daemon.c (5c092d2da577b08cdaa3491a6879ce41cb72e537) daemon.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

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

544 l2cap_unregister_service(item->value);
545 btstack_linked_list_remove(l2cap_psms, (btstack_linked_item_t *) item);
546 free(item);
547 }
548
549 btstack_linked_list_iterator_init(&it, l2cap_cids);
550 while (btstack_linked_list_iterator_has_next(&it)){
551 btstack_linked_list_uint32_t * item = (btstack_linked_list_uint32_t*) btstack_linked_list_iterator_next(&it);
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

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

544 l2cap_unregister_service(item->value);
545 btstack_linked_list_remove(l2cap_psms, (btstack_linked_item_t *) item);
546 free(item);
547 }
548
549 btstack_linked_list_iterator_init(&it, l2cap_cids);
550 while (btstack_linked_list_iterator_has_next(&it)){
551 btstack_linked_list_uint32_t * item = (btstack_linked_list_uint32_t*) btstack_linked_list_iterator_next(&it);
552 l2cap_disconnect(item->value, 0); // note: reason isn't used
552 l2cap_disconnect(item->value);
553 btstack_linked_list_remove(l2cap_cids, (btstack_linked_item_t *) item);
554 free(item);
555 }
556}
557
558static void daemon_sdp_close_connection(client_state_t * daemon_client){
559 btstack_linked_list_t * list = &daemon_client->sdp_record_handles;
560 btstack_linked_list_iterator_t it;

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

980 if (status){
981 send_l2cap_connection_open_failed(connection, addr, psm, status);
982 } else {
983 daemon_add_client_l2cap_channel(connection, cid);
984 }
985 break;
986 case L2CAP_DISCONNECT:
987 cid = little_endian_read_16(packet, 3);
553 btstack_linked_list_remove(l2cap_cids, (btstack_linked_item_t *) item);
554 free(item);
555 }
556}
557
558static void daemon_sdp_close_connection(client_state_t * daemon_client){
559 btstack_linked_list_t * list = &daemon_client->sdp_record_handles;
560 btstack_linked_list_iterator_t it;

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

980 if (status){
981 send_l2cap_connection_open_failed(connection, addr, psm, status);
982 } else {
983 daemon_add_client_l2cap_channel(connection, cid);
984 }
985 break;
986 case L2CAP_DISCONNECT:
987 cid = little_endian_read_16(packet, 3);
988 reason = packet[5];
989 l2cap_disconnect(cid, reason);
988 l2cap_disconnect(cid);
990 break;
991 case L2CAP_REGISTER_SERVICE:
992 psm = little_endian_read_16(packet, 3);
993 mtu = little_endian_read_16(packet, 5);
994 status = l2cap_register_service(NULL, psm, mtu, LEVEL_0);
995 daemon_add_client_l2cap_service(connection, little_endian_read_16(packet, 3));
996 l2cap_emit_service_registered(connection, status, psm);
997 break;

--- 1162 unchanged lines hidden ---
989 break;
990 case L2CAP_REGISTER_SERVICE:
991 psm = little_endian_read_16(packet, 3);
992 mtu = little_endian_read_16(packet, 5);
993 status = l2cap_register_service(NULL, psm, mtu, LEVEL_0);
994 daemon_add_client_l2cap_service(connection, little_endian_read_16(packet, 3));
995 l2cap_emit_service_registered(connection, status, psm);
996 break;

--- 1162 unchanged lines hidden ---