class IO2GSessionStatus

Parents
IAddRef

Brief

The interface provides method signatures to process notifications about session status changes and login failure.

Details

The interface must be implemented by the application in order to process the status change of the session object.

When the user tries to login, the session status changes to Connecting.

If login failed, the status changes to Disconnected and server returns an error message explaining why login has failed. If you want to capture what went wrong, use onLoginFailed method of the interface.

If login was successful, the session status changes to Connected. If you want to capture and process every status change of the session object, use onSessionStatusChanged method of the interface. For complete list of session statuses, please see O2GSessionStatus. For detailed explanation of session statuses, please refer to Session Statuses section.

If you want to use methods of IO2GSessionStatus interface, you must create a class which implements the interface. For example,
class SessionStatusListener : public IO2GSessionStatus { };

An instance of the class implementing IO2GSessionStatus interface must be subscribed to the session object before calling IO2GSession::login method. It is accomplished by calling IO2GSession::subscribeSessionStatus method. For example,

mSession = CO2GTransport::createSession();
SessionStatusListener *statusListener = new SessionStatusListener(mSession, mSubSessionID, mPin);
mSession->subscribeSessionStatus(statusListener);

An instance of the class implementing IO2GSessionStatus interface must be unsubscribed from the session object after calling IO2GSession::logout method. It is accomplished by calling IO2GSession::unsubscribeSessionStatus method. For example,

mSession->logout();
mSession->unsubscribeSessionStatus(statusListener);

For the interface implementation details, please see the example below:

Process notifications about session status changes and login failure [show]

Public Methods

onLoginFailed

Processes notification about the login failure.

onSessionStatusChanged

Processes notifications about the session status change.

back