| 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 CHROME_BROWSER_CHROMEOS_BLUETOOTH_BLUETOOTH_SERVICE_RECORD_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_BLUETOOTH_BLUETOOTH_SERVICE_RECORD_DBUS_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_BLUETOOTH_BLUETOOTH_SERVICE_RECORD_H_ | 6 #define CHROME_BROWSER_CHROMEOS_BLUETOOTH_BLUETOOTH_SERVICE_RECORD_DBUS_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "chrome/browser/chromeos/bluetooth/bluetooth_service_record_interface.h
" |
| 11 | 12 |
| 12 class XmlReader; | 13 class XmlReader; |
| 13 | 14 |
| 14 namespace chromeos { | 15 namespace chromeos { |
| 15 | 16 |
| 16 // The BluetoothServiceRecord represents an SDP service record. | 17 // The BluetoothServiceRecordDBus class is an implementation of |
| 18 // BluetoothServiceRecordInterface using DBus for Linux/ChromeOS platform. |
| 17 // | 19 // |
| 18 // This implementation is currently incomplete: it only supports those fields | 20 // This implementation is currently incomplete: it only supports those fields |
| 19 // that have been necessary so far. | 21 // that have been necessary so far. |
| 20 class BluetoothServiceRecord { | 22 class BluetoothServiceRecordDBus : public BluetoothServiceRecordInterface { |
| 21 public: | 23 public: |
| 22 BluetoothServiceRecord( | 24 BluetoothServiceRecordDBus( |
| 23 const std::string& address, | 25 const std::string& address, |
| 24 const std::string& xml_data); | 26 const std::string& xml_data); |
| 25 | 27 |
| 26 // The human-readable name of this service. | 28 // The human-readable name of this service. |
| 27 const std::string& name() const { return name_; } | 29 virtual const std::string& name() const { return name_; } |
| 30 |
| 31 // The UUID of the service. This field may be empty if no UUID was |
| 32 // specified in the service record. |
| 33 virtual const std::string& uuid() const { return uuid_; } |
| 28 | 34 |
| 29 // The address of the BluetoothDevice providing this service. | 35 // The address of the BluetoothDevice providing this service. |
| 30 const std::string& address() const { return address_; } | 36 const std::string& address() const { return address_; } |
| 31 | 37 |
| 32 // The UUID of the service. This field may be empty if no UUID was | |
| 33 // specified in the service record. | |
| 34 const std::string& uuid() const { return uuid_; } | |
| 35 | |
| 36 // Indicates if this service supports RFCOMM communication. | 38 // Indicates if this service supports RFCOMM communication. |
| 37 bool SupportsRfcomm() const { return supports_rfcomm_; } | 39 bool SupportsRfcomm() const { return supports_rfcomm_; } |
| 38 | 40 |
| 39 // The RFCOMM channel to use, if this service supports RFCOMM communication. | 41 // The RFCOMM channel to use, if this service supports RFCOMM communication. |
| 40 // The return value is undefined if SupportsRfcomm() returns false. | 42 // The return value is undefined if SupportsRfcomm() returns false. |
| 41 uint8_t rfcomm_channel() const { return rfcomm_channel_; } | 43 uint8_t rfcomm_channel() const { return rfcomm_channel_; } |
| 42 | 44 |
| 43 private: | 45 private: |
| 44 void ExtractChannels(XmlReader* reader); | 46 void ExtractChannels(XmlReader* reader); |
| 45 void ExtractUuid(XmlReader* reader); | 47 void ExtractUuid(XmlReader* reader); |
| 46 | 48 |
| 47 std::string address_; | 49 std::string address_; |
| 48 std::string name_; | 50 std::string name_; |
| 49 std::string uuid_; | 51 std::string uuid_; |
| 50 | 52 |
| 51 bool supports_rfcomm_; | 53 bool supports_rfcomm_; |
| 52 uint8_t rfcomm_channel_; | 54 uint8_t rfcomm_channel_; |
| 53 | 55 |
| 54 DISALLOW_COPY_AND_ASSIGN(BluetoothServiceRecord); | 56 DISALLOW_COPY_AND_ASSIGN(BluetoothServiceRecordDBus); |
| 55 }; | 57 }; |
| 56 | 58 |
| 57 } // namespace chromeos | 59 } // namespace chromeos |
| 58 | 60 |
| 59 #endif // CHROME_BROWSER_CHROMEOS_BLUETOOTH_BLUETOOTH_SERVICE_RECORD_H_ | 61 #endif // CHROME_BROWSER_CHROMEOS_BLUETOOTH_BLUETOOTH_SERVICE_RECORD_DBUS_H_ |
| OLD | NEW |