libupnpp 0.16.0
A C++ wrapper for the Portable UPnP reference library
|
Classes | |
class | Internal |
Public Member Functions | |
Service (const UPnPDeviceDesc &device, const UPnPServiceDesc &service) | |
Construct by copying data from device and service objects. | |
Service () | |
Empty object. | |
Service (const Service &)=delete | |
Service & | operator= (const Service &)=delete |
bool | initFromDescription (const UPnPDeviceDesc &description) |
Initialize empty object from device description. | |
bool | ok () |
Check that initialization went well. | |
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. | |
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, ActionOptions *opts=nullptr) |
Call Soap action and return resulting data. | |
int | runTrivialAction (const std::string &actionName, ActionOptions *opts=nullptr) |
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, ActionOptions *opts=nullptr) |
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, ActionOptions *opts=nullptr) |
Run action with a single input parameter and no return data. | |
virtual VarEventReporter * | getReporter () |
Get pointer to installed event reporter. | |
virtual void | installReporter (VarEventReporter *reporter) |
Install or uninstall event data reporter object. | |
virtual bool | serviceTypeMatch (const std::string &tp)=0 |
Perform a comparison to the service type string for this specific service. | |
Protected Member Functions | |
virtual bool | serviceInit (const UPnPDeviceDesc &, const UPnPServiceDesc &) |
Service-specific part of initialization. | |
bool | registerCallback (evtCBFunc c) |
Used by a derived class to register its callback method. | |
virtual void | registerCallback () |
This method will be called by installReporter() and should be overridden in classes which actually support events. | |
void | unregisterCallback () |
Cancel subscription to the service events, forget installed callback. | |
UPnPClient::Service::Service | ( | ) |
Empty object.
May be initialized later by calling initFromDescription().
|
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
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.
|
virtual |
Install or uninstall event data reporter object.
reporter | the callbacks to be installed, or nullptr to disable reporting (and cancel the upnp subscription). |
bool UPnPClient::Service::ok | ( | ) |
Check that initialization went well.
At the moment this is based on the subscription success, so that it's only meaningful after calling installReporter() (which causes the subscription request).
|
inlineprotectedvirtual |
This method will be called by installReporter() and should be overridden in classes which actually support events.
The call sequence is as follows: some_client_code() Service::installReporter() derivedActualService::registerCallback() Service::registerCallback(derivedcbfunc) The derived/actual service callback function is then in charge of calling the reporter methods upon event reception.
|
protected |
Used by a derived class to register its callback method.
This subscribes to the service events, obtaining a service subscription ID (SID), which is then linked to the callback function through a static map.
|
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.
|
virtual |
Call Soap action and return resulting data.
args | Action name and input parameters |
data | return data. |
|
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::RenderingControl, and UPnPClient::TypedService.
|
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.
tp | Service type string to be compared with the one for the derived class. |
Implemented in UPnPClient::AVTransport, UPnPClient::ContentDirectory, UPnPClient::ConnectionManager, UPnPClient::OHInfo, UPnPClient::OHPlaylist, UPnPClient::OHProduct, UPnPClient::OHRadio, UPnPClient::OHReceiver, UPnPClient::OHSender, UPnPClient::OHTime, UPnPClient::OHVolume, UPnPClient::RenderingControl, and UPnPClient::TypedService.