420 likes | 700 Views
Java ME Embedded: Theory and Practice. Olga Mikhaltcova Alexander Mironenko Development department of the Java ME Embedded platform. Safe Harbor Statement.
E N D
Java ME Embedded: Theory and Practice Olga Mikhaltcova Alexander Mironenko Development department of the Java ME Embedded platform
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.
Agenda • The 3rd IT Revolution • Java: The Platform for Embedded Solutions • Oracle Java ME Embedded • Demo: Industrial Control System Prototype • Demonstration • Summary
The 3rd IT Revolution Explosion of Devices and Data Data Volume “Things” will create majority of Internet traffic “Age of Mainframes” 1950-1970 “Internet of People” 1980-2010 “Internet of Things” 2015-… “Things” will outnumber PCs and Mobile Phones combined Time Mainframes Workstations/PCs Smart ConnectedDevices Mobile Phones People-to-device ratio N:1 1:M 1:1
Everything Connected Wireless Health Connected Consumer Devices Point of Sale Kiosks Energy & Smart grid Industrial & Commercial Equipment Automative & Commercial Transportation
Machine-to-Machine (M2M) … • Connect with “Out of Reach” data and processes • Dramatically increase efficiency • Enable new fields of business and new business models
Microcontroller S/W Development must adapt Complexity of development, integration, and maintainance Programming Language CPU C/C++ Proprietary API RTOS
Java lets You focus on the Customer Solution Stop reinventing and reintegrating the plumbing Java provides a common platform
Java Offers More: It is A Game Changer Software flexibility drives business advantages Without Java With Java • Extend lifetime, flexibility, and value of your solutions • Create cross-platform, modular software applications • In-field s/w upgrades while maintaining system integrity • Reduce device certification and testing overhead • Limited flexibility, high cost • H/w-s/w interdependencies • Upgrade complexity • Impact on security/integrity Service-Enabled System Traditional Platform Loadable Applications and Services Component Cloud (Network/Enterprise) Native Application Java Platform OS + Core Services OS + Core Services Hardware Platform Hardware Platform
The Breadth of Java Embedded Smart Energy & mHealth Multi-function Embedded Devices Sensors & Micro controllers Personal Devices Industrial controls & Network Appliances Smart Appliances & Consumer Electronics Connected Vehicles Communications
Oracle Java ME Embedded Unique and dedicated features for embedded
Oracle Java ME Embedded Stack (simplified) Tools Logging APIs XML Messaging Runtime Environment OEM APIs Access Point APIs Security & Trust Location Java ME SDK Test, Emulate AMS APIs Device Access APIs Web Services PIM and File IMP – NG CLDC-HI Virtual Machine On-Device Debugging NetBeans IDE Develop, Debug, Profile Device Port Porting Layer Embedded Hardware and RTOS
Oracle Java ME Embedded 3.3 Stack A rich embedded application platform
Device Access API Access Peripheral I/O Hardware directly from Java applications • 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 IMlet Application Layer Device Access API On-Device I/O Peripheral Access Application Environment Java VM CLDC
Goals of the Demo This system prototype for what? example ofAPI usage additional level of comprehensive testing Solar Panel System Demo proof of usability API checking and correction
Goals of the Demo What were the requirements? • Complete system prototype • Operability on the several interchangeable embedded devices including the emulator Java ME SDK • DA API mandatory usage • Simple integration with remote services • Connectivity demonstration • Other functionality including inherited from the Java ME
Prototype’s Concept The “birth” of the idea The prototype of the solar panel positioning system based on the Java ME Embedded platform
Prototype’s Concept Details • System repositioning by means of servo motors • Brightness measurement by a sensor • Automatic and manual positioning • Status indication using LEDs • Local control in the presence of suitable peripherals • Remote management, monitoring and logging • Sending statistics to the server
Prototype’s Concept Working process
Design: hardware architecture General scheme Statistics Server Light source Small Embedded Device Light sensor Java ME Embedded Application Network I2C Can be run on the same machine Remote Management Client Servo motors Servo controller UART / RS232
Design: hardware architecture Supported platforms
Design: hardware architecture Statistics Server Platform: Java ME SDK Emulator Java ME SDK Emulator USB-Serial converter Network Can be run on the same machine Remote Management Client Servo motors USB Servo controller UART / RS232
Design: hardware architecture Platform: Raspberry Pi Statistics Server Light source Raspberry Piboard Light sensor Network I2C Can be run on the same machine Remote Management Client Servo motors RS232-Serial converter UART Servo controller UART / RS232
Design: hardware architecture Platform: Keil MCBSTM32F200 Statistics Server Light source KEIL board Light sensor Network I2C Can be run on the same machine Remote Management Client Servo motors LEDs Joystick Servo controller UART / RS232 Buttons
Design: software architecture General scheme Small Embedded Device Remote PC Management and monitoring System Control IMlet ----------------------------------------------- Java ME-E (IMP-NG) application RemoteManagement Client ---------------------------------------- Java FX application Logging Statistics GlassFish Server Statistics Servlet --------------------------------------- Java EE application
Design: software architecture • Remote Management Client NetBeans IDE + Scene Builder +Java FX • connection using IP-address via proprietary protocol based on TCP • continuous polling in order to obtain current status of the hardware • remote system management: program start/stop, servo motor angles change, virtual joystick • log viewer • statistics from the GlassFish server
Design: software architecture Remote Management Client NetBeans IDE + GlassFish Server + Oracle DB • accepts incoming HTTP-connection from the system control IMlet, processes POST-request, stores data in the database • accepts incoming HTTP-connection from the remote management client application, processes GET-request, generates HTML-page, sends it back • statistics can be viewed either in browser or by using JavaFX application • Statistics Servlet HTTP / GET Statistics Servlet System Control IMlet HTTP / POST Embedded Device
Design: software architecture System Control IMlet GPIO System Control IMlet LEDs Remote Management Client SPSMP Server LEDs Driver Servo Driver Servo Controller TCP UART Logging Handler Program 1 Main Controller TCP Servo Motor 1 Statistics Servlet Statistics Module HTTP Servo Motor 2 Program N Light Sensor Driver Joystick Driver Buttons Driver GPIO I2C I2C Light Sensor Buttons Joystick
Implementation features Code example: I2C light sensor connection /* open & configure */ I2CDeviceConfig cfg = new I2CDeviceConfig(CFG_BUS, CFG_ADDRESS, PeripheralConfig.DEFAULT, PeripheralConfig.DEFAULT); slave = (I2CDevice) PeripheralManager.open(I2CDevice.class, cfg); .. /* read color component */ slave.begin(); slave.write(tx[0]); rx[0] = (byte)slave.read(); .. slave.end(); .. /* close */ slave.close();
Implementation features “Write once run anywhere”? • One programming language – Java • Common tooling for developing, debugging and deploying applications • UnifiedAPI Must be taken into consideration: • Different set and connectivity of peripherals • Different addressing/configuration of peripherals
Implementation features Task №1 Different set and connectivity of peripherals How to deal with it? • Connect external peripherals • Write flexible implementation processing such situations Java ME Embedded (and in particularDA API) provides these opportunities!
Implementation features Task №2 Different addressing/configuration of peripherals How to deal with it? • The integrator must provide unified configuration for the specific use • Possibility to change the default platform configuration • The configuration of the application itself, for example: • viaJAD-file • proprietary configuration file • a configuration request from a remote server
Implementation features Java ME SDK Emulator • The opportunity to start developing without a real hardware • Parallelizing of the development cycles • The overall development cycle reducing • Convenient debugging
Implementation features Automatic programs • Test • Endless test • Searching the position of maximum illumination • Light source tracking
Summary Demonstrated functionality of the product • CLDC, IMP-NG: • Multithreading and timers • Networking: HTTP andTCP • Record Management System (RMS) • DA API: • GPIO • UART • I2C • Logging API • IMletAutostart
Summary • Java is a trusted, robust platform ideally-suited to embedded systems • Oracle Java ME Embedded product lets systems designers create customized, reliable, and integrated embedded solutions for resource-constrained devices • Java’s large ecosystem of developers, partners, support, and training supports on-time delivery of projects and products
Summary “Write once run anywhere”! Statistics Server Light source Java ME SDK Light sensor Network I2C Can be run on the same machine Keil Raspberry Pi Remote Management Client Servo motors Servo controller UART / RS232
Useful links Oracle Java ME Embedded 3.3 for Raspberry Pi (Early Access) Downloads http://www.oracle.com/technetwork/java/embedded/downloads/javame/java-me-e-raspberry-pi-1913843.html Oracle Java ME Embedded 3.3 for Keil Downloads http://www.oracle.com/technetwork/java/embedded/downloads/javame/index.html Java ME SDK 3.3 (Early Access) and Java ME SDK 3.3 Plugin for NetBeanshttp://www-content.oracle.com/technetwork/java/javame/javamobile/download/sdk/java-sdk-early-access-1912715.html JDK and NetBeans IDE http://www.oracle.com/technetwork/java/javase/downloads/jdk-7-netbeans-download-432126.html JavaFX and Scene Builder http://www.oracle.com/technetwork/java/javafx/downloads/index.html GlassFish Server http://glassfish.java.net/downloads/3.1.2.2-final.html