解决查询云台位置命令不下发BUg

NWMQTT
jxjajs 2 months ago
parent 1f3943b34b
commit 2af459d57a

@ -1978,7 +1978,12 @@ int FindNextCameraPhotoCommand(SIO_PARAM_SERIAL_DEF *pPortParam)
srdt.iLastGetPhotoNo = -1; srdt.iLastGetPhotoNo = -1;
return 1; return 1;
case NOTIFY_PTZ_CLOSE: /* 通知云台关闭电源*/ case NOTIFY_PTZ_CLOSE: /* 通知云台关闭电源*/
if (pPortParam->sendptzstatecmd > 0) if (pPortParam->sendptzstatecmd == 0)
{
cmdidx = 0xA0;
pPortParam->sendptzstatecmd++;
}
else
{ {
pPortParam->SerialCmdidx = -2; pPortParam->SerialCmdidx = -2;
pPortParam->sendptzstatecmd = 0; pPortParam->sendptzstatecmd = 0;
@ -1986,12 +1991,24 @@ int FindNextCameraPhotoCommand(SIO_PARAM_SERIAL_DEF *pPortParam)
DebugLog(0, szbuf, 'I'); DebugLog(0, szbuf, 'I');
return -1; return -1;
} }
cmdidx = 0xA0;
pPortParam->sendptzstatecmd++;
//pPortParam->SerialCmdidx = -1; //pPortParam->SerialCmdidx = -1;
break; break;
case QUERY_PTZ_STATE: /* 查询云台状态信息*/ case QUERY_PTZ_STATE: /* 查询云台状态信息*/
if (pPortParam->sendptzstatecmd > 0) ::memset(szbuf, 0, sizeof(szbuf));
sprintf(szbuf, "下发命令sendptzstatecmd=%d!", pPortParam->sendptzstatecmd);
DebugLog(0, szbuf, 'I');
//if (pPortParam->sendptzstatecmd > 0)
#if 1
if (pPortParam->sendptzstatecmd == 0)
{
pPortParam->sendptzstatecmd++;
cmdidx = 0x08;
//::memset(szbuf, 0, sizeof(szbuf));
//sprintf(szbuf, "下发命令sendptzstatecmd=%d!", pPortParam->sendptzstatecmd);
//DebugLog(0, szbuf, 'I');
}
else
#endif
{ {
pPortParam->SerialCmdidx = -2; pPortParam->SerialCmdidx = -2;
pPortParam->sendptzstatecmd = 0; pPortParam->sendptzstatecmd = 0;
@ -1999,7 +2016,7 @@ int FindNextCameraPhotoCommand(SIO_PARAM_SERIAL_DEF *pPortParam)
DebugLog(0, szbuf, 'I'); DebugLog(0, szbuf, 'I');
return -1; return -1;
} }
pPortParam->sendptzstatecmd++; pPortParam->sendptzstatecmd++;
cmdidx = 0x08; cmdidx = 0x08;
//pPortParam->SerialCmdidx = -1; //pPortParam->SerialCmdidx = -1;
break; break;
@ -2024,7 +2041,11 @@ int FindNextCameraPhotoCommand(SIO_PARAM_SERIAL_DEF *pPortParam)
} }
break; break;
} }
MakeCameraPhotoCommand(pPortParam, cmdidx, imagesize, packetsize, imagequality, srdt.sendphototime); ::memset(szbuf, 0, sizeof(szbuf));
strcpy(szbuf, "make:sendptzstatecmd");
DebugLog(0, szbuf, 'I');
MakeCameraPhotoCommand(pPortParam, cmdidx, imagesize, packetsize, imagequality, srdt.sendphototime);
return 1; return 1;
} }
@ -2039,6 +2060,10 @@ void MakeCameraPhotoCommand(SIO_PARAM_SERIAL_DEF *pPortParam, uint8_t cmdidx, in
sendbuf = pPortParam->PollCmd; sendbuf = pPortParam->PollCmd;
::memset(szbuf, 0, sizeof(szbuf));
strcpy(szbuf, "make:sendptzstatecmd start!");
DebugLog(0, szbuf, 'I');
//return;
icurtime = phototime; icurtime = phototime;
i = 0; i = 0;
sendbuf[i++] = 0x00; /* 强制等待时间*/ sendbuf[i++] = 0x00; /* 强制等待时间*/
@ -2096,11 +2121,17 @@ void MakeCameraPhotoCommand(SIO_PARAM_SERIAL_DEF *pPortParam, uint8_t cmdidx, in
sendbuf[3] = (uint8_t)((i - 10) >> 8); sendbuf[3] = (uint8_t)((i - 10) >> 8);
sendbuf[4] = (uint8_t)(i - 10); sendbuf[4] = (uint8_t)(i - 10);
pPortParam->cmdlen = i; pPortParam->cmdlen = i;
if(0x08 == cmdidx) #if 1
//::memset(szbuf, 0, sizeof(szbuf));
//strcpy(szbuf, "make over!");
//DebugLog(0, szbuf, 'I');
if(0x08 == cmdidx)
{ {
::memset(szbuf, 0, sizeof(szbuf));
strcpy(szbuf, "生成查询云台位置命令!"); strcpy(szbuf, "生成查询云台位置命令!");
DebugLog(0, szbuf, 'I'); DebugLog(0, szbuf, 'I');
} }
#endif
//return; //return;
} }
@ -3119,7 +3150,7 @@ void SendCameraCmdFormPollCmdBuf(SIO_PARAM_SERIAL_DEF *pPortParam)
char buf[128]; char buf[128];
int len, ret; int len, ret;
int64_t lctime; int64_t lctime;
char szbuf[512]; //char szbuf[512];
memset(buf, 0, sizeof(buf)); memset(buf, 0, sizeof(buf));
lctime = get_msec(); lctime = get_msec();
@ -3132,8 +3163,8 @@ void SendCameraCmdFormPollCmdBuf(SIO_PARAM_SERIAL_DEF *pPortParam)
if (pPortParam->SendCmdFlag && (pPortParam->RevCmdFlag == 0)) if (pPortParam->SendCmdFlag && (pPortParam->RevCmdFlag == 0))
{ {
//pPortParam->RetryTimeCnt++; //pPortParam->RetryTimeCnt++;
strcpy(szbuf, "1-send"); //strcpy(szbuf, "1-send");
DebugLog(0, szbuf, 'E'); //DebugLog(0, szbuf, 'E');
if ((lctime - pPortParam->RetryTimeCnt > 3 * pPortParam->RetryTime) || (lctime - pPortParam->RetryTimeCnt < 0)) if ((lctime - pPortParam->RetryTimeCnt > 3 * pPortParam->RetryTime) || (lctime - pPortParam->RetryTimeCnt < 0))
{ {
@ -3160,8 +3191,8 @@ void SendCameraCmdFormPollCmdBuf(SIO_PARAM_SERIAL_DEF *pPortParam)
if (pPortParam->SendCmdFlag && pPortParam->RevCmdFlag) if (pPortParam->SendCmdFlag && pPortParam->RevCmdFlag)
{ {
strcpy(szbuf, "2-send"); //strcpy(szbuf, "2-send");
DebugLog(0, szbuf, 'E'); //DebugLog(0, szbuf, 'E');
// 清除当前命令 // 清除当前命令
ClearCameraCmdFormPollCmdBuf(pPortParam); ClearCameraCmdFormPollCmdBuf(pPortParam);
} }
@ -3460,8 +3491,11 @@ int QueryPtzState(PTZ_STATE *ptz_state, int cmdidx, const char *serfile, unsign
if (0x00 == flag) if (0x00 == flag)
{ {
sprintf(szbuf, "云台状态查询启动串口定时器!"); ::memset(szbuf, 0, sizeof(szbuf));
strcpy(szbuf, "云台状态查询启动串口定时器!");
DebugLog(8, szbuf, 'I'); DebugLog(8, szbuf, 'I');
//sprintf(szbuf, "下发命令sendptzstatecmd=%d!", cameraport->sendptzstatecmd);
//DebugLog(0, szbuf, 'I');
for (;;) for (;;)
{ {
usleep(10); usleep(10);

Loading…
Cancel
Save