def send_command(self, p_device_obj, p_queue_entry): """ @param p_command: is the comand b"!1PWR01" Gthis will add the rest of the ethernet framework """ if p_device_obj == None: LOG.error('Sending a command to None will never work!') return # LOG.debug(PrettyFormatAny.form(p_device_obj, 'Device', 190)) l_cmd = self._build_comand(p_queue_entry, p_device_obj) l_cmd += b'\x1a\n\r' l_len = len(l_cmd) l_ret = b'ISCP' + \ convert.int_2_bigend(16, 4) + \ convert.int_2_bigend(l_len, 4) + \ b'\x01' + \ b'\x00\x00\x00' + \ l_cmd # LOG.debug('Command {}'.format(l_ret)) try: p_device_obj._Protocol.transport.write(l_ret) LOG.info('Send TCP command: {} to {}'.format( l_ret, p_device_obj.Name)) except AttributeError as e_err: LOG.error( "Tried to call send_command without a onkyo device configured.\n\tError:{}" .format(e_err))
def test_04_15_2(self): """ Convert a datetime to Minutes """ l_int = 15 l_bytes = convert.int_2_bigend(l_int, 2) self.assertEqual(l_bytes, b'\x00\x0f')
def test_06_987_2(self): """ Convert a datetime to Minutes """ l_int = 987 l_bytes = convert.int_2_bigend(l_int, 2) self.assertEqual(l_bytes, b'\x03\xdb')
def test_02_zero2(self): """ Convert a datetime to Minutes """ l_int = 0 l_bytes = convert.int_2_bigend(l_int, 2) self.assertEqual(l_bytes, b'\x00\x00')