Script Engine for Device Payload Mapping
Using the Protocol Setup menu in the Console, you can configure protocol settings required for defining protocol channels for using mapping scripts.
The scripts can be uploaded on per tenant basis. It is possible to allocate mapping scripts to one or more Device Types and Protocols.
Adding a protocol setup
- In the top right of IMPACT Console, click Settings >
Protocol Setup.
The Protocol Setups window is displayed.
- Click Add Protocol Setup.
The Data Transformation Protocol tab is displayed.
The script is added per Manufacturer and Model or Protocol. The above snapshot is using Generic as Manufacturer and Sensor as Model. Ideally the real manufacturer and model must be preloaded before setting up the protocol script.
Each script is mapped to a manufacturer and model or to a specific protocol. You can just define the Protocol alone while adding a script as in the following screen shot.
The script can be edited from the Console or uploaded.
Working with transformation scripts
Scripts are uploaded using the Console as a zip file.
Create, Read, Update, and Delete operations can be performed on scripts. They are stored in the database.
Creating scripts
Scripts must have an unique name and also the Manufacturer and Model fields. They constitute the primary keys for creating scripts. Scripts can be provided in the following ways:
The codec()
and util()
scripts must be written in the
String format.
When an upload operation is to be performed, the main script must have a file name as,
codec.js
or encode.js
. Whereas, the utility script
must have a file name as, util.js
or utility.js
.
For more information on example transformation scripts, see the section Sample scripts.
Editing the transformation scripts
You can edit the script anytime to add some more conditions to your script.
The device Name, Manufacturer,
Model and Protocol fields cannot be
updated once created. However, the codec()
and the
utility()
scripts can be updated and uploaded as a zip file.
Editing and deleting the transformation scripts
The Data Transformation Protocol tab displays the list of Transformation scripts available. These scripts can be edited or deleted.