Poco::UPnP::GENA

class Listener

File Information

Library: UPnP/GENA
Package: GENA
Header: Poco/UPnP/GENA/Listener.h

Description

The RemotingNG Listener implementation for UPnP Eventing using GENA.

This class also manages event subscriptions. A subscription timeout can be set for events

Inheritance

Direct Base Classes: Poco::RemotingNG::EventListener

All Base Classes: Poco::RefCountedObject, Poco::RemotingNG::EventListener, Poco::RemotingNG::Listener

Member Summary

Member Functions: createURI, findStateProvider, findSubscriber, getEventSubscriptionTimeout, handlesURI, protocol, registerObject, registerStateProvider, setEventSubscriptionTimeout, start, stop, subscribeToEvents, unregisterObject, unregisterStateProvider, unsubscribeFromEvents

Inherited Functions: createURI, duplicate, endPoint, getAuthenticator, getAuthorizer, handlesURI, protocol, referenceCount, registerObject, release, setAuthenticator, setAuthorizer, start, stop, subscribeToEvents, unregisterObject, unsubscribeFromEvents

Types

Ptr

typedef Poco::AutoPtr < Listener > Ptr;

Enumerations

Anonymous

EVENT_REQUEST_TIMEOUT = 30

timeout for event subscription HTTP requests (seconds)

EVENT_SUBSCRIPTION_TIMEOUT = 1800

default timeout for event subscriptions (seconds)

Constructors

Listener

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.

Destructor

~Listener virtual

~Listener();

Destroys the Listener.

Member Functions

createURI

std::string createURI(
    const Poco::RemotingNG::Identifiable::TypeId & typeId,
    const Poco::RemotingNG::Identifiable::ObjectId & objectId
);

findStateProvider

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.

findSubscriber

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.

getEventSubscriptionTimeout

int getEventSubscriptionTimeout() const;

Returns the timeout (in seconds) for event subscriptions.

handlesURI virtual

bool handlesURI(
    const std::string & uri
);

protocol virtual

const std::string & protocol() const;

registerObject

void registerObject(
    Poco::RemotingNG::RemoteObject::Ptr pRemoteObject,
    Poco::RemotingNG::Skeleton::Ptr pSkeleton
);

registerStateProvider

void registerStateProvider(
    const std::string & uri,
    StateProvider * pStateProvider
);

Registers a StateProvider interface for the remote object with the given URI.

setEventSubscriptionTimeout

void setEventSubscriptionTimeout(
    int seconds
);

Sets the timeout (in seconds) for event subscriptions.

A zero timeout means infinite.

start virtual

void start();

stop virtual

void stop();

subscribeToEvents

std::string subscribeToEvents(
    Poco::RemotingNG::EventSubscriber::Ptr pEventSubscriber
);

unregisterObject

void unregisterObject(
    Poco::RemotingNG::RemoteObject::Ptr pRemoteObject
);

unregisterStateProvider

void unregisterStateProvider(
    const std::string & uri
);

Unregisters the StateProvider interface for the remote object with the given URI.

unsubscribeFromEvents

void unsubscribeFromEvents(
    Poco::RemotingNG::EventSubscriber::Ptr pEventSubscriber
);

Variables

EMPTY static

static const std::string EMPTY;

HDR_CALLBACK static

static const std::string HDR_CALLBACK;

HDR_TIMEOUT static

static const std::string HDR_TIMEOUT;

SUBSCRIBE static

static const std::string SUBSCRIBE;

TIMEOUT_INFINITE static

static const std::string TIMEOUT_INFINITE;

TIMEOUT_SECOND static

static const std::string TIMEOUT_SECOND;

UNSUBSCRIBE static

static const std::string UNSUBSCRIBE;

eventSubscriptionLost

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.

eventSubscriptionRenewalFailed

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.

eventSubscriptionRenewed

Poco::BasicEvent < const std::string > eventSubscriptionRenewed;

Fired whenever an event subscription has been successfully renewed.

The event subscription URI is given as argument.

Securely control IoT edge devices from anywhere   Connect a Device