From ec3f0ff822398d752511d516d0f3873e24c3fd41 Mon Sep 17 00:00:00 2001
From: JLChen <551775569@qq.com>
Date: 星期四, 05 十二月 2019 11:33:29 +0800
Subject: [PATCH] 2019-12-5 1.HDLElianZigBee aar库项目 上传管理。
---
HDLElianZigBeeDemo/build.gradle | 27
HDLElianZigBeeDemo/app/src/main/res/mipmap-xhdpi/ic_launcher.png | 0
HDLElianZigBeeDemo/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png | 0
HDLElianZigBeeDemo/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml | 5
HDLElianZigBeeDemo/app/src/main/res/values/strings.xml | 3
HDLElianZigBeeDemo/.idea/runConfigurations.xml | 12
HDLElianZigBeeDemo/.idea/encodings.xml | 4
HDLElianZigBeeDemo/HDLElianZigBee/src/main/jni/lib/armeabi/libelian.a | 0
HDLElianZigBeeDemo/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml | 5
HDLElianZigBeeDemo/app/src/main/AndroidManifest.xml | 22
HDLElianZigBeeDemo/HDLElianZigBee/src/main/jni/Application.mk | 3
HDLElianZigBeeDemo/app/proguard-rules.pro | 21
HDLElianZigBeeDemo/app/src/androidTest/java/com/hdl/hdlelianzigbee/ExampleInstrumentedTest.java | 27
HDLElianZigBeeDemo/app/src/main/res/layout/activity_elian.xml | 110 +++
HDLElianZigBeeDemo/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png | 0
HDLElianZigBeeDemo/HDLElianZigBee/src/main/jni/lib/mips64/libelian.a | 0
HDLElianZigBeeDemo/app/build.gradle | 30 +
HDLElianZigBeeDemo/HDLElianZigBee/src/main/jniLibs/arm64-v8a/libelianjni.so | 0
HDLElianZigBeeDemo/app/src/main/java/com/hdl/hdlelianzigbee/ElianActivity.java | 187 ++++++
HDLElianZigBeeDemo/app/src/main/res/mipmap-mdpi/ic_launcher.png | 0
HDLElianZigBeeDemo/HDLElianZigBee/src/main/jniLibs/mips/libelianjni.so | 0
HDLElianZigBeeDemo/HDLElianZigBee/src/main/jni/lib/armeabi-v7a/libelian.a | 0
HDLElianZigBeeDemo/app/src/main/res/mipmap-hdpi/ic_launcher_round.png | 0
HDLElianZigBeeDemo/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png | 0
HDLElianZigBeeDemo/HDLElianZigBee/src/main/jniLibs/x86_64/libelianjni.so | 0
HDLElianZigBeeDemo/gradle/wrapper/gradle-wrapper.jar | 0
HDLElianZigBeeDemo/app/src/main/res/drawable-v24/ic_launcher_foreground.xml | 34 +
HDLElianZigBeeDemo/gradle/wrapper/gradle-wrapper.properties | 6
HDLElianZigBeeDemo/HDLElianZigBee/src/main/jni/lib/x86/libelian.a | 0
HDLElianZigBeeDemo/app/src/main/res/layout/activity_main.xml | 20
HDLElianZigBeeDemo/HDLElianZigBee/src/main/jniLibs/armeabi-v7a/libelianjni.so | 0
HDLElianZigBeeDemo/HDLElianZigBee/src/main/java/com/mediatek/elian/ElianNative.java | 52 +
HDLElianZigBeeDemo/HDLElianZigBee/lint.xml | 3
HDLElianZigBeeDemo/HDLElianZigBee/src/main/jni/lib/x86_64/libelian.a | 0
HDLElianZigBeeDemo/.idea/vcs.xml | 6
HDLElianZigBeeDemo/app/src/main/res/mipmap-hdpi/ic_launcher.png | 0
HDLElianZigBeeDemo/HDLElianZigBee/src/main/AndroidManifest.xml | 25
HDLElianZigBeeDemo/HDLElianZigBee/src/main/jni/elianjni.cpp | 109 +++
HDLElianZigBeeDemo/HDLElianZigBee/build.gradle | 25
HDLElianZigBeeDemo/HDLElianZigBee/src/main/jniLibs/x86/libelianjni.so | 0
HDLElianZigBeeDemo/gradlew | 172 +++++
HDLElianZigBeeDemo/.gitignore | 13
HDLElianZigBeeDemo/HDLElianZigBee/src/main/res/layout/activity_elian.xml | 110 +++
HDLElianZigBeeDemo/app/src/main/res/mipmap-mdpi/ic_launcher_round.png | 0
HDLElianZigBeeDemo/app/src/main/res/drawable/ic_launcher_background.xml | 170 +++++
HDLElianZigBeeDemo/app/src/main/res/mipmap-xxhdpi/ic_launcher.png | 0
HDLElianZigBeeDemo/HDLElianZigBee/src/main/jniLibs/mips64/libelianjni.so | 0
HDLElianZigBeeDemo/HDLElianZigBee/src/main/res/values/styles.xml | 20
HDLElianZigBeeDemo/HDLElianZigBee/src/main/jni/Android.mk | 34 +
HDLElianZigBeeDemo/app/.gitignore | 1
HDLElianZigBeeDemo/.idea/gradle.xml | 15
HDLElianZigBeeDemo/app/src/main/res/values/colors.xml | 6
HDLElianZigBeeDemo/HDLElianZigBee/src/main/java/com/mediatek/elian/ElianActivity.java | 183 ++++++
HDLElianZigBeeDemo/HDLElianZigBee/src/main/jni/lib/mips/libelian.a | 0
HDLElianZigBeeDemo/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png | 0
HDLElianZigBeeDemo/.idea/misc.xml | 4
HDLElianZigBeeDemo/settings.gradle | 1
HDLElianZigBeeDemo/gradlew.bat | 84 ++
HDLElianZigBeeDemo/gradle.properties | 20
HDLElianZigBeeDemo/app/src/main/res/values/styles.xml | 11
HDLElianZigBeeDemo/HDLElianZigBee/src/main/res/values/strings.xml | 5
HDLElianZigBeeDemo/HDLElianZigBee/src/main/jni/lib/arm64-v8a/libelian.a | 0
HDLElianZigBeeDemo/app/src/main/java/com/hdl/hdlelianzigbee/MainActivity.java | 31 +
HDLElianZigBeeDemo/HDLElianZigBee/src/main/jni/elianjni.h | 53 +
HDLElianZigBeeDemo/HDLElianZigBee/src/main/jniLibs/armeabi/libelianjni.so | 0
HDLElianZigBeeDemo/app/src/test/java/com/hdl/hdlelianzigbee/ExampleUnitTest.java | 17
66 files changed, 1,686 insertions(+), 0 deletions(-)
diff --git a/HDLElianZigBeeDemo/.gitignore b/HDLElianZigBeeDemo/.gitignore
new file mode 100644
index 0000000..2b75303
--- /dev/null
+++ b/HDLElianZigBeeDemo/.gitignore
@@ -0,0 +1,13 @@
+*.iml
+.gradle
+/local.properties
+/.idea/caches
+/.idea/libraries
+/.idea/modules.xml
+/.idea/workspace.xml
+/.idea/navEditor.xml
+/.idea/assetWizardSettings.xml
+.DS_Store
+/build
+/captures
+.externalNativeBuild
diff --git a/HDLElianZigBeeDemo/.idea/encodings.xml b/HDLElianZigBeeDemo/.idea/encodings.xml
new file mode 100644
index 0000000..15a15b2
--- /dev/null
+++ b/HDLElianZigBeeDemo/.idea/encodings.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="Encoding" addBOMForNewFiles="with NO BOM" />
+</project>
\ No newline at end of file
diff --git a/HDLElianZigBeeDemo/.idea/gradle.xml b/HDLElianZigBeeDemo/.idea/gradle.xml
new file mode 100644
index 0000000..2996d53
--- /dev/null
+++ b/HDLElianZigBeeDemo/.idea/gradle.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="GradleSettings">
+ <option name="linkedExternalProjectsSettings">
+ <GradleProjectSettings>
+ <compositeConfiguration>
+ <compositeBuild compositeDefinitionSource="SCRIPT" />
+ </compositeConfiguration>
+ <option name="distributionType" value="DEFAULT_WRAPPED" />
+ <option name="externalProjectPath" value="$PROJECT_DIR$" />
+ <option name="resolveModulePerSourceSet" value="false" />
+ </GradleProjectSettings>
+ </option>
+ </component>
+</project>
\ No newline at end of file
diff --git a/HDLElianZigBeeDemo/.idea/misc.xml b/HDLElianZigBeeDemo/.idea/misc.xml
new file mode 100644
index 0000000..0d45e8d
--- /dev/null
+++ b/HDLElianZigBeeDemo/.idea/misc.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" project-jdk-name="1.8" project-jdk-type="JavaSDK" />
+</project>
\ No newline at end of file
diff --git a/HDLElianZigBeeDemo/.idea/runConfigurations.xml b/HDLElianZigBeeDemo/.idea/runConfigurations.xml
new file mode 100644
index 0000000..7f68460
--- /dev/null
+++ b/HDLElianZigBeeDemo/.idea/runConfigurations.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="RunConfigurationProducerService">
+ <option name="ignoredProducers">
+ <set>
+ <option value="org.jetbrains.plugins.gradle.execution.test.runner.AllInPackageGradleConfigurationProducer" />
+ <option value="org.jetbrains.plugins.gradle.execution.test.runner.TestClassGradleConfigurationProducer" />
+ <option value="org.jetbrains.plugins.gradle.execution.test.runner.TestMethodGradleConfigurationProducer" />
+ </set>
+ </option>
+ </component>
+</project>
\ No newline at end of file
diff --git a/HDLElianZigBeeDemo/.idea/vcs.xml b/HDLElianZigBeeDemo/.idea/vcs.xml
new file mode 100644
index 0000000..6c0b863
--- /dev/null
+++ b/HDLElianZigBeeDemo/.idea/vcs.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="VcsDirectoryMappings">
+ <mapping directory="$PROJECT_DIR$/.." vcs="Git" />
+ </component>
+</project>
\ No newline at end of file
diff --git a/HDLElianZigBeeDemo/HDLElianZigBee/build.gradle b/HDLElianZigBeeDemo/HDLElianZigBee/build.gradle
new file mode 100644
index 0000000..054bec2
--- /dev/null
+++ b/HDLElianZigBeeDemo/HDLElianZigBee/build.gradle
@@ -0,0 +1,25 @@
+//apply plugin: 'com.android.application'
+apply plugin: 'com.android.library'
+android {
+
+
+ compileSdkVersion 28
+
+ defaultConfig {
+ minSdkVersion 14
+ targetSdkVersion 28
+ versionCode 1
+ versionName "1.0.2"
+
+ ndk {
+ moduleName "libelian"
+ }
+ }
+
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
+ }
+ }
+}
diff --git a/HDLElianZigBeeDemo/HDLElianZigBee/lint.xml b/HDLElianZigBeeDemo/HDLElianZigBee/lint.xml
new file mode 100644
index 0000000..8423c0e
--- /dev/null
+++ b/HDLElianZigBeeDemo/HDLElianZigBee/lint.xml
@@ -0,0 +1,3 @@
+<?xml version="1.0" encoding="utf-8"?>
+<lint>
+</lint>
\ No newline at end of file
diff --git a/HDLElianZigBeeDemo/HDLElianZigBee/src/main/AndroidManifest.xml b/HDLElianZigBeeDemo/HDLElianZigBee/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..aa4e065
--- /dev/null
+++ b/HDLElianZigBeeDemo/HDLElianZigBee/src/main/AndroidManifest.xml
@@ -0,0 +1,25 @@
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.hdl.mediatek"
+ android:versionCode="17"
+ android:versionName="1.0.17" >
+
+ <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
+ <uses-permission android:name="android.permission.NET_ADMIN" />
+ <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
+ <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
+ <uses-permission android:name="android.permission.CHANGE_NETWORK_STATE"/>
+ <uses-permission android:name="android.permission.INTERNET" />
+
+
+ <application
+ android:allowBackup="true"
+ >
+ <activity android:name="com.mediatek.elian.ElianActivity" android:launchMode="singleTask">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+ </application>
+
+</manifest>
diff --git a/HDLElianZigBeeDemo/HDLElianZigBee/src/main/java/com/mediatek/elian/ElianActivity.java b/HDLElianZigBeeDemo/HDLElianZigBee/src/main/java/com/mediatek/elian/ElianActivity.java
new file mode 100644
index 0000000..e22c050
--- /dev/null
+++ b/HDLElianZigBeeDemo/HDLElianZigBee/src/main/java/com/mediatek/elian/ElianActivity.java
@@ -0,0 +1,183 @@
+package com.mediatek.elian;
+
+import android.app.Activity;
+import android.app.AlertDialog;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.content.pm.PackageInfo;
+import android.content.pm.PackageManager;
+import android.net.wifi.WifiInfo;
+import android.net.wifi.WifiManager;
+import android.os.Bundle;
+import android.view.View;
+import android.widget.Button;
+import android.widget.TextView;
+
+import com.hdl.mediatek.R;
+
+public class ElianActivity extends Activity {
+ private Button mButtonStartV1;
+ private Button mButtonStartV4;
+ private Button mButtonStartV1V4;
+ private Button mButtonStop;
+ private ElianNative elian;
+
+ private byte AuthModeOpen = 0x00;
+ private byte AuthModeShared = 0x01;
+ private byte AuthModeAutoSwitch = 0x02;
+ private byte AuthModeWPA = 0x03;
+ private byte AuthModeWPAPSK = 0x04;
+ private byte AuthModeWPANone = 0x05;
+ private byte AuthModeWPA2 = 0x06;
+ private byte AuthModeWPA2PSK = 0x07;
+ private byte AuthModeWPA1WPA2 = 0x08;
+ private byte AuthModeWPA1PSKWPA2PSK = 0x09;
+
+ public String getVersion() {
+ try {
+ PackageManager manager = this.getPackageManager();
+ PackageInfo info = manager.getPackageInfo(this.getPackageName(), 0);
+ String version = info.versionName;
+ return version;
+ } catch (Exception e) {
+ e.printStackTrace();
+ return "null";
+ }
+ }
+ private void showDialog(Context context, String title, String msg)
+ {
+ AlertDialog.Builder builder = new AlertDialog.Builder(context);
+// builder.setIcon(R.drawable.ic_launcher);
+ builder.setTitle(title);
+ builder.setMessage(msg);
+ builder.setPositiveButton("exit",
+ new DialogInterface.OnClickListener()
+ {
+ public void onClick(DialogInterface dialog, int whichButton)
+ {
+ finish();
+ }
+ });
+
+ builder.show();
+ }
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState)
+ {
+ // TODO Auto-generated method stub
+ WifiManager mWifiManager;
+ String mConnectedSsid;
+
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_elian);
+
+ boolean result = ElianNative.LoadLib();
+ if (!result)
+ {
+ showDialog(this, "Error", "can't load elianjni lib");
+ }
+
+ elian = new ElianNative();
+
+ TextView mSSID = (TextView)findViewById(R.id.SSID);
+
+ mWifiManager = (WifiManager) getSystemService (Context.WIFI_SERVICE);
+ if(mWifiManager.isWifiEnabled())
+ {
+ WifiInfo WifiInfo = mWifiManager.getConnectionInfo();
+ mConnectedSsid = WifiInfo.getSSID();
+
+ int iLen = mConnectedSsid.length();
+
+ if (iLen == 0)
+ {
+ return;
+ }
+
+ if (mConnectedSsid.startsWith("\"") && mConnectedSsid.endsWith("\""))
+ {
+ mConnectedSsid = mConnectedSsid.substring(1, iLen - 1);
+ }
+ // mConnectedSsid = mConnectedSsid.replace('\"', ' ');
+ // mConnectedSsid = mConnectedSsid.trim();
+ mSSID.setText(mConnectedSsid);
+ }
+
+ mButtonStartV1 = (Button)findViewById(R.id.startV1);
+ mButtonStartV4 = (Button)findViewById(R.id.startV4);
+ mButtonStartV1V4 = (Button)findViewById(R.id.startV1V4);
+ mButtonStop = (Button)findViewById(R.id.stop);
+ mButtonStop.setEnabled(false);
+
+ mButtonStartV1.setOnClickListener(startListener);
+ mButtonStartV4.setOnClickListener(startListener);
+ mButtonStartV1V4.setOnClickListener(startListener);
+ mButtonStop.setOnClickListener(stopListener);
+
+ int libVersion = elian.GetLibVersion();
+ int protoVersion = elian.GetProtoVersion();
+
+ ((TextView)findViewById(R.id.Notice)).setText("Version:" + getVersion() +
+ ", libVersion:" + libVersion + ", protocolVersion:" + protoVersion);
+ }
+
+ Button.OnClickListener startListener = new Button.OnClickListener() {
+ public void onClick(View arg0) {
+ String ssid = ((TextView) findViewById(R.id.SSID)).getText()
+ .toString();
+ String password = ((TextView) findViewById(R.id.Password))
+ .getText().toString();
+ String custom = ((TextView) findViewById(R.id.Custom))
+ .getText().toString();
+ byte authmode = 0;
+
+ if (arg0.getId() == R.id.startV1)
+ {
+ elian.InitSmartConnection(null, 1, 0);
+ elian.StartSmartConnection(ssid, password, custom);
+ }
+ else if (arg0.getId() == R.id.startV4)
+ {
+ elian.InitSmartConnection(null, 0, 1);
+ elian.StartSmartConnection(ssid, password, custom);
+ }
+ else if (arg0.getId() == R.id.startV1V4)
+ {
+ elian.InitSmartConnection(null, 1, 1);
+ elian.StartSmartConnection(ssid, password, custom);
+ }
+ mButtonStartV1.setEnabled(false);
+ mButtonStartV4.setEnabled(false);
+ mButtonStartV1V4.setEnabled(false);
+ mButtonStop.setEnabled(true);
+ }
+ };
+
+ Button.OnClickListener stopListener = new Button.OnClickListener() {
+ public void onClick(View arg0) {
+ elian.StopSmartConnection();
+ mButtonStartV1.setEnabled(true);
+ mButtonStartV4.setEnabled(true);
+ mButtonStartV1V4.setEnabled(true);
+ mButtonStop.setEnabled(false);
+ }
+ };
+
+ @Override
+ protected void onPause() {
+
+ super.onPause();
+ }
+
+ @Override
+ protected void onDestroy() {
+ elian.StopSmartConnection();
+ mButtonStartV1.setEnabled(true);
+ mButtonStartV4.setEnabled(true);
+ mButtonStartV1V4.setEnabled(true);
+ mButtonStop.setEnabled(false);
+
+ super.onDestroy();
+ }
+}
diff --git a/HDLElianZigBeeDemo/HDLElianZigBee/src/main/java/com/mediatek/elian/ElianNative.java b/HDLElianZigBeeDemo/HDLElianZigBee/src/main/java/com/mediatek/elian/ElianNative.java
new file mode 100644
index 0000000..d107643
--- /dev/null
+++ b/HDLElianZigBeeDemo/HDLElianZigBee/src/main/java/com/mediatek/elian/ElianNative.java
@@ -0,0 +1,52 @@
+package com.mediatek.elian;
+
+/**
+ * Created by yangyuan on 12/17/14.
+ */
+public class ElianNative {
+ static {
+// System.loadLibrary("elianjni");
+ }
+
+ public ElianNative()
+ {
+
+ }
+
+ public static boolean LoadLib()
+ {
+ try {
+ System.loadLibrary("elianjni");
+ return true;
+ } catch (UnsatisfiedLinkError ule) {
+ System.err.println("WARNING: Could not load elianjni library!");
+ return false;
+ }
+ }
+
+ public native int GetProtoVersion();
+
+ public native int GetLibVersion();
+
+ /*
+ * Init SmartConnection
+ */
+ public native int InitSmartConnection(String Target, int sendV1, int sendV4);
+
+ /**
+ * Start SmartConnection with Home AP
+ *
+ * @SSID : SSID of Home AP
+ * @Password : Password of Home AP
+ * @Auth : Auth of Home AP
+ */
+ public native int StartSmartConnection(String SSID, String Password, String Custom);
+
+ /**
+ * Stop SmartConnection by user
+ *
+ */
+
+ public native int StopSmartConnection();
+
+}
diff --git a/HDLElianZigBeeDemo/HDLElianZigBee/src/main/jni/Android.mk b/HDLElianZigBeeDemo/HDLElianZigBee/src/main/jni/Android.mk
new file mode 100644
index 0000000..ad68ca8
--- /dev/null
+++ b/HDLElianZigBeeDemo/HDLElianZigBee/src/main/jni/Android.mk
@@ -0,0 +1,34 @@
+# Copyright (C) 2009 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+
+LOCAL_MODULE := libelian
+LOCAL_SRC_FILES := lib/$(TARGET_ARCH_ABI)/libelian.a
+include $(PREBUILT_STATIC_LIBRARY)
+
+include $(CLEAR_VARS)
+
+ELIAN_DIR := ../../elian/
+LOCAL_C_INCLUDES := $(ELIAN_DIR)
+LOCAL_MODULE := elianjni
+LOCAL_SRC_FILES := elianjni.cpp
+LOCAL_LDLIBS += -L$(SYSROOT)/usr/lib -llog
+LOCAL_STATIC_LIBRARIES := libelian
+
+include $(BUILD_SHARED_LIBRARY)
+
diff --git a/HDLElianZigBeeDemo/HDLElianZigBee/src/main/jni/Application.mk b/HDLElianZigBeeDemo/HDLElianZigBee/src/main/jni/Application.mk
new file mode 100644
index 0000000..1d98dd2
--- /dev/null
+++ b/HDLElianZigBeeDemo/HDLElianZigBee/src/main/jni/Application.mk
@@ -0,0 +1,3 @@
+APP_ABI := all
+APP_STL := stlport_static
+
diff --git a/HDLElianZigBeeDemo/HDLElianZigBee/src/main/jni/elianjni.cpp b/HDLElianZigBeeDemo/HDLElianZigBee/src/main/jni/elianjni.cpp
new file mode 100644
index 0000000..59c58f3
--- /dev/null
+++ b/HDLElianZigBeeDemo/HDLElianZigBee/src/main/jni/elianjni.cpp
@@ -0,0 +1,109 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <elian.h>
+#include "elianjni.h"
+
+//#define ENCKEY "McdwCnwCdss2_18p"
+
+static void *context = NULL;
+
+JNIEXPORT jint JNICALL Java_com_mediatek_elian_ElianNative_GetProtoVersion
+ (JNIEnv *, jobject)
+{
+ int protoVersion = 0;
+ int libVersion = 0;
+
+ elianGetVersion(&protoVersion, &libVersion);
+ return protoVersion;
+}
+
+JNIEXPORT jint JNICALL Java_com_mediatek_elian_ElianNative_GetLibVersion
+ (JNIEnv *, jobject)
+{
+ int protoVersion = 0;
+ int libVersion = 0;
+
+ elianGetVersion(&protoVersion, &libVersion);
+ return libVersion;
+}
+
+JNIEXPORT jint JNICALL Java_com_mediatek_elian_ElianNative_InitSmartConnection
+ (JNIEnv *, jobject, jstring, jint sendV1, jint sendV4)
+{
+ unsigned char target[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
+ unsigned int flag = 0;
+
+ if (context)
+ {
+ elianStop(context);
+ elianDestroy(context);
+ context = NULL;
+ }
+
+ if (sendV1)
+ {
+ flag |= ELIAN_SEND_V1;
+ }
+ if (sendV4)
+ {
+ flag |= ELIAN_SEND_V4;
+ }
+ context = elianNew(NULL, 0, target, flag);
+ if (context == NULL)
+ {
+ return -1;
+ }
+ elianSetInterval(context, 20*1000);
+ return 0;
+}
+
+/*
+ * Class: com_mediatek_elian_ElianNative
+ * Method: StartSmartConnection
+ * Signature: (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;B)I
+ */
+JNIEXPORT jint JNICALL Java_com_mediatek_elian_ElianNative_StartSmartConnection
+ (JNIEnv *env, jobject, jstring SSID, jstring PASSWORD, jstring CUSTOM)
+{
+ const char *ssid = NULL;
+ const char *password = NULL;
+ const char *custom = NULL;
+
+ if (context == NULL)
+ {
+ return -1;
+ }
+ ssid = env->GetStringUTFChars(SSID, 0);
+ password = env->GetStringUTFChars(PASSWORD, 0);
+ custom = env->GetStringUTFChars(CUSTOM, 0);
+
+// elianPut(context, TYPE_ID_AM, (char *)&authmode, 1);
+ elianPut(context, TYPE_ID_SSID, (char *)ssid, strlen(ssid));
+ elianPut(context, TYPE_ID_PWD, (char *)password, strlen(password));
+ elianPut(context, TYPE_ID_CUST, (char *)custom, strlen(custom));
+
+ env->ReleaseStringUTFChars(SSID, ssid);
+ env->ReleaseStringUTFChars(PASSWORD, password);
+ env->ReleaseStringUTFChars(CUSTOM, custom);
+
+ elianStart(context);
+
+ return 0;
+}
+
+/*
+ * Class: com_mediatek_elian_ElianNative
+ * Method: StopSmartConnection
+ * Signature: ()I
+ */
+JNIEXPORT jint JNICALL Java_com_mediatek_elian_ElianNative_StopSmartConnection
+ (JNIEnv *, jobject)
+{
+ if (context)
+ {
+ elianStop(context);
+ elianDestroy(context);
+ context = NULL;
+ }
+ return 0;
+}
diff --git a/HDLElianZigBeeDemo/HDLElianZigBee/src/main/jni/elianjni.h b/HDLElianZigBeeDemo/HDLElianZigBee/src/main/jni/elianjni.h
new file mode 100644
index 0000000..efa6c30
--- /dev/null
+++ b/HDLElianZigBeeDemo/HDLElianZigBee/src/main/jni/elianjni.h
@@ -0,0 +1,53 @@
+/* DO NOT EDIT THIS FILE - it is machine generated */
+#include <jni.h>
+/* Header for class com_mediatek_elian_ElianNative */
+
+#ifndef _Included_com_mediatek_elian_ElianNative
+#define _Included_com_mediatek_elian_ElianNative
+#ifdef __cplusplus
+extern "C" {
+#endif
+/*
+ * Class: com_mediatek_elian_ElianNative
+ * Method: GetProtoVersion
+ * Signature: ()I
+ */
+JNIEXPORT jint JNICALL Java_com_mediatek_elian_ElianNative_GetProtoVersion
+ (JNIEnv *, jobject);
+
+/*
+ * Class: com_mediatek_elian_ElianNative
+ * Method: GetLibVersion
+ * Signature: ()I
+ */
+JNIEXPORT jint JNICALL Java_com_mediatek_elian_ElianNative_GetLibVersion
+ (JNIEnv *, jobject);
+
+/*
+ * Class: com_mediatek_elian_ElianNative
+ * Method: InitSmartConnection
+ * Signature: (Ljava/lang/String;II)I
+ */
+JNIEXPORT jint JNICALL Java_com_mediatek_elian_ElianNative_InitSmartConnection
+ (JNIEnv *, jobject, jstring, jint, jint);
+
+/*
+ * Class: com_mediatek_elian_ElianNative
+ * Method: StartSmartConnection
+ * Signature: (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;B)I
+ */
+JNIEXPORT jint JNICALL Java_com_mediatek_elian_ElianNative_StartSmartConnection
+ (JNIEnv *, jobject, jstring, jstring, jstring);
+
+/*
+ * Class: com_mediatek_elian_ElianNative
+ * Method: StopSmartConnection
+ * Signature: ()I
+ */
+JNIEXPORT jint JNICALL Java_com_mediatek_elian_ElianNative_StopSmartConnection
+ (JNIEnv *, jobject);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/HDLElianZigBeeDemo/HDLElianZigBee/src/main/jni/lib/arm64-v8a/libelian.a b/HDLElianZigBeeDemo/HDLElianZigBee/src/main/jni/lib/arm64-v8a/libelian.a
new file mode 100644
index 0000000..fa32b0b
--- /dev/null
+++ b/HDLElianZigBeeDemo/HDLElianZigBee/src/main/jni/lib/arm64-v8a/libelian.a
Binary files differ
diff --git a/HDLElianZigBeeDemo/HDLElianZigBee/src/main/jni/lib/armeabi-v7a/libelian.a b/HDLElianZigBeeDemo/HDLElianZigBee/src/main/jni/lib/armeabi-v7a/libelian.a
new file mode 100644
index 0000000..f4cf398
--- /dev/null
+++ b/HDLElianZigBeeDemo/HDLElianZigBee/src/main/jni/lib/armeabi-v7a/libelian.a
Binary files differ
diff --git a/HDLElianZigBeeDemo/HDLElianZigBee/src/main/jni/lib/armeabi/libelian.a b/HDLElianZigBeeDemo/HDLElianZigBee/src/main/jni/lib/armeabi/libelian.a
new file mode 100644
index 0000000..d5d638d
--- /dev/null
+++ b/HDLElianZigBeeDemo/HDLElianZigBee/src/main/jni/lib/armeabi/libelian.a
Binary files differ
diff --git a/HDLElianZigBeeDemo/HDLElianZigBee/src/main/jni/lib/mips/libelian.a b/HDLElianZigBeeDemo/HDLElianZigBee/src/main/jni/lib/mips/libelian.a
new file mode 100644
index 0000000..053a9d6
--- /dev/null
+++ b/HDLElianZigBeeDemo/HDLElianZigBee/src/main/jni/lib/mips/libelian.a
Binary files differ
diff --git a/HDLElianZigBeeDemo/HDLElianZigBee/src/main/jni/lib/mips64/libelian.a b/HDLElianZigBeeDemo/HDLElianZigBee/src/main/jni/lib/mips64/libelian.a
new file mode 100644
index 0000000..e1aeaef
--- /dev/null
+++ b/HDLElianZigBeeDemo/HDLElianZigBee/src/main/jni/lib/mips64/libelian.a
Binary files differ
diff --git a/HDLElianZigBeeDemo/HDLElianZigBee/src/main/jni/lib/x86/libelian.a b/HDLElianZigBeeDemo/HDLElianZigBee/src/main/jni/lib/x86/libelian.a
new file mode 100644
index 0000000..b4620c9
--- /dev/null
+++ b/HDLElianZigBeeDemo/HDLElianZigBee/src/main/jni/lib/x86/libelian.a
Binary files differ
diff --git a/HDLElianZigBeeDemo/HDLElianZigBee/src/main/jni/lib/x86_64/libelian.a b/HDLElianZigBeeDemo/HDLElianZigBee/src/main/jni/lib/x86_64/libelian.a
new file mode 100644
index 0000000..bb2c64c
--- /dev/null
+++ b/HDLElianZigBeeDemo/HDLElianZigBee/src/main/jni/lib/x86_64/libelian.a
Binary files differ
diff --git a/HDLElianZigBeeDemo/HDLElianZigBee/src/main/jniLibs/arm64-v8a/libelianjni.so b/HDLElianZigBeeDemo/HDLElianZigBee/src/main/jniLibs/arm64-v8a/libelianjni.so
new file mode 100644
index 0000000..71972a2
--- /dev/null
+++ b/HDLElianZigBeeDemo/HDLElianZigBee/src/main/jniLibs/arm64-v8a/libelianjni.so
Binary files differ
diff --git a/HDLElianZigBeeDemo/HDLElianZigBee/src/main/jniLibs/armeabi-v7a/libelianjni.so b/HDLElianZigBeeDemo/HDLElianZigBee/src/main/jniLibs/armeabi-v7a/libelianjni.so
new file mode 100644
index 0000000..0a48321
--- /dev/null
+++ b/HDLElianZigBeeDemo/HDLElianZigBee/src/main/jniLibs/armeabi-v7a/libelianjni.so
Binary files differ
diff --git a/HDLElianZigBeeDemo/HDLElianZigBee/src/main/jniLibs/armeabi/libelianjni.so b/HDLElianZigBeeDemo/HDLElianZigBee/src/main/jniLibs/armeabi/libelianjni.so
new file mode 100644
index 0000000..04e9fcc
--- /dev/null
+++ b/HDLElianZigBeeDemo/HDLElianZigBee/src/main/jniLibs/armeabi/libelianjni.so
Binary files differ
diff --git a/HDLElianZigBeeDemo/HDLElianZigBee/src/main/jniLibs/mips/libelianjni.so b/HDLElianZigBeeDemo/HDLElianZigBee/src/main/jniLibs/mips/libelianjni.so
new file mode 100644
index 0000000..ebc1275
--- /dev/null
+++ b/HDLElianZigBeeDemo/HDLElianZigBee/src/main/jniLibs/mips/libelianjni.so
Binary files differ
diff --git a/HDLElianZigBeeDemo/HDLElianZigBee/src/main/jniLibs/mips64/libelianjni.so b/HDLElianZigBeeDemo/HDLElianZigBee/src/main/jniLibs/mips64/libelianjni.so
new file mode 100644
index 0000000..bb2e311
--- /dev/null
+++ b/HDLElianZigBeeDemo/HDLElianZigBee/src/main/jniLibs/mips64/libelianjni.so
Binary files differ
diff --git a/HDLElianZigBeeDemo/HDLElianZigBee/src/main/jniLibs/x86/libelianjni.so b/HDLElianZigBeeDemo/HDLElianZigBee/src/main/jniLibs/x86/libelianjni.so
new file mode 100644
index 0000000..37e1774
--- /dev/null
+++ b/HDLElianZigBeeDemo/HDLElianZigBee/src/main/jniLibs/x86/libelianjni.so
Binary files differ
diff --git a/HDLElianZigBeeDemo/HDLElianZigBee/src/main/jniLibs/x86_64/libelianjni.so b/HDLElianZigBeeDemo/HDLElianZigBee/src/main/jniLibs/x86_64/libelianjni.so
new file mode 100644
index 0000000..0350ce2
--- /dev/null
+++ b/HDLElianZigBeeDemo/HDLElianZigBee/src/main/jniLibs/x86_64/libelianjni.so
Binary files differ
diff --git a/HDLElianZigBeeDemo/HDLElianZigBee/src/main/res/layout/activity_elian.xml b/HDLElianZigBeeDemo/HDLElianZigBee/src/main/res/layout/activity_elian.xml
new file mode 100644
index 0000000..1343784
--- /dev/null
+++ b/HDLElianZigBeeDemo/HDLElianZigBee/src/main/res/layout/activity_elian.xml
@@ -0,0 +1,110 @@
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ tools:context="com.mediatek.elian.ElianActivity" >
+
+ <LinearLayout
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:orientation="vertical"
+ android:weightSum="1" >
+
+ <TextView
+ android:id="@+id/Notice"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="" />
+
+ <TableLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content" >
+ </TableLayout>
+
+ <TableRow
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_weight="0.05">
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="SSID"
+ android:id="@+id/SSIDLabel" />
+
+ <EditText
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:id="@+id/SSID"
+ android:layout_weight="0.67" />
+ </TableRow>
+
+ <TableRow
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content">
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="Password"
+ android:id="@+id/PasswordLabel" />
+
+ <EditText
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:id="@+id/Password"
+ android:layout_gravity="center_horizontal" />
+ </TableRow>
+
+ <TableRow
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content">
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="custom"
+ android:id="@+id/CustomLabel" />
+
+ <EditText
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:id="@+id/Custom"
+ android:layout_gravity="center_horizontal" />
+ </TableRow>
+
+ <TableRow
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content">
+
+ <Button
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="Send V1"
+ android:id="@+id/startV1" />
+
+ <Button
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="Send V4"
+ android:id="@+id/startV4" />
+
+ <Button
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="Send Both"
+ android:id="@+id/startV1V4" />
+ </TableRow>
+
+ <TableRow
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content">
+
+ <Button
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="Stop"
+ android:id="@+id/stop" />
+ </TableRow>
+ </LinearLayout>
+</RelativeLayout>
diff --git a/HDLElianZigBeeDemo/HDLElianZigBee/src/main/res/values/strings.xml b/HDLElianZigBeeDemo/HDLElianZigBee/src/main/res/values/strings.xml
new file mode 100644
index 0000000..3f0d7f4
--- /dev/null
+++ b/HDLElianZigBeeDemo/HDLElianZigBee/src/main/res/values/strings.xml
@@ -0,0 +1,5 @@
+<resources>
+
+ <string name="app_name">Elian</string>
+
+</resources>
diff --git a/HDLElianZigBeeDemo/HDLElianZigBee/src/main/res/values/styles.xml b/HDLElianZigBeeDemo/HDLElianZigBee/src/main/res/values/styles.xml
new file mode 100644
index 0000000..6ce89c7
--- /dev/null
+++ b/HDLElianZigBeeDemo/HDLElianZigBee/src/main/res/values/styles.xml
@@ -0,0 +1,20 @@
+<resources>
+
+ <!--
+ Base application theme, dependent on API level. This theme is replaced
+ by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
+ -->
+ <style name="AppBaseTheme" parent="android:Theme.Light">
+ <!--
+ Theme customizations available in newer API levels can go in
+ res/values-vXX/styles.xml, while customizations related to
+ backward-compatibility can go here.
+ -->
+ </style>
+
+ <!-- Application theme. -->
+ <style name="AppTheme" parent="AppBaseTheme">
+ <!-- All customizations that are NOT specific to a particular API-level can go here. -->
+ </style>
+
+</resources>
diff --git a/HDLElianZigBeeDemo/app/.gitignore b/HDLElianZigBeeDemo/app/.gitignore
new file mode 100644
index 0000000..796b96d
--- /dev/null
+++ b/HDLElianZigBeeDemo/app/.gitignore
@@ -0,0 +1 @@
+/build
diff --git a/HDLElianZigBeeDemo/app/build.gradle b/HDLElianZigBeeDemo/app/build.gradle
new file mode 100644
index 0000000..571063a
--- /dev/null
+++ b/HDLElianZigBeeDemo/app/build.gradle
@@ -0,0 +1,30 @@
+apply plugin: 'com.android.application'
+
+android {
+ compileSdkVersion 29
+ buildToolsVersion "29.0.0"
+ defaultConfig {
+ applicationId "com.hdl.hdlelianzigbee"
+ minSdkVersion 21
+ targetSdkVersion 29
+ versionCode 1
+ versionName "1.0"
+ testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
+ }
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
+ }
+ }
+}
+
+dependencies {
+ implementation fileTree(dir: 'libs', include: ['*.jar'])
+ implementation 'androidx.appcompat:appcompat:1.1.0'
+ implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
+ testImplementation 'junit:junit:4.12'
+ androidTestImplementation 'androidx.test:runner:1.2.0'
+ androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
+ implementation project(':HDLElianZigBee')
+}
diff --git a/HDLElianZigBeeDemo/app/proguard-rules.pro b/HDLElianZigBeeDemo/app/proguard-rules.pro
new file mode 100644
index 0000000..f1b4245
--- /dev/null
+++ b/HDLElianZigBeeDemo/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/HDLElianZigBeeDemo/app/src/androidTest/java/com/hdl/hdlelianzigbee/ExampleInstrumentedTest.java b/HDLElianZigBeeDemo/app/src/androidTest/java/com/hdl/hdlelianzigbee/ExampleInstrumentedTest.java
new file mode 100644
index 0000000..c6ed461
--- /dev/null
+++ b/HDLElianZigBeeDemo/app/src/androidTest/java/com/hdl/hdlelianzigbee/ExampleInstrumentedTest.java
@@ -0,0 +1,27 @@
+package com.hdl.hdlelianzigbee;
+
+import android.content.Context;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.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 <a href="http://d.android.com/tools/testing">Testing documentation</a>
+ */
+@RunWith(AndroidJUnit4.class)
+public class ExampleInstrumentedTest {
+ @Test
+ public void useAppContext() {
+ // Context of the app under test.
+ Context appContext = InstrumentationRegistry.getTargetContext();
+
+ assertEquals("com.hdl.hdlelianzigbee", appContext.getPackageName());
+ }
+}
diff --git a/HDLElianZigBeeDemo/app/src/main/AndroidManifest.xml b/HDLElianZigBeeDemo/app/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..e5c0cc2
--- /dev/null
+++ b/HDLElianZigBeeDemo/app/src/main/AndroidManifest.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.hdl.hdlelianzigbee">
+
+ <application
+ android:allowBackup="true"
+ android:icon="@mipmap/ic_launcher"
+ android:label="@string/app_name"
+ android:roundIcon="@mipmap/ic_launcher_round"
+ android:supportsRtl="true"
+ android:theme="@style/AppTheme">
+ <activity android:name=".ElianActivity"></activity>
+ <activity android:name=".MainActivity">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+ </application>
+
+</manifest>
\ No newline at end of file
diff --git a/HDLElianZigBeeDemo/app/src/main/java/com/hdl/hdlelianzigbee/ElianActivity.java b/HDLElianZigBeeDemo/app/src/main/java/com/hdl/hdlelianzigbee/ElianActivity.java
new file mode 100644
index 0000000..77d4261
--- /dev/null
+++ b/HDLElianZigBeeDemo/app/src/main/java/com/hdl/hdlelianzigbee/ElianActivity.java
@@ -0,0 +1,187 @@
+package com.hdl.hdlelianzigbee;
+
+import java.util.List;
+
+import android.app.Activity;
+import android.app.AlertDialog;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.content.pm.PackageInfo;
+import android.content.pm.PackageManager;
+import android.net.wifi.ScanResult;
+import android.net.wifi.WifiInfo;
+import android.net.wifi.WifiManager;
+import android.os.Bundle;
+import android.util.Log;
+import android.view.View;
+import android.widget.Button;
+import android.widget.TextView;
+
+import com.mediatek.elian.ElianNative;
+
+public class ElianActivity extends Activity {
+ private Button mButtonStartV1;
+ private Button mButtonStartV4;
+ private Button mButtonStartV1V4;
+ private Button mButtonStop;
+ private ElianNative elian;
+
+ private byte AuthModeOpen = 0x00;
+ private byte AuthModeShared = 0x01;
+ private byte AuthModeAutoSwitch = 0x02;
+ private byte AuthModeWPA = 0x03;
+ private byte AuthModeWPAPSK = 0x04;
+ private byte AuthModeWPANone = 0x05;
+ private byte AuthModeWPA2 = 0x06;
+ private byte AuthModeWPA2PSK = 0x07;
+ private byte AuthModeWPA1WPA2 = 0x08;
+ private byte AuthModeWPA1PSKWPA2PSK = 0x09;
+
+ public String getVersion() {
+ try {
+ PackageManager manager = this.getPackageManager();
+ PackageInfo info = manager.getPackageInfo(this.getPackageName(), 0);
+ String version = info.versionName;
+ return version;
+ } catch (Exception e) {
+ e.printStackTrace();
+ return "null";
+ }
+ }
+ private void showDialog(Context context, String title, String msg)
+ {
+ AlertDialog.Builder builder = new AlertDialog.Builder(context);
+ builder.setIcon(R.mipmap.ic_launcher);
+ builder.setTitle(title);
+ builder.setMessage(msg);
+ builder.setPositiveButton("exit",
+ new DialogInterface.OnClickListener()
+ {
+ public void onClick(DialogInterface dialog, int whichButton)
+ {
+ finish();
+ }
+ });
+
+ builder.show();
+ }
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState)
+ {
+ // TODO Auto-generated method stub
+ WifiManager mWifiManager;
+ String mConnectedSsid;
+
+ super.onCreate(savedInstanceState);
+ setContentView(com.hdl.mediatek.R.layout.activity_elian);
+
+ boolean result = ElianNative.LoadLib();
+ if (!result)
+ {
+ showDialog(this, "Error", "can't load elianjni lib");
+ }
+
+ elian = new ElianNative();
+
+ TextView mSSID = (TextView)findViewById(com.hdl.mediatek.R.id.SSID);
+
+ mWifiManager = (WifiManager) getSystemService (Context.WIFI_SERVICE);
+ if(mWifiManager.isWifiEnabled())
+ {
+ WifiInfo WifiInfo = mWifiManager.getConnectionInfo();
+ mConnectedSsid = WifiInfo.getSSID();
+
+ int iLen = mConnectedSsid.length();
+
+ if (iLen == 0)
+ {
+ return;
+ }
+
+ if (mConnectedSsid.startsWith("\"") && mConnectedSsid.endsWith("\""))
+ {
+ mConnectedSsid = mConnectedSsid.substring(1, iLen - 1);
+ }
+ // mConnectedSsid = mConnectedSsid.replace('\"', ' ');
+ // mConnectedSsid = mConnectedSsid.trim();
+ mSSID.setText(mConnectedSsid);
+ }
+
+ mButtonStartV1 = (Button)findViewById(com.hdl.mediatek.R.id.startV1);
+ mButtonStartV4 = (Button)findViewById(com.hdl.mediatek.R.id.startV4);
+ mButtonStartV1V4 = (Button)findViewById(com.hdl.mediatek.R.id.startV1V4);
+ mButtonStop = (Button)findViewById(com.hdl.mediatek.R.id.stop);
+ mButtonStop.setEnabled(false);
+
+ mButtonStartV1.setOnClickListener(startListener);
+ mButtonStartV4.setOnClickListener(startListener);
+ mButtonStartV1V4.setOnClickListener(startListener);
+ mButtonStop.setOnClickListener(stopListener);
+
+ int libVersion = elian.GetLibVersion();
+ int protoVersion = elian.GetProtoVersion();
+
+ ((TextView)findViewById(com.hdl.mediatek.R.id.Notice)).setText("Version:" + getVersion() +
+ ", libVersion:" + libVersion + ", protocolVersion:" + protoVersion);
+ }
+
+ Button.OnClickListener startListener = new Button.OnClickListener() {
+ public void onClick(View arg0) {
+ String ssid = ((TextView) findViewById(com.hdl.mediatek.R.id.SSID)).getText()
+ .toString();
+ String password = ((TextView) findViewById(com.hdl.mediatek.R.id.Password))
+ .getText().toString();
+ String custom = ((TextView) findViewById(com.hdl.mediatek.R.id.Custom))
+ .getText().toString();
+ byte authmode = 0;
+
+ if (arg0.getId() == com.hdl.mediatek.R.id.startV1)
+ {
+ elian.InitSmartConnection(null, 1, 0);
+ elian.StartSmartConnection(ssid, password, custom);
+ }
+ else if (arg0.getId() == com.hdl.mediatek.R.id.startV4)
+ {
+ elian.InitSmartConnection(null, 0, 1);
+ elian.StartSmartConnection(ssid, password, custom);
+ }
+ else if (arg0.getId() == com.hdl.mediatek.R.id.startV1V4)
+ {
+ elian.InitSmartConnection(null, 1, 1);
+ elian.StartSmartConnection(ssid, password, custom);
+ }
+ mButtonStartV1.setEnabled(false);
+ mButtonStartV4.setEnabled(false);
+ mButtonStartV1V4.setEnabled(false);
+ mButtonStop.setEnabled(true);
+ }
+ };
+
+ Button.OnClickListener stopListener = new Button.OnClickListener() {
+ public void onClick(View arg0) {
+ elian.StopSmartConnection();
+ mButtonStartV1.setEnabled(true);
+ mButtonStartV4.setEnabled(true);
+ mButtonStartV1V4.setEnabled(true);
+ mButtonStop.setEnabled(false);
+ }
+ };
+
+ @Override
+ protected void onPause() {
+
+ super.onPause();
+ }
+
+ @Override
+ protected void onDestroy() {
+ elian.StopSmartConnection();
+ mButtonStartV1.setEnabled(true);
+ mButtonStartV4.setEnabled(true);
+ mButtonStartV1V4.setEnabled(true);
+ mButtonStop.setEnabled(false);
+
+ super.onDestroy();
+ }
+}
diff --git a/HDLElianZigBeeDemo/app/src/main/java/com/hdl/hdlelianzigbee/MainActivity.java b/HDLElianZigBeeDemo/app/src/main/java/com/hdl/hdlelianzigbee/MainActivity.java
new file mode 100644
index 0000000..b88f034
--- /dev/null
+++ b/HDLElianZigBeeDemo/app/src/main/java/com/hdl/hdlelianzigbee/MainActivity.java
@@ -0,0 +1,31 @@
+package com.hdl.hdlelianzigbee;
+
+import androidx.appcompat.app.AppCompatActivity;
+
+import android.content.Intent;
+import android.os.Bundle;
+import android.view.View;
+
+public class MainActivity extends AppCompatActivity {
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_main);
+
+ findViewById(R.id.btn_go).setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ startActivity(ElianActivity.class);
+
+ }
+ });
+ }
+
+ public void startActivity(Class<?> clazz) {
+ Intent intent = new Intent(this, clazz);
+ startActivity(intent);
+// overridePendingTransition(R.anim.slide_bottom_in, R.anim.slide_bottom_out);
+
+ }
+}
diff --git a/HDLElianZigBeeDemo/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/HDLElianZigBeeDemo/app/src/main/res/drawable-v24/ic_launcher_foreground.xml
new file mode 100644
index 0000000..1f6bb29
--- /dev/null
+++ b/HDLElianZigBeeDemo/app/src/main/res/drawable-v24/ic_launcher_foreground.xml
@@ -0,0 +1,34 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:aapt="http://schemas.android.com/aapt"
+ android:width="108dp"
+ android:height="108dp"
+ android:viewportWidth="108"
+ android:viewportHeight="108">
+ <path
+ android:fillType="evenOdd"
+ android:pathData="M32,64C32,64 38.39,52.99 44.13,50.95C51.37,48.37 70.14,49.57 70.14,49.57L108.26,87.69L108,109.01L75.97,107.97L32,64Z"
+ android:strokeWidth="1"
+ android:strokeColor="#00000000">
+ <aapt:attr name="android:fillColor">
+ <gradient
+ android:endX="78.5885"
+ android:endY="90.9159"
+ android:startX="48.7653"
+ android:startY="61.0927"
+ android:type="linear">
+ <item
+ android:color="#44000000"
+ android:offset="0.0" />
+ <item
+ android:color="#00000000"
+ android:offset="1.0" />
+ </gradient>
+ </aapt:attr>
+ </path>
+ <path
+ android:fillColor="#FFFFFF"
+ android:fillType="nonZero"
+ android:pathData="M66.94,46.02L66.94,46.02C72.44,50.07 76,56.61 76,64L32,64C32,56.61 35.56,50.11 40.98,46.06L36.18,41.19C35.45,40.45 35.45,39.3 36.18,38.56C36.91,37.81 38.05,37.81 38.78,38.56L44.25,44.05C47.18,42.57 50.48,41.71 54,41.71C57.48,41.71 60.78,42.57 63.68,44.05L69.11,38.56C69.84,37.81 70.98,37.81 71.71,38.56C72.44,39.3 72.44,40.45 71.71,41.19L66.94,46.02ZM62.94,56.92C64.08,56.92 65,56.01 65,54.88C65,53.76 64.08,52.85 62.94,52.85C61.8,52.85 60.88,53.76 60.88,54.88C60.88,56.01 61.8,56.92 62.94,56.92ZM45.06,56.92C46.2,56.92 47.13,56.01 47.13,54.88C47.13,53.76 46.2,52.85 45.06,52.85C43.92,52.85 43,53.76 43,54.88C43,56.01 43.92,56.92 45.06,56.92Z"
+ android:strokeWidth="1"
+ android:strokeColor="#00000000" />
+</vector>
diff --git a/HDLElianZigBeeDemo/app/src/main/res/drawable/ic_launcher_background.xml b/HDLElianZigBeeDemo/app/src/main/res/drawable/ic_launcher_background.xml
new file mode 100644
index 0000000..0d025f9
--- /dev/null
+++ b/HDLElianZigBeeDemo/app/src/main/res/drawable/ic_launcher_background.xml
@@ -0,0 +1,170 @@
+<?xml version="1.0" encoding="utf-8"?>
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="108dp"
+ android:height="108dp"
+ android:viewportWidth="108"
+ android:viewportHeight="108">
+ <path
+ android:fillColor="#008577"
+ android:pathData="M0,0h108v108h-108z" />
+ <path
+ android:fillColor="#00000000"
+ android:pathData="M9,0L9,108"
+ android:strokeWidth="0.8"
+ android:strokeColor="#33FFFFFF" />
+ <path
+ android:fillColor="#00000000"
+ android:pathData="M19,0L19,108"
+ android:strokeWidth="0.8"
+ android:strokeColor="#33FFFFFF" />
+ <path
+ android:fillColor="#00000000"
+ android:pathData="M29,0L29,108"
+ android:strokeWidth="0.8"
+ android:strokeColor="#33FFFFFF" />
+ <path
+ android:fillColor="#00000000"
+ android:pathData="M39,0L39,108"
+ android:strokeWidth="0.8"
+ android:strokeColor="#33FFFFFF" />
+ <path
+ android:fillColor="#00000000"
+ android:pathData="M49,0L49,108"
+ android:strokeWidth="0.8"
+ android:strokeColor="#33FFFFFF" />
+ <path
+ android:fillColor="#00000000"
+ android:pathData="M59,0L59,108"
+ android:strokeWidth="0.8"
+ android:strokeColor="#33FFFFFF" />
+ <path
+ android:fillColor="#00000000"
+ android:pathData="M69,0L69,108"
+ android:strokeWidth="0.8"
+ android:strokeColor="#33FFFFFF" />
+ <path
+ android:fillColor="#00000000"
+ android:pathData="M79,0L79,108"
+ android:strokeWidth="0.8"
+ android:strokeColor="#33FFFFFF" />
+ <path
+ android:fillColor="#00000000"
+ android:pathData="M89,0L89,108"
+ android:strokeWidth="0.8"
+ android:strokeColor="#33FFFFFF" />
+ <path
+ android:fillColor="#00000000"
+ android:pathData="M99,0L99,108"
+ android:strokeWidth="0.8"
+ android:strokeColor="#33FFFFFF" />
+ <path
+ android:fillColor="#00000000"
+ android:pathData="M0,9L108,9"
+ android:strokeWidth="0.8"
+ android:strokeColor="#33FFFFFF" />
+ <path
+ android:fillColor="#00000000"
+ android:pathData="M0,19L108,19"
+ android:strokeWidth="0.8"
+ android:strokeColor="#33FFFFFF" />
+ <path
+ android:fillColor="#00000000"
+ android:pathData="M0,29L108,29"
+ android:strokeWidth="0.8"
+ android:strokeColor="#33FFFFFF" />
+ <path
+ android:fillColor="#00000000"
+ android:pathData="M0,39L108,39"
+ android:strokeWidth="0.8"
+ android:strokeColor="#33FFFFFF" />
+ <path
+ android:fillColor="#00000000"
+ android:pathData="M0,49L108,49"
+ android:strokeWidth="0.8"
+ android:strokeColor="#33FFFFFF" />
+ <path
+ android:fillColor="#00000000"
+ android:pathData="M0,59L108,59"
+ android:strokeWidth="0.8"
+ android:strokeColor="#33FFFFFF" />
+ <path
+ android:fillColor="#00000000"
+ android:pathData="M0,69L108,69"
+ android:strokeWidth="0.8"
+ android:strokeColor="#33FFFFFF" />
+ <path
+ android:fillColor="#00000000"
+ android:pathData="M0,79L108,79"
+ android:strokeWidth="0.8"
+ android:strokeColor="#33FFFFFF" />
+ <path
+ android:fillColor="#00000000"
+ android:pathData="M0,89L108,89"
+ android:strokeWidth="0.8"
+ android:strokeColor="#33FFFFFF" />
+ <path
+ android:fillColor="#00000000"
+ android:pathData="M0,99L108,99"
+ android:strokeWidth="0.8"
+ android:strokeColor="#33FFFFFF" />
+ <path
+ android:fillColor="#00000000"
+ android:pathData="M19,29L89,29"
+ android:strokeWidth="0.8"
+ android:strokeColor="#33FFFFFF" />
+ <path
+ android:fillColor="#00000000"
+ android:pathData="M19,39L89,39"
+ android:strokeWidth="0.8"
+ android:strokeColor="#33FFFFFF" />
+ <path
+ android:fillColor="#00000000"
+ android:pathData="M19,49L89,49"
+ android:strokeWidth="0.8"
+ android:strokeColor="#33FFFFFF" />
+ <path
+ android:fillColor="#00000000"
+ android:pathData="M19,59L89,59"
+ android:strokeWidth="0.8"
+ android:strokeColor="#33FFFFFF" />
+ <path
+ android:fillColor="#00000000"
+ android:pathData="M19,69L89,69"
+ android:strokeWidth="0.8"
+ android:strokeColor="#33FFFFFF" />
+ <path
+ android:fillColor="#00000000"
+ android:pathData="M19,79L89,79"
+ android:strokeWidth="0.8"
+ android:strokeColor="#33FFFFFF" />
+ <path
+ android:fillColor="#00000000"
+ android:pathData="M29,19L29,89"
+ android:strokeWidth="0.8"
+ android:strokeColor="#33FFFFFF" />
+ <path
+ android:fillColor="#00000000"
+ android:pathData="M39,19L39,89"
+ android:strokeWidth="0.8"
+ android:strokeColor="#33FFFFFF" />
+ <path
+ android:fillColor="#00000000"
+ android:pathData="M49,19L49,89"
+ android:strokeWidth="0.8"
+ android:strokeColor="#33FFFFFF" />
+ <path
+ android:fillColor="#00000000"
+ android:pathData="M59,19L59,89"
+ android:strokeWidth="0.8"
+ android:strokeColor="#33FFFFFF" />
+ <path
+ android:fillColor="#00000000"
+ android:pathData="M69,19L69,89"
+ android:strokeWidth="0.8"
+ android:strokeColor="#33FFFFFF" />
+ <path
+ android:fillColor="#00000000"
+ android:pathData="M79,19L79,89"
+ android:strokeWidth="0.8"
+ android:strokeColor="#33FFFFFF" />
+</vector>
diff --git a/HDLElianZigBeeDemo/app/src/main/res/layout/activity_elian.xml b/HDLElianZigBeeDemo/app/src/main/res/layout/activity_elian.xml
new file mode 100644
index 0000000..94ffa26
--- /dev/null
+++ b/HDLElianZigBeeDemo/app/src/main/res/layout/activity_elian.xml
@@ -0,0 +1,110 @@
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ tools:context="com.hdl.mediatek.ElianActivity" >
+
+ <LinearLayout
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:orientation="vertical"
+ android:weightSum="1" >
+
+ <TextView
+ android:id="@+id/Notice"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="" />
+
+ <TableLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content" >
+ </TableLayout>
+
+ <TableRow
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_weight="0.05">
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="SSID"
+ android:id="@+id/SSIDLabel" />
+
+ <EditText
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:id="@+id/SSID"
+ android:layout_weight="0.67" />
+ </TableRow>
+
+ <TableRow
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content">
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="Password"
+ android:id="@+id/PasswordLabel" />
+
+ <EditText
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:id="@+id/Password"
+ android:layout_gravity="center_horizontal" />
+ </TableRow>
+
+ <TableRow
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content">
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="custom"
+ android:id="@+id/CustomLabel" />
+
+ <EditText
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:id="@+id/Custom"
+ android:layout_gravity="center_horizontal" />
+ </TableRow>
+
+ <TableRow
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content">
+
+ <Button
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="Send V1"
+ android:id="@+id/startV1" />
+
+ <Button
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="Send V4"
+ android:id="@+id/startV4" />
+
+ <Button
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="Send Both"
+ android:id="@+id/startV1V4" />
+ </TableRow>
+
+ <TableRow
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content">
+
+ <Button
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="Stop"
+ android:id="@+id/stop" />
+ </TableRow>
+ </LinearLayout>
+</RelativeLayout>
diff --git a/HDLElianZigBeeDemo/app/src/main/res/layout/activity_main.xml b/HDLElianZigBeeDemo/app/src/main/res/layout/activity_main.xml
new file mode 100644
index 0000000..88a76a4
--- /dev/null
+++ b/HDLElianZigBeeDemo/app/src/main/res/layout/activity_main.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ tools:context=".MainActivity">
+
+ <Button
+ android:id="@+id/btn_go"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="Go"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintLeft_toLeftOf="parent"
+ app:layout_constraintRight_toRightOf="parent"
+ app:layout_constraintTop_toTopOf="parent"
+ />
+
+</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
diff --git a/HDLElianZigBeeDemo/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/HDLElianZigBeeDemo/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
new file mode 100644
index 0000000..eca70cf
--- /dev/null
+++ b/HDLElianZigBeeDemo/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
+ <background android:drawable="@drawable/ic_launcher_background" />
+ <foreground android:drawable="@drawable/ic_launcher_foreground" />
+</adaptive-icon>
\ No newline at end of file
diff --git a/HDLElianZigBeeDemo/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/HDLElianZigBeeDemo/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
new file mode 100644
index 0000000..eca70cf
--- /dev/null
+++ b/HDLElianZigBeeDemo/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
+ <background android:drawable="@drawable/ic_launcher_background" />
+ <foreground android:drawable="@drawable/ic_launcher_foreground" />
+</adaptive-icon>
\ No newline at end of file
diff --git a/HDLElianZigBeeDemo/app/src/main/res/mipmap-hdpi/ic_launcher.png b/HDLElianZigBeeDemo/app/src/main/res/mipmap-hdpi/ic_launcher.png
new file mode 100644
index 0000000..898f3ed
--- /dev/null
+++ b/HDLElianZigBeeDemo/app/src/main/res/mipmap-hdpi/ic_launcher.png
Binary files differ
diff --git a/HDLElianZigBeeDemo/app/src/main/res/mipmap-hdpi/ic_launcher_round.png b/HDLElianZigBeeDemo/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
new file mode 100644
index 0000000..dffca36
--- /dev/null
+++ b/HDLElianZigBeeDemo/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
Binary files differ
diff --git a/HDLElianZigBeeDemo/app/src/main/res/mipmap-mdpi/ic_launcher.png b/HDLElianZigBeeDemo/app/src/main/res/mipmap-mdpi/ic_launcher.png
new file mode 100644
index 0000000..64ba76f
--- /dev/null
+++ b/HDLElianZigBeeDemo/app/src/main/res/mipmap-mdpi/ic_launcher.png
Binary files differ
diff --git a/HDLElianZigBeeDemo/app/src/main/res/mipmap-mdpi/ic_launcher_round.png b/HDLElianZigBeeDemo/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
new file mode 100644
index 0000000..dae5e08
--- /dev/null
+++ b/HDLElianZigBeeDemo/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
Binary files differ
diff --git a/HDLElianZigBeeDemo/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/HDLElianZigBeeDemo/app/src/main/res/mipmap-xhdpi/ic_launcher.png
new file mode 100644
index 0000000..e5ed465
--- /dev/null
+++ b/HDLElianZigBeeDemo/app/src/main/res/mipmap-xhdpi/ic_launcher.png
Binary files differ
diff --git a/HDLElianZigBeeDemo/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/HDLElianZigBeeDemo/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
new file mode 100644
index 0000000..14ed0af
--- /dev/null
+++ b/HDLElianZigBeeDemo/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
Binary files differ
diff --git a/HDLElianZigBeeDemo/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/HDLElianZigBeeDemo/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
new file mode 100644
index 0000000..b0907ca
--- /dev/null
+++ b/HDLElianZigBeeDemo/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
Binary files differ
diff --git a/HDLElianZigBeeDemo/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/HDLElianZigBeeDemo/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
new file mode 100644
index 0000000..d8ae031
--- /dev/null
+++ b/HDLElianZigBeeDemo/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
Binary files differ
diff --git a/HDLElianZigBeeDemo/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/HDLElianZigBeeDemo/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
new file mode 100644
index 0000000..2c18de9
--- /dev/null
+++ b/HDLElianZigBeeDemo/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Binary files differ
diff --git a/HDLElianZigBeeDemo/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/HDLElianZigBeeDemo/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
new file mode 100644
index 0000000..beed3cd
--- /dev/null
+++ b/HDLElianZigBeeDemo/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
Binary files differ
diff --git a/HDLElianZigBeeDemo/app/src/main/res/values/colors.xml b/HDLElianZigBeeDemo/app/src/main/res/values/colors.xml
new file mode 100644
index 0000000..69b2233
--- /dev/null
+++ b/HDLElianZigBeeDemo/app/src/main/res/values/colors.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <color name="colorPrimary">#008577</color>
+ <color name="colorPrimaryDark">#00574B</color>
+ <color name="colorAccent">#D81B60</color>
+</resources>
diff --git a/HDLElianZigBeeDemo/app/src/main/res/values/strings.xml b/HDLElianZigBeeDemo/app/src/main/res/values/strings.xml
new file mode 100644
index 0000000..7a9017a
--- /dev/null
+++ b/HDLElianZigBeeDemo/app/src/main/res/values/strings.xml
@@ -0,0 +1,3 @@
+<resources>
+ <string name="app_name">HDLElianZigBee</string>
+</resources>
diff --git a/HDLElianZigBeeDemo/app/src/main/res/values/styles.xml b/HDLElianZigBeeDemo/app/src/main/res/values/styles.xml
new file mode 100644
index 0000000..5885930
--- /dev/null
+++ b/HDLElianZigBeeDemo/app/src/main/res/values/styles.xml
@@ -0,0 +1,11 @@
+<resources>
+
+ <!-- Base application theme. -->
+ <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
+ <!-- Customize your theme here. -->
+ <item name="colorPrimary">@color/colorPrimary</item>
+ <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
+ <item name="colorAccent">@color/colorAccent</item>
+ </style>
+
+</resources>
diff --git a/HDLElianZigBeeDemo/app/src/test/java/com/hdl/hdlelianzigbee/ExampleUnitTest.java b/HDLElianZigBeeDemo/app/src/test/java/com/hdl/hdlelianzigbee/ExampleUnitTest.java
new file mode 100644
index 0000000..b73517f
--- /dev/null
+++ b/HDLElianZigBeeDemo/app/src/test/java/com/hdl/hdlelianzigbee/ExampleUnitTest.java
@@ -0,0 +1,17 @@
+package com.hdl.hdlelianzigbee;
+
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+/**
+ * Example local unit test, which will execute on the development machine (host).
+ *
+ * @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
+ */
+public class ExampleUnitTest {
+ @Test
+ public void addition_isCorrect() {
+ assertEquals(4, 2 + 2);
+ }
+}
\ No newline at end of file
diff --git a/HDLElianZigBeeDemo/build.gradle b/HDLElianZigBeeDemo/build.gradle
new file mode 100644
index 0000000..02199bb
--- /dev/null
+++ b/HDLElianZigBeeDemo/build.gradle
@@ -0,0 +1,27 @@
+// Top-level build file where you can add configuration options common to all sub-projects/modules.
+
+buildscript {
+ repositories {
+ google()
+ jcenter()
+
+ }
+ dependencies {
+ classpath 'com.android.tools.build:gradle:3.4.1'
+
+ // NOTE: Do not place your application dependencies here; they belong
+ // in the individual module build.gradle files
+ }
+}
+
+allprojects {
+ repositories {
+ google()
+ jcenter()
+
+ }
+}
+
+task clean(type: Delete) {
+ delete rootProject.buildDir
+}
diff --git a/HDLElianZigBeeDemo/gradle.properties b/HDLElianZigBeeDemo/gradle.properties
new file mode 100644
index 0000000..199d16e
--- /dev/null
+++ b/HDLElianZigBeeDemo/gradle.properties
@@ -0,0 +1,20 @@
+# 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
+# AndroidX package structure to make it clearer which packages are bundled with the
+# Android operating system, and which are packaged with your app's APK
+# https://developer.android.com/topic/libraries/support-library/androidx-rn
+android.useAndroidX=true
+# Automatically convert third-party libraries to use AndroidX
+android.enableJetifier=true
+
diff --git a/HDLElianZigBeeDemo/gradle/wrapper/gradle-wrapper.jar b/HDLElianZigBeeDemo/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 0000000..f6b961f
--- /dev/null
+++ b/HDLElianZigBeeDemo/gradle/wrapper/gradle-wrapper.jar
Binary files differ
diff --git a/HDLElianZigBeeDemo/gradle/wrapper/gradle-wrapper.properties b/HDLElianZigBeeDemo/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 0000000..de4adca
--- /dev/null
+++ b/HDLElianZigBeeDemo/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,6 @@
+#Thu Dec 05 10:56:29 GMT+08:00 2019
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
diff --git a/HDLElianZigBeeDemo/gradlew b/HDLElianZigBeeDemo/gradlew
new file mode 100644
index 0000000..cccdd3d
--- /dev/null
+++ b/HDLElianZigBeeDemo/gradlew
@@ -0,0 +1,172 @@
+#!/usr/bin/env sh
+
+##############################################################################
+##
+## Gradle start up script for UN*X
+##
+##############################################################################
+
+# 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
+
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS=""
+
+# 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
+nonstop=false
+case "`uname`" in
+ CYGWIN* )
+ cygwin=true
+ ;;
+ Darwin* )
+ darwin=true
+ ;;
+ MINGW* )
+ msys=true
+ ;;
+ NONSTOP* )
+ nonstop=true
+ ;;
+esac
+
+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" -a "$nonstop" = "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
+
+# Escape application args
+save () {
+ for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
+ echo " "
+}
+APP_ARGS=$(save "$@")
+
+# Collect all arguments for the java command, following the shell quoting and substitution rules
+eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
+
+# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
+if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
+ cd "$(dirname "$0")"
+fi
+
+exec "$JAVACMD" "$@"
diff --git a/HDLElianZigBeeDemo/gradlew.bat b/HDLElianZigBeeDemo/gradlew.bat
new file mode 100644
index 0000000..f955316
--- /dev/null
+++ b/HDLElianZigBeeDemo/gradlew.bat
@@ -0,0 +1,84 @@
+@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
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@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=
+
+@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 Windows variants
+
+if not "%OS%" == "Windows_NT" goto win9xME_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=%*
+
+: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/HDLElianZigBeeDemo/settings.gradle b/HDLElianZigBeeDemo/settings.gradle
new file mode 100644
index 0000000..796a969
--- /dev/null
+++ b/HDLElianZigBeeDemo/settings.gradle
@@ -0,0 +1 @@
+include ':app', ":HDLElianZigBee"
--
Gitblit v1.8.0