GLS Exported Functions

group GLS_Exported_Functions

Functions

T_SERVER_ID gls_add_service(void *p_func)

Add Glucose Service to the Bluetooth Host.

Example usage

void profile_init()
{
    server_init(service_num);
    gls_id = gls_add_service(app_handle_profile_message);
}

Parameters:

p_func[in] Callback when service attribute was read, write or CCCD update.

Return values:
  • 0xFF – Operation failure.

  • Others – Service ID assigned by Bluetooth Host.

Returns:

Service ID generated by the Bluetooth Host: T_SERVER_ID.

bool gls_set_parameter(T_GLS_PARAM_TYPE param_type, uint8_t len, void *p_value)

Set a GLS parameter.

This function can be called with a Glucose Service parameter type and it will set the Glucose Service parameter. Glucose Service parameters are defined in T_GLS_PARAM_TYPE. If the “len” field is set to the size of a “uint16_t”, the “p_value” field must point to a data with type of “uint16_t”.

Example usage

void test(void)
{
    T_GLC_MEASUREMENT_FLAG ms_flag =
    {
        1, //time_offset
        1, //con_ts_loc
        GLC_FLAGS_UNITS_MOL_L_ON, //con_units
        1, //ss_annuciation
        0, //ctxt_info_follows
        0  //rfu
    };
    bool ret = gls_set_parameter(GLS_PARAM_GLC_MS_FLAG, 1, &ms_flag);
}

Parameters:
  • param_type[in] Glucose Service parameter type: T_GLS_PARAM_TYPE.

  • len[in] Length of data to write.

  • p_value[in] Pointer to data to write. This is dependent on the parameter type and will be cast to the appropriate data type (For example: if data type of param is uint16_t, p_value will be cast to pointer of uint16_t).

Return values:
  • true – Operation success.

  • false – Operation failure.

Returns:

Operation result.

bool gls_get_parameter(T_GLS_PARAM_TYPE param_type, uint8_t *len, void *p_value)

Get a GLS parameter.

This function can be called with a glucose parameter type and it will get a glucose parameter. Glucose parameters are defined in T_GLS_PARAM_TYPE.

Example usage

void test(void)
{
    bool ret = gls_get_parameter(GLS_PARAM_RECORD_NUM, &len, &record_num);
}

Parameters:
  • param_type[in] Glucose parameter type: T_GLS_PARAM_TYPE

  • len[inout] Pointer to the location to get the length of data.

  • p_value[inout] Pointer to the location to get the parameter value. This is dependent on the parameter type and will be cast to the appropriate data type (For example: if data type of param is uint16_t, p_value will be cast to pointer of uint16_t).

Return values:
  • true – Operation success.

  • false – Operation failure.

Returns:

Operation result.

bool gls_glc_measurement_notify(uint8_t conn_id, T_SERVER_ID service_id, uint8_t index)

Send measurement notification data.

Example usage

void test(void)
{
    bool ret = gls_glc_measurement_notify(conn_id, gls_id, index);
}

Parameters:
  • conn_id[in] Connection ID.

  • service_id[in] Service ID.

  • index[in] Index.

Return values:
  • true – Operation success.

  • false – Operation failure.

Returns:

Operation result.

bool gls_glc_measurement_context_notify(uint8_t conn_id, T_SERVER_ID service_id, uint8_t index)

Send measurement context notification data.

Example usage

void test(void)
{
    bool ret = gls_glc_measurement_context_notify(conn_id, gls_id, index);
}

Parameters:
  • conn_id[in] Connection ID.

  • service_id[in] Service ID.

  • index[in] Index.

Return values:
  • true – Operation success.

  • false – Operation failure.

Returns:

Operation result.

bool gls_racp_response(uint8_t conn_id, T_SERVER_ID service_id, uint8_t rsp_code)

Indicate control point data response to client from application.

Parameters:
  • conn_id[in] Connection ID.

  • service_id[in] Service ID.

  • rsp_code[in] Response code.

Return values:
  • true – Operation success.

  • false – Operation failure.

Returns:

Operation result.

bool gls_racp_num_response(uint8_t conn_id, T_SERVER_ID service_id, uint16_t num)

Indicate control point data number response to client from application.

Parameters:
  • conn_id[in] Connection ID.

  • service_id[in] Service ID.

  • num[in] Number of glucose records.

Return values:
  • true – Operation success.

  • false – Operation failure.

Returns:

Operation result.

void gls_prepare_new_record(void)

Prepare a new record in database.

Returns:

void.

void gls_push_new_record(void)

Push a new record into database.

Returns:

void.

bool gls_report_records_task(uint8_t conn_id, T_SERVER_ID service_id)

Report records sub procedure.

Example usage

void test(void)
{
    bool ret = gls_report_records_task(conn_id, gls_id);
}

Parameters:
  • conn_id[in] Connection ID.

  • service_id[in] Service ID.

Return values:
  • true – Operation success.

  • false – Operation failure.

Returns:

Operation result.

void user_face_time(TIMESTAMP time_in, int16_t time_offset, TIMESTAMP time_out)

Calculate user-facing time by adding base time and time offset.

Example usage

void test(void)
{
    user_face_time(time_in, time_offset, time_out);
}

Parameters:
  • time_in[in] Time in.

  • time_offset[in] Time offset.

  • time_out[in] Time out.

Returns:

void.

void gls_abort_racp_procedure(void)

Abort RACP procedure by APP.

Example usage

void test(void)
{
    gls_abort_racp_procedure();
}

Returns:

void.