@@ -0,0 +1,2924 @@
+package com.android.utils.wificonnecter;%0A%0Aimport java.util.ArrayList;%0Aimport java.util.List;%0A%0Aimport android.content.Context;%0Aimport android.net.wifi.ScanResult;%0Aimport android.net.wifi.WifiInfo;%0Aimport android.net.wifi.WifiManager;%0A%0Apublic class WiFiAdmin %7B%0A    /**%0A     * android WifiManager%0A     */%0A    private WifiManager mWifiManager;%0A    /**%0A     * WifiAdmin%0A     */%0A    private static WiFiAdmin mInstance;%0A%0A    private WiFiAdmin(Context context) %7B%0A        mWifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);%0A    %7D%0A%0A    /**%0A     * WifiAdmin%0A     *%0A     * @param context%0A     *            android context%0A     * @return WifiAdmin%0A     */%0A    public static WiFiAdmin getInstance(Context mContext) %7B%0A        if (mInstance == null) %7B%0A            synchronized (WiFiAdmin.class) %7B%0A                if (mInstance == null) %7B%0A                    mInstance = new WiFiAdmin(mContext);%0A                %7D%0A            %7D%0A        %7D%0A        return mInstance;%0A    %7D%0A%0A    public WifiInfo getWifiInfo() %7B%0A        return mWifiManager.getConnectionInfo();%0A    %7D%0A%0A    public boolean startScan() %7B%0A        return mWifiManager.startScan();%0A    %7D%0A%0A    public WifiManager getWifiManager() %7B%0A        return mWifiManager;%0A    %7D%0A%0A    /**%0A     * get ScanResult list from android system%0A     *%0A     * @return ScanResult list%0A     */%0A    public List%3CScanResult%3E getScanResults() %7B%0A        mWifiManager.getConfiguredNetworks();%0A        mWifiManager.startScan();%0A        return (ArrayList%3CScanResult%3E) mWifiManager.getScanResults();%0A    %7D%0A%0A    public boolean openWifi() %7B%0A        if (mWifiManager != null && !mWifiManager.isWifiEnabled()) %7B%0A            return mWifiManager.setWifiEnabled(true);%0A        %7D%0A        return false;%0A    %7D%0A%0A    /**%0A     * Get the current phone connection wifi name%0A     *%0A     * @return%0A     */%0A    public String getCurrentWifiNetName()%7B%0A        return getWifiInfo().getSSID();%0A    %7D%0A%0A    public String getServerAddress()%7B%0A        int serverAddress = mWifiManager.getDhcpInfo().serverAddress;%0A        return %22http://%22 + intToIp(serverAddress) + %22/%22;%0A    %7D%0A%0A    private String intToIp(int paramInt) %7B%0A        return (paramInt & 0xFF) + %22.%22 + (0xFF & paramInt %3E%3E 8) + %22.%22 + (0xFF & paramInt %3E%3E 16) + %22.%22%0A                + (0xFF & paramInt %3E%3E 24);%0A    %7D%0A%0A    /**%0A     * get connected ap id%0A     *%0A     * @return ap ip%0A     */%0A    public String getCurrentWifiIp() %7B%0A        WifiInfo wifiInfo = mWifiManager.getConnectionInfo();%0A        int i = wifiInfo.getIpAddress();%0A        return (i & 0xFF) + %22.%22 + ((i %3E%3E 8) & 0xFF) + %22.%22 + ((i %3E%3E 16) & 0xFF)%0A                + %22.%22 + ((i %3E%3E 24) & 0xFF);%0A%0A    %7D%0A%0A    public boolean isWifiConnected() %7B%0A        WifiInfo wifiInfo = mWifiManager.getConnectionInfo();%0A        int ipAddress = wifiInfo == null ? 0 : wifiInfo.getIpAddress();%0A        if (mWifiManager.isWifiEnabled() && ipAddress != 0)%0A            return true;%0A        else%0A            return false;%0A    %7D%0A%0A%7D%0A

Create WiFiAdmin.java