Filippo Casamassima / Nucleo_blueNRG

Dependencies:   mbed

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  *@defgroup L2CAP_Functions L2CAP functions
00021  *@brief API for L2CAP layer.
00022  *@{
00023  */
00024 
00025 /**
00026  * @brief Send an L2CAP Connection Parameter Update request from the slave to the master.
00027  * @note  An @ref EVT_BLUE_L2CAP_CONN_UPD_RESP event will be raised when the master will respond to the request
00028  *        (accepts or rejects).
00029  * @param conn_handle Connection handle on which the connection parameter update request has to be sent.
00030  * @param interval_min Defines minimum value for the connection event interval in the following manner:
00031  *                      connIntervalMin = interval_min x 1.25ms
00032  * @param interval_max Defines maximum value for the connection event interval in the following manner:
00033  *                      connIntervalMax = interval_max x 1.25ms
00034  * @param slave_latency Defines the slave latency parameter (number of connection events that can be skipped).
00035  * @param timeout_multiplier Defines connection timeout parameter in the following manner:
00036  *                           timeout_multiplier x 10ms.
00037  * @return Value indicating success or error code.
00038  */
00039 tBleStatus aci_l2cap_connection_parameter_update_request(uint16_t conn_handle, uint16_t interval_min,
00040                              uint16_t interval_max, uint16_t slave_latency,
00041                              uint16_t timeout_multiplier);
00042 /**
00043  * @brief Accept or reject a connection update.
00044  * @note  This command should be sent in response to a @ref EVT_BLUE_L2CAP_CONN_UPD_REQ event from the controller.
00045  *        The accept parameter has to be set if the connection parameters given in the event are acceptable.
00046  * @param conn_handle Handle received in @ref EVT_BLUE_L2CAP_CONN_UPD_REQ event.
00047  * @param interval_min
00048  * @param interval_max
00049  * @param slave_latency
00050  * @param timeout_multiplier
00051  * @param id
00052  * @param accept
00053  * @return
00054  */
00055 tBleStatus aci_l2cap_connection_parameter_update_response(uint16_t conn_handle, uint16_t interval_min,
00056                              uint16_t interval_max, uint16_t slave_latency,
00057                              uint16_t timeout_multiplier, uint8_t id, uint8_t accept);
00058 
00059 /**
00060  * @}
00061  */
00062    
00063 /**
00064  * @defgroup L2CAP_Events L2CAP events
00065  * @{
00066  */
00067 
00068 /**
00069  * This event is generated when the master responds to the L2CAP connection update request packet.
00070  * For more info see CONNECTION PARAMETER UPDATE RESPONSE in Bluetooth Core v4.0 spec.
00071  */
00072 #define EVT_BLUE_L2CAP_CONN_UPD_RESP          (0x0800)
00073 typedef __packed struct _evt_l2cap_conn_upd_resp{
00074   uint16_t conn_handle;
00075   uint8_t  resp_len;
00076   uint8_t  code; /**< It will always be 0x13  */
00077   uint8_t  identifier;
00078   uint16_t l2cap_length;
00079   uint16_t result;
00080 } PACKED evt_l2cap_conn_upd_resp;
00081 
00082 /**
00083  * This event is generated when the master does not respond to the connection update request
00084  * within 30 seconds.
00085  */
00086 #define EVT_BLUE_L2CAP_PROCEDURE_TIMEOUT      (0x0801)
00087 
00088 /**
00089  * The event is given by the L2CAP layer when a connection update request is received from the slave.
00090  * The application has to respond by calling aci_l2cap_connection_parameter_update_response().
00091  */
00092 #define EVT_BLUE_L2CAP_CONN_UPD_REQ           (0x0802)
00093 typedef __packed struct _evt_l2cap_conn_upd_req{
00094   uint16_t conn_handle;
00095   uint8_t  resp_len;
00096   uint8_t  code; /**< It will always be 0x12  */
00097   uint8_t  identifier;
00098   uint16_t l2cap_length;
00099   uint16_t interval_min;
00100   uint16_t interval_max;
00101   uint16_t slave_latency;
00102   uint16_t timeout_mult;
00103 } PACKED evt_l2cap_conn_upd_req;
00104 
00105 /**
00106  * @}
00107  */
00108 
00109 
00110 #endif /* __BLUENRG_L2CAP_ACI_H__ */
00111