Open li317546360 opened 1 year ago
I forgot about the extension part of AdsDevice, which is used to query variable information
AdsSymbolEntry AdsDevice::getSymbolEntry(const std::string &symbolName) const
{
AdsSymbolEntry entry;
uint32_t bytesRead = 0;
uint32_t error = ReadWriteReqEx2(
ADSIGRP_SYM_INFOBYNAMEEX,
0x0,
sizeof(entry),
&entry,
sizeof(symbolName),
symbolName.c_str(),
&bytesRead);
if (error) {
throw AdsException(error);
}
return entry;
}
std::vector<AdsSymbolEntry> AdsDevice::getSymbolEntrys(const std::vector<std::string>& symbolNames) const
{
std::vector<AdsSymbolEntry> re;
for (const std::string &name : symbolNames){
re.push_back(getSymbolEntry(name));
}
return re;
}
ADS-sum command wrapper example, intended as a reference to assist those in need. It has been successfully tested on macOS.
Use