GATT Continuous Glucose Monitoring Service (CGMS)

Overview

This library implements the Continuous Glucose Monitoring Service with the corresponding set of characteristics defined in the Continuous Glucose Monitoring Service Specification.

Supported features

All the mandatory CGMS features are supported.

Configuration

Set the maximum number of glucose measurement records stored in the device using the CONFIG_BT_CGMS_MAX_MEASUREMENT_RECORD Kconfig option. The value should be large enough to hold all records generated in a session.

Set the logging level of the CGMS library using the CONFIG_BT_CGMS_LOG_LEVEL_CHOICE Kconfig option.

Usage

To use CGMS in your application, call the bt_cgms_init() function. Then, call the bt_cgms_measurement_add() function to pass the measurement result of glucose concentration to CGMS.

API documentation

Header file: include/bluetooth/services/cgms.h
Source files: subsys/bluetooth/services/cgms
group bt_cgms

API for the Continuous Glucose Monitoring Service (CGMS).

Enums

enum bt_cgms_feat_type

CGMS Feature characteristic Type field.

Values:

enumerator BT_CGMS_FEAT_TYPE_CAP_BLOOD

Capillary Whole blood

enumerator BT_CGMS_FEAT_TYPE_CAP_PLASMA

Capillary Plasma

enumerator BT_CGMS_FEAT_TYPE_VEN_BLOOD

Venous Whole blood

enumerator BT_CGMS_FEAT_TYPE_VEN_PLASMA

Venous Plasma

enumerator BT_CGMS_FEAT_TYPE_ART_BLOOD

Arterial Whole blood

enumerator BT_CGMS_FEAT_TYPE_ART_PLASMA

Arterial Plasma

enumerator BT_CGMS_FEAT_TYPE_UNDET_BLOOD

Arterial Plasma

enumerator BT_CGMS_FEAT_TYPE_UNDET_PLASMA

Arterial Plasma

enumerator BT_CGMS_FEAT_TYPE_FLUID

Interstitial Fluid (ISF)

enumerator BT_CGMS_FEAT_TYPE_CONTROL

Control Solution

enum bt_cgms_feat_loc

CGMS Feature characteristic Sample Location field.

Values:

enumerator BT_CGMS_FEAT_LOC_FINGER

Finger

enumerator BT_CGMS_FEAT_LOC_AST

Alternate Site Test (AST)

enumerator BT_CGMS_FEAT_LOC_EAR

Earlobe

enumerator BT_CGMS_FEAT_LOC_CONTROL

Control solution

enumerator BT_CGMS_FEAT_LOC_SUB_TISSUE

Subcutaneous tissue

enumerator BT_CGMS_FEAT_LOC_NOT_AVAIL

Sample Location value not available

Functions

int bt_cgms_measurement_add(struct bt_cgms_measurement measurement)

Submit glucose concentration measurement to CGM service.

This will add the new glucose measurement into the database.

Parameters:
  • measurement[in] The measurement result.

Returns:

Zero in case of success and error code in case of error.

int bt_cgms_init(struct bt_cgms_init_param *init_params)

Initialize Continuous Glucose Monitoring service.

This will initialize components used in CGMS.

Parameters:
  • init_params[in] The parameter used to initialize the corresponding values of CGMS module.

Returns:

Zero in case of success and error code in case of error.

struct bt_cgms_measurement
#include <cgms.h>

Continuous Glucose Monitoring service measurement record structure.

Public Members

struct sfloat glucose

The glucose concentration measurement in milligram per deciliter (mg/dL). It is in SFLOAT type defined in the IEEE 11073-20601 specification.

struct bt_cgms_cb
#include <cgms.h>

Continuous Glucose Monitoring service callback structure.

Public Members

void (*session_state_changed)(const bool session_state)

Callback when the state of session changes.

The application may start or stop glucose measurement based on the latest state of a session.

Param session_state:

The state of current session. True if session starts, False if session stops.

struct bt_cgms_init_param
#include <cgms.h>

Continuous Glucose Monitoring service initialization structure.

Public Members

enum bt_cgms_feat_type type

Continuous Glucose Monitoring type.

enum bt_cgms_feat_loc sample_location

CGMS sample location.

uint16_t session_run_time

The session run time in uint of hour. It shall be positive.

uint16_t initial_comm_interval

Initial communication interval of notification. It shall be positive.

struct bt_cgms_cb *cb

CGMS callback structure.