Roll forward to cl/314549634

Change-Id: I4d1e7eacd5fa4078a094571ad6d5f51e422535ff
This commit is contained in:
Himanshu Jaju
2020-06-03 11:18:32 -07:00
committed by Alexey Polyudov
parent ae1c427b99
commit cffbc04508
92 changed files with 3804 additions and 697 deletions
+3 -8
View File
@@ -24,7 +24,7 @@ class BluetoothDevice : public api::BluetoothDevice {
// https://developer.android.com/reference/android/bluetooth/BluetoothDevice.html#getName()
std::string GetName() const override;
BluetoothAdapter& GetAdapter();
BluetoothAdapter& GetAdapter() { return adapter_; }
private:
// Only BluetoothAdapter may instantiate BluetoothDevice.
@@ -41,8 +41,8 @@ class BluetoothAdapter : public api::BluetoothAdapter {
using Status = api::BluetoothAdapter::Status;
using ScanMode = api::BluetoothAdapter::ScanMode;
BluetoothAdapter() = default;
~BluetoothAdapter() override = default;
explicit BluetoothAdapter() = default;
~BluetoothAdapter() override;
// Synchronously sets the status of the BluetoothAdapter to 'status', and
// returns true if the operation was a success.
@@ -71,16 +71,11 @@ class BluetoothAdapter : public api::BluetoothAdapter {
BluetoothDevice& GetDevice() { return device_; }
private:
void RunOnCallbackThread(std::function<void()> runnable) {
serial_executor_.Execute(std::move(runnable));
}
mutable absl::Mutex mutex_;
BluetoothDevice device_{this};
ScanMode mode_ ABSL_GUARDED_BY(mutex_) = ScanMode::kNone;
std::string name_ ABSL_GUARDED_BY(mutex_) = "unknown G3 BT device";
bool enabled_ ABSL_GUARDED_BY(mutex_) = false;
SingleThreadExecutor serial_executor_;
};
} // namespace g3