Abstract IoTSensor instance object that defines a common interface.
        
        
Methods
- 
    accelerometerCallback(callbackFun)
- 
    
    RAW and SFL
 Set the accelerometer notification callback. This function is called everytime new data is available.
 Data is returned in g (x, y, z)Parameters:Name Type Description callbackFunfunction Callback called with accelerometer data: callbackFun(data). Exampleiotsensor.accelerometerCallback( function(data) { console.log('Accelerometer data: ' + data.x + 'g ' + data.y + 'g ' + data.z + 'g'); } );
- 
    accelerometerOff()
- 
    
    RAW and SFL
 Turn off accelerometer notification.Exampleiotsensor.accelerometerOff(); 
- 
    accelerometerOn()
- 
    
    RAW and SFL
 Turn on accelerometer notification.Make sure the callback function is set before turning on the sensor Exampleiotsensor.accelerometerOn(); 
- 
    barometerCallback(callbackFun)
- 
    
    RAW and SFL
 Set the barometer notification callback. This function is called everytime new data is available.
 Data is returned in Pascal (whole number)Parameters:Name Type Description callbackFunfunction Callback called with barometer data: callbackFun(data). Exampleiotsensor.barometerCallback( function(data) { console.log('Barometer data: ' + data + 'Pa'); } );
- 
    barometerOff()
- 
    
    RAW and SFL
 Turn off barometer notification.Exampleiotsensor.barometerOff(); 
- 
    barometerOn()
- 
    
    RAW and SFL
 Turn on barometer notification.Make sure the callback function is set before turning on the sensor Exampleiotsensor.barometerOn(); 
- 
    disableAllSensors()
- 
    
    RAW and SFL
 Turn off all sensors.Exampleiotsensor.disableAllSensors(); 
- 
    errorCallback(errorFun)
- 
    
    Set the error handler function.
 If no errorCallback is set, the default handler will be called:console.log(evothings.iotsensor.currentTime() + ' IoT Sensor error: ' + error); Parameters:Name Type Description errorFunfunction Callback called with error: errorFun(error) 
- 
    getDeviceModel()
- 
    
    Return the device modelReturns:- Type
- string
 Examplevar model = iotsensor.getDeviceModel(); console.log('Device model ' + model);
- 
    getFirmwareString()
- 
    
    Return the firmware version on the deviceReturns:- Type
- string
 Examplevar version = iotsensor.getFirmwareString(); console.log('Firmware version: ' + version);
- 
    gyroscopeCallback(callbackFun)
- 
    
    RAW and SFL
 Set the gyroscope notification callback. This function is called everytime new data is available.
 Data is returned in degrees per second (x, y, z)Parameters:Name Type Description callbackFunfunction Callback called with gyroscope data: callbackFun(data). Exampleiotsensor.gyroscopeCallback( function(data) { console.log('Gyroscope data: ' + data.x + 'degrees per second ' + data.y + 'degrees per second ' + data.z + 'degrees per second'); } );
- 
    gyroscopeOff()
- 
    
    RAW and SFL
 Turn off gyroscope notification.Exampleiotsensor.gyroscopeOff(); 
- 
    gyroscopeOn()
- 
    
    RAW and SFL
 Turn on gyroscope notification.Make sure the callback function is set before turning on the sensor Exampleiotsensor.gyroscopeOn(); 
- 
    humidityCallback(callbackFun)
- 
    
    RAW and SFL
 Set the humidity notification callback. This function is called everytime new data is available.
 Data is returned in % (whole number)Parameters:Name Type Description callbackFunfunction Callback called with humidity data: callbackFun(data). Exampleiotsensor.humidityCallback( function(data) { console.log('Humidity data: ' + data + '%'); } );
- 
    humidityOff()
- 
    
    RAW and SFL
 Turn off humidity notification.Exampleiotsensor.humidityOff(); 
- 
    humidityOn()
- 
    
    RAW and SFL
 Turn on humimdity notification.Make sure the callback function is set before turning on the sensor Exampleiotsensor.humidityOn(); 
- 
    isAccelerometerAvailable()
- 
    
    Checks if the accelerometer is available.Returns:- Type
- boolean
 Example// Check if accelerometer is available if(iotsensor.isAccelerometerAvailable()) { iotsensor.accelerometerOn(); }
- 
    isBarometerAvailable()
- 
    
    Checks if the barometer is available.Returns:- Type
- boolean
 Example// Check if barometer is available if(iotsensor.isBarometerAvailable()) { iotsensor.barometerOn(); }
- 
    isGyroscopeAvailable()
- 
    
    Checks if the gyroscope is available.Returns:- Type
- boolean
 Example// Check if gyroscope is available if(iotsensor.isGyroscopeAvailable()) { iotsensor.gyroscopeOn(); }
- 
    isHumidityAvailable()
- 
    
    Checks if the humidity sensor is available.Returns:- Type
- boolean
 Example// Check if humidity sensor is available if(iotsensor.isHumidityAvailable()) { iotsensor.humidityOn(); }
- 
    isMagnetometerAvailable()
- 
    
    Checks if the magnetometer is available.Returns:- Type
- boolean
 Example// Check if magnetometer is available if(iotsensor.isMagnetometerAvailable()) { iotsensor.magnetometerOn(); }
- 
    isSflAvailable()
- 
    
    Checks if Sensor Fusion is available.Returns:- Type
- boolean
 Example// Check if sensor fusion is available if(iotsensor.isSflAvailable()) { iotsensor.sflOn(); }
- 
    isTemperatureAvailable()
- 
    
    Checks if the temperature sensor is available.Returns:- Type
- boolean
 Example// Check if temperature sensor is available if(iotsensor.isTemperatureAvailable()) { iotsensor.temperatureOn(); }
- 
    magnetometerCallback(callbackFun)
- 
    
    RAW and SFL
 Set the magnetometer notification callback. This function is called everytime new data is available.
 Data is returned in micro Tesla (x, y, z)Parameters:Name Type Description callbackFunfunction Callback called with magnetometer data: callbackFun(data). Exampleiotsensor.magnetometerCallback( function(data) { console.log('Magnetometer data: ' + data.x + 'µT ' + data.y + 'µT ' + data.z + 'µT'); } );
- 
    magnetometerOff()
- 
    
    RAW and SFL
 Turn off magnetometer notification.Exampleiotsensor.magnetometerOff(); 
- 
    magnetometerOn()
- 
    
    RAW and SFL
 Turn on magnetometer notification.Make sure the callback function is set before turning on the sensor Exampleiotsensor.magnetometerOn(); 
- 
    sflCallback(callbackFun)
- 
    
    SFL only
 Set the sensor fusion notification callback. This function is called everytime new data is available.
 Data is returned in 4 axis (w, x, y, z)Parameters:Name Type Description callbackFunfunction Callback called with sensor fusion data: callbackFun(data). Exampleiotsensor.sflCallback( function(data) { console.log('Sensor fusion data: ' + data.w + ' ' + data.x + ' ' + data.y + ' ' + data.z); } );
- 
    sflOff()
- 
    
    SFL only
 Turn off sensor fusion notification.Exampleiotsensor.sflOff(); 
- 
    sflOn()
- 
    
    SFL only
 Turn on sensor fusion notification.Make sure the callback function is set before turning on sensor fusion Exampleiotsensor.sflOn(); 
- 
    statusCallback(statusFun)
- 
    
    Set the status handler function.
 If no statusCallback is set, the default handler will be called:console.log(evothings.iotsensor.currentTime() + ' IoT Sensor status: ' + status); Parameters:Name Type Description statusFunfunction Callback called with status: statusFun(status); 
- 
    temperatureCallback(callbackFun)
- 
    
    RAW and SFL
 Set the temperature notification callback. This function is called everytime new data is available.
 Data is returned in degrees Celcius (2 decimals)Parameters:Name Type Description callbackFunfunction Callback called with temperature data: callbackFun(data). Exampleiotsensor.temperatureCallback( function(data) { console.log('Temperature data: ' + data + '°C'); } );
- 
    temperatureOff()
- 
    
    RAW and SFL
 Turn off temperature notification.Exampleiotsensor.temperatureOff(); 
- 
    temperatureOn()
- 
    
    RAW and SFL
 Turn on temperature notification.Make sure the callback function is set before turning on the sensor Exampleiotsensor.temperatureOn();