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( |
| 24 const std::string& address, |
| 25 const std::string& xml_data); |
22 | 26 |
| 27 // The human-readable name of this service. |
23 const std::string& name() const { return name_; } | 28 const std::string& name() const { return name_; } |
24 | 29 |
| 30 // The address of the BluetoothDevice providing this service. |
| 31 const std::string& address() const { return address_; } |
| 32 |
| 33 // Indicates if this service supports RFCOMM communication. |
| 34 bool SupportsRfcomm() const { return supports_rfcomm_; } |
| 35 |
| 36 // The RFCOMM channel to use, if this service supports RFCOMM communication. |
| 37 // The return value is undefined if SupportsRfcomm() returns false. |
| 38 uint8_t rfcomm_channel() const { return rfcomm_channel_; } |
| 39 |
25 private: | 40 private: |
| 41 void ExtractChannels(XmlReader* reader); |
| 42 |
| 43 std::string address_; |
26 std::string name_; | 44 std::string name_; |
27 | 45 |
| 46 bool supports_rfcomm_; |
| 47 uint8_t rfcomm_channel_; |
| 48 |
28 DISALLOW_COPY_AND_ASSIGN(BluetoothServiceRecord); | 49 DISALLOW_COPY_AND_ASSIGN(BluetoothServiceRecord); |
29 }; | 50 }; |
30 | 51 |
31 } // namespace chromeos | 52 } // namespace chromeos |
32 | 53 |
33 #endif // CHROME_BROWSER_CHROMEOS_BLUETOOTH_BLUETOOTH_SERVICE_RECORD_H_ | 54 #endif // CHROME_BROWSER_CHROMEOS_BLUETOOTH_BLUETOOTH_SERVICE_RECORD_H_ |
OLD | NEW |