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.

FreeFareAccessBits.h 1.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. //
  2. // Created by robin on 7/21/16.
  3. //
  4. #ifndef MIFARE_TOOLS_ACCESSBITSDBO_H
  5. #define MIFARE_TOOLS_ACCESSBITSDBO_H
  6. #include <string>
  7. namespace LibNfc
  8. {
  9. namespace FreeFare
  10. {
  11. class FreeFareAccessBits
  12. {
  13. public:
  14. static const char nonInvertedBitPosition[4][4];
  15. static const char invertedBitPosition[4][4];
  16. FreeFareAccessBits();
  17. FreeFareAccessBits(const std::string& bits);
  18. char getUserData() const;
  19. void setUserData(const char& data);
  20. void setBit(int i, int j, const bool& value);
  21. bool getBit(int i, int j) const;
  22. std::string getBits() const;
  23. bool canKeyAReadBlock(int block) const;
  24. bool canKeyBReadBlock(int block) const;
  25. bool canKeyAWriteBlock(int block) const;
  26. bool canKeyBWriteBlock(int block) const;
  27. bool canKeyAIncrementBlock(int block) const;
  28. bool canKeyBIncrementBlock(int block) const;
  29. bool canKeyADecrementBlock(int block) const;
  30. bool canKeyBDecrementBlock(int block) const;
  31. bool canKeyAReadKeyATrailer() const;
  32. bool canKeyBReadKeyATrailer() const;
  33. bool canKeyAWriteKeyATrailer() const;
  34. bool canKeyBWriteKeyATrailer() const;
  35. bool canKeyAReadAccessBitsTrailer() const;
  36. bool canKeyBReadAccessBitsTrailer() const;
  37. bool canKeyAWriteAccessBitsTrailer() const;
  38. bool canKeyBWriteAccessBitsTrailer() const;
  39. bool canKeyAReadKeyBTrailer() const;
  40. bool canKeyBReadKeyBTrailer() const;
  41. bool canKeyAWriteKeyBTrailer() const;
  42. bool canKeyBWriteKeyBTrailer() const;
  43. private:
  44. std::string _bits;
  45. };
  46. }; // FreeFare
  47. }; // LibNfc
  48. #endif //MIFARE_TOOLS_ACCESSBITSDBO_H