tamz - wiki.cs.vsb.czwiki.cs.vsb.cz/images/4/46/tamz-l1.pdftamz. department of computer science...
TRANSCRIPT
Department of Computer ScienceVŠB-Technical University of Ostrava
1by Roman Szturc 2006 & Pavel Moravec 2008-2013
TAMZ
Department of Computer ScienceVŠB-Technical University of Ostrava
2by Roman Szturc 2006 & Pavel Moravec 2008-2013
Contact Information
Office: A-1007
Address: Dept. of Computer Science, FEECS17. listopadu 15708 33 Ostrava-Poruba
Phone: +420 59 732 4219
E-mail: [email protected]
Web: http://wiki.cs.vsb.cz/index.php/Moravec/cz
Department of Computer ScienceVŠB-Technical University of Ostrava
3by Roman Szturc 2006 & Pavel Moravec 2008-2013
Course Requirements
During the semester:Implementation (10 points)
programming of certain assignments in labs, one point for each completed assignmentPresentation (5 to 10 points)
presentation of pre-selected topic from subject area in labs, 10-15 minutes. Project (10 to 25 points)
implementation of chosen project in JavaME for a mobile device + its defense. Required to complete the course !
After the end of the semester:Final exam (20 to 55 points)
Department of Computer ScienceVŠB-Technical University of Ostrava
4by Roman Szturc 2006 & Pavel Moravec 2008-2013
References● Java Community Process
http://jcp.org/en/home/index/● Java 2 Platform, Micro Edition (JavaME)
http://java.sun.com/javame/● Sun Developer Network
http://developers.sun.com/techtopics/mobility/● Core J2ME Technology and MIDP
J. W. Muchow, 2002, ISBN 0130669113● Developing with J2ME, Second Edition
J. Knudsen, 2003, ISBN 1590590775● Wireless J2ME Platform Programming
V. Piroumian, 2002, ISBN 0130449148● …
Department of Computer ScienceVŠB-Technical University of Ostrava
5by Roman Szturc 2006 & Pavel Moravec 2008-2013
What is a Mobile Device?
A pocket-sized computing device, typically with:● a small visual display screen for user output● a miniature keyboard or touch screen for user input.
Examples:● Mobile & cordless phones, pagers● PDAs & smartphones● Navigation devices (e.g. PNA)● Cameras● Portable media players● Handheld game consoles (e.g. PSP)● Tablets, netbooks, UMPCs...
Department of Computer ScienceVŠB-Technical University of Ostrava
6by Roman Szturc 2006 & Pavel Moravec 2008-2013
Limitations of Mobile Devices
● Small lower-resolution display (sometimes even grayscale/BW)
● Limited input options (phone/software keyboard)● Lower operating memory & internal storage space
(the latter partly solved by external memory cards)● Limited CPU power + no or limited GPU● Limited instruction set (e.g. no floating point arithmetics,
no SSE, vector-processing instructions)● Network connectivity issues● Smaller library of system functions● Power considerations...
Department of Computer ScienceVŠB-Technical University of Ostrava
7by Roman Szturc 2006 & Pavel Moravec 2008-2013
Mobile Operating Systems
● Vendor-specific firmware (generic)● EPOC/Symbian OS (Nokia, SonyEricsson, ...)● Windows-based:
● Windows Mobile/CE, Windows embedded● WP7, Windows RT (8)
● PalmOS → WebOS● Linux-based:
● Android● Firefox OS, ● Maemo, MeeGo, Qt Extended (formerly Qtopia),
Openmoko, Tizen, Sailfish OS ● Debian (ARM), …
● iOS● Samsung BADA
Department of Computer ScienceVŠB-Technical University of Ostrava
8by Roman Szturc 2006 & Pavel Moravec 2008-2013
Mobile Frameworks
● JavaME – Java 2 Micro Edition● Flash Lite – commercial ● HTML5-based frameworks
– jQuery Mobile
– Sencha Touch
– PhoneGAP
● 3rd party frameworks (of varying quality) for – Java-based:
● Eve (formerly Ewe)● J2ME Polish
– HAXE, ...
Department of Computer ScienceVŠB-Technical University of Ostrava
9by Roman Szturc 2006 & Pavel Moravec 2008-2013
Programming languages
● Java (SE, ME, EE)● C/C++ - native libraries, e.g. Android NDK ● C# - Windows 8, WP7 (Silverlight, XNA)● Objective C – iOS● HTML + Javascript + CSS● Python● Exotic choices: LUA, Lazarus (Pascal), Shell
script, PHP, … ● …
Department of Computer ScienceVŠB-Technical University of Ostrava
10by Roman Szturc 2006 & Pavel Moravec 2008-2013
Mobile Platforms Comparison
Pocket PCWindows
MobileAndroid Symbian OS
GenericFirmware
PC
.NET CF 1.0: WM 2000+2.0: WM 2003+
Yes
Monodroidpreview-only
NO
SDK&
emulatorJava ME IBM J9,...
Java-based,emulators,convertors
Yes
Yes(problems!)
Symbian SDK NO NO
Flash Lite(commercial)
Windows Mobile 5+ HTC-only? > 03/2006 Flash MX
Android SDK NO Yes NO SDK
Additional platforms not included in comparison: ● iOS – iPhone, iPad, iPod - MacOS development only● Windows Phone 7 – XNA or Silverlight development only● Various Vendor-specific frameworks for specific devices
Department of Computer ScienceVŠB-Technical University of Ostrava
11by Roman Szturc 2006 & Pavel Moravec 2008-2013
New platforms changed everything!Device fragmentation → Platform fragmetation
Vendors try to keep customer by vendor lock-in
Applications sold by vendors directly through their AppStore/Marketplace/Market/...
4 dominant platforms in 2012
Android
iOS
Blackberry (US) / Symbian (EU)
Windows (Mobile+WP7+Windows RT)
Dumb phones still use JavaME (MIDP 3.0 – too little too late).
Department of Computer ScienceVŠB-Technical University of Ostrava
12by Roman Szturc 2006 & Pavel Moravec 2008-2013
Why is platform fragmentation bad?Different environment
Different APIs
Different programming languages (Java, JavaME, Objective C, Silverlight, …)
Different SDKs, specific OS needed for SDK and development (Windows, MacOS)
→ The code needs to be written several times We may use Native libraries (usually in C/C++)
Android/JavaME – basic common parts in Java, GUI/API calls separately
HTML 5 for simple applications – PhoneGap
Platform-independent SDKs
Department of Computer ScienceVŠB-Technical University of Ostrava
13by Roman Szturc 2006 & Pavel Moravec 2008-2013
Best description of current situation
Source
:htt
p://ww
w.root
.cz/
clan
ky/kom
iks-
trvale
-udrzi
teln
y-ro
zvoj/
Department of Computer ScienceVŠB-Technical University of Ostrava
14by Roman Szturc 2006 & Pavel Moravec 2008-2013
Java ME
Department of Computer ScienceVŠB-Technical University of Ostrava
15by Roman Szturc 2006 & Pavel Moravec 2008-2013
Why still use JavaME ?Basic ideas similar to other platforms, we can demonstrate the basic concepts here before moving to Android
Easy-to understand platform with well-defined standards (jcp.org)
Still the main choice for dumb phones
Basic notions will help when moving to Android Development
Per-app revenues still better than Android (150% based on 08/2011 data, but iOS has 200%).Source: Mobile Marketing Watch
SDK for all 3 major platforms (Windows, MacOS, Linux), Netbeans (or Eclipse) development
Department of Computer ScienceVŠB-Technical University of Ostrava
16by Roman Szturc 2006 & Pavel Moravec 2008-2013
Java started small, aimed at television set top boxes and other interactive devices.
Of course, once it got aimed toward web browsers and applets, the brakes were off. As a result, the platform got all kinds of amazing features like Swing, Java 2D, Java 3D, JDBC, EJB, and so on.
With each new API, the size of the platform got bigger and bigger and bigger. So did the runtime footprint. These days, it is not uncommon to see Java virtual machines with a gigabyte or more of heap space.
Whether it is called featuritis, bloat, or customer responsiveness, the fact remains that the Java 1 platform was big, and the standard Java 2 platform is huge.
History
Department of Computer ScienceVŠB-Technical University of Ostrava
17by Roman Szturc 2006 & Pavel Moravec 2008-2013
In 1995 the first version of Java, now known as Java Platform Standard Edition (JavaSE), was released. Since that time its landscape has changed significantly.
Standard Edition (JavaSE)Designed to run on desktop and workstation computers.
Enterprise Edition (JavaEE)This edition is aimed at server-based applications. Contains buit-in support for Servlets, JSP and XML.
Micro Edition (JavaME)Designed for devices with limited memory, display and processing power.
Java Editions
Department of Computer ScienceVŠB-Technical University of Ostrava
18by Roman Szturc 2006 & Pavel Moravec 2008-2013
Java
2 E
nte
rpris
e E
diti
on(J
avaE
E)
KVM
Java Editions
CLDC
MIDP
CDCJava
2 S
tan
dard
Ed
itio
n(J
ava
SE
)
Java 2 Micro Edition(JavaME)
Java Virtual Machine
Department of Computer ScienceVŠB-Technical University of Ostrava
19by Roman Szturc 2006 & Pavel Moravec 2008-2013
Generic JavaME Architecture
Profile
ApplicationNative
Applications
Application management
software (AMS)
Configuration
Libraries
JavaVirtual Machine
Host Operating System
Department of Computer ScienceVŠB-Technical University of Ostrava
20by Roman Szturc 2006 & Pavel Moravec 2008-2013
Any device running a Java application needs protection from malicious code that may access system information or resources. Advanced security model provided by the JavaSE is too memory-consuming to be included in CLDC devices.
The security model, which is provided in the CLDC devices, is the so called sandbox model. In the sandbox model, the applications are run in a closed environment in which the application can only access not secure-sensitive resources.
Regardless of the JVM, this type of “low-level” security is implemented using class file verification.
Handling Security
Department of Computer ScienceVŠB-Technical University of Ostrava
21by Roman Szturc 2006 & Pavel Moravec 2008-2013
Verifying the integrity of class files is not a trivial operation. To spread the work load on a mobile device, verification is done in two steps.
0. Pre-verificationA software program is run to insert additional attributes into the class file. This information reduces the amount of time and memory necessary when the JVM carries out step 2 of verification.
1. In-device verificationOnce a device loads a pre-verified class file, the in-device verifier runs through each instruction. There are several checks done to validate the code.
Class File Verification
Department of Computer ScienceVŠB-Technical University of Ostrava
22by Roman Szturc 2006 & Pavel Moravec 2008-2013
Capabilities of devices within the JavaME may vary greatly. A PDA may have a much larger display than a pager. One Java platform will most definitely not fit all. In order to accommodate a broad range of consumer electronics and embedded devices JavaME introduces two new concepts: configurations and profiles.
Configurations and Profiles
Profile
Libraries
Java Virtual MachineConfiguration
Department of Computer ScienceVŠB-Technical University of Ostrava
23by Roman Szturc 2006 & Pavel Moravec 2008-2013
A configuration defines a Java platform for a broad range of devices. A configuration is closely tied to a JVM. In fact, a configuration defines the Java language features and the core Java libraries of the JVM for that particular configuration.
The dividing line as to what a configuration applies is for the most part based on memory, network connectivity and processing power available on a device. Configuration provides the lowest common denominator for a group of devices.
Currently, there are two configurations defined:● Connected Limited Device Configuration (CLDC) ● Connected Device Configuration (CDC)
Configuration
Department of Computer ScienceVŠB-Technical University of Ostrava
24by Roman Szturc 2006 & Pavel Moravec 2008-2013
CDC is a subset of JavaSE, plus some extra classes. CLDC is a subset of CDC.
CDC versus CLDC
JavaSE
CDC CLCD
Department of Computer ScienceVŠB-Technical University of Ostrava
25by Roman Szturc 2006 & Pavel Moravec 2008-2013
This configuration is designed for devices with more memory, faster processors and greater network bandwidth It is appropriate, at least in the near term, for home automation and automotive navigation, entertainment and telemetry systems.
A programming model closer to JavaSE simplifies porting existing desktop clients for enterprise systems to mobile devices that support CDC.
CDC is used for example in Multimedia Home Platform (MHP) in DVB set-top boxes
Connected Device Configuration
Department of Computer ScienceVŠB-Technical University of Ostrava
26by Roman Szturc 2006 & Pavel Moravec 2008-2013
This configuration is intended for devices with intermittent network connections, small processors and limited memory. Expected targets included two-way pagers, mobile phones and entry-level PDAs.
However, in practice, the functionality delivered by CLDC and the associated profiles and optional packages is very close to that of CDC. As a consequence it is used today on most high-end mobile phones, or smartphones, which are replacing PDAs in the marketplace.
Connected Limited Device Configuration
Department of Computer ScienceVŠB-Technical University of Ostrava
27by Roman Szturc 2006 & Pavel Moravec 2008-2013
There are three main areas that distinguish the Java Language for CLDC to those defined in the Java Language Specification.
● Floating Point MathThe CLDC 1.0 implementation of the Java language does not support floats. CLDC 1.1 specifies such support. But MIDP 2.0 only requires CLDC 1.0.
● FinalizationThe CLDC does not support the finalize() method because an overhead and processor requirements are too steep.
● Error HandlingThe JVM supports a limited set of error handling exceptions due a significant demand on the system's device-dependent.
Java Language Differences
Department of Computer ScienceVŠB-Technical University of Ostrava
28by Roman Szturc 2006 & Pavel Moravec 2008-2013
JavaME Java Virtual Machines
C virtual machine (CVM)● classic Java virtual machine ● used with CDC ● 32b microprocessor● at least 2MB of RAM & 2.5 MB of ROM
Kilobyte virtual machine (KVM)● used with CLDC ● 16b/32b (slow) microprocessor● limited math, string, and I/O functions● lacks some features of classic JVM● only a small subset of JavaSE core libraries● at least 32kB of RAM & 128kB of ROM
Department of Computer ScienceVŠB-Technical University of Ostrava
29by Roman Szturc 2006 & Pavel Moravec 2008-2013
The Java virtual machine supporting CLDC (KVM) differs from the Java Virtual Machine specification
● Floating Point MathThe implementation of the JVM for CLDC 1.0 lacks support for floating point numbers.
● Java Native InterfaceTo reduce the potential of corruption to system level information support for invoking native methods was eliminated.
● Custom Class LoaderThere are tight controls on a class loader|it cannot be replaced, overridden or modified. The loader itself is device-dependent.
continued ►
Java Virtual Machine Differences
Department of Computer ScienceVŠB-Technical University of Ostrava
30by Roman Szturc 2006 & Pavel Moravec 2008-2013
◄ continued
● ReflectionReflection is not available on a JVM supporting the CLDC.
● Thread GroupsThe JVM does not support the ThreadGroup class.
● FinalizationThe JVM lacks support for finalization.
● Weak ReferencesThe JVM does not support weak references to objects.
Java Virtual Machine Differences
Department of Computer ScienceVŠB-Technical University of Ostrava
31by Roman Szturc 2006 & Pavel Moravec 2008-2013
A profile supplements a configuration to provide capabilities for a specific family of devices or specific industry segment application need.
For example, a configuration provides a generic Java API for battery powered, limited display and processing capability systems, while a profile provides a supplemental Java API specific to cellular telephones, which is a member of this larger group of devices. A profile must supplement a configuration.
A profile will not work without the configuration and virtual machine providing the core classes/API and runtime environment.
Profile
Department of Computer ScienceVŠB-Technical University of Ostrava
32by Roman Szturc 2006 & Pavel Moravec 2008-2013
Profiles
CDC profiles● Foundation profile – basic CDC profile● Game Profile – developing game applications● Personal Profile – complex UI components FP● Personal Basis Profile – simple UI components (single window)● RMI Profile – Remote Method Invocation support classes
CLDC profiles● Mobile Information Device Profile – local storage, UI, network● PDA Profile – better displays, larger memory compared to MIDP● KJava – Sun-specific API for Palm OS● Information Module Profile – subset of MIDP 1.0
Department of Computer ScienceVŠB-Technical University of Ostrava
33by Roman Szturc 2006 & Pavel Moravec 2008-2013
The Mobile Information Device Profile (MIDP) is a key element of the Java 2 Platform, Micro Edition (JavaME). When combined with the Connected Limited Device Configuration (CLDC), MIDP provides a standard Java runtime environment for today's most popular mobile information devices, such as cell phones and mainstream personal digital assistants. The profile can be characterized by the following features:
● rich user interface capabilities,● extensive connectivity,● multimedia and game functionality,● over-the-air-provisioning,● end-to-end security.
Mobile Information Device Profile
Department of Computer ScienceVŠB-Technical University of Ostrava
34by Roman Szturc 2006 & Pavel Moravec 2008-2013
The IMP is a strict subset of the MIDP 1.0 specification. The primary difference is that IMP removes MIDP's display and input mechanisms. Instead, IMP devices must provide their own implementation-specific classes to handle any interaction with the user they need.
Information Module Profile
Department of Computer ScienceVŠB-Technical University of Ostrava
35by Roman Szturc 2006 & Pavel Moravec 2008-2013
Excerpt from JavaME FAQ: Configurations and Profiles are defined by open industry working groups utilizing Sun’s Java Community Process Program. In this way industries can decide for themselves what elements are necessary to provide a complete solution targeted at their industry. For more information on the Sun Community Process Program, see: http://jcp.org.
How are Configurations and Profiles Defined?
Department of Computer ScienceVŠB-Technical University of Ostrava
36by Roman Szturc 2006 & Pavel Moravec 2008-2013
MIDP Optional PackagesOnce again the basic library was insufficient for some applications (remember the JavaSE history), which resulted in the development of several new packages:
● PDA Optional Package – more PDA-specific APIs, e.g. PIM ● Bluetooth API – Bluetooth communication (SDK problem)● Wireless Messaging API – SMS (MMS) capabilities● Location API – location tracking● SIP API for JavaME – VoIP communication,session initiation● Presence & IM API – JavaME version of JAIN, IM & presence
support based on SIP● Mobile Media API – audio/video controls, streaming media● JavaME Web Services API – Web Services-related XML
classes● Security and Trust API – Interaction with security smart card● Mobile 3D Graphics API – 3D graphics, mainly for games● ...