From 4f4a337c1b067cb604a84f73dc1fa7c3f6ea65e2 Mon Sep 17 00:00:00 2001 From: lixiaopeng Date: Tue, 7 Feb 2023 18:07:42 +0800 Subject: [PATCH 1/3] =?UTF-8?q?[dev=5Frobotaxi-d-app-module=5F2132=5F22122?= =?UTF-8?q?3=5F2.13.2]=20=E4=BC=98=E5=8C=96=E9=AD=94=E6=96=B9=E7=9A=84?= =?UTF-8?q?=E6=8C=89=E9=94=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../function/main/MainLauncherActivity.java | 32 ++++++++++--------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/MainLauncherActivity.java b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/MainLauncherActivity.java index 012b4f7f38..57da422786 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/MainLauncherActivity.java +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/MainLauncherActivity.java @@ -10,10 +10,8 @@ import android.os.Bundle; import android.os.Handler; import android.os.Process; import android.text.TextUtils; -import android.util.Log; import android.view.KeyEvent; import android.widget.FrameLayout; - import androidx.annotation.Nullable; import com.alibaba.android.arouter.launcher.ARouter; @@ -25,7 +23,6 @@ import com.mogo.eagle.core.function.api.base.IMoGoFunctionProvider; import com.mogo.eagle.core.function.api.setting.IMoGoSkinModeChangeListener; import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager; import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager; -import com.mogo.eagle.core.function.call.hmi.CallerHmiManager; import com.mogo.eagle.core.function.call.setting.CallerSkinModeListenerManager; import com.mogo.eagle.core.function.hmi.R; import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils; @@ -76,6 +73,11 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis private long pressEDownTime = 0; private long pressEUpTime = 0; + private int clickTime = 300; //单击 + private int clickTimeInterval = 330; + private int longPressTime = 670; + private int longPressTimeInterval = 700; + @Override protected void onCreate(@Nullable Bundle savedInstanceState) { @@ -219,7 +221,7 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis if (event.getAction() == KeyEvent.ACTION_DOWN) { pressADownTime = System.currentTimeMillis(); CallerLogger.INSTANCE.d(M_F + "MoFangManager", "dispatchKeyEvent A down pressADownTime = " + pressADownTime + "---" + (pressADownTime - startPressTime) + "----isCombinationKey = " + isCombinationKey + "--pressBDownTime = " + pressBDownTime); - if ((pressADownTime - startPressTime) > 360 && (pressADownTime - startPressTime) < 1300 && pressBDownTime > 0) { + if ((pressADownTime - startPressTime) > clickTimeInterval && (pressADownTime - startPressTime) < longPressTime && pressBDownTime > 0) { if (isShowToast) { ToastUtils.showShort("方块 A 按AB组合 +1 "); } @@ -228,7 +230,7 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis } if (isCombinationKey != 3 && isCombinationKey != 1) { - if ((pressADownTime - startPressTime) > 1320) { + if ((pressADownTime - startPressTime) > longPressTimeInterval) { if (isShowToast) { ToastUtils.showShort("方块 长按A -2 "); } @@ -239,7 +241,7 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis } else if (event.getAction() == KeyEvent.ACTION_UP) { pressAUpTime = System.currentTimeMillis(); CallerLogger.INSTANCE.d(M_F + "MoFangManager", "dispatchKeyEvent A up pressAUpTime = " + pressAUpTime + "---" + (pressAUpTime - startPressTime) + "--pressBDownTime = " + pressBDownTime); - if ((pressAUpTime - startPressTime) < 350 && isCombinationKey != 3) { + if ((pressAUpTime - startPressTime) < clickTime && isCombinationKey != 3) { isCombinationKey = 1; if (isShowToast) { ToastUtils.showShort("方块 单击A -1 "); @@ -260,7 +262,7 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis if (event.getAction() == KeyEvent.ACTION_DOWN) { pressBDownTime = System.currentTimeMillis(); CallerLogger.INSTANCE.d(M_F + "MoFangManager", "dispatchKeyEvent B down pressBDownTime = " + pressBDownTime + "--差-" + (pressBDownTime - startPressTime) + "---isCombinationKey = " + isCombinationKey + "--pressADownTime = " + pressADownTime); - if ((pressBDownTime - startPressTime) > 360 && (pressBDownTime - startPressTime) < 1300 && pressADownTime > 0) { + if ((pressBDownTime - startPressTime) > clickTimeInterval && (pressBDownTime - startPressTime) < longPressTime && pressADownTime > 0) { if (isShowToast) { ToastUtils.showShort("方块 B 按AB组合 +1 "); } @@ -268,7 +270,7 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis isCombinationKey = 3; } if (isCombinationKey != 3 && isCombinationKey != 1) { - if ((pressBDownTime - startPressTime) > 1320) { + if ((pressBDownTime - startPressTime) > longPressTimeInterval) { if (isShowToast) { ToastUtils.showShort("方块 长按B 无操作 "); } @@ -278,7 +280,7 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis } else if (event.getAction() == KeyEvent.ACTION_UP) { pressBUpTime = System.currentTimeMillis(); CallerLogger.INSTANCE.d(M_F + "MoFangManager", "dispatchKeyEvent B up pressBUpTime = " + pressBUpTime + "--差-" + (pressBUpTime - startPressTime) + "--pressADownTime = " + pressADownTime); - if ((pressBUpTime - startPressTime) < 350 && isCombinationKey != 3) { + if ((pressBUpTime - startPressTime) < clickTime && isCombinationKey != 3) { if (isShowToast) { ToastUtils.showShort("方块 单击B 0 "); } @@ -300,7 +302,7 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis if (event.getAction() == KeyEvent.ACTION_DOWN) { pressCDownTime = System.currentTimeMillis(); CallerLogger.INSTANCE.d(M_F + "MoFangManager", "dispatchKeyEvent 方块 长按C 无操作 time dif = " + (pressCDownTime - startPressTime)); - if ((pressCDownTime - startPressTime) > 1320) { + if ((pressCDownTime - startPressTime) > longPressTimeInterval) { if (isShowToast) { ToastUtils.showShort("方块 长按C 无操作 "); } @@ -309,7 +311,7 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis pressCUpTime = System.currentTimeMillis(); isPressEnd = false; CallerLogger.INSTANCE.d(M_F + "MoFangManager", "dispatchKeyEvent 方块 单击C ← 向左变道 time dif = " + (pressCUpTime - startPressTime)); - if ((pressCUpTime - startPressTime) < 350) { + if ((pressCUpTime - startPressTime) < clickTime) { if (isShowToast) { ToastUtils.showShort("方块 单击C ← 向左变道 "); } @@ -321,7 +323,7 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis if (event.getAction() == KeyEvent.ACTION_DOWN) { pressDDownTime = System.currentTimeMillis(); CallerLogger.INSTANCE.d(M_F + "MoFangManager", "dispatchKeyEvent 方块 长按D 无操作 time dif = " + (pressDDownTime - startPressTime)); - if ((pressDDownTime - startPressTime) > 1320) { + if ((pressDDownTime - startPressTime) > longPressTimeInterval) { if (isShowToast) { ToastUtils.showShort("方块 长按D 无操作 "); } @@ -330,7 +332,7 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis pressDUpTime = System.currentTimeMillis(); isPressEnd = false; CallerLogger.INSTANCE.d(M_F + "MoFangManager", "dispatchKeyEvent 方块 单击D → 向右变道 time dif = " + (pressDUpTime - startPressTime)); - if ((pressDUpTime - startPressTime) < 350) { + if ((pressDUpTime - startPressTime) < clickTime) { if (isShowToast) { ToastUtils.showShort("方块 单击D → 向右变道 "); } @@ -342,7 +344,7 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis if (event.getAction() == KeyEvent.ACTION_DOWN) { pressEDownTime = System.currentTimeMillis(); CallerLogger.INSTANCE.d(M_F + "MoFangManager", "dispatchKeyEvent 方块 长按E 鸣笛 time dif = " + (pressEDownTime - startPressTime)); - if ((pressEDownTime - startPressTime) > 1320) { + if ((pressEDownTime - startPressTime) > longPressTimeInterval) { if (isShowToast) { ToastUtils.showShort("方块 长按E 鸣笛 "); } @@ -362,7 +364,7 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis pressEUpTime = System.currentTimeMillis(); isPressEnd = false; CallerLogger.INSTANCE.d(M_F + "MoFangManager", "方块 单击E 开启自动驾驶 time dif = " + (pressEUpTime - startPressTime)); - if ((pressEUpTime - startPressTime) < 350) { + if ((pressEUpTime - startPressTime) < clickTime) { if (isShowToast) { ToastUtils.showShort("方块 单击E 开启自动驾驶 "); } From a3e889ed8b2e41ec0494f9cd6d3d9a00518188c4 Mon Sep 17 00:00:00 2001 From: lixiaopeng Date: Thu, 9 Feb 2023 17:41:35 +0800 Subject: [PATCH 2/3] =?UTF-8?q?[dev=5Frobotaxi-d-app-module=5F2132=5F22122?= =?UTF-8?q?3=5F2.13.2]=20=E7=BB=9F=E4=B8=80taxi=E5=92=8Cbus=20obu=E7=9A=84?= =?UTF-8?q?ip?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/function/obu/mogo/MoGoObuProvider.kt | 37 +++++-------------- 1 file changed, 9 insertions(+), 28 deletions(-) diff --git a/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/MoGoObuProvider.kt b/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/MoGoObuProvider.kt index a4de8e25d8..a4ab0a31ea 100644 --- a/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/MoGoObuProvider.kt +++ b/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/MoGoObuProvider.kt @@ -21,8 +21,7 @@ class MoGoObuProvider : IMoGoObuProvider { private val TAG = "MoGoObuProvider" private var mContext: Context? = null - private val busObuIp = "192.168.8.199" - private val taxiObuIp = "192.168.1.199" + private val taxiObuIp = "192.168.1.199" //taxi和bus网段统一 override val functionName: String get() = TAG @@ -44,32 +43,14 @@ class MoGoObuProvider : IMoGoObuProvider { } else { mContext = context mContext?.let { - if (AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode)) { //bus 司机端 - val ipAddress = - SharedPrefsMgr.getInstance(context).getString(MoGoConfig.OBU_IP, busObuIp) - - //mogo obu - MogoPrivateObuNewManager.INSTANCE.connectObu( - it, - ipAddress, - CommonUtils.getIpAddressString() - ) - - //old obu - MogoPrivateObuManager.INSTANCE.init(context, ipAddress) - } else if (AppIdentityModeUtils.isTaxi(FunctionBuildConfig.appIdentityMode)) { //taxi 司机端和乘客端 - val ipAddress = - SharedPrefsMgr.getInstance(context).getString(MoGoConfig.OBU_IP, taxiObuIp) - //mogo obu - MogoPrivateObuNewManager.INSTANCE.connectObu( - it, - ipAddress, - CommonUtils.getIpAddressString() - ) - - //old obu - MogoPrivateObuManager.INSTANCE.init(context, ipAddress) - } + val ipAddress = + SharedPrefsMgr.getInstance(context).getString(MoGoConfig.OBU_IP, taxiObuIp) + //mogo obu + MogoPrivateObuNewManager.INSTANCE.connectObu( + it, + ipAddress, + CommonUtils.getIpAddressString() + ) } } } From 1f7da9bd2936a6fb3ba9752629b7031581a1c42d Mon Sep 17 00:00:00 2001 From: lixiaopeng Date: Fri, 10 Feb 2023 17:28:41 +0800 Subject: [PATCH 3/3] =?UTF-8?q?[dev=5Frobotaxi-d-app-module=5F2132=5F22122?= =?UTF-8?q?3=5F2.13.2]=20=E5=8E=BB=E6=8E=89=E6=96=AD=E5=BC=80=E8=80=81obu?= =?UTF-8?q?=E7=9A=84=E6=93=8D=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/function/hmi/ui/setting/SOPSettingView.kt | 11 ++++++----- .../function/obu/mogo/MogoPrivateObuNewManager.kt | 7 ------- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/SOPSettingView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/SOPSettingView.kt index 6865374f1c..87f08bde14 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/SOPSettingView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/SOPSettingView.kt @@ -188,11 +188,12 @@ class SOPSettingView @JvmOverloads constructor( tbObu.isChecked = CallerOBUManager.isConnected() tbObu.setOnCheckedChangeListener { _, isChecked -> if (!isChecked) { - if (AppIdentityModeUtils.isTaxi(FunctionBuildConfig.appIdentityMode)) { - CallerOBUManager.resetObuIpAddress("192.168.1.199") - } else if (AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode)) { - CallerOBUManager.resetObuIpAddress("192.168.8.199") - } + CallerOBUManager.resetObuIpAddress("192.168.1.199") +// if (AppIdentityModeUtils.isTaxi(FunctionBuildConfig.appIdentityMode)) { +// CallerOBUManager.resetObuIpAddress("192.168.1.199") +// } else if (AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode)) { +// CallerOBUManager.resetObuIpAddress("192.168.8.199") +// } } else { //断开链接 CallerOBUManager.disConnectObu() diff --git a/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/MogoPrivateObuNewManager.kt b/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/MogoPrivateObuNewManager.kt index e22a0d3f7e..7bf199d550 100644 --- a/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/MogoPrivateObuNewManager.kt +++ b/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/MogoPrivateObuNewManager.kt @@ -106,13 +106,6 @@ class MogoPrivateObuNewManager private constructor() { mObuStatusInfo.obuStatus = true CallerObuListenerManager.invokeListener(mObuStatusInfo) mContext?.let { SharedPrefsMgr.getInstance(it).putBoolean("OBU", true) } - - //断开老obu - try { - com.zhidao.support.obu.MogoObuManager.getInstance().disConnect() - } catch (e: Exception) { - e.printStackTrace() - } } }