#ifndef MODULE_READER
#define MODULE_READER

#ifdef __cplusplus
extern "C" {
#endif

	typedef enum
	{
		MT_OK_ERR = 0,
		MT_IO_ERR = 1,
		MT_INTERNAL_DEV_ERR = 2,
		MT_CMD_FAILED_ERR = 3,
		MT_CMD_NO_TAG_ERR = 4,
		MT_M5E_FATAL_ERR = 5,
		MT_OP_NOT_SUPPORTED = 6,
		MT_INVALID_PARA = 7,
		MT_INVALID_READER_HANDLE = 8,
		MT_HARDWARE_ALERT_ERR_BY_HIGN_RETURN_LOSS = 9,
		MT_HARDWARE_ALERT_ERR_BY_TOO_MANY_RESET = 10,
		MT_HARDWARE_ALERT_ERR_BY_NO_ANTENNAS = 11,
		MT_HARDWARE_ALERT_ERR_BY_HIGH_TEMPERATURE = 12,
		MT_HARDWARE_ALERT_ERR_BY_READER_DOWN = 13,
		MT_HARDWARE_ALERT_ERR_BY_UNKNOWN_ERR = 14,
		M6E_INIT_FAILED = 15,
		MT_OP_EXECING = 16,
		MT_UNKNOWN_READER_TYPE = 17,
		MT_OP_INVALID = 18,
		MT_HARDWARE_ALERT_BY_FAILED_RESET_MODLUE = 19,
		MT_MAX_ERR_NUM = 20,
		MT_TEST_DEV_FAULT_1 = 51,
		MT_TEST_DEV_FAULT_2 = 52,
		MT_TEST_DEV_FAULT_3 = 53,
		MT_TEST_DEV_FAULT_4 = 54,
		MT_TEST_DEV_FAULT_5 = 55,
		MT_FREQUENT_ERR = 60, 
		MT_UPDFWFROMSP_OPENFILE_FAILED = 80,
		MT_UPDFWFROMSP_FILE_FORMAT_ERR = 81,

		MT_JNI_INVALID_PARA = 101,
		MT_MAX_INT_NUM = 0x7FFFFFFF,
	}READER_ERR;

	typedef enum 
	{
		MODOULE_NONE,
		MODOULE_R902_M1S,
		MODOULE_R902_M2S,
		MODOULE_M5E,
		MODOULE_M5E_C,
		MODOULE_M6E,
		MODOULE_PR9000,
		MODOULE_M5E_PRC,
		MODOULE_M6E_PRC,
		MODOULE_M6E_MICRO,
		MODOULE_SLR1100,
		MODOULE_SLR1200,
		MODOULE_SLR1300,
		MODOULE_SLR3000,
		MODOULE_SLR5100,
		MODOULE_SLR5200,
		MODOULE_SLR3100,
		MODOULE_SLR3200,
		MODOULE_SLR5300,
		MODOULE_SLR5900,
		MODOULE_SLR5800,
		MODOULE_SLR6000,
		MODOULE_SLR6100,
		MODOULE_SIM7100,
		MODOULE_SIM7200,
		MODOULE_SIM7300,
		MODOULE_SIM7400,
		MODOULE_SIM7500,
		MODOULE_SIM7600,
		MODOULE_SIM3100,
		MODOULE_SIM3200,
		MODOULE_SIM3300,
		MODOULE_SIM3400,
		MODOULE_SIM3500,
		MODOULE_SIM3600,
		MODOULE_SIM5100,
		MODOULE_SIM5200,
		MODOULE_SIM5300,
		MODOULE_SIM5400,
		MODOULE_SIM5500,
		MODOULE_SIM5600,
		MODOULE_SIM3110,
	}Module_Type;
	
	typedef enum 
	{
		MAINBOARD_NONE,
        MAINBOARD_ARM7,
        MAINBOARD_SERIAL,
        MAINBOARD_WIFI,
		MAINBOARD_ARM9,
		MAINBOARD_ARM9_WIFI,
		MAINBOARD_INTEGRATED_SERIAL,
		MAINBOARD_ARM9_V2,
		MAINBOARD_ARM9_WIFI_V2,
	} MaindBoard_Type;

	typedef enum
	{
		MODULE_TWO_ANTS,
		MODULE_FOUR_ANTS,
		MODULE_THREE_ANTS,
		MODULE_ONE_ANT,
		PR9000,
        MODULE_ARM7_TWO_ANTS,
		MODULE_ARM7_FOUR_ANTS,
		M6E_ARM7_FOUR_ANTS,
		M56_ARM7_FOUR_ANTS,
		R902_M1S,
		R902_M2S,
		ARM7_16ANTS,
		SL_COMMN_READER,
		ANT_ONE_EXT_MULTIPORTS,
	} Reader_Type;
	
	typedef struct  
	{
		Module_Type module;
		MaindBoard_Type board;
		Reader_Type logictype;
int selfcheckants;
	} HardwareDetails;

	typedef enum
	{
		SL_TAG_PROTOCOL_NONE              = 0x00,
		SL_TAG_PROTOCOL_ISO180006B        = 0x03,
		SL_TAG_PROTOCOL_GEN2              = 0x05,
		SL_TAG_PROTOCOL_ISO180006B_UCODE  = 0x06, 
		SL_TAG_PROTOCOL_IPX64             = 0x07,
		SL_TAG_PROTOCOL_IPX256            = 0x08,
	} SL_TagProtocol;

	typedef enum
	{
		RG_NONE = 0x0,
		RG_NA = 0x01,
		RG_EU = 0x02,
		RG_EU2 = 0X07,
		RG_EU3 = 0x08,
		RG_KR = 0x03,
		RG_PRC = 0x06,
		RG_PRC2 = 0x0A,

		RG_OPEN = 0xFF,

		RG_IN=0x04,
		RG_JP=0x05,
		RG_CE_HIGH = 0x0C,
        RG_HK = 0x0D,
        RG_TAIWAN = 0x0E,
        RG_MALAYSIA = 0x0F,
        RG_SOUTH_AFRICA = 0x10,
        RG_BRAZIL = 0x11,
        RG_THAILAND = 0x12,
        RG_SINGAPORE = 0x13,
        RG_AUSTRALIA=0x14,
        RG_URUGUAY = 0x16,
        RG_VIETNAM = 0x17,
        RG_ISRAEL = 0x18,
        RG_PHILIPPINES = 0x19,
        RG_INDONESIA = 0x1A,
        RG_NEW_ZEALAND = 0x1B,
        RG_PERU = 0x1C,
        RG_RUSSIA = 0x1D,
        RG_CE_LOW_HIGH=0x1E,
	} Region_Conf;
	
	typedef enum
	{
	
		MTR_PARAM_POTL_GEN2_SESSION,
		MTR_PARAM_POTL_GEN2_Q,
		MTR_PARAM_POTL_GEN2_TAGENCODING,
		MTR_PARAM_POTL_GEN2_MAXEPCLEN,
		MTR_PARAM_RF_ANTPOWER,
		MTR_PARAM_RF_MAXPOWER,
		MTR_PARAM_RF_MINPOWER,
		MTR_PARAM_TAG_FILTER,
		MTR_PARAM_TAG_EMBEDEDDATA,
		MTR_PARAM_TAG_INVPOTL,
		MTR_PARAM_READER_CONN_ANTS,
		MTR_PARAM_READER_AVAILABLE_ANTPORTS,
		MTR_PARAM_READER_IS_CHK_ANT,
		MTR_PARAM_READER_VERSION,
		MTR_PARAM_READER_IP,
		MTR_PARAM_FREQUENCY_REGION,
		MTR_PARAM_FREQUENCY_HOPTABLE,
		MTR_PARAM_POTL_GEN2_BLF,
		MTR_PARAM_POTL_GEN2_WRITEMODE,

		MTR_PARAM_POTL_GEN2_TARGET, //0:A; 1:B; 2:A->B; 3:B->A
		MTR_PARAM_TAGDATA_UNIQUEBYANT,
		MTR_PARAM_TAGDATA_UNIQUEBYEMDDATA,
		MTR_PARAM_TAGDATA_RECORDHIGHESTRSSI,
		MTR_PARAM_RF_TEMPERATURE,
		MTR_PARAM_RF_HOPTIME,
		MTR_PARAM_RF_LBT_ENABLE,
		MTR_PARAM_RF_SUPPORTEDREGIONS,
		MTR_PARAM_POTL_SUPPORTEDPROTOCOLS,
		MTR_PARAM_POTL_ISO180006B_BLF,
		MTR_PARAM_POTL_GEN2_TARI, //0:Tari of 25 microseconds;1:Tari of 12.5 microseconds;2:Tari of 6.25 microseconds
		MTR_PARAM_TRANS_TIMEOUT,
		MTR_PARAM_TAG_EMDSECUREREAD,
		MTR_PARAM_TRANSMIT_MODE,
		MTR_PARAM_POWERSAVE_MODE,
		MTR_PARAM_TAG_SEARCH_MODE,

		MTR_PARAM_POTL_ISO180006B_MODULATION_DEPTH,
		MTR_PARAM_POTL_ISO180006B_DELIMITER,
		MTR_PARAM_RF_ANTPORTS_VSWR,

		//alter by dkg
		MTR_PARAM_SAVECONFIGURATION,
		MTR_PARAM_MAXINDEX,

		//by dkg
		MTR_PARAM_INTERNALSAVECONFIGURATION,
		MTR_PARAM_CUSTOM,

		MTR_PARAM_READER_WATCHDOG,
		MTR_PARAM_READER_ERRORDATA,
		MTR_PARAM_RF_HOPANTTIME,

		MTR_PARAM_TAG_MULTISELECTORS,

		MTR_PARAM_SAVEINMODULE,
		MTR_PARAM_SAVEINMODULE_BAUD,
	}Mtr_Param;
    
	typedef enum
	{
		TAGOP_EMBEDDEDSPEC_NONE = 0,
		TAGOP_MONZA4_QTPEEK2PRIVATE = 1,
		TAGOP_MONZA4_QTPEEK2PUBLIC = 2,
		TAGOP_U8=3,
	} TagOpEmbeddedSpecReq_Code;

#define MAXANTCNT 16
#define MAXIPSTRLEN 50
#define HOPTABLECNT 100
#define MAXEPCBYTESCNT 62
#define MAXEMBDATALEN 128
#define MAXINVPOTLSCNT 6
#define MAXGPICNT 8

	typedef struct
	{
		int GpiId;
		int State;
	} GpiState_ST;
	typedef struct
	{
		int gpiCount;
		GpiState_ST gpiStats[MAXGPICNT];
	} GpiInfo_ST;

	typedef struct
	{
		void *pCusParam;
		int CParamlen;
	} CustomParam_ST;

	typedef struct  
	{
		unsigned int ReadCnt;
		int RSSI;
		unsigned char AntennaID;
		unsigned int Frequency;
		unsigned int TimeStamp;
		unsigned short EmbededDatalen;
		unsigned char EmbededData[MAXEMBDATALEN];
		unsigned char Res[2];
		unsigned short Epclen;
		unsigned char PC[2];
		unsigned char CRC[2];	
		unsigned char EpcId[MAXEPCBYTESCNT];
		int Phase;
		SL_TagProtocol protocol;
	} TAGINFO;
	

	typedef struct
	{
		int tagtype;
		int pwdtype;
		int ApIndexStartBitsInEpc;
		int ApIndexBitsNumInEpc;
		int bank;
		int address;
		int blkcnt;
		unsigned int accesspwd;
	} EmbededSecureRead_ST;

	typedef struct  
	{
		char ip[50];
		char mask[50];
		char gateway[50];
	} Reader_Ip;

	typedef struct  
	{
		char ver[20];
	} Reader_Ver;

	typedef struct  
	{
		int bank;
		unsigned int startaddr;
		int flen;
		unsigned char *fdata;
		int isInvert;
	} TagFilter_ST;

#define MaxTagSelBytesCount 32
	typedef struct  
	{
		int bank;
		unsigned int startaddr;
		int slen;
		unsigned char sdata[MaxTagSelBytesCount];
	} TagSelector_ST;
#define MaxTagSelcetorCount 16
	typedef struct
	{
		TagSelector_ST multiselectors[MaxTagSelcetorCount];
		int selectorcnt;
	} MultiTagSelectors_ST;

	typedef struct  
	{
		int bank;
		int startaddr;
		int bytecnt;
		unsigned char *accesspwd;
	} EmbededData_ST;

	typedef struct  
	{
		int antid;
		unsigned short readPower;
		unsigned short writePower;
	} AntPower;

	typedef struct  
	{
		int antcnt;
		AntPower Powers[MAXANTCNT];
	}AntPowerConf;

	typedef struct
	{
		int andid;
		unsigned short power;
		Region_Conf region;
		int frequencys[HOPTABLECNT];
		unsigned char vswrs[HOPTABLECNT];
		int frecount;
	} AntPortsVSWR;

	typedef struct  
	{
		int antcnt;
		int connectedants[MAXANTCNT];
	} ConnAnts_ST;

	typedef struct
	{
		unsigned int htb[HOPTABLECNT];
		int lenhtb;
	}HoptableData_ST;

	typedef struct  
	{
		SL_TagProtocol potl;
		int weight;
	} Inv_Potl;

	typedef struct  
	{
		int potlcnt;
		Inv_Potl potls[MAXINVPOTLSCNT];
	} Inv_Potls_ST;

    int  GetSDKVersion(void);

#if !defined (__SCM__)

	typedef struct
	{
		Mtr_Param key;
		void *customkey;
		int isdefault;
		void* val;
		//int valen;
	}Default_Param;

    READER_ERR  GetHardwareDetails(int hReader, HardwareDetails *phd);

    READER_ERR  GetHardwareDetails_BaseType(int hReader, unsigned char *outbuf);

    READER_ERR  InitReader_Notype(int *hReader, char * src, int antscnt);

    READER_ERR  AuthPassword(int hReader, unsigned char *pwd, int pwdlen);

#endif

    READER_ERR  InitReader(int *hReader, char * src, Reader_Type rtype);

    void  CloseReader(int hReader);

    READER_ERR  GetTagData(int hReader, int ant,
		unsigned char bank, unsigned int address, 
		int blkcnt, unsigned char *data, 
		unsigned char *accesspasswd, unsigned short timeout);
	
    READER_ERR  GetTagDataEx(int hReader, int ant,
		unsigned char bank, unsigned int address, 
		int blkcnt, unsigned char *data, 
		unsigned char *accesspasswd, unsigned short timeout, 
		int option, void *pSpec);

    READER_ERR  WriteTagData(int hReader, int ant,
		unsigned char bank, unsigned int address, 
		unsigned char *data, int datalen, 
		unsigned char *accesspasswd, unsigned short timeout);
	
    READER_ERR  WriteTagEpcEx(int hReader, int ant, unsigned char *Epc,
		int epclen, unsigned char *accesspwd, unsigned short timeout);
	
    READER_ERR  TagInventory_Count(int hReader, int *ants, int antcnt, unsigned short timeout,
		int *tagcnt, int isclearbuf);
	
    READER_ERR  TagInventory(int hReader, int *ants, int antcnt, unsigned short timeout,
		TAGINFO *pTInfo, int *tagcnt);
	
    READER_ERR  TagInventory_Raw(int hReader, int *ants, int antcnt, unsigned short timeout,
		int *tagcnt);

    READER_ERR  TagInventory_BaseType(int hReader, int *ants, int antcnt, unsigned short timeout,
		unsigned char *outbuf, int *tagcnt);
	
    READER_ERR  GetNextTag(int hReader, TAGINFO *pTInfo);

    READER_ERR  GetNextTag_BaseType(int hReader, unsigned char *outbuf);

    READER_ERR  PsamTransceiver(int hReader, int soltid, int coslen,
		unsigned char *cos, int *cosresplen, unsigned char *cosresp, 
		unsigned char *errcode, unsigned short timeout);

    READER_ERR  GetReaderAddress(int hReader, char *addr);

    READER_ERR  ReadTagTemperature(int hReader, int ant,unsigned char bank,
		int wordAddress, int wordCount, int alltime, int timeselwait, 
		int timereadwait, unsigned short metaflag, unsigned char *accesspasswd, 
		unsigned char *getdata,int *datalen);

    READER_ERR  ReadTagLED(int hReader, int ant,unsigned short metaflag,
		unsigned short timeout,unsigned char *getdata,int *datalen);

    char*  LookupErrorString(int derrcode);

    READER_ERR  GetLastDetailError(int hReader, int *derrcode, char **errstring);

	typedef enum
	{
		GPITRIGGER_NONE = 0,
		GPITRIGGER_TRI1START_TRI2STOP = 1,
		GPITRIGGER_TRI1START_TIMEOUTSTOP = 2,
		GPITRIGGER_TRI1ORTRI2START_TIMEOUTSTOP = 3,
		GPITRIGGER_TRI1ORTRI2START_TRI1ORTRI2STOP = 4,
	} GpiTrigger_Type;
	
#if !defined (__SCM__)
	
	typedef void (*ReadingErrorHandler)(int hReader, READER_ERR errcode, void* cookie);
	typedef struct
	{
		ReadingErrorHandler handler;
		void *cookie;
	} OnReadingErrorBlock;
    READER_ERR  SetReadingErrorHandler(int hReader, OnReadingErrorBlock bok);

	typedef void (*TagReadHandler)(int hReader, TAGINFO *tag, void* cookie);
	typedef struct
	{
		TagReadHandler handler;
		void *cookie;
	} OnTagReadBlock;
    READER_ERR  SetTagReadHandler(int hReader, OnTagReadBlock bok);

	typedef void (*GpiStateHandler)(int hReader, int triggerid, GpiInfo_ST *gpist, void* cookie);
	/*
	bordertype:1,开始盘点；2，停止盘点
	reason：1，gpi触发；2，超时
	*/
	typedef void (*GpiTriggerBoundaryHandler)(int hReader, int bordertype, int reason, void* cookie);
	typedef struct
	{
		//满足触发条件1和2时进行通知
		GpiStateHandler gshandler;
		//通知读写器开始和停止盘存的触发原因和读写器状态
		GpiTriggerBoundaryHandler gtbhandler;
		void *cookie;
	} OnGpiTriggerBlock;
    READER_ERR  SetGpiTriggerHandler(int hReader, OnGpiTriggerBlock bok);

	typedef void (*InvIdleHandler)(int hReader, void* cookie);
	typedef struct
	{
		InvIdleHandler handler;
		void *cookie;
	} OnInvIdleBlock;
    READER_ERR  SetInvIdleHandler(int hReader, OnInvIdleBlock bok);

	typedef int (*SwitchNextAntHandler)(void *pData, int *nextchan, int *nextlogant, int *invants, int antcnt);
	typedef int (*SwitchAntBoundaryHandler)(void *pData);
	typedef int (*CustomFuncHandler) (void *pRPData, void *pSPData);
	typedef struct
	{
		SwitchNextAntHandler SwitchHandler;
		void *pSwitchData;
		SwitchAntBoundaryHandler PreSwitchHandler;
		void *pPreSwitchData;
		SwitchAntBoundaryHandler AftSwitchHandler;
		void *pAftSwitchData;
		CustomFuncHandler CustomHandler;
		void *pCustomData;
	} MFRAntSwitchBlock;
    READER_ERR  SetSwitchNextAntHandler(int hReader, MFRAntSwitchBlock blk);

	typedef struct
	{
		int IsAntennaID;
		int IsReadCnt;
		int IsRSSI;
		int IsFrequency;
		int IsTimestamp;
		int IsRFU;
		int IsEmdData;
	} TagMetaFlags;


	typedef struct
	{
		GpiInfo_ST GpiTrigger1States;
		GpiInfo_ST GpiTrigger2States;
		GpiTrigger_Type GpiTriggerType;
		int StopTriggerTimeout;
	} GPITrigger;

	typedef struct
	{
		unsigned short ReadDuration;
		unsigned int ReadInterval;
		int IsFastRead;
		unsigned char FastReadDutyRation;
		TagMetaFlags TMFlags;
		GPITrigger GpiTrigger;
		int IsGPITrigger;
	} BackReadOption;

    READER_ERR  StartReading(int hReader, int *ants, int antcnt, BackReadOption *pBRO);

    READER_ERR  StopReading(int hReader);

    READER_ERR  AsyncStartReading(int hReader, int *ants, int antcnt, int option);

    READER_ERR  AsyncGetTagCount(int hReader, int *tagcnt);

    READER_ERR  AsyncGetNextTag(int hReader, TAGINFO *pTInfo);

    READER_ERR  AsyncStopReading(int hReader);

    READER_ERR  FirmwareLoadFromSerialPort(char *serialportpath, char *filepath);

    READER_ERR  RebootReader(char *address);

    READER_ERR  GetDeviceVersion(char *serialportpath, unsigned char *sfver);

#endif

	typedef enum
	{
		LOCK_OBJECT_KILL_PASSWORD = 0x01, //锁定对象为销毁密码
		LOCK_OBJECT_ACCESS_PASSWD = 0x02, //锁定对象为访问密码
		LOCK_OBJECT_BANK1 = 0x04, //锁定对象为bank1
		LOCK_OBJECT_BANK2 = 0x08,  //锁定对象为bank2
		LOCK_OBJECT_BANK3 = 0x10, //锁定对象为bank3		
	} Lock_Obj;
	
	typedef enum
	{
		KILL_PASSWORD_UNLOCK = 0x0000,
		KILL_PASSWORD_LOCK = 0x0200, //销毁密码密码锁定
		KILL_PASSWORD_PERM_LOCK = 0x0300, //销毁密码永久锁定
			
		ACCESS_PASSWD_UNLOCK = 0x00,
		ACCESS_PASSWD_LOCK = 0x80, //访问密码密码锁定
		ACCESS_PASSWD_PERM_LOCK = 0xC0, //访问密码永久锁定
			
		BANK1_UNLOCK = 0x00,
		BANK1_LOCK = 0x20, //bank1密码锁定
		BANK1_PERM_LOCK = 0x30, //bank1永久锁定
			
		BANK2_UNLOCK = 0x00,
		BANK2_LOCK = 0x08, //bank2密码锁定
		BANK2_PERM_LOCK = 0x0C,//bank2永久锁定
			
		BANK3_UNLOCK = 0x00,
		BANK3_LOCK = 0x02, //bank3密码锁定
		BANK3_PERM_LOCK = 0x03, //bank3永久锁定
	} Lock_Type;
	
	
	
	
    READER_ERR  LockTag(int hReader, int ant,
		unsigned char lockobjects, unsigned short locktypes,
		unsigned char *accesspasswd, unsigned short timeout);
	
    READER_ERR  KillTag(int hReader, int ant,
		unsigned char *killpasswd,
		unsigned short timeout);
	
    READER_ERR  Lock180006BTag(int hReader, int ant, int startblk,
		int blkcnt, unsigned short timeout);

    READER_ERR  BlockPermaLock(int hReader, int ant, int readlock, int startblk,
		int blkrange, unsigned char *mask, unsigned char *pwd, unsigned short timeout);

    READER_ERR  BlockErase(int hReader, int ant, int bank, int wordaddr, int wordcnt,
		unsigned char *pwd, unsigned short timeout);

    READER_ERR  SetGPO(int hReader, int gpoid, int state);

    READER_ERR  GetGPI(int hReader, int gpiid, int *state);

    READER_ERR  GetGPIEx(int hReader, GpiInfo_ST *gpiinfo);

	typedef enum
	{
		NXP_SetReadProtect,
		NXP_ResetReadProtect,
		NXP_ChangeEAS,
		NXP_EASAlarm,
		NXP_Calibrate,
			
		ALIEN_Higgs2_PartialLoadImage,
		ALIEN_Higgs2_FullLoadImage,
			
		ALIEN_Higgs3_FastLoadImage,
		ALIEN_Higgs3_LoadImage,
		ALIEN_Higgs3_BlockReadLock,
		ALIEN_Higgs3_BlockPermaLock,

		IMPINJ_M4_Qt,
		YiLian_Temperature,
		YiLian_Led,
		NXP_U8_InventoryMode = 20,
	} CustomCmdType;
	
	typedef struct
	{
		unsigned char AccessPwd[4];
		int CmdType; //0 = read the QT control bits in cache;1 = write the QT control bits 
		int MemType; //0 = Tag uses Private Memory Map;1 = Tag uses Public Memory Map
		int PersistType; //0 = write the QT Control to volatile memory;1 = write the QT Control to nonvolatile memory
		int RangeType; //0 = Tag does not reduce range;1 = Tag reduces range if in or about to be in OPEN or SECURED state
		unsigned short TimeOut;
	} IMPINJM4QtPara;

	typedef struct
	{
		int MemType;//0 = Tag uses Private Memory Map;1 = Tag uses Public Memory Map
		int RangeType;//0 = Tag does not reduce range;1 = Tag reduces range if in or about to be in OPEN or SECURED state
	} IMPINJM4QtResult;

	typedef struct  
	{
		unsigned char AccessPwd[4];
		int isSet;
		unsigned short TimeOut;
	} NXPChangeEASPara;
	
	typedef struct  
	{
		unsigned char DR;
		unsigned char MC;
		unsigned char TrExt;
		unsigned short TimeOut;
	} NXPEASAlarmPara;
	
	typedef struct  
	{
		unsigned char EASdata[8];
	} NXPEASAlarmResult;
	
	typedef struct  
	{
		unsigned char AccessPwd[4];
		unsigned char BlkBits;
		unsigned short TimeOut;
	} ALIENHiggs3BlockReadLockPara;
	
    READER_ERR  SyncStartFastReading(int hReader, int* ants, int antcnt, int option);
    READER_ERR  SyncGetNextTag(int hReader, TAGINFO *tag);
    READER_ERR  SyncStopFastReading(int hReader);

#if !defined (__SCM__)

    READER_ERR  ResetRfidModule(int hReader);

    READER_ERR  AsyncGetNextTag_BaseType(int hReader, unsigned char *outbuf);

    READER_ERR  GetLastDetailError_BaseType(int hReader, unsigned char *outbuf);

    READER_ERR  GetGPIEx_BaseType(int hReader, unsigned char *outbuf);
/*
	data:要发送的数据
	datalen：要发送数据的长度，单位字节
	timeout：超时时间，单位毫秒
	返回值：0表示成功，-1表示失败
*/
    int  DataTransportSend(int hReader, unsigned char *data, int datalen, int timeout);
	
/*
	data:接收缓冲区
	datalen：要接收数据的长度，单位字节
	timeout：超时时间，单位毫秒
	返回值：0表示成功，-1表示失败
*/
    int  DataTransportRecv(int hReader, unsigned char *data, int datalen, int timeout);

    READER_ERR  SaveDataOnReader(int hReader, int address, unsigned char *data, int datalen);
	
    READER_ERR  ReadDataOnReader(int hReader, int address, unsigned char *data, int datalen);

    READER_ERR  EraseDataOnReader(int hReader);

    READER_ERR  GetReaderDetails(int hReader, unsigned char *info);

#endif


    READER_ERR  CustomCmd(int hReader, int ant, CustomCmdType cmdtype, void *CustomPara, void *CustomRet);

    READER_ERR  CustomCmd_BaseType(int hReader, int ant, int cmdtype, unsigned char *CustomPara, unsigned char *CustomRet);

    READER_ERR  ParamGet(int hReader, Mtr_Param key, void *val);

    READER_ERR  ParamSet(int hReader, Mtr_Param key, void *val);

    void  Hex2Str(unsigned char *buf, int len, char *out);
	
    void  Str2Hex(const char *buf, int len, unsigned char *hexbuf);
	
    void  Str2Binary(const char *buf,int len,unsigned char *binarybuf);


#if defined (__SCM__)

	typedef struct  
	{
		unsigned int seconds;
		unsigned int milisecs;
	} SCM_TIME_ST;
	 
	typedef void SCM_GetSysClock(SCM_TIME_ST *time);
	typedef void SCM_Sleep(int milisecs);
	typedef int SCM_Trans_Recv(unsigned char *data, unsigned int len, unsigned int timeout);
	typedef int SCM_Trans_Send(unsigned char *data, unsigned int len, unsigned int timeout);
	typedef int SCM_Trans_Open();
	typedef int SCM_Trans_Close();
	typedef int SCM_Trans_SetPhySpeed(unsigned int speed);
	typedef int SCM_Trans_ClearRecvBuffer();
	typedef int SCM_Trans_Flush();
	typedef int SCM_Trans_IsFinResp(unsigned char *resp);

	typedef struct  
	{
		SCM_GetSysClock *scmGetSysClock;
		SCM_Sleep *scmSleep;
		SCM_Trans_Recv *scmTransRecv;
		SCM_Trans_Send *scmTransSend;
		SCM_Trans_Open *scmTransOpen;
		SCM_Trans_Close *scmTransClose;
		SCM_Trans_SetPhySpeed *scmTransSetPhySpeed;
		SCM_Trans_ClearRecvBuffer *scmTransClearRecvBuffer;
		SCM_Trans_Flush *scmTransFlush;
		SCM_Trans_IsFinResp *scmTransIsFinResp;
	} SCM_READER_CLK_TRANS;
	
    READER_ERR  SCMInitEnv(SCM_READER_CLK_TRANS clk_trans);
    READER_ERR  SCMSetDgPrintf(int pt);
    READER_ERR  StartTagInventory(int hReader, int *ants, int antcnt, unsigned short timeout);
    READER_ERR  IsFinTagInventory(int hReader, int *tagcnt);

    READER_ERR  StartGetTagData(int hReader, int ant,
		unsigned char bank, unsigned int address, 
		int blkcnt,  unsigned char *accesspasswd, unsigned short timeout);
    READER_ERR  IsFinGetTagData(int hReader, unsigned char *data);

#endif

	
/*
以下这些函数的功能已经被ParamGet和ParamSet所代替，不建议再使用了

*/
    READER_ERR  WriteTagEpc(int hReader, int ant,
		unsigned char *Epc, int epclen, unsigned short timeout);

    READER_ERR  SetInvPotl(int hReader, int potlcnt, SL_TagProtocol *potls, int *pweithts);

    READER_ERR  SetFilter(int hReader, int bank, unsigned int startaddr,
		unsigned char *filterdata, int datalen, int isInvert);
	
    READER_ERR  ResetFilter(int hReader);
	
    READER_ERR  SetEmbededData(int hReader, int bank, int startaddr, int bytecnt,
		unsigned char *accesspwd);
	
    READER_ERR  ResetEmbededData(int hReader);
	
    READER_ERR  GetAllAnts(int hReader, int *ants, int *antscnt);
 
    READER_ERR  GetAntsPower(int hReader, int *antcnt, unsigned short *rpwrs, unsigned short *wpwrs);

    READER_ERR  GetIpInfo(int hReader, char *ip, char *subnet, char *gateway);

    READER_ERR  GetGen2Session(int hReader, int *sess);

    READER_ERR  SetRegion(int hReader, Region_Conf rg);
	
    READER_ERR  SetIpInfo(int hReader, char *ip, char *subnet, char *gateway);

    READER_ERR  SetReadPower(int hReader, unsigned short power);

    READER_ERR  SetWritePower(int hReader, unsigned short power);
	
    READER_ERR  SetEPCLength(int hReader, int len);

    READER_ERR  SetGen2Session(int hReader, int sess);

    READER_ERR  SetGen2MVal(int hReader, int mval);

    READER_ERR  SetAntsPower(int hReader, int *ants, int antcnt, unsigned short *rpwrs, unsigned short *wpwrs);

    READER_ERR  GetPowerLimit(int hReader, unsigned short *MaxPower, unsigned short *MinPower);
	
#ifdef __cplusplus
}
#endif

#endif


