commit edbe442e9f6a1565ee6e455f080c0202e36fbe15 Author: DESKTOP-1PDT1EL\10564 <1056470187@qq.com> Date: Thu Sep 17 15:22:41 2026 +0800 x03-01/02 diff --git a/.gradle/8.10.2/checksums/checksums.lock b/.gradle/8.10.2/checksums/checksums.lock new file mode 100644 index 0000000..a83dc6b Binary files /dev/null and b/.gradle/8.10.2/checksums/checksums.lock differ diff --git a/.gradle/8.10.2/checksums/md5-checksums.bin b/.gradle/8.10.2/checksums/md5-checksums.bin new file mode 100644 index 0000000..4fce777 Binary files /dev/null and b/.gradle/8.10.2/checksums/md5-checksums.bin differ diff --git a/.gradle/8.10.2/checksums/sha1-checksums.bin b/.gradle/8.10.2/checksums/sha1-checksums.bin new file mode 100644 index 0000000..6c47c1e Binary files /dev/null and b/.gradle/8.10.2/checksums/sha1-checksums.bin differ diff --git a/.gradle/8.10.2/dependencies-accessors/gc.properties b/.gradle/8.10.2/dependencies-accessors/gc.properties new file mode 100644 index 0000000..e69de29 diff --git a/.gradle/8.10.2/executionHistory/executionHistory.bin b/.gradle/8.10.2/executionHistory/executionHistory.bin new file mode 100644 index 0000000..300e4fa Binary files /dev/null and b/.gradle/8.10.2/executionHistory/executionHistory.bin differ diff --git a/.gradle/8.10.2/executionHistory/executionHistory.lock b/.gradle/8.10.2/executionHistory/executionHistory.lock new file mode 100644 index 0000000..7c3ed7b Binary files /dev/null and b/.gradle/8.10.2/executionHistory/executionHistory.lock differ diff --git a/.gradle/8.10.2/fileChanges/last-build.bin b/.gradle/8.10.2/fileChanges/last-build.bin new file mode 100644 index 0000000..f76dd23 Binary files /dev/null and b/.gradle/8.10.2/fileChanges/last-build.bin differ diff --git a/.gradle/8.10.2/fileHashes/fileHashes.bin b/.gradle/8.10.2/fileHashes/fileHashes.bin new file mode 100644 index 0000000..8367153 Binary files /dev/null and b/.gradle/8.10.2/fileHashes/fileHashes.bin differ diff --git a/.gradle/8.10.2/fileHashes/fileHashes.lock b/.gradle/8.10.2/fileHashes/fileHashes.lock new file mode 100644 index 0000000..8db5c91 Binary files /dev/null and b/.gradle/8.10.2/fileHashes/fileHashes.lock differ diff --git a/.gradle/8.10.2/fileHashes/resourceHashesCache.bin b/.gradle/8.10.2/fileHashes/resourceHashesCache.bin new file mode 100644 index 0000000..7760186 Binary files /dev/null and b/.gradle/8.10.2/fileHashes/resourceHashesCache.bin differ diff --git a/.gradle/8.10.2/gc.properties b/.gradle/8.10.2/gc.properties new file mode 100644 index 0000000..e69de29 diff --git a/.gradle/buildOutputCleanup/buildOutputCleanup.lock b/.gradle/buildOutputCleanup/buildOutputCleanup.lock new file mode 100644 index 0000000..51d6c3e Binary files /dev/null and b/.gradle/buildOutputCleanup/buildOutputCleanup.lock differ diff --git a/.gradle/buildOutputCleanup/cache.properties b/.gradle/buildOutputCleanup/cache.properties new file mode 100644 index 0000000..cac55db --- /dev/null +++ b/.gradle/buildOutputCleanup/cache.properties @@ -0,0 +1,2 @@ +#Tue Jun 02 12:01:21 CST 2026 +gradle.version=8.10.2 diff --git a/.gradle/buildOutputCleanup/outputFiles.bin b/.gradle/buildOutputCleanup/outputFiles.bin new file mode 100644 index 0000000..eb65814 Binary files /dev/null and b/.gradle/buildOutputCleanup/outputFiles.bin differ diff --git a/.gradle/config.properties b/.gradle/config.properties new file mode 100644 index 0000000..eb16640 --- /dev/null +++ b/.gradle/config.properties @@ -0,0 +1,2 @@ +#Tue Jan 20 11:38:20 CST 2026 +java.home=D\:\\Program Files\\Android\\Android Studio\\jbr diff --git a/.gradle/file-system.probe b/.gradle/file-system.probe new file mode 100644 index 0000000..5357799 Binary files /dev/null and b/.gradle/file-system.probe differ diff --git a/.gradle/vcs-1/gc.properties b/.gradle/vcs-1/gc.properties new file mode 100644 index 0000000..e69de29 diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/.idea/.name b/.idea/.name new file mode 100644 index 0000000..c402885 --- /dev/null +++ b/.idea/.name @@ -0,0 +1 @@ +Washing02APP \ No newline at end of file diff --git a/.idea/PaintingApp.iml b/.idea/PaintingApp.iml new file mode 100644 index 0000000..d6ebd48 --- /dev/null +++ b/.idea/PaintingApp.iml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/PaintingAppV1_0.iml b/.idea/PaintingAppV1_0.iml new file mode 100644 index 0000000..d6ebd48 --- /dev/null +++ b/.idea/PaintingAppV1_0.iml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..b86273d --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/deploymentTargetDropDown.xml b/.idea/deploymentTargetDropDown.xml new file mode 100644 index 0000000..0c0c338 --- /dev/null +++ b/.idea/deploymentTargetDropDown.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/deploymentTargetSelector.xml b/.idea/deploymentTargetSelector.xml new file mode 100644 index 0000000..683d210 --- /dev/null +++ b/.idea/deploymentTargetSelector.xml @@ -0,0 +1,18 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml new file mode 100644 index 0000000..7b3006b --- /dev/null +++ b/.idea/gradle.xml @@ -0,0 +1,20 @@ + + + + + + + \ No newline at end of file diff --git a/.idea/migrations.xml b/.idea/migrations.xml new file mode 100644 index 0000000..f8051a6 --- /dev/null +++ b/.idea/migrations.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..1eb3ce8 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml new file mode 100644 index 0000000..16660f1 --- /dev/null +++ b/.idea/runConfigurations.xml @@ -0,0 +1,17 @@ + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..fc857be --- /dev/null +++ b/README.md @@ -0,0 +1,6 @@ +只有打磨模式下使用左右转检测到碰撞 回退 +26/5/28 修改状态机版本fsm_state_run(¤t_robot_move_state); +K1/2 控制大疙瘩正反转 K3控制电机上电 1上电,K4 喷漆电磁阀 1开、 K5控制喷水阀 +需要修改S1 按键为非自锁 +上电延时10s左右 包括急停恢复 再发报文 +摄像头界面可在app startvedio 函数设置画面正反 \ No newline at end of file diff --git a/app/.gitignore b/app/.gitignore new file mode 100644 index 0000000..42afabf --- /dev/null +++ b/app/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle new file mode 100644 index 0000000..b41590e --- /dev/null +++ b/app/build.gradle @@ -0,0 +1,65 @@ +plugins { + id 'com.android.application' +} + +android { + namespace 'com.example.washing02app' + compileSdk 35 + viewBinding + { + enabled true + } + // //add this feature + dataBinding + { + enabled true + } + defaultConfig { + applicationId "com.example.washing02app" + minSdk 24 + targetSdk 35 + versionCode 1 + versionName "1.0" + + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + } + android.applicationVariants.all { variant -> + variant.outputs.all { + outputFileName = "Painting.apk" + } + } + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } + } + buildFeatures{ + buildConfig true + } + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } +} + +dependencies { + + implementation 'androidx.appcompat:appcompat:1.6.1' + implementation 'androidx.constraintlayout:constraintlayout:2.1.4' + implementation 'androidx.media3:media3-exoplayer:1.5.1' + implementation 'androidx.media3:media3-ui:1.5.1' + implementation 'androidx.media3:media3-exoplayer-rtsp:1.5.1' + implementation 'com.google.android.material:material:1.12.0' + testImplementation 'junit:junit:4.13.2' + androidTestImplementation 'androidx.test.ext:junit:1.1.5' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1' + implementation 'com.github.mik3y:usb-serial-for-android:3.7.0' + implementation 'com.google.protobuf:protobuf-java:4.27.2' + implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.20") + implementation 'com.github.nodemedia:nodemediaclient-android:2.9.20' + implementation 'io.github.xmaihh:serialport:2.1.1' + + + +} \ No newline at end of file diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro new file mode 100644 index 0000000..481bb43 --- /dev/null +++ b/app/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/app/release/Painting.apk b/app/release/Painting.apk new file mode 100644 index 0000000..d26655f Binary files /dev/null and b/app/release/Painting.apk differ diff --git a/app/release/output-metadata.json b/app/release/output-metadata.json new file mode 100644 index 0000000..a4b6e36 --- /dev/null +++ b/app/release/output-metadata.json @@ -0,0 +1,20 @@ +{ + "version": 3, + "artifactType": { + "type": "APK", + "kind": "Directory" + }, + "applicationId": "com.example.paintingappv1_1", + "variantName": "release", + "elements": [ + { + "type": "SINGLE", + "filters": [], + "attributes": [], + "versionCode": 1, + "versionName": "1.0", + "outputFile": "Painting.apk" + } + ], + "elementType": "File" +} \ No newline at end of file diff --git a/app/src/androidTest/java/com/example/washing02app/ExampleInstrumentedTest.java b/app/src/androidTest/java/com/example/washing02app/ExampleInstrumentedTest.java new file mode 100644 index 0000000..8be3472 --- /dev/null +++ b/app/src/androidTest/java/com/example/washing02app/ExampleInstrumentedTest.java @@ -0,0 +1,26 @@ +package com.example.rougheningapp; + +import static org.junit.Assert.assertEquals; + +import android.content.Context; + +import androidx.test.ext.junit.runners.AndroidJUnit4; +import androidx.test.platform.app.InstrumentationRegistry; + +import org.junit.Test; +import org.junit.runner.RunWith; + +/** + * Instrumented test, which will execute on an Android device. + * + * @see Testing documentation + */ +@RunWith(AndroidJUnit4.class) +public class ExampleInstrumentedTest { + @Test + public void useAppContext() { + // Context of the app under test. + Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); + assertEquals("com.example.rougheningapp", appContext.getPackageName()); + } +} \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..aa26faa --- /dev/null +++ b/app/src/main/AndroidManifest.xml @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/java/bsp_Error.proto b/app/src/main/java/bsp_Error.proto new file mode 100644 index 0000000..513ee50 --- /dev/null +++ b/app/src/main/java/bsp_Error.proto @@ -0,0 +1,30 @@ +syntax = "proto3"; +option java_multiple_files = false; +option java_package = "com.example.washing02app.models"; +message ErrorData +{ + int32 Com_Error_Code=1; + int32 Left_Motor_Error_Code=2; + int32 Right_Motor_Error_Code=3; + +} + +enum ComError //枚举消息类型 Error Bit Define + { + MK32_SBus = 0; + TL720D = 1; + Ti5_1 = 2; + Ti5_2 = 3; + Ti5_3 = 4; + Ti5_4 = 5; + Ti5_5 = 6; + Ti5_6 = 7; + Remote_Button_Reset_State = 8; + + + } + +//protoc --nanopb_out=. *.proto + + + diff --git a/app/src/main/java/bsp_IV.proto b/app/src/main/java/bsp_IV.proto new file mode 100644 index 0000000..52958f8 --- /dev/null +++ b/app/src/main/java/bsp_IV.proto @@ -0,0 +1,25 @@ +syntax = "proto3"; + +option java_multiple_files = false; +option java_package = "com.example.washing02app.models"; + +message IV_struct_define +{ + int32 CurrentAngle= 1; //单位0.01° + int32 SBUS_State=2; //0断开 1连接 + int32 SystemError=3; //硬件通讯错误及按键未初始化错误 + + int32 LeftFrontMotor_Err=4;//左前电机报警 + int32 LeftBackMotor_Err=5;//右后电机报警 + + int32 RightFrontMotor_Err=6;//右前电机报警 + int32 RightBackMotor_Err=7;//右后电机报警 + + int32 SwingMotor_Err=8;//左摆电机报警 + int32 TiltMotor_Err=9;//伤摆电机报警 + + int32 IsWorking=10;//机器人正在执行运动指令 + int64 TimeStamp=11;//当前时间戳 + int32 IsRestart=12;//是否重启 + int32 RobotMoveSpeed=13; +}; diff --git a/app/src/main/java/bsp_PV.proto b/app/src/main/java/bsp_PV.proto new file mode 100644 index 0000000..89a1bca --- /dev/null +++ b/app/src/main/java/bsp_PV.proto @@ -0,0 +1,17 @@ +syntax = "proto3"; +option java_multiple_files = false; +option java_package = "com.example.washing02app.models"; + +message PV_struct_define{ + + // 洗舱项目 + int32 WorkMode = 1; //1 清洗 2 刷洗 3 喷漆 + int32 JointSpeed1=2; // 第一关节速度 °/s + int32 JointSpeed2= 3; // 第二关节速度 °/s + int32 ForceSet=4; // 下压力设置 + double LeftComp=5; //左行补偿 + double RightComp=6; //右行补偿 + int32 IV_IsRestart_Notified=7;// 是否接收到IV restart flag + int64 TimeStamp=8;// + +}; diff --git a/app/src/main/java/com/example/washing02app/MainActivity.java b/app/src/main/java/com/example/washing02app/MainActivity.java new file mode 100644 index 0000000..3ad6bd3 --- /dev/null +++ b/app/src/main/java/com/example/washing02app/MainActivity.java @@ -0,0 +1,514 @@ +package com.example.washing02app; + +import static com.example.washing02app.services.ReceiivedIVHandler.TIME_OUT; +import static com.example.washing02app.services.ReceiivedIVHandler.isAlarmDialogShowed; +import static com.example.washing02app.services.ReceiivedIVHandler.lastReceiveTime; +import static java.lang.Integer.parseInt; + +import android.graphics.Color; +import android.os.Bundle; +import android.os.Handler; +import android.os.Looper; +import android.text.Editable; +import android.text.InputFilter; +import android.text.TextUtils; +import android.text.TextWatcher; +import android.view.KeyEvent; +import android.view.View; +import android.view.ViewGroup; +import android.view.WindowManager; +import android.widget.Toast; + +import androidx.appcompat.app.AlertDialog; +import androidx.appcompat.app.AppCompatActivity; +import androidx.databinding.DataBindingUtil; +import androidx.media3.common.MediaItem; +import androidx.media3.exoplayer.ExoPlayer; + +import com.example.washing02app.databinding.ActivityMainBinding; +import com.example.washing02app.models.BspPV; +import com.example.washing02app.models.DisplayPV; +import com.example.washing02app.services.DecimalDigitsInputFilter; +import com.example.washing02app.services.ModbusCRC; +import com.example.washing02app.services.MyDataHelper; +import com.example.washing02app.services.PopupHelper; +import com.example.washing02app.services.ReceiivedIVHandler; +import com.example.washing02app.services.UDPHelper; +import com.example.washing02app.services.USBSerialPortHelper; +import com.example.washing02app.services.VideoPlayerHelper; + +import java.util.List; +import java.util.Timer; +import java.util.TimerTask; + +import cn.nodemedia.NodePlayer; + +public class MainActivity extends AppCompatActivity { + + public ActivityMainBinding mainBinding;//通过Binding可以获取界面数据 + //USB 串口服务 + public USBSerialPortHelper serialPortHelper; + + public static BspPV.PV_struct_define _toSendPV; + + Timer timer = new Timer(); + + public MyDataHelper myDataHelper = new MyDataHelper(this); + public PopupHelper popupHelper = new PopupHelper(this); + + public String _parameters_Call_Value = "1"; + public String _Work_Mode_Call_Value = "无"; + public int screen =0; + + //标记是否全屏 + private boolean isFullScreen = false; + //保存原始布局参数(退出全屏用) + private ViewGroup.LayoutParams originalParams; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + //设置全屏显示 + getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); + mainBinding = DataBindingUtil.setContentView(this, R.layout.activity_main); + mainBinding.editLeftCompTo32.setFilters(new InputFilter[]{new DecimalDigitsInputFilter()}); //editext 一位小数限制 + mainBinding.editRightCompTo32.setFilters(new InputFilter[]{new DecimalDigitsInputFilter()}); //editext 一位小数限制 + getWindow().clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND); + getWindow().setDimAmount(0f); + getWindow().setFlags( + WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED, + WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED + ); + /* USB串口 控制区域*/ + serialPortHelper = new USBSerialPortHelper(this); + serialPortHelper.intialize(); + serialPortHelper.connect(); + + /* NodePlayer 播放视频区域*/ + NodePlayer nodePlayer0=new NodePlayer(this); + String address0 = "rtsp://192.168.144.25:8554/main.264"; + mainBinding.nodePlayerView0.setBackgroundColor(Color.BLACK); + VideoPlayerHelper.startVedio(mainBinding.nodePlayerView0,nodePlayer0,address0); + + mainBinding.lineOverlay.setLinePosition(0.6f,0.8f); + // 保存原始宽高 + originalParams = mainBinding.nodePlayerView0.getLayoutParams(); + + // 单击切换全屏 + mainBinding.nodePlayerView0.setOnClickListener(v -> toggleFullScreen()); + + + + + timer.schedule(new TimerTask() { + @Override + public void run() { + // 使用 Handler 或 runOnUiThread 更新 UI + runOnUiThread(new Runnable() { + @Override + public void run() { + mainBinding.nodePlayerView0.setAlpha(1.0f); + // 更新 UI 的代码 + _toSendPV = BspPV.PV_struct_define.newBuilder(). + build(); + //单片机重启发1,安卓接收向单片机发送收到重启通知1,当单片机收到进而转为为 非重启状态 + if(ReceiivedIVHandler._toReceiveIV_Variable.getIsRestart()==1) + { + _toSendPV=_toSendPV.toBuilder().setIVIsRestartNotified(1).build(); + }else + { + _toSendPV=_toSendPV.toBuilder().setIVIsRestartNotified(0).build(); + } + //发送时间戳 ms + _toSendPV = _toSendPV.toBuilder().setTimeStamp(System.currentTimeMillis()).build(); + + + String jointSpeed1Str = mainBinding.jointSpeed1To32.getText().toString(); + String jointSpeed2Str = mainBinding.jointSpeed2To32.getText().toString(); + String forceSetStr = mainBinding.forceSetingTo32.getText().toString(); + String leftCompStr = mainBinding.editLeftCompTo32.getText().toString(); + String rightCompStr = mainBinding.editRightCompTo32.getText().toString(); + + //第一关节速度 + if (jointSpeed1Str.isEmpty()) { + _toSendPV = _toSendPV.toBuilder().setJointSpeed1(8).build(); + } else { + _toSendPV = _toSendPV.toBuilder() + .setJointSpeed1((Integer.parseInt(String.valueOf(mainBinding.jointSpeed1To32.getText())))).build(); + } + //第2关节速度 + if (jointSpeed2Str.isEmpty()) { + _toSendPV = _toSendPV.toBuilder().setJointSpeed2(8).build(); + } else { + _toSendPV = _toSendPV.toBuilder() + .setJointSpeed2((Integer.parseInt(String.valueOf(mainBinding.jointSpeed2To32.getText())))).build(); + } + //电流档位 + if (forceSetStr.isEmpty()) { + _toSendPV = _toSendPV.toBuilder().setForceSet(0).build(); + } else { + _toSendPV = _toSendPV.toBuilder() + .setForceSet((Integer.parseInt(String.valueOf(mainBinding.forceSetingTo32.getText())))).build(); + } + //左补偿 + try { + + if (leftCompStr.isEmpty()) { + _toSendPV = _toSendPV.toBuilder().setLeftComp(0).build(); + } else { + _toSendPV = _toSendPV.toBuilder() + .setLeftComp((int) (Double.parseDouble(String.valueOf(mainBinding.editLeftCompTo32.getText())) * 100)).build(); + + } + + } catch (Exception e) { + + } + //右补偿 + try { + + if (rightCompStr.isEmpty()) { + _toSendPV = _toSendPV.toBuilder().setRightComp(0).build(); + } else { + _toSendPV = _toSendPV.toBuilder() + .setRightComp((int) (Double.parseDouble(String.valueOf(mainBinding.editRightCompTo32.getText())) * 100)).build(); + + } + + } catch (Exception e) { + + } + + //发送作业模式值 + if (_Work_Mode_Call_Value.equals("无")) { + _toSendPV = _toSendPV.toBuilder().setWorkMode(0).build(); + } else if (_Work_Mode_Call_Value.equals("清洗")) { + _toSendPV = _toSendPV.toBuilder().setWorkMode(1).build(); + } else if (_Work_Mode_Call_Value.equals("刷洗")) { + _toSendPV = _toSendPV.toBuilder().setWorkMode(2).build(); + } + else if (_Work_Mode_Call_Value.equals("喷漆")) { + _toSendPV = _toSendPV.toBuilder().setWorkMode(3).build(); + } + + + + byte[] byteArray = _toSendPV.toByteArray(); + byte[] sendbyteArray = new byte[byteArray.length + 4]; + byte[] sendbyteArray3 = new byte[byteArray.length + 6]; + if (byteArray.length != 0) { + System.arraycopy(byteArray, 0, sendbyteArray, 4, byteArray.length); + } + sendbyteArray[0] = (byte) 0x55; + sendbyteArray[1] = (byte) 0x55; + sendbyteArray[2] = (byte) 0x01; + sendbyteArray[3] = (byte) 0x01; + + byte[] byteArray2 = ModbusCRC.calculateCRC(sendbyteArray); + + System.arraycopy(sendbyteArray, 0, sendbyteArray3, 0, sendbyteArray.length); + + System.arraycopy(byteArray2, 0, sendbyteArray3, sendbyteArray3.length - 2, 2); + + serialPortHelper.SendData(sendbyteArray3); + + } + }); + } + }, 0, 200); // 延迟 0 毫秒,每隔 1000 毫秒执行一次 + + mainBinding.btnWorkMode.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + popupHelper.WorkModePopUp(this); + } + }); + + + //setOnFocusChangeListener + mainBinding.jointSpeed1To32.setOnFocusChangeListener((v, hasFocus) -> { + // 当用户**输完离开输入框**时才检查 + if (!hasFocus) { + String input = mainBinding.jointSpeed1To32.getText().toString().trim(); + if (!input.isEmpty()) { + try { + int value = Integer.parseInt(input); + if (value < 10 || value > 30) { + showToast("请输入 10 ~ 90 之间的数字"); + // 可以清空,也可以不清空,让用户自己改 + mainBinding.jointSpeed1To32.setText(""); + } + } catch (NumberFormatException e) { + showToast("请输入有效数字"); + mainBinding.jointSpeed1To32.setText(""); + } + } + } + }); + + mainBinding.jointSpeed2To32.setOnFocusChangeListener((v, hasFocus) -> { + // 当用户**输完离开输入框**时才检查 + if (!hasFocus) { + String input = mainBinding.jointSpeed2To32.getText().toString().trim(); + if (!input.isEmpty()) { + try { + int value = Integer.parseInt(input); + if (value < 10 || value > 30) { + showToast("请输入 10 ~ 90 之间的数字"); + // 可以清空,也可以不清空,让用户自己改 + mainBinding.jointSpeed2To32.setText(""); + } + } catch (NumberFormatException e) { + showToast("请输入有效数字"); + mainBinding.jointSpeed2To32.setText(""); + } + } + } + }); + + + mainBinding.editLeftCompTo32.addTextChangedListener(new TextWatcher() { + @Override + public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) { + + } + + @Override + public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) { + + } + + @Override + public void afterTextChanged(Editable s) { + String input = s.toString().trim(); + + // 1. 允许空输入(用户正在删除) + if (TextUtils.isEmpty(input)) { + return; + } + + // 2. 允许合法的中间状态(如"-10.") + if (input.matches("^-?\\d*(\\.\\d*)?$")) { + // 合法格式:整数、负数、小数、小数点开头 + try { + + double value = Double.parseDouble(input); + // 检查输入值是否在 -50 到 100 范围内 + if (value < -10 || value > 10) { + showToast("请输入 -10 到 10 之间的数字"); + // 可以选择清除输入或限制在范围内 + mainBinding.editLeftCompTo32.setText(""); + } else { + showToast("输入有效: " + value); + } + // 尝试转换为double(处理小数) + //lastValidValue = Double.parseDouble(input); + } catch (NumberFormatException e) { + // 中间状态,忽略 + } + } + + } + + }); + + mainBinding.editRightCompTo32.addTextChangedListener(new TextWatcher() { + @Override + public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) { + + } + + @Override + public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) { + + } + + @Override + public void afterTextChanged(Editable s) { + String input = s.toString().trim(); + + // 1. 允许空输入(用户正在删除) + if (TextUtils.isEmpty(input)) { + return; + } + + // 2. 允许合法的中间状态(如"-10.") + if (input.matches("^-?\\d*(\\.\\d*)?$")) { + // 合法格式:整数、负数、小数、小数点开头 + try { + + double value = Double.parseDouble(input); + // 检查输入值是否在 -50 到 100 范围内 + if (value < -10 || value > 10) { + showToast("请输入 -10 到 10 之间的数字"); + // 可以选择清除输入或限制在范围内 + mainBinding.editRightCompTo32.setText(""); + } else { + showToast("输入有效: " + value); + } + // 尝试转换为double(处理小数) + //lastValidValue = Double.parseDouble(input); + } catch (NumberFormatException e) { + // 中间状态,忽略 + } + } + + } + + }); + + mainBinding.forceSetingTo32.addTextChangedListener(new TextWatcher() { + @Override + public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) { + + } + + @Override + public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) { + + } + + @Override + public void afterTextChanged(Editable s) { + // 文本变化后的回调,在这里进行范围检查 + String input = s.toString(); + if (!input.isEmpty()) { + try { + int value = Integer.parseInt(input); + // 检查输入值是否在 -50 到 100 范围内 + if (value < 0 || value > 8) { + showToast("请输入 0 到 8 之间的数字"); + // 可以选择清除输入或限制在范围内 + mainBinding.forceSetingTo32.setText(""); + } else { + showToast("输入有效: " + value); + } + } catch (NumberFormatException e) { + showToast("请输入有效的数字"); + } + } + + } + + }); + + mainBinding. ErrMessageBtn.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + popupHelper.RobotErrorListPopUp(this); + } + }); + mainBinding.lineChange.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + if(mainBinding.lineState.getText() == "开启") + { + mainBinding.lineState.setText("关闭"); + mainBinding.lineOverlay.setVisibility(View.GONE); + } + else{ + mainBinding.lineState.setText("开启"); + mainBinding.lineOverlay.setVisibility(View.VISIBLE); + + } + } + }); + + mainBinding.screenRotate.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + if(0 == screen) + { + mainBinding.nodePlayerView0.setRotation(180); + // VideoPlayerHelper.startVedio1(mainBinding.nodePlayerView0,nodePlayer0,address0); + screen = 1; + } + else + { + /* NodePlayer 播放视频区域*/ + mainBinding.nodePlayerView0.setRotation(0); + screen = 0; + } + } + }); + } + private void showToast(String message) + { + Toast.makeText(this, message, Toast.LENGTH_SHORT).show(); + } + + private void toggleFullScreen() { + if (!isFullScreen) { + // ---------- 进入全屏 ---------- + isFullScreen = true; + mainBinding.messageRounded.setVisibility(View.GONE); + + // 1. 隐藏状态栏、导航栏 + getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); + getWindow().getDecorView().setSystemUiVisibility( + View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | + View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY); + + // 2. 播放器铺满整个屏幕 + ViewGroup.LayoutParams params = mainBinding.nodePlayerView0.getLayoutParams(); + params.width = ViewGroup.LayoutParams.MATCH_PARENT; + params.height = ViewGroup.LayoutParams.MATCH_PARENT; + mainBinding.nodePlayerView0.setLayoutParams(params); + + } else { + // ---------- 退出全屏 ---------- + isFullScreen = false; + + mainBinding.messageRounded.setVisibility(View.VISIBLE); + // 1. 恢复状态栏、导航栏 + getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); + getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_VISIBLE); + + // 2. 恢复原来的宽高 + mainBinding.nodePlayerView0.setLayoutParams(originalParams); + } + } + + @Override + protected void onStart() { + super.onStart(); + serialPortHelper.onStart(); + + } + + @Override + public void onStop() { + serialPortHelper.onStop(); + super.onStop(); + } + + @Override + public void onResume() { + super.onResume(); + serialPortHelper.onResume(); + + } + + @Override + public void onPause() { + serialPortHelper.onPause(); + super.onPause(); + } + + @Override + protected void onDestroy() { + super.onDestroy(); + if (timer != null) { + timer.cancel(); + } + } + @Override + public boolean dispatchKeyEvent(KeyEvent event) { + if (event.getAction() == KeyEvent.ACTION_DOWN) { + // 防止View抢焦点 + mainBinding.nodePlayerView0.clearFocus(); + } + return super.dispatchKeyEvent(event); + } + +} \ No newline at end of file diff --git a/app/src/main/java/com/example/washing02app/models/BspError.java b/app/src/main/java/com/example/washing02app/models/BspError.java new file mode 100644 index 0000000..492ba79 --- /dev/null +++ b/app/src/main/java/com/example/washing02app/models/BspError.java @@ -0,0 +1,823 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: bsp_Error.proto +// Protobuf Java Version: 4.27.2 + +package com.example.washing02app.models; + +public final class BspError { + private BspError() {} + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 27, + /* patch= */ 2, + /* suffix= */ "", + BspError.class.getName()); + } + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistryLite registry) { + } + + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistry registry) { + registerAllExtensions( + (com.google.protobuf.ExtensionRegistryLite) registry); + } + /** + * Protobuf enum {@code ComError} + */ + public enum ComError + implements com.google.protobuf.ProtocolMessageEnum { + /** + * MK32_SBus = 0; + */ + MK32_SBus(0), + /** + * TL720D = 1; + */ + TL720D(1), + /** + * Ti5_1 = 2; + */ + Ti5_1(2), + /** + * Ti5_2 = 3; + */ + Ti5_2(3), + /** + * Ti5_3 = 4; + */ + Ti5_3(4), + /** + * Ti5_4 = 5; + */ + Ti5_4(5), + /** + * Ti5_5 = 6; + */ + Ti5_5(6), + /** + * Ti5_6 = 7; + */ + Ti5_6(7), + /** + * Remote_Button_Reset_State = 8; + */ + Remote_Button_Reset_State(8), + UNRECOGNIZED(-1), + ; + + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 27, + /* patch= */ 2, + /* suffix= */ "", + ComError.class.getName()); + } + /** + * MK32_SBus = 0; + */ + public static final int MK32_SBus_VALUE = 0; + /** + * TL720D = 1; + */ + public static final int TL720D_VALUE = 1; + /** + * Ti5_1 = 2; + */ + public static final int Ti5_1_VALUE = 2; + /** + * Ti5_2 = 3; + */ + public static final int Ti5_2_VALUE = 3; + /** + * Ti5_3 = 4; + */ + public static final int Ti5_3_VALUE = 4; + /** + * Ti5_4 = 5; + */ + public static final int Ti5_4_VALUE = 5; + /** + * Ti5_5 = 6; + */ + public static final int Ti5_5_VALUE = 6; + /** + * Ti5_6 = 7; + */ + public static final int Ti5_6_VALUE = 7; + /** + * Remote_Button_Reset_State = 8; + */ + public static final int Remote_Button_Reset_State_VALUE = 8; + + + public final int getNumber() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalArgumentException( + "Can't get the number of an unknown enum value."); + } + return value; + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static ComError valueOf(int value) { + return forNumber(value); + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + */ + public static ComError forNumber(int value) { + switch (value) { + case 0: return MK32_SBus; + case 1: return TL720D; + case 2: return Ti5_1; + case 3: return Ti5_2; + case 4: return Ti5_3; + case 5: return Ti5_4; + case 6: return Ti5_5; + case 7: return Ti5_6; + case 8: return Remote_Button_Reset_State; + default: return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap + internalGetValueMap() { + return internalValueMap; + } + private static final com.google.protobuf.Internal.EnumLiteMap< + ComError> internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public ComError findValueByNumber(int number) { + return ComError.forNumber(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor + getValueDescriptor() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalStateException( + "Can't get the descriptor of an unrecognized enum value."); + } + return getDescriptor().getValues().get(ordinal()); + } + public final com.google.protobuf.Descriptors.EnumDescriptor + getDescriptorForType() { + return getDescriptor(); + } + public static final com.google.protobuf.Descriptors.EnumDescriptor + getDescriptor() { + return com.example.washing02app.models.BspError.getDescriptor().getEnumTypes().get(0); + } + + private static final ComError[] VALUES = values(); + + public static ComError valueOf( + com.google.protobuf.Descriptors.EnumValueDescriptor desc) { + if (desc.getType() != getDescriptor()) { + throw new java.lang.IllegalArgumentException( + "EnumValueDescriptor is not for this type."); + } + if (desc.getIndex() == -1) { + return UNRECOGNIZED; + } + return VALUES[desc.getIndex()]; + } + + private final int value; + + private ComError(int value) { + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:ComError) + } + + public interface ErrorDataOrBuilder extends + // @@protoc_insertion_point(interface_extends:ErrorData) + com.google.protobuf.MessageOrBuilder { + + /** + * int32 Com_Error_Code = 1; + * @return The comErrorCode. + */ + int getComErrorCode(); + + /** + * int32 Left_Motor_Error_Code = 2; + * @return The leftMotorErrorCode. + */ + int getLeftMotorErrorCode(); + + /** + * int32 Right_Motor_Error_Code = 3; + * @return The rightMotorErrorCode. + */ + int getRightMotorErrorCode(); + } + /** + * Protobuf type {@code ErrorData} + */ + public static final class ErrorData extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:ErrorData) + ErrorDataOrBuilder { + private static final long serialVersionUID = 0L; + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 27, + /* patch= */ 2, + /* suffix= */ "", + ErrorData.class.getName()); + } + // Use ErrorData.newBuilder() to construct. + private ErrorData(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + private ErrorData() { + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.example.washing02app.models.BspError.internal_static_ErrorData_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.example.washing02app.models.BspError.internal_static_ErrorData_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.example.washing02app.models.BspError.ErrorData.class, com.example.washing02app.models.BspError.ErrorData.Builder.class); + } + + public static final int COM_ERROR_CODE_FIELD_NUMBER = 1; + private int comErrorCode_ = 0; + /** + * int32 Com_Error_Code = 1; + * @return The comErrorCode. + */ + @java.lang.Override + public int getComErrorCode() { + return comErrorCode_; + } + + public static final int LEFT_MOTOR_ERROR_CODE_FIELD_NUMBER = 2; + private int leftMotorErrorCode_ = 0; + /** + * int32 Left_Motor_Error_Code = 2; + * @return The leftMotorErrorCode. + */ + @java.lang.Override + public int getLeftMotorErrorCode() { + return leftMotorErrorCode_; + } + + public static final int RIGHT_MOTOR_ERROR_CODE_FIELD_NUMBER = 3; + private int rightMotorErrorCode_ = 0; + /** + * int32 Right_Motor_Error_Code = 3; + * @return The rightMotorErrorCode. + */ + @java.lang.Override + public int getRightMotorErrorCode() { + return rightMotorErrorCode_; + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (comErrorCode_ != 0) { + output.writeInt32(1, comErrorCode_); + } + if (leftMotorErrorCode_ != 0) { + output.writeInt32(2, leftMotorErrorCode_); + } + if (rightMotorErrorCode_ != 0) { + output.writeInt32(3, rightMotorErrorCode_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (comErrorCode_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(1, comErrorCode_); + } + if (leftMotorErrorCode_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(2, leftMotorErrorCode_); + } + if (rightMotorErrorCode_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(3, rightMotorErrorCode_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.example.washing02app.models.BspError.ErrorData)) { + return super.equals(obj); + } + com.example.washing02app.models.BspError.ErrorData other = (com.example.washing02app.models.BspError.ErrorData) obj; + + if (getComErrorCode() + != other.getComErrorCode()) return false; + if (getLeftMotorErrorCode() + != other.getLeftMotorErrorCode()) return false; + if (getRightMotorErrorCode() + != other.getRightMotorErrorCode()) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + COM_ERROR_CODE_FIELD_NUMBER; + hash = (53 * hash) + getComErrorCode(); + hash = (37 * hash) + LEFT_MOTOR_ERROR_CODE_FIELD_NUMBER; + hash = (53 * hash) + getLeftMotorErrorCode(); + hash = (37 * hash) + RIGHT_MOTOR_ERROR_CODE_FIELD_NUMBER; + hash = (53 * hash) + getRightMotorErrorCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.example.washing02app.models.BspError.ErrorData parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.example.washing02app.models.BspError.ErrorData parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.example.washing02app.models.BspError.ErrorData parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.example.washing02app.models.BspError.ErrorData parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.example.washing02app.models.BspError.ErrorData parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.example.washing02app.models.BspError.ErrorData parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.example.washing02app.models.BspError.ErrorData parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static com.example.washing02app.models.BspError.ErrorData parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static com.example.washing02app.models.BspError.ErrorData parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input); + } + + public static com.example.washing02app.models.BspError.ErrorData parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static com.example.washing02app.models.BspError.ErrorData parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static com.example.washing02app.models.BspError.ErrorData parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(com.example.washing02app.models.BspError.ErrorData prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code ErrorData} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder implements + // @@protoc_insertion_point(builder_implements:ErrorData) + com.example.washing02app.models.BspError.ErrorDataOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.example.washing02app.models.BspError.internal_static_ErrorData_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.example.washing02app.models.BspError.internal_static_ErrorData_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.example.washing02app.models.BspError.ErrorData.class, com.example.washing02app.models.BspError.ErrorData.Builder.class); + } + + // Construct using com.example.washing02app.models.BspError.ErrorData.newBuilder() + private Builder() { + + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + comErrorCode_ = 0; + leftMotorErrorCode_ = 0; + rightMotorErrorCode_ = 0; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.example.washing02app.models.BspError.internal_static_ErrorData_descriptor; + } + + @java.lang.Override + public com.example.washing02app.models.BspError.ErrorData getDefaultInstanceForType() { + return com.example.washing02app.models.BspError.ErrorData.getDefaultInstance(); + } + + @java.lang.Override + public com.example.washing02app.models.BspError.ErrorData build() { + com.example.washing02app.models.BspError.ErrorData result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.example.washing02app.models.BspError.ErrorData buildPartial() { + com.example.washing02app.models.BspError.ErrorData result = new com.example.washing02app.models.BspError.ErrorData(this); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartial0(com.example.washing02app.models.BspError.ErrorData result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.comErrorCode_ = comErrorCode_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.leftMotorErrorCode_ = leftMotorErrorCode_; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.rightMotorErrorCode_ = rightMotorErrorCode_; + } + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.example.washing02app.models.BspError.ErrorData) { + return mergeFrom((com.example.washing02app.models.BspError.ErrorData)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.example.washing02app.models.BspError.ErrorData other) { + if (other == com.example.washing02app.models.BspError.ErrorData.getDefaultInstance()) return this; + if (other.getComErrorCode() != 0) { + setComErrorCode(other.getComErrorCode()); + } + if (other.getLeftMotorErrorCode() != 0) { + setLeftMotorErrorCode(other.getLeftMotorErrorCode()); + } + if (other.getRightMotorErrorCode() != 0) { + setRightMotorErrorCode(other.getRightMotorErrorCode()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: { + comErrorCode_ = input.readInt32(); + bitField0_ |= 0x00000001; + break; + } // case 8 + case 16: { + leftMotorErrorCode_ = input.readInt32(); + bitField0_ |= 0x00000002; + break; + } // case 16 + case 24: { + rightMotorErrorCode_ = input.readInt32(); + bitField0_ |= 0x00000004; + break; + } // case 24 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int bitField0_; + + private int comErrorCode_ ; + /** + * int32 Com_Error_Code = 1; + * @return The comErrorCode. + */ + @java.lang.Override + public int getComErrorCode() { + return comErrorCode_; + } + /** + * int32 Com_Error_Code = 1; + * @param value The comErrorCode to set. + * @return This builder for chaining. + */ + public Builder setComErrorCode(int value) { + + comErrorCode_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * int32 Com_Error_Code = 1; + * @return This builder for chaining. + */ + public Builder clearComErrorCode() { + bitField0_ = (bitField0_ & ~0x00000001); + comErrorCode_ = 0; + onChanged(); + return this; + } + + private int leftMotorErrorCode_ ; + /** + * int32 Left_Motor_Error_Code = 2; + * @return The leftMotorErrorCode. + */ + @java.lang.Override + public int getLeftMotorErrorCode() { + return leftMotorErrorCode_; + } + /** + * int32 Left_Motor_Error_Code = 2; + * @param value The leftMotorErrorCode to set. + * @return This builder for chaining. + */ + public Builder setLeftMotorErrorCode(int value) { + + leftMotorErrorCode_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * int32 Left_Motor_Error_Code = 2; + * @return This builder for chaining. + */ + public Builder clearLeftMotorErrorCode() { + bitField0_ = (bitField0_ & ~0x00000002); + leftMotorErrorCode_ = 0; + onChanged(); + return this; + } + + private int rightMotorErrorCode_ ; + /** + * int32 Right_Motor_Error_Code = 3; + * @return The rightMotorErrorCode. + */ + @java.lang.Override + public int getRightMotorErrorCode() { + return rightMotorErrorCode_; + } + /** + * int32 Right_Motor_Error_Code = 3; + * @param value The rightMotorErrorCode to set. + * @return This builder for chaining. + */ + public Builder setRightMotorErrorCode(int value) { + + rightMotorErrorCode_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * int32 Right_Motor_Error_Code = 3; + * @return This builder for chaining. + */ + public Builder clearRightMotorErrorCode() { + bitField0_ = (bitField0_ & ~0x00000004); + rightMotorErrorCode_ = 0; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:ErrorData) + } + + // @@protoc_insertion_point(class_scope:ErrorData) + private static final com.example.washing02app.models.BspError.ErrorData DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.example.washing02app.models.BspError.ErrorData(); + } + + public static com.example.washing02app.models.BspError.ErrorData getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ErrorData parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.example.washing02app.models.BspError.ErrorData getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + + } + + private static final com.google.protobuf.Descriptors.Descriptor + internal_static_ErrorData_descriptor; + private static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_ErrorData_fieldAccessorTable; + + public static com.google.protobuf.Descriptors.FileDescriptor + getDescriptor() { + return descriptor; + } + private static com.google.protobuf.Descriptors.FileDescriptor + descriptor; + static { + java.lang.String[] descriptorData = { + "\n\017bsp_Error.proto\"b\n\tErrorData\022\026\n\016Com_Er" + + "ror_Code\030\001 \001(\005\022\035\n\025Left_Motor_Error_Code\030" + + "\002 \001(\005\022\036\n\026Right_Motor_Error_Code\030\003 \001(\005*\206\001" + + "\n\010ComError\022\r\n\tMK32_SBus\020\000\022\n\n\006TL720D\020\001\022\t\n" + + "\005Ti5_1\020\002\022\t\n\005Ti5_2\020\003\022\t\n\005Ti5_3\020\004\022\t\n\005Ti5_4\020" + + "\005\022\t\n\005Ti5_5\020\006\022\t\n\005Ti5_6\020\007\022\035\n\031Remote_Button" + + "_Reset_State\020\010B#\n\037com.example.washing02a" + + "pp.modelsP\000b\006proto3" + }; + descriptor = com.google.protobuf.Descriptors.FileDescriptor + .internalBuildGeneratedFileFrom(descriptorData, + new com.google.protobuf.Descriptors.FileDescriptor[] { + }); + internal_static_ErrorData_descriptor = + getDescriptor().getMessageTypes().get(0); + internal_static_ErrorData_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_ErrorData_descriptor, + new java.lang.String[] { "ComErrorCode", "LeftMotorErrorCode", "RightMotorErrorCode", }); + descriptor.resolveAllFeaturesImmutable(); + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/app/src/main/java/com/example/washing02app/models/BspIV.java b/app/src/main/java/com/example/washing02app/models/BspIV.java new file mode 100644 index 0000000..a39be3e --- /dev/null +++ b/app/src/main/java/com/example/washing02app/models/BspIV.java @@ -0,0 +1,1606 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: bsp_IV.proto +// Protobuf Java Version: 4.27.2 + +package com.example.washing02app.models; + +public final class BspIV { + private BspIV() {} + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 27, + /* patch= */ 2, + /* suffix= */ "", + BspIV.class.getName()); + } + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistryLite registry) { + } + + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistry registry) { + registerAllExtensions( + (com.google.protobuf.ExtensionRegistryLite) registry); + } + public interface IV_struct_defineOrBuilder extends + // @@protoc_insertion_point(interface_extends:IV_struct_define) + com.google.protobuf.MessageOrBuilder { + + /** + *
+     * 单位0.01°
+     * 
+ * + * int32 CurrentAngle = 1; + * @return The currentAngle. + */ + int getCurrentAngle(); + + /** + *
+     * 0断开 1连接
+     * 
+ * + * int32 SBUS_State = 2; + * @return The sBUSState. + */ + int getSBUSState(); + + /** + *
+     * 硬件通讯错误及按键未初始化错误
+     * 
+ * + * int32 SystemError = 3; + * @return The systemError. + */ + int getSystemError(); + + /** + *
+     * 左前电机报警
+     * 
+ * + * int32 LeftFrontMotor_Err = 4; + * @return The leftFrontMotorErr. + */ + int getLeftFrontMotorErr(); + + /** + *
+     * 右后电机报警
+     * 
+ * + * int32 LeftBackMotor_Err = 5; + * @return The leftBackMotorErr. + */ + int getLeftBackMotorErr(); + + /** + *
+     * 右前电机报警
+     * 
+ * + * int32 RightFrontMotor_Err = 6; + * @return The rightFrontMotorErr. + */ + int getRightFrontMotorErr(); + + /** + *
+     * 右后电机报警
+     * 
+ * + * int32 RightBackMotor_Err = 7; + * @return The rightBackMotorErr. + */ + int getRightBackMotorErr(); + + /** + *
+     * 左摆电机报警
+     * 
+ * + * int32 SwingMotor_Err = 8; + * @return The swingMotorErr. + */ + int getSwingMotorErr(); + + /** + *
+     * 伤摆电机报警
+     * 
+ * + * int32 TiltMotor_Err = 9; + * @return The tiltMotorErr. + */ + int getTiltMotorErr(); + + /** + *
+     * 机器人正在执行运动指令
+     * 
+ * + * int32 IsWorking = 10; + * @return The isWorking. + */ + int getIsWorking(); + + /** + *
+     * 当前时间戳
+     * 
+ * + * int64 TimeStamp = 11; + * @return The timeStamp. + */ + long getTimeStamp(); + + /** + *
+     * 是否重启
+     * 
+ * + * int32 IsRestart = 12; + * @return The isRestart. + */ + int getIsRestart(); + + /** + * int32 RobotMoveSpeed = 13; + * @return The robotMoveSpeed. + */ + int getRobotMoveSpeed(); + } + /** + * Protobuf type {@code IV_struct_define} + */ + public static final class IV_struct_define extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:IV_struct_define) + IV_struct_defineOrBuilder { + private static final long serialVersionUID = 0L; + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 27, + /* patch= */ 2, + /* suffix= */ "", + IV_struct_define.class.getName()); + } + // Use IV_struct_define.newBuilder() to construct. + private IV_struct_define(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + private IV_struct_define() { + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.example.washing02app.models.BspIV.internal_static_IV_struct_define_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.example.washing02app.models.BspIV.internal_static_IV_struct_define_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.example.washing02app.models.BspIV.IV_struct_define.class, com.example.washing02app.models.BspIV.IV_struct_define.Builder.class); + } + + public static final int CURRENTANGLE_FIELD_NUMBER = 1; + private int currentAngle_ = 0; + /** + *
+     * 单位0.01°
+     * 
+ * + * int32 CurrentAngle = 1; + * @return The currentAngle. + */ + @java.lang.Override + public int getCurrentAngle() { + return currentAngle_; + } + + public static final int SBUS_STATE_FIELD_NUMBER = 2; + private int sBUSState_ = 0; + /** + *
+     * 0断开 1连接
+     * 
+ * + * int32 SBUS_State = 2; + * @return The sBUSState. + */ + @java.lang.Override + public int getSBUSState() { + return sBUSState_; + } + + public static final int SYSTEMERROR_FIELD_NUMBER = 3; + private int systemError_ = 0; + /** + *
+     * 硬件通讯错误及按键未初始化错误
+     * 
+ * + * int32 SystemError = 3; + * @return The systemError. + */ + @java.lang.Override + public int getSystemError() { + return systemError_; + } + + public static final int LEFTFRONTMOTOR_ERR_FIELD_NUMBER = 4; + private int leftFrontMotorErr_ = 0; + /** + *
+     * 左前电机报警
+     * 
+ * + * int32 LeftFrontMotor_Err = 4; + * @return The leftFrontMotorErr. + */ + @java.lang.Override + public int getLeftFrontMotorErr() { + return leftFrontMotorErr_; + } + + public static final int LEFTBACKMOTOR_ERR_FIELD_NUMBER = 5; + private int leftBackMotorErr_ = 0; + /** + *
+     * 右后电机报警
+     * 
+ * + * int32 LeftBackMotor_Err = 5; + * @return The leftBackMotorErr. + */ + @java.lang.Override + public int getLeftBackMotorErr() { + return leftBackMotorErr_; + } + + public static final int RIGHTFRONTMOTOR_ERR_FIELD_NUMBER = 6; + private int rightFrontMotorErr_ = 0; + /** + *
+     * 右前电机报警
+     * 
+ * + * int32 RightFrontMotor_Err = 6; + * @return The rightFrontMotorErr. + */ + @java.lang.Override + public int getRightFrontMotorErr() { + return rightFrontMotorErr_; + } + + public static final int RIGHTBACKMOTOR_ERR_FIELD_NUMBER = 7; + private int rightBackMotorErr_ = 0; + /** + *
+     * 右后电机报警
+     * 
+ * + * int32 RightBackMotor_Err = 7; + * @return The rightBackMotorErr. + */ + @java.lang.Override + public int getRightBackMotorErr() { + return rightBackMotorErr_; + } + + public static final int SWINGMOTOR_ERR_FIELD_NUMBER = 8; + private int swingMotorErr_ = 0; + /** + *
+     * 左摆电机报警
+     * 
+ * + * int32 SwingMotor_Err = 8; + * @return The swingMotorErr. + */ + @java.lang.Override + public int getSwingMotorErr() { + return swingMotorErr_; + } + + public static final int TILTMOTOR_ERR_FIELD_NUMBER = 9; + private int tiltMotorErr_ = 0; + /** + *
+     * 伤摆电机报警
+     * 
+ * + * int32 TiltMotor_Err = 9; + * @return The tiltMotorErr. + */ + @java.lang.Override + public int getTiltMotorErr() { + return tiltMotorErr_; + } + + public static final int ISWORKING_FIELD_NUMBER = 10; + private int isWorking_ = 0; + /** + *
+     * 机器人正在执行运动指令
+     * 
+ * + * int32 IsWorking = 10; + * @return The isWorking. + */ + @java.lang.Override + public int getIsWorking() { + return isWorking_; + } + + public static final int TIMESTAMP_FIELD_NUMBER = 11; + private long timeStamp_ = 0L; + /** + *
+     * 当前时间戳
+     * 
+ * + * int64 TimeStamp = 11; + * @return The timeStamp. + */ + @java.lang.Override + public long getTimeStamp() { + return timeStamp_; + } + + public static final int ISRESTART_FIELD_NUMBER = 12; + private int isRestart_ = 0; + /** + *
+     * 是否重启
+     * 
+ * + * int32 IsRestart = 12; + * @return The isRestart. + */ + @java.lang.Override + public int getIsRestart() { + return isRestart_; + } + + public static final int ROBOTMOVESPEED_FIELD_NUMBER = 13; + private int robotMoveSpeed_ = 0; + /** + * int32 RobotMoveSpeed = 13; + * @return The robotMoveSpeed. + */ + @java.lang.Override + public int getRobotMoveSpeed() { + return robotMoveSpeed_; + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (currentAngle_ != 0) { + output.writeInt32(1, currentAngle_); + } + if (sBUSState_ != 0) { + output.writeInt32(2, sBUSState_); + } + if (systemError_ != 0) { + output.writeInt32(3, systemError_); + } + if (leftFrontMotorErr_ != 0) { + output.writeInt32(4, leftFrontMotorErr_); + } + if (leftBackMotorErr_ != 0) { + output.writeInt32(5, leftBackMotorErr_); + } + if (rightFrontMotorErr_ != 0) { + output.writeInt32(6, rightFrontMotorErr_); + } + if (rightBackMotorErr_ != 0) { + output.writeInt32(7, rightBackMotorErr_); + } + if (swingMotorErr_ != 0) { + output.writeInt32(8, swingMotorErr_); + } + if (tiltMotorErr_ != 0) { + output.writeInt32(9, tiltMotorErr_); + } + if (isWorking_ != 0) { + output.writeInt32(10, isWorking_); + } + if (timeStamp_ != 0L) { + output.writeInt64(11, timeStamp_); + } + if (isRestart_ != 0) { + output.writeInt32(12, isRestart_); + } + if (robotMoveSpeed_ != 0) { + output.writeInt32(13, robotMoveSpeed_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (currentAngle_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(1, currentAngle_); + } + if (sBUSState_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(2, sBUSState_); + } + if (systemError_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(3, systemError_); + } + if (leftFrontMotorErr_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(4, leftFrontMotorErr_); + } + if (leftBackMotorErr_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(5, leftBackMotorErr_); + } + if (rightFrontMotorErr_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(6, rightFrontMotorErr_); + } + if (rightBackMotorErr_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(7, rightBackMotorErr_); + } + if (swingMotorErr_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(8, swingMotorErr_); + } + if (tiltMotorErr_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(9, tiltMotorErr_); + } + if (isWorking_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(10, isWorking_); + } + if (timeStamp_ != 0L) { + size += com.google.protobuf.CodedOutputStream + .computeInt64Size(11, timeStamp_); + } + if (isRestart_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(12, isRestart_); + } + if (robotMoveSpeed_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(13, robotMoveSpeed_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.example.washing02app.models.BspIV.IV_struct_define)) { + return super.equals(obj); + } + com.example.washing02app.models.BspIV.IV_struct_define other = (com.example.washing02app.models.BspIV.IV_struct_define) obj; + + if (getCurrentAngle() + != other.getCurrentAngle()) return false; + if (getSBUSState() + != other.getSBUSState()) return false; + if (getSystemError() + != other.getSystemError()) return false; + if (getLeftFrontMotorErr() + != other.getLeftFrontMotorErr()) return false; + if (getLeftBackMotorErr() + != other.getLeftBackMotorErr()) return false; + if (getRightFrontMotorErr() + != other.getRightFrontMotorErr()) return false; + if (getRightBackMotorErr() + != other.getRightBackMotorErr()) return false; + if (getSwingMotorErr() + != other.getSwingMotorErr()) return false; + if (getTiltMotorErr() + != other.getTiltMotorErr()) return false; + if (getIsWorking() + != other.getIsWorking()) return false; + if (getTimeStamp() + != other.getTimeStamp()) return false; + if (getIsRestart() + != other.getIsRestart()) return false; + if (getRobotMoveSpeed() + != other.getRobotMoveSpeed()) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + CURRENTANGLE_FIELD_NUMBER; + hash = (53 * hash) + getCurrentAngle(); + hash = (37 * hash) + SBUS_STATE_FIELD_NUMBER; + hash = (53 * hash) + getSBUSState(); + hash = (37 * hash) + SYSTEMERROR_FIELD_NUMBER; + hash = (53 * hash) + getSystemError(); + hash = (37 * hash) + LEFTFRONTMOTOR_ERR_FIELD_NUMBER; + hash = (53 * hash) + getLeftFrontMotorErr(); + hash = (37 * hash) + LEFTBACKMOTOR_ERR_FIELD_NUMBER; + hash = (53 * hash) + getLeftBackMotorErr(); + hash = (37 * hash) + RIGHTFRONTMOTOR_ERR_FIELD_NUMBER; + hash = (53 * hash) + getRightFrontMotorErr(); + hash = (37 * hash) + RIGHTBACKMOTOR_ERR_FIELD_NUMBER; + hash = (53 * hash) + getRightBackMotorErr(); + hash = (37 * hash) + SWINGMOTOR_ERR_FIELD_NUMBER; + hash = (53 * hash) + getSwingMotorErr(); + hash = (37 * hash) + TILTMOTOR_ERR_FIELD_NUMBER; + hash = (53 * hash) + getTiltMotorErr(); + hash = (37 * hash) + ISWORKING_FIELD_NUMBER; + hash = (53 * hash) + getIsWorking(); + hash = (37 * hash) + TIMESTAMP_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong( + getTimeStamp()); + hash = (37 * hash) + ISRESTART_FIELD_NUMBER; + hash = (53 * hash) + getIsRestart(); + hash = (37 * hash) + ROBOTMOVESPEED_FIELD_NUMBER; + hash = (53 * hash) + getRobotMoveSpeed(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.example.washing02app.models.BspIV.IV_struct_define parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.example.washing02app.models.BspIV.IV_struct_define parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.example.washing02app.models.BspIV.IV_struct_define parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.example.washing02app.models.BspIV.IV_struct_define parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.example.washing02app.models.BspIV.IV_struct_define parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.example.washing02app.models.BspIV.IV_struct_define parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.example.washing02app.models.BspIV.IV_struct_define parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static com.example.washing02app.models.BspIV.IV_struct_define parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static com.example.washing02app.models.BspIV.IV_struct_define parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input); + } + + public static com.example.washing02app.models.BspIV.IV_struct_define parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static com.example.washing02app.models.BspIV.IV_struct_define parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static com.example.washing02app.models.BspIV.IV_struct_define parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(com.example.washing02app.models.BspIV.IV_struct_define prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code IV_struct_define} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder implements + // @@protoc_insertion_point(builder_implements:IV_struct_define) + com.example.washing02app.models.BspIV.IV_struct_defineOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.example.washing02app.models.BspIV.internal_static_IV_struct_define_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.example.washing02app.models.BspIV.internal_static_IV_struct_define_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.example.washing02app.models.BspIV.IV_struct_define.class, com.example.washing02app.models.BspIV.IV_struct_define.Builder.class); + } + + // Construct using com.example.washing02app.models.BspIV.IV_struct_define.newBuilder() + private Builder() { + + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + currentAngle_ = 0; + sBUSState_ = 0; + systemError_ = 0; + leftFrontMotorErr_ = 0; + leftBackMotorErr_ = 0; + rightFrontMotorErr_ = 0; + rightBackMotorErr_ = 0; + swingMotorErr_ = 0; + tiltMotorErr_ = 0; + isWorking_ = 0; + timeStamp_ = 0L; + isRestart_ = 0; + robotMoveSpeed_ = 0; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.example.washing02app.models.BspIV.internal_static_IV_struct_define_descriptor; + } + + @java.lang.Override + public com.example.washing02app.models.BspIV.IV_struct_define getDefaultInstanceForType() { + return com.example.washing02app.models.BspIV.IV_struct_define.getDefaultInstance(); + } + + @java.lang.Override + public com.example.washing02app.models.BspIV.IV_struct_define build() { + com.example.washing02app.models.BspIV.IV_struct_define result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.example.washing02app.models.BspIV.IV_struct_define buildPartial() { + com.example.washing02app.models.BspIV.IV_struct_define result = new com.example.washing02app.models.BspIV.IV_struct_define(this); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartial0(com.example.washing02app.models.BspIV.IV_struct_define result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.currentAngle_ = currentAngle_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.sBUSState_ = sBUSState_; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.systemError_ = systemError_; + } + if (((from_bitField0_ & 0x00000008) != 0)) { + result.leftFrontMotorErr_ = leftFrontMotorErr_; + } + if (((from_bitField0_ & 0x00000010) != 0)) { + result.leftBackMotorErr_ = leftBackMotorErr_; + } + if (((from_bitField0_ & 0x00000020) != 0)) { + result.rightFrontMotorErr_ = rightFrontMotorErr_; + } + if (((from_bitField0_ & 0x00000040) != 0)) { + result.rightBackMotorErr_ = rightBackMotorErr_; + } + if (((from_bitField0_ & 0x00000080) != 0)) { + result.swingMotorErr_ = swingMotorErr_; + } + if (((from_bitField0_ & 0x00000100) != 0)) { + result.tiltMotorErr_ = tiltMotorErr_; + } + if (((from_bitField0_ & 0x00000200) != 0)) { + result.isWorking_ = isWorking_; + } + if (((from_bitField0_ & 0x00000400) != 0)) { + result.timeStamp_ = timeStamp_; + } + if (((from_bitField0_ & 0x00000800) != 0)) { + result.isRestart_ = isRestart_; + } + if (((from_bitField0_ & 0x00001000) != 0)) { + result.robotMoveSpeed_ = robotMoveSpeed_; + } + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.example.washing02app.models.BspIV.IV_struct_define) { + return mergeFrom((com.example.washing02app.models.BspIV.IV_struct_define)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.example.washing02app.models.BspIV.IV_struct_define other) { + if (other == com.example.washing02app.models.BspIV.IV_struct_define.getDefaultInstance()) return this; + if (other.getCurrentAngle() != 0) { + setCurrentAngle(other.getCurrentAngle()); + } + if (other.getSBUSState() != 0) { + setSBUSState(other.getSBUSState()); + } + if (other.getSystemError() != 0) { + setSystemError(other.getSystemError()); + } + if (other.getLeftFrontMotorErr() != 0) { + setLeftFrontMotorErr(other.getLeftFrontMotorErr()); + } + if (other.getLeftBackMotorErr() != 0) { + setLeftBackMotorErr(other.getLeftBackMotorErr()); + } + if (other.getRightFrontMotorErr() != 0) { + setRightFrontMotorErr(other.getRightFrontMotorErr()); + } + if (other.getRightBackMotorErr() != 0) { + setRightBackMotorErr(other.getRightBackMotorErr()); + } + if (other.getSwingMotorErr() != 0) { + setSwingMotorErr(other.getSwingMotorErr()); + } + if (other.getTiltMotorErr() != 0) { + setTiltMotorErr(other.getTiltMotorErr()); + } + if (other.getIsWorking() != 0) { + setIsWorking(other.getIsWorking()); + } + if (other.getTimeStamp() != 0L) { + setTimeStamp(other.getTimeStamp()); + } + if (other.getIsRestart() != 0) { + setIsRestart(other.getIsRestart()); + } + if (other.getRobotMoveSpeed() != 0) { + setRobotMoveSpeed(other.getRobotMoveSpeed()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: { + currentAngle_ = input.readInt32(); + bitField0_ |= 0x00000001; + break; + } // case 8 + case 16: { + sBUSState_ = input.readInt32(); + bitField0_ |= 0x00000002; + break; + } // case 16 + case 24: { + systemError_ = input.readInt32(); + bitField0_ |= 0x00000004; + break; + } // case 24 + case 32: { + leftFrontMotorErr_ = input.readInt32(); + bitField0_ |= 0x00000008; + break; + } // case 32 + case 40: { + leftBackMotorErr_ = input.readInt32(); + bitField0_ |= 0x00000010; + break; + } // case 40 + case 48: { + rightFrontMotorErr_ = input.readInt32(); + bitField0_ |= 0x00000020; + break; + } // case 48 + case 56: { + rightBackMotorErr_ = input.readInt32(); + bitField0_ |= 0x00000040; + break; + } // case 56 + case 64: { + swingMotorErr_ = input.readInt32(); + bitField0_ |= 0x00000080; + break; + } // case 64 + case 72: { + tiltMotorErr_ = input.readInt32(); + bitField0_ |= 0x00000100; + break; + } // case 72 + case 80: { + isWorking_ = input.readInt32(); + bitField0_ |= 0x00000200; + break; + } // case 80 + case 88: { + timeStamp_ = input.readInt64(); + bitField0_ |= 0x00000400; + break; + } // case 88 + case 96: { + isRestart_ = input.readInt32(); + bitField0_ |= 0x00000800; + break; + } // case 96 + case 104: { + robotMoveSpeed_ = input.readInt32(); + bitField0_ |= 0x00001000; + break; + } // case 104 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int bitField0_; + + private int currentAngle_ ; + /** + *
+       * 单位0.01°
+       * 
+ * + * int32 CurrentAngle = 1; + * @return The currentAngle. + */ + @java.lang.Override + public int getCurrentAngle() { + return currentAngle_; + } + /** + *
+       * 单位0.01°
+       * 
+ * + * int32 CurrentAngle = 1; + * @param value The currentAngle to set. + * @return This builder for chaining. + */ + public Builder setCurrentAngle(int value) { + + currentAngle_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + *
+       * 单位0.01°
+       * 
+ * + * int32 CurrentAngle = 1; + * @return This builder for chaining. + */ + public Builder clearCurrentAngle() { + bitField0_ = (bitField0_ & ~0x00000001); + currentAngle_ = 0; + onChanged(); + return this; + } + + private int sBUSState_ ; + /** + *
+       * 0断开 1连接
+       * 
+ * + * int32 SBUS_State = 2; + * @return The sBUSState. + */ + @java.lang.Override + public int getSBUSState() { + return sBUSState_; + } + /** + *
+       * 0断开 1连接
+       * 
+ * + * int32 SBUS_State = 2; + * @param value The sBUSState to set. + * @return This builder for chaining. + */ + public Builder setSBUSState(int value) { + + sBUSState_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + *
+       * 0断开 1连接
+       * 
+ * + * int32 SBUS_State = 2; + * @return This builder for chaining. + */ + public Builder clearSBUSState() { + bitField0_ = (bitField0_ & ~0x00000002); + sBUSState_ = 0; + onChanged(); + return this; + } + + private int systemError_ ; + /** + *
+       * 硬件通讯错误及按键未初始化错误
+       * 
+ * + * int32 SystemError = 3; + * @return The systemError. + */ + @java.lang.Override + public int getSystemError() { + return systemError_; + } + /** + *
+       * 硬件通讯错误及按键未初始化错误
+       * 
+ * + * int32 SystemError = 3; + * @param value The systemError to set. + * @return This builder for chaining. + */ + public Builder setSystemError(int value) { + + systemError_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + *
+       * 硬件通讯错误及按键未初始化错误
+       * 
+ * + * int32 SystemError = 3; + * @return This builder for chaining. + */ + public Builder clearSystemError() { + bitField0_ = (bitField0_ & ~0x00000004); + systemError_ = 0; + onChanged(); + return this; + } + + private int leftFrontMotorErr_ ; + /** + *
+       * 左前电机报警
+       * 
+ * + * int32 LeftFrontMotor_Err = 4; + * @return The leftFrontMotorErr. + */ + @java.lang.Override + public int getLeftFrontMotorErr() { + return leftFrontMotorErr_; + } + /** + *
+       * 左前电机报警
+       * 
+ * + * int32 LeftFrontMotor_Err = 4; + * @param value The leftFrontMotorErr to set. + * @return This builder for chaining. + */ + public Builder setLeftFrontMotorErr(int value) { + + leftFrontMotorErr_ = value; + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + /** + *
+       * 左前电机报警
+       * 
+ * + * int32 LeftFrontMotor_Err = 4; + * @return This builder for chaining. + */ + public Builder clearLeftFrontMotorErr() { + bitField0_ = (bitField0_ & ~0x00000008); + leftFrontMotorErr_ = 0; + onChanged(); + return this; + } + + private int leftBackMotorErr_ ; + /** + *
+       * 右后电机报警
+       * 
+ * + * int32 LeftBackMotor_Err = 5; + * @return The leftBackMotorErr. + */ + @java.lang.Override + public int getLeftBackMotorErr() { + return leftBackMotorErr_; + } + /** + *
+       * 右后电机报警
+       * 
+ * + * int32 LeftBackMotor_Err = 5; + * @param value The leftBackMotorErr to set. + * @return This builder for chaining. + */ + public Builder setLeftBackMotorErr(int value) { + + leftBackMotorErr_ = value; + bitField0_ |= 0x00000010; + onChanged(); + return this; + } + /** + *
+       * 右后电机报警
+       * 
+ * + * int32 LeftBackMotor_Err = 5; + * @return This builder for chaining. + */ + public Builder clearLeftBackMotorErr() { + bitField0_ = (bitField0_ & ~0x00000010); + leftBackMotorErr_ = 0; + onChanged(); + return this; + } + + private int rightFrontMotorErr_ ; + /** + *
+       * 右前电机报警
+       * 
+ * + * int32 RightFrontMotor_Err = 6; + * @return The rightFrontMotorErr. + */ + @java.lang.Override + public int getRightFrontMotorErr() { + return rightFrontMotorErr_; + } + /** + *
+       * 右前电机报警
+       * 
+ * + * int32 RightFrontMotor_Err = 6; + * @param value The rightFrontMotorErr to set. + * @return This builder for chaining. + */ + public Builder setRightFrontMotorErr(int value) { + + rightFrontMotorErr_ = value; + bitField0_ |= 0x00000020; + onChanged(); + return this; + } + /** + *
+       * 右前电机报警
+       * 
+ * + * int32 RightFrontMotor_Err = 6; + * @return This builder for chaining. + */ + public Builder clearRightFrontMotorErr() { + bitField0_ = (bitField0_ & ~0x00000020); + rightFrontMotorErr_ = 0; + onChanged(); + return this; + } + + private int rightBackMotorErr_ ; + /** + *
+       * 右后电机报警
+       * 
+ * + * int32 RightBackMotor_Err = 7; + * @return The rightBackMotorErr. + */ + @java.lang.Override + public int getRightBackMotorErr() { + return rightBackMotorErr_; + } + /** + *
+       * 右后电机报警
+       * 
+ * + * int32 RightBackMotor_Err = 7; + * @param value The rightBackMotorErr to set. + * @return This builder for chaining. + */ + public Builder setRightBackMotorErr(int value) { + + rightBackMotorErr_ = value; + bitField0_ |= 0x00000040; + onChanged(); + return this; + } + /** + *
+       * 右后电机报警
+       * 
+ * + * int32 RightBackMotor_Err = 7; + * @return This builder for chaining. + */ + public Builder clearRightBackMotorErr() { + bitField0_ = (bitField0_ & ~0x00000040); + rightBackMotorErr_ = 0; + onChanged(); + return this; + } + + private int swingMotorErr_ ; + /** + *
+       * 左摆电机报警
+       * 
+ * + * int32 SwingMotor_Err = 8; + * @return The swingMotorErr. + */ + @java.lang.Override + public int getSwingMotorErr() { + return swingMotorErr_; + } + /** + *
+       * 左摆电机报警
+       * 
+ * + * int32 SwingMotor_Err = 8; + * @param value The swingMotorErr to set. + * @return This builder for chaining. + */ + public Builder setSwingMotorErr(int value) { + + swingMotorErr_ = value; + bitField0_ |= 0x00000080; + onChanged(); + return this; + } + /** + *
+       * 左摆电机报警
+       * 
+ * + * int32 SwingMotor_Err = 8; + * @return This builder for chaining. + */ + public Builder clearSwingMotorErr() { + bitField0_ = (bitField0_ & ~0x00000080); + swingMotorErr_ = 0; + onChanged(); + return this; + } + + private int tiltMotorErr_ ; + /** + *
+       * 伤摆电机报警
+       * 
+ * + * int32 TiltMotor_Err = 9; + * @return The tiltMotorErr. + */ + @java.lang.Override + public int getTiltMotorErr() { + return tiltMotorErr_; + } + /** + *
+       * 伤摆电机报警
+       * 
+ * + * int32 TiltMotor_Err = 9; + * @param value The tiltMotorErr to set. + * @return This builder for chaining. + */ + public Builder setTiltMotorErr(int value) { + + tiltMotorErr_ = value; + bitField0_ |= 0x00000100; + onChanged(); + return this; + } + /** + *
+       * 伤摆电机报警
+       * 
+ * + * int32 TiltMotor_Err = 9; + * @return This builder for chaining. + */ + public Builder clearTiltMotorErr() { + bitField0_ = (bitField0_ & ~0x00000100); + tiltMotorErr_ = 0; + onChanged(); + return this; + } + + private int isWorking_ ; + /** + *
+       * 机器人正在执行运动指令
+       * 
+ * + * int32 IsWorking = 10; + * @return The isWorking. + */ + @java.lang.Override + public int getIsWorking() { + return isWorking_; + } + /** + *
+       * 机器人正在执行运动指令
+       * 
+ * + * int32 IsWorking = 10; + * @param value The isWorking to set. + * @return This builder for chaining. + */ + public Builder setIsWorking(int value) { + + isWorking_ = value; + bitField0_ |= 0x00000200; + onChanged(); + return this; + } + /** + *
+       * 机器人正在执行运动指令
+       * 
+ * + * int32 IsWorking = 10; + * @return This builder for chaining. + */ + public Builder clearIsWorking() { + bitField0_ = (bitField0_ & ~0x00000200); + isWorking_ = 0; + onChanged(); + return this; + } + + private long timeStamp_ ; + /** + *
+       * 当前时间戳
+       * 
+ * + * int64 TimeStamp = 11; + * @return The timeStamp. + */ + @java.lang.Override + public long getTimeStamp() { + return timeStamp_; + } + /** + *
+       * 当前时间戳
+       * 
+ * + * int64 TimeStamp = 11; + * @param value The timeStamp to set. + * @return This builder for chaining. + */ + public Builder setTimeStamp(long value) { + + timeStamp_ = value; + bitField0_ |= 0x00000400; + onChanged(); + return this; + } + /** + *
+       * 当前时间戳
+       * 
+ * + * int64 TimeStamp = 11; + * @return This builder for chaining. + */ + public Builder clearTimeStamp() { + bitField0_ = (bitField0_ & ~0x00000400); + timeStamp_ = 0L; + onChanged(); + return this; + } + + private int isRestart_ ; + /** + *
+       * 是否重启
+       * 
+ * + * int32 IsRestart = 12; + * @return The isRestart. + */ + @java.lang.Override + public int getIsRestart() { + return isRestart_; + } + /** + *
+       * 是否重启
+       * 
+ * + * int32 IsRestart = 12; + * @param value The isRestart to set. + * @return This builder for chaining. + */ + public Builder setIsRestart(int value) { + + isRestart_ = value; + bitField0_ |= 0x00000800; + onChanged(); + return this; + } + /** + *
+       * 是否重启
+       * 
+ * + * int32 IsRestart = 12; + * @return This builder for chaining. + */ + public Builder clearIsRestart() { + bitField0_ = (bitField0_ & ~0x00000800); + isRestart_ = 0; + onChanged(); + return this; + } + + private int robotMoveSpeed_ ; + /** + * int32 RobotMoveSpeed = 13; + * @return The robotMoveSpeed. + */ + @java.lang.Override + public int getRobotMoveSpeed() { + return robotMoveSpeed_; + } + /** + * int32 RobotMoveSpeed = 13; + * @param value The robotMoveSpeed to set. + * @return This builder for chaining. + */ + public Builder setRobotMoveSpeed(int value) { + + robotMoveSpeed_ = value; + bitField0_ |= 0x00001000; + onChanged(); + return this; + } + /** + * int32 RobotMoveSpeed = 13; + * @return This builder for chaining. + */ + public Builder clearRobotMoveSpeed() { + bitField0_ = (bitField0_ & ~0x00001000); + robotMoveSpeed_ = 0; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:IV_struct_define) + } + + // @@protoc_insertion_point(class_scope:IV_struct_define) + private static final com.example.washing02app.models.BspIV.IV_struct_define DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.example.washing02app.models.BspIV.IV_struct_define(); + } + + public static com.example.washing02app.models.BspIV.IV_struct_define getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public IV_struct_define parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.example.washing02app.models.BspIV.IV_struct_define getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + + } + + private static final com.google.protobuf.Descriptors.Descriptor + internal_static_IV_struct_define_descriptor; + private static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_IV_struct_define_fieldAccessorTable; + + public static com.google.protobuf.Descriptors.FileDescriptor + getDescriptor() { + return descriptor; + } + private static com.google.protobuf.Descriptors.FileDescriptor + descriptor; + static { + java.lang.String[] descriptorData = { + "\n\014bsp_IV.proto\"\301\002\n\020IV_struct_define\022\024\n\014C" + + "urrentAngle\030\001 \001(\005\022\022\n\nSBUS_State\030\002 \001(\005\022\023\n" + + "\013SystemError\030\003 \001(\005\022\032\n\022LeftFrontMotor_Err" + + "\030\004 \001(\005\022\031\n\021LeftBackMotor_Err\030\005 \001(\005\022\033\n\023Rig" + + "htFrontMotor_Err\030\006 \001(\005\022\032\n\022RightBackMotor" + + "_Err\030\007 \001(\005\022\026\n\016SwingMotor_Err\030\010 \001(\005\022\025\n\rTi" + + "ltMotor_Err\030\t \001(\005\022\021\n\tIsWorking\030\n \001(\005\022\021\n\t" + + "TimeStamp\030\013 \001(\003\022\021\n\tIsRestart\030\014 \001(\005\022\026\n\016Ro" + + "botMoveSpeed\030\r \001(\005B#\n\037com.example.washin" + + "g02app.modelsP\000b\006proto3" + }; + descriptor = com.google.protobuf.Descriptors.FileDescriptor + .internalBuildGeneratedFileFrom(descriptorData, + new com.google.protobuf.Descriptors.FileDescriptor[] { + }); + internal_static_IV_struct_define_descriptor = + getDescriptor().getMessageTypes().get(0); + internal_static_IV_struct_define_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_IV_struct_define_descriptor, + new java.lang.String[] { "CurrentAngle", "SBUSState", "SystemError", "LeftFrontMotorErr", "LeftBackMotorErr", "RightFrontMotorErr", "RightBackMotorErr", "SwingMotorErr", "TiltMotorErr", "IsWorking", "TimeStamp", "IsRestart", "RobotMoveSpeed", }); + descriptor.resolveAllFeaturesImmutable(); + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/app/src/main/java/com/example/washing02app/models/BspPV.java b/app/src/main/java/com/example/washing02app/models/BspPV.java new file mode 100644 index 0000000..877dabd --- /dev/null +++ b/app/src/main/java/com/example/washing02app/models/BspPV.java @@ -0,0 +1,1162 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: bsp_PV.proto +// Protobuf Java Version: 4.27.2 + +package com.example.washing02app.models; + +public final class BspPV { + private BspPV() {} + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 27, + /* patch= */ 2, + /* suffix= */ "", + BspPV.class.getName()); + } + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistryLite registry) { + } + + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistry registry) { + registerAllExtensions( + (com.google.protobuf.ExtensionRegistryLite) registry); + } + public interface PV_struct_defineOrBuilder extends + // @@protoc_insertion_point(interface_extends:PV_struct_define) + com.google.protobuf.MessageOrBuilder { + + /** + *
+     * 洗舱项目
+     * 
+ * + * int32 WorkMode = 1; + * @return The workMode. + */ + int getWorkMode(); + + /** + *
+     * 第一关节速度 °/s
+     * 
+ * + * int32 JointSpeed1 = 2; + * @return The jointSpeed1. + */ + int getJointSpeed1(); + + /** + *
+     * 第二关节速度 °/s
+     * 
+ * + * int32 JointSpeed2 = 3; + * @return The jointSpeed2. + */ + int getJointSpeed2(); + + /** + *
+     * 下压力设置
+     * 
+ * + * int32 ForceSet = 4; + * @return The forceSet. + */ + int getForceSet(); + + /** + *
+     * 左行补偿
+     * 
+ * + * double LeftComp = 5; + * @return The leftComp. + */ + double getLeftComp(); + + /** + *
+     * 右行补偿
+     * 
+ * + * double RightComp = 6; + * @return The rightComp. + */ + double getRightComp(); + + /** + *
+     * 是否接收到IV restart flag
+     * 
+ * + * int32 IV_IsRestart_Notified = 7; + * @return The iVIsRestartNotified. + */ + int getIVIsRestartNotified(); + + /** + *
+     * 
+ * + * int64 TimeStamp = 8; + * @return The timeStamp. + */ + long getTimeStamp(); + } + /** + * Protobuf type {@code PV_struct_define} + */ + public static final class PV_struct_define extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:PV_struct_define) + PV_struct_defineOrBuilder { + private static final long serialVersionUID = 0L; + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 27, + /* patch= */ 2, + /* suffix= */ "", + PV_struct_define.class.getName()); + } + // Use PV_struct_define.newBuilder() to construct. + private PV_struct_define(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + private PV_struct_define() { + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.example.washing02app.models.BspPV.internal_static_PV_struct_define_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.example.washing02app.models.BspPV.internal_static_PV_struct_define_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.example.washing02app.models.BspPV.PV_struct_define.class, com.example.washing02app.models.BspPV.PV_struct_define.Builder.class); + } + + public static final int WORKMODE_FIELD_NUMBER = 1; + private int workMode_ = 0; + /** + *
+     * 洗舱项目
+     * 
+ * + * int32 WorkMode = 1; + * @return The workMode. + */ + @java.lang.Override + public int getWorkMode() { + return workMode_; + } + + public static final int JOINTSPEED1_FIELD_NUMBER = 2; + private int jointSpeed1_ = 0; + /** + *
+     * 第一关节速度 °/s
+     * 
+ * + * int32 JointSpeed1 = 2; + * @return The jointSpeed1. + */ + @java.lang.Override + public int getJointSpeed1() { + return jointSpeed1_; + } + + public static final int JOINTSPEED2_FIELD_NUMBER = 3; + private int jointSpeed2_ = 0; + /** + *
+     * 第二关节速度 °/s
+     * 
+ * + * int32 JointSpeed2 = 3; + * @return The jointSpeed2. + */ + @java.lang.Override + public int getJointSpeed2() { + return jointSpeed2_; + } + + public static final int FORCESET_FIELD_NUMBER = 4; + private int forceSet_ = 0; + /** + *
+     * 下压力设置
+     * 
+ * + * int32 ForceSet = 4; + * @return The forceSet. + */ + @java.lang.Override + public int getForceSet() { + return forceSet_; + } + + public static final int LEFTCOMP_FIELD_NUMBER = 5; + private double leftComp_ = 0D; + /** + *
+     * 左行补偿
+     * 
+ * + * double LeftComp = 5; + * @return The leftComp. + */ + @java.lang.Override + public double getLeftComp() { + return leftComp_; + } + + public static final int RIGHTCOMP_FIELD_NUMBER = 6; + private double rightComp_ = 0D; + /** + *
+     * 右行补偿
+     * 
+ * + * double RightComp = 6; + * @return The rightComp. + */ + @java.lang.Override + public double getRightComp() { + return rightComp_; + } + + public static final int IV_ISRESTART_NOTIFIED_FIELD_NUMBER = 7; + private int iVIsRestartNotified_ = 0; + /** + *
+     * 是否接收到IV restart flag
+     * 
+ * + * int32 IV_IsRestart_Notified = 7; + * @return The iVIsRestartNotified. + */ + @java.lang.Override + public int getIVIsRestartNotified() { + return iVIsRestartNotified_; + } + + public static final int TIMESTAMP_FIELD_NUMBER = 8; + private long timeStamp_ = 0L; + /** + *
+     * 
+ * + * int64 TimeStamp = 8; + * @return The timeStamp. + */ + @java.lang.Override + public long getTimeStamp() { + return timeStamp_; + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (workMode_ != 0) { + output.writeInt32(1, workMode_); + } + if (jointSpeed1_ != 0) { + output.writeInt32(2, jointSpeed1_); + } + if (jointSpeed2_ != 0) { + output.writeInt32(3, jointSpeed2_); + } + if (forceSet_ != 0) { + output.writeInt32(4, forceSet_); + } + if (java.lang.Double.doubleToRawLongBits(leftComp_) != 0) { + output.writeDouble(5, leftComp_); + } + if (java.lang.Double.doubleToRawLongBits(rightComp_) != 0) { + output.writeDouble(6, rightComp_); + } + if (iVIsRestartNotified_ != 0) { + output.writeInt32(7, iVIsRestartNotified_); + } + if (timeStamp_ != 0L) { + output.writeInt64(8, timeStamp_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (workMode_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(1, workMode_); + } + if (jointSpeed1_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(2, jointSpeed1_); + } + if (jointSpeed2_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(3, jointSpeed2_); + } + if (forceSet_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(4, forceSet_); + } + if (java.lang.Double.doubleToRawLongBits(leftComp_) != 0) { + size += com.google.protobuf.CodedOutputStream + .computeDoubleSize(5, leftComp_); + } + if (java.lang.Double.doubleToRawLongBits(rightComp_) != 0) { + size += com.google.protobuf.CodedOutputStream + .computeDoubleSize(6, rightComp_); + } + if (iVIsRestartNotified_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(7, iVIsRestartNotified_); + } + if (timeStamp_ != 0L) { + size += com.google.protobuf.CodedOutputStream + .computeInt64Size(8, timeStamp_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.example.washing02app.models.BspPV.PV_struct_define)) { + return super.equals(obj); + } + com.example.washing02app.models.BspPV.PV_struct_define other = (com.example.washing02app.models.BspPV.PV_struct_define) obj; + + if (getWorkMode() + != other.getWorkMode()) return false; + if (getJointSpeed1() + != other.getJointSpeed1()) return false; + if (getJointSpeed2() + != other.getJointSpeed2()) return false; + if (getForceSet() + != other.getForceSet()) return false; + if (java.lang.Double.doubleToLongBits(getLeftComp()) + != java.lang.Double.doubleToLongBits( + other.getLeftComp())) return false; + if (java.lang.Double.doubleToLongBits(getRightComp()) + != java.lang.Double.doubleToLongBits( + other.getRightComp())) return false; + if (getIVIsRestartNotified() + != other.getIVIsRestartNotified()) return false; + if (getTimeStamp() + != other.getTimeStamp()) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + WORKMODE_FIELD_NUMBER; + hash = (53 * hash) + getWorkMode(); + hash = (37 * hash) + JOINTSPEED1_FIELD_NUMBER; + hash = (53 * hash) + getJointSpeed1(); + hash = (37 * hash) + JOINTSPEED2_FIELD_NUMBER; + hash = (53 * hash) + getJointSpeed2(); + hash = (37 * hash) + FORCESET_FIELD_NUMBER; + hash = (53 * hash) + getForceSet(); + hash = (37 * hash) + LEFTCOMP_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong( + java.lang.Double.doubleToLongBits(getLeftComp())); + hash = (37 * hash) + RIGHTCOMP_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong( + java.lang.Double.doubleToLongBits(getRightComp())); + hash = (37 * hash) + IV_ISRESTART_NOTIFIED_FIELD_NUMBER; + hash = (53 * hash) + getIVIsRestartNotified(); + hash = (37 * hash) + TIMESTAMP_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong( + getTimeStamp()); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.example.washing02app.models.BspPV.PV_struct_define parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.example.washing02app.models.BspPV.PV_struct_define parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.example.washing02app.models.BspPV.PV_struct_define parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.example.washing02app.models.BspPV.PV_struct_define parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.example.washing02app.models.BspPV.PV_struct_define parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.example.washing02app.models.BspPV.PV_struct_define parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.example.washing02app.models.BspPV.PV_struct_define parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static com.example.washing02app.models.BspPV.PV_struct_define parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static com.example.washing02app.models.BspPV.PV_struct_define parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input); + } + + public static com.example.washing02app.models.BspPV.PV_struct_define parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static com.example.washing02app.models.BspPV.PV_struct_define parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static com.example.washing02app.models.BspPV.PV_struct_define parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(com.example.washing02app.models.BspPV.PV_struct_define prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code PV_struct_define} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder implements + // @@protoc_insertion_point(builder_implements:PV_struct_define) + com.example.washing02app.models.BspPV.PV_struct_defineOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.example.washing02app.models.BspPV.internal_static_PV_struct_define_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.example.washing02app.models.BspPV.internal_static_PV_struct_define_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.example.washing02app.models.BspPV.PV_struct_define.class, com.example.washing02app.models.BspPV.PV_struct_define.Builder.class); + } + + // Construct using com.example.washing02app.models.BspPV.PV_struct_define.newBuilder() + private Builder() { + + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + workMode_ = 0; + jointSpeed1_ = 0; + jointSpeed2_ = 0; + forceSet_ = 0; + leftComp_ = 0D; + rightComp_ = 0D; + iVIsRestartNotified_ = 0; + timeStamp_ = 0L; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.example.washing02app.models.BspPV.internal_static_PV_struct_define_descriptor; + } + + @java.lang.Override + public com.example.washing02app.models.BspPV.PV_struct_define getDefaultInstanceForType() { + return com.example.washing02app.models.BspPV.PV_struct_define.getDefaultInstance(); + } + + @java.lang.Override + public com.example.washing02app.models.BspPV.PV_struct_define build() { + com.example.washing02app.models.BspPV.PV_struct_define result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.example.washing02app.models.BspPV.PV_struct_define buildPartial() { + com.example.washing02app.models.BspPV.PV_struct_define result = new com.example.washing02app.models.BspPV.PV_struct_define(this); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartial0(com.example.washing02app.models.BspPV.PV_struct_define result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.workMode_ = workMode_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.jointSpeed1_ = jointSpeed1_; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.jointSpeed2_ = jointSpeed2_; + } + if (((from_bitField0_ & 0x00000008) != 0)) { + result.forceSet_ = forceSet_; + } + if (((from_bitField0_ & 0x00000010) != 0)) { + result.leftComp_ = leftComp_; + } + if (((from_bitField0_ & 0x00000020) != 0)) { + result.rightComp_ = rightComp_; + } + if (((from_bitField0_ & 0x00000040) != 0)) { + result.iVIsRestartNotified_ = iVIsRestartNotified_; + } + if (((from_bitField0_ & 0x00000080) != 0)) { + result.timeStamp_ = timeStamp_; + } + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.example.washing02app.models.BspPV.PV_struct_define) { + return mergeFrom((com.example.washing02app.models.BspPV.PV_struct_define)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.example.washing02app.models.BspPV.PV_struct_define other) { + if (other == com.example.washing02app.models.BspPV.PV_struct_define.getDefaultInstance()) return this; + if (other.getWorkMode() != 0) { + setWorkMode(other.getWorkMode()); + } + if (other.getJointSpeed1() != 0) { + setJointSpeed1(other.getJointSpeed1()); + } + if (other.getJointSpeed2() != 0) { + setJointSpeed2(other.getJointSpeed2()); + } + if (other.getForceSet() != 0) { + setForceSet(other.getForceSet()); + } + if (other.getLeftComp() != 0D) { + setLeftComp(other.getLeftComp()); + } + if (other.getRightComp() != 0D) { + setRightComp(other.getRightComp()); + } + if (other.getIVIsRestartNotified() != 0) { + setIVIsRestartNotified(other.getIVIsRestartNotified()); + } + if (other.getTimeStamp() != 0L) { + setTimeStamp(other.getTimeStamp()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: { + workMode_ = input.readInt32(); + bitField0_ |= 0x00000001; + break; + } // case 8 + case 16: { + jointSpeed1_ = input.readInt32(); + bitField0_ |= 0x00000002; + break; + } // case 16 + case 24: { + jointSpeed2_ = input.readInt32(); + bitField0_ |= 0x00000004; + break; + } // case 24 + case 32: { + forceSet_ = input.readInt32(); + bitField0_ |= 0x00000008; + break; + } // case 32 + case 41: { + leftComp_ = input.readDouble(); + bitField0_ |= 0x00000010; + break; + } // case 41 + case 49: { + rightComp_ = input.readDouble(); + bitField0_ |= 0x00000020; + break; + } // case 49 + case 56: { + iVIsRestartNotified_ = input.readInt32(); + bitField0_ |= 0x00000040; + break; + } // case 56 + case 64: { + timeStamp_ = input.readInt64(); + bitField0_ |= 0x00000080; + break; + } // case 64 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int bitField0_; + + private int workMode_ ; + /** + *
+       * 洗舱项目
+       * 
+ * + * int32 WorkMode = 1; + * @return The workMode. + */ + @java.lang.Override + public int getWorkMode() { + return workMode_; + } + /** + *
+       * 洗舱项目
+       * 
+ * + * int32 WorkMode = 1; + * @param value The workMode to set. + * @return This builder for chaining. + */ + public Builder setWorkMode(int value) { + + workMode_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + *
+       * 洗舱项目
+       * 
+ * + * int32 WorkMode = 1; + * @return This builder for chaining. + */ + public Builder clearWorkMode() { + bitField0_ = (bitField0_ & ~0x00000001); + workMode_ = 0; + onChanged(); + return this; + } + + private int jointSpeed1_ ; + /** + *
+       * 第一关节速度 °/s
+       * 
+ * + * int32 JointSpeed1 = 2; + * @return The jointSpeed1. + */ + @java.lang.Override + public int getJointSpeed1() { + return jointSpeed1_; + } + /** + *
+       * 第一关节速度 °/s
+       * 
+ * + * int32 JointSpeed1 = 2; + * @param value The jointSpeed1 to set. + * @return This builder for chaining. + */ + public Builder setJointSpeed1(int value) { + + jointSpeed1_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + *
+       * 第一关节速度 °/s
+       * 
+ * + * int32 JointSpeed1 = 2; + * @return This builder for chaining. + */ + public Builder clearJointSpeed1() { + bitField0_ = (bitField0_ & ~0x00000002); + jointSpeed1_ = 0; + onChanged(); + return this; + } + + private int jointSpeed2_ ; + /** + *
+       * 第二关节速度 °/s
+       * 
+ * + * int32 JointSpeed2 = 3; + * @return The jointSpeed2. + */ + @java.lang.Override + public int getJointSpeed2() { + return jointSpeed2_; + } + /** + *
+       * 第二关节速度 °/s
+       * 
+ * + * int32 JointSpeed2 = 3; + * @param value The jointSpeed2 to set. + * @return This builder for chaining. + */ + public Builder setJointSpeed2(int value) { + + jointSpeed2_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + *
+       * 第二关节速度 °/s
+       * 
+ * + * int32 JointSpeed2 = 3; + * @return This builder for chaining. + */ + public Builder clearJointSpeed2() { + bitField0_ = (bitField0_ & ~0x00000004); + jointSpeed2_ = 0; + onChanged(); + return this; + } + + private int forceSet_ ; + /** + *
+       * 下压力设置
+       * 
+ * + * int32 ForceSet = 4; + * @return The forceSet. + */ + @java.lang.Override + public int getForceSet() { + return forceSet_; + } + /** + *
+       * 下压力设置
+       * 
+ * + * int32 ForceSet = 4; + * @param value The forceSet to set. + * @return This builder for chaining. + */ + public Builder setForceSet(int value) { + + forceSet_ = value; + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + /** + *
+       * 下压力设置
+       * 
+ * + * int32 ForceSet = 4; + * @return This builder for chaining. + */ + public Builder clearForceSet() { + bitField0_ = (bitField0_ & ~0x00000008); + forceSet_ = 0; + onChanged(); + return this; + } + + private double leftComp_ ; + /** + *
+       * 左行补偿
+       * 
+ * + * double LeftComp = 5; + * @return The leftComp. + */ + @java.lang.Override + public double getLeftComp() { + return leftComp_; + } + /** + *
+       * 左行补偿
+       * 
+ * + * double LeftComp = 5; + * @param value The leftComp to set. + * @return This builder for chaining. + */ + public Builder setLeftComp(double value) { + + leftComp_ = value; + bitField0_ |= 0x00000010; + onChanged(); + return this; + } + /** + *
+       * 左行补偿
+       * 
+ * + * double LeftComp = 5; + * @return This builder for chaining. + */ + public Builder clearLeftComp() { + bitField0_ = (bitField0_ & ~0x00000010); + leftComp_ = 0D; + onChanged(); + return this; + } + + private double rightComp_ ; + /** + *
+       * 右行补偿
+       * 
+ * + * double RightComp = 6; + * @return The rightComp. + */ + @java.lang.Override + public double getRightComp() { + return rightComp_; + } + /** + *
+       * 右行补偿
+       * 
+ * + * double RightComp = 6; + * @param value The rightComp to set. + * @return This builder for chaining. + */ + public Builder setRightComp(double value) { + + rightComp_ = value; + bitField0_ |= 0x00000020; + onChanged(); + return this; + } + /** + *
+       * 右行补偿
+       * 
+ * + * double RightComp = 6; + * @return This builder for chaining. + */ + public Builder clearRightComp() { + bitField0_ = (bitField0_ & ~0x00000020); + rightComp_ = 0D; + onChanged(); + return this; + } + + private int iVIsRestartNotified_ ; + /** + *
+       * 是否接收到IV restart flag
+       * 
+ * + * int32 IV_IsRestart_Notified = 7; + * @return The iVIsRestartNotified. + */ + @java.lang.Override + public int getIVIsRestartNotified() { + return iVIsRestartNotified_; + } + /** + *
+       * 是否接收到IV restart flag
+       * 
+ * + * int32 IV_IsRestart_Notified = 7; + * @param value The iVIsRestartNotified to set. + * @return This builder for chaining. + */ + public Builder setIVIsRestartNotified(int value) { + + iVIsRestartNotified_ = value; + bitField0_ |= 0x00000040; + onChanged(); + return this; + } + /** + *
+       * 是否接收到IV restart flag
+       * 
+ * + * int32 IV_IsRestart_Notified = 7; + * @return This builder for chaining. + */ + public Builder clearIVIsRestartNotified() { + bitField0_ = (bitField0_ & ~0x00000040); + iVIsRestartNotified_ = 0; + onChanged(); + return this; + } + + private long timeStamp_ ; + /** + *
+       * 
+ * + * int64 TimeStamp = 8; + * @return The timeStamp. + */ + @java.lang.Override + public long getTimeStamp() { + return timeStamp_; + } + /** + *
+       * 
+ * + * int64 TimeStamp = 8; + * @param value The timeStamp to set. + * @return This builder for chaining. + */ + public Builder setTimeStamp(long value) { + + timeStamp_ = value; + bitField0_ |= 0x00000080; + onChanged(); + return this; + } + /** + *
+       * 
+ * + * int64 TimeStamp = 8; + * @return This builder for chaining. + */ + public Builder clearTimeStamp() { + bitField0_ = (bitField0_ & ~0x00000080); + timeStamp_ = 0L; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:PV_struct_define) + } + + // @@protoc_insertion_point(class_scope:PV_struct_define) + private static final com.example.washing02app.models.BspPV.PV_struct_define DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.example.washing02app.models.BspPV.PV_struct_define(); + } + + public static com.example.washing02app.models.BspPV.PV_struct_define getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public PV_struct_define parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.example.washing02app.models.BspPV.PV_struct_define getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + + } + + private static final com.google.protobuf.Descriptors.Descriptor + internal_static_PV_struct_define_descriptor; + private static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_PV_struct_define_fieldAccessorTable; + + public static com.google.protobuf.Descriptors.FileDescriptor + getDescriptor() { + return descriptor; + } + private static com.google.protobuf.Descriptors.FileDescriptor + descriptor; + static { + java.lang.String[] descriptorData = { + "\n\014bsp_PV.proto\"\267\001\n\020PV_struct_define\022\020\n\010W" + + "orkMode\030\001 \001(\005\022\023\n\013JointSpeed1\030\002 \001(\005\022\023\n\013Jo" + + "intSpeed2\030\003 \001(\005\022\020\n\010ForceSet\030\004 \001(\005\022\020\n\010Lef" + + "tComp\030\005 \001(\001\022\021\n\tRightComp\030\006 \001(\001\022\035\n\025IV_IsR" + + "estart_Notified\030\007 \001(\005\022\021\n\tTimeStamp\030\010 \001(\003" + + "B#\n\037com.example.washing02app.modelsP\000b\006p" + + "roto3" + }; + descriptor = com.google.protobuf.Descriptors.FileDescriptor + .internalBuildGeneratedFileFrom(descriptorData, + new com.google.protobuf.Descriptors.FileDescriptor[] { + }); + internal_static_PV_struct_define_descriptor = + getDescriptor().getMessageTypes().get(0); + internal_static_PV_struct_define_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_PV_struct_define_descriptor, + new java.lang.String[] { "WorkMode", "JointSpeed1", "JointSpeed2", "ForceSet", "LeftComp", "RightComp", "IVIsRestartNotified", "TimeStamp", }); + descriptor.resolveAllFeaturesImmutable(); + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/app/src/main/java/com/example/washing02app/models/DisplayIV.java b/app/src/main/java/com/example/washing02app/models/DisplayIV.java new file mode 100644 index 0000000..444b7ba --- /dev/null +++ b/app/src/main/java/com/example/washing02app/models/DisplayIV.java @@ -0,0 +1,50 @@ +package com.example.washing02app.models; + +import androidx.databinding.BaseObservable; + +public class DisplayIV extends BaseObservable { + private double leftCompensation; + private double rightCompensation; + private double currentAngle; + + public double getLeftCompensation() { + return leftCompensation; + } + + public void setLeftCompensation(double leftCompensation) { + this.leftCompensation = leftCompensation; + } + + public double getRightCompensation() { + return rightCompensation; + } + + public void setRightCompensation(double rightCompensation) { + this.rightCompensation = rightCompensation; + } + + public double getCurrentAngle() { + return currentAngle; + } + + public void setCurrentAngle(double currentAngle) { + this.currentAngle = currentAngle; + } + + public double getRobotMoveSpeed() { + return robotMoveSpeed; + } + + public void setRobotMoveSpeed(double robotMoveSpeed) { + this.robotMoveSpeed = robotMoveSpeed; + } + + private double robotMoveSpeed; + + public DisplayIV(double leftCompensation, double rightCompensation, double currentAngle, double robotMoveSpeed) { + this.leftCompensation = leftCompensation; + this.rightCompensation = rightCompensation; + this.currentAngle = currentAngle; + this.robotMoveSpeed = robotMoveSpeed; + } +} diff --git a/app/src/main/java/com/example/washing02app/models/DisplayPV.java b/app/src/main/java/com/example/washing02app/models/DisplayPV.java new file mode 100644 index 0000000..3e95e0c --- /dev/null +++ b/app/src/main/java/com/example/washing02app/models/DisplayPV.java @@ -0,0 +1,38 @@ +package com.example.washing02app.models; + +import androidx.databinding.BaseObservable; + +public class DisplayPV extends BaseObservable { + + private int id; + + private int laneChangeDistance; + private double verticalAdjust; + + public DisplayPV(int id, int laneChangeDistance, double verticalAdjust) { + this.id = id; + this.laneChangeDistance=laneChangeDistance; + this.verticalAdjust=verticalAdjust; + } + + + public int getId() { return id; } + public void setId(int id) { + this.id = id; + } + + + public int getLaneChangeDistance() { + return laneChangeDistance; + } + public void setLaneChangeDistance(int laneChangeDistance) { this.laneChangeDistance = laneChangeDistance;} + + public double getVerticalAdjust(){ + return verticalAdjust; + } + public void setVerticalAdjust(int verticalAdjust) { + this.verticalAdjust = verticalAdjust; + } + + +} diff --git a/app/src/main/java/com/example/washing02app/models/ErrorModel.java b/app/src/main/java/com/example/washing02app/models/ErrorModel.java new file mode 100644 index 0000000..c31132f --- /dev/null +++ b/app/src/main/java/com/example/washing02app/models/ErrorModel.java @@ -0,0 +1,44 @@ +package com.example.washing02app.models; + +public class ErrorModel { + + public ErrorModel(long timeID, String errorInfo) { + this.timeID = timeID; + this.errorInfo = errorInfo; + } + private long timeID; + + + public void setDateTimeBJ(String dateTimeUTC) { + this.dateTimeBJ = dateTimeUTC; + } + + private String errorInfo; + + public String getDateTimeBJ() { + return dateTimeBJ; + } + + private String dateTimeBJ; + + + @Override + public String toString() { + return String.valueOf(dateTimeBJ + errorInfo); + } + public void setTimeID(long timeID) { + this.timeID = timeID; + } + + public void setErrorInfo(String errorInfo) { + this.errorInfo = errorInfo; + } + + public long getTimeID() { + return timeID; + } + + public String getErrorInfo() { + return errorInfo; + } +} diff --git a/app/src/main/java/com/example/washing02app/models/ScrollBottomScrollView.java b/app/src/main/java/com/example/washing02app/models/ScrollBottomScrollView.java new file mode 100644 index 0000000..1e2ea38 --- /dev/null +++ b/app/src/main/java/com/example/washing02app/models/ScrollBottomScrollView.java @@ -0,0 +1,43 @@ +package com.example.washing02app.models; + +import android.content.Context; +import android.util.AttributeSet; +import android.view.View; +import android.widget.ScrollView; + +public class ScrollBottomScrollView extends ScrollView { + + private OnScrollBottomListener listener; + private int calCount; + + public interface OnScrollBottomListener { + void scrollToBottom(); + } + + public void onScrollViewScrollToBottom(OnScrollBottomListener l) { + listener = l; + } + + public void unRegisterOnScrollViewScrollToBottom() { + listener = null; + } + + public ScrollBottomScrollView(Context context, AttributeSet attrs) { + super(context, attrs); + } + + @Override + protected void onScrollChanged(int l, int t, int oldl, int oldt) { + View view = this.getChildAt(0); + if (this.getHeight() + this.getScrollY() == view.getHeight()) { + calCount++; + if (calCount == 1) { + if (listener != null) { + listener.scrollToBottom(); + } + } + } else { + calCount = 0; + } + } +} diff --git a/app/src/main/java/com/example/washing02app/services/ConvertHelper.java b/app/src/main/java/com/example/washing02app/services/ConvertHelper.java new file mode 100644 index 0000000..8d09432 --- /dev/null +++ b/app/src/main/java/com/example/washing02app/services/ConvertHelper.java @@ -0,0 +1,26 @@ +package com.example.washing02app.services; + +import android.widget.EditText; +import android.widget.TextView; + +public class ConvertHelper { + + public static int convertEditTextToInt(TextView editText) { + // 获取 EditText 中的文本 + String input = editText.getText().toString().trim(); + try { + // 尝试将字符串转换为整数 + return Integer.parseInt(input); + } catch (NumberFormatException e) { + // 输入不是有效的整数格式,返回 -1 表示转换失败 + return -1; + } + } + + public static boolean isEditTextNullOrEmpty(EditText editText) { + + String str = String.valueOf(editText.getText()); + + return str == null || str.isEmpty(); + } +} diff --git a/app/src/main/java/com/example/washing02app/services/CustomProber.java b/app/src/main/java/com/example/washing02app/services/CustomProber.java new file mode 100644 index 0000000..a6456ac --- /dev/null +++ b/app/src/main/java/com/example/washing02app/services/CustomProber.java @@ -0,0 +1,22 @@ +package com.example.washing02app.services; + +import com.hoho.android.usbserial.driver.FtdiSerialDriver; +import com.hoho.android.usbserial.driver.ProbeTable; +import com.hoho.android.usbserial.driver.UsbSerialProber; + +/** + * add devices here, that are not known to DefaultProber + * + * if the App should auto start for these devices, also + * add IDs to app/src/main/res/xml/device_filter.xml + */ +public class CustomProber { + + public static UsbSerialProber getCustomProber() { + ProbeTable customTable = new ProbeTable(); + customTable.addProduct(0x1234, 0x0001, FtdiSerialDriver.class); // e.g. device with custom VID+PID + customTable.addProduct(0x1234, 0x0002, FtdiSerialDriver.class); // e.g. device with custom VID+PID + return new UsbSerialProber(customTable); + } + +} diff --git a/app/src/main/java/com/example/washing02app/services/DecimalDigitsInputFilter.java b/app/src/main/java/com/example/washing02app/services/DecimalDigitsInputFilter.java new file mode 100644 index 0000000..27e0cff --- /dev/null +++ b/app/src/main/java/com/example/washing02app/services/DecimalDigitsInputFilter.java @@ -0,0 +1,71 @@ +package com.example.washing02app.services; + +import android.text.InputFilter; +import android.text.Spanned; + +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +/* + 自定义 InputFilter 类,用于限制输入格式 + 支持整数、负数和最多一位小数的输入 + 使用方法:editText.setFilters(new InputFilter[]{new DecimalDigitsInputFilter()}); +*/ +public class DecimalDigitsInputFilter implements InputFilter { + // 最终验证的正则表达式 + private final Pattern mFinalPattern; + // 中间状态允许的正则表达式 + private final Pattern mIntermediatePattern; + + public DecimalDigitsInputFilter() { + // 最终验证:必须是完整的数字格式 + mFinalPattern = Pattern.compile("^-?(0|[1-9]\\d*)(\\.\\d)?$"); + + // 中间状态:允许临时的不完整格式(如 "-"、"0."、"-2.") + mIntermediatePattern = Pattern.compile("^-?(0|[1-9]\\d*)?(\\.)?$"); + } + + @Override + public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) { + // 处理删除操作 + if (end - start == 0) { + return null; + } + + // 拼接新的输入内容 + String newText = dest.toString().substring(0, dstart) + + source.toString().substring(start, end) + + dest.toString().substring(dend); + + // 允许空字符串或单独的负号 + if (newText.isEmpty() || newText.equals("-")) { + return null; + } + + // 防止前导零(除非是 0 或 0.x) + if (newText.startsWith("0") && newText.length() > 1 && + !newText.startsWith("0.") && !newText.equals("0")) { + return ""; + } + + // 防止多个负号 + if (newText.indexOf('-') > 0) { + return ""; + } + + // 防止多个小数点 + if (newText.indexOf('.') != newText.lastIndexOf('.')) { + return ""; + } + + // 检查是否匹配最终模式或中间模式 + Matcher finalMatcher = mFinalPattern.matcher(newText); + Matcher intermediateMatcher = mIntermediatePattern.matcher(newText); + + if (finalMatcher.matches() || intermediateMatcher.matches()) { + return null; // 匹配成功,允许输入 + } + + return ""; // 匹配失败,阻止输入 + } +} \ No newline at end of file diff --git a/app/src/main/java/com/example/washing02app/services/ErrorDeocdeHelper.java b/app/src/main/java/com/example/washing02app/services/ErrorDeocdeHelper.java new file mode 100644 index 0000000..2e7bf61 --- /dev/null +++ b/app/src/main/java/com/example/washing02app/services/ErrorDeocdeHelper.java @@ -0,0 +1,58 @@ +package com.example.washing02app.services; +import com.example.washing02app.models.BspError; + +public class ErrorDeocdeHelper { + + //private static Map flagMap = new HashMap<>(); + +// public static void AddMap(String errorName, Integer bitPosition) +// { +// flagMap.put(errorName,bitPosition); +// } + private static String ErrorResult; + private static String addErrorResult; + public static String ErrorDeocde(int data) + { + ErrorResult=""; + + // 循环遍历 Map + for (BspError.ComError err : BspError.ComError.values()) { + + int bitPosiiton = err.ordinal(); +// if (err.toString().equals("UNRECOGNIZED")) continue; +// if (err.toString().equals("TL720D")) +// addErrorResult = " 作业模式已切换至手动"; +// else +// addErrorResult = " "; +// +// if (err.toString().equals("MK32_InitialState")) +// addErrorResult = " 遥控器按键未复位"; +// else +// addErrorResult = " "; + + + // 使用左移操作生成要检查的标志位 + int bitToCheck = 1 << bitPosiiton; + + // 判断该位置是否有对应的标志位 + if ((data & bitToCheck) != 0) + { + + // ErrorResult += String.valueOf(bitPosiiton); + + if (err.toString().equals("Remote_Button_Reset_State")) + { + ErrorResult = "未复位" ; + } +// else +// { +// ErrorResult += err.toString()+addErrorResult+"\t"; +// } + } + } + return ErrorResult; + } + + + +} diff --git a/app/src/main/java/com/example/washing02app/services/LineOverlayView.java b/app/src/main/java/com/example/washing02app/services/LineOverlayView.java new file mode 100644 index 0000000..4a44b0a --- /dev/null +++ b/app/src/main/java/com/example/washing02app/services/LineOverlayView.java @@ -0,0 +1,57 @@ +package com.example.washing02app.services; + +import android.content.Context; +import android.graphics.Canvas; +import android.graphics.Color; +import android.graphics.Paint; +import android.util.AttributeSet; +import android.view.View; + +public class LineOverlayView extends View { + + private Paint paint; + + // 两条线的位置(百分比) + private float line1Percent = 0.3f; + private float line2Percent = 0.7f; + + public LineOverlayView(Context context) { + super(context); + init(); + } + + public LineOverlayView(Context context, AttributeSet attrs) { + super(context, attrs); + init(); + } + + private void init() { + paint = new Paint(); + paint.setColor(Color.RED); + paint.setStrokeWidth(5); + paint.setAntiAlias(true); + } + + @Override + protected void onDraw(Canvas canvas) { + super.onDraw(canvas); + + int width = getWidth(); + int height = getHeight(); + + float y1 = height * line1Percent; + float y2 = height * line2Percent; + + // 第一条水平线 + canvas.drawLine(0, y1, width, y1, paint); + + // 第二条水平线 + canvas.drawLine(0, y2, width, y2, paint); + } + + public void setLinePosition(float p1, float p2) { + line1Percent = p1; + line2Percent = p2; + invalidate(); + } +} diff --git a/app/src/main/java/com/example/washing02app/services/LogUtil.java b/app/src/main/java/com/example/washing02app/services/LogUtil.java new file mode 100644 index 0000000..e23ae6d --- /dev/null +++ b/app/src/main/java/com/example/washing02app/services/LogUtil.java @@ -0,0 +1,39 @@ +package com.example.washing02app.services; + +import android.util.Log; + +public class LogUtil { + private String TAG; + private boolean isRelease = false; + private boolean isDebug; + + public LogUtil(Class c, boolean isDebug) { + this.TAG = c.getName(); + this.isDebug = isDebug; + } + + public void d(String msg) { + if (!isRelease && isDebug) { + Log.d(TAG, "--------->" + msg); + } + } + + public void i(String msg) { + if (!isRelease && isDebug) { + Log.i(TAG, "--------->" + msg); + } + } + + public void w(String msg) { + if (!isRelease && isDebug) { + Log.w(TAG, "--------->" + msg); + } + } + + public void e(String msg) { + if (!isRelease && isDebug) { + Log.e(TAG, "--------->" + msg); + } + } +} + diff --git a/app/src/main/java/com/example/washing02app/services/ModbusCRC.java b/app/src/main/java/com/example/washing02app/services/ModbusCRC.java new file mode 100644 index 0000000..8fe247b --- /dev/null +++ b/app/src/main/java/com/example/washing02app/services/ModbusCRC.java @@ -0,0 +1,72 @@ +package com.example.washing02app.services; + +public class ModbusCRC { + +// /** +// * 一个字节包含位的数量 8 +// */ +// private static final int BITS_OF_BYTE = 8; +// /** +// * 多项式 +// */ +// private static final int POLYNOMIAL = 0xA001; +// /** +// * 初始值 +// */ +// private static final int INITIAL_VALUE = 0xFFFF; +// +// /** +// * CRC16 编码 +// * +// * @param bytes 编码内容 +// * @return 编码结果 +// */ +// public static int crc16(byte[] bytes) { +// int res = INITIAL_VALUE; +// for (int data : bytes) { +// res = res ^ data; +// for (int i = 0; i < BITS_OF_BYTE; i++) { +// res = (res & 0x0001) == 1 ? (res >> 1) ^ POLYNOMIAL : res >> 1; +// } +// } +// return revert(res); +// } +// +// /** +// * 翻转16位的高八位和低八位字节 +// * +// * @param src 翻转数字 +// * @return 翻转结果 +// */ +// private static int revert(int src) { +// int lowByte = (src & 0xFF00) >> 8; +// int highByte = (src & 0x00FF) << 8; +// return lowByte | highByte; +// } + + + /** + * 计算 Modbus CRC 校验值 + * @param data 要计算校验值的字节数组 + * @return CRC 校验值,以 2 字节的数组形式返回 + */ + public static byte[] calculateCRC(byte[] data) { + int crc = 0xFFFF; + for (byte b : data) { + crc ^= (b & 0xFF); + for (int i = 0; i < 8; i++) { + if ((crc & 0x0001) != 0) { + crc >>= 1; + crc ^= 0xA001; + } else { + crc >>= 1; + } + } + } + // 将 CRC 结果拆分为两个字节 + byte[] crcBytes = new byte[2]; + crcBytes[0] = (byte) (crc & 0xFF); + crcBytes[1] = (byte) ((crc >> 8) & 0xFF); + return crcBytes; + } +} diff --git a/app/src/main/java/com/example/washing02app/services/MyDataHelper.java b/app/src/main/java/com/example/washing02app/services/MyDataHelper.java new file mode 100644 index 0000000..a935876 --- /dev/null +++ b/app/src/main/java/com/example/washing02app/services/MyDataHelper.java @@ -0,0 +1,222 @@ +package com.example.washing02app.services; + +import android.annotation.SuppressLint; +import android.content.ContentValues; +import android.content.Context; +import android.database.Cursor; +import android.database.sqlite.SQLiteDatabase; +import android.database.sqlite.SQLiteOpenHelper; +import android.util.Log; + +import androidx.annotation.Nullable; + +import com.example.washing02app.models.DisplayPV; +import com.example.washing02app.models.ErrorModel; + +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.TimeZone; + +public class MyDataHelper extends SQLiteOpenHelper { + public static final String COLUMN_ID = "id"; + public static final String TABLE_NAME = "information"; + + public static final String COLUMN_LANCE_CHANGE_DISTANCE = "lanceChangeDistance"; + public static final String COLUMN_VERTICAL_CALIBRATION = "verticalCalibration"; + + + + public static final String Error_TABLE_NAME = "error"; + public static final String Error_COLUMN_Iime_ID = "timeID"; + public static final String Error_COLUMN_ERROR_INFO = "errorInfo"; + + List robotErrorList = new ArrayList<>() ; + + public MyDataHelper(@Nullable Context context) { + super(context, "bingRobot.db", null, 2); + } + + @SuppressLint("SQLiteString") + @Override + public void onCreate(SQLiteDatabase db) { + + String sql = "CREATE TABLE " + TABLE_NAME + "(" + COLUMN_ID + " INTEGER PRIMARY KEY ," + + COLUMN_LANCE_CHANGE_DISTANCE + " INTEGER," + + COLUMN_VERTICAL_CALIBRATION + " DOUBLE" + + ")"; + db.execSQL(sql); + + + sql = "CREATE TABLE " + Error_TABLE_NAME + "(" + Error_COLUMN_Iime_ID + " INTEGER PRIMARY KEY ," + + Error_COLUMN_ERROR_INFO + " STRING " + ")"; + db.execSQL(sql); + + } + + @Override + public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { + db.execSQL("DROP TABLE IF EXISTS " + TABLE_NAME); + db.execSQL("DROP TABLE IF EXISTS " + Error_TABLE_NAME); + onCreate(db); + } + + //增 删 改 查 + public String addOrUpdateDisplayData(DisplayPV pv) { + ContentValues cv = new ContentValues(); + cv.put(COLUMN_ID, pv.getId()); + + cv.put(COLUMN_LANCE_CHANGE_DISTANCE, pv.getLaneChangeDistance()); + cv.put(COLUMN_VERTICAL_CALIBRATION, pv.getVerticalAdjust()); + + + SQLiteDatabase sqliteDatabase = this.getWritableDatabase(); + long insert = sqliteDatabase.insertWithOnConflict(TABLE_NAME, null, cv, SQLiteDatabase.CONFLICT_REPLACE); + sqliteDatabase.close(); + + if (insert == -1) { + return "failed"; + } + return "success"; + } + + public String deleteAll() { + SQLiteDatabase sqLiteDatabase = this.getWritableDatabase(); + int delete = sqLiteDatabase.delete(TABLE_NAME, null, + null); + + sqLiteDatabase.close(); + if (delete == 0) { + return "failed"; + } + return "success"; + + } + + public void IntializeDataBase() { + + for (int i = 1; i < 6; i++) { + List list = getDisplayData(i); + if (list.isEmpty()) { + DisplayPV pv = new DisplayPV(i, 1, 0); + addOrUpdateDisplayData(pv); + } + } + + } + + public List getDisplayData(int id) { + List list = new ArrayList<>(); + String sql = "SELECT * FROM " + TABLE_NAME + " WHERE " + COLUMN_ID + " = " + String.valueOf(id); + SQLiteDatabase sqLiteDatabase = this.getWritableDatabase(); + + + Cursor cursor = sqLiteDatabase.rawQuery(sql, null); + + + int idIndex = cursor.getColumnIndex(COLUMN_ID); + int _laneChangeDistanceIndex = cursor.getColumnIndex(COLUMN_LANCE_CHANGE_DISTANCE); + int _vertical_calibraton = cursor.getColumnIndex(COLUMN_VERTICAL_CALIBRATION); + + while (cursor.moveToNext()) { + + DisplayPV pv = new DisplayPV(cursor.getInt(idIndex), + cursor.getInt(_laneChangeDistanceIndex), cursor.getDouble(_vertical_calibraton) + ); + + list.add(pv); + } + cursor.close(); + sqLiteDatabase.close(); + return list; + + } + + public String AddOrUpdateErrorModel(ErrorModel em) { + ContentValues cv = new ContentValues(); + cv.put(Error_COLUMN_Iime_ID, em.getTimeID()); + cv.put(Error_COLUMN_ERROR_INFO, em.getErrorInfo()); + + SQLiteDatabase sqliteDatabase = this.getWritableDatabase(); + long insert = sqliteDatabase.insertWithOnConflict(Error_TABLE_NAME, null, cv, SQLiteDatabase.CONFLICT_REPLACE); + // ===================== 核心逻辑 ===================== + // 数据太多 → 删200行 + try { + Cursor cursor = sqliteDatabase.rawQuery("SELECT COUNT(*) FROM " + Error_TABLE_NAME, null); + int count = 0; + if (cursor.moveToFirst()) { + count = cursor.getInt(0); + } + cursor.close(); + + //数据超过 500 条,就删除最早的 200 条 + if (count > 100) { + sqliteDatabase.beginTransaction(); + String deleteQuery = "DELETE FROM " + Error_TABLE_NAME + + " WHERE " + Error_COLUMN_Iime_ID + + " IN (SELECT " + Error_COLUMN_Iime_ID + + " FROM " + Error_TABLE_NAME + + " ORDER BY " + Error_COLUMN_Iime_ID + " ASC LIMIT 50)"; + sqliteDatabase.execSQL(deleteQuery); + sqliteDatabase.setTransactionSuccessful(); + sqliteDatabase.endTransaction(); + Log.d("数据库", "数据太多,已删除最早200条"); + } + } catch (Exception e) { + e.printStackTrace(); + } + // ======================================================== + + sqliteDatabase.close(); + return insert == -1 ? "failed" : "success"; + } + + public String DeleteAllErrorModels() { + SQLiteDatabase sqLiteDatabase = this.getWritableDatabase(); + int delete = sqLiteDatabase.delete(Error_TABLE_NAME, null, + null); + + sqLiteDatabase.close(); + if (delete == 0) { + return "failed"; + } + return "success"; + + } + + public List GetAllErrorModels() { + List list = new ArrayList<>(); + + String sql = "SELECT * FROM " + Error_TABLE_NAME; + SQLiteDatabase sqLiteDatabase = this.getWritableDatabase(); + Cursor cursor = sqLiteDatabase.rawQuery(sql, null); + + + + int _time_id_Index = cursor.getColumnIndex(Error_COLUMN_Iime_ID); + int _error_Index = cursor.getColumnIndex(Error_COLUMN_ERROR_INFO); + + while (cursor.moveToNext()) { + + ErrorModel em = new ErrorModel(cursor.getLong(_time_id_Index),cursor.getString(_error_Index)); + + Date date = new Date(em.getTimeID()); // 将时间戳转换为Date对象 + // 创建SimpleDateFormat实例,并设置时区为UTC + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + sdf.setTimeZone(TimeZone.getTimeZone("Asia/Shanghai")); // 设置为UTC时区 + // 格式化日期 + String utcTime = sdf.format(date); + // System.out.println("UTC时间: " + utcTime); + em.setDateTimeBJ(utcTime); + + list.add(em); + } + cursor.close(); + sqLiteDatabase.close(); + return list; + + } + + +} diff --git a/app/src/main/java/com/example/washing02app/services/PopupHelper.java b/app/src/main/java/com/example/washing02app/services/PopupHelper.java new file mode 100644 index 0000000..03712e1 --- /dev/null +++ b/app/src/main/java/com/example/washing02app/services/PopupHelper.java @@ -0,0 +1,176 @@ +package com.example.washing02app.services; + +import android.app.Dialog; +import android.text.method.ScrollingMovementMethod; +import android.view.View; +import android.widget.Button; +import android.widget.RadioButton; +import android.widget.RadioGroup; +import android.widget.ScrollView; +import android.widget.TextView; +import android.widget.Toast; + +import com.example.washing02app.MainActivity; +import com.example.washing02app.R; +import com.example.washing02app.models.ErrorModel; +import com.example.washing02app.models.ScrollBottomScrollView; + +import java.util.List; +import java.util.Objects; + +public class PopupHelper { + String manual_Mode_Call_Value = "无"; + String work_Mode_Call_Temp; + + String result="1"; + + private final MainActivity mainActivity; + + public PopupHelper(MainActivity mainActivity) + { + this.mainActivity = mainActivity; + } + + public void WorkModePopUp(View.OnClickListener context) { + Dialog dialog = new Dialog(mainActivity); + + dialog.setContentView(R.layout.workmodepopup); // 设置自定义布局 + dialog.setCancelable(true); // 设置点击外部是否关闭弹窗 + + // 获取布局中的视图 + Button cancelButton = dialog.findViewById(R.id.manualModeCancel); + Button confirmButton = dialog.findViewById(R.id.manualModeModeApply); + + + // 设置取消按钮点击事件 + cancelButton.setOnClickListener(v -> { + Toast.makeText(mainActivity, "点击了取消", Toast.LENGTH_SHORT).show(); + + dialog.dismiss(); // 关闭弹窗 + }); + // 设置单选按钮点击事件 + + RadioGroup radioGroup = dialog.findViewById(R.id.manualModeSelectorGroup); + radioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(RadioGroup group, int checkedId) { + RadioButton radioButton = (RadioButton) group.findViewById(checkedId); + work_Mode_Call_Temp = radioButton.getText().toString(); + + } + + }); + String ii = (mainActivity._Work_Mode_Call_Value); + switch (ii) + { + case "无": { + radioGroup.check(R.id.rb_one); + break; + } + case "清洗": { + radioGroup.check(R.id.rb_two); + break; + } + case "刷洗": { + radioGroup.check(R.id.rb_three); + break; + } + case "喷漆": { + radioGroup.check(R.id.rb_four); + break; + } + } + // 设置确定按钮点击事件 + confirmButton.setOnClickListener(v -> { + + mainActivity._Work_Mode_Call_Value = work_Mode_Call_Temp; + mainActivity.mainBinding.workModeDisplay.setText(mainActivity._Work_Mode_Call_Value); + Toast.makeText(mainActivity, "设置成功", Toast.LENGTH_SHORT).show(); + dialog.dismiss(); // 关闭弹窗 + }); + dialog.show(); // 显示弹窗 + + } + + + + public void RobotErrorListPopUp(View.OnClickListener context) + { + Dialog dialog = new Dialog(mainActivity); + + dialog.setContentView(R.layout.log_item); // 设置自定义布局 + dialog.setCancelable(true); // 设置点击外部是否关闭弹窗 + + TextView LogText = dialog.findViewById(R.id.popUpErrorLogTextView); + ScrollBottomScrollView LogScrollView = dialog.findViewById(R.id.popUpErrorLogScrollview); + List list = mainActivity.myDataHelper.GetAllErrorModels(); + LogText.setMovementMethod(ScrollingMovementMethod.getInstance()); + + final int[] firstDisplay = {1}; + final int[] display = {2}; + final int[] displayOver = {0}; + int displayNum = 29; + LogScrollView.post(new Runnable() { + @Override + public void run() { + if(firstDisplay[0] == 1){ + //滑动顶部 + LogScrollView.fullScroll(ScrollView.FOCUS_UP); + firstDisplay[0] = 0; + } + } + }); + + LogScrollView.onScrollViewScrollToBottom(new ScrollBottomScrollView.OnScrollBottomListener() { + @Override + public void scrollToBottom() { + //请求数据 + if (!list.isEmpty()) { + if(list.size() > displayNum * display[0]) { + for(int i = list.size() - displayNum * (display[0]-1); i-- > list.size() - displayNum * display[0];){ + ErrorModel item = list.get(i); + String RobotErrorLog = item.getDateTimeBJ() + item.getErrorInfo() +"\n"; + LogText.append(RobotErrorLog); + } + display[0] ++; + } + else{ + if(displayOver[0]==0){ + for(int i = list.size() - displayNum * (display[0]-1); i-- > 0;){ + ErrorModel item = list.get(i); + String RobotErrorLog = item.getDateTimeBJ() + item.getErrorInfo() +"\n"; + LogText.append(RobotErrorLog); + displayOver[0]=1; + } + } + } + } + }}); + + if (!list.isEmpty()) { + + if(list.size() > displayNum) { + + for(int i = list.size(); i-- > list.size() - displayNum;){ + ErrorModel item = list.get(i); + String RobotErrorLog = item.getDateTimeBJ() + item.getErrorInfo() +"\n"; + LogText.append(RobotErrorLog); + } + } + else{ + for(int i = list.size(); i-- > 0;){ + ErrorModel item = list.get(i); + String RobotErrorLog = item.getDateTimeBJ() + item.getErrorInfo() +"\n"; + LogText.append(RobotErrorLog); + } + } + + } +// String list3 = mainActivity.myDataHelper.DeleteAllErrorModels(); + + dialog.show(); // 显示弹窗 + } + + + +} diff --git a/app/src/main/java/com/example/washing02app/services/ReceiivedIVHandler.java b/app/src/main/java/com/example/washing02app/services/ReceiivedIVHandler.java new file mode 100644 index 0000000..ecd9c05 --- /dev/null +++ b/app/src/main/java/com/example/washing02app/services/ReceiivedIVHandler.java @@ -0,0 +1,302 @@ +package com.example.washing02app.services; + +import static com.example.washing02app.services.ErrorDeocdeHelper.ErrorDeocde; +import static com.example.washing02app.services.USBSerialPortHelper.errorLast; +import static com.example.washing02app.services.USBSerialPortHelper.toHex4Digits; +import static com.example.washing02app.services.USBSerialPortHelper.unsignedIntToBinaryWithSeparator; + +import android.graphics.Color; +import android.view.Gravity; +import android.widget.TextView; +import android.widget.Toast; + +import com.example.washing02app.MainActivity; +import com.example.washing02app.R; +import com.example.washing02app.models.BspIV; +import com.example.washing02app.models.ErrorModel; +import com.google.protobuf.InvalidProtocolBufferException; + +import java.util.Objects; + +public class ReceiivedIVHandler { + + // 心跳检测相关 + public static long lastReceiveTime = System.currentTimeMillis(); // 最后一次收到数据的时间 + public static final long TIME_OUT = 5000; // 超时时间:2秒没收到数据就算离线 + public static boolean isAlarmDialogShowed = false; // 防止弹窗重复弹出 + + public static void midToast(String str, int showTime, com.example.washing02app.MainActivity MainActivity) { + Toast toast = Toast.makeText(MainActivity, str, showTime); + toast.setGravity(Gravity.CENTER_VERTICAL | Gravity.CENTER_HORIZONTAL, 0, 0); //设置显示位置 + TextView v = (TextView) toast.getView().findViewById(android.R.id.message); + v.setTextColor(Color.YELLOW); //设置字体颜色 + toast.show(); + } + + public static BspIV.IV_struct_define _toReceiveIV = BspIV.IV_struct_define.newBuilder().build();//上一次有效数据 + public static BspIV.IV_struct_define _toReceiveIV_Variable = BspIV.IV_struct_define.newBuilder().build();//最新数据 + + public static void HandleData(com.example.washing02app.MainActivity MainActivity, byte[] data) { + try { + + byte[] crcbytes = new byte[data.length - 2]; + System.arraycopy(data, 0, crcbytes, 0, data.length - 2); + byte[] crc = ModbusCRC.calculateCRC(crcbytes); + // status(bytesToHex(data)); + + if (data[data.length - 2] == (byte) (crc[1] & 0xff) && data[data.length - 1] == (byte) (crc[0] & 0xff)) { + + if ((data[0] == 0x55) && (data[1] == 0x55)) { + + byte[] bytes = new byte[data.length - 4]; + System.arraycopy(data, 2, bytes, 0, data.length - 4); + + + try { + lastReceiveTime = System.currentTimeMillis(); + isAlarmDialogShowed = false; // 收到数据,重置弹窗标记 + _toReceiveIV_Variable = BspIV.IV_struct_define.parseFrom(bytes);//单片机新数据到来 + + if (_toReceiveIV_Variable != null) { + + if(_toReceiveIV_Variable.getIsRestart()==1)//单片机重启 将收到的时间戳归0 + { + _toReceiveIV=_toReceiveIV.toBuilder().setTimeStamp(0).build(); + // MainActivity._toSendPV=MainActivity._toSendPV.toBuilder().setIVIsRestartNotified(1).build(); + } + //新数据的时间大于上次时间 将新数据赋值给上次数据 + if (_toReceiveIV_Variable.getTimeStamp() >= _toReceiveIV.getTimeStamp()) { + _toReceiveIV = _toReceiveIV_Variable; + } + + + MainActivity.runOnUiThread( + () -> { + + MainActivity.mainBinding.tvSpeedFrom32.setText(String.valueOf(_toReceiveIV.getRobotMoveSpeed())); + MainActivity.mainBinding.tvAngleFrom32.setText(String.valueOf((double) _toReceiveIV.getCurrentAngle() / 100)); + + + int errorInt = _toReceiveIV.getSystemError(); + String errorString2 = ErrorDeocde(errorInt); + + String errorString = unsignedIntToBinaryWithSeparator(errorInt); + errorString += toHex4Digits(_toReceiveIV.getLeftFrontMotorErr()); + errorString += toHex4Digits(_toReceiveIV.getRightFrontMotorErr()); + errorString += toHex4Digits(_toReceiveIV.getLeftBackMotorErr()); + + errorString += toHex4Digits(_toReceiveIV.getRightBackMotorErr()); + errorString += toHex4Digits(_toReceiveIV.getSwingMotorErr()); + errorString += toHex4Digits(_toReceiveIV.getTiltMotorErr()); + + + + +// String errorString = " # " + unsignedIntToBinaryWithSeparator(errorInt); +// errorString += " " + toHex4Digits(_toReceiveIV.getLeftFrontMotorErr()); +// errorString += " " + toHex4Digits(_toReceiveIV.getRightFrontMotorErr()); +// errorString += " " + toHex4Digits(_toReceiveIV.getLeftBackMotorErr()); +// +// errorString += " " + toHex4Digits(_toReceiveIV.getRightBackMotorErr()); +// errorString += " " + toHex4Digits(_toReceiveIV.getSwingMotorErr()); +// errorString += " " + toHex4Digits(_toReceiveIV.getTiltMotorErr()); + + + // 真正的错误 = (errorInt不是0 ) OR 电机有错误 + boolean hasRealError = + (errorInt != 0 ) || _toReceiveIV.getLeftFrontMotorErr() != 0 + || _toReceiveIV.getLeftBackMotorErr() != 0 + || _toReceiveIV.getRightFrontMotorErr() != 0 + || _toReceiveIV.getRightBackMotorErr() != 0 + || _toReceiveIV.getSwingMotorErr() != 0 + || _toReceiveIV.getTiltMotorErr() != 0; + + // 核心判断:只对真正错误变红 + if (hasRealError) { + if (!Objects.equals(errorLast, errorString)) { + + // 转换 + String errorText = parseError( + errorInt, + _toReceiveIV.getLeftFrontMotorErr(), + _toReceiveIV.getRightFrontMotorErr(), + _toReceiveIV.getLeftBackMotorErr(), + _toReceiveIV.getRightBackMotorErr(), + _toReceiveIV.getSwingMotorErr(), + _toReceiveIV.getTiltMotorErr() + ); + // 存数据库 + ErrorModel em = new ErrorModel(System.currentTimeMillis(), errorText); + MainActivity.myDataHelper.AddOrUpdateErrorModel(em); +// ErrorModel em = new ErrorModel(System.currentTimeMillis(), errorString); +// MainActivity.myDataHelper.AddOrUpdateErrorModel(em); + + if (Objects.equals(errorString2, "未复位")) { + MainActivity.mainBinding.mainViewErrMessageTxView.setText(String.valueOf(errorString2)); + MainActivity.mainBinding.messageRounded.setBackgroundResource(R.drawable.message_rounded_rectangle_red); + } else { + MainActivity.mainBinding.mainViewErrMessageTxView.setText("通信故障"); + MainActivity.mainBinding.messageRounded.setBackgroundResource(R.drawable.message_rounded_rectangle_red); + } + errorLast = errorString; + } + } else { + // 无错误 或 只有32/64 → 全部显示正常 + errorLast = errorString; + MainActivity.mainBinding.mainViewErrMessageTxView.setText("无"); + MainActivity.mainBinding.messageRounded.setBackgroundResource(R.drawable.message_rounded_rectangle); + } + + if (_toReceiveIV.getIsWorking() == 1) { + MainActivity.mainBinding.messageRounded.setEnabled(false); + MainActivity.mainBinding.messageRounded.setAlpha(0.5f); + + MainActivity.mainBinding.btnWorkMode.setEnabled(false); + MainActivity.mainBinding.btnWorkMode.setAlpha(0.5f); + + MainActivity.mainBinding.jointSpeed1To32.setEnabled(false); + MainActivity.mainBinding.jointSpeed1To32.setAlpha(0.5f); + + MainActivity.mainBinding.jointSpeed2To32.setEnabled(false); + MainActivity.mainBinding.jointSpeed2To32.setAlpha(0.5f); + + MainActivity.mainBinding.forceSetingTo32.setEnabled(false); + MainActivity.mainBinding.forceSetingTo32.setAlpha(0.5f); + + MainActivity.mainBinding.editLeftCompTo32.setEnabled(false); + MainActivity.mainBinding.editLeftCompTo32.setAlpha(0.5f); + + MainActivity.mainBinding.editRightCompTo32.setEnabled(false); + MainActivity.mainBinding.editRightCompTo32.setAlpha(0.5f); + +// MainActivity.mainBinding.mainViewErrMessageBtnPaint.setAlpha(0.5f); + + + } + else { + + MainActivity.mainBinding.messageRounded.setEnabled(true); + MainActivity.mainBinding.messageRounded.setAlpha(1.0f); + + MainActivity.mainBinding.btnWorkMode.setEnabled(true); + MainActivity.mainBinding.btnWorkMode.setAlpha(1.0f); + + MainActivity.mainBinding.jointSpeed1To32.setEnabled(true); + MainActivity.mainBinding.jointSpeed1To32.setAlpha(1.0f); + + MainActivity.mainBinding.jointSpeed2To32.setEnabled(true); + MainActivity.mainBinding.jointSpeed2To32.setAlpha(1.0f); + + MainActivity.mainBinding.forceSetingTo32.setEnabled(true); + MainActivity.mainBinding.forceSetingTo32.setAlpha(1.0f); + + MainActivity.mainBinding.editLeftCompTo32.setEnabled(true); + MainActivity.mainBinding.editLeftCompTo32.setAlpha(1.0f); + + MainActivity.mainBinding.editRightCompTo32.setEnabled(true); + MainActivity.mainBinding.editRightCompTo32.setAlpha(1.0f); +// +// MainActivity.mainBinding.mainViewErrMessageBtnPaint.setAlpha(1.0f); + } + + + }); + + } + else { //_toReceiveIV != null + + } + + } catch (InvalidProtocolBufferException ex) { + + } + + + + + } else { //校验 + + } + + } else {//校验 + //status("crc failed"); + } + + + } catch (Exception e) { + + } + + } + public static String parseError( + int systemError, + int m1, + int m2, + int m3, + int m4, + int m5, + int m6) + { + StringBuilder sb = new StringBuilder(); + + // 通信故障(bit24~bit32) + String[] commErrors = + { + "sbus", + "720D", + "M1", + "M2", + "M3", + "M4", + "M5", + "M6", + "未复位" + }; + + for (int i = 0; i < 9; i++) + { + if ((systemError & (1 << i)) != 0) + { + if (sb.length() > 0) + { + sb.append("、"); + } + + sb.append(commErrors[i]); + } + } + + // 电机报警码(直接显示数值) + appendMotorError(sb, "M1", m1); + appendMotorError(sb, "M2", m2); + appendMotorError(sb, "M3", m3); + appendMotorError(sb, "M4", m4); + appendMotorError(sb, "M5", m5); + appendMotorError(sb, "M6", m6); + + if (sb.length() == 0) + { + return "无故障"; + } + + return sb.toString(); + } + + private static void appendMotorError( + StringBuilder sb, + String motorName, + int errorCode) + { + if (errorCode != 0) + { + if (sb.length() > 0) + { + sb.append("、"); + } + + sb.append(motorName) + .append(":") + .append(errorCode); + } + } +} diff --git a/app/src/main/java/com/example/washing02app/services/RobotDataHanlder.java b/app/src/main/java/com/example/washing02app/services/RobotDataHanlder.java new file mode 100644 index 0000000..fa30251 --- /dev/null +++ b/app/src/main/java/com/example/washing02app/services/RobotDataHanlder.java @@ -0,0 +1,64 @@ +package com.example.washing02app.services; + + +import com.example.washing02app.models.BspIV; +import com.example.washing02app.models.BspPV; +import com.google.protobuf.InvalidProtocolBufferException; + +public class RobotDataHanlder { + + + public static void test() + { + //byte[] data=hexToByteArray("080110830118313A04B1CBBACF"); + byte[] data=hexToByteArray("100A180A28013A32B1CBBACF00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"); + + + + } + public static void DeoodeDataFromRobot(byte[] data) + { + try + { + if(data[0]==0x55&&data[1]==0x55) + { + if (data[2]==0x01) + { + BspIV.IV_struct_define iv = BspIV.IV_struct_define.parseFrom(data); + }else if(data[2]==0x02) + { + BspPV.PV_struct_define pv = BspPV.PV_struct_define.parseFrom(data); + } + } + } catch (InvalidProtocolBufferException e) + { + + } + + + } + + public static byte[] hexToByteArray(String inHex){ + int hexlen = inHex.length(); + byte[] result; + if (hexlen % 2 == 1){ + //奇数 + hexlen++; + result = new byte[(hexlen/2)]; + inHex="0"+inHex; + }else { + //偶数 + result = new byte[(hexlen/2)]; + } + int j=0; + for (int i = 0; i < hexlen; i+=2){ + result[j]=hexToByte(inHex.substring(i,i+2)); + j++; + } + return result; + } + public static byte hexToByte(String inHex){ + return (byte)Integer.parseInt(inHex,16); + } + +} diff --git a/app/src/main/java/com/example/washing02app/services/ToggleRadioButton.java b/app/src/main/java/com/example/washing02app/services/ToggleRadioButton.java new file mode 100644 index 0000000..b8cc4ed --- /dev/null +++ b/app/src/main/java/com/example/washing02app/services/ToggleRadioButton.java @@ -0,0 +1,55 @@ +package com.example.washing02app.services; + +import android.content.Context; +import android.util.AttributeSet; +import android.view.ViewParent; +import android.widget.RadioGroup; + +import androidx.appcompat.widget.AppCompatRadioButton; + +import com.example.washing02app.R; + +/**********自己的raidobutton按钮类*************/ +public class ToggleRadioButton extends AppCompatRadioButton { + public ToggleRadioButton(Context context) { + super(context); + } + + public ToggleRadioButton(Context context, AttributeSet attrs) { + super(context, attrs); + } + + public ToggleRadioButton(Context context, AttributeSet attrs, int defStyleAttr) { + super(context, attrs, defStyleAttr); + } + + + @Override + public boolean performClick() { + // 获取当前选中状态 + boolean wasChecked = isChecked(); + + // 先让父类处理点击事件(这会触发正常的选中逻辑) + boolean result = super.performClick(); + + // 如果点击前已经是选中状态,说明用户想要取消选中 + if (wasChecked) { + setChecked(false); + // 需要手动清除RadioGroup的选择状态 + clearSelectionInParent(); + } + + return result; + } + + /** + * 清除父RadioGroup中的选择状态 + */ + private void clearSelectionInParent() { + ViewParent parent = getParent(); + if (parent instanceof RadioGroup) { + ((RadioGroup) parent).clearCheck(); + } + + } +} diff --git a/app/src/main/java/com/example/washing02app/services/UDPHelper.java b/app/src/main/java/com/example/washing02app/services/UDPHelper.java new file mode 100644 index 0000000..a949220 --- /dev/null +++ b/app/src/main/java/com/example/washing02app/services/UDPHelper.java @@ -0,0 +1,89 @@ +package com.example.washing02app.services; + +import java.io.IOException; +import java.net.DatagramPacket; +import java.net.DatagramSocket; +import java.net.InetAddress; +import java.util.logging.Handler; + +public class UDPHelper { + + + private static com.example.washing02app.MainActivity MainActivity; + private static Thread receiveThread; + private static boolean running = false; + private static DatagramSocket sendSocket; + private static DatagramSocket receiveSocket; + private static Handler handler;// = new Handler(Looper.getMainLooper()); + private static String target_ip; + private static int target_port; + private static int listening_port; + + public static void Intialize(com.example.washing02app.MainActivity mainActivity, String targetip, int targetPort, int listentingPort) { + try { + MainActivity = mainActivity; + target_ip = targetip; + target_port = targetPort; + listening_port = listentingPort; + sendSocket = new DatagramSocket(10000); + //sendSocket.setBroadcast(true); + + running = true; + + + receiveSocket = new DatagramSocket(listening_port); + receiveSocket.setBroadcast(true); + running = true; + + + receiveThread = new Thread(() -> { + byte[] buffer = new byte[1024]; + DatagramPacket packet = new DatagramPacket(buffer, buffer.length); + + while (running) { + try { + receiveSocket.receive(packet); + byte[] receivedArray = new byte[packet.getLength()]; + System.arraycopy( packet.getData(), 0, receivedArray, 0, receivedArray.length); + ReceiivedIVHandler.HandleData(MainActivity, receivedArray); + + } catch (IOException e) { + if (running) { + + } + } + } + }); + receiveThread.start(); + } catch (IOException e) { + // tvOutput.setText("Socket error: " + e.getMessage()); + } + } + + public static void SendData(byte[] buffer) { + + new Thread(() -> + { + DatagramSocket socket = null; + try { + InetAddress address = InetAddress.getByName(target_ip); + DatagramPacket packet = new DatagramPacket(buffer, buffer.length, address, target_port); + sendSocket.send(packet); + } catch (Exception e) { + + + } + }).start(); + } + + public static void Destroy() { + running = false; + if (receiveSocket != null && !receiveSocket.isClosed()) { + receiveSocket.close(); + } + if (sendSocket != null && !sendSocket.isClosed()) { + sendSocket.close(); + } + } + +} diff --git a/app/src/main/java/com/example/washing02app/services/USBSerialPortHelper.java b/app/src/main/java/com/example/washing02app/services/USBSerialPortHelper.java new file mode 100644 index 0000000..6ce5a81 --- /dev/null +++ b/app/src/main/java/com/example/washing02app/services/USBSerialPortHelper.java @@ -0,0 +1,369 @@ +package com.example.washing02app.services; + + +import android.annotation.SuppressLint; +import android.app.PendingIntent; +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.content.IntentFilter; +import android.hardware.usb.UsbDevice; +import android.hardware.usb.UsbDeviceConnection; +import android.hardware.usb.UsbManager; +import android.os.Build; +import android.os.CountDownTimer; +import android.os.Handler; +import android.os.Looper; + +import androidx.core.content.ContextCompat; + + +import com.example.washing02app.BuildConfig; +import com.example.washing02app.MainActivity; +import com.example.washing02app.R; +import com.hoho.android.usbserial.driver.UsbSerialDriver; +import com.hoho.android.usbserial.driver.UsbSerialPort; +import com.hoho.android.usbserial.driver.UsbSerialProber; +import com.hoho.android.usbserial.util.SerialInputOutputManager; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +public class USBSerialPortHelper implements SerialInputOutputManager.Listener { + + + public USBSerialPortHelper(MainActivity mainActivity) + { + this.MainActivity=mainActivity; + } + + private final MainActivity MainActivity; + //sserial port part start + + private enum UsbPermission {Unknown, Requested, Granted, Denied} + + private final String INTENT_ACTION_GRANT_USB = BuildConfig.APPLICATION_ID + ".GRANT_USB"; + + + // + // + // + + + private int deviceId = 60000; + private int deviceId_test = 60000; + private int portNum; + private final int READ_WAIT_MILLIS = 100; + private String PortNameContians = "SILICON";/**/ + // private static String PortNameContians="FTD"; + private int baudRate = 57600; + private boolean withIoManager = true; + + private BroadcastReceiver broadcastReceiver; + private Handler mainLooper; + + private SerialInputOutputManager usbIoManager; + private UsbSerialPort usbSerialPort; + private UsbPermission usbPermission = UsbPermission.Unknown; + private boolean connected = false; + static String errorLast = ""; + public void intialize() { + + broadcastReceiver = new BroadcastReceiver() { + @Override + public void onReceive(Context context, Intent intent) { + if (INTENT_ACTION_GRANT_USB.equals(intent.getAction())) { + usbPermission = intent.getBooleanExtra(UsbManager.EXTRA_PERMISSION_GRANTED, false) ? UsbPermission.Granted : UsbPermission.Denied; + connect(); + } + } + }; + mainLooper = new Handler(Looper.getMainLooper()); + _receiveBufferlist = new ArrayList(); + } + + /* + * Serial + */ + @Override + public void onNewData(byte[] data) { + status("new data"); + mainLooper.post(() -> { + receive(data); + // receive data + }); + } + + @Override + public void onRunError(Exception e) { + mainLooper.post(() -> { + status("connection lost: " + e.getMessage()); + disconnect(); + }); + } + + /* + * Serial + UI + */ + + public void connect() { + + UsbDevice device = null; + UsbManager usbManager = (UsbManager) MainActivity.getSystemService(Context.USB_SERVICE); + for (UsbDevice v : usbManager.getDeviceList().values()) { + status(v.getManufacturerName().toUpperCase()); + if (v.getManufacturerName().toUpperCase().contains(PortNameContians)) { + device = v; + break; + } + } + + if (device == null) { + // _serialPortSwitch.setChecked(false); + + status("找不到设备"); + return; + } + UsbSerialDriver driver = UsbSerialProber.getDefaultProber().probeDevice(device); + if (driver == null) { + driver = CustomProber.getCustomProber().probeDevice(device); + } + if (driver == null) { + // _serialPortSwitch.setChecked(false); + status("无驱动"); + return; + } + if (driver.getPorts().size() < portNum) //就是0 cp2102 或者同一个驱动,第一个 + { + status("connection failed: not enough ports at device"); + status("找不到设备"); + return; + } + usbSerialPort = driver.getPorts().get(portNum); + + UsbDeviceConnection usbConnection = usbManager.openDevice(driver.getDevice()); + if (usbConnection == null && usbPermission == UsbPermission.Unknown && !usbManager.hasPermission(driver.getDevice())) { + usbPermission = UsbPermission.Requested; + int flags = Build.VERSION.SDK_INT >= Build.VERSION_CODES.M ? PendingIntent.FLAG_MUTABLE : 0; + Intent intent = new Intent(INTENT_ACTION_GRANT_USB); + intent.setPackage(MainActivity.getPackageName()); + PendingIntent usbPermissionIntent = PendingIntent.getBroadcast(MainActivity, 0, intent, flags); + usbManager.requestPermission(driver.getDevice(), usbPermissionIntent); + return; + } + if (usbConnection == null) { + if (!usbManager.hasPermission(driver.getDevice())) { + status("connection failed: permission denied"); + } else { + status("connection failed: open failed"); + } + + return; + } + + try { + usbSerialPort.open(usbConnection); + try { + usbSerialPort.setParameters(baudRate, 8, 1, UsbSerialPort.PARITY_NONE); + status("connected: "); + + } catch (UnsupportedOperationException e) { + status("unsupport setparameters"); + } + if (withIoManager) { + usbIoManager = new SerialInputOutputManager(usbSerialPort, this); + usbIoManager.setReadBufferSize(40960); + usbIoManager.setReadTimeout(READ_WAIT_MILLIS); + usbIoManager.start(); + } + //status("connected"); + connected = true; + // _serialPortSwitch.setChecked(true); + //switch set true + + } catch (Exception e) { + status("connection failed: " + e.getMessage()); + disconnect(); + } + } + + private void disconnect() { + connected = false; + + if (usbIoManager != null) { + usbIoManager.setListener(null); + usbIoManager.stop(); + } + usbIoManager = null; + try { + usbSerialPort.close(); + } catch (IOException ignored) { + + } + usbSerialPort = null; + } + + List _receiveBufferlist; + + private static byte[] listTobyte(List list) { + if (list == null || list.size() < 0) return null; + byte[] bytes = new byte[list.size()]; + int i = 0; + Iterator iterator = list.iterator(); + while (iterator.hasNext()) { + bytes[i] = iterator.next(); + i++; + } + return bytes; + } + + boolean StartCountDown = false; + + // byte _receivedData + private void receive(byte[] data) { + + // status("read data"); + for (int i = 0; i < data.length; i++) { + _receiveBufferlist.add(data[i]); + } + + //decodeRceive(data); + if (!StartCountDown)//从收到第一个数据开始计时 + { + StartCountDown = true; + new CountDownTimer(10, 5) { + public void onTick(long millisUntilFinished) { + + } + public void onFinish() { + + status("read finished"); + decodeRceive(listTobyte(_receiveBufferlist)); + _receiveBufferlist.clear(); + StartCountDown = false; + } + }.start(); + } + } + + void status(String str) { +// SpannableStringBuilder spn = new SpannableStringBuilder(str+'\r'+'\n'); +// +// // spn.append(getTime()); +// +// spn.setSpan(new ForegroundColorSpan(MainActivity.getResources().getColor(R.color.colorAccent)), 0, spn.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); +// receiveText.append(spn); + // mainBinding.roll.fullScroll(ScrollView.FOCUS_DOWN); + + + // MainActivity.mainBinding.message.setText(str); + } + /* + 逐位检查并构建二进制字符串 + */ + String unsignedIntToBinary(int value) { + StringBuilder sb = new StringBuilder(32); + for (int i = 7; i >= 0; i--) { + sb.append((value & (1 << i)) == 0 ? '0' : '1'); + } + return sb.toString(); + } + /* + 逐位检查并构建二进制字符串 每4位添加一个分隔符 + */ + public static String unsignedIntToBinaryWithSeparator(int value) { + StringBuilder sb = new StringBuilder(35); + for (int i = 8; i >= 0; i--) { + sb.append((value & (1 << i)) == 0 ? '0' : '1'); +// if (i % 4 == 0 && i != 0) { +// sb.append(' '); // 每4位添加一个分隔符 +// } + } + return sb.toString(); + } + public static String toHex4Digits(int value) { + char[] hexChars = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'}; + int low16Bits = value & 0xFFFF; + + char[] result = new char[4]; + result[0] = hexChars[(low16Bits >> 12) & 0xF]; + result[1] = hexChars[(low16Bits >> 8) & 0xF]; + result[2] = hexChars[(low16Bits >> 4) & 0xF]; + result[3] = hexChars[low16Bits & 0xF]; + + return new String(result); + } + @SuppressLint("SetTextI18n") + private void decodeRceive(byte[] data) { + try { + + ReceiivedIVHandler.HandleData(MainActivity, data); + + } catch (Exception e) { + + } + } + + public static String bytesToHex(byte[] bytes) { + StringBuilder result = new StringBuilder(); + for (byte b : bytes) { + result.append(String.format("%02X ", b & 0xFF)); + } + return result.toString(); + } + + + public void onStart() { + + ContextCompat.registerReceiver(MainActivity, broadcastReceiver, new IntentFilter(INTENT_ACTION_GRANT_USB), ContextCompat.RECEIVER_NOT_EXPORTED); + status("onStart"); + + } + + public void onStop() { + MainActivity.unregisterReceiver(broadcastReceiver); + status("onStop"); + } + + + + + + public void onResume() { + + if (!connected && (usbPermission == UsbPermission.Unknown || usbPermission == UsbPermission.Granted)) { + mainLooper.post(this::connect); + } + } + + + public void onPause() { + if (connected) { + status("串口断开"); + // _serialPortSwitch.setChecked(false); + disconnect(); + } + } + + public void SendData(byte[] data) { + if (connected) { + try { + int WRITE_WAIT_MILLIS = 500; + usbSerialPort.write(data, WRITE_WAIT_MILLIS); + } catch (IOException e) + { + status("Send Failed"); + connected = false; + } + } else { + status("usb serialport disconnected"); + + } + + + + } + +} diff --git a/app/src/main/java/com/example/washing02app/services/VideoPlayerHelper.java b/app/src/main/java/com/example/washing02app/services/VideoPlayerHelper.java new file mode 100644 index 0000000..3132f23 --- /dev/null +++ b/app/src/main/java/com/example/washing02app/services/VideoPlayerHelper.java @@ -0,0 +1,47 @@ +package com.example.washing02app.services; + + +import cn.nodemedia.NodePlayer; +import cn.nodemedia.NodePlayerView; + +public class VideoPlayerHelper { + + + + public static void startVedio(NodePlayerView nodePlayerView, NodePlayer nodePlayer,String address ){ + + nodePlayerView.setRenderType(NodePlayerView.RenderType.TEXTUREVIEW); + + //nodePlayerView.setRenderType(NodePlayerView.RenderType.SURFACEVIEW);//设置渲染器类型 + nodePlayerView.setRotation(180); // 1号 不注释 2号不注释 + nodePlayerView.setUIViewContentMode(NodePlayerView.UIViewContentMode.ScaleToFill);//设置视频画面缩放模式 + //nodePlayer=new NodePlayer(this); + nodePlayer.setPlayerView(nodePlayerView);//设置播放视图 + //设置RTSP流使用的传输协议,支持的模式有: + nodePlayer.setRtspTransport(NodePlayer.RTSP_TRANSPORT_TCP);//设置传输 + nodePlayer.setInputUrl(address); + nodePlayer.setVideoEnable(true);//设置视频启用 + nodePlayer.setBufferTime(100);//设置缓冲时间 + nodePlayer.setMaxBufferTime(200);//设置最大缓冲时间 + nodePlayer.start(); + } + + public static void startVedio1(NodePlayerView nodePlayerView, NodePlayer nodePlayer,String address ){ + + nodePlayerView.setRenderType(NodePlayerView.RenderType.TEXTUREVIEW); + + //nodePlayerView.setRenderType(NodePlayerView.RenderType.SURFACEVIEW);//设置渲染器类型 + //nodePlayerView.setRotation(180); // 1号 不注释 2号不注释 + nodePlayerView.setUIViewContentMode(NodePlayerView.UIViewContentMode.ScaleToFill);//设置视频画面缩放模式 + //nodePlayer=new NodePlayer(this); + nodePlayer.setPlayerView(nodePlayerView);//设置播放视图 + //设置RTSP流使用的传输协议,支持的模式有: + nodePlayer.setRtspTransport(NodePlayer.RTSP_TRANSPORT_TCP);//设置传输 + nodePlayer.setInputUrl(address); + nodePlayer.setVideoEnable(true);//设置视频启用 + nodePlayer.setBufferTime(100);//设置缓冲时间 + nodePlayer.setMaxBufferTime(200);//设置最大缓冲时间 + nodePlayer.start(); + } +} + diff --git a/app/src/main/java/com/example/washing02app/viewmodels/MainViewModel.java b/app/src/main/java/com/example/washing02app/viewmodels/MainViewModel.java new file mode 100644 index 0000000..a85438f --- /dev/null +++ b/app/src/main/java/com/example/washing02app/viewmodels/MainViewModel.java @@ -0,0 +1,11 @@ +package com.example.washing02app.viewmodels; + +import androidx.lifecycle.ViewModel; + +public class MainViewModel extends ViewModel { + + public MainViewModel() { + + } + +} \ No newline at end of file diff --git a/app/src/main/java/generate_java.bat b/app/src/main/java/generate_java.bat new file mode 100644 index 0000000..9835c18 --- /dev/null +++ b/app/src/main/java/generate_java.bat @@ -0,0 +1,2 @@ + protoc --java_out . *.proto + pause \ No newline at end of file diff --git a/app/src/main/java/protoc.7z b/app/src/main/java/protoc.7z new file mode 100644 index 0000000..b4ac7a1 Binary files /dev/null and b/app/src/main/java/protoc.7z differ diff --git a/app/src/main/java/protoc.exe b/app/src/main/java/protoc.exe new file mode 100644 index 0000000..f1ffb02 Binary files /dev/null and b/app/src/main/java/protoc.exe differ diff --git a/app/src/main/res/drawable/background.xml b/app/src/main/res/drawable/background.xml new file mode 100644 index 0000000..9c77c74 --- /dev/null +++ b/app/src/main/res/drawable/background.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable/bgr.png b/app/src/main/res/drawable/bgr.png new file mode 100644 index 0000000..4d6154f Binary files /dev/null and b/app/src/main/res/drawable/bgr.png differ diff --git a/app/src/main/res/drawable/bigackground.png b/app/src/main/res/drawable/bigackground.png new file mode 100644 index 0000000..8466de6 Binary files /dev/null and b/app/src/main/res/drawable/bigackground.png differ diff --git a/app/src/main/res/drawable/bigackground2.png b/app/src/main/res/drawable/bigackground2.png new file mode 100644 index 0000000..5ac409f Binary files /dev/null and b/app/src/main/res/drawable/bigackground2.png differ diff --git a/app/src/main/res/drawable/blue_rounded_rectangle.xml b/app/src/main/res/drawable/blue_rounded_rectangle.xml new file mode 100644 index 0000000..a973af9 --- /dev/null +++ b/app/src/main/res/drawable/blue_rounded_rectangle.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable/border.xml b/app/src/main/res/drawable/border.xml new file mode 100644 index 0000000..4f76948 --- /dev/null +++ b/app/src/main/res/drawable/border.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/app/src/main/res/drawable/borderblue.xml b/app/src/main/res/drawable/borderblue.xml new file mode 100644 index 0000000..e4995a9 --- /dev/null +++ b/app/src/main/res/drawable/borderblue.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable/bordergreen.xml b/app/src/main/res/drawable/bordergreen.xml new file mode 100644 index 0000000..c10e3c7 --- /dev/null +++ b/app/src/main/res/drawable/bordergreen.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable/borderlog.xml b/app/src/main/res/drawable/borderlog.xml new file mode 100644 index 0000000..1a1b34c --- /dev/null +++ b/app/src/main/res/drawable/borderlog.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable/borderorange.xml b/app/src/main/res/drawable/borderorange.xml new file mode 100644 index 0000000..0b0d657 --- /dev/null +++ b/app/src/main/res/drawable/borderorange.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable/bordersubmenu.xml b/app/src/main/res/drawable/bordersubmenu.xml new file mode 100644 index 0000000..af31d78 --- /dev/null +++ b/app/src/main/res/drawable/bordersubmenu.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable/borderwhite.xml b/app/src/main/res/drawable/borderwhite.xml new file mode 100644 index 0000000..e013ef8 --- /dev/null +++ b/app/src/main/res/drawable/borderwhite.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable/buttonborderwhite.xml b/app/src/main/res/drawable/buttonborderwhite.xml new file mode 100644 index 0000000..ec98fab --- /dev/null +++ b/app/src/main/res/drawable/buttonborderwhite.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable/dash_line.xml b/app/src/main/res/drawable/dash_line.xml new file mode 100644 index 0000000..c83a8c5 --- /dev/null +++ b/app/src/main/res/drawable/dash_line.xml @@ -0,0 +1,14 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_launcher_background.xml b/app/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 0000000..07d5da9 --- /dev/null +++ b/app/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable/ic_launcher_foreground.xml b/app/src/main/res/drawable/ic_launcher_foreground.xml new file mode 100644 index 0000000..2b068d1 --- /dev/null +++ b/app/src/main/res/drawable/ic_launcher_foreground.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/message_rounded_rectangle.xml b/app/src/main/res/drawable/message_rounded_rectangle.xml new file mode 100644 index 0000000..2d10340 --- /dev/null +++ b/app/src/main/res/drawable/message_rounded_rectangle.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable/message_rounded_rectangle_red.xml b/app/src/main/res/drawable/message_rounded_rectangle_red.xml new file mode 100644 index 0000000..0b0063f --- /dev/null +++ b/app/src/main/res/drawable/message_rounded_rectangle_red.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable/orange_rounded_rectangle.xml b/app/src/main/res/drawable/orange_rounded_rectangle.xml new file mode 100644 index 0000000..08930b5 --- /dev/null +++ b/app/src/main/res/drawable/orange_rounded_rectangle.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable/radio_button_selected.xml b/app/src/main/res/drawable/radio_button_selected.xml new file mode 100644 index 0000000..3232aed --- /dev/null +++ b/app/src/main/res/drawable/radio_button_selected.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/app/src/main/res/drawable/radio_button_textcolor.xml b/app/src/main/res/drawable/radio_button_textcolor.xml new file mode 100644 index 0000000..04c3ced --- /dev/null +++ b/app/src/main/res/drawable/radio_button_textcolor.xml @@ -0,0 +1,8 @@ + + + + + + diff --git a/app/src/main/res/drawable/radio_button_unselected.xml b/app/src/main/res/drawable/radio_button_unselected.xml new file mode 100644 index 0000000..8190483 --- /dev/null +++ b/app/src/main/res/drawable/radio_button_unselected.xml @@ -0,0 +1,11 @@ + + + + + + + + + + diff --git a/app/src/main/res/drawable/radiobutton_background.xml b/app/src/main/res/drawable/radiobutton_background.xml new file mode 100644 index 0000000..6eb6a48 --- /dev/null +++ b/app/src/main/res/drawable/radiobutton_background.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/radiobutton_notsave_background.xml b/app/src/main/res/drawable/radiobutton_notsave_background.xml new file mode 100644 index 0000000..3feee5f --- /dev/null +++ b/app/src/main/res/drawable/radiobutton_notsave_background.xml @@ -0,0 +1,11 @@ + + + + + + + + + + diff --git a/app/src/main/res/drawable/radiobutton_save_background.xml b/app/src/main/res/drawable/radiobutton_save_background.xml new file mode 100644 index 0000000..dd4aa50 --- /dev/null +++ b/app/src/main/res/drawable/radiobutton_save_background.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/app/src/main/res/drawable/rounded_edittext.xml b/app/src/main/res/drawable/rounded_edittext.xml new file mode 100644 index 0000000..9f845ce --- /dev/null +++ b/app/src/main/res/drawable/rounded_edittext.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable/smallbackground.png b/app/src/main/res/drawable/smallbackground.png new file mode 100644 index 0000000..1f6f84f Binary files /dev/null and b/app/src/main/res/drawable/smallbackground.png differ diff --git a/app/src/main/res/drawable/squrelogo.png b/app/src/main/res/drawable/squrelogo.png new file mode 100644 index 0000000..f7cafaf Binary files /dev/null and b/app/src/main/res/drawable/squrelogo.png differ diff --git a/app/src/main/res/drawable/submenu.xml b/app/src/main/res/drawable/submenu.xml new file mode 100644 index 0000000..64f9e41 --- /dev/null +++ b/app/src/main/res/drawable/submenu.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/submenu2.png b/app/src/main/res/drawable/submenu2.png new file mode 100644 index 0000000..ea943ed Binary files /dev/null and b/app/src/main/res/drawable/submenu2.png differ diff --git a/app/src/main/res/drawable/submenupng.png b/app/src/main/res/drawable/submenupng.png new file mode 100644 index 0000000..359b006 Binary files /dev/null and b/app/src/main/res/drawable/submenupng.png differ diff --git a/app/src/main/res/font/font_you_yuan.ttf b/app/src/main/res/font/font_you_yuan.ttf new file mode 100644 index 0000000..0d6e9c2 Binary files /dev/null and b/app/src/main/res/font/font_you_yuan.ttf differ diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml new file mode 100644 index 0000000..399a8fc --- /dev/null +++ b/app/src/main/res/layout/activity_main.xml @@ -0,0 +1,608 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/workmodepopup.xml b/app/src/main/res/layout/workmodepopup.xml new file mode 100644 index 0000000..9f898f4 --- /dev/null +++ b/app/src/main/res/layout/workmodepopup.xml @@ -0,0 +1,148 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml new file mode 100644 index 0000000..6f3b755 --- /dev/null +++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml new file mode 100644 index 0000000..6f3b755 --- /dev/null +++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher.webp b/app/src/main/res/mipmap-hdpi/ic_launcher.webp new file mode 100644 index 0000000..c209e78 Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher.webp differ diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp new file mode 100644 index 0000000..b2dfe3d Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher.webp b/app/src/main/res/mipmap-mdpi/ic_launcher.webp new file mode 100644 index 0000000..4f0f1d6 Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher.webp differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp new file mode 100644 index 0000000..62b611d Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.webp b/app/src/main/res/mipmap-xhdpi/ic_launcher.webp new file mode 100644 index 0000000..948a307 Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher.webp differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp new file mode 100644 index 0000000..1b9a695 Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp b/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp new file mode 100644 index 0000000..28d4b77 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp new file mode 100644 index 0000000..9287f50 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp new file mode 100644 index 0000000..aa7d642 Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp new file mode 100644 index 0000000..9126ae3 Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp differ diff --git a/app/src/main/res/values-night/themes.xml b/app/src/main/res/values-night/themes.xml new file mode 100644 index 0000000..6333a9c --- /dev/null +++ b/app/src/main/res/values-night/themes.xml @@ -0,0 +1,16 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml new file mode 100644 index 0000000..268380a --- /dev/null +++ b/app/src/main/res/values/colors.xml @@ -0,0 +1,164 @@ + + + #FF000000 + #FFFFFFFF + #FFFFFFFF + + #3F51B5 + #303F9F + #FF4081 + #00ADFC + #00194d + + #FBE5D6 + #1F4E79 + #00ACFC + #DEEBF7 + #FBE5D6 + #FF713D + #001E54 + + + #fffafa + #fffaf0 + #ffebcd + #f8f8ff + #f5f5f5 + #faebd7 + #ffdead + #808080 + #dcdcdc + #d3d3d3 + #a9a9a9 + #696969 + #708090 + #778899 + #2f4f4f + #c0c0c0 + + #ff0000 + #8b0000 + #dc143c + #8b008b + #ff00ff + #ff6347 + #f08080 + #e9967a + #ffdab9 + #dda0dd + #ffc0cb + #ffb6c1 + #ff1493 + #ff69b4 + #fff0f5 + #cd5c5c + #bc8f8f + #b22222 + #800000 + #f0fff0 + #ff4500 + #ffa500 + #32cd32 + #00ff00 + #ffff00 + #f5deb3 + #f0e68c + #deb887 + #ffe4c4 + #ffffe0 + #b8860b + #ff8c00 + #fafad2 + #fffacd + #fff8dc + #fff5ee + #ffefd5 + #ffe4e1 + #ffe4b5 + #fffff0 + #ffd700 + #daa520 + #ffa07a + #ff7f50 + #f5fffa + #f5f5dc + #f4a460 + #fdf5e6 + #faf0e6 + #fa8072 + #d8bfd8 + #d2b48c + #d2691e + #cd853f + #bdb76b + #eee8aa + #a52a2a + #8b4513 + #a0522d + #808000 + #7fff00 + #adff2f + #008000 + #006400 + #556b2f + #6b8e23 + #7cfc00 + #228b22 + #7fffd4 + #afeeee + #98fb98 + #48d1cc + #66cdaa + #00ffff + #00ff7f + #00fa9a + #00ced1 + #2e8b57 + #90ee90 + #8fbc8f + #40e0d0 + #00ffff + #008b8b + #e0ffff + #008080 + #4b0082 + #0000ff + #00008b + #0000cd + #191970 + #000080 + #4169e1 + #f0ffff + #87ceeb + #00bfff + #87cefa + #20b2aa + #add8e6 + #b0e0e6 + #f0f8ff + #7b68ee + #6a5acd + #483d8b + #3cb371 + #4682b4 + #b0c4de + #6495ed + #1e90ff + #5f9ea0 + #8a2be2 + #800080 + #e6e6fa + #da70d6 + #9370db + #9932cc + #ee82ee + #c71585 + #db7093 + #9400d3 + #ba55d3 + #00000000 + + #6efe00 + + + \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml new file mode 100644 index 0000000..0dae83f --- /dev/null +++ b/app/src/main/res/values/strings.xml @@ -0,0 +1,13 @@ + + 洗舱01 + 车体速度 + 作业模式 + 辅线状态 + 1关节速度 + 2关节速度 + 下压档位 + 角\u3000\u3000度 + 左行补偿 + 右行补偿 + + \ No newline at end of file diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml new file mode 100644 index 0000000..71d4d00 --- /dev/null +++ b/app/src/main/res/values/themes.xml @@ -0,0 +1,17 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/xml/backup_rules.xml b/app/src/main/res/xml/backup_rules.xml new file mode 100644 index 0000000..fa0f996 --- /dev/null +++ b/app/src/main/res/xml/backup_rules.xml @@ -0,0 +1,13 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/xml/check_boxs.xml b/app/src/main/res/xml/check_boxs.xml new file mode 100644 index 0000000..df2d64a --- /dev/null +++ b/app/src/main/res/xml/check_boxs.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/xml/data_extraction_rules.xml b/app/src/main/res/xml/data_extraction_rules.xml new file mode 100644 index 0000000..9ee9997 --- /dev/null +++ b/app/src/main/res/xml/data_extraction_rules.xml @@ -0,0 +1,19 @@ + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/xml/device_filter.xml b/app/src/main/res/xml/device_filter.xml new file mode 100644 index 0000000..b2a252c --- /dev/null +++ b/app/src/main/res/xml/device_filter.xml @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/test/java/com/example/washing02app/ExampleUnitTest.java b/app/src/test/java/com/example/washing02app/ExampleUnitTest.java new file mode 100644 index 0000000..c87c4b5 --- /dev/null +++ b/app/src/test/java/com/example/washing02app/ExampleUnitTest.java @@ -0,0 +1,17 @@ +package com.example.rougheningapp; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; + +/** + * Example local unit test, which will execute on the development machine (host). + * + * @see Testing documentation + */ +public class ExampleUnitTest { + @Test + public void addition_isCorrect() { + assertEquals(4, 2 + 2); + } +} \ No newline at end of file diff --git a/build.gradle b/build.gradle new file mode 100644 index 0000000..b99ec97 --- /dev/null +++ b/build.gradle @@ -0,0 +1,4 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. +plugins { +id 'com.android.application' version '8.8.0' apply false +} \ No newline at end of file diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 0000000..3e927b1 --- /dev/null +++ b/gradle.properties @@ -0,0 +1,21 @@ +# 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 +# Enables namespacing of each library's R class so that its R class includes only the +# resources declared in the library itself and none from the library's dependencies, +# thereby reducing the size of the R class for that library +android.nonTransitiveRClass=true \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..e708b1c Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..ccc51a8 --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Tue Jun 02 12:01:18 CST 2026 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew new file mode 100644 index 0000000..4f906e0 --- /dev/null +++ b/gradlew @@ -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" "$@" diff --git a/gradlew.bat b/gradlew.bat new file mode 100644 index 0000000..107acd3 --- /dev/null +++ b/gradlew.bat @@ -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 diff --git a/local.properties b/local.properties new file mode 100644 index 0000000..ddf9ad7 --- /dev/null +++ b/local.properties @@ -0,0 +1,8 @@ +## This file must *NOT* be checked into Version Control Systems, +# as it contains information specific to your local configuration. +# +# Location of the SDK. This is only used by Gradle. +# For customization when using a Version Control System, please read the +# header note. +#Tue Jan 20 11:38:44 CST 2026 +sdk.dir=C\:\\Users\\10564\\AppData\\Local\\Android\\Sdk diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 0000000..82523ce --- /dev/null +++ b/settings.gradle @@ -0,0 +1,18 @@ +pluginManagement { + repositories { + google() + mavenCentral() + gradlePluginPortal() + } +} +dependencyResolutionManagement { + repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) + repositories { + google() + mavenCentral() + maven { url 'https://jitpack.io' } + } +} + +rootProject.name = "Washing02APP" +include ':app'