示例#1
0
文件: net.c 项目: Sudiukil/c3status
void display_net(net *n) {

	char *dl_speed, *ul_speed;

	update_net(n);

	dl_speed = gen_str_speed(n->dl_speed, n->unit, n->threshold);
	ul_speed = gen_str_speed(n->ul_speed, n->unit, n->threshold);

	display("net", "download", n->label, dl_speed, 0);
	display("net", "upload", "↑", ul_speed, 0);

	free(dl_speed);
	free(ul_speed);
}
示例#2
0
文件: net.c 项目: iddumied/SDWM
void setup_net()
{
  int i;
  net.refresh = status_refresh;
  
  for(i = 0; i < MAX_NET_INTERFACES; i++) {
    net.interfaces[i].name[0] = '\x00';
    net.interfaces[i].state_unknowen = False;
    #ifdef NF310_A01
    net.interfaces[i].easy_online = False;
    #endif
    net.interfaces[i].online = False;
    net.interfaces[i].linkmax = -1;
    net.interfaces[i].linkcur = 0;
    net.interfaces[i].wireless = False;
    net.interfaces[i].bytespersec = 0;
    net.interfaces[i].strength = 0.0;
  }

  update_net();
}
示例#3
0
文件: net.c 项目: iddumied/SDWM
int main() {
  printf("Siezof Net: %d Bytes\n", sizeof(Net));

  setup_net();

  while(1==1){
    sleep(1);
    update_net();

    int i;
    printf("lan online: %d, wlan online: %d, connected %d\n", net_lan_online(), net_wlan_online(), net.connected);
    printf("%5s| %10s %10s %10s %10s %10s %10s %10s\n", "", "online", "wireless", "linkcur", "linkmax", "easyon","b/s up", "b/s down");
    printf("%5s+-%10s-%10s-%10s-%10s-%10s-%10s-%10s\n", "-----","----------","----------","----------","----------","----------","----------","----------");
    for (i = 0; i < net.num_interfaces; i++) {
      printf("%5s| %10d %10d %10d %10d %10d %10d %10d\n", net.interfaces[i].name, net.interfaces[i].online, net.interfaces[i].wireless,
              net.interfaces[i].linkcur, net.interfaces[i].linkmax, net.interfaces[i].easy_online, net.interfaces[i].between.transmit.bytes_per_sec,
                net.interfaces[i].between.receive.bytes_per_sec);
    }

  }

  return 0;
}
示例#4
0
文件: status.c 项目: iddumied/SDWM
void update_status()
{
    #ifdef DEBUG
    char buffer[256];
    sprintf(buffer, "Update Status: draw Memory %s", sbar_status_symbols[DrawMemory].active ? "yes" : "no");
    log_str(buffer, LOG_DEBUG);
    sprintf(buffer, "Update Status: draw Battery %s", sbar_status_symbols[DrawBattery].active ? "yes" : "no");
    log_str(buffer, LOG_DEBUG);
    sprintf(buffer, "Update Status: draw Uptime %s", sbar_status_symbols[DrawUptime].active ? "yes" : "no");
    log_str(buffer, LOG_DEBUG);
    sprintf(buffer, "Update Status: draw Termal %s", sbar_status_symbols[DrawTermal].active ? "yes" : "no");
    log_str(buffer, LOG_DEBUG);
    #ifdef NF310_A01
    sprintf(buffer, "Update Status: draw Backlight %s", sbar_status_symbols[DrawBacklight].active ? "yes" : "no");
    log_str(buffer, LOG_DEBUG);
    #endif
    sprintf(buffer, "Update Status: draw Net %s", sbar_status_symbols[DrawNet].active ? "yes" : "no");
    log_str(buffer, LOG_DEBUG);
    #endif
    
    if(sbar_status_symbols[DrawMemory].active) {
      get_memory();
      
      #ifdef DEBUG
      log_str("Sucessfully Updated Memory", LOG_DEBUG);
      #endif
    }
    
    if(sbar_status_symbols[DrawBattery].active) {
      check_battery();

      #ifdef DEBUG
      log_str("Sucessfully Updated Battery", LOG_DEBUG);
      #endif
    }

    cpu_usage();

    #ifdef DEBUG
    log_str("Sucessfully Updated CPU", LOG_DEBUG);
    #endif

    update_date();

    #ifdef DEBUG
    log_str("Sucessfully Updated Date", LOG_DEBUG);
    #endif

    if(sbar_status_symbols[DrawUptime].active) {
      update_uptime();

      #ifdef DEBUG
      log_str("Sucessfully Updated Uptime", LOG_DEBUG);
      #endif
    }

    if(sbar_status_symbols[DrawTermal].active) {
      get_thermal();

      #ifdef DEBUG
      log_str("Sucessfully Updated Termal", LOG_DEBUG);
      #endif
    }

    #ifdef NF310_A01
    if(sbar_status_symbols[DrawBacklight].active) {
      update_backlight();

      #ifdef DEBUG
      log_str("Sucessfully Updated Backlight", LOG_DEBUG);
      #endif
    }
    #endif

    if(sbar_status_symbols[DrawNet].active) {
      update_net();

      #ifdef DEBUG
      log_str("Sucessfully Updated Net", LOG_DEBUG);
      #endif
    }

    update_disk();

    #ifdef DEBUG
    log_str("Sucessfully Updated Disk", LOG_DEBUG);
    #endif

}