DIS Exported Functions

group DIS_Exported_Functions

Functions

bool dis_set_parameter(T_DIS_PARAM_TYPE param_type, uint8_t length, void *p_value)

Set a Device Information Service parameter.

This function can be called with a DIS parameter type T_DIS_PARAM_TYPE and it will set the DIS 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)
{
    const uint8_t dis_manufacture_name[] = "Realtek BT";
    bool ret = dis_set_parameter(DIS_PARAM_MANUFACTURER_NAME,
                                 sizeof(dis_manufacture_name),
                                 (void *)dis_manufacture_name);
}
Parameters:
  • param_type -- [in] Device Information Service parameter type: T_DIS_PARAM_TYPE.

  • length -- [in] Length of data to write.

  • p_value -- [in] Pointer to data to write.

Return values:
  • true -- Operation success.

  • false -- Operation failure.

Returns:

Operation result.

T_SERVER_ID dis_add_service(void *p_func)

Add Device Information Service to the Bluetooth Host.

Example usage

void profile_init()
{
    server_init(service_num);
    dis_id = dis_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.