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 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_DESCRIPTOR_CHROMEOS_H_ | 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_DESCRIPTOR_CHROMEOS_H_ |
6 #define DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_DESCRIPTOR_CHROMEOS_H_ | 6 #define DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_DESCRIPTOR_CHROMEOS_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 const dbus::ObjectPath& object_path() const { return object_path_; } | 50 const dbus::ObjectPath& object_path() const { return object_path_; } |
51 | 51 |
52 private: | 52 private: |
53 friend class BluetoothRemoteGattCharacteristicChromeOS; | 53 friend class BluetoothRemoteGattCharacteristicChromeOS; |
54 | 54 |
55 BluetoothRemoteGattDescriptorChromeOS( | 55 BluetoothRemoteGattDescriptorChromeOS( |
56 BluetoothRemoteGattCharacteristicChromeOS* characteristic, | 56 BluetoothRemoteGattCharacteristicChromeOS* characteristic, |
57 const dbus::ObjectPath& object_path); | 57 const dbus::ObjectPath& object_path); |
58 virtual ~BluetoothRemoteGattDescriptorChromeOS(); | 58 virtual ~BluetoothRemoteGattDescriptorChromeOS(); |
59 | 59 |
60 // Called by dbus:: on completion of the request to get the descriptor value. | 60 // Called by dbus:: on successful completion of a request to read |
61 void OnGetValue(const ValueCallback& callback, | 61 // the descriptor value. |
62 const ErrorCallback& error_callback, | 62 void OnValueSuccess(const ValueCallback& callback, |
63 bool success); | 63 const std::vector<uint8>& value); |
64 | 64 |
65 // Called by dbus:: on completion of the request to set the descriptor value. | 65 // Called by dbus:: on unsuccessful completion of a request to read or write |
66 void OnSetValue(const base::Closure& callback, | 66 // the descriptor value. |
67 const ErrorCallback& error_callback, | 67 void OnError(const ErrorCallback& error_callback, |
68 bool success); | 68 const std::string& error_name, |
| 69 const std::string& error_message); |
69 | 70 |
70 // Object path of the D-Bus descriptor object. | 71 // Object path of the D-Bus descriptor object. |
71 dbus::ObjectPath object_path_; | 72 dbus::ObjectPath object_path_; |
72 | 73 |
73 // The GATT characteristic this descriptor belongs to. | 74 // The GATT characteristic this descriptor belongs to. |
74 BluetoothRemoteGattCharacteristicChromeOS* characteristic_; | 75 BluetoothRemoteGattCharacteristicChromeOS* characteristic_; |
75 | 76 |
| 77 // The cached characteristic value based on the most recent read request. |
| 78 std::vector<uint8> cached_value_; |
| 79 |
76 // Note: This should remain the last member so it'll be destroyed and | 80 // Note: This should remain the last member so it'll be destroyed and |
77 // invalidate its weak pointers before any other members are destroyed. | 81 // invalidate its weak pointers before any other members are destroyed. |
78 base::WeakPtrFactory<BluetoothRemoteGattDescriptorChromeOS> weak_ptr_factory_; | 82 base::WeakPtrFactory<BluetoothRemoteGattDescriptorChromeOS> weak_ptr_factory_; |
79 | 83 |
80 DISALLOW_COPY_AND_ASSIGN(BluetoothRemoteGattDescriptorChromeOS); | 84 DISALLOW_COPY_AND_ASSIGN(BluetoothRemoteGattDescriptorChromeOS); |
81 }; | 85 }; |
82 | 86 |
83 } // namespace chromeos | 87 } // namespace chromeos |
84 | 88 |
85 #endif // DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_DESCRIPTOR_CHROMEOS_H_ | 89 #endif // DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_DESCRIPTOR_CHROMEOS_H_ |
OLD | NEW |