BLE_API v2.1.3

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

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

## Functions
BleStackStatus | setUDF01S_ServiceInit (uint8_t hostId, BleGattRole gattRole, BLEATT_UDF01S_Info *info, BleUDF01S_EventCallBack callback)
BleStackStatus | getUDF01S_ServiceHandles (uint8_t hostId, BLEATT_UDF01S_Info *info)
BleStackStatus | setUDF01S_ClientDataSend (uint8_t hostId, BleGattWrite writeType, uint16_t writeNumHdl, uint8_t *data, uint8_t length)
BleStackStatus | getUDF01S_ClientDataRead (uint8_t hostId, uint16_t hdlNum)
BleStackStatus | setUDF01S_ServerDataSend (uint8_t hostId, uint16_t cccd, uint16_t writeNumHdl, uint8_t *data, uint8_t length)

## Detailed Description

Here shows the definitions of the UDF01S service for application uses.

## Typedef Documentation

## ◆ BleUDF01S_EventCallBack

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

BleUDF01S_EventCallBack

Note
  This callback receives the UDF01 service events. Each of these events can be associated with parameters. *

## Function Documentation

## ◆ getUDF01S_ClientDataRead()

BleStackStatus getUDF01S_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.

## ◆ getUDF01S_ServiceHandles()

BleStackStatus getUDF01S_ServiceHandles | ( | uint8_t | hostId,
|  | BLEATT_UDF01S_Info * | info
| ) |  |

Get UDF01 Service 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.

Parameters

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

Return values

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

## ◆ setUDF01S_ClientDataSend()

BleStackStatus setUDF01S_ClientDataSend | ( | uint8_t | hostId,
|  | BleGattWrite | writeType,
|  | uint16_t | writeNumHdl,
|  | uint8_t * | data,
|  | uint8_t | length
| ) |  |

Send Data to Server (Client ONLY)

Parameters

  [in] | hostId | : the link's host id.
  [in] | writeType | : BLE GATT characteristic write type
  [in] | writeNumHdl | : handle number of write characteristic.
  [in] | data | : a pointer to data to send
  [in] | length | : length of the data

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.

## ◆ setUDF01S_ServerDataSend()

BleStackStatus setUDF01S_ServerDataSend | ( | uint8_t | hostId,
|  | uint16_t | cccd,
|  | uint16_t | writeNumHdl,
|  | uint8_t * | data,
|  | uint8_t | length
| ) |  |

Send Data to Client (Server ONLY)

Parameters

  [in] | hostId | : the link's host id.
  [in] | cccd | : BLE GATT characteristic cccd value to indicated notification or indication
  [in] | writeNumHdl | : handle number of write characteristic.
  [in] | data | : a pointer to data to send
  [in] | length | : length of the data

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.

## ◆ setUDF01S_ServiceInit()

BleStackStatus setUDF01S_ServiceInit | ( | uint8_t | hostId,
|  | BleGattRole | gattRole,
|  | BLEATT_UDF01S_Info * | info,
|  | BleUDF01S_EventCallBack | callback
| ) |  |

UDF01 Service Initialization

Parameters

  [in] | hostId | : the link's host id.
  [in] | gattRole | : BLE GATT role.
  [in] | info | : a pointer to UDF01S 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_ERR_NOT_SUPPORTED | : Registered services buffer full.
  BLESTACK_STATUS_SUCCESS | : Setting success.