From 7ded020ef3ae7897a4ee072832ed5fcb9605c9ae Mon Sep 17 00:00:00 2001 From: "LIN\\54376" <543769318@qq.com> Date: Thu, 18 Dec 2025 14:27:57 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/.name | 1 + .idea/inspectionProfiles/Project_Default.xml | 8 + .idea/render.experimental.xml | 6 + .idea/vcs.xml | 6 + .../ExampleInstrumentedTest.java | 26 + .../removemarineanimals/AppDatabase.java | 57 + .../MainActivity - 副本.txt | 335 ++++ .../removemarineanimals/MainActivity.java | 607 +++++++ .../example/removemarineanimals/RobotLog.java | 20 + .../removemarineanimals/RobotLogDao.java | 22 + .../removemarineanimals/models/BspError.java | 815 +++++++++ .../removemarineanimals/models/BspIV.java | 1532 +++++++++++++++++ .../removemarineanimals/models/BspPV.java | 789 +++++++++ .../removemarineanimals/models/RobotData.java | 792 +++++++++ .../models/RobotRMACM.java | 615 +++++++ .../services/CustomProber.java | 23 + .../services/DisplayUtils.java | 17 + .../services/ModbusCRC.java | 72 + .../services/RobotDataHanlder.java | 54 + .../services/RtspRecorder.java | 140 ++ .../services/USBSerialPortHelper.java | 352 ++++ .../services/VideoPlayerHelper.java | 27 + .../services/ttySerialPortHelper.java | 227 +++ .../viewmodels/MainViewModel.java | 77 + app/src/main/res/drawable/background.xml | 25 + .../res/drawable/blue_rounded_rectangle.xml | 25 + .../drawable/message_rounded_rectangle.xml | 24 + app/src/main/res/layout/dialog_logs.xml | 15 + .../removemarineanimals/ExampleUnitTest.java | 17 + proto/BspIV.java | 729 ++++++++ proto/BspPV.java | 564 ++++++ proto/bsp_IV.proto | 10 + proto/bsp_PV.proto | 6 + 33 files changed, 8035 insertions(+) create mode 100644 .idea/.name create mode 100644 .idea/inspectionProfiles/Project_Default.xml create mode 100644 .idea/render.experimental.xml create mode 100644 .idea/vcs.xml create mode 100644 app/src/androidTest/java/com/example/removemarineanimals/ExampleInstrumentedTest.java create mode 100644 app/src/main/java/com/example/removemarineanimals/AppDatabase.java create mode 100644 app/src/main/java/com/example/removemarineanimals/MainActivity - 副本.txt create mode 100644 app/src/main/java/com/example/removemarineanimals/MainActivity.java create mode 100644 app/src/main/java/com/example/removemarineanimals/RobotLog.java create mode 100644 app/src/main/java/com/example/removemarineanimals/RobotLogDao.java create mode 100644 app/src/main/java/com/example/removemarineanimals/models/BspError.java create mode 100644 app/src/main/java/com/example/removemarineanimals/models/BspIV.java create mode 100644 app/src/main/java/com/example/removemarineanimals/models/BspPV.java create mode 100644 app/src/main/java/com/example/removemarineanimals/models/RobotData.java create mode 100644 app/src/main/java/com/example/removemarineanimals/models/RobotRMACM.java create mode 100644 app/src/main/java/com/example/removemarineanimals/services/CustomProber.java create mode 100644 app/src/main/java/com/example/removemarineanimals/services/DisplayUtils.java create mode 100644 app/src/main/java/com/example/removemarineanimals/services/ModbusCRC.java create mode 100644 app/src/main/java/com/example/removemarineanimals/services/RobotDataHanlder.java create mode 100644 app/src/main/java/com/example/removemarineanimals/services/RtspRecorder.java create mode 100644 app/src/main/java/com/example/removemarineanimals/services/USBSerialPortHelper.java create mode 100644 app/src/main/java/com/example/removemarineanimals/services/VideoPlayerHelper.java create mode 100644 app/src/main/java/com/example/removemarineanimals/services/ttySerialPortHelper.java create mode 100644 app/src/main/java/com/example/removemarineanimals/viewmodels/MainViewModel.java create mode 100644 app/src/main/res/drawable/background.xml create mode 100644 app/src/main/res/drawable/blue_rounded_rectangle.xml create mode 100644 app/src/main/res/drawable/message_rounded_rectangle.xml create mode 100644 app/src/main/res/layout/dialog_logs.xml create mode 100644 app/src/test/java/com/example/removemarineanimals/ExampleUnitTest.java create mode 100644 proto/BspIV.java create mode 100644 proto/BspPV.java create mode 100644 proto/bsp_IV.proto create mode 100644 proto/bsp_PV.proto diff --git a/.idea/.name b/.idea/.name new file mode 100644 index 0000000..7245fcd --- /dev/null +++ b/.idea/.name @@ -0,0 +1 @@ +RemoveMarineAnimals \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..27d1ade --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,8 @@ + + + + \ 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/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/app/src/androidTest/java/com/example/removemarineanimals/ExampleInstrumentedTest.java b/app/src/androidTest/java/com/example/removemarineanimals/ExampleInstrumentedTest.java new file mode 100644 index 0000000..6a26675 --- /dev/null +++ b/app/src/androidTest/java/com/example/removemarineanimals/ExampleInstrumentedTest.java @@ -0,0 +1,26 @@ +package com.example.removemarineanimals; + +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.removemarineanimals", appContext.getPackageName()); + } +} \ No newline at end of file diff --git a/app/src/main/java/com/example/removemarineanimals/AppDatabase.java b/app/src/main/java/com/example/removemarineanimals/AppDatabase.java new file mode 100644 index 0000000..b56b312 --- /dev/null +++ b/app/src/main/java/com/example/removemarineanimals/AppDatabase.java @@ -0,0 +1,57 @@ +package com.example.removemarineanimals; + +import static com.example.removemarineanimals.viewmodels.MainViewModel.mainBinding; + +import android.content.Context; + +import androidx.room.Database; +import androidx.room.Room; +import androidx.room.RoomDatabase; + +@Database(entities = {RobotLog.class}, version = 1, exportSchema = false) +public abstract class AppDatabase extends RoomDatabase { + + public abstract RobotLogDao robotLogDao(); + + private static volatile AppDatabase INSTANCE; + + public static AppDatabase getInstance(Context context) { + if (INSTANCE == null) { + synchronized (AppDatabase.class) { + if (INSTANCE == null) { + INSTANCE = Room.databaseBuilder(context.getApplicationContext(), + AppDatabase.class, "robot_logs.db") + .fallbackToDestructiveMigration() // 数据库升级时清空数据,可根据需求改 + .build(); + } + } + } + return INSTANCE; + } + + // 在 MainActivity 中添加两个成员变量缓存电机状态 + private String lastLeftError = "正常"; + private String lastRightError = "正常"; + + // 在 TimerTask 或接收串口数据后调用的方法 + private void checkMotorErrors() { + String currentLeftError = mainBinding.tvLeftError.getText().toString().trim(); + String currentRightError = mainBinding.tvRightError.getText().toString().trim(); + + // 左电机状态变化且不正常时保存日志 + if (!currentLeftError.equals("正常") && !currentLeftError.equals(lastLeftError)) { + saveMotorError("左电机", currentLeftError); + } + lastLeftError = currentLeftError; + + // 右电机状态变化且不正常时保存日志 + if (!currentRightError.equals("正常") && !currentRightError.equals(lastRightError)) { + saveMotorError("右电机", currentRightError); + } + lastRightError = currentRightError; + } + + private void saveMotorError(String 左电机, String currentLeftError) { + } + +} diff --git a/app/src/main/java/com/example/removemarineanimals/MainActivity - 副本.txt b/app/src/main/java/com/example/removemarineanimals/MainActivity - 副本.txt new file mode 100644 index 0000000..1f074e9 --- /dev/null +++ b/app/src/main/java/com/example/removemarineanimals/MainActivity - 副本.txt @@ -0,0 +1,335 @@ +package com.example.removemarineanimals; + +import androidx.appcompat.app.AppCompatActivity; +import androidx.core.content.ContextCompat; +import androidx.databinding.DataBindingUtil; +import androidx.lifecycle.ViewModelProvider; + +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.Bundle; + +import com.example.removemarineanimals.databinding.ActivityMainBinding; +import com.example.removemarineanimals.services.CustomProber; +//import com.example.removemarineanimals.services.USBSerialPortHelper; +import com.example.removemarineanimals.services.VideoHelper; +import com.example.removemarineanimals.viewmodels.MainViewModel; +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 android.os.Bundle; +import android.os.CountDownTimer; +import android.os.Handler; +import android.os.Looper; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import cn.nodemedia.NodePlayer; + + +public class MainActivity extends AppCompatActivity implements SerialInputOutputManager.Listener { + + + private enum UsbPermission {Unknown, Requested, Granted, Denied} + + private static final String INTENT_ACTION_GRANT_USB = BuildConfig.APPLICATION_ID + ".GRANT_USB"; + private int deviceId = 60000; + private int deviceId_test = 60000; + private int portNum; + private static final int WRITE_WAIT_MILLIS = 500; + private static final int READ_WAIT_MILLIS = 1000; + private static String PortNameContians = "SILICON";/**/ + 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; + + + public void GetControlsReferences() { + 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(); + } + + + public static ActivityMainBinding mainBinding;//通过Binding可以获取界面数据 +// public USBSerialPortHelper serialPortHelper; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + // setContentView(R.layout.activity_main); + mainBinding = DataBindingUtil.setContentView(this, R.layout.activity_main); + MainViewModel vm = new ViewModelProvider(this).get(MainViewModel.class); + MainViewModel.mainBinding = mainBinding; + // vm.mainBinding=mainBinding; + mainBinding.setVm(vm); + + + //nodePlayer0 =new NodePlayer(this); + //nodePlayer1 =new NodePlayer(this); + + VideoHelper.nodePlayerView0 = mainBinding.nodePlayerView0; + VideoHelper.nodePlayerView1 = mainBinding.nodePlayerView1; + + VideoHelper.nodePlayer0 = new NodePlayer(this); + VideoHelper.nodePlayer1 = new NodePlayer(this); + + + VideoHelper.StatPlayVideo(); + +// +// serialPortHelper=new USBSerialPortHelper(); +// serialPortHelper.MainActivity=this; +// serialPortHelper.intialize(); + + + GetControlsReferences(); + connect(); + + } + + @Override + protected void onStart() { + super.onStart(); + ContextCompat.registerReceiver(this, broadcastReceiver, new IntentFilter(INTENT_ACTION_GRANT_USB), ContextCompat.RECEIVER_NOT_EXPORTED); + + } + + @Override + public void onStop() { + this.unregisterReceiver(broadcastReceiver); + super.onStop(); + } + + @Override + public void onResume() { + super.onResume(); + if (!connected && (usbPermission == UsbPermission.Unknown || usbPermission == UsbPermission.Granted)) { + //mainLooper.post(this::connect); + + } + + } + + @Override + public void onPause() { + if (connected) { + status("串口断开"); + // _serialPortSwitch.setChecked(false); + disconnect(); + } + super.onPause(); + } + + @Override + public void onNewData(byte[] data) { + mainLooper.post(() -> + { + receive(data); + // receive data + }); + } + + @Override + public void onRunError(Exception e) { + mainLooper.post(() -> + { + status("connection lost: " + e.getMessage()); + disconnect(); + }); + } + + private void connect() { + + UsbDevice device = null; + UsbManager usbManager = (UsbManager) this.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(this.getPackageName()); + PendingIntent usbPermissionIntent = PendingIntent.getBroadcast(this, 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); + } 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 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; + } + + public int Counter = 1000; + boolean StartCountDown = false; + + private void receive(byte[] data) { + + for (int i = 0; i < data.length; i++) { + _receiveBufferlist.add(data[i]); + } + + //decodeRceive(data); + if (StartCountDown == false) { + StartCountDown = true; + new CountDownTimer(500, 500) { + public void onTick(long millisUntilFinished) { + // Used for formatting digit to be in 2 digits only + + } + + // When the task is over it will print 00:00:00 there + public void onFinish() { + decodeRceive(listTobyte(_receiveBufferlist)); + _receiveBufferlist.clear(); + StartCountDown = false; + } + }.start(); + } + + + } + + private void decodeRceive(byte[] data) { + try { + + } catch ( + Exception e) { + //spn.append("exception:{e} "); + } + } + void status(String str) + { + mainBinding.message.setText(str); +// SpannableStringBuilder spn = new SpannableStringBuilder(str + '\r' + '\n'); +// +// // spn.append(getTime()); +// +// spn.setSpan(new ForegroundColorSpan(getResources().getColor(R.color.colorAccent)), 0, spn.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); +// receiveText.append(spn); +// scrollView.fullScroll(ScrollView.FOCUS_DOWN); + } +} diff --git a/app/src/main/java/com/example/removemarineanimals/MainActivity.java b/app/src/main/java/com/example/removemarineanimals/MainActivity.java new file mode 100644 index 0000000..b10b967 --- /dev/null +++ b/app/src/main/java/com/example/removemarineanimals/MainActivity.java @@ -0,0 +1,607 @@ +package com.example.removemarineanimals; + +import android.content.Context; +import android.content.SharedPreferences; +import android.os.Bundle; +import android.text.Editable; +import android.text.TextWatcher; +import android.view.View; +import android.view.inputmethod.InputMethodManager; +import android.widget.EditText; +import android.widget.TextView; +import androidx.annotation.NonNull; +import androidx.appcompat.app.AlertDialog; +import androidx.appcompat.app.AppCompatActivity; +import androidx.core.content.ContextCompat; +import androidx.databinding.DataBindingUtil; +import androidx.lifecycle.ViewModelProvider; + +import com.example.removemarineanimals.databinding.ActivityMainBinding; +import com.example.removemarineanimals.models.BspPV; +import com.example.removemarineanimals.models.RobotRMACM; +import com.example.removemarineanimals.services.ModbusCRC; +import com.example.removemarineanimals.services.ttySerialPortHelper; +import com.example.removemarineanimals.viewmodels.MainViewModel; + +import java.util.List; +import java.util.Locale; +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; + + public RobotRMACM.RMACM robotRMACM; + + // 换道标志位,默认左换道 + private int laneChangeDirection = 0; + + // 按钮高亮状态 + private boolean isLeftLaneChangeActive = true; + private boolean isRightLaneChangeActive = false; + + // 输入框 + private void setupDecimalEditText(EditText editText, String paramName) { + editText.addTextChangedListener(new TextWatcher() { + @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) {} + @Override public void onTextChanged(CharSequence s, int start, int before, int count) {} + @Override + public void afterTextChanged(Editable editable) { + String text = editable.toString(); + // 如果只输入了 "." + if (text.equals(".")) { + editText.setText("0."); + editText.setSelection(editText.getText().length()); + } + } + }); + + //新增 + editText.setOnFocusChangeListener((v, hasFocus) -> { + if (!hasFocus) { + String text = editText.getText().toString().trim(); + String originalText = text; + + if (text.isEmpty()) { + text = getDefaultValue(paramName); + editText.setText(text); + saveParamChange(paramName, text); + } else { + // 在编辑完成后进行一次性参数限制 + text = validateAndLimitValue(paramName, text); + + // 如果值被调整,更新编辑框并显示提示 + if (!text.equals(originalText)) { + editText.setText(text); + showRangeLimitDialog(paramName, originalText, text); + } + + // 自动保存参数修改日志 + saveParamChange(paramName, text); + } + editText.setCursorVisible(false); + } else { + // 获得焦点时再显示光标,并全选文本 + editText.setCursorVisible(true); + + // 延迟一小段时间后全选文本,确保焦点稳定 + editText.postDelayed(() -> { + if (editText.hasFocus()) { + editText.selectAll(); + } + }, 100); + } + }); + + // 新增:编辑完成时自动隐藏光标 + editText.setOnEditorActionListener((v, actionId, event) -> { + editText.setCursorVisible(false); + editText.clearFocus(); + InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); + if (imm != null) { + imm.hideSoftInputFromWindow(editText.getWindowToken(), 0); + } + return false; + }); + + // 新增:点击编辑框时也全选文本(作为焦点变化的补充) + editText.setOnClickListener(v -> { + if (editText.hasFocus()) { + editText.postDelayed(() -> { + if (editText.hasFocus()) { + editText.selectAll(); + } + }, 100); + } + }); + } + + /** + * 验证并限制参数值范围 + */ + private String validateAndLimitValue(String paramName, String value) { + try { + double numValue = Double.parseDouble(value); + + switch (paramName) { + case "RobotChgLength": + // 换道长度限制在0-1000 + int length = Math.max(0, Math.min(1000, (int) Math.round(numValue))); + return String.valueOf(length); + + case "RobotManualSpeed": + case "RobotAutoSpeed": + // 速度限制在 0-30 范围内 + double speed = Math.max(0, Math.min(30, numValue)); + // 保留一位小数 + return (speed == (int)speed) ? String.valueOf((int)speed) : String.format(Locale.getDefault(),"%.1f", speed); + + case "RobotForce": + // 压力限制在 300-3000 范围内 + int force = Math.max(300, Math.min(3000, (int) Math.round(numValue))); + return String.valueOf(force); + + default: + return value; + } + } catch (NumberFormatException e) { + // 如果解析失败,返回默认值 + return getDefaultValue(paramName); + } + } + + /** + * 获取参数的默认值 + */ + private String getDefaultValue(String paramName) { + switch (paramName) { + case "RobotChgLength": return "100"; + case "RobotManualSpeed": return "8"; + case "RobotAutoSpeed": return "20"; + case "RobotForce": return "300"; + default: return "0"; + } + } + + /** + * 显示范围限制提示对话框 + */ + private void showRangeLimitDialog(String paramName, String originalValue, String adjustedValue) { + runOnUiThread(() -> { + String paramDisplayName = getParamDisplayName(paramName); + String rangeInfo = getRangeInfo(paramName); + + String message = String.format("输入值 %s 已调整为 %s\n%s", + originalValue, adjustedValue, rangeInfo); + + new AlertDialog.Builder(this) + .setTitle(paramDisplayName + " 调整提示") + .setMessage(message) + .setPositiveButton("确定", null) + .show(); + }); + } + + /** + * 获取参数显示名称 + */ + private String getParamDisplayName(String paramName) { + switch (paramName) { + case "RobotChgLength": return "换道长度"; + case "RobotManualSpeed": return "手动速度"; + case "RobotAutoSpeed": return "自动速度"; + case "RobotForce": return "压力值"; + default: return paramName; + } + } + + /** + * 获取参数范围信息 + */ + private String getRangeInfo(String paramName) { + switch (paramName) { + case "RobotChgLength": return "有效范围:0 — 1000"; + case "RobotManualSpeed": + case "RobotAutoSpeed": return "有效范围:0 - 30"; + case "RobotForce": return "有效范围:300 - 3000"; + default: return ""; + } + } + + // 安全取值,防止 Timer 崩溃 + private int getSafeInt(@NonNull EditText editText) { + String text = editText.getText().toString().trim(); + if (text.isEmpty()) return 0; + try { + return Integer.parseInt(text); + } catch (NumberFormatException e) { + return 0; + } + } + + private double getSafeDouble(@NonNull EditText editText) { + String text = editText.getText().toString().trim(); + if (text.isEmpty()) return 0.0; + try { + return Double.parseDouble(text); + } catch (NumberFormatException e) { + return 0.0; + } + } + + Timer timer = new Timer(); + //-- + public MainActivity() { + robotRMACM = RobotRMACM.RMACM.newBuilder().setRobotSpeed(0).setLightBrightness(0).build(); + } + + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + //MainViewModel binding region + mainBinding = DataBindingUtil.setContentView(this,R.layout.activity_main); + MainViewModel vm=new ViewModelProvider(this).get(MainViewModel.class); + MainViewModel.mainBinding=mainBinding; + mainBinding.btnShowLogs.setOnClickListener(v -> showLogsDialog()); + mainBinding.setVm(vm); + + // 设置左右换道按钮的点击监听器 + mainBinding.btnLeftLaneChange.setOnClickListener(v -> { + setLaneChangeDirection(0); // 左换道 + updateButtonStyles(); + saveOperationLog("切换至左换道"); + }); + + mainBinding.btnRightLaneChange.setOnClickListener(v -> { + setLaneChangeDirection(1); // 右换道 + updateButtonStyles(); + saveOperationLog("切换至右换道"); + }); + + // 初始化按钮样式 + updateButtonStyles(); + + setupDecimalEditText(mainBinding.tvRobotChgLength, "RobotChgLength"); + setupDecimalEditText(mainBinding.tvRobotManualSpeed, "RobotManualSpeed"); + setupDecimalEditText(mainBinding.tvRobotAutoSpeed, "RobotAutoSpeed"); + setupDecimalEditText(mainBinding.tvRobotForce, "RobotForce"); + + + // 保存参数 + SharedPreferences sharedPreferences = getSharedPreferences("MyData", Context.MODE_PRIVATE); + String Str_RobotChgLength = sharedPreferences.getString("RobotChgLength", "100"); + String Str_RobotLeftCompensation = sharedPreferences.getString("RobotLeftCompensation", "0"); + String Str_RobotRightCompensation = sharedPreferences.getString("RobotRightCompensation", "0"); + String Str_RobotManualSpeed = sharedPreferences.getString("RobotManualSpeed", "8"); + String Str_RobotAutoSpeed = sharedPreferences.getString("RobotAutoSpeed", "20"); + String Str_RobotForce = sharedPreferences.getString("RobotForce", "300"); + + mainBinding.rFAngleRoll.setText(String.valueOf(0)); + mainBinding.tvRobotError.setText(String.valueOf(0)); + mainBinding.tvRobotChgLength.setText(Str_RobotChgLength); + mainBinding.tvRobotLeftCompensation.setText(Str_RobotLeftCompensation); + mainBinding.tvRobotRightCompensation.setText(Str_RobotRightCompensation); + mainBinding.tvForce.setText(String.valueOf(0)); + mainBinding.tvRobotManualSpeed.setText(Str_RobotManualSpeed); + mainBinding.tvRobotAutoSpeed.setText(Str_RobotAutoSpeed); + mainBinding.tvRobotCurrent.setText(String.valueOf(0)); + mainBinding.tvDynamometer.setText(String.valueOf(0)); + mainBinding.tvRobotForce.setText(Str_RobotForce); + + /* 删除15天前旧日志*/ + deleteOldLogs(); + + /* USB串口 控制区域*/ + ttySerialPortHelper.MainActivity = this; + ttySerialPortHelper.Open(); + +// /* NodePlayer 播放视频区域*/ +// NodePlayer nodePlayer0=new NodePlayer(this); +// // NodePlayer nodePlayer1=new NodePlayer(this); +// +// //String address0 = "rtsp://192.168.1.168:8554/0"; +// // String address1 = "rtsp://192.168.1.169:8554/0"; +// +// //String addressTest = "rtsp://rtspstream:yEhp9qzAqveM9kHIE7GcL@zephyr.rtsp.stream/movie"; +// String address0 = "rtsp://192.168.144.25:8554/main.264"; +// /**/ +// //VideoPlayerHelper.startVideo(mainBinding.nodePlayerView0,nodePlayer0,address0);不涉及摄像头 +// // VideoPlayerHelper.startVideo(mainBinding.nodePlayerView1,nodePlayer1,address1); +// //VideoPlayerHelper.startVideo(mainBinding.nodePlayerView1,nodePlayer1,addressTest); + + startSending(); + } + + // 设置换道方向 + private void setLaneChangeDirection(int direction) { + laneChangeDirection = direction; + isLeftLaneChangeActive = (direction == 0); + isRightLaneChangeActive = (direction == 1); + } + + // 更新按钮样式 + private void updateButtonStyles() { + // 左换道按钮样式 + if (isLeftLaneChangeActive) { + mainBinding.btnLeftLaneChange.setTextColor(ContextCompat.getColor(this, R.color.mediumvioletred)); // 高亮色 + mainBinding.btnLeftLaneChange.setBackgroundResource(R.drawable.blue_rounded_rectangle); + } else { + mainBinding.btnLeftLaneChange.setTextColor(ContextCompat.getColor(this, R.color.deepskyblue)); // 默认色 + mainBinding.btnLeftLaneChange.setBackgroundResource(R.drawable.blue_rounded_rectangle); + } + + // 右换道按钮样式 + if (isRightLaneChangeActive) { + mainBinding.btnRightLaneChange.setTextColor(ContextCompat.getColor(this, R.color.mediumvioletred)); + mainBinding.btnRightLaneChange.setBackgroundResource(R.drawable.blue_rounded_rectangle); + } else { + mainBinding.btnRightLaneChange.setTextColor(ContextCompat.getColor(this, R.color.deepskyblue)); + mainBinding.btnRightLaneChange.setBackgroundResource(R.drawable.blue_rounded_rectangle); + } + } + + // Create a Timer instance + + @Override + protected void onStart() { + super.onStart(); + + // serialPortHelper.onStart(); + + } + @Override + public void onStop() + { + super.onStop(); + } + + @Override + public void onResume() + { + super.onResume(); + // serialPortHelper.onResume(); + //新增 + startSending(); + } + + @Override + public void onPause() { + super.onPause(); + stopSending(); + + SharedPreferences sharedPreferences = getSharedPreferences("MyData", Context.MODE_PRIVATE); + SharedPreferences.Editor editor = sharedPreferences.edit(); + + // 添加空值检查 + String chgLength = String.valueOf(mainBinding.tvRobotChgLength.getText()); + if (chgLength.isEmpty()) chgLength = "100"; + + String leftComp = String.valueOf(mainBinding.tvRobotLeftCompensation.getText()); + if (leftComp.isEmpty()) leftComp = "0"; + + String rightComp = String.valueOf(mainBinding.tvRobotRightCompensation.getText()); + if (rightComp.isEmpty()) rightComp = "0"; + + String manualSpeed = String.valueOf(mainBinding.tvRobotManualSpeed.getText()); + if (manualSpeed.isEmpty()) manualSpeed = "8"; + + String autoSpeed = String.valueOf(mainBinding.tvRobotAutoSpeed.getText()); + if (autoSpeed.isEmpty()) autoSpeed = "20"; + + String force = String.valueOf(mainBinding.tvRobotForce.getText()); + if (force.isEmpty()) force = "300"; + + editor.putString("RobotChgLength", chgLength); + editor.putString("RobotLeftCompensation", leftComp); + editor.putString("RobotRightCompensation", rightComp); + editor.putString("RobotManualSpeed", manualSpeed); + editor.putString("RobotAutoSpeed", autoSpeed); + editor.putString("RobotForce", force); + editor.apply(); + } + @Override + protected void onDestroy() { + super.onDestroy(); + if (timer != null) { + timer.cancel(); + } + } + private TimerTask sendTask; + //新增 + private void startSending() { + stopSending(); + if (timer == null) { + timer = new Timer(); + sendTask = new TimerTask() { + @Override + public void run() { + try { + // 获取当前编辑框的值 + int chgLength = getSafeInt(mainBinding.tvRobotChgLength); + double manualSpeed = getSafeDouble(mainBinding.tvRobotManualSpeed); + double autoSpeed = getSafeDouble(mainBinding.tvRobotAutoSpeed); + int force = getSafeInt(mainBinding.tvRobotForce); + + // 在发送前进行范围限制 + chgLength = Math.max(0, Math.min(1000, chgLength)); + manualSpeed = Math.max(0, Math.min(30, manualSpeed)); + autoSpeed = Math.max(0, Math.min(30, autoSpeed)); + force = Math.max(300, Math.min(3000, force)); + + _toSendPV = BspPV.PV_struct_define.newBuilder() + .setRobotChgLength(chgLength) + .setRobotAutoSpeedBase(autoSpeed) + .setRobotManualSpeedBase(manualSpeed) + .setRobotLaneChangeDirection(laneChangeDirection) + .setRobotForce(force) + .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); + + ttySerialPortHelper.SendData(sendByteArray3); + + runOnUiThread(() -> checkMotorErrors()); + } catch (Exception e) { + android.util.Log.e("MainActivity", "Error in startSending timer task", e); + } + } + }; + timer.schedule(sendTask, 0, 1000); + } + } + + private void stopSending() { + try { + if (sendTask != null) { + sendTask.cancel(); + sendTask = null; + } + if (timer != null) { + timer.cancel(); + timer.purge(); + timer = null; + } + } catch (Exception ignored) {} + } + + private void saveMotorError(String motorSide, String errorMsg) { + new Thread(() -> { + AppDatabase db = AppDatabase.getInstance(this); + RobotLog log = new RobotLog(); + log.type = "error"; + log.message = motorSide + " 电机报错: " + errorMsg; + log.time = System.currentTimeMillis(); + db.robotLogDao().insert(log); + }).start(); + } + + + private String lastLeftError = "xxx"; + private String lastRightError = "xxx"; + + private void checkMotorErrors() { + String currentLeftError = mainBinding.tvLeftError.getText().toString().trim(); + String currentRightError = mainBinding.tvRightError.getText().toString().trim(); + + // 左电机状态变化且不正常时保存日志 + if (!currentLeftError.equals("正常") && !currentLeftError.equals(lastLeftError)) { + saveMotorError("左电机", currentLeftError); + } + lastLeftError = currentLeftError; + + // 右电机状态变化且不正常时保存日志 + if (!currentRightError.equals("正常") && !currentRightError.equals(lastRightError)) { + saveMotorError("右电机", currentRightError); + } + lastRightError = currentRightError; + } + + + // 启用参数设定区域 + public void enableParameterArea() { + runOnUiThread(() -> { + mainBinding.setLayout.setEnabled(true); + for (int i = 0; i < mainBinding.setLayout.getChildCount(); i++) { + View child = mainBinding.setLayout.getChildAt(i); + child.setEnabled(true); + child.setAlpha(1.0f); + } + }); + } + + // 禁用参数设定区域 + public void disableParameterArea() { + runOnUiThread(() -> { + mainBinding.setLayout.setEnabled(false); + for (int i = 0; i < mainBinding.setLayout.getChildCount(); i++) { + View child = mainBinding.setLayout.getChildAt(i); + child.setEnabled(false); + child.setAlpha(0.5f); + } + }); + } + + private void saveParamChange(String paramName, String newValue) { + new Thread(() -> { + AppDatabase db = AppDatabase.getInstance(this); + RobotLog log = new RobotLog(); + log.type = "param_change"; + log.message = paramName + " 修改为 " + newValue; + log.time = System.currentTimeMillis(); + db.robotLogDao().insert(log); + }).start(); + } + + private void saveOperationLog(String operation) { + new Thread(() -> { + AppDatabase db = AppDatabase.getInstance(this); + RobotLog log = new RobotLog(); + log.type = "operation"; + log.message = operation; + log.time = System.currentTimeMillis(); + db.robotLogDao().insert(log); + }).start(); + } + + private void showLogsDialog() { + new Thread(() -> { + AppDatabase db = AppDatabase.getInstance(this); + List logs = db.robotLogDao().getAllLogs(); + + StringBuilder sb = new StringBuilder(); + for (RobotLog log : logs) { + sb.append("[").append(android.text.format.DateFormat.format("yyyy-MM-dd HH:mm:ss", log.time)).append("] "); + sb.append(log.type).append(": ").append(log.message).append("\n"); + } + + String logContent = sb.toString(); + + runOnUiThread(() -> { + // 创建 Dialog + AlertDialog.Builder builder = new AlertDialog.Builder(this); + builder.setTitle("日志信息"); + + // 使用自定义布局 + View dialogView = getLayoutInflater().inflate(R.layout.dialog_logs, null); + TextView tvLogs = dialogView.findViewById(R.id.tv_logs_content); + tvLogs.setText(logContent.isEmpty() ? "暂无日志" : logContent); + + builder.setView(dialogView) + .setPositiveButton("关闭", null) + .show(); + }); + }).start(); + } + + private void deleteOldLogs() { + new Thread(() -> { + AppDatabase db = AppDatabase.getInstance(this); + long thirtyDaysAgo = System.currentTimeMillis() - 15L * 24 * 60 * 60 * 1000; // 15天前时间戳 + db.robotLogDao().deleteLogsBefore(thirtyDaysAgo); + }).start(); + } + + +} \ No newline at end of file diff --git a/app/src/main/java/com/example/removemarineanimals/RobotLog.java b/app/src/main/java/com/example/removemarineanimals/RobotLog.java new file mode 100644 index 0000000..c0bf6dd --- /dev/null +++ b/app/src/main/java/com/example/removemarineanimals/RobotLog.java @@ -0,0 +1,20 @@ +package com.example.removemarineanimals; + +import androidx.room.ColumnInfo; +import androidx.room.Entity; +import androidx.room.PrimaryKey; + +@Entity(tableName = "robot_logs") +public class RobotLog { + @PrimaryKey(autoGenerate = true) + public int id; + + @ColumnInfo(name = "type") // "error" 或 "param_change" + public String type; + + @ColumnInfo(name = "message") // 具体信息:报错内容或修改了哪个参数 + public String message; + + @ColumnInfo(name = "time") // 时间戳 + public long time; +} diff --git a/app/src/main/java/com/example/removemarineanimals/RobotLogDao.java b/app/src/main/java/com/example/removemarineanimals/RobotLogDao.java new file mode 100644 index 0000000..9fedc39 --- /dev/null +++ b/app/src/main/java/com/example/removemarineanimals/RobotLogDao.java @@ -0,0 +1,22 @@ +package com.example.removemarineanimals; + +import androidx.room.Dao; +import androidx.room.Insert; +import androidx.room.Query; + +import java.util.List; + +@Dao +public interface RobotLogDao { + + @Insert + void insert(RobotLog log); + + + @Query("SELECT * FROM robot_logs ORDER BY time DESC") + List getAllLogs(); + + @Query("DELETE FROM robot_logs WHERE time < :timeLimit") + void deleteLogsBefore(long timeLimit); + +} diff --git a/app/src/main/java/com/example/removemarineanimals/models/BspError.java b/app/src/main/java/com/example/removemarineanimals/models/BspError.java new file mode 100644 index 0000000..a7010bd --- /dev/null +++ b/app/src/main/java/com/example/removemarineanimals/models/BspError.java @@ -0,0 +1,815 @@ +// 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.removemarineanimals.models; + +public final class BspError { + private BspError() {} + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 27, + /* patch= */ 2, + /* suffix= */ "", + BspError.class.getName()); + } + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistryLite registry) { + } + + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistry registry) { + registerAllExtensions( + (com.google.protobuf.ExtensionRegistryLite) registry); + } + /** + * Protobuf enum {@code ComError} + */ + public enum ComError + implements com.google.protobuf.ProtocolMessageEnum { + /** + * MK32_SBus = 0; + */ + MK32_SBus(0), + /** + * TL720D = 1; + */ + TL720D(1), + /** + * Force_sensor = 2; + */ + Force_sensor(2), + /** + * ZQ_LeftMotor = 3; + */ + ZQ_LeftMotor(3), + /** + * ZQ_RightMotor = 4; + */ + ZQ_RightMotor(4), + /** + * DMAKE_1 = 5; + */ + DMAKE_1(5), + /** + *
+     * DMAKE_2 		=	6;
+     * DMAKE_3 		=	7;
+     * 
+ * + * MK32_Serial = 6; + */ + MK32_Serial(6), + UNRECOGNIZED(-1), + ; + + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 27, + /* patch= */ 2, + /* suffix= */ "", + ComError.class.getName()); + } + /** + * MK32_SBus = 0; + */ + public static final int MK32_SBus_VALUE = 0; + /** + * TL720D = 1; + */ + public static final int TL720D_VALUE = 1; + /** + * Force_sensor = 2; + */ + public static final int Force_sensor_VALUE = 2; + /** + * ZQ_LeftMotor = 3; + */ + public static final int ZQ_LeftMotor_VALUE = 3; + /** + * ZQ_RightMotor = 4; + */ + public static final int ZQ_RightMotor_VALUE = 4; + /** + * DMAKE_1 = 5; + */ + public static final int DMAKE_1_VALUE = 5; + /** + *
+     * DMAKE_2 		=	6;
+     * DMAKE_3 		=	7;
+     * 
+ * + * MK32_Serial = 6; + */ + public static final int MK32_Serial_VALUE = 6; + + + public final int getNumber() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalArgumentException( + "Can't get the number of an unknown enum value."); + } + return value; + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static ComError valueOf(int value) { + return forNumber(value); + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + */ + public static ComError forNumber(int value) { + switch (value) { + case 0: return MK32_SBus; + case 1: return TL720D; + case 2: return Force_sensor; + case 3: return ZQ_LeftMotor; + case 4: return ZQ_RightMotor; + case 5: return DMAKE_1; + case 6: return MK32_Serial; + 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.removemarineanimals.models.BspError.getDescriptor().getEnumTypes().get(0); + } + + private static final ComError[] VALUES = values(); + + public static ComError valueOf( + com.google.protobuf.Descriptors.EnumValueDescriptor desc) { + if (desc.getType() != getDescriptor()) { + throw new java.lang.IllegalArgumentException( + "EnumValueDescriptor is not for this type."); + } + if (desc.getIndex() == -1) { + return UNRECOGNIZED; + } + return VALUES[desc.getIndex()]; + } + + private final int value; + + private ComError(int value) { + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:ComError) + } + + public interface ErrorDataOrBuilder extends + // @@protoc_insertion_point(interface_extends:ErrorData) + com.google.protobuf.MessageOrBuilder { + + /** + * int32 Com_Error_Code = 1; + * @return The comErrorCode. + */ + int getComErrorCode(); + + /** + * int32 Left_Motor_Error_Code = 2; + * @return The leftMotorErrorCode. + */ + int getLeftMotorErrorCode(); + + /** + * int32 Right_Motor_Error_Code = 3; + * @return The rightMotorErrorCode. + */ + int getRightMotorErrorCode(); + } + /** + * Protobuf type {@code ErrorData} + */ + public static final class ErrorData extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:ErrorData) + ErrorDataOrBuilder { + private static final long serialVersionUID = 0L; + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 27, + /* patch= */ 2, + /* suffix= */ "", + ErrorData.class.getName()); + } + // Use ErrorData.newBuilder() to construct. + private ErrorData(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + private ErrorData() { + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.example.removemarineanimals.models.BspError.internal_static_ErrorData_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.example.removemarineanimals.models.BspError.internal_static_ErrorData_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.example.removemarineanimals.models.BspError.ErrorData.class, com.example.removemarineanimals.models.BspError.ErrorData.Builder.class); + } + + public static final int COM_ERROR_CODE_FIELD_NUMBER = 1; + private int comErrorCode_ = 0; + /** + * int32 Com_Error_Code = 1; + * @return The comErrorCode. + */ + @java.lang.Override + public int getComErrorCode() { + return comErrorCode_; + } + + public static final int LEFT_MOTOR_ERROR_CODE_FIELD_NUMBER = 2; + private int leftMotorErrorCode_ = 0; + /** + * int32 Left_Motor_Error_Code = 2; + * @return The leftMotorErrorCode. + */ + @java.lang.Override + public int getLeftMotorErrorCode() { + return leftMotorErrorCode_; + } + + public static final int RIGHT_MOTOR_ERROR_CODE_FIELD_NUMBER = 3; + private int rightMotorErrorCode_ = 0; + /** + * int32 Right_Motor_Error_Code = 3; + * @return The rightMotorErrorCode. + */ + @java.lang.Override + public int getRightMotorErrorCode() { + return rightMotorErrorCode_; + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (comErrorCode_ != 0) { + output.writeInt32(1, comErrorCode_); + } + if (leftMotorErrorCode_ != 0) { + output.writeInt32(2, leftMotorErrorCode_); + } + if (rightMotorErrorCode_ != 0) { + output.writeInt32(3, rightMotorErrorCode_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (comErrorCode_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(1, comErrorCode_); + } + if (leftMotorErrorCode_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(2, leftMotorErrorCode_); + } + if (rightMotorErrorCode_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(3, rightMotorErrorCode_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.example.removemarineanimals.models.BspError.ErrorData)) { + return super.equals(obj); + } + com.example.removemarineanimals.models.BspError.ErrorData other = (com.example.removemarineanimals.models.BspError.ErrorData) obj; + + if (getComErrorCode() + != other.getComErrorCode()) return false; + if (getLeftMotorErrorCode() + != other.getLeftMotorErrorCode()) return false; + if (getRightMotorErrorCode() + != other.getRightMotorErrorCode()) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + COM_ERROR_CODE_FIELD_NUMBER; + hash = (53 * hash) + getComErrorCode(); + hash = (37 * hash) + LEFT_MOTOR_ERROR_CODE_FIELD_NUMBER; + hash = (53 * hash) + getLeftMotorErrorCode(); + hash = (37 * hash) + RIGHT_MOTOR_ERROR_CODE_FIELD_NUMBER; + hash = (53 * hash) + getRightMotorErrorCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.example.removemarineanimals.models.BspError.ErrorData parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.example.removemarineanimals.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.removemarineanimals.models.BspError.ErrorData parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.example.removemarineanimals.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.removemarineanimals.models.BspError.ErrorData parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.example.removemarineanimals.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.removemarineanimals.models.BspError.ErrorData parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static com.example.removemarineanimals.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.removemarineanimals.models.BspError.ErrorData parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input); + } + + public static com.example.removemarineanimals.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.removemarineanimals.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.removemarineanimals.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.removemarineanimals.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.removemarineanimals.models.BspError.ErrorDataOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.example.removemarineanimals.models.BspError.internal_static_ErrorData_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.example.removemarineanimals.models.BspError.internal_static_ErrorData_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.example.removemarineanimals.models.BspError.ErrorData.class, com.example.removemarineanimals.models.BspError.ErrorData.Builder.class); + } + + // Construct using com.example.removemarineanimals.models.BspError.ErrorData.newBuilder() + private Builder() { + + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + comErrorCode_ = 0; + leftMotorErrorCode_ = 0; + rightMotorErrorCode_ = 0; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.example.removemarineanimals.models.BspError.internal_static_ErrorData_descriptor; + } + + @java.lang.Override + public com.example.removemarineanimals.models.BspError.ErrorData getDefaultInstanceForType() { + return com.example.removemarineanimals.models.BspError.ErrorData.getDefaultInstance(); + } + + @java.lang.Override + public com.example.removemarineanimals.models.BspError.ErrorData build() { + com.example.removemarineanimals.models.BspError.ErrorData result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.example.removemarineanimals.models.BspError.ErrorData buildPartial() { + com.example.removemarineanimals.models.BspError.ErrorData result = new com.example.removemarineanimals.models.BspError.ErrorData(this); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartial0(com.example.removemarineanimals.models.BspError.ErrorData result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.comErrorCode_ = comErrorCode_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.leftMotorErrorCode_ = leftMotorErrorCode_; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.rightMotorErrorCode_ = rightMotorErrorCode_; + } + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.example.removemarineanimals.models.BspError.ErrorData) { + return mergeFrom((com.example.removemarineanimals.models.BspError.ErrorData)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.example.removemarineanimals.models.BspError.ErrorData other) { + if (other == com.example.removemarineanimals.models.BspError.ErrorData.getDefaultInstance()) return this; + if (other.getComErrorCode() != 0) { + setComErrorCode(other.getComErrorCode()); + } + if (other.getLeftMotorErrorCode() != 0) { + setLeftMotorErrorCode(other.getLeftMotorErrorCode()); + } + if (other.getRightMotorErrorCode() != 0) { + setRightMotorErrorCode(other.getRightMotorErrorCode()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: { + comErrorCode_ = input.readInt32(); + bitField0_ |= 0x00000001; + break; + } // case 8 + case 16: { + leftMotorErrorCode_ = input.readInt32(); + bitField0_ |= 0x00000002; + break; + } // case 16 + case 24: { + rightMotorErrorCode_ = input.readInt32(); + bitField0_ |= 0x00000004; + break; + } // case 24 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int bitField0_; + + private int comErrorCode_ ; + /** + * int32 Com_Error_Code = 1; + * @return The comErrorCode. + */ + @java.lang.Override + public int getComErrorCode() { + return comErrorCode_; + } + /** + * int32 Com_Error_Code = 1; + * @param value The comErrorCode to set. + * @return This builder for chaining. + */ + public Builder setComErrorCode(int value) { + + comErrorCode_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * int32 Com_Error_Code = 1; + * @return This builder for chaining. + */ + public Builder clearComErrorCode() { + bitField0_ = (bitField0_ & ~0x00000001); + comErrorCode_ = 0; + onChanged(); + return this; + } + + private int leftMotorErrorCode_ ; + /** + * int32 Left_Motor_Error_Code = 2; + * @return The leftMotorErrorCode. + */ + @java.lang.Override + public int getLeftMotorErrorCode() { + return leftMotorErrorCode_; + } + /** + * int32 Left_Motor_Error_Code = 2; + * @param value The leftMotorErrorCode to set. + * @return This builder for chaining. + */ + public Builder setLeftMotorErrorCode(int value) { + + leftMotorErrorCode_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * int32 Left_Motor_Error_Code = 2; + * @return This builder for chaining. + */ + public Builder clearLeftMotorErrorCode() { + bitField0_ = (bitField0_ & ~0x00000002); + leftMotorErrorCode_ = 0; + onChanged(); + return this; + } + + private int rightMotorErrorCode_ ; + /** + * int32 Right_Motor_Error_Code = 3; + * @return The rightMotorErrorCode. + */ + @java.lang.Override + public int getRightMotorErrorCode() { + return rightMotorErrorCode_; + } + /** + * int32 Right_Motor_Error_Code = 3; + * @param value The rightMotorErrorCode to set. + * @return This builder for chaining. + */ + public Builder setRightMotorErrorCode(int value) { + + rightMotorErrorCode_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * int32 Right_Motor_Error_Code = 3; + * @return This builder for chaining. + */ + public Builder clearRightMotorErrorCode() { + bitField0_ = (bitField0_ & ~0x00000004); + rightMotorErrorCode_ = 0; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:ErrorData) + } + + // @@protoc_insertion_point(class_scope:ErrorData) + private static final com.example.removemarineanimals.models.BspError.ErrorData DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.example.removemarineanimals.models.BspError.ErrorData(); + } + + public static com.example.removemarineanimals.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.removemarineanimals.models.BspError.ErrorData getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + + } + + private static final com.google.protobuf.Descriptors.Descriptor + internal_static_ErrorData_descriptor; + private static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_ErrorData_fieldAccessorTable; + + public static com.google.protobuf.Descriptors.FileDescriptor + getDescriptor() { + return descriptor; + } + private static com.google.protobuf.Descriptors.FileDescriptor + descriptor; + static { + java.lang.String[] descriptorData = { + "\n\017bsp_Error.proto\"b\n\tErrorData\022\026\n\016Com_Er" + + "ror_Code\030\001 \001(\005\022\035\n\025Left_Motor_Error_Code\030" + + "\002 \001(\005\022\036\n\026Right_Motor_Error_Code\030\003 \001(\005*z\n" + + "\010ComError\022\r\n\tMK32_SBus\020\000\022\n\n\006TL720D\020\001\022\020\n\014" + + "Force_sensor\020\002\022\020\n\014ZQ_LeftMotor\020\003\022\021\n\rZQ_R" + + "ightMotor\020\004\022\013\n\007DMAKE_1\020\005\022\017\n\013MK32_Serial\020" + + "\006B*\n&com.example.removemarineanimals.mod" + + "elsP\000b\006proto3" + }; + descriptor = com.google.protobuf.Descriptors.FileDescriptor + .internalBuildGeneratedFileFrom(descriptorData, + new com.google.protobuf.Descriptors.FileDescriptor[] { + }); + internal_static_ErrorData_descriptor = + getDescriptor().getMessageTypes().get(0); + internal_static_ErrorData_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_ErrorData_descriptor, + new java.lang.String[] { "ComErrorCode", "LeftMotorErrorCode", "RightMotorErrorCode", }); + descriptor.resolveAllFeaturesImmutable(); + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/app/src/main/java/com/example/removemarineanimals/models/BspIV.java b/app/src/main/java/com/example/removemarineanimals/models/BspIV.java new file mode 100644 index 0000000..84e50a3 --- /dev/null +++ b/app/src/main/java/com/example/removemarineanimals/models/BspIV.java @@ -0,0 +1,1532 @@ +// 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.removemarineanimals.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 { + + /** + *
+     * 五轮项目
+     * 
+ * + * int32 Robot_Move_AutoSpeed = 1; + * @return The robotMoveAutoSpeed. + */ + int getRobotMoveAutoSpeed(); + + /** + * int32 Robot_Move_ManualSpeed = 2; + * @return The robotMoveManualSpeed. + */ + int getRobotMoveManualSpeed(); + + /** + * int32 Robot_CurrentPosition = 3; + * @return The robotCurrentPosition. + */ + int getRobotCurrentPosition(); + + /** + * int32 Robot_AngleRoll = 4; + * @return The robotAngleRoll. + */ + int getRobotAngleRoll(); + + /** + * int32 Robot_Error = 5; + * @return The robotError. + */ + int getRobotError(); + + /** + * int32 Robot_DynamometerValue = 6; + * @return The robotDynamometerValue. + */ + int getRobotDynamometerValue(); + + /** + * int32 Robot_ForceValue = 7; + * @return The robotForceValue. + */ + int getRobotForceValue(); + + /** + * int32 Robot_CurrentState = 8; + * @return The robotCurrentState. + */ + int getRobotCurrentState(); + + /** + * int32 Robot_Current_Left = 9; + * @return The robotCurrentLeft. + */ + int getRobotCurrentLeft(); + + /** + * int32 Robot_Current_Right = 10; + * @return The robotCurrentRight. + */ + int getRobotCurrentRight(); + + /** + * int32 Robot_Error_Left = 11; + * @return The robotErrorLeft. + */ + int getRobotErrorLeft(); + + /** + * int32 Robot_Error_Right = 12; + * @return The robotErrorRight. + */ + int getRobotErrorRight(); + + /** + * int32 Robot_Compensation_Left = 13; + * @return The robotCompensationLeft. + */ + int getRobotCompensationLeft(); + + /** + * int32 Robot_Compensation_Right = 14; + * @return The robotCompensationRight. + */ + int getRobotCompensationRight(); + + /** + * int32 Robot_RESET = 15; + * @return The robotRESET. + */ + int getRobotRESET(); + } + /** + * 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.removemarineanimals.models.BspIV.internal_static_IV_struct_define_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.example.removemarineanimals.models.BspIV.internal_static_IV_struct_define_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.example.removemarineanimals.models.BspIV.IV_struct_define.class, com.example.removemarineanimals.models.BspIV.IV_struct_define.Builder.class); + } + + public static final int ROBOT_MOVE_AUTOSPEED_FIELD_NUMBER = 1; + private int robotMoveAutoSpeed_ = 0; + /** + *
+     * 五轮项目
+     * 
+ * + * int32 Robot_Move_AutoSpeed = 1; + * @return The robotMoveAutoSpeed. + */ + @java.lang.Override + public int getRobotMoveAutoSpeed() { + return robotMoveAutoSpeed_; + } + + public static final int ROBOT_MOVE_MANUALSPEED_FIELD_NUMBER = 2; + private int robotMoveManualSpeed_ = 0; + /** + * int32 Robot_Move_ManualSpeed = 2; + * @return The robotMoveManualSpeed. + */ + @java.lang.Override + public int getRobotMoveManualSpeed() { + return robotMoveManualSpeed_; + } + + public static final int ROBOT_CURRENTPOSITION_FIELD_NUMBER = 3; + private int robotCurrentPosition_ = 0; + /** + * int32 Robot_CurrentPosition = 3; + * @return The robotCurrentPosition. + */ + @java.lang.Override + public int getRobotCurrentPosition() { + return robotCurrentPosition_; + } + + public static final int ROBOT_ANGLEROLL_FIELD_NUMBER = 4; + private int robotAngleRoll_ = 0; + /** + * int32 Robot_AngleRoll = 4; + * @return The robotAngleRoll. + */ + @java.lang.Override + public int getRobotAngleRoll() { + return robotAngleRoll_; + } + + public static final int ROBOT_ERROR_FIELD_NUMBER = 5; + private int robotError_ = 0; + /** + * int32 Robot_Error = 5; + * @return The robotError. + */ + @java.lang.Override + public int getRobotError() { + return robotError_; + } + + public static final int ROBOT_DYNAMOMETERVALUE_FIELD_NUMBER = 6; + private int robotDynamometerValue_ = 0; + /** + * int32 Robot_DynamometerValue = 6; + * @return The robotDynamometerValue. + */ + @java.lang.Override + public int getRobotDynamometerValue() { + return robotDynamometerValue_; + } + + public static final int ROBOT_FORCEVALUE_FIELD_NUMBER = 7; + private int robotForceValue_ = 0; + /** + * int32 Robot_ForceValue = 7; + * @return The robotForceValue. + */ + @java.lang.Override + public int getRobotForceValue() { + return robotForceValue_; + } + + public static final int ROBOT_CURRENTSTATE_FIELD_NUMBER = 8; + private int robotCurrentState_ = 0; + /** + * int32 Robot_CurrentState = 8; + * @return The robotCurrentState. + */ + @java.lang.Override + public int getRobotCurrentState() { + return robotCurrentState_; + } + + public static final int ROBOT_CURRENT_LEFT_FIELD_NUMBER = 9; + private int robotCurrentLeft_ = 0; + /** + * int32 Robot_Current_Left = 9; + * @return The robotCurrentLeft. + */ + @java.lang.Override + public int getRobotCurrentLeft() { + return robotCurrentLeft_; + } + + public static final int ROBOT_CURRENT_RIGHT_FIELD_NUMBER = 10; + private int robotCurrentRight_ = 0; + /** + * int32 Robot_Current_Right = 10; + * @return The robotCurrentRight. + */ + @java.lang.Override + public int getRobotCurrentRight() { + return robotCurrentRight_; + } + + public static final int ROBOT_ERROR_LEFT_FIELD_NUMBER = 11; + private int robotErrorLeft_ = 0; + /** + * int32 Robot_Error_Left = 11; + * @return The robotErrorLeft. + */ + @java.lang.Override + public int getRobotErrorLeft() { + return robotErrorLeft_; + } + + public static final int ROBOT_ERROR_RIGHT_FIELD_NUMBER = 12; + private int robotErrorRight_ = 0; + /** + * int32 Robot_Error_Right = 12; + * @return The robotErrorRight. + */ + @java.lang.Override + public int getRobotErrorRight() { + return robotErrorRight_; + } + + public static final int ROBOT_COMPENSATION_LEFT_FIELD_NUMBER = 13; + private int robotCompensationLeft_ = 0; + /** + * int32 Robot_Compensation_Left = 13; + * @return The robotCompensationLeft. + */ + @java.lang.Override + public int getRobotCompensationLeft() { + return robotCompensationLeft_; + } + + public static final int ROBOT_COMPENSATION_RIGHT_FIELD_NUMBER = 14; + private int robotCompensationRight_ = 0; + /** + * int32 Robot_Compensation_Right = 14; + * @return The robotCompensationRight. + */ + @java.lang.Override + public int getRobotCompensationRight() { + return robotCompensationRight_; + } + + public static final int ROBOT_RESET_FIELD_NUMBER = 15; + private int robotRESET_ = 0; + /** + * int32 Robot_RESET = 15; + * @return The robotRESET. + */ + @java.lang.Override + public int getRobotRESET() { + return robotRESET_; + } + + 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 (robotMoveAutoSpeed_ != 0) { + output.writeInt32(1, robotMoveAutoSpeed_); + } + if (robotMoveManualSpeed_ != 0) { + output.writeInt32(2, robotMoveManualSpeed_); + } + if (robotCurrentPosition_ != 0) { + output.writeInt32(3, robotCurrentPosition_); + } + if (robotAngleRoll_ != 0) { + output.writeInt32(4, robotAngleRoll_); + } + if (robotError_ != 0) { + output.writeInt32(5, robotError_); + } + if (robotDynamometerValue_ != 0) { + output.writeInt32(6, robotDynamometerValue_); + } + if (robotForceValue_ != 0) { + output.writeInt32(7, robotForceValue_); + } + if (robotCurrentState_ != 0) { + output.writeInt32(8, robotCurrentState_); + } + if (robotCurrentLeft_ != 0) { + output.writeInt32(9, robotCurrentLeft_); + } + if (robotCurrentRight_ != 0) { + output.writeInt32(10, robotCurrentRight_); + } + if (robotErrorLeft_ != 0) { + output.writeInt32(11, robotErrorLeft_); + } + if (robotErrorRight_ != 0) { + output.writeInt32(12, robotErrorRight_); + } + if (robotCompensationLeft_ != 0) { + output.writeInt32(13, robotCompensationLeft_); + } + if (robotCompensationRight_ != 0) { + output.writeInt32(14, robotCompensationRight_); + } + if (robotRESET_ != 0) { + output.writeInt32(15, robotRESET_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (robotMoveAutoSpeed_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(1, robotMoveAutoSpeed_); + } + if (robotMoveManualSpeed_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(2, robotMoveManualSpeed_); + } + if (robotCurrentPosition_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(3, robotCurrentPosition_); + } + if (robotAngleRoll_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(4, robotAngleRoll_); + } + if (robotError_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(5, robotError_); + } + if (robotDynamometerValue_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(6, robotDynamometerValue_); + } + if (robotForceValue_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(7, robotForceValue_); + } + if (robotCurrentState_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(8, robotCurrentState_); + } + if (robotCurrentLeft_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(9, robotCurrentLeft_); + } + if (robotCurrentRight_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(10, robotCurrentRight_); + } + if (robotErrorLeft_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(11, robotErrorLeft_); + } + if (robotErrorRight_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(12, robotErrorRight_); + } + if (robotCompensationLeft_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(13, robotCompensationLeft_); + } + if (robotCompensationRight_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(14, robotCompensationRight_); + } + if (robotRESET_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(15, robotRESET_); + } + 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.removemarineanimals.models.BspIV.IV_struct_define)) { + return super.equals(obj); + } + com.example.removemarineanimals.models.BspIV.IV_struct_define other = (com.example.removemarineanimals.models.BspIV.IV_struct_define) obj; + + if (getRobotMoveAutoSpeed() + != other.getRobotMoveAutoSpeed()) return false; + if (getRobotMoveManualSpeed() + != other.getRobotMoveManualSpeed()) return false; + if (getRobotCurrentPosition() + != other.getRobotCurrentPosition()) return false; + if (getRobotAngleRoll() + != other.getRobotAngleRoll()) return false; + if (getRobotError() + != other.getRobotError()) return false; + if (getRobotDynamometerValue() + != other.getRobotDynamometerValue()) return false; + if (getRobotForceValue() + != other.getRobotForceValue()) return false; + if (getRobotCurrentState() + != other.getRobotCurrentState()) return false; + if (getRobotCurrentLeft() + != other.getRobotCurrentLeft()) return false; + if (getRobotCurrentRight() + != other.getRobotCurrentRight()) return false; + if (getRobotErrorLeft() + != other.getRobotErrorLeft()) return false; + if (getRobotErrorRight() + != other.getRobotErrorRight()) return false; + if (getRobotCompensationLeft() + != other.getRobotCompensationLeft()) return false; + if (getRobotCompensationRight() + != other.getRobotCompensationRight()) return false; + if (getRobotRESET() + != other.getRobotRESET()) 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_MOVE_AUTOSPEED_FIELD_NUMBER; + hash = (53 * hash) + getRobotMoveAutoSpeed(); + hash = (37 * hash) + ROBOT_MOVE_MANUALSPEED_FIELD_NUMBER; + hash = (53 * hash) + getRobotMoveManualSpeed(); + hash = (37 * hash) + ROBOT_CURRENTPOSITION_FIELD_NUMBER; + hash = (53 * hash) + getRobotCurrentPosition(); + hash = (37 * hash) + ROBOT_ANGLEROLL_FIELD_NUMBER; + hash = (53 * hash) + getRobotAngleRoll(); + hash = (37 * hash) + ROBOT_ERROR_FIELD_NUMBER; + hash = (53 * hash) + getRobotError(); + hash = (37 * hash) + ROBOT_DYNAMOMETERVALUE_FIELD_NUMBER; + hash = (53 * hash) + getRobotDynamometerValue(); + hash = (37 * hash) + ROBOT_FORCEVALUE_FIELD_NUMBER; + hash = (53 * hash) + getRobotForceValue(); + hash = (37 * hash) + ROBOT_CURRENTSTATE_FIELD_NUMBER; + hash = (53 * hash) + getRobotCurrentState(); + hash = (37 * hash) + ROBOT_CURRENT_LEFT_FIELD_NUMBER; + hash = (53 * hash) + getRobotCurrentLeft(); + hash = (37 * hash) + ROBOT_CURRENT_RIGHT_FIELD_NUMBER; + hash = (53 * hash) + getRobotCurrentRight(); + hash = (37 * hash) + ROBOT_ERROR_LEFT_FIELD_NUMBER; + hash = (53 * hash) + getRobotErrorLeft(); + hash = (37 * hash) + ROBOT_ERROR_RIGHT_FIELD_NUMBER; + hash = (53 * hash) + getRobotErrorRight(); + hash = (37 * hash) + ROBOT_COMPENSATION_LEFT_FIELD_NUMBER; + hash = (53 * hash) + getRobotCompensationLeft(); + hash = (37 * hash) + ROBOT_COMPENSATION_RIGHT_FIELD_NUMBER; + hash = (53 * hash) + getRobotCompensationRight(); + hash = (37 * hash) + ROBOT_RESET_FIELD_NUMBER; + hash = (53 * hash) + getRobotRESET(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.example.removemarineanimals.models.BspIV.IV_struct_define parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.example.removemarineanimals.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.removemarineanimals.models.BspIV.IV_struct_define parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.example.removemarineanimals.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.removemarineanimals.models.BspIV.IV_struct_define parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.example.removemarineanimals.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.removemarineanimals.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.removemarineanimals.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.removemarineanimals.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.removemarineanimals.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.removemarineanimals.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.removemarineanimals.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.removemarineanimals.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.removemarineanimals.models.BspIV.IV_struct_defineOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.example.removemarineanimals.models.BspIV.internal_static_IV_struct_define_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.example.removemarineanimals.models.BspIV.internal_static_IV_struct_define_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.example.removemarineanimals.models.BspIV.IV_struct_define.class, com.example.removemarineanimals.models.BspIV.IV_struct_define.Builder.class); + } + + // Construct using com.example.removemarineanimals.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; + robotMoveAutoSpeed_ = 0; + robotMoveManualSpeed_ = 0; + robotCurrentPosition_ = 0; + robotAngleRoll_ = 0; + robotError_ = 0; + robotDynamometerValue_ = 0; + robotForceValue_ = 0; + robotCurrentState_ = 0; + robotCurrentLeft_ = 0; + robotCurrentRight_ = 0; + robotErrorLeft_ = 0; + robotErrorRight_ = 0; + robotCompensationLeft_ = 0; + robotCompensationRight_ = 0; + robotRESET_ = 0; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.example.removemarineanimals.models.BspIV.internal_static_IV_struct_define_descriptor; + } + + @java.lang.Override + public com.example.removemarineanimals.models.BspIV.IV_struct_define getDefaultInstanceForType() { + return com.example.removemarineanimals.models.BspIV.IV_struct_define.getDefaultInstance(); + } + + @java.lang.Override + public com.example.removemarineanimals.models.BspIV.IV_struct_define build() { + com.example.removemarineanimals.models.BspIV.IV_struct_define result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.example.removemarineanimals.models.BspIV.IV_struct_define buildPartial() { + com.example.removemarineanimals.models.BspIV.IV_struct_define result = new com.example.removemarineanimals.models.BspIV.IV_struct_define(this); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartial0(com.example.removemarineanimals.models.BspIV.IV_struct_define result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.robotMoveAutoSpeed_ = robotMoveAutoSpeed_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.robotMoveManualSpeed_ = robotMoveManualSpeed_; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.robotCurrentPosition_ = robotCurrentPosition_; + } + if (((from_bitField0_ & 0x00000008) != 0)) { + result.robotAngleRoll_ = robotAngleRoll_; + } + if (((from_bitField0_ & 0x00000010) != 0)) { + result.robotError_ = robotError_; + } + if (((from_bitField0_ & 0x00000020) != 0)) { + result.robotDynamometerValue_ = robotDynamometerValue_; + } + if (((from_bitField0_ & 0x00000040) != 0)) { + result.robotForceValue_ = robotForceValue_; + } + if (((from_bitField0_ & 0x00000080) != 0)) { + result.robotCurrentState_ = robotCurrentState_; + } + if (((from_bitField0_ & 0x00000100) != 0)) { + result.robotCurrentLeft_ = robotCurrentLeft_; + } + if (((from_bitField0_ & 0x00000200) != 0)) { + result.robotCurrentRight_ = robotCurrentRight_; + } + if (((from_bitField0_ & 0x00000400) != 0)) { + result.robotErrorLeft_ = robotErrorLeft_; + } + if (((from_bitField0_ & 0x00000800) != 0)) { + result.robotErrorRight_ = robotErrorRight_; + } + if (((from_bitField0_ & 0x00001000) != 0)) { + result.robotCompensationLeft_ = robotCompensationLeft_; + } + if (((from_bitField0_ & 0x00002000) != 0)) { + result.robotCompensationRight_ = robotCompensationRight_; + } + if (((from_bitField0_ & 0x00004000) != 0)) { + result.robotRESET_ = robotRESET_; + } + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.example.removemarineanimals.models.BspIV.IV_struct_define) { + return mergeFrom((com.example.removemarineanimals.models.BspIV.IV_struct_define)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.example.removemarineanimals.models.BspIV.IV_struct_define other) { + if (other == com.example.removemarineanimals.models.BspIV.IV_struct_define.getDefaultInstance()) return this; + if (other.getRobotMoveAutoSpeed() != 0) { + setRobotMoveAutoSpeed(other.getRobotMoveAutoSpeed()); + } + if (other.getRobotMoveManualSpeed() != 0) { + setRobotMoveManualSpeed(other.getRobotMoveManualSpeed()); + } + if (other.getRobotCurrentPosition() != 0) { + setRobotCurrentPosition(other.getRobotCurrentPosition()); + } + if (other.getRobotAngleRoll() != 0) { + setRobotAngleRoll(other.getRobotAngleRoll()); + } + if (other.getRobotError() != 0) { + setRobotError(other.getRobotError()); + } + if (other.getRobotDynamometerValue() != 0) { + setRobotDynamometerValue(other.getRobotDynamometerValue()); + } + if (other.getRobotForceValue() != 0) { + setRobotForceValue(other.getRobotForceValue()); + } + if (other.getRobotCurrentState() != 0) { + setRobotCurrentState(other.getRobotCurrentState()); + } + if (other.getRobotCurrentLeft() != 0) { + setRobotCurrentLeft(other.getRobotCurrentLeft()); + } + if (other.getRobotCurrentRight() != 0) { + setRobotCurrentRight(other.getRobotCurrentRight()); + } + if (other.getRobotErrorLeft() != 0) { + setRobotErrorLeft(other.getRobotErrorLeft()); + } + if (other.getRobotErrorRight() != 0) { + setRobotErrorRight(other.getRobotErrorRight()); + } + if (other.getRobotCompensationLeft() != 0) { + setRobotCompensationLeft(other.getRobotCompensationLeft()); + } + if (other.getRobotCompensationRight() != 0) { + setRobotCompensationRight(other.getRobotCompensationRight()); + } + if (other.getRobotRESET() != 0) { + setRobotRESET(other.getRobotRESET()); + } + 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: { + robotMoveAutoSpeed_ = input.readInt32(); + bitField0_ |= 0x00000001; + break; + } // case 8 + case 16: { + robotMoveManualSpeed_ = input.readInt32(); + bitField0_ |= 0x00000002; + break; + } // case 16 + case 24: { + robotCurrentPosition_ = input.readInt32(); + bitField0_ |= 0x00000004; + break; + } // case 24 + case 32: { + robotAngleRoll_ = input.readInt32(); + bitField0_ |= 0x00000008; + break; + } // case 32 + case 40: { + robotError_ = input.readInt32(); + bitField0_ |= 0x00000010; + break; + } // case 40 + case 48: { + robotDynamometerValue_ = input.readInt32(); + bitField0_ |= 0x00000020; + break; + } // case 48 + case 56: { + robotForceValue_ = input.readInt32(); + bitField0_ |= 0x00000040; + break; + } // case 56 + case 64: { + robotCurrentState_ = input.readInt32(); + bitField0_ |= 0x00000080; + break; + } // case 64 + case 72: { + robotCurrentLeft_ = input.readInt32(); + bitField0_ |= 0x00000100; + break; + } // case 72 + case 80: { + robotCurrentRight_ = input.readInt32(); + bitField0_ |= 0x00000200; + break; + } // case 80 + case 88: { + robotErrorLeft_ = input.readInt32(); + bitField0_ |= 0x00000400; + break; + } // case 88 + case 96: { + robotErrorRight_ = input.readInt32(); + bitField0_ |= 0x00000800; + break; + } // case 96 + case 104: { + robotCompensationLeft_ = input.readInt32(); + bitField0_ |= 0x00001000; + break; + } // case 104 + case 112: { + robotCompensationRight_ = input.readInt32(); + bitField0_ |= 0x00002000; + break; + } // case 112 + case 120: { + robotRESET_ = input.readInt32(); + bitField0_ |= 0x00004000; + break; + } // case 120 + 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 robotMoveAutoSpeed_ ; + /** + *
+       * 五轮项目
+       * 
+ * + * int32 Robot_Move_AutoSpeed = 1; + * @return The robotMoveAutoSpeed. + */ + @java.lang.Override + public int getRobotMoveAutoSpeed() { + return robotMoveAutoSpeed_; + } + /** + *
+       * 五轮项目
+       * 
+ * + * int32 Robot_Move_AutoSpeed = 1; + * @param value The robotMoveAutoSpeed to set. + * @return This builder for chaining. + */ + public Builder setRobotMoveAutoSpeed(int value) { + + robotMoveAutoSpeed_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + *
+       * 五轮项目
+       * 
+ * + * int32 Robot_Move_AutoSpeed = 1; + * @return This builder for chaining. + */ + public Builder clearRobotMoveAutoSpeed() { + bitField0_ = (bitField0_ & ~0x00000001); + robotMoveAutoSpeed_ = 0; + onChanged(); + return this; + } + + private int robotMoveManualSpeed_ ; + /** + * int32 Robot_Move_ManualSpeed = 2; + * @return The robotMoveManualSpeed. + */ + @java.lang.Override + public int getRobotMoveManualSpeed() { + return robotMoveManualSpeed_; + } + /** + * int32 Robot_Move_ManualSpeed = 2; + * @param value The robotMoveManualSpeed to set. + * @return This builder for chaining. + */ + public Builder setRobotMoveManualSpeed(int value) { + + robotMoveManualSpeed_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * int32 Robot_Move_ManualSpeed = 2; + * @return This builder for chaining. + */ + public Builder clearRobotMoveManualSpeed() { + bitField0_ = (bitField0_ & ~0x00000002); + robotMoveManualSpeed_ = 0; + onChanged(); + return this; + } + + private int robotCurrentPosition_ ; + /** + * int32 Robot_CurrentPosition = 3; + * @return The robotCurrentPosition. + */ + @java.lang.Override + public int getRobotCurrentPosition() { + return robotCurrentPosition_; + } + /** + * int32 Robot_CurrentPosition = 3; + * @param value The robotCurrentPosition to set. + * @return This builder for chaining. + */ + public Builder setRobotCurrentPosition(int value) { + + robotCurrentPosition_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * int32 Robot_CurrentPosition = 3; + * @return This builder for chaining. + */ + public Builder clearRobotCurrentPosition() { + bitField0_ = (bitField0_ & ~0x00000004); + robotCurrentPosition_ = 0; + onChanged(); + return this; + } + + private int robotAngleRoll_ ; + /** + * int32 Robot_AngleRoll = 4; + * @return The robotAngleRoll. + */ + @java.lang.Override + public int getRobotAngleRoll() { + return robotAngleRoll_; + } + /** + * int32 Robot_AngleRoll = 4; + * @param value The robotAngleRoll to set. + * @return This builder for chaining. + */ + public Builder setRobotAngleRoll(int value) { + + robotAngleRoll_ = value; + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + /** + * int32 Robot_AngleRoll = 4; + * @return This builder for chaining. + */ + public Builder clearRobotAngleRoll() { + bitField0_ = (bitField0_ & ~0x00000008); + robotAngleRoll_ = 0; + onChanged(); + return this; + } + + private int robotError_ ; + /** + * int32 Robot_Error = 5; + * @return The robotError. + */ + @java.lang.Override + public int getRobotError() { + return robotError_; + } + /** + * int32 Robot_Error = 5; + * @param value The robotError to set. + * @return This builder for chaining. + */ + public Builder setRobotError(int value) { + + robotError_ = value; + bitField0_ |= 0x00000010; + onChanged(); + return this; + } + /** + * int32 Robot_Error = 5; + * @return This builder for chaining. + */ + public Builder clearRobotError() { + bitField0_ = (bitField0_ & ~0x00000010); + robotError_ = 0; + onChanged(); + return this; + } + + private int robotDynamometerValue_ ; + /** + * int32 Robot_DynamometerValue = 6; + * @return The robotDynamometerValue. + */ + @java.lang.Override + public int getRobotDynamometerValue() { + return robotDynamometerValue_; + } + /** + * int32 Robot_DynamometerValue = 6; + * @param value The robotDynamometerValue to set. + * @return This builder for chaining. + */ + public Builder setRobotDynamometerValue(int value) { + + robotDynamometerValue_ = value; + bitField0_ |= 0x00000020; + onChanged(); + return this; + } + /** + * int32 Robot_DynamometerValue = 6; + * @return This builder for chaining. + */ + public Builder clearRobotDynamometerValue() { + bitField0_ = (bitField0_ & ~0x00000020); + robotDynamometerValue_ = 0; + onChanged(); + return this; + } + + private int robotForceValue_ ; + /** + * int32 Robot_ForceValue = 7; + * @return The robotForceValue. + */ + @java.lang.Override + public int getRobotForceValue() { + return robotForceValue_; + } + /** + * int32 Robot_ForceValue = 7; + * @param value The robotForceValue to set. + * @return This builder for chaining. + */ + public Builder setRobotForceValue(int value) { + + robotForceValue_ = value; + bitField0_ |= 0x00000040; + onChanged(); + return this; + } + /** + * int32 Robot_ForceValue = 7; + * @return This builder for chaining. + */ + public Builder clearRobotForceValue() { + bitField0_ = (bitField0_ & ~0x00000040); + robotForceValue_ = 0; + onChanged(); + return this; + } + + private int robotCurrentState_ ; + /** + * int32 Robot_CurrentState = 8; + * @return The robotCurrentState. + */ + @java.lang.Override + public int getRobotCurrentState() { + return robotCurrentState_; + } + /** + * int32 Robot_CurrentState = 8; + * @param value The robotCurrentState to set. + * @return This builder for chaining. + */ + public Builder setRobotCurrentState(int value) { + + robotCurrentState_ = value; + bitField0_ |= 0x00000080; + onChanged(); + return this; + } + /** + * int32 Robot_CurrentState = 8; + * @return This builder for chaining. + */ + public Builder clearRobotCurrentState() { + bitField0_ = (bitField0_ & ~0x00000080); + robotCurrentState_ = 0; + onChanged(); + return this; + } + + private int robotCurrentLeft_ ; + /** + * int32 Robot_Current_Left = 9; + * @return The robotCurrentLeft. + */ + @java.lang.Override + public int getRobotCurrentLeft() { + return robotCurrentLeft_; + } + /** + * int32 Robot_Current_Left = 9; + * @param value The robotCurrentLeft to set. + * @return This builder for chaining. + */ + public Builder setRobotCurrentLeft(int value) { + + robotCurrentLeft_ = value; + bitField0_ |= 0x00000100; + onChanged(); + return this; + } + /** + * int32 Robot_Current_Left = 9; + * @return This builder for chaining. + */ + public Builder clearRobotCurrentLeft() { + bitField0_ = (bitField0_ & ~0x00000100); + robotCurrentLeft_ = 0; + onChanged(); + return this; + } + + private int robotCurrentRight_ ; + /** + * int32 Robot_Current_Right = 10; + * @return The robotCurrentRight. + */ + @java.lang.Override + public int getRobotCurrentRight() { + return robotCurrentRight_; + } + /** + * int32 Robot_Current_Right = 10; + * @param value The robotCurrentRight to set. + * @return This builder for chaining. + */ + public Builder setRobotCurrentRight(int value) { + + robotCurrentRight_ = value; + bitField0_ |= 0x00000200; + onChanged(); + return this; + } + /** + * int32 Robot_Current_Right = 10; + * @return This builder for chaining. + */ + public Builder clearRobotCurrentRight() { + bitField0_ = (bitField0_ & ~0x00000200); + robotCurrentRight_ = 0; + onChanged(); + return this; + } + + private int robotErrorLeft_ ; + /** + * int32 Robot_Error_Left = 11; + * @return The robotErrorLeft. + */ + @java.lang.Override + public int getRobotErrorLeft() { + return robotErrorLeft_; + } + /** + * int32 Robot_Error_Left = 11; + * @param value The robotErrorLeft to set. + * @return This builder for chaining. + */ + public Builder setRobotErrorLeft(int value) { + + robotErrorLeft_ = value; + bitField0_ |= 0x00000400; + onChanged(); + return this; + } + /** + * int32 Robot_Error_Left = 11; + * @return This builder for chaining. + */ + public Builder clearRobotErrorLeft() { + bitField0_ = (bitField0_ & ~0x00000400); + robotErrorLeft_ = 0; + onChanged(); + return this; + } + + private int robotErrorRight_ ; + /** + * int32 Robot_Error_Right = 12; + * @return The robotErrorRight. + */ + @java.lang.Override + public int getRobotErrorRight() { + return robotErrorRight_; + } + /** + * int32 Robot_Error_Right = 12; + * @param value The robotErrorRight to set. + * @return This builder for chaining. + */ + public Builder setRobotErrorRight(int value) { + + robotErrorRight_ = value; + bitField0_ |= 0x00000800; + onChanged(); + return this; + } + /** + * int32 Robot_Error_Right = 12; + * @return This builder for chaining. + */ + public Builder clearRobotErrorRight() { + bitField0_ = (bitField0_ & ~0x00000800); + robotErrorRight_ = 0; + onChanged(); + return this; + } + + private int robotCompensationLeft_ ; + /** + * int32 Robot_Compensation_Left = 13; + * @return The robotCompensationLeft. + */ + @java.lang.Override + public int getRobotCompensationLeft() { + return robotCompensationLeft_; + } + /** + * int32 Robot_Compensation_Left = 13; + * @param value The robotCompensationLeft to set. + * @return This builder for chaining. + */ + public Builder setRobotCompensationLeft(int value) { + + robotCompensationLeft_ = value; + bitField0_ |= 0x00001000; + onChanged(); + return this; + } + /** + * int32 Robot_Compensation_Left = 13; + * @return This builder for chaining. + */ + public Builder clearRobotCompensationLeft() { + bitField0_ = (bitField0_ & ~0x00001000); + robotCompensationLeft_ = 0; + onChanged(); + return this; + } + + private int robotCompensationRight_ ; + /** + * int32 Robot_Compensation_Right = 14; + * @return The robotCompensationRight. + */ + @java.lang.Override + public int getRobotCompensationRight() { + return robotCompensationRight_; + } + /** + * int32 Robot_Compensation_Right = 14; + * @param value The robotCompensationRight to set. + * @return This builder for chaining. + */ + public Builder setRobotCompensationRight(int value) { + + robotCompensationRight_ = value; + bitField0_ |= 0x00002000; + onChanged(); + return this; + } + /** + * int32 Robot_Compensation_Right = 14; + * @return This builder for chaining. + */ + public Builder clearRobotCompensationRight() { + bitField0_ = (bitField0_ & ~0x00002000); + robotCompensationRight_ = 0; + onChanged(); + return this; + } + + private int robotRESET_ ; + /** + * int32 Robot_RESET = 15; + * @return The robotRESET. + */ + @java.lang.Override + public int getRobotRESET() { + return robotRESET_; + } + /** + * int32 Robot_RESET = 15; + * @param value The robotRESET to set. + * @return This builder for chaining. + */ + public Builder setRobotRESET(int value) { + + robotRESET_ = value; + bitField0_ |= 0x00004000; + onChanged(); + return this; + } + /** + * int32 Robot_RESET = 15; + * @return This builder for chaining. + */ + public Builder clearRobotRESET() { + bitField0_ = (bitField0_ & ~0x00004000); + robotRESET_ = 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.removemarineanimals.models.BspIV.IV_struct_define DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.example.removemarineanimals.models.BspIV.IV_struct_define(); + } + + public static com.example.removemarineanimals.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.removemarineanimals.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\"\271\003\n\020IV_struct_define\022\034\n\024R" + + "obot_Move_AutoSpeed\030\001 \001(\005\022\036\n\026Robot_Move_" + + "ManualSpeed\030\002 \001(\005\022\035\n\025Robot_CurrentPositi" + + "on\030\003 \001(\005\022\027\n\017Robot_AngleRoll\030\004 \001(\005\022\023\n\013Rob" + + "ot_Error\030\005 \001(\005\022\036\n\026Robot_DynamometerValue" + + "\030\006 \001(\005\022\030\n\020Robot_ForceValue\030\007 \001(\005\022\032\n\022Robo" + + "t_CurrentState\030\010 \001(\005\022\032\n\022Robot_Current_Le" + + "ft\030\t \001(\005\022\033\n\023Robot_Current_Right\030\n \001(\005\022\030\n" + + "\020Robot_Error_Left\030\013 \001(\005\022\031\n\021Robot_Error_R" + + "ight\030\014 \001(\005\022\037\n\027Robot_Compensation_Left\030\r " + + "\001(\005\022 \n\030Robot_Compensation_Right\030\016 \001(\005\022\023\n" + + "\013Robot_RESET\030\017 \001(\005B*\n&com.example.remove" + + "marineanimals.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[] { "RobotMoveAutoSpeed", "RobotMoveManualSpeed", "RobotCurrentPosition", "RobotAngleRoll", "RobotError", "RobotDynamometerValue", "RobotForceValue", "RobotCurrentState", "RobotCurrentLeft", "RobotCurrentRight", "RobotErrorLeft", "RobotErrorRight", "RobotCompensationLeft", "RobotCompensationRight", "RobotRESET", }); + descriptor.resolveAllFeaturesImmutable(); + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/app/src/main/java/com/example/removemarineanimals/models/BspPV.java b/app/src/main/java/com/example/removemarineanimals/models/BspPV.java new file mode 100644 index 0000000..966a19a --- /dev/null +++ b/app/src/main/java/com/example/removemarineanimals/models/BspPV.java @@ -0,0 +1,789 @@ +// 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.removemarineanimals.models; + +public final class BspPV { + private BspPV() {} + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 27, + /* patch= */ 2, + /* suffix= */ "", + BspPV.class.getName()); + } + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistryLite registry) { + } + + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistry registry) { + registerAllExtensions( + (com.google.protobuf.ExtensionRegistryLite) registry); + } + public interface PV_struct_defineOrBuilder extends + // @@protoc_insertion_point(interface_extends:PV_struct_define) + com.google.protobuf.MessageOrBuilder { + + /** + * int32 Robot_ChgLength = 1; + * @return The robotChgLength. + */ + int getRobotChgLength(); + + /** + * double Robot_AutoSpeedBase = 2; + * @return The robotAutoSpeedBase. + */ + double getRobotAutoSpeedBase(); + + /** + * double Robot_ManualSpeedBase = 3; + * @return The robotManualSpeedBase. + */ + double getRobotManualSpeedBase(); + + /** + * int32 Robot_LaneChange_Direction = 4; + * @return The robotLaneChangeDirection. + */ + int getRobotLaneChangeDirection(); + + /** + * int32 Robot_Force = 5; + * @return The robotForce. + */ + int getRobotForce(); + } + /** + * 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.removemarineanimals.models.BspPV.internal_static_PV_struct_define_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.example.removemarineanimals.models.BspPV.internal_static_PV_struct_define_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.example.removemarineanimals.models.BspPV.PV_struct_define.class, com.example.removemarineanimals.models.BspPV.PV_struct_define.Builder.class); + } + + public static final int ROBOT_CHGLENGTH_FIELD_NUMBER = 1; + private int robotChgLength_ = 0; + /** + * int32 Robot_ChgLength = 1; + * @return The robotChgLength. + */ + @java.lang.Override + public int getRobotChgLength() { + return robotChgLength_; + } + + public static final int ROBOT_AUTOSPEEDBASE_FIELD_NUMBER = 2; + private double robotAutoSpeedBase_ = 0D; + /** + * double Robot_AutoSpeedBase = 2; + * @return The robotAutoSpeedBase. + */ + @java.lang.Override + public double getRobotAutoSpeedBase() { + return robotAutoSpeedBase_; + } + + public static final int ROBOT_MANUALSPEEDBASE_FIELD_NUMBER = 3; + private double robotManualSpeedBase_ = 0D; + /** + * double Robot_ManualSpeedBase = 3; + * @return The robotManualSpeedBase. + */ + @java.lang.Override + public double getRobotManualSpeedBase() { + return robotManualSpeedBase_; + } + + public static final int ROBOT_LANECHANGE_DIRECTION_FIELD_NUMBER = 4; + private int robotLaneChangeDirection_ = 0; + /** + * int32 Robot_LaneChange_Direction = 4; + * @return The robotLaneChangeDirection. + */ + @java.lang.Override + public int getRobotLaneChangeDirection() { + return robotLaneChangeDirection_; + } + + public static final int ROBOT_FORCE_FIELD_NUMBER = 5; + private int robotForce_ = 0; + /** + * int32 Robot_Force = 5; + * @return The robotForce. + */ + @java.lang.Override + public int getRobotForce() { + return robotForce_; + } + + 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 (robotChgLength_ != 0) { + output.writeInt32(1, robotChgLength_); + } + if (java.lang.Double.doubleToRawLongBits(robotAutoSpeedBase_) != 0) { + output.writeDouble(2, robotAutoSpeedBase_); + } + if (java.lang.Double.doubleToRawLongBits(robotManualSpeedBase_) != 0) { + output.writeDouble(3, robotManualSpeedBase_); + } + if (robotLaneChangeDirection_ != 0) { + output.writeInt32(4, robotLaneChangeDirection_); + } + if (robotForce_ != 0) { + output.writeInt32(5, robotForce_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (robotChgLength_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(1, robotChgLength_); + } + if (java.lang.Double.doubleToRawLongBits(robotAutoSpeedBase_) != 0) { + size += com.google.protobuf.CodedOutputStream + .computeDoubleSize(2, robotAutoSpeedBase_); + } + if (java.lang.Double.doubleToRawLongBits(robotManualSpeedBase_) != 0) { + size += com.google.protobuf.CodedOutputStream + .computeDoubleSize(3, robotManualSpeedBase_); + } + if (robotLaneChangeDirection_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(4, robotLaneChangeDirection_); + } + if (robotForce_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(5, robotForce_); + } + 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.removemarineanimals.models.BspPV.PV_struct_define)) { + return super.equals(obj); + } + com.example.removemarineanimals.models.BspPV.PV_struct_define other = (com.example.removemarineanimals.models.BspPV.PV_struct_define) obj; + + if (getRobotChgLength() + != other.getRobotChgLength()) return false; + if (java.lang.Double.doubleToLongBits(getRobotAutoSpeedBase()) + != java.lang.Double.doubleToLongBits( + other.getRobotAutoSpeedBase())) return false; + if (java.lang.Double.doubleToLongBits(getRobotManualSpeedBase()) + != java.lang.Double.doubleToLongBits( + other.getRobotManualSpeedBase())) return false; + if (getRobotLaneChangeDirection() + != other.getRobotLaneChangeDirection()) return false; + if (getRobotForce() + != other.getRobotForce()) 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_CHGLENGTH_FIELD_NUMBER; + hash = (53 * hash) + getRobotChgLength(); + hash = (37 * hash) + ROBOT_AUTOSPEEDBASE_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong( + java.lang.Double.doubleToLongBits(getRobotAutoSpeedBase())); + hash = (37 * hash) + ROBOT_MANUALSPEEDBASE_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong( + java.lang.Double.doubleToLongBits(getRobotManualSpeedBase())); + hash = (37 * hash) + ROBOT_LANECHANGE_DIRECTION_FIELD_NUMBER; + hash = (53 * hash) + getRobotLaneChangeDirection(); + hash = (37 * hash) + ROBOT_FORCE_FIELD_NUMBER; + hash = (53 * hash) + getRobotForce(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.example.removemarineanimals.models.BspPV.PV_struct_define parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.example.removemarineanimals.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.removemarineanimals.models.BspPV.PV_struct_define parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.example.removemarineanimals.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.removemarineanimals.models.BspPV.PV_struct_define parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.example.removemarineanimals.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.removemarineanimals.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.removemarineanimals.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.removemarineanimals.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.removemarineanimals.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.removemarineanimals.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.removemarineanimals.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.removemarineanimals.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.removemarineanimals.models.BspPV.PV_struct_defineOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.example.removemarineanimals.models.BspPV.internal_static_PV_struct_define_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.example.removemarineanimals.models.BspPV.internal_static_PV_struct_define_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.example.removemarineanimals.models.BspPV.PV_struct_define.class, com.example.removemarineanimals.models.BspPV.PV_struct_define.Builder.class); + } + + // Construct using com.example.removemarineanimals.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; + robotChgLength_ = 0; + robotAutoSpeedBase_ = 0D; + robotManualSpeedBase_ = 0D; + robotLaneChangeDirection_ = 0; + robotForce_ = 0; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.example.removemarineanimals.models.BspPV.internal_static_PV_struct_define_descriptor; + } + + @java.lang.Override + public com.example.removemarineanimals.models.BspPV.PV_struct_define getDefaultInstanceForType() { + return com.example.removemarineanimals.models.BspPV.PV_struct_define.getDefaultInstance(); + } + + @java.lang.Override + public com.example.removemarineanimals.models.BspPV.PV_struct_define build() { + com.example.removemarineanimals.models.BspPV.PV_struct_define result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.example.removemarineanimals.models.BspPV.PV_struct_define buildPartial() { + com.example.removemarineanimals.models.BspPV.PV_struct_define result = new com.example.removemarineanimals.models.BspPV.PV_struct_define(this); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartial0(com.example.removemarineanimals.models.BspPV.PV_struct_define result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.robotChgLength_ = robotChgLength_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.robotAutoSpeedBase_ = robotAutoSpeedBase_; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.robotManualSpeedBase_ = robotManualSpeedBase_; + } + if (((from_bitField0_ & 0x00000008) != 0)) { + result.robotLaneChangeDirection_ = robotLaneChangeDirection_; + } + if (((from_bitField0_ & 0x00000010) != 0)) { + result.robotForce_ = robotForce_; + } + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.example.removemarineanimals.models.BspPV.PV_struct_define) { + return mergeFrom((com.example.removemarineanimals.models.BspPV.PV_struct_define)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.example.removemarineanimals.models.BspPV.PV_struct_define other) { + if (other == com.example.removemarineanimals.models.BspPV.PV_struct_define.getDefaultInstance()) return this; + if (other.getRobotChgLength() != 0) { + setRobotChgLength(other.getRobotChgLength()); + } + if (other.getRobotAutoSpeedBase() != 0D) { + setRobotAutoSpeedBase(other.getRobotAutoSpeedBase()); + } + if (other.getRobotManualSpeedBase() != 0D) { + setRobotManualSpeedBase(other.getRobotManualSpeedBase()); + } + if (other.getRobotLaneChangeDirection() != 0) { + setRobotLaneChangeDirection(other.getRobotLaneChangeDirection()); + } + if (other.getRobotForce() != 0) { + setRobotForce(other.getRobotForce()); + } + 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: { + robotChgLength_ = input.readInt32(); + bitField0_ |= 0x00000001; + break; + } // case 8 + case 17: { + robotAutoSpeedBase_ = input.readDouble(); + bitField0_ |= 0x00000002; + break; + } // case 17 + case 25: { + robotManualSpeedBase_ = input.readDouble(); + bitField0_ |= 0x00000004; + break; + } // case 25 + case 32: { + robotLaneChangeDirection_ = input.readInt32(); + bitField0_ |= 0x00000008; + break; + } // case 32 + case 40: { + robotForce_ = input.readInt32(); + bitField0_ |= 0x00000010; + break; + } // case 40 + 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 robotChgLength_ ; + /** + * int32 Robot_ChgLength = 1; + * @return The robotChgLength. + */ + @java.lang.Override + public int getRobotChgLength() { + return robotChgLength_; + } + /** + * int32 Robot_ChgLength = 1; + * @param value The robotChgLength to set. + * @return This builder for chaining. + */ + public Builder setRobotChgLength(int value) { + + robotChgLength_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * int32 Robot_ChgLength = 1; + * @return This builder for chaining. + */ + public Builder clearRobotChgLength() { + bitField0_ = (bitField0_ & ~0x00000001); + robotChgLength_ = 0; + onChanged(); + return this; + } + + private double robotAutoSpeedBase_ ; + /** + * double Robot_AutoSpeedBase = 2; + * @return The robotAutoSpeedBase. + */ + @java.lang.Override + public double getRobotAutoSpeedBase() { + return robotAutoSpeedBase_; + } + /** + * double Robot_AutoSpeedBase = 2; + * @param value The robotAutoSpeedBase to set. + * @return This builder for chaining. + */ + public Builder setRobotAutoSpeedBase(double value) { + + robotAutoSpeedBase_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * double Robot_AutoSpeedBase = 2; + * @return This builder for chaining. + */ + public Builder clearRobotAutoSpeedBase() { + bitField0_ = (bitField0_ & ~0x00000002); + robotAutoSpeedBase_ = 0D; + onChanged(); + return this; + } + + private double robotManualSpeedBase_ ; + /** + * double Robot_ManualSpeedBase = 3; + * @return The robotManualSpeedBase. + */ + @java.lang.Override + public double getRobotManualSpeedBase() { + return robotManualSpeedBase_; + } + /** + * double Robot_ManualSpeedBase = 3; + * @param value The robotManualSpeedBase to set. + * @return This builder for chaining. + */ + public Builder setRobotManualSpeedBase(double value) { + + robotManualSpeedBase_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * double Robot_ManualSpeedBase = 3; + * @return This builder for chaining. + */ + public Builder clearRobotManualSpeedBase() { + bitField0_ = (bitField0_ & ~0x00000004); + robotManualSpeedBase_ = 0D; + onChanged(); + return this; + } + + private int robotLaneChangeDirection_ ; + /** + * int32 Robot_LaneChange_Direction = 4; + * @return The robotLaneChangeDirection. + */ + @java.lang.Override + public int getRobotLaneChangeDirection() { + return robotLaneChangeDirection_; + } + /** + * int32 Robot_LaneChange_Direction = 4; + * @param value The robotLaneChangeDirection to set. + * @return This builder for chaining. + */ + public Builder setRobotLaneChangeDirection(int value) { + + robotLaneChangeDirection_ = value; + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + /** + * int32 Robot_LaneChange_Direction = 4; + * @return This builder for chaining. + */ + public Builder clearRobotLaneChangeDirection() { + bitField0_ = (bitField0_ & ~0x00000008); + robotLaneChangeDirection_ = 0; + onChanged(); + return this; + } + + private int robotForce_ ; + /** + * int32 Robot_Force = 5; + * @return The robotForce. + */ + @java.lang.Override + public int getRobotForce() { + return robotForce_; + } + /** + * int32 Robot_Force = 5; + * @param value The robotForce to set. + * @return This builder for chaining. + */ + public Builder setRobotForce(int value) { + + robotForce_ = value; + bitField0_ |= 0x00000010; + onChanged(); + return this; + } + /** + * int32 Robot_Force = 5; + * @return This builder for chaining. + */ + public Builder clearRobotForce() { + bitField0_ = (bitField0_ & ~0x00000010); + robotForce_ = 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.removemarineanimals.models.BspPV.PV_struct_define DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.example.removemarineanimals.models.BspPV.PV_struct_define(); + } + + public static com.example.removemarineanimals.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.removemarineanimals.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\"\240\001\n\020PV_struct_define\022\027\n\017R" + + "obot_ChgLength\030\001 \001(\005\022\033\n\023Robot_AutoSpeedB" + + "ase\030\002 \001(\001\022\035\n\025Robot_ManualSpeedBase\030\003 \001(\001" + + "\022\"\n\032Robot_LaneChange_Direction\030\004 \001(\005\022\023\n\013" + + "Robot_Force\030\005 \001(\005B*\n&com.example.removem" + + "arineanimals.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[] { "RobotChgLength", "RobotAutoSpeedBase", "RobotManualSpeedBase", "RobotLaneChangeDirection", "RobotForce", }); + descriptor.resolveAllFeaturesImmutable(); + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/app/src/main/java/com/example/removemarineanimals/models/RobotData.java b/app/src/main/java/com/example/removemarineanimals/models/RobotData.java new file mode 100644 index 0000000..138f780 --- /dev/null +++ b/app/src/main/java/com/example/removemarineanimals/models/RobotData.java @@ -0,0 +1,792 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: robot_data.proto +// Protobuf Java Version: 4.27.2 + +package com.example.removemarineanimals.models; + +public final class RobotData { + private RobotData() {} + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 27, + /* patch= */ 2, + /* suffix= */ "", + RobotData.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 DataTransOrBuilder extends + // @@protoc_insertion_point(interface_extends:DataTrans) + com.google.protobuf.MessageOrBuilder { + + /** + *
+     * 横滚角
+     * 
+ * + * int32 RF_Angle_Roll = 1; + * @return The rFAngleRoll. + */ + int getRFAngleRoll(); + + /** + *
+     * 俯仰角
+     * 
+ * + * int32 RF_Angle_Pitch = 2; + * @return The rFAnglePitch. + */ + int getRFAnglePitch(); + + /** + *
+     * 航向角
+     * 
+ * + * int32 RF_Angle_Yaw = 3; + * @return The rFAngleYaw. + */ + int getRFAngleYaw(); + + /** + *
+     * 海洋深度
+     * 
+ * + * int32 RF_Depth = 4; + * @return The rFDepth. + */ + int getRFDepth(); + } + /** + * Protobuf type {@code DataTrans} + */ + public static final class DataTrans extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:DataTrans) + DataTransOrBuilder { + 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= */ "", + DataTrans.class.getName()); + } + // Use DataTrans.newBuilder() to construct. + private DataTrans(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + private DataTrans() { + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return RobotData.internal_static_DataTrans_descriptor; + } + + @Override + protected FieldAccessorTable + internalGetFieldAccessorTable() { + return RobotData.internal_static_DataTrans_fieldAccessorTable + .ensureFieldAccessorsInitialized( + DataTrans.class, Builder.class); + } + + public static final int RF_ANGLE_ROLL_FIELD_NUMBER = 1; + private int rFAngleRoll_ = 0; + /** + *
+     * 横滚角
+     * 
+ * + * int32 RF_Angle_Roll = 1; + * @return The rFAngleRoll. + */ + @Override + public int getRFAngleRoll() { + return rFAngleRoll_; + } + + public static final int RF_ANGLE_PITCH_FIELD_NUMBER = 2; + private int rFAnglePitch_ = 0; + /** + *
+     * 俯仰角
+     * 
+ * + * int32 RF_Angle_Pitch = 2; + * @return The rFAnglePitch. + */ + @Override + public int getRFAnglePitch() { + return rFAnglePitch_; + } + + public static final int RF_ANGLE_YAW_FIELD_NUMBER = 3; + private int rFAngleYaw_ = 0; + /** + *
+     * 航向角
+     * 
+ * + * int32 RF_Angle_Yaw = 3; + * @return The rFAngleYaw. + */ + @Override + public int getRFAngleYaw() { + return rFAngleYaw_; + } + + public static final int RF_DEPTH_FIELD_NUMBER = 4; + private int rFDepth_ = 0; + /** + *
+     * 海洋深度
+     * 
+ * + * int32 RF_Depth = 4; + * @return The rFDepth. + */ + @Override + public int getRFDepth() { + return rFDepth_; + } + + private byte memoizedIsInitialized = -1; + @Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (rFAngleRoll_ != 0) { + output.writeInt32(1, rFAngleRoll_); + } + if (rFAnglePitch_ != 0) { + output.writeInt32(2, rFAnglePitch_); + } + if (rFAngleYaw_ != 0) { + output.writeInt32(3, rFAngleYaw_); + } + if (rFDepth_ != 0) { + output.writeInt32(4, rFDepth_); + } + getUnknownFields().writeTo(output); + } + + @Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (rFAngleRoll_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(1, rFAngleRoll_); + } + if (rFAnglePitch_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(2, rFAnglePitch_); + } + if (rFAngleYaw_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(3, rFAngleYaw_); + } + if (rFDepth_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(4, rFDepth_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @Override + public boolean equals(final Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof DataTrans)) { + return super.equals(obj); + } + DataTrans other = (DataTrans) obj; + + if (getRFAngleRoll() + != other.getRFAngleRoll()) return false; + if (getRFAnglePitch() + != other.getRFAnglePitch()) return false; + if (getRFAngleYaw() + != other.getRFAngleYaw()) return false; + if (getRFDepth() + != other.getRFDepth()) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + RF_ANGLE_ROLL_FIELD_NUMBER; + hash = (53 * hash) + getRFAngleRoll(); + hash = (37 * hash) + RF_ANGLE_PITCH_FIELD_NUMBER; + hash = (53 * hash) + getRFAnglePitch(); + hash = (37 * hash) + RF_ANGLE_YAW_FIELD_NUMBER; + hash = (53 * hash) + getRFAngleYaw(); + hash = (37 * hash) + RF_DEPTH_FIELD_NUMBER; + hash = (53 * hash) + getRFDepth(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static DataTrans parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static DataTrans parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static DataTrans parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static DataTrans parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static DataTrans parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static DataTrans parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static DataTrans parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static DataTrans 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 DataTrans parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input); + } + + public static DataTrans 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 DataTrans parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static DataTrans parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(DataTrans prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @Override + protected Builder newBuilderForType( + BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code DataTrans} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder implements + // @@protoc_insertion_point(builder_implements:DataTrans) + DataTransOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return RobotData.internal_static_DataTrans_descriptor; + } + + @Override + protected FieldAccessorTable + internalGetFieldAccessorTable() { + return RobotData.internal_static_DataTrans_fieldAccessorTable + .ensureFieldAccessorsInitialized( + DataTrans.class, Builder.class); + } + + // Construct using com.example.removemarineanimals.models.RobotData.DataTrans.newBuilder() + private Builder() { + + } + + private Builder( + BuilderParent parent) { + super(parent); + + } + @Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + rFAngleRoll_ = 0; + rFAnglePitch_ = 0; + rFAngleYaw_ = 0; + rFDepth_ = 0; + return this; + } + + @Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return RobotData.internal_static_DataTrans_descriptor; + } + + @Override + public DataTrans getDefaultInstanceForType() { + return DataTrans.getDefaultInstance(); + } + + @Override + public DataTrans build() { + DataTrans result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @Override + public DataTrans buildPartial() { + DataTrans result = new DataTrans(this); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartial0(DataTrans result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.rFAngleRoll_ = rFAngleRoll_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.rFAnglePitch_ = rFAnglePitch_; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.rFAngleYaw_ = rFAngleYaw_; + } + if (((from_bitField0_ & 0x00000008) != 0)) { + result.rFDepth_ = rFDepth_; + } + } + + @Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof DataTrans) { + return mergeFrom((DataTrans)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(DataTrans other) { + if (other == DataTrans.getDefaultInstance()) return this; + if (other.getRFAngleRoll() != 0) { + setRFAngleRoll(other.getRFAngleRoll()); + } + if (other.getRFAnglePitch() != 0) { + setRFAnglePitch(other.getRFAnglePitch()); + } + if (other.getRFAngleYaw() != 0) { + setRFAngleYaw(other.getRFAngleYaw()); + } + if (other.getRFDepth() != 0) { + setRFDepth(other.getRFDepth()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @Override + public final boolean isInitialized() { + return true; + } + + @Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: { + rFAngleRoll_ = input.readInt32(); + bitField0_ |= 0x00000001; + break; + } // case 8 + case 16: { + rFAnglePitch_ = input.readInt32(); + bitField0_ |= 0x00000002; + break; + } // case 16 + case 24: { + rFAngleYaw_ = input.readInt32(); + bitField0_ |= 0x00000004; + break; + } // case 24 + case 32: { + rFDepth_ = input.readInt32(); + bitField0_ |= 0x00000008; + break; + } // case 32 + 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 rFAngleRoll_ ; + /** + *
+       * 横滚角
+       * 
+ * + * int32 RF_Angle_Roll = 1; + * @return The rFAngleRoll. + */ + @Override + public int getRFAngleRoll() { + return rFAngleRoll_; + } + /** + *
+       * 横滚角
+       * 
+ * + * int32 RF_Angle_Roll = 1; + * @param value The rFAngleRoll to set. + * @return This builder for chaining. + */ + public Builder setRFAngleRoll(int value) { + + rFAngleRoll_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + *
+       * 横滚角
+       * 
+ * + * int32 RF_Angle_Roll = 1; + * @return This builder for chaining. + */ + public Builder clearRFAngleRoll() { + bitField0_ = (bitField0_ & ~0x00000001); + rFAngleRoll_ = 0; + onChanged(); + return this; + } + + private int rFAnglePitch_ ; + /** + *
+       * 俯仰角
+       * 
+ * + * int32 RF_Angle_Pitch = 2; + * @return The rFAnglePitch. + */ + @Override + public int getRFAnglePitch() { + return rFAnglePitch_; + } + /** + *
+       * 俯仰角
+       * 
+ * + * int32 RF_Angle_Pitch = 2; + * @param value The rFAnglePitch to set. + * @return This builder for chaining. + */ + public Builder setRFAnglePitch(int value) { + + rFAnglePitch_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + *
+       * 俯仰角
+       * 
+ * + * int32 RF_Angle_Pitch = 2; + * @return This builder for chaining. + */ + public Builder clearRFAnglePitch() { + bitField0_ = (bitField0_ & ~0x00000002); + rFAnglePitch_ = 0; + onChanged(); + return this; + } + + private int rFAngleYaw_ ; + /** + *
+       * 航向角
+       * 
+ * + * int32 RF_Angle_Yaw = 3; + * @return The rFAngleYaw. + */ + @Override + public int getRFAngleYaw() { + return rFAngleYaw_; + } + /** + *
+       * 航向角
+       * 
+ * + * int32 RF_Angle_Yaw = 3; + * @param value The rFAngleYaw to set. + * @return This builder for chaining. + */ + public Builder setRFAngleYaw(int value) { + + rFAngleYaw_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + *
+       * 航向角
+       * 
+ * + * int32 RF_Angle_Yaw = 3; + * @return This builder for chaining. + */ + public Builder clearRFAngleYaw() { + bitField0_ = (bitField0_ & ~0x00000004); + rFAngleYaw_ = 0; + onChanged(); + return this; + } + + private int rFDepth_ ; + /** + *
+       * 海洋深度
+       * 
+ * + * int32 RF_Depth = 4; + * @return The rFDepth. + */ + @Override + public int getRFDepth() { + return rFDepth_; + } + /** + *
+       * 海洋深度
+       * 
+ * + * int32 RF_Depth = 4; + * @param value The rFDepth to set. + * @return This builder for chaining. + */ + public Builder setRFDepth(int value) { + + rFDepth_ = value; + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + /** + *
+       * 海洋深度
+       * 
+ * + * int32 RF_Depth = 4; + * @return This builder for chaining. + */ + public Builder clearRFDepth() { + bitField0_ = (bitField0_ & ~0x00000008); + rFDepth_ = 0; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:DataTrans) + } + + // @@protoc_insertion_point(class_scope:DataTrans) + private static final DataTrans DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new DataTrans(); + } + + public static DataTrans getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @Override + public DataTrans 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; + } + + @Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @Override + public DataTrans getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + + } + + private static final com.google.protobuf.Descriptors.Descriptor + internal_static_DataTrans_descriptor; + private static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_DataTrans_fieldAccessorTable; + + public static com.google.protobuf.Descriptors.FileDescriptor + getDescriptor() { + return descriptor; + } + private static com.google.protobuf.Descriptors.FileDescriptor + descriptor; + static { + String[] descriptorData = { + "\n\020robot_data.proto\"b\n\tDataTrans\022\025\n\rRF_An" + + "gle_Roll\030\001 \001(\005\022\026\n\016RF_Angle_Pitch\030\002 \001(\005\022\024" + + "\n\014RF_Angle_Yaw\030\003 \001(\005\022\020\n\010RF_Depth\030\004 \001(\005B*" + + "\n&com.example.removemarineanimals.models" + + "P\000b\006proto3" + }; + descriptor = com.google.protobuf.Descriptors.FileDescriptor + .internalBuildGeneratedFileFrom(descriptorData, + new com.google.protobuf.Descriptors.FileDescriptor[] { + }); + internal_static_DataTrans_descriptor = + getDescriptor().getMessageTypes().get(0); + internal_static_DataTrans_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_DataTrans_descriptor, + new String[] { "RFAngleRoll", "RFAnglePitch", "RFAngleYaw", "RFDepth", }); + descriptor.resolveAllFeaturesImmutable(); + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/app/src/main/java/com/example/removemarineanimals/models/RobotRMACM.java b/app/src/main/java/com/example/removemarineanimals/models/RobotRMACM.java new file mode 100644 index 0000000..c1badac --- /dev/null +++ b/app/src/main/java/com/example/removemarineanimals/models/RobotRMACM.java @@ -0,0 +1,615 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: robot_RMACM.proto +// Protobuf Java Version: 4.27.2 + +package com.example.removemarineanimals.models; + +public final class RobotRMACM { + private RobotRMACM() {} + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 27, + /* patch= */ 2, + /* suffix= */ "", + RobotRMACM.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 RMACMOrBuilder extends + // @@protoc_insertion_point(interface_extends:RMACM) + com.google.protobuf.MessageOrBuilder { + + /** + *
+     * 灯光亮度
+     * 
+ * + * int32 LightBrightness = 1; + * @return The lightBrightness. + */ + int getLightBrightness(); + + /** + *
+     * 机器人速度
+     * 
+ * + * int32 Robot_Speed = 2; + * @return The robotSpeed. + */ + int getRobotSpeed(); + } + /** + *
+   * Remove Marine Animal Command
+   * 
+ * + * Protobuf type {@code RMACM} + */ + public static final class RMACM extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:RMACM) + RMACMOrBuilder { + 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= */ "", + RMACM.class.getName()); + } + // Use RMACM.newBuilder() to construct. + private RMACM(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + private RMACM() { + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return RobotRMACM.internal_static_RMACM_descriptor; + } + + @Override + protected FieldAccessorTable + internalGetFieldAccessorTable() { + return RobotRMACM.internal_static_RMACM_fieldAccessorTable + .ensureFieldAccessorsInitialized( + RMACM.class, Builder.class); + } + + public static final int LIGHTBRIGHTNESS_FIELD_NUMBER = 1; + private int lightBrightness_ = 0; + /** + *
+     * 灯光亮度
+     * 
+ * + * int32 LightBrightness = 1; + * @return The lightBrightness. + */ + @Override + public int getLightBrightness() { + return lightBrightness_; + } + + public static final int ROBOT_SPEED_FIELD_NUMBER = 2; + private int robotSpeed_ = 0; + /** + *
+     * 机器人速度
+     * 
+ * + * int32 Robot_Speed = 2; + * @return The robotSpeed. + */ + @Override + public int getRobotSpeed() { + return robotSpeed_; + } + + private byte memoizedIsInitialized = -1; + @Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (lightBrightness_ != 0) { + output.writeInt32(1, lightBrightness_); + } + if (robotSpeed_ != 0) { + output.writeInt32(2, robotSpeed_); + } + getUnknownFields().writeTo(output); + } + + @Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (lightBrightness_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(1, lightBrightness_); + } + if (robotSpeed_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(2, robotSpeed_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @Override + public boolean equals(final Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof RMACM)) { + return super.equals(obj); + } + RMACM other = (RMACM) obj; + + if (getLightBrightness() + != other.getLightBrightness()) return false; + if (getRobotSpeed() + != other.getRobotSpeed()) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + LIGHTBRIGHTNESS_FIELD_NUMBER; + hash = (53 * hash) + getLightBrightness(); + hash = (37 * hash) + ROBOT_SPEED_FIELD_NUMBER; + hash = (53 * hash) + getRobotSpeed(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static RMACM parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static RMACM parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static RMACM parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static RMACM parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static RMACM parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static RMACM parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static RMACM parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static RMACM 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 RMACM parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input); + } + + public static RMACM 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 RMACM parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static RMACM parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(RMACM prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @Override + protected Builder newBuilderForType( + BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + *
+     * Remove Marine Animal Command
+     * 
+ * + * Protobuf type {@code RMACM} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder implements + // @@protoc_insertion_point(builder_implements:RMACM) + RMACMOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return RobotRMACM.internal_static_RMACM_descriptor; + } + + @Override + protected FieldAccessorTable + internalGetFieldAccessorTable() { + return RobotRMACM.internal_static_RMACM_fieldAccessorTable + .ensureFieldAccessorsInitialized( + RMACM.class, Builder.class); + } + + // Construct using com.example.removemarineanimals.models.RobotRMACM.RMACM.newBuilder() + private Builder() { + + } + + private Builder( + BuilderParent parent) { + super(parent); + + } + @Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + lightBrightness_ = 0; + robotSpeed_ = 0; + return this; + } + + @Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return RobotRMACM.internal_static_RMACM_descriptor; + } + + @Override + public RMACM getDefaultInstanceForType() { + return RMACM.getDefaultInstance(); + } + + @Override + public RMACM build() { + RMACM result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @Override + public RMACM buildPartial() { + RMACM result = new RMACM(this); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartial0(RMACM result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.lightBrightness_ = lightBrightness_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.robotSpeed_ = robotSpeed_; + } + } + + @Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof RMACM) { + return mergeFrom((RMACM)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(RMACM other) { + if (other == RMACM.getDefaultInstance()) return this; + if (other.getLightBrightness() != 0) { + setLightBrightness(other.getLightBrightness()); + } + if (other.getRobotSpeed() != 0) { + setRobotSpeed(other.getRobotSpeed()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @Override + public final boolean isInitialized() { + return true; + } + + @Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: { + lightBrightness_ = input.readInt32(); + bitField0_ |= 0x00000001; + break; + } // case 8 + case 16: { + robotSpeed_ = input.readInt32(); + bitField0_ |= 0x00000002; + break; + } // case 16 + 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 lightBrightness_ ; + /** + *
+       * 灯光亮度
+       * 
+ * + * int32 LightBrightness = 1; + * @return The lightBrightness. + */ + @Override + public int getLightBrightness() { + return lightBrightness_; + } + /** + *
+       * 灯光亮度
+       * 
+ * + * int32 LightBrightness = 1; + * @param value The lightBrightness to set. + * @return This builder for chaining. + */ + public Builder setLightBrightness(int value) { + + lightBrightness_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + *
+       * 灯光亮度
+       * 
+ * + * int32 LightBrightness = 1; + * @return This builder for chaining. + */ + public Builder clearLightBrightness() { + bitField0_ = (bitField0_ & ~0x00000001); + lightBrightness_ = 0; + onChanged(); + return this; + } + + private int robotSpeed_ ; + /** + *
+       * 机器人速度
+       * 
+ * + * int32 Robot_Speed = 2; + * @return The robotSpeed. + */ + @Override + public int getRobotSpeed() { + return robotSpeed_; + } + /** + *
+       * 机器人速度
+       * 
+ * + * int32 Robot_Speed = 2; + * @param value The robotSpeed to set. + * @return This builder for chaining. + */ + public Builder setRobotSpeed(int value) { + + robotSpeed_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + *
+       * 机器人速度
+       * 
+ * + * int32 Robot_Speed = 2; + * @return This builder for chaining. + */ + public Builder clearRobotSpeed() { + bitField0_ = (bitField0_ & ~0x00000002); + robotSpeed_ = 0; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:RMACM) + } + + // @@protoc_insertion_point(class_scope:RMACM) + private static final RMACM DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new RMACM(); + } + + public static RMACM getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @Override + public RMACM 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; + } + + @Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @Override + public RMACM getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + + } + + private static final com.google.protobuf.Descriptors.Descriptor + internal_static_RMACM_descriptor; + private static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_RMACM_fieldAccessorTable; + + public static com.google.protobuf.Descriptors.FileDescriptor + getDescriptor() { + return descriptor; + } + private static com.google.protobuf.Descriptors.FileDescriptor + descriptor; + static { + String[] descriptorData = { + "\n\021robot_RMACM.proto\"5\n\005RMACM\022\027\n\017LightBri" + + "ghtness\030\001 \001(\005\022\023\n\013Robot_Speed\030\002 \001(\005B*\n&co" + + "m.example.removemarineanimals.modelsP\000b\006" + + "proto3" + }; + descriptor = com.google.protobuf.Descriptors.FileDescriptor + .internalBuildGeneratedFileFrom(descriptorData, + new com.google.protobuf.Descriptors.FileDescriptor[] { + }); + internal_static_RMACM_descriptor = + getDescriptor().getMessageTypes().get(0); + internal_static_RMACM_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_RMACM_descriptor, + new String[] { "LightBrightness", "RobotSpeed", }); + descriptor.resolveAllFeaturesImmutable(); + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/app/src/main/java/com/example/removemarineanimals/services/CustomProber.java b/app/src/main/java/com/example/removemarineanimals/services/CustomProber.java new file mode 100644 index 0000000..c9871c8 --- /dev/null +++ b/app/src/main/java/com/example/removemarineanimals/services/CustomProber.java @@ -0,0 +1,23 @@ +package com.example.removemarineanimals.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/removemarineanimals/services/DisplayUtils.java b/app/src/main/java/com/example/removemarineanimals/services/DisplayUtils.java new file mode 100644 index 0000000..a39e782 --- /dev/null +++ b/app/src/main/java/com/example/removemarineanimals/services/DisplayUtils.java @@ -0,0 +1,17 @@ +package com.example.removemarineanimals.services; + +import android.content.Context; +import android.content.res.Resources; +import android.util.TypedValue; + +public class DisplayUtils { + // 静态方法,无需实例化即可调用 + public static int dpToPx(Context context, int dp) { + Resources r = context.getResources(); + return (int) TypedValue.applyDimension( + TypedValue.COMPLEX_UNIT_DIP, + dp, + r.getDisplayMetrics() + ); + } +} \ No newline at end of file diff --git a/app/src/main/java/com/example/removemarineanimals/services/ModbusCRC.java b/app/src/main/java/com/example/removemarineanimals/services/ModbusCRC.java new file mode 100644 index 0000000..f8b7316 --- /dev/null +++ b/app/src/main/java/com/example/removemarineanimals/services/ModbusCRC.java @@ -0,0 +1,72 @@ +package com.example.removemarineanimals.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/removemarineanimals/services/RobotDataHanlder.java b/app/src/main/java/com/example/removemarineanimals/services/RobotDataHanlder.java new file mode 100644 index 0000000..798adde --- /dev/null +++ b/app/src/main/java/com/example/removemarineanimals/services/RobotDataHanlder.java @@ -0,0 +1,54 @@ +package com.example.removemarineanimals.services; + +import com.example.removemarineanimals.models.RobotData; +import com.google.protobuf.InvalidProtocolBufferException; + +public class RobotDataHanlder { + + + public static void test() + { + //byte[] data=hexToByteArray("080110830118313A04B1CBBACF"); + byte[] data=hexToByteArray("100A180A28013A32B1CBBACF00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"); + + } + public static RobotData.DataTrans DeoodeDataFromRobot(byte[] data) + { + + RobotData.DataTrans dtrans3 = null; + try + { + dtrans3 = RobotData.DataTrans.parseFrom(data); + + return dtrans3; + } catch (InvalidProtocolBufferException e) { + return null; + } + + + } + + 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/removemarineanimals/services/RtspRecorder.java b/app/src/main/java/com/example/removemarineanimals/services/RtspRecorder.java new file mode 100644 index 0000000..a3d96fa --- /dev/null +++ b/app/src/main/java/com/example/removemarineanimals/services/RtspRecorder.java @@ -0,0 +1,140 @@ +//package com.example.removemarineanimals.services; +// +//import android.content.Context; +//import android.graphics.Bitmap; +//import android.graphics.Canvas; +//import android.view.View; +//import android.widget.Toast; +// +//import com.arthenica.ffmpegkit.FFmpegKit; +//import com.arthenica.ffmpegkit.FFmpegSession; +//import com.arthenica.ffmpegkit.ReturnCode; +//import com.example.removemarineanimals.MainActivity; +// +//import java.io.File; +//import java.io.FileOutputStream; +//import java.io.IOException; +//import java.text.SimpleDateFormat; +//import java.util.Date; +// +//public class RtspRecorder { +// // 用于控制录制会话 +// private MainActivity MainActivity; +// private static FFmpegSession recordingSession; +// +// // 开始分段录制 +// public static void startRecording(Context context, String rtspUrl) +// { +// +// String outputPath ="storage/emulated/0/DCIM/" + "/record_%Y-%m-%d_%H-%M-%S.mp4"; +// //String outputPath = context.getExternalFilesDir(null) + "/record_%Y-%m-%d_%H-%M-%S.mp4"; +// String command = String.format( +// "-rtsp_transport tcp -i \"%s\" -c:v copy -f segment -segment_time 30 -reset_timestamps 1 -strftime 1 \"%s\"", +// rtspUrl, outputPath +// ); +// +// recordingSession = FFmpegKit.executeAsync(command, session -> { +// if (ReturnCode.isSuccess(session.getReturnCode())) { +// // 录制正常结束 +// } else { +// // 录制异常终止 +// } +// }); +// } +// +// // 停止录制 +// public static void stopRecording() { +// if (recordingSession != null) { +// FFmpegKit.cancel(recordingSession.getSessionId()); +// recordingSession = null; +// } +// } +// +// // 实时截图(需手动调用) +// public static void takeSnapshot(Context context, String rtspUrl) { +// //String outputPath = context.getExternalFilesDir(null) + "/snapshot_%Y-%m-%d_%H-%M-%S.jpg"; +// +// String outputPath = "storage/emulated/0/DCIM/" + "/snapshot_%Y-%m-%d_%H-%M-%S.jpg"; +// +// String command = String.format( +// "-rtsp_transport tcp -i \"%s\" -frames:v 1 -strftime 1 \"%s\"", +// rtspUrl, outputPath +// ); +// FFmpegSession session2 = FFmpegKit.executeAsync(command,session -> { +// if (ReturnCode.isSuccess(session.getReturnCode())) +// { +// // 截图成功 +// Toast.makeText(context, "截图成功", Toast.LENGTH_SHORT).show(); +// +// } else +// { +// // 截图失败 +// Toast.makeText(context, "截图失败", Toast.LENGTH_SHORT).show(); +// } +// }); +// +//// +//// if (ReturnCode.isSuccess(session.getReturnCode())) { +//// // 截图成功 +//// } else { +//// // 截图失败 +//// } +// +//// recordingSession = FFmpegKit.executeAsync(command, session -> { +//// if (ReturnCode.isSuccess(session.getReturnCode())) +//// { +//// // 截图成功 +//// Toast.makeText(context, "截图成功", Toast.LENGTH_SHORT).show(); +//// +//// } else +//// { +//// // 截图失败 +//// Toast.makeText(context, "截图失败", Toast.LENGTH_SHORT).show(); +//// } +//// }); +// +// +// } +// +// // 方法1:通过DrawingCache(适用于可见的View) +// public static Bitmap captureView(View view) { +// view.setDrawingCacheEnabled(true); +// view.buildDrawingCache(); +// Bitmap bitmap = Bitmap.createBitmap(view.getDrawingCache()); +// view.setDrawingCacheEnabled(false); // 释放缓存 +// return bitmap; +// } +// +// // 方法2:直接绘制到Bitmap(更可靠,适用于未显示的View) +// public static Bitmap captureViewManual(View view) { +// +//// view.measure(View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED), View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED)); +//// view.layout(0, 0, view.getMeasuredWidth(), view.getMeasuredHeight()); +//// view.buildDrawingCache(); +//// Bitmap bitmap = view.getDrawingCache(); +// +// +// Bitmap bitmap = Bitmap.createBitmap(view.getWidth(), view.getHeight(), Bitmap.Config.ARGB_8888); +// Canvas canvas = new Canvas(bitmap); +// view.draw(canvas); +// return bitmap; +// } +// +// public static void SnapPictureByView (View view) +// { +// // 保存到文件(需权限) +// Date dNow=new Date(); +// SimpleDateFormat ft = new SimpleDateFormat ("yyyy-MM-dd hh-mm-ss"); +// String path = "storage/emulated/0/DCIM/" + ft.format(dNow)+ ".png"; +// File file = new File(path); +// try (FileOutputStream out = new FileOutputStream(file)) +// { +// // Bitmap screenshot = captureView(view); +// Bitmap screenshot = captureViewManual(view); +// screenshot.compress(Bitmap.CompressFormat.PNG, 100, out); +// } catch (IOException e) { +// e.printStackTrace(); +// } +// } +// +//} \ No newline at end of file diff --git a/app/src/main/java/com/example/removemarineanimals/services/USBSerialPortHelper.java b/app/src/main/java/com/example/removemarineanimals/services/USBSerialPortHelper.java new file mode 100644 index 0000000..f9f8da2 --- /dev/null +++ b/app/src/main/java/com/example/removemarineanimals/services/USBSerialPortHelper.java @@ -0,0 +1,352 @@ +package com.example.removemarineanimals.services; + +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.removemarineanimals.BuildConfig; +import com.example.removemarineanimals.MainActivity; +import com.example.removemarineanimals.models.RobotData; +import com.example.removemarineanimals.viewmodels.MainViewModel; +import com.hoho.android.usbserial.driver.UsbSerialDriver; +import com.hoho.android.usbserial.driver.UsbSerialPort; +import com.hoho.android.usbserial.driver.UsbSerialProber; +import com.hoho.android.usbserial.util.SerialInputOutputManager; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +public class USBSerialPortHelper implements SerialInputOutputManager.Listener { + + + public 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; + + 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(50, 10) { + public void onTick(long millisUntilFinished) { + + + } + + + public void onFinish() { + + status("read finished"); + try { + + decodeRceive(listTobyte(_receiveBufferlist)); + + } + catch (Exception ignored) + { + status(ignored.getMessage()); + } + _receiveBufferlist.clear(); + StartCountDown = false; + } + }.start(); + } + + + } + + void status(String str) { +// SpannableStringBuilder spn = new SpannableStringBuilder(str+'\r'+'\n'); +// +// // spn.append(getTime()); +// +// spn.setSpan(new ForegroundColorSpan(MainActivity.getResources().getColor(R.color.colorAccent)), 0, spn.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); +// receiveText.append(spn); + // mainBinding.roll.fullScroll(ScrollView.FOCUS_DOWN); + + + // com.example.removemarineanimals.MainActivity.mainBinding.message.setText(str); + } + + private void decodeRceive(byte[] data) { + try { + + + byte[] crcbytes = new byte[data.length - 2]; + System.arraycopy(data, 0, crcbytes, 0, data.length - 2); + byte[] crc=ModbusCRC.calculateCRC(crcbytes); + // status(bytesToHex(data)); + + if(data[data.length-2]==(byte)(crc[1]&0xff) && data[data.length-1]==(byte)(crc[0] & 0xff)) + { + + } + if (data[0] == 0x55 && data[1] == 0x55) { + byte[] bytes = new byte[data.length - 2]; + System.arraycopy(data, 2, bytes, 0, data.length - 2); + RobotData.DataTrans _dataTrans = RobotDataHanlder.DeoodeDataFromRobot(bytes); + //RobotData.DataTrans _dataTrans = RobotDataHanlder.DeoodeDataFromRobot(data); + status("received data"); + if (_dataTrans != null) { + + MainViewModel.mainBinding.rFAngleRoll.setText(String.valueOf(_dataTrans.getRFAngleRoll())); + + } + } + + + } catch (Exception e) { + + } + } + + + 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/removemarineanimals/services/VideoPlayerHelper.java b/app/src/main/java/com/example/removemarineanimals/services/VideoPlayerHelper.java new file mode 100644 index 0000000..7d494ae --- /dev/null +++ b/app/src/main/java/com/example/removemarineanimals/services/VideoPlayerHelper.java @@ -0,0 +1,27 @@ +package com.example.removemarineanimals.services; + +import cn.nodemedia.NodePlayer; +import cn.nodemedia.NodePlayerView; + +public class VideoPlayerHelper { + + + + public static void startVideo(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.setHWEnable(true); + nodePlayer.setMaxBufferTime(200);//设置最大缓冲时间 + nodePlayer.start(); + } +} + diff --git a/app/src/main/java/com/example/removemarineanimals/services/ttySerialPortHelper.java b/app/src/main/java/com/example/removemarineanimals/services/ttySerialPortHelper.java new file mode 100644 index 0000000..4834107 --- /dev/null +++ b/app/src/main/java/com/example/removemarineanimals/services/ttySerialPortHelper.java @@ -0,0 +1,227 @@ +package com.example.removemarineanimals.services; + +import android.util.Log; + +import com.example.removemarineanimals.models.BspIV; + +import android_serialport_api.SerialPortFinder; +import tp.xmaihh.serialport.SerialHelper; +import tp.xmaihh.serialport.bean.ComBean; + +public class ttySerialPortHelper { + public static com.example.removemarineanimals.MainActivity MainActivity; + private static final String TAG = "ttySerialPortHelper"; + private static SerialHelper serialHelper; + private static SerialPortFinder serialPortFinder; + + final String[] ports = serialPortFinder.getAllDevicesPath(); + final String[] botes = new String[]{"0", "50", "75", "110", "134", "150", "200", "300", "600", "1200", "1800", "2400", "4800", "9600", "19200", "38400", "57600", "115200", "230400", "460800", "500000", "576000", "921600", "1000000", "1152000", "1500000", "2000000", "2500000", "3000000", "3500000", "4000000", "CUSTOM"}; + final String[] databits = new String[]{"8", "7", "6", "5"}; + final String[] paritys = new String[]{"NONE", "ODD", "EVEN", "SPACE", "MARK"}; + final String[] stopbits = new String[]{"1", "2"}; + final String[] flowcons = new String[]{"NONE", "RTS/CTS", "XON/XOFF"}; + + public static int[] decodedCH=new int[17]; + + public static void Open() + { + + try { + // serialPortFinder = new SerialPortFinder(); + //serialHelper = new SerialHelper("dev/ttyHS0", 115200)//MK32 + serialHelper = new SerialHelper("/dev/ttyHS3", 115200) //UR7 + { + + @Override + protected void onDataReceived(ComBean comBean) { + + MainActivity.runOnUiThread(new Runnable() { + @Override + public void run() { + // 更新 UI 的代码 + byte[] data=comBean.bRec; + // if (data[0] == 0x55 && data[1] == 0x55) { +// byte[] bytes = new byte[data.length - 2]; +// System.arraycopy(data, 2, bytes, 0, data.length - 2); +// RobotData.DataTrans _dataTrans = RobotDataHanlder.DeoodeDataFromRobot(bytes); +// +// if (_dataTrans != null) { +// MainViewModel.mainBinding.rFAngleDepth.setText(String.valueOf(_dataTrans.getRFDepth())); +// MainViewModel.mainBinding.rFAnglePitch.setText(String.valueOf(_dataTrans.getRFAnglePitch())); +// MainViewModel.mainBinding.rFAngleRoll.setText(String.valueOf(_dataTrans.getRFAngleRoll())); +// MainViewModel.mainBinding.rFAngleYaw.setText(String.valueOf(_dataTrans.getRFAngleYaw())); +// } +// } + + try { + + byte[] crcbytes = new byte[data.length - 2]; + System.arraycopy(data, 0, crcbytes, 0, data.length - 2); + byte[] crc=ModbusCRC.calculateCRC(crcbytes); + // status(bytesToHex(data)); + + if(data[data.length-2]==(byte)(crc[1]&0xff) && data[data.length-1]==(byte)(crc[0] & 0xff)) + { + + if ((data[0] == 0x55) && (data[1] == 0x55) ) + { + + byte[] bytes = new byte[data.length - 4]; + System.arraycopy(data, 2, bytes, 0, data.length - 4); + + BspIV.IV_struct_define _toReceiveIV=BspIV.IV_struct_define.parseFrom(bytes); + + + if (_toReceiveIV!=null) + { + // MainActivity.mainBinding.rxRobotSpeed.setText(String.valueOf(_toReceiveIV.getRobotMoveSpeed())); + + MainActivity.mainBinding.rFAngleRoll.setText(String.valueOf(_toReceiveIV.getRobotAngleRoll()/100.0)); + MainActivity.mainBinding.tvRobotError.setText(String.valueOf(_toReceiveIV.getRobotError())); + MainActivity.mainBinding.tvDynamometer.setText(String.valueOf(_toReceiveIV.getRobotDynamometerValue()/100.0)); + MainActivity.mainBinding.tvForce.setText(String.valueOf(_toReceiveIV.getRobotForceValue())); + MainActivity.mainBinding.tvRobotRightCompensation.setText(String.valueOf(_toReceiveIV.getRobotCompensationRight()/100.0)); + MainActivity.mainBinding.tvRobotLeftCompensation.setText(String.valueOf(_toReceiveIV.getRobotCompensationLeft()/100.0)); + MainActivity.mainBinding.tvRobotCurrent.setText("L"+String.valueOf(_toReceiveIV.getRobotCurrentLeft()/1000) + + "R"+String.valueOf(_toReceiveIV.getRobotCurrentRight()/1000)); + + int leftError = _toReceiveIV.getRobotErrorLeft(); + int rightError = _toReceiveIV.getRobotErrorRight(); + + // 左 + if (leftError != 0) { + StringBuilder leftBits = new StringBuilder("错误: "); + for (int i = 0; i < 32; i++) { + if (((leftError >> i) & 1) == 1) { + leftBits.append(i).append(" "); + } + } + + MainActivity.mainBinding.tvLeftError.setText(leftBits.toString().trim()); + } else { + MainActivity.mainBinding.tvLeftError.setText("正常"); + } + + //右 + if (rightError != 0) { + StringBuilder rightBits = new StringBuilder("错误: "); + for (int i = 0; i < 32; i++) { + if (((rightError >> i) & 1) == 1) { + rightBits.append(i).append(" "); + } + } + MainActivity.mainBinding.tvRightError.setText(rightBits.toString().trim()); + } else { + MainActivity.mainBinding.tvRightError.setText("正常"); + } + String m = ""; + + if(_toReceiveIV.getRobotError() != 0 && _toReceiveIV.getRobotCurrentState() != 12) + { + m = "null"; + MainActivity.mainBinding.tvRobotError.setText(m); + } + else + { + switch (_toReceiveIV.getRobotCurrentState()) + { + case 0 : + m ="停止"; + break; + case 1 : + m ="前进"; + break; + case 2 : + m ="后退"; + break; + case 3 : + m ="左转"; + break; + case 4 : + m ="右转"; + break; + case 5 : + m ="自动前进"; + break; + case 6 : + m ="自动后退"; + break; + case 7 : + m ="左换道"; + break; + case 8 : + m ="右换道"; + break; + case 9 : + m ="上换道"; + break; + case 10 : + m ="下换道"; + break; + case 11 : + m ="换道完成"; + break; + case 12 : + m ="急停"; + break; + case 13 : + m = "未复位"; + break; + case 14 : + m = "复位完成"; + break; + default: + throw new IllegalStateException("Unexpected value: " + _toReceiveIV.getRobotCurrentState()); + } + MainActivity.mainBinding.tvRobotError.setText(m); + // 当状态为 0、11、12、15 时允许修改参数,否则禁用 + int state = _toReceiveIV.getRobotCurrentState(); + if (state == 0 || state == 11 || state == 12 || state == 15) { + MainActivity.enableParameterArea(); + } else { + MainActivity.disableParameterArea(); + } + } + } + } + } + + } catch (Exception e) { + + } + + } + }); + } + }; + serialHelper.open(); + } + catch (Exception exception) + { + Log.d(TAG,"Data Received"); + } + + } + private static int index =0; + + + public static void SendData(byte[] data) { + + serialHelper.send( data); // 发送byte[] + } + + public static byte[] getAllChData=new byte[]{0x55, 0x66,0x01,0x01,0x00,0x00,0x00,0x42,0x02,(byte)(0xB5&0xff),(byte)(0xC0&0xff)}; + public static byte[] stopgetAllChData=new byte[]{0x55, 0x66,0x01,0x01,0x00,0x00,0x00,0x42,0x00,(byte)(0xf7&0xff),(byte)(0xe0&0xff)}; + public static void sendTxt(String sTxt) + { + serialHelper.sendTxt( sTxt); // 发送byte[] + } + //serialHelper.send(byte[] bOutArray); // 发送byte[] +//serialHelper.sendHex(String sHex); // 发送Hex +//serialHelper.sendTxt(String sTxt); // 发送ASCII + public static void onDestroy() { + + serialHelper.close(); + } + +} \ No newline at end of file diff --git a/app/src/main/java/com/example/removemarineanimals/viewmodels/MainViewModel.java b/app/src/main/java/com/example/removemarineanimals/viewmodels/MainViewModel.java new file mode 100644 index 0000000..7e2b9ad --- /dev/null +++ b/app/src/main/java/com/example/removemarineanimals/viewmodels/MainViewModel.java @@ -0,0 +1,77 @@ +package com.example.removemarineanimals.viewmodels; + + + +import android.view.View; +import android.widget.SeekBar; + +import androidx.annotation.MainThread; +import androidx.lifecycle.LiveData; +import androidx.lifecycle.MutableLiveData; +import androidx.lifecycle.ViewModel; + +import com.example.removemarineanimals.R; +import com.example.removemarineanimals.databinding.ActivityMainBinding; +//import com.example.removemarineanimals.models.user; +//import com.example.removemarineanimals.services.RobotData; +import com.example.removemarineanimals.services.RobotDataHanlder; +//import com.example.removemarineanimals.services.VideoHelper; + +import java.io.UnsupportedEncodingException; +import java.text.SimpleDateFormat; +import java.util.Date; + +import cn.nodemedia.NodePlayer; + +public class MainViewModel extends ViewModel { + + + // public RobotData.DataTrans _dataTrans=new RobotData.DataTrans(); + public static ActivityMainBinding mainBinding;//通过Binding可以获取界面数据 + // public final MutableLiveData LiveUser; + + public MainViewModel() + { +// LiveUser = new MutableLiveData(); +// +// user u=LiveUser.getValue(); +// if(u==null) +// { +// u=new user(); +// u.setName("dddddd"); +// LiveUser.setValue(u); +// } + + + + } + + + //# region Video操作区域 + int recordVideoState=0; + + public void SnapVideo() + { + + + } + + //#end region Video操作区域 + + void SetPage() + { + + + } + + public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { + + } + + + + + + + +} diff --git a/app/src/main/res/drawable/background.xml b/app/src/main/res/drawable/background.xml new file mode 100644 index 0000000..853e760 --- /dev/null +++ b/app/src/main/res/drawable/background.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + 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/message_rounded_rectangle.xml b/app/src/main/res/drawable/message_rounded_rectangle.xml new file mode 100644 index 0000000..4b88f7d --- /dev/null +++ b/app/src/main/res/drawable/message_rounded_rectangle.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/dialog_logs.xml b/app/src/main/res/layout/dialog_logs.xml new file mode 100644 index 0000000..49b534b --- /dev/null +++ b/app/src/main/res/layout/dialog_logs.xml @@ -0,0 +1,15 @@ + + + + + + diff --git a/app/src/test/java/com/example/removemarineanimals/ExampleUnitTest.java b/app/src/test/java/com/example/removemarineanimals/ExampleUnitTest.java new file mode 100644 index 0000000..e4c36cc --- /dev/null +++ b/app/src/test/java/com/example/removemarineanimals/ExampleUnitTest.java @@ -0,0 +1,17 @@ +package com.example.removemarineanimals; + +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/proto/BspIV.java b/proto/BspIV.java new file mode 100644 index 0000000..5deef62 --- /dev/null +++ b/proto/BspIV.java @@ -0,0 +1,729 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: bsp_IV.proto +// Protobuf Java Version: 4.27.2 + +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 { + + /** + *
+     * 洗舱项目
+     * 
+ * + * int32 Robot_Move_Speed = 1; + * @return The robotMoveSpeed. + */ + int getRobotMoveSpeed(); + + /** + * int32 Robot_Swing_Speed = 2; + * @return The robotSwingSpeed. + */ + int getRobotSwingSpeed(); + + /** + * int32 Robot_Tilt_Speed = 3; + * @return The robotTiltSpeed. + */ + int getRobotTiltSpeed(); + + /** + * int32 Robot_Tilt_Current = 4; + * @return The robotTiltCurrent. + */ + int getRobotTiltCurrent(); + } + /** + * 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 BspIV.internal_static_IV_struct_define_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return BspIV.internal_static_IV_struct_define_fieldAccessorTable + .ensureFieldAccessorsInitialized( + BspIV.IV_struct_define.class, BspIV.IV_struct_define.Builder.class); + } + + public static final int ROBOT_MOVE_SPEED_FIELD_NUMBER = 1; + private int robotMoveSpeed_ = 0; + /** + *
+     * 洗舱项目
+     * 
+ * + * int32 Robot_Move_Speed = 1; + * @return The robotMoveSpeed. + */ + @java.lang.Override + public int getRobotMoveSpeed() { + return robotMoveSpeed_; + } + + public static final int ROBOT_SWING_SPEED_FIELD_NUMBER = 2; + private int robotSwingSpeed_ = 0; + /** + * int32 Robot_Swing_Speed = 2; + * @return The robotSwingSpeed. + */ + @java.lang.Override + public int getRobotSwingSpeed() { + return robotSwingSpeed_; + } + + public static final int ROBOT_TILT_SPEED_FIELD_NUMBER = 3; + private int robotTiltSpeed_ = 0; + /** + * int32 Robot_Tilt_Speed = 3; + * @return The robotTiltSpeed. + */ + @java.lang.Override + public int getRobotTiltSpeed() { + return robotTiltSpeed_; + } + + public static final int ROBOT_TILT_CURRENT_FIELD_NUMBER = 4; + private int robotTiltCurrent_ = 0; + /** + * int32 Robot_Tilt_Current = 4; + * @return The robotTiltCurrent. + */ + @java.lang.Override + public int getRobotTiltCurrent() { + return robotTiltCurrent_; + } + + 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 (robotMoveSpeed_ != 0) { + output.writeInt32(1, robotMoveSpeed_); + } + if (robotSwingSpeed_ != 0) { + output.writeInt32(2, robotSwingSpeed_); + } + if (robotTiltSpeed_ != 0) { + output.writeInt32(3, robotTiltSpeed_); + } + if (robotTiltCurrent_ != 0) { + output.writeInt32(4, robotTiltCurrent_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (robotMoveSpeed_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(1, robotMoveSpeed_); + } + if (robotSwingSpeed_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(2, robotSwingSpeed_); + } + if (robotTiltSpeed_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(3, robotTiltSpeed_); + } + if (robotTiltCurrent_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(4, robotTiltCurrent_); + } + 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 BspIV.IV_struct_define)) { + return super.equals(obj); + } + BspIV.IV_struct_define other = (BspIV.IV_struct_define) obj; + + if (getRobotMoveSpeed() + != other.getRobotMoveSpeed()) return false; + if (getRobotSwingSpeed() + != other.getRobotSwingSpeed()) return false; + if (getRobotTiltSpeed() + != other.getRobotTiltSpeed()) return false; + if (getRobotTiltCurrent() + != other.getRobotTiltCurrent()) 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_MOVE_SPEED_FIELD_NUMBER; + hash = (53 * hash) + getRobotMoveSpeed(); + hash = (37 * hash) + ROBOT_SWING_SPEED_FIELD_NUMBER; + hash = (53 * hash) + getRobotSwingSpeed(); + hash = (37 * hash) + ROBOT_TILT_SPEED_FIELD_NUMBER; + hash = (53 * hash) + getRobotTiltSpeed(); + hash = (37 * hash) + ROBOT_TILT_CURRENT_FIELD_NUMBER; + hash = (53 * hash) + getRobotTiltCurrent(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static BspIV.IV_struct_define parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static 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 BspIV.IV_struct_define parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static 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 BspIV.IV_struct_define parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static BspIV.IV_struct_define parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static BspIV.IV_struct_define parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static 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 BspIV.IV_struct_define parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input); + } + + public static 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 BspIV.IV_struct_define parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static 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(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) + BspIV.IV_struct_defineOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return BspIV.internal_static_IV_struct_define_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return BspIV.internal_static_IV_struct_define_fieldAccessorTable + .ensureFieldAccessorsInitialized( + BspIV.IV_struct_define.class, BspIV.IV_struct_define.Builder.class); + } + + // Construct using 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; + robotMoveSpeed_ = 0; + robotSwingSpeed_ = 0; + robotTiltSpeed_ = 0; + robotTiltCurrent_ = 0; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return BspIV.internal_static_IV_struct_define_descriptor; + } + + @java.lang.Override + public BspIV.IV_struct_define getDefaultInstanceForType() { + return BspIV.IV_struct_define.getDefaultInstance(); + } + + @java.lang.Override + public BspIV.IV_struct_define build() { + BspIV.IV_struct_define result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public BspIV.IV_struct_define buildPartial() { + BspIV.IV_struct_define result = new BspIV.IV_struct_define(this); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartial0(BspIV.IV_struct_define result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.robotMoveSpeed_ = robotMoveSpeed_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.robotSwingSpeed_ = robotSwingSpeed_; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.robotTiltSpeed_ = robotTiltSpeed_; + } + if (((from_bitField0_ & 0x00000008) != 0)) { + result.robotTiltCurrent_ = robotTiltCurrent_; + } + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof BspIV.IV_struct_define) { + return mergeFrom((BspIV.IV_struct_define)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(BspIV.IV_struct_define other) { + if (other == BspIV.IV_struct_define.getDefaultInstance()) return this; + if (other.getRobotMoveSpeed() != 0) { + setRobotMoveSpeed(other.getRobotMoveSpeed()); + } + if (other.getRobotSwingSpeed() != 0) { + setRobotSwingSpeed(other.getRobotSwingSpeed()); + } + if (other.getRobotTiltSpeed() != 0) { + setRobotTiltSpeed(other.getRobotTiltSpeed()); + } + if (other.getRobotTiltCurrent() != 0) { + setRobotTiltCurrent(other.getRobotTiltCurrent()); + } + 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: { + robotMoveSpeed_ = input.readInt32(); + bitField0_ |= 0x00000001; + break; + } // case 8 + case 16: { + robotSwingSpeed_ = input.readInt32(); + bitField0_ |= 0x00000002; + break; + } // case 16 + case 24: { + robotTiltSpeed_ = input.readInt32(); + bitField0_ |= 0x00000004; + break; + } // case 24 + case 32: { + robotTiltCurrent_ = input.readInt32(); + bitField0_ |= 0x00000008; + break; + } // case 32 + 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 robotMoveSpeed_ ; + /** + *
+       * 洗舱项目
+       * 
+ * + * int32 Robot_Move_Speed = 1; + * @return The robotMoveSpeed. + */ + @java.lang.Override + public int getRobotMoveSpeed() { + return robotMoveSpeed_; + } + /** + *
+       * 洗舱项目
+       * 
+ * + * int32 Robot_Move_Speed = 1; + * @param value The robotMoveSpeed to set. + * @return This builder for chaining. + */ + public Builder setRobotMoveSpeed(int value) { + + robotMoveSpeed_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + *
+       * 洗舱项目
+       * 
+ * + * int32 Robot_Move_Speed = 1; + * @return This builder for chaining. + */ + public Builder clearRobotMoveSpeed() { + bitField0_ = (bitField0_ & ~0x00000001); + robotMoveSpeed_ = 0; + onChanged(); + return this; + } + + private int robotSwingSpeed_ ; + /** + * int32 Robot_Swing_Speed = 2; + * @return The robotSwingSpeed. + */ + @java.lang.Override + public int getRobotSwingSpeed() { + return robotSwingSpeed_; + } + /** + * int32 Robot_Swing_Speed = 2; + * @param value The robotSwingSpeed to set. + * @return This builder for chaining. + */ + public Builder setRobotSwingSpeed(int value) { + + robotSwingSpeed_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * int32 Robot_Swing_Speed = 2; + * @return This builder for chaining. + */ + public Builder clearRobotSwingSpeed() { + bitField0_ = (bitField0_ & ~0x00000002); + robotSwingSpeed_ = 0; + onChanged(); + return this; + } + + private int robotTiltSpeed_ ; + /** + * int32 Robot_Tilt_Speed = 3; + * @return The robotTiltSpeed. + */ + @java.lang.Override + public int getRobotTiltSpeed() { + return robotTiltSpeed_; + } + /** + * int32 Robot_Tilt_Speed = 3; + * @param value The robotTiltSpeed to set. + * @return This builder for chaining. + */ + public Builder setRobotTiltSpeed(int value) { + + robotTiltSpeed_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * int32 Robot_Tilt_Speed = 3; + * @return This builder for chaining. + */ + public Builder clearRobotTiltSpeed() { + bitField0_ = (bitField0_ & ~0x00000004); + robotTiltSpeed_ = 0; + onChanged(); + return this; + } + + private int robotTiltCurrent_ ; + /** + * int32 Robot_Tilt_Current = 4; + * @return The robotTiltCurrent. + */ + @java.lang.Override + public int getRobotTiltCurrent() { + return robotTiltCurrent_; + } + /** + * int32 Robot_Tilt_Current = 4; + * @param value The robotTiltCurrent to set. + * @return This builder for chaining. + */ + public Builder setRobotTiltCurrent(int value) { + + robotTiltCurrent_ = value; + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + /** + * int32 Robot_Tilt_Current = 4; + * @return This builder for chaining. + */ + public Builder clearRobotTiltCurrent() { + bitField0_ = (bitField0_ & ~0x00000008); + robotTiltCurrent_ = 0; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:IV_struct_define) + } + + // @@protoc_insertion_point(class_scope:IV_struct_define) + private static final BspIV.IV_struct_define DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new BspIV.IV_struct_define(); + } + + public static 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 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\"}\n\020IV_struct_define\022\030\n\020Ro" + + "bot_Move_Speed\030\001 \001(\005\022\031\n\021Robot_Swing_Spee" + + "d\030\002 \001(\005\022\030\n\020Robot_Tilt_Speed\030\003 \001(\005\022\032\n\022Rob" + + "ot_Tilt_Current\030\004 \001(\005b\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[] { "RobotMoveSpeed", "RobotSwingSpeed", "RobotTiltSpeed", "RobotTiltCurrent", }); + descriptor.resolveAllFeaturesImmutable(); + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/proto/BspPV.java b/proto/BspPV.java new file mode 100644 index 0000000..8918130 --- /dev/null +++ b/proto/BspPV.java @@ -0,0 +1,564 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: bsp_PV.proto +// Protobuf Java Version: 4.27.2 + +public final class BspPV { + private BspPV() {} + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 27, + /* patch= */ 2, + /* suffix= */ "", + BspPV.class.getName()); + } + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistryLite registry) { + } + + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistry registry) { + registerAllExtensions( + (com.google.protobuf.ExtensionRegistryLite) registry); + } + public interface PV_struct_defineOrBuilder extends + // @@protoc_insertion_point(interface_extends:PV_struct_define) + com.google.protobuf.MessageOrBuilder { + + /** + * int32 Robot_Tilt_TargetCurrent = 1; + * @return The robotTiltTargetCurrent. + */ + int getRobotTiltTargetCurrent(); + + /** + * int32 CurrentModeValue = 2; + * @return The currentModeValue. + */ + int getCurrentModeValue(); + } + /** + * 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 BspPV.internal_static_PV_struct_define_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return BspPV.internal_static_PV_struct_define_fieldAccessorTable + .ensureFieldAccessorsInitialized( + BspPV.PV_struct_define.class, BspPV.PV_struct_define.Builder.class); + } + + public static final int ROBOT_TILT_TARGETCURRENT_FIELD_NUMBER = 1; + private int robotTiltTargetCurrent_ = 0; + /** + * int32 Robot_Tilt_TargetCurrent = 1; + * @return The robotTiltTargetCurrent. + */ + @java.lang.Override + public int getRobotTiltTargetCurrent() { + return robotTiltTargetCurrent_; + } + + public static final int CURRENTMODEVALUE_FIELD_NUMBER = 2; + private int currentModeValue_ = 0; + /** + * int32 CurrentModeValue = 2; + * @return The currentModeValue. + */ + @java.lang.Override + public int getCurrentModeValue() { + return currentModeValue_; + } + + 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 (robotTiltTargetCurrent_ != 0) { + output.writeInt32(1, robotTiltTargetCurrent_); + } + if (currentModeValue_ != 0) { + output.writeInt32(2, currentModeValue_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (robotTiltTargetCurrent_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(1, robotTiltTargetCurrent_); + } + if (currentModeValue_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(2, currentModeValue_); + } + 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 BspPV.PV_struct_define)) { + return super.equals(obj); + } + BspPV.PV_struct_define other = (BspPV.PV_struct_define) obj; + + if (getRobotTiltTargetCurrent() + != other.getRobotTiltTargetCurrent()) return false; + if (getCurrentModeValue() + != other.getCurrentModeValue()) 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_TILT_TARGETCURRENT_FIELD_NUMBER; + hash = (53 * hash) + getRobotTiltTargetCurrent(); + hash = (37 * hash) + CURRENTMODEVALUE_FIELD_NUMBER; + hash = (53 * hash) + getCurrentModeValue(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static BspPV.PV_struct_define parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static 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 BspPV.PV_struct_define parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static 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 BspPV.PV_struct_define parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static BspPV.PV_struct_define parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static BspPV.PV_struct_define parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static 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 BspPV.PV_struct_define parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input); + } + + public static 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 BspPV.PV_struct_define parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static 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(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) + BspPV.PV_struct_defineOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return BspPV.internal_static_PV_struct_define_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return BspPV.internal_static_PV_struct_define_fieldAccessorTable + .ensureFieldAccessorsInitialized( + BspPV.PV_struct_define.class, BspPV.PV_struct_define.Builder.class); + } + + // Construct using 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; + robotTiltTargetCurrent_ = 0; + currentModeValue_ = 0; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return BspPV.internal_static_PV_struct_define_descriptor; + } + + @java.lang.Override + public BspPV.PV_struct_define getDefaultInstanceForType() { + return BspPV.PV_struct_define.getDefaultInstance(); + } + + @java.lang.Override + public BspPV.PV_struct_define build() { + BspPV.PV_struct_define result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public BspPV.PV_struct_define buildPartial() { + BspPV.PV_struct_define result = new BspPV.PV_struct_define(this); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartial0(BspPV.PV_struct_define result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.robotTiltTargetCurrent_ = robotTiltTargetCurrent_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.currentModeValue_ = currentModeValue_; + } + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof BspPV.PV_struct_define) { + return mergeFrom((BspPV.PV_struct_define)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(BspPV.PV_struct_define other) { + if (other == BspPV.PV_struct_define.getDefaultInstance()) return this; + if (other.getRobotTiltTargetCurrent() != 0) { + setRobotTiltTargetCurrent(other.getRobotTiltTargetCurrent()); + } + if (other.getCurrentModeValue() != 0) { + setCurrentModeValue(other.getCurrentModeValue()); + } + 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: { + robotTiltTargetCurrent_ = input.readInt32(); + bitField0_ |= 0x00000001; + break; + } // case 8 + case 16: { + currentModeValue_ = input.readInt32(); + bitField0_ |= 0x00000002; + break; + } // case 16 + 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 robotTiltTargetCurrent_ ; + /** + * int32 Robot_Tilt_TargetCurrent = 1; + * @return The robotTiltTargetCurrent. + */ + @java.lang.Override + public int getRobotTiltTargetCurrent() { + return robotTiltTargetCurrent_; + } + /** + * int32 Robot_Tilt_TargetCurrent = 1; + * @param value The robotTiltTargetCurrent to set. + * @return This builder for chaining. + */ + public Builder setRobotTiltTargetCurrent(int value) { + + robotTiltTargetCurrent_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * int32 Robot_Tilt_TargetCurrent = 1; + * @return This builder for chaining. + */ + public Builder clearRobotTiltTargetCurrent() { + bitField0_ = (bitField0_ & ~0x00000001); + robotTiltTargetCurrent_ = 0; + onChanged(); + return this; + } + + private int currentModeValue_ ; + /** + * int32 CurrentModeValue = 2; + * @return The currentModeValue. + */ + @java.lang.Override + public int getCurrentModeValue() { + return currentModeValue_; + } + /** + * int32 CurrentModeValue = 2; + * @param value The currentModeValue to set. + * @return This builder for chaining. + */ + public Builder setCurrentModeValue(int value) { + + currentModeValue_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * int32 CurrentModeValue = 2; + * @return This builder for chaining. + */ + public Builder clearCurrentModeValue() { + bitField0_ = (bitField0_ & ~0x00000002); + currentModeValue_ = 0; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:PV_struct_define) + } + + // @@protoc_insertion_point(class_scope:PV_struct_define) + private static final BspPV.PV_struct_define DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new BspPV.PV_struct_define(); + } + + public static 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 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\"N\n\020PV_struct_define\022 \n\030Ro" + + "bot_Tilt_TargetCurrent\030\001 \001(\005\022\030\n\020CurrentM" + + "odeValue\030\002 \001(\005b\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[] { "RobotTiltTargetCurrent", "CurrentModeValue", }); + descriptor.resolveAllFeaturesImmutable(); + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/proto/bsp_IV.proto b/proto/bsp_IV.proto new file mode 100644 index 0000000..b5fc91d --- /dev/null +++ b/proto/bsp_IV.proto @@ -0,0 +1,10 @@ +syntax = "proto3"; +message IV_struct_define{ + + // 洗舱项目 + int32 Robot_Move_Speed= 1; + int32 Robot_Swing_Speed= 2; + int32 Robot_Tilt_Speed= 3; + int32 Robot_Tilt_Current= 4; + +}; diff --git a/proto/bsp_PV.proto b/proto/bsp_PV.proto new file mode 100644 index 0000000..598fc65 --- /dev/null +++ b/proto/bsp_PV.proto @@ -0,0 +1,6 @@ +syntax = "proto3"; +message PV_struct_define{ + + int32 Robot_Tilt_TargetCurrent= 1; + int32 CurrentModeValue=2; +};