| 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 <stddef.h> |
| 9 #include <sys/socket.h> | 9 #include <sys/socket.h> |
| 10 #include <sys/types.h> | 10 #include <sys/types.h> |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 const std::string& error_message) { | 97 const std::string& error_message) { |
| 98 VLOG(1) << "Bluetooth Error: " << error_name << ": " << error_message; | 98 VLOG(1) << "Bluetooth Error: " << error_name << ": " << error_message; |
| 99 } | 99 } |
| 100 | 100 |
| 101 BluetoothDeviceClient::ServiceRecordList CreateFakeServiceRecords() { | 101 BluetoothDeviceClient::ServiceRecordList CreateFakeServiceRecords() { |
| 102 BluetoothDeviceClient::ServiceRecordList records; | 102 BluetoothDeviceClient::ServiceRecordList records; |
| 103 | 103 |
| 104 std::unique_ptr<BluetoothServiceRecordBlueZ> record1 = | 104 std::unique_ptr<BluetoothServiceRecordBlueZ> record1 = |
| 105 base::MakeUnique<BluetoothServiceRecordBlueZ>(); | 105 base::MakeUnique<BluetoothServiceRecordBlueZ>(); |
| 106 // ID 0 = handle. | 106 // ID 0 = handle. |
| 107 record1->AddRecordEntry(0x0, BluetoothServiceAttributeValueBlueZ( | 107 record1->AddRecordEntry( |
| 108 BluetoothServiceAttributeValueBlueZ::UINT, 4, | 108 0x0, BluetoothServiceAttributeValueBlueZ( |
| 109 base::MakeUnique<base::FundamentalValue>( | 109 BluetoothServiceAttributeValueBlueZ::UINT, 4, |
| 110 static_cast<int32_t>(0x1337)))); | 110 base::MakeUnique<base::Value>(static_cast<int32_t>(0x1337)))); |
| 111 // ID 1 = service class id list. | 111 // ID 1 = service class id list. |
| 112 std::unique_ptr<BluetoothServiceAttributeValueBlueZ::Sequence> class_id_list = | 112 std::unique_ptr<BluetoothServiceAttributeValueBlueZ::Sequence> class_id_list = |
| 113 base::MakeUnique<BluetoothServiceAttributeValueBlueZ::Sequence>(); | 113 base::MakeUnique<BluetoothServiceAttributeValueBlueZ::Sequence>(); |
| 114 class_id_list->emplace_back(BluetoothServiceAttributeValueBlueZ::UUID, 4, | 114 class_id_list->emplace_back(BluetoothServiceAttributeValueBlueZ::UUID, 4, |
| 115 base::MakeUnique<base::StringValue>("1802")); | 115 base::MakeUnique<base::StringValue>("1802")); |
| 116 record1->AddRecordEntry( | 116 record1->AddRecordEntry( |
| 117 0x1, BluetoothServiceAttributeValueBlueZ(std::move(class_id_list))); | 117 0x1, BluetoothServiceAttributeValueBlueZ(std::move(class_id_list))); |
| 118 records.emplace_back(*record1); | 118 records.emplace_back(*record1); |
| 119 | 119 |
| 120 std::unique_ptr<BluetoothServiceRecordBlueZ> record2 = | 120 std::unique_ptr<BluetoothServiceRecordBlueZ> record2 = |
| 121 base::MakeUnique<BluetoothServiceRecordBlueZ>(); | 121 base::MakeUnique<BluetoothServiceRecordBlueZ>(); |
| 122 // ID 0 = handle. | 122 // ID 0 = handle. |
| 123 record2->AddRecordEntry(0x0, BluetoothServiceAttributeValueBlueZ( | 123 record2->AddRecordEntry( |
| 124 BluetoothServiceAttributeValueBlueZ::UINT, 4, | 124 0x0, |
| 125 base::MakeUnique<base::FundamentalValue>( | 125 BluetoothServiceAttributeValueBlueZ( |
| 126 static_cast<int32_t>(0xffffffff)))); | 126 BluetoothServiceAttributeValueBlueZ::UINT, 4, |
| 127 base::MakeUnique<base::Value>(static_cast<int32_t>(0xffffffff)))); |
| 127 records.emplace_back(*record2); | 128 records.emplace_back(*record2); |
| 128 | 129 |
| 129 return records; | 130 return records; |
| 130 } | 131 } |
| 131 | 132 |
| 132 } // namespace | 133 } // namespace |
| 133 | 134 |
| 134 const char FakeBluetoothDeviceClient::kTestPinCode[] = "123456"; | 135 const char FakeBluetoothDeviceClient::kTestPinCode[] = "123456"; |
| 135 const int FakeBluetoothDeviceClient::kTestPassKey = 123456; | 136 const int FakeBluetoothDeviceClient::kTestPassKey = 123456; |
| 136 | 137 |
| (...skipping 1669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1806 } | 1807 } |
| 1807 properties->type.set_valid(true); | 1808 properties->type.set_valid(true); |
| 1808 | 1809 |
| 1809 properties_map_.insert(std::make_pair(device_path, std::move(properties))); | 1810 properties_map_.insert(std::make_pair(device_path, std::move(properties))); |
| 1810 device_list_.push_back(device_path); | 1811 device_list_.push_back(device_path); |
| 1811 for (auto& observer : observers_) | 1812 for (auto& observer : observers_) |
| 1812 observer.DeviceAdded(device_path); | 1813 observer.DeviceAdded(device_path); |
| 1813 } | 1814 } |
| 1814 | 1815 |
| 1815 } // namespace bluez | 1816 } // namespace bluez |
| OLD | NEW |