📄 test.c
字号:
Return : None
==============================================================*/
void GetResultNECG30CHG(void)
{
if (!strstr(Sw->RcvBuff, "chg subd") || !strstr(Sw->RcvBuff, Sw->Tel))
Sw->ReturnCode = 9999;
else
NECG30MapErr();
}
/*==============================================================
Function: GetResultNECG30MOD
Note :
Para : None
Return : None
==============================================================*/
void GetResultNECG30MOD(void)
{
if (!strstr(Sw->RcvBuff, "mod subd") || !strstr(Sw->RcvBuff, Sw->Tel))
Sw->ReturnCode = 9999;
else
NECG30MapErr();
}
/*==============================================================
Function: GetResultNECG30REGMTR
Note :
Para : None
Return : None
==============================================================*/
void GetResultNECG30REGMTR(void)
{
if (!strstr(Sw->RcvBuff, "reg mtr") || !strstr(Sw->RcvBuff, Sw->Tel))
Sw->ReturnCode = 9999;
else
NECG30MapErr();
}
/*==============================================================
Function: GetResultNECG30CANMTR
Note :
Para : None
Return : None
==============================================================*/
void GetResultNECG30CANMTR(void)
{
if (!strstr(Sw->RcvBuff, "can mtr") || !strstr(Sw->RcvBuff, Sw->Tel))
Sw->ReturnCode = 9999;
else
NECG30MapErr();
}
/*==============================================================
Function: GetNumOfLineNECG30
Note : 取实装统计结果
Para : None
Return : 1 - if success
0 - if fail
==============================================================*/
int GetNumOfLineNECG30(void)
{
char buf[32];
if (!GetPara(Sw->RcvBuff, "//total=", buf, 16)) {
Sw->ReturnCode = 9999;
return 0;
}
Sw->InstLine += atoi(buf);
return 1;
}
/*==============================================================
Function: GetF150V8SrcErr
Note : Get F150 V8 source error code
Para : None
Return : 0 - if command end
SrcErr - if command rejection
==============================================================*/
int GetF150V8SrcErr(void)
{
// This function same as GetF150V9SrcErr
return GetF150V9SrcErr();
}
/*==============================================================
Function: GetResultF150V8Login
Note :
Para : None
Return : 1 - command end, Sw->ReturnCode = 0
0 - command rejection, & set Sw->ReturnCode
==============================================================*/
int GetResultF150V8Login(void)
{
int SrcErr;
SrcErr = GetF150V8SrcErr();
if (SrcErr == 0) {
Sw->ReturnCode = 0;
return 1;
}
Sw->ReturnCode = F150V8MapErrCommon(SrcErr);
return 0;
}
/*==============================================================
Function: GetResultF150V8CHASUB
Note :
Para : None
Return : 1 - command end, Sw->ReturnCode = 0
0 - command rejection, & set Sw->ReturnCode
==============================================================*/
int GetResultF150V8CHASUB(void)
{
int SrcErr;
SrcErr = GetF150V8SrcErr();
if (SrcErr == 0) return 1;
if (SrcErr>=100)
Sw->ReturnCode = F150V8MapErrCHASUB(SrcErr);
else
Sw->ReturnCode = F150V8MapErrCommon(SrcErr);
return 0;
}
/*==============================================================
Function: GetResultF150V8DISSUB
Note :
Para : None
Return : 1 - command end, Sw->ReturnCode = 0
0 - command rejection, & set Sw->ReturnCode
==============================================================*/
int GetResultF150V8DISSUB(void)
{
int SrcErr;
char tmp[80];
SrcErr = GetF150V8SrcErr();
if (SrcErr != 0) {
Sw->ReturnCode = F150V8MapErrCommon(SrcErr);
return 0;
}
GetPara(Sw->RcvBuff, "LL=", tmp, 16);
strcat(Sw->Para, " LL=");
strcat(Sw->Para, tmp);
return 1;
}
/*==============================================================
Function: GetResultF150V8STCH
Note :
Para : None
Return : 1 - command end, Sw->ReturnCode = 0
0 - command rejection, & set Sw->ReturnCode
==============================================================*/
int GetResultF150V8STCH(void)
{
int SrcErr, i;
struct {
int SrcErr; // source error number from switch
int DestErr;
} Map[] = {
{121,2}, // Tel err
{123,8}, // LL err
{122,20}, // data changed not allowed
{125,12}, // double register
{-1,-1}
};
SrcErr = GetF150V8SrcErr();
if (SrcErr == 0) {
Sw->ReturnCode = 0;
return 1;
}
if (SrcErr<100) {
Sw->ReturnCode = F150V8MapErrCommon(SrcErr);
return 0;
}
if (SrcErr>=100 && SrcErr<120) {
Sw->ReturnCode = F150V8MapErrCHASUB(SrcErr);
return 0;
}
Sw->ReturnCode = 9999;
for (i=0; Map[i].SrcErr != -1; i++)
if (SrcErr == Map[i].SrcErr) {
Sw->ReturnCode = Map[i].DestErr;
break;
}
return 0;
}
/*==============================================================
Function: GetResultF150V8SVRG
Note :
Para : None
Return : 1 - command end, Sw->ReturnCode = 0
0 - command rejection, & set Sw->ReturnCode
==============================================================*/
int GetResultF150V8SVRG(void)
{
int SrcErr, i;
struct {
int SrcErr; // source error number from switch
int DestErr;
} Map[] = {
{121,2}, // Tel err
{-1,-1}
};
SrcErr = GetF150V8SrcErr();
if (SrcErr == 0) {
Sw->ReturnCode = 0;
return 1;
}
if (SrcErr<100) {
Sw->ReturnCode = F150V8MapErrCommon(SrcErr);
return 0;
}
if (SrcErr>=100 && SrcErr<120) {
Sw->ReturnCode = F150V8MapErrCHASUB(SrcErr);
return 0;
}
Sw->ReturnCode = 9999;
for (i=0; Map[i].SrcErr != -1; i++)
if (SrcErr == Map[i].SrcErr) {
Sw->ReturnCode = Map[i].DestErr;
break;
}
return 0;
}
/*==============================================================
Function: GetResultF150V8CLCH
Note :
Para : None
Return : 1 - command end, Sw->ReturnCode = 0
0 - command rejection, & set Sw->ReturnCode
==============================================================*/
int GetResultF150V8CLCH(void)
{
int SrcErr, i;
struct {
int SrcErr; // source error number from switch
int DestErr;
} Map[] = {
{121,2}, //Tel err
{127,0}, //Double register
{-1,-1}
};
SrcErr = GetF150V8SrcErr();
if (SrcErr == 0) {
Sw->ReturnCode = 0;
return 1;
}
if (SrcErr<100) {
Sw->ReturnCode = F150V8MapErrCommon(SrcErr);
return 0;
}
if (SrcErr>=100 && SrcErr<120) {
Sw->ReturnCode = F150V8MapErrCHASUB(SrcErr);
return 0;
}
Sw->ReturnCode = 9999;
for (i=0; Map[i].SrcErr != -1; i++)
if (SrcErr == Map[i].SrcErr) {
Sw->ReturnCode = Map[i].DestErr;
break;
}
return 0;
}
/*==============================================================
Function: GetResultF150V8CANMCT
Note :
Para : None
Return : 1 - command end, Sw->ReturnCode = 0
0 - command rejection, & set Sw->ReturnCode
==============================================================*/
int GetResultF150V8CANMCT(void)
{
int SrcErr, i;
struct {
int SrcErr; // source error number from switch
int DestErr;
} Map[] = {
{-1,-1}
};
SrcErr = GetF150V8SrcErr();
if (SrcErr == 0) {
Sw->ReturnCode = 0;
return 1;
}
if (SrcErr<100) {
Sw->ReturnCode = F150V8MapErrCommon(SrcErr);
return 0;
}
Sw->ReturnCode = 9999;
for (i=0; Map[i].SrcErr != -1; i++)
if (SrcErr == Map[i].SrcErr) {
Sw->ReturnCode = Map[i].DestErr;
break;
}
return 0;
}
/*==============================================================
Function: GetResultF150V8REGMCT
Note :
Para : None
Return : 1 - command end, Sw->ReturnCode = 0
0 - command rejection, & set Sw->ReturnCode
==============================================================*/
int GetResultF150V8REGMCT(void)
{
int SrcErr, i;
struct {
int SrcErr; // source error number from switch
int DestErr;
} Map[] = {
{-1,-1}
};
SrcErr = GetF150V8SrcErr();
if (SrcErr == 0) {
Sw->ReturnCode = 0;
return 1;
}
if (SrcErr<100) {
Sw->ReturnCode = F150V8MapErrCommon(SrcErr);
return 0;
}
Sw->ReturnCode = 9999;
for (i=0; Map[i].SrcErr != -1; i++)
if (SrcErr == Map[i].SrcErr) {
Sw->ReturnCode = Map[i].DestErr;
break;
}
return 0;
}
/*==========================================================
Function: F150V8MapErrCommon
Note : Map F150V8 err
Para : int SrcErr - source error number from switch
Return : Dest error code
===========================================================*/
int F150V8MapErrCommon(int SrcErr)
{
// This function same as F150V9MapErrCommon
return F150V9MapErrCommon(SrcErr);
}
/*==========================================================
Function: F150V8MapErrCHASUB
Note : Map F150V8 err, 100-119
Para : int SrcErr - source error number from switch
Return : Dest error code
===========================================================*/
int F150V8MapErrCHASUB(int SrcErr)
{
int DestErr = 9999, i;
struct {
int SrcErr; // source error number from switch
int DestErr;
} Map[] = {
{100,20}, // data changed not allowed
{101,23}, // malicious reg
{102,8}, // LL err
{104,0}, // Duplicate parameter designated
{110,10}, // line busy
{-1,-1}
};
for (i=0; Map[i].SrcErr != -1; i++)
if (SrcErr == Map[i].SrcErr) {
DestErr = Map[i].DestErr;
break;
}
return DestErr;
}
/*==============================================================
Function: GetF150V9SrcErr
Note : Get F150 V9 source error code
Para : None
Return : 0 - if command end
SrcErr - if command rejection
==============================================================*/
int GetF150V9SrcErr(void)
{
char *p, RtnStr[4];
int SrcErr;
if (strstr(Sw->RcvBuff, "COMMAND END") && strstr(Sw->RcvBuff, Sw->Tel))
return 0;
// CHA SBS:TYP; && CHA TIP;
//if (strstr(Sw->RcvBuff, "TYPE IN PARAMETER")) return 0;
p = strstr(Sw->RcvBuff, "REJECTION (");
if (p == NULL) return 9999;
p += strlen("REJECTION (");
strncpy(RtnStr, p, 3);
RtnStr[3] = '\0';
sscanf(RtnStr, "%d", &SrcErr);
return SrcErr;
}
/*==============================================================
Function: GetResultF150V9Login
Note :
Para : None
Return : 1 - command end, Sw->ReturnCode = 0
0 - command rejection, & set Sw->ReturnCode
==============================================================*/
int GetResultF150V9Login(void)
{
int SrcErr;
SrcErr = GetF150V9SrcErr();
if (SrcErr == 0) {
Sw->ReturnCode = 0;
return 1;
}
Sw->ReturnCode = F150V9MapErrCommon(SrcErr);
return 0;
}
/*==============================================================
Function: GetResultF150V9CHASBS
Note :
Para : None
Return : 1 - command end, Sw->ReturnCode = 0
0 - command rejection, & set Sw->ReturnCode
==============================================================*/
int GetResultF150V9CHASBS(void)
{
int SrcErr;
SrcErr = GetF150V9SrcErr();
if (SrcErr == 0) return 1;
if (SrcErr>=100 && SrcErr<200)
Sw->ReturnCode = F150V9MapErrCHASBS(SrcErr);
else
Sw->ReturnCode = F150V9MapErrCommon(SrcErr);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -