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