slit line to make it fit better on smaller resolutions
[slides.git] / fosdem2015 / index.html
index 1522846c9012880fafca5e8daf502cbccd86a82f..afab08ef34743d07b6d1a742ac8ff8a94cd9b435 100755 (executable)
@@ -87,7 +87,7 @@
 <h1>Firefox OS Tricorder App</h1>
 
 <div class="simplebox">
-<p>Displays sensor data</p>
+<p>Displays data from device sensors as exposed by WebAPIs</p>
 <p><a href="https://marketplace.firefox.com/app/tricorder/">marketplace.firefox.com/app/tricorder/</a></p>
 <p>Code: <a href="https://github.com/KaiRo-at/tricorder">github.com/KaiRo-at/tricorder</a></p>
 </div>
@@ -96,7 +96,9 @@
 <article id="ui" title="UI">
 <h1>Firefox OS Tricorder UI</h1>
 
-<div class="simplebox">
+<div class="simplebox cent">
+<img src="tricorder-ui.svg"
+     alt="Tricorder UI description">
 </div>
 </article>
 
 
 <div class="simplebox">
 <p>GPS, WiFi/Cell Location</p>
-<p>API: Geolocation</p>
+<p>API: <a href="https://developer.mozilla.org/en-US/docs/Web/API/Geolocation">Geolocation</a></p>
 <p>Permission: geolocation</p>
 </div>
 </article>
 
 <div class="simplebox">
 <pre>
-  this.watchID = navigator.geolocation.watchPosition(
-    function(position) { ... },
+  this.watchID = <a href="https://developer.mozilla.org/en-US/docs/Web/API/Geolocation.watchPosition">navigator.geolocation.watchPosition</a>(
+    function(position) {
+      position.coords.latitude / .longitude / .accuracy / ...
+    },
     function(error) { ... },
     {enableHighAccuracy: true, maximumAge: 10000, timeout: 60000}
   );
 <h1>Gravity Module</h1>
 
 <div class="simplebox">
-<p>Accelerometer, Magnetic Compass</p>
-<p>APIs: deviceorientation, devicemotion events</p>
+<p>Accelerometer, Magnetometer</p>
+<p>APIs: <a href="https://developer.mozilla.org/en-US/docs/Web/API/DeviceOrientationEvent">deviceorientation</a>,
+<a href="https://developer.mozilla.org/en-US/docs/Web/API/DeviceMotionEvent">devicemotion</a> events</p>
 <p>Permissions: ---</p>
 </div>
 </article>
 
 <div class="simplebox">
 <pre>
-  window.addEventListener("deviceorientation", this.orientEvent, true);
-  window.addEventListener("devicemotion", this.motionEvent, true);
+  window.addEventListener("<a href="https://developer.mozilla.org/en-US/docs/Web/Events/deviceorientation">deviceorientation</a>", this.orientEvent, true);
+  window.addEventListener("<a href="https://developer.mozilla.org/en-US/docs/Web/Events/devicemotion">devicemotion</a>", this.motionEvent, true);
 
   orientEvent: function(orientData) {
     orientData.alpha / .beta / .gamma (in °)
 
 <div class="simplebox">
 <p>Microphone</p>
-<p>APIs: WebRTC(getUserMedia), WebAudio</p>
+<p>APIs: <a href="https://developer.mozilla.org/en-US/docs/Web/Guide/API/WebRTC">WebRTC</a>(getUserMedia),
+<a href="https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API">WebAudio</a></p>
 <p>Permissions: audio-capture</p>
 </div>
 </article>
 
 <div class="simplebox">
 <pre>
+  <a href="https://developer.mozilla.org/en-US/docs/NavigatorUserMedia.getUserMedia">navigator.getUserMedia</a>({ audio: true },
+    function(aLocalMediaStream) {
+      gModSound.mAudio.stream = aLocalMediaStream;
+      gModSound.mAudio.context = new <a href="https://developer.mozilla.org/en-US/docs/Web/API/AudioContext">window.AudioContext</a>();
+      gModSound.mAudio.input =
+          gModSound.mAudio.context.createMediaStreamSource(gModSound.mAudio.stream);
+      gModSound.mAudio.analyzer = gModSound.mAudio.context<a href="https://developer.mozilla.org/en-US/docs/Web/API/AnalyserNode">.createAnalyser</a>();
+      gModSound.mAudio.input.connect(gModSound.mAudio.analyzer);
+    },
+    function(err) { ... }
+  );
+
+  // in window.requestAnimationFrame():
+  var data = new Uint8Array(gModSound.mAudio.frequencySlices);
+  gModSound.mAudio.analyzer<a href="https://developer.mozilla.org/en-US/docs/Web/API/AnalyserNode.getByteFrequencyData">.getByteFrequencyData</a>(data);
+  // ... do something with data ...
+
+  gModSound.mAudio.stream.stop();
 </pre>
 </div>
 </article>
 
 <div class="simplebox">
 <p>Light, Proximity; Flashlight</p>
-<p>APIs: devicelight, deviceproximity events; Camera API</p>
+<p>APIs: <a href="https://developer.mozilla.org/en-US/docs/Web/API/DeviceLightEvent">devicelight</a>,
+<a href="https://developer.mozilla.org/en-US/docs/Web/API/DeviceProximityEvent">deviceproximity</a> events;
+<a href="https://developer.mozilla.org/en-US/docs/Web/API/Camera_API">Camera API</a></p>
 <p>Permissions: ---; camera (for Flash)</p>
 </div>
 </article>
 
 <div class="simplebox">
 <pre>
+  window.addEventListener("<a href="https://developer.mozilla.org/en-US/docs/Web/Events/devicelight">devicelight</a>", this.lightEvent, true);
+  window.addEventListener("<a href="https://developer.mozilla.org/en-US/docs/Web/Events/deviceproximity">deviceproximity</a>", this.proxEvent, true);
+
+  lightEvent: function(lightData) {
+    lightData.value (in lux)
+  },
+  proxEvent: function(proxData) {
+    proxData.min &lt;= .value &lt;= .max (in cm)
+  },
+
+  window.removeEventListener("devicelight", this.lightEvent, true);
+  window.removeEventListener("deviceproximity", this.proxEvent, true);
+
+  // flash/torch code works via <a href="https://developer.mozilla.org/en-US/docs/Web/API/CameraManager.getCamera">navigator.mozCameras.getCamera</a>
+  // flaky and subject to change, please consult code on github
 </pre>
 </div>
 </article>
 
 <div class="simplebox">
 <p>Battery</p>
-<p>APIs: Battery</p>
+<p>APIs: <a href="https://developer.mozilla.org/en-US/docs/Web/API/Battery_Status_API">Battery Status API</a></p>
 <p>Permissions: ---</p>
 </div>
 </article>
 
 <div class="simplebox">
 <pre>
+  0 &lt;= <a href="https://developer.mozilla.org/en-US/docs/Web/API/Navigator.battery">navigator.battery</a>.level &lt;= 1
+
+  .charging (true/false)
+
+  .chargingTime (in s; 0 or Infinity: unknown)
+
+  .dischargingTime (in s; 0 or Infinity: unknown)
 </pre>
 </div>
 </article>