Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "device/bluetooth/bluetooth_gatt_notify_session_win.h" | |
| 6 | |
| 7 namespace device { | |
| 8 BluetoothGattNotifySessionWin::BluetoothGattNotifySessionWin( | |
| 9 base::WeakPtr<BluetoothRemoteGattCharacteristicWin> characteristic) | |
| 10 : is_active_(true), characteristic_(characteristic) {} | |
| 11 | |
| 12 BluetoothGattNotifySessionWin::~BluetoothGattNotifySessionWin() { | |
| 13 if (characteristic_.get() != nullptr && is_active_) | |
| 14 characteristic_.get()->StopNotifySession(); | |
| 15 } | |
| 16 | |
| 17 std::string BluetoothGattNotifySessionWin::GetCharacteristicIdentifier() const { | |
| 18 if (characteristic_.get() != nullptr) | |
| 19 return characteristic_.get()->GetIdentifier(); | |
| 20 return std::string(); | |
| 21 } | |
| 22 | |
| 23 bool BluetoothGattNotifySessionWin::IsActive() { | |
| 24 return is_active_ && characteristic_.get() != nullptr; | |
| 25 } | |
| 26 | |
| 27 void BluetoothGattNotifySessionWin::Stop(const base::Closure& callback) { | |
| 28 is_active_ = false; | |
| 29 if (characteristic_.get() != nullptr) | |
| 30 return characteristic_.get()->StopNotifySession(); | |
|
ortuno
2016/03/07 18:48:44
Split this:
characteristic_.get()->StopNotifySess
gogerald1
2016/03/07 22:52:48
Done.
| |
| 31 callback.Run(); | |
|
ortuno
2016/03/07 18:48:44
Stop should be async. Post a task.
gogerald1
2016/03/07 22:52:48
Done.
| |
| 32 } | |
| 33 | |
| 34 } // namespace device | |
| OLD | NEW |