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_H_ |
6 #define CHROME_BROWSER_CHROMEOS_BLUETOOTH_BLUETOOTH_SERVICE_RECORD_H_ | 6 #define CHROME_BROWSER_CHROMEOS_BLUETOOTH_BLUETOOTH_SERVICE_RECORD_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 | 12 |
| 13 class XmlReader; |
| 14 |
13 namespace chromeos { | 15 namespace chromeos { |
14 | 16 |
15 // The BluetoothServiceRecord represents an SDP service record. | 17 // The BluetoothServiceRecord represents an SDP service record. |
16 // | 18 // |
17 // This implementation is currently incomplete: it only supports those fields | 19 // This implementation is currently incomplete: it only supports those fields |
18 // that have been necessary so far. | 20 // that have been necessary so far. |
19 class BluetoothServiceRecord { | 21 class BluetoothServiceRecord { |
20 public: | 22 public: |
21 explicit BluetoothServiceRecord(const std::string& xml_data); | 23 BluetoothServiceRecord(const std::string& address, |
| 24 const std::string& xml_data); |
22 | 25 |
| 26 // The human-readable name of this service. |
23 const std::string& name() const { return name_; } | 27 const std::string& name() const { return name_; } |
24 | 28 |
| 29 // The address of the BluetoothDevice providing this service. |
| 30 const std::string& address() const { return address_; } |
| 31 |
| 32 // Indicates if this service supports RFCOMM communication. |
| 33 bool SupportsRfcomm() const { return supports_rfcomm_; } |
| 34 |
| 35 // The RFCOMM channel to use, if this service supports RFCOMM communication. |
| 36 // The return value is undefined if SupportsRfcomm() returns false. |
| 37 uint8_t rfcomm_channel() const { return rfcomm_channel_; } |
| 38 |
25 private: | 39 private: |
| 40 void ExtractChannels(XmlReader* reader); |
| 41 |
| 42 std::string address_; |
26 std::string name_; | 43 std::string name_; |
27 | 44 |
| 45 bool supports_rfcomm_; |
| 46 uint8_t rfcomm_channel_; |
| 47 |
28 DISALLOW_COPY_AND_ASSIGN(BluetoothServiceRecord); | 48 DISALLOW_COPY_AND_ASSIGN(BluetoothServiceRecord); |
29 }; | 49 }; |
30 | 50 |
31 } // namespace chromeos | 51 } // namespace chromeos |
32 | 52 |
33 #endif // CHROME_BROWSER_CHROMEOS_BLUETOOTH_BLUETOOTH_SERVICE_RECORD_H_ | 53 #endif // CHROME_BROWSER_CHROMEOS_BLUETOOTH_BLUETOOTH_SERVICE_RECORD_H_ |
OLD | NEW |