| Versions |
 |
|
| Author |
Topic  |
|
november17
23 Posts |
Posted - 17 févr. 2010 : 09:48:02
|
Hi mario thanks for your answer.
I have just another question. My problem is that I would send PMTK command to my iblue 821 in java. When i did not know your program, I tryed simple to open a Serial Port using rxtx lib, then i opened the outputstream and send the command byte by byte: HDD serial port monitor notify me that the string is sent but gps reiceiver don't send me back anything (I tried with some packet, like "$PMTK000*32\r\n", $PMTK604*6D\r\n and so on). I also tried to build an OutputStreamWriter for sendind the string instead of byte by byte but the reiceiver don't send me back anything yet.
So i watched you sources, but one thing is not clear for me. The class NMEAWriter in gps.connection build the complete string (including $, *, checksum, and end of line bytes) then use context.write for sending the command, where contex is instance of GPSrxtx class.
I saw GPSrxtx class also in gps.connection and i watched his method "write(string)": it reserve a semaphore, then use a GPSport.write(String). So I saw the class GPSPort but there is no implementation of method "write(string)" because it's an abstract class.
So i don't understand what lower structure use to send command (like outputstream or similar).
I hope that you could help me.
Thanks for reading. Bye from Italy
Graziano
|
 |
|
|
mdeweerd
798 Posts |
Posted - 17 févr. 2010 : 09:55:54
|
GPSPort is an abstract class because I have several implementations of the serial layer (J2SE RXTX, J2ME bluetooth, SuperWaba specific, J2SE virtual device). In the 'src_rxtx' directory structure you'll find the implementation for the RXTX library.
Make sure that you have set the correct speed for the GPS receiver. Normally your GPS receiver is already sending NMEA data (the current position), so even without sending HDD Serial Port Monitor should report that something is sent. If that is not the case, your serial port configuration is likely incorrect (speed, or, the port selected). |
 |
|
|
november17
23 Posts |
Posted - 17 févr. 2010 : 10:14:28
|
If I simple open HDD free serial port monitor, nothing happens, so i don't visualize the nmea sentence that gps reiceiver send me. But if I open your software or the sofware on Gps CD, i can see the data exchange between software and gps reiceiver.
HDD free serial port monitor don't give me the possibility of changing port speed.
I saw the correct source, i saw that you also use an outputstream and send command byte by byte, it was a great information because now i know that the problem is not there. Now i test other serial port monitor and i try to change port speed in my java program before sending command
I hope that i will solve my problems
thanks for helping me.
Bye from Italy
Graziano |
 |
|
|
mdeweerd
798 Posts |
Posted - 17 févr. 2010 : 10:16:30
|
Hi HDD serial port monitor will not change the speed, that has to be done in the controlling application. It is done in BT747 or the software on the gps cd. Kind regards Mario |
 |
|
|
november17
23 Posts |
Posted - 17 févr. 2010 : 10:24:04
|
I am trying with
thePort.setSerialPortParams(115200, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE);
but gps reiceiver don't send me back anything yet. I also tryed with 38400 instead of 115200 but the result is the same.
Are other parameters correct?
Thanks
Graziano |
 |
|
|
mdeweerd
798 Posts |
Posted - 17 févr. 2010 : 10:26:31
|
| I think that is correct, but you can check in HDD Serial Port Monitor the value that is actually set I think. |
 |
|
|
mdeweerd
798 Posts |
Posted - 17 févr. 2010 : 10:54:00
|
| You probably also need to actually request data from the serial link. |
 |
|
|
november17
23 Posts |
Posted - 17 févr. 2010 : 11:05:18
|
I am trying but receiver don't answer yet. What do you want to say exactly with "need to request data from serial link"?
Now my program is most simple possible, just open the port, set the speed, open OutputrStream and send the packet test; I see what happens with HDD serial port monitor, there is not a java class for receiving data.
|
 |
|
|
mdeweerd
798 Posts |
Posted - 17 févr. 2010 : 20:10:09
|
What I mean is do a 'readbytes' or 'available' test on the link in some kind of loop. According to your description, you do not do that. Even if the FIFO is filling up, the data is not requested on the API. |
 |
|
|
november17
23 Posts |
Posted - 18 févr. 2010 : 09:09:34
|
I tryed to make 2 java program, a sender one and a reiceiver one. I open receiver one and it wait the data on COM4 (the port of gps reiceiver). But when I open che sender program, there is a portinuse exeption caused by the reiceiver program that currently owned the port. Have you an idea for doing sender and receiver on the same program, or in two program and avoid portinuseexception?
thanks in advance.
Graziano |
 |
|
|
mdeweerd
798 Posts |
Posted - 19 févr. 2010 : 08:15:37
|
| Use 'com0com' to create virtual serial ports that you can loopback. |
 |
|
|
november17
23 Posts |
Posted - 19 févr. 2010 : 11:48:22
|
Today is a great day, i can communicate with my iblue 821.
I just write a reiceiver code after sender code and i see that the first nmea string that the program receive is PMTK ACK; after, it continue to receive GPRMC string and similar.
Now i have the problem to separate the sender part from the reiceiver one, making them indipendent.
I'm thinking that i can create two thread into same java program: it is a valid solution, in your opinion?
Thanks for supporting me ;-)
Bye from Italy
Graziano |
 |
|
|
mdeweerd
798 Posts |
Posted - 19 févr. 2010 : 11:52:39
|
I'll send you the invoice ;-).
You can either create the polling thread yourself or have RXTX notify a class instance through a method whenever it has data available.
|
 |
|
|
november17
23 Posts |
Posted - 22 févr. 2010 : 09:47:51
|
Eheh :-) If you one day will come in italy near Milan i will offer you at least a lunch :-) |
 |
|
|
november17
23 Posts |
Posted - 22 févr. 2010 : 15:38:55
|
Great, now i have also the receiver thread that poll the inputstream for showing me nmea sentence. Is there an PMTK command for avoid that GPS receiver send me GPRMC and other nmea sentence, but send me just pmtk sentence?
Or I have to implement a way to receive just PMTK packet instead of PMTK packet and GPRMC GPGSA GPSV GPGGA? |
 |
|
Topic  |
|
|
|
| This page was generated in 2,48 seconds. |
 |
|