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 <memory> | 7 #include <memory> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
11 #include "base/stl_util.h" | 11 #include "base/stl_util.h" |
12 #include "base/strings/string_util.h" | 12 #include "base/strings/string_util.h" |
13 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
| 14 #include "base/time/time.h" |
14 #include "base/values.h" | 15 #include "base/values.h" |
15 #include "device/bluetooth/bluetooth_adapter.h" | 16 #include "device/bluetooth/bluetooth_adapter.h" |
16 #include "device/bluetooth/bluetooth_gatt_connection.h" | 17 #include "device/bluetooth/bluetooth_gatt_connection.h" |
17 #include "device/bluetooth/bluetooth_remote_gatt_service.h" | 18 #include "device/bluetooth/bluetooth_remote_gatt_service.h" |
18 #include "grit/bluetooth_strings.h" | 19 #include "grit/bluetooth_strings.h" |
19 #include "ui/base/l10n/l10n_util.h" | 20 #include "ui/base/l10n/l10n_util.h" |
20 | 21 |
21 namespace device { | 22 namespace device { |
22 | 23 |
23 BluetoothDevice::BluetoothDevice(BluetoothAdapter* adapter) | 24 BluetoothDevice::BluetoothDevice(BluetoothAdapter* adapter) |
24 : adapter_(adapter), | 25 : adapter_(adapter), |
25 gatt_services_discovery_complete_(false), | 26 gatt_services_discovery_complete_(false), |
26 services_data_(new base::DictionaryValue()) {} | 27 services_data_(new base::DictionaryValue()), |
| 28 last_update_time_(base::Time()) {} |
27 | 29 |
28 BluetoothDevice::~BluetoothDevice() { | 30 BluetoothDevice::~BluetoothDevice() { |
29 DidDisconnectGatt(); | 31 DidDisconnectGatt(); |
30 } | 32 } |
31 | 33 |
32 BluetoothDevice::ConnectionInfo::ConnectionInfo() | 34 BluetoothDevice::ConnectionInfo::ConnectionInfo() |
33 : rssi(kUnknownPower), | 35 : rssi(kUnknownPower), |
34 transmit_power(kUnknownPower), | 36 transmit_power(kUnknownPower), |
35 max_transmit_power(kUnknownPower) {} | 37 max_transmit_power(kUnknownPower) {} |
36 | 38 |
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 services_data_->Set(serviceUUID.value(), | 382 services_data_->Set(serviceUUID.value(), |
381 base::BinaryValue::CreateWithCopiedBuffer(buffer, size)); | 383 base::BinaryValue::CreateWithCopiedBuffer(buffer, size)); |
382 } | 384 } |
383 | 385 |
384 void BluetoothDevice::Pair(PairingDelegate* pairing_delegate, | 386 void BluetoothDevice::Pair(PairingDelegate* pairing_delegate, |
385 const base::Closure& callback, | 387 const base::Closure& callback, |
386 const ConnectErrorCallback& error_callback) { | 388 const ConnectErrorCallback& error_callback) { |
387 NOTREACHED(); | 389 NOTREACHED(); |
388 } | 390 } |
389 | 391 |
| 392 void BluetoothDevice::UpdateTimestamp() { |
| 393 last_update_time_ = base::Time::NowFromSystemTime(); |
| 394 } |
| 395 |
390 } // namespace device | 396 } // namespace device |
OLD | NEW |