SophiaFramework UNIVERSE 5.3 |
The SFXCallback class is the kernel class to deal with a callback. This calss internally contains the BREW API AEECallback structure to be passed to the BREW environment as the callback information, through which the callback parameters can be set, and the registered callback can be confirmed or canceled.
In the implementation of the SFXCallback::Set function, a callback function and data passed to the callback function is set to the BREW API AEECallback structure that the SFXCallback class contains internally by calling the BREW API CALLBACK_Init function as follows:
Example 803. Implementation of the SFXCallback::Set function
class SFXCallback { ... private: The SFXCallback class contains the AEECallback structure internally AEECallback _callback; ... } /*public */Void SFXCallback::Set(CallbackSPP spp, VoidPtr reference) { cancel the callback registered into _callback Cancel(); clear data of _callback SFXHelper::memset(&_callback, 0, sizeof(_callback)); initialize _callback with a callback function and data passed to the callback function CALLBACK_Init(&_callback, spp, reference); return; }// SFXCallback::Set //
With the interface_cast operator, the SFXCallback class can be casted into the BREW API AEECallback structure, and vice versa.
In general, the BREW API AEECallback structure is passed between BREW API and SophiaFramework UNIVERSE by using this operator.
The below is the code to pass the BREW API AEECallback structure converted from the SFXCallback class by using the interface_cast operator to the BREW API ISHELL_SetTimerEx function.
Example 804. Method to pass the SFXCallback class to BREW API by converting it into the AEECallback structure
/*public */inline SFCError SFBShell::SetTimerEx(SInt32 mSecs, SFXCallbackPtr callback) { return ISHELL_SetTimerEx(interface_cast(this), mSecs, interface_cast(callback)); }// SFBShell::SetTimerEx //
SFXCallback class | |
---|---|
The SFXCallback class is used to implement callbacks in reading or writing data from or into the storage classes, a timer (SFXTimer), and a timer (SFXTask). |
SFXTask | SFXTimer | interface_cast | BREW API AEECallback | BREW API CALLBACK_Init | BREW API ISHELL_SetTimerEx | Storage
Constructor/Destructor |
---|
SFXCallback( Void ) Constructor of the SFXCallback class.
|
~SFXCallback( Void ) Destructor of the SFXCallback class.
|
Public Functions | |
---|---|
Void |
Cancel( Void ) Cancel the registered callback.
|
static SFXCallbackConstRef |
EmptyInstance( Void ) Get the empty callback.
|
CallbackSPP |
GetProcedure( Void ) Get the callback function set to this callback.
|
VoidPtr |
GetReference( Void ) Get the data passed to the callback function set to this callback.
|
Bool |
IsQueued( Void ) Check whether or not the callback is registered.
|
Void |
Set(
CallbackSPP spp
, VoidPtr reference
) Set the necessary information to register the callback.
|
AEECallback * |
interface_cast(
SFXCallback * param
) Cast the SFXCallback class into the AEECallback structure.
|
AEECallback const * |
interface_cast(
SFXCallback const * param
) Cast the SFXCallback class into the AEECallback structure.
|
Types |
---|
CallbackSPP Type of the callback function.
|
Global Functions | |
---|---|
AEECallback * |
interface_cast(
SFXCallback * param
) Cast the SFXCallback class into the AEECallback structure.
|
AEECallback const * |
interface_cast(
SFXCallback const * param
) Cast the SFXCallback class into the AEECallback structure.
|
[ public, explicit ] SFXCallback(Void);
This constructor clears the contents of the BREW API AEECallback structure internally contained by this callback with 0.
[ public ] ~SFXCallback(Void);
This destructor cancels to register the callback by calling the SFXCallback::Cancel function internally.
[ public ] Void Cancel(Void);
This function cancels the registered callback set with the SFXCallback::Set function.
If no callback is registered, nothing will happen.
Tip | |
---|---|
When an application suspends, it is recommended to cancel the callback registered with this function. |
Note | |
---|---|
Internally, this function cancels to register the callback with the BREW API CALLBACK_Cancel function after checking the registration of the callback with the BREW API CALLBACK_IsQueued function. |
Note | |
---|---|
This function is called in the SFXCallback::~SFXCallback destructor. |
SFXCallback::Set | SFXCallback::~SFXCallback | BREW API CALLBACK_IsQueued | BREW API CALLBACK_Cancel
[ public, static ] SFXCallbackConstRef EmptyInstance(Void);
Empty SFXCallback instance
This function gets the instance that represents an empty callback.
[ public, const ] CallbackSPP GetProcedure(Void);
Callback function set to this callback
This function gets the callback function set to this callback with the SFXCallback::Set function.
Note | |
---|---|
Concretely, the value of the pfnNotify member of the BREW API AEECallback structure internally contained by this callback will be returned. |
SFXCallback::Set | SFXCallback::GetReference | BREW API AEECallback
[ public, const ] VoidPtr GetReference(Void);
Data passed to the callback function set to this callback
This function gets the data passed to the callback function set to this callback with the SFXCallback::Set function.
Note | |
---|---|
Concretely, the value of the pNotifyData member of the BREW API AEECallback structure internally contained by this callback will be returned. |
[ public, const ] Bool IsQueued(Void);
This function checks whether or not the callback is registered into the AEE shell.
Note | |
---|---|
Internally, this function calls the BREW API CALLBACK_IsQueued function. |
This function sets information(callback function and data passed to it) necessary to register the callback into the AEE shell.
Internally, since the SFXCallback::Cancel function is called first, the callback that has been already registered before this function is called will be canceled.
Note | |
---|---|
This function will internally set the callback with the BREW API CALLBACK_Init function after clearing the contents of the BREW API AEECallback structure internally contained by this callback with 0. This function sets 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. |
SFXCallback::Cancel | SFXCallback::IsQueued | SFXCallback::GetProcedure | SFXCallback::GetReference | BREW API CALLBACK_Init | BREW API AEECallback
[ public, friend ] AEECallback * interface_cast( SFXCallback * param // callback to cast );
[ public, friend ] AEECallback const * interface_cast( SFXCallback const * param // callback to cast );
BREW API AEECallback structure.
This function casts the SFXCallback class into the BREW API AEECallback structure.
typedef Void(* SFXCallback::CallbackSPP)(VoidPtr reference)
Copyright(c) 2002 - 2024 Sophia Cradle Incorporated All Rights Reserved. |