Skip to content

Commit

Permalink
fix bug in simple attribute operand
Browse files Browse the repository at this point in the history
  • Loading branch information
huebl committed Aug 13, 2023
1 parent d3b46fd commit 3cf59f7
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
13 changes: 10 additions & 3 deletions src/OpcUaStackCore/Filter/FilterStack.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2017-2021 Kai Huebl ([email protected])
Copyright 2017-2023 Kai Huebl ([email protected])
Lizenziert gemäß Apache Licence Version 2.0 (die „Lizenz“); Nutzung dieser
Datei nur in Übereinstimmung mit der Lizenz erlaubt.
Expand Down Expand Up @@ -98,16 +98,23 @@ namespace OpcUaStackCore
}

bool
FilterStack::buildOperatorNode(ContentFilter& contentFilter, ContentFilterResult& contentFilterResult, int idx, FilterNode::SPtr& node)
FilterStack::buildOperatorNode(
ContentFilter& contentFilter,
ContentFilterResult& contentFilterResult,
int idx,
FilterNode::SPtr& node
)
{

OpcUaStatusCode operatorStatus = OpcUaStatusCode::Success;

bool hasOperandError = false;

// get content filter element
ContentFilterElement::SPtr el;
contentFilter.elements().get(idx, el);

// create result elements
auto operandStatuses = boost::make_shared<OpcUaStatusCodeArray>();
operandStatuses->resize(el->filterOperands().size());

Expand Down Expand Up @@ -179,7 +186,7 @@ namespace OpcUaStackCore
{
SimpleAttributeOperand::SPtr simpleAttributeOperand = operand->parameter<SimpleAttributeOperand>();
SimpleAttributeFilterNode::SPtr simpleAttributeNode(new SimpleAttributeFilterNode(
simpleAttributeOperand->typeId(),
simpleAttributeOperand->typeDefinitionId(),
simpleAttributeOperand->browsePath(),
simpleAttributeOperand->attributeId(),
simpleAttributeOperand->indexRange()));
Expand Down
14 changes: 13 additions & 1 deletion src/OpcUaStackServer/ServiceSet/EventItem.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2017-2021 Kai Huebl ([email protected])
Copyright 2017-2023 Kai Huebl ([email protected])
Lizenziert gemäß Apache Licence Version 2.0 (die „Lizenz“); Nutzung dieser
Datei nur in Übereinstimmung mit der Lizenz erlaubt.
Expand All @@ -16,6 +16,8 @@
*/

#include <iostream>
#include <sstream>

#include "OpcUaStackCore/Base/Log.h"
#include "OpcUaStackCore/StandardDataTypes/EventFilter.h"
#include "OpcUaStackCore/StandardEventType/BaseEventType.h"
Expand Down Expand Up @@ -69,6 +71,7 @@ namespace OpcUaStackServer
{
OpcUaStatusCode statusCode;

// check parameter
if (monitoredItemCreateRequest.get() == nullptr) {
return BadInvalidArgument;
}
Expand Down Expand Up @@ -170,6 +173,10 @@ namespace OpcUaStackServer
NodeSetNamespace nodeSetNamespace;
eventBase->namespaceArray(&nodeSetNamespace.globalNamespaceVec());

//
// handle base event type
//

// generate event id if necessary
if (baseEventType->eventId().get() == nullptr) {
boost::posix_time::ptime time = boost::posix_time::microsec_clock::local_time();
Expand Down Expand Up @@ -225,6 +232,11 @@ namespace OpcUaStackServer
baseEventType->severity(variant);
}

// log event information
std::stringstream ss;
ss << *baseEventType.get();
Log(Debug, "fire event").parameter("Event", ss.str());

// process select clause
bool resultCode;
eventBase_ = eventBase;
Expand Down

0 comments on commit 3cf59f7

Please sign in to comment.