Maxim Integrated / MaximBLE

Dependents:   BLE_Thermometer MAXWSNENV_demo

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers l2c_api.h Source File

l2c_api.h

Go to the documentation of this file.
00001 /*************************************************************************************************/
00002 /*!
00003  *  \file   l2c_api.h
00004  *        
00005  *  \brief  L2CAP subsystem API.
00006  *
00007  *          $Date: 2012-03-07 22:32:20 -0800 (Wed, 07 Mar 2012) $
00008  *          $Revision: 268 $
00009  *  
00010  *  Copyright (c) 2009-2016 ARM Limited. All rights reserved.
00011  *
00012  *  SPDX-License-Identifier: LicenseRef-PBL
00013  *
00014  *  Licensed under the Permissive Binary License, Version 1.0 (the "License"); you may not use
00015  *  this file except in compliance with the License.  You may obtain a copy of the License at
00016  *
00017  *  https://www.mbed.com/licenses/PBL-1.0
00018  *
00019  *  See the License for the specific language governing permissions and limitations under the License.
00020  */
00021 /*************************************************************************************************/
00022 #ifndef L2C_API_H
00023 #define L2C_API_H
00024 
00025 #include "hci_api.h"
00026 #include "l2c_defs.h"
00027 
00028 #ifdef __cplusplus
00029 extern "C" {
00030 #endif
00031 
00032 /**************************************************************************************************
00033   Macros
00034 **************************************************************************************************/
00035 
00036 /*! Control callback message events */
00037 #define L2C_CTRL_FLOW_ENABLE_IND          0         /*! Data flow enabled */
00038 #define L2C_CTRL_FLOW_DISABLE_IND         1         /*! Data flow disabled */
00039 
00040 /**************************************************************************************************
00041   Callback Function Types
00042 **************************************************************************************************/
00043 
00044 /*************************************************************************************************/
00045 /*!
00046  *  \fn     l2cDataCback_t
00047  *        
00048  *  \brief  This callback function sends a received L2CAP packet to the client.
00049  *
00050  *  \param  handle    The connection handle.
00051  *  \param  len       The length of the L2CAP payload data in pPacket.
00052  *  \param  pPacket   A buffer containing the packet.
00053  *
00054  *  \return None.
00055  */
00056 /*************************************************************************************************/
00057 typedef void (*l2cDataCback_t)(uint16_t handle, uint16_t len, uint8_t *pPacket);
00058 
00059 /*************************************************************************************************/
00060 /*!
00061  *  \fn     l2cCtrlCback_t
00062  *        
00063  *  \brief  This callback function sends control messages to the client.
00064  *
00065  *  \param  pMsg    Pointer to message structure.
00066  *
00067  *  \return None.
00068  */
00069 /*************************************************************************************************/
00070 typedef void (*l2cCtrlCback_t)(wsfMsgHdr_t  *pMsg);
00071 
00072 /**************************************************************************************************
00073   Function Declarations
00074 **************************************************************************************************/
00075 
00076 /*************************************************************************************************/
00077 /*!
00078  *  \fn     L2cInit
00079  *        
00080  *  \brief  Initialize L2C subsystem.
00081  *
00082  *  \return None.
00083  */
00084 /*************************************************************************************************/
00085 void L2cInit(void);
00086 
00087 /*************************************************************************************************/
00088 /*!
00089  *  \fn     L2cMasterInit
00090  *        
00091  *  \brief  Initialize L2C for operation as a Bluetooth LE master.
00092  *
00093  *  \return None.
00094  */
00095 /*************************************************************************************************/
00096 void L2cMasterInit(void);
00097 
00098 /*************************************************************************************************/
00099 /*!
00100  *  \fn     L2cSlaveInit
00101  *        
00102  *  \brief  Initialize L2C for operation as a Bluetooth LE slave.
00103  *
00104  *  \return None.
00105  */
00106 /*************************************************************************************************/
00107 void L2cSlaveInit(void);
00108 
00109 /*************************************************************************************************/
00110 /*!
00111  *  \fn     L2cRegister
00112  *        
00113  *  \brief  called by the L2C client, such as ATT or SMP, to register for the given CID.
00114  *
00115  *  \param  cid       channel identifier.
00116  *  \param  dataCback Callback function for L2CAP data received for this CID.
00117  *  \param  ctrlCback Callback function for control events for this CID.
00118  *
00119  *  \return None.
00120  */
00121 /*************************************************************************************************/
00122 void L2cRegister(uint16_t cid, l2cDataCback_t dataCback, l2cCtrlCback_t ctrlCback);
00123 
00124 /*************************************************************************************************/
00125 /*!
00126  *  \fn     L2cDataReq
00127  *        
00128  *  \brief  Send an L2CAP data packet on the given CID.
00129  *
00130  *  \param  cid       The channel identifier.
00131  *  \param  handle    The connection handle.  The client receives this handle from DM.
00132  *  \param  len       The length of the payload data in pPacket.
00133  *  \param  pPacket   A buffer containing the packet. 
00134  *
00135  *  \return None.
00136  */
00137 /*************************************************************************************************/
00138 void L2cDataReq(uint16_t cid, uint16_t handle, uint16_t len, uint8_t *pL2cPacket);
00139 
00140 /*************************************************************************************************/
00141 /*!
00142  *  \fn     L2cDmConnUpdateReq
00143  *        
00144  *  \brief  This function is called by DM to send an L2CAP connection update request.
00145  *
00146  *  \param  handle      The connection handle.
00147  *  \param  pConnSpec   Pointer to the connection specification structure.
00148  *
00149  *  \return None.
00150  */
00151 /*************************************************************************************************/
00152 void L2cDmConnUpdateReq(uint16_t handle, hciConnSpec_t  *pConnSpec);
00153 
00154 /*************************************************************************************************/
00155 /*!
00156  *  \fn     L2cDmConnUpdateRsp
00157  *        
00158  *  \brief  This function is called by DM to send an L2CAP connection update response.
00159  *
00160  *  \param  identifier  Identifier value previously passed from L2C to DM.
00161  *  \param  handle      The connection handle.
00162  *  \param  result      Connection update response result.
00163  *
00164  *  \return None.
00165  */
00166 /*************************************************************************************************/
00167 void L2cDmConnUpdateRsp(uint8_t identifier, uint16_t handle, uint16_t result);
00168 
00169 #ifdef __cplusplus
00170 };
00171 #endif
00172 
00173 #endif /* L2C_API_H */