BLE_API wrapper library for STMicroelectronics' BlueNRG Bluetooth Low Energy expansion board shield (Component)
Dependents: Nucleo_Zumo_BLE_IDB04A1 contest_IOT5 contest_IOT6 contest_IOT_10 ... more
Fork of X_NUCLEO_IDB0XA1 by
API for GATT layer. More...
Functions | |
tBleStatus | aci_gatt_init (void) |
Initialize the GATT layer for server and client roles. | |
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. | |
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. | |
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. | |
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. | |
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. | |
tBleStatus | aci_gatt_del_char (uint16_t servHandle, uint16_t charHandle) |
Delete the specified characteristic from the service. | |
tBleStatus | aci_gatt_del_service (uint16_t servHandle) |
Delete the specified service from the GATT server database. | |
tBleStatus | aci_gatt_del_include_service (uint16_t servHandle, uint16_t includeServHandle) |
Delete the Include definition from the service. | |
tBleStatus | aci_gatt_exchange_configuration (uint16_t conn_handle) |
Perform an ATT MTU exchange procedure. | |
tBleStatus | aci_att_find_information_req (uint16_t conn_handle, uint16_t start_handle, uint16_t end_handle) |
Send a Find Information Request. | |
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. | |
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. | |
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. | |
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. | |
tBleStatus | aci_att_execute_write_req (uint16_t conn_handle, uint8_t execute) |
Send an Execute Write Request. | |
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. | |
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. | |
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. | |
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. | |
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. | |
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. | |
tBleStatus | aci_gatt_read_charac_val (uint16_t conn_handle, uint16_t attr_handle) |
Start the procedure to read the attribute value. | |
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. | |
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. | |
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. | |
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. | |
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. | |
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. | |
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. | |
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. | |
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. | |
tBleStatus | aci_gatt_read_charac_desc (uint16_t conn_handle, uint16_t attr_handle) |
Start the procedure to read the descriptor specified. | |
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. | |
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. | |
tBleStatus | aci_gatt_confirm_indication (uint16_t conn_handle) |
Confirm an indication. | |
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. | |
tBleStatus | aci_gatt_allow_read (uint16_t conn_handle) |
Allow the GATT server to send a response to a read request from a client. | |
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. | |
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. | |
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. | |
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. |
Detailed Description
API for GATT layer.
Function Documentation
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_handle Connection 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.
Definition at line 632 of file bluenrg_gatt_aci.c.
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_handle Connection handle for which the command is given. start_handle First requested handle number end_handle Last requested handle number uuid 2 octet UUID to find (little-endian) attr_val_len Length of attribute value (maximum value is ATT_MTU - 7). attr_val Attribute value to find
- Returns:
- Value indicating success or error code.
Definition at line 501 of file bluenrg_gatt_aci.c.
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_handle Connection handle for which the command is given start_handle Starting handle of the range of attributes to be discovered on the server end_handle Ending handle of the range of attributes to be discovered on the server
- Returns:
- Value indicating success or error code.
Definition at line 477 of file bluenrg_gatt_aci.c.
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_handle Connection handle for which the command is given. attr_handle The handle of the attribute to be written value_offset The offset of the first octet to be written attr_val_len Length of attribute value (maximum value is ATT_MTU - 5). attr_val The value of the attribute to be written
- Returns:
- Value indicating success or error code.
Definition at line 602 of file bluenrg_gatt_aci.c.
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_handle Connection handle for which the command is given. start_handle First requested handle number end_handle Last requested handle number uuid_type - UUID_TYPE_16
- UUID_TYPE_128
uuid 2 or 16 octet UUID
- Returns:
- Value indicating success or error code.
Definition at line 567 of file bluenrg_gatt_aci.c.
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_handle Connection handle for which the command is given. start_handle First requested handle number end_handle Last requested handle number uuid_type - UUID_TYPE_16
- UUID_TYPE_128
uuid 2 or 16 octet UUID
- Returns:
- Value indicating success or error code.
Definition at line 532 of file bluenrg_gatt_aci.c.
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:
-
serviceHandle Handle of the service to which the characteristic has to be added. charUuidType Type of characteristic UUID (16-bit or 128-bit). See UUID Types. - UUID_TYPE_16
- UUID_TYPE_128
charUuid 16-bit or 128-bit UUID. charValueLen Maximum length of the characteristic value. charProperties Bitwise OR values of Characteristic Properties (defined in Volume 3, Section 3.3.3.1 of Bluetooth Specification 4.0). See Characteristic properties. secPermissions Security 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
gattEvtMask Bit 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
encryKeySize The minimum encryption key size requirement for this attribute. Valid Range: 7 to 16. isVariable If the attribute has a variable length value field (1) or not (0). charHandle Handle 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.
Definition at line 152 of file bluenrg_gatt_aci.c.
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:
-
serviceHandle Handle of the service to which the characteristic belongs charHandle Handle of the characteristic to which description has to be added. descUuidType 16-bit or 128-bit UUID. See UUID Types. - UUID_TYPE_16
- UUID_TYPE_128
[in] uuid UUID of the Characteristic descriptor. It can be one of the UUID assigned by Bluetooth SIG (Well_known_UUIDs) or a user-defined one. descValueMaxLen The maximum length of the descriptor value descValueLen Current Length of the characteristic descriptor value [in] descValue Value of the characteristic description secPermissions Security 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
accPermissions Access 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
gattEvtMask Bit mask that enables events that will be sent to the application by the GATT server on certain ATT requests. See Gatt Event Mask. encryKeySize The minimum encryption key size requirement for this attribute. Valid Range: 7 to 16. isVariable If the attribute has a variable length value field (1) or not (0). [out] descHandle Handle of the Characteristic Descriptor.
- Returns:
- Value indicating success or error code.
Definition at line 225 of file bluenrg_gatt_aci.c.
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_type Type of service UUID (16-bit or 128-bit). See UUID Types. [in] service_uuid 16-bit or 128-bit UUID based on the UUID Type field service_type Primary or secondary service. See Service Type. max_attr_records Maximum number of attribute records that can be added to this service (including the service declaration itself) [out] serviceHandle Handle 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.
Definition at line 47 of file bluenrg_gatt_aci.c.
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_handle Connection handle for which the command is given.
- Returns:
- Value indicating success or error code.
Definition at line 1311 of file bluenrg_gatt_aci.c.
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_handle Connection handle for which the command is given.
- Returns:
- Value indicating success or error code.
Definition at line 1236 of file bluenrg_gatt_aci.c.
tBleStatus aci_gatt_del_char | ( | uint16_t | servHandle, |
uint16_t | charHandle | ||
) |
Delete the specified characteristic from the service.
- Parameters:
-
servHandle Handle of the service to which characteristic belongs charHandle Handle of the characteristic to be deleted
- Returns:
- Value indicating success or error code.
Definition at line 364 of file bluenrg_gatt_aci.c.
tBleStatus aci_gatt_del_include_service | ( | uint16_t | servHandle, |
uint16_t | includeServHandle | ||
) |
Delete the Include definition from the service.
- Parameters:
-
servHandle Handle of the service to which Include definition belongs includeServHandle Handle of the Included definition to be deleted
- Returns:
- Value indicating success or error code.
Definition at line 409 of file bluenrg_gatt_aci.c.
tBleStatus aci_gatt_del_service | ( | uint16_t | servHandle ) |
Delete the specified service from the GATT server database.
- Parameters:
-
servHandle Handle of the service to be deleted
- Returns:
- Value indicating success or error code.
Definition at line 387 of file bluenrg_gatt_aci.c.
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_handle Connection handle for which the command is given. char_val_handle Starting handle of the characteristic char_end_handle End handle of the characteristic
- Returns:
- Value indicating success or error code.
Definition at line 813 of file bluenrg_gatt_aci.c.
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_handle Connection handle for which the command is given start_attr_handle Start attribute handle of the service end_attr_handle End attribute handle of the service
- Returns:
- Value indicating success or error code.
Definition at line 737 of file bluenrg_gatt_aci.c.
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_handle Connection handle for which the command is given.
- Returns:
- Value indicating success or error code.
Definition at line 655 of file bluenrg_gatt_aci.c.
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_handle Connection handle for which the command is given start_handle Start attribute handle of the service end_handle End attribute handle of the service uuid_type - UUID_TYPE_16
- UUID_TYPE_128
uuid 2 or 16 octet UUID
- Returns:
- Value indicating success or error code.
Definition at line 763 of file bluenrg_gatt_aci.c.
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_handle Connection handle for which the command is given. uuid_type - UUID_TYPE_16
- UUID_TYPE_128
uuid 2 or 16 octet UUID
- Returns:
- Value indicating success or error code.
Definition at line 678 of file bluenrg_gatt_aci.c.
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_handle Connection handle for which the command is given.
- Returns:
- Value indicating success or error code.
Definition at line 454 of file bluenrg_gatt_aci.c.
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_handle Connection handle for which the command is given. start_handle Start handle of the service end_handle End handle of the service
- Returns:
- Value indicating success or error code.
Definition at line 711 of file bluenrg_gatt_aci.c.
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_handle Handle of the service to which another service has to be included included_start_handle Start Handle of the service which has to be included in service included_end_handle End Handle of the service which has to be included in service included_uuid_type Type of UUID for included service (16-bit or 128-bit). See Well-Known UUIDs. [in] included_uuid 16-bit or 128-bit UUID. [out] included_handle Handle of the include declaration.
- Returns:
- Value indicating success or error code.
Definition at line 96 of file bluenrg_gatt_aci.c.
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.
Definition at line 30 of file bluenrg_gatt_aci.c.
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_handle Connection handle for which the command is given attr_handle Handle of the descriptor to be read
- Returns:
- Value indicating success or error code.
Definition at line 1154 of file bluenrg_gatt_aci.c.
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_handle Connection handle for which the command is given attr_handle Handle 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
- If the exchange has already taken place
Definition at line 839 of file bluenrg_gatt_aci.c.
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_handle Handle of the attribute to read data_len Length of the data buffer. [in] data_len_out_p Length of the read attribute. [in] data Pointer 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.
Definition at line 1408 of file bluenrg_gatt_aci.c.
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_handle Handle of the attribute to read offset Offset from which the value needs to be read data_len Length of the data buffer. [in] data_len_out_p Length of the read attribute. [in] data Pointer 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.
Definition at line 1440 of file bluenrg_gatt_aci.c.
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_handle Connection handle for which the command is given attr_handle Handle of the characteristic descriptor val_offset Offset from which the value needs to be read
- Returns:
- Value indicating success or error code.
Definition at line 1088 of file bluenrg_gatt_aci.c.
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_handle Connection handle for which the command is given attr_handle Handle of the characteristic to be read val_offset Offset 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
- If the exchange has already taken place
Definition at line 898 of file bluenrg_gatt_aci.c.
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_handle Connection handle for which the command is given num_handles The number of handles for which the value has to be read set_of_handles The handles for which the attribute value has to be read
- Returns:
- Value indicating success or error code.
Definition at line 924 of file bluenrg_gatt_aci.c.
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_handle Connection handle for which the command is given start_handle Starting handle of the range to be searched end_handle End handle of the range to be searched uuid_type - UUID_TYPE_16
- UUID_TYPE_128
uuid 2 or 16 octet UUID
- Returns:
- Value indicating success or error code.
Definition at line 863 of file bluenrg_gatt_aci.c.
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:
-
servHandle Handle of the service which contains the descriptor. charHandle Handle of the characteristic which contains the descriptor. charDescHandle Handle of the descriptor whose value has to be set. charDescValOffset Offset from which the descriptor value has to be updated. charDescValueLen Length of the descriptor value [in] charDescValue descriptor value
- Returns:
- Value indicating success or error code.
Definition at line 1358 of file bluenrg_gatt_aci.c.
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_handle Handle of the service which contains the attribute whose security permission has to be modified. attr_handle Handle of the attribute whose security permission has to be modified. security_permission Security 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.
Definition at line 1333 of file bluenrg_gatt_aci.c.
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_handle Connection handle for which the command is given attr_handle Handle of the attribute to be written val_len Length of the value to be written (up to ATT_MTU - 13). attr_val Value to be written
- Returns:
- Value indicating success or error code
Definition at line 1207 of file bluenrg_gatt_aci.c.
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.Here if BlueNRG buffer become full, the application try again to send the notification.tBleStatus Free_Fall_Notify(void) { uint8_t val; tBleStatus ret; val = 0x01; ret = aci_gatt_update_char_value(accServHandle, freeFallCharHandle, 0, 1, &val); if (ret != BLE_STATUS_SUCCESS){ PRINTF("Error while updating ACC characteristic.\n") ; return BLE_STATUS_ERROR ; } return BLE_STATUS_SUCCESS; }
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:
-
servHandle Handle of the service to which characteristic belongs charHandle Handle of the characteristic charValOffset The 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. charValueLen Length of the characteristic value in octets [in] charValue Characteristic value
- Returns:
- Value indicating success or error code.
Definition at line 315 of file bluenrg_gatt_aci.c.
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_handle Connection handle for which the command is given attr_handle Handle of the attribute to be written value_len Length of the value to be written [in] attr_value Value 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
- If the exchange has already taken place
Definition at line 1114 of file bluenrg_gatt_aci.c.
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_handle Connection handle for which the command is given attr_handle Handle of the attribute to be written val_offset Offset at which the attribute has to be written val_len Length of the value to be written attr_val Value to be written
- Returns:
- Value indicating success or error code.
Definition at line 1026 of file bluenrg_gatt_aci.c.
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_handle Connection handle for which the command is given attr_handle Handle of the characteristic to be written value_len Length of the value to be written [in] attr_value Value 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
- If the exchange has already taken place
Definition at line 955 of file bluenrg_gatt_aci.c.
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_handle Connection handle for which the command is given attr_handle Handle of the attribute to be written val_offset Offset at which the attribute has to be written val_len Length of the value to be written attr_val Value to be written
- Returns:
- Value indicating success or error code.
Definition at line 1057 of file bluenrg_gatt_aci.c.
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_handle Connection handle for which the command is given attr_handle Handle of the attribute to be written val_offset Offset at which the attribute has to be written val_len Length of the value to be written attr_val Value to be written
- Returns:
- Value indicating success or error code.
Definition at line 995 of file bluenrg_gatt_aci.c.
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_handle Connection handle for which the command is given attr_handle Handle of the attribute that was passed in the event EVT_BLUE_GATT_WRITE_PERMIT_REQ. write_status 0x00: 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_code The error code that has to be passed to the client in case the write has to be rejected. att_val_len Length of the value to be written as passed in the event EVT_BLUE_GATT_WRITE_PERMIT_REQ. att_val Value as passed in the event EVT_BLUE_GATT_WRITE_PERMIT_REQ.
- Returns:
- Value indicating success or error code.
Definition at line 1258 of file bluenrg_gatt_aci.c.
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_handle Connection handle for which the command is given attr_handle Handle of the attribute to be written val_len Length of the value to be written (up to ATT_MTU - 3) [in] attr_val Value 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
- If the exchange has already taken place
Definition at line 1178 of file bluenrg_gatt_aci.c.
Generated on Tue Jul 12 2022 18:15:59 by
