This commit is contained in:
zhouhuang 2024-12-10 21:31:56 +08:00
parent bc4df7172c
commit e08e4abb78
2 changed files with 18 additions and 2 deletions

View File

@ -917,9 +917,9 @@ BOOLEAN CHostADSBFProcess::OnTimer(void)
if (sec_changed) if (sec_changed)
{ {
if (m_turbine == NULL) { if (m_turbine == NULL) {
#if 0
m_turbine = new AdsDevice{m_remoteIp, AmsNetId(m_remoteNetId), m_remotePort}; m_turbine = new AdsDevice{m_remoteIp, AmsNetId(m_remoteNetId), m_remotePort};
const auto state = m_turbine->GetState(); const auto state = m_turbine->GetState();
//vLog(LOG_DEBUG, "%s ADS state: %d devState: %d\n", m_pidName.c_str(), (uint16_t)state.ads, (uint16_t)state.device);
if ((uint16_t)state.ads >= ADSSTATE::ADSSTATE_MAXSTATES || (uint16_t)state.device >= ADSSTATE::ADSSTATE_MAXSTATES) if ((uint16_t)state.ads >= ADSSTATE::ADSSTATE_MAXSTATES || (uint16_t)state.device >= ADSSTATE::ADSSTATE_MAXSTATES)
{ {
vLog(LOG_DEBUG, "read device state error.\n"); vLog(LOG_DEBUG, "read device state error.\n");
@ -928,6 +928,21 @@ BOOLEAN CHostADSBFProcess::OnTimer(void)
delete m_turbine; delete m_turbine;
m_turbine = NULL; m_turbine = NULL;
} }
#else
//先添加一条路由
long ret = AddRemoteRoute(m_remoteIp, m_localNetId, m_localIp, std::string("isoftstone"), std::string("admin"), std::string("admin"));
vLog(LOG_DEBUG, "bbb %s add route return value is: %d\n", m_pidName.c_str(), ret);
if (ret != 0) return TRUE;
//添加成功
m_turbine = new AdsDevice{m_remoteIp, AmsNetId(m_remoteNetId), m_remotePort};
const auto state = m_turbine->GetState();
if ((uint16_t)state.ads >= ADSSTATE::ADSSTATE_MAXSTATES || (uint16_t)state.device >= ADSSTATE::ADSSTATE_MAXSTATES)
{
vLog(LOG_DEBUG, "read device state error.\n");
delete m_turbine;
m_turbine = NULL;
}
#endif
return TRUE; return TRUE;
} }
if (!m_turbine->IsConnected()) return TRUE; if (!m_turbine->IsConnected()) return TRUE;

View File

@ -41,7 +41,8 @@ typedef int SOCKET;
#include <sys/stat.h> #include <sys/stat.h>
#include "zlog/zlog.h" #include "zlog/zlog.h"
#define MEMERY_1M 65536 //设置位64K //#define MEMERY_1M 65536 //设置位64K
#define MEMERY_1M (2 << 20) //设置位64K
#define DELAY_RUN 5000 #define DELAY_RUN 5000
#define DELAY_TIMER 50 //ms #define DELAY_TIMER 50 //ms
#define TIME_BASE (1000 / DELAY_TIMER) #define TIME_BASE (1000 / DELAY_TIMER)