www.pudn.com > mo_gps.zip > GSA.cls


VERSION 1.0 CLASS 
BEGIN 
  MultiUse = -1  'True 
END 
Attribute VB_Name = "GPGSA" 
Attribute VB_GlobalNameSpace = False 
Attribute VB_Creatable = True 
Attribute VB_PredeclaredId = False 
Attribute VB_Exposed = False 
Attribute VB_Ext_KEY = "SavedWithClassBuilder" ,"Yes" 
Attribute VB_Ext_KEY = "Top_Level" ,"Yes" 
'Class name:    GSA.cls 
'Author:        Ray Bivens, Applications Prototype Lab, ESRI 
'Date:          Dec 98 
'Description:   Factors an NMEA (GPS) 'GPGSA' sentence to its string components. 
'Comments:      Create an instance of the class and assign a GPGSA string to the 
'               Sentence property. 
' 
'Revisions: 
 
Option Explicit 
 
'local variables to hold property values 
Private mvarPosFixIDs As Collection 
Private mvarMode As String 
Private mvarFixStatus As String 
Private mvarPDOP As String 
Private mvarVDOP As String 
Private mvarHDOP As String 
Private mvarSentence As String 
Private mvarChecksum As String 
 
Public Enum GPGSAError 
    InvalidOrCorruptGPGSA = vbObjectError + 512 + 2 
End Enum 
 
Public Property Let Sentence(ByVal GSA_Sentence As String) 
Attribute Sentence.VB_Description = "Sets/Returns NMEA sentence for object." 
    Dim Utils As New CParseUtils 
     
        'check for correct header and number 
        'of place holders in sentence first... 
        If Utils.Parse(GSA_Sentence, 1) = "$GPGSA" And Utils.CountParts(GSA_Sentence) = 18 Then 
         
            Dim PosFixColl As New Collection 
            Dim sMode As String 
            Dim sFixStatus As String 
            Dim sPDOP As String 
            Dim sVDOP As String 
            Dim sHDOP As String 
            Dim sChecksum As String 
            Dim sPosID As String  'use this var for each of the positional IDs... 
            Dim sTempChecksum As String 
            Dim sTempVDOP As String 
             
            ' assign value to local variable... 
            mvarSentence = GSA_Sentence 
             
            ' parse NMEA sentence and check quality 
            ' if qc conditions not met, leave var as empty... 
            sMode = Utils.Parse(mvarSentence, 2)        'mode 
            mvarMode = sMode 
       
            sFixStatus = Utils.Parse(mvarSentence, 3)   'fix status 
                If IsNumeric(sFixStatus) Then 
                    mvarFixStatus = sFixStatus 
                End If 
             
            sPDOP = Utils.Parse(mvarSentence, 16)       'PDOP 
                If IsNumeric(sPDOP) Then 
                    mvarPDOP = sPDOP 
                End If 
                 
             
            sHDOP = Utils.Parse(mvarSentence, 17)       'HDOP 
                If IsNumeric(sHDOP) Then 
                    mvarHDOP = sHDOP 
                End If 
         
            sTempVDOP = Utils.Parse(mvarSentence, 18)   'VDOP 
            sVDOP = Utils.Parse(sTempVDOP, 1, "*") 
                If IsNumeric(sVDOP) Then 
                    mvarVDOP = sVDOP 
                End If 
             
            sTempChecksum = Utils.Parse(mvarSentence, 18) 'checksum 
            sChecksum = Utils.Parse(sTempChecksum, 2, "*") 
            mvarChecksum = sChecksum 
                 
            ' Loop through the NMEA string to find all of the 
            ' sats that are used in the position fix... 
            Dim bCount As Integer 
             
            For bCount = 4 To 15 
                sPosID = Utils.Parse(mvarSentence, bCount) 
                    If Len(sPosID) <> 0 Then 
                        PosFixColl.Add sPosID 
                    End If 
            Next bCount 
            Set mvarPosFixIDs = PosFixColl 
                 
        Else 
            Err.Raise InvalidOrCorruptGPGSA, "GPGSA::Sentence", "Invalid or corrupt GPGSA sentence." 
        End If 
         
    Set Utils = Nothing 
    Set PosFixColl = Nothing 
     
End Property 
 
Public Property Get Sentence() As String 
    Sentence = mvarSentence 
End Property 
 
Public Property Get Checksum() As String 
Attribute Checksum.VB_Description = "Returns the checksum of the NMEA string." 
    Checksum = mvarChecksum 
End Property 
 
Public Property Get HDOP() As String 
Attribute HDOP.VB_Description = "Returns the Horizontal Dilution of Precision of the object." 
    HDOP = mvarHDOP 
End Property 
 
Public Property Get VDOP() As String 
Attribute VDOP.VB_Description = "Returns the Vertical Dilution of Precision of the object." 
    VDOP = mvarVDOP 
End Property 
 
Public Property Get PDOP() As String 
Attribute PDOP.VB_Description = "Returns the Positional Dilution of Precision of the object." 
    PDOP = mvarPDOP 
End Property 
 
Public Property Get FixStatus() As String 
Attribute FixStatus.VB_Description = "1 = Fix unavailable; 2 = 2D Fix; 3 = 3D Fix." 
    FixStatus = mvarFixStatus 
End Property 
 
Public Property Get Mode() As String 
Attribute Mode.VB_Description = "Returns GPS mode of operation (M = Manual, forced to operate in 2D or 3D mode; A = Automatic)" 
    Mode = mvarMode 
End Property 
 
Public Property Get PosFixIDs() As Collection 
Attribute PosFixIDs.VB_Description = "Returns a collection of IDs of the satellites being used for a positional fix." 
    Set PosFixIDs = mvarPosFixIDs 
End Property