void netConnectedAtLeader(NetInfo[] nets) {
   for (NetInfo net : nets) {
     StringBuilder sb = new StringBuilder();
     sb.append("SSID: ").append(net.name);
     sb.append("; passwd: ").append(net.pass);
     sb.append("; encryption: ").append(NetInfo.NetEncryptionName(net.encrypt));
     // update GUI
     switch (net.type) {
       case NetInfo.WiFi:
         wifiInfo.setText(sb);
         if (connNets[NetInfo.WiFi] != null && connNets[NetInfo.WiFi].encrypt != NetInfo.NoPass) {
           groupPasswd.setVisibility(View.VISIBLE);
         }
         break;
       case NetInfo.WiFiDirect:
         wifiDirectInfo.setText(sb);
         break;
       case NetInfo.WiFiHotspot:
         if (WifiHotspotTransport.Unknown.equals(net.name)) {
           wifiHotspotInfo.setText(NetInfo.NetTypeName(net.type) + ": " + checkSetting);
           hotspotLockedInfo.setVisibility(View.VISIBLE);
         } else {
           wifiHotspotInfo.setText(sb);
           hotspotLockedInfo.setVisibility(View.GONE);
         }
         break;
     }
   }
 }
예제 #2
0
 public final String encode() {
   String pass = passwd;
   if (encrypt != NetInfo.NoPass && passwd.equals("*")) {
     pass = ""; // force checking configured nets
   }
   return String.format(
       "%s~=>%s~=>%s~=>%s~=>%s~=>%s",
       ssid, pass, NetInfo.NetEncryptionName(encrypt), hidden, useSSL, addr);
 }
 void showGroup(int grpNo) {
   groupRole.setVisibility(View.GONE);
   groupNType.setVisibility(View.GONE);
   groupPasswd.setVisibility(View.GONE);
   hotspotLockedInfo.setVisibility(View.GONE);
   groupQRCode.setVisibility(View.GONE);
   groupProg.setVisibility(View.GONE);
   switch (grpNo) {
     case -1:
       groupClose.setVisibility(View.GONE);
       groupProg.setVisibility(View.VISIBLE);
       break;
     case 1:
       groupRole.setVisibility(View.VISIBLE);
       break;
     case 2:
       groupNType.setVisibility(View.VISIBLE);
       if (connNets[NetInfo.WiFi] != null && connNets[NetInfo.WiFi].encrypt != NetInfo.NoPass) {
         groupPasswd.setVisibility(View.VISIBLE);
       }
       if (connNets[NetInfo.WiFiHotspot] != null
           && WifiHotspotTransport.Unknown.equals(connNets[NetInfo.WiFiHotspot].name)) {
         wifiHotspotInfo.setText(NetInfo.NetTypeName(NetInfo.WiFiHotspot) + ": " + checkSetting);
         hotspotLockedInfo.setVisibility(View.VISIBLE);
       }
       break;
     case 3:
       groupNType.setVisibility(View.VISIBLE);
       if (connNets[NetInfo.WiFi] != null && connNets[NetInfo.WiFi].encrypt != NetInfo.NoPass) {
         groupPasswd.setVisibility(View.VISIBLE);
       }
       if (connNets[NetInfo.WiFiHotspot] != null
           && WifiHotspotTransport.Unknown.equals(connNets[NetInfo.WiFiHotspot].name)) {
         wifiHotspotInfo.setText(NetInfo.NetTypeName(NetInfo.WiFiHotspot) + ": " + checkSetting);
         hotspotLockedInfo.setVisibility(View.VISIBLE);
       }
       groupQRCode.setVisibility(View.VISIBLE);
       break;
   }
 }
예제 #4
0
 public String toText() {
   return String.format(
       "ssid:%s; passwd:%s; encrypt:%s", ssid, passwd, NetInfo.NetEncryptionName(encrypt));
 }
예제 #5
0
 public String toString() {
   return String.format(
       "ssid:%s; passwd:%s; encrypt:%s; hidden:%s, useSSL:%s, addr:%s",
       ssid, passwd, NetInfo.NetEncryptionName(encrypt), hidden, useSSL, addr);
 }