-
Notifications
You must be signed in to change notification settings - Fork 20
/
data.h
189 lines (143 loc) · 4.36 KB
/
data.h
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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
// nRF8001 data structures
#ifndef _NRF8001_DATA_H
#define _NRF8001_DATA_H
struct nRFCommand {
uint8_t length;
uint8_t command;
union {
uint8_t rawData[NRF_MAX_PACKET_LENGTH-2];
uint8_t testFeature;
uint8_t echoData[NRF_MAX_ECHO_MESSAGE_LENGTH];
uint8_t setupData[NRF_SETUP_DATA_LENGTH];
uint8_t radioTxPowerLevel;
struct {
uint16_t timeout;
uint16_t advInterval;
} connect;
struct {
uint16_t timeout;
uint16_t advInterval;
} bond;
uint8_t disconnectReason;
struct {
uint16_t intervalMin;
uint16_t intervalMax;
uint16_t slaveLatency;
uint16_t timeout;
} changeTimingRequest;
nRFPipe servicePipeNo;
uint16_t dtmCommand;
struct {
uint8_t sequenceNo;
uint8_t dynamicData[NRF_DYNAMIC_DATA_LENGTH];
} writeDynamicData;
struct {
uint8_t applLatencyMode;
uint16_t latency;
} setApplLatency;
struct {
uint8_t keyType;
uint8_t key[NRF_PASSKEY_LENGTH];
} setKey;
uint64_t advServiceDataPipes;
struct {
uint16_t timeout;
uint16_t advInterval;
} broadcast;
struct {
uint8_t servicePipeNo;
uint8_t data[NRF_DATA_LENGTH];
} data;
struct {
uint8_t servicePipeNo;
uint8_t errorCode;
} sendDataNack;
} content;
};
struct nRFEvent {
uint8_t debug;
uint8_t length;
uint8_t event;
union {
uint8_t rawData[NRF_MAX_PACKET_LENGTH-2];
// Various response types
struct {
uint8_t operatingMode;
uint8_t hwError;
uint8_t dataCreditAvailable;
} deviceStarted;
uint8_t echo[NRF_MAX_ECHO_MESSAGE_LENGTH];
struct {
uint16_t lineNo;
uint8_t fileName[NRF_FIRMWARE_FILENAME_LENGTH];
} hardwareError;
struct {
uint8_t opcode;
uint8_t status;
union {
uint8_t rawData[NRF_COMMANDRESPONSEEVENT_LENGTH];
struct {
uint16_t configurationId;
uint8_t aciVersion;
uint8_t setupFormat;
uint32_t setupId;
uint8_t configurationStatus;
} getDeviceVersion;
uint16_t voltage;
uint16_t temperature;
struct {
uint8_t deviceAddress[NRF_ADDRESS_LENGTH];
uint8_t addressType;
} getDeviceAddress;
uint16_t dtmEvent;
struct {
uint8_t sequenceNo;
uint8_t dynamicData[NRF_DYNAMIC_DATA_LENGTH];
} readDynamicData;
} data;
} commandResponse;
struct {
uint8_t addressType;
uint8_t peerAddress[NRF_ADDRESS_LENGTH];
uint16_t connectionInterval;
uint16_t slaveLatency;
uint16_t supervisionTimeout;
uint8_t masterClockAccuracy;
} connected;
struct {
uint8_t aciStatus;
uint8_t btLeStatus;
} disconnected;
struct {
uint8_t bondStatusCode;
uint8_t bondStatusSource;
uint8_t bondStatusSecMode1;
uint8_t bondStatusSecMode2;
uint8_t bondStatusKeyExchSlave;
uint8_t bondStatusKeyExchMaster;
} bondStatus;
struct {
uint64_t pipesOpen;
uint64_t pipesClosed;
} pipeStatus;
struct {
uint16_t connectionInterval;
uint16_t slaveLatency;
uint16_t supervisionTimeout;
} timing;
uint8_t passkey[NRF_PASSKEY_LENGTH];
uint8_t keyType;
uint8_t dataCredits;
struct {
nRFPipe servicePipeNo;
uint8_t errorCode;
uint8_t rawData[NRF_PIPE_ERROR_LENGTH];
} pipeError;
struct {
nRFPipe servicePipeNo;
uint8_t data[NRF_DATA_LENGTH];
} dataReceived;
nRFPipe servicePipeNo;
} msg;
};
#endif /* _NRF8001_DATA_H */