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

Side by Side Diff: device/bluetooth/bluetooth_remote_gatt_characteristic_chromeos.h

Issue 228643004: device/bluetooth: Add chromeos::BluetoothRemoteGattCharacteristicChromeOS. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removed potentially flaky expectation from unit test. Created 6 years, 8 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 | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_CHARACTERISTIC_CHROMEOS_H_
6 #define DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_CHARACTERISTIC_CHROMEOS_H_
7
8 #include <string>
9 #include <vector>
10
11 #include "base/memory/weak_ptr.h"
12 #include "dbus/object_path.h"
13 #include "device/bluetooth/bluetooth_gatt_characteristic.h"
14 #include "device/bluetooth/bluetooth_uuid.h"
15
16 namespace device {
17
18 class BluetoothGattDescriptor;
19 class BluetoothGattService;
20
21 } // namespace device
22
23 namespace chromeos {
24
25 class BluetoothRemoteGattServiceChromeOS;
26
27 // The BluetoothRemoteGattCharacteristicChromeOS class implements
28 // BluetoothGattCharacteristic for remote GATT characteristics on the Chrome OS
29 // platform.
30 class BluetoothRemoteGattCharacteristicChromeOS
31 : public device::BluetoothGattCharacteristic {
32 public:
33 // device::BluetoothGattCharacteristic overrides.
34 virtual std::string GetIdentifier() const OVERRIDE;
35 virtual device::BluetoothUUID GetUUID() const OVERRIDE;
36 virtual bool IsLocal() const OVERRIDE;
37 virtual const std::vector<uint8>& GetValue() const OVERRIDE;
38 virtual device::BluetoothGattService* GetService() const OVERRIDE;
39 virtual Properties GetProperties() const OVERRIDE;
40 virtual Permissions GetPermissions() const OVERRIDE;
41 virtual std::vector<device::BluetoothGattDescriptor*>
42 GetDescriptors() const OVERRIDE;
43 virtual bool AddDescriptor(
44 device::BluetoothGattDescriptor* descriptor) OVERRIDE;
45 virtual bool UpdateValue(const std::vector<uint8>& value) OVERRIDE;
46 virtual void ReadRemoteCharacteristic(
47 const ValueCallback& callback,
48 const ErrorCallback& error_callback) OVERRIDE;
49 virtual void WriteRemoteCharacteristic(
50 const std::vector<uint8>& new_value,
51 const base::Closure& callback,
52 const ErrorCallback& error_callback) OVERRIDE;
53
54 // Object path of the underlying D-Bus characteristic.
55 const dbus::ObjectPath& object_path() const { return object_path_; }
56
57 private:
58 friend class BluetoothRemoteGattServiceChromeOS;
59
60 BluetoothRemoteGattCharacteristicChromeOS(
61 BluetoothRemoteGattServiceChromeOS* service,
62 const dbus::ObjectPath& object_path);
63 virtual ~BluetoothRemoteGattCharacteristicChromeOS();
64
65 // Called by dbus:: on completion of the request to get the characteristic
66 // value.
67 void OnGetValue(const ValueCallback& callback,
68 const ErrorCallback& error_callback,
69 bool success);
70
71 // Called by dbus:: on completion of the request to set the characteristic
72 // value.
73 void OnSetValue(const base::Closure& callback,
74 const ErrorCallback& error_callback,
75 bool success);
76
77 // Object path of the D-Bus characteristic object.
78 dbus::ObjectPath object_path_;
79
80 // The GATT service this GATT characteristic belongs to.
81 BluetoothRemoteGattServiceChromeOS* service_;
82
83 // Note: This should remain the last member so it'll be destroyed and
84 // invalidate its weak pointers before any other members are destroyed.
85 base::WeakPtrFactory<BluetoothRemoteGattCharacteristicChromeOS>
86 weak_ptr_factory_;
87
88 DISALLOW_COPY_AND_ASSIGN(BluetoothRemoteGattCharacteristicChromeOS);
89 };
90
91 } // namespace chromeos
92
93 #endif // DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_CHARACTERISTIC_CHROMEOS_H_
OLDNEW
« no previous file with comments | « device/bluetooth/bluetooth_gatt_service.h ('k') | device/bluetooth/bluetooth_remote_gatt_characteristic_chromeos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698