Provides access to custom automotive sensors
        
        
        
- Source:
Members
- 
    <static> Sensor
- 
    
    Sensor type enumeration. NOTE: This is provided as an example only. This API is intended to be a custom implementation for each system to access its specific sensor data. - Source:
 Properties:Name Type Description FUEL_LEVELNumber Fuel level (0 to 100%). COOLANT_LEVELNumber Coolant level (0 to 100%). COOLANT_TEMPERATURENumber Coolant temperature. ENGINE_OIL_PRESSURENumber Engine oil pressure (>=0 PSI). ENGINE_OIL_LEVELNumber Engine oil level (0 to 100%). ENGINE_OIL_TEMPERATURENumber Engine oil temperature. RPMNumber Engine RPM (>=0). SPEEDNumber Vehicle speed (>=0). BRAKE_FLUID_LEVELNumber Brake fluid level (0 to 100%). BRAKE_ABS_ENABLEDBoolean ABS brakes (true for on; default is true). BRAKE_PAD_WEAR_FRONTLEFTNumber Front left brake pad wear (0 to 100%). BRAKE_PAD_WEAR_FRONTRIGHTNumber Front right brake pad wear (0 to 100%). BRAKE_PAD_WEAR_REARLEFTNumber Rear left brake pad wear (0 to 100%). BRAKE_PAD_WEAR_REARRIGHTNumber Rear right brake pad wear (0 to 100%). BRAKE_ABS_FRONTLEFTBoolean Front left ABS (true for on; default is true). BRAKE_ABS_FRONTRIGHTBoolean Front right ABS (true for on; default is true). BRAKE_ABS_REARLEFTBoolean Rear left ABS (true for on; default is true). BRAKE_ABS_REARRIGHTBoolean Rear right ABS (true for on; default is true). TIRE_PRESSURE_FRONTLEFTNumber Front left tire pressure (>=0 PSI). TIRE_PRESSURE_FRONTRIGHTNumber Front right tire pressure (>=0 PSI). TIRE_PRESSURE_REARLEFTNumber Rear left tire pressure (>=0 PSI). TIRE_PRESSURE_REARRIGHTNumber Rear right tire pressure (>=0 PSI). TIRE_WEAR_FRONTLEFTNumber Front left tire wear (0 to 100%). TIRE_WEAR_FRONTRIGHTNumber Front right tire wear (0 to 100%). TIRE_WEAR_REARLEFTNumber Rear left tire wear (0 to 100%). TIRE_WEAR_REARRIGHTNumber Rear right tire wear (0 to 100%). LIGHT_HEADLIGHT_LEFTBoolean Left head light (true for on). LIGHT_HEADLIGHT_RIGHTBoolean Right head light (true for on). LIGHT_TAILLIGHT_LEFTBoolean Left tail light (true for on). LIGHT_TAILLIGHT_RIGHTBoolean Right tail light (true for on). TRANSMISSION_FLUID_LEVELNumber Transmission fluid level (0 to 100%). TRANSMISSION_FLUID_TEMPERATURENumber Transmission fluid temperature (-273.15 to 1000 degrees Fahrenheit). TRANSMISSION_CLUTCH_WEARNumber Clutch wear level (0 to 100%). TRANSMISSION_GEARString Transmission gear (One of: p,r,n,d,1,2,3,4,5,6,7). WASHERFLUID_LEVELNumber Washer fluid level (0 to 100%). 
Methods
- 
    <static> cancelWatch(watchId)
- 
    
    
    Stop watching sensor changesParameters:Name Type Description watchIdNumber The watch ID returned by car.sensors.watchSensors. - Source:
 Examplecar.sensors.cancelWatch(watchId);
- 
    <static> get(successCallback, errorCallback, sensors)
- 
    
    
    Return the current vehicle sensors If successfull, the successCallback method will be called with an object describing the available sensors, their location (if applicable), and their values. Parameters:Name Type Argument Description successCallbackFunction The callback that is called with the result on success. errorCallbackFunction <optional> 
 The callback that is called if there is an error. sensorsArray <optional> 
 A list of car.sensor.Sensor values to whitelist. - Source:
 Examples//define your callback function(s) function successCallback(sensorData) { //iterate through all the sensors var sensors = Object.keys(sensorData); for (var i=0; i<sensors.length; i++) { console.log("sensor name = " + sensors[i] + "; sensor value = " + sensorData[sensors[i]]); } //get the speed if (typeof sensorData[car.sensors.Sensor.SPEED] !== 'undefined') { console.log("speed = " + sensorData[car.sensors.Sensor.SPEED]); } } function errorCallback(error) { console.log(error.code, error.msg); } //optional: define a list of sensors by which to filter var sensors = [ car.sensors.Sensor.SPEED, car.sensors.Sensor.RPM ]; //NOTE: this is equivalent to doing: var sensors = [ 'speed', 'rpm' ]; //call the method car.sensors.get(successCallback, errorCallback, sensors);REST - with a filter Request: http://<car-ip>/car/sensors/get?sensors=speed,rpm Success Response: { code: 1, data: { speed: 50, rpm: 2000 } } Error Response: { code: -1, msg: "An error has occurred" }
- 
    <static> watchSensors(callback) → {Number}
- 
    
    
    Watch for sensor changesParameters:Name Type Description callbackFunction The function to be called when a change is detected. - Source:
 Returns:An ID for the added watch.- Type
- Number
 Example//define a callback function function myCallback(sensorData) { //iterate through all the sensors var sensors = Object.keys(sensorData); for (var i=0; i<sensors.length; i++) { console.log("sensor name = " + sensors[i] + "; sensor value = " + sensorData[sensors[i]]); } } var watchId = car.sensors.watchSensors(myCallback);