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

Side by Side Diff: device/bluetooth/dbus/bluetooth_gatt_characteristic_service_provider_impl.h

Issue 1974633002: Implement DBus changes needed for notifications. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_DBUS_BLUETOOTH_GATT_CHARACTERISTIC_SERVICE_PROVIDER_IMP L_H_ 5 #ifndef DEVICE_BLUETOOTH_DBUS_BLUETOOTH_GATT_CHARACTERISTIC_SERVICE_PROVIDER_IMP L_H_
6 #define DEVICE_BLUETOOTH_DBUS_BLUETOOTH_GATT_CHARACTERISTIC_SERVICE_PROVIDER_IMP L_H_ 6 #define DEVICE_BLUETOOTH_DBUS_BLUETOOTH_GATT_CHARACTERISTIC_SERVICE_PROVIDER_IMP L_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
14 #include "base/memory/weak_ptr.h" 14 #include "base/memory/weak_ptr.h"
15 #include "base/threading/platform_thread.h" 15 #include "base/threading/platform_thread.h"
16 #include "dbus/bus.h" 16 #include "dbus/bus.h"
17 #include "dbus/exported_object.h" 17 #include "dbus/exported_object.h"
18 #include "dbus/message.h" 18 #include "dbus/message.h"
19 #include "dbus/object_path.h" 19 #include "dbus/object_path.h"
20 #include "device/bluetooth/dbus/bluetooth_gatt_attribute_value_delegate.h" 20 #include "device/bluetooth/dbus/bluetooth_gatt_attribute_value_delegate.h"
21 #include "device/bluetooth/dbus/bluetooth_gatt_characteristic_service_provider.h " 21 #include "device/bluetooth/dbus/bluetooth_gatt_characteristic_service_provider.h "
22 22
23 namespace bluez { 23 namespace bluez {
24 24
25 // The BluetoothGattCharacteristicServiceProvider implementation used in 25 // The BluetoothGattCharacteristicServiceProvider implementation used in
26 // production. 26 // production.
27 class DEVICE_BLUETOOTH_EXPORT BluetoothGattCharacteristicServiceProviderImpl 27 class DEVICE_BLUETOOTH_EXPORT BluetoothGattCharacteristicServiceProviderImpl
28 : public BluetoothGattCharacteristicServiceProvider { 28 : public BluetoothGattCharacteristicServiceProvider {
29 public: 29 public:
30 // Use nullptr for |bus| to create for testing.
30 BluetoothGattCharacteristicServiceProviderImpl( 31 BluetoothGattCharacteristicServiceProviderImpl(
31 dbus::Bus* bus, 32 dbus::Bus* bus,
32 const dbus::ObjectPath& object_path, 33 const dbus::ObjectPath& object_path,
33 std::unique_ptr<BluetoothGattAttributeValueDelegate> delegate, 34 std::unique_ptr<BluetoothGattAttributeValueDelegate> delegate,
34 const std::string& uuid, 35 const std::string& uuid,
35 const std::vector<std::string>& flags, 36 const std::vector<std::string>& flags,
36 const dbus::ObjectPath& service_path); 37 const dbus::ObjectPath& service_path);
37 38
38 ~BluetoothGattCharacteristicServiceProviderImpl() override; 39 ~BluetoothGattCharacteristicServiceProviderImpl() override;
39 40
(...skipping 22 matching lines...) Expand all
62 // Called by BlueZ when a remote central is requesting to read the value of 63 // Called by BlueZ when a remote central is requesting to read the value of
63 // this characteristic. 64 // this characteristic.
64 void ReadValue(dbus::MethodCall* method_call, 65 void ReadValue(dbus::MethodCall* method_call,
65 dbus::ExportedObject::ResponseSender response_sender); 66 dbus::ExportedObject::ResponseSender response_sender);
66 67
67 // Called by BlueZ when a remote central is requesting to write the value of 68 // Called by BlueZ when a remote central is requesting to write the value of
68 // this characteristic. 69 // this characteristic.
69 void WriteValue(dbus::MethodCall* method_call, 70 void WriteValue(dbus::MethodCall* method_call,
70 dbus::ExportedObject::ResponseSender response_sender); 71 dbus::ExportedObject::ResponseSender response_sender);
71 72
73 // Called by BlueZ when a remote central is requesting to start a
74 // notification session for this characteristic.
75 void StartNotify(dbus::MethodCall* method_call,
76 dbus::ExportedObject::ResponseSender response_sender);
77
78 // Called by BlueZ when a remote central is requesting to stop any existing
79 // notification session for this characteristic.
80 void StopNotify(dbus::MethodCall* method_call,
81 dbus::ExportedObject::ResponseSender response_sender);
82
72 // Called by dbus:: when a method is exported. 83 // Called by dbus:: when a method is exported.
73 void OnExported(const std::string& interface_name, 84 void OnExported(const std::string& interface_name,
74 const std::string& method_name, 85 const std::string& method_name,
75 bool success); 86 bool success);
76 87
77 // Called by the Delegate in response to a method to call to get all 88 // Called by the Delegate in response to a method to call to get all
78 // properties, in which the delegate has successfully returned the 89 // properties, in which the delegate has successfully returned the
79 // characteristic value. 90 // characteristic value.
80 void OnGetAll(dbus::MethodCall* method_call, 91 void OnGetAll(dbus::MethodCall* method_call,
81 dbus::ExportedObject::ResponseSender response_sender, 92 dbus::ExportedObject::ResponseSender response_sender,
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 // invalidate its weak pointers before any other members are destroyed. 160 // invalidate its weak pointers before any other members are destroyed.
150 base::WeakPtrFactory<BluetoothGattCharacteristicServiceProviderImpl> 161 base::WeakPtrFactory<BluetoothGattCharacteristicServiceProviderImpl>
151 weak_ptr_factory_; 162 weak_ptr_factory_;
152 163
153 DISALLOW_COPY_AND_ASSIGN(BluetoothGattCharacteristicServiceProviderImpl); 164 DISALLOW_COPY_AND_ASSIGN(BluetoothGattCharacteristicServiceProviderImpl);
154 }; 165 };
155 166
156 } // namespace bluez 167 } // namespace bluez
157 168
158 #endif // DEVICE_BLUETOOTH_DBUS_BLUETOOTH_GATT_CHARACTERISTIC_SERVICE_PROVIDER_ IMPL_H_ 169 #endif // DEVICE_BLUETOOTH_DBUS_BLUETOOTH_GATT_CHARACTERISTIC_SERVICE_PROVIDER_ IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698