Device Information Service

[中文]

The device information service exposes manufacturer and/or vendor information about a device.

Examples

bluetooth/ble_services/ble_dis.

API Reference

Header File

Functions

esp_err_t esp_ble_dis_get_model_number(const char **value)

Get the model number that is assigned by the device vendor.

Parameters

value[out] The pointer to store the model number.

Returns

  • ESP_OK on successful

  • ESP_ERR_INVALID_ARG on wrong model number

esp_err_t esp_ble_dis_set_model_number(const char *value)

Set the model number of the device.

Parameters

value[in] The pointer to store the model number.

Returns

  • ESP_OK on successful

  • ESP_ERR_INVALID_ARG on wrong model number

esp_err_t esp_ble_dis_get_serial_number(const char **value)

Get the serial number for a particular instance of the device.

Parameters

value[out] The pointer to store the serial number.

Returns

  • ESP_OK on successful

  • ESP_ERR_INVALID_ARG on wrong serial number

esp_err_t esp_ble_dis_set_serial_number(const char *value)

Set the serial number of the device.

Parameters

value[in] The pointer to store the serial number.

Returns

  • ESP_OK on successful

  • ESP_ERR_INVALID_ARG on wrong serial number

esp_err_t esp_ble_dis_get_firmware_revision(const char **value)

Get the firmware revision for the firmware within the device.

Parameters

value[out] The pointer to store the firmware revision.

Returns

  • ESP_OK on successful

  • ESP_ERR_INVALID_ARG on wrong firmware revision

esp_err_t esp_ble_dis_set_firmware_revision(const char *value)

Set the firmware revision of the device.

Parameters

value[in] The pointer to store the firmware revision.

Returns

  • ESP_OK on successful

  • ESP_ERR_INVALID_ARG on wrong firmware revision

esp_err_t esp_ble_dis_get_hardware_revision(const char **value)

Get the hardware revision for the hardware within the device.

Parameters

value[out] The pointer to store the hardware revision.

Returns

  • ESP_OK on successful

  • ESP_ERR_INVALID_ARG on wrong hardware revision

esp_err_t esp_ble_dis_set_hardware_revision(const char *value)

Set the hardware revision of the device.

Parameters

value[in] The pointer to store the hardware revision.

Returns

  • ESP_OK on successful

  • ESP_ERR_INVALID_ARG on wrong hardware revision

esp_err_t esp_ble_dis_get_software_revision(const char **value)

Get the software revision for the software within the device.

Parameters

value[out] The pointer to store the software revision.

Returns

  • ESP_OK on successful

  • ESP_ERR_INVALID_ARG on wrong software revision

esp_err_t esp_ble_dis_set_software_revision(const char *value)

Set the software revision of the device.

Parameters

value[in] The pointer to store the software revision.

Returns

  • ESP_OK on successful

  • ESP_ERR_INVALID_ARG on wrong software revision

esp_err_t esp_ble_dis_get_manufacturer_name(const char **value)

Get the name of the manufacturer of the device.

Parameters

value[out] The pointer to store the name of the manufacturer.

Returns

  • ESP_OK on successful

  • ESP_ERR_INVALID_ARG on wrong name of the manufacturer

esp_err_t esp_ble_dis_set_manufacturer_name(const char *value)

Set the name of the manufacturer of the device.

Parameters

value[in] The pointer to store the name of the manufacturer.

Returns

  • ESP_OK on successful

  • ESP_ERR_INVALID_ARG on wrong name of the manufacturer

esp_err_t esp_ble_dis_get_system_id(const char **value)

Get the System Id of the device.

Parameters

value[out] The pointer to store the System Id.

Returns

  • ESP_OK on successful

  • ESP_ERR_INVALID_ARG on wrong System Id

esp_err_t esp_ble_dis_set_system_id(const char *value)

Set the System Id of the device.

Parameters

value[in] The pointer to store the System Id.

Returns

  • ESP_OK on successful

  • ESP_ERR_INVALID_ARG on wrong System Id

esp_err_t esp_ble_dis_get_pnp_id(esp_ble_dis_pnp_t *pnp_id)

Get the PnP Id of the device.

Parameters

pnp_id[in] The pointer to store the PnP Id.

Returns

:

  • ESP_OK on successful

  • ESP_ERR_INVALID_ARG on wrong PnP Id

esp_err_t esp_ble_dis_set_pnp_id(esp_ble_dis_pnp_t *pnp_id)

Set the PnP Id of the device.

Parameters

pnp_id[in] The pointer to store the PnP Id.

Returns

  • ESP_OK on successful

  • ESP_ERR_INVALID_ARG on wrong PnP Id

esp_err_t esp_ble_dis_init(void)

Initialization GATT Device Information Service.

Returns

  • ESP_OK on successful

  • ESP_ERR_INVALID_ARG on wrong initialization

  • ESP_FAIL on error

Structures

struct esp_ble_dis_pnp

The structure represent a set of values that are used to create a device ID value. These values are used to identify all devices of a given type/model/version using numbers.

Public Members

uint8_t src

The vendor ID source

uint16_t vid

The product vendor from the namespace in the vendor ID source

uint16_t pid

Manufacturer managed identifier for this product

uint16_t ver

Manufacturer managed version for this product

struct esp_ble_dis_data

Structure holding data for the main characteristics

Public Members

char model_number[CONFIG_BLE_DIS_STR_MAX]

Model number. Represent the model number that is assigned by the device vendor.

char serial_number[CONFIG_BLE_DIS_STR_MAX]

Serial number. Represent the serial number for a particular instance of the device.

char firmware_revision[CONFIG_BLE_DIS_STR_MAX]

Firmware revision. Represent the firmware revision for the firmware within the device.

char hardware_revision[CONFIG_BLE_DIS_STR_MAX]

Hardware revision. Represent the hardware revision for the hardware within the device.

char software_revision[CONFIG_BLE_DIS_STR_MAX]

Software revision. Represent the software revision for the software within the device.

char manufacturer_name[CONFIG_BLE_DIS_STR_MAX]

Manufacturer name. Represent the name of the manufacturer of the device.

char system_id[CONFIG_BLE_DIS_STR_MAX]

System ID. Represent the System Id of the device.

esp_ble_dis_pnp_t pnp_id

PnP ID. Represent the PnP Id of the device.

Macros

BLE_DIS_UUID16
BLE_DIS_CHR_UUID16_SYSTEM_ID
BLE_DIS_CHR_UUID16_MODEL_NUMBER
BLE_DIS_CHR_UUID16_SERIAL_NUMBER
BLE_DIS_CHR_UUID16_FIRMWARE_REVISION
BLE_DIS_CHR_UUID16_HARDWARE_REVISION
BLE_DIS_CHR_UUID16_SOFTWARE_REVISION
BLE_DIS_CHR_UUID16_MANUFACTURER_NAME
BLE_DIS_CHR_UUID16_REG_CERT
BLE_DIS_CHR_UUID16_PNP_ID

Type Definitions

typedef struct esp_ble_dis_pnp esp_ble_dis_pnp_t

The structure represent a set of values that are used to create a device ID value. These values are used to identify all devices of a given type/model/version using numbers.

typedef struct esp_ble_dis_data esp_ble_dis_data_t

Structure holding data for the main characteristics