Represents any kind of device, including a root device. More...
#include <Service.h>
Public Types | |
enum class | Field { XX , customStart = domain , MAX } |
using | List = ObjectList< Service > |
using | OwnedList = OwnedObjectList< Service > |
Public Types inherited from UPnP::Object | |
using | Version = ObjectClass::Version |
Public Member Functions | |
Service (Device &device) | |
Device & | root () |
String | caption () const |
void | search (const SearchFilter &filter) override |
Called during SSDP search operation. More... | |
bool | formatMessage (Message &msg, MessageSpec &ms) override |
Standard fields have been completed. More... | |
bool | onHttpRequest (HttpServerConnection &connection) override |
Called by framework to handle an incoming HTTP request. More... | |
virtual String | getField (Field desc) const |
Urn | objectType () const override |
String | serviceId () const |
XML::Node * | getDescription (XML::Document &doc, DescType descType) const override |
IDataSourceStream * | createDescription () override |
Called by framework to construct a device description response stream. More... | |
Device & | device () const |
virtual bool | sendRequest (HttpRequest *request) const |
Implemented in ServiceControl. More... | |
virtual Error | handleAction (ActionRequest &req)=0 |
An action request has been received. More... | |
Public Member Functions inherited from UPnP::ObjectTemplate< Service, Object > | |
Service * | getNext () const |
Iterator | begin () const |
Iterator | end () const |
Public Member Functions inherited from UPnP::Object | |
virtual const ObjectClass & | getClass () const =0 |
Object * | getNext () const |
bool | typeIs (const Urn &objectType) const |
bool | typeIs (const String &objectType) const |
bool | typeIs (const ObjectClass &objectClass) const |
virtual Version | version () 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 | |
Item * | next () const override |
LinkedItem * | getNext () const |
Public Member Functions inherited from UPnP::Item | |
virtual | ~Item () |
virtual ItemEnumerator * | getList (unsigned index, String &name) |
bool | operator== (const Item &other) const |
Detailed Description
Represents any kind of device, including a root device.
Member Typedef Documentation
◆ List
using UPnP::Service::List = ObjectList<Service> |
◆ OwnedList
Member Enumeration Documentation
◆ Field
|
strong |
Constructor & Destructor Documentation
◆ Service()
|
inline |
Member Function Documentation
◆ caption()
|
inline |
◆ createDescription()
|
overridevirtual |
Called by framework to construct a device description response stream.
- Return values
-
IDataSourceStream* The XML description content
By default, the framework generates a stream constructed from the device information fields, but this method may be overridden if, for example, a fixed description is stored in an .xml file.
Reimplemented from UPnP::Object.
◆ device()
|
inline |
◆ formatMessage()
|
overridevirtual |
Standard fields have been completed.
- Note
- Fields can be modified typically by adding any custom fields before sending response.
- Parameters
-
msg The message being constructed ms Template spec. for message
- Return values
-
bool Return true to send message, false to cancel
Implements UPnP::BaseObject.
◆ getDescription()
|
overridevirtual |
Reimplemented from UPnP::Item.
◆ getField()
Reimplemented in UPnP::ServiceControl.
◆ handleAction()
|
pure virtual |
An action request has been received.
- Parameters
-
env Contains the action request
- Return values
-
ErrorCode Implementation should place response into env
after reading parameters, e.g.:if(env.actionName() == "MyAction") { String arg1; int arg2; env.getArg("arg1", arg1); env.getArg("arg2", arg2); auto& response = env.createResponse(); // Process command here int arg3 = processMyAction(arg1, arg2); response.setArg("arg3", arg3); return ErrorCode::Success; } return ErrorCode::InvalidAction;
This is usually handled by generated wrapper class templates.
Implemented in UPnP::ServiceControl.
◆ objectType()
|
inlineoverridevirtual |
Reimplemented from UPnP::Object.
◆ onHttpRequest()
|
overridevirtual |
Called by framework to handle an incoming HTTP request.
- Parameters
-
connection request response
- Return values
-
bool true if request was handled
Reimplemented from UPnP::Object.
◆ root()
Device& UPnP::Service::root | ( | ) |
◆ search()
|
overridevirtual |
Called during SSDP search operation.
Implements UPnP::Object.
◆ sendRequest()
|
inlinevirtual |
Implemented in ServiceControl.
Reimplemented in UPnP::ServiceControl.
◆ serviceId()
|
inline |
The documentation for this class was generated from the following file: