+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/android/WIFITrick/app/.gitignore b/android/WIFITrick/app/.gitignore
new file mode 100644
index 0000000..796b96d
--- /dev/null
+++ b/android/WIFITrick/app/.gitignore
@@ -0,0 +1 @@
+/build
diff --git a/android/WIFITrick/app/build.gradle b/android/WIFITrick/app/build.gradle
new file mode 100644
index 0000000..851a2f6
--- /dev/null
+++ b/android/WIFITrick/app/build.gradle
@@ -0,0 +1,34 @@
+apply plugin: 'com.android.application'
+
+android {
+ compileSdkVersion 27
+ defaultConfig {
+ applicationId "com.scorpiomiku.wifitrick"
+ minSdkVersion 19
+ targetSdkVersion 27
+ versionCode 1
+ versionName "1.0"
+ testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
+ }
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ }
+ }
+}
+
+dependencies {
+ implementation fileTree(dir: 'libs', include: ['*.jar'])
+ implementation 'com.android.support:appcompat-v7:27.1.1'
+ implementation 'com.android.support.constraint:constraint-layout:1.1.3'
+ testImplementation 'junit:junit:4.12'
+ androidTestImplementation 'com.android.support.test:runner:1.0.2'
+ androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
+
+ //okhttp
+ implementation("com.squareup.okhttp3:okhttp:3.12.0")
+ testImplementation("com.squareup.okhttp3:mockwebserver:3.12.0")
+ //gson
+ implementation 'com.google.code.gson:gson:2.7'
+}
diff --git a/android/WIFITrick/app/proguard-rules.pro b/android/WIFITrick/app/proguard-rules.pro
new file mode 100644
index 0000000..f1b4245
--- /dev/null
+++ b/android/WIFITrick/app/proguard-rules.pro
@@ -0,0 +1,21 @@
+# Add project specific ProGuard rules here.
+# You can control the set of applied configuration files using the
+# proguardFiles setting in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
+
+# Uncomment this to preserve the line number information for
+# debugging stack traces.
+#-keepattributes SourceFile,LineNumberTable
+
+# If you keep the line number information, uncomment this to
+# hide the original source file name.
+#-renamesourcefileattribute SourceFile
diff --git a/android/WIFITrick/app/src/androidTest/java/com/scorpiomiku/wifitrick/ExampleInstrumentedTest.java b/android/WIFITrick/app/src/androidTest/java/com/scorpiomiku/wifitrick/ExampleInstrumentedTest.java
new file mode 100644
index 0000000..e5a7681
--- /dev/null
+++ b/android/WIFITrick/app/src/androidTest/java/com/scorpiomiku/wifitrick/ExampleInstrumentedTest.java
@@ -0,0 +1,26 @@
+package com.scorpiomiku.wifitrick;
+
+import android.content.Context;
+import android.support.test.InstrumentationRegistry;
+import android.support.test.runner.AndroidJUnit4;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import static org.junit.Assert.*;
+
+/**
+ * Instrumented test, which will execute on an Android device.
+ *
+ * @see Testing documentation
+ */
+@RunWith(AndroidJUnit4.class)
+public class ExampleInstrumentedTest {
+ @Test
+ public void useAppContext() throws Exception {
+ // Context of the app under test.
+ Context appContext = InstrumentationRegistry.getTargetContext();
+
+ assertEquals("com.scorpiomiku.wifitrick", appContext.getPackageName());
+ }
+}
diff --git a/android/WIFITrick/app/src/main/AndroidManifest.xml b/android/WIFITrick/app/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..0ea687d
--- /dev/null
+++ b/android/WIFITrick/app/src/main/AndroidManifest.xml
@@ -0,0 +1,40 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/android/WIFITrick/app/src/main/java/com/scorpiomiku/wifitrick/MainActivity.java b/android/WIFITrick/app/src/main/java/com/scorpiomiku/wifitrick/MainActivity.java
new file mode 100644
index 0000000..590859a
--- /dev/null
+++ b/android/WIFITrick/app/src/main/java/com/scorpiomiku/wifitrick/MainActivity.java
@@ -0,0 +1,133 @@
+package com.scorpiomiku.wifitrick;
+
+import android.Manifest;
+import android.annotation.SuppressLint;
+import android.content.Context;
+import android.content.pm.PackageManager;
+import android.net.ConnectivityManager;
+import android.net.wifi.ScanResult;
+import android.net.wifi.WifiConfiguration;
+import android.net.wifi.WifiManager;
+import android.os.Build;
+import android.os.Handler;
+import android.os.Message;
+import android.support.annotation.RequiresApi;
+import android.support.v4.app.ActivityCompat;
+import android.support.v4.content.ContextCompat;
+import android.support.v7.app.AppCompatActivity;
+import android.os.Bundle;
+import android.telephony.SubscriptionManager;
+import android.telephony.TelephonyManager;
+import android.util.Log;
+import android.view.View;
+import android.widget.Button;
+import android.widget.TextView;
+
+import com.google.gson.Gson;
+import com.google.gson.JsonObject;
+import com.google.gson.JsonParser;
+
+import java.io.IOException;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+import okhttp3.Call;
+import okhttp3.Callback;
+import okhttp3.Response;
+
+public class MainActivity extends AppCompatActivity {
+
+ private static final String TAG = "MainActivity";
+ private Button testButton;
+ private Button testButton2;
+ private Button startButton;
+ private static TextView textView;
+ private static WifiManager wifiManager;
+ private List wifiList = new ArrayList<>();
+ private static Handler handler;
+ private static Context context;
+
+ @SuppressLint("HandlerLeak")
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_main);
+ handler = new Handler() {
+ @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP_MR1)
+ @Override
+ public void handleMessage(Message msg) {
+ super.handleMessage(msg);
+ switch (msg.what) {
+ case 1:
+ //关闭wifi的逻辑
+ Log.d(TAG, "handleMessage: 关网");
+ wifiManager.setWifiEnabled(false);
+ break;
+ }
+ }
+ };
+ context = this;
+ testButton = findViewById(R.id.test);
+ testButton2 = findViewById(R.id.test2);
+ startButton = findViewById(R.id.start);
+ textView = findViewById(R.id.text);
+ wifiManager = (WifiManager) getApplicationContext().getSystemService(Context.WIFI_SERVICE);
+
+// checkPermission();
+ startButton.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ openWifi();
+ }
+ });
+ }
+
+
+ /**
+ * 获取wifi列表
+ */
+ private void getWifiList() {
+ wifiList = wifiManager.getScanResults();
+ if (wifiList.size() == 0) {
+ Log.d(TAG, "onClick: empty");
+ } else {
+ for (ScanResult result :
+ wifiList) {
+ Log.d(TAG, "onReceive: " + result.toString());
+ }
+ }
+ }
+
+ /**
+ * 延时10s关闭wifi
+ */
+ public static void delayCloseWifi() {
+ new Thread(new Runnable() {
+ @Override
+ public void run() {
+ try {
+ Thread.sleep(2000);
+ handler.sendEmptyMessage(1);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ }).start();
+ }
+
+ /**
+ * 打开wifi,自动链接
+ */
+ public static void openWifi() {
+ wifiManager.setWifiEnabled(true);
+ }
+
+ public static void connectWifi() {
+ WifiConnect wifiConnect = new WifiConnect(context, textView);
+ wifiConnect.addNetWork("sunplus_009", "");
+ }
+
+
+}
diff --git a/android/WIFITrick/app/src/main/java/com/scorpiomiku/wifitrick/NetworkReceiver.java b/android/WIFITrick/app/src/main/java/com/scorpiomiku/wifitrick/NetworkReceiver.java
new file mode 100644
index 0000000..1fe055b
--- /dev/null
+++ b/android/WIFITrick/app/src/main/java/com/scorpiomiku/wifitrick/NetworkReceiver.java
@@ -0,0 +1,161 @@
+package com.scorpiomiku.wifitrick;
+
+import android.annotation.SuppressLint;
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.net.ConnectivityManager;
+import android.net.NetworkInfo;
+import android.net.wifi.SupplicantState;
+import android.net.wifi.WifiInfo;
+import android.net.wifi.WifiManager;
+import android.os.Handler;
+import android.os.Message;
+import android.os.Parcelable;
+import android.util.Log;
+
+import java.io.IOException;
+import java.util.HashMap;
+
+import okhttp3.Call;
+import okhttp3.Callback;
+import okhttp3.Response;
+
+/**
+ * Created by ScorpioMiku on 2019/9/3.
+ */
+
+public class NetworkReceiver extends BroadcastReceiver {
+ private static final String TAG = "NetworkReceiver";
+ public static final int STATE1 = 1;//密码错误
+ public static final int STATE2 = 2;//连接成功
+ public static final int STATE3 = 3;//连接失败
+ public static final int STATE4 = 4;//正在获取ip地址
+ public static final int STATE5 = 5;//正在连接
+ public static HashMap mapData = new HashMap<>();
+ @SuppressLint("HandlerLeak")
+ private Handler handler = new Handler() {
+ @Override
+ public void handleMessage(Message msg) {
+ super.handleMessage(msg);
+ switch (msg.what) {
+ case 1:
+ upData();
+ break;
+ }
+ }
+ };
+
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ if (WifiManager.SUPPLICANT_STATE_CHANGED_ACTION.equals(intent.getAction())) {
+ //密码错误广播,是不是正在获得IP地址
+ int linkWifiResult = intent.getIntExtra(WifiManager.EXTRA_SUPPLICANT_ERROR, -1);
+ if (linkWifiResult == WifiManager.ERROR_AUTHENTICATING) {
+ //密码错误
+ Log.d(TAG, "onReceive: 密码错误");
+ }
+ SupplicantState supplicantState = intent.getParcelableExtra(WifiManager.EXTRA_NEW_STATE);
+ NetworkInfo.DetailedState state = WifiInfo.getDetailedStateOf(supplicantState);
+ if (state == NetworkInfo.DetailedState.CONNECTING) {
+ //正在连接
+ Log.d(TAG, "onReceive: 正在连接");
+ } else if (state == NetworkInfo.DetailedState.FAILED
+ || state == NetworkInfo.DetailedState.DISCONNECTING) {
+ //连接失败
+ Log.d(TAG, "onReceive: 连接失败");
+ } else if (state == NetworkInfo.DetailedState.CONNECTED) {
+ //连接成功
+ Log.d(TAG, "onReceive: 连接成功");
+ } else if (state == NetworkInfo.DetailedState.OBTAINING_IPADDR) {
+ //正在获取ip地址
+ Log.d(TAG, "onReceive: 正在获取ip地址");
+ } else if (state == NetworkInfo.DetailedState.IDLE) {
+ //闲置的
+ Log.d(TAG, "onReceive: 闲置");
+ }
+ } else if (WifiManager.WIFI_STATE_CHANGED_ACTION.equals(intent.getAction())) {
+ // 监听wifi的打开与关闭,与wifi的连接无关
+ int wifiState = intent.getIntExtra(WifiManager.EXTRA_WIFI_STATE, 0);
+ switch (wifiState) {
+ case WifiManager.WIFI_STATE_DISABLING://正在停止0
+ Log.d(TAG, "onReceive: 正在停止");
+ break;
+ case WifiManager.WIFI_STATE_DISABLED://已停止1
+ Log.d(TAG, "onReceive: 已停止");
+// upData();
+ new Thread(new Runnable() {
+ @Override
+ public void run() {
+ try {
+ Thread.sleep(5000);
+ handler.sendEmptyMessage(1);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ }).start();
+ break;
+ case WifiManager.WIFI_STATE_UNKNOWN://未知4
+ Log.d(TAG, "onReceive: 未知");
+ break;
+ case WifiManager.WIFI_STATE_ENABLING://正在打开2
+ Log.d(TAG, "onReceive: 正在打开");
+ break;
+ case WifiManager.WIFI_STATE_ENABLED://已开启3
+ Log.d(TAG, "onReceive: 已打开");
+ MainActivity.connectWifi();
+ break;
+ default:
+ break;
+ }
+ } else if (WifiManager.NETWORK_STATE_CHANGED_ACTION.equals(intent.getAction())) {
+ // 监听wifi的连接状态即是否连上了一个有效无线路由
+ Parcelable parcelableExtra = intent
+ .getParcelableExtra(WifiManager.EXTRA_NETWORK_INFO);
+ if (null != parcelableExtra) {
+ // 获取联网状态的NetWorkInfo对象
+ NetworkInfo networkInfo = (NetworkInfo) parcelableExtra;
+ //获取的State对象则代表着连接成功与否等状态
+ NetworkInfo.State state = networkInfo.getState();
+ //判断网络是否已经连接
+ boolean isConnected = state == NetworkInfo.State.CONNECTED;
+// Log.v(Constants.HTTP_WZ, "isConnected:" + isConnected);
+ if (isConnected) {
+// ToastUtils.showTipMsg(R.string.linked_success);
+ }
+ }
+ }
+ }
+
+ @SuppressWarnings("unused")
+ private String getConnectionType(int type) {
+ String connType = "";
+ if (type == ConnectivityManager.TYPE_MOBILE) {
+ connType = "移动网络";
+ } else if (type == ConnectivityManager.TYPE_WIFI) {
+ connType = "WIFI网络";
+ }
+ return connType;
+ }
+
+
+ /**
+ * 上传数据到服务器
+ */
+ private void upData() {
+ WebUtils.upRoomState(mapData, new Callback() {
+ @Override
+ public void onFailure(Call call, IOException e) {
+ Log.e(TAG, "onFailure: " + e.getMessage());
+ }
+
+ @Override
+ public void onResponse(Call call, Response response) throws IOException {
+ Log.d(TAG, "onResponse: upok");
+ mapData.clear();
+ MainActivity.openWifi();
+ }
+ });
+ }
+}
\ No newline at end of file
diff --git a/android/WIFITrick/app/src/main/java/com/scorpiomiku/wifitrick/Node.java b/android/WIFITrick/app/src/main/java/com/scorpiomiku/wifitrick/Node.java
new file mode 100644
index 0000000..f38be7c
--- /dev/null
+++ b/android/WIFITrick/app/src/main/java/com/scorpiomiku/wifitrick/Node.java
@@ -0,0 +1,56 @@
+package com.scorpiomiku.wifitrick;
+
+/**
+ * Created by ScorpioMiku on 2019/9/3.
+ */
+
+public class Node {
+ private String nwkAddr;
+ private String parAddr;
+ private String macAddr;
+ private funcList[] funcList;
+
+ public com.scorpiomiku.wifitrick.funcList[] getFuncList() {
+ return funcList;
+ }
+
+ public void setFuncList(com.scorpiomiku.wifitrick.funcList[] funcList) {
+ this.funcList = funcList;
+ }
+
+ @Override
+ public String toString() {
+ return "Node{" +
+ "nwkAddr='" + nwkAddr + '\'' +
+ ", parAddr='" + parAddr + '\'' +
+ ", macAddr='" + macAddr + '\'' +
+ ", funcList=" + funcList +
+ '}';
+ }
+
+ public String getNwkAddr() {
+ return nwkAddr;
+ }
+
+ public void setNwkAddr(String nwkAddr) {
+ this.nwkAddr = nwkAddr;
+ }
+
+ public String getParAddr() {
+ return parAddr;
+ }
+
+ public void setParAddr(String parAddr) {
+ this.parAddr = parAddr;
+ }
+
+ public String getMacAddr() {
+ return macAddr;
+ }
+
+ public void setMacAddr(String macAddr) {
+ this.macAddr = macAddr;
+ }
+
+
+}
diff --git a/android/WIFITrick/app/src/main/java/com/scorpiomiku/wifitrick/RoomData.java b/android/WIFITrick/app/src/main/java/com/scorpiomiku/wifitrick/RoomData.java
new file mode 100644
index 0000000..b88ff77
--- /dev/null
+++ b/android/WIFITrick/app/src/main/java/com/scorpiomiku/wifitrick/RoomData.java
@@ -0,0 +1,84 @@
+package com.scorpiomiku.wifitrick;
+
+import java.util.HashMap;
+
+/**
+ * Created by ScorpioMiku on 2019/9/3.
+ */
+
+public class RoomData {
+ private String isin;
+ private String temporature;
+ private String humidity;
+ private String time;
+ private String roomId;
+
+ public RoomData(String isin, String temporature, String humidity, String time, String roomId) {
+ this.isin = isin;
+ this.temporature = temporature;
+ this.humidity = humidity;
+ this.time = time;
+ this.roomId = roomId;
+ }
+
+ public HashMap getMap() {
+ HashMap mapData = new HashMap<>();
+ mapData.put("roomId", getRoomId());
+ mapData.put("time", TimeUtils.getTime());
+ mapData.put("temperature", getTemporature());
+ mapData.put("humidity", getHumidity());
+ mapData.put("isin", getIsin());
+ return mapData;
+ }
+
+ public String getIsin() {
+ return isin;
+ }
+
+ public void setIsin(String isin) {
+ this.isin = isin;
+ }
+
+ public String getTemporature() {
+ return temporature;
+ }
+
+ public void setTemporature(String temporature) {
+ this.temporature = temporature;
+ }
+
+ public String getHumidity() {
+ return humidity;
+ }
+
+ public void setHumidity(String humidity) {
+ this.humidity = humidity;
+ }
+
+ public String getTime() {
+ return time;
+ }
+
+ public void setTime(String time) {
+ this.time = time;
+ }
+
+ public String getRoomId() {
+ return roomId;
+ }
+
+ public void setRoomId(String roomId) {
+ this.roomId = roomId;
+ }
+
+ @Override
+ public String toString() {
+ return "RoomData{" +
+ "isin='" + isin + '\'' +
+ ", temporature='" + temporature + '\'' +
+ ", humidity='" + humidity + '\'' +
+ ", time='" + time + '\'' +
+ ", roomId='" + roomId + '\'' +
+ '}';
+ }
+}
diff --git a/android/WIFITrick/app/src/main/java/com/scorpiomiku/wifitrick/TimeUtils.java b/android/WIFITrick/app/src/main/java/com/scorpiomiku/wifitrick/TimeUtils.java
new file mode 100644
index 0000000..b545d2a
--- /dev/null
+++ b/android/WIFITrick/app/src/main/java/com/scorpiomiku/wifitrick/TimeUtils.java
@@ -0,0 +1,22 @@
+package com.scorpiomiku.wifitrick;
+
+import android.annotation.SuppressLint;
+
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.TimeZone;
+
+/**
+ * Created by ScorpioMiku on 2019/9/3.
+ */
+
+public class TimeUtils {
+ public static String getTime() {
+ @SuppressLint("SimpleDateFormat")
+ SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");// HH:mm:ss
+ //获取当前时间
+ Date date = new Date(System.currentTimeMillis());
+ return simpleDateFormat.format(date);
+ }
+}
diff --git a/android/WIFITrick/app/src/main/java/com/scorpiomiku/wifitrick/WebUtils.java b/android/WIFITrick/app/src/main/java/com/scorpiomiku/wifitrick/WebUtils.java
new file mode 100644
index 0000000..f773029
--- /dev/null
+++ b/android/WIFITrick/app/src/main/java/com/scorpiomiku/wifitrick/WebUtils.java
@@ -0,0 +1,77 @@
+package com.scorpiomiku.wifitrick;
+
+import android.util.Log;
+
+import com.google.gson.JsonObject;
+import com.google.gson.JsonParser;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Set;
+
+import okhttp3.Call;
+import okhttp3.Callback;
+import okhttp3.FormBody;
+import okhttp3.MediaType;
+import okhttp3.OkHttpClient;
+import okhttp3.Request;
+import okhttp3.RequestBody;
+import okhttp3.Response;
+
+/**
+ * Created by ScorpioMiku on 2019/9/3.
+ */
+
+public class WebUtils {
+ private static final String TAG = "WebUtils";
+ private static WebUtils instance = new WebUtils();
+ private static OkHttpClient mClient = new OkHttpClient();
+ private static final String webHost = "http://39.105.65.209:8080";
+
+ private WebUtils() {
+ }
+
+ public static WebUtils getInstance() {
+ return instance;
+ }
+
+ public static FormBody getBody(HashMap data) {
+ FormBody.Builder bodyBuilder = new FormBody.Builder();
+ Set keys = data.keySet();
+ for (String key : keys) {
+ bodyBuilder.add(key, data.get(key));
+ }
+
+ return bodyBuilder.build();
+ }
+
+ public static RequestBody getRequestBody(HashMap data) {
+ String body = "";
+ MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded");
+ Set keys = data.keySet();
+ for (String key : keys) {
+ body += key + "=" + data.get(key) + "&";
+ }
+ body = body.substring(0, body.length() - 1);
+// Log.d(TAG, "getRequestBody: " + body);
+ RequestBody requestBody = RequestBody.create(mediaType, body);
+ return requestBody;
+ }
+
+ public static void upRoomState(HashMap hashMap, Callback callback) {
+ Request request = new Request.Builder().post(getRequestBody(hashMap))
+ .url(webHost + "/rstate/add/").build();
+ Call call = mClient.newCall(request);
+ call.enqueue(callback);
+ }
+
+ public static void getTest(Callback callback) {
+ Request request = new Request.Builder()
+ .url("http://192.168.0.1/cgi-bin/node.cgi")
+ .build();
+ Call call = mClient.newCall(request);
+ call.enqueue(callback);
+ }
+
+
+}
diff --git a/android/WIFITrick/app/src/main/java/com/scorpiomiku/wifitrick/WifiConnect.java b/android/WIFITrick/app/src/main/java/com/scorpiomiku/wifitrick/WifiConnect.java
new file mode 100644
index 0000000..94f5ce3
--- /dev/null
+++ b/android/WIFITrick/app/src/main/java/com/scorpiomiku/wifitrick/WifiConnect.java
@@ -0,0 +1,218 @@
+package com.scorpiomiku.wifitrick;
+
+import android.annotation.SuppressLint;
+import android.content.Context;
+import android.net.wifi.WifiConfiguration;
+import android.net.wifi.WifiManager;
+import android.os.Handler;
+import android.os.Message;
+import android.util.Log;
+import android.widget.TextView;
+
+import com.google.gson.Gson;
+
+import java.io.IOException;
+import java.util.List;
+
+import okhttp3.Call;
+import okhttp3.Callback;
+import okhttp3.Response;
+
+/**
+ * Created by ScorpioMiku on 2019/9/3.
+ */
+
+public class WifiConnect {
+ private WifiManager mWifiManager;
+ private List wifiConfigurationList;
+ private Context mContext;
+ private TextView textView;
+
+ private String isin;
+ private String temporature;
+ private String humidity;
+ private String time;
+ private String roomId;
+
+ private Handler handler;
+ private static final String TAG = "WifiConnect";
+
+
+ @SuppressLint("HandlerLeak")
+ public WifiConnect(Context context, TextView view) {
+ // 常驻
+ mWifiManager = (WifiManager) context.getApplicationContext().getSystemService(Context.WIFI_SERVICE);
+ textView = view;
+ handler = new Handler() {
+ @Override
+ public void handleMessage(Message msg) {
+ super.handleMessage(msg);
+ switch (msg.what) {
+ case 1:
+ getRoomData();
+ break;
+ }
+ }
+ };
+ }
+
+ public WifiConnect(List wifiConfigurationList, WifiManager mWifiManager) {
+ this.wifiConfigurationList = wifiConfigurationList;
+ this.mWifiManager = mWifiManager;
+ }
+
+
+ /**
+ * 连接wifi
+ */
+ public void addNetWork(String SSID, String PASSW) {
+ int netId = -1;
+ if (removeWifi(SSID)) {
+ Log.e("sin", "移除,新建config");
+ netId = mWifiManager.addNetwork(createWifiInfo(SSID, PASSW));
+ } else {
+ if (getExitsWifiConfig(SSID) != null) {
+ Log.e("sin", "这个wifi是连接过");
+ netId = getExitsWifiConfig(SSID).networkId;
+ } else {
+ Log.e("sin", "没连接过的,新建一个wifi配置 ");
+ netId = mWifiManager.addNetwork(createWifiInfo(SSID, PASSW));
+ }
+ }
+
+ Log.e("sin", "netId: " + netId);
+
+ boolean b = mWifiManager.enableNetwork(netId, true); // 无论咋这都会返回true;
+ Log.e("sin", "ssss: " + b);
+ if (!b) {
+ Log.e("SSSSSSSSSSSS", "-0.0-");
+ // 如果这里失败,再从新获取manager 重新配置config;
+ mWifiManager = (WifiManager) mContext.getApplicationContext().getSystemService(Context.WIFI_SERVICE);
+ // 配置config
+ } else {
+ Log.e("SIN", "success");
+ new Thread(new Runnable() {
+ @Override
+ public void run() {
+ try {
+ Thread.sleep(5000);
+ handler.sendEmptyMessage(1);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ }).start();
+ }
+
+ }
+
+ private void getRoomData() {
+ WebUtils.getTest(new Callback() {
+ @Override
+ public void onFailure(Call call, IOException e) {
+
+ }
+
+ @Override
+ public void onResponse(Call call, Response response) throws IOException {
+ NetworkReceiver.mapData.clear();
+ String body = response.body().string();
+ Gson gson = new Gson();
+ Node[] nodes = gson.fromJson(body, Node[].class);
+ for (Node node : nodes) {
+ funcList[] funcLists = node.getFuncList();
+ for (funcList funcList : funcLists) {
+ if (funcList.getType().equals("安防")) {
+ isin = String.valueOf((int) funcList.getData());
+ } else if (funcList.getType().equals("温度")) {
+ temporature = String.valueOf(funcList.getData());
+ } else if (funcList.getType().equals("湿度")) {
+ humidity = String.valueOf(funcList.getData());
+ }
+ }
+ }
+ RoomData roomData = new RoomData(isin, temporature, humidity, TimeUtils.getTime(), "1");
+ NetworkReceiver.mapData.putAll(roomData.getMap());
+ Log.d(TAG, "onResponse: " + roomData);
+ MainActivity.delayCloseWifi();
+ }
+ });
+ }
+
+ /**
+ * 存在过的wifiConfiguration
+ */
+ public WifiConfiguration getExitsWifiConfig(String SSID) {
+ wifiConfigurationList = mWifiManager.getConfiguredNetworks();
+ for (WifiConfiguration wifiConfiguration : wifiConfigurationList) {
+ if (wifiConfiguration.SSID.equals("\"" + SSID + "\"")) {
+ return wifiConfiguration;
+ }
+ }
+ return null;
+ }
+
+
+ public boolean removeWifi(int netId) {
+ //
+ return mWifiManager.removeNetwork(netId);
+ }
+
+ /**
+ * config里存在; 在mWifiManager移除;
+ */
+ public boolean removeWifi(String SSID) {
+ if (getExitsWifiConfig(SSID) != null) {
+ return removeWifi(getExitsWifiConfig(SSID).networkId);
+ } else {
+ return false;
+ }
+ }
+
+
+ /**
+ * CHUANJian
+ *
+ * @param SSID
+ * @param password
+ * @return
+ */
+ public WifiConfiguration createWifiInfo(String SSID, String password) {
+ WifiConfiguration config = new WifiConfiguration();
+
+ if (config != null) {
+ config.allowedAuthAlgorithms.clear();
+ config.allowedGroupCiphers.clear();
+ config.allowedKeyManagement.clear();
+ config.allowedPairwiseCiphers.clear();
+ config.allowedProtocols.clear();
+ config.SSID = "\"" + SSID + "\"";
+
+ //如果有相同配置的,就先删除
+ WifiConfiguration tempConfig = getExitsWifiConfig(SSID);
+ if (tempConfig != null) {
+ mWifiManager.removeNetwork(tempConfig.networkId);
+ mWifiManager.saveConfiguration();
+ }
+ config.preSharedKey = "\"" + password + "\"";
+ config.hiddenSSID = true;
+ config.allowedAuthAlgorithms.set(WifiConfiguration.AuthAlgorithm.OPEN);
+ config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.TKIP);
+ config.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.WPA_PSK);
+ config.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.TKIP);
+ //config.allowedProtocols.set(WifiConfiguration.Protocol.WPA);
+ config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.CCMP);
+ config.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.CCMP);
+ config.status = WifiConfiguration.Status.ENABLED;
+
+ Log.e("sin", "config: " + config.SSID + " config: " + config.toString());
+ return config;
+ } else {
+
+ Log.e("SSS", "WOCAO NULL !!!");
+ return null;
+ }
+
+ }
+}
+
diff --git a/android/WIFITrick/app/src/main/java/com/scorpiomiku/wifitrick/funcList.java b/android/WIFITrick/app/src/main/java/com/scorpiomiku/wifitrick/funcList.java
new file mode 100644
index 0000000..5bdff9a
--- /dev/null
+++ b/android/WIFITrick/app/src/main/java/com/scorpiomiku/wifitrick/funcList.java
@@ -0,0 +1,57 @@
+package com.scorpiomiku.wifitrick;
+
+import java.util.HashMap;
+
+/**
+ * Created by ScorpioMiku on 2019/9/3.
+ */
+
+public class funcList {
+
+ private String typeCode;
+ private String type;
+ private float cycle;
+ private float data;
+
+ @Override
+ public String toString() {
+ return "funcList{" +
+ "typeCode='" + typeCode + '\'' +
+ ", type='" + type + '\'' +
+ ", cycle=" + cycle +
+ ", data=" + data +
+ '}';
+ }
+
+ public String getTypeCode() {
+ return typeCode;
+ }
+
+ public void setTypeCode(String typeCode) {
+ this.typeCode = typeCode;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public float getCycle() {
+ return cycle;
+ }
+
+ public void setCycle(float cycle) {
+ this.cycle = cycle;
+ }
+
+ public float getData() {
+ return data;
+ }
+
+ public void setData(float data) {
+ this.data = data;
+ }
+}
diff --git a/android/WIFITrick/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/android/WIFITrick/app/src/main/res/drawable-v24/ic_launcher_foreground.xml
new file mode 100644
index 0000000..c7bd21d
--- /dev/null
+++ b/android/WIFITrick/app/src/main/res/drawable-v24/ic_launcher_foreground.xml
@@ -0,0 +1,34 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/android/WIFITrick/app/src/main/res/drawable/ic_launcher_background.xml b/android/WIFITrick/app/src/main/res/drawable/ic_launcher_background.xml
new file mode 100644
index 0000000..d5fccc5
--- /dev/null
+++ b/android/WIFITrick/app/src/main/res/drawable/ic_launcher_background.xml
@@ -0,0 +1,170 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/android/WIFITrick/app/src/main/res/layout/activity_main.xml b/android/WIFITrick/app/src/main/res/layout/activity_main.xml
new file mode 100644
index 0000000..de0fd7d
--- /dev/null
+++ b/android/WIFITrick/app/src/main/res/layout/activity_main.xml
@@ -0,0 +1,46 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/android/WIFITrick/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/android/WIFITrick/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
new file mode 100644
index 0000000..eca70cf
--- /dev/null
+++ b/android/WIFITrick/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/android/WIFITrick/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/android/WIFITrick/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
new file mode 100644
index 0000000..eca70cf
--- /dev/null
+++ b/android/WIFITrick/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/android/WIFITrick/app/src/main/res/mipmap-hdpi/ic_launcher.png b/android/WIFITrick/app/src/main/res/mipmap-hdpi/ic_launcher.png
new file mode 100644
index 0000000..a2f5908
Binary files /dev/null and b/android/WIFITrick/app/src/main/res/mipmap-hdpi/ic_launcher.png differ
diff --git a/android/WIFITrick/app/src/main/res/mipmap-hdpi/ic_launcher_round.png b/android/WIFITrick/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
new file mode 100644
index 0000000..1b52399
Binary files /dev/null and b/android/WIFITrick/app/src/main/res/mipmap-hdpi/ic_launcher_round.png differ
diff --git a/android/WIFITrick/app/src/main/res/mipmap-mdpi/ic_launcher.png b/android/WIFITrick/app/src/main/res/mipmap-mdpi/ic_launcher.png
new file mode 100644
index 0000000..ff10afd
Binary files /dev/null and b/android/WIFITrick/app/src/main/res/mipmap-mdpi/ic_launcher.png differ
diff --git a/android/WIFITrick/app/src/main/res/mipmap-mdpi/ic_launcher_round.png b/android/WIFITrick/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
new file mode 100644
index 0000000..115a4c7
Binary files /dev/null and b/android/WIFITrick/app/src/main/res/mipmap-mdpi/ic_launcher_round.png differ
diff --git a/android/WIFITrick/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/android/WIFITrick/app/src/main/res/mipmap-xhdpi/ic_launcher.png
new file mode 100644
index 0000000..dcd3cd8
Binary files /dev/null and b/android/WIFITrick/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ
diff --git a/android/WIFITrick/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/android/WIFITrick/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
new file mode 100644
index 0000000..459ca60
Binary files /dev/null and b/android/WIFITrick/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png differ
diff --git a/android/WIFITrick/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/android/WIFITrick/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
new file mode 100644
index 0000000..8ca12fe
Binary files /dev/null and b/android/WIFITrick/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ
diff --git a/android/WIFITrick/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/android/WIFITrick/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
new file mode 100644
index 0000000..8e19b41
Binary files /dev/null and b/android/WIFITrick/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png differ
diff --git a/android/WIFITrick/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/android/WIFITrick/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
new file mode 100644
index 0000000..b824ebd
Binary files /dev/null and b/android/WIFITrick/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ
diff --git a/android/WIFITrick/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/android/WIFITrick/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
new file mode 100644
index 0000000..4c19a13
Binary files /dev/null and b/android/WIFITrick/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png differ
diff --git a/android/WIFITrick/app/src/main/res/values/colors.xml b/android/WIFITrick/app/src/main/res/values/colors.xml
new file mode 100644
index 0000000..3ab3e9c
--- /dev/null
+++ b/android/WIFITrick/app/src/main/res/values/colors.xml
@@ -0,0 +1,6 @@
+
+
+ #3F51B5
+ #303F9F
+ #FF4081
+
diff --git a/android/WIFITrick/app/src/main/res/values/strings.xml b/android/WIFITrick/app/src/main/res/values/strings.xml
new file mode 100644
index 0000000..9e5b1a8
--- /dev/null
+++ b/android/WIFITrick/app/src/main/res/values/strings.xml
@@ -0,0 +1,3 @@
+
+ WIFITrick
+
diff --git a/android/WIFITrick/app/src/main/res/values/styles.xml b/android/WIFITrick/app/src/main/res/values/styles.xml
new file mode 100644
index 0000000..5885930
--- /dev/null
+++ b/android/WIFITrick/app/src/main/res/values/styles.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
diff --git a/android/WIFITrick/app/src/test/java/com/scorpiomiku/wifitrick/ExampleUnitTest.java b/android/WIFITrick/app/src/test/java/com/scorpiomiku/wifitrick/ExampleUnitTest.java
new file mode 100644
index 0000000..3535010
--- /dev/null
+++ b/android/WIFITrick/app/src/test/java/com/scorpiomiku/wifitrick/ExampleUnitTest.java
@@ -0,0 +1,17 @@
+package com.scorpiomiku.wifitrick;
+
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+/**
+ * Example local unit test, which will execute on the development machine (host).
+ *
+ * @see Testing documentation
+ */
+public class ExampleUnitTest {
+ @Test
+ public void addition_isCorrect() throws Exception {
+ assertEquals(4, 2 + 2);
+ }
+}
\ No newline at end of file
diff --git a/android/WIFITrick/build.gradle b/android/WIFITrick/build.gradle
new file mode 100644
index 0000000..98b32b7
--- /dev/null
+++ b/android/WIFITrick/build.gradle
@@ -0,0 +1,33 @@
+// Top-level build file where you can add configuration options common to all sub-projects/modules.
+
+buildscript {
+
+ repositories {
+ google()
+ jcenter()
+ mavenCentral()
+ maven {
+ url "https://jitpack.io"
+ }
+ }
+ dependencies {
+ classpath 'com.android.tools.build:gradle:3.0.1'
+
+
+ // NOTE: Do not place your application dependencies here; they belong
+ // in the individual module build.gradle files
+ }
+}
+
+allprojects {
+ repositories {
+ google()
+ jcenter()
+ mavenCentral()
+ maven { url "https://jitpack.io" }
+ }
+}
+
+task clean(type: Delete) {
+ delete rootProject.buildDir
+}
diff --git a/android/WIFITrick/gradle.properties b/android/WIFITrick/gradle.properties
new file mode 100644
index 0000000..aac7c9b
--- /dev/null
+++ b/android/WIFITrick/gradle.properties
@@ -0,0 +1,17 @@
+# Project-wide Gradle settings.
+
+# IDE (e.g. Android Studio) users:
+# Gradle settings configured through the IDE *will override*
+# any settings specified in this file.
+
+# For more details on how to configure your build environment visit
+# http://www.gradle.org/docs/current/userguide/build_environment.html
+
+# Specifies the JVM arguments used for the daemon process.
+# The setting is particularly useful for tweaking memory settings.
+org.gradle.jvmargs=-Xmx1536m
+
+# When configured, Gradle will run in incubating parallel mode.
+# This option should only be used with decoupled projects. More details, visit
+# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
+# org.gradle.parallel=true
diff --git a/android/WIFITrick/gradle/wrapper/gradle-wrapper.jar b/android/WIFITrick/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 0000000..13372ae
Binary files /dev/null and b/android/WIFITrick/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/android/WIFITrick/gradle/wrapper/gradle-wrapper.properties b/android/WIFITrick/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 0000000..dd3667b
--- /dev/null
+++ b/android/WIFITrick/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,6 @@
+#Tue Sep 03 09:24:30 CST 2019
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
diff --git a/android/WIFITrick/gradlew b/android/WIFITrick/gradlew
new file mode 100644
index 0000000..9d82f78
--- /dev/null
+++ b/android/WIFITrick/gradlew
@@ -0,0 +1,160 @@
+#!/usr/bin/env bash
+
+##############################################################################
+##
+## Gradle start up script for UN*X
+##
+##############################################################################
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS=""
+
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD="maximum"
+
+warn ( ) {
+ echo "$*"
+}
+
+die ( ) {
+ echo
+ echo "$*"
+ echo
+ exit 1
+}
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+case "`uname`" in
+ CYGWIN* )
+ cygwin=true
+ ;;
+ Darwin* )
+ darwin=true
+ ;;
+ MINGW* )
+ msys=true
+ ;;
+esac
+
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`"/$link"
+ fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/" >/dev/null
+APP_HOME="`pwd -P`"
+cd "$SAVED" >/dev/null
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD="$JAVA_HOME/jre/sh/java"
+ else
+ JAVACMD="$JAVA_HOME/bin/java"
+ fi
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+else
+ JAVACMD="java"
+ which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
+ MAX_FD_LIMIT=`ulimit -H -n`
+ if [ $? -eq 0 ] ; then
+ if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
+ MAX_FD="$MAX_FD_LIMIT"
+ fi
+ ulimit -n $MAX_FD
+ if [ $? -ne 0 ] ; then
+ warn "Could not set maximum file descriptor limit: $MAX_FD"
+ fi
+ else
+ warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
+ fi
+fi
+
+# For Darwin, add options to specify how the application appears in the dock
+if $darwin; then
+ GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
+fi
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin ; then
+ APP_HOME=`cygpath --path --mixed "$APP_HOME"`
+ CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+ JAVACMD=`cygpath --unix "$JAVACMD"`
+
+ # We build the pattern for arguments to be converted via cygpath
+ ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
+ SEP=""
+ for dir in $ROOTDIRSRAW ; do
+ ROOTDIRS="$ROOTDIRS$SEP$dir"
+ SEP="|"
+ done
+ OURCYGPATTERN="(^($ROOTDIRS))"
+ # Add a user-defined pattern to the cygpath arguments
+ if [ "$GRADLE_CYGPATTERN" != "" ] ; then
+ OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
+ fi
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ i=0
+ for arg in "$@" ; do
+ CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
+ CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
+
+ if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
+ eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
+ else
+ eval `echo args$i`="\"$arg\""
+ fi
+ i=$((i+1))
+ done
+ case $i in
+ (0) set -- ;;
+ (1) set -- "$args0" ;;
+ (2) set -- "$args0" "$args1" ;;
+ (3) set -- "$args0" "$args1" "$args2" ;;
+ (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+ (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+ (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+ (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+ (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+ (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+ esac
+fi
+
+# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
+function splitJvmOpts() {
+ JVM_OPTS=("$@")
+}
+eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
+JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
+
+exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
diff --git a/android/WIFITrick/gradlew.bat b/android/WIFITrick/gradlew.bat
new file mode 100644
index 0000000..8a0b282
--- /dev/null
+++ b/android/WIFITrick/gradlew.bat
@@ -0,0 +1,90 @@
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS=
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto init
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto init
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:init
+@rem Get command-line arguments, handling Windowz variants
+
+if not "%OS%" == "Windows_NT" goto win9xME_args
+if "%@eval[2+2]" == "4" goto 4NT_args
+
+:win9xME_args
+@rem Slurp the command line arguments.
+set CMD_LINE_ARGS=
+set _SKIP=2
+
+:win9xME_args_slurp
+if "x%~1" == "x" goto execute
+
+set CMD_LINE_ARGS=%*
+goto execute
+
+:4NT_args
+@rem Get arguments from the 4NT Shell from JP Software
+set CMD_LINE_ARGS=%$
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/android/WIFITrick/settings.gradle b/android/WIFITrick/settings.gradle
new file mode 100644
index 0000000..e7b4def
--- /dev/null
+++ b/android/WIFITrick/settings.gradle
@@ -0,0 +1 @@
+include ':app'
diff --git a/android/handcircle/JYOU PRO SDK/android-sdk-jy/android-smartband-sdk-sxrblejy2/.idea/dictionaries/zhou0.xml b/android/handcircle/JYOU PRO SDK/android-sdk-jy/android-smartband-sdk-sxrblejy2/.idea/dictionaries/zhou0.xml
new file mode 100644
index 0000000..6f6186f
--- /dev/null
+++ b/android/handcircle/JYOU PRO SDK/android-sdk-jy/android-smartband-sdk-sxrblejy2/.idea/dictionaries/zhou0.xml
@@ -0,0 +1,3 @@
+
+
+
\ No newline at end of file
diff --git a/android/handcircle/JYOU PRO SDK/android-sdk-jy/android-smartband-sdk-sxrblejy2/.idea/gradle.xml b/android/handcircle/JYOU PRO SDK/android-sdk-jy/android-smartband-sdk-sxrblejy2/.idea/gradle.xml
new file mode 100644
index 0000000..e706236
--- /dev/null
+++ b/android/handcircle/JYOU PRO SDK/android-sdk-jy/android-smartband-sdk-sxrblejy2/.idea/gradle.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/android/handcircle/JYOU PRO SDK/android-sdk-jy/android-smartband-sdk-sxrblejy2/.idea/libraries/android_smartband_sdk_sxrblejy2aidl_release__aar.xml b/android/handcircle/JYOU PRO SDK/android-sdk-jy/android-smartband-sdk-sxrblejy2/.idea/libraries/android_smartband_sdk_sxrblejy2aidl_release__aar.xml
new file mode 100644
index 0000000..224096c
--- /dev/null
+++ b/android/handcircle/JYOU PRO SDK/android-sdk-jy/android-smartband-sdk-sxrblejy2/.idea/libraries/android_smartband_sdk_sxrblejy2aidl_release__aar.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/android/handcircle/JYOU PRO SDK/android-sdk-jy/android-smartband-sdk-sxrblejy2/.idea/libraries/android_smartband_sdk_sxrblejy2library_release__aar.xml b/android/handcircle/JYOU PRO SDK/android-sdk-jy/android-smartband-sdk-sxrblejy2/.idea/libraries/android_smartband_sdk_sxrblejy2library_release__aar.xml
new file mode 100644
index 0000000..dd7a1a0
--- /dev/null
+++ b/android/handcircle/JYOU PRO SDK/android-sdk-jy/android-smartband-sdk-sxrblejy2/.idea/libraries/android_smartband_sdk_sxrblejy2library_release__aar.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/android/handcircle/JYOU PRO SDK/android-sdk-jy/android-smartband-sdk-sxrblejy2/.idea/workspace.xml b/android/handcircle/JYOU PRO SDK/android-sdk-jy/android-smartband-sdk-sxrblejy2/.idea/workspace.xml
new file mode 100644
index 0000000..f38fce1
--- /dev/null
+++ b/android/handcircle/JYOU PRO SDK/android-sdk-jy/android-smartband-sdk-sxrblejy2/.idea/workspace.xml
@@ -0,0 +1,2770 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/android/图标/血氧.svg b/android/图标/血氧.svg
new file mode 100644
index 0000000..40ba469
--- /dev/null
+++ b/android/图标/血氧.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/android/图标/高血压.svg b/android/图标/高血压.svg
new file mode 100644
index 0000000..435b224
--- /dev/null
+++ b/android/图标/高血压.svg
@@ -0,0 +1 @@
+
\ No newline at end of file