POLL_INTERVAL catch event
Hi all,
I've got a Javacard applet which does a couple of things (file reading/writing, menu and so on...
Now I need to call a function I wrote (which writes in a file) every 30 seconds.
I know that the POLL_INTERVAL should already be set to 30 seconds.
Now the question is:
how can I "catch" the event?
I mean, could someone give me a sample code where this polling is used?
I haven't found an event to register or something like that.
Please help ...
# 1
I think you talk about an off-card implementation of your requirement, because a smart card has no clock.
There are plenty of code samples how to poll something in a given time interval. But I think your card won't have a very long life time writing every 30 seconds to the same file.
# 2
Sorry...
Forgotten to say that every 30 seconds I do a check and if the check is successful I write to the file.
Better said, I need to "create" a sort of startup event: I want to be triggered when the SIM is powered on.
To do that , the idea was to create a non transient byte array (1 byte is enough) and at every poll interval check which is the content.
If it is "FF" (the default value) I stores in it something else (say 01) and I do the file update, otherwise if it's already 01 I do nothing.
But I can't find a code sample of the poll.
# 3
Sorry for the time you lose... the problem was an old SIM. With a newer one all works like a charme.
If someone is interested, the code sample:
//Constructor of the applet
public RegDeregApplet () {
...
reg.requestPollInterval(POLL_SYSTEM_DURATION);
...
}
public void processToolkit( byte bEvent ) throws ToolkitException
{
try
{
switch ( bEvent )
{
case EVENT_STATUS_COMMAND:
doSomething();
break;
default:
return;
}
}
}
Bye