gls.h File Reference

Glucose Service API. More...

#include "gr_includes.h"
#include "custom_config.h"
#include "ble_prf_utils.h"
#include <stdint.h>
#include <stdbool.h>
+ Include dependency graph for gls.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  gls_ieee_float16_t
 SFLOAT format (IEEE-11073 16-bit FLOAT, defined as a 16-bit value with 12-bit mantissa and 4-bit exponent). More...
 
struct  gls_evt_t
 Glucose Service event. More...
 
struct  gls_meas_val_t
 Glucose Measurement structure. More...
 
struct  gls_meas_ctx_t
 Glucose measurement context structure. More...
 
struct  gls_rec_t
 Glucose measurement record. More...
 
struct  gls_init_t
 Glucose Service init stucture. More...
 

Macros

#define GLS_CONNECTION_MAX   10
 Maximum number of Glucose Profile connections. More...
 
#define GLS_MEAS_VAL_LEN_MAX   20
 Maximum length of GLS measurement value. More...
 
#define GLS_MEAS_CTX_LEN_MAX   20
 Maximum length of GLS measurement context value. More...
 
#define GLS_REC_ACCESS_CTRL_LEN_MIN   2
 Minimum length of Record Access Control Point packet. More...
 
#define GLS_REC_ACCESS_CTRL_LEN_MAX   21
 Maximum length of Record Access Control Point packet. More...
 
#define GLS_NTF_OF_NULL   0x00
 Mask for no notify. More...
 
#define GLS_NTF_OF_MEAS   0x01
 Mask for measurement notify. More...
 
#define GLS_NTF_OF_MEAS_CTX   0x10
 Mask for measurement context notify. More...
 
#define GLS_ERROR_PROC_IN_PROCESS   0x80
 Error code: A previously triggered SC Control Point operation is still in progress. More...
 
#define GLS_ERROR_CCCD_INVALID   0x81
 Error code: The Client Characteristic Configuration descriptor is not configured. More...
 
#define GLS_CHAR_MANDATORY   0x0f8f
 Bit mask for mandatory characteristic in GLS. More...
 
#define GLS_CHAR_MEAS_CTX_SUP   0x0070
 Bit mask for Glucose Measurement Context characteristic that is optional. More...
 
#define GLS_CHAR_FULL   0x0fff
 Bit mask of the full characteristic. More...
 
#define GLS_FEAT_LOW_BATT   (0x01 << 0)
 Low Battery Detection During Measurement Supported. More...
 
#define GLS_FEAT_MALFUNC   (0x01 << 1)
 Sensor Malfunction Detection Supported. More...
 
#define GLS_FEAT_SAMPLE_SIZE   (0x01 << 2)
 Sensor Sample Size Supported. More...
 
#define GLS_FEAT_INSERT_ERR   (0x01 << 3)
 Sensor Strip Insertion Error Detection Supported. More...
 
#define GLS_FEAT_TYPE_ERR   (0x01 << 4)
 Sensor Strip Type Error Detection Supported. More...
 
#define GLS_FEAT_RES_HIGH_LOW   (0x01 << 5)
 Sensor Result High-Low Detection Supported. More...
 
#define GLS_FEAT_TEMP_HIGH_LOW   (0x01 << 6)
 Sensor Temperature High-Low Detection Supported. More...
 
#define GLS_FEAT_READ_INT   (0x01 << 7)
 Sensor Read Interrupt Detection Supported. More...
 
#define GLS_FEAT_GENERAL_FAULT   (0x01 << 8)
 General Device Fault Supported. More...
 
#define GLS_FEAT_TIME_FAULT   (0x01 << 9)
 Time Fault Supported. More...
 
#define GLS_FEAT_MULTI_BOND   (0x01 << 10)
 Multiple Bond Supported. More...
 
#define GLS_FEAT_FULL   (0x07ff)
 All feature Supported. More...
 
#define GLS_MEAS_FLAG_TIME_OFFSET   0x01
 Time Offset Present. More...
 
#define GLS_MEAS_FLAG_CONC_TYPE_LOC   0x02
 Glucose Concentration, Type, and Sample Location Present. More...
 
#define GLS_MEAS_FLAG_UNITS_KG_L   0x00
 Glucose Concentration Units kg/L. More...
 
#define GLS_MEAS_FLAG_UNITS_MOL_L   0x04
 Glucose Concentration Units mol/L. More...
 
#define GLS_MEAS_FLAG_SENSOR_STATUS   0x08
 Sensor Status Annunciation Present. More...
 
#define GLS_MEAS_FLAG_CONTEXT_INFO   0x10
 Context Information Follows. More...
 
#define GLS_MEAS_CTX_FLAG_CARB   (0x01 << 0)
 Carbohydrate id and carbohydrate present. More...
 
#define GLS_MEAS_CTX_FLAG_MEAL   (0x01 << 1)
 Meal present. More...
 
#define GLS_MEAS_CTX_FLAG_TESTER   (0x01 << 2)
 Tester-health present. More...
 
#define GLS_MEAS_CTX_FLAG_EXERCISE   (0x01 << 3)
 Exercise duration and exercise intensity present. More...
 
#define GLS_MEAS_CTX_FLAG_MED   (0x01 << 4)
 Medication ID and medication present. More...
 
#define GLS_MEAS_CTX_FLAG_MED_KG   (0x01 << 5)
 Medication value units, kilograms. More...
 
#define GLS_MEAS_CTX_FLAG_MED_L   (0x01 << 6)
 Medication value units, liters. More...
 
#define GLS_MEAS_CTX_FLAG_HBA1C   (0x01 << 7)
 Hba1c present. More...
 
#define GLS_MEAS_CTX_FLAG_EXT   (0x01 << 8)
 Extended flags present. More...
 
#define GLS_MEAS_STATUS_BATT_LOW   (0x01 << 0)
 Device battery low at time of measurement. More...
 
#define GLS_MEAS_STATUS_SENSOR_FAULT   (0x01 << 1)
 Sensor malfunction or faulting at time of measurement. More...
 
#define GLS_MEAS_STATUS_SAMPLE_SIZE   (0x01 << 2)
 Sample size for blood or control solution insufficient at time of measurement. More...
 
#define GLS_MEAS_STATUS_STRIP_INSERT   (0x01 << 3)
 Strip insertion error. More...
 
#define GLS_MEAS_STATUS_STRIP_TYPE   (0x01 << 4)
 Strip type incorrect for device. More...
 
#define GLS_MEAS_STATUS_RESULT_HIGH   (0x01 << 5)
 Sensor result higher than the device can process. More...
 
#define GLS_MEAS_STATUS_RESULT_LOW   (0x01 << 6)
 Sensor result lower than the device can process. More...
 
#define GLS_MEAS_STATUS_TEMP_HIGH   (0x01 << 7)
 Sensor temperature too high for valid test/result at time of measurement. More...
 
#define GLS_MEAS_STATUS_TEMP_LOW   (0x01 << 8)
 Sensor temperature too low for valid test/result at time of measurement. More...
 
#define GLS_MEAS_STATUS_STRIP_PULL   (0x01 << 9)
 Sensor read interrupted because strip was pulled too soon at time of measurement. More...
 
#define GLS_MEAS_STATUS_GENERAL_FAULT   (0x01 << 10)
 General device fault has occurred in the sensor. More...
 
#define GLS_MEAS_STATUS_TIME_FAULT   (0x01 << 11)
 Time fault has occurred in the sensor and time may be inaccurate. More...
 

Typedefs

typedef void(* gls_evt_handler_t) (gls_evt_t *p_evt)
 Glucose Service event handler type. More...
 

Enumerations

enum  gls_meas_type_t {
  GLS_MEAS_TYPE_CAP_BLOOD = 0x01, GLS_MEAS_TYPE_CAP_PLASMA, GLS_MEAS_TYPE_VEN_BLOOD, GLS_MEAS_TYPE_VEN_PLASMA,
  GLS_MEAS_TYPE_ART_BLOOD, GLS_MEAS_TYPE_ART_PLASMA, GLS_MEAS_TYPE_UNDET_BLOOD, GLS_MEAS_TYPE_UNDET_PLASMA,
  GLS_MEAS_TYPE_FLUID, GLS_MEAS_TYPE_CONTROL
}
 Glucose measurement type. More...
 
enum  gls_meas_loc_t {
  GLS_MEAS_LOC_FINGER = 0x01, GLS_MEAS_LOC_AST, GLS_MEAS_LOC_EAR, GLS_MEAS_LOC_CONTROL,
  GLS_MEAS_LOC_NOT_AVAIL = 0x0f
}
 Glucose measurement location. More...
 
enum  gls_meas_ctx_carb_id_t {
  GLS_MEAS_CTX_CARB_BREAKFAST = 0x01, GLS_MEAS_CTX_CARB_LUNCH, GLS_MEAS_CTX_CARB_DINNER, GLS_MEAS_CTX_CARB_SNACK,
  GLS_MEAS_CTX_CARB_DRINK, GLS_MEAS_CTX_CARB_SUPPER, GLS_MEAS_CTX_CARB_BRUNCH
}
 Glucose measurement context carbohydrate ID. More...
 
enum  gls_meas_ctx_meal_t {
  GLS_MEAS_CTX_MEAL_PREPRANDIAL = 0x01, GLS_MEAS_CTX_MEAL_POSTPRANDIAL, GLS_MEAS_CTX_MEAL_FASTING, GLS_MEAS_CTX_MEAL_CASUAL,
  GLS_MEAS_CTX_MEAL_BEDTIME
}
 Glucose measurement context meal. More...
 
enum  gls_meas_ctx_tester_t { GLS_MEAS_CTX_TESTER_SELF = 0x01, GLS_MEAS_CTX_TESTER_PRO, GLS_MEAS_CTX_TESTER_LAB, GLS_MEAS_CTX_TESTER_NOT_AVAIL = 0x0f }
 Glucose measurement context tester. More...
 
enum  gls_meas_ctx_health_t {
  GLS_MEAS_CTX_HEALTH_MINOR = 0x01, GLS_MEAS_CTX_HEALTH_MAJOR, GLS_MEAS_CTX_HEALTH_MENSES, GLS_MEAS_CTX_HEALTH_STRESS,
  GLS_MEAS_CTX_HEALTH_NONE, GLS_MEAS_CTX_HEALTH_NOT_AVAIL = 0x0f
}
 Glucose measurement context health. More...
 
enum  gls_meas_ctx_medic_id_t {
  GLS_MEAS_CTX_MED_RAPID = 0x01, GLS_MEAS_CTX_MED_SHORT, GLS_MEAS_CTX_MED_INTERMED, GLS_MEAS_CTX_MED_LONG,
  GLS_MEAS_CTX_MED_PREMIX
}
 Glucose measurement context medication ID. More...
 
enum  gls_evt_type_t {
  GLS_EVT_INVALID = 0x00, GLS_EVT_MEAS_NOTIFICATION_ENABLED, GLS_EVT_MEAS_NOTIFICATION_DISABLED, GLS_EVT_CTX_NOTIFICATION_ENABLED,
  GLS_EVT_CTX_NOTIFICATION_DISABLED, GLS_EVT_CTRL_INDICATION_ENABLED, GLS_EVT_CTRL_INDICATION_DISABLED, GLS_EVT_CTRL_WRITE
}
 Glucose Service event type. More...
 

Functions

sdk_err_t gls_service_init (gls_init_t *p_gls_init)
 Initialize a Glucose Service instance and add in the DB. More...
 
bool gls_new_meas_record (gls_rec_t *p_rec)
 Record a new glucose measurement. More...
 
sdk_err_t gls_racp_rsp_send (uint8_t conn_idx, uint8_t *p_data, uint16_t length)
 Send RACP responce if indication has been enabled. More...
 

Detailed Description

Glucose Service API.

Attention
Copyright (c) 2019 GOODIX

All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. Neither the name of GOODIX nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Definition in file gls.h.