The MIDlet will start with a screen to define the event and send it. In this screen the user can set the destination number, the topic of the event, the start date/time, and the duration in minutes. It is also possible to look up the destination number in the contact list by using the "Find Contacts" menu item. This will display a list of contact names and phone number(s). Once a message is sent, the event is inserted in the local database.
The MIDlet will establish itself by listening for incoming messages on a given SMS port (6553). When a message is received, a new screen will pop up, the message will be decoded, and the event will be displayed on the screen. At that moment, the recipient can accept the insertion of new data to the calendar.
The MIDlet also registers itself in the PushRegistry
waiting
for incoming messages in the given SMS port. This registration is done statically
using a MIDlet-Push entry in the JAD file.
All operations that are related to reading or writing the PIM databases are done in a separate thread to avoid deadlocks with the UI thread.
The figure below presents a simplified class diagram of the Event Sharing MIDlet application.
The example includes the following classes:
This is the main class of the MIDlet; it contains the initialization of the MIDlet and the handling of transitions between different screens.
This class implements a form that contains the functionality to create an event and send it to another device.
This class implements a form that is activated when an incoming message is received and handles decoding the incoming message.
This class displays a list of contacts with their phone numbers so that the user can select to whom to send the event.
ErrorScreen
is a simple class used for reporting
errors to the end user.
This class creates a queue of operations that are executed in a separate thread.
This class defines the Operation
interface used
by OperationsQueue
.
The following three figures present some of the screens of the application.