| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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/bluez/bluetooth_adapter_bluez.h" | 5 #include "device/bluetooth/bluez/bluetooth_adapter_bluez.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 517 property_name == properties->alias.name() || | 517 property_name == properties->alias.name() || |
| 518 property_name == properties->paired.name() || | 518 property_name == properties->paired.name() || |
| 519 property_name == properties->trusted.name() || | 519 property_name == properties->trusted.name() || |
| 520 property_name == properties->connected.name() || | 520 property_name == properties->connected.name() || |
| 521 property_name == properties->uuids.name() || | 521 property_name == properties->uuids.name() || |
| 522 property_name == properties->rssi.name() || | 522 property_name == properties->rssi.name() || |
| 523 property_name == properties->tx_power.name()) { | 523 property_name == properties->tx_power.name()) { |
| 524 NotifyDeviceChanged(device_bluez); | 524 NotifyDeviceChanged(device_bluez); |
| 525 } | 525 } |
| 526 | 526 |
| 527 if (property_name == properties->gatt_services.name()) { | 527 if (property_name == properties->services_resolved.name() && |
| 528 device_bluez->SetGattServicesDiscoveryComplete(true); | 528 properties->services_resolved.value()) { |
| 529 NotifyGattServicesDiscovered(device_bluez); | 529 NotifyGattServicesDiscovered(device_bluez); |
| 530 } | 530 } |
| 531 | 531 |
| 532 // When a device becomes paired, mark it as trusted so that the user does | 532 // When a device becomes paired, mark it as trusted so that the user does |
| 533 // not need to approve every incoming connection | 533 // not need to approve every incoming connection |
| 534 if (property_name == properties->paired.name()) { | 534 if (property_name == properties->paired.name()) { |
| 535 if (properties->paired.value() && !properties->trusted.value()) { | 535 if (properties->paired.value() && !properties->trusted.value()) { |
| 536 device_bluez->SetTrusted(); | 536 device_bluez->SetTrusted(); |
| 537 } | 537 } |
| 538 NotifyDevicePairedChanged(device_bluez, properties->paired.value()); | 538 NotifyDevicePairedChanged(device_bluez, properties->paired.value()); |
| 539 } | 539 } |
| 540 | 540 |
| 541 // UMA connection counting | 541 // UMA connection counting |
| 542 if (property_name == properties->connected.name()) { | 542 if (property_name == properties->connected.name()) { |
| 543 // PlayStation joystick tries to reconnect after disconnection from USB. | 543 // PlayStation joystick tries to reconnect after disconnection from USB. |
| 544 // If it is still not trusted, set it, so it becomes available on the | 544 // If it is still not trusted, set it, so it becomes available on the |
| 545 // list of known devices. | 545 // list of known devices. |
| 546 if (properties->connected.value()) { | 546 if (properties->connected.value()) { |
| 547 if (device_bluez->IsTrustable() && !properties->trusted.value()) | 547 if (device_bluez->IsTrustable() && !properties->trusted.value()) |
| 548 device_bluez->SetTrusted(); | 548 device_bluez->SetTrusted(); |
| 549 } else { | |
| 550 device_bluez->SetGattServicesDiscoveryComplete(false); | |
| 551 } | 549 } |
| 552 | 550 |
| 553 int count = 0; | 551 int count = 0; |
| 554 | 552 |
| 555 for (DevicesMap::const_iterator iter = devices_.begin(); | 553 for (DevicesMap::const_iterator iter = devices_.begin(); |
| 556 iter != devices_.end(); ++iter) { | 554 iter != devices_.end(); ++iter) { |
| 557 if (iter->second->IsPaired() && iter->second->IsConnected()) | 555 if (iter->second->IsPaired() && iter->second->IsConnected()) |
| 558 ++count; | 556 ++count; |
| 559 } | 557 } |
| 560 | 558 |
| (...skipping 888 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1449 | 1447 |
| 1450 // If the queued request resulted in a pending call, then let it | 1448 // If the queued request resulted in a pending call, then let it |
| 1451 // asynchonously process the remaining queued requests once the pending | 1449 // asynchonously process the remaining queued requests once the pending |
| 1452 // call returns. | 1450 // call returns. |
| 1453 if (discovery_request_pending_) | 1451 if (discovery_request_pending_) |
| 1454 return; | 1452 return; |
| 1455 } | 1453 } |
| 1456 } | 1454 } |
| 1457 | 1455 |
| 1458 } // namespace bluez | 1456 } // namespace bluez |
| OLD | NEW |