Skip to content

Commit

Permalink
Force bind/connect logic
Browse files Browse the repository at this point in the history
  • Loading branch information
thomas-bc committed Mar 11, 2024
1 parent 314da3f commit 1aa36bb
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 16 deletions.
10 changes: 4 additions & 6 deletions src/fprime_gds/common/zmq_transport.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,11 +203,11 @@ class ZmqGround(GroundHandler):
to the display and processing layer(s). This effectively acts as the "FSW" side of that interface as it
frames/deframes packets heading to that layer.
Since there is likely only one communications client to the FSW users should call make_server() after construction
Since there is likely only one communications client to the FSW users should instantiate with server=True
to ensure that it binds to resources for the network. This is not forced in case of multiple FSW connections.
"""

def __init__(self, transport_url):
def __init__(self, transport_url, server=True):
"""Initialize this interface with the transport_url needed to connect
Args:
Expand All @@ -217,6 +217,8 @@ def __init__(self, transport_url):
self.zmq = ZmqWrapper()
self.transport_url = transport_url
self.timeout = 10
if server:
self.zmq.make_server()

def open(self):
"""Open this ground interface. Delegates to the connect method
Expand All @@ -242,10 +244,6 @@ def close(self):
self.zmq.disconnect_outgoing()
self.zmq.terminate()

def make_server(self):
"""Makes it into a server"""
self.zmq.make_server()

def receive_all(self):
"""Receive all available packets
Expand Down
6 changes: 0 additions & 6 deletions src/fprime_gds/executables/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -465,12 +465,6 @@ def get_arguments(self) -> Dict[Tuple[str, ...], Dict[str, Any]]:
"help": "Switch to using the ZMQ transportation layer",
"default": False,
},
("--zmq-server",): {
"dest": "zmq_server",
"action": "store_true",
"help": "Sets the ZMQ connection to be a server. Default: false (client)",
"default": False,
},
("--zmq-transport",): {
"dest": "zmq_transport",
"nargs": 2,
Expand Down
3 changes: 0 additions & 3 deletions src/fprime_gds/executables/comm.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,6 @@ def main():
sys.exit(-1)
elif args.zmq:
ground = fprime_gds.common.zmq_transport.ZmqGround(args.zmq_transport)
# Check for need to make this a server
if args.zmq_server:
ground.make_server()
else:
ground = fprime_gds.common.communication.ground.TCPGround(
args.tts_addr, args.tts_port
Expand Down
2 changes: 1 addition & 1 deletion src/fprime_gds/executables/run_deployment.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ def main():
parsed_args = parse_args()
launchers = []

# Launch a gui, if specified
# Launch middleware layer if not using ZMQ
if not parsed_args.zmq:
launchers.append(launch_tts)

Expand Down

0 comments on commit 1aa36bb

Please sign in to comment.