I'm attempting to run a program on a Nokia N97 using python that will connect to a micro controller board through Bluetooth and switch an LED on/off. The code is directly copied from an example in the book Mobile Python: Rapid Prototyping of Applications on the Mobile Platform so should, in theory, work.
It is as follows:
import socket, e32, appuifw
names = 
channels = 
for name, channel in services.items():
index = appuifw.popup_menu(names, u"Choose service")
address, services =socket.bt_discover()
channel = choose_service(services)
sock = socket.socket(socket.AF_BT, socket.SOCK_STREAM)
data = sock.recv(1)
if data == "1":
appuifw.note(u"LED on ", "info")
elif data == "0":
appuifw.note(u"LED off ", "info")
print "socket closed"
app_lock = e32.Ao_lock()
appuifw.app.menu = [(u"LED on", bt_send_data1),
(u"LED off", bt_send_data2),
appuifw.app.exit_key_handler = exit_key_handler
The error I am getting on the phone when I attempt to select connect is "Traceback (most recent call last): File "e:\python\example119.py", line 14, in connect address, services =socket.bt_discover() AttributeError: 'module' object has no attribute 'bt_discover'.
I'm really struggling to see what I'm doing wrong here and any help from a more experienced user of python would be greatly appreciated, thanks