OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "extensions/browser/api/bluetooth/bluetooth_api_utils.h" | 5 #include "extensions/browser/api/bluetooth/bluetooth_api_utils.h" |
6 | 6 |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "base/values.h" | 8 #include "base/values.h" |
9 #include "device/bluetooth/bluetooth_adapter.h" | 9 #include "device/bluetooth/bluetooth_adapter.h" |
10 #include "device/bluetooth/bluetooth_device.h" | 10 #include "device/bluetooth/bluetooth_device.h" |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 const device::BluetoothDevice::UUIDList& uuids = device.GetUUIDs(); | 116 const device::BluetoothDevice::UUIDList& uuids = device.GetUUIDs(); |
117 for (device::BluetoothDevice::UUIDList::const_iterator iter = uuids.begin(); | 117 for (device::BluetoothDevice::UUIDList::const_iterator iter = uuids.begin(); |
118 iter != uuids.end(); ++iter) | 118 iter != uuids.end(); ++iter) |
119 string_uuids->push_back(iter->canonical_value()); | 119 string_uuids->push_back(iter->canonical_value()); |
120 out->uuids.reset(string_uuids); | 120 out->uuids.reset(string_uuids); |
121 | 121 |
122 if (device.GetInquiryRSSI() != device::BluetoothDevice::kUnknownPower) | 122 if (device.GetInquiryRSSI() != device::BluetoothDevice::kUnknownPower) |
123 out->inquiry_rssi.reset(new int(device.GetInquiryRSSI())); | 123 out->inquiry_rssi.reset(new int(device.GetInquiryRSSI())); |
124 else | 124 else |
125 out->inquiry_rssi.reset(); | 125 out->inquiry_rssi.reset(); |
| 126 |
| 127 if (device.GetInquiryTxPower() != device::BluetoothDevice::kUnknownPower) |
| 128 out->inquiry_tx_power.reset(new int(device.GetInquiryTxPower())); |
| 129 else |
| 130 out->inquiry_tx_power.reset(); |
126 } | 131 } |
127 | 132 |
128 void PopulateAdapterState(const device::BluetoothAdapter& adapter, | 133 void PopulateAdapterState(const device::BluetoothAdapter& adapter, |
129 AdapterState* out) { | 134 AdapterState* out) { |
130 out->discovering = adapter.IsDiscovering(); | 135 out->discovering = adapter.IsDiscovering(); |
131 out->available = adapter.IsPresent(); | 136 out->available = adapter.IsPresent(); |
132 out->powered = adapter.IsPowered(); | 137 out->powered = adapter.IsPowered(); |
133 out->name = adapter.GetName(); | 138 out->name = adapter.GetName(); |
134 out->address = adapter.GetAddress(); | 139 out->address = adapter.GetAddress(); |
135 } | 140 } |
136 | 141 |
137 } // namespace bluetooth | 142 } // namespace bluetooth |
138 } // namespace core_api | 143 } // namespace core_api |
139 } // namespace extensions | 144 } // namespace extensions |
OLD | NEW |