Za'atar Digital

eServices for the rest of us

User Tools

Site Tools


gpskit:docs:zdgpskit:easydeviceconnection

EasyDeviceConnection

Type Class
Super Object
Namespace zdGPSKit

This is a wrapper class used to “automagically” build a connection with a GPS device. It handles the setup of a NMEA serial connection, a Simple Text Output serial connection, or a user implemented protocol if you provide your own implementation of the zdGPSKit.DataProvider and the zdGPSKit.DataListener interfaces.

Once set up, you just call the Open() method to start the communication with the GPS device.


Events


Closed

Syntax
Closed

Raised whenever the connection is closed.

Error

Syntax
Error( inErrorCode As Integer )
Parameter
inErrorCode The code of the error from the DataProvider.

Methods


BuildNMEAConnection

Build a NMEA serial connection with your device. It creates the GPS data provider and the GPS data listener and register the listener to the provider.

You have to call the Open() method to start the communication with the GPS device.

There is two syntax for this method.

Syntax
BuildNMEAConnection( inSerialPort As SerialPort )
Parameters
inSerialPort The SerialPort to connect with.

This is the simple version. Give it a serial port to connect to, and it will setup the serial connection with the NMEA standard parameters:

  • 4800 b/s (bit per second rate)
  • 8 bits of data
  • no parity
  • one stop bit
Syntax
BuildNMEAConnection( inSerialPort As SerialPort, inBaud As Integer, inBits As Integer, inParity As Integer, inStopBits As Integer )
Parameters
inSerialPort The SerialPort to connect to.
inBaud The data rate. See Serial.Baud for values.
inBits The number of bits. See Serial.Bits for values.
inParity The parity. See Serial.Parity for values.
inStopBits The number of stop bits. See Serial.Stop for values.

This is the customizable version. Use the parameters to match those of your device serial communication.

BuildTextConnection

Syntax
BuildTextConnection( inSerialPort As SerialPort )
Parameters
inSerialPort The SerialPort to connect with.

It builds a serial connection with the GPS Device for the Simple Text Output protocol. It creates the GPS data provider and the GPS data listener and register the listener to the provider.

You have to call the Open() method to start the communication with the GPS device.

Close

Syntax
Close()

Close the connection and raise the Closed event.

GPSDataProvider

Syntax
GPSDataProvider As zdGPSKit.DataProvider

Return a reference to the data provider. Returns Nil if there is no data provider.

GPSFixProvider

Syntax
GPSFixProvider As zdGPSKit.FixProvider

Return a reference to the current fix provider. Returns Nil if there is no fix provider.

IsConnected

Syntax
IsConnected() As Boolean

Returns True if the device is currently connected and False otherwise.

LastErrorCode

Syntax
LastError() As Integer

Returns the last error code from the data provider.

NMEAParser

Syntax
NMEAParser() As zdGPSKit.NMEA.Parser

Returns a reference to the current zdGPSKit.NMEA.Parser. If none is available, then it returns Nil.

Open

Syntax
Open() As Boolean

Open the previously built connection. Returns True if the connection is successful and False if it failed. Use the LastErrorCode method to get more information.

This method may raise a zdGPSKit.GPSKitException if you haven't build a proper connection prior to opening the connection.

SetupConnection

Syntax
SetupConnection( inProvider As zdGPSKit.DataProvider, inListener As zdGPSKit.DataListener )
Parameters
inProvider Your customized zdGPSKit.DataProvider
inListener Your customized zdGPSKit.DataListener

Use this method with your own implementation of the zdGPSKit.DataProvider and zdGPSKit.DataListener interface.

After using this method, you have to call Open() method in order to start the communication with the GPS device.

TextOutputParser

Syntax
TextOutputParser() As zdGPSKit.SimpleTextOutput.Parser

Returns a reference to the current text output parser. If none is available, then return Nil.

Properties

UseUnthreadedDataProvider

Syntax
UseUnthreadedDataProvider As Boolean

Set this property to True if you want to use the unthreaded version of the serial data Provider ( when available ).

Change this property value before calling the BuildNMEAConnection, BuildTextConnection or SetupConnection methods.
gpskit/docs/zdgpskit/easydeviceconnection.txt · Last modified: 2016/02/08 15:09 (external edit)