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
Martin Manchev
osie
Commits
acd16fc5
Commit
acd16fc5
authored
Apr 22, 2022
by
Ivan Tyagov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Set default ID of coupler.
Handle CLI switches related to hear_beat / keep-alive functionality.
parent
f7eb4b77
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
2 deletions
+23
-2
coupler/opc-ua-server/keep_alive.h
coupler/opc-ua-server/keep_alive.h
+3
-0
coupler/opc-ua-server/server.c
coupler/opc-ua-server/server.c
+20
-2
No files found.
coupler/opc-ua-server/keep_alive.h
View file @
acd16fc5
...
@@ -8,6 +8,9 @@ static unsigned int HEART_BEATS = 0;
...
@@ -8,6 +8,9 @@ static unsigned int HEART_BEATS = 0;
// the heart beat interval$
// the heart beat interval$
static
int
HEART_BEAT_INTERVAL
=
250
;
static
int
HEART_BEAT_INTERVAL
=
250
;
// the list of couplers onto which we depend for properly running
static
char
*
HEART_BEAT_ID_LIST
[
20
];
// the interval for publishing messages
// the interval for publishing messages
const
int
PUBLISHING_INTERVAL
=
100
;
const
int
PUBLISHING_INTERVAL
=
100
;
...
...
coupler/opc-ua-server/server.c
View file @
acd16fc5
...
@@ -44,6 +44,7 @@ UA_Server *server;
...
@@ -44,6 +44,7 @@ UA_Server *server;
// 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
;
const
int
DEFAULT_ID
=
0
;
// CLI arguments handling
// CLI arguments handling
const
char
*
argp_program_version
=
"OSIE OPC-UA coupler 0.0.1"
;
const
char
*
argp_program_version
=
"OSIE OPC-UA coupler 0.0.1"
;
...
@@ -79,6 +80,9 @@ struct arguments
...
@@ -79,6 +80,9 @@ struct arguments
char
*
key
;
char
*
key
;
char
*
certificate
;
char
*
certificate
;
int
id
;
int
id
;
bool
heart_beat
;
int
heart_beat_interval
;
char
*
heart_beat_id_list
;
};
};
static
error_t
parse_opt
(
int
key
,
char
*
arg
,
struct
argp_state
*
state
)
static
error_t
parse_opt
(
int
key
,
char
*
arg
,
struct
argp_state
*
state
)
...
@@ -110,7 +114,16 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state)
...
@@ -110,7 +114,16 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state)
arguments
->
key
=
arg
;
arguments
->
key
=
arg
;
break
;
break
;
case
'i'
:
case
'i'
:
arguments
->
id
=
arg
?
atoi
(
arg
)
:
0
;
arguments
->
id
=
arg
?
atoi
(
arg
)
:
DEFAULT_ID
;
break
;
case
'b'
:
arguments
->
heart_beat
=
atoi
(
arg
);
break
;
case
't'
:
arguments
->
heart_beat_interval
=
atoi
(
arg
);
break
;
case
'l'
:
arguments
->
heart_beat_id_list
=
arg
;
break
;
break
;
case
ARGP_KEY_ARG
:
case
ARGP_KEY_ARG
:
return
0
;
return
0
;
...
@@ -158,6 +171,9 @@ int main(int argc, char **argv)
...
@@ -158,6 +171,9 @@ int main(int argc, char **argv)
printf
(
"Key=%s
\n
"
,
arguments
.
key
);
printf
(
"Key=%s
\n
"
,
arguments
.
key
);
printf
(
"Certificate=%s
\n
"
,
arguments
.
certificate
);
printf
(
"Certificate=%s
\n
"
,
arguments
.
certificate
);
printf
(
"ID=%d
\n
"
,
arguments
.
id
);
printf
(
"ID=%d
\n
"
,
arguments
.
id
);
printf
(
"Heart beat=%d
\n
"
,
arguments
.
heart_beat
);
printf
(
"Heart beat interval=%d ms
\n
"
,
arguments
.
heart_beat_interval
);
printf
(
"Heart beat ID list=%s
\n
"
,
arguments
.
heart_beat_id_list
);
// transfer to global variables (CLI input)
// transfer to global variables (CLI input)
COUPLER_ID
=
arguments
.
id
;
COUPLER_ID
=
arguments
.
id
;
...
@@ -239,7 +255,9 @@ int main(int argc, char **argv)
...
@@ -239,7 +255,9 @@ int main(int argc, char **argv)
#endif
#endif
// enable keep-alive
// enable keep-alive
if
(
arguments
.
heart_beat
)
{
enablePublishHeartBeat
(
server
,
config
);
enablePublishHeartBeat
(
server
,
config
);
}
// run server
// run server
UA_StatusCode
retval
=
UA_Server_run
(
server
,
&
running
);
UA_StatusCode
retval
=
UA_Server_run
(
server
,
&
running
);
...
...
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