📄 test.c
字号:
return 0;
}
/*==============================================================
Function: GetResultF150V9DISSBS
Note :
Para : None
Return : 1 - command end, Sw->ReturnCode = 0
0 - command rejection, & set Sw->ReturnCode
==============================================================*/
int GetResultF150V9DISSBS(void)
{
int SrcErr;
char tmp[80];
SrcErr = GetF150V9SrcErr();
if (SrcErr != 0) {
Sw->ReturnCode = F150V9MapErrCommon(SrcErr);
return 0;
}
if (!GetPara(Sw->RcvBuff, "LL=", tmp, 16)) {
if (!GetPara(Sw->RcvBuff, "UL=", tmp, 16)) {
Sw->ReturnCode = 9999;
return 0;
}
}
strcat(Sw->Para, " LL=");
strcat(Sw->Para, tmp);
return 1;
}
/*==============================================================
Function: GetResultF150V9LISSBS
Note : 实装统计结果
Para : None
Return : 1 - command end, Sw->ReturnCode = 0
0 - command rejection, & set Sw->ReturnCode
==============================================================*/
int GetResultF150V9LISSBS(void)
{
int SrcErr;
char tmp[80];
SrcErr = GetF150V9SrcErr();
if (SrcErr != 0) {
Sw->ReturnCode = F150V9MapErrCommon(SrcErr);
return 0;
}
if (!GetPara(Sw->RcvBuff, "TOTAL=", tmp, 16)) {
Sw->ReturnCode = 9999;
return 0;
}
Sw->InstLine += atoi(tmp);
return 1;
}
/*==============================================================
Function: GetResultF150V9DISTIP
Note : 查呼出限制密码,
Para : None
Return : 1 - command end, Sw->ReturnCode = 0,
& if pass not null, strcat 'PASS=xxxx' in Para
0 - command rejection, & set Sw->ReturnCode
==============================================================*/
int GetResultF150V9DISTIP(void)
{
int SrcErr;
char tmp[80];
SrcErr = GetF150V9SrcErr();
if (SrcErr != 0) {
Sw->ReturnCode = F150V9MapErrCommon(SrcErr);
return 0;
}
/* "2312008 PASS 1234" */
/* "2360133 STD/IDD 6973 0 6973 0" */
GetPara(Sw->RcvBuff, "PASS ", tmp, 10);
if (strlen(tmp) > 0) {
strcat(Sw->Para, " PASS=");
strcat(Sw->Para, tmp);
Sw->ReturnCode = 0;
return 1;
}
GetPara(Sw->RcvBuff, "STD/IDD ", tmp, 10);
if (strlen(tmp) > 0) {
strcat(Sw->Para, " PASS=");
strcat(Sw->Para, tmp);
Sw->ReturnCode = 0;
return 1;
}
Sw->ReturnCode = 22;
return 0;
}
/*==============================================================
Function: GetResultF150V9CHATIP
Note :
Para : None
Return : 1 - command end, Sw->ReturnCode = 0
0 - command rejection, & set Sw->ReturnCode
==============================================================*/
int GetResultF150V9CHATIP(void)
{
int SrcErr, i;
struct {
int SrcErr; // source error number from switch
int DestErr;
} Map[] = {
{-1,-1}
};
SrcErr = GetF150V9SrcErr();
if (SrcErr == 0) {
Sw->ReturnCode = 0;
return 1;
}
if (SrcErr<100 || SrcErr>=200 && SrcErr<400) {
Sw->ReturnCode = F150V9MapErrCommon(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: GetResultF150V9STCH
Note :
Para : None
Return : 1 - command end, Sw->ReturnCode = 0
0 - command rejection, & set Sw->ReturnCode
==============================================================*/
int GetResultF150V9STCH(void)
{
int SrcErr, i;
struct {
int SrcErr; // source error number from switch
int DestErr;
} Map[] = {
{601,20}, {603,20}, {604,20}, {606,20}, {608,20}, // data changed not allowed
{602,21}, // password reg
{-1,-1}
};
SrcErr = GetF150V9SrcErr();
if (SrcErr == 0) {
Sw->ReturnCode = 0;
return 1;
}
if (SrcErr<100 || SrcErr>=200 && SrcErr<400) {
Sw->ReturnCode = F150V9MapErrCommon(SrcErr);
return 0;
}
if (SrcErr>=100 && SrcErr<200) {
Sw->ReturnCode = F150V9MapErrCHASBS(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: GetResultF150V9SVRG
Note :
Para : None
Return : 1 - command end, Sw->ReturnCode = 0
0 - command rejection, & set Sw->ReturnCode
==============================================================*/
int GetResultF150V9SVRG(void)
{
int SrcErr, i;
struct {
int SrcErr; // source error number from switch
int DestErr;
} Map[] = {
{-1,-1}
};
SrcErr = GetF150V9SrcErr();
if (SrcErr == 0) {
Sw->ReturnCode = 0;
return 1;
}
if (SrcErr<100 || SrcErr>=200 && SrcErr<400) {
Sw->ReturnCode = F150V9MapErrCommon(SrcErr);
return 0;
}
if (SrcErr>=100 && SrcErr<200) {
Sw->ReturnCode = F150V9MapErrCHASBS(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: GetResultF150V9CNCH
Note :
Para : None
Return : 1 - command end, Sw->ReturnCode = 0
0 - command rejection, & set Sw->ReturnCode
==============================================================*/
int GetResultF150V9CNCH(void)
{
int SrcErr, i;
struct {
int SrcErr; // source error number from switch
int DestErr;
} Map[] = {
{600,21},
{-1,-1}
};
SrcErr = GetF150V9SrcErr();
if (SrcErr == 0) {
Sw->ReturnCode = 0;
return 1;
}
if (SrcErr<100 || SrcErr>=200 && SrcErr<400) {
Sw->ReturnCode = F150V9MapErrCommon(SrcErr);
return 0;
}
if (SrcErr>=100 && SrcErr<200) {
Sw->ReturnCode = F150V9MapErrCHASBS(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: GetResultF150V9UNCH
Note :
Para : None
Return : 1 - command end, Sw->ReturnCode = 0
0 - command rejection, & set Sw->ReturnCode
==============================================================*/
int GetResultF150V9UNCH(void)
{
int SrcErr, i;
SrcErr = GetF150V9SrcErr();
if (SrcErr == 0) {
Sw->ReturnCode = 0;
return 1;
}
if (SrcErr<100 || SrcErr>=200 && SrcErr<400) {
Sw->ReturnCode = F150V9MapErrCommon(SrcErr);
return 0;
}
if (SrcErr>=100 && SrcErr<200) {
Sw->ReturnCode = F150V9MapErrCHASBS(SrcErr);
return 0;
}
Sw->ReturnCode = 9999;
return 0;
}
/*==============================================================
Function: GetResultF150V9CANMCT
Note :
Para : None
Return : 1 - command end, Sw->ReturnCode = 0
0 - command rejection, & set Sw->ReturnCode
==============================================================*/
int GetResultF150V9CANMCT(void)
{
int SrcErr, i;
struct {
int SrcErr; // source error number from switch
int DestErr;
} Map[] = {
{-1,-1}
};
SrcErr = GetF150V9SrcErr();
if (SrcErr == 0) {
Sw->ReturnCode = 0;
return 1;
}
if (SrcErr<100 || SrcErr>=200 && SrcErr<400) {
Sw->ReturnCode = F150V9MapErrCommon(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: GetResultF150V9REGMCT
Note :
Para : None
Return : 1 - command end, Sw->ReturnCode = 0
0 - command rejection, & set Sw->ReturnCode
==============================================================*/
int GetResultF150V9REGMCT(void)
{
int SrcErr, i;
struct {
int SrcErr; // source error number from switch
int DestErr;
} Map[] = {
{-1,-1}
};
SrcErr = GetF150V9SrcErr();
if (SrcErr == 0) {
Sw->ReturnCode = 0;
return 1;
}
if (SrcErr<100 || SrcErr>=200 && SrcErr<400) {
Sw->ReturnCode = F150V9MapErrCommon(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: F150V9MapErrCommon
Note : Map F150V9 err, 011-099, 200-299, 300-399, 700-799
Para : int SrcErr - source error number from switch
Return : Dest error code
===========================================================*/
int F150V9MapErrCommon(int SrcErr)
{
int DestErr = 9999, i;
struct {
int SrcErr; // source error number from switch
int DestErr;
} Map[] = {
/* Command Control Error */
{15,11}, // Command racing error
{16,6}, // Password error
{67,24}, // DN under observation
/* Command Parameter Error */
{20,3}, {21,3}, {22,3}, {23,3}, {24,3},
{30,4}, // Typewriter error
/* Tel Error */
{60,2}, {61,2}, {62,2}, {63,2}, {64,2}, {65,2}, {66, 2},
/* Registration Error */
{81,0}, {82,0},
{-1,-1}
};
for (i=0; Map[i].SrcErr != -1; i++)
if (SrcErr == Map[i].SrcErr) {
DestErr = Map[i].DestErr;
break;
}
return DestErr;
}
/*==========================================================
Function: F150V9MapErrCHASBS
Note : Map F150V9 err, 100-167
Para : int SrcErr - source error number from switch
Return : Dest error code
===========================================================*/
int F150V9MapErrCHASBS(int SrcErr)
{
int DestErr = 9999, i;
struct {
int SrcErr; // source error number from switch
int DestErr;
} Map[] = {
//{100,20}, // data changed not allowed
{100,12}, // data changed not allowed
{103,2}, // Tel err
{131,23}, // malicious reg
{-1,-1}
};
for (i=0; Map[i].SrcErr != -1; i++)
if (SrcErr == Map[i].SrcErr) {
DestErr = Map[i].DestErr;
break;
}
return DestErr;
}
/*==========================================================
Function: GetResult5ESSNewLine
Note :
Para : None
Return : Set Sw->ReturnCode
===========================================================*/
void GetResult5ESSNewLine(void)
{
struct {
int ErrCode;
char ErrStr[128];
} Map[] = {
{0, " OK"},
{2, "FORM NOT FOUND!!"},
{2, "Incorrect office code"},
{8, "ILLEGAL VALUE FOR ATTRIBUTE LNEQNR"},
{8, "Specified LN EQ NR is already assigned"},
{2, "DUPLICATE FORM!!"},
{10, "Port is busy"},
{11, "database modifications manually inhibited"},
{-1, ""}
};
int i;
if (!strstr(Sw->RcvBuff, Sw->Tel)) {
Sw->ReturnCode = 9999;
return;
}
Sw->ReturnCode = -1;
for (i=0; Map[i].ErrCode != -1; i++)
if (strstr(Sw->RcvBuff, Map[i].ErrStr)) {
Sw->ReturnCode = Map[i].ErrCode;
break;
}
if (Sw->ReturnCode == -1) Sw->ReturnCode = 9999;
}
/*============
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -