hci.c (fb8ba0dbcd59b0f55263e5be12c95aa6e35ceca0) | hci.c (df3354fc67b724e12e38312f95d99fe997e0d46e) |
---|---|
1/* 2 * Copyright (C) 2009-2012 by Matthias Ringwald 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 --- 1732 unchanged lines hidden (view full) --- 1741 event[0] = BTSTACK_EVENT_DISCOVERABLE_ENABLED; 1742 event[1] = sizeof(event) - 2; 1743 event[2] = enabled; 1744 hci_dump_packet( HCI_EVENT_PACKET, 0, event, sizeof(event)); 1745 hci_stack.packet_handler(HCI_EVENT_PACKET, event, sizeof(event)); 1746} 1747 1748void hci_emit_security_level(hci_con_handle_t con_handle, gap_security_level_t level){ | 1/* 2 * Copyright (C) 2009-2012 by Matthias Ringwald 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 --- 1732 unchanged lines hidden (view full) --- 1741 event[0] = BTSTACK_EVENT_DISCOVERABLE_ENABLED; 1742 event[1] = sizeof(event) - 2; 1743 event[2] = enabled; 1744 hci_dump_packet( HCI_EVENT_PACKET, 0, event, sizeof(event)); 1745 hci_stack.packet_handler(HCI_EVENT_PACKET, event, sizeof(event)); 1746} 1747 1748void hci_emit_security_level(hci_con_handle_t con_handle, gap_security_level_t level){ |
1749 log_info("hci_emit_security_level %u for handle %x", level, con_handle); |
|
1749 uint8_t event[5]; 1750 int pos = 0; 1751 event[pos++] = GAP_SECURITY_LEVEL; 1752 event[pos++] = sizeof(event) - 2; 1753 bt_store_16(event, 2, con_handle); 1754 pos += 2; 1755 event[pos++] = level; 1756 hci_dump_packet( HCI_EVENT_PACKET, 0, event, sizeof(event)); 1757 hci_stack.packet_handler(HCI_EVENT_PACKET, event, sizeof(event)); 1758} 1759 1760// query if remote side supports SSP 1761int hci_remote_ssp_supported(hci_con_handle_t con_handle){ 1762 hci_connection_t * connection = hci_connection_for_handle(con_handle); 1763 if (!connection) return 0; 1764 return (connection->bonding_flags & BONDING_REMOTE_SUPPORTS_SSP) ? 1 : 0; 1765} 1766 | 1750 uint8_t event[5]; 1751 int pos = 0; 1752 event[pos++] = GAP_SECURITY_LEVEL; 1753 event[pos++] = sizeof(event) - 2; 1754 bt_store_16(event, 2, con_handle); 1755 pos += 2; 1756 event[pos++] = level; 1757 hci_dump_packet( HCI_EVENT_PACKET, 0, event, sizeof(event)); 1758 hci_stack.packet_handler(HCI_EVENT_PACKET, event, sizeof(event)); 1759} 1760 1761// query if remote side supports SSP 1762int hci_remote_ssp_supported(hci_con_handle_t con_handle){ 1763 hci_connection_t * connection = hci_connection_for_handle(con_handle); 1764 if (!connection) return 0; 1765 return (connection->bonding_flags & BONDING_REMOTE_SUPPORTS_SSP) ? 1 : 0; 1766} 1767 |
1768int hci_ssp_supported_on_both_sides(hci_con_handle_t handle){ 1769 return hci_local_ssp_activated() && hci_remote_ssp_supported(handle); 1770} 1771 |
|
1767// GAP API 1768/** 1769 * @bbrief enable/disable bonding. default is enabled 1770 * @praram enabled 1771 */ 1772void gap_set_bondable_mode(int enable){ 1773 hci_stack.bondable = enable ? 1 : 0; 1774} --- 69 unchanged lines hidden --- | 1772// GAP API 1773/** 1774 * @bbrief enable/disable bonding. default is enabled 1775 * @praram enabled 1776 */ 1777void gap_set_bondable_mode(int enable){ 1778 hci_stack.bondable = enable ? 1 : 0; 1779} --- 69 unchanged lines hidden --- |