diff options
| author | Aditya Naik | 2020-04-22 16:30:15 -0400 |
|---|---|---|
| committer | Aditya Naik | 2020-04-22 16:30:15 -0400 |
| commit | 42a683033594289ddc520dffec652967e366e785 (patch) | |
| tree | b39c2746c5137ee65e021326e1d6ea3f7fe960e2 /data.proto | |
| parent | 3bba7e2e56f3459f5d5d67c81b3fa4a41a8c9176 (diff) | |
Added dataflow protocol files
Diffstat (limited to 'data.proto')
| -rw-r--r-- | data.proto | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/data.proto b/data.proto new file mode 100644 index 0000000..1506fb0 --- /dev/null +++ b/data.proto @@ -0,0 +1,83 @@ +// Protocol for Dataflow + +syntax = "proto2"; + + +/* +* SOR codes +* +* |------|----------------------| +* | Code | Instruction | +* | 1 | TX from slave | +* | 2 | RX datapoint | +* | 3 | RX command | +* |------|----------------------| +* +*/ + +message m2s_SOR { + required uint32 SOR_code = 1 [default=1]; + + /* If master wants slave to receive something, it also puts the rx length in the SOR */ + optional uint32 rx_length = 2; +} + + +/* DOC Codes +* +* |------|----------------------| +* | Code | Instruction | +* | 1 | Unicast command | +* | 2 | Multicast command | +* | 3 | Broadcast command | +* | 4 | Reserved | +* | 5 | Data | +* |------|----------------------| +* +*/ + +message s2m_DOC { + /* If master wants to receive something from the slave, the slave specifies whether + it is sending a command or data */ + required uint32 DOC_code = 1 [default=1]; + + /* Also encode the length of the next transmission */ + required uint32 tx_length = 2 [default=0]; + +} + +message m2s_CTS { + required uint32 timeout = 1; +} + +/* Commands when SOR code is 3 */ +message m2s_command { + optional uint32 source_module_id = 1 [default=1]; + optional uint32 source_i2c_address = 2 [default=1]; + + optional bytes cmd_bytes = 3; + optional string cmd_str = 4; +} + +/* Commands from slave */ +message s2m_command { + optional uint32 dest_module_id = 1; + repeated uint32 dest_module_id_multicast = 2; + + optional bytes cmd_bytes = 3; + optional string cmd_str = 4; +} + +message _datapoint { + required uint32 entity_id = 1 [default=0]; + required double data = 2 [default=0]; + + optional uint32 channel_id = 3 [default=1]; + optional uint32 unit_id = 4 [default=1]; + optional int32 timestamp = 5 [default=1]; + +} + +message s2m_data { + repeated _datapoint datapoints = 1; +}
\ No newline at end of file |
