diff --git a/OCH/charter/driver/src/main/java/com/magic/mogo/och/charter/model/DriverM1Model.kt b/OCH/charter/driver/src/main/java/com/magic/mogo/och/charter/model/DriverM1Model.kt index 8f15153e64..63ff59197f 100644 --- a/OCH/charter/driver/src/main/java/com/magic/mogo/och/charter/model/DriverM1Model.kt +++ b/OCH/charter/driver/src/main/java/com/magic/mogo/och/charter/model/DriverM1Model.kt @@ -385,7 +385,7 @@ class DriverM1Model { private fun onArriveAtSuccess() { isArrivedStation = true LedScreenManager.sendTripInfo2Led(LedScreenManager.ARRIVE_STATION,mCurrentOrder?.lineName!! - ,mCurrentOrder?.startSiteName!!,mCurrentOrder?.siteName!!,false) + ,mCurrentOrder?.startSiteName!!,mCurrentOrder?.siteName!!,false,"") if (currentChangeDestMsg != null){ currentChangeDestMsg?.isConfirmed = true @@ -771,13 +771,13 @@ class DriverM1Model { private fun sendCharterStartTripInfo() { if (mCurrentOrder == null) return LedScreenManager.sendTripInfo2Led(LedScreenManager.START_TRIP,mCurrentOrder?.lineName!! - ,"","",false) + ,"","",false,"") } private fun sendCharterEndTripInfo() { if (mCurrentOrder == null) return LedScreenManager.sendTripInfo2Led(LedScreenManager.END_TRIP,mCurrentOrder?.lineName!! - ,"","",false) + ,"","",false,"") } fun checkOrderCountDown() { diff --git a/OCH/charter/passenger/src/main/java/com/mogo/och/charter/passenger/model/CharterPassengerModel.kt b/OCH/charter/passenger/src/main/java/com/mogo/och/charter/passenger/model/CharterPassengerModel.kt index fa49f0d7b6..95bed5869f 100644 --- a/OCH/charter/passenger/src/main/java/com/mogo/och/charter/passenger/model/CharterPassengerModel.kt +++ b/OCH/charter/passenger/src/main/java/com/mogo/och/charter/passenger/model/CharterPassengerModel.kt @@ -1226,7 +1226,7 @@ object CharterPassengerModel { if(!it.lineName.isNullOrEmpty()&&!it.startSiteName.isNullOrEmpty()&&!it.siteName.isNullOrEmpty()) { LedScreenManager.sendTripInfo2Led( LedScreenManager.LEAVE_STATION, - it.lineName, it.startSiteName!!, it.siteName!!, false + it.lineName, it.startSiteName!!, it.siteName!!, false,"" ) } } diff --git a/OCH/common/common/src/debug/java/com/mogo/och/common/module/view/DebugFloatWindow.kt b/OCH/common/common/src/debug/java/com/mogo/och/common/module/view/DebugFloatWindow.kt index 93b7190e60..a446ccd4b8 100644 --- a/OCH/common/common/src/debug/java/com/mogo/och/common/module/view/DebugFloatWindow.kt +++ b/OCH/common/common/src/debug/java/com/mogo/och/common/module/view/DebugFloatWindow.kt @@ -3,18 +3,26 @@ package com.mogo.och.common.module.view import android.app.Activity import android.graphics.PixelFormat import android.util.DisplayMetrics -import android.view.* +import android.view.Gravity +import android.view.LayoutInflater +import android.view.MotionEvent +import android.view.View +import android.view.WindowManager import android.widget.RadioGroup +import android.widget.ToggleButton import androidx.appcompat.widget.AppCompatButton import androidx.appcompat.widget.AppCompatCheckBox +import androidx.appcompat.widget.AppCompatEditText import androidx.appcompat.widget.AppCompatImageView -import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager import com.mogo.eagle.core.utilcode.kotlin.onClick import com.mogo.eagle.core.utilcode.util.BarUtils +import com.mogo.eagle.core.utilcode.util.RegexUtils +import com.mogo.eagle.core.utilcode.util.ToastUtils import com.mogo.och.common.module.R import com.mogo.och.common.module.biz.media.VoiceNotice import com.mogo.och.common.module.debug.autopilot.AutopilotStateDebug -import mogo_msg.MogoReportMsg +import com.mogo.support.device.culed.CuLedManager + /** * @author XuXinChao @@ -36,6 +44,8 @@ class DebugFloatWindow constructor(activity: Activity) : View.OnTouchListener{ private var mInScreenY = 0f private var rg_autopilot:RadioGroup?=null + private var b4CuIp: AppCompatEditText?=null + private var b4CuPort: AppCompatEditText?=null init { initFloatWindow(); @@ -48,7 +58,8 @@ class DebugFloatWindow constructor(activity: Activity) : View.OnTouchListener{ mWindowManager = mActivity.windowManager mWindowParams?.let { it.format = PixelFormat.RGBA_8888 - it.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE + it.flags = (WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL + or WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH) it.gravity = Gravity.START or Gravity.TOP it.width = 800 it.height = 1000 @@ -56,20 +67,13 @@ class DebugFloatWindow constructor(activity: Activity) : View.OnTouchListener{ } rg_autopilot = mFloatLayout.findViewById(R.id.rg_autopilot) + b4CuIp = mFloatLayout.findViewById(R.id.b4_cu_ip) + b4CuPort = mFloatLayout.findViewById(R.id.b4_cu_port) mFloatLayout.findViewById(R.id.close_window).onClick { hideFloatWindow() } - mFloatLayout.findViewById(R.id.acbtn_send_15_dir).onClick { - val newBuilder = MogoReportMsg.MogoReportMessage.newBuilder() - newBuilder.code = "EMAP_ATTITUDE_INIT_FAILED" - newBuilder.timestampBuilder.sec = 0 - newBuilder.timestampBuilder.nsec = 0 - newBuilder.src = "2" - newBuilder.level = "" - CallerAutoPilotStatusListenerManager.invokeAutopilotGuardian(newBuilder.build()) - } mFloatLayout.findViewById(R.id.accb_autopilot_group).setOnCheckedChangeListener { buttonView, isChecked -> if(isChecked){ rg_autopilot?.visibility = View.VISIBLE @@ -102,6 +106,57 @@ class DebugFloatWindow constructor(activity: Activity) : View.OnTouchListener{ VoiceNotice.showNotice("混淆导致序列化问题") VoiceNotice.showNoticeOut("混淆导致序列化问题") } + + mFloatLayout.findViewById(R.id.b4_cu_reconnect).onClick { + val currentIp = b4CuIp?.text + val currentPort = b4CuPort?.text + if (RegexUtils.isIP(currentIp)) { + try { + val port = currentPort.toString().toInt() + if(port<65535){ + CuLedManager.reConnect(currentIp.toString(),port) + } + }catch (e:Exception){ + ToastUtils.showLong("请输入正确的端口号") + } + }else{ + ToastUtils.showLong("请输入正确的ip") + } + + } + + mFloatLayout.findViewById(R.id.b4_cu_setroot).onClick { + CuLedManager.updateTripInfoData(1,"100","last station name") + } + + mFloatLayout.findViewById(R.id.b4_cu_stop_service).onClick { + CuLedManager.updateTripInfoData(2,"100","last station name") + } + + mFloatLayout.findViewById(R.id.b4_cu_left_light).setOnCheckedChangeListener { buttonView, isChecked -> + if(buttonView.id == R.id.b4_cu_left_light){ + if(isChecked){ + CuLedManager.updateTurnSignalData(1) + }else{ + CuLedManager.updateTurnSignalData(0) + } + } + } + mFloatLayout.findViewById(R.id.b4_cu_right_light).setOnCheckedChangeListener { buttonView, isChecked -> + if(buttonView.id == R.id.b4_cu_right_light){ + if(isChecked){ + CuLedManager.updateTurnSignalData(2) + }else{ + CuLedManager.updateTurnSignalData(0) + } + } + } + mFloatLayout.findViewById(R.id.b4_cu_stop_request).setOnCheckedChangeListener { buttonView, isChecked -> + if(buttonView.id == R.id.b4_cu_stop_request){ + CuLedManager.triggerStopRequest(isChecked) + } + } + } override fun onTouch(v: View?, motionEvent: MotionEvent?): Boolean { diff --git a/OCH/common/common/src/debug/res/layout/debug_view.xml b/OCH/common/common/src/debug/res/layout/debug_view.xml index feddc184d3..f6d3813032 100644 --- a/OCH/common/common/src/debug/res/layout/debug_view.xml +++ b/OCH/common/common/src/debug/res/layout/debug_view.xml @@ -17,22 +17,12 @@ android:layout_width="@dimen/dp_50" android:layout_height="@dimen/dp_50"/> - - @@ -81,9 +71,99 @@ app:layout_constraintTop_toBottomOf="@+id/rg_autopilot" app:layout_constraintStart_toStartOf="parent" android:layout_marginTop="@dimen/dp_10" - android:layout_marginStart="@dimen/dp_40" + android:layout_marginStart="@dimen/dp_20" android:text="测试tts" android:layout_width="wrap_content" android:layout_height="wrap_content"/> + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/OCH/common/common/src/main/java/com/mogo/och/common/module/manager/socket/lan/LedScreenManager.kt b/OCH/common/common/src/main/java/com/mogo/och/common/module/manager/socket/lan/LedScreenManager.kt index 2ab99504ad..c4c909dde7 100644 --- a/OCH/common/common/src/main/java/com/mogo/och/common/module/manager/socket/lan/LedScreenManager.kt +++ b/OCH/common/common/src/main/java/com/mogo/och/common/module/manager/socket/lan/LedScreenManager.kt @@ -24,10 +24,12 @@ object LedScreenManager { fun sendTripInfo2Led(type: Int, lineName: String, departureStopName: String, arrivalStopName: String, - isLastStop: Boolean) { - val logInfo = "type: $type, lineName: $lineName, departureStopName: $departureStopName, arrivalStopName: $arrivalStopName, isLastStop: $isLastStop" + isLastStop: Boolean, + lastStopName:String, + ) { + val logInfo = "type: $type, lineName: $lineName, departureStopName: $departureStopName, arrivalStopName: $arrivalStopName, isLastStop: $isLastStop, lastStopName:${lastStopName}" d(M_BUS + "BusSendTripInfoManager", logInfo) OchChainLogManager.writeChainLogLanSocket("发送msg到外屏Led",logInfo,"send") - CallerAutoPilotControlManager.sendTripInfo(type,lineName,departureStopName, arrivalStopName, isLastStop) + CallerAutoPilotControlManager.sendTripInfo(type,lineName,departureStopName, arrivalStopName, isLastStop,lastStopName) } } \ No newline at end of file diff --git a/OCH/offline/driver/src/main/java/com/mogo/och/offline/model/OrderModel.kt b/OCH/offline/driver/src/main/java/com/mogo/och/offline/model/OrderModel.kt index bfcec50d95..7d948879a3 100644 --- a/OCH/offline/driver/src/main/java/com/mogo/och/offline/model/OrderModel.kt +++ b/OCH/offline/driver/src/main/java/com/mogo/och/offline/model/OrderModel.kt @@ -323,9 +323,14 @@ object OrderModel { LineModel.stationList?.let { if (LineModel.startTaskMessage()) { //默认是第一站到站查询 LineManager.lineInfos?.lineName?.let { lineName-> + val lastStopName = if(it.isNotEmpty()){ + it.last().name?:"" + }else{ + "" + } LedScreenManager.sendTripInfo2Led( LedScreenManager.START_TRIP, - lineName, "", "", false + lineName, "", "", false,lastStopName ) } } diff --git a/OCH/offline/driver/src/main/java/com/mogo/och/offline/model/ThirdDeviceData.kt b/OCH/offline/driver/src/main/java/com/mogo/och/offline/model/ThirdDeviceData.kt index e7797e40af..7b0f022637 100644 --- a/OCH/offline/driver/src/main/java/com/mogo/och/offline/model/ThirdDeviceData.kt +++ b/OCH/offline/driver/src/main/java/com/mogo/och/offline/model/ThirdDeviceData.kt @@ -84,7 +84,8 @@ object ThirdDeviceData { lineInfo.lineName, start.name?:"", end.name?:"", - LineModel.isLastStation() == true + LineModel.isLastStation() == true, + "" ) } } @@ -102,7 +103,8 @@ object ThirdDeviceData { lineInfo.lineName, start.name?:"", end.name?:"", - LineModel.isLastStation(end) + LineModel.isLastStation(end), + "" ) } } @@ -116,7 +118,8 @@ object ThirdDeviceData { lineInfo.lineName, "", "", - false + false, + "" ) } } diff --git a/OCH/shuttle/driver_unmanned/src/main/java/com/mogo/och/unmanned/model/OrderModel.kt b/OCH/shuttle/driver_unmanned/src/main/java/com/mogo/och/unmanned/model/OrderModel.kt index eab8d0c759..e0c95856cb 100644 --- a/OCH/shuttle/driver_unmanned/src/main/java/com/mogo/och/unmanned/model/OrderModel.kt +++ b/OCH/shuttle/driver_unmanned/src/main/java/com/mogo/och/unmanned/model/OrderModel.kt @@ -501,9 +501,14 @@ object OrderModel { LineModel.stationList?.let { if (LineModel.startTaskMessage()) { //默认是第一站到站查询 LineManager.lineInfos?.lineName?.let { lineName -> + val lastStopName = if(it.isNotEmpty()){ + it.last().name?:"" + }else{ + "" + } LedScreenManager.sendTripInfo2Led( LedScreenManager.START_TRIP, - lineName, "", "", false + lineName, "", "", false,lastStopName ) } //任务选择后首发前给司机提示任务 diff --git a/OCH/shuttle/driver_unmanned/src/main/java/com/mogo/och/unmanned/model/ThirdDeviceData.kt b/OCH/shuttle/driver_unmanned/src/main/java/com/mogo/och/unmanned/model/ThirdDeviceData.kt index edc4920ab0..0f890f76aa 100644 --- a/OCH/shuttle/driver_unmanned/src/main/java/com/mogo/och/unmanned/model/ThirdDeviceData.kt +++ b/OCH/shuttle/driver_unmanned/src/main/java/com/mogo/och/unmanned/model/ThirdDeviceData.kt @@ -131,7 +131,8 @@ object ThirdDeviceData { lineInfo.lineName, start.name ?: "", end.name ?: "", - LineModel.isLastStation() == true + LineModel.isLastStation() == true, + "", ) } } @@ -151,7 +152,8 @@ object ThirdDeviceData { lineInfo.lineName, start.name ?: "", end.name ?: "", - LineModel.isLastStation(end) + LineModel.isLastStation(end), + "" ) } } @@ -167,7 +169,8 @@ object ThirdDeviceData { lineInfo.lineName, "", "", - false + false, + "" ) } } diff --git a/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/model/OrderModel.kt b/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/model/OrderModel.kt index 7cfe457729..99dd75a09d 100644 --- a/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/model/OrderModel.kt +++ b/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/model/OrderModel.kt @@ -367,10 +367,15 @@ object OrderModel { LineModel.stationList?.let { if (LineModel.startTaskMessage()) { //默认是第一站到站查询 + val lastStopName = if(it.isNotEmpty()){ + it.last().name?:"" + }else{ + "" + } LineManager.lineInfos?.lineName?.let { lineName-> LedScreenManager.sendTripInfo2Led( LedScreenManager.START_TRIP, - lineName, "", "", false + lineName, "", "", false,lastStopName ) } //任务选择后首发前给司机提示任务 diff --git a/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/model/ThirdDeviceData.kt b/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/model/ThirdDeviceData.kt index 86887ea2cf..93934f6605 100644 --- a/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/model/ThirdDeviceData.kt +++ b/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/model/ThirdDeviceData.kt @@ -131,7 +131,8 @@ object ThirdDeviceData { lineInfo.lineName, start.name?:"", end.name?:"", - LineModel.isLastStation() == true + LineModel.isLastStation() == true, + "" ) } } @@ -151,7 +152,8 @@ object ThirdDeviceData { lineInfo.lineName, start.name?:"", end.name?:"", - LineModel.isLastStation(end) + LineModel.isLastStation(end), + "" ) } } @@ -167,7 +169,8 @@ object ThirdDeviceData { lineInfo.lineName, "", "", - false + false, + "" ) } } diff --git a/core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/v2x/v2n/scenario/scene/road/V2XRoadEventScenario.java b/core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/v2x/v2n/scenario/scene/road/V2XRoadEventScenario.java index 463882c204..2cbfba24f3 100644 --- a/core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/v2x/v2n/scenario/scene/road/V2XRoadEventScenario.java +++ b/core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/v2x/v2n/scenario/scene/road/V2XRoadEventScenario.java @@ -120,7 +120,7 @@ public class V2XRoadEventScenario extends AbsV2XScenario imp long oldTime = SharedPrefsMgr.getInstance().getLong("roadwork", 0); if (currentTime - oldTime > 60) { //超过一分钟,才会继续播报重复提醒 SharedPrefsMgr.getInstance().putLong("roadwork", System.currentTimeMillis() / 1000); - CallerAutoPilotControlManager.sendTripInfo(5, "", "", "", false); + CallerAutoPilotControlManager.sendTripInfo(5, "", "", "", false,""); } } diff --git a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/DataCenterProvider.kt b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/DataCenterProvider.kt index dd8cb13fa5..9a3955ca4c 100644 --- a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/DataCenterProvider.kt +++ b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/DataCenterProvider.kt @@ -40,7 +40,8 @@ class DataCenterProvider : IDataCenterProvider, IDataCenterBizListener { super.invokeVehicleChange() IotManager.init( AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode), - AppIdentityModeUtils.isB2(FunctionBuildConfig.appIdentityMode) + AppIdentityModeUtils.isB2(FunctionBuildConfig.appIdentityMode), + AppIdentityModeUtils.isB4(FunctionBuildConfig.appIdentityMode) ) } diff --git a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/autopilot/MoGoAutopilotControlProvider.kt b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/autopilot/MoGoAutopilotControlProvider.kt index abeccd8efa..fbcdd67a78 100644 --- a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/autopilot/MoGoAutopilotControlProvider.kt +++ b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/autopilot/MoGoAutopilotControlProvider.kt @@ -57,6 +57,7 @@ import com.mogo.eagle.core.utilcode.util.StringUtils import com.mogo.eagle.core.utilcode.util.ThreadUtils import com.mogo.eagle.core.utilcode.util.ToastUtils import com.mogo.eagle.core.utilcode.util.UiThreadHandler +import com.mogo.support.device.culed.CuLedManager import com.mogo.support.device.led.LedSourceManager import com.mogo.telematic.MogoProtocolMsg import com.mogo.telematic.MogoProtocolMsg.NORMAL_DATA @@ -1091,7 +1092,7 @@ class MoGoAutopilotControlProvider : * @param isLastStop 是否最终站 * @return boolean */ - override fun sendTripInfo(type: Int, lineName: String, departureStopName: String, arrivalStopName: String, isLastStop: Boolean) { + override fun sendTripInfo(type: Int, lineName: String, departureStopName: String, arrivalStopName: String, isLastStop: Boolean,lastStopName:String) { AdasManager.getInstance().sendTripInfoReq(type, lineName, departureStopName, arrivalStopName, isLastStop) LedSourceManager.updateTripInfoData( type, @@ -1100,6 +1101,10 @@ class MoGoAutopilotControlProvider : arrivalStopName, isLastStop ) + CuLedManager.updateTripInfoData(type, + lineName, + lastStopName + ) } /** diff --git a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/autopilot/adapter/MoGoAdasListenerImpl.kt b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/autopilot/adapter/MoGoAdasListenerImpl.kt index e9b8269717..c6ecaea77b 100644 --- a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/autopilot/adapter/MoGoAdasListenerImpl.kt +++ b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/autopilot/adapter/MoGoAdasListenerImpl.kt @@ -101,6 +101,7 @@ import com.mogo.eagle.core.function.call.obu.CallerObuWarningSpatListenerManager import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_D_C import com.mogo.eagle.core.utilcode.util.DeviceUtils +import com.mogo.support.device.culed.CuLedManager import com.mogo.support.device.led.LedSourceManager import com.mogo.support.obu.ObuScene import com.zhidao.support.adas.high.AdasManager @@ -327,6 +328,7 @@ class MoGoAdasListenerImpl : OnAdasListener { type = 3 } LedSourceManager.updateTurnSignalData(type) + CuLedManager.updateTurnSignalData(type) } //自动驾驶状态 diff --git a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/iot/IotManager.kt b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/iot/IotManager.kt index 022634fc25..f2dcfbed0b 100644 --- a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/iot/IotManager.kt +++ b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/iot/IotManager.kt @@ -12,6 +12,7 @@ import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.i import com.mogo.eagle.core.utilcode.util.StringUtils import com.mogo.support.device.DevicesManager import com.mogo.support.device.IWriteChainLogListener +import com.mogo.support.device.culed.CuLedManager import com.mogo.support.device.led.LedSourceManager import com.zhjt.service.chain.ChainLog import java.text.SimpleDateFormat @@ -24,7 +25,7 @@ object IotManager : IMoGoCloudListener, IWriteChainLogListener { private const val EVENT_KEY_HARDWARE_DEVICES = "event_key_hardware_devices" private var isPassenger: Boolean = false - fun init(isPassenger: Boolean, isB2: Boolean) { + fun init(isPassenger: Boolean, isB2: Boolean, isB4: Boolean) { destroy()//重新初始化时销毁之前调用的数据 this.isPassenger = isPassenger if (isPassenger) { @@ -34,6 +35,10 @@ object IotManager : IMoGoCloudListener, IWriteChainLogListener { } else { LedSourceManager.registerWriteChainLogListener(this) LedSourceManager.init(true, isB2) + if(isB4){ + CuLedManager.init() + CuLedManager.registerWriteChainLogListener(this) + } } } @@ -58,6 +63,7 @@ object IotManager : IMoGoCloudListener, IWriteChainLogListener { DevicesManager.destroy() } else { LedSourceManager.unregisterWriteChainLogListener() + CuLedManager.unregisterWriteChainLogListener() LedSourceManager.destroy() } } diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotControlProvider.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotControlProvider.kt index fe56b1fd08..8abbb89044 100644 --- a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotControlProvider.kt +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotControlProvider.kt @@ -480,7 +480,7 @@ interface IMoGoAutopilotControlProvider : IMoGoFunctionServerProvider { * @param isLastStop 是否最终站 * @return boolean */ - fun sendTripInfo(type: Int, lineName: String, departureStopName: String,arrivalStopName: String, isLastStop: Boolean) + fun sendTripInfo(type: Int, lineName: String, departureStopName: String,arrivalStopName: String, isLastStop: Boolean,lastStopName:String,) /** * 福田清扫车业务指令下发 diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutoPilotControlManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutoPilotControlManager.kt index fbfdfe6e67..c4f4725724 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutoPilotControlManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutoPilotControlManager.kt @@ -734,9 +734,10 @@ object CallerAutoPilotControlManager { lineName: String, departureStopName: String, arrivalStopName: String, - isLastStop: Boolean + isLastStop: Boolean, + lastStopName:String, ) { - providerApi?.sendTripInfo(type, lineName, departureStopName, arrivalStopName, isLastStop) + providerApi?.sendTripInfo(type, lineName, departureStopName, arrivalStopName, isLastStop,lastStopName) } /** diff --git a/libraries/mogo-hardware-devices/build.gradle b/libraries/mogo-hardware-devices/build.gradle index 58a210b2c1..0f25051a88 100644 --- a/libraries/mogo-hardware-devices/build.gradle +++ b/libraries/mogo-hardware-devices/build.gradle @@ -40,5 +40,6 @@ dependencies { implementation rootProject.ext.dependencies.androidxappcompat api rootProject.ext.dependencies.serialport implementation "com.mogo.support.device.manager:led_screen_cpower5a:1.0.13" + implementation "com.mogo.support.device.manager:led_screen_cubasic:1.0.0" implementation rootProject.ext.dependencies.view_model_scope } diff --git a/libraries/mogo-hardware-devices/src/main/java/com/mogo/support/device/culed/CuLedManager.kt b/libraries/mogo-hardware-devices/src/main/java/com/mogo/support/device/culed/CuLedManager.kt new file mode 100644 index 0000000000..8d1158f2c8 --- /dev/null +++ b/libraries/mogo-hardware-devices/src/main/java/com/mogo/support/device/culed/CuLedManager.kt @@ -0,0 +1,117 @@ +package com.mogo.support.device.culed + +import com.mogo.support.device.IWriteChainLogListener +import com.mogo.support.device.manager.cubasic.log.LogLevel +import com.mogo.support.device.manager.cubasic.log.LogListener +import com.mogo.support.device.manager.cubasic.log.LogManager +import com.mogo.support.device.manager.cubasic.netty.NettyXimpleClient +import kotlin.properties.Delegates + +object CuLedManager { + + /** + * 0 没有灯态 + * 1 左转灯 + * 2 右转灯 + * 3 双闪 + */ + private var lightState: Int by Delegates.observable(0) { _, oldValue, newValue -> + if (oldValue != newValue) { + if(newValue==0){ + if(oldValue==1) { + client?.setLeftTurn(false) + }else if(oldValue==2){ + client?.setRightTurn(false) + }else{ + client?.setLeftTurn(false) + client?.setRightTurn(false) + } + }else{ + when (newValue) { + 1 -> {client?.setLeftTurn(true)} + 2 -> {client?.setRightTurn(true)} + else -> {} + } + } + } + } + + private var client: NettyXimpleClient? = null + + private var writeChainLogListener: IWriteChainLogListener? = null + + fun init(host:String="",port:Int=0){ + if (client == null) { + client = NettyXimpleClient() + if (host.isNotEmpty() && port > 0) { + client?.setHostAndPort(host, port) + } + client?.connect() + } + LogManager.getInstance().isDebug = true + LogManager.getInstance().logListener = object :LogListener{ + override fun writeLog(logLevel: LogLevel?, tag: String?, message: String?) { + writeChainLogListener?.onWriteChainLog(logLevel?.name?:"level",tag?:"",message?:"") + } + } + } + + fun registerWriteChainLogListener(writeChainLogListener: IWriteChainLogListener) { + this.writeChainLogListener = writeChainLogListener + } + + fun unregisterWriteChainLogListener() { + this.writeChainLogListener = null + } + + fun reConnect(host:String="",port:Int=0){ + if (client == null) { + client = NettyXimpleClient() + if (host.isNotEmpty() && port > 0) { + client?.setHostAndPort(host, port) + } + client?.connect() + } else { + if(client?.isConnected==true) { + if (host.isNotEmpty() && port > 0) { + client?.setHostAndPort(host, port) + } + client?.reconnect() + }else{ + if(client?.connectionStatus=="CONNECTING"){ + if (host.isNotEmpty() && port > 0) { + client?.setHostAndPort(host, port) + } + } + } + } + } + + /** + * 0 没有灯态 + * 1 左转灯 + * 2 右转灯 + * 3 双闪 + */ + fun updateTurnSignalData(type: Int) { + this.lightState = type + } + + fun updateTripInfoData( + type: Int, + lineName: String, + lastStopName:String + ) { + when (type) { + 1 -> { client?.setRoute(lineName,lastStopName) } + 2 -> { client?.setOffService() } + else -> {} + } + } + + fun triggerStopRequest(isActive:Boolean){ + client?.triggerStopRequest(isActive) + } + + +} \ No newline at end of file