コード例 #1
0
  public String getDnsAddr() {
    switch (mEnableInfo) {
      case E_INFO_MANUAL:
        return mEthInfo.getDnsAddr();

      case E_INFO_DHCP:
        return intToString(mDhcpInfo.dns1);

      default:
        return null;
    }
  }
コード例 #2
0
  private DnsForPppoe(Context context) {
    this.mContext = context;
    mEthManager = (EthernetManager) mContext.getSystemService(Context.ETHERNET_SERVICE);
    int state = mEthManager.getState();

    if (mEthManager.isConfigured() && state == EthernetManager.ETHERNET_STATE_ENABLED) {
      mEthInfo = mEthManager.getSavedConfig();
      if (mEthInfo.getConnectMode().equals(EthernetDevInfo.ETHERNET_CONN_MODE_DHCP)) {
        mDhcpInfo = mEthManager.getDhcpInfo();
        mEnableInfo = E_INFO_DHCP;
      } else {
        mEnableInfo = E_INFO_MANUAL;
      }
    }
  }