Sensor API: Difference between revisions

Jump to navigation Jump to search
10 bytes removed ,  9 September 2011
no edit summary
No edit summary
No edit summary
Line 14: Line 14:
     attribute sequence<SensorSession> openSessions;
     attribute sequence<SensorSession> openSessions;
     sequence<Sensor> listSensors(); // List the available sensors on the device
     sequence<Sensor> listSensors(); // List the available sensors on the device
     attribute Function onSensorAvailable;
     attribute Function onSensorAvailable;
}
}
Line 24: Line 23:
interface SensorSession : EventTarget {
interface SensorSession : EventTarget {
     readonly attribute Sensor sensor;
     readonly attribute Sensor sensor;
     // Allows to watch (monitor) for the sensor  
     // Allows to watch (monitor) for the sensor  
     void watch(in SensorWatchOptions options);
     void watch(in SensorWatchOptions options);
     // Finish monitoring session
     // Finish monitoring session
     void endWatch();
     void endWatch();
   
     // Reads the value of a sensor
     // Reads the value of a sensor
     void read();
     void read();
     // Close the session with the sensor (endWatch is called if necessary)
     // Close the session with the sensor (endWatch is called if necessary)
     void close();
     void close();
     readonly attribute DOMString status; // ("watching", "closed", ...)
     readonly attribute DOMString status; // ("watching", "closed", ...)
     attribute Function onSensorData;
     attribute Function onSensorData;
     attribute Function onError;
     attribute Function onError;
Line 58: Line 52:
     attribute double interval; // Interval at which values will be provided by the sensor (milliseconds)
     attribute double interval; // Interval at which values will be provided by the sensor (milliseconds)
}
}


Example of use
Example of use
172

edits

Navigation menu