update
This commit is contained in:
parent
27dca2295d
commit
71e4686245
@ -33,6 +33,7 @@ struct myAdsVariable {
|
|||||||
{
|
{
|
||||||
if (!m_Route.IsConnected()) return FALSE;
|
if (!m_Route.IsConnected()) return FALSE;
|
||||||
uint32_t bytesRead = 0;
|
uint32_t bytesRead = 0;
|
||||||
|
if (m_Handle.get() == 0) return FALSE;
|
||||||
auto error = m_Route.ReadReqEx2(m_IndexGroup,
|
auto error = m_Route.ReadReqEx2(m_IndexGroup,
|
||||||
*m_Handle,
|
*m_Handle,
|
||||||
size,
|
size,
|
||||||
|
14
das-dn/third_party/AdsLib/AdsDevice.cpp
vendored
14
das-dn/third_party/AdsLib/AdsDevice.cpp
vendored
@ -123,7 +123,9 @@ AdsHandle AdsDevice::GetHandle(const std::string& symbolName) const
|
|||||||
if (error || (sizeof(handle) != bytesRead)) {
|
if (error || (sizeof(handle) != bytesRead)) {
|
||||||
LOG_ERROR("AdsDevice GetSymbolHandle is failed: " << symbolName << ".");
|
LOG_ERROR("AdsDevice GetSymbolHandle is failed: " << symbolName << ".");
|
||||||
//throw AdsException(error);
|
//throw AdsException(error);
|
||||||
}else{
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
handle = Beckhoff::letoh(handle);
|
handle = Beckhoff::letoh(handle);
|
||||||
return {new uint32_t {handle}, {std::bind(&AdsDevice::DeleteSymbolHandle, this, std::placeholders::_1)}};
|
return {new uint32_t {handle}, {std::bind(&AdsDevice::DeleteSymbolHandle, this, std::placeholders::_1)}};
|
||||||
}
|
}
|
||||||
@ -137,7 +139,8 @@ AdsHandle AdsDevice::GetHandle(const uint32_t indexGroup,
|
|||||||
PAdsNotificationFuncEx callback,
|
PAdsNotificationFuncEx callback,
|
||||||
const uint32_t hUser) const
|
const uint32_t hUser) const
|
||||||
{
|
{
|
||||||
if(m_Connected == true){
|
if (m_Connected == true)
|
||||||
|
{
|
||||||
uint32_t handle = 0;
|
uint32_t handle = 0;
|
||||||
auto error = AdsSyncAddDeviceNotificationReqEx(
|
auto error = AdsSyncAddDeviceNotificationReqEx(
|
||||||
*m_LocalPort, &m_Addr,
|
*m_LocalPort, &m_Addr,
|
||||||
@ -146,10 +149,13 @@ AdsHandle AdsDevice::GetHandle(const uint32_t indexGroup,
|
|||||||
callback,
|
callback,
|
||||||
hUser,
|
hUser,
|
||||||
&handle);
|
&handle);
|
||||||
if (error || !handle) {
|
if (error || !handle)
|
||||||
|
{
|
||||||
LOG_WARN("AdsDevice GetNotificationHandle is failed.");
|
LOG_WARN("AdsDevice GetNotificationHandle is failed.");
|
||||||
//throw AdsException(error);
|
//throw AdsException(error);
|
||||||
}else{
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
handle = Beckhoff::letoh(handle);
|
handle = Beckhoff::letoh(handle);
|
||||||
return {new uint32_t {handle}, {std::bind(&AdsDevice::DeleteNotificationHandle, this, std::placeholders::_1)}};
|
return {new uint32_t {handle}, {std::bind(&AdsDevice::DeleteNotificationHandle, this, std::placeholders::_1)}};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user