#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>

namespace Ui {
class MainWindow;
}

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();

private slots:
    void on_pushButton_clicked();

    void on_pushButton_2_clicked();

    void on_pushButton_3_clicked();

    void on_pushButton_6_clicked();

    void on_pushButton_7_clicked();

    void on_pushButton_8_clicked();

    void on_pushButton_9_clicked();

    void on_pushButton_10_clicked();

    void on_pushButton_11_clicked();

    void on_pushButton_12_clicked();

    void on_pushButton_13_clicked();

    void on_pushButton_14_clicked();

    void on_pushButton_15_clicked();

    void on_pushButton_16_clicked();

    void on_pushButton_17_clicked();

    void on_pushButton_18_clicked();

    void on_pushButton_19_clicked();

    void on_pushButton_20_clicked();

    void on_pushButton_21_clicked();

    void on_pushButton_22_clicked();

    void on_pushButton_23_clicked();

    void on_pushButton_24_clicked();

    void on_pushButton_25_clicked();

    void on_pushButton_27_clicked();

    void on_pushButton_26_clicked();

    void on_pushButton_28_clicked();

    void on_action_triggered();

    void on_action_2_triggered();

    void on_action_3_triggered();

private:
    Ui::MainWindow *ui;
};


#ifdef WINDOWS
    #include <Windows.h>
    #define DLL_API __stdcall
    #define LoadLibraryM(x) LoadLibraryEx(x, 0, LOAD_WITH_ALTERED_SEARCH_PATH);
#else
    #include <sys/time.h>
    #include <dlfcn.h>
    #include <pthread.h>
#ifdef ANDROID
    #include "miconv.h"
#else
    #include <iconv.h>
#endif
    #define DLL_API
    #define HINSTANCE void*
    #define LoadLibraryM(x) dlopen(x, RTLD_LAZY);
    #define GetProcAddress dlsym
    #define FreeLibrary dlclose
    #define CRITICAL_SECTION pthread_mutex_t
    #define InitializeCriticalSection(x) pthread_mutex_init(x, NULL)
    #define EnterCriticalSection pthread_mutex_lock
    #define LeaveCriticalSection pthread_mutex_unlock
    #define DeleteCriticalSection pthread_mutex_destroy
#endif

typedef long (DLL_API *_SetTerminalLibrary)(char* LibraryFileName);
typedef long (DLL_API *_SetAutoPara)(char* PortType,char* PortPara,char* ExtendPara);
typedef long (DLL_API *_OpenDevice)(char* PortType,char* PortPara,char* ExtendPara);
typedef long (DLL_API *_SetCurrentDevice)(long DevHandle);
typedef long (DLL_API *_GetCurrentDevice)();
typedef long (DLL_API *_CloseDevice)();
typedef long (DLL_API *_TerminalGetModel)(char* TerminalModel);
typedef long (DLL_API *_TerminalGetFirmVersion)(char* FirmVersion,char* HardwareVersion);
typedef long (DLL_API *_TerminalHeartBeat)();
typedef long (DLL_API *_GetLastRecvData)(unsigned char* LastRecvData);
typedef long (DLL_API *_IdFindCard)();
typedef long (DLL_API *_IdSelectCard)();
typedef long (DLL_API *_IdReadBaseMsg)(unsigned char* pucCHMsg,long* puiCHMsgLen,unsigned char* pucPHMsg,long* puiPHMsgLen);
typedef long (DLL_API *_IdReadBaseFpMsg)(unsigned char* pucCHMsg,long* puiCHMsgLen,unsigned char* pucPHMsg,long* puiPHMsgLen,unsigned char* pucFPMsg,long* puiFPMsgLen);
typedef long (DLL_API *_IdReadNewAppMsg)(unsigned char* pucAppMsg,long* puiAppMsgLen);
typedef long (DLL_API *_IdReadSn)(unsigned char* SN,long* SNLen);
typedef long (DLL_API *_IdApdu)(long SendApduLen,unsigned char* SendApdu,unsigned char* RecvApdu,long* RecvApduLen);
typedef long (DLL_API *_SdtFindCard)(unsigned char* pucManaInfo);
typedef long (DLL_API *_SdtSelectCard)(unsigned char* pucManaMsg);
typedef long (DLL_API *_SdtReadBaseMsg)(unsigned char* pucCHMsg,long* puiCHMsgLen,unsigned char* pucPHMsg,long* puiPHMsgLen);
typedef long (DLL_API *_SdtReadBaseFpMsg)(unsigned char* pucCHMsg,long* puiCHMsgLen,unsigned char* pucPHMsg,long* puiPHMsgLen,unsigned char* pucFPMsg,long* puiFPMsgLen);
typedef long (DLL_API *_SdtReadNewAppMsg)(unsigned char* pucAppMsg,long* puiAppMsgLen);
typedef long (DLL_API *_SamGetStatus)();
typedef long (DLL_API *_SamGetId)(unsigned char* SamId,long* SamIdLen);
typedef long (DLL_API *_SamGetIdStr)(char* SamIdStr);
typedef long (DLL_API *_SdtSamGetStatus)();
typedef long (DLL_API *_SdtSamGetId)(unsigned char* SamId,long* SamIdLen);
typedef long (DLL_API *_SdtSamGetIdStr)(char* SamIdStr);
typedef long (DLL_API *_IdReadCard)(unsigned char CardType,unsigned char InfoEncoding,char* IdCardInfo,long TimeOutMs);
typedef long (DLL_API *_SdtReadCard)(unsigned char CardType,unsigned char InfoEncoding,char* IdCardInfo,long TimeOutMs);
typedef long (DLL_API *_IdReadNewAddress)(char* NewAddress);
typedef long (DLL_API *_SdtReadNewAddress)(char* NewAddress);
typedef long (DLL_API *_IdCardGetRawInfo)(unsigned char* CHMsg,long* CHMsgLen,unsigned char* PHMsg,long* PHMsgLen,unsigned char* FPMsg,long* FPMsgLen);
typedef long (DLL_API *_IdCardGetName)(char* Name);
typedef long (DLL_API *_IdCardGetNameEn)(char* NameEn);
typedef long (DLL_API *_IdCardGetGender)(char* Gender);
typedef long (DLL_API *_IdCardGetGenderId)(char* GenderId);
typedef long (DLL_API *_IdCardGetNation)(char* Nation);
typedef long (DLL_API *_IdCardGetNationId)(char* NationId);
typedef long (DLL_API *_IdCardGetBirthDate)(char* BirthDate);
typedef long (DLL_API *_IdCardGetAddress)(char* Address);
typedef long (DLL_API *_IdCardGetIdNumber)(char* IdNumber);
typedef long (DLL_API *_IdCardGetSignOrgan)(char* SignOrgan);
typedef long (DLL_API *_IdCardGetBeginTerm)(char* BeginTerm);
typedef long (DLL_API *_IdCardGetValidTerm)(char* ValidTerm);
typedef long (DLL_API *_IdCardGetTypeFlag)(char* TypeFlag);
typedef long (DLL_API *_IdCardGetVersion)(char* Version);
typedef long (DLL_API *_IdCardGetFPBuffer)(unsigned char* FPBuffer,long* FPBufferLen);
typedef long (DLL_API *_IdCardGetPhotoFile)(char* PhotoFile);
typedef long (DLL_API *_IdCardGetPhotoBuffer)(unsigned char WltBmpJpg,unsigned char* PhotoBuffer,long* PhotoBufferLen);
typedef long (DLL_API *_MagRead)(unsigned char Tracks,char* TrackData1,char* TrackData2,char* TrackData3,unsigned char TimeOutSec);
typedef long (DLL_API *_MagWrite)(unsigned char Tracks,char* TrackData1,char* TrackData2,char* TrackData3,unsigned char TimeOutSec);
typedef long (DLL_API *_QrRead)(char* QrData,unsigned char TimeOutSec);
typedef long (DLL_API *_CpuPowerOn)(unsigned char Slot,unsigned char* ATRS,long* ATRSLen);
typedef long (DLL_API *_CpuApdu)(unsigned char Slot,long SendApduLen,unsigned char* SendApdu,unsigned char* RecvApdu,long* RecvApduLen);
typedef long (DLL_API *_CpuPowerOff)(unsigned char Slot);
typedef long (DLL_API *_M1FindCard)(unsigned char* UID,long* UIDLen);
typedef long (DLL_API *_M1Authentication)(unsigned char KeyType,unsigned char SecAddr,unsigned char* Key,unsigned char* UID);
typedef long (DLL_API *_M1ReadBlock)(unsigned char BlockAddr,unsigned char* BlockData,long* BlockDataLen);
typedef long (DLL_API *_M1WriteBlock)(unsigned char BlockAddr,long BlockDataLen,unsigned char* BlockData);
typedef long (DLL_API *_M1Halt)();
typedef long (DLL_API *_M0FindCard)(unsigned char* UID,long* UIDLen);
typedef long (DLL_API *_M0Authentication)(unsigned char* Key);
typedef long (DLL_API *_M0ReadBlock)(unsigned char BlockAddr,unsigned char* BlockData,long* BlockDataLen);
typedef long (DLL_API *_M0WriteBlock)(unsigned char BlockAddr,long BlockDataLen,unsigned char* BlockData);
typedef long (DLL_API *_M0Halt)();
typedef long (DLL_API *_FpCapFeature)(unsigned char* Feature,long* FeatureLen);
typedef long (DLL_API *_FpMatchFeature)(long FeatureLen1,unsigned char* Feature1,long FeatureLen2,unsigned char* Feature2,long* Score);
typedef long (DLL_API *_SsseReadCard)(int iType,char* SSCardInfo,char* SSErrorInfo);
typedef long (DLL_API *_SsseGetCardInfo)(char* Tag,char* SSCardInfo);
typedef long (DLL_API *_IccGetCardInfo)(int ICtype,char* AIDList,char* TagList,char* IcCardInfo);
typedef long (DLL_API *_IccGetARQC)(int ICtype,char* trData,char* AIDList,char* ARQC,char* trAppData);
typedef long (DLL_API *_IccARPCExeScript)(int ICtype,char* trData,char* ARPC,char* trAppData,char* ScriptResult,char* TC);
typedef long (DLL_API *_IccVerifyScript)(int ICtype,char* trData,char* ARPC,char* trAppData,char* ScriptResult,char* TC);
typedef long (DLL_API *_IccGetTrDetail)(int ICtype,char* AIDList,char* TrDetail);
typedef long (DLL_API *_IccGetLoadDetail)(int ICtype,char* AIDList,char* LoadDetail);
typedef long (DLL_API *_HexToAsc)(unsigned char* Hex,long HexLength,char* Asc);
typedef long (DLL_API *_AscToHex)(char* Asc,long HexLength,unsigned char* Hex);


#endif // MAINWINDOW_H
