BlueNRG-MS pack for STM32CubeMX: GATT functions

STM32CubeMX BlueNRG-MS

BlueNRG-MS pack for STM32CubeMX  V4.4.0
The BlueNRG-MS pack is an additional software for STM32CubeMX.

API for GATT layer. More...

Functions

tBleStatus aci_gatt_init (void)
 Initialize the GATT layer for server and client roles. More...
 
tBleStatus aci_gatt_add_serv (uint8_t service_uuid_type, const uint8_t *service_uuid, uint8_t service_type, uint8_t max_attr_records, uint16_t *serviceHandle)
 Add a service to the GATT Server. When a service is created in the server, the Host needs to reserve the handle ranges for this service using max_attr_records parameter. This parameter specifies the maximum number of attribute records that can be added to this service (including the service attribute, include attribute, characteristic attribute, characteristic value attribute and characteristic descriptor attribute). Handle of the created service is returned. More...
 
tBleStatus aci_gatt_include_service (uint16_t service_handle, uint16_t included_start_handle, uint16_t included_end_handle, uint8_t included_uuid_type, const uint8_t *included_uuid, uint16_t *included_handle)
 Include a service given by included_start_handle and included_end_handle to another service given by service_handle. Attribute server creates an INCLUDE definition attribute and return the handle of this attribute in included_handle. More...
 
tBleStatus aci_gatt_add_char (uint16_t serviceHandle, uint8_t charUuidType, const uint8_t *charUuid, uint8_t charValueLen, uint8_t charProperties, uint8_t secPermissions, uint8_t gattEvtMask, uint8_t encryKeySize, uint8_t isVariable, uint16_t *charHandle)
 Add a characteristic to a service. More...
 
tBleStatus aci_gatt_add_char_desc (uint16_t serviceHandle, uint16_t charHandle, uint8_t descUuidType, const uint8_t *uuid, uint8_t descValueMaxLen, uint8_t descValueLen, const void *descValue, uint8_t secPermissions, uint8_t accPermissions, uint8_t gattEvtMask, uint8_t encryKeySize, uint8_t isVariable, uint16_t *descHandle)
 
tBleStatus aci_gatt_update_char_value (uint16_t servHandle, uint16_t charHandle, uint8_t charValOffset, uint8_t charValueLen, const void *charValue)
 Update a characteristic value in a service. More...
 
tBleStatus aci_gatt_del_char (uint16_t servHandle, uint16_t charHandle)
 Delete the specified characteristic from the service. More...
 
tBleStatus aci_gatt_del_service (uint16_t servHandle)
 Delete the specified service from the GATT server database. More...
 
tBleStatus aci_gatt_del_include_service (uint16_t servHandle, uint16_t includeServHandle)
 Delete the Include definition from the service. More...
 
tBleStatus aci_gatt_exchange_configuration (uint16_t conn_handle)
 Perform an ATT MTU exchange procedure. More...
 
tBleStatus aci_att_find_information_req (uint16_t conn_handle, uint16_t start_handle, uint16_t end_handle)
 Send a Find Information Request. More...
 
tBleStatus aci_att_find_by_type_value_req (uint16_t conn_handle, uint16_t start_handle, uint16_t end_handle, uint8_t *uuid, uint8_t attr_val_len, uint8_t *attr_val)
 Send a Find By Type Value Request. More...
 
tBleStatus aci_att_read_by_type_req (uint16_t conn_handle, uint16_t start_handle, uint16_t end_handle, uint8_t uuid_type, uint8_t *uuid)
 Send a Read By Type Request. More...
 
tBleStatus aci_att_read_by_group_type_req (uint16_t conn_handle, uint16_t start_handle, uint16_t end_handle, uint8_t uuid_type, uint8_t *uuid)
 Send a Read By Group Type Request. More...
 
tBleStatus aci_att_prepare_write_req (uint16_t conn_handle, uint16_t attr_handle, uint16_t value_offset, uint8_t attr_val_len, uint8_t *attr_val)
 Send a Prepare Write Request. More...
 
tBleStatus aci_att_execute_write_req (uint16_t conn_handle, uint8_t execute)
 Send an Execute Write Request. More...
 
tBleStatus aci_gatt_disc_all_prim_services (uint16_t conn_handle)
 This command will start the GATT client procedure to discover all primary services on the server. More...
 
tBleStatus aci_gatt_disc_prim_service_by_uuid (uint16_t conn_handle, uint8_t uuid_type, uint8_t *uuid)
 Start the procedure to discover the primary services of the specified UUID on the server. More...
 
tBleStatus aci_gatt_find_included_services (uint16_t conn_handle, uint16_t start_handle, uint16_t end_handle)
 Start the procedure to find all included services. More...
 
tBleStatus aci_gatt_disc_all_charac_of_serv (uint16_t conn_handle, uint16_t start_attr_handle, uint16_t end_attr_handle)
 Start the procedure to discover all the characteristics of a given service. More...
 
tBleStatus aci_gatt_disc_charac_by_uuid (uint16_t conn_handle, uint16_t start_handle, uint16_t end_handle, uint8_t uuid_type, const uint8_t *uuid)
 Start the procedure to discover all the characteristics specified by a UUID. More...
 
tBleStatus aci_gatt_disc_all_charac_descriptors (uint16_t conn_handle, uint16_t char_val_handle, uint16_t char_end_handle)
 Start the procedure to discover all characteristic descriptors on the server. More...
 
tBleStatus aci_gatt_read_charac_val (uint16_t conn_handle, uint16_t attr_handle)
 Start the procedure to read the attribute value. More...
 
tBleStatus aci_gatt_read_using_charac_uuid (uint16_t conn_handle, uint16_t start_handle, uint16_t end_handle, uint8_t uuid_type, uint8_t *uuid)
 Start the procedure to read all the characteristics specified by the UUID. More...
 
tBleStatus aci_gatt_read_long_charac_val (uint16_t conn_handle, uint16_t attr_handle, uint16_t val_offset)
 Start the procedure to read a long characteristic value. More...
 
tBleStatus aci_gatt_read_multiple_charac_val (uint16_t conn_handle, uint8_t num_handles, uint8_t *set_of_handles)
 Start a procedure to read multiple characteristic values from a server. More...
 
tBleStatus aci_gatt_write_charac_value (uint16_t conn_handle, uint16_t attr_handle, uint8_t value_len, uint8_t *attr_value)
 Start the procedure to write a characteristic value. More...
 
tBleStatus aci_gatt_write_long_charac_val (uint16_t conn_handle, uint16_t attr_handle, uint16_t val_offset, uint8_t val_len, const uint8_t *attr_val)
 Start the procedure to write a long characteristic value. More...
 
tBleStatus aci_gatt_write_charac_reliable (uint16_t conn_handle, uint16_t attr_handle, uint16_t val_offset, uint8_t val_len, uint8_t *attr_val)
 Start the procedure to write a characteristic reliably. More...
 
tBleStatus aci_gatt_write_long_charac_desc (uint16_t conn_handle, uint16_t attr_handle, uint16_t val_offset, uint8_t val_len, uint8_t *attr_val)
 Start the procedure to write a long characteristic descriptor. More...
 
tBleStatus aci_gatt_read_long_charac_desc (uint16_t conn_handle, uint16_t attr_handle, uint16_t val_offset)
 Start the procedure to read a long characteristic value. More...
 
tBleStatus aci_gatt_write_charac_descriptor (uint16_t conn_handle, uint16_t attr_handle, uint8_t value_len, uint8_t *attr_value)
 Start the procedure to write a characteristic descriptor. More...
 
tBleStatus aci_gatt_read_charac_desc (uint16_t conn_handle, uint16_t attr_handle)
 Start the procedure to read the descriptor specified. More...
 
tBleStatus aci_gatt_write_without_response (uint16_t conn_handle, uint16_t attr_handle, uint8_t val_len, const uint8_t *attr_val)
 Start the procedure to write a characteristic value without waiting for any response from the server. More...
 
tBleStatus aci_gatt_signed_write_without_resp (uint16_t conn_handle, uint16_t attr_handle, uint8_t val_len, uint8_t *attr_val)
 Start a signed write without response from the server. More...
 
tBleStatus aci_gatt_confirm_indication (uint16_t conn_handle)
 Confirm an indication. More...
 
tBleStatus aci_gatt_write_response (uint16_t conn_handle, uint16_t attr_handle, uint8_t write_status, uint8_t err_code, uint8_t att_val_len, uint8_t *att_val)
 Allow or reject a write request from a client. More...
 
tBleStatus aci_gatt_allow_read (uint16_t conn_handle)
 Allow the GATT server to send a response to a read request from a client. More...
 
tBleStatus aci_gatt_set_security_permission (uint16_t service_handle, uint16_t attr_handle, uint8_t security_permission)
 Set the security permission for the attribute handle specified. More...
 
tBleStatus aci_gatt_set_desc_value (uint16_t servHandle, uint16_t charHandle, uint16_t charDescHandle, uint16_t charDescValOffset, uint8_t charDescValueLen, const void *charDescValue)
 This command sets the value of the descriptor specified by charDescHandle. More...
 
tBleStatus aci_gatt_read_handle_value (uint16_t attr_handle, uint16_t data_len, uint16_t *data_len_out_p, uint8_t *data)
 Reads the value of the attribute handle specified from the local GATT database. More...
 
tBleStatus aci_gatt_read_handle_value_offset_IDB05A1 (uint16_t attr_handle, uint8_t offset, uint16_t data_len, uint16_t *data_len_out_p, uint8_t *data)
 Reads the value of the attribute handle specified from the local GATT database, starting from a given offset. More...
 
tBleStatus aci_gatt_update_char_value_ext_IDB05A1 (uint16_t service_handle, uint16_t char_handle, uint8_t update_type, uint16_t char_length, uint16_t value_offset, uint8_t value_length, const uint8_t *value)
 Update the value of a characteristic and sends notifications or indications. More...
 
tBleStatus aci_gatt_set_event_mask (uint32_t event_mask)
 

Detailed Description

API for GATT layer.

Function Documentation

◆ aci_att_execute_write_req()

tBleStatus aci_att_execute_write_req ( uint16_t  conn_handle,
uint8_t  execute 
)

Send an Execute Write Request.

Note
The Execute Write Request is used to request the server to write or cancel the write of all the prepared values currently held in the prepare queue from this client. The result of the procedure is given through the EVT_BLUE_ATT_EXEC_WRITE_RESP event. The end of the procedure is indicated by a EVT_BLUE_GATT_PROCEDURE_COMPLETE event.
Parameters
conn_handleConnection handle for which the command is given.
execute
  • 0x00 – Cancel all prepared writes
  • 0x01 – Immediately write all pending prepared values.
Returns
Value indicating success or error code.

◆ aci_att_find_by_type_value_req()

tBleStatus aci_att_find_by_type_value_req ( uint16_t  conn_handle,
uint16_t  start_handle,
uint16_t  end_handle,
uint8_t *  uuid,
uint8_t  attr_val_len,
uint8_t *  attr_val 
)

Send a Find By Type Value Request.

Note
The Find By Type Value Request is used to obtain the handles of attributes that have a given 16-bit UUID attribute type and a given attribute value. The responses of the procedure are given through the EVT_BLUE_ATT_FIND_BY_TYPE_VAL_RESP event. The end of the procedure is indicated by a EVT_BLUE_GATT_PROCEDURE_COMPLETE event.
Parameters
conn_handleConnection handle for which the command is given.
start_handleFirst requested handle number
end_handleLast requested handle number
uuid2 octet UUID to find (little-endian)
attr_val_lenLength of attribute value (maximum value is ATT_MTU - 7).
attr_valAttribute value to find
Returns
Value indicating success or error code.

◆ aci_att_find_information_req()

tBleStatus aci_att_find_information_req ( uint16_t  conn_handle,
uint16_t  start_handle,
uint16_t  end_handle 
)

Send a Find Information Request.

Note
This command is used to obtain the mapping of attribute handles with their associated types. The responses of the procedure are given through the EVT_BLUE_ATT_FIND_INFORMATION_RESP event. The end of the procedure is indicated by a EVT_BLUE_GATT_PROCEDURE_COMPLETE event.
Parameters
conn_handleConnection handle for which the command is given
start_handleStarting handle of the range of attributes to be discovered on the server
end_handleEnding handle of the range of attributes to be discovered on the server
Returns
Value indicating success or error code.

◆ aci_att_prepare_write_req()

tBleStatus aci_att_prepare_write_req ( uint16_t  conn_handle,
uint16_t  attr_handle,
uint16_t  value_offset,
uint8_t  attr_val_len,
uint8_t *  attr_val 
)

Send a Prepare Write Request.

Note
The Prepare Write Request is used to request the server to prepare to write the value of an attribute. The responses of the procedure are given through the EVT_BLUE_ATT_PREPARE_WRITE_RESP event. The end of the procedure is indicated by a EVT_BLUE_GATT_PROCEDURE_COMPLETE.
Parameters
conn_handleConnection handle for which the command is given.
attr_handleThe handle of the attribute to be written
value_offsetThe offset of the first octet to be written
attr_val_lenLength of attribute value (maximum value is ATT_MTU - 5).
attr_valThe value of the attribute to be written
Returns
Value indicating success or error code.

◆ aci_att_read_by_group_type_req()

tBleStatus aci_att_read_by_group_type_req ( uint16_t  conn_handle,
uint16_t  start_handle,
uint16_t  end_handle,
uint8_t  uuid_type,
uint8_t *  uuid 
)

Send a Read By Group Type Request.

Note
The Read By Group Type Request is used to obtain the values of grouping attributes where the attribute type is known but the handle is not known. Grouping attributes are defined at GATT layer. The grouping attribute types are: «Primary Service», «Secondary Service» and «Characteristic». The responses of the procedure are given through the EVT_BLUE_ATT_READ_BY_GROUP_TYPE_RESP event. The end of the procedure is indicated by a EVT_BLUE_GATT_PROCEDURE_COMPLETE.
Parameters
conn_handleConnection handle for which the command is given.
start_handleFirst requested handle number
end_handleLast requested handle number
uuid_type
uuid2 or 16 octet UUID
Returns
Value indicating success or error code.

◆ aci_att_read_by_type_req()

tBleStatus aci_att_read_by_type_req ( uint16_t  conn_handle,
uint16_t  start_handle,
uint16_t  end_handle,
uint8_t  uuid_type,
uint8_t *  uuid 
)

Send a Read By Type Request.

Note
The Read By Type Request is used to obtain the values of attributes where the attribute type is known but the handle is not known. The responses of the procedure are given through the EVT_BLUE_ATT_READ_BY_TYPE_RESP event. The end of the procedure is indicated by a EVT_BLUE_GATT_PROCEDURE_COMPLETE event.
Parameters
conn_handleConnection handle for which the command is given.
start_handleFirst requested handle number
end_handleLast requested handle number
uuid_type
uuid2 or 16 octet UUID
Returns
Value indicating success or error code.

◆ aci_gatt_add_char()

tBleStatus aci_gatt_add_char ( uint16_t  serviceHandle,
uint8_t  charUuidType,
const uint8_t *  charUuid,
uint8_t  charValueLen,
uint8_t  charProperties,
uint8_t  secPermissions,
uint8_t  gattEvtMask,
uint8_t  encryKeySize,
uint8_t  isVariable,
uint16_t *  charHandle 
)

Add a characteristic to a service.

Parameters
serviceHandleHandle of the service to which the characteristic has to be added.
charUuidTypeType of characteristic UUID (16-bit or 128-bit). See UUID Types.
charUuid16-bit or 128-bit UUID.
charValueLenMaximum length of the characteristic value.
charPropertiesBitwise OR values of Characteristic Properties (defined in Volume 3, Section 3.3.3.1 of Bluetooth Specification 4.0). See Characteristic properties.
secPermissionsSecurity permissions for the added characteristic. See Security permissions.
  • ATTR_PERMISSION_NONE
  • ATTR_PERMISSION_AUTHEN_READ
  • ATTR_PERMISSION_AUTHOR_READ
  • ATTR_PERMISSION_ENCRY_READ
  • ATTR_PERMISSION_AUTHEN_WRITE
  • ATTR_PERMISSION_AUTHOR_WRITE
  • ATTR_PERMISSION_ENCRY_WRITE
gattEvtMaskBit mask that enables events that will be sent to the application by the GATT server on certain ATT requests. See Gatt Event Mask.
  • GATT_DONT_NOTIFY_EVENTS
  • GATT_NOTIFY_ATTRIBUTE_WRITE
  • GATT_NOTIFY_WRITE_REQ_AND_WAIT_FOR_APPL_RESP
  • GATT_NOTIFY_READ_REQ_AND_WAIT_FOR_APPL_RESP
encryKeySizeThe minimum encryption key size requirement for this attribute. Valid Range: 7 to 16.
isVariableIf the attribute has a variable length value field (1) or not (0).
charHandleHandle of the Characteristic that has been added. It is the handle of the characteristic declaration. The attribute that holds the characteristic value is allocated at the next handle, followed by the Client Characteristic Configuration descriptor if the characteristic has CHAR_PROP_NOTIFY or CHAR_PROP_INDICATE properties.
Returns
Value indicating success or error code.

◆ aci_gatt_add_char_desc()

tBleStatus aci_gatt_add_char_desc ( uint16_t  serviceHandle,
uint16_t  charHandle,
uint8_t  descUuidType,
const uint8_t *  uuid,
uint8_t  descValueMaxLen,
uint8_t  descValueLen,
const void *  descValue,
uint8_t  secPermissions,
uint8_t  accPermissions,
uint8_t  gattEvtMask,
uint8_t  encryKeySize,
uint8_t  isVariable,
uint16_t *  descHandle 
)

Add a characteristic descriptor to a service.

Parameters
serviceHandleHandle of the service to which the characteristic belongs
charHandleHandle of the characteristic to which description has to be added.
descUuidType16-bit or 128-bit UUID. See UUID Types.
[in]uuidUUID of the Characteristic descriptor. It can be one of the UUID assigned by Bluetooth SIG (Well_known_UUIDs) or a user-defined one.
descValueMaxLenThe maximum length of the descriptor value
descValueLenCurrent Length of the characteristic descriptor value
[in]descValueValue of the characteristic description
secPermissionsSecurity permissions for the added descriptor. See Security permissions.
  • ATTR_PERMISSION_NONE
  • ATTR_PERMISSION_AUTHEN_READ
  • ATTR_PERMISSION_AUTHOR_READ
  • ATTR_PERMISSION_ENCRY_READ
  • ATTR_PERMISSION_AUTHEN_WRITE
  • ATTR_PERMISSION_AUTHOR_WRITE
  • ATTR_PERMISSION_ENCRY_WRITE
accPermissionsAccess permissions for the added descriptor. See Access permissions.
  • ATTR_NO_ACCESS
  • ATTR_ACCESS_READ_ONLY
  • ATTR_ACCESS_WRITE_REQ_ONLY
  • ATTR_ACCESS_READ_WRITE
  • ATTR_ACCESS_WRITE_WITHOUT_RESPONSE
  • ATTR_ACCESS_SIGNED_WRITE_ALLOWED
gattEvtMaskBit mask that enables events that will be sent to the application by the GATT server on certain ATT requests. See Gatt Event Mask.
encryKeySizeThe minimum encryption key size requirement for this attribute. Valid Range: 7 to 16.
isVariableIf the attribute has a variable length value field (1) or not (0).
[out]descHandleHandle of the Characteristic Descriptor.
Returns
Value indicating success or error code.

◆ aci_gatt_add_serv()

tBleStatus aci_gatt_add_serv ( uint8_t  service_uuid_type,
const uint8_t *  service_uuid,
uint8_t  service_type,
uint8_t  max_attr_records,
uint16_t *  serviceHandle 
)

Add a service to the GATT Server. When a service is created in the server, the Host needs to reserve the handle ranges for this service using max_attr_records parameter. This parameter specifies the maximum number of attribute records that can be added to this service (including the service attribute, include attribute, characteristic attribute, characteristic value attribute and characteristic descriptor attribute). Handle of the created service is returned.

Note
Service declaration is taken from the service pool. The attributes for characteristics and descriptors are allocated from the attribute pool.
Parameters
service_uuid_typeType of service UUID (16-bit or 128-bit). See UUID Types.
[in]service_uuid16-bit or 128-bit UUID based on the UUID Type field
service_typePrimary or secondary service. See Service Type.
max_attr_recordsMaximum number of attribute records that can be added to this service (including the service declaration itself)
[out]serviceHandleHandle of the Service. When this service is added to the service, a handle is allocated by the server to this service. Server also allocates a range of handles for this service from serviceHandle to <serviceHandle + max_attr_records>.
Returns
Value indicating success or error code.

◆ aci_gatt_allow_read()

tBleStatus aci_gatt_allow_read ( uint16_t  conn_handle)

Allow the GATT server to send a response to a read request from a client.

Note
The application has to send this command when it receives the EVT_BLUE_GATT_READ_PERMIT_REQ or EVT_BLUE_GATT_READ_MULTI_PERMIT_REQ. This command indicates to the stack that the response can be sent to the client. So if the application wishes to update any of the attributes before they are read by the client, it has to update the characteristic values using the aci_gatt_update_char_value and then give this command. The application should perform the required operations within 30 seconds, otherwise the GATT procedure will go to timeout.
Parameters
conn_handleConnection handle for which the command is given.
Returns
Value indicating success or error code.

◆ aci_gatt_confirm_indication()

tBleStatus aci_gatt_confirm_indication ( uint16_t  conn_handle)

Confirm an indication.

Note
This command has to be sent when the application receives the event EVT_BLUE_GATT_INDICATION.
Parameters
conn_handleConnection handle for which the command is given.
Returns
Value indicating success or error code.

◆ aci_gatt_del_char()

tBleStatus aci_gatt_del_char ( uint16_t  servHandle,
uint16_t  charHandle 
)

Delete the specified characteristic from the service.

Parameters
servHandleHandle of the service to which characteristic belongs
charHandleHandle of the characteristic to be deleted
Returns
Value indicating success or error code.

◆ aci_gatt_del_include_service()

tBleStatus aci_gatt_del_include_service ( uint16_t  servHandle,
uint16_t  includeServHandle 
)

Delete the Include definition from the service.

Parameters
servHandleHandle of the service to which Include definition belongs
includeServHandleHandle of the Included definition to be deleted
Returns
Value indicating success or error code.

◆ aci_gatt_del_service()

tBleStatus aci_gatt_del_service ( uint16_t  servHandle)

Delete the specified service from the GATT server database.

Parameters
servHandleHandle of the service to be deleted
Returns
Value indicating success or error code.

◆ aci_gatt_disc_all_charac_descriptors()

tBleStatus aci_gatt_disc_all_charac_descriptors ( uint16_t  conn_handle,
uint16_t  char_val_handle,
uint16_t  char_end_handle 
)

Start the procedure to discover all characteristic descriptors on the server.

Note
When the procedure is completed, a EVT_BLUE_GATT_PROCEDURE_COMPLETE event is generated. Before procedure completion the response packets are given through EVT_BLUE_ATT_FIND_INFORMATION_RESP event.
Parameters
conn_handleConnection handle for which the command is given.
char_val_handleStarting handle of the characteristic
char_end_handleEnd handle of the characteristic
Returns
Value indicating success or error code.

◆ aci_gatt_disc_all_charac_of_serv()

tBleStatus aci_gatt_disc_all_charac_of_serv ( uint16_t  conn_handle,
uint16_t  start_attr_handle,
uint16_t  end_attr_handle 
)

Start the procedure to discover all the characteristics of a given service.

Note
When the procedure is completed, a EVT_BLUE_GATT_PROCEDURE_COMPLETE event is generated. Before procedure completion the response packets are given through EVT_BLUE_ATT_READ_BY_TYPE_RESP event.
Parameters
conn_handleConnection handle for which the command is given
start_attr_handleStart attribute handle of the service
end_attr_handleEnd attribute handle of the service
Returns
Value indicating success or error code.

◆ aci_gatt_disc_all_prim_services()

tBleStatus aci_gatt_disc_all_prim_services ( uint16_t  conn_handle)

This command will start the GATT client procedure to discover all primary services on the server.

Note
The responses of the procedure are given through the EVT_BLUE_ATT_READ_BY_GROUP_TYPE_RESP event. The end of the procedure is indicated by a EVT_BLUE_GATT_PROCEDURE_COMPLETE event.
Parameters
conn_handleConnection handle for which the command is given.
Returns
Value indicating success or error code.

◆ aci_gatt_disc_charac_by_uuid()

tBleStatus aci_gatt_disc_charac_by_uuid ( uint16_t  conn_handle,
uint16_t  start_handle,
uint16_t  end_handle,
uint8_t  uuid_type,
const uint8_t *  uuid 
)

Start the procedure to discover all the characteristics specified by a UUID.

Note
When the procedure is completed, a EVT_BLUE_GATT_PROCEDURE_COMPLETE event is generated. Before procedure completion the response packets are given through EVT_BLUE_GATT_DISC_READ_CHAR_BY_UUID_RESP event.
Parameters
conn_handleConnection handle for which the command is given
start_handleStart attribute handle of the service
end_handleEnd attribute handle of the service
uuid_type
uuid2 or 16 octet UUID
Returns
Value indicating success or error code.

◆ aci_gatt_disc_prim_service_by_uuid()

tBleStatus aci_gatt_disc_prim_service_by_uuid ( uint16_t  conn_handle,
uint8_t  uuid_type,
uint8_t *  uuid 
)

Start the procedure to discover the primary services of the specified UUID on the server.

Note
The responses of the procedure are given through the EVT_BLUE_ATT_FIND_BY_TYPE_VAL_RESP event. The end of the procedure is indicated by a EVT_BLUE_GATT_PROCEDURE_COMPLETE event.
Parameters
conn_handleConnection handle for which the command is given.
uuid_type
uuid2 or 16 octet UUID
Returns
Value indicating success or error code.

◆ aci_gatt_exchange_configuration()

tBleStatus aci_gatt_exchange_configuration ( uint16_t  conn_handle)

Perform an ATT MTU exchange procedure.

Note
When the ATT MTU exchange procedure is completed, a EVT_BLUE_ATT_EXCHANGE_MTU_RESP event is generated. A EVT_BLUE_GATT_PROCEDURE_COMPLETE event is also generated to indicate the end of the procedure.
Parameters
conn_handleConnection handle for which the command is given.
Returns
Value indicating success or error code.

◆ aci_gatt_find_included_services()

tBleStatus aci_gatt_find_included_services ( uint16_t  conn_handle,
uint16_t  start_handle,
uint16_t  end_handle 
)

Start the procedure to find all included services.

Note
The responses of the procedure are given through the EVT_BLUE_ATT_READ_BY_TYPE_RESP event. The end of the procedure is indicated by a EVT_BLUE_GATT_PROCEDURE_COMPLETE event.
Parameters
conn_handleConnection handle for which the command is given.
start_handleStart handle of the service
end_handleEnd handle of the service
Returns
Value indicating success or error code.

◆ aci_gatt_include_service()

tBleStatus aci_gatt_include_service ( uint16_t  service_handle,
uint16_t  included_start_handle,
uint16_t  included_end_handle,
uint8_t  included_uuid_type,
const uint8_t *  included_uuid,
uint16_t *  included_handle 
)

Include a service given by included_start_handle and included_end_handle to another service given by service_handle. Attribute server creates an INCLUDE definition attribute and return the handle of this attribute in included_handle.

Parameters
service_handleHandle of the service to which another service has to be included
included_start_handleStart Handle of the service which has to be included in service
included_end_handleEnd Handle of the service which has to be included in service
included_uuid_typeType of UUID for included service (16-bit or 128-bit). See Well-Known UUIDs.
[in]included_uuid16-bit or 128-bit UUID.
[out]included_handleHandle of the include declaration.
Returns
Value indicating success or error code.

◆ aci_gatt_init()

tBleStatus aci_gatt_init ( void  )

Initialize the GATT layer for server and client roles.

Note
It adds also the GATT service with Service Changed Characteristic. Until this command is issued the GATT channel will not process any commands even if the connection is opened. This command has to be given before using any of the GAP features.
Returns
Value indicating success or error code.

◆ aci_gatt_read_charac_desc()

tBleStatus aci_gatt_read_charac_desc ( uint16_t  conn_handle,
uint16_t  attr_handle 
)

Start the procedure to read the descriptor specified.

Note
When the procedure is completed, a EVT_BLUE_GATT_PROCEDURE_COMPLETE event is generated. Before procedure completion the response packet is given through EVT_BLUE_ATT_READ_RESP event.
Parameters
conn_handleConnection handle for which the command is given
attr_handleHandle of the descriptor to be read
Returns
Value indicating success or error code.

◆ aci_gatt_read_charac_val()

tBleStatus aci_gatt_read_charac_val ( uint16_t  conn_handle,
uint16_t  attr_handle 
)

Start the procedure to read the attribute value.

Note
When the procedure is completed, a EVT_BLUE_GATT_PROCEDURE_COMPLETE event is generated. Before procedure completion the response packet is given through EVT_BLUE_ATT_READ_RESP event.
Parameters
conn_handleConnection handle for which the command is given
attr_handleHandle of the characteristic to be read
Returns
Value indicating success or error code.
It can be BLE_STATUS_NOT_ALLOWED in the following cases:
  • If the exchange has already taken place
  • If GATT is expecting response for previous request
  • Already a request is in the queue to be sent
  • Channel not open
  • Already one GATT procedure is started

◆ aci_gatt_read_handle_value()

tBleStatus aci_gatt_read_handle_value ( uint16_t  attr_handle,
uint16_t  data_len,
uint16_t *  data_len_out_p,
uint8_t *  data 
)

Reads the value of the attribute handle specified from the local GATT database.

Parameters
attr_handleHandle of the attribute to read
data_lenLength of the data buffer.
[out]data_len_out_pLength of the read attribute.
[out]dataPointer to the buffer that will contain the read value. The buffer will be filled with the attribute value. The length will be the minimum between the provided data_len and the actual length of the attribute (in data_len_out_p).
Returns
Value indicating success or error code.

◆ aci_gatt_read_handle_value_offset_IDB05A1()

tBleStatus aci_gatt_read_handle_value_offset_IDB05A1 ( uint16_t  attr_handle,
uint8_t  offset,
uint16_t  data_len,
uint16_t *  data_len_out_p,
uint8_t *  data 
)

Reads the value of the attribute handle specified from the local GATT database, starting from a given offset.

Parameters
attr_handleHandle of the attribute to read
offsetOffset from which the value needs to be read
data_lenLength of the data buffer.
[out]data_len_out_pLength of the read attribute.
[out]dataPointer to the buffer that will contain the read value. The buffer will be filled with the attribute value. The length will be the minimum between the provided data_len and the actual length of the attribute (in data_len_out_p).
Returns
Value indicating success or error code.

◆ aci_gatt_read_long_charac_desc()

tBleStatus aci_gatt_read_long_charac_desc ( uint16_t  conn_handle,
uint16_t  attr_handle,
uint16_t  val_offset 
)

Start the procedure to read a long characteristic value.

Note
When the procedure is completed, a EVT_BLUE_GATT_PROCEDURE_COMPLETE event is generated. Before procedure completion the response packets are given through EVT_BLUE_ATT_READ_BLOB_RESP event.
Parameters
conn_handleConnection handle for which the command is given
attr_handleHandle of the characteristic descriptor
val_offsetOffset from which the value needs to be read
Returns
Value indicating success or error code.

◆ aci_gatt_read_long_charac_val()

tBleStatus aci_gatt_read_long_charac_val ( uint16_t  conn_handle,
uint16_t  attr_handle,
uint16_t  val_offset 
)

Start the procedure to read a long characteristic value.

Note
When the procedure is completed, a EVT_BLUE_GATT_PROCEDURE_COMPLETE event is generated. Before procedure completion the response packets are given through EVT_BLUE_ATT_READ_BLOB_RESP event.
Parameters
conn_handleConnection handle for which the command is given
attr_handleHandle of the characteristic to be read
val_offsetOffset from which the value needs to be read
Returns
Value indicating success or error code.
It can be BLE_STATUS_NOT_ALLOWED in the following cases:
  • If the exchange has already taken place
  • If GATT is expecting response for previous request
  • Already a request is in the queue to be sent
  • Channel not open
  • Already one GATT procedure is started

◆ aci_gatt_read_multiple_charac_val()

tBleStatus aci_gatt_read_multiple_charac_val ( uint16_t  conn_handle,
uint8_t  num_handles,
uint8_t *  set_of_handles 
)

Start a procedure to read multiple characteristic values from a server.

Note
This sub-procedure is used to read multiple Characteristic Values from a server when the client knows the Characteristic Value Handles. When the procedure is completed, a EVT_BLUE_GATT_PROCEDURE_COMPLETE event is generated. Before procedure completion the response packets are given through EVT_BLUE_ATT_READ_MULTIPLE_RESP event.
Parameters
conn_handleConnection handle for which the command is given
num_handlesThe number of handles for which the value has to be read
set_of_handlesThe handles for which the attribute value has to be read
Returns
Value indicating success or error code.

◆ aci_gatt_read_using_charac_uuid()

tBleStatus aci_gatt_read_using_charac_uuid ( uint16_t  conn_handle,
uint16_t  start_handle,
uint16_t  end_handle,
uint8_t  uuid_type,
uint8_t *  uuid 
)

Start the procedure to read all the characteristics specified by the UUID.

Note
When the procedure is completed, a EVT_BLUE_GATT_PROCEDURE_COMPLETE event is generated. Before procedure completion the response packets are given through EVT_BLUE_GATT_DISC_READ_CHAR_BY_UUID_RESP event.
Parameters
conn_handleConnection handle for which the command is given
start_handleStarting handle of the range to be searched
end_handleEnd handle of the range to be searched
uuid_type
uuid2 or 16 octet UUID
Returns
Value indicating success or error code.

◆ aci_gatt_set_desc_value()

tBleStatus aci_gatt_set_desc_value ( uint16_t  servHandle,
uint16_t  charHandle,
uint16_t  charDescHandle,
uint16_t  charDescValOffset,
uint8_t  charDescValueLen,
const void *  charDescValue 
)

This command sets the value of the descriptor specified by charDescHandle.

Parameters
servHandleHandle of the service which contains the descriptor.
charHandleHandle of the characteristic which contains the descriptor.
charDescHandleHandle of the descriptor whose value has to be set.
charDescValOffsetOffset from which the descriptor value has to be updated.
charDescValueLenLength of the descriptor value
[in]charDescValuedescriptor value
Returns
Value indicating success or error code.

◆ aci_gatt_set_event_mask()

tBleStatus aci_gatt_set_event_mask ( uint32_t  event_mask)

◆ aci_gatt_set_security_permission()

tBleStatus aci_gatt_set_security_permission ( uint16_t  service_handle,
uint16_t  attr_handle,
uint8_t  security_permission 
)

Set the security permission for the attribute handle specified.

Note
Currently the setting of security permission is allowed only for client configuration descriptor.
Parameters
service_handleHandle of the service which contains the attribute whose security permission has to be modified.
attr_handleHandle of the attribute whose security permission has to be modified.
security_permissionSecurity permissions for the descriptor. See Security permissions.
  • ATTR_PERMISSION_NONE
  • ATTR_PERMISSION_AUTHEN_READ
  • ATTR_PERMISSION_AUTHOR_READ
  • ATTR_PERMISSION_ENCRY_READ
  • ATTR_PERMISSION_AUTHEN_WRITE
  • ATTR_PERMISSION_AUTHOR_WRITE
  • ATTR_PERMISSION_ENCRY_WRITE
Returns
Value indicating success or error code.

◆ aci_gatt_signed_write_without_resp()

tBleStatus aci_gatt_signed_write_without_resp ( uint16_t  conn_handle,
uint16_t  attr_handle,
uint8_t  val_len,
uint8_t *  attr_val 
)

Start a signed write without response from the server.

Note
The procedure i used to write a characteristic value with an authentication signature without waiting for any response from the server. It cannot be used when the link is encrypted.
Parameters
conn_handleConnection handle for which the command is given
attr_handleHandle of the attribute to be written
val_lenLength of the value to be written (up to ATT_MTU - 13).
attr_valValue to be written
Returns
Value indicating success or error code

◆ aci_gatt_update_char_value()

tBleStatus aci_gatt_update_char_value ( uint16_t  servHandle,
uint16_t  charHandle,
uint8_t  charValOffset,
uint8_t  charValueLen,
const void *  charValue 
)

Update a characteristic value in a service.

Note
If notifications (or indications) are enabled on that characteristic, a notification (or indication) will be sent to the client after sending this command to the BlueNRG. The command is queued into the BlueNRG command queue. If the buffer is full, because previous commands could not be still processed, the function will return BLE_STATUS_INSUFFICIENT_RESOURCES. This will happen if notifications (or indications) are enabled and the application calls aci_gatt_update_char_value() at an higher rate than what is allowed by the link. Throughput on BLE link depends on connection interval and connection length parameters (decided by the master, see aci_l2cap_connection_parameter_update_request() for more info on how to suggest new connection parameters from a slave). If the application does not want to lose notifications because BlueNRG buffer becomes full, it has to retry again till the function returns BLE_STATUS_SUCCESS or any other error code.
Example:
Here if BlueNRG buffer become full because BlueNRG was not able to send packets for a while, some notifications will be lost.
tBleStatus Free_Fall_Notify(void)
{
uint8_t val;
val = 0x01;
ret = aci_gatt_update_char_value(accServHandle, freeFallCharHandle, 0, 1, &val);
if (ret != BLE_STATUS_SUCCESS){
PRINTF("Error while updating FFall characteristic.\n") ;
}
}
Here if BlueNRG buffer become full, the application try again to send the notification.
struct timer t;
Timer_Set(&t, CLOCK_SECOND*10);
while(aci_gatt_update_char_value(chatServHandle,TXCharHandle,0,len,array_val)==BLE_STATUS_INSUFFICIENT_RESOURCES){
// Radio is busy (buffer full).
if(Timer_Expired(&t))
break;
}
Parameters
servHandleHandle of the service to which characteristic belongs
charHandleHandle of the characteristic
charValOffsetThe offset from which the attribute value has to be updated. If this is set to 0, and the attribute value is of variable length, then the length of the attribute will be set to the charValueLen. If the charValOffset is set to a value greater than 0, then the length of the attribute will be set to the maximum length as specified for the attribute while adding the characteristic.
charValueLenLength of the characteristic value in octets
[in]charValueCharacteristic value
Returns
Value indicating success or error code.

◆ aci_gatt_update_char_value_ext_IDB05A1()

tBleStatus aci_gatt_update_char_value_ext_IDB05A1 ( uint16_t  service_handle,
uint16_t  char_handle,
uint8_t  update_type,
uint16_t  char_length,
uint16_t  value_offset,
uint8_t  value_length,
const uint8_t *  value 
)

Update the value of a characteristic and sends notifications or indications.

Note
This command is a more flexible version of ACI_GATT_UPDATE_CHAR_VALUE to support update of long attribute up to 512 bytes and indicate selectively the generation of indications and notifications.
Parameters
service_handleHandle of the service to which the characteristic belongs.
char_handleHandle of the characteristic
update_typeBitmask that controls generation of notifications and indications. It can be a combination
  • NOTIFICATION (0x01): send notification, if enabled.
  • INDICATION (0x02): send indication, if enabled. If set to 0 no notifications or indications are sent.
char_lengthTotal length of the characteristic value. In case of a variable size characteristic, this field specifies the new length of the characteristic value after the update; in case of fixed length characteristic this field is ignored.
value_offsetThe offset from which the attribute value has to be updated
value_lengthLength of the value to be updated
[out]valueUpdated characteristic value
Returns
Value indicating success or error code.

◆ aci_gatt_write_charac_descriptor()

tBleStatus aci_gatt_write_charac_descriptor ( uint16_t  conn_handle,
uint16_t  attr_handle,
uint8_t  value_len,
uint8_t *  attr_value 
)

Start the procedure to write a characteristic descriptor.

Note
When the procedure is completed, a EVT_BLUE_GATT_PROCEDURE_COMPLETE event is generated.
Parameters
conn_handleConnection handle for which the command is given
attr_handleHandle of the attribute to be written
value_lenLength of the value to be written
[in]attr_valueValue to be written
Returns
Value indicating success or error code.
It can be BLE_STATUS_NOT_ALLOWED in the following cases:
  • If the exchange has already taken place
  • If GATT is expecting response for previous request
  • Already a request is in the queue to be sent
  • Channel not open
  • Already one GATT procedure is started

◆ aci_gatt_write_charac_reliable()

tBleStatus aci_gatt_write_charac_reliable ( uint16_t  conn_handle,
uint16_t  attr_handle,
uint16_t  val_offset,
uint8_t  val_len,
uint8_t *  attr_val 
)

Start the procedure to write a characteristic reliably.

Note
When the procedure is completed, a EVT_BLUE_GATT_PROCEDURE_COMPLETE event is generated. During the procedure, EVT_BLUE_ATT_PREPARE_WRITE_RESP and EVT_BLUE_ATT_EXEC_WRITE_RESP events are raised.
Parameters
conn_handleConnection handle for which the command is given
attr_handleHandle of the attribute to be written
val_offsetOffset at which the attribute has to be written
val_lenLength of the value to be written
attr_valValue to be written
Returns
Value indicating success or error code.

◆ aci_gatt_write_charac_value()

tBleStatus aci_gatt_write_charac_value ( uint16_t  conn_handle,
uint16_t  attr_handle,
uint8_t  value_len,
uint8_t *  attr_value 
)

Start the procedure to write a characteristic value.

Note
When the procedure is completed, a EVT_BLUE_GATT_PROCEDURE_COMPLETE event is generated.
Parameters
conn_handleConnection handle for which the command is given
attr_handleHandle of the characteristic to be written
value_lenLength of the value to be written
[in]attr_valueValue to be written
Returns
Value indicating success or error code.
It can be BLE_STATUS_NOT_ALLOWED in the following cases:
  • If the exchange has already taken place
  • If GATT is expecting response for previous request
  • Already a request is in the queue to be sent
  • Channel not open
  • Already one GATT procedure is started

◆ aci_gatt_write_long_charac_desc()

tBleStatus aci_gatt_write_long_charac_desc ( uint16_t  conn_handle,
uint16_t  attr_handle,
uint16_t  val_offset,
uint8_t  val_len,
uint8_t *  attr_val 
)

Start the procedure to write a long characteristic descriptor.

Note
When the procedure is completed, a EVT_BLUE_GATT_PROCEDURE_COMPLETE event is generated. During the procedure, EVT_BLUE_ATT_PREPARE_WRITE_RESP and EVT_BLUE_ATT_EXEC_WRITE_RESP events are raised.
Parameters
conn_handleConnection handle for which the command is given
attr_handleHandle of the attribute to be written
val_offsetOffset at which the attribute has to be written
val_lenLength of the value to be written
attr_valValue to be written
Returns
Value indicating success or error code.

◆ aci_gatt_write_long_charac_val()

tBleStatus aci_gatt_write_long_charac_val ( uint16_t  conn_handle,
uint16_t  attr_handle,
uint16_t  val_offset,
uint8_t  val_len,
const uint8_t *  attr_val 
)

Start the procedure to write a long characteristic value.

Note
When the procedure is completed, a EVT_BLUE_GATT_PROCEDURE_COMPLETE event is generated. During the procedure, EVT_BLUE_ATT_PREPARE_WRITE_RESP and EVT_BLUE_ATT_EXEC_WRITE_RESP events are raised.
Parameters
conn_handleConnection handle for which the command is given
attr_handleHandle of the attribute to be written
val_offsetOffset at which the attribute has to be written
val_lenLength of the value to be written
attr_valValue to be written
Returns
Value indicating success or error code.

◆ aci_gatt_write_response()

tBleStatus aci_gatt_write_response ( uint16_t  conn_handle,
uint16_t  attr_handle,
uint8_t  write_status,
uint8_t  err_code,
uint8_t  att_val_len,
uint8_t *  att_val 
)

Allow or reject a write request from a client.

Note
This command has to be sent by the application when it receives the EVT_BLUE_GATT_WRITE_PERMIT_REQ. If the write is allowed, then the status and error code has to be set to 0. If the write is not allowed, then the status has to be set to 1 and the error code has to be set to the error code that has to be passed to the client.
Parameters
conn_handleConnection handle for which the command is given
attr_handleHandle of the attribute that was passed in the event EVT_BLUE_GATT_WRITE_PERMIT_REQ.
write_status0x00: The value can be written to the attribute specified by attr_handle
0x01: The value cannot be written to the attribute specified by the attr_handle.
err_codeThe error code that has to be passed to the client in case the write has to be rejected.
att_val_lenLength of the value to be written as passed in the event EVT_BLUE_GATT_WRITE_PERMIT_REQ.
att_valValue as passed in the event EVT_BLUE_GATT_WRITE_PERMIT_REQ.
Returns
Value indicating success or error code.

◆ aci_gatt_write_without_response()

tBleStatus aci_gatt_write_without_response ( uint16_t  conn_handle,
uint16_t  attr_handle,
uint8_t  val_len,
const uint8_t *  attr_val 
)

Start the procedure to write a characteristic value without waiting for any response from the server.

Note
No events are generated after this command is executed.
Parameters
conn_handleConnection handle for which the command is given
attr_handleHandle of the attribute to be written
val_lenLength of the value to be written (up to ATT_MTU - 3)
[in]attr_valValue to be written
Returns
Value indicating success or error code.
It can be BLE_STATUS_NOT_ALLOWED in the following cases:
  • If the exchange has already taken place
  • If GATT is expecting response for previous request
  • Already a request is in the queue to be sent
  • Channel not open
  • Already one GATT procedure is started
Generated on Mon Apr 15 2019 18:10:40 for BlueNRG-MS pack for STM32CubeMX by   doxygen 1.8.13