OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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/bluetooth_device.h" | 5 #include "device/bluetooth/bluetooth_device.h" |
6 | 6 |
7 #include <iterator> | 7 #include <iterator> |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 | 267 |
268 // Get the vendor part of the address: "00:11:22" for "00:11:22:33:44:55" | 268 // Get the vendor part of the address: "00:11:22" for "00:11:22:33:44:55" |
269 std::string vendor = GetAddress().substr(0, 8); | 269 std::string vendor = GetAddress().substr(0, 8); |
270 | 270 |
271 // Verbatim "Bluetooth Mouse", model 96674 | 271 // Verbatim "Bluetooth Mouse", model 96674 |
272 if (type == BluetoothDeviceType::MOUSE && vendor == "00:12:A1") | 272 if (type == BluetoothDeviceType::MOUSE && vendor == "00:12:A1") |
273 return false; | 273 return false; |
274 // Microsoft "Microsoft Bluetooth Notebook Mouse 5000", model X807028-001 | 274 // Microsoft "Microsoft Bluetooth Notebook Mouse 5000", model X807028-001 |
275 if (type == BluetoothDeviceType::MOUSE && vendor == "7C:ED:8D") | 275 if (type == BluetoothDeviceType::MOUSE && vendor == "7C:ED:8D") |
276 return false; | 276 return false; |
277 // Sony PlayStation Dualshock3 | |
278 if (IsTrustable()) | |
279 return false; | |
280 | 277 |
281 // TODO: Move this database into a config file. | 278 // TODO: Move this database into a config file. |
282 | 279 |
283 return true; | 280 return true; |
284 } | 281 } |
285 | 282 |
286 bool BluetoothDevice::IsTrustable() const { | |
287 // Sony PlayStation Dualshock3 | |
288 if ((GetVendorID() == 0x054c && GetProductID() == 0x0268 && | |
289 GetName() == std::string("PLAYSTATION(R)3 Controller"))) | |
290 return true; | |
291 | |
292 return false; | |
293 } | |
294 | |
295 BluetoothDevice::UUIDSet BluetoothDevice::GetUUIDs() const { | 283 BluetoothDevice::UUIDSet BluetoothDevice::GetUUIDs() const { |
296 return device_uuids_.GetUUIDs(); | 284 return device_uuids_.GetUUIDs(); |
297 } | 285 } |
298 | 286 |
299 const BluetoothDevice::ServiceDataMap& BluetoothDevice::GetServiceData() const { | 287 const BluetoothDevice::ServiceDataMap& BluetoothDevice::GetServiceData() const { |
300 return service_data_; | 288 return service_data_; |
301 } | 289 } |
302 | 290 |
303 BluetoothDevice::UUIDSet BluetoothDevice::GetServiceDataUUIDs() const { | 291 BluetoothDevice::UUIDSet BluetoothDevice::GetServiceDataUUIDs() const { |
304 UUIDSet service_data_uuids; | 292 UUIDSet service_data_uuids; |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
590 if (power < INT8_MIN) { | 578 if (power < INT8_MIN) { |
591 return INT8_MIN; | 579 return INT8_MIN; |
592 } | 580 } |
593 if (power > INT8_MAX) { | 581 if (power > INT8_MAX) { |
594 return INT8_MAX; | 582 return INT8_MAX; |
595 } | 583 } |
596 return static_cast<int8_t>(power); | 584 return static_cast<int8_t>(power); |
597 } | 585 } |
598 | 586 |
599 } // namespace device | 587 } // namespace device |
OLD | NEW |