#ifndef __LIBDLL_H__
#define __LIBDLL_H__

#define ALLERROR                        0xFFFFFFFF
#define ALLNOERROR                      0x00000000
#define ERRORSTEP(x)                    (0x1<<x)
#define ERROR_NORESOURCE                0x00000001                     
#define ERROR_NOSPACE                   0x00000002                     
#define ERROR_PARAMETER                 0x00000004                     
#define ERROR_WLAN_QUIRY_INTERFACE      0x00000008                     
#define ERROR_WLAN_SSID_REPEAT          0x00000010                     
#define ERROR_WLAN_NO_PRSSID_LIST       0x00000011                     
#define ERROR_WLAN_NO_ASSOCIATED        0X00000012                     
#define ERROR_WLAN_NO_AVAILABLE_LIST    0x00000013                     
#define ERROR_WLAN_NO_CONNECTED         0x00000014                     
#define ERROR_WLAN_SSID_UNKNOWN         0x00000018                     
#define ERROR_WLAN_QUIRY_FAILED         0x00000021                     
#define ERROR_BT_SERVICE                0x00000020                     


#ifdef __cplusplus
extern "C" {
#endif

#ifdef LIBDLL_EXPORTS
#define LIBDLL_API __declspec(dllexport)
#else
#define LIBDLL_API __declspec(dllimport)
#endif

typedef struct
{
    BOOL    FullKey;
    BOOL    TaskKey;
    BOOL    FuncKey;
    BOOL    AlphaKey;
}KEYPADLOCK, *PKEYPADLOCK;

typedef struct
{
    TCHAR   szClass[64];
}KEYPADBIND, *PKEYPADBIND;


typedef struct
{
    BOOL    CardInserted;
    BOOL    CardPowered;
    TCHAR   VENDER[32];
    TCHAR   PRODUCT[32];
}CARDINFO, *PCARDINFO;

typedef struct
{
    TCHAR   PIN[12];
        //BOOL SAMEPIN;
}PINNUM, *PPINNUM;

typedef struct
{
    TCHAR   MANUIDENNUM[100];
}MANUINFO, *PMANUINFO;


typedef struct
{
    TCHAR   APINUM[5];
}APIVER, *PAPIVER;

typedef struct _SYSINFO {
    BYTE   SerialNum[16];
    BYTE   DevCFG[16];
    BYTE   ManuDate[16];
    BYTE   OsVer[20];
    BYTE   DevDesc[20];
    BYTE   Manufactory[20];
} SYSINFO, *PSYSINFO;

typedef struct _BKLCTL {
    DWORD   batttimeout;
    DWORD   lightlevel;
    DWORD   actimeout;
    DWORD   aclightlevel;
    DWORD   backlightontap;
    DWORD   acbacklightontap;
    DWORD   usebattery;
    DWORD   useext;
} BKLCTL, *PBKLCTL;

typedef struct{
    UINT    uDeviceId;
    UINT    uMsg;
    DWORD   dwUser;
    DWORD   dwParam1;
    DWORD   dwParam2;
}AUDIO_MESSAGE_PARAMS;

typedef struct _WLANCTL {
    CHAR    SSID[32];
    DWORD   authentication;
    DWORD   encryption;
    DWORD   adhoc;
    DWORD   eap;
    WCHAR   key[80];
} WLANCTL, *PWLANCTL;

typedef struct _WLANCONNECTEDST {
    CHAR    SSID[32];
    DWORD   SSIDLength;
    BYTE    BSSID[6];
} WLANCONNECTEDST, *PWLANCONNECTEDST;

typedef struct _WLANADPTINFO {
    DWORD   fUseDHCP;
    DWORD   IPAddr;
    DWORD   SubnetMask;
    DWORD   Gateway;
    DWORD   DNSAddr;
    DWORD   DNSAltAddr;
    DWORD   WINSAddr;
    DWORD   WINSAltAddr;
} WLANADPTINFO, *PWLANADPTINFO;

#ifndef _WZCAPI_H_
typedef struct
{
    DWORD   dwDataLen;
    BYTE*   pData;
} RAW_DATA, *PRAW_DATA;
#endif

#define DBG_API   1
#define AUDIO_MUTEON    0x2222
#define AUDIO_MUTEOFF   0x3333

//
//  API prototypes
//
    DWORD WINAPI SetTriggerLockON(VOID);
    DWORD WINAPI SetTriggerLockOFF(VOID);
    DWORD WINAPI GetTriggerState(BYTE* pTriggerState);
    DWORD WINAPI SetAudioMuteON(VOID);
    DWORD WINAPI SetAudioMuteOFF(VOID);
    DWORD WINAPI SetAudioVolume(DWORD dwVolume);
    DWORD WINAPI GetAudioVolume(DWORD* pdwVolume);

    DWORD WINAPI GetAPIVersion(PAPIVER lpAPIVer);
    DWORD WINAPI GetHALUUID(GUID *lpGUID);
    DWORD WINAPI SystemSoftReset(VOID);

    //TouchPanel
    DWORD WINAPI SetTchLock(BYTE Lock);
    DWORD WINAPI GetTchLock(BYTE* Lock);
    DWORD WINAPI SetTchSensitivity(DWORD sValue);
    DWORD WINAPI GetTchSensitivity(DWORD* sValue);
    DWORD WINAPI TchCalibration(VOID);

    //Key
    DWORD WINAPI SetKeyPadSensitivity(DWORD sValue);
    DWORD WINAPI GetKeyPadSensitivity(DWORD* sValue);
    DWORD WINAPI SetKeyPadFullKeyLock(BYTE Lock);
    DWORD WINAPI GetKeyPadFullKeyState(BYTE* Lock);
    DWORD WINAPI SetKeyPadTaskKeyLock(BYTE Lock);
    DWORD WINAPI SetKeyPadFuncKeyLock(BYTE Lock);
    DWORD WINAPI GetKeyPadFuncKeyLock(BYTE* Lock);
    DWORD WINAPI SetKeyPadAlphaKeyLock(BYTE Lock);
    DWORD WINAPI GetKeyPadKeyLock(PKEYPADLOCK lpKEYLOCK);
    DWORD WINAPI SetKeyPadBind(PKEYPADBIND lpKEYBIND);
    DWORD WINAPI SetKeyAlphaState(BYTE State);
    DWORD WINAPI GetKeyAlphaState(BYTE* State);
    DWORD WINAPI SetKeyFuncKeyState(BYTE State);
    DWORD WINAPI GetKeyFuncKeyState(BYTE* State);

    //Init
    DWORD WINAPI SetInitLoaderBind(PKEYPADBIND lpKEYBIND);
    DWORD WINAPI SetTaskBarAlwaysHide(BYTE Hide);
    DWORD WINAPI SetTaskBarAutoHide(BYTE Hide);

    //Cf
    DWORD WINAPI GetCISInfo(PCARDINFO lpCARDINFO);
    DWORD WINAPI GetCardStatus(DWORD* Stateflags);
    DWORD WINAPI SetCardPower(BYTE Poweron);
    DWORD WINAPI GetCardPower(BYTE* Poweron);

    //Gprs Check
    DWORD WINAPI GetPINChecked(BYTE* Checked);
    DWORD WINAPI SetPINCode(PPINNUM lpPINCODE,BYTE* Result);
    DWORD WINAPI GetPINCode(PPINNUM lpPINCODE,BYTE* Result);
    DWORD WINAPI SetPINCodeToSave(BYTE* Result);
    DWORD WINAPI CheckPINNeed(BYTE* Stateflags);
    DWORD WINAPI CheckPINCode(PPINNUM lpPINCODE,BYTE* Result);
    DWORD WINAPI GetGPRSManufacturer(PMANUINFO lpMANUINFO);
    DWORD WINAPI UnBlockPINCode(PPINNUM lpPINCODE,BYTE* Result);
    DWORD WINAPI GPRSPowerOnAutoCheckPIN(BYTE* Result);

    //Com
    DWORD WINAPI SetReaderPower(BYTE Poweron);
    DWORD WINAPI SetRFIDPower(BYTE Poweron);

    //Wifi
    DWORD WINAPI SetWiFiPower(BYTE Poweron);
    DWORD WINAPI GetWiFiPower(BYTE* Poweron);

    //SysInfo
    DWORD WINAPI GetSysInfo(PSYSINFO psysinfo1);
    DWORD WINAPI GetSysDevName(WCHAR* p_devname,BYTE namesize);
    DWORD WINAPI SetSysDevName(WCHAR* p_devname,BYTE namesize);
    DWORD WINAPI GetSystemMemory(DWORD* lpdwStorePages, DWORD* lpdwRamPages, DWORD* lpdwPageSize);
    DWORD WINAPI SetSystemMemory(DWORD dwStorePages);

    //Vibartor
    DWORD SetVibratorPower(BYTE byOn);
    DWORD GetVibratorPower(BYTE* state);

    //Backlight
    DWORD GetBacklightST(BYTE* pState);
    DWORD SetBacklightST(BYTE State);
    DWORD GetBacklightLV(BYTE byFromAC, BYTE* pbyLevel);
    DWORD SetBacklightLV(BYTE byFromAC,BYTE byLevel);
    DWORD GetBacklightCTL(BKLCTL* p_bklctl1);
    DWORD SetBacklightCTL(BKLCTL* p_bklctl1);
    DWORD SetBacklightDefault(VOID);
    DWORD SetBacklightMax(VOID);
    DWORD SetBacklightMin(VOID);

    //Wireless
    DWORD AddWlanSsidToPreferredList(WLANCTL& wlanCtl1);
    DWORD ResetWlanPreferredList(VOID);
    DWORD ReconnectWlanPreferredList(VOID) ;
    DWORD GetWlanPreferredList(PRAW_DATA pPreferredList);
    DWORD GetWlanAvailableList(PRAW_DATA pAvailableList);
    DWORD GetWlanConnectedStatus(PWLANCONNECTEDST pWlanConnSt);
    DWORD SetWlanIpInfo(PWLANADPTINFO pAdpt);
    DWORD GetWlanIpInfo(PWLANADPTINFO pAdpt);
    DWORD WlanIPAddrToString(LPTSTR szStr, DWORD buffersize, DWORD IPAddr);
    DWORD WlanStringToIPAddr(TCHAR* AddressString, DWORD* AddressValue);

    //Bluetooth
    DWORD StartBluetooth(VOID);
    DWORD StopBluetooth(VOID);

//Dynamic**********************************

    //Audio
    typedef DWORD (WINAPI *PFN_SetTriggerLockON)(VOID);
    typedef DWORD (WINAPI *PFN_SetTriggerLockOFF)(VOID);
    typedef DWORD (WINAPI *PFN_GetTriggerState)(BYTE* pTriggerState);

    typedef DWORD (WINAPI *PFN_SetAudioMuteON)(VOID);
    typedef DWORD (WINAPI *PFN_SetAudioMuteOFF)(VOID);
    typedef DWORD (WINAPI *PFN_SetAudioVolume)(DWORD dwVolume);
    typedef DWORD (WINAPI *PFN_GetAudioVolume)(DWORD* pdwVolume);

    typedef DWORD (WINAPI *PFN_GetAPIVersion)(PAPIVER lpAPIVer);
    typedef DWORD (WINAPI *PFN_GetHALUUID)(GUID *lpGUID);

    //TouchPanel
    typedef DWORD (WINAPI *PFN_SetTchLock)(BYTE Lock);
    typedef DWORD (WINAPI *PFN_GetTchLock)(BYTE* Lock);
    typedef DWORD (WINAPI *PFN_SetTchSensitivity)(DWORD sValue);
    typedef DWORD (WINAPI *PFN_GetTchSensitivity)(DWORD* sValue);
    typedef DWORD (WINAPI *PFN_TchCalibration)(VOID);

    //Key
    typedef DWORD (WINAPI *PFN_SetKeyPadSensitivity)(DWORD sValue);
    typedef DWORD (WINAPI *PFN_GetKeyPadSensitivity)(DWORD* sValue);
    typedef DWORD (WINAPI *PFN_SetKeyPadFullKeyLock)(BYTE Lock);
    typedef DWORD (WINAPI *PFN_GetKeyPadFullKeyState)(BYTE* Lock);
    typedef DWORD (WINAPI *PFN_SetKeyPadTaskKeyLock)(BYTE Lock);
    typedef DWORD (WINAPI *PFN_SetKeyPadFuncKeyLock)(BYTE Lock);
    typedef DWORD (WINAPI *PFN_GetKeyPadFuncKeyLock)(BYTE* Lock);
    typedef DWORD (WINAPI *PFN_SetKeyPadAlphaKeyLock)(BYTE Lock);
    typedef DWORD (WINAPI *PFN_GetKeyPadKeyLock)(PKEYPADLOCK lpKEYLOCK);
    typedef DWORD (WINAPI *PFN_SetKeyPadBind)(PKEYPADBIND lpKEYBIND);
    typedef DWORD (WINAPI *PFN_SetKeyAlphaState)(BYTE State);
    typedef DWORD (WINAPI *PFN_GetKeyAlphaState)(BYTE* State);
    typedef DWORD (WINAPI *PFN_SetKeyFuncKeyState)(BYTE State);
    typedef DWORD (WINAPI *PFN_GetKeyFuncKeyState)(BYTE* State);    

    //Init
    typedef DWORD (WINAPI *PFN_SetInitLoaderBind)(PKEYPADBIND lpKEYBIND);
    typedef DWORD (WINAPI *PFN_SetTaskBarAlwaysHide)(BYTE Hide);
    typedef DWORD (WINAPI *PFN_SetTaskBarAutoHide)(BYTE Hide);

    //Cf
    typedef DWORD (WINAPI *PFN_GetCISInfo)(PCARDINFO lpCARDINFO);
    typedef DWORD (WINAPI *PFN_GetCardStatus)(DWORD* Stateflags);
    typedef DWORD (WINAPI *PFN_SetCardPower)(BYTE Poweron);
    typedef DWORD (WINAPI *PFN_GetCardPower)(BYTE* Poweron);

    //Gprs Check
    typedef DWORD (WINAPI *PFN_GetPINChecked)(BYTE* Checked);
    typedef DWORD (WINAPI *PFN_SetPINCode)(PPINNUM lpPINCODE,BYTE* Result);
    typedef DWORD (WINAPI *PFN_GetPINCode)(PPINNUM lpPINCODE,BYTE* Result);
    typedef DWORD (WINAPI *PFN_SetPINCodeToSave)(BYTE* Result);
    typedef DWORD (WINAPI *PFN_CheckPINNeed)(BYTE* Stateflags);
    typedef DWORD (WINAPI *PFN_CheckPINCode)(PPINNUM lpPINCODE,BYTE* Result);
    typedef DWORD (WINAPI *PFN_GetGPRSManufacturer)(PMANUINFO lpMANUINFO);
    typedef DWORD (WINAPI *PFN_UnBlockPINCode)(PPINNUM lpPINCODE,BYTE* Result);
    typedef DWORD (WINAPI *PFN_GPRSPOWERONAUTOCHECKPIN)(BYTE* Result);

    //Com
    typedef DWORD (WINAPI *PFN_SetReaderPower)(BYTE Poweron);
    typedef DWORD (WINAPI *PFN_SetRFIDPower)(BYTE Poweron);

    //Wifi
    typedef DWORD (WINAPI *PFN_SetWiFiPower)(BYTE Poweron);
    typedef DWORD (WINAPI *PFN_GetWiFiPower)(BYTE* Poweron);

    //SysInfo
    typedef DWORD (WINAPI * PFN_GetSysInfo)(PSYSINFO psysinfo1);
    typedef DWORD (WINAPI * PFN_GetSysDevName)(WCHAR* p_devname,BYTE namesize);
    typedef DWORD (WINAPI * PFN_SetSysDevName)(WCHAR* p_devname,BYTE namesize);
    typedef DWORD (WINAPI * PFN_GetSystemMemory)(DWORD* lpdwStorePages, DWORD* lpdwRamPages, DWORD* lpdwPageSize);
    typedef DWORD (WINAPI * PFN_SetSystemMemory)(DWORD dwStorePages);

    //Vibrator
    typedef DWORD (WINAPI * PFN_SetVibratorPower)(BYTE byOn);
    typedef DWORD (WINAPI * PFN_GetVibratorPower)(BYTE* state);

    //Backlight
    typedef DWORD (WINAPI * PFN_GetBacklightST)(BYTE* pState);
    typedef DWORD (WINAPI * PFN_SetBacklightST)(BYTE State);
    typedef DWORD (WINAPI * PFN_GetBacklightLV)(BYTE byFromAC, BYTE* pbyLevel);
    typedef DWORD (WINAPI * PFN_SetBacklightLV)(BYTE byFromAC,BYTE byLevel);
    typedef DWORD (WINAPI * PFN_GetBacklightCTL)(BKLCTL* p_bklctl1);
    typedef DWORD (WINAPI * PFN_SetBacklightCTL)(BKLCTL* p_bklctl1);
    typedef DWORD (WINAPI * PFN_SetBacklightDefault)();
    typedef DWORD (WINAPI * PFN_SetBacklightMax)();
    typedef DWORD (WINAPI * PFN_SetBacklightMin)();

    //Wireless
    typedef DWORD (WINAPI * PFN_AddWlanSsidToPreferredList)(WLANCTL& wlanCtl1) ;
    typedef DWORD (WINAPI * PFN_ResetWlanPreferredList)(VOID) ;
    typedef DWORD (WINAPI * PFN_ReconnectWlanPreferredList)(VOID) ;
    typedef DWORD (WINAPI * PFN_GetWlanPreferredList)(PRAW_DATA pPreferredList);
    typedef DWORD (WINAPI * PFN_GetWlanAvailableList)(PRAW_DATA pAvailableList);
    typedef DWORD (WINAPI * PFN_GetWlanConnectedStatus)(PWLANCONNECTEDST pWlanConnSt);
    typedef DWORD (WINAPI * PFN_GetWlanIpInfo)(PWLANADPTINFO pAdpt);
    typedef DWORD (WINAPI * PFN_SetWlanIpInfo)(PWLANADPTINFO pAdpt);
    typedef DWORD (WINAPI * PFN_WlanIPAddrToString)(LPTSTR szStr, DWORD buffersize, DWORD IPAddr);
    typedef DWORD (WINAPI * PFN_WlanStringToIPAddr)(TCHAR* AddressString, DWORD* AddressValue);

    //Bluetooth
    typedef DWORD (WINAPI * PFN_StartBluetooth)(VOID);
    typedef DWORD (WINAPI * PFN_StopBluetooth)(VOID);

#ifdef __cplusplus
}
#endif

#endif // __LIBDLLH__
