l2cap.c (eb920dbead2db537aa0971b64c2376c1bfa5d546) l2cap.c (9775e25bf20ac6af8d8305054e4795e2f68f9511)
1/*
2 * Copyright (C) 2009 by Matthias Ringwald
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright

--- 226 unchanged lines hidden (view full) ---

235void l2cap_create_channel_internal(void * connection, btstack_packet_handler_t packet_handler,
236 bd_addr_t address, uint16_t psm, uint16_t mtu){
237
238 // alloc structure
239 l2cap_channel_t * chan = malloc(sizeof(l2cap_channel_t));
240 // TODO: emit error event
241 if (!chan) return;
242
1/*
2 * Copyright (C) 2009 by Matthias Ringwald
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright

--- 226 unchanged lines hidden (view full) ---

235void l2cap_create_channel_internal(void * connection, btstack_packet_handler_t packet_handler,
236 bd_addr_t address, uint16_t psm, uint16_t mtu){
237
238 // alloc structure
239 l2cap_channel_t * chan = malloc(sizeof(l2cap_channel_t));
240 // TODO: emit error event
241 if (!chan) return;
242
243 // validate mtu
244 if (hci_max_acl_data_packet_length() < mtu) {
245 mtu = hci_max_acl_data_packet_length();
246 }
247
243 // fill in
244 BD_ADDR_COPY(chan->address, address);
245 chan->psm = psm;
246 chan->handle = 0;
247 chan->connection = connection;
248 chan->packet_handler = packet_handler;
249 chan->remote_mtu = L2CAP_MINIMAL_MTU;
250 chan->local_mtu = mtu;

--- 200 unchanged lines hidden (view full) ---

451 channel->handle = handle;
452 channel->connection = service->connection;
453 channel->packet_handler = service->packet_handler;
454 channel->local_cid = l2cap_next_local_cid();
455 channel->remote_cid = source_cid;
456 channel->local_mtu = service->mtu;
457 channel->remote_mtu = L2CAP_MINIMAL_MTU;
458
248 // fill in
249 BD_ADDR_COPY(chan->address, address);
250 chan->psm = psm;
251 chan->handle = 0;
252 chan->connection = connection;
253 chan->packet_handler = packet_handler;
254 chan->remote_mtu = L2CAP_MINIMAL_MTU;
255 chan->local_mtu = mtu;

--- 200 unchanged lines hidden (view full) ---

456 channel->handle = handle;
457 channel->connection = service->connection;
458 channel->packet_handler = service->packet_handler;
459 channel->local_cid = l2cap_next_local_cid();
460 channel->remote_cid = source_cid;
461 channel->local_mtu = service->mtu;
462 channel->remote_mtu = L2CAP_MINIMAL_MTU;
463
464 // validate mtu
465 if (hci_max_acl_data_packet_length() < channel->local_mtu) {
466 channel->local_mtu = hci_max_acl_data_packet_length();
467 }
468
459 // set initial state
460 channel->state = L2CAP_STATE_WAIT_CLIENT_ACCEPT_OR_REJECT;
461
462 // temp. store req sig id
463 channel->sig_id = sig_id;
464
465 // add to connections list
466 linked_list_add(&l2cap_channels, (linked_item_t *) channel);

--- 394 unchanged lines hidden ---
469 // set initial state
470 channel->state = L2CAP_STATE_WAIT_CLIENT_ACCEPT_OR_REJECT;
471
472 // temp. store req sig id
473 channel->sig_id = sig_id;
474
475 // add to connections list
476 linked_list_add(&l2cap_channels, (linked_item_t *) channel);

--- 394 unchanged lines hidden ---