-
Notifications
You must be signed in to change notification settings - Fork 0
/
server_msg.proto
154 lines (129 loc) · 4.13 KB
/
server_msg.proto
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
// Local Variables:
// mode: c++
// End:
package bling_pb;
// These messages are intended to be sent/received across a TCP/IP
// connection. Every 'real' message is preceeded by a header message
// which provides the length and type of the following message.
// These messages are sent between the client and the master_server.
// Many of these have corresponding messages that are sent from the
// master to the slaves (defined in messages.hpp).
message header
{
enum msg_id_type
{
SEND_ALL_STOP = 0;
GET_SLAVE_LIST = 1;
SLAVE_LIST = 2;
SET_SLAVE_TLC = 3;
START_EFFECT = 4;
PING_SLAVE = 5;
REBOOT_SLAVE = 6;
SLEEP_SLAVE = 7;
WAKE_SLAVE = 8;
PROGRAM_SLAVE = 9;
GET_MASTER_STATUS = 10; // No 'real' message follows
MASTER_STATUS = 11;
SHUTDOWN_MASTER = 12; // No 'real' message follows
}
required msg_id_type msg_id = 1;
required fixed32 len = 2;
}
// Sent as a response to some messages to indicate errors
message nak
{
optional uint32 msg_id = 1;
optional string reason = 2;
}
// Sent as a response to some messages to indicate happiness
message ack
{
optional uint32 msg_id = 1;
}
// master will send all stop commnad to indicated slave.
// master sends no response.
message send_all_stop
{
required uint32 slave_id = 1; // Slave to send all stop to. (0 is broadcast)
optional uint32 repeat = 2 [default = 1];
}
// master will re-run a scan of all slaves (if requested)
// master replys with a slave_list message will all slaves it has found.
message get_slave_list
{
required bool scan = 1; // Whether or not to scan for slaves or use the existing known list
optional uint32 tries = 2; // How many scans to conduct before returning
// Set true to return just those slaves that have responded recently
// false means all the master knows about
optional bool active = 4 [default = true];
optional uint32 slave_id = 3; // used to just get one (or more slave's info)
}
// A list of slaves and their info
message slave_list
{
// Most of these come from the Slave.hpp
message slave_info
{
required uint32 slave_id = 1;
optional string student_name = 17;
optional string drill_id = 18;
optional string version = 2;
optional float age = 3; // seconds since last response
optional float vcell = 4;
optional float soc = 5;
optional uint32 mmc = 6;
optional uint32 fc = 7;
repeated uint32 tlc = 16;
}
repeated slave_info slave = 1;
}
// the master will send either a set_tlc or a set_tlc_ch command to the indicated slave.
// master sends no response.
message set_slave_tlc
{
required uint32 slave_id = 1;
repeated uint32 tlc = 2;
optional uint32 repeat = 3 [default = 1];
}
// master will send the indicated command to the slave(s).
// master sends no response.
// Note that the start_time in this message is relative
// to when the master_server receives the message as opposed
// to an absolute time that is used in the message that is sent
// to the slaves.
message start_effect
{
required uint32 slave_id = 1;
required uint32 effect_id = 2;
required uint32 start_time = 3;
required uint32 duration = 4;
optional uint32 repeat = 5 [default = 1];
}
// master will ping indicated slave.
// master replys with slave_list message with only the indicated slave's info.
// If the slave never responds, the slave_list will be empty.
message ping_slave
{
required uint32 slave_id = 1;
optional uint32 repeat = 2 [default = 1];
}
// master will send a reboot command to the indicated slave.
// master sends no response.
message reboot_slave
{
required uint32 slave_id = 1;
optional uint32 repeat = 2 [default = 1];
}
// master will re-program the indicated slave.
// master replys with slave_list message with only the indicated slave's info.
// If the slave never responds, the slave_list will be empty.
message program_slave
{
required uint32 slave_id = 1;
}
message master_status
{
optional double temperature = 1; // CPU die temp
optional double load = 2; // 1 minute load average
optional uint64 disk_free = 3; // bytes free on disk
}