PrevNextUpHome SophiaFramework UNIVERSE 5.3
SFXCallback
Class for dealing with the callback.
#include <SFXCallback.h.hpp>
class SFXCallback;
SFMTYPEDEFCLASS(SFXCallback)

Description

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 //
[Note] 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).

Reference

SFXTask | SFXTimer | interface_cast | BREW API AEECallback | BREW API CALLBACK_Init | BREW API ISHELL_SetTimerEx | Storage

Member

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.

SFXCallback::SFXCallback
Constructor of the SFXCallback class.
[ public, explicit ]
SFXCallback(Void);

Description

This constructor clears the contents of the BREW API AEECallback structure internally contained by this callback with 0.

Reference

BREW API AEECallback


SFXCallback::~SFXCallback
Destructor of the SFXCallback class.
[ public ]
~SFXCallback(Void);

Description

This destructor cancels to register the callback by calling the SFXCallback::Cancel function internally.

Reference

SFXCallback::Cancel


SFXCallback::Cancel
Cancel the registered callback.
[ public ]
Void Cancel(Void);

Description

This function cancels the registered callback set with the SFXCallback::Set function.

If no callback is registered, nothing will happen.

[Tip] Tip

When an application suspends, it is recommended to cancel the callback registered with this function.

[Note] 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] Note

This function is called in the SFXCallback::~SFXCallback destructor.

Reference

SFXCallback::Set | SFXCallback::~SFXCallback | BREW API CALLBACK_IsQueued | BREW API CALLBACK_Cancel


SFXCallback::EmptyInstance
Get the empty callback.
[ public, static ]
SFXCallbackConstRef EmptyInstance(Void);

Return value

Empty SFXCallback instance

Description

This function gets the instance that represents an empty callback.

Reference

SFXCallback::SFXCallback


SFXCallback::GetProcedure
Get the callback function set to this callback.
[ public, const ]
CallbackSPP GetProcedure(Void);

Return value

Callback function set to this callback

Description

This function gets the callback function set to this callback with the SFXCallback::Set function.

[Note] Note

Concretely, the value of the pfnNotify member of the BREW API AEECallback structure internally contained by this callback will be returned.

Reference

SFXCallback::Set | SFXCallback::GetReference | BREW API AEECallback


SFXCallback::GetReference
Get the data passed to the callback function set to this callback.
[ public, const ]
VoidPtr GetReference(Void);

Return value

Data passed to the callback function set to this callback

Description

This function gets the data passed to the callback function set to this callback with the SFXCallback::Set function.

[Note] Note

Concretely, the value of the pNotifyData member of the BREW API AEECallback structure internally contained by this callback will be returned.

Reference

SFXCallback::GetReference | SFXCallback::Set


SFXCallback::IsQueued
Check whether or not the callback is registered.
[ public, const ]
Bool IsQueued(Void);

Return value

  • If registered: true
  • Otherwise: false

Description

This function checks whether or not the callback is registered into the AEE shell.

[Note] Note

Internally, this function calls the BREW API CALLBACK_IsQueued function.

Reference

SFXCallback::Set | BREW API CALLBACK_IsQueued


SFXCallback::Set
Set the necessary information to register the callback.
[ public ]
Void Set(
    CallbackSPP spp     // callback function
    VoidPtr reference   // user data
);

Description

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] 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.

Reference

SFXCallback::Cancel | SFXCallback::IsQueued | SFXCallback::GetProcedure | SFXCallback::GetReference | BREW API CALLBACK_Init | BREW API AEECallback


interface_cast
Cast the SFXCallback class into the AEECallback structure.
[ public, friend ]
AEECallback * interface_cast(
    SFXCallback * param   // callback to cast
);
[ public, friend ]
AEECallback const * interface_cast(
    SFXCallback const * param   // callback to cast
);

Return value

BREW API AEECallback structure.

Description

This function casts the SFXCallback class into the BREW API AEECallback structure.

Reference

BREW API AEECallback


SFXCallback::CallbackSPP
Type of the callback function.
typedef Void(* SFXCallback::CallbackSPP)(VoidPtr reference)