bg

GPS tracker: Redirecting data from a GPS tracker to another server, changing the format into ASCII

Task:

It is necessary to receive data packets from the vehicle GPS tracker and send them to another server for further processing. The other server (other software) supports only one data format, and it is impossible to connect other trackers to it directly. It means that GPS Tracker Data Logger will run as a converter in this case. The other server can receive information packets in the ASCII format and does not require authentication. Sample information packet:

IMEI,yyyymmddhhnnss,lon.llllll,lat.llllll,speed,dir,000alt,sat,RID,In,Out,A1.in,A2.in<CR><LF>
  1. IMEI - device ID.
  2. Year month date hours minutes seconds.
  3. Longitude and latitude in degrees and their decimals.
  4. Velocity (kph).
  5. Direction (degrees).
  6. Altitude (m).
  7. Number of satellites.
  8. Unknown parameter RID.
  9. 1+2+4+8-bit digital input.
  10. Digital outputs.
  11. Two analog inputs (voltage in volts).
  12. All that ends with a carriage return and a new line.

Requirements:

  • GPS Tracker Data Logger Enterprise or the trial version.
  • Parser for any tracker.
  • Script Execute plugin for Data Logger.
  • Data Redirecting plugin for the logger.
  • DDE server plugin for the logger (optional, for testing purposes).

It is assumed that:

  1. You have configured the parameters of connecting to the device and the parser for the vehicle GPS tracker the way it is described in this article;
  2. You have configured the TCP/IP connection with the other server the way it is described in this article.

Solution:

After you configure and test the parser with the help of DDE, you can get down to configuration.

1. It is necessary to generate a new data packet for redirecting. You can do it with the filtering "Script Execute" plugin. This plugin allows you to specify the script that will be called for every data packet the parser single out and processes. The parser for Teltonika trackers is used in this example. This parser has a set of variables it splits a data packet into. These variables will be used in the script.

2. Enable the "Data Redirecting" plugin. The "Data Redirecting" plugin must be below the "Script Execute" plugin in the list (fig. 1).

Note: The program can redirect only that data from the GPS tracker that the parser supports and processes. For example, if the tracker sends several types of packets and the parser processes only one of them, you will be able to redirect only that one packet.

GPS tracker. Selecting data filter plugins.
Fig.1. GPS tracker. "Data Redirecting" plugin configuration.

Writing the script

The "Script Execute" plugin allows you to write the script in several scripting languages. The script in the Pascal language will be used in this tutorial (fig. 2).

GPS tracker. Script.
Fig.2. GPS tracker. Script.

Full script source:

This script uses the GetVariable variables to get the values of the variables prepared by the parser, formats them and generates a new data packet. The new data packet in the ASCII format ready to be redirected is added to existing parser variables with the help of the SetVariable function under the name ASCII_DATA_PACKET. Values absent in the parser variables are replaced with their default values. If there are no device ID or date values among the parser variables, this data packet is ignored.

It is easy to see that script variables of the sDate_Name:string = 'TIMESTAMP_UTC'; type are used to specify the name of a parser variable that will be later used in the script body.

Redirecting the data

To configure the "Data Redirecting" plugin (fig.3), select it in the list and click the "Configure" button under the list.

GPS tracker. Configuring the Data redirecting plugin.
Fig.3. GPS tracker. "Data Redirecting" plugin configuration.

  1. Specify the name of the variable data from which will be redirected;
  2. Specify the destination IP address and port the way it is displayed in the program's main window.

Now you have to save all the changes. To do it, close all dialog boxes by clicking the "OK" button.

After data is received from the GPS tracker, you will see information about the data being redirected in the message log of the program (fig. 3).

GPS tracker. Data redirection message.
Fig.3. GPS tracker. Data redirection message.

If you switch to the TCP client configuration (fig. 4) in the program's main window, you will be able to see the data being redirected.

GPS tracker. Data being redirected.
Fig.4. GPS tracker. Data being redirected.

Related articles: GPS tracker: Redirecting data from a GPS tracker to another server, changing the format into ASCII

Installation

Configuration

GPS Tracker Data Logger - Read more about:

NMEA logger GPS tracker logger Data Logger Suite