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

Side by Side Diff: chromeos/dbus/bluetooth_advertisement_service_provider.h

Issue 1052363005: Add DBus bindings for BLE Advertisement. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROMEOS_DBUS_BLUETOOTH_ADVERTISEMENT_SERVICE_PROVIDER_H_
6 #define CHROMEOS_DBUS_BLUETOOTH_ADVERTISEMENT_SERVICE_PROVIDER_H_
7
8 #include <stdint.h>
9
10 #include <map>
11 #include <string>
12 #include <vector>
13
14 #include "base/basictypes.h"
15 #include "base/callback.h"
16 #include "base/memory/scoped_ptr.h"
17 #include "chromeos/chromeos_export.h"
18 #include "dbus/bus.h"
19 #include "dbus/file_descriptor.h"
20 #include "dbus/object_path.h"
21
22 namespace chromeos {
23
24 // BluetoothAdvertisementServiceProvider is used to provide a D-Bus object that
25 // the Bluetooth daemon can communicate with to advertise data.
26 //
27 // Instantiate with a chosen D-Bus object path and delegate object, and pass
28 // the D-Bus object path as the |obj_path| argument to the
29 // chromeos::BluetoothAdvertisementManagerClient::RegisterAdvertisement()
30 // method.
31 //
32 // When an incoming profile connection occurs, or after initiating a connection
Marie Janssen 2015/04/09 22:36:27 This comment section doesn't make sense, I'm guess
rkc 2015/04/13 19:47:45 Done.
33 // using the chromeos::BluetoothDeviceClient::ConnectAdvertisement() method, the
34 // Bluetooth daemon will make calls to this profile object and they will be
35 // passed on to your Delegate object for handling. Responses should be returned
36 // using the callbacks supplied to those methods.
37 class CHROMEOS_EXPORT BluetoothAdvertisementServiceProvider {
38 public:
39 using UUIDList = std::vector<std::string>;
40 using ManufacturerData = std::map<uint16_t, std::vector<uint8_t>>;
41 using ServiceData = std::map<std::string, std::vector<uint8_t>>;
42
43 // Type of advertisement.
44 enum AdvertisementType { BROADCAST, PERIPHERAL };
45
46 // Interface for reacting to profile requests.
47 class Delegate {
48 public:
49 virtual ~Delegate() {}
50
51 // This method will be called when the advertisement is unregistered from
52 // the Bluetooth daemon, generally at shutdown or at the applications'
53 // request. It may be used to perform cleanup tasks. This corresponds to
54 // the org.bluez.Advertisement1.Release method and is renamed to avoid a
Marie Janssen 2015/04/09 22:36:27 nit: org.bluez.LEAdvertisement1.Release
rkc 2015/04/13 19:47:45 Done.
55 // conflict with base::Refcounted<T>.
56 virtual void Released() = 0;
57 };
58
59 virtual ~BluetoothAdvertisementServiceProvider();
60
61 // Creates the instance where |bus| is the D-Bus bus connection to export
62 // the object onto, |object_path| is the object path that it should have
63 // and |delegate| is the object to which all method calls will be passed
64 // and responses generated from.
65 static BluetoothAdvertisementServiceProvider* Create(
66 dbus::Bus* bus,
67 const dbus::ObjectPath& object_path,
68 Delegate* delegate,
69 AdvertisementType type,
70 scoped_ptr<UUIDList> service_uuids,
71 scoped_ptr<ManufacturerData> manufacturer_data,
72 scoped_ptr<UUIDList> solicit_uuids,
73 scoped_ptr<ServiceData> service_data);
74
75 protected:
76 BluetoothAdvertisementServiceProvider();
77
78 private:
79 DISALLOW_COPY_AND_ASSIGN(BluetoothAdvertisementServiceProvider);
80 };
81
82 } // namespace chromeos
83
84 #endif // CHROMEOS_DBUS_BLUETOOTH_ADVERTISEMENT_SERVICE_PROVIDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698