MT7697 API Reference  LinkIt SDK v4

This section defines the macros for the GATTS. More...

Overview

This section defines the macros for the GATTS.

This section describes the macros defined for the GATTS.

Macros

#define BT_GATTS_REC_PERM_READ_SHIFT(mask)    ((mask)<<4)
 Note, when creating a record, the application should synchronize the record's permission and characteristic properties to be read out by the client. More...
 
#define BT_GATTS_REC_PERM_WRITE_SHIFT(mask)    ((mask)<<0)
 Write the permission mask shift. More...
 
#define BT_GATTS_REC_PERM_READ_MASK   0xf0
 Read the permission mask. More...
 
#define BT_GATTS_REC_PERM_READABLE   0x80
 The record is readable without any security requirement. More...
 
#define BT_GATTS_REC_PERM_READABLE_ENCRYPTION   (BT_GATTS_REC_PERM_READABLE | (BT_GATTS_REC_PERM_READ_SHIFT(BT_GAP_LE_SECURITY_ENCRYPTION_MASK)))
 The record is readable when the connection is encrypted. More...
 
#define BT_GATTS_REC_PERM_READABLE_AUTHENTICATION   (BT_GATTS_REC_PERM_READABLE | (BT_GATTS_REC_PERM_READ_SHIFT(BT_GAP_LE_SECURITY_AUTHENTICATION_MASK)))
 The record is readable only for the authenticated connection. More...
 
#define BT_GATTS_REC_PERM_READABLE_AUTHORIZATION   (BT_GATTS_REC_PERM_READABLE | (BT_GATTS_REC_PERM_READ_SHIFT(BT_GAP_LE_SECURITY_AUTHORIZATION_MASK)))
 The record is readable only after the application is granted a permission. More...
 
#define BT_GATTS_IS_READABLE(perm)    (((perm) & BT_GATTS_REC_PERM_READ_MASK)> 0)
 Checks if the record is readable. More...
 
#define BT_GATTS_REC_PERM_WRITE_MASK   0x0f
 Write the permission mask. More...
 
#define BT_GATTS_REC_PERM_WRITABLE   0x08
 The record is writable without any security requirement. More...
 
#define BT_GATTS_REC_PERM_WRITABLE_ENCRYPTION   (BT_GATTS_REC_PERM_WRITABLE | (BT_GATTS_REC_PERM_WRITE_SHIFT(BT_GAP_LE_SECURITY_ENCRYPTION_MASK)))
 The record is writable when the connection is encrypted. More...
 
#define BT_GATTS_REC_PERM_WRITABLE_AUTHENTICATION   (BT_GATTS_REC_PERM_WRITABLE | (BT_GATTS_REC_PERM_WRITE_SHIFT(BT_GAP_LE_SECURITY_AUTHENTICATION_MASK)))
 The record is writable only for the authenticated connection. More...
 
#define BT_GATTS_REC_PERM_WRITABLE_AUTHORIZATION   (BT_GATTS_REC_PERM_WRITABLE | (BT_GATTS_REC_PERM_WRITE_SHIFT(BT_GAP_LE_SECURITY_AUTHORIZATION_MASK)))
 The record is writable only after the application is granted a permission. More...
 
#define BT_GATTS_IS_WRITABLE(perm)    (((perm) & BT_GATTS_REC_PERM_WRITE_MASK)> 0)
 Checks if the record is writable. More...
 
#define BT_GATTS_CALLBACK_READ   0
 It is used in the record's callback bt_gatts_rec_callback_t() to notify a read request. More...
 
#define BT_GATTS_CALLBACK_WRITE   1
 It is used in the record's callback bt_gatts_rec_callback_t() to notify a write request. More...
 
#define BT_GATTS_CALLBACK_PREPARE_WRITE   2
 It is used in the record's callback bt_gatts_rec_callback_t() to notify a prepare write request. More...
 
#define BT_GATTS_CALLBACK_EXECUTE_WRITE_CANCEL   3
 It is used in the record's callback bt_gatts_rec_callback_t() to notify an execute write with action cancel request. More...
 
#define BT_GATTS_CALLBACK_EXECUTE_WRITE_WRITE   4
 It is used in the record's callback bt_gatts_rec_callback_t() to notify an execute write with action write request. More...
 
#define BT_GATTS_EXECUTE_WRITE_RLT_SET(handle, status)    (((handle)<<8)|(status))
 It is used to create a response to the execute write operation. More...
 
#define BT_GATTS_EXECUTE_WRITE_RLT_GET_HANDLE(s)    (((s)>>8)&0xFFFF)
 It is used to get handle of the execute write response. More...
 
#define BT_GATTS_EXECUTE_WRITE_RLT_GET_STATUS(s)    ((s)&0xFF)
 It is used to get status of the execute write response. More...
 
#define BT_GATTS_NEW_PRIMARY_SERVICE_16(name, uuid16_value)
 This macro creates a 16-bit primary service. More...
 
#define BT_GATTS_NEW_PRIMARY_SERVICE_128(name, uuid128_value)
 This macro creates a 128-bit primary service. More...
 
#define BT_GATTS_NEW_SECONDARY_SERVICE_16(name, uuid16_value)
 This macro creates a 16-bit secondary service. More...
 
#define BT_GATTS_NEW_SECONDARY_SERVICE_128(name, uuid128_value)
 This macro creates a 128-bit secondary service. More...
 
#define BT_GATTS_NEW_INCLUDED_SERVICE_16(name, s_handle, e_handle, uuid)
 This macro creates a 16-bit included service. More...
 
#define BT_GATTS_NEW_INCLUDED_SERVICE_128(name, s_handle, e_handle)
 This macro creates a 128-bit included service. More...
 
#define BT_GATTS_NEW_CHARC_16(name, prop, _handle, uuid)
 This macro creates a 16-bit readable characteristic. More...
 
#define BT_GATTS_NEW_CHARC_16_WRITABLE(name, prop, _handle, uuid)
 This macro creates a 16-bit writable characteristic. More...
 
#define BT_GATTS_NEW_CHARC_128(name, prop, _handle, uuid)
 This macro creates a 128-bit readable characteristic. More...
 
#define BT_GATTS_NEW_CHARC_VALUE_UINT8(name, uuid, _perm, _value)
 This macro creates a const uint8 characteristic value. More...
 
#define BT_GATTS_NEW_CHARC_VALUE_UINT8_WRITABLE(name, uuid, _perm, _value)
 This macro creates a uint8 characteristic value. More...
 
#define BT_GATTS_NEW_CHARC_VALUE_UINT16(name, uuid, _perm, _value)
 This macro creates a const uint16 characteristic value. More...
 
#define BT_GATTS_NEW_CHARC_VALUE_UINT32(name, uuid, _perm, _value)
 This macro creates a const uint32 characteristic value. More...
 
#define BT_GATTS_NEW_CHARC_VALUE_UINT32_WRITABLE(name, uuid, _perm, _value)
 This macro creates a uint32 characteristic value. More...
 
#define BT_GATTS_NEW_CHARC_VALUE_INT8(name, uuid, _perm, _value)
 This macro creates a const int8 characteristic value. More...
 
#define BT_GATTS_NEW_CHARC_VALUE_INT16(name, uuid, _perm, _value)
 This macro creates a const int16 characteristic value. More...
 
#define BT_GATTS_NEW_CHARC_VALUE_INT32(name, uuid, _perm, _value)
 This macro creates a const int32 characteristic value. More...
 
#define BT_GATTS_NEW_CHARC_VALUE_CALLBACK(name, uuid, _perm, call)
 This macro creates a characteristic value with callback. More...
 
#define BT_GATTS_NEW_CHARC_VALUE_CALLBACK_WRITABLE(name, uuid, _perm, call)
 This macro creates a characteristic value with callback. More...
 
#define BT_GATTS_NEW_CHARC_VALUE_STR16(name, uuid, _perm, val_len, val_name)
 This macro creates a str16 characteristic value. More...
 
#define BT_GATTS_NEW_CHARC_VALUE_HALFW8_WRITABLE(name, uuid, _perm, val_len, ...)
 This macro creates a half word characteristic value. More...
 
#define BT_GATTS_NEW_CHARC_EXTENDED_PROPERTIES(name, ext_prop)
 This macro creates a characteristic extended properties descriptor. More...
 
#define BT_GATTS_NEW_CHARC_USER_DESCRIPTION_STR16(name, _perm, val_len, val_name)
 This macro creates a characteristic str16 user description descriptor. More...
 
#define BT_GATTS_NEW_CHARC_USER_DESCRIPTION(name, _perm, _callback)
 This macro creates a characteristic user description descriptor. More...
 
#define BT_GATTS_NEW_CLIENT_CHARC_CONFIG(name, _perm, _callback)
 This macro creates a client characteristic configuration descriptor. More...
 
#define BT_GATTS_NEW_SERVER_CHARC_CONFIG(name, _perm, _callback)
 This macro creates a server characteristic configuration descriptor. More...
 
#define BT_GATTS_NEW_CHARC_FORMAT(name, _format, _exponent, _unit, _name_space, _description)
 This macro creates a characteristic presentation format descriptor. More...
 
#define BT_GATTS_NEW_CHARC_AGGREGATE_FORMAT_H8(name, _perm, val_len, ...)
 This macro creates a characteristic aggregate format descriptor. More...
 

Macro Definition Documentation

#define BT_GATTS_CALLBACK_EXECUTE_WRITE_CANCEL   3

It is used in the record's callback bt_gatts_rec_callback_t() to notify an execute write with action cancel request.

#define BT_GATTS_CALLBACK_EXECUTE_WRITE_WRITE   4

It is used in the record's callback bt_gatts_rec_callback_t() to notify an execute write with action write request.

#define BT_GATTS_CALLBACK_PREPARE_WRITE   2

It is used in the record's callback bt_gatts_rec_callback_t() to notify a prepare write request.

#define BT_GATTS_CALLBACK_READ   0

It is used in the record's callback bt_gatts_rec_callback_t() to notify a read request.

#define BT_GATTS_CALLBACK_WRITE   1

It is used in the record's callback bt_gatts_rec_callback_t() to notify a write request.

#define BT_GATTS_EXECUTE_WRITE_RLT_GET_HANDLE (   s)    (((s)>>8)&0xFFFF)

It is used to get handle of the execute write response.

#define BT_GATTS_EXECUTE_WRITE_RLT_GET_STATUS (   s)    ((s)&0xFF)

It is used to get status of the execute write response.

#define BT_GATTS_EXECUTE_WRITE_RLT_SET (   handle,
  status 
)    (((handle)<<8)|(status))

It is used to create a response to the execute write operation.

#define BT_GATTS_IS_READABLE (   perm)    (((perm) & BT_GATTS_REC_PERM_READ_MASK)> 0)

Checks if the record is readable.

#define BT_GATTS_IS_WRITABLE (   perm)    (((perm) & BT_GATTS_REC_PERM_WRITE_MASK)> 0)

Checks if the record is writable.

#define BT_GATTS_NEW_CHARC_128 (   name,
  prop,
  _handle,
  uuid 
)
Value:
static const bt_gatts_characteristic_128_t name = { \
.rec_hdr.perm = BT_GATTS_REC_PERM_READABLE, \
.rec_hdr.value_len = 19, \
.value.properties = prop, \
.value.handle = _handle, \
.value.uuid128 = uuid \
}
const bt_uuid_t * uuid_ptr
A pointer to the UUID of attribute type.
Definition: bt_gatts.h:236
bt_gatts_service_rec_t rec_hdr
The record, which is the basic element of a service or characteristic.
Definition: bt_gatts.h:381
const bt_uuid_t BT_GATT_UUID_CHARC
UUID for GATT characteristic.
#define BT_GATTS_REC_PERM_READABLE
The record is readable without any security requirement.
Definition: bt_gatts.h:170
128-bit UUID characteristic structure of the GATTS.
Definition: bt_gatts.h:379

This macro creates a 128-bit readable characteristic.

Parameters
[in]nameis the name of the record.
[in]propspecifies the properties of the characteristic.
[in]_handleis the handle of the characteristic value.
[in]uuidis the 128-bit characteristic UUID.
#define BT_GATTS_NEW_CHARC_16 (   name,
  prop,
  _handle,
  uuid 
)
Value:
static const bt_gatts_characteristic_16_t name = { \
.rec_hdr.perm = BT_GATTS_REC_PERM_READABLE, \
.rec_hdr.value_len = 5, \
.value.properties = prop, \
.value.handle = _handle, \
.value.uuid16 = uuid \
}
const bt_uuid_t * uuid_ptr
A pointer to the UUID of attribute type.
Definition: bt_gatts.h:236
const bt_uuid_t BT_GATT_UUID_CHARC
UUID for GATT characteristic.
16-bit UUID characteristic structure of the GATTS.
Definition: bt_gatts.h:370
bt_gatts_service_rec_t rec_hdr
The record, which is the basic element of a service or characteristic.
Definition: bt_gatts.h:372
#define BT_GATTS_REC_PERM_READABLE
The record is readable without any security requirement.
Definition: bt_gatts.h:170

This macro creates a 16-bit readable characteristic.

Parameters
[in]nameis the name of the record.
[in]propspecifies the properties of the characteristic.
[in]_handleis the handle of the characteristic value.
[in]uuidis the 16-bit characteristic UUID.
#define BT_GATTS_NEW_CHARC_16_WRITABLE (   name,
  prop,
  _handle,
  uuid 
)
Value:
.rec_hdr.perm = BT_GATTS_REC_PERM_READABLE, \
.rec_hdr.value_len = 5, \
.value.properties = prop, \
.value.handle = _handle, \
.value.uuid16 = uuid \
}
const bt_uuid_t * uuid_ptr
A pointer to the UUID of attribute type.
Definition: bt_gatts.h:236
const bt_uuid_t BT_GATT_UUID_CHARC
UUID for GATT characteristic.
16-bit UUID characteristic structure of the GATTS.
Definition: bt_gatts.h:370
bt_gatts_service_rec_t rec_hdr
The record, which is the basic element of a service or characteristic.
Definition: bt_gatts.h:372
#define BT_GATTS_REC_PERM_READABLE
The record is readable without any security requirement.
Definition: bt_gatts.h:170

This macro creates a 16-bit writable characteristic.

Parameters
[in]nameis the name of the record.
[in]propspecifies the properties of the characteristic.
[in]_handleis the handle of the characteristic value.
[in]uuidis the 16-bit characteristic UUID.
#define BT_GATTS_NEW_CHARC_AGGREGATE_FORMAT_H8 (   name,
  _perm,
  val_len,
  ... 
)
Value:
.rec_hdr.perm = _perm, \
.rec_hdr.value_len = val_len, \
.handle_list = {__VA_ARGS__} \
}
Characteristic aggregate format descriptor structure of the GATTS.
Definition: bt_gatts.h:461
const bt_uuid_t * uuid_ptr
A pointer to the UUID of attribute type.
Definition: bt_gatts.h:236
const bt_uuid_t BT_GATT_UUID_CHARC_AGGREGATE_FORMAT
UUID for GATT characteristic aggregate format.
bt_gatts_service_rec_t rec_hdr
The record, which is the basic element of a service or characteristic.
Definition: bt_gatts.h:463

This macro creates a characteristic aggregate format descriptor.

IMPORTANT: The length(val_len) is the number of bytes, and the maximum number of handles is 8.

Parameters
[in]nameis the name of the record.
[in]_permis the permission of the record.
[in]val_lenis the length of the handle list in bytes.
#define BT_GATTS_NEW_CHARC_EXTENDED_PROPERTIES (   name,
  ext_prop 
)
Value:
.rec_hdr.perm = BT_GATTS_REC_PERM_READABLE, \
.rec_hdr.value_len = 2, \
.extended_properties = ext_prop \
}
const bt_uuid_t * uuid_ptr
A pointer to the UUID of attribute type.
Definition: bt_gatts.h:236
Characteristic extended properties descriptor structure of the GATTS.
Definition: bt_gatts.h:415
bt_gatts_service_rec_t rec_hdr
The record, which is the basic element of a service or characteristic.
Definition: bt_gatts.h:417
#define BT_GATTS_REC_PERM_READABLE
The record is readable without any security requirement.
Definition: bt_gatts.h:170
const bt_uuid_t BT_GATT_UUID_CHARC_EXTENDED_PROPERTIES
UUID for GATT characteristic extended properties.

This macro creates a characteristic extended properties descriptor.

Parameters
[in]nameis the name of the record.
[in]ext_propspecifies the characteristic extended properties.
#define BT_GATTS_NEW_CHARC_FORMAT (   name,
  _format,
  _exponent,
  _unit,
  _name_space,
  _description 
)
Value:
static const bt_gatts_characteristic_format_t name = { \
.rec_hdr.perm = BT_GATTS_REC_PERM_READABLE, \
.rec_hdr.value_len = 7, \
.value.format = _format, \
.value.exponent = _exponent, \
.value.unit = _unit, \
.value.name_space = _name_space, \
.value.description = _description \
}
const bt_uuid_t * uuid_ptr
A pointer to the UUID of attribute type.
Definition: bt_gatts.h:236
const bt_uuid_t BT_GATT_UUID_CHARC_FORMAT
UUID for GATT characteristic presentation format.
Characteristic presentation format descriptor structure of the GATTS.
Definition: bt_gatts.h:452
bt_gatts_service_rec_t rec_hdr
The record, which is the basic element of a service or characteristic.
Definition: bt_gatts.h:454
#define BT_GATTS_REC_PERM_READABLE
The record is readable without any security requirement.
Definition: bt_gatts.h:170

This macro creates a characteristic presentation format descriptor.

Parameters
[in]nameis the name of the record.
[in]_formatis the format of the value of this characteristic.
[in]_exponentis the exponent field to determine how the value is further formatted.
[in]_unitis the unit of the characteristic.
[in]_name_spaceis the namespace of the characteristic.
[in]_descriptionis the description of the characteristic.
#define BT_GATTS_NEW_CHARC_USER_DESCRIPTION (   name,
  _perm,
  _callback 
)
Value:
.rec_hdr.perm = _perm, \
.rec_hdr.value_len = 0, \
.callback = _callback \
}
const bt_uuid_t * uuid_ptr
A pointer to the UUID of attribute type.
Definition: bt_gatts.h:236
const bt_uuid_t BT_GATT_UUID_CHARC_USER_DESCRIPTION
UUID for GATT characteristic user description.
bt_gatts_service_rec_t rec_hdr
The record, which is the basic element of a service or characteristic.
Definition: bt_gatts.h:426
Characteristic user description descriptor structure of the GATTS.
Definition: bt_gatts.h:424

This macro creates a characteristic user description descriptor.

Parameters
[in]nameis the name of the record.
[in]_permis the permission of the record.
[in]_callbackis the callback to handle the record read and write request.
#define BT_GATTS_NEW_CHARC_USER_DESCRIPTION_STR16 (   name,
  _perm,
  val_len,
  val_name 
)
Value:
.rec_hdr.perm = _perm, \
.rec_hdr.value_len = val_len, \
.str = val_name \
}
const bt_uuid_t * uuid_ptr
A pointer to the UUID of attribute type.
Definition: bt_gatts.h:236
const bt_uuid_t BT_GATT_UUID_CHARC_USER_DESCRIPTION
UUID for GATT characteristic user description.
bt_gatts_service_rec_t rec_hdr
The record, which is the basic element of a service or characteristic.
Definition: bt_gatts.h:399
utf-16 characteristic structure of the GATTS.
Definition: bt_gatts.h:397

This macro creates a characteristic str16 user description descriptor.

IMPORTANT: The length(val_len) of val_name should be less than or equal to 16.

Parameters
[in]nameis the name of the record.
[in]_permis the permission of the record.
[in]val_lenis the length of the record.
[in]val_nameis the name of the buffer to hold the record value.
#define BT_GATTS_NEW_CHARC_VALUE_CALLBACK (   name,
  uuid,
  _perm,
  call 
)
Value:
static const bt_gatts_characteristic_t name = { \
.rec_hdr.uuid_ptr = &uuid, \
.rec_hdr.perm = _perm, \
.rec_hdr.value_len = 0, \
.value.callback = call \
}
Characteristic structure of the GATTS.
Definition: bt_gatts.h:388
const bt_uuid_t * uuid_ptr
A pointer to the UUID of attribute type.
Definition: bt_gatts.h:236
bt_gatts_service_rec_t rec_hdr
The record, which is the basic element of a service or characteristic.
Definition: bt_gatts.h:390

This macro creates a characteristic value with callback.

Parameters
[in]nameis the name of the record.
[in]uuidis the UUID of the characteristic value.
[in]_permis the permission of the characteristic value.
[in]callis the callback to handle the characteristic value read and write request.
#define BT_GATTS_NEW_CHARC_VALUE_CALLBACK_WRITABLE (   name,
  uuid,
  _perm,
  call 
)
Value:
static bt_gatts_characteristic_t name = { \
.rec_hdr.uuid_ptr = &uuid, \
.rec_hdr.perm = _perm, \
.rec_hdr.value_len = 0, \
.value.callback = call \
}
Characteristic structure of the GATTS.
Definition: bt_gatts.h:388
const bt_uuid_t * uuid_ptr
A pointer to the UUID of attribute type.
Definition: bt_gatts.h:236
bt_gatts_service_rec_t rec_hdr
The record, which is the basic element of a service or characteristic.
Definition: bt_gatts.h:390

This macro creates a characteristic value with callback.

Parameters
[in]nameis the name of the record.
[in]uuidis the UUID of the characteristic value.
[in]_permis the permission of the characteristic value.
[in]callis the callback to handle the characteristic value read and write request.
#define BT_GATTS_NEW_CHARC_VALUE_HALFW8_WRITABLE (   name,
  uuid,
  _perm,
  val_len,
  ... 
)
Value:
.rec_hdr.uuid_ptr = &uuid, \
.rec_hdr.perm = _perm, \
.rec_hdr.value_len = val_len, \
.halfw = {__VA_ARGS__} \
}
const bt_uuid_t * uuid_ptr
A pointer to the UUID of attribute type.
Definition: bt_gatts.h:236
bt_gatts_service_rec_t rec_hdr
The record, which is the basic element of a service or characteristic.
Definition: bt_gatts.h:408
Half word characteristic structure of the GATTS.
Definition: bt_gatts.h:406

This macro creates a half word characteristic value.

Parameters
[in]nameis the name of the record.
[in]uuidis the UUID of the characteristic value.
[in]_permis the permission of the characteristic value.
[in]val_lenis the length of the characteristic value.
#define BT_GATTS_NEW_CHARC_VALUE_INT16 (   name,
  uuid,
  _perm,
  _value 
)
Value:
static const bt_gatts_characteristic_t name = { \
.rec_hdr.uuid_ptr = &uuid, \
.rec_hdr.perm = _perm, \
.rec_hdr.value_len = 2, \
.value.value_int_16 = _value \
}
Characteristic structure of the GATTS.
Definition: bt_gatts.h:388
const bt_uuid_t * uuid_ptr
A pointer to the UUID of attribute type.
Definition: bt_gatts.h:236
bt_gatts_service_rec_t rec_hdr
The record, which is the basic element of a service or characteristic.
Definition: bt_gatts.h:390

This macro creates a const int16 characteristic value.

Parameters
[in]nameis the name of the record.
[in]uuidis the UUID of the characteristic value.
[in]_permis the permission of the characteristic value.
[in]_valueis int16 characteristic value.
#define BT_GATTS_NEW_CHARC_VALUE_INT32 (   name,
  uuid,
  _perm,
  _value 
)
Value:
static const bt_gatts_characteristic_t name = { \
.rec_hdr.uuid_ptr = &uuid, \
.rec_hdr.perm = _perm, \
.rec_hdr.value_len = 4, \
.value.value_int_32 = _value \
}
Characteristic structure of the GATTS.
Definition: bt_gatts.h:388
const bt_uuid_t * uuid_ptr
A pointer to the UUID of attribute type.
Definition: bt_gatts.h:236
bt_gatts_service_rec_t rec_hdr
The record, which is the basic element of a service or characteristic.
Definition: bt_gatts.h:390

This macro creates a const int32 characteristic value.

Parameters
[in]nameis the name of the record.
[in]uuidis the UUID of the characteristic value.
[in]_permis the permission of the characteristic value.
[in]_valueis int32 characteristic value.
#define BT_GATTS_NEW_CHARC_VALUE_INT8 (   name,
  uuid,
  _perm,
  _value 
)
Value:
static const bt_gatts_characteristic_t name = { \
.rec_hdr.uuid_ptr = &uuid, \
.rec_hdr.perm = _perm, \
.rec_hdr.value_len = 1, \
.value.value_int_8 = _value \
}
Characteristic structure of the GATTS.
Definition: bt_gatts.h:388
const bt_uuid_t * uuid_ptr
A pointer to the UUID of attribute type.
Definition: bt_gatts.h:236
bt_gatts_service_rec_t rec_hdr
The record, which is the basic element of a service or characteristic.
Definition: bt_gatts.h:390

This macro creates a const int8 characteristic value.

Parameters
[in]nameis the name of the record.
[in]uuidis the UUID of the characteristic value.
[in]_permis the permission of the characteristic value.
[in]_valueis int8 characteristic value.
#define BT_GATTS_NEW_CHARC_VALUE_STR16 (   name,
  uuid,
  _perm,
  val_len,
  val_name 
)
Value:
static const bt_gatts_characteristic_str16_t name = { \
.rec_hdr.uuid_ptr = &uuid, \
.rec_hdr.perm = _perm, \
.rec_hdr.value_len = val_len, \
.str = val_name \
}
const bt_uuid_t * uuid_ptr
A pointer to the UUID of attribute type.
Definition: bt_gatts.h:236
bt_gatts_service_rec_t rec_hdr
The record, which is the basic element of a service or characteristic.
Definition: bt_gatts.h:399
utf-16 characteristic structure of the GATTS.
Definition: bt_gatts.h:397

This macro creates a str16 characteristic value.

IMPORTANT: The length(val_len) of val_name should be less than or equal to 16.

Parameters
[in]nameis the name of the record.
[in]uuidis the UUID of the characteristic value.
[in]_permis the permission of the characteristic value.
[in]val_lenis the length of the characteristic value.
[in]val_nameis the name of the buffer to hold the characteristic value.
#define BT_GATTS_NEW_CHARC_VALUE_UINT16 (   name,
  uuid,
  _perm,
  _value 
)
Value:
static const bt_gatts_characteristic_t name = { \
.rec_hdr.uuid_ptr = &uuid, \
.rec_hdr.perm = _perm, \
.rec_hdr.value_len = 2, \
.value.value_uint_16 = _value \
}
Characteristic structure of the GATTS.
Definition: bt_gatts.h:388
const bt_uuid_t * uuid_ptr
A pointer to the UUID of attribute type.
Definition: bt_gatts.h:236
bt_gatts_service_rec_t rec_hdr
The record, which is the basic element of a service or characteristic.
Definition: bt_gatts.h:390

This macro creates a const uint16 characteristic value.

Parameters
[in]nameis the name of the record.
[in]uuidis the UUID of the characteristic value.
[in]_permis the permission of the characteristic value.
[in]_valueis uint16 characteristic value.
#define BT_GATTS_NEW_CHARC_VALUE_UINT32 (   name,
  uuid,
  _perm,
  _value 
)
Value:
static const bt_gatts_characteristic_t name = { \
.rec_hdr.uuid_ptr = &uuid, \
.rec_hdr.perm = _perm, \
.rec_hdr.value_len = 4, \
.value.value_uint_32 = _value \
}
Characteristic structure of the GATTS.
Definition: bt_gatts.h:388
const bt_uuid_t * uuid_ptr
A pointer to the UUID of attribute type.
Definition: bt_gatts.h:236
bt_gatts_service_rec_t rec_hdr
The record, which is the basic element of a service or characteristic.
Definition: bt_gatts.h:390

This macro creates a const uint32 characteristic value.

Parameters
[in]nameis the name of the record.
[in]uuidis the UUID of the characteristic value.
[in]_permis the permission of the characteristic value.
[in]_valueis uint32 characteristic value.
#define BT_GATTS_NEW_CHARC_VALUE_UINT32_WRITABLE (   name,
  uuid,
  _perm,
  _value 
)
Value:
static bt_gatts_characteristic_t name = { \
.rec_hdr.uuid_ptr = &uuid, \
.rec_hdr.perm = _perm, \
.rec_hdr.value_len = 4, \
.value.value_uint_32 = _value \
}
Characteristic structure of the GATTS.
Definition: bt_gatts.h:388
const bt_uuid_t * uuid_ptr
A pointer to the UUID of attribute type.
Definition: bt_gatts.h:236
bt_gatts_service_rec_t rec_hdr
The record, which is the basic element of a service or characteristic.
Definition: bt_gatts.h:390

This macro creates a uint32 characteristic value.

Parameters
[in]nameis the name of the record.
[in]uuidis the UUID of the characteristic value.
[in]_permis the permission of the characteristic value.
[in]_valueis uint32 characteristic value.
#define BT_GATTS_NEW_CHARC_VALUE_UINT8 (   name,
  uuid,
  _perm,
  _value 
)
Value:
static const bt_gatts_characteristic_t name = { \
.rec_hdr.uuid_ptr = &uuid, \
.rec_hdr.perm = _perm, \
.rec_hdr.value_len = 1, \
.value.value_uint_8 = _value \
}
Characteristic structure of the GATTS.
Definition: bt_gatts.h:388
const bt_uuid_t * uuid_ptr
A pointer to the UUID of attribute type.
Definition: bt_gatts.h:236
bt_gatts_service_rec_t rec_hdr
The record, which is the basic element of a service or characteristic.
Definition: bt_gatts.h:390

This macro creates a const uint8 characteristic value.

Parameters
[in]nameis the name of the record.
[in]uuidis the UUID of the characteristic value.
[in]_permis the permission of the characteristic value.
[in]_valueis uint8 characteristic value.
#define BT_GATTS_NEW_CHARC_VALUE_UINT8_WRITABLE (   name,
  uuid,
  _perm,
  _value 
)
Value:
static bt_gatts_characteristic_t name = { \
.rec_hdr.uuid_ptr = &uuid, \
.rec_hdr.perm = _perm, \
.rec_hdr.value_len = 1, \
.value.value_uint_8 = _value \
}
Characteristic structure of the GATTS.
Definition: bt_gatts.h:388
const bt_uuid_t * uuid_ptr
A pointer to the UUID of attribute type.
Definition: bt_gatts.h:236
bt_gatts_service_rec_t rec_hdr
The record, which is the basic element of a service or characteristic.
Definition: bt_gatts.h:390

This macro creates a uint8 characteristic value.

Parameters
[in]nameis the name of the record.
[in]uuidis the UUID of the characteristic value.
[in]_permis the permission of the characteristic value.
[in]_valueis uint8 characteristic value.
#define BT_GATTS_NEW_CLIENT_CHARC_CONFIG (   name,
  _perm,
  _callback 
)
Value:
.rec_hdr.perm = _perm, \
.rec_hdr.value_len = 0, \
.callback = _callback \
}
const bt_uuid_t * uuid_ptr
A pointer to the UUID of attribute type.
Definition: bt_gatts.h:236
bt_gatts_service_rec_t rec_hdr
The record, which is the basic element of a service or characteristic.
Definition: bt_gatts.h:440
Client characteristic configuration descriptor structure of the GATTS.
Definition: bt_gatts.h:438
const bt_uuid_t BT_GATT_UUID_CLIENT_CHARC_CONFIG
UUID for GATT client characteristic configuration.

This macro creates a client characteristic configuration descriptor.

Parameters
[in]nameis the name of the record.
[in]_permis the permission of the record.
[in]_callbackis the callback to handle the record read and write request.
#define BT_GATTS_NEW_INCLUDED_SERVICE_128 (   name,
  s_handle,
  e_handle 
)
Value:
static const bt_gatts_included_service_t name = { \
.rec_hdr.perm = BT_GATTS_REC_PERM_READABLE, \
.rec_hdr.value_len = 4, \
.value.service_handle = s_handle, \
.value.end_group_handle = e_handle, \
.value.uuid16 =0x0000 \
}
const bt_uuid_t BT_GATT_UUID_INCLUDED_SERVICE
UUID for GATT included service.
const bt_uuid_t * uuid_ptr
A pointer to the UUID of attribute type.
Definition: bt_gatts.h:236
bt_gatts_service_rec_t rec_hdr
The record, which is the basic element of a service or characteristic.
Definition: bt_gatts.h:363
Included service structure of the GATTS.
Definition: bt_gatts.h:361
#define BT_GATTS_REC_PERM_READABLE
The record is readable without any security requirement.
Definition: bt_gatts.h:170

This macro creates a 128-bit included service.

Parameters
[in]nameis the name of the record.
[in]s_handleis the starting handle of the included service.
[in]e_handleis the ending handle of the included service.
#define BT_GATTS_NEW_INCLUDED_SERVICE_16 (   name,
  s_handle,
  e_handle,
  uuid 
)
Value:
static const bt_gatts_included_service_t name = { \
.rec_hdr.perm = BT_GATTS_REC_PERM_READABLE, \
.rec_hdr.value_len = 6, \
.value.service_handle = s_handle, \
.value.end_group_handle = e_handle, \
.value.uuid16 = uuid \
}
const bt_uuid_t BT_GATT_UUID_INCLUDED_SERVICE
UUID for GATT included service.
const bt_uuid_t * uuid_ptr
A pointer to the UUID of attribute type.
Definition: bt_gatts.h:236
bt_gatts_service_rec_t rec_hdr
The record, which is the basic element of a service or characteristic.
Definition: bt_gatts.h:363
Included service structure of the GATTS.
Definition: bt_gatts.h:361
#define BT_GATTS_REC_PERM_READABLE
The record is readable without any security requirement.
Definition: bt_gatts.h:170

This macro creates a 16-bit included service.

Parameters
[in]nameis the name of the record.
[in]s_handleis the starting handle of the included service.
[in]e_handleis the ending handle of the included service.
[in]uuidis the 16-bit included service UUID.
#define BT_GATTS_NEW_PRIMARY_SERVICE_128 (   name,
  uuid128_value 
)
Value:
static const bt_gatts_primary_service_128_t name = { \
.rec_hdr.perm = BT_GATTS_REC_PERM_READABLE, \
.rec_hdr.value_len = 16, \
.uuid128 = uuid128_value \
}
const bt_uuid_t * uuid_ptr
A pointer to the UUID of attribute type.
Definition: bt_gatts.h:236
128-bit primary service structure of the GATTS.
Definition: bt_gatts.h:347
const bt_uuid_t BT_GATT_UUID_PRIMARY_SERVICE
UUID for GATT primary service.
#define BT_GATTS_REC_PERM_READABLE
The record is readable without any security requirement.
Definition: bt_gatts.h:170
bt_gatts_service_rec_t rec_hdr
The record, which is the basic element of a service or characteristic.
Definition: bt_gatts.h:349

This macro creates a 128-bit primary service.

Parameters
[in]nameis the name of the record.
[in]uuid128_valueis the 128-bit primary service UUID.
#define BT_GATTS_NEW_PRIMARY_SERVICE_16 (   name,
  uuid16_value 
)
Value:
static const bt_gatts_primary_service_16_t name = { \
.rec_hdr.perm = BT_GATTS_REC_PERM_READABLE, \
.rec_hdr.value_len = 2, \
.uuid16 = uuid16_value \
}
16-bit primary service structure of the GATTS.
Definition: bt_gatts.h:333
const bt_uuid_t * uuid_ptr
A pointer to the UUID of attribute type.
Definition: bt_gatts.h:236
const bt_uuid_t BT_GATT_UUID_PRIMARY_SERVICE
UUID for GATT primary service.
#define BT_GATTS_REC_PERM_READABLE
The record is readable without any security requirement.
Definition: bt_gatts.h:170
bt_gatts_service_rec_t rec_hdr
The record, which is the basic element of a service or characteristic.
Definition: bt_gatts.h:335

This macro creates a 16-bit primary service.

Parameters
[in]nameis the name of the record.
[in]uuid16_valueis the 16-bit primary service UUID.
#define BT_GATTS_NEW_SECONDARY_SERVICE_128 (   name,
  uuid128_value 
)
Value:
static const bt_gatts_secondary_service_128_t name = { \
.rec_hdr.perm = BT_GATTS_REC_PERM_READABLE, \
.rec_hdr.value_len = 16, \
.uuid128 = uuid128_value \
}
const bt_uuid_t * uuid_ptr
A pointer to the UUID of attribute type.
Definition: bt_gatts.h:236
128-bit primary service structure of the GATTS.
Definition: bt_gatts.h:347
const bt_uuid_t BT_GATT_UUID_SECONDARY_SERVICE
UUID for GATT secondary primary service.
#define BT_GATTS_REC_PERM_READABLE
The record is readable without any security requirement.
Definition: bt_gatts.h:170
bt_gatts_service_rec_t rec_hdr
The record, which is the basic element of a service or characteristic.
Definition: bt_gatts.h:349

This macro creates a 128-bit secondary service.

Parameters
[in]nameis the name of the record.
[in]uuid128_valueis the 128-bit secondary service UUID.
#define BT_GATTS_NEW_SECONDARY_SERVICE_16 (   name,
  uuid16_value 
)
Value:
static const bt_gatts_secondary_service_16_t name = { \
.rec_hdr.perm = BT_GATTS_REC_PERM_READABLE, \
.rec_hdr.value_len = 2, \
.uuid16 = uuid16_value \
}
16-bit primary service structure of the GATTS.
Definition: bt_gatts.h:333
const bt_uuid_t * uuid_ptr
A pointer to the UUID of attribute type.
Definition: bt_gatts.h:236
const bt_uuid_t BT_GATT_UUID_SECONDARY_SERVICE
UUID for GATT secondary primary service.
#define BT_GATTS_REC_PERM_READABLE
The record is readable without any security requirement.
Definition: bt_gatts.h:170
bt_gatts_service_rec_t rec_hdr
The record, which is the basic element of a service or characteristic.
Definition: bt_gatts.h:335

This macro creates a 16-bit secondary service.

Parameters
[in]nameis the name of the record.
[in]uuid16_valueis the 16-bit secondary service UUID.
#define BT_GATTS_NEW_SERVER_CHARC_CONFIG (   name,
  _perm,
  _callback 
)
Value:
.rec_hdr.perm = _perm, \
.rec_hdr.value_len = 0, \
.callback = _callback \
}
const bt_uuid_t * uuid_ptr
A pointer to the UUID of attribute type.
Definition: bt_gatts.h:236
bt_gatts_service_rec_t rec_hdr
The record, which is the basic element of a service or characteristic.
Definition: bt_gatts.h:440
Client characteristic configuration descriptor structure of the GATTS.
Definition: bt_gatts.h:438
const bt_uuid_t BT_GATT_UUID_SERVER_CHARC_CONFIG
UUID for GATT server characteristic configuration.

This macro creates a server characteristic configuration descriptor.

Parameters
[in]nameis the name of the record.
[in]_permis the permission of the record.
[in]_callbackis the callback to handle the record read and write request.
#define BT_GATTS_REC_PERM_READ_MASK   0xf0

Read the permission mask.

#define BT_GATTS_REC_PERM_READ_SHIFT (   mask)    ((mask)<<4)

Note, when creating a record, the application should synchronize the record's permission and characteristic properties to be read out by the client.

When the client requests to read or write the record, the Bluetooth stack checks this permission.Read the permission mask shift.

#define BT_GATTS_REC_PERM_READABLE   0x80

The record is readable without any security requirement.

#define BT_GATTS_REC_PERM_READABLE_AUTHENTICATION   (BT_GATTS_REC_PERM_READABLE | (BT_GATTS_REC_PERM_READ_SHIFT(BT_GAP_LE_SECURITY_AUTHENTICATION_MASK)))

The record is readable only for the authenticated connection.

#define BT_GATTS_REC_PERM_READABLE_AUTHORIZATION   (BT_GATTS_REC_PERM_READABLE | (BT_GATTS_REC_PERM_READ_SHIFT(BT_GAP_LE_SECURITY_AUTHORIZATION_MASK)))

The record is readable only after the application is granted a permission.

#define BT_GATTS_REC_PERM_READABLE_ENCRYPTION   (BT_GATTS_REC_PERM_READABLE | (BT_GATTS_REC_PERM_READ_SHIFT(BT_GAP_LE_SECURITY_ENCRYPTION_MASK)))

The record is readable when the connection is encrypted.

#define BT_GATTS_REC_PERM_WRITABLE   0x08

The record is writable without any security requirement.

#define BT_GATTS_REC_PERM_WRITABLE_AUTHENTICATION   (BT_GATTS_REC_PERM_WRITABLE | (BT_GATTS_REC_PERM_WRITE_SHIFT(BT_GAP_LE_SECURITY_AUTHENTICATION_MASK)))

The record is writable only for the authenticated connection.

#define BT_GATTS_REC_PERM_WRITABLE_AUTHORIZATION   (BT_GATTS_REC_PERM_WRITABLE | (BT_GATTS_REC_PERM_WRITE_SHIFT(BT_GAP_LE_SECURITY_AUTHORIZATION_MASK)))

The record is writable only after the application is granted a permission.

#define BT_GATTS_REC_PERM_WRITABLE_ENCRYPTION   (BT_GATTS_REC_PERM_WRITABLE | (BT_GATTS_REC_PERM_WRITE_SHIFT(BT_GAP_LE_SECURITY_ENCRYPTION_MASK)))

The record is writable when the connection is encrypted.

#define BT_GATTS_REC_PERM_WRITE_MASK   0x0f

Write the permission mask.

#define BT_GATTS_REC_PERM_WRITE_SHIFT (   mask)    ((mask)<<0)

Write the permission mask shift.