@@ -33,6 +33,8 @@ def __init__(self, com_port, log_stream: util.logger.LoggerStream) -> None:
3333
3434 self .__external_commands = []
3535
36+ self .__ack_queue = []
37+
3638
3739 def process_packet (self , packet_json ):
3840 """Append metadata to a packet to conform to GSS v1.1 packet structure"""
@@ -71,6 +73,11 @@ def __read_comport(self):
7173 else :
7274 return []
7375
76+ def get_ack_queue (self ):
77+ q_copy = copy .deepcopy (self .__ack_queue )
78+ self .__ack_queue .clear ()
79+ return q_copy
80+
7481 def add_combiner (self , combiner ):
7582 """Add a combiner data sink for this telemetry thread"""
7683 self .__combiners .append (combiner )
@@ -131,18 +138,23 @@ def run(self) -> None:
131138
132139 if packet_in ['type' ] == "command_success" :
133140 self .__log .console_log ("RX: Command good" )
141+ self .__ack_queue .append ([self .__combiners [0 ].get_mqtt_control_topic (), packet_in ])
134142 continue
135143
144+ # This is jank but idc
136145 if packet_in ['type' ] == "bad_command" :
137146 self .__log .console_log ("RX: Command bad" )
147+ self .__ack_queue .append ([self .__combiners [0 ].get_mqtt_control_topic (), packet_in ])
138148 continue
139149
140150 if packet_in ['type' ] == "command_acknowledge" :
141151 self .__log .console_log ("RX: Command ACK" )
152+ self .__ack_queue .append ([self .__combiners [0 ].get_mqtt_control_topic (), packet_in ])
142153 continue
143154
144155 if packet_in ['type' ] == "command_sent" :
145156 self .__log .console_log ("RX: Command send confirmed" )
157+ self .__ack_queue .append ([self .__combiners [0 ].get_mqtt_control_topic (), packet_in ])
146158 continue
147159
148160 # print(packet_in)
@@ -292,6 +304,11 @@ def publish(self, packet_list, topic) -> None:
292304 self .__log .fail ()
293305 self .__log .waiting_delta (- 1 )
294306
307+ def send_raw (self , topic , data ) -> None :
308+ """Publish a set of packets to a `Data` topic"""
309+ self .__mqttclient .publish (topic , json .dumps (data ).encode ("utf-8" ))
310+ self .__log .console_log (f"Published" )
311+
295312 def run (self ) -> None :
296313 self .__mqttclient .loop_start ()
297314
0 commit comments