| Airoha M0 BLE API 1.0.5.4

Data Structures | Enumerations | Functions
ble_gatt_server.h

## Data Structures
struct | gatt_add_service_para
| API parameter for creating a GATT service. More...
struct | gatt_add_include_para
| API parameter for including a GATT service in another. More...
struct | gatt_add_charact_para
| API parameter for creating a GATT characteristic. More...
struct | gatt_add_descrip_para
| API parameter for creating a GATT characteristic descriptor. More...

## Enumerations
enum | service_type { primary_service = 0x2800, secondary_service = 0x2801 }
| GATT service type. More...
enum | NOTIFY_INDICATE_LINK_SEL { FORCE_LINK0 = 0, FORCE_LINK1, FORCE_LINK2, FORCE_LINK3, FORCE_LINK4, FORCE_LINK5, FORCE_LINK6, FORCE_LINK7, ALL_CCCD_ENABLED_LINK = 0x99 }
| GATT Notification/Indication target link selection. More...
enum | CHAR_PROPERTY
| GATT characteristic Property.

## Functions
att_handle | BLE_gatt_add_service (gatt_add_service_para *para)
| API for adding a GATT Service declaration into the attribute server database. More...
att_handle | BLE_gatt_add_include (gatt_add_include_para *para)
| API for including another GATT Service in last added service. More...
att_handle | BLE_gatt_add_charact (gatt_add_charact_para *para)
| API for declaring a GATT Characteristic in last added service. More...
att_handle | BLE_gatt_add_descrip (gatt_add_descrip_para *para)
| API for declaring a GATT descriptor in last added characteristic. More...
void | BLE_gatt_charact_notify (att_handle char_handle, NOTIFY_INDICATE_LINK_SEL sel)
| API for sending a characteristic value notification to the selected target(s). More...
bool | BLE_gatt_charact_indicate (att_handle char_handle, NOTIFY_INDICATE_LINK_SEL sel, INDI_CB cb)
| API for sending a characteristic value indication to the selected target(s). More...

## Detailed Description

### ble_gatt_server.h

ble_gatt_server.h provides simple API for implementing GATT profiles as the server role. The hierarchical structure is directly decided by the order of API calling.

## Enumeration Type Documentation

## ◆ service_type

enum service_type

GATT service type.

Enumerator
primary_service | 0x2800
secondary_service | 0x2801

## ◆ NOTIFY_INDICATE_LINK_SEL

enum NOTIFY_INDICATE_LINK_SEL

GATT Notification/Indication target link selection.

CCCD stands for Client Characteristic Configuration Descriptor.

Enumerator
FORCE_LINK0 | Send to link0, ignore CCCD value
FORCE_LINK1 | Send to link1, ignore CCCD value
FORCE_LINK2 | Send to link2, ignore CCCD value
FORCE_LINK3 | Send to link3, ignore CCCD value
FORCE_LINK4 | Send to link4, ignore CCCD value
FORCE_LINK5 | Send to link5, ignore CCCD value
FORCE_LINK6 | Send to link6, ignore CCCD value
FORCE_LINK7 | Send to link7, ignore CCCD value
ALL_CCCD_ENABLED_LINK | Send to all links with valid CCCD value

## Function Documentation

## ◆ BLE_gatt_add_service()

att_handle BLE_gatt_add_service | ( | gatt_add_service_para * | para | ) |

API for adding a GATT Service declaration into the attribute server database.

Parameters

  para | gatt_add_service_para

Returns
  The attribute handle of service declaration within the attribute server database.

Attention
  Service declaration should always be the first attribute in the database.

## ◆ BLE_gatt_add_include()

att_handle BLE_gatt_add_include | ( | gatt_add_include_para * | para | ) |

API for including another GATT Service in last added service.

Parameters

  para | gatt_add_include_para

Returns
  The attribute handle of include declaration within the attribute server database.

Attention
  The included service should have smaller attribute handle to avoid circular including.

## ◆ BLE_gatt_add_charact()

att_handle BLE_gatt_add_charact | ( | gatt_add_charact_para * | para | ) |

API for declaring a GATT Characteristic in last added service.

Parameters

  para | gatt_add_charact_para

Returns
  The attribute handle of characteristic value within the attribute server database.

## ◆ BLE_gatt_add_descrip()

att_handle BLE_gatt_add_descrip | ( | gatt_add_descrip_para * | para | ) |

API for declaring a GATT descriptor in last added characteristic.

Parameters

  para | gatt_add_charact_para

Returns
  The attribute handle of descriptor within the attribute server database.

## ◆ BLE_gatt_charact_notify()

void BLE_gatt_charact_notify | ( | att_handle | char_handle,
|  | NOTIFY_INDICATE_LINK_SEL | sel
| ) |  |

API for sending a characteristic value notification to the selected target(s).

Parameters

  char_handle | attribute handle of characteristic value.
  sel | NOTIFY_INDICATE_LINK_SEL

## ◆ BLE_gatt_charact_indicate()

bool BLE_gatt_charact_indicate | ( | att_handle | char_handle,
|  | NOTIFY_INDICATE_LINK_SEL | sel,
|  | INDI_CB | cb
| ) |  |

API for sending a characteristic value indication to the selected target(s).

Parameters

  char_handle | attribute handle of characteristic value.
  sel | NOTIFY_INDICATE_LINK_SEL
  cb | INDI_CB

Returns
  0: indication successfully sent.
  1: failed to send indication, previous transaction not finished yet.