programming for the dell axim x50 - florida gulf coast...

14
Dell Axim x50: Programming William Tucker 1 Programming for the Dell Axim x50 William Tucker – Compilation from Previous Reports with Examples Abstract The objective of this report is to help those who are beginning to use the Dell Axim x50 or x50v for programming mobile applications. It includes step by step instructions along with illustrations of installing java virtual machines, creating entry level java programs (standard and client/server), and mobile data acquisition information. By the end of this report, one should have a clear understanding of how to utilize the functionalities of this mobile device for their own Java based application solutions. Section 1. Introduction Programming for PDA’s and other mobile devices is becoming more and more necessary as technologies and networks become mobile as well. This guide contains the necessary steps to begin programming in the mobile world, specifically, for the Dell Axim x50. This guide focuses on a fully functional Java implementation due to Java’s portability and large API library. However, one should not have trouble finding resources on another programming language. Two virtual machines will be focused on, Mysaifu JVM and CrEme JVM. Note that only specific JVM’s can run on specific mobile operating systems, and therefore one must choose a virtual machine that is compatible with the mobile devices chipset and operating system. A list of compatibilities can be found at the following site: http://www.comp.lancs.ac.uk/computing/users/fittond/ppcjava.html Section 2. Installing the Virtual Machine Section 2.1. Mysaifu JVM The Mysaifu JVM is a Java Virtual Machine (JVM) with full API libraries from the Java 2.0 Standard Edition (J2SE). It is this robustness that makes this JVM preferred for complex mobile programs, such as multithreaded or graphic intensive applications. Mysaifu JVM will run on Windows Mobile 5.0 or Windows Mobile 2003 distributions, and is fairly easy to install. Just follow these steps: Step 1: Obtain a copy of the JVM’s code at (.zip format): http://www2s.biglobe.ne.jp/~dat/java/project/jvm/index_en.html Step 2:

Upload: others

Post on 24-Jul-2020

4 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Programming for the Dell Axim x50 - Florida Gulf Coast ...itech.fgcu.edu/faculty/zalewski/cen3213/files/pdaprogramdevv2.pdfCrEme JVM is special in that it employs Java 2.0 Mobile Edition

Dell Axim x50: Programming William Tucker

1

Programming for the Dell Axim x50 William Tucker – Compilation from Previous Reports with Examples Abstract The objective of this report is to help those who are beginning to use the Dell Axim x50 or x50v for programming mobile applications. It includes step by step instructions along with illustrations of installing java virtual machines, creating entry level java programs (standard and client/server), and mobile data acquisition information. By the end of this report, one should have a clear understanding of how to utilize the functionalities of this mobile device for their own Java based application solutions. Section 1. Introduction Programming for PDA’s and other mobile devices is becoming more and more necessary as technologies and networks become mobile as well. This guide contains the necessary steps to begin programming in the mobile world, specifically, for the Dell Axim x50. This guide focuses on a fully functional Java implementation due to Java’s portability and large API library. However, one should not have trouble finding resources on another programming language. Two virtual machines will be focused on, Mysaifu JVM and CrEme JVM. Note that only specific JVM’s can run on specific mobile operating systems, and therefore one must choose a virtual machine that is compatible with the mobile devices chipset and operating system. A list of compatibilities can be found at the following site: http://www.comp.lancs.ac.uk/computing/users/fittond/ppcjava.html Section 2. Installing the Virtual Machine Section 2.1. Mysaifu JVM The Mysaifu JVM is a Java Virtual Machine (JVM) with full API libraries from the Java 2.0 Standard Edition (J2SE). It is this robustness that makes this JVM preferred for complex mobile programs, such as multithreaded or graphic intensive applications. Mysaifu JVM will run on Windows Mobile 5.0 or Windows Mobile 2003 distributions, and is fairly easy to install. Just follow these steps: Step 1: Obtain a copy of the JVM’s code at (.zip format): http://www2s.biglobe.ne.jp/~dat/java/project/jvm/index_en.html Step 2:

Page 2: Programming for the Dell Axim x50 - Florida Gulf Coast ...itech.fgcu.edu/faculty/zalewski/cen3213/files/pdaprogramdevv2.pdfCrEme JVM is special in that it employs Java 2.0 Mobile Edition

Dell Axim x50: Programming William Tucker

2

Unzip the file to a user-specified folder. Using Microsoft Activesync software (packaged with the Dell Axim x50 or downloadable from the Microsoft website), transfer the CAB file to the ‘My Documents’ folder on the PDA.

Figure 2.1. Transfer of CAB File to My Documents Folder on PDA

Step 3: Using the PDA’s file explorer, navigate to the ‘My Documents’ folder (or whichever folder the file was transferred to on the PDA) and execute the jvm.ARM file by clicking on it. The file will run and install itself. Section 2.2. CrEme JVM CrEme JVM is special in that it employs Java 2.0 Mobile Edition (J2ME) apposed to Java 2.0 Standard Edition. This lighter edition of the portable Java language offers less overhead for mobile devices, and only includes key API libraries. It should be noted that J2ME lacks some of the advanced functionality and programming ease that is offered by the standard edition of Java 2.0. On a positive note, CrEme is better supported and integrated with the Windows-CE computing environment. CrEme is available for most Windows-CE mobile operating systems, and can be installed by following these steps: Step 1: Download and Purchase (or evaluate) the CrEme JVM from www.nsicom.com Step 2:

Page 3: Programming for the Dell Axim x50 - Florida Gulf Coast ...itech.fgcu.edu/faculty/zalewski/cen3213/files/pdaprogramdevv2.pdfCrEme JVM is special in that it employs Java 2.0 Mobile Edition

Dell Axim x50: Programming William Tucker

3

Follow the onscreen instructions. Microsoft Activesync or an equivalent transfer program will likely be needed. Section 3. Program Compilation and Initialization Section 3.1. Mysaifu JVM Mysaifu JVM is not capable of compilation, so the files must be written and compiled on the desktop machine. The virtual machine uses Java 2.0 Standard Edition, and can run class files that have been transferred to it via Microsoft Activesync. The files can be transferred to the root Mobile Device drive using the following steps: Step 1: Under Windows XP file explorer with the PDA connected and ActiveSync running, open up ‘My Computer’. Step 2: There should be a drive labeled ‘Mobile Device.’ Open this drive up, and copy the class files there using Windows Explorer copy and paste commands. ** One thing to note: ActiveSync will always give a warning message that some data may be lost in file conversions to the PDA. This warning seems to be a false positive. **

Figure 2.2. Transfer of Class Files to the PDA Explorer

Page 4: Programming for the Dell Axim x50 - Florida Gulf Coast ...itech.fgcu.edu/faculty/zalewski/cen3213/files/pdaprogramdevv2.pdfCrEme JVM is special in that it employs Java 2.0 Mobile Edition

Dell Axim x50: Programming William Tucker

4

Step 3: Once the class files are copied to the PDA, all that is left to be done is to run the virtual machine. Mysaifu JVM will be in the programs list under the start menu.

Figure 3.1. Mysaifu Program Screen

Step 4: Once the program opens up, type the name of the class file in the “Class name” field, without any file extension. Step 5: Press the execute button, and the code will run. To view the command line, press the “Show Console” button. Section 3.2. CrEme JVM Note that while Mysaifu required the class file from the Java 2.0 Standard Edition, CrEme takes a different approach that does not require a JVM program to be loaded for execution. CrEme allows the program files to be run directly on the PDA via the use of executable JAR files. Executable JAR files contain information for running the Java program within the JVM without first loading the virtual machine. All that needs to be done is a JAR file created on the desktop machine, and then transferred to the PDA mobile device via Microsoft Activesync or an equivalent, and then the JAR file can be run as any other mobile program. To create an executable JAR file, follow these steps: Step 1:

Page 5: Programming for the Dell Axim x50 - Florida Gulf Coast ...itech.fgcu.edu/faculty/zalewski/cen3213/files/pdaprogramdevv2.pdfCrEme JVM is special in that it employs Java 2.0 Mobile Edition

Dell Axim x50: Programming William Tucker

5

You need a simple text file containing two and only two lines in it. This is your Manifest file. The first line should be “Main-Class: ClassWithMain” where ClassWithMain is the name of the Java file containing your “main” method. The second line is empty. Step 2: Move your Java files and your Manifest file into a separate directory by themselves. Step 3: Using the command line interface, execute the command “jar –cmf Manifest.txt App.jar *.java” where Manifest.txt is the name of your Manifest file and App.jar is the name you want your new executable JAR file to be. You should have a new file in that directory named App.jar. Step 4: Copy this file to the PDA mobile device and click on it for execution. Section 4. Examples and Application Section 4.1. Standard Hello World Example Using the steps outline above, we can illustrate how one runs a standard Java program on the mobile device. First, we write our HelloWorld example program. It is important that we implement this example graphically, as command line interaction is quite awkward on the PDA.

Figure 4.1. Standard HelloWorld Code (HelloWorld.java)

// HelloWorld.java // Author: William Tucker import java.awt.*; import java.awt.event.*; class HelloWorld { // variables to handle display TextArea sysMsg; public HelloWorld() { display(); //GUI //Writes Hello World to the TextArea sysMsg.append("Hello World!"); } public static void main(String args[]) { HelloWorld hello = new HelloWorld(); }

Page 6: Programming for the Dell Axim x50 - Florida Gulf Coast ...itech.fgcu.edu/faculty/zalewski/cen3213/files/pdaprogramdevv2.pdfCrEme JVM is special in that it employs Java 2.0 Mobile Edition

Dell Axim x50: Programming William Tucker

6

// method that handles initial display to screen public void display() { Frame f = new Frame(); f.setVisible(false); f.setLayout(new BorderLayout()); Panel p = new Panel(); p.setLayout(new BorderLayout()); p.add(new Label("Hello World Example")); f.add("North", p); Panel q = new Panel(); q.setLayout(new BorderLayout()); sysMsg = new TextArea(); q.add(sysMsg); f.add("Center", q); f.setSize(500,500); f.setVisible(true); f.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); } // close display method } // close HelloWorld class // EOF

Save this file as ‘HelloWorld.java’. Compile this Java file with the command ‘javac HelloWorld.java’ in the command line of the same directory. Using the Windows explorer, navigate to the PDA directory and transfer this .class file to the PDA using Activesync.

Figure 4.2. HelloWorld Standard Running on Desktop

Page 7: Programming for the Dell Axim x50 - Florida Gulf Coast ...itech.fgcu.edu/faculty/zalewski/cen3213/files/pdaprogramdevv2.pdfCrEme JVM is special in that it employs Java 2.0 Mobile Edition

Dell Axim x50: Programming William Tucker

7

On the PDA, open the MySaifu program. You will be greeted with a screen much like that of Figure 3.1. Type the class name in if it is not already within the drop down box of the class name field. Once done, press ‘Execute’. A window should display showing ‘HelloWorld!’. Close the window to finish the demonstration. Section 4.2. Client/Server Hello World Example A great feature of the MySaifu JVM is its interoperability with all of the standard Java API functions. This makes complex functions, such as networking, a breeze as demonstrated in the following example:

Figure 4.3. Hello World Client Code (HelloClient.java)

// HelloClient.java // // Author: William Tucker import java.awt.*; import java.awt.event.*; import java.io.*; import java.net.*; class HelloClient { // variables to handle display TextArea sysMsg; public HelloClient() { display(); //GUI connectToServer(); //Connectivity } public static void main(String args[]) { HelloClient hello = new HelloClient(); } // method that handles initial display to screen public void display() { Frame f = new Frame(); f.setVisible(false); f.setLayout(new BorderLayout()); Panel p = new Panel(); p.setLayout(new BorderLayout()); p.add(new Label("Hello World Example")); f.add("North", p);

Page 8: Programming for the Dell Axim x50 - Florida Gulf Coast ...itech.fgcu.edu/faculty/zalewski/cen3213/files/pdaprogramdevv2.pdfCrEme JVM is special in that it employs Java 2.0 Mobile Edition

Dell Axim x50: Programming William Tucker

8

Panel q = new Panel(); q.setLayout(new BorderLayout()); sysMsg = new TextArea(); q.add(sysMsg); f.add("Center", q); f.setSize(500,500); f.setVisible(true); f.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); } // close display method // method to connect to the server public void connectToServer() { Socket s = null; try { s = new Socket("satnet.fgcu.edu", 1101); DataInputStream fromServer = new DataInputStream(s.getInputStream()); PrintStream toServer = new PrintStream(s.getOutputStream()); //Verification of Connectivity System.out.println("Connected to server!\n"); sysMsg.append("Connected to server!\n"); String msg = fromServer.readLine(); System.out.println(msg + "\n"); sysMsg.append(msg + "\n"); } catch (UnknownHostException e) { sysMsg.append("Unknown Error!\n"); } catch (IOException e2) { sysMsg.append("IO Exception!\n"); } } // close connectToServer method } // close HelloClient class // EOF

Page 9: Programming for the Dell Axim x50 - Florida Gulf Coast ...itech.fgcu.edu/faculty/zalewski/cen3213/files/pdaprogramdevv2.pdfCrEme JVM is special in that it employs Java 2.0 Mobile Edition

Dell Axim x50: Programming William Tucker

9

Figure 4.4. Hello World Server Code (HelloServer.java)

// HelloServer.java // // Author: William Tucker // Description: Sends 'Hello World!' to connecting clients. import java.io.*; import java.net.*; // the main class only creates the server sockets, listens and // accepts new connections, and then sends the message to the client public class HelloServer extends Thread { ServerSocket listen_socket; public static void main(String[] args) { new HelloServer(); } HelloServer() { // create the server socket and start the thread try{ listen_socket = new ServerSocket(1101); this.start(); } catch(IOException e) { System.out.println("Error creating server socket.\n"); } } // close constructor // now loop forever, listening for new clients, and sending 'HelloWord!' public void run() { try { System.out.println("\nServer listening on port number 1100.\n"); while(true) { Socket HelloClient = listen_socket.accept(); System.out.println("Client accepted.\n"); DataInputStream fromClient = new DataInputStream(HelloClient.getInputStream()); PrintStream toClient = new PrintStream(HelloClient.getOutputStream()); toClient.println("Hello World!"); } // close while } catch(IOException e) { System.out.println("Error while listening for connections.\n"); } } // close run method } // close HelloServer class // EOF

Page 10: Programming for the Dell Axim x50 - Florida Gulf Coast ...itech.fgcu.edu/faculty/zalewski/cen3213/files/pdaprogramdevv2.pdfCrEme JVM is special in that it employs Java 2.0 Mobile Edition

Dell Axim x50: Programming William Tucker

10

Essentially, all that is happening here is very simple connectivity and data passing. First, our server must be running on a specific machine (in this case satnet.fgcu.edu on port 1101). The server is in an infinite loop, and will accept as many clients as it can within its operating capacity and reply to them with ‘Hello World!’. The clients then write this phrase that is sent to them in a TextArea within the PDA screen, not much unlike our original example of Standard Hello World.

Figure 4.5. GameSuite Server Interface and Runtime Screen

We follow the exact same steps as we did for our first example to run the client on the PDA. The server must be run using the ‘java HelloServer’ command on the satnet server, or another respective server. Note however, that is a different hostname is used for the server, the client code must be changed so that it may know where to look for a connection.

Figure 4.6. HelloClient Running on Desktop with Server in Background

Page 11: Programming for the Dell Axim x50 - Florida Gulf Coast ...itech.fgcu.edu/faculty/zalewski/cen3213/files/pdaprogramdevv2.pdfCrEme JVM is special in that it employs Java 2.0 Mobile Edition

Dell Axim x50: Programming William Tucker

11

Section 4.3. Real-world Application of Mobile Platform Development In the fall of 2005, a colleague and I developed a mobile client/server application entitled GameSuite. GameSuite’s server component resided on the satnet server, and would essentially listen and wait for client connections, pairing every two clients that connected to it. This pairing was accomplished with two input and two output streams, both of which were passed to each other via a spawned thread of the server application. In this fashion, a theoretical infinite number of clients could connect with no knowledge of each others location – only the knowledge of the server’s location. The end goal of this project was to use this architecture to allow fast paced connectivity and initialization of PDA games that we were creating. For this specific project, we started with the game of BlackJack, where two clients could connect and play. We left the project quite open for new development, and adding games is quite trivial once the game has been programmed. The code and user development process for GameSuite can be found in the final project report. [5]

Figure 4.7. Physical Topology of the GameSuite Project

Section 4.4. Real-world Application of Mobile Device Use In the spring of 2006, colleagues and I worked on developing a mobile data acquisition solution for remote clients in an inhospitable environment. For this reason, we chose a compact data acquisition solution involving the Dell Axim x50. Although we did not

Page 12: Programming for the Dell Axim x50 - Florida Gulf Coast ...itech.fgcu.edu/faculty/zalewski/cen3213/files/pdaprogramdevv2.pdfCrEme JVM is special in that it employs Java 2.0 Mobile Edition

Dell Axim x50: Programming William Tucker

12

develop a fully functional product, we were able to outline the procedure for undertaking such a project and the necessary steps for mobile data acquisition. Below is a brief summary and procedural instructions. [6]

Figure 4.8. EWEPS PDA DAQ Application Example With the current need for more convenient computing methods, and the growing rate of data acquisition, PDA based data acquisition monitoring and control is becoming an ever present area of study. This guide introduces the creation of PDA data acquisition applications with LabVIEW, a well know and accepted data acquisition software. Using the LabVIEW PDA module, one can utilize the power of LabVIEW on a handheld device. [7] Below are the steps to install and set up the LabVIEW PDA Module. For this example, I used LabVIEW v7.1, and am assuming the user is running a relatively new version of the LabVIEW software. Installing the LabVIEW PDA Module: Step 1: Install PDA Device Software For Pocket PC 2003 devices, one will need to acquire the Microsoft ActiveSync software. The latest version of Microsoft ActiveSync is 3.8, and can be found at the Microsoft Download Center: http://www.microsoft.com/downloads/search.aspx?displaylang=en For Palm OS devices, one will need to acquire HotSync and Palm Desktop. Currently, the software can be downloaded from: http://www.palm.com/us/support/palmdesktop.html

Page 13: Programming for the Dell Axim x50 - Florida Gulf Coast ...itech.fgcu.edu/faculty/zalewski/cen3213/files/pdaprogramdevv2.pdfCrEme JVM is special in that it employs Java 2.0 Mobile Edition

Dell Axim x50: Programming William Tucker

13

Step 2: Installing Emulation and Support Software There are a few more pieces or support and emulation software needed for those using Pocket PC 2003 devices: eMbedded Visual C++ 4.0: http://www.microsoft.com/downloads/details.aspx?familyid=1DACDB3D-50D1-41B2-A107-FA75AE960856&displaylang=en eMbedded Visual C++ 4.0 SP3: http://www.microsoft.com/downloads/details.aspx?familyid=5bb36f3e-5b3d-419a-9610-2fe53815ae3b&displaylang=en SDK for Windows Mobile 2003-based Pocket PCs http://www.microsoft.com/downloads/details.aspx?familyid=9996b314-0364-4623-9ede-0b5fbb133652&displaylang=en Step 3: Installing and Activating the LabVIEW PDA Module Install the PDA Module included with the LabVIEW installation disks. Once installed, run the NI License Manager. Until one registers the PDA Module, one will not be able to build PDA executables. One will need the license given with the LabVIEW software in order to activate the PDA Module. Step 4: Running and Configuring the LabVIEW PDA Module Run the LabVIEW software. Once the main menu is loaded, one should see a list box in the bottom right corner. This list box contains the ‘Execution Target.’ When one runs the PDA virtual instruments, they will be run on this execution target. If one has followed the above steps, the following options will be available:

• LabVIEW for Windows • POCKET PC 2003 Device • POCKET PC 2003 Emulator

Other options may be available based on one’s configuration. For this example, I used the POCKET PC 2003 Device execution target. This allows for real time compilation and execution of LabVIEW programs on the PDA, without the hassle of transporting executables. Step 5: Building PDA Applications Note: If one is not familiar with building LabVIEW applications, one can simply open a PDA application example. Simply go to Open > Examples. Explore the ‘Toolkits and Modules’ folder, and then the ‘PDA’ subfolder. Once your PDA application is ready to be ported over for portable used, simply go to the Tools menu, and select ‘Build for PDA…’. If this option is not available, the one needs to activate the PDA Module, as shown in Step 3.

Page 14: Programming for the Dell Axim x50 - Florida Gulf Coast ...itech.fgcu.edu/faculty/zalewski/cen3213/files/pdaprogramdevv2.pdfCrEme JVM is special in that it employs Java 2.0 Mobile Edition

Dell Axim x50: Programming William Tucker

14

Specify the Destination Directory, and a Pocket PC 2003 executable will be created. Simply transfer this executable to your portable device for use. Section 5. Summary In summary, we have covered installation, compilation, and initialization of two Java editions (J2SE and J2ME) for the Dell Axim x50. These virtual machines are not limited to this mobile device, but are compatible with both the chipset and the operating system. We also illustrated these concepts in practice in Section 4, where it was shown the PDA application development and use is extremely useful when the scenario calls for it. Both virtual machines require that some type of file transfer hardware and software exist for the mobile device, such as Microsoft Activesync. Mysaifu JVM requires the class files from Java 2.0 Standard Edition, whereas CrEme JVM requires an executable JAR file. Overall, the Mysaifu JVM offers more complex programs access to the PDA, whereas the CrEme JVM allows easier access and integration to the Microsoft Windows-CE environment. It is important to remember that the Mysaifu JVM incorporates the Java 2.0 Standard Edition along with its full API libraries, whereas the CrEme JVM incorporates Java 2.0 Mobile Edition, and is somewhat limited in its programming ease. Section 5.2. References [1] Mysaifu Java Virtual Machine Information and Images: http://www2s.biglobe.ne.jp/~dat/java/project/jvm/index_en.html [2] NSIcom’s CrEme Information http://www.nsicom.com [3] Mobile Operating System and Virtual Machine Compatibilities Information http://www.comp.lancs.ac.uk/computing/users/fittond/ppcjava.html [4] Microsoft Activesync Information and Download http://www.microsoft.com/downloads [5] GameSuite v1.0: Requirements, Design, and Implementation. Tucker, William.

Maxwell, Jeremy. Fall 2005. [6] EWEPS: Early Warning Environmental Protection Systems. Clem, Grant. Maxwell,

Jeremy. Parra Jr., Marco. Tucker, William. Zalewski, Janusz. Spring 2006. [7] Building PDA DAQ Applications with LabVIEW. Tucker, William. Spring 2006.