top of page

Scripting with rIoT Engine

In rIoT Engine, you can use .Net scripting language to manipulate data before sending to the server platforms. In addition, you can use scripting to create new data sources. For example, if you like to monitor memory resource of a host machine, you can use scripting to acquire that information and write into the scripting streams.

To add a scripting client, right click on Devices: Clients, Scripting and add a new scripting device. Once the device is created, you need to add a scripting stream. To add a scripting stream, right client on the scripting device and add a new stream.

Now, we need to add scripts to manipulate scripting streams. Complete instructions for writing scripts are defined in other documents. Here are two simple examples to demonstrate how scripting works:

Example 1: Pushing a constant number to the scripting stream:


Interface.SetScriptingStreamValue("Sc1", "St1", 1234);

In this example, value 1234 is pushed to stream St1 of device Sc1.

Example 2: Creating a sine wave and pushing to the scripting stream:


double y = ((Environment.TickCount / 1000) % 60) * Math.PI * 2 / 60;

double sinY = Math.Sin(y);

Interface.SetScriptingStreamValue("Sc1", "St1", sinY);

This listing creates a sine wave with the period of one minute. Here is the trend in the cloud service:

TIP: You can see the script errors in the runtime by clicking on the script when the Explorer is connected to the Engine. For example, if we change double sinY = Math.Sin(y); to double sinY = Math.Sine(y); the following error appears next to the script properties:


Featured Posts
Recent Posts
Search By Tags
Follow Us
  • Facebook Basic Square
  • Twitter Basic Square
  • Google+ Basic Square
bottom of page