Page 1
HTML5 and JAVABeagleBoard, Raspberry Pi
Page 2
HTML5 and JAVABeagleBoard, Raspberry Pi
approv
ed
Page 4
Gerrit Grunwaldcanoo Engineering AG
TWITTER: @hansolo_ WEB: harmonic-code.org
Page 6
what embedded
IS...
Page 7
the point of view
...depends on
Page 8
Hardware
Developer
Page 9
Software
Developer
Page 11
KioskJavaFX
powe
red
Page 14
CPU : ARM A9 DualCoreClock: 1.2 GHzRam : 1 GBGPU : Power VR SGX540
Page 17
Benefits of Java★ Superb developer toolchain
Page 18
Benefits of Java★ Superb developer toolchain★ Mature, fast, widespread
Page 19
Benefits of Java★ Superb developer toolchain★ Mature, fast, widespread★ Thousands of libraries
Page 20
Benefits of Java★ Superb developer toolchain★ Mature, fast, widespread★ Thousands of libraries★ Huge community
Page 21
Benefits of Java★ Superb developer toolchain★ Mature, fast, widespread★ Thousands of libraries★ Huge community★ No standard on embedded
Page 24
Possible
USECASES5
Page 27
★Home automation
★Home entertainment
Page 28
★Home automation
★Home entertainment
★Medical devices
Page 29
★Home automation
★Home entertainment
★Medical devices
★ Information Kiosks
Page 30
★Home automation
★Home entertainment
★Medical devices
★ Information Kiosks
★Education
Page 31
EMBEDDED ?WHAT IS JAVAFX ON
Page 32
A Subset of
JAVAFX
Page 33
Without support for
Page 34
Without support for
★ Swing/SWT
Page 35
Without support for
★ Swing/SWT★ System Menu
Page 36
Without support for
★ Swing/SWT★ System Menu★ Drag'n Drop
Page 37
Without support for
★ Swing/SWT★ System Menu★ Drag'n Drop★ WebView
Page 39
Available SDK's
★JDK 7 (JFX 2)
Page 40
Available SDK's
★JDK 7 (JFX 2)★JDK 8 (JFX 8)
Page 41
Target* footprint
Page 42
Target* footprint
MIN ~16 MB
*~32 MB today
Page 43
PLATFORMS ?WHAT ARE THE SUPPORTED
Page 44
BeagleBoard xM
Raspberry Pi
Page 48
★ ARM A8, 1 GHz★ 512 MB RAM
Page 49
★ ARM A8, 1 GHz★ 512 MB RAM★ 4 x USB
Page 50
★ ARM A8, 1 GHz★ 512 MB RAM★ 4 x USB★ ETHERNET RJ45
Page 51
★ ARM A8, 1 GHz★ 512 MB RAM★ 4 x USB★ ETHERNET RJ45★ HDMI
Page 52
★ ARM A8, 1 GHz★ 512 MB RAM★ 4 x USB★ ETHERNET RJ45★ HDMI★ I2C, JTAG, SPI
Page 53
running on
Ångström
Page 54
running on
Ångströmbased on Debian
Page 55
xMBeagleBoard
JDK 7JavaFX 2
Page 56
xMBeagleBoard
JDK 7JavaFX 2
with SoftFloat support
Page 59
★ ARM v6, 700 MHz
Page 60
★ ARM v6, 700 MHz★ 512 MB RAM
Page 61
★ ARM v6, 700 MHz★ 512 MB RAM★ 2 x USB
Page 62
★ ARM v6, 700 MHz★ 512 MB RAM★ 2 x USB★ ETHERNET RJ45
Page 63
★ ARM v6, 700 MHz★ 512 MB RAM★ 2 x USB★ ETHERNET RJ45★ HDMI, COMPOSITE
Page 64
★ ARM v6, 700 MHz★ 512 MB RAM★ 2 x USB★ ETHERNET RJ45★ HDMI, COMPOSITE★ GPIO, I2C, UART, SPI
Page 65
running on
Raspbian
Page 66
running on
Raspbianbased on Debian
Page 67
PiRaspberry
JDK 8JavaFX 8
Page 68
PiRaspberry
JDK 8JavaFX 8
with HardFloat support
Page 69
JavaSo...having
means...
Page 70
ANYWHEREWRITE ONCE RUN ?
Page 71
SOMEFACTS
FIRST...
Page 72
Intel i7 Quadcore2.3 GHz
16 GB ram
Nvidia GeForceGT 650m
ARM A81 Ghz
512 MB ram
Power VRSGX series 5
Macbook Pro BeagleBoard xM
Page 73
Nvidia GeForceGT 650m
Power VRSGX series 5
Macbook Pro BeagleBoard xM
Page 74
Nvidia GeForceGT 650m
Power VRSGX series 5
Macbook Pro BeagleBoard xM
★ 384 Cores★ ~15 GPixel/s★ ~600 GFlops
★ 1 Core★ ~500 MPixel/s★ ~1.6 GFlops
Page 75
REQUIREMENTSEmbedded
Page 77
Requirements
★ touchable user interface
Page 78
Requirements
★ touchable user interface★ reasonable controls
Page 79
Requirements
★ touchable user interface★ reasonable controls★ no mouse and keyboard
Page 80
Requirements
★ touchable user interface★ reasonable controls★ no mouse and keyboard★ restriced screen estate
Page 82
ANYWHEREWRITE ONCE RUN!NO
Page 83
RECYCLE A LOTBut you can
Page 84
FROM MOBILEAnd learn
60 cm 50 mm90 m
m
34 cm
Page 86
MonitoringTemperature
Page 88
Requirements
★ Measure the temperature
Page 89
Requirements
★ Measure the temperature★ Monitor on site
Page 90
Requirements
★ Measure the temperature★ Monitor on site★ Monitor on desktop
Page 91
Requirements
★ Measure the temperature★ Monitor on site★ Monitor on desktop★ Monitor on mobile
Page 93
Requirements
★ Feedback on site
Page 94
Requirements
★ Feedback on site★ Feedback on desktop
Page 95
Requirements
★ Feedback on site★ Feedback on desktop★ No platform dependency
Page 100
Hardware
★ Raspberry Pi for measuring the temperature
Page 101
Hardware
★ Raspberry Pi for measuring the temperature
★ BeagleBoard xM with lcd for on site monitoring
Page 102
measuring ?A Raspberry Pi for
Page 103
Overkill ?Isn't it
Page 104
Overkill ?Isn't it
Page 105
but it's cheap...
OF COURSE
Page 108
Raspberry Pi
★Raspberry Pi
Page 109
Raspberry Pi
★Raspberry Pi★Case for the Pi
Page 110
Raspberry Pi
★Raspberry Pi★Case for the Pi★Power Supply
Page 111
Raspberry Pi
★Raspberry Pi★Case for the Pi★Power Supply★Serial to USB Converter
Page 112
Raspberry Pi
★Raspberry Pi★Case for the Pi★Power Supply★Serial to USB Converter★ Industrial serial temp sensor
Page 113
Raspberry Pi
★Raspberry Pi★Case for the Pi★Power Supply★Serial to USB Converter★ Industrial serial temp sensor★Network connection
Page 117
BeagleBoard
★Beagleboard xM
Page 118
BeagleBoard
★Beagleboard xM★10" LCD touchscreen
Page 119
BeagleBoard
★Beagleboard xM★10" LCD touchscreen★Case
Page 120
BeagleBoard
★Beagleboard xM★10" LCD touchscreen★Case★Power Supply
Page 121
BeagleBoard
★Beagleboard xM★10" LCD touchscreen★Case★Power Supply★USB relay board
Page 122
BeagleBoard
★Beagleboard xM★10" LCD touchscreen★Case★Power Supply★USB relay board★Some indicator (Werma design42)
Page 124
350 $Estimated
excl. the Signaltower
Page 127
Desktop
★Windows, OS X or Linux
Page 128
Desktop
★Windows, OS X or Linux★Java Virtual Machine (> JDK 7u6)
Page 129
Desktop
★Windows, OS X or Linux★Java Virtual Machine (> JDK 7u6)★Network connection
Page 132
Mobile
★ iOS, Android, ...
Page 133
Mobile
★ iOS, Android, ...★HTML5 capable browser
Page 134
Mobile
★ iOS, Android, ...★HTML5 capable browser★Network connection
Page 137
Platforms
★ Raspberry Pi on Java 8
Page 138
Platforms
★ Raspberry Pi on Java 8★ BeagleBoard xM on Java 7
Page 139
Platforms
★ Raspberry Pi on Java 8★ BeagleBoard xM on Java 7★ Desktop Client on Java 7
Page 140
Platforms
★ Raspberry Pi on Java 8★ BeagleBoard xM on Java 7★ Desktop Client on Java 7★ Mobile Client on HTML5
Page 141
What aboutCOMMUNICATION
Page 143
Communication
★ xmpp (extensible messaging and presence protocol)
Page 144
Communication
★ xmpp (extensible messaging and presence protocol)
★ smack xmpp java library
Page 145
Communication
★ xmpp (extensible messaging and presence protocol)
★ smack xmpp java library★ bosh (bidirectional streams over synchronous http)
Page 146
Overview
Java Emb.Raspberry Pi
Java FXDesktop
HTML5Mobile
Java FX emb.BeagleBoard xM
xmppServer
∆10 sec
Page 147
Overview
Java Emb.Raspberry Pi
Java FXDesktop
HTML5Mobile
Java FX emb.BeagleBoard xM
xmppServer
Page 148
Advantage of xmpp
Page 149
Advantage of xmpp
★ free infrastructure
Page 150
Advantage of xmpp
★ free infrastructure★ widely used
Page 151
Advantage of xmpp
★ free infrastructure★ widely used★ extensible
Page 152
Advantage of xmpp
★ free infrastructure★ widely used★ extensible★ presence
Page 153
Advantage of xmpp
Page 154
Advantage of xmpp
★ use one account on different resources
Page 155
Advantage of xmpp
★ use one account on different resources
★ fast
Page 156
Advantage of xmpp
★ use one account on different resources
★ fast★ mature
Page 157
1Raspberry Pi
APPLICATION
Page 159
Requirements
★ measure the temperature
Page 160
Requirements
★ measure the temperature★ distribute the data via xmpp
Page 163
ONHEADLESS
JavaFX
Page 164
Sensor Class
XMPP Class
Page 165
Sensor ClassDoubleProperty celsius = new SimpleDoubleProperty();
public ReadOnlyDoubleProperty celsiusProperty() { return celsius;}
XMPP Class
Page 166
Sensor ClassDoubleProperty celsius = new SimpleDoubleProperty();
public ReadOnlyDoubleProperty celsiusProperty() { return celsius;}
... BufferedReader br = new BufferedReader(new InputStreamReader(is)); while (running) { try { while((br.ready() && (line = br.readline) != null)) { celsius.set(Double.parseDouble(line)); } catch (Exception exception) {} }...
XMPP Class
Page 167
Sensor ClassDoubleProperty celsius = new SimpleDoubleProperty();
public ReadOnlyDoubleProperty celsiusProperty() { return celsius;}
XMPP ClasssensorClass.celsiusProperty().addListener( new ChangeListener<Number>() { @Override public void changed( ObservableValue<? extends Number> ov, Number oldC, Number newC) { sendMessage(newC.doubleValue(), RECEIVER); } });
Page 168
extensiblexmpp is
Page 169
xmpp is extensible// Exchange data with otherspublic void sendData(String id, double celsius, double fahrenheit, double humidity, double pressure, double latitude, double longitude, String signalTowerColor, String JID) throws XMPPException { Message message = new Message(); message.setProperty("id", id); message.setProperty("celsius", celsius); message.setProperty("fahrenheit", fahrenheit); message.setProperty("humidity", humidity); message.setProperty("pressure", pressure); message.setProperty("latitude", latitude); message.setProperty("longitude", longitude); message.setProperty("signalTowerColor", signalTowerColor); Chat chat = chatManager.createChat(JID, messageListener); chat.sendMessage(message);}
Page 170
why not chattingxmpp == jabber
”“ ”“
Page 171
Chat with the Pi// The XMPP Packet listener running on the Raspberry Piprivate class XmppPacketListener implements PacketListener { @Override public void processPacket(Packet packet) { String from = ((Message) packet).getFrom(); String body = ((Message) packet).getBody(); if (body.toLowerCase().equals("temp?")) { answerTempRequest(from); } else if (body.toLowerCase().equals("location?")) { answerLocationRequest(from); } else if (body.toLowerCase().equals("history?")) { answerHistoryRequest(from); } else if (body.toLowerCase().equals("humidity?")) { answerHumidityRequest(from); } else if (body.toLowerCase().equals("pressure?")) { answerPressureRequest(from); } }}
Page 172
Chat with the Pi// Answering the temperature requestpublic void answerTempRequest(final String JID) { new Thread(new Runnable() { @Override public void run() { try { Message message = new Message(); message.setBody("Current temperature at " + id + ":\n" + celsius + " °C\n" + fahrenheit + " °F"); Chat chat = chatManager.createChat(JID, messageListener); chat.sendMessage(message); } catch (XMPPException exception) {...} } }).start();}
Page 173
Chat with the Pi
Page 174
2BeagleBoard
APPLICATION
Page 178
Requirements
★ Visualize the temperature on connected lcd
Page 179
Requirements
★ Visualize the temperature on connected lcd
★ Indicate the status on the outside
Page 180
Do we need this ?
Page 181
Isn't this enough ?
Page 182
Ok, let's take this
Page 184
CONTENT
IT'S ABOUT
OVER CHROME
Page 185
3 Nodes
CHROMECONTENT
245 Nodes
Page 186
3 Nodes
COMPROMISECONTENT
33 Nodes
Page 188
3Desktop
APPLICATION
Page 192
Requirements
★ Visualize the temperature
Page 193
Requirements
★ Visualize the temperature★ No platform dependency
Page 194
Requirements
★ Visualize the temperature★ No platform dependency★ Feedback on current value
Page 196
JavaFX Benefits
★ Cross platform
Page 197
JavaFX Benefits
★ Cross platform★ Good graphic support
Page 198
JavaFX Benefits
★ Cross platform★ Good graphic support★ Good audio support
Page 199
JavaFX Benefits
★ Cross platform★ Good graphic support★ Good audio support★ Easy to implment
Page 201
4HTML5
APPLICATION
Page 204
Requirements
★ Monitor the temperature
Page 206
HTML5 on Phone
★ Pure JavaScript
Page 207
HTML5 on Phone
★ Pure JavaScript★ Using SteelSeries
Page 208
HTML5 on Phone
★ Pure JavaScript★ Using SteelSeries★ Using Highcharts
Page 211
5Just for the
FUN OF IT...
Page 212
Google Earth client
Page 214
really rocks...JAVA(FX) ON EMBEDDED
Page 216
Text
Text
TextText
keep coding...