月份:八月 2007

UPnP Intel builder Send Variable update

Posted on

every state variables of UPnP AVT RCS should be updated to CP by through of LastChange variable 56
every state variables of UPnP AVT RCS should be updated to CP by through of LastChange variable.
the variable (LastChange) should be well formated as <Event ……> </Event>
the codes are as following:

void UPnPFireLastChangeEvent(UPnPMicroStackToken upnptoken, char * service_name, char *var_name, char* val)
{
char *tmpXML = (char *) malloc(strlen(service_name) + strlen(val) + strlen(var_name) + 103 + 20) ;
char *eventXML = NULL;

sprintf( tmpXML , “<Event xmlns=\"urn:schemas-upnp-org:metadata-1-0/%s/\">"
“<InstanceID val=\"0\">"
“<%s val=\"%s\"/>"
“</InstanceID></Event>", service_name,var_name,val);

eventXML = (char*)malloc(ILibXmlEscapeLength(tmpXML)+1);
if ( tmpXML == NULL || eventXML == NULL)
return;

ILibXmlEscape(eventXML,tmpXML);

if ( ! strncmp(“AVT",service_name,3) )
{
UPnPSetState_AVTransport_LastChange(UPnPmicroStack, eventXML);
}
else if ( ! strncmp(“RCS",service_name,3) )
{
UPnPSetState_RenderingControl_LastChange(UPnPmicroStack, eventXML);
}
else
{
fprintf(stderr,"%s %d: Service Nmae should be \"AVT\" or \"RCS\"\n",__FILE__,__LINE__);
}

if ( eventXML) free (eventXML);
if ( tmpXML ) free ( tmpXML);
}

廣告