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 01e15ceb2e..2db961af9b 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 @@ -104,166 +104,212 @@ static const uint8_t file_descriptor[] { 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,0x42,0x0f,0x0a,0x0d,0x63,0x6f,0x6d,0x2e,0x6d, -0x72,0x63,0x2e,0x70,0x72,0x6f,0x74,0x6f,0x4a,0xa1, -0x0c,0x0a,0x06,0x12,0x04,0x00,0x00,0x2e,0x01,0x0a, -0x08,0x0a,0x01,0x0c,0x12,0x03,0x00,0x00,0x12,0x0a, -0x08,0x0a,0x01,0x02,0x12,0x03,0x02,0x00,0x12,0x0a, -0x08,0x0a,0x01,0x08,0x12,0x03,0x04,0x00,0x26,0x0a, -0x09,0x0a,0x02,0x08,0x01,0x12,0x03,0x04,0x00,0x26, -0x0a,0x0a,0x0a,0x02,0x04,0x00,0x12,0x04,0x06,0x00, -0x0b,0x01,0x0a,0x0a,0x0a,0x03,0x04,0x00,0x01,0x12, -0x03,0x06,0x08,0x1c,0x0a,0x0b,0x0a,0x04,0x04,0x00, -0x02,0x00,0x12,0x03,0x07,0x04,0x1b,0x0a,0x0c,0x0a, -0x05,0x04,0x00,0x02,0x00,0x05,0x12,0x03,0x07,0x04, -0x0a,0x0a,0x0c,0x0a,0x05,0x04,0x00,0x02,0x00,0x01, -0x12,0x03,0x07,0x0b,0x16,0x0a,0x0c,0x0a,0x05,0x04, -0x00,0x02,0x00,0x03,0x12,0x03,0x07,0x19,0x1a,0x0a, -0x0b,0x0a,0x04,0x04,0x00,0x02,0x01,0x12,0x03,0x08, -0x04,0x18,0x0a,0x0c,0x0a,0x05,0x04,0x00,0x02,0x01, -0x05,0x12,0x03,0x08,0x04,0x0b,0x0a,0x0c,0x0a,0x05, -0x04,0x00,0x02,0x01,0x01,0x12,0x03,0x08,0x0c,0x13, -0x0a,0x0c,0x0a,0x05,0x04,0x00,0x02,0x01,0x03,0x12, -0x03,0x08,0x16,0x17,0x0a,0x0b,0x0a,0x04,0x04,0x00, -0x02,0x02,0x12,0x03,0x09,0x04,0x1c,0x0a,0x0c,0x0a, -0x05,0x04,0x00,0x02,0x02,0x04,0x12,0x03,0x09,0x04, -0x0c,0x0a,0x0c,0x0a,0x05,0x04,0x00,0x02,0x02,0x05, -0x12,0x03,0x09,0x0d,0x12,0x0a,0x0c,0x0a,0x05,0x04, -0x00,0x02,0x02,0x01,0x12,0x03,0x09,0x13,0x17,0x0a, -0x0c,0x0a,0x05,0x04,0x00,0x02,0x02,0x03,0x12,0x03, -0x09,0x1a,0x1b,0x0a,0x0b,0x0a,0x04,0x04,0x00,0x02, -0x03,0x12,0x03,0x0a,0x04,0x1d,0x0a,0x0c,0x0a,0x05, -0x04,0x00,0x02,0x03,0x04,0x12,0x03,0x0a,0x04,0x0c, -0x0a,0x0c,0x0a,0x05,0x04,0x00,0x02,0x03,0x05,0x12, -0x03,0x0a,0x0d,0x13,0x0a,0x0c,0x0a,0x05,0x04,0x00, -0x02,0x03,0x01,0x12,0x03,0x0a,0x14,0x18,0x0a,0x0c, -0x0a,0x05,0x04,0x00,0x02,0x03,0x03,0x12,0x03,0x0a, -0x1b,0x1c,0x0a,0x0a,0x0a,0x02,0x04,0x01,0x12,0x04, -0x0d,0x00,0x12,0x01,0x0a,0x0a,0x0a,0x03,0x04,0x01, -0x01,0x12,0x03,0x0d,0x08,0x1b,0x0a,0x0b,0x0a,0x04, -0x04,0x01,0x02,0x00,0x12,0x03,0x0e,0x04,0x1b,0x0a, -0x0c,0x0a,0x05,0x04,0x01,0x02,0x00,0x05,0x12,0x03, -0x0e,0x04,0x0a,0x0a,0x0c,0x0a,0x05,0x04,0x01,0x02, -0x00,0x01,0x12,0x03,0x0e,0x0b,0x16,0x0a,0x0c,0x0a, -0x05,0x04,0x01,0x02,0x00,0x03,0x12,0x03,0x0e,0x19, -0x1a,0x0a,0x0b,0x0a,0x04,0x04,0x01,0x02,0x01,0x12, -0x03,0x0f,0x04,0x18,0x0a,0x0c,0x0a,0x05,0x04,0x01, -0x02,0x01,0x05,0x12,0x03,0x0f,0x04,0x09,0x0a,0x0c, -0x0a,0x05,0x04,0x01,0x02,0x01,0x01,0x12,0x03,0x0f, -0x0a,0x13,0x0a,0x0c,0x0a,0x05,0x04,0x01,0x02,0x01, -0x03,0x12,0x03,0x0f,0x16,0x17,0x0a,0x0b,0x0a,0x04, -0x04,0x01,0x02,0x02,0x12,0x03,0x10,0x04,0x30,0x0a, -0x0c,0x0a,0x05,0x04,0x01,0x02,0x02,0x04,0x12,0x03, -0x10,0x04,0x0c,0x0a,0x0c,0x0a,0x05,0x04,0x01,0x02, -0x02,0x06,0x12,0x03,0x10,0x0d,0x21,0x0a,0x0c,0x0a, -0x05,0x04,0x01,0x02,0x02,0x01,0x12,0x03,0x10,0x22, -0x2b,0x0a,0x0c,0x0a,0x05,0x04,0x01,0x02,0x02,0x03, -0x12,0x03,0x10,0x2e,0x2f,0x0a,0x0b,0x0a,0x04,0x04, -0x01,0x02,0x03,0x12,0x03,0x11,0x04,0x16,0x0a,0x0c, -0x0a,0x05,0x04,0x01,0x02,0x03,0x05,0x12,0x03,0x11, -0x04,0x0a,0x0a,0x0c,0x0a,0x05,0x04,0x01,0x02,0x03, -0x01,0x12,0x03,0x11,0x0b,0x11,0x0a,0x0c,0x0a,0x05, -0x04,0x01,0x02,0x03,0x03,0x12,0x03,0x11,0x14,0x15, -0x0a,0x0a,0x0a,0x02,0x04,0x02,0x12,0x04,0x14,0x00, -0x1b,0x01,0x0a,0x0a,0x0a,0x03,0x04,0x02,0x01,0x12, -0x03,0x14,0x08,0x22,0x0a,0x0b,0x0a,0x04,0x04,0x02, -0x02,0x00,0x12,0x03,0x15,0x04,0x1c,0x0a,0x0c,0x0a, -0x05,0x04,0x02,0x02,0x00,0x05,0x12,0x03,0x15,0x04, -0x0a,0x0a,0x0c,0x0a,0x05,0x04,0x02,0x02,0x00,0x01, -0x12,0x03,0x15,0x0b,0x17,0x0a,0x0c,0x0a,0x05,0x04, -0x02,0x02,0x00,0x03,0x12,0x03,0x15,0x1a,0x1b,0x0a, -0x0b,0x0a,0x04,0x04,0x02,0x02,0x01,0x12,0x03,0x16, -0x04,0x21,0x0a,0x0c,0x0a,0x05,0x04,0x02,0x02,0x01, -0x04,0x12,0x03,0x16,0x04,0x0c,0x0a,0x0c,0x0a,0x05, -0x04,0x02,0x02,0x01,0x05,0x12,0x03,0x16,0x0d,0x12, -0x0a,0x0c,0x0a,0x05,0x04,0x02,0x02,0x01,0x01,0x12, -0x03,0x16,0x13,0x1c,0x0a,0x0c,0x0a,0x05,0x04,0x02, -0x02,0x01,0x03,0x12,0x03,0x16,0x1f,0x20,0x0a,0x0b, -0x0a,0x04,0x04,0x02,0x02,0x02,0x12,0x03,0x17,0x04, -0x14,0x0a,0x0c,0x0a,0x05,0x04,0x02,0x02,0x02,0x05, -0x12,0x03,0x17,0x04,0x08,0x0a,0x0c,0x0a,0x05,0x04, -0x02,0x02,0x02,0x01,0x12,0x03,0x17,0x09,0x0f,0x0a, -0x0c,0x0a,0x05,0x04,0x02,0x02,0x02,0x03,0x12,0x03, -0x17,0x12,0x13,0x0a,0x0b,0x0a,0x04,0x04,0x02,0x02, -0x03,0x12,0x03,0x18,0x04,0x1b,0x0a,0x0c,0x0a,0x05, -0x04,0x02,0x02,0x03,0x05,0x12,0x03,0x18,0x04,0x09, -0x0a,0x0c,0x0a,0x05,0x04,0x02,0x02,0x03,0x01,0x12, -0x03,0x18,0x0a,0x16,0x0a,0x0c,0x0a,0x05,0x04,0x02, -0x02,0x03,0x03,0x12,0x03,0x18,0x19,0x1a,0x0a,0x0b, -0x0a,0x04,0x04,0x02,0x02,0x04,0x12,0x03,0x19,0x04, -0x1a,0x0a,0x0c,0x0a,0x05,0x04,0x02,0x02,0x04,0x05, -0x12,0x03,0x19,0x04,0x09,0x0a,0x0c,0x0a,0x05,0x04, -0x02,0x02,0x04,0x01,0x12,0x03,0x19,0x0a,0x15,0x0a, -0x0c,0x0a,0x05,0x04,0x02,0x02,0x04,0x03,0x12,0x03, -0x19,0x18,0x19,0x0a,0x0b,0x0a,0x04,0x04,0x02,0x02, -0x05,0x12,0x03,0x1a,0x04,0x17,0x0a,0x0c,0x0a,0x05, -0x04,0x02,0x02,0x05,0x05,0x12,0x03,0x1a,0x04,0x09, -0x0a,0x0c,0x0a,0x05,0x04,0x02,0x02,0x05,0x01,0x12, -0x03,0x1a,0x0a,0x12,0x0a,0x0c,0x0a,0x05,0x04,0x02, -0x02,0x05,0x03,0x12,0x03,0x1a,0x15,0x16,0x0a,0x0a, -0x0a,0x02,0x04,0x03,0x12,0x04,0x1d,0x00,0x21,0x01, -0x0a,0x0a,0x0a,0x03,0x04,0x03,0x01,0x12,0x03,0x1d, -0x08,0x22,0x0a,0x0b,0x0a,0x04,0x04,0x03,0x02,0x00, -0x12,0x03,0x1e,0x04,0x1b,0x0a,0x0c,0x0a,0x05,0x04, -0x03,0x02,0x00,0x05,0x12,0x03,0x1e,0x04,0x0b,0x0a, -0x0c,0x0a,0x05,0x04,0x03,0x02,0x00,0x01,0x12,0x03, -0x1e,0x0c,0x16,0x0a,0x0c,0x0a,0x05,0x04,0x03,0x02, -0x00,0x03,0x12,0x03,0x1e,0x19,0x1a,0x0a,0x0b,0x0a, -0x04,0x04,0x03,0x02,0x01,0x12,0x03,0x1f,0x04,0x19, -0x0a,0x0c,0x0a,0x05,0x04,0x03,0x02,0x01,0x05,0x12, -0x03,0x1f,0x04,0x09,0x0a,0x0c,0x0a,0x05,0x04,0x03, -0x02,0x01,0x01,0x12,0x03,0x1f,0x0a,0x14,0x0a,0x0c, -0x0a,0x05,0x04,0x03,0x02,0x01,0x03,0x12,0x03,0x1f, -0x17,0x18,0x0a,0x0b,0x0a,0x04,0x04,0x03,0x02,0x02, -0x12,0x03,0x20,0x04,0x1a,0x0a,0x0c,0x0a,0x05,0x04, -0x03,0x02,0x02,0x05,0x12,0x03,0x20,0x04,0x09,0x0a, -0x0c,0x0a,0x05,0x04,0x03,0x02,0x02,0x01,0x12,0x03, -0x20,0x0a,0x15,0x0a,0x0c,0x0a,0x05,0x04,0x03,0x02, -0x02,0x03,0x12,0x03,0x20,0x18,0x19,0x0a,0x0a,0x0a, -0x02,0x04,0x04,0x12,0x04,0x23,0x00,0x27,0x01,0x0a, -0x0a,0x0a,0x03,0x04,0x04,0x01,0x12,0x03,0x23,0x08, -0x1b,0x0a,0x0b,0x0a,0x04,0x04,0x04,0x02,0x00,0x12, -0x03,0x24,0x04,0x19,0x0a,0x0c,0x0a,0x05,0x04,0x04, -0x02,0x00,0x05,0x12,0x03,0x24,0x04,0x0b,0x0a,0x0c, -0x0a,0x05,0x04,0x04,0x02,0x00,0x01,0x12,0x03,0x24, -0x0c,0x14,0x0a,0x0c,0x0a,0x05,0x04,0x04,0x02,0x00, -0x03,0x12,0x03,0x24,0x17,0x18,0x0a,0x0b,0x0a,0x04, -0x04,0x04,0x02,0x01,0x12,0x03,0x25,0x04,0x14,0x0a, -0x0c,0x0a,0x05,0x04,0x04,0x02,0x01,0x05,0x12,0x03, -0x25,0x04,0x0a,0x0a,0x0c,0x0a,0x05,0x04,0x04,0x02, -0x01,0x01,0x12,0x03,0x25,0x0b,0x0f,0x0a,0x0c,0x0a, -0x05,0x04,0x04,0x02,0x01,0x03,0x12,0x03,0x25,0x12, -0x13,0x0a,0x0b,0x0a,0x04,0x04,0x04,0x02,0x02,0x12, -0x03,0x26,0x04,0x17,0x0a,0x0c,0x0a,0x05,0x04,0x04, -0x02,0x02,0x05,0x12,0x03,0x26,0x04,0x0a,0x0a,0x0c, -0x0a,0x05,0x04,0x04,0x02,0x02,0x01,0x12,0x03,0x26, -0x0b,0x12,0x0a,0x0c,0x0a,0x05,0x04,0x04,0x02,0x02, -0x03,0x12,0x03,0x26,0x15,0x16,0x0a,0x0a,0x0a,0x02, -0x04,0x05,0x12,0x04,0x29,0x00,0x2e,0x01,0x0a,0x0a, -0x0a,0x03,0x04,0x05,0x01,0x12,0x03,0x29,0x08,0x19, -0x0a,0x0b,0x0a,0x04,0x04,0x05,0x02,0x00,0x12,0x03, -0x2a,0x04,0x19,0x0a,0x0c,0x0a,0x05,0x04,0x05,0x02, -0x00,0x05,0x12,0x03,0x2a,0x04,0x0a,0x0a,0x0c,0x0a, -0x05,0x04,0x05,0x02,0x00,0x01,0x12,0x03,0x2a,0x0b, -0x14,0x0a,0x0c,0x0a,0x05,0x04,0x05,0x02,0x00,0x03, -0x12,0x03,0x2a,0x17,0x18,0x0a,0x0b,0x0a,0x04,0x04, -0x05,0x02,0x01,0x12,0x03,0x2b,0x04,0x1a,0x0a,0x0c, -0x0a,0x05,0x04,0x05,0x02,0x01,0x05,0x12,0x03,0x2b, -0x04,0x09,0x0a,0x0c,0x0a,0x05,0x04,0x05,0x02,0x01, -0x01,0x12,0x03,0x2b,0x0a,0x15,0x0a,0x0c,0x0a,0x05, -0x04,0x05,0x02,0x01,0x03,0x12,0x03,0x2b,0x18,0x19, -0x0a,0x0b,0x0a,0x04,0x04,0x05,0x02,0x02,0x12,0x03, -0x2c,0x04,0x1b,0x0a,0x0c,0x0a,0x05,0x04,0x05,0x02, -0x02,0x05,0x12,0x03,0x2c,0x04,0x09,0x0a,0x0c,0x0a, -0x05,0x04,0x05,0x02,0x02,0x01,0x12,0x03,0x2c,0x0a, -0x16,0x0a,0x0c,0x0a,0x05,0x04,0x05,0x02,0x02,0x03, -0x12,0x03,0x2c,0x19,0x1a,0x0a,0x0b,0x0a,0x04,0x04, -0x05,0x02,0x03,0x12,0x03,0x2d,0x04,0x18,0x0a,0x0c, -0x0a,0x05,0x04,0x05,0x02,0x03,0x05,0x12,0x03,0x2d, -0x04,0x09,0x0a,0x0c,0x0a,0x05,0x04,0x05,0x02,0x03, -0x01,0x12,0x03,0x2d,0x0a,0x13,0x0a,0x0c,0x0a,0x05, -0x04,0x05,0x02,0x03,0x03,0x12,0x03,0x2d,0x16,0x17, -0x62,0x06,0x70,0x72,0x6f,0x74,0x6f,0x33, +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,0x42,0x0f,0x0a,0x0d,0x63,0x6f,0x6d, +0x2e,0x6d,0x72,0x63,0x2e,0x70,0x72,0x6f,0x74,0x6f, +0x4a,0xcc,0x0e,0x0a,0x06,0x12,0x04,0x00,0x00,0x36, +0x01,0x0a,0x08,0x0a,0x01,0x0c,0x12,0x03,0x00,0x00, +0x12,0x0a,0x08,0x0a,0x01,0x02,0x12,0x03,0x02,0x00, +0x12,0x0a,0x08,0x0a,0x01,0x08,0x12,0x03,0x04,0x00, +0x26,0x0a,0x09,0x0a,0x02,0x08,0x01,0x12,0x03,0x04, +0x00,0x26,0x0a,0x0a,0x0a,0x02,0x04,0x00,0x12,0x04, +0x06,0x00,0x0b,0x01,0x0a,0x0a,0x0a,0x03,0x04,0x00, +0x01,0x12,0x03,0x06,0x08,0x1c,0x0a,0x0b,0x0a,0x04, +0x04,0x00,0x02,0x00,0x12,0x03,0x07,0x04,0x1b,0x0a, +0x0c,0x0a,0x05,0x04,0x00,0x02,0x00,0x05,0x12,0x03, +0x07,0x04,0x0a,0x0a,0x0c,0x0a,0x05,0x04,0x00,0x02, +0x00,0x01,0x12,0x03,0x07,0x0b,0x16,0x0a,0x0c,0x0a, +0x05,0x04,0x00,0x02,0x00,0x03,0x12,0x03,0x07,0x19, +0x1a,0x0a,0x0b,0x0a,0x04,0x04,0x00,0x02,0x01,0x12, +0x03,0x08,0x04,0x18,0x0a,0x0c,0x0a,0x05,0x04,0x00, +0x02,0x01,0x05,0x12,0x03,0x08,0x04,0x0b,0x0a,0x0c, +0x0a,0x05,0x04,0x00,0x02,0x01,0x01,0x12,0x03,0x08, +0x0c,0x13,0x0a,0x0c,0x0a,0x05,0x04,0x00,0x02,0x01, +0x03,0x12,0x03,0x08,0x16,0x17,0x0a,0x0b,0x0a,0x04, +0x04,0x00,0x02,0x02,0x12,0x03,0x09,0x04,0x1c,0x0a, +0x0c,0x0a,0x05,0x04,0x00,0x02,0x02,0x04,0x12,0x03, +0x09,0x04,0x0c,0x0a,0x0c,0x0a,0x05,0x04,0x00,0x02, +0x02,0x05,0x12,0x03,0x09,0x0d,0x12,0x0a,0x0c,0x0a, +0x05,0x04,0x00,0x02,0x02,0x01,0x12,0x03,0x09,0x13, +0x17,0x0a,0x0c,0x0a,0x05,0x04,0x00,0x02,0x02,0x03, +0x12,0x03,0x09,0x1a,0x1b,0x0a,0x0b,0x0a,0x04,0x04, +0x00,0x02,0x03,0x12,0x03,0x0a,0x04,0x1d,0x0a,0x0c, +0x0a,0x05,0x04,0x00,0x02,0x03,0x04,0x12,0x03,0x0a, +0x04,0x0c,0x0a,0x0c,0x0a,0x05,0x04,0x00,0x02,0x03, +0x05,0x12,0x03,0x0a,0x0d,0x13,0x0a,0x0c,0x0a,0x05, +0x04,0x00,0x02,0x03,0x01,0x12,0x03,0x0a,0x14,0x18, +0x0a,0x0c,0x0a,0x05,0x04,0x00,0x02,0x03,0x03,0x12, +0x03,0x0a,0x1b,0x1c,0x0a,0x0a,0x0a,0x02,0x04,0x01, +0x12,0x04,0x0d,0x00,0x12,0x01,0x0a,0x0a,0x0a,0x03, +0x04,0x01,0x01,0x12,0x03,0x0d,0x08,0x1b,0x0a,0x0b, +0x0a,0x04,0x04,0x01,0x02,0x00,0x12,0x03,0x0e,0x04, +0x1b,0x0a,0x0c,0x0a,0x05,0x04,0x01,0x02,0x00,0x05, +0x12,0x03,0x0e,0x04,0x0a,0x0a,0x0c,0x0a,0x05,0x04, +0x01,0x02,0x00,0x01,0x12,0x03,0x0e,0x0b,0x16,0x0a, +0x0c,0x0a,0x05,0x04,0x01,0x02,0x00,0x03,0x12,0x03, +0x0e,0x19,0x1a,0x0a,0x0b,0x0a,0x04,0x04,0x01,0x02, +0x01,0x12,0x03,0x0f,0x04,0x18,0x0a,0x0c,0x0a,0x05, +0x04,0x01,0x02,0x01,0x05,0x12,0x03,0x0f,0x04,0x09, +0x0a,0x0c,0x0a,0x05,0x04,0x01,0x02,0x01,0x01,0x12, +0x03,0x0f,0x0a,0x13,0x0a,0x0c,0x0a,0x05,0x04,0x01, +0x02,0x01,0x03,0x12,0x03,0x0f,0x16,0x17,0x0a,0x0b, +0x0a,0x04,0x04,0x01,0x02,0x02,0x12,0x03,0x10,0x04, +0x30,0x0a,0x0c,0x0a,0x05,0x04,0x01,0x02,0x02,0x04, +0x12,0x03,0x10,0x04,0x0c,0x0a,0x0c,0x0a,0x05,0x04, +0x01,0x02,0x02,0x06,0x12,0x03,0x10,0x0d,0x21,0x0a, +0x0c,0x0a,0x05,0x04,0x01,0x02,0x02,0x01,0x12,0x03, +0x10,0x22,0x2b,0x0a,0x0c,0x0a,0x05,0x04,0x01,0x02, +0x02,0x03,0x12,0x03,0x10,0x2e,0x2f,0x0a,0x0b,0x0a, +0x04,0x04,0x01,0x02,0x03,0x12,0x03,0x11,0x04,0x16, +0x0a,0x0c,0x0a,0x05,0x04,0x01,0x02,0x03,0x05,0x12, +0x03,0x11,0x04,0x0a,0x0a,0x0c,0x0a,0x05,0x04,0x01, +0x02,0x03,0x01,0x12,0x03,0x11,0x0b,0x11,0x0a,0x0c, +0x0a,0x05,0x04,0x01,0x02,0x03,0x03,0x12,0x03,0x11, +0x14,0x15,0x0a,0x0a,0x0a,0x02,0x04,0x02,0x12,0x04, +0x14,0x00,0x1b,0x01,0x0a,0x0a,0x0a,0x03,0x04,0x02, +0x01,0x12,0x03,0x14,0x08,0x22,0x0a,0x0b,0x0a,0x04, +0x04,0x02,0x02,0x00,0x12,0x03,0x15,0x04,0x1c,0x0a, +0x0c,0x0a,0x05,0x04,0x02,0x02,0x00,0x05,0x12,0x03, +0x15,0x04,0x0a,0x0a,0x0c,0x0a,0x05,0x04,0x02,0x02, +0x00,0x01,0x12,0x03,0x15,0x0b,0x17,0x0a,0x0c,0x0a, +0x05,0x04,0x02,0x02,0x00,0x03,0x12,0x03,0x15,0x1a, +0x1b,0x0a,0x0b,0x0a,0x04,0x04,0x02,0x02,0x01,0x12, +0x03,0x16,0x04,0x21,0x0a,0x0c,0x0a,0x05,0x04,0x02, +0x02,0x01,0x04,0x12,0x03,0x16,0x04,0x0c,0x0a,0x0c, +0x0a,0x05,0x04,0x02,0x02,0x01,0x05,0x12,0x03,0x16, +0x0d,0x12,0x0a,0x0c,0x0a,0x05,0x04,0x02,0x02,0x01, +0x01,0x12,0x03,0x16,0x13,0x1c,0x0a,0x0c,0x0a,0x05, +0x04,0x02,0x02,0x01,0x03,0x12,0x03,0x16,0x1f,0x20, +0x0a,0x0b,0x0a,0x04,0x04,0x02,0x02,0x02,0x12,0x03, +0x17,0x04,0x14,0x0a,0x0c,0x0a,0x05,0x04,0x02,0x02, +0x02,0x05,0x12,0x03,0x17,0x04,0x08,0x0a,0x0c,0x0a, +0x05,0x04,0x02,0x02,0x02,0x01,0x12,0x03,0x17,0x09, +0x0f,0x0a,0x0c,0x0a,0x05,0x04,0x02,0x02,0x02,0x03, +0x12,0x03,0x17,0x12,0x13,0x0a,0x0b,0x0a,0x04,0x04, +0x02,0x02,0x03,0x12,0x03,0x18,0x04,0x1b,0x0a,0x0c, +0x0a,0x05,0x04,0x02,0x02,0x03,0x05,0x12,0x03,0x18, +0x04,0x09,0x0a,0x0c,0x0a,0x05,0x04,0x02,0x02,0x03, +0x01,0x12,0x03,0x18,0x0a,0x16,0x0a,0x0c,0x0a,0x05, +0x04,0x02,0x02,0x03,0x03,0x12,0x03,0x18,0x19,0x1a, +0x0a,0x0b,0x0a,0x04,0x04,0x02,0x02,0x04,0x12,0x03, +0x19,0x04,0x1a,0x0a,0x0c,0x0a,0x05,0x04,0x02,0x02, +0x04,0x05,0x12,0x03,0x19,0x04,0x09,0x0a,0x0c,0x0a, +0x05,0x04,0x02,0x02,0x04,0x01,0x12,0x03,0x19,0x0a, +0x15,0x0a,0x0c,0x0a,0x05,0x04,0x02,0x02,0x04,0x03, +0x12,0x03,0x19,0x18,0x19,0x0a,0x0b,0x0a,0x04,0x04, +0x02,0x02,0x05,0x12,0x03,0x1a,0x04,0x17,0x0a,0x0c, +0x0a,0x05,0x04,0x02,0x02,0x05,0x05,0x12,0x03,0x1a, +0x04,0x09,0x0a,0x0c,0x0a,0x05,0x04,0x02,0x02,0x05, +0x01,0x12,0x03,0x1a,0x0a,0x12,0x0a,0x0c,0x0a,0x05, +0x04,0x02,0x02,0x05,0x03,0x12,0x03,0x1a,0x15,0x16, +0x0a,0x0a,0x0a,0x02,0x04,0x03,0x12,0x04,0x1d,0x00, +0x21,0x01,0x0a,0x0a,0x0a,0x03,0x04,0x03,0x01,0x12, +0x03,0x1d,0x08,0x22,0x0a,0x0b,0x0a,0x04,0x04,0x03, +0x02,0x00,0x12,0x03,0x1e,0x04,0x1b,0x0a,0x0c,0x0a, +0x05,0x04,0x03,0x02,0x00,0x05,0x12,0x03,0x1e,0x04, +0x0b,0x0a,0x0c,0x0a,0x05,0x04,0x03,0x02,0x00,0x01, +0x12,0x03,0x1e,0x0c,0x16,0x0a,0x0c,0x0a,0x05,0x04, +0x03,0x02,0x00,0x03,0x12,0x03,0x1e,0x19,0x1a,0x0a, +0x0b,0x0a,0x04,0x04,0x03,0x02,0x01,0x12,0x03,0x1f, +0x04,0x19,0x0a,0x0c,0x0a,0x05,0x04,0x03,0x02,0x01, +0x05,0x12,0x03,0x1f,0x04,0x09,0x0a,0x0c,0x0a,0x05, +0x04,0x03,0x02,0x01,0x01,0x12,0x03,0x1f,0x0a,0x14, +0x0a,0x0c,0x0a,0x05,0x04,0x03,0x02,0x01,0x03,0x12, +0x03,0x1f,0x17,0x18,0x0a,0x0b,0x0a,0x04,0x04,0x03, +0x02,0x02,0x12,0x03,0x20,0x04,0x1a,0x0a,0x0c,0x0a, +0x05,0x04,0x03,0x02,0x02,0x05,0x12,0x03,0x20,0x04, +0x09,0x0a,0x0c,0x0a,0x05,0x04,0x03,0x02,0x02,0x01, +0x12,0x03,0x20,0x0a,0x15,0x0a,0x0c,0x0a,0x05,0x04, +0x03,0x02,0x02,0x03,0x12,0x03,0x20,0x18,0x19,0x0a, +0x0a,0x0a,0x02,0x04,0x04,0x12,0x04,0x23,0x00,0x27, +0x01,0x0a,0x0a,0x0a,0x03,0x04,0x04,0x01,0x12,0x03, +0x23,0x08,0x1b,0x0a,0x0b,0x0a,0x04,0x04,0x04,0x02, +0x00,0x12,0x03,0x24,0x04,0x19,0x0a,0x0c,0x0a,0x05, +0x04,0x04,0x02,0x00,0x05,0x12,0x03,0x24,0x04,0x0b, +0x0a,0x0c,0x0a,0x05,0x04,0x04,0x02,0x00,0x01,0x12, +0x03,0x24,0x0c,0x14,0x0a,0x0c,0x0a,0x05,0x04,0x04, +0x02,0x00,0x03,0x12,0x03,0x24,0x17,0x18,0x0a,0x0b, +0x0a,0x04,0x04,0x04,0x02,0x01,0x12,0x03,0x25,0x04, +0x14,0x0a,0x0c,0x0a,0x05,0x04,0x04,0x02,0x01,0x05, +0x12,0x03,0x25,0x04,0x0a,0x0a,0x0c,0x0a,0x05,0x04, +0x04,0x02,0x01,0x01,0x12,0x03,0x25,0x0b,0x0f,0x0a, +0x0c,0x0a,0x05,0x04,0x04,0x02,0x01,0x03,0x12,0x03, +0x25,0x12,0x13,0x0a,0x0b,0x0a,0x04,0x04,0x04,0x02, +0x02,0x12,0x03,0x26,0x04,0x17,0x0a,0x0c,0x0a,0x05, +0x04,0x04,0x02,0x02,0x05,0x12,0x03,0x26,0x04,0x0a, +0x0a,0x0c,0x0a,0x05,0x04,0x04,0x02,0x02,0x01,0x12, +0x03,0x26,0x0b,0x12,0x0a,0x0c,0x0a,0x05,0x04,0x04, +0x02,0x02,0x03,0x12,0x03,0x26,0x15,0x16,0x0a,0x0a, +0x0a,0x02,0x04,0x05,0x12,0x04,0x29,0x00,0x2e,0x01, +0x0a,0x0a,0x0a,0x03,0x04,0x05,0x01,0x12,0x03,0x29, +0x08,0x19,0x0a,0x0b,0x0a,0x04,0x04,0x05,0x02,0x00, +0x12,0x03,0x2a,0x04,0x19,0x0a,0x0c,0x0a,0x05,0x04, +0x05,0x02,0x00,0x05,0x12,0x03,0x2a,0x04,0x0a,0x0a, +0x0c,0x0a,0x05,0x04,0x05,0x02,0x00,0x01,0x12,0x03, +0x2a,0x0b,0x14,0x0a,0x0c,0x0a,0x05,0x04,0x05,0x02, +0x00,0x03,0x12,0x03,0x2a,0x17,0x18,0x0a,0x0b,0x0a, +0x04,0x04,0x05,0x02,0x01,0x12,0x03,0x2b,0x04,0x1a, +0x0a,0x0c,0x0a,0x05,0x04,0x05,0x02,0x01,0x05,0x12, +0x03,0x2b,0x04,0x09,0x0a,0x0c,0x0a,0x05,0x04,0x05, +0x02,0x01,0x01,0x12,0x03,0x2b,0x0a,0x15,0x0a,0x0c, +0x0a,0x05,0x04,0x05,0x02,0x01,0x03,0x12,0x03,0x2b, +0x18,0x19,0x0a,0x0b,0x0a,0x04,0x04,0x05,0x02,0x02, +0x12,0x03,0x2c,0x04,0x1b,0x0a,0x0c,0x0a,0x05,0x04, +0x05,0x02,0x02,0x05,0x12,0x03,0x2c,0x04,0x09,0x0a, +0x0c,0x0a,0x05,0x04,0x05,0x02,0x02,0x01,0x12,0x03, +0x2c,0x0a,0x16,0x0a,0x0c,0x0a,0x05,0x04,0x05,0x02, +0x02,0x03,0x12,0x03,0x2c,0x19,0x1a,0x0a,0x0b,0x0a, +0x04,0x04,0x05,0x02,0x03,0x12,0x03,0x2d,0x04,0x18, +0x0a,0x0c,0x0a,0x05,0x04,0x05,0x02,0x03,0x05,0x12, +0x03,0x2d,0x04,0x09,0x0a,0x0c,0x0a,0x05,0x04,0x05, +0x02,0x03,0x01,0x12,0x03,0x2d,0x0a,0x13,0x0a,0x0c, +0x0a,0x05,0x04,0x05,0x02,0x03,0x03,0x12,0x03,0x2d, +0x16,0x17,0x0a,0x0a,0x0a,0x02,0x04,0x06,0x12,0x04, +0x30,0x00,0x36,0x01,0x0a,0x0a,0x0a,0x03,0x04,0x06, +0x01,0x12,0x03,0x30,0x08,0x19,0x0a,0x0b,0x0a,0x04, +0x04,0x06,0x02,0x00,0x12,0x03,0x31,0x04,0x15,0x0a, +0x0c,0x0a,0x05,0x04,0x06,0x02,0x00,0x05,0x12,0x03, +0x31,0x04,0x08,0x0a,0x0c,0x0a,0x05,0x04,0x06,0x02, +0x00,0x01,0x12,0x03,0x31,0x09,0x10,0x0a,0x0c,0x0a, +0x05,0x04,0x06,0x02,0x00,0x03,0x12,0x03,0x31,0x13, +0x14,0x0a,0x0b,0x0a,0x04,0x04,0x06,0x02,0x01,0x12, +0x03,0x32,0x04,0x19,0x0a,0x0c,0x0a,0x05,0x04,0x06, +0x02,0x01,0x05,0x12,0x03,0x32,0x04,0x0a,0x0a,0x0c, +0x0a,0x05,0x04,0x06,0x02,0x01,0x01,0x12,0x03,0x32, +0x0b,0x14,0x0a,0x0c,0x0a,0x05,0x04,0x06,0x02,0x01, +0x03,0x12,0x03,0x32,0x17,0x18,0x0a,0x0b,0x0a,0x04, +0x04,0x06,0x02,0x02,0x12,0x03,0x33,0x04,0x17,0x0a, +0x0c,0x0a,0x05,0x04,0x06,0x02,0x02,0x05,0x12,0x03, +0x33,0x04,0x0a,0x0a,0x0c,0x0a,0x05,0x04,0x06,0x02, +0x02,0x01,0x12,0x03,0x33,0x0b,0x12,0x0a,0x0c,0x0a, +0x05,0x04,0x06,0x02,0x02,0x03,0x12,0x03,0x33,0x15, +0x16,0x0a,0x0b,0x0a,0x04,0x04,0x06,0x02,0x03,0x12, +0x03,0x34,0x04,0x18,0x0a,0x0c,0x0a,0x05,0x04,0x06, +0x02,0x03,0x05,0x12,0x03,0x34,0x04,0x0a,0x0a,0x0c, +0x0a,0x05,0x04,0x06,0x02,0x03,0x01,0x12,0x03,0x34, +0x0b,0x13,0x0a,0x0c,0x0a,0x05,0x04,0x06,0x02,0x03, +0x03,0x12,0x03,0x34,0x16,0x17,0x0a,0x0b,0x0a,0x04, +0x04,0x06,0x02,0x04,0x12,0x03,0x35,0x04,0x19,0x0a, +0x0c,0x0a,0x05,0x04,0x06,0x02,0x04,0x05,0x12,0x03, +0x35,0x04,0x0a,0x0a,0x0c,0x0a,0x05,0x04,0x06,0x02, +0x04,0x01,0x12,0x03,0x35,0x0b,0x14,0x0a,0x0c,0x0a, +0x05,0x04,0x06,0x02,0x04,0x03,0x12,0x03,0x35,0x17, +0x18,0x62,0x06,0x70,0x72,0x6f,0x74,0x6f,0x33, }; static const char file_name[] = "MrcComm.proto"; static const char mrc_proto_ProtobufJoystickData_name[] = "mrc.proto.ProtobufJoystickData"; @@ -302,4 +348,10 @@ pb_filedesc_t mrc_proto_ProtobufMatchInfo::file_descriptor(void) noexcept { retu PB_BIND(mrc_proto_ProtobufMatchInfo, mrc_proto_ProtobufMatchInfo, AUTO) +static const char mrc_proto_ProtobufErrorInfo_name[] = "mrc.proto.ProtobufErrorInfo"; +std::string_view mrc_proto_ProtobufErrorInfo::msg_name(void) noexcept { return mrc_proto_ProtobufErrorInfo_name; } +pb_filedesc_t mrc_proto_ProtobufErrorInfo::file_descriptor(void) noexcept { return {::file_name, ::file_descriptor}; } +PB_BIND(mrc_proto_ProtobufErrorInfo, mrc_proto_ProtobufErrorInfo, 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 8818758c1e..9e024839cd 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 @@ -81,6 +81,18 @@ typedef struct _mrc_proto_ProtobufMatchInfo { int32_t MatchType; } mrc_proto_ProtobufMatchInfo; +typedef struct _mrc_proto_ProtobufErrorInfo { + 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; + + bool IsError; + int32_t ErrorCode; + pb_callback_t Details; + pb_callback_t Location; + pb_callback_t CallStack; +} mrc_proto_ProtobufErrorInfo; + /* Initializer values for message structs */ #define mrc_proto_ProtobufJoystickData_init_default {0, 0, {{NULL}, NULL}, {{NULL}, NULL}} @@ -89,12 +101,14 @@ typedef struct _mrc_proto_ProtobufMatchInfo { #define mrc_proto_ProtobufJoystickOutputData_init_default {0, 0, 0} #define mrc_proto_ProtobufVersionInfo_init_default {0, {{NULL}, NULL}, {{NULL}, NULL}} #define mrc_proto_ProtobufMatchInfo_init_default {{{NULL}, NULL}, 0, 0, 0} +#define mrc_proto_ProtobufErrorInfo_init_default {0, 0, {{NULL}, NULL}, {{NULL}, NULL}, {{NULL}, NULL}} #define mrc_proto_ProtobufJoystickData_init_zero {0, 0, {{NULL}, NULL}, {{NULL}, NULL}} #define mrc_proto_ProtobufControlData_init_zero {0, 0, {{NULL}, NULL}, {{NULL}, NULL}} #define mrc_proto_ProtobufJoystickDescriptor_init_zero {{{NULL}, NULL}, {{NULL}, NULL}, 0, 0, 0, 0} #define mrc_proto_ProtobufJoystickOutputData_init_zero {0, 0, 0} #define mrc_proto_ProtobufVersionInfo_init_zero {0, {{NULL}, NULL}, {{NULL}, NULL}} #define mrc_proto_ProtobufMatchInfo_init_zero {{{NULL}, NULL}, 0, 0, 0} +#define mrc_proto_ProtobufErrorInfo_init_zero {0, 0, {{NULL}, NULL}, {{NULL}, NULL}, {{NULL}, NULL}} /* Field tags (for use in manual encoding/decoding) */ #define mrc_proto_ProtobufJoystickData_ButtonCount_tag 1 @@ -121,6 +135,11 @@ typedef struct _mrc_proto_ProtobufMatchInfo { #define mrc_proto_ProtobufMatchInfo_MatchNumber_tag 2 #define mrc_proto_ProtobufMatchInfo_ReplayNumber_tag 3 #define mrc_proto_ProtobufMatchInfo_MatchType_tag 4 +#define mrc_proto_ProtobufErrorInfo_IsError_tag 1 +#define mrc_proto_ProtobufErrorInfo_ErrorCode_tag 2 +#define mrc_proto_ProtobufErrorInfo_Details_tag 3 +#define mrc_proto_ProtobufErrorInfo_Location_tag 4 +#define mrc_proto_ProtobufErrorInfo_CallStack_tag 5 /* Struct field encoding specification for nanopb */ #define mrc_proto_ProtobufJoystickData_FIELDLIST(X, a) \ @@ -172,12 +191,22 @@ X(a, STATIC, SINGULAR, INT32, MatchType, 4) #define mrc_proto_ProtobufMatchInfo_CALLBACK pb_default_field_callback #define mrc_proto_ProtobufMatchInfo_DEFAULT NULL +#define mrc_proto_ProtobufErrorInfo_FIELDLIST(X, a) \ +X(a, STATIC, SINGULAR, BOOL, IsError, 1) \ +X(a, STATIC, SINGULAR, SINT32, ErrorCode, 2) \ +X(a, CALLBACK, SINGULAR, STRING, Details, 3) \ +X(a, CALLBACK, SINGULAR, STRING, Location, 4) \ +X(a, CALLBACK, SINGULAR, STRING, CallStack, 5) +#define mrc_proto_ProtobufErrorInfo_CALLBACK pb_default_field_callback +#define mrc_proto_ProtobufErrorInfo_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_ProtobufVersionInfo_size depends on runtime parameters */ /* mrc_proto_ProtobufMatchInfo_size depends on runtime parameters */ +/* mrc_proto_ProtobufErrorInfo_size depends on runtime parameters */ #define MRC_PROTO_MRCCOMM_NPB_H_MAX_SIZE mrc_proto_ProtobufJoystickOutputData_size #define mrc_proto_ProtobufJoystickOutputData_size 15 diff --git a/hal/src/main/native/cpp/proto/ErrorInfoProto.cpp b/hal/src/main/native/cpp/proto/ErrorInfoProto.cpp new file mode 100644 index 0000000000..e64719f481 --- /dev/null +++ b/hal/src/main/native/cpp/proto/ErrorInfoProto.cpp @@ -0,0 +1,71 @@ +// 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 + +#include "hal/proto/ErrorInfo.h" + +std::optional wpi::Protobuf::Unpack( + InputStream& Stream) { + wpi::UnpackCallback DetailsCb; + wpi::UnpackCallback LocationCb; + wpi::UnpackCallback CallStackCb; + + mrc_proto_ProtobufErrorInfo Msg{ + .IsError = false, + .ErrorCode = 0, + .Details = DetailsCb.Callback(), + .Location = LocationCb.Callback(), + .CallStack = CallStackCb.Callback(), + }; + + if (!Stream.Decode(Msg)) { + return {}; + } + + auto Details = DetailsCb.Items(); + auto Location = LocationCb.Items(); + auto CallStack = CallStackCb.Items(); + + mrc::ErrorInfo ToRet; + ToRet.IsError = Msg.IsError; + ToRet.ErrorCode = Msg.ErrorCode; + + if (!Details.empty()) { + ToRet.MoveDetails(std::move(Details[0])); + } + + if (!Location.empty()) { + ToRet.MoveLocation(std::move(Location[0])); + } + + if (!CallStack.empty()) { + ToRet.MoveCallStack(std::move(CallStack[0])); + } + + return ToRet; +} + +bool wpi::Protobuf::Pack(OutputStream& Stream, + const mrc::ErrorInfo& Value) { + std::string_view DetailsView = Value.GetDetails(); + std::string_view LocationView = Value.GetLocation(); + std::string_view CallStackView = Value.GetCallStack(); + wpi::PackCallback DetailsCb{&DetailsView}; + wpi::PackCallback LocationCb{&LocationView}; + wpi::PackCallback CallStackCb{&CallStackView}; + + mrc_proto_ProtobufErrorInfo Msg{ + .IsError = Value.IsError, + .ErrorCode = Value.ErrorCode, + .Details = DetailsCb.Callback(), + .Location = LocationCb.Callback(), + .CallStack = CallStackCb.Callback(), + }; + + return Stream.Encode(Msg); +} diff --git a/hal/src/main/native/include/hal/proto/ErrorInfo.h b/hal/src/main/native/include/hal/proto/ErrorInfo.h new file mode 100644 index 0000000000..e921160c20 --- /dev/null +++ b/hal/src/main/native/include/hal/proto/ErrorInfo.h @@ -0,0 +1,21 @@ +// Copyright (c) FIRST and other WPILib contributors. +// Open Source Software; you can modify and/or share it under the terms of +// the WPILib BSD license file in the root directory of this project. + +#pragma once + +#include + +#include + +#include "MrcComm.npb.h" +#include "mrc/NetComm.h" + +template <> +struct wpi::Protobuf { + using MessageStruct = mrc_proto_ProtobufErrorInfo; + using InputStream = wpi::ProtoInputStream; + using OutputStream = wpi::ProtoOutputStream; + static std::optional Unpack(InputStream& Stream); + static bool Pack(OutputStream& Stream, const mrc::ErrorInfo& Value); +}; diff --git a/hal/src/main/native/systemcore/FRCDriverStation.cpp b/hal/src/main/native/systemcore/FRCDriverStation.cpp index f80ce6fa4b..613a6cfff3 100644 --- a/hal/src/main/native/systemcore/FRCDriverStation.cpp +++ b/hal/src/main/native/systemcore/FRCDriverStation.cpp @@ -31,6 +31,7 @@ #include "hal/DriverStation.h" #include "hal/Errors.h" #include "hal/proto/ControlData.h" +#include "hal/proto/ErrorInfo.h" #include "hal/proto/JoystickDescriptor.h" #include "hal/proto/JoystickOutputData.h" #include "hal/proto/MatchInfo.h" @@ -77,6 +78,7 @@ struct SystemServerDriverStation { nt::StringPublisher versionPublisher; nt::StringPublisher consoleLinePublisher; + nt::ProtobufPublisher errorInfoPublisher; std::array, MRC_MAX_NUM_JOYSTICKS> @@ -122,6 +124,10 @@ struct SystemServerDriverStation { consoleLinePublisher = ntInst.GetStringTopic(ROBOT_CONSOLE_LINE_PATH).Publish(options); + errorInfoPublisher = + ntInst.GetProtobufTopic(ROBOT_ERROR_INFO_PATH) + .Publish(options); + versionPublisher = ntInst.GetStringTopic(ROBOT_LIB_VERSION_PATH).Publish(options); @@ -342,102 +348,74 @@ extern "C" { int32_t HAL_SendError(HAL_Bool isError, int32_t errorCode, HAL_Bool isLVCode, const char* details, const char* location, const char* callStack, HAL_Bool printMsg) { - return 0; - // // Avoid flooding console by keeping track of previous 5 error - // // messages and only printing again if they're longer than 1 second old. - // static constexpr int KEEP_MSGS = 5; - // std::scoped_lock lock(msgMutex); - // static std::string prevMsg[KEEP_MSGS]; - // static std::chrono::time_point - // prevMsgTime[KEEP_MSGS]; - // static bool initialized = false; - // if (!initialized) { - // for (int i = 0; i < KEEP_MSGS; i++) { - // prevMsgTime[i] = - // std::chrono::steady_clock::now() - std::chrono::seconds(2); - // } - // initialized = true; - // } + // Avoid flooding console by keeping track of previous 5 error + // messages and only printing again if they're longer than 1 second old. + static constexpr int KEEP_MSGS = 5; + std::scoped_lock lock(msgMutex); + static std::string prevMsg[KEEP_MSGS]; + static std::chrono::time_point + prevMsgTime[KEEP_MSGS]; + static bool initialized = false; + if (!initialized) { + for (int i = 0; i < KEEP_MSGS; i++) { + prevMsgTime[i] = + std::chrono::steady_clock::now() - std::chrono::seconds(2); + } + initialized = true; + } - // auto curTime = std::chrono::steady_clock::now(); - // int i; - // for (i = 0; i < KEEP_MSGS; ++i) { - // if (prevMsg[i] == details) { - // break; - // } - // } - // int retval = 0; - // if (i == KEEP_MSGS || (curTime - prevMsgTime[i]) >= - // std::chrono::seconds(1)) { - // std::string_view detailsRef{details}; - // std::string_view locationRef{location}; - // std::string_view callStackRef{callStack}; + auto curTime = std::chrono::steady_clock::now(); + int i; + for (i = 0; i < KEEP_MSGS; ++i) { + if (prevMsg[i] == details) { + break; + } + } + int retval = 0; + if (i == KEEP_MSGS || (curTime - prevMsgTime[i]) >= std::chrono::seconds(1)) { + std::string_view detailsRef{details}; + std::string_view locationRef{location}; + std::string_view callStackRef{callStack}; - // // 2 size, 1 tag, 4 timestamp, 2 seqnum - // // 2 numOccur, 4 error code, 1 flags, 6 strlen - // // 1 extra needed for padding on Netcomm end. - // size_t baseLength = 23; + mrc::ErrorInfo errorInfo; + errorInfo.IsError = isError ? 1 : 0; + errorInfo.ErrorCode = errorCode; + errorInfo.SetDetails(details); + errorInfo.SetLocation(location); + errorInfo.SetCallStack(callStack); - // if (baseLength + detailsRef.size() + locationRef.size() + - // callStackRef.size() <= - // 65535) { - // // Pass through - // retval = FRC_NetworkCommunication_sendError(isError, errorCode, - // isLVCode, - // details, location, - // callStack); - // } else if (baseLength + detailsRef.size() > 65535) { - // // Details too long, cut both location and stack - // auto newLen = 65535 - baseLength; - // std::string newDetails{details, newLen}; - // char empty = '\0'; - // retval = FRC_NetworkCommunication_sendError( - // isError, errorCode, isLVCode, newDetails.c_str(), &empty, &empty); - // } else if (baseLength + detailsRef.size() + locationRef.size() > 65535) { - // // Location too long, cut stack - // auto newLen = 65535 - baseLength - detailsRef.size(); - // std::string newLocation{location, newLen}; - // char empty = '\0'; - // retval = FRC_NetworkCommunication_sendError( - // isError, errorCode, isLVCode, details, newLocation.c_str(), - // &empty); - // } else { - // // Stack too long - // auto newLen = 65535 - baseLength - detailsRef.size() - - // locationRef.size(); std::string newCallStack{callStack, newLen}; retval - // = FRC_NetworkCommunication_sendError(isError, errorCode, isLVCode, - // details, location, - // newCallStack.c_str()); - // } - // if (printMsg) { - // fmt::memory_buffer buf; - // if (location && location[0] != '\0') { - // fmt::format_to(fmt::appender{buf}, - // "{} at {}: ", isError ? "Error" : "Warning", - // location); - // } - // fmt::format_to(fmt::appender{buf}, "{}\n", details); - // if (callStack && callStack[0] != '\0') { - // fmt::format_to(fmt::appender{buf}, "{}\n", callStack); - // } - // auto printError = gPrintErrorImpl.load(); - // printError(buf.data(), buf.size()); - // } - // if (i == KEEP_MSGS) { - // // replace the oldest one - // i = 0; - // auto first = prevMsgTime[0]; - // for (int j = 1; j < KEEP_MSGS; ++j) { - // if (prevMsgTime[j] < first) { - // first = prevMsgTime[j]; - // i = j; - // } - // } - // prevMsg[i] = details; - // } - // prevMsgTime[i] = curTime; - // } - // return retval; + fmt::print("{}\n", errorInfo.GetCallStack()); + + systemServerDs->errorInfoPublisher.Set(errorInfo); + + if (printMsg) { + fmt::memory_buffer buf; + if (location && location[0] != '\0') { + fmt::format_to(fmt::appender{buf}, + "{} at {}: ", isError ? "Error" : "Warning", location); + } + fmt::format_to(fmt::appender{buf}, "{}\n", details); + if (callStack && callStack[0] != '\0') { + fmt::format_to(fmt::appender{buf}, "{}\n", callStack); + } + auto printError = gPrintErrorImpl.load(); + printError(buf.data(), buf.size()); + } + if (i == KEEP_MSGS) { + // replace the oldest one + i = 0; + auto first = prevMsgTime[0]; + for (int j = 1; j < KEEP_MSGS; ++j) { + if (prevMsgTime[j] < first) { + first = prevMsgTime[j]; + i = j; + } + } + prevMsg[i] = details; + } + prevMsgTime[i] = curTime; + } + return retval; } void HAL_SetPrintErrorImpl(void (*func)(const char* line, size_t size)) { diff --git a/hal/src/mrc/include/mrc/NetComm.h b/hal/src/mrc/include/mrc/NetComm.h index b859e53c97..5b5a40764a 100644 --- a/hal/src/mrc/include/mrc/NetComm.h +++ b/hal/src/mrc/include/mrc/NetComm.h @@ -178,6 +178,12 @@ struct MatchInfo { EventName.size()}; } + bool operator==(const MatchInfo& Other) const { + return MatchNumber == Other.MatchNumber && + ReplayNumber == Other.ReplayNumber && Type == Other.Type && + EventName == Other.EventName; + } + private: std::string EventName; }; @@ -305,4 +311,89 @@ struct VersionInfo { std::string Version; }; +struct ErrorInfo { + bool IsError{false}; + int32_t ErrorCode{0}; + + void SetDetails(std::string_view NewDetails) { + if (NewDetails.size() > MRC_MAX_ERROR_INFO_STR_LEN) { + NewDetails = NewDetails.substr(0, MRC_MAX_ERROR_INFO_STR_LEN); + } + Details = NewDetails; + } + + void MoveDetails(std::string&& NewDetails) { + Details = std::move(NewDetails); + if (Details.size() > MRC_MAX_ERROR_INFO_STR_LEN) { + Details.resize(MRC_MAX_ERROR_INFO_STR_LEN); + } + } + + std::string_view GetDetails() const { return Details; } + + std::span WritableDetailsBuffer(size_t Len) { + if (Len > MRC_MAX_ERROR_INFO_STR_LEN) { + Len = MRC_MAX_ERROR_INFO_STR_LEN; + } + Details.resize(Len); + return std::span{reinterpret_cast(Details.data()), + Details.size()}; + } + + void SetLocation(std::string_view NewLocation) { + if (NewLocation.size() > MRC_MAX_ERROR_INFO_STR_LEN) { + NewLocation = NewLocation.substr(0, MRC_MAX_ERROR_INFO_STR_LEN); + } + Location = NewLocation; + } + + void MoveLocation(std::string&& NewLocation) { + Location = std::move(NewLocation); + if (Location.size() > MRC_MAX_ERROR_INFO_STR_LEN) { + Location.resize(MRC_MAX_ERROR_INFO_STR_LEN); + } + } + + std::string_view GetLocation() const { return Location; } + + std::span WritableLocationBuffer(size_t Len) { + if (Len > MRC_MAX_ERROR_INFO_STR_LEN) { + Len = MRC_MAX_ERROR_INFO_STR_LEN; + } + Location.resize(Len); + return std::span{reinterpret_cast(Location.data()), + Location.size()}; + } + + void SetCallStack(std::string_view NewCallStack) { + if (NewCallStack.size() > MRC_MAX_ERROR_INFO_STR_LEN) { + NewCallStack = NewCallStack.substr(0, MRC_MAX_ERROR_INFO_STR_LEN); + } + CallStack = NewCallStack; + } + + void MoveCallStack(std::string&& NewCallStack) { + CallStack = std::move(NewCallStack); + if (CallStack.size() > MRC_MAX_ERROR_INFO_STR_LEN) { + CallStack.resize(MRC_MAX_ERROR_INFO_STR_LEN); + } + } + + std::string_view GetCallStack() const { return CallStack; } + + std::span WritableCallStackBuffer(size_t Len) { + if (Len > MRC_MAX_ERROR_INFO_STR_LEN) { + Len = MRC_MAX_ERROR_INFO_STR_LEN; + } + CallStack.resize(Len); + return std::span{reinterpret_cast(CallStack.data()), + CallStack.size()}; + } + + private: + std::string Details; + std::string Location; + std::string CallStack; +}; + } // namespace mrc diff --git a/hal/src/mrc/include/mrc/NtNetComm.h b/hal/src/mrc/include/mrc/NtNetComm.h index faa306a1bd..5f88d43f91 100644 --- a/hal/src/mrc/include/mrc/NtNetComm.h +++ b/hal/src/mrc/include/mrc/NtNetComm.h @@ -31,6 +31,7 @@ #define ROBOT_CONSOLE_DATA_PREFIX "/Netcomm/Console/" #define ROBOT_CONSOLE_LINE_PATH (ROBOT_CONSOLE_DATA_PREFIX "ConsoleLine") +#define ROBOT_ERROR_INFO_PATH (ROBOT_CONSOLE_DATA_PREFIX "ErrorInfo") #define ROBOT_REPORTING_DATA_PREFIX "/Netcomm/Reporting/" #define ROBOT_LIB_VERSION_PATH (ROBOT_REPORTING_DATA_PREFIX "LibVersion") @@ -58,3 +59,4 @@ #define MRC_MAX_EVENT_NAME_LEN 64 #define MRC_MAX_JOYSTICK_NAME_LEN 256 #define MRC_MAX_VERSION_SIZE 256 +#define MRC_MAX_ERROR_INFO_STR_LEN 10000 diff --git a/hal/src/mrc/proto/MrcComm.proto b/hal/src/mrc/proto/MrcComm.proto index 7db585663f..cc370e29c4 100644 --- a/hal/src/mrc/proto/MrcComm.proto +++ b/hal/src/mrc/proto/MrcComm.proto @@ -45,3 +45,11 @@ message ProtobufMatchInfo { int32 ReplayNumber = 3; int32 MatchType = 4; } + +message ProtobufErrorInfo { + bool IsError = 1; + sint32 ErrorCode = 2; + string Details = 3; + string Location = 4; + string CallStack = 5; +}