Mistake on this page?
Report an issue in GitHub or email us
Data Structures | Macros | Typedefs
l2c_api.h File Reference

L2CAP subsystem API. More...

#include "dm_api.h"
#include "l2c_defs.h"

Go to the source code of this file.

Data Structures

struct  l2cCocReg_t
 Connection oriented channel registration structure. More...
 
struct  l2cCocConnectInd_t
 Connection oriented channel connect indication structure. More...
 
struct  l2cCocDisconnectInd_t
 Connection oriented channel disconnect indication structure. More...
 
struct  l2cCocDataInd_t
 Connection oriented channel data indication structure. More...
 
struct  l2cCocDataCnf_t
 Connection oriented channel disconnect indication structure. More...
 
struct  l2cCocEnConnectInd_t
 Enhanced connection oriented channel connect indication structure. More...
 
struct  l2cCocEnReconfigInd_t
 Enhanced connection oriented channel reconfiguration indication structure. More...
 
union  l2cCocEvt_t
 Connection oriented channel event structure. More...
 
struct  l2cCfg_t
 Configurable parameters. More...
 

Macros

#define L2C_COC_REG_ID_NONE   0
 Invalid channel registration ID for connection oriented channels. More...
 
#define L2C_COC_CID_NONE   0
 Invalid channel ID for connection oriented channels. More...
 
#define L2C_SIGNAL_ID_INVALID   0
 Invalid signal identifier. More...
 
L2CAP Control Callback Events

Control callback message events

#define L2C_CTRL_FLOW_ENABLE_IND   0
 Data flow enabled. More...
 
#define L2C_CTRL_FLOW_DISABLE_IND   1
 Data flow disabled. More...
 
L2CAP COC Channel Roles

Connection oriented channel initiator/acceptor role

#define L2C_COC_ROLE_NONE   0x00
 No role (unallocated) More...
 
#define L2C_COC_ROLE_INITIATOR   0x01
 Channel initiator. More...
 
#define L2C_COC_ROLE_ACCEPTOR   0x02
 Channel acceptor. More...
 
L2CAP COC Data Confirm Codes

Connection oriented channel data confirm status values

#define L2C_COC_DATA_SUCCESS   0
 Data request successful. More...
 
#define L2C_COC_DATA_ERR_MEMORY   1
 Out of memory. More...
 
#define L2C_COC_DATA_ERR_OVERFLOW   2
 Transaction overflow. More...
 

Typedefs

typedef uint16_t l2cCocRegId_t
 Connection oriented channel registration ID. More...
 
typedef void(* l2cDataCback_t) (uint16_t handle, uint16_t len, uint8_t *pPacket)
 This callback function sends a received L2CAP packet to the client. More...
 
typedef void(* l2cCtrlCback_t) (wsfMsgHdr_t *pMsg)
 This callback function sends control messages to the client. More...
 
typedef void(* l2cCocCback_t) (l2cCocEvt_t *pMsg)
 This callback function sends data and other events to connection oriented channels clients. More...
 
typedef uint8_t(* l2cCocAcceptCb_t) (dmConnId_t connId, uint8_t numChans)
 This callback function asks clients of connection oriented channels if a given number of channels can be created on the PSM. More...
 
typedef uint16_t(* l2cCocAuthorCback_t) (dmConnId_t connId, l2cCocRegId_t regId, uint16_t psm)
 This callback function is used for authoriztion of connection oriented channels. More...
 

Functions

L2CAP Initialization

Initialization and registration functions

void L2cInit (void)
 Initialize L2C subsystem. More...
 
void L2cMasterInit (void)
 Initialize L2C for operation as a Bluetooth LE master. More...
 
void L2cSlaveInit (void)
 Initialize L2C for operation as a Bluetooth LE slave. More...
 
L2CAP CID Functions

Register and send data over a CID

void L2cRegister (uint16_t cid, l2cDataCback_t dataCback, l2cCtrlCback_t ctrlCback)
 called by the L2C client, such as ATT or SMP, to register for the given CID. More...
 
void L2cDataReq (uint16_t cid, uint16_t handle, uint16_t len, uint8_t *pL2cPacket)
 Send an L2CAP data packet on the given CID. More...
 
void L2cDmSigReq (uint16_t handle, uint8_t code, uint16_t len, uint8_t *pParam)
 Build and send a signaling packet. More...
 
L2CAP COC Functions

Connection Oriented Channels Functions

void L2cCocInit (void)
 Initialize L2C connection oriented channel subsystem. More...
 
l2cCocRegId_t L2cCocRegister (l2cCocCback_t cback, l2cCocReg_t *pReg)
 Register to use a connection oriented channel, as either a channel acceptor, initiator, or both. If registering as channel acceptor then the PSM is specified. After registering a connection can be established by the client using this registration instance. More...
 
void L2cCocDeregister (l2cCocRegId_t regId)
 Deregister and deallocate a connection oriented channel registration instance. This function should only be called if there are no active channels using this registration instance. More...
 
void L2cCocSetAcceptCback (l2cCocRegId_t regId, l2cCocAcceptCb_t cback)
 Set the channel accept callback. More...
 
uint16_t L2cCocConnectReq (dmConnId_t connId, l2cCocRegId_t regId, uint16_t psm)
 Initiate a connection to the given peer PSM. More...
 
void L2cCocDisconnectReq (uint16_t cid)
 Disconnect the channel for the given CID. More...
 
void L2cCocDataReq (uint16_t cid, uint16_t len, uint8_t *pPayload)
 Send an L2CAP data packet on the given connection oriented CID. More...
 
bool_t L2cCocEnhancedConnectReq (dmConnId_t connId, l2cCocRegId_t regId, uint16_t psm, uint16_t credits, uint8_t numChan)
 Send a request to open enhanced credit based channels. More...
 
bool_t L2cCocEnhancedReconfigReq (dmConnId_t connId, uint16_t mtu, uint16_t mps, uint8_t numChan, uint16_t *pChanList)
 Send a request to reconfigure enhanced credit based channels. More...
 
void L2cCocErrorTest (uint16_t result)
 For testing purposes only. More...
 
void L2cCocCreditSendTest (uint16_t cid, uint16_t credits)
 For testing purposes only. More...
 
L2CAP Connection Parameter Update Functions
void L2cDmConnUpdateReq (uint16_t handle, hciConnSpec_t *pConnSpec)
 For internal use only. This function is called by DM to send an L2CAP connection update request. More...
 
void L2cDmConnUpdateRsp (uint8_t identifier, uint16_t handle, uint16_t result)
 For internal use only. This function is called by DM to send an L2CAP connection update response. More...
 

Variables

L2CAP Configuration Structure

Pointer to structure containing initialization details of the L2CAP Subsystem.

To be configured by Application.

l2cCfg_tpL2cCfg
 Configuration pointer. More...
 

L2CAP COC Callback Events

Connection oriented channel callback events.

#define L2C_COC_CBACK_START   0x70
 L2C callback event starting value. More...
 
#define L2C_COC_CBACK_CBACK_END   L2C_COC_DATA_CNF
 L2C callback event ending value. More...
 

Detailed Description

L2CAP subsystem API.

Copyright (c) 2009-2018 Arm Ltd. All Rights Reserved.

Copyright (c) 2019-2020 Packetcraft, Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Definition in file l2c_api.h.

Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.