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

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.
armansito 2015/04/09 22:08:33 s/2013/2015/
rkc 2015/04/13 19:47:46 Done.
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 class CHROMEOS_EXPORT BluetoothAdvertisementServiceProvider {
27 public:
28 using UUIDList = std::vector<std::string>;
29 using ManufacturerData = std::map<uint16_t, std::vector<uint8_t>>;
30 using ServiceData = std::map<std::string, std::vector<uint8_t>>;
31
32 // Type of advertisement.
33 enum AdvertisementType { BROADCAST, PERIPHERAL };
armansito 2015/04/09 22:08:33 ADVERTISEMENT_TYPE_BROADCAST, etc.
rkc 2015/04/13 19:47:46 Done.
34
35 // Interface for reacting to profile requests.
36 class Delegate {
37 public:
38 virtual ~Delegate() {}
39
40 // This method will be called when the advertisement is unregistered from
41 // the Bluetooth daemon, generally at shutdown or at the applications'
42 // request. It may be used to perform cleanup tasks. This corresponds to
43 // the org.bluez.Advertisement1.Release method and is renamed to avoid a
44 // conflict with base::Refcounted<T>.
45 virtual void Released() = 0;
46 };
47
48 virtual ~BluetoothAdvertisementServiceProvider();
49
50 // Creates the instance where |bus| is the D-Bus bus connection to export
51 // the object onto, |object_path| is the object path that it should have
52 // and |delegate| is the object to which all method calls will be passed
53 // and responses generated from.
54 static BluetoothAdvertisementServiceProvider* Create(
55 dbus::Bus* bus,
56 const dbus::ObjectPath& object_path,
57 Delegate* delegate,
58 AdvertisementType type,
59 scoped_ptr<UUIDList> service_uuids,
60 scoped_ptr<ManufacturerData> manufacturer_data,
61 scoped_ptr<UUIDList> solicit_uuids,
62 scoped_ptr<ServiceData> service_data);
armansito 2015/04/09 22:08:33 You should probably define a structure for these p
rkc 2015/04/13 19:47:46 I think the current design is to simply create a n
63
64 protected:
65 BluetoothAdvertisementServiceProvider();
66
67 private:
68 DISALLOW_COPY_AND_ASSIGN(BluetoothAdvertisementServiceProvider);
69 };
70
71 } // namespace chromeos
72
73 #endif // CHROMEOS_DBUS_BLUETOOTH_ADVERTISEMENT_SERVICE_PROVIDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698