📄 public.c
字号:
memset(strErrorMessage2,0,sizeof(strErrorMessage2));
switch(ErrorNo)
{
case ERR_MIF_AUTEN://M1密码认证错误
strcpy(strErrorMessage1, "M1密码认证错误");
break;
case ERR_MIF_READ://M1读卡错误
strcpy(strErrorMessage1, "M1读卡错误");
break;
case ERR_MIF_WRITE://M1写卡错误
strcpy(strErrorMessage1, "M1写卡错误");
break;
case ERR_MIF_INBLACK://M1卡号在黑名单上
strcpy(strErrorMessage1, "M1卡号在黑名单");
strcpy(strErrorMessage2, "上");
break;
case ERR_COM_TIMEOUT://超时错误
strcpy(strErrorMessage1, "超时错误");
break;
case ERR_COM_SEND://发送命令错误
strcpy(strErrorMessage1, "发送命令错误");
break;
case ERR_CHG_CANNOTCHARGEN://无法冲正
strcpy(strErrorMessage1, "无法冲正");
break;
case ERR_CHG_FULLEEPROM://存储区满
strcpy(strErrorMessage1, "存储区满");
break;
case ERR_CHG_READEEPROM://读存储区错误
strcpy(strErrorMessage1, "读存储区错误");
break;
case ERR_CHG_WRITEEEPROM://写存储区错误
strcpy(strErrorMessage1, "写存储区错误");
break;
case ERR_PSAM_PINAUTH://SAM卡PIN认证错误
strcpy(strErrorMessage1, "SAM卡PIN认");
strcpy(strErrorMessage2, "证错误");
break;
case ERR_PSAM_AUTHEN://SAM卡认证出错
strcpy(strErrorMessage1, "SAM卡认证出错");
break;
case ERR_PSAM_FUNC://SAM卡功能不支持
strcpy(strErrorMessage1, "SAM卡功能不支");
strcpy(strErrorMessage2, "持");
break;
case ERR_PSAM_SPKEY://SAM卡密钥索引不支持
strcpy(strErrorMessage1, "SAM卡密钥索引");
strcpy(strErrorMessage2, "不支持");
break;
case ERR_POS_GETCARDINFO://读卡信息错
strcpy(strErrorMessage1, "读卡信息错");
break;
case ERR_POS_NOTSAMECARD://非同一张卡
strcpy(strErrorMessage1, "非同一张卡");
break;
case ERR_POS_NOTCHKSERBL://未检查服务器黑名单
strcpy(strErrorMessage1, "未检查服务器黑名");
strcpy(strErrorMessage2, "单");
break;
case ERR_POS_INSERVERBL://存在于服务器黑名单内
strcpy(strErrorMessage1, "存在于服务器黑名");
strcpy(strErrorMessage2, "单内");
break;
case ERR_POS_NOTCUMSCARD://非同一张卡
strcpy(strErrorMessage1, "非同一张卡");
break;
case ERR_POS_BLCARD://黑名单卡
strcpy(strErrorMessage1, "黑名单卡");
break;
case ERR_POS_CARDNOTSTART://卡未启用
strcpy(strErrorMessage1, "卡未启用");
break;
case ERR_POS_OUTOFLIMIT://卡过期
strcpy(strErrorMessage1, "卡过期");
break;
case ERR_POS_FULLTIMESBLOCK://月票充次时无空块储存
strcpy(strErrorMessage1, "月票充次时无空块");
strcpy(strErrorMessage2, "储存");
break;
case ERR_POS_RECHARGETIMES://月票充次时该月已经充了月票
strcpy(strErrorMessage1, "月票充次时该月已");
strcpy(strErrorMessage2, "经充了月票");
break;
case ERR_POS_DISCHARGETIMES://月票冲正时该月未充月票
strcpy(strErrorMessage1, "月票冲正时该月未");
strcpy(strErrorMessage2, "充月票");
break;
case ERR_POS_WRITECHRSTEP://写交易进程标记出错
strcpy(strErrorMessage1, "写交易进程标记出");
strcpy(strErrorMessage2, "错");
break;
case ERR_POS_WRITECHRPOINT://写交易指针出错
strcpy(strErrorMessage1, "写交易指针出错");
break;
case ERR_POS_COPYTO2BLOCK://复制正本到副本出错
strcpy(strErrorMessage1, "复制正本到副本出");
strcpy(strErrorMessage2, "错");
break;
case ERR_POS_MODIFYMONEY://充值或冲正时改变钱包出错
strcpy(strErrorMessage1, "充值或冲正时改变");
strcpy(strErrorMessage2, "钱包出错");
break;
case ERR_POS_BUILDRECORD://写记录出错
strcpy(strErrorMessage1, "写记录出错");
break;
case ERR_POS_TIMESPARM://充次时的参数出错
strcpy(strErrorMessage1, "充次时所选月份小");
strcpy(strErrorMessage2, "于当前月");
break;
case ERR_POS_NOCARD://无卡
strcpy(strErrorMessage1, "无卡");
break;
case ERR_POS_NOTWHITECARD://非白卡
strcpy(strErrorMessage1, "非白卡");
break;
case ERR_POS_CARDALRSTART://卡已经启用
strcpy(strErrorMessage1, "卡已经启用");
break;
case ERR_POS_MODIFYSTARTFLAG://修改卡启用标记错误
strcpy(strErrorMessage1, "修改卡启用标记错");
strcpy(strErrorMessage2, "误");
break;
case ERR_POS_ALREADYBLCARD://该卡已经是黑名单卡
strcpy(strErrorMessage1, "该卡已经是黑名单");
strcpy(strErrorMessage2, "卡");
break;
case ERR_POS_NOTBLCARD://不是黑名单卡
strcpy(strErrorMessage1, "不是黑名单卡");
break;
case ERR_POS_UNKOWNCMD://无效命令
strcpy(strErrorMessage1, "无效命令");
break;
case ERR_POS_BLISFULL://黑名单数溢出
strcpy(strErrorMessage1, "黑名单数溢出");
break;
case ERR_POS_HAVENTTIMESBLK://无月票区
strcpy(strErrorMessage1, "无月票区");
break;
case ERR_POS_ERRORPARM://错误参数
strcpy(strErrorMessage1, "错误参数");
break;
case ERR_POS_ERRORCHKCARD://验卡错误
strcpy(strErrorMessage1, "验卡错误");
break;
case ERR_POS_ALREADYAUTH://设备已经认证
strcpy(strErrorMessage1, "设备已经认证");
break;
case ERR_POS_NOAUTHREQUEST://没有收到认证请求
strcpy(strErrorMessage1, "没有收到认证请求");
break;
case ERR_POS_NOTSAMERANDOM://数据与随机数不匹配
strcpy(strErrorMessage1, "数据与随机数不匹");
strcpy(strErrorMessage2, "配");
break;
case ERR_POS_GETRANDOM://取随机数错误
strcpy(strErrorMessage1, "取随机数错误");
break;
case ERR_POS_DEVICENOTAUTH://设备未认证
strcpy(strErrorMessage1, "设备未认证");
break;
case ERR_POS_LIMITDATE://错误的有效期数据
strcpy(strErrorMessage1, "错误的有效期数据");
break;
case ERR_POS_SAMELIMITDATE://相同的有效期数据
strcpy(strErrorMessage1, "相同的有效期数据");
break;
case ERR_POS_MUCHMOREMONEY://充值数值太大
strcpy(strErrorMessage1, "充值数值太大");
break;
case ERR_POS_NOTENOUGHMONEY: //余额不足
strcpy(strErrorMessage1, "余额不足");
break;
case ERR_POS_ERRORCARD: //交易进程标志为1
strcpy(strErrorMessage1, "卡片状态不正确,");
strcpy(strErrorMessage2, "请到充值机上恢复");
break;
default:
sprintf(strErrorMessage1, "未知错误:%d", ErrorNo);
break;
}
clr_scr();
set_inversed_disp();
move_cursor(0,0);
puts("错误:");
set_normal_disp();
move_cursor(0,2);
puts(strErrorMessage1);
move_cursor(0,4);
puts(strErrorMessage2);
move_cursor(0,6);
puts("按取消键返回");
return getch();
}
unsigned char get_str(unsigned char x,unsigned char y,unsigned char *str,unsigned char length,unsigned char type)
{
unsigned char cPressKey, ch[2], cursor[2], i=0, state=0, ch_temp[2]=" ",ch_sec[2]="*",sitex,sitey;
sitey=y;
sitex=x;
for(;;)
{
cursor[0] = '_';
cursor[1] = 0;
ch[0] = 0;
ch[1] = 0;
move_cursor(sitex, sitey);
puts(cursor);
EL_setting(EL_ON);
cPressKey = getch();
move_cursor(sitex, sitey);
puts(ch_temp);
if(cPressKey==KEY_CLR)
{
if(i)
{
i--;
sitex--;
if (sitex>=16)
sitey-=2;
if(str[i]==KEY_F3) state = 0;
str[i]=' ';
}
else
{
str[0]=0;
return KEY_CLR;
}
move_cursor(sitex, sitey);
puts(ch_temp);
}
else if(((cPressKey>=KEY_0) && (cPressKey<=KEY_9))||(cPressKey==KEY_F3))
{
if(type==2)
{
move_cursor(sitex, sitey);
puts(ch_sec);
}
else
{
if(cPressKey!=KEY_F3)
ch[0] = cPressKey+'0';
else
ch[0] = '.';
move_cursor(sitex, sitey);
puts(ch);
}
if(type&0x01==0)
{
str[i]=cPressKey;
}
else
{
if(state)
{
state++;
if(state>type+1)
{
str[i]=cPressKey+'0';
str[i+1]=0;
return KEY_ENTER;
}
str[i]=cPressKey+'0';
}
else
{
if(cPressKey==KEY_F3)
{
str[i]='.';
state=1;
}
else
{
str[i]=cPressKey+'0';
}
}
}
i++;
sitex++;
if (sitex>=16)
{
sitey+=2;
sitex=sitex%16;
}
}
else if(cPressKey==KEY_CLR)
{
str[i]=0;
return KEY_CLR;
}
else
{
str[i]=0;
return cPressKey;
}
if(i>=length)
{
str[i]=0;
return KEY_ENTER;
}
}
}
void SendSMSCmd(unsigned char cCmd, unsigned short sLen, unsigned char *cBuffer)
{
unsigned char cSendBuffer[200];
unsigned short sSendLen, sChkSum;
memset(cSendBuffer, 0, sizeof(cSendBuffer));
memcpy(cSendBuffer, "EKT", 3);
cSendBuffer[3] = 0x20;
sSendLen = sLen + 5;
memcpy(cSendBuffer + 4, &sSendLen, 2);
cSendBuffer[6] = cCmd;
memcpy(cSendBuffer + 7, &sSendHandle, 2);
memcpy(cSendBuffer + 9, cBuffer, sLen);
sChkSum = cal_chksum(cSendBuffer + 3, sLen + 3);
memcpy(cSendBuffer + sLen + 9, &sChkSum, 2);
sSendHandle ++;
SendSMS(cSendBuffer, sSendLen + 4);
}
unsigned char ReadSMSCmd(unsigned char *cCmd, unsigned short *sHandle, unsigned short *sLen, unsigned char *cBuffer)
{
unsigned char cReadBuffer[200];
unsigned short sReadLen, sChkSum;
memset(cReadBuffer, 0, sizeof(cReadBuffer));
ReadSMS(cReadBuffer);
if(memcmp(cReadBuffer, "EKT", 3)==0)
{
if(cReadBuffer[3] == 0x20)
{
memcpy(&sReadLen, cReadBuffer + 4, 2);
*sLen = sReadLen - 5;
*cCmd = cReadBuffer[6];
memcpy(sHandle, cReadBuffer + 7, 2);
memcpy(cBuffer, cReadBuffer + 9, *sLen);
memcpy(&sChkSum, cReadBuffer + *sLen + 9, 2);
if(sChkSum == cal_chksum(cReadBuffer+3, sLen + 3))
return 1;
}
}
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -