You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

NfcDevice.cpp 784B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. //
  2. // Created by robin on 7/22/16.
  3. //
  4. #include "libnfc_cpptools/NfcDevice.h"
  5. #include "NfcDeviceInternal.h"
  6. namespace LibNfc
  7. {
  8. namespace Core
  9. {
  10. NfcDevice::NfcDevice(std::shared_ptr<NfcDeviceInternal> device)
  11. : _device(device)
  12. {
  13. }
  14. LibNfc::Utils::ResultBool NfcDevice::open()
  15. {
  16. if (isOpened()) {
  17. return LibNfc::Utils::ResultBool::error("NFC device is already opened");
  18. }
  19. return _device->open();
  20. }
  21. void NfcDevice::close()
  22. {
  23. if (isOpened()) {
  24. _device->close();
  25. }
  26. }
  27. bool NfcDevice::isOpened() const
  28. {
  29. return _device->getDevice() != 0;
  30. }
  31. const std::string &NfcDevice::getConnStr() const
  32. {
  33. return _device->getConnStr();
  34. }
  35. std::shared_ptr<NfcDeviceInternal> NfcDevice::getDevice() const
  36. {
  37. return _device;
  38. }
  39. }; // Core
  40. }; // LibNfc