Firefox OS Tricorder UI
-- this.watchID = navigator.geolocation.watchPosition( - function(position) { ... }, + this.watchID = navigator.geolocation.watchPosition( + function(position) { + position.coords.latitude / .longitude / .accuracy / ... + }, function(error) { ... }, {enableHighAccuracy: true, maximumAge: 10000, timeout: 60000} ); @@ -145,8 +149,9 @@Gravity Module
-@@ -156,8 +161,8 @@Accelerometer, Magnetic Compass
-APIs: deviceorientation, devicemotion events
+Accelerometer, Magnetometer
+APIs: deviceorientation, +devicemotion events
Permissions: ---
- window.addEventListener("deviceorientation", this.orientEvent, true); - window.addEventListener("devicemotion", this.motionEvent, true); + window.addEventListener("deviceorientation", this.orientEvent, true); + window.addEventListener("devicemotion", this.motionEvent, true); orientEvent: function(orientData) { orientData.alpha / .beta / .gamma (in °) @@ -177,7 +182,8 @@@@ -187,6 +193,24 @@Microphone
-APIs: WebRTC(getUserMedia), WebAudio
+APIs: WebRTC(getUserMedia), +WebAudio
Permissions: audio-capture
@@ -196,7 +220,9 @@+ navigator.getUserMedia({ audio: true }, + function(aLocalMediaStream) { + gModSound.mAudio.stream = aLocalMediaStream; + gModSound.mAudio.context = new window.AudioContext(); + gModSound.mAudio.input = + gModSound.mAudio.context.createMediaStreamSource(gModSound.mAudio.stream); + gModSound.mAudio.analyzer = gModSound.mAudio.context.createAnalyser(); + gModSound.mAudio.input.connect(gModSound.mAudio.analyzer); + }, + function(err) { ... } + ); + + // in window.requestAnimationFrame(): + var data = new Uint8Array(gModSound.mAudio.frequencySlices); + gModSound.mAudio.analyzer.getByteFrequencyData(data); + // ... do something with data ... + + gModSound.mAudio.stream.stop();@@ -206,6 +232,21 @@Light, Proximity; Flashlight
-APIs: devicelight, deviceproximity events; Camera API
+APIs: devicelight, +deviceproximity events; +Camera API
Permissions: ---; camera (for Flash)
@@ -215,7 +256,7 @@ @@ -225,6 +266,13 @@+ window.addEventListener("devicelight", this.lightEvent, true); + window.addEventListener("deviceproximity", this.proxEvent, true); + + lightEvent: function(lightData) { + lightData.value (in lux) + }, + proxEvent: function(proxData) { + proxData.min <= .value <= .max (in cm) + }, + + window.removeEventListener("devicelight", this.lightEvent, true); + window.removeEventListener("deviceproximity", this.proxEvent, true); + + // flash/torch code works via navigator.mozCameras.getCamera + // flaky and subject to change, please consult code on github+ 0 <= navigator.battery.level <= 1 + + .charging (true/false) + + .chargingTime (in s; 0 or Infinity: unknown) + + .dischargingTime (in s; 0 or Infinity: unknown)