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

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

Issue 1728163006: Implement BluetoothRemoteGattCharacteristicWin::GetDescriptors (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments Created 4 years, 9 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 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_remote_gatt_descriptor_win.h"
6
7 #include "base/bind.h"
8 #include "device/bluetooth/bluetooth_adapter_win.h"
9 #include "device/bluetooth/bluetooth_remote_gatt_characteristic_win.h"
10 #include "device/bluetooth/bluetooth_remote_gatt_service_win.h"
11
12 namespace device {
13
14 BluetoothRemoteGattDescriptorWin::BluetoothRemoteGattDescriptorWin(
15 BluetoothRemoteGattCharacteristicWin* parent_characteristic,
16 BTH_LE_GATT_DESCRIPTOR* descriptor_info,
17 scoped_refptr<base::SequencedTaskRunner>& ui_task_runner)
18 : parent_characteristic_(parent_characteristic),
19 descriptor_info_(descriptor_info),
20 ui_task_runner_(ui_task_runner),
21 weak_ptr_factory_(this) {
22 DCHECK(ui_task_runner_->RunsTasksOnCurrentThread());
23 DCHECK(parent_characteristic_);
24 DCHECK(descriptor_info_.get());
25
26 task_manager_ = parent_characteristic_->GetWinService()
27 ->GetWinAdapter()
28 ->GetWinBluetoothTaskManager();
29 DCHECK(task_manager_);
30 service_path_ = parent_characteristic_->GetWinService()->GetServicePath();
31 DCHECK(!service_path_.empty());
32 descriptor_uuid_ =
33 BluetoothTaskManagerWin::BluetoothLowEnergyUuidToBluetoothUuid(
34 descriptor_info_.get()->DescriptorUuid);
35 DCHECK(descriptor_uuid_.IsValid());
36 descriptor_identifier_ = parent_characteristic_->GetIdentifier() + "_" +
37 std::to_string(descriptor_info_->AttributeHandle);
38 }
39
40 BluetoothRemoteGattDescriptorWin::~BluetoothRemoteGattDescriptorWin() {
41 DCHECK(ui_task_runner_->RunsTasksOnCurrentThread());
42
43 parent_characteristic_->GetWinService()
44 ->GetWinAdapter()
45 ->NotifyGattDescriptorRemoved(this);
46 }
47
48 std::string BluetoothRemoteGattDescriptorWin::GetIdentifier() const {
49 return descriptor_identifier_;
50 }
51
52 BluetoothUUID BluetoothRemoteGattDescriptorWin::GetUUID() const {
53 return descriptor_uuid_;
54 }
55
56 bool BluetoothRemoteGattDescriptorWin::IsLocal() const {
57 return false;
58 }
59
60 std::vector<uint8_t>& BluetoothRemoteGattDescriptorWin::GetValue() const {
61 NOTIMPLEMENTED();
62 return const_cast<std::vector<uint8_t>&>(descriptor_value_);
63 }
64
65 BluetoothGattCharacteristic*
66 BluetoothRemoteGattDescriptorWin::GetCharacteristic() const {
67 return parent_characteristic_;
68 }
69
70 BluetoothGattCharacteristic::Permissions
71 BluetoothRemoteGattDescriptorWin::GetPermissions() const {
72 NOTIMPLEMENTED();
73 return descriptor_permissions_;
74 }
75
76 void BluetoothRemoteGattDescriptorWin::ReadRemoteDescriptor(
77 const ValueCallback& callback,
78 const ErrorCallback& error_callback) {
79 DCHECK(ui_task_runner_->RunsTasksOnCurrentThread());
80
81 NOTIMPLEMENTED();
82 error_callback.Run(BluetoothGattService::GATT_ERROR_NOT_SUPPORTED);
83 }
84
85 void BluetoothRemoteGattDescriptorWin::WriteRemoteDescriptor(
86 const std::vector<uint8_t>& new_value,
87 const base::Closure& callback,
88 const ErrorCallback& error_callback) {
89 DCHECK(ui_task_runner_->RunsTasksOnCurrentThread());
90
91 NOTIMPLEMENTED();
92 error_callback.Run(BluetoothGattService::GATT_ERROR_NOT_SUPPORTED);
93 }
94
95 uint16_t BluetoothRemoteGattDescriptorWin::GetAttributeHandle() const {
96 return descriptor_info_->AttributeHandle;
97 }
98
99 } // namespace device.
OLDNEW
« no previous file with comments | « device/bluetooth/bluetooth_remote_gatt_descriptor_win.h ('k') | device/bluetooth/bluetooth_remote_gatt_service_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698