Virtual resources are an important piece of Octave applications.
Octave’s documentation shows exemples of JSON virtual resources used to store multiple values like the current state of your device, in order to use it later on the edge or on the cloud. For example:
function(event) {
var temperature = Datahub.read("/redSensor/imu/temp/value",0).value;
var pressure = Datahub.read("/redSensor/pressure/value",0).value;
var lat = 0;
var lon = 0;
var pos = Datahub.read("/location/coordinates/value",0);
if (pos) {
lat = pos.lat;
lon = pos.lon
}
var light = Datahub.read("/redSensor/light/value",0).value;
var bars = Datahub.read("/util/cellular/signal/value",0).value.bars;
var technology = Datahub.read("/util/cellular/signal/value",0).value.rat;
var report = {
"temperature": temperature,
"pressure": pressure,
"location": { "lat": lat, "lon": lon },
"light": light,
"signal_bars": bars,
"cell_technology": technology
}
return {
"vr://report": [report]
}
}
Read more on: