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 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_H_ | 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_H_ |
6 #define DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_H_ | 6 #define DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/callback.h" | 13 #include "base/callback.h" |
| 14 #include "base/gtest_prod_util.h" |
14 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
15 #include "base/strings/string16.h" | 16 #include "base/strings/string16.h" |
16 #include "device/bluetooth/bluetooth_export.h" | 17 #include "device/bluetooth/bluetooth_export.h" |
17 #include "device/bluetooth/bluetooth_uuid.h" | 18 #include "device/bluetooth/bluetooth_uuid.h" |
18 #include "net/log/net_log.h" | 19 #include "net/log/net_log.h" |
19 | 20 |
20 namespace base { | 21 namespace base { |
21 class BinaryValue; | 22 class BinaryValue; |
22 } | 23 } |
23 | 24 |
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
428 virtual UUIDList GetServiceDataUUIDs() const; | 429 virtual UUIDList GetServiceDataUUIDs() const; |
429 | 430 |
430 // Returns the |address| in the canonical format: XX:XX:XX:XX:XX:XX, where | 431 // Returns the |address| in the canonical format: XX:XX:XX:XX:XX:XX, where |
431 // each 'X' is a hex digit. If the input |address| is invalid, returns an | 432 // each 'X' is a hex digit. If the input |address| is invalid, returns an |
432 // empty string. | 433 // empty string. |
433 static std::string CanonicalizeAddress(const std::string& address); | 434 static std::string CanonicalizeAddress(const std::string& address); |
434 | 435 |
435 protected: | 436 protected: |
436 // BluetoothGattConnection is a friend to call Add/RemoveGattConnection. | 437 // BluetoothGattConnection is a friend to call Add/RemoveGattConnection. |
437 friend BluetoothGattConnection; | 438 friend BluetoothGattConnection; |
| 439 FRIEND_TEST_ALL_PREFIXES(BluetoothTest, |
| 440 BluetoothGattConnection_ConnectDisconnect); |
438 | 441 |
439 BluetoothDevice(BluetoothAdapter* adapter); | 442 BluetoothDevice(BluetoothAdapter* adapter); |
440 | 443 |
441 // Returns the internal name of the Bluetooth device, used by GetName(). | 444 // Returns the internal name of the Bluetooth device, used by GetName(). |
442 virtual std::string GetDeviceName() const = 0; | 445 virtual std::string GetDeviceName() const = 0; |
443 | 446 |
444 // Implements platform specific operations to initiate a GATT connection. | 447 // Implements platform specific operations to initiate a GATT connection. |
445 // Subclasses must also call DidConnectGatt, DidFailToConnectGatt, or | 448 // Subclasses must also call DidConnectGatt, DidFailToConnectGatt, or |
446 // DidDisconnectGatt immediately or asynchronously as the connection state | 449 // DidDisconnectGatt immediately or asynchronously as the connection state |
447 // changes. | 450 // changes. |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
499 | 502 |
500 private: | 503 private: |
501 // Returns a localized string containing the device's bluetooth address and | 504 // Returns a localized string containing the device's bluetooth address and |
502 // a device type for display when |name_| is empty. | 505 // a device type for display when |name_| is empty. |
503 base::string16 GetAddressWithLocalizedDeviceTypeName() const; | 506 base::string16 GetAddressWithLocalizedDeviceTypeName() const; |
504 }; | 507 }; |
505 | 508 |
506 } // namespace device | 509 } // namespace device |
507 | 510 |
508 #endif // DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_H_ | 511 #endif // DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_H_ |
OLD | NEW |