X_NUCLEO_IDB0XA1

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers bluenrg_l2cap_aci.h Source File

bluenrg_l2cap_aci.h

00001 /******************** (C) COPYRIGHT 2014 STMicroelectronics ********************
00002 * File Name          : bluenrg_l2cap_aci.h
00003 * Author             : AMS - HEA&RF BU
00004 * Version            : V1.0.0
00005 * Date               : 26-Jun-2014
00006 * Description        : Header file with L2CAP commands for BlueNRG FW6.3.
00007 ********************************************************************************
00008 * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
00009 * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
00010 * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
00011 * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
00012 * CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
00013 * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
00014 *******************************************************************************/
00015 
00016 #ifndef __BLUENRG_L2CAP_ACI_H__
00017 #define __BLUENRG_L2CAP_ACI_H__
00018 
00019 /**
00020  *@addtogroup L2CAP L2CAP
00021  *@brief L2CAP layer.
00022  *@{
00023  */
00024 
00025 /**
00026  *@defgroup L2CAP_Functions L2CAP functions
00027  *@brief API for L2CAP layer.
00028  *@{
00029  */
00030 
00031 /**
00032  * @brief Send an L2CAP Connection Parameter Update request from the slave to the master.
00033  * @note  An @ref EVT_BLUE_L2CAP_CONN_UPD_RESP event will be raised when the master will respond to the request
00034  *        (accepts or rejects).
00035  * @param conn_handle Connection handle on which the connection parameter update request has to be sent.
00036  * @param interval_min Defines minimum value for the connection event interval in the following manner:
00037  *                      connIntervalMin = interval_min x 1.25ms
00038  * @param interval_max Defines maximum value for the connection event interval in the following manner:
00039  *                      connIntervalMax = interval_max x 1.25ms
00040  * @param slave_latency Defines the slave latency parameter (number of connection events that can be skipped).
00041  * @param timeout_multiplier Defines connection timeout parameter in the following manner:
00042  *                           timeout_multiplier x 10ms.
00043  * @return Value indicating success or error code.
00044  */
00045 tBleStatus aci_l2cap_connection_parameter_update_request(uint16_t conn_handle, uint16_t interval_min,
00046                              uint16_t interval_max, uint16_t slave_latency,
00047                              uint16_t timeout_multiplier);
00048 /**
00049  * @brief Accept or reject a connection update.
00050  * @note  This command should be sent in response to a @ref EVT_BLUE_L2CAP_CONN_UPD_REQ event from the controller.
00051  *        The accept parameter has to be set if the connection parameters given in the event are acceptable.
00052  * @param conn_handle Handle received in @ref EVT_BLUE_L2CAP_CONN_UPD_REQ event.
00053  * @param interval_min The connection interval parameter as received in the l2cap connection update request event
00054  * @param interval_max The maximum connection interval parameter as received in the l2cap connection update request event.
00055  * @param slave_latency The slave latency parameter as received in the l2cap connection update request event.
00056  * @param timeout_multiplier The supervision connection timeout parameter as received in the l2cap connection update request event.
00057  * @param min_ce_length Minimum length of connection event needed for the LE connection.\n
00058  *                      Range: 0x0000 - 0xFFFF\n
00059  *                      Time = N x 0.625 msec.
00060  * @param max_ce_length Maximum length of connection event needed for the LE connection.\n
00061  *                      Range: 0x0000 - 0xFFFF\n
00062  *                      Time = N x 0.625 msec.
00063  * @param id Identifier received in @ref EVT_BLUE_L2CAP_CONN_UPD_REQ event.
00064  * @param accept @arg 0x00: The connection update parameters are not acceptable.
00065  *               @arg 0x01: The connection update parameters are acceptable.
00066  * @return Value indicating success or error code.
00067  */
00068 tBleStatus aci_l2cap_connection_parameter_update_response_IDB05A1(uint16_t conn_handle, uint16_t interval_min,
00069                              uint16_t interval_max, uint16_t slave_latency,
00070                              uint16_t timeout_multiplier, uint16_t min_ce_length, uint16_t max_ce_length,
00071                                                          uint8_t id, uint8_t accept);
00072  /**
00073  * @brief Accept or reject a connection update.
00074  * @note  This command should be sent in response to a @ref EVT_BLUE_L2CAP_CONN_UPD_REQ event from the controller.
00075  *        The accept parameter has to be set if the connection parameters given in the event are acceptable.
00076  * @param conn_handle Handle received in @ref EVT_BLUE_L2CAP_CONN_UPD_REQ event.
00077  * @param interval_min The connection interval parameter as received in the l2cap connection update request event
00078  * @param interval_max The maximum connection interval parameter as received in the l2cap connection update request event.
00079  * @param slave_latency The slave latency parameter as received in the l2cap connection update request event.
00080  * @param timeout_multiplier The supervision connection timeout parameter as received in the l2cap connection update request event.
00081  * @param id Identifier received in @ref EVT_BLUE_L2CAP_CONN_UPD_REQ event.
00082  * @param accept @arg 0x00: The connection update parameters are not acceptable.
00083  *               @arg 0x01: The connection update parameters are acceptable.
00084  * @return Value indicating success or error code.
00085  */
00086 tBleStatus aci_l2cap_connection_parameter_update_response_IDB04A1(uint16_t conn_handle, uint16_t interval_min,
00087                              uint16_t interval_max, uint16_t slave_latency,
00088                              uint16_t timeout_multiplier, uint8_t id, uint8_t accept);
00089 
00090 /**
00091  * @}
00092  */
00093    
00094 /**
00095  * @defgroup L2CAP_Events L2CAP events
00096  * @{
00097  */
00098 
00099 /**
00100  * This event is generated when the master responds to the L2CAP connection update request packet.
00101  * For more info see CONNECTION PARAMETER UPDATE RESPONSE and COMMAND REJECT in Bluetooth Core v4.0 spec.
00102  */
00103 #define EVT_BLUE_L2CAP_CONN_UPD_RESP          (0x0800)
00104 typedef __packed struct _evt_l2cap_conn_upd_resp{
00105   uint16_t conn_handle;         /**< The connection handle related to the event. */
00106   uint8_t  event_data_length;  /**< Length of following data. */
00107 /**
00108  * @li 0x13 in case of valid L2CAP Connection Parameter Update Response packet.
00109  * @li 0x01 in case of Command Reject.
00110  */
00111   uint8_t  code;
00112   uint8_t  identifier;    /**< Identifier of the response. It is equal to the request. */
00113   uint16_t l2cap_length;  /**< Length of following data. It should always be 2 */
00114 /**
00115  * Result code (parameters accepted or rejected) in case of Connection Parameter Update
00116  * Response (code=0x13) or reason code for rejection in case of Command Reject (code=0x01).
00117  */
00118   uint16_t result;
00119 } PACKED evt_l2cap_conn_upd_resp;
00120 
00121 /**
00122  * This event is generated when the master does not respond to the connection update request
00123  * within 30 seconds.
00124  */
00125 #define EVT_BLUE_L2CAP_PROCEDURE_TIMEOUT      (0x0801)
00126 typedef __packed struct _evt_l2cap_procedure_timeout{
00127   uint16_t conn_handle;         /**< The connection handle related to the event. */
00128   uint8_t  event_data_length;  /**< Length of following data. It should be always 0 for this event. */
00129 } PACKED evt_l2cap_procedure_timeout;
00130 
00131 /**
00132  * The event is given by the L2CAP layer when a connection update request is received from the slave.
00133  * The application has to respond by calling aci_l2cap_connection_parameter_update_response().
00134  */
00135 #define EVT_BLUE_L2CAP_CONN_UPD_REQ           (0x0802)
00136 typedef __packed struct _evt_l2cap_conn_upd_req{
00137 /**
00138  * Handle of the connection for which the connection update request has been received.
00139  * The same handle has to be returned while responding to the event with the command
00140  * aci_l2cap_connection_parameter_update_response().
00141  */
00142   uint16_t conn_handle; 
00143   uint8_t  event_data_length; /**< Length of following data. */
00144 /**
00145  * This is the identifier which associates the request to the
00146  * response. The same identifier has to be returned by the upper
00147  * layer in the command aci_l2cap_connection_parameter_update_response().
00148  */
00149   uint8_t  identifier; 
00150   uint16_t l2cap_length;  /**< Length of the L2CAP connection update request. */
00151   uint16_t interval_min;  /**< Value as defined in Bluetooth 4.0 spec, Volume 3, Part A 4.20. */
00152   uint16_t interval_max;  /**< Value as defined in Bluetooth 4.0 spec, Volume 3, Part A 4.20. */
00153   uint16_t slave_latency; /**< Value as defined in Bluetooth 4.0 spec, Volume 3, Part A 4.20. */
00154   uint16_t timeout_mult;  /**< Value as defined in Bluetooth 4.0 spec, Volume 3, Part A 4.20. */
00155 } PACKED evt_l2cap_conn_upd_req;
00156 
00157 /**
00158  * @}
00159  */
00160 
00161 /**
00162  * @}
00163  */
00164 
00165 
00166 #endif /* __BLUENRG_L2CAP_ACI_H__ */