Go to the documentation of this file.
56 #ifndef __BLE_GATTS_H__
57 #define __BLE_GATTS_H__
71 #define BLE_GATTS_MAX_INC_SRVC_NUM (5)
76 #define BLE_GATTS_BROADCAST (0x01)
77 #define BLE_GATTS_READ (0x02)
78 #define BLE_GATTS_WRITE_CMD (0x04)
79 #define BLE_GATTS_WRITE_REQ (0x08)
80 #define BLE_GATTS_NOTIFY (0x10)
81 #define BLE_GATTS_INDICATE (0x20)
82 #define BLE_GATTS_WRITE_SIGNED (0x40)
83 #define BLE_GATTS_EXT_PROP (0x80)
88 #define BLE_GATTS_READ_POS (0x00)
89 #define BLE_GATTS_WRITE_POS (0x02)
90 #define BLE_GATTS_INDICATE_POS (0x04)
91 #define BLE_GATTS_NOTIFY_POS (0x06)
97 #define BLE_GATTS_NOAUTH (0x00)
99 #define BLE_GATTS_UNAUTH (0x01)
101 #define BLE_GATTS_AUTH (0x02)
103 #define BLE_GATTS_SEC_CON (0x03)
109 #define BLE_GATTS_SEC_LEVEL_MASK (0x03)
115 #define BLE_GATTS_UUID_TYPE_16 (0x00)
116 #define BLE_GATTS_UUID_TYPE_128 (0x02)
136 #define BLE_GATTS_SRVC_SECONDARY_SET (0x80)
137 #define BLE_GATTS_SRVC_UUID_TYPE_SET(uuid_len) ((uuid_len) << 5)
138 #define BLE_GATTS_SRVC_DISABLE (0x10)
139 #define BLE_GATTS_SRVC_PERM(sec_level) (((sec_level) & SEC_LEVEL_MASK) << 2)
140 #define BLE_GATTS_SRVC_ENCRP_KEY_SIZE_16 (0x02)
141 #define BLE_GATTS_SRVC_MULTI_ENABLE (0x01)
168 #define BLE_GATTS_READ_PERM_UNSEC (BLE_GATTS_READ << 8)
169 #define BLE_GATTS_READ_PERM(sec_level) (BLE_GATTS_READ << 8 | (((sec_level) & BLE_GATTS_SEC_LEVEL_MASK) << BLE_GATTS_READ_POS))
170 #define BLE_GATTS_WRITE_REQ_PERM_UNSEC (BLE_GATTS_WRITE_REQ << 8)
171 #define BLE_GATTS_WRITE_REQ_PERM(sec_level) (BLE_GATTS_WRITE_REQ << 8 | (((sec_level) & BLE_GATTS_SEC_LEVEL_MASK) << BLE_GATTS_WRITE_POS))
172 #define BLE_GATTS_WRITE_CMD_PERM_UNSEC (BLE_GATTS_WRITE_CMD << 8)
173 #define BLE_GATTS_WRITE_CMD_PERM(sec_level) (BLE_GATTS_WRITE_CMD << 8 | (((sec_level) & BLE_GATTS_SEC_LEVEL_MASK) << BLE_GATTS_WRITE_POS))
174 #define BLE_GATTS_WRITE_SIGNED_PERM_UNSEC (BLE_GATTS_WRITE_SIGNED << 8)
175 #define BLE_GATTS_WRITE_SIGNED_PERM(sec_level) (BLE_GATTS_WRITE_SIGNED << 8 | (((sec_level) & BLE_GATTS_SEC_LEVEL_MASK) << BLE_GATTS_WRITE_POS))
176 #define BLE_GATTS_INDICATE_PERM_UNSEC (BLE_GATTS_INDICATE << 8)
177 #define BLE_GATTS_INDICATE_PERM(sec_level) (BLE_GATTS_INDICATE << 8 | (((sec_level) & BLE_GATTS_SEC_LEVEL_MASK) << BLE_GATTS_INDICATE_POS))
178 #define BLE_GATTS_NOTIFY_PERM_UNSEC (BLE_GATTS_NOTIFY << 8)
179 #define BLE_GATTS_NOTIFY_PERM(sec_level) (BLE_GATTS_NOTIFY << 8 | (((sec_level) & BLE_GATTS_SEC_LEVEL_MASK) << BLE_GATTS_NOTIFY_POS))
180 #define BLE_GATTS_BROADCAST_ENABLE (BLE_GATTS_BROADCAST << 8)
181 #define BLE_GATTS_EXT_PROP_ENABLE (BLE_GATTS_EXT_PROP << 8)
199 #define BLE_GATTS_ATT_VAL_LOC_USER (1 << 15)
200 #define BLE_GATTS_ATT_VAL_LOC_STACK (0 << 15)
201 #define BLE_GATTS_ATT_UUID_TYPE_SET(uuid_len) ((uuid_len) << 13)
202 #define BLE_GATTS_ATT_ENC_KEY_SIZE_16 (0x1000)
630 #endif // BLE_SDK_GATTS_H_
const ble_gatts_attm_desc_128_t * attr_tab_128
128 bits service description.
uint16_t max_size
Attribute max size.
uint8_t srvc_perm
Service permission.
uint16_t start_hdl
Start handle of database inited.
uint16_t max_size
Attribute max size.
GATT read request event for BLE_GATTS_EVT_READ_REQUEST.
The struct of broadcast address with broadcast type.
uint8_t status
Status of write operation by upper layers.
uint16_t handle
Handle of the read attribute.
uint8_t * value
Data to be written to characteristic value.
GATT write attribute result description.
uint16_t offset
Offset at which the data has to be written.
Parameter of Added service description.
@ BLE_GATTS_SERVICE_TABLE_TYPE_16
16-bit service table type.
Service(16-bit UUID) description.
uint16_t ble_gatts_service_hide_all(uint8_t conn_idx)
Hide all service.
uint16_t cccd_val
CCCD value.
GATT sending Notification or Indication event param description.
ble_gatt_evt_type_t type
Notification or indication event type.
ble_gap_bdaddr_t peer_addr
Pointer to peer address.
GATT prepare write request event for BLE_GATTS_EVT_PREP_WRITE_REQUEST.
@ BLE_GATTS_SERVICE_TABLE_TYPE_128
128-bit service table type.
uint16_t ble_gatts_attr_permission_set(uint16_t handle, uint16_t perm, uint16_t ext_perm)
Update attribute permission.
uint8_t * value
Characteristic Value pointer.
uint8_t index
Index of connection.
uint16_t uuid
16-bit LSB-first UUID
ble_gatt_evt_type_t type
Request type (Notification/Indication).
ble_gatts_evt_inited_ind_t inited_ind
Gatt database inited indication send event.
const uint8_t * uuid
Service UUID pointer.
ble_gatts_service_type_t
Service table type.
uint16_t handle
Handle of the attribute to be written.
uint16_t ble_gatts_value_set(uint16_t handle, uint16_t length, uint16_t offset, const uint8_t *p_value)
Update attribute value only if the attribute value is saved in the BLE Stack space.
uint16_t end_hdl
End handle of database inited.
File that contains error codes.
ble_gatts_evt_read_t read_req
Read request event.
ble_gatts_evt_write_t write_req
Write request event.
const ble_gatts_attm_desc_t * attr_tab_16
16 bits service description.
ble_gatts_service_type_t attr_tab_type
Service table type.
uint8_t max_nb_attr
Number of attributes in attribute table.
uint16_t handle
Characteristic Value handle to be notified or indicated.
uint16_t perm
Attribute permissions, see Attribute Permission.
uint16_t handle
Handle of attribute.
uint16_t ble_gatts_write_cfm(uint8_t conn_idx, const ble_gatts_write_cfm_t *p_param)
Respond to an attribute write request.
uint16_t handle
Handle of the attribute in prepare write operation.
uint16_t * shdl
Service start handle pointer.
ble_gatts_evt_cccd_rec_t cccd_recovery
Gatt cccd recovery event .
uint16_t length
Length of read data.
uint16_t handle
Handle of the attribute written.
uint16_t handle
Handle of the write operation, or notification/indication operation.
ble_gatt_evt_type_t
GATT common events.
uint16_t ble_gatts_srvc_db_create(ble_gatts_create_db_t *p_param)
Register a service's attribute list.
uint8_t status
Status of prepare write operation by upper layers.
uint16_t ble_gatts_prepare_write_cfm(uint8_t conn_idx, const ble_gatts_prep_write_cfm_t *p_param)
Respond to an attribute prepare write request.
uint16_t ble_gatts_attr_permission_get(uint16_t handle, uint16_t *p_perm, uint16_t *p_ext_perm)
Retrieve attribute permission.
uint8_t status
Status of read operation by upper layers.
BLE GATTS event structure.
GATT write request event for BLE_GATTS_EVT_WRITE_REQUEST.
uint16_t inc_srvc_num
Included Service number for this service.
uint16_t handle
Handle of the attribute for whose value is requested.
uint16_t length
Current length of the attribute.
#define BLE_GATTS_MAX_INC_SRVC_NUM
The max number of Included Services a Primary/Secondary service can have.
uint16_t ble_gatts_service_discoverable_set(uint8_t conn_idx, uint16_t start_hdl, bool discoverable)
Set a service discoverable or not.
uint8_t * attr_tab_cfg
Attribute table selector pointer.
ble_gatts_evt_ntf_ind_t ntf_ind_sended
Notification or indication sened event.
uint16_t ble_gatts_value_get(uint16_t handle, uint16_t *p_length, uint8_t *p_value)
Retrieve attribute value only if the attribute value is saved in the BLE Stack space.
uint16_t handle
Handle of the attribute to be read.
GATT prepare write result description.
uint16_t perm
Attribute permissions, see Attribute Permission.
uint16_t length
Length of Characteristic Value to be sent.
void ble_gatts_service_changed(void)
When service on local device finishes upgrade, call this API to send service upgrade to stack.
ble_gatts_evt_prep_write_t prep_wr_req
Prepare write request event.
uint8_t * value
Attribute value pointer.
GATTS Database Inited Indication event structure.
uint16_t ble_gatts_service_discover_all(uint8_t conn_idx)
Set all service discoverable.
uint16_t length
Data length to be written.
uint16_t ext_perm
Attribute extended permissions, see Attribute Extend Permission.
GATT read attribute result description.
uint16_t ext_perm
Attribute extended permissions, see Attribute Extend Permission.
uint16_t ble_gatts_noti_ind(uint8_t conn_idx, const ble_gatts_noti_ind_t *p_param)
Send out a notification or an indication.
Service(128 bits UUID) description.
Gatt Notification or indication event for BLE_GATTS_EVT_NTF_IND.
uint16_t ble_gatts_read_cfm(uint8_t conn_idx, const ble_gatts_read_cfm_t *p_param)
Respond to an attribute read request.
Gatt cccd recovery event for BLE_GATTS_EVT_CCCD_RECOVERY.