BLE_API v2.1.3

Typedefs | Functions
BLE DIS Definitions for Application
BLE Services » BLE Defined-Services » BLE DIS Definitions » BLE DIS Application Definitions

## Typedefs
typedef void(* | BleDIS_EventCallBack) (uint8_t hostId, uint8_t cmdAccess, uint8_t *data, uint16_t length)

## Functions
BleStackStatus | setDIS_ServiceInit (uint8_t hostId, BleGattRole gattRole, BLEATT_DIS_Info *info, BleDIS_EventCallBack callback)
BleStackStatus | getDIS_ServiceHandles (uint8_t hostId, BLEATT_DIS_Info *info)
BleStackStatus | getDIS_ClientDataRead (uint8_t hostId, uint16_t hdlNum)

## Detailed Description

Here shows the definitions of the DIS for application uses.

## Typedef Documentation

## ◆ BleDIS_EventCallBack

typedef void(* BleDIS_EventCallBack) (uint8_t hostId, uint8_t cmdAccess, uint8_t *data, uint16_t length)

BleDIS_EventCallBack

Note
  This callback receives the DIS events. Each of these events can be associated with parameters.

## Function Documentation

## ◆ getDIS_ClientDataRead()

BleStackStatus getDIS_ClientDataRead | ( | uint8_t | hostId,
|  | uint16_t | hdlNum
| ) |  |

Get data from server by reading request (Client ONLY)

Parameters

  [in] | hostId | : the link's host id
  [in] | hdlNum | : handle number of the data you want to read.

Return values

  BLESTACK_STATUS_ERR_INVALID_HOSTID | : Error host id.
  BLESTACK_STATUS_ERR_INVALID_PARAM | : Invalid parameter.
  BLESTACK_STATUS_ERR_DB_PARSING_IN_PROGRESS | : parsing database process has NOT finished.
  BLESTACK_STATUS_ERR_INVALID_HANDLE | : Invalid attribute handle.
  BLESTACK_STATUS_ERR_BUSY | : Message queue buffer full.
  BLESTACK_STATUS_SUCCESS | : Setting success.

## ◆ getDIS_ServiceHandles()

BleStackStatus getDIS_ServiceHandles | ( | uint8_t | hostId,
|  | BLEATT_DIS_Info * | info
| ) |  |

Get DIS Handle Numbers

Attention
  - role = BLE_GATT_ROLE_CLIENT:
  MUST call this API to get service information after received BLECMD_EVENT_ATT_DATABASE_PARSING_FINISHED
  - role = BLE_GATT_ROLE_SERVER:
    MUST call this API to get service information before connection established.

BLE DIS Event
  Wait for BLE DIS event callback to get characteristic value.

Parameters

  [in] | hostId | : the link's host id.
  [out] | info | : a pointer to DIS information

Return values

  BLESTACK_STATUS_ERR_INVALID_HOSTID | : Error host id.
  BLESTACK_STATUS_ERR_INVALID_PARAM | : Invalid parameter.
  BLESTACK_STATUS_SUCCESS | : Setting success.

## ◆ setDIS_ServiceInit()

BleStackStatus setDIS_ServiceInit | ( | uint8_t | hostId,
|  | BleGattRole | gattRole,
|  | BLEATT_DIS_Info * | info,
|  | BleDIS_EventCallBack | callback
| ) |  |

Device Information Service (DIS) Initialization

Attention
  Due to there is only one instance of DIS shall be exposed on a device (if role is BLE_GATT_ROLE_SERVER).
  Callback shall be ignored if role is BLE_GATT_ROLE_SERVER).

Parameters

  [in] | hostId | : the link's host id.
  [in] | gattRole | : BLE GATT role.
  [in] | info | : a pointer to DIS information.
  [in] | callback | : a pointer to a callback function that receive the service events.

Return values

  BLESTACK_STATUS_ERR_INVALID_HOSTID | : Error host id.
  BLESTACK_STATUS_ERR_INVALID_PARAM | : Invalid parameter.
  BLESTACK_STATUS_SUCCESS | : Setting success.