![]() |
|
|||||||
| Home | Register | FAQ | Members List | Search | Today's Posts | Mark Forums Read |
| Questions & Help Needed Post any question regarding Basic4ppc. |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
Hello!!!
Ich have a Problem with reading a kompletly NMEA-protocol like "§GPGGA,..." (see Help 'StrSplit') from a server. The Server sends every two seconds a NMEA-protokoll. Ich can see this in a Control-Monitor and the server allows every client to take this data. But in the 'filestream.ReadString' there are only some parts of the protocol. Sometimes parts out of the middle or something from the end. Only the first read is correct and begins with "GPGGA,...." With the folowing code i always checked the length of the string. This is every time different between 5 or 10 and perhaps 60 to 80. I have tested the timer with 500,1000 and 2000 ms, but no different. If i don't know, where the string begins, I can not take the parameters with 'StrSplit' to use them. Here the nessesary parts of my code: I use the components Network.dll and BinaryFile.dll Sub App_Start .. Timer1.Enabled=true Client.New1 Client.Connect("87.139.78.???",11112) .. end sub Sub Timer1_Tick .. if Client.DataAvailable=true then filestream.New1(Client.Getstream,false) Protokoll=filestream.ReadString Label1.Text=Protokoll Label2.Text=StrLength(Protokoll) end if .. end sub ![]() I trie to find an answer for two weeks, but nothing..... Thanks for help!!! |
|
|||
|
Hello Erel, thanks for your fast answer.
But I have two problems with GPS.GPSStream: First i have give a kompletly NMEA-String to the GPSStream like Sub Globals NMEA="$GPGGA,161229.487,3723.2475,N,12158.3416,W,1 ,07,1.0,9.0,M,,,,0000*18" end Sub Sub Timer1_Tick if NMEA<>"" then gps.GPSStream(NMEA) end if End Sub Sub GPS_GPSDecoded Label1.text=gps.latitude ... end Sub but the GPS_GPSDecoded -Sub was not call. So I have call this Sub manuell, but there is no data from the NMEA-Protocol. I have tested it with GPGGA an GPRMC. What else i need to call the GPS_GPSDecoded, if the GPSBuffer have enough data? The second Problem is, that my application takes the data from a GPS-mouse and the GPS-data from the server at the same time, because i calculate then distance and course of this two points. When I use the GPS.dll for both, the GPSBuffer takes the data from the GPS-mouse and from the server, so that I must have two different GPS-Objekts with two different GPS-Buffer. To take the data from the server is my last problem of the application, then it run. Frindly greetings schimanski |
|
|||
|
Hello!
Thanks for the given answers. It was a great help for me. But now, i have again one problem: When I read the NMEA-protocoll from the server by using the client-object and filestream.readstring over a GPRS-connection, i can take the data without problems. But if I dont' read the data form the server for perhaps one minute, the server will send me the NMEA-protocoll from one minute ago. If I wait three or four minutes and read then the filestream, i don't can take the actuell data, only the data from the time, i have stoped reading. The administrator from the server said, that the server doesn't buffer the data. Is it possible to make a reset, when i begin to read from the stream? ![]() thanks for help.... |
|
|||
|
Hello Erel!
Here the code, which i take the data from the server: If I don't take the data for perhaps two minutes, because i have selected another index in combobox2, i only can get the old data. Sub Globals Dim Type (Lat,Lon,HemLat,HemLon) Ziel Dim Type (Lat,HemLat,Lon,HemLon,Geschwindigkeit,Kurs) Array_NMEA .. end sub Sub App_Start GPS_Server.New1 .. end sub 'Create the server-connection, when button is clicked' Sub Button4_Click ErrorLabel(noconnection) WaitCursor(true) client.New1 'init Client-Objekt' IP_Adresse=textbox18.Text Port_Nummer=textbox19.Text Client.Connect (IP_Adresse,Port_Nummer) If timer2.Enabled=false Then timer2.Enabled = true 'I have tested the Timer with 2000, 1000 and 500 ms' WaitCursor(false) Return noconnection: .. End Sub 'Takes the data from the server' Sub Timer2_Tick ErrorLabel(connectionbreak) if ComboBox2.SelectedIndex = 1 then If client.DataAvailable=true Then Image4.LoadPicture("IconDaten1.bmp") filestream.New1(client.GetStream,false) GPS_Server.GPSStream(filestream.ReadString) Else Image4.LoadPicture("IconDaten2.bmp") End If End If Return connectionbreak: .. client.close End Sub 'Read the GPS_Server-bufferstring' Sub GPS_Server_GPSDecoded ErrorLabel(GPS_Server_Fehler) If GPS_Server.status="A" Then Image3.LoadPicture("IconSat1.bmp") Else Image3.LoadPicture("IconSat2.bmp") End If Ziel.Lat=GPS_Server.DecimalLatitude Ziel.HemLat=GPS_Server.LatitudeHemisphere Ziel.Lon=GPS_Server.DecimalLongitude Ziel.HemLon=GPS.LongitudeHemisphere 'Save the GPS-data from Server to create a NMEA-protocoll' Array_NMEA.Lat=GPS_Server.Latitude Array_NMEA.HemLat=GPS_Server.LatitudeHemisphere Array_NMEA.Lon=GPS_Server.Longitude Array_NMEA.HemLon=GPS_Server.LongitudeHemisphere Array_NMEA.Geschwindigkeit=GPS_Server.SpeedOverGro und Array_NMEA.Kurs=GPS_Server.CourseOverGround Label11.Text=Round(GPS_Server.SpeedOverGround * 1.852) Label20.Text=Round(GPS_Server.Altitude) & "(" & (Round(GPS_Server.Altitude)-Round(GPS.Altitude)) & ")" Return GPS_Server_Fehler: End Sub 'Close server-connection' Sub Button3_Click client.Close If timer2.Enabled=true Then timer2.Enabled=false Image3.LoadPicture("IconSat2.bmp") Image4.LoadPicture("IconDaten2.bmp") End Sub 'Generate a NMEA-protokoll (GPRMC) an send it to a serial COM.port' Sub Timer3_Tick NMEA="$GPRMC," & Time(Now) & ",A," & Array_NMEA.Lat & "," & Array_NMEA.HemLat & "," & Array_NMEA.Lon & "," & Array_NMEA.HemLon & "," & Array_NMEA.Geschwindigkeit & "," & Array_NMEA.Kurs & "," & Date(Now) & ",0.4,E,A*" 'Berechnung der Prüfsumme' buffer() = bit.StringToBytes(NMEA,1,StrLength(NMEA)-2) laenge=ArrayLen(buffer()) Summe=buffer(0) For i=1 To laenge-1 Summe=bit.XOR(summe,buffer(i)) Next Pruefsumme=bit.DecToHex(Summe) 'Pruefsumme am NMEA-Protokoll anhängen' NMEA=NMEA & Pruefsumme & crlf serial_output.Output(NMEA) End Sub ![]() ![]() ![]() |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Comunicating with a Telnet Server | lu_ozzie | Questions & Help Needed | 16 | 05-05-2008 05:25 PM |
| Simple NMEA logger | Bruno | Share Your Creations | 0 | 05-02-2008 07:43 PM |
| Checksum in nmea | wolfgang | Code Samples & Tips | 0 | 02-15-2008 01:42 PM |
| Probleme beim Lesen eines NMEA-Protokolls | schimanski | German Forum | 0 | 12-09-2007 05:20 PM |
| New server | Erel | Forum Discussion | 12 | 11-06-2007 04:21 PM |