Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
GATT functions
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 uint8_t *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_gatt_find_information_req (uint16_t conn_handle, uint16_t start_handle, uint16_t end_handle) |
| Send a Find Information 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_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_discovery_characteristic_by_uuid (uint16_t conn_handle, uint16_t start_handle, uint16_t end_handle, uint8_t charUuidType, const uint8_t *charUuid) |
| 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_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_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_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_write_without_response (uint16_t conn_handle, uint16_t attr_handle, uint8_t value_len, uint8_t *attr_value) |
| Start the procedure to write a characteristic value without waiting for any 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_desc_value (uint16_t servHandle, uint16_t charHandle, uint16_t charDescHandle, uint16_t charDescValOffset, uint8_t charDescValueLen, const uint8_t *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. | |
Detailed Description
API for GATT layer.
Function Documentation
| 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 type. - 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 Server event bit 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 153 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 type. - 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 Server event bit 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 226 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.
- Parameters:
-
service_uuid_type Type of service UUID (16-bit or 128-bit). See UUID type. [in] service_uuid 16-bit or 128-bit UUID based on the UUID Type field service_type Primary or secondary service. See Type of service. max_attr_records Maximum number of attribute records that can be added to this service [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 48 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 898 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 823 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 365 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 410 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 388 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 627 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 551 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 502 of file bluenrg_gatt_aci.c.
| tBleStatus aci_gatt_discovery_characteristic_by_uuid | ( | uint16_t | conn_handle, |
| uint16_t | start_handle, | ||
| uint16_t | end_handle, | ||
| uint8_t | charUuidType, | ||
| const uint8_t * | charUuid | ||
| ) |
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_ATT_READ_BY_TYPE_RESP event.
- Parameters:
-
conn_handle start_handle end_handle charUuidType charUuid
- Returns:
Definition at line 577 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 455 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 525 of file bluenrg_gatt_aci.c.
| tBleStatus aci_gatt_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 478 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 UUID type. [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 97 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 31 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 653 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 970 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 677 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 uint8_t * | 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 920 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 uint8_t * | 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 316 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 743 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 703 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 845 of file bluenrg_gatt_aci.c.
| tBleStatus aci_gatt_write_without_response | ( | uint16_t | conn_handle, |
| uint16_t | attr_handle, | ||
| uint8_t | value_len, | ||
| uint8_t * | attr_value | ||
| ) |
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 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 783 of file bluenrg_gatt_aci.c.
Generated on Tue Jul 12 2022 17:28:29 by
1.7.2