
Originally Posted by
rabaf
Hello,
I want to send some text (Finally from a text file) from my Mobile device to my Computer.
How could I accomplish this?
I have the connecctivity option as Bluetooth.
Thanks in advance.
Hi,
You could use the Code below to send text from your Mobile to PC using Bluetooth,
Here it accepts text input from appuifw.query to get the input text, you can also read text from a text file on the Phone.
Code:
import appuifw
import socket
import e32
def bt_connect():
global sock
sock=socket.socket(socket.AF_BT,socket.SOCK_STREAM)
target=''
if not target:
address,services=socket.bt_discover()
print "Discovered: %s, %s"%(address,services)
if len(services)>1:
import appuifw
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])
print "Connecting to "+str(target)
sock.connect(target)
print "OK."
bt_typetext()
def bt_typetext():
global sock
test = appuifw.query(u"Type words", "text", u"")
if test == None:
exit_key_handler()
else:
sock.send(test)
bt_typetext()
def exit_key_handler():
script_lock.signal()
appuifw.app.set_exit()
appuifw.app.title = u"Mob to PC"
script_lock = e32.Ao_lock()
appuifw.app.exit_key_handler = exit_key_handler()
bt_connect()
script_lock.wait()
Best Regards,
Croozeus