mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-23 01:21:42 +00:00
[sim] Various WebSockets fixes and enhancements (#2952)
This is a breaking change to the WebSockets layer to align it with recent specification documentation work. To support this, HAL SimValue changed readonly to a direction enum. This allows specifying bidirectional in addition to input and output. The SimValue change is specifically designed to avoid API and ABI breakage. This is completely transparent in C++; in Java a new callback class was added, and the old readonly functions have been marked deprecated. A new SimValue creation function for enums allows specifying double values for each enum value, not just strings. This allows mapping enum values to doubles in the WebSockets layer. A ":" in the SimDevice name now maps it to different WebSocket types (e.g. "Accel:Name" becomes type "Accel", device "Name"). The type is hidden in the GUI. Other WebSockets changes: * Implemented match_time and game_data * Added joystick rumble data * Added builtin accelerometer support * SimValue enums are mapped to string and double value on WS interface * Added WebSockets protocol specification * Added READMEs
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) 2019 FIRST. All Rights Reserved. */
|
||||
/* Copyright (c) 2019-2020 FIRST. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
@@ -14,19 +14,26 @@ HAL_SimDeviceHandle HAL_CreateSimDevice(const char* name) { return 0; }
|
||||
void HAL_FreeSimDevice(HAL_SimDeviceHandle handle) {}
|
||||
|
||||
HAL_SimValueHandle HAL_CreateSimValue(HAL_SimDeviceHandle device,
|
||||
const char* name, HAL_Bool readonly,
|
||||
const char* name, int32_t direction,
|
||||
const struct HAL_Value* initialValue) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
HAL_SimValueHandle HAL_CreateSimValueEnum(HAL_SimDeviceHandle device,
|
||||
const char* name, HAL_Bool readonly,
|
||||
const char* name, int32_t direction,
|
||||
int32_t numOptions,
|
||||
const char** options,
|
||||
int32_t initialValue) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
HAL_SimValueHandle HAL_CreateSimValueEnumDouble(
|
||||
HAL_SimDeviceHandle device, const char* name, int32_t direction,
|
||||
int32_t numOptions, const char** options, const double* optionValues,
|
||||
int32_t initialValue) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void HAL_GetSimValue(HAL_SimValueHandle handle, struct HAL_Value* value) {
|
||||
value->type = HAL_UNASSIGNED;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user