Pepper: Fix crash on allocation failure.
[chromium-blink-merge.git] / chromeos / dbus / bluetooth_gatt_service_service_provider.h
blob258c4b4ace74ce78c870cbbe79a8985adead2751
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_SERVICE_SERVICE_PROVIDER_H_
6 #define CHROMEOS_DBUS_BLUETOOTH_GATT_SERVICE_SERVICE_PROVIDER_H_
8 #include <string>
9 #include <vector>
11 #include "chromeos/chromeos_export.h"
12 #include "dbus/bus.h"
13 #include "dbus/object_path.h"
15 namespace chromeos {
17 // BluetoothGattServiceServiceProvider is used to provide a D-Bus object that
18 // the Bluetooth daemon can communicate with to register GATT service
19 // hierarchies.
21 // Instantiate with a chosen D-Bus object path (that conforms to the BlueZ GATT
22 // service specification), service UUID, and the list of included services, and
23 // pass the D-Bus object path as the |service_path| argument to the
24 // chromeos::BluetoothGattManagerClient::RegisterService method. Make sure to
25 // create characteristic and descriptor objects using the appropriate service
26 // providers before registering a GATT service with the Bluetooth daemon.
27 class CHROMEOS_EXPORT BluetoothGattServiceServiceProvider {
28 public:
29 virtual ~BluetoothGattServiceServiceProvider();
31 // Creates the instance where |bus| is the D-Bus bus connection to export the
32 // object onto, |object_path| is the object path that it should have, |uuid|
33 // is the 128-bit GATT service UUID, and |includes| are a list of object paths
34 // belonging to other exported GATT services that are included by the GATT
35 // service being created. Make sure that all included services have been
36 // exported before registering a GATT services with the GATT manager.
37 static BluetoothGattServiceServiceProvider* Create(
38 dbus::Bus* bus,
39 const dbus::ObjectPath& object_path,
40 const std::string& uuid,
41 const std::vector<dbus::ObjectPath>& includes);
43 protected:
44 BluetoothGattServiceServiceProvider();
46 private:
47 DISALLOW_COPY_AND_ASSIGN(BluetoothGattServiceServiceProvider);
50 } // namespace chromeos
52 #endif // CHROMEOS_DBUS_BLUETOOTH_GATT_SERVICE_SERVICE_PROVIDER_H_