mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
[hal,wpilib] Add support for joystick outputs (#8385)
Support joystick outputs, including Rumble and LEDs. Also requires an update to Joystick descriptors, as that has also changed in mrccomm to support showing what outputs are supported.
This commit is contained in:
@@ -53,86 +53,136 @@ static const uint8_t file_descriptor[] {
|
|||||||
0x0a,0x0d,0x43,0x75,0x72,0x72,0x65,0x6e,0x74,0x4f,
|
0x0a,0x0d,0x43,0x75,0x72,0x72,0x65,0x6e,0x74,0x4f,
|
||||||
0x70,0x4d,0x6f,0x64,0x65,0x18,0x04,0x20,0x01,0x28,
|
0x70,0x4d,0x6f,0x64,0x65,0x18,0x04,0x20,0x01,0x28,
|
||||||
0x06,0x52,0x0d,0x43,0x75,0x72,0x72,0x65,0x6e,0x74,
|
0x06,0x52,0x0d,0x43,0x75,0x72,0x72,0x65,0x6e,0x74,
|
||||||
0x4f,0x70,0x4d,0x6f,0x64,0x65,0x22,0x80,0x02,0x0a,
|
0x4f,0x70,0x4d,0x6f,0x64,0x65,0x22,0xac,0x01,0x0a,
|
||||||
0x1a,0x50,0x72,0x6f,0x74,0x6f,0x62,0x75,0x66,0x4a,
|
0x1a,0x50,0x72,0x6f,0x74,0x6f,0x62,0x75,0x66,0x4a,
|
||||||
0x6f,0x79,0x73,0x74,0x69,0x63,0x6b,0x44,0x65,0x73,
|
0x6f,0x79,0x73,0x74,0x69,0x63,0x6b,0x44,0x65,0x73,
|
||||||
0x63,0x72,0x69,0x70,0x74,0x6f,0x72,0x12,0x22,0x0a,
|
0x63,0x72,0x69,0x70,0x74,0x6f,0x72,0x12,0x22,0x0a,
|
||||||
0x0c,0x4a,0x6f,0x79,0x73,0x74,0x69,0x63,0x6b,0x4e,
|
0x0c,0x4a,0x6f,0x79,0x73,0x74,0x69,0x63,0x6b,0x4e,
|
||||||
0x61,0x6d,0x65,0x18,0x01,0x20,0x01,0x28,0x09,0x52,
|
0x61,0x6d,0x65,0x18,0x01,0x20,0x01,0x28,0x09,0x52,
|
||||||
0x0c,0x4a,0x6f,0x79,0x73,0x74,0x69,0x63,0x6b,0x4e,
|
0x0c,0x4a,0x6f,0x79,0x73,0x74,0x69,0x63,0x6b,0x4e,
|
||||||
0x61,0x6d,0x65,0x12,0x1c,0x0a,0x09,0x41,0x78,0x69,
|
0x61,0x6d,0x65,0x12,0x1c,0x0a,0x09,0x49,0x73,0x47,
|
||||||
0x73,0x54,0x79,0x70,0x65,0x73,0x18,0x02,0x20,0x03,
|
0x61,0x6d,0x65,0x70,0x61,0x64,0x18,0x02,0x20,0x01,
|
||||||
0x28,0x05,0x52,0x09,0x41,0x78,0x69,0x73,0x54,0x79,
|
|
||||||
0x70,0x65,0x73,0x12,0x1c,0x0a,0x09,0x49,0x73,0x47,
|
|
||||||
0x61,0x6d,0x65,0x70,0x61,0x64,0x18,0x03,0x20,0x01,
|
|
||||||
0x28,0x08,0x52,0x09,0x49,0x73,0x47,0x61,0x6d,0x65,
|
0x28,0x08,0x52,0x09,0x49,0x73,0x47,0x61,0x6d,0x65,
|
||||||
0x70,0x61,0x64,0x12,0x22,0x0a,0x0c,0x4a,0x6f,0x79,
|
0x70,0x61,0x64,0x12,0x20,0x0a,0x0b,0x47,0x61,0x6d,
|
||||||
0x73,0x74,0x69,0x63,0x6b,0x54,0x79,0x70,0x65,0x18,
|
0x65,0x70,0x61,0x64,0x54,0x79,0x70,0x65,0x18,0x03,
|
||||||
0x04,0x20,0x01,0x28,0x05,0x52,0x0c,0x4a,0x6f,0x79,
|
0x20,0x01,0x28,0x0d,0x52,0x0b,0x47,0x61,0x6d,0x65,
|
||||||
0x73,0x74,0x69,0x63,0x6b,0x54,0x79,0x70,0x65,0x12,
|
0x70,0x61,0x64,0x54,0x79,0x70,0x65,0x12,0x2a,0x0a,
|
||||||
0x20,0x0a,0x0b,0x42,0x75,0x74,0x74,0x6f,0x6e,0x43,
|
0x10,0x53,0x75,0x70,0x70,0x6f,0x72,0x74,0x65,0x64,
|
||||||
0x6f,0x75,0x6e,0x74,0x18,0x05,0x20,0x01,0x28,0x05,
|
0x4f,0x75,0x74,0x70,0x75,0x74,0x73,0x18,0x04,0x20,
|
||||||
0x52,0x0b,0x42,0x75,0x74,0x74,0x6f,0x6e,0x43,0x6f,
|
0x01,0x28,0x0d,0x52,0x10,0x53,0x75,0x70,0x70,0x6f,
|
||||||
0x75,0x6e,0x74,0x12,0x1a,0x0a,0x08,0x50,0x6f,0x76,
|
0x72,0x74,0x65,0x64,0x4f,0x75,0x74,0x70,0x75,0x74,
|
||||||
0x43,0x6f,0x75,0x6e,0x74,0x18,0x06,0x20,0x01,0x28,
|
0x73,0x22,0x66,0x0a,0x1b,0x50,0x72,0x6f,0x74,0x6f,
|
||||||
0x05,0x52,0x08,0x50,0x6f,0x76,0x43,0x6f,0x75,0x6e,
|
0x62,0x75,0x66,0x4a,0x6f,0x79,0x73,0x74,0x69,0x63,
|
||||||
0x74,0x12,0x20,0x0a,0x0b,0x52,0x75,0x6d,0x62,0x6c,
|
0x6b,0x44,0x65,0x73,0x63,0x72,0x69,0x70,0x74,0x6f,
|
||||||
0x65,0x43,0x6f,0x75,0x6e,0x74,0x18,0x07,0x20,0x01,
|
0x72,0x73,0x12,0x47,0x0a,0x0b,0x44,0x65,0x73,0x63,
|
||||||
0x28,0x05,0x52,0x0b,0x52,0x75,0x6d,0x62,0x6c,0x65,
|
0x72,0x69,0x70,0x74,0x6f,0x72,0x73,0x18,0x01,0x20,
|
||||||
0x43,0x6f,0x75,0x6e,0x74,0x22,0x32,0x0a,0x1a,0x50,
|
0x03,0x28,0x0b,0x32,0x25,0x2e,0x6d,0x72,0x63,0x2e,
|
||||||
|
0x70,0x72,0x6f,0x74,0x6f,0x2e,0x50,0x72,0x6f,0x74,
|
||||||
|
0x6f,0x62,0x75,0x66,0x4a,0x6f,0x79,0x73,0x74,0x69,
|
||||||
|
0x63,0x6b,0x44,0x65,0x73,0x63,0x72,0x69,0x70,0x74,
|
||||||
|
0x6f,0x72,0x52,0x0b,0x44,0x65,0x73,0x63,0x72,0x69,
|
||||||
|
0x70,0x74,0x6f,0x72,0x73,0x22,0x6a,0x0a,0x16,0x50,
|
||||||
0x72,0x6f,0x74,0x6f,0x62,0x75,0x66,0x4a,0x6f,0x79,
|
0x72,0x6f,0x74,0x6f,0x62,0x75,0x66,0x4a,0x6f,0x79,
|
||||||
0x73,0x74,0x69,0x63,0x6b,0x52,0x75,0x6d,0x62,0x6c,
|
0x73,0x74,0x69,0x63,0x6b,0x4f,0x75,0x74,0x70,0x75,
|
||||||
0x65,0x44,0x61,0x74,0x61,0x12,0x14,0x0a,0x05,0x56,
|
0x74,0x12,0x12,0x0a,0x04,0x4c,0x45,0x44,0x73,0x18,
|
||||||
0x61,0x6c,0x75,0x65,0x18,0x03,0x20,0x03,0x28,0x0d,
|
0x01,0x20,0x01,0x28,0x0d,0x52,0x04,0x4c,0x45,0x44,
|
||||||
0x52,0x05,0x56,0x61,0x6c,0x75,0x65,0x22,0x95,0x01,
|
0x73,0x12,0x16,0x0a,0x06,0x52,0x75,0x6d,0x62,0x6c,
|
||||||
0x0a,0x11,0x50,0x72,0x6f,0x74,0x6f,0x62,0x75,0x66,
|
0x65,0x18,0x02,0x20,0x01,0x28,0x0d,0x52,0x06,0x52,
|
||||||
0x4d,0x61,0x74,0x63,0x68,0x49,0x6e,0x66,0x6f,0x12,
|
0x75,0x6d,0x62,0x6c,0x65,0x12,0x24,0x0a,0x0d,0x54,
|
||||||
0x1c,0x0a,0x09,0x45,0x76,0x65,0x6e,0x74,0x4e,0x61,
|
0x72,0x69,0x67,0x67,0x65,0x72,0x52,0x75,0x6d,0x62,
|
||||||
0x6d,0x65,0x18,0x01,0x20,0x01,0x28,0x09,0x52,0x09,
|
0x6c,0x65,0x18,0x03,0x20,0x01,0x28,0x0d,0x52,0x0d,
|
||||||
0x45,0x76,0x65,0x6e,0x74,0x4e,0x61,0x6d,0x65,0x12,
|
0x54,0x72,0x69,0x67,0x67,0x65,0x72,0x52,0x75,0x6d,
|
||||||
0x20,0x0a,0x0b,0x4d,0x61,0x74,0x63,0x68,0x4e,0x75,
|
0x62,0x6c,0x65,0x22,0x56,0x0a,0x17,0x50,0x72,0x6f,
|
||||||
0x6d,0x62,0x65,0x72,0x18,0x02,0x20,0x01,0x28,0x05,
|
0x74,0x6f,0x62,0x75,0x66,0x4a,0x6f,0x79,0x73,0x74,
|
||||||
0x52,0x0b,0x4d,0x61,0x74,0x63,0x68,0x4e,0x75,0x6d,
|
0x69,0x63,0x6b,0x4f,0x75,0x74,0x70,0x75,0x74,0x73,
|
||||||
0x62,0x65,0x72,0x12,0x22,0x0a,0x0c,0x52,0x65,0x70,
|
0x12,0x3b,0x0a,0x07,0x4f,0x75,0x74,0x70,0x75,0x74,
|
||||||
0x6c,0x61,0x79,0x4e,0x75,0x6d,0x62,0x65,0x72,0x18,
|
0x73,0x18,0x01,0x20,0x03,0x28,0x0b,0x32,0x21,0x2e,
|
||||||
0x03,0x20,0x01,0x28,0x05,0x52,0x0c,0x52,0x65,0x70,
|
0x6d,0x72,0x63,0x2e,0x70,0x72,0x6f,0x74,0x6f,0x2e,
|
||||||
0x6c,0x61,0x79,0x4e,0x75,0x6d,0x62,0x65,0x72,0x12,
|
0x50,0x72,0x6f,0x74,0x6f,0x62,0x75,0x66,0x4a,0x6f,
|
||||||
0x1c,0x0a,0x09,0x4d,0x61,0x74,0x63,0x68,0x54,0x79,
|
0x79,0x73,0x74,0x69,0x63,0x6b,0x4f,0x75,0x74,0x70,
|
||||||
0x70,0x65,0x18,0x04,0x20,0x01,0x28,0x05,0x52,0x09,
|
0x75,0x74,0x52,0x07,0x4f,0x75,0x74,0x70,0x75,0x74,
|
||||||
0x4d,0x61,0x74,0x63,0x68,0x54,0x79,0x70,0x65,0x22,
|
0x73,0x22,0x95,0x01,0x0a,0x11,0x50,0x72,0x6f,0x74,
|
||||||
0x9f,0x01,0x0a,0x11,0x50,0x72,0x6f,0x74,0x6f,0x62,
|
0x6f,0x62,0x75,0x66,0x4d,0x61,0x74,0x63,0x68,0x49,
|
||||||
0x75,0x66,0x45,0x72,0x72,0x6f,0x72,0x49,0x6e,0x66,
|
0x6e,0x66,0x6f,0x12,0x1c,0x0a,0x09,0x45,0x76,0x65,
|
||||||
0x6f,0x12,0x18,0x0a,0x07,0x49,0x73,0x45,0x72,0x72,
|
0x6e,0x74,0x4e,0x61,0x6d,0x65,0x18,0x01,0x20,0x01,
|
||||||
0x6f,0x72,0x18,0x01,0x20,0x01,0x28,0x08,0x52,0x07,
|
0x28,0x09,0x52,0x09,0x45,0x76,0x65,0x6e,0x74,0x4e,
|
||||||
0x49,0x73,0x45,0x72,0x72,0x6f,0x72,0x12,0x1c,0x0a,
|
0x61,0x6d,0x65,0x12,0x20,0x0a,0x0b,0x4d,0x61,0x74,
|
||||||
0x09,0x45,0x72,0x72,0x6f,0x72,0x43,0x6f,0x64,0x65,
|
0x63,0x68,0x4e,0x75,0x6d,0x62,0x65,0x72,0x18,0x02,
|
||||||
0x18,0x02,0x20,0x01,0x28,0x11,0x52,0x09,0x45,0x72,
|
0x20,0x01,0x28,0x05,0x52,0x0b,0x4d,0x61,0x74,0x63,
|
||||||
0x72,0x6f,0x72,0x43,0x6f,0x64,0x65,0x12,0x18,0x0a,
|
0x68,0x4e,0x75,0x6d,0x62,0x65,0x72,0x12,0x22,0x0a,
|
||||||
0x07,0x44,0x65,0x74,0x61,0x69,0x6c,0x73,0x18,0x03,
|
0x0c,0x52,0x65,0x70,0x6c,0x61,0x79,0x4e,0x75,0x6d,
|
||||||
0x20,0x01,0x28,0x09,0x52,0x07,0x44,0x65,0x74,0x61,
|
0x62,0x65,0x72,0x18,0x03,0x20,0x01,0x28,0x05,0x52,
|
||||||
0x69,0x6c,0x73,0x12,0x1a,0x0a,0x08,0x4c,0x6f,0x63,
|
0x0c,0x52,0x65,0x70,0x6c,0x61,0x79,0x4e,0x75,0x6d,
|
||||||
0x61,0x74,0x69,0x6f,0x6e,0x18,0x04,0x20,0x01,0x28,
|
0x62,0x65,0x72,0x12,0x1c,0x0a,0x09,0x4d,0x61,0x74,
|
||||||
0x09,0x52,0x08,0x4c,0x6f,0x63,0x61,0x74,0x69,0x6f,
|
0x63,0x68,0x54,0x79,0x70,0x65,0x18,0x04,0x20,0x01,
|
||||||
0x6e,0x12,0x1c,0x0a,0x09,0x43,0x61,0x6c,0x6c,0x53,
|
0x28,0x05,0x52,0x09,0x4d,0x61,0x74,0x63,0x68,0x54,
|
||||||
0x74,0x61,0x63,0x6b,0x18,0x05,0x20,0x01,0x28,0x09,
|
0x79,0x70,0x65,0x22,0x9f,0x01,0x0a,0x11,0x50,0x72,
|
||||||
0x52,0x09,0x43,0x61,0x6c,0x6c,0x53,0x74,0x61,0x63,
|
0x6f,0x74,0x6f,0x62,0x75,0x66,0x45,0x72,0x72,0x6f,
|
||||||
0x6b,0x22,0x38,0x0a,0x0e,0x50,0x72,0x6f,0x74,0x6f,
|
0x72,0x49,0x6e,0x66,0x6f,0x12,0x18,0x0a,0x07,0x49,
|
||||||
0x62,0x75,0x66,0x4f,0x70,0x4d,0x6f,0x64,0x65,0x12,
|
0x73,0x45,0x72,0x72,0x6f,0x72,0x18,0x01,0x20,0x01,
|
||||||
0x12,0x0a,0x04,0x48,0x61,0x73,0x68,0x18,0x01,0x20,
|
0x28,0x08,0x52,0x07,0x49,0x73,0x45,0x72,0x72,0x6f,
|
||||||
0x01,0x28,0x06,0x52,0x04,0x48,0x61,0x73,0x68,0x12,
|
0x72,0x12,0x1c,0x0a,0x09,0x45,0x72,0x72,0x6f,0x72,
|
||||||
0x12,0x0a,0x04,0x4e,0x61,0x6d,0x65,0x18,0x02,0x20,
|
0x43,0x6f,0x64,0x65,0x18,0x02,0x20,0x01,0x28,0x11,
|
||||||
0x01,0x28,0x09,0x52,0x04,0x4e,0x61,0x6d,0x65,0x22,
|
0x52,0x09,0x45,0x72,0x72,0x6f,0x72,0x43,0x6f,0x64,
|
||||||
0x4b,0x0a,0x18,0x50,0x72,0x6f,0x74,0x6f,0x62,0x75,
|
0x65,0x12,0x18,0x0a,0x07,0x44,0x65,0x74,0x61,0x69,
|
||||||
0x66,0x41,0x76,0x61,0x69,0x6c,0x61,0x62,0x6c,0x65,
|
0x6c,0x73,0x18,0x03,0x20,0x01,0x28,0x09,0x52,0x07,
|
||||||
0x4f,0x70,0x4d,0x6f,0x64,0x65,0x73,0x12,0x2f,0x0a,
|
0x44,0x65,0x74,0x61,0x69,0x6c,0x73,0x12,0x1a,0x0a,
|
||||||
0x05,0x4d,0x6f,0x64,0x65,0x73,0x18,0x01,0x20,0x03,
|
0x08,0x4c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x18,
|
||||||
0x28,0x0b,0x32,0x19,0x2e,0x6d,0x72,0x63,0x2e,0x70,
|
0x04,0x20,0x01,0x28,0x09,0x52,0x08,0x4c,0x6f,0x63,
|
||||||
0x72,0x6f,0x74,0x6f,0x2e,0x50,0x72,0x6f,0x74,0x6f,
|
0x61,0x74,0x69,0x6f,0x6e,0x12,0x1c,0x0a,0x09,0x43,
|
||||||
0x62,0x75,0x66,0x4f,0x70,0x4d,0x6f,0x64,0x65,0x52,
|
0x61,0x6c,0x6c,0x53,0x74,0x61,0x63,0x6b,0x18,0x05,
|
||||||
0x05,0x4d,0x6f,0x64,0x65,0x73,0x42,0x0f,0x0a,0x0d,
|
0x20,0x01,0x28,0x09,0x52,0x09,0x43,0x61,0x6c,0x6c,
|
||||||
|
0x53,0x74,0x61,0x63,0x6b,0x22,0x38,0x0a,0x0e,0x50,
|
||||||
|
0x72,0x6f,0x74,0x6f,0x62,0x75,0x66,0x4f,0x70,0x4d,
|
||||||
|
0x6f,0x64,0x65,0x12,0x12,0x0a,0x04,0x48,0x61,0x73,
|
||||||
|
0x68,0x18,0x01,0x20,0x01,0x28,0x06,0x52,0x04,0x48,
|
||||||
|
0x61,0x73,0x68,0x12,0x12,0x0a,0x04,0x4e,0x61,0x6d,
|
||||||
|
0x65,0x18,0x02,0x20,0x01,0x28,0x09,0x52,0x04,0x4e,
|
||||||
|
0x61,0x6d,0x65,0x22,0x4b,0x0a,0x18,0x50,0x72,0x6f,
|
||||||
|
0x74,0x6f,0x62,0x75,0x66,0x41,0x76,0x61,0x69,0x6c,
|
||||||
|
0x61,0x62,0x6c,0x65,0x4f,0x70,0x4d,0x6f,0x64,0x65,
|
||||||
|
0x73,0x12,0x2f,0x0a,0x05,0x4d,0x6f,0x64,0x65,0x73,
|
||||||
|
0x18,0x01,0x20,0x03,0x28,0x0b,0x32,0x19,0x2e,0x6d,
|
||||||
|
0x72,0x63,0x2e,0x70,0x72,0x6f,0x74,0x6f,0x2e,0x50,
|
||||||
|
0x72,0x6f,0x74,0x6f,0x62,0x75,0x66,0x4f,0x70,0x4d,
|
||||||
|
0x6f,0x64,0x65,0x52,0x05,0x4d,0x6f,0x64,0x65,0x73,
|
||||||
|
0x22,0xc4,0x01,0x0a,0x1a,0x50,0x72,0x6f,0x74,0x6f,
|
||||||
|
0x62,0x75,0x66,0x45,0x72,0x72,0x6f,0x72,0x49,0x6e,
|
||||||
|
0x66,0x6f,0x54,0x69,0x6d,0x65,0x73,0x74,0x61,0x6d,
|
||||||
|
0x70,0x12,0x3a,0x0a,0x09,0x45,0x72,0x72,0x6f,0x72,
|
||||||
|
0x49,0x6e,0x66,0x6f,0x18,0x01,0x20,0x01,0x28,0x0b,
|
||||||
|
0x32,0x1c,0x2e,0x6d,0x72,0x63,0x2e,0x70,0x72,0x6f,
|
||||||
|
0x74,0x6f,0x2e,0x50,0x72,0x6f,0x74,0x6f,0x62,0x75,
|
||||||
|
0x66,0x45,0x72,0x72,0x6f,0x72,0x49,0x6e,0x66,0x6f,
|
||||||
|
0x52,0x09,0x45,0x72,0x72,0x6f,0x72,0x49,0x6e,0x66,
|
||||||
|
0x6f,0x12,0x1c,0x0a,0x09,0x54,0x69,0x6d,0x65,0x73,
|
||||||
|
0x74,0x61,0x6d,0x70,0x18,0x02,0x20,0x01,0x28,0x04,
|
||||||
|
0x52,0x09,0x54,0x69,0x6d,0x65,0x73,0x74,0x61,0x6d,
|
||||||
|
0x70,0x12,0x26,0x0a,0x0e,0x53,0x65,0x71,0x75,0x65,
|
||||||
|
0x6e,0x63,0x65,0x4e,0x75,0x6d,0x62,0x65,0x72,0x18,
|
||||||
|
0x03,0x20,0x01,0x28,0x05,0x52,0x0e,0x53,0x65,0x71,
|
||||||
|
0x75,0x65,0x6e,0x63,0x65,0x4e,0x75,0x6d,0x62,0x65,
|
||||||
|
0x72,0x12,0x24,0x0a,0x0d,0x4e,0x75,0x6d,0x4f,0x63,
|
||||||
|
0x63,0x75,0x72,0x61,0x6e,0x63,0x65,0x73,0x18,0x04,
|
||||||
|
0x20,0x01,0x28,0x05,0x52,0x0d,0x4e,0x75,0x6d,0x4f,
|
||||||
|
0x63,0x63,0x75,0x72,0x61,0x6e,0x63,0x65,0x73,0x22,
|
||||||
|
0x86,0x01,0x0a,0x1c,0x50,0x72,0x6f,0x74,0x6f,0x62,
|
||||||
|
0x75,0x66,0x43,0x6f,0x6e,0x73,0x6f,0x6c,0x65,0x4c,
|
||||||
|
0x69,0x6e,0x65,0x54,0x69,0x6d,0x65,0x73,0x74,0x61,
|
||||||
|
0x6d,0x70,0x12,0x20,0x0a,0x0b,0x43,0x6f,0x6e,0x73,
|
||||||
|
0x6f,0x6c,0x65,0x4c,0x69,0x6e,0x65,0x18,0x01,0x20,
|
||||||
|
0x01,0x28,0x09,0x52,0x0b,0x43,0x6f,0x6e,0x73,0x6f,
|
||||||
|
0x6c,0x65,0x4c,0x69,0x6e,0x65,0x12,0x1c,0x0a,0x09,
|
||||||
|
0x54,0x69,0x6d,0x65,0x73,0x74,0x61,0x6d,0x70,0x18,
|
||||||
|
0x02,0x20,0x01,0x28,0x04,0x52,0x09,0x54,0x69,0x6d,
|
||||||
|
0x65,0x73,0x74,0x61,0x6d,0x70,0x12,0x26,0x0a,0x0e,
|
||||||
|
0x53,0x65,0x71,0x75,0x65,0x6e,0x63,0x65,0x4e,0x75,
|
||||||
|
0x6d,0x62,0x65,0x72,0x18,0x03,0x20,0x01,0x28,0x05,
|
||||||
|
0x52,0x0e,0x53,0x65,0x71,0x75,0x65,0x6e,0x63,0x65,
|
||||||
|
0x4e,0x75,0x6d,0x62,0x65,0x72,0x42,0x0f,0x0a,0x0d,
|
||||||
0x63,0x6f,0x6d,0x2e,0x6d,0x72,0x63,0x2e,0x70,0x72,
|
0x63,0x6f,0x6d,0x2e,0x6d,0x72,0x63,0x2e,0x70,0x72,
|
||||||
0x6f,0x74,0x6f,0x4a,0xdc,0x0f,0x0a,0x06,0x12,0x04,
|
0x6f,0x74,0x6f,0x4a,0xb4,0x14,0x0a,0x06,0x12,0x04,
|
||||||
0x00,0x00,0x3c,0x01,0x0a,0x08,0x0a,0x01,0x0c,0x12,
|
0x00,0x00,0x50,0x01,0x0a,0x08,0x0a,0x01,0x0c,0x12,
|
||||||
0x03,0x00,0x00,0x12,0x0a,0x08,0x0a,0x01,0x02,0x12,
|
0x03,0x00,0x00,0x12,0x0a,0x08,0x0a,0x01,0x02,0x12,
|
||||||
0x03,0x02,0x00,0x12,0x0a,0x08,0x0a,0x01,0x08,0x12,
|
0x03,0x02,0x00,0x12,0x0a,0x08,0x0a,0x01,0x08,0x12,
|
||||||
0x03,0x04,0x00,0x26,0x0a,0x09,0x0a,0x02,0x08,0x01,
|
0x03,0x04,0x00,0x26,0x0a,0x09,0x0a,0x02,0x08,0x01,
|
||||||
@@ -205,7 +255,7 @@ static const uint8_t file_descriptor[] {
|
|||||||
0x02,0x03,0x01,0x12,0x03,0x15,0x0c,0x19,0x0a,0x0c,
|
0x02,0x03,0x01,0x12,0x03,0x15,0x0c,0x19,0x0a,0x0c,
|
||||||
0x0a,0x05,0x04,0x01,0x02,0x03,0x03,0x12,0x03,0x15,
|
0x0a,0x05,0x04,0x01,0x02,0x03,0x03,0x12,0x03,0x15,
|
||||||
0x1c,0x1d,0x0a,0x0a,0x0a,0x02,0x04,0x02,0x12,0x04,
|
0x1c,0x1d,0x0a,0x0a,0x0a,0x02,0x04,0x02,0x12,0x04,
|
||||||
0x18,0x00,0x20,0x01,0x0a,0x0a,0x0a,0x03,0x04,0x02,
|
0x18,0x00,0x1d,0x01,0x0a,0x0a,0x0a,0x03,0x04,0x02,
|
||||||
0x01,0x12,0x03,0x18,0x08,0x22,0x0a,0x0b,0x0a,0x04,
|
0x01,0x12,0x03,0x18,0x08,0x22,0x0a,0x0b,0x0a,0x04,
|
||||||
0x04,0x02,0x02,0x00,0x12,0x03,0x19,0x04,0x1c,0x0a,
|
0x04,0x02,0x02,0x00,0x12,0x03,0x19,0x04,0x1c,0x0a,
|
||||||
0x0c,0x0a,0x05,0x04,0x02,0x02,0x00,0x05,0x12,0x03,
|
0x0c,0x0a,0x05,0x04,0x02,0x02,0x00,0x05,0x12,0x03,
|
||||||
@@ -213,126 +263,186 @@ static const uint8_t file_descriptor[] {
|
|||||||
0x00,0x01,0x12,0x03,0x19,0x0b,0x17,0x0a,0x0c,0x0a,
|
0x00,0x01,0x12,0x03,0x19,0x0b,0x17,0x0a,0x0c,0x0a,
|
||||||
0x05,0x04,0x02,0x02,0x00,0x03,0x12,0x03,0x19,0x1a,
|
0x05,0x04,0x02,0x02,0x00,0x03,0x12,0x03,0x19,0x1a,
|
||||||
0x1b,0x0a,0x0b,0x0a,0x04,0x04,0x02,0x02,0x01,0x12,
|
0x1b,0x0a,0x0b,0x0a,0x04,0x04,0x02,0x02,0x01,0x12,
|
||||||
0x03,0x1a,0x04,0x21,0x0a,0x0c,0x0a,0x05,0x04,0x02,
|
0x03,0x1a,0x04,0x17,0x0a,0x0c,0x0a,0x05,0x04,0x02,
|
||||||
0x02,0x01,0x04,0x12,0x03,0x1a,0x04,0x0c,0x0a,0x0c,
|
0x02,0x01,0x05,0x12,0x03,0x1a,0x04,0x08,0x0a,0x0c,
|
||||||
0x0a,0x05,0x04,0x02,0x02,0x01,0x05,0x12,0x03,0x1a,
|
0x0a,0x05,0x04,0x02,0x02,0x01,0x01,0x12,0x03,0x1a,
|
||||||
0x0d,0x12,0x0a,0x0c,0x0a,0x05,0x04,0x02,0x02,0x01,
|
0x09,0x12,0x0a,0x0c,0x0a,0x05,0x04,0x02,0x02,0x01,
|
||||||
0x01,0x12,0x03,0x1a,0x13,0x1c,0x0a,0x0c,0x0a,0x05,
|
0x03,0x12,0x03,0x1a,0x15,0x16,0x0a,0x0b,0x0a,0x04,
|
||||||
0x04,0x02,0x02,0x01,0x03,0x12,0x03,0x1a,0x1f,0x20,
|
0x04,0x02,0x02,0x02,0x12,0x03,0x1b,0x04,0x1b,0x0a,
|
||||||
0x0a,0x0b,0x0a,0x04,0x04,0x02,0x02,0x02,0x12,0x03,
|
0x0c,0x0a,0x05,0x04,0x02,0x02,0x02,0x05,0x12,0x03,
|
||||||
0x1b,0x04,0x17,0x0a,0x0c,0x0a,0x05,0x04,0x02,0x02,
|
0x1b,0x04,0x0a,0x0a,0x0c,0x0a,0x05,0x04,0x02,0x02,
|
||||||
0x02,0x05,0x12,0x03,0x1b,0x04,0x08,0x0a,0x0c,0x0a,
|
0x02,0x01,0x12,0x03,0x1b,0x0b,0x16,0x0a,0x0c,0x0a,
|
||||||
0x05,0x04,0x02,0x02,0x02,0x01,0x12,0x03,0x1b,0x09,
|
0x05,0x04,0x02,0x02,0x02,0x03,0x12,0x03,0x1b,0x19,
|
||||||
0x12,0x0a,0x0c,0x0a,0x05,0x04,0x02,0x02,0x02,0x03,
|
0x1a,0x0a,0x0b,0x0a,0x04,0x04,0x02,0x02,0x03,0x12,
|
||||||
0x12,0x03,0x1b,0x15,0x16,0x0a,0x0b,0x0a,0x04,0x04,
|
0x03,0x1c,0x04,0x20,0x0a,0x0c,0x0a,0x05,0x04,0x02,
|
||||||
0x02,0x02,0x03,0x12,0x03,0x1c,0x04,0x1b,0x0a,0x0c,
|
0x02,0x03,0x05,0x12,0x03,0x1c,0x04,0x0a,0x0a,0x0c,
|
||||||
0x0a,0x05,0x04,0x02,0x02,0x03,0x05,0x12,0x03,0x1c,
|
0x0a,0x05,0x04,0x02,0x02,0x03,0x01,0x12,0x03,0x1c,
|
||||||
0x04,0x09,0x0a,0x0c,0x0a,0x05,0x04,0x02,0x02,0x03,
|
0x0b,0x1b,0x0a,0x0c,0x0a,0x05,0x04,0x02,0x02,0x03,
|
||||||
0x01,0x12,0x03,0x1c,0x0a,0x16,0x0a,0x0c,0x0a,0x05,
|
0x03,0x12,0x03,0x1c,0x1e,0x1f,0x0a,0x0a,0x0a,0x02,
|
||||||
0x04,0x02,0x02,0x03,0x03,0x12,0x03,0x1c,0x19,0x1a,
|
0x04,0x03,0x12,0x04,0x1f,0x00,0x21,0x01,0x0a,0x0a,
|
||||||
0x0a,0x0b,0x0a,0x04,0x04,0x02,0x02,0x04,0x12,0x03,
|
0x0a,0x03,0x04,0x03,0x01,0x12,0x03,0x1f,0x08,0x23,
|
||||||
0x1d,0x04,0x1a,0x0a,0x0c,0x0a,0x05,0x04,0x02,0x02,
|
0x0a,0x0b,0x0a,0x04,0x04,0x03,0x02,0x00,0x12,0x03,
|
||||||
0x04,0x05,0x12,0x03,0x1d,0x04,0x09,0x0a,0x0c,0x0a,
|
0x20,0x04,0x38,0x0a,0x0c,0x0a,0x05,0x04,0x03,0x02,
|
||||||
0x05,0x04,0x02,0x02,0x04,0x01,0x12,0x03,0x1d,0x0a,
|
0x00,0x04,0x12,0x03,0x20,0x04,0x0c,0x0a,0x0c,0x0a,
|
||||||
0x15,0x0a,0x0c,0x0a,0x05,0x04,0x02,0x02,0x04,0x03,
|
0x05,0x04,0x03,0x02,0x00,0x06,0x12,0x03,0x20,0x0d,
|
||||||
0x12,0x03,0x1d,0x18,0x19,0x0a,0x0b,0x0a,0x04,0x04,
|
0x27,0x0a,0x0c,0x0a,0x05,0x04,0x03,0x02,0x00,0x01,
|
||||||
0x02,0x02,0x05,0x12,0x03,0x1e,0x04,0x17,0x0a,0x0c,
|
0x12,0x03,0x20,0x28,0x33,0x0a,0x0c,0x0a,0x05,0x04,
|
||||||
0x0a,0x05,0x04,0x02,0x02,0x05,0x05,0x12,0x03,0x1e,
|
0x03,0x02,0x00,0x03,0x12,0x03,0x20,0x36,0x37,0x0a,
|
||||||
0x04,0x09,0x0a,0x0c,0x0a,0x05,0x04,0x02,0x02,0x05,
|
0x0a,0x0a,0x02,0x04,0x04,0x12,0x04,0x23,0x00,0x27,
|
||||||
0x01,0x12,0x03,0x1e,0x0a,0x12,0x0a,0x0c,0x0a,0x05,
|
0x01,0x0a,0x0a,0x0a,0x03,0x04,0x04,0x01,0x12,0x03,
|
||||||
0x04,0x02,0x02,0x05,0x03,0x12,0x03,0x1e,0x15,0x16,
|
0x23,0x08,0x1e,0x0a,0x0b,0x0a,0x04,0x04,0x04,0x02,
|
||||||
0x0a,0x0b,0x0a,0x04,0x04,0x02,0x02,0x06,0x12,0x03,
|
0x00,0x12,0x03,0x24,0x04,0x14,0x0a,0x0c,0x0a,0x05,
|
||||||
0x1f,0x04,0x1a,0x0a,0x0c,0x0a,0x05,0x04,0x02,0x02,
|
0x04,0x04,0x02,0x00,0x05,0x12,0x03,0x24,0x04,0x0a,
|
||||||
0x06,0x05,0x12,0x03,0x1f,0x04,0x09,0x0a,0x0c,0x0a,
|
0x0a,0x0c,0x0a,0x05,0x04,0x04,0x02,0x00,0x01,0x12,
|
||||||
0x05,0x04,0x02,0x02,0x06,0x01,0x12,0x03,0x1f,0x0a,
|
0x03,0x24,0x0b,0x0f,0x0a,0x0c,0x0a,0x05,0x04,0x04,
|
||||||
0x15,0x0a,0x0c,0x0a,0x05,0x04,0x02,0x02,0x06,0x03,
|
0x02,0x00,0x03,0x12,0x03,0x24,0x12,0x13,0x0a,0x2b,
|
||||||
0x12,0x03,0x1f,0x18,0x19,0x0a,0x0a,0x0a,0x02,0x04,
|
0x0a,0x04,0x04,0x04,0x02,0x01,0x12,0x03,0x25,0x04,
|
||||||
0x03,0x12,0x04,0x22,0x00,0x24,0x01,0x0a,0x0a,0x0a,
|
0x16,0x22,0x1e,0x20,0x31,0x36,0x20,0x62,0x69,0x74,
|
||||||
0x03,0x04,0x03,0x01,0x12,0x03,0x22,0x08,0x22,0x0a,
|
0x73,0x2c,0x20,0x6c,0x65,0x66,0x74,0x20,0x6d,0x73,
|
||||||
0x0b,0x0a,0x04,0x04,0x03,0x02,0x00,0x12,0x03,0x23,
|
0x62,0x2c,0x20,0x72,0x69,0x67,0x68,0x74,0x20,0x6c,
|
||||||
0x04,0x1e,0x0a,0x0c,0x0a,0x05,0x04,0x03,0x02,0x00,
|
0x73,0x62,0x0a,0x0a,0x0c,0x0a,0x05,0x04,0x04,0x02,
|
||||||
0x04,0x12,0x03,0x23,0x04,0x0c,0x0a,0x0c,0x0a,0x05,
|
0x01,0x05,0x12,0x03,0x25,0x04,0x0a,0x0a,0x0c,0x0a,
|
||||||
0x04,0x03,0x02,0x00,0x05,0x12,0x03,0x23,0x0d,0x13,
|
0x05,0x04,0x04,0x02,0x01,0x01,0x12,0x03,0x25,0x0b,
|
||||||
0x0a,0x0c,0x0a,0x05,0x04,0x03,0x02,0x00,0x01,0x12,
|
0x11,0x0a,0x0c,0x0a,0x05,0x04,0x04,0x02,0x01,0x03,
|
||||||
0x03,0x23,0x14,0x19,0x0a,0x0c,0x0a,0x05,0x04,0x03,
|
0x12,0x03,0x25,0x14,0x15,0x0a,0x2b,0x0a,0x04,0x04,
|
||||||
0x02,0x00,0x03,0x12,0x03,0x23,0x1c,0x1d,0x0a,0x0a,
|
0x04,0x02,0x02,0x12,0x03,0x26,0x04,0x1d,0x22,0x1e,
|
||||||
0x0a,0x02,0x04,0x04,0x12,0x04,0x26,0x00,0x2b,0x01,
|
0x20,0x31,0x36,0x20,0x62,0x69,0x74,0x73,0x2c,0x20,
|
||||||
0x0a,0x0a,0x0a,0x03,0x04,0x04,0x01,0x12,0x03,0x26,
|
0x6c,0x65,0x66,0x74,0x20,0x6d,0x73,0x62,0x2c,0x20,
|
||||||
0x08,0x19,0x0a,0x0b,0x0a,0x04,0x04,0x04,0x02,0x00,
|
0x72,0x69,0x67,0x68,0x74,0x20,0x6c,0x73,0x62,0x0a,
|
||||||
0x12,0x03,0x27,0x04,0x19,0x0a,0x0c,0x0a,0x05,0x04,
|
0x0a,0x0c,0x0a,0x05,0x04,0x04,0x02,0x02,0x05,0x12,
|
||||||
0x04,0x02,0x00,0x05,0x12,0x03,0x27,0x04,0x0a,0x0a,
|
0x03,0x26,0x04,0x0a,0x0a,0x0c,0x0a,0x05,0x04,0x04,
|
||||||
0x0c,0x0a,0x05,0x04,0x04,0x02,0x00,0x01,0x12,0x03,
|
0x02,0x02,0x01,0x12,0x03,0x26,0x0b,0x18,0x0a,0x0c,
|
||||||
0x27,0x0b,0x14,0x0a,0x0c,0x0a,0x05,0x04,0x04,0x02,
|
0x0a,0x05,0x04,0x04,0x02,0x02,0x03,0x12,0x03,0x26,
|
||||||
0x00,0x03,0x12,0x03,0x27,0x17,0x18,0x0a,0x0b,0x0a,
|
0x1b,0x1c,0x0a,0x0a,0x0a,0x02,0x04,0x05,0x12,0x04,
|
||||||
0x04,0x04,0x04,0x02,0x01,0x12,0x03,0x28,0x04,0x1a,
|
0x29,0x00,0x2b,0x01,0x0a,0x0a,0x0a,0x03,0x04,0x05,
|
||||||
0x0a,0x0c,0x0a,0x05,0x04,0x04,0x02,0x01,0x05,0x12,
|
0x01,0x12,0x03,0x29,0x08,0x1f,0x0a,0x0b,0x0a,0x04,
|
||||||
0x03,0x28,0x04,0x09,0x0a,0x0c,0x0a,0x05,0x04,0x04,
|
0x04,0x05,0x02,0x00,0x12,0x03,0x2a,0x04,0x30,0x0a,
|
||||||
0x02,0x01,0x01,0x12,0x03,0x28,0x0a,0x15,0x0a,0x0c,
|
0x0c,0x0a,0x05,0x04,0x05,0x02,0x00,0x04,0x12,0x03,
|
||||||
0x0a,0x05,0x04,0x04,0x02,0x01,0x03,0x12,0x03,0x28,
|
0x2a,0x04,0x0c,0x0a,0x0c,0x0a,0x05,0x04,0x05,0x02,
|
||||||
0x18,0x19,0x0a,0x0b,0x0a,0x04,0x04,0x04,0x02,0x02,
|
0x00,0x06,0x12,0x03,0x2a,0x0d,0x23,0x0a,0x0c,0x0a,
|
||||||
0x12,0x03,0x29,0x04,0x1b,0x0a,0x0c,0x0a,0x05,0x04,
|
0x05,0x04,0x05,0x02,0x00,0x01,0x12,0x03,0x2a,0x24,
|
||||||
0x04,0x02,0x02,0x05,0x12,0x03,0x29,0x04,0x09,0x0a,
|
0x2b,0x0a,0x0c,0x0a,0x05,0x04,0x05,0x02,0x00,0x03,
|
||||||
0x0c,0x0a,0x05,0x04,0x04,0x02,0x02,0x01,0x12,0x03,
|
0x12,0x03,0x2a,0x2e,0x2f,0x0a,0x0a,0x0a,0x02,0x04,
|
||||||
0x29,0x0a,0x16,0x0a,0x0c,0x0a,0x05,0x04,0x04,0x02,
|
0x06,0x12,0x04,0x2d,0x00,0x32,0x01,0x0a,0x0a,0x0a,
|
||||||
0x02,0x03,0x12,0x03,0x29,0x19,0x1a,0x0a,0x0b,0x0a,
|
0x03,0x04,0x06,0x01,0x12,0x03,0x2d,0x08,0x19,0x0a,
|
||||||
0x04,0x04,0x04,0x02,0x03,0x12,0x03,0x2a,0x04,0x18,
|
0x0b,0x0a,0x04,0x04,0x06,0x02,0x00,0x12,0x03,0x2e,
|
||||||
0x0a,0x0c,0x0a,0x05,0x04,0x04,0x02,0x03,0x05,0x12,
|
0x04,0x19,0x0a,0x0c,0x0a,0x05,0x04,0x06,0x02,0x00,
|
||||||
0x03,0x2a,0x04,0x09,0x0a,0x0c,0x0a,0x05,0x04,0x04,
|
0x05,0x12,0x03,0x2e,0x04,0x0a,0x0a,0x0c,0x0a,0x05,
|
||||||
0x02,0x03,0x01,0x12,0x03,0x2a,0x0a,0x13,0x0a,0x0c,
|
0x04,0x06,0x02,0x00,0x01,0x12,0x03,0x2e,0x0b,0x14,
|
||||||
0x0a,0x05,0x04,0x04,0x02,0x03,0x03,0x12,0x03,0x2a,
|
0x0a,0x0c,0x0a,0x05,0x04,0x06,0x02,0x00,0x03,0x12,
|
||||||
0x16,0x17,0x0a,0x0a,0x0a,0x02,0x04,0x05,0x12,0x04,
|
0x03,0x2e,0x17,0x18,0x0a,0x0b,0x0a,0x04,0x04,0x06,
|
||||||
0x2d,0x00,0x33,0x01,0x0a,0x0a,0x0a,0x03,0x04,0x05,
|
0x02,0x01,0x12,0x03,0x2f,0x04,0x1a,0x0a,0x0c,0x0a,
|
||||||
0x01,0x12,0x03,0x2d,0x08,0x19,0x0a,0x0b,0x0a,0x04,
|
0x05,0x04,0x06,0x02,0x01,0x05,0x12,0x03,0x2f,0x04,
|
||||||
0x04,0x05,0x02,0x00,0x12,0x03,0x2e,0x04,0x15,0x0a,
|
0x09,0x0a,0x0c,0x0a,0x05,0x04,0x06,0x02,0x01,0x01,
|
||||||
0x0c,0x0a,0x05,0x04,0x05,0x02,0x00,0x05,0x12,0x03,
|
0x12,0x03,0x2f,0x0a,0x15,0x0a,0x0c,0x0a,0x05,0x04,
|
||||||
0x2e,0x04,0x08,0x0a,0x0c,0x0a,0x05,0x04,0x05,0x02,
|
0x06,0x02,0x01,0x03,0x12,0x03,0x2f,0x18,0x19,0x0a,
|
||||||
0x00,0x01,0x12,0x03,0x2e,0x09,0x10,0x0a,0x0c,0x0a,
|
0x0b,0x0a,0x04,0x04,0x06,0x02,0x02,0x12,0x03,0x30,
|
||||||
0x05,0x04,0x05,0x02,0x00,0x03,0x12,0x03,0x2e,0x13,
|
0x04,0x1b,0x0a,0x0c,0x0a,0x05,0x04,0x06,0x02,0x02,
|
||||||
0x14,0x0a,0x0b,0x0a,0x04,0x04,0x05,0x02,0x01,0x12,
|
0x05,0x12,0x03,0x30,0x04,0x09,0x0a,0x0c,0x0a,0x05,
|
||||||
0x03,0x2f,0x04,0x19,0x0a,0x0c,0x0a,0x05,0x04,0x05,
|
0x04,0x06,0x02,0x02,0x01,0x12,0x03,0x30,0x0a,0x16,
|
||||||
0x02,0x01,0x05,0x12,0x03,0x2f,0x04,0x0a,0x0a,0x0c,
|
0x0a,0x0c,0x0a,0x05,0x04,0x06,0x02,0x02,0x03,0x12,
|
||||||
0x0a,0x05,0x04,0x05,0x02,0x01,0x01,0x12,0x03,0x2f,
|
0x03,0x30,0x19,0x1a,0x0a,0x0b,0x0a,0x04,0x04,0x06,
|
||||||
0x0b,0x14,0x0a,0x0c,0x0a,0x05,0x04,0x05,0x02,0x01,
|
0x02,0x03,0x12,0x03,0x31,0x04,0x18,0x0a,0x0c,0x0a,
|
||||||
0x03,0x12,0x03,0x2f,0x17,0x18,0x0a,0x0b,0x0a,0x04,
|
0x05,0x04,0x06,0x02,0x03,0x05,0x12,0x03,0x31,0x04,
|
||||||
0x04,0x05,0x02,0x02,0x12,0x03,0x30,0x04,0x17,0x0a,
|
0x09,0x0a,0x0c,0x0a,0x05,0x04,0x06,0x02,0x03,0x01,
|
||||||
0x0c,0x0a,0x05,0x04,0x05,0x02,0x02,0x05,0x12,0x03,
|
0x12,0x03,0x31,0x0a,0x13,0x0a,0x0c,0x0a,0x05,0x04,
|
||||||
0x30,0x04,0x0a,0x0a,0x0c,0x0a,0x05,0x04,0x05,0x02,
|
0x06,0x02,0x03,0x03,0x12,0x03,0x31,0x16,0x17,0x0a,
|
||||||
0x02,0x01,0x12,0x03,0x30,0x0b,0x12,0x0a,0x0c,0x0a,
|
0x0a,0x0a,0x02,0x04,0x07,0x12,0x04,0x34,0x00,0x3a,
|
||||||
0x05,0x04,0x05,0x02,0x02,0x03,0x12,0x03,0x30,0x15,
|
0x01,0x0a,0x0a,0x0a,0x03,0x04,0x07,0x01,0x12,0x03,
|
||||||
0x16,0x0a,0x0b,0x0a,0x04,0x04,0x05,0x02,0x03,0x12,
|
0x34,0x08,0x19,0x0a,0x0b,0x0a,0x04,0x04,0x07,0x02,
|
||||||
0x03,0x31,0x04,0x18,0x0a,0x0c,0x0a,0x05,0x04,0x05,
|
0x00,0x12,0x03,0x35,0x04,0x15,0x0a,0x0c,0x0a,0x05,
|
||||||
0x02,0x03,0x05,0x12,0x03,0x31,0x04,0x0a,0x0a,0x0c,
|
0x04,0x07,0x02,0x00,0x05,0x12,0x03,0x35,0x04,0x08,
|
||||||
0x0a,0x05,0x04,0x05,0x02,0x03,0x01,0x12,0x03,0x31,
|
|
||||||
0x0b,0x13,0x0a,0x0c,0x0a,0x05,0x04,0x05,0x02,0x03,
|
|
||||||
0x03,0x12,0x03,0x31,0x16,0x17,0x0a,0x0b,0x0a,0x04,
|
|
||||||
0x04,0x05,0x02,0x04,0x12,0x03,0x32,0x04,0x19,0x0a,
|
|
||||||
0x0c,0x0a,0x05,0x04,0x05,0x02,0x04,0x05,0x12,0x03,
|
|
||||||
0x32,0x04,0x0a,0x0a,0x0c,0x0a,0x05,0x04,0x05,0x02,
|
|
||||||
0x04,0x01,0x12,0x03,0x32,0x0b,0x14,0x0a,0x0c,0x0a,
|
|
||||||
0x05,0x04,0x05,0x02,0x04,0x03,0x12,0x03,0x32,0x17,
|
|
||||||
0x18,0x0a,0x0a,0x0a,0x02,0x04,0x06,0x12,0x04,0x35,
|
|
||||||
0x00,0x38,0x01,0x0a,0x0a,0x0a,0x03,0x04,0x06,0x01,
|
|
||||||
0x12,0x03,0x35,0x08,0x16,0x0a,0x0b,0x0a,0x04,0x04,
|
|
||||||
0x06,0x02,0x00,0x12,0x03,0x36,0x04,0x15,0x0a,0x0c,
|
|
||||||
0x0a,0x05,0x04,0x06,0x02,0x00,0x05,0x12,0x03,0x36,
|
|
||||||
0x04,0x0b,0x0a,0x0c,0x0a,0x05,0x04,0x06,0x02,0x00,
|
|
||||||
0x01,0x12,0x03,0x36,0x0c,0x10,0x0a,0x0c,0x0a,0x05,
|
|
||||||
0x04,0x06,0x02,0x00,0x03,0x12,0x03,0x36,0x13,0x14,
|
|
||||||
0x0a,0x0b,0x0a,0x04,0x04,0x06,0x02,0x01,0x12,0x03,
|
|
||||||
0x37,0x04,0x14,0x0a,0x0c,0x0a,0x05,0x04,0x06,0x02,
|
|
||||||
0x01,0x05,0x12,0x03,0x37,0x04,0x0a,0x0a,0x0c,0x0a,
|
|
||||||
0x05,0x04,0x06,0x02,0x01,0x01,0x12,0x03,0x37,0x0b,
|
|
||||||
0x0f,0x0a,0x0c,0x0a,0x05,0x04,0x06,0x02,0x01,0x03,
|
|
||||||
0x12,0x03,0x37,0x12,0x13,0x0a,0x0a,0x0a,0x02,0x04,
|
|
||||||
0x07,0x12,0x04,0x3a,0x00,0x3c,0x01,0x0a,0x0a,0x0a,
|
|
||||||
0x03,0x04,0x07,0x01,0x12,0x03,0x3a,0x08,0x20,0x0a,
|
|
||||||
0x0b,0x0a,0x04,0x04,0x07,0x02,0x00,0x12,0x03,0x3b,
|
|
||||||
0x04,0x26,0x0a,0x0c,0x0a,0x05,0x04,0x07,0x02,0x00,
|
|
||||||
0x04,0x12,0x03,0x3b,0x04,0x0c,0x0a,0x0c,0x0a,0x05,
|
|
||||||
0x04,0x07,0x02,0x00,0x06,0x12,0x03,0x3b,0x0d,0x1b,
|
|
||||||
0x0a,0x0c,0x0a,0x05,0x04,0x07,0x02,0x00,0x01,0x12,
|
0x0a,0x0c,0x0a,0x05,0x04,0x07,0x02,0x00,0x01,0x12,
|
||||||
0x03,0x3b,0x1c,0x21,0x0a,0x0c,0x0a,0x05,0x04,0x07,
|
0x03,0x35,0x09,0x10,0x0a,0x0c,0x0a,0x05,0x04,0x07,
|
||||||
0x02,0x00,0x03,0x12,0x03,0x3b,0x24,0x25,0x62,0x06,
|
0x02,0x00,0x03,0x12,0x03,0x35,0x13,0x14,0x0a,0x0b,
|
||||||
|
0x0a,0x04,0x04,0x07,0x02,0x01,0x12,0x03,0x36,0x04,
|
||||||
|
0x19,0x0a,0x0c,0x0a,0x05,0x04,0x07,0x02,0x01,0x05,
|
||||||
|
0x12,0x03,0x36,0x04,0x0a,0x0a,0x0c,0x0a,0x05,0x04,
|
||||||
|
0x07,0x02,0x01,0x01,0x12,0x03,0x36,0x0b,0x14,0x0a,
|
||||||
|
0x0c,0x0a,0x05,0x04,0x07,0x02,0x01,0x03,0x12,0x03,
|
||||||
|
0x36,0x17,0x18,0x0a,0x0b,0x0a,0x04,0x04,0x07,0x02,
|
||||||
|
0x02,0x12,0x03,0x37,0x04,0x17,0x0a,0x0c,0x0a,0x05,
|
||||||
|
0x04,0x07,0x02,0x02,0x05,0x12,0x03,0x37,0x04,0x0a,
|
||||||
|
0x0a,0x0c,0x0a,0x05,0x04,0x07,0x02,0x02,0x01,0x12,
|
||||||
|
0x03,0x37,0x0b,0x12,0x0a,0x0c,0x0a,0x05,0x04,0x07,
|
||||||
|
0x02,0x02,0x03,0x12,0x03,0x37,0x15,0x16,0x0a,0x0b,
|
||||||
|
0x0a,0x04,0x04,0x07,0x02,0x03,0x12,0x03,0x38,0x04,
|
||||||
|
0x18,0x0a,0x0c,0x0a,0x05,0x04,0x07,0x02,0x03,0x05,
|
||||||
|
0x12,0x03,0x38,0x04,0x0a,0x0a,0x0c,0x0a,0x05,0x04,
|
||||||
|
0x07,0x02,0x03,0x01,0x12,0x03,0x38,0x0b,0x13,0x0a,
|
||||||
|
0x0c,0x0a,0x05,0x04,0x07,0x02,0x03,0x03,0x12,0x03,
|
||||||
|
0x38,0x16,0x17,0x0a,0x0b,0x0a,0x04,0x04,0x07,0x02,
|
||||||
|
0x04,0x12,0x03,0x39,0x04,0x19,0x0a,0x0c,0x0a,0x05,
|
||||||
|
0x04,0x07,0x02,0x04,0x05,0x12,0x03,0x39,0x04,0x0a,
|
||||||
|
0x0a,0x0c,0x0a,0x05,0x04,0x07,0x02,0x04,0x01,0x12,
|
||||||
|
0x03,0x39,0x0b,0x14,0x0a,0x0c,0x0a,0x05,0x04,0x07,
|
||||||
|
0x02,0x04,0x03,0x12,0x03,0x39,0x17,0x18,0x0a,0x0a,
|
||||||
|
0x0a,0x02,0x04,0x08,0x12,0x04,0x3c,0x00,0x3f,0x01,
|
||||||
|
0x0a,0x0a,0x0a,0x03,0x04,0x08,0x01,0x12,0x03,0x3c,
|
||||||
|
0x08,0x16,0x0a,0x0b,0x0a,0x04,0x04,0x08,0x02,0x00,
|
||||||
|
0x12,0x03,0x3d,0x04,0x15,0x0a,0x0c,0x0a,0x05,0x04,
|
||||||
|
0x08,0x02,0x00,0x05,0x12,0x03,0x3d,0x04,0x0b,0x0a,
|
||||||
|
0x0c,0x0a,0x05,0x04,0x08,0x02,0x00,0x01,0x12,0x03,
|
||||||
|
0x3d,0x0c,0x10,0x0a,0x0c,0x0a,0x05,0x04,0x08,0x02,
|
||||||
|
0x00,0x03,0x12,0x03,0x3d,0x13,0x14,0x0a,0x0b,0x0a,
|
||||||
|
0x04,0x04,0x08,0x02,0x01,0x12,0x03,0x3e,0x04,0x14,
|
||||||
|
0x0a,0x0c,0x0a,0x05,0x04,0x08,0x02,0x01,0x05,0x12,
|
||||||
|
0x03,0x3e,0x04,0x0a,0x0a,0x0c,0x0a,0x05,0x04,0x08,
|
||||||
|
0x02,0x01,0x01,0x12,0x03,0x3e,0x0b,0x0f,0x0a,0x0c,
|
||||||
|
0x0a,0x05,0x04,0x08,0x02,0x01,0x03,0x12,0x03,0x3e,
|
||||||
|
0x12,0x13,0x0a,0x0a,0x0a,0x02,0x04,0x09,0x12,0x04,
|
||||||
|
0x41,0x00,0x43,0x01,0x0a,0x0a,0x0a,0x03,0x04,0x09,
|
||||||
|
0x01,0x12,0x03,0x41,0x08,0x20,0x0a,0x0b,0x0a,0x04,
|
||||||
|
0x04,0x09,0x02,0x00,0x12,0x03,0x42,0x04,0x26,0x0a,
|
||||||
|
0x0c,0x0a,0x05,0x04,0x09,0x02,0x00,0x04,0x12,0x03,
|
||||||
|
0x42,0x04,0x0c,0x0a,0x0c,0x0a,0x05,0x04,0x09,0x02,
|
||||||
|
0x00,0x06,0x12,0x03,0x42,0x0d,0x1b,0x0a,0x0c,0x0a,
|
||||||
|
0x05,0x04,0x09,0x02,0x00,0x01,0x12,0x03,0x42,0x1c,
|
||||||
|
0x21,0x0a,0x0c,0x0a,0x05,0x04,0x09,0x02,0x00,0x03,
|
||||||
|
0x12,0x03,0x42,0x24,0x25,0x0a,0x0a,0x0a,0x02,0x04,
|
||||||
|
0x0a,0x12,0x04,0x45,0x00,0x4a,0x01,0x0a,0x0a,0x0a,
|
||||||
|
0x03,0x04,0x0a,0x01,0x12,0x03,0x45,0x08,0x22,0x0a,
|
||||||
|
0x0b,0x0a,0x04,0x04,0x0a,0x02,0x00,0x12,0x03,0x46,
|
||||||
|
0x04,0x24,0x0a,0x0c,0x0a,0x05,0x04,0x0a,0x02,0x00,
|
||||||
|
0x06,0x12,0x03,0x46,0x04,0x15,0x0a,0x0c,0x0a,0x05,
|
||||||
|
0x04,0x0a,0x02,0x00,0x01,0x12,0x03,0x46,0x16,0x1f,
|
||||||
|
0x0a,0x0c,0x0a,0x05,0x04,0x0a,0x02,0x00,0x03,0x12,
|
||||||
|
0x03,0x46,0x22,0x23,0x0a,0x0b,0x0a,0x04,0x04,0x0a,
|
||||||
|
0x02,0x01,0x12,0x03,0x47,0x04,0x19,0x0a,0x0c,0x0a,
|
||||||
|
0x05,0x04,0x0a,0x02,0x01,0x05,0x12,0x03,0x47,0x04,
|
||||||
|
0x0a,0x0a,0x0c,0x0a,0x05,0x04,0x0a,0x02,0x01,0x01,
|
||||||
|
0x12,0x03,0x47,0x0b,0x14,0x0a,0x0c,0x0a,0x05,0x04,
|
||||||
|
0x0a,0x02,0x01,0x03,0x12,0x03,0x47,0x17,0x18,0x0a,
|
||||||
|
0x0b,0x0a,0x04,0x04,0x0a,0x02,0x02,0x12,0x03,0x48,
|
||||||
|
0x04,0x1d,0x0a,0x0c,0x0a,0x05,0x04,0x0a,0x02,0x02,
|
||||||
|
0x05,0x12,0x03,0x48,0x04,0x09,0x0a,0x0c,0x0a,0x05,
|
||||||
|
0x04,0x0a,0x02,0x02,0x01,0x12,0x03,0x48,0x0a,0x18,
|
||||||
|
0x0a,0x0c,0x0a,0x05,0x04,0x0a,0x02,0x02,0x03,0x12,
|
||||||
|
0x03,0x48,0x1b,0x1c,0x0a,0x0b,0x0a,0x04,0x04,0x0a,
|
||||||
|
0x02,0x03,0x12,0x03,0x49,0x04,0x1c,0x0a,0x0c,0x0a,
|
||||||
|
0x05,0x04,0x0a,0x02,0x03,0x05,0x12,0x03,0x49,0x04,
|
||||||
|
0x09,0x0a,0x0c,0x0a,0x05,0x04,0x0a,0x02,0x03,0x01,
|
||||||
|
0x12,0x03,0x49,0x0a,0x17,0x0a,0x0c,0x0a,0x05,0x04,
|
||||||
|
0x0a,0x02,0x03,0x03,0x12,0x03,0x49,0x1a,0x1b,0x0a,
|
||||||
|
0x0a,0x0a,0x02,0x04,0x0b,0x12,0x04,0x4c,0x00,0x50,
|
||||||
|
0x01,0x0a,0x0a,0x0a,0x03,0x04,0x0b,0x01,0x12,0x03,
|
||||||
|
0x4c,0x08,0x24,0x0a,0x0b,0x0a,0x04,0x04,0x0b,0x02,
|
||||||
|
0x00,0x12,0x03,0x4d,0x04,0x1b,0x0a,0x0c,0x0a,0x05,
|
||||||
|
0x04,0x0b,0x02,0x00,0x05,0x12,0x03,0x4d,0x04,0x0a,
|
||||||
|
0x0a,0x0c,0x0a,0x05,0x04,0x0b,0x02,0x00,0x01,0x12,
|
||||||
|
0x03,0x4d,0x0b,0x16,0x0a,0x0c,0x0a,0x05,0x04,0x0b,
|
||||||
|
0x02,0x00,0x03,0x12,0x03,0x4d,0x19,0x1a,0x0a,0x0b,
|
||||||
|
0x0a,0x04,0x04,0x0b,0x02,0x01,0x12,0x03,0x4e,0x04,
|
||||||
|
0x19,0x0a,0x0c,0x0a,0x05,0x04,0x0b,0x02,0x01,0x05,
|
||||||
|
0x12,0x03,0x4e,0x04,0x0a,0x0a,0x0c,0x0a,0x05,0x04,
|
||||||
|
0x0b,0x02,0x01,0x01,0x12,0x03,0x4e,0x0b,0x14,0x0a,
|
||||||
|
0x0c,0x0a,0x05,0x04,0x0b,0x02,0x01,0x03,0x12,0x03,
|
||||||
|
0x4e,0x17,0x18,0x0a,0x0b,0x0a,0x04,0x04,0x0b,0x02,
|
||||||
|
0x02,0x12,0x03,0x4f,0x04,0x1d,0x0a,0x0c,0x0a,0x05,
|
||||||
|
0x04,0x0b,0x02,0x02,0x05,0x12,0x03,0x4f,0x04,0x09,
|
||||||
|
0x0a,0x0c,0x0a,0x05,0x04,0x0b,0x02,0x02,0x01,0x12,
|
||||||
|
0x03,0x4f,0x0a,0x18,0x0a,0x0c,0x0a,0x05,0x04,0x0b,
|
||||||
|
0x02,0x02,0x03,0x12,0x03,0x4f,0x1b,0x1c,0x62,0x06,
|
||||||
0x70,0x72,0x6f,0x74,0x6f,0x33,
|
0x70,0x72,0x6f,0x74,0x6f,0x33,
|
||||||
};
|
};
|
||||||
static const char file_name[] = "MrcComm.proto";
|
static const char file_name[] = "MrcComm.proto";
|
||||||
@@ -354,10 +464,22 @@ pb_filedesc_t mrc_proto_ProtobufJoystickDescriptor::file_descriptor(void) noexce
|
|||||||
PB_BIND(mrc_proto_ProtobufJoystickDescriptor, mrc_proto_ProtobufJoystickDescriptor, AUTO)
|
PB_BIND(mrc_proto_ProtobufJoystickDescriptor, mrc_proto_ProtobufJoystickDescriptor, AUTO)
|
||||||
|
|
||||||
|
|
||||||
static const char mrc_proto_ProtobufJoystickRumbleData_name[] = "mrc.proto.ProtobufJoystickRumbleData";
|
static const char mrc_proto_ProtobufJoystickDescriptors_name[] = "mrc.proto.ProtobufJoystickDescriptors";
|
||||||
std::string_view mrc_proto_ProtobufJoystickRumbleData::msg_name(void) noexcept { return mrc_proto_ProtobufJoystickRumbleData_name; }
|
std::string_view mrc_proto_ProtobufJoystickDescriptors::msg_name(void) noexcept { return mrc_proto_ProtobufJoystickDescriptors_name; }
|
||||||
pb_filedesc_t mrc_proto_ProtobufJoystickRumbleData::file_descriptor(void) noexcept { return {::file_name, ::file_descriptor}; }
|
pb_filedesc_t mrc_proto_ProtobufJoystickDescriptors::file_descriptor(void) noexcept { return {::file_name, ::file_descriptor}; }
|
||||||
PB_BIND(mrc_proto_ProtobufJoystickRumbleData, mrc_proto_ProtobufJoystickRumbleData, AUTO)
|
PB_BIND(mrc_proto_ProtobufJoystickDescriptors, mrc_proto_ProtobufJoystickDescriptors, AUTO)
|
||||||
|
|
||||||
|
|
||||||
|
static const char mrc_proto_ProtobufJoystickOutput_name[] = "mrc.proto.ProtobufJoystickOutput";
|
||||||
|
std::string_view mrc_proto_ProtobufJoystickOutput::msg_name(void) noexcept { return mrc_proto_ProtobufJoystickOutput_name; }
|
||||||
|
pb_filedesc_t mrc_proto_ProtobufJoystickOutput::file_descriptor(void) noexcept { return {::file_name, ::file_descriptor}; }
|
||||||
|
PB_BIND(mrc_proto_ProtobufJoystickOutput, mrc_proto_ProtobufJoystickOutput, AUTO)
|
||||||
|
|
||||||
|
|
||||||
|
static const char mrc_proto_ProtobufJoystickOutputs_name[] = "mrc.proto.ProtobufJoystickOutputs";
|
||||||
|
std::string_view mrc_proto_ProtobufJoystickOutputs::msg_name(void) noexcept { return mrc_proto_ProtobufJoystickOutputs_name; }
|
||||||
|
pb_filedesc_t mrc_proto_ProtobufJoystickOutputs::file_descriptor(void) noexcept { return {::file_name, ::file_descriptor}; }
|
||||||
|
PB_BIND(mrc_proto_ProtobufJoystickOutputs, mrc_proto_ProtobufJoystickOutputs, AUTO)
|
||||||
|
|
||||||
|
|
||||||
static const char mrc_proto_ProtobufMatchInfo_name[] = "mrc.proto.ProtobufMatchInfo";
|
static const char mrc_proto_ProtobufMatchInfo_name[] = "mrc.proto.ProtobufMatchInfo";
|
||||||
@@ -384,4 +506,16 @@ pb_filedesc_t mrc_proto_ProtobufAvailableOpModes::file_descriptor(void) noexcept
|
|||||||
PB_BIND(mrc_proto_ProtobufAvailableOpModes, mrc_proto_ProtobufAvailableOpModes, AUTO)
|
PB_BIND(mrc_proto_ProtobufAvailableOpModes, mrc_proto_ProtobufAvailableOpModes, AUTO)
|
||||||
|
|
||||||
|
|
||||||
|
static const char mrc_proto_ProtobufErrorInfoTimestamp_name[] = "mrc.proto.ProtobufErrorInfoTimestamp";
|
||||||
|
std::string_view mrc_proto_ProtobufErrorInfoTimestamp::msg_name(void) noexcept { return mrc_proto_ProtobufErrorInfoTimestamp_name; }
|
||||||
|
pb_filedesc_t mrc_proto_ProtobufErrorInfoTimestamp::file_descriptor(void) noexcept { return {::file_name, ::file_descriptor}; }
|
||||||
|
PB_BIND(mrc_proto_ProtobufErrorInfoTimestamp, mrc_proto_ProtobufErrorInfoTimestamp, AUTO)
|
||||||
|
|
||||||
|
|
||||||
|
static const char mrc_proto_ProtobufConsoleLineTimestamp_name[] = "mrc.proto.ProtobufConsoleLineTimestamp";
|
||||||
|
std::string_view mrc_proto_ProtobufConsoleLineTimestamp::msg_name(void) noexcept { return mrc_proto_ProtobufConsoleLineTimestamp_name; }
|
||||||
|
pb_filedesc_t mrc_proto_ProtobufConsoleLineTimestamp::file_descriptor(void) noexcept { return {::file_name, ::file_descriptor}; }
|
||||||
|
PB_BIND(mrc_proto_ProtobufConsoleLineTimestamp, mrc_proto_ProtobufConsoleLineTimestamp, AUTO)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -47,21 +47,36 @@ typedef struct _mrc_proto_ProtobufJoystickDescriptor {
|
|||||||
static pb_filedesc_t file_descriptor(void) noexcept;
|
static pb_filedesc_t file_descriptor(void) noexcept;
|
||||||
|
|
||||||
pb_callback_t JoystickName;
|
pb_callback_t JoystickName;
|
||||||
pb_callback_t AxisTypes;
|
|
||||||
bool IsGamepad;
|
bool IsGamepad;
|
||||||
int32_t JoystickType;
|
uint32_t GamepadType;
|
||||||
int32_t ButtonCount;
|
uint32_t SupportedOutputs;
|
||||||
int32_t PovCount;
|
|
||||||
int32_t RumbleCount;
|
|
||||||
} mrc_proto_ProtobufJoystickDescriptor;
|
} mrc_proto_ProtobufJoystickDescriptor;
|
||||||
|
|
||||||
typedef struct _mrc_proto_ProtobufJoystickRumbleData {
|
typedef struct _mrc_proto_ProtobufJoystickDescriptors {
|
||||||
static const pb_msgdesc_t* msg_descriptor(void) noexcept;
|
static const pb_msgdesc_t* msg_descriptor(void) noexcept;
|
||||||
static std::string_view msg_name(void) noexcept;
|
static std::string_view msg_name(void) noexcept;
|
||||||
static pb_filedesc_t file_descriptor(void) noexcept;
|
static pb_filedesc_t file_descriptor(void) noexcept;
|
||||||
|
|
||||||
pb_callback_t Value;
|
pb_callback_t Descriptors;
|
||||||
} mrc_proto_ProtobufJoystickRumbleData;
|
} mrc_proto_ProtobufJoystickDescriptors;
|
||||||
|
|
||||||
|
typedef struct _mrc_proto_ProtobufJoystickOutput {
|
||||||
|
static const pb_msgdesc_t* msg_descriptor(void) noexcept;
|
||||||
|
static std::string_view msg_name(void) noexcept;
|
||||||
|
static pb_filedesc_t file_descriptor(void) noexcept;
|
||||||
|
|
||||||
|
uint32_t LEDs;
|
||||||
|
uint32_t Rumble; /* 16 bits, left msb, right lsb */
|
||||||
|
uint32_t TriggerRumble; /* 16 bits, left msb, right lsb */
|
||||||
|
} mrc_proto_ProtobufJoystickOutput;
|
||||||
|
|
||||||
|
typedef struct _mrc_proto_ProtobufJoystickOutputs {
|
||||||
|
static const pb_msgdesc_t* msg_descriptor(void) noexcept;
|
||||||
|
static std::string_view msg_name(void) noexcept;
|
||||||
|
static pb_filedesc_t file_descriptor(void) noexcept;
|
||||||
|
|
||||||
|
pb_callback_t Outputs;
|
||||||
|
} mrc_proto_ProtobufJoystickOutputs;
|
||||||
|
|
||||||
typedef struct _mrc_proto_ProtobufMatchInfo {
|
typedef struct _mrc_proto_ProtobufMatchInfo {
|
||||||
static const pb_msgdesc_t* msg_descriptor(void) noexcept;
|
static const pb_msgdesc_t* msg_descriptor(void) noexcept;
|
||||||
@@ -103,24 +118,53 @@ typedef struct _mrc_proto_ProtobufAvailableOpModes {
|
|||||||
pb_callback_t Modes;
|
pb_callback_t Modes;
|
||||||
} mrc_proto_ProtobufAvailableOpModes;
|
} mrc_proto_ProtobufAvailableOpModes;
|
||||||
|
|
||||||
|
typedef struct _mrc_proto_ProtobufErrorInfoTimestamp {
|
||||||
|
static const pb_msgdesc_t* msg_descriptor(void) noexcept;
|
||||||
|
static std::string_view msg_name(void) noexcept;
|
||||||
|
static pb_filedesc_t file_descriptor(void) noexcept;
|
||||||
|
|
||||||
|
pb_callback_t ErrorInfo;
|
||||||
|
uint64_t Timestamp;
|
||||||
|
int32_t SequenceNumber;
|
||||||
|
int32_t NumOccurances;
|
||||||
|
} mrc_proto_ProtobufErrorInfoTimestamp;
|
||||||
|
|
||||||
|
typedef struct _mrc_proto_ProtobufConsoleLineTimestamp {
|
||||||
|
static const pb_msgdesc_t* msg_descriptor(void) noexcept;
|
||||||
|
static std::string_view msg_name(void) noexcept;
|
||||||
|
static pb_filedesc_t file_descriptor(void) noexcept;
|
||||||
|
|
||||||
|
pb_callback_t ConsoleLine;
|
||||||
|
uint64_t Timestamp;
|
||||||
|
int32_t SequenceNumber;
|
||||||
|
} mrc_proto_ProtobufConsoleLineTimestamp;
|
||||||
|
|
||||||
|
|
||||||
/* Initializer values for message structs */
|
/* Initializer values for message structs */
|
||||||
#define mrc_proto_ProtobufJoystickData_init_default {0, 0, 0, {{NULL}, NULL}, 0, 0}
|
#define mrc_proto_ProtobufJoystickData_init_default {0, 0, 0, {{NULL}, NULL}, 0, 0}
|
||||||
#define mrc_proto_ProtobufControlData_init_default {0, 0, {{NULL}, NULL}, 0}
|
#define mrc_proto_ProtobufControlData_init_default {0, 0, {{NULL}, NULL}, 0}
|
||||||
#define mrc_proto_ProtobufJoystickDescriptor_init_default {{{NULL}, NULL}, {{NULL}, NULL}, 0, 0, 0, 0, 0}
|
#define mrc_proto_ProtobufJoystickDescriptor_init_default {{{NULL}, NULL}, 0, 0, 0}
|
||||||
#define mrc_proto_ProtobufJoystickRumbleData_init_default {{{NULL}, NULL}}
|
#define mrc_proto_ProtobufJoystickDescriptors_init_default {{{NULL}, NULL}}
|
||||||
|
#define mrc_proto_ProtobufJoystickOutput_init_default {0, 0, 0}
|
||||||
|
#define mrc_proto_ProtobufJoystickOutputs_init_default {{{NULL}, NULL}}
|
||||||
#define mrc_proto_ProtobufMatchInfo_init_default {{{NULL}, NULL}, 0, 0, 0}
|
#define mrc_proto_ProtobufMatchInfo_init_default {{{NULL}, NULL}, 0, 0, 0}
|
||||||
#define mrc_proto_ProtobufErrorInfo_init_default {0, 0, {{NULL}, NULL}, {{NULL}, NULL}, {{NULL}, NULL}}
|
#define mrc_proto_ProtobufErrorInfo_init_default {0, 0, {{NULL}, NULL}, {{NULL}, NULL}, {{NULL}, NULL}}
|
||||||
#define mrc_proto_ProtobufOpMode_init_default {0, {{NULL}, NULL}}
|
#define mrc_proto_ProtobufOpMode_init_default {0, {{NULL}, NULL}}
|
||||||
#define mrc_proto_ProtobufAvailableOpModes_init_default {{{NULL}, NULL}}
|
#define mrc_proto_ProtobufAvailableOpModes_init_default {{{NULL}, NULL}}
|
||||||
|
#define mrc_proto_ProtobufErrorInfoTimestamp_init_default {{{NULL}, NULL}, 0, 0, 0}
|
||||||
|
#define mrc_proto_ProtobufConsoleLineTimestamp_init_default {{{NULL}, NULL}, 0, 0}
|
||||||
#define mrc_proto_ProtobufJoystickData_init_zero {0, 0, 0, {{NULL}, NULL}, 0, 0}
|
#define mrc_proto_ProtobufJoystickData_init_zero {0, 0, 0, {{NULL}, NULL}, 0, 0}
|
||||||
#define mrc_proto_ProtobufControlData_init_zero {0, 0, {{NULL}, NULL}, 0}
|
#define mrc_proto_ProtobufControlData_init_zero {0, 0, {{NULL}, NULL}, 0}
|
||||||
#define mrc_proto_ProtobufJoystickDescriptor_init_zero {{{NULL}, NULL}, {{NULL}, NULL}, 0, 0, 0, 0, 0}
|
#define mrc_proto_ProtobufJoystickDescriptor_init_zero {{{NULL}, NULL}, 0, 0, 0}
|
||||||
#define mrc_proto_ProtobufJoystickRumbleData_init_zero {{{NULL}, NULL}}
|
#define mrc_proto_ProtobufJoystickDescriptors_init_zero {{{NULL}, NULL}}
|
||||||
|
#define mrc_proto_ProtobufJoystickOutput_init_zero {0, 0, 0}
|
||||||
|
#define mrc_proto_ProtobufJoystickOutputs_init_zero {{{NULL}, NULL}}
|
||||||
#define mrc_proto_ProtobufMatchInfo_init_zero {{{NULL}, NULL}, 0, 0, 0}
|
#define mrc_proto_ProtobufMatchInfo_init_zero {{{NULL}, NULL}, 0, 0, 0}
|
||||||
#define mrc_proto_ProtobufErrorInfo_init_zero {0, 0, {{NULL}, NULL}, {{NULL}, NULL}, {{NULL}, NULL}}
|
#define mrc_proto_ProtobufErrorInfo_init_zero {0, 0, {{NULL}, NULL}, {{NULL}, NULL}, {{NULL}, NULL}}
|
||||||
#define mrc_proto_ProtobufOpMode_init_zero {0, {{NULL}, NULL}}
|
#define mrc_proto_ProtobufOpMode_init_zero {0, {{NULL}, NULL}}
|
||||||
#define mrc_proto_ProtobufAvailableOpModes_init_zero {{{NULL}, NULL}}
|
#define mrc_proto_ProtobufAvailableOpModes_init_zero {{{NULL}, NULL}}
|
||||||
|
#define mrc_proto_ProtobufErrorInfoTimestamp_init_zero {{{NULL}, NULL}, 0, 0, 0}
|
||||||
|
#define mrc_proto_ProtobufConsoleLineTimestamp_init_zero {{{NULL}, NULL}, 0, 0}
|
||||||
|
|
||||||
/* Field tags (for use in manual encoding/decoding) */
|
/* Field tags (for use in manual encoding/decoding) */
|
||||||
#define mrc_proto_ProtobufJoystickData_AvailableButtons_tag 1
|
#define mrc_proto_ProtobufJoystickData_AvailableButtons_tag 1
|
||||||
@@ -134,13 +178,14 @@ typedef struct _mrc_proto_ProtobufAvailableOpModes {
|
|||||||
#define mrc_proto_ProtobufControlData_Joysticks_tag 3
|
#define mrc_proto_ProtobufControlData_Joysticks_tag 3
|
||||||
#define mrc_proto_ProtobufControlData_CurrentOpMode_tag 4
|
#define mrc_proto_ProtobufControlData_CurrentOpMode_tag 4
|
||||||
#define mrc_proto_ProtobufJoystickDescriptor_JoystickName_tag 1
|
#define mrc_proto_ProtobufJoystickDescriptor_JoystickName_tag 1
|
||||||
#define mrc_proto_ProtobufJoystickDescriptor_AxisTypes_tag 2
|
#define mrc_proto_ProtobufJoystickDescriptor_IsGamepad_tag 2
|
||||||
#define mrc_proto_ProtobufJoystickDescriptor_IsGamepad_tag 3
|
#define mrc_proto_ProtobufJoystickDescriptor_GamepadType_tag 3
|
||||||
#define mrc_proto_ProtobufJoystickDescriptor_JoystickType_tag 4
|
#define mrc_proto_ProtobufJoystickDescriptor_SupportedOutputs_tag 4
|
||||||
#define mrc_proto_ProtobufJoystickDescriptor_ButtonCount_tag 5
|
#define mrc_proto_ProtobufJoystickDescriptors_Descriptors_tag 1
|
||||||
#define mrc_proto_ProtobufJoystickDescriptor_PovCount_tag 6
|
#define mrc_proto_ProtobufJoystickOutput_LEDs_tag 1
|
||||||
#define mrc_proto_ProtobufJoystickDescriptor_RumbleCount_tag 7
|
#define mrc_proto_ProtobufJoystickOutput_Rumble_tag 2
|
||||||
#define mrc_proto_ProtobufJoystickRumbleData_Value_tag 3
|
#define mrc_proto_ProtobufJoystickOutput_TriggerRumble_tag 3
|
||||||
|
#define mrc_proto_ProtobufJoystickOutputs_Outputs_tag 1
|
||||||
#define mrc_proto_ProtobufMatchInfo_EventName_tag 1
|
#define mrc_proto_ProtobufMatchInfo_EventName_tag 1
|
||||||
#define mrc_proto_ProtobufMatchInfo_MatchNumber_tag 2
|
#define mrc_proto_ProtobufMatchInfo_MatchNumber_tag 2
|
||||||
#define mrc_proto_ProtobufMatchInfo_ReplayNumber_tag 3
|
#define mrc_proto_ProtobufMatchInfo_ReplayNumber_tag 3
|
||||||
@@ -153,6 +198,13 @@ typedef struct _mrc_proto_ProtobufAvailableOpModes {
|
|||||||
#define mrc_proto_ProtobufOpMode_Hash_tag 1
|
#define mrc_proto_ProtobufOpMode_Hash_tag 1
|
||||||
#define mrc_proto_ProtobufOpMode_Name_tag 2
|
#define mrc_proto_ProtobufOpMode_Name_tag 2
|
||||||
#define mrc_proto_ProtobufAvailableOpModes_Modes_tag 1
|
#define mrc_proto_ProtobufAvailableOpModes_Modes_tag 1
|
||||||
|
#define mrc_proto_ProtobufErrorInfoTimestamp_ErrorInfo_tag 1
|
||||||
|
#define mrc_proto_ProtobufErrorInfoTimestamp_Timestamp_tag 2
|
||||||
|
#define mrc_proto_ProtobufErrorInfoTimestamp_SequenceNumber_tag 3
|
||||||
|
#define mrc_proto_ProtobufErrorInfoTimestamp_NumOccurances_tag 4
|
||||||
|
#define mrc_proto_ProtobufConsoleLineTimestamp_ConsoleLine_tag 1
|
||||||
|
#define mrc_proto_ProtobufConsoleLineTimestamp_Timestamp_tag 2
|
||||||
|
#define mrc_proto_ProtobufConsoleLineTimestamp_SequenceNumber_tag 3
|
||||||
|
|
||||||
/* Struct field encoding specification for nanopb */
|
/* Struct field encoding specification for nanopb */
|
||||||
#define mrc_proto_ProtobufJoystickData_FIELDLIST(X, a) \
|
#define mrc_proto_ProtobufJoystickData_FIELDLIST(X, a) \
|
||||||
@@ -176,19 +228,30 @@ X(a, STATIC, SINGULAR, FIXED64, CurrentOpMode, 4)
|
|||||||
|
|
||||||
#define mrc_proto_ProtobufJoystickDescriptor_FIELDLIST(X, a) \
|
#define mrc_proto_ProtobufJoystickDescriptor_FIELDLIST(X, a) \
|
||||||
X(a, CALLBACK, SINGULAR, STRING, JoystickName, 1) \
|
X(a, CALLBACK, SINGULAR, STRING, JoystickName, 1) \
|
||||||
X(a, CALLBACK, REPEATED, INT32, AxisTypes, 2) \
|
X(a, STATIC, SINGULAR, BOOL, IsGamepad, 2) \
|
||||||
X(a, STATIC, SINGULAR, BOOL, IsGamepad, 3) \
|
X(a, STATIC, SINGULAR, UINT32, GamepadType, 3) \
|
||||||
X(a, STATIC, SINGULAR, INT32, JoystickType, 4) \
|
X(a, STATIC, SINGULAR, UINT32, SupportedOutputs, 4)
|
||||||
X(a, STATIC, SINGULAR, INT32, ButtonCount, 5) \
|
|
||||||
X(a, STATIC, SINGULAR, INT32, PovCount, 6) \
|
|
||||||
X(a, STATIC, SINGULAR, INT32, RumbleCount, 7)
|
|
||||||
#define mrc_proto_ProtobufJoystickDescriptor_CALLBACK pb_default_field_callback
|
#define mrc_proto_ProtobufJoystickDescriptor_CALLBACK pb_default_field_callback
|
||||||
#define mrc_proto_ProtobufJoystickDescriptor_DEFAULT NULL
|
#define mrc_proto_ProtobufJoystickDescriptor_DEFAULT NULL
|
||||||
|
|
||||||
#define mrc_proto_ProtobufJoystickRumbleData_FIELDLIST(X, a) \
|
#define mrc_proto_ProtobufJoystickDescriptors_FIELDLIST(X, a) \
|
||||||
X(a, CALLBACK, REPEATED, UINT32, Value, 3)
|
X(a, CALLBACK, REPEATED, MESSAGE, Descriptors, 1)
|
||||||
#define mrc_proto_ProtobufJoystickRumbleData_CALLBACK pb_default_field_callback
|
#define mrc_proto_ProtobufJoystickDescriptors_CALLBACK pb_default_field_callback
|
||||||
#define mrc_proto_ProtobufJoystickRumbleData_DEFAULT NULL
|
#define mrc_proto_ProtobufJoystickDescriptors_DEFAULT NULL
|
||||||
|
#define mrc_proto_ProtobufJoystickDescriptors_Descriptors_MSGTYPE mrc_proto_ProtobufJoystickDescriptor
|
||||||
|
|
||||||
|
#define mrc_proto_ProtobufJoystickOutput_FIELDLIST(X, a) \
|
||||||
|
X(a, STATIC, SINGULAR, UINT32, LEDs, 1) \
|
||||||
|
X(a, STATIC, SINGULAR, UINT32, Rumble, 2) \
|
||||||
|
X(a, STATIC, SINGULAR, UINT32, TriggerRumble, 3)
|
||||||
|
#define mrc_proto_ProtobufJoystickOutput_CALLBACK NULL
|
||||||
|
#define mrc_proto_ProtobufJoystickOutput_DEFAULT NULL
|
||||||
|
|
||||||
|
#define mrc_proto_ProtobufJoystickOutputs_FIELDLIST(X, a) \
|
||||||
|
X(a, CALLBACK, REPEATED, MESSAGE, Outputs, 1)
|
||||||
|
#define mrc_proto_ProtobufJoystickOutputs_CALLBACK pb_default_field_callback
|
||||||
|
#define mrc_proto_ProtobufJoystickOutputs_DEFAULT NULL
|
||||||
|
#define mrc_proto_ProtobufJoystickOutputs_Outputs_MSGTYPE mrc_proto_ProtobufJoystickOutput
|
||||||
|
|
||||||
#define mrc_proto_ProtobufMatchInfo_FIELDLIST(X, a) \
|
#define mrc_proto_ProtobufMatchInfo_FIELDLIST(X, a) \
|
||||||
X(a, CALLBACK, SINGULAR, STRING, EventName, 1) \
|
X(a, CALLBACK, SINGULAR, STRING, EventName, 1) \
|
||||||
@@ -219,15 +282,36 @@ X(a, CALLBACK, REPEATED, MESSAGE, Modes, 1)
|
|||||||
#define mrc_proto_ProtobufAvailableOpModes_DEFAULT NULL
|
#define mrc_proto_ProtobufAvailableOpModes_DEFAULT NULL
|
||||||
#define mrc_proto_ProtobufAvailableOpModes_Modes_MSGTYPE mrc_proto_ProtobufOpMode
|
#define mrc_proto_ProtobufAvailableOpModes_Modes_MSGTYPE mrc_proto_ProtobufOpMode
|
||||||
|
|
||||||
|
#define mrc_proto_ProtobufErrorInfoTimestamp_FIELDLIST(X, a) \
|
||||||
|
X(a, CALLBACK, OPTIONAL, MESSAGE, ErrorInfo, 1) \
|
||||||
|
X(a, STATIC, SINGULAR, UINT64, Timestamp, 2) \
|
||||||
|
X(a, STATIC, SINGULAR, INT32, SequenceNumber, 3) \
|
||||||
|
X(a, STATIC, SINGULAR, INT32, NumOccurances, 4)
|
||||||
|
#define mrc_proto_ProtobufErrorInfoTimestamp_CALLBACK pb_default_field_callback
|
||||||
|
#define mrc_proto_ProtobufErrorInfoTimestamp_DEFAULT NULL
|
||||||
|
#define mrc_proto_ProtobufErrorInfoTimestamp_ErrorInfo_MSGTYPE mrc_proto_ProtobufErrorInfo
|
||||||
|
|
||||||
|
#define mrc_proto_ProtobufConsoleLineTimestamp_FIELDLIST(X, a) \
|
||||||
|
X(a, CALLBACK, SINGULAR, STRING, ConsoleLine, 1) \
|
||||||
|
X(a, STATIC, SINGULAR, UINT64, Timestamp, 2) \
|
||||||
|
X(a, STATIC, SINGULAR, INT32, SequenceNumber, 3)
|
||||||
|
#define mrc_proto_ProtobufConsoleLineTimestamp_CALLBACK pb_default_field_callback
|
||||||
|
#define mrc_proto_ProtobufConsoleLineTimestamp_DEFAULT NULL
|
||||||
|
|
||||||
/* Maximum encoded size of messages (where known) */
|
/* Maximum encoded size of messages (where known) */
|
||||||
/* mrc_proto_ProtobufJoystickData_size depends on runtime parameters */
|
/* mrc_proto_ProtobufJoystickData_size depends on runtime parameters */
|
||||||
/* mrc_proto_ProtobufControlData_size depends on runtime parameters */
|
/* mrc_proto_ProtobufControlData_size depends on runtime parameters */
|
||||||
/* mrc_proto_ProtobufJoystickDescriptor_size depends on runtime parameters */
|
/* mrc_proto_ProtobufJoystickDescriptor_size depends on runtime parameters */
|
||||||
/* mrc_proto_ProtobufJoystickRumbleData_size depends on runtime parameters */
|
/* mrc_proto_ProtobufJoystickDescriptors_size depends on runtime parameters */
|
||||||
|
/* mrc_proto_ProtobufJoystickOutputs_size depends on runtime parameters */
|
||||||
/* mrc_proto_ProtobufMatchInfo_size depends on runtime parameters */
|
/* mrc_proto_ProtobufMatchInfo_size depends on runtime parameters */
|
||||||
/* mrc_proto_ProtobufErrorInfo_size depends on runtime parameters */
|
/* mrc_proto_ProtobufErrorInfo_size depends on runtime parameters */
|
||||||
/* mrc_proto_ProtobufOpMode_size depends on runtime parameters */
|
/* mrc_proto_ProtobufOpMode_size depends on runtime parameters */
|
||||||
/* mrc_proto_ProtobufAvailableOpModes_size depends on runtime parameters */
|
/* mrc_proto_ProtobufAvailableOpModes_size depends on runtime parameters */
|
||||||
|
/* mrc_proto_ProtobufErrorInfoTimestamp_size depends on runtime parameters */
|
||||||
|
/* mrc_proto_ProtobufConsoleLineTimestamp_size depends on runtime parameters */
|
||||||
|
#define MRC_PROTO_MRCCOMM_NPB_H_MAX_SIZE mrc_proto_ProtobufJoystickOutput_size
|
||||||
|
#define mrc_proto_ProtobufJoystickOutput_size 18
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -167,17 +167,32 @@ public class DriverStationJNI extends JNIWrapper {
|
|||||||
long[] buttonsAndMetadata);
|
long[] buttonsAndMetadata);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set joystick outputs.
|
* Set joystick rumbles.
|
||||||
*
|
*
|
||||||
* @param joystickNum the joystick number
|
* @param joystickNum the joystick number
|
||||||
* @param outputs bitmask of outputs, 1 for on 0 for off
|
|
||||||
* @param leftRumble the left rumble value (0-FFFF)
|
* @param leftRumble the left rumble value (0-FFFF)
|
||||||
* @param rightRumble the right rumble value (0-FFFF)
|
* @param rightRumble the right rumble value (0-FFFF)
|
||||||
|
* @param leftTriggerRumble the left trigger rumble value (0-FFFF)
|
||||||
|
* @param rightTriggerRumble the right trigger rumble value (0-FFFF)
|
||||||
* @return the error code, or 0 for success
|
* @return the error code, or 0 for success
|
||||||
* @see "HAL_SetJoystickOutputs"
|
* @see "HAL_SetJoystickRumble"
|
||||||
*/
|
*/
|
||||||
public static native int setJoystickOutputs(
|
public static native int setJoystickRumble(
|
||||||
byte joystickNum, int outputs, int leftRumble, int rightRumble);
|
byte joystickNum,
|
||||||
|
int leftRumble,
|
||||||
|
int rightRumble,
|
||||||
|
int leftTriggerRumble,
|
||||||
|
int rightTriggerRumble);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the LEDs on a specific joystick.
|
||||||
|
*
|
||||||
|
* @param joystickNum the joystick number
|
||||||
|
* @param leds the rgb led color value (0xRRGGBB)
|
||||||
|
* @return the error code, or 0 for success
|
||||||
|
* @see "HAL_SetJoystickLeds"
|
||||||
|
*/
|
||||||
|
public static native int setJoystickLeds(byte joystickNum, int leds);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets whether a specific joystick is considered to be an Gamepad.
|
* Gets whether a specific joystick is considered to be an Gamepad.
|
||||||
@@ -196,9 +211,18 @@ public class DriverStationJNI extends JNIWrapper {
|
|||||||
*
|
*
|
||||||
* @param joystickNum the joystick number
|
* @param joystickNum the joystick number
|
||||||
* @return the enumerated joystick type
|
* @return the enumerated joystick type
|
||||||
* @see "HAL_GetJoystickType"
|
* @see "HAL_GetJoystickGamepadType"
|
||||||
*/
|
*/
|
||||||
public static native int getJoystickType(byte joystickNum);
|
public static native int getJoystickGamepadType(byte joystickNum);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the supported outputs of a specific joystick.
|
||||||
|
*
|
||||||
|
* @param joystickNum the joystick number
|
||||||
|
* @return bitmask of supported outputs
|
||||||
|
* @see "HAL_GetJoystickSupportedOutputs"
|
||||||
|
*/
|
||||||
|
public static native int getJoystickSupportedOutputs(byte joystickNum);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the name of a joystick.
|
* Gets the name of a joystick.
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ public class DriverStationDataJNI extends JNIWrapper {
|
|||||||
public static native void setJoystickButtons(
|
public static native void setJoystickButtons(
|
||||||
byte joystickNum, long buttons, long availableButtons);
|
byte joystickNum, long buttons, long availableButtons);
|
||||||
|
|
||||||
public static native long getJoystickOutputs(int stick);
|
public static native int getJoystickLeds(int stick);
|
||||||
|
|
||||||
public static native int getJoystickRumble(int stick, int rumbleNum);
|
public static native int getJoystickRumble(int stick, int rumbleNum);
|
||||||
|
|
||||||
@@ -121,10 +121,12 @@ public class DriverStationDataJNI extends JNIWrapper {
|
|||||||
|
|
||||||
public static native void setJoystickIsGamepad(int stick, boolean isGamepad);
|
public static native void setJoystickIsGamepad(int stick, boolean isGamepad);
|
||||||
|
|
||||||
public static native void setJoystickType(int stick, int type);
|
public static native void setJoystickGamepadType(int stick, int type);
|
||||||
|
|
||||||
public static native void setJoystickName(int stick, String name);
|
public static native void setJoystickName(int stick, String name);
|
||||||
|
|
||||||
|
public static native void setJoystickSupportedOutputs(int stick, int supportedOutputs);
|
||||||
|
|
||||||
public static native void setGameSpecificMessage(String message);
|
public static native void setGameSpecificMessage(String message);
|
||||||
|
|
||||||
public static native void setEventName(String name);
|
public static native void setEventName(String name);
|
||||||
|
|||||||
@@ -171,14 +171,28 @@ Java_org_wpilib_hardware_hal_DriverStationJNI_getAllJoystickData
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: org_wpilib_hardware_hal_DriverStationJNI
|
* Class: org_wpilib_hardware_hal_DriverStationJNI
|
||||||
* Method: setJoystickOutputs
|
* Method: setJoystickRumble
|
||||||
* Signature: (BIII)I
|
* Signature: (BIIII)I
|
||||||
*/
|
*/
|
||||||
JNIEXPORT jint JNICALL
|
JNIEXPORT jint JNICALL
|
||||||
Java_org_wpilib_hardware_hal_DriverStationJNI_setJoystickOutputs
|
Java_org_wpilib_hardware_hal_DriverStationJNI_setJoystickRumble
|
||||||
(JNIEnv*, jclass, jbyte port, jint outputs, jint leftRumble, jint rightRumble)
|
(JNIEnv*, jclass, jbyte port, jint leftRumble, jint rightRumble,
|
||||||
|
jint leftTriggerRumble, jint rightTriggerRumble)
|
||||||
{
|
{
|
||||||
return HAL_SetJoystickOutputs(port, outputs, leftRumble, rightRumble);
|
return HAL_SetJoystickRumble(port, leftRumble, rightRumble, leftTriggerRumble,
|
||||||
|
rightTriggerRumble);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: org_wpilib_hardware_hal_DriverStationJNI
|
||||||
|
* Method: setJoystickLeds
|
||||||
|
* Signature: (BI)I
|
||||||
|
*/
|
||||||
|
JNIEXPORT jint JNICALL
|
||||||
|
Java_org_wpilib_hardware_hal_DriverStationJNI_setJoystickLeds
|
||||||
|
(JNIEnv*, jclass, jbyte port, jint leds)
|
||||||
|
{
|
||||||
|
return HAL_SetJoystickLeds(port, leds);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -195,14 +209,26 @@ Java_org_wpilib_hardware_hal_DriverStationJNI_getJoystickIsGamepad
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: org_wpilib_hardware_hal_DriverStationJNI
|
* Class: org_wpilib_hardware_hal_DriverStationJNI
|
||||||
* Method: getJoystickType
|
* Method: getJoystickSupportedOutputs
|
||||||
* Signature: (B)I
|
* Signature: (B)I
|
||||||
*/
|
*/
|
||||||
JNIEXPORT jint JNICALL
|
JNIEXPORT jint JNICALL
|
||||||
Java_org_wpilib_hardware_hal_DriverStationJNI_getJoystickType
|
Java_org_wpilib_hardware_hal_DriverStationJNI_getJoystickSupportedOutputs
|
||||||
(JNIEnv*, jclass, jbyte port)
|
(JNIEnv*, jclass, jbyte port)
|
||||||
{
|
{
|
||||||
return HAL_GetJoystickType(port);
|
return HAL_GetJoystickSupportedOutputs(port);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: org_wpilib_hardware_hal_DriverStationJNI
|
||||||
|
* Method: getJoystickGamepadType
|
||||||
|
* Signature: (B)I
|
||||||
|
*/
|
||||||
|
JNIEXPORT jint JNICALL
|
||||||
|
Java_org_wpilib_hardware_hal_DriverStationJNI_getJoystickGamepadType
|
||||||
|
(JNIEnv*, jclass, jbyte port)
|
||||||
|
{
|
||||||
|
return HAL_GetJoystickGamepadType(port);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -493,18 +493,16 @@ Java_org_wpilib_hardware_hal_simulation_DriverStationDataJNI_setJoystickButtons
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: org_wpilib_hardware_hal_simulation_DriverStationDataJNI
|
* Class: org_wpilib_hardware_hal_simulation_DriverStationDataJNI
|
||||||
* Method: getJoystickOutputs
|
* Method: getJoystickLeds
|
||||||
* Signature: (I)J
|
* Signature: (I)I
|
||||||
*/
|
*/
|
||||||
JNIEXPORT jlong JNICALL
|
JNIEXPORT jint JNICALL
|
||||||
Java_org_wpilib_hardware_hal_simulation_DriverStationDataJNI_getJoystickOutputs
|
Java_org_wpilib_hardware_hal_simulation_DriverStationDataJNI_getJoystickLeds
|
||||||
(JNIEnv* env, jclass, jint stick)
|
(JNIEnv* env, jclass, jint stick)
|
||||||
{
|
{
|
||||||
int64_t outputs = 0;
|
int32_t leds = 0;
|
||||||
int32_t leftRumble;
|
HALSIM_GetJoystickLeds(stick, &leds);
|
||||||
int32_t rightRumble;
|
return leds;
|
||||||
HALSIM_GetJoystickOutputs(stick, &outputs, &leftRumble, &rightRumble);
|
|
||||||
return outputs;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -516,11 +514,24 @@ JNIEXPORT jint JNICALL
|
|||||||
Java_org_wpilib_hardware_hal_simulation_DriverStationDataJNI_getJoystickRumble
|
Java_org_wpilib_hardware_hal_simulation_DriverStationDataJNI_getJoystickRumble
|
||||||
(JNIEnv* env, jclass, jint stick, jint rumbleNum)
|
(JNIEnv* env, jclass, jint stick, jint rumbleNum)
|
||||||
{
|
{
|
||||||
int64_t outputs;
|
|
||||||
int32_t leftRumble = 0;
|
int32_t leftRumble = 0;
|
||||||
int32_t rightRumble = 0;
|
int32_t rightRumble = 0;
|
||||||
HALSIM_GetJoystickOutputs(stick, &outputs, &leftRumble, &rightRumble);
|
int32_t leftTriggerRumble = 0;
|
||||||
return rumbleNum == 0 ? leftRumble : rightRumble;
|
int32_t rightTriggerRumble = 0;
|
||||||
|
HALSIM_GetJoystickRumbles(stick, &leftRumble, &rightRumble,
|
||||||
|
&leftTriggerRumble, &rightTriggerRumble);
|
||||||
|
switch (rumbleNum) {
|
||||||
|
case 0:
|
||||||
|
return leftRumble;
|
||||||
|
case 1:
|
||||||
|
return rightRumble;
|
||||||
|
case 2:
|
||||||
|
return leftTriggerRumble;
|
||||||
|
case 3:
|
||||||
|
return rightTriggerRumble;
|
||||||
|
default:
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -713,14 +724,26 @@ Java_org_wpilib_hardware_hal_simulation_DriverStationDataJNI_setJoystickIsGamepa
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: org_wpilib_hardware_hal_simulation_DriverStationDataJNI
|
* Class: org_wpilib_hardware_hal_simulation_DriverStationDataJNI
|
||||||
* Method: setJoystickType
|
* Method: setJoystickGamepadType
|
||||||
* Signature: (II)V
|
* Signature: (II)V
|
||||||
*/
|
*/
|
||||||
JNIEXPORT void JNICALL
|
JNIEXPORT void JNICALL
|
||||||
Java_org_wpilib_hardware_hal_simulation_DriverStationDataJNI_setJoystickType
|
Java_org_wpilib_hardware_hal_simulation_DriverStationDataJNI_setJoystickGamepadType
|
||||||
(JNIEnv*, jclass, jint stick, jint type)
|
(JNIEnv*, jclass, jint stick, jint type)
|
||||||
{
|
{
|
||||||
HALSIM_SetJoystickType(stick, type);
|
HALSIM_SetJoystickGamepadType(stick, type);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: org_wpilib_hardware_hal_simulation_DriverStationDataJNI
|
||||||
|
* Method: setJoystickSupportedOutputs
|
||||||
|
* Signature: (II)V
|
||||||
|
*/
|
||||||
|
JNIEXPORT void JNICALL
|
||||||
|
Java_org_wpilib_hardware_hal_simulation_DriverStationDataJNI_setJoystickSupportedOutputs
|
||||||
|
(JNIEnv*, jclass, jint stick, jint supportedOutputs)
|
||||||
|
{
|
||||||
|
HALSIM_SetJoystickSupportedOutputs(stick, supportedOutputs);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
// Open Source Software; you can modify and/or share it under the terms of
|
// Open Source Software; you can modify and/or share it under the terms of
|
||||||
// the WPILib BSD license file in the root directory of this project.
|
// the WPILib BSD license file in the root directory of this project.
|
||||||
|
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
#include "wpi/hal/proto/ControlData.h"
|
#include "wpi/hal/proto/ControlData.h"
|
||||||
#include "wpi/util/protobuf/ProtobufCallbacks.hpp"
|
#include "wpi/util/protobuf/ProtobufCallbacks.hpp"
|
||||||
|
|
||||||
@@ -85,7 +87,7 @@ std::optional<mrc::ControlData> wpi::util::Protobuf<mrc::ControlData>::Unpack(
|
|||||||
ControlData.SetJoystickCount(Joysticks.size());
|
ControlData.SetJoystickCount(Joysticks.size());
|
||||||
|
|
||||||
for (size_t i = 0; i < ControlData.GetJoystickCount(); i++) {
|
for (size_t i = 0; i < ControlData.GetJoystickCount(); i++) {
|
||||||
ControlData.Joysticks()[i] = Joysticks[i];
|
ControlData.Joysticks()[i] = std::move(Joysticks[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ControlData;
|
return ControlData;
|
||||||
|
|||||||
@@ -1,69 +0,0 @@
|
|||||||
// Copyright (c) FIRST and other WPILib contributors.
|
|
||||||
// Open Source Software; you can modify and/or share it under the terms of
|
|
||||||
// the WPILib BSD license file in the root directory of this project.
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
#include <utility>
|
|
||||||
|
|
||||||
#include "wpi/hal/proto/JoystickDescriptor.h"
|
|
||||||
#include "wpi/util/protobuf/ProtobufCallbacks.hpp"
|
|
||||||
|
|
||||||
std::optional<mrc::JoystickDescriptor>
|
|
||||||
wpi::util::Protobuf<mrc::JoystickDescriptor>::Unpack(InputStream& Stream) {
|
|
||||||
wpi::util::UnpackCallback<std::string> JoystickNameCb;
|
|
||||||
wpi::util::UnpackCallback<uint8_t, MRC_MAX_NUM_AXES> AxisTypesCb;
|
|
||||||
|
|
||||||
mrc_proto_ProtobufJoystickDescriptor Msg;
|
|
||||||
Msg.JoystickName = JoystickNameCb.Callback();
|
|
||||||
Msg.AxisTypes = AxisTypesCb.Callback();
|
|
||||||
|
|
||||||
if (!Stream.Decode(Msg)) {
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
|
|
||||||
auto JoystickName = JoystickNameCb.Items();
|
|
||||||
auto AxisTypes = AxisTypesCb.Items();
|
|
||||||
|
|
||||||
if (JoystickName.empty()) {
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
|
|
||||||
mrc::JoystickDescriptor OutputData;
|
|
||||||
OutputData.MoveName(std::move(JoystickName[0]));
|
|
||||||
|
|
||||||
OutputData.SetAxesCount(AxisTypes.size());
|
|
||||||
|
|
||||||
for (size_t i = 0; i < OutputData.GetAxesCount(); i++) {
|
|
||||||
OutputData.AxesTypes()[i] = AxisTypes[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
OutputData.SetPovsCount(Msg.PovCount);
|
|
||||||
OutputData.SetButtonsCount(Msg.ButtonCount);
|
|
||||||
|
|
||||||
OutputData.IsGamepad = Msg.IsGamepad ? 1 : 0;
|
|
||||||
OutputData.Type = Msg.JoystickType;
|
|
||||||
OutputData.RumbleCount = Msg.RumbleCount;
|
|
||||||
|
|
||||||
return OutputData;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool wpi::util::Protobuf<mrc::JoystickDescriptor>::Pack(
|
|
||||||
OutputStream& Stream, const mrc::JoystickDescriptor& Value) {
|
|
||||||
std::string_view JoystickName = Value.GetName();
|
|
||||||
wpi::util::PackCallback JoystickNameCb{&JoystickName};
|
|
||||||
|
|
||||||
std::span<const uint8_t> AxisTypes = Value.AxesTypes();
|
|
||||||
wpi::util::PackCallback AxisTypesCb{AxisTypes};
|
|
||||||
|
|
||||||
mrc_proto_ProtobufJoystickDescriptor Msg{
|
|
||||||
.JoystickName = JoystickNameCb.Callback(),
|
|
||||||
.AxisTypes = AxisTypesCb.Callback(),
|
|
||||||
.IsGamepad = Value.IsGamepad ? true : false,
|
|
||||||
.JoystickType = Value.Type,
|
|
||||||
.ButtonCount = static_cast<int32_t>(Value.GetButtonsCount()),
|
|
||||||
.PovCount = static_cast<int32_t>(Value.GetPovsCount()),
|
|
||||||
.RumbleCount = Value.RumbleCount,
|
|
||||||
};
|
|
||||||
|
|
||||||
return Stream.Encode(Msg);
|
|
||||||
}
|
|
||||||
84
hal/src/main/native/cpp/proto/JoystickDescriptorsProto.cpp
Normal file
84
hal/src/main/native/cpp/proto/JoystickDescriptorsProto.cpp
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
// Copyright (c) FIRST and other WPILib contributors.
|
||||||
|
// Open Source Software; you can modify and/or share it under the terms of
|
||||||
|
// the WPILib BSD license file in the root directory of this project.
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
|
#include "wpi/hal/proto/JoystickDescriptors.h"
|
||||||
|
#include "wpi/util/protobuf/ProtobufCallbacks.hpp"
|
||||||
|
|
||||||
|
std::optional<mrc::JoystickDescriptors>
|
||||||
|
wpi::util::Protobuf<mrc::JoystickDescriptors>::Unpack(InputStream& Stream) {
|
||||||
|
wpi::util::UnpackCallback<mrc::JoystickDescriptor, MRC_MAX_NUM_JOYSTICKS>
|
||||||
|
JoystickDescriptorsCb;
|
||||||
|
|
||||||
|
mrc_proto_ProtobufJoystickDescriptors Msg;
|
||||||
|
Msg.Descriptors = JoystickDescriptorsCb.Callback();
|
||||||
|
|
||||||
|
if (!Stream.Decode(Msg)) {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
auto Descriptors = JoystickDescriptorsCb.Items();
|
||||||
|
|
||||||
|
mrc::JoystickDescriptors OutputData;
|
||||||
|
OutputData.SetDescriptorCount(Descriptors.size());
|
||||||
|
for (size_t i = 0; i < OutputData.GetDescriptorCount(); i++) {
|
||||||
|
OutputData.Descriptors()[i] = std::move(Descriptors[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return OutputData;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wpi::util::Protobuf<mrc::JoystickDescriptors>::Pack(
|
||||||
|
OutputStream& Stream, const mrc::JoystickDescriptors& Value) {
|
||||||
|
std::span<const mrc::JoystickDescriptor> Descriptors = Value.Descriptors();
|
||||||
|
wpi::util::PackCallback JoystickDescriptorsCb{Descriptors};
|
||||||
|
|
||||||
|
mrc_proto_ProtobufJoystickDescriptors Msg{
|
||||||
|
.Descriptors = JoystickDescriptorsCb.Callback(),
|
||||||
|
};
|
||||||
|
|
||||||
|
return Stream.Encode(Msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::optional<mrc::JoystickDescriptor>
|
||||||
|
wpi::util::Protobuf<mrc::JoystickDescriptor>::Unpack(InputStream& Stream) {
|
||||||
|
wpi::util::UnpackCallback<std::string> JoystickNameCb;
|
||||||
|
|
||||||
|
mrc_proto_ProtobufJoystickDescriptor Msg;
|
||||||
|
Msg.JoystickName = JoystickNameCb.Callback();
|
||||||
|
|
||||||
|
if (!Stream.Decode(Msg)) {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
auto JoystickName = JoystickNameCb.Items();
|
||||||
|
|
||||||
|
mrc::JoystickDescriptor OutputData;
|
||||||
|
if (!JoystickName.empty()) {
|
||||||
|
OutputData.MoveName(std::move(JoystickName[0]));
|
||||||
|
}
|
||||||
|
|
||||||
|
OutputData.IsGamepad = Msg.IsGamepad ? 1 : 0;
|
||||||
|
OutputData.GamepadType = Msg.GamepadType;
|
||||||
|
OutputData.SupportedOutputs = Msg.SupportedOutputs;
|
||||||
|
|
||||||
|
return OutputData;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wpi::util::Protobuf<mrc::JoystickDescriptor>::Pack(
|
||||||
|
OutputStream& Stream, const mrc::JoystickDescriptor& Value) {
|
||||||
|
std::string_view JoystickName = Value.GetName();
|
||||||
|
wpi::util::PackCallback JoystickNameCb{&JoystickName};
|
||||||
|
|
||||||
|
mrc_proto_ProtobufJoystickDescriptor Msg{
|
||||||
|
.JoystickName = JoystickNameCb.Callback(),
|
||||||
|
.IsGamepad = Value.IsGamepad ? true : false,
|
||||||
|
.GamepadType = Value.GamepadType,
|
||||||
|
.SupportedOutputs = Value.SupportedOutputs,
|
||||||
|
};
|
||||||
|
|
||||||
|
return Stream.Encode(Msg);
|
||||||
|
}
|
||||||
79
hal/src/main/native/cpp/proto/JoystickOutputDataProto.cpp
Normal file
79
hal/src/main/native/cpp/proto/JoystickOutputDataProto.cpp
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
// Copyright (c) FIRST and other WPILib contributors.
|
||||||
|
// Open Source Software; you can modify and/or share it under the terms of
|
||||||
|
// the WPILib BSD license file in the root directory of this project.
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
|
#include "wpi/hal/proto/JoystickOutput.h"
|
||||||
|
#include "wpi/util/protobuf/ProtobufCallbacks.hpp"
|
||||||
|
|
||||||
|
std::optional<mrc::JoystickOutputs>
|
||||||
|
wpi::util::Protobuf<mrc::JoystickOutputs>::Unpack(InputStream& Stream) {
|
||||||
|
wpi::util::UnpackCallback<mrc::JoystickOutput, MRC_MAX_NUM_JOYSTICKS>
|
||||||
|
JoystickOutputsCb;
|
||||||
|
|
||||||
|
mrc_proto_ProtobufJoystickOutputs Msg;
|
||||||
|
Msg.Outputs = JoystickOutputsCb.Callback();
|
||||||
|
|
||||||
|
if (!Stream.Decode(Msg)) {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
auto Outputs = JoystickOutputsCb.Items();
|
||||||
|
|
||||||
|
mrc::JoystickOutputs OutputData;
|
||||||
|
OutputData.SetOutputCount(Outputs.size());
|
||||||
|
for (size_t i = 0; i < OutputData.GetOutputCount(); i++) {
|
||||||
|
OutputData.Outputs()[i] = std::move(Outputs[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return OutputData;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wpi::util::Protobuf<mrc::JoystickOutputs>::Pack(
|
||||||
|
OutputStream& Stream, const mrc::JoystickOutputs& Value) {
|
||||||
|
std::span<const mrc::JoystickOutput> Outputs = Value.Outputs();
|
||||||
|
wpi::util::PackCallback JoystickOutputsCb{Outputs};
|
||||||
|
|
||||||
|
mrc_proto_ProtobufJoystickOutputs Msg{
|
||||||
|
.Outputs = JoystickOutputsCb.Callback(),
|
||||||
|
};
|
||||||
|
|
||||||
|
return Stream.Encode(Msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::optional<mrc::JoystickOutput>
|
||||||
|
wpi::util::Protobuf<mrc::JoystickOutput>::Unpack(InputStream& Stream) {
|
||||||
|
mrc_proto_ProtobufJoystickOutput Msg;
|
||||||
|
|
||||||
|
if (!Stream.Decode(Msg)) {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
return mrc::JoystickOutput{
|
||||||
|
.R = static_cast<uint8_t>((Msg.LEDs >> 16) & 0xFF),
|
||||||
|
.G = static_cast<uint8_t>((Msg.LEDs >> 8) & 0xFF),
|
||||||
|
.B = static_cast<uint8_t>(Msg.LEDs & 0xFF),
|
||||||
|
.LeftRumble = static_cast<uint16_t>((Msg.Rumble >> 16) & 0xFFFF),
|
||||||
|
.RightRumble = static_cast<uint16_t>(Msg.Rumble & 0xFFFF),
|
||||||
|
.LeftTriggerRumble =
|
||||||
|
static_cast<uint16_t>((Msg.TriggerRumble >> 16) & 0xFFFF),
|
||||||
|
.RightTriggerRumble = static_cast<uint16_t>(Msg.TriggerRumble & 0xFFFF),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wpi::util::Protobuf<mrc::JoystickOutput>::Pack(
|
||||||
|
OutputStream& Stream, const mrc::JoystickOutput& Value) {
|
||||||
|
mrc_proto_ProtobufJoystickOutput Msg{
|
||||||
|
.LEDs = (static_cast<uint32_t>(Value.R) << 16) |
|
||||||
|
(static_cast<uint32_t>(Value.G) << 8) |
|
||||||
|
static_cast<uint32_t>(Value.B),
|
||||||
|
.Rumble = (static_cast<uint32_t>(Value.LeftRumble) << 16) |
|
||||||
|
static_cast<uint32_t>(Value.RightRumble),
|
||||||
|
.TriggerRumble = (static_cast<uint32_t>(Value.LeftTriggerRumble) << 16) |
|
||||||
|
static_cast<uint32_t>(Value.RightTriggerRumble),
|
||||||
|
};
|
||||||
|
|
||||||
|
return Stream.Encode(Msg);
|
||||||
|
}
|
||||||
@@ -1,41 +0,0 @@
|
|||||||
// Copyright (c) FIRST and other WPILib contributors.
|
|
||||||
// Open Source Software; you can modify and/or share it under the terms of
|
|
||||||
// the WPILib BSD license file in the root directory of this project.
|
|
||||||
|
|
||||||
#include "wpi/hal/proto/JoystickRumbleData.h"
|
|
||||||
#include "wpi/util/protobuf/ProtobufCallbacks.hpp"
|
|
||||||
|
|
||||||
std::optional<mrc::JoystickRumbleData>
|
|
||||||
wpi::util::Protobuf<mrc::JoystickRumbleData>::Unpack(InputStream& Stream) {
|
|
||||||
wpi::util::UnpackCallback<uint16_t, MRC_MAX_NUM_RUMBLE> RumbleCb;
|
|
||||||
|
|
||||||
mrc_proto_ProtobufJoystickRumbleData Msg{
|
|
||||||
.Value = RumbleCb.Callback(),
|
|
||||||
};
|
|
||||||
|
|
||||||
if (!Stream.Decode(Msg)) {
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
|
|
||||||
auto Rumbles = RumbleCb.Items();
|
|
||||||
|
|
||||||
mrc::JoystickRumbleData Rumble;
|
|
||||||
Rumble.SetCount(Rumbles.size());
|
|
||||||
|
|
||||||
for (size_t i = 0; i < Rumble.GetCount(); i++) {
|
|
||||||
Rumble.Rumbles()[i] = Rumbles[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
return Rumble;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool wpi::util::Protobuf<mrc::JoystickRumbleData>::Pack(
|
|
||||||
OutputStream& Stream, const mrc::JoystickRumbleData& Value) {
|
|
||||||
wpi::util::PackCallback RumbleCb{Value.Rumbles()};
|
|
||||||
|
|
||||||
mrc_proto_ProtobufJoystickRumbleData Msg{
|
|
||||||
.Value = RumbleCb.Callback(),
|
|
||||||
};
|
|
||||||
|
|
||||||
return Stream.Encode(Msg);
|
|
||||||
}
|
|
||||||
@@ -131,13 +131,20 @@ HAL_Bool HAL_GetJoystickIsGamepad(int32_t joystickNum);
|
|||||||
/**
|
/**
|
||||||
* Gets the type of joystick connected.
|
* Gets the type of joystick connected.
|
||||||
*
|
*
|
||||||
* This is device specific, and different depending on what system input type
|
* This maps to SDL_GamepadType
|
||||||
* the joystick uses.
|
|
||||||
*
|
*
|
||||||
* @param joystickNum the joystick number
|
* @param joystickNum the joystick number
|
||||||
* @return the enumerated joystick type
|
* @return the enumerated gamepad type
|
||||||
*/
|
*/
|
||||||
int32_t HAL_GetJoystickType(int32_t joystickNum);
|
int32_t HAL_GetJoystickGamepadType(int32_t joystickNum);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the supported outputs of a specific joystick.
|
||||||
|
*
|
||||||
|
* @param joystickNum the joystick number
|
||||||
|
* @return bitmask of supported outputs
|
||||||
|
*/
|
||||||
|
int32_t HAL_GetJoystickSupportedOutputs(int32_t joystickNum);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the name of a joystick.
|
* Gets the name of a joystick.
|
||||||
@@ -150,16 +157,26 @@ int32_t HAL_GetJoystickType(int32_t joystickNum);
|
|||||||
void HAL_GetJoystickName(struct WPI_String* name, int32_t joystickNum);
|
void HAL_GetJoystickName(struct WPI_String* name, int32_t joystickNum);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set joystick outputs.
|
* Set joystick rumbles.
|
||||||
*
|
*
|
||||||
* @param joystickNum the joystick number
|
* @param joystickNum the joystick number
|
||||||
* @param outputs bitmask of outputs, 1 for on 0 for off
|
|
||||||
* @param leftRumble the left rumble value (0-FFFF)
|
* @param leftRumble the left rumble value (0-FFFF)
|
||||||
* @param rightRumble the right rumble value (0-FFFF)
|
* @param rightRumble the right rumble value (0-FFFF)
|
||||||
|
* @param leftTriggerRumble the left trigger rumble value (0-FFFF)
|
||||||
|
* @param rightTriggerRumble the right trigger rumble value (0-FFFF)
|
||||||
* @return the error code, or 0 for success
|
* @return the error code, or 0 for success
|
||||||
*/
|
*/
|
||||||
int32_t HAL_SetJoystickOutputs(int32_t joystickNum, int64_t outputs,
|
int32_t HAL_SetJoystickRumble(int32_t joystickNum, int32_t leftRumble,
|
||||||
int32_t leftRumble, int32_t rightRumble);
|
int32_t rightRumble, int32_t leftTriggerRumble,
|
||||||
|
int32_t rightTriggerRumble);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set joystick LEDs.
|
||||||
|
* @param joystickNum the joystick number
|
||||||
|
* @param leds the rgb led color value (0xRRGGBB)
|
||||||
|
* @return the error code, or 0 for success
|
||||||
|
*/
|
||||||
|
int32_t HAL_SetJoystickLeds(int32_t joystickNum, int32_t leds);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the approximate match time. The FMS does not send an official match
|
* Return the approximate match time. The FMS does not send an official match
|
||||||
|
|||||||
@@ -109,7 +109,8 @@ typedef struct HAL_JoystickButtons HAL_JoystickButtons;
|
|||||||
|
|
||||||
struct HAL_JoystickDescriptor {
|
struct HAL_JoystickDescriptor {
|
||||||
uint8_t isGamepad;
|
uint8_t isGamepad;
|
||||||
uint8_t type;
|
uint8_t gamepadType;
|
||||||
|
uint8_t supportedOutputs;
|
||||||
char name[256];
|
char name[256];
|
||||||
};
|
};
|
||||||
typedef struct HAL_JoystickDescriptor HAL_JoystickDescriptor;
|
typedef struct HAL_JoystickDescriptor HAL_JoystickDescriptor;
|
||||||
|
|||||||
@@ -10,6 +10,15 @@
|
|||||||
#include "mrc/NetComm.h"
|
#include "mrc/NetComm.h"
|
||||||
#include "wpi/util/protobuf/Protobuf.hpp"
|
#include "wpi/util/protobuf/Protobuf.hpp"
|
||||||
|
|
||||||
|
template <>
|
||||||
|
struct wpi::util::Protobuf<mrc::JoystickDescriptors> {
|
||||||
|
using MessageStruct = mrc_proto_ProtobufJoystickDescriptors;
|
||||||
|
using InputStream = wpi::util::ProtoInputStream<mrc::JoystickDescriptors>;
|
||||||
|
using OutputStream = wpi::util::ProtoOutputStream<mrc::JoystickDescriptors>;
|
||||||
|
static std::optional<mrc::JoystickDescriptors> Unpack(InputStream& Stream);
|
||||||
|
static bool Pack(OutputStream& Stream, const mrc::JoystickDescriptors& Value);
|
||||||
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct wpi::util::Protobuf<mrc::JoystickDescriptor> {
|
struct wpi::util::Protobuf<mrc::JoystickDescriptor> {
|
||||||
using MessageStruct = mrc_proto_ProtobufJoystickDescriptor;
|
using MessageStruct = mrc_proto_ProtobufJoystickDescriptor;
|
||||||
29
hal/src/main/native/include/wpi/hal/proto/JoystickOutput.h
Normal file
29
hal/src/main/native/include/wpi/hal/proto/JoystickOutput.h
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
// Copyright (c) FIRST and other WPILib contributors.
|
||||||
|
// Open Source Software; you can modify and/or share it under the terms of
|
||||||
|
// the WPILib BSD license file in the root directory of this project.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#include "MrcComm.npb.h"
|
||||||
|
#include "mrc/NetComm.h"
|
||||||
|
#include "wpi/util/protobuf/Protobuf.hpp"
|
||||||
|
|
||||||
|
template <>
|
||||||
|
struct wpi::util::Protobuf<mrc::JoystickOutput> {
|
||||||
|
using MessageStruct = mrc_proto_ProtobufJoystickOutput;
|
||||||
|
using InputStream = wpi::util::ProtoInputStream<mrc::JoystickOutput>;
|
||||||
|
using OutputStream = wpi::util::ProtoOutputStream<mrc::JoystickOutput>;
|
||||||
|
static std::optional<mrc::JoystickOutput> Unpack(InputStream& Stream);
|
||||||
|
static bool Pack(OutputStream& Stream, const mrc::JoystickOutput& Value);
|
||||||
|
};
|
||||||
|
|
||||||
|
template <>
|
||||||
|
struct wpi::util::Protobuf<mrc::JoystickOutputs> {
|
||||||
|
using MessageStruct = mrc_proto_ProtobufJoystickOutputs;
|
||||||
|
using InputStream = wpi::util::ProtoInputStream<mrc::JoystickOutputs>;
|
||||||
|
using OutputStream = wpi::util::ProtoOutputStream<mrc::JoystickOutputs>;
|
||||||
|
static std::optional<mrc::JoystickOutputs> Unpack(InputStream& Stream);
|
||||||
|
static bool Pack(OutputStream& Stream, const mrc::JoystickOutputs& Value);
|
||||||
|
};
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
// Copyright (c) FIRST and other WPILib contributors.
|
|
||||||
// Open Source Software; you can modify and/or share it under the terms of
|
|
||||||
// the WPILib BSD license file in the root directory of this project.
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
#include "MrcComm.npb.h"
|
|
||||||
#include "mrc/NetComm.h"
|
|
||||||
#include "wpi/util/protobuf/Protobuf.hpp"
|
|
||||||
|
|
||||||
template <>
|
|
||||||
struct wpi::util::Protobuf<mrc::JoystickRumbleData> {
|
|
||||||
using MessageStruct = mrc_proto_ProtobufJoystickRumbleData;
|
|
||||||
using InputStream = wpi::util::ProtoInputStream<mrc::JoystickRumbleData>;
|
|
||||||
using OutputStream = wpi::util::ProtoOutputStream<mrc::JoystickRumbleData>;
|
|
||||||
static std::optional<mrc::JoystickRumbleData> Unpack(InputStream& Stream);
|
|
||||||
static bool Pack(OutputStream& Stream, const mrc::JoystickRumbleData& Value);
|
|
||||||
};
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
// Copyright (c) FIRST and other WPILib contributors.
|
|
||||||
// Open Source Software; you can modify and/or share it under the terms of
|
|
||||||
// the WPILib BSD license file in the root directory of this project.
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
#include "MrcComm.npb.h"
|
|
||||||
#include "mrc/NetComm.h"
|
|
||||||
#include "wpi/util/protobuf/Protobuf.hpp"
|
|
||||||
|
|
||||||
template <>
|
|
||||||
struct wpi::util::Protobuf<mrc::VersionInfo> {
|
|
||||||
using MessageStruct = mrc_proto_ProtobufVersionInfo;
|
|
||||||
using InputStream = wpi::util::ProtoInputStream<mrc::VersionInfo>;
|
|
||||||
using OutputStream = wpi::util::ProtoOutputStream<mrc::VersionInfo>;
|
|
||||||
static std::optional<mrc::VersionInfo> Unpack(InputStream& Stream);
|
|
||||||
static bool Pack(OutputStream& Stream, const mrc::VersionInfo& Value);
|
|
||||||
};
|
|
||||||
@@ -23,10 +23,11 @@ typedef void (*HAL_JoystickButtonsCallback)(const char* name, void* param,
|
|||||||
typedef void (*HAL_JoystickDescriptorCallback)(
|
typedef void (*HAL_JoystickDescriptorCallback)(
|
||||||
const char* name, void* param, int32_t joystickNum,
|
const char* name, void* param, int32_t joystickNum,
|
||||||
const HAL_JoystickDescriptor* descriptor);
|
const HAL_JoystickDescriptor* descriptor);
|
||||||
typedef void (*HAL_JoystickOutputsCallback)(const char* name, void* param,
|
typedef void (*HAL_JoystickLedsCallback)(const char* name, void* param,
|
||||||
int32_t joystickNum,
|
int32_t joystickNum, int32_t leds);
|
||||||
int64_t outputs, int32_t leftRumble,
|
typedef void (*HAL_JoystickRumblesCallback)(
|
||||||
int32_t rightRumble);
|
const char* name, void* param, int32_t joystickNum, int32_t leftRumble,
|
||||||
|
int32_t rightRumble, int32_t leftTriggerRumble, int32_t rightTriggerRumble);
|
||||||
typedef void (*HAL_MatchInfoCallback)(const char* name, void* param,
|
typedef void (*HAL_MatchInfoCallback)(const char* name, void* param,
|
||||||
const HAL_MatchInfo* info);
|
const HAL_MatchInfo* info);
|
||||||
|
|
||||||
@@ -121,14 +122,24 @@ void HALSIM_GetJoystickDescriptor(int32_t joystickNum,
|
|||||||
void HALSIM_SetJoystickDescriptor(int32_t joystickNum,
|
void HALSIM_SetJoystickDescriptor(int32_t joystickNum,
|
||||||
const HAL_JoystickDescriptor* descriptor);
|
const HAL_JoystickDescriptor* descriptor);
|
||||||
|
|
||||||
int32_t HALSIM_RegisterJoystickOutputsCallback(
|
int32_t HALSIM_RegisterJoystickLedsCallback(int32_t joystickNum,
|
||||||
int32_t joystickNum, HAL_JoystickOutputsCallback callback, void* param,
|
HAL_JoystickLedsCallback callback,
|
||||||
|
void* param,
|
||||||
|
HAL_Bool initialNotify);
|
||||||
|
void HALSIM_CancelJoystickLedsCallback(int32_t uid);
|
||||||
|
void HALSIM_GetJoystickLeds(int32_t joystickNum, int32_t* leds);
|
||||||
|
void HALSIM_SetJoystickLeds(int32_t joystickNum, int32_t leds);
|
||||||
|
|
||||||
|
int32_t HALSIM_RegisterJoystickRumblesCallback(
|
||||||
|
int32_t joystickNum, HAL_JoystickRumblesCallback callback, void* param,
|
||||||
HAL_Bool initialNotify);
|
HAL_Bool initialNotify);
|
||||||
void HALSIM_CancelJoystickOutputsCallback(int32_t uid);
|
void HALSIM_CancelJoystickRumblesCallback(int32_t uid);
|
||||||
void HALSIM_GetJoystickOutputs(int32_t joystickNum, int64_t* outputs,
|
void HALSIM_GetJoystickRumbles(int32_t joystickNum, int32_t* leftRumble,
|
||||||
int32_t* leftRumble, int32_t* rightRumble);
|
int32_t* rightRumble, int32_t* leftTriggerRumble,
|
||||||
void HALSIM_SetJoystickOutputs(int32_t joystickNum, int64_t outputs,
|
int32_t* rightTriggerRumble);
|
||||||
int32_t leftRumble, int32_t rightRumble);
|
void HALSIM_SetJoystickRumbles(int32_t joystickNum, int32_t leftRumble,
|
||||||
|
int32_t rightRumble, int32_t leftTriggerRumble,
|
||||||
|
int32_t rightTriggerRumble);
|
||||||
|
|
||||||
int32_t HALSIM_RegisterMatchInfoCallback(HAL_MatchInfoCallback callback,
|
int32_t HALSIM_RegisterMatchInfoCallback(HAL_MatchInfoCallback callback,
|
||||||
void* param, HAL_Bool initialNotify);
|
void* param, HAL_Bool initialNotify);
|
||||||
@@ -148,8 +159,10 @@ void HALSIM_GetJoystickAvailables(int32_t stick, uint16_t* axesAvailable,
|
|||||||
uint8_t* povsAvailable);
|
uint8_t* povsAvailable);
|
||||||
|
|
||||||
void HALSIM_SetJoystickIsGamepad(int32_t stick, HAL_Bool isGamepad);
|
void HALSIM_SetJoystickIsGamepad(int32_t stick, HAL_Bool isGamepad);
|
||||||
void HALSIM_SetJoystickType(int32_t stick, int32_t type);
|
void HALSIM_SetJoystickGamepadType(int32_t stick, int32_t type);
|
||||||
void HALSIM_SetJoystickName(int32_t stick, const struct WPI_String* name);
|
void HALSIM_SetJoystickName(int32_t stick, const struct WPI_String* name);
|
||||||
|
void HALSIM_SetJoystickSupportedOutputs(int32_t stick,
|
||||||
|
int32_t supportedOutputs);
|
||||||
|
|
||||||
void HALSIM_SetGameSpecificMessage(const struct WPI_String* message);
|
void HALSIM_SetGameSpecificMessage(const struct WPI_String* message);
|
||||||
void HALSIM_SetEventName(const struct WPI_String* name);
|
void HALSIM_SetEventName(const struct WPI_String* name);
|
||||||
|
|||||||
@@ -295,12 +295,21 @@ HAL_Bool HAL_GetJoystickIsGamepad(int32_t joystickNum) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t HAL_GetJoystickType(int32_t joystickNum) {
|
int32_t HAL_GetJoystickGamepadType(int32_t joystickNum) {
|
||||||
HAL_JoystickDescriptor joystickDesc;
|
HAL_JoystickDescriptor joystickDesc;
|
||||||
if (HAL_GetJoystickDescriptor(joystickNum, &joystickDesc) < 0) {
|
if (HAL_GetJoystickDescriptor(joystickNum, &joystickDesc) < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
} else {
|
} else {
|
||||||
return joystickDesc.type;
|
return joystickDesc.gamepadType;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t HAL_GetJoystickSupportedOutputs(int32_t joystickNum) {
|
||||||
|
HAL_JoystickDescriptor joystickDesc;
|
||||||
|
if (HAL_GetJoystickDescriptor(joystickNum, &joystickDesc) < 0) {
|
||||||
|
return -1;
|
||||||
|
} else {
|
||||||
|
return joystickDesc.supportedOutputs;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -315,10 +324,17 @@ void HAL_GetJoystickName(struct WPI_String* name, int32_t joystickNum) {
|
|||||||
std::memcpy(write, cName, len);
|
std::memcpy(write, cName, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t HAL_SetJoystickOutputs(int32_t joystickNum, int64_t outputs,
|
int32_t HAL_SetJoystickRumble(int32_t joystickNum, int32_t leftRumble,
|
||||||
int32_t leftRumble, int32_t rightRumble) {
|
int32_t rightRumble, int32_t leftTriggerRumble,
|
||||||
SimDriverStationData->SetJoystickOutputs(joystickNum, outputs, leftRumble,
|
int32_t rightTriggerRumble) {
|
||||||
rightRumble);
|
SimDriverStationData->SetJoystickRumbles(joystickNum, leftRumble, rightRumble,
|
||||||
|
leftTriggerRumble,
|
||||||
|
rightTriggerRumble);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t HAL_SetJoystickLeds(int32_t joystickNum, int32_t leds) {
|
||||||
|
SimDriverStationData->SetJoystickLeds(joystickNum, leds);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -36,14 +36,22 @@ void DriverStationData::ResetData() {
|
|||||||
m_joystickAxesCallbacks.Reset();
|
m_joystickAxesCallbacks.Reset();
|
||||||
m_joystickPOVsCallbacks.Reset();
|
m_joystickPOVsCallbacks.Reset();
|
||||||
m_joystickButtonsCallbacks.Reset();
|
m_joystickButtonsCallbacks.Reset();
|
||||||
m_joystickOutputsCallbacks.Reset();
|
m_joystickLedsCallbacks.Reset();
|
||||||
|
m_joystickRumblesCallbacks.Reset();
|
||||||
m_joystickDescriptorCallbacks.Reset();
|
m_joystickDescriptorCallbacks.Reset();
|
||||||
for (int i = 0; i < kNumJoysticks; i++) {
|
for (int i = 0; i < kNumJoysticks; i++) {
|
||||||
m_joystickData[i].axes = HAL_JoystickAxes{};
|
m_joystickData[i].axes = HAL_JoystickAxes{};
|
||||||
m_joystickData[i].povs = HAL_JoystickPOVs{};
|
m_joystickData[i].povs = HAL_JoystickPOVs{};
|
||||||
m_joystickData[i].buttons = HAL_JoystickButtons{};
|
m_joystickData[i].buttons = HAL_JoystickButtons{};
|
||||||
m_joystickData[i].descriptor = HAL_JoystickDescriptor{};
|
m_joystickData[i].descriptor = HAL_JoystickDescriptor{};
|
||||||
m_joystickData[i].descriptor.type = -1;
|
m_joystickData[i].outputs.leds = 0;
|
||||||
|
m_joystickData[i].outputs.leftRumble = 0;
|
||||||
|
m_joystickData[i].outputs.rightRumble = 0;
|
||||||
|
m_joystickData[i].outputs.leftTriggerRumble = 0;
|
||||||
|
m_joystickData[i].outputs.rightTriggerRumble = 0;
|
||||||
|
m_joystickData[i].descriptor.gamepadType = 0;
|
||||||
|
m_joystickData[i].descriptor.isGamepad = 0;
|
||||||
|
m_joystickData[i].descriptor.supportedOutputs = 0;
|
||||||
m_joystickData[i].descriptor.name[0] = '\0';
|
m_joystickData[i].descriptor.name[0] = '\0';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -121,50 +129,96 @@ void DriverStationData::SetJoystickDescriptor(
|
|||||||
m_joystickDescriptorCallbacks(joystickNum, descriptor);
|
m_joystickDescriptorCallbacks(joystickNum, descriptor);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t DriverStationData::RegisterJoystickOutputsCallback(
|
int32_t DriverStationData::RegisterJoystickLedsCallback(
|
||||||
int32_t joystickNum, HAL_JoystickOutputsCallback callback, void* param,
|
int32_t joystickNum, HAL_JoystickLedsCallback callback, void* param,
|
||||||
HAL_Bool initialNotify) {
|
HAL_Bool initialNotify) {
|
||||||
if (joystickNum < 0 || joystickNum >= DriverStationData::kNumJoysticks) {
|
if (joystickNum < 0 || joystickNum >= DriverStationData::kNumJoysticks) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
std::scoped_lock lock(m_joystickDataMutex);
|
std::scoped_lock lock(m_joystickDataMutex);
|
||||||
int32_t uid = m_joystickOutputsCallbacks.Register(callback, param);
|
int32_t uid = m_joystickLedsCallbacks.Register(callback, param);
|
||||||
if (initialNotify) {
|
if (initialNotify) {
|
||||||
const auto& outputs = m_joystickData[joystickNum].outputs;
|
const auto& outputs = m_joystickData[joystickNum].outputs;
|
||||||
callback(DriverStationData::GetJoystickOutputsName(), param, joystickNum,
|
callback(DriverStationData::GetJoystickLedsName(), param, joystickNum,
|
||||||
outputs.outputs, outputs.leftRumble, outputs.rightRumble);
|
outputs.leds);
|
||||||
}
|
}
|
||||||
return uid;
|
return uid;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DriverStationData::CancelJoystickOutputsCallback(int32_t uid) {
|
void DriverStationData::CancelJoystickLedsCallback(int32_t uid) {
|
||||||
m_joystickOutputsCallbacks.Cancel(uid);
|
m_joystickLedsCallbacks.Cancel(uid);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DriverStationData::GetJoystickOutputs(int32_t joystickNum,
|
void DriverStationData::GetJoystickLeds(int32_t joystickNum, int32_t* leds) {
|
||||||
int64_t* outputs,
|
if (joystickNum < 0 || joystickNum >= kNumJoysticks) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
std::scoped_lock lock(m_joystickDataMutex);
|
||||||
|
*leds = m_joystickData[joystickNum].outputs.leds;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DriverStationData::SetJoystickLeds(int32_t joystickNum, int32_t leds) {
|
||||||
|
if (joystickNum < 0 || joystickNum >= kNumJoysticks) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
std::scoped_lock lock(m_joystickDataMutex);
|
||||||
|
m_joystickData[joystickNum].outputs.leds = leds;
|
||||||
|
m_joystickLedsCallbacks(joystickNum, leds);
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t DriverStationData::RegisterJoystickRumblesCallback(
|
||||||
|
int32_t joystickNum, HAL_JoystickRumblesCallback callback, void* param,
|
||||||
|
HAL_Bool initialNotify) {
|
||||||
|
if (joystickNum < 0 || joystickNum >= DriverStationData::kNumJoysticks) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
std::scoped_lock lock(m_joystickDataMutex);
|
||||||
|
int32_t uid = m_joystickRumblesCallbacks.Register(callback, param);
|
||||||
|
if (initialNotify) {
|
||||||
|
const auto& outputs = m_joystickData[joystickNum].outputs;
|
||||||
|
callback(DriverStationData::GetJoystickRumblesName(), param, joystickNum,
|
||||||
|
outputs.leftRumble, outputs.rightRumble, outputs.leftTriggerRumble,
|
||||||
|
outputs.rightTriggerRumble);
|
||||||
|
}
|
||||||
|
return uid;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DriverStationData::CancelJoystickRumblesCallback(int32_t uid) {
|
||||||
|
m_joystickRumblesCallbacks.Cancel(uid);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DriverStationData::GetJoystickRumbles(int32_t joystickNum,
|
||||||
int32_t* leftRumble,
|
int32_t* leftRumble,
|
||||||
int32_t* rightRumble) {
|
int32_t* rightRumble,
|
||||||
|
int32_t* leftTriggerRumble,
|
||||||
|
int32_t* rightTriggerRumble) {
|
||||||
if (joystickNum < 0 || joystickNum >= kNumJoysticks) {
|
if (joystickNum < 0 || joystickNum >= kNumJoysticks) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
std::scoped_lock lock(m_joystickDataMutex);
|
std::scoped_lock lock(m_joystickDataMutex);
|
||||||
*leftRumble = m_joystickData[joystickNum].outputs.leftRumble;
|
const auto& outputs = m_joystickData[joystickNum].outputs;
|
||||||
*outputs = m_joystickData[joystickNum].outputs.outputs;
|
*leftRumble = outputs.leftRumble;
|
||||||
*rightRumble = m_joystickData[joystickNum].outputs.rightRumble;
|
*rightRumble = outputs.rightRumble;
|
||||||
|
*leftTriggerRumble = outputs.leftTriggerRumble;
|
||||||
|
*rightTriggerRumble = outputs.rightTriggerRumble;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DriverStationData::SetJoystickOutputs(int32_t joystickNum, int64_t outputs,
|
void DriverStationData::SetJoystickRumbles(int32_t joystickNum,
|
||||||
int32_t leftRumble,
|
int32_t leftRumble,
|
||||||
int32_t rightRumble) {
|
int32_t rightRumble,
|
||||||
|
int32_t leftTriggerRumble,
|
||||||
|
int32_t rightTriggerRumble) {
|
||||||
if (joystickNum < 0 || joystickNum >= kNumJoysticks) {
|
if (joystickNum < 0 || joystickNum >= kNumJoysticks) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
std::scoped_lock lock(m_joystickDataMutex);
|
std::scoped_lock lock(m_joystickDataMutex);
|
||||||
m_joystickData[joystickNum].outputs.leftRumble = leftRumble;
|
auto& outputs = m_joystickData[joystickNum].outputs;
|
||||||
m_joystickData[joystickNum].outputs.outputs = outputs;
|
outputs.leftRumble = leftRumble;
|
||||||
m_joystickData[joystickNum].outputs.rightRumble = rightRumble;
|
outputs.rightRumble = rightRumble;
|
||||||
m_joystickOutputsCallbacks(joystickNum, outputs, leftRumble, rightRumble);
|
outputs.leftTriggerRumble = leftTriggerRumble;
|
||||||
|
outputs.rightTriggerRumble = rightTriggerRumble;
|
||||||
|
m_joystickRumblesCallbacks(joystickNum, leftRumble, rightRumble,
|
||||||
|
leftTriggerRumble, rightTriggerRumble);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t DriverStationData::RegisterMatchInfoCallback(
|
int32_t DriverStationData::RegisterMatchInfoCallback(
|
||||||
@@ -328,12 +382,22 @@ void DriverStationData::SetJoystickIsGamepad(int32_t stick,
|
|||||||
m_joystickDescriptorCallbacks(stick, &m_joystickData[stick].descriptor);
|
m_joystickDescriptorCallbacks(stick, &m_joystickData[stick].descriptor);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DriverStationData::SetJoystickType(int32_t stick, int32_t type) {
|
void DriverStationData::SetJoystickGamepadType(int32_t stick, int32_t type) {
|
||||||
if (stick < 0 || stick >= kNumJoysticks) {
|
if (stick < 0 || stick >= kNumJoysticks) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
std::scoped_lock lock(m_joystickDataMutex);
|
std::scoped_lock lock(m_joystickDataMutex);
|
||||||
m_joystickData[stick].descriptor.type = type;
|
m_joystickData[stick].descriptor.gamepadType = type;
|
||||||
|
m_joystickDescriptorCallbacks(stick, &m_joystickData[stick].descriptor);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DriverStationData::SetJoystickSupportedOutputs(int32_t stick,
|
||||||
|
int32_t supportedOutputs) {
|
||||||
|
if (stick < 0 || stick >= kNumJoysticks) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
std::scoped_lock lock(m_joystickDataMutex);
|
||||||
|
m_joystickData[stick].descriptor.supportedOutputs = supportedOutputs;
|
||||||
m_joystickDescriptorCallbacks(stick, &m_joystickData[stick].descriptor);
|
m_joystickDescriptorCallbacks(stick, &m_joystickData[stick].descriptor);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -428,27 +492,51 @@ DEFINE_CAPI(POVs, povs)
|
|||||||
DEFINE_CAPI(Buttons, buttons)
|
DEFINE_CAPI(Buttons, buttons)
|
||||||
DEFINE_CAPI(Descriptor, descriptor)
|
DEFINE_CAPI(Descriptor, descriptor)
|
||||||
|
|
||||||
int32_t HALSIM_RegisterJoystickOutputsCallback(
|
int32_t HALSIM_RegisterJoystickLedsCallback(int32_t joystickNum,
|
||||||
int32_t joystickNum, HAL_JoystickOutputsCallback callback, void* param,
|
HAL_JoystickLedsCallback callback,
|
||||||
HAL_Bool initialNotify) {
|
void* param,
|
||||||
return SimDriverStationData->RegisterJoystickOutputsCallback(
|
HAL_Bool initialNotify) {
|
||||||
|
return SimDriverStationData->RegisterJoystickLedsCallback(
|
||||||
joystickNum, callback, param, initialNotify);
|
joystickNum, callback, param, initialNotify);
|
||||||
}
|
}
|
||||||
|
|
||||||
void HALSIM_CancelJoystickOutputsCallback(int32_t uid) {
|
void HALSIM_CancelJoystickLedsCallback(int32_t uid) {
|
||||||
SimDriverStationData->CancelJoystickOutputsCallback(uid);
|
SimDriverStationData->CancelJoystickLedsCallback(uid);
|
||||||
}
|
}
|
||||||
|
|
||||||
void HALSIM_GetJoystickOutputs(int32_t joystickNum, int64_t* outputs,
|
void HALSIM_GetJoystickLeds(int32_t joystickNum, int32_t* leds) {
|
||||||
int32_t* leftRumble, int32_t* rightRumble) {
|
SimDriverStationData->GetJoystickLeds(joystickNum, leds);
|
||||||
SimDriverStationData->GetJoystickOutputs(joystickNum, outputs, leftRumble,
|
|
||||||
rightRumble);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void HALSIM_SetJoystickOutputs(int32_t joystickNum, int64_t outputs,
|
void HALSIM_SetJoystickLeds(int32_t joystickNum, int32_t leds) {
|
||||||
int32_t leftRumble, int32_t rightRumble) {
|
SimDriverStationData->SetJoystickLeds(joystickNum, leds);
|
||||||
SimDriverStationData->SetJoystickOutputs(joystickNum, outputs, leftRumble,
|
}
|
||||||
rightRumble);
|
|
||||||
|
int32_t HALSIM_RegisterJoystickRumblesCallback(
|
||||||
|
int32_t joystickNum, HAL_JoystickRumblesCallback callback, void* param,
|
||||||
|
HAL_Bool initialNotify) {
|
||||||
|
return SimDriverStationData->RegisterJoystickRumblesCallback(
|
||||||
|
joystickNum, callback, param, initialNotify);
|
||||||
|
}
|
||||||
|
|
||||||
|
void HALSIM_CancelJoystickRumblesCallback(int32_t uid) {
|
||||||
|
SimDriverStationData->CancelJoystickRumblesCallback(uid);
|
||||||
|
}
|
||||||
|
|
||||||
|
void HALSIM_GetJoystickRumbles(int32_t joystickNum, int32_t* leftRumble,
|
||||||
|
int32_t* rightRumble, int32_t* leftTriggerRumble,
|
||||||
|
int32_t* rightTriggerRumble) {
|
||||||
|
SimDriverStationData->GetJoystickRumbles(joystickNum, leftRumble, rightRumble,
|
||||||
|
leftTriggerRumble,
|
||||||
|
rightTriggerRumble);
|
||||||
|
}
|
||||||
|
|
||||||
|
void HALSIM_SetJoystickRumbles(int32_t joystickNum, int32_t leftRumble,
|
||||||
|
int32_t rightRumble, int32_t leftTriggerRumble,
|
||||||
|
int32_t rightTriggerRumble) {
|
||||||
|
SimDriverStationData->SetJoystickRumbles(joystickNum, leftRumble, rightRumble,
|
||||||
|
leftTriggerRumble,
|
||||||
|
rightTriggerRumble);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t HALSIM_RegisterMatchInfoCallback(HAL_MatchInfoCallback callback,
|
int32_t HALSIM_RegisterMatchInfoCallback(HAL_MatchInfoCallback callback,
|
||||||
@@ -523,8 +611,13 @@ void HALSIM_SetJoystickIsGamepad(int32_t stick, HAL_Bool isGamepad) {
|
|||||||
SimDriverStationData->SetJoystickIsGamepad(stick, isGamepad);
|
SimDriverStationData->SetJoystickIsGamepad(stick, isGamepad);
|
||||||
}
|
}
|
||||||
|
|
||||||
void HALSIM_SetJoystickType(int32_t stick, int32_t type) {
|
void HALSIM_SetJoystickGamepadType(int32_t stick, int32_t type) {
|
||||||
SimDriverStationData->SetJoystickType(stick, type);
|
SimDriverStationData->SetJoystickGamepadType(stick, type);
|
||||||
|
}
|
||||||
|
|
||||||
|
void HALSIM_SetJoystickSupportedOutputs(int32_t stick,
|
||||||
|
int32_t supportedOutputs) {
|
||||||
|
SimDriverStationData->SetJoystickSupportedOutputs(stick, supportedOutputs);
|
||||||
}
|
}
|
||||||
|
|
||||||
void HALSIM_SetJoystickName(int32_t stick, const WPI_String* name) {
|
void HALSIM_SetJoystickName(int32_t stick, const WPI_String* name) {
|
||||||
|
|||||||
@@ -26,7 +26,8 @@ class DriverStationData {
|
|||||||
HAL_SIMCALLBACKREGISTRY_DEFINE_NAME(JoystickPOVs)
|
HAL_SIMCALLBACKREGISTRY_DEFINE_NAME(JoystickPOVs)
|
||||||
HAL_SIMCALLBACKREGISTRY_DEFINE_NAME(JoystickButtons)
|
HAL_SIMCALLBACKREGISTRY_DEFINE_NAME(JoystickButtons)
|
||||||
HAL_SIMCALLBACKREGISTRY_DEFINE_NAME(JoystickDescriptor)
|
HAL_SIMCALLBACKREGISTRY_DEFINE_NAME(JoystickDescriptor)
|
||||||
HAL_SIMCALLBACKREGISTRY_DEFINE_NAME(JoystickOutputs)
|
HAL_SIMCALLBACKREGISTRY_DEFINE_NAME(JoystickLeds)
|
||||||
|
HAL_SIMCALLBACKREGISTRY_DEFINE_NAME(JoystickRumbles)
|
||||||
HAL_SIMCALLBACKREGISTRY_DEFINE_NAME(MatchInfo)
|
HAL_SIMCALLBACKREGISTRY_DEFINE_NAME(MatchInfo)
|
||||||
HAL_SIMCALLBACKREGISTRY_DEFINE_NAME(NewData)
|
HAL_SIMCALLBACKREGISTRY_DEFINE_NAME(NewData)
|
||||||
|
|
||||||
@@ -70,14 +71,22 @@ class DriverStationData {
|
|||||||
void SetJoystickDescriptor(int32_t joystickNum,
|
void SetJoystickDescriptor(int32_t joystickNum,
|
||||||
const HAL_JoystickDescriptor* descriptor);
|
const HAL_JoystickDescriptor* descriptor);
|
||||||
|
|
||||||
int32_t RegisterJoystickOutputsCallback(int32_t joystickNum,
|
int32_t RegisterJoystickLedsCallback(int32_t joystickNum,
|
||||||
HAL_JoystickOutputsCallback callback,
|
HAL_JoystickLedsCallback callback,
|
||||||
|
void* param, HAL_Bool initialNotify);
|
||||||
|
void CancelJoystickLedsCallback(int32_t uid);
|
||||||
|
void GetJoystickLeds(int32_t joystickNum, int32_t* leds);
|
||||||
|
void SetJoystickLeds(int32_t joystickNum, int32_t leds);
|
||||||
|
int32_t RegisterJoystickRumblesCallback(int32_t joystickNum,
|
||||||
|
HAL_JoystickRumblesCallback callback,
|
||||||
void* param, HAL_Bool initialNotify);
|
void* param, HAL_Bool initialNotify);
|
||||||
void CancelJoystickOutputsCallback(int32_t uid);
|
void CancelJoystickRumblesCallback(int32_t uid);
|
||||||
void GetJoystickOutputs(int32_t joystickNum, int64_t* outputs,
|
void GetJoystickRumbles(int32_t joystickNum, int32_t* leftRumble,
|
||||||
int32_t* leftRumble, int32_t* rightRumble);
|
int32_t* rightRumble, int32_t* leftTriggerRumble,
|
||||||
void SetJoystickOutputs(int32_t joystickNum, int64_t outputs,
|
int32_t* rightTriggerRumble);
|
||||||
int32_t leftRumble, int32_t rightRumble);
|
void SetJoystickRumbles(int32_t joystickNum, int32_t leftRumble,
|
||||||
|
int32_t rightRumble, int32_t leftTriggerRumble,
|
||||||
|
int32_t rightTriggerRumble);
|
||||||
|
|
||||||
int32_t RegisterMatchInfoCallback(HAL_MatchInfoCallback callback, void* param,
|
int32_t RegisterMatchInfoCallback(HAL_MatchInfoCallback callback, void* param,
|
||||||
HAL_Bool initialNotify);
|
HAL_Bool initialNotify);
|
||||||
@@ -106,8 +115,9 @@ class DriverStationData {
|
|||||||
uint8_t* povsAvailable);
|
uint8_t* povsAvailable);
|
||||||
|
|
||||||
void SetJoystickIsGamepad(int32_t stick, HAL_Bool isGamepad);
|
void SetJoystickIsGamepad(int32_t stick, HAL_Bool isGamepad);
|
||||||
void SetJoystickType(int32_t stick, int32_t type);
|
void SetJoystickGamepadType(int32_t stick, int32_t type);
|
||||||
void SetJoystickName(int32_t stick, std::string_view message);
|
void SetJoystickName(int32_t stick, std::string_view message);
|
||||||
|
void SetJoystickSupportedOutputs(int32_t stick, int32_t supportedOutputs);
|
||||||
|
|
||||||
void SetGameSpecificMessage(std::string_view message);
|
void SetGameSpecificMessage(std::string_view message);
|
||||||
void SetEventName(std::string_view name);
|
void SetEventName(std::string_view name);
|
||||||
@@ -134,8 +144,10 @@ class DriverStationData {
|
|||||||
m_joystickPOVsCallbacks;
|
m_joystickPOVsCallbacks;
|
||||||
SimCallbackRegistry<HAL_JoystickButtonsCallback, GetJoystickButtonsName>
|
SimCallbackRegistry<HAL_JoystickButtonsCallback, GetJoystickButtonsName>
|
||||||
m_joystickButtonsCallbacks;
|
m_joystickButtonsCallbacks;
|
||||||
SimCallbackRegistry<HAL_JoystickOutputsCallback, GetJoystickOutputsName>
|
SimCallbackRegistry<HAL_JoystickLedsCallback, GetJoystickLedsName>
|
||||||
m_joystickOutputsCallbacks;
|
m_joystickLedsCallbacks;
|
||||||
|
SimCallbackRegistry<HAL_JoystickRumblesCallback, GetJoystickRumblesName>
|
||||||
|
m_joystickRumblesCallbacks;
|
||||||
SimCallbackRegistry<HAL_JoystickDescriptorCallback, GetJoystickDescriptorName>
|
SimCallbackRegistry<HAL_JoystickDescriptorCallback, GetJoystickDescriptorName>
|
||||||
m_joystickDescriptorCallbacks;
|
m_joystickDescriptorCallbacks;
|
||||||
SimCallbackRegistry<HAL_MatchInfoCallback, GetMatchInfoName>
|
SimCallbackRegistry<HAL_MatchInfoCallback, GetMatchInfoName>
|
||||||
@@ -143,9 +155,11 @@ class DriverStationData {
|
|||||||
SimCallbackRegistry<HAL_NotifyCallback, GetNewDataName> m_newDataCallbacks;
|
SimCallbackRegistry<HAL_NotifyCallback, GetNewDataName> m_newDataCallbacks;
|
||||||
|
|
||||||
struct JoystickOutputStore {
|
struct JoystickOutputStore {
|
||||||
int64_t outputs = 0;
|
int32_t leds = 0;
|
||||||
int32_t leftRumble = 0;
|
int32_t leftRumble = 0;
|
||||||
int32_t rightRumble = 0;
|
int32_t rightRumble = 0;
|
||||||
|
int32_t leftTriggerRumble = 0;
|
||||||
|
int32_t rightTriggerRumble = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct JoystickData {
|
struct JoystickData {
|
||||||
|
|||||||
@@ -22,8 +22,8 @@
|
|||||||
#include "wpi/hal/Errors.h"
|
#include "wpi/hal/Errors.h"
|
||||||
#include "wpi/hal/proto/ControlData.h"
|
#include "wpi/hal/proto/ControlData.h"
|
||||||
#include "wpi/hal/proto/ErrorInfo.h"
|
#include "wpi/hal/proto/ErrorInfo.h"
|
||||||
#include "wpi/hal/proto/JoystickDescriptor.h"
|
#include "wpi/hal/proto/JoystickDescriptors.h"
|
||||||
#include "wpi/hal/proto/JoystickRumbleData.h"
|
#include "wpi/hal/proto/JoystickOutput.h"
|
||||||
#include "wpi/hal/proto/MatchInfo.h"
|
#include "wpi/hal/proto/MatchInfo.h"
|
||||||
#include "wpi/hal/proto/OpMode.h"
|
#include "wpi/hal/proto/OpMode.h"
|
||||||
#include "wpi/nt/BooleanTopic.hpp"
|
#include "wpi/nt/BooleanTopic.hpp"
|
||||||
@@ -72,17 +72,16 @@ struct SystemServerDriverStation {
|
|||||||
wpi::nt::ProtobufSubscriber<mrc::MatchInfo> matchInfoSubscriber;
|
wpi::nt::ProtobufSubscriber<mrc::MatchInfo> matchInfoSubscriber;
|
||||||
wpi::nt::StringSubscriber gameSpecificMessageSubscriber;
|
wpi::nt::StringSubscriber gameSpecificMessageSubscriber;
|
||||||
|
|
||||||
std::array<wpi::nt::ProtobufSubscriber<mrc::JoystickDescriptor>,
|
wpi::nt::ProtobufSubscriber<mrc::JoystickDescriptors>
|
||||||
MRC_MAX_NUM_JOYSTICKS>
|
joystickDescriptorsTopic;
|
||||||
joystickDescriptorTopics;
|
|
||||||
|
|
||||||
wpi::nt::StringPublisher versionPublisher;
|
wpi::nt::StringPublisher versionPublisher;
|
||||||
wpi::nt::StringPublisher consoleLinePublisher;
|
wpi::nt::StringPublisher consoleLinePublisher;
|
||||||
wpi::nt::ProtobufPublisher<mrc::ErrorInfo> errorInfoPublisher;
|
wpi::nt::ProtobufPublisher<mrc::ErrorInfo> errorInfoPublisher;
|
||||||
|
|
||||||
std::array<wpi::nt::ProtobufPublisher<mrc::JoystickRumbleData>,
|
std::array<wpi::nt::ProtobufPublisher<mrc::JoystickOutput>,
|
||||||
MRC_MAX_NUM_JOYSTICKS>
|
MRC_MAX_NUM_JOYSTICKS>
|
||||||
joystickRumbleTopics;
|
joystickOutputTopics;
|
||||||
|
|
||||||
wpi::nt::ProtobufPublisher<std::vector<mrc::OpMode>> teleopOpModes;
|
wpi::nt::ProtobufPublisher<std::vector<mrc::OpMode>> teleopOpModes;
|
||||||
wpi::nt::ProtobufPublisher<std::vector<mrc::OpMode>> autoOpModes;
|
wpi::nt::ProtobufPublisher<std::vector<mrc::OpMode>> autoOpModes;
|
||||||
@@ -95,6 +94,9 @@ struct SystemServerDriverStation {
|
|||||||
wpi::util::ProtobufMessage<mrc::ControlData> controlDataMsg;
|
wpi::util::ProtobufMessage<mrc::ControlData> controlDataMsg;
|
||||||
wpi::nt::Value lastValue;
|
wpi::nt::Value lastValue;
|
||||||
|
|
||||||
|
wpi::util::mutex joystickOutputMutexes[MRC_MAX_NUM_JOYSTICKS];
|
||||||
|
mrc::JoystickOutput joystickOutputs[MRC_MAX_NUM_JOYSTICKS];
|
||||||
|
|
||||||
explicit SystemServerDriverStation(wpi::nt::NetworkTableInstance inst) {
|
explicit SystemServerDriverStation(wpi::nt::NetworkTableInstance inst) {
|
||||||
ntInst = inst;
|
ntInst = inst;
|
||||||
|
|
||||||
@@ -106,12 +108,11 @@ struct SystemServerDriverStation {
|
|||||||
hasUserCodeReadyPublisher =
|
hasUserCodeReadyPublisher =
|
||||||
ntInst.GetBooleanTopic(ROBOT_HAS_USER_CODE_READY_PATH).Publish(options);
|
ntInst.GetBooleanTopic(ROBOT_HAS_USER_CODE_READY_PATH).Publish(options);
|
||||||
|
|
||||||
for (size_t count = 0; count < joystickRumbleTopics.size(); count++) {
|
for (size_t count = 0; count < joystickOutputTopics.size(); count++) {
|
||||||
std::string name = ROBOT_JOYSTICK_RUMBLE_PATH;
|
std::string name = ROBOT_JOYSTICK_OUTPUTS_PATH;
|
||||||
name += std::to_string(count);
|
name += std::to_string(count);
|
||||||
joystickRumbleTopics[count] =
|
joystickOutputTopics[count] =
|
||||||
ntInst.GetProtobufTopic<mrc::JoystickRumbleData>(name).Publish(
|
ntInst.GetProtobufTopic<mrc::JoystickOutput>(name).Publish(options);
|
||||||
options);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
hasUserCodePublisher =
|
hasUserCodePublisher =
|
||||||
@@ -142,12 +143,10 @@ struct SystemServerDriverStation {
|
|||||||
gameSpecificMessageSubscriber =
|
gameSpecificMessageSubscriber =
|
||||||
ntInst.GetStringTopic(ROBOT_GAME_SPECIFIC_MESSAGE_PATH).Subscribe({});
|
ntInst.GetStringTopic(ROBOT_GAME_SPECIFIC_MESSAGE_PATH).Subscribe({});
|
||||||
|
|
||||||
for (size_t count = 0; count < joystickDescriptorTopics.size(); count++) {
|
joystickDescriptorsTopic = ntInst
|
||||||
std::string name = ROBOT_JOYSTICK_DESCRIPTORS_PATH;
|
.GetProtobufTopic<mrc::JoystickDescriptors>(
|
||||||
name += std::to_string(count);
|
ROBOT_JOYSTICK_DESCRIPTORS_PATH)
|
||||||
joystickDescriptorTopics[count] =
|
.Subscribe({});
|
||||||
ntInst.GetProtobufTopic<mrc::JoystickDescriptor>(name).Subscribe({});
|
|
||||||
}
|
|
||||||
|
|
||||||
teleopOpModes = ntInst
|
teleopOpModes = ntInst
|
||||||
.GetProtobufTopic<std::vector<mrc::OpMode>>(
|
.GetProtobufTopic<std::vector<mrc::OpMode>>(
|
||||||
@@ -333,14 +332,17 @@ void TcpCache::Update() {
|
|||||||
}
|
}
|
||||||
matchInfo.gameSpecificMessageSize = gameDataLen;
|
matchInfo.gameSpecificMessageSize = gameDataLen;
|
||||||
|
|
||||||
for (size_t count = 0;
|
const auto descriptorsMsg = systemServerDs->joystickDescriptorsTopic.Get();
|
||||||
count < systemServerDs->joystickDescriptorTopics.size(); count++) {
|
size_t descriptorCount = descriptorsMsg.GetDescriptorCount();
|
||||||
auto newDesc = systemServerDs->joystickDescriptorTopics[count].Get();
|
|
||||||
|
for (size_t count = 0; count < descriptorCount; count++) {
|
||||||
|
const auto& newDesc = descriptorsMsg.Descriptors()[count];
|
||||||
|
|
||||||
auto& desc = descriptors[count];
|
auto& desc = descriptors[count];
|
||||||
|
|
||||||
desc.isGamepad = newDesc.IsGamepad;
|
desc.isGamepad = newDesc.IsGamepad;
|
||||||
desc.type = newDesc.Type;
|
desc.supportedOutputs = newDesc.SupportedOutputs;
|
||||||
|
desc.gamepadType = newDesc.GamepadType;
|
||||||
|
|
||||||
auto joystickName = newDesc.GetName();
|
auto joystickName = newDesc.GetName();
|
||||||
auto joystickNameLen =
|
auto joystickNameLen =
|
||||||
@@ -519,12 +521,21 @@ HAL_Bool HAL_GetJoystickIsGamepad(int32_t joystickNum) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t HAL_GetJoystickType(int32_t joystickNum) {
|
int32_t HAL_GetJoystickGamepadType(int32_t joystickNum) {
|
||||||
HAL_JoystickDescriptor joystickDesc;
|
HAL_JoystickDescriptor joystickDesc;
|
||||||
if (HAL_GetJoystickDescriptor(joystickNum, &joystickDesc) < 0) {
|
if (HAL_GetJoystickDescriptor(joystickNum, &joystickDesc) < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
} else {
|
} else {
|
||||||
return joystickDesc.type;
|
return joystickDesc.gamepadType;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t HAL_GetJoystickSupportedOutputs(int32_t joystickNum) {
|
||||||
|
HAL_JoystickDescriptor joystickDesc;
|
||||||
|
if (HAL_GetJoystickDescriptor(joystickNum, &joystickDesc) < 0) {
|
||||||
|
return -1;
|
||||||
|
} else {
|
||||||
|
return joystickDesc.supportedOutputs;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -539,22 +550,37 @@ void HAL_GetJoystickName(struct WPI_String* name, int32_t joystickNum) {
|
|||||||
std::memcpy(write, cName, len);
|
std::memcpy(write, cName, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t HAL_SetJoystickOutputs(int32_t joystickNum, int64_t outputs,
|
int32_t HAL_SetJoystickRumble(int32_t joystickNum, int32_t leftRumble,
|
||||||
int32_t leftRumble, int32_t rightRumble) {
|
int32_t rightRumble, int32_t leftTriggerRumble,
|
||||||
|
int32_t rightTriggerRumble) {
|
||||||
CHECK_JOYSTICK_NUMBER(joystickNum);
|
CHECK_JOYSTICK_NUMBER(joystickNum);
|
||||||
|
|
||||||
// TODO Update this API
|
std::scoped_lock lock{systemServerDs->joystickOutputMutexes[joystickNum]};
|
||||||
|
systemServerDs->joystickOutputs[joystickNum].LeftRumble =
|
||||||
|
std::clamp(leftRumble, 0, UINT16_MAX);
|
||||||
|
systemServerDs->joystickOutputs[joystickNum].RightRumble =
|
||||||
|
std::clamp(rightRumble, 0, UINT16_MAX);
|
||||||
|
systemServerDs->joystickOutputs[joystickNum].LeftTriggerRumble =
|
||||||
|
std::clamp(leftTriggerRumble, 0, UINT16_MAX);
|
||||||
|
systemServerDs->joystickOutputs[joystickNum].RightTriggerRumble =
|
||||||
|
std::clamp(rightTriggerRumble, 0, UINT16_MAX);
|
||||||
|
|
||||||
// mrc::JoystickOutputData outputData{
|
systemServerDs->joystickOutputTopics[joystickNum].Set(
|
||||||
// .HidOutputs = static_cast<uint32_t>(outputs),
|
systemServerDs->joystickOutputs[joystickNum]);
|
||||||
// .LeftRumble = std::clamp(leftRumble, 0, UINT16_MAX) /
|
|
||||||
// static_cast<float>(UINT16_MAX),
|
|
||||||
// .RightRumble = std::clamp(rightRumble, 0, UINT16_MAX) /
|
|
||||||
// static_cast<float>(UINT16_MAX),
|
|
||||||
// };
|
|
||||||
|
|
||||||
// systemServerDs->joystickRumbleTopics[joystickNum].Set(outputData);
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t HAL_SetJoystickLeds(int32_t joystickNum, int32_t leds) {
|
||||||
|
CHECK_JOYSTICK_NUMBER(joystickNum);
|
||||||
|
|
||||||
|
std::scoped_lock lock{systemServerDs->joystickOutputMutexes[joystickNum]};
|
||||||
|
systemServerDs->joystickOutputs[joystickNum].R = (leds >> 16) & 0xFF;
|
||||||
|
systemServerDs->joystickOutputs[joystickNum].G = (leds >> 8) & 0xFF;
|
||||||
|
systemServerDs->joystickOutputs[joystickNum].B = leds & 0xFF;
|
||||||
|
|
||||||
|
systemServerDs->joystickOutputTopics[joystickNum].Set(
|
||||||
|
systemServerDs->joystickOutputs[joystickNum]);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -43,19 +43,34 @@ DEFINE_CAPI(POVs, povs)
|
|||||||
DEFINE_CAPI(Buttons, buttons)
|
DEFINE_CAPI(Buttons, buttons)
|
||||||
DEFINE_CAPI(Descriptor, descriptor)
|
DEFINE_CAPI(Descriptor, descriptor)
|
||||||
|
|
||||||
int32_t HALSIM_RegisterJoystickOutputsCallback(
|
int32_t HALSIM_RegisterJoystickLedsCallback(int32_t joystickNum,
|
||||||
int32_t joystickNum, HAL_JoystickOutputsCallback callback, void* param,
|
HAL_JoystickLedsCallback callback,
|
||||||
|
void* param,
|
||||||
|
HAL_Bool initialNotify) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void HALSIM_CancelJoystickLedsCallback(int32_t uid) {}
|
||||||
|
|
||||||
|
void HALSIM_GetJoystickLeds(int32_t joystickNum, int32_t* leds) {}
|
||||||
|
|
||||||
|
void HALSIM_SetJoystickLeds(int32_t joystickNum, int32_t leds) {}
|
||||||
|
|
||||||
|
int32_t HALSIM_RegisterJoystickRumblesCallback(
|
||||||
|
int32_t joystickNum, HAL_JoystickRumblesCallback callback, void* param,
|
||||||
HAL_Bool initialNotify) {
|
HAL_Bool initialNotify) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void HALSIM_CancelJoystickOutputsCallback(int32_t uid) {}
|
void HALSIM_CancelJoystickRumblesCallback(int32_t uid) {}
|
||||||
|
|
||||||
void HALSIM_GetJoystickOutputs(int32_t joystickNum, int64_t* outputs,
|
void HALSIM_GetJoystickRumbles(int32_t joystickNum, int32_t* leftRumble,
|
||||||
int32_t* leftRumble, int32_t* rightRumble) {}
|
int32_t* rightRumble, int32_t* leftTriggerRumble,
|
||||||
|
int32_t* rightTriggerRumble) {}
|
||||||
|
|
||||||
void HALSIM_SetJoystickOutputs(int32_t joystickNum, int64_t outputs,
|
void HALSIM_SetJoystickRumbles(int32_t joystickNum, int32_t leftRumble,
|
||||||
int32_t leftRumble, int32_t rightRumble) {}
|
int32_t rightRumble, int32_t leftTriggerRumble,
|
||||||
|
int32_t rightTriggerRumble) {}
|
||||||
|
|
||||||
int32_t HALSIM_RegisterMatchInfoCallback(HAL_MatchInfoCallback callback,
|
int32_t HALSIM_RegisterMatchInfoCallback(HAL_MatchInfoCallback callback,
|
||||||
void* param, HAL_Bool initialNotify) {
|
void* param, HAL_Bool initialNotify) {
|
||||||
@@ -102,10 +117,13 @@ void HALSIM_GetJoystickAvailables(int32_t stick, uint16_t* axesAvailable,
|
|||||||
|
|
||||||
void HALSIM_SetJoystickIsGamepad(int32_t stick, HAL_Bool isGamepad) {}
|
void HALSIM_SetJoystickIsGamepad(int32_t stick, HAL_Bool isGamepad) {}
|
||||||
|
|
||||||
void HALSIM_SetJoystickType(int32_t stick, int32_t type) {}
|
void HALSIM_SetJoystickGamepadType(int32_t stick, int32_t type) {}
|
||||||
|
|
||||||
void HALSIM_SetJoystickName(int32_t stick, const struct WPI_String* name) {}
|
void HALSIM_SetJoystickName(int32_t stick, const struct WPI_String* name) {}
|
||||||
|
|
||||||
|
void HALSIM_SetJoystickSupportedOutputs(int32_t stick,
|
||||||
|
int32_t supportedOutputs) {}
|
||||||
|
|
||||||
void HALSIM_SetGameSpecificMessage(const struct WPI_String* message) {}
|
void HALSIM_SetGameSpecificMessage(const struct WPI_String* message) {}
|
||||||
|
|
||||||
void HALSIM_SetEventName(const struct WPI_String* name) {}
|
void HALSIM_SetEventName(const struct WPI_String* name) {}
|
||||||
|
|||||||
@@ -13,7 +13,8 @@ functions:
|
|||||||
HAL_GetJoystickButtons:
|
HAL_GetJoystickButtons:
|
||||||
HAL_GetAllJoystickData:
|
HAL_GetAllJoystickData:
|
||||||
HAL_GetJoystickDescriptor:
|
HAL_GetJoystickDescriptor:
|
||||||
HAL_GetJoystickType:
|
HAL_GetJoystickGamepadType:
|
||||||
|
HAL_GetJoystickSupportedOutputs:
|
||||||
HAL_GetJoystickName:
|
HAL_GetJoystickName:
|
||||||
param_override:
|
param_override:
|
||||||
name:
|
name:
|
||||||
@@ -26,7 +27,8 @@ functions:
|
|||||||
WPI_FreeString(&name);
|
WPI_FreeString(&name);
|
||||||
return sname;
|
return sname;
|
||||||
}
|
}
|
||||||
HAL_SetJoystickOutputs:
|
HAL_SetJoystickLeds:
|
||||||
|
HAL_SetJoystickRumble:
|
||||||
HAL_GetMatchTime:
|
HAL_GetMatchTime:
|
||||||
HAL_GetOutputsEnabled:
|
HAL_GetOutputsEnabled:
|
||||||
HAL_GetMatchInfo:
|
HAL_GetMatchInfo:
|
||||||
|
|||||||
@@ -37,7 +37,8 @@ classes:
|
|||||||
available:
|
available:
|
||||||
HAL_JoystickDescriptor:
|
HAL_JoystickDescriptor:
|
||||||
attributes:
|
attributes:
|
||||||
type:
|
supportedOutputs:
|
||||||
|
gamepadType:
|
||||||
name:
|
name:
|
||||||
isGamepad:
|
isGamepad:
|
||||||
HAL_MatchInfo:
|
HAL_MatchInfo:
|
||||||
|
|||||||
@@ -63,11 +63,16 @@ functions:
|
|||||||
HALSIM_CancelJoystickDescriptorCallback:
|
HALSIM_CancelJoystickDescriptorCallback:
|
||||||
HALSIM_GetJoystickDescriptor:
|
HALSIM_GetJoystickDescriptor:
|
||||||
HALSIM_SetJoystickDescriptor:
|
HALSIM_SetJoystickDescriptor:
|
||||||
HALSIM_RegisterJoystickOutputsCallback:
|
HALSIM_RegisterJoystickLedsCallback:
|
||||||
ignore: true
|
ignore: true
|
||||||
HALSIM_CancelJoystickOutputsCallback:
|
HALSIM_CancelJoystickLedsCallback:
|
||||||
HALSIM_GetJoystickOutputs:
|
HALSIM_GetJoystickLeds:
|
||||||
HALSIM_SetJoystickOutputs:
|
HALSIM_SetJoystickLeds:
|
||||||
|
HALSIM_RegisterJoystickRumblesCallback:
|
||||||
|
ignore: true
|
||||||
|
HALSIM_CancelJoystickRumblesCallback:
|
||||||
|
HALSIM_GetJoystickRumbles:
|
||||||
|
HALSIM_SetJoystickRumbles:
|
||||||
HALSIM_RegisterMatchInfoCallback:
|
HALSIM_RegisterMatchInfoCallback:
|
||||||
ignore: true
|
ignore: true
|
||||||
HALSIM_CancelMatchInfoCallback:
|
HALSIM_CancelMatchInfoCallback:
|
||||||
@@ -77,7 +82,8 @@ functions:
|
|||||||
HALSIM_SetJoystickAxis:
|
HALSIM_SetJoystickAxis:
|
||||||
HALSIM_SetJoystickPOV:
|
HALSIM_SetJoystickPOV:
|
||||||
HALSIM_SetJoystickButtonsValue:
|
HALSIM_SetJoystickButtonsValue:
|
||||||
HALSIM_SetJoystickType:
|
HALSIM_SetJoystickGamepadType:
|
||||||
|
HALSIM_SetJoystickSupportedOutputs:
|
||||||
HALSIM_SetJoystickName:
|
HALSIM_SetJoystickName:
|
||||||
cpp_code: |
|
cpp_code: |
|
||||||
[](int32_t stick, std::string_view sv) {
|
[](int32_t stick, std::string_view sv) {
|
||||||
|
|||||||
@@ -81,6 +81,30 @@ struct ControlFlags {
|
|||||||
uint32_t WatchdogActive : 1 = 0;
|
uint32_t WatchdogActive : 1 = 0;
|
||||||
uint32_t Alliance : 6 = 0;
|
uint32_t Alliance : 6 = 0;
|
||||||
uint32_t Reserved : 19 = 0;
|
uint32_t Reserved : 19 = 0;
|
||||||
|
|
||||||
|
constexpr bool operator==(const ControlFlags& Other) const {
|
||||||
|
return Enabled == Other.Enabled && Auto == Other.Auto &&
|
||||||
|
Test == Other.Test && EStop == Other.EStop &&
|
||||||
|
FmsConnected == Other.FmsConnected &&
|
||||||
|
DsConnected == Other.DsConnected &&
|
||||||
|
WatchdogActive == Other.WatchdogActive && Alliance == Other.Alliance;
|
||||||
|
}
|
||||||
|
|
||||||
|
constexpr bool operator!=(const ControlFlags& Other) const {
|
||||||
|
return !(*this == Other);
|
||||||
|
}
|
||||||
|
|
||||||
|
constexpr void Reset() {
|
||||||
|
Enabled = 0;
|
||||||
|
Auto = 0;
|
||||||
|
Test = 0;
|
||||||
|
EStop = 0;
|
||||||
|
FmsConnected = 0;
|
||||||
|
DsConnected = 0;
|
||||||
|
WatchdogActive = 0;
|
||||||
|
Alliance = 0;
|
||||||
|
Reserved = 0;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct JoystickAxes {
|
struct JoystickAxes {
|
||||||
@@ -193,25 +217,41 @@ struct ControlData {
|
|||||||
uint8_t JoystickCount{0};
|
uint8_t JoystickCount{0};
|
||||||
};
|
};
|
||||||
|
|
||||||
struct JoystickRumbleData {
|
struct JoystickOutput {
|
||||||
public:
|
public:
|
||||||
std::span<uint16_t> Rumbles() {
|
uint8_t R{0};
|
||||||
return std::span{RumbleStore.data(), GetCount()};
|
uint8_t G{0};
|
||||||
|
uint8_t B{0};
|
||||||
|
uint16_t LeftRumble{0};
|
||||||
|
uint16_t RightRumble{0};
|
||||||
|
uint16_t LeftTriggerRumble{0};
|
||||||
|
uint16_t RightTriggerRumble{0};
|
||||||
|
|
||||||
|
bool IsEmpty() const {
|
||||||
|
return R == 0 && G == 0 && B == 0 && LeftRumble == 0 && RightRumble == 0 &&
|
||||||
|
LeftTriggerRumble == 0 && RightTriggerRumble == 0;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
struct JoystickOutputs {
|
||||||
|
std::span<JoystickOutput> Outputs() {
|
||||||
|
return std::span{OutputsStore.data(), GetOutputCount()};
|
||||||
}
|
}
|
||||||
|
|
||||||
std::span<const uint16_t> Rumbles() const {
|
std::span<const JoystickOutput> Outputs() const {
|
||||||
return std::span{RumbleStore.data(), GetCount()};
|
return std::span{OutputsStore.data(), GetOutputCount()};
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetCount(uint8_t NewCount) {
|
size_t GetOutputCount() const { return OutputCount; }
|
||||||
Count = (std::min)(NewCount, static_cast<uint8_t>(MRC_MAX_NUM_RUMBLE));
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t GetCount() const { return Count; }
|
void SetOutputCount(uint8_t NewCount) {
|
||||||
|
OutputCount =
|
||||||
|
(std::min)(NewCount, static_cast<uint8_t>(MRC_MAX_NUM_JOYSTICKS));
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::array<uint16_t, MRC_MAX_NUM_RUMBLE> RumbleStore;
|
std::array<JoystickOutput, MRC_MAX_NUM_JOYSTICKS> OutputsStore;
|
||||||
uint8_t Count{0};
|
uint8_t OutputCount{0};
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class MatchType : uint8_t {
|
enum class MatchType : uint8_t {
|
||||||
@@ -264,36 +304,9 @@ struct MatchInfo {
|
|||||||
|
|
||||||
struct JoystickDescriptor {
|
struct JoystickDescriptor {
|
||||||
public:
|
public:
|
||||||
bool IsGamepad{0};
|
bool IsGamepad{false};
|
||||||
uint8_t Type{0};
|
uint8_t GamepadType{0};
|
||||||
uint8_t RumbleCount{0};
|
uint8_t SupportedOutputs{0};
|
||||||
|
|
||||||
std::span<uint8_t> AxesTypes() {
|
|
||||||
return std::span{AxesTypesStore.data(), GetAxesCount()};
|
|
||||||
}
|
|
||||||
|
|
||||||
std::span<const uint8_t> AxesTypes() const {
|
|
||||||
return std::span{AxesTypesStore.data(), GetAxesCount()};
|
|
||||||
}
|
|
||||||
|
|
||||||
void SetAxesCount(uint8_t NewCount) {
|
|
||||||
AxesCount = (std::min)(NewCount, static_cast<uint8_t>(MRC_MAX_NUM_AXES));
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t GetAxesCount() const { return AxesCount; }
|
|
||||||
|
|
||||||
void SetPovsCount(uint8_t NewCount) {
|
|
||||||
PovCount = (std::min)(NewCount, static_cast<uint8_t>(MRC_MAX_NUM_POVS));
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t GetPovsCount() const { return PovCount; }
|
|
||||||
|
|
||||||
void SetButtonsCount(uint8_t NewCount) {
|
|
||||||
ButtonCount =
|
|
||||||
(std::min)(NewCount, static_cast<uint8_t>(MRC_MAX_NUM_BUTTONS));
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t GetButtonsCount() const { return ButtonCount; }
|
|
||||||
|
|
||||||
void SetName(std::string_view Name) {
|
void SetName(std::string_view Name) {
|
||||||
if (Name.size() > MRC_MAX_JOYSTICK_NAME_LEN) {
|
if (Name.size() > MRC_MAX_JOYSTICK_NAME_LEN) {
|
||||||
@@ -322,10 +335,27 @@ struct JoystickDescriptor {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
std::string JoystickName;
|
std::string JoystickName;
|
||||||
std::array<uint8_t, MRC_MAX_NUM_AXES> AxesTypesStore;
|
};
|
||||||
uint8_t AxesCount{0};
|
|
||||||
uint8_t ButtonCount{0};
|
struct JoystickDescriptors {
|
||||||
uint8_t PovCount{0};
|
std::span<JoystickDescriptor> Descriptors() {
|
||||||
|
return std::span{DescriptorsStore.data(), GetDescriptorCount()};
|
||||||
|
}
|
||||||
|
|
||||||
|
std::span<const JoystickDescriptor> Descriptors() const {
|
||||||
|
return std::span{DescriptorsStore.data(), GetDescriptorCount()};
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t GetDescriptorCount() const { return DescriptorCount; }
|
||||||
|
|
||||||
|
void SetDescriptorCount(uint8_t NewCount) {
|
||||||
|
DescriptorCount =
|
||||||
|
(std::min)(NewCount, static_cast<uint8_t>(MRC_MAX_NUM_JOYSTICKS));
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::array<JoystickDescriptor, MRC_MAX_NUM_JOYSTICKS> DescriptorsStore;
|
||||||
|
uint8_t DescriptorCount{0};
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ErrorInfo {
|
struct ErrorInfo {
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
(ROBOT_CONTROL_DATA_PREFIX "GameSpecificMessage")
|
(ROBOT_CONTROL_DATA_PREFIX "GameSpecificMessage")
|
||||||
#define ROBOT_MATCH_INFO_PATH (ROBOT_CONTROL_DATA_PREFIX "MatchInfo")
|
#define ROBOT_MATCH_INFO_PATH (ROBOT_CONTROL_DATA_PREFIX "MatchInfo")
|
||||||
#define ROBOT_JOYSTICK_DESCRIPTORS_PATH \
|
#define ROBOT_JOYSTICK_DESCRIPTORS_PATH \
|
||||||
(ROBOT_CONTROL_DATA_PREFIX "JoystickDescriptors/")
|
(ROBOT_CONTROL_DATA_PREFIX "JoystickDescriptors")
|
||||||
#define ROBOT_HAS_SET_WALL_CLOCK_PATH \
|
#define ROBOT_HAS_SET_WALL_CLOCK_PATH \
|
||||||
(ROBOT_CONTROL_DATA_PREFIX "HasSetWallClock")
|
(ROBOT_CONTROL_DATA_PREFIX "HasSetWallClock")
|
||||||
|
|
||||||
@@ -26,7 +26,8 @@
|
|||||||
(ROBOT_STATUS_DATA_PREFIX "CurrentOpModeTrace")
|
(ROBOT_STATUS_DATA_PREFIX "CurrentOpModeTrace")
|
||||||
|
|
||||||
#define ROBOT_OUTPUTS_DATA_PREFIX "/Netcomm/Outputs/"
|
#define ROBOT_OUTPUTS_DATA_PREFIX "/Netcomm/Outputs/"
|
||||||
#define ROBOT_JOYSTICK_RUMBLE_PATH (ROBOT_OUTPUTS_DATA_PREFIX "Rumble/")
|
#define ROBOT_JOYSTICK_OUTPUTS_PATH \
|
||||||
|
(ROBOT_OUTPUTS_DATA_PREFIX "JoystickOutput/")
|
||||||
|
|
||||||
#define ROBOT_CONSOLE_DATA_PREFIX "/Netcomm/Console/"
|
#define ROBOT_CONSOLE_DATA_PREFIX "/Netcomm/Console/"
|
||||||
#define ROBOT_CONSOLE_LINE_PATH (ROBOT_CONSOLE_DATA_PREFIX "ConsoleLine")
|
#define ROBOT_CONSOLE_LINE_PATH (ROBOT_CONSOLE_DATA_PREFIX "ConsoleLine")
|
||||||
@@ -59,7 +60,6 @@
|
|||||||
#define MRC_MAX_NUM_AXES 12
|
#define MRC_MAX_NUM_AXES 12
|
||||||
#define MRC_MAX_NUM_POVS 8
|
#define MRC_MAX_NUM_POVS 8
|
||||||
#define MRC_MAX_NUM_BUTTONS 64
|
#define MRC_MAX_NUM_BUTTONS 64
|
||||||
#define MRC_MAX_NUM_RUMBLE 8
|
|
||||||
#define MRC_MAX_OPMODE_LEN 128
|
#define MRC_MAX_OPMODE_LEN 128
|
||||||
#define MRC_MAX_GAME_SPECIFIC_MESSAGE_LEN 128
|
#define MRC_MAX_GAME_SPECIFIC_MESSAGE_LEN 128
|
||||||
#define MRC_MAX_EVENT_NAME_LEN 64
|
#define MRC_MAX_EVENT_NAME_LEN 64
|
||||||
|
|||||||
@@ -24,16 +24,23 @@ message ProtobufControlData {
|
|||||||
|
|
||||||
message ProtobufJoystickDescriptor {
|
message ProtobufJoystickDescriptor {
|
||||||
string JoystickName = 1;
|
string JoystickName = 1;
|
||||||
repeated int32 AxisTypes = 2;
|
bool IsGamepad = 2;
|
||||||
bool IsGamepad = 3;
|
uint32 GamepadType = 3;
|
||||||
int32 JoystickType = 4;
|
uint32 SupportedOutputs = 4;
|
||||||
int32 ButtonCount = 5;
|
|
||||||
int32 PovCount = 6;
|
|
||||||
int32 RumbleCount = 7;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
message ProtobufJoystickRumbleData {
|
message ProtobufJoystickDescriptors {
|
||||||
repeated uint32 Value = 3;
|
repeated ProtobufJoystickDescriptor Descriptors = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message ProtobufJoystickOutput {
|
||||||
|
uint32 LEDs = 1;
|
||||||
|
uint32 Rumble = 2; // 16 bits, left msb, right lsb
|
||||||
|
uint32 TriggerRumble = 3; // 16 bits, left msb, right lsb
|
||||||
|
}
|
||||||
|
|
||||||
|
message ProtobufJoystickOutputs {
|
||||||
|
repeated ProtobufJoystickOutput Outputs = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
message ProtobufMatchInfo {
|
message ProtobufMatchInfo {
|
||||||
@@ -59,3 +66,16 @@ message ProtobufOpMode {
|
|||||||
message ProtobufAvailableOpModes {
|
message ProtobufAvailableOpModes {
|
||||||
repeated ProtobufOpMode Modes = 1;
|
repeated ProtobufOpMode Modes = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
message ProtobufErrorInfoTimestamp {
|
||||||
|
ProtobufErrorInfo ErrorInfo = 1;
|
||||||
|
uint64 Timestamp = 2;
|
||||||
|
int32 SequenceNumber = 3;
|
||||||
|
int32 NumOccurances = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
message ProtobufConsoleLineTimestamp {
|
||||||
|
string ConsoleLine = 1;
|
||||||
|
uint64 Timestamp = 2;
|
||||||
|
int32 SequenceNumber = 3;
|
||||||
|
}
|
||||||
|
|||||||
@@ -261,7 +261,7 @@ void DSCommPacket::ReadJoystickDescriptionTag(std::span<const uint8_t> data) {
|
|||||||
DSCommJoystickPacket& packet = m_joystick_packets[joystickNum];
|
DSCommJoystickPacket& packet = m_joystick_packets[joystickNum];
|
||||||
packet.ResetTcp();
|
packet.ResetTcp();
|
||||||
packet.descriptor.isGamepad = data[1] != 0 ? 1 : 0;
|
packet.descriptor.isGamepad = data[1] != 0 ? 1 : 0;
|
||||||
packet.descriptor.type = data[2];
|
packet.descriptor.gamepadType = data[2];
|
||||||
int nameLength =
|
int nameLength =
|
||||||
std::min<size_t>(data[3], (sizeof(packet.descriptor.name) - 1));
|
std::min<size_t>(data[3], (sizeof(packet.descriptor.name) - 1));
|
||||||
for (int i = 0; i < nameLength; i++) {
|
for (int i = 0; i < nameLength; i++) {
|
||||||
@@ -283,7 +283,6 @@ void DSCommPacket::SendJoysticks(void) {
|
|||||||
|
|
||||||
void DSCommPacket::SetupSendBuffer(wpi::net::raw_uv_ostream& buf) {
|
void DSCommPacket::SetupSendBuffer(wpi::net::raw_uv_ostream& buf) {
|
||||||
SetupSendHeader(buf);
|
SetupSendHeader(buf);
|
||||||
SetupJoystickTag(buf);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DSCommPacket::SetupSendHeader(wpi::net::raw_uv_ostream& buf) {
|
void DSCommPacket::SetupSendHeader(wpi::net::raw_uv_ostream& buf) {
|
||||||
@@ -303,31 +302,6 @@ void DSCommPacket::SetupSendHeader(wpi::net::raw_uv_ostream& buf) {
|
|||||||
buf << static_cast<uint8_t>(0);
|
buf << static_cast<uint8_t>(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DSCommPacket::SetupJoystickTag(wpi::net::raw_uv_ostream& buf) {
|
|
||||||
static constexpr uint8_t kHIDTag = 0x01;
|
|
||||||
|
|
||||||
// HID tags are sent 1 per device
|
|
||||||
int64_t outputs;
|
|
||||||
int32_t rightRumble;
|
|
||||||
int32_t leftRumble;
|
|
||||||
for (size_t i = 0; i < m_joystick_packets.size(); i++) {
|
|
||||||
// Length is 9, 1 tag and 8 data.
|
|
||||||
buf << static_cast<uint8_t>(9) << kHIDTag;
|
|
||||||
HALSIM_GetJoystickOutputs(i, &outputs, &leftRumble, &rightRumble);
|
|
||||||
auto op = static_cast<uint32_t>(outputs);
|
|
||||||
auto rr = static_cast<uint16_t>(rightRumble);
|
|
||||||
auto lr = static_cast<uint16_t>(leftRumble);
|
|
||||||
buf.write((op >> 24 & 0xFF));
|
|
||||||
buf.write((op >> 16 & 0xFF));
|
|
||||||
buf.write((op >> 8 & 0xFF));
|
|
||||||
buf.write((op & 0xFF));
|
|
||||||
buf.write((rr >> 8 & 0xFF));
|
|
||||||
buf.write((rr & 0xFF));
|
|
||||||
buf.write((lr >> 8 & 0xFF));
|
|
||||||
buf.write((lr & 0xFF));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void DSCommPacket::SendUDPToHALSim(void) {
|
void DSCommPacket::SendUDPToHALSim(void) {
|
||||||
SendJoysticks();
|
SendJoysticks();
|
||||||
|
|
||||||
|
|||||||
@@ -52,7 +52,6 @@ class DSCommPacket {
|
|||||||
void SetControl(uint8_t control, uint8_t request);
|
void SetControl(uint8_t control, uint8_t request);
|
||||||
void SetAlliance(uint8_t station_code);
|
void SetAlliance(uint8_t station_code);
|
||||||
void SetupSendHeader(wpi::net::raw_uv_ostream& buf);
|
void SetupSendHeader(wpi::net::raw_uv_ostream& buf);
|
||||||
void SetupJoystickTag(wpi::net::raw_uv_ostream& buf);
|
|
||||||
void ReadMatchtimeTag(std::span<const uint8_t> tagData);
|
void ReadMatchtimeTag(std::span<const uint8_t> tagData);
|
||||||
void ReadJoystickTag(std::span<const uint8_t> data, int index);
|
void ReadJoystickTag(std::span<const uint8_t> data, int index);
|
||||||
void ReadNewMatchInfoTag(std::span<const uint8_t> data);
|
void ReadNewMatchInfoTag(std::span<const uint8_t> data);
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ TEST_F(DSCommPacketTest, DescriptorTag) {
|
|||||||
arr[1] = sizeof(arr) - 2;
|
arr[1] = sizeof(arr) - 2;
|
||||||
auto& data = ReadDescriptorTag(arr);
|
auto& data = ReadDescriptorTag(arr);
|
||||||
ASSERT_EQ(data.descriptor.isGamepad, 1);
|
ASSERT_EQ(data.descriptor.isGamepad, 1);
|
||||||
ASSERT_EQ(data.descriptor.type, 0);
|
ASSERT_EQ(data.descriptor.gamepadType, 0);
|
||||||
ASSERT_STREQ(data.descriptor.name, "Hello World");
|
ASSERT_STREQ(data.descriptor.name, "Hello World");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ namespace {
|
|||||||
struct HALJoystickData {
|
struct HALJoystickData {
|
||||||
HALJoystickData() {
|
HALJoystickData() {
|
||||||
std::memset(&desc, 0, sizeof(desc));
|
std::memset(&desc, 0, sizeof(desc));
|
||||||
desc.type = -1;
|
desc.gamepadType = 0;
|
||||||
std::memset(&axes, 0, sizeof(axes));
|
std::memset(&axes, 0, sizeof(axes));
|
||||||
std::memset(&buttons, 0, sizeof(buttons));
|
std::memset(&buttons, 0, sizeof(buttons));
|
||||||
std::memset(&povs, 0, sizeof(povs));
|
std::memset(&povs, 0, sizeof(povs));
|
||||||
@@ -426,7 +426,7 @@ void GlfwSystemJoystick::GetData(HALJoystickData* data, bool mapGamepad) const {
|
|||||||
|
|
||||||
// copy into HAL structures
|
// copy into HAL structures
|
||||||
data->desc.isGamepad = m_isGamepad ? 1 : 0;
|
data->desc.isGamepad = m_isGamepad ? 1 : 0;
|
||||||
data->desc.type = m_isGamepad ? 21 : 20;
|
data->desc.gamepadType = m_isGamepad ? 21 : 20;
|
||||||
std::strncpy(data->desc.name, m_name, sizeof(data->desc.name) - 1);
|
std::strncpy(data->desc.name, m_name, sizeof(data->desc.name) - 1);
|
||||||
data->desc.name[sizeof(data->desc.name) - 1] = '\0';
|
data->desc.name[sizeof(data->desc.name) - 1] = '\0';
|
||||||
int axesCount = (std::min)(m_axisCount, HAL_kMaxJoystickAxes);
|
int axesCount = (std::min)(m_axisCount, HAL_kMaxJoystickAxes);
|
||||||
@@ -555,7 +555,7 @@ KeyboardJoystick::KeyboardJoystick(wpi::glass::Storage& storage, int index)
|
|||||||
|
|
||||||
// init desc structure
|
// init desc structure
|
||||||
m_data.desc.isGamepad = 0;
|
m_data.desc.isGamepad = 0;
|
||||||
m_data.desc.type = 20;
|
m_data.desc.gamepadType = 20;
|
||||||
std::strncpy(m_data.desc.name, m_name, 256);
|
std::strncpy(m_data.desc.name, m_name, 256);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1328,7 +1328,7 @@ static void DisplayJoysticks() {
|
|||||||
joy.GetHAL(i);
|
joy.GetHAL(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((disableDS && joy.data.desc.type != 0) ||
|
if ((disableDS && joy.data.desc.gamepadType > 0) ||
|
||||||
(joy.sys && joy.sys->IsPresent())) {
|
(joy.sys && joy.sys->IsPresent())) {
|
||||||
// update GUI display
|
// update GUI display
|
||||||
ImGui::PushID(i);
|
ImGui::PushID(i);
|
||||||
|
|||||||
@@ -238,7 +238,7 @@ Joystick data is an input to the robot program and should be updated for each in
|
|||||||
| ``">axes"`` | Array of float | One array element per axis; value is -1 to 1 range |
|
| ``">axes"`` | Array of float | One array element per axis; value is -1 to 1 range |
|
||||||
| ``">povs"`` | Array of integer | One array element per POV; value is angle in degrees of the POV (e.g. 0, 90, 315) if pressed, or -1 if the POV is not pressed |
|
| ``">povs"`` | Array of integer | One array element per POV; value is angle in degrees of the POV (e.g. 0, 90, 315) if pressed, or -1 if the POV is not pressed |
|
||||||
| ``">buttons"`` | Array of boolean | One array element per button; true if button is pressed, false if button is released |
|
| ``">buttons"`` | Array of boolean | One array element per button; true if button is pressed, false if button is released |
|
||||||
| ``"<outputs"`` | Integer | Bitmask of joystick HID outputs |
|
| ``"<leds"`` | Integer | LED Output Color (0xRRGGBB) |
|
||||||
| ``"<rumble_left"`` | Float | Left rumble, value is 0-1 range |
|
| ``"<rumble_left"`` | Float | Left rumble, value is 0-1 range |
|
||||||
| ``"<rumble_right"`` | Float | Right rumble, value is 0-1 range |
|
| ``"<rumble_right"`` | Float | Right rumble, value is 0-1 range |
|
||||||
|
|
||||||
|
|||||||
@@ -450,7 +450,7 @@ components:
|
|||||||
maximum: 1.0
|
maximum: 1.0
|
||||||
<outputs:
|
<outputs:
|
||||||
type: integer
|
type: integer
|
||||||
description: "Bitmask of joystick HID outputs"
|
description: "LED Output Color (0xRRGGBB)"
|
||||||
|
|
||||||
pcmData:
|
pcmData:
|
||||||
type: object
|
type: object
|
||||||
|
|||||||
@@ -65,16 +65,20 @@ void HALSimWSProviderJoystick::RegisterCallbacks() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Rumble data
|
// Rumble data
|
||||||
int64_t outputs = 0;
|
int32_t leds = 0;
|
||||||
int32_t leftRumble = 0;
|
int32_t leftRumble = 0;
|
||||||
int32_t rightRumble = 0;
|
int32_t rightRumble = 0;
|
||||||
HALSIM_GetJoystickOutputs(provider->GetChannel(), &outputs, &leftRumble,
|
int32_t leftTriggerRumble = 0;
|
||||||
&rightRumble);
|
int32_t rightTriggerRumble = 0;
|
||||||
|
HALSIM_GetJoystickRumbles(provider->GetChannel(), &leftRumble,
|
||||||
|
&rightRumble, &leftTriggerRumble,
|
||||||
|
&rightTriggerRumble);
|
||||||
|
HALSIM_GetJoystickLeds(provider->GetChannel(), &leds);
|
||||||
|
|
||||||
payload[">axes"] = axesValues;
|
payload[">axes"] = axesValues;
|
||||||
payload[">povs"] = povsValues;
|
payload[">povs"] = povsValues;
|
||||||
payload[">buttons"] = buttonsValues;
|
payload[">buttons"] = buttonsValues;
|
||||||
payload["<outputs"] = outputs;
|
payload["<leds"] = leds;
|
||||||
payload["<rumble_left"] = leftRumble;
|
payload["<rumble_left"] = leftRumble;
|
||||||
payload["<rumble_right"] = rightRumble;
|
payload["<rumble_right"] = rightRumble;
|
||||||
|
|
||||||
|
|||||||
@@ -471,7 +471,7 @@ bool DriverStation::GetJoystickIsGamepad(int stick) {
|
|||||||
return static_cast<bool>(descriptor.isGamepad);
|
return static_cast<bool>(descriptor.isGamepad);
|
||||||
}
|
}
|
||||||
|
|
||||||
int DriverStation::GetJoystickType(int stick) {
|
int DriverStation::GetJoystickGamepadType(int stick) {
|
||||||
if (stick < 0 || stick >= kJoystickPorts) {
|
if (stick < 0 || stick >= kJoystickPorts) {
|
||||||
WPILIB_ReportError(warn::BadJoystickIndex, "stick {} out of range", stick);
|
WPILIB_ReportError(warn::BadJoystickIndex, "stick {} out of range", stick);
|
||||||
return -1;
|
return -1;
|
||||||
@@ -480,7 +480,19 @@ int DriverStation::GetJoystickType(int stick) {
|
|||||||
HAL_JoystickDescriptor descriptor;
|
HAL_JoystickDescriptor descriptor;
|
||||||
HAL_GetJoystickDescriptor(stick, &descriptor);
|
HAL_GetJoystickDescriptor(stick, &descriptor);
|
||||||
|
|
||||||
return static_cast<int>(descriptor.type);
|
return static_cast<int>(descriptor.gamepadType);
|
||||||
|
}
|
||||||
|
|
||||||
|
int DriverStation::GetJoystickSupportedOutputs(int stick) {
|
||||||
|
if (stick < 0 || stick >= kJoystickPorts) {
|
||||||
|
WPILIB_ReportError(warn::BadJoystickIndex, "stick {} out of range", stick);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
HAL_JoystickDescriptor descriptor;
|
||||||
|
HAL_GetJoystickDescriptor(stick, &descriptor);
|
||||||
|
|
||||||
|
return static_cast<int>(descriptor.supportedOutputs);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string DriverStation::GetJoystickName(int stick) {
|
std::string DriverStation::GetJoystickName(int stick) {
|
||||||
|
|||||||
@@ -135,8 +135,13 @@ bool GenericHID::IsConnected() const {
|
|||||||
return DriverStation::IsJoystickConnected(m_port);
|
return DriverStation::IsJoystickConnected(m_port);
|
||||||
}
|
}
|
||||||
|
|
||||||
GenericHID::HIDType GenericHID::GetType() const {
|
GenericHID::HIDType GenericHID::GetGamepadType() const {
|
||||||
return static_cast<HIDType>(DriverStation::GetJoystickType(m_port));
|
return static_cast<HIDType>(DriverStation::GetJoystickGamepadType(m_port));
|
||||||
|
}
|
||||||
|
|
||||||
|
GenericHID::SupportedOutputs GenericHID::GetSupportedOutputs() const {
|
||||||
|
return static_cast<SupportedOutputs>(
|
||||||
|
DriverStation::GetJoystickSupportedOutputs(m_port));
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string GenericHID::GetName() const {
|
std::string GenericHID::GetName() const {
|
||||||
@@ -147,16 +152,11 @@ int GenericHID::GetPort() const {
|
|||||||
return m_port;
|
return m_port;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GenericHID::SetOutput(int outputNumber, bool value) {
|
void GenericHID::SetLeds(int r, int g, int b) {
|
||||||
m_outputs =
|
uint32_t value = (static_cast<uint32_t>(r & 0xFF) << 16) |
|
||||||
(m_outputs & ~(1 << (outputNumber - 1))) | (value << (outputNumber - 1));
|
(static_cast<uint32_t>(g & 0xFF) << 8) |
|
||||||
|
static_cast<uint32_t>(b & 0xFF);
|
||||||
HAL_SetJoystickOutputs(m_port, m_outputs, m_leftRumble, m_rightRumble);
|
HAL_SetJoystickLeds(m_port, value);
|
||||||
}
|
|
||||||
|
|
||||||
void GenericHID::SetOutputs(int value) {
|
|
||||||
m_outputs = value;
|
|
||||||
HAL_SetJoystickOutputs(m_port, m_outputs, m_leftRumble, m_rightRumble);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GenericHID::SetRumble(RumbleType type, double value) {
|
void GenericHID::SetRumble(RumbleType type, double value) {
|
||||||
@@ -167,10 +167,12 @@ void GenericHID::SetRumble(RumbleType type, double value) {
|
|||||||
m_leftRumble = rumbleValue;
|
m_leftRumble = rumbleValue;
|
||||||
} else if (type == kRightRumble) {
|
} else if (type == kRightRumble) {
|
||||||
m_rightRumble = rumbleValue;
|
m_rightRumble = rumbleValue;
|
||||||
} else {
|
} else if (type == kLeftTriggerRumble) {
|
||||||
m_leftRumble = rumbleValue;
|
m_leftTriggerRumble = rumbleValue;
|
||||||
m_rightRumble = rumbleValue;
|
} else if (type == kRightTriggerRumble) {
|
||||||
|
m_rightTriggerRumble = rumbleValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
HAL_SetJoystickOutputs(m_port, m_outputs, m_leftRumble, m_rightRumble);
|
HAL_SetJoystickRumble(m_port, m_leftRumble, m_rightRumble,
|
||||||
|
m_leftTriggerRumble, m_rightTriggerRumble);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -180,20 +180,31 @@ void DriverStationSim::SetSendConsoleLine(bool shouldSend) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t DriverStationSim::GetJoystickOutputs(int stick) {
|
int32_t DriverStationSim::GetJoystickLeds(int stick) {
|
||||||
int64_t outputs = 0;
|
int32_t leds = 0;
|
||||||
int32_t leftRumble;
|
HALSIM_GetJoystickLeds(stick, &leds);
|
||||||
int32_t rightRumble;
|
return leds;
|
||||||
HALSIM_GetJoystickOutputs(stick, &outputs, &leftRumble, &rightRumble);
|
|
||||||
return outputs;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int DriverStationSim::GetJoystickRumble(int stick, int rumbleNum) {
|
int DriverStationSim::GetJoystickRumble(int stick, int rumbleNum) {
|
||||||
int64_t outputs;
|
|
||||||
int32_t leftRumble = 0;
|
int32_t leftRumble = 0;
|
||||||
int32_t rightRumble = 0;
|
int32_t rightRumble = 0;
|
||||||
HALSIM_GetJoystickOutputs(stick, &outputs, &leftRumble, &rightRumble);
|
int32_t leftTriggerRumble = 0;
|
||||||
return rumbleNum == 0 ? leftRumble : rightRumble;
|
int32_t rightTriggerRumble = 0;
|
||||||
|
HALSIM_GetJoystickRumbles(stick, &leftRumble, &rightRumble,
|
||||||
|
&leftTriggerRumble, &rightTriggerRumble);
|
||||||
|
switch (rumbleNum) {
|
||||||
|
case 0:
|
||||||
|
return leftRumble;
|
||||||
|
case 1:
|
||||||
|
return rightRumble;
|
||||||
|
case 2:
|
||||||
|
return leftTriggerRumble;
|
||||||
|
case 3:
|
||||||
|
return rightTriggerRumble;
|
||||||
|
default:
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DriverStationSim::SetJoystickButton(int stick, int button, bool state) {
|
void DriverStationSim::SetJoystickButton(int stick, int button, bool state) {
|
||||||
@@ -261,8 +272,13 @@ void DriverStationSim::SetJoystickIsGamepad(int stick, bool isGamepad) {
|
|||||||
HALSIM_SetJoystickIsGamepad(stick, isGamepad);
|
HALSIM_SetJoystickIsGamepad(stick, isGamepad);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DriverStationSim::SetJoystickType(int stick, int type) {
|
void DriverStationSim::SetJoystickGamepadType(int stick, int type) {
|
||||||
HALSIM_SetJoystickType(stick, type);
|
HALSIM_SetJoystickGamepadType(stick, type);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DriverStationSim::SetJoystickSupportedOutputs(int stick,
|
||||||
|
int supportedOutputs) {
|
||||||
|
HALSIM_SetJoystickSupportedOutputs(stick, supportedOutputs);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DriverStationSim::SetJoystickName(int stick, std::string_view name) {
|
void DriverStationSim::SetJoystickName(int stick, std::string_view name) {
|
||||||
|
|||||||
@@ -60,25 +60,41 @@ void GenericHIDSim::SetButtonsAvailable(uint64_t count) {
|
|||||||
DriverStationSim::SetJoystickButtonsAvailable(m_port, count);
|
DriverStationSim::SetJoystickButtonsAvailable(m_port, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GenericHIDSim::SetType(GenericHID::HIDType type) {
|
void GenericHIDSim::SetGamepadType(GenericHID::HIDType type) {
|
||||||
DriverStationSim::SetJoystickType(m_port, type);
|
DriverStationSim::SetJoystickGamepadType(m_port, type);
|
||||||
|
}
|
||||||
|
|
||||||
|
void GenericHIDSim::SetSupportedOutputs(
|
||||||
|
GenericHID::SupportedOutputs supportedOutputs) {
|
||||||
|
DriverStationSim::SetJoystickSupportedOutputs(m_port, supportedOutputs);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GenericHIDSim::SetName(const char* name) {
|
void GenericHIDSim::SetName(const char* name) {
|
||||||
DriverStationSim::SetJoystickName(m_port, name);
|
DriverStationSim::SetJoystickName(m_port, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GenericHIDSim::GetOutput(int outputNumber) {
|
int32_t GenericHIDSim::GetLeds() {
|
||||||
int64_t outputs = GetOutputs();
|
return DriverStationSim::GetJoystickLeds(m_port);
|
||||||
return (outputs & (static_cast<int64_t>(1) << (outputNumber - 1))) != 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int64_t GenericHIDSim::GetOutputs() {
|
|
||||||
return DriverStationSim::GetJoystickOutputs(m_port);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
double GenericHIDSim::GetRumble(GenericHID::RumbleType type) {
|
double GenericHIDSim::GetRumble(GenericHID::RumbleType type) {
|
||||||
int value = DriverStationSim::GetJoystickRumble(
|
int intType = 0;
|
||||||
m_port, type == GenericHID::kLeftRumble ? 0 : 1);
|
switch (type) {
|
||||||
|
case GenericHID::kLeftRumble:
|
||||||
|
intType = 0;
|
||||||
|
break;
|
||||||
|
case GenericHID::kRightRumble:
|
||||||
|
intType = 1;
|
||||||
|
break;
|
||||||
|
case GenericHID::kLeftTriggerRumble:
|
||||||
|
intType = 2;
|
||||||
|
break;
|
||||||
|
case GenericHID::kRightTriggerRumble:
|
||||||
|
intType = 3;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return 0.0;
|
||||||
|
}
|
||||||
|
int value = DriverStationSim::GetJoystickRumble(m_port, intType);
|
||||||
return value / 65535.0;
|
return value / 65535.0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -245,10 +245,21 @@ class DriverStation final {
|
|||||||
/**
|
/**
|
||||||
* Returns the type of joystick at a given port.
|
* Returns the type of joystick at a given port.
|
||||||
*
|
*
|
||||||
|
* This maps to SDL_GamepadType
|
||||||
|
*
|
||||||
* @param stick The joystick port number
|
* @param stick The joystick port number
|
||||||
* @return The HID type of joystick at the given port
|
* @return The HID type of joystick at the given port
|
||||||
*/
|
*/
|
||||||
static int GetJoystickType(int stick);
|
static int GetJoystickGamepadType(int stick);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the number of outputs supported by the joystick at the given
|
||||||
|
* port.
|
||||||
|
*
|
||||||
|
* @param stick The joystick port number
|
||||||
|
* @return The number of outputs supported by the joystick at the given port
|
||||||
|
*/
|
||||||
|
static int GetJoystickSupportedOutputs(int stick);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the name of the joystick at the given port.
|
* Returns the name of the joystick at the given port.
|
||||||
|
|||||||
@@ -33,8 +33,28 @@ class GenericHID {
|
|||||||
kLeftRumble,
|
kLeftRumble,
|
||||||
/// Right rumble motor.
|
/// Right rumble motor.
|
||||||
kRightRumble,
|
kRightRumble,
|
||||||
/// Both left and right rumble motors.
|
/// Left trigger rumble motor.
|
||||||
kBothRumble
|
kLeftTriggerRumble,
|
||||||
|
/// Right trigger rumble motor.
|
||||||
|
kRightTriggerRumble,
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents the various outputs that a HID may support.
|
||||||
|
*/
|
||||||
|
enum SupportedOutputs {
|
||||||
|
/// No outputs supported.
|
||||||
|
kNone = 0x0,
|
||||||
|
/// Mono LED support.
|
||||||
|
kMonoLed = 0x1,
|
||||||
|
/// RGB LED support.
|
||||||
|
kRgbLed = 0x2,
|
||||||
|
/// Player LED support.
|
||||||
|
kPlayerLed = 0x4,
|
||||||
|
/// Rumble support.
|
||||||
|
kRumble = 0x8,
|
||||||
|
/// Trigger rumble support.
|
||||||
|
kTriggerRumble = 0x10,
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -42,39 +62,27 @@ class GenericHID {
|
|||||||
*/
|
*/
|
||||||
enum HIDType {
|
enum HIDType {
|
||||||
/// Unknown.
|
/// Unknown.
|
||||||
kUnknown = -1,
|
kUnknown = 0,
|
||||||
/// XInputUnknown.
|
/// Standard HID device.
|
||||||
kXInputUnknown = 0,
|
kStandard,
|
||||||
/// XInputGamepad.
|
/// Xbox 360 controller.
|
||||||
kXInputGamepad = 1,
|
kXbox360,
|
||||||
/// XInputWheel.
|
/// Xbox One controller.
|
||||||
kXInputWheel = 2,
|
kXboxOne,
|
||||||
/// XInputArcadeStick.
|
/// PS3 controller.
|
||||||
kXInputArcadeStick = 3,
|
kPS3,
|
||||||
/// XInputFlightStick.
|
/// PS4 controller.
|
||||||
kXInputFlightStick = 4,
|
kPS4,
|
||||||
/// XInputDancePad.
|
/// PS5 controller.
|
||||||
kXInputDancePad = 5,
|
kPS5,
|
||||||
/// XInputGuitar.
|
/// Nintendo Switch Pro controller.
|
||||||
kXInputGuitar = 6,
|
kSwitchPro,
|
||||||
/// XInputGuitar2.
|
/// Nintendo Switch Joycon Left controller.
|
||||||
kXInputGuitar2 = 7,
|
kSwitchJoyconLeft,
|
||||||
/// XInputDrumKit.
|
/// Nintendo Switch Joycon Right controller.
|
||||||
kXInputDrumKit = 8,
|
kSwitchJoyconRight,
|
||||||
/// XInputGuitar3.
|
/// Nintendo Switch Joycon controller pair.
|
||||||
kXInputGuitar3 = 11,
|
kSwitchJoyconPair
|
||||||
/// XInputArcadePad.
|
|
||||||
kXInputArcadePad = 19,
|
|
||||||
/// HIDJoystick.
|
|
||||||
kHIDJoystick = 20,
|
|
||||||
/// HIDGamepad.
|
|
||||||
kHIDGamepad = 21,
|
|
||||||
/// HIDDriving.
|
|
||||||
kHIDDriving = 22,
|
|
||||||
/// HIDFlight.
|
|
||||||
kHIDFlight = 23,
|
|
||||||
/// HID1stPerson.
|
|
||||||
kHID1stPerson = 24
|
|
||||||
};
|
};
|
||||||
|
|
||||||
explicit GenericHID(int port);
|
explicit GenericHID(int port);
|
||||||
@@ -319,7 +327,14 @@ class GenericHID {
|
|||||||
*
|
*
|
||||||
* @return the type of the HID.
|
* @return the type of the HID.
|
||||||
*/
|
*/
|
||||||
GenericHID::HIDType GetType() const;
|
GenericHID::HIDType GetGamepadType() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the supported outputs of the HID.
|
||||||
|
*
|
||||||
|
* @return the supported outputs of the HID.
|
||||||
|
*/
|
||||||
|
GenericHID::SupportedOutputs GetSupportedOutputs() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the name of the HID.
|
* Get the name of the HID.
|
||||||
@@ -336,19 +351,14 @@ class GenericHID {
|
|||||||
int GetPort() const;
|
int GetPort() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set a single HID output value for the HID.
|
* Set leds on the controller. If only mono is supported, the system will use
|
||||||
|
* the highest value passed in.
|
||||||
*
|
*
|
||||||
* @param outputNumber The index of the output to set (1-32)
|
* @param r Red value from 0-255
|
||||||
* @param value The value to set the output to
|
* @param g Green value from 0-255
|
||||||
|
* @param b Blue value from 0-255
|
||||||
*/
|
*/
|
||||||
void SetOutput(int outputNumber, bool value);
|
void SetLeds(int r, int g, int b);
|
||||||
|
|
||||||
/**
|
|
||||||
* Set all output values for the HID.
|
|
||||||
*
|
|
||||||
* @param value The 32 bit output value (1 bit for each output)
|
|
||||||
*/
|
|
||||||
void SetOutputs(int value);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the rumble output for the HID.
|
* Set the rumble output for the HID.
|
||||||
@@ -362,9 +372,10 @@ class GenericHID {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
int m_port;
|
int m_port;
|
||||||
int m_outputs = 0;
|
|
||||||
uint16_t m_leftRumble = 0;
|
uint16_t m_leftRumble = 0;
|
||||||
uint16_t m_rightRumble = 0;
|
uint16_t m_rightRumble = 0;
|
||||||
|
uint16_t m_leftTriggerRumble = 0;
|
||||||
|
uint16_t m_rightTriggerRumble = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace wpi
|
} // namespace wpi
|
||||||
|
|||||||
@@ -251,13 +251,14 @@ class DriverStationSim {
|
|||||||
* @param stick The joystick number
|
* @param stick The joystick number
|
||||||
* @return The joystick outputs
|
* @return The joystick outputs
|
||||||
*/
|
*/
|
||||||
static int64_t GetJoystickOutputs(int stick);
|
static int32_t GetJoystickLeds(int stick);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the joystick rumble.
|
* Gets the joystick rumble.
|
||||||
*
|
*
|
||||||
* @param stick The joystick number
|
* @param stick The joystick number
|
||||||
* @param rumbleNum Rumble to get (0=left, 1=right)
|
* @param rumbleNum Rumble to get (0=left, 1=right, 2=left trigger, 3=right
|
||||||
|
* trigger)
|
||||||
* @return The joystick rumble value
|
* @return The joystick rumble value
|
||||||
*/
|
*/
|
||||||
static int GetJoystickRumble(int stick, int rumbleNum);
|
static int GetJoystickRumble(int stick, int rumbleNum);
|
||||||
@@ -346,7 +347,7 @@ class DriverStationSim {
|
|||||||
* @param stick The joystick number
|
* @param stick The joystick number
|
||||||
* @param type The value of type
|
* @param type The value of type
|
||||||
*/
|
*/
|
||||||
static void SetJoystickType(int stick, int type);
|
static void SetJoystickGamepadType(int stick, int type);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the name of a joystick.
|
* Sets the name of a joystick.
|
||||||
@@ -356,6 +357,14 @@ class DriverStationSim {
|
|||||||
*/
|
*/
|
||||||
static void SetJoystickName(int stick, std::string_view name);
|
static void SetJoystickName(int stick, std::string_view name);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the supported outputs for a joystick.
|
||||||
|
*
|
||||||
|
* @param stick The joystick number
|
||||||
|
* @param supportedOutputs The supported outputs for the joystick
|
||||||
|
*/
|
||||||
|
static void SetJoystickSupportedOutputs(int stick, int supportedOutputs);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the game specific message.
|
* Sets the game specific message.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -102,7 +102,9 @@ class GenericHIDSim {
|
|||||||
*
|
*
|
||||||
* @param type the new device type
|
* @param type the new device type
|
||||||
*/
|
*/
|
||||||
void SetType(GenericHID::HIDType type);
|
void SetGamepadType(GenericHID::HIDType type);
|
||||||
|
|
||||||
|
void SetSupportedOutputs(GenericHID::SupportedOutputs supportedOutputs);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the name of this device.
|
* Set the name of this device.
|
||||||
@@ -112,19 +114,11 @@ class GenericHIDSim {
|
|||||||
void SetName(const char* name);
|
void SetName(const char* name);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read the output of a button.
|
* Get the value of set LEDs.
|
||||||
*
|
*
|
||||||
* @param outputNumber the button number
|
* @return the led color
|
||||||
* @return the value of the button (true = pressed)
|
|
||||||
*/
|
*/
|
||||||
bool GetOutput(int outputNumber);
|
int32_t GetLeds();
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the encoded 16-bit integer that passes button values.
|
|
||||||
*
|
|
||||||
* @return the button values
|
|
||||||
*/
|
|
||||||
int64_t GetOutputs();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the joystick rumble.
|
* Get the joystick rumble.
|
||||||
|
|||||||
@@ -17,7 +17,8 @@ classes:
|
|||||||
GetStickAxis:
|
GetStickAxis:
|
||||||
GetStickPOV:
|
GetStickPOV:
|
||||||
GetStickButtons:
|
GetStickButtons:
|
||||||
GetJoystickType:
|
GetJoystickGamepadType:
|
||||||
|
GetJoystickSupportedOutputs:
|
||||||
GetJoystickName:
|
GetJoystickName:
|
||||||
IsJoystickConnected:
|
IsJoystickConnected:
|
||||||
IsEnabled:
|
IsEnabled:
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ classes:
|
|||||||
wpi::GenericHID:
|
wpi::GenericHID:
|
||||||
enums:
|
enums:
|
||||||
RumbleType:
|
RumbleType:
|
||||||
|
SupportedOutputs:
|
||||||
HIDType:
|
HIDType:
|
||||||
methods:
|
methods:
|
||||||
GenericHID:
|
GenericHID:
|
||||||
@@ -34,11 +35,11 @@ classes:
|
|||||||
AxisLessThan:
|
AxisLessThan:
|
||||||
AxisGreaterThan:
|
AxisGreaterThan:
|
||||||
IsConnected:
|
IsConnected:
|
||||||
GetType:
|
GetGamepadType:
|
||||||
|
GetSupportedOutputs:
|
||||||
GetName:
|
GetName:
|
||||||
GetPort:
|
GetPort:
|
||||||
SetOutput:
|
SetLeds:
|
||||||
SetOutputs:
|
|
||||||
SetRumble:
|
SetRumble:
|
||||||
GetAxesMaximumIndex:
|
GetAxesMaximumIndex:
|
||||||
GetAxesAvailable:
|
GetAxesAvailable:
|
||||||
|
|||||||
@@ -30,12 +30,13 @@ classes:
|
|||||||
NotifyNewData:
|
NotifyNewData:
|
||||||
SetSendError:
|
SetSendError:
|
||||||
SetSendConsoleLine:
|
SetSendConsoleLine:
|
||||||
GetJoystickOutputs:
|
GetJoystickLeds:
|
||||||
GetJoystickRumble:
|
GetJoystickRumble:
|
||||||
SetJoystickButton:
|
SetJoystickButton:
|
||||||
SetJoystickAxis:
|
SetJoystickAxis:
|
||||||
SetJoystickPOV:
|
SetJoystickPOV:
|
||||||
SetJoystickType:
|
SetJoystickGamepadType:
|
||||||
|
SetJoystickSupportedOutputs:
|
||||||
SetJoystickName:
|
SetJoystickName:
|
||||||
SetGameSpecificMessage:
|
SetGameSpecificMessage:
|
||||||
SetEventName:
|
SetEventName:
|
||||||
|
|||||||
@@ -12,10 +12,10 @@ classes:
|
|||||||
overloads:
|
overloads:
|
||||||
int, DriverStation::POVDirection:
|
int, DriverStation::POVDirection:
|
||||||
DriverStation::POVDirection:
|
DriverStation::POVDirection:
|
||||||
SetType:
|
SetGamepadType:
|
||||||
|
SetSupportedOutputs:
|
||||||
SetName:
|
SetName:
|
||||||
GetOutput:
|
GetLeds:
|
||||||
GetOutputs:
|
|
||||||
GetRumble:
|
GetRumble:
|
||||||
SetAxesMaximumIndex:
|
SetAxesMaximumIndex:
|
||||||
SetAxesAvailable:
|
SetAxesAvailable:
|
||||||
|
|||||||
@@ -17,9 +17,19 @@ TEST(GenericHIDTest, RumbleRange) {
|
|||||||
|
|
||||||
for (int i = 0; i <= 100; i++) {
|
for (int i = 0; i <= 100; i++) {
|
||||||
double rumbleValue = i / 100.0;
|
double rumbleValue = i / 100.0;
|
||||||
hid.SetRumble(RumbleType::kBothRumble, rumbleValue);
|
hid.SetRumble(RumbleType::kLeftRumble, rumbleValue);
|
||||||
EXPECT_NEAR(rumbleValue, sim.GetRumble(RumbleType::kLeftRumble), kEpsilon);
|
EXPECT_NEAR(rumbleValue, sim.GetRumble(RumbleType::kLeftRumble), kEpsilon);
|
||||||
|
|
||||||
|
hid.SetRumble(RumbleType::kRightRumble, rumbleValue);
|
||||||
EXPECT_NEAR(rumbleValue, sim.GetRumble(RumbleType::kRightRumble), kEpsilon);
|
EXPECT_NEAR(rumbleValue, sim.GetRumble(RumbleType::kRightRumble), kEpsilon);
|
||||||
|
|
||||||
|
hid.SetRumble(RumbleType::kLeftTriggerRumble, rumbleValue);
|
||||||
|
EXPECT_NEAR(rumbleValue, sim.GetRumble(RumbleType::kLeftTriggerRumble),
|
||||||
|
kEpsilon);
|
||||||
|
|
||||||
|
hid.SetRumble(RumbleType::kRightTriggerRumble, rumbleValue);
|
||||||
|
EXPECT_NEAR(rumbleValue, sim.GetRumble(RumbleType::kRightTriggerRumble),
|
||||||
|
kEpsilon);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -27,25 +37,45 @@ TEST(GenericHIDTest, RumbleTypes) {
|
|||||||
GenericHID hid{0};
|
GenericHID hid{0};
|
||||||
sim::GenericHIDSim sim{0};
|
sim::GenericHIDSim sim{0};
|
||||||
|
|
||||||
// Make sure both are off
|
// Make sure all are off
|
||||||
hid.SetRumble(RumbleType::kBothRumble, 0);
|
hid.SetRumble(RumbleType::kLeftRumble, 0);
|
||||||
EXPECT_NEAR(0, sim.GetRumble(RumbleType::kBothRumble), kEpsilon);
|
hid.SetRumble(RumbleType::kLeftTriggerRumble, 0);
|
||||||
|
hid.SetRumble(RumbleType::kRightRumble, 0);
|
||||||
// test both
|
hid.SetRumble(RumbleType::kRightTriggerRumble, 0);
|
||||||
hid.SetRumble(RumbleType::kBothRumble, 1);
|
EXPECT_NEAR(0, sim.GetRumble(RumbleType::kLeftRumble), kEpsilon);
|
||||||
EXPECT_NEAR(1, sim.GetRumble(RumbleType::kLeftRumble), kEpsilon);
|
EXPECT_NEAR(0, sim.GetRumble(RumbleType::kLeftTriggerRumble), kEpsilon);
|
||||||
EXPECT_NEAR(1, sim.GetRumble(RumbleType::kRightRumble), kEpsilon);
|
EXPECT_NEAR(0, sim.GetRumble(RumbleType::kRightRumble), kEpsilon);
|
||||||
hid.SetRumble(RumbleType::kBothRumble, 0);
|
EXPECT_NEAR(0, sim.GetRumble(RumbleType::kRightTriggerRumble), kEpsilon);
|
||||||
|
|
||||||
// test left only
|
// test left only
|
||||||
hid.SetRumble(RumbleType::kLeftRumble, 1);
|
hid.SetRumble(RumbleType::kLeftRumble, 1);
|
||||||
EXPECT_NEAR(1, sim.GetRumble(RumbleType::kLeftRumble), kEpsilon);
|
EXPECT_NEAR(1, sim.GetRumble(RumbleType::kLeftRumble), kEpsilon);
|
||||||
EXPECT_NEAR(0, sim.GetRumble(RumbleType::kRightRumble), kEpsilon);
|
EXPECT_NEAR(0, sim.GetRumble(RumbleType::kRightRumble), kEpsilon);
|
||||||
|
EXPECT_NEAR(0, sim.GetRumble(RumbleType::kLeftTriggerRumble), kEpsilon);
|
||||||
|
EXPECT_NEAR(0, sim.GetRumble(RumbleType::kRightTriggerRumble), kEpsilon);
|
||||||
hid.SetRumble(RumbleType::kLeftRumble, 0);
|
hid.SetRumble(RumbleType::kLeftRumble, 0);
|
||||||
|
|
||||||
// test right only
|
// test right only
|
||||||
hid.SetRumble(RumbleType::kRightRumble, 1);
|
hid.SetRumble(RumbleType::kRightRumble, 1);
|
||||||
EXPECT_NEAR(0, sim.GetRumble(RumbleType::kLeftRumble), kEpsilon);
|
EXPECT_NEAR(0, sim.GetRumble(RumbleType::kLeftRumble), kEpsilon);
|
||||||
EXPECT_NEAR(1, sim.GetRumble(RumbleType::kRightRumble), kEpsilon);
|
EXPECT_NEAR(1, sim.GetRumble(RumbleType::kRightRumble), kEpsilon);
|
||||||
|
EXPECT_NEAR(0, sim.GetRumble(RumbleType::kLeftTriggerRumble), kEpsilon);
|
||||||
|
EXPECT_NEAR(0, sim.GetRumble(RumbleType::kRightTriggerRumble), kEpsilon);
|
||||||
hid.SetRumble(RumbleType::kRightRumble, 0);
|
hid.SetRumble(RumbleType::kRightRumble, 0);
|
||||||
|
|
||||||
|
// test left trigger only
|
||||||
|
hid.SetRumble(RumbleType::kLeftTriggerRumble, 1);
|
||||||
|
EXPECT_NEAR(0, sim.GetRumble(RumbleType::kLeftRumble), kEpsilon);
|
||||||
|
EXPECT_NEAR(0, sim.GetRumble(RumbleType::kRightRumble), kEpsilon);
|
||||||
|
EXPECT_NEAR(1, sim.GetRumble(RumbleType::kLeftTriggerRumble), kEpsilon);
|
||||||
|
EXPECT_NEAR(0, sim.GetRumble(RumbleType::kRightTriggerRumble), kEpsilon);
|
||||||
|
hid.SetRumble(RumbleType::kLeftTriggerRumble, 0);
|
||||||
|
|
||||||
|
// test right trigger only
|
||||||
|
hid.SetRumble(RumbleType::kRightTriggerRumble, 1);
|
||||||
|
EXPECT_NEAR(0, sim.GetRumble(RumbleType::kLeftRumble), kEpsilon);
|
||||||
|
EXPECT_NEAR(0, sim.GetRumble(RumbleType::kRightRumble), kEpsilon);
|
||||||
|
EXPECT_NEAR(0, sim.GetRumble(RumbleType::kLeftTriggerRumble), kEpsilon);
|
||||||
|
EXPECT_NEAR(1, sim.GetRumble(RumbleType::kRightTriggerRumble), kEpsilon);
|
||||||
|
hid.SetRumble(RumbleType::kRightTriggerRumble, 0);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -977,17 +977,31 @@ public final class DriverStation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the value of type on a joystick.
|
* Gets the value of type on a gamepad.
|
||||||
*
|
*
|
||||||
* @param stick The joystick port number
|
* @param stick The joystick port number
|
||||||
* @return The value of type
|
* @return The value of type
|
||||||
*/
|
*/
|
||||||
public static int getJoystickType(int stick) {
|
public static int getJoystickGamepadType(int stick) {
|
||||||
if (stick < 0 || stick >= kJoystickPorts) {
|
if (stick < 0 || stick >= kJoystickPorts) {
|
||||||
throw new IllegalArgumentException("Joystick index is out of range, should be 0-5");
|
throw new IllegalArgumentException("Joystick index is out of range, should be 0-5");
|
||||||
}
|
}
|
||||||
|
|
||||||
return DriverStationJNI.getJoystickType((byte) stick);
|
return DriverStationJNI.getJoystickGamepadType((byte) stick);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the value of supported outputs on a joystick.
|
||||||
|
*
|
||||||
|
* @param stick The joystick port number
|
||||||
|
* @return The value of supported outputs
|
||||||
|
*/
|
||||||
|
public static int getJoystickSupportedOutputs(int stick) {
|
||||||
|
if (stick < 0 || stick >= kJoystickPorts) {
|
||||||
|
throw new IllegalArgumentException("Joystick index is out of range, should be 0-5");
|
||||||
|
}
|
||||||
|
|
||||||
|
return DriverStationJNI.getJoystickSupportedOutputs((byte) stick);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -26,46 +26,36 @@ public class GenericHID {
|
|||||||
kLeftRumble,
|
kLeftRumble,
|
||||||
/** Right rumble motor. */
|
/** Right rumble motor. */
|
||||||
kRightRumble,
|
kRightRumble,
|
||||||
/** Both left and right rumble motors. */
|
/** Left trigger rumble motor. */
|
||||||
kBothRumble
|
kLeftTriggerRumble,
|
||||||
|
/** Right trigger rumble motor. */
|
||||||
|
kRightTriggerRumble,
|
||||||
}
|
}
|
||||||
|
|
||||||
/** USB HID interface type. */
|
/** USB HID interface type. */
|
||||||
public enum HIDType {
|
public enum HIDType {
|
||||||
/** Unknown. */
|
/** Unknown. */
|
||||||
kUnknown(-1),
|
kUnknown(0),
|
||||||
/** XInputUnknown. */
|
/** Standard. */
|
||||||
kXInputUnknown(0),
|
kStandard(1),
|
||||||
/** XInputGamepad. */
|
/** Xbox 360. */
|
||||||
kXInputGamepad(1),
|
kXbox360(2),
|
||||||
/** XInputWheel. */
|
/** Xbox One. */
|
||||||
kXInputWheel(2),
|
kXboxOne(3),
|
||||||
/** XInputArcadeStick. */
|
/** PS3. */
|
||||||
kXInputArcadeStick(3),
|
kPS3(4),
|
||||||
/** XInputFlightStick. */
|
/** PS4. */
|
||||||
kXInputFlightStick(4),
|
kPS4(5),
|
||||||
/** XInputDancePad. */
|
/** PS5. */
|
||||||
kXInputDancePad(5),
|
kPS5(6),
|
||||||
/** XInputGuitar. */
|
/** Switch Pro. */
|
||||||
kXInputGuitar(6),
|
kSwitchPro(7),
|
||||||
/** XInputGuitar2. */
|
/** Switch Joycon Left. */
|
||||||
kXInputGuitar2(7),
|
kSwitchJoyconLeft(8),
|
||||||
/** XInputDrumKit. */
|
/** Switch Joycon Right. */
|
||||||
kXInputDrumKit(8),
|
kSwitchJoyconRight(9),
|
||||||
/** XInputGuitar3. */
|
/** Switch Joycon Pair. */
|
||||||
kXInputGuitar3(11),
|
kSwitchJoyconPair(10);
|
||||||
/** XInputArcadePad. */
|
|
||||||
kXInputArcadePad(19),
|
|
||||||
/** HIDJoystick. */
|
|
||||||
kHIDJoystick(20),
|
|
||||||
/** HIDGamepad. */
|
|
||||||
kHIDGamepad(21),
|
|
||||||
/** HIDDriving. */
|
|
||||||
kHIDDriving(22),
|
|
||||||
/** HIDFlight. */
|
|
||||||
kHIDFlight(23),
|
|
||||||
/** HID1stPerson. */
|
|
||||||
kHID1stPerson(24);
|
|
||||||
|
|
||||||
/** HIDType value. */
|
/** HIDType value. */
|
||||||
public final int value;
|
public final int value;
|
||||||
@@ -94,9 +84,10 @@ public class GenericHID {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private final int m_port;
|
private final int m_port;
|
||||||
private int m_outputs;
|
|
||||||
private int m_leftRumble;
|
private int m_leftRumble;
|
||||||
private int m_rightRumble;
|
private int m_rightRumble;
|
||||||
|
private int m_leftTriggerRumble;
|
||||||
|
private int m_rightTriggerRumble;
|
||||||
private final Map<EventLoop, Map<Integer, BooleanEvent>> m_buttonCache = new HashMap<>();
|
private final Map<EventLoop, Map<Integer, BooleanEvent>> m_buttonCache = new HashMap<>();
|
||||||
private final Map<EventLoop, Map<Pair<Integer, Double>, BooleanEvent>> m_axisLessThanCache =
|
private final Map<EventLoop, Map<Pair<Integer, Double>, BooleanEvent>> m_axisLessThanCache =
|
||||||
new HashMap<>();
|
new HashMap<>();
|
||||||
@@ -432,8 +423,17 @@ public class GenericHID {
|
|||||||
*
|
*
|
||||||
* @return the type of the HID.
|
* @return the type of the HID.
|
||||||
*/
|
*/
|
||||||
public HIDType getType() {
|
public HIDType getGamepadType() {
|
||||||
return HIDType.of(DriverStation.getJoystickType(m_port));
|
return HIDType.of(DriverStation.getJoystickGamepadType(m_port));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the supported outputs for the HID.
|
||||||
|
*
|
||||||
|
* @return the supported outputs for the HID.
|
||||||
|
*/
|
||||||
|
public int getSupportedOutputs() {
|
||||||
|
return DriverStation.getJoystickSupportedOutputs(m_port);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -455,24 +455,16 @@ public class GenericHID {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set a single HID output value for the HID.
|
* Set leds on the controller. If only mono is supported, the system will use the highest value
|
||||||
|
* passed in.
|
||||||
*
|
*
|
||||||
* @param outputNumber The index of the output to set (1-32)
|
* @param r Red value from 0-255
|
||||||
* @param value The value to set the output to
|
* @param g Green value from 0-255
|
||||||
|
* @param b Blue value from 0-255
|
||||||
*/
|
*/
|
||||||
public void setOutput(int outputNumber, boolean value) {
|
public void setLeds(int r, int g, int b) {
|
||||||
m_outputs = (m_outputs & ~(1 << (outputNumber - 1))) | ((value ? 1 : 0) << (outputNumber - 1));
|
int value = ((r & 0xFF) << 16) | ((g & 0xFF) << 8) | (b & 0xFF);
|
||||||
DriverStationJNI.setJoystickOutputs((byte) m_port, m_outputs, m_leftRumble, m_rightRumble);
|
DriverStationJNI.setJoystickLeds((byte) m_port, value);
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set all HID output values for the HID.
|
|
||||||
*
|
|
||||||
* @param value The 32 bit output value (1 bit for each output)
|
|
||||||
*/
|
|
||||||
public void setOutputs(int value) {
|
|
||||||
m_outputs = value;
|
|
||||||
DriverStationJNI.setJoystickOutputs((byte) m_port, m_outputs, m_leftRumble, m_rightRumble);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -486,15 +478,27 @@ public class GenericHID {
|
|||||||
value = Math.clamp(value, 0, 1);
|
value = Math.clamp(value, 0, 1);
|
||||||
int rumbleValue = (int) (value * 65535);
|
int rumbleValue = (int) (value * 65535);
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case kLeftRumble -> this.m_leftRumble = rumbleValue;
|
case kLeftRumble:
|
||||||
case kRightRumble -> this.m_rightRumble = rumbleValue;
|
|
||||||
default -> {
|
|
||||||
this.m_leftRumble = rumbleValue;
|
this.m_leftRumble = rumbleValue;
|
||||||
|
break;
|
||||||
|
case kRightRumble:
|
||||||
this.m_rightRumble = rumbleValue;
|
this.m_rightRumble = rumbleValue;
|
||||||
}
|
break;
|
||||||
|
case kLeftTriggerRumble:
|
||||||
|
this.m_leftTriggerRumble = rumbleValue;
|
||||||
|
break;
|
||||||
|
case kRightTriggerRumble:
|
||||||
|
this.m_rightTriggerRumble = rumbleValue;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
DriverStationJNI.setJoystickOutputs(
|
DriverStationJNI.setJoystickRumble(
|
||||||
(byte) this.m_port, this.m_outputs, this.m_leftRumble, this.m_rightRumble);
|
(byte) this.m_port,
|
||||||
|
this.m_leftRumble,
|
||||||
|
this.m_rightRumble,
|
||||||
|
this.m_leftTriggerRumble,
|
||||||
|
this.m_rightTriggerRumble);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -322,15 +322,15 @@ public final class DriverStationSim {
|
|||||||
* @param stick The joystick number
|
* @param stick The joystick number
|
||||||
* @return The joystick outputs
|
* @return The joystick outputs
|
||||||
*/
|
*/
|
||||||
public static long getJoystickOutputs(int stick) {
|
public static int getJoystickLeds(int stick) {
|
||||||
return DriverStationDataJNI.getJoystickOutputs(stick);
|
return DriverStationDataJNI.getJoystickLeds(stick);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the joystick rumble.
|
* Gets the joystick rumble.
|
||||||
*
|
*
|
||||||
* @param stick The joystick number
|
* @param stick The joystick number
|
||||||
* @param rumbleNum Rumble to get (0=left, 1=right)
|
* @param rumbleNum Rumble to get (0=left, 1=right, 2=left trigger, 3=right trigger)
|
||||||
* @return The joystick rumble value
|
* @return The joystick rumble value
|
||||||
*/
|
*/
|
||||||
public static int getJoystickRumble(int stick, int rumbleNum) {
|
public static int getJoystickRumble(int stick, int rumbleNum) {
|
||||||
@@ -450,8 +450,18 @@ public final class DriverStationSim {
|
|||||||
* @param stick The joystick number
|
* @param stick The joystick number
|
||||||
* @param type The value of type
|
* @param type The value of type
|
||||||
*/
|
*/
|
||||||
public static void setJoystickType(int stick, int type) {
|
public static void setJoystickGamepadType(int stick, int type) {
|
||||||
DriverStationDataJNI.setJoystickType(stick, type);
|
DriverStationDataJNI.setJoystickGamepadType(stick, type);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the value of supported outputs for a joystick.
|
||||||
|
*
|
||||||
|
* @param stick The joystick number
|
||||||
|
* @param supportedOutputs The value of supported outputs
|
||||||
|
*/
|
||||||
|
public static void setJoystickSupportedOutputs(int stick, int supportedOutputs) {
|
||||||
|
DriverStationDataJNI.setJoystickSupportedOutputs(stick, supportedOutputs);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -133,8 +133,17 @@ public class GenericHIDSim {
|
|||||||
*
|
*
|
||||||
* @param type the new device type
|
* @param type the new device type
|
||||||
*/
|
*/
|
||||||
public void setType(GenericHID.HIDType type) {
|
public void setGamepadType(GenericHID.HIDType type) {
|
||||||
DriverStationSim.setJoystickType(m_port, type.value);
|
DriverStationSim.setJoystickGamepadType(m_port, type.value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the supported outputs of this device.
|
||||||
|
*
|
||||||
|
* @param supportedOutputs the new supported outputs
|
||||||
|
*/
|
||||||
|
public void setSupportedOutputs(int supportedOutputs) {
|
||||||
|
DriverStationSim.setJoystickSupportedOutputs(m_port, supportedOutputs);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -147,23 +156,12 @@ public class GenericHIDSim {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read the output of a button.
|
* Get the led color set.
|
||||||
*
|
*
|
||||||
* @param outputNumber the button number
|
* @return the led color set
|
||||||
* @return the value of the button (true = pressed)
|
|
||||||
*/
|
*/
|
||||||
public boolean getOutput(int outputNumber) {
|
public int getLeds() {
|
||||||
long outputs = getOutputs();
|
return DriverStationSim.getJoystickLeds(m_port);
|
||||||
return (outputs & (1L << (outputNumber - 1))) != 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the encoded 16-bit integer that passes button values.
|
|
||||||
*
|
|
||||||
* @return the button values
|
|
||||||
*/
|
|
||||||
public long getOutputs() {
|
|
||||||
return DriverStationSim.getJoystickOutputs(m_port);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -173,9 +171,24 @@ public class GenericHIDSim {
|
|||||||
* @return the rumble value
|
* @return the rumble value
|
||||||
*/
|
*/
|
||||||
public double getRumble(GenericHID.RumbleType type) {
|
public double getRumble(GenericHID.RumbleType type) {
|
||||||
int value =
|
int intType = 0;
|
||||||
DriverStationSim.getJoystickRumble(
|
switch (type) {
|
||||||
m_port, type == GenericHID.RumbleType.kLeftRumble ? 0 : 1);
|
case kLeftRumble:
|
||||||
|
intType = 0;
|
||||||
|
break;
|
||||||
|
case kRightRumble:
|
||||||
|
intType = 1;
|
||||||
|
break;
|
||||||
|
case kLeftTriggerRumble:
|
||||||
|
intType = 2;
|
||||||
|
break;
|
||||||
|
case kRightTriggerRumble:
|
||||||
|
intType = 3;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return 0.0;
|
||||||
|
}
|
||||||
|
int value = DriverStationSim.getJoystickRumble(m_port, intType);
|
||||||
return value / 65535.0;
|
return value / 65535.0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,37 +20,65 @@ class GenericHIDTest {
|
|||||||
|
|
||||||
for (int i = 0; i <= 100; i++) {
|
for (int i = 0; i <= 100; i++) {
|
||||||
double rumbleValue = i / 100.0;
|
double rumbleValue = i / 100.0;
|
||||||
hid.setRumble(RumbleType.kBothRumble, rumbleValue);
|
hid.setRumble(RumbleType.kLeftRumble, rumbleValue);
|
||||||
assertEquals(rumbleValue, sim.getRumble(RumbleType.kLeftRumble), kEpsilon);
|
assertEquals(rumbleValue, sim.getRumble(RumbleType.kLeftRumble), kEpsilon);
|
||||||
|
|
||||||
|
hid.setRumble(RumbleType.kRightRumble, rumbleValue);
|
||||||
assertEquals(rumbleValue, sim.getRumble(RumbleType.kRightRumble), kEpsilon);
|
assertEquals(rumbleValue, sim.getRumble(RumbleType.kRightRumble), kEpsilon);
|
||||||
|
|
||||||
|
hid.setRumble(RumbleType.kLeftTriggerRumble, rumbleValue);
|
||||||
|
assertEquals(rumbleValue, sim.getRumble(RumbleType.kLeftTriggerRumble), kEpsilon);
|
||||||
|
|
||||||
|
hid.setRumble(RumbleType.kRightTriggerRumble, rumbleValue);
|
||||||
|
assertEquals(rumbleValue, sim.getRumble(RumbleType.kRightTriggerRumble), kEpsilon);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testRumbleTypes() {
|
void testRumbleTypes() {
|
||||||
GenericHID hid = new GenericHID(0);
|
GenericHID hid = new GenericHID(0);
|
||||||
GenericHIDSim sim = new GenericHIDSim(0);
|
final GenericHIDSim sim = new GenericHIDSim(0);
|
||||||
|
|
||||||
// Make sure both are off
|
// Make sure all are off
|
||||||
hid.setRumble(RumbleType.kBothRumble, 0);
|
hid.setRumble(RumbleType.kLeftRumble, 0);
|
||||||
assertEquals(0, sim.getRumble(RumbleType.kBothRumble), kEpsilon);
|
hid.setRumble(RumbleType.kRightRumble, 0);
|
||||||
|
hid.setRumble(RumbleType.kLeftTriggerRumble, 0);
|
||||||
// test both
|
hid.setRumble(RumbleType.kRightTriggerRumble, 0);
|
||||||
hid.setRumble(RumbleType.kBothRumble, 1);
|
assertEquals(0, sim.getRumble(RumbleType.kLeftRumble), kEpsilon);
|
||||||
assertEquals(1, sim.getRumble(RumbleType.kLeftRumble), kEpsilon);
|
assertEquals(0, sim.getRumble(RumbleType.kRightRumble), kEpsilon);
|
||||||
assertEquals(1, sim.getRumble(RumbleType.kRightRumble), kEpsilon);
|
assertEquals(0, sim.getRumble(RumbleType.kLeftTriggerRumble), kEpsilon);
|
||||||
hid.setRumble(RumbleType.kBothRumble, 0);
|
assertEquals(0, sim.getRumble(RumbleType.kRightTriggerRumble), kEpsilon);
|
||||||
|
|
||||||
// test left only
|
// test left only
|
||||||
hid.setRumble(RumbleType.kLeftRumble, 1);
|
hid.setRumble(RumbleType.kLeftRumble, 1);
|
||||||
assertEquals(1, sim.getRumble(RumbleType.kLeftRumble), kEpsilon);
|
assertEquals(1, sim.getRumble(RumbleType.kLeftRumble), kEpsilon);
|
||||||
assertEquals(0, sim.getRumble(RumbleType.kRightRumble), kEpsilon);
|
assertEquals(0, sim.getRumble(RumbleType.kRightRumble), kEpsilon);
|
||||||
|
assertEquals(0, sim.getRumble(RumbleType.kLeftTriggerRumble), kEpsilon);
|
||||||
|
assertEquals(0, sim.getRumble(RumbleType.kRightTriggerRumble), kEpsilon);
|
||||||
hid.setRumble(RumbleType.kLeftRumble, 0);
|
hid.setRumble(RumbleType.kLeftRumble, 0);
|
||||||
|
|
||||||
// test right only
|
// test right only
|
||||||
hid.setRumble(RumbleType.kRightRumble, 1);
|
hid.setRumble(RumbleType.kRightRumble, 1);
|
||||||
assertEquals(0, sim.getRumble(RumbleType.kLeftRumble), kEpsilon);
|
assertEquals(0, sim.getRumble(RumbleType.kLeftRumble), kEpsilon);
|
||||||
assertEquals(1, sim.getRumble(RumbleType.kRightRumble), kEpsilon);
|
assertEquals(1, sim.getRumble(RumbleType.kRightRumble), kEpsilon);
|
||||||
|
assertEquals(0, sim.getRumble(RumbleType.kLeftTriggerRumble), kEpsilon);
|
||||||
|
assertEquals(0, sim.getRumble(RumbleType.kRightTriggerRumble), kEpsilon);
|
||||||
hid.setRumble(RumbleType.kRightRumble, 0);
|
hid.setRumble(RumbleType.kRightRumble, 0);
|
||||||
|
|
||||||
|
// test left trigger only
|
||||||
|
hid.setRumble(RumbleType.kLeftTriggerRumble, 1);
|
||||||
|
assertEquals(0, sim.getRumble(RumbleType.kLeftRumble), kEpsilon);
|
||||||
|
assertEquals(0, sim.getRumble(RumbleType.kRightRumble), kEpsilon);
|
||||||
|
assertEquals(1, sim.getRumble(RumbleType.kLeftTriggerRumble), kEpsilon);
|
||||||
|
assertEquals(0, sim.getRumble(RumbleType.kRightTriggerRumble), kEpsilon);
|
||||||
|
hid.setRumble(RumbleType.kLeftTriggerRumble, 0);
|
||||||
|
|
||||||
|
// test right trigger only
|
||||||
|
hid.setRumble(RumbleType.kRightTriggerRumble, 1);
|
||||||
|
assertEquals(0, sim.getRumble(RumbleType.kLeftRumble), kEpsilon);
|
||||||
|
assertEquals(0, sim.getRumble(RumbleType.kRightRumble), kEpsilon);
|
||||||
|
assertEquals(0, sim.getRumble(RumbleType.kLeftTriggerRumble), kEpsilon);
|
||||||
|
assertEquals(1, sim.getRumble(RumbleType.kRightTriggerRumble), kEpsilon);
|
||||||
|
hid.setRumble(RumbleType.kRightTriggerRumble, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user