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
Martin Manchev
osie
Commits
1b59a872
Commit
1b59a872
authored
Oct 05, 2022
by
Ivan Tyagov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Small optimisation.
parent
4466677a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
4 deletions
+5
-4
coupler/opc-ua-server/keep_alive.h
coupler/opc-ua-server/keep_alive.h
+1
-1
coupler/opc-ua-server/keep_alive_subscriber.h
coupler/opc-ua-server/keep_alive_subscriber.h
+4
-3
No files found.
coupler/opc-ua-server/keep_alive.h
View file @
1b59a872
...
...
@@ -6,7 +6,7 @@ char *NETWORK_ADDRESS_URL_DATA_TYPE = "opc.udp://224.0.0.22:4840/";
static
unsigned
int
HEART_BEATS
=
0
;
// the heart beat interval$$
const
int
DEFAULT_HEART_BEAT_INTERVAL
=
5
0
;
const
int
DEFAULT_HEART_BEAT_INTERVAL
=
1
0
;
static
int
HEART_BEAT_INTERVAL
=
DEFAULT_HEART_BEAT_INTERVAL
;
// the timeout in millis after which a coupler is considered down
...
...
coupler/opc-ua-server/keep_alive_subscriber.h
View file @
1b59a872
...
...
@@ -25,7 +25,7 @@ static void dataChangeNotificationCallback(UA_Server *server, UA_UInt32 monitore
void
*
monitoredItemContext
,
const
UA_NodeId
*
nodeId
,
void
*
nodeContext
,
UA_UInt32
attributeId
,
const
UA_DataValue
*
var
)
{
unsigned
long
int
milli_seconds_now
=
getMilliSecondsSinceEpoch
()
;
unsigned
long
int
milli_seconds_now
;
unsigned
int
coupler_id
;
// filter out ID from Data Set
...
...
@@ -54,8 +54,9 @@ static void dataChangeNotificationCallback(UA_Server *server, UA_UInt32 monitore
// filter out heart_beat from Data Set
if
(
UA_Variant_hasScalarType
(
&
var
->
value
,
&
UA_TYPES
[
UA_TYPES_FLOAT
]))
{
float
heart_beat
=
*
(
UA_Float
*
)
var
->
value
.
data
;
milli_seconds_now
=
getMilliSecondsSinceEpoch
();
// split <ID>.<heart_beats>, just converting to int is enough
coupler_id
=
(
int
)
heart_beat
;
coupler_id
=
(
int
)
heart_beat
;
if
(
coupler_id
!=
COUPLER_ID
)
{
UA_LOG_INFO
(
UA_Log_Stdout
,
\
UA_LOGCATEGORY_USERLAND
,
\
...
...
@@ -217,7 +218,7 @@ static UA_StatusCode addSubscribedVariables(UA_Server *server, UA_NodeId dataSet
if
(
ENABLE_HEART_BEAT_CHECK
)
{
UA_MonitoredItemCreateRequest
monRequest
=
UA_MonitoredItemCreateRequest_default
(
newNode
);
//monRequest.requestedParameters.samplingInterval = 100.0; /* 100 ms interval */
UA_Server_createDataChangeMonitoredItem
(
server
,
UA_TIMESTAMPSTORETURN_
SOURCE
,
UA_Server_createDataChangeMonitoredItem
(
server
,
UA_TIMESTAMPSTORETURN_
NEITHER
,
monRequest
,
NULL
,
dataChangeNotificationCallback
);
}
/* For creating Targetvariables */
...
...
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