Programming Handheld and Mobile devices 1 Programming of Handheld and Mobile Devices Lecture 7 J2ME Rob Pooley

Slides:



Advertisements
Similar presentations
MIDP Mobile Information Device Profile Johnny Yau CIS 642 Prof. Insup Lee.
Advertisements

J2ME 25 July Overview  What is J2ME?  The CLDC and CDC configurations  MIDP and MIDlets  Development Tools  Demonstrations.
Introduction to Systems Programming (CS 0449) PalmOS Events Handling Events OS–AppEventLoop() – Event Handlers.
Writing Your First MIDlet Running JAVA on a Cell Phone Jon A. Batcheller January 27, 2004.
UNDERSTANDING JAVA APIS FOR MOBILE DEVICES v0.01.
Programming Handheld and Mobile devices 1 Programming of Handheld and Mobile Devices Lecture 10 Java for MIDs Rob Pooley
1 Frameworks. 2 Framework Set of cooperating classes/interfaces –Structure essential mechanisms of a problem domain –Programmer can extend framework classes,
Interactive Visual System By Arthur Evans, John Sikorski, and Patricia Thomas.
J2ME Prepared by: - Gaery- Ronny - Alan- Andy. Why Technology for Mobile Devices? The nature of wireless devices is changing Old devices: All the software.
Making Cell Phone Games An Overview Ray Ratelis Guild Software, Inc.
Mobile Application Development
V0.01 © 2009 Research In Motion Limited Understanding Java APIs for Mobile Devices Trainer name Date.
Cosc 4730 Phone Programming in Java An Introduction.
Lab 1 Instructor: Jolanta Soltis.
Java 2 Platform, Micro Edition (J2ME) By Xiaorong Wang.
SM3121 Software Technology Mark Green School of Creative Media.
Asst.Prof.Dr.Ahmet Ünveren SPRING Computer Engineering Department Asst.Prof.Dr.Ahmet Ünveren SPRING Computer Engineering Department.
ANDROID PROGRAMMING MODULE 1 – GETTING STARTED
01 Introduction to Java Technology. 2 Contents History of Java What is Java? Java Platforms Java Virtual Machine (JVM) Java Development Kit (JDK) Benefits.
Android Application Development 2013 PClassic Chris Murphy 1.
DAT602 Database Application Development Lecture 15 Java Server Pages Part 1.
Introduction to The Linaro Toolchain Embedded Processors Training Multicore Software Applications Literature Number: SPRPXXX 1.
1 Introduction to Tool chains. 2 Tool chain for the Sitara Family (but it is true for other ARM based devices as well) A tool chain is a collection of.
Topics on KVM Presented By Xiaozhou David Zhu. Topics covered Introduction Java2 Platform Micro Edition CLDC KVM.
Programming In C++ Spring Semester 2013 Programming In C++, Lecture 1.
Android Introduction Platform Overview.
Unit Testing & Defensive Programming. F-22 Raptor Fighter.
M. Taimoor Khan * Java Server Pages (JSP) is a server-side programming technology that enables the creation of dynamic,
1 I-Logix Professional Services Specialist Rhapsody IDF (Interrupt Driven Framework) CPU External Code RTOS OXF Framework Rhapsody Generated.
Programming Handheld and Mobile devices 1 Programming of Handheld and Mobile Devices Lecture 11 J2ME and MIDlets Rob Pooley
© 2008, Renesas Technology America, Inc., All Rights Reserved 1 Purpose  This training course describes how to configure the the C/C++ compiler options.
Lecture 2 Event driven programming Mobile and Handheld Applications1 Programming of Handheld and Mobile Devices Lecture 2: Event driven programming concepts.
Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved Programming Languages Machine.
Small Devices on DBGlobe System George Samaras Chara Skouteli.
Framework and application bytecode size CLDC MIDP kXML parser Utility classes Graphics Logic (MIDlet) Application Data (XML file)
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.
Programming Handheld and Mobile devices 1 Programming of Handheld and Mobile Devices Lecture 5 Compiling with resources Rob Pooley
Programming of Mobile and Handheld Devices Lecture 7: Programming OXO for Palm OS Rob Pooley
Old Chapter 10: Programming Tools A Developer’s Candy Store.
Lecture 3Programming Handheld and Mobile devices 1 Programming of Handheld and Mobile Devices Lecture 3 Palm conventions Rob Pooley
About the Presentations The presentations cover the objectives found in the opening of each chapter. All chapter objectives are listed in the beginning.
© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems Memory: Relocation.
Writing a Run Time DLL The application loads the DLL using LoadLibrary() or LoadLibraryEx(). The standard search sequence is used by the operating system.
Programming of Mobile and Handheld Devices Lecture 5: Programming for Palm OS Rob Pooley
Lecture 4 OXO for PalmMobile and Handheld Applications1 Programming of Mobile and Handheld Devices Lecture 4: Programming OXO for Palm OS Rob Pooley
Core Java Introduction Byju Veedu Ness Technologies httpdownload.oracle.com/javase/tutorial/getStarted/intro/definition.html.
Lecture 3 Programming on Palm OS Mobile and Handheld Applications1 Programming of Mobile and Handheld Devices Lecture 3: Programming for Palm OS Rob Pooley.
 Programming - the process of creating computer programs.
Palm OS emulator.
Mobile Programming Mobile Programming - Ordibehesht Ordibehesht 1390.
김민수 Cortex-M4 Processor - Getting Started with the GNU Compiler Collection(gcc)
Best 5 Mobile App Development Tools for Developer's to think beyond the Limitation.
Java Programming Fifth Edition Chapter 1 Creating Your First Java Classes.
Some of the utilities associated with the development of programs. These program development tools allow users to write and construct programs that the.
SESSION 1 Introduction in Java. Objectives Introduce classes and objects Starting with Java Introduce JDK Writing a simple Java program Using comments.
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.
The Java Platform Micro Edition Java ME
Android Mobile Application Development
Object Oriented Programming in
What is Apertis? Apertis is a versatile open source infrastructure tailored to the automotive needs and fit for a wide variety of electronic devices.
Programming of Handheld and Mobile Devices
MOBILE DEVICE OPERATING SYSTEM
Wireless Instant Messaging Using J2ME
CMPE419 Mobile Application Development
CMPE419 Mobile Application Development
Outcome of the Lecture Upon completion of this lecture you will be able to understand Fundamentals and Characteristics of Java Language Basic Terminology.
Plug-In Architecture Pattern
Presentation transcript:

Programming Handheld and Mobile devices 1 Programming of Handheld and Mobile Devices Lecture 7 J2ME Rob Pooley

Programming Handheld and Mobile devices 2 Java 2 Platform, Micro Edition (J2ME) 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

Programming Handheld and Mobile devices 3 The J2ME Architecture The J2ME architecture comprises a variety of configurations, profiles, and optional packages that implementers and developers can choose from

Programming Handheld and Mobile devices 4 Configurations Configurations comprise a virtual machine and 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) and –the Connected Device Configuration (CDC).

Programming Handheld and Mobile devices 5 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

Programming Handheld and Mobile devices 6 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.

Programming Handheld and Mobile devices 7

8 AppHandleEvent() static Boolean AppHandleEvent(EventType* pEvent) { uint16_t formId; FormType* pForm; if (pEvent->eType == frmLoadEvent) { // Load the form resource. formId = pEvent->data.frmLoad.formID; // OS6NEW: FrmInitForm() needs app db ptr as first argument pForm = FrmInitForm(gAppDB, formId); FrmSetActiveForm(pForm); // Set the event handler for the form. The handler of the currently active form is called by FrmHandleEvent each time // is receives an event. switch (formId) { case MainForm: FrmSetEventHandler(pForm, MainFormHandleEvent); FrmInitLayout(pForm, gMainFormLayout); break; case Form2Form: FrmSetEventHandler(pForm, Form2FormHandleEvent); FrmInitLayout(pForm, gForm2FormLayout); break; default: ErrFatalDisplay("Invalid Form Load Event"); break; } return true; } return false; }

Programming Handheld and Mobile devices 9 The makefile ## # Palm OS Generic Protein Makefile for # Eclipse v1.0.0 # # Fill in this file to specify your # project and the source that you want # to build, and the settings involved in # the build. The makefile-engine.mk # will then do the hard work of the # makefile and dependency handling. # # After starting a new project, please # remember the following steps... #1. Add all sources and resources in # SOURCES and RESOURCES # 2. Review the other settings as needed. # SHELL = /bin/sh ## conditionally include an # auto-generated.mk for dynamic definitions -include auto-generated.mk ## # Set up the artifact name. # The database name and other file names are # based on the application name ## ARTIFACT_NAME = BasicApp EMPTY = SPACE =$(EMPTY) $(EMPTY) ESCAPED_ARTIFACT_NAME = $(subst $(SPACE),\,$(ARTIFACT_NAME)) PROJECT_NAME = BasicApp PRC_NAME = BasicApp.prc

Programming Handheld and Mobile devices 10 The makefile 2 # Sources and Resources and Definition files # List all the sources (.c/.cpp), resources # (.xrd), and definition file (.sld) # in your project. Use project relative path # names with forward slashes # (src/code.cpp). Please do not use spaces in # directory or file names. # # A note about XRD resource files: If you have # existing.rsrc or.rcp files, # refer to the documentation for the GenerateXRD # tool to convert them into # XRD files for use with all Palm OS SDKs. ## # TODO: Update all sources and resources SOURCES = Src/AppMain.c RESOURCES = Rsc/BasicApp.xrd Rsc/Version.xrd DEFS_FILE = Src/BasicApp.def SLD_FILE = Src/BasicApp.sld ## # Review Database information # Register Creator ID at: ## CREATOR_ID = bapp DB_TYPE = appl DATABASE_RESET = DATABASE_BACKUP = -b DATABASE_HIDDEN = DATABASE_PROTECT = DATABASE_VERSION = 1 LOCALE = enUS DATABASE_NAME = $(APP_NAME)

Programming Handheld and Mobile devices 11 The makefile 3 # Choose SDK # Supported values: #sdk-6 ## SDK_VERSION = sdk-6 ifeq ($(SDK_LOCATION),) SDK_LOCATION=../../ endif ## # Build Settings # Review the following for your needs. # The default settings build with debug information # and no optimization and # a target platform of an actual device. ## # # Set Debug or Release configuration for this project # via the project properties # (right-click on the project and select Properties). # DEBUG_OR_RELEASE=Debug # # Set the target platform for the build; # either Device or Simulator # Use Device as a target for emulator builds. # TARGET_PLATFORM=Simulator # Specify the level of optimization that you want: # NONE, SOME, FULL, INTRAPROCEDURAL, INTERPROCEDURAL, INLINING. # Leave blank to select FULL for release builds, and NONE # for debug builds. # INTRAPROCEDURAL, INTERPROCEDURAL, INLINING are applicable # to device builds only; simulator builds will translate # those levels to FULL. OPTIMIZE_LEVEL = NONE # Specify warning level # NONE = suppress all warnings # ALL = enable all warnings # = default warnings WARNING_LEVEL = # Specify exception handling support # true = enable it # false = don't enable it ENABLE_EXCEPTION_HANDLING=true # List additional libraries to link with # (Full or project relative path) ADDITIONAL_LINK_LIBRARIES = ADDITIONAL_SIM_LINK_LIBRARIES =

Programming Handheld and Mobile devices 12 The makefile 4 # Additional paths to look for #include "header" # (Source file directories are automatically included) # Please note that both local and system include paths # should either use "cygwin" syntax or if in Windows # syntax they should # be quoted. ie:../MyLibrary/headers # or "C:\Source\MyLibrary\headers" # Additionally, you must explicly specify the "-I" # prior to each path included in this variable. Spaces # are used to separate each path from each other. LOCAL_INCLUDE_PATHS = -Irsc LOCAL_SIM_INCLUDE_PATHS = -Irsc # Additional paths to look for #include # (Palm OS SDK directories are automatically included) # Additionally, you must explicly specify the "-I" # prior to each path included in this variable. Spaces # are used to separate each path from each other. SYSTEM_INCLUDE_PATHS = SYSTEM_SIM_INCLUDE_PATHS = # Specify any needed preprocessor symbols. # If you set DEFINES to "ASSERTLEVEL=1", the # compiler will see "-DASSERTLEVEL=1" # (separate individual entries with spaces) DEFINES = SIM_DEFINES = # Specify additional compiler flags for all files ADDITIONAL_COMPILER_FLAGS = ADDITIONAL_SIM_COMPILER_FLAGS = # Specify additional linker flags ADDITIONAL_LINKER_FLAGS = ADDITIONAL_SIM_LINKER_FLAGS = # Specify additional archival flags (for static # libraries) ADDITIONAL_AR_FLAGS = ADDITIONAL_SIM_AR_FLAGS = # Tools Directory # Normally you wouldn't want to override this # since the necessary tools # are in the PATH. But if you experimenting with # other tools, then reset the directory here # If overridden, end with a trailing '/' ifeq ($(TOOLS_DIR), ) TOOLS_DIR =../../../PalmOSTools/ endif

Programming Handheld and Mobile devices 13 The makefile 5 ## # Resource Settings ## # Specify the target text encoding # LATIN, JAPANESE, SIMPLIFIED_CHINESE TEXTENCODING = LATIN # Specify error levels for locale and text encoding # NOCHECK # STRICT # LOCALE_CHECKING = # Specific if encoding should be checked # FALSE, TRUE STRICT_ENCODING = FALSE ## # Output Settings ## # Modify if you want object and output files to be in # different locations # (However, please note that all three object # directories must be different # for the makefile engine to properly operate.) # OUTPUT_DIR is the "main" output directory, where # all linked and binary objects # will be put. DEBUG_DEVICE_OUTPUT_DIR := DebugDevice RELEASE_DEVICE_OUTPUT_DIR := ReleaseDevice DEBUG_SIMULATOR_OUTPUT_DIR := DebugSim RELEASE_SIMULATOR_OUTPUT_DIR := ReleaseSim RSC_OBJ_DIR := ResourceObjs ## # Makefiles ## ## include the makefile engine include makefile-engine.mk ## conditionally include your own custom.mk for ## your specific overrides or definitions ## this is useful if you don't want to use the ## auto-generated.mk values ## for some reason -include custom.mk

Programming Handheld and Mobile devices 14 Another simple example UInt32 PilotMain(UInt16 launchCode, MemPtr launchParameters, UInt16 launchFlags) { #pragma unused(launchParameters) Err error; switch (launchCode) { case sysAppLaunchCmdNormalLaunch: error = RomVersionCompatible (kOurMinVersion, launchFlags); if (error) return error; error = AppStart(); if (error) return error; FrmGotoForm(MainForm); AppEventLoop(); AppStop(); break; default: break; } return errNone; }

Programming Handheld and Mobile devices 15 Second AppStart() and AppStop() static Err AppStart(void) { return errNone; } static void AppStop(void) { FrmCloseAllForms(); }

Programming Handheld and Mobile devices 16 The event loop static void AppEventLoop(void) { Err error; EventType event; do { EvtGetEvent(&event, evtWaitForever); if (! SysHandleEvent(&event)) if (! MenuHandleEvent(0, &event, &error)) if (! AppHandleEvent(&event)) FrmDispatchEvent(&event); } while (event.eType != appStopEvent); }

Programming Handheld and Mobile devices 17 Application events static Boolean AppHandleEvent(EventPtr event) { UInt16 formId; FormPtr form; if (event->eType == frmLoadEvent) { // Load the form resource. formId = event->data.frmLoad.formID; form = FrmInitForm(formId); ErrFatalDisplayIf(!form, "Can't initialize form"); FrmSetActiveForm(form); // Set the event handler for the form. The handler of the currently // active form is called by FrmHandleEvent each time it receives an // event. switch (formId) { case MainForm: FrmSetEventHandler(form, MainFormHandleEvent); break; case SecondForm: FrmSetEventHandler(form, SecondFormHandleEvent); break; default: ErrFatalDisplay("Invalid Form Load Event"); break; } return true; } else return false; }