Handset Wireless Synchronization Of Data With Data Storage
By: Eugene Kovshilovsky
Class: CS491B
Abstract
With the coming of the cell phone age we are facing some old problems but can provide new solutions. As most people still have difficulty getting together, planning events, and finding each other’s phone numbers, synchronizing all their contacts together and their main events such as birthdays together can be solved by putting all their contacts and events into one central location. This project is attempting to provide a method of synchronizing their contacts and events by introducing programs based on the SyncML protocol. People will be able to synchronize their cell phone, their Pocket PC, their Outlook and other devices in the near future.
I.Introduction
Initially the idea for this project was to create a system where people would be able to place a database of birthdates into their cell phone. As more information was found, the project developed more scope. It has evolved into the idea to create and/or install a SyncML server which runs on open source products and to create a client that will be able to synchronize with the server. The client being web based and/or handset (cell phone or Pocket PC) basedand connect without any wires.
II.Technological background
Java and JavaServer Pages(JSP) are the two languages being used to write the program. As Java is the main language currently used in cell phones, there was little choice. JSP was chosen because it provides a simplified, fast way to create dynamic web content. JSP technology enables rapid development of web-based applications that are server and platformindependent and complements the Java development by being translated into Java servlet before running.
SyncML is a data synchronization protocol based on XML and designed by Open Mobile Alliance. The protocol was designed to synchronize devices with security (authorization), multiple bearers (HTTP, HTTPS, and WAP), parameter/configuration management (ADD, REPLACE, and DELETE) and extensibility in mind. It also addresses resource limitations of handset devices.
SyncServer is an open source Java SyncML server maintained by Funamboland is implemented as a standard J2EE (Java 2 Enterprise Edition) application so that it can be deployed on top of any J2EE compliant application server or a standalone servlet. The server is designed so that you can use it with any SyncML client (e.g. to synchronize the address book on your phone through a pre-installed SyncML client). The server runs well on Apache Tomcat web server or on a JBOSS web server.
Apache Tomcat is a web server developed in an open source environment. It has a servlet container that is used for the Java Servlet and JavaServer Pages technologies.
III.System Architecture
The system architecture consists of server and client. The architecture of the SyncML Server is based entirely on open industry standards. The server is designed to operate a highly scalable, fault-tolerant environment tightly integrated with existing infrastructure. Because it is based exclusively on the open industry standard SyncML-DM, the server is completely client-agnostic and can update any SyncML-DM handset independently of the firmware update agent and delta management software used.
Because the server will be running on Apache Tomcat it can either be implemented on Linux or PC computer. This computer must have a connection to the internet and the firewall has to have port 8080 open if default configuration is used.
The web based client has to be placed in the apache web root directory for it to function properly. The standalone Java client has been tested on a Windows based system and is functioning but may not run properly on Linux.
Many cell phones come equipped with a SyncML client, such as the Nokia 6600 and some phones work well with the Nokia SyncML Client 2.0a such as the Nokia 3650. There are other phones on the market that also come with a SyncML client built in and a compatibility list can be found at the Open Mobile Alliance.
IV.Design and implementation details
- JAVA PC CLIENT GUI DESIGN: The menu bar will contain 4 drop-down categories. The File category will have Synchronize, Config, and Quit. The Edit menu will contain New Contact and New Calendar. The View menu will have Contact List and Calendar List and the Help menu will at this time only have the about box. There will also be 4 Buttons: New, Modify, Delete and Synchronize. When in a particular view (e. g. Calendar List) the buttons willcorrespond to that view. New will allow you to create a new record while Modify will modify the highlighted record and Delete will delete the entire record.
When Synchronize button is pushed the entire date will be synchronized with the server which is set in the configuration menu. - WEB CLIENT GUI DESIGN: The side tool bar will have a choice of contacts or calendars. For the demo Sync Manager the side bar will also contain a reset to reset all the records in the database. At the moment the tool only logs in with one user account which is set in the Java code but it can later be expanded to multiple user configurations. The main window will display the Contact List or the Calendar List. When a particular record is clicked the window will change to that record and let you modify the contents. If a new record is needed then create and new record can be pushed instead.
- POCKET PC CLIENT GUI DESIGN: The design for the handhelds only needs to have a single menu witch lets you modify the configuration such as the connection settings. The main windows needs to have a synchronize button which will synchronize the contacts and calendar in the database with the contacts and calendar in the hand held device. At this time a snapshot is unavailable.
- CODE DESIGN: Code will be designed in a modular manner and all buttons and text will be allowed to be modified without the need to modify HTML or JSP code by storing all text pertaining to the program in calendar.properties and contact.properties files.
- CODE STRUCTURE
- Sync Client API Architecture
- Sync Manager Layer is responsible for everything regarding the SyncML protocol and the data synchronization process.
- Sync Source is an application module used to interact with the application data sources. Application specific and transparent to the synchronization engine.
- When items that are exchanged between client and server, the client feeds the Sync Source with the items changed on the client side while the Sync Manager feeds it with the items received by the server.
- SyncManager Functions
- SyncManager() Constructor
- int prepareSync(SyncSource& source) Initializes a new synchronization session for the specified sync source. It returns 0 in case of success, an error code in case of error
- int sync(SyncSource& source) Synchronizes the specified source with the server. Source should be filled with the client-side modified items. At the end of the process source will be fed with the items sent by the server. It returns 0 in case of success or an error code in case of error
- int endSync(SyncSource& source) Ends the synchronization of the specified source. If source contains LUIG-GUID mapping this is sent to the server. It returns 0 in case of success or an error code in case of error
- SyncSource Functions
- setNextAnchor(char* next):Sets the next anchor associated to the source.
- char* getNextAnchor(char* next): Gets the next anchor associated to the source. If next is NULL the internal buffer address is returned, otherwise the value is copied in the given buffer and the buffer address is returned.
- setAllSyncItems(SyncItem* items[], int n):Sets all the items stored in the data source. For performance reasons, this should only be set when required (for example in case of slow or refresh sync). The items are passed to the SyncSource as an array of SyncItem objects.
- setDeletedSyncItems(SyncItem* items[], int n):Sets the items deleted after the last synchronization. The items are passed to the SyncSource as an array of SyncItem objects.
- setNewSyncItems(SyncItem* items[], int n):Sets the items created after the last synchronization. The items are passed to the SyncSource as an array of SyncItem objects.
- Other Classes
- SyncManagerFactory: This is the factory for SyncManager objects. Use its getSyncManager() method to get a new configured instance of SyncManager.
- SyncSource: The class that represents a synchronization data source. Must be filled with the client-side items before passing it to the SyncManager in order to synchronize it. After the SyncManager has finished a sync(), the SyncSource object will contain the server-side items.Items are stored as arrays of SyncItem objects.
- SyncItem:An item is represented by a SyncItem, who associates an identifying key with the item content.
- Config:This class represents the entire SyncManager configuration. It groups utility methods to easily access configuration properties.
- SyncSourceConfig:Similar to Config but for SyncSources
- When developing the sync client, the API is used as transport only. The client must first take the data stored in the device and parse, convert and modify to fit the SyncML standard. That data must then be filled into a SyncItem object. This approach would be done in a similar manner on the server side and when the data is sent back to the client the new SyncItem must be read and converted to update the data on the client.
- PROBLEMS FACED AND SOLVED:
- During the development process there were a few problems. The fist problem was faced was during the attempt to code the client in Java for my mobile phone. Unfortunately my phone does not support MIDP 2.0 API. The phone supported an earlier version MIDP 1.0 which didn’t have the required functions to access the contacts and calendar data. After the attempt I found out that most new phones that support MIDP 2.0 now actually have a SyncML client that Nokia has designed. To not develop what is already out on the market that project had to be scrapped and in turn I have moved to Pocket PC because no SyncML client exists as of yet.
- While developing the client for Pocket PC only minor problems arose such as conversion of 32bit data into 64bit data and vice versa. Also I was unable to properly execute my code at the later stages of development on the emulator because eMbedded Visual Basic would not copy all the required files into the emulator such as the images. Because of the ease of synchronization of Pocket PC with the development tools, I was not in too big of a problem during development. I was able to test my code directly on the Pocket PC.
- CAPABILITIES:
- After completing my Sync Client for Pocket PC it was capable of synchronizing contacts and calendar with the SyncML server. At the moment the SyncML server is cable of storing other data such as tasks and files. As the development continues there are plans for the client to synchronize other types of data the server supports.
- The SyncML protocol is also capable of transferring configuration data. Although auto configuration has not been implemented into the Client this can actually be done at a later time if required. By synchronizing configuration it is possible to manage multiple clients without having to modify any configuration on the client by hand.
- SERVER CONFIGUARTION:
- Set the Server URI by Editing <SYNC4J_HOME>/config/Sync4j.properties and setting server-name=
- Create a New Principal
- SyncServer associates a user and a device into a principal. Therefore if you add a new user or a new device you need to create a new principal, otherwise SyncServer will not allow that user to synchronize.
- The device id is specified by the phone in its “Source” field inside the SyncML message and isrepresented by the phone's IMEI (International Mobile Equipment Identity) code (e.g.:IMEI:351111103384988). This code can be found on the phone's box label, under the phone'sbattery or pressing *#06# on the phone keyboard.
- When you have the serial number, you can add a new device and principal: start the Sync4jSyncServer administration tool and add the device selecting Add Device from the context menuthen, add the new principal selecting Add Principal from the context menu andassociating the newly created device with the user guest.
- GENERIC CLIENT CONFIGURATION
- The information you need to know at the client side to synchronize with SyncServer contact and calendar items are the following:
Url:
User: <username>
Password: <password>
Remote Address Book: ./contact
Remote Calendar: ./calendar - If the client allows you to set the target URI, set it to the value of the server.uri property in <SYNC4J_HOME>/config/Sync4j.properties.
- NOKIA 7650 SYNCML CONFIGURATION:
- Create a Bookmark pointed to Remote Sync software: from the Main menu select Services then select Options > Add bookmark and enter the following url:
- Select your default Access Point. Save bookmark. Download Remote Sync software. Activate the bookmark by pressing the joystick middle button. Wait until you get the 'InstallSync?'message. Select Yes.
Move the selection to the Sync application and press the joystick.Click on Options and create a new sync profile. Insert thefollowing information:
Name: Sync4j
Transport: Internet
Access Point: choose your internet access point
Host Address: <yourhost>/sync4j/sync
Port: <yourport> (eg: 8080)
User: guest
Password: guest / Calendar: Yes
Remote Calendar: calendar
Address Book: Yes
Remote Address Book: contact
HTTP Authentication: No
HTTP User: <empty>
HTTP Password: <empty>
- Press Back when finished.
- Select the newly created profile and click the Select button, thenselect Synchronize. Depending on your phone settings, you willbe prompted to make a connection. Press OK.
V.Conclusion and future work
I have come to the conclusion that this project isa work in progress. With the use of SyncML there was hope that writing a client for any device would be simple. Unfortunately the older devices provide too much of a constraint making it almost impossible to write a useful synchronization tool based on the SyncML protocol. If development needs to continue in that direction then the project requires many man hours for the project and to stay competitive it would require many people to get the job done quick. Future work will include making upgrades to the server, the web client and the Java client to make the data independent from user to user. The work may include integration of device management whereby the client configuration would be done by sending a command to the device, making synchronization seamless.The web client also need more development to setup a secure login and maybe more features such as file synchronization in Briefcase. Although it may require many development hours for legacy devices, it is highly recommended to write new clients for new devices if no client has been developed yet. Through the use of the SyncML protocol and framework the development can be enhanced.
References
Appendix
TOOLS USED:
- JBuilderX Java compiler
- Nokia Developer’s Suit 2.2
- Nokia S40 DP SDK 1.0
- J2EE SDK 1.0
- J2ME Wireless Toolkit
- Apache Tomcat 5.0
- Sync4j SyncML server 2.1 Stable Release
SERVER INSTALLATION:
- Install the JDK 1.4.x if not already present.
- Install Tomcat 5.0.x if not already present.
- Unpack syncserver-4.0.x.zip in a directory of your choice. We will refer to that directory asSYNC4J_HOME.
- Set up your database so that it can be accessed with a dedicated user (e.g. sync4j). This userneeds to be granted permissions for connection, creating, deleting and selecting tables.
- Customize install.properties to reflect your system.
- On unix systems, give execution permission to the executable scripts in bin and ant/bin. Use the command (from SYNC4J_HOME):chmod +x bin/*.sh ant/bin/*
- Make sure that the environment variables JAVA_HOME and J2EE_HOME point respectivelyto your JDK/JRE home and to your Tomcat home
- From SYNC4J_HOME, run:bin/install.sh tomcat (bin\install.cmd tomcat)
- You will be asked if you want to create the database for SyncServer and some SyncServermodules. Respond yes ('y') to all questions.
- Start SyncServer: from SYNC4J_HOME run:
- bin/start.sh (bin\start.cmd)
- Point the browser to to check that SyncServer is properlyinstalled (you should get the welcome page).