dragonsteve
Posts: 16
Joined: Thu Sep 15, 2005 3:50 pm

BT GPS Fix Problem

Mon Jan 09, 2006 2:32 pm

Hi,

we have a problem with the fix of our BT GPS Reciever.

Sometimes it takes way to long until the GPS gets a fix.
This is not will all our devices.
A normal initial GPS Fix takes up to maximum 1 minute.
But with some we have an hour fix time.
This happens at random with our devices.

I can not see that there is anything wrong with our code.
Hopefully you could help me with this problem.

Code: Select all

    Public Sub connectGPS()
        If objParser Is Nothing Then
            objParser = New GpsToolsNET.NmeaParser
            objParser.Parent = Me

            objParser.ComPort = oMainForm.iPort
            objParser.BaudRate = oMainForm.iRate
            objParser.NoEvents = True

            Try
                objParser.PortEnabled = True
            Catch ex As Exception
                objParser.Dispose()
                objParser = Nothing
                bGPSDeviceConnected = False
            End Try
            tmrCheck.Enabled = True
        Else
            objParser.Dispose()
            objParser = Nothing
        End If
    End Sub

    Private Sub doGPSCheck(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tmrCheck.Tick
        tmrCheck.Enabled = False
        If bGPSDeviceConnected Then
            If checkCom() Then
                bGPSDeviceConnected = True
                checkSats()
                checkFix()
            Else
                oMainForm.picSatsRed.Image = oMainForm.imgLstGPS.Images(4)
            End If
        End If
        tmrCheck.Enabled = True
    End Sub

    Private Function checkCom() As Boolean
        'CHECK BT GPS COMMUNICATION STATUS
        Dim bOk As Boolean = False
        If Not objParser Is Nothing Then
            Dim objStatus As GpsToolsNET.ComStatus
            objStatus = objParser.GetComStatus

            If objStatus.ValidNmea Then
                If objStatus.ComPort = -1 Then
                    oMainForm.picSatsRed.Image = oMainForm.imgLstGPS.Images(4)
                    bOk = True
                Else
                    oMainForm.picSatsRed.Image = oMainForm.imgLstGPS.Images(3)
                    bOk = True
                End If
            Else
                oMainForm.picSatsRed.Image = oMainForm.imgLstGPS.Images(4)
                connectGPS()
            End If
        Else
            connectGPS()
        End If
        Return bOk
    End Function

    Private Sub checkSats()
        ' CHECK SATELITES TO SET AN IMAGE INDICATOR
        Dim iIndex As Integer
        Dim iIndicator As Integer = 0
        Dim iIndicatorGreen As Integer = 0
        Dim sStr As String = ""
        Dim objSats As GpsToolsNET.Satellites
        objSats = objParser.GetSatellites(0)

        If Not objSats Is Nothing Then
            Try
                For iIndex = 1 To objSats.Count
                    If Not IsNothing(objSats.Item(iIndex)) Then
                        If objSats.Item(iIndex).UsedForFix Then
                            sStr = sStr & "[ " & objSats.Item(iIndex).ID & ": " & objSats.Item(iIndex).SNR & " ]"
                            If objSats.Item(iIndex).SNR > 40 Then
                                iIndicatorGreen += 1
                                iIndicator += 1
                            Else
                                If objSats.Item(iIndex).SNR > 24 Then
                                    iIndicator += 1
                                End If
                            End If
                        End If
                    End If
                Next
            Catch ex As Exception
                ' MsgBox("Fout in sats")
            End Try
            If iIndicatorGreen > 2 Then
                oMainForm.picSatsRed.Image = oMainForm.imgLstGPS.Images(1) ' GREEN
            Else
                oMainForm.picSatsRed.Image = oMainForm.imgLstGPS.Images(0) ' YELLOW
            End If
        End If
    End Sub

    Private Sub checkFix()
        Try

            Dim objPosition As GpsToolsNET.Position
            Dim objFix As GpsToolsNET.GpsFix
            Dim objMovement As GpsToolsNET.Movement

            objFix = objParser.GetGpsFix(0, 2)

            ' IF WE HAVE A FIX TAKE ACTION
            If Not objFix Is Nothing Then
                If Not oMainForm.workerThreadDone Then
                    oMainForm.workerThreadDone = True
                    oMainForm.pnlGPS.Visible = False
                    oMainForm.ShowStartButtons()
                    oMainForm.pnlLanguage.Dispose()
                End If
                objPosition = objFix.Position

                If Not oMainForm.bStoryboard Then
                    oComStat = objParser.GetComStatus()
                    If oComStat.ValidNmea And oComStat.ValidFix Then
                        objMovement = objParser.GetMovement(0)

                        If Not objMovement Is Nothing Then
                            If Math.Round(objMovement.Speed(1)) > 0 Then
                                oMainForm.disableLevel2()
                            Else
                                oMainForm.enableLevel2()
                            End If
                        End If
                    End If
                End If

                oMainForm.oGlobalPos = objPosition
                If Not checkForCodeAction() Then
                    oMainForm.startThreadCheck()
                End If
            Else
                If Not oMainForm.workerThreadDone Then
                    If oMainForm.prgBarGPS.Value < 10 Then
                        oMainForm.prgBarGPS.Value += 1
                    Else
                        oMainForm.prgBarGPS.Value = 0
                    End If
                End If
            End If

        Catch ex As Exception
            'oMainForm.addToLog(ex.Message)
        End Try
    End Sub
Regards,

Steve

User avatar
johan
GpsGate
Posts: 15400
Joined: Wed Aug 04, 2004 10:40 pm
Location: Sweden
Contact: Website

RE: BT GPS Fix Problem

Mon Jan 09, 2006 7:05 pm

-> This happens at random with our devices.

Can the same very device somethime take a minute and then one hour? Or it is the same devices that performs badly?

Regards,
Johan

Franson Support

dragonsteve
Posts: 16
Joined: Thu Sep 15, 2005 3:50 pm

RE: BT GPS Fix Problem

Tue Jan 10, 2006 10:53 am

Yes the same device can get a fix fast and then take a long time.

User avatar
johan
GpsGate
Posts: 15400
Joined: Wed Aug 04, 2004 10:40 pm
Location: Sweden
Contact: Website

RE: BT GPS Fix Problem

Tue Jan 10, 2006 1:03 pm

The code looks ok. Have you tried some other GPS application under the same circumstances, does that also give those random failures?

GPS receives sometimes perform badly if you hold them in your hand, or if you are to close to them. Also make sure you have a clear sky over the receiver.

Regards,
Johan

Franson Support

dragonsteve
Posts: 16
Joined: Thu Sep 15, 2005 3:50 pm

RE: BT GPS Fix Problem

Tue Jan 10, 2006 1:29 pm

I have also another situation where this happens.

The GPS is used to guide people.
These visitors could also enter a building or place the GPS with PDA somewhere away in there car.
Then the GPS doesn't recieve any more GPS coordinates.
After that the visitor get's the GPS out and again it takes to much time to have a fix.

I have read the following on the site:(Under GPS Gate)

->> More stable GPS connection. In particular to Bluetooth GPS receivers

--------------

So my code is ok, but when I don't get a GPSFix from the GPSTools the program doesn't work.
Normally the BT Recievers that we are using has a pretty good initial fix time.

User avatar
johan
GpsGate
Posts: 15400
Joined: Wed Aug 04, 2004 10:40 pm
Location: Sweden
Contact: Website

RE: BT GPS Fix Problem

Tue Jan 10, 2006 5:50 pm

GpsTools is very much slave under the GPS. If the GPS doesn't give a fix, it is not much GpsTools can do. The solution might be to further investigate the hardware and see if you can see any patterns for when the hardware performs poorly. As mentioned earlier, a GPS you hold in your hand may never get a fix.

Regards,
Johan

Franson Support

Return to “GpsTools”