att_server.c (fa5e3464655894dcb2606444fca382b824e7ac69) | att_server.c (bce48a26559b983f222efb64ec1cede436ab446e) |
---|---|
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 --- 151 unchanged lines hidden (view full) --- 160 (*att_client_packet_handler)(HCI_EVENT_PACKET, 0, &event[0], sizeof(event)); 161} 162 163static void att_handle_value_indication_timeout(btstack_timer_source_t *ts){ 164 void * context = btstack_run_loop_get_timer_context(ts); 165 hci_con_handle_t con_handle = (hci_con_handle_t) (uintptr_t) context; 166 att_server_t * att_server = att_server_for_handle(con_handle); 167 if (!att_server) return; | 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 --- 151 unchanged lines hidden (view full) --- 160 (*att_client_packet_handler)(HCI_EVENT_PACKET, 0, &event[0], sizeof(event)); 161} 162 163static void att_handle_value_indication_timeout(btstack_timer_source_t *ts){ 164 void * context = btstack_run_loop_get_timer_context(ts); 165 hci_con_handle_t con_handle = (hci_con_handle_t) (uintptr_t) context; 166 att_server_t * att_server = att_server_for_handle(con_handle); 167 if (!att_server) return; |
168 // @note: after a transcation timeout, no more requests shall be sent over this ATT Bearer 169 // (that's why we don't reset the value_indication_handle) |
|
168 uint16_t att_handle = att_server->value_indication_handle; 169 att_handle_value_indication_notify_client(ATT_HANDLE_VALUE_INDICATION_TIMEOUT, att_server->connection.con_handle, att_handle); 170} 171 172static void att_event_packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){ 173 174 UNUSED(channel); // ok: there is no channel 175 UNUSED(size); // ok: handling own l2cap events --- 55 unchanged lines hidden (view full) --- 231 232 case HCI_EVENT_DISCONNECTION_COMPLETE: 233 // check handle 234 con_handle = hci_event_disconnection_complete_get_connection_handle(packet); 235 att_server = att_server_for_handle(con_handle); 236 if (!att_server) break; 237 att_clear_transaction_queue(&att_server->connection); 238 att_server->connection.con_handle = 0; | 170 uint16_t att_handle = att_server->value_indication_handle; 171 att_handle_value_indication_notify_client(ATT_HANDLE_VALUE_INDICATION_TIMEOUT, att_server->connection.con_handle, att_handle); 172} 173 174static void att_event_packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){ 175 176 UNUSED(channel); // ok: there is no channel 177 UNUSED(size); // ok: handling own l2cap events --- 55 unchanged lines hidden (view full) --- 233 234 case HCI_EVENT_DISCONNECTION_COMPLETE: 235 // check handle 236 con_handle = hci_event_disconnection_complete_get_connection_handle(packet); 237 att_server = att_server_for_handle(con_handle); 238 if (!att_server) break; 239 att_clear_transaction_queue(&att_server->connection); 240 att_server->connection.con_handle = 0; |
239 att_server->value_indication_handle = 0; // reset error state | |
240 att_server->pairing_active = 0; 241 att_server->state = ATT_SERVER_IDLE; | 241 att_server->pairing_active = 0; 242 att_server->state = ATT_SERVER_IDLE; |
243 if (att_server->value_indication_handle){ 244 uint16_t att_handle = att_server->value_indication_handle; 245 att_server->value_indication_handle = 0; // reset error state 246 att_handle_value_indication_notify_client(ATT_HANDLE_VALUE_INDICATION_DISCONNECT, att_server->connection.con_handle, att_handle); 247 } |
|
242 break; 243 244 // Identity Resolving 245 case SM_EVENT_IDENTITY_RESOLVING_STARTED: 246 con_handle = sm_event_identity_resolving_started_get_handle(packet); 247 att_server = att_server_for_handle(con_handle); 248 if (!att_server) break; 249 log_info("SM_EVENT_IDENTITY_RESOLVING_STARTED"); --- 732 unchanged lines hidden --- | 248 break; 249 250 // Identity Resolving 251 case SM_EVENT_IDENTITY_RESOLVING_STARTED: 252 con_handle = sm_event_identity_resolving_started_get_handle(packet); 253 att_server = att_server_for_handle(con_handle); 254 if (!att_server) break; 255 log_info("SM_EVENT_IDENTITY_RESOLVING_STARTED"); --- 732 unchanged lines hidden --- |