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 for power 3.
    # From the top, door is left, windows on the right
    # |        0  |
    # |
    # \           |
    #
    # /           |
    # |
    # |        1  |

    # Transmitters
    # ID | Type               | UUID     | Current Port | Angle
    #  0 | FTDI MTM-CM5000MSP | MFUD5PNI | /dev/ttyUSB0 | 315 @ 30C
    #  1 | FTDI MTM-CM5000MSP | MFUBFEOE | /dev/ttyUSB2 | 355 @ 65C
#
# The file is part of my bachelor thesis and is released under the 3-clause BSD
# license. See the file `LICENSE` for the full license governing this code.
# -----------------------------------------------------------------------------


import os
import sys

from box_manager import BoxManager
from script_manager import ScriptManager


if __name__ == "__main__":

    boxmanager = BoxManager()
    boxmanager.add_box(0, "/dev/ttyUSB1:telos", "/dev/ttyUSB4", -2)
    boxmanager.add_box(1, "/dev/ttyUSB2:telos", "/dev/ttyUSB3", -2)

    scriptmanager = ScriptManager(boxmanager)
    for arg in sys.argv[1:]:
        scriptmanager.add_script(arg)

    while True:
        scriptmanager.run()
        if scriptmanager.is_idle():
            # turn off all the heating elements
            for box in boxmanager.boxes:
                box.set_air_temperature(0)
            # force quit of all threads
            print "Terminating..."
#
# The file is part of my bachelor thesis and is released under the 3-clause BSD
# license. See the file `LICENSE` for the full license governing this code.
# -----------------------------------------------------------------------------


import os
import sys

from box_manager import BoxManager
from script_manager import ScriptManager


if __name__ == "__main__":

    boxmanager = BoxManager()

    # Current setup:
    # From the top, wall is left
    # |
    # |   4 5 6 7
    # |
    # |
    # |   0 1 2 3
    # |

    # Transmitters
    # ID | Type               | UUID     | Current Port
    #  0 | FTDI MTM-CM5000MSP | MFUBFEOE | /dev/ttyUSB6
    #  1 | FTDI MTM-CM5000MSP | MFUCIY5N | /dev/ttyUSB7
    #  2 | Moteiv tmote sky   | M4A9K6N6 | /dev/ttyUSB0
#
# The file is part of my bachelor thesis and is released under the 3-clause BSD
# license. See the file `LICENSE` for the full license governing this code.
# -----------------------------------------------------------------------------


import os
import sys

from box_manager import BoxManager
from script_manager import ScriptManager


if __name__ == "__main__":

    boxmanager = BoxManager()

    # Current setup:
    # From the top, wall is left
    # |
    # |   0
    # |
    # |
    # |   1
    # |

    # Transmitters
    # ID | Type               | UUID     | Current Port | Temperature
    #  0 | FTDI MTM-CM5000MSP | MFUD5PNI | /dev/ttyUSB2 | /dev/ttyUSB3
    #  1 | FTDI MTM-CM5000MSP | MFUD5QHV | /dev/ttyUSB4 | /dev/ttyUSB0
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
    #  0 | FTDI MTM-CM5000MSP | MFUD5PNI | /dev/ttyUSB0
    #  1 | FTDI MTM-CM5000MSP | MFUBFEOE | /dev/ttyUSB2