Tc45_Java User's Guide_V02 - Siemens TC45 User Manual

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

Advertisement

TC45 TC45 JAVA User's Guide
Confidential / Released
* <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("atC + 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 CSimplePhonebook instance
// to look into the module's phonebook.
SimplePhonebook pbk = new SimplePhonebook(atch);
try
{
}

TC45_JAVA User's Guide_V02

// 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 application
sms.setServiceCentreAddr(SERVICE_CENTRE_ADDR);
// now send the message
System.out.println("Sending Short Message, please wait...");
sms.send(destinationAddr, MESSAGE_TXT);
System.out.println("Short Message was sent.");
}
catch (SmsSendException e)
{
System.out.println(e);
}
finally
{
// release the used resources
sms.release();
sms = null;
}
Page 71 of 72
RECIPIENT_NAME + ", please wait...");
30.06.2003

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents