from html5 to hardware - simonyi conference budapest april 15
DESCRIPTION
Internals of Firefox OS. Process isolation, difference between Gonk/Gecko/Gaia. Tracing a call to the SMS service from the UI back to the RIL.TRANSCRIPT
![Page 1: From HTML5 to Hardware - Simonyi Conference Budapest April 15](https://reader034.vdocuments.site/reader034/viewer/2022052618/554bbc15b4c90530298b4cd5/html5/thumbnails/1.jpg)
From HTML5 to hardware
@janjongboomSimonyi Conference, Budapest, April 15
Tuesday, April 15, 14
![Page 2: From HTML5 to Hardware - Simonyi Conference Budapest April 15](https://reader034.vdocuments.site/reader034/viewer/2022052618/554bbc15b4c90530298b4cd5/html5/thumbnails/2.jpg)
@janjongboomTuesday, April 15, 14
I’m Jan, live in Amsterdam. Work for Telenor on Mozilla products. Firefox OS contributor & keyboard peer. I write code for Gaia and Gecko.
![Page 3: From HTML5 to Hardware - Simonyi Conference Budapest April 15](https://reader034.vdocuments.site/reader034/viewer/2022052618/554bbc15b4c90530298b4cd5/html5/thumbnails/3.jpg)
@janjongboomTuesday, April 15, 14
I’m Jan, live in Amsterdam. Work for Telenor on Mozilla products. Firefox OS contributor & keyboard peer. I write code for Gaia and Gecko.
![Page 4: From HTML5 to Hardware - Simonyi Conference Budapest April 15](https://reader034.vdocuments.site/reader034/viewer/2022052618/554bbc15b4c90530298b4cd5/html5/thumbnails/4.jpg)
@janjongboomTuesday, April 15, 14
I’m Jan, live in Amsterdam. Work for Telenor on Mozilla products. Firefox OS contributor & keyboard peer. I write code for Gaia and Gecko.
![Page 5: From HTML5 to Hardware - Simonyi Conference Budapest April 15](https://reader034.vdocuments.site/reader034/viewer/2022052618/554bbc15b4c90530298b4cd5/html5/thumbnails/5.jpg)
Tuesday, April 15, 14
Internet is normal for western world, but big part of the world doesnt have it.
Click Only 2.5 billion people out of 7.
![Page 6: From HTML5 to Hardware - Simonyi Conference Budapest April 15](https://reader034.vdocuments.site/reader034/viewer/2022052618/554bbc15b4c90530298b4cd5/html5/thumbnails/6.jpg)
4,500,000,000
Tuesday, April 15, 14
Internet is normal for western world, but big part of the world doesnt have it.
Click Only 2.5 billion people out of 7.
![Page 7: From HTML5 to Hardware - Simonyi Conference Budapest April 15](https://reader034.vdocuments.site/reader034/viewer/2022052618/554bbc15b4c90530298b4cd5/html5/thumbnails/7.jpg)
The web has everythingInformation does not like to be locked down
Tuesday, April 15, 14
We want people to access the web, not the closed silo’s that Android / iOS are, because thats not where the information is
![Page 8: From HTML5 to Hardware - Simonyi Conference Budapest April 15](https://reader034.vdocuments.site/reader034/viewer/2022052618/554bbc15b4c90530298b4cd5/html5/thumbnails/8.jpg)
Affordable device to access the internet
Tuesday, April 15, 14
So goal: affordable device that people can use to get on the internet
![Page 9: From HTML5 to Hardware - Simonyi Conference Budapest April 15](https://reader034.vdocuments.site/reader034/viewer/2022052618/554bbc15b4c90530298b4cd5/html5/thumbnails/9.jpg)
Tuesday, April 15, 14
Meet Firefox OS
![Page 10: From HTML5 to Hardware - Simonyi Conference Budapest April 15](https://reader034.vdocuments.site/reader034/viewer/2022052618/554bbc15b4c90530298b4cd5/html5/thumbnails/10.jpg)
19,000 HUF
Tuesday, April 15, 14
First generation came out last year. Goes for about 19000 HUF here in Hungary (65 eur)
![Page 11: From HTML5 to Hardware - Simonyi Conference Budapest April 15](https://reader034.vdocuments.site/reader034/viewer/2022052618/554bbc15b4c90530298b4cd5/html5/thumbnails/11.jpg)
Tuesday, April 15, 14
Next generation is going to be lower. System requirements are four times as low as Android.
![Page 12: From HTML5 to Hardware - Simonyi Conference Budapest April 15](https://reader034.vdocuments.site/reader034/viewer/2022052618/554bbc15b4c90530298b4cd5/html5/thumbnails/12.jpg)
Great performance on cheap hardware?
Tuesday, April 15, 14
So if we want to get great performance out of cheap hardware, how do we do it?
![Page 13: From HTML5 to Hardware - Simonyi Conference Budapest April 15](https://reader034.vdocuments.site/reader034/viewer/2022052618/554bbc15b4c90530298b4cd5/html5/thumbnails/13.jpg)
Tuesday, April 15, 14
Traditional model: Application -> VM (f.e. Dalvik on Android; .NET on Windows Phone, JavaScript in V8)
![Page 14: From HTML5 to Hardware - Simonyi Conference Budapest April 15](https://reader034.vdocuments.site/reader034/viewer/2022052618/554bbc15b4c90530298b4cd5/html5/thumbnails/14.jpg)
Dalvik .NET V8
Tuesday, April 15, 14
Traditional model: Application -> VM (f.e. Dalvik on Android; .NET on Windows Phone, JavaScript in V8)
![Page 15: From HTML5 to Hardware - Simonyi Conference Budapest April 15](https://reader034.vdocuments.site/reader034/viewer/2022052618/554bbc15b4c90530298b4cd5/html5/thumbnails/15.jpg)
Dalvik .NET V8
Apps Apps Apps
Tuesday, April 15, 14
Traditional model: Application -> VM (f.e. Dalvik on Android; .NET on Windows Phone, JavaScript in V8)
![Page 16: From HTML5 to Hardware - Simonyi Conference Budapest April 15](https://reader034.vdocuments.site/reader034/viewer/2022052618/554bbc15b4c90530298b4cd5/html5/thumbnails/16.jpg)
Most mobile OS’es
App
Tuesday, April 15, 14
VM on top of OS. Kernel is hardware dependent. But always two layers between App and Kernel.
![Page 17: From HTML5 to Hardware - Simonyi Conference Budapest April 15](https://reader034.vdocuments.site/reader034/viewer/2022052618/554bbc15b4c90530298b4cd5/html5/thumbnails/17.jpg)
Most mobile OS’es
App VM
Tuesday, April 15, 14
VM on top of OS. Kernel is hardware dependent. But always two layers between App and Kernel.
![Page 18: From HTML5 to Hardware - Simonyi Conference Budapest April 15](https://reader034.vdocuments.site/reader034/viewer/2022052618/554bbc15b4c90530298b4cd5/html5/thumbnails/18.jpg)
Most mobile OS’es
App VM OS
Tuesday, April 15, 14
VM on top of OS. Kernel is hardware dependent. But always two layers between App and Kernel.
![Page 19: From HTML5 to Hardware - Simonyi Conference Budapest April 15](https://reader034.vdocuments.site/reader034/viewer/2022052618/554bbc15b4c90530298b4cd5/html5/thumbnails/19.jpg)
Most mobile OS’es
App VM OS Kernel
Tuesday, April 15, 14
VM on top of OS. Kernel is hardware dependent. But always two layers between App and Kernel.
![Page 20: From HTML5 to Hardware - Simonyi Conference Budapest April 15](https://reader034.vdocuments.site/reader034/viewer/2022052618/554bbc15b4c90530298b4cd5/html5/thumbnails/20.jpg)
Most mobile OS’es
App VM OS Kernel Hardware
Tuesday, April 15, 14
VM on top of OS. Kernel is hardware dependent. But always two layers between App and Kernel.
![Page 21: From HTML5 to Hardware - Simonyi Conference Budapest April 15](https://reader034.vdocuments.site/reader034/viewer/2022052618/554bbc15b4c90530298b4cd5/html5/thumbnails/21.jpg)
Firefox OS
App
JS VM
Browser
Kernel Hardware
Tuesday, April 15, 14
Firefox OS only has one intermediate layer. The browser. Everything has to go through there. No exceptions like proprietary APIs (ok, well a few)
![Page 22: From HTML5 to Hardware - Simonyi Conference Budapest April 15](https://reader034.vdocuments.site/reader034/viewer/2022052618/554bbc15b4c90530298b4cd5/html5/thumbnails/22.jpg)
One application runtimeBrowser runs directly on top of the kernel
Tuesday, April 15, 14
So browser directly on top of the kernel. No overhead.
![Page 23: From HTML5 to Hardware - Simonyi Conference Budapest April 15](https://reader034.vdocuments.site/reader034/viewer/2022052618/554bbc15b4c90530298b4cd5/html5/thumbnails/23.jpg)
Everything runs in browserSMS, Payments, Marketplace
Tuesday, April 15, 14
System itself can’t take shortcuts. Everything is browser. Also system apps.
![Page 24: From HTML5 to Hardware - Simonyi Conference Budapest April 15](https://reader034.vdocuments.site/reader034/viewer/2022052618/554bbc15b4c90530298b4cd5/html5/thumbnails/24.jpg)
Small Kernel
• Small Linux kernel
• Based on Android Open Source Project
• Contains Hardware Abstraction Layer
• Porting target
• Boot straight into Gecko
Tuesday, April 15, 14
All runs on top of a very small kernel. Based on Android OSP. Contains HAL and boots straight into Gecko. Gecko is browser engine.
![Page 25: From HTML5 to Hardware - Simonyi Conference Budapest April 15](https://reader034.vdocuments.site/reader034/viewer/2022052618/554bbc15b4c90530298b4cd5/html5/thumbnails/25.jpg)
WindowsTuesday, April 15, 14
Makes it easier and light weight. Windows: 998 lines of calls to Win32 API on clipboard code.
![Page 26: From HTML5 to Hardware - Simonyi Conference Budapest April 15](https://reader034.vdocuments.site/reader034/viewer/2022052618/554bbc15b4c90530298b4cd5/html5/thumbnails/26.jpg)
Firefox OSTuesday, April 15, 14
Firefox OS: 200 lines, just have a var that holds the clipboard. Other stuff is IPC.
![Page 27: From HTML5 to Hardware - Simonyi Conference Budapest April 15](https://reader034.vdocuments.site/reader034/viewer/2022052618/554bbc15b4c90530298b4cd5/html5/thumbnails/27.jpg)
Application runtime
Tuesday, April 15, 14
Application runtime is done through iframes. Every application is iframe.
![Page 28: From HTML5 to Hardware - Simonyi Conference Budapest April 15](https://reader034.vdocuments.site/reader034/viewer/2022052618/554bbc15b4c90530298b4cd5/html5/thumbnails/28.jpg)
Window Manager
• Boot into HTML app (system)• System is the window manager• Applications are loaded in iframe• iframes can be ran out of process
Tuesday, April 15, 14
The window manager is called the system app. It creates the iframes on demand. There is automatic process isolation in place. For example Here maps.
![Page 29: From HTML5 to Hardware - Simonyi Conference Budapest April 15](https://reader034.vdocuments.site/reader034/viewer/2022052618/554bbc15b4c90530298b4cd5/html5/thumbnails/29.jpg)
remote=true
Tuesday, April 15, 14
It’s an iframe that points to a special URL that maps to a location on disk. But it has remote=true.
![Page 30: From HTML5 to Hardware - Simonyi Conference Budapest April 15](https://reader034.vdocuments.site/reader034/viewer/2022052618/554bbc15b4c90530298b4cd5/html5/thumbnails/30.jpg)
Tuesday, April 15, 14
Automatic process isolation, and automatic user isolation. Security ftw.
![Page 31: From HTML5 to Hardware - Simonyi Conference Budapest April 15](https://reader034.vdocuments.site/reader034/viewer/2022052618/554bbc15b4c90530298b4cd5/html5/thumbnails/31.jpg)
Tuesday, April 15, 14
Automatic process isolation, and automatic user isolation. Security ftw.
![Page 32: From HTML5 to Hardware - Simonyi Conference Budapest April 15](https://reader034.vdocuments.site/reader034/viewer/2022052618/554bbc15b4c90530298b4cd5/html5/thumbnails/32.jpg)
Tracing down a SMS messageFrom HTML to the RIL
Tuesday, April 15, 14
All cool, but now let’s talk about some actual code. How does it look like if you make a call from HTML to the RIL.
![Page 33: From HTML5 to Hardware - Simonyi Conference Budapest April 15](https://reader034.vdocuments.site/reader034/viewer/2022052618/554bbc15b4c90530298b4cd5/html5/thumbnails/33.jpg)
I NEED AN ADULT!Tuesday, April 15, 14
No clue what the RIL is? I’ll walk you through it.
![Page 34: From HTML5 to Hardware - Simonyi Conference Budapest April 15](https://reader034.vdocuments.site/reader034/viewer/2022052618/554bbc15b4c90530298b4cd5/html5/thumbnails/34.jpg)
Tuesday, April 15, 14
We’ll walk over what happens if you click Send, up until the moment it reaches the cell tower.
![Page 35: From HTML5 to Hardware - Simonyi Conference Budapest April 15](https://reader034.vdocuments.site/reader034/viewer/2022052618/554bbc15b4c90530298b4cd5/html5/thumbnails/35.jpg)
Gaia
Gecko
Gonk
User Interface
Browser engine
Kernel
Tuesday, April 15, 14
FFOS consists of three layers. Gaia, Gecko, Gonk
![Page 36: From HTML5 to Hardware - Simonyi Conference Budapest April 15](https://reader034.vdocuments.site/reader034/viewer/2022052618/554bbc15b4c90530298b4cd5/html5/thumbnails/36.jpg)
Gaia• Frontend• github.com/mozilla-b2g/gaia• All system applications• HTML/CSS/JS• SMS app code under /apps/sms
(that easy!)
Tuesday, April 15, 14
Gaia, open source frontend. Not limited to only run on Gecko (but at the moment it is).
![Page 37: From HTML5 to Hardware - Simonyi Conference Budapest April 15](https://reader034.vdocuments.site/reader034/viewer/2022052618/554bbc15b4c90530298b4cd5/html5/thumbnails/37.jpg)
index.html
Tuesday, April 15, 14
SMS app index.html has the button
![Page 38: From HTML5 to Hardware - Simonyi Conference Budapest April 15](https://reader034.vdocuments.site/reader034/viewer/2022052618/554bbc15b4c90530298b4cd5/html5/thumbnails/38.jpg)
thread_ui.js
Tuesday, April 15, 14
Button has click handler that goes to MessageManager. There is also a callback involved.
![Page 39: From HTML5 to Hardware - Simonyi Conference Budapest April 15](https://reader034.vdocuments.site/reader034/viewer/2022052618/554bbc15b4c90530298b4cd5/html5/thumbnails/39.jpg)
thread_ui.js
Tuesday, April 15, 14
Button has click handler that goes to MessageManager. There is also a callback involved.
![Page 40: From HTML5 to Hardware - Simonyi Conference Budapest April 15](https://reader034.vdocuments.site/reader034/viewer/2022052618/554bbc15b4c90530298b4cd5/html5/thumbnails/40.jpg)
thread_ui.js
Tuesday, April 15, 14
Button has click handler that goes to MessageManager. There is also a callback involved.
![Page 41: From HTML5 to Hardware - Simonyi Conference Budapest April 15](https://reader034.vdocuments.site/reader034/viewer/2022052618/554bbc15b4c90530298b4cd5/html5/thumbnails/41.jpg)
thread_ui.js
Tuesday, April 15, 14
Button has click handler that goes to MessageManager. There is also a callback involved.
![Page 42: From HTML5 to Hardware - Simonyi Conference Budapest April 15](https://reader034.vdocuments.site/reader034/viewer/2022052618/554bbc15b4c90530298b4cd5/html5/thumbnails/42.jpg)
thread_ui.js
Tuesday, April 15, 14
Button has click handler that goes to MessageManager. There is also a callback involved.
![Page 43: From HTML5 to Hardware - Simonyi Conference Budapest April 15](https://reader034.vdocuments.site/reader034/viewer/2022052618/554bbc15b4c90530298b4cd5/html5/thumbnails/43.jpg)
message_manager.js
Tuesday, April 15, 14
MessageManager makes a call to Gecko (under navigator object). Returns a DOMRequest. Like a promise.
![Page 44: From HTML5 to Hardware - Simonyi Conference Budapest April 15](https://reader034.vdocuments.site/reader034/viewer/2022052618/554bbc15b4c90530298b4cd5/html5/thumbnails/44.jpg)
message_manager.jsGecko!
Tuesday, April 15, 14
MessageManager makes a call to Gecko (under navigator object). Returns a DOMRequest. Like a promise.
![Page 45: From HTML5 to Hardware - Simonyi Conference Budapest April 15](https://reader034.vdocuments.site/reader034/viewer/2022052618/554bbc15b4c90530298b4cd5/html5/thumbnails/45.jpg)
message_manager.jsGecko!
Tuesday, April 15, 14
MessageManager makes a call to Gecko (under navigator object). Returns a DOMRequest. Like a promise.
![Page 46: From HTML5 to Hardware - Simonyi Conference Budapest April 15](https://reader034.vdocuments.site/reader034/viewer/2022052618/554bbc15b4c90530298b4cd5/html5/thumbnails/46.jpg)
We need to go deeper!Tuesday, April 15, 14
So let’s go into Gecko.
![Page 47: From HTML5 to Hardware - Simonyi Conference Budapest April 15](https://reader034.vdocuments.site/reader034/viewer/2022052618/554bbc15b4c90530298b4cd5/html5/thumbnails/47.jpg)
Gecko
• Browser engine• Same as Firefox for Desktop / Android / etc.• Runs directly on kernel (B2G)
Tuesday, April 15, 14
Browser engine
![Page 48: From HTML5 to Hardware - Simonyi Conference Budapest April 15](https://reader034.vdocuments.site/reader034/viewer/2022052618/554bbc15b4c90530298b4cd5/html5/thumbnails/48.jpg)
nsIDOMMobileMessageManager.idl(yeah, that’s long)
Tuesday, April 15, 14
Gecko has IDL files. These are shared by browser vendors so eveyrone implements the same API. Can be implemented in C++ or JSM (variant of JS)
![Page 49: From HTML5 to Hardware - Simonyi Conference Budapest April 15](https://reader034.vdocuments.site/reader034/viewer/2022052618/554bbc15b4c90530298b4cd5/html5/thumbnails/49.jpg)
nsIDOMMobileMessageManager.idl(yeah, that’s long)
addEventListener
Tuesday, April 15, 14
Gecko has IDL files. These are shared by browser vendors so eveyrone implements the same API. Can be implemented in C++ or JSM (variant of JS)
![Page 50: From HTML5 to Hardware - Simonyi Conference Budapest April 15](https://reader034.vdocuments.site/reader034/viewer/2022052618/554bbc15b4c90530298b4cd5/html5/thumbnails/50.jpg)
nsIDOMMobileMessageManager.idl(yeah, that’s long)
Tuesday, April 15, 14
Gecko has IDL files. These are shared by browser vendors so eveyrone implements the same API. Can be implemented in C++ or JSM (variant of JS)
![Page 51: From HTML5 to Hardware - Simonyi Conference Budapest April 15](https://reader034.vdocuments.site/reader034/viewer/2022052618/554bbc15b4c90530298b4cd5/html5/thumbnails/51.jpg)
MobileMessageManager.cppCould also be .jsm
Tuesday, April 15, 14
Inheritance chain. This is written in CPP.
![Page 52: From HTML5 to Hardware - Simonyi Conference Budapest April 15](https://reader034.vdocuments.site/reader034/viewer/2022052618/554bbc15b4c90530298b4cd5/html5/thumbnails/52.jpg)
MobileMessageManager.cppCould also be .jsm
Tuesday, April 15, 14
Inheritance chain. This is written in CPP.
![Page 53: From HTML5 to Hardware - Simonyi Conference Budapest April 15](https://reader034.vdocuments.site/reader034/viewer/2022052618/554bbc15b4c90530298b4cd5/html5/thumbnails/53.jpg)
MobileMessageManager.cpp
Tuesday, April 15, 14
JS values get boxed automatically. We create a new DOMRequest. See the gaia code.
![Page 54: From HTML5 to Hardware - Simonyi Conference Budapest April 15](https://reader034.vdocuments.site/reader034/viewer/2022052618/554bbc15b4c90530298b4cd5/html5/thumbnails/54.jpg)
MobileMessageManager.cpp
Tuesday, April 15, 14
JS values get boxed automatically. We create a new DOMRequest. See the gaia code.
![Page 55: From HTML5 to Hardware - Simonyi Conference Budapest April 15](https://reader034.vdocuments.site/reader034/viewer/2022052618/554bbc15b4c90530298b4cd5/html5/thumbnails/55.jpg)
MobileMessageManager.cpp
Tuesday, April 15, 14
JS values get boxed automatically. We create a new DOMRequest. See the gaia code.
![Page 56: From HTML5 to Hardware - Simonyi Conference Budapest April 15](https://reader034.vdocuments.site/reader034/viewer/2022052618/554bbc15b4c90530298b4cd5/html5/thumbnails/56.jpg)
MobileMessageManager.cpp
Tuesday, April 15, 14
JS values get boxed automatically. We create a new DOMRequest. See the gaia code.
![Page 57: From HTML5 to Hardware - Simonyi Conference Budapest April 15](https://reader034.vdocuments.site/reader034/viewer/2022052618/554bbc15b4c90530298b4cd5/html5/thumbnails/57.jpg)
MobileMessageManager.cpp
Tuesday, April 15, 14
Then in the same function we make a call to the SMS Service. This is platform specific. Android does different than FFOS.
![Page 58: From HTML5 to Hardware - Simonyi Conference Budapest April 15](https://reader034.vdocuments.site/reader034/viewer/2022052618/554bbc15b4c90530298b4cd5/html5/thumbnails/58.jpg)
MobileMessageManager.cpp
Services are platform speci!c
Tuesday, April 15, 14
Then in the same function we make a call to the SMS Service. This is platform specific. Android does different than FFOS.
![Page 59: From HTML5 to Hardware - Simonyi Conference Budapest April 15](https://reader034.vdocuments.site/reader034/viewer/2022052618/554bbc15b4c90530298b4cd5/html5/thumbnails/59.jpg)
moz.buildService injection at compile time
Tuesday, April 15, 14
This is the service injection in moz.build. Happens at compile time. In android we need Android SMS database access. FFOS we don’t.
![Page 60: From HTML5 to Hardware - Simonyi Conference Budapest April 15](https://reader034.vdocuments.site/reader034/viewer/2022052618/554bbc15b4c90530298b4cd5/html5/thumbnails/60.jpg)
moz.buildService injection at compile time
Tuesday, April 15, 14
This is the service injection in moz.build. Happens at compile time. In android we need Android SMS database access. FFOS we don’t.
![Page 61: From HTML5 to Hardware - Simonyi Conference Budapest April 15](https://reader034.vdocuments.site/reader034/viewer/2022052618/554bbc15b4c90530298b4cd5/html5/thumbnails/61.jpg)
Tuesday, April 15, 14
Time to go DEEPER
![Page 62: From HTML5 to Hardware - Simonyi Conference Budapest April 15](https://reader034.vdocuments.site/reader034/viewer/2022052618/554bbc15b4c90530298b4cd5/html5/thumbnails/62.jpg)
Gonk
• Kernel• Hardware Abstraction• Think of the clipboard example• Android code calls back to Android• We can go straight to the RIL
Tuesday, April 15, 14
Gonk is the kernel. If you have platform dependent code it’s not in Gecko but in Gonk. Target for Gecko.
![Page 63: From HTML5 to Hardware - Simonyi Conference Budapest April 15](https://reader034.vdocuments.site/reader034/viewer/2022052618/554bbc15b4c90530298b4cd5/html5/thumbnails/63.jpg)
SmsService.cpp
Tuesday, April 15, 14
Get the radio interface layer. It’s the API to the chipset in the phone. And send SMS.
![Page 64: From HTML5 to Hardware - Simonyi Conference Budapest April 15](https://reader034.vdocuments.site/reader034/viewer/2022052618/554bbc15b4c90530298b4cd5/html5/thumbnails/64.jpg)
SmsService.cpp
Tuesday, April 15, 14
Get the radio interface layer. It’s the API to the chipset in the phone. And send SMS.
![Page 65: From HTML5 to Hardware - Simonyi Conference Budapest April 15](https://reader034.vdocuments.site/reader034/viewer/2022052618/554bbc15b4c90530298b4cd5/html5/thumbnails/65.jpg)
SmsService.cpp
Tuesday, April 15, 14
Get the radio interface layer. It’s the API to the chipset in the phone. And send SMS.
![Page 66: From HTML5 to Hardware - Simonyi Conference Budapest April 15](https://reader034.vdocuments.site/reader034/viewer/2022052618/554bbc15b4c90530298b4cd5/html5/thumbnails/66.jpg)
dom/system folder
Tuesday, April 15, 14
There are a bunch of platforms, they implement the services. In this case the RIL service is implemented by Gonk.
![Page 67: From HTML5 to Hardware - Simonyi Conference Budapest April 15](https://reader034.vdocuments.site/reader034/viewer/2022052618/554bbc15b4c90530298b4cd5/html5/thumbnails/67.jpg)
nsIRadioInterfaceLayer.idl
Tuesday, April 15, 14
Also has IDL definitions.
![Page 68: From HTML5 to Hardware - Simonyi Conference Budapest April 15](https://reader034.vdocuments.site/reader034/viewer/2022052618/554bbc15b4c90530298b4cd5/html5/thumbnails/68.jpg)
nsIRadioInterfaceLayer.idl
Tuesday, April 15, 14
Also has IDL definitions.
![Page 69: From HTML5 to Hardware - Simonyi Conference Budapest April 15](https://reader034.vdocuments.site/reader034/viewer/2022052618/554bbc15b4c90530298b4cd5/html5/thumbnails/69.jpg)
nsIRadioInterfaceLayer.idl
Tuesday, April 15, 14
Also has IDL definitions.
![Page 70: From HTML5 to Hardware - Simonyi Conference Budapest April 15](https://reader034.vdocuments.site/reader034/viewer/2022052618/554bbc15b4c90530298b4cd5/html5/thumbnails/70.jpg)
RadioInterfaceLayer.jsCould also be .cpp
Tuesday, April 15, 14
RIL code has been written in javascript in this case. It does stuff like normalizing phone numbers, because the chipset won’t do that for you
![Page 71: From HTML5 to Hardware - Simonyi Conference Budapest April 15](https://reader034.vdocuments.site/reader034/viewer/2022052618/554bbc15b4c90530298b4cd5/html5/thumbnails/71.jpg)
RadioInterfaceLayer.jsCould also be .cpp
Tuesday, April 15, 14
RIL code has been written in javascript in this case. It does stuff like normalizing phone numbers, because the chipset won’t do that for you
![Page 72: From HTML5 to Hardware - Simonyi Conference Budapest April 15](https://reader034.vdocuments.site/reader034/viewer/2022052618/554bbc15b4c90530298b4cd5/html5/thumbnails/72.jpg)
RadioInterfaceLayer.jsCould also be .cpp
Tuesday, April 15, 14
RIL code has been written in javascript in this case. It does stuff like normalizing phone numbers, because the chipset won’t do that for you
![Page 73: From HTML5 to Hardware - Simonyi Conference Budapest April 15](https://reader034.vdocuments.site/reader034/viewer/2022052618/554bbc15b4c90530298b4cd5/html5/thumbnails/73.jpg)
RadioInterfaceLayer.js
Tuesday, April 15, 14
Now dispatch to a worker. JS single-threaded. Can’t wait for the response from hardware. Response codes are RIL data. Use these to feed back into the DOMRequest.
![Page 74: From HTML5 to Hardware - Simonyi Conference Budapest April 15](https://reader034.vdocuments.site/reader034/viewer/2022052618/554bbc15b4c90530298b4cd5/html5/thumbnails/74.jpg)
RadioInterfaceLayer.js
Tuesday, April 15, 14
Now dispatch to a worker. JS single-threaded. Can’t wait for the response from hardware. Response codes are RIL data. Use these to feed back into the DOMRequest.
![Page 75: From HTML5 to Hardware - Simonyi Conference Budapest April 15](https://reader034.vdocuments.site/reader034/viewer/2022052618/554bbc15b4c90530298b4cd5/html5/thumbnails/75.jpg)
RadioInterfaceLayer.js
Tuesday, April 15, 14
Now dispatch to a worker. JS single-threaded. Can’t wait for the response from hardware. Response codes are RIL data. Use these to feed back into the DOMRequest.
![Page 76: From HTML5 to Hardware - Simonyi Conference Budapest April 15](https://reader034.vdocuments.site/reader034/viewer/2022052618/554bbc15b4c90530298b4cd5/html5/thumbnails/76.jpg)
Tuesday, April 15, 14
rilMessageToken is used to get the callbacks.
![Page 77: From HTML5 to Hardware - Simonyi Conference Budapest April 15](https://reader034.vdocuments.site/reader034/viewer/2022052618/554bbc15b4c90530298b4cd5/html5/thumbnails/77.jpg)
Tuesday, April 15, 14
rilMessageToken is used to get the callbacks.
![Page 78: From HTML5 to Hardware - Simonyi Conference Budapest April 15](https://reader034.vdocuments.site/reader034/viewer/2022052618/554bbc15b4c90530298b4cd5/html5/thumbnails/78.jpg)
Tuesday, April 15, 14
Something in between to shake up the audience.
![Page 79: From HTML5 to Hardware - Simonyi Conference Budapest April 15](https://reader034.vdocuments.site/reader034/viewer/2022052618/554bbc15b4c90530298b4cd5/html5/thumbnails/79.jpg)
ril_worker.js
Tuesday, April 15, 14
Now ril_worker talks to the actual hardware. Pretty simple stuff. Some options.
![Page 80: From HTML5 to Hardware - Simonyi Conference Budapest April 15](https://reader034.vdocuments.site/reader034/viewer/2022052618/554bbc15b4c90530298b4cd5/html5/thumbnails/80.jpg)
Mindig írni byte az én RIL!
Tuesday, April 15, 14
I always write bytes to the RIL. RIL doesn’t understand JS or CPP. Only understands bytes.
![Page 81: From HTML5 to Hardware - Simonyi Conference Budapest April 15](https://reader034.vdocuments.site/reader034/viewer/2022052618/554bbc15b4c90530298b4cd5/html5/thumbnails/81.jpg)
ril_worker.js
Tuesday, April 15, 14
So now depending on protocol we talk, we dump bytes. SEND_SMS is 25, then some options. Send the parcel and now it’s on the actual RIL.
![Page 82: From HTML5 to Hardware - Simonyi Conference Budapest April 15](https://reader034.vdocuments.site/reader034/viewer/2022052618/554bbc15b4c90530298b4cd5/html5/thumbnails/82.jpg)
ril_worker.js
Tuesday, April 15, 14
So now depending on protocol we talk, we dump bytes. SEND_SMS is 25, then some options. Send the parcel and now it’s on the actual RIL.
![Page 83: From HTML5 to Hardware - Simonyi Conference Budapest April 15](https://reader034.vdocuments.site/reader034/viewer/2022052618/554bbc15b4c90530298b4cd5/html5/thumbnails/83.jpg)
ril_worker.js
Tuesday, April 15, 14
So now depending on protocol we talk, we dump bytes. SEND_SMS is 25, then some options. Send the parcel and now it’s on the actual RIL.
![Page 84: From HTML5 to Hardware - Simonyi Conference Budapest April 15](https://reader034.vdocuments.site/reader034/viewer/2022052618/554bbc15b4c90530298b4cd5/html5/thumbnails/84.jpg)
ril_worker.js
Tuesday, April 15, 14
So now depending on protocol we talk, we dump bytes. SEND_SMS is 25, then some options. Send the parcel and now it’s on the actual RIL.
![Page 85: From HTML5 to Hardware - Simonyi Conference Budapest April 15](https://reader034.vdocuments.site/reader034/viewer/2022052618/554bbc15b4c90530298b4cd5/html5/thumbnails/85.jpg)
Radio Interface Layer• Proprietary• Comes with chipset• Trade secret• Delivered to RIL? Done!• See how it looks like?
https://github.com/mozilla-b2g/b2g/
Tuesday, April 15, 14
And that’s where our job is done. RIL is proprietary and comes with chipset. RIL calls back with the token, we bubble it up back to Gecko and eventually Gaia, and show user the feedback. This happens in under a second. There is ref implementtion from Mozilla if you want to look at it.
![Page 86: From HTML5 to Hardware - Simonyi Conference Budapest April 15](https://reader034.vdocuments.site/reader034/viewer/2022052618/554bbc15b4c90530298b4cd5/html5/thumbnails/86.jpg)
OMGAWESOMEPlay around? I have devices with me.
Tuesday, April 15, 14
OMG AWESOME SHIT. All open source. I have some devices, including the 25$ phone with me.
![Page 87: From HTML5 to Hardware - Simonyi Conference Budapest April 15](https://reader034.vdocuments.site/reader034/viewer/2022052618/554bbc15b4c90530298b4cd5/html5/thumbnails/87.jpg)
Thank you!
slideshare.net/janjongboomTuesday, April 15, 14
Thanks!
![Page 88: From HTML5 to Hardware - Simonyi Conference Budapest April 15](https://reader034.vdocuments.site/reader034/viewer/2022052618/554bbc15b4c90530298b4cd5/html5/thumbnails/88.jpg)
slideshare.net/janjongboom
Questions?
Tuesday, April 15, 14
Thanks!