#pragma once
#ifndef _AL_PRINTER_LIB_H
#define _AL_PRINTER_LIB_H

#define AL_PARA_ERROR  -1
#define AL_SUCCESS 0
#define AL_PORT_UNAVAILABLE 1
#define AL_RECOVER_PRINTER_FAIL 2
#define AL_GET_PRINTER_STATUS_FAIL 3
#define AL_READ_PORT_FAIL 4
#define AL_READ_TIME_OUT 5
#define AL_WRITE_PORT_FAIL 6
#define AL_WRITE_TIME_OUT 7
#define AL_ARGUMENTS_ERROR 8
#define AL_FAIL 9


#define USB_PORT 0
#define SERIAL_PORT 1

#define BAUDRATE_4800 4800
#define BAUDRATE_9600 9600
#define BAUDRATE_19200 19200
#define BAUDRATE_38400 38400
#define BAUDRATE_57600 57600
#define BAUDRATE_115200 115200

#ifdef WIN32
#define _AL_API_ __declspec(dllexport) 
#else
#define _AL_API_ 
#endif

#define LIB_CALLING		__stdcall
#ifdef __cplusplus
extern "C" {
#endif
	_AL_API_ int LIB_CALLING SetCommSettings(int portType, int portNo, int baudRate, int flowControl);
	_AL_API_ int LIB_CALLING  OpenPort();
	_AL_API_ void LIB_CALLING ClosePort();
	_AL_API_ int LIB_CALLING  SendDataToDevice(unsigned char *Buffer, DWORD wLength, LPDWORD wBytes, unsigned int iWaitTime);
	_AL_API_ int LIB_CALLING  ReceiveDataFromDevice(unsigned char *Buffer, DWORD wLength, LPDWORD wBytes, unsigned int iWaitTime);
	_AL_API_ int SetLedOn(int lednum);
	_AL_API_ int SetLedOff(int lednum);
	_AL_API_ int SetLedFlash(int lednum, int flashnum);
#ifdef __cplusplus
}
#endif


#endif //_SZZT_PRINTER_LIB_H