Create a new-installs-only uniformity trial.
[chromium-blink-merge.git] / device / bluetooth / bluetooth_service_record.h
blobe04d73a632f86fa4be5bcbbc9f494f7ae2bf03f4
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
3 // found in the LICENSE file.
5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_SERVICE_RECORD_H_
6 #define DEVICE_BLUETOOTH_BLUETOOTH_SERVICE_RECORD_H_
8 #include <string>
10 #include "base/basictypes.h"
12 class XmlReader;
14 namespace device {
16 // BluetoothServiceRecord represents an SDP service record.
18 // This implementation is currently incomplete: it only supports those fields
19 // that have been necessary so far.
20 class BluetoothServiceRecord {
21 public:
22 BluetoothServiceRecord(
23 const std::string& address,
24 const std::string& xml_data);
26 // The human-readable name of this service.
27 const std::string& name() const { return name_; }
29 // The address of the BluetoothDevice providing this service.
30 const std::string& address() const { return address_; }
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_; }
36 // Indicates if this service supports RFCOMM communication.
37 bool SupportsRfcomm() const { return supports_rfcomm_; }
39 // The RFCOMM channel to use, if this service supports RFCOMM communication.
40 // The return value is undefined if SupportsRfcomm() returns false.
41 uint8 rfcomm_channel() const { return rfcomm_channel_; }
43 private:
44 void ExtractChannels(XmlReader* reader);
45 void ExtractUuid(XmlReader* reader);
47 std::string address_;
48 std::string name_;
49 std::string uuid_;
51 bool supports_rfcomm_;
52 uint8 rfcomm_channel_;
54 DISALLOW_COPY_AND_ASSIGN(BluetoothServiceRecord);
57 } // namespace device
59 #endif // DEVICE_BLUETOOTH_BLUETOOTH_SERVICE_RECORD_H_