summaryrefslogtreecommitdiff
path: root/chromium/device/bluetooth/bluetooth_service_record.h
blob: eebdb6ad376887c5ed6df98f0906af1f29eccb7a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef DEVICE_BLUETOOTH_BLUETOOTH_SERVICE_RECORD_H_
#define DEVICE_BLUETOOTH_BLUETOOTH_SERVICE_RECORD_H_

#include <string>

#include "base/basictypes.h"

namespace device {

// BluetoothServiceRecord represents an SDP service record.
//
// This implementation is currently incomplete: it only supports those fields
// that have been necessary so far.
class BluetoothServiceRecord {
 public:
  virtual ~BluetoothServiceRecord();

  // The human-readable name of this service.
  const std::string& name() const { return name_; }

  // The address of the BluetoothDevice providing this service.
  const std::string& address() const { return address_; }

  // The UUID of the service.  This field may be empty if no UUID was
  // specified in the service record.
  const std::string& uuid() const { return uuid_; }

  // Indicates if this service supports HID.
  bool SupportsHid() const { return supports_hid_; }

  // For HID services, returns the HIDReconnectInitiate attribute. For non-HID
  // or unknown services defaults to true.
  bool hid_reconnect_initiate() const { return hid_reconnect_initiate_; }

  // For HID services, returns the HIDNormallyConnectable attribute. For non-HID
  // or unknown services defaults to true.
  bool hid_normally_connectable() const { return hid_normally_connectable_; }

  // Indicates if this service supports RFCOMM communication.
  bool SupportsRfcomm() const { return supports_rfcomm_; }

  // The RFCOMM channel to use, if this service supports RFCOMM communication.
  // The return value is undefined if SupportsRfcomm() returns false.
  uint8 rfcomm_channel() const { return rfcomm_channel_; }

 protected:
  BluetoothServiceRecord();

  std::string address_;
  std::string name_;
  std::string uuid_;

  bool supports_hid_;
  bool hid_reconnect_initiate_;
  bool hid_normally_connectable_;

  bool supports_rfcomm_;
  uint8 rfcomm_channel_;

 private:
  DISALLOW_COPY_AND_ASSIGN(BluetoothServiceRecord);
};

}  // namespace device

#endif  // DEVICE_BLUETOOTH_BLUETOOTH_SERVICE_RECORD_H_