* Return a real value for the SystemUpdateID evented variable.

This commit is contained in:
Justin Maggard 2009-03-31 02:48:55 +00:00
parent 2e3a4f1dde
commit 29aa8608c2
2 changed files with 14 additions and 10 deletions

View File

@ -17,6 +17,7 @@ char friendly_name[] = "localhost: system_type";
char serialnumber[] = "12345678";
char modelnumber[] = "1";
char presentationurl[] = "http://192.168.0.1:8080/";
unsigned int updateID = 0;
int getifaddr(const char * ifname, char * buf, int len)
{

View File

@ -400,7 +400,7 @@ static const struct stateVar ContentDirectoryVars[] =
//JM{"A_ARG_TYPE_URI", 5, 0}, /* 15 */
{"SearchCapabilities", 0, 0},
{"SortCapabilities", 0, 0},
{"SystemUpdateID", 3|0x80, 0, 46, 46},
{"SystemUpdateID", 3|0x80, 0, 46, 255},
//{"ContainerUpdateIDs", 0, 0},
{0, 0}
};
@ -792,33 +792,36 @@ genEventVars(int * len, const struct serviceDesc * s, const char * servns)
const struct stateVar * v;
char * str;
int tmplen;
char buf[512];
tmplen = 512;
str = (char *)malloc(tmplen);
if(str == NULL)
return NULL;
*len = 0;
v = s->serviceStateTable;
str = strcat_str(str, len, &tmplen, "<e:propertyset xmlns:e=\"urn:schemas-upnp-org:event-1-0\" xmlns:s=\"");
str = strcat_str(str, len, &tmplen, servns);
str = strcat_str(str, len, &tmplen, "\">");
snprintf(buf, sizeof(buf), "<e:propertyset xmlns:e=\"urn:schemas-upnp-org:event-1-0\" xmlns:s=\"%s\">", servns);
str = strcat_str(str, len, &tmplen, buf);
while(v->name) {
if(v->itype & 0x80) {
str = strcat_str(str, len, &tmplen, "<e:property><");
str = strcat_str(str, len, &tmplen, v->name);
str = strcat_str(str, len, &tmplen, ">");
snprintf(buf, sizeof(buf), "<e:property><%s>", v->name);
str = strcat_str(str, len, &tmplen, buf);
//printf("<e:property><s:%s>", v->name);
switch(v->ieventvalue) {
case 0:
break;
case 255: /* Magical values should go around here */
if( strcmp(v->name, "SystemUpdateID") == 0 )
{
snprintf(buf, sizeof(buf), "%d", updateID);
str = strcat_str(str, len, &tmplen, buf);
}
break;
default:
str = strcat_str(str, len, &tmplen, upnpallowedvalues[v->ieventvalue]);
//printf("%s", upnpallowedvalues[v->ieventvalue]);
}
str = strcat_str(str, len, &tmplen, "</");
str = strcat_str(str, len, &tmplen, v->name);
str = strcat_str(str, len, &tmplen, "></e:property>");
snprintf(buf, sizeof(buf), "</%s></e:property>", v->name);
str = strcat_str(str, len, &tmplen, buf);
//printf("</s:%s></e:property>\n", v->name);
}
v++;