完成的基本的页面布局,实现了通信功能

master
Tushida 2024-05-28 13:41:40 +08:00
commit bf41e2f78c
85 changed files with 2692 additions and 0 deletions

View File

@ -0,0 +1,3 @@
# Default ignored files
/shelf/
/workspace.xml

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/APP.iml" filepath="$PROJECT_DIR$/.idea/APP.iml" />
</modules>
</component>
</project>

Binary file not shown.

After

Width:  |  Height:  |  Size: 921 KiB

15
robot_android_App/APP/UPBot/.gitignore vendored Normal file
View File

@ -0,0 +1,15 @@
*.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
.cxx
local.properties

View File

@ -0,0 +1,3 @@
# Default ignored files
/shelf/
/workspace.xml

View File

@ -0,0 +1 @@
WiFiDemo

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<bytecodeTargetLevel target="11" />
</component>
</project>

View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="deploymentTargetDropDown">
<targetSelectedWithDropDown>
<Target>
<type value="QUICK_BOOT_TARGET" />
<deviceKey>
<Key>
<type value="VIRTUAL_DEVICE_PATH" />
<value value="C:\Users\Administrator\.android\avd\Nexus_5_API_30.avd" />
</Key>
</deviceKey>
</Target>
</targetSelectedWithDropDown>
<timeTargetWasSelectedWithDropDown value="2024-05-17T06:35:12.680766100Z" />
</component>
</project>

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleMigrationSettings" migrationVersion="1" />
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="testRunner" value="GRADLE" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleJvm" value="Embedded JDK" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/app" />
</set>
</option>
<option name="resolveExternalAnnotations" value="false" />
</GradleProjectSettings>
</option>
</component>
</project>

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectMigrations">
<option name="MigrateToGradleLocalJavaHome">
<set>
<option value="$PROJECT_DIR$" />
</set>
</option>
</component>
</project>

View File

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DesignSurface">
<option name="filePathToZoomLevelMap">
<map>
<entry key="..\:/SoftwareProject/APP/UPBot/app/src/main/res/layout/activity_client.xml" value="0.375" />
<entry key="..\:/SoftwareProject/APP/UPBot/app/src/main/res/layout/activity_main.xml" value="0.3242753623188406" />
<entry key="..\:/SoftwareProject/APP/UPBot/app/src/main/res/layout/activity_service.xml" value="0.25" />
<entry key="..\:/SoftwareProject/APP/UPBot/app/src/main/res/layout/activity_splash.xml" value="0.165" />
<entry key="..\:/SoftwareProject/APP/UPBot/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml" value="0.2535" />
<entry key="..\:/SoftwareProject/APP/WiFiDemo-master/app/src/main/res/layout/activity_client.xml" value="0.2509057971014493" />
<entry key="..\:/SoftwareProject/APP/WiFiDemo-master/app/src/main/res/layout/activity_esp8266_client.xml" value="0.14583333333333334" />
<entry key="..\:/SoftwareProject/APP/WiFiDemo-master/app/src/main/res/layout/activity_main.xml" value="0.2857142857142857" />
<entry key="..\:/SoftwareProject/APP/WiFiDemo-master/app/src/main/res/layout/activity_service.xml" value="0.14583333333333334" />
<entry key="..\:/SoftwareProject/APP/WiFiDemo-master/app/src/main/res/layout/activity_splash.xml" value="0.2857142857142857" />
<entry key="..\:/SoftwareProject/APP/WiFiDemo-master/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml" value="0.12571428571428572" />
</map>
</option>
</component>
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="11" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">
<option name="id" value="Android" />
</component>
</project>

View File

@ -0,0 +1 @@
/build

View File

@ -0,0 +1,38 @@
plugins {
id 'com.android.application'
}
android {
compileSdk 31
defaultConfig {
applicationId "com.example.wifidemo"
minSdk 26
targetSdk 31
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.3.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
}

View File

@ -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

View File

@ -0,0 +1,20 @@
{
"version": 3,
"artifactType": {
"type": "APK",
"kind": "Directory"
},
"applicationId": "com.example.wifidemo",
"variantName": "release",
"elements": [
{
"type": "SINGLE",
"filters": [],
"attributes": [],
"versionCode": 1,
"versionName": "1.0",
"outputFile": "app-release.apk"
}
],
"elementType": "File"
}

View File

@ -0,0 +1,26 @@
package com.example.wifidemo;
import android.content.Context;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.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.getInstrumentation().getTargetContext();
assertEquals("com.example.wifidemo", appContext.getPackageName());
}
}

View File

@ -0,0 +1,39 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.wifidemo">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
<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/Theme.WiFiDemo">
<activity
android:name=".ESP8266ClientActivity"
android:exported="false" />
<activity
android:name=".ClientActivity"
android:exported="false" />
<activity
android:name=".ServiceActivity"
android:exported="false" />
<activity android:name=".MainActivity"
android:exported="false"/>
<activity android:name=".SplashActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>

View File

@ -0,0 +1,171 @@
package com.example.wifidemo;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AppCompatActivity;
import android.annotation.SuppressLint;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.net.Socket;
public class ClientActivity extends AppCompatActivity {
private EditText ipET;
private EditText msgET;
private Button confirmBtn;
private Button sendBtn;
private ActionBar actionBar;
private Socket mSocket;
// private OutputStream mOutStream;
// private InputStream mInStream;
private SocketConnectThread socketConnectThread;
private StringBuffer stringBuffer = new StringBuffer();
private TextView msgTV;
private final String TAG="WifiDemoLogClientActivity";
@SuppressLint("HandlerLeak")
public Handler handler = new Handler(Looper.myLooper()){
@Override
public void handleMessage(Message msg) {
super.handleMessage(msg);
if (msg.what == 1){
stringBuffer.append(msg.obj);
stringBuffer.append("\n");
msgTV.setText(stringBuffer.toString());
}
}
};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_client);
actionBar = getSupportActionBar();
assert actionBar != null;
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setTitle("机器人控制");
socketConnectThread = new SocketConnectThread();
initView();
setListener();
}
private void initView() {
ipET = (EditText) findViewById(R.id.ipET);
msgET = (EditText) findViewById(R.id.msgET);
sendBtn = findViewById(R.id.btn_send);
confirmBtn = findViewById(R.id.btn_confirm);
msgTV = (TextView) findViewById(R.id.msgTV);
}
private void setListener() {
sendBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if(mSocket==null) {
Toast.makeText(ClientActivity.this, "未进行连接", Toast.LENGTH_SHORT).show();
return;
}
sendMessage(msgET.getText().toString());
}
});
confirmBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
socketConnectThread.start();
confirmBtn.setEnabled(false);//连接只点一次
}
});
}
/**
* 线
*/
class SocketConnectThread extends Thread{
public void run(){
try {
//指定ip地址和端口号
mSocket = new Socket(ipET.getText().toString(), 1989);
//获取输出流、输入流
// mOutStream = mSocket.getOutputStream();
// mInStream = mSocket.getInputStream();
} catch (Exception e) {
e.printStackTrace();
return;
}
startReader(mSocket);
}
}
/**
*
* @param msg
*/
public void sendMessage(final String msg) {
if (msg.length() == 0){
return;
}
new Thread() {
@Override
public void run() {
try {
DataOutputStream writer = new DataOutputStream(mSocket.getOutputStream());
writer.writeUTF(msg); // 写一个UTF-8的信息
} catch (IOException e) {
e.printStackTrace();
}
}
}.start();
}
/**
*
*/
private void startReader(final Socket socket) {
new Thread(){
@Override
public void run() {
DataInputStream reader;
try {
// 获取读取流
reader = new DataInputStream(socket.getInputStream());
while (true) {
// 读取数据
String msg = reader.readUTF();
Message message = new Message();
message.what = 1;
message.obj=msg;
handler.sendMessage(message);
}
} catch (IOException e) {
e.printStackTrace();
}
}
}.start();
}
@Override
protected void onDestroy() {
if(mSocket!=null){
try {
mSocket.close();
} catch (IOException e) {
e.printStackTrace();
}
}
super.onDestroy();
}
}

View File

@ -0,0 +1,152 @@
package com.example.wifidemo;
import androidx.appcompat.app.AppCompatActivity;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import android.annotation.SuppressLint;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import android.os.CountDownTimer;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.Socket;
public class ESP8266ClientActivity extends AppCompatActivity {
private String mIp;//硬件的IP
private int mPort = 5000;//硬件的端口
private EditText et_ip;//输入硬件对应的IP
private EditText et_msg;//输入要发送的消息
private Button btn_confirm;//进行连接
private Button btn_send;//发送消息
// Socket mSocket = null;//连接成功可得到的Socket
// OutputStream outputStream = null;//定义输出流
// InputStream inputStream = null;//定义输入流
private StringBuffer sb = new StringBuffer();//消息
private TextView tv_msg;//显示消息
private boolean connectFlage = true;//连接成功或连接3s后变false
private TextView connetStatusTextView;//显示连接状态
private int ShowPointSum = 0;//连接时显示 连接中.. 后面点的计数
private final String TAG = "WifiDemoLogESP8266ClientActivity";
private LocalBroadcastManager localBroadcastManager;//本地广播管理器
private MyLocalBroadcastReceiver localBroadcastReceiver;//广播接收者
private int connectingCount=0;//用来刷新 正在连接 与 正 在 连 接
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_esp8266_client);
initView();//初始化控件
setListener();//设置Button的点击事件
registerBroadcastReceiver();//广播注册
}
/**
*
*/
private void initView() {
et_ip = (EditText) findViewById(R.id.et_ipESP8266);
et_msg = (EditText) findViewById(R.id.et_msgESP8266);
btn_send = findViewById(R.id.btn_sendESP8266);
btn_confirm = findViewById(R.id.btn_confirmESP8266);
tv_msg = (TextView) findViewById(R.id.tv_msgESP8266);
connetStatusTextView = findViewById(R.id.connetStatusTV);
}
/**
* Button
*/
private void setListener() {
btn_confirm.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
btn_confirm.setEnabled(false);//防止正在连接时再次点击连接
WiFiModeUtil.connectFlage=true;
mIp = et_ip.getText().toString();//得到IP
WiFiModeUtil.connetByTCP(mIp,mPort);//进行连接
}
});
btn_send.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (WiFiModeUtil.mSocket == null) {
Toast.makeText(ESP8266ClientActivity.this, "未连接任何设备~~", Toast.LENGTH_SHORT).show();
return;
}
WiFiModeUtil.sendData(et_msg.getText().toString());//发送数据
}
});
}
@Override
protected void onDestroy() {
localBroadcastManager.unregisterReceiver(localBroadcastReceiver);//注销广播
WiFiModeUtil.closeSocketAndStream();//关闭Socket释放资源
super.onDestroy();
}
/**
* 广
*/
private void registerBroadcastReceiver() {
IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction("WiFiModeUtil.Connecting");//正在连接
intentFilter.addAction("WiFiModeUtil.Connect.Succeed");//连接成功
intentFilter.addAction("WiFiModeUtil.Connect.Fail");//连接失败
intentFilter.addAction("WiFiModeUtil.Connect.ReceiveMessage");//接收到数据
intentFilter.addAction("WiFiModeUtil.Disconnected");//接收到数据
localBroadcastReceiver = new MyLocalBroadcastReceiver();
localBroadcastManager = LocalBroadcastManager.getInstance(this);
WiFiModeUtil.localBroadcastManager=localBroadcastManager;//给WiFiModeUtil工具类中的本地广播管理器赋值
localBroadcastManager.registerReceiver(localBroadcastReceiver,intentFilter);
}
/**
* 广
*/
class MyLocalBroadcastReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
switch (intent.getAction()) {
case "WiFiModeUtil.Connecting":
connectingCount++;
if(connectingCount%2==0)
connetStatusTextView.setText("正在连接");
else
connetStatusTextView.setText("正 在 连 接");
break;
case "WiFiModeUtil.Connect.Succeed":
connetStatusTextView.setText("连接成功");
btn_confirm.setEnabled(true);
break;
case "WiFiModeUtil.Connect.Fail":
connetStatusTextView.setText("连接失败");
btn_confirm.setEnabled(true);
break;
case "WiFiModeUtil.Connect.ReceiveMessage":
tv_msg.setText(WiFiModeUtil.DataRecivice.toString());
break;
case "WiFiModeUtil.Disconnected":
tv_msg.setText("连接已断开,请重新进行连接");
break;
}
}
}
}

View File

@ -0,0 +1,76 @@
package com.example.wifidemo;
import androidx.annotation.NonNull;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;
public class MainActivity extends AppCompatActivity{
private ActionBar actionBar;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
actionBar = getSupportActionBar();
assert actionBar != null;
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setTitle("深安割草机器人");
findViewById(R.id.base_config_layout).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent=new Intent(MainActivity.this, ServiceActivity.class);
startActivity(intent);
}
});
findViewById(R.id.mowing_layout).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent=new Intent(MainActivity.this,ClientActivity.class);
startActivity(intent);
}
});
findViewById(R.id.client_mode_layout).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent=new Intent(MainActivity.this,ESP8266ClientActivity.class);
startActivity(intent);
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
if (item.getItemId() == android.R.id.home){
Toast.makeText(this,"返回上一页",Toast.LENGTH_LONG).show();
finish();
}else if (item.getItemId() == R.id.action_more){
Toast.makeText(this,"更多设置",Toast.LENGTH_LONG).show();
}
return true;
}
}

View File

@ -0,0 +1,205 @@
package com.example.wifidemo;
import androidx.appcompat.app.AppCompatActivity;
import android.annotation.SuppressLint;
import android.content.Context;
import android.net.wifi.WifiInfo;
import android.net.wifi.WifiManager;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;
public class ServiceActivity extends AppCompatActivity {
private Button clearBtn;
private Button showIPBtn;
private TextView ipTV;
private TextView msgTV;
private ServerSocket mServerSocket;
private Socket mSocket;
private StringBuffer stringBuffer = new StringBuffer();
private final String TAG = "WifiDemoLogServiceActivity";
@SuppressLint("HandlerLeak")
public Handler handler = new Handler(Looper.myLooper()) {
@Override
public void handleMessage(Message msg) {
super.handleMessage(msg);
if (msg.what == 1) {
stringBuffer.append(msg.obj);
stringBuffer.append("\n");
msgTV.setText(stringBuffer.toString());
}
}
};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_service);
initView();
setListener();
try {
mServerSocket = new ServerSocket(5000);//端口号5000
} catch (IOException e) {
e.printStackTrace();
}
//启动服务线程
SocketAcceptThread socketAcceptThread = new SocketAcceptThread();
socketAcceptThread.start();
}
/**
*
*/
private void initView() {
clearBtn = findViewById(R.id.clearBtn);
showIPBtn = findViewById(R.id.showIPBtn);
ipTV = findViewById(R.id.ipTV);
msgTV = findViewById(R.id.msgTV);
}
/**
*
*/
private void setListener() {
clearBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
stringBuffer.setLength(0);
msgTV.setText("");
}
});
showIPBtn.setOnClickListener(new View.OnClickListener() {
@SuppressLint("SetTextI18n")
@Override
public void onClick(View v) {
ipTV.setText(getLocalIpAddress(ServiceActivity.this) + ":5000");
}
});
}
/**
* 线
* Socket
*/
class SocketAcceptThread extends Thread {
@Override
public void run() {
try {
//等待客户端的连接Accept会阻塞直到建立连接
//所以需要放在子线程中运行
mSocket = mServerSocket.accept();
} catch (IOException e) {
e.printStackTrace();
return;
}
//启动消息接收线程
startReader(mSocket);
}
}
/**
* Socket
*/
private void startReader(final Socket socket) {
new Thread() {
@Override
public void run() {
DataInputStream reader;
try {
// 获取读取流
reader = new DataInputStream(socket.getInputStream());
while (true) {
// 读取数据
String msg = reader.readUTF();
Log.d(TAG, "客户端的信息:" + msg);
//告知客户端消息收到
DataOutputStream writer = new DataOutputStream(mSocket.getOutputStream());
writer.writeUTF("收到:" + msg); // 写一个UTF-8的信息
//发消息更新UI
Message message = new Message();
message.what = 1;
message.obj=msg;
handler.sendMessage(message);
}
} catch (IOException e) {
e.printStackTrace();
}
}
}.start();
}
@Override
protected void onDestroy() {
if (mServerSocket != null) {
try {
mServerSocket.close();
} catch (IOException e) {
e.printStackTrace();
}
}
if(mSocket!=null){
try {
mSocket.close();
} catch (IOException e) {
e.printStackTrace();
}
}
super.onDestroy();
}
/**
* ipip
*
* @param ipInt
* @return
*/
public static String int2ip(int ipInt) {
StringBuilder sb = new StringBuilder();
sb.append(ipInt & 0xFF).append(".");
sb.append((ipInt >> 8) & 0xFF).append(".");
sb.append((ipInt >> 16) & 0xFF).append(".");
sb.append((ipInt >> 24) & 0xFF);
return sb.toString();
}
/**
* ip
*
* @param context
* @return
*/
public static String getLocalIpAddress(Context context) {
try {
WifiManager wifiManager = (WifiManager) context
.getSystemService(Context.WIFI_SERVICE);
WifiInfo wifiInfo = wifiManager.getConnectionInfo();
int i = wifiInfo.getIpAddress();
return int2ip(i);
} catch (Exception ex) {
return " 获取IP出错鸟!!!!请保证是WIFI,或者请重新打开网络!\n" + ex.getMessage();
}
// return null;
}
}

View File

@ -0,0 +1,57 @@
package com.example.wifidemo;
import android.annotation.SuppressLint;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.view.View;
import android.view.WindowManager;
import androidx.annotation.RequiresApi;
import androidx.appcompat.app.AppCompatActivity;
@SuppressLint("CustomSplashScreen")
public class SplashActivity extends AppCompatActivity {
@RequiresApi(api = Build.VERSION_CODES.P)
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
fullScreenDisplay();
setContentView(R.layout.activity_splash);
//创建子线程
Thread mThread=new Thread(){
@Override
public void run() {
super.run();
try {
sleep(3000);//使程序休眠3秒
Intent intent=new Intent(getApplicationContext(),MainActivity.class);
startActivity(intent);
finish();
}catch (Exception e){
e.printStackTrace();
}
}
};
mThread.start();//启动线程
}
@RequiresApi(api = Build.VERSION_CODES.P)
protected void fullScreenDisplay(){
// 隐藏状态栏和ActionBar,实现全屏画面的效果
//隐藏状态栏
getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
//隐藏标题栏
getSupportActionBar().hide();
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_FULLSCREEN);
WindowManager.LayoutParams lp = getWindow().getAttributes();
// 始终允许窗口延伸到屏幕短边上的刘海区域
lp.layoutInDisplayCutoutMode = WindowManager.LayoutParams.
LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES;
getWindow().setAttributes(lp);
}
}

View File

@ -0,0 +1,260 @@
package com.example.wifidemo;
import android.annotation.SuppressLint;
import android.content.Intent;
import android.os.CountDownTimer;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.util.Log;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.Socket;
import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
/**
* 广Action:"WiFiModeUtil.Connecting"
* 广Action:"WiFiModeUtil.Connect.Fail"
* 广Action:"WiFiModeUtil.Connect.Succeed"
* 广Action:"WiFiModeUtil.Connect.ReceiveMessage"
* 广Action:"WiFiModeUtil.Disconnected"
*/
public class WiFiModeUtil {
private static String mIp;//硬件的IP
private static int mPort = 5000;//硬件的端口
public static Socket mSocket = null;//连接成功可得到的Socket
public static OutputStream outputStream = null;//定义输出流
public static InputStream inputStream = null;//定义输入流
public static StringBuffer DataRecivice = new StringBuffer();//数据
public static List<String> DataList=new ArrayList<>();//数据
public static boolean connectFlage = true;//连接成功或连接3s后变false
// private static int ShowPointSum = 0;//连接时显示 连接中.. 后面点的计数
private static final String TAG = "WifiDemoLogESP8266ClientActivity";
/**
* 广 :
* WiFiModeUtil.localBroadcastManager=localBroadcastManager;
*
*/
public static LocalBroadcastManager localBroadcastManager;
/**
* Handler
*/
@SuppressLint("HandlerLeak")
public static Handler mHandler = new Handler(Looper.myLooper()) {
@Override
public void handleMessage(Message msg) {
super.handleMessage(msg);
switch (msg.what) {
case 0://接收到数据
DataRecivice.append(msg.obj.toString());
DataRecivice.append("\n");
DataList.add(msg.obj.toString());//添加数据
Intent intent = new Intent("WiFiModeUtil.Connect.ReceiveMessage");
localBroadcastManager.sendBroadcast(intent);//发送收到数据广播
break;
case 1://连接成功
Intent intent2 = new Intent("WiFiModeUtil.Connect.Succeed");
localBroadcastManager.sendBroadcast(intent2);//发送连接成功广播
readData();//开启接收线程
connectFlage = true;
break;
case 2://连接断开
Intent intent3 = new Intent("WiFiModeUtil.Disconnected");
localBroadcastManager.sendBroadcast(intent3);//发送连接失败广播
connectFlage = true;
break;
}
}
};
/***
* 3s
* 3s
* 3s
*/
private final static CountDownTimer tcpClientCountDownTimer = new CountDownTimer(3000, 300) {
@Override
public void onTick(long millisUntilFinished) {//每隔300ms进入
if (connectFlage) {
Intent intent = new Intent("WiFiModeUtil.Connecting");
localBroadcastManager.sendBroadcast(intent);
}
}
@Override
public void onFinish() {//3s后进入(没有取消定时器的情况下)
if (connectFlage) {
connectFlage = false;//连接失败
closeSocketAndStream();
}
tcpClientCountDownTimer.cancel();//关掉定时器
Intent intent = new Intent("WiFiModeUtil.Connect.Fail");
localBroadcastManager.sendBroadcast(intent);
Log.d(TAG,"连接失败");
}
};
/**
* Socket
*/
public static void closeSocketAndStream() {
if (outputStream != null) {
try {
outputStream.close();
Log.d(TAG,"关闭输出流");
} catch (IOException e) {
e.printStackTrace();
}
outputStream = null;
}
if (inputStream != null) {
try {
inputStream.close();
Log.d(TAG,"关闭输入流");
} catch (IOException e) {
e.printStackTrace();
}
inputStream = null;
}
if (mSocket != null) {
try {
mSocket.close();
Log.d(TAG,"关闭Socket");
} catch (IOException e) {
e.printStackTrace();
}
mSocket = null;
}
}
/**
*
*/
static class ConnectSeverThread extends Thread {
@Override
public void run() {
Log.d(TAG,"连接线程开启");
while (connectFlage) {
try {
Log.d(TAG,"正在连接...");
mSocket = new Socket(mIp, mPort);//进行连接
connectFlage = false;//已连接
tcpClientCountDownTimer.cancel();//关掉计时器
/*连接成功更新显示连接状态的UI*/
Message msg = new Message();
msg.what = 1;
mHandler.sendMessage(msg);
Log.d(TAG,"连接成功");
inputStream = mSocket.getInputStream();//获取输入流
Log.d(TAG,"获取输入流");
outputStream = mSocket.getOutputStream();////获取输出流
Log.d(TAG,"获取输出流");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
Log.d(TAG,"连接过程中出错");
}
}
}
}
/**
* IPTCP
* 200ms 广
* 3 广
* 广
*
* @param IPAdress
*/
public static void connetByTCP(String IPAdress,int Port) {
mIp = IPAdress;
mPort=Port;
ConnectSeverThread connectSeverThread = new ConnectSeverThread();
connectSeverThread.start();
tcpClientCountDownTimer.start();
}
/**
*
*/
public static void sendData(String data) {
if(mSocket!=null){
byte[] sendByte = data.getBytes();
new Thread() {
@Override
public void run() {
try {
Log.d(TAG,"发送线程开启 正在发送中...");
DataOutputStream writer = new DataOutputStream(outputStream);
writer.write(sendByte, 0, sendByte.length);
Log.d(TAG,"已发送数据:"+data);
} catch (IOException e) {
e.printStackTrace();
}
Log.d(TAG,"发送线程结束");
}
}.start();
}
}
/**
*
*
*/
public static void readData() {
new Thread() {
@Override
public void run() {
Log.d(TAG,"接收线程开启");
try {
while (true) {
Thread.sleep(200);
//如果连接断开 尝试重连
try {
/*
sendUrgentData()
SocketSO_OOBINLINE
SO_OOBINLINE
*/
mSocket.sendUrgentData(0xFF);//发送1个字节的紧急数据默认情况下服务器端没有开启紧急数据处理不影响正常通信
} catch (Exception ex) {
Log.d(TAG,"连接已断开,请重新进行连接");
Message msg=new Message();
msg.what=2;
msg.obj="连接已断开,请重新进行连接";
mHandler.sendMessage(msg);
}
DataInputStream reader = new DataInputStream(inputStream);
byte[] buffer = new byte[1024];
int len;
while ((len = reader.read(buffer)) != -1) {
String data = new String(buffer, 0, len);
Log.d(TAG,"接收到数据:"+data);
Message msg = new Message();
msg.what = 0;
msg.obj = data;
mHandler.sendMessage(msg);
}
}
} catch (IOException | InterruptedException e) {
e.printStackTrace();
}
Log.d(TAG,"接收线程结束");
}
}.start();
}
}

View File

@ -0,0 +1,30 @@
<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:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">
<aapt:attr name="android:fillColor">
<gradient
android:endX="85.84757"
android:endY="92.4963"
android:startX="42.9492"
android:startY="49.59793"
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="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
android:strokeWidth="1"
android:strokeColor="#00000000" />
</vector>

Binary file not shown.

After

Width:  |  Height:  |  Size: 883 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

View File

@ -0,0 +1,5 @@
<vector android:autoMirrored="true" android:height="24dp"
android:tint="#9E8A8A" android:viewportHeight="24"
android:viewportWidth="24" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M22,3L7,3c-0.69,0 -1.23,0.35 -1.59,0.88L0,12l5.41,8.11c0.36,0.53 0.97,0.89 1.66,0.89L22,21c1.1,0 2,-0.9 2,-2L24,5c0,-1.1 -0.9,-2 -2,-2zM9,13.5c-0.83,0 -1.5,-0.67 -1.5,-1.5s0.67,-1.5 1.5,-1.5 1.5,0.67 1.5,1.5 -0.67,1.5 -1.5,1.5zM14,13.5c-0.83,0 -1.5,-0.67 -1.5,-1.5s0.67,-1.5 1.5,-1.5 1.5,0.67 1.5,1.5 -0.67,1.5 -1.5,1.5zM19,13.5c-0.83,0 -1.5,-0.67 -1.5,-1.5s0.67,-1.5 1.5,-1.5 1.5,0.67 1.5,1.5 -0.67,1.5 -1.5,1.5z"/>
</vector>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

View File

@ -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="#3DDC84"
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>

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 484 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

@ -0,0 +1,4 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#FFFFFF"/> <!-- 纯白色背景 -->
<corners android:radius="10dp"/> <!-- 设置圆角半径,可以根据需要调整 -->
</shape>

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<solid android:color="#FF66AA"/>
<stroke android:width="1dp"
android:color="#AAAAAA"/>
<corners android:radius="10dp"/>
</shape>

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#FFD700"/>
<stroke android:width="1dp"
android:color="#AAAAAA"/>
<corners android:radius="20dp"/>
</shape>

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

View File

@ -0,0 +1,222 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
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"
android:orientation="vertical"
android:background="#F0F0F0"
tools:context=".ClientActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="150dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="10dp"
android:layout_marginStart="10dp">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/rounded_corner_bg"
android:layout_marginRight="10dp"
>
<TextView
android:id="@+id/textView11"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginTop="10dp"
android:text="启动机器人"
android:textColor="#1E1E1E"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/imageView5" />
<TextView
android:id="@+id/textView12"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:text="状态:机器人已就绪"
app:layout_constraintStart_toStartOf="@+id/textView11"
app:layout_constraintTop_toBottomOf="@+id/textView11" />
<ImageView
android:id="@+id/imageView5"
android:layout_width="67dp"
android:layout_height="63dp"
android:layout_marginStart="12dp"
android:layout_marginTop="7dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/robot_start" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/rounded_corner_bg"
>
<ImageView
android:id="@+id/imageView4"
android:layout_width="80dp"
android:layout_height="63dp"
android:layout_marginStart="10dp"
android:layout_marginTop="7dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/path_plan" />
<TextView
android:id="@+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginTop="10dp"
android:text="全覆盖割草"
android:textColor="#1E1E1E"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/imageView4" />
<TextView
android:id="@+id/textView10"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:text="上次割草: 3天前"
app:layout_constraintStart_toStartOf="@+id/textView4"
app:layout_constraintTop_toBottomOf="@+id/textView4" />
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="150dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="10dp"
android:layout_marginStart="10dp">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/rounded_corner_bg"
android:layout_marginRight="10dp"
>
<TextView
android:id="@+id/tv_charge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginTop="10dp"
android:text="返回充电"
android:textColor="#1E1E1E"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/iv_charge" />
<TextView
android:id="@+id/charge_state"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:text="上次充电: 一周前"
app:layout_constraintStart_toStartOf="@+id/tv_charge"
app:layout_constraintTop_toBottomOf="@+id/tv_charge" />
<ImageView
android:id="@+id/iv_charge"
android:layout_width="67dp"
android:layout_height="63dp"
android:layout_marginStart="12dp"
android:layout_marginTop="7dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/robot_charge" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/rounded_corner_bg"
>
<ImageView
android:id="@+id/iv_lawn_patrol"
android:layout_width="80dp"
android:layout_height="63dp"
android:layout_marginStart="10dp"
android:layout_marginTop="7dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/robot_patrol" />
<TextView
android:id="@+id/tv_lawn_patrol"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginTop="10dp"
android:text="草坪巡逻"
android:textColor="#1E1E1E"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/iv_lawn_patrol" />
<TextView
android:id="@+id/tv_lawn_patrol_date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:text="上次巡逻: 1天前"
app:layout_constraintStart_toStartOf="@+id/tv_lawn_patrol"
app:layout_constraintTop_toBottomOf="@+id/tv_lawn_patrol" />
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>
<EditText
android:id="@+id/ipET"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="ip"
/>
<Button
android:id="@+id/btn_confirm"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="连接"
android:gravity="center" />
<EditText
android:id="@+id/msgET"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="msg"/>
<Button
android:id="@+id/btn_send"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="send"
android:gravity="center"
android:backgroundTint="#1E88E5"/>
<TextView
android:id="@+id/msgTV"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
</LinearLayout>

View File

@ -0,0 +1,48 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
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"
android:orientation="vertical"
tools:context=".ESP8266ClientActivity">
<EditText
android:id="@+id/et_ipESP8266"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="ip"
/>
<Button
android:id="@+id/btn_confirmESP8266"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="confirm"
android:gravity="center"
android:backgroundTint="#dddddd"/>
<EditText
android:id="@+id/et_msgESP8266"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="msg"/>
<Button
android:id="@+id/btn_sendESP8266"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="send"
android:gravity="center"
android:backgroundTint="#dddddd"/>
<TextView
android:gravity="center"
android:text="未连接"
android:layout_width="match_parent"
android:layout_height="20dp"
android:id="@+id/connetStatusTV"/>
<TextView
android:scrollbars="vertical"
android:id="@+id/tv_msgESP8266"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
</LinearLayout>

View File

@ -0,0 +1,285 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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="wrap_content"
android:layout_height="match_parent"
android:background="#F0F0F0"
android:orientation="vertical"
tools:context=".MainActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginBottom="10dp"
android:layout_weight='1'
android:background="@drawable/background" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="140dp"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
android:background="@drawable/rounded_corner_bg">
<ImageView
android:id="@+id/imageView"
android:layout_width="180dp"
android:layout_height="160dp"
android:layout_alignParentTop="true"
android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true"
android:layout_marginTop="0dp"
android:layout_marginEnd="10dp"
android:layout_marginBottom="0dp"
app:srcCompat="@drawable/robot_medium" />
<TextView
android:id="@+id/textView"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_above="@+id/imageView2"
android:layout_alignParentStart="true"
android:layout_marginStart="23dp"
android:layout_marginBottom="0dp"
android:gravity="center_vertical"
android:text="86"
android:textColor="#1E1E1E"
android:textSize="40sp"
android:textStyle="bold|italic" />
<ImageView
android:id="@+id/imageView2"
android:layout_width="50dp"
android:layout_height="25dp"
android:layout_alignParentStart="true"
android:layout_alignParentBottom="true"
android:layout_marginStart="20dp"
android:layout_marginBottom="22dp"
app:srcCompat="@drawable/battery" />
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/imageView2"
android:layout_marginStart="0dp"
android:layout_marginBottom="5dp"
android:layout_toEndOf="@+id/textView"
android:text="%"
android:textColor="#1C1B1B"
android:textSize="20sp"
android:textStyle="bold" />
<ImageView
android:id="@+id/imageView3"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginStart="20dp"
android:layout_marginTop="10dp"
app:srcCompat="@drawable/wifi" />
<ImageView
android:id="@+id/imageView6"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_alignParentTop="true"
android:layout_marginStart="10dp"
android:layout_marginTop="10dp"
android:layout_toEndOf="@+id/imageView3"
app:srcCompat="@drawable/satellite" />
<ImageView
android:id="@+id/iv_uwb_state"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_alignParentTop="true"
android:layout_marginStart="10dp"
android:layout_marginTop="10dp"
android:layout_toEndOf="@+id/imageView6"
app:srcCompat="@drawable/uwb" />
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="220dp"
android:layout_marginTop="10dp"
android:orientation="horizontal">
<LinearLayout
android:id="@+id/layout_left"
android:layout_width="180dp"
android:layout_height="match_parent"
android:layout_alignParentStart="true"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
android:layout_marginBottom="10dp"
android:layout_weight="1"
android:orientation="vertical">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/base_config_layout"
android:layout_width="match_parent"
android:layout_height="100dp"
android:background="@drawable/rounded_corner_bg">
<TextView
android:id="@+id/textView8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:text="基站配置"
android:textColor="#1E1E1E"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="@+id/imageView12"
app:layout_constraintTop_toBottomOf="@+id/imageView12" />
<TextView
android:id="@+id/textView9"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="当前共有3个基站在线"
android:textSize="10sp"
app:layout_constraintStart_toStartOf="@+id/textView8"
app:layout_constraintTop_toBottomOf="@+id/textView8" />
<ImageView
android:id="@+id/imageView12"
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_marginStart="10dp"
android:layout_marginTop="10dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/base_station" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/client_mode_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="10dp"
android:background="@drawable/rounded_corner_bg">
<TextView
android:id="@+id/textView6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="割草作业区"
android:textColor="#1E1E1E"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="@+id/imageView11"
app:layout_constraintTop_toBottomOf="@+id/imageView11" />
<TextView
android:id="@+id/textView7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="共13个区域"
android:textSize="10sp"
app:layout_constraintStart_toStartOf="@+id/textView6"
app:layout_constraintTop_toBottomOf="@+id/textView6" />
<ImageView
android:id="@+id/imageView11"
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_marginStart="10dp"
android:layout_marginTop="5dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/mowgin_working" />
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/layout_right"
android:layout_width="180dp"
android:layout_height="match_parent"
android:layout_marginEnd="10dp"
android:layout_marginBottom="10dp"
android:layout_weight="1"
android:orientation="vertical">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/mowing_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/rounded_corner_bg">
<ImageView
android:id="@+id/imageView9"
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_marginStart="10dp"
android:layout_marginTop="5dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/target" />
<TextView
android:id="@+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:text="最后作业"
android:textColor="#1E1E1E"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="@+id/imageView9"
app:layout_constraintTop_toBottomOf="@+id/imageView9" />
<TextView
android:id="@+id/tv_location"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:text="高尔夫球场"
android:textSize="10sp"
app:layout_constraintStart_toStartOf="@+id/textView3"
app:layout_constraintTop_toBottomOf="@+id/textView3" />
<ImageView
android:id="@+id/iv_mapping_history"
android:layout_width="189dp"
android:layout_height="78dp"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
android:layout_marginBottom="10dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.514"
app:layout_constraintStart_toStartOf="parent"
app:srcCompat="@drawable/mowing_mapping" />
<TextView
android:id="@+id/textView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:text="3天前"
android:textSize="8sp"
app:layout_constraintStart_toStartOf="@+id/tv_location"
app:layout_constraintTop_toBottomOf="@+id/tv_location" />
<ImageView
android:id="@+id/imageView10"
android:layout_width="10dp"
android:layout_height="10dp"
android:layout_marginEnd="20dp"
app:layout_constraintBottom_toBottomOf="@+id/textView3"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@+id/textView3"
app:srcCompat="@drawable/icon_dot" />
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>

View File

@ -0,0 +1,256 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
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"
android:orientation="vertical"
android:background="#F0F0F0"
tools:context=".ServiceActivity">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="100dp"
android:layout_marginStart="10dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="10dp"
android:background="@drawable/rounded_corner_bg">
<ImageView
android:id="@+id/imageView8"
android:layout_width="70dp"
android:layout_height="57dp"
android:layout_marginStart="15dp"
android:layout_marginTop="21dp"
android:layout_marginBottom="21dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/uwb_base_blue" />
<TextView
android:id="@+id/textView14"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:text="UWB基站 : 1号"
app:layout_constraintStart_toEndOf="@+id/imageView8"
app:layout_constraintTop_toTopOf="@+id/imageView8" />
<TextView
android:id="@+id/textView15"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="90%"
app:layout_constraintBottom_toBottomOf="@+id/imageView14"
app:layout_constraintStart_toEndOf="@+id/imageView14" />
<TextView
android:id="@+id/textView16"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:text="坐标 x:240,y:180,z:240"
android:textSize="12sp"
app:layout_constraintBottom_toBottomOf="@+id/textView15"
app:layout_constraintStart_toEndOf="@+id/textView15" />
<ImageView
android:id="@+id/imageView13"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_marginTop="32dp"
android:layout_marginEnd="12dp"
android:layout_marginBottom="32dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/setting" />
<ImageView
android:id="@+id/imageView14"
android:layout_width="23dp"
android:layout_height="21dp"
android:layout_marginStart="10dp"
android:layout_marginTop="10dp"
app:layout_constraintStart_toEndOf="@+id/imageView8"
app:layout_constraintTop_toBottomOf="@+id/textView14"
app:srcCompat="@drawable/uwb_battery" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="100dp"
android:layout_marginStart="10dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="10dp"
android:background="@drawable/rounded_corner_bg">
<ImageView
android:id="@+id/imageView82"
android:layout_width="70dp"
android:layout_height="57dp"
android:layout_marginStart="15dp"
android:layout_marginTop="21dp"
android:layout_marginBottom="21dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/uwb_base_blue" />
<TextView
android:id="@+id/textView142"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:text="UWB基站 : 2号"
app:layout_constraintStart_toEndOf="@+id/imageView82"
app:layout_constraintTop_toTopOf="@+id/imageView82" />
<TextView
android:id="@+id/textView152"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="98%"
app:layout_constraintBottom_toBottomOf="@+id/imageView142"
app:layout_constraintStart_toEndOf="@+id/imageView142" />
<TextView
android:id="@+id/textView162"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:text="坐标 x:240,y:180,z:240"
android:textSize="12sp"
app:layout_constraintBottom_toBottomOf="@+id/textView152"
app:layout_constraintStart_toEndOf="@+id/textView152" />
<ImageView
android:id="@+id/imageView132"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_marginTop="32dp"
android:layout_marginEnd="12dp"
android:layout_marginBottom="32dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/setting" />
<ImageView
android:id="@+id/imageView142"
android:layout_width="23dp"
android:layout_height="21dp"
android:layout_marginStart="10dp"
android:layout_marginTop="10dp"
app:layout_constraintStart_toEndOf="@+id/imageView82"
app:layout_constraintTop_toBottomOf="@+id/textView142"
app:srcCompat="@drawable/uwb_battery" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="100dp"
android:layout_marginEnd="10dp"
android:layout_marginStart="10dp"
android:layout_marginTop="10dp"
android:background="@drawable/rounded_corner_bg">
<ImageView
android:id="@+id/imageView83"
android:layout_width="70dp"
android:layout_height="57dp"
android:layout_marginStart="15dp"
android:layout_marginTop="21dp"
android:layout_marginBottom="21dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/uwb_base_blue" />
<TextView
android:id="@+id/textView143"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:text="UWB基站 : 3号"
app:layout_constraintStart_toEndOf="@+id/imageView83"
app:layout_constraintTop_toTopOf="@+id/imageView83" />
<TextView
android:id="@+id/textView153"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="78%"
app:layout_constraintBottom_toBottomOf="@+id/imageView143"
app:layout_constraintStart_toEndOf="@+id/imageView143" />
<TextView
android:id="@+id/textView163"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:text="坐标 x:240,y:180,z:240"
android:textSize="12sp"
app:layout_constraintBottom_toBottomOf="@+id/textView153"
app:layout_constraintStart_toEndOf="@+id/textView153" />
<ImageView
android:id="@+id/imageView133"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_marginTop="32dp"
android:layout_marginEnd="12dp"
android:layout_marginBottom="32dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/setting" />
<ImageView
android:id="@+id/imageView143"
android:layout_width="23dp"
android:layout_height="21dp"
android:layout_marginStart="10dp"
android:layout_marginTop="10dp"
app:layout_constraintStart_toEndOf="@+id/imageView83"
app:layout_constraintTop_toBottomOf="@+id/textView143"
app:srcCompat="@drawable/uwb_battery" />
</androidx.constraintlayout.widget.ConstraintLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<Button
android:id="@+id/showIPBtn"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="显示IP"
android:gravity="center"
android:padding="15dp" />
<Button
android:id="@+id/clearBtn"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="清屏"
android:gravity="center"
android:padding="15dp"
android:layout_marginLeft="5dp"/>
</LinearLayout>
<TextView
android:id="@+id/ipTV"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dp"/>
<TextView
android:id="@+id/msgTV"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="40dp"
android:layout_margin="10dp"/>
</LinearLayout>

View File

@ -0,0 +1,58 @@
<?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"
android:background="@color/white"
tools:context="SplashActivity">
<TextView
android:id="@+id/tv_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="100dp"
android:layout_marginEnd="100dp"
android:layout_marginBottom="2dp"
android:text="@string/shen_an_team"
app:layout_constraintBottom_toTopOf="@+id/textView13"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<ImageView
android:id="@+id/iv_logo"
android:layout_width="161dp"
android:layout_height="80dp"
android:src="@drawable/upbot_logo"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.37" />
<ImageView
android:id="@+id/imageView7"
android:layout_width="184dp"
android:layout_height="37dp"
android:layout_marginStart="100dp"
android:layout_marginEnd="100dp"
android:layout_marginBottom="5dp"
android:src="@drawable/logo"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<TextView
android:id="@+id/textView13"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="100dp"
android:layout_marginEnd="100dp"
android:layout_marginBottom="2dp"
android:text="@string/shen_an_team_en"
android:textSize="10sp"
app:layout_constraintBottom_toTopOf="@+id/imageView7"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -0,0 +1,8 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/action_more"
android:title="@string/more"
app:showAsAction="always"
android:icon="@drawable/baseline_more_24" />
</menu>

View File

@ -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" />
<foreground android:drawable="@drawable/ic_launcher" />
</adaptive-icon>

View File

@ -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>

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 484 KiB

View File

@ -0,0 +1,16 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Theme.WiFiDemo" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<!-- Primary brand color. -->
<item name="colorPrimary">@color/purple_200</item>
<item name="colorPrimaryVariant">@color/purple_700</item>
<item name="colorOnPrimary">@color/black</item>
<!-- Secondary brand color. -->
<item name="colorSecondary">@color/teal_200</item>
<item name="colorSecondaryVariant">@color/teal_200</item>
<item name="colorOnSecondary">@color/black</item>
<!-- Status bar color. -->
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
<!-- Customize your theme here. -->
</style>
</resources>

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="purple_200">#FFBB86FC</color>
<color name="purple_500">#FF6200EE</color>
<color name="purple_700">#FF3700B3</color>
<color name="teal_200">#FF03DAC5</color>
<color name="teal_700">#FF018786</color>
<color name="black">#FF000000</color>
<color name="white">#FFFFFFFF</color>
</resources>

View File

@ -0,0 +1,10 @@
<resources>
<string name="app_name">UPBot</string>
<string name="service">基站配置</string>
<string name="client">割草</string>
<string name="custom">设置</string>
<string name="shen_an_team">深安实验室研发出品</string>
<string name="shen_an_team_en">\@ShenAn Technology Co.,Ltd</string>
<string name="more">more\n</string>
</resources>

View File

@ -0,0 +1,16 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Theme.WiFiDemo" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<!-- Primary brand color. -->
<item name="colorPrimary">@color/purple_500</item>
<item name="colorPrimaryVariant">@color/purple_700</item>
<item name="colorOnPrimary">@color/white</item>
<!-- Secondary brand color. -->
<item name="colorSecondary">@color/teal_200</item>
<item name="colorSecondaryVariant">@color/teal_700</item>
<item name="colorOnSecondary">@color/black</item>
<!-- Status bar color. -->
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
<!-- Customize your theme here. -->
</style>
</resources>

View File

@ -0,0 +1,17 @@
package com.example.wifidemo;
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);
}
}

View File

@ -0,0 +1,17 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
mavenCentral()
}
dependencies {
classpath "com.android.tools.build:gradle:7.0.3"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}

View File

@ -0,0 +1,19 @@
# 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=-Xmx2048m -Dfile.encoding=UTF-8
# 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

Binary file not shown.

View File

@ -0,0 +1,7 @@
#Thu Mar 31 10:23:59 CST 2022
distributionBase=GRADLE_USER_HOME
distributionUrl=https://mirrors.cloud.tencent.com/gradle/gradle-7.0.2-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME

185
robot_android_App/APP/UPBot/gradlew vendored Normal file
View File

@ -0,0 +1,185 @@
#!/usr/bin/env sh
#
# Copyright 2015 the original author or authors.
#
# 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
#
# https://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.
#
##############################################################################
##
## 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='"-Xmx64m" "-Xms64m"'
# 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 or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; 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=`expr $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"
exec "$JAVACMD" "$@"

89
robot_android_App/APP/UPBot/gradlew.bat vendored Normal file
View File

@ -0,0 +1,89 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@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 Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@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="-Xmx64m" "-Xms64m"
@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 execute
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 execute
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
: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 %*
: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

View File

@ -0,0 +1,10 @@
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
jcenter() // Warning: this repository is going to shut down soon
}
}
rootProject.name = "WiFiDemo"
include ':app'