Пример #1
0
/*-----------------------------------------------------------------------------------*/
PROCESS_THREAD(netconf_process, ev, data)
{

  PROCESS_BEGIN();
  
  /* Create TCP/IP configuration window. */
  ctk_window_new(&tcpipwindow, 30, 10, "TCP/IP config");
  
  CTK_WIDGET_ADD(&tcpipwindow, &ipaddrlabel);  
  CTK_WIDGET_ADD(&tcpipwindow, &ipaddrtextentry);
  CTK_WIDGET_ADD(&tcpipwindow, &netmasklabel);
  CTK_WIDGET_ADD(&tcpipwindow, &netmasktextentry);
  CTK_WIDGET_ADD(&tcpipwindow, &gatewaylabel);
  CTK_WIDGET_ADD(&tcpipwindow, &gatewaytextentry);
#if UIP_UDP
  CTK_WIDGET_ADD(&tcpipwindow, &dnsserverlabel);
  CTK_WIDGET_ADD(&tcpipwindow, &dnsservertextentry);  
#endif /* UIP_UDP */
  CTK_WIDGET_ADD(&tcpipwindow, &tcpipclosebutton);

  CTK_WIDGET_FOCUS(&tcpipwindow, &ipaddrtextentry);  
  
  /* Fill the configuration strings with values from the current
     configuration */
  makestrings();
    
  ctk_window_open(&tcpipwindow);

  while(1) {
    PROCESS_WAIT_EVENT();
    
    if(ev == ctk_signal_button_activate) {   
      if(data == (process_data_t)&tcpipclosebutton) {
	apply_tcpipconfig();
	ctk_window_close(&tcpipwindow);
	netconf_quit();
      }
    } else if(
#if CTK_CONF_WINDOWCLOSE
	      ev == ctk_signal_window_close ||
#endif
	      ev == PROCESS_EVENT_EXIT) {
      ctk_window_close(&tcpipwindow);
      netconf_quit();
    }
  }

  PROCESS_END();
}
Пример #2
0
/*-----------------------------------------------------------------------------------*/
PROCESS_THREAD(dhcp_process, ev, data)
{
  PROCESS_BEGIN();
  
  ctk_window_new(&window, 29, 14, "DHCP client");
  
  CTK_WIDGET_ADD(&window, &requestbutton);
  CTK_WIDGET_ADD(&window, &statuslabel);  
  CTK_WIDGET_ADD(&window, &ipaddrlabel);  
  CTK_WIDGET_ADD(&window, &ipaddrtextentry);
  CTK_WIDGET_ADD(&window, &netmasklabel);
  CTK_WIDGET_ADD(&window, &netmasktextentry);
  CTK_WIDGET_ADD(&window, &gatewaylabel);
  CTK_WIDGET_ADD(&window, &gatewaytextentry);
#if WITH_DNS
  CTK_WIDGET_ADD(&window, &dnsserverlabel);
  CTK_WIDGET_ADD(&window, &dnsservertextentry);  
#endif /* WITH_DNS */
  CTK_WIDGET_ADD(&window, &savebutton);
  CTK_WIDGET_ADD(&window, &cancelbutton);

  CTK_WIDGET_FOCUS(&window, &requestbutton);  

  ctk_window_open(&window);

  /* Allow resolver to set DNS server address. */
  process_post(PROCESS_CURRENT(), PROCESS_EVENT_MSG, NULL);

  dhcpc_init(uip_ethaddr.addr, sizeof(uip_ethaddr.addr));

  while(1) {
    PROCESS_WAIT_EVENT();
    
    if(ev == PROCESS_EVENT_MSG) {
      makestrings();
      ctk_window_redraw(&window);
    } else if(ev == tcpip_event) {
      dhcpc_appcall(ev, data);
    } else if(ev == ctk_signal_button_activate) {   
      if(data == (process_data_t)&requestbutton) {
	dhcpc_request();
	set_statustext("Requesting...");
      }
      if(data == (process_data_t)&savebutton) {
	apply_tcpipconfig();
	app_quit();
      }
      if(data == (process_data_t)&cancelbutton) {
	app_quit();
      }
    } else if(
#if CTK_CONF_WINDOWCLOSE
	      ev == ctk_signal_window_close ||
#endif
	      ev == PROCESS_EVENT_EXIT) {
      app_quit();
    }
  }

  PROCESS_END();
}
Пример #3
0
void BaseContact::getText( std::string &dest, const BaseContestLog * const curcon ) const
{
   ContactBuffs::brgbuff[ 0 ] = 0;
   ContactBuffs::scorebuff[ 0 ] = 0;
   ContactBuffs::qthbuff[ 0 ] = 0;

   if ( contactFlags.getValue() & ( LOCAL_COMMENT | COMMENT_ONLY | DONT_PRINT ) )
   {
      sprintf( ContactBuffs::buff, "%-5.5s %s %-60.60s", time.getTime( DTGDISP ).c_str(),
               ( contactFlags.getValue() & DONT_PRINT ) ? "DELETED" : ( contactFlags.getValue() & LOCAL_COMMENT ) ? "LOCAL COMMENT" : "COMMENT FOR ADJUDICATOR",
               comments.getValue().c_str() );
   }
   else
   {
      // if contest requires a serial
      makestrings( curcon ->serialField.getValue() );

      mystrncpy( ContactBuffs::qthbuff, extraText.getValue().c_str(), 100 );

      if ( contactFlags.getValue() & MANUAL_SCORE )
         strcpy( ContactBuffs::brgbuff, "MAN" );

      if ( contactFlags.getValue() & DONT_PRINT )
         strcpy( ContactBuffs::scorebuff, "DEL" );
      else
         if ( contactFlags.getValue() & NON_SCORING )
            strcpy( ContactBuffs::scorebuff, "N/S" );
         else
         {
            // look at the contest dup
            if ( ( cs.valRes == ERR_DUPCS ) && ( curcon == contest ) )
               strcpy( ContactBuffs::scorebuff, "DUP" );
         }
   }

   int nbuff = 4;

   if ( contactFlags.getValue() & VALID_DUPLICATE )
      strcpy( ContactBuffs::buff2, "BP " );
   else
      if ( contactFlags.getValue() & XBAND )
         strcpy( ContactBuffs::buff2, "XB " );
      else
      {
         nbuff = 0;
         ContactBuffs::buff2[ 0 ] = 0;
      }
   strcpysp( ContactBuffs::buff, comments.getValue(), 42 );
   if ( ContactBuffs::buff[ 0 ] )
   {
      strcpysp( &ContactBuffs::buff2[ nbuff ], ContactBuffs::qthbuff, 20 );
      strcat( ContactBuffs::buff2, " | " );
      strcat( ContactBuffs::buff2, ContactBuffs::buff );
   }
   else
      strcpysp( &ContactBuffs::buff2[ nbuff ], ContactBuffs::qthbuff, 42 );

   memset( ContactBuffs::buff, ' ', 255 );
   int next = 0;
   next = placestr( ContactBuffs::buff, time.getDate( DTGDISP ), next, 8 );
   next += 1;
   next = placestr( ContactBuffs::buff, time.getTime( DTGDISP ), next, 5 );

   next += 1;
   next = placestr( ContactBuffs::buff, cs.fullCall.getValue(), next, 11 );

   if ( curcon ->RSTField.getValue() )
      next = placestr( ContactBuffs::buff, reps.getValue(), next, 3 );
   next = placestr( ContactBuffs::buff, ContactBuffs::ssbuff, next, -4 );
   if ( curcon ->RSTField.getValue() )
      next = placestr( ContactBuffs::buff, repr.getValue(), next + 1, 3 );
   next = placestr( ContactBuffs::buff, ContactBuffs::srbuff, next, -4 );

   next = placestr( ContactBuffs::buff, loc.loc.getValue(), next + 1, ( curcon ->allowLoc8.getValue() ) ? 8 : 6 );

   next = placestr( ContactBuffs::buff, ContactBuffs::brgbuff, next + 1, 4 );
   next = placestr( ContactBuffs::buff, ContactBuffs::scorebuff, next, -5 );

   next = placestr( ContactBuffs::buff, op1.getValue(), next, -8 );
   next += 1;
   next = placestr( ContactBuffs::buff, op2.getValue(), next, -8 );

   next = placestr( ContactBuffs::buff, ContactBuffs::buff2, next + 1, 90 );

   dest = trimr( ContactBuffs::buff );
}