hci.c (1714cbbd1ffd22dedd24a9a4f4c8a59d6361cb70) | hci.c (77208d90205dc3c436e52c037cf12aa50863eaf0) |
---|---|
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 --- 392 unchanged lines hidden (view full) --- 401 hci_connection->authentication_flags |= SSP_PAIRING_ACTIVE; 402 } else { 403 hci_connection->authentication_flags |= LEGACY_PAIRING_ACTIVE; 404 } 405 // if we are initiator, we have sent an HCI Authenticate Request 406 bool initiator = (hci_connection->bonding_flags & BONDING_SENT_AUTHENTICATE_REQUEST) != 0; 407 408 log_info("pairing started, ssp %u, initiator %u", (int) ssp, (int) initiator); | 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 --- 392 unchanged lines hidden (view full) --- 401 hci_connection->authentication_flags |= SSP_PAIRING_ACTIVE; 402 } else { 403 hci_connection->authentication_flags |= LEGACY_PAIRING_ACTIVE; 404 } 405 // if we are initiator, we have sent an HCI Authenticate Request 406 bool initiator = (hci_connection->bonding_flags & BONDING_SENT_AUTHENTICATE_REQUEST) != 0; 407 408 log_info("pairing started, ssp %u, initiator %u", (int) ssp, (int) initiator); |
409 410 uint8_t event[12]; 411 event[0] = GAP_EVENT_PAIRING_STARTED; 412 event[1] = 10; 413 reverse_bd_addr(hci_connection->address, &event[2]); 414 little_endian_store_16(event, 8, (uint16_t) hci_connection->con_handle); 415 event[10] = (uint8_t) ssp; 416 event[11] = (uint8_t) initiator; 417 hci_emit_event(event, sizeof(event), 1); |
|
409} 410 411static void hci_pairing_complete(hci_connection_t * hci_connection, uint8_t status){ 412 if (!hci_pairing_active(hci_connection)) return; 413 hci_connection->authentication_flags &= ~PAIRING_ACTIVE_MASK; 414 log_info("pairing complete, status %02x", status); | 418} 419 420static void hci_pairing_complete(hci_connection_t * hci_connection, uint8_t status){ 421 if (!hci_pairing_active(hci_connection)) return; 422 hci_connection->authentication_flags &= ~PAIRING_ACTIVE_MASK; 423 log_info("pairing complete, status %02x", status); |
424 425 uint8_t event[12]; 426 event[0] = GAP_EVENT_PAIRING_COMPLETE; 427 event[1] = 9; 428 reverse_bd_addr(hci_connection->address, &event[2]); 429 little_endian_store_16(event, 8, (uint16_t) hci_connection->con_handle); 430 event[10] = status; 431 hci_emit_event(event, sizeof(event), 1); |
|
415} 416 417int hci_authentication_active_for_handle(hci_con_handle_t handle){ 418 hci_connection_t * conn = hci_connection_for_handle(handle); 419 if (!conn) return 0; 420 return (int) hci_pairing_active(conn); 421} 422 --- 6259 unchanged lines hidden --- | 432} 433 434int hci_authentication_active_for_handle(hci_con_handle_t handle){ 435 hci_connection_t * conn = hci_connection_for_handle(handle); 436 if (!conn) return 0; 437 return (int) hci_pairing_active(conn); 438} 439 --- 6259 unchanged lines hidden --- |