kodi
|
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. More... | |
PLT_Action (PLT_ActionDesc &action_desc, PLT_DeviceDataReference &root_device) | |
Constructor. More... | |
PLT_ActionDesc & | GetActionDesc () |
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_ActionDesc & | m_ActionDesc |
PLT_Arguments | m_Arguments |
unsigned int | m_ErrorCode |
NPT_String | m_ErrorDescription |
PLT_DeviceDataReference | m_RootDevice |
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.
PLT_Action::PLT_Action | ( | PLT_ActionDesc & | action_desc | ) |
Constructor.
action_desc | the 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.
action_desc | the action description |
root_device | a 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). |
|
static |
Helper method for a device to serialize an action invocation error.
code | optional pointer to receive the code |
desc | the error short description |
stream | the stream to serialize to |
NPT_Result PLT_Action::FormatSoapRequest | ( | NPT_OutputStream & | stream | ) |
Called by a control point when serializing an action.
stream | the 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.
stream | the stream to serialize the action to |
|
inline |
Return 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.
name | the argument name |
value | the string value to retrieve |
NPT_Result PLT_Action::GetArgumentValue | ( | const char * | name, |
NPT_UInt32 & | value | ||
) |
Retrieve the value of an argument given an argument name.
name | the argument name |
value | the unsigned int value to retrieve |
NPT_Result PLT_Action::GetArgumentValue | ( | const char * | name, |
NPT_Int32 & | value | ||
) |
Retrieve the value of an argument given an argument name.
name | the argument name |
value | the int value to retrieve |
NPT_Result PLT_Action::GetArgumentValue | ( | const char * | name, |
bool & | value | ||
) |
Retrieve the value of an argument given an argument name.
name | the argument name |
value | the bool value to retrieve |
const char * PLT_Action::GetError | ( | unsigned int * | code = NULL | ) |
Return the error description and code for the failed action.
code | optional pointer to receive the code |
unsigned int PLT_Action::GetErrorCode | ( | ) |
Return the error code for the failed action.
NPT_Result PLT_Action::SetArgumentOutFromStateVariable | ( | const char * | name | ) |
Set the output argument value from the associated current state variable value.
name | the state variable name |
NPT_Result PLT_Action::SetArgumentValue | ( | const char * | name, |
const char * | value | ||
) |
Set an argument value.
name | the argument name |
value | the argument value |
NPT_Result PLT_Action::SetError | ( | unsigned int | code, |
const char * | description | ||
) |
Set the error code and description in case of failure.
code | the code for the error |
description | a short description |
NPT_Result PLT_Action::VerifyArguments | ( | bool | input | ) |
Verify that all required arguments are set.
input | boolean 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.
name | the argument name |
value | the value to verify |