Skip to content

File syn_ble_l2cap.h

FileList > ble > syn_ble_l2cap.h

Go to the source code of this file

Zero-Heap BLE Logical Link Control and Adaptation Protocol (L2CAP).

  • #include "../common/syn_defs.h"
  • #include "syn_ble_hci.h"
  • #include <stdbool.h>
  • #include <stddef.h>
  • #include <stdint.h>

Classes

Type Name
struct SYN_BLE_L2CAP_Connection
struct SYN_BLE_L2CAP_s

Public Types

Type Name
typedef void(* SYN_BLE_L2CAP_RxCb

Public Functions

Type Name
SYN_Status syn_ble_l2cap_connect (SYN_BLE_L2CAP * l2cap, uint16_t conn_handle)
Register connection handle.
SYN_Status syn_ble_l2cap_disconnect (SYN_BLE_L2CAP * l2cap, uint16_t conn_handle)
Unregister connection handle.
SYN_Status syn_ble_l2cap_encode_pdu (uint16_t conn_handle, uint16_t cid, const uint8_t * payload, uint16_t len, uint8_t * tx_buf, uint16_t * tx_len)
Encode L2CAP PDU for transmission over HCI ACL.
SYN_Status syn_ble_l2cap_init (SYN_BLE_L2CAP * l2cap, SYN_BLE_L2CAP_RxCb rx_cb, void * user_data)
Initialize L2CAP engine context.
SYN_Status syn_ble_l2cap_process_acl (SYN_BLE_L2CAP * l2cap, uint16_t conn_handle, uint8_t pb_bc_flags, const uint8_t * data, uint16_t len)
Process incoming ACL packet from HCI layer.

Macros

Type Name
define SYN_BLE_L2CAP_BUF_SIZE 256U
define SYN_BLE_L2CAP_CID_ATT 0x0004U
define SYN_BLE_L2CAP_CID_SIGNALING 0x0005U
define SYN_BLE_L2CAP_CID_SMP 0x0006U
define SYN_BLE_MAX_CONNECTIONS 2U

Public Types Documentation

typedef SYN_BLE_L2CAP_RxCb

typedef void(* SYN_BLE_L2CAP_RxCb) (SYN_BLE_L2CAP *l2cap, uint16_t conn_handle, uint16_t cid, const uint8_t *payload, uint16_t len, void *user_data);

L2CAP PDU Received Callback


Public Functions Documentation

function syn_ble_l2cap_connect

Register connection handle.

SYN_Status syn_ble_l2cap_connect (
    SYN_BLE_L2CAP * l2cap,
    uint16_t conn_handle
) 

Parameters:

  • l2cap Context handle pointer.
  • conn_handle Connection handle assigned by HCI.

Returns:

SYN_OK on success.


function syn_ble_l2cap_disconnect

Unregister connection handle.

SYN_Status syn_ble_l2cap_disconnect (
    SYN_BLE_L2CAP * l2cap,
    uint16_t conn_handle
) 

Parameters:

  • l2cap Context handle pointer.
  • conn_handle Connection handle assigned by HCI.

Returns:

SYN_OK on success.


function syn_ble_l2cap_encode_pdu

Encode L2CAP PDU for transmission over HCI ACL.

SYN_Status syn_ble_l2cap_encode_pdu (
    uint16_t conn_handle,
    uint16_t cid,
    const uint8_t * payload,
    uint16_t len,
    uint8_t * tx_buf,
    uint16_t * tx_len
) 

Parameters:

  • conn_handle Connection handle.
  • cid Channel ID (e.g. SYN_BLE_L2CAP_CID_ATT).
  • payload PDU payload buffer.
  • len Payload length.
  • tx_buf Output buffer for HCI ACL frame.
  • tx_len Output size pointer.

Returns:

SYN_OK on success.


function syn_ble_l2cap_init

Initialize L2CAP engine context.

SYN_Status syn_ble_l2cap_init (
    SYN_BLE_L2CAP * l2cap,
    SYN_BLE_L2CAP_RxCb rx_cb,
    void * user_data
) 

Parameters:

  • l2cap Context handle pointer.
  • rx_cb PDU receive callback.
  • user_data User context pointer.

Returns:

SYN_OK on success.


function syn_ble_l2cap_process_acl

Process incoming ACL packet from HCI layer.

SYN_Status syn_ble_l2cap_process_acl (
    SYN_BLE_L2CAP * l2cap,
    uint16_t conn_handle,
    uint8_t pb_bc_flags,
    const uint8_t * data,
    uint16_t len
) 

Parameters:

  • l2cap Context handle pointer.
  • conn_handle Connection handle.
  • pb_bc_flags Packet boundary/broadcast flags.
  • data ACL payload.
  • len Payload length.

Returns:

SYN_OK on success.


Macro Definition Documentation

define SYN_BLE_L2CAP_BUF_SIZE

#define SYN_BLE_L2CAP_BUF_SIZE `256U`

Maximum reassembled L2CAP PDU size


define SYN_BLE_L2CAP_CID_ATT

#define SYN_BLE_L2CAP_CID_ATT `0x0004U`

Attribute Protocol (ATT) Channel


define SYN_BLE_L2CAP_CID_SIGNALING

#define SYN_BLE_L2CAP_CID_SIGNALING `0x0005U`

LE Signaling Channel


define SYN_BLE_L2CAP_CID_SMP

#define SYN_BLE_L2CAP_CID_SMP `0x0006U`

Security Manager Protocol (SMP) Channel


define SYN_BLE_MAX_CONNECTIONS

#define SYN_BLE_MAX_CONNECTIONS `2U`

Maximum active BLE connection handles



The documentation for this class was generated from the following file src/syntropic/ble/syn_ble_l2cap.h