Example #1
0
void Peers::update_peers()
{
	model.clear();
	if (wpagui == NULL)
		return;

	char reply[20];
	size_t replylen = sizeof(reply) - 1;
	wpagui->ctrlRequest("WPS_ER_START", reply, &replylen);

	add_stations();
	add_scan_results();
	add_persistent_groups();
}
Example #2
0
static void *
xanalogtv_init (Display *dpy, Window window)
{
  struct state *st = (struct state *) calloc (1, sizeof(*st));
  int i;
  int last_station=42;
  int delay = get_integer_resource(dpy, "delay", "Integer");
  if (delay < 1) delay = 1;

  analogtv_make_font(dpy, window, &st->ugly_font, 7, 10, "6x10");
  
  st->dpy = dpy;
  st->window = window;
  st->tv=analogtv_allocate(dpy, window);

  add_stations(st);

  analogtv_set_defaults(st->tv, "");
  st->tv->need_clear=1;

  if (random()%4==0) {
    st->tv->tint_control += pow(frand(2.0)-1.0, 7) * 180.0;
  }
  if (1) {
    st->tv->color_control += frand(0.3);
  }

  for (i=0; i<N_CHANNELS; i++) {
    memset(&st->chansettings[i], 0, sizeof(chansetting));

    st->chansettings[i].noise_level = 0.06;
    st->chansettings[i].dur = 1000*delay;

    if (random()%6==0) {
      st->chansettings[i].dur=600;
    }
    else {
      int stati;
      for (stati=0; stati<MAX_MULTICHAN; stati++) {
        analogtv_reception *rec=&st->chansettings[i].recs[stati];
        int station;
        while (1) {
          station=random()%st->n_stations;
          if (station!=last_station) break;
          if ((random()%10)==0) break;
        }
        last_station=station;
        rec->input = st->stations[station];
        rec->level = pow(frand(1.0), 3.0) * 2.0 + 0.05;
        rec->ofs=random()%ANALOGTV_SIGNAL_LEN;
        if (random()%3) {
          rec->multipath = frand(1.0);
        } else {
          rec->multipath=0.0;
        }
        if (stati) {
          /* We only set a frequency error for ghosting stations,
             because it doesn't matter otherwise */
          rec->freqerr = (frand(2.0)-1.0) * 3.0;
        }

        if (rec->level > 0.3) break;
        if (random()%4) break;
      }
    }
  }

  gettimeofday(&st->basetime,NULL);

  st->curinputi=0;
  st->cs = &st->chansettings[st->curinputi];
  st->change_ticks = st->cs->dur + 1500;

  st->tv->powerup=0.0;

  load_station_images(st);

  return st;
}