Ajof; Example - Siemens TC45 User Manual

Cellular engine
Hide thumbs Also See for TC45:
Table of Contents

Advertisement

TC45 TC45 JAVA User's Guide
Confidential / Released

11.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.
11.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
* retrieved 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,
* <li>enter the <code>SIM PIN</code>, so we can access the phonebook and
* send an SMS message,
* <li>create a phonebook control and look up the recipient's phone number,
* <li>create an SMS control,
* <li>set the service centre address (SCA),
TC45_JAVA User's Guide_V02
= "foo, bar";
= "0000";
= "Hello, world.";
Page 70 of 72
30.06.2003

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents