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
8e1c9e19
Commit
8e1c9e19
authored
May 03, 2022
by
Ivan Tyagov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Better logging.
parent
71e8e5ff
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
3 deletions
+11
-3
coupler/opc-ua-server/keep_alive_subscriber.h
coupler/opc-ua-server/keep_alive_subscriber.h
+11
-3
No files found.
coupler/opc-ua-server/keep_alive_subscriber.h
View file @
8e1c9e19
...
@@ -34,7 +34,7 @@ static void dataChangeNotificationCallback(UA_Server *server, UA_UInt32 monitore
...
@@ -34,7 +34,7 @@ static void dataChangeNotificationCallback(UA_Server *server, UA_UInt32 monitore
if
(
coupler_id
!=
COUPLER_ID
)
{
if
(
coupler_id
!=
COUPLER_ID
)
{
UA_LOG_INFO
(
UA_Log_Stdout
,
\
UA_LOG_INFO
(
UA_Log_Stdout
,
\
UA_LOGCATEGORY_USERLAND
,
\
UA_LOGCATEGORY_USERLAND
,
\
"
Got heart beat from ID = %d, timestamp=%ld"
,
coupler_id
,
milli_seconds_now
);
"
HEART BEAT: %d"
,
coupler_id
);
// 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,6 +258,10 @@ static void fillTestDataSetMetaData(UA_DataSetMetaDataType *pMetaData) {
...
@@ -258,6 +258,10 @@ static void fillTestDataSetMetaData(UA_DataSetMetaDataType *pMetaData) {
void
callbackCheckHeartBeat
()
{
void
callbackCheckHeartBeat
()
{
/*
* Check if for liveness of related couplers. Called upon a certain interval.
* If a related coupler is down got to safe mode.
*/
int
i
,
coupler_id
;
int
i
,
coupler_id
;
unsigned
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
]);
...
@@ -267,13 +271,17 @@ void callbackCheckHeartBeat() {
...
@@ -267,13 +271,17 @@ void callbackCheckHeartBeat() {
// convert to str as this is the hash key
// convert to str as this is the hash key
char
*
coupler_id_str
=
convertInt2Str
(
coupler_id
);
char
*
coupler_id_str
=
convertInt2Str
(
coupler_id
);
char
*
last_seen_timestamp
=
getItem
(
SUBSCRIBER_DICT
,
coupler_id_str
);
char
*
last_seen_timestamp
=
getItem
(
SUBSCRIBER_DICT
,
coupler_id_str
);
UA_LOG_INFO
(
UA_Log_Stdout
,
UA_LOGCATEGORY_USERLAND
,
"Check ID=%s, last_seen=%s"
,
coupler_id_str
,
last_seen_timestamp
);
//
UA_LOG_INFO(UA_Log_Stdout, UA_LOGCATEGORY_USERLAND, "Check ID=%s, last_seen=%s", coupler_id_str, last_seen_timestamp);
if
(
last_seen_timestamp
!=
NULL
){
if
(
last_seen_timestamp
!=
NULL
){
// we do have timestamp for this coupler ID
// we do have timestamp for this coupler ID
int
last_seen_timestamp_int
=
atoi
(
last_seen_timestamp
);
int
last_seen_timestamp_int
=
atoi
(
last_seen_timestamp
);
int
timestamp_delta
=
milli_seconds
-
last_seen_timestamp_int
;
int
timestamp_delta
=
milli_seconds
-
last_seen_timestamp_int
;
bool
is_down
=
(
timestamp_delta
>
1000
);
bool
is_down
=
(
timestamp_delta
>
1000
);
UA_LOG_INFO
(
UA_Log_Stdout
,
UA_LOGCATEGORY_USERLAND
,
"
\t
delta=%d, is_down=%d"
,
timestamp_delta
,
is_down
);
if
(
is_down
)
{
UA_LOG_INFO
(
UA_Log_Stdout
,
\
UA_LOGCATEGORY_USERLAND
,
\
"DOWN: %s (delta=%d)"
,
coupler_id_str
,
timestamp_delta
);
}
}
}
}
}
}
}
...
...
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