MT2523 API Reference  LinkIt SDK v4
GATTS Service

This section provides APIs to set GAP service and characteristics information, such as device name, appearance, peripheral preferred connection parameters and central address resolution. More...

Overview

This section provides APIs to set GAP service and characteristics information, such as device name, appearance, peripheral preferred connection parameters and central address resolution.

Terms and Acronyms

Terms Details
GAP Generic Access Profile. This profile defines the generic procedures related to discovery of Bluetooth enabled devices and link management aspects of connecting to the Bluetooth enabled devices. It also defines procedures related to the use of different security levels.
GATTS GATT Server, is the device that accepts incoming commands and requests from the GATT client.
PPCP Peripheral Preferred Connection Parameters, contains the preferred connection parameters of Peripheral.

How to use this module

Functions

void bt_gatts_service_init (void)
 This function initializes the GATTS service. More...
 
bt_status_t bt_gatts_service_set_gap_device_name (const uint8_t *device_name, uint16_t length)
 This function sets Device Name Characteristic. More...
 
const uint8_t * bt_gatts_service_get_gap_device_name (void)
 This function gets the current Device Name Characteristic value. More...
 
void bt_gatts_service_set_gap_appearance (uint16_t appearance)
 This function sets Appearance Characteristic. More...
 
bt_status_t bt_gatts_service_set_gap_ppcp (bt_gatts_le_gap_ppcp_t *ppcp_param)
 This function sets Peripheral Preferred Connection Parameters Characteristic. More...
 
bt_status_t bt_gatts_service_set_gap_central_address_resolution (uint8_t flag)
 This function sets Central Address Resolution Characteristic. More...
 

Variables

const bt_gatts_service_t bt_if_gatt_service
 
const bt_gatts_service_t bt_if_gap_service
 

Modules

 Struct
 This section defines structures for the GATTS service.
 

Function Documentation

const uint8_t* bt_gatts_service_get_gap_device_name ( void  )

This function gets the current Device Name Characteristic value.

Parameters
[in]void.
Returns
device name is a pointer to a UTF-8 encoded string.
void bt_gatts_service_init ( void  )

This function initializes the GATTS service.

It is recommended to call this API once during the bootup.

Parameters
[in]void.
Returns
void.
void bt_gatts_service_set_gap_appearance ( uint16_t  appearance)

This function sets Appearance Characteristic.

It should be called after bt_gatts_service_init().

Parameters
[in]appearanceis the Appearance Characteristic value, it shall be 2 octets in length.
Returns
void.
bt_status_t bt_gatts_service_set_gap_central_address_resolution ( uint8_t  flag)

This function sets Central Address Resolution Characteristic.

It should be called after bt_gatts_service_init(). This function should be called by Central role only to define whether the device supports privacy with the address resolution.

Parameters
[in]flagis a 1 octet value, 0 means the address resolution is not supported in this device, 1 means the address solution is supported in this device, the reserved value range is from 2 to 255.
Returns
BT_STATUS_SUCCESS, the resolution is set successfully. BT_STATUS_FAIL, the resolution failed to set, an invalid parameter is supplied.
bt_status_t bt_gatts_service_set_gap_device_name ( const uint8_t *  device_name,
uint16_t  length 
)

This function sets Device Name Characteristic.

It should be called after bt_gatts_service_init().

Parameters
[in]device_nameis a pointer to a UTF-8 encoded string.
[in]lengthis the length of a UTF-8 string pointed to by device_name in octets (shall be 0 to 248 octets).
Returns
BT_STATUS_SUCCESS, the device name is set successfully. BT_STATUS_FAIL, the device name failed to set, a NULL pointer or invalid length is supplied.
bt_status_t bt_gatts_service_set_gap_ppcp ( bt_gatts_le_gap_ppcp_t ppcp_param)

This function sets Peripheral Preferred Connection Parameters Characteristic.

It should be called after (). This function should be called by Peripheral role only to set the Peripheral Preferred Connection Parameters.

Parameters
[in]ppcp_paramis a pointer to the bt_gatts_le_gap_ppcp_t structure with the desired parameter.
Returns
BT_STATUS_SUCCESS, the PPCP value is set successfully. BT_STATUS_FAIL, the PPCP value failed to set, an invalid parameter is supplied.