summaryrefslogtreecommitdiff
path: root/data.proto
blob: 1506fb07c2b12c63f46d1ca6ff3a2da72cc279a5 (plain)
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
// 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;
}