<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>
<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">
<pre>
this.watchID = navigator.geolocation.watchPosition(
- function(position) { ... },
+ 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>Accelerometer, Magnetometer</p>
<p>APIs: deviceorientation, devicemotion events</p>
<p>Permissions: ---</p>
</div>
<div class="simplebox">
<pre>
+ 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();
</pre>
</div>
</article>
<div class="simplebox">
<pre>
+ 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
</pre>
</div>
</article>
<div class="simplebox">
<pre>
+ (navigator.battery.level * 100).toFixed(1) + "%";
+
+ if (navigator.battery.charging) {
+ if (navigator.battery.chargingTime == 0 ||
+ navigator.battery.chargingTime == Infinity) {
+ "charging";
+ }
+ else {
+ "charging, " + navigator.battery.chargingTime + "s remaining";
+ }
+ }
+ else {
+ if (navigator.battery.dischargingTime == 0 ||
+ navigator.battery.dischargingTime == Infinity) {
+ "discharging";
+ }
+ else {
+ navigator.battery.dischargingTime + "s usage remaining";
+ }
+ }
</pre>
</div>
</article>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="693.35614"
+ height="441.99106"
+ id="svg2"
+ version="1.1"
+ inkscape:version="0.48.5 r10040"
+ sodipodi:docname="tricorder-ui.svg">
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="1.8032039"
+ inkscape:cx="346.67806"
+ inkscape:cy="220.99553"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ showgrid="false"
+ inkscape:window-width="1865"
+ inkscape:window-height="1019"
+ inkscape:window-x="51"
+ inkscape:window-y="-4"
+ inkscape:window-maximized="1"
+ fit-margin-top="0"
+ fit-margin-left="0"
+ fit-margin-right="0"
+ fit-margin-bottom="0"
+ inkscape:showpageshadow="true"
+ showborder="true" />
+ <defs
+ id="defs4">
+ <marker
+ style="overflow:visible"
+ id="Arrow2Send"
+ refX="0"
+ refY="0"
+ orient="auto"
+ inkscape:stockid="Arrow2Send">
+ <path
+ transform="matrix(-0.3,0,0,-0.3,0.69,0)"
+ d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
+ style="fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round"
+ id="path4013"
+ inkscape:connector-curvature="0" />
+ </marker>
+ <marker
+ style="overflow:visible"
+ id="Arrow2Lend"
+ refX="0"
+ refY="0"
+ orient="auto"
+ inkscape:stockid="Arrow2Lend">
+ <path
+ transform="matrix(-1.1,0,0,-1.1,-1.1,0)"
+ d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
+ style="fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round"
+ id="path4001"
+ inkscape:connector-curvature="0" />
+ </marker>
+ <marker
+ inkscape:stockid="Arrow2Mend"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="Arrow2Mend"
+ style="overflow:visible">
+ <path
+ id="path4007"
+ style="fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round"
+ d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
+ transform="scale(-0.6,-0.6)"
+ inkscape:connector-curvature="0" />
+ </marker>
+ <marker
+ inkscape:stockid="Arrow1Send"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="Arrow1Send"
+ style="overflow:visible">
+ <path
+ id="path3995"
+ d="M 0,0 5,-5 -12.5,0 5,5 0,0 z"
+ style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt"
+ transform="matrix(-0.2,0,0,-0.2,-1.2,0)"
+ inkscape:connector-curvature="0" />
+ </marker>
+ <marker
+ inkscape:stockid="Arrow1Lend"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="Arrow1Lend"
+ style="overflow:visible">
+ <path
+ id="path3983"
+ d="M 0,0 5,-5 -12.5,0 5,5 0,0 z"
+ style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt"
+ transform="matrix(-0.8,0,0,-0.8,-10,0)"
+ inkscape:connector-curvature="0" />
+ </marker>
+ <marker
+ inkscape:stockid="Arrow2Mend4"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="Arrow2Mend4"
+ style="overflow:visible">
+ <path
+ id="path4803"
+ style="fill:#ff0000;fill-rule:evenodd;stroke:#ff0000;stroke-width:0.625;stroke-linejoin:round"
+ d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
+ transform="scale(-0.6,-0.6)"
+ inkscape:connector-curvature="0" />
+ </marker>
+ <marker
+ inkscape:stockid="Arrow2MendF"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="Arrow2MendF"
+ style="overflow:visible">
+ <path
+ id="path5443"
+ style="fill:#ff0000;fill-rule:evenodd;stroke:#ff0000;stroke-width:0.625;stroke-linejoin:round"
+ d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
+ transform="scale(-0.6,-0.6)"
+ inkscape:connector-curvature="0" />
+ </marker>
+ <marker
+ inkscape:stockid="Arrow2Mendi"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="Arrow2Mendi"
+ style="overflow:visible">
+ <path
+ id="path5446"
+ style="fill:#ff0000;fill-rule:evenodd;stroke:#ff0000;stroke-width:0.625;stroke-linejoin:round"
+ d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
+ transform="scale(-0.6,-0.6)"
+ inkscape:connector-curvature="0" />
+ </marker>
+ <marker
+ inkscape:stockid="Arrow2Mendh"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="Arrow2Mendh"
+ style="overflow:visible">
+ <path
+ id="path5449"
+ style="fill:#ff0000;fill-rule:evenodd;stroke:#ff0000;stroke-width:0.625;stroke-linejoin:round"
+ d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
+ transform="scale(-0.6,-0.6)"
+ inkscape:connector-curvature="0" />
+ </marker>
+ <marker
+ inkscape:stockid="Arrow2MendV"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="Arrow2MendV"
+ style="overflow:visible">
+ <path
+ id="path5452"
+ style="fill:#ff0000;fill-rule:evenodd;stroke:#ff0000;stroke-width:0.625;stroke-linejoin:round"
+ d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
+ transform="scale(-0.6,-0.6)"
+ inkscape:connector-curvature="0" />
+ </marker>
+ <marker
+ inkscape:stockid="Arrow2Mendr"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="Arrow2Mendr"
+ style="overflow:visible">
+ <path
+ id="path5455"
+ style="fill:#ff0000;fill-rule:evenodd;stroke:#ff0000;stroke-width:0.625;stroke-linejoin:round"
+ d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
+ transform="scale(-0.6,-0.6)"
+ inkscape:connector-curvature="0" />
+ </marker>
+ </defs>
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Ebene 1"
+ inkscape:groupmode="layer"
+ id="layer1"
+ transform="translate(-7.8607359,-274.05545)">
+ <image
+ y="274.05545"
+ x="279.9769"
+ id="image2993"
+ xlink:href="tricorder_20150124_01.png"
+ height="441.99106"
+ width="248.57143" />
+ <text
+ xml:space="preserve"
+ style="font-size:60px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#ff0000;fill-opacity:1;stroke:none;font-family:Open Sans;-inkscape-font-specification:Sans Bold"
+ x="6.6039157"
+ y="374.19101"
+ id="text2996"
+ sodipodi:linespacing="125%"><tspan
+ sodipodi:role="line"
+ id="tspan2998"
+ x="6.6039157"
+ y="374.19101">Stardate</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-size:60px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#ff0000;fill-opacity:1;stroke:none;font-family:Open Sans;-inkscape-font-specification:Sans Bold"
+ x="570.96295"
+ y="342.84106"
+ id="text3768"
+ sodipodi:linespacing="125%"><tspan
+ sodipodi:role="line"
+ id="tspan3770"
+ x="570.96295"
+ y="342.84106">Title</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-size:60px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#ff0000;fill-opacity:1;stroke:none;font-family:Open Sans;-inkscape-font-specification:Sans Bold"
+ x="2.4701109"
+ y="638.75806"
+ id="text3772"
+ sodipodi:linespacing="125%"><tspan
+ sodipodi:role="line"
+ id="tspan3774"
+ x="2.4701109"
+ y="638.75806">Full screen</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-size:60px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#ff0000;fill-opacity:1;stroke:none;font-family:Open Sans;-inkscape-font-specification:Sans Bold"
+ x="428.65002"
+ y="524.64343"
+ id="text3776"
+ sodipodi:linespacing="125%"><tspan
+ sodipodi:role="line"
+ id="tspan3778"
+ x="428.65002"
+ y="524.64343">Modules</tspan></text>
+ <path
+ style="fill:none;stroke:#ff0000;stroke-width:5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;marker-end:url(#Arrow2MendF)"
+ d="m 252.04085,328.86629 42.41464,-35.07365"
+ id="path3780"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:none;stroke:#ff0000;stroke-width:5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;marker-end:url(#Arrow2Mendi)"
+ d="M 566.88799,321.52529 491.8467,306.8433"
+ id="path3782"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:none;stroke:#ff0000;stroke-width:5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;marker-end:url(#Arrow2Mendr)"
+ d="M 424.14641,483.84286 342.57979,422.6679"
+ id="path3784"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:none;stroke:#ff0000;stroke-width:5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;marker-end:url(#Arrow2MendV)"
+ d="M 425.77774,490.36819 345.02679,466.71387"
+ id="path3786"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:none;stroke:#ff0000;stroke-width:5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;marker-end:url(#Arrow2Mendh)"
+ d="m 427.40907,498.52485 -79.11962,10.60366"
+ id="path3788"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:#ff0000;stroke:#ff0000;stroke-width:5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;marker-end:url(#Arrow2Mend4)"
+ d="m 231.64919,648.60743 57.9123,39.96764"
+ id="path3790"
+ inkscape:connector-curvature="0" />
+ </g>
+</svg>