libupnpp  0.16.0
A C++ wrapper for the Portable UPnP reference library
Classes | Public Member Functions | Protected Member Functions | List of all members
UPnPClient::Service Class Referenceabstract
Inheritance diagram for UPnPClient::Service:
UPnPClient::AVTransport UPnPClient::ContentDirectory UPnPClient::OHInfo UPnPClient::OHPlaylist UPnPClient::OHProduct UPnPClient::OHRadio UPnPClient::OHReceiver UPnPClient::OHSender UPnPClient::OHTime UPnPClient::OHVolume UPnPClient::RenderingControl UPnPClient::TypedService

Classes

class  Internal
 

Public Member Functions

 Service (const UPnPDeviceDesc &device, const UPnPServiceDesc &service)
 Construct by copying data from device and service objects. More...
 
 Service ()
 Empty object. More...
 
bool initFromDescription (const UPnPDeviceDesc &description)
 Initialize empty object from device description. More...
 
virtual bool reSubscribe ()
 Restart the subscription to get all the State variable values, in case we get the events before we are ready (e.g. More...
 
const std::string & getFriendlyName () const
 Accessors for the values extracted from the device description during initialization.
 
const std::string & getDeviceId () const
 
const std::string & getServiceType () const
 
const std::string & getActionURL () const
 
const std::string & getModelName () const
 
const std::string & getManufacturer () const
 
virtual int runAction (const UPnPP::SoapOutgoing &args, UPnPP::SoapIncoming &data)
 Call Soap action and return resulting data. More...
 
int runTrivialAction (const std::string &actionName)
 Run trivial action where there are neither input parameters nor return data (beyond the status)
 
template<class T >
int runSimpleGet (const std::string &actnm, const std::string &valnm, T *valuep)
 Run action where there are no input parameters and a single named value is to be retrieved from the result.
 
template<class T >
int runSimpleAction (const std::string &actnm, const std::string &valnm, T value)
 Run action with a single input parameter and no return data.
 
virtual VarEventReportergetReporter ()
 Get pointer to installed event reporter. More...
 
virtual void installReporter (VarEventReporter *reporter)
 Install or uninstall event data reporter object. More...
 
virtual bool serviceTypeMatch (const std::string &tp)=0
 Perform a comparison to the service type string for this specific service. More...
 

Protected Member Functions

virtual bool serviceInit (const UPnPDeviceDesc &, const UPnPServiceDesc &)
 Service-specific part of initialization. More...
 
bool registerCallback (evtCBFunc c)
 Used by a derived class to register its callback method. More...
 
virtual void registerCallback ()
 To be overridden in classes which actually support events. More...
 
void unregisterCallback ()
 Cancel subscription to the service events, forget installed callback.
 

Constructor & Destructor Documentation

◆ Service() [1/2]

UPnPClient::Service::Service ( const UPnPDeviceDesc device,
const UPnPServiceDesc service 
)

Construct by copying data from device and service objects.

◆ Service() [2/2]

UPnPClient::Service::Service ( )

Empty object.

May be initialized later by calling initFromDescription().

Member Function Documentation

◆ getReporter()

VarEventReporter * UPnPClient::Service::getReporter ( )
virtual

Get pointer to installed event reporter.

This is used by a derived class event handling method and should be in the protected section actually, it has no external use which I can think of

◆ initFromDescription()

bool UPnPClient::Service::initFromDescription ( const UPnPDeviceDesc description)

Initialize empty object from device description.

This allows separating the object construction and initialization. The method can fail if the appropriate service is not found. It calls serviceInit() to perform any initialization specific to the service type. This relies on serviceTypeMatch() implemented in the derived class to find the right service.

◆ installReporter()

void UPnPClient::Service::installReporter ( VarEventReporter reporter)
virtual

Install or uninstall event data reporter object.

Parameters
reporterthe callbacks to be installed, or nullptr to disable reporting (and cancel the upnp subscription).

◆ registerCallback() [1/2]

bool UPnPClient::Service::registerCallback ( evtCBFunc  c)
protected

Used by a derived class to register its callback method.

This creates an entry in the static map, using m_SID, which was obtained by subscribe() during construction

◆ registerCallback() [2/2]

virtual void UPnPClient::Service::registerCallback ( )
inlineprotectedvirtual

To be overridden in classes which actually support events.

Will be called by installReporter(). The call sequence is as follows: some_client_code() Service::installReporter() derived::registerCallback() Service::registerCallback(derivedcbfunc)

◆ reSubscribe()

bool UPnPClient::Service::reSubscribe ( )
virtual

Restart the subscription to get all the State variable values, in case we get the events before we are ready (e.g.

before the connections are set in a qt app). Also: when reconnecting after a device restarts.

◆ runAction()

int UPnPClient::Service::runAction ( const UPnPP::SoapOutgoing args,
UPnPP::SoapIncoming data 
)
virtual

Call Soap action and return resulting data.

Parameters
argsAction name and input parameters
datareturn data.
Returns
0 if the call succeeded, some non-zero UPNP_E_... value else

◆ serviceInit()

virtual bool UPnPClient::Service::serviceInit ( const UPnPDeviceDesc ,
const UPnPServiceDesc  
)
inlineprotectedvirtual

Service-specific part of initialization.

This can be called from the constructor or from initFromDescription(). Most services don't need specific initialization, so we provide a default implementation.

Reimplemented in UPnPClient::ContentDirectory, UPnPClient::TypedService, and UPnPClient::RenderingControl.

◆ serviceTypeMatch()

virtual bool UPnPClient::Service::serviceTypeMatch ( const std::string &  tp)
pure virtual

Perform a comparison to the service type string for this specific service.

This allows embedding knowledge of the service type string inside the derived class. It is used, e.g., by initFromDescription() to look up an appropriate entry from the device description service list. Can also be used by external code wishing to do the same.

Parameters
tpService type string to be compared with the one for the derived class.

Implemented in UPnPClient::AVTransport, UPnPClient::ContentDirectory, UPnPClient::OHVolume, UPnPClient::OHRadio, UPnPClient::TypedService, UPnPClient::OHInfo, UPnPClient::OHPlaylist, UPnPClient::OHProduct, UPnPClient::OHReceiver, UPnPClient::OHTime, UPnPClient::RenderingControl, UPnPClient::OHSender, and UPnPClient::ConnectionManager.


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