Here I have a client-server project, client is Nokia phone with a MIDlet created with J2ME. Server should be a normal java application running on PC, waiting for bluetooth connections.
As I know bluetooth stack is integratd in S60 MIDP SDK (2.1), and we can use J2ME to access this stack by bluetooth API.
My question is how to use bluetooth API (to access bluetooth stack) to setup connections when I build normal Java application without J2ME?
Any information will be appreciated. Thanks in advance.
The server-side application could connect to a certain (virtual) COM port, and the Bluetooth solution would be configured to use Bluetooth Serial Port Profile on that very same COM port. when the phone connects, the 'pipe' should be opened.
On the client side, you can develop a Java MIDP or Symbian C++ application that uses Bluetooth serial port service over RFCOMM protocol (Service Class UUID 0x1101). There are good examples in both languages:
Java: BtsppEcho example. Go to www.forum.nokia.com -> documents -> 'Introduction to developing Networked MIDlets using Bluetooth' (document includes example)
C++: BTPointToPoint example. It can be found in the Series 60 SDK.
First I feel so lucky to get your help so soon. Thanks a lot.
I printed your reply and read it more than twenty times today and made some codes to try, later I read almost all your reply to related posts in this forum. Now I realized you did give out the solution before, but I didn't understand well. Now I think your solution is like this (copied from your previous reply):
you could take advantage of Bluetooth APIs from some PC Card/USB dongle manufacturers, to let the application to connect to the COM port (and the rest is then taken care of by the Bluetooth unit; the application does not need to pay attention to Bluetooth specific issues).
so I just install the driver for my USB dongle and set it to COM port, and use Java to access this serial port to wait for connections and send data.
I don't need to access Nokia bluetooth stack or Bluetooth API (which is used for NOkia stack, my USB dongle- Belkin F8T003 doesn't open any API). So That's perfect solution for me, but the only bad thing is that I can't control the bluetooth connection.
The biggest inconvinience is not be able to add my own service.
Quite correct. A couple of clarifications:
You need to have an access to Bluetooth capabilities on each device; on phone to JSR-82 Bluetooth API when creating a Java application, on PC to available interfaces as described below.
You have two different approaches on the PC:
1) The application uses Windows serial communications interface (i.e., it connects to a virtual COM port), and the underlying Bluetooth solution takes care of the rest. You can test this pretty easily using Hyper Terminal.
Drawback:The application is not Bluetooth-aware. Access to Bluetooth methods (to run device discovery and select a remote device, for example) is solution dependent.
2) The application uses Bluetooth APIs directly. This requires that you have chosen a Bluetooth solution where also APIs/Development Kit are available. SDKs for that purpose may cost a bit.
Drawback: As the PC world is fragmented as regards to Bluetooth, the APIs ARE STACK/VENDOR-SPECIFIC; there are many different Bluetooth USB dongles/cards available for PC; if the application is targeted to be a commercial one, please note that the customers should then have a compatible Bluetooth solution (the same stack/vendor) in use.
Thanks sooo much seppo_fn. Actually I did some trial according to your guide, and find some good result, here is the brief report
On phone side, I should have no problem refering to sppEcho. To be honest, that's an extremely good example, just a bit complex and need time to grasp all.
On PC side, I found three solutions(My thesis is still on the way), exactly match everything you said.
1. Based on USB SPP(Serial Port profile), I use javax.comm access the exact serial port, just send data and listen. I hope I can use this solution to satisfy my project. It's simple and portable.
2。Backup solution: On windows Xp, Microsoft bluetooth stack + blueCove (JSR82 partly implementation). Also use serial port profile. Benhui.net gives some nice examples and instructions. http://www.benhui.net/modules.php?name=Bluetooth
3。Last alternatives: Linux, bluz+ KDE. It's possible.
BTW, your suggestion for the customer thing is so considerate, maybe useful in my future or for others in this forum. Now I am just doing a 20-point thesis for my professor. He just thinks it's fun to have it, not for commercial.
The last thought, I feel pretty honored to get your instructions, which I didn't get even from my professor.
So give my best regards to you! /bow.
I've found your post very interesting. In fact I've similar project to aluckybird's too. The only good solution I've found so far is to connect mobile phone by the RFCOMM virtual port as seppo_fn have said. I'm interested in sending voice through bluetooth. I wonder if it's possible to send the RING and other commands from pc to phone in order to receive ack and establish a voice connection? Has onyone tested it ? Is it somewhere a full list of AT commands which concerns bluetooth ?
I'll be appreciated for any help and I willing to contact people(is possible to contact here by e-mail?) making some developments regarding to this subject.