Skip to content
Snippets Groups Projects
Commit 2b557c0e authored by jkerdreu's avatar jkerdreu
Browse files

drop old json import


git-svn-id: https://redmine.imt-atlantique.fr/svn/xaal/code/Python/branches/fork@1480 b32b6428-25c9-4566-ad07-03861ab6144f
parent 8a8bebe2
No related branches found
No related tags found
No related merge requests found
......@@ -19,8 +19,8 @@
from xaal.lib import Engine, Device, tools, config
import json
import sys
import time
logger = tools.get_logger("isalive",'DEBUG')
class Scanner:
......@@ -42,7 +42,6 @@ class Scanner:
def query(self,devtype='any.any'):
self.devtype = devtype
self.seen = []
self.timer = 0
print("[%s] Sending xAAL isAlive [%s]" % (self.addr,self.devtype))
self.eng.send_isAlive(self.dev,[self.devtype,])
......@@ -52,17 +51,16 @@ class Scanner:
print("="*70)
def loop(self):
t0 = time.time()
while 1:
self.eng.loop()
if self.timer > 50:
if time.time() > (t0 + 1):
break
self.timer += 1
def parse_answer(self,msg):
if (msg.msgtype == 'notify'):
if msg.action == 'alive':
if msg.source == self.addr:return
if msg.source == self.addr:return #hidding myself
if msg.source not in self.seen:
print("%s : %s" % (msg.source,msg.devtype))
self.seen.append(msg.source)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment