| 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 "device/bluetooth/dbus/bluetooth_gatt_characteristic_client.h" | 5 #include "device/bluetooth/dbus/bluetooth_gatt_characteristic_client.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
| 12 #include "base/observer_list.h" | 12 #include "base/observer_list.h" |
| 13 #include "dbus/bus.h" | 13 #include "dbus/bus.h" |
| 14 #include "dbus/object_manager.h" | 14 #include "dbus/object_manager.h" |
| 15 #include "third_party/cros_system_api/dbus/service_constants.h" | 15 #include "third_party/cros_system_api/dbus/service_constants.h" |
| 16 | 16 |
| 17 namespace bluez { | 17 namespace bluez { |
| 18 | 18 |
| 19 namespace { | |
| 20 | |
| 21 // TODO(armansito): Move this constant to cros_system_api. | |
| 22 const char kValueProperty[] = "Value"; | |
| 23 | |
| 24 } // namespace | |
| 25 | |
| 26 // static | 19 // static |
| 27 const char BluetoothGattCharacteristicClient::kNoResponseError[] = | 20 const char BluetoothGattCharacteristicClient::kNoResponseError[] = |
| 28 "org.chromium.Error.NoResponse"; | 21 "org.chromium.Error.NoResponse"; |
| 29 // static | 22 // static |
| 30 const char BluetoothGattCharacteristicClient::kUnknownCharacteristicError[] = | 23 const char BluetoothGattCharacteristicClient::kUnknownCharacteristicError[] = |
| 31 "org.chromium.Error.UnknownCharacteristic"; | 24 "org.chromium.Error.UnknownCharacteristic"; |
| 32 | 25 |
| 33 BluetoothGattCharacteristicClient::Properties::Properties( | 26 BluetoothGattCharacteristicClient::Properties::Properties( |
| 34 dbus::ObjectProxy* object_proxy, | 27 dbus::ObjectProxy* object_proxy, |
| 35 const std::string& interface_name, | 28 const std::string& interface_name, |
| 36 const PropertyChangedCallback& callback) | 29 const PropertyChangedCallback& callback) |
| 37 : dbus::PropertySet(object_proxy, interface_name, callback) { | 30 : dbus::PropertySet(object_proxy, interface_name, callback) { |
| 38 RegisterProperty(bluetooth_gatt_characteristic::kUUIDProperty, &uuid); | 31 RegisterProperty(bluetooth_gatt_characteristic::kUUIDProperty, &uuid); |
| 39 RegisterProperty(bluetooth_gatt_characteristic::kServiceProperty, &service); | 32 RegisterProperty(bluetooth_gatt_characteristic::kServiceProperty, &service); |
| 40 RegisterProperty(kValueProperty, &value); | 33 RegisterProperty(bluetooth_gatt_characteristic::kValueProperty, &value); |
| 41 RegisterProperty(bluetooth_gatt_characteristic::kNotifyingProperty, | 34 RegisterProperty(bluetooth_gatt_characteristic::kNotifyingProperty, |
| 42 ¬ifying); | 35 ¬ifying); |
| 43 RegisterProperty(bluetooth_gatt_characteristic::kFlagsProperty, &flags); | 36 RegisterProperty(bluetooth_gatt_characteristic::kFlagsProperty, &flags); |
| 44 RegisterProperty(bluetooth_gatt_characteristic::kDescriptorsProperty, | |
| 45 &descriptors); | |
| 46 } | 37 } |
| 47 | 38 |
| 48 BluetoothGattCharacteristicClient::Properties::~Properties() {} | 39 BluetoothGattCharacteristicClient::Properties::~Properties() {} |
| 49 | 40 |
| 50 // The BluetoothGattCharacteristicClient implementation used in production. | 41 // The BluetoothGattCharacteristicClient implementation used in production. |
| 51 class BluetoothGattCharacteristicClientImpl | 42 class BluetoothGattCharacteristicClientImpl |
| 52 : public BluetoothGattCharacteristicClient, | 43 : public BluetoothGattCharacteristicClient, |
| 53 public dbus::ObjectManager::Interface { | 44 public dbus::ObjectManager::Interface { |
| 54 public: | 45 public: |
| 55 BluetoothGattCharacteristicClientImpl() | 46 BluetoothGattCharacteristicClientImpl() |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 BluetoothGattCharacteristicClient::BluetoothGattCharacteristicClient() {} | 288 BluetoothGattCharacteristicClient::BluetoothGattCharacteristicClient() {} |
| 298 | 289 |
| 299 BluetoothGattCharacteristicClient::~BluetoothGattCharacteristicClient() {} | 290 BluetoothGattCharacteristicClient::~BluetoothGattCharacteristicClient() {} |
| 300 | 291 |
| 301 // static | 292 // static |
| 302 BluetoothGattCharacteristicClient* BluetoothGattCharacteristicClient::Create() { | 293 BluetoothGattCharacteristicClient* BluetoothGattCharacteristicClient::Create() { |
| 303 return new BluetoothGattCharacteristicClientImpl(); | 294 return new BluetoothGattCharacteristicClientImpl(); |
| 304 } | 295 } |
| 305 | 296 |
| 306 } // namespace bluez | 297 } // namespace bluez |
| OLD | NEW |