当前位置: 首页>>代码示例>>C++>>正文


C++ CNetworkInterface::IsConnected方法代码示例

本文整理汇总了C++中CNetworkInterface::IsConnected方法的典型用法代码示例。如果您正苦于以下问题:C++ CNetworkInterface::IsConnected方法的具体用法?C++ CNetworkInterface::IsConnected怎么用?C++ CNetworkInterface::IsConnected使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CNetworkInterface的用法示例。


在下文中一共展示了CNetworkInterface::IsConnected方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: SaveConfiguration

bool CGUIWindowBoxeeWizardNetwork::SaveConfiguration()
{
   if (!NetworkConfigurationChanged())
      return true;
      
   bool result = false;
   CStdString currentEssId;
   CStdString currentKey;
   EncMode    currentEnc;
   CStdString currentInterfaceName;
   
   GetUserConfiguration(currentInterfaceName, currentEssId, currentKey, currentEnc);
   
   CGUIDialogProgress* pDlgProgress = (CGUIDialogProgress*)m_gWindowManager.GetWindow(WINDOW_DIALOG_PROGRESS);
   pDlgProgress->SetHeading("");
   pDlgProgress->SetLine(0, "Applying network configuration...");
   pDlgProgress->SetLine(1, "");
   pDlgProgress->SetLine(2, "");
   pDlgProgress->StartModal();
   pDlgProgress->Progress();
        
   CStdString empty;
   NetworkAssignment assignment;
   CNetworkInterface* interface; 
   for (unsigned int i = 0; i < m_interfaces.size(); i++)
   {
      interface = m_interfaces[i];
      if (interface->GetName() == currentInterfaceName)
      {
         assignment = NETWORK_DHCP;
         interface->SetSettings(assignment, empty, empty, empty, currentEssId, currentKey, currentEnc);
      }
      else
      { 
         // if we have a different interfaces, we need to take them down
         assignment = NETWORK_DISABLED;
         EncMode enc = ENC_NONE;
         interface->SetSettings(assignment, empty, empty, empty, empty, empty, enc);
      }
   }
   
   pDlgProgress->Close();
     
   if (!interface->IsConnected())
      CGUIDialogOK::ShowAndGetInput(0, 50001, 50002, 0);
   else if (!g_application.IsConnectedToNet())
      CGUIDialogOK::ShowAndGetInput(0, 50003, 50004, 50002);
   else
      result = true;
          
   ResetCurrentNetworkState();
   
   return result;
}
开发者ID:Kr0nZ,项目名称:boxee,代码行数:54,代码来源:GUIWindowBoxeeWizardNetwork.cpp

示例2: GetLabel


//.........这里部分代码省略.........
      value = g_langInfo.GetTemperatureUnitString();
      return true;
    case SYSTEM_FRIENDLY_NAME:
      value = CSysInfo::GetDeviceName();
      return true;
    case SYSTEM_STEREOSCOPIC_MODE:
    {
      int iStereoMode = CServiceBroker::GetSettingsComponent()->GetSettings()->GetInt(CSettings::SETTING_VIDEOSCREEN_STEREOSCOPICMODE);
      value = StringUtils::Format("%i", iStereoMode);
      return true;
    }
    case SYSTEM_GET_CORE_USAGE:
      value = StringUtils::Format("%4.2f", g_cpuInfo.GetCoreInfo(std::atoi(info.GetData3().c_str())).m_fPct);
      return true;
    case SYSTEM_RENDER_VENDOR:
      value = CServiceBroker::GetRenderSystem()->GetRenderVendor();
      return true;
    case SYSTEM_RENDER_RENDERER:
      value = CServiceBroker::GetRenderSystem()->GetRenderRenderer();
      return true;
    case SYSTEM_RENDER_VERSION:
      value = CServiceBroker::GetRenderSystem()->GetRenderVersionString();
      return true;

    ///////////////////////////////////////////////////////////////////////////////////////////////
    // NETWORK_*
    ///////////////////////////////////////////////////////////////////////////////////////////////
    case NETWORK_IP_ADDRESS:
    {
      CNetworkInterface* iface = CServiceBroker::GetNetwork().GetFirstConnectedInterface();
      if (iface)
      {
        value = iface->GetCurrentIPAddress();
        return true;
      }
      break;
    }
    case NETWORK_SUBNET_MASK:
    {
      CNetworkInterface* iface = CServiceBroker::GetNetwork().GetFirstConnectedInterface();
      if (iface)
      {
        value = iface->GetCurrentNetmask();
        return true;
      }
      break;
    }
    case NETWORK_GATEWAY_ADDRESS:
    {
      CNetworkInterface* iface = CServiceBroker::GetNetwork().GetFirstConnectedInterface();
      if (iface)
      {
        value = iface->GetCurrentDefaultGateway();
        return true;
      }
      break;
    }
    case NETWORK_DNS1_ADDRESS:
    {
      const std::vector<std::string> nss = CServiceBroker::GetNetwork().GetNameServers();
      if (nss.size() >= 1)
      {
        value = nss[0];
        return true;
      }
      break;
    }
    case NETWORK_DNS2_ADDRESS:
    {
      const std::vector<std::string> nss = CServiceBroker::GetNetwork().GetNameServers();
      if (nss.size() >= 2)
      {
        value = nss[1];
        return true;
      }
      break;
    }
    case NETWORK_DHCP_ADDRESS:
    {
      // wtf?
      std::string dhcpserver;
      value = dhcpserver;
      return true;
    }
    case NETWORK_LINK_STATE:
    {
      std::string linkStatus = g_localizeStrings.Get(151);
      linkStatus += " ";
      CNetworkInterface* iface = CServiceBroker::GetNetwork().GetFirstConnectedInterface();
      if (iface && iface->IsConnected())
        linkStatus += g_localizeStrings.Get(15207);
      else
        linkStatus += g_localizeStrings.Get(15208);
      value = linkStatus;
      return true;
    }
  }

  return false;
}
开发者ID:AlwinEsch,项目名称:kodi,代码行数:101,代码来源:SystemGUIInfo.cpp


注:本文中的CNetworkInterface::IsConnected方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。