att_dispatch.c (2aed7bd41498d3f8075ac599d3ccdefe1a4ff4c1) att_dispatch.c (6737be29e20a85932375e6f1b7d9d8d605dba991)
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

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

149 index = for_server ? ATT_SERVER : ATT_CLIENT;
150 if (!subscriptions[index].packet_handler) return;
151 subscriptions[index].packet_handler(packet_type, channel, packet, size);
152}
153
154static void att_packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){
155#ifdef ENABLE_GATT_OVER_CLASSIC
156 hci_connection_t * hci_connection;
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

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

149 index = for_server ? ATT_SERVER : ATT_CLIENT;
150 if (!subscriptions[index].packet_handler) return;
151 subscriptions[index].packet_handler(packet_type, channel, packet, size);
152}
153
154static void att_packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){
155#ifdef ENABLE_GATT_OVER_CLASSIC
156 hci_connection_t * hci_connection;
157 att_server_t * att_server;
157 hci_con_handle_t con_handle;
158 bool outgoing_active;
159 uint8_t index;
160#endif
161#if defined(ENABLE_GATT_OVER_CLASSIC) || defined(ENABLE_GATT_OVER_EATT)
162 bd_addr_t address;
163 uint16_t l2cap_cid;
164 uint8_t status;

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

211 // dispatch to all roles
212 for (index = 0; index < ATT_MAX; index++){
213 if (subscriptions[index].packet_handler != NULL){
214 subscriptions[index].packet_handler(packet_type, channel, packet, size);
215 }
216 }
217 break;
218 case L2CAP_EVENT_CHANNEL_CLOSED:
158 hci_con_handle_t con_handle;
159 bool outgoing_active;
160 uint8_t index;
161#endif
162#if defined(ENABLE_GATT_OVER_CLASSIC) || defined(ENABLE_GATT_OVER_EATT)
163 bd_addr_t address;
164 uint16_t l2cap_cid;
165 uint8_t status;

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

212 // dispatch to all roles
213 for (index = 0; index < ATT_MAX; index++){
214 if (subscriptions[index].packet_handler != NULL){
215 subscriptions[index].packet_handler(packet_type, channel, packet, size);
216 }
217 }
218 break;
219 case L2CAP_EVENT_CHANNEL_CLOSED:
219 // clear l2cap cid in hci_connection->att_server
220 con_handle = l2cap_event_incoming_connection_get_handle(packet);
221 hci_connection = hci_connection_for_handle(con_handle);
222 hci_connection->att_server.l2cap_cid = 0;
220 // clear l2cap_cid in att_server
221 l2cap_cid = l2cap_event_incoming_connection_get_handle(packet);
222 att_server = att_dispatch_att_server_for_l2cap_cid(l2cap_cid);
223 att_server->l2cap_cid = 0;
223 // dispatch to all roles
224 for (index = 0; index < ATT_MAX; index++){
225 if (subscriptions[index].packet_handler != NULL){
226 subscriptions[index].packet_handler(packet_type, channel, packet, size);
227 }
228 }
229 break;
230#endif

--- 119 unchanged lines hidden ---
224 // dispatch to all roles
225 for (index = 0; index < ATT_MAX; index++){
226 if (subscriptions[index].packet_handler != NULL){
227 subscriptions[index].packet_handler(packet_type, channel, packet, size);
228 }
229 }
230 break;
231#endif

--- 119 unchanged lines hidden ---