|
|
|
|
pMEA, Access to serial ports
Posted:
Oct 7, 2008 12:18 AM
|
|
|
Hello, we need to communicate with a serial port to get access to a GPS device. I think we have the same problem described in this message:
http://markmail.org/message/osumbxclbtzuthep
But we are running Windows Mobile, not Linux. If I understood it well, they have recompiled the VM with a small change to let applications access serial ports.
Is that correct? Do Davy's CAB installers give access to serial ports? How? We always get an exception when we try. Do we have to recompile the VM as the person in that forum did?
Besides, when we read the GPS data, we need to write a few bytes to that port to let the data flow begin.
Regards, Lucas
|
|
|
|
|
|
|
Re: pMEA, Access to serial ports
Posted:
Oct 7, 2008 4:54 AM
in response to: jldominguez
|
|
|
On Tuesday 07 October 2008 09:18:22 phonemeadvanced@mobileandembedded.org wrote: > Hello, we need to communicate with a serial port to get access to a GPS > device. I think we have the same problem described in this message: > > http://markmail.org/message/osumbxclbtzuthep > > But we are running Windows Mobile, not Linux. If I understood it well, they > have recompiled the VM with a small change to let applications access > serial ports. > > Is that correct? Do Davy's CAB installers give access to serial ports? How? > We always get an exception when we try. Do we have to recompile the VM as > the person in that forum did? > > Besides, when we read the GPS data, we need to write a few bytes to that > port to let the data flow begin. > > Regards, > Lucas > [Message sent by forum member 'jldominguez' (jldominguez)]
Hi Lucas,
A while ago, I was able to get my bluetooth GPS dongle to work (via COM6:) with J9 using a WinCE implementation of RXTX. I added jcl.jar and comm.jar to the classpath and put the rxtxSerial.dll in the library path, etc. I just tested the same approach with a pMEA personal profile build and that works as well.
I implemented the JNI interfaces for the Generic Connection Framework (GCF) for Windows Mobile, and had to set "export CVM_INCLUDE_COMMCONNECTION=true" before compiling the sources. I made a midlet that could read the NMEA sentences of my GPS dongle using the javax.microedition.io.CommConnection class. You can find the same class in cdc.jar, foundation.jar or personal.jar. There does not appear to be a javax.comm package and e.g. no CommPortIdentifier class in the subversion tree, so I think you will still need external libraries to get serial port access this way, unless we build javax.comm wrapper classes around the native code (commProtocol_md.c) that is used by the javax.microedition.io.CommConnection class.
Cheers, Davy
--------------------------------------------------------------------- To unsubscribe, e-mail: advanced-unsubscribe@phoneme.dev.java.net For additional commands, e-mail: advanced-help@phoneme.dev.java.net
|
|
|
|
|
|
|
|
Re: pMEA, Access to serial ports
Posted:
Oct 8, 2008 1:30 AM
in response to: Davy Preuveneers
|
|
|
I'm trying to connect using:
CommConnection cc = (CommConnection)Connector.open("comm:com5",Connector.READ); InputStream is = cc.openInputStream(); BufferedReader br = new BufferedReader( new InputStreamReader(is)); String line = br.readLine();
but I allways get:
javax.microedition.io.ConnectionNotFoundException: The requested protocol does not exist com5
System.getProperty("microedition.commports") returns "com0,com1,com2,com3,com4,com5,com6,com7,com8,com9" but none of this ports works
|
|
|
|
|
|
|
|
Re: pMEA, Access to serial ports
Posted:
Oct 8, 2008 3:40 AM
in response to: jacarma
|
|
|
On Wednesday 08 October 2008 10:30:49 phonemeadvanced@mobileandembedded.org wrote: > I'm trying to connect using: > > CommConnection cc = > (CommConnection)Connector.open("comm:com5",Connector.READ); InputStream is > = cc.openInputStream(); > BufferedReader br = new BufferedReader( new InputStreamReader(is)); > String line = br.readLine(); > > but I allways get: > > javax.microedition.io.ConnectionNotFoundException: The requested protocol > does not exist com5 > > System.getProperty("microedition.commports") returns > "com0,com1,com2,com3,com4,com5,com6,com7,com8,com9" > but none of this ports works > [Message sent by forum member 'jacarma' (jacarma)] > > http://forums.java.net/jive/thread.jspa?messageID=303887 > > --------------------------------------------------------------------- > To unsubscribe, e-mail: advanced-unsubscribe@phoneme.dev.java.net > For additional commands, e-mail: advanced-help@phoneme.dev.java.net
I am getting the same problem with CommConnection in phoneME Personal Profile. The fact that you get "com0,com1,com2,com3,com4,com5,com6,com7,com8,com9" for the system property, is because I defined the property as such. Don't rely too much on this property, because it is a static hard coded property.
I documented my approach with pMEA+RXTX and some sample code over here: http://www.cs.kuleuven.be/~davy/phoneme/other.htm
Cheers, Davy
--------------------------------------------------------------------- To unsubscribe, e-mail: advanced-unsubscribe@phoneme.dev.java.net For additional commands, e-mail: advanced-help@phoneme.dev.java.net
|
|
|
|
|
|
|
|
Re: pMEA, Access to serial ports
Posted:
Oct 8, 2008 7:01 AM
in response to: Davy Preuveneers
|
|
|
Thank you Davy,
I have downloaded * GPSTest.java * comm.jar * jcl.jar * rxtxSerial.dll
and tried to run It but I got "Port XXX not found." for everyport I try, and CommPortIdentifier.getPortIdentifiers() returns an empty collection.
|
|
|
|
|
|
|
|
Re: pMEA, Access to serial ports
Posted:
Oct 8, 2008 8:56 AM
in response to: jacarma
|
|
|
On Wednesday 08 October 2008 16:01:47 phonemeadvanced@mobileandembedded.org wrote: > Thank you Davy, > > I have downloaded > * GPSTest.java > * comm.jar > * jcl.jar > * rxtxSerial.dll > > and tried to run It but I got "Port XXX not found." for everyport I try, > and CommPortIdentifier.getPortIdentifiers() returns an empty collection. > [Message sent by forum member 'jacarma' (jacarma)] > > http://forums.java.net/jive/thread.jspa?messageID=303960
In that case I am afraid I cannot really help you. The only thing I can think of is testing whether a midlet on top of phoneME Feature can connect to your serial port. A have written a small midlet before that uses the GCF to read from a serial port, so I know it works on my device and I have confirmation from other people that they connect to a serial port this way too. Here is a another more advanced midlet that you could use to test your serial ports:
http://mob385.com/midlet/SerialPortTester.jad http://mob385.com/midlet/SerialPortTester.jar
Regards, Davy
--------------------------------------------------------------------- To unsubscribe, e-mail: advanced-unsubscribe@phoneme.dev.java.net For additional commands, e-mail: advanced-help@phoneme.dev.java.net
|
|
|
|
|
|
|
|
Re: pMEA, Access to serial ports
Posted:
Oct 13, 2008 4:13 AM
in response to: Davy Preuveneers
|
|
|
Thank you Davy, we made it work recompiling the rxtxserial.dll, now we have only some minor problems with RXTX (with setSerialPortParams() ).
Thank you again
|
|
|
|
|
|
|
|
Re: pMEA, Access to serial ports
Posted:
Oct 13, 2008 4:55 AM
in response to: jacarma
|
|
|
|
|
|
|
|
|
|
|
Re: pMEA, Access to serial ports
Posted:
Apr 30, 2009 7:23 PM
in response to: Davy Preuveneers
|
|
|
Hi Davy,
I follow your instruction to setup the environment and successfully compile and run GPSTest.java without error. But, it stucks on Found port 'COM1' without further data retreive from GPS receiver. Do I miss anything such as send a command or else? The code did not go through serialEvent(). Help and Thanks.
Fred
|
|
|
|
|
|
|
|
Re: pMEA, Access to serial ports
Posted:
May 9, 2009 5:09 AM
in response to: fchen2020
|
|
|
Are you sure your GPS is hooked up to COM1? I have my Bluetooth GPS configured to use COM6. For an internal GPS, the COM1 port could be correct, but it is possible that the port is already in use, or that you have to send some commands to this port first, or that you have to use different speed/parity/stopbits etc. That is all I can think of right now.
Davy
|
|
|
|
|