1 /* 2 * l2cap.h 3 * 4 * Logical Link Control and Adaption Protocl (L2CAP) 5 * 6 * Created by Matthias Ringwald on 5/16/09. 7 */ 8 9 #pragma once 10 11 #include "hci.h" 12 #include "l2cap_signaling.h" 13 #include "utils.h" 14 15 #define L2CAP_SIG_ID_INVALID 0 16 17 typedef enum { 18 L2CAP_STATE_CLOSED, // no baseband 19 L2CAP_STATE_CONNECTED, // baseband connection 20 L2CAP_STATE_W4_L2CA_CONNECTION_RSP, // from application 21 L2CAP_STATE_W4_L2CAP_CONNECTION_RSP, // from peer 22 L2CAP_STATE_CONFIG, 23 L2CAP_STATE_OPEN, 24 L2CAP_STATE_W4_L2CA_DISCON_RSP, // from application 25 L2CAP_STATE_W4_L2CAP_DISCON_RSP, // from peer 26 } L2CAP_STATE; 27 28 typedef struct { 29 L2CAP_STATE state; 30 uint8_t sig_id; 31 uint16_t local_cid; 32 bd_addr_t address; 33 uint16_t psm; 34 hci_con_handle_t handle; 35 void (*event_callback)(uint8_t *packet, uint16_t size); 36 void (*data_callback)(uint8_t *packet, uint16_t size); 37 // uint16_t mtu_incoming; 38 // uint16_t mtu_outgoing; 39 // uint16_t flush_timeout_incoming; 40 // uint16_t flush_timeout_outgoing; 41 } l2cap_channel_t; 42 43 typedef struct { 44 45 } l2cap_service_t; 46 47 void l2cap_init(); 48 int l2cap_send_signaling_packet(hci_con_handle_t handle, L2CAP_SIGNALING_COMMANDS cmd, uint8_t identifier, ...); 49