def run(self):
# we'll pull out scan & card to avoid calling it every SCAN seconds
i = 0
card = self._card
scan = self._scan
n = len(self._scan)
# loop until the card is destroyed. we'll use pyric.error as
# a poison pill
nlsock = nl.nl_socket_alloc()
while True:
try:
time.sleep(SCAN)
i = (i + 1) % n
pyw.freqset(card, scan[i][0], scan[i][1], nlsock)
except pyric.error:
# ideally we should check below and return error if
# we didn't lose the card
#if not pyw.validcard(card,nlsock): break
break
nl.nl_socket_free(nlsock)
评论列表
文章目录