Serial ports

phoneME Advanced - Personal Profile: Accessing serial ports

The Generic Connection Framework (GCF) is a J2ME API that supports various connection types, including communication through serial ports. GCF has been succesfully used with the two MIDP supporting phoneME VMs (phoneME Feature and phoneME Advanced dual stack) to read the NMEA sentences of a bluetooth GPS dongle through the Serial Port profile. Using the same API for plain phoneME Advanced (CDC, Foundation, Personal Profile) does not seem to work. An alternative is to use the free RXTX that provides native WinCE libaries and the Java javax.comm packages for serial port communication.

Here are some files and example code that have been used to read the same NMEA sentences of the GPS dongle:

Change the com port if necessary, compile the GPSTest.java source file and put the class files in a jar file. Copy all jar and dll files into a folder \gps on your mobile device and create a startup file, e.g. gpstest.lnk, with the following content on one line (make sure you modify the paths where needed):

254#\personal\bin\cvm.exe -Djava.library.path=\gps -cp \gps\GPSTest.jar;\gps\jcl.jar;\gps\comm.jar GPSTest