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 "device/bluetooth/dbus/fake_bluetooth_device_client.h" | 5 #include "device/bluetooth/dbus/fake_bluetooth_device_client.h" |
6 | 6 |
7 #include <fcntl.h> | 7 #include <fcntl.h> |
| 8 #include <stddef.h> |
8 #include <sys/socket.h> | 9 #include <sys/socket.h> |
9 #include <sys/types.h> | 10 #include <sys/types.h> |
10 #include <unistd.h> | 11 #include <unistd.h> |
11 | 12 |
12 #include <algorithm> | 13 #include <algorithm> |
13 #include <string> | 14 #include <string> |
14 #include <utility> | 15 #include <utility> |
15 | 16 |
16 #include "base/location.h" | 17 #include "base/location.h" |
17 #include "base/logging.h" | 18 #include "base/logging.h" |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 const char FakeBluetoothDeviceClient::kPairingActionConfirmation[] = | 107 const char FakeBluetoothDeviceClient::kPairingActionConfirmation[] = |
107 "Confirmation"; | 108 "Confirmation"; |
108 const char FakeBluetoothDeviceClient::kPairingActionDisplay[] = "Display"; | 109 const char FakeBluetoothDeviceClient::kPairingActionDisplay[] = "Display"; |
109 const char FakeBluetoothDeviceClient::kPairingActionFail[] = "Fail"; | 110 const char FakeBluetoothDeviceClient::kPairingActionFail[] = "Fail"; |
110 const char FakeBluetoothDeviceClient::kPairingActionRequest[] = "Request"; | 111 const char FakeBluetoothDeviceClient::kPairingActionRequest[] = "Request"; |
111 | 112 |
112 const char FakeBluetoothDeviceClient::kPairedDevicePath[] = "/fake/hci0/dev0"; | 113 const char FakeBluetoothDeviceClient::kPairedDevicePath[] = "/fake/hci0/dev0"; |
113 const char FakeBluetoothDeviceClient::kPairedDeviceAddress[] = | 114 const char FakeBluetoothDeviceClient::kPairedDeviceAddress[] = |
114 "00:11:22:33:44:55"; | 115 "00:11:22:33:44:55"; |
115 const char FakeBluetoothDeviceClient::kPairedDeviceName[] = "Fake Device"; | 116 const char FakeBluetoothDeviceClient::kPairedDeviceName[] = "Fake Device"; |
116 const uint32 FakeBluetoothDeviceClient::kPairedDeviceClass = 0x000104; | 117 const uint32_t FakeBluetoothDeviceClient::kPairedDeviceClass = 0x000104; |
117 | 118 |
118 const char FakeBluetoothDeviceClient::kLegacyAutopairPath[] = "/fake/hci0/dev1"; | 119 const char FakeBluetoothDeviceClient::kLegacyAutopairPath[] = "/fake/hci0/dev1"; |
119 const char FakeBluetoothDeviceClient::kLegacyAutopairAddress[] = | 120 const char FakeBluetoothDeviceClient::kLegacyAutopairAddress[] = |
120 "28:CF:DA:00:00:00"; | 121 "28:CF:DA:00:00:00"; |
121 const char FakeBluetoothDeviceClient::kLegacyAutopairName[] = | 122 const char FakeBluetoothDeviceClient::kLegacyAutopairName[] = |
122 "Bluetooth 2.0 Mouse"; | 123 "Bluetooth 2.0 Mouse"; |
123 const uint32 FakeBluetoothDeviceClient::kLegacyAutopairClass = 0x002580; | 124 const uint32_t FakeBluetoothDeviceClient::kLegacyAutopairClass = 0x002580; |
124 | 125 |
125 const char FakeBluetoothDeviceClient::kDisplayPinCodePath[] = "/fake/hci0/dev2"; | 126 const char FakeBluetoothDeviceClient::kDisplayPinCodePath[] = "/fake/hci0/dev2"; |
126 const char FakeBluetoothDeviceClient::kDisplayPinCodeAddress[] = | 127 const char FakeBluetoothDeviceClient::kDisplayPinCodeAddress[] = |
127 "28:37:37:00:00:00"; | 128 "28:37:37:00:00:00"; |
128 const char FakeBluetoothDeviceClient::kDisplayPinCodeName[] = | 129 const char FakeBluetoothDeviceClient::kDisplayPinCodeName[] = |
129 "Bluetooth 2.0 Keyboard"; | 130 "Bluetooth 2.0 Keyboard"; |
130 const uint32 FakeBluetoothDeviceClient::kDisplayPinCodeClass = 0x002540; | 131 const uint32_t FakeBluetoothDeviceClient::kDisplayPinCodeClass = 0x002540; |
131 | 132 |
132 const char FakeBluetoothDeviceClient::kVanishingDevicePath[] = | 133 const char FakeBluetoothDeviceClient::kVanishingDevicePath[] = |
133 "/fake/hci0/dev3"; | 134 "/fake/hci0/dev3"; |
134 const char FakeBluetoothDeviceClient::kVanishingDeviceAddress[] = | 135 const char FakeBluetoothDeviceClient::kVanishingDeviceAddress[] = |
135 "01:02:03:04:05:06"; | 136 "01:02:03:04:05:06"; |
136 const char FakeBluetoothDeviceClient::kVanishingDeviceName[] = | 137 const char FakeBluetoothDeviceClient::kVanishingDeviceName[] = |
137 "Vanishing Device"; | 138 "Vanishing Device"; |
138 const uint32 FakeBluetoothDeviceClient::kVanishingDeviceClass = 0x000104; | 139 const uint32_t FakeBluetoothDeviceClient::kVanishingDeviceClass = 0x000104; |
139 | 140 |
140 const char FakeBluetoothDeviceClient::kConnectUnpairablePath[] = | 141 const char FakeBluetoothDeviceClient::kConnectUnpairablePath[] = |
141 "/fake/hci0/dev4"; | 142 "/fake/hci0/dev4"; |
142 const char FakeBluetoothDeviceClient::kConnectUnpairableAddress[] = | 143 const char FakeBluetoothDeviceClient::kConnectUnpairableAddress[] = |
143 "7C:ED:8D:00:00:00"; | 144 "7C:ED:8D:00:00:00"; |
144 const char FakeBluetoothDeviceClient::kConnectUnpairableName[] = | 145 const char FakeBluetoothDeviceClient::kConnectUnpairableName[] = |
145 "Unpairable Device"; | 146 "Unpairable Device"; |
146 const uint32 FakeBluetoothDeviceClient::kConnectUnpairableClass = 0x002580; | 147 const uint32_t FakeBluetoothDeviceClient::kConnectUnpairableClass = 0x002580; |
147 | 148 |
148 const char FakeBluetoothDeviceClient::kDisplayPasskeyPath[] = "/fake/hci0/dev5"; | 149 const char FakeBluetoothDeviceClient::kDisplayPasskeyPath[] = "/fake/hci0/dev5"; |
149 const char FakeBluetoothDeviceClient::kDisplayPasskeyAddress[] = | 150 const char FakeBluetoothDeviceClient::kDisplayPasskeyAddress[] = |
150 "00:0F:F6:00:00:00"; | 151 "00:0F:F6:00:00:00"; |
151 const char FakeBluetoothDeviceClient::kDisplayPasskeyName[] = | 152 const char FakeBluetoothDeviceClient::kDisplayPasskeyName[] = |
152 "Bluetooth 2.1+ Keyboard"; | 153 "Bluetooth 2.1+ Keyboard"; |
153 const uint32 FakeBluetoothDeviceClient::kDisplayPasskeyClass = 0x002540; | 154 const uint32_t FakeBluetoothDeviceClient::kDisplayPasskeyClass = 0x002540; |
154 | 155 |
155 const char FakeBluetoothDeviceClient::kRequestPinCodePath[] = "/fake/hci0/dev6"; | 156 const char FakeBluetoothDeviceClient::kRequestPinCodePath[] = "/fake/hci0/dev6"; |
156 const char FakeBluetoothDeviceClient::kRequestPinCodeAddress[] = | 157 const char FakeBluetoothDeviceClient::kRequestPinCodeAddress[] = |
157 "00:24:BE:00:00:00"; | 158 "00:24:BE:00:00:00"; |
158 const char FakeBluetoothDeviceClient::kRequestPinCodeName[] = "PIN Device"; | 159 const char FakeBluetoothDeviceClient::kRequestPinCodeName[] = "PIN Device"; |
159 const uint32 FakeBluetoothDeviceClient::kRequestPinCodeClass = 0x240408; | 160 const uint32_t FakeBluetoothDeviceClient::kRequestPinCodeClass = 0x240408; |
160 | 161 |
161 const char FakeBluetoothDeviceClient::kConfirmPasskeyPath[] = "/fake/hci0/dev7"; | 162 const char FakeBluetoothDeviceClient::kConfirmPasskeyPath[] = "/fake/hci0/dev7"; |
162 const char FakeBluetoothDeviceClient::kConfirmPasskeyAddress[] = | 163 const char FakeBluetoothDeviceClient::kConfirmPasskeyAddress[] = |
163 "20:7D:74:00:00:00"; | 164 "20:7D:74:00:00:00"; |
164 const char FakeBluetoothDeviceClient::kConfirmPasskeyName[] = "Phone"; | 165 const char FakeBluetoothDeviceClient::kConfirmPasskeyName[] = "Phone"; |
165 const uint32 FakeBluetoothDeviceClient::kConfirmPasskeyClass = 0x7a020c; | 166 const uint32_t FakeBluetoothDeviceClient::kConfirmPasskeyClass = 0x7a020c; |
166 | 167 |
167 const char FakeBluetoothDeviceClient::kRequestPasskeyPath[] = "/fake/hci0/dev8"; | 168 const char FakeBluetoothDeviceClient::kRequestPasskeyPath[] = "/fake/hci0/dev8"; |
168 const char FakeBluetoothDeviceClient::kRequestPasskeyAddress[] = | 169 const char FakeBluetoothDeviceClient::kRequestPasskeyAddress[] = |
169 "20:7D:74:00:00:01"; | 170 "20:7D:74:00:00:01"; |
170 const char FakeBluetoothDeviceClient::kRequestPasskeyName[] = "Passkey Device"; | 171 const char FakeBluetoothDeviceClient::kRequestPasskeyName[] = "Passkey Device"; |
171 const uint32 FakeBluetoothDeviceClient::kRequestPasskeyClass = 0x7a020c; | 172 const uint32_t FakeBluetoothDeviceClient::kRequestPasskeyClass = 0x7a020c; |
172 | 173 |
173 const char FakeBluetoothDeviceClient::kUnconnectableDevicePath[] = | 174 const char FakeBluetoothDeviceClient::kUnconnectableDevicePath[] = |
174 "/fake/hci0/dev9"; | 175 "/fake/hci0/dev9"; |
175 const char FakeBluetoothDeviceClient::kUnconnectableDeviceAddress[] = | 176 const char FakeBluetoothDeviceClient::kUnconnectableDeviceAddress[] = |
176 "20:7D:74:00:00:02"; | 177 "20:7D:74:00:00:02"; |
177 const char FakeBluetoothDeviceClient::kUnconnectableDeviceName[] = | 178 const char FakeBluetoothDeviceClient::kUnconnectableDeviceName[] = |
178 "Unconnectable Device"; | 179 "Unconnectable Device"; |
179 const uint32 FakeBluetoothDeviceClient::kUnconnectableDeviceClass = 0x7a020c; | 180 const uint32_t FakeBluetoothDeviceClient::kUnconnectableDeviceClass = 0x7a020c; |
180 | 181 |
181 const char FakeBluetoothDeviceClient::kUnpairableDevicePath[] = | 182 const char FakeBluetoothDeviceClient::kUnpairableDevicePath[] = |
182 "/fake/hci0/devA"; | 183 "/fake/hci0/devA"; |
183 const char FakeBluetoothDeviceClient::kUnpairableDeviceAddress[] = | 184 const char FakeBluetoothDeviceClient::kUnpairableDeviceAddress[] = |
184 "20:7D:74:00:00:03"; | 185 "20:7D:74:00:00:03"; |
185 const char FakeBluetoothDeviceClient::kUnpairableDeviceName[] = | 186 const char FakeBluetoothDeviceClient::kUnpairableDeviceName[] = |
186 "Unpairable Device"; | 187 "Unpairable Device"; |
187 const uint32 FakeBluetoothDeviceClient::kUnpairableDeviceClass = 0x002540; | 188 const uint32_t FakeBluetoothDeviceClient::kUnpairableDeviceClass = 0x002540; |
188 | 189 |
189 const char FakeBluetoothDeviceClient::kJustWorksPath[] = "/fake/hci0/devB"; | 190 const char FakeBluetoothDeviceClient::kJustWorksPath[] = "/fake/hci0/devB"; |
190 const char FakeBluetoothDeviceClient::kJustWorksAddress[] = "00:0C:8A:00:00:00"; | 191 const char FakeBluetoothDeviceClient::kJustWorksAddress[] = "00:0C:8A:00:00:00"; |
191 const char FakeBluetoothDeviceClient::kJustWorksName[] = "Just-Works Device"; | 192 const char FakeBluetoothDeviceClient::kJustWorksName[] = "Just-Works Device"; |
192 const uint32 FakeBluetoothDeviceClient::kJustWorksClass = 0x240428; | 193 const uint32_t FakeBluetoothDeviceClient::kJustWorksClass = 0x240428; |
193 | 194 |
194 const char FakeBluetoothDeviceClient::kLowEnergyPath[] = "/fake/hci0/devC"; | 195 const char FakeBluetoothDeviceClient::kLowEnergyPath[] = "/fake/hci0/devC"; |
195 const char FakeBluetoothDeviceClient::kLowEnergyAddress[] = "00:1A:11:00:15:30"; | 196 const char FakeBluetoothDeviceClient::kLowEnergyAddress[] = "00:1A:11:00:15:30"; |
196 const char FakeBluetoothDeviceClient::kLowEnergyName[] = | 197 const char FakeBluetoothDeviceClient::kLowEnergyName[] = |
197 "Bluetooth 4.0 Heart Rate Monitor"; | 198 "Bluetooth 4.0 Heart Rate Monitor"; |
198 const uint32 FakeBluetoothDeviceClient::kLowEnergyClass = | 199 const uint32_t FakeBluetoothDeviceClient::kLowEnergyClass = |
199 0x000918; // Major class "Health", Minor class "Heart/Pulse Rate Monitor." | 200 0x000918; // Major class "Health", Minor class "Heart/Pulse Rate Monitor." |
200 | 201 |
201 const char FakeBluetoothDeviceClient::kPairedUnconnectableDevicePath[] = | 202 const char FakeBluetoothDeviceClient::kPairedUnconnectableDevicePath[] = |
202 "/fake/hci0/devD"; | 203 "/fake/hci0/devD"; |
203 const char FakeBluetoothDeviceClient::kPairedUnconnectableDeviceAddress[] = | 204 const char FakeBluetoothDeviceClient::kPairedUnconnectableDeviceAddress[] = |
204 "20:7D:74:00:00:04"; | 205 "20:7D:74:00:00:04"; |
205 const char FakeBluetoothDeviceClient::kPairedUnconnectableDeviceName[] = | 206 const char FakeBluetoothDeviceClient::kPairedUnconnectableDeviceName[] = |
206 "Paired Unconnectable Device"; | 207 "Paired Unconnectable Device"; |
207 const uint32 FakeBluetoothDeviceClient::kPairedUnconnectableDeviceClass = | 208 const uint32_t FakeBluetoothDeviceClient::kPairedUnconnectableDeviceClass = |
208 0x000104; | 209 0x000104; |
209 | 210 |
210 const char FakeBluetoothDeviceClient::kConnectedTrustedNotPairedDevicePath[] = | 211 const char FakeBluetoothDeviceClient::kConnectedTrustedNotPairedDevicePath[] = |
211 "/fake/hci0/devE"; | 212 "/fake/hci0/devE"; |
212 const char | 213 const char |
213 FakeBluetoothDeviceClient::kConnectedTrustedNotPairedDeviceAddress[] = | 214 FakeBluetoothDeviceClient::kConnectedTrustedNotPairedDeviceAddress[] = |
214 "11:22:33:44:55:66"; | 215 "11:22:33:44:55:66"; |
215 const char FakeBluetoothDeviceClient::kConnectedTrustedNotPairedDeviceName[] = | 216 const char FakeBluetoothDeviceClient::kConnectedTrustedNotPairedDeviceName[] = |
216 "Connected Pairable Device"; | 217 "Connected Pairable Device"; |
217 const uint32 FakeBluetoothDeviceClient::kConnectedTrustedNotPairedDeviceClass = | 218 const uint32_t |
218 0x7a020c; | 219 FakeBluetoothDeviceClient::kConnectedTrustedNotPairedDeviceClass = 0x7a020c; |
219 | 220 |
220 FakeBluetoothDeviceClient::Properties::Properties( | 221 FakeBluetoothDeviceClient::Properties::Properties( |
221 const PropertyChangedCallback& callback) | 222 const PropertyChangedCallback& callback) |
222 : BluetoothDeviceClient::Properties( | 223 : BluetoothDeviceClient::Properties( |
223 NULL, | 224 NULL, |
224 bluetooth_device::kBluetoothDeviceInterface, | 225 bluetooth_device::kBluetoothDeviceInterface, |
225 callback) {} | 226 callback) {} |
226 | 227 |
227 FakeBluetoothDeviceClient::Properties::~Properties() {} | 228 FakeBluetoothDeviceClient::Properties::~Properties() {} |
228 | 229 |
(...skipping 1206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1435 FakeBluetoothInputClient* fake_bluetooth_input_client = | 1436 FakeBluetoothInputClient* fake_bluetooth_input_client = |
1436 static_cast<FakeBluetoothInputClient*>( | 1437 static_cast<FakeBluetoothInputClient*>( |
1437 bluez::BluezDBusManager::Get()->GetBluetoothInputClient()); | 1438 bluez::BluezDBusManager::Get()->GetBluetoothInputClient()); |
1438 | 1439 |
1439 if ((properties->bluetooth_class.value() & 0x001f03) == 0x000500) | 1440 if ((properties->bluetooth_class.value() & 0x001f03) == 0x000500) |
1440 fake_bluetooth_input_client->AddInputDevice(object_path); | 1441 fake_bluetooth_input_client->AddInputDevice(object_path); |
1441 } | 1442 } |
1442 | 1443 |
1443 void FakeBluetoothDeviceClient::UpdateDeviceRSSI( | 1444 void FakeBluetoothDeviceClient::UpdateDeviceRSSI( |
1444 const dbus::ObjectPath& object_path, | 1445 const dbus::ObjectPath& object_path, |
1445 int16 rssi) { | 1446 int16_t rssi) { |
1446 PropertiesMap::const_iterator iter = properties_map_.find(object_path); | 1447 PropertiesMap::const_iterator iter = properties_map_.find(object_path); |
1447 if (iter == properties_map_.end()) { | 1448 if (iter == properties_map_.end()) { |
1448 VLOG(2) << "Fake device does not exist: " << object_path.value(); | 1449 VLOG(2) << "Fake device does not exist: " << object_path.value(); |
1449 return; | 1450 return; |
1450 } | 1451 } |
1451 Properties* properties = iter->second.get(); | 1452 Properties* properties = iter->second.get(); |
1452 DCHECK(properties); | 1453 DCHECK(properties); |
1453 properties->rssi.ReplaceValue(rssi); | 1454 properties->rssi.ReplaceValue(rssi); |
1454 } | 1455 } |
1455 | 1456 |
1456 void FakeBluetoothDeviceClient::UpdateConnectionInfo( | 1457 void FakeBluetoothDeviceClient::UpdateConnectionInfo( |
1457 uint16 connection_rssi, | 1458 uint16_t connection_rssi, |
1458 uint16 transmit_power, | 1459 uint16_t transmit_power, |
1459 uint16 max_transmit_power) { | 1460 uint16_t max_transmit_power) { |
1460 connection_rssi_ = connection_rssi; | 1461 connection_rssi_ = connection_rssi; |
1461 transmit_power_ = transmit_power; | 1462 transmit_power_ = transmit_power; |
1462 max_transmit_power_ = max_transmit_power; | 1463 max_transmit_power_ = max_transmit_power; |
1463 } | 1464 } |
1464 | 1465 |
1465 void FakeBluetoothDeviceClient::PinCodeCallback( | 1466 void FakeBluetoothDeviceClient::PinCodeCallback( |
1466 const dbus::ObjectPath& object_path, | 1467 const dbus::ObjectPath& object_path, |
1467 const base::Closure& callback, | 1468 const base::Closure& callback, |
1468 const ErrorCallback& error_callback, | 1469 const ErrorCallback& error_callback, |
1469 BluetoothAgentServiceProvider::Delegate::Status status, | 1470 BluetoothAgentServiceProvider::Delegate::Status status, |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1511 base::Unretained(this), object_path, error_callback), | 1512 base::Unretained(this), object_path, error_callback), |
1512 base::TimeDelta::FromMilliseconds(simulation_interval_ms_)); | 1513 base::TimeDelta::FromMilliseconds(simulation_interval_ms_)); |
1513 } | 1514 } |
1514 } | 1515 } |
1515 | 1516 |
1516 void FakeBluetoothDeviceClient::PasskeyCallback( | 1517 void FakeBluetoothDeviceClient::PasskeyCallback( |
1517 const dbus::ObjectPath& object_path, | 1518 const dbus::ObjectPath& object_path, |
1518 const base::Closure& callback, | 1519 const base::Closure& callback, |
1519 const ErrorCallback& error_callback, | 1520 const ErrorCallback& error_callback, |
1520 BluetoothAgentServiceProvider::Delegate::Status status, | 1521 BluetoothAgentServiceProvider::Delegate::Status status, |
1521 uint32 passkey) { | 1522 uint32_t passkey) { |
1522 VLOG(1) << "PasskeyCallback: " << object_path.value(); | 1523 VLOG(1) << "PasskeyCallback: " << object_path.value(); |
1523 | 1524 |
1524 if (status == BluetoothAgentServiceProvider::Delegate::SUCCESS) { | 1525 if (status == BluetoothAgentServiceProvider::Delegate::SUCCESS) { |
1525 PairingOptionsMap::const_iterator iter = | 1526 PairingOptionsMap::const_iterator iter = |
1526 pairing_options_map_.find(object_path); | 1527 pairing_options_map_.find(object_path); |
1527 bool success = true; | 1528 bool success = true; |
1528 | 1529 |
1529 if (iter != pairing_options_map_.end()) { | 1530 if (iter != pairing_options_map_.end()) { |
1530 success = static_cast<uint32>( | 1531 success = static_cast<uint32_t>( |
1531 std::stoi(iter->second->pairing_auth_token)) == passkey; | 1532 std::stoi(iter->second->pairing_auth_token)) == passkey; |
1532 } | 1533 } |
1533 | 1534 |
1534 if (success) { | 1535 if (success) { |
1535 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( | 1536 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
1536 FROM_HERE, | 1537 FROM_HERE, |
1537 base::Bind(&FakeBluetoothDeviceClient::CompleteSimulatedPairing, | 1538 base::Bind(&FakeBluetoothDeviceClient::CompleteSimulatedPairing, |
1538 base::Unretained(this), object_path, callback, | 1539 base::Unretained(this), object_path, callback, |
1539 error_callback), | 1540 error_callback), |
1540 base::TimeDelta::FromMilliseconds(kSimulateNormalPairTimeMultiplier * | 1541 base::TimeDelta::FromMilliseconds(kSimulateNormalPairTimeMultiplier * |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1589 } else if (status == BluetoothAgentServiceProvider::Delegate::REJECTED) { | 1590 } else if (status == BluetoothAgentServiceProvider::Delegate::REJECTED) { |
1590 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( | 1591 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
1591 FROM_HERE, | 1592 FROM_HERE, |
1592 base::Bind(&FakeBluetoothDeviceClient::RejectSimulatedPairing, | 1593 base::Bind(&FakeBluetoothDeviceClient::RejectSimulatedPairing, |
1593 base::Unretained(this), object_path, error_callback), | 1594 base::Unretained(this), object_path, error_callback), |
1594 base::TimeDelta::FromMilliseconds(simulation_interval_ms_)); | 1595 base::TimeDelta::FromMilliseconds(simulation_interval_ms_)); |
1595 } | 1596 } |
1596 } | 1597 } |
1597 | 1598 |
1598 void FakeBluetoothDeviceClient::SimulateKeypress( | 1599 void FakeBluetoothDeviceClient::SimulateKeypress( |
1599 uint16 entered, | 1600 uint16_t entered, |
1600 const dbus::ObjectPath& object_path, | 1601 const dbus::ObjectPath& object_path, |
1601 const base::Closure& callback, | 1602 const base::Closure& callback, |
1602 const ErrorCallback& error_callback) { | 1603 const ErrorCallback& error_callback) { |
1603 VLOG(1) << "SimulateKeypress " << entered << ": " << object_path.value(); | 1604 VLOG(1) << "SimulateKeypress " << entered << ": " << object_path.value(); |
1604 | 1605 |
1605 FakeBluetoothAgentManagerClient* fake_bluetooth_agent_manager_client = | 1606 FakeBluetoothAgentManagerClient* fake_bluetooth_agent_manager_client = |
1606 static_cast<FakeBluetoothAgentManagerClient*>( | 1607 static_cast<FakeBluetoothAgentManagerClient*>( |
1607 bluez::BluezDBusManager::Get()->GetBluetoothAgentManagerClient()); | 1608 bluez::BluezDBusManager::Get()->GetBluetoothAgentManagerClient()); |
1608 FakeBluetoothAgentServiceProvider* agent_service_provider = | 1609 FakeBluetoothAgentServiceProvider* agent_service_provider = |
1609 fake_bluetooth_agent_manager_client->GetAgentServiceProvider(); | 1610 fake_bluetooth_agent_manager_client->GetAgentServiceProvider(); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1661 // TODO(keybuk): tear down this side of the connection | 1662 // TODO(keybuk): tear down this side of the connection |
1662 callback.Run(); | 1663 callback.Run(); |
1663 } else if (status == BluetoothProfileServiceProvider::Delegate::CANCELLED) { | 1664 } else if (status == BluetoothProfileServiceProvider::Delegate::CANCELLED) { |
1664 error_callback.Run(bluetooth_device::kErrorFailed, "Canceled"); | 1665 error_callback.Run(bluetooth_device::kErrorFailed, "Canceled"); |
1665 } else if (status == BluetoothProfileServiceProvider::Delegate::REJECTED) { | 1666 } else if (status == BluetoothProfileServiceProvider::Delegate::REJECTED) { |
1666 error_callback.Run(bluetooth_device::kErrorFailed, "Rejected"); | 1667 error_callback.Run(bluetooth_device::kErrorFailed, "Rejected"); |
1667 } | 1668 } |
1668 } | 1669 } |
1669 | 1670 |
1670 } // namespace bluez | 1671 } // namespace bluez |
OLD | NEW |