[hal] Update DS API to new format (#7977)

This commit is contained in:
Thad House
2025-05-16 22:15:14 -07:00
committed by GitHub
parent 1596e2fd7a
commit 231ec348fe
35 changed files with 878 additions and 766 deletions

View File

@@ -14,81 +14,72 @@
static const uint8_t file_descriptor[] {
0x0a,0x0d,0x4d,0x72,0x63,0x43,0x6f,0x6d,0x6d,0x2e,
0x70,0x72,0x6f,0x74,0x6f,0x12,0x09,0x6d,0x72,0x63,
0x2e,0x70,0x72,0x6f,0x74,0x6f,0x22,0x7a,0x0a,0x14,
0x50,0x72,0x6f,0x74,0x6f,0x62,0x75,0x66,0x4a,0x6f,
0x79,0x73,0x74,0x69,0x63,0x6b,0x44,0x61,0x74,0x61,
0x12,0x20,0x0a,0x0b,0x42,0x75,0x74,0x74,0x6f,0x6e,
0x43,0x6f,0x75,0x6e,0x74,0x18,0x01,0x20,0x01,0x28,
0x0d,0x52,0x0b,0x42,0x75,0x74,0x74,0x6f,0x6e,0x43,
0x6f,0x75,0x6e,0x74,0x12,0x18,0x0a,0x07,0x42,0x75,
0x74,0x74,0x6f,0x6e,0x73,0x18,0x02,0x20,0x01,0x28,
0x07,0x52,0x07,0x42,0x75,0x74,0x74,0x6f,0x6e,0x73,
0x12,0x12,0x0a,0x04,0x41,0x78,0x65,0x73,0x18,0x03,
0x20,0x03,0x28,0x02,0x52,0x04,0x41,0x78,0x65,0x73,
0x12,0x12,0x0a,0x04,0x50,0x4f,0x56,0x73,0x18,0x04,
0x20,0x03,0x28,0x11,0x52,0x04,0x50,0x4f,0x56,0x73,
0x22,0xac,0x01,0x0a,0x13,0x50,0x72,0x6f,0x74,0x6f,
0x62,0x75,0x66,0x43,0x6f,0x6e,0x74,0x72,0x6f,0x6c,
0x44,0x61,0x74,0x61,0x12,0x20,0x0a,0x0b,0x43,0x6f,
0x6e,0x74,0x72,0x6f,0x6c,0x57,0x6f,0x72,0x64,0x18,
0x01,0x20,0x01,0x28,0x0d,0x52,0x0b,0x43,0x6f,0x6e,
0x74,0x72,0x6f,0x6c,0x57,0x6f,0x72,0x64,0x12,0x1c,
0x0a,0x09,0x4d,0x61,0x74,0x63,0x68,0x54,0x69,0x6d,
0x65,0x18,0x02,0x20,0x01,0x28,0x02,0x52,0x09,0x4d,
0x61,0x74,0x63,0x68,0x54,0x69,0x6d,0x65,0x12,0x3d,
0x0a,0x09,0x4a,0x6f,0x79,0x73,0x74,0x69,0x63,0x6b,
0x73,0x18,0x03,0x20,0x03,0x28,0x0b,0x32,0x1f,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,0x61,0x74,0x61,
0x52,0x09,0x4a,0x6f,0x79,0x73,0x74,0x69,0x63,0x6b,
0x73,0x12,0x16,0x0a,0x06,0x4f,0x70,0x4d,0x6f,0x64,
0x65,0x18,0x04,0x20,0x01,0x28,0x09,0x52,0x06,0x4f,
0x70,0x4d,0x6f,0x64,0x65,0x22,0xd8,0x01,0x0a,0x1a,
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,0x12,0x22,0x0a,0x0c,
0x4a,0x6f,0x79,0x73,0x74,0x69,0x63,0x6b,0x4e,0x61,
0x6d,0x65,0x18,0x01,0x20,0x01,0x28,0x09,0x52,0x0c,
0x4a,0x6f,0x79,0x73,0x74,0x69,0x63,0x6b,0x4e,0x61,
0x6d,0x65,0x12,0x1c,0x0a,0x09,0x41,0x78,0x69,0x73,
0x54,0x79,0x70,0x65,0x73,0x18,0x02,0x20,0x03,0x28,
0x05,0x52,0x09,0x41,0x78,0x69,0x73,0x54,0x79,0x70,
0x65,0x73,0x12,0x16,0x0a,0x06,0x49,0x73,0x58,0x62,
0x6f,0x78,0x18,0x03,0x20,0x01,0x28,0x08,0x52,0x06,
0x49,0x73,0x58,0x62,0x6f,0x78,0x12,0x22,0x0a,0x0c,
0x4a,0x6f,0x79,0x73,0x74,0x69,0x63,0x6b,0x54,0x79,
0x70,0x65,0x18,0x04,0x20,0x01,0x28,0x05,0x52,0x0c,
0x4a,0x6f,0x79,0x73,0x74,0x69,0x63,0x6b,0x54,0x79,
0x70,0x65,0x12,0x20,0x0a,0x0b,0x42,0x75,0x74,0x74,
0x6f,0x6e,0x43,0x6f,0x75,0x6e,0x74,0x18,0x05,0x20,
0x01,0x28,0x05,0x52,0x0b,0x42,0x75,0x74,0x74,0x6f,
0x6e,0x43,0x6f,0x75,0x6e,0x74,0x12,0x1a,0x0a,0x08,
0x50,0x6f,0x76,0x43,0x6f,0x75,0x6e,0x74,0x18,0x06,
0x20,0x01,0x28,0x05,0x52,0x08,0x50,0x6f,0x76,0x43,
0x6f,0x75,0x6e,0x74,0x22,0x7e,0x0a,0x1a,0x50,0x72,
0x6f,0x74,0x6f,0x62,0x75,0x66,0x4a,0x6f,0x79,0x73,
0x74,0x69,0x63,0x6b,0x4f,0x75,0x74,0x70,0x75,0x74,
0x44,0x61,0x74,0x61,0x12,0x1e,0x0a,0x0a,0x48,0x69,
0x64,0x4f,0x75,0x74,0x70,0x75,0x74,0x73,0x18,0x01,
0x20,0x01,0x28,0x07,0x52,0x0a,0x48,0x69,0x64,0x4f,
0x75,0x74,0x70,0x75,0x74,0x73,0x12,0x1e,0x0a,0x0a,
0x4c,0x65,0x66,0x74,0x52,0x75,0x6d,0x62,0x6c,0x65,
0x18,0x02,0x20,0x01,0x28,0x02,0x52,0x0a,0x4c,0x65,
0x66,0x74,0x52,0x75,0x6d,0x62,0x6c,0x65,0x12,0x20,
0x0a,0x0b,0x52,0x69,0x67,0x68,0x74,0x52,0x75,0x6d,
0x62,0x6c,0x65,0x18,0x03,0x20,0x01,0x28,0x02,0x52,
0x0b,0x52,0x69,0x67,0x68,0x74,0x52,0x75,0x6d,0x62,
0x6c,0x65,0x22,0x5f,0x0a,0x13,0x50,0x72,0x6f,0x74,
0x6f,0x62,0x75,0x66,0x56,0x65,0x72,0x73,0x69,0x6f,
0x6e,0x49,0x6e,0x66,0x6f,0x12,0x1a,0x0a,0x08,0x44,
0x65,0x76,0x69,0x63,0x65,0x49,0x64,0x18,0x01,0x20,
0x01,0x28,0x07,0x52,0x08,0x44,0x65,0x76,0x69,0x63,
0x65,0x49,0x64,0x12,0x12,0x0a,0x04,0x4e,0x61,0x6d,
0x65,0x18,0x02,0x20,0x01,0x28,0x09,0x52,0x04,0x4e,
0x61,0x6d,0x65,0x12,0x18,0x0a,0x07,0x56,0x65,0x72,
0x73,0x69,0x6f,0x6e,0x18,0x03,0x20,0x01,0x28,0x09,
0x52,0x07,0x56,0x65,0x72,0x73,0x69,0x6f,0x6e,0x22,
0x2e,0x70,0x72,0x6f,0x74,0x6f,0x22,0x96,0x01,0x0a,
0x14,0x50,0x72,0x6f,0x74,0x6f,0x62,0x75,0x66,0x4a,
0x6f,0x79,0x73,0x74,0x69,0x63,0x6b,0x44,0x61,0x74,
0x61,0x12,0x20,0x0a,0x0b,0x42,0x75,0x74,0x74,0x6f,
0x6e,0x43,0x6f,0x75,0x6e,0x74,0x18,0x01,0x20,0x01,
0x28,0x0d,0x52,0x0b,0x42,0x75,0x74,0x74,0x6f,0x6e,
0x43,0x6f,0x75,0x6e,0x74,0x12,0x18,0x0a,0x07,0x42,
0x75,0x74,0x74,0x6f,0x6e,0x73,0x18,0x02,0x20,0x01,
0x28,0x07,0x52,0x07,0x42,0x75,0x74,0x74,0x6f,0x6e,
0x73,0x12,0x12,0x0a,0x04,0x41,0x78,0x65,0x73,0x18,
0x03,0x20,0x03,0x28,0x11,0x52,0x04,0x41,0x78,0x65,
0x73,0x12,0x1a,0x0a,0x08,0x50,0x4f,0x56,0x43,0x6f,
0x75,0x6e,0x74,0x18,0x04,0x20,0x01,0x28,0x0d,0x52,
0x08,0x50,0x4f,0x56,0x43,0x6f,0x75,0x6e,0x74,0x12,
0x12,0x0a,0x04,0x50,0x4f,0x56,0x73,0x18,0x05,0x20,
0x01,0x28,0x0d,0x52,0x04,0x50,0x4f,0x56,0x73,0x22,
0xba,0x01,0x0a,0x13,0x50,0x72,0x6f,0x74,0x6f,0x62,
0x75,0x66,0x43,0x6f,0x6e,0x74,0x72,0x6f,0x6c,0x44,
0x61,0x74,0x61,0x12,0x20,0x0a,0x0b,0x43,0x6f,0x6e,
0x74,0x72,0x6f,0x6c,0x57,0x6f,0x72,0x64,0x18,0x01,
0x20,0x01,0x28,0x0d,0x52,0x0b,0x43,0x6f,0x6e,0x74,
0x72,0x6f,0x6c,0x57,0x6f,0x72,0x64,0x12,0x1c,0x0a,
0x09,0x4d,0x61,0x74,0x63,0x68,0x54,0x69,0x6d,0x65,
0x18,0x02,0x20,0x01,0x28,0x05,0x52,0x09,0x4d,0x61,
0x74,0x63,0x68,0x54,0x69,0x6d,0x65,0x12,0x3d,0x0a,
0x09,0x4a,0x6f,0x79,0x73,0x74,0x69,0x63,0x6b,0x73,
0x18,0x03,0x20,0x03,0x28,0x0b,0x32,0x1f,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,0x61,0x74,0x61,0x52,
0x09,0x4a,0x6f,0x79,0x73,0x74,0x69,0x63,0x6b,0x73,
0x12,0x24,0x0a,0x0d,0x43,0x75,0x72,0x72,0x65,0x6e,
0x74,0x4f,0x70,0x4d,0x6f,0x64,0x65,0x18,0x04,0x20,
0x01,0x28,0x06,0x52,0x0d,0x43,0x75,0x72,0x72,0x65,
0x6e,0x74,0x4f,0x70,0x4d,0x6f,0x64,0x65,0x22,0x80,
0x02,0x0a,0x1a,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,0x12,
0x22,0x0a,0x0c,0x4a,0x6f,0x79,0x73,0x74,0x69,0x63,
0x6b,0x4e,0x61,0x6d,0x65,0x18,0x01,0x20,0x01,0x28,
0x09,0x52,0x0c,0x4a,0x6f,0x79,0x73,0x74,0x69,0x63,
0x6b,0x4e,0x61,0x6d,0x65,0x12,0x1c,0x0a,0x09,0x41,
0x78,0x69,0x73,0x54,0x79,0x70,0x65,0x73,0x18,0x02,
0x20,0x03,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,0x70,0x61,0x64,0x12,0x22,0x0a,0x0c,0x4a,
0x6f,0x79,0x73,0x74,0x69,0x63,0x6b,0x54,0x79,0x70,
0x65,0x18,0x04,0x20,0x01,0x28,0x05,0x52,0x0c,0x4a,
0x6f,0x79,0x73,0x74,0x69,0x63,0x6b,0x54,0x79,0x70,
0x65,0x12,0x20,0x0a,0x0b,0x42,0x75,0x74,0x74,0x6f,
0x6e,0x43,0x6f,0x75,0x6e,0x74,0x18,0x05,0x20,0x01,
0x28,0x05,0x52,0x0b,0x42,0x75,0x74,0x74,0x6f,0x6e,
0x43,0x6f,0x75,0x6e,0x74,0x12,0x1a,0x0a,0x08,0x50,
0x6f,0x76,0x43,0x6f,0x75,0x6e,0x74,0x18,0x06,0x20,
0x01,0x28,0x05,0x52,0x08,0x50,0x6f,0x76,0x43,0x6f,
0x75,0x6e,0x74,0x12,0x20,0x0a,0x0b,0x52,0x75,0x6d,
0x62,0x6c,0x65,0x43,0x6f,0x75,0x6e,0x74,0x18,0x07,
0x20,0x01,0x28,0x05,0x52,0x0b,0x52,0x75,0x6d,0x62,
0x6c,0x65,0x43,0x6f,0x75,0x6e,0x74,0x22,0x32,0x0a,
0x1a,0x50,0x72,0x6f,0x74,0x6f,0x62,0x75,0x66,0x4a,
0x6f,0x79,0x73,0x74,0x69,0x63,0x6b,0x52,0x75,0x6d,
0x62,0x6c,0x65,0x44,0x61,0x74,0x61,0x12,0x14,0x0a,
0x05,0x56,0x61,0x6c,0x75,0x65,0x18,0x03,0x20,0x03,
0x28,0x0d,0x52,0x05,0x56,0x61,0x6c,0x75,0x65,0x22,
0x95,0x01,0x0a,0x11,0x50,0x72,0x6f,0x74,0x6f,0x62,
0x75,0x66,0x4d,0x61,0x74,0x63,0x68,0x49,0x6e,0x66,
0x6f,0x12,0x1c,0x0a,0x09,0x45,0x76,0x65,0x6e,0x74,
@@ -120,196 +111,219 @@ static const uint8_t file_descriptor[] {
0x69,0x6f,0x6e,0x12,0x1c,0x0a,0x09,0x43,0x61,0x6c,
0x6c,0x53,0x74,0x61,0x63,0x6b,0x18,0x05,0x20,0x01,
0x28,0x09,0x52,0x09,0x43,0x61,0x6c,0x6c,0x53,0x74,
0x61,0x63,0x6b,0x42,0x0f,0x0a,0x0d,0x63,0x6f,0x6d,
0x2e,0x6d,0x72,0x63,0x2e,0x70,0x72,0x6f,0x74,0x6f,
0x4a,0xcc,0x0e,0x0a,0x06,0x12,0x04,0x00,0x00,0x36,
0x01,0x0a,0x08,0x0a,0x01,0x0c,0x12,0x03,0x00,0x00,
0x12,0x0a,0x08,0x0a,0x01,0x02,0x12,0x03,0x02,0x00,
0x12,0x0a,0x08,0x0a,0x01,0x08,0x12,0x03,0x04,0x00,
0x26,0x0a,0x09,0x0a,0x02,0x08,0x01,0x12,0x03,0x04,
0x00,0x26,0x0a,0x0a,0x0a,0x02,0x04,0x00,0x12,0x04,
0x06,0x00,0x0b,0x01,0x0a,0x0a,0x0a,0x03,0x04,0x00,
0x01,0x12,0x03,0x06,0x08,0x1c,0x0a,0x0b,0x0a,0x04,
0x04,0x00,0x02,0x00,0x12,0x03,0x07,0x04,0x1b,0x0a,
0x0c,0x0a,0x05,0x04,0x00,0x02,0x00,0x05,0x12,0x03,
0x07,0x04,0x0a,0x0a,0x0c,0x0a,0x05,0x04,0x00,0x02,
0x00,0x01,0x12,0x03,0x07,0x0b,0x16,0x0a,0x0c,0x0a,
0x05,0x04,0x00,0x02,0x00,0x03,0x12,0x03,0x07,0x19,
0x1a,0x0a,0x0b,0x0a,0x04,0x04,0x00,0x02,0x01,0x12,
0x03,0x08,0x04,0x18,0x0a,0x0c,0x0a,0x05,0x04,0x00,
0x02,0x01,0x05,0x12,0x03,0x08,0x04,0x0b,0x0a,0x0c,
0x0a,0x05,0x04,0x00,0x02,0x01,0x01,0x12,0x03,0x08,
0x0c,0x13,0x0a,0x0c,0x0a,0x05,0x04,0x00,0x02,0x01,
0x03,0x12,0x03,0x08,0x16,0x17,0x0a,0x0b,0x0a,0x04,
0x04,0x00,0x02,0x02,0x12,0x03,0x09,0x04,0x1c,0x0a,
0x0c,0x0a,0x05,0x04,0x00,0x02,0x02,0x04,0x12,0x03,
0x09,0x04,0x0c,0x0a,0x0c,0x0a,0x05,0x04,0x00,0x02,
0x02,0x05,0x12,0x03,0x09,0x0d,0x12,0x0a,0x0c,0x0a,
0x05,0x04,0x00,0x02,0x02,0x01,0x12,0x03,0x09,0x13,
0x17,0x0a,0x0c,0x0a,0x05,0x04,0x00,0x02,0x02,0x03,
0x12,0x03,0x09,0x1a,0x1b,0x0a,0x0b,0x0a,0x04,0x04,
0x00,0x02,0x03,0x12,0x03,0x0a,0x04,0x1d,0x0a,0x0c,
0x0a,0x05,0x04,0x00,0x02,0x03,0x04,0x12,0x03,0x0a,
0x04,0x0c,0x0a,0x0c,0x0a,0x05,0x04,0x00,0x02,0x03,
0x05,0x12,0x03,0x0a,0x0d,0x13,0x0a,0x0c,0x0a,0x05,
0x04,0x00,0x02,0x03,0x01,0x12,0x03,0x0a,0x14,0x18,
0x0a,0x0c,0x0a,0x05,0x04,0x00,0x02,0x03,0x03,0x12,
0x03,0x0a,0x1b,0x1c,0x0a,0x0a,0x0a,0x02,0x04,0x01,
0x12,0x04,0x0d,0x00,0x12,0x01,0x0a,0x0a,0x0a,0x03,
0x04,0x01,0x01,0x12,0x03,0x0d,0x08,0x1b,0x0a,0x0b,
0x0a,0x04,0x04,0x01,0x02,0x00,0x12,0x03,0x0e,0x04,
0x1b,0x0a,0x0c,0x0a,0x05,0x04,0x01,0x02,0x00,0x05,
0x12,0x03,0x0e,0x04,0x0a,0x0a,0x0c,0x0a,0x05,0x04,
0x01,0x02,0x00,0x01,0x12,0x03,0x0e,0x0b,0x16,0x0a,
0x0c,0x0a,0x05,0x04,0x01,0x02,0x00,0x03,0x12,0x03,
0x0e,0x19,0x1a,0x0a,0x0b,0x0a,0x04,0x04,0x01,0x02,
0x01,0x12,0x03,0x0f,0x04,0x18,0x0a,0x0c,0x0a,0x05,
0x04,0x01,0x02,0x01,0x05,0x12,0x03,0x0f,0x04,0x09,
0x0a,0x0c,0x0a,0x05,0x04,0x01,0x02,0x01,0x01,0x12,
0x03,0x0f,0x0a,0x13,0x0a,0x0c,0x0a,0x05,0x04,0x01,
0x02,0x01,0x03,0x12,0x03,0x0f,0x16,0x17,0x0a,0x0b,
0x0a,0x04,0x04,0x01,0x02,0x02,0x12,0x03,0x10,0x04,
0x30,0x0a,0x0c,0x0a,0x05,0x04,0x01,0x02,0x02,0x04,
0x12,0x03,0x10,0x04,0x0c,0x0a,0x0c,0x0a,0x05,0x04,
0x01,0x02,0x02,0x06,0x12,0x03,0x10,0x0d,0x21,0x0a,
0x0c,0x0a,0x05,0x04,0x01,0x02,0x02,0x01,0x12,0x03,
0x10,0x22,0x2b,0x0a,0x0c,0x0a,0x05,0x04,0x01,0x02,
0x02,0x03,0x12,0x03,0x10,0x2e,0x2f,0x0a,0x0b,0x0a,
0x04,0x04,0x01,0x02,0x03,0x12,0x03,0x11,0x04,0x16,
0x0a,0x0c,0x0a,0x05,0x04,0x01,0x02,0x03,0x05,0x12,
0x03,0x11,0x04,0x0a,0x0a,0x0c,0x0a,0x05,0x04,0x01,
0x02,0x03,0x01,0x12,0x03,0x11,0x0b,0x11,0x0a,0x0c,
0x0a,0x05,0x04,0x01,0x02,0x03,0x03,0x12,0x03,0x11,
0x14,0x15,0x0a,0x0a,0x0a,0x02,0x04,0x02,0x12,0x04,
0x14,0x00,0x1b,0x01,0x0a,0x0a,0x0a,0x03,0x04,0x02,
0x01,0x12,0x03,0x14,0x08,0x22,0x0a,0x0b,0x0a,0x04,
0x04,0x02,0x02,0x00,0x12,0x03,0x15,0x04,0x1c,0x0a,
0x0c,0x0a,0x05,0x04,0x02,0x02,0x00,0x05,0x12,0x03,
0x15,0x04,0x0a,0x0a,0x0c,0x0a,0x05,0x04,0x02,0x02,
0x00,0x01,0x12,0x03,0x15,0x0b,0x17,0x0a,0x0c,0x0a,
0x05,0x04,0x02,0x02,0x00,0x03,0x12,0x03,0x15,0x1a,
0x1b,0x0a,0x0b,0x0a,0x04,0x04,0x02,0x02,0x01,0x12,
0x03,0x16,0x04,0x21,0x0a,0x0c,0x0a,0x05,0x04,0x02,
0x02,0x01,0x04,0x12,0x03,0x16,0x04,0x0c,0x0a,0x0c,
0x0a,0x05,0x04,0x02,0x02,0x01,0x05,0x12,0x03,0x16,
0x0d,0x12,0x0a,0x0c,0x0a,0x05,0x04,0x02,0x02,0x01,
0x01,0x12,0x03,0x16,0x13,0x1c,0x0a,0x0c,0x0a,0x05,
0x04,0x02,0x02,0x01,0x03,0x12,0x03,0x16,0x1f,0x20,
0x0a,0x0b,0x0a,0x04,0x04,0x02,0x02,0x02,0x12,0x03,
0x17,0x04,0x14,0x0a,0x0c,0x0a,0x05,0x04,0x02,0x02,
0x02,0x05,0x12,0x03,0x17,0x04,0x08,0x0a,0x0c,0x0a,
0x05,0x04,0x02,0x02,0x02,0x01,0x12,0x03,0x17,0x09,
0x0f,0x0a,0x0c,0x0a,0x05,0x04,0x02,0x02,0x02,0x03,
0x12,0x03,0x17,0x12,0x13,0x0a,0x0b,0x0a,0x04,0x04,
0x02,0x02,0x03,0x12,0x03,0x18,0x04,0x1b,0x0a,0x0c,
0x0a,0x05,0x04,0x02,0x02,0x03,0x05,0x12,0x03,0x18,
0x04,0x09,0x0a,0x0c,0x0a,0x05,0x04,0x02,0x02,0x03,
0x01,0x12,0x03,0x18,0x0a,0x16,0x0a,0x0c,0x0a,0x05,
0x04,0x02,0x02,0x03,0x03,0x12,0x03,0x18,0x19,0x1a,
0x0a,0x0b,0x0a,0x04,0x04,0x02,0x02,0x04,0x12,0x03,
0x19,0x04,0x1a,0x0a,0x0c,0x0a,0x05,0x04,0x02,0x02,
0x04,0x05,0x12,0x03,0x19,0x04,0x09,0x0a,0x0c,0x0a,
0x05,0x04,0x02,0x02,0x04,0x01,0x12,0x03,0x19,0x0a,
0x15,0x0a,0x0c,0x0a,0x05,0x04,0x02,0x02,0x04,0x03,
0x12,0x03,0x19,0x18,0x19,0x0a,0x0b,0x0a,0x04,0x04,
0x02,0x02,0x05,0x12,0x03,0x1a,0x04,0x17,0x0a,0x0c,
0x0a,0x05,0x04,0x02,0x02,0x05,0x05,0x12,0x03,0x1a,
0x04,0x09,0x0a,0x0c,0x0a,0x05,0x04,0x02,0x02,0x05,
0x01,0x12,0x03,0x1a,0x0a,0x12,0x0a,0x0c,0x0a,0x05,
0x04,0x02,0x02,0x05,0x03,0x12,0x03,0x1a,0x15,0x16,
0x0a,0x0a,0x0a,0x02,0x04,0x03,0x12,0x04,0x1d,0x00,
0x21,0x01,0x0a,0x0a,0x0a,0x03,0x04,0x03,0x01,0x12,
0x03,0x1d,0x08,0x22,0x0a,0x0b,0x0a,0x04,0x04,0x03,
0x02,0x00,0x12,0x03,0x1e,0x04,0x1b,0x0a,0x0c,0x0a,
0x05,0x04,0x03,0x02,0x00,0x05,0x12,0x03,0x1e,0x04,
0x0b,0x0a,0x0c,0x0a,0x05,0x04,0x03,0x02,0x00,0x01,
0x12,0x03,0x1e,0x0c,0x16,0x0a,0x0c,0x0a,0x05,0x04,
0x03,0x02,0x00,0x03,0x12,0x03,0x1e,0x19,0x1a,0x0a,
0x0b,0x0a,0x04,0x04,0x03,0x02,0x01,0x12,0x03,0x1f,
0x04,0x19,0x0a,0x0c,0x0a,0x05,0x04,0x03,0x02,0x01,
0x05,0x12,0x03,0x1f,0x04,0x09,0x0a,0x0c,0x0a,0x05,
0x04,0x03,0x02,0x01,0x01,0x12,0x03,0x1f,0x0a,0x14,
0x0a,0x0c,0x0a,0x05,0x04,0x03,0x02,0x01,0x03,0x12,
0x03,0x1f,0x17,0x18,0x0a,0x0b,0x0a,0x04,0x04,0x03,
0x02,0x02,0x12,0x03,0x20,0x04,0x1a,0x0a,0x0c,0x0a,
0x05,0x04,0x03,0x02,0x02,0x05,0x12,0x03,0x20,0x04,
0x09,0x0a,0x0c,0x0a,0x05,0x04,0x03,0x02,0x02,0x01,
0x12,0x03,0x20,0x0a,0x15,0x0a,0x0c,0x0a,0x05,0x04,
0x03,0x02,0x02,0x03,0x12,0x03,0x20,0x18,0x19,0x0a,
0x0a,0x0a,0x02,0x04,0x04,0x12,0x04,0x23,0x00,0x27,
0x01,0x0a,0x0a,0x0a,0x03,0x04,0x04,0x01,0x12,0x03,
0x23,0x08,0x1b,0x0a,0x0b,0x0a,0x04,0x04,0x04,0x02,
0x00,0x12,0x03,0x24,0x04,0x19,0x0a,0x0c,0x0a,0x05,
0x04,0x04,0x02,0x00,0x05,0x12,0x03,0x24,0x04,0x0b,
0x0a,0x0c,0x0a,0x05,0x04,0x04,0x02,0x00,0x01,0x12,
0x03,0x24,0x0c,0x14,0x0a,0x0c,0x0a,0x05,0x04,0x04,
0x02,0x00,0x03,0x12,0x03,0x24,0x17,0x18,0x0a,0x0b,
0x0a,0x04,0x04,0x04,0x02,0x01,0x12,0x03,0x25,0x04,
0x14,0x0a,0x0c,0x0a,0x05,0x04,0x04,0x02,0x01,0x05,
0x12,0x03,0x25,0x04,0x0a,0x0a,0x0c,0x0a,0x05,0x04,
0x04,0x02,0x01,0x01,0x12,0x03,0x25,0x0b,0x0f,0x0a,
0x0c,0x0a,0x05,0x04,0x04,0x02,0x01,0x03,0x12,0x03,
0x25,0x12,0x13,0x0a,0x0b,0x0a,0x04,0x04,0x04,0x02,
0x02,0x12,0x03,0x26,0x04,0x17,0x0a,0x0c,0x0a,0x05,
0x04,0x04,0x02,0x02,0x05,0x12,0x03,0x26,0x04,0x0a,
0x0a,0x0c,0x0a,0x05,0x04,0x04,0x02,0x02,0x01,0x12,
0x03,0x26,0x0b,0x12,0x0a,0x0c,0x0a,0x05,0x04,0x04,
0x02,0x02,0x03,0x12,0x03,0x26,0x15,0x16,0x0a,0x0a,
0x0a,0x02,0x04,0x05,0x12,0x04,0x29,0x00,0x2e,0x01,
0x0a,0x0a,0x0a,0x03,0x04,0x05,0x01,0x12,0x03,0x29,
0x08,0x19,0x0a,0x0b,0x0a,0x04,0x04,0x05,0x02,0x00,
0x12,0x03,0x2a,0x04,0x19,0x0a,0x0c,0x0a,0x05,0x04,
0x05,0x02,0x00,0x05,0x12,0x03,0x2a,0x04,0x0a,0x0a,
0x0c,0x0a,0x05,0x04,0x05,0x02,0x00,0x01,0x12,0x03,
0x2a,0x0b,0x14,0x0a,0x0c,0x0a,0x05,0x04,0x05,0x02,
0x00,0x03,0x12,0x03,0x2a,0x17,0x18,0x0a,0x0b,0x0a,
0x04,0x04,0x05,0x02,0x01,0x12,0x03,0x2b,0x04,0x1a,
0x0a,0x0c,0x0a,0x05,0x04,0x05,0x02,0x01,0x05,0x12,
0x03,0x2b,0x04,0x09,0x0a,0x0c,0x0a,0x05,0x04,0x05,
0x02,0x01,0x01,0x12,0x03,0x2b,0x0a,0x15,0x0a,0x0c,
0x0a,0x05,0x04,0x05,0x02,0x01,0x03,0x12,0x03,0x2b,
0x18,0x19,0x0a,0x0b,0x0a,0x04,0x04,0x05,0x02,0x02,
0x12,0x03,0x2c,0x04,0x1b,0x0a,0x0c,0x0a,0x05,0x04,
0x05,0x02,0x02,0x05,0x12,0x03,0x2c,0x04,0x09,0x0a,
0x0c,0x0a,0x05,0x04,0x05,0x02,0x02,0x01,0x12,0x03,
0x2c,0x0a,0x16,0x0a,0x0c,0x0a,0x05,0x04,0x05,0x02,
0x02,0x03,0x12,0x03,0x2c,0x19,0x1a,0x0a,0x0b,0x0a,
0x04,0x04,0x05,0x02,0x03,0x12,0x03,0x2d,0x04,0x18,
0x0a,0x0c,0x0a,0x05,0x04,0x05,0x02,0x03,0x05,0x12,
0x03,0x2d,0x04,0x09,0x0a,0x0c,0x0a,0x05,0x04,0x05,
0x02,0x03,0x01,0x12,0x03,0x2d,0x0a,0x13,0x0a,0x0c,
0x0a,0x05,0x04,0x05,0x02,0x03,0x03,0x12,0x03,0x2d,
0x16,0x17,0x0a,0x0a,0x0a,0x02,0x04,0x06,0x12,0x04,
0x30,0x00,0x36,0x01,0x0a,0x0a,0x0a,0x03,0x04,0x06,
0x01,0x12,0x03,0x30,0x08,0x19,0x0a,0x0b,0x0a,0x04,
0x04,0x06,0x02,0x00,0x12,0x03,0x31,0x04,0x15,0x0a,
0x0c,0x0a,0x05,0x04,0x06,0x02,0x00,0x05,0x12,0x03,
0x31,0x04,0x08,0x0a,0x0c,0x0a,0x05,0x04,0x06,0x02,
0x00,0x01,0x12,0x03,0x31,0x09,0x10,0x0a,0x0c,0x0a,
0x05,0x04,0x06,0x02,0x00,0x03,0x12,0x03,0x31,0x13,
0x14,0x0a,0x0b,0x0a,0x04,0x04,0x06,0x02,0x01,0x12,
0x03,0x32,0x04,0x19,0x0a,0x0c,0x0a,0x05,0x04,0x06,
0x02,0x01,0x05,0x12,0x03,0x32,0x04,0x0a,0x0a,0x0c,
0x0a,0x05,0x04,0x06,0x02,0x01,0x01,0x12,0x03,0x32,
0x0b,0x14,0x0a,0x0c,0x0a,0x05,0x04,0x06,0x02,0x01,
0x03,0x12,0x03,0x32,0x17,0x18,0x0a,0x0b,0x0a,0x04,
0x04,0x06,0x02,0x02,0x12,0x03,0x33,0x04,0x17,0x0a,
0x0c,0x0a,0x05,0x04,0x06,0x02,0x02,0x05,0x12,0x03,
0x33,0x04,0x0a,0x0a,0x0c,0x0a,0x05,0x04,0x06,0x02,
0x02,0x01,0x12,0x03,0x33,0x0b,0x12,0x0a,0x0c,0x0a,
0x05,0x04,0x06,0x02,0x02,0x03,0x12,0x03,0x33,0x15,
0x16,0x0a,0x0b,0x0a,0x04,0x04,0x06,0x02,0x03,0x12,
0x03,0x34,0x04,0x18,0x0a,0x0c,0x0a,0x05,0x04,0x06,
0x02,0x03,0x05,0x12,0x03,0x34,0x04,0x0a,0x0a,0x0c,
0x0a,0x05,0x04,0x06,0x02,0x03,0x01,0x12,0x03,0x34,
0x0b,0x13,0x0a,0x0c,0x0a,0x05,0x04,0x06,0x02,0x03,
0x03,0x12,0x03,0x34,0x16,0x17,0x0a,0x0b,0x0a,0x04,
0x04,0x06,0x02,0x04,0x12,0x03,0x35,0x04,0x19,0x0a,
0x0c,0x0a,0x05,0x04,0x06,0x02,0x04,0x05,0x12,0x03,
0x35,0x04,0x0a,0x0a,0x0c,0x0a,0x05,0x04,0x06,0x02,
0x04,0x01,0x12,0x03,0x35,0x0b,0x14,0x0a,0x0c,0x0a,
0x05,0x04,0x06,0x02,0x04,0x03,0x12,0x03,0x35,0x17,
0x18,0x62,0x06,0x70,0x72,0x6f,0x74,0x6f,0x33,
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,0x42,0x0f,
0x0a,0x0d,0x63,0x6f,0x6d,0x2e,0x6d,0x72,0x63,0x2e,
0x70,0x72,0x6f,0x74,0x6f,0x4a,0xa5,0x0f,0x0a,0x06,
0x12,0x04,0x00,0x00,0x3b,0x01,0x0a,0x08,0x0a,0x01,
0x0c,0x12,0x03,0x00,0x00,0x12,0x0a,0x08,0x0a,0x01,
0x02,0x12,0x03,0x02,0x00,0x12,0x0a,0x08,0x0a,0x01,
0x08,0x12,0x03,0x04,0x00,0x26,0x0a,0x09,0x0a,0x02,
0x08,0x01,0x12,0x03,0x04,0x00,0x26,0x0a,0x0a,0x0a,
0x02,0x04,0x00,0x12,0x04,0x06,0x00,0x0e,0x01,0x0a,
0x0a,0x0a,0x03,0x04,0x00,0x01,0x12,0x03,0x06,0x08,
0x1c,0x0a,0x0b,0x0a,0x04,0x04,0x00,0x02,0x00,0x12,
0x03,0x07,0x04,0x1b,0x0a,0x0c,0x0a,0x05,0x04,0x00,
0x02,0x00,0x05,0x12,0x03,0x07,0x04,0x0a,0x0a,0x0c,
0x0a,0x05,0x04,0x00,0x02,0x00,0x01,0x12,0x03,0x07,
0x0b,0x16,0x0a,0x0c,0x0a,0x05,0x04,0x00,0x02,0x00,
0x03,0x12,0x03,0x07,0x19,0x1a,0x0a,0x0b,0x0a,0x04,
0x04,0x00,0x02,0x01,0x12,0x03,0x08,0x04,0x18,0x0a,
0x0c,0x0a,0x05,0x04,0x00,0x02,0x01,0x05,0x12,0x03,
0x08,0x04,0x0b,0x0a,0x0c,0x0a,0x05,0x04,0x00,0x02,
0x01,0x01,0x12,0x03,0x08,0x0c,0x13,0x0a,0x0c,0x0a,
0x05,0x04,0x00,0x02,0x01,0x03,0x12,0x03,0x08,0x16,
0x17,0x0a,0x0b,0x0a,0x04,0x04,0x00,0x02,0x02,0x12,
0x03,0x09,0x04,0x1d,0x0a,0x0c,0x0a,0x05,0x04,0x00,
0x02,0x02,0x04,0x12,0x03,0x09,0x04,0x0c,0x0a,0x0c,
0x0a,0x05,0x04,0x00,0x02,0x02,0x05,0x12,0x03,0x09,
0x0d,0x13,0x0a,0x0c,0x0a,0x05,0x04,0x00,0x02,0x02,
0x01,0x12,0x03,0x09,0x14,0x18,0x0a,0x0c,0x0a,0x05,
0x04,0x00,0x02,0x02,0x03,0x12,0x03,0x09,0x1b,0x1c,
0x0a,0x3e,0x0a,0x04,0x04,0x00,0x02,0x03,0x12,0x03,
0x0c,0x04,0x18,0x1a,0x31,0x20,0x45,0x61,0x63,0x68,
0x20,0x50,0x4f,0x56,0x20,0x74,0x61,0x6b,0x65,0x73,
0x20,0x75,0x70,0x20,0x34,0x20,0x62,0x69,0x74,0x73,
0x0a,0x20,0x57,0x65,0x20,0x63,0x61,0x6e,0x20,0x66,
0x69,0x74,0x20,0x38,0x20,0x69,0x6e,0x20,0x68,0x65,
0x72,0x65,0x2e,0x0a,0x0a,0x0c,0x0a,0x05,0x04,0x00,
0x02,0x03,0x05,0x12,0x03,0x0c,0x04,0x0a,0x0a,0x0c,
0x0a,0x05,0x04,0x00,0x02,0x03,0x01,0x12,0x03,0x0c,
0x0b,0x13,0x0a,0x0c,0x0a,0x05,0x04,0x00,0x02,0x03,
0x03,0x12,0x03,0x0c,0x16,0x17,0x0a,0x0b,0x0a,0x04,
0x04,0x00,0x02,0x04,0x12,0x03,0x0d,0x04,0x14,0x0a,
0x0c,0x0a,0x05,0x04,0x00,0x02,0x04,0x05,0x12,0x03,
0x0d,0x04,0x0a,0x0a,0x0c,0x0a,0x05,0x04,0x00,0x02,
0x04,0x01,0x12,0x03,0x0d,0x0b,0x0f,0x0a,0x0c,0x0a,
0x05,0x04,0x00,0x02,0x04,0x03,0x12,0x03,0x0d,0x12,
0x13,0x0a,0x0a,0x0a,0x02,0x04,0x01,0x12,0x04,0x10,
0x00,0x15,0x01,0x0a,0x0a,0x0a,0x03,0x04,0x01,0x01,
0x12,0x03,0x10,0x08,0x1b,0x0a,0x0b,0x0a,0x04,0x04,
0x01,0x02,0x00,0x12,0x03,0x11,0x04,0x1b,0x0a,0x0c,
0x0a,0x05,0x04,0x01,0x02,0x00,0x05,0x12,0x03,0x11,
0x04,0x0a,0x0a,0x0c,0x0a,0x05,0x04,0x01,0x02,0x00,
0x01,0x12,0x03,0x11,0x0b,0x16,0x0a,0x0c,0x0a,0x05,
0x04,0x01,0x02,0x00,0x03,0x12,0x03,0x11,0x19,0x1a,
0x0a,0x0b,0x0a,0x04,0x04,0x01,0x02,0x01,0x12,0x03,
0x12,0x04,0x18,0x0a,0x0c,0x0a,0x05,0x04,0x01,0x02,
0x01,0x05,0x12,0x03,0x12,0x04,0x09,0x0a,0x0c,0x0a,
0x05,0x04,0x01,0x02,0x01,0x01,0x12,0x03,0x12,0x0a,
0x13,0x0a,0x0c,0x0a,0x05,0x04,0x01,0x02,0x01,0x03,
0x12,0x03,0x12,0x16,0x17,0x0a,0x0b,0x0a,0x04,0x04,
0x01,0x02,0x02,0x12,0x03,0x13,0x04,0x30,0x0a,0x0c,
0x0a,0x05,0x04,0x01,0x02,0x02,0x04,0x12,0x03,0x13,
0x04,0x0c,0x0a,0x0c,0x0a,0x05,0x04,0x01,0x02,0x02,
0x06,0x12,0x03,0x13,0x0d,0x21,0x0a,0x0c,0x0a,0x05,
0x04,0x01,0x02,0x02,0x01,0x12,0x03,0x13,0x22,0x2b,
0x0a,0x0c,0x0a,0x05,0x04,0x01,0x02,0x02,0x03,0x12,
0x03,0x13,0x2e,0x2f,0x0a,0x0b,0x0a,0x04,0x04,0x01,
0x02,0x03,0x12,0x03,0x14,0x04,0x1e,0x0a,0x0c,0x0a,
0x05,0x04,0x01,0x02,0x03,0x05,0x12,0x03,0x14,0x04,
0x0b,0x0a,0x0c,0x0a,0x05,0x04,0x01,0x02,0x03,0x01,
0x12,0x03,0x14,0x0c,0x19,0x0a,0x0c,0x0a,0x05,0x04,
0x01,0x02,0x03,0x03,0x12,0x03,0x14,0x1c,0x1d,0x0a,
0x0a,0x0a,0x02,0x04,0x02,0x12,0x04,0x17,0x00,0x1f,
0x01,0x0a,0x0a,0x0a,0x03,0x04,0x02,0x01,0x12,0x03,
0x17,0x08,0x22,0x0a,0x0b,0x0a,0x04,0x04,0x02,0x02,
0x00,0x12,0x03,0x18,0x04,0x1c,0x0a,0x0c,0x0a,0x05,
0x04,0x02,0x02,0x00,0x05,0x12,0x03,0x18,0x04,0x0a,
0x0a,0x0c,0x0a,0x05,0x04,0x02,0x02,0x00,0x01,0x12,
0x03,0x18,0x0b,0x17,0x0a,0x0c,0x0a,0x05,0x04,0x02,
0x02,0x00,0x03,0x12,0x03,0x18,0x1a,0x1b,0x0a,0x0b,
0x0a,0x04,0x04,0x02,0x02,0x01,0x12,0x03,0x19,0x04,
0x21,0x0a,0x0c,0x0a,0x05,0x04,0x02,0x02,0x01,0x04,
0x12,0x03,0x19,0x04,0x0c,0x0a,0x0c,0x0a,0x05,0x04,
0x02,0x02,0x01,0x05,0x12,0x03,0x19,0x0d,0x12,0x0a,
0x0c,0x0a,0x05,0x04,0x02,0x02,0x01,0x01,0x12,0x03,
0x19,0x13,0x1c,0x0a,0x0c,0x0a,0x05,0x04,0x02,0x02,
0x01,0x03,0x12,0x03,0x19,0x1f,0x20,0x0a,0x0b,0x0a,
0x04,0x04,0x02,0x02,0x02,0x12,0x03,0x1a,0x04,0x17,
0x0a,0x0c,0x0a,0x05,0x04,0x02,0x02,0x02,0x05,0x12,
0x03,0x1a,0x04,0x08,0x0a,0x0c,0x0a,0x05,0x04,0x02,
0x02,0x02,0x01,0x12,0x03,0x1a,0x09,0x12,0x0a,0x0c,
0x0a,0x05,0x04,0x02,0x02,0x02,0x03,0x12,0x03,0x1a,
0x15,0x16,0x0a,0x0b,0x0a,0x04,0x04,0x02,0x02,0x03,
0x12,0x03,0x1b,0x04,0x1b,0x0a,0x0c,0x0a,0x05,0x04,
0x02,0x02,0x03,0x05,0x12,0x03,0x1b,0x04,0x09,0x0a,
0x0c,0x0a,0x05,0x04,0x02,0x02,0x03,0x01,0x12,0x03,
0x1b,0x0a,0x16,0x0a,0x0c,0x0a,0x05,0x04,0x02,0x02,
0x03,0x03,0x12,0x03,0x1b,0x19,0x1a,0x0a,0x0b,0x0a,
0x04,0x04,0x02,0x02,0x04,0x12,0x03,0x1c,0x04,0x1a,
0x0a,0x0c,0x0a,0x05,0x04,0x02,0x02,0x04,0x05,0x12,
0x03,0x1c,0x04,0x09,0x0a,0x0c,0x0a,0x05,0x04,0x02,
0x02,0x04,0x01,0x12,0x03,0x1c,0x0a,0x15,0x0a,0x0c,
0x0a,0x05,0x04,0x02,0x02,0x04,0x03,0x12,0x03,0x1c,
0x18,0x19,0x0a,0x0b,0x0a,0x04,0x04,0x02,0x02,0x05,
0x12,0x03,0x1d,0x04,0x17,0x0a,0x0c,0x0a,0x05,0x04,
0x02,0x02,0x05,0x05,0x12,0x03,0x1d,0x04,0x09,0x0a,
0x0c,0x0a,0x05,0x04,0x02,0x02,0x05,0x01,0x12,0x03,
0x1d,0x0a,0x12,0x0a,0x0c,0x0a,0x05,0x04,0x02,0x02,
0x05,0x03,0x12,0x03,0x1d,0x15,0x16,0x0a,0x0b,0x0a,
0x04,0x04,0x02,0x02,0x06,0x12,0x03,0x1e,0x04,0x1a,
0x0a,0x0c,0x0a,0x05,0x04,0x02,0x02,0x06,0x05,0x12,
0x03,0x1e,0x04,0x09,0x0a,0x0c,0x0a,0x05,0x04,0x02,
0x02,0x06,0x01,0x12,0x03,0x1e,0x0a,0x15,0x0a,0x0c,
0x0a,0x05,0x04,0x02,0x02,0x06,0x03,0x12,0x03,0x1e,
0x18,0x19,0x0a,0x0a,0x0a,0x02,0x04,0x03,0x12,0x04,
0x21,0x00,0x23,0x01,0x0a,0x0a,0x0a,0x03,0x04,0x03,
0x01,0x12,0x03,0x21,0x08,0x22,0x0a,0x0b,0x0a,0x04,
0x04,0x03,0x02,0x00,0x12,0x03,0x22,0x04,0x1e,0x0a,
0x0c,0x0a,0x05,0x04,0x03,0x02,0x00,0x04,0x12,0x03,
0x22,0x04,0x0c,0x0a,0x0c,0x0a,0x05,0x04,0x03,0x02,
0x00,0x05,0x12,0x03,0x22,0x0d,0x13,0x0a,0x0c,0x0a,
0x05,0x04,0x03,0x02,0x00,0x01,0x12,0x03,0x22,0x14,
0x19,0x0a,0x0c,0x0a,0x05,0x04,0x03,0x02,0x00,0x03,
0x12,0x03,0x22,0x1c,0x1d,0x0a,0x0a,0x0a,0x02,0x04,
0x04,0x12,0x04,0x25,0x00,0x2a,0x01,0x0a,0x0a,0x0a,
0x03,0x04,0x04,0x01,0x12,0x03,0x25,0x08,0x19,0x0a,
0x0b,0x0a,0x04,0x04,0x04,0x02,0x00,0x12,0x03,0x26,
0x04,0x19,0x0a,0x0c,0x0a,0x05,0x04,0x04,0x02,0x00,
0x05,0x12,0x03,0x26,0x04,0x0a,0x0a,0x0c,0x0a,0x05,
0x04,0x04,0x02,0x00,0x01,0x12,0x03,0x26,0x0b,0x14,
0x0a,0x0c,0x0a,0x05,0x04,0x04,0x02,0x00,0x03,0x12,
0x03,0x26,0x17,0x18,0x0a,0x0b,0x0a,0x04,0x04,0x04,
0x02,0x01,0x12,0x03,0x27,0x04,0x1a,0x0a,0x0c,0x0a,
0x05,0x04,0x04,0x02,0x01,0x05,0x12,0x03,0x27,0x04,
0x09,0x0a,0x0c,0x0a,0x05,0x04,0x04,0x02,0x01,0x01,
0x12,0x03,0x27,0x0a,0x15,0x0a,0x0c,0x0a,0x05,0x04,
0x04,0x02,0x01,0x03,0x12,0x03,0x27,0x18,0x19,0x0a,
0x0b,0x0a,0x04,0x04,0x04,0x02,0x02,0x12,0x03,0x28,
0x04,0x1b,0x0a,0x0c,0x0a,0x05,0x04,0x04,0x02,0x02,
0x05,0x12,0x03,0x28,0x04,0x09,0x0a,0x0c,0x0a,0x05,
0x04,0x04,0x02,0x02,0x01,0x12,0x03,0x28,0x0a,0x16,
0x0a,0x0c,0x0a,0x05,0x04,0x04,0x02,0x02,0x03,0x12,
0x03,0x28,0x19,0x1a,0x0a,0x0b,0x0a,0x04,0x04,0x04,
0x02,0x03,0x12,0x03,0x29,0x04,0x18,0x0a,0x0c,0x0a,
0x05,0x04,0x04,0x02,0x03,0x05,0x12,0x03,0x29,0x04,
0x09,0x0a,0x0c,0x0a,0x05,0x04,0x04,0x02,0x03,0x01,
0x12,0x03,0x29,0x0a,0x13,0x0a,0x0c,0x0a,0x05,0x04,
0x04,0x02,0x03,0x03,0x12,0x03,0x29,0x16,0x17,0x0a,
0x0a,0x0a,0x02,0x04,0x05,0x12,0x04,0x2c,0x00,0x32,
0x01,0x0a,0x0a,0x0a,0x03,0x04,0x05,0x01,0x12,0x03,
0x2c,0x08,0x19,0x0a,0x0b,0x0a,0x04,0x04,0x05,0x02,
0x00,0x12,0x03,0x2d,0x04,0x15,0x0a,0x0c,0x0a,0x05,
0x04,0x05,0x02,0x00,0x05,0x12,0x03,0x2d,0x04,0x08,
0x0a,0x0c,0x0a,0x05,0x04,0x05,0x02,0x00,0x01,0x12,
0x03,0x2d,0x09,0x10,0x0a,0x0c,0x0a,0x05,0x04,0x05,
0x02,0x00,0x03,0x12,0x03,0x2d,0x13,0x14,0x0a,0x0b,
0x0a,0x04,0x04,0x05,0x02,0x01,0x12,0x03,0x2e,0x04,
0x19,0x0a,0x0c,0x0a,0x05,0x04,0x05,0x02,0x01,0x05,
0x12,0x03,0x2e,0x04,0x0a,0x0a,0x0c,0x0a,0x05,0x04,
0x05,0x02,0x01,0x01,0x12,0x03,0x2e,0x0b,0x14,0x0a,
0x0c,0x0a,0x05,0x04,0x05,0x02,0x01,0x03,0x12,0x03,
0x2e,0x17,0x18,0x0a,0x0b,0x0a,0x04,0x04,0x05,0x02,
0x02,0x12,0x03,0x2f,0x04,0x17,0x0a,0x0c,0x0a,0x05,
0x04,0x05,0x02,0x02,0x05,0x12,0x03,0x2f,0x04,0x0a,
0x0a,0x0c,0x0a,0x05,0x04,0x05,0x02,0x02,0x01,0x12,
0x03,0x2f,0x0b,0x12,0x0a,0x0c,0x0a,0x05,0x04,0x05,
0x02,0x02,0x03,0x12,0x03,0x2f,0x15,0x16,0x0a,0x0b,
0x0a,0x04,0x04,0x05,0x02,0x03,0x12,0x03,0x30,0x04,
0x18,0x0a,0x0c,0x0a,0x05,0x04,0x05,0x02,0x03,0x05,
0x12,0x03,0x30,0x04,0x0a,0x0a,0x0c,0x0a,0x05,0x04,
0x05,0x02,0x03,0x01,0x12,0x03,0x30,0x0b,0x13,0x0a,
0x0c,0x0a,0x05,0x04,0x05,0x02,0x03,0x03,0x12,0x03,
0x30,0x16,0x17,0x0a,0x0b,0x0a,0x04,0x04,0x05,0x02,
0x04,0x12,0x03,0x31,0x04,0x19,0x0a,0x0c,0x0a,0x05,
0x04,0x05,0x02,0x04,0x05,0x12,0x03,0x31,0x04,0x0a,
0x0a,0x0c,0x0a,0x05,0x04,0x05,0x02,0x04,0x01,0x12,
0x03,0x31,0x0b,0x14,0x0a,0x0c,0x0a,0x05,0x04,0x05,
0x02,0x04,0x03,0x12,0x03,0x31,0x17,0x18,0x0a,0x0a,
0x0a,0x02,0x04,0x06,0x12,0x04,0x34,0x00,0x37,0x01,
0x0a,0x0a,0x0a,0x03,0x04,0x06,0x01,0x12,0x03,0x34,
0x08,0x16,0x0a,0x0b,0x0a,0x04,0x04,0x06,0x02,0x00,
0x12,0x03,0x35,0x04,0x15,0x0a,0x0c,0x0a,0x05,0x04,
0x06,0x02,0x00,0x05,0x12,0x03,0x35,0x04,0x0b,0x0a,
0x0c,0x0a,0x05,0x04,0x06,0x02,0x00,0x01,0x12,0x03,
0x35,0x0c,0x10,0x0a,0x0c,0x0a,0x05,0x04,0x06,0x02,
0x00,0x03,0x12,0x03,0x35,0x13,0x14,0x0a,0x0b,0x0a,
0x04,0x04,0x06,0x02,0x01,0x12,0x03,0x36,0x04,0x14,
0x0a,0x0c,0x0a,0x05,0x04,0x06,0x02,0x01,0x05,0x12,
0x03,0x36,0x04,0x0a,0x0a,0x0c,0x0a,0x05,0x04,0x06,
0x02,0x01,0x01,0x12,0x03,0x36,0x0b,0x0f,0x0a,0x0c,
0x0a,0x05,0x04,0x06,0x02,0x01,0x03,0x12,0x03,0x36,
0x12,0x13,0x0a,0x0a,0x0a,0x02,0x04,0x07,0x12,0x04,
0x39,0x00,0x3b,0x01,0x0a,0x0a,0x0a,0x03,0x04,0x07,
0x01,0x12,0x03,0x39,0x08,0x20,0x0a,0x0b,0x0a,0x04,
0x04,0x07,0x02,0x00,0x12,0x03,0x3a,0x04,0x26,0x0a,
0x0c,0x0a,0x05,0x04,0x07,0x02,0x00,0x04,0x12,0x03,
0x3a,0x04,0x0c,0x0a,0x0c,0x0a,0x05,0x04,0x07,0x02,
0x00,0x06,0x12,0x03,0x3a,0x0d,0x1b,0x0a,0x0c,0x0a,
0x05,0x04,0x07,0x02,0x00,0x01,0x12,0x03,0x3a,0x1c,
0x21,0x0a,0x0c,0x0a,0x05,0x04,0x07,0x02,0x00,0x03,
0x12,0x03,0x3a,0x24,0x25,0x62,0x06,0x70,0x72,0x6f,
0x74,0x6f,0x33,
};
static const char file_name[] = "MrcComm.proto";
static const char mrc_proto_ProtobufJoystickData_name[] = "mrc.proto.ProtobufJoystickData";
@@ -330,16 +344,10 @@ pb_filedesc_t mrc_proto_ProtobufJoystickDescriptor::file_descriptor(void) noexce
PB_BIND(mrc_proto_ProtobufJoystickDescriptor, mrc_proto_ProtobufJoystickDescriptor, AUTO)
static const char mrc_proto_ProtobufJoystickOutputData_name[] = "mrc.proto.ProtobufJoystickOutputData";
std::string_view mrc_proto_ProtobufJoystickOutputData::msg_name(void) noexcept { return mrc_proto_ProtobufJoystickOutputData_name; }
pb_filedesc_t mrc_proto_ProtobufJoystickOutputData::file_descriptor(void) noexcept { return {::file_name, ::file_descriptor}; }
PB_BIND(mrc_proto_ProtobufJoystickOutputData, mrc_proto_ProtobufJoystickOutputData, AUTO)
static const char mrc_proto_ProtobufVersionInfo_name[] = "mrc.proto.ProtobufVersionInfo";
std::string_view mrc_proto_ProtobufVersionInfo::msg_name(void) noexcept { return mrc_proto_ProtobufVersionInfo_name; }
pb_filedesc_t mrc_proto_ProtobufVersionInfo::file_descriptor(void) noexcept { return {::file_name, ::file_descriptor}; }
PB_BIND(mrc_proto_ProtobufVersionInfo, mrc_proto_ProtobufVersionInfo, AUTO)
static const char mrc_proto_ProtobufJoystickRumbleData_name[] = "mrc.proto.ProtobufJoystickRumbleData";
std::string_view mrc_proto_ProtobufJoystickRumbleData::msg_name(void) noexcept { return mrc_proto_ProtobufJoystickRumbleData_name; }
pb_filedesc_t mrc_proto_ProtobufJoystickRumbleData::file_descriptor(void) noexcept { return {::file_name, ::file_descriptor}; }
PB_BIND(mrc_proto_ProtobufJoystickRumbleData, mrc_proto_ProtobufJoystickRumbleData, AUTO)
static const char mrc_proto_ProtobufMatchInfo_name[] = "mrc.proto.ProtobufMatchInfo";
@@ -354,4 +362,16 @@ pb_filedesc_t mrc_proto_ProtobufErrorInfo::file_descriptor(void) noexcept { retu
PB_BIND(mrc_proto_ProtobufErrorInfo, mrc_proto_ProtobufErrorInfo, AUTO)
static const char mrc_proto_ProtobufOpMode_name[] = "mrc.proto.ProtobufOpMode";
std::string_view mrc_proto_ProtobufOpMode::msg_name(void) noexcept { return mrc_proto_ProtobufOpMode_name; }
pb_filedesc_t mrc_proto_ProtobufOpMode::file_descriptor(void) noexcept { return {::file_name, ::file_descriptor}; }
PB_BIND(mrc_proto_ProtobufOpMode, mrc_proto_ProtobufOpMode, AUTO)
static const char mrc_proto_ProtobufAvailableOpModes_name[] = "mrc.proto.ProtobufAvailableOpModes";
std::string_view mrc_proto_ProtobufAvailableOpModes::msg_name(void) noexcept { return mrc_proto_ProtobufAvailableOpModes_name; }
pb_filedesc_t mrc_proto_ProtobufAvailableOpModes::file_descriptor(void) noexcept { return {::file_name, ::file_descriptor}; }
PB_BIND(mrc_proto_ProtobufAvailableOpModes, mrc_proto_ProtobufAvailableOpModes, AUTO)

View File

@@ -23,7 +23,10 @@ typedef struct _mrc_proto_ProtobufJoystickData {
uint32_t ButtonCount;
uint32_t Buttons;
pb_callback_t Axes;
pb_callback_t POVs;
/* Each POV takes up 4 bits
We can fit 8 in here. */
uint32_t POVCount;
uint32_t POVs;
} mrc_proto_ProtobufJoystickData;
typedef struct _mrc_proto_ProtobufControlData {
@@ -32,9 +35,9 @@ typedef struct _mrc_proto_ProtobufControlData {
static pb_filedesc_t file_descriptor(void) noexcept;
uint32_t ControlWord;
float MatchTime;
int32_t MatchTime;
pb_callback_t Joysticks;
pb_callback_t OpMode;
uint64_t CurrentOpMode;
} mrc_proto_ProtobufControlData;
typedef struct _mrc_proto_ProtobufJoystickDescriptor {
@@ -44,31 +47,20 @@ typedef struct _mrc_proto_ProtobufJoystickDescriptor {
pb_callback_t JoystickName;
pb_callback_t AxisTypes;
bool IsXbox;
bool IsGamepad;
int32_t JoystickType;
int32_t ButtonCount;
int32_t PovCount;
int32_t RumbleCount;
} mrc_proto_ProtobufJoystickDescriptor;
typedef struct _mrc_proto_ProtobufJoystickOutputData {
typedef struct _mrc_proto_ProtobufJoystickRumbleData {
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 HidOutputs;
float LeftRumble;
float RightRumble;
} mrc_proto_ProtobufJoystickOutputData;
typedef struct _mrc_proto_ProtobufVersionInfo {
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 DeviceId;
pb_callback_t Name;
pb_callback_t Version;
} mrc_proto_ProtobufVersionInfo;
pb_callback_t Value;
} mrc_proto_ProtobufJoystickRumbleData;
typedef struct _mrc_proto_ProtobufMatchInfo {
static const pb_msgdesc_t* msg_descriptor(void) noexcept;
@@ -93,44 +85,60 @@ typedef struct _mrc_proto_ProtobufErrorInfo {
pb_callback_t CallStack;
} mrc_proto_ProtobufErrorInfo;
typedef struct _mrc_proto_ProtobufOpMode {
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;
uint64_t Hash;
pb_callback_t Name;
} mrc_proto_ProtobufOpMode;
typedef struct _mrc_proto_ProtobufAvailableOpModes {
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 Modes;
} mrc_proto_ProtobufAvailableOpModes;
/* Initializer values for message structs */
#define mrc_proto_ProtobufJoystickData_init_default {0, 0, {{NULL}, NULL}, {{NULL}, NULL}}
#define mrc_proto_ProtobufControlData_init_default {0, 0, {{NULL}, NULL}, {{NULL}, NULL}}
#define mrc_proto_ProtobufJoystickDescriptor_init_default {{{NULL}, NULL}, {{NULL}, NULL}, 0, 0, 0, 0}
#define mrc_proto_ProtobufJoystickOutputData_init_default {0, 0, 0}
#define mrc_proto_ProtobufVersionInfo_init_default {0, {{NULL}, NULL}, {{NULL}, NULL}}
#define mrc_proto_ProtobufJoystickData_init_default {0, 0, {{NULL}, NULL}, 0, 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_ProtobufJoystickRumbleData_init_default {{{NULL}, NULL}}
#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_ProtobufJoystickData_init_zero {0, 0, {{NULL}, NULL}, {{NULL}, NULL}}
#define mrc_proto_ProtobufControlData_init_zero {0, 0, {{NULL}, NULL}, {{NULL}, NULL}}
#define mrc_proto_ProtobufJoystickDescriptor_init_zero {{{NULL}, NULL}, {{NULL}, NULL}, 0, 0, 0, 0}
#define mrc_proto_ProtobufJoystickOutputData_init_zero {0, 0, 0}
#define mrc_proto_ProtobufVersionInfo_init_zero {0, {{NULL}, NULL}, {{NULL}, NULL}}
#define mrc_proto_ProtobufOpMode_init_default {0, {{NULL}, NULL}}
#define mrc_proto_ProtobufAvailableOpModes_init_default {{{NULL}, NULL}}
#define mrc_proto_ProtobufJoystickData_init_zero {0, 0, {{NULL}, NULL}, 0, 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_ProtobufJoystickRumbleData_init_zero {{{NULL}, NULL}}
#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_ProtobufOpMode_init_zero {0, {{NULL}, NULL}}
#define mrc_proto_ProtobufAvailableOpModes_init_zero {{{NULL}, NULL}}
/* Field tags (for use in manual encoding/decoding) */
#define mrc_proto_ProtobufJoystickData_ButtonCount_tag 1
#define mrc_proto_ProtobufJoystickData_Buttons_tag 2
#define mrc_proto_ProtobufJoystickData_Axes_tag 3
#define mrc_proto_ProtobufJoystickData_POVs_tag 4
#define mrc_proto_ProtobufJoystickData_POVCount_tag 4
#define mrc_proto_ProtobufJoystickData_POVs_tag 5
#define mrc_proto_ProtobufControlData_ControlWord_tag 1
#define mrc_proto_ProtobufControlData_MatchTime_tag 2
#define mrc_proto_ProtobufControlData_Joysticks_tag 3
#define mrc_proto_ProtobufControlData_OpMode_tag 4
#define mrc_proto_ProtobufControlData_CurrentOpMode_tag 4
#define mrc_proto_ProtobufJoystickDescriptor_JoystickName_tag 1
#define mrc_proto_ProtobufJoystickDescriptor_AxisTypes_tag 2
#define mrc_proto_ProtobufJoystickDescriptor_IsXbox_tag 3
#define mrc_proto_ProtobufJoystickDescriptor_IsGamepad_tag 3
#define mrc_proto_ProtobufJoystickDescriptor_JoystickType_tag 4
#define mrc_proto_ProtobufJoystickDescriptor_ButtonCount_tag 5
#define mrc_proto_ProtobufJoystickDescriptor_PovCount_tag 6
#define mrc_proto_ProtobufJoystickOutputData_HidOutputs_tag 1
#define mrc_proto_ProtobufJoystickOutputData_LeftRumble_tag 2
#define mrc_proto_ProtobufJoystickOutputData_RightRumble_tag 3
#define mrc_proto_ProtobufVersionInfo_DeviceId_tag 1
#define mrc_proto_ProtobufVersionInfo_Name_tag 2
#define mrc_proto_ProtobufVersionInfo_Version_tag 3
#define mrc_proto_ProtobufJoystickDescriptor_RumbleCount_tag 7
#define mrc_proto_ProtobufJoystickRumbleData_Value_tag 3
#define mrc_proto_ProtobufMatchInfo_EventName_tag 1
#define mrc_proto_ProtobufMatchInfo_MatchNumber_tag 2
#define mrc_proto_ProtobufMatchInfo_ReplayNumber_tag 3
@@ -140,21 +148,25 @@ typedef struct _mrc_proto_ProtobufErrorInfo {
#define mrc_proto_ProtobufErrorInfo_Details_tag 3
#define mrc_proto_ProtobufErrorInfo_Location_tag 4
#define mrc_proto_ProtobufErrorInfo_CallStack_tag 5
#define mrc_proto_ProtobufOpMode_Hash_tag 1
#define mrc_proto_ProtobufOpMode_Name_tag 2
#define mrc_proto_ProtobufAvailableOpModes_Modes_tag 1
/* Struct field encoding specification for nanopb */
#define mrc_proto_ProtobufJoystickData_FIELDLIST(X, a) \
X(a, STATIC, SINGULAR, UINT32, ButtonCount, 1) \
X(a, STATIC, SINGULAR, FIXED32, Buttons, 2) \
X(a, CALLBACK, REPEATED, FLOAT, Axes, 3) \
X(a, CALLBACK, REPEATED, SINT32, POVs, 4)
X(a, CALLBACK, REPEATED, SINT32, Axes, 3) \
X(a, STATIC, SINGULAR, UINT32, POVCount, 4) \
X(a, STATIC, SINGULAR, UINT32, POVs, 5)
#define mrc_proto_ProtobufJoystickData_CALLBACK pb_default_field_callback
#define mrc_proto_ProtobufJoystickData_DEFAULT NULL
#define mrc_proto_ProtobufControlData_FIELDLIST(X, a) \
X(a, STATIC, SINGULAR, UINT32, ControlWord, 1) \
X(a, STATIC, SINGULAR, FLOAT, MatchTime, 2) \
X(a, STATIC, SINGULAR, INT32, MatchTime, 2) \
X(a, CALLBACK, REPEATED, MESSAGE, Joysticks, 3) \
X(a, CALLBACK, SINGULAR, STRING, OpMode, 4)
X(a, STATIC, SINGULAR, FIXED64, CurrentOpMode, 4)
#define mrc_proto_ProtobufControlData_CALLBACK pb_default_field_callback
#define mrc_proto_ProtobufControlData_DEFAULT NULL
#define mrc_proto_ProtobufControlData_Joysticks_MSGTYPE mrc_proto_ProtobufJoystickData
@@ -162,26 +174,18 @@ X(a, CALLBACK, SINGULAR, STRING, OpMode, 4)
#define mrc_proto_ProtobufJoystickDescriptor_FIELDLIST(X, a) \
X(a, CALLBACK, SINGULAR, STRING, JoystickName, 1) \
X(a, CALLBACK, REPEATED, INT32, AxisTypes, 2) \
X(a, STATIC, SINGULAR, BOOL, IsXbox, 3) \
X(a, STATIC, SINGULAR, BOOL, IsGamepad, 3) \
X(a, STATIC, SINGULAR, INT32, JoystickType, 4) \
X(a, STATIC, SINGULAR, INT32, ButtonCount, 5) \
X(a, STATIC, SINGULAR, INT32, PovCount, 6)
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_DEFAULT NULL
#define mrc_proto_ProtobufJoystickOutputData_FIELDLIST(X, a) \
X(a, STATIC, SINGULAR, FIXED32, HidOutputs, 1) \
X(a, STATIC, SINGULAR, FLOAT, LeftRumble, 2) \
X(a, STATIC, SINGULAR, FLOAT, RightRumble, 3)
#define mrc_proto_ProtobufJoystickOutputData_CALLBACK NULL
#define mrc_proto_ProtobufJoystickOutputData_DEFAULT NULL
#define mrc_proto_ProtobufVersionInfo_FIELDLIST(X, a) \
X(a, STATIC, SINGULAR, FIXED32, DeviceId, 1) \
X(a, CALLBACK, SINGULAR, STRING, Name, 2) \
X(a, CALLBACK, SINGULAR, STRING, Version, 3)
#define mrc_proto_ProtobufVersionInfo_CALLBACK pb_default_field_callback
#define mrc_proto_ProtobufVersionInfo_DEFAULT NULL
#define mrc_proto_ProtobufJoystickRumbleData_FIELDLIST(X, a) \
X(a, CALLBACK, REPEATED, UINT32, Value, 3)
#define mrc_proto_ProtobufJoystickRumbleData_CALLBACK pb_default_field_callback
#define mrc_proto_ProtobufJoystickRumbleData_DEFAULT NULL
#define mrc_proto_ProtobufMatchInfo_FIELDLIST(X, a) \
X(a, CALLBACK, SINGULAR, STRING, EventName, 1) \
@@ -200,15 +204,27 @@ X(a, CALLBACK, SINGULAR, STRING, CallStack, 5)
#define mrc_proto_ProtobufErrorInfo_CALLBACK pb_default_field_callback
#define mrc_proto_ProtobufErrorInfo_DEFAULT NULL
#define mrc_proto_ProtobufOpMode_FIELDLIST(X, a) \
X(a, STATIC, SINGULAR, FIXED64, Hash, 1) \
X(a, CALLBACK, SINGULAR, STRING, Name, 2)
#define mrc_proto_ProtobufOpMode_CALLBACK pb_default_field_callback
#define mrc_proto_ProtobufOpMode_DEFAULT NULL
#define mrc_proto_ProtobufAvailableOpModes_FIELDLIST(X, a) \
X(a, CALLBACK, REPEATED, MESSAGE, Modes, 1)
#define mrc_proto_ProtobufAvailableOpModes_CALLBACK pb_default_field_callback
#define mrc_proto_ProtobufAvailableOpModes_DEFAULT NULL
#define mrc_proto_ProtobufAvailableOpModes_Modes_MSGTYPE mrc_proto_ProtobufOpMode
/* Maximum encoded size of messages (where known) */
/* mrc_proto_ProtobufJoystickData_size depends on runtime parameters */
/* mrc_proto_ProtobufControlData_size depends on runtime parameters */
/* mrc_proto_ProtobufJoystickDescriptor_size depends on runtime parameters */
/* mrc_proto_ProtobufVersionInfo_size depends on runtime parameters */
/* mrc_proto_ProtobufJoystickRumbleData_size depends on runtime parameters */
/* mrc_proto_ProtobufMatchInfo_size depends on runtime parameters */
/* mrc_proto_ProtobufErrorInfo_size depends on runtime parameters */
#define MRC_PROTO_MRCCOMM_NPB_H_MAX_SIZE mrc_proto_ProtobufJoystickOutputData_size
#define mrc_proto_ProtobufJoystickOutputData_size 15
/* mrc_proto_ProtobufOpMode_size depends on runtime parameters */
/* mrc_proto_ProtobufAvailableOpModes_size depends on runtime parameters */
#endif

View File

@@ -143,7 +143,7 @@ public class DriverStationJNI extends JNIWrapper {
public static final int kMaxJoystickAxes = 12;
/** The maximum number of POVs. */
public static final int kMaxJoystickPOVs = 12;
public static final int kMaxJoystickPOVs = 8;
/** The maximum number of joysticks. */
public static final int kMaxJoysticks = 6;
@@ -162,11 +162,11 @@ public class DriverStationJNI extends JNIWrapper {
* Gets the axes of a specific joystick.
*
* @param joystickNum the joystick number
* @param rawAxesArray the raw int axes values (0-255)
* @param rawAxesArray the raw int axes values (-32767-32768)
* @return number of joystick axes, or 0 for error
* @see "HAL_GetJoystickAxes"
*/
public static native int getJoystickAxesRaw(byte joystickNum, int[] rawAxesArray);
public static native int getJoystickAxesRaw(byte joystickNum, short[] rawAxesArray);
/**
* Gets the POVs of a specific joystick.
@@ -176,7 +176,7 @@ public class DriverStationJNI extends JNIWrapper {
* @return number of POVs, or 0 for error
* @see "HAL_GetJoystickPOVs"
*/
public static native int getJoystickPOVs(byte joystickNum, short[] povsArray);
public static native int getJoystickPOVs(byte joystickNum, byte[] povsArray);
/**
* Gets the buttons of a specific joystick.
@@ -199,7 +199,7 @@ public class DriverStationJNI extends JNIWrapper {
* @see "HAL_GetAllJoystickData"
*/
public static native void getAllJoystickData(
float[] axesArray, byte[] rawAxesArray, short[] povsArray, long[] buttonsAndMetadata);
float[] axesArray, short[] rawAxesArray, byte[] povsArray, long[] buttonsAndMetadata);
/**
* Set joystick outputs.
@@ -215,13 +215,13 @@ public class DriverStationJNI extends JNIWrapper {
byte joystickNum, int outputs, int leftRumble, int rightRumble);
/**
* Gets whether a specific joystick is considered to be an XBox controller.
* Gets whether a specific joystick is considered to be an Gamepad.
*
* @param joystickNum the joystick number
* @return 1 if xbox, 0 otherwise
* @see "HAL_GetJoystickIsXbox"
* @return 1 if gamepad, 0 otherwise
* @see "HAL_GetJoystickIsGamepad"
*/
public static native int getJoystickIsXbox(byte joystickNum);
public static native int getJoystickIsGamepad(byte joystickNum);
/**
* Gets the type of joystick connected.

View File

@@ -79,7 +79,7 @@ public class DriverStationDataJNI extends JNIWrapper {
public static native void setJoystickAxes(byte joystickNum, float[] axesArray);
public static native void setJoystickPOVs(byte joystickNum, short[] povsArray);
public static native void setJoystickPOVs(byte joystickNum, byte[] povsArray);
public static native void setJoystickButtons(byte joystickNum, int buttons, int count);
@@ -116,7 +116,7 @@ public class DriverStationDataJNI extends JNIWrapper {
public static native void setJoystickButtonCount(int stick, int count);
public static native void setJoystickIsXbox(int stick, boolean isXbox);
public static native void setJoystickIsGamepad(int stick, boolean isGamepad);
public static native void setJoystickType(int stick, int type);

View File

@@ -136,11 +136,11 @@ Java_edu_wpi_first_hal_DriverStationJNI_nativeGetAllianceStation
/*
* Class: edu_wpi_first_hal_DriverStationJNI
* Method: getJoystickAxesRaw
* Signature: (B[I)I
* Signature: (B[S)I
*/
JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_DriverStationJNI_getJoystickAxesRaw
(JNIEnv* env, jclass, jbyte joystickNum, jintArray axesRawArray)
(JNIEnv* env, jclass, jbyte joystickNum, jshortArray axesRawArray)
{
HAL_JoystickAxes axes;
HAL_GetJoystickAxes(joystickNum, &axes);
@@ -155,11 +155,7 @@ Java_edu_wpi_first_hal_DriverStationJNI_getJoystickAxesRaw
return 0;
}
jint raw[HAL_kMaxJoystickAxes];
for (int16_t i = 0; i < axes.count; i++) {
raw[i] = axes.raw[i];
}
env->SetIntArrayRegion(axesRawArray, 0, axes.count, raw);
env->SetShortArrayRegion(axesRawArray, 0, axes.count, axes.raw);
return axes.count;
}
@@ -194,11 +190,11 @@ Java_edu_wpi_first_hal_DriverStationJNI_getJoystickAxes
/*
* Class: edu_wpi_first_hal_DriverStationJNI
* Method: getJoystickPOVs
* Signature: (B[S)I
* Signature: (B[B)I
*/
JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_DriverStationJNI_getJoystickPOVs
(JNIEnv* env, jclass, jbyte joystickNum, jshortArray povsArray)
(JNIEnv* env, jclass, jbyte joystickNum, jbyteArray povsArray)
{
HAL_JoystickPOVs povs;
HAL_GetJoystickPOVs(joystickNum, &povs);
@@ -213,7 +209,8 @@ Java_edu_wpi_first_hal_DriverStationJNI_getJoystickPOVs
return 0;
}
env->SetShortArrayRegion(povsArray, 0, povs.count, povs.povs);
env->SetByteArrayRegion(povsArray, 0, povs.count,
reinterpret_cast<const jbyte*>(povs.povs));
return povs.count;
}
@@ -221,12 +218,12 @@ Java_edu_wpi_first_hal_DriverStationJNI_getJoystickPOVs
/*
* Class: edu_wpi_first_hal_DriverStationJNI
* Method: getAllJoystickData
* Signature: ([F[B[S[J)V
* Signature: ([F[S[B[J)V
*/
JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_DriverStationJNI_getAllJoystickData
(JNIEnv* env, jclass cls, jfloatArray axesArray, jbyteArray rawAxesArray,
jshortArray povsArray, jlongArray buttonsAndMetadataArray)
(JNIEnv* env, jclass cls, jfloatArray axesArray, jshortArray rawAxesArray,
jbyteArray povsArray, jlongArray buttonsAndMetadataArray)
{
HAL_JoystickAxes axes[HAL_kMaxJoysticks];
HAL_JoystickPOVs povs[HAL_kMaxJoysticks];
@@ -235,8 +232,8 @@ Java_edu_wpi_first_hal_DriverStationJNI_getAllJoystickData
HAL_GetAllJoystickData(axes, povs, buttons);
CriticalJSpan<jfloat> jAxes(env, axesArray);
CriticalJSpan<jbyte> jRawAxes(env, rawAxesArray);
CriticalJSpan<jshort> jPovs(env, povsArray);
CriticalJSpan<jshort> jRawAxes(env, rawAxesArray);
CriticalJSpan<jbyte> jPovs(env, povsArray);
CriticalJSpan<jlong> jButtons(env, buttonsAndMetadataArray);
static_assert(sizeof(jAxes[0]) == sizeof(axes[0].axes[0]));
@@ -288,14 +285,14 @@ Java_edu_wpi_first_hal_DriverStationJNI_setJoystickOutputs
/*
* Class: edu_wpi_first_hal_DriverStationJNI
* Method: getJoystickIsXbox
* Method: getJoystickIsGamepad
* Signature: (B)I
*/
JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_DriverStationJNI_getJoystickIsXbox
Java_edu_wpi_first_hal_DriverStationJNI_getJoystickIsGamepad
(JNIEnv*, jclass, jbyte port)
{
return HAL_GetJoystickIsXbox(port);
return HAL_GetJoystickIsGamepad(port);
}
/*

View File

@@ -452,15 +452,15 @@ Java_edu_wpi_first_hal_simulation_DriverStationDataJNI_setJoystickAxes
/*
* Class: edu_wpi_first_hal_simulation_DriverStationDataJNI
* Method: setJoystickPOVs
* Signature: (B[S)V
* Signature: (B[B)V
*/
JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_simulation_DriverStationDataJNI_setJoystickPOVs
(JNIEnv* env, jclass, jbyte joystickNum, jshortArray povsArray)
(JNIEnv* env, jclass, jbyte joystickNum, jbyteArray povsArray)
{
HAL_JoystickPOVs povs;
{
JSpan<const jshort> jArrayRef(env, povsArray);
JSpan<const jbyte> jArrayRef(env, povsArray);
auto arrayRef = jArrayRef.array();
auto arraySize = arrayRef.size();
int maxCount =
@@ -701,14 +701,14 @@ Java_edu_wpi_first_hal_simulation_DriverStationDataJNI_setJoystickButtonCount
/*
* Class: edu_wpi_first_hal_simulation_DriverStationDataJNI
* Method: setJoystickIsXbox
* Method: setJoystickIsGamepad
* Signature: (IZ)V
*/
JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_simulation_DriverStationDataJNI_setJoystickIsXbox
(JNIEnv*, jclass, jint stick, jboolean isXbox)
Java_edu_wpi_first_hal_simulation_DriverStationDataJNI_setJoystickIsGamepad
(JNIEnv*, jclass, jint stick, jboolean isGamepad)
{
HALSIM_SetJoystickIsXbox(stick, isXbox);
HALSIM_SetJoystickIsGamepad(stick, isGamepad);
}
/*

View File

@@ -2,9 +2,6 @@
// 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/protobuf/ProtobufCallbacks.h>
#include "hal/proto/ControlData.h"
@@ -13,6 +10,8 @@ static_assert(sizeof(mrc::ControlFlags) == sizeof(uint32_t));
namespace {
constexpr uint32_t EnabledMask = 0x1;
constexpr uint32_t AutoMask = 0x2;
constexpr uint32_t TestMask = 0x4;
constexpr uint32_t EStopMask = 0x8;
constexpr uint32_t FmsConnectedMask = 0x10;
constexpr uint32_t DsConnectedMask = 0x20;
@@ -20,6 +19,8 @@ constexpr uint32_t WatchdogActiveMask = 0x40;
constexpr uint32_t AllianceMask = 0x1F80;
constexpr uint32_t EnabledShift = 0;
constexpr uint32_t AutoShift = 1;
constexpr uint32_t TestShift = 2;
constexpr uint32_t EStopShift = 3;
constexpr uint32_t FmsConnectedShift = 4;
constexpr uint32_t DsConnectedShift = 5;
@@ -31,6 +32,8 @@ constexpr uint32_t AllianceShift = 7;
constexpr uint32_t FromControlWord(mrc::ControlFlags Word) {
uint32_t Ret = 0;
WORD_TO_INT(Enabled);
WORD_TO_INT(Auto);
WORD_TO_INT(Test);
WORD_TO_INT(EStop);
WORD_TO_INT(FmsConnected);
WORD_TO_INT(DsConnected);
@@ -46,6 +49,8 @@ constexpr uint32_t FromControlWord(mrc::ControlFlags Word) {
constexpr mrc::ControlFlags ToControlWord(uint32_t Word) {
mrc::ControlFlags Ret = {};
INT_TO_WORD(Enabled);
INT_TO_WORD(Auto);
INT_TO_WORD(Test);
INT_TO_WORD(EStop);
INT_TO_WORD(FmsConnected);
INT_TO_WORD(DsConnected);
@@ -59,13 +64,12 @@ constexpr mrc::ControlFlags ToControlWord(uint32_t Word) {
std::optional<mrc::ControlData> wpi::Protobuf<mrc::ControlData>::Unpack(
InputStream& Stream) {
wpi::UnpackCallback<mrc::Joystick, MRC_MAX_NUM_JOYSTICKS> JoystickCb;
wpi::UnpackCallback<std::string> OpModeCb;
mrc_proto_ProtobufControlData Msg{
.ControlWord = 0,
.MatchTime = 0,
.Joysticks = JoystickCb.Callback(),
.OpMode = OpModeCb.Callback(),
.CurrentOpMode = 0,
};
if (!Stream.Decode(Msg)) {
@@ -73,16 +77,12 @@ std::optional<mrc::ControlData> wpi::Protobuf<mrc::ControlData>::Unpack(
}
auto Joysticks = JoystickCb.Items();
auto OpMode = OpModeCb.Items();
mrc::ControlData ControlData;
if (!OpMode.empty()) {
ControlData.MoveOpMode(std::move(OpMode[0]));
}
ControlData.ControlWord = ToControlWord(Msg.ControlWord);
ControlData.MatchTime = Msg.MatchTime;
ControlData.CurrentOpMode = Msg.CurrentOpMode;
ControlData.SetJoystickCount(Joysticks.size());
for (size_t i = 0; i < ControlData.GetJoystickCount(); i++) {
@@ -94,8 +94,6 @@ std::optional<mrc::ControlData> wpi::Protobuf<mrc::ControlData>::Unpack(
bool wpi::Protobuf<mrc::ControlData>::Pack(OutputStream& Stream,
const mrc::ControlData& Value) {
std::string_view OpMode = Value.GetOpMode();
wpi::PackCallback OpModeCb{&OpMode};
std::span<const mrc::Joystick> Sticks = Value.Joysticks();
wpi::PackCallback Joysticks{Sticks};
@@ -103,7 +101,7 @@ bool wpi::Protobuf<mrc::ControlData>::Pack(OutputStream& Stream,
.ControlWord = FromControlWord(Value.ControlWord),
.MatchTime = Value.MatchTime,
.Joysticks = Joysticks.Callback(),
.OpMode = OpModeCb.Callback(),
.CurrentOpMode = Value.CurrentOpMode,
};
return Stream.Encode(Msg);
@@ -111,14 +109,14 @@ bool wpi::Protobuf<mrc::ControlData>::Pack(OutputStream& Stream,
std::optional<mrc::Joystick> wpi::Protobuf<mrc::Joystick>::Unpack(
InputStream& Stream) {
wpi::UnpackCallback<float, MRC_MAX_NUM_AXES> AxesCb;
wpi::UnpackCallback<int16_t, MRC_MAX_NUM_POVS> PovsCb;
wpi::UnpackCallback<int16_t, MRC_MAX_NUM_AXES> AxesCb;
mrc_proto_ProtobufJoystickData Msg{
.ButtonCount = 0,
.Buttons = 0,
.Axes = AxesCb.Callback(),
.POVs = PovsCb.Callback(),
.POVCount = 0,
.POVs = 0,
};
if (!Stream.Decode(Msg)) {
@@ -126,7 +124,6 @@ std::optional<mrc::Joystick> wpi::Protobuf<mrc::Joystick>::Unpack(
}
auto Axes = AxesCb.Items();
auto Povs = PovsCb.Items();
mrc::Joystick Joystick;
Joystick.Axes.SetCount(Axes.size());
@@ -135,28 +132,36 @@ std::optional<mrc::Joystick> wpi::Protobuf<mrc::Joystick>::Unpack(
Joystick.Axes.Axes()[i] = Axes[i];
}
Joystick.Povs.SetCount(Povs.size());
for (size_t i = 0; i < Joystick.Povs.GetCount(); i++) {
Joystick.Povs.Povs()[i] = Povs[i];
}
Joystick.Buttons.SetCount(Msg.ButtonCount);
Joystick.Buttons.Buttons = Msg.Buttons;
Joystick.Povs.SetCount(Msg.POVCount);
uint32_t PovsStore = Msg.POVs;
for (size_t i = 0; i < Joystick.Povs.GetCount(); i++) {
uint8_t Val = PovsStore & 0xF;
PovsStore >>= 4;
Joystick.Povs.Povs()[i] = Val;
}
return Joystick;
}
bool wpi::Protobuf<mrc::Joystick>::Pack(OutputStream& Stream,
const mrc::Joystick& Value) {
wpi::PackCallback AxesCb{Value.Axes.Axes()};
wpi::PackCallback PovsCb{Value.Povs.Povs()};
uint32_t PovsStore = 0;
for (size_t i = 0; i < Value.Povs.GetCount(); i++) {
PovsStore <<= 4;
PovsStore |= Value.Povs.Povs()[i] & 0xF;
}
mrc_proto_ProtobufJoystickData Msg{
.ButtonCount = static_cast<uint32_t>(Value.Buttons.GetCount()),
.Buttons = Value.Buttons.Buttons,
.Axes = AxesCb.Callback(),
.POVs = PovsCb.Callback(),
.POVCount = static_cast<uint32_t>(Value.Povs.GetCount()),
.POVs = PovsStore,
};
return Stream.Encode(Msg);

View File

@@ -41,8 +41,9 @@ wpi::Protobuf<mrc::JoystickDescriptor>::Unpack(InputStream& Stream) {
OutputData.SetPovsCount(Msg.PovCount);
OutputData.SetButtonsCount(Msg.ButtonCount);
OutputData.IsXbox = Msg.IsXbox ? 1 : 0;
OutputData.IsGamepad = Msg.IsGamepad ? 1 : 0;
OutputData.Type = Msg.JoystickType;
OutputData.RumbleCount = Msg.RumbleCount;
return OutputData;
}
@@ -58,10 +59,11 @@ bool wpi::Protobuf<mrc::JoystickDescriptor>::Pack(
mrc_proto_ProtobufJoystickDescriptor Msg{
.JoystickName = JoystickNameCb.Callback(),
.AxisTypes = AxisTypesCb.Callback(),
.IsXbox = Value.IsXbox ? true : false,
.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);

View File

@@ -1,33 +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/protobuf/ProtobufCallbacks.h>
#include "hal/proto/JoystickOutputData.h"
std::optional<mrc::JoystickOutputData>
wpi::Protobuf<mrc::JoystickOutputData>::Unpack(InputStream& Stream) {
mrc_proto_ProtobufJoystickOutputData Msg;
if (!Stream.Decode(Msg)) {
return {};
}
return mrc::JoystickOutputData{
.HidOutputs = Msg.HidOutputs,
.LeftRumble = Msg.LeftRumble,
.RightRumble = Msg.RightRumble,
};
}
bool wpi::Protobuf<mrc::JoystickOutputData>::Pack(
OutputStream& Stream, const mrc::JoystickOutputData& Value) {
mrc_proto_ProtobufJoystickOutputData Msg{
.HidOutputs = Value.HidOutputs,
.LeftRumble = Value.LeftRumble,
.RightRumble = Value.RightRumble,
};
return Stream.Encode(Msg);
}

View File

@@ -0,0 +1,42 @@
// 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/protobuf/ProtobufCallbacks.h>
#include "hal/proto/JoystickRumbleData.h"
std::optional<mrc::JoystickRumbleData>
wpi::Protobuf<mrc::JoystickRumbleData>::Unpack(InputStream& Stream) {
wpi::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::Protobuf<mrc::JoystickRumbleData>::Pack(
OutputStream& Stream, const mrc::JoystickRumbleData& Value) {
wpi::PackCallback RumbleCb{Value.Rumbles()};
mrc_proto_ProtobufJoystickRumbleData Msg{
.Value = RumbleCb.Callback(),
};
return Stream.Encode(Msg);
}

View File

@@ -0,0 +1,76 @@
// 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 <vector>
#include <wpi/protobuf/ProtobufCallbacks.h>
#include "hal/proto/OpMode.h"
std::optional<mrc::OpMode> wpi::Protobuf<mrc::OpMode>::Unpack(
InputStream& Stream) {
wpi::UnpackCallback<std::string> NameCb;
mrc_proto_ProtobufOpMode Msg;
Msg.Name = NameCb.Callback();
if (!Stream.Decode(Msg)) {
return {};
}
auto Name = NameCb.Items();
if (Name.empty()) {
return {};
}
mrc::OpMode OutputData;
OutputData.MoveName(std::move(Name[0]));
OutputData.Hash = Msg.Hash;
return OutputData;
}
bool wpi::Protobuf<mrc::OpMode>::Pack(OutputStream& Stream,
const mrc::OpMode& Value) {
std::string_view EventNameStr = Value.GetName();
wpi::PackCallback EventName{&EventNameStr};
mrc_proto_ProtobufOpMode Msg{
.Hash = Value.Hash,
.Name = EventName.Callback(),
};
return Stream.Encode(Msg);
}
std::optional<std::vector<mrc::OpMode>>
wpi::Protobuf<std::vector<mrc::OpMode>>::Unpack(InputStream& Stream) {
wpi::StdVectorUnpackCallback<mrc::OpMode> ModesCb;
ModesCb.SetLimits(DecodeLimits::Add);
mrc_proto_ProtobufAvailableOpModes Msg;
Msg.Modes = ModesCb.Callback();
if (!Stream.Decode(Msg)) {
return {};
}
return ModesCb.Vec();
}
bool wpi::Protobuf<std::vector<mrc::OpMode>>::Pack(
OutputStream& Stream, const std::vector<mrc::OpMode>& Value) {
std::span<const mrc::OpMode> ModesSpan = Value;
wpi::PackCallback Modes{ModesSpan};
mrc_proto_ProtobufAvailableOpModes Msg{
.Modes = Modes.Callback(),
};
return Stream.Encode(Msg);
}

View File

@@ -1,56 +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/protobuf/ProtobufCallbacks.h>
#include "hal/proto/VersionInfo.h"
std::optional<mrc::VersionInfo> wpi::Protobuf<mrc::VersionInfo>::Unpack(
InputStream& Stream) {
wpi::UnpackCallback<std::string> NameCb;
wpi::UnpackCallback<std::string> VersionCb;
mrc_proto_ProtobufVersionInfo Msg{
.DeviceId = 0,
.Name = NameCb.Callback(),
.Version = VersionCb.Callback(),
};
if (!Stream.Decode(Msg)) {
return {};
}
auto Name = NameCb.Items();
auto Version = VersionCb.Items();
if (Name.empty() || Version.empty()) {
return {};
}
mrc::VersionInfo ToRet;
ToRet.DeviceId = Msg.DeviceId;
ToRet.MoveName(std::move(Name[0]));
ToRet.MoveVersion(std::move(Version[0]));
return ToRet;
}
bool wpi::Protobuf<mrc::VersionInfo>::Pack(OutputStream& Stream,
const mrc::VersionInfo& Value) {
std::string_view NameView = Value.GetName();
std::string_view VersionView = Value.GetVersion();
wpi::PackCallback NameCb{&NameView};
wpi::PackCallback VersionCb{&VersionView};
mrc_proto_ProtobufVersionInfo Msg{
.DeviceId = Value.DeviceId,
.Name = NameCb.Callback(),
.Version = VersionCb.Callback(),
};
return Stream.Encode(Msg);
}

View File

@@ -122,12 +122,12 @@ int32_t HAL_GetJoystickDescriptor(int32_t joystickNum,
HAL_JoystickDescriptor* desc);
/**
* Gets whether a specific joystick is considered to be an XBox controller.
* Gets whether a specific joystick is considered to be an Gamepad.
*
* @param joystickNum the joystick number
* @return true if xbox, false otherwise
* @return true if gamepad, false otherwise
*/
HAL_Bool HAL_GetJoystickIsXbox(int32_t joystickNum);
HAL_Bool HAL_GetJoystickIsGamepad(int32_t joystickNum);
/**
* Gets the type of joystick connected.

View File

@@ -75,7 +75,7 @@ HAL_ENUM(HAL_MatchType) {
* struct. This is used for allocating buffers, not bounds checking, since there
* are usually less POVs in practice.
*/
#define HAL_kMaxJoystickPOVs 12
#define HAL_kMaxJoystickPOVs 8
/**
* The maximum number of joysticks.
*/
@@ -84,13 +84,13 @@ HAL_ENUM(HAL_MatchType) {
struct HAL_JoystickAxes {
int16_t count;
float axes[HAL_kMaxJoystickAxes];
uint8_t raw[HAL_kMaxJoystickAxes];
int16_t raw[HAL_kMaxJoystickAxes];
};
typedef struct HAL_JoystickAxes HAL_JoystickAxes;
struct HAL_JoystickPOVs {
int16_t count;
int16_t povs[HAL_kMaxJoystickPOVs];
uint8_t povs[HAL_kMaxJoystickPOVs];
};
typedef struct HAL_JoystickPOVs HAL_JoystickPOVs;
@@ -101,7 +101,7 @@ struct HAL_JoystickButtons {
typedef struct HAL_JoystickButtons HAL_JoystickButtons;
struct HAL_JoystickDescriptor {
uint8_t isXbox;
uint8_t isGamepad;
uint8_t type;
char name[256];
uint8_t axisCount;

View File

@@ -1,21 +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 <wpi/protobuf/Protobuf.h>
#include "MrcComm.npb.h"
#include "mrc/NetComm.h"
template <>
struct wpi::Protobuf<mrc::JoystickOutputData> {
using MessageStruct = mrc_proto_ProtobufJoystickOutputData;
using InputStream = wpi::ProtoInputStream<mrc::JoystickOutputData>;
using OutputStream = wpi::ProtoOutputStream<mrc::JoystickOutputData>;
static std::optional<mrc::JoystickOutputData> Unpack(InputStream& Stream);
static bool Pack(OutputStream& Stream, const mrc::JoystickOutputData& Value);
};

View File

@@ -0,0 +1,21 @@
// 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 <wpi/protobuf/Protobuf.h>
#include "MrcComm.npb.h"
#include "mrc/NetComm.h"
template <>
struct wpi::Protobuf<mrc::JoystickRumbleData> {
using MessageStruct = mrc_proto_ProtobufJoystickRumbleData;
using InputStream = wpi::ProtoInputStream<mrc::JoystickRumbleData>;
using OutputStream = wpi::ProtoOutputStream<mrc::JoystickRumbleData>;
static std::optional<mrc::JoystickRumbleData> Unpack(InputStream& Stream);
static bool Pack(OutputStream& Stream, const mrc::JoystickRumbleData& Value);
};

View File

@@ -0,0 +1,32 @@
// 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 <vector>
#include <wpi/protobuf/Protobuf.h>
#include "MrcComm.npb.h"
#include "mrc/NetComm.h"
template <>
struct wpi::Protobuf<mrc::OpMode> {
using MessageStruct = mrc_proto_ProtobufOpMode;
using InputStream = wpi::ProtoInputStream<mrc::OpMode>;
using OutputStream = wpi::ProtoOutputStream<mrc::OpMode>;
static std::optional<mrc::OpMode> Unpack(InputStream& Stream);
static bool Pack(OutputStream& Stream, const mrc::OpMode& Value);
};
template <>
struct wpi::Protobuf<std::vector<mrc::OpMode>> {
using MessageStruct = mrc_proto_ProtobufAvailableOpModes;
using InputStream = wpi::ProtoInputStream<std::vector<mrc::OpMode>>;
using OutputStream = wpi::ProtoOutputStream<std::vector<mrc::OpMode>>;
static std::optional<std::vector<mrc::OpMode>> Unpack(InputStream& Stream);
static bool Pack(OutputStream& Stream, const std::vector<mrc::OpMode>& Value);
};

View File

@@ -147,7 +147,7 @@ void HALSIM_SetJoystickButtonCount(int32_t stick, int32_t count);
void HALSIM_GetJoystickCounts(int32_t stick, int32_t* axisCount,
int32_t* buttonCount, int32_t* povCount);
void HALSIM_SetJoystickIsXbox(int32_t stick, HAL_Bool isXbox);
void HALSIM_SetJoystickIsGamepad(int32_t stick, HAL_Bool isGamepad);
void HALSIM_SetJoystickType(int32_t stick, int32_t type);
void HALSIM_SetJoystickName(int32_t stick, const struct WPI_String* name);
void HALSIM_SetJoystickAxisType(int32_t stick, int32_t axis, int32_t type);

View File

@@ -285,12 +285,12 @@ int32_t HAL_GetJoystickDescriptor(int32_t joystickNum,
return 0;
}
HAL_Bool HAL_GetJoystickIsXbox(int32_t joystickNum) {
HAL_Bool HAL_GetJoystickIsGamepad(int32_t joystickNum) {
HAL_JoystickDescriptor joystickDesc;
if (HAL_GetJoystickDescriptor(joystickNum, &joystickDesc) < 0) {
return 0;
} else {
return joystickDesc.isXbox;
return joystickDesc.isGamepad;
}
}

View File

@@ -320,12 +320,13 @@ void DriverStationData::GetJoystickCounts(int32_t stick, int32_t* axisCount,
*povCount = m_joystickData[stick].povs.count;
}
void DriverStationData::SetJoystickIsXbox(int32_t stick, HAL_Bool isXbox) {
void DriverStationData::SetJoystickIsGamepad(int32_t stick,
HAL_Bool isGamepad) {
if (stick < 0 || stick >= kNumJoysticks) {
return;
}
std::scoped_lock lock(m_joystickDataMutex);
m_joystickData[stick].descriptor.isXbox = isXbox;
m_joystickData[stick].descriptor.isGamepad = isGamepad;
m_joystickDescriptorCallbacks(stick, &m_joystickData[stick].descriptor);
}
@@ -532,8 +533,8 @@ void HALSIM_GetJoystickCounts(int32_t stick, int32_t* axisCount,
povCount);
}
void HALSIM_SetJoystickIsXbox(int32_t stick, HAL_Bool isXbox) {
SimDriverStationData->SetJoystickIsXbox(stick, isXbox);
void HALSIM_SetJoystickIsGamepad(int32_t stick, HAL_Bool isGamepad) {
SimDriverStationData->SetJoystickIsGamepad(stick, isGamepad);
}
void HALSIM_SetJoystickType(int32_t stick, int32_t type) {

View File

@@ -105,7 +105,7 @@ class DriverStationData {
void GetJoystickCounts(int32_t stick, int32_t* axisCount,
int32_t* buttonCount, int32_t* povCount);
void SetJoystickIsXbox(int32_t stick, HAL_Bool isXbox);
void SetJoystickIsGamepad(int32_t stick, HAL_Bool isGamepad);
void SetJoystickType(int32_t stick, int32_t type);
void SetJoystickName(int32_t stick, std::string_view message);
void SetJoystickAxisType(int32_t stick, int32_t axis, int32_t type);

View File

@@ -11,6 +11,7 @@
#include <string>
#include <string_view>
#include <utility>
#include <vector>
#include <fmt/format.h>
#include <networktables/BooleanTopic.h>
@@ -32,8 +33,9 @@
#include "hal/proto/ControlData.h"
#include "hal/proto/ErrorInfo.h"
#include "hal/proto/JoystickDescriptor.h"
#include "hal/proto/JoystickOutputData.h"
#include "hal/proto/JoystickRumbleData.h"
#include "hal/proto/MatchInfo.h"
#include "hal/proto/OpMode.h"
#include "mrc/NtNetComm.h"
static_assert(sizeof(int32_t) >= sizeof(int),
@@ -60,12 +62,8 @@ static_assert(std::is_standard_layout_v<JoystickDataCache>);
struct SystemServerDriverStation {
nt::NetworkTableInstance ntInst;
nt::BooleanPublisher robotProgramPublisher;
nt::BooleanPublisher codeStartedPublisher;
nt::BooleanPublisher userCodeDisabledPublisher;
nt::BooleanPublisher userCodeAutonomousPublisher;
nt::BooleanPublisher userCodeTeleopPublisher;
nt::BooleanPublisher userCodeTestPublisher;
nt::BooleanPublisher hasUserCodePublisher;
nt::BooleanPublisher hasUserCodeReadyPublisher;
nt::ProtobufSubscriber<mrc::ControlData> controlDataSubscriber;
nt::ProtobufSubscriber<mrc::MatchInfo> matchInfoSubscriber;
@@ -79,9 +77,13 @@ struct SystemServerDriverStation {
nt::StringPublisher consoleLinePublisher;
nt::ProtobufPublisher<mrc::ErrorInfo> errorInfoPublisher;
std::array<nt::ProtobufPublisher<mrc::JoystickOutputData>,
std::array<nt::ProtobufPublisher<mrc::JoystickRumbleData>,
MRC_MAX_NUM_JOYSTICKS>
joystickOutputsTopics;
joystickRumbleTopics;
nt::ProtobufPublisher<std::vector<mrc::OpMode>> teleopOpModes;
nt::ProtobufPublisher<std::vector<mrc::OpMode>> autoOpModes;
nt::ProtobufPublisher<std::vector<mrc::OpMode>> testOpModes;
NT_Listener controlDataListener;
@@ -97,28 +99,20 @@ struct SystemServerDriverStation {
options.keepDuplicates = true;
options.periodic = 0.005;
codeStartedPublisher =
ntInst.GetBooleanTopic(ROBOT_CODE_STARTED_PATH).Publish(options);
userCodeDisabledPublisher =
ntInst.GetBooleanTopic(ROBOT_DISABLED_TRACE_PATH).Publish(options);
userCodeAutonomousPublisher =
ntInst.GetBooleanTopic(ROBOT_AUTON_TRACE_PATH).Publish(options);
userCodeTeleopPublisher =
ntInst.GetBooleanTopic(ROBOT_TELEOP_TRACE_PATH).Publish(options);
userCodeTestPublisher =
ntInst.GetBooleanTopic(ROBOT_TEST_TRACE_PATH).Publish(options);
hasUserCodeReadyPublisher =
ntInst.GetBooleanTopic(ROBOT_HAS_USER_CODE_READY_PATH).Publish(options);
for (size_t count = 0; count < joystickOutputsTopics.size(); count++) {
std::string name = ROBOT_JOYSTICK_OUTPUTS_PATH;
for (size_t count = 0; count < joystickRumbleTopics.size(); count++) {
std::string name = ROBOT_JOYSTICK_RUMBLE_PATH;
name += std::to_string(count);
joystickOutputsTopics[count] =
ntInst.GetProtobufTopic<mrc::JoystickOutputData>(name).Publish(
joystickRumbleTopics[count] =
ntInst.GetProtobufTopic<mrc::JoystickRumbleData>(name).Publish(
options);
}
robotProgramPublisher =
ntInst.GetBooleanTopic(ROBOT_NEW_ROBOT_PROGRAM_PATH).Publish();
robotProgramPublisher.Set(true);
hasUserCodePublisher =
ntInst.GetBooleanTopic(ROBOT_HAS_USER_CODE_PATH).Publish();
hasUserCodePublisher.Set(true);
consoleLinePublisher =
ntInst.GetStringTopic(ROBOT_CONSOLE_LINE_PATH).Publish(options);
@@ -147,6 +141,31 @@ struct SystemServerDriverStation {
ntInst.GetProtobufTopic<mrc::JoystickDescriptor>(name).Subscribe({});
}
teleopOpModes = ntInst
.GetProtobufTopic<std::vector<mrc::OpMode>>(
ROBOT_TELEOP_OP_MODES_PATH)
.Publish();
autoOpModes = ntInst
.GetProtobufTopic<std::vector<mrc::OpMode>>(
ROBOT_AUTO_OP_MODES_PATH)
.Publish();
testOpModes = ntInst
.GetProtobufTopic<std::vector<mrc::OpMode>>(
ROBOT_TEST_OP_MODES_PATH)
.Publish();
std::vector<mrc::OpMode> staticTeleopOpModes;
staticTeleopOpModes.emplace_back(mrc::OpMode{"TeleOp", 2});
teleopOpModes.Set(staticTeleopOpModes);
std::vector<mrc::OpMode> staticAutoOpModes;
staticAutoOpModes.emplace_back(mrc::OpMode{"Auto", 1});
autoOpModes.Set(staticAutoOpModes);
std::vector<mrc::OpMode> staticTestOpModes;
staticTestOpModes.emplace_back(mrc::OpMode{"Test", 3});
testOpModes.Set(staticTestOpModes);
ntInst.AddListener(
controlDataSubscriber, NT_EVENT_VALUE_REMOTE | NT_EVENT_UNPUBLISH,
[this](const nt::Event& event) { HandleListener(event); });
@@ -211,13 +230,8 @@ void JoystickDataCache::Update(const mrc::ControlData& data) {
controlWord.fmsAttached = data.ControlWord.FmsConnected;
controlWord.dsAttached = data.ControlWord.DsConnected;
controlWord.eStop = data.ControlWord.EStop;
auto mode = data.GetOpMode();
if (mode == "Test") {
controlWord.test = true;
} else if (mode == "Auton") {
controlWord.autonomous = true;
}
controlWord.test = data.ControlWord.Test;
controlWord.autonomous = data.ControlWord.Auto;
auto sticks = data.Joysticks();
@@ -228,7 +242,13 @@ void JoystickDataCache::Update(const mrc::ControlData& data) {
axes[count].count = newAxes.size();
for (size_t i = 0; i < newAxes.size(); i++) {
axes[count].axes[i] = newAxes[i];
axes[count].raw[i] = newAxes[i];
int16_t axisValue = newAxes[i];
if (axisValue < 0) {
axes[count].axes[i] = axisValue / 32768.0f;
} else {
axes[count].axes[i] = axisValue / 32767.0f;
}
}
povs[count].count = newPovs.size();
@@ -301,7 +321,7 @@ void TcpCache::Update() {
auto& desc = descriptors[count];
desc.isXbox = newDesc.IsXbox;
desc.isGamepad = newDesc.IsGamepad;
desc.type = newDesc.Type;
desc.buttonCount = newDesc.GetButtonsCount();
desc.povCount = newDesc.GetPovsCount();
@@ -481,12 +501,12 @@ HAL_AllianceStationID HAL_GetAllianceStation(int32_t* status) {
return currentRead->allianceStation;
}
HAL_Bool HAL_GetJoystickIsXbox(int32_t joystickNum) {
HAL_Bool HAL_GetJoystickIsGamepad(int32_t joystickNum) {
HAL_JoystickDescriptor joystickDesc;
if (HAL_GetJoystickDescriptor(joystickNum, &joystickDesc) < 0) {
return 0;
} else {
return joystickDesc.isXbox;
return joystickDesc.isGamepad;
}
}
@@ -523,15 +543,17 @@ int32_t HAL_SetJoystickOutputs(int32_t joystickNum, int64_t outputs,
int32_t leftRumble, int32_t rightRumble) {
CHECK_JOYSTICK_NUMBER(joystickNum);
mrc::JoystickOutputData outputData{
.HidOutputs = static_cast<uint32_t>(outputs),
.LeftRumble = std::clamp(leftRumble, 0, UINT16_MAX) /
static_cast<float>(UINT16_MAX),
.RightRumble = std::clamp(rightRumble, 0, UINT16_MAX) /
static_cast<float>(UINT16_MAX),
};
// TODO Update this API
systemServerDs->joystickOutputsTopics[joystickNum].Set(outputData);
// mrc::JoystickOutputData outputData{
// .HidOutputs = static_cast<uint32_t>(outputs),
// .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;
}
@@ -542,24 +564,16 @@ double HAL_GetMatchTime(int32_t* status) {
}
void HAL_ObserveUserProgramStarting(void) {
systemServerDs->codeStartedPublisher.Set(true);
systemServerDs->hasUserCodeReadyPublisher.Set(true);
}
void HAL_ObserveUserProgramDisabled(void) {
systemServerDs->userCodeDisabledPublisher.Set(true);
}
void HAL_ObserveUserProgramDisabled(void) {}
void HAL_ObserveUserProgramAutonomous(void) {
systemServerDs->userCodeAutonomousPublisher.Set(true);
}
void HAL_ObserveUserProgramAutonomous(void) {}
void HAL_ObserveUserProgramTeleop(void) {
systemServerDs->userCodeTeleopPublisher.Set(true);
}
void HAL_ObserveUserProgramTeleop(void) {}
void HAL_ObserveUserProgramTest(void) {
systemServerDs->userCodeTestPublisher.Set(true);
}
void HAL_ObserveUserProgramTest(void) {}
HAL_Bool HAL_RefreshDSData(void) {
mrc::ControlData newestData;

View File

@@ -99,7 +99,7 @@ void HALSIM_GetJoystickCounts(int32_t stick, int32_t* axisCount,
*povCount = 0;
}
void HALSIM_SetJoystickIsXbox(int32_t stick, HAL_Bool isXbox) {}
void HALSIM_SetJoystickIsGamepad(int32_t stick, HAL_Bool isGamepad) {}
void HALSIM_SetJoystickType(int32_t stick, int32_t type) {}

View File

@@ -16,9 +16,31 @@
namespace mrc {
struct OpModeTrace {
uint64_t Hash{0};
bool Enabled{false};
bool NoCurrentOpMpode{false};
static OpModeTrace FromValue(uint64_t Value) {
return OpModeTrace{
.Hash = Value & 0x3FFFFFFFFFFFFFFF,
.Enabled = (Value & 0x8000000000000000) == 0,
.NoCurrentOpMpode = (Value & 0x4000000000000000) != 0,
};
}
uint64_t ToValue() const {
uint64_t RetVal = Hash & 0x3FFFFFFFFFFFFFFF;
RetVal |= Enabled ? 0 : 0x8000000000000000;
RetVal |= NoCurrentOpMpode ? 0x4000000000000000 : 0;
return RetVal;
}
};
struct ControlFlags {
uint32_t Enabled : 1;
uint32_t ModeReserved : 2;
uint32_t Auto : 1;
uint32_t Test : 1;
uint32_t EStop : 1;
uint32_t FmsConnected : 1;
uint32_t DsConnected : 1;
@@ -29,9 +51,9 @@ struct ControlFlags {
struct JoystickAxes {
public:
std::span<float> Axes() { return std::span{AxesStore.data(), GetCount()}; }
std::span<int16_t> Axes() { return std::span{AxesStore.data(), GetCount()}; }
std::span<const float> Axes() const {
std::span<const int16_t> Axes() const {
return std::span{AxesStore.data(), GetCount()};
}
@@ -42,15 +64,15 @@ struct JoystickAxes {
size_t GetCount() const { return Count; }
private:
std::array<float, MRC_MAX_NUM_AXES> AxesStore;
std::array<int16_t, MRC_MAX_NUM_AXES> AxesStore;
uint8_t Count{0};
};
struct JoystickPovs {
public:
std::span<int16_t> Povs() { return std::span{PovsStore.data(), GetCount()}; }
std::span<uint8_t> Povs() { return std::span{PovsStore.data(), GetCount()}; }
std::span<const int16_t> Povs() const {
std::span<const uint8_t> Povs() const {
return std::span{PovsStore.data(), GetCount()};
}
@@ -61,7 +83,7 @@ struct JoystickPovs {
size_t GetCount() const { return Count; }
private:
std::array<int16_t, MRC_MAX_NUM_POVS> PovsStore;
std::array<uint8_t, MRC_MAX_NUM_POVS> PovsStore;
uint8_t Count{0};
};
@@ -86,7 +108,8 @@ struct Joystick {
struct ControlData {
ControlFlags ControlWord;
float MatchTime;
uint16_t MatchTime;
uint64_t CurrentOpMode;
std::span<Joystick> Joysticks() {
return std::span{JoysticksStore.data(), GetJoystickCount()};
@@ -103,41 +126,30 @@ struct ControlData {
(std::min)(NewCount, static_cast<uint8_t>(MRC_MAX_NUM_JOYSTICKS));
}
void SetOpMode(std::string_view Mode) {
if (Mode.size() > MRC_MAX_OPMODE_LEN) {
Mode = Mode.substr(0, MRC_MAX_OPMODE_LEN);
}
OpMode = Mode;
}
void MoveOpMode(std::string&& Mode) {
OpMode = std::move(Mode);
if (OpMode.size() > MRC_MAX_OPMODE_LEN) {
OpMode.resize(MRC_MAX_OPMODE_LEN);
}
}
std::string_view GetOpMode() const { return OpMode; }
std::span<uint8_t> WritableOpModeBuffer(size_t Len) {
if (Len > MRC_MAX_OPMODE_LEN) {
Len = MRC_MAX_OPMODE_LEN;
}
OpMode.resize(Len);
return std::span<uint8_t>{reinterpret_cast<uint8_t*>(OpMode.data()),
OpMode.size()};
}
private:
std::array<Joystick, MRC_MAX_NUM_JOYSTICKS> JoysticksStore;
uint8_t JoystickCount{0};
std::string OpMode;
};
struct JoystickOutputData {
uint32_t HidOutputs{0};
float LeftRumble{0};
float RightRumble{0};
struct JoystickRumbleData {
public:
std::span<uint16_t> Rumbles() {
return std::span{RumbleStore.data(), GetCount()};
}
std::span<const uint16_t> Rumbles() const {
return std::span{RumbleStore.data(), GetCount()};
}
void SetCount(uint8_t NewCount) {
Count = (std::min)(NewCount, static_cast<uint8_t>(MRC_MAX_NUM_RUMBLE));
}
size_t GetCount() const { return Count; }
private:
std::array<uint16_t, MRC_MAX_NUM_RUMBLE> RumbleStore;
uint8_t Count{0};
};
enum class MatchType : uint8_t {
@@ -190,8 +202,9 @@ struct MatchInfo {
struct JoystickDescriptor {
public:
bool IsXbox{0};
bool IsGamepad{0};
uint8_t Type{0};
uint8_t RumbleCount{0};
std::span<uint8_t> AxesTypes() {
return std::span{AxesTypesStore.data(), GetAxesCount()};
@@ -253,64 +266,6 @@ struct JoystickDescriptor {
uint8_t PovCount{0};
};
struct VersionInfo {
uint32_t DeviceId{0};
void SetName(std::string_view NewName) {
if (NewName.size() > MRC_MAX_VERSION_SIZE) {
NewName = NewName.substr(0, MRC_MAX_VERSION_SIZE);
}
Name = NewName;
}
void MoveName(std::string&& NewName) {
Name = std::move(NewName);
if (Name.size() > MRC_MAX_VERSION_SIZE) {
Name.resize(MRC_MAX_VERSION_SIZE);
}
}
std::string_view GetName() const { return Name; }
std::span<uint8_t> WritableNameBuffer(size_t Len) {
if (Len > MRC_MAX_VERSION_SIZE) {
Len = MRC_MAX_VERSION_SIZE;
}
Name.resize(Len);
return std::span<uint8_t>{reinterpret_cast<uint8_t*>(Name.data()),
Name.size()};
}
void SetVersion(std::string_view NewVersion) {
if (NewVersion.size() > MRC_MAX_VERSION_SIZE) {
NewVersion = NewVersion.substr(0, MRC_MAX_VERSION_SIZE);
}
Version = NewVersion;
}
void MoveVersion(std::string&& NewVersion) {
Version = std::move(NewVersion);
if (Version.size() > MRC_MAX_VERSION_SIZE) {
Version.resize(MRC_MAX_VERSION_SIZE);
}
}
std::string_view GetVersion() const { return Version; }
std::span<uint8_t> WritableVersionBuffer(size_t Len) {
if (Len > MRC_MAX_VERSION_SIZE) {
Len = MRC_MAX_VERSION_SIZE;
}
Version.resize(Len);
return std::span<uint8_t>{reinterpret_cast<uint8_t*>(Version.data()),
Version.size()};
}
private:
std::string Name;
std::string Version;
};
struct ErrorInfo {
bool IsError{false};
int32_t ErrorCode{0};
@@ -396,4 +351,42 @@ struct ErrorInfo {
std::string CallStack;
};
struct OpMode {
OpMode(std::string_view _Name, uint64_t _Hash) : Hash{_Hash} {
SetName(_Name);
}
OpMode() = default;
uint64_t Hash{0};
void SetName(std::string_view NewName) {
if (NewName.size() > MRC_MAX_OPMODE_LEN) {
NewName = NewName.substr(0, MRC_MAX_OPMODE_LEN);
}
Name = NewName;
}
void MoveName(std::string&& NewName) {
Name = std::move(NewName);
if (Name.size() > MRC_MAX_OPMODE_LEN) {
Name.resize(MRC_MAX_OPMODE_LEN);
}
}
std::string_view GetName() const { return Name; }
std::span<uint8_t> WritableNameBuffer(size_t Len) {
if (Len > MRC_MAX_OPMODE_LEN) {
Len = MRC_MAX_OPMODE_LEN;
}
Name.resize(Len);
return std::span<uint8_t>{reinterpret_cast<uint8_t*>(Name.data()),
Name.size()};
}
private:
std::string Name;
};
} // namespace mrc

View File

@@ -17,28 +17,31 @@
(ROBOT_CONTROL_DATA_PREFIX "JoystickDescriptors/")
#define ROBOT_STATUS_DATA_PREFIX "/Netcomm/Status/"
#define ROBOT_NEW_ROBOT_PROGRAM_PATH \
(ROBOT_STATUS_DATA_PREFIX "NewRobotProgram")
#define ROBOT_CODE_STARTED_PATH (ROBOT_STATUS_DATA_PREFIX "UserCodeStarted")
#define ROBOT_DISABLED_TRACE_PATH (ROBOT_STATUS_DATA_PREFIX "UserCodeDisabled")
#define ROBOT_AUTON_TRACE_PATH (ROBOT_STATUS_DATA_PREFIX "UserCodeAutonomous")
#define ROBOT_TELEOP_TRACE_PATH (ROBOT_STATUS_DATA_PREFIX "UserCodeTeleop")
#define ROBOT_TEST_TRACE_PATH (ROBOT_STATUS_DATA_PREFIX "UserCodeTest")
#define ROBOT_HAS_USER_CODE_PATH (ROBOT_STATUS_DATA_PREFIX "HasUserCode")
#define ROBOT_HAS_USER_CODE_READY_PATH \
(ROBOT_STATUS_DATA_PREFIX "HasUserCodeReady")
#define ROBOT_CURRENT_OPMODE_TRACE_PATH \
(ROBOT_STATUS_DATA_PREFIX "CurrentOpModeTrace")
#define ROBOT_OUTPUTS_DATA_PREFIX "/Netcomm/Outputs/"
#define ROBOT_JOYSTICK_OUTPUTS_PATH (ROBOT_OUTPUTS_DATA_PREFIX "Joysticks/")
#define ROBOT_JOYSTICK_RUMBLE_PATH (ROBOT_OUTPUTS_DATA_PREFIX "Rumble/")
#define ROBOT_CONSOLE_DATA_PREFIX "/Netcomm/Console/"
#define ROBOT_CONSOLE_LINE_PATH (ROBOT_CONSOLE_DATA_PREFIX "ConsoleLine")
#define ROBOT_ERROR_INFO_PATH (ROBOT_CONSOLE_DATA_PREFIX "ErrorInfo")
#define ROBOT_REPORTING_DATA_PREFIX "/Netcomm/Reporting/"
#define ROBOT_REQUEST_REPORTING_PATH \
(ROBOT_REPORTING_DATA_PREFIX "RequestVersions")
#define ROBOT_LIB_VERSION_PATH (ROBOT_REPORTING_DATA_PREFIX "LibVersion")
#define ROBOT_USER_REPORTING_PATH (ROBOT_REPORTING_DATA_PREFIX "User")
#define ROBOT_USER_VERSION_PATH (ROBOT_REPORTING_DATA_PREFIX "UserVersion")
#define ROBOT_USER_VERSION_STR_PATH \
(ROBOT_REPORTING_DATA_PREFIX "UserVersionStr")
#define ROBOT_MODES_PREFIX "/Netcomm/Modes/"
#define ROBOT_AVAILABLE_OP_MODES_PATH (ROBOT_MODES_PREFIX "AvailableOpModes")
#define ROBOT_TELEOP_OP_MODES_PATH (ROBOT_MODES_PREFIX "TeleopOpModes")
#define ROBOT_AUTO_OP_MODES_PATH (ROBOT_MODES_PREFIX "AutoOpModes")
#define ROBOT_TEST_OP_MODES_PATH (ROBOT_MODES_PREFIX "TestOpModes")
#define ROBOT_SYSTEM_SERVER_PREFIX "/sys/"
#define ROBOT_BATTERY_VOLTAGE_PATH (ROBOT_SYSTEM_SERVER_PREFIX "battery")
@@ -52,9 +55,10 @@
#define MRC_MAX_NUM_JOYSTICKS 6
#define MRC_MAX_NUM_AXES 12
#define MRC_MAX_NUM_POVS 12
#define MRC_MAX_NUM_POVS 8
#define MRC_MAX_NUM_BUTTONS 32
#define MRC_MAX_OPMODE_LEN 32
#define MRC_MAX_NUM_RUMBLE 8
#define MRC_MAX_OPMODE_LEN 128
#define MRC_MAX_GAME_SPECIFIC_MESSAGE_LEN 128
#define MRC_MAX_EVENT_NAME_LEN 64
#define MRC_MAX_JOYSTICK_NAME_LEN 256

View File

@@ -7,36 +7,32 @@ option java_package = "com.mrc.proto";
message ProtobufJoystickData {
uint32 ButtonCount = 1;
fixed32 Buttons = 2;
repeated float Axes = 3;
repeated sint32 POVs = 4;
repeated sint32 Axes = 3;
// Each POV takes up 4 bits
// We can fit 8 in here.
uint32 POVCount = 4;
uint32 POVs = 5;
}
message ProtobufControlData {
uint32 ControlWord = 1;
float MatchTime = 2;
int32 MatchTime = 2;
repeated ProtobufJoystickData Joysticks = 3;
string OpMode = 4;
fixed64 CurrentOpMode = 4;
}
message ProtobufJoystickDescriptor {
string JoystickName = 1;
repeated int32 AxisTypes = 2;
bool IsXbox = 3;
bool IsGamepad = 3;
int32 JoystickType = 4;
int32 ButtonCount = 5;
int32 PovCount = 6;
int32 RumbleCount = 7;
}
message ProtobufJoystickOutputData {
fixed32 HidOutputs = 1;
float LeftRumble = 2;
float RightRumble = 3;
}
message ProtobufVersionInfo {
fixed32 DeviceId = 1;
string Name = 2;
string Version = 3;
message ProtobufJoystickRumbleData {
repeated uint32 Value = 3;
}
message ProtobufMatchInfo {
@@ -53,3 +49,12 @@ message ProtobufErrorInfo {
string Location = 4;
string CallStack = 5;
}
message ProtobufOpMode {
fixed64 Hash = 1;
string Name = 2;
}
message ProtobufAvailableOpModes {
repeated ProtobufOpMode Modes = 1;
}

View File

@@ -230,7 +230,7 @@ void DSCommPacket::ReadJoystickDescriptionTag(std::span<const uint8_t> data) {
int joystickNum = data[0];
DSCommJoystickPacket& packet = m_joystick_packets[joystickNum];
packet.ResetTcp();
packet.descriptor.isXbox = data[1] != 0 ? 1 : 0;
packet.descriptor.isGamepad = data[1] != 0 ? 1 : 0;
packet.descriptor.type = data[2];
int nameLength =
std::min<size_t>(data[3], (sizeof(packet.descriptor.name) - 1));

View File

@@ -110,7 +110,7 @@ TEST_F(DSCommPacketTest, DescriptorTag) {
12, 3};
arr[1] = sizeof(arr) - 2;
auto& data = ReadDescriptorTag(arr);
ASSERT_EQ(data.descriptor.isXbox, 1);
ASSERT_EQ(data.descriptor.isGamepad, 1);
ASSERT_EQ(data.descriptor.type, 0);
ASSERT_STREQ(data.descriptor.name, "Hello World");
ASSERT_EQ(data.descriptor.axisCount, 4);

View File

@@ -393,29 +393,6 @@ void GlfwSystemJoystick::Update() {
}
}
static int HatToAngle(unsigned char hat) {
switch (hat) {
case GLFW_HAT_UP:
return 0;
case GLFW_HAT_RIGHT:
return 90;
case GLFW_HAT_DOWN:
return 180;
case GLFW_HAT_LEFT:
return 270;
case GLFW_HAT_RIGHT_UP:
return 45;
case GLFW_HAT_RIGHT_DOWN:
return 135;
case GLFW_HAT_LEFT_UP:
return 315;
case GLFW_HAT_LEFT_DOWN:
return 225;
default:
return -1;
}
}
void GlfwSystemJoystick::GetData(HALJoystickData* data, bool mapGamepad) const {
if (!m_present) {
return;
@@ -438,7 +415,7 @@ void GlfwSystemJoystick::GetData(HALJoystickData* data, bool mapGamepad) const {
}
// copy into HAL structures
data->desc.isXbox = m_isGamepad ? 1 : 0;
data->desc.isGamepad = m_isGamepad ? 1 : 0;
data->desc.type = m_isGamepad ? 21 : 20;
std::strncpy(data->desc.name, m_name, sizeof(data->desc.name) - 1);
data->desc.name[sizeof(data->desc.name) - 1] = '\0';
@@ -478,7 +455,14 @@ void GlfwSystemJoystick::GetData(HALJoystickData* data, bool mapGamepad) const {
data->povs.count = data->desc.povCount;
for (int j = 0; j < data->povs.count; ++j) {
data->povs.povs[j] = HatToAngle(m_hats[j]);
#if __GNUC__ >= 12
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wstringop-overflow="
#endif // __GNUC__ >= 12
data->povs.povs[j] = m_hats[j];
#if __GNUC__ >= 12
#pragma GCC diagnostic pop
#endif // __GNUC__ >= 12
}
}
@@ -562,7 +546,7 @@ KeyboardJoystick::KeyboardJoystick(glass::Storage& storage, int index)
}
// init desc structure
m_data.desc.isXbox = 0;
m_data.desc.isGamepad = 0;
m_data.desc.type = 20;
std::strncpy(m_data.desc.name, m_name, 256);
}
@@ -774,27 +758,37 @@ void KeyboardJoystick::Update() {
}
}
#define SDL_HAT_CENTERED 0x00u
#define SDL_HAT_UP 0x01u
#define SDL_HAT_RIGHT 0x02u
#define SDL_HAT_DOWN 0x04u
#define SDL_HAT_LEFT 0x08u
#define SDL_HAT_RIGHTUP (SDL_HAT_RIGHT | SDL_HAT_UP)
#define SDL_HAT_RIGHTDOWN (SDL_HAT_RIGHT | SDL_HAT_DOWN)
#define SDL_HAT_LEFTUP (SDL_HAT_LEFT | SDL_HAT_UP)
#define SDL_HAT_LEFTDOWN (SDL_HAT_LEFT | SDL_HAT_DOWN)
// povs
for (int i = 0; i < m_data.povs.count; ++i) {
auto& config = m_povConfig[i];
auto& povValue = m_data.povs.povs[i];
povValue = -1;
povValue = 0;
if (IsKeyDown(io, config.key0)) {
povValue = 0;
povValue = SDL_HAT_UP;
} else if (IsKeyDown(io, config.key45)) {
povValue = 45;
povValue = SDL_HAT_RIGHTUP;
} else if (IsKeyDown(io, config.key90)) {
povValue = 90;
povValue = SDL_HAT_RIGHT;
} else if (IsKeyDown(io, config.key135)) {
povValue = 135;
povValue = SDL_HAT_RIGHTDOWN;
} else if (IsKeyDown(io, config.key180)) {
povValue = 180;
povValue = SDL_HAT_DOWN;
} else if (IsKeyDown(io, config.key225)) {
povValue = 225;
povValue = SDL_HAT_LEFTDOWN;
} else if (IsKeyDown(io, config.key270)) {
povValue = 270;
povValue = SDL_HAT_LEFT;
} else if (IsKeyDown(io, config.key315)) {
povValue = 315;
povValue = SDL_HAT_LEFTUP;
}
}
@@ -1326,7 +1320,7 @@ static void DisplayJoysticks() {
ImGui::PushID(i);
if (disableDS) {
ImGui::Text("%s", joy.data.desc.name);
ImGui::Text("Gamepad: %s", joy.data.desc.isXbox ? "Yes" : "No");
ImGui::Text("Gamepad: %s", joy.data.desc.isGamepad ? "Yes" : "No");
} else {
ImGui::Text("%d: %s", joy.sys->GetIndex(), joy.sys->GetName());

View File

@@ -387,7 +387,7 @@ int DriverStation::GetStickButtonCount(int stick) {
return buttons.count;
}
bool DriverStation::GetJoystickIsXbox(int stick) {
bool DriverStation::GetJoystickIsGamepad(int stick) {
if (stick < 0 || stick >= kJoystickPorts) {
FRC_ReportError(warn::BadJoystickIndex, "stick {} out of range", stick);
return false;
@@ -396,7 +396,7 @@ bool DriverStation::GetJoystickIsXbox(int stick) {
HAL_JoystickDescriptor descriptor;
HAL_GetJoystickDescriptor(stick, &descriptor);
return static_cast<bool>(descriptor.isXbox);
return static_cast<bool>(descriptor.isGamepad);
}
int DriverStation::GetJoystickType(int stick) {

View File

@@ -225,8 +225,8 @@ void DriverStationSim::SetJoystickButtonCount(int stick, int count) {
HALSIM_SetJoystickButtonCount(stick, count);
}
void DriverStationSim::SetJoystickIsXbox(int stick, bool isXbox) {
HALSIM_SetJoystickIsXbox(stick, isXbox);
void DriverStationSim::SetJoystickIsGamepad(int stick, bool isGamepad) {
HALSIM_SetJoystickIsGamepad(stick, isGamepad);
}
void DriverStationSim::SetJoystickType(int stick, int type) {

View File

@@ -135,7 +135,7 @@ class DriverStation final {
* @param stick The joystick port number
* @return A boolean that is true if the controller is an xbox controller.
*/
static bool GetJoystickIsXbox(int stick);
static bool GetJoystickIsGamepad(int stick);
/**
* Returns the type of joystick at a given port.

View File

@@ -323,12 +323,12 @@ class DriverStationSim {
static void SetJoystickButtonCount(int stick, int count);
/**
* Sets the value of isXbox for a joystick.
* Sets the value of isGamepad for a joystick.
*
* @param stick The joystick number
* @param isXbox The value of isXbox
* @param isGamepad The value of isGamepad
*/
static void SetJoystickIsXbox(int stick, bool isXbox);
static void SetJoystickIsGamepad(int stick, bool isGamepad);
/**
* Sets the value of type for a joystick.

View File

@@ -47,24 +47,24 @@ public final class DriverStation {
}
private static class HALJoystickAxesRaw {
public final int[] m_axes;
public final short[] m_axes;
@SuppressWarnings("unused")
public int m_count;
HALJoystickAxesRaw(int count) {
m_axes = new int[count];
m_axes = new short[count];
}
}
private static class HALJoystickPOVs {
public final short[] m_povs;
public final byte[] m_povs;
public int m_count;
HALJoystickPOVs(int count) {
m_povs = new short[count];
m_povs = new byte[count];
for (int i = 0; i < count; i++) {
m_povs[i] = -1;
m_povs[i] = 0;
}
}
}
@@ -779,17 +779,17 @@ public final class DriverStation {
}
/**
* Gets the value of isXbox on a joystick.
* Gets the value of isGamepad on a joystick.
*
* @param stick The joystick port number
* @return A boolean that returns the value of isXbox
* @return A boolean that returns the value of isGamepad
*/
public static boolean getJoystickIsXbox(int stick) {
public static boolean getJoystickIsGamepad(int stick) {
if (stick < 0 || stick >= kJoystickPorts) {
throw new IllegalArgumentException("Joystick index is out of range, should be 0-5");
}
return DriverStationJNI.getJoystickIsXbox((byte) stick) == 1;
return DriverStationJNI.getJoystickIsGamepad((byte) stick) == 1;
}
/**

View File

@@ -411,13 +411,13 @@ public final class DriverStationSim {
}
/**
* Sets the value of isXbox for a joystick.
* Sets the value of isGamepad for a joystick.
*
* @param stick The joystick number
* @param isXbox The value of isXbox
* @param isGamepad The value of isGamepad
*/
public static void setJoystickIsXbox(int stick, boolean isXbox) {
DriverStationDataJNI.setJoystickIsXbox(stick, isXbox);
public static void setJoystickIsGamepad(int stick, boolean isGamepad) {
DriverStationDataJNI.setJoystickIsGamepad(stick, isGamepad);
}
/**