1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- //
- // Created by robin on 7/22/16.
- //
-
- #ifndef MIFARE_TOOLS_FREEFARETAGBUSINESS_H
- #define MIFARE_TOOLS_FREEFARETAGBUSINESS_H
-
-
- #include <boost/shared_ptr.hpp>
- #include <libnfc_cpptools/FreeFareSector.h>
-
- namespace LibNfc
- {
- namespace FreeFare
- {
-
- class FreeFareTagInternal;
-
- typedef std::vector<std::pair<std::string, std::string>> MappedKeys;
-
- class FreeFareTag
- {
- public:
- enum FreeFareTagType {
- UNKNOWN,
- FELICA,
- MIFARE_MINI,
- MIFARE_CLASSIC_1K,
- MIFARE_CLASSIC_4K,
- MIFARE_DESFIRE,
- MIFARE_ULTRALIGHT,
- MIFARE_ULTRALIGHT_C
- };
-
- static std::string getTagTypeString(FreeFareTagType type);
-
- FreeFareTag(std::shared_ptr<FreeFareTagInternal> tag);
-
- LibNfc::Utils::ResultBool authenticate(int sector, std::string key, int keyType);
-
- LibNfc::Utils::Result<MappedKeys> mapKeys(std::vector<std::string> keys, std::function<void(int, int)> cb = 0);
-
- LibNfc::Utils::ResultString readBlock(int sector, int block, std::string key, int keyType);
-
- LibNfc::Utils::Result<FreeFareSector> readSector(int sector, std::string key, int keyType);
-
- LibNfc::Utils::Result<std::vector<FreeFareSector>> read(MappedKeys keys, std::function<void(int, int)> cb = 0);
-
- LibNfc::Utils::Result<std::vector<FreeFareSector>> read(std::vector<std::string> keys, std::function<void(int, int)> mapCb = 0,
- std::function<void(int, int)> readCb = 0);
-
- LibNfc::Utils::ResultBool writeBlock(int sector, int block, std::string key, int keyType, const std::string& data);
-
- LibNfc::Utils::ResultBool writeSector(int sector, std::string key, int keyType, const std::string& data);
-
- LibNfc::Utils::ResultBool write(MappedKeys keys, const std::string& data, bool writeSector0, std::function<void(int, int)> cb = 0);
-
- LibNfc::Utils::ResultBool write(std::vector<std::string> keys, const std::string& data, bool writeSector0,
- std::function<void(int, int)> mapCb = 0, std::function<void(int, int)> writeCb = 0);
-
- const std::string& getUid() const;
-
- FreeFareTagType getType() const;
-
- std::shared_ptr<FreeFareTagInternal> getTag() const;
-
- protected:
- std::shared_ptr<FreeFareTagInternal> _tag;
- };
-
- }; // FreeFare
- }; // LibNfc
-
- #endif //MIFARE_TOOLS_FREEFARETAGBUSINESS_H
|