View Single Post
Posts: 804 | Thanked: 1,598 times | Joined on Feb 2010 @ Gdynia, Poland
#1
Hello!

I'm writing an app to remotely control N900 with any different Bluetooth and Java ME phone. So far I got almost everything working (even system-wide simulation of keypresses and mouse-touch events), by the way: you can now download xdotools package from extras-devel for fremantle if you need it. I need help with bluetooth communication. I found enormous amounts of sources, but unfortunately none really worked for me. I'm now just requesting help in getting BT communication between my N900 Python script and N95 Java ME app. What I have now to demonstrate just my problem is:

Nokia N900 side:
Code:
import bluetooth

server_sock=bluetooth.BluetoothSocket( bluetooth.RFCOMM )

port = 5
server_sock.bind(("",port))
server_sock.listen(1)
print "listening on port %d" % port

uuid = "1e0ca4ea-299d-4335-93eb-27fcfe7fa848"
bluetooth.advertise_service( server_sock, "FooBar", uuid )

print "Waiting for connections"

client_sock,address = server_sock.accept()
print "Accepted connection from ",address

data = client_sock.recv(1024)
print "received [%s]" % data

client_sock.close()
server_sock.close()
Code is taken from http://people.csail.mit.edu/albert/b...omm-server-sdp and edited. It is quite obsolete anyway...

I tried also http://git.kernel.org/?p=bluetooth/b...ervice;hb=HEAD and am aware of http://git.kernel.org/?p=bluetooth/b...f=test;hb=HEAD examples. But when I used this, the service was not discovered by N95 Java MIDlet.

My connection string in MIDlet is:
Code:
UUID uuid = new UUID("1e0ca4ea299d433593eb27fcfe7fa848",false);
connectionURL = "btspp://" + myRemoteDevice.getBluetoothAddress() + ":" + uuid + ";authenticate=false;name=FooBar";
And I get IllegalArgumentException while calling Connector.open() with this url. If I change uuid to just hardcoded "5" (server-side code is listening on port 5), N95 tries to send the data (bluetooth icon is blinking), but N900 script never gets it, and soon N900 gets IOException with information "SymbianOS error = -6004 : General: System failure" (it's in Polish, but that's what it says).

According to http://symbian.newlc.com/Symbian-OS-Error-Codes.html it means EPageTimedOut error from "Bluetooth Errors" category.

I've read already http://developers.sun.com/mobility/m...es/bluetooth2/ and many other documents, but I still have no idea how to set things up...

I've also googled all those errors and found no solution, just flocks of programmers unable to find solution (like me). I think I just should get some newer python code and try to build something on it, but I am totally lost at the moment.

Could anyone help me and just explain or point to source, which could explain me how to exchange data between Java ME applet on Nokia N95 phone and python script on Nokia N900 phone? I need to register bt service on N900 and connect N95 client app to it. It's a total blocker for now for my app (mmmRemotePhoneKeyboard, when I will solve this issue with bluetooth, I will upload it to extras-devel). Thank you very much in advance.

Edit: soved, see further posts

Last edited by misiak; 2012-05-14 at 14:24.
 

The Following User Says Thank You to misiak For This Useful Post: