Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to accept comms with FSW running TCP server #137

Merged
merged 2 commits into from
Aug 14, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions src/fprime_gds/common/communication/adapters/ip.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,17 @@ class IpAdapter(fprime_gds.common.communication.adapters.base.BaseAdapter):
KEEPALIVE_DATA = b"sitting well"
MAXIMUM_DATA_SIZE = 4096

def __init__(self, address, port):
def __init__(self, address, port, server=True):
"""
Initialize this adapter by creating a handler for UDP and TCP. A thread for the KEEPALIVE application packets
will be created, if the interval is not none.
will be created, if the interval is not none. Handlers are servers unless server=False.
"""
self.address = address
self.port = port
self.stop = False
self.keepalive = None
self.tcp = TcpHandler(address, port)
self.udp = UdpHandler(address, port)
self.tcp = TcpHandler(address, port, server=server)
self.udp = UdpHandler(address, port, server=server)
self.thtcp = None
self.thudp = None
self.data_chunks = queue.Queue()
Expand Down Expand Up @@ -171,6 +171,14 @@ def get_arguments(cls):
"default": 50000,
"help": "Port of the IP adapter server. Default: %(default)s",
},
("--ip-client",): {
# dest is "server" since it is handled in BaseAdapter.construct_adapter and passed with the same
# name to the IpAdapter constructor. Default to server=True, meaning IpAdapter is the TCP server
"dest": "server",
"action": "store_false",
"default": True,
"help": "Run the IP adapter as the client (connects to FSW running TcpServer)",
},
}

@classmethod
Expand Down
Loading