GPS Examples

Example 1. Opening a GPS port.

result = GPS.Open("COM1:", 9600, 8, SP_NOPARITY, SP_ONESTOPBIT, SP_HANDSHAKE_OFF)

IF result <> 0

{

Form.MessageBox("Error", "Could not open port", 0)

}

ELSE

{

Form.MessageBox("Success", "Open", 0)

}

Note:

Example 2. Closing a GPS port.

result = GPS.Close()

IF result <> 0

{

Form.MessageBox("Error", "Could not close port", 0)

}

ELSE

{

Form.MessageBox("Success", "Closed", 0)

}

Note:

Example 3. Reading the GPS data.

str = "Latitude : " & GPS.GetLatitude() & CHAR_NEWLINE

edit_control1 = str

IF GPS.HasValidRead() == true

{

    str = "Latitude : " & GPS.GetLatitude() & CHAR_NEWLINE

    str = str & "Longitude : " & GPS.GetLongitude() & CHAR_NEWLINE

    str = str & "Altitude : " & GPS.GetAltitude() & CHAR_NEWLINE

    str = str & "Speed KM :" & GPS.GetSpeed() & CHAR_NEWLINE

    str = str & "Track Angle : " & GPS.GetTrackAngle() & CHAR_NEWLINE

edit_control1 = str

GPS.Reset()

}

ELSE

{

edit_control1 = edit_control1 & "No valid reading is available !"

}

Note: