144
Firefox OS NDC 3 December 2014 …and the Internet of Things

Firefox OS and the Internet of Things - NDC London 2014

Embed Size (px)

Citation preview

Page 1: Firefox OS and the Internet of Things - NDC London 2014

Firefox OSNDC

3 December 2014

…and the Internet of Things

Page 2: Firefox OS and the Internet of Things - NDC London 2014

@janjongboom

Firefox OS…

Page 3: Firefox OS and the Internet of Things - NDC London 2014

@janjongboom

Evangelist

Firefox OS…

Page 4: Firefox OS and the Internet of Things - NDC London 2014

@janjongboom

Evangelist

ContributorFirefox OS…

Page 5: Firefox OS and the Internet of Things - NDC London 2014

@janjongboom

Evangelist

ContributorFirefox OS…User

Page 6: Firefox OS and the Internet of Things - NDC London 2014
Page 7: Firefox OS and the Internet of Things - NDC London 2014
Page 8: Firefox OS and the Internet of Things - NDC London 2014
Page 9: Firefox OS and the Internet of Things - NDC London 2014

4,300,000,000

Page 10: Firefox OS and the Internet of Things - NDC London 2014

Network2013: 3G rollout in Bangladesh

Page 11: Firefox OS and the Internet of Things - NDC London 2014

BIGGERPROBLEM

Page 12: Firefox OS and the Internet of Things - NDC London 2014

Handsets12-14% smartphone penetration

Page 13: Firefox OS and the Internet of Things - NDC London 2014

Handsets12-14% smartphone penetration

Page 14: Firefox OS and the Internet of Things - NDC London 2014

but not enough...prices are dropping

Page 15: Firefox OS and the Internet of Things - NDC London 2014

...and OS makers focus on the upper end

Page 16: Firefox OS and the Internet of Things - NDC London 2014

Firefox OSSmartphone OS by Mozilla

Page 17: Firefox OS and the Internet of Things - NDC London 2014

“Awesome internet experience at low-cost hardware”

Page 18: Firefox OS and the Internet of Things - NDC London 2014

Launched in 201326 countries

Page 19: Firefox OS and the Internet of Things - NDC London 2014

Putting the web firstUnlike Android, iOS

Page 20: Firefox OS and the Internet of Things - NDC London 2014

Take the full content of the Android App Store

Page 21: Firefox OS and the Internet of Things - NDC London 2014

Take the full content of the Android App Store

Times 41,666

Page 22: Firefox OS and the Internet of Things - NDC London 2014

Take the full content of the Android App Store

Times 41,666That’s the amount of pages on the Google’able web (10-20% of full web)

Page 23: Firefox OS and the Internet of Things - NDC London 2014

Web is superior for informationAnd information develops a country

Page 24: Firefox OS and the Internet of Things - NDC London 2014

Building a smartphone for the open web

Goal of the project

Page 25: Firefox OS and the Internet of Things - NDC London 2014

Architecture

Page 26: Firefox OS and the Internet of Things - NDC London 2014

Architecture

Page 27: Firefox OS and the Internet of Things - NDC London 2014

A web page

Web page

Traditional model

Page 28: Firefox OS and the Internet of Things - NDC London 2014

A web page

Web page Browser

Traditional model

Page 29: Firefox OS and the Internet of Things - NDC London 2014

A web page

Web page Browser OS

Traditional model

Page 30: Firefox OS and the Internet of Things - NDC London 2014

A web page

Web page Browser OS Kernel

Traditional model

Page 31: Firefox OS and the Internet of Things - NDC London 2014

A web page

Web page Browser OS Kernel Phone

Traditional model

Page 32: Firefox OS and the Internet of Things - NDC London 2014

A web page

Web page Browser OS Kernel Phone

Firefox OS

Page 33: Firefox OS and the Internet of Things - NDC London 2014

A web page

Web page Browser Kernel Phone

Firefox OS

Page 34: Firefox OS and the Internet of Things - NDC London 2014

A web page

Web page Browser Kernel Phone

Firefox OS

Page 35: Firefox OS and the Internet of Things - NDC London 2014

Android 4.4 Firefox OS 1.3

Page 36: Firefox OS and the Internet of Things - NDC London 2014

Android 4.4 Firefox OS 1.3

512 MB

Page 37: Firefox OS and the Internet of Things - NDC London 2014

Android 4.4 Firefox OS 1.3

512 MB128 MB

Page 38: Firefox OS and the Internet of Things - NDC London 2014

Just a web browserApps? Offline? Payment?

Page 39: Firefox OS and the Internet of Things - NDC London 2014

No shortcutsEverything in the phone written in HTML5

Page 40: Firefox OS and the Internet of Things - NDC London 2014
Page 41: Firefox OS and the Internet of Things - NDC London 2014

1 var call = navigator.mozTelephony.dial('555123') 2 3 call.onconnected = function() { 4 call.hangUp() 5 }

Page 42: Firefox OS and the Internet of Things - NDC London 2014

Lifes are changing!

Page 43: Firefox OS and the Internet of Things - NDC London 2014

Before mobile revolution…Limited input methods

Page 44: Firefox OS and the Internet of Things - NDC London 2014

Vibration sensor?

Page 45: Firefox OS and the Internet of Things - NDC London 2014

Accelerometer?

Page 46: Firefox OS and the Internet of Things - NDC London 2014

Accelerometer?

Page 47: Firefox OS and the Internet of Things - NDC London 2014

Proximity Accelerometer Ambient Light Magnetometer Gyroscope Humidity Ambient Temperature Pressure Battery Cameras

Page 48: Firefox OS and the Internet of Things - NDC London 2014

Bend sensor

Page 49: Firefox OS and the Internet of Things - NDC London 2014

Internet of Things

Page 50: Firefox OS and the Internet of Things - NDC London 2014

Moves IHR SleepCycle

Page 51: Firefox OS and the Internet of Things - NDC London 2014

BORING!

Page 52: Firefox OS and the Internet of Things - NDC London 2014
Page 53: Firefox OS and the Internet of Things - NDC London 2014
Page 54: Firefox OS and the Internet of Things - NDC London 2014
Page 55: Firefox OS and the Internet of Things - NDC London 2014
Page 56: Firefox OS and the Internet of Things - NDC London 2014

WiFi ConnectionReal purpose: internet connection

Page 57: Firefox OS and the Internet of Things - NDC London 2014

Hide & Seek!Hider sets up a WiFi hotspot

Seekers use dBm to triangulate

Page 58: Firefox OS and the Internet of Things - NDC London 2014

Hide & Seek! 1 var req = navigator.mozWifiManager.getNetworks(); 2 req.onsuccess = function() { 3 var seeker = this.result.find(n => n.ssid === 'seeker'); 4 if (!seeker) { 5 console.log('Too far out!'); 6 } 7 else { 8 console.log(network.relSignalStrength); 9 } 10 };

Page 59: Firefox OS and the Internet of Things - NDC London 2014

Device LightReal purpose: adjust brightness

Page 60: Firefox OS and the Internet of Things - NDC London 2014

MusicTheremin is instrument

Use device light as tone frequency

Wave your hands and magic!

Page 61: Firefox OS and the Internet of Things - NDC London 2014

MusicTheremin is instrument

Use device light as tone frequency

Wave your hands and magic!

Page 62: Firefox OS and the Internet of Things - NDC London 2014

1 var context = new AudioContext(); 2 var oscillator = context.createOscillator(); 3 oscillator.connect(context.destination); 4 oscillator.start(0); 5 6 window.addEventListener('devicelight', function(e) { 7 oscillator.frequency.value = e.value * 10; 8 });

Music

Page 63: Firefox OS and the Internet of Things - NDC London 2014

GyroscopeReal purpose: rotate screen

Page 64: Firefox OS and the Internet of Things - NDC London 2014

GyroscopeReal purpose: rotate screen

Page 65: Firefox OS and the Internet of Things - NDC London 2014

Track real life movementDraw 3D model of phones

Measure gyroscope data

Show real life state on screen

Page 66: Firefox OS and the Internet of Things - NDC London 2014
Page 67: Firefox OS and the Internet of Things - NDC London 2014

Track real life movement 1 var front = new THREE.MeshBasicMaterial({ map: loadTexture('front.jpg') }); 2 var back = new THREE.MeshBasicMaterial({ map: loadTexture('back.jpg') }); 3 var border = new THREE.MeshBasicMaterial({ color: 0xffe04526 }); 4 5 var materials = [ border, border, border, 6 border, front, back ]; 7 8 var geometry = new THREE.BoxGeometry(2, 4, 0.3); 9 var cube = new THREE.Mesh(geometry, 10 new THREE.MeshFaceMaterial(materials)); 11 scene.add(cube);

Page 68: Firefox OS and the Internet of Things - NDC London 2014

Track real life movement

1 window.addEventListener('deviceorientation', function(e) { 2 cube.rotation.x = e.beta / 60; 3 cube.rotation.y = e.gamma / 60; 4 cube.rotation.z = e.alpha / 60; 5 });

Page 69: Firefox OS and the Internet of Things - NDC London 2014

AccelerometerReal purpose: Turn to mute

Page 70: Firefox OS and the Internet of Things - NDC London 2014

Juggling visualizerMeasure z-forces on device

Plot it in graph over time

Juggle with multiple devices

Page 71: Firefox OS and the Internet of Things - NDC London 2014

Juggling visualizer

1 window.addEventListener('devicemotion', function(e) { 2 var serie = getGraphSerieForDevice(e.data.deviceId); 3 serie.addPoint([ e.data.timestamp, Math.abs(e.data.z) ]); 4 });

Page 72: Firefox OS and the Internet of Things - NDC London 2014
Page 73: Firefox OS and the Internet of Things - NDC London 2014
Page 74: Firefox OS and the Internet of Things - NDC London 2014

Maker movement is EVERYWHERE(Kickstarter, spaces, fairs, Wired)

Page 75: Firefox OS and the Internet of Things - NDC London 2014
Page 76: Firefox OS and the Internet of Things - NDC London 2014
Page 77: Firefox OS and the Internet of Things - NDC London 2014

€ 34,99

Page 78: Firefox OS and the Internet of Things - NDC London 2014
Page 79: Firefox OS and the Internet of Things - NDC London 2014
Page 80: Firefox OS and the Internet of Things - NDC London 2014

£ 20.46

Page 81: Firefox OS and the Internet of Things - NDC London 2014
Page 82: Firefox OS and the Internet of Things - NDC London 2014

Bluetooth, WiFi, 3G, 2 Cameras, GPS,

qHD touch screen

Page 83: Firefox OS and the Internet of Things - NDC London 2014

Bluetooth, WiFi, 3G, 2 Cameras, GPS,

qHD touch screen

Page 84: Firefox OS and the Internet of Things - NDC London 2014
Page 85: Firefox OS and the Internet of Things - NDC London 2014

Linux Kernel

Page 86: Firefox OS and the Internet of Things - NDC London 2014

Linux Kernel

Gecko

Page 87: Firefox OS and the Internet of Things - NDC London 2014

Linux Kernel

Gecko HTML5UI

Page 88: Firefox OS and the Internet of Things - NDC London 2014

Linux Kernel

Gecko HTML5UI

Has all phone APIs in JS

Page 89: Firefox OS and the Internet of Things - NDC London 2014

Linux Kernel

Gecko

Has all phone APIs in JS

Page 90: Firefox OS and the Internet of Things - NDC London 2014
Page 91: Firefox OS and the Internet of Things - NDC London 2014

First screwdriver ever!

Page 92: Firefox OS and the Internet of Things - NDC London 2014
Page 93: Firefox OS and the Internet of Things - NDC London 2014
Page 94: Firefox OS and the Internet of Things - NDC London 2014
Page 95: Firefox OS and the Internet of Things - NDC London 2014
Page 96: Firefox OS and the Internet of Things - NDC London 2014
Page 97: Firefox OS and the Internet of Things - NDC London 2014
Page 98: Firefox OS and the Internet of Things - NDC London 2014
Page 99: Firefox OS and the Internet of Things - NDC London 2014
Page 100: Firefox OS and the Internet of Things - NDC London 2014
Page 101: Firefox OS and the Internet of Things - NDC London 2014
Page 102: Firefox OS and the Internet of Things - NDC London 2014
Page 103: Firefox OS and the Internet of Things - NDC London 2014
Page 104: Firefox OS and the Internet of Things - NDC London 2014
Page 105: Firefox OS and the Internet of Things - NDC London 2014
Page 106: Firefox OS and the Internet of Things - NDC London 2014
Page 107: Firefox OS and the Internet of Things - NDC London 2014
Page 108: Firefox OS and the Internet of Things - NDC London 2014
Page 109: Firefox OS and the Internet of Things - NDC London 2014
Page 110: Firefox OS and the Internet of Things - NDC London 2014
Page 111: Firefox OS and the Internet of Things - NDC London 2014
Page 112: Firefox OS and the Internet of Things - NDC London 2014
Page 113: Firefox OS and the Internet of Things - NDC London 2014

Linux Kernel

Gecko

Has all phone APIs in JS

Page 114: Firefox OS and the Internet of Things - NDC London 2014

Linux Kernel

Gecko JanOS

Has all phone APIs in JS

Page 115: Firefox OS and the Internet of Things - NDC London 2014

Linux Kernel

Gecko JanOS

Has all phone APIs in JS

Page 116: Firefox OS and the Internet of Things - NDC London 2014

JanOSAlternative to Firefox OS

Some batteries included

Need rooted Firefox OS phone with ADB enabled !

github.com/janjongboom/janos

Page 117: Firefox OS and the Internet of Things - NDC London 2014

Booting / flashing

$ make reset-phone && adb logcat

Page 118: Firefox OS and the Internet of Things - NDC London 2014

1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta name="viewport" content="width=device-width, user-scalable=no, 5 initial-scale=1"> 6 <meta charset="utf-8"> 7 8 <script src="js/bootstrap.js"></script> 9 <script defer src="js/camera.js"></script> 10 <script defer src="js/security_cam.js"></script> 11 <script defer src="js/doorbell.js"></script> 12 <script defer src="js/bluetooth.js"></script> 13 <script defer src="js/tracker.js"></script> 14 </head> 16 <body> 17 <h1>OMG WELCOME TO JANOS 1.0!</h1> 18 </body> 19 </html>

Page 119: Firefox OS and the Internet of Things - NDC London 2014

about:app-manager

Page 120: Firefox OS and the Internet of Things - NDC London 2014

Security cameraEvery 5 seconds take photo

Save to storage (4GB!) or SD

Sync with cloud

Page 121: Firefox OS and the Internet of Things - NDC London 2014

Taking picture to storage

1 window.camera.takePicture('front').then(function(blob) { 2 var storage = navigator.getDeviceStorage('pictures'); 3 var req = storage.addNamed(blob, 'myawesomepicture.jpg'); 4 req.onsuccess = function() { 5 console.log('Saved on internal storage!'); 6 }; 7 });

Page 122: Firefox OS and the Internet of Things - NDC London 2014

Taking picture to storage

1 window.camera.takePicture('front').then(function(blob) { 2 var storage = navigator.getDeviceStorage('pictures'); 3 var req = storage.addNamed(blob, 'myawesomepicture.jpg'); 4 req.onsuccess = function() { 5 console.log('Saved on internal storage!'); 6 }; 7 });

Page 123: Firefox OS and the Internet of Things - NDC London 2014

Taking picture to storage

1 window.camera.takePicture('front').then(function(blob) { 2 var storage = navigator.getDeviceStorage('pictures'); 3 var req = storage.addNamed(blob, 'myawesomepicture.jpg'); 4 req.onsuccess = function() { 5 console.log('Saved on internal storage!'); 6 }; 7 });

Page 124: Firefox OS and the Internet of Things - NDC London 2014

Taking picture to storage

1 window.camera.takePicture('front').then(function(blob) { 2 var storage = navigator.getDeviceStorage('pictures'); 3 var req = storage.addNamed(blob, 'myawesomepicture.jpg'); 4 req.onsuccess = function() { 5 console.log('Saved on internal storage!'); 6 }; 7 });

Page 125: Firefox OS and the Internet of Things - NDC London 2014

DoorbellProximity sensor

Ring over bluetooth

Live video stream

Page 126: Firefox OS and the Internet of Things - NDC London 2014

Bluetooth doorbell

1 enableBluetoothAudio('00:0C:8A:75:EF:30').then(function() { 2 window.onuserproximity = function(e) { 3 if (e.near) { 4 var audio = new Audio('/sounds/doorbell.ogg'); 5 audio.play(); 6 } 7 }; 8 });

Page 127: Firefox OS and the Internet of Things - NDC London 2014

Bluetooth doorbell

1 enableBluetoothAudio('00:0C:8A:75:EF:30').then(function() { 2 window.onuserproximity = function(e) { 3 if (e.near) { 4 var audio = new Audio('/sounds/doorbell.ogg'); 5 audio.play(); 6 } 7 }; 8 });

Page 128: Firefox OS and the Internet of Things - NDC London 2014

Bluetooth doorbell

1 enableBluetoothAudio('00:0C:8A:75:EF:30').then(function() { 2 window.onuserproximity = function(e) { 3 if (e.near) { 4 var audio = new Audio('/sounds/doorbell.ogg'); 5 audio.play(); 6 } 7 }; 8 });

Page 129: Firefox OS and the Internet of Things - NDC London 2014

Bluetooth doorbell

1 enableBluetoothAudio('00:0C:8A:75:EF:30').then(function() { 2 window.onuserproximity = function(e) { 3 if (e.near) { 4 var audio = new Audio('/sounds/doorbell.ogg'); 5 audio.play(); 6 } 7 }; 8 });

Page 130: Firefox OS and the Internet of Things - NDC London 2014
Page 131: Firefox OS and the Internet of Things - NDC London 2014

Brian

Page 132: Firefox OS and the Internet of Things - NDC London 2014
Page 133: Firefox OS and the Internet of Things - NDC London 2014
Page 134: Firefox OS and the Internet of Things - NDC London 2014

BrianTracker™2G connection

Connected to push server

Geolocation on request

Page 135: Firefox OS and the Internet of Things - NDC London 2014
Page 136: Firefox OS and the Internet of Things - NDC London 2014
Page 137: Firefox OS and the Internet of Things - NDC London 2014
Page 138: Firefox OS and the Internet of Things - NDC London 2014

Get hacking

Page 139: Firefox OS and the Internet of Things - NDC London 2014

Get hackingGrab a rootable FxOS phone

Crack it open

Write your own scripts

PROFIT!

Page 140: Firefox OS and the Internet of Things - NDC London 2014

One more thing…

Page 141: Firefox OS and the Internet of Things - NDC London 2014
Page 142: Firefox OS and the Internet of Things - NDC London 2014
Page 143: Firefox OS and the Internet of Things - NDC London 2014

Small camera

JanOS powered

Timelapse & on-demand

@janjongboom

Page 144: Firefox OS and the Internet of Things - NDC London 2014

Thank you!http://janjongboom.com

github.com/janjongboom