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