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.

FreeFareDeviceBusiness.cpp 993B

12345678910111213141516171819202122232425262728
  1. //
  2. // Created by robin on 7/22/16.
  3. //
  4. #include "FreeFareDeviceBusiness.h"
  5. FreeFareDeviceBusiness::FreeFareDeviceBusiness(std::shared_ptr<NfcDeviceBusiness> device)
  6. : _device(device),
  7. _freeFareDevice(std::make_shared<FreeFareDevice>(_device->getDevice()))
  8. {
  9. }
  10. Result<std::vector<std::shared_ptr<FreeFareTagBusiness>>> FreeFareDeviceBusiness::getTags() const
  11. {
  12. if (!_device->isOpened()) {
  13. return Result<std::vector<std::shared_ptr<FreeFareTagBusiness>>>::error("Device is not opened");
  14. }
  15. auto tagsResult = _freeFareDevice->getTags();
  16. if (!tagsResult) {
  17. return Result<std::vector<std::shared_ptr<FreeFareTagBusiness>>>::error(tagsResult);
  18. }
  19. auto tags = tagsResult.getData();
  20. std::vector<std::shared_ptr<FreeFareTagBusiness>> tagsBusiness;
  21. for (auto tag : tags) {
  22. tagsBusiness.push_back(std::make_shared<FreeFareTagBusiness>(tag));
  23. }
  24. return Result<std::vector<std::shared_ptr<FreeFareTagBusiness>>>::ok(tagsBusiness);
  25. }