Platinum UPnP SDK
Public Member Functions | Static Public Member Functions | List of all members
PLT_Action Class Reference

The PLT_Action class provides a mechanism to call or verify the validity of a specific UPNP service action. More...

#include <PltAction.h>

Public Member Functions

 PLT_Action (PLT_ActionDesc &action_desc)
 Constructor.
 
 PLT_Action (PLT_ActionDesc &action_desc, PLT_DeviceDataReference &root_device)
 Constructor.
 
NPT_Result FormatSoapRequest (NPT_OutputStream &stream)
 Called by a control point when serializing an action.
 
NPT_Result FormatSoapResponse (NPT_OutputStream &stream)
 Called by a device when serializing a response to an action.
 
PLT_ActionDescGetActionDesc ()
 Return the action description.
 
NPT_Result GetArgumentValue (const char *name, NPT_String &value)
 Retrieve the string value of an argument given an argument name.
 
NPT_Result GetArgumentValue (const char *name, NPT_UInt32 &value)
 Retrieve the value of an argument given an argument name.
 
NPT_Result GetArgumentValue (const char *name, NPT_Int32 &value)
 Retrieve the value of an argument given an argument name.
 
NPT_Result GetArgumentValue (const char *name, bool &value)
 Retrieve the value of an argument given an argument name.
 
const char * GetError (unsigned int *code=NULL)
 Return the error description and code for the failed action.
 
unsigned int GetErrorCode ()
 Return the error code for the failed action.
 
NPT_Result SetArgumentOutFromStateVariable (const char *name)
 Set the output argument value from the associated current state variable value.
 
NPT_Result SetArgumentsOutFromStateVariable ()
 Set all the output argument values associated with state variables.
 
NPT_Result SetArgumentValue (const char *name, const char *value)
 Set an argument value.
 
NPT_Result SetError (unsigned int code, const char *description)
 Set the error code and description in case of failure.
 
NPT_Result VerifyArguments (bool input)
 Verify that all required arguments are set.
 
NPT_Result VerifyArgumentValue (const char *name, const char *value)
 Verify a value is valid for a given argument.
 

Static Public Member Functions

static NPT_Result FormatSoapError (unsigned int code, NPT_String desc, NPT_OutputStream &stream)
 Helper method for a device to serialize an action invocation error.
 

Detailed Description

The PLT_Action class provides a mechanism to call or verify the validity of a specific UPNP service action.

Given a service, a UPnP Control Point would use this class to serialize a soap request. On the other side, a UPnP Device would use this class to verify a soap request and the validity of the action arguments.

Constructor & Destructor Documentation

PLT_Action::PLT_Action ( PLT_ActionDesc action_desc)

Constructor.

Parameters
action_descthe action description If you intend to send an action, you need to use the second constructor and pass the root device of the device you wish to control.
PLT_Action::PLT_Action ( PLT_ActionDesc action_desc,
PLT_DeviceDataReference &  root_device 
)

Constructor.

Parameters
action_descthe action description
root_devicea reference to the root device of the service the action is associated with. This insures that the device won't be deleted if it goes away while we're waiting for a response for this action. This is important because we only keep a reference to the PLT_ActionDesc which is own by the service operated by the device (or embedded device).

Member Function Documentation

static NPT_Result PLT_Action::FormatSoapError ( unsigned int  code,
NPT_String  desc,
NPT_OutputStream &  stream 
)
static

Helper method for a device to serialize an action invocation error.

Parameters
codeoptional pointer to receive the code
descthe error short description
streamthe stream to serialize to
NPT_Result PLT_Action::FormatSoapRequest ( NPT_OutputStream &  stream)

Called by a control point when serializing an action.

Parameters
streamthe stream to serialize the action to
NPT_Result PLT_Action::FormatSoapResponse ( NPT_OutputStream &  stream)

Called by a device when serializing a response to an action.

Parameters
streamthe stream to serialize the action to
PLT_ActionDesc& PLT_Action::GetActionDesc ( )
inline

Return the action description.

Returns
the action description
NPT_Result PLT_Action::GetArgumentValue ( const char *  name,
NPT_String &  value 
)

Retrieve the string value of an argument given an argument name.

Parameters
namethe argument name
valuethe string value to retrieve
Returns
error if the argument is not found or if the type does not correspond.
NPT_Result PLT_Action::GetArgumentValue ( const char *  name,
NPT_UInt32 &  value 
)

Retrieve the value of an argument given an argument name.

Parameters
namethe argument name
valuethe unsigned int value to retrieve
Returns
error if the argument is not found or if the type does not correspond.
NPT_Result PLT_Action::GetArgumentValue ( const char *  name,
NPT_Int32 &  value 
)

Retrieve the value of an argument given an argument name.

Parameters
namethe argument name
valuethe int value to retrieve
Returns
error if the argument is not found or if the type does not correspond.
NPT_Result PLT_Action::GetArgumentValue ( const char *  name,
bool &  value 
)

Retrieve the value of an argument given an argument name.

Parameters
namethe argument name
valuethe bool value to retrieve
Returns
error if the argument is not found or if the type does not correspond.
const char* PLT_Action::GetError ( unsigned int *  code = NULL)

Return the error description and code for the failed action.

Parameters
codeoptional pointer to receive the code
Returns
the error short description
unsigned int PLT_Action::GetErrorCode ( )

Return the error code for the failed action.

Returns
the error code.
NPT_Result PLT_Action::SetArgumentOutFromStateVariable ( const char *  name)

Set the output argument value from the associated current state variable value.

Parameters
namethe state variable name
NPT_Result PLT_Action::SetArgumentsOutFromStateVariable ( )

Set all the output argument values associated with state variables.

NPT_Result PLT_Action::SetArgumentValue ( const char *  name,
const char *  value 
)

Set an argument value.

Parameters
namethe argument name
valuethe argument value
NPT_Result PLT_Action::SetError ( unsigned int  code,
const char *  description 
)

Set the error code and description in case of failure.

Parameters
codethe code for the error
descriptiona short description
NPT_Result PLT_Action::VerifyArguments ( bool  input)

Verify that all required arguments are set.

Parameters
inputboolean indicating whether input or output parameters should be verified
NPT_Result PLT_Action::VerifyArgumentValue ( const char *  name,
const char *  value 
)

Verify a value is valid for a given argument.

Parameters
namethe argument name
valuethe value to verify

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