-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathHubToLocalMessage.fbs
99 lines (80 loc) · 1.7 KB
/
HubToLocalMessage.fbs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
include "./Types/WifiScanStatus.fbs";
include "./Types/WifiNetwork.fbs";
include "./Types/WifiNetworkEventType.fbs";
include "./HubConfig.fbs";
attribute "fs_serializer";
namespace OpenShock.Serialization.Local;
table ReadyMessage {
poggies:bool;
connected_wifi:Types.WifiNetwork;
account_linked:bool;
config:Configuration.HubConfig;
gpio_valid_inputs:[int8];
gpio_valid_outputs:[int8];
}
table ErrorMessage {
message:string;
}
table WifiScanStatusMessage {
status:Types.WifiScanStatus;
}
table WifiNetworkEvent {
event_type:Types.WifiNetworkEventType;
networks:[Types.WifiNetwork];
}
table WifiGotIpEvent {
ip:string;
}
table WifiLostIpEvent {
ip:string;
}
enum AccountLinkResultCode : uint8 {
Success = 0,
CodeRequired = 1,
InvalidCodeLength = 2,
NoInternetConnection = 3,
InvalidCode = 4,
RateLimited = 5,
InternalError = 6
}
table AccountLinkCommandResult {
result:AccountLinkResultCode;
}
enum SetGPIOResultCode : uint8 {
Success = 0,
InvalidPin = 1,
InternalError = 2
}
table SetRfTxPinCommandResult {
pin:int8;
result:SetGPIOResultCode;
}
table SetEstopEnabledCommandResult {
enabled:bool;
success:bool;
}
table SetEstopPinCommandResult {
gpio_pin:int8;
result:SetGPIOResultCode;
}
union HubToLocalMessagePayload {
// General stuff
ReadyMessage,
ErrorMessage,
// Wifi stuff
WifiScanStatusMessage,
WifiNetworkEvent,
WifiGotIpEvent,
WifiLostIpEvent,
// Account linking stuff
AccountLinkCommandResult,
// RF transmitter stuff
SetRfTxPinCommandResult,
// E-stop stuff
SetEstopEnabledCommandResult,
SetEstopPinCommandResult
}
table HubToLocalMessage (fs_serializer) {
payload:HubToLocalMessagePayload;
}
root_type HubToLocalMessage;