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.

MainClass.h 1.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. //
  2. // Created by robin on 8/8/15.
  3. //
  4. #ifndef PDNS_SLAVE_MAINCLASS_H
  5. #define PDNS_SLAVE_MAINCLASS_H
  6. #include <memory>
  7. #include <libnfc_cpptools/FreeFareTag.h>
  8. #include <libnfc_cpptools/NfcDevice.h>
  9. class MainClass {
  10. public:
  11. enum Actions {
  12. Read,
  13. Write,
  14. Map,
  15. Devices,
  16. Tags
  17. };
  18. MainClass(int argc, char* argv[]);
  19. int main();
  20. std::shared_ptr<LibNfc::Core::NfcDevice> getDevice(const std::string& deviceName, std::vector<std::shared_ptr<LibNfc::Core::NfcDevice>> devices);
  21. std::shared_ptr<LibNfc::FreeFare::FreeFareTag> getTag(const std::string& tagUid, std::vector<std::shared_ptr<LibNfc::FreeFare::FreeFareTag>> tags);
  22. int mapKeys(std::shared_ptr<LibNfc::FreeFare::FreeFareTag> tag, std::vector<std::string> keys);
  23. int read(std::shared_ptr<LibNfc::FreeFare::FreeFareTag> tag, std::vector<std::string> keys);
  24. int write(std::shared_ptr<LibNfc::FreeFare::FreeFareTag> tag, std::vector<std::string> keys, const std::string& data);
  25. LibNfc::Utils::Result<std::vector<std::string>> readFile(const std::string& filePath);
  26. LibNfc::Utils::Result<std::vector<std::string>> readStream(std::istream& stream);
  27. void printSectors(const std::vector<LibNfc::FreeFare::FreeFareSector>& sectors);
  28. void printBlockAccessBits(const LibNfc::FreeFare::FreeFareAccessBits& accessBits, int block);
  29. void printTrailerAccessBits(const LibNfc::FreeFare::FreeFareAccessBits& accessBits);
  30. void printVersion();
  31. std::ostream& cout();
  32. std::istream& cin();
  33. static void printPercent(int done, int total, const std::string& header);
  34. static void printPercentMapKeys(int done, int total);
  35. static void printPercentDump(int done, int total);
  36. static void printPercentWrite(int done, int total);
  37. private:
  38. int _argc;
  39. char** _argv;
  40. std::shared_ptr<std::ofstream> _outputStream;
  41. std::shared_ptr<std::ifstream> _inputStream;
  42. };
  43. #endif //PDNS_SLAVE_MAINCLASS_H