Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
osie
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
osie
Commits
e6e3548b
Commit
e6e3548b
authored
Apr 18, 2022
by
Ivan Tyagov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add callback for now just to print in case of a change in amonitored variable.
parent
9d0283a5
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
0 deletions
+17
-0
coupler/opc-ua-server/server_subscribe.c
coupler/opc-ua-server/server_subscribe.c
+17
-0
No files found.
coupler/opc-ua-server/server_subscribe.c
View file @
e6e3548b
#include <open62541/client_subscriptions.h>
#include <open62541/plugin/log_stdout.h>
#include <open62541/plugin/pubsub_udp.h>
#include <open62541/server.h>
...
...
@@ -22,6 +23,18 @@ UA_DataSetReaderConfig readerConfig;
static
void
fillTestDataSetMetaData
(
UA_DataSetMetaDataType
*
pMetaData
);
/* callback to handle change notifications */
static
void
dataChangeNotificationCallback
(
UA_Server
*
server
,
UA_UInt32
monitoredItemId
,
void
*
monitoredItemContext
,
const
UA_NodeId
*
nodeId
,
void
*
nodeContext
,
UA_UInt32
attributeId
,
const
UA_DataValue
*
var
)
{
if
(
UA_Variant_hasScalarType
(
&
var
->
value
,
&
UA_TYPES
[
UA_TYPES_INT64
]))
{
UA_LOG_INFO
(
UA_Log_Stdout
,
UA_LOGCATEGORY_USERLAND
,
"Received Notification with value %ld"
,
*
(
UA_Int64
*
)
var
->
value
.
data
);
}
}
/* Add new connection to the server */
static
UA_StatusCode
addPubSubConnection
(
UA_Server
*
server
,
UA_String
*
transportProfile
,
UA_NetworkAddressUrlDataType
*
networkAddressUrl
)
{
...
...
@@ -162,6 +175,10 @@ static UA_StatusCode addSubscribedVariables(UA_Server *server, UA_NodeId dataSet
UA_QUALIFIEDNAME
(
1
,
(
char
*
)
readerConfig
.
dataSetMetaData
.
fields
[
i
].
name
.
data
),
UA_NODEID_NUMERIC
(
0
,
UA_NS0ID_BASEDATAVARIABLETYPE
),
vAttr
,
NULL
,
&
newNode
);
/*monitor variable*/
UA_MonitoredItemCreateRequest
monRequest
=
UA_MonitoredItemCreateRequest_default
(
newNode
);
UA_Server_createDataChangeMonitoredItem
(
server
,
UA_TIMESTAMPSTORETURN_SOURCE
,
monRequest
,
NULL
,
dataChangeNotificationCallback
);
/* For creating Targetvariables */
UA_FieldTargetDataType_init
(
&
targetVars
[
i
].
targetVariable
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment