libUPnP 1.14.19
|
Additional, optional utility API that can be helpful in writing applications. More...
Functions | |
UPNP_EXPORT_SPEC const char * | UpnpGetErrorMessage (int errorcode) |
Converts an SDK error code into a string error message suitable for display. The memory returned from this function should NOT be freed. | |
UPNP_EXPORT_SPEC int | UpnpResolveURL (const char *BaseURL, const char *RelURL, char *AbsURL) |
Combines a base URL and a relative URL into a single absolute URL. | |
UPNP_EXPORT_SPEC int | UpnpResolveURL2 (const char *BaseURL, const char *RelURL, char **AbsURL) |
Combines a base URL and a relative URL into a single absolute URL. | |
UPNP_EXPORT_SPEC IXML_Document * | UpnpMakeAction (const char *ActionName, const char *ServType, int NumArg, const char *Arg,...) |
Creates an action request packet based on its input parameters (status variable name and value pair). | |
UPNP_EXPORT_SPEC IXML_Document * | UpnpMakeActionResponse (const char *ActionName, const char *ServType, int NumArg, const char *Arg,...) |
Ceates an action response packet based on its output parameters (status variable name and value pair). | |
UPNP_EXPORT_SPEC int | UpnpAddToAction (IXML_Document **ActionDoc, const char *ActionName, const char *ServType, const char *ArgName, const char *ArgVal) |
Adds the argument in the action request. | |
UPNP_EXPORT_SPEC int | UpnpAddToActionResponse (IXML_Document **ActionResponse, const char *ActionName, const char *ServType, const char *ArgName, const char *ArgVal) |
Creates an action response packet based on its output parameters (status variable name and value pair). | |
UPNP_EXPORT_SPEC IXML_Document * | UpnpCreatePropertySet (int NumArg, const char *Arg,...) |
Creates a property set message packet. | |
UPNP_EXPORT_SPEC int | UpnpAddToPropertySet (IXML_Document **PropSet, const char *ArgName, const char *ArgVal) |
Can be used when an application needs to transfer the status of many variables at once. | |
Additional, optional utility API that can be helpful in writing applications.
This additional API can be compiled out in order to save code size in the library. Refer to the file README for details.
UPNP_EXPORT_SPEC int UpnpAddToAction | ( | IXML_Document ** | ActionDoc, |
const char * | ActionName, | ||
const char * | ServType, | ||
const char * | ArgName, | ||
const char * | ArgVal | ||
) |
Adds the argument in the action request.
This API is specially suitable inside a loop to add any number input parameters into an existing action. If no action document exists in the beginning then a Upnp_Document variable initialized with NULL
should be passed as a parameter.
It is a wrapper function that calls addToAction() function to add the argument in the action request.
UPNP_E_SUCCESS
: The operation completed successfully. UPNP_E_INVALID_PARAM
: One or more of the parameters are invalid. UPNP_E_OUTOF_MEMORY
: Insufficient resources exist to complete this operation. [in,out] | ActionDoc | A pointer to store the action document node. |
[in] | ActionName | The action name. |
[in] | ServType | The service type. |
[in] | ArgName | The status variable name. |
[in] | ArgVal | The status variable value. |
References addToAction().
UPNP_EXPORT_SPEC int UpnpAddToActionResponse | ( | IXML_Document ** | ActionResponse, |
const char * | ActionName, | ||
const char * | ServType, | ||
const char * | ArgName, | ||
const char * | ArgVal | ||
) |
Creates an action response packet based on its output parameters (status variable name and value pair).
This API is especially suitable inside a loop to add any number of input parameters into an existing action response. If no action document exists in the beginning, a Upnp_Document variable initialized with NULL
should be passed as a parameter.
It is a wrapper function that calls addToAction() function to add the argument in the action request.
UPNP_E_SUCCESS
: The operation completed successfully. UPNP_E_INVALID_PARAM
: One or more of the parameters are invalid. UPNP_E_OUTOF_MEMORY
: Insufficient resources exist to complete this operation. [in,out] | ActionResponse | Pointer to a document to store the action document node. |
[in] | ActionName | The action name. |
[in] | ServType | The service type. |
[in] | ArgName | The status variable name. |
[in] | ArgVal | The status variable value. |
References addToAction().
Referenced by IncrementBrightness(), IncrementColor(), IncrementContrast(), IncrementVolume(), TvDevicePowerOff(), TvDevicePowerOn(), TvDeviceSetBrightness(), TvDeviceSetChannel(), TvDeviceSetColor(), TvDeviceSetContrast(), TvDeviceSetTint(), and TvDeviceSetVolume().
UPNP_EXPORT_SPEC int UpnpAddToPropertySet | ( | IXML_Document ** | PropSet, |
const char * | ArgName, | ||
const char * | ArgVal | ||
) |
Can be used when an application needs to transfer the status of many variables at once.
It can be used (inside a loop) to add some extra status variables into an existing property set. If the application does not already have a property set document, the application should create a variable initialized with NULL
and pass that as the first parameter.
UPNP_E_SUCCESS
: The operation completed successfully. UPNP_E_INVALID_PARAM
: One or more of the parameters are invalid. UPNP_E_OUTOF_MEMORY
: Insufficient resources exist to complete this operation. [in,out] | PropSet | A pointer to the document containing the property set document node. |
[in] | ArgName | The status variable name. |
[in] | ArgVal | The status variable value. |
References ixmlDocument_createElement(), ixmlDocument_createTextNode(), ixmlNode_appendChild(), ixmlNode_getFirstChild(), ixmlParseBufferEx(), ErrorString::rc, UPNP_E_INVALID_PARAM, UPNP_E_OUTOF_MEMORY, and UPNP_E_SUCCESS.
Referenced by TvDeviceHandleSubscriptionRequest().
UPNP_EXPORT_SPEC IXML_Document * UpnpCreatePropertySet | ( | int | NumArg, |
const char * | Arg, | ||
... | |||
) |
Creates a property set message packet.
Any number of input parameters can be passed to this function but every input variable name should have a matching value input argument.
NULL
on failure, or the property-set document node. [in] | NumArg | The number of argument pairs passed. |
[in] | Arg | The status variable name and value pair. |
[in] | ... | Variable sized list with the rest of the parameters. |
References ixmlDocument_createElement(), ixmlDocument_createTextNode(), ixmlNode_appendChild(), ixmlNode_getFirstChild(), and ixmlParseBufferEx().
Referenced by TvDeviceSetServiceTableVar().
UPNP_EXPORT_SPEC const char * UpnpGetErrorMessage | ( | int | errorcode | ) |
Converts an SDK error code into a string error message suitable for display. The memory returned from this function should NOT be freed.
[in] | errorcode | The SDK error code to convert. |
References ErrorMessages, ErrorString::rc, and ErrorString::rcError.
UPNP_EXPORT_SPEC IXML_Document * UpnpMakeAction | ( | const char * | ActionName, |
const char * | ServType, | ||
int | NumArg, | ||
const char * | Arg, | ||
... | |||
) |
Creates an action request packet based on its input parameters (status variable name and value pair).
Any number of input parameters can be passed to this function but every input variable name should have a matching value argument.
It is a wrapper function that calls makeAction() function to create the action request.
NULL
if the operation failed. [in] | ActionName | Name of the action request or response. |
[in] | ServType | The service type. |
[in] | NumArg | Number of argument pairs to be passed. |
[in] | Arg | pointer to the first argument. |
[in] | ... | Argument list. |
References makeAction().
UPNP_EXPORT_SPEC IXML_Document * UpnpMakeActionResponse | ( | const char * | ActionName, |
const char * | ServType, | ||
int | NumArg, | ||
const char * | Arg, | ||
... | |||
) |
Ceates an action response packet based on its output parameters (status variable name and value pair).
Any number of input parameters can be passed to this function but every output variable name should have a matching value argument.
It is a wrapper function that calls makeAction() function to create the action request.
NULL
if the operation failed. [in] | ActionName | The action name. |
[in] | ServType | The service type.. |
[in] | NumArg | The number of argument pairs passed. |
[in] | Arg | The status variable name and value pair. |
[in] | ... | Other status variable name and value pairs. |
References makeAction().
UPNP_EXPORT_SPEC int UpnpResolveURL | ( | const char * | BaseURL, |
const char * | RelURL, | ||
char * | AbsURL | ||
) |
Combines a base URL and a relative URL into a single absolute URL.
The memory for AbsURL needs to be allocated by the caller and must be large enough to hold the BaseURL and RelURL combined.
UPNP_E_SUCCESS
: The operation completed successfully. UPNP_E_INVALID_PARAM
: RelURL is NULL
. UPNP_E_INVALID_URL
: The BaseURL / RelURL combination does not form a valid URL. UPNP_E_OUTOF_MEMORY
: Insufficient resources exist to complete this operation.[in] | BaseURL | The base URL to combine. |
[in] | RelURL | The relative URL to BaseURL. |
[out] | AbsURL | A pointer to a buffer to store the absolute URL. |
References resolve_rel_url(), UPNP_E_INVALID_PARAM, UPNP_E_INVALID_URL, and UPNP_E_SUCCESS.
UPNP_EXPORT_SPEC int UpnpResolveURL2 | ( | const char * | BaseURL, |
const char * | RelURL, | ||
char ** | AbsURL | ||
) |
Combines a base URL and a relative URL into a single absolute URL.
The memory for AbsURL becomes owned by the caller and should be freed later.
UPNP_E_SUCCESS
: The operation completed successfully. UPNP_E_INVALID_PARAM
: RelURL is NULL
. UPNP_E_INVALID_URL
: The BaseURL / RelURL combination does not form a valid URL. UPNP_E_OUTOF_MEMORY
: Insufficient resources exist to complete this operation. [in] | BaseURL | The base URL to combine. |
[in] | RelURL | The relative URL to BaseURL. |
[out] | AbsURL | A pointer to a pointer to a buffer to store the absolute URL. Must be freed later by the caller. |
References resolve_rel_url(), UPNP_E_INVALID_PARAM, UPNP_E_INVALID_URL, and UPNP_E_SUCCESS.
Referenced by SampleUtil_FindAndParseService().