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

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

Issue 2084463002: BlueZ + DBus implementations of create/remove service record functions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 6 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_ADAPTER_CLIENT_H_ 5 #ifndef DEVICE_BLUETOOTH_DBUS_BLUETOOTH_ADAPTER_CLIENT_H_
6 #define DEVICE_BLUETOOTH_DBUS_BLUETOOTH_ADAPTER_CLIENT_H_ 6 #define DEVICE_BLUETOOTH_DBUS_BLUETOOTH_ADAPTER_CLIENT_H_
7 7
8 #include <stdint.h> 8 #include <cstdint>
9
10 #include <memory> 9 #include <memory>
11 #include <string> 10 #include <string>
12 #include <vector> 11 #include <vector>
13 12
14 #include "base/callback.h" 13 #include "base/callback_forward.h"
15 #include "base/macros.h" 14 #include "base/macros.h"
16 #include "base/observer_list.h"
17 #include "base/values.h"
18 #include "dbus/object_path.h" 15 #include "dbus/object_path.h"
19 #include "dbus/property.h" 16 #include "dbus/property.h"
20 #include "device/bluetooth/bluetooth_export.h" 17 #include "device/bluetooth/bluetooth_export.h"
21 #include "device/bluetooth/dbus/bluez_dbus_client.h" 18 #include "device/bluetooth/dbus/bluez_dbus_client.h"
22 19
20 namespace dbus {
21 class ObjectProxy;
22 }
23
23 namespace bluez { 24 namespace bluez {
24 25
26 class BluetoothServiceRecordBlueZ;
27
25 // BluetoothAdapterClient is used to communicate with objects representing 28 // BluetoothAdapterClient is used to communicate with objects representing
26 // local Bluetooth Adapters. 29 // local Bluetooth Adapters.
27 class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterClient : public BluezDBusClient { 30 class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterClient : public BluezDBusClient {
28 public: 31 public:
29 // A DiscoveryFilter represents a filter passed to the SetDiscoveryFilter 32 // A DiscoveryFilter represents a filter passed to the SetDiscoveryFilter
30 // method. 33 // method.
31 struct DiscoveryFilter { 34 struct DiscoveryFilter {
32 DiscoveryFilter(); 35 DiscoveryFilter();
33 ~DiscoveryFilter(); 36 ~DiscoveryFilter();
34 37
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 virtual void AddObserver(Observer* observer) = 0; 130 virtual void AddObserver(Observer* observer) = 0;
128 virtual void RemoveObserver(Observer* observer) = 0; 131 virtual void RemoveObserver(Observer* observer) = 0;
129 132
130 // Returns the list of adapter object paths known to the system. 133 // Returns the list of adapter object paths known to the system.
131 virtual std::vector<dbus::ObjectPath> GetAdapters() = 0; 134 virtual std::vector<dbus::ObjectPath> GetAdapters() = 0;
132 135
133 // Obtain the properties for the adapter with object path |object_path|, 136 // Obtain the properties for the adapter with object path |object_path|,
134 // any values should be copied if needed. 137 // any values should be copied if needed.
135 virtual Properties* GetProperties(const dbus::ObjectPath& object_path) = 0; 138 virtual Properties* GetProperties(const dbus::ObjectPath& object_path) = 0;
136 139
140 // Callback used to send back the handle of a created service record.
141 using ServiceRecordCallback = base::Callback<void(uint32_t)>;
142
137 // The ErrorCallback is used by adapter methods to indicate failure. 143 // The ErrorCallback is used by adapter methods to indicate failure.
138 // It receives two arguments: the name of the error in |error_name| and 144 // It receives two arguments: the name of the error in |error_name| and
139 // an optional message in |error_message|. 145 // an optional message in |error_message|.
140 typedef base::Callback<void(const std::string& error_name, 146 typedef base::Callback<void(const std::string& error_name,
141 const std::string& error_message)> ErrorCallback; 147 const std::string& error_message)> ErrorCallback;
142 148
143 // Starts a device discovery on the adapter with object path |object_path|. 149 // Starts a device discovery on the adapter with object path |object_path|.
144 virtual void StartDiscovery(const dbus::ObjectPath& object_path, 150 virtual void StartDiscovery(const dbus::ObjectPath& object_path,
145 const base::Closure& callback, 151 const base::Closure& callback,
146 const ErrorCallback& error_callback) = 0; 152 const ErrorCallback& error_callback) = 0;
(...skipping 16 matching lines...) Expand all
163 // |object_path|. When this method is called with no filter parameter, filter 169 // |object_path|. When this method is called with no filter parameter, filter
164 // is removed. 170 // is removed.
165 // SetDiscoveryFilter can be called before StartDiscovery. It is useful when 171 // SetDiscoveryFilter can be called before StartDiscovery. It is useful when
166 // client will create first discovery session, to ensure that proper scan 172 // client will create first discovery session, to ensure that proper scan
167 // will be started right after call to StartDiscovery. 173 // will be started right after call to StartDiscovery.
168 virtual void SetDiscoveryFilter(const dbus::ObjectPath& object_path, 174 virtual void SetDiscoveryFilter(const dbus::ObjectPath& object_path,
169 const DiscoveryFilter& discovery_filter, 175 const DiscoveryFilter& discovery_filter,
170 const base::Closure& callback, 176 const base::Closure& callback,
171 const ErrorCallback& error_callback) = 0; 177 const ErrorCallback& error_callback) = 0;
172 178
179 // Creates the service record |record| on the adapter with the object path
180 // |object_path|.
181 virtual void CreateServiceRecord(const dbus::ObjectPath& object_path,
182 const BluetoothServiceRecordBlueZ& record,
183 const ServiceRecordCallback& callback,
184 const ErrorCallback& error_callback) = 0;
185
186 // Removes the service record with the uuid |uuid| on the adapter with the
187 // object path |object_path|.
188 virtual void RemoveServiceRecord(const dbus::ObjectPath& object_path,
189 uint32_t handle,
190 const base::Closure& callback,
191 const ErrorCallback& error_callback) = 0;
192
173 // Creates the instance. 193 // Creates the instance.
174 static BluetoothAdapterClient* Create(); 194 static BluetoothAdapterClient* Create();
175 195
176 // Constants used to indicate exceptional error conditions. 196 // Constants used to indicate exceptional error conditions.
177 static const char kNoResponseError[]; 197 static const char kNoResponseError[];
178 static const char kUnknownAdapterError[]; 198 static const char kUnknownAdapterError[];
179 199
180 protected: 200 protected:
181 BluetoothAdapterClient(); 201 BluetoothAdapterClient();
182 202
183 private: 203 private:
184 DISALLOW_COPY_AND_ASSIGN(BluetoothAdapterClient); 204 DISALLOW_COPY_AND_ASSIGN(BluetoothAdapterClient);
185 }; 205 };
186 206
187 } // namespace bluez 207 } // namespace bluez
188 208
189 #endif // DEVICE_BLUETOOTH_DBUS_BLUETOOTH_ADAPTER_CLIENT_H_ 209 #endif // DEVICE_BLUETOOTH_DBUS_BLUETOOTH_ADAPTER_CLIENT_H_
OLDNEW
« no previous file with comments | « device/bluetooth/bluez/bluetooth_service_record_bluez_unittest.cc ('k') | device/bluetooth/dbus/bluetooth_adapter_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698