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_SERVICE_RECORD_H_ | 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_SERVICE_RECORD_H_ |
6 #define DEVICE_BLUETOOTH_BLUETOOTH_SERVICE_RECORD_H_ | 6 #define DEVICE_BLUETOOTH_BLUETOOTH_SERVICE_RECORD_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 | 11 |
12 class XmlReader; | |
13 | |
14 namespace device { | 12 namespace device { |
15 | 13 |
16 // BluetoothServiceRecord represents an SDP service record. | 14 // BluetoothServiceRecord represents an SDP service record. |
17 // | 15 // |
18 // This implementation is currently incomplete: it only supports those fields | 16 // This implementation is currently incomplete: it only supports those fields |
19 // that have been necessary so far. | 17 // that have been necessary so far. |
20 class BluetoothServiceRecord { | 18 class BluetoothServiceRecord { |
21 public: | 19 public: |
bryeung
2013/01/14 20:21:46
missing the no-argument constructor
youngki
2013/01/14 20:37:57
I put the constructor under protected access speci
bryeung
2013/01/14 20:40:55
Oops! Missed that.
| |
22 BluetoothServiceRecord( | 20 virtual ~BluetoothServiceRecord(); |
bryeung
2013/01/14 20:21:46
The whitespace is messed up here (it was before to
youngki
2013/01/14 20:37:57
Hm.. it is messed up indeed..; fixed it.
| |
23 const std::string& address, | |
24 const std::string& xml_data); | |
25 | 21 |
26 // The human-readable name of this service. | 22 // The human-readable name of this service. |
27 const std::string& name() const { return name_; } | 23 const std::string& name() const { return name_; } |
28 | 24 |
29 // The address of the BluetoothDevice providing this service. | 25 // The address of the BluetoothDevice providing this service. |
30 const std::string& address() const { return address_; } | 26 const std::string& address() const { return address_; } |
31 | 27 |
32 // The UUID of the service. This field may be empty if no UUID was | 28 // The UUID of the service. This field may be empty if no UUID was |
33 // specified in the service record. | 29 // specified in the service record. |
34 const std::string& uuid() const { return uuid_; } | 30 const std::string& uuid() const { return uuid_; } |
35 | 31 |
36 // Indicates if this service supports RFCOMM communication. | 32 // Indicates if this service supports RFCOMM communication. |
37 bool SupportsRfcomm() const { return supports_rfcomm_; } | 33 bool SupportsRfcomm() const { return supports_rfcomm_; } |
38 | 34 |
39 // The RFCOMM channel to use, if this service supports RFCOMM communication. | 35 // The RFCOMM channel to use, if this service supports RFCOMM communication. |
40 // The return value is undefined if SupportsRfcomm() returns false. | 36 // The return value is undefined if SupportsRfcomm() returns false. |
41 uint8 rfcomm_channel() const { return rfcomm_channel_; } | 37 uint8 rfcomm_channel() const { return rfcomm_channel_; } |
42 | 38 |
39 protected: | |
40 BluetoothServiceRecord(); | |
41 | |
42 std::string address_; | |
43 std::string name_; | |
44 std::string uuid_; | |
45 | |
46 bool supports_rfcomm_; | |
47 uint8 rfcomm_channel_; | |
48 | |
43 private: | 49 private: |
44 void ExtractChannels(XmlReader* reader); | 50 DISALLOW_COPY_AND_ASSIGN(BluetoothServiceRecord); |
45 void ExtractUuid(XmlReader* reader); | |
46 | |
47 std::string address_; | |
48 std::string name_; | |
49 std::string uuid_; | |
50 | |
51 bool supports_rfcomm_; | |
52 uint8 rfcomm_channel_; | |
53 | |
54 DISALLOW_COPY_AND_ASSIGN(BluetoothServiceRecord); | |
55 }; | 51 }; |
56 | 52 |
57 } // namespace device | 53 } // namespace device |
58 | 54 |
59 #endif // DEVICE_BLUETOOTH_BLUETOOTH_SERVICE_RECORD_H_ | 55 #endif // DEVICE_BLUETOOTH_BLUETOOTH_SERVICE_RECORD_H_ |
OLD | NEW |