l2cap.c (9a98c7803e511d6260a83042cfec5c16e3990ecc) l2cap.c (b93f89661ecd1d19be40311be96b92932960a800)
1/*
2 * Copyright (C) 2014 BlueKitchen GmbH
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

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

2454 }
2455 }
2456
2457 l2cap_run();
2458
2459 return ERROR_CODE_SUCCESS;
2460}
2461
1/*
2 * Copyright (C) 2014 BlueKitchen GmbH
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

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

2454 }
2455 }
2456
2457 l2cap_run();
2458
2459 return ERROR_CODE_SUCCESS;
2460}
2461
2462void l2cap_disconnect(uint16_t local_cid, uint8_t reason){
2463 log_info("disconnect local_cid 0x%x reason 0x%x", local_cid, reason);
2464 UNUSED(reason);
2465 // find channel for local_cid
2462uint8_t l2cap_disconnect(uint16_t local_cid){
2466 l2cap_channel_t * channel = l2cap_get_channel_for_local_cid(local_cid);
2463 l2cap_channel_t * channel = l2cap_get_channel_for_local_cid(local_cid);
2467 if (channel) {
2468 channel->state = L2CAP_STATE_WILL_SEND_DISCONNECT_REQUEST;
2464 if (!channel) {
2465 return L2CAP_LOCAL_CID_DOES_NOT_EXIST;
2469 }
2466 }
2470 // process
2467 channel->state = L2CAP_STATE_WILL_SEND_DISCONNECT_REQUEST;
2471 l2cap_run();
2468 l2cap_run();
2469 return ERROR_CODE_SUCCESS;
2472}
2473
2474static void l2cap_handle_connection_failed_for_addr(bd_addr_t address, uint8_t status){
2475 // mark all channels before emitting open events as these could trigger new connetion requests to the same device
2476 btstack_linked_list_iterator_t it;
2477 btstack_linked_list_iterator_init(&it, &l2cap_channels);
2478 while (btstack_linked_list_iterator_has_next(&it)){
2479 l2cap_channel_t * channel = (l2cap_channel_t *) btstack_linked_list_iterator_next(&it);

--- 3076 unchanged lines hidden ---
2470}
2471
2472static void l2cap_handle_connection_failed_for_addr(bd_addr_t address, uint8_t status){
2473 // mark all channels before emitting open events as these could trigger new connetion requests to the same device
2474 btstack_linked_list_iterator_t it;
2475 btstack_linked_list_iterator_init(&it, &l2cap_channels);
2476 while (btstack_linked_list_iterator_has_next(&it)){
2477 l2cap_channel_t * channel = (l2cap_channel_t *) btstack_linked_list_iterator_next(&it);

--- 3076 unchanged lines hidden ---