Android activity to add a network, and all associated code for dealing
[zxing.git] / android / src / com / google / zxing / client / android / wifi / NetworkSetting.java
1 /*
2  * Copyright (C) 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.android.wifi;
18
19 import java.util.Vector;
20
21 import com.google.zxing.client.android.wifi.WifiActivity.NetworkType;
22
23 /**
24  * Everything we could get from the barcode is to be here
25  * @author Vikram Aggarwal
26  *
27  */
28 class NetworkSetting {
29   // The ancillary network setting from the barcode
30   private NetworkType mNetworkType;
31   // The password this ssid has
32   private String mPassword;
33   // The ssid we read from the barcode
34   private String mSsid;
35
36   static String[] toStringArray(Vector<String> strings) {
37     int size = strings.size();
38     String[] result = new String[size];
39     for (int j = 0; j < size; j++) {
40       result[j] = (String) strings.elementAt(j);
41     }
42     return result;
43   }
44   /**
45    * Create a new NetworkSetting object.
46    * @param ssid: The SSID
47    * @param password: Password for the setting, blank if unsecured network
48    * @param networkType: WPA for WPA/WPA2, or WEP for WEP or unsecured
49    */
50   public NetworkSetting(String ssid, String password, NetworkType networkType){
51     mSsid = ssid;
52     mPassword = password;
53     mNetworkType = networkType;
54   }
55
56   public NetworkType getNetworkType() {
57     return mNetworkType;
58   }
59   public String getPassword() {
60     return mPassword;
61   }
62
63   public String getSsid() {
64     return mSsid;
65   }
66 }