SophiaFramework UNIVERSE 5.3 |
The SFXTimer class is used to deal with a timer, that is, callback that will be called and executed after a specified time elapses.
The method to use the SFXTimer class is as follows:
Internal implementation | |
---|---|
The SFXTimer class is implemented by using the SFXCallback class. In the internal implementaion, the BREW API ISHELL_SetTimerEx function is used to schedule a timer, i.e., register a callback, |
class MyClass { private: SFXTimer _timer; public: Void Function(Void); XALLBACK_DECLARE_SFXTIMER(TimerCallback) }; Void MyClass::Function(Void) { ... // set information necessary to schedule the timer // * set the TimerCallback function and data passed to the TimerCallback function _timer.Set(XALLBACK_INTERNAL(TimerCallback)); // schedule the timer // * the TimerCallback function will be called after the 4000 milliseconds elapses _timer.Schedule(4000); } /// callback function called by BREW environment after the specified time elapses XALLBACK_IMPLEMENT_SFXTIMER(MyClass, TimerCallback) { ... }
Constructor/Destructor |
---|
SFXTimer( Void ) Constructor of the SFXTimer class.
|
~SFXTimer( Void ) Destructor of the SFXTimer class.
|
Public Functions | |
---|---|
Void |
Cancel( Void ) Cancel the scheduled timer.
|
static SFXTimerConstRef |
EmptyInstance( Void ) Get the empty timer.
|
SFXCallback::CallbackSPP |
GetProcedure( Void ) Get the callback function set to this timer.
|
VoidPtr |
GetReference( Void ) Get the data passed to the callback function set to this timer.
|
Bool |
IsValid( Void ) Check whether or not the timer is scheduled.
|
SFCError |
Schedule(
UInt32 msec
) Schedule the timer.
|
Void |
Set(
SFXCallback::CallbackSPP spp
, VoidPtr reference
) Set information necessary to schedule the timer.
|
[ public, explicit ] SFXTimer(Void);
This constructor does nothing.
[ public ] ~SFXTimer(Void);
This destructor cancels to schedule the timer by calling the SFXTimer::Cancel function internally.
[ public ] Void Cancel(Void);
This function cancels the scheduled timer, i.e., the registered callback.
The timer scheduled with the SFXTimer::Schedule function will be canceled. If no timer is scheduled, nothing will happen.
Tip | |
---|---|
When an application suspends, it is recommended to cancel the scheduled timer with this function. |
Note | |
---|---|
This function is called in the SFXTimer::~SFXTimer destructor. |
Note | |
---|---|
Internally, this function calls the SFXCallback::Cancel function. |
SFXTimer::Schedule | SFXTimer::~SFXTimer | SFXCallback::Cancel
[ public, static ] SFXTimerConstRef EmptyInstance(Void);
Empty SFXTimer instance
This function gets the instance that represents an empty timer.
[ public, const ] SFXCallback::CallbackSPP GetProcedure(Void);
Return the callback function set to this timer.
This function gets the callback function set to this timer with the SFXTimer::Set function.
Note | |
---|---|
Internally, this function calls the SFXCallback::GetProcedure function. Concretely, the value of the pfnNotify member of the BREW API AEECallback structure internally contained by this timer will be returned. |
[ public, const ] VoidPtr GetReference(Void);
Data passed to the callback function set to this timer
This function gets the data passed to the callback function set to this timer with the SFXTimer::Set function.
Note | |
---|---|
Internally, this function calls the SFXCallback::GetReference function. Concretely, the value of the pNotifyData member of the BREW API AEECallback structure internally contained by this timer will be returned. |
[ public, const ] Bool IsValid(Void);
This function whether or not the timer is schedule with the SFXTimer::Schedule function.
Note | |
---|---|
Internally, this function calls the SFXCallback::IsQueued function. |
[ public ] SFCError Schedule( UInt32 msec // time until the callback function is called ( milli-second ) );
This function schedules the timer, i.e., registers the callback into the AEE shell.
If the timer has already been scheduled, it will be canceled and scheduled again.
If this function is executed, the callback function set with the SFXTimer::Set function will be called when the time set in the msec argument of this function elapses.
Note | |
---|---|
Internally, after the timer is canceled with the SFXTimer::Cancel function, it will be scheduled again with the SFBShell::SetTimerEx function. |
Prerequisite | |
---|---|
Before this function is called, it is necessary to set the timer with the SFXTimer::Set function. |
SFXTimer::Set | SFXTimer::Cancel | SFXTimer::IsValid | SFBShell | BREW API ISHELL_SetTimerEx
[ public ] Void Set( SFXCallback::CallbackSPP spp // callback function that is set to the timer VoidPtr reference // data passed to the callback function );
This function sets information(callback function and data passed to it) necessary to schedule the timer.
Internally, since the SFXTimer::Cancel function is called first, the timer that has been already scheduled before this function is called will be canceled.
Note | |
---|---|
After this function is executed, schedule the timer with the SFXTimer::Schedule function (register the callback). |
Note | |
---|---|
This function internally calls the SFXCallback::Set function to set the callback function and the data passed to it specified in the arguments to the pfnNotify member and the pNotifyData member of the BREW API AEECallback structure internally contained by this timer. |
Copyright(c) 2002 - 2024 Sophia Cradle Incorporated All Rights Reserved. |