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 device information service parameter type and it will set the device information service parameter. Device information service parameters are defined in T_DIS_PARAM_TYPE. If the “length” field is set to the size of a “uint16_t”, the “p_value” field must point to data with the type “uint16_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. This is dependent on the parameter type and will be cast to the appropriate data type (For example: if the data type of param is uint16_t, p_value will be cast to a pointer of uint16_t).

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.