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
daaa4a55
Commit
daaa4a55
authored
Apr 27, 2022
by
Ivan Tyagov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
WIP: First check for couplers' which are down.
parent
89669a4b
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
11 deletions
+29
-11
coupler/opc-ua-server/coupler1.sh
coupler/opc-ua-server/coupler1.sh
+1
-1
coupler/opc-ua-server/coupler2.sh
coupler/opc-ua-server/coupler2.sh
+1
-1
coupler/opc-ua-server/coupler3.sh
coupler/opc-ua-server/coupler3.sh
+1
-1
coupler/opc-ua-server/keep_alive_subscriber.h
coupler/opc-ua-server/keep_alive_subscriber.h
+26
-8
No files found.
coupler/opc-ua-server/coupler1.sh
View file @
daaa4a55
#!/bin/bash
#!/bin/bash
./server
-m
1
-b
1
-i
1
-l
7,2
-t
100
./server
-m
1
-b
1
-i
1
-l
2,3
-t
100
coupler/opc-ua-server/coupler2.sh
View file @
daaa4a55
#!/bin/bash
#!/bin/bash
./server
-p
4841
-m
1
-b
1
-i
2
-l
7,2
-t
100
./server
-p
4841
-m
1
-b
1
-i
2
-l
1,3
-t
100
coupler/opc-ua-server/coupler3.sh
View file @
daaa4a55
#!/bin/bash
#!/bin/bash
./server
-p
4842
-m
1
-b
1
-i
3
-l
7
,2
-t
100
./server
-p
4842
-m
1
-b
1
-i
3
-l
1
,2
-t
100
coupler/opc-ua-server/keep_alive_subscriber.h
View file @
daaa4a55
...
@@ -7,10 +7,6 @@
...
@@ -7,10 +7,6 @@
#include "ua_pubsub.h"
#include "ua_pubsub.h"
#if defined (UA_ENABLE_PUBSUB_ETH_UADP)
#include <open62541/plugin/pubsub_ethernet.h>
#endif
#include <stdio.h>
#include <stdio.h>
#include <signal.h>
#include <signal.h>
#include <stdlib.h>
#include <stdlib.h>
...
@@ -35,21 +31,43 @@ static void dataChangeNotificationCallback(UA_Server *server, UA_UInt32 monitore
...
@@ -35,21 +31,43 @@ static void dataChangeNotificationCallback(UA_Server *server, UA_UInt32 monitore
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_LOGCATEGORY_USERLAND
,
"Got heart beat from ID = %d, timestamp=%ld"
,
coupler_id
,
micro_seconds
);
// convert coupler_id to str
// convert coupler_id to str
(XXX: define as a function)
int
length
=
snprintf
(
NULL
,
0
,
"%d"
,
coupler_id
);
int
length
=
snprintf
(
NULL
,
0
,
"%d"
,
coupler_id
);
char
*
coupler_id_str
=
malloc
(
length
+
1
);
char
*
coupler_id_str
=
malloc
(
length
+
1
);
snprintf
(
coupler_id_str
,
length
+
1
,
"%d"
,
coupler_id
);
snprintf
(
coupler_id_str
,
length
+
1
,
"%d"
,
coupler_id
);
// convert micro seconds to str
// convert micro seconds to str
(XXX: define as afunction)
length
=
snprintf
(
NULL
,
0
,
"%ld"
,
micro_seconds
);
length
=
snprintf
(
NULL
,
0
,
"%ld"
,
micro_seconds
);
char
*
micro_seconds_str
=
malloc
(
length
+
1
);
char
*
micro_seconds_str
=
malloc
(
length
+
1
);
snprintf
(
micro_seconds_str
,
length
+
1
,
"%ld"
,
micro_seconds
);
snprintf
(
micro_seconds_str
,
length
+
1
,
"%ld"
,
micro_seconds
);
// XXX: implement check for dead couplers using asynchronous callbacks from open62541
int
i
,
id
;
size_t
n
=
sizeof
(
HEART_BEAT_ID_LIST
)
/
sizeof
(
HEART_BEAT_ID_LIST
[
0
]);
for
(
int
i
=
0
;
i
<
n
;
i
++
)
{
id
=
HEART_BEAT_ID_LIST
[
i
];
if
(
id
>
0
)
{
// XXX: define as a function
length
=
snprintf
(
NULL
,
0
,
"%d"
,
id
);
char
*
id_str
=
malloc
(
length
+
1
);
snprintf
(
id_str
,
length
+
1
,
"%d"
,
id
);
char
*
last_seen_timestamp
=
getItem
(
SUBSCRIBER_DICT
,
id_str
);
UA_LOG_INFO
(
UA_Log_Stdout
,
UA_LOGCATEGORY_USERLAND
,
"
\t
check id_str=%s, last_seen=%s"
,
id_str
,
last_seen_timestamp
);
if
(
last_seen_timestamp
!=
NULL
){
// we do have timestamp for this coupler ID
int
last_seen_timestamp_int
=
atoi
(
last_seen_timestamp
);
int
timestamp_delta
=
micro_seconds
-
last_seen_timestamp_int
;
UA_LOG_INFO
(
UA_Log_Stdout
,
UA_LOGCATEGORY_USERLAND
,
"
\t\t
delta=%d"
,
timestamp_delta
);
}
}
}
// Add to our local linked list
// Add to our local linked list
addItem
(
&
SUBSCRIBER_DICT
,
coupler_id_str
,
micro_seconds_str
);
addItem
(
&
SUBSCRIBER_DICT
,
coupler_id_str
,
micro_seconds_str
);
UA_LOG_INFO
(
UA_Log_Stdout
,
UA_LOGCATEGORY_USERLAND
,
"ID = %d, microseconds=%ld"
,
coupler_id
,
micro_seconds
);
}
}
}
}
...
...
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