BLE FOTA APP

Dependencies:   BLE_API mbed

It doesn't work with the default FOTA bootloader. It use NVIC_SystemReset() to enter a bootloader.

Committer:
yihui
Date:
Fri Oct 10 03:36:28 2014 +0000
Revision:
1:a607cd9655d7
use NVIC_SystemReset() to run bootloader

Who changed what in which revision?

UserRevisionLine numberNew contents of line
yihui 1:a607cd9655d7 1 /* Copyright (c) 2012 Nordic Semiconductor. All Rights Reserved.
yihui 1:a607cd9655d7 2 *
yihui 1:a607cd9655d7 3 * The information contained herein is property of Nordic Semiconductor ASA.
yihui 1:a607cd9655d7 4 * Terms and conditions of usage are described in detail in NORDIC
yihui 1:a607cd9655d7 5 * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
yihui 1:a607cd9655d7 6 *
yihui 1:a607cd9655d7 7 * Licensees are granted free, non-transferable use of the information. NO
yihui 1:a607cd9655d7 8 * WARRANTY of ANY KIND is provided. This heading must NOT be removed from
yihui 1:a607cd9655d7 9 * the file.
yihui 1:a607cd9655d7 10 */
yihui 1:a607cd9655d7 11
yihui 1:a607cd9655d7 12 /** @file
yihui 1:a607cd9655d7 13 *
yihui 1:a607cd9655d7 14 * @defgroup ble_sdk_srv_gls Glucose Service
yihui 1:a607cd9655d7 15 * @{
yihui 1:a607cd9655d7 16 * @ingroup ble_sdk_srv
yihui 1:a607cd9655d7 17 * @brief Glucose Service module.
yihui 1:a607cd9655d7 18 *
yihui 1:a607cd9655d7 19 * @details This module implements the Glucose Service.
yihui 1:a607cd9655d7 20 *
yihui 1:a607cd9655d7 21 * @note The application must propagate BLE stack events to the Glucose Service module by calling
yihui 1:a607cd9655d7 22 * ble_gls_on_ble_evt() from the from the @ref ble_stack_handler callback.
yihui 1:a607cd9655d7 23 *
yihui 1:a607cd9655d7 24 * @note Attention!
yihui 1:a607cd9655d7 25 * To maintain compliance with Nordic Semiconductor ASA Bluetooth profile
yihui 1:a607cd9655d7 26 * qualification listings, this section of source code must not be modified.
yihui 1:a607cd9655d7 27 */
yihui 1:a607cd9655d7 28
yihui 1:a607cd9655d7 29 #ifndef BLE_GLS_H__
yihui 1:a607cd9655d7 30 #define BLE_GLS_H__
yihui 1:a607cd9655d7 31
yihui 1:a607cd9655d7 32 #include <stdint.h>
yihui 1:a607cd9655d7 33 #include <stdbool.h>
yihui 1:a607cd9655d7 34 #include "ble.h"
yihui 1:a607cd9655d7 35 #include "ble_srv_common.h"
yihui 1:a607cd9655d7 36 #include "ble_date_time.h"
yihui 1:a607cd9655d7 37
yihui 1:a607cd9655d7 38 /**@brief Glucose feature */
yihui 1:a607cd9655d7 39 #define BLE_GLS_FEATURE_LOW_BATT 0x0001 /**< Low Battery Detection During Measurement Supported */
yihui 1:a607cd9655d7 40 #define BLE_GLS_FEATURE_MALFUNC 0x0002 /**< Sensor Malfunction Detection Supported */
yihui 1:a607cd9655d7 41 #define BLE_GLS_FEATURE_SAMPLE_SIZE 0x0004 /**< Sensor Sample Size Supported */
yihui 1:a607cd9655d7 42 #define BLE_GLS_FEATURE_INSERT_ERR 0x0008 /**< Sensor Strip Insertion Error Detection Supported */
yihui 1:a607cd9655d7 43 #define BLE_GLS_FEATURE_TYPE_ERR 0x0010 /**< Sensor Strip Type Error Detection Supported */
yihui 1:a607cd9655d7 44 #define BLE_GLS_FEATURE_RES_HIGH_LOW 0x0020 /**< Sensor Result High-Low Detection Supported */
yihui 1:a607cd9655d7 45 #define BLE_GLS_FEATURE_TEMP_HIGH_LOW 0x0040 /**< Sensor Temperature High-Low Detection Supported */
yihui 1:a607cd9655d7 46 #define BLE_GLS_FEATURE_READ_INT 0x0080 /**< Sensor Read Interrupt Detection Supported */
yihui 1:a607cd9655d7 47 #define BLE_GLS_FEATURE_GENERAL_FAULT 0x0100 /**< General Device Fault Supported */
yihui 1:a607cd9655d7 48 #define BLE_GLS_FEATURE_TIME_FAULT 0x0200 /**< Time Fault Supported */
yihui 1:a607cd9655d7 49 #define BLE_GLS_FEATURE_MULTI_BOND 0x0400 /**< Multiple Bond Supported */
yihui 1:a607cd9655d7 50
yihui 1:a607cd9655d7 51 /**@brief Glucose measurement flags */
yihui 1:a607cd9655d7 52 #define BLE_GLS_MEAS_FLAG_TIME_OFFSET 0x01 /**< Time Offset Present */
yihui 1:a607cd9655d7 53 #define BLE_GLS_MEAS_FLAG_CONC_TYPE_LOC 0x02 /**< Glucose Concentration, Type, and Sample Location Present */
yihui 1:a607cd9655d7 54 #define BLE_GLS_MEAS_FLAG_UNITS_KG_L 0x00 /**< Glucose Concentration Units kg/L */
yihui 1:a607cd9655d7 55 #define BLE_GLS_MEAS_FLAG_UNITS_MOL_L 0x04 /**< Glucose Concentration Units mol/L */
yihui 1:a607cd9655d7 56 #define BLE_GLS_MEAS_FLAG_SENSOR_STATUS 0x08 /**< Sensor Status Annunciation Present */
yihui 1:a607cd9655d7 57 #define BLE_GLS_MEAS_FLAG_CONTEXT_INFO 0x10 /**< Context Information Follows */
yihui 1:a607cd9655d7 58
yihui 1:a607cd9655d7 59 /**@brief Glucose measurement type */
yihui 1:a607cd9655d7 60 #define BLE_GLS_MEAS_TYPE_CAP_BLOOD 1 /**< Capillary whole blood */
yihui 1:a607cd9655d7 61 #define BLE_GLS_MEAS_TYPE_CAP_PLASMA 2 /**< Capillary plasma */
yihui 1:a607cd9655d7 62 #define BLE_GLS_MEAS_TYPE_VEN_BLOOD 3 /**< Venous whole blood */
yihui 1:a607cd9655d7 63 #define BLE_GLS_MEAS_TYPE_VEN_PLASMA 4 /**< Venous plasma */
yihui 1:a607cd9655d7 64 #define BLE_GLS_MEAS_TYPE_ART_BLOOD 5 /**< Arterial whole blood */
yihui 1:a607cd9655d7 65 #define BLE_GLS_MEAS_TYPE_ART_PLASMA 6 /**< Arterial plasma */
yihui 1:a607cd9655d7 66 #define BLE_GLS_MEAS_TYPE_UNDET_BLOOD 7 /**< Undetermined whole blood */
yihui 1:a607cd9655d7 67 #define BLE_GLS_MEAS_TYPE_UNDET_PLASMA 8 /**< Undetermined plasma */
yihui 1:a607cd9655d7 68 #define BLE_GLS_MEAS_TYPE_FLUID 9 /**< Interstitial fluid (ISF) */
yihui 1:a607cd9655d7 69 #define BLE_GLS_MEAS_TYPE_CONTROL 10 /**< Control solution */
yihui 1:a607cd9655d7 70
yihui 1:a607cd9655d7 71 /**@brief Glucose measurement location */
yihui 1:a607cd9655d7 72 #define BLE_GLS_MEAS_LOC_FINGER 1 /**< Finger */
yihui 1:a607cd9655d7 73 #define BLE_GLS_MEAS_LOC_AST 2 /**< Alternate Site Test (AST) */
yihui 1:a607cd9655d7 74 #define BLE_GLS_MEAS_LOC_EAR 3 /**< Earlobe */
yihui 1:a607cd9655d7 75 #define BLE_GLS_MEAS_LOC_CONTROL 4 /**< Control solution */
yihui 1:a607cd9655d7 76 #define BLE_GLS_MEAS_LOC_NOT_AVAIL 15 /**< Sample Location value not available */
yihui 1:a607cd9655d7 77
yihui 1:a607cd9655d7 78 /**@brief Glucose sensor status annunciation */
yihui 1:a607cd9655d7 79 #define BLE_GLS_MEAS_STATUS_BATT_LOW 0x0001 /**< Device battery low at time of measurement */
yihui 1:a607cd9655d7 80 #define BLE_GLS_MEAS_STATUS_SENSOR_FAULT 0x0002 /**< Sensor malfunction or faulting at time of measurement */
yihui 1:a607cd9655d7 81 #define BLE_GLS_MEAS_STATUS_SAMPLE_SIZE 0x0004 /**< Sample size for blood or control solution insufficient at time of measurement */
yihui 1:a607cd9655d7 82 #define BLE_GLS_MEAS_STATUS_STRIP_INSERT 0x0008 /**< Strip insertion error */
yihui 1:a607cd9655d7 83 #define BLE_GLS_MEAS_STATUS_STRIP_TYPE 0x0010 /**< Strip type incorrect for device */
yihui 1:a607cd9655d7 84 #define BLE_GLS_MEAS_STATUS_RESULT_HIGH 0x0020 /**< Sensor result higher than the device can process */
yihui 1:a607cd9655d7 85 #define BLE_GLS_MEAS_STATUS_RESULT_LOW 0x0040 /**< Sensor result lower than the device can process */
yihui 1:a607cd9655d7 86 #define BLE_GLS_MEAS_STATUS_TEMP_HIGH 0x0080 /**< Sensor temperature too high for valid test/result at time of measurement */
yihui 1:a607cd9655d7 87 #define BLE_GLS_MEAS_STATUS_TEMP_LOW 0x0100 /**< Sensor temperature too low for valid test/result at time of measurement */
yihui 1:a607cd9655d7 88 #define BLE_GLS_MEAS_STATUS_STRIP_PULL 0x0200 /**< Sensor read interrupted because strip was pulled too soon at time of measurement */
yihui 1:a607cd9655d7 89 #define BLE_GLS_MEAS_STATUS_GENERAL_FAULT 0x0400 /**< General device fault has occurred in the sensor */
yihui 1:a607cd9655d7 90 #define BLE_GLS_MEAS_STATUS_TIME_FAULT 0x0800 /**< Time fault has occurred in the sensor and time may be inaccurate */
yihui 1:a607cd9655d7 91
yihui 1:a607cd9655d7 92 /**@brief Glucose measurement context flags */
yihui 1:a607cd9655d7 93 #define BLE_GLS_CONTEXT_FLAG_CARB 0x01 /**< Carbohydrate id and carbohydrate present */
yihui 1:a607cd9655d7 94 #define BLE_GLS_CONTEXT_FLAG_MEAL 0x02 /**< Meal present */
yihui 1:a607cd9655d7 95 #define BLE_GLS_CONTEXT_FLAG_TESTER 0x04 /**< Tester-health present */
yihui 1:a607cd9655d7 96 #define BLE_GLS_CONTEXT_FLAG_EXERCISE 0x08 /**< Exercise duration and exercise intensity present */
yihui 1:a607cd9655d7 97 #define BLE_GLS_CONTEXT_FLAG_MED 0x10 /**< Medication ID and medication present */
yihui 1:a607cd9655d7 98 #define BLE_GLS_CONTEXT_FLAG_MED_KG 0x00 /**< Medication value units, kilograms */
yihui 1:a607cd9655d7 99 #define BLE_GLS_CONTEXT_FLAG_MED_L 0x20 /**< Medication value units, liters */
yihui 1:a607cd9655d7 100 #define BLE_GLS_CONTEXT_FLAG_HBA1C 0x40 /**< Hba1c present */
yihui 1:a607cd9655d7 101 #define BLE_GLS_CONTEXT_FLAG_EXT 0x80 /**< Extended flags present */
yihui 1:a607cd9655d7 102
yihui 1:a607cd9655d7 103 /**@brief Glucose measurement context carbohydrate ID */
yihui 1:a607cd9655d7 104 #define BLE_GLS_CONTEXT_CARB_BREAKFAST 1 /**< Breakfast */
yihui 1:a607cd9655d7 105 #define BLE_GLS_CONTEXT_CARB_LUNCH 2 /**< Lunch */
yihui 1:a607cd9655d7 106 #define BLE_GLS_CONTEXT_CARB_DINNER 3 /**< Dinner */
yihui 1:a607cd9655d7 107 #define BLE_GLS_CONTEXT_CARB_SNACK 4 /**< Snack */
yihui 1:a607cd9655d7 108 #define BLE_GLS_CONTEXT_CARB_DRINK 5 /**< Drink */
yihui 1:a607cd9655d7 109 #define BLE_GLS_CONTEXT_CARB_SUPPER 6 /**< Supper */
yihui 1:a607cd9655d7 110 #define BLE_GLS_CONTEXT_CARB_BRUNCH 7 /**< Brunch */
yihui 1:a607cd9655d7 111
yihui 1:a607cd9655d7 112 /**@brief Glucose measurement context meal */
yihui 1:a607cd9655d7 113 #define BLE_GLS_CONTEXT_MEAL_PREPRANDIAL 1 /**< Preprandial (before meal) */
yihui 1:a607cd9655d7 114 #define BLE_GLS_CONTEXT_MEAL_POSTPRANDIAL 2 /**< Postprandial (after meal) */
yihui 1:a607cd9655d7 115 #define BLE_GLS_CONTEXT_MEAL_FASTING 3 /**< Fasting */
yihui 1:a607cd9655d7 116 #define BLE_GLS_CONTEXT_MEAL_CASUAL 4 /**< Casual (snacks, drinks, etc.) */
yihui 1:a607cd9655d7 117 #define BLE_GLS_CONTEXT_MEAL_BEDTIME 5 /**< Bedtime */
yihui 1:a607cd9655d7 118
yihui 1:a607cd9655d7 119 /**@brief Glucose measurement context tester */
yihui 1:a607cd9655d7 120 #define BLE_GLS_CONTEXT_TESTER_SELF 1 /**< Self */
yihui 1:a607cd9655d7 121 #define BLE_GLS_CONTEXT_TESTER_PRO 2 /**< Health care professional */
yihui 1:a607cd9655d7 122 #define BLE_GLS_CONTEXT_TESTER_LAB 3 /**< Lab test */
yihui 1:a607cd9655d7 123 #define BLE_GLS_CONTEXT_TESTER_NOT_AVAIL 15 /**< Tester value not available */
yihui 1:a607cd9655d7 124
yihui 1:a607cd9655d7 125 /**@brief Glucose measurement context health */
yihui 1:a607cd9655d7 126 #define BLE_GLS_CONTEXT_HEALTH_MINOR 1 /**< Minor health issues */
yihui 1:a607cd9655d7 127 #define BLE_GLS_CONTEXT_HEALTH_MAJOR 2 /**< Major health issues */
yihui 1:a607cd9655d7 128 #define BLE_GLS_CONTEXT_HEALTH_MENSES 3 /**< During menses */
yihui 1:a607cd9655d7 129 #define BLE_GLS_CONTEXT_HEALTH_STRESS 4 /**< Under stress */
yihui 1:a607cd9655d7 130 #define BLE_GLS_CONTEXT_HEALTH_NONE 5 /**< No health issues */
yihui 1:a607cd9655d7 131 #define BLE_GLS_CONTEXT_HEALTH_NOT_AVAIL 15 /**< Health value not available */
yihui 1:a607cd9655d7 132
yihui 1:a607cd9655d7 133 /**@brief Glucose measurement context medication ID */
yihui 1:a607cd9655d7 134 #define BLE_GLS_CONTEXT_MED_RAPID 1 /**< Rapid acting insulin */
yihui 1:a607cd9655d7 135 #define BLE_GLS_CONTEXT_MED_SHORT 2 /**< Short acting insulin */
yihui 1:a607cd9655d7 136 #define BLE_GLS_CONTEXT_MED_INTERMED 3 /**< Intermediate acting insulin */
yihui 1:a607cd9655d7 137 #define BLE_GLS_CONTEXT_MED_LONG 4 /**< Long acting insulin */
yihui 1:a607cd9655d7 138 #define BLE_GLS_CONTEXT_MED_PREMIX 5 /**< Pre-mixed insulin */
yihui 1:a607cd9655d7 139
yihui 1:a607cd9655d7 140 /**@brief SFLOAT format (IEEE-11073 16-bit FLOAT, meaning 4 bits for exponent (base 10) and 12 bits mantissa) */
yihui 1:a607cd9655d7 141 typedef struct
yihui 1:a607cd9655d7 142 {
yihui 1:a607cd9655d7 143 int8_t exponent; /**< Base 10 exponent, should be using only 4 bits */
yihui 1:a607cd9655d7 144 int16_t mantissa; /**< Mantissa, should be using only 12 bits */
yihui 1:a607cd9655d7 145 } sfloat_t;
yihui 1:a607cd9655d7 146
yihui 1:a607cd9655d7 147 /**@brief Glucose Service event type. */
yihui 1:a607cd9655d7 148 typedef enum
yihui 1:a607cd9655d7 149 {
yihui 1:a607cd9655d7 150 BLE_GLS_EVT_NOTIFICATION_ENABLED, /**< Glucose value notification enabled event. */
yihui 1:a607cd9655d7 151 BLE_GLS_EVT_NOTIFICATION_DISABLED /**< Glucose value notification disabled event. */
yihui 1:a607cd9655d7 152 } ble_gls_evt_type_t;
yihui 1:a607cd9655d7 153
yihui 1:a607cd9655d7 154 /**@brief Glucose Service event. */
yihui 1:a607cd9655d7 155 typedef struct
yihui 1:a607cd9655d7 156 {
yihui 1:a607cd9655d7 157 ble_gls_evt_type_t evt_type; /**< Type of event. */
yihui 1:a607cd9655d7 158 } ble_gls_evt_t;
yihui 1:a607cd9655d7 159
yihui 1:a607cd9655d7 160 // Forward declaration of the ble_gls_t type.
yihui 1:a607cd9655d7 161 typedef struct ble_gls_s ble_gls_t;
yihui 1:a607cd9655d7 162
yihui 1:a607cd9655d7 163 /**@brief Glucose Service event handler type. */
yihui 1:a607cd9655d7 164 typedef void (*ble_gls_evt_handler_t) (ble_gls_t * p_gls, ble_gls_evt_t * p_evt);
yihui 1:a607cd9655d7 165
yihui 1:a607cd9655d7 166 /**@brief Glucose Measurement structure. This contains glucose measurement value. */
yihui 1:a607cd9655d7 167 typedef struct
yihui 1:a607cd9655d7 168 {
yihui 1:a607cd9655d7 169 uint8_t flags; /**< Flags */
yihui 1:a607cd9655d7 170 uint16_t sequence_number; /**< Sequence number */
yihui 1:a607cd9655d7 171 ble_date_time_t base_time; /**< Time stamp */
yihui 1:a607cd9655d7 172 int16_t time_offset; /**< Time offset */
yihui 1:a607cd9655d7 173 sfloat_t glucose_concentration; /**< Glucose concentration */
yihui 1:a607cd9655d7 174 uint8_t type; /**< Type */
yihui 1:a607cd9655d7 175 uint8_t sample_location; /**< Sample location */
yihui 1:a607cd9655d7 176 uint16_t sensor_status_annunciation; /**< Sensor status annunciation */
yihui 1:a607cd9655d7 177 } ble_gls_meas_t;
yihui 1:a607cd9655d7 178
yihui 1:a607cd9655d7 179 /**@brief Glucose measurement context structure */
yihui 1:a607cd9655d7 180 typedef struct
yihui 1:a607cd9655d7 181 {
yihui 1:a607cd9655d7 182 uint8_t flags; /**< Flags */
yihui 1:a607cd9655d7 183 uint8_t extended_flags; /**< Extended Flags */
yihui 1:a607cd9655d7 184 uint8_t carbohydrate_id; /**< Carbohydrate ID */
yihui 1:a607cd9655d7 185 sfloat_t carbohydrate; /**< Carbohydrate */
yihui 1:a607cd9655d7 186 uint8_t meal; /**< Meal */
yihui 1:a607cd9655d7 187 uint8_t tester_and_health; /**< Tester and health */
yihui 1:a607cd9655d7 188 uint16_t exercise_duration; /**< Exercise Duration */
yihui 1:a607cd9655d7 189 uint8_t exercise_intensity; /**< Exercise Intensity */
yihui 1:a607cd9655d7 190 uint8_t medication_id; /**< Medication ID */
yihui 1:a607cd9655d7 191 sfloat_t medication; /**< Medication */
yihui 1:a607cd9655d7 192 uint16_t hba1c; /**< HbA1c */
yihui 1:a607cd9655d7 193 } ble_gls_meas_context_t;
yihui 1:a607cd9655d7 194
yihui 1:a607cd9655d7 195 /**@brief Glucose measurement record */
yihui 1:a607cd9655d7 196 typedef struct
yihui 1:a607cd9655d7 197 {
yihui 1:a607cd9655d7 198 ble_gls_meas_t meas; /**< Glucose measurement */
yihui 1:a607cd9655d7 199 ble_gls_meas_context_t context; /**< Glucose measurement context */
yihui 1:a607cd9655d7 200 } ble_gls_rec_t;
yihui 1:a607cd9655d7 201
yihui 1:a607cd9655d7 202 /**@brief Glucose Service init structure. This contains all options and data needed for
yihui 1:a607cd9655d7 203 * initialization of the service. */
yihui 1:a607cd9655d7 204 typedef struct
yihui 1:a607cd9655d7 205 {
yihui 1:a607cd9655d7 206 ble_gls_evt_handler_t evt_handler; /**< Event handler to be called for handling events in the Glucose Service. */
yihui 1:a607cd9655d7 207 ble_srv_error_handler_t error_handler; /**< Function to be called in case of an error. */
yihui 1:a607cd9655d7 208 uint16_t feature; /**< Glucose Feature value indicating supported features. */
yihui 1:a607cd9655d7 209 bool is_context_supported; /**< Determines if optional Glucose Measurement Context is to be supported. */
yihui 1:a607cd9655d7 210 } ble_gls_init_t;
yihui 1:a607cd9655d7 211
yihui 1:a607cd9655d7 212 /**@brief Glucose Service structure. This contains various status information for the service. */
yihui 1:a607cd9655d7 213 typedef struct ble_gls_s
yihui 1:a607cd9655d7 214 {
yihui 1:a607cd9655d7 215 ble_gls_evt_handler_t evt_handler; /**< Event handler to be called for handling events in the Glucose Service. */
yihui 1:a607cd9655d7 216 ble_srv_error_handler_t error_handler; /**< Function to be called in case of an error. */
yihui 1:a607cd9655d7 217 uint16_t service_handle; /**< Handle of Glucose Service (as provided by the BLE stack). */
yihui 1:a607cd9655d7 218 ble_gatts_char_handles_t glm_handles; /**< Handles related to the Glucose Measurement characteristic. */
yihui 1:a607cd9655d7 219 ble_gatts_char_handles_t glm_context_handles; /**< Handles related to the Glucose Measurement Context characteristic. */
yihui 1:a607cd9655d7 220 ble_gatts_char_handles_t glf_handles; /**< Handles related to the Glucose Feature characteristic. */
yihui 1:a607cd9655d7 221 ble_gatts_char_handles_t racp_handles; /**< Handles related to the Record Access Control Point characteristic. */
yihui 1:a607cd9655d7 222 uint16_t conn_handle; /**< Handle of the current connection (as provided by the BLE stack, is BLE_CONN_HANDLE_INVALID if not in a connection). */
yihui 1:a607cd9655d7 223 uint16_t feature;
yihui 1:a607cd9655d7 224 bool is_context_supported;
yihui 1:a607cd9655d7 225 } ble_gls_t;
yihui 1:a607cd9655d7 226
yihui 1:a607cd9655d7 227 /**@brief Function for initializing the Glucose Service.
yihui 1:a607cd9655d7 228 *
yihui 1:a607cd9655d7 229 * @details This call allows the application to initialize the Glucose Service.
yihui 1:a607cd9655d7 230 *
yihui 1:a607cd9655d7 231 * @param[out] p_gls Glucose Service structure. This structure will have to be supplied by
yihui 1:a607cd9655d7 232 * the application. It will be initialized by this function, and will later
yihui 1:a607cd9655d7 233 * be used to identify this particular service instance.
yihui 1:a607cd9655d7 234 * @param[in] p_gls_init Information needed to initialize the service.
yihui 1:a607cd9655d7 235 *
yihui 1:a607cd9655d7 236 * @return NRF_SUCCESS on successful initialization of service, otherwise an error code.
yihui 1:a607cd9655d7 237 */
yihui 1:a607cd9655d7 238 uint32_t ble_gls_init(ble_gls_t * p_gls, const ble_gls_init_t * p_gls_init);
yihui 1:a607cd9655d7 239
yihui 1:a607cd9655d7 240 /**@brief Function for handling the Application's BLE Stack events.
yihui 1:a607cd9655d7 241 *
yihui 1:a607cd9655d7 242 * @details Handles all events from the BLE stack of interest to the Glucose Service.
yihui 1:a607cd9655d7 243 *
yihui 1:a607cd9655d7 244 * @param[in] p_gls Glucose Service structure.
yihui 1:a607cd9655d7 245 * @param[in] p_ble_evt Event received from the BLE stack.
yihui 1:a607cd9655d7 246 */
yihui 1:a607cd9655d7 247 void ble_gls_on_ble_evt(ble_gls_t * p_gls, ble_evt_t * p_ble_evt);
yihui 1:a607cd9655d7 248
yihui 1:a607cd9655d7 249 /**@brief Function for reporting a new glucose measurement to the glucose service module.
yihui 1:a607cd9655d7 250 *
yihui 1:a607cd9655d7 251 * @details The application calls this function after having performed a new glucose measurement.
yihui 1:a607cd9655d7 252 * The new measurement is recorded in the RACP database.
yihui 1:a607cd9655d7 253 *
yihui 1:a607cd9655d7 254 * @param[in] p_gls Glucose Service structure.
yihui 1:a607cd9655d7 255 * @param[in] p_rec Pointer to glucose record (measurement plus context).
yihui 1:a607cd9655d7 256 *
yihui 1:a607cd9655d7 257 * @return NRF_SUCCESS on success, otherwise an error code.
yihui 1:a607cd9655d7 258 */
yihui 1:a607cd9655d7 259 uint32_t ble_gls_glucose_new_meas(ble_gls_t * p_gls, ble_gls_rec_t * p_rec);
yihui 1:a607cd9655d7 260
yihui 1:a607cd9655d7 261 #endif // BLE_GLS_H__
yihui 1:a607cd9655d7 262
yihui 1:a607cd9655d7 263 /** @} */
yihui 1:a607cd9655d7 264
yihui 1:a607cd9655d7 265 /** @endcond */