![Siemens TC45 Скачать руководство пользователя страница 67](http://html.mh-extra.com/html/siemens/tc45/tc45_user-manual_375438067.webp)
TC45 TC45 JAVA User's Guide
Confidential / Released
TC45_JAVA User's Guide_V02
Page 67 of 72
30.06.2003
11.1.3.3
Registering a listener with an
ATCommand
instance
After creating an instance of the
ATCommandListener
class, this class instance has to be
passed as a parameter to the
ATCommand.addListener()
method. After that, the callback
methods will be called by the runtime system each time the corresponding events (URCs or
signal state changes) occur on the corresponding device AT parser.
/* we have two ATCommands instances, atc1 and atc2 */
ATListenerA reminder_listener = new ATListenerA();
ATListenerB card_listener = new ATListenerB();
atc1.addListener(reminder_listener);
atc2.addListener(card_listener);
The
ATCommand.removeListener()
method removes a listener object that has been
previously added to the internal list table of listener objects. After it has been removed from
the list it will not be called when URCs occur. If it was not previously registered the list
remains unchanged.
The same
ATCommandListener
may be added to several
ATCommand
instances and
several
ATCommandListeners
may be added to the same
ATCommand
.