Files

103 lines
3.0 KiB
C++

/**
* @file include/ActivOneApi/ISessionHandler.h
*
* @brief Header for the ISessionHandler class.
*/
#if (!defined ACTIV_ONE_API_ISESSION_HANDLER_H)
#define ACTIV_ONE_API_ISESSION_HANDLER_H
#include "ActivOneApi/External.h"
#include "ActivOneApi/TypeDefinitions.h"
#include "ActivMiddleware/ActivBase/ActivBase.h"
//! Activ namespace.
namespace Activ
{
//! OneApi namespace.
namespace OneApi
{
class Session;
//! Session handler interface class.
class ISessionHandler
{
public:
//! Destructor.
virtual ~ISessionHandler() { }
/**
* @brief Callback when an asynchronous connection to the platform is established.
*
* - This method will not be called for a synchronous connection.
* - If the connection is lost to the platform automatic reconnection will be notified through this method.
*
* @param session the Session that generated the callback.
*/
virtual void OnSessionConnect(Session &session) { }
/**
* @brief Callback on disconnect from the platform.
*
* - Called when a client initiated disconnect completes (Session::Disconnect()).
*
* @param session the Session that generated the callback.
*/
virtual void OnSessionDisconnect(Session &session) { }
/**
* @brief Callback on session error.
*
* - Called when a client connect request can't be completed or when the connection is lost.
*
* @param session the Session that generated the callback.
* @param statusCode the status code.
* STATUS_CODE_ACCESS_DENIED authentication issue
* STATUS_CODE_CONNECTION_REFUSED connection refused
* STATUS_CODE_HOST_UNREACHABLE host unreachable
* STATUS_CODE_INVALID_PASSWORD invalid password
* STATUS_CODE_INVALID_USER invalid username
* STATUS_CODE_INVALID_VERSION invalid api version
* STATUS_CODE_NOT_SUPPORTED not supported
* STATUS_CODE_TIMEOUT connection timeout
* STATUS_CODE_NOT_CONNECTED connection broken
* STATUS_CODE_NOT_FOUND required dictionaries could not be downloaded
*/
virtual void OnSessionError(Session &session, const StatusCode statusCode) { }
/**
* @brief Callback on log message.
*
* - Provides notification messages for state changes, configuration details and connection notifications.
*
* @param session the Session that generated the callback.
* @param logType
*
* - LOG_TYPE_INFO
* - LOG_TYPE_WARNING
* - LOG_TYPE_ERROR
*
* @param message the log message.
*/
virtual void OnSessionLogMessage(Session &session, const LogType logType, const String &message) { }
/**
* @brief Callback on user message posted via Session::PostUserMessage().
*
* @param session the Session that generated the callback.
* @param pMessage the buffer containing the message, note that this buffer is only valid for the duration of the callback.
* @param messageLength the length of @a pMessage.
*/
virtual void OnSessionUserMessage(Session &session, const void *pMessage, const size_t messageLength) { }
};
} // namespace OneApi
} // namespace Activ
#endif // (!defined ACTIV_ONE_API_ISESSION_HANDLER_H)