Skip to content

Commit

Permalink
Issue #105 - Add check for log and telem stream name attributes
Browse files Browse the repository at this point in the history
When a message is received the GUI now checks to see if the topic
is within its log and telem stream name attributes, and if so,
processes the message accordingly. If these attributes do not exist
or if the received topic is in not in them, the GUI checks if the
topic contains either "telem_stream" or "log_stream" and processes
accordingly. If none of these conditions are met, an error is
thrown that a message with an unrecognized topic has been received.
  • Loading branch information
aywaldron committed Apr 17, 2019
1 parent 79b7288 commit d5def6b
Show file tree
Hide file tree
Showing 3 changed files with 61,239 additions and 124 deletions.
32 changes: 27 additions & 5 deletions ait/gui/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,11 +177,33 @@ def process(self, input_data, topic=None):
# msg is going to be a tuple from the ait_packet_handler
# (packet_uid, packet)
# need to handle log/telem messages differently based on topic
# Sessions.addMessage vs Sessions.addTelemetry
if topic == "telem_stream":
self.process_telem_msg(input_data)
elif topic == "log_stream":
self.process_log_msg(input_data)
# Look for topic in list of stream log and telem stream names first.
# If those lists don't exist or topic not in them, try matching text
# in topic name.

processed = False

if hasattr(self, 'log_stream_names'):
if topic in self.log_stream_names:
self.process_log_msg(input_data)
processed = True

if hasattr(self, 'telem_stream_names'):
if topic in self.telem_stream_names:
self.process_telem_msg(input_data)
processed = True

if not processed:
if "telem_stream" in topic:
self.process_telem_msg(input_data)
processed = True

elif topic == "log_stream":
self.process_log_msg(input_data)
processed = True

if not processed:
raise ValueError('Topic of received message not recognized as telem or log stream.')

def process_telem_msg(self, msg):
msg = pickle.loads(msg)
Expand Down
8,793 changes: 8,790 additions & 3 deletions ait/gui/static/build/ait.bundle.css

Large diffs are not rendered by default.

Loading

0 comments on commit d5def6b

Please sign in to comment.