hci.c (67f708e073a3b5c01fde35c3f01722ed61d4b6a3) hci.c (461a2bc4b085abdabe6c7af40c278636bcefb607)
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

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

2077static void hci_handle_remote_features_page_2(hci_connection_t * conn, const uint8_t * features){
2078 // SC Controller
2079 if (features[1] & (1 << 0)){
2080 conn->bonding_flags |= BONDING_REMOTE_SUPPORTS_SC_CONTROLLER;
2081 }
2082}
2083
2084static void hci_handle_remote_features_received(hci_connection_t * conn){
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

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

2077static void hci_handle_remote_features_page_2(hci_connection_t * conn, const uint8_t * features){
2078 // SC Controller
2079 if (features[1] & (1 << 0)){
2080 conn->bonding_flags |= BONDING_REMOTE_SUPPORTS_SC_CONTROLLER;
2081 }
2082}
2083
2084static void hci_handle_remote_features_received(hci_connection_t * conn){
2085 conn->bonding_flags &= ~BONDING_REMOTE_FEATURES_QUERY_ACTIVE;
2085 conn->bonding_flags |= BONDING_RECEIVED_REMOTE_FEATURES;
2086 log_info("Remote features %02x, bonding flags %x", conn->remote_supported_features[0], conn->bonding_flags);
2087 if (conn->bonding_flags & BONDING_DEDICATED){
2088 conn->bonding_flags |= BONDING_SEND_AUTHENTICATE_REQUEST;
2089 }
2090}
2091static bool hci_remote_sc_enabled(hci_connection_t * connection){
2092 const uint16_t sc_enabled_mask = BONDING_REMOTE_SUPPORTS_SC_HOST | BONDING_REMOTE_SUPPORTS_SC_CONTROLLER;

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

5606}
5607
5608/**
5609 * Trigger remote supported features query
5610 */
5611void hci_remote_features_query(hci_con_handle_t con_handle){
5612 hci_connection_t * connection = hci_connection_for_handle(con_handle);
5613 if (!connection) return;
2086 conn->bonding_flags |= BONDING_RECEIVED_REMOTE_FEATURES;
2087 log_info("Remote features %02x, bonding flags %x", conn->remote_supported_features[0], conn->bonding_flags);
2088 if (conn->bonding_flags & BONDING_DEDICATED){
2089 conn->bonding_flags |= BONDING_SEND_AUTHENTICATE_REQUEST;
2090 }
2091}
2092static bool hci_remote_sc_enabled(hci_connection_t * connection){
2093 const uint16_t sc_enabled_mask = BONDING_REMOTE_SUPPORTS_SC_HOST | BONDING_REMOTE_SUPPORTS_SC_CONTROLLER;

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

5607}
5608
5609/**
5610 * Trigger remote supported features query
5611 */
5612void hci_remote_features_query(hci_con_handle_t con_handle){
5613 hci_connection_t * connection = hci_connection_for_handle(con_handle);
5614 if (!connection) return;
5614 if ((connection->bonding_flags & BONDING_RECEIVED_REMOTE_FEATURES) != 0) return;
5615 connection->bonding_flags |= BONDING_REQUEST_REMOTE_FEATURES_PAGE_0;
5615 if ((connection->bonding_flags & (BONDING_REMOTE_FEATURES_QUERY_ACTIVE | BONDING_RECEIVED_REMOTE_FEATURES)) != 0) return;
5616 connection->bonding_flags |= BONDING_REMOTE_FEATURES_QUERY_ACTIVE | BONDING_REQUEST_REMOTE_FEATURES_PAGE_0;
5616 hci_run();
5617}
5618
5619// GAP API
5620/**
5621 * @bbrief enable/disable bonding. default is enabled
5622 * @praram enabled
5623 */

--- 1327 unchanged lines hidden ---
5617 hci_run();
5618}
5619
5620// GAP API
5621/**
5622 * @bbrief enable/disable bonding. default is enabled
5623 * @praram enabled
5624 */

--- 1327 unchanged lines hidden ---