同步代码

main
BlueMatthew 2 years ago
parent df1725177b
commit d9b4b9080e

@ -188,9 +188,9 @@ CheckTime=NO
[Port18]
Protocol=buban104
NetCommMode=TCP,Server
NetPort=50105
NetPort=50104
NetCommAddr=10.142.247.14
AiNum=128
AiNum=65500
DiNum=256
PiNum=64
Retry=1
@ -204,7 +204,7 @@ CheckTime=UP
总召唤电度数据=120.00
召唤初始化数据=300.00
帧序应答=20.00
超时时间=3.00
超时时间=300.00
转发返校超时时间=0.00
转发是否要求应答=0
超时发送测试帧=0

@ -4617,7 +4617,7 @@ void ProvBuban104SendAIwithFloat(int commid, RTUMSG *rtumsg, int iGroupNo)
{
char commandbuf[MAX_POLLCMD_BUF_LEN];
//DWORD dwStartAddr;
int iLenth, iSendCount=1, iaddr0=1, iaddr1=1;
int iLenth, iSendCount = 1, iaddr0 = 1, iaddr1 = 1, ibyid = 11827;
int i, j, iAllDataCount, iSendNum, flag;
int iNo, iCmdType, igno, iItemNo;
float *pfValue;
@ -4660,7 +4660,7 @@ void ProvBuban104SendAIwithFloat(int commid, RTUMSG *rtumsg, int iGroupNo)
if (iAllDataCount - i > MAX_FLOATAINUM)
{
iSendNum = MAX_FLOATAINUM;
commandbuf[14] = (iSendNum & 0x80); // 通用分类数据集数目NGD
commandbuf[14] = (iSendNum | 0x80); // 通用分类数据集数目NGD
}
else
{
@ -4672,23 +4672,34 @@ void ProvBuban104SendAIwithFloat(int commid, RTUMSG *rtumsg, int iGroupNo)
iLenth = 15;
for (j = 0; j < iSendNum; j++)
{
pfValue = (float *)&commandbuf[iLenth+14];
pfValue = (float *)&commandbuf[iLenth + 13];
flag = GetAIPntMsg(j + iNo, (unsigned int*)&igno, (unsigned int*)&iItemNo, &sCurTime, pfValue, (unsigned int*)&iaddr1);
if (0 == flag)
break;
if (-1 == flag)
continue;
if (0 == j)
{
commandbuf[9] = (u_char)iaddr1; //
commandbuf[10] = (u_char)(iaddr1 >> 8); // 应用服务数据单元公共地址
}
if (iaddr1 == iaddr0)
;
{
; //commandbuf[9] = (u_char)iaddr0; //
//commandbuf[10] = (u_char)(iaddr0 >> 8); // 应用服务数据单元公共地址
}
else
{
iaddr0 = iaddr1;
if (15 == iLenth)
;
{
; //commandbuf[9] = (u_char)iaddr0; //
//commandbuf[10] = (u_char)(iaddr0 >> 8); // 应用服务数据单元公共地址
}
else
break;
}
commandbuf[iLenth] = igno;
commandbuf[iLenth++] = igno;
commandbuf[iLenth++] = iItemNo;
commandbuf[iLenth++] = 1; // 描述类别KOD实际值
commandbuf[iLenth++] = 7; // 数据类型
@ -4701,20 +4712,22 @@ void ProvBuban104SendAIwithFloat(int commid, RTUMSG *rtumsg, int iGroupNo)
commandbuf[iLenth++] = (u_char)sCurTime.Day;
commandbuf[iLenth++] = (u_char)sCurTime.Month;
commandbuf[iLenth++] = (u_char)(sCurTime.Year % 100);
iLenth += 12;
iLenth += 8;
//*pfValue = SequenceHostToRtufloat((float)((int)pntmsg.RawValue));
//iLenth += sizeof(float);
//commandbuf[iLenth++] = 0;
commandbuf[iLenth++] = (u_char)ibyid;
commandbuf[iLenth++] = (u_char)(ibyid >> 8);
commandbuf[iLenth++] = (u_char)(ibyid >> 16);
commandbuf[iLenth++] = (u_char)(ibyid >> 24);
}
if (15 == iLenth)
break;
commandbuf[9] = (u_char)iaddr0; //
commandbuf[10] = (u_char)(iaddr0 >> 8); // 应用服务数据单元公共地址
i += j;
if (flag == 0)
{
printf("get total %d item!\n", i);
i = iAllDataCount;
}
if (i >= iAllDataCount)
@ -4722,12 +4735,13 @@ void ProvBuban104SendAIwithFloat(int commid, RTUMSG *rtumsg, int iGroupNo)
commandbuf[14] = j; // 通用分类数据集数目NGD
}
else
commandbuf[14] = (j & 0x80); // 通用分类数据集数目NGD
commandbuf[14] = (j | 0x80); // 通用分类数据集数目NGD
commandbuf[1] = (char)(iLenth - 2);
PutPollCmdToBuf(commid, iCmdType, 0, (char *)commandbuf, iLenth);
}
//printf("get total %d item!\n", i);
}
/*void ProvBuban104SendAIwithFloat(int commid, RTUMSG *rtumsg, int iGroupNo)

Loading…
Cancel
Save