| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_DEVICE_CHOOSER_CONTROLLER_H_ | 5 #ifndef CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_DEVICE_CHOOSER_CONTROLLER_H_ |
| 6 #define CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_DEVICE_CHOOSER_CONTROLLER_H_ | 6 #define CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_DEVICE_CHOOSER_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <unordered_set> | 9 #include <unordered_set> |
| 10 | 10 |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 const ErrorCallback& error_callback); | 72 const ErrorCallback& error_callback); |
| 73 | 73 |
| 74 // Adds a device to the chooser. Should only be called after GetDevice and | 74 // Adds a device to the chooser. Should only be called after GetDevice and |
| 75 // before either of the callbacks are run. | 75 // before either of the callbacks are run. |
| 76 void AddFilteredDevice(const device::BluetoothDevice& device); | 76 void AddFilteredDevice(const device::BluetoothDevice& device); |
| 77 | 77 |
| 78 // Stops the current discovery session and notifies the chooser | 78 // Stops the current discovery session and notifies the chooser |
| 79 // that the adapter changed states. | 79 // that the adapter changed states. |
| 80 void AdapterPoweredChanged(bool powered); | 80 void AdapterPoweredChanged(bool powered); |
| 81 | 81 |
| 82 // Stops the discovery session and notifies the chooser |
| 83 // when discovery stops accidentally. |
| 84 void AdapterDiscoveringChanged(bool discovering); |
| 85 |
| 82 // Received Signal Strength Indicator (RSSI) is a measurement of the power | 86 // Received Signal Strength Indicator (RSSI) is a measurement of the power |
| 83 // present in a received radio signal. | 87 // present in a received radio signal. |
| 84 static int CalculateSignalStrengthLevel(int8_t rssi); | 88 static int CalculateSignalStrengthLevel(int8_t rssi); |
| 85 | 89 |
| 86 // After this method is called any new instance of | 90 // After this method is called any new instance of |
| 87 // BluetoothDeviceChooserController will have a scan duration of 0. | 91 // BluetoothDeviceChooserController will have a scan duration of 0. |
| 88 static void SetTestScanDurationForTesting(); | 92 static void SetTestScanDurationForTesting(); |
| 89 | 93 |
| 94 // DJKim |
| 95 bool IsDiscoverySessionActive(); |
| 96 |
| 90 private: | 97 private: |
| 91 // Populates the chooser with the GATT connected devices. | 98 // Populates the chooser with the GATT connected devices. |
| 92 void PopulateConnectedDevices(); | 99 void PopulateConnectedDevices(); |
| 93 | 100 |
| 94 // Notifies the chooser that discovery is starting and starts a discovery | 101 // Notifies the chooser that discovery is starting and starts a discovery |
| 95 // session. | 102 // session. |
| 96 void StartDeviceDiscovery(); | 103 void StartDeviceDiscovery(); |
| 97 | 104 |
| 98 // Stops the discovery session and notifies the chooser. | 105 // Stops the discovery session and notifies the chooser. |
| 99 void StopDeviceDiscovery(); | 106 void StopDeviceDiscovery(); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 // Weak pointer factory for generating 'this' pointers that might live longer | 163 // Weak pointer factory for generating 'this' pointers that might live longer |
| 157 // than we do. | 164 // than we do. |
| 158 // Note: This should remain the last member so it'll be destroyed and | 165 // Note: This should remain the last member so it'll be destroyed and |
| 159 // invalidate its weak pointers before any other members are destroyed. | 166 // invalidate its weak pointers before any other members are destroyed. |
| 160 base::WeakPtrFactory<BluetoothDeviceChooserController> weak_ptr_factory_; | 167 base::WeakPtrFactory<BluetoothDeviceChooserController> weak_ptr_factory_; |
| 161 }; | 168 }; |
| 162 | 169 |
| 163 } // namespace content | 170 } // namespace content |
| 164 | 171 |
| 165 #endif // CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_DEVICE_CHOOSER_CONTROLLER_H_ | 172 #endif // CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_DEVICE_CHOOSER_CONTROLLER_H_ |
| OLD | NEW |