def async_send_command(self, command): if isinstance(command, str): command = CecCommand(command) _LOGGER.debug("<< %s", command) if command.src is None or command.src == 0xf: command.src = self._adapter.get_logical_address() self._loop.call_soon_threadsafe(self._adapter.transmit, command)
def test_src(): cc = CecCommand("1f:90:02") assert cc.src == 0x1 cc = CecCommand("52:90:02") assert cc.src == 0x5 cc = CecCommand(0x8F, 0x5, 0x3) assert cc.src == 0x3 cc = CecCommand("52:90:02") cc.src = 0x4 assert ("%s" % cc) == "42:90:02" cc = CecCommand(0x8F, 0x5, 0x3, raw="78:a5:89:45") assert cc.src == 0x7
def test_src(self): cc = CecCommand("1f:90:02") self.assertEqual(cc.src, 0x1) cc = CecCommand("52:90:02") self.assertEqual(cc.src, 0x5) cc = CecCommand(0x8f, 0x5, 0x3) self.assertEqual(cc.src, 0x3) cc = CecCommand("52:90:02") cc.src = 0x4 self.assertEqual(("%s" % cc), "42:90:02") cc = CecCommand(0x8f, 0x5, 0x3, raw="78:a5:89:45") self.assertEqual(cc.src, 0x7)