Script for geofences

The scripting language contains functions for working with geofences and operators for sending commands via GPRS channel. This publication provides two examples of using the scripting language for working with geofences.

Positioning frequency in a certain zone

Get geofence ident and create a script

Suppose you need to set the positioning frequency in a certain zone (1234) with a frequency of 60 seconds, and outside - 10 seconds. This task can be solved by the following script (for example, a tracker is working by Coban protocol):

 LET CURRENT_ZONE = @INZONE 1234
IF @NOTEXIST SAVED_ZONE THEN LET SAVED_ZONE = CURRENT_ZONE
IF CURRENT_ZONE == SAVED_ZONE THEN RETURN
IF CURRENT_ZONE == 1 THEN COMMAND "**,imei:%IMEI,C,60s" ELSE COMMAND "**,imei:%IMEI,C,10s"
LET SAVED_ZONE = CURRENT_ZONE

Creating an event when the object has over speed in a certain geofence

Suppose you need to create an event when the object has over speed in a certain geofence. This can be done using the following script:

 LET CHECK_ZONE = @INZONE 1234
LET SPEED_IN_ZONE = V * CHECK_ZONE
IF SPEED_IN_ZONE > 100 THEN EVENT "Overspeed in Zone X"

For this event, you can define notifications and receive information on a smartphone or by email.