• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2010 ZXing authors
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.google.zxing.client.result;
18 
19 /**
20  * Represents a parsed result that encodes wifi network information, like SSID and password.
21  *
22  * @author Vikram Aggarwal
23  */
24 public final class WifiParsedResult extends ParsedResult {
25 
26   private final String ssid;
27   private final String networkEncryption;
28   private final String password;
29   private final boolean hidden;
30   private final String identity;
31   private final String anonymousIdentity;
32   private final String eapMethod;
33   private final String phase2Method;
34 
WifiParsedResult(String networkEncryption, String ssid, String password)35   public WifiParsedResult(String networkEncryption, String ssid, String password) {
36     this(networkEncryption, ssid, password, false);
37   }
38 
WifiParsedResult(String networkEncryption, String ssid, String password, boolean hidden)39   public WifiParsedResult(String networkEncryption, String ssid, String password, boolean hidden) {
40     this(networkEncryption, ssid, password, hidden, null, null, null, null);
41   }
42 
WifiParsedResult(String networkEncryption, String ssid, String password, boolean hidden, String identity, String anonymousIdentity, String eapMethod, String phase2Method)43   public WifiParsedResult(String networkEncryption,
44                           String ssid,
45                           String password,
46                           boolean hidden,
47                           String identity,
48                           String anonymousIdentity,
49                           String eapMethod,
50                           String phase2Method) {
51     super(ParsedResultType.WIFI);
52     this.ssid = ssid;
53     this.networkEncryption = networkEncryption;
54     this.password = password;
55     this.hidden = hidden;
56     this.identity = identity;
57     this.anonymousIdentity = anonymousIdentity;
58     this.eapMethod = eapMethod;
59     this.phase2Method = phase2Method;
60   }
61 
getSsid()62   public String getSsid() {
63     return ssid;
64   }
65 
getNetworkEncryption()66   public String getNetworkEncryption() {
67     return networkEncryption;
68   }
69 
getPassword()70   public String getPassword() {
71     return password;
72   }
73 
isHidden()74   public boolean isHidden() {
75     return hidden;
76   }
77 
getIdentity()78   public String getIdentity() {
79     return identity;
80   }
81 
getAnonymousIdentity()82   public String getAnonymousIdentity() {
83     return anonymousIdentity;
84   }
85 
getEapMethod()86   public String getEapMethod() {
87     return eapMethod;
88   }
89 
getPhase2Method()90   public String getPhase2Method() {
91     return phase2Method;
92   }
93 
94   @Override
getDisplayResult()95   public String getDisplayResult() {
96     StringBuilder result = new StringBuilder(80);
97     maybeAppend(ssid, result);
98     maybeAppend(networkEncryption, result);
99     maybeAppend(password, result);
100     maybeAppend(Boolean.toString(hidden), result);
101     return result.toString();
102   }
103 
104 }
105