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 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 const ErrorCallback& error_callback) = 0; | 391 const ErrorCallback& error_callback) = 0; |
392 | 392 |
393 // Returns the list of discovered GATT services. | 393 // Returns the list of discovered GATT services. |
394 virtual std::vector<BluetoothGattService*> GetGattServices() const; | 394 virtual std::vector<BluetoothGattService*> GetGattServices() const; |
395 | 395 |
396 // Returns the GATT service with device-specific identifier |identifier|. | 396 // Returns the GATT service with device-specific identifier |identifier|. |
397 // Returns NULL, if no such service exists. | 397 // Returns NULL, if no such service exists. |
398 virtual BluetoothGattService* GetGattService( | 398 virtual BluetoothGattService* GetGattService( |
399 const std::string& identifier) const; | 399 const std::string& identifier) const; |
400 | 400 |
401 // Returns the |address| in the canoncial format: XX:XX:XX:XX:XX:XX, where | 401 // Returns the |address| in the canonical format: XX:XX:XX:XX:XX:XX, where |
402 // each 'X' is a hex digit. If the input |address| is invalid, returns an | 402 // each 'X' is a hex digit. If the input |address| is invalid, returns an |
403 // empty string. | 403 // empty string. |
404 static std::string CanonicalizeAddress(const std::string& address); | 404 static std::string CanonicalizeAddress(const std::string& address); |
405 | 405 |
406 protected: | 406 protected: |
407 BluetoothDevice(); | 407 BluetoothDevice(); |
408 | 408 |
409 // Returns the internal name of the Bluetooth device, used by GetName(). | 409 // Returns the internal name of the Bluetooth device, used by GetName(). |
410 virtual std::string GetDeviceName() const = 0; | 410 virtual std::string GetDeviceName() const = 0; |
411 | 411 |
412 // Mapping from the platform-specific GATT service identifiers to | 412 // Mapping from the platform-specific GATT service identifiers to |
413 // BluetoothGattService objects. | 413 // BluetoothGattService objects. |
414 typedef std::map<std::string, BluetoothGattService*> GattServiceMap; | 414 typedef std::map<std::string, BluetoothGattService*> GattServiceMap; |
415 GattServiceMap gatt_services_; | 415 GattServiceMap gatt_services_; |
416 | 416 |
417 private: | 417 private: |
418 // Returns a localized string containing the device's bluetooth address and | 418 // Returns a localized string containing the device's bluetooth address and |
419 // a device type for display when |name_| is empty. | 419 // a device type for display when |name_| is empty. |
420 base::string16 GetAddressWithLocalizedDeviceTypeName() const; | 420 base::string16 GetAddressWithLocalizedDeviceTypeName() const; |
421 }; | 421 }; |
422 | 422 |
423 } // namespace device | 423 } // namespace device |
424 | 424 |
425 #endif // DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_H_ | 425 #endif // DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_H_ |
OLD | NEW |