def test_power_on(packets, crypto): bin_name = 'poweron_request' msg = factory.power_on(liveid='FD00112233FFEE66') packed = _pack(msg, crypto) assert msg.header.pkt_type == enum.PacketType.PowerOnRequest assert msg.header.version == 0 assert msg.unprotected_payload.liveid == 'FD00112233FFEE66' assert len(packed) == len(packets[bin_name]) assert packed == packets[bin_name]
def power_on(self, liveid, addr=None, tries=2): """ Power on console. Args: liveid (str): Live ID of console addr (str): (optional) IP address of console tries (int): PowerOn attempts Returns: None """ msg = factory.power_on(liveid) for i in range(tries): self.send_message(msg, addr=BROADCAST) self.send_message(msg, addr=MULTICAST) if addr: self.send_message(msg, addr=addr) gevent.sleep(0.1)
async def power_on(self, liveid: str, addr: Optional[str] = None, tries: int = 2) -> None: """ Power on console. Args: liveid: Live ID of console addr: IP address of console tries: PowerOn attempts Returns: None """ msg = factory.power_on(liveid) for i in range(tries): await self.send_message(msg, addr=BROADCAST) await self.send_message(msg, addr=MULTICAST) if addr: await self.send_message(msg, addr=addr) await asyncio.sleep(0.1)