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

Side by Side Diff: device/bluetooth/bluetooth_adapter_bluez.cc

Issue 1681853003: Add BluetoothRemoteGattServiceWin to BluetoothDeviceWin (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add PlatformSupportsLowEnergy check in the unittests Created 4 years, 10 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
« no previous file with comments | « device/bluetooth/bluetooth_adapter_bluez.h ('k') | device/bluetooth/bluetooth_device.h » ('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 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/bluetooth_adapter_bluez.h" 5 #include "device/bluetooth/bluetooth_adapter_bluez.h"
6 6
7 #include <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after
473 property_name == properties->paired.name() || 473 property_name == properties->paired.name() ||
474 property_name == properties->trusted.name() || 474 property_name == properties->trusted.name() ||
475 property_name == properties->connected.name() || 475 property_name == properties->connected.name() ||
476 property_name == properties->uuids.name() || 476 property_name == properties->uuids.name() ||
477 property_name == properties->rssi.name() || 477 property_name == properties->rssi.name() ||
478 property_name == properties->tx_power.name()) { 478 property_name == properties->tx_power.name()) {
479 NotifyDeviceChanged(device_bluez); 479 NotifyDeviceChanged(device_bluez);
480 } 480 }
481 481
482 if (property_name == properties->gatt_services.name()) { 482 if (property_name == properties->gatt_services.name()) {
483 device_bluez->SetGattServicesDiscoveryComplete(true);
483 NotifyGattServicesDiscovered(device_bluez); 484 NotifyGattServicesDiscovered(device_bluez);
484 } 485 }
485 486
486 // When a device becomes paired, mark it as trusted so that the user does 487 // When a device becomes paired, mark it as trusted so that the user does
487 // not need to approve every incoming connection 488 // not need to approve every incoming connection
488 if (property_name == properties->paired.name() && 489 if (property_name == properties->paired.name() &&
489 properties->paired.value() && !properties->trusted.value()) { 490 properties->paired.value() && !properties->trusted.value()) {
490 device_bluez->SetTrusted(); 491 device_bluez->SetTrusted();
491 } 492 }
492 493
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after
904 905
905 void BluetoothAdapterBlueZ::NotifyDeviceAddressChanged( 906 void BluetoothAdapterBlueZ::NotifyDeviceAddressChanged(
906 BluetoothDeviceBlueZ* device, 907 BluetoothDeviceBlueZ* device,
907 const std::string& old_address) { 908 const std::string& old_address) {
908 DCHECK(device->adapter_ == this); 909 DCHECK(device->adapter_ == this);
909 910
910 FOR_EACH_OBSERVER(BluetoothAdapter::Observer, observers_, 911 FOR_EACH_OBSERVER(BluetoothAdapter::Observer, observers_,
911 DeviceAddressChanged(this, device, old_address)); 912 DeviceAddressChanged(this, device, old_address));
912 } 913 }
913 914
914 void BluetoothAdapterBlueZ::NotifyGattServiceAdded(
915 BluetoothRemoteGattServiceBlueZ* service) {
916 DCHECK_EQ(service->GetAdapter(), this);
917 DCHECK_EQ(static_cast<BluetoothDeviceBlueZ*>(service->GetDevice())->adapter_,
918 this);
919
920 FOR_EACH_OBSERVER(BluetoothAdapter::Observer, observers_,
921 GattServiceAdded(this, service->GetDevice(), service));
922 }
923
924 void BluetoothAdapterBlueZ::NotifyGattServiceRemoved(
925 BluetoothRemoteGattServiceBlueZ* service) {
926 DCHECK_EQ(service->GetAdapter(), this);
927 DCHECK_EQ(static_cast<BluetoothDeviceBlueZ*>(service->GetDevice())->adapter_,
928 this);
929
930 FOR_EACH_OBSERVER(BluetoothAdapter::Observer, observers_,
931 GattServiceRemoved(this, service->GetDevice(), service));
932 }
933
934 void BluetoothAdapterBlueZ::NotifyGattServiceChanged(
935 BluetoothRemoteGattServiceBlueZ* service) {
936 DCHECK_EQ(service->GetAdapter(), this);
937
938 FOR_EACH_OBSERVER(BluetoothAdapter::Observer, observers_,
939 GattServiceChanged(this, service));
940 }
941
942 void BluetoothAdapterBlueZ::NotifyGattServicesDiscovered(
943 BluetoothDeviceBlueZ* device) {
944 DCHECK(device->adapter_ == this);
945
946 device->SetGattServicesDiscoveryComplete(true);
947 FOR_EACH_OBSERVER(BluetoothAdapter::Observer, observers_,
948 GattServicesDiscovered(this, device));
949 }
950
951 void BluetoothAdapterBlueZ::NotifyGattDiscoveryComplete(
952 BluetoothRemoteGattServiceBlueZ* service) {
953 DCHECK_EQ(service->GetAdapter(), this);
954
955 FOR_EACH_OBSERVER(BluetoothAdapter::Observer, observers_,
956 GattDiscoveryCompleteForService(this, service));
957 }
958
959 void BluetoothAdapterBlueZ::NotifyGattCharacteristicAdded(
960 BluetoothRemoteGattCharacteristicBlueZ* characteristic) {
961 DCHECK_EQ(static_cast<BluetoothRemoteGattServiceBlueZ*>(
962 characteristic->GetService())
963 ->GetAdapter(),
964 this);
965
966 FOR_EACH_OBSERVER(BluetoothAdapter::Observer, observers_,
967 GattCharacteristicAdded(this, characteristic));
968 }
969
970 void BluetoothAdapterBlueZ::NotifyGattCharacteristicRemoved(
971 BluetoothRemoteGattCharacteristicBlueZ* characteristic) {
972 DCHECK_EQ(static_cast<BluetoothRemoteGattServiceBlueZ*>(
973 characteristic->GetService())
974 ->GetAdapter(),
975 this);
976
977 FOR_EACH_OBSERVER(BluetoothAdapter::Observer, observers_,
978 GattCharacteristicRemoved(this, characteristic));
979 }
980
981 void BluetoothAdapterBlueZ::NotifyGattDescriptorAdded(
982 BluetoothRemoteGattDescriptorBlueZ* descriptor) {
983 DCHECK_EQ(static_cast<BluetoothRemoteGattServiceBlueZ*>(
984 descriptor->GetCharacteristic()->GetService())
985 ->GetAdapter(),
986 this);
987
988 FOR_EACH_OBSERVER(BluetoothAdapter::Observer, observers_,
989 GattDescriptorAdded(this, descriptor));
990 }
991
992 void BluetoothAdapterBlueZ::NotifyGattDescriptorRemoved(
993 BluetoothRemoteGattDescriptorBlueZ* descriptor) {
994 DCHECK_EQ(static_cast<BluetoothRemoteGattServiceBlueZ*>(
995 descriptor->GetCharacteristic()->GetService())
996 ->GetAdapter(),
997 this);
998
999 FOR_EACH_OBSERVER(BluetoothAdapter::Observer, observers_,
1000 GattDescriptorRemoved(this, descriptor));
1001 }
1002
1003 void BluetoothAdapterBlueZ::NotifyGattCharacteristicValueChanged(
1004 BluetoothRemoteGattCharacteristicBlueZ* characteristic,
1005 const std::vector<uint8_t>& value) {
1006 DCHECK_EQ(static_cast<BluetoothRemoteGattServiceBlueZ*>(
1007 characteristic->GetService())
1008 ->GetAdapter(),
1009 this);
1010
1011 FOR_EACH_OBSERVER(
1012 BluetoothAdapter::Observer, observers_,
1013 GattCharacteristicValueChanged(this, characteristic, value));
1014 }
1015
1016 void BluetoothAdapterBlueZ::NotifyGattDescriptorValueChanged(
1017 BluetoothRemoteGattDescriptorBlueZ* descriptor,
1018 const std::vector<uint8_t>& value) {
1019 DCHECK_EQ(static_cast<BluetoothRemoteGattServiceBlueZ*>(
1020 descriptor->GetCharacteristic()->GetService())
1021 ->GetAdapter(),
1022 this);
1023
1024 FOR_EACH_OBSERVER(BluetoothAdapter::Observer, observers_,
1025 GattDescriptorValueChanged(this, descriptor, value));
1026 }
1027
1028 void BluetoothAdapterBlueZ::UseProfile( 915 void BluetoothAdapterBlueZ::UseProfile(
1029 const BluetoothUUID& uuid, 916 const BluetoothUUID& uuid,
1030 const dbus::ObjectPath& device_path, 917 const dbus::ObjectPath& device_path,
1031 const bluez::BluetoothProfileManagerClient::Options& options, 918 const bluez::BluetoothProfileManagerClient::Options& options,
1032 bluez::BluetoothProfileServiceProvider::Delegate* delegate, 919 bluez::BluetoothProfileServiceProvider::Delegate* delegate,
1033 const ProfileRegisteredCallback& success_callback, 920 const ProfileRegisteredCallback& success_callback,
1034 const ErrorCompletionCallback& error_callback) { 921 const ErrorCompletionCallback& error_callback) {
1035 DCHECK(delegate); 922 DCHECK(delegate);
1036 923
1037 if (!IsPresent()) { 924 if (!IsPresent()) {
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after
1510 1397
1511 // If the queued request resulted in a pending call, then let it 1398 // If the queued request resulted in a pending call, then let it
1512 // asynchonously process the remaining queued requests once the pending 1399 // asynchonously process the remaining queued requests once the pending
1513 // call returns. 1400 // call returns.
1514 if (discovery_request_pending_) 1401 if (discovery_request_pending_)
1515 return; 1402 return;
1516 } 1403 }
1517 } 1404 }
1518 1405
1519 } // namespace bluez 1406 } // namespace bluez
OLDNEW
« no previous file with comments | « device/bluetooth/bluetooth_adapter_bluez.h ('k') | device/bluetooth/bluetooth_device.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698