X-Git-Url: https://git-public.kairo.at/?p=slides.git;a=blobdiff_plain;f=fosdem2015%2Findex.html;h=afab08ef34743d07b6d1a742ac8ff8a94cd9b435;hp=1522846c9012880fafca5e8daf502cbccd86a82f;hb=e7829ad6f5fc19d8fc3b142d86855d0fa2a4eaf0;hpb=b41707de4c4f88a5d499c0854a8762391cfae9fd diff --git a/fosdem2015/index.html b/fosdem2015/index.html index 1522846..afab08e 100755 --- a/fosdem2015/index.html +++ b/fosdem2015/index.html @@ -87,7 +87,7 @@

Firefox OS Tricorder App

-

Displays sensor data

+

Displays data from device sensors as exposed by WebAPIs

marketplace.firefox.com/app/tricorder/

Code: github.com/KaiRo-at/tricorder

@@ -96,7 +96,9 @@

Firefox OS Tricorder UI

-
+
+Tricorder UI description
@@ -120,7 +122,7 @@

GPS, WiFi/Cell Location

-

API: Geolocation

+

API: Geolocation

Permission: geolocation

@@ -130,8 +132,10 @@
-  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

-

Accelerometer, Magnetic Compass

-

APIs: deviceorientation, devicemotion events

+

Accelerometer, Magnetometer

+

APIs: deviceorientation, +devicemotion events

Permissions: ---

@@ -156,8 +161,8 @@
-  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 @@
 
 

Microphone

-

APIs: WebRTC(getUserMedia), WebAudio

+

APIs: WebRTC(getUserMedia), +WebAudio

Permissions: audio-capture

@@ -187,6 +193,24 @@
+  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();
 
@@ -196,7 +220,9 @@

Light, Proximity; Flashlight

-

APIs: devicelight, deviceproximity events; Camera API

+

APIs: devicelight, +deviceproximity events; +Camera API

Permissions: ---; camera (for Flash)

@@ -206,6 +232,21 @@
+  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
 
@@ -215,7 +256,7 @@

Battery

-

APIs: Battery

+

APIs: Battery Status API

Permissions: ---

@@ -225,6 +266,13 @@
+  0 <= navigator.battery.level <= 1
+
+  .charging (true/false)
+
+  .chargingTime (in s; 0 or Infinity: unknown)
+
+  .dischargingTime (in s; 0 or Infinity: unknown)