예제 #1
0
/* pdata 

print the sensor data as hold in structure sens

*/
char *
pdata(struct wthio *wth) {
  int i,j; 
  int size = 100;
  static char t[MAXBUFF];
  char *s;

  t[0] = '\0';

  s = mkmsg("Sensor\tType\tStatus\tdataset\ttime\t\tsign\tabs.value\n");
  /* code won't work on LINUX, FreeBSD OK
     size = strlen(s) + 1; 
     if ((t = malloc(size)) == NULL )
     return NULL;
     strcat(t,s);
  */
  strncat(t, s, strlen(s));
  
  for ( i = 0; i < MAXSENSORS; i++ ) {
    if ( wth->sens[i].status != 0 ) {   
      for ( j = 0; j < wth->wstat.ndats; j++) {

	s = mkmsg("%d\t%s\t%d\t%d\t%lu\t%d\t%8.1f\n", i, 
		  wth->sens[i].type, wth->sens[i].status, j, 
		  wth->sens[i].mess[j].time,
		  wth->sens[i].mess[j].sign,
		  wth->sens[i].mess[j].value);
	
	size = size + strlen(s) + 1;
	strncat(t, s, strlen(s));
      }
    }
  }
  return (t);
}
예제 #2
0
파일: engine.c 프로젝트: andyvand/prekit
void fb_queue_erase(const char *ptn)
{
    Action *a;
    a = queue_action(OP_COMMAND, "erase:%s", ptn);
    if (ptn && strlen(ptn) > 0)
        a->msg = mkmsg("erasing '%s'", ptn);
    else
        a->msg = mkmsg("");
}
예제 #3
0
파일: engine.c 프로젝트: andyvand/prekit
void fb_queue_stream_flash(const char *ptn, void *data, unsigned sz)
{
    Action *a;
    a = queue_action(OP_FLASH, "flash:%s:%08X", ptn, sz);
    a->data = data;
    a->size = sz;
    if (ptn && strlen(ptn) > 0)
        a->msg = mkmsg("streaming flash '%s', size (%d KB)", ptn, sz / 1024);
    else
        a->msg = mkmsg("");
}