52#include "ble_ranges.h"
119#define BLE_ERROR_GATTS_INVALID_ATTR_TYPE (NRF_GATTS_ERR_BASE + 0x000)
120#define BLE_ERROR_GATTS_SYS_ATTR_MISSING (NRF_GATTS_ERR_BASE + 0x001)
125#define BLE_GATTS_FIX_ATTR_LEN_MAX (510)
126#define BLE_GATTS_VAR_ATTR_LEN_MAX (512)
131#define BLE_GATTS_SRVC_TYPE_INVALID 0x00
132#define BLE_GATTS_SRVC_TYPE_PRIMARY 0x01
133#define BLE_GATTS_SRVC_TYPE_SECONDARY 0x02
139#define BLE_GATTS_ATTR_TYPE_INVALID 0x00
140#define BLE_GATTS_ATTR_TYPE_PRIM_SRVC_DECL 0x01
141#define BLE_GATTS_ATTR_TYPE_SEC_SRVC_DECL 0x02
142#define BLE_GATTS_ATTR_TYPE_INC_DECL 0x03
143#define BLE_GATTS_ATTR_TYPE_CHAR_DECL 0x04
144#define BLE_GATTS_ATTR_TYPE_CHAR_VAL 0x05
145#define BLE_GATTS_ATTR_TYPE_DESC 0x06
146#define BLE_GATTS_ATTR_TYPE_OTHER 0x07
152#define BLE_GATTS_OP_INVALID 0x00
153#define BLE_GATTS_OP_WRITE_REQ 0x01
154#define BLE_GATTS_OP_WRITE_CMD 0x02
155#define BLE_GATTS_OP_PREP_WRITE_REQ 0x04
156#define BLE_GATTS_OP_EXEC_WRITE_REQ_CANCEL 0x05
157#define BLE_GATTS_OP_EXEC_WRITE_REQ_NOW 0x06
162#define BLE_GATTS_VLOC_INVALID 0x00
163#define BLE_GATTS_VLOC_STACK 0x01
164#define BLE_GATTS_VLOC_USER 0x02
170#define BLE_GATTS_AUTHORIZE_TYPE_INVALID 0x00
171#define BLE_GATTS_AUTHORIZE_TYPE_READ 0x01
172#define BLE_GATTS_AUTHORIZE_TYPE_WRITE 0x02
177#define BLE_GATTS_SYS_ATTR_FLAG_SYS_SRVCS (1 << 0)
178#define BLE_GATTS_SYS_ATTR_FLAG_USR_SRVCS (1 << 1)
184#define BLE_GATTS_SERVICE_CHANGED_DEFAULT (1)
190#define BLE_GATTS_ATTR_TAB_SIZE_MIN (248)
191#define BLE_GATTS_ATTR_TAB_SIZE_DEFAULT (1408)
197#define BLE_GATTS_HVN_TX_QUEUE_SIZE_DEFAULT 1
BLE_GATTS_CFGS
GATTS Configuration IDs.
Definition ble_gatts.h:106
@ BLE_GATTS_CFG_ATTR_TAB_SIZE
Definition ble_gatts.h:109
@ BLE_GATTS_CFG_SERVICE_CHANGED_CCCD_PERM
Definition ble_gatts.h:108
@ BLE_GATTS_CFG_SERVICE_CHANGED
Definition ble_gatts.h:107
BLE_GATTS_SVCS
GATTS API SVC numbers.
Definition ble_gatts.h:69
@ SD_BLE_GATTS_INITIAL_USER_HANDLE_GET
Definition ble_gatts.h:81
@ SD_BLE_GATTS_ATTR_GET
Definition ble_gatts.h:82
@ SD_BLE_GATTS_VALUE_GET
Definition ble_gatts.h:75
@ SD_BLE_GATTS_CHARACTERISTIC_ADD
Definition ble_gatts.h:72
@ SD_BLE_GATTS_SERVICE_CHANGED
Definition ble_gatts.h:77
@ SD_BLE_GATTS_RW_AUTHORIZE_REPLY
Definition ble_gatts.h:78
@ SD_BLE_GATTS_INCLUDE_ADD
Definition ble_gatts.h:71
@ SD_BLE_GATTS_HVX
Definition ble_gatts.h:76
@ SD_BLE_GATTS_VALUE_SET
Definition ble_gatts.h:74
@ SD_BLE_GATTS_SERVICE_ADD
Definition ble_gatts.h:70
@ SD_BLE_GATTS_SYS_ATTR_SET
Definition ble_gatts.h:79
@ SD_BLE_GATTS_SYS_ATTR_GET
Definition ble_gatts.h:80
@ SD_BLE_GATTS_EXCHANGE_MTU_REPLY
Definition ble_gatts.h:83
@ SD_BLE_GATTS_DESCRIPTOR_ADD
Definition ble_gatts.h:73
BLE_GATTS_EVTS
GATT Server Event IDs.
Definition ble_gatts.h:90
@ BLE_GATTS_EVT_SC_CONFIRM
Definition ble_gatts.h:95
@ BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST
Definition ble_gatts.h:92
@ BLE_GATTS_EVT_TIMEOUT
Definition ble_gatts.h:97
@ BLE_GATTS_EVT_EXCHANGE_MTU_REQUEST
Definition ble_gatts.h:96
@ BLE_GATTS_EVT_WRITE
Definition ble_gatts.h:91
@ BLE_GATTS_EVT_SYS_ATTR_MISSING
Definition ble_gatts.h:93
@ BLE_GATTS_EVT_HVC
Definition ble_gatts.h:94
@ BLE_GATTS_EVT_HVN_TX_COMPLETE
Definition ble_gatts.h:98
uint32_t sd_ble_gatts_descriptor_add(uint16_t char_handle, ble_gatts_attr_t const *p_attr, uint16_t *p_handle)
Add a descriptor to the Attribute Table.
uint32_t sd_ble_gatts_value_set(uint16_t conn_handle, uint16_t handle, ble_gatts_value_t *p_value)
Set the value of a given attribute.
uint32_t sd_ble_gatts_service_changed(uint16_t conn_handle, uint16_t start_handle, uint16_t end_handle)
Indicate the Service Changed attribute value.
uint32_t sd_ble_gatts_hvx(uint16_t conn_handle, ble_gatts_hvx_params_t const *p_hvx_params)
Notify or Indicate an attribute value.
uint32_t sd_ble_gatts_service_add(uint8_t type, ble_uuid_t const *p_uuid, uint16_t *p_handle)
Add a service declaration to the Attribute Table.
uint32_t sd_ble_gatts_attr_get(uint16_t handle, ble_uuid_t *p_uuid, ble_gatts_attr_md_t *p_md)
Retrieve the attribute UUID and/or metadata.
uint32_t sd_ble_gatts_sys_attr_get(uint16_t conn_handle, uint8_t *p_sys_attr_data, uint16_t *p_len, uint32_t flags)
Retrieve persistent system attribute information from the stack.
uint32_t sd_ble_gatts_sys_attr_set(uint16_t conn_handle, uint8_t const *p_sys_attr_data, uint16_t len, uint32_t flags)
Update persistent system attribute information.
uint32_t sd_ble_gatts_include_add(uint16_t service_handle, uint16_t inc_srvc_handle, uint16_t *p_include_handle)
Add an include declaration to the Attribute Table.
uint32_t sd_ble_gatts_rw_authorize_reply(uint16_t conn_handle, ble_gatts_rw_authorize_reply_params_t const *p_rw_authorize_reply_params)
Respond to a Read/Write authorization request.
uint32_t sd_ble_gatts_characteristic_add(uint16_t service_handle, ble_gatts_char_md_t const *p_char_md, ble_gatts_attr_t const *p_attr_char_value, ble_gatts_char_handles_t *p_handles)
Add a characteristic declaration, a characteristic value declaration and optional characteristic desc...
uint32_t sd_ble_gatts_initial_user_handle_get(uint16_t *p_handle)
Retrieve the first valid user attribute handle.
uint32_t sd_ble_gatts_exchange_mtu_reply(uint16_t conn_handle, uint16_t server_rx_mtu)
Reply to an ATT_MTU exchange request by sending an Exchange MTU Response to the client.
uint32_t sd_ble_gatts_value_get(uint16_t conn_handle, uint16_t handle, ble_gatts_value_t *p_value)
Get the value of a given attribute.
#define BLE_GATTS_EVT_BASE
Definition ble_ranges.h:91
#define BLE_GATTS_SVC_BASE
Definition ble_ranges.h:75
#define BLE_GATTS_CFG_BASE
Definition ble_ranges.h:132
GAP connection security modes.
Definition ble_gap.h:635
GATT Characteristic Extended Properties.
Definition ble_gatt.h:215
GATT Characteristic Properties.
Definition ble_gatt.h:202
uint8_t rd_auth
Definition ble_gatts.h:221
ble_gap_conn_sec_mode_t read_perm
Definition ble_gatts.h:217
uint8_t vlen
Definition ble_gatts.h:219
uint8_t vloc
Definition ble_gatts.h:220
ble_gap_conn_sec_mode_t write_perm
Definition ble_gatts.h:218
uint8_t wr_auth
Definition ble_gatts.h:222
Attribute metadata.
Definition ble_gatts.h:216
ble_uuid_t const * p_uuid
Definition ble_gatts.h:229
ble_gatts_attr_md_t const * p_attr_md
Definition ble_gatts.h:230
uint16_t max_len
Definition ble_gatts.h:233
uint16_t init_len
Definition ble_gatts.h:231
uint16_t init_offs
Definition ble_gatts.h:232
uint8_t * p_value
Definition ble_gatts.h:234
GATT Attribute.
Definition ble_gatts.h:228
uint16_t gatt_status
Definition ble_gatts.h:299
uint8_t update
Definition ble_gatts.h:300
uint8_t const * p_data
Definition ble_gatts.h:305
uint16_t offset
Definition ble_gatts.h:303
uint16_t len
Definition ble_gatts.h:304
GATT Authorization parameters.
Definition ble_gatts.h:298
uint32_t attr_tab_size
Definition ble_gatts.h:348
Attribute table size configuration parameters, set with sd_ble_cfg_set.
Definition ble_gatts.h:347
ble_gatts_attr_md_t perm
Definition ble_gatts.h:336
Service Changed CCCD permission configuration parameters, set with sd_ble_cfg_set.
Definition ble_gatts.h:335
uint8_t service_changed
Definition ble_gatts.h:321
Service Changed Inclusion configuration parameters, set with sd_ble_cfg_set.
Definition ble_gatts.h:320
uint16_t sccd_handle
Definition ble_gatts.h:282
uint16_t user_desc_handle
Definition ble_gatts.h:280
uint16_t value_handle
Definition ble_gatts.h:279
uint16_t cccd_handle
Definition ble_gatts.h:281
GATT Characteristic Definition Handles.
Definition ble_gatts.h:278
ble_gatts_attr_md_t const * p_user_desc_md
Definition ble_gatts.h:270
uint16_t char_user_desc_size
Definition ble_gatts.h:268
ble_gatt_char_props_t char_props
Definition ble_gatts.h:264
ble_gatts_attr_md_t const * p_cccd_md
Definition ble_gatts.h:271
uint16_t char_user_desc_max_size
Definition ble_gatts.h:267
ble_gatts_char_pf_t const * p_char_pf
Definition ble_gatts.h:269
uint8_t const * p_char_user_desc
Definition ble_gatts.h:266
ble_gatt_char_ext_props_t char_ext_props
Definition ble_gatts.h:265
ble_gatts_attr_md_t const * p_sccd_md
Definition ble_gatts.h:272
GATT Characteristic metadata.
Definition ble_gatts.h:263
uint8_t name_space
Definition ble_gatts.h:256
uint16_t desc
Definition ble_gatts.h:257
int8_t exponent
Definition ble_gatts.h:254
uint8_t format
Definition ble_gatts.h:253
uint16_t unit
Definition ble_gatts.h:255
GATT Characteristic Presentation Format.
Definition ble_gatts.h:252
uint8_t hvn_tx_queue_size
Definition ble_gatts.h:210
BLE GATTS connection configuration parameters, set with sd_ble_cfg_set.
Definition ble_gatts.h:209
uint16_t client_rx_mtu
Definition ble_gatts.h:407
Event structure for BLE_GATTS_EVT_EXCHANGE_MTU_REQUEST.
Definition ble_gatts.h:406
uint16_t handle
Definition ble_gatts.h:401
Event structure for BLE_GATTS_EVT_HVC.
Definition ble_gatts.h:400
uint8_t count
Definition ble_gatts.h:419
Event structure for BLE_GATTS_EVT_HVN_TX_COMPLETE.
Definition ble_gatts.h:418
ble_uuid_t uuid
Definition ble_gatts.h:377
uint16_t handle
Definition ble_gatts.h:376
uint16_t offset
Definition ble_gatts.h:378
Event substructure for authorized read requests, see ble_gatts_evt_rw_authorize_request_t.
Definition ble_gatts.h:375
uint8_t type
Definition ble_gatts.h:384
ble_gatts_evt_read_t read
Definition ble_gatts.h:386
ble_gatts_evt_write_t write
Definition ble_gatts.h:387
Event structure for BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST.
Definition ble_gatts.h:383
uint8_t hint
Definition ble_gatts.h:394
Event structure for BLE_GATTS_EVT_SYS_ATTR_MISSING.
Definition ble_gatts.h:393
ble_gatts_evt_rw_authorize_request_t authorize_request
Definition ble_gatts.h:429
ble_gatts_evt_exchange_mtu_request_t exchange_mtu_request
Definition ble_gatts.h:432
ble_gatts_evt_hvn_tx_complete_t hvn_tx_complete
Definition ble_gatts.h:434
ble_gatts_evt_timeout_t timeout
Definition ble_gatts.h:433
ble_gatts_evt_hvc_t hvc
Definition ble_gatts.h:431
ble_gatts_evt_write_t write
Definition ble_gatts.h:428
ble_gatts_evt_sys_attr_missing_t sys_attr_missing
Definition ble_gatts.h:430
uint16_t conn_handle
Definition ble_gatts.h:425
GATTS event structure.
Definition ble_gatts.h:424
uint8_t src
Definition ble_gatts.h:413
Event structure for BLE_GATTS_EVT_TIMEOUT.
Definition ble_gatts.h:412
uint8_t op
Definition ble_gatts.h:365
uint16_t len
Definition ble_gatts.h:368
ble_uuid_t uuid
Definition ble_gatts.h:364
uint8_t auth_required
Definition ble_gatts.h:366
uint16_t handle
Definition ble_gatts.h:363
uint16_t offset
Definition ble_gatts.h:367
Event structure for BLE_GATTS_EVT_WRITE.
Definition ble_gatts.h:362
uint16_t offset
Definition ble_gatts.h:291
uint16_t handle
Definition ble_gatts.h:289
uint8_t type
Definition ble_gatts.h:290
uint16_t * p_len
Definition ble_gatts.h:292
uint8_t const * p_data
Definition ble_gatts.h:293
GATT HVx parameters.
Definition ble_gatts.h:288
ble_gatts_authorize_params_t read
Definition ble_gatts.h:313
uint8_t type
Definition ble_gatts.h:311
ble_gatts_authorize_params_t write
Definition ble_gatts.h:314
GATT Read or Write Authorize Reply parameters.
Definition ble_gatts.h:310
uint8_t * p_value
Definition ble_gatts.h:244
uint16_t offset
Definition ble_gatts.h:243
uint16_t len
Definition ble_gatts.h:242
GATT Attribute Value.
Definition ble_gatts.h:241
Bluetooth Low Energy UUID type, encapsulates both 16-bit and 128-bit UUIDs.
Definition ble_types.h:193
ble_gatts_cfg_service_changed_cccd_perm_t service_changed_cccd_perm
Definition ble_gatts.h:355
ble_gatts_cfg_attr_tab_size_t attr_tab_size
Definition ble_gatts.h:356
ble_gatts_cfg_service_changed_t service_changed
Definition ble_gatts.h:354
Config structure for GATTS configurations.
Definition ble_gatts.h:353