Event Timer Expiration problem

Hello all,

I have problem with Timer, I've registered the Event, Timer was started and expirated. But the applet was not triggered. What I want to do is catching the event if the timer expirates and display some text or play tone. I tried to get the event "EVENT_TIMER_EXPIRATION" triggered or the envelop tag "BTAG_TIMER_EXPIRATION". Nothing happens. I checked the TERMINAL PROFILE where all items about Timer are supported.

Pls have a look at my source code following, if I am doing sth wrong. Any help would be appreciated!

p.s.: i simplified the applet for testing.

public MyApplet1 (){

reg = ToolkitRegistry.getEntry();

reg.allocateTimer();

// two events were registered for triggering

reg.setEvent(EVENT_FORMATTED_SMS_PP_ENV);

reg.setEvent(EVENT_UNFORMATTED_SMS_PP_ENV);

}

publicvoid processToolkit (byte event ){

ProactiveHandler proHdlr = ProactiveHandler.getTheHandler();

ProactiveResponseHandler rspHdlr = ProactiveResponseHandler.getTheHandler();

EnvelopeHandler envHdlr = EnvelopeHandler.getTheHandler();

EnvelopeResponseHandler envRspHdlr = EnvelopeResponseHandler.getTheHandler();

if (envHdlr.getEnvelopeTag() == BTAG_TIMER_EXPIRATION){

displayMessage ((byte)81, DCS_8_BIT_DATA, textToDisplay, (short)0, (short)2);

}

if (event == EVENT_TIMER_EXPIRATION){

displayMessage ((byte)81, DCS_8_BIT_DATA, textToDisplay, (short)2, (short)2);

}

if (event == EVENT_FORMATTED_SMS_PP_ENV || event == EVENT_UNFORMATTED_SMS_PP_ENV){

byte [] timerData =newbyte [3];

timerData [0] = (byte)0;

timerData [1] = (byte)0;

timerData [2] = (byte)0x51;

proHdlr.init(PRO_CMD_TIMER_MANAGEMENT, (byte)0, DEV_ID_ME);

proHdlr.appendTLV(TAG_TIMER_IDENTIFIER, (byte)1);

proHdlr.appendTLV(TAG_TIMER_VALUE, timerData, (short)0, (short)3);

proHdlr.send();

}

}

[3004 byte] By [dmenga] at [2007-10-3 2:28:32]
# 1

Hi dmeng,

first of all,

u r not registered with " EVENT_TIMER_EXPIRATION"

means

reg.setEvent(EVENT_TIMER_EXPIRATION);

& one more thing u r calling PAC "PRO_CMD_TIMER_MANAGEMENT"

in sms events ,is there any need of that if loop (i don't think so)

may be that event formatted & unformatted sms is not triggering(r u receiving any sms?)

Divyesh.

divyesh_atomtecha at 2007-7-14 19:27:37 > top of Java-index,Java Mobility Forums,Consumer and Commerce...
# 2

hi,

sorry for the late to answer you, was in vacation.

for your questions:

1. some events are not allowed for the setEvent() method, e.g.: EVENT_TIMER_EXPIRATION

2. i am sorry that i didnt make it clear: my program needs to set the timer only after triggering of some events e.g.: event_formatted_sms_pp_env. there is no loop.

i have meanwhile got the problem sovled:

EnvelopeResponseHandler must not be declared if the Envelope has no response. Otherwise the event cannot be triggered, and BTAG will be lost. I didn't understand it totally, but it works after i deleted EnvelopeResponseHandler.

thanks for your answer.

bye

dmong

dmenga at 2007-7-14 19:27:37 > top of Java-index,Java Mobility Forums,Consumer and Commerce...