-
Notifications
You must be signed in to change notification settings - Fork 0
/
serial-protocol.txt
28 lines (26 loc) · 1.07 KB
/
serial-protocol.txt
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
Client (Arduino)
================
0) Wait 5 seconds after Serial Port is available and ready
1) Send '*' and wait 200ms
2) send hello message "#hello:\n"
3) Send states "#states:day_state_off=0,day_state_on=1,night_state_off=0,night_state_on=1\n"
The key is the function name, the value is the ENUM associated value
4) Send modes "#modes:day=0,night=1\n"
The key is the mode name, the value is the ENUM associated value
5) Send settings "#params:key=value,key2=value3\n"
Send key/values pairs for monitoring settings
6) Send EndOfInit message "#eoi:\n"
7) Start transmitting for monitor "#monitor:\n"
* MESSAGE FORMAT "<mode>,<state>\n"
* EXAMPLE: "0,0\n"
=> Initial stage, <day> mode, <day_state_off> state
Server (Python Listener)
========================
1) Loop until '*' char is received
2) read next line, '#hello:\n' message
3) read next line, <states>, then parse & store
4) read next line, <modes>, ...
5) read next line, <settings>, ...
6) read next line, <EndOfInit> message
7) read next line, <monitor> announce
7) Loop for each message, read mode, state