
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:
You have to specify the COM port that the GPS device is attached to.
result = GPS.Close()
IF result <> 0
{
Form.MessageBox("Error", "Could not close port", 0)
}
ELSE
{
Form.MessageBox("Success", "Closed", 0)
}
Note:
This will automatically close any GPS connection.
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:
Each GPS data such as the latitude and longitude has its own format thus BrightSoftware has created different methods to get the GPS data.