mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-07-01 02:41:48 +00:00
[hal] Add initial SystemServer support (#7463)
This commit is contained in:
305
hal/src/generated/main/native/cpp/mrc/protobuf/MrcComm.npb.cpp
generated
Normal file
305
hal/src/generated/main/native/cpp/mrc/protobuf/MrcComm.npb.cpp
generated
Normal file
@@ -0,0 +1,305 @@
|
||||
// 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.
|
||||
/* Automatically generated nanopb constant definitions */
|
||||
/* Generated by nanopb-0.4.9 */
|
||||
|
||||
#include "MrcComm.npb.h"
|
||||
#if PB_PROTO_HEADER_VERSION != 40
|
||||
#error Regenerate this file with the current version of nanopb generator.
|
||||
#endif
|
||||
|
||||
#include <span>
|
||||
#include <string_view>
|
||||
static const uint8_t file_descriptor[] {
|
||||
0x0a,0x0d,0x4d,0x72,0x63,0x43,0x6f,0x6d,0x6d,0x2e,
|
||||
0x70,0x72,0x6f,0x74,0x6f,0x12,0x09,0x6d,0x72,0x63,
|
||||
0x2e,0x70,0x72,0x6f,0x74,0x6f,0x22,0x7a,0x0a,0x14,
|
||||
0x50,0x72,0x6f,0x74,0x6f,0x62,0x75,0x66,0x4a,0x6f,
|
||||
0x79,0x73,0x74,0x69,0x63,0x6b,0x44,0x61,0x74,0x61,
|
||||
0x12,0x20,0x0a,0x0b,0x42,0x75,0x74,0x74,0x6f,0x6e,
|
||||
0x43,0x6f,0x75,0x6e,0x74,0x18,0x01,0x20,0x01,0x28,
|
||||
0x0d,0x52,0x0b,0x42,0x75,0x74,0x74,0x6f,0x6e,0x43,
|
||||
0x6f,0x75,0x6e,0x74,0x12,0x18,0x0a,0x07,0x42,0x75,
|
||||
0x74,0x74,0x6f,0x6e,0x73,0x18,0x02,0x20,0x01,0x28,
|
||||
0x07,0x52,0x07,0x42,0x75,0x74,0x74,0x6f,0x6e,0x73,
|
||||
0x12,0x12,0x0a,0x04,0x41,0x78,0x65,0x73,0x18,0x03,
|
||||
0x20,0x03,0x28,0x02,0x52,0x04,0x41,0x78,0x65,0x73,
|
||||
0x12,0x12,0x0a,0x04,0x50,0x4f,0x56,0x73,0x18,0x04,
|
||||
0x20,0x03,0x28,0x11,0x52,0x04,0x50,0x4f,0x56,0x73,
|
||||
0x22,0xac,0x01,0x0a,0x13,0x50,0x72,0x6f,0x74,0x6f,
|
||||
0x62,0x75,0x66,0x43,0x6f,0x6e,0x74,0x72,0x6f,0x6c,
|
||||
0x44,0x61,0x74,0x61,0x12,0x20,0x0a,0x0b,0x43,0x6f,
|
||||
0x6e,0x74,0x72,0x6f,0x6c,0x57,0x6f,0x72,0x64,0x18,
|
||||
0x01,0x20,0x01,0x28,0x0d,0x52,0x0b,0x43,0x6f,0x6e,
|
||||
0x74,0x72,0x6f,0x6c,0x57,0x6f,0x72,0x64,0x12,0x1c,
|
||||
0x0a,0x09,0x4d,0x61,0x74,0x63,0x68,0x54,0x69,0x6d,
|
||||
0x65,0x18,0x02,0x20,0x01,0x28,0x02,0x52,0x09,0x4d,
|
||||
0x61,0x74,0x63,0x68,0x54,0x69,0x6d,0x65,0x12,0x3d,
|
||||
0x0a,0x09,0x4a,0x6f,0x79,0x73,0x74,0x69,0x63,0x6b,
|
||||
0x73,0x18,0x03,0x20,0x03,0x28,0x0b,0x32,0x1f,0x2e,
|
||||
0x6d,0x72,0x63,0x2e,0x70,0x72,0x6f,0x74,0x6f,0x2e,
|
||||
0x50,0x72,0x6f,0x74,0x6f,0x62,0x75,0x66,0x4a,0x6f,
|
||||
0x79,0x73,0x74,0x69,0x63,0x6b,0x44,0x61,0x74,0x61,
|
||||
0x52,0x09,0x4a,0x6f,0x79,0x73,0x74,0x69,0x63,0x6b,
|
||||
0x73,0x12,0x16,0x0a,0x06,0x4f,0x70,0x4d,0x6f,0x64,
|
||||
0x65,0x18,0x04,0x20,0x01,0x28,0x09,0x52,0x06,0x4f,
|
||||
0x70,0x4d,0x6f,0x64,0x65,0x22,0xd8,0x01,0x0a,0x1a,
|
||||
0x50,0x72,0x6f,0x74,0x6f,0x62,0x75,0x66,0x4a,0x6f,
|
||||
0x79,0x73,0x74,0x69,0x63,0x6b,0x44,0x65,0x73,0x63,
|
||||
0x72,0x69,0x70,0x74,0x6f,0x72,0x12,0x22,0x0a,0x0c,
|
||||
0x4a,0x6f,0x79,0x73,0x74,0x69,0x63,0x6b,0x4e,0x61,
|
||||
0x6d,0x65,0x18,0x01,0x20,0x01,0x28,0x09,0x52,0x0c,
|
||||
0x4a,0x6f,0x79,0x73,0x74,0x69,0x63,0x6b,0x4e,0x61,
|
||||
0x6d,0x65,0x12,0x1c,0x0a,0x09,0x41,0x78,0x69,0x73,
|
||||
0x54,0x79,0x70,0x65,0x73,0x18,0x02,0x20,0x03,0x28,
|
||||
0x05,0x52,0x09,0x41,0x78,0x69,0x73,0x54,0x79,0x70,
|
||||
0x65,0x73,0x12,0x16,0x0a,0x06,0x49,0x73,0x58,0x62,
|
||||
0x6f,0x78,0x18,0x03,0x20,0x01,0x28,0x08,0x52,0x06,
|
||||
0x49,0x73,0x58,0x62,0x6f,0x78,0x12,0x22,0x0a,0x0c,
|
||||
0x4a,0x6f,0x79,0x73,0x74,0x69,0x63,0x6b,0x54,0x79,
|
||||
0x70,0x65,0x18,0x04,0x20,0x01,0x28,0x05,0x52,0x0c,
|
||||
0x4a,0x6f,0x79,0x73,0x74,0x69,0x63,0x6b,0x54,0x79,
|
||||
0x70,0x65,0x12,0x20,0x0a,0x0b,0x42,0x75,0x74,0x74,
|
||||
0x6f,0x6e,0x43,0x6f,0x75,0x6e,0x74,0x18,0x05,0x20,
|
||||
0x01,0x28,0x05,0x52,0x0b,0x42,0x75,0x74,0x74,0x6f,
|
||||
0x6e,0x43,0x6f,0x75,0x6e,0x74,0x12,0x1a,0x0a,0x08,
|
||||
0x50,0x6f,0x76,0x43,0x6f,0x75,0x6e,0x74,0x18,0x06,
|
||||
0x20,0x01,0x28,0x05,0x52,0x08,0x50,0x6f,0x76,0x43,
|
||||
0x6f,0x75,0x6e,0x74,0x22,0x7e,0x0a,0x1a,0x50,0x72,
|
||||
0x6f,0x74,0x6f,0x62,0x75,0x66,0x4a,0x6f,0x79,0x73,
|
||||
0x74,0x69,0x63,0x6b,0x4f,0x75,0x74,0x70,0x75,0x74,
|
||||
0x44,0x61,0x74,0x61,0x12,0x1e,0x0a,0x0a,0x48,0x69,
|
||||
0x64,0x4f,0x75,0x74,0x70,0x75,0x74,0x73,0x18,0x01,
|
||||
0x20,0x01,0x28,0x07,0x52,0x0a,0x48,0x69,0x64,0x4f,
|
||||
0x75,0x74,0x70,0x75,0x74,0x73,0x12,0x1e,0x0a,0x0a,
|
||||
0x4c,0x65,0x66,0x74,0x52,0x75,0x6d,0x62,0x6c,0x65,
|
||||
0x18,0x02,0x20,0x01,0x28,0x02,0x52,0x0a,0x4c,0x65,
|
||||
0x66,0x74,0x52,0x75,0x6d,0x62,0x6c,0x65,0x12,0x20,
|
||||
0x0a,0x0b,0x52,0x69,0x67,0x68,0x74,0x52,0x75,0x6d,
|
||||
0x62,0x6c,0x65,0x18,0x03,0x20,0x01,0x28,0x02,0x52,
|
||||
0x0b,0x52,0x69,0x67,0x68,0x74,0x52,0x75,0x6d,0x62,
|
||||
0x6c,0x65,0x22,0x5f,0x0a,0x13,0x50,0x72,0x6f,0x74,
|
||||
0x6f,0x62,0x75,0x66,0x56,0x65,0x72,0x73,0x69,0x6f,
|
||||
0x6e,0x49,0x6e,0x66,0x6f,0x12,0x1a,0x0a,0x08,0x44,
|
||||
0x65,0x76,0x69,0x63,0x65,0x49,0x64,0x18,0x01,0x20,
|
||||
0x01,0x28,0x07,0x52,0x08,0x44,0x65,0x76,0x69,0x63,
|
||||
0x65,0x49,0x64,0x12,0x12,0x0a,0x04,0x4e,0x61,0x6d,
|
||||
0x65,0x18,0x02,0x20,0x01,0x28,0x09,0x52,0x04,0x4e,
|
||||
0x61,0x6d,0x65,0x12,0x18,0x0a,0x07,0x56,0x65,0x72,
|
||||
0x73,0x69,0x6f,0x6e,0x18,0x03,0x20,0x01,0x28,0x09,
|
||||
0x52,0x07,0x56,0x65,0x72,0x73,0x69,0x6f,0x6e,0x22,
|
||||
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,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,
|
||||
};
|
||||
static const char file_name[] = "MrcComm.proto";
|
||||
static const char mrc_proto_ProtobufJoystickData_name[] = "mrc.proto.ProtobufJoystickData";
|
||||
std::string_view mrc_proto_ProtobufJoystickData::msg_name(void) noexcept { return mrc_proto_ProtobufJoystickData_name; }
|
||||
pb_filedesc_t mrc_proto_ProtobufJoystickData::file_descriptor(void) noexcept { return {::file_name, ::file_descriptor}; }
|
||||
PB_BIND(mrc_proto_ProtobufJoystickData, mrc_proto_ProtobufJoystickData, AUTO)
|
||||
|
||||
|
||||
static const char mrc_proto_ProtobufControlData_name[] = "mrc.proto.ProtobufControlData";
|
||||
std::string_view mrc_proto_ProtobufControlData::msg_name(void) noexcept { return mrc_proto_ProtobufControlData_name; }
|
||||
pb_filedesc_t mrc_proto_ProtobufControlData::file_descriptor(void) noexcept { return {::file_name, ::file_descriptor}; }
|
||||
PB_BIND(mrc_proto_ProtobufControlData, mrc_proto_ProtobufControlData, AUTO)
|
||||
|
||||
|
||||
static const char mrc_proto_ProtobufJoystickDescriptor_name[] = "mrc.proto.ProtobufJoystickDescriptor";
|
||||
std::string_view mrc_proto_ProtobufJoystickDescriptor::msg_name(void) noexcept { return mrc_proto_ProtobufJoystickDescriptor_name; }
|
||||
pb_filedesc_t mrc_proto_ProtobufJoystickDescriptor::file_descriptor(void) noexcept { return {::file_name, ::file_descriptor}; }
|
||||
PB_BIND(mrc_proto_ProtobufJoystickDescriptor, mrc_proto_ProtobufJoystickDescriptor, AUTO)
|
||||
|
||||
|
||||
static const char mrc_proto_ProtobufJoystickOutputData_name[] = "mrc.proto.ProtobufJoystickOutputData";
|
||||
std::string_view mrc_proto_ProtobufJoystickOutputData::msg_name(void) noexcept { return mrc_proto_ProtobufJoystickOutputData_name; }
|
||||
pb_filedesc_t mrc_proto_ProtobufJoystickOutputData::file_descriptor(void) noexcept { return {::file_name, ::file_descriptor}; }
|
||||
PB_BIND(mrc_proto_ProtobufJoystickOutputData, mrc_proto_ProtobufJoystickOutputData, AUTO)
|
||||
|
||||
|
||||
static const char mrc_proto_ProtobufVersionInfo_name[] = "mrc.proto.ProtobufVersionInfo";
|
||||
std::string_view mrc_proto_ProtobufVersionInfo::msg_name(void) noexcept { return mrc_proto_ProtobufVersionInfo_name; }
|
||||
pb_filedesc_t mrc_proto_ProtobufVersionInfo::file_descriptor(void) noexcept { return {::file_name, ::file_descriptor}; }
|
||||
PB_BIND(mrc_proto_ProtobufVersionInfo, mrc_proto_ProtobufVersionInfo, AUTO)
|
||||
|
||||
|
||||
static const char mrc_proto_ProtobufMatchInfo_name[] = "mrc.proto.ProtobufMatchInfo";
|
||||
std::string_view mrc_proto_ProtobufMatchInfo::msg_name(void) noexcept { return mrc_proto_ProtobufMatchInfo_name; }
|
||||
pb_filedesc_t mrc_proto_ProtobufMatchInfo::file_descriptor(void) noexcept { return {::file_name, ::file_descriptor}; }
|
||||
PB_BIND(mrc_proto_ProtobufMatchInfo, mrc_proto_ProtobufMatchInfo, AUTO)
|
||||
|
||||
|
||||
|
||||
185
hal/src/generated/main/native/cpp/mrc/protobuf/MrcComm.npb.h
generated
Normal file
185
hal/src/generated/main/native/cpp/mrc/protobuf/MrcComm.npb.h
generated
Normal file
@@ -0,0 +1,185 @@
|
||||
// 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.
|
||||
/* Automatically generated nanopb header */
|
||||
/* Generated by nanopb-0.4.9 */
|
||||
|
||||
#ifndef PB_MRC_PROTO_MRCCOMM_NPB_H_INCLUDED
|
||||
#define PB_MRC_PROTO_MRCCOMM_NPB_H_INCLUDED
|
||||
#include <pb.h>
|
||||
#include <span>
|
||||
#include <string_view>
|
||||
|
||||
#if PB_PROTO_HEADER_VERSION != 40
|
||||
#error Regenerate this file with the current version of nanopb generator.
|
||||
#endif
|
||||
|
||||
/* Struct definitions */
|
||||
typedef struct _mrc_proto_ProtobufJoystickData {
|
||||
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 ButtonCount;
|
||||
uint32_t Buttons;
|
||||
pb_callback_t Axes;
|
||||
pb_callback_t POVs;
|
||||
} mrc_proto_ProtobufJoystickData;
|
||||
|
||||
typedef struct _mrc_proto_ProtobufControlData {
|
||||
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 ControlWord;
|
||||
float MatchTime;
|
||||
pb_callback_t Joysticks;
|
||||
pb_callback_t OpMode;
|
||||
} mrc_proto_ProtobufControlData;
|
||||
|
||||
typedef struct _mrc_proto_ProtobufJoystickDescriptor {
|
||||
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 JoystickName;
|
||||
pb_callback_t AxisTypes;
|
||||
bool IsXbox;
|
||||
int32_t JoystickType;
|
||||
int32_t ButtonCount;
|
||||
int32_t PovCount;
|
||||
} mrc_proto_ProtobufJoystickDescriptor;
|
||||
|
||||
typedef struct _mrc_proto_ProtobufJoystickOutputData {
|
||||
static const pb_msgdesc_t* msg_descriptor(void) noexcept;
|
||||
static std::string_view msg_name(void) noexcept;
|
||||
static pb_filedesc_t file_descriptor(void) noexcept;
|
||||
|
||||
uint32_t HidOutputs;
|
||||
float LeftRumble;
|
||||
float RightRumble;
|
||||
} mrc_proto_ProtobufJoystickOutputData;
|
||||
|
||||
typedef struct _mrc_proto_ProtobufVersionInfo {
|
||||
static const pb_msgdesc_t* msg_descriptor(void) noexcept;
|
||||
static std::string_view msg_name(void) noexcept;
|
||||
static pb_filedesc_t file_descriptor(void) noexcept;
|
||||
|
||||
uint32_t DeviceId;
|
||||
pb_callback_t Name;
|
||||
pb_callback_t Version;
|
||||
} mrc_proto_ProtobufVersionInfo;
|
||||
|
||||
typedef struct _mrc_proto_ProtobufMatchInfo {
|
||||
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 EventName;
|
||||
int32_t MatchNumber;
|
||||
int32_t ReplayNumber;
|
||||
int32_t MatchType;
|
||||
} mrc_proto_ProtobufMatchInfo;
|
||||
|
||||
|
||||
/* Initializer values for message structs */
|
||||
#define mrc_proto_ProtobufJoystickData_init_default {0, 0, {{NULL}, NULL}, {{NULL}, NULL}}
|
||||
#define mrc_proto_ProtobufControlData_init_default {0, 0, {{NULL}, NULL}, {{NULL}, NULL}}
|
||||
#define mrc_proto_ProtobufJoystickDescriptor_init_default {{{NULL}, NULL}, {{NULL}, NULL}, 0, 0, 0, 0}
|
||||
#define mrc_proto_ProtobufJoystickOutputData_init_default {0, 0, 0}
|
||||
#define mrc_proto_ProtobufVersionInfo_init_default {0, {{NULL}, NULL}, {{NULL}, NULL}}
|
||||
#define mrc_proto_ProtobufMatchInfo_init_default {{{NULL}, NULL}, 0, 0, 0}
|
||||
#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}
|
||||
|
||||
/* Field tags (for use in manual encoding/decoding) */
|
||||
#define mrc_proto_ProtobufJoystickData_ButtonCount_tag 1
|
||||
#define mrc_proto_ProtobufJoystickData_Buttons_tag 2
|
||||
#define mrc_proto_ProtobufJoystickData_Axes_tag 3
|
||||
#define mrc_proto_ProtobufJoystickData_POVs_tag 4
|
||||
#define mrc_proto_ProtobufControlData_ControlWord_tag 1
|
||||
#define mrc_proto_ProtobufControlData_MatchTime_tag 2
|
||||
#define mrc_proto_ProtobufControlData_Joysticks_tag 3
|
||||
#define mrc_proto_ProtobufControlData_OpMode_tag 4
|
||||
#define mrc_proto_ProtobufJoystickDescriptor_JoystickName_tag 1
|
||||
#define mrc_proto_ProtobufJoystickDescriptor_AxisTypes_tag 2
|
||||
#define mrc_proto_ProtobufJoystickDescriptor_IsXbox_tag 3
|
||||
#define mrc_proto_ProtobufJoystickDescriptor_JoystickType_tag 4
|
||||
#define mrc_proto_ProtobufJoystickDescriptor_ButtonCount_tag 5
|
||||
#define mrc_proto_ProtobufJoystickDescriptor_PovCount_tag 6
|
||||
#define mrc_proto_ProtobufJoystickOutputData_HidOutputs_tag 1
|
||||
#define mrc_proto_ProtobufJoystickOutputData_LeftRumble_tag 2
|
||||
#define mrc_proto_ProtobufJoystickOutputData_RightRumble_tag 3
|
||||
#define mrc_proto_ProtobufVersionInfo_DeviceId_tag 1
|
||||
#define mrc_proto_ProtobufVersionInfo_Name_tag 2
|
||||
#define mrc_proto_ProtobufVersionInfo_Version_tag 3
|
||||
#define mrc_proto_ProtobufMatchInfo_EventName_tag 1
|
||||
#define mrc_proto_ProtobufMatchInfo_MatchNumber_tag 2
|
||||
#define mrc_proto_ProtobufMatchInfo_ReplayNumber_tag 3
|
||||
#define mrc_proto_ProtobufMatchInfo_MatchType_tag 4
|
||||
|
||||
/* Struct field encoding specification for nanopb */
|
||||
#define mrc_proto_ProtobufJoystickData_FIELDLIST(X, a) \
|
||||
X(a, STATIC, SINGULAR, UINT32, ButtonCount, 1) \
|
||||
X(a, STATIC, SINGULAR, FIXED32, Buttons, 2) \
|
||||
X(a, CALLBACK, REPEATED, FLOAT, Axes, 3) \
|
||||
X(a, CALLBACK, REPEATED, SINT32, POVs, 4)
|
||||
#define mrc_proto_ProtobufJoystickData_CALLBACK pb_default_field_callback
|
||||
#define mrc_proto_ProtobufJoystickData_DEFAULT NULL
|
||||
|
||||
#define mrc_proto_ProtobufControlData_FIELDLIST(X, a) \
|
||||
X(a, STATIC, SINGULAR, UINT32, ControlWord, 1) \
|
||||
X(a, STATIC, SINGULAR, FLOAT, MatchTime, 2) \
|
||||
X(a, CALLBACK, REPEATED, MESSAGE, Joysticks, 3) \
|
||||
X(a, CALLBACK, SINGULAR, STRING, OpMode, 4)
|
||||
#define mrc_proto_ProtobufControlData_CALLBACK pb_default_field_callback
|
||||
#define mrc_proto_ProtobufControlData_DEFAULT NULL
|
||||
#define mrc_proto_ProtobufControlData_Joysticks_MSGTYPE mrc_proto_ProtobufJoystickData
|
||||
|
||||
#define mrc_proto_ProtobufJoystickDescriptor_FIELDLIST(X, a) \
|
||||
X(a, CALLBACK, SINGULAR, STRING, JoystickName, 1) \
|
||||
X(a, CALLBACK, REPEATED, INT32, AxisTypes, 2) \
|
||||
X(a, STATIC, SINGULAR, BOOL, IsXbox, 3) \
|
||||
X(a, STATIC, SINGULAR, INT32, JoystickType, 4) \
|
||||
X(a, STATIC, SINGULAR, INT32, ButtonCount, 5) \
|
||||
X(a, STATIC, SINGULAR, INT32, PovCount, 6)
|
||||
#define mrc_proto_ProtobufJoystickDescriptor_CALLBACK pb_default_field_callback
|
||||
#define mrc_proto_ProtobufJoystickDescriptor_DEFAULT NULL
|
||||
|
||||
#define mrc_proto_ProtobufJoystickOutputData_FIELDLIST(X, a) \
|
||||
X(a, STATIC, SINGULAR, FIXED32, HidOutputs, 1) \
|
||||
X(a, STATIC, SINGULAR, FLOAT, LeftRumble, 2) \
|
||||
X(a, STATIC, SINGULAR, FLOAT, RightRumble, 3)
|
||||
#define mrc_proto_ProtobufJoystickOutputData_CALLBACK NULL
|
||||
#define mrc_proto_ProtobufJoystickOutputData_DEFAULT NULL
|
||||
|
||||
#define mrc_proto_ProtobufVersionInfo_FIELDLIST(X, a) \
|
||||
X(a, STATIC, SINGULAR, FIXED32, DeviceId, 1) \
|
||||
X(a, CALLBACK, SINGULAR, STRING, Name, 2) \
|
||||
X(a, CALLBACK, SINGULAR, STRING, Version, 3)
|
||||
#define mrc_proto_ProtobufVersionInfo_CALLBACK pb_default_field_callback
|
||||
#define mrc_proto_ProtobufVersionInfo_DEFAULT NULL
|
||||
|
||||
#define mrc_proto_ProtobufMatchInfo_FIELDLIST(X, a) \
|
||||
X(a, CALLBACK, SINGULAR, STRING, EventName, 1) \
|
||||
X(a, STATIC, SINGULAR, INT32, MatchNumber, 2) \
|
||||
X(a, STATIC, SINGULAR, INT32, ReplayNumber, 3) \
|
||||
X(a, STATIC, SINGULAR, INT32, MatchType, 4)
|
||||
#define mrc_proto_ProtobufMatchInfo_CALLBACK pb_default_field_callback
|
||||
#define mrc_proto_ProtobufMatchInfo_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 */
|
||||
#define MRC_PROTO_MRCCOMM_NPB_H_MAX_SIZE mrc_proto_ProtobufJoystickOutputData_size
|
||||
#define mrc_proto_ProtobufJoystickOutputData_size 15
|
||||
|
||||
|
||||
#endif
|
||||
163
hal/src/main/native/cpp/proto/ControlDataProto.cpp
Normal file
163
hal/src/main/native/cpp/proto/ControlDataProto.cpp
Normal file
@@ -0,0 +1,163 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
#include <wpi/protobuf/ProtobufCallbacks.h>
|
||||
|
||||
#include "hal/proto/ControlData.h"
|
||||
|
||||
static_assert(sizeof(mrc::ControlFlags) == sizeof(uint32_t));
|
||||
|
||||
namespace {
|
||||
constexpr uint32_t EnabledMask = 0x1;
|
||||
constexpr uint32_t EStopMask = 0x8;
|
||||
constexpr uint32_t FmsConnectedMask = 0x10;
|
||||
constexpr uint32_t DsConnectedMask = 0x20;
|
||||
constexpr uint32_t WatchdogActiveMask = 0x40;
|
||||
constexpr uint32_t AllianceMask = 0x1F80;
|
||||
|
||||
constexpr uint32_t EnabledShift = 0;
|
||||
constexpr uint32_t EStopShift = 3;
|
||||
constexpr uint32_t FmsConnectedShift = 4;
|
||||
constexpr uint32_t DsConnectedShift = 5;
|
||||
constexpr uint32_t WatchdogActiveShift = 6;
|
||||
constexpr uint32_t AllianceShift = 7;
|
||||
|
||||
#define WORD_TO_INT(Name) Ret |= (Word.Name << Name##Shift)
|
||||
|
||||
constexpr uint32_t FromControlWord(mrc::ControlFlags Word) {
|
||||
uint32_t Ret = 0;
|
||||
WORD_TO_INT(Enabled);
|
||||
WORD_TO_INT(EStop);
|
||||
WORD_TO_INT(FmsConnected);
|
||||
WORD_TO_INT(DsConnected);
|
||||
WORD_TO_INT(WatchdogActive);
|
||||
WORD_TO_INT(Alliance);
|
||||
return Ret;
|
||||
}
|
||||
|
||||
#undef WORD_TO_INT
|
||||
|
||||
#define INT_TO_WORD(Name) Ret.Name = ((Word & Name##Mask) >> Name##Shift)
|
||||
|
||||
constexpr mrc::ControlFlags ToControlWord(uint32_t Word) {
|
||||
mrc::ControlFlags Ret = {};
|
||||
INT_TO_WORD(Enabled);
|
||||
INT_TO_WORD(EStop);
|
||||
INT_TO_WORD(FmsConnected);
|
||||
INT_TO_WORD(DsConnected);
|
||||
INT_TO_WORD(WatchdogActive);
|
||||
INT_TO_WORD(Alliance);
|
||||
return Ret;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
std::optional<mrc::ControlData> wpi::Protobuf<mrc::ControlData>::Unpack(
|
||||
InputStream& Stream) {
|
||||
wpi::UnpackCallback<mrc::Joystick, MRC_MAX_NUM_JOYSTICKS> JoystickCb;
|
||||
wpi::UnpackCallback<std::string> OpModeCb;
|
||||
|
||||
mrc_proto_ProtobufControlData Msg{
|
||||
.ControlWord = 0,
|
||||
.MatchTime = 0,
|
||||
.Joysticks = JoystickCb.Callback(),
|
||||
.OpMode = OpModeCb.Callback(),
|
||||
};
|
||||
|
||||
if (!Stream.Decode(Msg)) {
|
||||
return {};
|
||||
}
|
||||
|
||||
auto Joysticks = JoystickCb.Items();
|
||||
auto OpMode = OpModeCb.Items();
|
||||
|
||||
mrc::ControlData ControlData;
|
||||
|
||||
if (!OpMode.empty()) {
|
||||
ControlData.MoveOpMode(std::move(OpMode[0]));
|
||||
}
|
||||
|
||||
ControlData.ControlWord = ToControlWord(Msg.ControlWord);
|
||||
ControlData.MatchTime = Msg.MatchTime;
|
||||
ControlData.SetJoystickCount(Joysticks.size());
|
||||
|
||||
for (size_t i = 0; i < ControlData.GetJoystickCount(); i++) {
|
||||
ControlData.Joysticks()[i] = Joysticks[i];
|
||||
}
|
||||
|
||||
return ControlData;
|
||||
}
|
||||
|
||||
bool wpi::Protobuf<mrc::ControlData>::Pack(OutputStream& Stream,
|
||||
const mrc::ControlData& Value) {
|
||||
std::string_view OpMode = Value.GetOpMode();
|
||||
wpi::PackCallback OpModeCb{&OpMode};
|
||||
std::span<const mrc::Joystick> Sticks = Value.Joysticks();
|
||||
wpi::PackCallback Joysticks{Sticks};
|
||||
|
||||
mrc_proto_ProtobufControlData Msg{
|
||||
.ControlWord = FromControlWord(Value.ControlWord),
|
||||
.MatchTime = Value.MatchTime,
|
||||
.Joysticks = Joysticks.Callback(),
|
||||
.OpMode = OpModeCb.Callback(),
|
||||
};
|
||||
|
||||
return Stream.Encode(Msg);
|
||||
}
|
||||
|
||||
std::optional<mrc::Joystick> wpi::Protobuf<mrc::Joystick>::Unpack(
|
||||
InputStream& Stream) {
|
||||
wpi::UnpackCallback<float, MRC_MAX_NUM_AXES> AxesCb;
|
||||
wpi::UnpackCallback<uint16_t, MRC_MAX_NUM_POVS> PovsCb;
|
||||
|
||||
mrc_proto_ProtobufJoystickData Msg{
|
||||
.ButtonCount = 0,
|
||||
.Buttons = 0,
|
||||
.Axes = AxesCb.Callback(),
|
||||
.POVs = PovsCb.Callback(),
|
||||
};
|
||||
|
||||
if (!Stream.Decode(Msg)) {
|
||||
return {};
|
||||
}
|
||||
|
||||
auto Axes = AxesCb.Items();
|
||||
auto Povs = PovsCb.Items();
|
||||
|
||||
mrc::Joystick Joystick;
|
||||
Joystick.Axes.SetCount(Axes.size());
|
||||
|
||||
for (size_t i = 0; i < Joystick.Axes.GetCount(); i++) {
|
||||
Joystick.Axes.Axes()[i] = Axes[i];
|
||||
}
|
||||
|
||||
Joystick.Povs.SetCount(Povs.size());
|
||||
|
||||
for (size_t i = 0; i < Joystick.Povs.GetCount(); i++) {
|
||||
Joystick.Povs.Povs()[i] = Povs[i];
|
||||
}
|
||||
|
||||
Joystick.Buttons.SetCount(Msg.ButtonCount);
|
||||
Joystick.Buttons.Buttons = Msg.Buttons;
|
||||
|
||||
return Joystick;
|
||||
}
|
||||
|
||||
bool wpi::Protobuf<mrc::Joystick>::Pack(OutputStream& Stream,
|
||||
const mrc::Joystick& Value) {
|
||||
wpi::PackCallback AxesCb{Value.Axes.Axes()};
|
||||
wpi::PackCallback PovsCb{Value.Povs.Povs()};
|
||||
|
||||
mrc_proto_ProtobufJoystickData Msg{
|
||||
.ButtonCount = static_cast<uint32_t>(Value.Buttons.GetCount()),
|
||||
.Buttons = Value.Buttons.Buttons,
|
||||
.Axes = AxesCb.Callback(),
|
||||
.POVs = PovsCb.Callback(),
|
||||
};
|
||||
|
||||
return Stream.Encode(Msg);
|
||||
}
|
||||
68
hal/src/main/native/cpp/proto/JoystickDescriptorProto.cpp
Normal file
68
hal/src/main/native/cpp/proto/JoystickDescriptorProto.cpp
Normal file
@@ -0,0 +1,68 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
#include <wpi/protobuf/ProtobufCallbacks.h>
|
||||
|
||||
#include "hal/proto/JoystickDescriptor.h"
|
||||
|
||||
std::optional<mrc::JoystickDescriptor>
|
||||
wpi::Protobuf<mrc::JoystickDescriptor>::Unpack(InputStream& Stream) {
|
||||
wpi::UnpackCallback<std::string> JoystickNameCb;
|
||||
wpi::UnpackCallback<uint8_t, MRC_MAX_NUM_AXES> AxisTypesCb;
|
||||
|
||||
mrc_proto_ProtobufJoystickDescriptor Msg;
|
||||
Msg.JoystickName = JoystickNameCb.Callback();
|
||||
Msg.AxisTypes = AxisTypesCb.Callback();
|
||||
|
||||
if (!Stream.Decode(Msg)) {
|
||||
return {};
|
||||
}
|
||||
|
||||
auto JoystickName = JoystickNameCb.Items();
|
||||
auto AxisTypes = AxisTypesCb.Items();
|
||||
|
||||
if (JoystickName.empty()) {
|
||||
return {};
|
||||
}
|
||||
|
||||
mrc::JoystickDescriptor OutputData;
|
||||
OutputData.MoveName(std::move(JoystickName[0]));
|
||||
|
||||
OutputData.SetAxesCount(AxisTypes.size());
|
||||
|
||||
for (size_t i = 0; i < OutputData.GetAxesCount(); i++) {
|
||||
OutputData.AxesTypes()[i] = AxisTypes[i];
|
||||
}
|
||||
|
||||
OutputData.SetPovsCount(Msg.PovCount);
|
||||
OutputData.SetButtonsCount(Msg.ButtonCount);
|
||||
|
||||
OutputData.IsXbox = Msg.IsXbox ? 1 : 0;
|
||||
OutputData.Type = Msg.JoystickType;
|
||||
|
||||
return OutputData;
|
||||
}
|
||||
|
||||
bool wpi::Protobuf<mrc::JoystickDescriptor>::Pack(
|
||||
OutputStream& Stream, const mrc::JoystickDescriptor& Value) {
|
||||
std::string_view JoystickName = Value.GetName();
|
||||
wpi::PackCallback JoystickNameCb{&JoystickName};
|
||||
|
||||
std::span<const uint8_t> AxisTypes = Value.AxesTypes();
|
||||
wpi::PackCallback AxisTypesCb{AxisTypes};
|
||||
|
||||
mrc_proto_ProtobufJoystickDescriptor Msg{
|
||||
.JoystickName = JoystickNameCb.Callback(),
|
||||
.AxisTypes = AxisTypesCb.Callback(),
|
||||
.IsXbox = Value.IsXbox ? true : false,
|
||||
.JoystickType = Value.Type,
|
||||
.ButtonCount = static_cast<int32_t>(Value.GetButtonsCount()),
|
||||
.PovCount = static_cast<int32_t>(Value.GetPovsCount()),
|
||||
};
|
||||
|
||||
return Stream.Encode(Msg);
|
||||
}
|
||||
33
hal/src/main/native/cpp/proto/JoystickOutputDataProto.cpp
Normal file
33
hal/src/main/native/cpp/proto/JoystickOutputDataProto.cpp
Normal file
@@ -0,0 +1,33 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
#include <wpi/protobuf/ProtobufCallbacks.h>
|
||||
|
||||
#include "hal/proto/JoystickOutputData.h"
|
||||
|
||||
std::optional<mrc::JoystickOutputData>
|
||||
wpi::Protobuf<mrc::JoystickOutputData>::Unpack(InputStream& Stream) {
|
||||
mrc_proto_ProtobufJoystickOutputData Msg;
|
||||
|
||||
if (!Stream.Decode(Msg)) {
|
||||
return {};
|
||||
}
|
||||
|
||||
return mrc::JoystickOutputData{
|
||||
.HidOutputs = Msg.HidOutputs,
|
||||
.LeftRumble = Msg.LeftRumble,
|
||||
.RightRumble = Msg.RightRumble,
|
||||
};
|
||||
}
|
||||
|
||||
bool wpi::Protobuf<mrc::JoystickOutputData>::Pack(
|
||||
OutputStream& Stream, const mrc::JoystickOutputData& Value) {
|
||||
mrc_proto_ProtobufJoystickOutputData Msg{
|
||||
.HidOutputs = Value.HidOutputs,
|
||||
.LeftRumble = Value.LeftRumble,
|
||||
.RightRumble = Value.RightRumble,
|
||||
};
|
||||
|
||||
return Stream.Encode(Msg);
|
||||
}
|
||||
52
hal/src/main/native/cpp/proto/MatchInfoProto.cpp
Normal file
52
hal/src/main/native/cpp/proto/MatchInfoProto.cpp
Normal file
@@ -0,0 +1,52 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
#include <wpi/protobuf/ProtobufCallbacks.h>
|
||||
|
||||
#include "hal/proto/MatchInfo.h"
|
||||
|
||||
std::optional<mrc::MatchInfo> wpi::Protobuf<mrc::MatchInfo>::Unpack(
|
||||
InputStream& Stream) {
|
||||
wpi::UnpackCallback<std::string> NameCb;
|
||||
|
||||
mrc_proto_ProtobufMatchInfo Msg;
|
||||
Msg.EventName = NameCb.Callback();
|
||||
|
||||
if (!Stream.Decode(Msg)) {
|
||||
return {};
|
||||
}
|
||||
|
||||
auto Name = NameCb.Items();
|
||||
|
||||
if (Name.empty()) {
|
||||
return {};
|
||||
}
|
||||
|
||||
mrc::MatchInfo OutputData;
|
||||
OutputData.MoveEventName(std::move(Name[0]));
|
||||
|
||||
OutputData.MatchNumber = Msg.MatchNumber;
|
||||
OutputData.ReplayNumber = Msg.ReplayNumber;
|
||||
OutputData.Type = static_cast<mrc::MatchType>(Msg.MatchType);
|
||||
|
||||
return OutputData;
|
||||
}
|
||||
|
||||
bool wpi::Protobuf<mrc::MatchInfo>::Pack(OutputStream& Stream,
|
||||
const mrc::MatchInfo& Value) {
|
||||
std::string_view EventNameStr = Value.GetEventName();
|
||||
wpi::PackCallback EventName{&EventNameStr};
|
||||
|
||||
mrc_proto_ProtobufMatchInfo Msg{
|
||||
.EventName = EventName.Callback(),
|
||||
.MatchNumber = Value.MatchNumber,
|
||||
.ReplayNumber = Value.ReplayNumber,
|
||||
.MatchType = static_cast<int32_t>(Value.Type),
|
||||
};
|
||||
|
||||
return Stream.Encode(Msg);
|
||||
}
|
||||
56
hal/src/main/native/cpp/proto/VersionInfoProto.cpp
Normal file
56
hal/src/main/native/cpp/proto/VersionInfoProto.cpp
Normal file
@@ -0,0 +1,56 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
#include <wpi/protobuf/ProtobufCallbacks.h>
|
||||
|
||||
#include "hal/proto/VersionInfo.h"
|
||||
|
||||
std::optional<mrc::VersionInfo> wpi::Protobuf<mrc::VersionInfo>::Unpack(
|
||||
InputStream& Stream) {
|
||||
wpi::UnpackCallback<std::string> NameCb;
|
||||
wpi::UnpackCallback<std::string> VersionCb;
|
||||
|
||||
mrc_proto_ProtobufVersionInfo Msg{
|
||||
.DeviceId = 0,
|
||||
.Name = NameCb.Callback(),
|
||||
.Version = VersionCb.Callback(),
|
||||
};
|
||||
|
||||
if (!Stream.Decode(Msg)) {
|
||||
return {};
|
||||
}
|
||||
|
||||
auto Name = NameCb.Items();
|
||||
auto Version = VersionCb.Items();
|
||||
|
||||
if (Name.empty() || Version.empty()) {
|
||||
return {};
|
||||
}
|
||||
|
||||
mrc::VersionInfo ToRet;
|
||||
|
||||
ToRet.DeviceId = Msg.DeviceId;
|
||||
ToRet.MoveName(std::move(Name[0]));
|
||||
ToRet.MoveVersion(std::move(Version[0]));
|
||||
|
||||
return ToRet;
|
||||
}
|
||||
|
||||
bool wpi::Protobuf<mrc::VersionInfo>::Pack(OutputStream& Stream,
|
||||
const mrc::VersionInfo& Value) {
|
||||
std::string_view NameView = Value.GetName();
|
||||
std::string_view VersionView = Value.GetVersion();
|
||||
wpi::PackCallback NameCb{&NameView};
|
||||
wpi::PackCallback VersionCb{&VersionView};
|
||||
|
||||
mrc_proto_ProtobufVersionInfo Msg{
|
||||
.DeviceId = Value.DeviceId,
|
||||
.Name = NameCb.Callback(),
|
||||
.Version = VersionCb.Callback(),
|
||||
};
|
||||
return Stream.Encode(Msg);
|
||||
}
|
||||
30
hal/src/main/native/include/hal/proto/ControlData.h
Normal file
30
hal/src/main/native/include/hal/proto/ControlData.h
Normal file
@@ -0,0 +1,30 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <wpi/protobuf/Protobuf.h>
|
||||
|
||||
#include "MrcComm.npb.h"
|
||||
#include "mrc/NetComm.h"
|
||||
|
||||
template <>
|
||||
struct wpi::Protobuf<mrc::ControlData> {
|
||||
using MessageStruct = mrc_proto_ProtobufControlData;
|
||||
using InputStream = wpi::ProtoInputStream<mrc::ControlData>;
|
||||
using OutputStream = wpi::ProtoOutputStream<mrc::ControlData>;
|
||||
static std::optional<mrc::ControlData> Unpack(InputStream& Stream);
|
||||
static bool Pack(OutputStream& Stream, const mrc::ControlData& Value);
|
||||
};
|
||||
|
||||
template <>
|
||||
struct wpi::Protobuf<mrc::Joystick> {
|
||||
using MessageStruct = mrc_proto_ProtobufJoystickData;
|
||||
using InputStream = wpi::ProtoInputStream<mrc::Joystick>;
|
||||
using OutputStream = wpi::ProtoOutputStream<mrc::Joystick>;
|
||||
static std::optional<mrc::Joystick> Unpack(InputStream& Stream);
|
||||
static bool Pack(OutputStream& Stream, const mrc::Joystick& Value);
|
||||
};
|
||||
21
hal/src/main/native/include/hal/proto/JoystickDescriptor.h
Normal file
21
hal/src/main/native/include/hal/proto/JoystickDescriptor.h
Normal file
@@ -0,0 +1,21 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <wpi/protobuf/Protobuf.h>
|
||||
|
||||
#include "MrcComm.npb.h"
|
||||
#include "mrc/NetComm.h"
|
||||
|
||||
template <>
|
||||
struct wpi::Protobuf<mrc::JoystickDescriptor> {
|
||||
using MessageStruct = mrc_proto_ProtobufJoystickDescriptor;
|
||||
using InputStream = wpi::ProtoInputStream<mrc::JoystickDescriptor>;
|
||||
using OutputStream = wpi::ProtoOutputStream<mrc::JoystickDescriptor>;
|
||||
static std::optional<mrc::JoystickDescriptor> Unpack(InputStream& Stream);
|
||||
static bool Pack(OutputStream& Stream, const mrc::JoystickDescriptor& Value);
|
||||
};
|
||||
21
hal/src/main/native/include/hal/proto/JoystickOutputData.h
Normal file
21
hal/src/main/native/include/hal/proto/JoystickOutputData.h
Normal file
@@ -0,0 +1,21 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <wpi/protobuf/Protobuf.h>
|
||||
|
||||
#include "MrcComm.npb.h"
|
||||
#include "mrc/NetComm.h"
|
||||
|
||||
template <>
|
||||
struct wpi::Protobuf<mrc::JoystickOutputData> {
|
||||
using MessageStruct = mrc_proto_ProtobufJoystickOutputData;
|
||||
using InputStream = wpi::ProtoInputStream<mrc::JoystickOutputData>;
|
||||
using OutputStream = wpi::ProtoOutputStream<mrc::JoystickOutputData>;
|
||||
static std::optional<mrc::JoystickOutputData> Unpack(InputStream& Stream);
|
||||
static bool Pack(OutputStream& Stream, const mrc::JoystickOutputData& Value);
|
||||
};
|
||||
21
hal/src/main/native/include/hal/proto/MatchInfo.h
Normal file
21
hal/src/main/native/include/hal/proto/MatchInfo.h
Normal file
@@ -0,0 +1,21 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <wpi/protobuf/Protobuf.h>
|
||||
|
||||
#include "MrcComm.npb.h"
|
||||
#include "mrc/NetComm.h"
|
||||
|
||||
template <>
|
||||
struct wpi::Protobuf<mrc::MatchInfo> {
|
||||
using MessageStruct = mrc_proto_ProtobufMatchInfo;
|
||||
using InputStream = wpi::ProtoInputStream<mrc::MatchInfo>;
|
||||
using OutputStream = wpi::ProtoOutputStream<mrc::MatchInfo>;
|
||||
static std::optional<mrc::MatchInfo> Unpack(InputStream& Stream);
|
||||
static bool Pack(OutputStream& Stream, const mrc::MatchInfo& Value);
|
||||
};
|
||||
21
hal/src/main/native/include/hal/proto/VersionInfo.h
Normal file
21
hal/src/main/native/include/hal/proto/VersionInfo.h
Normal file
@@ -0,0 +1,21 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <wpi/protobuf/Protobuf.h>
|
||||
|
||||
#include "MrcComm.npb.h"
|
||||
#include "mrc/NetComm.h"
|
||||
|
||||
template <>
|
||||
struct wpi::Protobuf<mrc::VersionInfo> {
|
||||
using MessageStruct = mrc_proto_ProtobufVersionInfo;
|
||||
using InputStream = wpi::ProtoInputStream<mrc::VersionInfo>;
|
||||
using OutputStream = wpi::ProtoOutputStream<mrc::VersionInfo>;
|
||||
static std::optional<mrc::VersionInfo> Unpack(InputStream& Stream);
|
||||
static bool Pack(OutputStream& Stream, const mrc::VersionInfo& Value);
|
||||
};
|
||||
@@ -27,11 +27,11 @@
|
||||
|
||||
#include "HALInitializer.h"
|
||||
#include "HALInternal.h"
|
||||
#include "SystemServer.h"
|
||||
#include "hal/DriverStation.h"
|
||||
#include "hal/Errors.h"
|
||||
#include "hal/Notifier.h"
|
||||
#include "hal/handles/HandlesInternal.h"
|
||||
#include "hal/roborio/HMB.h"
|
||||
|
||||
using namespace hal;
|
||||
|
||||
@@ -337,6 +337,8 @@ HAL_Bool HAL_Initialize(int32_t timeout, int32_t mode) {
|
||||
|
||||
prctl(PR_SET_PDEATHSIG, SIGTERM);
|
||||
|
||||
hal::InitializeSystemServer();
|
||||
|
||||
// // Return false if program failed to kill an existing program
|
||||
// if (!killExistingProgram(timeout, mode)) {
|
||||
// return false;
|
||||
|
||||
35
hal/src/main/native/systemcore/SystemServer.cpp
Normal file
35
hal/src/main/native/systemcore/SystemServer.cpp
Normal file
@@ -0,0 +1,35 @@
|
||||
// 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 "SystemServer.h"
|
||||
|
||||
#include "mrc/NtNetComm.h"
|
||||
|
||||
namespace hal {
|
||||
|
||||
static nt::NetworkTableInstance ServerInstance;
|
||||
|
||||
void InitializeSystemServer() {
|
||||
if (ServerInstance) {
|
||||
return;
|
||||
}
|
||||
ServerInstance = nt::NetworkTableInstance::Create();
|
||||
ServerInstance.SetServer("localhost", ROBOT_SYSTEM_SERVER_NT_PORT);
|
||||
ServerInstance.StartClient4("RobotProgram");
|
||||
}
|
||||
|
||||
void ShutdownSystemServer() {
|
||||
if (!ServerInstance) {
|
||||
return;
|
||||
}
|
||||
|
||||
ServerInstance.StopClient();
|
||||
nt::NetworkTableInstance::Destroy(ServerInstance);
|
||||
}
|
||||
|
||||
nt::NetworkTableInstance GetSystemServer() {
|
||||
return ServerInstance;
|
||||
}
|
||||
|
||||
} // namespace hal
|
||||
13
hal/src/main/native/systemcore/SystemServer.h
Normal file
13
hal/src/main/native/systemcore/SystemServer.h
Normal file
@@ -0,0 +1,13 @@
|
||||
// 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 <networktables/NetworkTableInstance.h>
|
||||
|
||||
namespace hal {
|
||||
void InitializeSystemServer();
|
||||
void ShutdownSystemServer();
|
||||
nt::NetworkTableInstance GetSystemServer();
|
||||
} // namespace hal
|
||||
308
hal/src/mrc/include/mrc/NetComm.h
Normal file
308
hal/src/mrc/include/mrc/NetComm.h
Normal file
@@ -0,0 +1,308 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <array>
|
||||
#include <span>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <utility>
|
||||
|
||||
#include "mrc/NtNetComm.h"
|
||||
|
||||
namespace mrc {
|
||||
|
||||
struct ControlFlags {
|
||||
uint32_t Enabled : 1;
|
||||
uint32_t ModeReserved : 2;
|
||||
uint32_t EStop : 1;
|
||||
uint32_t FmsConnected : 1;
|
||||
uint32_t DsConnected : 1;
|
||||
uint32_t WatchdogActive : 1;
|
||||
uint32_t Alliance : 6;
|
||||
uint32_t Reserved : 19;
|
||||
};
|
||||
|
||||
struct JoystickAxes {
|
||||
public:
|
||||
std::span<float> Axes() { return std::span{AxesStore.data(), GetCount()}; }
|
||||
|
||||
std::span<const float> Axes() const {
|
||||
return std::span{AxesStore.data(), GetCount()};
|
||||
}
|
||||
|
||||
void SetCount(uint8_t NewCount) {
|
||||
Count = (std::min)(NewCount, static_cast<uint8_t>(MRC_MAX_NUM_AXES));
|
||||
}
|
||||
|
||||
size_t GetCount() const { return Count; }
|
||||
|
||||
private:
|
||||
std::array<float, MRC_MAX_NUM_AXES> AxesStore;
|
||||
uint8_t Count{0};
|
||||
};
|
||||
|
||||
struct JoystickPovs {
|
||||
public:
|
||||
std::span<int16_t> Povs() { return std::span{PovsStore.data(), GetCount()}; }
|
||||
|
||||
std::span<const int16_t> Povs() const {
|
||||
return std::span{PovsStore.data(), GetCount()};
|
||||
}
|
||||
|
||||
void SetCount(uint8_t NewCount) {
|
||||
Count = (std::min)(NewCount, static_cast<uint8_t>(MRC_MAX_NUM_POVS));
|
||||
}
|
||||
|
||||
size_t GetCount() const { return Count; }
|
||||
|
||||
private:
|
||||
std::array<int16_t, MRC_MAX_NUM_POVS> PovsStore;
|
||||
uint8_t Count{0};
|
||||
};
|
||||
|
||||
struct JoystickButtons {
|
||||
uint32_t Buttons;
|
||||
|
||||
void SetCount(uint8_t NewCount) {
|
||||
Count = (std::min)(NewCount, static_cast<uint8_t>(MRC_MAX_NUM_BUTTONS));
|
||||
}
|
||||
|
||||
size_t GetCount() const { return Count; }
|
||||
|
||||
private:
|
||||
uint8_t Count{0};
|
||||
};
|
||||
|
||||
struct Joystick {
|
||||
JoystickAxes Axes;
|
||||
JoystickPovs Povs;
|
||||
JoystickButtons Buttons;
|
||||
};
|
||||
|
||||
struct ControlData {
|
||||
ControlFlags ControlWord;
|
||||
float MatchTime;
|
||||
|
||||
std::span<Joystick> Joysticks() {
|
||||
return std::span{JoysticksStore.data(), GetJoystickCount()};
|
||||
}
|
||||
|
||||
std::span<const Joystick> Joysticks() const {
|
||||
return std::span{JoysticksStore.data(), GetJoystickCount()};
|
||||
}
|
||||
|
||||
size_t GetJoystickCount() const { return JoystickCount; }
|
||||
|
||||
void SetJoystickCount(uint8_t NewCount) {
|
||||
JoystickCount =
|
||||
(std::min)(NewCount, static_cast<uint8_t>(MRC_MAX_NUM_JOYSTICKS));
|
||||
}
|
||||
|
||||
void SetOpMode(std::string_view Mode) {
|
||||
if (Mode.size() > MRC_MAX_OPMODE_LEN) {
|
||||
Mode = Mode.substr(0, MRC_MAX_OPMODE_LEN);
|
||||
}
|
||||
OpMode = Mode;
|
||||
}
|
||||
|
||||
void MoveOpMode(std::string&& Mode) {
|
||||
OpMode = std::move(Mode);
|
||||
if (OpMode.size() > MRC_MAX_OPMODE_LEN) {
|
||||
OpMode.resize(MRC_MAX_OPMODE_LEN);
|
||||
}
|
||||
}
|
||||
|
||||
std::string_view GetOpMode() const { return OpMode; }
|
||||
|
||||
std::span<uint8_t> WritableOpModeBuffer(size_t Len) {
|
||||
if (Len > MRC_MAX_OPMODE_LEN) {
|
||||
Len = MRC_MAX_OPMODE_LEN;
|
||||
}
|
||||
OpMode.resize(Len);
|
||||
return std::span<uint8_t>{reinterpret_cast<uint8_t*>(OpMode.data()),
|
||||
OpMode.size()};
|
||||
}
|
||||
|
||||
private:
|
||||
std::array<Joystick, MRC_MAX_NUM_JOYSTICKS> JoysticksStore;
|
||||
uint8_t JoystickCount{0};
|
||||
std::string OpMode;
|
||||
};
|
||||
|
||||
struct JoystickOutputData {
|
||||
uint32_t HidOutputs{0};
|
||||
float LeftRumble{0};
|
||||
float RightRumble{0};
|
||||
};
|
||||
|
||||
enum class MatchType : uint8_t {
|
||||
None = 0,
|
||||
Practice = 1,
|
||||
Qualification = 2,
|
||||
Playoff = 3,
|
||||
Test = 4,
|
||||
};
|
||||
|
||||
struct MatchInfo {
|
||||
uint16_t MatchNumber{0};
|
||||
uint8_t ReplayNumber{0};
|
||||
MatchType Type{MatchType::None};
|
||||
|
||||
void SetEventName(std::string_view Name) {
|
||||
if (Name.size() > MRC_MAX_EVENT_NAME_LEN) {
|
||||
Name = Name.substr(0, MRC_MAX_EVENT_NAME_LEN);
|
||||
}
|
||||
EventName = Name;
|
||||
}
|
||||
|
||||
void MoveEventName(std::string&& Name) {
|
||||
EventName = std::move(Name);
|
||||
if (EventName.size() > MRC_MAX_EVENT_NAME_LEN) {
|
||||
EventName.resize(MRC_MAX_EVENT_NAME_LEN);
|
||||
}
|
||||
}
|
||||
|
||||
std::string_view GetEventName() const { return EventName; }
|
||||
|
||||
std::span<uint8_t> WritableNameBuffer(size_t Len) {
|
||||
if (Len > MRC_MAX_EVENT_NAME_LEN) {
|
||||
Len = MRC_MAX_EVENT_NAME_LEN;
|
||||
}
|
||||
EventName.resize(Len);
|
||||
return std::span<uint8_t>{reinterpret_cast<uint8_t*>(EventName.data()),
|
||||
EventName.size()};
|
||||
}
|
||||
|
||||
private:
|
||||
std::string EventName;
|
||||
};
|
||||
|
||||
struct JoystickDescriptor {
|
||||
public:
|
||||
bool IsXbox{0};
|
||||
uint8_t Type{0};
|
||||
|
||||
std::span<uint8_t> AxesTypes() {
|
||||
return std::span{AxesTypesStore.data(), GetAxesCount()};
|
||||
}
|
||||
|
||||
std::span<const uint8_t> AxesTypes() const {
|
||||
return std::span{AxesTypesStore.data(), GetAxesCount()};
|
||||
}
|
||||
|
||||
void SetAxesCount(uint8_t NewCount) {
|
||||
AxesCount = (std::min)(NewCount, static_cast<uint8_t>(MRC_MAX_NUM_AXES));
|
||||
}
|
||||
|
||||
size_t GetAxesCount() const { return AxesCount; }
|
||||
|
||||
void SetPovsCount(uint8_t NewCount) {
|
||||
PovCount = (std::min)(NewCount, static_cast<uint8_t>(MRC_MAX_NUM_POVS));
|
||||
}
|
||||
|
||||
size_t GetPovsCount() const { return PovCount; }
|
||||
|
||||
void SetButtonsCount(uint8_t NewCount) {
|
||||
ButtonCount =
|
||||
(std::min)(NewCount, static_cast<uint8_t>(MRC_MAX_NUM_BUTTONS));
|
||||
}
|
||||
|
||||
size_t GetButtonsCount() const { return ButtonCount; }
|
||||
|
||||
void SetName(std::string_view Name) {
|
||||
if (Name.size() > MRC_MAX_JOYSTICK_NAME_LEN) {
|
||||
Name = Name.substr(0, MRC_MAX_JOYSTICK_NAME_LEN);
|
||||
}
|
||||
JoystickName = Name;
|
||||
}
|
||||
|
||||
void MoveName(std::string&& Name) {
|
||||
JoystickName = std::move(Name);
|
||||
if (JoystickName.size() > MRC_MAX_JOYSTICK_NAME_LEN) {
|
||||
JoystickName.resize(MRC_MAX_JOYSTICK_NAME_LEN);
|
||||
}
|
||||
}
|
||||
|
||||
std::string_view GetName() const { return JoystickName; }
|
||||
|
||||
std::span<uint8_t> WritableNameBuffer(size_t Len) {
|
||||
if (Len > MRC_MAX_JOYSTICK_NAME_LEN) {
|
||||
Len = MRC_MAX_JOYSTICK_NAME_LEN;
|
||||
}
|
||||
JoystickName.resize(Len);
|
||||
return std::span<uint8_t>{reinterpret_cast<uint8_t*>(JoystickName.data()),
|
||||
JoystickName.size()};
|
||||
}
|
||||
|
||||
private:
|
||||
std::string JoystickName;
|
||||
std::array<uint8_t, MRC_MAX_NUM_AXES> AxesTypesStore;
|
||||
uint8_t AxesCount{0};
|
||||
uint8_t ButtonCount{0};
|
||||
uint8_t PovCount{0};
|
||||
};
|
||||
|
||||
struct VersionInfo {
|
||||
uint32_t DeviceId{0};
|
||||
|
||||
void SetName(std::string_view NewName) {
|
||||
if (NewName.size() > MRC_MAX_VERSION_SIZE) {
|
||||
NewName = NewName.substr(0, MRC_MAX_VERSION_SIZE);
|
||||
}
|
||||
Name = NewName;
|
||||
}
|
||||
|
||||
void MoveName(std::string&& NewName) {
|
||||
Name = std::move(NewName);
|
||||
if (Name.size() > MRC_MAX_VERSION_SIZE) {
|
||||
Name.resize(MRC_MAX_VERSION_SIZE);
|
||||
}
|
||||
}
|
||||
|
||||
std::string_view GetName() const { return Name; }
|
||||
|
||||
std::span<uint8_t> WritableNameBuffer(size_t Len) {
|
||||
if (Len > MRC_MAX_VERSION_SIZE) {
|
||||
Len = MRC_MAX_VERSION_SIZE;
|
||||
}
|
||||
Name.resize(Len);
|
||||
return std::span<uint8_t>{reinterpret_cast<uint8_t*>(Name.data()),
|
||||
Name.size()};
|
||||
}
|
||||
|
||||
void SetVersion(std::string_view NewVersion) {
|
||||
if (NewVersion.size() > MRC_MAX_VERSION_SIZE) {
|
||||
NewVersion = NewVersion.substr(0, MRC_MAX_VERSION_SIZE);
|
||||
}
|
||||
Version = NewVersion;
|
||||
}
|
||||
|
||||
void MoveVersion(std::string&& NewVersion) {
|
||||
Version = std::move(NewVersion);
|
||||
if (Version.size() > MRC_MAX_VERSION_SIZE) {
|
||||
Version.resize(MRC_MAX_VERSION_SIZE);
|
||||
}
|
||||
}
|
||||
|
||||
std::string_view GetVersion() const { return Version; }
|
||||
|
||||
std::span<uint8_t> WritableVersionBuffer(size_t Len) {
|
||||
if (Len > MRC_MAX_VERSION_SIZE) {
|
||||
Len = MRC_MAX_VERSION_SIZE;
|
||||
}
|
||||
Version.resize(Len);
|
||||
return std::span<uint8_t>{reinterpret_cast<uint8_t*>(Version.data()),
|
||||
Version.size()};
|
||||
}
|
||||
|
||||
private:
|
||||
std::string Name;
|
||||
std::string Version;
|
||||
};
|
||||
|
||||
} // namespace mrc
|
||||
60
hal/src/mrc/include/mrc/NtNetComm.h
Normal file
60
hal/src/mrc/include/mrc/NtNetComm.h
Normal file
@@ -0,0 +1,60 @@
|
||||
// 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
|
||||
|
||||
#define ROBOT_SYSTEM_SERVER_NT_PORT 6810
|
||||
|
||||
#define ROBOT_CONTROL_DATA_PREFIX "/Netcomm/Control/"
|
||||
|
||||
#define ROBOT_WATCHDOG_ACTIVE_PATH (ROBOT_CONTROL_DATA_PREFIX "WatchdogActive")
|
||||
#define ROBOT_CONTROL_DATA_PATH (ROBOT_CONTROL_DATA_PREFIX "ControlData")
|
||||
#define ROBOT_GAME_SPECIFIC_MESSAGE_PATH \
|
||||
(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/")
|
||||
|
||||
#define ROBOT_STATUS_DATA_PREFIX "/Netcomm/Status/"
|
||||
|
||||
#define ROBOT_NEW_ROBOT_PROGRAM_PATH \
|
||||
(ROBOT_STATUS_DATA_PREFIX "NewRobotProgram")
|
||||
#define ROBOT_CODE_STARTED_PATH (ROBOT_STATUS_DATA_PREFIX "UserCodeStarted")
|
||||
#define ROBOT_DISABLED_TRACE_PATH (ROBOT_STATUS_DATA_PREFIX "UserCodeDisabled")
|
||||
#define ROBOT_AUTON_TRACE_PATH (ROBOT_STATUS_DATA_PREFIX "UserCodeAutonomous")
|
||||
#define ROBOT_TELEOP_TRACE_PATH (ROBOT_STATUS_DATA_PREFIX "UserCodeTeleop")
|
||||
#define ROBOT_TEST_TRACE_PATH (ROBOT_STATUS_DATA_PREFIX "UserCodeTest")
|
||||
|
||||
#define ROBOT_OUTPUTS_DATA_PREFIX "/Netcomm/Outputs/"
|
||||
#define ROBOT_JOYSTICK_OUTPUTS_PATH (ROBOT_OUTPUTS_DATA_PREFIX "Joysticks/")
|
||||
|
||||
#define ROBOT_CONSOLE_DATA_PREFIX "/Netcomm/Console/"
|
||||
#define ROBOT_CONSOLE_LINE_PATH (ROBOT_CONSOLE_DATA_PREFIX "ConsoleLine")
|
||||
|
||||
#define ROBOT_REPORTING_DATA_PREFIX "/Netcomm/Reporting/"
|
||||
#define ROBOT_LIB_VERSION_PATH (ROBOT_REPORTING_DATA_PREFIX "LibVersion")
|
||||
#define ROBOT_USER_REPORTING_PATH (ROBOT_REPORTING_DATA_PREFIX "User")
|
||||
|
||||
#define ROBOT_MODES_PREFIX "/Netcomm/Modes/"
|
||||
#define ROBOT_AVAILABLE_OP_MODES_PATH (ROBOT_MODES_PREFIX "AvailableOpModes")
|
||||
|
||||
#define ROBOT_SYSTEM_SERVER_PREFIX "/sys/"
|
||||
#define ROBOT_BATTERY_VOLTAGE_PATH (ROBOT_SYSTEM_SERVER_PREFIX "battery")
|
||||
#define ROBOT_RAM_USED_PATH (ROBOT_SYSTEM_SERVER_PREFIX "ram")
|
||||
#define ROBOT_RAM_BYTES_PATH (ROBOT_SYSTEM_SERVER_PREFIX "ramtotal")
|
||||
#define ROBOT_STORAGE_USED_PATH (ROBOT_SYSTEM_SERVER_PREFIX "storage")
|
||||
#define ROBOT_STORAGE_BYTES_PATH (ROBOT_SYSTEM_SERVER_PREFIX "storagetotal")
|
||||
#define ROBOT_CPU_PATH (ROBOT_SYSTEM_SERVER_PREFIX "cpu")
|
||||
#define ROBOT_CAN_BW_PATH (ROBOT_SYSTEM_SERVER_PREFIX "canbusban")
|
||||
#define ROBOT_TEAM_PATH (ROBOT_SYSTEM_SERVER_PREFIX "team")
|
||||
|
||||
#define MRC_MAX_NUM_JOYSTICKS 6
|
||||
#define MRC_MAX_NUM_AXES 12
|
||||
#define MRC_MAX_NUM_POVS 12
|
||||
#define MRC_MAX_NUM_BUTTONS 32
|
||||
#define MRC_MAX_OPMODE_LEN 32
|
||||
#define MRC_MAX_GAME_SPECIFIC_MESSAGE_LEN 128
|
||||
#define MRC_MAX_EVENT_NAME_LEN 64
|
||||
#define MRC_MAX_JOYSTICK_NAME_LEN 256
|
||||
#define MRC_MAX_VERSION_SIZE 256
|
||||
47
hal/src/mrc/proto/MrcComm.proto
Normal file
47
hal/src/mrc/proto/MrcComm.proto
Normal file
@@ -0,0 +1,47 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package mrc.proto;
|
||||
|
||||
option java_package = "com.mrc.proto";
|
||||
|
||||
message ProtobufJoystickData {
|
||||
uint32 ButtonCount = 1;
|
||||
fixed32 Buttons = 2;
|
||||
repeated float Axes = 3;
|
||||
repeated sint32 POVs = 4;
|
||||
}
|
||||
|
||||
message ProtobufControlData {
|
||||
uint32 ControlWord = 1;
|
||||
float MatchTime = 2;
|
||||
repeated ProtobufJoystickData Joysticks = 3;
|
||||
string OpMode = 4;
|
||||
}
|
||||
|
||||
message ProtobufJoystickDescriptor {
|
||||
string JoystickName = 1;
|
||||
repeated int32 AxisTypes = 2;
|
||||
bool IsXbox = 3;
|
||||
int32 JoystickType = 4;
|
||||
int32 ButtonCount = 5;
|
||||
int32 PovCount = 6;
|
||||
}
|
||||
|
||||
message ProtobufJoystickOutputData {
|
||||
fixed32 HidOutputs = 1;
|
||||
float LeftRumble = 2;
|
||||
float RightRumble = 3;
|
||||
}
|
||||
|
||||
message ProtobufVersionInfo {
|
||||
fixed32 DeviceId = 1;
|
||||
string Name = 2;
|
||||
string Version = 3;
|
||||
}
|
||||
|
||||
message ProtobufMatchInfo {
|
||||
string EventName = 1;
|
||||
int32 MatchNumber = 2;
|
||||
int32 ReplayNumber = 3;
|
||||
int32 MatchType = 4;
|
||||
}
|
||||
Reference in New Issue
Block a user