kodi
Public Member Functions | Static Public Member Functions | Protected Attributes | 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>

Collaboration diagram for PLT_Action:
Collaboration graph
[legend]

Public Member Functions

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

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. More...
 

Protected Attributes

PLT_ActionDescm_ActionDesc
 
PLT_Arguments m_Arguments
 
unsigned int m_ErrorCode
 
NPT_String m_ErrorDescription
 
PLT_DeviceDataReference m_RootDevice
 

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() [1/2]

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() [2/2]

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

◆ FormatSoapError()

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

◆ FormatSoapRequest()

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

◆ FormatSoapResponse()

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

◆ GetActionDesc()

PLT_ActionDesc& PLT_Action::GetActionDesc ( )
inline

Return the action description.

Returns
the action description

◆ GetArgumentValue() [1/4]

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.

◆ GetArgumentValue() [2/4]

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.

◆ GetArgumentValue() [3/4]

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.

◆ GetArgumentValue() [4/4]

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.

◆ GetError()

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

◆ GetErrorCode()

unsigned int PLT_Action::GetErrorCode ( )

Return the error code for the failed action.

Returns
the error code.

◆ SetArgumentOutFromStateVariable()

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

◆ SetArgumentValue()

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

Set an argument value.

Parameters
namethe argument name
valuethe argument value

◆ SetError()

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

◆ VerifyArguments()

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

◆ VerifyArgumentValue()

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 files: