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.

NfcDeviceBusiness.cpp 693B

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