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.
4
5#ifndef CHROMEOS_DBUS_BLUETOOTH_GATT_SERVICE_SERVICE_PROVIDER_H_
6#define CHROMEOS_DBUS_BLUETOOTH_GATT_SERVICE_SERVICE_PROVIDER_H_
7
8#include <string>
9#include <vector>
10
11#include "chromeos/chromeos_export.h"
12#include "dbus/bus.h"
13#include "dbus/object_path.h"
14
15namespace chromeos {
16
17// BluetoothGattServiceServiceProvider is used to provide a D-Bus object that
18// the Bluetooth daemon can communicate with to register GATT service
19// hierarchies.
20//
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.
27class CHROMEOS_EXPORT BluetoothGattServiceServiceProvider {
28 public:
29  virtual ~BluetoothGattServiceServiceProvider();
30
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);
42
43 protected:
44  BluetoothGattServiceServiceProvider();
45
46 private:
47  DISALLOW_COPY_AND_ASSIGN(BluetoothGattServiceServiceProvider);
48};
49
50}  // namespace chromeos
51
52#endif  // CHROMEOS_DBUS_BLUETOOTH_GATT_SERVICE_SERVICE_PROVIDER_H_
53