@@ -44,6 +44,8 @@ def __init__(self):
4444 self .client_socket = None
4545 self .logger = None
4646 self .dictionary_path = None
47+ self .up_store = None
48+ self .down_store = None
4749
4850 self .__dictionaries = dictionaries .Dictionaries ()
4951 self .__coders = encoding .EncodingDecoding ()
@@ -52,19 +54,31 @@ def __init__(self):
5254 self .__transport_type = ThreadedTCPSocketClient
5355
5456 def setup (
55- self , config , dictionary , down_store , logging_prefix = None , packet_spec = None
57+ self , config , dictionary , file_store , logging_prefix = None , packet_spec = None
5658 ):
5759 """
5860 Setup the standard pipeline for moving data from the middleware layer through the GDS layers using the standard
5961 patterns. This allows just registering the consumers, and invoking 'setup' all other of the GDS support layer.
6062
6163 :param config: config object used when constructing the pipeline.
6264 :param dictionary: dictionary path. Used to setup loading of dictionaries.
63- :param down_store: downlink storage directory
65+ :param file_store: uplink/ downlink storage directory
6466 :param logging_prefix: logging prefix. Defaults to not logging at all.
6567 :param packet_spec: location of packetized telemetry XML specification.
6668 """
67- assert dictionary is not None and Path (dictionary ).is_file (), f"Dictionary { dictionary } does not exist"
69+ assert (
70+ dictionary is not None and Path (dictionary ).is_file ()
71+ ), f"Dictionary { dictionary } does not exist"
72+ # File storage configuration for uplink and downlink
73+ self .up_store = Path (file_store ) / "fprime-uplink"
74+ self .down_store = Path (file_store ) / "fprime-downlink"
75+ try :
76+ self .down_store .mkdir (parents = True , exist_ok = True )
77+ self .up_store .mkdir (parents = True , exist_ok = True )
78+ except PermissionError :
79+ raise PermissionError (
80+ f"{ file_store } is not writable. Fix permissions or change storage directory with --file-storage-directory."
81+ )
6882 self .dictionary_path = Path (dictionary )
6983 # Loads the distributor and client socket
7084 self .distributor = fprime_gds .common .distributor .distributor .Distributor (config )
@@ -76,7 +90,7 @@ def setup(
7690 )
7791 self .histories .setup_histories (self .coders )
7892 self .files .setup_file_handling (
79- down_store ,
93+ self . down_store ,
8094 self .coders .file_encoder ,
8195 self .coders .file_decoder ,
8296 self .distributor ,
@@ -152,7 +166,11 @@ def connect(
152166 outgoing_tag: this pipeline will produce data for supplied tag (FSW, GUI). Default: FSW
153167 """
154168 # Backwards compatibility with the old method .connect(host, port)
155- if isinstance (incoming_tag , int ) and ":" not in connection_uri and outgoing_tag == RoutingTag .FSW :
169+ if (
170+ isinstance (incoming_tag , int )
171+ and ":" not in connection_uri
172+ and outgoing_tag == RoutingTag .FSW
173+ ):
156174 connection_uri = f"{ connection_uri } :{ incoming_tag } "
157175 incoming_tag = RoutingTag .GUI
158176 self .client_socket .connect (connection_uri , incoming_tag , outgoing_tag )
0 commit comments