94 lines
2.8 KiB
C++
94 lines
2.8 KiB
C++
/**
|
|
* @file include/ActivOneApi/ISubscriptionHandler.h
|
|
*
|
|
* @brief Header for the ISubscriptionHandler class.
|
|
*/
|
|
|
|
#if (!defined ACTIV_ONE_API_ISUBSCRIPTION_HANDLER_H)
|
|
#define ACTIV_ONE_API_ISUBSCRIPTION_HANDLER_H
|
|
|
|
#include "ActivOneApi/External.h"
|
|
|
|
#include "ActivOneApi/TypeDefinitions.h"
|
|
|
|
//! Activ namespace.
|
|
namespace Activ
|
|
{
|
|
|
|
//! OneApi namespace.
|
|
namespace OneApi
|
|
{
|
|
|
|
class Context;
|
|
class RefreshMessage;
|
|
class TopicStatusMessage;
|
|
class UpdateMessage;
|
|
|
|
//! Subscription handler interface (see Session::Subscribe()).
|
|
class ISubscriptionHandler
|
|
{
|
|
public:
|
|
//! Destructor.
|
|
virtual ~ISubscriptionHandler() { }
|
|
|
|
/**
|
|
* @brief Callback on a subscription refresh message.
|
|
*
|
|
* For map subscriptions, a refresh message is received for each entry in the map. Any number of refreshes can be
|
|
* received, including none at all for an empty map. Users should watch for a topic status of OK to detect when
|
|
* refreshes for the map have completed.
|
|
*
|
|
* @param refreshMessage the @a RefreshMessage object.
|
|
* @param context the context for this event.
|
|
*/
|
|
virtual void OnSubscriptionRefresh(const RefreshMessage &refreshMessage, const Context &context) { }
|
|
|
|
/**
|
|
* @brief Callback on a subscription update message.
|
|
*
|
|
* For field list subscriptions, update messages will be received after the initial refresh message.
|
|
*
|
|
* For map subscriptions, updates are received for individual entries. Update messages can be received for individual entries
|
|
* before all refresh messages have been received. Therefore, the user should expect to see update messages for individual
|
|
* entries in all subscription states other than TOPIC_SUBSCRIPTION_STATE_PENDING.
|
|
*
|
|
* @param updateMessage the @a UpdateMessage object.
|
|
* @param context the context for this event.
|
|
*/
|
|
virtual void OnSubscriptionUpdate(const UpdateMessage &updateMessage, const Context &context) { }
|
|
|
|
/**
|
|
* @brief Callback on subscription topic status message.
|
|
*
|
|
* @param topicStatusMessage the @a TopicStatusMessage object.
|
|
* @param context the context for this event.
|
|
*/
|
|
virtual void OnSubscriptionTopicStatus(const TopicStatusMessage &topicStatusMessage, const Context &context) { }
|
|
|
|
/**
|
|
* @brief Callback on error.
|
|
*
|
|
* The subscription has failed, probably due to a service disconnect. The subscription will resume on reconnect.
|
|
*
|
|
* @param statusCode
|
|
* @param context the context for this event.
|
|
*/
|
|
virtual void OnSubscriptionError(const StatusCode statusCode, const Context &context) { }
|
|
|
|
/**
|
|
* @brief Callback on failure to create the subscription.
|
|
*
|
|
* The subscription has failed and will not recover.
|
|
*
|
|
* @param statusCode
|
|
* @param context the context for this event.
|
|
*/
|
|
virtual void OnSubscriptionFailure(const StatusCode statusCode, const Context &context) { }
|
|
};
|
|
|
|
} // namespace OneApi
|
|
|
|
} // namespace Activ
|
|
|
|
#endif // (!defined ACTIV_ONE_API_ISUBSCRIPTION_HANDLER_H)
|