コード例 #1
0
ファイル: link.py プロジェクト: yeyintminthuhtut/btlejack
 def wait_packet(self, clazz):
     """
     Wait for a specific packet type.
     """
     while True:
         pkt = PacketRegistry.decode(self.read())
         if isinstance(pkt, clazz):
             return pkt
コード例 #2
0
ファイル: link.py プロジェクト: yeyintminthuhtut/btlejack
 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