GPSDevice (CPIK Libraries)

Contents

GPSDevice #

Overview #
This class should be used when GPS position is being received via an external device. If using an external device this class can be used to update the GPS position using locations or NMEA sentences. If internal device GPS receiver is being used this class is not required. This class cannot be used to supplement the GPS position.
Android Support
>=9.6.0.821
Type
Class
Package
com.alk.cpik.guidance
Methods #
Method Name Return Type Description
open()
void
CoPilot is capable of receiving GPS Locations externally. This is useful when using a non-integrated GPS device.
open(Boolean)
void
Opens a GPS device and causes CoPilot to stop listening for GPS updates. After it is opened, a device can be sent location updates via the update() calls.
close()
void
Restores CoPilot to its default state of listening to an internal GPS device. To be called when external GPS locations are done being sent.
sendGPSLocation(Location)
void
Sends a GPS location into CoPilot.Open() must be called prior to sending any locations.
sendGPSLocation(Coordinate)
void
Sends a GPS location into CoPilot.Open() must be called prior to sending any locations.
sendNMEASentence(String)
void
Sends an NMEA sentence into CoPilot.Open() must be called prior to sending any sentences using this API.
sendNMEASentenceWithOverride(String,double)
void
Sends an NMEA sentence in to CoPilot.Open() must be called prior to sending any sentences using this API.

GPSDevice.open #

Overview #
Opens a GPS device and causes CoPilot to stop listening for GPS updates. After it is opened, a device can be sent location updates via the update() calls. This is unnecessary if we have configured a build to exclusively accept external GPS input. This call will disable tunnel mode.
Android Support
>=9.6.0.821
Type
Method
Package
com.alk.cpik.guidance
Syntax #
void open()
Sample Code #
// Get the GPS device
GPSDevice gpsDevice = GuidanceMgr.getGPSDevice();

// Open the GPS device
// Note: This will disable tunnel mode!
gpsDevice.open();
  • GPSDevice.close()
  • GPSDevice.sendGPSLocation()
  • GPSDevice.sendNMEASentence()
  • GPSDevice.sendNMEASentenceWithOverride()

GPSDevice.open (boolean) #

Overview #
Opens a GPS device and causes CoPilot to stop listening for GPS updates. After it is opened, a device can be sent location updates via the update() calls. This is unnecessary if we have configured a build to exclusively accept external GPS input.
Android Support
>=9.6.0.821
Type
Method
Package
com.alk.cpik.guidance
Syntax #
Parameters #

boolean disableTunnelMode - Whether or not to disable tunnel mode.

Sample Code #
  • GPSDevice.close()
  • GPSDevice.sendGPSLocation()
  • GPSDevice.sendNMEASentence()
  • GPSDevice.sendNMEASentenceWithOverride()

GPSDevice.close #

Overview #
Restores CoPilot to its default state of listening to an internal GPS device. To be called when external GPS locations are done being sent.
Android Support
>=9.6.0.821
Type
Method
Package
com.alk.cpik.guidance
Syntax #
Sample Code #
  • GPSDevice.open()
  • GPSDevice.sendGPSLocation()
  • GPSDevice.sendNMEASentence()
  • GPSDevice.sendNMEASentenceWithOverride()

GPSDevice.sendGPSLocation (Send a Location) #

Overview #
Sends a GPS location into CoPilot. Open() must be called prior to sending any locations.
Android Support
>=9.6.0.821
Type
Method
Package
com.alk.cpik.guidance
Syntax #
Parameters #

Location - An object with the information about the current position.

Sample Code #
  • GPSDevice.open()
  • GPSDevice.close()
  • GPSDevice.sendNMEASentence()
  • GPSDevice.sendNMEASentenceWithOverride()

GPSDevice.sendGPSLocation (Send a Coordinate) #

Overview #
Sends a GPS coordinate into CoPilot. Open() must be called prior to sending any coordinate.
Android Support
>=9.6.0.821
Type
Method
Package
com.alk.cpik.guidance
Syntax #
Parameters #

Location - An object with the information about the current position.

Sample Code #
  • GPSDevice.open()
  • GPSDevice.close()
  • GPSDevice.sendNMEASentence()
  • GPSDevice.sendNMEASentenceWithOverride()

GPSDevice.sendNMEASentence (NMEA String) #

Overview #
Sends an NMEA sentence into CoPilot. Open() must be called prior to sending any locations.
Android Support
>=9.6.0.821
Type
Method
Package
com.alk.cpik.guidance
Syntax #
void sendNMEASentence(String)
Parameters #

Sentence - The NMEA sentence to send to CoPilot.

Sample Code #
// Get the GPS device
GPSDevice gpsDevice = GuidanceMgr.getGPSDevice();
boolean disableTunnelMode = false;
// Open the GPS device, but don't disable tunnel mode
gpsDevice.open(disableTunnelMode);
// Send a NMEA sentence as an update
String sentenceString = "$GPRMC,123519,A,4807.038,N,01131.000,E,022.4,084.4,230394,003.1,W*6A";
try{
  gpsDevice.sendNMEASentence(sentenceString);
}catch(GuidanceException e){
  e.printStackTrace();
}

GPSDevice.sendNMEASentenceWithOverride (String, double) #

Overview #
Sends an NMEA sentence into CoPilot. Open() must be called prior to sending any sentences using this API. The double is used to override the speed in the input sentence with another value.
Android Support
>=9.6.0.821
Type
Method
Package
com.alk.cpik.guidance
Syntax #
Parameters #

String - NMEA sentence to send.

Double - Speed, in miles per hour, to override.

Sample Code #
  • GPSDevice.open()
  • GPSDevice.close()
  • GPSDevice.sendGPSLocation()
  • GPSDevice.sendNMEASentence()
Last updated July 20, 2021.