cgms.h
Go to the documentation of this file.
1 /**
2 ****************************************************************************************
3 *
4 * @file cgms.h
5 *
6 * @brief Continuous Glucose Monitoring Service API.
7 *
8 ****************************************************************************************
9 * @attention
10 #####Copyright (c) 2019 GOODIX
11 All rights reserved.
12
13 Redistribution and use in source and binary forms, with or without
14 modification, are permitted provided that the following conditions are met:
15 * Redistributions of source code must retain the above copyright
16 notice, this list of conditions and the following disclaimer.
17 * Redistributions in binary form must reproduce the above copyright
18 notice, this list of conditions and the following disclaimer in the
19 documentation and/or other materials provided with the distribution.
20 * Neither the name of GOODIX nor the names of its contributors may be used
21 to endorse or promote products derived from this software without
22 specific prior written permission.
23
24 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE
28 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34 POSSIBILITY OF SUCH DAMAGE.
35 *****************************************************************************************
36 */
37
38 /**
39 * @addtogroup BLE_SRV BLE Services
40 * @{
41 * @brief Definitions and prototypes for the BLE Service interface.
42 */
43
44 /**
45 * @defgroup BLE_SDK_CGMS Continuous Glucose Monitoring Service (CGMS)
46 * @{
47 * @brief Continuous Glucose Monitoring Service module.
48 *
49 * @details The Continuous Glucose Monitoring Service exposes glucose and other data related to
50 * a personal Continuous Glucose Monitoring (CGM) sensor for use in consumer healthcare applications.
51 * This module implements the Continuous Glucose Monitoring Service with CGM Measurement, CGM Feature,
52 * CGM Status, CGM Session Start Time, CGM Session Run Time, Record Access Control Point and CGM Specific
53 * Ops Control Point characteristics.
54 */
55
56 #ifndef __CGMS_H__
57 #define __CGMS_H__
58
59 /*
60 * INCLUDE FILES
61 ****************************************************************************************
62 */
63 #include "gr_includes.h"
64 #include "custom_config.h"
65
66 #include "cgms_racp.h"
67
68 /**
69 * @defgroup CGMS_MACRO Defines
70 * @{
71 */
72 #define CGMS_CONNECTION_MAX 10
73 #define CGMS_MEASUREMENT_VAL_LEN_MAX 15
74 #define CGMS_FEATURE_VAL_LEN_MAX 6
75 #define CGMS_STATUS_VAL_LEN_MAX 7
76 #define CGMS_RUN_TIME_VAL_LEN_MAX 4
77 #define CGMS_START_TIME_VAL_LEN_MAX 11
78 #define CGMS_RACP_VAL_LEN_MAX 7
79 #define CGMS_RACP_VAL_LEN_MIN 2
80
81 #define CGMS_ERROR_MISSING_CRC 0x80 /**< Error code: If E2E-CRC is supported and a Write procedure is processed without CRC attached. */
82 #define CGMS_ERROR_INVALID_CRC 0x81 /**< Error code: If E2E-CRC is supported and a Write procedure is processed with incorrect or invalid CRC value attached. */
83 #define CGMS_ERROR_CCCD_NOT_CFG 0xFD
84 #define CGMS_ERROR_PRO_IN_PROCESS 0xFE
85
86 /**
87 * @defgroup CGMS_FEAT CGM Feature
88 * @{
89 * @brief CGM feature.
90 */
91 #define CGMS_FEAT_CALIBRATION (0x01 << 0)
92 #define CGMS_FEAT_PATIENT_HIGH_LOW_ALERT (0x01 << 1)
93 #define CGMS_FEAT_HYPO_ALERT (0x01 << 2)
94 #define CGMS_FEAT_HYPER_ALERT (0x01 << 3)
95 #define CGMS_FEAT_RATE_INC_DEC_ALERT (0x01 << 4)
96 #define CGMS_FEAT_DEV_SPEC_ALERT (0x01 << 5)
97 #define CGMS_FEAT_SENSOR_MAL_DET (0x01 << 6)
98 #define CGMS_FEAT_TEMP_HIGH_LOW_DET (0x01 << 7)
99 #define CGMS_FEAT_RESULT_HIGH_LOW_DET (0x01 << 8)
100 #define CGMS_FEAT_LOW_BATTERY_DET (0x01 << 9)
101 #define CGMS_FEAT_SENSOR_TYPE_ERR_DET (0x01 << 10)
102 #define CGMS_FEAT_GENERAL_DEV_FAULT_DET (0x01 << 11)
103 #define CGMS_FEAT_E2E_CRC (0x01 << 12)
104 #define CGMS_FEAT_MULTIPLE_BOND (0x01 << 13)
105 #define CGMS_FEAT_MULTIPLE_SESSION (0x01 << 14)
106 #define CGMS_FEAT_TREND_INFORMATION (0x01 << 15)
107 #define CGMS_FEAT_QUALITY (0x01 << 16)
108 #define CGMS_FEAT_FULL (0x1ffff) /**< All feature Supported. */
109 /** @} */
110
111
112 /**
113 * @defgroup CGMS_MEAS_FLAG Measurement Flag
114 * @{
115 * @brief CGM Measurement Flags.
116 */
117 #define CGMS_MEAS_FLAG_TREND_INFO_PRESENT (0x01 << 0)
118 #define CGMS_MEAS_FLAG_QUALITY_PRESENT (0x01 << 1)
119 #define CGMS_MEAS_FLAG_WARING_PRESENT (0x01 << 5)
120 #define CGMS_MEAS_FLAG_CAL_TEMP_PRESENT (0x01 << 6)
121 #define CGMS_MEAS_FLAG_STATUS_PRESENT (0x01 << 7)
122 #define CGMS_MEAS_FLAG_FULL (0xe3)
123 /** @} */
124
125 /**
126 * @defgroup CGMS_MEAS_STATUS Measurement status
127 * @{
128 * @brief Glucose measurement status
129 */
130 #define CGMS_ANN_STATUS_SESSION_STOPPED (0x01 << 0)
131 #define CGMS_ANN_STATUS_DEV_BATTERY_LOW (0x01 << 1)
132 #define CGMS_ANN_STATUS_SENSOR_TYPE_INCORRECT (0x01 << 2)
133 #define CGMS_ANN_STATUS_SENSOR_MALFUNCTION (0x01 << 3)
134 #define CGMS_ANN_STATUS_DEV_SPEC_ALERT (0x01 << 4)
135 #define CGMS_ANN_STATUS_GEN_DEV_FAULT (0x01 << 5)
136
137 #define CGMS_ANN_CAL_TEMP_TIME_SYNC_REQ (0x01 << 0)
138 #define CGMS_ANN_CAL_TEMP_CAL_NOT_ALLOWED (0x01 << 1)
139 #define CGMS_ANN_CAL_TEMP_CAL_RECOMMENED (0x01 << 2)
140 #define CGMS_ANN_CAL_TEMP_CAL_REQ (0x01 << 3)
141 #define CGMS_ANN_CAL_TEMP_TEMP_TOO_HIGH (0x01 << 4)
142 #define CGMS_ANN_CAL_TEMP_TEMP_TOO_LOW (0x01 << 5)
143 #define CGMS_ANN_CAL_TEMP_CAL_PROCESS_PENDING (0x01 << 6)
144
145 #define CGMS_ANN_WARN_RESULT_LOWER_THAN_PATIENT_LOW_LVL (0x01 << 0)
146 #define CGMS_ANN_WARN_RESULT_HIGHER_THAN_PATIENT_HIGH_LVL (0x01 << 1)
147 #define CGMS_ANN_WARN_RESULT_LOWER_THAN_HYPO_LVL (0x01 << 2)
148 #define CGMS_ANN_WARN_RESULT_HIGHER_THAN_HYPER_LVL (0x01 << 3)
149 #define CGMS_ANN_WARN_RATE_OF_DECREASE_EXCEEDED (0x01 << 4)
150 #define CGMS_ANN_WARN_RATE_OF_INCREASE_EXCEEDED (0x01 << 5)
151 #define CGMS_ANN_WARN_RESULT_LOWER_THAN_DEV_CAN_PROCESS (0x01 << 6)
152 #define CGMS_ANN_WARN_RESULT_HIGHER_THAN_DEV_CAN_PROCESS (0x01 << 7)
153 /** @} */
154 /** @} */
155
156 /**
157 * @defgroup CGMS_ENUM Enumerations
158 * @{
159 */
160 /**@brief CGM measurement type */
161 typedef enum
162 {
163 CGMS_MEAS_TYPE_CAP_BLOOD = 0x01, /**< Capillary whole blood */
164 CGMS_MEAS_TYPE_CAP_PLASMA, /**< Capillary plasma */
165 CGMS_MEAS_TYPE_VEN_BLOOD, /**< Venous whole blood */
166 CGMS_MEAS_TYPE_VEN_PLASMA, /**< Venous plasma */
167 CGMS_MEAS_TYPE_ART_BLOOD, /**< Arterial whole blood */
168 CGMS_MEAS_TYPE_ART_PLASMA, /**< Arterial plasma */
169 CGMS_MEAS_TYPE_UNDET_BLOOD, /**< Undetermined whole blood */
170 CGMS_MEAS_TYPE_UNDET_PLASMA, /**< Undetermined plasma */
171 CGMS_MEAS_TYPE_FLUID, /**< Interstitial fluid (ISF) */
172 CGMS_MEAS_TYPE_CONTROL, /**< Control solution */
173 } cgms_meas_type_t;
174
175 /**@brief CGM measurement location */
176 typedef enum
177 {
178 CGMS_MEAS_LOC_FINGER = 0x01, /**< Finger */
179 CGMS_MEAS_LOC_AST, /**< Alternate Site Test (AST) */
180 CGMS_MEAS_LOC_EAR, /**< Earlobe */
181 CGMS_MEAS_LOC_CONTROL, /**< Control solution */
182 CGMS_MEAS_LOC_SUB_TISSUE, /**< Subcutaneous tissue */
183 } cgms_meas_loc_t;
184
185
186 typedef enum
187 {
188 CGMS_CAL_STATUS_REJECT,
189 CGMS_CAL_STATUS_OUT_OF_RANGE,
190 CGMS_CAL_STATUS_PROCESS_PENGDING,
191 } cgms_cal_status_t;
192
193 typedef enum
194 {
195 CGMS_CCCD_STATUS_MEAS_ENABLED,
196 CGMS_CCCD_STATUS_MEAS_DISABLED,
197 CGMS_CCCD_STATUS_RACP_ENABLED,
198 CGMS_CCCD_STATUS_RACP_DISABLED,
199 CGMS_CCCD_STATUS_SPCP_ENABLED,
200 CGMS_CCCD_STATUS_SPCP_DISABLED,
201 CGMS_CCCD_STATUS_FEAT_ENABLED,
202 CGMS_CCCD_STATUS_FEAT_DISABLED,
203 } cgms_cccd_status_t;
204
205 typedef enum
206 {
207 CGMS_GET_INFO_NONE,
208 CGMS_GET_INFO_ANN_STATUS,
209 CGMS_GET_INFO_SES_START_TIME,
210 CGMS_GET_INFO_SES_RUN_TIME,
211 } cgms_get_info_code_t;
212
213 typedef enum
214 {
215 CGMS_CP_CODE_NONE,
216 CGMS_CP_CODE_SET_COM_INTERVAL,
217 CGMS_CP_CODE_GET_COM_INTERVAL,
218 CGMS_CP_CODE_SET_CAL_VALUE = 0x04,
219 CGMS_CP_CODE_GET_CAL_VALUE,
220 CGMS_CP_CODE_SET_PATIENT_HIGHT_LVL = 0x07,
221 CGMS_CP_CODE_GET_PATIENT_HIGHT_LVL,
222 CGMS_CP_CODE_SET_PATIENT_LOW_LVL = 0x0a,
223 CGMS_CP_CODE_GET_PATIENT_LOW_LVL,
224 CGMS_CP_CODE_SET_HYPO_LVL = 0x0d,
225 CGMS_CP_CODE_GET_HYPO_LVL,
226 CGMS_CP_CODE_SET_HYPER_LVL = 0x10,
227 CGMS_CP_CODE_GET_HYPER_LVL,
228 CGMS_CP_CODE_SET_RATE_OF_DEC_LVL = 0x13,
229 CGMS_CP_CODE_GET_RATE_OF_DEC_LVL,
230 CGMS_CP_CODE_SET_RATE_OF_INC_LVL = 0x16,
231 CGMS_CP_CODE_GET_RATE_OF_INC_LVL,
232 CGMS_CP_CODE_RESET_DEV_SPEC_ALERT = 0x19,
233 CGMS_CP_CODE_START_THE_SESSION,
234 CGMS_CP_CODE_STOP_THE_SESSION,
235 CGMS_CP_CODE_SET_SES_START_TIME,
236 } cgms_cp_cmd_code_t;
237
238 typedef enum
239 {
240 CGMS_CMD_RET_CODE_RESERVED = 0x00,
241 CGMS_CMD_RET_CODE_SUCESS,
242 CGMS_CMD_RET_CODE_NOT_SUPPORT,
243 CGMS_CMD_RET_CODE_INVALID_OPERAND,
244 CGMS_CMD_RET_CODE_PROCEDURE_NOT_COMPLETED,
245 CGMS_CMD_RET_CODE_PARAM_OUT_OF_RANGE,
246 } cgms_cp_cmd_ret_t;
247
248 /** @} */
249
250 /**
251 * @defgroup CGMS_STRUCT Structures
252 * @{
253 */
254 typedef struct
255 {
256 uint16_t time_offset;
257 uint8_t status;
258 uint8_t cal_temp;
259 uint8_t warning;
260 } __attribute__((packed)) cgms_ann_status_t;
261
262 typedef struct
263 {
264 uint16_t year; /**< year time element. */
265 uint8_t month; /**< month time element. */
266 uint8_t day; /**< day time element. */
267 uint8_t hour; /**< hour time element. */
268 uint8_t min; /**< minute time element. */
269 uint8_t sec; /**< second time element. */
270 int8_t time_zone;
271 uint8_t dst_offset;
272 } __attribute__((packed)) cgms_time_t;
273
274 typedef struct
275 {
276 int16_t concentration;
277 uint16_t since_start_time_minutes;
278 uint8_t meas_type : 4;
279 uint8_t meas_loc : 4;
280 uint16_t next_cal_time_minutes;
281 uint16_t cal_data_record_num;
282 uint8_t cal_status;
283 } __attribute__((packed)) cgms_cal_value_t;
284
285 typedef union
286 {
287 cgms_ann_status_t ann_status;
288 cgms_time_t start_time;
289 uint16_t run_time;
290 } cgms_get_info_req_t;
291
292 typedef struct
293 {
294 cgms_cp_cmd_code_t cp_code;
295 union
296 {
297 uint8_t comm_interval_in_minutes;
298 cgms_time_t start_time;
299 cgms_cal_value_t cal_value;
300 int16_t cal_data_rec_num;
301 int16_t patient_high_alert_level;
302 int16_t patient_low_alert_level;
303 int16_t hypo_alert_level;
304 int16_t hyper_alert_level;
305 int16_t rate_of_dec_alert_level;
306 int16_t rate_of_inc_alert_level;
307 } param;
308 } cgms_cp_cmd_req_t;
309
310 typedef struct
311 {
312 cgms_cp_cmd_code_t cp_code;
313 cgms_cp_cmd_ret_t cp_ret;
314 union
315 {
316 uint8_t comm_interval_in_minutes;
317 cgms_cal_value_t cal_value;
318 int16_t patient_high_alert_level;
319 int16_t patient_low_alert_level;
320 int16_t hypo_alert_level;
321 int16_t hyper_alert_level;
322 int16_t rate_of_dec_alert_level;
323 int16_t rate_of_inc_alert_level;
324 } param;
325 } cgms_cp_cmd_rsp_t;
326
327
328 /**@brief Glucose Measurement structure. This contains glucose measurement value. */
329 typedef struct
330 {
331 uint8_t flags; /**< Flags. */
332 int16_t glucose_concentration; /**< Glucose concentration. */
333 cgms_ann_status_t ann_status;
334 uint16_t trend_info;
335 uint16_t quality;
336 } cgms_meas_rec_t;
337 /** @} */
338
339 /**
340 * @defgroup CGMS_TYPEDEF Typedefs
341 * @{
342 */
343 typedef void (*cgms_cccd_change_handler_t)(uint8_t conn_idx, cgms_cccd_status_t cccd_status);
344
345 typedef void (*cgms_get_info_req_handler_t)(uint8_t conn_idx, cgms_get_info_code_t code, cgms_get_info_req_t *data_out);
346
347 typedef void (*cgms_cp_cmd_req_handler_t)(uint8_t conn_idx, cgms_cp_cmd_req_t *req);
348
349 typedef void (*cgms_racp_req_handler_t)(uint8_t conn_idx, cgms_racp_req_t *req);
350
351 typedef uint16_t (*cgms_rec_num_get_func_t)(void);
352 typedef void (*cgms_db_rec_delete_func_t)(uint8_t rec_idx);
353 typedef void (*cgms_db_rec_get_func_t)(uint8_t rec_idx, cgms_meas_rec_t *p_rec);
354 /** @} */
355
356 /**
357 * @defgroup CGMS_STRUCT Structures
358 * @{
359 */
360 /**@brief CGM Service init stucture. This contains all option and data needed for initialization of the service. */
361 typedef struct
362 {
363
364 cgms_cccd_change_handler_t cccd_change_handler;
365 cgms_get_info_req_handler_t get_info_req_handler;
366 cgms_cp_cmd_req_handler_t cp_cmd_req_handler;
367 cgms_racp_req_handler_t racp_req_handler;
368 cgms_rec_num_get_func_t rec_num_get_func;
369 cgms_db_rec_delete_func_t rec_delete_func;
370 cgms_db_rec_get_func_t rec_get_func;
371 uint32_t feature;
372 cgms_meas_type_t meas_type;
373 cgms_meas_loc_t meas_loc;
374 } cgms_init_t;
375 /** @} */
376
377 /**
378 * @defgroup CGMS_FUNCTION Functions
379 * @{
380 */
381 /**
382 *****************************************************************************************
383 * @brief Initialize a Continuous Glucose Monitoring Service instance and add in the DB.
384 *
385 * @param[in] p_cgms_init: Pointer to Continuous Glucose Monitoring Service initialization variable
386 *
387 * @return Result of service initialization.
388 *****************************************************************************************
389 */
390 sdk_err_t cgms_service_init(cgms_init_t *p_cgms_init);
391
392 /**
393 *****************************************************************************************
394 * @brief Send cgms control point cmd response.
395 *
396 * @param[in] conn_idx: Index of connection.
397 * @param[in] p_rsp: Pointer to response value.
398 *
399 * @return Result of response send.
400 *****************************************************************************************
401 */
402 sdk_err_t cgms_cp_cmd_rsp_send(uint8_t conn_idx, cgms_cp_cmd_rsp_t *p_rsp);
403
404 /**
405 *****************************************************************************************
406 * @brief Update cgms feature.
407 *
408 * @param[in] feature: Feature value.
409 *
410 * @return Result of feature update.
411 *****************************************************************************************
412 */
413 sdk_err_t cgms_feature_update( uint32_t feature);
414
415 /**
416 *****************************************************************************************
417 * @brief Send cgms measurement value.
418 *
419 * @param[in] conn_idx: Index of connection.
420 * @param[in] p_rec: Pointer to measurement value.
421 *
422 * @return Result of measurement value send.
423 *****************************************************************************************
424 */
425 sdk_err_t cgms_meas_val_send(uint8_t conn_idx, cgms_meas_rec_t *p_rec);
426
427 /** @} */
428
429 #endif
430 /** @} */
431 /** @} */
432
cgms_cp_cmd_rsp_t::cal_value
cgms_cal_value_t cal_value
Definition: cgms.h:317
CGMS_CP_CODE_GET_HYPO_LVL
@ CGMS_CP_CODE_GET_HYPO_LVL
Definition: cgms.h:225
cgms_get_info_req_t
Definition: cgms.h:286
cgms_cal_status_t
cgms_cal_status_t
Definition: cgms.h:187
__attribute__
typedef __attribute__
Electronic Shelf Label Key Material.
Definition: esls.h:318
cgms_meas_rec_t::ann_status
cgms_ann_status_t ann_status
Definition: cgms.h:333
cgms_cp_cmd_req_t
Definition: cgms.h:293
CGMS_GET_INFO_SES_START_TIME
@ CGMS_GET_INFO_SES_START_TIME
Definition: cgms.h:209
CGMS_CP_CODE_GET_PATIENT_LOW_LVL
@ CGMS_CP_CODE_GET_PATIENT_LOW_LVL
Definition: cgms.h:223
cgms_rec_num_get_func_t
uint16_t(* cgms_rec_num_get_func_t)(void)
Definition: cgms.h:351
cgms_init_t::rec_num_get_func
cgms_rec_num_get_func_t rec_num_get_func
Definition: cgms.h:368
__attribute__::concentration
int16_t concentration
Definition: cgms.h:276
cgms_cp_cmd_req_t::cal_value
cgms_cal_value_t cal_value
Definition: cgms.h:299
CGMS_CMD_RET_CODE_SUCESS
@ CGMS_CMD_RET_CODE_SUCESS
Definition: cgms.h:241
CGMS_GET_INFO_SES_RUN_TIME
@ CGMS_GET_INFO_SES_RUN_TIME
Definition: cgms.h:210
__attribute__::dst_offset
uint8_t dst_offset
Definition: cgms.h:271
CGMS_CP_CODE_SET_SES_START_TIME
@ CGMS_CP_CODE_SET_SES_START_TIME
Definition: cgms.h:235
cgms_meas_rec_t::flags
uint8_t flags
Definition: cgms.h:331
cgms_db_rec_get_func_t
void(* cgms_db_rec_get_func_t)(uint8_t rec_idx, cgms_meas_rec_t *p_rec)
Definition: cgms.h:353
__attribute__::status
uint8_t status
Definition: cgms.h:257
cgms_meas_rec_t::glucose_concentration
int16_t glucose_concentration
Definition: cgms.h:332
CGMS_MEAS_TYPE_CAP_PLASMA
@ CGMS_MEAS_TYPE_CAP_PLASMA
Definition: cgms.h:164
cgms_init_t::meas_loc
cgms_meas_loc_t meas_loc
Definition: cgms.h:373
CGMS_CCCD_STATUS_MEAS_DISABLED
@ CGMS_CCCD_STATUS_MEAS_DISABLED
Definition: cgms.h:196
cgms_cp_cmd_req_handler_t
void(* cgms_cp_cmd_req_handler_t)(uint8_t conn_idx, cgms_cp_cmd_req_t *req)
Definition: cgms.h:347
__attribute__::hour
uint8_t hour
Definition: cgms.h:267
__attribute__::cal_data_record_num
uint16_t cal_data_record_num
Definition: cgms.h:281
CGMS_CMD_RET_CODE_RESERVED
@ CGMS_CMD_RET_CODE_RESERVED
Definition: cgms.h:240
CGMS_CCCD_STATUS_FEAT_DISABLED
@ CGMS_CCCD_STATUS_FEAT_DISABLED
Definition: cgms.h:202
CGMS_CP_CODE_SET_RATE_OF_DEC_LVL
@ CGMS_CP_CODE_SET_RATE_OF_DEC_LVL
Definition: cgms.h:228
cgms_meas_rec_t
Glucose Measurement structure. This contains glucose measurement value.
Definition: cgms.h:330
CGMS_MEAS_TYPE_CAP_BLOOD
@ CGMS_MEAS_TYPE_CAP_BLOOD
Definition: cgms.h:163
__attribute__::cal_temp
uint8_t cal_temp
Definition: cgms.h:258
CGMS_MEAS_TYPE_VEN_PLASMA
@ CGMS_MEAS_TYPE_VEN_PLASMA
Definition: cgms.h:166
gr_includes.h
Include Files API.
cgms_db_rec_delete_func_t
void(* cgms_db_rec_delete_func_t)(uint8_t rec_idx)
Definition: cgms.h:352
CGMS_MEAS_LOC_FINGER
@ CGMS_MEAS_LOC_FINGER
Definition: cgms.h:178
CGMS_CP_CODE_STOP_THE_SESSION
@ CGMS_CP_CODE_STOP_THE_SESSION
Definition: cgms.h:234
cgms_cp_cmd_rsp_t::patient_high_alert_level
int16_t patient_high_alert_level
Definition: cgms.h:318
CGMS_CP_CODE_SET_RATE_OF_INC_LVL
@ CGMS_CP_CODE_SET_RATE_OF_INC_LVL
Definition: cgms.h:230
CGMS_GET_INFO_NONE
@ CGMS_GET_INFO_NONE
Definition: cgms.h:207
__attribute__::since_start_time_minutes
uint16_t since_start_time_minutes
Definition: cgms.h:277
CGMS_MEAS_TYPE_ART_PLASMA
@ CGMS_MEAS_TYPE_ART_PLASMA
Definition: cgms.h:168
cgms_cp_cmd_rsp_t::rate_of_inc_alert_level
int16_t rate_of_inc_alert_level
Definition: cgms.h:323
cgms_cccd_status_t
cgms_cccd_status_t
Definition: cgms.h:194
CGMS_CP_CODE_SET_PATIENT_LOW_LVL
@ CGMS_CP_CODE_SET_PATIENT_LOW_LVL
Definition: cgms.h:222
cgms_init_t::get_info_req_handler
cgms_get_info_req_handler_t get_info_req_handler
Definition: cgms.h:365
cgms_meas_val_send
sdk_err_t cgms_meas_val_send(uint8_t conn_idx, cgms_meas_rec_t *p_rec)
Send cgms measurement value.
CGMS_CP_CODE_START_THE_SESSION
@ CGMS_CP_CODE_START_THE_SESSION
Definition: cgms.h:233
__attribute__::min
uint8_t min
Definition: cgms.h:268
CGMS_MEAS_TYPE_VEN_BLOOD
@ CGMS_MEAS_TYPE_VEN_BLOOD
Definition: cgms.h:165
CGMS_CCCD_STATUS_SPCP_DISABLED
@ CGMS_CCCD_STATUS_SPCP_DISABLED
Definition: cgms.h:200
CGMS_CCCD_STATUS_RACP_ENABLED
@ CGMS_CCCD_STATUS_RACP_ENABLED
Definition: cgms.h:197
cgms_init_t::rec_get_func
cgms_db_rec_get_func_t rec_get_func
Definition: cgms.h:370
cgms_cp_cmd_rsp_t
Definition: cgms.h:311
cgms_cp_cmd_rsp_t::patient_low_alert_level
int16_t patient_low_alert_level
Definition: cgms.h:319
cgms_cp_cmd_req_t::hypo_alert_level
int16_t hypo_alert_level
Definition: cgms.h:303
cgms_get_info_req_t::ann_status
cgms_ann_status_t ann_status
Definition: cgms.h:287
CGMS_MEAS_TYPE_CONTROL
@ CGMS_MEAS_TYPE_CONTROL
Definition: cgms.h:172
cgms_cp_cmd_ret_t
cgms_cp_cmd_ret_t
Definition: cgms.h:239
CGMS_CCCD_STATUS_FEAT_ENABLED
@ CGMS_CCCD_STATUS_FEAT_ENABLED
Definition: cgms.h:201
CGMS_CP_CODE_SET_HYPER_LVL
@ CGMS_CP_CODE_SET_HYPER_LVL
Definition: cgms.h:226
CGMS_CP_CODE_SET_CAL_VALUE
@ CGMS_CP_CODE_SET_CAL_VALUE
Definition: cgms.h:218
cgms_service_init
sdk_err_t cgms_service_init(cgms_init_t *p_cgms_init)
Initialize a Continuous Glucose Monitoring Service instance and add in the DB.
cgms_init_t::racp_req_handler
cgms_racp_req_handler_t racp_req_handler
Definition: cgms.h:367
cgms_meas_rec_t::trend_info
uint16_t trend_info
Definition: cgms.h:334
CGMS_MEAS_TYPE_UNDET_BLOOD
@ CGMS_MEAS_TYPE_UNDET_BLOOD
Definition: cgms.h:169
CGMS_CAL_STATUS_OUT_OF_RANGE
@ CGMS_CAL_STATUS_OUT_OF_RANGE
Definition: cgms.h:189
CGMS_CMD_RET_CODE_NOT_SUPPORT
@ CGMS_CMD_RET_CODE_NOT_SUPPORT
Definition: cgms.h:242
__attribute__::meas_type
uint8_t meas_type
Definition: cgms.h:278
CGMS_MEAS_LOC_AST
@ CGMS_MEAS_LOC_AST
Definition: cgms.h:179
cgms_cp_cmd_req_t::rate_of_dec_alert_level
int16_t rate_of_dec_alert_level
Definition: cgms.h:305
cgms_cccd_change_handler_t
void(* cgms_cccd_change_handler_t)(uint8_t conn_idx, cgms_cccd_status_t cccd_status)
Definition: cgms.h:343
__attribute__::year
uint16_t year
Definition: cgms.h:264
__attribute__::sec
uint8_t sec
Definition: cgms.h:269
CGMS_CP_CODE_GET_CAL_VALUE
@ CGMS_CP_CODE_GET_CAL_VALUE
Definition: cgms.h:219
cgms_get_info_req_t::run_time
uint16_t run_time
Definition: cgms.h:289
__attribute__::meas_loc
uint8_t meas_loc
Definition: cgms.h:279
CGMS_CMD_RET_CODE_PARAM_OUT_OF_RANGE
@ CGMS_CMD_RET_CODE_PARAM_OUT_OF_RANGE
Definition: cgms.h:245
cgms_racp_req_t
Continuous Glucose Monitoring Recoerd Access Control Point request value.
Definition: cgms_racp.h:128
cgms_cp_cmd_req_t::comm_interval_in_minutes
uint8_t comm_interval_in_minutes
Definition: cgms.h:297
CGMS_CCCD_STATUS_RACP_DISABLED
@ CGMS_CCCD_STATUS_RACP_DISABLED
Definition: cgms.h:198
CGMS_CMD_RET_CODE_INVALID_OPERAND
@ CGMS_CMD_RET_CODE_INVALID_OPERAND
Definition: cgms.h:243
sdk_err_t
uint16_t sdk_err_t
SDK API result type.
Definition: ble_error.h:290
cgms_cp_cmd_req_t::cp_code
cgms_cp_cmd_code_t cp_code
Definition: cgms.h:294
CGMS_CMD_RET_CODE_PROCEDURE_NOT_COMPLETED
@ CGMS_CMD_RET_CODE_PROCEDURE_NOT_COMPLETED
Definition: cgms.h:244
CGMS_CP_CODE_GET_RATE_OF_INC_LVL
@ CGMS_CP_CODE_GET_RATE_OF_INC_LVL
Definition: cgms.h:231
cgms_cp_cmd_req_t::cal_data_rec_num
int16_t cal_data_rec_num
Definition: cgms.h:300
CGMS_MEAS_LOC_SUB_TISSUE
@ CGMS_MEAS_LOC_SUB_TISSUE
Definition: cgms.h:182
CGMS_CP_CODE_SET_COM_INTERVAL
@ CGMS_CP_CODE_SET_COM_INTERVAL
Definition: cgms.h:216
cgms_racp.h
Continuous Continuous Glucose Monitoring Monitoring Service Record Access Control Point API.
cgms_cp_cmd_req_t::rate_of_inc_alert_level
int16_t rate_of_inc_alert_level
Definition: cgms.h:306
cgms_init_t::feature
uint32_t feature
Definition: cgms.h:371
CGMS_CP_CODE_SET_HYPO_LVL
@ CGMS_CP_CODE_SET_HYPO_LVL
Definition: cgms.h:224
CGMS_CP_CODE_GET_COM_INTERVAL
@ CGMS_CP_CODE_GET_COM_INTERVAL
Definition: cgms.h:217
cgms_cp_cmd_rsp_t::cp_code
cgms_cp_cmd_code_t cp_code
Definition: cgms.h:312
__attribute__::time_offset
uint16_t time_offset
Definition: cgms.h:256
cgms_cp_cmd_rsp_t::cp_ret
cgms_cp_cmd_ret_t cp_ret
Definition: cgms.h:313
cgms_cp_cmd_rsp_t::comm_interval_in_minutes
uint8_t comm_interval_in_minutes
Definition: cgms.h:316
__attribute__::next_cal_time_minutes
uint16_t next_cal_time_minutes
Definition: cgms.h:280
cgms_cp_cmd_code_t
cgms_cp_cmd_code_t
Definition: cgms.h:214
cgms_cp_cmd_req_t::patient_low_alert_level
int16_t patient_low_alert_level
Definition: cgms.h:302
cgms_get_info_req_t::start_time
cgms_time_t start_time
Definition: cgms.h:288
CGMS_CAL_STATUS_PROCESS_PENGDING
@ CGMS_CAL_STATUS_PROCESS_PENGDING
Definition: cgms.h:190
cgms_cp_cmd_req_t::start_time
cgms_time_t start_time
Definition: cgms.h:298
__attribute__::day
uint8_t day
Definition: cgms.h:266
cgms_cp_cmd_rsp_t::rate_of_dec_alert_level
int16_t rate_of_dec_alert_level
Definition: cgms.h:322
CGMS_MEAS_LOC_CONTROL
@ CGMS_MEAS_LOC_CONTROL
Definition: cgms.h:181
cgms_cp_cmd_rsp_t::hypo_alert_level
int16_t hypo_alert_level
Definition: cgms.h:320
cgms_meas_rec_t::quality
uint16_t quality
Definition: cgms.h:335
__attribute__::time_zone
int8_t time_zone
Definition: cgms.h:270
CGMS_CP_CODE_RESET_DEV_SPEC_ALERT
@ CGMS_CP_CODE_RESET_DEV_SPEC_ALERT
Definition: cgms.h:232
CGMS_MEAS_LOC_EAR
@ CGMS_MEAS_LOC_EAR
Definition: cgms.h:180
cgms_cp_cmd_rsp_send
sdk_err_t cgms_cp_cmd_rsp_send(uint8_t conn_idx, cgms_cp_cmd_rsp_t *p_rsp)
Send cgms control point cmd response.
__attribute__::month
uint8_t month
Definition: cgms.h:265
CGMS_CP_CODE_SET_PATIENT_HIGHT_LVL
@ CGMS_CP_CODE_SET_PATIENT_HIGHT_LVL
Definition: cgms.h:220
__attribute__::cal_status
uint8_t cal_status
Definition: cgms.h:282
CGMS_GET_INFO_ANN_STATUS
@ CGMS_GET_INFO_ANN_STATUS
Definition: cgms.h:208
cgms_get_info_code_t
cgms_get_info_code_t
Definition: cgms.h:206
cgms_meas_type_t
cgms_meas_type_t
CGM measurement type.
Definition: cgms.h:162
cgms_init_t::rec_delete_func
cgms_db_rec_delete_func_t rec_delete_func
Definition: cgms.h:369
cgms_init_t::cp_cmd_req_handler
cgms_cp_cmd_req_handler_t cp_cmd_req_handler
Definition: cgms.h:366
CGMS_MEAS_TYPE_ART_BLOOD
@ CGMS_MEAS_TYPE_ART_BLOOD
Definition: cgms.h:167
cgms_get_info_req_handler_t
void(* cgms_get_info_req_handler_t)(uint8_t conn_idx, cgms_get_info_code_t code, cgms_get_info_req_t *data_out)
Definition: cgms.h:345
cgms_init_t::cccd_change_handler
cgms_cccd_change_handler_t cccd_change_handler
Definition: cgms.h:364
cgms_cp_cmd_rsp_t::hyper_alert_level
int16_t hyper_alert_level
Definition: cgms.h:321
CGMS_CCCD_STATUS_MEAS_ENABLED
@ CGMS_CCCD_STATUS_MEAS_ENABLED
Definition: cgms.h:195
cgms_cp_cmd_req_t::patient_high_alert_level
int16_t patient_high_alert_level
Definition: cgms.h:301
__attribute__::warning
uint8_t warning
Definition: cgms.h:259
cgms_feature_update
sdk_err_t cgms_feature_update(uint32_t feature)
Update cgms feature.
CGMS_CP_CODE_GET_RATE_OF_DEC_LVL
@ CGMS_CP_CODE_GET_RATE_OF_DEC_LVL
Definition: cgms.h:229
CGMS_CAL_STATUS_REJECT
@ CGMS_CAL_STATUS_REJECT
Definition: cgms.h:188
CGMS_CP_CODE_GET_PATIENT_HIGHT_LVL
@ CGMS_CP_CODE_GET_PATIENT_HIGHT_LVL
Definition: cgms.h:221
CGMS_MEAS_TYPE_FLUID
@ CGMS_MEAS_TYPE_FLUID
Definition: cgms.h:171
cgms_cp_cmd_req_t::hyper_alert_level
int16_t hyper_alert_level
Definition: cgms.h:304
CGMS_CCCD_STATUS_SPCP_ENABLED
@ CGMS_CCCD_STATUS_SPCP_ENABLED
Definition: cgms.h:199
cgms_racp_req_handler_t
void(* cgms_racp_req_handler_t)(uint8_t conn_idx, cgms_racp_req_t *req)
Definition: cgms.h:349
CGMS_MEAS_TYPE_UNDET_PLASMA
@ CGMS_MEAS_TYPE_UNDET_PLASMA
Definition: cgms.h:170
cgms_meas_loc_t
cgms_meas_loc_t
CGM measurement location.
Definition: cgms.h:177
CGMS_CP_CODE_GET_HYPER_LVL
@ CGMS_CP_CODE_GET_HYPER_LVL
Definition: cgms.h:227
CGMS_CP_CODE_NONE
@ CGMS_CP_CODE_NONE
Definition: cgms.h:215
cgms_init_t
CGM Service init stucture. This contains all option and data needed for initialization of the service...
Definition: cgms.h:362
cgms_init_t::meas_type
cgms_meas_type_t meas_type
Definition: cgms.h:372