| 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 #include "device/bluetooth/bluetooth_uuid.h" | |
| 12 | 11 |
| 13 namespace device { | 12 namespace device { |
| 14 | 13 |
| 15 // BluetoothServiceRecord represents an SDP service record. | 14 // BluetoothServiceRecord represents an SDP service record. |
| 16 // | 15 // |
| 17 // This implementation is currently incomplete: it only supports those fields | 16 // This implementation is currently incomplete: it only supports those fields |
| 18 // that have been necessary so far. | 17 // that have been necessary so far. |
| 19 class BluetoothServiceRecord { | 18 class BluetoothServiceRecord { |
| 20 public: | 19 public: |
| 21 virtual ~BluetoothServiceRecord(); | 20 virtual ~BluetoothServiceRecord(); |
| 22 | 21 |
| 23 // The human-readable name of this service. | 22 // The human-readable name of this service. |
| 24 const std::string& name() const { return name_; } | 23 const std::string& name() const { return name_; } |
| 25 | 24 |
| 26 // The address of the BluetoothDevice providing this service. | 25 // The address of the BluetoothDevice providing this service. |
| 27 const std::string& address() const { return address_; } | 26 const std::string& address() const { return address_; } |
| 28 | 27 |
| 29 // 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 |
| 30 // specified in the service record. | 29 // specified in the service record. |
| 31 const BluetoothUUID& uuid() const { return uuid_; } | 30 const std::string& uuid() const { return uuid_; } |
| 32 | 31 |
| 33 // Indicates if this service supports HID. | 32 // Indicates if this service supports HID. |
| 34 bool SupportsHid() const { return supports_hid_; } | 33 bool SupportsHid() const { return supports_hid_; } |
| 35 | 34 |
| 36 // For HID services, returns the HIDReconnectInitiate attribute. For non-HID | 35 // For HID services, returns the HIDReconnectInitiate attribute. For non-HID |
| 37 // or unknown services defaults to true. | 36 // or unknown services defaults to true. |
| 38 bool hid_reconnect_initiate() const { return hid_reconnect_initiate_; } | 37 bool hid_reconnect_initiate() const { return hid_reconnect_initiate_; } |
| 39 | 38 |
| 40 // For HID services, returns the HIDNormallyConnectable attribute. For non-HID | 39 // For HID services, returns the HIDNormallyConnectable attribute. For non-HID |
| 41 // or unknown services defaults to true. | 40 // or unknown services defaults to true. |
| 42 bool hid_normally_connectable() const { return hid_normally_connectable_; } | 41 bool hid_normally_connectable() const { return hid_normally_connectable_; } |
| 43 | 42 |
| 44 // Indicates if this service supports RFCOMM communication. | 43 // Indicates if this service supports RFCOMM communication. |
| 45 bool SupportsRfcomm() const { return supports_rfcomm_; } | 44 bool SupportsRfcomm() const { return supports_rfcomm_; } |
| 46 | 45 |
| 47 // The RFCOMM channel to use, if this service supports RFCOMM communication. | 46 // The RFCOMM channel to use, if this service supports RFCOMM communication. |
| 48 // The return value is undefined if SupportsRfcomm() returns false. | 47 // The return value is undefined if SupportsRfcomm() returns false. |
| 49 uint8 rfcomm_channel() const { return rfcomm_channel_; } | 48 uint8 rfcomm_channel() const { return rfcomm_channel_; } |
| 50 | 49 |
| 51 protected: | 50 protected: |
| 52 BluetoothServiceRecord(); | 51 BluetoothServiceRecord(); |
| 53 | 52 |
| 54 std::string address_; | 53 std::string address_; |
| 55 std::string name_; | 54 std::string name_; |
| 56 BluetoothUUID uuid_; | 55 std::string uuid_; |
| 57 | 56 |
| 58 bool supports_hid_; | 57 bool supports_hid_; |
| 59 bool hid_reconnect_initiate_; | 58 bool hid_reconnect_initiate_; |
| 60 bool hid_normally_connectable_; | 59 bool hid_normally_connectable_; |
| 61 | 60 |
| 62 bool supports_rfcomm_; | 61 bool supports_rfcomm_; |
| 63 uint8 rfcomm_channel_; | 62 uint8 rfcomm_channel_; |
| 64 | 63 |
| 65 private: | 64 private: |
| 66 DISALLOW_COPY_AND_ASSIGN(BluetoothServiceRecord); | 65 DISALLOW_COPY_AND_ASSIGN(BluetoothServiceRecord); |
| 67 }; | 66 }; |
| 68 | 67 |
| 69 } // namespace device | 68 } // namespace device |
| 70 | 69 |
| 71 #endif // DEVICE_BLUETOOTH_BLUETOOTH_SERVICE_RECORD_H_ | 70 #endif // DEVICE_BLUETOOTH_BLUETOOTH_SERVICE_RECORD_H_ |
| OLD | NEW |