From 71e468624556ad4626c1ce8324fe03957fc3eb76 Mon Sep 17 00:00:00 2001 From: zhouhuang Date: Mon, 13 Jan 2025 09:26:27 +0800 Subject: [PATCH] update --- das-dn/hostadsbf/hostadsbf.h | 1 + das-dn/third_party/AdsLib/AdsDevice.cpp | 18 ++++++++++++------ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/das-dn/hostadsbf/hostadsbf.h b/das-dn/hostadsbf/hostadsbf.h index e273c1cf..a221b098 100644 --- a/das-dn/hostadsbf/hostadsbf.h +++ b/das-dn/hostadsbf/hostadsbf.h @@ -33,6 +33,7 @@ struct myAdsVariable { { if (!m_Route.IsConnected()) return FALSE; uint32_t bytesRead = 0; + if (m_Handle.get() == 0) return FALSE; auto error = m_Route.ReadReqEx2(m_IndexGroup, *m_Handle, size, diff --git a/das-dn/third_party/AdsLib/AdsDevice.cpp b/das-dn/third_party/AdsLib/AdsDevice.cpp index 66011c65..00a5ef5f 100644 --- a/das-dn/third_party/AdsLib/AdsDevice.cpp +++ b/das-dn/third_party/AdsLib/AdsDevice.cpp @@ -108,7 +108,7 @@ AdsHandle AdsDevice::GetHandle(const uint32_t offset) const AdsHandle AdsDevice::GetHandle(const std::string& symbolName) const { - if(m_Connected == true) + if (m_Connected == true) { uint32_t handle = 0; uint32_t bytesRead = 0; @@ -121,9 +121,11 @@ AdsHandle AdsDevice::GetHandle(const std::string& symbolName) const ); if (error || (sizeof(handle) != bytesRead)) { - LOG_ERROR("AdsDevice GetSymbolHandle is failed: "<