In this series of publications, the scripting language integrated into the
ViaLatM service will be described.

ViaLatM scripting language allows you to:
- Create new parameters based on messages coming from devices
- Perform logical processing of events occurring in devices
- Generate new system events
- Send commands to devices
- Relay device messages to external systems
The scenario can be applied both to a separate device (already available in the service) and to an account with all its resources: trackers, geofences, ... (in the process of testing).
')
Using the scripting language allows you to simplify and unload the interface of the application and configure it for specific use cases of personal monitoring and transport monitoring services.
The main elements of the scripting language: variables, functions, operators, commands, events.
Variables
Variables are used when working with device messages. Based on data from incoming messages and applying formulas to them, you can create new variables that will be available for display in the application and use in the scripting language.
Examples:
Fuel gauge reading: X1;
Fuel in the tank: FUEL = LINEAR (X1,0,0,1000,40);
Distance: DIST = DISTANCE (L, UNIT.L);If after the variable identifier follows the sign ";" (no assignment operation), this means that it corresponds to the message parameter coming from the device (X1 is an analog sensor connected to the fuel tank).
The list of variables sent by a particular device depends on the type of device and its settings. Information on variable identifiers sent by various types of devices is in the section
"Variables - Attributes of Objects" .
Functions
In addition to standard mathematical functions, the language has built-in functions for working with telematic data. For example:
Calculate the distance between two points of locations -
DISTANCE .
Argument conversion by linear function -
LINEAR . In the simplest cases, it can be used as a calibration function for calculating the fuel in the tank using sensors.
The list of available functions in the section -
Functions .
The list will be significantly expanded, especially in terms of working with telematic data. For example, among the candidates for the implementation is the
TIME_OF_DAY function, which allows you to get the time of day based on the current location of the event.
Usage example
Not all devices give data on acceleration or total mileage. For such devices, you can fill this in using the ViaLatM scripting language. In the panel “Setting variables and script” the following lines are added:
Acceleration: ACCELERATION = (V-UNIT.V) / (DT-UNIT.DT);
Mileage: ODOM = VARDEF (UNIT.ODOM, 0) + DISTANCE (L, UNIT.L);
As a result, two additional attributes “Acceleration” and “Mileage” appear in the device panel “Organizer of the tooltip window”. When selected, they will be displayed in the tooltip window (when you click on the device icon). They also become available in the "Graph by Parameters" reports and you can get graphs from them.

The following publications will continue the description of the script language ViaLatM