Data Structures | Macros | Typedefs | Enumerations | Functions
gls.h File Reference

Glucose Service API. More...

`#include "gr55xx_sys.h"`
`#include "custom_config.h"`
`#include "ble_prf_utils.h"`
`#include <stdint.h>`
`#include <stdbool.h>`

Go to the source code of this file.

## Data Structures
struct | 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. This contains glucose measurement value. 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. This contains all option and data needed for initialization of the service. More...

## Macros
#define | GLS_CONNECTION_MAX
#define | GLS_MEAS_VAL_LEN_MAX 20
#define | GLS_MEAS_CTX_LEN_MAX 20
#define | GLS_REC_ACCESS_CTRL_LEN_MIN 2
#define | GLS_REC_ACCESS_CTRL_LEN_MAX 21
#define | GLS_NTF_OF_NULL 0x00
#define | GLS_NTF_OF_MEAS 0x01
#define | GLS_NTF_OF_MEAS_CTX 0x10
#define | GLS_ERROR_PROC_IN_PROCESS 0x80
#define | GLS_ERROR_CCCD_INVALID 0x81
#define | GLS_CHAR_MANDATORY 0x0f8f
#define | GLS_CHAR_MEAS_CTX_SUP 0x0070
#define | GLS_CHAR_FULL 0x0fff
#define | GLS_FEAT_LOW_BATT (0x01 << 0)
#define | GLS_FEAT_MALFUNC (0x01 << 1)
#define | GLS_FEAT_SAMPLE_SIZE (0x01 << 2)
#define | GLS_FEAT_INSERT_ERR (0x01 << 3)
#define | GLS_FEAT_TYPE_ERR (0x01 << 4)
#define | GLS_FEAT_RES_HIGH_LOW (0x01 << 5)
#define | GLS_FEAT_TEMP_HIGH_LOW (0x01 << 6)
#define | GLS_FEAT_READ_INT (0x01 << 7)
#define | GLS_FEAT_GENERAL_FAULT (0x01 << 8)
#define | GLS_FEAT_TIME_FAULT (0x01 << 9)
#define | GLS_FEAT_MULTI_BOND (0x01 << 10)
#define | GLS_FEAT_FULL (0x07ff)
#define | GLS_MEAS_FLAG_TIME_OFFSET 0x01
#define | GLS_MEAS_FLAG_CONC_TYPE_LOC 0x02
#define | GLS_MEAS_FLAG_UNITS_KG_L 0x00
#define | GLS_MEAS_FLAG_UNITS_MOL_L 0x04
#define | GLS_MEAS_FLAG_SENSOR_STATUS 0x08
#define | GLS_MEAS_FLAG_CONTEXT_INFO 0x10
#define | GLS_MEAS_CTX_FLAG_CARB (0x01 << 0)
#define | GLS_MEAS_CTX_FLAG_MEAL (0x01 << 1)
#define | GLS_MEAS_CTX_FLAG_TESTER (0x01 << 2)
#define | GLS_MEAS_CTX_FLAG_EXERCISE (0x01 << 3)
#define | GLS_MEAS_CTX_FLAG_MED (0x01 << 4)
#define | GLS_MEAS_CTX_FLAG_MED_KG (0x01 << 5)
#define | GLS_MEAS_CTX_FLAG_MED_L (0x01 << 6)
#define | GLS_MEAS_CTX_FLAG_HBA1C (0x01 << 7)
#define | GLS_MEAS_CTX_FLAG_EXT (0x01 << 8)
#define | GLS_MEAS_STATUS_BATT_LOW (0x01 << 0)
#define | GLS_MEAS_STATUS_SENSOR_FAULT (0x01 << 1)
#define | GLS_MEAS_STATUS_SAMPLE_SIZE (0x01 << 2)
#define | GLS_MEAS_STATUS_STRIP_INSERT (0x01 << 3)
#define | GLS_MEAS_STATUS_STRIP_TYPE (0x01 << 4)
#define | GLS_MEAS_STATUS_RESULT_HIGH (0x01 << 5)
#define | GLS_MEAS_STATUS_RESULT_LOW (0x01 << 6)
#define | GLS_MEAS_STATUS_TEMP_HIGH (0x01 << 7)
#define | GLS_MEAS_STATUS_TEMP_LOW (0x01 << 8)
#define | GLS_MEAS_STATUS_STRIP_PULL (0x01 << 9)
#define | GLS_MEAS_STATUS_GENERAL_FAULT (0x01 << 10)
#define | GLS_MEAS_STATUS_TIME_FAULT (0x01 << 11)

## Typedefs
typedef void(* | gls_evt_handler_t) (gls_evt_t *p_evt)
| Glucose Service event handler type.

## 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.