Sena Parani MSP1000 User Manual page 76

For wireless multi-serial communications, based on bluetooth technology
Table of Contents

Advertisement

for bitpos, classname in service_classes:
if device_class & (1 << (bitpos-1)) and classname == "object
transfer":
scan_info.append(address)
def inquiry_complete(self):
self.done = True
def sendfile(bdaddr, i):
if len(send_info) > 0:
for item in send_info:
if item['addr'] == bdaddr:
return
services = lightblue.findservices(addr=bdaddr, servicetype=lightblue.OBEX)
address, serviceport, servicename = services[0]
lightblue.obex.sendfile(address, serviceport, file_path)
temp = {'addr': bdaddr, 'time': time()}
send_info.append(temp)
def update_send_info():
cur_time = time()
for item in send_info:
if cur_time - item['time'] > send_interval:
send_info.remove(item)
send_info = []
while True:
scan_info = []
threads = []
nloops = 0
d = MyDiscoverer()
d.find_devices(lookup_names = True)
readfiles = [ d, ]
while True:
rfds = select.select( readfiles, [], [] )[0]
if d in rfds:
d.process_event()
if d.done: break
if len(send_info) > 0:
update_send_info()
for item in scan_info:
t = threading.Thread(target=sendfile, args=(item, 0))
threads.append(t)
nloops += 1
for i in range(0, nloops):
threads[i].start()
sleep(5)
for i in range(0, nloops):
threads[i].join()
del scan_info
del threads
del nloops
(23, "information"))
76

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents