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
......@@ -44,6 +44,7 @@ def setup_command_argument_parser():
:return: ArgumentParser with the station_test_watchdog options
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('expected_filename', help="Considers events only on file with a name"
"that matches the specified regular expression")
......@@ -74,7 +75,7 @@ def femto(args):
settings = get_settings_from_command_arguments(args)
server = setup_server()
server = setup_server(settings.url)
# Start the server.
......@@ -28,11 +28,14 @@ def datapoint_change_callback(idx, current_event: dict):
return True
def setup_server():
def setup_server(url: str):
global monitor_points, idx
# setup our server
server = Server()
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)")
# setup our own namespace, not really necessary but should as spec
uri = ""
......@@ -100,4 +103,4 @@ def setup_server():
monitor_points[mp_name]["spectrum"] = {"object": obj, "variable": var}
return server
\ No newline at end of file
return server
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment