43#ifndef __MODULES_INCLUDE_BLUETOOTH_BLE_GATT_H
44#define __MODULES_INCLUDE_BLUETOOTH_BLE_GATT_H
62#define BLE_MAX_SERVICES 1
69#define BLE_MAX_CHARACTERISTICS 1
76#define BLE_MAX_CHAR_SIZE 20
83#define BLE_GATT_INVALID_SERVICE_HANDLE UINT16_MAX
90#define BLE_GATT_INVALID_ATTRIBUTE_HANDLE (0x0000)
98#define BLE_DB_DISCOVERY_MAX_SRV 3
105#define BLE_DB_DISCOVERY_MAX_CHAR_PER_SRV 4
159 uint8_t uuid128[BT_UUID128_LEN];
427#define EXTERN extern "C"
552 uint16_t char_handle,
int ble_write_characteristic(uint16_t conn_handle, uint16_t char_handle, uint8_t *data, int len, bool rsp)
BLE Write Characteristic value Send write characteristic request to peripheral (For Central role)
int ble_characteristic_read(uint16_t conn_handle, struct ble_gatt_char_s *charc)
BLE Read Characteristic value (Deprecated) Send read characteristic request to peripheral (For Centra...
int ble_add_characteristic(struct ble_gatt_service_s *service, struct ble_gatt_char_s *charc)
BLE add Characteristic to service Add characteristic to service.
BLE_GATT_TYPE
GATTS service type.
Definition: ble_gatt.h:134
@ BLE_GATTS_SRVTYP_SECONDARY
Definition: ble_gatt.h:136
@ BLE_GATTS_SRVTYP_PRIMARY
Definition: ble_gatt.h:135
BLE_GATT_UUID_TYPE
GATTS UUID type.
Definition: ble_gatt.h:123
@ BLE_UUID_TYPE_BASEALIAS_BTSIG
Definition: ble_gatt.h:125
@ BLE_UUID_TYPE_BASEALIAS_VENDOR
Definition: ble_gatt.h:126
@ BLE_UUID_TYPE_UUID128
Definition: ble_gatt.h:124
int ble_register_servce(struct ble_gatt_service_s *service)
BLE Register GATT Service Register GATT Service to HAL.
int ble_set_vendor_uuid(BLE_UUID *uuid)
Set vendor specific UUID This API allows the vendor specific UUID to be discovered.
int ble_descriptor_read(uint16_t conn_handle, uint16_t handle)
BLE Read Descriptor value Send read descriptor request to peripheral (For Central role)
BLE_SEC_MODE
Definition: ble_gatt.h:144
@ BLE_SEC_MODE2LV2__MITM_DATA_SGN
Definition: ble_gatt.h:150
@ BLE_SEC_MODE_NO_ACCESS
Definition: ble_gatt.h:145
@ BLE_SEC_MODE1LV3_MITM_ENC
Definition: ble_gatt.h:148
@ BLE_SEC_MODE1LV2_NO_MITM_ENC
Definition: ble_gatt.h:147
@ BLE_SEC_MODE1LV1_NO_SEC
Definition: ble_gatt.h:146
@ BLE_SEC_MODE2LV1_NO_MITM_DATA_SGN
Definition: ble_gatt.h:149
int ble_characteristic_write(uint16_t conn_handle, struct ble_gatt_char_s *charc, uint8_t *data, int len)
BLE Write Characteristic value (Deprecated) Send write characteristic request to peripheral (For Cent...
int ble_create_service(struct ble_gatt_service_s **service)
BLE Create GATT Service Create GATT Service instance and return instance pointer via *service.
int ble_continue_db_discovery(uint16_t start_handle, uint16_t conn_handle)
BLE continue database discovery Send continue database discovery request to peripheral (For Central r...
bool ble_gatt_is_supported(void)
Get Bluetooth Low Ennergy GATT support or not support.
int ble_descriptor_write(uint16_t conn_handle, uint16_t handle, uint8_t *data, int len)
BLE Write Descriptor value Send write descriptor request to peripheral (For Central role)
int ble_read_characteristic(uint16_t conn_handle, uint16_t char_handle)
BLE Read Characteristic value Send read characteristic request to peripheral (For Central role)
int ble_start_db_discovery(uint16_t conn_handle)
BLE start database discovery Send database discovery request to peripheral (For Central role) In case...
int ble_discover_uuid(uint16_t conn_handle, BLE_UUID *srv_uuid, BLE_UUID *char_uuid)
Discover GATT database with specific UUID.
int ble_characteristic_notify(uint16_t conn_handle, struct ble_gatt_char_s *charc, uint8_t *data, int len)
BLE Notify Characteristic value Notify characteristic value to Central (For Peripheral role)
Bluetooth common header for SDK on Spresense.
Attribute permission structure.
Definition: ble_gatt.h:191
BLE_SEC_MODE readPerm
Definition: ble_gatt.h:192
BLE_SEC_MODE writePerm
Definition: ble_gatt.h:193
Characteristic standard properties.
Definition: ble_gatt.h:213
uint8_t indicate
Definition: ble_gatt.h:219
uint8_t write
Definition: ble_gatt.h:217
uint8_t broadcast
Definition: ble_gatt.h:214
uint8_t authSignedWr
Definition: ble_gatt.h:220
uint8_t notify
Definition: ble_gatt.h:218
uint8_t reserve
Definition: ble_gatt.h:221
uint8_t read
Definition: ble_gatt.h:215
uint8_t writeWoResp
Definition: ble_gatt.h:216
characteristic value attribute structure
Definition: ble_gatt.h:201
uint16_t length
Definition: ble_gatt.h:204
uint8_t * data
Definition: ble_gatt.h:203
BLE_ATTR_PERM attrPerm
Definition: ble_gatt.h:202
BLE security mode security level.
128-bit UUID structure for BLE
Definition: ble_gatt.h:158
UUID base + alias structure.
Definition: ble_gatt.h:167
uint16_t uuidAlias
Definition: ble_gatt.h:169
BLE_UUID128 uuidBase
Definition: ble_gatt.h:168
BLE UUID structure.
Definition: ble_gatt.h:177
BLE_GATT_UUID_TYPE type
Definition: ble_gatt.h:178
BLE_UUID128 uuid128
Definition: ble_gatt.h:181
BLE_UUID_ALIAS alias
Definition: ble_gatt.h:182
Bluetooth LE characteristic callbacks(for Central)
Definition: ble_gatt.h:397
void(* read)(uint16_t conn_handle, struct ble_gatt_char_s *ble_gatt_char)
Definition: ble_gatt.h:404
void(* write)(uint16_t conn_handle, struct ble_gatt_char_s *ble_gatt_char)
Definition: ble_gatt.h:400
void(* database_discovery)(struct ble_gatt_event_db_discovery_t *db_disc)
Definition: ble_gatt.h:412
void(* notify)(uint16_t conn_handle, struct ble_gatt_char_s *ble_gatt_char)
Definition: ble_gatt.h:408
void(* descriptor_write)(uint16_t conn_handle, uint16_t handle, int status)
Definition: ble_gatt.h:416
void(* descriptor_read)(uint16_t conn_handle, uint16_t handle, uint8_t *data, uint16_t len)
Definition: ble_gatt.h:420
Bluetooth LE GATT characteristic context.
Definition: ble_gatt.h:242
struct ble_gatt_central_ops_s * ble_gatt_central_ops
Definition: ble_gatt.h:250
BLE_CHAR_PROP property
Definition: ble_gatt.h:246
BLE_UUID uuid
Definition: ble_gatt.h:244
struct ble_gatt_peripheral_ops_s * ble_gatt_peripheral_ops
Definition: ble_gatt.h:251
BLE_CHAR_VALUE value
Definition: ble_gatt.h:245
uint8_t status
Definition: ble_gatt.h:247
uint16_t handle
Definition: ble_gatt.h:243
Definition: ble_gatt.h:367
uint16_t end_handle
Definition: ble_gatt.h:369
uint8_t srv_count
Definition: ble_gatt.h:368
GATTC attribute database discovery event structure.
Definition: ble_gatt.h:378
uint16_t conn_handle
Definition: ble_gatt.h:382
uint8_t result
Definition: ble_gatt.h:381
uint32_t reason
Definition: ble_gatt.h:385
union ble_gatt_event_db_discovery_t::@52 params
uint8_t group_id
Definition: ble_gatt.h:379
struct ble_gattc_db_discovery_s db_discovery
Definition: ble_gatt.h:386
struct ble_gatt_coverrun_state_s state
Definition: ble_gatt.h:383
uint8_t event_id
Definition: ble_gatt.h:380
Bluetooth LE characteristic callbacks(for Peripheral)
Definition: ble_gatt.h:231
void(* notify)(struct ble_gatt_char_s *ble_gatt_char, bool enable)
Definition: ble_gatt.h:234
void(* read)(struct ble_gatt_char_s *ble_gatt_char)
Definition: ble_gatt.h:233
void(* write)(struct ble_gatt_char_s *ble_gatt_char)
Definition: ble_gatt.h:232
Bluetooth LE GATT service context.
Definition: ble_gatt.h:260
BLE_UUID uuid
Definition: ble_gatt.h:262
BLE_GATT_TYPE type
Definition: ble_gatt.h:263
uint8_t num
Definition: ble_gatt.h:264
struct ble_gatt_char_s * chars[BLE_MAX_CHARACTERISTICS]
Definition: ble_gatt.h:265
uint16_t handle
Definition: ble_gatt.h:261
Bluetooth LE GATT context.
Definition: ble_gatt.h:273
struct ble_gatt_central_ops_s * ble_gatt_central_ops
Definition: ble_gatt.h:279
struct ble_state_s * ble_state
Definition: ble_gatt.h:274
struct ble_gatt_service_s services[BLE_MAX_SERVICES]
Definition: ble_gatt.h:277
struct ble_hal_gatt_ops_s * ble_hal_gatt_ops
Definition: ble_gatt.h:275
uint8_t num
Definition: ble_gatt.h:276
GATTC characteristic structure.
Definition: ble_gatt.h:297
BLE_CHAR_PROP char_prope
Definition: ble_gatt.h:298
BLE_UUID char_valuuid
Definition: ble_gatt.h:301
uint16_t char_declhandle
Definition: ble_gatt.h:300
uint16_t char_valhandle
Definition: ble_gatt.h:299
GATTC discovered characteristic data structure.
Definition: ble_gatt.h:309
uint16_t cpfd_handle
Definition: ble_gatt.h:328
uint16_t cccd_handle
Definition: ble_gatt.h:320
uint16_t cudd_handle
Definition: ble_gatt.h:316
uint16_t cepd_handle
Definition: ble_gatt.h:312
struct ble_gattc_char_s characteristic
Definition: ble_gatt.h:336
uint16_t cafd_handle
Definition: ble_gatt.h:332
uint16_t sccd_handle
Definition: ble_gatt.h:324
GATTC discovered service data structure.
Definition: ble_gatt.h:344
BLE_UUID srv_uuid
Definition: ble_gatt.h:348
struct ble_gattc_db_disc_char_s characteristics[BLE_DB_DISCOVERY_MAX_CHAR_PER_SRV]
Definition: ble_gatt.h:347
struct ble_gattc_handle_range_s srv_handle_range
Definition: ble_gatt.h:346
uint8_t char_count
Definition: ble_gatt.h:345
GATTC discovered attribute database data structure.
Definition: ble_gatt.h:356
uint16_t conn_handle
Definition: ble_gatt.h:358
struct ble_gattc_db_disc_srv_s services[BLE_DB_DISCOVERY_MAX_SRV]
Definition: ble_gatt.h:359
uint8_t srv_count
Definition: ble_gatt.h:357
GATTC handle range structure.
Definition: ble_gatt.h:287
uint16_t start_handle
Definition: ble_gatt.h:288
uint16_t end_handle
Definition: ble_gatt.h:289
Bluetooth LE GATT HAL.
Definition: bt_if.h:229
Bluetooth LE context.
Definition: bt_common.h:176