You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
113 lines
2.1 KiB
C
113 lines
2.1 KiB
C
#ifndef GLOBAL_H
|
|
#define GLOBAL_H
|
|
|
|
#include "DevType.h"
|
|
|
|
#define PRINTTYPE_LPT 1
|
|
#define PRINTTYPE_COM 2
|
|
#define PRINTTYPE_USBLPT 3
|
|
#define PRINTTYPE_OTHER 4
|
|
|
|
#define DEVWRITEBUFSIZE 1024
|
|
|
|
//错误定义
|
|
#define DLL_INITFAIL -1
|
|
#define DEVSTR_NEWFAILE -2
|
|
#define DEVOBJ_ISNULL -10
|
|
|
|
#define JSON_PARAERR -15
|
|
|
|
#define WINIO_INITFAIL -20
|
|
#define PARALLEPORT_STATESERR -100
|
|
#define DEV_WRITERR -200
|
|
#define DEV_READERR -201
|
|
|
|
//
|
|
#define STR_ISNULL -300
|
|
#define STR_LENGTHERR -301
|
|
#define STR_FORMATERR -302
|
|
|
|
|
|
//
|
|
#define MAXNAME_LEN 64
|
|
#define MAXVALUE_LEN 128
|
|
#define MAXDATA_LEN 384
|
|
|
|
typedef struct printerPara
|
|
{
|
|
char Name[MAXNAME_LEN];
|
|
int col;
|
|
int line;
|
|
}myprinterPara;
|
|
|
|
typedef struct printerInfo
|
|
{
|
|
char Name[MAXNAME_LEN];
|
|
char Value[MAXVALUE_LEN];
|
|
}myprinterInfo;
|
|
|
|
typedef struct printerData
|
|
{
|
|
int line;
|
|
char Data[MAXDATA_LEN];
|
|
}myprinterData;
|
|
|
|
typedef struct CutPaperPara
|
|
{
|
|
int iCutPaper;
|
|
int iCmdlf;
|
|
int iCutcmd;
|
|
|
|
}myCutPaperPara;
|
|
|
|
/*
|
|
typedef struct SendFrame
|
|
{
|
|
char buf[DEVWRITEBUFSIZE];
|
|
int iDatalen;
|
|
}mySendFrame;
|
|
*/
|
|
|
|
int isnumer(char cChar, int base = 10);
|
|
int isnumer(char * buf, int base = 10);
|
|
|
|
//int QStringToChar(char * dest, QString & Qsource, int iLen);
|
|
int QStringToChar(char * dest,QString & Qsource, int iLen, int isChange =0);
|
|
char * GetErrStr(INT32 ErrorCode);
|
|
|
|
int isLptPort(char * buf);
|
|
int isComPort(char * buf);
|
|
void charToUpper(char * buf);
|
|
|
|
//void mySleep(unsigned int itime);
|
|
|
|
// 串口检查
|
|
//波特率
|
|
int isBaudRate(int baud);
|
|
|
|
//
|
|
int GetBaud(char * buf);
|
|
|
|
//数据位
|
|
int isDataBits(int iBit);
|
|
|
|
//校验位
|
|
int isParity(int iParity);
|
|
|
|
//停止位
|
|
int isStopBits(int iBit);
|
|
|
|
void ByteToASC(char* buf, char data);
|
|
|
|
void InitPrinterPara(myprinterPara * pPara);
|
|
void InitPrinterInfo(myprinterInfo * pPara);
|
|
void InitPrinterData(myprinterData * pPara);
|
|
void InitPrinterCutPara(myCutPaperPara * pPara);
|
|
|
|
//void InitSendFrame(mySendFrame * ptr);
|
|
|
|
//获取错误码
|
|
char * GetErrStr(INT32 ErrorCode);
|
|
|
|
#endif // GLOBAL_H
|