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
Nikola Balog
osie
Commits
71e8e5ff
Commit
71e8e5ff
authored
May 03, 2022
by
Ivan Tyagov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use proper type.
parent
181b82ce
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
7 deletions
+8
-7
coupler/opc-ua-server/common.h
coupler/opc-ua-server/common.h
+3
-3
coupler/opc-ua-server/keep_alive_subscriber.h
coupler/opc-ua-server/keep_alive_subscriber.h
+5
-4
No files found.
coupler/opc-ua-server/common.h
View file @
71e8e5ff
...
@@ -7,13 +7,13 @@
...
@@ -7,13 +7,13 @@
#include <open62541/server.h>
#include <open62541/server.h>
int
getMilliSecondsSinceEpoch
()
{
unsigned
long
int
getMilliSecondsSinceEpoch
()
{
/*
/*
* Return milli seconds since epoch
* Return milli seconds since epoch
.
*/
*/
struct
timeval
current_time
;
struct
timeval
current_time
;
gettimeofday
(
&
current_time
,
NULL
);
gettimeofday
(
&
current_time
,
NULL
);
long
int
ms
=
current_time
.
tv_sec
*
1000
+
current_time
.
tv_usec
/
1000
;
unsigned
long
int
ms
=
current_time
.
tv_sec
*
1000
+
current_time
.
tv_usec
/
1000
;
return
ms
;
return
ms
;
}
}
...
...
coupler/opc-ua-server/keep_alive_subscriber.h
View file @
71e8e5ff
...
@@ -25,15 +25,16 @@ static void dataChangeNotificationCallback(UA_Server *server, UA_UInt32 monitore
...
@@ -25,15 +25,16 @@ static void dataChangeNotificationCallback(UA_Server *server, UA_UInt32 monitore
void
*
monitoredItemContext
,
const
UA_NodeId
*
nodeId
,
void
*
monitoredItemContext
,
const
UA_NodeId
*
nodeId
,
void
*
nodeContext
,
UA_UInt32
attributeId
,
void
*
nodeContext
,
UA_UInt32
attributeId
,
const
UA_DataValue
*
var
)
{
const
UA_DataValue
*
var
)
{
long
int
milli_seconds_now
=
getMilliSecondsSinceEpoch
();
unsigned
long
int
milli_seconds_now
=
getMilliSecondsSinceEpoch
();
// filter out ID from Data Set
// filter out ID from Data Set
if
(
UA_Variant_hasScalarType
(
&
var
->
value
,
&
UA_TYPES
[
UA_TYPES_UINT32
]))
{
if
(
UA_Variant_hasScalarType
(
&
var
->
value
,
&
UA_TYPES
[
UA_TYPES_UINT32
]))
{
unsigned
int
coupler_id
=
*
(
UA_UInt32
*
)
var
->
value
.
data
;
unsigned
int
coupler_id
=
*
(
UA_UInt32
*
)
var
->
value
.
data
;
// care for other coupler_id NOT ourselves
// care for other coupler_id NOT ourselves
if
(
coupler_id
!=
COUPLER_ID
)
{
if
(
coupler_id
!=
COUPLER_ID
)
{
//HEART_BEAT_ID_LIST
UA_LOG_INFO
(
UA_Log_Stdout
,
\
UA_LOG_INFO
(
UA_Log_Stdout
,
UA_LOGCATEGORY_USERLAND
,
"Got heart beat from ID = %d, timestamp=%ld"
,
coupler_id
,
milli_seconds_now
);
UA_LOGCATEGORY_USERLAND
,
\
"Got heart beat from ID = %d, timestamp=%ld"
,
coupler_id
,
milli_seconds_now
);
// convert coupler_id to str
// convert coupler_id to str
char
*
coupler_id_str
=
convertInt2Str
(
coupler_id
);
char
*
coupler_id_str
=
convertInt2Str
(
coupler_id
);
...
@@ -258,7 +259,7 @@ static void fillTestDataSetMetaData(UA_DataSetMetaDataType *pMetaData) {
...
@@ -258,7 +259,7 @@ static void fillTestDataSetMetaData(UA_DataSetMetaDataType *pMetaData) {
void
callbackCheckHeartBeat
()
{
void
callbackCheckHeartBeat
()
{
int
i
,
coupler_id
;
int
i
,
coupler_id
;
long
int
milli_seconds
=
getMilliSecondsSinceEpoch
();
unsigned
long
int
milli_seconds
=
getMilliSecondsSinceEpoch
();
size_t
n
=
sizeof
(
HEART_BEAT_ID_LIST
)
/
sizeof
(
HEART_BEAT_ID_LIST
[
0
]);
size_t
n
=
sizeof
(
HEART_BEAT_ID_LIST
)
/
sizeof
(
HEART_BEAT_ID_LIST
[
0
]);
for
(
int
i
=
0
;
i
<
n
;
i
++
)
{
for
(
int
i
=
0
;
i
<
n
;
i
++
)
{
coupler_id
=
HEART_BEAT_ID_LIST
[
i
];
coupler_id
=
HEART_BEAT_ID_LIST
[
i
];
...
...
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