-
Notifications
You must be signed in to change notification settings - Fork 20
/
services.h.example
310 lines (292 loc) · 13.5 KB
/
services.h.example
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
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
/* Copyright (c) 2010 Nordic Semiconductor. All Rights Reserved.
*
* The information contained herein is property of Nordic Semiconductor ASA.
* Terms and conditions of usage are described in detail in NORDIC
* SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
*
* Licensees are granted free, non-transferable use of the information. NO
* WARRANTY of ANY KIND is provided. This heading must NOT be removed from
* the file.
*/
/**
* This file is autogenerated by 1.12.1.1992
*/
#ifndef SETUP_MESSAGES_H__
#define SETUP_MESSAGES_H__
#include "hal_platform.h"
#include "aci.h"
#define PIPE_DEVICE_INFORMATION_SERIAL_NUMBER_STRING_SET 1
#define PIPE_DEVICE_INFORMATION_MANUFACTURER_NAME_STRING_SET 2
#define PIPE_DEVICE_INFORMATION_SYSTEM_ID_SET 3
#define PIPE_DEVICE_INFORMATION_FIRMWARE_REVISION_STRING_SET 4
#define PIPE_HEART_RATE_HEART_RATE_MEASUREMENT_TX 5
#define PIPE_HEART_RATE_HEART_RATE_SENSOR_LOCATION_SET 6
#define PIPE_HEART_RATE_HEART_RATE_CONTROL_POINT_RX_ACK 7
#define PIPE_BATTERY_BATTERY_LEVEL_TX 8
#define PIPE_BATTERY_BATTERY_LEVEL_SET 9
#define NUMBER_OF_PIPES 9
typedef struct
{
aci_pipe_store_t location;
aci_pipe_type_t pipe_type;
} services_pipe_type_mapping_t;
static services_pipe_type_mapping_t services_pipe_type_mapping[NUMBER_OF_PIPES] =
{
{ACI_STORE_LOCAL, ACI_SET},
{ACI_STORE_LOCAL, ACI_SET},
{ACI_STORE_LOCAL, ACI_SET},
{ACI_STORE_LOCAL, ACI_SET},
{ACI_STORE_LOCAL, ACI_TX},
{ACI_STORE_LOCAL, ACI_SET},
{ACI_STORE_LOCAL, ACI_RX_ACK},
{ACI_STORE_LOCAL, ACI_TX},
{ACI_STORE_LOCAL, ACI_SET},
};
#define GAP_PPCP_MAX_CONN_INT 0x320 /**< Maximum connection interval as a multiple of 1.25 msec , 0xFFFF means no specific value requested */
#define GAP_PPCP_MIN_CONN_INT 0x190 /**< Minimum connection interval as a multiple of 1.25 msec , 0xFFFF means no specific maximum*/
#define GAP_PPCP_SLAVE_LATENCY 0
#define GAP_PPCP_CONN_TIMEOUT 0x1f6 /** Connection Supervision timeout multiplier as a multiple of 10msec, 0xFFFF means no specific value requested */
/** @brief do a set_local_data a new value for PIPE_DEVICE_INFORMATION_SERIAL_NUMBER_STRING_SET
* @param src source buffer to send data from.
* Presentation format: UTF-8 string
* @param size the number of bytes to send. Maximum size is 4
* @details use this function to do a set_local_data for PIPE_DEVICE_INFORMATION_SERIAL_NUMBER_STRING_SET. If no transaction are currently
* running, the set will be immediate, otherwise, it will be done at the end of the current transaction
* when services_update_pipes will be called.
*/
void services_set_device_information_serial_number_string(void *src, int size);
/** @brief do a set_local_data a new value for PIPE_DEVICE_INFORMATION_MANUFACTURER_NAME_STRING_SET
* @param src source buffer to send data from.
* Presentation format: UTF-8 string
* @param size the number of bytes to send. Maximum size is 20
* @details use this function to do a set_local_data for PIPE_DEVICE_INFORMATION_MANUFACTURER_NAME_STRING_SET. If no transaction are currently
* running, the set will be immediate, otherwise, it will be done at the end of the current transaction
* when services_update_pipes will be called.
*/
void services_set_device_information_manufacturer_name_string(void *src, int size);
/** @brief do a set_local_data a new value for PIPE_DEVICE_INFORMATION_SYSTEM_ID_SET
* @param src source buffer to send data from
* @param size the number of bytes to send. Maximum size is 8
* @details use this function to do a set_local_data for PIPE_DEVICE_INFORMATION_SYSTEM_ID_SET. If no transaction are currently
* running, the set will be immediate, otherwise, it will be done at the end of the current transaction
* when services_update_pipes will be called.
*/
void services_set_device_information_system_id(void *src, int size);
/** @brief do a set_local_data a new value for PIPE_DEVICE_INFORMATION_FIRMWARE_REVISION_STRING_SET
* @param src source buffer to send data from.
* Presentation format: UTF-8 string
* @param size the number of bytes to send. Maximum size is 4
* @details use this function to do a set_local_data for PIPE_DEVICE_INFORMATION_FIRMWARE_REVISION_STRING_SET. If no transaction are currently
* running, the set will be immediate, otherwise, it will be done at the end of the current transaction
* when services_update_pipes will be called.
*/
void services_set_device_information_firmware_revision_string(void *src, int size);
/** @brief send a new value for PIPE_HEART_RATE_HEART_RATE_MEASUREMENT_TX
* @param src source buffer to send data from
* @param size the number of bytes to send. Maximum size is 19
* @param is_freshest_sample set it to true if you want to overwrite an eventual pending transaction on this pipe.
* @details use this function to send a new value for PIPE_HEART_RATE_HEART_RATE_MEASUREMENT_TX. If no transaction are currently
* running, the send will be immediate, otherwise, it will be done at the end of the current transaction
* when services_update_pipes will be called. If a transaction on this pipe is already pending, then this function
* will not overwrite the data of the previous transaction and return false.
* @return : true if is_freshest_sample true, otherwise return false if a transaction on this pipe is already pending, true otherwise.
*/
bool services_send_heart_rate_heart_rate_measurement(void *src, int size, bool is_freshest_sample);
/** @brief do a set_local_data a new value for PIPE_HEART_RATE_HEART_RATE_SENSOR_LOCATION_SET
* @param src the value to send
* @details use this function to do a set_local_data for PIPE_HEART_RATE_HEART_RATE_SENSOR_LOCATION_SET. If no transaction are currently
* running, the set will be immediate, otherwise, it will be done at the end of the current transaction
* when services_update_pipes will be called.
*/
void services_set_heart_rate_heart_rate_sensor_location(uint8_t src);
/** @brief send an acknowledge rx ack pipe for PIPE_HEART_RATE_HEART_RATE_CONTROL_POINT_RX_ACK
* @details use this function to acknowledge PIPE_HEART_RATE_HEART_RATE_CONTROL_POINT_RX_ACK. If no transaction are pending, it
* would be sent immediately, otherwise, it will be done at the end of the current transaction when services_update_pipes
* will be called.
*/
void services_acknowledge_heart_rate_heart_rate_control_point(const unsigned char error_code);
/** @brief send a new value for PIPE_BATTERY_BATTERY_LEVEL_TX
* @param src the value to send
* @param is_freshest_sample set it to true if you want to overwrite an eventual pending transaction on this pipe.
* @details use this function to send a new value for PIPE_BATTERY_BATTERY_LEVEL_TX. If no transaction are currently
* running, the send will be immediate, otherwise, it will be done at the end of the current transaction
* when services_update_pipes will be called. If a transaction on this pipe is already pending, then this function
* will not overwrite the data of the previous transaction and return false.
* @return : true if is_freshest_sample true, otherwise return false if a transaction on this pipe is already pending, true otherwise.
*/
bool services_send_battery_battery_level(uint8_t src, bool is_freshest_sample);
/** @brief do a set_local_data a new value for PIPE_BATTERY_BATTERY_LEVEL_SET
* @param src the value to send
* @details use this function to do a set_local_data for PIPE_BATTERY_BATTERY_LEVEL_SET. If no transaction are currently
* running, the set will be immediate, otherwise, it will be done at the end of the current transaction
* when services_update_pipes will be called.
*/
void services_set_battery_battery_level(uint8_t src);
/** @brief function to trig pending transaction on pipes
* @details This function check for each pipe if it has a pending transaction (send/rx_request/ack)
* and if so executes this transaction.
* This function should be called in the APP_RUN state of the process function of the application.
*/
void services_update_pipes(void);
#define NB_SETUP_MESSAGES 27
#define SETUP_MESSAGES_CONTENT {\
{0x00,\
{\
0x07,0x06,0x00,0x00,0x03,0x02,0x40,0x6c,\
},\
},\
{0x00,\
{\
0x1f,0x06,0x10,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x09,0x00,0x06,0x00,0x00,0x06,0x00,0x00,\
0x81,0x0d,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\
},\
},\
{0x00,\
{\
0x1f,0x06,0x10,0x1c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\
0x00,0x00,0x00,0x12,0x00,0x00,0x00,0x12,0x03,0x90,0x00,0x14,\
},\
},\
{0x00,\
{\
0x1f,0x06,0x10,0x38,0x02,0xff,0x00,0x00,0x00,0x05,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\
},\
},\
{0x00,\
{\
0x05,0x06,0x10,0x54,0x00,0x00,\
},\
},\
{0x00,\
{\
0x1f,0x06,0x20,0x00,0x04,0x04,0x02,0x02,0x00,0x01,0x28,0x00,0x01,0x00,0x18,0x04,0x04,0x05,0x05,0x00,\
0x02,0x28,0x03,0x01,0x0e,0x03,0x00,0x00,0x2a,0x04,0x14,0x0f,\
},\
},\
{0x00,\
{\
0x1f,0x06,0x20,0x1c,0x0f,0x00,0x03,0x2a,0x00,0x01,0x4e,0x6f,0x72,0x64,0x69,0x63,0x20,0x48,0x52,0x4d,\
0x20,0x56,0x31,0x2e,0x30,0x04,0x04,0x05,0x05,0x00,0x04,0x28,\
},\
},\
{0x00,\
{\
0x1f,0x06,0x20,0x38,0x03,0x01,0x02,0x05,0x00,0x01,0x2a,0x06,0x04,0x03,0x02,0x00,0x05,0x2a,0x01,0x01,\
0x00,0x00,0x04,0x04,0x05,0x05,0x00,0x06,0x28,0x03,0x01,0x02,\
},\
},\
{0x00,\
{\
0x1f,0x06,0x20,0x54,0x07,0x00,0x04,0x2a,0x06,0x04,0x09,0x08,0x00,0x07,0x2a,0x04,0x01,0x90,0x01,0x20,\
0x03,0x00,0x00,0xf6,0x01,0x04,0x04,0x02,0x02,0x00,0x08,0x28,\
},\
},\
{0x00,\
{\
0x1f,0x06,0x20,0x70,0x00,0x01,0x01,0x18,0x04,0x04,0x02,0x02,0x00,0x09,0x28,0x00,0x01,0x0a,0x18,0x04,\
0x04,0x05,0x05,0x00,0x0a,0x28,0x03,0x01,0x02,0x0b,0x00,0x25,\
},\
},\
{0x00,\
{\
0x1f,0x06,0x20,0x8c,0x2a,0x06,0x04,0x05,0x04,0x00,0x0b,0x2a,0x25,0x01,0x31,0x35,0x38,0x37,0x06,0x04,\
0x08,0x07,0x00,0x0c,0x29,0x04,0x01,0x19,0x00,0x00,0x00,0x01,\
},\
},\
{0x00,\
{\
0x1f,0x06,0x20,0xa8,0x00,0x00,0x04,0x04,0x05,0x05,0x00,0x0d,0x28,0x03,0x01,0x02,0x0e,0x00,0x29,0x2a,\
0x06,0x04,0x15,0x14,0x00,0x0e,0x2a,0x29,0x01,0x4e,0x6f,0x72,\
},\
},\
{0x00,\
{\
0x1f,0x06,0x20,0xc4,0x64,0x69,0x63,0x53,0x65,0x6d,0x69,0x63,0x6f,0x6e,0x64,0x75,0x63,0x74,0x6f,0x72,\
0x00,0x06,0x04,0x08,0x07,0x00,0x0f,0x29,0x04,0x01,0x19,0x00,\
},\
},\
{0x00,\
{\
0x1f,0x06,0x20,0xe0,0x00,0x00,0x01,0x00,0x00,0x04,0x04,0x05,0x05,0x00,0x10,0x28,0x03,0x01,0x02,0x11,\
0x00,0x23,0x2a,0x06,0x04,0x09,0x08,0x00,0x11,0x2a,0x23,0x01,\
},\
},\
{0x00,\
{\
0x1f,0x06,0x20,0xfc,0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa,0x04,0x04,0x05,0x05,0x00,0x12,0x28,0x03,\
0x01,0x02,0x13,0x00,0x26,0x2a,0x06,0x04,0x05,0x04,0x00,0x13,\
},\
},\
{0x00,\
{\
0x1f,0x06,0x21,0x18,0x2a,0x26,0x01,0x30,0x31,0x2e,0x31,0x06,0x04,0x08,0x07,0x00,0x14,0x29,0x04,0x01,\
0x19,0x00,0x00,0x00,0x01,0x00,0x00,0x04,0x04,0x02,0x02,0x00,\
},\
},\
{0x00,\
{\
0x1f,0x06,0x21,0x34,0x15,0x28,0x00,0x01,0x0d,0x18,0x04,0x04,0x05,0x05,0x00,0x16,0x28,0x03,0x01,0x10,\
0x17,0x00,0x37,0x2a,0x14,0x00,0x13,0x00,0x00,0x17,0x2a,0x37,\
},\
},\
{0x00,\
{\
0x1f,0x06,0x21,0x50,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\
0x00,0x00,0x00,0x00,0x46,0x14,0x03,0x02,0x00,0x18,0x29,0x02,\
},\
},\
{0x00,\
{\
0x1f,0x06,0x21,0x6c,0x01,0x00,0x00,0x04,0x04,0x05,0x05,0x00,0x19,0x28,0x03,0x01,0x02,0x1a,0x00,0x38,\
0x2a,0x06,0x04,0x02,0x01,0x00,0x1a,0x2a,0x38,0x01,0x03,0x04,\
},\
},\
{0x00,\
{\
0x1f,0x06,0x21,0x88,0x04,0x05,0x05,0x00,0x1b,0x28,0x03,0x01,0x08,0x1c,0x00,0x39,0x2a,0x46,0x10,0x02,\
0x01,0x00,0x1c,0x2a,0x39,0x01,0x00,0x04,0x04,0x02,0x02,0x00,\
},\
},\
{0x00,\
{\
0x1f,0x06,0x21,0xa4,0x1d,0x28,0x00,0x01,0x0f,0x18,0x04,0x04,0x05,0x05,0x00,0x1e,0x28,0x03,0x01,0x12,\
0x1f,0x00,0x19,0x2a,0x16,0x04,0x02,0x01,0x00,0x1f,0x2a,0x19,\
},\
},\
{0x00,\
{\
0x11,0x06,0x21,0xc0,0x01,0x64,0x46,0x14,0x03,0x02,0x00,0x20,0x29,0x02,0x01,0x00,0x00,0x00,\
},\
},\
{0x00,\
{\
0x1f,0x06,0x40,0x00,0x2a,0x25,0x01,0x00,0x80,0x04,0x00,0x0b,0x00,0x00,0x2a,0x29,0x01,0x00,0x80,0x04,\
0x00,0x0e,0x00,0x00,0x2a,0x23,0x01,0x00,0x80,0x04,0x00,0x11,\
},\
},\
{0x00,\
{\
0x1f,0x06,0x40,0x1c,0x00,0x00,0x2a,0x26,0x01,0x00,0x80,0x04,0x00,0x13,0x00,0x00,0x2a,0x37,0x01,0x00,\
0x02,0x04,0x00,0x17,0x00,0x18,0x2a,0x38,0x01,0x00,0x80,0x04,\
},\
},\
{0x00,\
{\
0x1b,0x06,0x40,0x38,0x00,0x1a,0x00,0x00,0x2a,0x39,0x01,0x00,0x10,0x04,0x00,0x1c,0x00,0x00,0x2a,0x19,\
0x01,0x00,0x82,0x04,0x00,0x1f,0x00,0x20,\
},\
},\
{0x00,\
{\
0x1b,0x06,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\
},\
},\
{0x00,\
{\
0x06,0x06,0xf0,0x00,0x03,0x18,0x28,\
},\
},\
}
#endif