Click or drag to resize

GpsReceiver Class

Implements the communication with a serial, USB or bluetooth GPS receiver.
Inheritance Hierarchy
SystemObject
  SystemMarshalByRefObject
    System.ComponentModelComponent
      ZylSoft.GpsBaseGpsReceiver
        ZylSoft.GpsGpsReceiver

Namespace: ZylSoft.Gps
Assembly: ZylGpsReceiver (in ZylGpsReceiver.dll) Version: 3.28.8737.22596
XMLNS for XAML: Not mapped to an xmlns.
Syntax
public class GpsReceiver : BaseGpsReceiver, 
	IGpsReceiver

The GpsReceiver type exposes the following members.

Constructors
Properties
 NameDescription
Public propertyActiveRoute The active route.
(Inherited from BaseGpsReceiver)
Public propertyAutoReconnect Set this property to true, if you want to automatically reconnect to the serial port after a Faulted event, when the port is available again. Set AutoReconnect to true, before the port is faulted, otherwise it will have no effect. The default value is false.
Public propertyAutoReconnectCheckInterval The time interval in milliseconds the serial port is trying to periodically reconnect, after a Faulted event occur, if AutoReconnect is set to true. It must be a positive value. The default value is 4000.
Public propertyBaudRate Baud rate at which the communications device operates.
Protected propertyCanRaiseEventsGets a value indicating whether the component can raise an event.
(Inherited from Component)
Public propertyCloseWhenLineStatusIsZero When this property is true and line status becomes 0 (supposing that it was non 0 after the port has been opened), the port will be closed automatically. Set it to true, for improved fault detection. If you have problems with the port closing itself automatically immediately after open, set this property to false. The default value is true.
Public propertyConnectedTo Returns the port where the GPS receiver is connected to.
Public propertyConnectionTime Indicates when the last connection was established.
Public propertyContainerGets the IContainer that contains the Component.
(Inherited from Component)
Public propertyCustomBaudRate Custom baud rate value, used when BaudRate is set to Custom.
Public propertyCustomPortName Custom port name can be used when Port is set to Custom. You can use any name, different from COMMxx.
Public propertyDataWidth Number of bits in the bytes transmitted and received.
Protected propertyDesignModeGets a value that indicates whether the Component is currently in design mode.
(Inherited from Component)
Public propertyEnableDtrOnOpen Enable DTR when the port is opening. The default value is true.
Public propertyEnableRtsOnOpen Enable RTS when the port is opening. The default value is true.
Protected propertyEventsGets the list of event handlers that are attached to this Component.
(Inherited from Component)
Public propertyForceChecksum Enable or ignore checksum checking for NMEA sentences. When this property is true, all the sentences which checksum is not correct will be ignored.
(Inherited from BaseGpsReceiver)
Public propertyHardwareFlowControl Hardware flow control of the serial port.
Public propertyIdleInterval Idle time interval in milliseconds. If the elapsed time from the last receive is higher than IdleInterval, Idle event occurs. If IdleInterval is 0, Idle event never occurs.
Public propertyIdleTimeoutInterval You can set a time-out value to automatically close the connection and fire the IdleTimeout event, if there is no data received in several milliseconds. A value of zero indicates that time-out is not used.
Public propertyInputBuffer Recommended size of the device's internal input buffer, in bytes.
Public propertyInterval Time interval between two receivings in milliseconds (frequency).
Public propertyCode exampleIsFaulted Indicates that the last connection was faulted.
Public propertyIsIdle True if Idle occurred, until Resumed.
Public propertyIsReceiving This property is false when the component is receiving data from the port, otherwise is false. Use this property to check if the component is inside a receiving process.
Public propertyIsSending This property is true when the component is sending data to the port, otherwise is false. Use this property to check if the component is inside a sending process.
Public propertyLastTimeReceived Last date-time when data received from the serial port.
Public propertyLogDateTime When this property is true, a date-time stamp will be added before each logged NMEA sentence.
(Inherited from BaseGpsReceiver)
Public propertyLogFile Name and path of the NMEA log file.
(Inherited from BaseGpsReceiver)
Public propertyLogNmea Enables or disables NMEA logging. If you enable it, all the valid NMEA sentences will be logged to the LogFile.
(Inherited from BaseGpsReceiver)
Public propertyMinCheckDisconnectedInterval The minimum time interval in milliseconds, for which the port availability is checked. For time critical usage it's recommended to set it to a higher value. Default value is 50.
Public propertyNavigationInfo Returns information about the active route.
(Inherited from BaseGpsReceiver)
Public propertyNeedSynchronization Set this property to true for thread safety. The default value is false. Note: if you set it to true, you may experiment thread interblocking and lower speed.
Public propertyNmeaSentencePrefix NMEA sentence prefix. Default value: "$"
(Inherited from BaseGpsReceiver)
Public propertyNmeaSentences Accepted NMEA sentences.
(Inherited from BaseGpsReceiver)
Public propertyNmeaSentenceTerminator NMEA sentence terminator. Default value: ((char)13(char)10)
(Inherited from BaseGpsReceiver)
Public propertyNmeaSentenceTerminator2 Second NMEA sentence terminator. Default value: ((char)13) It is used, if NmeaSentenceTerminator is not found in the sentence.
(Inherited from BaseGpsReceiver)
Public propertyOutputBuffer Recommended size of the device's internal output buffer, in bytes.
Public propertyParityBits Parity scheme to be used.
Public propertyPort Physical name of the serial port where the GPS receiver is connected to.
Public propertyPosition Contains the current position data.
(Inherited from BaseGpsReceiver)
Public propertyPriority Priority of the receiver thread.
Public propertyReceiverStatus Returns status info of the GPS receiver unit.
(Inherited from BaseGpsReceiver)
Public propertySatelliteTypes Accepted satellites.
(Inherited from BaseGpsReceiver)
Public propertySiteGets or sets the ISite of the Component.
(Inherited from Component)
Public propertySkipSetupFailed When this property is true, if setting serial parameters like DCB in the Open method fails, will ignore this. Otherwise method Open will return false and the port will not be opened.
Public propertySoftwareFlowControl Software flow control of the serial port.
Public propertyStopBits Number of stop bits to be used.
Public propertyTrack The current track.
(Inherited from BaseGpsReceiver)
Public propertyWaypoints List of waypoints (List of Waypoint objects).
(Inherited from BaseGpsReceiver)
Top
Methods
 NameDescription
Public methodAddChecksumToNmea Adds checksum to a NMEA sentence (including asterix).
(Inherited from BaseGpsReceiver)
Public methodAddSentenceTerminatorToNmea Adds sentence terminator (usually CR-LF) to an NMEA sentence.
(Inherited from BaseGpsReceiver)
Public methodChecksumOk Checks if the checksum of the sentence is valid.
(Inherited from BaseGpsReceiver)
Public methodClearInputBuffer Clears the input buffer
Public methodClearOutputBuffer Clears the output buffer
Public methodClose Closes the communication with the GPS receiver.
Public methodCreateObjRefCreates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object.
(Inherited from MarshalByRefObject)
Public methodDetectAllGps Detects all the GPS receivers connected to the system and returns in a dictionary the communication port and baud rate. Only baud rate values between startBaudRate and endBaudRate are checked.
Public methodDetectGps(SerialCommPort, SerialBaudRate) Detects the first GPS receiver connected to the system and returns as output parameters the communication port and baud rate.
Public methodDetectGps(String, SerialBaudRate) Detects the first GPS receiver connected to the system and returns as output parameters the communication port and baud rate.
Public methodDetectGps(SerialBaudRate, SerialBaudRate, String, SerialBaudRate) Detects the first GPS receiver connected to the system and returns as output parameters the communication port and baud rate. Only baud rate values between startBaudRate and endBaudRate are checked.
Public methodDetectGps(SerialBaudRate, SerialBaudRate, SerialCommPort, SerialBaudRate) Detects the first GPS receiver connected to the system and returns as output parameters the communication port and baud rate. Only baud rate values between startBaudRate and endBaudRate are checked.
Public methodDisposeReleases all resources used by the Component.
(Inherited from Component)
Protected methodDispose(Boolean) Clean up any resources being used.
(Overrides BaseGpsReceiverDispose(Boolean))
Public methodCode exampleDrawCompass Draws a compass.
(Inherited from BaseGpsReceiver)
Public methodDrawCompassToBitmap Draws a compass to a bitmap.
(Inherited from BaseGpsReceiver)
Public methodCode exampleDrawCompassWithSkin(Graphics, Int32) Draws a compass, using an embedded skin.
(Inherited from BaseGpsReceiver)
Public methodCode exampleDrawCompassWithSkin(Graphics, Image, Int32) Draws a compass, using a custom skin.
(Inherited from BaseGpsReceiver)
Public methodCode exampleDrawCompassWithSkin(Graphics, String, Int32) Draws a compass, using a custom skin.
(Inherited from BaseGpsReceiver)
Public methodDrawCompassWithSkinToBitmap Draws a compass with skin to a bitmap.
(Inherited from BaseGpsReceiver)
Public methodCode exampleDrawSatellites Draws the satellites in view. Red brush satellite - very low signal Orange brush satellite - low signal Yellow brush satellite - medium signal Light green brush satellite - good signal Green brush satellite - very good signal White pen satellite - GPS Orange red pen satellite - GLONASS Yellow pen satellite - BeiDou Blue pen satellite - Galileo Green pen satellite - QZSS Black pen satellite - Unknown
(Inherited from BaseGpsReceiver)
Public methodDrawSatellitesSignal(Graphics, Int32, Int32, Color) Draw the signals of satellites in view. Red brush satellite - very low signal Orange brush satellite - low signal Yellow brush satellite - medium signal Light green brush satellite - good signal Green brush satellite - very good signal
(Inherited from BaseGpsReceiver)
Public methodDrawSatellitesSignal(Graphics, Int32, Int32, Color, Color, Color, Int32) Draw the signals of satellites in view. Red brush satellite - very low signal Orange brush satellite - low signal Yellow brush satellite - medium signal Light green brush satellite - good signal Green brush satellite - very good signal
(Inherited from BaseGpsReceiver)
Public methodDrawSatellitesSignalToBitmap Draw the signals of satellites in view to a bitmap. Red brush satellite - very low signal Orange brush satellite - low signal Yellow brush satellite - medium signal Light green brush satellite - good signal Green brush satellite - very good signal
(Inherited from BaseGpsReceiver)
Public methodDrawSatellitesToBitmap Draws the satellites in view to a bitmap. Red brush satellite - very low signal Orange brush satellite - low signal Yellow brush satellite - medium signal Light green brush satellite - good signal Green brush satellite - very good signal White pen satellite - GPS Orange red pen satellite - GLONASS Yellow pen satellite - BeiDou Blue pen satellite - Galileo Green pen satellite - QZSS Black pen satellite - Unknown
(Inherited from BaseGpsReceiver)
Public methodEqualsDetermines whether the specified object is equal to the current object.
(Inherited from Object)
Public methodFastDetectAllGps Detects all the GPS receivers connected to the system and returns in a dictionary the communication port and baud rate. Only baud rate values between Br004800 and Br921600 are checked.
Public methodFastDetectGps Detects the first GPS receiver connected to the system and returns as output parameters the communication port and baud rate. Only baud rate values between 4800 and 460800 are checked.
Protected methodFeedGpsReceiver Use this method to feed the GPS receiver with NMEA data from the source you wish for classes derived from BaseGpsReceiver.
(Inherited from BaseGpsReceiver)
Protected methodFinalizeReleases unmanaged resources and performs other cleanup operations before the Component is reclaimed by garbage collection.
(Inherited from Component)
Public methodGetAverageSatelliteSnr Returns the average SignalToNoiseRatio of satellites using the highest 4 values.
(Inherited from BaseGpsReceiver)
Public methodStatic memberGetExistingCommPortNames Returns the existing serial port names of the system.
Public methodStatic memberGetExistingCommPorts Returns the existing serial ports of the system.
Public methodGetHashCodeServes as the default hash function.
(Inherited from Object)
Public methodGetLifetimeServiceRetrieves the current lifetime service object that controls the lifetime policy for this instance.
(Inherited from MarshalByRefObject)
Public methodGetNmeaChecksum Returns the checksum of a sentence.
(Inherited from BaseGpsReceiver)
Protected methodGetServiceReturns an object that represents a service provided by the Component or by its Container.
(Inherited from Component)
Public methodGetTypeGets the Type of the current instance.
(Inherited from Object)
Public methodInitializeLifetimeServiceObtains a lifetime service object to control the lifetime policy for this instance.
(Inherited from MarshalByRefObject)
Public methodStatic memberIntToSerialCommPort Converts string to SerialCommPort.
Public methodIsConnected Returns true if the GPS receiver is connected (open), otherwise false.
Public methodStatic memberIsExistingCommPort(SerialCommPort) Checks if a serial port exists.
Public methodStatic memberIsExistingCommPort(String) Checks if a serial port exists.
Protected methodMemberwiseCloneCreates a shallow copy of the current Object.
(Inherited from Object)
Protected methodMemberwiseClone(Boolean)Creates a shallow copy of the current MarshalByRefObject object.
(Inherited from MarshalByRefObject)
Protected methodOnActiveRouteReceived Raises the ActiveRouteReceived event.
(Inherited from BaseGpsReceiver)
Protected methodOnAltitudeChanged Raises the AltitudeChanged event.
(Inherited from BaseGpsReceiver)
Protected methodOnArrival Raises the Arrival event.
(Inherited from BaseGpsReceiver)
Protected methodOnConnected Raises the Connected event.
Protected methodOnCourseChanged Raises the CourseChanged event.
(Inherited from BaseGpsReceiver)
Protected methodOnDetecting Raises the Detecting event.
Protected methodOnDisconnected Raises the Disconnected event.
Protected methodOnFaulted Raises the Faulted event.
Protected methodOnHeadingChanged Raises the HeadingChanged event.
(Inherited from BaseGpsReceiver)
Protected methodOnIdle Raises the Idle event.
Protected methodOnIdleTimeout Raises the IdleTimeout event.
Protected methodOnLatitudeChanged Raises the LatitudeChanged event.
(Inherited from BaseGpsReceiver)
Protected methodOnLongitudeChanged Raises the LongitudeChanged event.
(Inherited from BaseGpsReceiver)
Protected methodOnNewSentenceReceived Raises the NewSentenceReceived event.
(Inherited from BaseGpsReceiver)
Protected methodOnPosition2DChanged Raises the Position2DChanged event.
(Inherited from BaseGpsReceiver)
Protected methodOnPosition3DChanged Raises the Position3DChanged event.
(Inherited from BaseGpsReceiver)
Protected methodOnReceived Raises the Received event.
(Inherited from BaseGpsReceiver)
Protected methodOnReconnecting Raises the Reconnecting event.
Protected methodOnResumed Raises the Resumed event.
Protected methodOnSatelliteReceived Raises the SatelliteReceived event.
(Inherited from BaseGpsReceiver)
Protected methodOnSatellitesReceived Raises the SatellitesReceived event.
(Inherited from BaseGpsReceiver)
Protected methodOnSent Raises the Sent event.
(Inherited from BaseGpsReceiver)
Protected methodOnSpeedChanged Raises the SpeedChanged event.
(Inherited from BaseGpsReceiver)
Protected methodOnUnknownSentenceReceived Raises the UnknownSentenceReceived event.
(Inherited from BaseGpsReceiver)
Protected methodOnWaypointReceived Raises the WaypointReceived event.
(Inherited from BaseGpsReceiver)
Public methodOpen Opens the communication with the GPS receiver.
Public methodReadStringUpToEndChars Reads the serial port up to the first occurrence of one of the endChars sequences of the endCharsList collection. It works only if AutoReceive property is false.
Public methodReset Resets all GPS data to a default value: Position, ReceiverStatus, NavigationInfo, WayPoints, ActiveRoute, Track.
(Inherited from BaseGpsReceiver)
Public methodResetIdleState Resets the idle state of the port.
Protected methodRouteToNmea(Route) Converts a route to NMEA.
(Inherited from BaseGpsReceiver)
Protected methodRouteToNmea(String) Converts a route to NMEA.
(Inherited from BaseGpsReceiver)
Public methodSendAsciiString Sends an ASCII string to the GPS receiver.
Public methodSendByte Sends a byte to the serial port.
Public methodSendByteArray Sends a byte array to the GPS receiver.
Public methodSerialCommPortToString Converts SerialCommPort to string.
Public methodShowOnGoogleMaps(Int32) Displays the current position on Google maps in the default browser.
(Inherited from BaseGpsReceiver)
Public methodStatic memberStringToSerialCommPort Converts string to SerialCommPort.
Public methodTestDevice Tests if the connection is alive.
Public methodToStringReturns a String containing the name of the Component, if any. This method should not be overridden.
(Inherited from Component)
Public methodUploadRoute(Route) It uploads a route.
Public methodUploadRoute(String) It uploads a route.
Public methodUploadWaypoint Uploads a waypoint.
Protected methodWaypointToNmea Converts a waypoint to NMEA.
(Inherited from BaseGpsReceiver)
Top
Events
 NameDescription
Public eventActiveRouteReceived Occurs when the active route is received.
(Inherited from BaseGpsReceiver)
Public eventAltitudeChanged Occurs when the altitude has changed.
(Inherited from BaseGpsReceiver)
Public eventArrival Occurs at the arrival to the destination waypoint.
(Inherited from BaseGpsReceiver)
Public eventConnected Occurs after the GPS receiver is connected.
Public eventCourseChanged Occurs when the course has changed.
(Inherited from BaseGpsReceiver)
Public eventDetecting Occurs when the GPS receiver detection is in progress and there are new values of port or baud rate in view.
Public eventDisconnected Occurs when the GPS receiver is disconnected.
Public eventDisposedOccurs when the component is disposed by a call to the Dispose method.
(Inherited from Component)
Public eventCode exampleFaulted Occurs when the serial port communication is faulted.
Public eventHeadingChanged Occurs when the heading has changed.
(Inherited from BaseGpsReceiver)
Public eventIdle If the elapsed time from the last receive is higher than IdleInterval (milliseconds), Idle event occurs. If IdleTinerval is 0, this event will never occur.
Public eventIdleTimeout Occurs when there is no data received in several milliseconds, the interval is specified in the IdleTimeoutInterval property.
Public eventLatitudeChanged Occurs when the latitude has changed.
(Inherited from BaseGpsReceiver)
Public eventLongitudeChanged Occurs when the longitude has changed.
(Inherited from BaseGpsReceiver)
Public eventNewSentenceReceived Occurs when a new valid NMEA sentence is received. The sentence parameter contains the sentence.
(Inherited from BaseGpsReceiver)
Public eventPosition2DChanged Occurs when latitude or longitude has changed.
(Inherited from BaseGpsReceiver)
Public eventPosition3DChanged Occurs when latitude or longitude or altitude has changed.
(Inherited from BaseGpsReceiver)
Public eventReceived Occurs when data was received.
(Inherited from BaseGpsReceiver)
Public eventReconnecting Occurs when the serial port connection was lost (faulted) and tries to reconnect. AutoReconnect must be true.
Public eventResumed Occurs when the receiver is idle and data is received.
Public eventSatelliteReceived Occurs when a satellite is received.
(Inherited from BaseGpsReceiver)
Public eventSatellitesReceived Occurs when a list of all satellites in view is received.
(Inherited from BaseGpsReceiver)
Public eventSent Occurs when data was sent.
(Inherited from BaseGpsReceiver)
Public eventSpeedChanged Occurs when the speed has changed.
(Inherited from BaseGpsReceiver)
Public eventUnknownSentenceReceived Occurs when a valid, but unknown NMEA sentence is received. The sentence parameter contains the unknown sentence. This event is fired only if you set NmeaSentences property to All and there is an unknown sentence received. In this case you can write your own processing code inside this event handler.
(Inherited from BaseGpsReceiver)
Public eventWaypointReceived Occurs when a waypoint is received.
(Inherited from BaseGpsReceiver)
Top
Extension Methods
 NameDescription
Public Extension MethodCode exampleDrawCompassToWpfCanvas Draws a compass to WPF canvas.
(Defined by BaseGpsReceiverWpfExtensions)
Public Extension MethodCode exampleDrawCompassWithSkinToWpfCanvas Draws a compass, using an embedded skin to WPF canvas.
(Defined by BaseGpsReceiverWpfExtensions)
Public Extension MethodCode exampleDrawCompassWithSkinToWpfCanvas Draws a compass, using a custom skin to WPF canvas.
(Defined by BaseGpsReceiverWpfExtensions)
Public Extension MethodDrawSatellitesSignalToWpfCanvas Draw the signals of satellites in view to WPF canvas. Red brush satellite - very low signal Orange brush satellite - low signal Yellow brush satellite - medium signal Light green brush satellite - good signal Green brush satellite - very good signal
(Defined by BaseGpsReceiverWpfExtensions)
Public Extension MethodDrawSatellitesSignalToWpfCanvas Draw the signals of satellites in view to WPF canvas. Red brush satellite - very low signal Orange brush satellite - low signal Yellow brush satellite - medium signal Light green brush satellite - good signal Green brush satellite - very good signal
(Defined by BaseGpsReceiverWpfExtensions)
Public Extension MethodCode exampleDrawSatellitesToWpfCanvas Draws the satellites in view to WPF canvas. Red brush satellite - very low signal Orange brush satellite - low signal Yellow brush satellite - medium signal Light green brush satellite - good signal Green brush satellite - very good signal White pen satellite - GPS Orange red pen satellite - GLONASS Yellow pen satellite - BeiDou Blue pen satellite - Galileo Green pen satellite - QZSS Black pen satellite - Unknown
(Defined by BaseGpsReceiverWpfExtensions)
Top
Remarks
Events are raised on a secondary thread when data is received. Because these events are raised on a secondary thread, and not the main thread, attempting to modify some elements in the main thread, such as UI elements, could raise a threading exception. If it is necessary to modify elements in the main Form or Control, post change requests back using Invoke (or BeginInvoke to avoid deadlock), which will do the work on the proper thread.
See Also