Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

FreeFareTagBusiness.cpp 1022B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. //
  2. // Created by robin on 7/22/16.
  3. //
  4. #include "FreeFareTagBusiness.h"
  5. FreeFareTagBusiness::FreeFareTagBusiness(std::shared_ptr<FreeFareTag> tag)
  6. : _tag(tag)
  7. {
  8. }
  9. ResultBool FreeFareTagBusiness::authenticate(int sector, int block, std::string key, int keyType)
  10. {
  11. return _tag->authenticate(sector, block, key, keyType);
  12. }
  13. ResultString FreeFareTagBusiness::readBlock(int sector, int block, std::string key, int keyType)
  14. {
  15. return _tag->readBlock(sector, block, key, keyType);
  16. }
  17. ResultString FreeFareTagBusiness::readSector(int sector, std::string key, int keyType)
  18. {
  19. std::string res;
  20. for (int i = 0; i < 4; ++i) {
  21. auto data = readBlock(sector, i, key, keyType);
  22. if (data) {
  23. res += data.getData();
  24. }
  25. else {
  26. return data;
  27. }
  28. }
  29. return ResultString::ok(res);
  30. }
  31. const std::string &FreeFareTagBusiness::getUid() const
  32. {
  33. return _tag->getUid();
  34. }
  35. std::shared_ptr<FreeFareTag> FreeFareTagBusiness::getTag() const
  36. {
  37. return _tag;
  38. }