diff --git a/src/urh/signalprocessing/Participant.py b/src/urh/signalprocessing/Participant.py index a8b045fe..00b942f4 100644 --- a/src/urh/signalprocessing/Participant.py +++ b/src/urh/signalprocessing/Participant.py @@ -61,7 +61,7 @@ class Participant(object): root.set("color_index", str(self.color_index)) root.set("id", str(self.__id)) root.set("relative_rssi", str(self.relative_rssi)) - root.set("simulate", str(int(self.simulate))) + root.set("simulate", str(int(bool(self.simulate)))) return root diff --git a/src/urh/simulator/SimulatorMessage.py b/src/urh/simulator/SimulatorMessage.py index 632c10b6..3b056492 100644 --- a/src/urh/simulator/SimulatorMessage.py +++ b/src/urh/simulator/SimulatorMessage.py @@ -10,9 +10,12 @@ from urh.util.Formatter import Formatter class SimulatorMessage(Message, SimulatorItem): def __init__(self, destination: Participant, plain_bits, - pause: int, message_type: MessageType, decoder=None, source=None): + pause: int, message_type: MessageType, decoder=None, source=None, timestamp=None): Message.__init__(self, plain_bits, pause, message_type, decoder=decoder, participant=source) SimulatorItem.__init__(self) + if timestamp is not None: + self.timestamp = timestamp + self.destination = destination self.send_recv_messages = [] self.repeat = 1 @@ -81,4 +84,5 @@ class SimulatorMessage(Message, SimulatorItem): decoders=decoders, message_types=message_types) destination = Participant.find_matching(tag.get("destination_id", ""), participants) - return SimulatorMessage(destination, msg.plain_bits, msg.pause, msg.message_type, msg.decoder, msg.participant) + return SimulatorMessage(destination, msg.plain_bits, msg.pause, msg.message_type, msg.decoder, msg.participant, + timestamp=msg.timestamp) diff --git a/src/urh/ui/SimulatorScene.py b/src/urh/ui/SimulatorScene.py index 6c4e996c..ccae5074 100644 --- a/src/urh/ui/SimulatorScene.py +++ b/src/urh/ui/SimulatorScene.py @@ -484,13 +484,14 @@ class SimulatorScene(QGraphicsScene): for protocol in protocols_to_add: for msg in protocol.messages: source, destination = self.detect_source_destination(msg) - - messages.append(self.create_message(destination=destination, + simulator_msg = self.create_message(destination=destination, plain_bits=copy.copy(msg.decoded_bits), pause=0, message_type=msg.message_type, decoder=msg.decoder, - source=source)) + source=source) + simulator_msg.timestamp = msg.timestamp + messages.append(simulator_msg) self.simulator_config.add_items(messages, pos, parent) diff --git a/src/urh/util/ProjectManager.py b/src/urh/util/ProjectManager.py index 209cefe7..1092c54e 100644 --- a/src/urh/util/ProjectManager.py +++ b/src/urh/util/ProjectManager.py @@ -153,7 +153,6 @@ class ProjectManager(QObject): self.decodings = decodings if decodings else fallback - @staticmethod def read_device_conf_dict(tag: ET.Element, target_dict): if tag is None: @@ -161,7 +160,10 @@ class ProjectManager(QObject): for dev_tag in tag: try: - value = float(dev_tag.text) + try: + value = int(dev_tag.text) + except ValueError: + value = float(dev_tag.text) except ValueError: value = dev_tag.text target_dict[dev_tag.tag] = value