| 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 "device/bluetooth/bluetooth_device.h" | 5 #include "device/bluetooth/bluetooth_device.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| 11 #include "base/values.h" | 11 #include "base/values.h" |
| 12 #include "device/bluetooth/bluetooth_gatt_service.h" | 12 #include "device/bluetooth/bluetooth_gatt_service.h" |
| 13 #include "grit/device_bluetooth_strings.h" | 13 #include "grit/device_bluetooth_strings.h" |
| 14 #include "ui/base/l10n/l10n_util.h" | 14 #include "ui/base/l10n/l10n_util.h" |
| 15 | 15 |
| 16 namespace device { | 16 namespace device { |
| 17 | 17 |
| 18 BluetoothDevice::BluetoothDevice() | 18 BluetoothDevice::BluetoothDevice() |
| 19 : services_data_(new base::DictionaryValue()) {} | 19 : services_data_(new base::DictionaryValue()) {} |
| 20 | 20 |
| 21 BluetoothDevice::~BluetoothDevice() { | 21 BluetoothDevice::~BluetoothDevice() { |
| 22 STLDeleteValues(&gatt_services_); | 22 STLDeleteValues(&gatt_services_); |
| 23 } | 23 } |
| 24 | 24 |
| 25 bool BluetoothDevice::SupportsLowEnergy() const { |
| 26 return supports_low_energy_; |
| 27 } |
| 28 |
| 29 bool BluetoothDevice::SupportsClassic() const { |
| 30 return supports_classic_; |
| 31 } |
| 32 |
| 25 BluetoothDevice::ConnectionInfo::ConnectionInfo() | 33 BluetoothDevice::ConnectionInfo::ConnectionInfo() |
| 26 : rssi(kUnknownPower), | 34 : rssi(kUnknownPower), |
| 27 transmit_power(kUnknownPower), | 35 transmit_power(kUnknownPower), |
| 28 max_transmit_power(kUnknownPower) {} | 36 max_transmit_power(kUnknownPower) {} |
| 29 | 37 |
| 30 BluetoothDevice::ConnectionInfo::ConnectionInfo( | 38 BluetoothDevice::ConnectionInfo::ConnectionInfo( |
| 31 int rssi, int transmit_power, int max_transmit_power) | 39 int rssi, int transmit_power, int max_transmit_power) |
| 32 : rssi(rssi), | 40 : rssi(rssi), |
| 33 transmit_power(transmit_power), | 41 transmit_power(transmit_power), |
| 34 max_transmit_power(max_transmit_power) {} | 42 max_transmit_power(max_transmit_power) {} |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 | 282 |
| 275 void BluetoothDevice::ClearServiceData() { services_data_->Clear(); } | 283 void BluetoothDevice::ClearServiceData() { services_data_->Clear(); } |
| 276 | 284 |
| 277 void BluetoothDevice::SetServiceData(BluetoothUUID serviceUUID, | 285 void BluetoothDevice::SetServiceData(BluetoothUUID serviceUUID, |
| 278 const char* buffer, size_t size) { | 286 const char* buffer, size_t size) { |
| 279 services_data_->Set(serviceUUID.value(), | 287 services_data_->Set(serviceUUID.value(), |
| 280 base::BinaryValue::CreateWithCopiedBuffer(buffer, size)); | 288 base::BinaryValue::CreateWithCopiedBuffer(buffer, size)); |
| 281 } | 289 } |
| 282 | 290 |
| 283 } // namespace device | 291 } // namespace device |
| OLD | NEW |