Device Information Service

group DIS

Device information service.

The Device Information Service exposes manufacturer and/or vendor information about a device. This module implements the Device Information Service. The Device Information Service may expose one or more of the characteristics. It can be configured in file dis_config.h.

Application shall register device information service when initialization.

Sample code:

void app_le_profile_init(void)
{
    dis_service_id = dis_add_service(app_profile_callback);
}

When characteristic value was read, write or cccd updated by remote device, app_profile_callback will be called. Application shall set dis parameter value by call dis_set_parameter.

Sample code:

T_APP_RESULT app_profile_callback(T_SERVER_ID service_id, void *p_data)
{
...
    if (dis_service_id == service_id)
    {
        T_DIS_CALLBACK_DATA *p_dis_cb_data = (T_DIS_CALLBACK_DATA *)p_data;
        switch (p_dis_cb_data->msg_type)
        {
        case SERVICE_CALLBACK_TYPE_READ_CHAR_VALUE:
            {
                if (p_dis_cb_data->msg_data.read_value_index == DIS_READ_MANU_NAME_INDEX)
                {
                    const uint8_t dis_manufacture_name[] = "Realtek BT";
                    dis_set_parameter(DIS_PARAM_MANUFACTURER_NAME,
                                      sizeof(dis_manufacture_name),
                                      (void *)dis_manufacture_name);
                }
                else if (p_dis_cb_data->msg_data.read_value_index == DIS_READ_MODEL_NUM_INDEX)
                {
                    const uint8_t dis_model_number[] = "Model Num 1.0";
                    dis_set_parameter(DIS_PARAM_MODEL_NUMBER,
                                      sizeof(dis_model_number),
                                      (void *)dis_model_number);
                }
                ...
                ...

            }

            break;
        default:
            break;
        }
    }
}