//
// 9300CE_SYS.h
//

#ifndef ATHENACE_SYS_H
#define ATHENACE_SYS_H


#ifdef __cplusplus
 extern "C" {
#endif


const static TCHAR API_VERSION[] = L"1.014";

//******************************************************************************
// Return values
//******************************************************************************
#define ALLNOERROR                    0
#define ERROR_NORESOURCE              1
#define ERROR_NOSPACE                 2
#define ERROR_PARAMETER               4
#define ERRORSTEP(x)                  (0x1<<x)
#define ALLERROR                      0xFFFFFFFF


#define ERROR_DEVICEIOCTL_FAIL        1
#define ERROR_CREATEFILE_FAIL         2

#define ERROR_REG_OPEN_FAIL           1
#define ERROR_REG_SET_FAIL            2

#define ERROR_BKL_OUTOFRANGE_BAT_MODE 16
#define ERROR_BKL_OUTOFRANGE_AC_MODE  32

#define ERROR_WLAN_QUIRY_INTERFACE    8
#define ERROR_WLAN_SSID_REPEAT        16
#define ERROR_WLAN_NO_PRSSID_LIST     17
#define ERROR_WLAN_NO_ASSOCIATED      18
#define ERROR_WLAN_NO_CONNECTED       20

#define ERROR_BT_START_SRV_FAIL       20
#define ERROR_BT_STOP_SRV_FAIL        20

#define ERROR_GET_TOUCH_HANDLE_FAIL   1
#define ERROR_TOUCH_ACCESS_FAIL       2
#define ERROR_FULL_KEY_LOCKED         4
#define ERROR_SET_TOUCH_FAIL          8

#define ERROR_KEY_LOCKED              2
#define ERROR_TOUCH_LOCKED            2

//========== Bluetooth Error Code =====================
#define ERROR_PARAMETER               4
#define ERROR_NO_DEVICE_INFO          21
#define ERROR_NO_SERVICE_INFO         22
#define ERROR_WRONG_DEVICE_INFO       23
#define ERROR_WRONG_SERVICE_INFO      24
#define ERROR_NOT_DEVICEINFO_OBJ      25
#define ERROR_NOT_SERVICEINFO_OBJ     26
#define ERROR_WRONG_SERVICE_TYPE      27
#define ERROR_DEVICE_NOT_HAS_SERVICE  28
#define ERROR_SERVICE_NOT_CONNECTED   29
#define ERROR_NO_STARTFINDING         30
#define ERROR_WRONG_ARG               31
#define ERROR_OPPERATION_FAIL         32
#define ERROR_MACHINE_NOT_SUPPORTED   33


//******************************************************************************
// Constants
//******************************************************************************
#define KEY_GENERAL              0x00000001 // 1
#define KEY_ALPHA                0x00000002 // 2
#define KEY_FN                   0x00000004 // 4
#define KEY_CTRL                 0x00000008 // 8
#define KEY_ALT                  0x00000010 // 16
#define KEY_SCAN                 0x00000020 // 32
#define KEY_POWER                0x00000040 // 64
#define KEY_LSTRIGGER            0x00000080 // 128
#define KEY_RSTRIGGER            0x00000100 // 256
#define KEY_ALL                  0xffffffff

#define KEY_LOCK_GENERAL         0x00000001 // 1
#define KEY_LOCK_ALPHA           0x00000002 // 2
#define KEY_LOCK_FN              0x00000004 // 4
#define KEY_LOCK_CTRL            0x00000008 // 8
#define KEY_LOCK_ALT             0x00000010 // 16
#define KEY_LOCK_SCAN            0x00000020 // 32
#define KEY_LOCK_POWER           0x00000040 // 64
#define KEY_LOCK_SIDE_L          0x00000080 // 128
#define KEY_LOCK_SIDE_R          0x00000100 // 256
#define KEY_LOCK_ALL             0xffffffff

//========== Button Assign related =====================
#if(BSP_ATHENA_DVT==1 || BSP_ATHENA_MVT == 1)
    #define RAW_SC_MAX                (0x30+5)
#else
  #define RAW_SC_MAX                  (0x30+3)
#endif
#define RAW_SC_BUFF_SIZE              (RAW_SC_MAX*2)
#define ASSIGN_ID_OLD_NUM             33
#define PROGRAM_PATH_SIZE             150

#define LAUNCH_MODE                   0x10  // 10 means launch mode
#define SHIFT_MODE                    0x20  // 20 means Shift mode
#define ALT_MODE                      0x40  // 40 means Alt mode
#define CTRL_MODE                     0x80  // 80 means Ctrl mode
#define CTRL_ALT_MODE                 (CTRL_MODE | ALT_MODE)   // means Ctrl + Alt mode
#define KPID_29                       0x0000001D
#define KPID_43                       0x0000002B

#define NEW_ASSIGNID_NUM              18
#define NEW_BUTTONID_NUM              22
#define MAX_SUBKEY_LENGTH             40
//========== Bluetooth service type =====================
#define UNDEFINED_BT_SERVICE          0
#define BT_HID_SERVICE                1
#define BT_DUN_SERVICE                2
#define BT_SPP_SERVICE                3
#define BT_OPP_SERVICE                4
#define BT_PAN_SERVICE                5
#define BT_HEADSET_SERVICE            6
#define BT_HANDSFREE_SERVICE          7
#define BT_FTP_SERVICE                8

//******************************************************************************
// Data types
//******************************************************************************
//3.2.1 APIVER
typedef struct
{
    TCHAR   APINUM[5];//A serial number for API version in the format of x.xxxx, e.g. 0.101
} APIVER, *PAPIVER;

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

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

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

//3.2.9 SYSINFO
typedef struct _SYSINFO {
    UCHAR   DevDesc[16];
    UCHAR   DevCFG[16];
    UCHAR   SerialNum[16];
    UCHAR   SerialNumReadOnly[16];
    UCHAR   SerialNumPCBA[16];
    UCHAR   Manufactory[32];
    UCHAR   ManuDate[16];
    UCHAR   OsVer[32];
    UCHAR   BootloaderVer[32];
    UCHAR   MicroPVer[32];
    UCHAR   BTAddress[32];
    UCHAR   WiFiAddress[32];
    UCHAR   IMEI[32];
} SYSINFO, *PSYSINFO;

//========== Bluetooth FTP files information =====================
typedef struct {
    INT     fileType;
    WCHAR   fileName[200];
    INT     fileSize;
} FTP_FILE_INFO;



//wireless
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


////////////////////////////////////////////////////////////////////////////////
// Summit Constants
////////////////////////////////////////////////////////////////////////////////

#define DATA_MEM_MIN    32
#define DATA_MEM_MAX    65536

#define CONFIG_NAME_SZ  33
#define SSID_SZ         33
#define CLIENT_NAME_SZ  17
#define USER_NAME_SZ    65
#define USER_PWD_SZ     65
#define PSK_SZ          65
#define MAX_CFGS        20
#define NUM_WEP_KEYS    4
#define PDELAY_LOW      0
#define PDELAY_HIGH     7200000
#define PTIME_LOW       0
#define PTIME_HIGH      30000
#define FRAG_LOW        256
#define FRAG_HIGH       2346
#define RTS_LOW         0
#define RTS_HIGH        2347
#define AUTH_LOW        3
#define AUTH_HIGH       60
#define MAX_CERT_PATH   65
#define CRED_CA_POS     72 //in SDCConfig userName.buffer
#define CRED_UCA_POS    72 //in SDCConfig userPwd.buffer
#define CRED_PFILE_POS  34 //in SDCConfig userPwd.buffer
#define CRED_CERT_SZ    48 //for CRED_CA and CRED_UCA
#define CRED_PFILE_SZ   32


typedef enum _SDCERR {
  SDCERR_SUCCESS = 0,
  SDCERR_FAIL,
  SDCERR_INVALID_NAME,
  SDCERR_INVALID_CONFIG,
  SDCERR_INVALID_DELETE,
  SDCERR_POWERCYCLE_REQUIRED,
  SDCERR_INVALID_PARAMETER,
  SDCERR_INVALID_EAP_TYPE,
  SDCERR_INVALID_WEP_TYPE,
  SDCERR_INVALID_FILE
} SDCERR;


typedef enum _AUTH {
  AUTH_OPEN = 0,
  AUTH_SHARED,
  AUTH_NETWORK_EAP,
} AUTH;

typedef enum _EAPTYPE {
  EAP_NONE = 0,
  EAP_LEAP,
  EAP_EAPFAST,
  EAP_PEAPMSCHAP,
  EAP_PEAPGTC,
  EAP_EAPTLS,
} EAPTYPE;

typedef enum _POWERSAVE {
  POWERSAVE_OFF = 0,
  POWERSAVE_MAX,
  POWERSAVE_FAST,
} POWERSAVE;

typedef enum _WEPTYPE {
  WEP_OFF = 0,
  WEP_ON,
  WEP_AUTO,
  WPA_PSK,
  WPA_TKIP,
  WPA2_PSK,
  WPA2_AES,
  CCKM_TKIP,
  WEP_CKIP,
  WEP_AUTO_CKIP,
  CCKM_AES
} WEPTYPE;

typedef enum _RADIOMODE {
  RADIOMODE_B_ONLY = 0,
  RADIOMODE_BG,
  RADIOMODE_G_ONLY,
  RADIOMODE_BG_LRS,
  RADIOMODE_A_ONLY,
  RADIOMODE_ABG,
  RADIOMODE_BGA,
  RADIOMODE_ADHOC
} RADIOMODE;

typedef enum _TXPOWER {
  TXPOWER_MAX = 0,
  TXPOWER_1   = 1,
  TXPOWER_5   = 5,
  TXPOWER_10  = 10,
  TXPOWER_20  = 20,
  TXPOWER_30  = 30,
  TXPOWER_50  = 50,
} TXPOWER;

typedef enum _BITRATE {
  BITRATE_AUTO  = 0,
  BITRATE_1     = 2,
  BITRATE_2     = 4,
  BITRATE_5_5   = 11,
  BITRATE_6     = 12,
  BITRATE_9     = 18,
  BITRATE_11    = 22,
  BITRATE_12    = 24,
  BITRATE_18    = 36,
  BITRATE_24    = 48,
  BITRATE_36    = 72,
  BITRATE_48    = 96,
  BITRATE_54    = 108
} BITRATE;

typedef enum _PREAMBLE {
  PRE_AUTO = 0,
  PRE_SHORT,
  PRE_LONG,
} PREAMBLE;

typedef enum _GSHORTSLOT {
  GSHORT_AUTO = 0,
  GSHORT_OFF,
  GSHORT_ON,
} GSHORTSLOT;

typedef enum _BT_COEXIST {
  BT_OFF  = 0,
  BT_ON,
} BT_COEXIST;

typedef enum _REGDOMAIN {
  REG_FCC   = 0,
  REG_ETSI  = 1,
  REG_TELEC = 2,
  REG_WW    = 3
} REG_DOMAIN;

typedef enum _PING_PAYLOAD {
  PP_32    = 32,
  PP_64    = 64,
  PP_128   = 128,
  PP_256   = 256,
  PP_512   = 512,
  PP_1024  = 1024
} PING_PAYLOAD;

typedef enum _RX_DIV {
  RXDIV_MAIN = 0,
  RXDIV_AUX,
  RXDIV_START_AUX,
  RXDIV_START_MAIN,
} RX_DIV;

typedef enum _TX_DIV {
  TXDIV_MAIN = 0,
  TXDIV_AUX,
  TXDIV_ON   = 3,
} TX_DIV;

typedef enum _ROAM_TRIG {
  RTRIG_50 = 50,
  RTRIG_55 = 55,
  RTRIG_60 = 60,
  RTRIG_65 = 65,
  RTRIG_70 = 70,
  RTRIG_75 = 75,
  RTRIG_80 = 80,
  RTRIG_85 = 85,
  RTRIG_90 = 90,
} ROAM_TRIG;

typedef enum _ROAM_DELTA {
  RDELTA_5  = 5,
  RDELTA_10 = 10,
  RDELTA_15 = 15,
  RDELTA_20 = 20,
  RDELTA_25 = 25,
  RDELTA_30 = 30,
  RDELTA_35 = 35,
} ROAM_DELTA;

typedef enum _ROAM_PERIOD {
  RPERIOD_5   = 5,
  RPERIOD_10  = 10,
  RPERIOD_15  = 15,
  RPERIOD_20  = 20,
  RPERIOD_25  = 25,
  RPERIOD_30  = 30,
  RPERIOD_35  = 35,
  RPERIOD_40  = 40,
  RPERIOD_45  = 45,
  RPERIOD_50  = 50,
  RPERIOD_55  = 55,
  RPERIOD_60  = 60,
} ROAM_PERIOD;

typedef enum _CCX_FEATURES {
  CCX_OPTIMIZED = 0,
  CCX_FULL      = 1,
  CCX_OFF       = 2,
} CCX_FEATURES;

typedef enum _WEPLEN {
  WEPLEN_NOT_SET = 0,
  WEPLEN_40BIT,
  WEPLEN_128BIT,
} WEPLEN;

typedef enum _FCCTEST {
  FCCTEST_OFF  = 0,
  FCCTEST_TX   = 1,
  FCCTEST_RX   = 3,
  FCCTEST_FREQ = 2,
} FCC_TEST;

typedef enum _CARDSTATE {
  CARDSTATE_NOT_INSERTED = 0,
  CARDSTATE_NOT_ASSOCIATED,
  CARDSTATE_ASSOCIATED,
  CARDSTATE_AUTHENTICATED,
  CARDSTATE_FCCTEST,
  CARDSTATE_NOT_SDC
} CARDSTATE;

typedef enum _RADIOTYPE {
  RADIOTYPE_BG        = 0,
  RADIOTYPE_ABG       = 1,
  RADIOTYPE_NOT_SDC   = 100,
  RADIOTYPE_NOT_SDC_1 = 101,
} RADIOTYPE;

typedef enum _CERTLOCATION {
  CERT_NONE = 0,   // don't validate the server
  CERT_FILE,       // specify the filename for caCert
  CERT_FULL_STORE, // use the entire MS-store
  CERT_IN_STORE    // use one specific cert from the MS-store, specify the cert's hash
} CERTLOCATION;

typedef enum _INTERFERENCE {
  INTER_NONE = 0,  // OFF
  INTER_NONWLAN,   // reduces CCA Tx threshold
  INTER_WLAN,      // reduces interchannel noise
  INTER_AUTO       // automatic
} INTERFERENCE;

// or this in the length to set the XMIT key
#define XMITBIT 0x100

#pragma pack(1)

typedef struct _WEPKEY {
    DWORD              length;   //40 or 128 or 0 for not set
    UCHAR              data[16]; //enough to store 128 bits
} WEPKey;

typedef struct _CRYPT {
    DWORD              size;
    CHAR               buffer[120];
    DWORD              offset;
} CRYPT;

typedef struct _SDCConfig {
    CHAR               configName[CONFIG_NAME_SZ];
    CHAR               SSID[SSID_SZ];
    CHAR               clientName[CLIENT_NAME_SZ];
    INT                txPower;
    AUTH               authType;
    EAPTYPE            eapType;
    POWERSAVE          powerSave;
    WEPTYPE            wepType;
    BITRATE            bitRate;
    RADIOMODE          radioMode;
    CRYPT              userName;
    CRYPT              userPwd;
    CRYPT              PSK;
    CRYPT              WEPKeys;
} SDCConfig;

typedef struct _SDCGlobalConfig {
    DWORD              fragThreshold;
    DWORD              RTSThreshold;
    RX_DIV             RxDiversity;
    TX_DIV             TxDiversity;
    ROAM_TRIG          roamTrigger;
    ROAM_DELTA         roamDelta;
    ROAM_PERIOD        roamPeriod;
    PREAMBLE           preamble;
    GSHORTSLOT         g_shortslot;
    BT_COEXIST         BTcoexist;
    PING_PAYLOAD       pingPayload;
    DWORD              pingTimeout;
    DWORD              pingDelay;
    DWORD              radioState;
    DWORD              displayPasswords;
    DWORD              adminOverride;
    DWORD              txMax;
    FCC_TEST           FCCtest;
    DWORD              testChannel;
    BITRATE            testRate;
    TXPOWER            testPower;
    DWORD              regDomain;
    DWORD              ledUsed;
    DWORD              txTestTimeout;
    DWORD              WMEenabled;
    DWORD              CCXfeatures;
    CHAR               certPath[MAX_CERT_PATH];
    CRYPT              adminPassword;
    DWORD              bLRS;
    DWORD              avgWindow;
    DWORD              probeDelay;
    DWORD              polledIRQ;
    DWORD              keepAlive;
    DWORD              trayIcon;
    DWORD              aggScanTimer;
    DWORD              authTimeout;
    DWORD              autoProfile;
    DWORD              Reserved0[6];
    DWORD              txMaxA;
    DWORD              adminFiles;
    DWORD              DFSchannels;
    DWORD              interferenceMode;
    DWORD              authServerType;
    DWORD              Reserved1[4];
} SDCGlobalConfig;

typedef struct _SDC3rdPartyConfig {
    CHAR               clientName[CLIENT_NAME_SZ];
    POWERSAVE          powerSave;
    INT                txPower;
    BITRATE            bitRate;
    RADIOMODE          radioMode;
} SDC3rdPartyConfig;

typedef struct _CF10G_STATUS {
    CARDSTATE          cardState;
    CHAR               configName[CONFIG_NAME_SZ];
    UCHAR              client_MAC[6];
    UCHAR              client_IP[4];
    CHAR               clientName[CLIENT_NAME_SZ];
    UCHAR              AP_MAC[6];
    UCHAR              AP_IP[4];
    CHAR               APName[CLIENT_NAME_SZ];
    EAPTYPE            eapType;
    DWORD              channel;
    INT                rssi;
    BITRATE            bitRate;
    INT                txPower;
    DWORD              driverVersion;
    RADIOTYPE          radioType;
    DWORD              DTIM;
    DWORD              beaconPeriod;
    DWORD              beaconsReceived;
} CF10G_STATUS;

typedef struct _CONFIG_FILE_INFO {
    DWORD              numConfigs;
    BOOLEAN            globalConfigPresent;
    BOOLEAN            thirdPartyConfigPresent;
    DWORD              sdkVersion;
} CONFIG_FILE_INFO;

typedef struct _SDC_ALL {
    DWORD              numConfigs;
    SDCConfig          *configs;
    SDC3rdPartyConfig  *configThirdParty;
    SDCGlobalConfig    *configGlobal;
} SDC_ALL;


#pragma pack()





//******************************************************************************
// Function prototypes
//******************************************************************************
//SYSTEM SETTINGS
DWORD GetAPIVersion (APIVER *apiVer);
DWORD GetSysDevName (WCHAR *devName, BYTE nameSize);
DWORD GetHALUUID (GUID *guid);
DWORD GetSysInfo (SYSINFO *sysInfo);
DWORD SetInitLoaderBind (KEYPADBIND *keypadBind);
DWORD SetSysDevName (WCHAR *devName, BYTE nameSize);
DWORD SystemSoftReset (VOID);

//BACKLIGHT
DWORD GetBacklightCTL (BKLCTL *bklCtl);
DWORD SetBacklightCTL (BKLCTL *bklCtl);
DWORD SetBacklightDefault (VOID);
DWORD SetBacklightMax (VOID);
DWORD SetBacklightMin (VOID);
DWORD GetBacklightST (BYTE *bklState);
DWORD SetBacklightST (BYTE bklState);
DWORD GetBacklightLV (BYTE byFromAC, BYTE *byLevel);
DWORD SetBacklightLV (BYTE byFromAC, BYTE byLevel);
DWORD GetKeylightOnOff (BYTE *onOff);
DWORD SetKeylightOnOff (BYTE onOff);

//TOUCH PANEL
DWORD GetTchLock (BYTE *lockState);
DWORD SetTchLock (BYTE lockState);

//TASKBAR
DWORD SetTaskBarAlwaysHide (BYTE hide);
DWORD SetTaskBarAutoHide (BYTE hide);

//KEYPAD
DWORD GetKeyAlphaState(BYTE *state);
DWORD GetKeyFuncKeyState(BYTE *state);
DWORD GetKeyPadFuncKeyLock(BYTE *lockState);
DWORD GetKeyPadFullKeyState(BYTE *state);
DWORD GetKeyPadKeyLock(KEYPADLOCK *keyLock);
DWORD GetKeyPadSensitivity (DWORD *value);
DWORD GetKeypadType (BYTE *keypadLayout);
DWORD SetKeyAlphaState (BYTE state);
DWORD SetKeyFuncKeyState (BYTE state);
DWORD SetKeyPadAlphaKeyLock (BYTE lockState);
DWORD SetKeyPadFullKeyLock (BYTE lockState);
DWORD SetKeyPadFuncKeyLock (BYTE lockState);
DWORD SetKeyPadSensitivity (DWORD value);

DWORD GetKeypadState(DWORD key, DWORD *state);
DWORD SetKeypadState(DWORD key, DWORD state);
DWORD GetKeypadMode(DWORD key, DWORD *mode);
DWORD SetKeypadMode(DWORD key, DWORD mode);
DWORD GetKeypadLock(DWORD key, DWORD *lockState);
DWORD SetKeypadLock(DWORD key, DWORD lockState);
DWORD GetKeypadSensitivity(DWORD *value);
DWORD SetKeypadSensitivity(DWORD value);

//AUDIO
DWORD GetAudioVolume (DWORD *volume);
DWORD SetAudioMuteOFF (VOID);
DWORD SetAudioMuteON (VOID);
DWORD SetAudioVolume (DWORD volume);

//VIBRATOR
DWORD GetVibratorPower (BYTE *onOff);
DWORD SetVibratorPower (BYTE onOff);

//WIRELESS LAN
DWORD SetWiFiPower(BYTE onOff);
DWORD GetWiFiPower(BYTE *onOff);
DWORD SetWlanIpInfo(WLANADPTINFO *adpt);
DWORD GetWlanIpInfo(WLANADPTINFO *adpt);
DWORD AddWlanSsidToPreferredList(WLANCTL &wlanCtl);
DWORD GetWlanPreferredList(RAW_DATA *preferredList);
DWORD GetWlanAvailableList(RAW_DATA *availableList);
DWORD GetWlanConnectedStatus(WLANCONNECTEDST *wlanConnSt);
DWORD ResetWlanPreferredList(VOID);
DWORD ReconnectWlanPreferredList(VOID);
DWORD GetWiFiMac(ULONGLONG *wifiMac);

//BLUETOOTH
DWORD StartBluetooth(VOID);
DWORD StopBluetooth(VOID);
DWORD StartFindingDevice(VOID);
DWORD FindNextBTDevice(INT *deviceInfo);
DWORD FindService(INT targetService, INT deviceInfo, INT *serviceInfo);
DWORD GetBTConnStatus(INT serviceInfo, INT *status);
DWORD SetBTConnStatus(INT serviceType, INT onOff, INT deviceInfo, INT serviceInfo);
DWORD StartBrowse(INT serviceInfo, CHAR *targetPath);
DWORD GetNextFile(INT serviceInfo, FTP_FILE_INFO *fileInfo);
DWORD PutFile(INT serviceInfo, CHAR *filePath, HWND progressBar);
DWORD GetFile(INT serviceInfo, FTP_FILE_INFO *fileInfo, HWND progressBar);
DWORD GetDeviceName(INT deviceInfo, CHAR *outBuf, INT bufSize);
DWORD GetServiceType(INT serviceInfo, INT *serviceType);
DWORD GetDeviceAddress(INT deviceInfo, ULONGLONG *btAddr);
DWORD StartPairing(INT deviceInfo, CHAR *pinCode, INT pinCodeLen);
DWORD StartUnpairing(INT deviceInfo);

//STATUS INDICATION
DWORD SetBuzzerOFF (VOID);
DWORD SetBuzzerON (DWORD hz);
DWORD SetLEDLight (BYTE color, BOOL onOff);

//BUTTON ASSIGNMENT
DWORD GetButtonAssignment(INT buttonID, INT *keyCode, TCHAR *program);
DWORD SetButtonAssignment(INT buttonID, INT keyCode, TCHAR *program);
DWORD GetButtonAssignmentAdv(DWORD modifyMode, DWORD buttonID, DWORD *assignID);
DWORD SetButtonAssignmentAdv(DWORD modifyMode, DWORD buttonID, DWORD assignID);

//HEADSET
DWORD SetAudioPath (DWORD uiPath);
DWORD SetBTAudioState (BOOL state);
DWORD GetHeadsetState (BYTE *state);

//BARCODE SCANNER
DWORD TriggerBarcodeScannerByGPIO (void);


//******************************************************************************
// Dynamic
//******************************************************************************
//SYSTEM SETTINGS
typedef DWORD (WINAPI *PFN_GetAPIVersion)(APIVER *apiVer);
typedef DWORD (WINAPI *PFN_GetSysDevName)(WCHAR *devName, BYTE nameSize);
typedef DWORD (WINAPI *PFN_GetHALUUID)(GUID *guid);
typedef DWORD (WINAPI *PFN_GetSysInfo)   (SYSINFO *sysInfo);
typedef DWORD (WINAPI *PFN_SetInitLoaderBind)(KEYPADBIND *keypadBind);
typedef DWORD (WINAPI *PFN_SetSysDevName)(WCHAR *devName, BYTE nameSize);
typedef DWORD (WINAPI *PFN_SystemSoftReset)(VOID);

//BACKLIGHT
typedef DWORD (WINAPI *PFN_GetBacklightCTL)(BKLCTL *bklctl);
typedef DWORD (WINAPI *PFN_SetBacklightCTL)(BKLCTL *bklctl);
typedef DWORD (WINAPI *PFN_SetBacklightDefault)();
typedef DWORD (WINAPI *PFN_SetBacklightMax)();
typedef DWORD (WINAPI *PFN_SetBacklightMin)();
typedef DWORD (WINAPI *PFN_GetBacklightST) (BYTE *state);
typedef DWORD (WINAPI *PFN_SetBacklightST) (BYTE state);
typedef DWORD (WINAPI *PFN_GetBacklightLV) (BYTE byFromAC, BYTE *byLevel);
typedef DWORD (WINAPI *PFN_SetBacklightLV) (BYTE byFromAC, BYTE byLevel);
//keylight
typedef DWORD (WINAPI *PFN_GetKeylightOnOff) (BYTE *onOff);
typedef DWORD (WINAPI *PFN_SetKeylightOnOff) (BYTE onOff);

//TOUCH PANEL
typedef DWORD (WINAPI *PFN_SetTchLock)(BYTE lockState);
typedef DWORD (WINAPI *PFN_GetTchLock)(BYTE *lockState);

//TASKBAR
typedef DWORD (WINAPI *PFN_SetTaskBarAlwaysHide)(BYTE hide);
typedef DWORD (WINAPI *PFN_SetTaskBarAutoHide)(BYTE hide);

//KEYPAD
//keypad legacy
typedef DWORD (WINAPI *PFN_GetKeyAlphaState)(BYTE *state);
typedef DWORD (WINAPI *PFN_SetKeyAlphaState)(BYTE state);
typedef DWORD (WINAPI *PFN_GetKeyFuncKeyState)  (BYTE *state);
typedef DWORD (WINAPI *PFN_SetKeyFuncKeyState)  (BYTE state);
typedef DWORD (WINAPI *PFN_GetKeyPadFuncKeyLock)(BYTE *lockstate);
typedef DWORD (WINAPI *PFN_SetKeyPadFuncKeyLock)(BYTE lockState);
typedef DWORD (WINAPI *PFN_GetKeyPadSensitivity)(DWORD *value);
typedef DWORD (WINAPI *PFN_SetKeyPadSensitivity)(DWORD value);
typedef DWORD (WINAPI *PFN_GetKeyPadFullKeyState)(BYTE *state);
typedef DWORD (WINAPI *PFN_GetKeyPadKeyLock)(KEYPADLOCK *keyLock);
typedef DWORD (WINAPI *PFN_GetKeypadType) (BYTE *keypadLayout);
typedef DWORD (WINAPI *PFN_SetKeyPadAlphaKeyLock)(BYTE lockState);
typedef DWORD (WINAPI *PFN_SetKeyPadFullKeyLock)(BYTE lockState);

//keypad new
typedef DWORD (WINAPI *PFN_GetKeypadState) (DWORD key, DWORD *state);
typedef DWORD (WINAPI *PFN_SetKeypadState) (DWORD key, DWORD state);
typedef DWORD (WINAPI *PFN_GetKeypadMode) (DWORD key, DWORD *mode);
typedef DWORD (WINAPI *PFN_SetKeypadMode) (DWORD key, DWORD mode);
typedef DWORD (WINAPI *PFN_GetKeypadLock) (DWORD key, DWORD *lockState);
typedef DWORD (WINAPI *PFN_SetKeypadLock) (DWORD key, DWORD lockState);
typedef DWORD (WINAPI *PFN_GetKeypadSensitivity) (DWORD *value);
typedef DWORD (WINAPI *PFN_SetKeypadSensitivity) (DWORD value);

//AUDIO
typedef DWORD (WINAPI *PFN_SetAudioMuteON)(VOID);
typedef DWORD (WINAPI *PFN_SetAudioMuteOFF)(VOID);
typedef DWORD (WINAPI *PFN_SetAudioVolume)(DWORD volume);
typedef DWORD (WINAPI *PFN_GetAudioVolume)(DWORD *volume);

//VIBRATOR
typedef DWORD (WINAPI *PFN_SetVibratorPower) (BYTE onOff);
typedef DWORD (WINAPI *PFN_GetVibratorPower) (BYTE *onOff);

//WIRELESS LAN
typedef DWORD (WINAPI *PFN_SetWiFiPower)(BYTE onOff);
typedef DWORD (WINAPI *PFN_GetWiFiPower)(BYTE *onOff);
typedef DWORD (WINAPI *PFN_GetWlanIpInfo) (WLANADPTINFO *adpt);
typedef DWORD (WINAPI *PFN_SetWlanIpInfo) (WLANADPTINFO *adpt);
typedef DWORD (WINAPI *PFN_AddWlanSsidToPreferredList) (WLANCTL &wlanCtl) ;
typedef DWORD (WINAPI *PFN_GetWlanPreferredList) (RAW_DATA *preferredList);
typedef DWORD (WINAPI *PFN_GetWlanAvailableList) (RAW_DATA *availableList);
typedef DWORD (WINAPI *PFN_GetWlanConnectedStatus) (WLANCONNECTEDST *wlanConnSt);
typedef DWORD (WINAPI *PFN_ResetWlanPreferredList) (VOID) ;
typedef DWORD (WINAPI *PFN_ReconnectWlanPreferredList) (VOID) ;
typedef DWORD (WINAPI *PFN_GetWiFiMac) (ULONGLONG *wifiMac);

//BLUETOOTH
typedef DWORD (WINAPI *PFN_StartBluetooth)(VOID);
typedef DWORD (WINAPI *PFN_StopBluetooth) (VOID);
typedef DWORD (WINAPI *PFN_StartFindingDevice)(VOID);
typedef DWORD (WINAPI *PFN_FindNextBTDevice)(INT *deviceInfo);
typedef DWORD (WINAPI *PFN_FindService)(INT targetService, INT deviceInfo, INT *serviceInfo);
typedef DWORD (WINAPI *PFN_GetBTConnStatus)(INT serviceInfo, INT *status);
typedef DWORD (WINAPI *PFN_SetBTConnStatus)(INT serviceType, INT onOff, INT deviceInfo, INT serviceInfo);
typedef DWORD (WINAPI *PFN_StartBrowse)(INT serviceInfo, CHAR *targetPath);
typedef DWORD (WINAPI *PFN_GetNextFile)(INT serviceInfo, FTP_FILE_INFO *fileInfo);
typedef DWORD (WINAPI *PFN_PutFile)(INT serviceInfo, CHAR *filePath, HWND progressBar);
typedef DWORD (WINAPI *PFN_GetFile)(INT serviceInfo, FTP_FILE_INFO *fileInfo, HWND progressBar);
typedef DWORD (WINAPI *PFN_GetDeviceName)(INT deviceInfo, CHAR *outBuf, INT bufSize);
typedef DWORD (WINAPI *PFN_GetServiceType)(INT serviceInfo, INT *serviceType);
typedef DWORD (WINAPI *PFN_GetDeviceAddress)(INT deviceInfo, ULONGLONG *btAddr);
typedef DWORD (WINAPI *PFN_StartPairing)(INT deviceInfo, CHAR *pinCode, INT pinCodeLen);
typedef DWORD (WINAPI *PFN_StartUnpairing)(INT deviceInfo);

//STATUS INDICATION
typedef DWORD (WINAPI *PFN_SetBuzzerON)(DWORD hz);
typedef DWORD (WINAPI *PFN_SetBuzzerOFF)(VOID);
typedef DWORD (WINAPI *PFN_SetLEDLight)(BYTE color,BOOL onOff);

//BUTTON ASSIGNMENT
typedef DWORD (WINAPI *PFN_GetButtonAssignment)(INT buttonID, INT *keyCode, TCHAR *program);
typedef DWORD (WINAPI *PFN_SetButtonAssignment)(INT buttonID, INT keyCode, TCHAR *program);
typedef DWORD (WINAPI *PFN_GetButtonAssignmentAdv)(DWORD modifyMode, DWORD buttonID, DWORD *assignID);
typedef DWORD (WINAPI *PFN_SetButtonAssignmentAdv)(DWORD modifyMode, DWORD buttonID, DWORD assignID);

//HEADSET
typedef DWORD (WINAPI *PFN_SetAudioPath)(DWORD uiPath);
typedef DWORD (WINAPI *PFN_SetBTAudioState)(BOOL state);
typedef DWORD (WINAPI *PFN_GetHeadsetState) (BYTE *state);

//BARCODE SCANNER
typedef DWORD (WINAPI *PFN_TriggerBarcodeScannerByGPIO) (void);

DWORD PowerUp_Bluetooth(VOID);
DWORD PowerDown_Bluetooth(VOID);



////////////////////////////////////////////////////////////////////////////////
// Summit Prototypes
////////////////////////////////////////////////////////////////////////////////

//Summit Static Link
SDCERR GetCurrentConfig(DWORD *num, CHAR *name);
SDCERR ModifyConfig(CHAR *name, SDCConfig *config);
SDCERR GetConfig(CHAR *name, SDCConfig *config);
SDCERR DeleteConfig(CHAR *name);
SDCERR GetNumConfigs(DWORD *num);
SDCERR ActivateConfig(CHAR *name);
SDCERR AddConfig(SDCConfig *config);
SDCERR GetAllConfigs(SDCConfig *config, DWORD *num);
SDCERR SetAllConfigs(DWORD num, SDCConfig *config);
SDCERR GetGlobalSettings(SDCGlobalConfig *configGlobal);
SDCERR SetGlobalSettings(SDCGlobalConfig *configGlobal);
SDCERR Get3rdPartyConfig(SDC3rdPartyConfig *config3rd);
SDCERR Set3rdPartyConfig(SDC3rdPartyConfig *config3rd);
SDCERR GetCurrentStatus(CF10G_STATUS *status);
SDCERR RadioDisable();
SDCERR RadioEnable();
REG_DOMAIN GetCurrentDomain();
SDCERR GetSDKVersion(DWORD *version);
SDCERR FlushConfigKeys(INT configNumber);
SDCERR FlushAllConfigKeys();
SDCERR GetConfigFileInfo(CHAR *fileName, CONFIG_FILE_INFO *info);
SDCERR ExportSettings(CHAR *fileName, SDC_ALL *configAll);
SDCERR ImportSettings(CHAR *fileName, SDC_ALL *configAll);
SDCERR SetWEPKey(SDCConfig *config, INT keyIndex,  WEPLEN keyLength, UCHAR *wepKey, BOOLEAN keyState);
SDCERR GetWEPKey(SDCConfig *config, INT keyIndex,  WEPLEN *keyLength, UCHAR *wepKey, BOOLEAN *keyState);
SDCERR SetMultipleWEPKeys(SDCConfig *config,  INT keyIndex,  WEPLEN keyLength1, UCHAR *wepKey1,
                                                        WEPLEN keyLength2, UCHAR * wepKey2,
                                                        WEPLEN keyLength3, UCHAR * wepKey3,
                                                        WEPLEN keyLength4, UCHAR * wepKey4);
SDCERR GetMultipleWEPKeys(SDCConfig *config,  INT *keyIndex, WEPLEN *keyLength1, UCHAR *wepKey1,
                                                        WEPLEN *keyLength2, UCHAR *wepKey2,
                                                        WEPLEN *keyLength3, UCHAR *wepKey3,
                                                        WEPLEN *keyLength4, UCHAR *wepKey4);
SDCERR SetPSK(SDCConfig *config,  CHAR *psk);
SDCERR GetPSK(SDCConfig *config,  CHAR *psk);
SDCERR SetLEAPCred(SDCConfig *config,  CHAR *username, CHAR *password);
SDCERR GetLEAPCred(SDCConfig *config,  CHAR *username, CHAR *password);
SDCERR SetEAPFASTCred(SDCConfig *config,  CHAR *username, CHAR *password, CHAR *pacFileName, CHAR *pacPassword);
SDCERR GetEAPFASTCred(SDCConfig *config,  CHAR *username, CHAR *password, CHAR *pacFileName, CHAR *pacPassword);
SDCERR SetPEAPGTCCred(SDCConfig *config,  CHAR *username, CHAR *password, CERTLOCATION certLocation, CHAR *caCert );
SDCERR GetPEAPGTCCred(SDCConfig *config,  CHAR *username, CHAR *password, CERTLOCATION *certLocation, CHAR *caCert );
SDCERR SetPEAPMSCHAPCred(SDCConfig *config,  CHAR *username, CHAR *password, CERTLOCATION certLocation, CHAR *caCert );
SDCERR GetPEAPMSCHAPCred(SDCConfig *config,  CHAR *username, CHAR *password, CERTLOCATION *certLocation, CHAR *caCert );
SDCERR SetEAPTLSCred(SDCConfig *config,  CHAR *username, CHAR *userCert, CERTLOCATION certLocation, CHAR *caCert);
SDCERR GetEAPTLSCred(SDCConfig *config,  CHAR *username, CHAR *userCert, CERTLOCATION *certLocation, CHAR *caCert);
DWORD  ScanWiFiBSSID(void);
DWORD  GetWiFiBSSIDList(BYTE *buffer);






//Summit Dynamic Link
typedef SDCERR (WINAPI * PFN_GetCurrentConfig)(DWORD *num, CHAR *name);
typedef SDCERR (WINAPI * PFN_ModifyConfig)(CHAR *name, SDCConfig *config);
typedef SDCERR (WINAPI * PFN_GetConfig)(CHAR *name, SDCConfig *config);
typedef SDCERR (WINAPI * PFN_DeleteConfig)(CHAR *name);
typedef SDCERR (WINAPI * PFN_GetNumConfigs)(DWORD *num);
typedef SDCERR (WINAPI * PFN_ActivateConfig)(CHAR *name);
typedef SDCERR (WINAPI * PFN_AddConfig)(SDCConfig *config);
typedef SDCERR (WINAPI * PFN_GetAllConfigs)(SDCConfig *config, DWORD *num);
typedef SDCERR (WINAPI * PFN_SetAllConfigs)(DWORD num, SDCConfig *config);
typedef SDCERR (WINAPI * PFN_GetGlobalSettings)(SDCGlobalConfig *configGlobal);
typedef SDCERR (WINAPI * PFN_SetGlobalSettings)(SDCGlobalConfig *configGlobal);
typedef SDCERR (WINAPI * PFN_Get3rdPartyConfig)(SDC3rdPartyConfig *config3rd);
typedef SDCERR (WINAPI * PFN_Set3rdPartyConfig)(SDC3rdPartyConfig *config3rd);
typedef SDCERR (WINAPI * PFN_GetCurrentStatus)(CF10G_STATUS *status);
typedef SDCERR (WINAPI * PFN_RadioDisable)();
typedef SDCERR (WINAPI * PFN_RadioEnable)();
typedef REG_DOMAIN (WINAPI * PFN_GetCurrentDomain)();
typedef SDCERR (WINAPI * PFN_GetSDKVersion)(DWORD *version);
typedef SDCERR (WINAPI * PFN_FlushConfigKeys)(INT configNumber);
typedef SDCERR (WINAPI * PFN_FlushAllConfigKeys)();
typedef SDCERR (WINAPI * PFN_GetConfigFileInfo)(CHAR *fileName, CONFIG_FILE_INFO *info);
typedef SDCERR (WINAPI * PFN_ExportSettings)(CHAR *fileName, SDC_ALL *configAll);
typedef SDCERR (WINAPI * PFN_ImportSettings)(CHAR *fileName, SDC_ALL *configAll);
typedef SDCERR (WINAPI * PFN_SetWEPKey)(SDCConfig *config, INT keyIndex,  WEPLEN keyLength, UCHAR *wepKey, BOOLEAN keyState);
typedef SDCERR (WINAPI * PFN_GetWEPKey)(SDCConfig *config, INT keyIndex,  WEPLEN *keyLength, UCHAR *wepKey, BOOLEAN *keyState);
typedef SDCERR (WINAPI * PFN_SetMultipleWEPKeys)(SDCConfig *config,  INT keyIndex,  WEPLEN keyLength1, UCHAR *wepKey1,
                                                        WEPLEN keyLength2, UCHAR *wepKey2,
                                                        WEPLEN keyLength3, UCHAR *wepKey3,
                                                        WEPLEN keyLength4, UCHAR *wepKey4);
typedef SDCERR (WINAPI * PFN_GetMultipleWEPKeys)(SDCConfig *config,  INT *keyIndex, WEPLEN *keyLength1, UCHAR *wepKey1,
                                                        WEPLEN *keyLength2, UCHAR *wepKey2,
                                                        WEPLEN *keyLength3, UCHAR *wepKey3,
                                                        WEPLEN *keyLength4, UCHAR *wepKey4);
typedef SDCERR (WINAPI * PFN_SetPSK)(SDCConfig *config,  CHAR *psk);
typedef SDCERR (WINAPI * PFN_GetPSK)(SDCConfig *config,  CHAR *psk);
typedef SDCERR (WINAPI * PFN_SetLEAPCred)(SDCConfig *config,  CHAR *username, CHAR *password);
typedef SDCERR (WINAPI * PFN_GetLEAPCred)(SDCConfig *config,  CHAR *username, CHAR *password);
typedef SDCERR (WINAPI * PFN_SetEAPFASTCred)(SDCConfig *config,  CHAR *username, CHAR *password, CHAR *pacFileName, CHAR *pacPassword);
typedef SDCERR (WINAPI * PFN_GetEAPFASTCred)(SDCConfig *config,  CHAR *username, CHAR *password, CHAR *pacFileName, CHAR *pacPassword);
typedef SDCERR (WINAPI * PFN_SetPEAPGTCCred)(SDCConfig *config,  CHAR *username, CHAR *password, CERTLOCATION certLocation, CHAR *caCert );
typedef SDCERR (WINAPI * PFN_GetPEAPGTCCred)(SDCConfig *config,  CHAR *username, CHAR *password, CERTLOCATION *certLocation, CHAR *caCert );
typedef SDCERR (WINAPI * PFN_SetPEAPMSCHAPCred)(SDCConfig *config,  CHAR *username, CHAR *password, CERTLOCATION certLocation, CHAR *caCert );
typedef SDCERR (WINAPI * PFN_GetPEAPMSCHAPCred)(SDCConfig *config,  CHAR *username, CHAR *password, CERTLOCATION *certLocation, CHAR *caCert );
typedef SDCERR (WINAPI * PFN_SetEAPTLSCred)(SDCConfig *config,  CHAR *username, CHAR *userCert, CERTLOCATION certLocation, CHAR *caCert);
typedef SDCERR (WINAPI * PFN_GetEAPTLSCred)(SDCConfig *config,  CHAR *username, CHAR *userCert, CERTLOCATION *certLocation, CHAR *caCert);
typedef DWORD  (WINAPI * PFN_GetWiFiBSSIDList)(BYTE *buffer);
typedef DWORD  (WINAPI * PFN_ScanWiFiBSSID)(void);


#define FILE_DEVICE_SD_WIFI     FILE_DEVICE_NETWORK

#define SDHC_IOCTL_SLOT_DISABLE \
    CTL_CODE(FILE_DEVICE_SD_WIFI, 0, METHOD_BUFFERED, FILE_ANY_ACCESS)

#define SDHC_IOCTL_SLOT_ENABLE \
    CTL_CODE(FILE_DEVICE_SD_WIFI, 1, METHOD_BUFFERED, FILE_ANY_ACCESS)

#define SDHC_IOCTL_SLOT_GET_STATUS \
    CTL_CODE(FILE_DEVICE_SD_WIFI, 2, METHOD_BUFFERED, FILE_ANY_ACCESS)






#ifdef __cplusplus
 }
#endif



#endif  //ATHENACE_SYS_H


