[Android WebView] Fix webview perf bot switchover to use org.chromium.webview_shell...
[chromium-blink-merge.git] / chromeos / dbus / bluetooth_gatt_manager_client.h
blob155c2b5322f5ef49ebd5403b4e9b2ea133295c8a
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.
5 #ifndef CHROMEOS_DBUS_BLUETOOTH_GATT_MANAGER_CLIENT_H_
6 #define CHROMEOS_DBUS_BLUETOOTH_GATT_MANAGER_CLIENT_H_
8 #include <string>
10 #include "base/callback.h"
11 #include "chromeos/chromeos_export.h"
12 #include "chromeos/dbus/dbus_client.h"
13 #include "dbus/object_path.h"
15 namespace chromeos {
17 // BluetoothGattManagerClient is used to communicate with the GATT Service
18 // manager object of the Bluetooth daemon.
19 class CHROMEOS_EXPORT BluetoothGattManagerClient : public DBusClient {
20 public:
21 // Options used to register a GATT service hierarchy.
22 struct CHROMEOS_EXPORT Options {
23 // TODO(armansito): This parameter is not yet clearly defined. Add fields
24 // later as we know more about how this will be used.
27 ~BluetoothGattManagerClient() override;
29 // The ErrorCallback is used by GATT manager methods to indicate failure. It
30 // receives two arguments: the name of the error in |error_name| and an
31 // optional message in |error_message|.
32 typedef base::Callback<void(const std::string& error_name,
33 const std::string& error_message)> ErrorCallback;
35 // Registers a GATT service implementation within the local process at the
36 // D-Bus object path |service_path| with the remote GATT manager. The local
37 // service must implement the GattService1 interface. Characteristic objects
38 // must be hierarchical to their service and must use the interface
39 // GattCharacteristic1. Similarly, characteristic descriptor objects must
40 // implement the GattDescriptor1 interface and must be hierarchical to their
41 // characteristic. In a successful invocation of RegisterService, the
42 // Bluetooth daemon will discover all objects in the registered hierarchy by
43 // using D-Bus Object Manager. Hence, the object paths and the interfaces in
44 // the registered hierarchy must comply with the BlueZ GATT D-Bus
45 // specification.
46 virtual void RegisterService(const dbus::ObjectPath& service_path,
47 const Options& options,
48 const base::Closure& callback,
49 const ErrorCallback& error_callback) = 0;
51 // Unregisters the GATT service with the D-Bus object path |service_path| from
52 // the remote GATT manager.
53 virtual void UnregisterService(const dbus::ObjectPath& service_path,
54 const base::Closure& callback,
55 const ErrorCallback& error_callback) = 0;
57 // Creates the instance.
58 static BluetoothGattManagerClient* Create();
60 // Constants used to indicate exceptional error conditions.
61 static const char kNoResponseError[];
63 protected:
64 BluetoothGattManagerClient();
66 private:
67 DISALLOW_COPY_AND_ASSIGN(BluetoothGattManagerClient);
70 } // namespace chromeos
72 #endif // CHROMEOS_DBUS_BLUETOOTH_GATT_MANAGER_CLIENT_H_