Class to manage a SOAP envelope for service request/response. More...

#include <Envelope.h>

Collaboration diagram for UPnP::Envelope:

Classes

class  Fault
 

Public Types

enum class  ContentType { none , fault , request , response }
 

Public Member Functions

 Envelope (const Service &service)
 
void clear ()
 Wipe the envelope contents. More...
 
bool isEmpty () const
 
bool isFault () const
 
String serialize (bool pretty)
 Obtain content as XML string. More...
 
size_t serialize (Print &p, bool pretty)
 Serialize XML content to a stream. More...
 
ContentType contentType () const
 Get the current envelope content type. More...
 
String actionName () const
 Get the action name. More...
 
EnvelopecreateRequest (const String &actionName)
 Initialise the envelope as a request. More...
 
EnvelopecreateResponse (const String &actionName)
 Initialise the envelope as a response. More...
 
void convertToResponse ()
 Set a flag that this should be converted to Response on next setArg() call. More...
 
void prepareResponse ()
 If Response is required but hasn't been prepared yet, do it now. This wipes out the incoming request. More...
 
Fault createFault (ErrorCode error)
 Initialise the envelope as a fault. More...
 
String soapAction () const
 
Error load (String &&content)
 Load a SOAP document. More...
 
Error load (const FlashString &content)
 
Fetch fault object
Fault fault ()
 
const Fault fault () const
 
Argument getters
const char * getArgValue (const String &name) const
 
String getArg (const String &name) const
 
bool getArg (const String &name, char &value, char defaultValue='?')
 
bool getArg (const String &name, String &value)
 
template<typename T >
std::enable_if< std::is_unsigned< T >::value &&!std::is_floating_point< T >::value, bool >::type getArg (const String &name, T &value, T defaultValue=T{})
 
template<typename T >
std::enable_if< std::is_signed< T >::value &&!std::is_floating_point< T >::value, bool >::type getArg (const String &name, T &value, T defaultValue=T{})
 
bool getArg (const String &name, bool &value, bool defaultValue=false)
 
bool getArg (const String &name, uint32_t &value, uint32_t defaultValue=0)
 
bool getArg (const String &name, int32_t &value, int32_t defaultValue=0)
 
bool getArg (const String &name, float &value, float defaultValue=0.0)
 
bool getArg (const String &name, double &value, double defaultValue=0.0)
 
bool getArg (const String &name, Base64 &value)
 
Argument setters
bool addArg (const String &name, const String &value)
 
bool addArg (const String &name, const char *value)
 
bool addArg (const String &name, bool value)
 
bool addArg (const String &name, const Base64 &value)
 
template<typename T >
bool addArg (const String &name, T value)
 

Public Attributes

const Serviceservice
 

Detailed Description

Class to manage a SOAP envelope for service request/response.

Member Enumeration Documentation

◆ ContentType

Enumerator
none 
fault 
request 
response 

Constructor & Destructor Documentation

◆ Envelope()

UPnP::Envelope::Envelope ( const Service service)
inline

Member Function Documentation

◆ actionName()

String UPnP::Envelope::actionName ( ) const
inline

Get the action name.

◆ addArg() [1/5]

bool UPnP::Envelope::addArg ( const String name,
bool  value 
)
inline

◆ addArg() [2/5]

bool UPnP::Envelope::addArg ( const String name,
const Base64 value 
)
inline

◆ addArg() [3/5]

bool UPnP::Envelope::addArg ( const String name,
const char *  value 
)
inline

◆ addArg() [4/5]

bool UPnP::Envelope::addArg ( const String name,
const String value 
)
inline

◆ addArg() [5/5]

template<typename T >
bool UPnP::Envelope::addArg ( const String name,
value 
)
inline

◆ clear()

void UPnP::Envelope::clear ( )

Wipe the envelope contents.

◆ contentType()

ContentType UPnP::Envelope::contentType ( ) const
inline

Get the current envelope content type.

◆ convertToResponse()

void UPnP::Envelope::convertToResponse ( )
inline

Set a flag that this should be converted to Response on next setArg() call.

◆ createFault()

Fault UPnP::Envelope::createFault ( ErrorCode  error)

Initialise the envelope as a fault.

◆ createRequest()

Envelope& UPnP::Envelope::createRequest ( const String actionName)

Initialise the envelope as a request.

◆ createResponse()

Envelope& UPnP::Envelope::createResponse ( const String actionName)

Initialise the envelope as a response.

◆ fault() [1/2]

Fault UPnP::Envelope::fault ( )
inline

◆ fault() [2/2]

const Fault UPnP::Envelope::fault ( ) const
inline

◆ getArg() [1/11]

String UPnP::Envelope::getArg ( const String name) const
inline

◆ getArg() [2/11]

bool UPnP::Envelope::getArg ( const String name,
Base64 value 
)
inline

◆ getArg() [3/11]

bool UPnP::Envelope::getArg ( const String name,
bool &  value,
bool  defaultValue = false 
)

◆ getArg() [4/11]

bool UPnP::Envelope::getArg ( const String name,
char &  value,
char  defaultValue = '?' 
)
inline

◆ getArg() [5/11]

bool UPnP::Envelope::getArg ( const String name,
double &  value,
double  defaultValue = 0.0 
)

◆ getArg() [6/11]

bool UPnP::Envelope::getArg ( const String name,
float &  value,
float  defaultValue = 0.0 
)

◆ getArg() [7/11]

bool UPnP::Envelope::getArg ( const String name,
int32_t &  value,
int32_t  defaultValue = 0 
)

◆ getArg() [8/11]

bool UPnP::Envelope::getArg ( const String name,
String value 
)
inline

◆ getArg() [9/11]

template<typename T >
std::enable_if<std::is_unsigned<T>::value && !std::is_floating_point<T>::value, bool>::type UPnP::Envelope::getArg ( const String name,
T &  value,
defaultValue = T{} 
)
inline

◆ getArg() [10/11]

template<typename T >
std::enable_if<std::is_signed<T>::value && !std::is_floating_point<T>::value, bool>::type UPnP::Envelope::getArg ( const String name,
T &  value,
defaultValue = T{} 
)
inline

◆ getArg() [11/11]

bool UPnP::Envelope::getArg ( const String name,
uint32_t &  value,
uint32_t  defaultValue = 0 
)

◆ getArgValue()

const char* UPnP::Envelope::getArgValue ( const String name) const
inline

◆ isEmpty()

bool UPnP::Envelope::isEmpty ( ) const
inline

◆ isFault()

bool UPnP::Envelope::isFault ( ) const
inline

◆ load() [1/2]

Error UPnP::Envelope::load ( const FlashString content)

◆ load() [2/2]

Error UPnP::Envelope::load ( String &&  content)

Load a SOAP document.

Parameters
contentMUST remain valid for the lifetime of this Envelope, or until initialise() is called.

◆ prepareResponse()

void UPnP::Envelope::prepareResponse ( )
inline

If Response is required but hasn't been prepared yet, do it now. This wipes out the incoming request.

◆ serialize() [1/2]

String UPnP::Envelope::serialize ( bool  pretty)
inline

Obtain content as XML string.

◆ serialize() [2/2]

size_t UPnP::Envelope::serialize ( Print p,
bool  pretty 
)
inline

Serialize XML content to a stream.

◆ soapAction()

String UPnP::Envelope::soapAction ( ) const

Member Data Documentation

◆ service

const Service& UPnP::Envelope::service

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