GPS Tracking System based on ActiveXperts SMS Messaging Server

This case study is available by sending an e-mail to

1. Background

This case study describes a scenario where a customer wants to track a number of trucks using GPS and SMS. SMS is used since the phone network is a very large and robust network that is available almost anywhere. When trucks are only sending out their locations 2 or 4 times per hour it can be a very cost effective solution as well.

This case study shows how to track trucks and plot them on a Google Maps web interface.

2. Problem Statement

A transport company wants to upgrade their fleet management system by incorporating a system which is able to dynamically track the location of their trucks. They need to have the location of their trucks available in real time plotted on a map.

3. Goals of the new System

The system has the following goals:

4. ActiveXperts SMS Messaging Server Solution

Every truck within the company is fitted with an SMS enabled GPS tracking device. These devices will send out SMS messages containing the trucks ID and it's location 4 times every hour.

The SMS Messaging server receives the SMS messages and a Trigger script parses the messages and stores them into the tracking database.

This database is also accessible through a web site. on this web site, GPS coordinates of the trucks are mapped in real-time on a Google Maps image.

GPS demo screenshot

Figure 1: A screen shot of the GPS Demo application

SMS message format

SMS messages format sent from truck to ActiveXperts SMS Messaging Server:

Message body (syntax): [truckid] [latitude] [longitude]
Sample:                5 40.7069943037633 -74.009313583374
Explanation:           Truck sends his identifier number and current latitude/longitude values

Hardware and Software

The system consists of the following:

GPS Tracker database

The GPS Tracker database: GPS Coordinates.mdb

Trucks table:

Coordinates table


A Trigger is called when a new message arrives in the system. GPS Tracking Project only accepts messages via SMS. Since GPS Tracking uses one incoming SMS number, one trigger is defined.

The GPS Coordinates.vbs trigger does the following:

Option Explicit

CONST STR_DATABASEFILE = "C:\\GPS Coordinates.mdb"

Dim g_objMessageDB, g_objConstants

' Creation of global objects
Set g_objConstants      = CreateObject( "Axsms-messaging-server.Constants" )
Set g_objMessageDB      = CreateObject( "Axsms-messaging-server.MessageDB" ) 

' // ========================================================================
' // Function: ProcessMessage
' // ------------------------------------------------------------------------
' // ProcessMessage trigger function to process incoming messages
' // ========================================================================

Function ProcessMessage( numMessageID )
   Dim objMessageIn, objMessageOut

   ' Open the Message Database
   If( g_objMessageDB.LastError <> 0 ) Then
      Exit Function
   End If

   ' Retrieve the message that has just been received. If it fails then exit script 
   Set objMessageIn   = g_objMessageDB.FindFirstMessage( "ID = " & numMessageID ) 
   If g_objMessageDB.LastError <> 0 Then
      Exit Function
   End If

   ' Change Status to from Pending to Success. If you don't do it, the message will 
   ' be processed by subsequent triggers (if defined) because message is still 
   ' pending
   objMessageIn.StatusID = g_objConstants.MESSAGESTATUS_SUCCESS
   g_objMessageDB.Save objMessageIn   

   SaveCoordinate ( objMessageIn )
   ' Close the Message Database
End Function

' // ========================================================================
' // ReplyMessage
' // ------------------------------------------------------------------------
' // Auto reply to every incoming SMS message
' // ========================================================================

Function SaveCoordinate( objMessageIn )
   Dim objMessageOut
   Dim strResponse   
   Dim strResult, strCall
   Dim objConn
   Dim RSResult
   Dim nCount
   Set objConn = CreateObject("ADODB.Connection")
   objConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & STR_DATABASEFILE & ";"
   strResult = Split(objMessageIn.Body)  
   If (UBOUND(strResult) + 1 < 3) Then
    Exit Function
   End If
   Set RSResult = objConn.Execute("SELECT TOP 1 * FROM Coordinates WHERE TruckID='" & _
                  strResult(0) & "' ORDER BY Callnr DESC")
    if ( RSResult.EOF ) Then 
     strCall = 0
     strCall = RSResult ("Callnr")
    end if
   strCall = strCall + 1
   objConn.Execute "INSERT INTO Coordinates (TruckID,Latitude,Longitude,Callnr) VALUES ('" & _
                   strResult(0) & "','" & strResult(1) & "','" & strResult(2) & "'," & _
                   strCall & ")"
End Function