#ifndef YCAPI_H
#define YCAPI_H

//#include "ycapi_global.h"
//#include <QtCore/qglobal.h>
#include <linux/input.h>

#if defined(YCAPI_LIBRARY)
#  define YCAPISHARED_EXPORT Q_DECL_EXPORT
#else
#  define YCAPISHARED_EXPORT Q_DECL_IMPORT
#endif

#define IO_POLLING_MODE 0
#define IO_INTR_MODE    1

#define IO_INTR_LOW_LEVEL_TRIGGERED    0
#define IO_INTR_HIGH_LEVEL_TRIGGERED   1
#define IO_INTR_FALLING_EDGE_TRIGGERED 2
#define IO_INTR_RISING_EDGE_TRIGGERED  3
#define IO_INTR_BOTH_EDGE_TRIGGERED    4

//YCAPISHARED_EXPORT
class  Ycapi {
public:
    Ycapi();

    bool BeepOn(bool bStatus);

    bool SetLed(bool bStatus);

    bool SetWDog(int interval);
    bool StartWDog();
    bool FeedWDog();
    bool StopWDog();

    bool WriteEEPROM(int addr,char *buf);
    bool ReadEEPROM(int addr,char *buf);

     bool ReadEEPROMLen(int addr,char *buf,int len);
     bool WriteEEPROMLen(int addr,char *buf,int len);

    bool SetIO( unsigned char level , unsigned char ioNum);
    bool SetIoMode(int ioNum,int ioMode ,int triggeredMode);
    unsigned char GetIO(unsigned char * level ,unsigned char ioNum);
    bool GetIoBlockMode( unsigned char * level,unsigned char ioNum);

    bool CopyDir(char * dstDir,char * srcDir);

    bool SetBacklightSwitch(bool flag);
    void SetBacklightOn(int BakLevel);
    bool SetBacklightTimeOut(int timeValue);
    void SetDefaultBackLightLevel(int level);
    bool EnableBackLightAuto(bool flag);
    bool GetEnableBackLightAuto();
    int    GetDefaultBackLightLevel();
    int    GetBacklightTimeOut();
    void SendStartBackligtSignal();
    void SendStopBackligtSignal();


    bool SetNetWork(int num,bool isDhcp,char * ip,char * subnetmask,char * gateway,char *dns);
    bool GetNetWorkCfg(int num,bool *isDhcp,char * ip,char * subnetmask,char * gateway,char *dns,char *macAddr);
    bool SetMacAddr(int num,char * macAddr);
    bool GetMacAddr(int num,char * macAddr);
     void RandomSetMacAddr();

    bool SetAutoStartPath(char * path);
    bool GetAutoStartPath(char * path);
    bool RunAutoStartPath();

    bool ReadTouchEvent();

    bool TouchDisable(bool flag);

    bool ReadAdc(int channel,double *data);

    int    GetWifiName(char wifiname[512][512]);
    void CfgWifiSsidPwd(char * ssid,char * pwd);
    void ConnectWifi();
    void DisconnectWifi();
    bool GetWifiSsidPwd(char * ssid,char * pwd);

    void OpenCanFilter(int baudrate,struct can_filter *filter,int filter_count);
    void OpenCan(int baudrate);
    int WriteCan(int can_id,unsigned char *data,unsigned char  dlc);
    int ReadCan(unsigned int  *can_id,unsigned char  *can_dlc,unsigned char *data);
    void CloseCan();

     void OpenCanFilter2(int baudrate,struct can_filter *filter,int filter_count);
    void OpenCan2(int baudrate);
    int WriteCan2(int can_id,unsigned char *data,unsigned char  dlc);
    int ReadCan2(unsigned int  *can_id,unsigned char  *can_dlc,unsigned char *data);
    void CloseCan2();

     bool Connect3G() ;
     bool Disconnect3G();
};

#endif // YCAPI_H
