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);
}

廣告

發表迴響

在下方填入你的資料或按右方圖示以社群網站登入:

WordPress.com Logo

您的留言將使用 WordPress.com 帳號。 登出 / 變更 )

Twitter picture

您的留言將使用 Twitter 帳號。 登出 / 變更 )

Facebook照片

您的留言將使用 Facebook 帳號。 登出 / 變更 )

Google+ photo

您的留言將使用 Google+ 帳號。 登出 / 變更 )

連結到 %s