Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. On the Main tab, click Execution Plans.
  2. Click Add Execution Plan.
  3. Copy the execution plan that is given below and replace the sample content that is in the text box.

    Code Block
    @Plan:name('analze_battery_level')
    @Import('org.wso2.iot.DeviceInfoStream:1.0.0')
    define stream inputStream (meta_deviceId string, meta_deviceType string, timeStamp long, imei string, imsi string, deviceModel string, vendor string, osVersion string, osBuildDate string, batteryLevel double, totalInternalMemory double, availableInternalMemory double, totalExternalMemory double, availableExternalMemory double, operator string, connectionType string, mobileSignalStrength double, ssid string, cpuUsage double, totalRAM double, availableRAM double, pluggedIn bool);
    
    @Export('org.wso2.iot.BatteryStream:1.0.0')
    define stream outputStream (meta_deviceId string, meta_deviceType string, meta_timestamp long, level double, year int, month int, day int, hour int, minute int);
    
    from inputStream
    select meta_deviceId, meta_deviceType, timeStamp as meta_timestamp, batteryLevel as level, time:extract(time:timestampInMilliseconds(), 'year') as year, time:extract(time:timestampInMilliseconds(), 'day') as day, time:extract(time:timestampInMilliseconds(), 'hour') as hour, time:extract(time:timestampInMilliseconds(), 'minute') as minute insert into outputStream;
    
    
  4. Click Add Execution Plan.

Try it out


What's next