commit 53eec34065ffb4228b1262818df7dcd9418c3f26 Author: DESKTOP-1PDT1EL\10564 <1056470187@qq.com> Date: Fri Mar 13 10:41:21 2026 +0800 first commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..aa724b7 --- /dev/null +++ b/.gitignore @@ -0,0 +1,15 @@ +*.iml +.gradle +/local.properties +/.idea/caches +/.idea/libraries +/.idea/modules.xml +/.idea/workspace.xml +/.idea/navEditor.xml +/.idea/assetWizardSettings.xml +.DS_Store +/build +/captures +.externalNativeBuild +.cxx +local.properties 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..05e305b --- /dev/null +++ b/.idea/.name @@ -0,0 +1 @@ +SwingArmAPP_SandBlast \ 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..60ba08d --- /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..b2c751a --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,9 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/render.experimental.xml b/.idea/render.experimental.xml new file mode 100644 index 0000000..8ec256a --- /dev/null +++ b/.idea/render.experimental.xml @@ -0,0 +1,6 @@ + + + + + \ 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..ba60b3c --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +江南摆臂带喷砂机app \ 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..5dfaded --- /dev/null +++ b/app/build.gradle @@ -0,0 +1,58 @@ +plugins { + id 'com.android.application' +} + +android { + namespace 'com.example.swingarmapp_sandblast' + compileSdk 35 + viewBinding + { + enabled true + } + // //add this feature + dataBinding + { + enabled true + } + defaultConfig { + applicationId "com.example.swingarmapp_sandblast" + minSdk 24 + targetSdk 35 + versionCode 1 + versionName "1.0" + + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + } + + 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 'com.google.android.material:material:1.9.0' + implementation 'androidx.constraintlayout:constraintlayout:2.1.4' + 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/app-release.apk b/app/release/app-release.apk new file mode 100644 index 0000000..7262d7c Binary files /dev/null and b/app/release/app-release.apk differ diff --git a/app/release/baselineProfiles/0/app-release.dm b/app/release/baselineProfiles/0/app-release.dm new file mode 100644 index 0000000..e3cbdb4 Binary files /dev/null and b/app/release/baselineProfiles/0/app-release.dm differ diff --git a/app/release/baselineProfiles/1/app-release.dm b/app/release/baselineProfiles/1/app-release.dm new file mode 100644 index 0000000..c46deb7 Binary files /dev/null and b/app/release/baselineProfiles/1/app-release.dm differ diff --git a/app/release/output-metadata.json b/app/release/output-metadata.json new file mode 100644 index 0000000..9ec7083 --- /dev/null +++ b/app/release/output-metadata.json @@ -0,0 +1,37 @@ +{ + "version": 3, + "artifactType": { + "type": "APK", + "kind": "Directory" + }, + "applicationId": "com.example.swingarmapp_sandblast", + "variantName": "release", + "elements": [ + { + "type": "SINGLE", + "filters": [], + "attributes": [], + "versionCode": 1, + "versionName": "1.0", + "outputFile": "app-release.apk" + } + ], + "elementType": "File", + "baselineProfiles": [ + { + "minApi": 28, + "maxApi": 30, + "baselineProfiles": [ + "baselineProfiles/1/app-release.dm" + ] + }, + { + "minApi": 31, + "maxApi": 2147483647, + "baselineProfiles": [ + "baselineProfiles/0/app-release.dm" + ] + } + ], + "minSdkVersionForDexing": 24 +} \ No newline at end of file diff --git a/app/src/androidTest/java/com/example/swingarmapp_sandblast/ExampleInstrumentedTest.java b/app/src/androidTest/java/com/example/swingarmapp_sandblast/ExampleInstrumentedTest.java new file mode 100644 index 0000000..0586ed0 --- /dev/null +++ b/app/src/androidTest/java/com/example/swingarmapp_sandblast/ExampleInstrumentedTest.java @@ -0,0 +1,26 @@ +package com.example.swingarmapp_sandblast; + +import android.content.Context; + +import androidx.test.platform.app.InstrumentationRegistry; +import androidx.test.ext.junit.runners.AndroidJUnit4; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import static org.junit.Assert.*; + +/** + * Instrumented test, which will execute on an Android device. + * + * @see 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..06d4d63 --- /dev/null +++ b/app/src/main/AndroidManifest.xml @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ 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..5590c14 --- /dev/null +++ b/app/src/main/java/bsp_Error.proto @@ -0,0 +1,45 @@ +syntax = "proto3"; + +option java_multiple_files = false; +option java_package = "com.example.swingarmapp_sandblast.models"; + + message ErrorDataInfo + { + int32 Error_Value = 1; + bytes Error_Name=4; + } + + +message ErrorData +{ + int32 ErrorCode=1; + int32 Motor_1_Error=21; + int32 Motor_2_Error=22; + int32 Motor_3_Error=23; + int32 Motor_4_Error=24; + int32 Motor_5_Error=25; + int32 Motor_6_Error=26; + int32 Motor_7_Error=27; +} + +enum ComError //枚举消息类型 + { + Mk32_SBus =0; //proto3版本中,首成员必须为0,成员不应有相同的值 + MK32_Serial =1; + MK32_InitialState =2; + TL720D =3; + + ZQ_CAN_ID1_LeftMotor =4; + ZQ_CAN_ID2_RightMotor =5; + ZQ_CAN_ID3_SwingMotor =6; + Force_Sensor =7; + Mfog40 =8; + Ultrasonic_Sensor =9; + + } + +//protoc --nanopb_out=. *.proto + + + + diff --git a/app/src/main/java/bsp_IV.options b/app/src/main/java/bsp_IV.options new file mode 100644 index 0000000..ba860c4 --- /dev/null +++ b/app/src/main/java/bsp_IV.options @@ -0,0 +1,2 @@ +# lock.options +IV_struct_define.Buff_Data max_size:30 fixed_length:true \ No newline at end of file diff --git a/app/src/main/java/bsp_IV.proto b/app/src/main/java/bsp_IV.proto new file mode 100644 index 0000000..d48bca4 --- /dev/null +++ b/app/src/main/java/bsp_IV.proto @@ -0,0 +1,22 @@ +syntax = "proto3"; + +option java_multiple_files = false; +option java_package = "com.example.swingarmapp_sandblast.models"; + +message IV_struct_define +{ + int32 LeftCompensation= 1;//发送100显示1° + int32 RightCompensation= 2;//发送100显示1° + int32 Robot_Move_Deri_Speed= 3;//发送100显示10m/min + int32 Robot_Gyro= 4;//发送100显示1° + int32 Distance_Sensor=5; //发送100显示10cm + int32 SystemError=6;//硬件通讯错误及按键未初始化错误 + int32 Left_Motor_Err=7;//左轮电机报警 + int32 Right_Motor_Err=8;//右轮电机报警 + int32 Swing_Motor_Err=9;//摆臂电机报警 + int32 Is_Online=10;//是否在线 + int32 Spara_Data_1=11;//备用数据1 + int32 Spara_Data_2=12;//备用数据2 + int32 Spara_Data_3=13;//备用数据3 +}; + diff --git a/app/src/main/java/bsp_PV.proto b/app/src/main/java/bsp_PV.proto new file mode 100644 index 0000000..997e078 --- /dev/null +++ b/app/src/main/java/bsp_PV.proto @@ -0,0 +1,22 @@ +syntax = "proto3"; +option java_multiple_files = false; +option java_package = "com.example.swingarmapp_sandblast.models"; +message PV_struct_define{ + int32 Robot_Operation_Mode= 1; //操作模式 手动模式1 2 3 4 自动模式5 6 7 + int32 Robot_Move_Speed=2; //机器人移动速度 + int32 Robot_Change_Lane_Distance= 3; //换道距离 + int32 Robot_Swing_Speed= 4; //摆臂速度 + int32 Robot_symmetricalOrNot=5; //摆臂角度界面中的对称or非对称 1 对称 2 非对称 + int32 Robot_Swing_Range_Angle=6; //对称下的摆臂角度 + int32 Robot_asymmetricalAngleSetValue=7; //非对称条件下下 1左侧 2 右侧 + int32 Robot_backMode=8; //后退设置模式 1 打退交替 2 边打边退 + int32 Robot_Back_Distance= 9; //打退交替条件下的后退距离 + int32 Robot_Back_Speed=10; //边打边退条件下的后退速度 + int32 Robot_Press_Set= 11; //压力设置 + int32 Robot_Vertical_Adjust= 12; //竖直微调 + int32 Robot_Length_Homework=13; //自动模式下的作业长度 + int32 Robot_Width_Homework=14; //自动模式下的作业宽度 + int32 Robot_SandBalst_Encode_One=15; //喷砂机编码1 输入为空发1 + int32 Robot_SandBalst_Encode_Two=16; //喷砂机编码2 输入为空发2 +}; + diff --git a/app/src/main/java/com/example/swingarmapp_sandblast/MainActivity.java b/app/src/main/java/com/example/swingarmapp_sandblast/MainActivity.java new file mode 100644 index 0000000..4f5a899 --- /dev/null +++ b/app/src/main/java/com/example/swingarmapp_sandblast/MainActivity.java @@ -0,0 +1,585 @@ +package com.example.swingarmapp_sandblast; + +import androidx.appcompat.app.AppCompatActivity; +import androidx.databinding.DataBindingUtil; + +import android.os.Bundle; +import android.text.Editable; +import android.text.InputFilter; +import android.text.TextUtils; +import android.text.TextWatcher; +import android.view.View; +import android.view.WindowManager; +import android.widget.Toast; + +import com.example.swingarmapp_sandblast.databinding.ActivityMainBinding; +import com.example.swingarmapp_sandblast.models.DisplayPV; +import com.example.swingarmapp_sandblast.models.DisplaySandBlast; +import com.example.swingarmapp_sandblast.services.DecimalDigitsInputFilter; +import com.example.swingarmapp_sandblast.services.ModbusCRC; +import com.example.swingarmapp_sandblast.services.MyDataHelper; +import com.example.swingarmapp_sandblast.services.PopupHelper; +import com.example.swingarmapp_sandblast.services.USBSerialPortHelper; + +import com.example.swingarmapp_sandblast.models.BspPV; + +import java.util.List; +import java.util.Timer; +import java.util.TimerTask; + +public class MainActivity extends AppCompatActivity { + + public ActivityMainBinding mainBinding;//通过Binding可以获取界面数据 + //USB 串口服务 + public USBSerialPortHelper serialPortHelper;//串口接收类 + private BspPV.PV_struct_define _toSendPV; + + Timer timer = new Timer(); + + public MyDataHelper myDataHelper = new MyDataHelper(this);//数据库类 + public PopupHelper popupHelper = new PopupHelper(this);//对话框类,把主界面实例传过去 + + public static byte[] stopgetAllChData = new byte[]{0x55, 0x66, 0x01, 0x01, 0x00, 0x00, 0x00, 0x42, 0x00, (byte) (0xf7 & 0xff), (byte) (0xe0 & 0xff)}; + public static int sendStopDataCount = 0; + public String _parameters_Call_Value = "1"; //默认1 + public String _Manual_Mode_Call_Value = "无"; // 默认为手动模式 无 模式值1-4 + public String _Auto_Mode_Call_Value = "未启用"; // 默认为未启用 模式值6 7 + public String workLength = "0"; //自动模式下作业长度----->变量存储 + + public String workWidth = "0"; ////自动模式下作业宽度----->变量存储 + + public int symmetricalOrNot = 1; //1对称 2非对称----->变量存储 + + public int asymmetricalAngleSetValue= 0 ; //非对称下的值 0 默认 1 左侧 2 右侧----->变量存储 + + public int backMode = 1 ; // 1 打退交替 2 边打边退----->变量存储 + + public String backSpeedSetValue = "5.0"; // 边打边退速度值----->变量存储 + public boolean isInputGroupActive = true; // 默认对称组激活 --->摆臂角度界面 + public boolean isFirstInputActive = true; // 默认第一个输入框激活--->后退界面 + + + + @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.MaintvVerticalAdjustTo32.setFilters(new InputFilter[]{new DecimalDigitsInputFilter()}); //editext 一位小数限制 + mainBinding.MaintvMoveSpeedTo32.setFilters(new InputFilter[]{new DecimalDigitsInputFilter() }); + + /* USB串口 控制区域*/ + serialPortHelper = new USBSerialPortHelper(this); + serialPortHelper.intialize(); + serialPortHelper.connect(); + + +// //程序初始化,读取数据库,进行界面显示 + myDataHelper.IntializeDataBase(); + String parame = mainBinding.MaintvParameterCallTo32.getText().toString(); //获取界面参数调用值 + //读取数据 + int paraIndex = Integer.parseInt(parame); + List pvList = myDataHelper.getDisplayData(paraIndex); //按id查询数据赋值给界面 + + mainBinding.MaintvSwingArmAngleTo32.setText(String.valueOf(pvList.get(0).getSwingArmAngle())); + mainBinding.MaintvSwingArmSpeedTo32.setText(String.valueOf(pvList.get(0).getSwingArmSpeed())); + mainBinding.MaintvBackDistanceTo32.setText(String.valueOf(pvList.get(0).getBackDistance())); + mainBinding.MaintvLaneChangeDistanceTo32.setText(String.valueOf(pvList.get(0).getLaneChangeDistance())); + mainBinding.MaintvPressTo32.setText(String.valueOf(pvList.get(0).getPressSet())); + mainBinding.MaintvVerticalAdjustTo32.setText(String.valueOf(pvList.get(0).getVerticalAdjust())); + backSpeedSetValue=String.valueOf(pvList.get(0).getBackSpeedValue()); + workLength=String.valueOf(pvList.get(0).getWorkLength()); + workWidth=String.valueOf(pvList.get(0).getWorkWidth()); + + /***读取喷砂机编码设置**/ + ListdsbList = myDataHelper.getDisplayData_sandBalst(); //按id查询数据赋值给界面 + mainBinding.MaintvSandCodeOneTo32.setText(String.valueOf(dsbList.get(0).getsand_encodeone())); + mainBinding.MaintvSandCodeTwoTo32.setText(String.valueOf(dsbList.get(0).getsand_encodetwo())); + + + + /*发往32*/ + timer.schedule(new TimerTask() { + @Override + public void run() { + // 使用 Handler 或 runOnUiThread 更新 UI + runOnUiThread(new Runnable() { + @Override + public void run() { + // 更新 UI 的代码 + _toSendPV = BspPV.PV_struct_define.newBuilder() + .setRobotOperationMode(1) + .setRobotMoveSpeed(0) + .setRobotChangeLaneDistance(0) + .setRobotSwingSpeed(0) + .setRobotSymmetricalOrNot(1) + .setRobotSwingRangeAngle(0) + .setRobotAsymmetricalAngleSetValue(1) + .setRobotBackMode(1) + .setRobotBackDistance(0) + .setRobotBackSpeed(0) + .setRobotPressSet(0) + .setRobotVerticalAdjust(0) + .setRobotLengthHomework(0) + .setRobotWidthHomework(0) + .build(); + + + String MoveSpeedStr = mainBinding.MaintvMoveSpeedTo32.getText().toString(); + String ChangeLaneDistanceStr = mainBinding.MaintvLaneChangeDistanceTo32.getText().toString(); + String SwingSpeedStr = mainBinding.MaintvSwingArmSpeedTo32.getText().toString(); + String SwingRangeAngleStr = mainBinding.MaintvSwingArmAngleTo32.getText().toString(); + String BackDistanceStr = mainBinding.MaintvBackDistanceTo32.getText().toString(); + String PressStr = mainBinding.MaintvPressTo32.getText().toString(); + String VeticalAdjustStr = mainBinding.MaintvVerticalAdjustTo32.getText().toString(); + String SandBlastOneStr = mainBinding.MaintvSandCodeOneTo32.getText().toString(); + String SandBlastTwoStr = mainBinding.MaintvSandCodeTwoTo32.getText().toString(); + if(SandBlastOneStr.isEmpty() ){_toSendPV.toBuilder() + .setRobotSandBalstEncodeOne(1).build(); + } + else { + _toSendPV = _toSendPV.toBuilder() + .setRobotSandBalstEncodeOne((Integer.parseInt(String.valueOf(mainBinding.MaintvSandCodeOneTo32.getText())))).build(); + } + + if(SandBlastTwoStr.isEmpty() ){_toSendPV.toBuilder() + .setRobotSandBalstEncodeTwo(2).build(); + } + else { + _toSendPV = _toSendPV.toBuilder() + .setRobotSandBalstEncodeTwo((Integer.parseInt(String.valueOf(mainBinding.MaintvSandCodeTwoTo32.getText())))).build(); + } + + //移动速度 + try { + if( MoveSpeedStr.isEmpty() ) {_toSendPV = _toSendPV.toBuilder().setRobotMoveSpeed(1).build();} + else { _toSendPV = _toSendPV.toBuilder() + .setRobotMoveSpeed( (int) (Double.parseDouble(String.valueOf(mainBinding.MaintvMoveSpeedTo32.getText()))*10 )).build(); + } + } + catch (Exception e) + { + + } + + //换道距离 + if( ChangeLaneDistanceStr.isEmpty() ) {_toSendPV = _toSendPV.toBuilder().setRobotChangeLaneDistance(1).build();} + else { _toSendPV = _toSendPV.toBuilder() + .setRobotChangeLaneDistance((Integer.parseInt(String.valueOf(mainBinding.MaintvLaneChangeDistanceTo32.getText())))).build();} + //摆臂速度 + if( SwingSpeedStr.isEmpty() ) {_toSendPV = _toSendPV.toBuilder().setRobotSwingSpeed(1).build();} + else { _toSendPV = _toSendPV.toBuilder() + .setRobotSwingSpeed((Integer.parseInt(String.valueOf(mainBinding.MaintvSwingArmSpeedTo32.getText())))).build();} + //摆臂角度 + if( SwingRangeAngleStr.isEmpty() ) {_toSendPV = _toSendPV.toBuilder().setRobotSwingRangeAngle(1).build();} + else { _toSendPV = _toSendPV.toBuilder() + .setRobotSwingRangeAngle((Integer.parseInt(String.valueOf(mainBinding.MaintvSwingArmAngleTo32.getText())))).build();} + + _toSendPV = _toSendPV.toBuilder().setRobotBackMode(backMode).build(); //1 打退交替 2 边打边退 + _toSendPV = _toSendPV.toBuilder().setRobotBackSpeed( (int) (Double.parseDouble(backSpeedSetValue)*10) ).build(); //边打边退的后退速度 *10 + _toSendPV = _toSendPV.toBuilder().setRobotSymmetricalOrNot(symmetricalOrNot).build(); //1 对称 2//非对称 + _toSendPV = _toSendPV.toBuilder().setRobotAsymmetricalAngleSetValue(asymmetricalAngleSetValue).build(); //非对称下左侧右侧值 1 左 2右 + _toSendPV = _toSendPV.toBuilder().setRobotLengthHomework(Integer.parseInt(workLength)).build(); //作业长度 + _toSendPV = _toSendPV.toBuilder().setRobotWidthHomework(Integer.parseInt(workWidth)).build(); //作业宽度 + + //后退距离 + try { + if( BackDistanceStr.isEmpty() ) {_toSendPV = _toSendPV.toBuilder().setRobotBackDistance(1).build();} + else { _toSendPV = _toSendPV.toBuilder() + .setRobotBackDistance( (int) (Double.parseDouble(String.valueOf(mainBinding.MaintvBackDistanceTo32.getText()))*10 )).build(); + } + } catch (Exception e) { + + } + try { + //压力设定 + if( PressStr.isEmpty() ) {_toSendPV = _toSendPV.toBuilder().setRobotPressSet(1).build();} + else { _toSendPV = _toSendPV.toBuilder() + .setRobotPressSet((Integer.parseInt(String.valueOf(mainBinding.MaintvPressTo32.getText())))).build();} + }catch (Exception e) { + + } + + //竖直微调--小数 *10 + try { + + if( VeticalAdjustStr.isEmpty() ) {_toSendPV = _toSendPV.toBuilder().setRobotVerticalAdjust(0).build();} + else { _toSendPV = _toSendPV.toBuilder() + .setRobotVerticalAdjust( (int) (Double.parseDouble(String.valueOf(mainBinding.MaintvVerticalAdjustTo32.getText()))*10 )) .build(); + + } + + } catch (Exception e) { + + } + + + //自动手动模式发送 + + if(_Manual_Mode_Call_Value.equals("未启用")) //手动模式未启用 + { + //发送自动模式值 + if(_Auto_Mode_Call_Value.equals("水平")) + { + _toSendPV = _toSendPV.toBuilder().setRobotOperationMode(6).build(); + } else if(_Auto_Mode_Call_Value.equals("平面")) { + _toSendPV = _toSendPV.toBuilder().setRobotOperationMode(7).build(); + } + + } + else if(_Auto_Mode_Call_Value.equals("未启用")) //自动模式未启用 + { + //发送手动模式值 + if (_Manual_Mode_Call_Value.equals("无")) { + _toSendPV = _toSendPV.toBuilder().setRobotOperationMode(1).build(); + } else if (_Manual_Mode_Call_Value.equals("水平")) { + _toSendPV = _toSendPV.toBuilder().setRobotOperationMode(2).build(); + } else if (_Manual_Mode_Call_Value.equals("平面")) { + _toSendPV = _toSendPV.toBuilder().setRobotOperationMode(3).build(); + } else if (_Manual_Mode_Call_Value.equals("竖直向左")) { + _toSendPV = _toSendPV.toBuilder().setRobotOperationMode(4).build(); + } + else if (_Manual_Mode_Call_Value.equals("竖直向右")) { + _toSendPV = _toSendPV.toBuilder().setRobotOperationMode(5).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, 1000); // 延迟 0 毫秒,每隔 1000 毫秒执行一次 + + + + + + //三个弹窗选择界面 + mainBinding.setManualModeBtn.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + popupHelper.ManualModePopup(this); + } + }); + + mainBinding.setAutoModeBtn.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + popupHelper.AutoModePopup(this); + } + }); + + mainBinding.setSwingArmAngleBtn.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + popupHelper.SwingArmPopup(); + } + }); + + mainBinding.setBackDistanceBtn.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + popupHelper.BackSetPopup(); + } + }); + + mainBinding.setcallParametersBtn.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + popupHelper.ParametersCallPopup(this,myDataHelper); + } + }); + mainBinding.mainViewErrMessageBtn.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + popupHelper.RobotErrorListPopUp(this); + } + }); + + + + //移动速度事件 + mainBinding.MaintvMoveSpeedTo32.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(); + double value=0.0; + + if (!input.isEmpty()) { + try { + value = Double.parseDouble(input); + // 检查输入值是否在 -50 到 100 范围内 + if (value <= 0 || value > 14) { + showToast("请输入 0 到 14 之间的数字"); + // 可以选择清除输入或限制在范围内 + mainBinding.MaintvMoveSpeedTo32.setText(""); + + } else { + showToast("输入有效: " + value); + + } + } catch (NumberFormatException e) { + showToast("请输入有效的数字"); + } + } + + } + + }); + //换道距离事件 + mainBinding.MaintvLaneChangeDistanceTo32.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 > 250) { + showToast("请输入 0 到 250 之间的数字"); + // 可以选择清除输入或限制在范围内 + mainBinding.MaintvLaneChangeDistanceTo32.setText(""); + } else { + showToast("输入有效: " + value); + } + } catch (NumberFormatException e) { + showToast("请输入有效的数字"); + } + } + + + } + }); + //摆臂速度 + mainBinding.MaintvSwingArmSpeedTo32.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 > 60) { + showToast("请输入 0 到 60 之间的数字"); + // 可以选择清除输入或限制在范围内 + mainBinding.MaintvSwingArmSpeedTo32.setText(""); + } else { + showToast("输入有效: " + value); + } + } catch (NumberFormatException e) { + showToast("请输入有效的数字"); + } + } + + } + }); + + + //压力设定 + mainBinding.MaintvPressTo32.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 < -3000 || value > 3000) { + showToast("请输入 -3000 到 3000 之间的数字"); + // 可以选择清除输入或限制在范围内 + mainBinding.MaintvPressTo32.setText(""); + } else { + showToast("输入有效: " + value); + } + } catch (NumberFormatException e) { + showToast("请输入有效的数字"); + } + } + } + }); + //竖直微调 + mainBinding.MaintvVerticalAdjustTo32.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 { + + int value = Integer.parseInt(input); + // 检查输入值是否在 -50 到 100 范围内 + if (value < -10 || value > 10) { + showToast("请输入 -10 到 10 之间的数字"); + // 可以选择清除输入或限制在范围内 + mainBinding.MaintvVerticalAdjustTo32.setText(""); + } else { + showToast("输入有效: " + value); + } + // 尝试转换为double(处理小数) + //lastValidValue = Double.parseDouble(input); + } catch (NumberFormatException e) { + // 中间状态,忽略 + } + } + + + + + + + + + + + + } + }); + + //喷砂机设置按钮 + mainBinding.setSandBlastBtn.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + int paraIndex = 1; + int sandBlastone = Integer.parseInt(mainBinding.MaintvSandCodeOneTo32.getText().toString()); + int sandBlasttwo = Integer.parseInt(mainBinding.MaintvSandCodeTwoTo32.getText().toString()); + + //把界面中的值放进PV类的变量中 + DisplaySandBlast displaysb = new DisplaySandBlast(paraIndex, sandBlastone,sandBlasttwo); + myDataHelper.addOrUpdateDisplayData_SandBlast(displaysb); //创建数据库的实例在这里 PV传进去保存到数据库 + showToast("保存成功"); + } + }); + } //oncreate + + +//函数定义放create外 +private void showToast(String message) +{ + Toast.makeText(this, message, Toast.LENGTH_SHORT).show(); +} + + + + + + @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(); + } + } + + +} \ No newline at end of file diff --git a/app/src/main/java/com/example/swingarmapp_sandblast/models/BspError.java b/app/src/main/java/com/example/swingarmapp_sandblast/models/BspError.java new file mode 100644 index 0000000..c1fed8e --- /dev/null +++ b/app/src/main/java/com/example/swingarmapp_sandblast/models/BspError.java @@ -0,0 +1,1724 @@ +// 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.swingarmapp_sandblast.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 { + /** + *
+     * proto3版本中,首成员必须为0,成员不应有相同的值
+     * 
+ * + * Mk32_SBus = 0; + */ + Mk32_SBus(0), + /** + * MK32_Serial = 1; + */ + MK32_Serial(1), + /** + * MK32_InitialState = 2; + */ + MK32_InitialState(2), + /** + * TL720D = 3; + */ + TL720D(3), + /** + * ZQ_CAN_ID1_LeftMotor = 4; + */ + ZQ_CAN_ID1_LeftMotor(4), + /** + * ZQ_CAN_ID2_RightMotor = 5; + */ + ZQ_CAN_ID2_RightMotor(5), + /** + * ZQ_CAN_ID3_SwingMotor = 6; + */ + ZQ_CAN_ID3_SwingMotor(6), + /** + * Force_Sensor = 7; + */ + Force_Sensor(7), + /** + * Mfog40 = 8; + */ + Mfog40(8), + /** + * Ultrasonic_Sensor = 9; + */ + Ultrasonic_Sensor(9), + UNRECOGNIZED(-1), + ; + + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 27, + /* patch= */ 2, + /* suffix= */ "", + ComError.class.getName()); + } + /** + *
+     * proto3版本中,首成员必须为0,成员不应有相同的值
+     * 
+ * + * Mk32_SBus = 0; + */ + public static final int Mk32_SBus_VALUE = 0; + /** + * MK32_Serial = 1; + */ + public static final int MK32_Serial_VALUE = 1; + /** + * MK32_InitialState = 2; + */ + public static final int MK32_InitialState_VALUE = 2; + /** + * TL720D = 3; + */ + public static final int TL720D_VALUE = 3; + /** + * ZQ_CAN_ID1_LeftMotor = 4; + */ + public static final int ZQ_CAN_ID1_LeftMotor_VALUE = 4; + /** + * ZQ_CAN_ID2_RightMotor = 5; + */ + public static final int ZQ_CAN_ID2_RightMotor_VALUE = 5; + /** + * ZQ_CAN_ID3_SwingMotor = 6; + */ + public static final int ZQ_CAN_ID3_SwingMotor_VALUE = 6; + /** + * Force_Sensor = 7; + */ + public static final int Force_Sensor_VALUE = 7; + /** + * Mfog40 = 8; + */ + public static final int Mfog40_VALUE = 8; + /** + * Ultrasonic_Sensor = 9; + */ + public static final int Ultrasonic_Sensor_VALUE = 9; + + + 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 MK32_Serial; + case 2: return MK32_InitialState; + case 3: return TL720D; + case 4: return ZQ_CAN_ID1_LeftMotor; + case 5: return ZQ_CAN_ID2_RightMotor; + case 6: return ZQ_CAN_ID3_SwingMotor; + case 7: return Force_Sensor; + case 8: return Mfog40; + case 9: return Ultrasonic_Sensor; + 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.swingarmapp_sandblast.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 ErrorDataInfoOrBuilder extends + // @@protoc_insertion_point(interface_extends:ErrorDataInfo) + com.google.protobuf.MessageOrBuilder { + + /** + * int32 Error_Value = 1; + * @return The errorValue. + */ + int getErrorValue(); + + /** + * bytes Error_Name = 4; + * @return The errorName. + */ + com.google.protobuf.ByteString getErrorName(); + } + /** + * Protobuf type {@code ErrorDataInfo} + */ + public static final class ErrorDataInfo extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:ErrorDataInfo) + ErrorDataInfoOrBuilder { + 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= */ "", + ErrorDataInfo.class.getName()); + } + // Use ErrorDataInfo.newBuilder() to construct. + private ErrorDataInfo(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + private ErrorDataInfo() { + errorName_ = com.google.protobuf.ByteString.EMPTY; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.example.swingarmapp_sandblast.models.BspError.internal_static_ErrorDataInfo_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.example.swingarmapp_sandblast.models.BspError.internal_static_ErrorDataInfo_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.example.swingarmapp_sandblast.models.BspError.ErrorDataInfo.class, com.example.swingarmapp_sandblast.models.BspError.ErrorDataInfo.Builder.class); + } + + public static final int ERROR_VALUE_FIELD_NUMBER = 1; + private int errorValue_ = 0; + /** + * int32 Error_Value = 1; + * @return The errorValue. + */ + @java.lang.Override + public int getErrorValue() { + return errorValue_; + } + + public static final int ERROR_NAME_FIELD_NUMBER = 4; + private com.google.protobuf.ByteString errorName_ = com.google.protobuf.ByteString.EMPTY; + /** + * bytes Error_Name = 4; + * @return The errorName. + */ + @java.lang.Override + public com.google.protobuf.ByteString getErrorName() { + return errorName_; + } + + 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 (errorValue_ != 0) { + output.writeInt32(1, errorValue_); + } + if (!errorName_.isEmpty()) { + output.writeBytes(4, errorName_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (errorValue_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(1, errorValue_); + } + if (!errorName_.isEmpty()) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(4, errorName_); + } + 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.swingarmapp_sandblast.models.BspError.ErrorDataInfo)) { + return super.equals(obj); + } + com.example.swingarmapp_sandblast.models.BspError.ErrorDataInfo other = (com.example.swingarmapp_sandblast.models.BspError.ErrorDataInfo) obj; + + if (getErrorValue() + != other.getErrorValue()) return false; + if (!getErrorName() + .equals(other.getErrorName())) 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) + ERROR_VALUE_FIELD_NUMBER; + hash = (53 * hash) + getErrorValue(); + hash = (37 * hash) + ERROR_NAME_FIELD_NUMBER; + hash = (53 * hash) + getErrorName().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.example.swingarmapp_sandblast.models.BspError.ErrorDataInfo parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.example.swingarmapp_sandblast.models.BspError.ErrorDataInfo parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.example.swingarmapp_sandblast.models.BspError.ErrorDataInfo parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.example.swingarmapp_sandblast.models.BspError.ErrorDataInfo 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.swingarmapp_sandblast.models.BspError.ErrorDataInfo parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.example.swingarmapp_sandblast.models.BspError.ErrorDataInfo parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.example.swingarmapp_sandblast.models.BspError.ErrorDataInfo parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static com.example.swingarmapp_sandblast.models.BspError.ErrorDataInfo 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.swingarmapp_sandblast.models.BspError.ErrorDataInfo parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input); + } + + public static com.example.swingarmapp_sandblast.models.BspError.ErrorDataInfo 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.swingarmapp_sandblast.models.BspError.ErrorDataInfo parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static com.example.swingarmapp_sandblast.models.BspError.ErrorDataInfo 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.swingarmapp_sandblast.models.BspError.ErrorDataInfo 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 ErrorDataInfo} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder implements + // @@protoc_insertion_point(builder_implements:ErrorDataInfo) + com.example.swingarmapp_sandblast.models.BspError.ErrorDataInfoOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.example.swingarmapp_sandblast.models.BspError.internal_static_ErrorDataInfo_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.example.swingarmapp_sandblast.models.BspError.internal_static_ErrorDataInfo_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.example.swingarmapp_sandblast.models.BspError.ErrorDataInfo.class, com.example.swingarmapp_sandblast.models.BspError.ErrorDataInfo.Builder.class); + } + + // Construct using com.example.swingarmapp_sandblast.models.BspError.ErrorDataInfo.newBuilder() + private Builder() { + + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + errorValue_ = 0; + errorName_ = com.google.protobuf.ByteString.EMPTY; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.example.swingarmapp_sandblast.models.BspError.internal_static_ErrorDataInfo_descriptor; + } + + @java.lang.Override + public com.example.swingarmapp_sandblast.models.BspError.ErrorDataInfo getDefaultInstanceForType() { + return com.example.swingarmapp_sandblast.models.BspError.ErrorDataInfo.getDefaultInstance(); + } + + @java.lang.Override + public com.example.swingarmapp_sandblast.models.BspError.ErrorDataInfo build() { + com.example.swingarmapp_sandblast.models.BspError.ErrorDataInfo result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.example.swingarmapp_sandblast.models.BspError.ErrorDataInfo buildPartial() { + com.example.swingarmapp_sandblast.models.BspError.ErrorDataInfo result = new com.example.swingarmapp_sandblast.models.BspError.ErrorDataInfo(this); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartial0(com.example.swingarmapp_sandblast.models.BspError.ErrorDataInfo result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.errorValue_ = errorValue_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.errorName_ = errorName_; + } + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.example.swingarmapp_sandblast.models.BspError.ErrorDataInfo) { + return mergeFrom((com.example.swingarmapp_sandblast.models.BspError.ErrorDataInfo)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.example.swingarmapp_sandblast.models.BspError.ErrorDataInfo other) { + if (other == com.example.swingarmapp_sandblast.models.BspError.ErrorDataInfo.getDefaultInstance()) return this; + if (other.getErrorValue() != 0) { + setErrorValue(other.getErrorValue()); + } + if (other.getErrorName() != com.google.protobuf.ByteString.EMPTY) { + setErrorName(other.getErrorName()); + } + 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: { + errorValue_ = input.readInt32(); + bitField0_ |= 0x00000001; + break; + } // case 8 + case 34: { + errorName_ = input.readBytes(); + bitField0_ |= 0x00000002; + break; + } // case 34 + 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 errorValue_ ; + /** + * int32 Error_Value = 1; + * @return The errorValue. + */ + @java.lang.Override + public int getErrorValue() { + return errorValue_; + } + /** + * int32 Error_Value = 1; + * @param value The errorValue to set. + * @return This builder for chaining. + */ + public Builder setErrorValue(int value) { + + errorValue_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * int32 Error_Value = 1; + * @return This builder for chaining. + */ + public Builder clearErrorValue() { + bitField0_ = (bitField0_ & ~0x00000001); + errorValue_ = 0; + onChanged(); + return this; + } + + private com.google.protobuf.ByteString errorName_ = com.google.protobuf.ByteString.EMPTY; + /** + * bytes Error_Name = 4; + * @return The errorName. + */ + @java.lang.Override + public com.google.protobuf.ByteString getErrorName() { + return errorName_; + } + /** + * bytes Error_Name = 4; + * @param value The errorName to set. + * @return This builder for chaining. + */ + public Builder setErrorName(com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + errorName_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * bytes Error_Name = 4; + * @return This builder for chaining. + */ + public Builder clearErrorName() { + bitField0_ = (bitField0_ & ~0x00000002); + errorName_ = getDefaultInstance().getErrorName(); + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:ErrorDataInfo) + } + + // @@protoc_insertion_point(class_scope:ErrorDataInfo) + private static final com.example.swingarmapp_sandblast.models.BspError.ErrorDataInfo DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.example.swingarmapp_sandblast.models.BspError.ErrorDataInfo(); + } + + public static com.example.swingarmapp_sandblast.models.BspError.ErrorDataInfo getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ErrorDataInfo 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.swingarmapp_sandblast.models.BspError.ErrorDataInfo getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + + } + + public interface ErrorDataOrBuilder extends + // @@protoc_insertion_point(interface_extends:ErrorData) + com.google.protobuf.MessageOrBuilder { + + /** + * int32 ErrorCode = 1; + * @return The errorCode. + */ + int getErrorCode(); + + /** + * int32 Motor_1_Error = 21; + * @return The motor1Error. + */ + int getMotor1Error(); + + /** + * int32 Motor_2_Error = 22; + * @return The motor2Error. + */ + int getMotor2Error(); + + /** + * int32 Motor_3_Error = 23; + * @return The motor3Error. + */ + int getMotor3Error(); + + /** + * int32 Motor_4_Error = 24; + * @return The motor4Error. + */ + int getMotor4Error(); + + /** + * int32 Motor_5_Error = 25; + * @return The motor5Error. + */ + int getMotor5Error(); + + /** + * int32 Motor_6_Error = 26; + * @return The motor6Error. + */ + int getMotor6Error(); + + /** + * int32 Motor_7_Error = 27; + * @return The motor7Error. + */ + int getMotor7Error(); + } + /** + * 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.swingarmapp_sandblast.models.BspError.internal_static_ErrorData_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.example.swingarmapp_sandblast.models.BspError.internal_static_ErrorData_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.example.swingarmapp_sandblast.models.BspError.ErrorData.class, com.example.swingarmapp_sandblast.models.BspError.ErrorData.Builder.class); + } + + public static final int ERRORCODE_FIELD_NUMBER = 1; + private int errorCode_ = 0; + /** + * int32 ErrorCode = 1; + * @return The errorCode. + */ + @java.lang.Override + public int getErrorCode() { + return errorCode_; + } + + public static final int MOTOR_1_ERROR_FIELD_NUMBER = 21; + private int motor1Error_ = 0; + /** + * int32 Motor_1_Error = 21; + * @return The motor1Error. + */ + @java.lang.Override + public int getMotor1Error() { + return motor1Error_; + } + + public static final int MOTOR_2_ERROR_FIELD_NUMBER = 22; + private int motor2Error_ = 0; + /** + * int32 Motor_2_Error = 22; + * @return The motor2Error. + */ + @java.lang.Override + public int getMotor2Error() { + return motor2Error_; + } + + public static final int MOTOR_3_ERROR_FIELD_NUMBER = 23; + private int motor3Error_ = 0; + /** + * int32 Motor_3_Error = 23; + * @return The motor3Error. + */ + @java.lang.Override + public int getMotor3Error() { + return motor3Error_; + } + + public static final int MOTOR_4_ERROR_FIELD_NUMBER = 24; + private int motor4Error_ = 0; + /** + * int32 Motor_4_Error = 24; + * @return The motor4Error. + */ + @java.lang.Override + public int getMotor4Error() { + return motor4Error_; + } + + public static final int MOTOR_5_ERROR_FIELD_NUMBER = 25; + private int motor5Error_ = 0; + /** + * int32 Motor_5_Error = 25; + * @return The motor5Error. + */ + @java.lang.Override + public int getMotor5Error() { + return motor5Error_; + } + + public static final int MOTOR_6_ERROR_FIELD_NUMBER = 26; + private int motor6Error_ = 0; + /** + * int32 Motor_6_Error = 26; + * @return The motor6Error. + */ + @java.lang.Override + public int getMotor6Error() { + return motor6Error_; + } + + public static final int MOTOR_7_ERROR_FIELD_NUMBER = 27; + private int motor7Error_ = 0; + /** + * int32 Motor_7_Error = 27; + * @return The motor7Error. + */ + @java.lang.Override + public int getMotor7Error() { + return motor7Error_; + } + + 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 (errorCode_ != 0) { + output.writeInt32(1, errorCode_); + } + if (motor1Error_ != 0) { + output.writeInt32(21, motor1Error_); + } + if (motor2Error_ != 0) { + output.writeInt32(22, motor2Error_); + } + if (motor3Error_ != 0) { + output.writeInt32(23, motor3Error_); + } + if (motor4Error_ != 0) { + output.writeInt32(24, motor4Error_); + } + if (motor5Error_ != 0) { + output.writeInt32(25, motor5Error_); + } + if (motor6Error_ != 0) { + output.writeInt32(26, motor6Error_); + } + if (motor7Error_ != 0) { + output.writeInt32(27, motor7Error_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (errorCode_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(1, errorCode_); + } + if (motor1Error_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(21, motor1Error_); + } + if (motor2Error_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(22, motor2Error_); + } + if (motor3Error_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(23, motor3Error_); + } + if (motor4Error_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(24, motor4Error_); + } + if (motor5Error_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(25, motor5Error_); + } + if (motor6Error_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(26, motor6Error_); + } + if (motor7Error_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(27, motor7Error_); + } + 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.swingarmapp_sandblast.models.BspError.ErrorData)) { + return super.equals(obj); + } + com.example.swingarmapp_sandblast.models.BspError.ErrorData other = (com.example.swingarmapp_sandblast.models.BspError.ErrorData) obj; + + if (getErrorCode() + != other.getErrorCode()) return false; + if (getMotor1Error() + != other.getMotor1Error()) return false; + if (getMotor2Error() + != other.getMotor2Error()) return false; + if (getMotor3Error() + != other.getMotor3Error()) return false; + if (getMotor4Error() + != other.getMotor4Error()) return false; + if (getMotor5Error() + != other.getMotor5Error()) return false; + if (getMotor6Error() + != other.getMotor6Error()) return false; + if (getMotor7Error() + != other.getMotor7Error()) 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) + ERRORCODE_FIELD_NUMBER; + hash = (53 * hash) + getErrorCode(); + hash = (37 * hash) + MOTOR_1_ERROR_FIELD_NUMBER; + hash = (53 * hash) + getMotor1Error(); + hash = (37 * hash) + MOTOR_2_ERROR_FIELD_NUMBER; + hash = (53 * hash) + getMotor2Error(); + hash = (37 * hash) + MOTOR_3_ERROR_FIELD_NUMBER; + hash = (53 * hash) + getMotor3Error(); + hash = (37 * hash) + MOTOR_4_ERROR_FIELD_NUMBER; + hash = (53 * hash) + getMotor4Error(); + hash = (37 * hash) + MOTOR_5_ERROR_FIELD_NUMBER; + hash = (53 * hash) + getMotor5Error(); + hash = (37 * hash) + MOTOR_6_ERROR_FIELD_NUMBER; + hash = (53 * hash) + getMotor6Error(); + hash = (37 * hash) + MOTOR_7_ERROR_FIELD_NUMBER; + hash = (53 * hash) + getMotor7Error(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.example.swingarmapp_sandblast.models.BspError.ErrorData parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.example.swingarmapp_sandblast.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.swingarmapp_sandblast.models.BspError.ErrorData parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.example.swingarmapp_sandblast.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.swingarmapp_sandblast.models.BspError.ErrorData parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.example.swingarmapp_sandblast.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.swingarmapp_sandblast.models.BspError.ErrorData parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static com.example.swingarmapp_sandblast.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.swingarmapp_sandblast.models.BspError.ErrorData parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input); + } + + public static com.example.swingarmapp_sandblast.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.swingarmapp_sandblast.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.swingarmapp_sandblast.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.swingarmapp_sandblast.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.swingarmapp_sandblast.models.BspError.ErrorDataOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.example.swingarmapp_sandblast.models.BspError.internal_static_ErrorData_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.example.swingarmapp_sandblast.models.BspError.internal_static_ErrorData_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.example.swingarmapp_sandblast.models.BspError.ErrorData.class, com.example.swingarmapp_sandblast.models.BspError.ErrorData.Builder.class); + } + + // Construct using com.example.swingarmapp_sandblast.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; + errorCode_ = 0; + motor1Error_ = 0; + motor2Error_ = 0; + motor3Error_ = 0; + motor4Error_ = 0; + motor5Error_ = 0; + motor6Error_ = 0; + motor7Error_ = 0; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.example.swingarmapp_sandblast.models.BspError.internal_static_ErrorData_descriptor; + } + + @java.lang.Override + public com.example.swingarmapp_sandblast.models.BspError.ErrorData getDefaultInstanceForType() { + return com.example.swingarmapp_sandblast.models.BspError.ErrorData.getDefaultInstance(); + } + + @java.lang.Override + public com.example.swingarmapp_sandblast.models.BspError.ErrorData build() { + com.example.swingarmapp_sandblast.models.BspError.ErrorData result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.example.swingarmapp_sandblast.models.BspError.ErrorData buildPartial() { + com.example.swingarmapp_sandblast.models.BspError.ErrorData result = new com.example.swingarmapp_sandblast.models.BspError.ErrorData(this); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartial0(com.example.swingarmapp_sandblast.models.BspError.ErrorData result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.errorCode_ = errorCode_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.motor1Error_ = motor1Error_; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.motor2Error_ = motor2Error_; + } + if (((from_bitField0_ & 0x00000008) != 0)) { + result.motor3Error_ = motor3Error_; + } + if (((from_bitField0_ & 0x00000010) != 0)) { + result.motor4Error_ = motor4Error_; + } + if (((from_bitField0_ & 0x00000020) != 0)) { + result.motor5Error_ = motor5Error_; + } + if (((from_bitField0_ & 0x00000040) != 0)) { + result.motor6Error_ = motor6Error_; + } + if (((from_bitField0_ & 0x00000080) != 0)) { + result.motor7Error_ = motor7Error_; + } + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.example.swingarmapp_sandblast.models.BspError.ErrorData) { + return mergeFrom((com.example.swingarmapp_sandblast.models.BspError.ErrorData)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.example.swingarmapp_sandblast.models.BspError.ErrorData other) { + if (other == com.example.swingarmapp_sandblast.models.BspError.ErrorData.getDefaultInstance()) return this; + if (other.getErrorCode() != 0) { + setErrorCode(other.getErrorCode()); + } + if (other.getMotor1Error() != 0) { + setMotor1Error(other.getMotor1Error()); + } + if (other.getMotor2Error() != 0) { + setMotor2Error(other.getMotor2Error()); + } + if (other.getMotor3Error() != 0) { + setMotor3Error(other.getMotor3Error()); + } + if (other.getMotor4Error() != 0) { + setMotor4Error(other.getMotor4Error()); + } + if (other.getMotor5Error() != 0) { + setMotor5Error(other.getMotor5Error()); + } + if (other.getMotor6Error() != 0) { + setMotor6Error(other.getMotor6Error()); + } + if (other.getMotor7Error() != 0) { + setMotor7Error(other.getMotor7Error()); + } + 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: { + errorCode_ = input.readInt32(); + bitField0_ |= 0x00000001; + break; + } // case 8 + case 168: { + motor1Error_ = input.readInt32(); + bitField0_ |= 0x00000002; + break; + } // case 168 + case 176: { + motor2Error_ = input.readInt32(); + bitField0_ |= 0x00000004; + break; + } // case 176 + case 184: { + motor3Error_ = input.readInt32(); + bitField0_ |= 0x00000008; + break; + } // case 184 + case 192: { + motor4Error_ = input.readInt32(); + bitField0_ |= 0x00000010; + break; + } // case 192 + case 200: { + motor5Error_ = input.readInt32(); + bitField0_ |= 0x00000020; + break; + } // case 200 + case 208: { + motor6Error_ = input.readInt32(); + bitField0_ |= 0x00000040; + break; + } // case 208 + case 216: { + motor7Error_ = input.readInt32(); + bitField0_ |= 0x00000080; + break; + } // case 216 + 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 errorCode_ ; + /** + * int32 ErrorCode = 1; + * @return The errorCode. + */ + @java.lang.Override + public int getErrorCode() { + return errorCode_; + } + /** + * int32 ErrorCode = 1; + * @param value The errorCode to set. + * @return This builder for chaining. + */ + public Builder setErrorCode(int value) { + + errorCode_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * int32 ErrorCode = 1; + * @return This builder for chaining. + */ + public Builder clearErrorCode() { + bitField0_ = (bitField0_ & ~0x00000001); + errorCode_ = 0; + onChanged(); + return this; + } + + private int motor1Error_ ; + /** + * int32 Motor_1_Error = 21; + * @return The motor1Error. + */ + @java.lang.Override + public int getMotor1Error() { + return motor1Error_; + } + /** + * int32 Motor_1_Error = 21; + * @param value The motor1Error to set. + * @return This builder for chaining. + */ + public Builder setMotor1Error(int value) { + + motor1Error_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * int32 Motor_1_Error = 21; + * @return This builder for chaining. + */ + public Builder clearMotor1Error() { + bitField0_ = (bitField0_ & ~0x00000002); + motor1Error_ = 0; + onChanged(); + return this; + } + + private int motor2Error_ ; + /** + * int32 Motor_2_Error = 22; + * @return The motor2Error. + */ + @java.lang.Override + public int getMotor2Error() { + return motor2Error_; + } + /** + * int32 Motor_2_Error = 22; + * @param value The motor2Error to set. + * @return This builder for chaining. + */ + public Builder setMotor2Error(int value) { + + motor2Error_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * int32 Motor_2_Error = 22; + * @return This builder for chaining. + */ + public Builder clearMotor2Error() { + bitField0_ = (bitField0_ & ~0x00000004); + motor2Error_ = 0; + onChanged(); + return this; + } + + private int motor3Error_ ; + /** + * int32 Motor_3_Error = 23; + * @return The motor3Error. + */ + @java.lang.Override + public int getMotor3Error() { + return motor3Error_; + } + /** + * int32 Motor_3_Error = 23; + * @param value The motor3Error to set. + * @return This builder for chaining. + */ + public Builder setMotor3Error(int value) { + + motor3Error_ = value; + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + /** + * int32 Motor_3_Error = 23; + * @return This builder for chaining. + */ + public Builder clearMotor3Error() { + bitField0_ = (bitField0_ & ~0x00000008); + motor3Error_ = 0; + onChanged(); + return this; + } + + private int motor4Error_ ; + /** + * int32 Motor_4_Error = 24; + * @return The motor4Error. + */ + @java.lang.Override + public int getMotor4Error() { + return motor4Error_; + } + /** + * int32 Motor_4_Error = 24; + * @param value The motor4Error to set. + * @return This builder for chaining. + */ + public Builder setMotor4Error(int value) { + + motor4Error_ = value; + bitField0_ |= 0x00000010; + onChanged(); + return this; + } + /** + * int32 Motor_4_Error = 24; + * @return This builder for chaining. + */ + public Builder clearMotor4Error() { + bitField0_ = (bitField0_ & ~0x00000010); + motor4Error_ = 0; + onChanged(); + return this; + } + + private int motor5Error_ ; + /** + * int32 Motor_5_Error = 25; + * @return The motor5Error. + */ + @java.lang.Override + public int getMotor5Error() { + return motor5Error_; + } + /** + * int32 Motor_5_Error = 25; + * @param value The motor5Error to set. + * @return This builder for chaining. + */ + public Builder setMotor5Error(int value) { + + motor5Error_ = value; + bitField0_ |= 0x00000020; + onChanged(); + return this; + } + /** + * int32 Motor_5_Error = 25; + * @return This builder for chaining. + */ + public Builder clearMotor5Error() { + bitField0_ = (bitField0_ & ~0x00000020); + motor5Error_ = 0; + onChanged(); + return this; + } + + private int motor6Error_ ; + /** + * int32 Motor_6_Error = 26; + * @return The motor6Error. + */ + @java.lang.Override + public int getMotor6Error() { + return motor6Error_; + } + /** + * int32 Motor_6_Error = 26; + * @param value The motor6Error to set. + * @return This builder for chaining. + */ + public Builder setMotor6Error(int value) { + + motor6Error_ = value; + bitField0_ |= 0x00000040; + onChanged(); + return this; + } + /** + * int32 Motor_6_Error = 26; + * @return This builder for chaining. + */ + public Builder clearMotor6Error() { + bitField0_ = (bitField0_ & ~0x00000040); + motor6Error_ = 0; + onChanged(); + return this; + } + + private int motor7Error_ ; + /** + * int32 Motor_7_Error = 27; + * @return The motor7Error. + */ + @java.lang.Override + public int getMotor7Error() { + return motor7Error_; + } + /** + * int32 Motor_7_Error = 27; + * @param value The motor7Error to set. + * @return This builder for chaining. + */ + public Builder setMotor7Error(int value) { + + motor7Error_ = value; + bitField0_ |= 0x00000080; + onChanged(); + return this; + } + /** + * int32 Motor_7_Error = 27; + * @return This builder for chaining. + */ + public Builder clearMotor7Error() { + bitField0_ = (bitField0_ & ~0x00000080); + motor7Error_ = 0; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:ErrorData) + } + + // @@protoc_insertion_point(class_scope:ErrorData) + private static final com.example.swingarmapp_sandblast.models.BspError.ErrorData DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.example.swingarmapp_sandblast.models.BspError.ErrorData(); + } + + public static com.example.swingarmapp_sandblast.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.swingarmapp_sandblast.models.BspError.ErrorData getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + + } + + private static final com.google.protobuf.Descriptors.Descriptor + internal_static_ErrorDataInfo_descriptor; + private static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_ErrorDataInfo_fieldAccessorTable; + 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\"8\n\rErrorDataInfo\022\023\n\013Er" + + "ror_Value\030\001 \001(\005\022\022\n\nError_Name\030\004 \001(\014\"\277\001\n\t" + + "ErrorData\022\021\n\tErrorCode\030\001 \001(\005\022\025\n\rMotor_1_" + + "Error\030\025 \001(\005\022\025\n\rMotor_2_Error\030\026 \001(\005\022\025\n\rMo" + + "tor_3_Error\030\027 \001(\005\022\025\n\rMotor_4_Error\030\030 \001(\005" + + "\022\025\n\rMotor_5_Error\030\031 \001(\005\022\025\n\rMotor_6_Error" + + "\030\032 \001(\005\022\025\n\rMotor_7_Error\030\033 \001(\005*\322\001\n\010ComErr" + + "or\022\r\n\tMk32_SBus\020\000\022\017\n\013MK32_Serial\020\001\022\025\n\021MK" + + "32_InitialState\020\002\022\n\n\006TL720D\020\003\022\030\n\024ZQ_CAN_" + + "ID1_LeftMotor\020\004\022\031\n\025ZQ_CAN_ID2_RightMotor" + + "\020\005\022\031\n\025ZQ_CAN_ID3_SwingMotor\020\006\022\020\n\014Force_S" + + "ensor\020\007\022\n\n\006Mfog40\020\010\022\025\n\021Ultrasonic_Sensor" + + "\020\tB,\n(com.example.swingarmapp_sandblast." + + "modelsP\000b\006proto3" + }; + descriptor = com.google.protobuf.Descriptors.FileDescriptor + .internalBuildGeneratedFileFrom(descriptorData, + new com.google.protobuf.Descriptors.FileDescriptor[] { + }); + internal_static_ErrorDataInfo_descriptor = + getDescriptor().getMessageTypes().get(0); + internal_static_ErrorDataInfo_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_ErrorDataInfo_descriptor, + new java.lang.String[] { "ErrorValue", "ErrorName", }); + internal_static_ErrorData_descriptor = + getDescriptor().getMessageTypes().get(1); + internal_static_ErrorData_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_ErrorData_descriptor, + new java.lang.String[] { "ErrorCode", "Motor1Error", "Motor2Error", "Motor3Error", "Motor4Error", "Motor5Error", "Motor6Error", "Motor7Error", }); + descriptor.resolveAllFeaturesImmutable(); + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/app/src/main/java/com/example/swingarmapp_sandblast/models/BspIV.java b/app/src/main/java/com/example/swingarmapp_sandblast/models/BspIV.java new file mode 100644 index 0000000..3bea129 --- /dev/null +++ b/app/src/main/java/com/example/swingarmapp_sandblast/models/BspIV.java @@ -0,0 +1,1625 @@ +// 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.swingarmapp_sandblast.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 { + + /** + *
+     * 发送100显示1°
+     * 
+ * + * int32 LeftCompensation = 1; + * @return The leftCompensation. + */ + int getLeftCompensation(); + + /** + *
+     * 发送100显示1°
+     * 
+ * + * int32 RightCompensation = 2; + * @return The rightCompensation. + */ + int getRightCompensation(); + + /** + *
+     * 发送100显示10m/min
+     * 
+ * + * int32 Robot_Move_Deri_Speed = 3; + * @return The robotMoveDeriSpeed. + */ + int getRobotMoveDeriSpeed(); + + /** + *
+     * 发送100显示1°
+     * 
+ * + * int32 Robot_Gyro = 4; + * @return The robotGyro. + */ + int getRobotGyro(); + + /** + *
+     * 发送100显示10cm
+     * 
+ * + * int32 Distance_Sensor = 5; + * @return The distanceSensor. + */ + int getDistanceSensor(); + + /** + *
+     * 硬件通讯错误及按键未初始化错误
+     * 
+ * + * int32 SystemError = 6; + * @return The systemError. + */ + int getSystemError(); + + /** + *
+     * 左轮电机报警
+     * 
+ * + * int32 Left_Motor_Err = 7; + * @return The leftMotorErr. + */ + int getLeftMotorErr(); + + /** + *
+     * 右轮电机报警
+     * 
+ * + * int32 Right_Motor_Err = 8; + * @return The rightMotorErr. + */ + int getRightMotorErr(); + + /** + *
+     * 摆臂电机报警
+     * 
+ * + * int32 Swing_Motor_Err = 9; + * @return The swingMotorErr. + */ + int getSwingMotorErr(); + + /** + *
+     * 是否在线
+     * 
+ * + * int32 Is_Online = 10; + * @return The isOnline. + */ + int getIsOnline(); + + /** + *
+     * 备用数据1
+     * 
+ * + * int32 Spara_Data_1 = 11; + * @return The sparaData1. + */ + int getSparaData1(); + + /** + *
+     * 备用数据2
+     * 
+ * + * int32 Spara_Data_2 = 12; + * @return The sparaData2. + */ + int getSparaData2(); + + /** + *
+     * 备用数据3
+     * 
+ * + * int32 Spara_Data_3 = 13; + * @return The sparaData3. + */ + int getSparaData3(); + } + /** + * 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.swingarmapp_sandblast.models.BspIV.internal_static_IV_struct_define_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.example.swingarmapp_sandblast.models.BspIV.internal_static_IV_struct_define_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.example.swingarmapp_sandblast.models.BspIV.IV_struct_define.class, com.example.swingarmapp_sandblast.models.BspIV.IV_struct_define.Builder.class); + } + + public static final int LEFTCOMPENSATION_FIELD_NUMBER = 1; + private int leftCompensation_ = 0; + /** + *
+     * 发送100显示1°
+     * 
+ * + * int32 LeftCompensation = 1; + * @return The leftCompensation. + */ + @java.lang.Override + public int getLeftCompensation() { + return leftCompensation_; + } + + public static final int RIGHTCOMPENSATION_FIELD_NUMBER = 2; + private int rightCompensation_ = 0; + /** + *
+     * 发送100显示1°
+     * 
+ * + * int32 RightCompensation = 2; + * @return The rightCompensation. + */ + @java.lang.Override + public int getRightCompensation() { + return rightCompensation_; + } + + public static final int ROBOT_MOVE_DERI_SPEED_FIELD_NUMBER = 3; + private int robotMoveDeriSpeed_ = 0; + /** + *
+     * 发送100显示10m/min
+     * 
+ * + * int32 Robot_Move_Deri_Speed = 3; + * @return The robotMoveDeriSpeed. + */ + @java.lang.Override + public int getRobotMoveDeriSpeed() { + return robotMoveDeriSpeed_; + } + + public static final int ROBOT_GYRO_FIELD_NUMBER = 4; + private int robotGyro_ = 0; + /** + *
+     * 发送100显示1°
+     * 
+ * + * int32 Robot_Gyro = 4; + * @return The robotGyro. + */ + @java.lang.Override + public int getRobotGyro() { + return robotGyro_; + } + + public static final int DISTANCE_SENSOR_FIELD_NUMBER = 5; + private int distanceSensor_ = 0; + /** + *
+     * 发送100显示10cm
+     * 
+ * + * int32 Distance_Sensor = 5; + * @return The distanceSensor. + */ + @java.lang.Override + public int getDistanceSensor() { + return distanceSensor_; + } + + public static final int SYSTEMERROR_FIELD_NUMBER = 6; + private int systemError_ = 0; + /** + *
+     * 硬件通讯错误及按键未初始化错误
+     * 
+ * + * int32 SystemError = 6; + * @return The systemError. + */ + @java.lang.Override + public int getSystemError() { + return systemError_; + } + + public static final int LEFT_MOTOR_ERR_FIELD_NUMBER = 7; + private int leftMotorErr_ = 0; + /** + *
+     * 左轮电机报警
+     * 
+ * + * int32 Left_Motor_Err = 7; + * @return The leftMotorErr. + */ + @java.lang.Override + public int getLeftMotorErr() { + return leftMotorErr_; + } + + public static final int RIGHT_MOTOR_ERR_FIELD_NUMBER = 8; + private int rightMotorErr_ = 0; + /** + *
+     * 右轮电机报警
+     * 
+ * + * int32 Right_Motor_Err = 8; + * @return The rightMotorErr. + */ + @java.lang.Override + public int getRightMotorErr() { + return rightMotorErr_; + } + + public static final int SWING_MOTOR_ERR_FIELD_NUMBER = 9; + private int swingMotorErr_ = 0; + /** + *
+     * 摆臂电机报警
+     * 
+ * + * int32 Swing_Motor_Err = 9; + * @return The swingMotorErr. + */ + @java.lang.Override + public int getSwingMotorErr() { + return swingMotorErr_; + } + + public static final int IS_ONLINE_FIELD_NUMBER = 10; + private int isOnline_ = 0; + /** + *
+     * 是否在线
+     * 
+ * + * int32 Is_Online = 10; + * @return The isOnline. + */ + @java.lang.Override + public int getIsOnline() { + return isOnline_; + } + + public static final int SPARA_DATA_1_FIELD_NUMBER = 11; + private int sparaData1_ = 0; + /** + *
+     * 备用数据1
+     * 
+ * + * int32 Spara_Data_1 = 11; + * @return The sparaData1. + */ + @java.lang.Override + public int getSparaData1() { + return sparaData1_; + } + + public static final int SPARA_DATA_2_FIELD_NUMBER = 12; + private int sparaData2_ = 0; + /** + *
+     * 备用数据2
+     * 
+ * + * int32 Spara_Data_2 = 12; + * @return The sparaData2. + */ + @java.lang.Override + public int getSparaData2() { + return sparaData2_; + } + + public static final int SPARA_DATA_3_FIELD_NUMBER = 13; + private int sparaData3_ = 0; + /** + *
+     * 备用数据3
+     * 
+ * + * int32 Spara_Data_3 = 13; + * @return The sparaData3. + */ + @java.lang.Override + public int getSparaData3() { + return sparaData3_; + } + + 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 (leftCompensation_ != 0) { + output.writeInt32(1, leftCompensation_); + } + if (rightCompensation_ != 0) { + output.writeInt32(2, rightCompensation_); + } + if (robotMoveDeriSpeed_ != 0) { + output.writeInt32(3, robotMoveDeriSpeed_); + } + if (robotGyro_ != 0) { + output.writeInt32(4, robotGyro_); + } + if (distanceSensor_ != 0) { + output.writeInt32(5, distanceSensor_); + } + if (systemError_ != 0) { + output.writeInt32(6, systemError_); + } + if (leftMotorErr_ != 0) { + output.writeInt32(7, leftMotorErr_); + } + if (rightMotorErr_ != 0) { + output.writeInt32(8, rightMotorErr_); + } + if (swingMotorErr_ != 0) { + output.writeInt32(9, swingMotorErr_); + } + if (isOnline_ != 0) { + output.writeInt32(10, isOnline_); + } + if (sparaData1_ != 0) { + output.writeInt32(11, sparaData1_); + } + if (sparaData2_ != 0) { + output.writeInt32(12, sparaData2_); + } + if (sparaData3_ != 0) { + output.writeInt32(13, sparaData3_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (leftCompensation_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(1, leftCompensation_); + } + if (rightCompensation_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(2, rightCompensation_); + } + if (robotMoveDeriSpeed_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(3, robotMoveDeriSpeed_); + } + if (robotGyro_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(4, robotGyro_); + } + if (distanceSensor_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(5, distanceSensor_); + } + if (systemError_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(6, systemError_); + } + if (leftMotorErr_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(7, leftMotorErr_); + } + if (rightMotorErr_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(8, rightMotorErr_); + } + if (swingMotorErr_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(9, swingMotorErr_); + } + if (isOnline_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(10, isOnline_); + } + if (sparaData1_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(11, sparaData1_); + } + if (sparaData2_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(12, sparaData2_); + } + if (sparaData3_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(13, sparaData3_); + } + 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.swingarmapp_sandblast.models.BspIV.IV_struct_define)) { + return super.equals(obj); + } + com.example.swingarmapp_sandblast.models.BspIV.IV_struct_define other = (com.example.swingarmapp_sandblast.models.BspIV.IV_struct_define) obj; + + if (getLeftCompensation() + != other.getLeftCompensation()) return false; + if (getRightCompensation() + != other.getRightCompensation()) return false; + if (getRobotMoveDeriSpeed() + != other.getRobotMoveDeriSpeed()) return false; + if (getRobotGyro() + != other.getRobotGyro()) return false; + if (getDistanceSensor() + != other.getDistanceSensor()) return false; + if (getSystemError() + != other.getSystemError()) return false; + if (getLeftMotorErr() + != other.getLeftMotorErr()) return false; + if (getRightMotorErr() + != other.getRightMotorErr()) return false; + if (getSwingMotorErr() + != other.getSwingMotorErr()) return false; + if (getIsOnline() + != other.getIsOnline()) return false; + if (getSparaData1() + != other.getSparaData1()) return false; + if (getSparaData2() + != other.getSparaData2()) return false; + if (getSparaData3() + != other.getSparaData3()) 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) + LEFTCOMPENSATION_FIELD_NUMBER; + hash = (53 * hash) + getLeftCompensation(); + hash = (37 * hash) + RIGHTCOMPENSATION_FIELD_NUMBER; + hash = (53 * hash) + getRightCompensation(); + hash = (37 * hash) + ROBOT_MOVE_DERI_SPEED_FIELD_NUMBER; + hash = (53 * hash) + getRobotMoveDeriSpeed(); + hash = (37 * hash) + ROBOT_GYRO_FIELD_NUMBER; + hash = (53 * hash) + getRobotGyro(); + hash = (37 * hash) + DISTANCE_SENSOR_FIELD_NUMBER; + hash = (53 * hash) + getDistanceSensor(); + hash = (37 * hash) + SYSTEMERROR_FIELD_NUMBER; + hash = (53 * hash) + getSystemError(); + hash = (37 * hash) + LEFT_MOTOR_ERR_FIELD_NUMBER; + hash = (53 * hash) + getLeftMotorErr(); + hash = (37 * hash) + RIGHT_MOTOR_ERR_FIELD_NUMBER; + hash = (53 * hash) + getRightMotorErr(); + hash = (37 * hash) + SWING_MOTOR_ERR_FIELD_NUMBER; + hash = (53 * hash) + getSwingMotorErr(); + hash = (37 * hash) + IS_ONLINE_FIELD_NUMBER; + hash = (53 * hash) + getIsOnline(); + hash = (37 * hash) + SPARA_DATA_1_FIELD_NUMBER; + hash = (53 * hash) + getSparaData1(); + hash = (37 * hash) + SPARA_DATA_2_FIELD_NUMBER; + hash = (53 * hash) + getSparaData2(); + hash = (37 * hash) + SPARA_DATA_3_FIELD_NUMBER; + hash = (53 * hash) + getSparaData3(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.example.swingarmapp_sandblast.models.BspIV.IV_struct_define parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.example.swingarmapp_sandblast.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.swingarmapp_sandblast.models.BspIV.IV_struct_define parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.example.swingarmapp_sandblast.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.swingarmapp_sandblast.models.BspIV.IV_struct_define parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.example.swingarmapp_sandblast.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.swingarmapp_sandblast.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.swingarmapp_sandblast.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.swingarmapp_sandblast.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.swingarmapp_sandblast.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.swingarmapp_sandblast.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.swingarmapp_sandblast.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.swingarmapp_sandblast.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.swingarmapp_sandblast.models.BspIV.IV_struct_defineOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.example.swingarmapp_sandblast.models.BspIV.internal_static_IV_struct_define_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.example.swingarmapp_sandblast.models.BspIV.internal_static_IV_struct_define_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.example.swingarmapp_sandblast.models.BspIV.IV_struct_define.class, com.example.swingarmapp_sandblast.models.BspIV.IV_struct_define.Builder.class); + } + + // Construct using com.example.swingarmapp_sandblast.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; + leftCompensation_ = 0; + rightCompensation_ = 0; + robotMoveDeriSpeed_ = 0; + robotGyro_ = 0; + distanceSensor_ = 0; + systemError_ = 0; + leftMotorErr_ = 0; + rightMotorErr_ = 0; + swingMotorErr_ = 0; + isOnline_ = 0; + sparaData1_ = 0; + sparaData2_ = 0; + sparaData3_ = 0; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.example.swingarmapp_sandblast.models.BspIV.internal_static_IV_struct_define_descriptor; + } + + @java.lang.Override + public com.example.swingarmapp_sandblast.models.BspIV.IV_struct_define getDefaultInstanceForType() { + return com.example.swingarmapp_sandblast.models.BspIV.IV_struct_define.getDefaultInstance(); + } + + @java.lang.Override + public com.example.swingarmapp_sandblast.models.BspIV.IV_struct_define build() { + com.example.swingarmapp_sandblast.models.BspIV.IV_struct_define result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.example.swingarmapp_sandblast.models.BspIV.IV_struct_define buildPartial() { + com.example.swingarmapp_sandblast.models.BspIV.IV_struct_define result = new com.example.swingarmapp_sandblast.models.BspIV.IV_struct_define(this); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartial0(com.example.swingarmapp_sandblast.models.BspIV.IV_struct_define result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.leftCompensation_ = leftCompensation_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.rightCompensation_ = rightCompensation_; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.robotMoveDeriSpeed_ = robotMoveDeriSpeed_; + } + if (((from_bitField0_ & 0x00000008) != 0)) { + result.robotGyro_ = robotGyro_; + } + if (((from_bitField0_ & 0x00000010) != 0)) { + result.distanceSensor_ = distanceSensor_; + } + if (((from_bitField0_ & 0x00000020) != 0)) { + result.systemError_ = systemError_; + } + if (((from_bitField0_ & 0x00000040) != 0)) { + result.leftMotorErr_ = leftMotorErr_; + } + if (((from_bitField0_ & 0x00000080) != 0)) { + result.rightMotorErr_ = rightMotorErr_; + } + if (((from_bitField0_ & 0x00000100) != 0)) { + result.swingMotorErr_ = swingMotorErr_; + } + if (((from_bitField0_ & 0x00000200) != 0)) { + result.isOnline_ = isOnline_; + } + if (((from_bitField0_ & 0x00000400) != 0)) { + result.sparaData1_ = sparaData1_; + } + if (((from_bitField0_ & 0x00000800) != 0)) { + result.sparaData2_ = sparaData2_; + } + if (((from_bitField0_ & 0x00001000) != 0)) { + result.sparaData3_ = sparaData3_; + } + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.example.swingarmapp_sandblast.models.BspIV.IV_struct_define) { + return mergeFrom((com.example.swingarmapp_sandblast.models.BspIV.IV_struct_define)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.example.swingarmapp_sandblast.models.BspIV.IV_struct_define other) { + if (other == com.example.swingarmapp_sandblast.models.BspIV.IV_struct_define.getDefaultInstance()) return this; + if (other.getLeftCompensation() != 0) { + setLeftCompensation(other.getLeftCompensation()); + } + if (other.getRightCompensation() != 0) { + setRightCompensation(other.getRightCompensation()); + } + if (other.getRobotMoveDeriSpeed() != 0) { + setRobotMoveDeriSpeed(other.getRobotMoveDeriSpeed()); + } + if (other.getRobotGyro() != 0) { + setRobotGyro(other.getRobotGyro()); + } + if (other.getDistanceSensor() != 0) { + setDistanceSensor(other.getDistanceSensor()); + } + if (other.getSystemError() != 0) { + setSystemError(other.getSystemError()); + } + if (other.getLeftMotorErr() != 0) { + setLeftMotorErr(other.getLeftMotorErr()); + } + if (other.getRightMotorErr() != 0) { + setRightMotorErr(other.getRightMotorErr()); + } + if (other.getSwingMotorErr() != 0) { + setSwingMotorErr(other.getSwingMotorErr()); + } + if (other.getIsOnline() != 0) { + setIsOnline(other.getIsOnline()); + } + if (other.getSparaData1() != 0) { + setSparaData1(other.getSparaData1()); + } + if (other.getSparaData2() != 0) { + setSparaData2(other.getSparaData2()); + } + if (other.getSparaData3() != 0) { + setSparaData3(other.getSparaData3()); + } + 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: { + leftCompensation_ = input.readInt32(); + bitField0_ |= 0x00000001; + break; + } // case 8 + case 16: { + rightCompensation_ = input.readInt32(); + bitField0_ |= 0x00000002; + break; + } // case 16 + case 24: { + robotMoveDeriSpeed_ = input.readInt32(); + bitField0_ |= 0x00000004; + break; + } // case 24 + case 32: { + robotGyro_ = input.readInt32(); + bitField0_ |= 0x00000008; + break; + } // case 32 + case 40: { + distanceSensor_ = input.readInt32(); + bitField0_ |= 0x00000010; + break; + } // case 40 + case 48: { + systemError_ = input.readInt32(); + bitField0_ |= 0x00000020; + break; + } // case 48 + case 56: { + leftMotorErr_ = input.readInt32(); + bitField0_ |= 0x00000040; + break; + } // case 56 + case 64: { + rightMotorErr_ = input.readInt32(); + bitField0_ |= 0x00000080; + break; + } // case 64 + case 72: { + swingMotorErr_ = input.readInt32(); + bitField0_ |= 0x00000100; + break; + } // case 72 + case 80: { + isOnline_ = input.readInt32(); + bitField0_ |= 0x00000200; + break; + } // case 80 + case 88: { + sparaData1_ = input.readInt32(); + bitField0_ |= 0x00000400; + break; + } // case 88 + case 96: { + sparaData2_ = input.readInt32(); + bitField0_ |= 0x00000800; + break; + } // case 96 + case 104: { + sparaData3_ = 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 leftCompensation_ ; + /** + *
+       * 发送100显示1°
+       * 
+ * + * int32 LeftCompensation = 1; + * @return The leftCompensation. + */ + @java.lang.Override + public int getLeftCompensation() { + return leftCompensation_; + } + /** + *
+       * 发送100显示1°
+       * 
+ * + * int32 LeftCompensation = 1; + * @param value The leftCompensation to set. + * @return This builder for chaining. + */ + public Builder setLeftCompensation(int value) { + + leftCompensation_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + *
+       * 发送100显示1°
+       * 
+ * + * int32 LeftCompensation = 1; + * @return This builder for chaining. + */ + public Builder clearLeftCompensation() { + bitField0_ = (bitField0_ & ~0x00000001); + leftCompensation_ = 0; + onChanged(); + return this; + } + + private int rightCompensation_ ; + /** + *
+       * 发送100显示1°
+       * 
+ * + * int32 RightCompensation = 2; + * @return The rightCompensation. + */ + @java.lang.Override + public int getRightCompensation() { + return rightCompensation_; + } + /** + *
+       * 发送100显示1°
+       * 
+ * + * int32 RightCompensation = 2; + * @param value The rightCompensation to set. + * @return This builder for chaining. + */ + public Builder setRightCompensation(int value) { + + rightCompensation_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + *
+       * 发送100显示1°
+       * 
+ * + * int32 RightCompensation = 2; + * @return This builder for chaining. + */ + public Builder clearRightCompensation() { + bitField0_ = (bitField0_ & ~0x00000002); + rightCompensation_ = 0; + onChanged(); + return this; + } + + private int robotMoveDeriSpeed_ ; + /** + *
+       * 发送100显示10m/min
+       * 
+ * + * int32 Robot_Move_Deri_Speed = 3; + * @return The robotMoveDeriSpeed. + */ + @java.lang.Override + public int getRobotMoveDeriSpeed() { + return robotMoveDeriSpeed_; + } + /** + *
+       * 发送100显示10m/min
+       * 
+ * + * int32 Robot_Move_Deri_Speed = 3; + * @param value The robotMoveDeriSpeed to set. + * @return This builder for chaining. + */ + public Builder setRobotMoveDeriSpeed(int value) { + + robotMoveDeriSpeed_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + *
+       * 发送100显示10m/min
+       * 
+ * + * int32 Robot_Move_Deri_Speed = 3; + * @return This builder for chaining. + */ + public Builder clearRobotMoveDeriSpeed() { + bitField0_ = (bitField0_ & ~0x00000004); + robotMoveDeriSpeed_ = 0; + onChanged(); + return this; + } + + private int robotGyro_ ; + /** + *
+       * 发送100显示1°
+       * 
+ * + * int32 Robot_Gyro = 4; + * @return The robotGyro. + */ + @java.lang.Override + public int getRobotGyro() { + return robotGyro_; + } + /** + *
+       * 发送100显示1°
+       * 
+ * + * int32 Robot_Gyro = 4; + * @param value The robotGyro to set. + * @return This builder for chaining. + */ + public Builder setRobotGyro(int value) { + + robotGyro_ = value; + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + /** + *
+       * 发送100显示1°
+       * 
+ * + * int32 Robot_Gyro = 4; + * @return This builder for chaining. + */ + public Builder clearRobotGyro() { + bitField0_ = (bitField0_ & ~0x00000008); + robotGyro_ = 0; + onChanged(); + return this; + } + + private int distanceSensor_ ; + /** + *
+       * 发送100显示10cm
+       * 
+ * + * int32 Distance_Sensor = 5; + * @return The distanceSensor. + */ + @java.lang.Override + public int getDistanceSensor() { + return distanceSensor_; + } + /** + *
+       * 发送100显示10cm
+       * 
+ * + * int32 Distance_Sensor = 5; + * @param value The distanceSensor to set. + * @return This builder for chaining. + */ + public Builder setDistanceSensor(int value) { + + distanceSensor_ = value; + bitField0_ |= 0x00000010; + onChanged(); + return this; + } + /** + *
+       * 发送100显示10cm
+       * 
+ * + * int32 Distance_Sensor = 5; + * @return This builder for chaining. + */ + public Builder clearDistanceSensor() { + bitField0_ = (bitField0_ & ~0x00000010); + distanceSensor_ = 0; + onChanged(); + return this; + } + + private int systemError_ ; + /** + *
+       * 硬件通讯错误及按键未初始化错误
+       * 
+ * + * int32 SystemError = 6; + * @return The systemError. + */ + @java.lang.Override + public int getSystemError() { + return systemError_; + } + /** + *
+       * 硬件通讯错误及按键未初始化错误
+       * 
+ * + * int32 SystemError = 6; + * @param value The systemError to set. + * @return This builder for chaining. + */ + public Builder setSystemError(int value) { + + systemError_ = value; + bitField0_ |= 0x00000020; + onChanged(); + return this; + } + /** + *
+       * 硬件通讯错误及按键未初始化错误
+       * 
+ * + * int32 SystemError = 6; + * @return This builder for chaining. + */ + public Builder clearSystemError() { + bitField0_ = (bitField0_ & ~0x00000020); + systemError_ = 0; + onChanged(); + return this; + } + + private int leftMotorErr_ ; + /** + *
+       * 左轮电机报警
+       * 
+ * + * int32 Left_Motor_Err = 7; + * @return The leftMotorErr. + */ + @java.lang.Override + public int getLeftMotorErr() { + return leftMotorErr_; + } + /** + *
+       * 左轮电机报警
+       * 
+ * + * int32 Left_Motor_Err = 7; + * @param value The leftMotorErr to set. + * @return This builder for chaining. + */ + public Builder setLeftMotorErr(int value) { + + leftMotorErr_ = value; + bitField0_ |= 0x00000040; + onChanged(); + return this; + } + /** + *
+       * 左轮电机报警
+       * 
+ * + * int32 Left_Motor_Err = 7; + * @return This builder for chaining. + */ + public Builder clearLeftMotorErr() { + bitField0_ = (bitField0_ & ~0x00000040); + leftMotorErr_ = 0; + onChanged(); + return this; + } + + private int rightMotorErr_ ; + /** + *
+       * 右轮电机报警
+       * 
+ * + * int32 Right_Motor_Err = 8; + * @return The rightMotorErr. + */ + @java.lang.Override + public int getRightMotorErr() { + return rightMotorErr_; + } + /** + *
+       * 右轮电机报警
+       * 
+ * + * int32 Right_Motor_Err = 8; + * @param value The rightMotorErr to set. + * @return This builder for chaining. + */ + public Builder setRightMotorErr(int value) { + + rightMotorErr_ = value; + bitField0_ |= 0x00000080; + onChanged(); + return this; + } + /** + *
+       * 右轮电机报警
+       * 
+ * + * int32 Right_Motor_Err = 8; + * @return This builder for chaining. + */ + public Builder clearRightMotorErr() { + bitField0_ = (bitField0_ & ~0x00000080); + rightMotorErr_ = 0; + onChanged(); + return this; + } + + private int swingMotorErr_ ; + /** + *
+       * 摆臂电机报警
+       * 
+ * + * int32 Swing_Motor_Err = 9; + * @return The swingMotorErr. + */ + @java.lang.Override + public int getSwingMotorErr() { + return swingMotorErr_; + } + /** + *
+       * 摆臂电机报警
+       * 
+ * + * int32 Swing_Motor_Err = 9; + * @param value The swingMotorErr to set. + * @return This builder for chaining. + */ + public Builder setSwingMotorErr(int value) { + + swingMotorErr_ = value; + bitField0_ |= 0x00000100; + onChanged(); + return this; + } + /** + *
+       * 摆臂电机报警
+       * 
+ * + * int32 Swing_Motor_Err = 9; + * @return This builder for chaining. + */ + public Builder clearSwingMotorErr() { + bitField0_ = (bitField0_ & ~0x00000100); + swingMotorErr_ = 0; + onChanged(); + return this; + } + + private int isOnline_ ; + /** + *
+       * 是否在线
+       * 
+ * + * int32 Is_Online = 10; + * @return The isOnline. + */ + @java.lang.Override + public int getIsOnline() { + return isOnline_; + } + /** + *
+       * 是否在线
+       * 
+ * + * int32 Is_Online = 10; + * @param value The isOnline to set. + * @return This builder for chaining. + */ + public Builder setIsOnline(int value) { + + isOnline_ = value; + bitField0_ |= 0x00000200; + onChanged(); + return this; + } + /** + *
+       * 是否在线
+       * 
+ * + * int32 Is_Online = 10; + * @return This builder for chaining. + */ + public Builder clearIsOnline() { + bitField0_ = (bitField0_ & ~0x00000200); + isOnline_ = 0; + onChanged(); + return this; + } + + private int sparaData1_ ; + /** + *
+       * 备用数据1
+       * 
+ * + * int32 Spara_Data_1 = 11; + * @return The sparaData1. + */ + @java.lang.Override + public int getSparaData1() { + return sparaData1_; + } + /** + *
+       * 备用数据1
+       * 
+ * + * int32 Spara_Data_1 = 11; + * @param value The sparaData1 to set. + * @return This builder for chaining. + */ + public Builder setSparaData1(int value) { + + sparaData1_ = value; + bitField0_ |= 0x00000400; + onChanged(); + return this; + } + /** + *
+       * 备用数据1
+       * 
+ * + * int32 Spara_Data_1 = 11; + * @return This builder for chaining. + */ + public Builder clearSparaData1() { + bitField0_ = (bitField0_ & ~0x00000400); + sparaData1_ = 0; + onChanged(); + return this; + } + + private int sparaData2_ ; + /** + *
+       * 备用数据2
+       * 
+ * + * int32 Spara_Data_2 = 12; + * @return The sparaData2. + */ + @java.lang.Override + public int getSparaData2() { + return sparaData2_; + } + /** + *
+       * 备用数据2
+       * 
+ * + * int32 Spara_Data_2 = 12; + * @param value The sparaData2 to set. + * @return This builder for chaining. + */ + public Builder setSparaData2(int value) { + + sparaData2_ = value; + bitField0_ |= 0x00000800; + onChanged(); + return this; + } + /** + *
+       * 备用数据2
+       * 
+ * + * int32 Spara_Data_2 = 12; + * @return This builder for chaining. + */ + public Builder clearSparaData2() { + bitField0_ = (bitField0_ & ~0x00000800); + sparaData2_ = 0; + onChanged(); + return this; + } + + private int sparaData3_ ; + /** + *
+       * 备用数据3
+       * 
+ * + * int32 Spara_Data_3 = 13; + * @return The sparaData3. + */ + @java.lang.Override + public int getSparaData3() { + return sparaData3_; + } + /** + *
+       * 备用数据3
+       * 
+ * + * int32 Spara_Data_3 = 13; + * @param value The sparaData3 to set. + * @return This builder for chaining. + */ + public Builder setSparaData3(int value) { + + sparaData3_ = value; + bitField0_ |= 0x00001000; + onChanged(); + return this; + } + /** + *
+       * 备用数据3
+       * 
+ * + * int32 Spara_Data_3 = 13; + * @return This builder for chaining. + */ + public Builder clearSparaData3() { + bitField0_ = (bitField0_ & ~0x00001000); + sparaData3_ = 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.swingarmapp_sandblast.models.BspIV.IV_struct_define DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.example.swingarmapp_sandblast.models.BspIV.IV_struct_define(); + } + + public static com.example.swingarmapp_sandblast.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.swingarmapp_sandblast.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\"\307\002\n\020IV_struct_define\022\030\n\020L" + + "eftCompensation\030\001 \001(\005\022\031\n\021RightCompensati" + + "on\030\002 \001(\005\022\035\n\025Robot_Move_Deri_Speed\030\003 \001(\005\022" + + "\022\n\nRobot_Gyro\030\004 \001(\005\022\027\n\017Distance_Sensor\030\005" + + " \001(\005\022\023\n\013SystemError\030\006 \001(\005\022\026\n\016Left_Motor_" + + "Err\030\007 \001(\005\022\027\n\017Right_Motor_Err\030\010 \001(\005\022\027\n\017Sw" + + "ing_Motor_Err\030\t \001(\005\022\021\n\tIs_Online\030\n \001(\005\022\024" + + "\n\014Spara_Data_1\030\013 \001(\005\022\024\n\014Spara_Data_2\030\014 \001" + + "(\005\022\024\n\014Spara_Data_3\030\r \001(\005B,\n(com.example." + + "swingarmapp_sandblast.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[] { "LeftCompensation", "RightCompensation", "RobotMoveDeriSpeed", "RobotGyro", "DistanceSensor", "SystemError", "LeftMotorErr", "RightMotorErr", "SwingMotorErr", "IsOnline", "SparaData1", "SparaData2", "SparaData3", }); + descriptor.resolveAllFeaturesImmutable(); + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/app/src/main/java/com/example/swingarmapp_sandblast/models/BspPV.java b/app/src/main/java/com/example/swingarmapp_sandblast/models/BspPV.java new file mode 100644 index 0000000..513be80 --- /dev/null +++ b/app/src/main/java/com/example/swingarmapp_sandblast/models/BspPV.java @@ -0,0 +1,1906 @@ +// 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.swingarmapp_sandblast.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 { + + /** + *
+     * 操作模式 手动模式1 2 3 4   自动模式5 6 7
+     * 
+ * + * int32 Robot_Operation_Mode = 1; + * @return The robotOperationMode. + */ + int getRobotOperationMode(); + + /** + *
+     * 机器人移动速度
+     * 
+ * + * int32 Robot_Move_Speed = 2; + * @return The robotMoveSpeed. + */ + int getRobotMoveSpeed(); + + /** + *
+     * 换道距离
+     * 
+ * + * int32 Robot_Change_Lane_Distance = 3; + * @return The robotChangeLaneDistance. + */ + int getRobotChangeLaneDistance(); + + /** + *
+     * 摆臂速度
+     * 
+ * + * int32 Robot_Swing_Speed = 4; + * @return The robotSwingSpeed. + */ + int getRobotSwingSpeed(); + + /** + *
+     * 摆臂角度界面中的对称or非对称 1 对称 2 非对称
+     * 
+ * + * int32 Robot_symmetricalOrNot = 5; + * @return The robotSymmetricalOrNot. + */ + int getRobotSymmetricalOrNot(); + + /** + *
+     * 对称下的摆臂角度
+     * 
+ * + * int32 Robot_Swing_Range_Angle = 6; + * @return The robotSwingRangeAngle. + */ + int getRobotSwingRangeAngle(); + + /** + *
+     * 非对称条件下下  1左侧   2 右侧
+     * 
+ * + * int32 Robot_asymmetricalAngleSetValue = 7; + * @return The robotAsymmetricalAngleSetValue. + */ + int getRobotAsymmetricalAngleSetValue(); + + /** + *
+     * 后退设置模式 1 打退交替 2 边打边退
+     * 
+ * + * int32 Robot_backMode = 8; + * @return The robotBackMode. + */ + int getRobotBackMode(); + + /** + *
+     * 打退交替条件下的后退距离
+     * 
+ * + * int32 Robot_Back_Distance = 9; + * @return The robotBackDistance. + */ + int getRobotBackDistance(); + + /** + *
+     * 边打边退条件下的后退速度
+     * 
+ * + * int32 Robot_Back_Speed = 10; + * @return The robotBackSpeed. + */ + int getRobotBackSpeed(); + + /** + *
+     * 压力设置
+     * 
+ * + * int32 Robot_Press_Set = 11; + * @return The robotPressSet. + */ + int getRobotPressSet(); + + /** + *
+     * 竖直微调
+     * 
+ * + * int32 Robot_Vertical_Adjust = 12; + * @return The robotVerticalAdjust. + */ + int getRobotVerticalAdjust(); + + /** + *
+     * 自动模式下的作业长度
+     * 
+ * + * int32 Robot_Length_Homework = 13; + * @return The robotLengthHomework. + */ + int getRobotLengthHomework(); + + /** + *
+     * 自动模式下的作业宽度
+     * 
+ * + * int32 Robot_Width_Homework = 14; + * @return The robotWidthHomework. + */ + int getRobotWidthHomework(); + + /** + *
+     * 喷砂机编码1
+     * 
+ * + * int32 Robot_SandBalst_Encode_One = 15; + * @return The robotSandBalstEncodeOne. + */ + int getRobotSandBalstEncodeOne(); + + /** + *
+     * 喷砂机编码2
+     * 
+ * + * int32 Robot_SandBalst_Encode_Two = 16; + * @return The robotSandBalstEncodeTwo. + */ + int getRobotSandBalstEncodeTwo(); + } + /** + * 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.swingarmapp_sandblast.models.BspPV.internal_static_PV_struct_define_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.example.swingarmapp_sandblast.models.BspPV.internal_static_PV_struct_define_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.example.swingarmapp_sandblast.models.BspPV.PV_struct_define.class, com.example.swingarmapp_sandblast.models.BspPV.PV_struct_define.Builder.class); + } + + public static final int ROBOT_OPERATION_MODE_FIELD_NUMBER = 1; + private int robotOperationMode_ = 0; + /** + *
+     * 操作模式 手动模式1 2 3 4   自动模式5 6 7
+     * 
+ * + * int32 Robot_Operation_Mode = 1; + * @return The robotOperationMode. + */ + @java.lang.Override + public int getRobotOperationMode() { + return robotOperationMode_; + } + + public static final int ROBOT_MOVE_SPEED_FIELD_NUMBER = 2; + private int robotMoveSpeed_ = 0; + /** + *
+     * 机器人移动速度
+     * 
+ * + * int32 Robot_Move_Speed = 2; + * @return The robotMoveSpeed. + */ + @java.lang.Override + public int getRobotMoveSpeed() { + return robotMoveSpeed_; + } + + public static final int ROBOT_CHANGE_LANE_DISTANCE_FIELD_NUMBER = 3; + private int robotChangeLaneDistance_ = 0; + /** + *
+     * 换道距离
+     * 
+ * + * int32 Robot_Change_Lane_Distance = 3; + * @return The robotChangeLaneDistance. + */ + @java.lang.Override + public int getRobotChangeLaneDistance() { + return robotChangeLaneDistance_; + } + + public static final int ROBOT_SWING_SPEED_FIELD_NUMBER = 4; + private int robotSwingSpeed_ = 0; + /** + *
+     * 摆臂速度
+     * 
+ * + * int32 Robot_Swing_Speed = 4; + * @return The robotSwingSpeed. + */ + @java.lang.Override + public int getRobotSwingSpeed() { + return robotSwingSpeed_; + } + + public static final int ROBOT_SYMMETRICALORNOT_FIELD_NUMBER = 5; + private int robotSymmetricalOrNot_ = 0; + /** + *
+     * 摆臂角度界面中的对称or非对称 1 对称 2 非对称
+     * 
+ * + * int32 Robot_symmetricalOrNot = 5; + * @return The robotSymmetricalOrNot. + */ + @java.lang.Override + public int getRobotSymmetricalOrNot() { + return robotSymmetricalOrNot_; + } + + public static final int ROBOT_SWING_RANGE_ANGLE_FIELD_NUMBER = 6; + private int robotSwingRangeAngle_ = 0; + /** + *
+     * 对称下的摆臂角度
+     * 
+ * + * int32 Robot_Swing_Range_Angle = 6; + * @return The robotSwingRangeAngle. + */ + @java.lang.Override + public int getRobotSwingRangeAngle() { + return robotSwingRangeAngle_; + } + + public static final int ROBOT_ASYMMETRICALANGLESETVALUE_FIELD_NUMBER = 7; + private int robotAsymmetricalAngleSetValue_ = 0; + /** + *
+     * 非对称条件下下  1左侧   2 右侧
+     * 
+ * + * int32 Robot_asymmetricalAngleSetValue = 7; + * @return The robotAsymmetricalAngleSetValue. + */ + @java.lang.Override + public int getRobotAsymmetricalAngleSetValue() { + return robotAsymmetricalAngleSetValue_; + } + + public static final int ROBOT_BACKMODE_FIELD_NUMBER = 8; + private int robotBackMode_ = 0; + /** + *
+     * 后退设置模式 1 打退交替 2 边打边退
+     * 
+ * + * int32 Robot_backMode = 8; + * @return The robotBackMode. + */ + @java.lang.Override + public int getRobotBackMode() { + return robotBackMode_; + } + + public static final int ROBOT_BACK_DISTANCE_FIELD_NUMBER = 9; + private int robotBackDistance_ = 0; + /** + *
+     * 打退交替条件下的后退距离
+     * 
+ * + * int32 Robot_Back_Distance = 9; + * @return The robotBackDistance. + */ + @java.lang.Override + public int getRobotBackDistance() { + return robotBackDistance_; + } + + public static final int ROBOT_BACK_SPEED_FIELD_NUMBER = 10; + private int robotBackSpeed_ = 0; + /** + *
+     * 边打边退条件下的后退速度
+     * 
+ * + * int32 Robot_Back_Speed = 10; + * @return The robotBackSpeed. + */ + @java.lang.Override + public int getRobotBackSpeed() { + return robotBackSpeed_; + } + + public static final int ROBOT_PRESS_SET_FIELD_NUMBER = 11; + private int robotPressSet_ = 0; + /** + *
+     * 压力设置
+     * 
+ * + * int32 Robot_Press_Set = 11; + * @return The robotPressSet. + */ + @java.lang.Override + public int getRobotPressSet() { + return robotPressSet_; + } + + public static final int ROBOT_VERTICAL_ADJUST_FIELD_NUMBER = 12; + private int robotVerticalAdjust_ = 0; + /** + *
+     * 竖直微调
+     * 
+ * + * int32 Robot_Vertical_Adjust = 12; + * @return The robotVerticalAdjust. + */ + @java.lang.Override + public int getRobotVerticalAdjust() { + return robotVerticalAdjust_; + } + + public static final int ROBOT_LENGTH_HOMEWORK_FIELD_NUMBER = 13; + private int robotLengthHomework_ = 0; + /** + *
+     * 自动模式下的作业长度
+     * 
+ * + * int32 Robot_Length_Homework = 13; + * @return The robotLengthHomework. + */ + @java.lang.Override + public int getRobotLengthHomework() { + return robotLengthHomework_; + } + + public static final int ROBOT_WIDTH_HOMEWORK_FIELD_NUMBER = 14; + private int robotWidthHomework_ = 0; + /** + *
+     * 自动模式下的作业宽度
+     * 
+ * + * int32 Robot_Width_Homework = 14; + * @return The robotWidthHomework. + */ + @java.lang.Override + public int getRobotWidthHomework() { + return robotWidthHomework_; + } + + public static final int ROBOT_SANDBALST_ENCODE_ONE_FIELD_NUMBER = 15; + private int robotSandBalstEncodeOne_ = 0; + /** + *
+     * 喷砂机编码1
+     * 
+ * + * int32 Robot_SandBalst_Encode_One = 15; + * @return The robotSandBalstEncodeOne. + */ + @java.lang.Override + public int getRobotSandBalstEncodeOne() { + return robotSandBalstEncodeOne_; + } + + public static final int ROBOT_SANDBALST_ENCODE_TWO_FIELD_NUMBER = 16; + private int robotSandBalstEncodeTwo_ = 0; + /** + *
+     * 喷砂机编码2
+     * 
+ * + * int32 Robot_SandBalst_Encode_Two = 16; + * @return The robotSandBalstEncodeTwo. + */ + @java.lang.Override + public int getRobotSandBalstEncodeTwo() { + return robotSandBalstEncodeTwo_; + } + + 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 (robotOperationMode_ != 0) { + output.writeInt32(1, robotOperationMode_); + } + if (robotMoveSpeed_ != 0) { + output.writeInt32(2, robotMoveSpeed_); + } + if (robotChangeLaneDistance_ != 0) { + output.writeInt32(3, robotChangeLaneDistance_); + } + if (robotSwingSpeed_ != 0) { + output.writeInt32(4, robotSwingSpeed_); + } + if (robotSymmetricalOrNot_ != 0) { + output.writeInt32(5, robotSymmetricalOrNot_); + } + if (robotSwingRangeAngle_ != 0) { + output.writeInt32(6, robotSwingRangeAngle_); + } + if (robotAsymmetricalAngleSetValue_ != 0) { + output.writeInt32(7, robotAsymmetricalAngleSetValue_); + } + if (robotBackMode_ != 0) { + output.writeInt32(8, robotBackMode_); + } + if (robotBackDistance_ != 0) { + output.writeInt32(9, robotBackDistance_); + } + if (robotBackSpeed_ != 0) { + output.writeInt32(10, robotBackSpeed_); + } + if (robotPressSet_ != 0) { + output.writeInt32(11, robotPressSet_); + } + if (robotVerticalAdjust_ != 0) { + output.writeInt32(12, robotVerticalAdjust_); + } + if (robotLengthHomework_ != 0) { + output.writeInt32(13, robotLengthHomework_); + } + if (robotWidthHomework_ != 0) { + output.writeInt32(14, robotWidthHomework_); + } + if (robotSandBalstEncodeOne_ != 0) { + output.writeInt32(15, robotSandBalstEncodeOne_); + } + if (robotSandBalstEncodeTwo_ != 0) { + output.writeInt32(16, robotSandBalstEncodeTwo_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (robotOperationMode_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(1, robotOperationMode_); + } + if (robotMoveSpeed_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(2, robotMoveSpeed_); + } + if (robotChangeLaneDistance_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(3, robotChangeLaneDistance_); + } + if (robotSwingSpeed_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(4, robotSwingSpeed_); + } + if (robotSymmetricalOrNot_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(5, robotSymmetricalOrNot_); + } + if (robotSwingRangeAngle_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(6, robotSwingRangeAngle_); + } + if (robotAsymmetricalAngleSetValue_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(7, robotAsymmetricalAngleSetValue_); + } + if (robotBackMode_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(8, robotBackMode_); + } + if (robotBackDistance_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(9, robotBackDistance_); + } + if (robotBackSpeed_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(10, robotBackSpeed_); + } + if (robotPressSet_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(11, robotPressSet_); + } + if (robotVerticalAdjust_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(12, robotVerticalAdjust_); + } + if (robotLengthHomework_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(13, robotLengthHomework_); + } + if (robotWidthHomework_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(14, robotWidthHomework_); + } + if (robotSandBalstEncodeOne_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(15, robotSandBalstEncodeOne_); + } + if (robotSandBalstEncodeTwo_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(16, robotSandBalstEncodeTwo_); + } + 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.swingarmapp_sandblast.models.BspPV.PV_struct_define)) { + return super.equals(obj); + } + com.example.swingarmapp_sandblast.models.BspPV.PV_struct_define other = (com.example.swingarmapp_sandblast.models.BspPV.PV_struct_define) obj; + + if (getRobotOperationMode() + != other.getRobotOperationMode()) return false; + if (getRobotMoveSpeed() + != other.getRobotMoveSpeed()) return false; + if (getRobotChangeLaneDistance() + != other.getRobotChangeLaneDistance()) return false; + if (getRobotSwingSpeed() + != other.getRobotSwingSpeed()) return false; + if (getRobotSymmetricalOrNot() + != other.getRobotSymmetricalOrNot()) return false; + if (getRobotSwingRangeAngle() + != other.getRobotSwingRangeAngle()) return false; + if (getRobotAsymmetricalAngleSetValue() + != other.getRobotAsymmetricalAngleSetValue()) return false; + if (getRobotBackMode() + != other.getRobotBackMode()) return false; + if (getRobotBackDistance() + != other.getRobotBackDistance()) return false; + if (getRobotBackSpeed() + != other.getRobotBackSpeed()) return false; + if (getRobotPressSet() + != other.getRobotPressSet()) return false; + if (getRobotVerticalAdjust() + != other.getRobotVerticalAdjust()) return false; + if (getRobotLengthHomework() + != other.getRobotLengthHomework()) return false; + if (getRobotWidthHomework() + != other.getRobotWidthHomework()) return false; + if (getRobotSandBalstEncodeOne() + != other.getRobotSandBalstEncodeOne()) return false; + if (getRobotSandBalstEncodeTwo() + != other.getRobotSandBalstEncodeTwo()) 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) + ROBOT_OPERATION_MODE_FIELD_NUMBER; + hash = (53 * hash) + getRobotOperationMode(); + hash = (37 * hash) + ROBOT_MOVE_SPEED_FIELD_NUMBER; + hash = (53 * hash) + getRobotMoveSpeed(); + hash = (37 * hash) + ROBOT_CHANGE_LANE_DISTANCE_FIELD_NUMBER; + hash = (53 * hash) + getRobotChangeLaneDistance(); + hash = (37 * hash) + ROBOT_SWING_SPEED_FIELD_NUMBER; + hash = (53 * hash) + getRobotSwingSpeed(); + hash = (37 * hash) + ROBOT_SYMMETRICALORNOT_FIELD_NUMBER; + hash = (53 * hash) + getRobotSymmetricalOrNot(); + hash = (37 * hash) + ROBOT_SWING_RANGE_ANGLE_FIELD_NUMBER; + hash = (53 * hash) + getRobotSwingRangeAngle(); + hash = (37 * hash) + ROBOT_ASYMMETRICALANGLESETVALUE_FIELD_NUMBER; + hash = (53 * hash) + getRobotAsymmetricalAngleSetValue(); + hash = (37 * hash) + ROBOT_BACKMODE_FIELD_NUMBER; + hash = (53 * hash) + getRobotBackMode(); + hash = (37 * hash) + ROBOT_BACK_DISTANCE_FIELD_NUMBER; + hash = (53 * hash) + getRobotBackDistance(); + hash = (37 * hash) + ROBOT_BACK_SPEED_FIELD_NUMBER; + hash = (53 * hash) + getRobotBackSpeed(); + hash = (37 * hash) + ROBOT_PRESS_SET_FIELD_NUMBER; + hash = (53 * hash) + getRobotPressSet(); + hash = (37 * hash) + ROBOT_VERTICAL_ADJUST_FIELD_NUMBER; + hash = (53 * hash) + getRobotVerticalAdjust(); + hash = (37 * hash) + ROBOT_LENGTH_HOMEWORK_FIELD_NUMBER; + hash = (53 * hash) + getRobotLengthHomework(); + hash = (37 * hash) + ROBOT_WIDTH_HOMEWORK_FIELD_NUMBER; + hash = (53 * hash) + getRobotWidthHomework(); + hash = (37 * hash) + ROBOT_SANDBALST_ENCODE_ONE_FIELD_NUMBER; + hash = (53 * hash) + getRobotSandBalstEncodeOne(); + hash = (37 * hash) + ROBOT_SANDBALST_ENCODE_TWO_FIELD_NUMBER; + hash = (53 * hash) + getRobotSandBalstEncodeTwo(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.example.swingarmapp_sandblast.models.BspPV.PV_struct_define parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.example.swingarmapp_sandblast.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.swingarmapp_sandblast.models.BspPV.PV_struct_define parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.example.swingarmapp_sandblast.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.swingarmapp_sandblast.models.BspPV.PV_struct_define parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.example.swingarmapp_sandblast.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.swingarmapp_sandblast.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.swingarmapp_sandblast.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.swingarmapp_sandblast.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.swingarmapp_sandblast.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.swingarmapp_sandblast.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.swingarmapp_sandblast.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.swingarmapp_sandblast.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.swingarmapp_sandblast.models.BspPV.PV_struct_defineOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.example.swingarmapp_sandblast.models.BspPV.internal_static_PV_struct_define_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.example.swingarmapp_sandblast.models.BspPV.internal_static_PV_struct_define_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.example.swingarmapp_sandblast.models.BspPV.PV_struct_define.class, com.example.swingarmapp_sandblast.models.BspPV.PV_struct_define.Builder.class); + } + + // Construct using com.example.swingarmapp_sandblast.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; + robotOperationMode_ = 0; + robotMoveSpeed_ = 0; + robotChangeLaneDistance_ = 0; + robotSwingSpeed_ = 0; + robotSymmetricalOrNot_ = 0; + robotSwingRangeAngle_ = 0; + robotAsymmetricalAngleSetValue_ = 0; + robotBackMode_ = 0; + robotBackDistance_ = 0; + robotBackSpeed_ = 0; + robotPressSet_ = 0; + robotVerticalAdjust_ = 0; + robotLengthHomework_ = 0; + robotWidthHomework_ = 0; + robotSandBalstEncodeOne_ = 0; + robotSandBalstEncodeTwo_ = 0; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.example.swingarmapp_sandblast.models.BspPV.internal_static_PV_struct_define_descriptor; + } + + @java.lang.Override + public com.example.swingarmapp_sandblast.models.BspPV.PV_struct_define getDefaultInstanceForType() { + return com.example.swingarmapp_sandblast.models.BspPV.PV_struct_define.getDefaultInstance(); + } + + @java.lang.Override + public com.example.swingarmapp_sandblast.models.BspPV.PV_struct_define build() { + com.example.swingarmapp_sandblast.models.BspPV.PV_struct_define result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.example.swingarmapp_sandblast.models.BspPV.PV_struct_define buildPartial() { + com.example.swingarmapp_sandblast.models.BspPV.PV_struct_define result = new com.example.swingarmapp_sandblast.models.BspPV.PV_struct_define(this); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartial0(com.example.swingarmapp_sandblast.models.BspPV.PV_struct_define result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.robotOperationMode_ = robotOperationMode_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.robotMoveSpeed_ = robotMoveSpeed_; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.robotChangeLaneDistance_ = robotChangeLaneDistance_; + } + if (((from_bitField0_ & 0x00000008) != 0)) { + result.robotSwingSpeed_ = robotSwingSpeed_; + } + if (((from_bitField0_ & 0x00000010) != 0)) { + result.robotSymmetricalOrNot_ = robotSymmetricalOrNot_; + } + if (((from_bitField0_ & 0x00000020) != 0)) { + result.robotSwingRangeAngle_ = robotSwingRangeAngle_; + } + if (((from_bitField0_ & 0x00000040) != 0)) { + result.robotAsymmetricalAngleSetValue_ = robotAsymmetricalAngleSetValue_; + } + if (((from_bitField0_ & 0x00000080) != 0)) { + result.robotBackMode_ = robotBackMode_; + } + if (((from_bitField0_ & 0x00000100) != 0)) { + result.robotBackDistance_ = robotBackDistance_; + } + if (((from_bitField0_ & 0x00000200) != 0)) { + result.robotBackSpeed_ = robotBackSpeed_; + } + if (((from_bitField0_ & 0x00000400) != 0)) { + result.robotPressSet_ = robotPressSet_; + } + if (((from_bitField0_ & 0x00000800) != 0)) { + result.robotVerticalAdjust_ = robotVerticalAdjust_; + } + if (((from_bitField0_ & 0x00001000) != 0)) { + result.robotLengthHomework_ = robotLengthHomework_; + } + if (((from_bitField0_ & 0x00002000) != 0)) { + result.robotWidthHomework_ = robotWidthHomework_; + } + if (((from_bitField0_ & 0x00004000) != 0)) { + result.robotSandBalstEncodeOne_ = robotSandBalstEncodeOne_; + } + if (((from_bitField0_ & 0x00008000) != 0)) { + result.robotSandBalstEncodeTwo_ = robotSandBalstEncodeTwo_; + } + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.example.swingarmapp_sandblast.models.BspPV.PV_struct_define) { + return mergeFrom((com.example.swingarmapp_sandblast.models.BspPV.PV_struct_define)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.example.swingarmapp_sandblast.models.BspPV.PV_struct_define other) { + if (other == com.example.swingarmapp_sandblast.models.BspPV.PV_struct_define.getDefaultInstance()) return this; + if (other.getRobotOperationMode() != 0) { + setRobotOperationMode(other.getRobotOperationMode()); + } + if (other.getRobotMoveSpeed() != 0) { + setRobotMoveSpeed(other.getRobotMoveSpeed()); + } + if (other.getRobotChangeLaneDistance() != 0) { + setRobotChangeLaneDistance(other.getRobotChangeLaneDistance()); + } + if (other.getRobotSwingSpeed() != 0) { + setRobotSwingSpeed(other.getRobotSwingSpeed()); + } + if (other.getRobotSymmetricalOrNot() != 0) { + setRobotSymmetricalOrNot(other.getRobotSymmetricalOrNot()); + } + if (other.getRobotSwingRangeAngle() != 0) { + setRobotSwingRangeAngle(other.getRobotSwingRangeAngle()); + } + if (other.getRobotAsymmetricalAngleSetValue() != 0) { + setRobotAsymmetricalAngleSetValue(other.getRobotAsymmetricalAngleSetValue()); + } + if (other.getRobotBackMode() != 0) { + setRobotBackMode(other.getRobotBackMode()); + } + if (other.getRobotBackDistance() != 0) { + setRobotBackDistance(other.getRobotBackDistance()); + } + if (other.getRobotBackSpeed() != 0) { + setRobotBackSpeed(other.getRobotBackSpeed()); + } + if (other.getRobotPressSet() != 0) { + setRobotPressSet(other.getRobotPressSet()); + } + if (other.getRobotVerticalAdjust() != 0) { + setRobotVerticalAdjust(other.getRobotVerticalAdjust()); + } + if (other.getRobotLengthHomework() != 0) { + setRobotLengthHomework(other.getRobotLengthHomework()); + } + if (other.getRobotWidthHomework() != 0) { + setRobotWidthHomework(other.getRobotWidthHomework()); + } + if (other.getRobotSandBalstEncodeOne() != 0) { + setRobotSandBalstEncodeOne(other.getRobotSandBalstEncodeOne()); + } + if (other.getRobotSandBalstEncodeTwo() != 0) { + setRobotSandBalstEncodeTwo(other.getRobotSandBalstEncodeTwo()); + } + 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: { + robotOperationMode_ = input.readInt32(); + bitField0_ |= 0x00000001; + break; + } // case 8 + case 16: { + robotMoveSpeed_ = input.readInt32(); + bitField0_ |= 0x00000002; + break; + } // case 16 + case 24: { + robotChangeLaneDistance_ = input.readInt32(); + bitField0_ |= 0x00000004; + break; + } // case 24 + case 32: { + robotSwingSpeed_ = input.readInt32(); + bitField0_ |= 0x00000008; + break; + } // case 32 + case 40: { + robotSymmetricalOrNot_ = input.readInt32(); + bitField0_ |= 0x00000010; + break; + } // case 40 + case 48: { + robotSwingRangeAngle_ = input.readInt32(); + bitField0_ |= 0x00000020; + break; + } // case 48 + case 56: { + robotAsymmetricalAngleSetValue_ = input.readInt32(); + bitField0_ |= 0x00000040; + break; + } // case 56 + case 64: { + robotBackMode_ = input.readInt32(); + bitField0_ |= 0x00000080; + break; + } // case 64 + case 72: { + robotBackDistance_ = input.readInt32(); + bitField0_ |= 0x00000100; + break; + } // case 72 + case 80: { + robotBackSpeed_ = input.readInt32(); + bitField0_ |= 0x00000200; + break; + } // case 80 + case 88: { + robotPressSet_ = input.readInt32(); + bitField0_ |= 0x00000400; + break; + } // case 88 + case 96: { + robotVerticalAdjust_ = input.readInt32(); + bitField0_ |= 0x00000800; + break; + } // case 96 + case 104: { + robotLengthHomework_ = input.readInt32(); + bitField0_ |= 0x00001000; + break; + } // case 104 + case 112: { + robotWidthHomework_ = input.readInt32(); + bitField0_ |= 0x00002000; + break; + } // case 112 + case 120: { + robotSandBalstEncodeOne_ = input.readInt32(); + bitField0_ |= 0x00004000; + break; + } // case 120 + case 128: { + robotSandBalstEncodeTwo_ = input.readInt32(); + bitField0_ |= 0x00008000; + break; + } // case 128 + 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 robotOperationMode_ ; + /** + *
+       * 操作模式 手动模式1 2 3 4   自动模式5 6 7
+       * 
+ * + * int32 Robot_Operation_Mode = 1; + * @return The robotOperationMode. + */ + @java.lang.Override + public int getRobotOperationMode() { + return robotOperationMode_; + } + /** + *
+       * 操作模式 手动模式1 2 3 4   自动模式5 6 7
+       * 
+ * + * int32 Robot_Operation_Mode = 1; + * @param value The robotOperationMode to set. + * @return This builder for chaining. + */ + public Builder setRobotOperationMode(int value) { + + robotOperationMode_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + *
+       * 操作模式 手动模式1 2 3 4   自动模式5 6 7
+       * 
+ * + * int32 Robot_Operation_Mode = 1; + * @return This builder for chaining. + */ + public Builder clearRobotOperationMode() { + bitField0_ = (bitField0_ & ~0x00000001); + robotOperationMode_ = 0; + onChanged(); + return this; + } + + private int robotMoveSpeed_ ; + /** + *
+       * 机器人移动速度
+       * 
+ * + * int32 Robot_Move_Speed = 2; + * @return The robotMoveSpeed. + */ + @java.lang.Override + public int getRobotMoveSpeed() { + return robotMoveSpeed_; + } + /** + *
+       * 机器人移动速度
+       * 
+ * + * int32 Robot_Move_Speed = 2; + * @param value The robotMoveSpeed to set. + * @return This builder for chaining. + */ + public Builder setRobotMoveSpeed(int value) { + + robotMoveSpeed_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + *
+       * 机器人移动速度
+       * 
+ * + * int32 Robot_Move_Speed = 2; + * @return This builder for chaining. + */ + public Builder clearRobotMoveSpeed() { + bitField0_ = (bitField0_ & ~0x00000002); + robotMoveSpeed_ = 0; + onChanged(); + return this; + } + + private int robotChangeLaneDistance_ ; + /** + *
+       * 换道距离
+       * 
+ * + * int32 Robot_Change_Lane_Distance = 3; + * @return The robotChangeLaneDistance. + */ + @java.lang.Override + public int getRobotChangeLaneDistance() { + return robotChangeLaneDistance_; + } + /** + *
+       * 换道距离
+       * 
+ * + * int32 Robot_Change_Lane_Distance = 3; + * @param value The robotChangeLaneDistance to set. + * @return This builder for chaining. + */ + public Builder setRobotChangeLaneDistance(int value) { + + robotChangeLaneDistance_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + *
+       * 换道距离
+       * 
+ * + * int32 Robot_Change_Lane_Distance = 3; + * @return This builder for chaining. + */ + public Builder clearRobotChangeLaneDistance() { + bitField0_ = (bitField0_ & ~0x00000004); + robotChangeLaneDistance_ = 0; + onChanged(); + return this; + } + + private int robotSwingSpeed_ ; + /** + *
+       * 摆臂速度
+       * 
+ * + * int32 Robot_Swing_Speed = 4; + * @return The robotSwingSpeed. + */ + @java.lang.Override + public int getRobotSwingSpeed() { + return robotSwingSpeed_; + } + /** + *
+       * 摆臂速度
+       * 
+ * + * int32 Robot_Swing_Speed = 4; + * @param value The robotSwingSpeed to set. + * @return This builder for chaining. + */ + public Builder setRobotSwingSpeed(int value) { + + robotSwingSpeed_ = value; + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + /** + *
+       * 摆臂速度
+       * 
+ * + * int32 Robot_Swing_Speed = 4; + * @return This builder for chaining. + */ + public Builder clearRobotSwingSpeed() { + bitField0_ = (bitField0_ & ~0x00000008); + robotSwingSpeed_ = 0; + onChanged(); + return this; + } + + private int robotSymmetricalOrNot_ ; + /** + *
+       * 摆臂角度界面中的对称or非对称 1 对称 2 非对称
+       * 
+ * + * int32 Robot_symmetricalOrNot = 5; + * @return The robotSymmetricalOrNot. + */ + @java.lang.Override + public int getRobotSymmetricalOrNot() { + return robotSymmetricalOrNot_; + } + /** + *
+       * 摆臂角度界面中的对称or非对称 1 对称 2 非对称
+       * 
+ * + * int32 Robot_symmetricalOrNot = 5; + * @param value The robotSymmetricalOrNot to set. + * @return This builder for chaining. + */ + public Builder setRobotSymmetricalOrNot(int value) { + + robotSymmetricalOrNot_ = value; + bitField0_ |= 0x00000010; + onChanged(); + return this; + } + /** + *
+       * 摆臂角度界面中的对称or非对称 1 对称 2 非对称
+       * 
+ * + * int32 Robot_symmetricalOrNot = 5; + * @return This builder for chaining. + */ + public Builder clearRobotSymmetricalOrNot() { + bitField0_ = (bitField0_ & ~0x00000010); + robotSymmetricalOrNot_ = 0; + onChanged(); + return this; + } + + private int robotSwingRangeAngle_ ; + /** + *
+       * 对称下的摆臂角度
+       * 
+ * + * int32 Robot_Swing_Range_Angle = 6; + * @return The robotSwingRangeAngle. + */ + @java.lang.Override + public int getRobotSwingRangeAngle() { + return robotSwingRangeAngle_; + } + /** + *
+       * 对称下的摆臂角度
+       * 
+ * + * int32 Robot_Swing_Range_Angle = 6; + * @param value The robotSwingRangeAngle to set. + * @return This builder for chaining. + */ + public Builder setRobotSwingRangeAngle(int value) { + + robotSwingRangeAngle_ = value; + bitField0_ |= 0x00000020; + onChanged(); + return this; + } + /** + *
+       * 对称下的摆臂角度
+       * 
+ * + * int32 Robot_Swing_Range_Angle = 6; + * @return This builder for chaining. + */ + public Builder clearRobotSwingRangeAngle() { + bitField0_ = (bitField0_ & ~0x00000020); + robotSwingRangeAngle_ = 0; + onChanged(); + return this; + } + + private int robotAsymmetricalAngleSetValue_ ; + /** + *
+       * 非对称条件下下  1左侧   2 右侧
+       * 
+ * + * int32 Robot_asymmetricalAngleSetValue = 7; + * @return The robotAsymmetricalAngleSetValue. + */ + @java.lang.Override + public int getRobotAsymmetricalAngleSetValue() { + return robotAsymmetricalAngleSetValue_; + } + /** + *
+       * 非对称条件下下  1左侧   2 右侧
+       * 
+ * + * int32 Robot_asymmetricalAngleSetValue = 7; + * @param value The robotAsymmetricalAngleSetValue to set. + * @return This builder for chaining. + */ + public Builder setRobotAsymmetricalAngleSetValue(int value) { + + robotAsymmetricalAngleSetValue_ = value; + bitField0_ |= 0x00000040; + onChanged(); + return this; + } + /** + *
+       * 非对称条件下下  1左侧   2 右侧
+       * 
+ * + * int32 Robot_asymmetricalAngleSetValue = 7; + * @return This builder for chaining. + */ + public Builder clearRobotAsymmetricalAngleSetValue() { + bitField0_ = (bitField0_ & ~0x00000040); + robotAsymmetricalAngleSetValue_ = 0; + onChanged(); + return this; + } + + private int robotBackMode_ ; + /** + *
+       * 后退设置模式 1 打退交替 2 边打边退
+       * 
+ * + * int32 Robot_backMode = 8; + * @return The robotBackMode. + */ + @java.lang.Override + public int getRobotBackMode() { + return robotBackMode_; + } + /** + *
+       * 后退设置模式 1 打退交替 2 边打边退
+       * 
+ * + * int32 Robot_backMode = 8; + * @param value The robotBackMode to set. + * @return This builder for chaining. + */ + public Builder setRobotBackMode(int value) { + + robotBackMode_ = value; + bitField0_ |= 0x00000080; + onChanged(); + return this; + } + /** + *
+       * 后退设置模式 1 打退交替 2 边打边退
+       * 
+ * + * int32 Robot_backMode = 8; + * @return This builder for chaining. + */ + public Builder clearRobotBackMode() { + bitField0_ = (bitField0_ & ~0x00000080); + robotBackMode_ = 0; + onChanged(); + return this; + } + + private int robotBackDistance_ ; + /** + *
+       * 打退交替条件下的后退距离
+       * 
+ * + * int32 Robot_Back_Distance = 9; + * @return The robotBackDistance. + */ + @java.lang.Override + public int getRobotBackDistance() { + return robotBackDistance_; + } + /** + *
+       * 打退交替条件下的后退距离
+       * 
+ * + * int32 Robot_Back_Distance = 9; + * @param value The robotBackDistance to set. + * @return This builder for chaining. + */ + public Builder setRobotBackDistance(int value) { + + robotBackDistance_ = value; + bitField0_ |= 0x00000100; + onChanged(); + return this; + } + /** + *
+       * 打退交替条件下的后退距离
+       * 
+ * + * int32 Robot_Back_Distance = 9; + * @return This builder for chaining. + */ + public Builder clearRobotBackDistance() { + bitField0_ = (bitField0_ & ~0x00000100); + robotBackDistance_ = 0; + onChanged(); + return this; + } + + private int robotBackSpeed_ ; + /** + *
+       * 边打边退条件下的后退速度
+       * 
+ * + * int32 Robot_Back_Speed = 10; + * @return The robotBackSpeed. + */ + @java.lang.Override + public int getRobotBackSpeed() { + return robotBackSpeed_; + } + /** + *
+       * 边打边退条件下的后退速度
+       * 
+ * + * int32 Robot_Back_Speed = 10; + * @param value The robotBackSpeed to set. + * @return This builder for chaining. + */ + public Builder setRobotBackSpeed(int value) { + + robotBackSpeed_ = value; + bitField0_ |= 0x00000200; + onChanged(); + return this; + } + /** + *
+       * 边打边退条件下的后退速度
+       * 
+ * + * int32 Robot_Back_Speed = 10; + * @return This builder for chaining. + */ + public Builder clearRobotBackSpeed() { + bitField0_ = (bitField0_ & ~0x00000200); + robotBackSpeed_ = 0; + onChanged(); + return this; + } + + private int robotPressSet_ ; + /** + *
+       * 压力设置
+       * 
+ * + * int32 Robot_Press_Set = 11; + * @return The robotPressSet. + */ + @java.lang.Override + public int getRobotPressSet() { + return robotPressSet_; + } + /** + *
+       * 压力设置
+       * 
+ * + * int32 Robot_Press_Set = 11; + * @param value The robotPressSet to set. + * @return This builder for chaining. + */ + public Builder setRobotPressSet(int value) { + + robotPressSet_ = value; + bitField0_ |= 0x00000400; + onChanged(); + return this; + } + /** + *
+       * 压力设置
+       * 
+ * + * int32 Robot_Press_Set = 11; + * @return This builder for chaining. + */ + public Builder clearRobotPressSet() { + bitField0_ = (bitField0_ & ~0x00000400); + robotPressSet_ = 0; + onChanged(); + return this; + } + + private int robotVerticalAdjust_ ; + /** + *
+       * 竖直微调
+       * 
+ * + * int32 Robot_Vertical_Adjust = 12; + * @return The robotVerticalAdjust. + */ + @java.lang.Override + public int getRobotVerticalAdjust() { + return robotVerticalAdjust_; + } + /** + *
+       * 竖直微调
+       * 
+ * + * int32 Robot_Vertical_Adjust = 12; + * @param value The robotVerticalAdjust to set. + * @return This builder for chaining. + */ + public Builder setRobotVerticalAdjust(int value) { + + robotVerticalAdjust_ = value; + bitField0_ |= 0x00000800; + onChanged(); + return this; + } + /** + *
+       * 竖直微调
+       * 
+ * + * int32 Robot_Vertical_Adjust = 12; + * @return This builder for chaining. + */ + public Builder clearRobotVerticalAdjust() { + bitField0_ = (bitField0_ & ~0x00000800); + robotVerticalAdjust_ = 0; + onChanged(); + return this; + } + + private int robotLengthHomework_ ; + /** + *
+       * 自动模式下的作业长度
+       * 
+ * + * int32 Robot_Length_Homework = 13; + * @return The robotLengthHomework. + */ + @java.lang.Override + public int getRobotLengthHomework() { + return robotLengthHomework_; + } + /** + *
+       * 自动模式下的作业长度
+       * 
+ * + * int32 Robot_Length_Homework = 13; + * @param value The robotLengthHomework to set. + * @return This builder for chaining. + */ + public Builder setRobotLengthHomework(int value) { + + robotLengthHomework_ = value; + bitField0_ |= 0x00001000; + onChanged(); + return this; + } + /** + *
+       * 自动模式下的作业长度
+       * 
+ * + * int32 Robot_Length_Homework = 13; + * @return This builder for chaining. + */ + public Builder clearRobotLengthHomework() { + bitField0_ = (bitField0_ & ~0x00001000); + robotLengthHomework_ = 0; + onChanged(); + return this; + } + + private int robotWidthHomework_ ; + /** + *
+       * 自动模式下的作业宽度
+       * 
+ * + * int32 Robot_Width_Homework = 14; + * @return The robotWidthHomework. + */ + @java.lang.Override + public int getRobotWidthHomework() { + return robotWidthHomework_; + } + /** + *
+       * 自动模式下的作业宽度
+       * 
+ * + * int32 Robot_Width_Homework = 14; + * @param value The robotWidthHomework to set. + * @return This builder for chaining. + */ + public Builder setRobotWidthHomework(int value) { + + robotWidthHomework_ = value; + bitField0_ |= 0x00002000; + onChanged(); + return this; + } + /** + *
+       * 自动模式下的作业宽度
+       * 
+ * + * int32 Robot_Width_Homework = 14; + * @return This builder for chaining. + */ + public Builder clearRobotWidthHomework() { + bitField0_ = (bitField0_ & ~0x00002000); + robotWidthHomework_ = 0; + onChanged(); + return this; + } + + private int robotSandBalstEncodeOne_ ; + /** + *
+       * 喷砂机编码1
+       * 
+ * + * int32 Robot_SandBalst_Encode_One = 15; + * @return The robotSandBalstEncodeOne. + */ + @java.lang.Override + public int getRobotSandBalstEncodeOne() { + return robotSandBalstEncodeOne_; + } + /** + *
+       * 喷砂机编码1
+       * 
+ * + * int32 Robot_SandBalst_Encode_One = 15; + * @param value The robotSandBalstEncodeOne to set. + * @return This builder for chaining. + */ + public Builder setRobotSandBalstEncodeOne(int value) { + + robotSandBalstEncodeOne_ = value; + bitField0_ |= 0x00004000; + onChanged(); + return this; + } + /** + *
+       * 喷砂机编码1
+       * 
+ * + * int32 Robot_SandBalst_Encode_One = 15; + * @return This builder for chaining. + */ + public Builder clearRobotSandBalstEncodeOne() { + bitField0_ = (bitField0_ & ~0x00004000); + robotSandBalstEncodeOne_ = 0; + onChanged(); + return this; + } + + private int robotSandBalstEncodeTwo_ ; + /** + *
+       * 喷砂机编码2
+       * 
+ * + * int32 Robot_SandBalst_Encode_Two = 16; + * @return The robotSandBalstEncodeTwo. + */ + @java.lang.Override + public int getRobotSandBalstEncodeTwo() { + return robotSandBalstEncodeTwo_; + } + /** + *
+       * 喷砂机编码2
+       * 
+ * + * int32 Robot_SandBalst_Encode_Two = 16; + * @param value The robotSandBalstEncodeTwo to set. + * @return This builder for chaining. + */ + public Builder setRobotSandBalstEncodeTwo(int value) { + + robotSandBalstEncodeTwo_ = value; + bitField0_ |= 0x00008000; + onChanged(); + return this; + } + /** + *
+       * 喷砂机编码2
+       * 
+ * + * int32 Robot_SandBalst_Encode_Two = 16; + * @return This builder for chaining. + */ + public Builder clearRobotSandBalstEncodeTwo() { + bitField0_ = (bitField0_ & ~0x00008000); + robotSandBalstEncodeTwo_ = 0; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:PV_struct_define) + } + + // @@protoc_insertion_point(class_scope:PV_struct_define) + private static final com.example.swingarmapp_sandblast.models.BspPV.PV_struct_define DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.example.swingarmapp_sandblast.models.BspPV.PV_struct_define(); + } + + public static com.example.swingarmapp_sandblast.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.swingarmapp_sandblast.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\"\377\003\n\020PV_struct_define\022\034\n\024R" + + "obot_Operation_Mode\030\001 \001(\005\022\030\n\020Robot_Move_" + + "Speed\030\002 \001(\005\022\"\n\032Robot_Change_Lane_Distanc" + + "e\030\003 \001(\005\022\031\n\021Robot_Swing_Speed\030\004 \001(\005\022\036\n\026Ro" + + "bot_symmetricalOrNot\030\005 \001(\005\022\037\n\027Robot_Swin" + + "g_Range_Angle\030\006 \001(\005\022\'\n\037Robot_asymmetrica" + + "lAngleSetValue\030\007 \001(\005\022\026\n\016Robot_backMode\030\010" + + " \001(\005\022\033\n\023Robot_Back_Distance\030\t \001(\005\022\030\n\020Rob" + + "ot_Back_Speed\030\n \001(\005\022\027\n\017Robot_Press_Set\030\013" + + " \001(\005\022\035\n\025Robot_Vertical_Adjust\030\014 \001(\005\022\035\n\025R" + + "obot_Length_Homework\030\r \001(\005\022\034\n\024Robot_Widt" + + "h_Homework\030\016 \001(\005\022\"\n\032Robot_SandBalst_Enco" + + "de_One\030\017 \001(\005\022\"\n\032Robot_SandBalst_Encode_T" + + "wo\030\020 \001(\005B,\n(com.example.swingarmapp_sand" + + "blast.modelsP\000b\006proto3" + }; + 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[] { "RobotOperationMode", "RobotMoveSpeed", "RobotChangeLaneDistance", "RobotSwingSpeed", "RobotSymmetricalOrNot", "RobotSwingRangeAngle", "RobotAsymmetricalAngleSetValue", "RobotBackMode", "RobotBackDistance", "RobotBackSpeed", "RobotPressSet", "RobotVerticalAdjust", "RobotLengthHomework", "RobotWidthHomework", "RobotSandBalstEncodeOne", "RobotSandBalstEncodeTwo", }); + descriptor.resolveAllFeaturesImmutable(); + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/app/src/main/java/com/example/swingarmapp_sandblast/models/DisplayIV.java b/app/src/main/java/com/example/swingarmapp_sandblast/models/DisplayIV.java new file mode 100644 index 0000000..69fa3b9 --- /dev/null +++ b/app/src/main/java/com/example/swingarmapp_sandblast/models/DisplayIV.java @@ -0,0 +1,50 @@ +package com.example.swingarmapp_sandblast.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/swingarmapp_sandblast/models/DisplayPV.java b/app/src/main/java/com/example/swingarmapp_sandblast/models/DisplayPV.java new file mode 100644 index 0000000..eddab05 --- /dev/null +++ b/app/src/main/java/com/example/swingarmapp_sandblast/models/DisplayPV.java @@ -0,0 +1,119 @@ +package com.example.swingarmapp_sandblast.models; + +import androidx.databinding.BaseObservable; + +public class DisplayPV extends BaseObservable { + + private int id; + + private int moveSpeed; + private int laneChangeDistance; + private int swingArmSpeed; + private int swingArmAngle; + + private double backDistance; + private double backSpeedValue; + private int pressSet; + + private double verticalAdjust; + + private int workLength; + private int workWidth; + + + + public DisplayPV(int id, int laneChangeDistance, int swingArmSpeed, int swingArmAngle, double backDistance, double backSpeedValue, int pressSet,double verticalAdjust ,int workLength,int workWidth) { + this.id = id; + this.laneChangeDistance=laneChangeDistance; + this.swingArmSpeed = swingArmSpeed; + this.swingArmAngle = swingArmAngle; + this.backDistance = backDistance; + this.backSpeedValue=backSpeedValue; + this.pressSet=pressSet; + this.verticalAdjust=verticalAdjust; + this.workLength=workLength; + this.workWidth=workWidth; + + } + + + public int getId() { return id; } + public void setId(int id) { + this.id = id; + } + + + + +// public int getMoveSpeed() +// { +// return moveSpeed; +// } +// public void setMoveSpeed(int moveSpeed){ this.moveSpeed=moveSpeed;} + + public int getLaneChangeDistance() { + return laneChangeDistance; + } + public void setLaneChangeDistance(int laneChangeDistance) { this.laneChangeDistance = laneChangeDistance;} + + public int getSwingArmSpeed() { + return swingArmSpeed; + } + public void setSwingArmSpeed(int swingArmSpeed) { this.swingArmSpeed = swingArmSpeed;} + + public int getSwingArmAngle() { + return swingArmAngle; + } + public void setSwingArmAngle(int swingArmAngle) { + this.swingArmAngle = swingArmAngle; + } + + + public double getBackDistance() { + return backDistance; + } + public void setBackDistance(int backDistance) { + this.backDistance = backDistance; + } + + public double getBackSpeedValue() { + return backSpeedValue; + } + public void setBackSpeedValue(int backSpeedValue) { + this.backSpeedValue = backSpeedValue; + } + + public int getPressSet() { + return pressSet; + } + public void setPressSet(int pressSet) { + this.pressSet = pressSet; + } + + + public double getVerticalAdjust() { + return verticalAdjust; + } + public void setVerticalAdjust(int verticalAdjust) { + this.verticalAdjust = verticalAdjust; + } + + + + public int getWorkLength() { + return workLength; + } + public void setWorkLength(int workLength) { + this.workLength = workLength; + } + + public int getWorkWidth() { + return workWidth; + } + public void setWorkWidth(int workWidth) { + this.workLength = workWidth; + } + + + +} diff --git a/app/src/main/java/com/example/swingarmapp_sandblast/models/DisplaySandBlast.java b/app/src/main/java/com/example/swingarmapp_sandblast/models/DisplaySandBlast.java new file mode 100644 index 0000000..816158c --- /dev/null +++ b/app/src/main/java/com/example/swingarmapp_sandblast/models/DisplaySandBlast.java @@ -0,0 +1,30 @@ +package com.example.swingarmapp_sandblast.models; + +public class DisplaySandBlast { + private int id; + private int sand_encodeone; + private int sand_encodetwo; + + public DisplaySandBlast(int id , int sandEncodeOne,int sandEncodeTwo){ + + this.id=id; + this.sand_encodeone=sandEncodeOne; + this.sand_encodetwo=sandEncodeTwo; + } + + public int getId() { return id; } + public void setId(int id) { + this.id = id; + } + + public int getsand_encodeone() { return sand_encodeone; } + public void setsand_encodeone(int sandEncodeOne) { + this.sand_encodeone = sandEncodeOne; + } + + public int getsand_encodetwo() { return sand_encodetwo; } + public void setsand_encodetwo(int sand_encodetwo) { + this.sand_encodeone = sand_encodetwo; + } + +} diff --git a/app/src/main/java/com/example/swingarmapp_sandblast/models/ErrorModel.java b/app/src/main/java/com/example/swingarmapp_sandblast/models/ErrorModel.java new file mode 100644 index 0000000..baa51d2 --- /dev/null +++ b/app/src/main/java/com/example/swingarmapp_sandblast/models/ErrorModel.java @@ -0,0 +1,44 @@ +package com.example.swingarmapp_sandblast.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/swingarmapp_sandblast/models/ScrollBottomScrollView.java b/app/src/main/java/com/example/swingarmapp_sandblast/models/ScrollBottomScrollView.java new file mode 100644 index 0000000..fdd0850 --- /dev/null +++ b/app/src/main/java/com/example/swingarmapp_sandblast/models/ScrollBottomScrollView.java @@ -0,0 +1,43 @@ +package com.example.swingarmapp_sandblast.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/swingarmapp_sandblast/services/ConvertHelper.java b/app/src/main/java/com/example/swingarmapp_sandblast/services/ConvertHelper.java new file mode 100644 index 0000000..0f911d4 --- /dev/null +++ b/app/src/main/java/com/example/swingarmapp_sandblast/services/ConvertHelper.java @@ -0,0 +1,26 @@ +package com.example.swingarmapp_sandblast.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/swingarmapp_sandblast/services/CustomProber.java b/app/src/main/java/com/example/swingarmapp_sandblast/services/CustomProber.java new file mode 100644 index 0000000..c817235 --- /dev/null +++ b/app/src/main/java/com/example/swingarmapp_sandblast/services/CustomProber.java @@ -0,0 +1,22 @@ +package com.example.swingarmapp_sandblast.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/swingarmapp_sandblast/services/DecimalDigitsInputFilter.java b/app/src/main/java/com/example/swingarmapp_sandblast/services/DecimalDigitsInputFilter.java new file mode 100644 index 0000000..8d64171 --- /dev/null +++ b/app/src/main/java/com/example/swingarmapp_sandblast/services/DecimalDigitsInputFilter.java @@ -0,0 +1,71 @@ +package com.example.swingarmapp_sandblast.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/swingarmapp_sandblast/services/ErrorDeocdeHelper.java b/app/src/main/java/com/example/swingarmapp_sandblast/services/ErrorDeocdeHelper.java new file mode 100644 index 0000000..f4a17f7 --- /dev/null +++ b/app/src/main/java/com/example/swingarmapp_sandblast/services/ErrorDeocdeHelper.java @@ -0,0 +1,78 @@ +package com.example.swingarmapp_sandblast.services; + +import com.example.swingarmapp_sandblast.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 (Map.Entry entry : flagMap.entrySet()) { +// String key = entry.getKey(); +// int bitPosiiton = entry.getValue(); +// +// // 使用左移操作生成要检查的标志位 +// int bitToCheck = 1 << bitPosiiton; +// +// // 判断该位置是否有对应的标志位 +// if ((data & bitToCheck) != 0) +// { +// ErrorResult+=key+":\t 错误! "; +// } else +// { +// +// } +// } + +// + 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 = " "; + + // 使用左移操作生成要检查的标志位 + int bitToCheck = 1 << bitPosiiton; + +// // 判断该位置是否有对应的标志位 +// if ((data & bitToCheck) != 0) +// { +// +// ErrorResult+=err.toString()+addErrorResult+"\t"; +// } else +// { +// +// } + + + // 判断该位置是否有对应的标志位 + if ((data & bitToCheck) != 0) { + + // ErrorResult += String.valueOf(bitPosiiton); + + if (err.toString().equals("MK32_InitialState")) { + ErrorResult = "未复位"; + } +// else +// { +// ErrorResult += err.toString()+addErrorResult+"\t"; +// } + } + } + return ErrorResult; + } + +} diff --git a/app/src/main/java/com/example/swingarmapp_sandblast/services/LogUtil.java b/app/src/main/java/com/example/swingarmapp_sandblast/services/LogUtil.java new file mode 100644 index 0000000..a9e219b --- /dev/null +++ b/app/src/main/java/com/example/swingarmapp_sandblast/services/LogUtil.java @@ -0,0 +1,39 @@ +package com.example.swingarmapp_sandblast.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/swingarmapp_sandblast/services/ModbusCRC.java b/app/src/main/java/com/example/swingarmapp_sandblast/services/ModbusCRC.java new file mode 100644 index 0000000..586e77a --- /dev/null +++ b/app/src/main/java/com/example/swingarmapp_sandblast/services/ModbusCRC.java @@ -0,0 +1,72 @@ +package com.example.swingarmapp_sandblast.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/swingarmapp_sandblast/services/MyDataHelper.java b/app/src/main/java/com/example/swingarmapp_sandblast/services/MyDataHelper.java new file mode 100644 index 0000000..45a8407 --- /dev/null +++ b/app/src/main/java/com/example/swingarmapp_sandblast/services/MyDataHelper.java @@ -0,0 +1,304 @@ +package com.example.swingarmapp_sandblast.services; + +import android.content.ContentValues; +import android.content.Context; +import android.database.Cursor; +import android.database.SQLException; +import android.database.sqlite.SQLiteDatabase;//具体进行数据库、数据表的一个操作 +import android.database.sqlite.SQLiteOpenHelper;//用来创建数据库和对数据库进行版本管理 +import android.util.Log; + +import androidx.annotation.Nullable; + +import com.example.swingarmapp_sandblast.models.DisplayPV; +import com.example.swingarmapp_sandblast.models.DisplaySandBlast; +import com.example.swingarmapp_sandblast.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_LANE_CHANGE_DISTANCE = "laneChangeDistance";//换道距离 + public static final String COLUMN_SWING_ARM_SPEED = "swingArmSpeed";//Maintv_swingArmSpeedTo32摆臂速度 + public static final String COLUMN_SWING_ARM_ANGLE = "swingArmAngle";//Maintv_swingArmAngleTo32摆臂角度 + + public static final String COLUMN_BACK_DISTANCE = "backDistance";//Maintv_BackDistanceTo32后退距离 + public static final String COLUMN_BACK_SPEED = "backSpeed";//Maintv_BackSpeedTo32后退速度 + + public static final String COLUMN_PRESS_SET = "pressSet";//Maintv_PressTo32 压力设定 + public static final String COLUMN_VERTICAL_ADJUST = "verticalAdjust";//Maintv_VerticalAdjustTo32 竖直微调 + public static final String COLUMN_WORK_LENGTH = "workLength";//Maintv_WorkLenthTo32作业长度 + public static final String COLUMN_WORK_WIDTH = "workWidth";//Maintv_WorkWidthTo32作业宽度 + + + public static final String Error_TABLE_NAME = "error"; + public static final String Error_COLUMN_TimeStamp = "timeID"; + + public static final String Error_COLUMN_ERROR_INFO = "errorInfo"; + + /*****************************************/ + public static final String SAND_TABLE_NAME = "sandblast"; + public static final String SAND_COLUMN_ENCODEONE = "encode1"; + + public static final String SAND_COLUMN_ENCODETWO = "encode2"; + + + + public MyDataHelper(@Nullable Context context) { + super(context, "bingbot.db", null, 6); //数据库名称为 bingbot.db,数据库版本为 1。存放两个表 + } + + @Override + public void onCreate(SQLiteDatabase db) { + + + //INTEGER前加空格 + String sql = "CREATE TABLE " + TABLE_NAME + " (" + + COLUMN_ID + " INTEGER PRIMARY KEY AUTOINCREMENT, " + + COLUMN_PRESS_SET + " INTEGER, " + + COLUMN_VERTICAL_ADJUST + " DOUBLE, " + + COLUMN_SWING_ARM_ANGLE + " INTEGER, " + + COLUMN_SWING_ARM_SPEED + " INTEGER, " + + COLUMN_BACK_DISTANCE + " DOUBLE, " + + COLUMN_LANE_CHANGE_DISTANCE + " INTEGER, " + + COLUMN_WORK_LENGTH + " INTEGER, " + + COLUMN_WORK_WIDTH + " INTEGER, " + + COLUMN_BACK_SPEED + " DOUBLE);"; + + db.execSQL(sql); //执行sql语句 + // Log.d("DB_DEBUG", "表创建成功,列名包含: moveSpeed"); + sql = "CREATE TABLE " + Error_TABLE_NAME + "(" + Error_COLUMN_TimeStamp + " INTEGER PRIMARY KEY ," + + Error_COLUMN_ERROR_INFO + " STRING " + ")"; + + db.execSQL(sql); //创建错误表 + + /*******创建喷砂机编码表*********/ + sql = "CREATE TABLE " + SAND_TABLE_NAME + "(" + COLUMN_ID + " INTEGER PRIMARY KEY ,"+ SAND_COLUMN_ENCODEONE + " INTEGER, " + + SAND_COLUMN_ENCODETWO + " INTEGER " + ")"; + + 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_BACK_SPEED, pv.getBackSpeedValue()); + cv.put(COLUMN_LANE_CHANGE_DISTANCE, pv.getLaneChangeDistance()); + cv.put(COLUMN_SWING_ARM_SPEED, pv.getSwingArmSpeed()); + cv.put(COLUMN_SWING_ARM_ANGLE, pv.getSwingArmAngle()); + cv.put(COLUMN_BACK_DISTANCE, pv.getBackDistance()); + cv.put(COLUMN_PRESS_SET, pv.getPressSet()); + cv.put(COLUMN_VERTICAL_ADJUST, pv.getVerticalAdjust()); + cv.put(COLUMN_WORK_LENGTH, pv.getWorkLength()); + cv.put(COLUMN_WORK_WIDTH, pv.getWorkWidth()); + + + SQLiteDatabase sqliteDatabase = this.getWritableDatabase();//获取数据库实例以实现增上查改等,如果没有就新建 并把sqliteDatabase作为参数传给oncreate方法 + long insert = sqliteDatabase.insertWithOnConflict(TABLE_NAME, null, cv, SQLiteDatabase.CONFLICT_REPLACE); + sqliteDatabase.close(); + if (insert == -1) { + return "failed"; + } + return "success"; + } + + public String addOrUpdateDisplayData_SandBlast(DisplaySandBlast dsb) { + ContentValues cv = new ContentValues(); //键值对的类 + cv.put(COLUMN_ID, 1); + cv.put(SAND_COLUMN_ENCODEONE, dsb.getsand_encodeone()); + cv.put(SAND_COLUMN_ENCODETWO, dsb.getsand_encodetwo()); + + SQLiteDatabase sqliteDatabase = this.getWritableDatabase();//获取数据库实例以实现增上查改等,如果没有就新建 并把sqliteDatabase作为参数传给oncreate方法 + long insert = sqliteDatabase.insertWithOnConflict(SAND_TABLE_NAME, null, cv, SQLiteDatabase.CONFLICT_REPLACE); + sqliteDatabase.close(); + if (insert == -1) { + return "failed"; + } + return "success"; + } + public List getDisplayData_sandBalst() { //初始化 + + List list = new ArrayList<>(); + String sql = "SELECT * FROM " + SAND_TABLE_NAME + " WHERE " + COLUMN_ID + " = " + String.valueOf(1); + SQLiteDatabase sqLiteDatabase = this.getWritableDatabase();//获取可写数据库实例 + + + Cursor cursor = sqLiteDatabase.rawQuery(sql, null); //按id查询 + + int idIndex = cursor.getColumnIndex(COLUMN_ID); + int _sandEncodeOneIndex = cursor.getColumnIndex(SAND_COLUMN_ENCODEONE); + int _sandEncodeTwoIndex = cursor.getColumnIndex(SAND_COLUMN_ENCODETWO); + + + while (cursor.moveToNext()) { + + DisplaySandBlast dsb = new DisplaySandBlast(cursor.getInt(idIndex), cursor.getInt(_sandEncodeOneIndex), + cursor.getInt(_sandEncodeTwoIndex) + ); + + list.add(dsb); + } + cursor.close(); + sqLiteDatabase.close(); + return list; + + } + 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.size() == 0) { + DisplayPV pv = new DisplayPV(i, 0, 0, 0, 0, 0, 0,0, 0, 0); + addOrUpdateDisplayData(pv);//一行一行添加 + } + } + List list_dsb = getDisplayData_sandBalst(); //从数据库中读 + if (list_dsb.size() == 0) { + DisplaySandBlast dsb = new DisplaySandBlast(1, 0, 0); + addOrUpdateDisplayData_SandBlast(dsb);//一行一行添加 + } + } + + + 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); //按id查询 + + int idIndex = cursor.getColumnIndex(COLUMN_ID); + int _laneChangeDistanceIndex = cursor.getColumnIndex(COLUMN_LANE_CHANGE_DISTANCE); + int _swingArmSpeedIndex = cursor.getColumnIndex(COLUMN_SWING_ARM_SPEED); + int _swingArmAngleIndex = cursor.getColumnIndex(COLUMN_SWING_ARM_ANGLE); + int _backDistanceIndex = cursor.getColumnIndex(COLUMN_BACK_DISTANCE); + int _backSpeedValue= cursor.getColumnIndex(COLUMN_BACK_SPEED); + int _pressSetIndex = cursor.getColumnIndex(COLUMN_PRESS_SET); + int _verticalAdjustIndex = cursor.getColumnIndex(COLUMN_VERTICAL_ADJUST); + int _workLengthIndex = cursor.getColumnIndex(COLUMN_WORK_LENGTH); + int _workWidthIndex = cursor.getColumnIndex(COLUMN_WORK_WIDTH); + + while (cursor.moveToNext()) { + + DisplayPV pv = new DisplayPV(cursor.getInt(idIndex), cursor.getInt(_laneChangeDistanceIndex), + cursor.getInt(_swingArmSpeedIndex), cursor.getInt(_swingArmAngleIndex), cursor.getInt(_backDistanceIndex),cursor.getInt(_backSpeedValue), cursor.getInt(_pressSetIndex), + cursor.getInt(_verticalAdjustIndex), cursor.getInt(_workLengthIndex), cursor.getInt(_workWidthIndex) + ); + + list.add(pv); + } + cursor.close(); + sqLiteDatabase.close(); + return list; + + } + + + public String AddOrUpdateErrorModel(ErrorModel em) { + ContentValues cv = new ContentValues(); + cv.put(Error_COLUMN_TimeStamp, 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); + if (insert == -1) { + // 插入失败,按时间戳删除最早的100行 + try { + // 开始事务 + sqliteDatabase.beginTransaction(); + + String deleteQuery = "DELETE FROM error WHERE timeID IN (SELECT timeID FROM error ORDER BY timeID ASC LIMIT 100)"; + sqliteDatabase.execSQL(deleteQuery); + // 标记事务成功 + sqliteDatabase.setTransactionSuccessful(); + + Log.d("DB_OPERATION", "插入失败,已按时间戳删除最早的100行数据"); + } catch (SQLException e) { + Log.e("DB_ERROR", "删除时发生错误: " + e.getMessage()); + } finally { + // 结束事务(若setTransactionSuccessful()被调用则提交,否则回滚) + sqliteDatabase.endTransaction(); + } + sqliteDatabase.close(); + return "failed"; + } + sqliteDatabase.close(); + return "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_TimeStamp); + + 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/swingarmapp_sandblast/services/PopupHelper.java b/app/src/main/java/com/example/swingarmapp_sandblast/services/PopupHelper.java new file mode 100644 index 0000000..c3b8e9e --- /dev/null +++ b/app/src/main/java/com/example/swingarmapp_sandblast/services/PopupHelper.java @@ -0,0 +1,754 @@ +package com.example.swingarmapp_sandblast.services; + +import android.app.Dialog; +import android.content.Context; +import android.graphics.Color; +import android.text.InputFilter; +import android.text.method.ScrollingMovementMethod; +import android.view.MotionEvent; +import android.view.View; +import android.view.inputmethod.InputMethodManager; +import android.widget.Button; +import android.widget.EditText; +import android.widget.LinearLayout; +import android.widget.RadioButton; +import android.widget.RadioGroup; +import android.widget.ScrollView; +import android.widget.TextView; +import android.widget.Toast; + +import androidx.core.content.ContextCompat; + +import com.example.swingarmapp_sandblast.models.ErrorModel; +import com.example.swingarmapp_sandblast.models.ScrollBottomScrollView; +import com.example.swingarmapp_sandblast.MainActivity; +import com.example.swingarmapp_sandblast.R; +import com.example.swingarmapp_sandblast.models.DisplayPV; + +import java.util.List; + +public class PopupHelper { + + private MainActivity mainActivity; + private LinearLayout inputContainer, buttonsContainer; + private EditText inputEditText; + private Button buttonA, buttonB; + private TextView statusText; + + + String result="1"; + private EditText firstEditText; + private EditText secondEditText; + + public PopupHelper(MainActivity mainActivity) + { + this.mainActivity = mainActivity; + + } + + + //手动模式弹窗 + public void ManualModePopup(View.OnClickListener context) { //手动模式弹窗 + Dialog dialog = new Dialog(mainActivity); + + dialog.setContentView(R.layout.manualmodepopup); // 设置自定义布局 + dialog.setCancelable(true); // 设置点击外部是否关闭弹窗 + + // 获取布局中的视图 + Button cancelButton = dialog.findViewById(R.id.manualModeCancel); + Button confirmButton = dialog.findViewById(R.id.manualModeApply); + + //获取按钮组 + RadioGroup radioGroup = (RadioGroup) dialog.findViewById(R.id.manualModeSelectorGroup); + + //4种模式 + radioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(RadioGroup group, int checkedId) { + RadioButton radioButton = (RadioButton) group.findViewById(checkedId); + if (radioButton != null) + { + mainActivity._Manual_Mode_Call_Value = radioButton.getText().toString(); + } + } + }); + + //下次进来保证是选中状态或者未远中 + String ii= mainActivity.mainBinding.manualModeDisplay.getText().toString(); + 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; + } + default: + + radioGroup.clearCheck(); + break; + + } + + + // 设置确定按钮点击事件 + confirmButton.setOnClickListener(v -> { //手动模式弹窗确认 + if (radioGroup.getCheckedRadioButtonId() != -1) { //有按钮选中时按确定 更新值 + mainActivity.mainBinding.manualModeDisplay.setText(mainActivity._Manual_Mode_Call_Value); + + mainActivity._Auto_Mode_Call_Value="未启用"; + mainActivity.mainBinding.autoModeDisplay.setText("未启用"); + //读取数据库,并对其他控件进行赋值 + Toast.makeText(mainActivity, "设置成功", Toast.LENGTH_SHORT).show(); + } + + + dialog.dismiss(); // 关闭弹窗 + }); + + // 设置取消按钮点击事件 + cancelButton.setOnClickListener(v -> { + Toast.makeText(mainActivity, "点击了取消", Toast.LENGTH_SHORT).show(); + + dialog.dismiss(); // 关闭弹窗 + }); + dialog.show(); // 显示弹窗 + + } + //自动模式弹窗 + public void AutoModePopup(View.OnClickListener context) { + Dialog dialog = new Dialog(mainActivity); + + dialog.setContentView(R.layout.automodepopup); // 设置自定义布局 + dialog.setCancelable(true); // 设置点击外部是否关闭弹窗 + + // 获取布局中的视图 + Button cancelButton = dialog.findViewById(R.id.autoModeCancel); + Button confirmButton = dialog.findViewById(R.id.autoModeApply); + EditText workLength_Edit=dialog.findViewById(R.id.worklength_input); + EditText workWidth_Edit=dialog.findViewById(R.id.workwidth_input); + + workLength_Edit.setText(mainActivity.workLength); + workWidth_Edit.setText(mainActivity.workWidth); + RadioGroup radioGroup = (RadioGroup) dialog.findViewById(R.id.autoModeSelectorGroup); + + //2种模式 + radioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(RadioGroup group, int checkedId) { + RadioButton radioButton = (RadioButton) group.findViewById(checkedId); + if(radioButton!=null){ + mainActivity._Auto_Mode_Call_Value = radioButton.getText().toString(); + } + + } + }); + + String ii= mainActivity.mainBinding.autoModeDisplay.getText().toString(); + switch (ii) + { + + case "水平": { radioGroup.check(R.id.rb_five); + break; + } + case "平面": { radioGroup.check(R.id.rb_six); + break; + } + default: + radioGroup.clearCheck();//清除选中 + break; + + } + + + // 设置确定按钮点击事件 + confirmButton.setOnClickListener(v -> { + + if (radioGroup.getCheckedRadioButtonId() != -1) { //有按钮选中时按确定 更新值 + mainActivity.mainBinding.autoModeDisplay.setText(mainActivity._Auto_Mode_Call_Value); + //失能手动模式 + mainActivity._Manual_Mode_Call_Value="未启用"; + mainActivity.mainBinding.manualModeDisplay.setText("未启用"); + + Toast.makeText(mainActivity, "设置成功", Toast.LENGTH_SHORT).show(); + } + + //检查作业宽度 长度 范围 + int value1=0; int value2=0; + try { + value1=Integer.parseInt(String.valueOf(workLength_Edit.getText())); + value2=Integer.parseInt(String.valueOf(workWidth_Edit.getText())); + } + catch(Exception e) + { + Toast.makeText(mainActivity, "输入不能为空", Toast.LENGTH_SHORT).show(); + return; + } + + if(value1>=0 && value1<=50) + { + mainActivity.workLength=String.valueOf(value1); + + }else{ + Toast.makeText(mainActivity, "请输入0-50的数字", Toast.LENGTH_SHORT).show(); + workLength_Edit.setText("0"); + return; + } + if(value2>=0 && value2<=50) + { + mainActivity.workWidth=String.valueOf(value2); + + }else{ + Toast.makeText(mainActivity, "请输入0-50的数字", Toast.LENGTH_SHORT).show(); + workWidth_Edit.setText("0"); + return; + } + + dialog.dismiss(); // 关闭弹窗 + }); + + + + // 设置取消按钮点击事件 + cancelButton.setOnClickListener(v -> { + Toast.makeText(mainActivity, "点击了取消", Toast.LENGTH_SHORT).show(); + + dialog.dismiss(); // 关闭弹窗 + }); + dialog.show(); // 显示弹窗 + + } + + public void SwingArmPopup() { + Dialog dialog = new Dialog(mainActivity); + dialog.setContentView(R.layout.swingarmanglepopup); + dialog.setCancelable(true); + // 初始化控件 + LinearLayout inputContainer = dialog.findViewById(R.id.inputContainer);//对称 + LinearLayout buttonContainer = dialog.findViewById(R.id.buttonContainer);//非对称 + EditText editAngle = dialog.findViewById(R.id.EditAngleTo32); + RadioGroup radioGroup = dialog.findViewById(R.id.radioGroup); + RadioButton btn_left = dialog.findViewById(R.id.btn_left); + RadioButton btn_right = dialog.findViewById(R.id.btn_right); + + Button confirmBtn=dialog.findViewById(R.id.swingArmAngleApply); + Button cancleBtn=dialog.findViewById(R.id.swingArmAngleCancel); + + + //主界面值传过来 + editAngle.setText( mainActivity.mainBinding.MaintvSwingArmAngleTo32.getText()); + // 设置对称点击事件 + inputContainer.setOnClickListener(v -> { + mainActivity.symmetricalOrNot=1;// 1对称 2非对称 + + if (!mainActivity.isInputGroupActive) { + mainActivity.isInputGroupActive = true; + updateUIState(editAngle, radioGroup, inputContainer, buttonContainer); + } + }); + + // 设置非对称点击事件 + buttonContainer.setOnClickListener(v -> { + mainActivity.symmetricalOrNot=2; + if (mainActivity.isInputGroupActive) { + mainActivity.isInputGroupActive = false; + updateUIState(editAngle, radioGroup, buttonContainer, inputContainer); + } + }); + + //长按 和松手事件 + btn_left.setOnTouchListener(new View.OnTouchListener() { + @Override + public boolean onTouch(View view, MotionEvent motionEvent) { + switch (motionEvent.getAction()) { + case MotionEvent.ACTION_DOWN: + // 按下时设置为蓝色 + view.setBackgroundColor(ContextCompat.getColor(mainActivity, R.color.blue_green)); + + // 按钮按下事件 + view.setAlpha(0.7f); // 按下时降低透明度,提供视觉反馈 + mainActivity.asymmetricalAngleSetValue=1; + return true; + + case MotionEvent.ACTION_UP: + case MotionEvent.ACTION_CANCEL: + // 松开或取消时设置为灰色 + view.setBackgroundColor(ContextCompat.getColor(mainActivity, R.color.gray)); + view.setBackgroundColor(Color.TRANSPARENT); + // 按钮松开或取消事件 + view.setAlpha(1.0f); // 恢复透明度 + mainActivity.asymmetricalAngleSetValue=0; + return true; + } + + return true; + } + }); + + btn_right.setOnTouchListener(new View.OnTouchListener() { + @Override + public boolean onTouch(View view, MotionEvent motionEvent) { + switch (motionEvent.getAction()) { + case MotionEvent.ACTION_DOWN: + // 按下时设置为蓝色 + view.setBackgroundColor(ContextCompat.getColor(mainActivity, R.color.blue_green)); + + // 按钮按下事件 + view.setAlpha(0.7f); // 按下时降低透明度,提供视觉反馈 + mainActivity.asymmetricalAngleSetValue=2; + return true; + + case MotionEvent.ACTION_UP: + case MotionEvent.ACTION_CANCEL: + // 松开或取消时设置为灰色 + view.setBackgroundColor(ContextCompat.getColor(mainActivity, R.color.gray)); + view.setBackgroundColor(Color.TRANSPARENT); + // 按钮松开或取消事件 + view.setAlpha(1.0f); // 恢复透明度 + mainActivity.asymmetricalAngleSetValue=0; + return true; + } + + return true; + + } + }); + + + confirmBtn.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + //检查对称角度输入范围 + String swingArmAngle_Edit=editAngle.getText().toString(); + if(swingArmAngle_Edit.equals("")) + { + Toast.makeText(mainActivity, "左侧角度输入不应为空", Toast.LENGTH_SHORT).show(); + return; + } + int _tempValue = Integer.parseInt(swingArmAngle_Edit); + if (_tempValue <= 150 && _tempValue > 0) + { + mainActivity.mainBinding.MaintvSwingArmAngleTo32.setText(swingArmAngle_Edit); + Toast.makeText(mainActivity, "左侧角度设置成功"+_tempValue, Toast.LENGTH_SHORT).show(); + } else + { + Toast.makeText(mainActivity, "左侧输入数据不应大于150或者小于=0", Toast.LENGTH_SHORT).show(); + editAngle.setText("0"); + return; + } + /**************************************/ + dialog.dismiss(); + + } + }); + cancleBtn.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + + dialog.dismiss(); + } + }); + + + // 初始状态设置 + if(mainActivity.isInputGroupActive) + { + updateUIState(editAngle, radioGroup, inputContainer, buttonContainer); + } + else { + updateUIState(editAngle, radioGroup, buttonContainer, inputContainer); + } + + + dialog.show(); + } + public void BackSetPopup() { + Dialog dialog = new Dialog(mainActivity); + dialog.setContentView(R.layout.backsetpopup); + dialog.setCancelable(true); + + // 初始化控件 + LinearLayout firstInputContainer = dialog.findViewById(R.id.firstInputContainer); + LinearLayout secondInputContainer = dialog.findViewById(R.id.secondInputContainer); + firstEditText = dialog.findViewById(R.id.firstEditText); + secondEditText = dialog.findViewById(R.id.secondEditText); + Button confirmButton= dialog.findViewById(R.id.backDistanceApply); + Button cancleButton= dialog.findViewById(R.id.backDistanceCancel); + firstEditText.setFilters(new InputFilter[]{new DecimalDigitsInputFilter()}); //editext 一位小数限制 + secondEditText.setFilters(new InputFilter[]{new DecimalDigitsInputFilter()}); //editext 一位小数限制 + //界面值传过来 + firstEditText.setText(mainActivity.mainBinding.MaintvBackDistanceTo32.getText()); + secondEditText.setText(mainActivity.backSpeedSetValue); + // 设置第一个打退交替点击事件 + firstInputContainer.setOnClickListener(v -> { + mainActivity.backMode=1; + if (! mainActivity.isFirstInputActive) { + mainActivity.isFirstInputActive = true; + updateUIState2(firstEditText, secondEditText, + firstInputContainer, secondInputContainer); + } + }); + + // 设置边打边退点击事件 + secondInputContainer.setOnClickListener(v -> { + mainActivity.backMode=2; + if ( mainActivity.isFirstInputActive) { + mainActivity.isFirstInputActive = false; + updateUIState2(secondEditText, firstEditText, + secondInputContainer, firstInputContainer); + } + }); + + + //确定按钮点击事件 + confirmButton.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + //检查后退距离输入范围 + String backDistance_Edit= firstEditText.getText().toString(); + if(backDistance_Edit.equals("")) + { + Toast.makeText(mainActivity, "左侧输入不应为空", Toast.LENGTH_SHORT).show(); + //dialog.dismiss(); // 关闭弹窗 + return; + } + double _tempValue = Double.parseDouble(backDistance_Edit); + + if (_tempValue <= 100 && _tempValue >= 0) + { + mainActivity.mainBinding.MaintvBackDistanceTo32.setText(String.valueOf(_tempValue)); + Toast.makeText(mainActivity, "左侧设置成功", Toast.LENGTH_SHORT).show(); + } else { + Toast.makeText(mainActivity, "左侧输入数据不应大于100或者小于=0", Toast.LENGTH_SHORT).show(); + firstEditText.setText("0.1"); + return; + } + /**************************************/ + //检查后退速度输入范围 + String backDistance_Edit1= secondEditText.getText().toString(); + if(backDistance_Edit1.equals("")) + { + Toast.makeText(mainActivity, "右侧输入不应为空", Toast.LENGTH_SHORT).show(); + return; + } + double _tempValue1 = Double.parseDouble(backDistance_Edit1); + if (_tempValue1 <= 20 && _tempValue1 >= 0) + { + mainActivity.backSpeedSetValue=String.valueOf(_tempValue1) ; + Toast.makeText(mainActivity, "右侧设置成功", Toast.LENGTH_SHORT).show(); + } else { + Toast.makeText(mainActivity, "右侧输入数据不应大于20或者小于=0", Toast.LENGTH_SHORT).show(); + secondEditText.setText(""); + return; + } + Toast.makeText(mainActivity, "设置成功", Toast.LENGTH_SHORT).show(); + dialog.dismiss(); // 关闭弹窗 + } + }); + + //取消按钮点击事件 + cancleButton.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + + dialog.dismiss(); + } + }); + // 初始状态设置 确定再次进入 按钮保持选中状态 + if(mainActivity.isFirstInputActive) + { + updateUIState2(firstEditText, secondEditText, + firstInputContainer, secondInputContainer); + + } + else { + updateUIState2(secondEditText, firstEditText, + secondInputContainer, firstInputContainer); + + } + + dialog.show(); + + + } + + public void ParametersCallPopup(View.OnClickListener context,MyDataHelper myDataHelper ) { + Dialog dialog = new Dialog(mainActivity); + dialog.setContentView(R.layout.parameters_call); // 设置自定义布局 + dialog.setCancelable(true); // 设置点击外部是否关闭弹窗 + + // 获取布局中的视图 + Button exitButton = dialog.findViewById(R.id.parametersExit); + Button confirmButton = dialog.findViewById(R.id.parametersApply); + Button saveButton=dialog.findViewById(R.id.parametersSavebtn); + Button clearButton=dialog.findViewById(R.id.parametersClearBtn); + RadioGroup radioGroup = (RadioGroup) dialog.findViewById(R.id.parameters_call_group); + + + Integer ii= ConvertHelper.convertEditTextToInt(mainActivity.mainBinding.MaintvParameterCallTo32); + + switch (ii) + { + case 1: { radioGroup.check(R.id.rb_one); + break; + } + case 2: { radioGroup.check(R.id.rb_two); + break; + } + case 3: { radioGroup.check(R.id.rb_three); + break; + } + case 4: { radioGroup.check(R.id.rb_four); + break; + } + case 5: { radioGroup.check(R.id.rb_five); + break; + } + } + + dialog.show(); // 显示弹窗 + //调用值更新 + radioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(RadioGroup group, int checkedId) { + RadioButton radioButton = (RadioButton) group.findViewById(checkedId); + result = radioButton.getText().toString(); + // mainActivity._parameters_Call_Value = result; + } + }); + //保存按钮 获取界面参数 存入数据库 + saveButton.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + //获取界面参数以写进数据库 + int paraIndex = Integer.parseInt(mainActivity.mainBinding.MaintvParameterCallTo32.getText().toString()); + int laneChangeDistance = Integer.parseInt(mainActivity.mainBinding.MaintvLaneChangeDistanceTo32.getText().toString()); + int swingArmSpeed = Integer.parseInt(mainActivity.mainBinding.MaintvSwingArmSpeedTo32.getText().toString()); + int swingArmAngle = Integer.parseInt(mainActivity.mainBinding.MaintvSwingArmAngleTo32.getText().toString()); + double backDistance = Double.parseDouble(mainActivity.mainBinding.MaintvBackDistanceTo32.getText().toString()); + double backSpeed = Double.parseDouble(mainActivity.backSpeedSetValue); + int pressSet = Integer.parseInt(mainActivity.mainBinding.MaintvPressTo32.getText().toString()); + double verticalAdjust = Double.parseDouble(mainActivity.mainBinding.MaintvVerticalAdjustTo32.getText().toString()); + int workLength = Integer.parseInt(mainActivity.workLength); + int workWidth = Integer.parseInt(mainActivity.workWidth); + + //把界面中的值放进PV类的变量中 + DisplayPV displayPV = new DisplayPV(paraIndex, laneChangeDistance,swingArmSpeed,swingArmAngle, backDistance,backSpeed,pressSet, verticalAdjust, workLength,workWidth ); + myDataHelper.addOrUpdateDisplayData(displayPV); //创建数据库的实例在这里 PV传进去保存到数据库 + Toast.makeText(dialog.getContext(), "保存成功", Toast.LENGTH_SHORT).show(); + } + }); + + //清除按钮 界面显示设为默认值 并存入数据库 + clearButton.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + mainActivity.mainBinding.MaintvLaneChangeDistanceTo32.setText(String.valueOf(1)); + mainActivity.mainBinding.MaintvSwingArmSpeedTo32.setText(String.valueOf(1)); + mainActivity.mainBinding.MaintvSwingArmAngleTo32.setText(String.valueOf(1)); + mainActivity.mainBinding.MaintvBackDistanceTo32.setText(String.valueOf(1)); + mainActivity.backSpeedSetValue=String.valueOf(1.0); + mainActivity.mainBinding.MaintvPressTo32.setText(String.valueOf(1)); + mainActivity.mainBinding.MaintvVerticalAdjustTo32.setText(String.valueOf(1)); + mainActivity.workLength=String.valueOf(1); + mainActivity.workWidth=String.valueOf(1); + //获取界面参数以写进数据库 + int paraIndex = Integer.parseInt(mainActivity.mainBinding.MaintvParameterCallTo32.getText().toString()); + int laneChangeDistance = Integer.parseInt(mainActivity.mainBinding.MaintvLaneChangeDistanceTo32.getText().toString()); + int swingArmSpeed = Integer.parseInt(mainActivity.mainBinding.MaintvSwingArmSpeedTo32.getText().toString()); + int swingArmAngle = Integer.parseInt(mainActivity.mainBinding.MaintvSwingArmAngleTo32.getText().toString()); + double backDistance = Double.parseDouble(mainActivity.mainBinding.MaintvBackDistanceTo32.getText().toString()); + double backSpeed =Double.parseDouble(mainActivity.backSpeedSetValue); + int pressSet =Integer.parseInt(mainActivity.mainBinding.MaintvPressTo32.getText().toString()); + double verticalAdjust =Double.parseDouble(mainActivity.mainBinding.MaintvVerticalAdjustTo32.getText().toString()); + int workLength = Integer.parseInt(mainActivity.workLength); + int workWidth = Integer.parseInt(mainActivity.workWidth); + //把界面中的值放进PV类的变量中 + DisplayPV displayPV = new DisplayPV(paraIndex, laneChangeDistance,swingArmSpeed,swingArmAngle, backDistance,backSpeed, pressSet, verticalAdjust, workLength,workWidth ); + myDataHelper.addOrUpdateDisplayData(displayPV); //创建数据库的实例在这里 PV传进去保存到数据库 + Toast.makeText(dialog.getContext(), "清除成功", Toast.LENGTH_SHORT).show(); + } + }); + + // 使用按钮 点击事件 //把主界面 调用值显示 改了 并从数据库中读赋值给界面 + confirmButton.setOnClickListener(v -> { + mainActivity._parameters_Call_Value = result; + mainActivity.mainBinding.MaintvParameterCallTo32.setText(mainActivity._parameters_Call_Value);//把主界面 调用值显示 改了 + + //读取数据 + int paraIndex = Integer.parseInt(mainActivity._parameters_Call_Value); + List pvList = mainActivity.myDataHelper.getDisplayData(paraIndex);//从数据库中读,,并对其他控件进行赋值 + mainActivity.backSpeedSetValue=String.valueOf(pvList.get(0).getBackSpeedValue()); + mainActivity.mainBinding.MaintvLaneChangeDistanceTo32.setText(String.valueOf(pvList.get(0).getLaneChangeDistance())); + mainActivity.mainBinding.MaintvSwingArmSpeedTo32.setText(String.valueOf(pvList.get(0).getSwingArmSpeed())); + mainActivity.mainBinding.MaintvSwingArmAngleTo32.setText(String.valueOf(pvList.get(0).getSwingArmAngle())); + mainActivity.mainBinding.MaintvBackDistanceTo32.setText(String.valueOf(pvList.get(0).getBackDistance())); + mainActivity.mainBinding.MaintvPressTo32.setText(String.valueOf(pvList.get(0).getPressSet())); + mainActivity.mainBinding.MaintvVerticalAdjustTo32.setText(String.valueOf(pvList.get(0).getVerticalAdjust())); + mainActivity.workLength=String.valueOf(pvList.get(0).getWorkLength()); + mainActivity.workWidth=String.valueOf(pvList.get(0).getWorkWidth()); + + //读取数据库,并对其他控件进行赋值 + Toast.makeText(dialog.getContext(), "调用成功", Toast.LENGTH_SHORT).show(); + + // dialog.dismiss(); // 关闭弹窗 + }); + + + + // 退出按钮点击事件 + exitButton.setOnClickListener(v -> { + Toast.makeText(dialog.getContext(), "点击了退出", Toast.LENGTH_SHORT).show(); + dialog.dismiss(); // 关闭弹窗 + }); + + + + } + + + 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 = 25; + 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(); // 显示弹窗 + } + + + + + // 更新后退距离UI状态的辅助方法 + private void updateUIState2(EditText activeEditText, EditText inactiveEditText, + View activeContainer, View inactiveContainer) { + // 更新输入框状态 + activeEditText.setEnabled(true); + activeEditText.requestFocus(); + + inactiveEditText.setEnabled(false); + inactiveEditText.clearFocus(); + + // 显示/隐藏软键盘 + InputMethodManager imm = (InputMethodManager) mainActivity.getSystemService(Context.INPUT_METHOD_SERVICE); + imm.showSoftInput(activeEditText, InputMethodManager.SHOW_IMPLICIT); + imm.hideSoftInputFromWindow(inactiveEditText.getWindowToken(), 0); + + + + // 更新容器样式 + activeContainer.setBackgroundResource(R.drawable.container_active); + inactiveContainer.setBackgroundResource(R.drawable.container_inactive); + } + + // 更新摆臂角度UI状态的辅助方法 + private void updateUIState(EditText editText, RadioGroup radioGroup, + View activeContainer, View inactiveContainer) { + // 更新输入框状态 + editText.setEnabled(mainActivity.isInputGroupActive); // + if (mainActivity.isInputGroupActive) { + editText.requestFocus(); + // 显示软键盘 + InputMethodManager imm = (InputMethodManager) mainActivity.getSystemService(Context.INPUT_METHOD_SERVICE); + imm.showSoftInput(editText, InputMethodManager.SHOW_IMPLICIT); + } else { + // 隐藏软键盘 + InputMethodManager imm = (InputMethodManager) mainActivity.getSystemService(Context.INPUT_METHOD_SERVICE); + imm.hideSoftInputFromWindow(editText.getWindowToken(), 0); + } + + // 更新按钮组状态 true失能 fasle 使能 全部未选中 + radioGroup.setEnabled(!mainActivity.isInputGroupActive); + for (int i = 0; i < radioGroup.getChildCount(); i++) { + radioGroup.getChildAt(i).setEnabled(!mainActivity.isInputGroupActive); + } + + // 重置按钮选择状态 + if (!mainActivity.isInputGroupActive) { + radioGroup.clearCheck(); + } + + + // 更新容器样式 + activeContainer.setBackgroundResource(R.drawable.container_active); + // activeContainer.setBackgroundResource(R.drawable.container_inactive); + inactiveContainer.setBackgroundResource(R.drawable.container_inactive); + } + +} //根类 + + diff --git a/app/src/main/java/com/example/swingarmapp_sandblast/services/RobotDataHanlder.java b/app/src/main/java/com/example/swingarmapp_sandblast/services/RobotDataHanlder.java new file mode 100644 index 0000000..783620c --- /dev/null +++ b/app/src/main/java/com/example/swingarmapp_sandblast/services/RobotDataHanlder.java @@ -0,0 +1,63 @@ +package com.example.swingarmapp_sandblast.services; + +import com.example.swingarmapp_sandblast.models.BspIV; +import com.example.swingarmapp_sandblast.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/swingarmapp_sandblast/services/USBSerialPortHelper.java b/app/src/main/java/com/example/swingarmapp_sandblast/services/USBSerialPortHelper.java new file mode 100644 index 0000000..499b334 --- /dev/null +++ b/app/src/main/java/com/example/swingarmapp_sandblast/services/USBSerialPortHelper.java @@ -0,0 +1,451 @@ +package com.example.swingarmapp_sandblast.services; + + +import static com.example.swingarmapp_sandblast.services.ErrorDeocdeHelper.ErrorDeocde; + +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.swingarmapp_sandblast.BuildConfig; +import com.example.swingarmapp_sandblast.MainActivity; +import com.example.swingarmapp_sandblast.models.ErrorModel; +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 com.example.swingarmapp_sandblast.models.BspIV; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Objects; + +public class USBSerialPortHelper implements SerialInputOutputManager.Listener { + + + public USBSerialPortHelper(MainActivity mainActivity) + { + this.MainActivity=mainActivity; + } + + private 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 WRITE_WAIT_MILLIS = 500; + 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; + + 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 == false)//从收到第一个数据开始计时 + { + StartCountDown = true; + new CountDownTimer(400, 200) { + public void onTick(long millisUntilFinished) { + + } + public void onFinish() { + + // status("read finished"); + decodeRceive(listTobyte(_receiveBufferlist)); + _receiveBufferlist.clear(); + StartCountDown = false; + } + }.start(); + } + } + + + /* + 逐位检查并构建二进制字符串 + */ + 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位添加一个分隔符 + */ + String unsignedIntToBinaryWithSeparator(int value) { + StringBuilder sb = new StringBuilder(35); + for (int i = 11; i >= 0; i--) { + sb.append((value & (1 << i)) == 0 ? '0' : '1'); + if (i % 4 == 0 && i != 0) { + sb.append(' '); // 每4位添加一个分隔符 + } + } + return sb.toString(); + } + 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); + } + + private void decodeRceive(byte[] data) { + try { + + // String dataReceived = bytesToHex(data); + //status(dataReceived); + // if ((data[0] == 0xFE) && (data[1] == 0xFE)) + byte[] crcbytes = new byte[data.length - 2]; + System.arraycopy(data, 0, crcbytes, 0, data.length - 2); + byte[] crc=ModbusCRC.calculateCRC(crcbytes); + // status(bytesToHex(data)); + // status(String.valueOf(crc[0]+" "+ String.valueOf(crc[1]))); + 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); + + BspIV.IV_struct_define _toReceiveIV=BspIV.IV_struct_define.parseFrom(bytes); + + if (_toReceiveIV!=null) + { + MainActivity.mainBinding.tvSpeedFrom32.setText(String.valueOf((double)_toReceiveIV.getRobotMoveDeriSpeed()/10)); + + MainActivity.mainBinding.tvAngleFrom32.setText(String.valueOf((double)_toReceiveIV.getRobotGyro()/100)); + MainActivity.mainBinding.tvHeightFrom32.setText(String.valueOf((double)_toReceiveIV.getDistanceSensor()/10)); + + MainActivity.mainBinding.tvLCompensationFrom32.setText(String.valueOf((double)_toReceiveIV.getLeftCompensation()/100)); + + MainActivity.mainBinding.tvRCopmpensationFrom32.setText(String.valueOf(((double) _toReceiveIV.getRightCompensation()/100))); + +// + if(_toReceiveIV.getIsOnline()==0) + { + MainActivity.mainBinding.tvSignal.setText("断开"); + } + else if(_toReceiveIV.getIsOnline()==1) + { + MainActivity.mainBinding.tvSignal.setText("已连接"); + } + + int errorInt = _toReceiveIV.getSystemError();//硬件错误 + String errorString2 = ErrorDeocde(errorInt); + String errorString = " # " + unsignedIntToBinaryWithSeparator(errorInt); + errorString += " " + toHex4Digits(_toReceiveIV.getLeftMotorErr()); + errorString += " " + toHex4Digits(_toReceiveIV.getRightMotorErr()); + errorString += " " + toHex4Digits(_toReceiveIV.getSwingMotorErr()); + + if(errorInt !=0 || _toReceiveIV.getLeftMotorErr()!=0 ||_toReceiveIV.getRightMotorErr()!=0 ||_toReceiveIV.getSwingMotorErr()!=0) + { + if(!Objects.equals(errorLast, errorString)){ + ErrorModel em = new ErrorModel(System.currentTimeMillis(), errorString); + MainActivity.myDataHelper.AddOrUpdateErrorModel(em); + + if(Objects.equals(errorString2, "未复位")) + { + MainActivity.mainBinding.mainViewErrMessageTxView.setText(String.valueOf(errorString2)); + } + else + { + MainActivity.mainBinding.mainViewErrMessageTxView.setText("有"); + } + + errorLast = errorString; + } + } + else + { + MainActivity.mainBinding.mainViewErrMessageTxView.setText("无"); + } + + + + + }else + { + // status("null"); + } + + + + + + }else + { + + } + + }else + { + //status("crc failed"); + } + + + + + } 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 { + 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/swingarmapp_sandblast/services/VideoPlayerHelper.java b/app/src/main/java/com/example/swingarmapp_sandblast/services/VideoPlayerHelper.java new file mode 100644 index 0000000..ba62290 --- /dev/null +++ b/app/src/main/java/com/example/swingarmapp_sandblast/services/VideoPlayerHelper.java @@ -0,0 +1,27 @@ +package com.example.swingarmapp_sandblast.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.SURFACEVIEW);//设置渲染器类型 + 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/swingarmapp_sandblast/viewmodels/MainViewModel.java b/app/src/main/java/com/example/swingarmapp_sandblast/viewmodels/MainViewModel.java new file mode 100644 index 0000000..081ec7f --- /dev/null +++ b/app/src/main/java/com/example/swingarmapp_sandblast/viewmodels/MainViewModel.java @@ -0,0 +1,11 @@ +package com.example.swingarmapp_sandblast.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..97deb24 --- /dev/null +++ b/app/src/main/java/generate_java.bat @@ -0,0 +1,2 @@ + protoc --java_out . *.proto + pause 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/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/border_active.xml b/app/src/main/res/drawable/border_active.xml new file mode 100644 index 0000000..5919263 --- /dev/null +++ b/app/src/main/res/drawable/border_active.xml @@ -0,0 +1,8 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/border_inactive.xml b/app/src/main/res/drawable/border_inactive.xml new file mode 100644 index 0000000..093780c --- /dev/null +++ b/app/src/main/res/drawable/border_inactive.xml @@ -0,0 +1,8 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/borderblue.xml b/app/src/main/res/drawable/borderblue.xml new file mode 100644 index 0000000..b234be6 --- /dev/null +++ b/app/src/main/res/drawable/borderblue.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable/borderbluegreen.xml b/app/src/main/res/drawable/borderbluegreen.xml new file mode 100644 index 0000000..25d3346 --- /dev/null +++ b/app/src/main/res/drawable/borderbluegreen.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + 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..eef56c3 --- /dev/null +++ b/app/src/main/res/drawable/borderorange.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/button_active.xml b/app/src/main/res/drawable/button_active.xml new file mode 100644 index 0000000..28f66f6 --- /dev/null +++ b/app/src/main/res/drawable/button_active.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/button_inactive.xml b/app/src/main/res/drawable/button_inactive.xml new file mode 100644 index 0000000..146bfd1 --- /dev/null +++ b/app/src/main/res/drawable/button_inactive.xml @@ -0,0 +1,11 @@ + + + + + + + + + \ No newline at end of file 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/container_active.xml b/app/src/main/res/drawable/container_active.xml new file mode 100644 index 0000000..dc691f7 --- /dev/null +++ b/app/src/main/res/drawable/container_active.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/container_inactive.xml b/app/src/main/res/drawable/container_inactive.xml new file mode 100644 index 0000000..edcae41 --- /dev/null +++ b/app/src/main/res/drawable/container_inactive.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file 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/my_cursor.xml b/app/src/main/res/drawable/my_cursor.xml new file mode 100644 index 0000000..970a494 --- /dev/null +++ b/app/src/main/res/drawable/my_cursor.xml @@ -0,0 +1,9 @@ + + + + android:shape="rectangle"> + + + \ No newline at end of file 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..8835bab --- /dev/null +++ b/app/src/main/res/drawable/orange_rounded_rectangle.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + 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..e7389bd --- /dev/null +++ b/app/src/main/res/drawable/radio_button_selected.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + 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..9fe93c7 --- /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..ccb6bf8 --- /dev/null +++ b/app/src/main/res/drawable/radio_button_unselected.xml @@ -0,0 +1,8 @@ + + + + + + + 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/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/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/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml new file mode 100644 index 0000000..7897244 --- /dev/null +++ b/app/src/main/res/layout/activity_main.xml @@ -0,0 +1,1058 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/backsetpopup.xml b/app/src/main/res/layout/backsetpopup.xml new file mode 100644 index 0000000..4780d83 --- /dev/null +++ b/app/src/main/res/layout/backsetpopup.xml @@ -0,0 +1,180 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/log_item.xml b/app/src/main/res/layout/log_item.xml new file mode 100644 index 0000000..520b0a2 --- /dev/null +++ b/app/src/main/res/layout/log_item.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/manualmodepopup.xml b/app/src/main/res/layout/manualmodepopup.xml new file mode 100644 index 0000000..6e59107 --- /dev/null +++ b/app/src/main/res/layout/manualmodepopup.xml @@ -0,0 +1,174 @@ + + + + + + + + + + + + + + + + + + + + + + > + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/parameters_call.xml b/app/src/main/res/layout/parameters_call.xml new file mode 100644 index 0000000..36c6e0b --- /dev/null +++ b/app/src/main/res/layout/parameters_call.xml @@ -0,0 +1,201 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/swingarmanglepopup.xml b/app/src/main/res/layout/swingarmanglepopup.xml new file mode 100644 index 0000000..a9d84ad --- /dev/null +++ b/app/src/main/res/layout/swingarmanglepopup.xml @@ -0,0 +1,190 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ 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..d5516cd --- /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..7ed5a2f --- /dev/null +++ b/app/src/main/res/values/colors.xml @@ -0,0 +1,168 @@ + + + #FF000000 + #FFFFFFFF + #FFFFFFFF + #BDBDBD + #3F51B5 + #303F9F + #FF4081 + + #FBE5D6 + #1F4E79 + #00ACFC + #DEEBF7 + #FBE5D6 + #FF713D + #001E54 + + + + + + #00194d + #00ADFC + + #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..e62c039 --- /dev/null +++ b/app/src/main/res/values/strings.xml @@ -0,0 +1,42 @@ + + 摆臂sandbalst + 状态\n信息 + 移动\n速度 + 实时\n高度 + 实时\n角度 + 左侧\n补偿 + 右侧\n补偿 + 手动\n模式 + + 手动操作 + 竖直操作 + 水平操作 + + + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + + + + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + + 20 + + \ 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..a645915 --- /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/swingarmapp_sandblast/ExampleUnitTest.java b/app/src/test/java/com/example/swingarmapp_sandblast/ExampleUnitTest.java new file mode 100644 index 0000000..9d1d62f --- /dev/null +++ b/app/src/test/java/com/example/swingarmapp_sandblast/ExampleUnitTest.java @@ -0,0 +1,17 @@ +package com.example.swingarmapp_sandblast; + +import org.junit.Test; + +import static org.junit.Assert.*; + +/** + * Example local unit test, which will execute on the development machine (host). + * + * @see Testing documentation + */ +public class ExampleUnitTest { + @Test + public void addition_isCorrect() { + 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..ab0fcbf --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Wed Feb 05 16:42:57 CST 2025 +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/settings.gradle b/settings.gradle new file mode 100644 index 0000000..be3882d --- /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 = "SwingArmAPP_SandBlast" +include ':app' diff --git a/swingarmapp_sandblast/.gitignore b/swingarmapp_sandblast/.gitignore new file mode 100644 index 0000000..aa724b7 --- /dev/null +++ b/swingarmapp_sandblast/.gitignore @@ -0,0 +1,15 @@ +*.iml +.gradle +/local.properties +/.idea/caches +/.idea/libraries +/.idea/modules.xml +/.idea/workspace.xml +/.idea/navEditor.xml +/.idea/assetWizardSettings.xml +.DS_Store +/build +/captures +.externalNativeBuild +.cxx +local.properties diff --git a/swingarmapp_sandblast/.idea/.gitignore b/swingarmapp_sandblast/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/swingarmapp_sandblast/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/swingarmapp_sandblast/.idea/.name b/swingarmapp_sandblast/.idea/.name new file mode 100644 index 0000000..05e305b --- /dev/null +++ b/swingarmapp_sandblast/.idea/.name @@ -0,0 +1 @@ +SwingArmAPP_SandBlast \ No newline at end of file diff --git a/swingarmapp_sandblast/.idea/compiler.xml b/swingarmapp_sandblast/.idea/compiler.xml new file mode 100644 index 0000000..b86273d --- /dev/null +++ b/swingarmapp_sandblast/.idea/compiler.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/swingarmapp_sandblast/.idea/deploymentTargetDropDown.xml b/swingarmapp_sandblast/.idea/deploymentTargetDropDown.xml new file mode 100644 index 0000000..0c0c338 --- /dev/null +++ b/swingarmapp_sandblast/.idea/deploymentTargetDropDown.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/swingarmapp_sandblast/.idea/deploymentTargetSelector.xml b/swingarmapp_sandblast/.idea/deploymentTargetSelector.xml new file mode 100644 index 0000000..60ba08d --- /dev/null +++ b/swingarmapp_sandblast/.idea/deploymentTargetSelector.xml @@ -0,0 +1,18 @@ + + + + + + + + + \ No newline at end of file diff --git a/swingarmapp_sandblast/.idea/gradle.xml b/swingarmapp_sandblast/.idea/gradle.xml new file mode 100644 index 0000000..7b3006b --- /dev/null +++ b/swingarmapp_sandblast/.idea/gradle.xml @@ -0,0 +1,20 @@ + + + + + + + \ No newline at end of file diff --git a/swingarmapp_sandblast/.idea/migrations.xml b/swingarmapp_sandblast/.idea/migrations.xml new file mode 100644 index 0000000..f8051a6 --- /dev/null +++ b/swingarmapp_sandblast/.idea/migrations.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/swingarmapp_sandblast/.idea/misc.xml b/swingarmapp_sandblast/.idea/misc.xml new file mode 100644 index 0000000..b2c751a --- /dev/null +++ b/swingarmapp_sandblast/.idea/misc.xml @@ -0,0 +1,9 @@ + + + + + + + + \ No newline at end of file diff --git a/swingarmapp_sandblast/.idea/render.experimental.xml b/swingarmapp_sandblast/.idea/render.experimental.xml new file mode 100644 index 0000000..8ec256a --- /dev/null +++ b/swingarmapp_sandblast/.idea/render.experimental.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/swingarmapp_sandblast/.idea/runConfigurations.xml b/swingarmapp_sandblast/.idea/runConfigurations.xml new file mode 100644 index 0000000..16660f1 --- /dev/null +++ b/swingarmapp_sandblast/.idea/runConfigurations.xml @@ -0,0 +1,17 @@ + + + + + + \ No newline at end of file diff --git a/swingarmapp_sandblast/.idea/vcs.xml b/swingarmapp_sandblast/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/swingarmapp_sandblast/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/swingarmapp_sandblast/README.md b/swingarmapp_sandblast/README.md new file mode 100644 index 0000000..e69de29 diff --git a/swingarmapp_sandblast/app/.gitignore b/swingarmapp_sandblast/app/.gitignore new file mode 100644 index 0000000..42afabf --- /dev/null +++ b/swingarmapp_sandblast/app/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/swingarmapp_sandblast/app/build.gradle b/swingarmapp_sandblast/app/build.gradle new file mode 100644 index 0000000..5dfaded --- /dev/null +++ b/swingarmapp_sandblast/app/build.gradle @@ -0,0 +1,58 @@ +plugins { + id 'com.android.application' +} + +android { + namespace 'com.example.swingarmapp_sandblast' + compileSdk 35 + viewBinding + { + enabled true + } + // //add this feature + dataBinding + { + enabled true + } + defaultConfig { + applicationId "com.example.swingarmapp_sandblast" + minSdk 24 + targetSdk 35 + versionCode 1 + versionName "1.0" + + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + } + + 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 'com.google.android.material:material:1.9.0' + implementation 'androidx.constraintlayout:constraintlayout:2.1.4' + 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/swingarmapp_sandblast/app/proguard-rules.pro b/swingarmapp_sandblast/app/proguard-rules.pro new file mode 100644 index 0000000..481bb43 --- /dev/null +++ b/swingarmapp_sandblast/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/swingarmapp_sandblast/app/release/app-release.apk b/swingarmapp_sandblast/app/release/app-release.apk new file mode 100644 index 0000000..7262d7c Binary files /dev/null and b/swingarmapp_sandblast/app/release/app-release.apk differ diff --git a/swingarmapp_sandblast/app/release/baselineProfiles/0/app-release.dm b/swingarmapp_sandblast/app/release/baselineProfiles/0/app-release.dm new file mode 100644 index 0000000..e3cbdb4 Binary files /dev/null and b/swingarmapp_sandblast/app/release/baselineProfiles/0/app-release.dm differ diff --git a/swingarmapp_sandblast/app/release/baselineProfiles/1/app-release.dm b/swingarmapp_sandblast/app/release/baselineProfiles/1/app-release.dm new file mode 100644 index 0000000..c46deb7 Binary files /dev/null and b/swingarmapp_sandblast/app/release/baselineProfiles/1/app-release.dm differ diff --git a/swingarmapp_sandblast/app/release/output-metadata.json b/swingarmapp_sandblast/app/release/output-metadata.json new file mode 100644 index 0000000..9ec7083 --- /dev/null +++ b/swingarmapp_sandblast/app/release/output-metadata.json @@ -0,0 +1,37 @@ +{ + "version": 3, + "artifactType": { + "type": "APK", + "kind": "Directory" + }, + "applicationId": "com.example.swingarmapp_sandblast", + "variantName": "release", + "elements": [ + { + "type": "SINGLE", + "filters": [], + "attributes": [], + "versionCode": 1, + "versionName": "1.0", + "outputFile": "app-release.apk" + } + ], + "elementType": "File", + "baselineProfiles": [ + { + "minApi": 28, + "maxApi": 30, + "baselineProfiles": [ + "baselineProfiles/1/app-release.dm" + ] + }, + { + "minApi": 31, + "maxApi": 2147483647, + "baselineProfiles": [ + "baselineProfiles/0/app-release.dm" + ] + } + ], + "minSdkVersionForDexing": 24 +} \ No newline at end of file diff --git a/swingarmapp_sandblast/app/src/androidTest/java/com/example/swingarmapp_sandblast/ExampleInstrumentedTest.java b/swingarmapp_sandblast/app/src/androidTest/java/com/example/swingarmapp_sandblast/ExampleInstrumentedTest.java new file mode 100644 index 0000000..0586ed0 --- /dev/null +++ b/swingarmapp_sandblast/app/src/androidTest/java/com/example/swingarmapp_sandblast/ExampleInstrumentedTest.java @@ -0,0 +1,26 @@ +package com.example.swingarmapp_sandblast; + +import android.content.Context; + +import androidx.test.platform.app.InstrumentationRegistry; +import androidx.test.ext.junit.runners.AndroidJUnit4; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import static org.junit.Assert.*; + +/** + * Instrumented test, which will execute on an Android device. + * + * @see 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/swingarmapp_sandblast/app/src/main/AndroidManifest.xml b/swingarmapp_sandblast/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..06d4d63 --- /dev/null +++ b/swingarmapp_sandblast/app/src/main/AndroidManifest.xml @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/swingarmapp_sandblast/app/src/main/java/bsp_Error.proto b/swingarmapp_sandblast/app/src/main/java/bsp_Error.proto new file mode 100644 index 0000000..5590c14 --- /dev/null +++ b/swingarmapp_sandblast/app/src/main/java/bsp_Error.proto @@ -0,0 +1,45 @@ +syntax = "proto3"; + +option java_multiple_files = false; +option java_package = "com.example.swingarmapp_sandblast.models"; + + message ErrorDataInfo + { + int32 Error_Value = 1; + bytes Error_Name=4; + } + + +message ErrorData +{ + int32 ErrorCode=1; + int32 Motor_1_Error=21; + int32 Motor_2_Error=22; + int32 Motor_3_Error=23; + int32 Motor_4_Error=24; + int32 Motor_5_Error=25; + int32 Motor_6_Error=26; + int32 Motor_7_Error=27; +} + +enum ComError //枚举消息类型 + { + Mk32_SBus =0; //proto3版本中,首成员必须为0,成员不应有相同的值 + MK32_Serial =1; + MK32_InitialState =2; + TL720D =3; + + ZQ_CAN_ID1_LeftMotor =4; + ZQ_CAN_ID2_RightMotor =5; + ZQ_CAN_ID3_SwingMotor =6; + Force_Sensor =7; + Mfog40 =8; + Ultrasonic_Sensor =9; + + } + +//protoc --nanopb_out=. *.proto + + + + diff --git a/swingarmapp_sandblast/app/src/main/java/bsp_IV.options b/swingarmapp_sandblast/app/src/main/java/bsp_IV.options new file mode 100644 index 0000000..ba860c4 --- /dev/null +++ b/swingarmapp_sandblast/app/src/main/java/bsp_IV.options @@ -0,0 +1,2 @@ +# lock.options +IV_struct_define.Buff_Data max_size:30 fixed_length:true \ No newline at end of file diff --git a/swingarmapp_sandblast/app/src/main/java/bsp_IV.proto b/swingarmapp_sandblast/app/src/main/java/bsp_IV.proto new file mode 100644 index 0000000..d48bca4 --- /dev/null +++ b/swingarmapp_sandblast/app/src/main/java/bsp_IV.proto @@ -0,0 +1,22 @@ +syntax = "proto3"; + +option java_multiple_files = false; +option java_package = "com.example.swingarmapp_sandblast.models"; + +message IV_struct_define +{ + int32 LeftCompensation= 1;//发送100显示1° + int32 RightCompensation= 2;//发送100显示1° + int32 Robot_Move_Deri_Speed= 3;//发送100显示10m/min + int32 Robot_Gyro= 4;//发送100显示1° + int32 Distance_Sensor=5; //发送100显示10cm + int32 SystemError=6;//硬件通讯错误及按键未初始化错误 + int32 Left_Motor_Err=7;//左轮电机报警 + int32 Right_Motor_Err=8;//右轮电机报警 + int32 Swing_Motor_Err=9;//摆臂电机报警 + int32 Is_Online=10;//是否在线 + int32 Spara_Data_1=11;//备用数据1 + int32 Spara_Data_2=12;//备用数据2 + int32 Spara_Data_3=13;//备用数据3 +}; + diff --git a/swingarmapp_sandblast/app/src/main/java/bsp_PV.proto b/swingarmapp_sandblast/app/src/main/java/bsp_PV.proto new file mode 100644 index 0000000..997e078 --- /dev/null +++ b/swingarmapp_sandblast/app/src/main/java/bsp_PV.proto @@ -0,0 +1,22 @@ +syntax = "proto3"; +option java_multiple_files = false; +option java_package = "com.example.swingarmapp_sandblast.models"; +message PV_struct_define{ + int32 Robot_Operation_Mode= 1; //操作模式 手动模式1 2 3 4 自动模式5 6 7 + int32 Robot_Move_Speed=2; //机器人移动速度 + int32 Robot_Change_Lane_Distance= 3; //换道距离 + int32 Robot_Swing_Speed= 4; //摆臂速度 + int32 Robot_symmetricalOrNot=5; //摆臂角度界面中的对称or非对称 1 对称 2 非对称 + int32 Robot_Swing_Range_Angle=6; //对称下的摆臂角度 + int32 Robot_asymmetricalAngleSetValue=7; //非对称条件下下 1左侧 2 右侧 + int32 Robot_backMode=8; //后退设置模式 1 打退交替 2 边打边退 + int32 Robot_Back_Distance= 9; //打退交替条件下的后退距离 + int32 Robot_Back_Speed=10; //边打边退条件下的后退速度 + int32 Robot_Press_Set= 11; //压力设置 + int32 Robot_Vertical_Adjust= 12; //竖直微调 + int32 Robot_Length_Homework=13; //自动模式下的作业长度 + int32 Robot_Width_Homework=14; //自动模式下的作业宽度 + int32 Robot_SandBalst_Encode_One=15; //喷砂机编码1 输入为空发1 + int32 Robot_SandBalst_Encode_Two=16; //喷砂机编码2 输入为空发2 +}; + diff --git a/swingarmapp_sandblast/app/src/main/java/com/example/swingarmapp_sandblast/MainActivity.java b/swingarmapp_sandblast/app/src/main/java/com/example/swingarmapp_sandblast/MainActivity.java new file mode 100644 index 0000000..4f5a899 --- /dev/null +++ b/swingarmapp_sandblast/app/src/main/java/com/example/swingarmapp_sandblast/MainActivity.java @@ -0,0 +1,585 @@ +package com.example.swingarmapp_sandblast; + +import androidx.appcompat.app.AppCompatActivity; +import androidx.databinding.DataBindingUtil; + +import android.os.Bundle; +import android.text.Editable; +import android.text.InputFilter; +import android.text.TextUtils; +import android.text.TextWatcher; +import android.view.View; +import android.view.WindowManager; +import android.widget.Toast; + +import com.example.swingarmapp_sandblast.databinding.ActivityMainBinding; +import com.example.swingarmapp_sandblast.models.DisplayPV; +import com.example.swingarmapp_sandblast.models.DisplaySandBlast; +import com.example.swingarmapp_sandblast.services.DecimalDigitsInputFilter; +import com.example.swingarmapp_sandblast.services.ModbusCRC; +import com.example.swingarmapp_sandblast.services.MyDataHelper; +import com.example.swingarmapp_sandblast.services.PopupHelper; +import com.example.swingarmapp_sandblast.services.USBSerialPortHelper; + +import com.example.swingarmapp_sandblast.models.BspPV; + +import java.util.List; +import java.util.Timer; +import java.util.TimerTask; + +public class MainActivity extends AppCompatActivity { + + public ActivityMainBinding mainBinding;//通过Binding可以获取界面数据 + //USB 串口服务 + public USBSerialPortHelper serialPortHelper;//串口接收类 + private BspPV.PV_struct_define _toSendPV; + + Timer timer = new Timer(); + + public MyDataHelper myDataHelper = new MyDataHelper(this);//数据库类 + public PopupHelper popupHelper = new PopupHelper(this);//对话框类,把主界面实例传过去 + + public static byte[] stopgetAllChData = new byte[]{0x55, 0x66, 0x01, 0x01, 0x00, 0x00, 0x00, 0x42, 0x00, (byte) (0xf7 & 0xff), (byte) (0xe0 & 0xff)}; + public static int sendStopDataCount = 0; + public String _parameters_Call_Value = "1"; //默认1 + public String _Manual_Mode_Call_Value = "无"; // 默认为手动模式 无 模式值1-4 + public String _Auto_Mode_Call_Value = "未启用"; // 默认为未启用 模式值6 7 + public String workLength = "0"; //自动模式下作业长度----->变量存储 + + public String workWidth = "0"; ////自动模式下作业宽度----->变量存储 + + public int symmetricalOrNot = 1; //1对称 2非对称----->变量存储 + + public int asymmetricalAngleSetValue= 0 ; //非对称下的值 0 默认 1 左侧 2 右侧----->变量存储 + + public int backMode = 1 ; // 1 打退交替 2 边打边退----->变量存储 + + public String backSpeedSetValue = "5.0"; // 边打边退速度值----->变量存储 + public boolean isInputGroupActive = true; // 默认对称组激活 --->摆臂角度界面 + public boolean isFirstInputActive = true; // 默认第一个输入框激活--->后退界面 + + + + @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.MaintvVerticalAdjustTo32.setFilters(new InputFilter[]{new DecimalDigitsInputFilter()}); //editext 一位小数限制 + mainBinding.MaintvMoveSpeedTo32.setFilters(new InputFilter[]{new DecimalDigitsInputFilter() }); + + /* USB串口 控制区域*/ + serialPortHelper = new USBSerialPortHelper(this); + serialPortHelper.intialize(); + serialPortHelper.connect(); + + +// //程序初始化,读取数据库,进行界面显示 + myDataHelper.IntializeDataBase(); + String parame = mainBinding.MaintvParameterCallTo32.getText().toString(); //获取界面参数调用值 + //读取数据 + int paraIndex = Integer.parseInt(parame); + List pvList = myDataHelper.getDisplayData(paraIndex); //按id查询数据赋值给界面 + + mainBinding.MaintvSwingArmAngleTo32.setText(String.valueOf(pvList.get(0).getSwingArmAngle())); + mainBinding.MaintvSwingArmSpeedTo32.setText(String.valueOf(pvList.get(0).getSwingArmSpeed())); + mainBinding.MaintvBackDistanceTo32.setText(String.valueOf(pvList.get(0).getBackDistance())); + mainBinding.MaintvLaneChangeDistanceTo32.setText(String.valueOf(pvList.get(0).getLaneChangeDistance())); + mainBinding.MaintvPressTo32.setText(String.valueOf(pvList.get(0).getPressSet())); + mainBinding.MaintvVerticalAdjustTo32.setText(String.valueOf(pvList.get(0).getVerticalAdjust())); + backSpeedSetValue=String.valueOf(pvList.get(0).getBackSpeedValue()); + workLength=String.valueOf(pvList.get(0).getWorkLength()); + workWidth=String.valueOf(pvList.get(0).getWorkWidth()); + + /***读取喷砂机编码设置**/ + ListdsbList = myDataHelper.getDisplayData_sandBalst(); //按id查询数据赋值给界面 + mainBinding.MaintvSandCodeOneTo32.setText(String.valueOf(dsbList.get(0).getsand_encodeone())); + mainBinding.MaintvSandCodeTwoTo32.setText(String.valueOf(dsbList.get(0).getsand_encodetwo())); + + + + /*发往32*/ + timer.schedule(new TimerTask() { + @Override + public void run() { + // 使用 Handler 或 runOnUiThread 更新 UI + runOnUiThread(new Runnable() { + @Override + public void run() { + // 更新 UI 的代码 + _toSendPV = BspPV.PV_struct_define.newBuilder() + .setRobotOperationMode(1) + .setRobotMoveSpeed(0) + .setRobotChangeLaneDistance(0) + .setRobotSwingSpeed(0) + .setRobotSymmetricalOrNot(1) + .setRobotSwingRangeAngle(0) + .setRobotAsymmetricalAngleSetValue(1) + .setRobotBackMode(1) + .setRobotBackDistance(0) + .setRobotBackSpeed(0) + .setRobotPressSet(0) + .setRobotVerticalAdjust(0) + .setRobotLengthHomework(0) + .setRobotWidthHomework(0) + .build(); + + + String MoveSpeedStr = mainBinding.MaintvMoveSpeedTo32.getText().toString(); + String ChangeLaneDistanceStr = mainBinding.MaintvLaneChangeDistanceTo32.getText().toString(); + String SwingSpeedStr = mainBinding.MaintvSwingArmSpeedTo32.getText().toString(); + String SwingRangeAngleStr = mainBinding.MaintvSwingArmAngleTo32.getText().toString(); + String BackDistanceStr = mainBinding.MaintvBackDistanceTo32.getText().toString(); + String PressStr = mainBinding.MaintvPressTo32.getText().toString(); + String VeticalAdjustStr = mainBinding.MaintvVerticalAdjustTo32.getText().toString(); + String SandBlastOneStr = mainBinding.MaintvSandCodeOneTo32.getText().toString(); + String SandBlastTwoStr = mainBinding.MaintvSandCodeTwoTo32.getText().toString(); + if(SandBlastOneStr.isEmpty() ){_toSendPV.toBuilder() + .setRobotSandBalstEncodeOne(1).build(); + } + else { + _toSendPV = _toSendPV.toBuilder() + .setRobotSandBalstEncodeOne((Integer.parseInt(String.valueOf(mainBinding.MaintvSandCodeOneTo32.getText())))).build(); + } + + if(SandBlastTwoStr.isEmpty() ){_toSendPV.toBuilder() + .setRobotSandBalstEncodeTwo(2).build(); + } + else { + _toSendPV = _toSendPV.toBuilder() + .setRobotSandBalstEncodeTwo((Integer.parseInt(String.valueOf(mainBinding.MaintvSandCodeTwoTo32.getText())))).build(); + } + + //移动速度 + try { + if( MoveSpeedStr.isEmpty() ) {_toSendPV = _toSendPV.toBuilder().setRobotMoveSpeed(1).build();} + else { _toSendPV = _toSendPV.toBuilder() + .setRobotMoveSpeed( (int) (Double.parseDouble(String.valueOf(mainBinding.MaintvMoveSpeedTo32.getText()))*10 )).build(); + } + } + catch (Exception e) + { + + } + + //换道距离 + if( ChangeLaneDistanceStr.isEmpty() ) {_toSendPV = _toSendPV.toBuilder().setRobotChangeLaneDistance(1).build();} + else { _toSendPV = _toSendPV.toBuilder() + .setRobotChangeLaneDistance((Integer.parseInt(String.valueOf(mainBinding.MaintvLaneChangeDistanceTo32.getText())))).build();} + //摆臂速度 + if( SwingSpeedStr.isEmpty() ) {_toSendPV = _toSendPV.toBuilder().setRobotSwingSpeed(1).build();} + else { _toSendPV = _toSendPV.toBuilder() + .setRobotSwingSpeed((Integer.parseInt(String.valueOf(mainBinding.MaintvSwingArmSpeedTo32.getText())))).build();} + //摆臂角度 + if( SwingRangeAngleStr.isEmpty() ) {_toSendPV = _toSendPV.toBuilder().setRobotSwingRangeAngle(1).build();} + else { _toSendPV = _toSendPV.toBuilder() + .setRobotSwingRangeAngle((Integer.parseInt(String.valueOf(mainBinding.MaintvSwingArmAngleTo32.getText())))).build();} + + _toSendPV = _toSendPV.toBuilder().setRobotBackMode(backMode).build(); //1 打退交替 2 边打边退 + _toSendPV = _toSendPV.toBuilder().setRobotBackSpeed( (int) (Double.parseDouble(backSpeedSetValue)*10) ).build(); //边打边退的后退速度 *10 + _toSendPV = _toSendPV.toBuilder().setRobotSymmetricalOrNot(symmetricalOrNot).build(); //1 对称 2//非对称 + _toSendPV = _toSendPV.toBuilder().setRobotAsymmetricalAngleSetValue(asymmetricalAngleSetValue).build(); //非对称下左侧右侧值 1 左 2右 + _toSendPV = _toSendPV.toBuilder().setRobotLengthHomework(Integer.parseInt(workLength)).build(); //作业长度 + _toSendPV = _toSendPV.toBuilder().setRobotWidthHomework(Integer.parseInt(workWidth)).build(); //作业宽度 + + //后退距离 + try { + if( BackDistanceStr.isEmpty() ) {_toSendPV = _toSendPV.toBuilder().setRobotBackDistance(1).build();} + else { _toSendPV = _toSendPV.toBuilder() + .setRobotBackDistance( (int) (Double.parseDouble(String.valueOf(mainBinding.MaintvBackDistanceTo32.getText()))*10 )).build(); + } + } catch (Exception e) { + + } + try { + //压力设定 + if( PressStr.isEmpty() ) {_toSendPV = _toSendPV.toBuilder().setRobotPressSet(1).build();} + else { _toSendPV = _toSendPV.toBuilder() + .setRobotPressSet((Integer.parseInt(String.valueOf(mainBinding.MaintvPressTo32.getText())))).build();} + }catch (Exception e) { + + } + + //竖直微调--小数 *10 + try { + + if( VeticalAdjustStr.isEmpty() ) {_toSendPV = _toSendPV.toBuilder().setRobotVerticalAdjust(0).build();} + else { _toSendPV = _toSendPV.toBuilder() + .setRobotVerticalAdjust( (int) (Double.parseDouble(String.valueOf(mainBinding.MaintvVerticalAdjustTo32.getText()))*10 )) .build(); + + } + + } catch (Exception e) { + + } + + + //自动手动模式发送 + + if(_Manual_Mode_Call_Value.equals("未启用")) //手动模式未启用 + { + //发送自动模式值 + if(_Auto_Mode_Call_Value.equals("水平")) + { + _toSendPV = _toSendPV.toBuilder().setRobotOperationMode(6).build(); + } else if(_Auto_Mode_Call_Value.equals("平面")) { + _toSendPV = _toSendPV.toBuilder().setRobotOperationMode(7).build(); + } + + } + else if(_Auto_Mode_Call_Value.equals("未启用")) //自动模式未启用 + { + //发送手动模式值 + if (_Manual_Mode_Call_Value.equals("无")) { + _toSendPV = _toSendPV.toBuilder().setRobotOperationMode(1).build(); + } else if (_Manual_Mode_Call_Value.equals("水平")) { + _toSendPV = _toSendPV.toBuilder().setRobotOperationMode(2).build(); + } else if (_Manual_Mode_Call_Value.equals("平面")) { + _toSendPV = _toSendPV.toBuilder().setRobotOperationMode(3).build(); + } else if (_Manual_Mode_Call_Value.equals("竖直向左")) { + _toSendPV = _toSendPV.toBuilder().setRobotOperationMode(4).build(); + } + else if (_Manual_Mode_Call_Value.equals("竖直向右")) { + _toSendPV = _toSendPV.toBuilder().setRobotOperationMode(5).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, 1000); // 延迟 0 毫秒,每隔 1000 毫秒执行一次 + + + + + + //三个弹窗选择界面 + mainBinding.setManualModeBtn.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + popupHelper.ManualModePopup(this); + } + }); + + mainBinding.setAutoModeBtn.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + popupHelper.AutoModePopup(this); + } + }); + + mainBinding.setSwingArmAngleBtn.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + popupHelper.SwingArmPopup(); + } + }); + + mainBinding.setBackDistanceBtn.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + popupHelper.BackSetPopup(); + } + }); + + mainBinding.setcallParametersBtn.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + popupHelper.ParametersCallPopup(this,myDataHelper); + } + }); + mainBinding.mainViewErrMessageBtn.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + popupHelper.RobotErrorListPopUp(this); + } + }); + + + + //移动速度事件 + mainBinding.MaintvMoveSpeedTo32.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(); + double value=0.0; + + if (!input.isEmpty()) { + try { + value = Double.parseDouble(input); + // 检查输入值是否在 -50 到 100 范围内 + if (value <= 0 || value > 14) { + showToast("请输入 0 到 14 之间的数字"); + // 可以选择清除输入或限制在范围内 + mainBinding.MaintvMoveSpeedTo32.setText(""); + + } else { + showToast("输入有效: " + value); + + } + } catch (NumberFormatException e) { + showToast("请输入有效的数字"); + } + } + + } + + }); + //换道距离事件 + mainBinding.MaintvLaneChangeDistanceTo32.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 > 250) { + showToast("请输入 0 到 250 之间的数字"); + // 可以选择清除输入或限制在范围内 + mainBinding.MaintvLaneChangeDistanceTo32.setText(""); + } else { + showToast("输入有效: " + value); + } + } catch (NumberFormatException e) { + showToast("请输入有效的数字"); + } + } + + + } + }); + //摆臂速度 + mainBinding.MaintvSwingArmSpeedTo32.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 > 60) { + showToast("请输入 0 到 60 之间的数字"); + // 可以选择清除输入或限制在范围内 + mainBinding.MaintvSwingArmSpeedTo32.setText(""); + } else { + showToast("输入有效: " + value); + } + } catch (NumberFormatException e) { + showToast("请输入有效的数字"); + } + } + + } + }); + + + //压力设定 + mainBinding.MaintvPressTo32.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 < -3000 || value > 3000) { + showToast("请输入 -3000 到 3000 之间的数字"); + // 可以选择清除输入或限制在范围内 + mainBinding.MaintvPressTo32.setText(""); + } else { + showToast("输入有效: " + value); + } + } catch (NumberFormatException e) { + showToast("请输入有效的数字"); + } + } + } + }); + //竖直微调 + mainBinding.MaintvVerticalAdjustTo32.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 { + + int value = Integer.parseInt(input); + // 检查输入值是否在 -50 到 100 范围内 + if (value < -10 || value > 10) { + showToast("请输入 -10 到 10 之间的数字"); + // 可以选择清除输入或限制在范围内 + mainBinding.MaintvVerticalAdjustTo32.setText(""); + } else { + showToast("输入有效: " + value); + } + // 尝试转换为double(处理小数) + //lastValidValue = Double.parseDouble(input); + } catch (NumberFormatException e) { + // 中间状态,忽略 + } + } + + + + + + + + + + + + } + }); + + //喷砂机设置按钮 + mainBinding.setSandBlastBtn.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + int paraIndex = 1; + int sandBlastone = Integer.parseInt(mainBinding.MaintvSandCodeOneTo32.getText().toString()); + int sandBlasttwo = Integer.parseInt(mainBinding.MaintvSandCodeTwoTo32.getText().toString()); + + //把界面中的值放进PV类的变量中 + DisplaySandBlast displaysb = new DisplaySandBlast(paraIndex, sandBlastone,sandBlasttwo); + myDataHelper.addOrUpdateDisplayData_SandBlast(displaysb); //创建数据库的实例在这里 PV传进去保存到数据库 + showToast("保存成功"); + } + }); + } //oncreate + + +//函数定义放create外 +private void showToast(String message) +{ + Toast.makeText(this, message, Toast.LENGTH_SHORT).show(); +} + + + + + + @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(); + } + } + + +} \ No newline at end of file diff --git a/swingarmapp_sandblast/app/src/main/java/com/example/swingarmapp_sandblast/models/BspError.java b/swingarmapp_sandblast/app/src/main/java/com/example/swingarmapp_sandblast/models/BspError.java new file mode 100644 index 0000000..c1fed8e --- /dev/null +++ b/swingarmapp_sandblast/app/src/main/java/com/example/swingarmapp_sandblast/models/BspError.java @@ -0,0 +1,1724 @@ +// 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.swingarmapp_sandblast.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 { + /** + *
+     * proto3版本中,首成员必须为0,成员不应有相同的值
+     * 
+ * + * Mk32_SBus = 0; + */ + Mk32_SBus(0), + /** + * MK32_Serial = 1; + */ + MK32_Serial(1), + /** + * MK32_InitialState = 2; + */ + MK32_InitialState(2), + /** + * TL720D = 3; + */ + TL720D(3), + /** + * ZQ_CAN_ID1_LeftMotor = 4; + */ + ZQ_CAN_ID1_LeftMotor(4), + /** + * ZQ_CAN_ID2_RightMotor = 5; + */ + ZQ_CAN_ID2_RightMotor(5), + /** + * ZQ_CAN_ID3_SwingMotor = 6; + */ + ZQ_CAN_ID3_SwingMotor(6), + /** + * Force_Sensor = 7; + */ + Force_Sensor(7), + /** + * Mfog40 = 8; + */ + Mfog40(8), + /** + * Ultrasonic_Sensor = 9; + */ + Ultrasonic_Sensor(9), + UNRECOGNIZED(-1), + ; + + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 27, + /* patch= */ 2, + /* suffix= */ "", + ComError.class.getName()); + } + /** + *
+     * proto3版本中,首成员必须为0,成员不应有相同的值
+     * 
+ * + * Mk32_SBus = 0; + */ + public static final int Mk32_SBus_VALUE = 0; + /** + * MK32_Serial = 1; + */ + public static final int MK32_Serial_VALUE = 1; + /** + * MK32_InitialState = 2; + */ + public static final int MK32_InitialState_VALUE = 2; + /** + * TL720D = 3; + */ + public static final int TL720D_VALUE = 3; + /** + * ZQ_CAN_ID1_LeftMotor = 4; + */ + public static final int ZQ_CAN_ID1_LeftMotor_VALUE = 4; + /** + * ZQ_CAN_ID2_RightMotor = 5; + */ + public static final int ZQ_CAN_ID2_RightMotor_VALUE = 5; + /** + * ZQ_CAN_ID3_SwingMotor = 6; + */ + public static final int ZQ_CAN_ID3_SwingMotor_VALUE = 6; + /** + * Force_Sensor = 7; + */ + public static final int Force_Sensor_VALUE = 7; + /** + * Mfog40 = 8; + */ + public static final int Mfog40_VALUE = 8; + /** + * Ultrasonic_Sensor = 9; + */ + public static final int Ultrasonic_Sensor_VALUE = 9; + + + 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 MK32_Serial; + case 2: return MK32_InitialState; + case 3: return TL720D; + case 4: return ZQ_CAN_ID1_LeftMotor; + case 5: return ZQ_CAN_ID2_RightMotor; + case 6: return ZQ_CAN_ID3_SwingMotor; + case 7: return Force_Sensor; + case 8: return Mfog40; + case 9: return Ultrasonic_Sensor; + 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.swingarmapp_sandblast.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 ErrorDataInfoOrBuilder extends + // @@protoc_insertion_point(interface_extends:ErrorDataInfo) + com.google.protobuf.MessageOrBuilder { + + /** + * int32 Error_Value = 1; + * @return The errorValue. + */ + int getErrorValue(); + + /** + * bytes Error_Name = 4; + * @return The errorName. + */ + com.google.protobuf.ByteString getErrorName(); + } + /** + * Protobuf type {@code ErrorDataInfo} + */ + public static final class ErrorDataInfo extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:ErrorDataInfo) + ErrorDataInfoOrBuilder { + 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= */ "", + ErrorDataInfo.class.getName()); + } + // Use ErrorDataInfo.newBuilder() to construct. + private ErrorDataInfo(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + private ErrorDataInfo() { + errorName_ = com.google.protobuf.ByteString.EMPTY; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.example.swingarmapp_sandblast.models.BspError.internal_static_ErrorDataInfo_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.example.swingarmapp_sandblast.models.BspError.internal_static_ErrorDataInfo_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.example.swingarmapp_sandblast.models.BspError.ErrorDataInfo.class, com.example.swingarmapp_sandblast.models.BspError.ErrorDataInfo.Builder.class); + } + + public static final int ERROR_VALUE_FIELD_NUMBER = 1; + private int errorValue_ = 0; + /** + * int32 Error_Value = 1; + * @return The errorValue. + */ + @java.lang.Override + public int getErrorValue() { + return errorValue_; + } + + public static final int ERROR_NAME_FIELD_NUMBER = 4; + private com.google.protobuf.ByteString errorName_ = com.google.protobuf.ByteString.EMPTY; + /** + * bytes Error_Name = 4; + * @return The errorName. + */ + @java.lang.Override + public com.google.protobuf.ByteString getErrorName() { + return errorName_; + } + + 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 (errorValue_ != 0) { + output.writeInt32(1, errorValue_); + } + if (!errorName_.isEmpty()) { + output.writeBytes(4, errorName_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (errorValue_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(1, errorValue_); + } + if (!errorName_.isEmpty()) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(4, errorName_); + } + 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.swingarmapp_sandblast.models.BspError.ErrorDataInfo)) { + return super.equals(obj); + } + com.example.swingarmapp_sandblast.models.BspError.ErrorDataInfo other = (com.example.swingarmapp_sandblast.models.BspError.ErrorDataInfo) obj; + + if (getErrorValue() + != other.getErrorValue()) return false; + if (!getErrorName() + .equals(other.getErrorName())) 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) + ERROR_VALUE_FIELD_NUMBER; + hash = (53 * hash) + getErrorValue(); + hash = (37 * hash) + ERROR_NAME_FIELD_NUMBER; + hash = (53 * hash) + getErrorName().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.example.swingarmapp_sandblast.models.BspError.ErrorDataInfo parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.example.swingarmapp_sandblast.models.BspError.ErrorDataInfo parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.example.swingarmapp_sandblast.models.BspError.ErrorDataInfo parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.example.swingarmapp_sandblast.models.BspError.ErrorDataInfo 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.swingarmapp_sandblast.models.BspError.ErrorDataInfo parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.example.swingarmapp_sandblast.models.BspError.ErrorDataInfo parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.example.swingarmapp_sandblast.models.BspError.ErrorDataInfo parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static com.example.swingarmapp_sandblast.models.BspError.ErrorDataInfo 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.swingarmapp_sandblast.models.BspError.ErrorDataInfo parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input); + } + + public static com.example.swingarmapp_sandblast.models.BspError.ErrorDataInfo 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.swingarmapp_sandblast.models.BspError.ErrorDataInfo parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static com.example.swingarmapp_sandblast.models.BspError.ErrorDataInfo 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.swingarmapp_sandblast.models.BspError.ErrorDataInfo 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 ErrorDataInfo} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder implements + // @@protoc_insertion_point(builder_implements:ErrorDataInfo) + com.example.swingarmapp_sandblast.models.BspError.ErrorDataInfoOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.example.swingarmapp_sandblast.models.BspError.internal_static_ErrorDataInfo_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.example.swingarmapp_sandblast.models.BspError.internal_static_ErrorDataInfo_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.example.swingarmapp_sandblast.models.BspError.ErrorDataInfo.class, com.example.swingarmapp_sandblast.models.BspError.ErrorDataInfo.Builder.class); + } + + // Construct using com.example.swingarmapp_sandblast.models.BspError.ErrorDataInfo.newBuilder() + private Builder() { + + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + errorValue_ = 0; + errorName_ = com.google.protobuf.ByteString.EMPTY; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.example.swingarmapp_sandblast.models.BspError.internal_static_ErrorDataInfo_descriptor; + } + + @java.lang.Override + public com.example.swingarmapp_sandblast.models.BspError.ErrorDataInfo getDefaultInstanceForType() { + return com.example.swingarmapp_sandblast.models.BspError.ErrorDataInfo.getDefaultInstance(); + } + + @java.lang.Override + public com.example.swingarmapp_sandblast.models.BspError.ErrorDataInfo build() { + com.example.swingarmapp_sandblast.models.BspError.ErrorDataInfo result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.example.swingarmapp_sandblast.models.BspError.ErrorDataInfo buildPartial() { + com.example.swingarmapp_sandblast.models.BspError.ErrorDataInfo result = new com.example.swingarmapp_sandblast.models.BspError.ErrorDataInfo(this); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartial0(com.example.swingarmapp_sandblast.models.BspError.ErrorDataInfo result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.errorValue_ = errorValue_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.errorName_ = errorName_; + } + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.example.swingarmapp_sandblast.models.BspError.ErrorDataInfo) { + return mergeFrom((com.example.swingarmapp_sandblast.models.BspError.ErrorDataInfo)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.example.swingarmapp_sandblast.models.BspError.ErrorDataInfo other) { + if (other == com.example.swingarmapp_sandblast.models.BspError.ErrorDataInfo.getDefaultInstance()) return this; + if (other.getErrorValue() != 0) { + setErrorValue(other.getErrorValue()); + } + if (other.getErrorName() != com.google.protobuf.ByteString.EMPTY) { + setErrorName(other.getErrorName()); + } + 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: { + errorValue_ = input.readInt32(); + bitField0_ |= 0x00000001; + break; + } // case 8 + case 34: { + errorName_ = input.readBytes(); + bitField0_ |= 0x00000002; + break; + } // case 34 + 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 errorValue_ ; + /** + * int32 Error_Value = 1; + * @return The errorValue. + */ + @java.lang.Override + public int getErrorValue() { + return errorValue_; + } + /** + * int32 Error_Value = 1; + * @param value The errorValue to set. + * @return This builder for chaining. + */ + public Builder setErrorValue(int value) { + + errorValue_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * int32 Error_Value = 1; + * @return This builder for chaining. + */ + public Builder clearErrorValue() { + bitField0_ = (bitField0_ & ~0x00000001); + errorValue_ = 0; + onChanged(); + return this; + } + + private com.google.protobuf.ByteString errorName_ = com.google.protobuf.ByteString.EMPTY; + /** + * bytes Error_Name = 4; + * @return The errorName. + */ + @java.lang.Override + public com.google.protobuf.ByteString getErrorName() { + return errorName_; + } + /** + * bytes Error_Name = 4; + * @param value The errorName to set. + * @return This builder for chaining. + */ + public Builder setErrorName(com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + errorName_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * bytes Error_Name = 4; + * @return This builder for chaining. + */ + public Builder clearErrorName() { + bitField0_ = (bitField0_ & ~0x00000002); + errorName_ = getDefaultInstance().getErrorName(); + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:ErrorDataInfo) + } + + // @@protoc_insertion_point(class_scope:ErrorDataInfo) + private static final com.example.swingarmapp_sandblast.models.BspError.ErrorDataInfo DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.example.swingarmapp_sandblast.models.BspError.ErrorDataInfo(); + } + + public static com.example.swingarmapp_sandblast.models.BspError.ErrorDataInfo getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ErrorDataInfo 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.swingarmapp_sandblast.models.BspError.ErrorDataInfo getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + + } + + public interface ErrorDataOrBuilder extends + // @@protoc_insertion_point(interface_extends:ErrorData) + com.google.protobuf.MessageOrBuilder { + + /** + * int32 ErrorCode = 1; + * @return The errorCode. + */ + int getErrorCode(); + + /** + * int32 Motor_1_Error = 21; + * @return The motor1Error. + */ + int getMotor1Error(); + + /** + * int32 Motor_2_Error = 22; + * @return The motor2Error. + */ + int getMotor2Error(); + + /** + * int32 Motor_3_Error = 23; + * @return The motor3Error. + */ + int getMotor3Error(); + + /** + * int32 Motor_4_Error = 24; + * @return The motor4Error. + */ + int getMotor4Error(); + + /** + * int32 Motor_5_Error = 25; + * @return The motor5Error. + */ + int getMotor5Error(); + + /** + * int32 Motor_6_Error = 26; + * @return The motor6Error. + */ + int getMotor6Error(); + + /** + * int32 Motor_7_Error = 27; + * @return The motor7Error. + */ + int getMotor7Error(); + } + /** + * 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.swingarmapp_sandblast.models.BspError.internal_static_ErrorData_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.example.swingarmapp_sandblast.models.BspError.internal_static_ErrorData_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.example.swingarmapp_sandblast.models.BspError.ErrorData.class, com.example.swingarmapp_sandblast.models.BspError.ErrorData.Builder.class); + } + + public static final int ERRORCODE_FIELD_NUMBER = 1; + private int errorCode_ = 0; + /** + * int32 ErrorCode = 1; + * @return The errorCode. + */ + @java.lang.Override + public int getErrorCode() { + return errorCode_; + } + + public static final int MOTOR_1_ERROR_FIELD_NUMBER = 21; + private int motor1Error_ = 0; + /** + * int32 Motor_1_Error = 21; + * @return The motor1Error. + */ + @java.lang.Override + public int getMotor1Error() { + return motor1Error_; + } + + public static final int MOTOR_2_ERROR_FIELD_NUMBER = 22; + private int motor2Error_ = 0; + /** + * int32 Motor_2_Error = 22; + * @return The motor2Error. + */ + @java.lang.Override + public int getMotor2Error() { + return motor2Error_; + } + + public static final int MOTOR_3_ERROR_FIELD_NUMBER = 23; + private int motor3Error_ = 0; + /** + * int32 Motor_3_Error = 23; + * @return The motor3Error. + */ + @java.lang.Override + public int getMotor3Error() { + return motor3Error_; + } + + public static final int MOTOR_4_ERROR_FIELD_NUMBER = 24; + private int motor4Error_ = 0; + /** + * int32 Motor_4_Error = 24; + * @return The motor4Error. + */ + @java.lang.Override + public int getMotor4Error() { + return motor4Error_; + } + + public static final int MOTOR_5_ERROR_FIELD_NUMBER = 25; + private int motor5Error_ = 0; + /** + * int32 Motor_5_Error = 25; + * @return The motor5Error. + */ + @java.lang.Override + public int getMotor5Error() { + return motor5Error_; + } + + public static final int MOTOR_6_ERROR_FIELD_NUMBER = 26; + private int motor6Error_ = 0; + /** + * int32 Motor_6_Error = 26; + * @return The motor6Error. + */ + @java.lang.Override + public int getMotor6Error() { + return motor6Error_; + } + + public static final int MOTOR_7_ERROR_FIELD_NUMBER = 27; + private int motor7Error_ = 0; + /** + * int32 Motor_7_Error = 27; + * @return The motor7Error. + */ + @java.lang.Override + public int getMotor7Error() { + return motor7Error_; + } + + 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 (errorCode_ != 0) { + output.writeInt32(1, errorCode_); + } + if (motor1Error_ != 0) { + output.writeInt32(21, motor1Error_); + } + if (motor2Error_ != 0) { + output.writeInt32(22, motor2Error_); + } + if (motor3Error_ != 0) { + output.writeInt32(23, motor3Error_); + } + if (motor4Error_ != 0) { + output.writeInt32(24, motor4Error_); + } + if (motor5Error_ != 0) { + output.writeInt32(25, motor5Error_); + } + if (motor6Error_ != 0) { + output.writeInt32(26, motor6Error_); + } + if (motor7Error_ != 0) { + output.writeInt32(27, motor7Error_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (errorCode_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(1, errorCode_); + } + if (motor1Error_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(21, motor1Error_); + } + if (motor2Error_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(22, motor2Error_); + } + if (motor3Error_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(23, motor3Error_); + } + if (motor4Error_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(24, motor4Error_); + } + if (motor5Error_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(25, motor5Error_); + } + if (motor6Error_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(26, motor6Error_); + } + if (motor7Error_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(27, motor7Error_); + } + 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.swingarmapp_sandblast.models.BspError.ErrorData)) { + return super.equals(obj); + } + com.example.swingarmapp_sandblast.models.BspError.ErrorData other = (com.example.swingarmapp_sandblast.models.BspError.ErrorData) obj; + + if (getErrorCode() + != other.getErrorCode()) return false; + if (getMotor1Error() + != other.getMotor1Error()) return false; + if (getMotor2Error() + != other.getMotor2Error()) return false; + if (getMotor3Error() + != other.getMotor3Error()) return false; + if (getMotor4Error() + != other.getMotor4Error()) return false; + if (getMotor5Error() + != other.getMotor5Error()) return false; + if (getMotor6Error() + != other.getMotor6Error()) return false; + if (getMotor7Error() + != other.getMotor7Error()) 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) + ERRORCODE_FIELD_NUMBER; + hash = (53 * hash) + getErrorCode(); + hash = (37 * hash) + MOTOR_1_ERROR_FIELD_NUMBER; + hash = (53 * hash) + getMotor1Error(); + hash = (37 * hash) + MOTOR_2_ERROR_FIELD_NUMBER; + hash = (53 * hash) + getMotor2Error(); + hash = (37 * hash) + MOTOR_3_ERROR_FIELD_NUMBER; + hash = (53 * hash) + getMotor3Error(); + hash = (37 * hash) + MOTOR_4_ERROR_FIELD_NUMBER; + hash = (53 * hash) + getMotor4Error(); + hash = (37 * hash) + MOTOR_5_ERROR_FIELD_NUMBER; + hash = (53 * hash) + getMotor5Error(); + hash = (37 * hash) + MOTOR_6_ERROR_FIELD_NUMBER; + hash = (53 * hash) + getMotor6Error(); + hash = (37 * hash) + MOTOR_7_ERROR_FIELD_NUMBER; + hash = (53 * hash) + getMotor7Error(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.example.swingarmapp_sandblast.models.BspError.ErrorData parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.example.swingarmapp_sandblast.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.swingarmapp_sandblast.models.BspError.ErrorData parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.example.swingarmapp_sandblast.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.swingarmapp_sandblast.models.BspError.ErrorData parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.example.swingarmapp_sandblast.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.swingarmapp_sandblast.models.BspError.ErrorData parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static com.example.swingarmapp_sandblast.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.swingarmapp_sandblast.models.BspError.ErrorData parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input); + } + + public static com.example.swingarmapp_sandblast.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.swingarmapp_sandblast.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.swingarmapp_sandblast.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.swingarmapp_sandblast.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.swingarmapp_sandblast.models.BspError.ErrorDataOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.example.swingarmapp_sandblast.models.BspError.internal_static_ErrorData_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.example.swingarmapp_sandblast.models.BspError.internal_static_ErrorData_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.example.swingarmapp_sandblast.models.BspError.ErrorData.class, com.example.swingarmapp_sandblast.models.BspError.ErrorData.Builder.class); + } + + // Construct using com.example.swingarmapp_sandblast.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; + errorCode_ = 0; + motor1Error_ = 0; + motor2Error_ = 0; + motor3Error_ = 0; + motor4Error_ = 0; + motor5Error_ = 0; + motor6Error_ = 0; + motor7Error_ = 0; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.example.swingarmapp_sandblast.models.BspError.internal_static_ErrorData_descriptor; + } + + @java.lang.Override + public com.example.swingarmapp_sandblast.models.BspError.ErrorData getDefaultInstanceForType() { + return com.example.swingarmapp_sandblast.models.BspError.ErrorData.getDefaultInstance(); + } + + @java.lang.Override + public com.example.swingarmapp_sandblast.models.BspError.ErrorData build() { + com.example.swingarmapp_sandblast.models.BspError.ErrorData result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.example.swingarmapp_sandblast.models.BspError.ErrorData buildPartial() { + com.example.swingarmapp_sandblast.models.BspError.ErrorData result = new com.example.swingarmapp_sandblast.models.BspError.ErrorData(this); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartial0(com.example.swingarmapp_sandblast.models.BspError.ErrorData result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.errorCode_ = errorCode_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.motor1Error_ = motor1Error_; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.motor2Error_ = motor2Error_; + } + if (((from_bitField0_ & 0x00000008) != 0)) { + result.motor3Error_ = motor3Error_; + } + if (((from_bitField0_ & 0x00000010) != 0)) { + result.motor4Error_ = motor4Error_; + } + if (((from_bitField0_ & 0x00000020) != 0)) { + result.motor5Error_ = motor5Error_; + } + if (((from_bitField0_ & 0x00000040) != 0)) { + result.motor6Error_ = motor6Error_; + } + if (((from_bitField0_ & 0x00000080) != 0)) { + result.motor7Error_ = motor7Error_; + } + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.example.swingarmapp_sandblast.models.BspError.ErrorData) { + return mergeFrom((com.example.swingarmapp_sandblast.models.BspError.ErrorData)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.example.swingarmapp_sandblast.models.BspError.ErrorData other) { + if (other == com.example.swingarmapp_sandblast.models.BspError.ErrorData.getDefaultInstance()) return this; + if (other.getErrorCode() != 0) { + setErrorCode(other.getErrorCode()); + } + if (other.getMotor1Error() != 0) { + setMotor1Error(other.getMotor1Error()); + } + if (other.getMotor2Error() != 0) { + setMotor2Error(other.getMotor2Error()); + } + if (other.getMotor3Error() != 0) { + setMotor3Error(other.getMotor3Error()); + } + if (other.getMotor4Error() != 0) { + setMotor4Error(other.getMotor4Error()); + } + if (other.getMotor5Error() != 0) { + setMotor5Error(other.getMotor5Error()); + } + if (other.getMotor6Error() != 0) { + setMotor6Error(other.getMotor6Error()); + } + if (other.getMotor7Error() != 0) { + setMotor7Error(other.getMotor7Error()); + } + 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: { + errorCode_ = input.readInt32(); + bitField0_ |= 0x00000001; + break; + } // case 8 + case 168: { + motor1Error_ = input.readInt32(); + bitField0_ |= 0x00000002; + break; + } // case 168 + case 176: { + motor2Error_ = input.readInt32(); + bitField0_ |= 0x00000004; + break; + } // case 176 + case 184: { + motor3Error_ = input.readInt32(); + bitField0_ |= 0x00000008; + break; + } // case 184 + case 192: { + motor4Error_ = input.readInt32(); + bitField0_ |= 0x00000010; + break; + } // case 192 + case 200: { + motor5Error_ = input.readInt32(); + bitField0_ |= 0x00000020; + break; + } // case 200 + case 208: { + motor6Error_ = input.readInt32(); + bitField0_ |= 0x00000040; + break; + } // case 208 + case 216: { + motor7Error_ = input.readInt32(); + bitField0_ |= 0x00000080; + break; + } // case 216 + 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 errorCode_ ; + /** + * int32 ErrorCode = 1; + * @return The errorCode. + */ + @java.lang.Override + public int getErrorCode() { + return errorCode_; + } + /** + * int32 ErrorCode = 1; + * @param value The errorCode to set. + * @return This builder for chaining. + */ + public Builder setErrorCode(int value) { + + errorCode_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * int32 ErrorCode = 1; + * @return This builder for chaining. + */ + public Builder clearErrorCode() { + bitField0_ = (bitField0_ & ~0x00000001); + errorCode_ = 0; + onChanged(); + return this; + } + + private int motor1Error_ ; + /** + * int32 Motor_1_Error = 21; + * @return The motor1Error. + */ + @java.lang.Override + public int getMotor1Error() { + return motor1Error_; + } + /** + * int32 Motor_1_Error = 21; + * @param value The motor1Error to set. + * @return This builder for chaining. + */ + public Builder setMotor1Error(int value) { + + motor1Error_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * int32 Motor_1_Error = 21; + * @return This builder for chaining. + */ + public Builder clearMotor1Error() { + bitField0_ = (bitField0_ & ~0x00000002); + motor1Error_ = 0; + onChanged(); + return this; + } + + private int motor2Error_ ; + /** + * int32 Motor_2_Error = 22; + * @return The motor2Error. + */ + @java.lang.Override + public int getMotor2Error() { + return motor2Error_; + } + /** + * int32 Motor_2_Error = 22; + * @param value The motor2Error to set. + * @return This builder for chaining. + */ + public Builder setMotor2Error(int value) { + + motor2Error_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * int32 Motor_2_Error = 22; + * @return This builder for chaining. + */ + public Builder clearMotor2Error() { + bitField0_ = (bitField0_ & ~0x00000004); + motor2Error_ = 0; + onChanged(); + return this; + } + + private int motor3Error_ ; + /** + * int32 Motor_3_Error = 23; + * @return The motor3Error. + */ + @java.lang.Override + public int getMotor3Error() { + return motor3Error_; + } + /** + * int32 Motor_3_Error = 23; + * @param value The motor3Error to set. + * @return This builder for chaining. + */ + public Builder setMotor3Error(int value) { + + motor3Error_ = value; + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + /** + * int32 Motor_3_Error = 23; + * @return This builder for chaining. + */ + public Builder clearMotor3Error() { + bitField0_ = (bitField0_ & ~0x00000008); + motor3Error_ = 0; + onChanged(); + return this; + } + + private int motor4Error_ ; + /** + * int32 Motor_4_Error = 24; + * @return The motor4Error. + */ + @java.lang.Override + public int getMotor4Error() { + return motor4Error_; + } + /** + * int32 Motor_4_Error = 24; + * @param value The motor4Error to set. + * @return This builder for chaining. + */ + public Builder setMotor4Error(int value) { + + motor4Error_ = value; + bitField0_ |= 0x00000010; + onChanged(); + return this; + } + /** + * int32 Motor_4_Error = 24; + * @return This builder for chaining. + */ + public Builder clearMotor4Error() { + bitField0_ = (bitField0_ & ~0x00000010); + motor4Error_ = 0; + onChanged(); + return this; + } + + private int motor5Error_ ; + /** + * int32 Motor_5_Error = 25; + * @return The motor5Error. + */ + @java.lang.Override + public int getMotor5Error() { + return motor5Error_; + } + /** + * int32 Motor_5_Error = 25; + * @param value The motor5Error to set. + * @return This builder for chaining. + */ + public Builder setMotor5Error(int value) { + + motor5Error_ = value; + bitField0_ |= 0x00000020; + onChanged(); + return this; + } + /** + * int32 Motor_5_Error = 25; + * @return This builder for chaining. + */ + public Builder clearMotor5Error() { + bitField0_ = (bitField0_ & ~0x00000020); + motor5Error_ = 0; + onChanged(); + return this; + } + + private int motor6Error_ ; + /** + * int32 Motor_6_Error = 26; + * @return The motor6Error. + */ + @java.lang.Override + public int getMotor6Error() { + return motor6Error_; + } + /** + * int32 Motor_6_Error = 26; + * @param value The motor6Error to set. + * @return This builder for chaining. + */ + public Builder setMotor6Error(int value) { + + motor6Error_ = value; + bitField0_ |= 0x00000040; + onChanged(); + return this; + } + /** + * int32 Motor_6_Error = 26; + * @return This builder for chaining. + */ + public Builder clearMotor6Error() { + bitField0_ = (bitField0_ & ~0x00000040); + motor6Error_ = 0; + onChanged(); + return this; + } + + private int motor7Error_ ; + /** + * int32 Motor_7_Error = 27; + * @return The motor7Error. + */ + @java.lang.Override + public int getMotor7Error() { + return motor7Error_; + } + /** + * int32 Motor_7_Error = 27; + * @param value The motor7Error to set. + * @return This builder for chaining. + */ + public Builder setMotor7Error(int value) { + + motor7Error_ = value; + bitField0_ |= 0x00000080; + onChanged(); + return this; + } + /** + * int32 Motor_7_Error = 27; + * @return This builder for chaining. + */ + public Builder clearMotor7Error() { + bitField0_ = (bitField0_ & ~0x00000080); + motor7Error_ = 0; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:ErrorData) + } + + // @@protoc_insertion_point(class_scope:ErrorData) + private static final com.example.swingarmapp_sandblast.models.BspError.ErrorData DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.example.swingarmapp_sandblast.models.BspError.ErrorData(); + } + + public static com.example.swingarmapp_sandblast.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.swingarmapp_sandblast.models.BspError.ErrorData getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + + } + + private static final com.google.protobuf.Descriptors.Descriptor + internal_static_ErrorDataInfo_descriptor; + private static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_ErrorDataInfo_fieldAccessorTable; + 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\"8\n\rErrorDataInfo\022\023\n\013Er" + + "ror_Value\030\001 \001(\005\022\022\n\nError_Name\030\004 \001(\014\"\277\001\n\t" + + "ErrorData\022\021\n\tErrorCode\030\001 \001(\005\022\025\n\rMotor_1_" + + "Error\030\025 \001(\005\022\025\n\rMotor_2_Error\030\026 \001(\005\022\025\n\rMo" + + "tor_3_Error\030\027 \001(\005\022\025\n\rMotor_4_Error\030\030 \001(\005" + + "\022\025\n\rMotor_5_Error\030\031 \001(\005\022\025\n\rMotor_6_Error" + + "\030\032 \001(\005\022\025\n\rMotor_7_Error\030\033 \001(\005*\322\001\n\010ComErr" + + "or\022\r\n\tMk32_SBus\020\000\022\017\n\013MK32_Serial\020\001\022\025\n\021MK" + + "32_InitialState\020\002\022\n\n\006TL720D\020\003\022\030\n\024ZQ_CAN_" + + "ID1_LeftMotor\020\004\022\031\n\025ZQ_CAN_ID2_RightMotor" + + "\020\005\022\031\n\025ZQ_CAN_ID3_SwingMotor\020\006\022\020\n\014Force_S" + + "ensor\020\007\022\n\n\006Mfog40\020\010\022\025\n\021Ultrasonic_Sensor" + + "\020\tB,\n(com.example.swingarmapp_sandblast." + + "modelsP\000b\006proto3" + }; + descriptor = com.google.protobuf.Descriptors.FileDescriptor + .internalBuildGeneratedFileFrom(descriptorData, + new com.google.protobuf.Descriptors.FileDescriptor[] { + }); + internal_static_ErrorDataInfo_descriptor = + getDescriptor().getMessageTypes().get(0); + internal_static_ErrorDataInfo_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_ErrorDataInfo_descriptor, + new java.lang.String[] { "ErrorValue", "ErrorName", }); + internal_static_ErrorData_descriptor = + getDescriptor().getMessageTypes().get(1); + internal_static_ErrorData_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_ErrorData_descriptor, + new java.lang.String[] { "ErrorCode", "Motor1Error", "Motor2Error", "Motor3Error", "Motor4Error", "Motor5Error", "Motor6Error", "Motor7Error", }); + descriptor.resolveAllFeaturesImmutable(); + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/swingarmapp_sandblast/app/src/main/java/com/example/swingarmapp_sandblast/models/BspIV.java b/swingarmapp_sandblast/app/src/main/java/com/example/swingarmapp_sandblast/models/BspIV.java new file mode 100644 index 0000000..3bea129 --- /dev/null +++ b/swingarmapp_sandblast/app/src/main/java/com/example/swingarmapp_sandblast/models/BspIV.java @@ -0,0 +1,1625 @@ +// 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.swingarmapp_sandblast.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 { + + /** + *
+     * 发送100显示1°
+     * 
+ * + * int32 LeftCompensation = 1; + * @return The leftCompensation. + */ + int getLeftCompensation(); + + /** + *
+     * 发送100显示1°
+     * 
+ * + * int32 RightCompensation = 2; + * @return The rightCompensation. + */ + int getRightCompensation(); + + /** + *
+     * 发送100显示10m/min
+     * 
+ * + * int32 Robot_Move_Deri_Speed = 3; + * @return The robotMoveDeriSpeed. + */ + int getRobotMoveDeriSpeed(); + + /** + *
+     * 发送100显示1°
+     * 
+ * + * int32 Robot_Gyro = 4; + * @return The robotGyro. + */ + int getRobotGyro(); + + /** + *
+     * 发送100显示10cm
+     * 
+ * + * int32 Distance_Sensor = 5; + * @return The distanceSensor. + */ + int getDistanceSensor(); + + /** + *
+     * 硬件通讯错误及按键未初始化错误
+     * 
+ * + * int32 SystemError = 6; + * @return The systemError. + */ + int getSystemError(); + + /** + *
+     * 左轮电机报警
+     * 
+ * + * int32 Left_Motor_Err = 7; + * @return The leftMotorErr. + */ + int getLeftMotorErr(); + + /** + *
+     * 右轮电机报警
+     * 
+ * + * int32 Right_Motor_Err = 8; + * @return The rightMotorErr. + */ + int getRightMotorErr(); + + /** + *
+     * 摆臂电机报警
+     * 
+ * + * int32 Swing_Motor_Err = 9; + * @return The swingMotorErr. + */ + int getSwingMotorErr(); + + /** + *
+     * 是否在线
+     * 
+ * + * int32 Is_Online = 10; + * @return The isOnline. + */ + int getIsOnline(); + + /** + *
+     * 备用数据1
+     * 
+ * + * int32 Spara_Data_1 = 11; + * @return The sparaData1. + */ + int getSparaData1(); + + /** + *
+     * 备用数据2
+     * 
+ * + * int32 Spara_Data_2 = 12; + * @return The sparaData2. + */ + int getSparaData2(); + + /** + *
+     * 备用数据3
+     * 
+ * + * int32 Spara_Data_3 = 13; + * @return The sparaData3. + */ + int getSparaData3(); + } + /** + * 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.swingarmapp_sandblast.models.BspIV.internal_static_IV_struct_define_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.example.swingarmapp_sandblast.models.BspIV.internal_static_IV_struct_define_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.example.swingarmapp_sandblast.models.BspIV.IV_struct_define.class, com.example.swingarmapp_sandblast.models.BspIV.IV_struct_define.Builder.class); + } + + public static final int LEFTCOMPENSATION_FIELD_NUMBER = 1; + private int leftCompensation_ = 0; + /** + *
+     * 发送100显示1°
+     * 
+ * + * int32 LeftCompensation = 1; + * @return The leftCompensation. + */ + @java.lang.Override + public int getLeftCompensation() { + return leftCompensation_; + } + + public static final int RIGHTCOMPENSATION_FIELD_NUMBER = 2; + private int rightCompensation_ = 0; + /** + *
+     * 发送100显示1°
+     * 
+ * + * int32 RightCompensation = 2; + * @return The rightCompensation. + */ + @java.lang.Override + public int getRightCompensation() { + return rightCompensation_; + } + + public static final int ROBOT_MOVE_DERI_SPEED_FIELD_NUMBER = 3; + private int robotMoveDeriSpeed_ = 0; + /** + *
+     * 发送100显示10m/min
+     * 
+ * + * int32 Robot_Move_Deri_Speed = 3; + * @return The robotMoveDeriSpeed. + */ + @java.lang.Override + public int getRobotMoveDeriSpeed() { + return robotMoveDeriSpeed_; + } + + public static final int ROBOT_GYRO_FIELD_NUMBER = 4; + private int robotGyro_ = 0; + /** + *
+     * 发送100显示1°
+     * 
+ * + * int32 Robot_Gyro = 4; + * @return The robotGyro. + */ + @java.lang.Override + public int getRobotGyro() { + return robotGyro_; + } + + public static final int DISTANCE_SENSOR_FIELD_NUMBER = 5; + private int distanceSensor_ = 0; + /** + *
+     * 发送100显示10cm
+     * 
+ * + * int32 Distance_Sensor = 5; + * @return The distanceSensor. + */ + @java.lang.Override + public int getDistanceSensor() { + return distanceSensor_; + } + + public static final int SYSTEMERROR_FIELD_NUMBER = 6; + private int systemError_ = 0; + /** + *
+     * 硬件通讯错误及按键未初始化错误
+     * 
+ * + * int32 SystemError = 6; + * @return The systemError. + */ + @java.lang.Override + public int getSystemError() { + return systemError_; + } + + public static final int LEFT_MOTOR_ERR_FIELD_NUMBER = 7; + private int leftMotorErr_ = 0; + /** + *
+     * 左轮电机报警
+     * 
+ * + * int32 Left_Motor_Err = 7; + * @return The leftMotorErr. + */ + @java.lang.Override + public int getLeftMotorErr() { + return leftMotorErr_; + } + + public static final int RIGHT_MOTOR_ERR_FIELD_NUMBER = 8; + private int rightMotorErr_ = 0; + /** + *
+     * 右轮电机报警
+     * 
+ * + * int32 Right_Motor_Err = 8; + * @return The rightMotorErr. + */ + @java.lang.Override + public int getRightMotorErr() { + return rightMotorErr_; + } + + public static final int SWING_MOTOR_ERR_FIELD_NUMBER = 9; + private int swingMotorErr_ = 0; + /** + *
+     * 摆臂电机报警
+     * 
+ * + * int32 Swing_Motor_Err = 9; + * @return The swingMotorErr. + */ + @java.lang.Override + public int getSwingMotorErr() { + return swingMotorErr_; + } + + public static final int IS_ONLINE_FIELD_NUMBER = 10; + private int isOnline_ = 0; + /** + *
+     * 是否在线
+     * 
+ * + * int32 Is_Online = 10; + * @return The isOnline. + */ + @java.lang.Override + public int getIsOnline() { + return isOnline_; + } + + public static final int SPARA_DATA_1_FIELD_NUMBER = 11; + private int sparaData1_ = 0; + /** + *
+     * 备用数据1
+     * 
+ * + * int32 Spara_Data_1 = 11; + * @return The sparaData1. + */ + @java.lang.Override + public int getSparaData1() { + return sparaData1_; + } + + public static final int SPARA_DATA_2_FIELD_NUMBER = 12; + private int sparaData2_ = 0; + /** + *
+     * 备用数据2
+     * 
+ * + * int32 Spara_Data_2 = 12; + * @return The sparaData2. + */ + @java.lang.Override + public int getSparaData2() { + return sparaData2_; + } + + public static final int SPARA_DATA_3_FIELD_NUMBER = 13; + private int sparaData3_ = 0; + /** + *
+     * 备用数据3
+     * 
+ * + * int32 Spara_Data_3 = 13; + * @return The sparaData3. + */ + @java.lang.Override + public int getSparaData3() { + return sparaData3_; + } + + 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 (leftCompensation_ != 0) { + output.writeInt32(1, leftCompensation_); + } + if (rightCompensation_ != 0) { + output.writeInt32(2, rightCompensation_); + } + if (robotMoveDeriSpeed_ != 0) { + output.writeInt32(3, robotMoveDeriSpeed_); + } + if (robotGyro_ != 0) { + output.writeInt32(4, robotGyro_); + } + if (distanceSensor_ != 0) { + output.writeInt32(5, distanceSensor_); + } + if (systemError_ != 0) { + output.writeInt32(6, systemError_); + } + if (leftMotorErr_ != 0) { + output.writeInt32(7, leftMotorErr_); + } + if (rightMotorErr_ != 0) { + output.writeInt32(8, rightMotorErr_); + } + if (swingMotorErr_ != 0) { + output.writeInt32(9, swingMotorErr_); + } + if (isOnline_ != 0) { + output.writeInt32(10, isOnline_); + } + if (sparaData1_ != 0) { + output.writeInt32(11, sparaData1_); + } + if (sparaData2_ != 0) { + output.writeInt32(12, sparaData2_); + } + if (sparaData3_ != 0) { + output.writeInt32(13, sparaData3_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (leftCompensation_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(1, leftCompensation_); + } + if (rightCompensation_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(2, rightCompensation_); + } + if (robotMoveDeriSpeed_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(3, robotMoveDeriSpeed_); + } + if (robotGyro_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(4, robotGyro_); + } + if (distanceSensor_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(5, distanceSensor_); + } + if (systemError_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(6, systemError_); + } + if (leftMotorErr_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(7, leftMotorErr_); + } + if (rightMotorErr_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(8, rightMotorErr_); + } + if (swingMotorErr_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(9, swingMotorErr_); + } + if (isOnline_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(10, isOnline_); + } + if (sparaData1_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(11, sparaData1_); + } + if (sparaData2_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(12, sparaData2_); + } + if (sparaData3_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(13, sparaData3_); + } + 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.swingarmapp_sandblast.models.BspIV.IV_struct_define)) { + return super.equals(obj); + } + com.example.swingarmapp_sandblast.models.BspIV.IV_struct_define other = (com.example.swingarmapp_sandblast.models.BspIV.IV_struct_define) obj; + + if (getLeftCompensation() + != other.getLeftCompensation()) return false; + if (getRightCompensation() + != other.getRightCompensation()) return false; + if (getRobotMoveDeriSpeed() + != other.getRobotMoveDeriSpeed()) return false; + if (getRobotGyro() + != other.getRobotGyro()) return false; + if (getDistanceSensor() + != other.getDistanceSensor()) return false; + if (getSystemError() + != other.getSystemError()) return false; + if (getLeftMotorErr() + != other.getLeftMotorErr()) return false; + if (getRightMotorErr() + != other.getRightMotorErr()) return false; + if (getSwingMotorErr() + != other.getSwingMotorErr()) return false; + if (getIsOnline() + != other.getIsOnline()) return false; + if (getSparaData1() + != other.getSparaData1()) return false; + if (getSparaData2() + != other.getSparaData2()) return false; + if (getSparaData3() + != other.getSparaData3()) 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) + LEFTCOMPENSATION_FIELD_NUMBER; + hash = (53 * hash) + getLeftCompensation(); + hash = (37 * hash) + RIGHTCOMPENSATION_FIELD_NUMBER; + hash = (53 * hash) + getRightCompensation(); + hash = (37 * hash) + ROBOT_MOVE_DERI_SPEED_FIELD_NUMBER; + hash = (53 * hash) + getRobotMoveDeriSpeed(); + hash = (37 * hash) + ROBOT_GYRO_FIELD_NUMBER; + hash = (53 * hash) + getRobotGyro(); + hash = (37 * hash) + DISTANCE_SENSOR_FIELD_NUMBER; + hash = (53 * hash) + getDistanceSensor(); + hash = (37 * hash) + SYSTEMERROR_FIELD_NUMBER; + hash = (53 * hash) + getSystemError(); + hash = (37 * hash) + LEFT_MOTOR_ERR_FIELD_NUMBER; + hash = (53 * hash) + getLeftMotorErr(); + hash = (37 * hash) + RIGHT_MOTOR_ERR_FIELD_NUMBER; + hash = (53 * hash) + getRightMotorErr(); + hash = (37 * hash) + SWING_MOTOR_ERR_FIELD_NUMBER; + hash = (53 * hash) + getSwingMotorErr(); + hash = (37 * hash) + IS_ONLINE_FIELD_NUMBER; + hash = (53 * hash) + getIsOnline(); + hash = (37 * hash) + SPARA_DATA_1_FIELD_NUMBER; + hash = (53 * hash) + getSparaData1(); + hash = (37 * hash) + SPARA_DATA_2_FIELD_NUMBER; + hash = (53 * hash) + getSparaData2(); + hash = (37 * hash) + SPARA_DATA_3_FIELD_NUMBER; + hash = (53 * hash) + getSparaData3(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.example.swingarmapp_sandblast.models.BspIV.IV_struct_define parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.example.swingarmapp_sandblast.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.swingarmapp_sandblast.models.BspIV.IV_struct_define parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.example.swingarmapp_sandblast.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.swingarmapp_sandblast.models.BspIV.IV_struct_define parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.example.swingarmapp_sandblast.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.swingarmapp_sandblast.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.swingarmapp_sandblast.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.swingarmapp_sandblast.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.swingarmapp_sandblast.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.swingarmapp_sandblast.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.swingarmapp_sandblast.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.swingarmapp_sandblast.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.swingarmapp_sandblast.models.BspIV.IV_struct_defineOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.example.swingarmapp_sandblast.models.BspIV.internal_static_IV_struct_define_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.example.swingarmapp_sandblast.models.BspIV.internal_static_IV_struct_define_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.example.swingarmapp_sandblast.models.BspIV.IV_struct_define.class, com.example.swingarmapp_sandblast.models.BspIV.IV_struct_define.Builder.class); + } + + // Construct using com.example.swingarmapp_sandblast.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; + leftCompensation_ = 0; + rightCompensation_ = 0; + robotMoveDeriSpeed_ = 0; + robotGyro_ = 0; + distanceSensor_ = 0; + systemError_ = 0; + leftMotorErr_ = 0; + rightMotorErr_ = 0; + swingMotorErr_ = 0; + isOnline_ = 0; + sparaData1_ = 0; + sparaData2_ = 0; + sparaData3_ = 0; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.example.swingarmapp_sandblast.models.BspIV.internal_static_IV_struct_define_descriptor; + } + + @java.lang.Override + public com.example.swingarmapp_sandblast.models.BspIV.IV_struct_define getDefaultInstanceForType() { + return com.example.swingarmapp_sandblast.models.BspIV.IV_struct_define.getDefaultInstance(); + } + + @java.lang.Override + public com.example.swingarmapp_sandblast.models.BspIV.IV_struct_define build() { + com.example.swingarmapp_sandblast.models.BspIV.IV_struct_define result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.example.swingarmapp_sandblast.models.BspIV.IV_struct_define buildPartial() { + com.example.swingarmapp_sandblast.models.BspIV.IV_struct_define result = new com.example.swingarmapp_sandblast.models.BspIV.IV_struct_define(this); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartial0(com.example.swingarmapp_sandblast.models.BspIV.IV_struct_define result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.leftCompensation_ = leftCompensation_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.rightCompensation_ = rightCompensation_; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.robotMoveDeriSpeed_ = robotMoveDeriSpeed_; + } + if (((from_bitField0_ & 0x00000008) != 0)) { + result.robotGyro_ = robotGyro_; + } + if (((from_bitField0_ & 0x00000010) != 0)) { + result.distanceSensor_ = distanceSensor_; + } + if (((from_bitField0_ & 0x00000020) != 0)) { + result.systemError_ = systemError_; + } + if (((from_bitField0_ & 0x00000040) != 0)) { + result.leftMotorErr_ = leftMotorErr_; + } + if (((from_bitField0_ & 0x00000080) != 0)) { + result.rightMotorErr_ = rightMotorErr_; + } + if (((from_bitField0_ & 0x00000100) != 0)) { + result.swingMotorErr_ = swingMotorErr_; + } + if (((from_bitField0_ & 0x00000200) != 0)) { + result.isOnline_ = isOnline_; + } + if (((from_bitField0_ & 0x00000400) != 0)) { + result.sparaData1_ = sparaData1_; + } + if (((from_bitField0_ & 0x00000800) != 0)) { + result.sparaData2_ = sparaData2_; + } + if (((from_bitField0_ & 0x00001000) != 0)) { + result.sparaData3_ = sparaData3_; + } + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.example.swingarmapp_sandblast.models.BspIV.IV_struct_define) { + return mergeFrom((com.example.swingarmapp_sandblast.models.BspIV.IV_struct_define)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.example.swingarmapp_sandblast.models.BspIV.IV_struct_define other) { + if (other == com.example.swingarmapp_sandblast.models.BspIV.IV_struct_define.getDefaultInstance()) return this; + if (other.getLeftCompensation() != 0) { + setLeftCompensation(other.getLeftCompensation()); + } + if (other.getRightCompensation() != 0) { + setRightCompensation(other.getRightCompensation()); + } + if (other.getRobotMoveDeriSpeed() != 0) { + setRobotMoveDeriSpeed(other.getRobotMoveDeriSpeed()); + } + if (other.getRobotGyro() != 0) { + setRobotGyro(other.getRobotGyro()); + } + if (other.getDistanceSensor() != 0) { + setDistanceSensor(other.getDistanceSensor()); + } + if (other.getSystemError() != 0) { + setSystemError(other.getSystemError()); + } + if (other.getLeftMotorErr() != 0) { + setLeftMotorErr(other.getLeftMotorErr()); + } + if (other.getRightMotorErr() != 0) { + setRightMotorErr(other.getRightMotorErr()); + } + if (other.getSwingMotorErr() != 0) { + setSwingMotorErr(other.getSwingMotorErr()); + } + if (other.getIsOnline() != 0) { + setIsOnline(other.getIsOnline()); + } + if (other.getSparaData1() != 0) { + setSparaData1(other.getSparaData1()); + } + if (other.getSparaData2() != 0) { + setSparaData2(other.getSparaData2()); + } + if (other.getSparaData3() != 0) { + setSparaData3(other.getSparaData3()); + } + 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: { + leftCompensation_ = input.readInt32(); + bitField0_ |= 0x00000001; + break; + } // case 8 + case 16: { + rightCompensation_ = input.readInt32(); + bitField0_ |= 0x00000002; + break; + } // case 16 + case 24: { + robotMoveDeriSpeed_ = input.readInt32(); + bitField0_ |= 0x00000004; + break; + } // case 24 + case 32: { + robotGyro_ = input.readInt32(); + bitField0_ |= 0x00000008; + break; + } // case 32 + case 40: { + distanceSensor_ = input.readInt32(); + bitField0_ |= 0x00000010; + break; + } // case 40 + case 48: { + systemError_ = input.readInt32(); + bitField0_ |= 0x00000020; + break; + } // case 48 + case 56: { + leftMotorErr_ = input.readInt32(); + bitField0_ |= 0x00000040; + break; + } // case 56 + case 64: { + rightMotorErr_ = input.readInt32(); + bitField0_ |= 0x00000080; + break; + } // case 64 + case 72: { + swingMotorErr_ = input.readInt32(); + bitField0_ |= 0x00000100; + break; + } // case 72 + case 80: { + isOnline_ = input.readInt32(); + bitField0_ |= 0x00000200; + break; + } // case 80 + case 88: { + sparaData1_ = input.readInt32(); + bitField0_ |= 0x00000400; + break; + } // case 88 + case 96: { + sparaData2_ = input.readInt32(); + bitField0_ |= 0x00000800; + break; + } // case 96 + case 104: { + sparaData3_ = 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 leftCompensation_ ; + /** + *
+       * 发送100显示1°
+       * 
+ * + * int32 LeftCompensation = 1; + * @return The leftCompensation. + */ + @java.lang.Override + public int getLeftCompensation() { + return leftCompensation_; + } + /** + *
+       * 发送100显示1°
+       * 
+ * + * int32 LeftCompensation = 1; + * @param value The leftCompensation to set. + * @return This builder for chaining. + */ + public Builder setLeftCompensation(int value) { + + leftCompensation_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + *
+       * 发送100显示1°
+       * 
+ * + * int32 LeftCompensation = 1; + * @return This builder for chaining. + */ + public Builder clearLeftCompensation() { + bitField0_ = (bitField0_ & ~0x00000001); + leftCompensation_ = 0; + onChanged(); + return this; + } + + private int rightCompensation_ ; + /** + *
+       * 发送100显示1°
+       * 
+ * + * int32 RightCompensation = 2; + * @return The rightCompensation. + */ + @java.lang.Override + public int getRightCompensation() { + return rightCompensation_; + } + /** + *
+       * 发送100显示1°
+       * 
+ * + * int32 RightCompensation = 2; + * @param value The rightCompensation to set. + * @return This builder for chaining. + */ + public Builder setRightCompensation(int value) { + + rightCompensation_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + *
+       * 发送100显示1°
+       * 
+ * + * int32 RightCompensation = 2; + * @return This builder for chaining. + */ + public Builder clearRightCompensation() { + bitField0_ = (bitField0_ & ~0x00000002); + rightCompensation_ = 0; + onChanged(); + return this; + } + + private int robotMoveDeriSpeed_ ; + /** + *
+       * 发送100显示10m/min
+       * 
+ * + * int32 Robot_Move_Deri_Speed = 3; + * @return The robotMoveDeriSpeed. + */ + @java.lang.Override + public int getRobotMoveDeriSpeed() { + return robotMoveDeriSpeed_; + } + /** + *
+       * 发送100显示10m/min
+       * 
+ * + * int32 Robot_Move_Deri_Speed = 3; + * @param value The robotMoveDeriSpeed to set. + * @return This builder for chaining. + */ + public Builder setRobotMoveDeriSpeed(int value) { + + robotMoveDeriSpeed_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + *
+       * 发送100显示10m/min
+       * 
+ * + * int32 Robot_Move_Deri_Speed = 3; + * @return This builder for chaining. + */ + public Builder clearRobotMoveDeriSpeed() { + bitField0_ = (bitField0_ & ~0x00000004); + robotMoveDeriSpeed_ = 0; + onChanged(); + return this; + } + + private int robotGyro_ ; + /** + *
+       * 发送100显示1°
+       * 
+ * + * int32 Robot_Gyro = 4; + * @return The robotGyro. + */ + @java.lang.Override + public int getRobotGyro() { + return robotGyro_; + } + /** + *
+       * 发送100显示1°
+       * 
+ * + * int32 Robot_Gyro = 4; + * @param value The robotGyro to set. + * @return This builder for chaining. + */ + public Builder setRobotGyro(int value) { + + robotGyro_ = value; + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + /** + *
+       * 发送100显示1°
+       * 
+ * + * int32 Robot_Gyro = 4; + * @return This builder for chaining. + */ + public Builder clearRobotGyro() { + bitField0_ = (bitField0_ & ~0x00000008); + robotGyro_ = 0; + onChanged(); + return this; + } + + private int distanceSensor_ ; + /** + *
+       * 发送100显示10cm
+       * 
+ * + * int32 Distance_Sensor = 5; + * @return The distanceSensor. + */ + @java.lang.Override + public int getDistanceSensor() { + return distanceSensor_; + } + /** + *
+       * 发送100显示10cm
+       * 
+ * + * int32 Distance_Sensor = 5; + * @param value The distanceSensor to set. + * @return This builder for chaining. + */ + public Builder setDistanceSensor(int value) { + + distanceSensor_ = value; + bitField0_ |= 0x00000010; + onChanged(); + return this; + } + /** + *
+       * 发送100显示10cm
+       * 
+ * + * int32 Distance_Sensor = 5; + * @return This builder for chaining. + */ + public Builder clearDistanceSensor() { + bitField0_ = (bitField0_ & ~0x00000010); + distanceSensor_ = 0; + onChanged(); + return this; + } + + private int systemError_ ; + /** + *
+       * 硬件通讯错误及按键未初始化错误
+       * 
+ * + * int32 SystemError = 6; + * @return The systemError. + */ + @java.lang.Override + public int getSystemError() { + return systemError_; + } + /** + *
+       * 硬件通讯错误及按键未初始化错误
+       * 
+ * + * int32 SystemError = 6; + * @param value The systemError to set. + * @return This builder for chaining. + */ + public Builder setSystemError(int value) { + + systemError_ = value; + bitField0_ |= 0x00000020; + onChanged(); + return this; + } + /** + *
+       * 硬件通讯错误及按键未初始化错误
+       * 
+ * + * int32 SystemError = 6; + * @return This builder for chaining. + */ + public Builder clearSystemError() { + bitField0_ = (bitField0_ & ~0x00000020); + systemError_ = 0; + onChanged(); + return this; + } + + private int leftMotorErr_ ; + /** + *
+       * 左轮电机报警
+       * 
+ * + * int32 Left_Motor_Err = 7; + * @return The leftMotorErr. + */ + @java.lang.Override + public int getLeftMotorErr() { + return leftMotorErr_; + } + /** + *
+       * 左轮电机报警
+       * 
+ * + * int32 Left_Motor_Err = 7; + * @param value The leftMotorErr to set. + * @return This builder for chaining. + */ + public Builder setLeftMotorErr(int value) { + + leftMotorErr_ = value; + bitField0_ |= 0x00000040; + onChanged(); + return this; + } + /** + *
+       * 左轮电机报警
+       * 
+ * + * int32 Left_Motor_Err = 7; + * @return This builder for chaining. + */ + public Builder clearLeftMotorErr() { + bitField0_ = (bitField0_ & ~0x00000040); + leftMotorErr_ = 0; + onChanged(); + return this; + } + + private int rightMotorErr_ ; + /** + *
+       * 右轮电机报警
+       * 
+ * + * int32 Right_Motor_Err = 8; + * @return The rightMotorErr. + */ + @java.lang.Override + public int getRightMotorErr() { + return rightMotorErr_; + } + /** + *
+       * 右轮电机报警
+       * 
+ * + * int32 Right_Motor_Err = 8; + * @param value The rightMotorErr to set. + * @return This builder for chaining. + */ + public Builder setRightMotorErr(int value) { + + rightMotorErr_ = value; + bitField0_ |= 0x00000080; + onChanged(); + return this; + } + /** + *
+       * 右轮电机报警
+       * 
+ * + * int32 Right_Motor_Err = 8; + * @return This builder for chaining. + */ + public Builder clearRightMotorErr() { + bitField0_ = (bitField0_ & ~0x00000080); + rightMotorErr_ = 0; + onChanged(); + return this; + } + + private int swingMotorErr_ ; + /** + *
+       * 摆臂电机报警
+       * 
+ * + * int32 Swing_Motor_Err = 9; + * @return The swingMotorErr. + */ + @java.lang.Override + public int getSwingMotorErr() { + return swingMotorErr_; + } + /** + *
+       * 摆臂电机报警
+       * 
+ * + * int32 Swing_Motor_Err = 9; + * @param value The swingMotorErr to set. + * @return This builder for chaining. + */ + public Builder setSwingMotorErr(int value) { + + swingMotorErr_ = value; + bitField0_ |= 0x00000100; + onChanged(); + return this; + } + /** + *
+       * 摆臂电机报警
+       * 
+ * + * int32 Swing_Motor_Err = 9; + * @return This builder for chaining. + */ + public Builder clearSwingMotorErr() { + bitField0_ = (bitField0_ & ~0x00000100); + swingMotorErr_ = 0; + onChanged(); + return this; + } + + private int isOnline_ ; + /** + *
+       * 是否在线
+       * 
+ * + * int32 Is_Online = 10; + * @return The isOnline. + */ + @java.lang.Override + public int getIsOnline() { + return isOnline_; + } + /** + *
+       * 是否在线
+       * 
+ * + * int32 Is_Online = 10; + * @param value The isOnline to set. + * @return This builder for chaining. + */ + public Builder setIsOnline(int value) { + + isOnline_ = value; + bitField0_ |= 0x00000200; + onChanged(); + return this; + } + /** + *
+       * 是否在线
+       * 
+ * + * int32 Is_Online = 10; + * @return This builder for chaining. + */ + public Builder clearIsOnline() { + bitField0_ = (bitField0_ & ~0x00000200); + isOnline_ = 0; + onChanged(); + return this; + } + + private int sparaData1_ ; + /** + *
+       * 备用数据1
+       * 
+ * + * int32 Spara_Data_1 = 11; + * @return The sparaData1. + */ + @java.lang.Override + public int getSparaData1() { + return sparaData1_; + } + /** + *
+       * 备用数据1
+       * 
+ * + * int32 Spara_Data_1 = 11; + * @param value The sparaData1 to set. + * @return This builder for chaining. + */ + public Builder setSparaData1(int value) { + + sparaData1_ = value; + bitField0_ |= 0x00000400; + onChanged(); + return this; + } + /** + *
+       * 备用数据1
+       * 
+ * + * int32 Spara_Data_1 = 11; + * @return This builder for chaining. + */ + public Builder clearSparaData1() { + bitField0_ = (bitField0_ & ~0x00000400); + sparaData1_ = 0; + onChanged(); + return this; + } + + private int sparaData2_ ; + /** + *
+       * 备用数据2
+       * 
+ * + * int32 Spara_Data_2 = 12; + * @return The sparaData2. + */ + @java.lang.Override + public int getSparaData2() { + return sparaData2_; + } + /** + *
+       * 备用数据2
+       * 
+ * + * int32 Spara_Data_2 = 12; + * @param value The sparaData2 to set. + * @return This builder for chaining. + */ + public Builder setSparaData2(int value) { + + sparaData2_ = value; + bitField0_ |= 0x00000800; + onChanged(); + return this; + } + /** + *
+       * 备用数据2
+       * 
+ * + * int32 Spara_Data_2 = 12; + * @return This builder for chaining. + */ + public Builder clearSparaData2() { + bitField0_ = (bitField0_ & ~0x00000800); + sparaData2_ = 0; + onChanged(); + return this; + } + + private int sparaData3_ ; + /** + *
+       * 备用数据3
+       * 
+ * + * int32 Spara_Data_3 = 13; + * @return The sparaData3. + */ + @java.lang.Override + public int getSparaData3() { + return sparaData3_; + } + /** + *
+       * 备用数据3
+       * 
+ * + * int32 Spara_Data_3 = 13; + * @param value The sparaData3 to set. + * @return This builder for chaining. + */ + public Builder setSparaData3(int value) { + + sparaData3_ = value; + bitField0_ |= 0x00001000; + onChanged(); + return this; + } + /** + *
+       * 备用数据3
+       * 
+ * + * int32 Spara_Data_3 = 13; + * @return This builder for chaining. + */ + public Builder clearSparaData3() { + bitField0_ = (bitField0_ & ~0x00001000); + sparaData3_ = 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.swingarmapp_sandblast.models.BspIV.IV_struct_define DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.example.swingarmapp_sandblast.models.BspIV.IV_struct_define(); + } + + public static com.example.swingarmapp_sandblast.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.swingarmapp_sandblast.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\"\307\002\n\020IV_struct_define\022\030\n\020L" + + "eftCompensation\030\001 \001(\005\022\031\n\021RightCompensati" + + "on\030\002 \001(\005\022\035\n\025Robot_Move_Deri_Speed\030\003 \001(\005\022" + + "\022\n\nRobot_Gyro\030\004 \001(\005\022\027\n\017Distance_Sensor\030\005" + + " \001(\005\022\023\n\013SystemError\030\006 \001(\005\022\026\n\016Left_Motor_" + + "Err\030\007 \001(\005\022\027\n\017Right_Motor_Err\030\010 \001(\005\022\027\n\017Sw" + + "ing_Motor_Err\030\t \001(\005\022\021\n\tIs_Online\030\n \001(\005\022\024" + + "\n\014Spara_Data_1\030\013 \001(\005\022\024\n\014Spara_Data_2\030\014 \001" + + "(\005\022\024\n\014Spara_Data_3\030\r \001(\005B,\n(com.example." + + "swingarmapp_sandblast.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[] { "LeftCompensation", "RightCompensation", "RobotMoveDeriSpeed", "RobotGyro", "DistanceSensor", "SystemError", "LeftMotorErr", "RightMotorErr", "SwingMotorErr", "IsOnline", "SparaData1", "SparaData2", "SparaData3", }); + descriptor.resolveAllFeaturesImmutable(); + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/swingarmapp_sandblast/app/src/main/java/com/example/swingarmapp_sandblast/models/BspPV.java b/swingarmapp_sandblast/app/src/main/java/com/example/swingarmapp_sandblast/models/BspPV.java new file mode 100644 index 0000000..513be80 --- /dev/null +++ b/swingarmapp_sandblast/app/src/main/java/com/example/swingarmapp_sandblast/models/BspPV.java @@ -0,0 +1,1906 @@ +// 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.swingarmapp_sandblast.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 { + + /** + *
+     * 操作模式 手动模式1 2 3 4   自动模式5 6 7
+     * 
+ * + * int32 Robot_Operation_Mode = 1; + * @return The robotOperationMode. + */ + int getRobotOperationMode(); + + /** + *
+     * 机器人移动速度
+     * 
+ * + * int32 Robot_Move_Speed = 2; + * @return The robotMoveSpeed. + */ + int getRobotMoveSpeed(); + + /** + *
+     * 换道距离
+     * 
+ * + * int32 Robot_Change_Lane_Distance = 3; + * @return The robotChangeLaneDistance. + */ + int getRobotChangeLaneDistance(); + + /** + *
+     * 摆臂速度
+     * 
+ * + * int32 Robot_Swing_Speed = 4; + * @return The robotSwingSpeed. + */ + int getRobotSwingSpeed(); + + /** + *
+     * 摆臂角度界面中的对称or非对称 1 对称 2 非对称
+     * 
+ * + * int32 Robot_symmetricalOrNot = 5; + * @return The robotSymmetricalOrNot. + */ + int getRobotSymmetricalOrNot(); + + /** + *
+     * 对称下的摆臂角度
+     * 
+ * + * int32 Robot_Swing_Range_Angle = 6; + * @return The robotSwingRangeAngle. + */ + int getRobotSwingRangeAngle(); + + /** + *
+     * 非对称条件下下  1左侧   2 右侧
+     * 
+ * + * int32 Robot_asymmetricalAngleSetValue = 7; + * @return The robotAsymmetricalAngleSetValue. + */ + int getRobotAsymmetricalAngleSetValue(); + + /** + *
+     * 后退设置模式 1 打退交替 2 边打边退
+     * 
+ * + * int32 Robot_backMode = 8; + * @return The robotBackMode. + */ + int getRobotBackMode(); + + /** + *
+     * 打退交替条件下的后退距离
+     * 
+ * + * int32 Robot_Back_Distance = 9; + * @return The robotBackDistance. + */ + int getRobotBackDistance(); + + /** + *
+     * 边打边退条件下的后退速度
+     * 
+ * + * int32 Robot_Back_Speed = 10; + * @return The robotBackSpeed. + */ + int getRobotBackSpeed(); + + /** + *
+     * 压力设置
+     * 
+ * + * int32 Robot_Press_Set = 11; + * @return The robotPressSet. + */ + int getRobotPressSet(); + + /** + *
+     * 竖直微调
+     * 
+ * + * int32 Robot_Vertical_Adjust = 12; + * @return The robotVerticalAdjust. + */ + int getRobotVerticalAdjust(); + + /** + *
+     * 自动模式下的作业长度
+     * 
+ * + * int32 Robot_Length_Homework = 13; + * @return The robotLengthHomework. + */ + int getRobotLengthHomework(); + + /** + *
+     * 自动模式下的作业宽度
+     * 
+ * + * int32 Robot_Width_Homework = 14; + * @return The robotWidthHomework. + */ + int getRobotWidthHomework(); + + /** + *
+     * 喷砂机编码1
+     * 
+ * + * int32 Robot_SandBalst_Encode_One = 15; + * @return The robotSandBalstEncodeOne. + */ + int getRobotSandBalstEncodeOne(); + + /** + *
+     * 喷砂机编码2
+     * 
+ * + * int32 Robot_SandBalst_Encode_Two = 16; + * @return The robotSandBalstEncodeTwo. + */ + int getRobotSandBalstEncodeTwo(); + } + /** + * 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.swingarmapp_sandblast.models.BspPV.internal_static_PV_struct_define_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.example.swingarmapp_sandblast.models.BspPV.internal_static_PV_struct_define_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.example.swingarmapp_sandblast.models.BspPV.PV_struct_define.class, com.example.swingarmapp_sandblast.models.BspPV.PV_struct_define.Builder.class); + } + + public static final int ROBOT_OPERATION_MODE_FIELD_NUMBER = 1; + private int robotOperationMode_ = 0; + /** + *
+     * 操作模式 手动模式1 2 3 4   自动模式5 6 7
+     * 
+ * + * int32 Robot_Operation_Mode = 1; + * @return The robotOperationMode. + */ + @java.lang.Override + public int getRobotOperationMode() { + return robotOperationMode_; + } + + public static final int ROBOT_MOVE_SPEED_FIELD_NUMBER = 2; + private int robotMoveSpeed_ = 0; + /** + *
+     * 机器人移动速度
+     * 
+ * + * int32 Robot_Move_Speed = 2; + * @return The robotMoveSpeed. + */ + @java.lang.Override + public int getRobotMoveSpeed() { + return robotMoveSpeed_; + } + + public static final int ROBOT_CHANGE_LANE_DISTANCE_FIELD_NUMBER = 3; + private int robotChangeLaneDistance_ = 0; + /** + *
+     * 换道距离
+     * 
+ * + * int32 Robot_Change_Lane_Distance = 3; + * @return The robotChangeLaneDistance. + */ + @java.lang.Override + public int getRobotChangeLaneDistance() { + return robotChangeLaneDistance_; + } + + public static final int ROBOT_SWING_SPEED_FIELD_NUMBER = 4; + private int robotSwingSpeed_ = 0; + /** + *
+     * 摆臂速度
+     * 
+ * + * int32 Robot_Swing_Speed = 4; + * @return The robotSwingSpeed. + */ + @java.lang.Override + public int getRobotSwingSpeed() { + return robotSwingSpeed_; + } + + public static final int ROBOT_SYMMETRICALORNOT_FIELD_NUMBER = 5; + private int robotSymmetricalOrNot_ = 0; + /** + *
+     * 摆臂角度界面中的对称or非对称 1 对称 2 非对称
+     * 
+ * + * int32 Robot_symmetricalOrNot = 5; + * @return The robotSymmetricalOrNot. + */ + @java.lang.Override + public int getRobotSymmetricalOrNot() { + return robotSymmetricalOrNot_; + } + + public static final int ROBOT_SWING_RANGE_ANGLE_FIELD_NUMBER = 6; + private int robotSwingRangeAngle_ = 0; + /** + *
+     * 对称下的摆臂角度
+     * 
+ * + * int32 Robot_Swing_Range_Angle = 6; + * @return The robotSwingRangeAngle. + */ + @java.lang.Override + public int getRobotSwingRangeAngle() { + return robotSwingRangeAngle_; + } + + public static final int ROBOT_ASYMMETRICALANGLESETVALUE_FIELD_NUMBER = 7; + private int robotAsymmetricalAngleSetValue_ = 0; + /** + *
+     * 非对称条件下下  1左侧   2 右侧
+     * 
+ * + * int32 Robot_asymmetricalAngleSetValue = 7; + * @return The robotAsymmetricalAngleSetValue. + */ + @java.lang.Override + public int getRobotAsymmetricalAngleSetValue() { + return robotAsymmetricalAngleSetValue_; + } + + public static final int ROBOT_BACKMODE_FIELD_NUMBER = 8; + private int robotBackMode_ = 0; + /** + *
+     * 后退设置模式 1 打退交替 2 边打边退
+     * 
+ * + * int32 Robot_backMode = 8; + * @return The robotBackMode. + */ + @java.lang.Override + public int getRobotBackMode() { + return robotBackMode_; + } + + public static final int ROBOT_BACK_DISTANCE_FIELD_NUMBER = 9; + private int robotBackDistance_ = 0; + /** + *
+     * 打退交替条件下的后退距离
+     * 
+ * + * int32 Robot_Back_Distance = 9; + * @return The robotBackDistance. + */ + @java.lang.Override + public int getRobotBackDistance() { + return robotBackDistance_; + } + + public static final int ROBOT_BACK_SPEED_FIELD_NUMBER = 10; + private int robotBackSpeed_ = 0; + /** + *
+     * 边打边退条件下的后退速度
+     * 
+ * + * int32 Robot_Back_Speed = 10; + * @return The robotBackSpeed. + */ + @java.lang.Override + public int getRobotBackSpeed() { + return robotBackSpeed_; + } + + public static final int ROBOT_PRESS_SET_FIELD_NUMBER = 11; + private int robotPressSet_ = 0; + /** + *
+     * 压力设置
+     * 
+ * + * int32 Robot_Press_Set = 11; + * @return The robotPressSet. + */ + @java.lang.Override + public int getRobotPressSet() { + return robotPressSet_; + } + + public static final int ROBOT_VERTICAL_ADJUST_FIELD_NUMBER = 12; + private int robotVerticalAdjust_ = 0; + /** + *
+     * 竖直微调
+     * 
+ * + * int32 Robot_Vertical_Adjust = 12; + * @return The robotVerticalAdjust. + */ + @java.lang.Override + public int getRobotVerticalAdjust() { + return robotVerticalAdjust_; + } + + public static final int ROBOT_LENGTH_HOMEWORK_FIELD_NUMBER = 13; + private int robotLengthHomework_ = 0; + /** + *
+     * 自动模式下的作业长度
+     * 
+ * + * int32 Robot_Length_Homework = 13; + * @return The robotLengthHomework. + */ + @java.lang.Override + public int getRobotLengthHomework() { + return robotLengthHomework_; + } + + public static final int ROBOT_WIDTH_HOMEWORK_FIELD_NUMBER = 14; + private int robotWidthHomework_ = 0; + /** + *
+     * 自动模式下的作业宽度
+     * 
+ * + * int32 Robot_Width_Homework = 14; + * @return The robotWidthHomework. + */ + @java.lang.Override + public int getRobotWidthHomework() { + return robotWidthHomework_; + } + + public static final int ROBOT_SANDBALST_ENCODE_ONE_FIELD_NUMBER = 15; + private int robotSandBalstEncodeOne_ = 0; + /** + *
+     * 喷砂机编码1
+     * 
+ * + * int32 Robot_SandBalst_Encode_One = 15; + * @return The robotSandBalstEncodeOne. + */ + @java.lang.Override + public int getRobotSandBalstEncodeOne() { + return robotSandBalstEncodeOne_; + } + + public static final int ROBOT_SANDBALST_ENCODE_TWO_FIELD_NUMBER = 16; + private int robotSandBalstEncodeTwo_ = 0; + /** + *
+     * 喷砂机编码2
+     * 
+ * + * int32 Robot_SandBalst_Encode_Two = 16; + * @return The robotSandBalstEncodeTwo. + */ + @java.lang.Override + public int getRobotSandBalstEncodeTwo() { + return robotSandBalstEncodeTwo_; + } + + 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 (robotOperationMode_ != 0) { + output.writeInt32(1, robotOperationMode_); + } + if (robotMoveSpeed_ != 0) { + output.writeInt32(2, robotMoveSpeed_); + } + if (robotChangeLaneDistance_ != 0) { + output.writeInt32(3, robotChangeLaneDistance_); + } + if (robotSwingSpeed_ != 0) { + output.writeInt32(4, robotSwingSpeed_); + } + if (robotSymmetricalOrNot_ != 0) { + output.writeInt32(5, robotSymmetricalOrNot_); + } + if (robotSwingRangeAngle_ != 0) { + output.writeInt32(6, robotSwingRangeAngle_); + } + if (robotAsymmetricalAngleSetValue_ != 0) { + output.writeInt32(7, robotAsymmetricalAngleSetValue_); + } + if (robotBackMode_ != 0) { + output.writeInt32(8, robotBackMode_); + } + if (robotBackDistance_ != 0) { + output.writeInt32(9, robotBackDistance_); + } + if (robotBackSpeed_ != 0) { + output.writeInt32(10, robotBackSpeed_); + } + if (robotPressSet_ != 0) { + output.writeInt32(11, robotPressSet_); + } + if (robotVerticalAdjust_ != 0) { + output.writeInt32(12, robotVerticalAdjust_); + } + if (robotLengthHomework_ != 0) { + output.writeInt32(13, robotLengthHomework_); + } + if (robotWidthHomework_ != 0) { + output.writeInt32(14, robotWidthHomework_); + } + if (robotSandBalstEncodeOne_ != 0) { + output.writeInt32(15, robotSandBalstEncodeOne_); + } + if (robotSandBalstEncodeTwo_ != 0) { + output.writeInt32(16, robotSandBalstEncodeTwo_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (robotOperationMode_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(1, robotOperationMode_); + } + if (robotMoveSpeed_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(2, robotMoveSpeed_); + } + if (robotChangeLaneDistance_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(3, robotChangeLaneDistance_); + } + if (robotSwingSpeed_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(4, robotSwingSpeed_); + } + if (robotSymmetricalOrNot_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(5, robotSymmetricalOrNot_); + } + if (robotSwingRangeAngle_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(6, robotSwingRangeAngle_); + } + if (robotAsymmetricalAngleSetValue_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(7, robotAsymmetricalAngleSetValue_); + } + if (robotBackMode_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(8, robotBackMode_); + } + if (robotBackDistance_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(9, robotBackDistance_); + } + if (robotBackSpeed_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(10, robotBackSpeed_); + } + if (robotPressSet_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(11, robotPressSet_); + } + if (robotVerticalAdjust_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(12, robotVerticalAdjust_); + } + if (robotLengthHomework_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(13, robotLengthHomework_); + } + if (robotWidthHomework_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(14, robotWidthHomework_); + } + if (robotSandBalstEncodeOne_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(15, robotSandBalstEncodeOne_); + } + if (robotSandBalstEncodeTwo_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(16, robotSandBalstEncodeTwo_); + } + 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.swingarmapp_sandblast.models.BspPV.PV_struct_define)) { + return super.equals(obj); + } + com.example.swingarmapp_sandblast.models.BspPV.PV_struct_define other = (com.example.swingarmapp_sandblast.models.BspPV.PV_struct_define) obj; + + if (getRobotOperationMode() + != other.getRobotOperationMode()) return false; + if (getRobotMoveSpeed() + != other.getRobotMoveSpeed()) return false; + if (getRobotChangeLaneDistance() + != other.getRobotChangeLaneDistance()) return false; + if (getRobotSwingSpeed() + != other.getRobotSwingSpeed()) return false; + if (getRobotSymmetricalOrNot() + != other.getRobotSymmetricalOrNot()) return false; + if (getRobotSwingRangeAngle() + != other.getRobotSwingRangeAngle()) return false; + if (getRobotAsymmetricalAngleSetValue() + != other.getRobotAsymmetricalAngleSetValue()) return false; + if (getRobotBackMode() + != other.getRobotBackMode()) return false; + if (getRobotBackDistance() + != other.getRobotBackDistance()) return false; + if (getRobotBackSpeed() + != other.getRobotBackSpeed()) return false; + if (getRobotPressSet() + != other.getRobotPressSet()) return false; + if (getRobotVerticalAdjust() + != other.getRobotVerticalAdjust()) return false; + if (getRobotLengthHomework() + != other.getRobotLengthHomework()) return false; + if (getRobotWidthHomework() + != other.getRobotWidthHomework()) return false; + if (getRobotSandBalstEncodeOne() + != other.getRobotSandBalstEncodeOne()) return false; + if (getRobotSandBalstEncodeTwo() + != other.getRobotSandBalstEncodeTwo()) 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) + ROBOT_OPERATION_MODE_FIELD_NUMBER; + hash = (53 * hash) + getRobotOperationMode(); + hash = (37 * hash) + ROBOT_MOVE_SPEED_FIELD_NUMBER; + hash = (53 * hash) + getRobotMoveSpeed(); + hash = (37 * hash) + ROBOT_CHANGE_LANE_DISTANCE_FIELD_NUMBER; + hash = (53 * hash) + getRobotChangeLaneDistance(); + hash = (37 * hash) + ROBOT_SWING_SPEED_FIELD_NUMBER; + hash = (53 * hash) + getRobotSwingSpeed(); + hash = (37 * hash) + ROBOT_SYMMETRICALORNOT_FIELD_NUMBER; + hash = (53 * hash) + getRobotSymmetricalOrNot(); + hash = (37 * hash) + ROBOT_SWING_RANGE_ANGLE_FIELD_NUMBER; + hash = (53 * hash) + getRobotSwingRangeAngle(); + hash = (37 * hash) + ROBOT_ASYMMETRICALANGLESETVALUE_FIELD_NUMBER; + hash = (53 * hash) + getRobotAsymmetricalAngleSetValue(); + hash = (37 * hash) + ROBOT_BACKMODE_FIELD_NUMBER; + hash = (53 * hash) + getRobotBackMode(); + hash = (37 * hash) + ROBOT_BACK_DISTANCE_FIELD_NUMBER; + hash = (53 * hash) + getRobotBackDistance(); + hash = (37 * hash) + ROBOT_BACK_SPEED_FIELD_NUMBER; + hash = (53 * hash) + getRobotBackSpeed(); + hash = (37 * hash) + ROBOT_PRESS_SET_FIELD_NUMBER; + hash = (53 * hash) + getRobotPressSet(); + hash = (37 * hash) + ROBOT_VERTICAL_ADJUST_FIELD_NUMBER; + hash = (53 * hash) + getRobotVerticalAdjust(); + hash = (37 * hash) + ROBOT_LENGTH_HOMEWORK_FIELD_NUMBER; + hash = (53 * hash) + getRobotLengthHomework(); + hash = (37 * hash) + ROBOT_WIDTH_HOMEWORK_FIELD_NUMBER; + hash = (53 * hash) + getRobotWidthHomework(); + hash = (37 * hash) + ROBOT_SANDBALST_ENCODE_ONE_FIELD_NUMBER; + hash = (53 * hash) + getRobotSandBalstEncodeOne(); + hash = (37 * hash) + ROBOT_SANDBALST_ENCODE_TWO_FIELD_NUMBER; + hash = (53 * hash) + getRobotSandBalstEncodeTwo(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.example.swingarmapp_sandblast.models.BspPV.PV_struct_define parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.example.swingarmapp_sandblast.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.swingarmapp_sandblast.models.BspPV.PV_struct_define parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.example.swingarmapp_sandblast.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.swingarmapp_sandblast.models.BspPV.PV_struct_define parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.example.swingarmapp_sandblast.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.swingarmapp_sandblast.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.swingarmapp_sandblast.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.swingarmapp_sandblast.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.swingarmapp_sandblast.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.swingarmapp_sandblast.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.swingarmapp_sandblast.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.swingarmapp_sandblast.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.swingarmapp_sandblast.models.BspPV.PV_struct_defineOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.example.swingarmapp_sandblast.models.BspPV.internal_static_PV_struct_define_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.example.swingarmapp_sandblast.models.BspPV.internal_static_PV_struct_define_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.example.swingarmapp_sandblast.models.BspPV.PV_struct_define.class, com.example.swingarmapp_sandblast.models.BspPV.PV_struct_define.Builder.class); + } + + // Construct using com.example.swingarmapp_sandblast.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; + robotOperationMode_ = 0; + robotMoveSpeed_ = 0; + robotChangeLaneDistance_ = 0; + robotSwingSpeed_ = 0; + robotSymmetricalOrNot_ = 0; + robotSwingRangeAngle_ = 0; + robotAsymmetricalAngleSetValue_ = 0; + robotBackMode_ = 0; + robotBackDistance_ = 0; + robotBackSpeed_ = 0; + robotPressSet_ = 0; + robotVerticalAdjust_ = 0; + robotLengthHomework_ = 0; + robotWidthHomework_ = 0; + robotSandBalstEncodeOne_ = 0; + robotSandBalstEncodeTwo_ = 0; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.example.swingarmapp_sandblast.models.BspPV.internal_static_PV_struct_define_descriptor; + } + + @java.lang.Override + public com.example.swingarmapp_sandblast.models.BspPV.PV_struct_define getDefaultInstanceForType() { + return com.example.swingarmapp_sandblast.models.BspPV.PV_struct_define.getDefaultInstance(); + } + + @java.lang.Override + public com.example.swingarmapp_sandblast.models.BspPV.PV_struct_define build() { + com.example.swingarmapp_sandblast.models.BspPV.PV_struct_define result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.example.swingarmapp_sandblast.models.BspPV.PV_struct_define buildPartial() { + com.example.swingarmapp_sandblast.models.BspPV.PV_struct_define result = new com.example.swingarmapp_sandblast.models.BspPV.PV_struct_define(this); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartial0(com.example.swingarmapp_sandblast.models.BspPV.PV_struct_define result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.robotOperationMode_ = robotOperationMode_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.robotMoveSpeed_ = robotMoveSpeed_; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.robotChangeLaneDistance_ = robotChangeLaneDistance_; + } + if (((from_bitField0_ & 0x00000008) != 0)) { + result.robotSwingSpeed_ = robotSwingSpeed_; + } + if (((from_bitField0_ & 0x00000010) != 0)) { + result.robotSymmetricalOrNot_ = robotSymmetricalOrNot_; + } + if (((from_bitField0_ & 0x00000020) != 0)) { + result.robotSwingRangeAngle_ = robotSwingRangeAngle_; + } + if (((from_bitField0_ & 0x00000040) != 0)) { + result.robotAsymmetricalAngleSetValue_ = robotAsymmetricalAngleSetValue_; + } + if (((from_bitField0_ & 0x00000080) != 0)) { + result.robotBackMode_ = robotBackMode_; + } + if (((from_bitField0_ & 0x00000100) != 0)) { + result.robotBackDistance_ = robotBackDistance_; + } + if (((from_bitField0_ & 0x00000200) != 0)) { + result.robotBackSpeed_ = robotBackSpeed_; + } + if (((from_bitField0_ & 0x00000400) != 0)) { + result.robotPressSet_ = robotPressSet_; + } + if (((from_bitField0_ & 0x00000800) != 0)) { + result.robotVerticalAdjust_ = robotVerticalAdjust_; + } + if (((from_bitField0_ & 0x00001000) != 0)) { + result.robotLengthHomework_ = robotLengthHomework_; + } + if (((from_bitField0_ & 0x00002000) != 0)) { + result.robotWidthHomework_ = robotWidthHomework_; + } + if (((from_bitField0_ & 0x00004000) != 0)) { + result.robotSandBalstEncodeOne_ = robotSandBalstEncodeOne_; + } + if (((from_bitField0_ & 0x00008000) != 0)) { + result.robotSandBalstEncodeTwo_ = robotSandBalstEncodeTwo_; + } + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.example.swingarmapp_sandblast.models.BspPV.PV_struct_define) { + return mergeFrom((com.example.swingarmapp_sandblast.models.BspPV.PV_struct_define)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.example.swingarmapp_sandblast.models.BspPV.PV_struct_define other) { + if (other == com.example.swingarmapp_sandblast.models.BspPV.PV_struct_define.getDefaultInstance()) return this; + if (other.getRobotOperationMode() != 0) { + setRobotOperationMode(other.getRobotOperationMode()); + } + if (other.getRobotMoveSpeed() != 0) { + setRobotMoveSpeed(other.getRobotMoveSpeed()); + } + if (other.getRobotChangeLaneDistance() != 0) { + setRobotChangeLaneDistance(other.getRobotChangeLaneDistance()); + } + if (other.getRobotSwingSpeed() != 0) { + setRobotSwingSpeed(other.getRobotSwingSpeed()); + } + if (other.getRobotSymmetricalOrNot() != 0) { + setRobotSymmetricalOrNot(other.getRobotSymmetricalOrNot()); + } + if (other.getRobotSwingRangeAngle() != 0) { + setRobotSwingRangeAngle(other.getRobotSwingRangeAngle()); + } + if (other.getRobotAsymmetricalAngleSetValue() != 0) { + setRobotAsymmetricalAngleSetValue(other.getRobotAsymmetricalAngleSetValue()); + } + if (other.getRobotBackMode() != 0) { + setRobotBackMode(other.getRobotBackMode()); + } + if (other.getRobotBackDistance() != 0) { + setRobotBackDistance(other.getRobotBackDistance()); + } + if (other.getRobotBackSpeed() != 0) { + setRobotBackSpeed(other.getRobotBackSpeed()); + } + if (other.getRobotPressSet() != 0) { + setRobotPressSet(other.getRobotPressSet()); + } + if (other.getRobotVerticalAdjust() != 0) { + setRobotVerticalAdjust(other.getRobotVerticalAdjust()); + } + if (other.getRobotLengthHomework() != 0) { + setRobotLengthHomework(other.getRobotLengthHomework()); + } + if (other.getRobotWidthHomework() != 0) { + setRobotWidthHomework(other.getRobotWidthHomework()); + } + if (other.getRobotSandBalstEncodeOne() != 0) { + setRobotSandBalstEncodeOne(other.getRobotSandBalstEncodeOne()); + } + if (other.getRobotSandBalstEncodeTwo() != 0) { + setRobotSandBalstEncodeTwo(other.getRobotSandBalstEncodeTwo()); + } + 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: { + robotOperationMode_ = input.readInt32(); + bitField0_ |= 0x00000001; + break; + } // case 8 + case 16: { + robotMoveSpeed_ = input.readInt32(); + bitField0_ |= 0x00000002; + break; + } // case 16 + case 24: { + robotChangeLaneDistance_ = input.readInt32(); + bitField0_ |= 0x00000004; + break; + } // case 24 + case 32: { + robotSwingSpeed_ = input.readInt32(); + bitField0_ |= 0x00000008; + break; + } // case 32 + case 40: { + robotSymmetricalOrNot_ = input.readInt32(); + bitField0_ |= 0x00000010; + break; + } // case 40 + case 48: { + robotSwingRangeAngle_ = input.readInt32(); + bitField0_ |= 0x00000020; + break; + } // case 48 + case 56: { + robotAsymmetricalAngleSetValue_ = input.readInt32(); + bitField0_ |= 0x00000040; + break; + } // case 56 + case 64: { + robotBackMode_ = input.readInt32(); + bitField0_ |= 0x00000080; + break; + } // case 64 + case 72: { + robotBackDistance_ = input.readInt32(); + bitField0_ |= 0x00000100; + break; + } // case 72 + case 80: { + robotBackSpeed_ = input.readInt32(); + bitField0_ |= 0x00000200; + break; + } // case 80 + case 88: { + robotPressSet_ = input.readInt32(); + bitField0_ |= 0x00000400; + break; + } // case 88 + case 96: { + robotVerticalAdjust_ = input.readInt32(); + bitField0_ |= 0x00000800; + break; + } // case 96 + case 104: { + robotLengthHomework_ = input.readInt32(); + bitField0_ |= 0x00001000; + break; + } // case 104 + case 112: { + robotWidthHomework_ = input.readInt32(); + bitField0_ |= 0x00002000; + break; + } // case 112 + case 120: { + robotSandBalstEncodeOne_ = input.readInt32(); + bitField0_ |= 0x00004000; + break; + } // case 120 + case 128: { + robotSandBalstEncodeTwo_ = input.readInt32(); + bitField0_ |= 0x00008000; + break; + } // case 128 + 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 robotOperationMode_ ; + /** + *
+       * 操作模式 手动模式1 2 3 4   自动模式5 6 7
+       * 
+ * + * int32 Robot_Operation_Mode = 1; + * @return The robotOperationMode. + */ + @java.lang.Override + public int getRobotOperationMode() { + return robotOperationMode_; + } + /** + *
+       * 操作模式 手动模式1 2 3 4   自动模式5 6 7
+       * 
+ * + * int32 Robot_Operation_Mode = 1; + * @param value The robotOperationMode to set. + * @return This builder for chaining. + */ + public Builder setRobotOperationMode(int value) { + + robotOperationMode_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + *
+       * 操作模式 手动模式1 2 3 4   自动模式5 6 7
+       * 
+ * + * int32 Robot_Operation_Mode = 1; + * @return This builder for chaining. + */ + public Builder clearRobotOperationMode() { + bitField0_ = (bitField0_ & ~0x00000001); + robotOperationMode_ = 0; + onChanged(); + return this; + } + + private int robotMoveSpeed_ ; + /** + *
+       * 机器人移动速度
+       * 
+ * + * int32 Robot_Move_Speed = 2; + * @return The robotMoveSpeed. + */ + @java.lang.Override + public int getRobotMoveSpeed() { + return robotMoveSpeed_; + } + /** + *
+       * 机器人移动速度
+       * 
+ * + * int32 Robot_Move_Speed = 2; + * @param value The robotMoveSpeed to set. + * @return This builder for chaining. + */ + public Builder setRobotMoveSpeed(int value) { + + robotMoveSpeed_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + *
+       * 机器人移动速度
+       * 
+ * + * int32 Robot_Move_Speed = 2; + * @return This builder for chaining. + */ + public Builder clearRobotMoveSpeed() { + bitField0_ = (bitField0_ & ~0x00000002); + robotMoveSpeed_ = 0; + onChanged(); + return this; + } + + private int robotChangeLaneDistance_ ; + /** + *
+       * 换道距离
+       * 
+ * + * int32 Robot_Change_Lane_Distance = 3; + * @return The robotChangeLaneDistance. + */ + @java.lang.Override + public int getRobotChangeLaneDistance() { + return robotChangeLaneDistance_; + } + /** + *
+       * 换道距离
+       * 
+ * + * int32 Robot_Change_Lane_Distance = 3; + * @param value The robotChangeLaneDistance to set. + * @return This builder for chaining. + */ + public Builder setRobotChangeLaneDistance(int value) { + + robotChangeLaneDistance_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + *
+       * 换道距离
+       * 
+ * + * int32 Robot_Change_Lane_Distance = 3; + * @return This builder for chaining. + */ + public Builder clearRobotChangeLaneDistance() { + bitField0_ = (bitField0_ & ~0x00000004); + robotChangeLaneDistance_ = 0; + onChanged(); + return this; + } + + private int robotSwingSpeed_ ; + /** + *
+       * 摆臂速度
+       * 
+ * + * int32 Robot_Swing_Speed = 4; + * @return The robotSwingSpeed. + */ + @java.lang.Override + public int getRobotSwingSpeed() { + return robotSwingSpeed_; + } + /** + *
+       * 摆臂速度
+       * 
+ * + * int32 Robot_Swing_Speed = 4; + * @param value The robotSwingSpeed to set. + * @return This builder for chaining. + */ + public Builder setRobotSwingSpeed(int value) { + + robotSwingSpeed_ = value; + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + /** + *
+       * 摆臂速度
+       * 
+ * + * int32 Robot_Swing_Speed = 4; + * @return This builder for chaining. + */ + public Builder clearRobotSwingSpeed() { + bitField0_ = (bitField0_ & ~0x00000008); + robotSwingSpeed_ = 0; + onChanged(); + return this; + } + + private int robotSymmetricalOrNot_ ; + /** + *
+       * 摆臂角度界面中的对称or非对称 1 对称 2 非对称
+       * 
+ * + * int32 Robot_symmetricalOrNot = 5; + * @return The robotSymmetricalOrNot. + */ + @java.lang.Override + public int getRobotSymmetricalOrNot() { + return robotSymmetricalOrNot_; + } + /** + *
+       * 摆臂角度界面中的对称or非对称 1 对称 2 非对称
+       * 
+ * + * int32 Robot_symmetricalOrNot = 5; + * @param value The robotSymmetricalOrNot to set. + * @return This builder for chaining. + */ + public Builder setRobotSymmetricalOrNot(int value) { + + robotSymmetricalOrNot_ = value; + bitField0_ |= 0x00000010; + onChanged(); + return this; + } + /** + *
+       * 摆臂角度界面中的对称or非对称 1 对称 2 非对称
+       * 
+ * + * int32 Robot_symmetricalOrNot = 5; + * @return This builder for chaining. + */ + public Builder clearRobotSymmetricalOrNot() { + bitField0_ = (bitField0_ & ~0x00000010); + robotSymmetricalOrNot_ = 0; + onChanged(); + return this; + } + + private int robotSwingRangeAngle_ ; + /** + *
+       * 对称下的摆臂角度
+       * 
+ * + * int32 Robot_Swing_Range_Angle = 6; + * @return The robotSwingRangeAngle. + */ + @java.lang.Override + public int getRobotSwingRangeAngle() { + return robotSwingRangeAngle_; + } + /** + *
+       * 对称下的摆臂角度
+       * 
+ * + * int32 Robot_Swing_Range_Angle = 6; + * @param value The robotSwingRangeAngle to set. + * @return This builder for chaining. + */ + public Builder setRobotSwingRangeAngle(int value) { + + robotSwingRangeAngle_ = value; + bitField0_ |= 0x00000020; + onChanged(); + return this; + } + /** + *
+       * 对称下的摆臂角度
+       * 
+ * + * int32 Robot_Swing_Range_Angle = 6; + * @return This builder for chaining. + */ + public Builder clearRobotSwingRangeAngle() { + bitField0_ = (bitField0_ & ~0x00000020); + robotSwingRangeAngle_ = 0; + onChanged(); + return this; + } + + private int robotAsymmetricalAngleSetValue_ ; + /** + *
+       * 非对称条件下下  1左侧   2 右侧
+       * 
+ * + * int32 Robot_asymmetricalAngleSetValue = 7; + * @return The robotAsymmetricalAngleSetValue. + */ + @java.lang.Override + public int getRobotAsymmetricalAngleSetValue() { + return robotAsymmetricalAngleSetValue_; + } + /** + *
+       * 非对称条件下下  1左侧   2 右侧
+       * 
+ * + * int32 Robot_asymmetricalAngleSetValue = 7; + * @param value The robotAsymmetricalAngleSetValue to set. + * @return This builder for chaining. + */ + public Builder setRobotAsymmetricalAngleSetValue(int value) { + + robotAsymmetricalAngleSetValue_ = value; + bitField0_ |= 0x00000040; + onChanged(); + return this; + } + /** + *
+       * 非对称条件下下  1左侧   2 右侧
+       * 
+ * + * int32 Robot_asymmetricalAngleSetValue = 7; + * @return This builder for chaining. + */ + public Builder clearRobotAsymmetricalAngleSetValue() { + bitField0_ = (bitField0_ & ~0x00000040); + robotAsymmetricalAngleSetValue_ = 0; + onChanged(); + return this; + } + + private int robotBackMode_ ; + /** + *
+       * 后退设置模式 1 打退交替 2 边打边退
+       * 
+ * + * int32 Robot_backMode = 8; + * @return The robotBackMode. + */ + @java.lang.Override + public int getRobotBackMode() { + return robotBackMode_; + } + /** + *
+       * 后退设置模式 1 打退交替 2 边打边退
+       * 
+ * + * int32 Robot_backMode = 8; + * @param value The robotBackMode to set. + * @return This builder for chaining. + */ + public Builder setRobotBackMode(int value) { + + robotBackMode_ = value; + bitField0_ |= 0x00000080; + onChanged(); + return this; + } + /** + *
+       * 后退设置模式 1 打退交替 2 边打边退
+       * 
+ * + * int32 Robot_backMode = 8; + * @return This builder for chaining. + */ + public Builder clearRobotBackMode() { + bitField0_ = (bitField0_ & ~0x00000080); + robotBackMode_ = 0; + onChanged(); + return this; + } + + private int robotBackDistance_ ; + /** + *
+       * 打退交替条件下的后退距离
+       * 
+ * + * int32 Robot_Back_Distance = 9; + * @return The robotBackDistance. + */ + @java.lang.Override + public int getRobotBackDistance() { + return robotBackDistance_; + } + /** + *
+       * 打退交替条件下的后退距离
+       * 
+ * + * int32 Robot_Back_Distance = 9; + * @param value The robotBackDistance to set. + * @return This builder for chaining. + */ + public Builder setRobotBackDistance(int value) { + + robotBackDistance_ = value; + bitField0_ |= 0x00000100; + onChanged(); + return this; + } + /** + *
+       * 打退交替条件下的后退距离
+       * 
+ * + * int32 Robot_Back_Distance = 9; + * @return This builder for chaining. + */ + public Builder clearRobotBackDistance() { + bitField0_ = (bitField0_ & ~0x00000100); + robotBackDistance_ = 0; + onChanged(); + return this; + } + + private int robotBackSpeed_ ; + /** + *
+       * 边打边退条件下的后退速度
+       * 
+ * + * int32 Robot_Back_Speed = 10; + * @return The robotBackSpeed. + */ + @java.lang.Override + public int getRobotBackSpeed() { + return robotBackSpeed_; + } + /** + *
+       * 边打边退条件下的后退速度
+       * 
+ * + * int32 Robot_Back_Speed = 10; + * @param value The robotBackSpeed to set. + * @return This builder for chaining. + */ + public Builder setRobotBackSpeed(int value) { + + robotBackSpeed_ = value; + bitField0_ |= 0x00000200; + onChanged(); + return this; + } + /** + *
+       * 边打边退条件下的后退速度
+       * 
+ * + * int32 Robot_Back_Speed = 10; + * @return This builder for chaining. + */ + public Builder clearRobotBackSpeed() { + bitField0_ = (bitField0_ & ~0x00000200); + robotBackSpeed_ = 0; + onChanged(); + return this; + } + + private int robotPressSet_ ; + /** + *
+       * 压力设置
+       * 
+ * + * int32 Robot_Press_Set = 11; + * @return The robotPressSet. + */ + @java.lang.Override + public int getRobotPressSet() { + return robotPressSet_; + } + /** + *
+       * 压力设置
+       * 
+ * + * int32 Robot_Press_Set = 11; + * @param value The robotPressSet to set. + * @return This builder for chaining. + */ + public Builder setRobotPressSet(int value) { + + robotPressSet_ = value; + bitField0_ |= 0x00000400; + onChanged(); + return this; + } + /** + *
+       * 压力设置
+       * 
+ * + * int32 Robot_Press_Set = 11; + * @return This builder for chaining. + */ + public Builder clearRobotPressSet() { + bitField0_ = (bitField0_ & ~0x00000400); + robotPressSet_ = 0; + onChanged(); + return this; + } + + private int robotVerticalAdjust_ ; + /** + *
+       * 竖直微调
+       * 
+ * + * int32 Robot_Vertical_Adjust = 12; + * @return The robotVerticalAdjust. + */ + @java.lang.Override + public int getRobotVerticalAdjust() { + return robotVerticalAdjust_; + } + /** + *
+       * 竖直微调
+       * 
+ * + * int32 Robot_Vertical_Adjust = 12; + * @param value The robotVerticalAdjust to set. + * @return This builder for chaining. + */ + public Builder setRobotVerticalAdjust(int value) { + + robotVerticalAdjust_ = value; + bitField0_ |= 0x00000800; + onChanged(); + return this; + } + /** + *
+       * 竖直微调
+       * 
+ * + * int32 Robot_Vertical_Adjust = 12; + * @return This builder for chaining. + */ + public Builder clearRobotVerticalAdjust() { + bitField0_ = (bitField0_ & ~0x00000800); + robotVerticalAdjust_ = 0; + onChanged(); + return this; + } + + private int robotLengthHomework_ ; + /** + *
+       * 自动模式下的作业长度
+       * 
+ * + * int32 Robot_Length_Homework = 13; + * @return The robotLengthHomework. + */ + @java.lang.Override + public int getRobotLengthHomework() { + return robotLengthHomework_; + } + /** + *
+       * 自动模式下的作业长度
+       * 
+ * + * int32 Robot_Length_Homework = 13; + * @param value The robotLengthHomework to set. + * @return This builder for chaining. + */ + public Builder setRobotLengthHomework(int value) { + + robotLengthHomework_ = value; + bitField0_ |= 0x00001000; + onChanged(); + return this; + } + /** + *
+       * 自动模式下的作业长度
+       * 
+ * + * int32 Robot_Length_Homework = 13; + * @return This builder for chaining. + */ + public Builder clearRobotLengthHomework() { + bitField0_ = (bitField0_ & ~0x00001000); + robotLengthHomework_ = 0; + onChanged(); + return this; + } + + private int robotWidthHomework_ ; + /** + *
+       * 自动模式下的作业宽度
+       * 
+ * + * int32 Robot_Width_Homework = 14; + * @return The robotWidthHomework. + */ + @java.lang.Override + public int getRobotWidthHomework() { + return robotWidthHomework_; + } + /** + *
+       * 自动模式下的作业宽度
+       * 
+ * + * int32 Robot_Width_Homework = 14; + * @param value The robotWidthHomework to set. + * @return This builder for chaining. + */ + public Builder setRobotWidthHomework(int value) { + + robotWidthHomework_ = value; + bitField0_ |= 0x00002000; + onChanged(); + return this; + } + /** + *
+       * 自动模式下的作业宽度
+       * 
+ * + * int32 Robot_Width_Homework = 14; + * @return This builder for chaining. + */ + public Builder clearRobotWidthHomework() { + bitField0_ = (bitField0_ & ~0x00002000); + robotWidthHomework_ = 0; + onChanged(); + return this; + } + + private int robotSandBalstEncodeOne_ ; + /** + *
+       * 喷砂机编码1
+       * 
+ * + * int32 Robot_SandBalst_Encode_One = 15; + * @return The robotSandBalstEncodeOne. + */ + @java.lang.Override + public int getRobotSandBalstEncodeOne() { + return robotSandBalstEncodeOne_; + } + /** + *
+       * 喷砂机编码1
+       * 
+ * + * int32 Robot_SandBalst_Encode_One = 15; + * @param value The robotSandBalstEncodeOne to set. + * @return This builder for chaining. + */ + public Builder setRobotSandBalstEncodeOne(int value) { + + robotSandBalstEncodeOne_ = value; + bitField0_ |= 0x00004000; + onChanged(); + return this; + } + /** + *
+       * 喷砂机编码1
+       * 
+ * + * int32 Robot_SandBalst_Encode_One = 15; + * @return This builder for chaining. + */ + public Builder clearRobotSandBalstEncodeOne() { + bitField0_ = (bitField0_ & ~0x00004000); + robotSandBalstEncodeOne_ = 0; + onChanged(); + return this; + } + + private int robotSandBalstEncodeTwo_ ; + /** + *
+       * 喷砂机编码2
+       * 
+ * + * int32 Robot_SandBalst_Encode_Two = 16; + * @return The robotSandBalstEncodeTwo. + */ + @java.lang.Override + public int getRobotSandBalstEncodeTwo() { + return robotSandBalstEncodeTwo_; + } + /** + *
+       * 喷砂机编码2
+       * 
+ * + * int32 Robot_SandBalst_Encode_Two = 16; + * @param value The robotSandBalstEncodeTwo to set. + * @return This builder for chaining. + */ + public Builder setRobotSandBalstEncodeTwo(int value) { + + robotSandBalstEncodeTwo_ = value; + bitField0_ |= 0x00008000; + onChanged(); + return this; + } + /** + *
+       * 喷砂机编码2
+       * 
+ * + * int32 Robot_SandBalst_Encode_Two = 16; + * @return This builder for chaining. + */ + public Builder clearRobotSandBalstEncodeTwo() { + bitField0_ = (bitField0_ & ~0x00008000); + robotSandBalstEncodeTwo_ = 0; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:PV_struct_define) + } + + // @@protoc_insertion_point(class_scope:PV_struct_define) + private static final com.example.swingarmapp_sandblast.models.BspPV.PV_struct_define DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.example.swingarmapp_sandblast.models.BspPV.PV_struct_define(); + } + + public static com.example.swingarmapp_sandblast.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.swingarmapp_sandblast.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\"\377\003\n\020PV_struct_define\022\034\n\024R" + + "obot_Operation_Mode\030\001 \001(\005\022\030\n\020Robot_Move_" + + "Speed\030\002 \001(\005\022\"\n\032Robot_Change_Lane_Distanc" + + "e\030\003 \001(\005\022\031\n\021Robot_Swing_Speed\030\004 \001(\005\022\036\n\026Ro" + + "bot_symmetricalOrNot\030\005 \001(\005\022\037\n\027Robot_Swin" + + "g_Range_Angle\030\006 \001(\005\022\'\n\037Robot_asymmetrica" + + "lAngleSetValue\030\007 \001(\005\022\026\n\016Robot_backMode\030\010" + + " \001(\005\022\033\n\023Robot_Back_Distance\030\t \001(\005\022\030\n\020Rob" + + "ot_Back_Speed\030\n \001(\005\022\027\n\017Robot_Press_Set\030\013" + + " \001(\005\022\035\n\025Robot_Vertical_Adjust\030\014 \001(\005\022\035\n\025R" + + "obot_Length_Homework\030\r \001(\005\022\034\n\024Robot_Widt" + + "h_Homework\030\016 \001(\005\022\"\n\032Robot_SandBalst_Enco" + + "de_One\030\017 \001(\005\022\"\n\032Robot_SandBalst_Encode_T" + + "wo\030\020 \001(\005B,\n(com.example.swingarmapp_sand" + + "blast.modelsP\000b\006proto3" + }; + 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[] { "RobotOperationMode", "RobotMoveSpeed", "RobotChangeLaneDistance", "RobotSwingSpeed", "RobotSymmetricalOrNot", "RobotSwingRangeAngle", "RobotAsymmetricalAngleSetValue", "RobotBackMode", "RobotBackDistance", "RobotBackSpeed", "RobotPressSet", "RobotVerticalAdjust", "RobotLengthHomework", "RobotWidthHomework", "RobotSandBalstEncodeOne", "RobotSandBalstEncodeTwo", }); + descriptor.resolveAllFeaturesImmutable(); + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/swingarmapp_sandblast/app/src/main/java/com/example/swingarmapp_sandblast/models/DisplayIV.java b/swingarmapp_sandblast/app/src/main/java/com/example/swingarmapp_sandblast/models/DisplayIV.java new file mode 100644 index 0000000..69fa3b9 --- /dev/null +++ b/swingarmapp_sandblast/app/src/main/java/com/example/swingarmapp_sandblast/models/DisplayIV.java @@ -0,0 +1,50 @@ +package com.example.swingarmapp_sandblast.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/swingarmapp_sandblast/app/src/main/java/com/example/swingarmapp_sandblast/models/DisplayPV.java b/swingarmapp_sandblast/app/src/main/java/com/example/swingarmapp_sandblast/models/DisplayPV.java new file mode 100644 index 0000000..eddab05 --- /dev/null +++ b/swingarmapp_sandblast/app/src/main/java/com/example/swingarmapp_sandblast/models/DisplayPV.java @@ -0,0 +1,119 @@ +package com.example.swingarmapp_sandblast.models; + +import androidx.databinding.BaseObservable; + +public class DisplayPV extends BaseObservable { + + private int id; + + private int moveSpeed; + private int laneChangeDistance; + private int swingArmSpeed; + private int swingArmAngle; + + private double backDistance; + private double backSpeedValue; + private int pressSet; + + private double verticalAdjust; + + private int workLength; + private int workWidth; + + + + public DisplayPV(int id, int laneChangeDistance, int swingArmSpeed, int swingArmAngle, double backDistance, double backSpeedValue, int pressSet,double verticalAdjust ,int workLength,int workWidth) { + this.id = id; + this.laneChangeDistance=laneChangeDistance; + this.swingArmSpeed = swingArmSpeed; + this.swingArmAngle = swingArmAngle; + this.backDistance = backDistance; + this.backSpeedValue=backSpeedValue; + this.pressSet=pressSet; + this.verticalAdjust=verticalAdjust; + this.workLength=workLength; + this.workWidth=workWidth; + + } + + + public int getId() { return id; } + public void setId(int id) { + this.id = id; + } + + + + +// public int getMoveSpeed() +// { +// return moveSpeed; +// } +// public void setMoveSpeed(int moveSpeed){ this.moveSpeed=moveSpeed;} + + public int getLaneChangeDistance() { + return laneChangeDistance; + } + public void setLaneChangeDistance(int laneChangeDistance) { this.laneChangeDistance = laneChangeDistance;} + + public int getSwingArmSpeed() { + return swingArmSpeed; + } + public void setSwingArmSpeed(int swingArmSpeed) { this.swingArmSpeed = swingArmSpeed;} + + public int getSwingArmAngle() { + return swingArmAngle; + } + public void setSwingArmAngle(int swingArmAngle) { + this.swingArmAngle = swingArmAngle; + } + + + public double getBackDistance() { + return backDistance; + } + public void setBackDistance(int backDistance) { + this.backDistance = backDistance; + } + + public double getBackSpeedValue() { + return backSpeedValue; + } + public void setBackSpeedValue(int backSpeedValue) { + this.backSpeedValue = backSpeedValue; + } + + public int getPressSet() { + return pressSet; + } + public void setPressSet(int pressSet) { + this.pressSet = pressSet; + } + + + public double getVerticalAdjust() { + return verticalAdjust; + } + public void setVerticalAdjust(int verticalAdjust) { + this.verticalAdjust = verticalAdjust; + } + + + + public int getWorkLength() { + return workLength; + } + public void setWorkLength(int workLength) { + this.workLength = workLength; + } + + public int getWorkWidth() { + return workWidth; + } + public void setWorkWidth(int workWidth) { + this.workLength = workWidth; + } + + + +} diff --git a/swingarmapp_sandblast/app/src/main/java/com/example/swingarmapp_sandblast/models/DisplaySandBlast.java b/swingarmapp_sandblast/app/src/main/java/com/example/swingarmapp_sandblast/models/DisplaySandBlast.java new file mode 100644 index 0000000..816158c --- /dev/null +++ b/swingarmapp_sandblast/app/src/main/java/com/example/swingarmapp_sandblast/models/DisplaySandBlast.java @@ -0,0 +1,30 @@ +package com.example.swingarmapp_sandblast.models; + +public class DisplaySandBlast { + private int id; + private int sand_encodeone; + private int sand_encodetwo; + + public DisplaySandBlast(int id , int sandEncodeOne,int sandEncodeTwo){ + + this.id=id; + this.sand_encodeone=sandEncodeOne; + this.sand_encodetwo=sandEncodeTwo; + } + + public int getId() { return id; } + public void setId(int id) { + this.id = id; + } + + public int getsand_encodeone() { return sand_encodeone; } + public void setsand_encodeone(int sandEncodeOne) { + this.sand_encodeone = sandEncodeOne; + } + + public int getsand_encodetwo() { return sand_encodetwo; } + public void setsand_encodetwo(int sand_encodetwo) { + this.sand_encodeone = sand_encodetwo; + } + +} diff --git a/swingarmapp_sandblast/app/src/main/java/com/example/swingarmapp_sandblast/models/ErrorModel.java b/swingarmapp_sandblast/app/src/main/java/com/example/swingarmapp_sandblast/models/ErrorModel.java new file mode 100644 index 0000000..baa51d2 --- /dev/null +++ b/swingarmapp_sandblast/app/src/main/java/com/example/swingarmapp_sandblast/models/ErrorModel.java @@ -0,0 +1,44 @@ +package com.example.swingarmapp_sandblast.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/swingarmapp_sandblast/app/src/main/java/com/example/swingarmapp_sandblast/models/ScrollBottomScrollView.java b/swingarmapp_sandblast/app/src/main/java/com/example/swingarmapp_sandblast/models/ScrollBottomScrollView.java new file mode 100644 index 0000000..fdd0850 --- /dev/null +++ b/swingarmapp_sandblast/app/src/main/java/com/example/swingarmapp_sandblast/models/ScrollBottomScrollView.java @@ -0,0 +1,43 @@ +package com.example.swingarmapp_sandblast.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/swingarmapp_sandblast/app/src/main/java/com/example/swingarmapp_sandblast/services/ConvertHelper.java b/swingarmapp_sandblast/app/src/main/java/com/example/swingarmapp_sandblast/services/ConvertHelper.java new file mode 100644 index 0000000..0f911d4 --- /dev/null +++ b/swingarmapp_sandblast/app/src/main/java/com/example/swingarmapp_sandblast/services/ConvertHelper.java @@ -0,0 +1,26 @@ +package com.example.swingarmapp_sandblast.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/swingarmapp_sandblast/app/src/main/java/com/example/swingarmapp_sandblast/services/CustomProber.java b/swingarmapp_sandblast/app/src/main/java/com/example/swingarmapp_sandblast/services/CustomProber.java new file mode 100644 index 0000000..c817235 --- /dev/null +++ b/swingarmapp_sandblast/app/src/main/java/com/example/swingarmapp_sandblast/services/CustomProber.java @@ -0,0 +1,22 @@ +package com.example.swingarmapp_sandblast.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/swingarmapp_sandblast/app/src/main/java/com/example/swingarmapp_sandblast/services/DecimalDigitsInputFilter.java b/swingarmapp_sandblast/app/src/main/java/com/example/swingarmapp_sandblast/services/DecimalDigitsInputFilter.java new file mode 100644 index 0000000..8d64171 --- /dev/null +++ b/swingarmapp_sandblast/app/src/main/java/com/example/swingarmapp_sandblast/services/DecimalDigitsInputFilter.java @@ -0,0 +1,71 @@ +package com.example.swingarmapp_sandblast.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/swingarmapp_sandblast/app/src/main/java/com/example/swingarmapp_sandblast/services/ErrorDeocdeHelper.java b/swingarmapp_sandblast/app/src/main/java/com/example/swingarmapp_sandblast/services/ErrorDeocdeHelper.java new file mode 100644 index 0000000..f4a17f7 --- /dev/null +++ b/swingarmapp_sandblast/app/src/main/java/com/example/swingarmapp_sandblast/services/ErrorDeocdeHelper.java @@ -0,0 +1,78 @@ +package com.example.swingarmapp_sandblast.services; + +import com.example.swingarmapp_sandblast.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 (Map.Entry entry : flagMap.entrySet()) { +// String key = entry.getKey(); +// int bitPosiiton = entry.getValue(); +// +// // 使用左移操作生成要检查的标志位 +// int bitToCheck = 1 << bitPosiiton; +// +// // 判断该位置是否有对应的标志位 +// if ((data & bitToCheck) != 0) +// { +// ErrorResult+=key+":\t 错误! "; +// } else +// { +// +// } +// } + +// + 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 = " "; + + // 使用左移操作生成要检查的标志位 + int bitToCheck = 1 << bitPosiiton; + +// // 判断该位置是否有对应的标志位 +// if ((data & bitToCheck) != 0) +// { +// +// ErrorResult+=err.toString()+addErrorResult+"\t"; +// } else +// { +// +// } + + + // 判断该位置是否有对应的标志位 + if ((data & bitToCheck) != 0) { + + // ErrorResult += String.valueOf(bitPosiiton); + + if (err.toString().equals("MK32_InitialState")) { + ErrorResult = "未复位"; + } +// else +// { +// ErrorResult += err.toString()+addErrorResult+"\t"; +// } + } + } + return ErrorResult; + } + +} diff --git a/swingarmapp_sandblast/app/src/main/java/com/example/swingarmapp_sandblast/services/LogUtil.java b/swingarmapp_sandblast/app/src/main/java/com/example/swingarmapp_sandblast/services/LogUtil.java new file mode 100644 index 0000000..a9e219b --- /dev/null +++ b/swingarmapp_sandblast/app/src/main/java/com/example/swingarmapp_sandblast/services/LogUtil.java @@ -0,0 +1,39 @@ +package com.example.swingarmapp_sandblast.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/swingarmapp_sandblast/app/src/main/java/com/example/swingarmapp_sandblast/services/ModbusCRC.java b/swingarmapp_sandblast/app/src/main/java/com/example/swingarmapp_sandblast/services/ModbusCRC.java new file mode 100644 index 0000000..586e77a --- /dev/null +++ b/swingarmapp_sandblast/app/src/main/java/com/example/swingarmapp_sandblast/services/ModbusCRC.java @@ -0,0 +1,72 @@ +package com.example.swingarmapp_sandblast.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/swingarmapp_sandblast/app/src/main/java/com/example/swingarmapp_sandblast/services/MyDataHelper.java b/swingarmapp_sandblast/app/src/main/java/com/example/swingarmapp_sandblast/services/MyDataHelper.java new file mode 100644 index 0000000..45a8407 --- /dev/null +++ b/swingarmapp_sandblast/app/src/main/java/com/example/swingarmapp_sandblast/services/MyDataHelper.java @@ -0,0 +1,304 @@ +package com.example.swingarmapp_sandblast.services; + +import android.content.ContentValues; +import android.content.Context; +import android.database.Cursor; +import android.database.SQLException; +import android.database.sqlite.SQLiteDatabase;//具体进行数据库、数据表的一个操作 +import android.database.sqlite.SQLiteOpenHelper;//用来创建数据库和对数据库进行版本管理 +import android.util.Log; + +import androidx.annotation.Nullable; + +import com.example.swingarmapp_sandblast.models.DisplayPV; +import com.example.swingarmapp_sandblast.models.DisplaySandBlast; +import com.example.swingarmapp_sandblast.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_LANE_CHANGE_DISTANCE = "laneChangeDistance";//换道距离 + public static final String COLUMN_SWING_ARM_SPEED = "swingArmSpeed";//Maintv_swingArmSpeedTo32摆臂速度 + public static final String COLUMN_SWING_ARM_ANGLE = "swingArmAngle";//Maintv_swingArmAngleTo32摆臂角度 + + public static final String COLUMN_BACK_DISTANCE = "backDistance";//Maintv_BackDistanceTo32后退距离 + public static final String COLUMN_BACK_SPEED = "backSpeed";//Maintv_BackSpeedTo32后退速度 + + public static final String COLUMN_PRESS_SET = "pressSet";//Maintv_PressTo32 压力设定 + public static final String COLUMN_VERTICAL_ADJUST = "verticalAdjust";//Maintv_VerticalAdjustTo32 竖直微调 + public static final String COLUMN_WORK_LENGTH = "workLength";//Maintv_WorkLenthTo32作业长度 + public static final String COLUMN_WORK_WIDTH = "workWidth";//Maintv_WorkWidthTo32作业宽度 + + + public static final String Error_TABLE_NAME = "error"; + public static final String Error_COLUMN_TimeStamp = "timeID"; + + public static final String Error_COLUMN_ERROR_INFO = "errorInfo"; + + /*****************************************/ + public static final String SAND_TABLE_NAME = "sandblast"; + public static final String SAND_COLUMN_ENCODEONE = "encode1"; + + public static final String SAND_COLUMN_ENCODETWO = "encode2"; + + + + public MyDataHelper(@Nullable Context context) { + super(context, "bingbot.db", null, 6); //数据库名称为 bingbot.db,数据库版本为 1。存放两个表 + } + + @Override + public void onCreate(SQLiteDatabase db) { + + + //INTEGER前加空格 + String sql = "CREATE TABLE " + TABLE_NAME + " (" + + COLUMN_ID + " INTEGER PRIMARY KEY AUTOINCREMENT, " + + COLUMN_PRESS_SET + " INTEGER, " + + COLUMN_VERTICAL_ADJUST + " DOUBLE, " + + COLUMN_SWING_ARM_ANGLE + " INTEGER, " + + COLUMN_SWING_ARM_SPEED + " INTEGER, " + + COLUMN_BACK_DISTANCE + " DOUBLE, " + + COLUMN_LANE_CHANGE_DISTANCE + " INTEGER, " + + COLUMN_WORK_LENGTH + " INTEGER, " + + COLUMN_WORK_WIDTH + " INTEGER, " + + COLUMN_BACK_SPEED + " DOUBLE);"; + + db.execSQL(sql); //执行sql语句 + // Log.d("DB_DEBUG", "表创建成功,列名包含: moveSpeed"); + sql = "CREATE TABLE " + Error_TABLE_NAME + "(" + Error_COLUMN_TimeStamp + " INTEGER PRIMARY KEY ," + + Error_COLUMN_ERROR_INFO + " STRING " + ")"; + + db.execSQL(sql); //创建错误表 + + /*******创建喷砂机编码表*********/ + sql = "CREATE TABLE " + SAND_TABLE_NAME + "(" + COLUMN_ID + " INTEGER PRIMARY KEY ,"+ SAND_COLUMN_ENCODEONE + " INTEGER, " + + SAND_COLUMN_ENCODETWO + " INTEGER " + ")"; + + 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_BACK_SPEED, pv.getBackSpeedValue()); + cv.put(COLUMN_LANE_CHANGE_DISTANCE, pv.getLaneChangeDistance()); + cv.put(COLUMN_SWING_ARM_SPEED, pv.getSwingArmSpeed()); + cv.put(COLUMN_SWING_ARM_ANGLE, pv.getSwingArmAngle()); + cv.put(COLUMN_BACK_DISTANCE, pv.getBackDistance()); + cv.put(COLUMN_PRESS_SET, pv.getPressSet()); + cv.put(COLUMN_VERTICAL_ADJUST, pv.getVerticalAdjust()); + cv.put(COLUMN_WORK_LENGTH, pv.getWorkLength()); + cv.put(COLUMN_WORK_WIDTH, pv.getWorkWidth()); + + + SQLiteDatabase sqliteDatabase = this.getWritableDatabase();//获取数据库实例以实现增上查改等,如果没有就新建 并把sqliteDatabase作为参数传给oncreate方法 + long insert = sqliteDatabase.insertWithOnConflict(TABLE_NAME, null, cv, SQLiteDatabase.CONFLICT_REPLACE); + sqliteDatabase.close(); + if (insert == -1) { + return "failed"; + } + return "success"; + } + + public String addOrUpdateDisplayData_SandBlast(DisplaySandBlast dsb) { + ContentValues cv = new ContentValues(); //键值对的类 + cv.put(COLUMN_ID, 1); + cv.put(SAND_COLUMN_ENCODEONE, dsb.getsand_encodeone()); + cv.put(SAND_COLUMN_ENCODETWO, dsb.getsand_encodetwo()); + + SQLiteDatabase sqliteDatabase = this.getWritableDatabase();//获取数据库实例以实现增上查改等,如果没有就新建 并把sqliteDatabase作为参数传给oncreate方法 + long insert = sqliteDatabase.insertWithOnConflict(SAND_TABLE_NAME, null, cv, SQLiteDatabase.CONFLICT_REPLACE); + sqliteDatabase.close(); + if (insert == -1) { + return "failed"; + } + return "success"; + } + public List getDisplayData_sandBalst() { //初始化 + + List list = new ArrayList<>(); + String sql = "SELECT * FROM " + SAND_TABLE_NAME + " WHERE " + COLUMN_ID + " = " + String.valueOf(1); + SQLiteDatabase sqLiteDatabase = this.getWritableDatabase();//获取可写数据库实例 + + + Cursor cursor = sqLiteDatabase.rawQuery(sql, null); //按id查询 + + int idIndex = cursor.getColumnIndex(COLUMN_ID); + int _sandEncodeOneIndex = cursor.getColumnIndex(SAND_COLUMN_ENCODEONE); + int _sandEncodeTwoIndex = cursor.getColumnIndex(SAND_COLUMN_ENCODETWO); + + + while (cursor.moveToNext()) { + + DisplaySandBlast dsb = new DisplaySandBlast(cursor.getInt(idIndex), cursor.getInt(_sandEncodeOneIndex), + cursor.getInt(_sandEncodeTwoIndex) + ); + + list.add(dsb); + } + cursor.close(); + sqLiteDatabase.close(); + return list; + + } + 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.size() == 0) { + DisplayPV pv = new DisplayPV(i, 0, 0, 0, 0, 0, 0,0, 0, 0); + addOrUpdateDisplayData(pv);//一行一行添加 + } + } + List list_dsb = getDisplayData_sandBalst(); //从数据库中读 + if (list_dsb.size() == 0) { + DisplaySandBlast dsb = new DisplaySandBlast(1, 0, 0); + addOrUpdateDisplayData_SandBlast(dsb);//一行一行添加 + } + } + + + 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); //按id查询 + + int idIndex = cursor.getColumnIndex(COLUMN_ID); + int _laneChangeDistanceIndex = cursor.getColumnIndex(COLUMN_LANE_CHANGE_DISTANCE); + int _swingArmSpeedIndex = cursor.getColumnIndex(COLUMN_SWING_ARM_SPEED); + int _swingArmAngleIndex = cursor.getColumnIndex(COLUMN_SWING_ARM_ANGLE); + int _backDistanceIndex = cursor.getColumnIndex(COLUMN_BACK_DISTANCE); + int _backSpeedValue= cursor.getColumnIndex(COLUMN_BACK_SPEED); + int _pressSetIndex = cursor.getColumnIndex(COLUMN_PRESS_SET); + int _verticalAdjustIndex = cursor.getColumnIndex(COLUMN_VERTICAL_ADJUST); + int _workLengthIndex = cursor.getColumnIndex(COLUMN_WORK_LENGTH); + int _workWidthIndex = cursor.getColumnIndex(COLUMN_WORK_WIDTH); + + while (cursor.moveToNext()) { + + DisplayPV pv = new DisplayPV(cursor.getInt(idIndex), cursor.getInt(_laneChangeDistanceIndex), + cursor.getInt(_swingArmSpeedIndex), cursor.getInt(_swingArmAngleIndex), cursor.getInt(_backDistanceIndex),cursor.getInt(_backSpeedValue), cursor.getInt(_pressSetIndex), + cursor.getInt(_verticalAdjustIndex), cursor.getInt(_workLengthIndex), cursor.getInt(_workWidthIndex) + ); + + list.add(pv); + } + cursor.close(); + sqLiteDatabase.close(); + return list; + + } + + + public String AddOrUpdateErrorModel(ErrorModel em) { + ContentValues cv = new ContentValues(); + cv.put(Error_COLUMN_TimeStamp, 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); + if (insert == -1) { + // 插入失败,按时间戳删除最早的100行 + try { + // 开始事务 + sqliteDatabase.beginTransaction(); + + String deleteQuery = "DELETE FROM error WHERE timeID IN (SELECT timeID FROM error ORDER BY timeID ASC LIMIT 100)"; + sqliteDatabase.execSQL(deleteQuery); + // 标记事务成功 + sqliteDatabase.setTransactionSuccessful(); + + Log.d("DB_OPERATION", "插入失败,已按时间戳删除最早的100行数据"); + } catch (SQLException e) { + Log.e("DB_ERROR", "删除时发生错误: " + e.getMessage()); + } finally { + // 结束事务(若setTransactionSuccessful()被调用则提交,否则回滚) + sqliteDatabase.endTransaction(); + } + sqliteDatabase.close(); + return "failed"; + } + sqliteDatabase.close(); + return "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_TimeStamp); + + 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/swingarmapp_sandblast/app/src/main/java/com/example/swingarmapp_sandblast/services/PopupHelper.java b/swingarmapp_sandblast/app/src/main/java/com/example/swingarmapp_sandblast/services/PopupHelper.java new file mode 100644 index 0000000..c3b8e9e --- /dev/null +++ b/swingarmapp_sandblast/app/src/main/java/com/example/swingarmapp_sandblast/services/PopupHelper.java @@ -0,0 +1,754 @@ +package com.example.swingarmapp_sandblast.services; + +import android.app.Dialog; +import android.content.Context; +import android.graphics.Color; +import android.text.InputFilter; +import android.text.method.ScrollingMovementMethod; +import android.view.MotionEvent; +import android.view.View; +import android.view.inputmethod.InputMethodManager; +import android.widget.Button; +import android.widget.EditText; +import android.widget.LinearLayout; +import android.widget.RadioButton; +import android.widget.RadioGroup; +import android.widget.ScrollView; +import android.widget.TextView; +import android.widget.Toast; + +import androidx.core.content.ContextCompat; + +import com.example.swingarmapp_sandblast.models.ErrorModel; +import com.example.swingarmapp_sandblast.models.ScrollBottomScrollView; +import com.example.swingarmapp_sandblast.MainActivity; +import com.example.swingarmapp_sandblast.R; +import com.example.swingarmapp_sandblast.models.DisplayPV; + +import java.util.List; + +public class PopupHelper { + + private MainActivity mainActivity; + private LinearLayout inputContainer, buttonsContainer; + private EditText inputEditText; + private Button buttonA, buttonB; + private TextView statusText; + + + String result="1"; + private EditText firstEditText; + private EditText secondEditText; + + public PopupHelper(MainActivity mainActivity) + { + this.mainActivity = mainActivity; + + } + + + //手动模式弹窗 + public void ManualModePopup(View.OnClickListener context) { //手动模式弹窗 + Dialog dialog = new Dialog(mainActivity); + + dialog.setContentView(R.layout.manualmodepopup); // 设置自定义布局 + dialog.setCancelable(true); // 设置点击外部是否关闭弹窗 + + // 获取布局中的视图 + Button cancelButton = dialog.findViewById(R.id.manualModeCancel); + Button confirmButton = dialog.findViewById(R.id.manualModeApply); + + //获取按钮组 + RadioGroup radioGroup = (RadioGroup) dialog.findViewById(R.id.manualModeSelectorGroup); + + //4种模式 + radioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(RadioGroup group, int checkedId) { + RadioButton radioButton = (RadioButton) group.findViewById(checkedId); + if (radioButton != null) + { + mainActivity._Manual_Mode_Call_Value = radioButton.getText().toString(); + } + } + }); + + //下次进来保证是选中状态或者未远中 + String ii= mainActivity.mainBinding.manualModeDisplay.getText().toString(); + 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; + } + default: + + radioGroup.clearCheck(); + break; + + } + + + // 设置确定按钮点击事件 + confirmButton.setOnClickListener(v -> { //手动模式弹窗确认 + if (radioGroup.getCheckedRadioButtonId() != -1) { //有按钮选中时按确定 更新值 + mainActivity.mainBinding.manualModeDisplay.setText(mainActivity._Manual_Mode_Call_Value); + + mainActivity._Auto_Mode_Call_Value="未启用"; + mainActivity.mainBinding.autoModeDisplay.setText("未启用"); + //读取数据库,并对其他控件进行赋值 + Toast.makeText(mainActivity, "设置成功", Toast.LENGTH_SHORT).show(); + } + + + dialog.dismiss(); // 关闭弹窗 + }); + + // 设置取消按钮点击事件 + cancelButton.setOnClickListener(v -> { + Toast.makeText(mainActivity, "点击了取消", Toast.LENGTH_SHORT).show(); + + dialog.dismiss(); // 关闭弹窗 + }); + dialog.show(); // 显示弹窗 + + } + //自动模式弹窗 + public void AutoModePopup(View.OnClickListener context) { + Dialog dialog = new Dialog(mainActivity); + + dialog.setContentView(R.layout.automodepopup); // 设置自定义布局 + dialog.setCancelable(true); // 设置点击外部是否关闭弹窗 + + // 获取布局中的视图 + Button cancelButton = dialog.findViewById(R.id.autoModeCancel); + Button confirmButton = dialog.findViewById(R.id.autoModeApply); + EditText workLength_Edit=dialog.findViewById(R.id.worklength_input); + EditText workWidth_Edit=dialog.findViewById(R.id.workwidth_input); + + workLength_Edit.setText(mainActivity.workLength); + workWidth_Edit.setText(mainActivity.workWidth); + RadioGroup radioGroup = (RadioGroup) dialog.findViewById(R.id.autoModeSelectorGroup); + + //2种模式 + radioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(RadioGroup group, int checkedId) { + RadioButton radioButton = (RadioButton) group.findViewById(checkedId); + if(radioButton!=null){ + mainActivity._Auto_Mode_Call_Value = radioButton.getText().toString(); + } + + } + }); + + String ii= mainActivity.mainBinding.autoModeDisplay.getText().toString(); + switch (ii) + { + + case "水平": { radioGroup.check(R.id.rb_five); + break; + } + case "平面": { radioGroup.check(R.id.rb_six); + break; + } + default: + radioGroup.clearCheck();//清除选中 + break; + + } + + + // 设置确定按钮点击事件 + confirmButton.setOnClickListener(v -> { + + if (radioGroup.getCheckedRadioButtonId() != -1) { //有按钮选中时按确定 更新值 + mainActivity.mainBinding.autoModeDisplay.setText(mainActivity._Auto_Mode_Call_Value); + //失能手动模式 + mainActivity._Manual_Mode_Call_Value="未启用"; + mainActivity.mainBinding.manualModeDisplay.setText("未启用"); + + Toast.makeText(mainActivity, "设置成功", Toast.LENGTH_SHORT).show(); + } + + //检查作业宽度 长度 范围 + int value1=0; int value2=0; + try { + value1=Integer.parseInt(String.valueOf(workLength_Edit.getText())); + value2=Integer.parseInt(String.valueOf(workWidth_Edit.getText())); + } + catch(Exception e) + { + Toast.makeText(mainActivity, "输入不能为空", Toast.LENGTH_SHORT).show(); + return; + } + + if(value1>=0 && value1<=50) + { + mainActivity.workLength=String.valueOf(value1); + + }else{ + Toast.makeText(mainActivity, "请输入0-50的数字", Toast.LENGTH_SHORT).show(); + workLength_Edit.setText("0"); + return; + } + if(value2>=0 && value2<=50) + { + mainActivity.workWidth=String.valueOf(value2); + + }else{ + Toast.makeText(mainActivity, "请输入0-50的数字", Toast.LENGTH_SHORT).show(); + workWidth_Edit.setText("0"); + return; + } + + dialog.dismiss(); // 关闭弹窗 + }); + + + + // 设置取消按钮点击事件 + cancelButton.setOnClickListener(v -> { + Toast.makeText(mainActivity, "点击了取消", Toast.LENGTH_SHORT).show(); + + dialog.dismiss(); // 关闭弹窗 + }); + dialog.show(); // 显示弹窗 + + } + + public void SwingArmPopup() { + Dialog dialog = new Dialog(mainActivity); + dialog.setContentView(R.layout.swingarmanglepopup); + dialog.setCancelable(true); + // 初始化控件 + LinearLayout inputContainer = dialog.findViewById(R.id.inputContainer);//对称 + LinearLayout buttonContainer = dialog.findViewById(R.id.buttonContainer);//非对称 + EditText editAngle = dialog.findViewById(R.id.EditAngleTo32); + RadioGroup radioGroup = dialog.findViewById(R.id.radioGroup); + RadioButton btn_left = dialog.findViewById(R.id.btn_left); + RadioButton btn_right = dialog.findViewById(R.id.btn_right); + + Button confirmBtn=dialog.findViewById(R.id.swingArmAngleApply); + Button cancleBtn=dialog.findViewById(R.id.swingArmAngleCancel); + + + //主界面值传过来 + editAngle.setText( mainActivity.mainBinding.MaintvSwingArmAngleTo32.getText()); + // 设置对称点击事件 + inputContainer.setOnClickListener(v -> { + mainActivity.symmetricalOrNot=1;// 1对称 2非对称 + + if (!mainActivity.isInputGroupActive) { + mainActivity.isInputGroupActive = true; + updateUIState(editAngle, radioGroup, inputContainer, buttonContainer); + } + }); + + // 设置非对称点击事件 + buttonContainer.setOnClickListener(v -> { + mainActivity.symmetricalOrNot=2; + if (mainActivity.isInputGroupActive) { + mainActivity.isInputGroupActive = false; + updateUIState(editAngle, radioGroup, buttonContainer, inputContainer); + } + }); + + //长按 和松手事件 + btn_left.setOnTouchListener(new View.OnTouchListener() { + @Override + public boolean onTouch(View view, MotionEvent motionEvent) { + switch (motionEvent.getAction()) { + case MotionEvent.ACTION_DOWN: + // 按下时设置为蓝色 + view.setBackgroundColor(ContextCompat.getColor(mainActivity, R.color.blue_green)); + + // 按钮按下事件 + view.setAlpha(0.7f); // 按下时降低透明度,提供视觉反馈 + mainActivity.asymmetricalAngleSetValue=1; + return true; + + case MotionEvent.ACTION_UP: + case MotionEvent.ACTION_CANCEL: + // 松开或取消时设置为灰色 + view.setBackgroundColor(ContextCompat.getColor(mainActivity, R.color.gray)); + view.setBackgroundColor(Color.TRANSPARENT); + // 按钮松开或取消事件 + view.setAlpha(1.0f); // 恢复透明度 + mainActivity.asymmetricalAngleSetValue=0; + return true; + } + + return true; + } + }); + + btn_right.setOnTouchListener(new View.OnTouchListener() { + @Override + public boolean onTouch(View view, MotionEvent motionEvent) { + switch (motionEvent.getAction()) { + case MotionEvent.ACTION_DOWN: + // 按下时设置为蓝色 + view.setBackgroundColor(ContextCompat.getColor(mainActivity, R.color.blue_green)); + + // 按钮按下事件 + view.setAlpha(0.7f); // 按下时降低透明度,提供视觉反馈 + mainActivity.asymmetricalAngleSetValue=2; + return true; + + case MotionEvent.ACTION_UP: + case MotionEvent.ACTION_CANCEL: + // 松开或取消时设置为灰色 + view.setBackgroundColor(ContextCompat.getColor(mainActivity, R.color.gray)); + view.setBackgroundColor(Color.TRANSPARENT); + // 按钮松开或取消事件 + view.setAlpha(1.0f); // 恢复透明度 + mainActivity.asymmetricalAngleSetValue=0; + return true; + } + + return true; + + } + }); + + + confirmBtn.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + //检查对称角度输入范围 + String swingArmAngle_Edit=editAngle.getText().toString(); + if(swingArmAngle_Edit.equals("")) + { + Toast.makeText(mainActivity, "左侧角度输入不应为空", Toast.LENGTH_SHORT).show(); + return; + } + int _tempValue = Integer.parseInt(swingArmAngle_Edit); + if (_tempValue <= 150 && _tempValue > 0) + { + mainActivity.mainBinding.MaintvSwingArmAngleTo32.setText(swingArmAngle_Edit); + Toast.makeText(mainActivity, "左侧角度设置成功"+_tempValue, Toast.LENGTH_SHORT).show(); + } else + { + Toast.makeText(mainActivity, "左侧输入数据不应大于150或者小于=0", Toast.LENGTH_SHORT).show(); + editAngle.setText("0"); + return; + } + /**************************************/ + dialog.dismiss(); + + } + }); + cancleBtn.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + + dialog.dismiss(); + } + }); + + + // 初始状态设置 + if(mainActivity.isInputGroupActive) + { + updateUIState(editAngle, radioGroup, inputContainer, buttonContainer); + } + else { + updateUIState(editAngle, radioGroup, buttonContainer, inputContainer); + } + + + dialog.show(); + } + public void BackSetPopup() { + Dialog dialog = new Dialog(mainActivity); + dialog.setContentView(R.layout.backsetpopup); + dialog.setCancelable(true); + + // 初始化控件 + LinearLayout firstInputContainer = dialog.findViewById(R.id.firstInputContainer); + LinearLayout secondInputContainer = dialog.findViewById(R.id.secondInputContainer); + firstEditText = dialog.findViewById(R.id.firstEditText); + secondEditText = dialog.findViewById(R.id.secondEditText); + Button confirmButton= dialog.findViewById(R.id.backDistanceApply); + Button cancleButton= dialog.findViewById(R.id.backDistanceCancel); + firstEditText.setFilters(new InputFilter[]{new DecimalDigitsInputFilter()}); //editext 一位小数限制 + secondEditText.setFilters(new InputFilter[]{new DecimalDigitsInputFilter()}); //editext 一位小数限制 + //界面值传过来 + firstEditText.setText(mainActivity.mainBinding.MaintvBackDistanceTo32.getText()); + secondEditText.setText(mainActivity.backSpeedSetValue); + // 设置第一个打退交替点击事件 + firstInputContainer.setOnClickListener(v -> { + mainActivity.backMode=1; + if (! mainActivity.isFirstInputActive) { + mainActivity.isFirstInputActive = true; + updateUIState2(firstEditText, secondEditText, + firstInputContainer, secondInputContainer); + } + }); + + // 设置边打边退点击事件 + secondInputContainer.setOnClickListener(v -> { + mainActivity.backMode=2; + if ( mainActivity.isFirstInputActive) { + mainActivity.isFirstInputActive = false; + updateUIState2(secondEditText, firstEditText, + secondInputContainer, firstInputContainer); + } + }); + + + //确定按钮点击事件 + confirmButton.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + //检查后退距离输入范围 + String backDistance_Edit= firstEditText.getText().toString(); + if(backDistance_Edit.equals("")) + { + Toast.makeText(mainActivity, "左侧输入不应为空", Toast.LENGTH_SHORT).show(); + //dialog.dismiss(); // 关闭弹窗 + return; + } + double _tempValue = Double.parseDouble(backDistance_Edit); + + if (_tempValue <= 100 && _tempValue >= 0) + { + mainActivity.mainBinding.MaintvBackDistanceTo32.setText(String.valueOf(_tempValue)); + Toast.makeText(mainActivity, "左侧设置成功", Toast.LENGTH_SHORT).show(); + } else { + Toast.makeText(mainActivity, "左侧输入数据不应大于100或者小于=0", Toast.LENGTH_SHORT).show(); + firstEditText.setText("0.1"); + return; + } + /**************************************/ + //检查后退速度输入范围 + String backDistance_Edit1= secondEditText.getText().toString(); + if(backDistance_Edit1.equals("")) + { + Toast.makeText(mainActivity, "右侧输入不应为空", Toast.LENGTH_SHORT).show(); + return; + } + double _tempValue1 = Double.parseDouble(backDistance_Edit1); + if (_tempValue1 <= 20 && _tempValue1 >= 0) + { + mainActivity.backSpeedSetValue=String.valueOf(_tempValue1) ; + Toast.makeText(mainActivity, "右侧设置成功", Toast.LENGTH_SHORT).show(); + } else { + Toast.makeText(mainActivity, "右侧输入数据不应大于20或者小于=0", Toast.LENGTH_SHORT).show(); + secondEditText.setText(""); + return; + } + Toast.makeText(mainActivity, "设置成功", Toast.LENGTH_SHORT).show(); + dialog.dismiss(); // 关闭弹窗 + } + }); + + //取消按钮点击事件 + cancleButton.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + + dialog.dismiss(); + } + }); + // 初始状态设置 确定再次进入 按钮保持选中状态 + if(mainActivity.isFirstInputActive) + { + updateUIState2(firstEditText, secondEditText, + firstInputContainer, secondInputContainer); + + } + else { + updateUIState2(secondEditText, firstEditText, + secondInputContainer, firstInputContainer); + + } + + dialog.show(); + + + } + + public void ParametersCallPopup(View.OnClickListener context,MyDataHelper myDataHelper ) { + Dialog dialog = new Dialog(mainActivity); + dialog.setContentView(R.layout.parameters_call); // 设置自定义布局 + dialog.setCancelable(true); // 设置点击外部是否关闭弹窗 + + // 获取布局中的视图 + Button exitButton = dialog.findViewById(R.id.parametersExit); + Button confirmButton = dialog.findViewById(R.id.parametersApply); + Button saveButton=dialog.findViewById(R.id.parametersSavebtn); + Button clearButton=dialog.findViewById(R.id.parametersClearBtn); + RadioGroup radioGroup = (RadioGroup) dialog.findViewById(R.id.parameters_call_group); + + + Integer ii= ConvertHelper.convertEditTextToInt(mainActivity.mainBinding.MaintvParameterCallTo32); + + switch (ii) + { + case 1: { radioGroup.check(R.id.rb_one); + break; + } + case 2: { radioGroup.check(R.id.rb_two); + break; + } + case 3: { radioGroup.check(R.id.rb_three); + break; + } + case 4: { radioGroup.check(R.id.rb_four); + break; + } + case 5: { radioGroup.check(R.id.rb_five); + break; + } + } + + dialog.show(); // 显示弹窗 + //调用值更新 + radioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(RadioGroup group, int checkedId) { + RadioButton radioButton = (RadioButton) group.findViewById(checkedId); + result = radioButton.getText().toString(); + // mainActivity._parameters_Call_Value = result; + } + }); + //保存按钮 获取界面参数 存入数据库 + saveButton.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + //获取界面参数以写进数据库 + int paraIndex = Integer.parseInt(mainActivity.mainBinding.MaintvParameterCallTo32.getText().toString()); + int laneChangeDistance = Integer.parseInt(mainActivity.mainBinding.MaintvLaneChangeDistanceTo32.getText().toString()); + int swingArmSpeed = Integer.parseInt(mainActivity.mainBinding.MaintvSwingArmSpeedTo32.getText().toString()); + int swingArmAngle = Integer.parseInt(mainActivity.mainBinding.MaintvSwingArmAngleTo32.getText().toString()); + double backDistance = Double.parseDouble(mainActivity.mainBinding.MaintvBackDistanceTo32.getText().toString()); + double backSpeed = Double.parseDouble(mainActivity.backSpeedSetValue); + int pressSet = Integer.parseInt(mainActivity.mainBinding.MaintvPressTo32.getText().toString()); + double verticalAdjust = Double.parseDouble(mainActivity.mainBinding.MaintvVerticalAdjustTo32.getText().toString()); + int workLength = Integer.parseInt(mainActivity.workLength); + int workWidth = Integer.parseInt(mainActivity.workWidth); + + //把界面中的值放进PV类的变量中 + DisplayPV displayPV = new DisplayPV(paraIndex, laneChangeDistance,swingArmSpeed,swingArmAngle, backDistance,backSpeed,pressSet, verticalAdjust, workLength,workWidth ); + myDataHelper.addOrUpdateDisplayData(displayPV); //创建数据库的实例在这里 PV传进去保存到数据库 + Toast.makeText(dialog.getContext(), "保存成功", Toast.LENGTH_SHORT).show(); + } + }); + + //清除按钮 界面显示设为默认值 并存入数据库 + clearButton.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + mainActivity.mainBinding.MaintvLaneChangeDistanceTo32.setText(String.valueOf(1)); + mainActivity.mainBinding.MaintvSwingArmSpeedTo32.setText(String.valueOf(1)); + mainActivity.mainBinding.MaintvSwingArmAngleTo32.setText(String.valueOf(1)); + mainActivity.mainBinding.MaintvBackDistanceTo32.setText(String.valueOf(1)); + mainActivity.backSpeedSetValue=String.valueOf(1.0); + mainActivity.mainBinding.MaintvPressTo32.setText(String.valueOf(1)); + mainActivity.mainBinding.MaintvVerticalAdjustTo32.setText(String.valueOf(1)); + mainActivity.workLength=String.valueOf(1); + mainActivity.workWidth=String.valueOf(1); + //获取界面参数以写进数据库 + int paraIndex = Integer.parseInt(mainActivity.mainBinding.MaintvParameterCallTo32.getText().toString()); + int laneChangeDistance = Integer.parseInt(mainActivity.mainBinding.MaintvLaneChangeDistanceTo32.getText().toString()); + int swingArmSpeed = Integer.parseInt(mainActivity.mainBinding.MaintvSwingArmSpeedTo32.getText().toString()); + int swingArmAngle = Integer.parseInt(mainActivity.mainBinding.MaintvSwingArmAngleTo32.getText().toString()); + double backDistance = Double.parseDouble(mainActivity.mainBinding.MaintvBackDistanceTo32.getText().toString()); + double backSpeed =Double.parseDouble(mainActivity.backSpeedSetValue); + int pressSet =Integer.parseInt(mainActivity.mainBinding.MaintvPressTo32.getText().toString()); + double verticalAdjust =Double.parseDouble(mainActivity.mainBinding.MaintvVerticalAdjustTo32.getText().toString()); + int workLength = Integer.parseInt(mainActivity.workLength); + int workWidth = Integer.parseInt(mainActivity.workWidth); + //把界面中的值放进PV类的变量中 + DisplayPV displayPV = new DisplayPV(paraIndex, laneChangeDistance,swingArmSpeed,swingArmAngle, backDistance,backSpeed, pressSet, verticalAdjust, workLength,workWidth ); + myDataHelper.addOrUpdateDisplayData(displayPV); //创建数据库的实例在这里 PV传进去保存到数据库 + Toast.makeText(dialog.getContext(), "清除成功", Toast.LENGTH_SHORT).show(); + } + }); + + // 使用按钮 点击事件 //把主界面 调用值显示 改了 并从数据库中读赋值给界面 + confirmButton.setOnClickListener(v -> { + mainActivity._parameters_Call_Value = result; + mainActivity.mainBinding.MaintvParameterCallTo32.setText(mainActivity._parameters_Call_Value);//把主界面 调用值显示 改了 + + //读取数据 + int paraIndex = Integer.parseInt(mainActivity._parameters_Call_Value); + List pvList = mainActivity.myDataHelper.getDisplayData(paraIndex);//从数据库中读,,并对其他控件进行赋值 + mainActivity.backSpeedSetValue=String.valueOf(pvList.get(0).getBackSpeedValue()); + mainActivity.mainBinding.MaintvLaneChangeDistanceTo32.setText(String.valueOf(pvList.get(0).getLaneChangeDistance())); + mainActivity.mainBinding.MaintvSwingArmSpeedTo32.setText(String.valueOf(pvList.get(0).getSwingArmSpeed())); + mainActivity.mainBinding.MaintvSwingArmAngleTo32.setText(String.valueOf(pvList.get(0).getSwingArmAngle())); + mainActivity.mainBinding.MaintvBackDistanceTo32.setText(String.valueOf(pvList.get(0).getBackDistance())); + mainActivity.mainBinding.MaintvPressTo32.setText(String.valueOf(pvList.get(0).getPressSet())); + mainActivity.mainBinding.MaintvVerticalAdjustTo32.setText(String.valueOf(pvList.get(0).getVerticalAdjust())); + mainActivity.workLength=String.valueOf(pvList.get(0).getWorkLength()); + mainActivity.workWidth=String.valueOf(pvList.get(0).getWorkWidth()); + + //读取数据库,并对其他控件进行赋值 + Toast.makeText(dialog.getContext(), "调用成功", Toast.LENGTH_SHORT).show(); + + // dialog.dismiss(); // 关闭弹窗 + }); + + + + // 退出按钮点击事件 + exitButton.setOnClickListener(v -> { + Toast.makeText(dialog.getContext(), "点击了退出", Toast.LENGTH_SHORT).show(); + dialog.dismiss(); // 关闭弹窗 + }); + + + + } + + + 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 = 25; + 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(); // 显示弹窗 + } + + + + + // 更新后退距离UI状态的辅助方法 + private void updateUIState2(EditText activeEditText, EditText inactiveEditText, + View activeContainer, View inactiveContainer) { + // 更新输入框状态 + activeEditText.setEnabled(true); + activeEditText.requestFocus(); + + inactiveEditText.setEnabled(false); + inactiveEditText.clearFocus(); + + // 显示/隐藏软键盘 + InputMethodManager imm = (InputMethodManager) mainActivity.getSystemService(Context.INPUT_METHOD_SERVICE); + imm.showSoftInput(activeEditText, InputMethodManager.SHOW_IMPLICIT); + imm.hideSoftInputFromWindow(inactiveEditText.getWindowToken(), 0); + + + + // 更新容器样式 + activeContainer.setBackgroundResource(R.drawable.container_active); + inactiveContainer.setBackgroundResource(R.drawable.container_inactive); + } + + // 更新摆臂角度UI状态的辅助方法 + private void updateUIState(EditText editText, RadioGroup radioGroup, + View activeContainer, View inactiveContainer) { + // 更新输入框状态 + editText.setEnabled(mainActivity.isInputGroupActive); // + if (mainActivity.isInputGroupActive) { + editText.requestFocus(); + // 显示软键盘 + InputMethodManager imm = (InputMethodManager) mainActivity.getSystemService(Context.INPUT_METHOD_SERVICE); + imm.showSoftInput(editText, InputMethodManager.SHOW_IMPLICIT); + } else { + // 隐藏软键盘 + InputMethodManager imm = (InputMethodManager) mainActivity.getSystemService(Context.INPUT_METHOD_SERVICE); + imm.hideSoftInputFromWindow(editText.getWindowToken(), 0); + } + + // 更新按钮组状态 true失能 fasle 使能 全部未选中 + radioGroup.setEnabled(!mainActivity.isInputGroupActive); + for (int i = 0; i < radioGroup.getChildCount(); i++) { + radioGroup.getChildAt(i).setEnabled(!mainActivity.isInputGroupActive); + } + + // 重置按钮选择状态 + if (!mainActivity.isInputGroupActive) { + radioGroup.clearCheck(); + } + + + // 更新容器样式 + activeContainer.setBackgroundResource(R.drawable.container_active); + // activeContainer.setBackgroundResource(R.drawable.container_inactive); + inactiveContainer.setBackgroundResource(R.drawable.container_inactive); + } + +} //根类 + + diff --git a/swingarmapp_sandblast/app/src/main/java/com/example/swingarmapp_sandblast/services/RobotDataHanlder.java b/swingarmapp_sandblast/app/src/main/java/com/example/swingarmapp_sandblast/services/RobotDataHanlder.java new file mode 100644 index 0000000..783620c --- /dev/null +++ b/swingarmapp_sandblast/app/src/main/java/com/example/swingarmapp_sandblast/services/RobotDataHanlder.java @@ -0,0 +1,63 @@ +package com.example.swingarmapp_sandblast.services; + +import com.example.swingarmapp_sandblast.models.BspIV; +import com.example.swingarmapp_sandblast.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/swingarmapp_sandblast/app/src/main/java/com/example/swingarmapp_sandblast/services/USBSerialPortHelper.java b/swingarmapp_sandblast/app/src/main/java/com/example/swingarmapp_sandblast/services/USBSerialPortHelper.java new file mode 100644 index 0000000..499b334 --- /dev/null +++ b/swingarmapp_sandblast/app/src/main/java/com/example/swingarmapp_sandblast/services/USBSerialPortHelper.java @@ -0,0 +1,451 @@ +package com.example.swingarmapp_sandblast.services; + + +import static com.example.swingarmapp_sandblast.services.ErrorDeocdeHelper.ErrorDeocde; + +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.swingarmapp_sandblast.BuildConfig; +import com.example.swingarmapp_sandblast.MainActivity; +import com.example.swingarmapp_sandblast.models.ErrorModel; +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 com.example.swingarmapp_sandblast.models.BspIV; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Objects; + +public class USBSerialPortHelper implements SerialInputOutputManager.Listener { + + + public USBSerialPortHelper(MainActivity mainActivity) + { + this.MainActivity=mainActivity; + } + + private 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 WRITE_WAIT_MILLIS = 500; + 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; + + 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 == false)//从收到第一个数据开始计时 + { + StartCountDown = true; + new CountDownTimer(400, 200) { + public void onTick(long millisUntilFinished) { + + } + public void onFinish() { + + // status("read finished"); + decodeRceive(listTobyte(_receiveBufferlist)); + _receiveBufferlist.clear(); + StartCountDown = false; + } + }.start(); + } + } + + + /* + 逐位检查并构建二进制字符串 + */ + 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位添加一个分隔符 + */ + String unsignedIntToBinaryWithSeparator(int value) { + StringBuilder sb = new StringBuilder(35); + for (int i = 11; i >= 0; i--) { + sb.append((value & (1 << i)) == 0 ? '0' : '1'); + if (i % 4 == 0 && i != 0) { + sb.append(' '); // 每4位添加一个分隔符 + } + } + return sb.toString(); + } + 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); + } + + private void decodeRceive(byte[] data) { + try { + + // String dataReceived = bytesToHex(data); + //status(dataReceived); + // if ((data[0] == 0xFE) && (data[1] == 0xFE)) + byte[] crcbytes = new byte[data.length - 2]; + System.arraycopy(data, 0, crcbytes, 0, data.length - 2); + byte[] crc=ModbusCRC.calculateCRC(crcbytes); + // status(bytesToHex(data)); + // status(String.valueOf(crc[0]+" "+ String.valueOf(crc[1]))); + 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); + + BspIV.IV_struct_define _toReceiveIV=BspIV.IV_struct_define.parseFrom(bytes); + + if (_toReceiveIV!=null) + { + MainActivity.mainBinding.tvSpeedFrom32.setText(String.valueOf((double)_toReceiveIV.getRobotMoveDeriSpeed()/10)); + + MainActivity.mainBinding.tvAngleFrom32.setText(String.valueOf((double)_toReceiveIV.getRobotGyro()/100)); + MainActivity.mainBinding.tvHeightFrom32.setText(String.valueOf((double)_toReceiveIV.getDistanceSensor()/10)); + + MainActivity.mainBinding.tvLCompensationFrom32.setText(String.valueOf((double)_toReceiveIV.getLeftCompensation()/100)); + + MainActivity.mainBinding.tvRCopmpensationFrom32.setText(String.valueOf(((double) _toReceiveIV.getRightCompensation()/100))); + +// + if(_toReceiveIV.getIsOnline()==0) + { + MainActivity.mainBinding.tvSignal.setText("断开"); + } + else if(_toReceiveIV.getIsOnline()==1) + { + MainActivity.mainBinding.tvSignal.setText("已连接"); + } + + int errorInt = _toReceiveIV.getSystemError();//硬件错误 + String errorString2 = ErrorDeocde(errorInt); + String errorString = " # " + unsignedIntToBinaryWithSeparator(errorInt); + errorString += " " + toHex4Digits(_toReceiveIV.getLeftMotorErr()); + errorString += " " + toHex4Digits(_toReceiveIV.getRightMotorErr()); + errorString += " " + toHex4Digits(_toReceiveIV.getSwingMotorErr()); + + if(errorInt !=0 || _toReceiveIV.getLeftMotorErr()!=0 ||_toReceiveIV.getRightMotorErr()!=0 ||_toReceiveIV.getSwingMotorErr()!=0) + { + if(!Objects.equals(errorLast, errorString)){ + ErrorModel em = new ErrorModel(System.currentTimeMillis(), errorString); + MainActivity.myDataHelper.AddOrUpdateErrorModel(em); + + if(Objects.equals(errorString2, "未复位")) + { + MainActivity.mainBinding.mainViewErrMessageTxView.setText(String.valueOf(errorString2)); + } + else + { + MainActivity.mainBinding.mainViewErrMessageTxView.setText("有"); + } + + errorLast = errorString; + } + } + else + { + MainActivity.mainBinding.mainViewErrMessageTxView.setText("无"); + } + + + + + }else + { + // status("null"); + } + + + + + + }else + { + + } + + }else + { + //status("crc failed"); + } + + + + + } 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 { + usbSerialPort.write(data, WRITE_WAIT_MILLIS); + } catch (IOException e) + { + // status("Send Failed"); + connected = false; + } + } + else { + //status("usb serialport disconnected"); + + } + + + } + +} diff --git a/swingarmapp_sandblast/app/src/main/java/com/example/swingarmapp_sandblast/services/VideoPlayerHelper.java b/swingarmapp_sandblast/app/src/main/java/com/example/swingarmapp_sandblast/services/VideoPlayerHelper.java new file mode 100644 index 0000000..ba62290 --- /dev/null +++ b/swingarmapp_sandblast/app/src/main/java/com/example/swingarmapp_sandblast/services/VideoPlayerHelper.java @@ -0,0 +1,27 @@ +package com.example.swingarmapp_sandblast.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.SURFACEVIEW);//设置渲染器类型 + 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/swingarmapp_sandblast/app/src/main/java/com/example/swingarmapp_sandblast/viewmodels/MainViewModel.java b/swingarmapp_sandblast/app/src/main/java/com/example/swingarmapp_sandblast/viewmodels/MainViewModel.java new file mode 100644 index 0000000..081ec7f --- /dev/null +++ b/swingarmapp_sandblast/app/src/main/java/com/example/swingarmapp_sandblast/viewmodels/MainViewModel.java @@ -0,0 +1,11 @@ +package com.example.swingarmapp_sandblast.viewmodels; + +import androidx.lifecycle.ViewModel; + +public class MainViewModel extends ViewModel { + + public MainViewModel() { + + } + +} \ No newline at end of file diff --git a/swingarmapp_sandblast/app/src/main/java/generate_java.bat b/swingarmapp_sandblast/app/src/main/java/generate_java.bat new file mode 100644 index 0000000..97deb24 --- /dev/null +++ b/swingarmapp_sandblast/app/src/main/java/generate_java.bat @@ -0,0 +1,2 @@ + protoc --java_out . *.proto + pause diff --git a/swingarmapp_sandblast/app/src/main/java/protoc.exe b/swingarmapp_sandblast/app/src/main/java/protoc.exe new file mode 100644 index 0000000..f1ffb02 Binary files /dev/null and b/swingarmapp_sandblast/app/src/main/java/protoc.exe differ diff --git a/swingarmapp_sandblast/app/src/main/res/drawable/background.xml b/swingarmapp_sandblast/app/src/main/res/drawable/background.xml new file mode 100644 index 0000000..9c77c74 --- /dev/null +++ b/swingarmapp_sandblast/app/src/main/res/drawable/background.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/swingarmapp_sandblast/app/src/main/res/drawable/bgr.png b/swingarmapp_sandblast/app/src/main/res/drawable/bgr.png new file mode 100644 index 0000000..4d6154f Binary files /dev/null and b/swingarmapp_sandblast/app/src/main/res/drawable/bgr.png differ diff --git a/swingarmapp_sandblast/app/src/main/res/drawable/blue_rounded_rectangle.xml b/swingarmapp_sandblast/app/src/main/res/drawable/blue_rounded_rectangle.xml new file mode 100644 index 0000000..a973af9 --- /dev/null +++ b/swingarmapp_sandblast/app/src/main/res/drawable/blue_rounded_rectangle.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/swingarmapp_sandblast/app/src/main/res/drawable/border.xml b/swingarmapp_sandblast/app/src/main/res/drawable/border.xml new file mode 100644 index 0000000..4f76948 --- /dev/null +++ b/swingarmapp_sandblast/app/src/main/res/drawable/border.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/swingarmapp_sandblast/app/src/main/res/drawable/border_active.xml b/swingarmapp_sandblast/app/src/main/res/drawable/border_active.xml new file mode 100644 index 0000000..5919263 --- /dev/null +++ b/swingarmapp_sandblast/app/src/main/res/drawable/border_active.xml @@ -0,0 +1,8 @@ + + + + + + \ No newline at end of file diff --git a/swingarmapp_sandblast/app/src/main/res/drawable/border_inactive.xml b/swingarmapp_sandblast/app/src/main/res/drawable/border_inactive.xml new file mode 100644 index 0000000..093780c --- /dev/null +++ b/swingarmapp_sandblast/app/src/main/res/drawable/border_inactive.xml @@ -0,0 +1,8 @@ + + + + + + \ No newline at end of file diff --git a/swingarmapp_sandblast/app/src/main/res/drawable/borderblue.xml b/swingarmapp_sandblast/app/src/main/res/drawable/borderblue.xml new file mode 100644 index 0000000..b234be6 --- /dev/null +++ b/swingarmapp_sandblast/app/src/main/res/drawable/borderblue.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + diff --git a/swingarmapp_sandblast/app/src/main/res/drawable/borderbluegreen.xml b/swingarmapp_sandblast/app/src/main/res/drawable/borderbluegreen.xml new file mode 100644 index 0000000..25d3346 --- /dev/null +++ b/swingarmapp_sandblast/app/src/main/res/drawable/borderbluegreen.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + diff --git a/swingarmapp_sandblast/app/src/main/res/drawable/borderlog.xml b/swingarmapp_sandblast/app/src/main/res/drawable/borderlog.xml new file mode 100644 index 0000000..1a1b34c --- /dev/null +++ b/swingarmapp_sandblast/app/src/main/res/drawable/borderlog.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/swingarmapp_sandblast/app/src/main/res/drawable/borderorange.xml b/swingarmapp_sandblast/app/src/main/res/drawable/borderorange.xml new file mode 100644 index 0000000..eef56c3 --- /dev/null +++ b/swingarmapp_sandblast/app/src/main/res/drawable/borderorange.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + diff --git a/swingarmapp_sandblast/app/src/main/res/drawable/borderwhite.xml b/swingarmapp_sandblast/app/src/main/res/drawable/borderwhite.xml new file mode 100644 index 0000000..e013ef8 --- /dev/null +++ b/swingarmapp_sandblast/app/src/main/res/drawable/borderwhite.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + diff --git a/swingarmapp_sandblast/app/src/main/res/drawable/button_active.xml b/swingarmapp_sandblast/app/src/main/res/drawable/button_active.xml new file mode 100644 index 0000000..28f66f6 --- /dev/null +++ b/swingarmapp_sandblast/app/src/main/res/drawable/button_active.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/swingarmapp_sandblast/app/src/main/res/drawable/button_inactive.xml b/swingarmapp_sandblast/app/src/main/res/drawable/button_inactive.xml new file mode 100644 index 0000000..146bfd1 --- /dev/null +++ b/swingarmapp_sandblast/app/src/main/res/drawable/button_inactive.xml @@ -0,0 +1,11 @@ + + + + + + + + + \ No newline at end of file diff --git a/swingarmapp_sandblast/app/src/main/res/drawable/buttonborderwhite.xml b/swingarmapp_sandblast/app/src/main/res/drawable/buttonborderwhite.xml new file mode 100644 index 0000000..ec98fab --- /dev/null +++ b/swingarmapp_sandblast/app/src/main/res/drawable/buttonborderwhite.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + diff --git a/swingarmapp_sandblast/app/src/main/res/drawable/container_active.xml b/swingarmapp_sandblast/app/src/main/res/drawable/container_active.xml new file mode 100644 index 0000000..dc691f7 --- /dev/null +++ b/swingarmapp_sandblast/app/src/main/res/drawable/container_active.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/swingarmapp_sandblast/app/src/main/res/drawable/container_inactive.xml b/swingarmapp_sandblast/app/src/main/res/drawable/container_inactive.xml new file mode 100644 index 0000000..edcae41 --- /dev/null +++ b/swingarmapp_sandblast/app/src/main/res/drawable/container_inactive.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/swingarmapp_sandblast/app/src/main/res/drawable/dash_line.xml b/swingarmapp_sandblast/app/src/main/res/drawable/dash_line.xml new file mode 100644 index 0000000..c83a8c5 --- /dev/null +++ b/swingarmapp_sandblast/app/src/main/res/drawable/dash_line.xml @@ -0,0 +1,14 @@ + + + + + \ No newline at end of file diff --git a/swingarmapp_sandblast/app/src/main/res/drawable/ic_launcher_background.xml b/swingarmapp_sandblast/app/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 0000000..07d5da9 --- /dev/null +++ b/swingarmapp_sandblast/app/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/swingarmapp_sandblast/app/src/main/res/drawable/ic_launcher_foreground.xml b/swingarmapp_sandblast/app/src/main/res/drawable/ic_launcher_foreground.xml new file mode 100644 index 0000000..2b068d1 --- /dev/null +++ b/swingarmapp_sandblast/app/src/main/res/drawable/ic_launcher_foreground.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/swingarmapp_sandblast/app/src/main/res/drawable/my_cursor.xml b/swingarmapp_sandblast/app/src/main/res/drawable/my_cursor.xml new file mode 100644 index 0000000..970a494 --- /dev/null +++ b/swingarmapp_sandblast/app/src/main/res/drawable/my_cursor.xml @@ -0,0 +1,9 @@ + + + + android:shape="rectangle"> + + + \ No newline at end of file diff --git a/swingarmapp_sandblast/app/src/main/res/drawable/orange_rounded_rectangle.xml b/swingarmapp_sandblast/app/src/main/res/drawable/orange_rounded_rectangle.xml new file mode 100644 index 0000000..8835bab --- /dev/null +++ b/swingarmapp_sandblast/app/src/main/res/drawable/orange_rounded_rectangle.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/swingarmapp_sandblast/app/src/main/res/drawable/radio_button_selected.xml b/swingarmapp_sandblast/app/src/main/res/drawable/radio_button_selected.xml new file mode 100644 index 0000000..e7389bd --- /dev/null +++ b/swingarmapp_sandblast/app/src/main/res/drawable/radio_button_selected.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + diff --git a/swingarmapp_sandblast/app/src/main/res/drawable/radio_button_textcolor.xml b/swingarmapp_sandblast/app/src/main/res/drawable/radio_button_textcolor.xml new file mode 100644 index 0000000..9fe93c7 --- /dev/null +++ b/swingarmapp_sandblast/app/src/main/res/drawable/radio_button_textcolor.xml @@ -0,0 +1,8 @@ + + + + + + diff --git a/swingarmapp_sandblast/app/src/main/res/drawable/radio_button_unselected.xml b/swingarmapp_sandblast/app/src/main/res/drawable/radio_button_unselected.xml new file mode 100644 index 0000000..ccb6bf8 --- /dev/null +++ b/swingarmapp_sandblast/app/src/main/res/drawable/radio_button_unselected.xml @@ -0,0 +1,8 @@ + + + + + + + diff --git a/swingarmapp_sandblast/app/src/main/res/drawable/radiobutton_background.xml b/swingarmapp_sandblast/app/src/main/res/drawable/radiobutton_background.xml new file mode 100644 index 0000000..6eb6a48 --- /dev/null +++ b/swingarmapp_sandblast/app/src/main/res/drawable/radiobutton_background.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/swingarmapp_sandblast/app/src/main/res/drawable/rounded_edittext.xml b/swingarmapp_sandblast/app/src/main/res/drawable/rounded_edittext.xml new file mode 100644 index 0000000..9f845ce --- /dev/null +++ b/swingarmapp_sandblast/app/src/main/res/drawable/rounded_edittext.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/swingarmapp_sandblast/app/src/main/res/drawable/squrelogo.png b/swingarmapp_sandblast/app/src/main/res/drawable/squrelogo.png new file mode 100644 index 0000000..f7cafaf Binary files /dev/null and b/swingarmapp_sandblast/app/src/main/res/drawable/squrelogo.png differ diff --git a/swingarmapp_sandblast/app/src/main/res/drawable/submenu.xml b/swingarmapp_sandblast/app/src/main/res/drawable/submenu.xml new file mode 100644 index 0000000..64f9e41 --- /dev/null +++ b/swingarmapp_sandblast/app/src/main/res/drawable/submenu.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/swingarmapp_sandblast/app/src/main/res/layout/activity_main.xml b/swingarmapp_sandblast/app/src/main/res/layout/activity_main.xml new file mode 100644 index 0000000..7897244 --- /dev/null +++ b/swingarmapp_sandblast/app/src/main/res/layout/activity_main.xml @@ -0,0 +1,1058 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/swingarmapp_sandblast/app/src/main/res/layout/backsetpopup.xml b/swingarmapp_sandblast/app/src/main/res/layout/backsetpopup.xml new file mode 100644 index 0000000..4780d83 --- /dev/null +++ b/swingarmapp_sandblast/app/src/main/res/layout/backsetpopup.xml @@ -0,0 +1,180 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/swingarmapp_sandblast/app/src/main/res/layout/log_item.xml b/swingarmapp_sandblast/app/src/main/res/layout/log_item.xml new file mode 100644 index 0000000..520b0a2 --- /dev/null +++ b/swingarmapp_sandblast/app/src/main/res/layout/log_item.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/swingarmapp_sandblast/app/src/main/res/layout/manualmodepopup.xml b/swingarmapp_sandblast/app/src/main/res/layout/manualmodepopup.xml new file mode 100644 index 0000000..6e59107 --- /dev/null +++ b/swingarmapp_sandblast/app/src/main/res/layout/manualmodepopup.xml @@ -0,0 +1,174 @@ + + + + + + + + + + + + + + + + + + + + + + > + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/swingarmapp_sandblast/app/src/main/res/layout/parameters_call.xml b/swingarmapp_sandblast/app/src/main/res/layout/parameters_call.xml new file mode 100644 index 0000000..36c6e0b --- /dev/null +++ b/swingarmapp_sandblast/app/src/main/res/layout/parameters_call.xml @@ -0,0 +1,201 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/swingarmapp_sandblast/app/src/main/res/layout/swingarmanglepopup.xml b/swingarmapp_sandblast/app/src/main/res/layout/swingarmanglepopup.xml new file mode 100644 index 0000000..a9d84ad --- /dev/null +++ b/swingarmapp_sandblast/app/src/main/res/layout/swingarmanglepopup.xml @@ -0,0 +1,190 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/swingarmapp_sandblast/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/swingarmapp_sandblast/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml new file mode 100644 index 0000000..6f3b755 --- /dev/null +++ b/swingarmapp_sandblast/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/swingarmapp_sandblast/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/swingarmapp_sandblast/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml new file mode 100644 index 0000000..6f3b755 --- /dev/null +++ b/swingarmapp_sandblast/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/swingarmapp_sandblast/app/src/main/res/mipmap-hdpi/ic_launcher.webp b/swingarmapp_sandblast/app/src/main/res/mipmap-hdpi/ic_launcher.webp new file mode 100644 index 0000000..c209e78 Binary files /dev/null and b/swingarmapp_sandblast/app/src/main/res/mipmap-hdpi/ic_launcher.webp differ diff --git a/swingarmapp_sandblast/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp b/swingarmapp_sandblast/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp new file mode 100644 index 0000000..b2dfe3d Binary files /dev/null and b/swingarmapp_sandblast/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp differ diff --git a/swingarmapp_sandblast/app/src/main/res/mipmap-mdpi/ic_launcher.webp b/swingarmapp_sandblast/app/src/main/res/mipmap-mdpi/ic_launcher.webp new file mode 100644 index 0000000..4f0f1d6 Binary files /dev/null and b/swingarmapp_sandblast/app/src/main/res/mipmap-mdpi/ic_launcher.webp differ diff --git a/swingarmapp_sandblast/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp b/swingarmapp_sandblast/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp new file mode 100644 index 0000000..62b611d Binary files /dev/null and b/swingarmapp_sandblast/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp differ diff --git a/swingarmapp_sandblast/app/src/main/res/mipmap-xhdpi/ic_launcher.webp b/swingarmapp_sandblast/app/src/main/res/mipmap-xhdpi/ic_launcher.webp new file mode 100644 index 0000000..948a307 Binary files /dev/null and b/swingarmapp_sandblast/app/src/main/res/mipmap-xhdpi/ic_launcher.webp differ diff --git a/swingarmapp_sandblast/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp b/swingarmapp_sandblast/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp new file mode 100644 index 0000000..1b9a695 Binary files /dev/null and b/swingarmapp_sandblast/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp differ diff --git a/swingarmapp_sandblast/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp b/swingarmapp_sandblast/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp new file mode 100644 index 0000000..28d4b77 Binary files /dev/null and b/swingarmapp_sandblast/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp differ diff --git a/swingarmapp_sandblast/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp b/swingarmapp_sandblast/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp new file mode 100644 index 0000000..9287f50 Binary files /dev/null and b/swingarmapp_sandblast/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp differ diff --git a/swingarmapp_sandblast/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp b/swingarmapp_sandblast/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp new file mode 100644 index 0000000..aa7d642 Binary files /dev/null and b/swingarmapp_sandblast/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp differ diff --git a/swingarmapp_sandblast/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp b/swingarmapp_sandblast/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp new file mode 100644 index 0000000..9126ae3 Binary files /dev/null and b/swingarmapp_sandblast/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp differ diff --git a/swingarmapp_sandblast/app/src/main/res/values-night/themes.xml b/swingarmapp_sandblast/app/src/main/res/values-night/themes.xml new file mode 100644 index 0000000..d5516cd --- /dev/null +++ b/swingarmapp_sandblast/app/src/main/res/values-night/themes.xml @@ -0,0 +1,16 @@ + + + + \ No newline at end of file diff --git a/swingarmapp_sandblast/app/src/main/res/values/colors.xml b/swingarmapp_sandblast/app/src/main/res/values/colors.xml new file mode 100644 index 0000000..7ed5a2f --- /dev/null +++ b/swingarmapp_sandblast/app/src/main/res/values/colors.xml @@ -0,0 +1,168 @@ + + + #FF000000 + #FFFFFFFF + #FFFFFFFF + #BDBDBD + #3F51B5 + #303F9F + #FF4081 + + #FBE5D6 + #1F4E79 + #00ACFC + #DEEBF7 + #FBE5D6 + #FF713D + #001E54 + + + + + + #00194d + #00ADFC + + #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/swingarmapp_sandblast/app/src/main/res/values/strings.xml b/swingarmapp_sandblast/app/src/main/res/values/strings.xml new file mode 100644 index 0000000..e62c039 --- /dev/null +++ b/swingarmapp_sandblast/app/src/main/res/values/strings.xml @@ -0,0 +1,42 @@ + + 摆臂sandbalst + 状态\n信息 + 移动\n速度 + 实时\n高度 + 实时\n角度 + 左侧\n补偿 + 右侧\n补偿 + 手动\n模式 + + 手动操作 + 竖直操作 + 水平操作 + + + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + + + + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + + 20 + + \ No newline at end of file diff --git a/swingarmapp_sandblast/app/src/main/res/values/themes.xml b/swingarmapp_sandblast/app/src/main/res/values/themes.xml new file mode 100644 index 0000000..a645915 --- /dev/null +++ b/swingarmapp_sandblast/app/src/main/res/values/themes.xml @@ -0,0 +1,17 @@ + + + + + \ No newline at end of file diff --git a/swingarmapp_sandblast/app/src/main/res/xml/backup_rules.xml b/swingarmapp_sandblast/app/src/main/res/xml/backup_rules.xml new file mode 100644 index 0000000..fa0f996 --- /dev/null +++ b/swingarmapp_sandblast/app/src/main/res/xml/backup_rules.xml @@ -0,0 +1,13 @@ + + + + \ No newline at end of file diff --git a/swingarmapp_sandblast/app/src/main/res/xml/check_boxs.xml b/swingarmapp_sandblast/app/src/main/res/xml/check_boxs.xml new file mode 100644 index 0000000..df2d64a --- /dev/null +++ b/swingarmapp_sandblast/app/src/main/res/xml/check_boxs.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/swingarmapp_sandblast/app/src/main/res/xml/data_extraction_rules.xml b/swingarmapp_sandblast/app/src/main/res/xml/data_extraction_rules.xml new file mode 100644 index 0000000..9ee9997 --- /dev/null +++ b/swingarmapp_sandblast/app/src/main/res/xml/data_extraction_rules.xml @@ -0,0 +1,19 @@ + + + + + + + \ No newline at end of file diff --git a/swingarmapp_sandblast/app/src/main/res/xml/device_filter.xml b/swingarmapp_sandblast/app/src/main/res/xml/device_filter.xml new file mode 100644 index 0000000..b2a252c --- /dev/null +++ b/swingarmapp_sandblast/app/src/main/res/xml/device_filter.xml @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/swingarmapp_sandblast/app/src/test/java/com/example/swingarmapp_sandblast/ExampleUnitTest.java b/swingarmapp_sandblast/app/src/test/java/com/example/swingarmapp_sandblast/ExampleUnitTest.java new file mode 100644 index 0000000..9d1d62f --- /dev/null +++ b/swingarmapp_sandblast/app/src/test/java/com/example/swingarmapp_sandblast/ExampleUnitTest.java @@ -0,0 +1,17 @@ +package com.example.swingarmapp_sandblast; + +import org.junit.Test; + +import static org.junit.Assert.*; + +/** + * Example local unit test, which will execute on the development machine (host). + * + * @see Testing documentation + */ +public class ExampleUnitTest { + @Test + public void addition_isCorrect() { + assertEquals(4, 2 + 2); + } +} \ No newline at end of file diff --git a/swingarmapp_sandblast/build.gradle b/swingarmapp_sandblast/build.gradle new file mode 100644 index 0000000..b99ec97 --- /dev/null +++ b/swingarmapp_sandblast/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/swingarmapp_sandblast/gradle.properties b/swingarmapp_sandblast/gradle.properties new file mode 100644 index 0000000..3e927b1 --- /dev/null +++ b/swingarmapp_sandblast/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/swingarmapp_sandblast/gradle/wrapper/gradle-wrapper.jar b/swingarmapp_sandblast/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..e708b1c Binary files /dev/null and b/swingarmapp_sandblast/gradle/wrapper/gradle-wrapper.jar differ diff --git a/swingarmapp_sandblast/gradle/wrapper/gradle-wrapper.properties b/swingarmapp_sandblast/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..ab0fcbf --- /dev/null +++ b/swingarmapp_sandblast/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Wed Feb 05 16:42:57 CST 2025 +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/swingarmapp_sandblast/gradlew b/swingarmapp_sandblast/gradlew new file mode 100644 index 0000000..4f906e0 --- /dev/null +++ b/swingarmapp_sandblast/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/swingarmapp_sandblast/gradlew.bat b/swingarmapp_sandblast/gradlew.bat new file mode 100644 index 0000000..107acd3 --- /dev/null +++ b/swingarmapp_sandblast/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/swingarmapp_sandblast/settings.gradle b/swingarmapp_sandblast/settings.gradle new file mode 100644 index 0000000..be3882d --- /dev/null +++ b/swingarmapp_sandblast/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 = "SwingArmAPP_SandBlast" +include ':app' diff --git a/swingarmapp_sandblast/备注.txt b/swingarmapp_sandblast/备注.txt new file mode 100644 index 0000000..3bc9537 --- /dev/null +++ b/swingarmapp_sandblast/备注.txt @@ -0,0 +1,2 @@ +修改新的摆臂界面---2025.5.29 +摆臂加喷砂机版本 \ No newline at end of file diff --git a/备注.txt b/备注.txt new file mode 100644 index 0000000..3bc9537 --- /dev/null +++ b/备注.txt @@ -0,0 +1,2 @@ +修改新的摆臂界面---2025.5.29 +摆臂加喷砂机版本 \ No newline at end of file