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);
}
参数:

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

返回值:
  • 0xFF -- Operation failure.

  • Others -- Service ID assigned by Bluetooth Host.

返回:

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 GLS parameter type T_GLS_PARAM_TYPE and it will set the GLS parameter. The 'p_value' field must point to an appropriate data type that meets the requirements for the corresponding parameter type. (For example, if required data length for parameter type is 1 octets, p_value should be cast to a pointer of uint8_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);
}
参数:
  • 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.

返回值:
  • true -- Operation success.

  • false -- Operation failure.

返回:

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);
}
参数:
  • 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).

返回值:
  • true -- Operation success.

  • false -- Operation failure.

返回:

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);
}
参数:
  • conn_id -- [in] Connection ID.

  • service_id -- [in] Service ID.

  • index -- [in] Index.

返回值:
  • true -- Operation success.

  • false -- Operation failure.

返回:

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);
}
参数:
  • conn_id -- [in] Connection ID.

  • service_id -- [in] Service ID.

  • index -- [in] Index.

返回值:
  • true -- Operation success.

  • false -- Operation failure.

返回:

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.

参数:
  • conn_id -- [in] Connection ID.

  • service_id -- [in] Service ID.

  • rsp_code -- [in] Response code.

返回值:
  • true -- Operation success.

  • false -- Operation failure.

返回:

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.

参数:
  • conn_id -- [in] Connection ID.

  • service_id -- [in] Service ID.

  • num -- [in] Number of glucose records.

返回值:
  • true -- Operation success.

  • false -- Operation failure.

返回:

Operation result.

void gls_prepare_new_record(void)

Prepare a new record in database.

void gls_push_new_record(void)

Push a new record into database.

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);
}
参数:
  • conn_id -- [in] Connection ID.

  • service_id -- [in] Service ID.

返回值:
  • true -- Operation success.

  • false -- Operation failure.

返回:

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);
}
参数:
  • time_in -- [in] Time in.

  • time_offset -- [in] Time offset.

  • time_out -- [in] Time out.

void gls_abort_racp_procedure(void)

Abort RACP procedure by APP.

Example usage

void test(void)
{
    gls_abort_racp_procedure();
}