39 #ifndef _PLT_SERVICE_H_    40 #define _PLT_SERVICE_H_    83                 const char*     last_change_namespace = NULL);
    91     NPT_Result 
InitURLs(
const char* service_name);
    97     bool IsValid() {  
return (m_ActionDescs.GetItemCount() > 0); }
   109         if (value.Compare(
"1", 
true)    && 
   110             value.Compare(
"true", 
true) && 
   111             value.Compare(
"yes", 
true)) {
   122     NPT_Result 
SetSCPDURL(
const char* url)     { m_SCPDURL = url; 
return NPT_SUCCESS; }
   128     NPT_Result SetControlURL(
const char* url)  { m_ControlURL = url; 
return NPT_SUCCESS; };
   135     NPT_Result 
SetEventSubURL(
const char* url) { m_EventSubURL = url; 
return NPT_SUCCESS; };
   221     NPT_Result 
SetStateVariable(
const char* name, 
const char* value, 
const bool clearonsend = 
false);
   294         PLT_ServiceEventTask(
PLT_Service* service) : m_Service(service) {}
   296         void DoRun()
 override { 
   297             while (!IsAborting(100)) m_Service->NotifyChanged();
   325     NPT_Result NotifyChanged();
   331     NPT_Result ProcessNewSubscription(
   342     NPT_Result ProcessRenewSubscription(
   352     NPT_Result ProcessCancelSubscription(
   371     PLT_ServiceEventTask*                   m_EventTask;
   378     bool                                    m_EventingPaused;
   395     bool operator()(
PLT_Service* 
const & service) 
const;
   415     bool operator()(
PLT_Service* 
const & service) 
const;
   435     bool operator()(
PLT_Service* 
const & service) 
const;
   455     bool operator()(
PLT_Service* 
const & service) 
const;
   475     bool operator()(
PLT_Service* 
const & service) 
const;
   495     bool operator()(
PLT_Service* 
const & service) 
const;
 NPT_Result GetSCPDXML(NPT_String &xml)
Return the service SCPD xml document. 
Definition: PltService.cpp:91
NPT_Result InitURLs(const char *service_name)
When service is hosted by a PLT_DeviceHost, this setups the SCPD, control and event urls...
Definition: PltService.cpp:156
const NPT_List< PLT_StateVariable * > & GetStateVariables() const
Return the list of state variables. 
Definition: PltService.h:270
The PLT_LastChangeXMLIterator class is used to serialize the LastChange variable changes into xml giv...
Definition: PltService.h:509
The PLT_ActionDesc class provides information about a UPnP Service given action. 
Definition: PltAction.h:61
const NPT_Array< PLT_ActionDesc * > & GetActionDescs() const
Return an array of actions descriptions PLT_ActionDesc. 
Definition: PltService.h:283
Definition: NptHttp.h:315
UPnP Service Action Argument. 
Definition: NptArray.h:54
The PLT_ServiceIDFinder class returns an instance of a PLT_Service given a service id...
Definition: PltService.h:449
NPT_Result ForceVersion(NPT_Cardinal version)
When a control point discover a new service with a higher version number than it can work with...
Definition: PltService.cpp:401
UPnP Service. 
Definition: PltService.h:67
NPT_Result SetSCPDXML(const char *xml)
Set the service SCPD xml document. 
Definition: PltService.cpp:172
Definition: NptThreads.h:76
NPT_Result GetStateVariableValue(const char *name, NPT_String &value)
Return the state variable value given a state variable name. 
Definition: PltService.cpp:436
PLT_DeviceData * GetDevice()
Return the PLT_DeviceData* the service is associated with. 
Definition: PltService.h:183
NPT_Result PauseEventing(bool pause=true)
When a PLT_DeviceHost needs to change more than one state variables at a time but would rather send o...
Definition: PltService.cpp:774
NPT_Result SetStateVariableExtraAttribute(const char *name, const char *key, const char *value)
Certain state variables require extra xml attributes when serialized. 
Definition: PltService.cpp:490
The PLT_StateVariable class maintains the state of a UPnP Service state variable. ...
Definition: PltStateVariable.h:75
Definition: NptSockets.h:77
PLT_StateVariable * FindStateVariable(const char *name)
Return the PLT_StateVariable pointer given a state variable name. 
Definition: PltService.cpp:425
PLT_ActionDesc * FindActionDesc(const char *name)
Return the PLT_ActionDesc given an action name. 
Definition: PltService.cpp:414
NPT_String GetEventSubURL(bool absolute=false)
Return the Event subscription url associated with this service. 
Definition: PltService.cpp:391
The PLT_ServiceNameFinder class returns an instance of a PLT_Service given a service name...
Definition: PltService.h:489
bool IsSubscribable()
Return whether a service is capable of sending events. 
Definition: PltService.cpp:448
The PLT_DeviceData class holds information about a device being advertised or found by a control poin...
Definition: PltDeviceData.h:93
The PLT_ServiceEventSubURLFinder class returns an instance of a PLT_Service given a service event sub...
Definition: PltService.h:429
UPnP Device Host. 
Definition: PltDeviceHost.h:69
The PLT_ServiceSCPDURLFinder class returns an instance of a PLT_Service given a service SCPD url...
Definition: PltService.h:389
NPT_Result SetStateVariable(const char *name, const char *value, const bool clearonsend=false)
Set a new value for a given state variable. 
Definition: PltService.cpp:462
const NPT_String & GetServiceType() const
Return the service type. 
Definition: PltService.h:171
NPT_Result GetDescription(NPT_XmlElementNode *parent, NPT_XmlElementNode **service=NULL)
Populate the UPnP Device description document with service information. 
Definition: PltService.cpp:136
The PLT_ServiceTypeFinder class returns an instance of a PLT_Service given a service type...
Definition: PltService.h:469
PLT_Service(PLT_DeviceData *device, const char *type, const char *id, const char *name, const char *last_change_namespace=NULL)
Create an instance of a UPnP Service either hosted or discovered. 
Definition: PltService.cpp:49
const NPT_String & GetServiceName() const
Return the service friendly name. 
Definition: PltService.h:177
NPT_String GetSCPDURL(bool absolute=false)
Return the SCPD url associated with this service. 
Definition: PltService.cpp:371
const NPT_String & GetServiceID() const
Return the service id. 
Definition: PltService.h:165
The PLT_ServiceControlURLFinder class returns an instance of a PLT_Service given a service control ur...
Definition: PltService.h:409
The PLT_ThreadTask class is a base class for executing a given task in a worker thread. 
Definition: PltThreadTask.h:56
Definition: NptStrings.h:57
NPT_String GetControlURL(bool absolute=false)
Return the Control url associated with this service. 
Definition: PltService.cpp:381
bool IsValid()
Verify the service has been properly initialized or is a valid discovered service. 
Definition: PltService.h:97
NPT_Result SetSCPDURL(const char *url)
Set the SCPD url for control points to be able to fetch the SCPD xml document. 
Definition: PltService.h:122
NPT_Result IncStateVariable(const char *name)
Helper function to increment a state variable representing a number. 
Definition: PltService.cpp:506
NPT_Result SetStateVariableRate(const char *name, NPT_TimeInterval rate)
Certain state variables notifications must not be sent faster than a certain rate according to the UP...
Definition: PltService.cpp:476
NPT_Result SetEventSubURL(const char *url)
Set the Service Event subscription url for control points to be able to subscribe to events...
Definition: PltService.h:135