Siemens TC65 manual ATCommandListener Interface, ATEvents, Implementation

Models: TC65

1 90
Download 90 pages 14.61 Kb
Page 86
Image 86

TC65 JAVA User's Guide

Strictly confidential / Released

s

12.1.3ATCommandListener Interface

The ATCommandListener interface implements callback functions for:

URCs

Changes of the serial interface signals RING, DCD and DSR

Opening and closing of data connections

The user must create an implementation class for ATCommandListener to receive AT events. The ATEvent method of this class must contain the processing code for the different AT-Events (URCs). The RINGChanged, DCDChanged, DSRChanged and CONNChanged methods should contain the processing code for possible state changes.

12.1.3.1ATEvents

An ATEvent or a URC is a report message sent from the module to the application. An unsolicited result code is either delivered automatically when an event occurs or as a result of a query the module previously received. However, a URC is not issued as a direct response to an executed AT command. Some URCs must be activated with an AT command.

Typical URCs may be information about incoming calls, a received SM, temperature changes, the status of the battery, etc. A summary of URCs is listed in the AT Command Set document [3].

12.1.3.2Implementation

class ATListenerA implements ATCommandListener {

public void ATEvent(String Event) {

if (Event.indexOf("+CALA: Reminder 1") >= 0) {

/* take desired action after receiving the reminder */

}else if (Event.indexOf("+CALA: Reminder 2") >= 0) { /* take desired action after receiving the reminder */

}else if (Event.indexOf("+CALA: Reminder 3") >= 0) { /* take desired action after receiving the reminder */

}

/* No action taken for these events */

public void RINGChanged(boolean SignalState) {} public void DCDChanged(boolean SignalState) {} public void DSRChanged(boolean SignalState) {}

}

class ATListenerB implements ATCommandListener {

public void ATEvent(String Event) {

if (Event.indexOf("+SCKS: 0") >= 0) { System.out.println("SIM Card is not inserted."); /* perform other actions */

}else if (Event.indexOf("+SCKS: 1") >= 0) { System.out.println("SIM Card is inserted.");

/* perform other actions */

}

}

public void RINGChanged(boolean SignalState) {

/* take some action when the RING signal changes if you want to */

}

public void DCDChanged(boolean SignalState) {

TC65 JAVA User's Guide_V05

Page 86 of 90

26.09.2005

Page 86
Image 86
Siemens TC65 manual ATCommandListener Interface, ATEvents, Implementation