Example #1
0
    def format_for_log(self, properties=None):
        filtered_keys = ['mode', 'id', 'timeout', 'temperature', 'seqnum', 'length', 'data', 'lqi', 'rssi', 'crc', 'timestamp']
        filtered_values = {key: value for key, value in self.properties.items() if key in self.properties}
        if 'data' in filtered_values:
            filtered_values['data'] = map(int, filtered_values['data'])
        if properties:
            if properties['type'] == 'reed-solomon':
                coder = "rs,{},{}".format(properties['coder'].n, properties['coder'].k)
                filtered_values.update({'coder': coder})

        log_string = MessageFormatter.format_dictionary(filtered_values)

        return "timestamp={}\t{}\n".format(str(self.properties['timestamp'])[:-3].replace(".", ","), log_string)

import os
import sys
import time

from box_manager import BoxManager
from script_manager import ScriptManager
from visualizer import MessageVisualizer
from formatter import MessageFormatter


if __name__ == "__main__":

    visualizer = MessageVisualizer(2, 200)
    MessageFormatter.add_visualizer(visualizer)

    boxmanager = BoxManager()

    # Current setup:
    # From the top, door is left, windows on the right
    # |        0  |
    # |
    # \           |
    #
    # /           |
    # |
    # |        1  |

    # Transmitters
    # ID | Type               | UUID     | Current Port