| BlueNRG-1 ACI APIs and events callbacks

- Main Page
- Modules
- Classes
- Files

Classes | Typedefs | Functions
ACI GATT/ATT events

ACI GATT/ATT events layer. More...

## Classes

struct | Attribute_Group_Handle_Pair_t_s
struct | Handle_Item_t_s

## Typedefs

typedef struct Attribute_Group_Handle_Pair_t_s | Attribute_Group_Handle_Pair_t
typedef struct Handle_Item_t_s | Handle_Item_t

## Functions

void | aci_gatt_attribute_modified_event (uint16_t Connection_Handle, uint16_t Attr_Handle, uint16_t Offset, uint8_t Attr_Data_Length, uint8_t Attr_Data[])
| This event is generated to the application by the GATT server when a client modifies any attribute on the server, as consequence of one of the following GATT procedures: More...
void | aci_gatt_proc_timeout_event (uint16_t Connection_Handle)
| This event is generated by the client/server to the application on a GATT timeout (30 seconds). This is a critical event that should not happen during normal operating conditions. It is an indication of either a major disruption in the communication link or a mistake in the application which does not provide a reply to GATT procedures. After this event, the GATT channel is closed and no more GATT communication can be performed. The applications is exptected to issue an aci_gap_terminate to disconnect from the peer device. It is important to leave an 100 ms blank window before sending the aci_gap_terminate, since immediately after this event, system could save important information in non volatile memory. More...
void | aci_att_exchange_mtu_resp_event (uint16_t Connection_Handle, uint16_t Server_RX_MTU)
| This event is generated in response to an Exchange MTU request. See aci_gatt_exchange_config. More...
void | aci_att_find_info_resp_event (uint16_t Connection_Handle, uint8_t Format, uint8_t Event_Data_Length, uint8_t Handle_UUID_Pair[])
| This event is generated in response to a Find Information Request. See aci_att_find_info_req and Find Information Response in Bluetooth Core v4.1 spec. More...
void | aci_att_find_by_type_value_resp_event (uint16_t Connection_Handle, uint8_t Num_of_Handle_Pair, Attribute_Group_Handle_Pair_t Attribute_Group_Handle_Pair[])
| This event is generated in response to a aci_att_find_by_type_value_req. More...
void | aci_att_read_by_type_resp_event (uint16_t Connection_Handle, uint8_t Handle_Value_Pair_Length, uint8_t Data_Length, uint8_t Handle_Value_Pair_Data[])
| This event is generated in response to a aci_att_read_by_type_req. See aci_gatt_find_included_services and aci_gatt_disc_all_char_desc. More...
void | aci_att_read_resp_event (uint16_t Connection_Handle, uint8_t Event_Data_Length, uint8_t Attribute_Value[])
| This event is generated in response to a Read Request. See aci_gatt_read_char_value. More...
void | aci_att_read_blob_resp_event (uint16_t Connection_Handle, uint8_t Event_Data_Length, uint8_t Attribute_Value[])
| This event is generated in response to a Read Request. See aci_gatt_read_char_value. More...
void | aci_att_read_multiple_resp_event (uint16_t Connection_Handle, uint8_t Event_Data_Length, uint8_t Set_Of_Values[])
| This event is generated in response to a Read Multiple Request. More...
void | aci_att_read_by_group_type_resp_event (uint16_t Connection_Handle, uint8_t Attribute_Data_Length, uint8_t Data_Length, uint8_t Attribute_Data_List[])
| This event is generated in response to a Read By Group Type Request. See aci_gatt_disc_all_primary_services. More...
void | aci_att_prepare_write_resp_event (uint16_t Connection_Handle, uint16_t Attribute_Handle, uint16_t Offset, uint8_t Part_Attribute_Value_Length, uint8_t Part_Attribute_Value[])
| This event is generated in response to a aci_att_prepare_write_req. More...
void | aci_att_exec_write_resp_event (uint16_t Connection_Handle)
| This event is generated in response to an Execute Write Request. More...
void | aci_gatt_indication_event (uint16_t Connection_Handle, uint16_t Attribute_Handle, uint8_t Attribute_Value_Length, uint8_t Attribute_Value[])
| This event is generated when an indication is received from the server. More...
void | aci_gatt_notification_event (uint16_t Connection_Handle, uint16_t Attribute_Handle, uint8_t Attribute_Value_Length, uint8_t Attribute_Value[])
| This event is generated when a notification is received from the server. More...
void | aci_gatt_proc_complete_event (uint16_t Connection_Handle, uint8_t Error_Code)
| This event is generated when a GATT client procedure completes either with error or successfully. More...
void | aci_gatt_error_resp_event (uint16_t Connection_Handle, uint8_t Req_Opcode, uint16_t Attribute_Handle, uint8_t Error_Code)
| This event is generated when an Error Response is received from the server. The error response can be given by the server at the end of one of the GATT discovery procedures. This does not mean that the procedure ended with an error, but this error event is part of the procedure itself. More...
void | aci_gatt_disc_read_char_by_uuid_resp_event (uint16_t Connection_Handle, uint16_t Attribute_Handle, uint8_t Attribute_Value_Length, uint8_t Attribute_Value[])
| This event can be generated during a "Discover Characteristics By UUID" procedure or a "Read using Characteristic UUID" procedure. The attribute value will be a service declaration as defined in Bluetooth Core v4.1spec (vol.3, Part G, ch. 3.3.1), when a "Discover Characteristics By UUID" has been started. It will be the value of the Characteristic if a* "Read using Characteristic UUID" has been performed. More...
void | aci_gatt_write_permit_req_event (uint16_t Connection_Handle, uint16_t Attribute_Handle, uint8_t Data_Length, uint8_t Data[])
| This event is given to the application when a write request, write command or signed write command is received by the server from the client. This event will be given to the application only if the event bit for this event generation is set when the characteristic was added. When this event is received, the application has to check whether the value being requested for write can be allowed to be written and respond with the command aci_gatt_write_resp. The details of the parameters of the command can be found. Based on the response from the application, the attribute value will be modified by the stack. If the write is rejected by the application, then the value of the attribute will not be modified. In case of a write REQ, an error response will be sent to the client, with the error code as specified by the application. In case of write/signed write commands, no response is sent to the client but the attribute is not modified. More...
void | aci_gatt_read_permit_req_event (uint16_t Connection_Handle, uint16_t Attribute_Handle, uint16_t Offset)
| This event is given to the application when a read request or read blob request is received by the server from the client. This event will be given to the application only if the event bit for this event generation is set when the characteristic was added. On receiving this event, the application can update the value of the handle if it desires and when done, it has to send the aci_gatt_allow_read command to indicate to the stack that it can send the response to the client. More...
void | aci_gatt_read_multi_permit_req_event (uint16_t Connection_Handle, uint8_t Number_of_Handles, Handle_Item_t Handle_Item[])
| This event is given to the application when a read multiple request or read by type request is received by the server from the client. This event will be given to the application only if the event bit for this event generation is set when the characteristic was added. On receiving this event, the application can update the values of the handles if it desires and when done, it has to send the aci_gatt_allow_read command to indicate to the stack that it can send the response to the client. More...
void | aci_gatt_tx_pool_available_event (uint16_t Connection_Handle, uint16_t Available_Buffers)
| Each time BLE FW stack raises the error code BLE_STATUS_INSUFFICIENT_RESOURCES (0x64), the aci_gatt_tx_pool_available_event event is generated as soon as there are at least two buffers available for notifications or write commands. More...
void | aci_gatt_server_confirmation_event (uint16_t Connection_Handle)
| This event is generated when the client has sent the confirmation to a previously sent indication. More...
void | aci_gatt_prepare_write_permit_req_event (uint16_t Connection_Handle, uint16_t Attribute_Handle, uint16_t Offset, uint8_t Data_Length, uint8_t Data[])
| This event is given to the application when a prepare write request is received by the server from the client. This event will be given to the application only if the event bit for this event generation is set when the characteristic was added. When this event is received, the application has to check whether the value being requested for write can be allowed to be written and respond with the command aci_gatt_write_resp. Based on the response from the application, the attribute value will be modified by the stack. If the write is rejected by the application, then the value of the attribute will not be modified and an error response will be sent to the client, with the error code as specified by the application. More...

## Detailed Description

ACI GATT/ATT events layer.

## Typedef Documentation

typedef struct Attribute_Group_Handle_Pair_t_s Attribute_Group_Handle_Pair_t

Documentation for Attribute_Group_Handle_Pair_t

typedef struct Handle_Item_t_s Handle_Item_t

Documentation for Handle_Item_t

## Function Documentation

void aci_att_exchange_mtu_resp_event | ( | uint16_t | Connection_Handle,
|  | uint16_t | Server_RX_MTU
| ) |  |

This event is generated in response to an Exchange MTU request. See aci_gatt_exchange_config.

Parameters

  Connection_Handle | Connection handle related to the response
  Server_RX_MTU | Attribute server receive MTU size

Return values

  None |

void aci_att_exec_write_resp_event | ( | uint16_t | Connection_Handle | ) |

This event is generated in response to an Execute Write Request.

Parameters

  Connection_Handle | Connection handle related to the response

Return values

  None |

void aci_att_find_by_type_value_resp_event | ( | uint16_t | Connection_Handle,
|  | uint8_t | Num_of_Handle_Pair,
|  | Attribute_Group_Handle_Pair_t | Attribute_Group_Handle_Pair[]
| ) |  |

This event is generated in response to a aci_att_find_by_type_value_req.

Parameters

  Connection_Handle | Connection handle related to the response
  Num_of_Handle_Pair | Number of attribute, group handle pairs
  Attribute_Group_Handle_Pair | See Attribute_Group_Handle_Pair_t

Return values

  None |

void aci_att_find_info_resp_event | ( | uint16_t | Connection_Handle,
|  | uint8_t | Format,
|  | uint8_t | Event_Data_Length,
|  | uint8_t | Handle_UUID_Pair[]
| ) |  |

This event is generated in response to a Find Information Request. See aci_att_find_info_req and Find Information Response in Bluetooth Core v4.1 spec.

Parameters

  Connection_Handle | Connection handle related to the response
  Format | Format of the hanndle-uuid pairs
  Event_Data_Length | Length of Handle_UUID_Pair in octets
  Handle_UUID_Pair | A sequence of handle-uuid pairs. if format=1, each pair is:[2 octets for handle, 2 octets for UUIDs], if format=2, each pair is:[2 octets for handle, 16 octets for UUIDs]

Return values

  None |

void aci_att_prepare_write_resp_event | ( | uint16_t | Connection_Handle,
|  | uint16_t | Attribute_Handle,
|  | uint16_t | Offset,
|  | uint8_t | Part_Attribute_Value_Length,
|  | uint8_t | Part_Attribute_Value[]
| ) |  |

This event is generated in response to a aci_att_prepare_write_req.

Parameters

  Connection_Handle | Connection handle related to the response
  Attribute_Handle | The handle of the attribute to be written
  Offset | The offset of the first octet to be written.
  Part_Attribute_Value_Length | Length of Part_Attribute_Value in octets
  Part_Attribute_Value | The value of the attribute to be written

Return values

  None |

void aci_att_read_blob_resp_event | ( | uint16_t | Connection_Handle,
|  | uint8_t | Event_Data_Length,
|  | uint8_t | Attribute_Value[]
| ) |  |

This event is generated in response to a Read Request. See aci_gatt_read_char_value.

Parameters

  Connection_Handle | Connection handle related to the response
  Event_Data_Length | Length of following data
  Attribute_Value | Part of the attribute value.

Return values

  None |

void aci_att_read_by_group_type_resp_event | ( | uint16_t | Connection_Handle,
|  | uint8_t | Attribute_Data_Length,
|  | uint8_t | Data_Length,
|  | uint8_t | Attribute_Data_List[]
| ) |  |

This event is generated in response to a Read By Group Type Request. See aci_gatt_disc_all_primary_services.

Parameters

  Connection_Handle | Connection handle related to the response
  Attribute_Data_Length | The size of each attribute data
  Data_Length | Length of Attribute_Data_List in octets
  Attribute_Data_List | Attribute Data List as defined in Bluetooth Core v4.1 spec. A sequence of attribute handle, end group handle, attribute value tuples: [2 octets for Attribute Handle, 2 octets End Group Handle, (Attribute_Data_Length - 4 octets) for Attribute Value]

Return values

  None |

void aci_att_read_by_type_resp_event | ( | uint16_t | Connection_Handle,
|  | uint8_t | Handle_Value_Pair_Length,
|  | uint8_t | Data_Length,
|  | uint8_t | Handle_Value_Pair_Data[]
| ) |  |

This event is generated in response to a aci_att_read_by_type_req. See aci_gatt_find_included_services and aci_gatt_disc_all_char_desc.

Parameters

  Connection_Handle | Connection handle related to the response
  Handle_Value_Pair_Length | The size of each attribute handle-value pair
  Data_Length | Length of Handle_Value_Pair_Data in octets
  Handle_Value_Pair_Data | Attribute Data List as defined in Bluetooth Core v4.1 spec. A sequence of handle-value pairs: [2 octets for Attribute Handle, (Handle_Value_Pair_Length - 2 octets) for Attribute Value]

Return values

  None |

void aci_att_read_multiple_resp_event | ( | uint16_t | Connection_Handle,
|  | uint8_t | Event_Data_Length,
|  | uint8_t | Set_Of_Values[]
| ) |  |

This event is generated in response to a Read Multiple Request.

Parameters

  Connection_Handle | Connection handle related to the response
  Event_Data_Length | Length of following data
  Set_Of_Values | A set of two or more values. A concatenation of attribute values for each of the attribute handles in the request in the order that they were requested.

Return values

  None |

void aci_att_read_resp_event | ( | uint16_t | Connection_Handle,
|  | uint8_t | Event_Data_Length,
|  | uint8_t | Attribute_Value[]
| ) |  |

This event is generated in response to a Read Request. See aci_gatt_read_char_value.

Parameters

  Connection_Handle | Connection handle related to the response
  Event_Data_Length | Length of following data
  Attribute_Value | The value of the attribute.

Return values

  None |

void aci_gatt_attribute_modified_event | ( | uint16_t | Connection_Handle,
|  | uint16_t | Attr_Handle,
|  | uint16_t | Offset,
|  | uint8_t | Attr_Data_Length,
|  | uint8_t | Attr_Data[]
| ) |  |

This event is generated to the application by the GATT server when a client modifies any attribute on the server, as consequence of one of the following GATT procedures:

- write without response
- signed write without response
- write characteristic value
- write long characteristic value
- reliable write.
  Parameters

    Connection_Handle | The connection handle which modified the attribute.
    Attr_Handle | Handle of the attribute that was modified.
    Offset | Offset from which the write has been performed by the peer device.
    Attr_Data_Length | Length of Attr_Data in octets
    Attr_Data | The modified value

  Return values

    None |

void aci_gatt_disc_read_char_by_uuid_resp_event | ( | uint16_t | Connection_Handle,
|  | uint16_t | Attribute_Handle,
|  | uint8_t | Attribute_Value_Length,
|  | uint8_t | Attribute_Value[]
| ) |  |

This event can be generated during a "Discover Characteristics By UUID" procedure or a "Read using Characteristic UUID" procedure. The attribute value will be a service declaration as defined in Bluetooth Core v4.1spec (vol.3, Part G, ch. 3.3.1), when a "Discover Characteristics By UUID" has been started. It will be the value of the Characteristic if a* "Read using Characteristic UUID" has been performed.

Parameters

  Connection_Handle | Connection handle related to the response
  Attribute_Handle | The handle of the attribute
  Attribute_Value_Length | Length of Attribute_Value in octets
  Attribute_Value | The attribute value will be a service declaration as defined in Bluetooth Core v4.0 spec (vol.3, Part G, ch. 3.3.1), when a "Discover Characteristics By UUID" has been started. It will be the value of the Characteristic if a "Read using Characteristic UUID" has been performed.

Return values

  None |

void aci_gatt_error_resp_event | ( | uint16_t | Connection_Handle,
|  | uint8_t | Req_Opcode,
|  | uint16_t | Attribute_Handle,
|  | uint8_t | Error_Code
| ) |  |

This event is generated when an Error Response is received from the server. The error response can be given by the server at the end of one of the GATT discovery procedures. This does not mean that the procedure ended with an error, but this error event is part of the procedure itself.

Parameters

  Connection_Handle | Connection handle related to the response
  Req_Opcode | The request that generated this error response
  Attribute_Handle | The attribute handle that generated this error response
  Error_Code | The reason why the request has generated an error response (ATT error codes)

Return values

  None |

void aci_gatt_indication_event | ( | uint16_t | Connection_Handle,
|  | uint16_t | Attribute_Handle,
|  | uint8_t | Attribute_Value_Length,
|  | uint8_t | Attribute_Value[]
| ) |  |

This event is generated when an indication is received from the server.

Parameters

  Connection_Handle | Connection handle related to the response
  Attribute_Handle | The handle of the attribute
  Attribute_Value_Length | Length of Attribute_Value in octets
  Attribute_Value | The current value of the attribute

Return values

  None |

void aci_gatt_notification_event | ( | uint16_t | Connection_Handle,
|  | uint16_t | Attribute_Handle,
|  | uint8_t | Attribute_Value_Length,
|  | uint8_t | Attribute_Value[]
| ) |  |

This event is generated when a notification is received from the server.

Parameters

  Connection_Handle | Connection handle related to the response
  Attribute_Handle | The handle of the attribute
  Attribute_Value_Length | Length of Attribute_Value in octets
  Attribute_Value | The current value of the attribute

Return values

  None |

void aci_gatt_prepare_write_permit_req_event | ( | uint16_t | Connection_Handle,
|  | uint16_t | Attribute_Handle,
|  | uint16_t | Offset,
|  | uint8_t | Data_Length,
|  | uint8_t | Data[]
| ) |  |

This event is given to the application when a prepare write request is received by the server from the client. This event will be given to the application only if the event bit for this event generation is set when the characteristic was added. When this event is received, the application has to check whether the value being requested for write can be allowed to be written and respond with the command aci_gatt_write_resp. Based on the response from the application, the attribute value will be modified by the stack. If the write is rejected by the application, then the value of the attribute will not be modified and an error response will be sent to the client, with the error code as specified by the application.

Parameters

  Connection_Handle | Handle of the connection on which there was the request to write the attribute
  Attribute_Handle | The handle of the attribute
  Offset | The offset from which the prepare write has been requested
  Data_Length | Length of Data field
  Data | The data that the client has requested to write

Return values

  None |

void aci_gatt_proc_complete_event | ( | uint16_t | Connection_Handle,
|  | uint8_t | Error_Code
| ) |  |

This event is generated when a GATT client procedure completes either with error or successfully.

Parameters

  Connection_Handle | Connection handle related to the response
  Error_Code | Indicates whether the procedure completed with an error or was successful

Return values

  None |

void aci_gatt_proc_timeout_event | ( | uint16_t | Connection_Handle | ) |

This event is generated by the client/server to the application on a GATT timeout (30 seconds). This is a critical event that should not happen during normal operating conditions. It is an indication of either a major disruption in the communication link or a mistake in the application which does not provide a reply to GATT procedures. After this event, the GATT channel is closed and no more GATT communication can be performed. The applications is exptected to issue an aci_gap_terminate to disconnect from the peer device. It is important to leave an 100 ms blank window before sending the aci_gap_terminate, since immediately after this event, system could save important information in non volatile memory.

Parameters

  Connection_Handle | Connection handle on which the GATT procedure has timed out

Return values

  None |

void aci_gatt_read_multi_permit_req_event | ( | uint16_t | Connection_Handle,
|  | uint8_t | Number_of_Handles,
|  | Handle_Item_t | Handle_Item[]
| ) |  |

This event is given to the application when a read multiple request or read by type request is received by the server from the client. This event will be given to the application only if the event bit for this event generation is set when the characteristic was added. On receiving this event, the application can update the values of the handles if it desires and when done, it has to send the aci_gatt_allow_read command to indicate to the stack that it can send the response to the client.

Parameters

  Connection_Handle | Handle of the connection which requested to read the attribute
  Number_of_Handles | Not available
  Handle_Item | See Handle_Item_t

Return values

  None |

void aci_gatt_read_permit_req_event | ( | uint16_t | Connection_Handle,
|  | uint16_t | Attribute_Handle,
|  | uint16_t | Offset
| ) |  |

This event is given to the application when a read request or read blob request is received by the server from the client. This event will be given to the application only if the event bit for this event generation is set when the characteristic was added. On receiving this event, the application can update the value of the handle if it desires and when done, it has to send the aci_gatt_allow_read command to indicate to the stack that it can send the response to the client.

Parameters

  Connection_Handle | Connection handle related to the response
  Attribute_Handle | The handle of the attribute
  Offset | Contains the offset from which the read has been requested

Return values

  None |

void aci_gatt_server_confirmation_event | ( | uint16_t | Connection_Handle | ) |

This event is generated when the client has sent the confirmation to a previously sent indication.

Parameters

  Connection_Handle | Connection handle related to the event

Return values

  None |

void aci_gatt_tx_pool_available_event | ( | uint16_t | Connection_Handle,
|  | uint16_t | Available_Buffers
| ) |  |

Each time BLE FW stack raises the error code BLE_STATUS_INSUFFICIENT_RESOURCES (0x64), the aci_gatt_tx_pool_available_event event is generated as soon as there are at least two buffers available for notifications or write commands.

Parameters

  Connection_Handle | Connection handle related to the request
  Available_Buffers | Number of buffers available

Return values

  None |

void aci_gatt_write_permit_req_event | ( | uint16_t | Connection_Handle,
|  | uint16_t | Attribute_Handle,
|  | uint8_t | Data_Length,
|  | uint8_t | Data[]
| ) |  |

This event is given to the application when a write request, write command or signed write command is received by the server from the client. This event will be given to the application only if the event bit for this event generation is set when the characteristic was added. When this event is received, the application has to check whether the value being requested for write can be allowed to be written and respond with the command aci_gatt_write_resp. The details of the parameters of the command can be found. Based on the response from the application, the attribute value will be modified by the stack. If the write is rejected by the application, then the value of the attribute will not be modified. In case of a write REQ, an error response will be sent to the client, with the error code as specified by the application. In case of write/signed write commands, no response is sent to the client but the attribute is not modified.

Parameters

  Connection_Handle | Handle of the connection on which there was the request to write the attribute
  Attribute_Handle | The handle of the attribute
  Data_Length | Length of Data field
  Data | The data that the client has requested to write

Return values

  None |