OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/test/bluetooth_test.h" | 5 #include "device/bluetooth/test/bluetooth_test.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 const std::string BluetoothTestBase::kTestDeviceNameEmpty = ""; | 21 const std::string BluetoothTestBase::kTestDeviceNameEmpty = ""; |
22 | 22 |
23 const std::string BluetoothTestBase::kTestDeviceAddress1 = "01:00:00:90:1E:BE"; | 23 const std::string BluetoothTestBase::kTestDeviceAddress1 = "01:00:00:90:1E:BE"; |
24 const std::string BluetoothTestBase::kTestDeviceAddress2 = "02:00:00:8B:74:63"; | 24 const std::string BluetoothTestBase::kTestDeviceAddress2 = "02:00:00:8B:74:63"; |
25 | 25 |
26 const std::string BluetoothTestBase::kTestUUIDGenericAccess = "1800"; | 26 const std::string BluetoothTestBase::kTestUUIDGenericAccess = "1800"; |
27 const std::string BluetoothTestBase::kTestUUIDGenericAttribute = "1801"; | 27 const std::string BluetoothTestBase::kTestUUIDGenericAttribute = "1801"; |
28 const std::string BluetoothTestBase::kTestUUIDImmediateAlert = "1802"; | 28 const std::string BluetoothTestBase::kTestUUIDImmediateAlert = "1802"; |
29 const std::string BluetoothTestBase::kTestUUIDLinkLoss = "1803"; | 29 const std::string BluetoothTestBase::kTestUUIDLinkLoss = "1803"; |
30 | 30 |
31 BluetoothTestBase::NotificationType::NotificationType() : indicate(false) {} | |
32 | |
33 BluetoothTestBase::NotificationType::NotificationType( | |
34 std::string device_path, | |
35 std::vector<uint8_t> value, | |
36 bool indicate) | |
37 : device_path(device_path), value(value), indicate(indicate) {} | |
38 | |
39 BluetoothTestBase::NotificationType::NotificationType( | |
40 const NotificationType& obj) { | |
41 this->device_path = obj.device_path; | |
42 this->value = obj.value; | |
43 this->indicate = obj.indicate; | |
44 } | |
45 | |
46 BluetoothTestBase::NotificationType::~NotificationType() {} | |
47 | |
48 BluetoothTestBase::BluetoothTestBase() : weak_factory_(this) {} | 31 BluetoothTestBase::BluetoothTestBase() : weak_factory_(this) {} |
49 | 32 |
50 BluetoothTestBase::~BluetoothTestBase() { | 33 BluetoothTestBase::~BluetoothTestBase() { |
51 } | 34 } |
52 | 35 |
53 void BluetoothTestBase::StartLowEnergyDiscoverySession() { | 36 void BluetoothTestBase::StartLowEnergyDiscoverySession() { |
54 adapter_->StartDiscoverySessionWithFilter( | 37 adapter_->StartDiscoverySessionWithFilter( |
55 base::WrapUnique(new BluetoothDiscoveryFilter( | 38 base::WrapUnique(new BluetoothDiscoveryFilter( |
56 BluetoothDiscoveryFilter::Transport::TRANSPORT_LE)), | 39 BluetoothDiscoveryFilter::Transport::TRANSPORT_LE)), |
57 GetDiscoverySessionCallback(Call::EXPECTED), | 40 GetDiscoverySessionCallback(Call::EXPECTED), |
(...skipping 27 matching lines...) Expand all Loading... |
85 return nullptr; | 68 return nullptr; |
86 } | 69 } |
87 | 70 |
88 bool BluetoothTestBase::SimulateLocalGattCharacteristicNotificationsRequest( | 71 bool BluetoothTestBase::SimulateLocalGattCharacteristicNotificationsRequest( |
89 BluetoothLocalGattCharacteristic* characteristic, | 72 BluetoothLocalGattCharacteristic* characteristic, |
90 bool start) { | 73 bool start) { |
91 NOTIMPLEMENTED(); | 74 NOTIMPLEMENTED(); |
92 return false; | 75 return false; |
93 } | 76 } |
94 | 77 |
95 BluetoothTestBase::NotificationType | 78 std::vector<uint8_t> BluetoothTestBase::LastNotifactionValueForCharacteristic( |
96 BluetoothTestBase::LastNotifactionValueForCharacteristic( | |
97 BluetoothLocalGattCharacteristic* characteristic) { | 79 BluetoothLocalGattCharacteristic* characteristic) { |
98 NOTIMPLEMENTED(); | 80 NOTIMPLEMENTED(); |
99 return NotificationType(); | 81 return std::vector<uint8_t>(); |
100 } | 82 } |
101 | 83 |
102 std::vector<BluetoothLocalGattService*> | 84 std::vector<BluetoothLocalGattService*> |
103 BluetoothTestBase::RegisteredGattServices() { | 85 BluetoothTestBase::RegisteredGattServices() { |
104 NOTIMPLEMENTED(); | 86 NOTIMPLEMENTED(); |
105 return std::vector<BluetoothLocalGattService*>(); | 87 return std::vector<BluetoothLocalGattService*>(); |
106 } | 88 } |
107 | 89 |
108 void BluetoothTestBase::DeleteDevice(BluetoothDevice* device) { | 90 void BluetoothTestBase::DeleteDevice(BluetoothDevice* device) { |
109 adapter_->DeleteDeviceForTesting(device->GetAddress()); | 91 adapter_->DeleteDeviceForTesting(device->GetAddress()); |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 gatt_disconnection_attempts_ = 0; | 315 gatt_disconnection_attempts_ = 0; |
334 gatt_discovery_attempts_ = 0; | 316 gatt_discovery_attempts_ = 0; |
335 gatt_notify_characteristic_attempts_ = 0; | 317 gatt_notify_characteristic_attempts_ = 0; |
336 gatt_read_characteristic_attempts_ = 0; | 318 gatt_read_characteristic_attempts_ = 0; |
337 gatt_write_characteristic_attempts_ = 0; | 319 gatt_write_characteristic_attempts_ = 0; |
338 gatt_read_descriptor_attempts_ = 0; | 320 gatt_read_descriptor_attempts_ = 0; |
339 gatt_write_descriptor_attempts_ = 0; | 321 gatt_write_descriptor_attempts_ = 0; |
340 } | 322 } |
341 | 323 |
342 } // namespace device | 324 } // namespace device |
OLD | NEW |