#include <ControlPoint.h>

Inheritance diagram for UPnP::ControlPoint:
Collaboration diagram for UPnP::ControlPoint:

Public Member Functions

 ControlPoint (size_t maxResponseSize=2048)
 Constructor. More...
 
 ~ControlPoint ()
 
void reset ()
 Cancel any outstanding search and reset the list of known unique service names. More...
 
void clear ()
 Perform a reset and destroy all created devices. More...
 
bool beginSearch (const Urn &urn, SsdpSearch::Callback callback)
 Searches for UPnP device or service and returns SSDP response messages. More...
 
bool beginSearch (const Urn &urn, DescriptionSearch::Callback callback)
 Searches for UPnP device or service and fetches its description. More...
 
bool beginSearch (const ObjectClass &cls, DeviceSearch::Callback callback)
 Searches for UPnP device. More...
 
bool beginSearch (const ObjectClass &cls, ServiceSearch::Callback callback)
 Searches for UPnP service. More...
 
template<typename Device >
bool beginSearch (Delegate< bool(Device &)> callback)
 
bool isSearchActive () const
 Determine if there's an active search in progress. More...
 
bool cancelSearch ()
 Cancel any active search operation. More...
 
virtual void onNotify (BasicMessage &msg)
 Called by framework to handle an incoming SSDP message. More...
 
bool formatMessage (Message &msg, MessageSpec &ms) override
 Standard fields have been completed. More...
 
bool sendRequest (HttpRequest *request)
 Send a request. More...
 
bool requestDescription (const String &url, DescriptionSearch::Callback callback)
 Send a request for description document. More...
 
- Public Member Functions inherited from UPnP::ObjectTemplate< ControlPoint, BaseObject >
ControlPointgetNext () const
 
Iterator begin () const
 
Iterator end () const
 
- Public Member Functions inherited from UPnP::BaseObject
virtual void sendMessage (Message &msg, MessageSpec &ms)
 Called by framework to construct then send a message. More...
 
- Public Member Functions inherited from UPnP::LinkedItem
Itemnext () const override
 
LinkedItemgetNext () const
 
- Public Member Functions inherited from UPnP::Item
virtual ~Item ()
 
virtual XML::NodegetDescription (XML::Document &doc, DescType descType) const
 
virtual ItemEnumeratorgetList (unsigned index, String &name)
 
bool operator== (const Item &other) const
 

Static Public Member Functions

static void onSsdpMessage (BasicMessage &msg)
 Called via SSDP when incoming message received. More...
 
static const ObjectClassfindClass (const Urn &objectType)
 Find a registered class. More...
 
static void registerClasses (const FlashString &domain, const ObjectClass::List &classes)
 Use this method to register all device and service classes you need to control. More...
 

Constructor & Destructor Documentation

◆ ControlPoint()

UPnP::ControlPoint::ControlPoint ( size_t  maxResponseSize = 2048)
inline

Constructor.

Parameters
maxResponseSizeLimits size of stream used to receive HTTP responses

◆ ~ControlPoint()

UPnP::ControlPoint::~ControlPoint ( )
inline

Member Function Documentation

◆ beginSearch() [1/5]

bool UPnP::ControlPoint::beginSearch ( const ObjectClass cls,
DeviceSearch::Callback  callback 
)
inline

Searches for UPnP device.

Parameters
clsDevice class object
callbackInvoked with constructed control object
Return values
booltrue on success, false if request queue is full

◆ beginSearch() [2/5]

bool UPnP::ControlPoint::beginSearch ( const ObjectClass cls,
ServiceSearch::Callback  callback 
)
inline

Searches for UPnP service.

Parameters
clsService class object
callbackInvoked with constructed control object
Return values
booltrue on success, false if request queue is full

◆ beginSearch() [3/5]

bool UPnP::ControlPoint::beginSearch ( const Urn urn,
DescriptionSearch::Callback  callback 
)
inline

Searches for UPnP device or service and fetches its description.

Parameters
urnunique identifier of the service or device to find
callbackInvoked with device description document
Return values
booltrue on success, false if request queue is full

◆ beginSearch() [4/5]

bool UPnP::ControlPoint::beginSearch ( const Urn urn,
SsdpSearch::Callback  callback 
)
inline

Searches for UPnP device or service and returns SSDP response messages.

Parameters
urnunique identifier of the service or device to find
callbackInvoked with SSDP response message
Return values
booltrue on success, false if request queue is full

◆ beginSearch() [5/5]

template<typename Device >
bool UPnP::ControlPoint::beginSearch ( Delegate< bool(Device &)>  callback)
inline

◆ cancelSearch()

bool UPnP::ControlPoint::cancelSearch ( )

Cancel any active search operation.

Return values
booltrue if a search was active, false if there was no active search
Todo:
Set timeout on search operation and call this automatically Need to inform application though - perhaps a generic callback on the class?

◆ clear()

void UPnP::ControlPoint::clear ( void  )
inline

Perform a reset and destroy all created devices.

◆ findClass()

static const ObjectClass* UPnP::ControlPoint::findClass ( const Urn objectType)
static

Find a registered class.

Parameters
objectTypeUrn uniquely identifying the class
Return values
ObjectClass*The class, or nullptr if not found

◆ formatMessage()

bool UPnP::ControlPoint::formatMessage ( Message msg,
MessageSpec ms 
)
overridevirtual

Standard fields have been completed.

Note
Fields can be modified typically by adding any custom fields before sending response.
Parameters
msgThe message being constructed
msTemplate spec. for message
Return values
boolReturn true to send message, false to cancel

Implements UPnP::BaseObject.

◆ isSearchActive()

bool UPnP::ControlPoint::isSearchActive ( ) const
inline

Determine if there's an active search in progress.

◆ onNotify()

virtual void UPnP::ControlPoint::onNotify ( BasicMessage msg)
virtual

Called by framework to handle an incoming SSDP message.

Parameters
msg

◆ onSsdpMessage()

static void UPnP::ControlPoint::onSsdpMessage ( BasicMessage msg)
static

Called via SSDP when incoming message received.

◆ registerClasses()

static void UPnP::ControlPoint::registerClasses ( const FlashString domain,
const ObjectClass::List classes 
)
inlinestatic

Use this method to register all device and service classes you need to control.

Parameters
domain
classesList of classes to register

Class information is required in order to instantiate device or service objects in response to incoming descriptions. This information must be pre-registered with the control point.

◆ requestDescription()

bool UPnP::ControlPoint::requestDescription ( const String url,
DescriptionSearch::Callback  callback 
)

Send a request for description document.

Parameters
requestDescription URL
callbackTo be invoked with requested document
Return values
booltrue on success, false if queue is full

◆ reset()

void UPnP::ControlPoint::reset ( )
inline

Cancel any outstanding search and reset the list of known unique service names.

◆ sendRequest()

bool UPnP::ControlPoint::sendRequest ( HttpRequest request)

Send a request.

Parameters
requestCompleted request object: leave response stream unassigned, will be set later
Return values
booltrue on success, false if queue is full

The documentation for this class was generated from the following file: