Commit b8d5e8a3 authored by Ralph Lange's avatar Ralph Lange
Browse files

uasdk: log BadNodeIdUnknown on session connect

(fixes #22)
parent 9a77cfac
......@@ -15,6 +15,7 @@
#include <uaclientsdk.h>
#include <uanodeid.h>
#include <opcua_statuscodes.h>
#include "RecordConnector.h"
#include "opcuaItemRecord.h"
......@@ -34,7 +35,7 @@ ItemUaSdk::ItemUaSdk (const linkInfo &info)
, registered(false)
, revisedSamplingInterval(0.0)
, revisedQueueSize(0)
, lastStatus(0x800D0000) // BadServerNotConnected
, lastStatus(OpcUa_BadServerNotConnected)
{
rebuildNodeId();
......@@ -145,6 +146,15 @@ ItemUaSdk::setIncomingData(const OpcUa_DataValue &value, ProcessReason reason)
tsSource = uaToEpicsTime(UaDateTime(value.SourceTimestamp), value.SourcePicoseconds);
tsServer = uaToEpicsTime(UaDateTime(value.ServerTimestamp), value.ServerPicoseconds);
setReason(reason);
if (getLastStatus() == OpcUa_BadServerNotConnected && value.StatusCode == OpcUa_BadNodeIdUnknown)
errlogPrintf("OPC UA session %s: item ns=%d;%s%.*d%s : BadNodeIdUnknown\n",
session->getName().c_str(),
linkinfo.namespaceIndex,
(linkinfo.identifierIsNumeric ? "i=" : "s="),
(linkinfo.identifierIsNumeric ? 1 : 0),
(linkinfo.identifierIsNumeric ? linkinfo.identifierNumber : 0),
(linkinfo.identifierIsNumeric ? "" : linkinfo.identifierString.c_str()));
setLastStatus(value.StatusCode);
if (auto pd = rootElement.lock())
......@@ -157,7 +167,7 @@ ItemUaSdk::setIncomingEvent(const ProcessReason reason)
tsClient = epicsTime::getCurrent();
setReason(reason);
if (reason == ProcessReason::connectionLoss)
setLastStatus(0x800D0000); // BadServerNotConnected
setLastStatus(OpcUa_BadServerNotConnected);
if (auto pd = rootElement.lock()) {
pd->setIncomingEvent(reason);
......
......@@ -103,7 +103,7 @@ public:
* @brief Getter for the status of the last read operation.
* @return read status
*/
const UaStatusCode &getLastStatus() { return lastStatus; }
UaStatusCode getLastStatus() { return lastStatus; }
/**
* @brief Setter for the reason of an operation.
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment