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::TypedService Class Reference

Access an UPnP service actions through a string based interface. More...

#include <typedservice.hxx>

Inheritance diagram for UPnPClient::TypedService:
UPnPClient::Service

Classes

class  Internal
 

Public Member Functions

 TypedService (const std::string &tp)
 Build an empty object. More...
 
virtual bool serviceTypeMatch (const std::string &tp)
 Check if the input matches our service type.
 
virtual int runAction (const std::string &name, std::vector< std::string > args, std::map< std::string, std::string > &retdata)
 Run an action specified by name, with specified input return output. More...
 
- Public Member Functions inherited from UPnPClient::Service
 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 void reSubscribe ()
 
const std::string & getFriendlyName () const
 
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 event data reporter object.
 

Protected Member Functions

virtual bool serviceInit (const UPnPDeviceDesc &device, const UPnPServiceDesc &service)
 Service-specific part of initialization. More...
 
- Protected Member Functions inherited from UPnPClient::Service
void registerCallback (evtCBFunc c)
 Used by a derived class to register its callback method. More...
 
void unregisterCallback ()
 Cancel subscription to the service events, forget installed callback.
 

Detailed Description

Access an UPnP service actions through a string based interface.

This class allows flexible and easy access to a service functionality without the effort of deriving a specific class from UPnPClient::Service. It was mostly implemented for the Python SWIG interface, but it could probably have other usages. The constructor yields a barely initialized object, still needing initialization through a call to Service::initFromDescription(). The easiest way to build a usable object is to use the findTypedService() helper function.

Constructor & Destructor Documentation

◆ TypedService()

UPnPClient::TypedService::TypedService ( const std::string &  tp)

Build an empty object.

Will be later initialized by initFromDescription(), typically called from findTypedService().

Parameters
tpshould be the official service type value, e.g. urn:schemas-upnp-org:service:AVTransport:1

Member Function Documentation

◆ runAction()

int UPnPClient::TypedService::runAction ( const std::string &  name,
std::vector< std::string >  args,
std::map< std::string, std::string > &  retdata 
)
virtual

Run an action specified by name, with specified input return output.

Parameters
namethe action name (e.g. SetAVTransportURI)
argsthe input argument vector. These must be given in the order given by the action definition inside the service description.
[out]retdatathe output returned from the action. map used instead of unordered_map for swig 2.0 compatibility.
Returns
a libupnp error code, 0 for success.

◆ serviceInit()

bool UPnPClient::TypedService::serviceInit ( const UPnPDeviceDesc device,
const UPnPServiceDesc service 
)
protectedvirtual

Service-specific part of initialization.

This downloads and parses the service description data. This is called from initFromDescription(), typically in findTypedService() in our case.

Reimplemented from UPnPClient::Service.


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