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

Side by Side Diff: chromeos/dbus/bluetooth_property.cc

Issue 15020009: Bluetooth: remove legacy backend (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « chromeos/dbus/bluetooth_property.h ('k') | chromeos/dbus/dbus_thread_manager.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2012 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 #include "chromeos/dbus/bluetooth_property.h"
6
7 #include "base/bind.h"
8 #include "dbus/message.h"
9 #include "dbus/object_proxy.h"
10 #include "third_party/cros_system_api/dbus/service_constants.h"
11
12 namespace chromeos {
13
14 void BluetoothPropertySet::ConnectSignals() {
15 dbus::ObjectProxy* object_proxy = this->object_proxy();
16 DCHECK(object_proxy);
17 object_proxy->ConnectToSignal(
18 interface(),
19 bluetooth_common::kPropertyChangedSignal,
20 base::Bind(&dbus::PropertySet::ChangedReceived, GetWeakPtr()),
21 base::Bind(&dbus::PropertySet::ChangedConnected, GetWeakPtr()));
22 }
23
24 void BluetoothPropertySet::ChangedReceived(dbus::Signal* signal) {
25 DCHECK(signal);
26
27 dbus::MessageReader reader(signal);
28 UpdatePropertyFromReader(&reader);
29 }
30
31 void BluetoothPropertySet::Get(dbus::PropertyBase* property,
32 GetCallback callback) {
33 NOTREACHED() << "BlueZ does not implement Get for properties";
34 }
35
36 void BluetoothPropertySet::GetAll() {
37 dbus::MethodCall method_call(interface(),
38 bluetooth_common::kGetProperties);
39
40 dbus::ObjectProxy* object_proxy = this->object_proxy();
41 DCHECK(object_proxy);
42 object_proxy->CallMethod(&method_call,
43 dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
44 base::Bind(&dbus::PropertySet::OnGetAll,
45 GetWeakPtr()));
46 }
47
48 void BluetoothPropertySet::Set(dbus::PropertyBase* property,
49 SetCallback callback) {
50 dbus::MethodCall method_call(interface(),
51 bluetooth_common::kSetProperty);
52 dbus::MessageWriter writer(&method_call);
53 writer.AppendString(property->name());
54 property->AppendSetValueToWriter(&writer);
55
56 dbus::ObjectProxy *object_proxy = this->object_proxy();
57 DCHECK(object_proxy);
58 object_proxy->CallMethod(&method_call,
59 dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
60 base::Bind(&dbus::PropertySet::OnSet,
61 this->GetWeakPtr(),
62 property,
63 callback));
64 }
65
66 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/dbus/bluetooth_property.h ('k') | chromeos/dbus/dbus_thread_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698