diff --git a/C5/settings.gradle b/C5/settings.gradle
index c3852a4..520d6d5 100644
--- a/C5/settings.gradle
+++ b/C5/settings.gradle
@@ -1,2 +1,2 @@
-include ':app', ':udpmodule', ':xpadprotocal', ':util', ':sunvoteadapter', 'txpad', 'sunvotesdk','testproject','statusBar'
+include ':app', ':udpmodule', ':xpadprotocal', ':util','statusBar'
\ No newline at end of file
diff --git a/C5/sunvoteadapter/.gitignore b/C5/sunvoteadapter/.gitignore
deleted file mode 100644
index 796b96d..0000000
--- a/C5/sunvoteadapter/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/build
diff --git a/C5/sunvoteadapter/build.gradle b/C5/sunvoteadapter/build.gradle
deleted file mode 100644
index 2759ab5..0000000
--- a/C5/sunvoteadapter/build.gradle
+++ /dev/null
@@ -1,23 +0,0 @@
-apply plugin: 'com.android.library'
-
-android {
- compileSdkVersion 26
- defaultConfig {
- minSdkVersion 21
- targetSdkVersion 26
- versionCode 1
- versionName "1.0"
-
- }
- buildTypes {
- release {
- minifyEnabled false
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
- }
- }
- buildToolsVersion '26.0.2'
-}
-
-dependencies {
- implementation project(':udpmodule')
-}
diff --git a/C5/sunvoteadapter/proguard-rules.pro b/C5/sunvoteadapter/proguard-rules.pro
deleted file mode 100644
index f1b4245..0000000
--- a/C5/sunvoteadapter/proguard-rules.pro
+++ /dev/null
@@ -1,21 +0,0 @@
-# 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/C5/sunvoteadapter/src/main/AndroidManifest.xml b/C5/sunvoteadapter/src/main/AndroidManifest.xml
deleted file mode 100644
index 3892789..0000000
--- a/C5/sunvoteadapter/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,2 +0,0 @@
-
diff --git a/C5/sunvoteadapter/src/main/java/com/sunvote/sunvoteadapter/IBottomCommandReceiver.java b/C5/sunvoteadapter/src/main/java/com/sunvote/sunvoteadapter/IBottomCommandReceiver.java
deleted file mode 100644
index 5f8c8b6..0000000
--- a/C5/sunvoteadapter/src/main/java/com/sunvote/sunvoteadapter/IBottomCommandReceiver.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package com.sunvote.sunvoteadapter;
-
-import com.sunvote.cmd.ICmd;
-
-/**
- * Created by Elvis on 2017/12/4 14:45
- * Email:Eluis@psunsky.com
- * 版权所有:长沙中天电子设计开发有限公司
- * Description: 人大通用版XPadAppRD
- */
-public interface IBottomCommandReceiver {
-
- boolean onReceiverCmd(ICmd cmd);
-
-}
diff --git a/C5/sunvoteadapter/src/main/java/com/sunvote/sunvoteadapter/SunVoteAdapterManagerFactroy.java b/C5/sunvoteadapter/src/main/java/com/sunvote/sunvoteadapter/SunVoteAdapterManagerFactroy.java
deleted file mode 100644
index a93f6e8..0000000
--- a/C5/sunvoteadapter/src/main/java/com/sunvote/sunvoteadapter/SunVoteAdapterManagerFactroy.java
+++ /dev/null
@@ -1,192 +0,0 @@
-package com.sunvote.sunvoteadapter;
-
-import com.sunvote.cmd.BaseCmd;
-import com.sunvote.cmd.ICmd;
-import com.sunvote.protocal.Protocol;
-import com.sunvote.udptransfer.UDPModule;
-import com.sunvote.udptransfer.work.WorkThread;
-import com.sunvote.util.ByteUtil;
-import com.sunvote.util.LogUtil;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Created by Elvis on 2017/11/29 17:07
- * Email:Eluis@psunsky.com
- * 版权所有:长沙中天电子设计开发有限公司
- * Description: SunVoteAdapterManagerFactroy
- */
-public class SunVoteAdapterManagerFactroy {
- private static volatile SunVoteAdapterManagerFactroy ourInstance = null;
- private static String TAG = "SunVote";
-
- private UDPModule client = null;
-
- private InputStream mInputStream;
- private OutputStream mOutputStream;
- private WorkThread receiverWorkThread;
- private boolean isRunning = false;
-
- private List mCommandReceivingList = new ArrayList<>();
-
- public boolean isRunning() {
- return isRunning;
- }
-
- public static SunVoteAdapterManagerFactroy getInstance() {
- if(ourInstance == null){
- synchronized (SunVoteAdapterManagerFactroy.class){
- if(ourInstance == null){
- ourInstance = new SunVoteAdapterManagerFactroy();
- }
- }
- }
- return ourInstance;
- }
-
- public void registerCommandReceiverListener(IBottomCommandReceiver receiver){
- mCommandReceivingList.add(receiver);
- }
-
- public void unRegisterCommandReceiverListener(IBottomCommandReceiver receiver){
- mCommandReceivingList.remove(receiver);
- }
-
- public void clearReceiverListener(){
- mCommandReceivingList.clear();
- }
-
- private SunVoteAdapterManagerFactroy() {
- }
-
- public void start(){
- if(!isRunning()) {
- isRunning = true;
- client = new UDPModule();
- mOutputStream = client.getOutputStream();
- mInputStream = client.getInputStream();
- if (receiverWorkThread != null) {
- receiverWorkThread.destroyObject();
- }
- receiverWorkThread = new WorkThread("SunVoteAdapterManagerFactroy");
- reciveMsgBean.executeMethod = executeMethod;
- receiverWorkThread.sendMessage(reciveMsgBean);
- }
- }
-
- public void stop(){
- if(isRunning()){
- isRunning = false;
- if (receiverWorkThread != null) {
- receiverWorkThread.destroyObject();
- }
- if(mInputStream != null) {
- try {
- mInputStream.close();
- } catch (IOException e) {
- LogUtil.e(TAG,e);
- }
- mInputStream = null;
- }
- if(mOutputStream != null){
- try {
- mOutputStream.close();
- } catch (IOException e) {
- LogUtil.e(TAG,e);
- }
- }
- mOutputStream = null;
- client = null;
- }
- }
-
- private WorkThread.MessageBean reciveMsgBean = new WorkThread.MessageBean();
-
- private WorkThread.ExecuteMethod executeMethod = new WorkThread.ExecuteMethod() {
- @Override
- public void execute(WorkThread.MessageBean messageBean) {
- if(mInputStream != null){
- ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
- byte[] bytes = new byte[1024];
- int tmpLength = -1 ;
- while(isRunning()){
- try {
- tmpLength = mInputStream.read(bytes);
- if(tmpLength < 0){
- break;
- }
- // 1. 先检测读取数据到缓冲区
- byteArrayOutputStream.write(bytes,0,tmpLength);
- // 2. 判断缓冲区的数据标志是否存在
- if(byteArrayOutputStream.size() >= 3){
- byte[] temp = byteArrayOutputStream.toByteArray();
- int find = ByteUtil.findBytes(temp,Protocol.HEADER,0);
- if(find >= 0){
- // 3. 标志存在,则继续读取长度
- if(byteArrayOutputStream.size() >= find + 4){
- int length = ByteUtil.byte1ToInt(byteArrayOutputStream.toByteArray()[find+3]);
- if(byteArrayOutputStream.size() >= find + 4 + length){
- ByteArrayOutputStream tmp = new ByteArrayOutputStream();
- // 4. 根据长度读取包的内容
- for(int i = find ; i < find + 4 + length;i++){
- // 5. 截取包的内容,向外抛出,处理,接着读取下一个包
- tmp.write(temp[i]);
- }
- // 6. 抛出处理
- LogUtil.i(TAG,"命令包数据",tmp.toByteArray());
- ICmd cmd = BaseCmd.parse(tmp.toByteArray(),tmp.size());
- sendCmdToCall(cmd);
- // 7. 剩余数据重新打包处理
-// byteArrayOutputStream = new ByteArrayOutputStream();
- byteArrayOutputStream.reset();
- for(int i = find + 4 + length ; i < temp.length ; i++) {
- byteArrayOutputStream.write(temp[i]);
- }
- }
- }
- }
- }
- if(byteArrayOutputStream.size() > 2048){
- LogUtil.i(TAG,"被恶意攻击?或者传输数据错误?丢弃处理!",byteArrayOutputStream.toByteArray());
- byteArrayOutputStream.reset();
- }
- } catch (Exception e) {
- LogUtil.e(TAG,e);
- }
- }
- }
- }
- };
-
- public boolean sendCmd(ICmd cmd){
- if(isRunning()) {
- Protocol protocol = new Protocol<>();
- protocol.setEnableMatchCode(false);
- protocol.setCmd(cmd);
- if (mOutputStream != null) {
- try {
- mOutputStream.write(protocol.toBytes());
- mOutputStream.flush();
- return true;
- } catch (Exception e) {
- LogUtil.e(TAG, e);
- }
- }
- }
- return false;
- }
-
- private void sendCmdToCall(ICmd cmd){
- if(mCommandReceivingList != null && mCommandReceivingList.size() > 0) {
- for (IBottomCommandReceiver receiver : mCommandReceivingList) {
- receiver.onReceiverCmd(cmd);
- }
- }
- }
-
-}
diff --git a/C5/sunvoteadapter/src/main/res/values/strings.xml b/C5/sunvoteadapter/src/main/res/values/strings.xml
deleted file mode 100644
index af66ce7..0000000
--- a/C5/sunvoteadapter/src/main/res/values/strings.xml
+++ /dev/null
@@ -1,3 +0,0 @@
-
- SunVoteAdapter
-
diff --git a/C5/testproject/.gitignore b/C5/testproject/.gitignore
deleted file mode 100644
index 796b96d..0000000
--- a/C5/testproject/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/build
diff --git a/C5/testproject/build.gradle b/C5/testproject/build.gradle
deleted file mode 100644
index bbd530a..0000000
--- a/C5/testproject/build.gradle
+++ /dev/null
@@ -1,35 +0,0 @@
-apply plugin: 'com.android.application'
-
-android {
- compileSdkVersion 26
- buildToolsVersion "26.0.2"
- defaultConfig {
- minSdkVersion 21
- targetSdkVersion 26
- applicationId "com.sunvote.udptest"
- versionCode 1
- versionName "1.0"
- testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
- }
- buildTypes {
- release {
- minifyEnabled false
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
- }
- }
- productFlavors {
- }
-}
-
-dependencies {
- compile fileTree(include: ['*.jar'], dir: 'libs')
- androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
- exclude group: 'com.android.support', module: 'support-annotations'
- })
- compile 'com.android.support:appcompat-v7:26.+'
- compile 'com.android.support.constraint:constraint-layout:1.0.2'
- compile 'com.android.support:design:26.+'
- testCompile 'junit:junit:4.12'
- implementation project(':sunvotesdk')
- implementation 'com.squareup.okhttp3:okhttp:3.11.0'
-}
diff --git a/C5/testproject/proguard-rules.pro b/C5/testproject/proguard-rules.pro
deleted file mode 100644
index 387d18b..0000000
--- a/C5/testproject/proguard-rules.pro
+++ /dev/null
@@ -1,25 +0,0 @@
-# Add project specific ProGuard rules here.
-# By default, the flags in this file are appended to flags specified
-# in C:\Users\XXW\AppData\Local\Android\Sdk/tools/proguard/proguard-android.txt
-# You can edit the include path and order by changing the proguardFiles
-# directive in build.gradle.
-#
-# For more details, see
-# http://developer.android.com/guide/developing/tools/proguard.html
-
-# Add any project specific keep options here:
-
-# 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/C5/testproject/release/output.json b/C5/testproject/release/output.json
deleted file mode 100644
index b3fa25a..0000000
--- a/C5/testproject/release/output.json
+++ /dev/null
@@ -1 +0,0 @@
-[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":1},"path":"testproject-release.apk","properties":{"packageId":"com.sunvote.udptest","split":"","minSdkVersion":"21"}}]
\ No newline at end of file
diff --git a/C5/testproject/src/androidTest/java/com/sunvote/udptest/ExampleInstrumentedTest.java b/C5/testproject/src/androidTest/java/com/sunvote/udptest/ExampleInstrumentedTest.java
deleted file mode 100644
index 0b93298..0000000
--- a/C5/testproject/src/androidTest/java/com/sunvote/udptest/ExampleInstrumentedTest.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package com.sunvote.udptest;
-
-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.*;
-
-/**
- * Instrumentation 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.sunvote.udptest", appContext.getPackageName());
- }
-}
diff --git a/C5/testproject/src/main/AndroidManifest.xml b/C5/testproject/src/main/AndroidManifest.xml
deleted file mode 100644
index 431db12..0000000
--- a/C5/testproject/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,68 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/C5/testproject/src/main/java/com/sunvote/udptest/FontSizeActity.java b/C5/testproject/src/main/java/com/sunvote/udptest/FontSizeActity.java
deleted file mode 100644
index 016f519..0000000
--- a/C5/testproject/src/main/java/com/sunvote/udptest/FontSizeActity.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package com.sunvote.udptest;
-
-import android.os.Bundle;
-import android.support.design.widget.FloatingActionButton;
-import android.support.design.widget.Snackbar;
-import android.support.v7.app.AppCompatActivity;
-import android.support.v7.widget.Toolbar;
-import android.view.View;
-
-public class FontSizeActity extends AppCompatActivity {
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_font_size_actity);
-
- }
-
-}
diff --git a/C5/testproject/src/main/java/com/sunvote/udptest/LocalUDPDataSender.java b/C5/testproject/src/main/java/com/sunvote/udptest/LocalUDPDataSender.java
deleted file mode 100644
index f3d41c7..0000000
--- a/C5/testproject/src/main/java/com/sunvote/udptest/LocalUDPDataSender.java
+++ /dev/null
@@ -1,96 +0,0 @@
-package com.sunvote.udptest;
-
-import java.net.DatagramSocket;
-import java.net.InetAddress;
-
-/**
- * Created by Elvis on 2017/8/8.
- * Email:Eluis@psunsky.com
- * Description:
- */
-
-public class LocalUDPDataSender {
-
- private final static String TAG = LocalUDPDataSender.class.getSimpleName();
-
- private static LocalUDPDataSender instance = null;
-
- private DatagramSocket remoteUDPSocket = null;
-
-
- public static LocalUDPDataSender getInstance() {
- if (instance == null)
- instance = new LocalUDPDataSender();
- return instance;
- }
-
- private LocalUDPDataSender() {
-
- }
-
- public DatagramSocket resetRemoteUDPSocket() {
- try {
- closeLocalUDPSocket();
- remoteUDPSocket = (MainActivity.port == 0 ?
- new DatagramSocket() : new DatagramSocket(MainActivity.port));//_Utils.LOCAL_UDP_SEND$LISTENING_PORT);
- remoteUDPSocket.setReuseAddress(true);
- return remoteUDPSocket;
- } catch (Exception e) {
- closeLocalUDPSocket();
- return null;
- }
- }
-
- private boolean isRemoteUDPSocketReady() {
- boolean ret = true;
- if(remoteUDPSocket != null) {
- return ret && !remoteUDPSocket.isClosed();
- }
- return false;
- }
-
-
-
- public void closeLocalUDPSocket() {
- try {
- if (remoteUDPSocket != null) {
- remoteUDPSocket.close();
- remoteUDPSocket = null;
- } else {
- }
- } catch (Exception e) {
- }
- }
-
- public DatagramSocket getRemoteDPSocket() {
- if (isRemoteUDPSocketReady()) {
- return remoteUDPSocket;
- } else {
- return resetRemoteUDPSocket();
- }
- }
-
-
-
- /**
- * 需要重载一个函数
- * 如果没有指定服务器IP地址,则只能广播出去,让服务器接收处理
- * @param fullProtocalBytes
- * @param dataLen
- * @return
- */
- public int send(byte[] fullProtocalBytes, int dataLen) {
- DatagramSocket ds = getRemoteDPSocket();
- if (ds != null && !ds.isConnected()) {
- try {
- ds.connect(InetAddress.getByName(MainActivity.serverIp), MainActivity.port);
- } catch (Exception e) {
- return -1;
- }
- }
- return UDPUtils.send(ds, fullProtocalBytes, dataLen) ? 0 : -1;
-
- }
-
-
-}
diff --git a/C5/testproject/src/main/java/com/sunvote/udptest/LocalUDPSocketProvider.java b/C5/testproject/src/main/java/com/sunvote/udptest/LocalUDPSocketProvider.java
deleted file mode 100644
index 2c6d7fc..0000000
--- a/C5/testproject/src/main/java/com/sunvote/udptest/LocalUDPSocketProvider.java
+++ /dev/null
@@ -1,76 +0,0 @@
-package com.sunvote.udptest;
-
-import java.net.DatagramSocket;
-import java.net.SocketAddress;
-
-/**
- * Created by Elvis on 2017/8/8.
- * Email:Eluis@psunsky.com
- * Description:
- * 本地UDP提供类
- */
-
-public class LocalUDPSocketProvider {
- private final static String TAG = LocalUDPSocketProvider.class.getSimpleName();
-
- private static LocalUDPSocketProvider instance = null;
-
- private DatagramSocket localUDPSocket = null;
-
- public static LocalUDPSocketProvider getInstance() {
- if (instance == null)
- instance = new LocalUDPSocketProvider();
- return instance;
- }
-
- private LocalUDPSocketProvider() {
- //
- }
-
- public DatagramSocket resetLocalUDPSocket() {
- try {
- closeLocalUDPSocket();
- localUDPSocket = new DatagramSocket(Main2Activity.port);//_Utils.LOCAL_UDP_SEND$LISTENING_PORT);
- //Config.getInstance().localUDPPort
- localUDPSocket.setReuseAddress(true);
- localUDPSocket.setSoTimeout(60 * 10000);
- return localUDPSocket;
- } catch (Exception e) {
- closeLocalUDPSocket();
- return null;
- }
- }
-
- private boolean isLocalUDPSocketReady() {
- boolean ret = true;
- if(localUDPSocket != null) {
- SocketAddress socketAddress = localUDPSocket.getRemoteSocketAddress();
- if (socketAddress != null) {
- if(!"".equals(Main2Activity.ip)){
- ret = socketAddress.toString().contains(Main2Activity.ip);
- }
- }
- return ret && !localUDPSocket.isClosed();
- }
- return false;
- }
-
- public DatagramSocket getLocalUDPSocket() {
- if (isLocalUDPSocketReady()) {
- return localUDPSocket;
- } else {
- return resetLocalUDPSocket();
- }
- }
-
- public void closeLocalUDPSocket() {
- try {
- if (localUDPSocket != null) {
- localUDPSocket.close();
- localUDPSocket = null;
- } else {
- }
- } catch (Exception e) {
- }
- }
-}
diff --git a/C5/testproject/src/main/java/com/sunvote/udptest/Main2Activity.java b/C5/testproject/src/main/java/com/sunvote/udptest/Main2Activity.java
deleted file mode 100644
index 78087d8..0000000
--- a/C5/testproject/src/main/java/com/sunvote/udptest/Main2Activity.java
+++ /dev/null
@@ -1,87 +0,0 @@
-package com.sunvote.udptest;
-
-import android.os.Handler;
-import android.support.v7.app.AppCompatActivity;
-import android.os.Bundle;
-import android.text.TextUtils;
-import android.view.View;
-import android.widget.Button;
-import android.widget.TextView;
-
-import com.sunvote.util.ByteUtils;
-
-import java.net.DatagramPacket;
-import java.net.DatagramSocket;
-
-public class Main2Activity extends AppCompatActivity {
-
- public static int port = 40003;
-
- public static String ip ;
-
- private TextView display;
- private Button button;
- private int cou = 0 ;
- StringBuilder stringBuilder = new StringBuilder();
- private String count ;
-
- private boolean isCrate = false;
- private Handler handler ;
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main2);
-
- display = (TextView) findViewById(R.id.display);
- button = (Button) findViewById(R.id.clean);
-
- button.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- stringBuilder = new StringBuilder();
- cou = 0 ;
- display.setText("收到" + cou + "条消息\n"+ stringBuilder.toString());
- }
- });
-
- isCrate = true;
- handler = new Handler();
- thread.start();
- }
-
- @Override
- protected void onDestroy() {
- super.onDestroy();
- isCrate = false;
- }
-
- private Thread thread = new Thread(){
- @Override
- public void run() {
- super.run();
-
- DatagramSocket localUDPSocket = LocalUDPSocketProvider.getInstance().getLocalUDPSocket();
- while (isCrate){
- if (localUDPSocket != null && !localUDPSocket.isClosed()) {
- try {
- byte[] data = new byte[1024];
- DatagramPacket packet = new DatagramPacket(data, data.length);
- localUDPSocket.receive(packet);
- stringBuilder.append(ByteUtils.bytesToHexString(packet.getData(),packet.getLength())).append("\n");
- cou ++ ;
- handler.post(new Runnable() {
- @Override
- public void run() {
- display.setText("收到" + cou + "条消息\n"+ stringBuilder.toString());
- }
- });
- }catch (Exception ex){
-
- }
- }
-
- }
- }
- };
-}
diff --git a/C5/testproject/src/main/java/com/sunvote/udptest/MainActivity.java b/C5/testproject/src/main/java/com/sunvote/udptest/MainActivity.java
deleted file mode 100644
index ff6bd11..0000000
--- a/C5/testproject/src/main/java/com/sunvote/udptest/MainActivity.java
+++ /dev/null
@@ -1,116 +0,0 @@
-package com.sunvote.udptest;
-
-import android.support.v7.app.AppCompatActivity;
-import android.os.Bundle;
-import android.text.Html;
-import android.text.TextUtils;
-import android.view.View;
-import android.widget.EditText;
-import android.widget.TextView;
-import android.widget.Toast;
-
-import java.net.DatagramSocket;
-import java.net.InetAddress;
-
-public class MainActivity extends AppCompatActivity {
-
- private EditText sreverIpView;
- private EditText serverPortView;
- private EditText contentView;
-
- private TextView webviewtest;
-
- private View test;
-
- public static String serverIp = "192.168.0.104";
- public static int port ;
- private String content;
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
-
- initView();
-
- }
-
- private void initView() {
- sreverIpView = (EditText) findViewById(R.id.server_ip);
- serverPortView = (EditText) findViewById(R.id.server_port);
- contentView = (EditText)findViewById(R.id.content);
- webviewtest = (TextView)findViewById(R.id.webviewtest);
-
- test = findViewById(R.id.test);
-
- webviewtest.setText(Html.fromHtml("
解:如图所示:∵在△ABC中,∠C=90°,有一点既在BC的对称轴上,又在AC的对称轴上,
∴由直角三角形斜边的中点到三角形三个顶点的距离相等,则该点一定是AB中点.
故选:D."));
-
- test.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View view) {
- serverIp = sreverIpView.getText().toString();
- try{
- port = Integer.parseInt(serverPortView.getText().toString());
- }catch (Exception ex){
- Toast.makeText(MainActivity.this,"端口错误",Toast.LENGTH_SHORT).show();
- return;
- }
- content = contentView.getText().toString();
- content = content.replace(" ","");
-
- if(TextUtils.isEmpty(serverIp)){
- Toast.makeText(MainActivity.this,"ip 為空",Toast.LENGTH_SHORT).show();
- return;
- }
-
- if(TextUtils.isEmpty(content)){
- Toast.makeText(MainActivity.this,"ip 輸入發送內容為空",Toast.LENGTH_SHORT).show();
- return;
- }
-
- new Thread(){
- public void run(){
- byte[] datas = hexStringToBytes(content);
- boolean ret = false;
- try{
- InetAddress address = InetAddress.getByName(serverIp);
- ret = LocalUDPDataSender.getInstance().send(datas,datas.length)>=0;
- }catch (Exception ex){
- ret = false;
- }
- final boolean result = ret;
- runOnUiThread(new Runnable() {
- @Override
- public void run() {
- Toast.makeText(MainActivity.this,"send:" + result,Toast.LENGTH_SHORT).show();
- }
- });
- }
- }.start();
- }
- });
- }
-
- public static byte[] hexStringToBytes(String hexString) {
- if (hexString == null || hexString.equals("")) {
- return null;
- }
- hexString = hexString.toUpperCase();
- int length = hexString.length() / 2;
- char[] hexChars = hexString.toCharArray();
- byte[] d = new byte[length];
- for (int i = 0; i < length; i++) {
- int pos = i * 2;
- d[i] = (byte) (charToByte(hexChars[pos]) << 4 | charToByte(hexChars[pos + 1]));
- }
- return d;
- }
- /**
- * Convert char to byte
- * @param c char
- * @return byte
- */
- private static byte charToByte(char c) {
- return (byte) "0123456789ABCDEF".indexOf(c);
- }
-}
diff --git a/C5/testproject/src/main/java/com/sunvote/udptest/ModifyMachCode.java b/C5/testproject/src/main/java/com/sunvote/udptest/ModifyMachCode.java
deleted file mode 100644
index 69361df..0000000
--- a/C5/testproject/src/main/java/com/sunvote/udptest/ModifyMachCode.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package com.sunvote.udptest;
-
-import android.os.Bundle;
-import android.support.v7.app.AppCompatActivity;
-import android.view.View;
-import android.widget.Button;
-import android.widget.EditText;
-import android.widget.Toast;
-
-import com.sunvote.sunvotesdk.BaseStationManager;
-
-public class ModifyMachCode extends AppCompatActivity {
-
- private Button modify;
- private EditText content;
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.content_modify_mach_code);
-
- BaseStationManager.getInstance().connectSer();
- content = (EditText) findViewById(R.id.content);
- modify = (Button)findViewById(R.id.modify);
- modify.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- String machcode = content.getText().toString();
- if(machcode != null && machcode.length() == 8){
- if(BaseStationManager.getInstance().getBaseStationInfo().isConnected()) {
- BaseStationManager.getInstance().writeMatchCode(machcode);
- Toast.makeText(ModifyMachCode.this,"修改成功",Toast.LENGTH_LONG).show();
- }else{
- Toast.makeText(ModifyMachCode.this,"修改失败",Toast.LENGTH_LONG).show();
- BaseStationManager.getInstance().connectSer();
- }
-
- }else{
- Toast.makeText(ModifyMachCode.this,"配对码输入不正确",Toast.LENGTH_LONG).show();
- }
- }
- });
- }
-
-}
diff --git a/C5/testproject/src/main/java/com/sunvote/udptest/UDPUtils.java b/C5/testproject/src/main/java/com/sunvote/udptest/UDPUtils.java
deleted file mode 100644
index 3fc1fa4..0000000
--- a/C5/testproject/src/main/java/com/sunvote/udptest/UDPUtils.java
+++ /dev/null
@@ -1,46 +0,0 @@
-package com.sunvote.udptest;
-
-import java.net.DatagramPacket;
-import java.net.DatagramSocket;
-
-/**
- * Created by Elvis on 2017/8/8.
- * Email:Eluis@psunsky.com
- * Description: UDP发送工具类
- */
-
-public class UDPUtils {
-
- private final static String TAG = UDPUtils.class.getSimpleName();
-
- public static boolean send(DatagramSocket skt, byte[] d, int dataLen) {
- if (skt != null && d != null) {
- try {
- return send(skt, new DatagramPacket(d, dataLen));
- } catch (Exception e) {
- return false;
- }
- } else {
- return false;
- }
- }
-
- public synchronized static boolean send(DatagramSocket skt, DatagramPacket p) {
- boolean sendSucess = true;
- if (skt != null && p != null) {
- if (skt.isConnected()) {
- try {
- skt.send(p);
- } catch (Exception e) {
- try{
- skt.close();
- }catch (Exception ex){}
- sendSucess = false;
- }
- }
- } else {
- }
-
- return sendSucess;
- }
-}
diff --git a/C5/testproject/src/main/java/com/sunvote/udptest/WebActivity.java b/C5/testproject/src/main/java/com/sunvote/udptest/WebActivity.java
deleted file mode 100644
index 2b7356e..0000000
--- a/C5/testproject/src/main/java/com/sunvote/udptest/WebActivity.java
+++ /dev/null
@@ -1,157 +0,0 @@
-package com.sunvote.udptest;
-
-import android.app.Activity;
-import android.graphics.Bitmap;
-import android.net.http.SslError;
-import android.os.Bundle;
-import android.os.Environment;
-import android.os.Handler;
-import android.os.Message;
-import android.view.KeyEvent;
-import android.webkit.ClientCertRequest;
-import android.webkit.HttpAuthHandler;
-import android.webkit.RenderProcessGoneDetail;
-import android.webkit.SslErrorHandler;
-import android.webkit.WebChromeClient;
-import android.webkit.WebResourceError;
-import android.webkit.WebResourceRequest;
-import android.webkit.WebResourceResponse;
-import android.webkit.WebView;
-import android.webkit.WebViewClient;
-import android.widget.TextView;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.HttpURLConnection;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.URLConnection;
-import java.util.Date;
-
-public class WebActivity extends Activity {
-
- private WebView webView;
- private Handler handler;
- private TextView msg;
- private String url;
- private int errorCount = 0;
- private int successCount = 0;
- private boolean last = true;
- private String current;
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.content_base);
- webView = (WebView) findViewById(R.id.webview);
- msg = (TextView) findViewById(R.id.msg);
- handler = new Handler();
- }
-
- @Override
- protected void onResume() {
- super.onResume();
- initIp();
- if (url != null) {
- handler.post(runnable);
- }
-
- }
-
- public void initIp() {
- File file = new File(Environment.getExternalStorageDirectory().getPath() + "/sunvote/serverip.txt");
- FileReader fileReader = null;
- BufferedReader br = null;
- try {
- fileReader = new FileReader(file);
- br = new BufferedReader(fileReader);
- url = br.readLine();
- url = "http://" + url + ":8080";
- } catch (Exception e) {
- e.printStackTrace();
- } finally {
- if (br != null) {
- try {
- br.close();
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- if (fileReader != null) {
- try {
- fileReader.close();
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- }
- }
-
- private Runnable runnable = new Runnable() {
- @Override
- public void run() {
- new Thread() {
- public void run() {
- try {
- URL network = new URL(url);
- URLConnection connection = network.openConnection();
- connection.setConnectTimeout(10000);
- connection.setReadTimeout(15000);
- InputStream is = connection.getInputStream();
- if (is != null) {
- byte[] bytes = new byte[1024];
- while (is.read(bytes) > 0) ;
- }
- successCount++;
- last = true;
- } catch (Exception e) {
- e.printStackTrace();
- errorCount++;
- if(last) {
- current = new Date().toString();
- last = false;
- }
- }
- handler.post(new Runnable() {
- @Override
- public void run() {
- msg.setText("成功次数:" + successCount + ",失败次数:" + errorCount + "," + current);
- webView.loadUrl(url);
- }
- });
- handler.postDelayed(runnable, 2000);
- }
- }.start();
-
- }
- };
-
- private Runnable error = new Runnable() {
- @Override
- public void run() {
- error();
- }
- };
-
- private void error() {
- errorCount++;
- handler.post(new Runnable() {
- @Override
- public void run() {
- msg.setText("成功次数:" + successCount + ",失败次数:" + errorCount);
- }
- });
- handler.postDelayed(runnable, 2000);
- }
-
- @Override
- protected void onDestroy() {
- super.onDestroy();
- handler.removeCallbacks(error);
- handler.removeCallbacks(runnable);
- }
-}
diff --git a/C5/testproject/src/main/res/layout/activity_base.xml b/C5/testproject/src/main/res/layout/activity_base.xml
deleted file mode 100644
index caea870..0000000
--- a/C5/testproject/src/main/res/layout/activity_base.xml
+++ /dev/null
@@ -1,33 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/C5/testproject/src/main/res/layout/activity_font_size_actity.xml b/C5/testproject/src/main/res/layout/activity_font_size_actity.xml
deleted file mode 100644
index 6ccfa30..0000000
--- a/C5/testproject/src/main/res/layout/activity_font_size_actity.xml
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-
-
-
-
-
-
diff --git a/C5/testproject/src/main/res/layout/activity_main.xml b/C5/testproject/src/main/res/layout/activity_main.xml
deleted file mode 100644
index d24a456..0000000
--- a/C5/testproject/src/main/res/layout/activity_main.xml
+++ /dev/null
@@ -1,48 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/C5/testproject/src/main/res/layout/activity_main2.xml b/C5/testproject/src/main/res/layout/activity_main2.xml
deleted file mode 100644
index 688bf4d..0000000
--- a/C5/testproject/src/main/res/layout/activity_main2.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/C5/testproject/src/main/res/layout/activity_modify_mach_code.xml b/C5/testproject/src/main/res/layout/activity_modify_mach_code.xml
deleted file mode 100644
index 8c6864e..0000000
--- a/C5/testproject/src/main/res/layout/activity_modify_mach_code.xml
+++ /dev/null
@@ -1,33 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/C5/testproject/src/main/res/layout/content_base.xml b/C5/testproject/src/main/res/layout/content_base.xml
deleted file mode 100644
index eeb3458..0000000
--- a/C5/testproject/src/main/res/layout/content_base.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-
-
-
-
-
-
-
-
diff --git a/C5/testproject/src/main/res/layout/content_font_size_actity.xml b/C5/testproject/src/main/res/layout/content_font_size_actity.xml
deleted file mode 100644
index 13cbf57..0000000
--- a/C5/testproject/src/main/res/layout/content_font_size_actity.xml
+++ /dev/null
@@ -1,152 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/C5/testproject/src/main/res/layout/content_modify_mach_code.xml b/C5/testproject/src/main/res/layout/content_modify_mach_code.xml
deleted file mode 100644
index 32d913b..0000000
--- a/C5/testproject/src/main/res/layout/content_modify_mach_code.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
-
-
-
-
-
-
diff --git a/C5/testproject/src/main/res/mipmap-hdpi/ic_launcher.png b/C5/testproject/src/main/res/mipmap-hdpi/ic_launcher.png
deleted file mode 100644
index cde69bc..0000000
--- a/C5/testproject/src/main/res/mipmap-hdpi/ic_launcher.png
+++ /dev/null
diff --git a/C5/testproject/src/main/res/mipmap-hdpi/ic_launcher_round.png b/C5/testproject/src/main/res/mipmap-hdpi/ic_launcher_round.png
deleted file mode 100644
index 9a078e3..0000000
--- a/C5/testproject/src/main/res/mipmap-hdpi/ic_launcher_round.png
+++ /dev/null
diff --git a/C5/testproject/src/main/res/mipmap-mdpi/ic_launcher.png b/C5/testproject/src/main/res/mipmap-mdpi/ic_launcher.png
deleted file mode 100644
index c133a0c..0000000
--- a/C5/testproject/src/main/res/mipmap-mdpi/ic_launcher.png
+++ /dev/null
diff --git a/C5/testproject/src/main/res/mipmap-mdpi/ic_launcher_round.png b/C5/testproject/src/main/res/mipmap-mdpi/ic_launcher_round.png
deleted file mode 100644
index efc028a..0000000
--- a/C5/testproject/src/main/res/mipmap-mdpi/ic_launcher_round.png
+++ /dev/null
diff --git a/C5/testproject/src/main/res/mipmap-xhdpi/ic_launcher.png b/C5/testproject/src/main/res/mipmap-xhdpi/ic_launcher.png
deleted file mode 100644
index bfa42f0..0000000
--- a/C5/testproject/src/main/res/mipmap-xhdpi/ic_launcher.png
+++ /dev/null
diff --git a/C5/testproject/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/C5/testproject/src/main/res/mipmap-xhdpi/ic_launcher_round.png
deleted file mode 100644
index 3af2608..0000000
--- a/C5/testproject/src/main/res/mipmap-xhdpi/ic_launcher_round.png
+++ /dev/null
diff --git a/C5/testproject/src/main/res/mipmap-xxhdpi/ic_launcher.png b/C5/testproject/src/main/res/mipmap-xxhdpi/ic_launcher.png
deleted file mode 100644
index 324e72c..0000000
--- a/C5/testproject/src/main/res/mipmap-xxhdpi/ic_launcher.png
+++ /dev/null
diff --git a/C5/testproject/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/C5/testproject/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
deleted file mode 100644
index 9bec2e6..0000000
--- a/C5/testproject/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
+++ /dev/null
diff --git a/C5/testproject/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/C5/testproject/src/main/res/mipmap-xxxhdpi/ic_launcher.png
deleted file mode 100644
index aee44e1..0000000
--- a/C5/testproject/src/main/res/mipmap-xxxhdpi/ic_launcher.png
+++ /dev/null
diff --git a/C5/testproject/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/C5/testproject/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
deleted file mode 100644
index 34947cd..0000000
--- a/C5/testproject/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
+++ /dev/null
diff --git a/C5/testproject/src/main/res/values/colors.xml b/C5/testproject/src/main/res/values/colors.xml
deleted file mode 100644
index 0ae036b..0000000
--- a/C5/testproject/src/main/res/values/colors.xml
+++ /dev/null
@@ -1,165 +0,0 @@
-
-
-
-
-
-
- #00000000
- #00000000
- #00000000
-
- #009fd3
- #e0e0e0
- #08c308
- #ff0000
-
- #FFFFFF
- #FFFFF0
- #FFFFE0
- #FFFF00
- #FFFAFA
- #FFFAF0
- #FFFACD
- #FFF8DC
- #FFF5EE
- #FFF0F5
- #FFEFD5
- #FFEBCD
- #FFE4E1
- #FFE4C4
- #FFE4B5
- #FFDEAD
- #FFDAB9
- #FFD700
- #FFC0CB
- #FFB6C1
- #FFA500
- #FFA07A
- #FF8C00
- #FF7F50
- #FF69B4
- #FF6347
- #FF4500
- #FF1493
- #FF00FF
- #FF00FF
- #FF0000
- #FDF5E6
- #FAFAD2
- #FAF0E6
- #FAEBD7
- #FA8072
- #F8F8FF
- #F5FFFA
- #F5F5F5
- #F5F5DC
- #F5DEB3
- #F4A460
- #F0FFFF
- #F0FFF0
- #F0F8FF
- #F0E68C
- #F08080
- #EEE8AA
- #EE82EE
- #E9967A
- #E6E6FA
- #E0FFFF
- #DEB887
- #DDA0DD
- #DCDCDC
- #DC143C
- #DB7093
- #DAA520
- #DA70D6
- #D8BFD8
- #D3D3D3
- #D3D3D3
- #D2B48C
- #D2691E
- #CD853F
- #CD5C5C
- #C71585
- #C0C0C0
- #BDB76B
- #BC8F8F
- #BA55D3
- #B8860B
- #B22222
- #B0E0E6
- #B0C4DE
- #AFEEEE
- #ADFF2F
- #ADD8E6
- #A9A9A9
- #A9A9A9
- #A52A2A
- #A0522D
- #9932CC
- #98FB98
- #9400D3
- #9370DB
- #90EE90
- #8FBC8F
- #8B4513
- #8B008B
- #8B0000
- #8A2BE2
- #87CEFA
- #87CEEB
- #808080
- #808080
- #808000
- #800080
- #800000
- #7FFFD4
- #7FFF00
- #7CFC00
- #7B68EE
- #778899
- #778899
- #708090
- #708090
- #6B8E23
- #6A5ACD
- #696969
- #696969
- #66CDAA
- #6495ED
- #5F9EA0
- #556B2F
- #4B0082
- #48D1CC
- #483D8B
- #4682B4
- #4169E1
- #40E0D0
- #3CB371
- #32CD32
- #2F4F4F
- #2F4F4F
- #2E8B57
- #228B22
- #20B2AA
- #1E90FF
- #191970
- #00FFFF
- #00FFFF
- #00FF7F
- #00FF00
- #00FA9A
- #00CED1
- #00BFFF
- #008B8B
- #008080
- #008000
- #006400
- #0000FF
- #0000CD
- #00008B
- #000080
- #000000
-
-
\ No newline at end of file
diff --git a/C5/testproject/src/main/res/values/dimens.xml b/C5/testproject/src/main/res/values/dimens.xml
deleted file mode 100644
index 9098f96..0000000
--- a/C5/testproject/src/main/res/values/dimens.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-
- 16dp
-
- 50sp
- 30sp
- 22sp
- 18sp
- 14sp
- 10sp
-
-
- 10sp
- 12sp
- 14sp
- 16sp
- 18sp
- 20sp
- 22sp
- 24sp
- 26sp
- 28sp
- 30sp
- 32sp
- 34sp
- 36sp
- 38sp
- 40sp
- 45sp
- 50sp
-
diff --git a/C5/testproject/src/main/res/values/strings.xml b/C5/testproject/src/main/res/values/strings.xml
deleted file mode 100644
index accff86..0000000
--- a/C5/testproject/src/main/res/values/strings.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-
- 测试工具
- FontSizeActity
- BaseActivity
- ModifyMachCode
- 解密
-
diff --git a/C5/testproject/src/main/res/values/styles.xml b/C5/testproject/src/main/res/values/styles.xml
deleted file mode 100644
index 545b9c6..0000000
--- a/C5/testproject/src/main/res/values/styles.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/C5/testproject/src/test/java/com/sunvote/udptest/ExampleUnitTest.java b/C5/testproject/src/test/java/com/sunvote/udptest/ExampleUnitTest.java
deleted file mode 100644
index 05d84ee..0000000
--- a/C5/testproject/src/test/java/com/sunvote/udptest/ExampleUnitTest.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package com.sunvote.udptest;
-
-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