// Copyright *** Corporation.  All rights reserved.
// Redistribution is Prohibited.

#include <WINSOCK2.H>

typedef struct
{
	unsigned int year;
	unsigned char month;
	unsigned char day;
	unsigned char hour;
	unsigned char minute;
	unsigned char second;
}DateTime;

typedef struct
{
	unsigned char TagType;
	unsigned char AntNum;
	unsigned char Ids[ID_Length];
}TagIds;

typedef struct
{	DateTime DateTime;
	unsigned char TagType;
	unsigned char AntNum;
	unsigned char Ids[ID_Length];
}OLTagIds;

//reader manage function
short __declspec(dllexport) __stdcall SelectStation (unsigned char StationNum);
short __declspec(dllexport) __stdcall OpenReader (HANDLE *hCom, unsigned char LinkType,char *com_port);
short __declspec(dllexport) __stdcall CloseReader (HANDLE hCom);
short __declspec(dllexport) __stdcall SetBaudRate(HANDLE hCom, USHORT BaudRate);
short __declspec(dllexport) __stdcall SetParameter(HANDLE hCom, unsigned int iAddr, unsigned char ParaCount,unsigned char * Parameters); 
short __declspec(dllexport) __stdcall GetParameter(HANDLE hCom, unsigned int iAddr, unsigned char ParaCount,unsigned char *value);
short __declspec(dllexport) __stdcall ResetReader (HANDLE hCom);
short __declspec(dllexport) __stdcall GetFirmwareVersion (HANDLE hCom, unsigned char *SoftwareFlag, unsigned char *major, unsigned char *minor);
short __declspec(dllexport) __stdcall StopRFwork(HANDLE hCom);

//tag operation function
short __declspec(dllexport) __stdcall SingleTagIdentifyEX(HANDLE hCom, unsigned char * TagType, unsigned char *value) ;
short __declspec(dllexport) __stdcall SingleTagIdentify(HANDLE hCom, unsigned int TagType, unsigned char *value) ;
short __declspec(dllexport) __stdcall MultipleTagIdentify(HANDLE hCom, unsigned int TagType, unsigned char * Count,TagIds *value);
short __declspec(dllexport) __stdcall ReadTagUserWithID(HANDLE hCom, unsigned char count, unsigned int Addr, unsigned char *Id,unsigned char *value);
short __declspec(dllexport) __stdcall ReadTagUser(HANDLE hCom, unsigned char count, unsigned int Addr, unsigned char *value,unsigned char *TagID);
short __declspec(dllexport) __stdcall WriteTagUserWithID(HANDLE hCom, unsigned char count, unsigned int Addr,unsigned char *Id, unsigned char *value,unsigned char *Result);
short __declspec(dllexport) __stdcall WriteTagUser(HANDLE hCom, unsigned char count, unsigned int Addr, unsigned char *value,unsigned char *Result,unsigned char *TagID);

short __declspec(dllexport) __stdcall EnterTagPassword(HANDLE hCom, unsigned char *Passwrd) ;
short __declspec(dllexport) __stdcall SetTagSafeLevel(HANDLE hCom, unsigned char *Id, unsigned char SafeLevel) ;
short __declspec(dllexport) __stdcall SetTagPassword(HANDLE hCom, unsigned char *Id, unsigned char *NewPasswrd) ;
short __declspec(dllexport) __stdcall LockTagUser(HANDLE hCom, unsigned char *Id, unsigned char LockStatus) ;

//Reader application function
short __declspec(dllexport) __stdcall GetTrigState (HANDLE hCom);
short __declspec(dllexport) __stdcall BeepControl(HANDLE hCom, unsigned char ControlType);
short __declspec(dllexport) __stdcall SetRelayState(HANDLE hCom, unsigned char Mask, unsigned char State);

short __declspec(dllexport) __stdcall SetIdmData(HANDLE hCom, unsigned char order,unsigned char match_length, unsigned int count,TagIds *value);
short __declspec(dllexport) __stdcall GetIdmData (HANDLE hCom, unsigned char * moreFlag,unsigned int *count,TagIds *value) ;
short __declspec(dllexport) __stdcall SetOLEnable (HANDLE hCom,unsigned char flag) ;
short __declspec(dllexport) __stdcall GetOLData(HANDLE hCom, unsigned char * moreFlag,unsigned int *count,OLTagIds *value);
short __declspec(dllexport) __stdcall SetReaderDateTime(HANDLE hCom,DateTime * dateTime) ;
short __declspec(dllexport) __stdcall GetReaderDateTime(HANDLE hCom,DateTime * dateTime) ;
