Skip to content
Snippets Groups Projects
Commit e652053e authored by Thomas Jürges's avatar Thomas Jürges
Browse files

Add command line parameter for server name and port

parent c9234a9c
No related branches found
No related tags found
No related merge requests found
...@@ -44,6 +44,7 @@ def setup_command_argument_parser(): ...@@ -44,6 +44,7 @@ def setup_command_argument_parser():
:return: ArgumentParser with the station_test_watchdog options :return: ArgumentParser with the station_test_watchdog options
""" """
parser = ArgumentParser(description="Femto watchdog listens to file write events") parser = ArgumentParser(description="Femto watchdog listens to file write events")
parser.add_argument('url', help="OPC UA server name including port. Example: \"localhost:55555\"", default="localhost:55555")
parser.add_argument('path', help="file system path to monitor for new file events") parser.add_argument('path', help="file system path to monitor for new file events")
parser.add_argument('expected_filename', help="Considers events only on file with a name" parser.add_argument('expected_filename', help="Considers events only on file with a name"
"that matches the specified regular expression") "that matches the specified regular expression")
...@@ -74,7 +75,7 @@ def femto(args): ...@@ -74,7 +75,7 @@ def femto(args):
settings = get_settings_from_command_arguments(args) settings = get_settings_from_command_arguments(args)
apply_global_settings(settings) apply_global_settings(settings)
server = setup_server() server = setup_server(settings.url)
try: try:
# Start the server. # Start the server.
......
...@@ -28,11 +28,14 @@ def datapoint_change_callback(idx, current_event: dict): ...@@ -28,11 +28,14 @@ def datapoint_change_callback(idx, current_event: dict):
return True return True
def setup_server(): def setup_server(url: str):
global monitor_points, idx global monitor_points, idx
# setup our server # setup our server
server = Server() server = Server()
server.set_endpoint("opc.tcp://localhost:55555/LOFAR2.0/FEMTO") server_url = "localhost:55555"
if url is not None:
server_url = url
server.set_endpoint("opc.tcp://" + server_url + "/LOFAR2.0/FEMTO")
server.set_server_name("LOFAR2.0 Faulty Element Measurement To Opc UA (FEMTO)") server.set_server_name("LOFAR2.0 Faulty Element Measurement To Opc UA (FEMTO)")
# setup our own namespace, not really necessary but should as spec # setup our own namespace, not really necessary but should as spec
uri = "http://lofar.eu" uri = "http://lofar.eu"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment