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

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

Issue 333983003: device/bluetooth: Implement BluetoothGattConnection on Chrome OS. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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 | « no previous file | device/bluetooth/bluetooth.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "chromeos/dbus/fake_bluetooth_device_client.h" 5 #include "chromeos/dbus/fake_bluetooth_device_client.h"
6 6
7 #include <fcntl.h> 7 #include <fcntl.h>
8 #include <unistd.h> 8 #include <unistd.h>
9 #include <sys/types.h> 9 #include <sys/types.h>
10 #include <sys/socket.h> 10 #include <sys/socket.h>
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 VLOG(1) << "Connect: " << object_path.value(); 286 VLOG(1) << "Connect: " << object_path.value();
287 Properties* properties = GetProperties(object_path); 287 Properties* properties = GetProperties(object_path);
288 288
289 if (properties->connected.value() == true) { 289 if (properties->connected.value() == true) {
290 // Already connected. 290 // Already connected.
291 callback.Run(); 291 callback.Run();
292 return; 292 return;
293 } 293 }
294 294
295 if (properties->paired.value() != true && 295 if (properties->paired.value() != true &&
296 object_path != dbus::ObjectPath(kConnectUnpairablePath)) { 296 object_path != dbus::ObjectPath(kConnectUnpairablePath) &&
297 object_path != dbus::ObjectPath(kLowEnergyPath)) {
297 // Must be paired. 298 // Must be paired.
298 error_callback.Run(bluetooth_device::kErrorFailed, "Not paired"); 299 error_callback.Run(bluetooth_device::kErrorFailed, "Not paired");
299 return; 300 return;
300 } else if (properties->paired.value() == true && 301 } else if (properties->paired.value() == true &&
301 object_path == dbus::ObjectPath(kUnconnectableDevicePath)) { 302 object_path == dbus::ObjectPath(kUnconnectableDevicePath)) {
302 // Must not be paired 303 // Must not be paired
303 error_callback.Run(bluetooth_device::kErrorFailed, 304 error_callback.Run(bluetooth_device::kErrorFailed,
304 "Connection fails while paired"); 305 "Connection fails while paired");
305 return; 306 return;
306 } 307 }
(...skipping 883 matching lines...) Expand 10 before | Expand all | Expand 10 after
1190 // TODO(keybuk): tear down this side of the connection 1191 // TODO(keybuk): tear down this side of the connection
1191 callback.Run(); 1192 callback.Run();
1192 } else if (status == BluetoothProfileServiceProvider::Delegate::CANCELLED) { 1193 } else if (status == BluetoothProfileServiceProvider::Delegate::CANCELLED) {
1193 error_callback.Run(bluetooth_device::kErrorFailed, "Canceled"); 1194 error_callback.Run(bluetooth_device::kErrorFailed, "Canceled");
1194 } else if (status == BluetoothProfileServiceProvider::Delegate::REJECTED) { 1195 } else if (status == BluetoothProfileServiceProvider::Delegate::REJECTED) {
1195 error_callback.Run(bluetooth_device::kErrorFailed, "Rejected"); 1196 error_callback.Run(bluetooth_device::kErrorFailed, "Rejected");
1196 } 1197 }
1197 } 1198 }
1198 1199
1199 } // namespace chromeos 1200 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | device/bluetooth/bluetooth.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698