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 <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
411 const ErrorCallback& error_callback) = 0; | 411 const ErrorCallback& error_callback) = 0; |
412 | 412 |
413 // Returns the list of discovered GATT services. | 413 // Returns the list of discovered GATT services. |
414 virtual std::vector<BluetoothGattService*> GetGattServices() const; | 414 virtual std::vector<BluetoothGattService*> GetGattServices() const; |
415 | 415 |
416 // Returns the GATT service with device-specific identifier |identifier|. | 416 // Returns the GATT service with device-specific identifier |identifier|. |
417 // Returns NULL, if no such service exists. | 417 // Returns NULL, if no such service exists. |
418 virtual BluetoothGattService* GetGattService( | 418 virtual BluetoothGattService* GetGattService( |
419 const std::string& identifier) const; | 419 const std::string& identifier) const; |
420 | 420 |
| 421 // Returns the |address| in the canoncial format: XX:XX:XX:XX:XX:XX, where |
| 422 // each 'X' is a hex digit. If the input |address| is invalid, returns an |
| 423 // empty string. |
| 424 static std::string CanonicalizeAddress(const std::string& address); |
| 425 |
421 protected: | 426 protected: |
422 BluetoothDevice(); | 427 BluetoothDevice(); |
423 | 428 |
424 // Returns the internal name of the Bluetooth device, used by GetName(). | 429 // Returns the internal name of the Bluetooth device, used by GetName(). |
425 virtual std::string GetDeviceName() const = 0; | 430 virtual std::string GetDeviceName() const = 0; |
426 | 431 |
427 // Mapping from the platform-specific GATT service identifiers to | 432 // Mapping from the platform-specific GATT service identifiers to |
428 // BluetoothGattService objects. | 433 // BluetoothGattService objects. |
429 typedef std::map<std::string, BluetoothGattService*> GattServiceMap; | 434 typedef std::map<std::string, BluetoothGattService*> GattServiceMap; |
430 GattServiceMap gatt_services_; | 435 GattServiceMap gatt_services_; |
431 | 436 |
432 private: | 437 private: |
433 // Returns a localized string containing the device's bluetooth address and | 438 // Returns a localized string containing the device's bluetooth address and |
434 // a device type for display when |name_| is empty. | 439 // a device type for display when |name_| is empty. |
435 base::string16 GetAddressWithLocalizedDeviceTypeName() const; | 440 base::string16 GetAddressWithLocalizedDeviceTypeName() const; |
436 }; | 441 }; |
437 | 442 |
438 } // namespace device | 443 } // namespace device |
439 | 444 |
440 #endif // DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_H_ | 445 #endif // DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_H_ |
OLD | NEW |