Exemplo n.º 1
0
UINT8 ucSelectPrintCVChannel(DevHandle hDev, UINT8 ucChannel)
{
	UINT8  ucInBuf[20];
	UINT32 uiInLen;
	UINT8  ucOutBuf[20];
	UINT32 uiOutLen;
	UINT8 ucRet;
	
	memcpy(ucInBuf, "\x1B\x2F", 2);
	uiInLen = 2;
	ucInBuf[uiInLen] = ucChannel;
	uiInLen += 1;
	
	ucMakePrinterCmd(ucInBuf, uiInLen, ucOutBuf, &uiOutLen);
	ucRet = EA_ucWriteDevice(hDev, uiOutLen, 3, ucOutBuf);
	if (ucRet != EM_SUCCESS)
	{
		display(2, "%s(%d):%02x", __FILE__, __LINE__, ucRet);
		inkey(0);
		
		return 1;
	}

	return 0;
}
Exemplo n.º 2
0
//设置0上标1下标打印,解除ucflag = 0
UINT8 ucSetPrintUPDOWN(DevHandle hDev, UINT8 ucMode, UINT8 ucFlag)
{
	UINT8  ucInBuf[20];
	UINT32 uiInLen;
	UINT8  ucOutBuf[20];
	UINT32 uiOutLen;
	UINT8 ucRet;
	
	if (ucFlag == 1)
	{
		memcpy(ucInBuf, "\x1B\x53", 2);
		uiInLen = 2;
		ucInBuf[uiInLen] = ucMode;
		uiInLen += 1;

	}
	else
	{
		memcpy(ucInBuf, "\x1B\x54", 2);
		uiInLen = 2;
	}
	
	ucMakePrinterCmd(ucInBuf, uiInLen, ucOutBuf, &uiOutLen);
	ucRet = EA_ucWriteDevice(hDev, uiOutLen, 3, ucOutBuf);
	if (ucRet != EM_SUCCESS)
	{
		display(2, "%s(%d):%02x", __FILE__, __LINE__, ucRet);
		inkey(0);
		
		return 1;
	}
	
	return 0;
}
Exemplo n.º 3
0
//按英寸设定页长
UINT8 ucSetPrintPageLongByInch(DevHandle hDev, UINT8 n)
{
	UINT8  ucInBuf[20];
	UINT32 uiInLen;
	UINT8  ucOutBuf[20];
	UINT32 uiOutLen;
	UINT8 ucRet;
	
	memcpy(ucInBuf, "\x1B\x43\x00", 3);
	uiInLen = 3;
	ucInBuf[uiInLen] = n;
	uiInLen += 1;
	
	ucMakePrinterCmd(ucInBuf, uiInLen, ucOutBuf, &uiOutLen);
	ucRet = EA_ucWriteDevice(hDev, uiOutLen, 3, ucOutBuf);
	if (ucRet != EM_SUCCESS)
	{
		display(2, "%s(%d):%02x", __FILE__, __LINE__, ucRet);
		inkey(0);
		
		return 1;
	}
	
	return 0;
}
Exemplo n.º 4
0
UINT8 ucSetPrintCMode(DevHandle hDev, UINT8 ucMode)
{
	UINT8  ucInBuf[20];
	UINT32 uiInLen;
	UINT8  ucOutBuf[20];
	UINT32 uiOutLen;
	UINT8 ucRet;
	
	if (ucMode == 0)
	{
		memcpy(ucInBuf, "\x1B\x26", 2);
		uiInLen = 2;
	}
	else
	{
		memcpy(ucInBuf, "\x1B\x2E", 2);
		uiInLen = 2;
	}
	
	ucMakePrinterCmd(ucInBuf, uiInLen, ucOutBuf, &uiOutLen);
	ucRet = EA_ucWriteDevice(hDev, uiOutLen, 3, ucOutBuf);
	if (ucRet != EM_SUCCESS)
	{
		display(2, "%s(%d):%02x", __FILE__, __LINE__, ucRet);
		inkey(0);
		
		return 1;
	}
	
	return 0;
}
Exemplo n.º 5
0
//设置页顶、叶底空白量
//页顶:(t1 + t2 *256)*(单位)
//叶底:(b1 + b2 *256)*(单位)
UINT8 ucSetPrintPageFormat(DevHandle hDev, UINT8 t1, UINT8 t2, UINT8 b1, UINT8 b2)
{
	UINT8  ucInBuf[20];
	UINT32 uiInLen;
	UINT8  ucOutBuf[20];
	UINT32 uiOutLen;
	UINT8 ucRet;
	
	memcpy(ucInBuf, "\x1B\x28\x43\x04\x00", 5);
	uiInLen = 5;
	ucInBuf[uiInLen] = t1;
	ucInBuf[uiInLen +1] = t2;
	ucInBuf[uiInLen +2] = b1;
	ucInBuf[uiInLen +3] = b2;
	uiInLen += 4;
	
	ucMakePrinterCmd(ucInBuf, uiInLen, ucOutBuf, &uiOutLen);
	ucRet = EA_ucWriteDevice(hDev, uiOutLen, 3, ucOutBuf);
	if (ucRet != EM_SUCCESS)
	{
		display(2, "%s(%d):%02x", __FILE__, __LINE__, ucRet);
		inkey(0);
		
		return 1;
	}
	
	return 0;
}
Exemplo n.º 6
0
// 有效值ucMode:10 20 30 40 50 60  单位:ucMode/3600 英寸
UINT8 ucDefinePrintUint(DevHandle hDev, UINT8 ucMode)
{
	UINT8  ucInBuf[20];
	UINT32 uiInLen;
	UINT8  ucOutBuf[20];
	UINT32 uiOutLen;
	UINT8 ucRet;
	
	memcpy(ucInBuf, "\x1B\x28\x55\x01\x00", 5);
	uiInLen = 5;
	ucInBuf[uiInLen] = ucMode;
	uiInLen += 1;
	
	ucMakePrinterCmd(ucInBuf, uiInLen, ucOutBuf, &uiOutLen);
	ucRet = EA_ucWriteDevice(hDev, uiOutLen, 3, ucOutBuf);
	if (ucRet != EM_SUCCESS)
	{
		display(2, "%s(%d):%02x", __FILE__, __LINE__, ucRet);
		inkey(0);
		
		return 1;
	}
	
	return 0;
}
Exemplo n.º 7
0
//m =0 :不改变字符宽度 1:选择比例打印	>5:360/m CPI
//字符高度:(n1+n2*256)/2 point		1point = 1/72英寸
UINT8 ucSetPrintEFontSize(DevHandle hDev, UINT8 m, UINT8 n1, UINT8 n2)
{
	UINT8  ucInBuf[20];
	UINT32 uiInLen;
	UINT8  ucOutBuf[20];
	UINT32 uiOutLen;
	UINT8 ucRet;
	
	memcpy(ucInBuf, "\x1B\x58", 2);
	uiInLen = 2;
	ucInBuf[uiInLen] = m;
	uiInLen += 1;
	ucInBuf[uiInLen] = n1;
	ucInBuf[uiInLen +1] = n2;
	uiInLen += 2;
	
	ucMakePrinterCmd(ucInBuf, uiInLen, ucOutBuf, &uiOutLen);
	ucRet = EA_ucWriteDevice(hDev, uiOutLen, 3, ucOutBuf);
	if (ucRet != EM_SUCCESS)
	{
		display(2, "%s(%d):%02x", __FILE__, __LINE__, ucRet);
		inkey(0);
		
		return 1;
	}

	return 0;
}
Exemplo n.º 8
0
//设置行间距
UINT8 ucSetPrintRowSpacing(DevHandle hDev, UINT8 ucMode, UINT8 n)
{
	UINT8  ucInBuf[20];
	UINT32 uiInLen;
	UINT8  ucOutBuf[20];
	UINT32 uiOutLen;
	UINT8 ucRet;
	
	uiInLen = 0;
	memset(ucInBuf, 0, sizeof(ucInBuf));
	switch(ucMode)
	{
	case 0:
		//1/8英寸
		memcpy(ucInBuf, "\x1B\x30", 2);
		uiInLen = 2;
		break;
	case 1:
		//1/6英寸
		memcpy(ucInBuf, "\x1B\x32", 2);
		uiInLen = 2;
		break;
	case 2:
		//1/180英寸
		memcpy(ucInBuf, "\x1B\x33", 2);
		uiInLen = 2;
		ucInBuf[uiInLen] = n;
		uiInLen += 1;
		break;
	case 3:
		//1/60英寸
		memcpy(ucInBuf, "\x1B\x41", 2);
		uiInLen = 2;
		ucInBuf[uiInLen] = n;
		uiInLen += 1;
		break;
	case 4:
		//1/360英寸
		memcpy(ucInBuf, "\x1B\x2B", 2);
		uiInLen = 2;
		ucInBuf[uiInLen] = n;
		uiInLen += 1;
		break;
	default:
		break;
	}
	
	ucMakePrinterCmd(ucInBuf, uiInLen, ucOutBuf, &uiOutLen);
	ucRet = EA_ucWriteDevice(hDev, uiOutLen, 3, ucOutBuf);
	if (ucRet != EM_SUCCESS)
	{
		display(2, "%s(%d):%02x", __FILE__, __LINE__, ucRet);
		inkey(0);
		
		return 1;
	}
	return 0;
}
Exemplo n.º 9
0
Arquivo: main.c Projeto: 12019/zibogas
void Debugprintf(const char *fmt, ...)
{

//  int n;
//  char *arg;
//  va_list arg = (va_list)((char*)(&fmt) + 4);
//  n = vsprintf(sprint_buf, fmt, arg);
	EA_ucWriteDevice(hRS232Handle, strlen(fmt), 0, (char *)fmt);
}
Exemplo n.º 10
0
UINT8 ucPrintPassBook(DevHandle hDev, UINT8 ucRow, UINT8 *ucBuf)
{
	UINT8  ucInBuf[256];
	UINT32 uiInLen;
	UINT8  ucOutBuf[256];
	UINT32 uiOutLen;
	UINT8 ucRet;
	UINT16 usPosition = 0x90;

	memset(ucInBuf, 0, sizeof(ucInBuf));
	uiInLen = 0;
	
	if (ucRow > 20 || ucRow <= 0)
	{
		return 1;
	}

	if (ucRow >= 11)
	{
		ucRow += 1;
	}
	
	for (ucRet = 0;ucRet < (ucRow -1); ++ucRet)
	{
		usPosition += 0x55;
	}
// 	display(2, "position:%02x-%02x", usPosition %256, usPosition/256);
// 	inkey(0);
	ucSetPrintLocation(hDev, 0, 0, usPosition %256, usPosition /256);


	memcpy(ucInBuf + uiInLen, ucBuf, strlen(ucBuf));
	uiInLen += strlen(ucBuf);
	memcpy(ucInBuf + uiInLen, "\x0D\x0A", 2);
	uiInLen += 2;
	
	ucMakePrinterCmd(ucInBuf, uiInLen, ucOutBuf, &uiOutLen);
	ucRet = EA_ucWriteDevice(hDev, uiOutLen, 3, ucOutBuf);
	if (ucRet != EM_SUCCESS)
	{
		display(2, "%s(%d):%02x", __FILE__, __LINE__, ucRet);
		inkey(0);
		
		return 1;
	}
	
	return 0;
}
Exemplo n.º 11
0
int SetS100LoadKeyMode(void)
{
	uchar aucOut[20], ucRet;
	DevHandle hDevHandle;
	uint uiOutLen;
	int  nReturn;
	
	nReturn = 0;
	ucRet = EA_ucOpenDevice("COM", EM_io_PORT2, &hDevHandle);
    if ( ucRet != EM_SUCCESS)
    {
		EA_vCls();
        PubDisplay(2,"打开端口错误 %d", ucRet);
        PubuiInkey(30);
		return -1;
    }
	EA_ucInitRS232(hDevHandle, EM_232_115200BPS, EM_232_NOPAR, EM_232_8DBS);
	EA_ucClearRS232(hDevHandle);//清除缓冲区
	
    memcpy(aucOut,"\x02\x06\x9a\x01\x00\x00\x03\x02",8);
    ucRet = EA_ucWriteDevice(hDevHandle, 8, 1, (char*)aucOut);
	
    memset(aucOut, 0x00, 8);
    memcpy(aucOut+8,"\x06\x02\x04\x00\x01\x03\x02",7);    
	uiOutLen = 0;
    ucRet = EA_ucReadDevice(hDevHandle, 7, 3, aucOut, &uiOutLen);
    if ( ucRet != EM_SUCCESS|| uiOutLen != 7)
    {
		EA_vCls();
        PubDisplay(2,"从端口读数据错 %d %d", ucRet, uiOutLen);
        PubuiInkey(30);
		nReturn = -2;
    }
    else
    {
        if(memcmp(aucOut+8, aucOut, 7))
        {
			EA_vCls();
			PubDisplay(2,"数据校验错误");
			PubuiInkey(30);
			nReturn = -3;
        }
    }
	EA_ucCloseDevice(&hDevHandle);
	return nReturn;
}
Exemplo n.º 12
0
UINT8 ucSetPrintLocation(DevHandle hDev,  UINT8 n1, UINT8 n2, UINT8 m1, UINT8 m2)
{
	UINT8  ucInBuf[20];
	UINT32 uiInLen;
	UINT8  ucOutBuf[20];
	UINT32 uiOutLen;
	UINT8 ucRet;
	
// 	memcpy(ucInBuf, "\x1B\x24", 2);
// 	uiInLen = 2;
// 	ucInBuf[uiInLen] = n1;
// 	uiInLen += 1;
// 	ucInBuf[uiInLen] = n2;
// 	uiInLen += 2;
// 
// 	ucMakePrinterCmd(ucInBuf, uiInLen, ucOutBuf, &uiOutLen);
// 	ucRet = EA_ucWriteDevice(hDev, uiOutLen, 3, ucOutBuf);
// 	if (ucRet != EM_SUCCESS)
// 	{
// 		display(2, "%s(%d):%02x", __FILE__, __LINE__, ucRet);
// 		inkey(0);
// 		
// 		return 1;
// 	}
	
	memcpy(ucInBuf, "\x1B\x28\x56\x02\x00", 5);
	uiInLen = 5;

	ucInBuf[uiInLen] = m1;
	uiInLen += 1;
	ucInBuf[uiInLen] = m2;
	uiInLen += 1;
	
	ucMakePrinterCmd(ucInBuf, uiInLen, ucOutBuf, &uiOutLen);
	ucRet = EA_ucWriteDevice(hDev, uiOutLen, 3, ucOutBuf);
	if (ucRet != EM_SUCCESS)
	{
		display(2, "%s(%d):%02x", __FILE__, __LINE__, ucRet);
		inkey(0);
		
		return 1;
	}	
	
	return 0;
}
Exemplo n.º 13
0
UINT8 ucSetPrintCVPoint(DevHandle hDev, UINT8 ucChannel, UINT8* aucPoint, UINT8 ucNum)
{
	UINT8  ucInBuf[20];
	UINT32 uiInLen;
	UINT8  ucOutBuf[20];
	UINT32 uiOutLen;
	UINT8 ucRet;
	
	memcpy(ucInBuf, "\x1B\x62", 2);
	uiInLen = 2;
	if (ucChannel >7)
	{
		return 1;
	}
	ucInBuf[uiInLen] = ucChannel;
	uiInLen += 1;
	if (ucNum > 16)
	{
		return 1;
	}
	if (ucNum == 0)
	{
		ucInBuf[uiInLen] = 0x00;
		uiInLen += 1;
	}
	else
	{
		memcpy(ucInBuf + uiInLen, aucPoint, ucNum);
		uiInLen += ucNum;
		ucInBuf[uiInLen] = 0x00;
		uiInLen += 1;
	}
	
	ucMakePrinterCmd(ucInBuf, uiInLen, ucOutBuf, &uiOutLen);
	ucRet = EA_ucWriteDevice(hDev, uiOutLen, 3, ucOutBuf);
	if (ucRet != EM_SUCCESS)
	{
		display(2, "%s(%d):%02x", __FILE__, __LINE__, ucRet);
		inkey(0);
		
		return 1;
	}

	return 0;
}
Exemplo n.º 14
0
uchar TA_Usb_ucWriteUsb(uint uiDataLen, uchar* pucDataIn)
{
	uchar ucRet = EM_SUCCESS;

	if (0 == uiDataLen)
	{
		return EM_SUCCESS;
	}

	TA_vPrintHex("WriteUsb>>>>", pucDataIn, uiDataLen);
	ucRet = EA_ucWriteDevice(g_hUsbComHandle, uiDataLen, WRITE_TIMEOUT_S_MIN, (void*)pucDataIn);
	if (EM_SUCCESS != ucRet)
	{
		PRINT_RET("TA_Usb_ucWriteUsb", ucRet);
		return ucRet;
	}

	return EM_SUCCESS;
}
Exemplo n.º 15
0
int send_to_EFT(int len, char *p)
{
	uchar ucRet;
    DevHandle hRS232Handle;
    ET_ProductInfo tProductInfo;
	
#ifdef EPT_A9L
    memset(&tProductInfo, 0x00, sizeof(ET_ProductInfo));
	EA_ucGetProductInfo(&tProductInfo);
	if ( memcmp(tProductInfo.acName , "E520" , 4) == 0 && tProductInfo.ucMachType == 2)
	{
		ucRet = EA_ucOpenDevice("COM3", 0, &hRS232Handle);
	}
	else
	{
		ucRet = EA_ucOpenDevice(SERIAL_PORT, 0, &hRS232Handle);
	}

#else
	ucRet = EA_ucOpenDevice("COM", EM_io_PORT1, &hRS232Handle);
#endif
	
    if (ucRet != EM_SUCCESS)
    {
        EA_vCls();
        EA_vDisplay(2, "打开RS232口出错");
		EA_ucCloseDevice(&hRS232Handle);
        PubuiInkey(3);
        return (EXCEPTION);
    }
    EA_ucInitRS232(hRS232Handle, EM_232_9600BPS, EM_232_NOPAR, EM_232_8DBS);
    EA_ucClearRS232(hRS232Handle);//清除RS232缓冲区

	ucRet = EA_ucWriteDevice(hRS232Handle, (uint)len, 0, p);
    EA_ucCloseDevice(&hRS232Handle);
//    debug_print((char*)"SendToPC", p, len);
    if (ucRet  == EM_io_SUCCESS)
        return NORMAL;
    else
        return EXCEPTION;
	return (NORMAL) ;
}
Exemplo n.º 16
0
//设定字符间距10 12 15 CPI
UINT8 ucSetPrintXSpace(DevHandle hDev, UINT8 ucMode)
{
	UINT8  ucInBuf[20];
	UINT32 uiInLen;
	UINT8  ucOutBuf[20];
	UINT32 uiOutLen;
	UINT8 ucRet;
	
	memcpy(ucInBuf, "\x1B", 1);
	uiInLen = 1;

	switch(ucMode)
	{
	case 0:
		ucInBuf[uiInLen] = 0x50;
		uiInLen += 1;
		break;
	case 1:
		ucInBuf[uiInLen] = 0x4D;
		uiInLen += 1;
		break;
	case 2:
		ucInBuf[uiInLen] = 0x67;
		uiInLen += 1;
		break;
	default:
		return 1;
		break;
	}
	
	ucMakePrinterCmd(ucInBuf, uiInLen, ucOutBuf, &uiOutLen);
	ucRet = EA_ucWriteDevice(hDev, uiOutLen, 3, ucOutBuf);
	if (ucRet != EM_SUCCESS)
	{
		display(2, "%s(%d):%02x", __FILE__, __LINE__, ucRet);
		inkey(0);
		
		return 1;
	}
	
	return 0;
}
Exemplo n.º 17
0
UINT8 ucSetPrintFontCSize(DevHandle hDev, UINT8 ucMode)
{
	UINT8  ucInBuf[20];
	UINT32 uiInLen;
	UINT8  ucOutBuf[20];
	UINT32 uiOutLen;
	UINT8 ucRet;
	UINT8 ucN[10][3] = 
	{
		"\x20\x00", 
		"\x28\x00", 
		"\x30\x00",
		"\x38\x00",
		"\x40\x00",
		"\x48\x00",
		"\x50\x00",
		"\x60\x00",
		"\x70\x00",
		"\x80\x00"
	};
	
	memcpy(ucInBuf, "\x1C\x59\x1B", 3);
	uiInLen = 3;
	
	memcpy(ucInBuf + uiInLen, ucN[ucMode], 2);
	uiInLen += 2;
	
	ucMakePrinterCmd(ucInBuf, uiInLen, ucOutBuf, &uiOutLen);
	ucRet = EA_ucWriteDevice(hDev, uiOutLen, 3, ucOutBuf);
	if (ucRet != EM_SUCCESS)
	{
		display(2, "%s(%d):%02x", __FILE__, __LINE__, ucRet);
		inkey(0);
		
		return 1;
	}
	
	return 0;
}