Classes | Macros | Enumerations | Functions
ble_gatts.h File Reference

BLE GATTS API. More...

`#include "ble_error.h"`
`#include "ble_att.h"`
`#include "ble_gatt.h"`
`#include "ble_gapc.h"`
`#include <stdint.h>`
Include dependency graph for ble_gatts.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Classes
struct | ble_gatts_attm_desc_t
| Service(16-bit UUID) description. More...
struct | ble_gatts_attm_desc_128_t
| Service(128 bits UUID) description. More...
struct | ble_gatts_create_db_t
| Parameter of Added service description. More...
union | ble_gatts_create_db_t::attribute_table
| < Attribute table. More...
struct | ble_gatts_read_cfm_t
| GATT read attribute result description. More...
struct | ble_gatts_write_cfm_t
| GATT write attribute result description. More...
struct | ble_gatts_prep_write_cfm_t
| GATT prepare write result description. More...
struct | ble_gatts_noti_ind_t
| GATT sending Notification or Indication event param description. More...
struct | noti_multiple_t
| GATTS sending Multiple Notification event param description. More...
struct | ble_gatts_noti_multiple_t
| GATTCS Multiple Notification. More...
struct | ble_gatts_evt_read_t
| GATT read request event for BLE_GATTS_EVT_READ_REQUEST. More...
struct | ble_gatts_evt_write_t
| GATT write request event for BLE_GATTS_EVT_WRITE_REQUEST. More...
struct | ble_gatts_evt_prep_write_t
| GATT prepare write request event for BLE_GATTS_EVT_PREP_WRITE_REQUEST. More...
struct | ble_gatts_evt_ntf_ind_t
| Gatt Notification or indication event for BLE_GATTS_EVT_NTF_IND. More...
struct | ble_gatts_evt_cccd_rec_t
| Gatt cccd recovery event for BLE_GATTS_EVT_CCCD_RECOVERY. More...
struct | ble_gatts_evt_multi_ntf_t
| GATTS Multiple Variable Length Notification Operation Complete event structure. More...
struct | ble_gatts_evt_enh_read_t
| GATT read request event for BLE_GATTS_EVT_READ_REQUEST. More...
struct | ble_gatts_evt_enh_write_t
| GATT write request struct. More...
struct | ble_gatts_evt_enh_prep_write_t
| GATT prepare write request struct. More...
struct | ble_gatts_evt_enh_ntf_ind_t
| GATTS Operation Complete event structure. More...
struct | ble_gatts_evt_enh_cccd_rec_t
| Gatt cccd recovery event for BLE_GATTS_EVT_CCCD_RECOVERY. More...
struct | ble_gatts_evt_enh_multi_ntf_t
| GATTS Multiple Variable Length Notification Operation Complete event structure. More...
struct | ble_gatts_evt_inited_ind_t
| GATTS Multiple Variable Length Notification Operation Complete event structure. More...
struct | ble_gatts_evt_t
| BLE GATTS event structure. More...

## Macros
#define | BLE_GATTS_MAX_INC_SRVC_NUM (5)
| The max number of Included Services a Primary/Secondary service can have. More...
#define | BLE_GATTS_BROADCAST (0x01)
| In one byte, bit0 means: Broadcast bit. More...
#define | BLE_GATTS_READ (0x02)
| In one byte, bit1 means: Read bit. More...
#define | BLE_GATTS_WRITE_CMD (0x04)
| In one byte, bit2 means: Write_cmd bit. More...
#define | BLE_GATTS_WRITE_REQ (0x08)
| In one byte, bit3 means: Write_req bit. More...
#define | BLE_GATTS_NOTIFY (0x10)
| In one byte, bit4 means: Notify bit. More...
#define | BLE_GATTS_INDICATE (0x20)
| In one byte, bit5 means: Indicate bit. More...
#define | BLE_GATTS_WRITE_SIGNED (0x40)
| In one byte, bit6 means: Write_signed bit. More...
#define | BLE_GATTS_EXT_PROP (0x80)
| In one byte, bit7 means: Ext_property bit. More...
#define | BLE_GATTS_READ_POS (0x00)
| Bit position of read permission. More...
#define | BLE_GATTS_WRITE_POS (0x02)
| Bit position of write permission. More...
#define | BLE_GATTS_INDICATE_POS (0x04)
| Bit position of indicate bit. More...
#define | BLE_GATTS_NOTIFY_POS (0x06)
| Bit position of notify bit. More...
#define | BLE_GATTS_NOAUTH (0x00)
| LE security mode 1, level 1. More...
#define | BLE_GATTS_UNAUTH (0x01)
| LE security mode 1, level 2. More...
#define | BLE_GATTS_AUTH (0x02)
| LE security mode 1, level 3. More...
#define | BLE_GATTS_SEC_CON (0x03)
| LE security mode 1, level 4. More...
#define | BLE_GATTS_SEC_LEVEL_MASK (0x03)
| Security level mask. More...
#define | BLE_GATTS_UUID_TYPE_16 (0x00)
| 16-bit UUID length. More...
#define | BLE_GATTS_UUID_TYPE_128 (0x02)
| 128-bit UUID length. More...
#define | BLE_GATTS_SRVC_SECONDARY_SET (0x80)
| Secondary service set. More...
#define | BLE_GATTS_SRVC_UUID_TYPE_SET(uuid_len) ((uuid_len) << 5)
| Service UUID length set. More...
#define | BLE_GATTS_SRVC_DISABLE (0x10)
| Service disable. More...
#define | BLE_GATTS_SRVC_PERM(sec_level) (((sec_level) & SEC_LEVEL_MASK) << 2)
| Service permission authentication. More...
#define | BLE_GATTS_SRVC_ENCRP_KEY_SIZE_16 (0x02)
| 16 bytes service encryption key size . More...
#define | BLE_GATTS_SRVC_MULTI_ENABLE (0x01)
| Service is multi-instantiated. More...
#define | BLE_GATTS_READ_PERM_UNSEC (BLE_GATTS_READ << 8)
| Default Read permission. More...
#define | BLE_GATTS_READ_PERM(sec_level) (BLE_GATTS_READ << 8 | (((sec_level) & BLE_GATTS_SEC_LEVEL_MASK) << BLE_GATTS_READ_POS))
| Read permission set. More...
#define | BLE_GATTS_WRITE_REQ_PERM_UNSEC (BLE_GATTS_WRITE_REQ << 8)
| Default Write Permission. More...
#define | BLE_GATTS_WRITE_REQ_PERM(sec_level) (BLE_GATTS_WRITE_REQ << 8 | (((sec_level) & BLE_GATTS_SEC_LEVEL_MASK) << BLE_GATTS_WRITE_POS))
| Write permission set. More...
#define | BLE_GATTS_WRITE_CMD_PERM_UNSEC (BLE_GATTS_WRITE_CMD << 8)
| Default Write without Response Permission. More...
#define | BLE_GATTS_WRITE_CMD_PERM(sec_level) (BLE_GATTS_WRITE_CMD << 8 | (((sec_level) & BLE_GATTS_SEC_LEVEL_MASK) << BLE_GATTS_WRITE_POS))
| Write without Response permission set. More...
#define | BLE_GATTS_WRITE_SIGNED_PERM_UNSEC (BLE_GATTS_WRITE_SIGNED << 8)
| Default Authenticated Signed Write Permission. More...
#define | BLE_GATTS_WRITE_SIGNED_PERM(sec_level) (BLE_GATTS_WRITE_SIGNED << 8 | (((sec_level) & BLE_GATTS_SEC_LEVEL_MASK) << BLE_GATTS_WRITE_POS))
| Authenticated Signed Write permission set. More...
#define | BLE_GATTS_INDICATE_PERM_UNSEC (BLE_GATTS_INDICATE << 8)
| Default Indicate Permission. More...
#define | BLE_GATTS_INDICATE_PERM(sec_level) (BLE_GATTS_INDICATE << 8 | (((sec_level) & BLE_GATTS_SEC_LEVEL_MASK) << BLE_GATTS_INDICATE_POS))
| Indicate permission set. More...
#define | BLE_GATTS_NOTIFY_PERM_UNSEC (BLE_GATTS_NOTIFY << 8)
| Default Notify Permission. More...
#define | BLE_GATTS_NOTIFY_PERM(sec_level) (BLE_GATTS_NOTIFY << 8 | (((sec_level) & BLE_GATTS_SEC_LEVEL_MASK) << BLE_GATTS_NOTIFY_POS))
| Notify permission set. More...
#define | BLE_GATTS_BROADCAST_ENABLE (BLE_GATTS_BROADCAST << 8)
| Broadcast enable. More...
#define | BLE_GATTS_EXT_PROP_ENABLE (BLE_GATTS_EXT_PROP << 8)
| Extended Properties enable. More...
#define | BLE_GATTS_ATT_VAL_LOC_USER (1 << 15)
| Value location which means value saved in user space, the profile's read/write callback will be called. More...
#define | BLE_GATTS_ATT_VAL_LOC_STACK (0 << 15)
| Value location which means value saved in BLE Stack. More...
#define | BLE_GATTS_ATT_UUID_TYPE_SET(uuid_len) ((uuid_len) << 13)
| Attribute UUID length set. More...
#define | BLE_GATTS_ATT_ENC_KEY_SIZE_16 (0x1000)
| 16 bytes attribute encryption key size . More...

## Enumerations
enum | ble_gatts_service_type_t { BLE_GATTS_SERVICE_TABLE_TYPE_16 = 0x00, BLE_GATTS_SERVICE_TABLE_TYPE_128 }
| Service table type. More...

## Functions
uint16_t | ble_gatts_srvc_db_create (ble_gatts_create_db_t *p_param)
| Register a service's attribute list. More...
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. More...
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. More...
uint16_t | ble_gatts_attr_permission_set (uint16_t handle, uint16_t perm, uint16_t ext_perm)
| Update attribute permission. More...
uint16_t | ble_gatts_attr_permission_get (uint16_t handle, uint16_t *p_perm, uint16_t *p_ext_perm)
| Retrieve attribute permission. More...
uint16_t | ble_gatts_read_cfm (uint8_t conn_idx, const ble_gatts_read_cfm_t *p_param)
| Respond to an attribute read request. More...
uint16_t | ble_gatts_write_cfm (uint8_t conn_idx, const ble_gatts_write_cfm_t *p_param)
| Respond to an attribute write request. More...
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. More...
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. More...
void | ble_gatts_service_changed (void)
| When service on local device finishes upgrade, call this API to send service upgrade to stack. More...
uint16_t | ble_gatts_mult_noti (uint8_t conn_idx, const ble_gatts_noti_multiple_t *p_param)
| Send out Multiple Variable Length Notifications. More...
uint16_t | ble_gatts_service_discoverable_set (uint8_t conn_idx, uint16_t start_hdl, bool discoverable)
| Set a service discoverable or not. More...
uint16_t | ble_gatts_service_discover_all (uint8_t conn_idx)
| Set all service discoverable. More...
uint16_t | ble_gatts_service_hide_all (uint8_t conn_idx)
| Hide all service. More...

## Detailed Description

BLE GATTS API.

Attention

  ##### Copyright (c) 2019 GOODIX

All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. Neither the name of GOODIX nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Definition in file ble_gatts.h.