Fxos for Embedded Systems (English version)

31
Firefox OS study group tokyo 9th Firefox OS for Embedded System and Web APIs (English version)

Transcript of Fxos for Embedded Systems (English version)

Page 1: Fxos for Embedded Systems (English version)

Firefox OS study group tokyo 9th

Firefox OS for Embedded System and Web APIs(English version)

Page 2: Fxos for Embedded Systems (English version)

2/31

Self Introduction

Twitter: @masap Embedded System Engineer(mainly Wi-Fi)

Page 3: Fxos for Embedded Systems (English version)

3/31

Table of contents

What is WoT ? Position of Firefox OS on WoT Add the Web APIs for Firefox OS Standardization of Web APIs

Page 4: Fxos for Embedded Systems (English version)

4/31

What is WoT ?

Page 5: Fxos for Embedded Systems (English version)

5/31

review

Today's thema is “Go for it WoT ”! Review on WoT

Page 6: Fxos for Embedded Systems (English version)

6/31

IoT (Internet of Things)

Connect various things to the Internet By computers on cloud

Summarize informations Control devices

Cloud

Things

Traffic accidentoccurredControl signals,

digital signage

Page 7: Fxos for Embedded Systems (English version)

7/31

WoT (Web of Things)

Web = HTTP ? IoT = IP、Web = HTTP no diferent→

Application

HTTP

IP

Things

Application

Things

IP

IoT WoT

Page 8: Fxos for Embedded Systems (English version)

8/31

WoT (Web of Things)

Web = Browser? We can write all with JavaScript

Browser

HTTP

IP

Things

WoT

ApplicationApplication

IP

Things

IoT

CC/Java

JavaScript

Page 9: Fxos for Embedded Systems (English version)

9/31

Browser as a platform

“Web = Browser” is more acceptable Accessing to things and connection to the network

could be done via Browser JavaScript can control things and HTTP protocol At the standard IoT, almost things will be controlled

with native languages (like C) ⇒Browser as a platform

WoT means this

Page 10: Fxos for Embedded Systems (English version)

10/31

Position of Firefox OS on WoT

Page 11: Fxos for Embedded Systems (English version)

11/31

Should all the things run browser ?

Smart Endpoint vs Dumb Endpoint This question causes debates on IoT

Should the “Things” on IoT be intelligent ? Don' be involved in the debates. Make an layer

between them. Fog computing⇒

Smart Endpoint Dumb Endpoint

Unintelligent - Pass the raw data to upper layer - Do ordered actions

Intelligent - Pass the summarized data to upper layer - Acts autonomously

Page 12: Fxos for Embedded Systems (English version)

12/31

What is Fog Computing

Create a Fog Layer between Cloud and Things

Cloud

Things

Cloud

Things

Fog

Data reception server, Database,Statistical Analytics Server, etc...

temperature, accelerometer,Geiger-Müller counter, other sensors.

CloudComputing

FogComputing

Summarize data,Transform format, etc...

Page 13: Fxos for Embedded Systems (English version)

13/31

Example of Fog Layer

Cloud

Things

Fog

Urban planning by AI

Fog

Things

Notify to neighborsAccidents statistics

Traffic accidentoccurredControl signals,

digital signage

Page 14: Fxos for Embedded Systems (English version)

14/31

Fog Computing Products

Cisco Cisco proposes Fog Computing Cisco has “Cisco Iox” Fog Development Platform It's too expensive for almost companies

Page 15: Fxos for Embedded Systems (English version)

15/31

Fog with Firefox OS

Firefox OS Fog with Firefox OS

Firefox OS has more hardware access Web APIs than Chrome、Safari、IE

Page 16: Fxos for Embedded Systems (English version)

16/31

What is required for Fog ?

Hardware access via Firefox OS Firefox OS is built with Web Technology

There is no mechanism like the Android NDK Can not use native language

Hardware control with JavaScript is required

Page 17: Fxos for Embedded Systems (English version)

17/31

The way to control Things via Web (1)

Via Network HTTP, nodejs, WebSocket, WebRTC This way is already used

sensorFirefox OS

network

Page 18: Fxos for Embedded Systems (English version)

18/31

The way to control Things via Web (2)

Control locally Without network connection There is not any path for this

⇒ Let them make API

⇒ Create new Web APIs !

sensor

Direct connectionFirefox OS

Page 19: Fxos for Embedded Systems (English version)

19/31

Add the Web APIs for Firefox OS

Page 20: Fxos for Embedded Systems (English version)

20/31

What is Web API ?

“Web API” has two means Services on the Web

Twitter API、Youtube API、... JavaScript API on the Browser (I expect this today)

navigator.getUserMedia, navigator.geolocation, …

Page 21: Fxos for Embedded Systems (English version)

21/31

Hardware access Web API

What will we create ? Create navigator.hardwareaccessxxx API like

navigator.getusermedia How to create new Web API ?

Modify Firefox

Page 22: Fxos for Embedded Systems (English version)

22/31

Modify Firefox

On Firefox, Gecko implements Web APIs So will add some new code to Gecko to create some new

Web APIs gecko/dom/geolocation etc...

Gecko

Web Application

Web API

Page 23: Fxos for Embedded Systems (English version)

23/31

Required Web API

Popular hardware for IoT input: sensor output: motor Such hardwares has GPIO or I2C interface Create Web API for GPIO and I2C

Page 24: Fxos for Embedded Systems (English version)

24/31

What is GPIO ?

What is GPIO ? General Purpose Input/Output Pins connects computers and peripherals Configure on/of or read on/of of specific pin Control on/of of LEDs or motors

Page 25: Fxos for Embedded Systems (English version)

25/31

What is I2C ?

What is I2C ? Bus for serial communication Enables you to read/write a value

GPIO deals only on/of Almost sensors and motors has this interface

Page 26: Fxos for Embedded Systems (English version)

26/31

Web GPIO API

Web GPIO API (part) navigator.requestGPIOAccess()

Get a GPIO access object gpio.ports.get(GPIO pin number)

Get a GPIO port object port.write(value)

Write to a port port.read()

Read from a port

Page 27: Fxos for Embedded Systems (English version)

27/31

Web I2C API

Web I2C API (in progress) navigator.requestI2CAccess(device_name,address)

Get an I2C device access object i2c_device.write/read(register address, value);

Write to a register, read from a register example

Drive a motor with DRV8830

var i2c_device =

navigator.requestI2CAccess("/dev/i2c-1", 0x64);

i2c_device.write(0x00, 0xfd);

Page 28: Fxos for Embedded Systems (English version)

28/31

Standardization of Web APIs

Page 29: Fxos for Embedded Systems (English version)

29/31

Standardization

WoT is not only Gecko WoT with V8 or Trident

Standard way is required Web GPIO is discussed on W3C Browsers and

Robotics Community Grouphttp://www.w3.org/community/browserobo/

Page 30: Fxos for Embedded Systems (English version)

30/31

Example of discussion

Promise vs Return value Promise

merit: async enabled demerit: deep nest

Return value merit: shallow nest demerit: async disabled

Page 31: Fxos for Embedded Systems (English version)

31/31

end