| Airoha M0 BLE API 1.0.5.4

ble_gatt_server.h
1 /******************************************************************************
2 Copyright (c) Airoha 2016 - All rights reserved
3
4 FILE NAME
5 ble_gatt_server.h
6 DESCRIPTION
7 NOTES
8 ********************************************************************************/
9 #ifndef _BLE_GATT_SERVER_H_
10 #define _BLE_GATT_SERVER_H_
11
21 #include <stdint.h>
22 #include <stddef.h>
23 #include <stdbool.h>
24 #include "ble_att.h"
25
26
30 typedef enum
31 {
32 primary_service = 0x2800,
33 secondary_service = 0x2801,
34 }service_type;
35
41 typedef enum
42 {
43 FORCE_LINK0 = 0,
44 FORCE_LINK1,
45 FORCE_LINK2,
46 FORCE_LINK3,
47 FORCE_LINK4,
48 FORCE_LINK5,
49 FORCE_LINK6,
50 FORCE_LINK7,
52 ALL_CCCD_ENABLED_LINK = 0x99,
53 }NOTIFY_INDICATE_LINK_SEL;
54
55
59 typedef enum
60 {
61 C_BCAST = 0x01,
62 C_READ = 0x02,
63 C_WRITE_NO_RSP = 0x04,
64 C_WRITE = 0x08,
65 C_NOTIFY = 0x10,
66 C_INDICATE = 0x20,
67 C_AUTHEN = 0x40,
68 C_EXTENDED = 0x80,
69 }CHAR_PROPERTY;
70
74 typedef struct
75 {
76 service_type type;
77 UUID_size size;
78 uint8_t UUID[16];
79 }gatt_add_service_para;
80
84 typedef struct
85 {
86 att_handle service_handle;
87 }gatt_add_include_para;
88
92 typedef struct
93 {
94 UUID_size size;
95 uint8_t UUID[16];
96 uint8_t property;
97 uint8_t permission;
98 uint16_t data_initial_length;
99 uint16_t data_maximum_length;
100 uint8_t * char_data;
101 ATTCB cb;
102 }gatt_add_charact_para;
103
107 typedef struct
108 {
109 UUID_size size;
110 uint8_t UUID[16];
111 uint8_t permission;
112 uint16_t data_initial_length;
113 uint16_t data_maximum_length;
114 uint8_t * desc_data;
115 ATTCB cb;
116 }gatt_add_descrip_para;
117
126 att_handle BLE_gatt_add_service(gatt_add_service_para * para);
127
136 att_handle BLE_gatt_add_include(gatt_add_include_para * para);
137
144 att_handle BLE_gatt_add_charact(gatt_add_charact_para * para);
145
152 att_handle BLE_gatt_add_descrip(gatt_add_descrip_para * para);
153
154
161 void BLE_gatt_charact_notify(att_handle char_handle, NOTIFY_INDICATE_LINK_SEL sel);
162
172 bool BLE_gatt_charact_indicate(att_handle char_handle, NOTIFY_INDICATE_LINK_SEL sel, INDI_CB cb);
173
177 #endif
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.
FORCE_LINK3
Definition: ble_gatt_server.h:46
gatt_add_descrip_para::permission
uint8_t permission
Definition: ble_gatt_server.h:111
gatt_add_charact_para::size
UUID_size size
Definition: ble_gatt_server.h:94
primary_service
Definition: ble_gatt_server.h:32
gatt_add_charact_para
API parameter for creating a GATT characteristic.
Definition: ble_gatt_server.h:92
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.
att_handle
uint16_t att_handle
attribute handle.
Definition: ble_att.h:52
FORCE_LINK4
Definition: ble_gatt_server.h:47
gatt_add_descrip_para::desc_data
uint8_t * desc_data
Definition: ble_gatt_server.h:114
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.
gatt_add_descrip_para::cb
ATTCB cb
Definition: ble_gatt_server.h:115
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).
gatt_add_charact_para::data_initial_length
uint16_t data_initial_length
Definition: ble_gatt_server.h:98
gatt_add_include_para::service_handle
att_handle service_handle
Definition: ble_gatt_server.h:86
ATTCB
void(* ATTCB)(ATT_CB_TYPE type, uint8_t linkindex, uint16_t handle)
attribute value accessed call back function.
Definition: ble_att.h:111
FORCE_LINK6
Definition: ble_gatt_server.h:49
gatt_add_descrip_para::size
UUID_size size
Definition: ble_gatt_server.h:109
gatt_add_service_para::type
service_type type
Definition: ble_gatt_server.h:76
gatt_add_charact_para::char_data
uint8_t * char_data
Definition: ble_gatt_server.h:100
gatt_add_charact_para::data_maximum_length
uint16_t data_maximum_length
Definition: ble_gatt_server.h:99
gatt_add_descrip_para
API parameter for creating a GATT characteristic descriptor.
Definition: ble_gatt_server.h:107
FORCE_LINK2
Definition: ble_gatt_server.h:45
gatt_add_service_para::size
UUID_size size
Definition: ble_gatt_server.h:77
gatt_add_charact_para::permission
uint8_t permission
Definition: ble_gatt_server.h:97
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).
gatt_add_service_para
API parameter for creating a GATT service.
Definition: ble_gatt_server.h:74
service_type
service_type
GATT service type.
Definition: ble_gatt_server.h:30
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.
ALL_CCCD_ENABLED_LINK
Definition: ble_gatt_server.h:52
FORCE_LINK1
Definition: ble_gatt_server.h:44
gatt_add_include_para
API parameter for including a GATT service in another.
Definition: ble_gatt_server.h:84
NOTIFY_INDICATE_LINK_SEL
NOTIFY_INDICATE_LINK_SEL
GATT Notification/Indication target link selection.
Definition: ble_gatt_server.h:41
gatt_add_charact_para::property
uint8_t property
Definition: ble_gatt_server.h:96
gatt_add_descrip_para::data_maximum_length
uint16_t data_maximum_length
Definition: ble_gatt_server.h:113
gatt_add_descrip_para::data_initial_length
uint16_t data_initial_length
Definition: ble_gatt_server.h:112
CHAR_PROPERTY
CHAR_PROPERTY
GATT characteristic Property.
Definition: ble_gatt_server.h:59
FORCE_LINK0
Definition: ble_gatt_server.h:43
secondary_service
Definition: ble_gatt_server.h:33
FORCE_LINK5
Definition: ble_gatt_server.h:48
INDI_CB
void(* INDI_CB)(uint8_t link_index)
characteristic value indication confirmed call back function.
Definition: ble_att.h:118
gatt_add_charact_para::cb
ATTCB cb
Definition: ble_gatt_server.h:101
UUID_size
UUID_size
UUID size in bytes.
Definition: ble_att.h:58
FORCE_LINK7
Definition: ble_gatt_server.h:50