Ejemplo n.º 1
0
 def process(self, message):
     logging.debug("Received from Kramer VP-88: " + SerialDevice.byteArrayToString(message).encode('hex_codec'))
     if (message[3] == 0x80 + self.machineNumber):
         if (message[0] == 0x41) or (message[0] == 0x45):  # Notification of video switch or response to query
             inp = message[1] - 0x80
             outp = message[2] - 0x80
             return {outp: inp}
     return {}
Ejemplo n.º 2
0
 def process(self, message):
     logging.debug("Received from Kramer 602: " + SerialDevice.byteArrayToString(message).encode('hex_codec'))
     if ((message[0] & 0x7) == (self.machineNumber - 1)):
         if message[1] == 0xff:  # Occasionally on startup we seem to receive a three-byte packet with the middle byte 0xFF. So ignore that middle.
             message[1] = self.parentDevice.port.read(1)
         if (message[1] & 0x20) == 0:  # Not just a "I switched successfully" message
             outp = (((message[1] & 0x1F) - 1) % 2) + 1
             inp = (((message[1] & 0x1F) - outp) / 2) + 1  # int(math.ceil((message[1] & 0x1F) + (2 / 2)) - 1)
             return {outp: inp}
         else:
             self.parentDevice.requestStatus()  # Request device to send current status so listener can intercept
     return {}
Ejemplo n.º 3
0
 def initialise(self):
     SerialDevice.initialise(self)
     self.port.flushInput()
     self.requestStatus()
Ejemplo n.º 4
0
 def sendInputToOutput(self, inChannel, outChannel):
     if outChannel > 2:
         logging.error("Output channel " + str(outChannel) + " does not exist on switcher " + self.deviceID)
     else:
         code = [0, 0x80 + (2 * inChannel) - (2 - outChannel)]
         self.sendCommand(SerialDevice.byteArrayToString(code))
Ejemplo n.º 5
0
 def execute(self, command):
     if isinstance(command, VISCACommand):
         return self.sendCommand(SerialDevice.byteArrayToString(command.getBytes(self.cameraID)))
Ejemplo n.º 6
0
 def sendVISCA(self, commandBytes):
     return self.sendCommand(SerialDevice.byteArrayToString([0x80 + self.cameraID] + commandBytes + [0xFF]))
Ejemplo n.º 7
0
 def requestStatus(self):
     for i in range(1, 9):
         self.sendCommand(SerialDevice.byteArrayToString([0x05, 0x80, 0x80 + i, 0x80 + self.machineNumber]))
Ejemplo n.º 8
0
 def sendInputToOutput(self, inChannel, outChannel):
     toSend = [0x01, 0x80 + inChannel, 0x80 + outChannel, 0x80 + self.machineNumber]
     return self.sendCommand(SerialDevice.byteArrayToString(toSend))
Ejemplo n.º 9
0
 def off(self, channel):
     result = self.sendCommand(SerialDevice.byteArrayToString([0x31 + 2 * channel]))
     time.sleep(self.sendDelay)
     return result
Ejemplo n.º 10
0
 def off(self, channel):
     return self.sendCommand(SerialDevice.byteArrayToString([0xFF, channel, 0x00]))
Ejemplo n.º 11
0
 def __init__(self, deviceID, serialDevice, **others):
     SerialDevice.__init__(self, deviceID, serialDevice, **others)