TC65 JAVA User's Guide
Strictly confidential / Draft
13.3
AJOF
The following example uses AJOF. It demonstrates how the writing of an application for the
module is abstracted and simplified with the framework. This example does not use threads
but could be implemented in a structure similar to the one shown above.
Some comments:
• CWmMIDlet is the MIDlet instance wrapping the application. CWmMIDlet adds AT
command channel management to the standard MIDlet class.
• An AT channel, ATChannel, consists of an ATC parser and one or more listeners waiting
for URCs. The channel is distributed by the application to any class that needs access to
the module via the ATC interface.
13.3.1
Example
/* WmTutorial.java
* Copyright (C) Siemens AG 2003. All Rights reserved.
* Transmittal, reproduction and/or dissemination of this document
* as well as utilization of its contents and communication thereof
* to others without express authorization are prohibited.
* Offenders will be held liable for payment of damages.
* All rights created by patent grant or registration of a utility
* model or design patent are reserved.
*/
package example.ajoftutorial;
import com.siemens.icm.io.ATCommandFailedException;
import com.siemens.icm.ajof.WmMIDlet;
import com.siemens.icm.ajof.AtChannel;
import com.siemens.icm.ajof.AtChannel.SendTimeoutException;
import com.siemens.icm.ajof.AjofException;
import com.siemens.icm.ajof.status.WmLock;
import com.siemens.icm.ajof.status.WmLockException;
import com.siemens.icm.ajof.phonebook.SimplePhonebook;
import com.siemens.icm.ajof.phonebook.PhonebookStoreException;
import com.siemens.icm.ajof.sms.SimpleSms;
import com.siemens.icm.ajof.sms.SmsSendException;
/**
* demonstrates how easy it is to retrieve a number from the phonebook and
send an SMS message to this destination.
* @author SIEMENS AG
* @version 1
* @since AJOF 1.0
*/
public class WmTutorial extends WmMIDlet
{
// Please, change these constants to your desired settings
final String RECIPIENT_NAME
final String SERVICE_CENTRE_ADDR = "+491720000000";
final String SIM_PIN
final String MESSAGE_TXT
/**
* creates and sends an SMS message to a recipient, whose phone number
is retreived from the SIM phonebook.
* <ol><li>get an AT channel to communicate with the module's AT
interface
* <li>just check, if the module answers to AT commands,
TC65 JAVA User's Guide_V01
= "foo, bar";
= "0000";
= "Hello, world.";
Page 63 of 69
s
11.03.2005