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
1
Merge Requests
1
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
72a1342f
Commit
72a1342f
authored
Oct 05, 2022
by
Ivan Tyagov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
WIP
parent
43d22d04
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
6 deletions
+7
-6
coupler/opc-ua-server/build.sh
coupler/opc-ua-server/build.sh
+1
-1
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
+5
-4
No files found.
coupler/opc-ua-server/build.sh
View file @
72a1342f
#!/bin/bash
#!/bin/bash
OPEN62541_SR
=
/
opt/slapgrid/6c567f8750e604c805e3a25adbbd0e44/parts/open62541/
OPEN62541_SR
=
/
usr/local/lib
rm
-f
server
rm
-f
server
# build OPC UA server which publishes msgs
# build OPC UA server which publishes msgs
...
...
coupler/opc-ua-server/keep_alive.h
View file @
72a1342f
...
@@ -6,7 +6,7 @@ char *NETWORK_ADDRESS_URL_DATA_TYPE = "opc.udp://224.0.0.22:4840/";
...
@@ -6,7 +6,7 @@ char *NETWORK_ADDRESS_URL_DATA_TYPE = "opc.udp://224.0.0.22:4840/";
static
unsigned
int
HEART_BEATS
=
0
;
static
unsigned
int
HEART_BEATS
=
0
;
// the heart beat interval$$
// the heart beat interval$$
const
int
DEFAULT_HEART_BEAT_INTERVAL
=
2
50
;
const
int
DEFAULT_HEART_BEAT_INTERVAL
=
50
;
static
int
HEART_BEAT_INTERVAL
=
DEFAULT_HEART_BEAT_INTERVAL
;
static
int
HEART_BEAT_INTERVAL
=
DEFAULT_HEART_BEAT_INTERVAL
;
// the timeout in millis after which a coupler is considered down
// the timeout in millis after which a coupler is considered down
...
...
coupler/opc-ua-server/keep_alive_subscriber.h
View file @
72a1342f
...
@@ -32,9 +32,9 @@ static void dataChangeNotificationCallback(UA_Server *server, UA_UInt32 monitore
...
@@ -32,9 +32,9 @@ 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
)
{
//
UA_LOG_INFO(UA_Log_Stdout, \
UA_LOG_INFO
(
UA_Log_Stdout
,
\
//
UA_LOGCATEGORY_USERLAND, \
UA_LOGCATEGORY_USERLAND
,
\
//
"HEART BEAT: %d", coupler_id);
"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
);
...
@@ -51,7 +51,7 @@ static void dataChangeNotificationCallback(UA_Server *server, UA_UInt32 monitore
...
@@ -51,7 +51,7 @@ static void dataChangeNotificationCallback(UA_Server *server, UA_UInt32 monitore
// filter out heart_beat from Data Set
// filter out heart_beat from Data Set
if
(
UA_Variant_hasScalarType
(
&
var
->
value
,
&
UA_TYPES
[
UA_TYPES_FLOAT
]))
{
if
(
UA_Variant_hasScalarType
(
&
var
->
value
,
&
UA_TYPES
[
UA_TYPES_FLOAT
]))
{
float
heart_beat
=
*
(
UA_Float
*
)
var
->
value
.
data
;
float
heart_beat
=
*
(
UA_Float
*
)
var
->
value
.
data
;
//
UA_LOG_INFO(UA_Log_Stdout, UA_LOGCATEGORY_USERLAND, "heart_beat = %f", heart_beat);
UA_LOG_INFO
(
UA_Log_Stdout
,
UA_LOGCATEGORY_USERLAND
,
"heart_beat = %f"
,
heart_beat
);
}
}
}
}
...
@@ -198,6 +198,7 @@ static UA_StatusCode addSubscribedVariables(UA_Server *server, UA_NodeId dataSet
...
@@ -198,6 +198,7 @@ static UA_StatusCode addSubscribedVariables(UA_Server *server, UA_NodeId dataSet
/*monitor variable*/
/*monitor variable*/
if
(
ENABLE_HEART_BEAT_CHECK
)
{
if
(
ENABLE_HEART_BEAT_CHECK
)
{
UA_MonitoredItemCreateRequest
monRequest
=
UA_MonitoredItemCreateRequest_default
(
newNode
);
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_SOURCE
,
monRequest
,
NULL
,
dataChangeNotificationCallback
);
monRequest
,
NULL
,
dataChangeNotificationCallback
);
}
}
...
...
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