Java in the Internet of Things: Small, Smart,...
Transcript of Java in the Internet of Things: Small, Smart,...
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 1
Java in the Internet of Things: Small, Smart, Connected Terrence Barr (@terrencebarr) Senior Technologist, Principal Product Manager Oracle
Angela Caicedo (@acaicedo) Technologist Evangelist Oracle
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 2
Safe Harbor Statement
The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, and timing of any features or functionality described for Oracle’s products remains at the sole discretion of Oracle.
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 3
Program Agenda
§ The 3rd IT Revolution: Tackling the Opportunity § Java: The Platform for the Internet of Things § Oracle Java ME Embedded 3.3 § Demos § Java ME 8: The Next Generation § Roadmap + Wrapping Up
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 4
The 3rd IT Revolution: Tackling the Opportunity
x86 Architecture/ Windows OS
Standards Based Hardware & Software Proprietary Hardware
& Software
1960 - 1985 Host Era
2006 - 2025 Internet of Things
1985-2006 PC Era
The 3rd IT Revolution
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 6
Internet of Things: Everything Connected Industrial & Commercial Equipment
Point of Sale Kiosks
Energy & Smart grid
Automative & Commercial
Transportation
Wireless Health
Connected Consumer Devices
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 7
The Full Picture: Device to Data Center It’s not just about the device!
Event Processing
Data Management
Big Data Analytics
Integration
Spatial/GIS
CRM
Service
Billing
Industry Solutions
Intelligent System Application
Portal
UI
Sensing Device Concentrator or Gateway Network Cloud Intelligent Systems
Foundation Supporting Applications
Other Data Generating Sources such as Social
Media
Fixed Internet
2G, 3G, LTE, Satellite
NFC, Bluetooth, Zigbee, WLAN, DASH7 Fixed
Internet
Internet
Gateway
Network Abstraction
Protocol Gateway
Service Bus
Data Sync, Control, Feedback and Updates
Data Encryption, Device and Application Identity and Access Management
Base Stations Switches
Management Billing
Provisioning
Scalable Resilient Secure
Standards Based Managed Integrated
Value-Add Services
External Systems
Industry Specific core solutions and external/customer
systems
Any Device from Cameras, Smart Cards, Medical
Equipment, Consumer Goods,
Vehicles, Containers, Buildings.
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 8
IoT Development is Different
• Multitude and variety of devices
• Security, privacy, reliablity • Remoteness, no human
control
• Provisioning, management and monitoring
• Data flow and analytics • Interoperability and
standards
What keeps you awake at night?
• Long device lifecycle • Connectivity, cost,
infrastructure, bandwidth • Device cost, power
requirements
• Developer productivity • Development cost, skill
sets, re-use • Time-to-market
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 9
Need for an IoT Platform Stop reinventing the plumbing!
Your Value-Add
Shift from proprietary point
solutions to
horizontal platforms and
infrastructure
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 10
Java: The Platform for Device to Datacenter
Enterprise Data & Applications
Meters
Smart Appliances & electronics
Personal Devices
Med-Large Embedded / Multi-function Devices
VoIP Comm
Industrial controls / Network Appliances
Management / Monitoring / Operations
Sensors / Microcontrollers
Connected Vehicles
A single development architecture across all domains
Connectivity
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 11
Java Technology Benefits For Embedded
Software Updatability
Developer Ecosystem
Off-the-shelf components
Portability
Security Standards-based
Proven
Single end-to-end development platform
Trusted vendor
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 12
Introduction into Oracle Java ME Embedded 3.3
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 13
Oracle Java ME Embedded Focus
Platform Footprint
Device CPU/ GPU/I-O ARM 7 Cortex M ARM9/11 MIPS32 - ARM Cortex A – PPC - Intel
Atom
50KB-1MB
1MB-10MB
10MB-100MB Java ME Java SE
Java Card
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 14
Designed for Small Embedded • Complete Java runtime optimized for low-
footprint ARM architecture devices • Portable, extensible architecture to address
diverse embedded requirements • Dedicated embedded features and APIs
Latest Java ME platform • Best-in-class multitasking VM • APIs to support connectivity, encryption,
location, and web services • Based on proven, widely-deployed
technology
Flexible service platform • Extend system life via remote software
update preserving system integrity and certification
• Cross-platform, modular applications • Distributed processing through Java end to
end
Best-in-class tool chain • Java ME SDK tools and emulation • Netbeans and Eclipse IDE support • Live, Java-level debugging on device
Oracle Java ME Embedded High-performance Java runtime for small embedded
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 15
Oracle Java ME Embedded Unique and dedicated features for embedded
Highly Optimized VM
• Multi-tasking VM • Robust, 24x7
operation • Tuned for low
footprint and efficiency
• In-field VM configurability
Embedded Extensions
• Fully headless operation
• Wireless and wired connectivity
• Direct access to hardware from Java
• Extensibility by OEM or integrator
Remote Operation
• Remote application deployment and management
• Automatic start-up and recovery
• Remote monitoring options
Low-footprint embedded targets
• Supports microcontroller-class systems
• Portable and configurable
• Very low requirements, starting at • 350 KB ROM • 130 KB RAM
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 16
Tools – Developing Efficiently
NetBeans + device emulation
• Java ME SDK – Tools and emulation for rapid development
of embedded Java ME applications
• NetBeans & Eclipse Plug-ins – Integration with Java ME SDK – Full-featured, integrated development
environment for embedded – Familiar toolchain (Java SE & EE dev.)
Java ME SDK and IDEs
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 17
Oracle Java ME Embedded 3.3 Stack A rich embedded application platform
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 18
Oracle Java ME Embedded Device Profile Targeting wireless modules and horizontal M2M
Aspect Description
System Architecture ARM architecture SOCs incl. ARM9, ARM11, Cortex-M, -R, and –A
Device Type Resource-constrained, headless, always-on
Operating System Simple embedded kernel or more capable OS/RTOS
Network IP-based wired (Ethernet) or wireless (cellular or other) Including multiple access points
Peripheral I/O Versatile access to peripheral I/O Serial, file, GPS, I2C, SPI, GPIO, ADC/DAC, AT Cmds, Pulse C., mem.-map
Footprint Minimum configuration (customized)
approx. 130 KB RAM/350 KB ROM Full, standard configuration
approx. 700 KB RAM/2000 KB ROM
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 19
General Machine-to-Machine (M2M) and IoT systems
Smart Meters/Smart Sensors
Medical: eHealth & TeleHealth
Wireless Modules
Industrial Control
Example Use Cases Enabling products and services across different market segments
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 20
l Evaluation Board: KEIL MCBSTM32F200 l ARM Cortex-M3 STM32F20X SOC l 120 MHz, 2 MB RAM, 8 MB Flash l Available through distibutors worldwide
l Peripherals supported l Headless (no graphics) l Network (Ethernet TCP/IP), SD card (file) l Serial/UART, ADC, DAC, Pulse Counter l Devices attached via I2C, SPI, GPIO, memory-mapped I/O
ARM KEIL Microcontroller Eval. Platform Easy evaluation and prototyping for microcontroller-class systems
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 21
l Raspberry Pi (Model B) l Broadcom BCM2835 (ARM1176JZF) SOC l 700 MHz, 512 MB RAM, Linux (Debian) l ~1 million devices sold, US $35
l Peripherals supported l Headless (no graphics) l Network (Ethernet TCP/IP), SD card (file) l Serial/UART l Devices attached via I2C, SPI, and GPIO
l Brings Java ME Embedded features to Raspberry Pi (compared to Java SE-E)
Raspberry Pi Popular, cheap board for development and educational use
GPIO, UART, I2C, SPI
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 22
Cinterion Wireless Modules
§ Smart & programmable § Complete and highly integrated § CPU, RAM/Flash, I/O, SIM § 2G/3G (voice + data), low power § Remote provisioning and management
§ Add intelligence and connectivity to vertical solutions § Industrial automation § Healthcare § Security & monitoring
Built on Oracle Java ME Embedded
Philips Respironics One
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 23
Device Access API
Java VM
Application Layer
Application Environment
CLDC
Example 1 Real-Time Clock Peripheral
Implementation (High Level Driver)
Example 2 Simple GPIO Pin-
based sensor reader (low level application)
On-Device I/O Peripheral Access
Device Access API
• Generic API to access peripheral I/O in a platform-neutral manner
• ‘Late binding’ allows addition of new peripheral types without changing API
• Enables development of Java-based ‘device drivers’ (non-real time)
• No native application code • Also planned for
availability on Java SE
Access Peripheral I/O Hardware directly from Java applications
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 24
Demo: Lego Plane
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 25
GPIO Demo
GPIOPinConfig forward = new GPIOPinConfig(! 7, //Port Number! 3, //Pin number! GPIOPinConfig.DIR_OUTPUT_ONLY, //direction! PeripheralConfig.DEFAULT, //mode! GPIOPinConfig.TRIGGER_NONE, //trigger!! false); //initial value!! !GPIOPin forwardPin = ! (GPIOPin) PeripheralManager.open(forward);!!forwardPin.setValue(true);!
Lego Airplane
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 26
Demo: Smart Sensor
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 27
Client-Server Connection
Java SE Java ME Embedded
ServerSocket 4427
ClientSocket
192.168.0.79
SDA SCL
Color Sensor LED
I2C GPIO
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 28
Java SE Java ME Embedded
ServerSocket 4427
ClientSocket
192.168.0.79
SDA SCL
Color Sensor LED
I2C
Server Code
serverSocket = new ServerSocket(4427);! while (true) {! clientSocket = serverSocket.accept();! input = new BufferedReader(! new InputStreamReader(! clientSocket.getInputStream()));! while ((inputLine = input.readLine()) != null){! System.out.println("read:" + inputLine);! }! ... ! input.close(); ! clientSocket.close(); !
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 29
Java SE Java ME Embedded
ServerSocket 4427
ClientSocket
192.168.0.79
SDA SCL
Color Sensor LED
I2C
ServerSocket 4427
ClientSocket
192.168.0.79
SDA SCL
Java SE Java ME Embedded
Initializing the Color Sensor
! private I2CDevice device;! private byte[] tx = new byte[2]! private byte[] rx = new byte[2];! … ! public void connect(){! device=(I2CDevice)PeripheralManager.open(! new I2CDeviceConfig(1,57,7,100000);! tx[0] = (byte)0x80;! tx[1] = (byte)0x03;! device.write(tx, 0, 2);! }! …! device.close();! !
GPIO
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 30
ServerSocket 4427
ClientSocket
192.168.0.79
SDA SCL
Java SE Java ME Embedded
Color Sensor LED
I2C
Reading the Color Values
Java SE Java ME Embedded
ServerSocket 4427
ClientSocket
192.168.0.79
SDA SCL
Color Sensor LED
I2C
! public synchronized int getValue() throws IOException, ! PeripheralNotAvailableException {! return getW() + getR() + getG() + getB();! }! ! public synchronized int getW() throws IOException, ! PeripheralNotAvailableException {! tx[0] = (byte)(REG_W | 0x80);! device.write(tx, 0, 1);! device.read(rx, 0, 1);! tx[0]++;! device.write(tx, 0, 1);! device.read(rx, 1, 1);! return (0xFF & rx[0]) + (0xFF & rx[1]) * 256;! }!
GPIO
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 31
ServerSocket 4427
ClientSocket
192.168.0.79
SDA SCL
Java SE Java ME Embedded
Color Sensor LED
I2C
Sending Sensor Data to the Server
Java SE Java ME Embedded
ServerSocket 4427
ClientSocket
192.168.0.79
SDA SCL
Color Sensor LED
I2C
! lightSensor.connect()); ! socketConnection = (SocketConnection) Connector.open(! “socket://192.168.0.79:4427”);! output = new OutputStreamWriter(! socketConnection.openOutputStream());! led = (GPIOPin)PeripheralManager.open(LED_PIN_ID); ! led.setValue(true);! ! msg = id+":”+System.currentTimeMillis()+":”+ ! lightSensor.getW()+":”+lightSensor.getR()+":”+ ! lightSensor.getG()+":”+lightSensor.getB()+'\n';! outputStream.write(msg);! outputStream.flush();! led.setValue(false); ! …! led.close();! lightSensor.disconnect();!
Runnable
GPIO
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 32
Java ME 8: The Next Generation
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 33
Java ME 8: Themes and Key Features The Next Generation: Feature-Rich, Flexible, Aligned with Java SE
• ME / SE language and VM alignment • New and enhanced embedded functionality and APIs • Improved flexibility and configurability
Themes
Key Features
• Updated VM + alignment with Java SE 8 (Java ME CLDC 8) • Updated application platform (Java ME Embedded Profile 8) • Updated device access (Peripheral I/O API) • Updated Security And Trust Services API (SATSA rev 2) • Improved flexibility (footprint, features, security) • Additional, dedicated APIs and features for small embedded
Target Markets
• Small embedded, across a wide range of use cases and markets • Intelligent edge devices, communication modules, healthcare
devices, smart sensors, smart meters, general IoT and M2M
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 34
Next: The Java ME 8 Platform
Java VM
Additonal APIs (Examples)
Application Platform
Java ME CLDC 8 (JSR 360, aligned with Java SE 8)
Java ME Embedded Profile (ME EP 8, JSR 361)
Additional Optional APIs
On-Device I/O Peripheral Access
Peripheral I/O API
Vertical Specific APIs Location
Messaging Wireless Communication
Web Services
Protocols and Data Conversion
Sensors
SATSA rev2
Security and Trust Services
Additional Optional JSRs
Security and Management
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 35
Wrapping Up
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 36
Roadmap Embedded Java
2016 2012 2013 2014
Java Embedded Suite 7 • SE Embedded 7 • GlassFish for Embedded • Java DB
Java SE Embedded 8 • Complete JVM convergence • Additional compact profiles • JavaFX for Embedded
Java Embedded Suite 8 • Extensible framework to allow simple integration of new services
NetBeans IDE 8 • Java ME/SE 8 Embedded support
Java ME Embedded 3.2 • Microcontroller support • Device Access APIs
Java ME SDK 3.2 • Embedded emulator • Eclipse integration
Java Embedded 9 • JDK9 • Modularity based on Jigsaw • Additional Embedded device APIs • Ease of Development
Java ME Embedded 3.3 • Enhanced device access • Footprint optimization & configuration tools • Raspberry Pi, Keil F200, QSC 6270, Windows Java ME SDK 3.3 • Improved developer tooling & experience for ME-Embedded Oracle Event Processing for Java Embedded 11.1.1.7.1 • Real-time data capture and analysis for embedded devices
Java ME Embedded 8 • Java ME 8 • Standardized Embedded API • New on-device debugging architecture Java ME SDK 8 • Improved developer tooling & experience
NetBeans IDE 9 • Java ME/SE 9 Embedded support • Jigsaw support
NetBeans IDE 7.3 • Improved ME Emb. support • New hints and refactoring • HTML 5, Scene Builder
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 37
Resources Java Magazine Jan/Feb: “Embedded Everywhere”
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 38
More Resources
§ Oracle OTN Embedded Java http://www.oracle.com/technetwork/java/embedded
§ Oracle Java ME Embedded Product Page -> overview/javame
§ Java Embedded Community http://www.javaembeddedcommunity.com
§ Terrence Barr’s blog http://terrencebarr.wordpress.com
Where to Find More
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 39
Questions?
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 40
Safe Harbor Statement
The preceding is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, and timing of any features or functionality described for Oracle’s products remains at the sole discretion of Oracle.
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 41
Java in the Internet of Things: Small, Smart, Connected
Terrence Barr Senior Technologist, Principal Product Manager Oracle @terrencebarr