1 Mobile Software Development Framework 4/14/2009 Richard Yang.

Slides:



Advertisements
Similar presentations
How to use TinyOS Jason Hill Rob Szewczyk Alec Woo David Culler An event based execution environment for Networked Sensors.
Advertisements

A System Architecture for Tiny Networked Devices
MIDP Mobile Information Device Profile Johnny Yau CIS 642 Prof. Insup Lee.
1 Mobile Software Development Framework: TinyOS, J2ME 10/2/2012 Y. Richard Yang.
Pengantar Teknologi Mobile 12
Introduction of J2ME Mobile solutions. Overview What is J2ME. How does J2ME work? Java J2ME Carriers and Products. The Two Configuration of J2ME. Profiles.
Multimedia Network Communications Subject:T0934 / Multimedia Programming Foundation Session:13 Tahun:2009 Versi:1/0.
J2ME 25 July Overview  What is J2ME?  The CLDC and CDC configurations  MIDP and MIDlets  Development Tools  Demonstrations.
Writing Your First MIDlet Running JAVA on a Cell Phone Jon A. Batcheller January 27, 2004.
UNDERSTANDING JAVA APIS FOR MOBILE DEVICES v0.01.
Introduction to Java 2 Micro Edition Mark Balbes, Ph.D. Senior Software Engineer Jeff Brown Senior Software Engineer.
Programming Handheld and Mobile devices 1 Programming of Handheld and Mobile Devices Lecture 10 Java for MIDs Rob Pooley
Developing an Application with J2ME Technology Scott Palmer, Nat Panchee, Judy Sullivan, Karen Thabet, Sten Westgard.
Jason Hill, Robert Szewczyk, Alec Woo Spring 2000 TinyOS Operating System for Networked Sensors Networked SensorsSystem Structure Composing Components.
J2ME Prepared by: - Gaery- Ronny - Alan- Andy. Why Technology for Mobile Devices? The nature of wireless devices is changing Old devices: All the software.
A System Architecture for Tiny Networked Devices Jason Hill U.C. Berkeley 9/22/2000.
1 TinyOS Mohammad Rahimi CSCI599-Spring Motivation  The new class of distributed tiny devices  The new generation of software.
PDA Programming Using J2ME Presenter :涂俊凱 Date : 2003/4/8.
Making Cell Phone Games An Overview Ray Ratelis Guild Software, Inc.
Developing J2ME Applications Mobile and Wireless Networks.
Cosc 4730 Phone Programming in Java An Introduction.
Java 2 Micro Edition Mano Chen Senior Technical Consultant
Java Platform, Micro Edition (J2ME)
Java 2 Platform, Micro Edition (J2ME) By Xiaorong Wang.
Topics on KVM Presented By Xiaozhou David Zhu. Topics covered Introduction Java2 Platform Micro Edition CLDC KVM.
Android Introduction Platform Overview.
J2ME Java for Mobile Environments Based on J2ME In A Nutshell, by Kim Topley, O’Reilly & Associates Inc., 2002, and Tetris by Alexei Patinov.
An Introduction to the Java ME Project Jens A Andersson.
Platforms and tools for Web Services and Mobile Applications J2ME based Applications Bent Thomsen Aalborg University 3rd and 4th of June 2004.
Getting Started with JXTA for J2ME Advisor : Dr. Ching-Long Yeh Report : DI.2, 洪泰昌 ( ) Course: XML 文件管理.
A System Architecture for Networked Sensors Jason Hill, Robert Szewczyk, Alec Woo, Seth Hollar, David Culler, Kris Pister
@2011 Mihail L. Sichitiu1 Android Introduction Platform Overview.
Michael Brockway Advanced Applications Development in Java J2ME -- Introduction l Introduction / Overview l Java 2 Micro Edition n CLDC n MIDP l Examples.
Programming Handheld and Mobile devices 1 Programming of Handheld and Mobile Devices Lecture 11 J2ME and MIDlets Rob Pooley
1 OFDM, Mobile Software Development Framework 9/27/2012 Y. Richard Yang.
Framework and application bytecode size CLDC MIDP kXML parser Utility classes Graphics Logic (MIDlet) Application Data (XML file)
ANDROID Presented By Mastan Vali.SK. © artesis 2008 | 2 1. Introduction 2. Platform 3. Software development 4. Advantages Main topics.
Computer Science Wi-Fi App using J2ME and MVC Architecture Advisor : Dr. Chung-E Wang Department of Computer Science Sacramento State University Date:
J2ME Presented by May Sayed & Menna Hawash. Outline Introduction “Java Technology” Introduction “What is J2ME?” J2ME Architecture J2ME Core Concepts 
Java 2 Micro Edition (J2ME) and the world of java
1Basics of J2ME. 2 Objectives –Understand the different java API’s and how the mobile edition API’s fit in –Understand what a mobile configuration and.
Overview of: System Architecture Directions for Networked Sensors John Kerwin CSE 291 Sensor Networks Paper by: Jason Hill, Robert Szewczyk, Alec Woo,
Dhanshree Nimje Smita Khartad
System Architecture Directions for Networked Sensors Jason Hill, Robert Szewczyk, Alec Woo, Seth Hollar, David Culler, Kris Pister Presented by Yang Zhao.
Simulation of Distributed Application and Protocols using TOSSIM Valliappan Annamalai.
System Architecture Directions for Networked Sensors Jason Hill, Robert Szewczyk, Alec Woo, Seth Hollar, David Culler, Kris Pister Presenter: James.
Java 2 Micro Edition The Connected, Limited Device Configuration.
TinyOS Sandeep Gupta. Operating System (OS) What is an OS? Main functions  Process management  Memory management  Resource management Traditional OSs.
1 Introduction to J2ME Outline MIDP Building J2ME Apps- Tool J2ME Wireless Toolkit Demo MIDlet Programming -- MIDlet Transition States -- Midlet Skeleton.
Enhanced mobile services in Java enabled phones Björn Hjelt Sonera zed ltd Supervisor: Professor Jorma Jormakka.
Why does it need? [USN] ( 주 ) 한백전자 Background Wireless Sensor Network (WSN)  Relationship between Sensor and WSN Individual sensors are very limited.
Software Architecture of Sensors. Hardware - Sensor Nodes Sensing: sensor --a transducer that converts a physical, chemical, or biological parameter into.
Advance Computer Programming Market for Java ME The Java ME Platform – Java 2 Micro Edition (J2ME) combines a resource- constrained JVM and a set of Java.
1 Mobile Systems Richard Yang. 2 Admin. r Homework 4 m due Friday Dec. 8th.
1 Mobile Application Development Framework 4/16/2009 Richard Yang.
The Java Platform Micro Edition Java ME
CS434/534: Topics in Networked (Networking) Systems WSN/Mobile Systems Yang (Richard) Yang Computer Science Department Yale University 208A Watson
Voice Controlled Robot by Cell Phone with Android App
Java N Amanquah.
Simulation of Distributed Application and Protocols using TOSSIM
Programming of Handheld and Mobile Devices
Mobile Systems Richard Yang.
Chapter 2: System Structures
MOBILE DEVICE OPERATING SYSTEM
Wireless Instant Messaging Using J2ME
Mobile Software Development Framework: TinyOS, J2ME
Mobile Software Development Framework
By Jeff Heaton An Overview of J2ME By Jeff Heaton
Java for Mobile Devices
Presentation transcript:

1 Mobile Software Development Framework 4/14/2009 Richard Yang

2 Admin. r Homework 4

3 Recap r What are the major considerations in developing a software environment and application framework for mobile wireless applications? m Handle heterogeneous devices/configurations m Efficient (memory, battery, …) m Easy programming for event-driven programming m …

Overview r Software framework for mobile applications is a quite large topic, we will see three representative examples m TinyOS m J2ME m Android 4

5 TinyOS

6 Hardware r Assembled from off-the-shelf components r 4Mhz, 8bit MCU (ATMEL) m 512 bytes RAM, 8KB ROM r Devices m serial Port m temperature sensor & light sensor m 900Mhz Radio (RF monolithics) ft. range m LED outputs 1.5” x 1.5”

7 Schematic Diagram of a Mote

8 Sample Application: Environment Monitoring r Environment monitoring, e.g., m measure temperature, lighting values/events m periodically transmit measurements/events to a base station m forward data for other nodes that are out of range of the base station r …

9 Requirements on Software Dev. Framework r Small foot print m devices have limited memory and power resources r Support one application at a time but flexible reprogramming r Flexible configuration of attached devices

TinyOS Application Dev. Framework r Basic principle: Generate customized OS + application for each given scenario r We say each generated scenario generates a tinyOS 10

11 Schematic Diagram

12 TinyOS: Software Components r A tinyOS consists of one or more components linked together m software components motivated by hardware component r Each component specifies that m it provides some interfaces allows other components to control it m also uses some interfaces control other components

13 Interface r An interface m declares a set of functions called commands that provider must implement and m another set of functions called events that the interface user must implement A uses interfaces I1 and I2 B provides I1 C provides I2 commands events commands events I1 I2 C provides I3

14 Interface: Examples StdControl.nc interface StdControl { command result_t init(); command result_t start(); command result_t stop(); } Timer.nc interface Timer { command result_t start( char type, uint32_t interval); command result_t stop(); event result_t fired(); } ADC.nc interface ADC { async command result_t getdata(); async command result_t getContinuousData(); event result_t dataReady(uint 16_t data); }

15 TinyOS Component: Implementation r Component contains: m commands and event handlers can invoke lower level commands, but cannot block event handler can signal higher level signals while command cannot m frame (storage) statically allocated, fixed sized to know memory requirement and avoid overhead of dynamic allocation Component Internal State Internal Tasks CommandsEvents

16 Linking Components Two types of components: m modules: individual components m configurations : assemble components together, connecting interfaces (objects) used by components to interfaces (objects) provided by others

17 Example Application r A simple TinyOS application which periodically reads in the light intensity value, computes a moving average, displays it on the LED See SenseTaskM.nc SenseTask.nc

18 TinyOS Execution Model r Concurrency model: only two threads m long running tasks that can be interrupted by hardware event handlers r Tasks perform the primary computation work m commands and event handlers post tasks m call lower level commands m signal higher level events m schedule other tasks within a component r Each task is atomic with respect to other tasks m run to completion, but can be preempted by events m the task scheduler is a simple FIFO scheduler

19 Running tinyOS Program r make mica r ncc -o main.exe -target=mica SenseTask.nc r avr-objcopy --output-target=srec main.exe main.srec r Use uisp to install

20 A More Complete Sample Application r Sensor network monitoring m monitor temperature and light conditions m periodically transmit measurements to a base station m sensors can forward data for other sensors that are out of range of the base station m dynamically determine the correct routing topology for the network

21 Internal Component Graph RFM Radio byte Radio Packet UART UART Packet I2C Temp Light Active Messages Clocks bit byte packet Ad hoc Routing Application application HW SW

22 Message Send Transition r Total propagation delay up the 5 layer radio communication stack is about 80 instructions Timing diagram of event propagation

23 Evaluation: Storage Component NameCode Size (bytes) Data Size (bytes) Routing AM_dispatch AM_temperature AM_light AM RADIO_packet RADIO_byte RFM Light Temp UART UART_packet I2C Processor_init TinyOS scheduler C runtime Total  Scheduler only occupies 178 bytes  Complete application only requires 3 KB of instruction memory and 226 bytes of data (less than 50% of the 512 bytes available)  Only processor_init, TinyOS scheduler, and C runtime are required

24 Evaluation: Timing OperationsCost (cycles) Time (µs) Normalized to byte copy Byte copy821 Post an Event Call a Command Post a task to scheduler Context switch overhead Interrupt (hardware cost) Interrupt (software cost)

Discussion r What would we need to extend to tinyOS if we were to use it for writing mobile applications for mobile phones and PDAs? 25

26 Java2 Micro Edition (J2ME)

27 Java Platforms r Java2 is divided into three platforms m J2EE (Java2 Enterprise Edition) business applications m J2SE (Java2 Standard Edition) general applications m J2ME (Java2 Micro Edition) small devices such as mobile phone, PDA, car navigation

28 J2ME r Based on Java r Uses “versioning” to avoid using lowest common denominator r Uses java virtual machines to mask device heterogeneity

29 J2ME Versioning r To accommodate heterogeneous mobile devices, define configurations and profiles -A configuration provides fundamental services for a broad category of devices (e.g., lang, io, util) - A profile supports higher-level services common to a more specific class of devices or market (e.g., life cycle, GUI) -An optional package adds specialized services that are useful on devices of many kinds, but not necessary on all of them

30 J2ME K mem bit proc Upto 2M mem 32 bit proc

31 Two Available J2ME Configurations r Connected Limited Device Configuration (CLDC) m 160 KB to 512 KB of total memory available m 16-bit or 32-bit processor m low power consumption and often operating with battery power m connectivity with limited bandwidth m many Java features deleted, e.g., floating point, finalize m examples: cell phones, certain PDAs r Connected Device Configuration (CDC) m 2 MB or more memory for Java platform m 32-bit processor m high bandwidth network connection, most often using TCP/IP m examples: set-top boxes, certain PDAs

32 Available J2ME Profiles r Mobile Information Device Profile (MIDP) m delivers an enhanced user interface, multimedia and game functionality, end-to-end security, and greater networked connectivity to mobile phones and entry level PDAs r Foundation Profile m set of Java APIs that support resource-constrained devices without a standards-based GUI system r Personal Profile m Together with CDC and Foundation Profile, Personal Profile provides a complete application environment for the high-end PDA market. Personal Profile contains the full set of AWT APIs, including support for applets and Xlets r Personal Basis Profile m provides a J2ME application environment for network-connected devices supporting a basic level of graphical presentation

33 Mobile Phone Framework

34 Typical J2ME Technology Stack Mobile Information Device Profile KVM CLDC = KVM + J2ME Core APIs in this example DSP chip (e.g., ARM) J2ME core APIs Your MIDlet Yellow Pages, train schedules and ticketing, games… UI, HTTP networking... Threads, no Floats… 32-bit RISC, 256K ROM, 256K Flash, 64K RAM

35 CLDC Available Packages r java.lang r java.util r java.io r javax.microedition.io

36 CLDC Classes r Boolean r Byte r Character r Class r Integer r Long r Math r Object r Runnable r Runtime r Short r String r StringBuffer r System r Thread r Throwable r Calendar r Date r Enumeration r Hashtable r Random r Stack r TimeZone r Vector r ByteArrayOutputStream r ByteArrayInputStream r DataOuput r DataInput r DataInputStream r DataOutputStream r InputStream r InputStreamReader r OutputStream r OutputStreamWriter r PrintStream r Reader r Writer java.lang java.util java.io

37 Networking Connection r Based on a framework called the Generic Connection Framework (GCF) r GCF consists of m an interface hierarchy that is extensible m a connection factory, and m uses Standard Uniform Resource Locators (URLs) to indicate the connection types to create e.g. socket:// file:///myResourceFile.res datagram:// sms://

38 MIDP Hardware r Memory (added to CLDC memory) m 128 KB non-volatile for MIDP components m 8 KB non-volatile for application persistent data m 32 KB volatile for KVM r Display m screen 96x54 m display depth 1-bit m pixel shape (aspect ratio) 1:1

39 MIDP Hardware r Input (one or more) m one-handed keyboard (ITU-T phone keypad) m two-handed keyboard (QWERTY keyboard) m or touch screen r Networking m two-way m wireless m possibly intermittent m limited bandwidth

40 MIDP Packages r java.io r java.lang r java.util r javax.microedition.io r javax.microedition.lcdui r javax.microedition.rms r javax.microedition.midlet r javax.microedition.lcdui.game r javax.microedition.media r javax.microedition.media.control r javax.microedition.pki addition in version 2.0 version 1.0

41 MIDP Application Model r An MIDP application is called a MIDlet m similar to the J2SE applet m GUI based r MIDlet suites – for applications that share resources or data

42 MIDP: Application Lifecycle r MIDlets move from state to state in the lifecycle, as indicated m start – acquire resources and start executing m pause – release resources and become quiescent (wait) m destroy – release all resources, destroy threads, and end all activity PauseActiveDestroyed startApp destroyApp pauseApp destroyApp

43 HelloWorldMIDlet.java import javax.microedition.midlet.*; import javax.microedition.lcdui.*; public class HelloWorldMIDlet extends MIDlet implements CommandListener { private Command exitCommand; private Display display; private TextBox t; public HelloWorldMIDlet() { display = Display.getDisplay(this); exitCommand = new Command("Exit", Command.EXIT, 2); t = new TextBox(“CS434", "Hello World!", 256, 0); t.addCommand(exitCommand); t.setCommandListener(this); } public void startApp() { display.setCurrent(t); } public void pauseApp() { } public void destroyApp(boolean unconditional) { } public void commandAction(Command c, Displayable s) { if (c == exitCommand) { destroyApp(false); notifyDestroyed(); }

44 Developing J2ME Applications r Identify the devices r Identify the profiles supported by devices m using the MID profile, the application will target cell phones and pagers r Develop application m install jdk, a package supporting the wireless target (e.g., Sun Wireless Toolkit for CLDC) m debug using a simulator m for deployment, preverify by pre-generating “stack map”

45 Stack map attribute increases the size of a classfile by appro. 5% but substantiall y reduces device mem and CPU usage Deploying: Two-Phase Class File Verification Process

46 Deploying r Generate deployment files: two files Java Application Description file (.jad) Java archive file (.jar) r Upload.jad and.jar to the device or a server where the device can download the application

47 Over-The-Air Application Loading Process Web Page JAM Downloads App User Selects App Advertise App on Web Page Network Transfer Java Application Manager (Name, Version, Size, …) Jar File Descriptor File

48 Summary: J2ME r Scale down a popular programming environment to ease learning r Use virtual machines to mask (some) device heterogeneity r Use versioning to avoid using lowest common denominator

49 Windows.NET Compact Framework r Similar to J2ME r Scales down a popular programming environment to ease learning m the.NET CF is a subset of the full.NET framework with some additions m designed for resource constrained devices m 1,400 classes for.NET CF vs. 8,000 for full m 27 UI controls for.NET CF vs. 52 for full m 1.5 MB for.NET CF vs. 30 MB for full r Uses versioning to avoid using lowest common denominator m pocket PC m pocket PC phone version m smart phone version r Uses virtual machines to mask device heterogeneity m programming languages compile to MSIL MSIL is JIT compiled on the device MSIL code is smaller than native executables MSIL allows your code to be processor independent

Andriod 50

Andriod 51

Andriod Features r Linux kernel as foundation r Java based framework (J2SE not J2ME) r Dalvik Virtual machine 52

Application Framework: Key Concepts r Activity m Visible screen r Service m Background services r Content provider m Shared data r Broadcast receivers m Receive and react to broadcast events r Intent m Activating component 53