コード例 #1
0
 async def send_command(self, command_name):
     self.writer.write(encode_command(command_name))
     await self.writer.drain()
コード例 #2
0
 def test_encode_mute_toggle(self):
     self.assertEqual(encode_command('MUTE_TOGGLE'),
                      b'\xfe\x03\xa3\x10\x1e\xd4')
コード例 #3
0
 def test_encode_power_toggle(self):
     self.assertEqual(encode_command('POWER_TOGGLE'),
                      b'\xfe\x03\xa3\x10\x0a\xc0')
コード例 #4
0
 def test_make_invalid_command(self):
     with self.assertRaises(KeyError):
         encode_command('INVALID_COMMAND')
コード例 #5
0
 def test_meta_encoding_of_start_byte(self):
     self.assertEqual(encode_command('ZONE_3_VOLUME_36'),
                      b'\xfe\x03\xa3\x33\x24\xfd\x00')
コード例 #6
0
 def test_meta_encoding_of_escape_byte(self):
     self.assertEqual(encode_command('VOLUME_40'),
                      b'\xfe\x03\xa3\x30\x28\xfd\x01')