Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
|
ortuno
2016/04/14 17:42:35
It's 2016!
rkc
2016/04/14 19:27:27
It sure is.
| |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_GATT_SERVICE_BLUEZ_H_ | |
| 6 #define DEVICE_BLUETOOTH_BLUETOOTH_GATT_SERVICE_BLUEZ_H_ | |
| 7 | |
| 8 #include <stdint.h> | |
|
ortuno
2016/04/14 17:42:35
Not necessary.
rkc
2016/04/14 19:27:27
Done.
| |
| 9 | |
| 10 #include <map> | |
| 11 #include <string> | |
| 12 #include <vector> | |
| 13 | |
| 14 #include "base/macros.h" | |
| 15 #include "dbus/object_path.h" | |
| 16 #include "device/bluetooth/bluetooth_gatt_service.h" | |
| 17 | |
| 18 namespace device { | |
| 19 | |
| 20 class BluetoothGattCharacteristic; | |
| 21 | |
| 22 } // namespace device | |
| 23 | |
| 24 namespace bluez { | |
| 25 | |
| 26 class BluetoothAdapterBlueZ; | |
| 27 class BluetoothDeviceBlueZ; | |
| 28 class BluetoothGattCharacteristicBlueZ; | |
| 29 | |
| 30 // The BluetoothGattServiceBlueZ class implements BluetootGattService | |
| 31 // for GATT services on platforms that use BlueZ. | |
|
ortuno
2016/04/14 17:42:35
Please mention that this class implements methods
rkc
2016/04/14 19:27:27
Please see my comment elsewhere regarding this.
| |
| 32 class BluetoothGattServiceBlueZ : public device::BluetoothGattService { | |
| 33 public: | |
| 34 // device::BluetoothGattService overrides. | |
| 35 std::string GetIdentifier() const override; | |
| 36 std::vector<device::BluetoothGattCharacteristic*> GetCharacteristics() | |
| 37 const override; | |
| 38 std::vector<device::BluetoothGattService*> GetIncludedServices() | |
| 39 const override; | |
| 40 device::BluetoothGattCharacteristic* GetCharacteristic( | |
| 41 const std::string& identifier) const override; | |
| 42 | |
| 43 // Object path of the underlying service. | |
| 44 const dbus::ObjectPath& object_path() const { return object_path_; } | |
|
ortuno
2016/04/14 17:42:35
hmm there are a lot of variables called "object_pa
rkc
2016/04/14 19:27:27
Please see my other comments about this being a re
| |
| 45 | |
| 46 // Parses a named D-Bus error into a service error code. | |
| 47 static device::BluetoothGattService::GattErrorCode DBusErrorToServiceError( | |
| 48 const std::string error_name); | |
| 49 | |
| 50 // Returns the adapter associated with this service. | |
| 51 BluetoothAdapterBlueZ* GetAdapter() const; | |
| 52 | |
| 53 protected: | |
| 54 BluetoothGattServiceBlueZ(BluetoothAdapterBlueZ* adapter, | |
| 55 const dbus::ObjectPath& object_path); | |
| 56 ~BluetoothGattServiceBlueZ() override; | |
| 57 | |
| 58 using CharacteristicMap = | |
| 59 std::map<dbus::ObjectPath, BluetoothGattCharacteristicBlueZ*>; | |
|
ortuno
2016/04/14 17:42:35
optional: Consider using unique_ptrs. If not then
rkc
2016/04/14 19:27:27
Please see my other comments about this being a re
ortuno
2016/04/14 21:17:38
I still think you need to document that classes th
rkc
2016/04/14 21:59:38
Done.
| |
| 60 | |
| 61 // Mapping from GATT characteristic object paths to characteristic objects. | |
| 62 // owned by this service. Since the BlueZ implementation uses object | |
| 63 // paths as unique identifiers, we also use this mapping to return | |
| 64 // characteristics by identifier. | |
| 65 CharacteristicMap characteristics_; | |
| 66 | |
| 67 private: | |
| 68 friend class BluetoothDeviceBlueZ; | |
| 69 | |
| 70 // The adapter associated with this service. It's ok to store a raw pointer | |
| 71 // here since |adapter_| indirectly owns this instance. | |
| 72 BluetoothAdapterBlueZ* adapter_; | |
| 73 | |
| 74 // Object path of the GATT service. | |
| 75 dbus::ObjectPath object_path_; | |
| 76 | |
| 77 DISALLOW_COPY_AND_ASSIGN(BluetoothGattServiceBlueZ); | |
| 78 }; | |
| 79 | |
| 80 } // namespace bluez | |
| 81 | |
| 82 #endif // DEVICE_BLUETOOTH_BLUETOOTH_GATT_SERVICE_BLUEZ_H_ | |
| OLD | NEW |