--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htdocs/summerofcode/mel/RoutingSMS/server/CellPhoneMidlet.java Sun Aug 28 21:04:54 2005 -0400
@@ -0,0 +1,142 @@
+import javax.microedition.lcdui.*; +import javax.microedition.midlet.*; +public class CellPhoneMIDlet extends MIDlet implements CommandListener + * menulist, main menu List object. + * elements, String elements of the menu. + private String[] elements; + * server, Server object is created if this MIDlet is launced as Server. + * UUIDString, Service record UUID that is used in this example application. + * Both Client and Server retrives this UUID string from this MIDlet class. + public static final String UUIDString = "11223344556677889900aabbccddeeff"; + * Constructor. Initialize main menu; + public CellPhoneMIDlet() + elements = new String[3]; + elements[0] = "Start Application"; + menulist = new List(title, List.IMPLICIT, elements, null); + menulist.setCommandListener(this); + * startApp Shows main menu + * @throws MIDletStateChangeException + protected void startApp() + throws MIDletStateChangeException + protected void pauseApp() + * destroyApp. Ensures that connections have been closed. + protected void destroyApp(boolean p1) + server.applicationClosed = true; + server.closeConnection(); + * commandAction. Handles main menu command events. + public void commandAction(Command c, Displayable d) + int index = menulist.getSelectedIndex(); + * quitApp. Called when application is closed. + * showMenu. Shows main menu list. + Display.getDisplay(this).setCurrent(menulist); + * showAbout. Shows About dialog. + public void showAbout() + AboutForm aboutForm = new AboutForm("About SMS Routing over BT Link", this); + Display.getDisplay(this).setCurrent(aboutForm); + * startServer. Starts bluetooth server thread. + private void startServer() + server = new Server(this);