コード例 #1
0
void QGenieGetRouterWlanInfoThread::run()
{
    if(0==m_soapapi
#ifdef PLATFORM_WIN32
       && 0==setupapi_inf
#endif
       )
    {
        emit getwlaninfo_complete(false,QString(),QString(),QString(),QString());
        return;
    }

    //initialize
    m_bstart_ok         = false;
    m_bgetssid_ok       = false;
    m_bgetkey_ok        = false;
    m_bcontinue         = true;

    m_strnicguid.clear();
    m_strprofilename.clear();
    m_strssid.clear();
    m_strkey.clear();
    //initialize end

    if(false/*setupapi_inf && setupapi_inf->get_export_information(m_strnicguid,m_strssid,m_strprofilename)*/)
    {
         emit getwlaninfo_complete(true,m_strssid,QString(),m_strnicguid,m_strprofilename);
    }
    else
    {
        QString  str_session("f8018c9f-5431-497e-ac5d-511dd0ae7402");
        //get wlan exporting information from router
//        //Start
//        QString start_module("DeviceConfig");
//        QString start_method("ConfigurationStarted");
//        QMap<QString,QString> start_param;
//        QUuid uuid_start ("{14E65BB7-0D3B-4c90-871E-187E58D6712C}");
//        start_param.insert(QString("NewSessionID"), QString("99999999999"));
//        m_soapapi->submitrequest(start_module,start_method ,start_param,uuid_start,
//                                str_session );
//        GeniePlugin_WSetupPlugin::output_log(QString("submit:DeviceConfig ConfigurationStarted UUID:{14E65BB7-0D3B-4c90-871E-187E58D6712C}"));

        QMap<QString,QString> search_param;
        QString  search_module("WLANConfiguration");
        QString  search_method("GetSSID");
        QUuid uuid_ssid( "{CFE911FE-C5E8-4a0e-A073-6FD28B017E41}");
        m_soapapi->submitrequest(search_module,search_method , search_param,uuid_ssid,str_session);
        GeniePlugin_WSetupPlugin::output_log(QString("submit:WLANConfiguration GetSSID UUID:{CFE911FE-C5E8-4a0e-A073-6FD28B017E41}"));

        search_method = "GetWPASecurityKeys";
        QUuid uuid_key("{B8D2DCFD-0A58-4e46-882A-5EB1DC77EBB4}");
        m_soapapi->submitrequest(search_module,search_method , search_param,uuid_key,str_session);
        GeniePlugin_WSetupPlugin::output_log(QString("submit:WLANConfiguration GetWPASecurityKeys UUID:{B8D2DCFD-0A58-4e46-882A-5EB1DC77EBB4}"));
    }
}
コード例 #2
0
ファイル: kraus.c プロジェクト: toke/craus
int main(int argc, char *argv[]) {

  calendar_t cal = {0};

  module_t * out_module;
  module_t * strat_module;

  char *output_s = NULL;
  char *strategy_s = NULL;
  int c;


  while ((c = getopt(argc, argv, "hwc:o:s:")) != -1)
    switch (c) {
    case 'w': // Skip Weekends
      cal.flags.weekday = 1;
      break;
    case 'c': // Count
      if (optarg && atoi(optarg) > 0) {
        cal.count = optarg ? atoi(optarg) : 1;
      } else {
        cal.count = 1;
      }
      break;
    case 'o': // Output Module
      output_s = optarg;
      break;
    case 's': // Strategy Module
      strategy_s = optarg;
      break;
    case 'h':
      usage();
      return 0;
      break;
    case '?':
      printf("craus %i.%i.%i\n", VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH);

      if (optopt == 'c' || optopt == 'o' || optopt == 's') {
        fprintf(stderr, "Option -%c requires an argument.\n", optopt);
        usage();
      } else if (isprint(optopt)) {
        fprintf(stderr, "Unknown option `-%c'.\n", optopt);
      } else {
        fprintf(stderr, "Unknown option character `\\x%x'.\n", optopt);
      }
      return 1;
    default:
      abort();
  }


  module_registry_t strategy_modules = {
    .name = "Strategy",
  };

  module_registry_t output_modules = {
    .name = "Output",
  };

  register_strategy(&strategy_modules);
  register_output(&output_modules);

  // Handle output Modules
  if (output_s != NULL) {
    out_module = search_module(&output_modules, (module_ident_t *) output_s);
    if (out_module == NULL) {
      printf("Output-module not found\n\n");
      usage_output(&output_modules);
      return -1;
    }
  } else {
    out_module = get_default_module(&output_modules);
  }

  // Handle strategy Modules
  if (strategy_s != NULL) {
    strat_module = search_module(&strategy_modules, (module_ident_t *) strategy_s);
    if (strat_module == NULL) {
      printf("Strategy-module not found\n\n");
      usage_output(&strategy_modules);
      return -1;
    }
  } else {
    strat_module = get_default_module(&strategy_modules);
  }

  time(&cal.start_date);
  cal.count = cal.count ? cal.count : 1;

  output   = out_module->func;
  strategy = strat_module->func;
  output(&cal, strategy);

  return 0;
}

void usage(void) {

  module_registry_t strategy_registry = {
    .name = "Strategy",
  };
  module_registry_t output_registry = {
    .name = "Output",
  };

  register_output(&output_registry);
  register_strategy(&strategy_registry);


  printf("craus Version %i.%i.%i\n", VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH);
  printf("kraus [-o OUTPUT MODULE] [-s STRATEGY MODULE] [-w] [-c COUNT]\n\n");

  printf("\n");
  usage_modules(&output_registry);
  printf("\n");
  usage_modules(&strategy_registry);

}