Siemens TC65 JAVA User Manual page 64

Cellular
Hide thumbs Also See for TC65 JAVA:
Table of Contents

Advertisement

TC65 JAVA User's Guide
Strictly confidential / Draft
* <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),
* <li>last, but not least send the SMS message.
* <li>Please do not forget to cleanup all used resources. Each AJOF
class has a method <code>release()</code>,
* which performs this task.
* <li>Terminate the application by calling
<code>notifyDestroyed()</code>.</ol>
* @see <code>AT</code>
* @see <code>AT+CPIN</code>
* @see <code>AT+CPBR</code>
* @see <code>AT+CPMGF</code>
* @see <code>AT+CPMGS</code>
*/
public void startApp()
{
try
{
// To access the module we need an AT-channel:
AtChannel atch = openAtChannel();
// Test the connection
// (this code is optional and used only for demonstration
purposes)
System.out.println("\nTesting connection...");
String response = atch.send("at\r");
System.out.println("AT" + response);
// Set elaborated error messages
atch.send("AT+CMEE=2\r");
// Enter the SIM PIN
System.out.println("Entering PIN...");
WmLock lockControl = new WmLock(atch);
try
{
lockControl.sendSimPin(SIM_PIN);
// We create a SimplePhonebook instance
// to look into the module's phonebook.
SimplePhonebook pbk= new SimplePhonebook(atch);
try
{
RECIPIENT_NAME + ", please wait...");
application
TC65 JAVA User's Guide_V01
// Now let's look for the SMS's recipient.
// The number is stored in the phonebook.
System.out.println("Looking up phone number for " +
String destinationAddr = pbk.getNumber(RECIPIENT_NAME);
// create a simple SMS control
SimpleSms sms = new SimpleSms(atch);
try
{
// You need to set the SCA only once in your
sms.setServiceCentreAddr(SERVICE_CENTRE_ADDR);
// now send the message
Page 64 of 69
s
11.03.2005

Advertisement

Table of Contents
loading

Table of Contents