mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-01-27 06:35:20 +00:00
allow to set packet handler for internal l2cap connections
This commit is contained in:
parent
81aa29cbfd
commit
6b296a2712
@ -135,7 +135,7 @@ static int btstack_command_handler(connection_t *connection, uint8_t *packet, ui
|
||||
case L2CAP_CREATE_CHANNEL:
|
||||
bt_flip_addr(addr, &packet[3]);
|
||||
psm = READ_BT_16(packet, 9);
|
||||
l2cap_create_channel_internal( connection, addr, psm );
|
||||
l2cap_create_channel_internal( connection, NULL, addr, psm );
|
||||
break;
|
||||
case L2CAP_DISCONNECT:
|
||||
cid = READ_BT_16(packet, 3);
|
||||
|
@ -183,7 +183,7 @@ void l2cap_send_internal(uint16_t local_cid, uint8_t *data, uint16_t len){
|
||||
}
|
||||
|
||||
// open outgoing L2CAP channel
|
||||
void l2cap_create_channel_internal(void * connection, bd_addr_t address, uint16_t psm){
|
||||
void l2cap_create_channel_internal(void * connection, btstack_packet_handler_t packet_handler, bd_addr_t address, uint16_t psm){
|
||||
|
||||
// alloc structure
|
||||
l2cap_channel_t * chan = malloc(sizeof(l2cap_channel_t));
|
||||
@ -195,7 +195,7 @@ void l2cap_create_channel_internal(void * connection, bd_addr_t address, uint16_
|
||||
chan->psm = psm;
|
||||
chan->handle = 0;
|
||||
chan->connection = connection;
|
||||
chan->packet_handler = NULL;
|
||||
chan->packet_handler = packet_handler;
|
||||
chan->remote_mtu = L2CAP_MINIMAL_MTU;
|
||||
|
||||
// set initial state
|
||||
|
@ -107,7 +107,7 @@ typedef struct {
|
||||
|
||||
void l2cap_init();
|
||||
void l2cap_register_packet_handler(void (*handler)(void * connection, uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size));
|
||||
void l2cap_create_channel_internal(void * connection, bd_addr_t address, uint16_t psm);
|
||||
void l2cap_create_channel_internal(void * connection, btstack_packet_handler_t packet_handler, bd_addr_t address, uint16_t psm);
|
||||
void l2cap_disconnect_internal(uint16_t local_cid, uint8_t reason);
|
||||
void l2cap_send_internal(uint16_t local_cid, uint8_t *data, uint16_t len);
|
||||
uint16_t l2cap_get_remote_mtu_for_local_cid(uint16_t local_cid);
|
||||
|
Loading…
x
Reference in New Issue
Block a user