Siemens AC65 Manuel D’Utilisation

Page de 123
Java User’s Guide
13.1 Using the AT Command API
122
s
wm_java_usersguide_v12
Page 119 of 123
2008-02-25
Confidential / Released
13.1.3.2
Implementation
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) {
    /* take some action when the DCD signal changes if you want to */
  }
  public void DSRChanged(boolean SignalState {}
    /* take some action when the DSR signal changes if you want to */
  }
  public void CONNChanged(boolean SignalState {}
    /* take some action when the state of a connection changes if you want
    to */
  }
}