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

Side by Side Diff: device/bluetooth/dbus/fake_bluetooth_gatt_manager_client.cc

Issue 1946053002: Fixes to DBus GATT components. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
« no previous file with comments | « device/bluetooth/dbus/fake_bluetooth_gatt_manager_client.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "device/bluetooth/dbus/fake_bluetooth_gatt_manager_client.h" 5 #include "device/bluetooth/dbus/fake_bluetooth_gatt_manager_client.h"
6 6
7 #include <set> 7 #include <set>
8 #include <string> 8 #include <string>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 90
91 FakeBluetoothGattManagerClient::FakeBluetoothGattManagerClient() {} 91 FakeBluetoothGattManagerClient::FakeBluetoothGattManagerClient() {}
92 92
93 FakeBluetoothGattManagerClient::~FakeBluetoothGattManagerClient() {} 93 FakeBluetoothGattManagerClient::~FakeBluetoothGattManagerClient() {}
94 94
95 // DBusClient override. 95 // DBusClient override.
96 void FakeBluetoothGattManagerClient::Init(dbus::Bus* bus) {} 96 void FakeBluetoothGattManagerClient::Init(dbus::Bus* bus) {}
97 97
98 // BluetoothGattManagerClient overrides. 98 // BluetoothGattManagerClient overrides.
99 void FakeBluetoothGattManagerClient::RegisterApplication( 99 void FakeBluetoothGattManagerClient::RegisterApplication(
100 const dbus::ObjectPath& adapter_object_path,
100 const dbus::ObjectPath& application_path, 101 const dbus::ObjectPath& application_path,
101 const Options& options, 102 const Options& options,
102 const base::Closure& callback, 103 const base::Closure& callback,
103 const ErrorCallback& error_callback) { 104 const ErrorCallback& error_callback) {
104 VLOG(1) << "Register GATT application: " << application_path.value(); 105 VLOG(1) << "Register GATT application: " << application_path.value();
105 ApplicationProvider* provider = 106 ApplicationProvider* provider =
106 GetApplicationServiceProvider(application_path); 107 GetApplicationServiceProvider(application_path);
107 if (!provider || provider->second) 108 if (!provider || provider->second)
108 error_callback.Run(bluetooth_gatt_service::kErrorFailed, ""); 109 error_callback.Run(bluetooth_gatt_service::kErrorFailed, "");
109 if (!VerifyProviderHierarchy(provider->first)) 110 if (!VerifyProviderHierarchy(provider->first))
110 error_callback.Run(bluetooth_gatt_service::kErrorFailed, ""); 111 error_callback.Run(bluetooth_gatt_service::kErrorFailed, "");
111 provider->second = true; 112 provider->second = true;
112 callback.Run(); 113 callback.Run();
113 } 114 }
114 115
115 // BluetoothGattManagerClient overrides. 116 // BluetoothGattManagerClient overrides.
116 void FakeBluetoothGattManagerClient::UnregisterApplication( 117 void FakeBluetoothGattManagerClient::UnregisterApplication(
118 const dbus::ObjectPath& adapter_object_path,
117 const dbus::ObjectPath& application_path, 119 const dbus::ObjectPath& application_path,
118 const base::Closure& callback, 120 const base::Closure& callback,
119 const ErrorCallback& error_callback) { 121 const ErrorCallback& error_callback) {
120 VLOG(1) << "Unregister GATT application: " << application_path.value(); 122 VLOG(1) << "Unregister GATT application: " << application_path.value();
121 ApplicationProvider* provider = 123 ApplicationProvider* provider =
122 GetApplicationServiceProvider(application_path); 124 GetApplicationServiceProvider(application_path);
123 if (!provider || !provider->second) 125 if (!provider || !provider->second)
124 error_callback.Run(bluetooth_gatt_service::kErrorFailed, ""); 126 error_callback.Run(bluetooth_gatt_service::kErrorFailed, "");
125 provider->second = false; 127 provider->second = false;
126 callback.Run(); 128 callback.Run();
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 if (base::StartsWith(service_path.value(), 242 if (base::StartsWith(service_path.value(),
241 application.second.first->object_path().value(), 243 application.second.first->object_path().value(),
242 base::CompareCase::SENSITIVE)) { 244 base::CompareCase::SENSITIVE)) {
243 return application.second.second; 245 return application.second.second;
244 } 246 }
245 } 247 }
246 return false; 248 return false;
247 } 249 }
248 250
249 } // namespace bluez 251 } // namespace bluez
OLDNEW
« no previous file with comments | « device/bluetooth/dbus/fake_bluetooth_gatt_manager_client.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698