Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(443)

Side by Side Diff: device/bluetooth/bluetooth_gatt_notify_session_win.cc

Issue 1606013002: BLE GATT service implementation in Chrome for Windows 8 and later (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update Build.gn Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2015 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() != NULL && is_active_)
14 characteristic_.get()->StopNotifySession();
15 }
16
17 std::string BluetoothGattNotifySessionWin::GetCharacteristicIdentifier() const {
18 if (characteristic_.get() != NULL)
19 return characteristic_.get()->GetIdentifier();
20 return std::string();
21 }
22
23 bool BluetoothGattNotifySessionWin::IsActive() {
24 return is_active_ && characteristic_.get() != NULL;
25 }
26
27 void BluetoothGattNotifySessionWin::Stop(const base::Closure& callback) {
28 is_active_ = false;
29 if (characteristic_.get() != NULL)
30 return characteristic_.get()->StopNotifySession();
31 callback.Run();
32 }
33 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698