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_remote_gatt_service_win.h" |
| 6 |
| 7 namespace device { |
| 8 BluetoothRemoteGattServiceWin::BluetoothRemoteGattServiceWin( |
| 9 BluetoothDeviceWin* device, |
| 10 base::FilePath service_path, |
| 11 BluetoothUUID service_uuid, |
| 12 uint16_t service_attribute_handle, |
| 13 bool is_primary, |
| 14 BluetoothRemoteGattServiceWin* parent_service, |
| 15 scoped_refptr<base::SequencedTaskRunner>& ui_task_runner) |
| 16 : service_path_(service_path), |
| 17 device_(device), |
| 18 service_uuid_(service_uuid), |
| 19 service_attribute_handle_(service_attribute_handle), |
| 20 is_primary_(is_primary), |
| 21 parent_service_(parent_service), |
| 22 ui_task_runner_(ui_task_runner) { |
| 23 DCHECK(ui_task_runner_->RunsTasksOnCurrentThread()); |
| 24 DCHECK(!service_path_.empty()); |
| 25 DCHECK(service_uuid_.IsValid()); |
| 26 DCHECK(service_attribute_handle_); |
| 27 DCHECK(device_); |
| 28 if (!is_primary_) |
| 29 DCHECK(parent_service_); |
| 30 Update(); |
| 31 } |
| 32 |
| 33 BluetoothRemoteGattServiceWin::~BluetoothRemoteGattServiceWin() {} |
| 34 |
| 35 std::string BluetoothRemoteGattServiceWin::GetIdentifier() const { |
| 36 std::string identifier = |
| 37 service_uuid_.value() + "_" + std::to_string(service_attribute_handle_); |
| 38 if (is_primary_) |
| 39 return device_->GetIdentifier() + "/" + identifier; |
| 40 else |
| 41 return parent_service_->GetIdentifier() + "/" + identifier; |
| 42 } |
| 43 |
| 44 BluetoothUUID BluetoothRemoteGattServiceWin::GetUUID() const { |
| 45 return const_cast<BluetoothUUID&>(service_uuid_); |
| 46 } |
| 47 |
| 48 bool BluetoothRemoteGattServiceWin::IsLocal() const { |
| 49 return false; |
| 50 } |
| 51 |
| 52 bool BluetoothRemoteGattServiceWin::IsPrimary() const { |
| 53 return is_primary_; |
| 54 } |
| 55 |
| 56 BluetoothDevice* BluetoothRemoteGattServiceWin::GetDevice() const { |
| 57 return device_; |
| 58 } |
| 59 |
| 60 std::vector<BluetoothGattCharacteristic*> |
| 61 BluetoothRemoteGattServiceWin::GetCharacteristics() const { |
| 62 NOTIMPLEMENTED(); |
| 63 return std::vector<BluetoothGattCharacteristic*>(); |
| 64 } |
| 65 |
| 66 std::vector<BluetoothGattService*> |
| 67 BluetoothRemoteGattServiceWin::GetIncludedServices() const { |
| 68 NOTIMPLEMENTED(); |
| 69 return std::vector<BluetoothGattService*>(); |
| 70 } |
| 71 |
| 72 BluetoothGattCharacteristic* BluetoothRemoteGattServiceWin::GetCharacteristic( |
| 73 const std::string& identifier) const { |
| 74 NOTIMPLEMENTED(); |
| 75 return nullptr; |
| 76 } |
| 77 |
| 78 bool BluetoothRemoteGattServiceWin::AddCharacteristic( |
| 79 device::BluetoothGattCharacteristic* characteristic) { |
| 80 NOTIMPLEMENTED(); |
| 81 return false; |
| 82 } |
| 83 |
| 84 bool BluetoothRemoteGattServiceWin::AddIncludedService( |
| 85 device::BluetoothGattService* service) { |
| 86 NOTIMPLEMENTED(); |
| 87 return false; |
| 88 } |
| 89 |
| 90 void BluetoothRemoteGattServiceWin::Register( |
| 91 const base::Closure& callback, |
| 92 const ErrorCallback& error_callback) { |
| 93 NOTIMPLEMENTED(); |
| 94 error_callback.Run(); |
| 95 } |
| 96 |
| 97 void BluetoothRemoteGattServiceWin::Unregister( |
| 98 const base::Closure& callback, |
| 99 const ErrorCallback& error_callback) { |
| 100 NOTIMPLEMENTED(); |
| 101 error_callback.Run(); |
| 102 } |
| 103 |
| 104 void BluetoothRemoteGattServiceWin::Update() { |
| 105 DCHECK(ui_task_runner_->RunsTasksOnCurrentThread()); |
| 106 NOTIMPLEMENTED(); |
| 107 } |
| 108 |
| 109 uint16_t BluetoothRemoteGattServiceWin::GetAttributeHandle() { |
| 110 return service_attribute_handle_; |
| 111 } |
| 112 |
| 113 } // namespace device. |
OLD | NEW |