bluetooth_service_record_win.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. // Copyright (c) 2013 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.
  4. #ifndef DEVICE_BLUETOOTH_BLUETOOTH_SERVICE_RECORD_WIN_H_
  5. #define DEVICE_BLUETOOTH_BLUETOOTH_SERVICE_RECORD_WIN_H_
  6. #include <stdint.h>
  7. #include <string>
  8. #include <vector>
  9. #include "device/bluetooth/bluetooth_export.h"
  10. #include "device/bluetooth/bluetooth_init_win.h"
  11. #include "device/bluetooth/public/cpp/bluetooth_uuid.h"
  12. namespace device {
  13. class DEVICE_BLUETOOTH_EXPORT BluetoothServiceRecordWin {
  14. public:
  15. BluetoothServiceRecordWin(const std::string& device_address,
  16. const std::string& name,
  17. const std::vector<uint8_t>& sdp_bytes,
  18. const BluetoothUUID& gatt_uuid);
  19. BluetoothServiceRecordWin(const BluetoothServiceRecordWin&) = delete;
  20. BluetoothServiceRecordWin& operator=(const BluetoothServiceRecordWin&) =
  21. delete;
  22. bool IsEqual(const BluetoothServiceRecordWin& other);
  23. // The BTH_ADDR address of the BluetoothDevice providing this service.
  24. BTH_ADDR device_bth_addr() const { return device_bth_addr_; }
  25. // The address of the BluetoothDevice providing this service.
  26. const std::string& device_address() const { return device_address_; }
  27. // The human-readable name of this service.
  28. const std::string& name() const { return name_; }
  29. // The UUID of the service. This field may be empty if no UUID was
  30. // specified in the service record.
  31. const BluetoothUUID& uuid() const { return uuid_; }
  32. // Indicates if this service supports RFCOMM communication.
  33. bool SupportsRfcomm() const { return supports_rfcomm_; }
  34. // The RFCOMM channel to use, if this service supports RFCOMM communication.
  35. // The return value is undefined if SupportsRfcomm() returns false.
  36. uint8_t rfcomm_channel() const { return rfcomm_channel_; }
  37. private:
  38. BTH_ADDR device_bth_addr_;
  39. std::string device_address_;
  40. std::string name_;
  41. BluetoothUUID uuid_;
  42. bool supports_rfcomm_;
  43. uint8_t rfcomm_channel_;
  44. };
  45. } // namespace device
  46. #endif // DEVICE_BLUETOOTH_BLUETOOTH_SERVICE_RECORD_WIN_H_