Library: UPnP/GENA
Package: GENA
Header: Poco/UPnP/GENA/Listener.h
The RemotingNG Listener implementation for UPnP Eventing using GENA.
This class also manages event subscriptions. A subscription timeout can be set for events
Direct Base Classes: Poco::RemotingNG::EventListener
All Base Classes: Poco::RefCountedObject, Poco::RemotingNG::EventListener, Poco::RemotingNG::Listener
Member Functions: createURI, findStateProvider, findSubscriber, getEventSubscriptionTimeout, handlesURI, protocol, registerObject, registerStateProvider, setEventSubscriptionTimeout, start, stop, subscribeToEvents, unregisterObject, unregisterStateProvider, unsubscribeFromEvents
Inherited Functions: createURI, duplicate, endPoint, handlesURI, protocol, referenceCount, registerObject, release, start, stop, subscribeToEvents, unregisterObject, unsubscribeFromEvents
typedef Poco::AutoPtr < Listener > Ptr;
timeout for event subscription HTTP requests (seconds)
EVENT_SUBSCRIPTION_TIMEOUT = 1800
default timeout for event subscriptions (seconds)
Listener(
const std::string & endPoint,
Poco::Util::Timer & timer
);
Creates a Listener for the given endpoint, which must be in <host>:<port> format.
The timer is required for periodically renewing event subscriptions.
Note that this Listener implementation does not actually accept requests itself. It merely registers an endpoint in the ORB. The actual work of accepting and dispatching requests is done by the RequestHandler class.
~Listener();
Destroys the Listener.
std::string createURI(
const Poco::RemotingNG::Identifiable::TypeId & typeId,
const Poco::RemotingNG::Identifiable::ObjectId & objectId
);
StateProvider * findStateProvider(
const std::string & uri
);
Returns the StateProvider for the remote object with the given URI, or a null pointer if no StateProvider has been registered for that object.
Poco::RemotingNG::EventSubscriber::Ptr findSubscriber(
const std::string & sid
);
Returns a pointer to the EventSubscriber with the given SID, or a null pointer if no such subscriber exists.
int getEventSubscriptionTimeout() const;
Returns the timeout (in seconds) for event subscriptions.
bool handlesURI(
const std::string & uri
);
See also: Poco::RemotingNG::Listener::handlesURI()
const std::string & protocol() const;
See also: Poco::RemotingNG::Listener::protocol()
void registerObject(
Poco::RemotingNG::RemoteObject::Ptr pRemoteObject,
Poco::RemotingNG::Skeleton::Ptr pSkeleton
);
void registerStateProvider(
const std::string & uri,
StateProvider * pStateProvider
);
Registers a StateProvider interface for the remote object with the given URI.
void setEventSubscriptionTimeout(
int seconds
);
Sets the timeout (in seconds) for event subscriptions.
A zero timeout means infinite.
void start();
See also: Poco::RemotingNG::Listener::start()
void stop();
See also: Poco::RemotingNG::Listener::stop()
void subscribeToEvents(
Poco::RemotingNG::EventSubscriber::Ptr pEventSubscriber
);
void unregisterObject(
Poco::RemotingNG::RemoteObject::Ptr pRemoteObject
);
void unregisterStateProvider(
const std::string & uri
);
Unregisters the StateProvider interface for the remote object with the given URI.
void unsubscribeFromEvents(
Poco::RemotingNG::EventSubscriber::Ptr pEventSubscriber
);
static const std::string EMPTY;
static const std::string HDR_CALLBACK;
static const std::string HDR_TIMEOUT;
static const std::string SUBSCRIBE;
static const std::string TIMEOUT_INFINITE;
static const std::string TIMEOUT_SECOND;
static const std::string UNSUBSCRIBE;
Poco::BasicEvent < const std::string > eventSubscriptionLost;
Fired whenever an event subscription has been lost. This happens when an normal renewal attempt fails with a 412 Precondition Failed HTTP error, and the following attempt to create a new subscription also fails.
The event subscription URI is given as argument.
Poco::BasicEvent < const std::string > eventSubscriptionRenewalFailed;
Fired whenever an attempt to renew an event subscription failed with a network error or HTTP error other than 412.
The framework will still attempt to renew the subscription in the future, until it gets a 412 Precondition Failed error. In this case, one last attempt to create a new subscription will be made. If this also fails, the event subscription is lost and the eventSubscriptionLost event is fired.
The event subscription URI is given as argument.
Poco::BasicEvent < const std::string > eventSubscriptionRenewed;
Fired whenever an event subscription has been successfully renewed.
The event subscription URI is given as argument.