Developing applications using Embedded Rich Client ... · PDF fileDeveloping applications...
-
Upload
phungkhanh -
Category
Documents
-
view
236 -
download
2
Transcript of Developing applications using Embedded Rich Client ... · PDF fileDeveloping applications...
©2008 by «Author»; made available under the EPL v1.0 | Date | Other Information, if necessary
Developing applications using Embedded Rich Client Platform (eRCP) | ©2008 by Nokia; made available under the EPL v1.0
Developing applications using Embedded Rich
Client Platform (eRCP)
Gorkem Ercan, Nokia, Finland
Deeptendu Majumder, Nokia, US
Presentation Title | Presentation Subtitle | ©2008 by «Author»; made available under the EPL v1.0
2Developing applications using Embedded Rich Client Platform (eRCP) | ©2008 by Nokia; made available under the EPL v1.0
Agenda
•Introduction to eRCP
•Introduction to eSWT
•Creating an eWorkbenchapplication
•Deploying to a real device
Presentation Title | Presentation Subtitle | ©2008 by «Author»; made available under the EPL v1.0
3Developing applications using Embedded Rich Client Platform (eRCP) | ©2008 by Nokia; made available under the EPL v1.0
What is eRCP
•eRCP is the embedded version of the Rich Client Platform
•Project was launched by Nokia, IBM and Motorola
•Utilizes standard OSGi Service Platform
•Reduces RCP size and functionality to fit on devices
•Pushes requirements/patches back to core components
�Enable running core components on JME CDC/Foundation Profile
�Keep dependencies in check
•Adds components to enable application binary compatibility
across a range of devices
Presentation Title | Presentation Subtitle | ©2008 by «Author»; made available under the EPL v1.0
4Developing applications using Embedded Rich Client Platform (eRCP) | ©2008 by Nokia; made available under the EPL v1.0
4
Architecture
•OSGi underpinnings
•Applications and services run in the same JVM instance
•eRCP applications can launched from a workbench or
be integrated into the native desktop
•Deployable to a range of devices
�Desktops, cell phones, handhelds, internet tablets etc.
�eRCP applications can also run on RCP
•It is also possible to have stand-alone eSWT
applications and MIDlets
Presentation Title | Presentation Subtitle | ©2008 by «Author»; made available under the EPL v1.0
5Developing applications using Embedded Rich Client Platform (eRCP) | ©2008 by Nokia; made available under the EPL v1.0
Parts of eRCP
•eWorkbench:Responsible for managing the GUI thread and
provides the main “container”for application views that are
created by eRCP applications.
•eSWT: Embedded Standard Widget Toolkit. This is the
embedded version of the SWT found in (RCP).
•eJFace: Provides a set of ready-to-use complex graphical
components on top of eSWT, makes the development of
sophisticated UI applications easier.
•Core Runtime: Built around OSGi framework, provides
extension point framework.
•eUpdate: Provides the capability to download, install, and
update eRCP software as Eclipse features.
Presentation Title | Presentation Subtitle | ©2008 by «Author»; made available under the EPL v1.0
6Developing applications using Embedded Rich Client Platform (eRCP) | ©2008 by Nokia; made available under the EPL v1.0
Relating eRCP to RCP
Presentation Title | Presentation Subtitle | ©2008 by «Author»; made available under the EPL v1.0
7Developing applications using Embedded Rich Client Platform (eRCP) | ©2008 by Nokia; made available under the EPL v1.0
Introduction to eSWT
•Subset of SWT and additional mobile specific widgets
•Provides efficient, portable access to the user interface
facilities of the operating system
•Consists of 3 packages
�SWT subset divided into two
�corepackage
�expandedpackage
�mobilepackage -new eSWT components defined for mobile
world
Presentation Title | Presentation Subtitle | ©2008 by «Author»; made available under the EPL v1.0
8Developing applications using Embedded Rich Client Platform (eRCP) | ©2008 by Nokia; made available under the EPL v1.0
eSWT API
Presentation Title | Presentation Subtitle | ©2008 by «Author»; made available under the EPL v1.0
9Developing applications using Embedded Rich Client Platform (eRCP) | ©2008 by Nokia; made available under the EPL v1.0
How does SWT widgets look on a device
Presentation Title | Presentation Subtitle | ©2008 by «Author»; made available under the EPL v1.0
10
Developing applications using Embedded Rich Client Platform (eRCP) | ©2008 by Nokia; made available under the EPL v1.0
Mobile extensions -MobileShell
•A device tailored Shell that
can change the trimmings
dynamically
�Top-level shell
�Full screen mode
�Allows key press polling
•Introduces status pane styles
�NO_STATUS_PANE
�SMALL_STATUS_PANE
�LARGE_STATUS_PANE
Presentation Title | Presentation Subtitle | ©2008 by «Author»; made available under the EPL v1.0
11
Developing applications using Embedded Rich Client Platform (eRCP) | ©2008 by Nokia; made available under the EPL v1.0
Mobile extensions -Basic controls
•ConstrainedText
•DateEditor
•HyperLink
•TextExtension
•CaptionedControl
•SortedList
•TaskTip
�Suitable for providing info on
long running tasks
�Text and optional ProgressBar
Presentation Title | Presentation Subtitle | ©2008 by «Author»; made available under the EPL v1.0
12
Developing applications using Embedded Rich Client Platform (eRCP) | ©2008 by Nokia; made available under the EPL v1.0
Mobile extensions -Advanced Controls
•ListBox: A list control with enhanced capabilities to
display icons
•ListView: Selectable control that can display items in a
multi-column way
•MultipageDialog: A tabbed dialog
Presentation Title | Presentation Subtitle | ©2008 by «Author»; made available under the EPL v1.0
13
Developing applications using Embedded Rich Client Platform (eRCP) | ©2008 by Nokia; made available under the EPL v1.0
Mobile Extensions –Dialogs
•QueryDialog: Several query
types
�STANDARD: alphanumeric
input
�NUMERIC
�TIME
�DATE
�PASSWORD
•TimedMessageBox:
�4 Different system Icons
(working, information,
warning, error )
�Icons can be replaced
Presentation Title | Presentation Subtitle | ©2008 by «Author»; made available under the EPL v1.0
14
Developing applications using Embedded Rich Client Platform (eRCP) | ©2008 by Nokia; made available under the EPL v1.0
Mobile Extensions –Commands
•Maps to a specific mechanism depending upon device
capabilities
•Has logical types that are typically mapped to Soft
keys (GENERAL, SELECT, OK, CANCEL, DELETE,
BACK, EXIT, STOP, HELP)
�COMMANDGROUP can contain other sub-commands
�S60 implementation maps DELETE commands to ‘C’clear
key.
•Bound to focus context
Presentation Title | Presentation Subtitle | ©2008 by «Author»; made available under the EPL v1.0
15
Developing applications using Embedded Rich Client Platform (eRCP) | ©2008 by Nokia; made available under the EPL v1.0
Mobile Extensions –MobileDevice, Screen & Input
•MobileDevice
�Discover device capabilities and characteristics
�Register listeners for changes in input, screen capabilities
•Screen
�Query the capabilities of the screen(s)
•Input
�Determine input device capabilities
Presentation Title | Presentation Subtitle | ©2008 by «Author»; made available under the EPL v1.0
16
Developing applications using Embedded Rich Client Platform (eRCP) | ©2008 by Nokia; made available under the EPL v1.0
Tips: Building mobile applications using eSWT
•Do not rely on Shell trimmings some platforms do not support
trimmings like SWT.CLOSE
•Do not use deep menu hierarchies.
•Use Commands in relation with the focus context to avoid the soft
keys getting crowded
•Use MobileDevice, Screen, and Input to adjust the behavior at
runtime
�Active screens, active input methods may change
•Use layout managers
•Check the computed layout size and add scrollbars if greater than
screen size
•Tailor your application according to aspect ratios
Presentation Title | Presentation Subtitle | ©2008 by «Author»; made available under the EPL v1.0
17
Developing applications using Embedded Rich Client Platform (eRCP) | ©2008 by Nokia; made available under the EPL v1.0
Right input widget is VERYimportant
Presentation Title | Presentation Subtitle | ©2008 by «Author»; made available under the EPL v1.0
18
Developing applications using Embedded Rich Client Platform (eRCP) | ©2008 by Nokia; made available under the EPL v1.0
Using eSWT with Java ME Midlets
•Java ME MIDP is the most
common computing platform
�700+ million java enabled phones
�635+ java enabled phone models
from 35+ vendors
•Alternate UI toolkit for Java ME
applications
•Available on all Nokia S60 3rdEd.
FP2 devices
Presentation Title | Presentation Subtitle | ©2008 by «Author»; made available under the EPL v1.0
19
Developing applications using Embedded Rich Client Platform (eRCP) | ©2008 by Nokia; made available under the EPL v1.0
Using eSWT with a JavaMEMidlets
•Required Software
�Eclipse IDE
�EclipseMEplug-in (www.eclipseme.org)
�Nokia S60 3.2 SDK (forum.nokia.com)
•HelloWorldMidletavailable in eRCP project’s wiki
�http://wiki.eclipse.org/How_to_use_eSWT_with_Midlets
•You can use NetBeansas well ??
Presentation Title | Presentation Subtitle | ©2008 by «Author»; made available under the EPL v1.0
20
Developing applications using Embedded Rich Client Platform (eRCP) | ©2008 by Nokia; made available under the EPL v1.0
eWorkbench
•Provides the main “container”for application views
that are created by eRCP applications
•Responsible for managing the UI thread
•Applications and services run in the same JVM
instance
�Fewer resources than separate JVMs
�Allows sharing of services
�Enables variety of life cycle models
•eRCP applications are created as Eclipse plug-ins for
the eWorkbench
Presentation Title | Presentation Subtitle | ©2008 by «Author»; made available under the EPL v1.0
21
Developing applications using Embedded Rich Client Platform (eRCP) | ©2008 by Nokia; made available under the EPL v1.0
Adding applications to eWorkbench
•Plug-ins intended to run in the eWorkbench are
required to contribute extensions towards the following
extension points
•org.eclipse.ui.views
�This extension point allows applications to provide their views
•org.eclipse.ercp.eworkbench.applications
�Introduces applications to eWorkbench
�To accommodate with devices with multiple displays, it can
have three types of views –Normal, Large and Status. Only
the Normal view is required. Each view type is defined into
separate viewelement
Presentation Title | Presentation Subtitle | ©2008 by «Author»; made available under the EPL v1.0
22
Developing applications using Embedded Rich Client Platform (eRCP) | ©2008 by Nokia; made available under the EPL v1.0
Required development tools
•Eclipse 3.3 or later with Plug-in development
environment (PDE)
�www.eclipse.org/downloads
•eRCP distribution for Windows Desktop
�www.eclipse.org/ercp
•And a java runtime
�http://java.sun.com/javase/downloads/index.jsp
Presentation Title | Presentation Subtitle | ©2008 by «Author»; made available under the EPL v1.0
23
Developing applications using Embedded Rich Client Platform (eRCP) | ©2008 by Nokia; made available under the EPL v1.0
Setting up Eclipse PDE for eRCP development
•Unzip eRCP distribution for Windows Desktop
•Set Plug-in Developmenttarget platform to be eRCP
1.Window -> Preferences
2.expand the Plug-in Developmentnode and choose the
Target Platformsub-node
3.In the Locationfield, specify the
<ercp_installation_dir>\win32\eRCPdirectory
Presentation Title | Presentation Subtitle | ©2008 by «Author»; made available under the EPL v1.0
24
Developing applications using Embedded Rich Client Platform (eRCP) | ©2008 by Nokia; made available under the EPL v1.0
HelloWorldeWorkbench application (1)
•Create a plug-in project
1.Call File->New->Projectand choose the Plug-in Project
2.A bundle Activator is not needed for this plug-in unselect it.
3.Select the execution environment as OSGi Minimum 1.1
(available in wizard only after 3.4)
4.Select Finish.
�Add required dependencies
�org.eclipse.core.runtime
�org.eclipse.ui
�org.eclipse.ercp.eworkbench
Presentation Title | Presentation Subtitle | ©2008 by «Author»; made available under the EPL v1.0
25
Developing applications using Embedded Rich Client Platform (eRCP) | ©2008 by Nokia; made available under the EPL v1.0
HelloWorldeWorkbench application (2)
•Create org.eclipse.ui.views
1.Add from the Extensionstab select the
org.eclipse.ui.views
2.To add a view right click on the org.eclipse.ui.views
extension point and choose New->viewfrom the menu that
appears
3.Create a new class that extends
org.eclipse.ui.part.ViewPart
•Extend org.eclipse.ercp.eworkbench.applications
1.add this extension point similar to above step
2.Fill in the properties of the applicationand viewselements
Presentation Title | Presentation Subtitle | ©2008 by «Author»; made available under the EPL v1.0
26
Developing applications using Embedded Rich Client Platform (eRCP) | ©2008 by Nokia; made available under the EPL v1.0
Testing the HelloWorld
1.Call Run->Run Configurations
2.Create a new Eclipse Application configuration
3.Choose
org.eclipse.ercp.eworkbench.eWorkbenchfor
Run an Application option
Presentation Title | Presentation Subtitle | ©2008 by «Author»; made available under the EPL v1.0
27
Developing applications using Embedded Rich Client Platform (eRCP) | ©2008 by Nokia; made available under the EPL v1.0
Deploying to Device
•Features and deployment
via update sites is supported
by all target environments
•Create a feature
1.File ->New -> Project ->
Feature Project
2.Select your plug-in
•Create update site
1.File ->New -> Project ->
Update Site Project
2.Add your feature
Presentation Title | Presentation Subtitle | ©2008 by «Author»; made available under the EPL v1.0
28
Developing applications using Embedded Rich Client Platform (eRCP) | ©2008 by Nokia; made available under the EPL v1.0
Conclusion
•eRCP brings the RCP paradigm to mobile devices
•Website
�http://www.eclipse.org/ercp
•Newsgroups
�news://news.eclipse.org/eclipse.dsdp.ercp
•Always looking for contributors!
Presentation Title | Presentation Subtitle | ©2008 by «Author»; made available under the EPL v1.0
29
Developing applications using Embedded Rich Client Platform (eRCP) | ©2008 by Nokia; made available under the EPL v1.0
Nokia eRCP for S60 3.0 FP 1
•eRCP 1.0.3
•JSR 232
•S60 integration
•Early release/Beta
•Security work &
S60 3.0 FP2 in
progress
Presentation Title | Presentation Subtitle | ©2008 by «Author»; made available under the EPL v1.0
30
Developing applications using Embedded Rich Client Platform (eRCP) | ©2008 by Nokia; made available under the EPL v1.0
On-Device Tooling for NeRCP
•Instrumentation
Agent
•Remote Console
•Remote
Debugging
Presentation Title | Presentation Subtitle | ©2008 by «Author»; made available under the EPL v1.0
31
Developing applications using Embedded Rich Client Platform (eRCP) | ©2008 by Nokia; made available under the EPL v1.0
Remote Console
•Setup via Instrumentation Agent
•Run remote console server on device
•Output redirected
•Additional Feature allows mgmt
commands.
•Status of stack
•Bundle manifests
•etc.
Presentation Title | Presentation Subtitle | ©2008 by «Author»; made available under the EPL v1.0
32
Developing applications using Embedded Rich Client Platform (eRCP) | ©2008 by Nokia; made available under the EPL v1.0
Remote Debugging
•Can be setup as server or client
•Set breakpoints in code
•Setup Debug Configon Eclipse
�Use Show IP option in IAgent
•Start debugging project
Presentation Title | Presentation Subtitle | ©2008 by «Author»; made available under the EPL v1.0
33
Developing applications using Embedded Rich Client Platform (eRCP) | ©2008 by Nokia; made available under the EPL v1.0
Remote Profiling
•Profiling Agents
�Can be deployed & connect to host
�Measure the memory consumption of
the application.
�Monitor CPU usage.
�Take heap snapshots .
�Monitor thread progress statistics.
�View VM statistics
•ProSyst JProfiler
Presentation Title | Presentation Subtitle | ©2008 by «Author»; made available under the EPL v1.0
34
Developing applications using Embedded Rich Client Platform (eRCP) | ©2008 by Nokia; made available under the EPL v1.0
S60 3.1 Generic Emulator Setup for NeRCP
�Download S60 3.0 FP 1 SDK
�Unpack and install {SDK}
�Unpack NeRCP win32
distribution
�{SDK}\Symbian\9.2\S60_3rd_FP1_2\
�One time setup (javamesetup.exe)
Presentation Title | Presentation Subtitle | ©2008 by «Author»; made available under the EPL v1.0
35
Developing applications using Embedded Rich Client Platform (eRCP) | ©2008 by Nokia; made available under the EPL v1.0
Using S60 3.1 Emulator for NeRCP
�Launch (epoc.exe)
�Copy project Update site to
�{SDK}\epoc32\winscw \c\Data\downloads\=
(C:\Data\downloads)
�Point eRCP App Manager to local
Update site
Presentation Title | Presentation Subtitle | ©2008 by «Author»; made available under the EPL v1.0
36
Developing applications using Embedded Rich Client Platform (eRCP) | ©2008 by Nokia; made available under the EPL v1.0
Deployment to Device
•Local & Remote Update Site
•PC Suite or USB Mass storage
connection.
•Valid update site locations
�C:\Data\Downloads
�E:\Downloads
•Use eRCP Application Manager
Presentation Title | Presentation Subtitle | ©2008 by «Author»; made available under the EPL v1.0
37
Developing applications using Embedded Rich Client Platform (eRCP) | ©2008 by Nokia; made available under the EPL v1.0
Building an Application for NeRCP
•A Simple eRCP application
•Using OSGi services
�Module Layer Concepts
�Lifecycle Layer Concepts
�Service Layer Concepts
INSTALLED
RESOLVED
UNINSTALLED
ACTIVE
STOPPING
STARTING
start
stop
uninstall
uninstall
install
resolve
update/
refresh
Module
Life Cycle
Services
Security
Exec Env
Applications
Presentation Title | Presentation Subtitle | ©2008 by «Author»; made available under the EPL v1.0
38
Developing applications using Embedded Rich Client Platform (eRCP) | ©2008 by Nokia; made available under the EPL v1.0
OSGi Concepts
A Layered Architecture designed for predictable, managed and
secure execution of modular applications and services. It Enables a
model for co-operation between components and provides a
Standardized a set of powerful services
Module Layer, using Bundleas a unit of modularization, enables
a managed linking between components in term of how packages
are shared and used.
Lifecycle Layer, addresses the capturing of the full lifecycle states
of a software component to enable well managed resource
utilization needed for a dynamic service platform.
Service Layer, enables a dynamic service orientation based on a
publish, find and bind architecture
Presentation Title | Presentation Subtitle | ©2008 by «Author»; made available under the EPL v1.0
39
Developing applications using Embedded Rich Client Platform (eRCP) | ©2008 by Nokia; made available under the EPL v1.0
Sim
ple Contact Manager eRCP App
•Simplified Nokia eRCP Demo
•Logically structured with multiple bundles
•Dynamic functionality extension
�PIM Data Management add-on
�Network add-on
�Management add-on
�Voice call add-on
Presentation Title | Presentation Subtitle | ©2008 by «Author»; made available under the EPL v1.0
40
Developing applications using Embedded Rich Client Platform (eRCP) | ©2008 by Nokia; made available under the EPL v1.0
Application M
odules
Presentation Title | Presentation Subtitle | ©2008 by «Author»; made available under the EPL v1.0
41
Developing applications using Embedded Rich Client Platform (eRCP) | ©2008 by Nokia; made available under the EPL v1.0
Application M
odules
•Model
�Packages Data & Service Interfaces
�No execution logic
�Only exports packages
•Main Application
�Main application as an eWorkbench application
�Provides main application logic
�Provides the view components
�Publishes a view manipulation service
�Enables dynamic extension of functionality via Commands
and actions .
Presentation Title | Presentation Subtitle | ©2008 by «Author»; made available under the EPL v1.0
42
Developing applications using Embedded Rich Client Platform (eRCP) | ©2008 by Nokia; made available under the EPL v1.0
Add-on Modules
•PIM Data Management add-on
�Registers its service (in-memory db)
�Service detected & list populated
•Management Add on
�Adds command (s) & operations to the Application
�Detects PIM service and manipulates content
•Internet Add on
�Registers Mapping services (email, website, etc.)
�Adds commands to the Applications
•Voice Add on
�Adds command to the Application
�Utilizes Symbian Native component to place call
Presentation Title | Presentation Subtitle | ©2008 by «Author»; made available under the EPL v1.0
43
Developing applications using Embedded Rich Client Platform (eRCP) | ©2008 by Nokia; made available under the EPL v1.0
App Screen Shots on desktop
Presentation Title | Presentation Subtitle | ©2008 by «Author»; made available under the EPL v1.0
44
Developing applications using Embedded Rich Client Platform (eRCP) | ©2008 by Nokia; made available under the EPL v1.0
Application UI
Presentation Title | Presentation Subtitle | ©2008 by «Author»; made available under the EPL v1.0
45
Developing applications using Embedded Rich Client Platform (eRCP) | ©2008 by Nokia; made available under the EPL v1.0
Module creation concerns
•Declaring static dependencies
•Describing the module
•Handling Initialization & Termination of execution
•Handling dynamic dependencies
�Looking for services
�Reacting to changes in service states
�Publishing services
•Business logic
•Dealing with Startup mechanisms & Deployment
Presentation Title | Presentation Subtitle | ©2008 by «Author»; made available under the EPL v1.0
46
Developing applications using Embedded Rich Client Platform (eRCP) | ©2008 by Nokia; made available under the EPL v1.0
Creating the Application
Model Plugin
•Exporting packages
Main Application Plugin
•Main app as an eWorkbench plugin
�org.eclipse.ercp.eworkbench.applicationsextension point
•Creating the View
�org.eclipse.ui.viewsextension point
�Creates a ContactListcomponent that contains a List
�implements SelectionListenerfor various selection events
�creates a Command->action map
�more..
Presentation Title | Presentation Subtitle | ©2008 by «Author»; made available under the EPL v1.0
47
Developing applications using Embedded Rich Client Platform (eRCP) | ©2008 by Nokia; made available under the EPL v1.0
Plugin/Bundle Project Set Up
Presentation Title | Presentation Subtitle | ©2008 by «Author»; made available under the EPL v1.0
48
Developing applications using Embedded Rich Client Platform (eRCP) | ©2008 by Nokia; made available under the EPL v1.0
Bundle Headers
Require-Bundle
OSGi/Minimum-1.1
Bundle-
RequiredExecutionEnvironment
true
Eclipse-LazyStart
org.eclipsecon.demo.contact.app,
org.eclipsecon.demo.contact.app.ui,
org.eclipsecon.demo.contact.app.ui.impl
Export-Package
org.eclipse.ercp.swt.mobile,
org.eclipse.swt,
org.eclipse.swt.browser
Import-Package
1.0.0
Bundle-Version
org.eclipsecon.demo.contact.app.Contact
AppActivator
Bundle-Activator
nercp.contactmanager.app;
singleton:=true
Bundle-SymbolicName
Presentation Title | Presentation Subtitle | ©2008 by «Author»; made available under the EPL v1.0
49
Developing applications using Embedded Rich Client Platform (eRCP) | ©2008 by Nokia; made available under the EPL v1.0
Initialization & Term
ination
•Using BundleActivators
�Like a main class
�start()
�do init
�acquire resources
�execute business logic
�stop()
�release resources
•Using AbstractUIPlugin
�Bundle activator for Eclipse UI plugins
Presentation Title | Presentation Subtitle | ©2008 by «Author»; made available under the EPL v1.0
50
Developing applications using Embedded Rich Client Platform (eRCP) | ©2008 by Nokia; made available under the EPL v1.0
BundleActivator usage
publicvoidstart(BundleContextbc) throwsException {
this.bc= bc;
commonGUITracker= newServiceTracker(bc,bc.createFilter….
commonGUITracker.open();
mServiceTracker= newServiceTracker(bc, bc.createFilter….
mServiceTracker.open();
} ………
publicvoidstop(BundleContextbc) throwsException {
if(sReg!= null) {
sReg.unregister();
sReg= null; }
if( mServiceTracker!= null) {
mServiceTracker.close();
mServiceTracker= null;}
this.bc= null;
………
Presentation Title | Presentation Subtitle | ©2008 by «Author»; made available under the EPL v1.0
51
Developing applications using Embedded Rich Client Platform (eRCP) | ©2008 by Nokia; made available under the EPL v1.0
Working with Services
•Registering Services
�bc.registerService(classes, commonGUI, null);
�ServiceRegistrationobject
•ServiceReferences
�sref= bc.getServiceReference(CommonGUI.class.getName());
�bc.getService(sRef);
�Services may come and go
�Stale references
•Filters (Query Expressions)
•ServiceListener
•ServiceTrackersand ServiceTrackerCustomizers
Presentation Title | Presentation Subtitle | ©2008 by «Author»; made available under the EPL v1.0
52
Developing applications using Embedded Rich Client Platform (eRCP) | ©2008 by Nokia; made available under the EPL v1.0
Service Creation
// Registering the UI Manipulation service
String[] classes = new String[] {
CommonGUI.class.getName()};
commonGUI
= CommonGUIFactory.getInstance(this);
serviceReg
= bc.registerService(classes, commonGUI, null);
----------------------------------------
// Registering the Simple PIM Data Service
Hashtable
props = new Hashtable(5);
props.put("service-name", "SimpleData");
props.put("service-description", "Simple In Memory Contact
Data");
dataProvReg
= bc.registerService(
ContactOperations.class.getName(),simpleDataService,props);
Presentation Title | Presentation Subtitle | ©2008 by «Author»; made available under the EPL v1.0
53
Developing applications using Embedded Rich Client Platform (eRCP) | ©2008 by Nokia; made available under the EPL v1.0
Filters
Query Expressions
private
static
final
String CONTACT_OPERATIONS_NAME
=
ContactOperations.class.getName();
private
static
final
String FILTER
= "(" +
Constants.OBJECTCLASS
+ "=" + CONTACT_OPERATIONS_NAME
+ ")";
private static final
String FILTER =
"(&(" + Constants.OBJECTCLASS
+ "=" + MAP_SERVICE_NAME +
")(service-name=Google*))"
Presentation Title | Presentation Subtitle | ©2008 by «Author»; made available under the EPL v1.0
54
Developing applications using Embedded Rich Client Platform (eRCP) | ©2008 by Nokia; made available under the EPL v1.0
ServiceTracker& ServiceTrackerC
ustomizer
{….
sTracker= newServiceTracker(bc, bc.createFilter(FILTER), this);
sTracker.open();
..}
-----------------------------------
publicObject addingService(ServiceReferencesRef) {
cOperations= (ContactOperations) bc.getService(sRef);
// if contact operations are added dynamically refresh UI
ServiceReferencesf=
bc.getServiceReference(CommonGUI.class.getName());
if(sf!= null) {
((CommonGUI)bc.getService(sf)).reload();
bc.ungetService(sf);
} returncOperations;
}
Presentation Title | Presentation Subtitle | ©2008 by «Author»; made available under the EPL v1.0
55
Developing applications using Embedded Rich Client Platform (eRCP) | ©2008 by Nokia; made available under the EPL v1.0
ServiceListener
sL
= new ServiceListener() {
public void serviceChanged( ServiceEvent
arg0) {
ServiceReference
sref
= null;
switch(arg0.getType()) {
case (ServiceEvent.REGISTERED):
cOperations= (ContactOperations)bc.getService(
arg0.getServiceReference());
sref= bc.getServiceReference(CommonGUI.class.getName());
if (sref
!= null) {
((CommonGUI)bc.getService(sref)).reload(); // UI List reload
bc.ungetService(sref);
} break;
case (ServiceEvent.UNREGISTERING):
cOperations= null;
sref= bc.getServiceReference(CommonGUI.class.getName());
if (sref
!= null) {
((CommonGUI)bc.getService(sref)).clear(); // flush UI
bc.ungetService(sref);
}
break;
}}};
bc.addServiceListener(sL, FILTER);
Presentation Title | Presentation Subtitle | ©2008 by «Author»; made available under the EPL v1.0
56
Developing applications using Embedded Rich Client Platform (eRCP) | ©2008 by Nokia; made available under the EPL v1.0
Creating the Add-O
ns
•Looks for UI manipulation service
•Looks for other map/data services
•Publish add-on service if needed
•Add UI commands to application
•repeat..
Presentation Title | Presentation Subtitle | ©2008 by «Author»; made available under the EPL v1.0
57
Developing applications using Embedded Rich Client Platform (eRCP) | ©2008 by Nokia; made available under the EPL v1.0
Native Code integration
•Voice call add-on uses JNI
�Symbian specific aspects
•Native code using Symbian Telephony API
•DLL built using S60 SDK
•Packaged in SIS
•Manifest header: SymbianNativePackages: VoiceCall.sisx
•On-device Native install resource processor
•Permission and capability requirements
Presentation Title | Presentation Subtitle | ©2008 by «Author»; made available under the EPL v1.0
58
Developing applications using Embedded Rich Client Platform (eRCP) | ©2008 by Nokia; made available under the EPL v1.0
Dealing with startup
•Start plugins/bundles on demand
�Eclipse-LazyStart:Start when resources are accessed
•Triggering startup
�Using org.eclipse.ui.startupextension point
•Declarative Service (Service Component Runtime)
•Manipulate OSGi framework start level
•On-device
�Startup without restarting eWorkbench
�NeRCP uses preinstalled.pluginsfile
�Install handler in feature.xml
�<install-handler handler=
"org.eclipse.ercp.update.PreInstallHandler"/>
Presentation Title | Presentation Subtitle | ©2008 by «Author»; made available under the EPL v1.0
59
Developing applications using Embedded Rich Client Platform (eRCP) | ©2008 by Nokia; made available under the EPL v1.0
Deploying Application
•Features and Update Sites
•Modifications for NeRCP deployment
�install, startup order, etc.