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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 const std::string& error_message) { | 99 const std::string& error_message) { |
100 VLOG(1) << "Bluetooth Error: " << error_name << ": " << error_message; | 100 VLOG(1) << "Bluetooth Error: " << error_name << ": " << error_message; |
101 } | 101 } |
102 | 102 |
103 BluetoothDeviceClient::ServiceRecordList CreateFakeServiceRecords() { | 103 BluetoothDeviceClient::ServiceRecordList CreateFakeServiceRecords() { |
104 BluetoothDeviceClient::ServiceRecordList records; | 104 BluetoothDeviceClient::ServiceRecordList records; |
105 | 105 |
106 std::unique_ptr<BluetoothServiceRecordBlueZ> record1 = | 106 std::unique_ptr<BluetoothServiceRecordBlueZ> record1 = |
107 base::MakeUnique<BluetoothServiceRecordBlueZ>(); | 107 base::MakeUnique<BluetoothServiceRecordBlueZ>(); |
108 // ID 0 = handle. | 108 // ID 0 = handle. |
109 record1->AddRecordEntry(0x0, BluetoothServiceAttributeValueBlueZ( | 109 record1->AddRecordEntry( |
110 BluetoothServiceAttributeValueBlueZ::UINT, 4, | 110 0x0, BluetoothServiceAttributeValueBlueZ( |
111 base::MakeUnique<base::FundamentalValue>( | 111 BluetoothServiceAttributeValueBlueZ::UINT, 4, |
112 static_cast<int32_t>(0x1337)))); | 112 base::MakeUnique<base::Value>(static_cast<int32_t>(0x1337)))); |
113 // ID 1 = service class id list. | 113 // ID 1 = service class id list. |
114 std::unique_ptr<BluetoothServiceAttributeValueBlueZ::Sequence> class_id_list = | 114 std::unique_ptr<BluetoothServiceAttributeValueBlueZ::Sequence> class_id_list = |
115 base::MakeUnique<BluetoothServiceAttributeValueBlueZ::Sequence>(); | 115 base::MakeUnique<BluetoothServiceAttributeValueBlueZ::Sequence>(); |
116 class_id_list->emplace_back(BluetoothServiceAttributeValueBlueZ::UUID, 4, | 116 class_id_list->emplace_back(BluetoothServiceAttributeValueBlueZ::UUID, 4, |
117 base::MakeUnique<base::StringValue>("1802")); | 117 base::MakeUnique<base::StringValue>("1802")); |
118 record1->AddRecordEntry( | 118 record1->AddRecordEntry( |
119 0x1, BluetoothServiceAttributeValueBlueZ(std::move(class_id_list))); | 119 0x1, BluetoothServiceAttributeValueBlueZ(std::move(class_id_list))); |
120 records.emplace_back(*record1); | 120 records.emplace_back(*record1); |
121 | 121 |
122 std::unique_ptr<BluetoothServiceRecordBlueZ> record2 = | 122 std::unique_ptr<BluetoothServiceRecordBlueZ> record2 = |
123 base::MakeUnique<BluetoothServiceRecordBlueZ>(); | 123 base::MakeUnique<BluetoothServiceRecordBlueZ>(); |
124 // ID 0 = handle. | 124 // ID 0 = handle. |
125 record2->AddRecordEntry(0x0, BluetoothServiceAttributeValueBlueZ( | 125 record2->AddRecordEntry( |
126 BluetoothServiceAttributeValueBlueZ::UINT, 4, | 126 0x0, |
127 base::MakeUnique<base::FundamentalValue>( | 127 BluetoothServiceAttributeValueBlueZ( |
128 static_cast<int32_t>(0xffffffff)))); | 128 BluetoothServiceAttributeValueBlueZ::UINT, 4, |
| 129 base::MakeUnique<base::Value>(static_cast<int32_t>(0xffffffff)))); |
129 records.emplace_back(*record2); | 130 records.emplace_back(*record2); |
130 | 131 |
131 return records; | 132 return records; |
132 } | 133 } |
133 | 134 |
134 } // namespace | 135 } // namespace |
135 | 136 |
136 const char FakeBluetoothDeviceClient::kTestPinCode[] = "123456"; | 137 const char FakeBluetoothDeviceClient::kTestPinCode[] = "123456"; |
137 const int FakeBluetoothDeviceClient::kTestPassKey = 123456; | 138 const int FakeBluetoothDeviceClient::kTestPassKey = 123456; |
138 | 139 |
(...skipping 1678 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1817 } | 1818 } |
1818 properties->type.set_valid(true); | 1819 properties->type.set_valid(true); |
1819 | 1820 |
1820 properties_map_.insert(std::make_pair(device_path, std::move(properties))); | 1821 properties_map_.insert(std::make_pair(device_path, std::move(properties))); |
1821 device_list_.push_back(device_path); | 1822 device_list_.push_back(device_path); |
1822 for (auto& observer : observers_) | 1823 for (auto& observer : observers_) |
1823 observer.DeviceAdded(device_path); | 1824 observer.DeviceAdded(device_path); |
1824 } | 1825 } |
1825 | 1826 |
1826 } // namespace bluez | 1827 } // namespace bluez |
OLD | NEW |