Exemple #1
0
 def recv(self, timeout=8000):
     if self.available() > 0:
         return self.queue.pop()
     else:
         timer = ntl.millis() + timeout
         while timer > ntl.millis():
             if self.available() > 0:
                 return self.queue.pop()
             time.sleep(0.0001)
         return None
Exemple #2
0
 def getPacket(self, timeout=8000):
     self.update()
     if self.available() > 0:
         return self.queue.pop(0)
     timer = ntl.millis() + timeout
     while ntl.millis() < timer:
         self.update()
         if len(self.queue) > 0:
             return self.queue.pop(0)
         time.sleep(0.005)
     return None