GLPS minor improvement

ID: LPCBARESDK-695

Status: Open

First reported: 6.0.14.1114

Fixed in: TBD

Description

In the current SDK6 version there exists a minor limitation in GLPS profile. If the application does not support Glucose measurement context, then the GLPS_IDX calculates the relative attribute value handle incorrectly. As a result, the ATTribute layer will return Attribute permissions are insufficient to the peer device.

When the structure element meas_ctx_supported is 0, and the application reads the GLS_IDX_FEATURE_VAL from the attribute state machine enum, Therefore, the get database attribute index a part of the condition of the ternary operator evaluates false in the original SDK6 code.

Workaround

Changing the GLPS_IDX to the following corrects the calculation where the comparison is made against GLS_IDX_MEAS_NTF_CFG instead of GLS_IDX_MEAS_CTX_NTF_CFG:

Original location: _6.0.14.1114sdkblestackprofilesglpglps* File name: *glps.h

Existing code

/// Get database attribute index
#define GLPS_IDX(hdl) \
    (((((hdl) - glps_env->start_hdl) > GLS_IDX_MEAS_CTX_NTF_CFG) && !(glps_env->meas_ctx_supported)) ?\
        ((hdl) - glps_env->start_hdl + 3) : ((hdl) - glps_env->start_hdl))

Modified code

/// Get database attribute index
#define GLPS_IDX(hdl) \
    (((((hdl) - glps_env->start_hdl) > GLS_IDX_MEAS_NTF_CFG) && !(glps_env->meas_ctx_supported)) ?\
        ((hdl) - glps_env->start_hdl + 3) : ((hdl) - glps_env->start_hdl))