Hi All, i have the need to run a few python scripts in B4J, i came across the Jython library which works very good, but unfortunately i can not get the Bluetooth Module to work, I believe it is because that package is not installed in Jython and I believe that Jython also doesn't support modules that have C dependencies.
With that said, i've tried using the Shell library which works great, i'am able to run a scrip that searches for any bluetooth devices and displays the names and mac address.
The python code is the following:
My question is this, how can I call a function inside a python script using Shell? Can this be done? if so does anyone have any examples?
Thanks in advance.
Walter
With that said, i've tried using the Shell library which works great, i'am able to run a scrip that searches for any bluetooth devices and displays the names and mac address.
The python code is the following:
B4X:
import bluetooth
print("performing inquiry...")
nearby_devices = bluetooth.discover_devices(
duration=8, lookup_names=True, flush_cache=True, lookup_class=False)
print("found %d devices" % len(nearby_devices))
for addr, name in nearby_devices:
try:
print(" %s - %s" % (addr, name))
except UnicodeEncodeError:
print(" %s - %s" % (addr, name.encode('utf-8', 'replace')))
Thanks in advance.
Walter