fixed client, namespace, id and string was not read correctly

main
Steffen Pohle 1 month ago
parent 624a1d8eb8
commit edb5fdc831

@ -11,7 +11,7 @@ int main(int argc, char* argv[]) {
<< " <Server-URL> <Node-ID> [Interval-in-seconds]\n\n" << " <Server-URL> <Node-ID> [Interval-in-seconds]\n\n"
<< "Example:\n" << "Example:\n"
<< argv[0] << argv[0]
<< " opc.tcp://192.168.1.100:4840 ns=2;i=2 1\n"; << " opc.tcp://192.168.1.100:4840 \"ns=2;i=2\" 1\n";
return 1; return 1;
} }
@ -28,12 +28,12 @@ int main(int argc, char* argv[]) {
// 2. Read Node Value // 2. Read Node Value
uint16_t nsIndex = std::stoi(nodeText.substr(nodeText.find("ns=") + 3, nodeText.find(";") - (nodeText.find("ns=") + 3))); uint16_t nsIndex = std::stoi(nodeText.substr(nodeText.find("ns=") + 3, nodeText.find(";") - (nodeText.find("ns=") + 3)));
std::size_t sPos = nodeText.find("s="); std::size_t sPos = nodeText.find(";s=");
std::string stringNodeId; std::string stringNodeId;
uint32_t numericNodeId; uint32_t numericNodeId;
std::string value; std::string value;
if (sPos != std::string::npos) stringNodeId = nodeText.substr(sPos + 2); if (sPos != std::string::npos) stringNodeId = nodeText.substr(sPos + 3);
else numericNodeId = std::stoi(nodeText.substr(nodeText.find("i=") + 2)); else numericNodeId = std::stoi(nodeText.substr(nodeText.find("i=") + 2));
do { do {

Loading…
Cancel
Save