diff --git a/das-dn/hostadsbf/hostadsbf.cpp b/das-dn/hostadsbf/hostadsbf.cpp index 1aef74ad..48b819f8 100644 --- a/das-dn/hostadsbf/hostadsbf.cpp +++ b/das-dn/hostadsbf/hostadsbf.cpp @@ -917,9 +917,9 @@ BOOLEAN CHostADSBFProcess::OnTimer(void) if (sec_changed) { if (m_turbine == NULL) { +#if 0 m_turbine = new AdsDevice{m_remoteIp, AmsNetId(m_remoteNetId), m_remotePort}; 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) { vLog(LOG_DEBUG, "read device state error.\n"); @@ -928,6 +928,21 @@ BOOLEAN CHostADSBFProcess::OnTimer(void) delete m_turbine; 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; } if (!m_turbine->IsConnected()) return TRUE; diff --git a/das-dn/inc/public.h b/das-dn/inc/public.h index 620ba54f..3db29c5d 100644 --- a/das-dn/inc/public.h +++ b/das-dn/inc/public.h @@ -41,7 +41,8 @@ typedef int SOCKET; #include #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_TIMER 50 //ms #define TIME_BASE (1000 / DELAY_TIMER)