It is easy to create an Event Notifier to signal a custom server over HTTP when something happens in GpsGate VehicleTracker. You can for example let GpsGate send a signal to your business system when a vehicle enters a geofence, a driver presses SOS, a driver logs in using an IButton or if any other conditions using Event Rules are true.
This blog assumes you are familiar with GpsGate VehicleTracker and that you have setup Event Rules before. If you feel a bit uncertain about that, please check out the GpsGate Server documentation to start with.
How to setup the event Notifier
In step 5. in the Event Rules Wizard add a “Command” Notifier.
Select “Custom Server” in the first drop down.
Let the second drop down keep its value “_ExternaNotification”.
Select “http” in the third drop down.
And finally enter the URL to your custom server in the “URL” text field, e.g. http://yourserver.com/yourpage.aspx
Now save your Event Rule. When the Event Rule turns true GpsGate will make a HTTP GET to the URL you specified.
What the HTTP request looks like
GpsGate makes a HTTP GET to the custom server when the Event Rule is true. The URL will contain all information you need about the event. Here is an example of a SOS signal:
http://yourserver.com/yourpage.aspx?cmd=_ExternalNotification&SIGNAL_SOS=true&RULE_NAME=SOS&EVENT_TIME=2010-10-03T15:02:56&EVENT_DURATION=0&USER_USERNAME=johan&USER_NAME=johan&USER_DESCRIPTION=&POS_TIME=2010-10-03T15:02:55&POS_LATITUDE=59.28687&POS_LONGITUDE=18.08927&POS_HEADING=275&POS_ADDRESS=Nyn%C3%A4sv%C3%A4gen%20303-305,%20122%2034%20Stockholm,%20Sweden
The value of all GpsGate Variables used in evaluating the event will be included in the URL. They will be named SIGNAL_NAME, where name is the upper case variable name.
The following variables are always included in the URL: RULE_NAME, EVENT_TIME, EVENT_DURATION, USER_USERNAME, USER_NAME, USER_DESCRIPTION, POS_TIME, POS_LATITUDE, POS_LONGITUDE, POS_HEADING, POS_ADDRESS
If geofence expressions are used you find the geofence name in the variable GEOFENCE_NAME.
Reply to HTTP request
Your server must return a plain text “OK”. Any other kind of reply will be considered to be an error.
Trouble shooting
You can see the status of the notifier in the “Queue Viewer”. Login to SiteAdmin and take a look under Terminal -> Queue Viewer -> Commands. If you don’t have a login to SiteAdmin, please ask your GpsGate Server administrator to enable the Terminal in your VehicleTracker application.
If the HTTP GET fails, GpsGate will retry in 2 minutes, and then every 15 minutes for about 8 hours before there is a permanent failure. The most common problems are that you don’t return a plain text “OK”, the specified URL is wrong or you have an exception in the receiving web page. In most cases the Queue Viewer will give you the information you need to resolve the problem.
Related stuff
The Command notifier can also send outgoing commands using TCP, in which case it uses the GpsGate Protocol. It can also be used to send back Template Commands to a GPS tracker.
When playing around with Event Rules it is a great help to use SimOne. SimOne is a tracker (GpsGate TrackerOne) simulator you can run from your Windows desktop. It enables you to send position reports including signals to your GpsGate Server installation and examine the outcome.
You can download SimOne on the GpsGate Server download page.
For more info on Event Rules take a look at GpsGate VehicleTracker Tips & Trix .







