OLD | NEW |
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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 namespace chromeos { | 72 namespace chromeos { |
73 | 73 |
74 const char FakeBluetoothDeviceClient::kPairedDevicePath[] = | 74 const char FakeBluetoothDeviceClient::kPairedDevicePath[] = |
75 "/fake/hci0/dev0"; | 75 "/fake/hci0/dev0"; |
76 const char FakeBluetoothDeviceClient::kPairedDeviceAddress[] = | 76 const char FakeBluetoothDeviceClient::kPairedDeviceAddress[] = |
77 "00:11:22:33:44:55"; | 77 "00:11:22:33:44:55"; |
78 const char FakeBluetoothDeviceClient::kPairedDeviceName[] = | 78 const char FakeBluetoothDeviceClient::kPairedDeviceName[] = |
79 "Fake Device"; | 79 "Fake Device"; |
80 const uint32 FakeBluetoothDeviceClient::kPairedDeviceClass = 0x000104; | 80 const uint32 FakeBluetoothDeviceClient::kPairedDeviceClass = 0x000104; |
81 | 81 |
82 const char FakeBluetoothDeviceClient::kAppleMousePath[] = | 82 const char FakeBluetoothDeviceClient::kLegacyAutopairPath[] = |
83 "/fake/hci0/dev1"; | 83 "/fake/hci0/dev1"; |
84 const char FakeBluetoothDeviceClient::kAppleMouseAddress[] = | 84 const char FakeBluetoothDeviceClient::kLegacyAutopairAddress[] = |
85 "28:CF:DA:00:00:00"; | 85 "28:CF:DA:00:00:00"; |
86 const char FakeBluetoothDeviceClient::kAppleMouseName[] = | 86 const char FakeBluetoothDeviceClient::kLegacyAutopairName[] = |
87 "Apple Magic Mouse"; | 87 "Bluetooth 2.0 Mouse"; |
88 const uint32 FakeBluetoothDeviceClient::kAppleMouseClass = 0x002580; | 88 const uint32 FakeBluetoothDeviceClient::kLegacyAutopairClass = 0x002580; |
89 | 89 |
90 const char FakeBluetoothDeviceClient::kAppleKeyboardPath[] = | 90 const char FakeBluetoothDeviceClient::kDisplayPinCodePath[] = |
91 "/fake/hci0/dev2"; | 91 "/fake/hci0/dev2"; |
92 const char FakeBluetoothDeviceClient::kAppleKeyboardAddress[] = | 92 const char FakeBluetoothDeviceClient::kDisplayPinCodeAddress[] = |
93 "28:37:37:00:00:00"; | 93 "28:37:37:00:00:00"; |
94 const char FakeBluetoothDeviceClient::kAppleKeyboardName[] = | 94 const char FakeBluetoothDeviceClient::kDisplayPinCodeName[] = |
95 "Apple Wireless Keyboard"; | 95 "Bluetooth 2.0 Keyboard"; |
96 const uint32 FakeBluetoothDeviceClient::kAppleKeyboardClass = 0x002540; | 96 const uint32 FakeBluetoothDeviceClient::kDisplayPinCodeClass = 0x002540; |
97 | 97 |
98 const char FakeBluetoothDeviceClient::kVanishingDevicePath[] = | 98 const char FakeBluetoothDeviceClient::kVanishingDevicePath[] = |
99 "/fake/hci0/dev3"; | 99 "/fake/hci0/dev3"; |
100 const char FakeBluetoothDeviceClient::kVanishingDeviceAddress[] = | 100 const char FakeBluetoothDeviceClient::kVanishingDeviceAddress[] = |
101 "01:02:03:04:05:06"; | 101 "01:02:03:04:05:06"; |
102 const char FakeBluetoothDeviceClient::kVanishingDeviceName[] = | 102 const char FakeBluetoothDeviceClient::kVanishingDeviceName[] = |
103 "Vanishing Device"; | 103 "Vanishing Device"; |
104 const uint32 FakeBluetoothDeviceClient::kVanishingDeviceClass = 0x000104; | 104 const uint32 FakeBluetoothDeviceClient::kVanishingDeviceClass = 0x000104; |
105 | 105 |
106 const char FakeBluetoothDeviceClient::kMicrosoftMousePath[] = | 106 const char FakeBluetoothDeviceClient::kConnectUnpairablePath[] = |
107 "/fake/hci0/dev4"; | 107 "/fake/hci0/dev4"; |
108 const char FakeBluetoothDeviceClient::kMicrosoftMouseAddress[] = | 108 const char FakeBluetoothDeviceClient::kConnectUnpairableAddress[] = |
109 "7C:ED:8D:00:00:00"; | 109 "7C:ED:8D:00:00:00"; |
110 const char FakeBluetoothDeviceClient::kMicrosoftMouseName[] = | 110 const char FakeBluetoothDeviceClient::kConnectUnpairableName[] = |
111 "Microsoft Mouse"; | 111 "Unpairable Device"; |
112 const uint32 FakeBluetoothDeviceClient::kMicrosoftMouseClass = 0x002580; | 112 const uint32 FakeBluetoothDeviceClient::kConnectUnpairableClass = 0x002580; |
113 | 113 |
114 const char FakeBluetoothDeviceClient::kMotorolaKeyboardPath[] = | 114 const char FakeBluetoothDeviceClient::kDisplayPasskeyPath[] = |
115 "/fake/hci0/dev5"; | 115 "/fake/hci0/dev5"; |
116 const char FakeBluetoothDeviceClient::kMotorolaKeyboardAddress[] = | 116 const char FakeBluetoothDeviceClient::kDisplayPasskeyAddress[] = |
117 "00:0F:F6:00:00:00"; | 117 "00:0F:F6:00:00:00"; |
118 const char FakeBluetoothDeviceClient::kMotorolaKeyboardName[] = | 118 const char FakeBluetoothDeviceClient::kDisplayPasskeyName[] = |
119 "Motorola Keyboard"; | 119 "Bluetooth 2.1+ Keyboard"; |
120 const uint32 FakeBluetoothDeviceClient::kMotorolaKeyboardClass = 0x002540; | 120 const uint32 FakeBluetoothDeviceClient::kDisplayPasskeyClass = 0x002540; |
121 | 121 |
122 const char FakeBluetoothDeviceClient::kSonyHeadphonesPath[] = | 122 const char FakeBluetoothDeviceClient::kRequestPinCodePath[] = |
123 "/fake/hci0/dev6"; | 123 "/fake/hci0/dev6"; |
124 const char FakeBluetoothDeviceClient::kSonyHeadphonesAddress[] = | 124 const char FakeBluetoothDeviceClient::kRequestPinCodeAddress[] = |
125 "00:24:BE:00:00:00"; | 125 "00:24:BE:00:00:00"; |
126 const char FakeBluetoothDeviceClient::kSonyHeadphonesName[] = | 126 const char FakeBluetoothDeviceClient::kRequestPinCodeName[] = |
127 "Sony BT-00"; | 127 "PIN Device"; |
128 const uint32 FakeBluetoothDeviceClient::kSonyHeadphonesClass = 0x240408; | 128 const uint32 FakeBluetoothDeviceClient::kRequestPinCodeClass = 0x240408; |
129 | 129 |
130 const char FakeBluetoothDeviceClient::kPhonePath[] = | 130 const char FakeBluetoothDeviceClient::kConfirmPasskeyPath[] = |
131 "/fake/hci0/dev7"; | 131 "/fake/hci0/dev7"; |
132 const char FakeBluetoothDeviceClient::kPhoneAddress[] = | 132 const char FakeBluetoothDeviceClient::kConfirmPasskeyAddress[] = |
133 "20:7D:74:00:00:00"; | 133 "20:7D:74:00:00:00"; |
134 const char FakeBluetoothDeviceClient::kPhoneName[] = | 134 const char FakeBluetoothDeviceClient::kConfirmPasskeyName[] = |
135 "Phone"; | 135 "Phone"; |
136 const uint32 FakeBluetoothDeviceClient::kPhoneClass = 0x7a020c; | 136 const uint32 FakeBluetoothDeviceClient::kConfirmPasskeyClass = 0x7a020c; |
137 | 137 |
138 const char FakeBluetoothDeviceClient::kWeirdDevicePath[] = | 138 const char FakeBluetoothDeviceClient::kRequestPasskeyPath[] = |
139 "/fake/hci0/dev8"; | 139 "/fake/hci0/dev8"; |
140 const char FakeBluetoothDeviceClient::kWeirdDeviceAddress[] = | 140 const char FakeBluetoothDeviceClient::kRequestPasskeyAddress[] = |
141 "20:7D:74:00:00:01"; | 141 "20:7D:74:00:00:01"; |
142 const char FakeBluetoothDeviceClient::kWeirdDeviceName[] = | 142 const char FakeBluetoothDeviceClient::kRequestPasskeyName[] = |
143 "Weird Device"; | 143 "Passkey Device"; |
144 const uint32 FakeBluetoothDeviceClient::kWeirdDeviceClass = 0x7a020c; | 144 const uint32 FakeBluetoothDeviceClient::kRequestPasskeyClass = 0x7a020c; |
145 | 145 |
146 const char FakeBluetoothDeviceClient::kUnconnectableDevicePath[] = | 146 const char FakeBluetoothDeviceClient::kUnconnectableDevicePath[] = |
147 "/fake/hci0/dev9"; | 147 "/fake/hci0/dev9"; |
148 const char FakeBluetoothDeviceClient::kUnconnectableDeviceAddress[] = | 148 const char FakeBluetoothDeviceClient::kUnconnectableDeviceAddress[] = |
149 "20:7D:74:00:00:02"; | 149 "20:7D:74:00:00:02"; |
150 const char FakeBluetoothDeviceClient::kUnconnectableDeviceName[] = | 150 const char FakeBluetoothDeviceClient::kUnconnectableDeviceName[] = |
151 "Unconnectable Device"; | 151 "Unconnectable Device"; |
152 const uint32 FakeBluetoothDeviceClient::kUnconnectableDeviceClass = 0x7a020c; | 152 const uint32 FakeBluetoothDeviceClient::kUnconnectableDeviceClass = 0x7a020c; |
153 | 153 |
154 const char FakeBluetoothDeviceClient::kUnpairableDevicePath[] = | 154 const char FakeBluetoothDeviceClient::kUnpairableDevicePath[] = |
155 "/fake/hci0/devA"; | 155 "/fake/hci0/devA"; |
156 const char FakeBluetoothDeviceClient::kUnpairableDeviceAddress[] = | 156 const char FakeBluetoothDeviceClient::kUnpairableDeviceAddress[] = |
157 "20:7D:74:00:00:03"; | 157 "20:7D:74:00:00:03"; |
158 const char FakeBluetoothDeviceClient::kUnpairableDeviceName[] = | 158 const char FakeBluetoothDeviceClient::kUnpairableDeviceName[] = |
159 "Unpairable Device"; | 159 "Unpairable Device"; |
160 const uint32 FakeBluetoothDeviceClient::kUnpairableDeviceClass = 0x002540; | 160 const uint32 FakeBluetoothDeviceClient::kUnpairableDeviceClass = 0x002540; |
161 | 161 |
162 const char FakeBluetoothDeviceClient::kBoseSpeakersPath[] = | 162 const char FakeBluetoothDeviceClient::kJustWorksPath[] = |
163 "/fake/hci0/devB"; | 163 "/fake/hci0/devB"; |
164 const char FakeBluetoothDeviceClient::kBoseSpeakersAddress[] = | 164 const char FakeBluetoothDeviceClient::kJustWorksAddress[] = |
165 "00:0C:8A:00:00:00"; | 165 "00:0C:8A:00:00:00"; |
166 const char FakeBluetoothDeviceClient::kBoseSpeakersName[] = | 166 const char FakeBluetoothDeviceClient::kJustWorksName[] = |
167 "Bose SoundLink Mobile speaker II"; | 167 "Just-Works Device"; |
168 const uint32 FakeBluetoothDeviceClient::kBoseSpeakersClass = 0x240428; | 168 const uint32 FakeBluetoothDeviceClient::kJustWorksClass = 0x240428; |
169 | 169 |
170 FakeBluetoothDeviceClient::Properties::Properties( | 170 FakeBluetoothDeviceClient::Properties::Properties( |
171 const PropertyChangedCallback& callback) | 171 const PropertyChangedCallback& callback) |
172 : BluetoothDeviceClient::Properties( | 172 : BluetoothDeviceClient::Properties( |
173 NULL, | 173 NULL, |
174 bluetooth_device::kBluetoothDeviceInterface, | 174 bluetooth_device::kBluetoothDeviceInterface, |
175 callback) { | 175 callback) { |
176 } | 176 } |
177 | 177 |
178 FakeBluetoothDeviceClient::Properties::~Properties() { | 178 FakeBluetoothDeviceClient::Properties::~Properties() { |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 VLOG(1) << "Connect: " << object_path.value(); | 270 VLOG(1) << "Connect: " << object_path.value(); |
271 Properties* properties = GetProperties(object_path); | 271 Properties* properties = GetProperties(object_path); |
272 | 272 |
273 if (properties->connected.value() == true) { | 273 if (properties->connected.value() == true) { |
274 // Already connected. | 274 // Already connected. |
275 callback.Run(); | 275 callback.Run(); |
276 return; | 276 return; |
277 } | 277 } |
278 | 278 |
279 if (properties->paired.value() != true && | 279 if (properties->paired.value() != true && |
280 object_path != dbus::ObjectPath(kMicrosoftMousePath)) { | 280 object_path != dbus::ObjectPath(kConnectUnpairablePath)) { |
281 // Must be paired. | 281 // Must be paired. |
282 error_callback.Run(bluetooth_device::kErrorFailed, "Not paired"); | 282 error_callback.Run(bluetooth_device::kErrorFailed, "Not paired"); |
283 return; | 283 return; |
284 } else if (properties->paired.value() == true && | 284 } else if (properties->paired.value() == true && |
285 object_path == dbus::ObjectPath(kUnconnectableDevicePath)) { | 285 object_path == dbus::ObjectPath(kUnconnectableDevicePath)) { |
286 // Must not be paired | 286 // Must not be paired |
287 error_callback.Run(bluetooth_device::kErrorFailed, | 287 error_callback.Run(bluetooth_device::kErrorFailed, |
288 "Connection fails while paired"); | 288 "Connection fails while paired"); |
289 return; | 289 return; |
290 } | 290 } |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
475 if (std::find(device_list_.begin(), | 475 if (std::find(device_list_.begin(), |
476 device_list_.end(), device_path) != device_list_.end()) | 476 device_list_.end(), device_path) != device_list_.end()) |
477 return; | 477 return; |
478 | 478 |
479 Properties* properties = new Properties(base::Bind( | 479 Properties* properties = new Properties(base::Bind( |
480 &FakeBluetoothDeviceClient::OnPropertyChanged, | 480 &FakeBluetoothDeviceClient::OnPropertyChanged, |
481 base::Unretained(this), | 481 base::Unretained(this), |
482 device_path)); | 482 device_path)); |
483 properties->adapter.ReplaceValue(adapter_path); | 483 properties->adapter.ReplaceValue(adapter_path); |
484 | 484 |
485 if (device_path == dbus::ObjectPath(kAppleMousePath)) { | 485 if (device_path == dbus::ObjectPath(kLegacyAutopairPath)) { |
486 properties->address.ReplaceValue(kAppleMouseAddress); | 486 properties->address.ReplaceValue(kLegacyAutopairAddress); |
487 properties->bluetooth_class.ReplaceValue(kAppleMouseClass); | 487 properties->bluetooth_class.ReplaceValue(kLegacyAutopairClass); |
488 properties->name.ReplaceValue("Fake Apple Magic Mouse"); | 488 properties->name.ReplaceValue("LegacyAutopair"); |
489 properties->alias.ReplaceValue(kAppleMouseName); | 489 properties->alias.ReplaceValue(kLegacyAutopairName); |
490 | 490 |
491 std::vector<std::string> uuids; | 491 std::vector<std::string> uuids; |
492 uuids.push_back("00001124-0000-1000-8000-00805f9b34fb"); | 492 uuids.push_back("00001124-0000-1000-8000-00805f9b34fb"); |
493 properties->uuids.ReplaceValue(uuids); | 493 properties->uuids.ReplaceValue(uuids); |
494 | 494 |
495 } else if (device_path == dbus::ObjectPath(kAppleKeyboardPath)) { | 495 } else if (device_path == dbus::ObjectPath(kDisplayPinCodePath)) { |
496 properties->address.ReplaceValue(kAppleKeyboardAddress); | 496 properties->address.ReplaceValue(kDisplayPinCodeAddress); |
497 properties->bluetooth_class.ReplaceValue(kAppleKeyboardClass); | 497 properties->bluetooth_class.ReplaceValue(kDisplayPinCodeClass); |
498 properties->name.ReplaceValue("Fake Apple Wireless Keyboard"); | 498 properties->name.ReplaceValue("DisplayPinCode"); |
499 properties->alias.ReplaceValue(kAppleKeyboardName); | 499 properties->alias.ReplaceValue(kDisplayPinCodeName); |
500 | 500 |
501 std::vector<std::string> uuids; | 501 std::vector<std::string> uuids; |
502 uuids.push_back("00001124-0000-1000-8000-00805f9b34fb"); | 502 uuids.push_back("00001124-0000-1000-8000-00805f9b34fb"); |
503 properties->uuids.ReplaceValue(uuids); | 503 properties->uuids.ReplaceValue(uuids); |
504 | 504 |
505 } else if (device_path == dbus::ObjectPath(kVanishingDevicePath)) { | 505 } else if (device_path == dbus::ObjectPath(kVanishingDevicePath)) { |
506 properties->address.ReplaceValue(kVanishingDeviceAddress); | 506 properties->address.ReplaceValue(kVanishingDeviceAddress); |
507 properties->bluetooth_class.ReplaceValue(kVanishingDeviceClass); | 507 properties->bluetooth_class.ReplaceValue(kVanishingDeviceClass); |
508 properties->name.ReplaceValue("Fake Vanishing Device"); | 508 properties->name.ReplaceValue("VanishingDevice"); |
509 properties->alias.ReplaceValue(kVanishingDeviceName); | 509 properties->alias.ReplaceValue(kVanishingDeviceName); |
510 | 510 |
511 } else if (device_path == dbus::ObjectPath(kMicrosoftMousePath)) { | 511 } else if (device_path == dbus::ObjectPath(kConnectUnpairablePath)) { |
512 properties->address.ReplaceValue(kMicrosoftMouseAddress); | 512 properties->address.ReplaceValue(kConnectUnpairableAddress); |
513 properties->bluetooth_class.ReplaceValue(kMicrosoftMouseClass); | 513 properties->bluetooth_class.ReplaceValue(kConnectUnpairableClass); |
514 properties->name.ReplaceValue("Fake Microsoft Mouse"); | 514 properties->name.ReplaceValue("ConnectUnpairable"); |
515 properties->alias.ReplaceValue(kMicrosoftMouseName); | 515 properties->alias.ReplaceValue(kConnectUnpairableName); |
516 | 516 |
517 std::vector<std::string> uuids; | 517 std::vector<std::string> uuids; |
518 uuids.push_back("00001124-0000-1000-8000-00805f9b34fb"); | 518 uuids.push_back("00001124-0000-1000-8000-00805f9b34fb"); |
519 properties->uuids.ReplaceValue(uuids); | 519 properties->uuids.ReplaceValue(uuids); |
520 | 520 |
521 } else if (device_path == dbus::ObjectPath(kMotorolaKeyboardPath)) { | 521 } else if (device_path == dbus::ObjectPath(kDisplayPasskeyPath)) { |
522 properties->address.ReplaceValue(kMotorolaKeyboardAddress); | 522 properties->address.ReplaceValue(kDisplayPasskeyAddress); |
523 properties->bluetooth_class.ReplaceValue(kMotorolaKeyboardClass); | 523 properties->bluetooth_class.ReplaceValue(kDisplayPasskeyClass); |
524 properties->name.ReplaceValue("Fake Motorola Keyboard"); | 524 properties->name.ReplaceValue("DisplayPasskey"); |
525 properties->alias.ReplaceValue(kMotorolaKeyboardName); | 525 properties->alias.ReplaceValue(kDisplayPasskeyName); |
526 | 526 |
527 std::vector<std::string> uuids; | 527 std::vector<std::string> uuids; |
528 uuids.push_back("00001124-0000-1000-8000-00805f9b34fb"); | 528 uuids.push_back("00001124-0000-1000-8000-00805f9b34fb"); |
529 properties->uuids.ReplaceValue(uuids); | 529 properties->uuids.ReplaceValue(uuids); |
530 | 530 |
531 } else if (device_path == dbus::ObjectPath(kSonyHeadphonesPath)) { | 531 } else if (device_path == dbus::ObjectPath(kRequestPinCodePath)) { |
532 properties->address.ReplaceValue(kSonyHeadphonesAddress); | 532 properties->address.ReplaceValue(kRequestPinCodeAddress); |
533 properties->bluetooth_class.ReplaceValue(kSonyHeadphonesClass); | 533 properties->bluetooth_class.ReplaceValue(kRequestPinCodeClass); |
534 properties->name.ReplaceValue("Fake Sony Headphones"); | 534 properties->name.ReplaceValue("RequestPinCode"); |
535 properties->alias.ReplaceValue(kSonyHeadphonesName); | 535 properties->alias.ReplaceValue(kRequestPinCodeName); |
536 | 536 |
537 } else if (device_path == dbus::ObjectPath(kPhonePath)) { | 537 } else if (device_path == dbus::ObjectPath(kConfirmPasskeyPath)) { |
538 properties->address.ReplaceValue(kPhoneAddress); | 538 properties->address.ReplaceValue(kConfirmPasskeyAddress); |
539 properties->bluetooth_class.ReplaceValue(kPhoneClass); | 539 properties->bluetooth_class.ReplaceValue(kConfirmPasskeyClass); |
540 properties->name.ReplaceValue("Fake Phone"); | 540 properties->name.ReplaceValue("ConfirmPasskey"); |
541 properties->alias.ReplaceValue(kPhoneName); | 541 properties->alias.ReplaceValue(kConfirmPasskeyName); |
542 | 542 |
543 } else if (device_path == dbus::ObjectPath(kWeirdDevicePath)) { | 543 } else if (device_path == dbus::ObjectPath(kRequestPasskeyPath)) { |
544 properties->address.ReplaceValue(kWeirdDeviceAddress); | 544 properties->address.ReplaceValue(kRequestPasskeyAddress); |
545 properties->bluetooth_class.ReplaceValue(kWeirdDeviceClass); | 545 properties->bluetooth_class.ReplaceValue(kRequestPasskeyClass); |
546 properties->name.ReplaceValue("Fake Weird Device"); | 546 properties->name.ReplaceValue("RequestPasskey"); |
547 properties->alias.ReplaceValue(kWeirdDeviceName); | 547 properties->alias.ReplaceValue(kRequestPasskeyName); |
548 | 548 |
549 } else if (device_path == dbus::ObjectPath(kUnconnectableDevicePath)) { | 549 } else if (device_path == dbus::ObjectPath(kUnconnectableDevicePath)) { |
550 properties->address.ReplaceValue(kUnconnectableDeviceAddress); | 550 properties->address.ReplaceValue(kUnconnectableDeviceAddress); |
551 properties->bluetooth_class.ReplaceValue(kUnconnectableDeviceClass); | 551 properties->bluetooth_class.ReplaceValue(kUnconnectableDeviceClass); |
552 properties->name.ReplaceValue("Fake Unconnectable Device"); | 552 properties->name.ReplaceValue("UnconnectableDevice"); |
553 properties->alias.ReplaceValue(kUnconnectableDeviceName); | 553 properties->alias.ReplaceValue(kUnconnectableDeviceName); |
554 | 554 |
555 } else if (device_path == dbus::ObjectPath(kUnpairableDevicePath)) { | 555 } else if (device_path == dbus::ObjectPath(kUnpairableDevicePath)) { |
556 properties->address.ReplaceValue(kUnpairableDeviceAddress); | 556 properties->address.ReplaceValue(kUnpairableDeviceAddress); |
557 properties->bluetooth_class.ReplaceValue(kUnpairableDeviceClass); | 557 properties->bluetooth_class.ReplaceValue(kUnpairableDeviceClass); |
558 properties->name.ReplaceValue("Fake Unpairable Device"); | 558 properties->name.ReplaceValue("Fake Unpairable Device"); |
559 properties->alias.ReplaceValue(kUnpairableDeviceName); | 559 properties->alias.ReplaceValue(kUnpairableDeviceName); |
560 | 560 |
561 } else if (device_path == dbus::ObjectPath(kBoseSpeakersPath)) { | 561 } else if (device_path == dbus::ObjectPath(kJustWorksPath)) { |
562 properties->address.ReplaceValue(kBoseSpeakersAddress); | 562 properties->address.ReplaceValue(kJustWorksAddress); |
563 properties->bluetooth_class.ReplaceValue(kBoseSpeakersClass); | 563 properties->bluetooth_class.ReplaceValue(kJustWorksClass); |
564 properties->name.ReplaceValue("Fake Bose Speakers"); | 564 properties->name.ReplaceValue("JustWorks"); |
565 properties->alias.ReplaceValue(kBoseSpeakersName); | 565 properties->alias.ReplaceValue(kJustWorksName); |
566 | 566 |
567 } else { | 567 } else { |
568 NOTREACHED(); | 568 NOTREACHED(); |
569 | 569 |
570 } | 570 } |
571 | 571 |
572 properties_map_[device_path] = properties; | 572 properties_map_[device_path] = properties; |
573 device_list_.push_back(device_path); | 573 device_list_.push_back(device_path); |
574 FOR_EACH_OBSERVER(BluetoothDeviceClient::Observer, observers_, | 574 FOR_EACH_OBSERVER(BluetoothDeviceClient::Observer, observers_, |
575 DeviceAdded(device_path)); | 575 DeviceAdded(device_path)); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
613 | 613 |
614 void FakeBluetoothDeviceClient::DiscoverySimulationTimer() { | 614 void FakeBluetoothDeviceClient::DiscoverySimulationTimer() { |
615 if (!discovery_simulation_step_) | 615 if (!discovery_simulation_step_) |
616 return; | 616 return; |
617 | 617 |
618 // Timer fires every .75s, the numbers below are arbitrary to give a feel | 618 // Timer fires every .75s, the numbers below are arbitrary to give a feel |
619 // for a discovery process. | 619 // for a discovery process. |
620 VLOG(1) << "discovery simulation, step " << discovery_simulation_step_; | 620 VLOG(1) << "discovery simulation, step " << discovery_simulation_step_; |
621 if (discovery_simulation_step_ == 2) { | 621 if (discovery_simulation_step_ == 2) { |
622 CreateDevice(dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath), | 622 CreateDevice(dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath), |
623 dbus::ObjectPath(kAppleMousePath)); | 623 dbus::ObjectPath(kLegacyAutopairPath)); |
624 | 624 |
625 } else if (discovery_simulation_step_ == 4) { | 625 } else if (discovery_simulation_step_ == 4) { |
626 CreateDevice(dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath), | 626 CreateDevice(dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath), |
627 dbus::ObjectPath(kAppleKeyboardPath)); | 627 dbus::ObjectPath(kDisplayPinCodePath)); |
628 CreateDevice(dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath), | 628 CreateDevice(dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath), |
629 dbus::ObjectPath(kVanishingDevicePath)); | 629 dbus::ObjectPath(kVanishingDevicePath)); |
630 | 630 |
631 } else if (discovery_simulation_step_ == 7) { | 631 } else if (discovery_simulation_step_ == 7) { |
632 CreateDevice(dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath), | 632 CreateDevice(dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath), |
633 dbus::ObjectPath(kMicrosoftMousePath)); | 633 dbus::ObjectPath(kConnectUnpairablePath)); |
634 | 634 |
635 } else if (discovery_simulation_step_ == 8) { | 635 } else if (discovery_simulation_step_ == 8) { |
636 CreateDevice(dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath), | 636 CreateDevice(dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath), |
637 dbus::ObjectPath(kMotorolaKeyboardPath)); | 637 dbus::ObjectPath(kDisplayPasskeyPath)); |
638 CreateDevice(dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath), | 638 CreateDevice(dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath), |
639 dbus::ObjectPath(kSonyHeadphonesPath)); | 639 dbus::ObjectPath(kRequestPinCodePath)); |
640 | 640 |
641 } else if (discovery_simulation_step_ == 10) { | 641 } else if (discovery_simulation_step_ == 10) { |
642 CreateDevice(dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath), | 642 CreateDevice(dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath), |
643 dbus::ObjectPath(kPhonePath)); | 643 dbus::ObjectPath(kConfirmPasskeyPath)); |
644 CreateDevice(dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath), | 644 CreateDevice(dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath), |
645 dbus::ObjectPath(kWeirdDevicePath)); | 645 dbus::ObjectPath(kRequestPasskeyPath)); |
646 CreateDevice(dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath), | 646 CreateDevice(dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath), |
647 dbus::ObjectPath(kUnconnectableDevicePath)); | 647 dbus::ObjectPath(kUnconnectableDevicePath)); |
648 CreateDevice(dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath), | 648 CreateDevice(dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath), |
649 dbus::ObjectPath(kUnpairableDevicePath)); | 649 dbus::ObjectPath(kUnpairableDevicePath)); |
650 CreateDevice(dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath), | 650 CreateDevice(dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath), |
651 dbus::ObjectPath(kBoseSpeakersPath)); | 651 dbus::ObjectPath(kJustWorksPath)); |
652 | 652 |
653 } else if (discovery_simulation_step_ == 13) { | 653 } else if (discovery_simulation_step_ == 13) { |
654 RemoveDevice(dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath), | 654 RemoveDevice(dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath), |
655 dbus::ObjectPath(kVanishingDevicePath)); | 655 dbus::ObjectPath(kVanishingDevicePath)); |
656 | 656 |
657 } else if (discovery_simulation_step_ == 14) { | 657 } else if (discovery_simulation_step_ == 14) { |
658 return; | 658 return; |
659 | 659 |
660 } | 660 } |
661 | 661 |
662 ++discovery_simulation_step_; | 662 ++discovery_simulation_step_; |
663 base::MessageLoop::current()->PostDelayedTask( | 663 base::MessageLoop::current()->PostDelayedTask( |
664 FROM_HERE, | 664 FROM_HERE, |
665 base::Bind(&FakeBluetoothDeviceClient::DiscoverySimulationTimer, | 665 base::Bind(&FakeBluetoothDeviceClient::DiscoverySimulationTimer, |
666 base::Unretained(this)), | 666 base::Unretained(this)), |
667 base::TimeDelta::FromMilliseconds(simulation_interval_ms_)); | 667 base::TimeDelta::FromMilliseconds(simulation_interval_ms_)); |
668 } | 668 } |
669 | 669 |
670 void FakeBluetoothDeviceClient::IncomingPairingSimulationTimer() { | 670 void FakeBluetoothDeviceClient::IncomingPairingSimulationTimer() { |
671 if (!incoming_pairing_simulation_step_) | 671 if (!incoming_pairing_simulation_step_) |
672 return; | 672 return; |
673 | 673 |
674 VLOG(1) << "incoming pairing simulation, step " | 674 VLOG(1) << "incoming pairing simulation, step " |
675 << incoming_pairing_simulation_step_; | 675 << incoming_pairing_simulation_step_; |
676 switch (incoming_pairing_simulation_step_) { | 676 switch (incoming_pairing_simulation_step_) { |
677 case 1: | 677 case 1: |
678 CreateDevice(dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath), | 678 CreateDevice(dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath), |
679 dbus::ObjectPath(kPhonePath)); | 679 dbus::ObjectPath(kConfirmPasskeyPath)); |
680 SimulatePairing(dbus::ObjectPath(kPhonePath), true, | 680 SimulatePairing(dbus::ObjectPath(kConfirmPasskeyPath), true, |
681 base::Bind(&base::DoNothing), | 681 base::Bind(&base::DoNothing), |
682 base::Bind(&SimpleErrorCallback)); | 682 base::Bind(&SimpleErrorCallback)); |
683 break; | 683 break; |
684 case 2: | 684 case 2: |
685 CreateDevice(dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath), | 685 CreateDevice(dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath), |
686 dbus::ObjectPath(kBoseSpeakersPath)); | 686 dbus::ObjectPath(kJustWorksPath)); |
687 SimulatePairing(dbus::ObjectPath(kBoseSpeakersPath), true, | 687 SimulatePairing(dbus::ObjectPath(kJustWorksPath), true, |
688 base::Bind(&base::DoNothing), | 688 base::Bind(&base::DoNothing), |
689 base::Bind(&SimpleErrorCallback)); | 689 base::Bind(&SimpleErrorCallback)); |
690 break; | 690 break; |
691 case 3: | 691 case 3: |
692 CreateDevice(dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath), | 692 CreateDevice(dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath), |
693 dbus::ObjectPath(kAppleKeyboardPath)); | 693 dbus::ObjectPath(kDisplayPinCodePath)); |
694 SimulatePairing(dbus::ObjectPath(kAppleKeyboardPath), true, | 694 SimulatePairing(dbus::ObjectPath(kDisplayPinCodePath), true, |
695 base::Bind(&base::DoNothing), | 695 base::Bind(&base::DoNothing), |
696 base::Bind(&SimpleErrorCallback)); | 696 base::Bind(&SimpleErrorCallback)); |
697 break; | 697 break; |
698 case 4: | 698 case 4: |
699 CreateDevice(dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath), | 699 CreateDevice(dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath), |
700 dbus::ObjectPath(kMotorolaKeyboardPath)); | 700 dbus::ObjectPath(kDisplayPasskeyPath)); |
701 SimulatePairing(dbus::ObjectPath(kMotorolaKeyboardPath), true, | 701 SimulatePairing(dbus::ObjectPath(kDisplayPasskeyPath), true, |
702 base::Bind(&base::DoNothing), | 702 base::Bind(&base::DoNothing), |
703 base::Bind(&SimpleErrorCallback)); | 703 base::Bind(&SimpleErrorCallback)); |
704 break; | 704 break; |
705 case 5: | 705 case 5: |
706 CreateDevice(dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath), | 706 CreateDevice(dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath), |
707 dbus::ObjectPath(kSonyHeadphonesPath)); | 707 dbus::ObjectPath(kRequestPinCodePath)); |
708 SimulatePairing(dbus::ObjectPath(kSonyHeadphonesPath), true, | 708 SimulatePairing(dbus::ObjectPath(kRequestPinCodePath), true, |
709 base::Bind(&base::DoNothing), | 709 base::Bind(&base::DoNothing), |
710 base::Bind(&SimpleErrorCallback)); | 710 base::Bind(&SimpleErrorCallback)); |
711 break; | 711 break; |
712 case 6: | 712 case 6: |
713 CreateDevice(dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath), | 713 CreateDevice(dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath), |
714 dbus::ObjectPath(kWeirdDevicePath)); | 714 dbus::ObjectPath(kRequestPasskeyPath)); |
715 SimulatePairing(dbus::ObjectPath(kWeirdDevicePath), true, | 715 SimulatePairing(dbus::ObjectPath(kRequestPasskeyPath), true, |
716 base::Bind(&base::DoNothing), | 716 base::Bind(&base::DoNothing), |
717 base::Bind(&SimpleErrorCallback)); | 717 base::Bind(&SimpleErrorCallback)); |
718 break; | 718 break; |
719 default: | 719 default: |
720 return; | 720 return; |
721 } | 721 } |
722 | 722 |
723 ++incoming_pairing_simulation_step_; | 723 ++incoming_pairing_simulation_step_; |
724 base::MessageLoop::current()->PostDelayedTask( | 724 base::MessageLoop::current()->PostDelayedTask( |
725 FROM_HERE, | 725 FROM_HERE, |
726 base::Bind(&FakeBluetoothDeviceClient::IncomingPairingSimulationTimer, | 726 base::Bind(&FakeBluetoothDeviceClient::IncomingPairingSimulationTimer, |
727 base::Unretained(this)), | 727 base::Unretained(this)), |
728 base::TimeDelta::FromMilliseconds(45 * simulation_interval_ms_)); | 728 base::TimeDelta::FromMilliseconds(45 * simulation_interval_ms_)); |
729 } | 729 } |
730 | 730 |
731 void FakeBluetoothDeviceClient::SimulatePairing( | 731 void FakeBluetoothDeviceClient::SimulatePairing( |
732 const dbus::ObjectPath& object_path, | 732 const dbus::ObjectPath& object_path, |
733 bool incoming_request, | 733 bool incoming_request, |
734 const base::Closure& callback, | 734 const base::Closure& callback, |
735 const ErrorCallback& error_callback) { | 735 const ErrorCallback& error_callback) { |
736 pairing_cancelled_ = false; | 736 pairing_cancelled_ = false; |
737 | 737 |
738 FakeBluetoothAgentManagerClient* fake_bluetooth_agent_manager_client = | 738 FakeBluetoothAgentManagerClient* fake_bluetooth_agent_manager_client = |
739 static_cast<FakeBluetoothAgentManagerClient*>( | 739 static_cast<FakeBluetoothAgentManagerClient*>( |
740 DBusThreadManager::Get()->GetBluetoothAgentManagerClient()); | 740 DBusThreadManager::Get()->GetBluetoothAgentManagerClient()); |
741 FakeBluetoothAgentServiceProvider* agent_service_provider = | 741 FakeBluetoothAgentServiceProvider* agent_service_provider = |
742 fake_bluetooth_agent_manager_client->GetAgentServiceProvider(); | 742 fake_bluetooth_agent_manager_client->GetAgentServiceProvider(); |
743 CHECK(agent_service_provider != NULL); | 743 CHECK(agent_service_provider != NULL); |
744 | 744 |
745 if (object_path == dbus::ObjectPath(kAppleMousePath) || | 745 if (object_path == dbus::ObjectPath(kLegacyAutopairPath) || |
746 object_path == dbus::ObjectPath(kMicrosoftMousePath) || | 746 object_path == dbus::ObjectPath(kConnectUnpairablePath) || |
747 object_path == dbus::ObjectPath(kUnconnectableDevicePath)) { | 747 object_path == dbus::ObjectPath(kUnconnectableDevicePath)) { |
748 // No need to call anything on the pairing delegate, just wait 3 times | 748 // No need to call anything on the pairing delegate, just wait 3 times |
749 // the interval before acting as if the other end accepted it. | 749 // the interval before acting as if the other end accepted it. |
750 base::MessageLoop::current()->PostDelayedTask( | 750 base::MessageLoop::current()->PostDelayedTask( |
751 FROM_HERE, | 751 FROM_HERE, |
752 base::Bind(&FakeBluetoothDeviceClient::CompleteSimulatedPairing, | 752 base::Bind(&FakeBluetoothDeviceClient::CompleteSimulatedPairing, |
753 base::Unretained(this), | 753 base::Unretained(this), |
754 object_path, callback, error_callback), | 754 object_path, callback, error_callback), |
755 base::TimeDelta::FromMilliseconds(3 * simulation_interval_ms_)); | 755 base::TimeDelta::FromMilliseconds(3 * simulation_interval_ms_)); |
756 | 756 |
757 } else if (object_path == dbus::ObjectPath(kAppleKeyboardPath)) { | 757 } else if (object_path == dbus::ObjectPath(kDisplayPinCodePath)) { |
758 // Display a Pincode, and wait 7 times the interval before acting as | 758 // Display a Pincode, and wait 7 times the interval before acting as |
759 // if the other end accepted it. | 759 // if the other end accepted it. |
760 agent_service_provider->DisplayPinCode(object_path, "123456"); | 760 agent_service_provider->DisplayPinCode(object_path, "123456"); |
761 | 761 |
762 base::MessageLoop::current()->PostDelayedTask( | 762 base::MessageLoop::current()->PostDelayedTask( |
763 FROM_HERE, | 763 FROM_HERE, |
764 base::Bind(&FakeBluetoothDeviceClient::CompleteSimulatedPairing, | 764 base::Bind(&FakeBluetoothDeviceClient::CompleteSimulatedPairing, |
765 base::Unretained(this), | 765 base::Unretained(this), |
766 object_path, callback, error_callback), | 766 object_path, callback, error_callback), |
767 base::TimeDelta::FromMilliseconds(7 * simulation_interval_ms_)); | 767 base::TimeDelta::FromMilliseconds(7 * simulation_interval_ms_)); |
768 | 768 |
769 } else if (object_path == dbus::ObjectPath(kVanishingDevicePath)) { | 769 } else if (object_path == dbus::ObjectPath(kVanishingDevicePath)) { |
770 // The vanishing device simulates being too far away, and thus times out. | 770 // The vanishing device simulates being too far away, and thus times out. |
771 base::MessageLoop::current()->PostDelayedTask( | 771 base::MessageLoop::current()->PostDelayedTask( |
772 FROM_HERE, | 772 FROM_HERE, |
773 base::Bind(&FakeBluetoothDeviceClient::TimeoutSimulatedPairing, | 773 base::Bind(&FakeBluetoothDeviceClient::TimeoutSimulatedPairing, |
774 base::Unretained(this), | 774 base::Unretained(this), |
775 object_path, error_callback), | 775 object_path, error_callback), |
776 base::TimeDelta::FromMilliseconds(4 * simulation_interval_ms_)); | 776 base::TimeDelta::FromMilliseconds(4 * simulation_interval_ms_)); |
777 | 777 |
778 } else if (object_path == dbus::ObjectPath(kMotorolaKeyboardPath)) { | 778 } else if (object_path == dbus::ObjectPath(kDisplayPasskeyPath)) { |
779 // Display a passkey, and each interval act as if another key was entered | 779 // Display a passkey, and each interval act as if another key was entered |
780 // for it. | 780 // for it. |
781 agent_service_provider->DisplayPasskey(object_path, 123456, 0); | 781 agent_service_provider->DisplayPasskey(object_path, 123456, 0); |
782 | 782 |
783 base::MessageLoop::current()->PostDelayedTask( | 783 base::MessageLoop::current()->PostDelayedTask( |
784 FROM_HERE, | 784 FROM_HERE, |
785 base::Bind(&FakeBluetoothDeviceClient::SimulateKeypress, | 785 base::Bind(&FakeBluetoothDeviceClient::SimulateKeypress, |
786 base::Unretained(this), | 786 base::Unretained(this), |
787 1, object_path, callback, error_callback), | 787 1, object_path, callback, error_callback), |
788 base::TimeDelta::FromMilliseconds(simulation_interval_ms_)); | 788 base::TimeDelta::FromMilliseconds(simulation_interval_ms_)); |
789 | 789 |
790 } else if (object_path == dbus::ObjectPath(kSonyHeadphonesPath)) { | 790 } else if (object_path == dbus::ObjectPath(kRequestPinCodePath)) { |
791 // Request a Pincode. | 791 // Request a Pincode. |
792 agent_service_provider->RequestPinCode( | 792 agent_service_provider->RequestPinCode( |
793 object_path, | 793 object_path, |
794 base::Bind(&FakeBluetoothDeviceClient::PinCodeCallback, | 794 base::Bind(&FakeBluetoothDeviceClient::PinCodeCallback, |
795 base::Unretained(this), | 795 base::Unretained(this), |
796 object_path, | 796 object_path, |
797 callback, | 797 callback, |
798 error_callback)); | 798 error_callback)); |
799 | 799 |
800 } else if (object_path == dbus::ObjectPath(kPhonePath)) { | 800 } else if (object_path == dbus::ObjectPath(kConfirmPasskeyPath)) { |
801 // Request confirmation of a Passkey. | 801 // Request confirmation of a Passkey. |
802 agent_service_provider->RequestConfirmation( | 802 agent_service_provider->RequestConfirmation( |
803 object_path, 123456, | 803 object_path, 123456, |
804 base::Bind(&FakeBluetoothDeviceClient::ConfirmationCallback, | 804 base::Bind(&FakeBluetoothDeviceClient::ConfirmationCallback, |
805 base::Unretained(this), | 805 base::Unretained(this), |
806 object_path, | 806 object_path, |
807 callback, | 807 callback, |
808 error_callback)); | 808 error_callback)); |
809 | 809 |
810 } else if (object_path == dbus::ObjectPath(kWeirdDevicePath)) { | 810 } else if (object_path == dbus::ObjectPath(kRequestPasskeyPath)) { |
811 // Request a Passkey from the user. | 811 // Request a Passkey from the user. |
812 agent_service_provider->RequestPasskey( | 812 agent_service_provider->RequestPasskey( |
813 object_path, | 813 object_path, |
814 base::Bind(&FakeBluetoothDeviceClient::PasskeyCallback, | 814 base::Bind(&FakeBluetoothDeviceClient::PasskeyCallback, |
815 base::Unretained(this), | 815 base::Unretained(this), |
816 object_path, | 816 object_path, |
817 callback, | 817 callback, |
818 error_callback)); | 818 error_callback)); |
819 | 819 |
820 } else if (object_path == dbus::ObjectPath(kUnpairableDevicePath)) { | 820 } else if (object_path == dbus::ObjectPath(kUnpairableDevicePath)) { |
821 // Fails the pairing with an org.bluez.Error.Failed error. | 821 // Fails the pairing with an org.bluez.Error.Failed error. |
822 base::MessageLoop::current()->PostDelayedTask( | 822 base::MessageLoop::current()->PostDelayedTask( |
823 FROM_HERE, | 823 FROM_HERE, |
824 base::Bind(&FakeBluetoothDeviceClient::FailSimulatedPairing, | 824 base::Bind(&FakeBluetoothDeviceClient::FailSimulatedPairing, |
825 base::Unretained(this), | 825 base::Unretained(this), |
826 object_path, error_callback), | 826 object_path, error_callback), |
827 base::TimeDelta::FromMilliseconds(simulation_interval_ms_)); | 827 base::TimeDelta::FromMilliseconds(simulation_interval_ms_)); |
828 | 828 |
829 } else if (object_path == dbus::ObjectPath(kBoseSpeakersPath)) { | 829 } else if (object_path == dbus::ObjectPath(kJustWorksPath)) { |
830 if (incoming_request) { | 830 if (incoming_request) { |
831 agent_service_provider->RequestAuthorization( | 831 agent_service_provider->RequestAuthorization( |
832 object_path, | 832 object_path, |
833 base::Bind(&FakeBluetoothDeviceClient::ConfirmationCallback, | 833 base::Bind(&FakeBluetoothDeviceClient::ConfirmationCallback, |
834 base::Unretained(this), | 834 base::Unretained(this), |
835 object_path, | 835 object_path, |
836 callback, | 836 callback, |
837 error_callback)); | 837 error_callback)); |
838 | 838 |
839 } else { | 839 } else { |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1093 // TODO(keybuk): tear down this side of the connection | 1093 // TODO(keybuk): tear down this side of the connection |
1094 callback.Run(); | 1094 callback.Run(); |
1095 } else if (status == BluetoothProfileServiceProvider::Delegate::CANCELLED) { | 1095 } else if (status == BluetoothProfileServiceProvider::Delegate::CANCELLED) { |
1096 error_callback.Run(bluetooth_device::kErrorFailed, "Canceled"); | 1096 error_callback.Run(bluetooth_device::kErrorFailed, "Canceled"); |
1097 } else if (status == BluetoothProfileServiceProvider::Delegate::REJECTED) { | 1097 } else if (status == BluetoothProfileServiceProvider::Delegate::REJECTED) { |
1098 error_callback.Run(bluetooth_device::kErrorFailed, "Rejected"); | 1098 error_callback.Run(bluetooth_device::kErrorFailed, "Rejected"); |
1099 } | 1099 } |
1100 } | 1100 } |
1101 | 1101 |
1102 } // namespace chromeos | 1102 } // namespace chromeos |
OLD | NEW |