.. _lib_ble_service_cgms: Continuous Glucose Monitoring Service (CGMS) ############################################ .. contents:: :local: :depth: 2 This module implements a sensor for the Continuous Glucose Monitoring Service. Overview ******** The sensor is a GATT Server that sends CGM measurements to a connected CGMS Collector. The CGMS Sensor stores records that can be accessed with the Record Access Control Point (RACP). The collector can access the features and status of the sensor. Session Run Time and Session Start Time can be used to convey timing information between the sensor and the collector. The Specific Operations Control Point is used to stop and start monitoring sessions, among other things. Configuration ************* Set the :kconfig:option:`CONFIG_BLE_CGMS` Kconfig option to enable the service. The CGMS service can be configured by using the following Kconfig options: * :kconfig:option:`CONFIG_BLE_CGMS_DB_RECORDS_MAX` - Sets the maximum number of records that can be stored in the database. Initialization ============== The service instance is declared using the :c:macro:`BLE_CGMS_DEF` macro, specifying the name of the instance. The service is initialized by calling the :c:func:`ble_cgms_init` function. See the :c:struct:`ble_cgms_config` struct for configuration details, in addition to the CGMS specification. Usage ***** Events from the service are forwarded through the event handler specified during initialization. For a full list of events see the :c:enum:`ble_cgms_evt_type` enum. The :c:func:`ble_cgms_conn_handle_assign` must be called to assign a connection handle to a CGMS instance. The application can report a new measurement to the CGMS module by calling the :c:func:`ble_cgms_meas_create` function. The new measurement is recorded in the RACP database. The application can call the :c:func:`ble_cgms_update_status` function to update the CGM status characteristic value. The :c:func:`ble_cgms_srt_set` function allows the application to set the Session Run Time characteristic value. Dependencies ************ This service has the following |BMshort| dependencies: * SoftDevice (peripheral role) - :kconfig:option:`CONFIG_SOFTDEVICE_PERIPHERAL` * :ref:`lib_nrf_sdh` (Bluetooth LE) - :kconfig:option:`CONFIG_NRF_SDH_BLE` * Record Access Control Point - :kconfig:option:`CONFIG_BLE_RACP` * :ref:`lib_ble_gatt_queue` - :kconfig:option:`CONFIG_BLE_GATT_QUEUE` API documentation ***************** | Header file: :file:`include/bm/bluetooth/services/ble_cgms.h` | Source files: :file:`subsys/bluetooth/services/ble_cgms/` :ref:`Continuous Glucose Monitoring Service API reference `