Exemple #1
0
 def wait_packet(self, clazz):
     """
     Wait for a specific packet type.
     """
     while True:
         pkt = PacketRegistry.decode(self.read())
         if isinstance(pkt, clazz):
             return pkt
Exemple #2
0
 def recover_connection(self,
                        access_address,
                        channel_map=None,
                        hop_interval=None):
     """
     Recover an existing connection.
     """
     self.write(
         RecoverCrcInitCommand(access_address, channel_map, hop_interval))
     self.wait_packet(RecoverResponse)
     while True:
         # get packet
         pkt = PacketRegistry.decode(self.read())
         yield pkt