示例#1
0
    def testInline3808(self):

        port = MockSerialPort()

        inline = Inline3808("Test", port)

        inline.initialise()

        self.assertEqual(list("[CNF290000]"), port.bytes)

        port.clear()

        inline.sendInputToOutput(3, 2)
        self.assertEqual(list("[PT1O02I03]"), port.bytes)
示例#2
0
    def testKramer602(self):
        port = MockSerialPort()
        k602 = Kramer602("Test", port)

        k602.initialise()
        self.assertBytesEqual([0x0, 0xA1], port.bytes)
        port.clear()

        k602.sendInputToOutput(2, 1)
        self.assertBytesEqual([0x0, 0x83], port.bytes)

        port.clear()

        k602.sendInputToOutput(1, 2)
        self.assertBytesEqual([0x0, 0x82], port.bytes)
示例#3
0
    def testKramerVP88(self):
        port = MockSerialPort()
        vp88 = KramerVP88("Test", port)

        vp88.initialise()
        self.assertBytesEqual([0x05, 0x80, 0x81, 0x81,
                               0x05, 0x80, 0x82, 0x81,
                               0x05, 0x80, 0x83, 0x81,
                               0x05, 0x80, 0x84, 0x81,
                               0x05, 0x80, 0x85, 0x81,
                               0x05, 0x80, 0x86, 0x81,
                               0x05, 0x80, 0x87, 0x81,
                               0x05, 0x80, 0x88, 0x81], port.bytes)
        port.clear()

        vp88.sendInputToOutput(2, 8)
        self.assertBytesEqual([0x01, 0x82, 0x88, 0x81], port.bytes)
示例#4
0
    def testKMtronicSerialRelayCard(self):
        port = MockSerialPort()
        card = KMtronicSerialRelayCard("Test", port)

        card.initialise()
        self.assertEqual([], port.bytes)

        card.on(1)
        self.assertEqual(['\xFF', '\x01', '\x01'], port.bytes)
        port.clear()

        channel = card.createDevice("channel", 2)
        channel.on()
        self.assertEqual(['\xFF', '\x02', '\x01'], port.bytes)
        port.clear()
        channel.off()
        self.assertEqual(['\xFF', '\x02', '\x00'], port.bytes)
示例#5
0
    def testUnisonDevice(self):
        port = MockSerialPort()
        unison = UnisonDevice("Test", port)

        activate = unison.activate("Test.Test.Preset1")
        self.assertBytesEqual([0xEE, 25, 0, 0, 0x40,
                               ord('T'), ord('e'), ord('s'), ord('t'), ord('.'),
                               ord('T'), ord('e'), ord('s'), ord('t'), ord('.'),
                               ord('P'), ord('r'), ord('e'), ord('s'), ord('e'), ord('t'), ord('1'), ord('.'),
                               ord('A'), ord('C'), ord('T'), ord('I'),
                               0, 0], port.bytes)
        self.assertEquals(29, activate)

        port.clear()

        deact = unison.deactivate("Test.Test.Preset2")
        self.assertBytesEqual([0xEE, 25, 0, 0, 0x40,
                               ord('T'), ord('e'), ord('s'), ord('t'), ord('.'),
                               ord('T'), ord('e'), ord('s'), ord('t'), ord('.'),
                               ord('P'), ord('r'), ord('e'), ord('s'), ord('e'), ord('t'), ord('2'), ord('.'),
                               ord('D'), ord('A'), ord('C'), ord('T'),
                               0, 0], port.bytes)
        self.assertEquals(29, deact)
示例#6
0
    def testKramerVP703(self):
        port = MockSerialPort()
        vp703 = KramerVP703("Test", port)

        vp703.initialise()
        self.assertEqual(list(b"Overscan = 1\r\n"), port.bytes)
        port.clear()

        vp703.overscanOff()
        self.assertEqual(list(b"Overscan = 0\r\n"), port.bytes)
        port.clear()

        vp703.freeze()
        self.assertEqual(list(b"Image Freeze = 1\r\n"), port.bytes)
        port.clear()

        vp703.unfreeze()
        self.assertEqual(list(b"Image Freeze = 0\r\n"), port.bytes)
示例#7
0
    def testJBSerialRelayCard(self):
        port = MockSerialPort()
        card = JBSerialRelayCard("Test", port)

        card.initialise()
        self.assertEqual([], port.bytes)
        port.clear()

        card.on(1)
        self.assertEqual(['\x32'], port.bytes)
        port.clear()

        channel = card.createDevice("channel", 2)
        channel.on()
        self.assertEqual(['\x34'], port.bytes)
        port.clear()
        channel.off()
        self.assertEqual(['\x35'], port.bytes)
示例#8
0
    def testCoriogenEclipse(self):
        port = MockSerialPort()
        ce = CoriogenEclipse("Test", port)

        ce.initialise()
        self.assertEqual([], port.bytes)

        ce.fadeIn()
        self.assertEqual(list(b"Fade = 1\r\n"), port.bytes)
        port.clear()

        ce.fadeIn()
        self.assertEqual(list(b"Fade = 1\r\n"), port.bytes)
        port.clear()

        ce.fadeOut()
        self.assertEqual(list(b"Fade = 0\r\n"), port.bytes)
        port.clear()

        ce.freeze()
        self.assertEqual(list(b"Freeze = On\r\n"), port.bytes)
        port.clear()

        ce.unfreeze()
        self.assertEqual(list(b"Freeze = Off\r\n"), port.bytes)
        port.clear()

        ce.overlayOn()
        self.assertEqual(list(b"Mode = 3\r\n"), port.bytes)
        port.clear()

        ce.overlayOff()
        self.assertEqual(list(b"Mode = 0\r\n"), port.bytes)