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
502ab54b
Commit
502ab54b
authored
Apr 20, 2022
by
Ivan Tyagov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add heart_beat callback. Cleanup tabulations.
parent
0de27517
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
24 deletions
+42
-24
coupler/opc-ua-server/server.c
coupler/opc-ua-server/server.c
+42
-24
No files found.
coupler/opc-ua-server/server.c
View file @
502ab54b
...
@@ -37,6 +37,11 @@
...
@@ -37,6 +37,11 @@
// global Id of coupler
// global Id of coupler
static
int
COUPLER_ID
=
0
;
static
int
COUPLER_ID
=
0
;
// global HEART BEATs of coupler
static
int
HEART_BEATS
=
0
;
// the heart beat interval
static
int
HEART_BEAT_INTERVAL
=
250
;
// The default port of OPC-UA server
// The default port of OPC-UA server
const
int
DEFAULT_OPC_UA_PORT
=
4840
;
const
int
DEFAULT_OPC_UA_PORT
=
4840
;
const
int
DEFAULT_MODE
=
0
;
const
int
DEFAULT_MODE
=
0
;
...
@@ -122,6 +127,14 @@ static void stopHandler(int sign)
...
@@ -122,6 +127,14 @@ static void stopHandler(int sign)
running
=
false
;
running
=
false
;
}
}
void
callbackTicHeartBeat
()
{
/* Increase periodically heart beats of the server */
HEART_BEATS
+=
1
;
UA_LOG_INFO
(
UA_Log_Stdout
,
UA_LOGCATEGORY_USERLAND
,
"heart_beat %d"
,
HEART_BEATS
);
// XXX: set OPC ua's heat_beat value
}
int
main
(
int
argc
,
char
**
argv
)
int
main
(
int
argc
,
char
**
argv
)
{
{
int
i
;
int
i
;
...
@@ -180,7 +193,7 @@ int main(int argc, char **argv)
...
@@ -180,7 +193,7 @@ int main(int argc, char **argv)
UA_ServerConfig
*
config
=
UA_Server_getConfig
(
server
);
UA_ServerConfig
*
config
=
UA_Server_getConfig
(
server
);
config
->
verifyRequestTimestamp
=
UA_RULEHANDLING_ACCEPT
;
config
->
verifyRequestTimestamp
=
UA_RULEHANDLING_ACCEPT
;
// add variables representing physical relar
ys
/ inputs, etc
// add variables representing physical relar
ay
/ inputs, etc
addVariable
(
server
);
addVariable
(
server
);
addValueCallbackToCurrentTimeVariable
(
server
);
addValueCallbackToCurrentTimeVariable
(
server
);
...
@@ -229,8 +242,13 @@ int main(int argc, char **argv)
...
@@ -229,8 +242,13 @@ int main(int argc, char **argv)
#endif
#endif
// enable keep-alive
// enable keep-alive
UA_Int32
defaultInt32
=
0
;
UA_Int32
couplerID
=
COUPLER_ID
;
// add a callback which will increment heart beat tics
UA_UInt64
callbackId
=
1
;
UA_Server_addRepeatedCallback
(
server
,
callbackTicHeartBeat
,
NULL
,
HEART_BEAT_INTERVAL
,
&
callbackId
);
UA_Int32
defaultInt32
=
0
;
//XXX: use unsigned int
UA_Int32
couplerID
=
COUPLER_ID
;
//XXX: use unsigned int
const
PublishedVariable
publishedVariableArray
[]
=
{
const
PublishedVariable
publishedVariableArray
[]
=
{
// representing time in millis since start of process
// representing time in millis since start of process
{
{
...
...
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