| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chromeos/dbus/bluetooth_gatt_service_client.h" | 5 #include "chromeos/dbus/bluetooth_gatt_service_client.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
| 9 #include "base/observer_list.h" | 9 #include "base/observer_list.h" |
| 10 #include "dbus/bus.h" | 10 #include "dbus/bus.h" |
| 11 #include "dbus/object_manager.h" | 11 #include "dbus/object_manager.h" |
| 12 #include "third_party/cros_system_api/dbus/service_constants.h" | 12 #include "third_party/cros_system_api/dbus/service_constants.h" |
| 13 | 13 |
| 14 namespace chromeos { | 14 namespace chromeos { |
| 15 | 15 |
| 16 namespace { | |
| 17 | |
| 18 // TODO(armansito): Add these to service_constants.h when they are defined | |
| 19 // in the BlueZ doc. | |
| 20 const char kDeviceProperty[] = "Device"; | |
| 21 const char kPrimaryProperty[] = "Primary"; | |
| 22 | |
| 23 } // namespace | |
| 24 | |
| 25 BluetoothGattServiceClient::Properties::Properties( | 16 BluetoothGattServiceClient::Properties::Properties( |
| 26 dbus::ObjectProxy* object_proxy, | 17 dbus::ObjectProxy* object_proxy, |
| 27 const std::string& interface_name, | 18 const std::string& interface_name, |
| 28 const PropertyChangedCallback&callback) | 19 const PropertyChangedCallback&callback) |
| 29 : dbus::PropertySet(object_proxy, interface_name, callback) { | 20 : dbus::PropertySet(object_proxy, interface_name, callback) { |
| 30 RegisterProperty(bluetooth_gatt_service::kUUIDProperty, &uuid); | 21 RegisterProperty(bluetooth_gatt_service::kUUIDProperty, &uuid); |
| 31 RegisterProperty(bluetooth_gatt_service::kIncludesProperty, &includes); | 22 RegisterProperty(bluetooth_gatt_service::kIncludesProperty, &includes); |
| 32 RegisterProperty(kDeviceProperty, &device); | 23 RegisterProperty(bluetooth_gatt_service::kDeviceProperty, &device); |
| 33 RegisterProperty(kPrimaryProperty, &primary); | 24 RegisterProperty(bluetooth_gatt_service::kPrimaryProperty, &primary); |
| 34 } | 25 } |
| 35 | 26 |
| 36 BluetoothGattServiceClient::Properties::~Properties() { | 27 BluetoothGattServiceClient::Properties::~Properties() { |
| 37 } | 28 } |
| 38 | 29 |
| 39 // The BluetoothGattServiceClient implementation used in production. | 30 // The BluetoothGattServiceClient implementation used in production. |
| 40 class BluetoothGattServiceClientImpl : public BluetoothGattServiceClient, | 31 class BluetoothGattServiceClientImpl : public BluetoothGattServiceClient, |
| 41 public dbus::ObjectManager::Interface { | 32 public dbus::ObjectManager::Interface { |
| 42 public: | 33 public: |
| 43 BluetoothGattServiceClientImpl() | 34 BluetoothGattServiceClientImpl() |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 | 144 |
| 154 BluetoothGattServiceClient::~BluetoothGattServiceClient() { | 145 BluetoothGattServiceClient::~BluetoothGattServiceClient() { |
| 155 } | 146 } |
| 156 | 147 |
| 157 // static | 148 // static |
| 158 BluetoothGattServiceClient* BluetoothGattServiceClient::Create() { | 149 BluetoothGattServiceClient* BluetoothGattServiceClient::Create() { |
| 159 return new BluetoothGattServiceClientImpl(); | 150 return new BluetoothGattServiceClientImpl(); |
| 160 } | 151 } |
| 161 | 152 |
| 162 } // namespace chromeos | 153 } // namespace chromeos |
| OLD | NEW |