ver:init

Committer:
iv123
Date:
Sun Jun 18 16:11:03 2017 +0000
Revision:
0:4946262d6030
Initial commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
iv123 0:4946262d6030 1 /******************** (C) COPYRIGHT 2014 STMicroelectronics ********************
iv123 0:4946262d6030 2 * File Name : bluenrg_l2cap_aci.h
iv123 0:4946262d6030 3 * Author : AMS - HEA&RF BU
iv123 0:4946262d6030 4 * Version : V1.0.0
iv123 0:4946262d6030 5 * Date : 26-Jun-2014
iv123 0:4946262d6030 6 * Description : Header file with L2CAP commands for BlueNRG FW6.3.
iv123 0:4946262d6030 7 ********************************************************************************
iv123 0:4946262d6030 8 * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
iv123 0:4946262d6030 9 * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
iv123 0:4946262d6030 10 * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
iv123 0:4946262d6030 11 * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
iv123 0:4946262d6030 12 * CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
iv123 0:4946262d6030 13 * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
iv123 0:4946262d6030 14 *******************************************************************************/
iv123 0:4946262d6030 15
iv123 0:4946262d6030 16 #ifndef __BLUENRG_L2CAP_ACI_H__
iv123 0:4946262d6030 17 #define __BLUENRG_L2CAP_ACI_H__
iv123 0:4946262d6030 18
iv123 0:4946262d6030 19 /**
iv123 0:4946262d6030 20 *@addtogroup L2CAP L2CAP
iv123 0:4946262d6030 21 *@brief L2CAP layer.
iv123 0:4946262d6030 22 *@{
iv123 0:4946262d6030 23 */
iv123 0:4946262d6030 24
iv123 0:4946262d6030 25 /**
iv123 0:4946262d6030 26 *@defgroup L2CAP_Functions L2CAP functions
iv123 0:4946262d6030 27 *@brief API for L2CAP layer.
iv123 0:4946262d6030 28 *@{
iv123 0:4946262d6030 29 */
iv123 0:4946262d6030 30
iv123 0:4946262d6030 31 /**
iv123 0:4946262d6030 32 * @brief Send an L2CAP Connection Parameter Update request from the slave to the master.
iv123 0:4946262d6030 33 * @note An @ref EVT_BLUE_L2CAP_CONN_UPD_RESP event will be raised when the master will respond to the request
iv123 0:4946262d6030 34 * (accepts or rejects).
iv123 0:4946262d6030 35 * @param conn_handle Connection handle on which the connection parameter update request has to be sent.
iv123 0:4946262d6030 36 * @param interval_min Defines minimum value for the connection event interval in the following manner:
iv123 0:4946262d6030 37 * connIntervalMin = interval_min x 1.25ms
iv123 0:4946262d6030 38 * @param interval_max Defines maximum value for the connection event interval in the following manner:
iv123 0:4946262d6030 39 * connIntervalMax = interval_max x 1.25ms
iv123 0:4946262d6030 40 * @param slave_latency Defines the slave latency parameter (number of connection events that can be skipped).
iv123 0:4946262d6030 41 * @param timeout_multiplier Defines connection timeout parameter in the following manner:
iv123 0:4946262d6030 42 * timeout_multiplier x 10ms.
iv123 0:4946262d6030 43 * @return Value indicating success or error code.
iv123 0:4946262d6030 44 */
iv123 0:4946262d6030 45 tBleStatus aci_l2cap_connection_parameter_update_request(uint16_t conn_handle, uint16_t interval_min,
iv123 0:4946262d6030 46 uint16_t interval_max, uint16_t slave_latency,
iv123 0:4946262d6030 47 uint16_t timeout_multiplier);
iv123 0:4946262d6030 48 /**
iv123 0:4946262d6030 49 * @brief Accept or reject a connection update.
iv123 0:4946262d6030 50 * @note This command should be sent in response to a @ref EVT_BLUE_L2CAP_CONN_UPD_REQ event from the controller.
iv123 0:4946262d6030 51 * The accept parameter has to be set if the connection parameters given in the event are acceptable.
iv123 0:4946262d6030 52 * @param conn_handle Handle received in @ref EVT_BLUE_L2CAP_CONN_UPD_REQ event.
iv123 0:4946262d6030 53 * @param interval_min The connection interval parameter as received in the l2cap connection update request event
iv123 0:4946262d6030 54 * @param interval_max The maximum connection interval parameter as received in the l2cap connection update request event.
iv123 0:4946262d6030 55 * @param slave_latency The slave latency parameter as received in the l2cap connection update request event.
iv123 0:4946262d6030 56 * @param timeout_multiplier The supervision connection timeout parameter as received in the l2cap connection update request event.
iv123 0:4946262d6030 57 * @param min_ce_length Minimum length of connection event needed for the LE connection.\n
iv123 0:4946262d6030 58 * Range: 0x0000 - 0xFFFF\n
iv123 0:4946262d6030 59 * Time = N x 0.625 msec.
iv123 0:4946262d6030 60 * @param max_ce_length Maximum length of connection event needed for the LE connection.\n
iv123 0:4946262d6030 61 * Range: 0x0000 - 0xFFFF\n
iv123 0:4946262d6030 62 * Time = N x 0.625 msec.
iv123 0:4946262d6030 63 * @param id Identifier received in @ref EVT_BLUE_L2CAP_CONN_UPD_REQ event.
iv123 0:4946262d6030 64 * @param accept @arg 0x00: The connection update parameters are not acceptable.
iv123 0:4946262d6030 65 * @arg 0x01: The connection update parameters are acceptable.
iv123 0:4946262d6030 66 * @return Value indicating success or error code.
iv123 0:4946262d6030 67 */
iv123 0:4946262d6030 68 tBleStatus aci_l2cap_connection_parameter_update_response_IDB05A1(uint16_t conn_handle, uint16_t interval_min,
iv123 0:4946262d6030 69 uint16_t interval_max, uint16_t slave_latency,
iv123 0:4946262d6030 70 uint16_t timeout_multiplier, uint16_t min_ce_length, uint16_t max_ce_length,
iv123 0:4946262d6030 71 uint8_t id, uint8_t accept);
iv123 0:4946262d6030 72 /**
iv123 0:4946262d6030 73 * @brief Accept or reject a connection update.
iv123 0:4946262d6030 74 * @note This command should be sent in response to a @ref EVT_BLUE_L2CAP_CONN_UPD_REQ event from the controller.
iv123 0:4946262d6030 75 * The accept parameter has to be set if the connection parameters given in the event are acceptable.
iv123 0:4946262d6030 76 * @param conn_handle Handle received in @ref EVT_BLUE_L2CAP_CONN_UPD_REQ event.
iv123 0:4946262d6030 77 * @param interval_min The connection interval parameter as received in the l2cap connection update request event
iv123 0:4946262d6030 78 * @param interval_max The maximum connection interval parameter as received in the l2cap connection update request event.
iv123 0:4946262d6030 79 * @param slave_latency The slave latency parameter as received in the l2cap connection update request event.
iv123 0:4946262d6030 80 * @param timeout_multiplier The supervision connection timeout parameter as received in the l2cap connection update request event.
iv123 0:4946262d6030 81 * @param id Identifier received in @ref EVT_BLUE_L2CAP_CONN_UPD_REQ event.
iv123 0:4946262d6030 82 * @param accept @arg 0x00: The connection update parameters are not acceptable.
iv123 0:4946262d6030 83 * @arg 0x01: The connection update parameters are acceptable.
iv123 0:4946262d6030 84 * @return Value indicating success or error code.
iv123 0:4946262d6030 85 */
iv123 0:4946262d6030 86 tBleStatus aci_l2cap_connection_parameter_update_response_IDB04A1(uint16_t conn_handle, uint16_t interval_min,
iv123 0:4946262d6030 87 uint16_t interval_max, uint16_t slave_latency,
iv123 0:4946262d6030 88 uint16_t timeout_multiplier, uint8_t id, uint8_t accept);
iv123 0:4946262d6030 89
iv123 0:4946262d6030 90 /**
iv123 0:4946262d6030 91 * @}
iv123 0:4946262d6030 92 */
iv123 0:4946262d6030 93
iv123 0:4946262d6030 94 /**
iv123 0:4946262d6030 95 * @defgroup L2CAP_Events L2CAP events
iv123 0:4946262d6030 96 * @{
iv123 0:4946262d6030 97 */
iv123 0:4946262d6030 98
iv123 0:4946262d6030 99 /**
iv123 0:4946262d6030 100 * This event is generated when the master responds to the L2CAP connection update request packet.
iv123 0:4946262d6030 101 * For more info see CONNECTION PARAMETER UPDATE RESPONSE and COMMAND REJECT in Bluetooth Core v4.0 spec.
iv123 0:4946262d6030 102 */
iv123 0:4946262d6030 103 #define EVT_BLUE_L2CAP_CONN_UPD_RESP (0x0800)
iv123 0:4946262d6030 104 typedef __packed struct _evt_l2cap_conn_upd_resp{
iv123 0:4946262d6030 105 uint16_t conn_handle; /**< The connection handle related to the event. */
iv123 0:4946262d6030 106 uint8_t event_data_length; /**< Length of following data. */
iv123 0:4946262d6030 107 /**
iv123 0:4946262d6030 108 * @li 0x13 in case of valid L2CAP Connection Parameter Update Response packet.
iv123 0:4946262d6030 109 * @li 0x01 in case of Command Reject.
iv123 0:4946262d6030 110 */
iv123 0:4946262d6030 111 uint8_t code;
iv123 0:4946262d6030 112 uint8_t identifier; /**< Identifier of the response. It is equal to the request. */
iv123 0:4946262d6030 113 uint16_t l2cap_length; /**< Length of following data. It should always be 2 */
iv123 0:4946262d6030 114 /**
iv123 0:4946262d6030 115 * Result code (parameters accepted or rejected) in case of Connection Parameter Update
iv123 0:4946262d6030 116 * Response (code=0x13) or reason code for rejection in case of Command Reject (code=0x01).
iv123 0:4946262d6030 117 */
iv123 0:4946262d6030 118 uint16_t result;
iv123 0:4946262d6030 119 } PACKED evt_l2cap_conn_upd_resp;
iv123 0:4946262d6030 120
iv123 0:4946262d6030 121 /**
iv123 0:4946262d6030 122 * This event is generated when the master does not respond to the connection update request
iv123 0:4946262d6030 123 * within 30 seconds.
iv123 0:4946262d6030 124 */
iv123 0:4946262d6030 125 #define EVT_BLUE_L2CAP_PROCEDURE_TIMEOUT (0x0801)
iv123 0:4946262d6030 126 typedef __packed struct _evt_l2cap_procedure_timeout{
iv123 0:4946262d6030 127 uint16_t conn_handle; /**< The connection handle related to the event. */
iv123 0:4946262d6030 128 uint8_t event_data_length; /**< Length of following data. It should be always 0 for this event. */
iv123 0:4946262d6030 129 } PACKED evt_l2cap_procedure_timeout;
iv123 0:4946262d6030 130
iv123 0:4946262d6030 131 /**
iv123 0:4946262d6030 132 * The event is given by the L2CAP layer when a connection update request is received from the slave.
iv123 0:4946262d6030 133 * The application has to respond by calling aci_l2cap_connection_parameter_update_response().
iv123 0:4946262d6030 134 */
iv123 0:4946262d6030 135 #define EVT_BLUE_L2CAP_CONN_UPD_REQ (0x0802)
iv123 0:4946262d6030 136 typedef __packed struct _evt_l2cap_conn_upd_req{
iv123 0:4946262d6030 137 /**
iv123 0:4946262d6030 138 * Handle of the connection for which the connection update request has been received.
iv123 0:4946262d6030 139 * The same handle has to be returned while responding to the event with the command
iv123 0:4946262d6030 140 * aci_l2cap_connection_parameter_update_response().
iv123 0:4946262d6030 141 */
iv123 0:4946262d6030 142 uint16_t conn_handle;
iv123 0:4946262d6030 143 uint8_t event_data_length; /**< Length of following data. */
iv123 0:4946262d6030 144 /**
iv123 0:4946262d6030 145 * This is the identifier which associates the request to the
iv123 0:4946262d6030 146 * response. The same identifier has to be returned by the upper
iv123 0:4946262d6030 147 * layer in the command aci_l2cap_connection_parameter_update_response().
iv123 0:4946262d6030 148 */
iv123 0:4946262d6030 149 uint8_t identifier;
iv123 0:4946262d6030 150 uint16_t l2cap_length; /**< Length of the L2CAP connection update request. */
iv123 0:4946262d6030 151 uint16_t interval_min; /**< Value as defined in Bluetooth 4.0 spec, Volume 3, Part A 4.20. */
iv123 0:4946262d6030 152 uint16_t interval_max; /**< Value as defined in Bluetooth 4.0 spec, Volume 3, Part A 4.20. */
iv123 0:4946262d6030 153 uint16_t slave_latency; /**< Value as defined in Bluetooth 4.0 spec, Volume 3, Part A 4.20. */
iv123 0:4946262d6030 154 uint16_t timeout_mult; /**< Value as defined in Bluetooth 4.0 spec, Volume 3, Part A 4.20. */
iv123 0:4946262d6030 155 } PACKED evt_l2cap_conn_upd_req;
iv123 0:4946262d6030 156
iv123 0:4946262d6030 157 /**
iv123 0:4946262d6030 158 * @}
iv123 0:4946262d6030 159 */
iv123 0:4946262d6030 160
iv123 0:4946262d6030 161 /**
iv123 0:4946262d6030 162 * @}
iv123 0:4946262d6030 163 */
iv123 0:4946262d6030 164
iv123 0:4946262d6030 165
iv123 0:4946262d6030 166 #endif /* __BLUENRG_L2CAP_ACI_H__ */