Go to the documentation of this file.
56 #ifndef __BLE_GATTS_H__
57 #define __BLE_GATTS_H__
70 #define MAX_INC_SRVC_NUM (5)
75 #define BROADCAST (0x01)
77 #define WRITE_CMD (0x04)
78 #define WRITE_REQ (0x08)
80 #define INDICATE (0x20)
81 #define WRITE_SIGNED (0x40)
82 #define EXT_PROP (0x80)
87 #define READ_POS (0x00)
88 #define WRITE_POS (0x02)
89 #define INDICATE_POS (0x04)
90 #define NOTIFY_POS (0x06)
102 #define SEC_CON (0x03)
108 #define SEC_LEVEL_MASK (0x03)
114 #define UUID_TYPE_16 (0x00)
115 #define UUID_TYPE_128 (0x02)
135 #define SRVC_SECONDARY_SET (0x80)
136 #define SRVC_UUID_TYPE_SET(uuid_len) ((uuid_len) << 5)
137 #define SRVC_DISABLE (0x10)
138 #define SRVC_PERM(sec_level) (((sec_level) & SEC_LEVEL_MASK) << 2)
139 #define SRVC_ENCRP_KEY_SIZE_16 (0x02)
140 #define SRVC_MULTI_ENABLE (0x01)
167 #define READ_PERM_UNSEC (READ << 8)
168 #define READ_PERM(sec_level) (READ << 8 | (((sec_level) & SEC_LEVEL_MASK) << READ_POS))
170 #define WRITE_REQ_PERM_UNSEC (WRITE_REQ << 8)
171 #define WRITE_REQ_PERM(sec_level) (WRITE_REQ << 8 | (((sec_level) & SEC_LEVEL_MASK) << WRITE_POS))
173 #define WRITE_CMD_PERM_UNSEC (WRITE_CMD << 8)
174 #define WRITE_CMD_PERM(sec_level) (WRITE_CMD << 8 | (((sec_level) & SEC_LEVEL_MASK) << WRITE_POS))
176 #define WRITE_SIGNED_PERM_UNSEC (WRITE_SIGNED << 8)
177 #define WRITE_SIGNED_PERM(sec_level) (WRITE_SIGNED << 8 | (((sec_level) & SEC_LEVEL_MASK) << WRITE_POS))
179 #define INDICATE_PERM_UNSEC (INDICATE << 8)
180 #define INDICATE_PERM(sec_level) (INDICATE << 8 | (((sec_level) & SEC_LEVEL_MASK) << INDICATE_POS))
182 #define NOTIFY_PERM_UNSEC (NOTIFY << 8)
183 #define NOTIFY_PERM(sec_level) (NOTIFY << 8 | (((sec_level) & SEC_LEVEL_MASK) << NOTIFY_POS))
185 #define BROADCAST_ENABLE (BROADCAST << 8)
186 #define EXT_PROP_ENABLE (EXT_PROP << 8)
204 #define ATT_VAL_LOC_USER (1 << 15)
205 #define ATT_VAL_LOC_STACK (0 << 15)
206 #define ATT_UUID_TYPE_SET(uuid_len) ((uuid_len) << 13)
207 #define ATT_ENC_KEY_SIZE_16 (0x1000)
533 #endif // BLE_SDK_GATTS_H_
gatts_service_type_t
Service table type.
uint16_t length
Length of read data.
Service(16-bit UUID) description.
@ SERVICE_TABLE_TYPE_16
16-bit service table type.
@ SERVICE_TABLE_TYPE_128
128-bit service table type.
uint16_t length
Length of Characteristic Value to be sent.
uint16_t ble_gatts_read_cfm(uint8_t conn_idx, const gatts_read_cfm_t *p_param)
Respond to an attribute read request.
uint16_t ble_gatts_prepare_write_cfm(uint8_t conn_idx, const gatts_prep_write_cfm_t *p_param)
Respond to an attribute prepare write request.
uint8_t srvc_perm
Service permission.
uint8_t * value
Characteristic Value pointer.
Service(128 bits UUID) description.
uint16_t ble_gatts_write_cfm(uint8_t conn_idx, const gatts_write_cfm_t *p_param)
Respond to an attribute write request.
GATT sending Notification or Indication event param description.
gatt_evt_type_t
GATT common events.
uint8_t * value
Attribute value pointer.
gatts_service_type_t attr_tab_type
Service table type.
uint16_t ble_gatts_srvc_db_create(gatts_create_db_t *p_param)
Register a service's attribute list.
const attm_desc_t * attr_tab_16
16 bits service description.
uint16_t ble_gatts_attr_permission_set(uint16_t handle, uint16_t perm, uint16_t ext_perm)
Update attribute permission.
GATT write attribute result description.
uint8_t * attr_tab_cfg
Attribute table selector pointer.
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 max_size
Attribute max size.
uint16_t inc_srvc_num
Included Service number for this service.
uint16_t length
Current length of the attribute.
File that contains error codes.
uint8_t status
Status of prepare write operation by upper layers.
uint16_t perm
Attribute permissions, see Attribute Permission.
uint16_t handle
Handle of the read attribute.
uint16_t ext_perm
Attribute extended permissions, see Attribute Extend Permission.
uint16_t uuid
16-bit LSB-first UUID
uint8_t status
Status of read operation by upper layers.
#define MAX_INC_SRVC_NUM
The max number of Included Services a Primary/Secondary service can have.
GATT prepare write result description.
uint16_t * shdl
Service start handle pointer.
uint8_t status
Status of write operation by upper layers.
const uint8_t * uuid
Service UUID pointer.
gatt_evt_type_t type
Request type (Notification/Indication).
uint16_t handle
Handle of the attribute in prepare write operation.
uint16_t ble_gatts_attr_permission_get(uint16_t handle, uint16_t *p_perm, uint16_t *p_ext_perm)
Retrieve attribute permission.
uint8_t max_nb_attr
Number of attributes in attribute table.
uint16_t handle
Handle of the attribute written.
uint16_t ble_gatts_noti_ind(uint8_t conn_idx, const gatts_noti_ind_t *p_param)
Send out a notification or an indication.
Parameter of Added service description.
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.
void ble_gatts_service_changed(void)
When service on local device finishes upgrade, call this API to send service upgrade to stack.
uint16_t handle
Characteristic Value handle to be notified or indicated.
const attm_desc_128_t * attr_tab_128
128 bits service description.
uint16_t max_size
Attribute max size.
uint16_t perm
Attribute permissions, see Attribute Permission.
GATT read attribute result description.
uint16_t ext_perm
Attribute extended permissions, see Attribute Extend Permission.