/* * KeyA.h * * Created on: Aug 19, 2008 * Author: Hedayat Vatankhah , 2008. */ #ifndef KEYA_H_ #define KEYA_H_ #include "keya_types.h" /** This can be sent to OpenDevice function to open the next keya device */ #define KEYA_NEXT_ID(keya) keya.GetKeyAID() + 1 class KeyA { public: KeyA(uint moduleType = _HID_CLASS); virtual ~KeyA(); static uint GetModuleCount(); static uint EncBlock(const byte *pKey, const byte *pData, byte *pRes); static uint DecBlock(const byte *pKey, const byte *pData, byte *pRes); static char *GetErrorText(int lastError, char *perrText, uint buflen); uint OpenDevice(int id); uint CloseDevice(); int GetKeyAID(); uint SetModuleType(uint moduleType); uint SetKeyAFunctionality(uint keyaFun); uint Init(const byte *pKp, const byte *pKr, const byte *pKw, const byte *pKw2); uint NetInit(const byte *pKp, const byte *pKr, const byte *pKw, const byte *pKw2); uint SetCallBackProc(CallbackProc pAttachCallBack, void *param); uint SetAttachCallBackProc(PureAttachCallbackProc pAttachCallBack); uint SetCallBackWithIDProc(CallbackProcWithID callback, void *param); void SetCallbackErrorHandlerProc(CallbackErrorHandler handler); int GetCallbackThreadErrorNumber(); uint SetKAB(const byte *pKA, const byte *pKAB); uint SetKeyAParameters(const byte *pKA, byte *pData); uint ChangeKAB(const byte *pKAB, const byte *pNewKAB); uint WriteAccessKey(const byte *pKBB); uint ReadPayamPardazMemory(int address, int len, byte *pBuf); uint WritePayamPardazMemory(int address, int len, const byte *pKA, const byte *pData); uint ReadFreeMemory(int address, int len, byte *pBuf); uint WriteFreeMemory(int address, int len, const byte *pBuf); uint ReadUserMemory(int address, int len, const byte *pUserKey, byte *pBuf); uint WriteUserMemory(int address, int len, const byte *pUserKey, const byte *pBuf); uint ReadUserMemory(int address, int len, byte *pBuf); uint WriteUserMemory(int address, int len, const byte *pBuf); uint ReadDeveloperMemory(int address, int len, byte *pBuf); uint WriteDeveloperMemory(int address, int len, const byte *pBuf); uint SetMasterPin(const char *pPin, byte pinLen); uint SetUserPin(const char *pPin, byte pinLen); uint UserLogin(const char *pPin, byte pinLen); uint MasterLogin(const char *pPin, byte pinLen); //////////////////// New Functions ////////////////// uint GetAutoLoginStatus(); uint ResetAutoLogin(); uint SetAutoLogin(const char *pUserPin, int PinLen, const byte *pAutoLoginKey ); uint AutoLogin(const byte *pAutoLoginKey ); uint SetModuleName(const char *strModuleName ); uint GetModuleName(char *strModuleName, int nModuleNameSize ); //////////////////////////////////////////////////////////// uint SetKV(byte iKVIndex, const byte *pKV); uint EncByKV(byte iKvIndex, const byte *pData, byte *pRes); uint DecByKV(byte iKvIndex, const byte *pData, byte *pRes); uint SetQuery(byte iQueryIndex, const byte *pQueryKey); uint GetQuery(byte iQueryIndex, const byte *pQueryData, byte *pQueryResult); uint EncByCustomKey(const byte *pCusKey, const byte *pData, byte *pRes); uint DecByCustomKey(const byte *pCusKey, const byte *pData, byte *pRes); uint CheckModuleExistence(); uint GetSerialNumber(byte *pSerialNum); uint GetMemoryInfo(int *pDevMemLen, int *pSecMemLen, int *pFMemLen); uint GetVersionInfo(byte *pVer, byte *pDevMemSup, byte *pFmemSup, byte *pLoginSup, byte *pCusKeySup); uint GetKeyCount(int *pQueryKeyNum, int *pKVKeyNum); uint SetMaxClient(byte clientNum); uint GetMaxClient(byte *pClientNum); private: KeyAHID *keya; KeyA(KeyA &); }; #endif /* KEYA_H_ */