Maxim Integrated Bluetooth LE Library
Dependents: BLE_Thermometer MAXWSNENV_demo
exactLE/stack/include/l2c_api.h@0:b562096246b3, 2016-03-03 (annotated)
- Committer:
- enginerd
- Date:
- Thu Mar 03 14:13:21 2016 +0000
- Revision:
- 0:b562096246b3
Initial commit of Maxim Integrated Bluetooth LE Library
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
enginerd | 0:b562096246b3 | 1 | /*************************************************************************************************/ |
enginerd | 0:b562096246b3 | 2 | /*! |
enginerd | 0:b562096246b3 | 3 | * \file l2c_api.h |
enginerd | 0:b562096246b3 | 4 | * |
enginerd | 0:b562096246b3 | 5 | * \brief L2CAP subsystem API. |
enginerd | 0:b562096246b3 | 6 | * |
enginerd | 0:b562096246b3 | 7 | * $Date: 2012-03-07 22:32:20 -0800 (Wed, 07 Mar 2012) $ |
enginerd | 0:b562096246b3 | 8 | * $Revision: 268 $ |
enginerd | 0:b562096246b3 | 9 | * |
enginerd | 0:b562096246b3 | 10 | * Copyright (c) 2009-2016 ARM Limited. All rights reserved. |
enginerd | 0:b562096246b3 | 11 | * |
enginerd | 0:b562096246b3 | 12 | * SPDX-License-Identifier: LicenseRef-PBL |
enginerd | 0:b562096246b3 | 13 | * |
enginerd | 0:b562096246b3 | 14 | * Licensed under the Permissive Binary License, Version 1.0 (the "License"); you may not use |
enginerd | 0:b562096246b3 | 15 | * this file except in compliance with the License. You may obtain a copy of the License at |
enginerd | 0:b562096246b3 | 16 | * |
enginerd | 0:b562096246b3 | 17 | * https://www.mbed.com/licenses/PBL-1.0 |
enginerd | 0:b562096246b3 | 18 | * |
enginerd | 0:b562096246b3 | 19 | * See the License for the specific language governing permissions and limitations under the License. |
enginerd | 0:b562096246b3 | 20 | */ |
enginerd | 0:b562096246b3 | 21 | /*************************************************************************************************/ |
enginerd | 0:b562096246b3 | 22 | #ifndef L2C_API_H |
enginerd | 0:b562096246b3 | 23 | #define L2C_API_H |
enginerd | 0:b562096246b3 | 24 | |
enginerd | 0:b562096246b3 | 25 | #include "hci_api.h" |
enginerd | 0:b562096246b3 | 26 | #include "l2c_defs.h" |
enginerd | 0:b562096246b3 | 27 | |
enginerd | 0:b562096246b3 | 28 | #ifdef __cplusplus |
enginerd | 0:b562096246b3 | 29 | extern "C" { |
enginerd | 0:b562096246b3 | 30 | #endif |
enginerd | 0:b562096246b3 | 31 | |
enginerd | 0:b562096246b3 | 32 | /************************************************************************************************** |
enginerd | 0:b562096246b3 | 33 | Macros |
enginerd | 0:b562096246b3 | 34 | **************************************************************************************************/ |
enginerd | 0:b562096246b3 | 35 | |
enginerd | 0:b562096246b3 | 36 | /*! Control callback message events */ |
enginerd | 0:b562096246b3 | 37 | #define L2C_CTRL_FLOW_ENABLE_IND 0 /*! Data flow enabled */ |
enginerd | 0:b562096246b3 | 38 | #define L2C_CTRL_FLOW_DISABLE_IND 1 /*! Data flow disabled */ |
enginerd | 0:b562096246b3 | 39 | |
enginerd | 0:b562096246b3 | 40 | /************************************************************************************************** |
enginerd | 0:b562096246b3 | 41 | Callback Function Types |
enginerd | 0:b562096246b3 | 42 | **************************************************************************************************/ |
enginerd | 0:b562096246b3 | 43 | |
enginerd | 0:b562096246b3 | 44 | /*************************************************************************************************/ |
enginerd | 0:b562096246b3 | 45 | /*! |
enginerd | 0:b562096246b3 | 46 | * \fn l2cDataCback_t |
enginerd | 0:b562096246b3 | 47 | * |
enginerd | 0:b562096246b3 | 48 | * \brief This callback function sends a received L2CAP packet to the client. |
enginerd | 0:b562096246b3 | 49 | * |
enginerd | 0:b562096246b3 | 50 | * \param handle The connection handle. |
enginerd | 0:b562096246b3 | 51 | * \param len The length of the L2CAP payload data in pPacket. |
enginerd | 0:b562096246b3 | 52 | * \param pPacket A buffer containing the packet. |
enginerd | 0:b562096246b3 | 53 | * |
enginerd | 0:b562096246b3 | 54 | * \return None. |
enginerd | 0:b562096246b3 | 55 | */ |
enginerd | 0:b562096246b3 | 56 | /*************************************************************************************************/ |
enginerd | 0:b562096246b3 | 57 | typedef void (*l2cDataCback_t)(uint16_t handle, uint16_t len, uint8_t *pPacket); |
enginerd | 0:b562096246b3 | 58 | |
enginerd | 0:b562096246b3 | 59 | /*************************************************************************************************/ |
enginerd | 0:b562096246b3 | 60 | /*! |
enginerd | 0:b562096246b3 | 61 | * \fn l2cCtrlCback_t |
enginerd | 0:b562096246b3 | 62 | * |
enginerd | 0:b562096246b3 | 63 | * \brief This callback function sends control messages to the client. |
enginerd | 0:b562096246b3 | 64 | * |
enginerd | 0:b562096246b3 | 65 | * \param pMsg Pointer to message structure. |
enginerd | 0:b562096246b3 | 66 | * |
enginerd | 0:b562096246b3 | 67 | * \return None. |
enginerd | 0:b562096246b3 | 68 | */ |
enginerd | 0:b562096246b3 | 69 | /*************************************************************************************************/ |
enginerd | 0:b562096246b3 | 70 | typedef void (*l2cCtrlCback_t)(wsfMsgHdr_t *pMsg); |
enginerd | 0:b562096246b3 | 71 | |
enginerd | 0:b562096246b3 | 72 | /************************************************************************************************** |
enginerd | 0:b562096246b3 | 73 | Function Declarations |
enginerd | 0:b562096246b3 | 74 | **************************************************************************************************/ |
enginerd | 0:b562096246b3 | 75 | |
enginerd | 0:b562096246b3 | 76 | /*************************************************************************************************/ |
enginerd | 0:b562096246b3 | 77 | /*! |
enginerd | 0:b562096246b3 | 78 | * \fn L2cInit |
enginerd | 0:b562096246b3 | 79 | * |
enginerd | 0:b562096246b3 | 80 | * \brief Initialize L2C subsystem. |
enginerd | 0:b562096246b3 | 81 | * |
enginerd | 0:b562096246b3 | 82 | * \return None. |
enginerd | 0:b562096246b3 | 83 | */ |
enginerd | 0:b562096246b3 | 84 | /*************************************************************************************************/ |
enginerd | 0:b562096246b3 | 85 | void L2cInit(void); |
enginerd | 0:b562096246b3 | 86 | |
enginerd | 0:b562096246b3 | 87 | /*************************************************************************************************/ |
enginerd | 0:b562096246b3 | 88 | /*! |
enginerd | 0:b562096246b3 | 89 | * \fn L2cMasterInit |
enginerd | 0:b562096246b3 | 90 | * |
enginerd | 0:b562096246b3 | 91 | * \brief Initialize L2C for operation as a Bluetooth LE master. |
enginerd | 0:b562096246b3 | 92 | * |
enginerd | 0:b562096246b3 | 93 | * \return None. |
enginerd | 0:b562096246b3 | 94 | */ |
enginerd | 0:b562096246b3 | 95 | /*************************************************************************************************/ |
enginerd | 0:b562096246b3 | 96 | void L2cMasterInit(void); |
enginerd | 0:b562096246b3 | 97 | |
enginerd | 0:b562096246b3 | 98 | /*************************************************************************************************/ |
enginerd | 0:b562096246b3 | 99 | /*! |
enginerd | 0:b562096246b3 | 100 | * \fn L2cSlaveInit |
enginerd | 0:b562096246b3 | 101 | * |
enginerd | 0:b562096246b3 | 102 | * \brief Initialize L2C for operation as a Bluetooth LE slave. |
enginerd | 0:b562096246b3 | 103 | * |
enginerd | 0:b562096246b3 | 104 | * \return None. |
enginerd | 0:b562096246b3 | 105 | */ |
enginerd | 0:b562096246b3 | 106 | /*************************************************************************************************/ |
enginerd | 0:b562096246b3 | 107 | void L2cSlaveInit(void); |
enginerd | 0:b562096246b3 | 108 | |
enginerd | 0:b562096246b3 | 109 | /*************************************************************************************************/ |
enginerd | 0:b562096246b3 | 110 | /*! |
enginerd | 0:b562096246b3 | 111 | * \fn L2cRegister |
enginerd | 0:b562096246b3 | 112 | * |
enginerd | 0:b562096246b3 | 113 | * \brief called by the L2C client, such as ATT or SMP, to register for the given CID. |
enginerd | 0:b562096246b3 | 114 | * |
enginerd | 0:b562096246b3 | 115 | * \param cid channel identifier. |
enginerd | 0:b562096246b3 | 116 | * \param dataCback Callback function for L2CAP data received for this CID. |
enginerd | 0:b562096246b3 | 117 | * \param ctrlCback Callback function for control events for this CID. |
enginerd | 0:b562096246b3 | 118 | * |
enginerd | 0:b562096246b3 | 119 | * \return None. |
enginerd | 0:b562096246b3 | 120 | */ |
enginerd | 0:b562096246b3 | 121 | /*************************************************************************************************/ |
enginerd | 0:b562096246b3 | 122 | void L2cRegister(uint16_t cid, l2cDataCback_t dataCback, l2cCtrlCback_t ctrlCback); |
enginerd | 0:b562096246b3 | 123 | |
enginerd | 0:b562096246b3 | 124 | /*************************************************************************************************/ |
enginerd | 0:b562096246b3 | 125 | /*! |
enginerd | 0:b562096246b3 | 126 | * \fn L2cDataReq |
enginerd | 0:b562096246b3 | 127 | * |
enginerd | 0:b562096246b3 | 128 | * \brief Send an L2CAP data packet on the given CID. |
enginerd | 0:b562096246b3 | 129 | * |
enginerd | 0:b562096246b3 | 130 | * \param cid The channel identifier. |
enginerd | 0:b562096246b3 | 131 | * \param handle The connection handle. The client receives this handle from DM. |
enginerd | 0:b562096246b3 | 132 | * \param len The length of the payload data in pPacket. |
enginerd | 0:b562096246b3 | 133 | * \param pPacket A buffer containing the packet. |
enginerd | 0:b562096246b3 | 134 | * |
enginerd | 0:b562096246b3 | 135 | * \return None. |
enginerd | 0:b562096246b3 | 136 | */ |
enginerd | 0:b562096246b3 | 137 | /*************************************************************************************************/ |
enginerd | 0:b562096246b3 | 138 | void L2cDataReq(uint16_t cid, uint16_t handle, uint16_t len, uint8_t *pL2cPacket); |
enginerd | 0:b562096246b3 | 139 | |
enginerd | 0:b562096246b3 | 140 | /*************************************************************************************************/ |
enginerd | 0:b562096246b3 | 141 | /*! |
enginerd | 0:b562096246b3 | 142 | * \fn L2cDmConnUpdateReq |
enginerd | 0:b562096246b3 | 143 | * |
enginerd | 0:b562096246b3 | 144 | * \brief This function is called by DM to send an L2CAP connection update request. |
enginerd | 0:b562096246b3 | 145 | * |
enginerd | 0:b562096246b3 | 146 | * \param handle The connection handle. |
enginerd | 0:b562096246b3 | 147 | * \param pConnSpec Pointer to the connection specification structure. |
enginerd | 0:b562096246b3 | 148 | * |
enginerd | 0:b562096246b3 | 149 | * \return None. |
enginerd | 0:b562096246b3 | 150 | */ |
enginerd | 0:b562096246b3 | 151 | /*************************************************************************************************/ |
enginerd | 0:b562096246b3 | 152 | void L2cDmConnUpdateReq(uint16_t handle, hciConnSpec_t *pConnSpec); |
enginerd | 0:b562096246b3 | 153 | |
enginerd | 0:b562096246b3 | 154 | /*************************************************************************************************/ |
enginerd | 0:b562096246b3 | 155 | /*! |
enginerd | 0:b562096246b3 | 156 | * \fn L2cDmConnUpdateRsp |
enginerd | 0:b562096246b3 | 157 | * |
enginerd | 0:b562096246b3 | 158 | * \brief This function is called by DM to send an L2CAP connection update response. |
enginerd | 0:b562096246b3 | 159 | * |
enginerd | 0:b562096246b3 | 160 | * \param identifier Identifier value previously passed from L2C to DM. |
enginerd | 0:b562096246b3 | 161 | * \param handle The connection handle. |
enginerd | 0:b562096246b3 | 162 | * \param result Connection update response result. |
enginerd | 0:b562096246b3 | 163 | * |
enginerd | 0:b562096246b3 | 164 | * \return None. |
enginerd | 0:b562096246b3 | 165 | */ |
enginerd | 0:b562096246b3 | 166 | /*************************************************************************************************/ |
enginerd | 0:b562096246b3 | 167 | void L2cDmConnUpdateRsp(uint8_t identifier, uint16_t handle, uint16_t result); |
enginerd | 0:b562096246b3 | 168 | |
enginerd | 0:b562096246b3 | 169 | #ifdef __cplusplus |
enginerd | 0:b562096246b3 | 170 | }; |
enginerd | 0:b562096246b3 | 171 | #endif |
enginerd | 0:b562096246b3 | 172 | |
enginerd | 0:b562096246b3 | 173 | #endif /* L2C_API_H */ |