• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
  • Piet Souris
  • Himai Minh

Serial communication possible on SPV C500?

Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I have a Windows Mobile 2003 smartphone called SPV C500 (also known as Qtek 8010 or HTC Typhoon).

I have paired this phone with a Bluetooth GPS and applications can now talk to the GPS through COM7 (the kind of serial communication via Bluetooth which all Bluetooth GPS receivers use). It seems that I cannot connect to the GPS manually, but as soon as any application starts talking to COM7, the phone will connect automatically to COM7.

I am now trying to write my very first J2ME application ever which will get data from the GPS. However, I am not able to connect to COM7.

I have installed Netbeans 5.0 and started a new Mobile Application project. In the existing "startApp()" I have added this:

try {
CommConnection sc = (CommConnection) Connector.open("comm:COM7;baudrate=19200");
DataInputStream is = sc.openDataInputStream();
StringBuffer b = new StringBuffer();
int br = sc.getBaudRate();
if (br > 0) { // we have a connection
tickerstreng = "we have a connection";
} else {
tickerstreng = "we do not have a connection";
} catch (Exception e) {

tickerstreng = e.getMessage();

The "tickerstreng" is a String declared elsewhere which I use for simple debugging.

In the emulator in Netbeans, I will get an exception because the PC do not have a COM7. The message in tickerstreng is "Bad parameter". This is ok.

On the phone, I assume that I also get an exception, but I don't know what it says, since the phone will hang unless I remove the "tickerstreng = e.getMessage();" line.

After removing this line, the program will run fine, but no connection with the GPS is established, and tickerstreng is not changed from its default value, meaning that the program will never reach the "if (br > 0)" line.

Does anyone know if serial communication in J2ME is possible at all on the SPV C500?

How do I see the error message in the exception when I can't fill it into a String?

As I said, this is my first J2ME application ever (actually my first Java application at all) so please be gentle and do not assume that I know anything.
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello. I don't want to disappoint you, but I was trying to communicate with hardware bluetooth on my phone too, and after many tries I found out, that it is impossible. (I mean by Java app - J2ME). Look at this page, and you will see... Java club SPV C500
You can't expect to wield supreme executive power just because
Free, earth friendly heat - from the CodeRanch trailboss
    Bookmark Topic Watch Topic
  • New Topic