thermferm/server.c

changeset 209
c5b1dfd83e81
parent 208
934d45d9751d
child 213
2317b8d644fa
equal deleted inserted replaced
208:934d45d9751d 209:c5b1dfd83e81
260 device->type = i; 260 device->type = i;
261 break; 261 break;
262 } 262 }
263 } 263 }
264 device->direction = DEVDIR_UNDEF; 264 device->direction = DEVDIR_UNDEF;
265 device->value = device->subdevice = device->inuse = 0; 265 device->value = device->offset = device->subdevice = device->inuse = 0;
266 device->present = DEVPRESENT_UNDEF; 266 device->present = DEVPRESENT_UNDEF;
267 device->address = xstrcpy((char *)"Enter address here"); 267 device->address = xstrcpy((char *)"Enter address here");
268 device->gpiopin = -1; 268 device->gpiopin = -1;
269 device->description = xstrcpy((char *)"Describe me here"); 269 device->description = xstrcpy((char *)"Describe me here");
270 device->comment = xstrcpy((char *)"Comment here"); 270 device->comment = xstrcpy((char *)"Comment here");
306 if (strcmp(device->uuid, param) == 0) { 306 if (strcmp(device->uuid, param) == 0) {
307 srv_send((char *)"213 Device %s record follows:", device->uuid); 307 srv_send((char *)"213 Device %s record follows:", device->uuid);
308 srv_send((char *)"TYPE,%s", DEVTYPE[device->type]); 308 srv_send((char *)"TYPE,%s", DEVTYPE[device->type]);
309 srv_send((char *)"DIRECTION,%s", DEVDIR[device->direction]); 309 srv_send((char *)"DIRECTION,%s", DEVDIR[device->direction]);
310 srv_send((char *)"VALUE,%d", device->value); 310 srv_send((char *)"VALUE,%d", device->value);
311 srv_send((char *)"OFFSET,%d", device->offset);
311 srv_send((char *)"PRESENT,%s", DEVPRESENT[device->present]); 312 srv_send((char *)"PRESENT,%s", DEVPRESENT[device->present]);
312 srv_send((char *)"ADDRESS,%s", device->address); 313 srv_send((char *)"ADDRESS,%s", device->address);
313 srv_send((char *)"SUBDEVICE,%d", device->subdevice); 314 srv_send((char *)"SUBDEVICE,%d", device->subdevice);
314 srv_send((char *)"GPIOPIN,%d", device->gpiopin); 315 srv_send((char *)"GPIOPIN,%d", device->gpiopin);
315 srv_send((char *)"DESCRIPTION,%s", device->description); 316 srv_send((char *)"DESCRIPTION,%s", device->description);
377 } 378 }
378 379
379 } else if (strcmp(kwd, (char *)"VALUE") == 0) { 380 } else if (strcmp(kwd, (char *)"VALUE") == 0) {
380 if (sscanf(val, "%d", &ival) == 1) 381 if (sscanf(val, "%d", &ival) == 1)
381 device->value = ival; 382 device->value = ival;
383
384 } else if (strcmp(kwd, (char *)"OFFSET") == 0) {
385 if (sscanf(val, "%d", &ival) == 1)
386 device->offset = ival;
382 387
383 } else if (strcmp(kwd, (char *)"PRESENT") == 0) { 388 } else if (strcmp(kwd, (char *)"PRESENT") == 0) {
384 for (i = 0; i < 4; i++) { 389 for (i = 0; i < 4; i++) {
385 if (strcmp(val, DEVPRESENT[i]) == 0) { 390 if (strcmp(val, DEVPRESENT[i]) == 0) {
386 device->present = i; 391 device->present = i;

mercurial