Download Programming of Handheld and Mobile Devices

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
Java 2 Micro Edition (J2ME) and the
world of java
• The Java 2 Platform, Micro Edition (J2ME)
provides a flexible environment for applications
running on consumer devices, such as mobile
phones, PDAs, and TV set-top boxes, as well as a
broad range of embedded devices.
• J2ME includes Java virtual machines and a set of
standard Java APIs
• It includes flexible user interfaces, a robust
security model, a broad range of built-in network
protocols, and extensive support for networked
and offline applications
1
The J2ME Architecture
• The J2ME architecture comprises a variety of
configurations, profiles, and optional packages
that implementers and developers can choose
from
2
J2ME Configurations and Profiles
•
•
•
•
Even within J2ME one size does not fit all
Configurations: Minimum libraries and JVM
Profiles: libraries for specific devices or markets
J2ME configurations
– CLDC
– CDC
• J2ME profiles
•
MIDP
– Foundation, Bluetooth, Personal, ...
• Configurations and profiles defined by the Java
Community ProcessSM
3
Configurations
• Configurations comprise
– a virtual machine
– a minimal set of class libraries.
• They provide the base functionality for a
particular range of devices that share similar
characteristics, such as network connectivity and
memory footprint.
• Currently, there are two J2ME configurations:
– the Connected Limited Device Configuration (CLDC)
•
Established and widely used
– the Connected Device Configuration (CDC)
•
Next generation configuration
4
Profiles
• To provide a complete runtime environment for a
specific device category a configuration must be
combined with a profile
• This is a set of higher-level APIs that further
define the application life-cycle model, the user
interface, and access to device-specific
properties.
• A profile supports a narrower category of devices
within the framework of a chosen configuration.
• A widely adopted example is to combine CLDC
with the Mobile Information Device Profile
(MIDP) to provide a complete Java application
environment for cell phones and other devices
with similar capabilities
5
Optional Packages
• The J2ME platform can be extended by adding
various optional packages to a technology stack that
includes either CLDC or CDC and an associated
profile.
• Optional packages offer standard APIs for using both
existing and emerging technologies such as database
connectivity, wireless messaging, multimedia,
Bluetooth, and web services.
• Because optional packages are modular, developers
can avoid carrying the overhead of unnecessary
functionality by including only the packages an
application actually needs.
6
7
Mobile Information Device Profile
• The first J2ME profile
• Targets devices implementing CLDC
• Profile addresses:
– Display toolkit, user input methods
– Persistent data storage
– Messaging( SMS, email, etc), security and
networking over wireless network connection
8
Related Technologies:
Java Card™ Technology
• Specifies minimized subset of Java
technology for GSM SIM cards,
smart cards, Java rings, and other
extremely constrained devices
•
Key benefits versus non-Java smart
cards
– Multiple applications per card
– Post-issuance updates to apps
on card
9
Related Technologies:
EmbeddedJava™ Technology
• EmbeddedJava. technology is a program from
Sun supporting development of dedicatedfunction embedded devices for a wide range of
end uses
• EmbeddedJava technology gives device
manufacturers the ability to:
– Configure the Java platform to leave out unneeded
classes and VM features
– Minimize resource requirements and cost for a
deeply-embedded device
– Optimize for devices with no GUI and intermittent
(at best) networking
– Keep APIs for their devices private
10
J2ME™: Connected Device
Configuration
• Connected Device Configuration (CDC)
– Targeted for devices that have 2 MB or more total
available memory
– Memory dedicated to J2ME environment
– More than 2MB ROM/Flash
– More than 512 KB RAM
– Network connectivity
– Full Java 2 Virtual Machine specification
11
Example J2ME™ CDC Uses
•
•
•
•
•
Wireless communicators
High-end PDAs
TV set-top boxes
Gateways
Automotive entertainment and navigation
systems
• Telecomm/Networking Equipment
• Industrial Controllers
12
What Is CVM?
• Basis for J2ME CDC and profiles
– Large VMs for desktops/servers don.t scale well to
devices
– Static and dynamic memory footprint too big
– Not embeddable, ROMable, not portable
– Implicit assumption of virtual memory
– Native stack use, address range reservation
– Implicit assumption of process model
• Global variables, .system threads.
13
CVM features
•
•
•
•
•
Good JVM features
Device friendliness.
Easily re-targetable
Narrow porting interface
Almost entirely in C (except
dynamic compiler)
• ~256KB with JNI, reflection,
verification,.
• CVM supports all Java 2 Platform,
version 1.3,
• VM features and libraries for security,
weak references, JNI, RMI and JVMDI
• CVM allows devices to map Java
threads directly to native threads.
• Can run Java classes out of ROM
• Contains a precise memory system
with advanced Garbage Collection
features:
• Small average GC pause times
• Pluggable Garbage Collectors
• Full separation of VM from memory
system
14
J2ME Profiles
• Mobile Information Device Profile (MIDP)
– Profile for wireless devices implementing CLDC
• J2ME Foundation Profile
– Profile for non-GUI networked devices
implementing CDC
• J2ME Personal Basis, Personal, RMI Profiles
– Basic graphics, next generation PersonalJava
environment, and RMI support for CDC &
Foundation Profile based devices
15
CDC APIs
• 􀀀 Defines minimum set of APIs for Java VM
support
– java.lang VM system classes (Object, Thread, etc.)
– java.util.Underlying utilities
– java.net.UDP Datagram and File URL
– java.io.File
– java.text.I18n support for Java VM error messages
– java.security.Fine grain security and encryption
for object serialization
16
CVM Sizes Today
• CVM only
– Static ROM + RAM req.= 258 KB
• Natives only
– Static ROM + RAM req.= 124 KB
• Porting layer only
– Static ROM + RAM req.= 28 KB
• CVM+natives+porting_layer
– Static ROM + RAM req.= 410 KB
17
Foundation Profile APIs
• Defines core set of Java platform functionality
– No GUI
– Subset of JDK 1.3
• Completes full functionality from CDC
– java.lang.Rounds out full java.lang.*(Compiler,
UnknownError)
– java.util.Adds full zip support, Timer, etc.
– java.net.Adds TCP Socket and HTTP
– java.io.Rounds out full java.io.* (Readers and
Writers)
18
– java.text.Full I18n (Annotation, Collator, Iterators,
CVM Sizes with Foundation Profile APIs
• CDC Java libraries (ROMized)
– Static ROM + RAM req.= 1011 KB
• Foundation Java libraries (ROMized)
– Static ROM + RAM req.= 1564 KB
• CDC TOTAL (CVM+natives+porting+libraries)
– Static ROM + RAM req.= 1421 KB
• Java libraries + natives for Foundation Profile
– Static ROM + RAM req = 553 KB
• Foundation TOTAL (CVM+natives+porting+libraries)
– Static ROM + RAM req.= 1974 KB
19