Gude HTTP over serial
Version vom 30. Mai 2014, 13:40 Uhr von Mb (Diskussion | Beiträge)
HTTP over Serial
- offers the EPC HTTP Interface over serial interface
Serial interface Paramaters
- 115200 8N1
- 115200 Baud
- 8bits
- no parity
- one stop bit
Packet format:
- [STX][message-string][ETX][CRX]
- [STX] start of text, (0x02)
- [message string] (CGI in, JSON out)
- [ETX] end of text (0x03)
- CRC: 2 bytes xmodem CRC
Example 1:
request -> [STX] statusjsn.js?components=16384&svt=1&svi=1&svf=1&brief=1 [ETX] [CRC:0x5d49] answer <- [STX] { "sensor_values":[[[1,1,null,1],[[237.310]]]],"eof":1 } [ETX] [CRC:0x5d49]
Example 2:
./hosd --port /dev/ttyS0 --cgi "statusjsn.js?components=16384&svt=1&svi=1&svf=1&brief=1" --batch | python -m json.tool
{ "eof": 1, "sensor_values": [ [ [ 1, 1, null, 1 ], [ [ 236.61 ] ] ] ] }