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.

FreeFareTagBusiness.h 1.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. //
  2. // Created by robin on 7/22/16.
  3. //
  4. #ifndef MIFARE_TOOLS_FREEFARETAGBUSINESS_H
  5. #define MIFARE_TOOLS_FREEFARETAGBUSINESS_H
  6. #include <boost/shared_ptr.hpp>
  7. #include <DataAccess/FreeFareTag.h>
  8. #include <DataAccess/SectorDbo.h>
  9. typedef std::vector<std::pair<std::string, std::string>> MappedKeys;
  10. class FreeFareTagBusiness
  11. {
  12. public:
  13. FreeFareTagBusiness(std::shared_ptr<FreeFareTag> tag);
  14. ResultBool authenticate(int sector, std::string key, int keyType);
  15. Result<MappedKeys> mapKeys(std::vector<std::string> keys, std::function<void(int, int)> cb = 0);
  16. ResultString readBlock(int sector, int block, std::string key, int keyType);
  17. Result<SectorDbo> readSector(int sector, std::string key, int keyType);
  18. Result<std::vector<SectorDbo>> read(MappedKeys keys, std::function<void(int, int)> cb = 0);
  19. Result<std::vector<SectorDbo>> read(std::vector<std::string> keys, std::function<void(int, int)> mapCb = 0,
  20. std::function<void(int, int)> dumpCb = 0);
  21. ResultBool writeBlock(int sector, int block, std::string key, int keyType, const std::string& data);
  22. ResultBool writeSector(int sector, std::string key, int keyType, const std::string& data);
  23. ResultBool write(MappedKeys keys, const std::string& data, bool writeSector0, std::function<void(int, int)> cb = 0);
  24. ResultBool write(std::vector<std::string> keys, const std::string& data, bool writeSector0,
  25. std::function<void(int, int)> mapCb = 0, std::function<void(int, int)> dumpCb = 0);
  26. const std::string& getUid() const;
  27. freefare_tag_type getType() const;
  28. std::shared_ptr<FreeFareTag> getTag() const;
  29. protected:
  30. std::shared_ptr<FreeFareTag> _tag;
  31. };
  32. #endif //MIFARE_TOOLS_FREEFARETAGBUSINESS_H