Hi,
I am doing a project which will connect bluetooth module to a development board .
I am going to use mobile phone to discover that bluetooth module and control the development board .
My code not work with python 1.9.x but work with python 1.4.5
Please help me and edit my code .
Thx you
Code:import socket import appuifw import e32 e32.ao_yield() def bt_socket_connect(target=''): if not target: address, services = socket.bt_discover() if len(services) > 1: choices = services.keys() choices.sort() choice = appuifw.popup_menu([unicode(services[x])+": "+x for x in choices], u'Choose port:') target = (address, services[choices[choice]]) else: target = (address, services.values()[0]) sock = socket.socket(socket.AF_BT,socket.SOCK_STREAM) sock.connect(target) return sock def bt_connect(): sock = bt_socket_connect() def send_command(self, command): sock = self.sock sock.send(command + "\r\n") def exit_key_handler(): print "socket closed" sock.close() app_lock.signal() app = appuifw.app app_lock = e32.Ao_lock() exit_flag = False app.title = u"Bluetooth" app.exit_key_handler = exit_key_handler bt_connect()



Reply With Quote

