diff --git a/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/fragment/BaseBusTabFragment.java b/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/fragment/BaseBusTabFragment.java index f4b65292b4..23f6ac1d5b 100644 --- a/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/fragment/BaseBusTabFragment.java +++ b/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/fragment/BaseBusTabFragment.java @@ -74,7 +74,7 @@ public abstract class BaseBusTabFragment private Group groupTestPanel; private FrameLayout flSpeed; // private BusArcView mouduleArc; - private TrafficDataView mouduleArc; + private TrafficDataView mTrafficDataView; private ImageView mUpgradeTipIv; // private BusTrafficLightView mTrafficLightView; @@ -120,7 +120,7 @@ public abstract class BaseBusTabFragment tvOperationStatus = findViewById(R.id.module_mogo_och_operation_status); flSpeed = (FrameLayout) findViewById(R.id.fl_speed); - mouduleArc = (TrafficDataView) findViewById(R.id.bus_arc); + mTrafficDataView = (TrafficDataView) findViewById(R.id.bus_arc); panelView = LayoutInflater.from(getContext()).inflate(getStationPanelViewId(), flStationPanelContainer); slidePanelView.setOnSlidePanelMoveToEndListener(onSlideToEndListener); @@ -148,8 +148,8 @@ public abstract class BaseBusTabFragment }); if (DebugConfig.isDebug()) { - mouduleArc.setLongClickable(true); - mouduleArc.setOnLongClickListener(v -> { + mTrafficDataView.setLongClickable(true); + mTrafficDataView.setOnLongClickListener(v -> { CallerLogger.INSTANCE.d(M_BUS + TAG, "长按显示状态工具栏"); Intent intent = new Intent(); intent.putExtra("oper", 52); @@ -480,11 +480,9 @@ public abstract class BaseBusTabFragment */ public void updateSpeedView(float newSpeed) { int speed = (int) (Math.abs(newSpeed) * 3.6F); // 倒车时工控机反馈定位信息中speed为负值 - mouduleArc.showWithSpeedValue(speed); - -// mouduleArc.setArcColor(Color.parseColor(speed > 60 ? "#DB3137" : "#3E77F6")); -// mouduleArc.setValues(speed); -// flSpeed.setBackgroundResource(speed > 60 ? R.drawable.bus_yi_biao_pan_bg_speeding : R.drawable.bus_yi_biao_pan_bg_nor); + if (mTrafficDataView != null){ + mTrafficDataView.updateSpeedWithValue(speed); + } } @Override diff --git a/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/adapter/MoGoAdasListenerImpl.kt b/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/adapter/MoGoAdasListenerImpl.kt index ff9e9558c2..8246bcc13a 100644 --- a/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/adapter/MoGoAdasListenerImpl.kt +++ b/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/adapter/MoGoAdasListenerImpl.kt @@ -151,6 +151,8 @@ class MoGoAdasListenerImpl : OnAdasListener { CallerAutopilotVehicleStateListenerManager.invokeAutopilotSteeringData(vehicleState.steering) //挂挡档位数据 CallerAutopilotVehicleStateListenerManager.invokeAutopilotGearData(vehicleState.gear) + //加速度 + CallerAutopilotVehicleStateListenerManager.invokeAutopilotAcc(vehicleState.accel) } else { CallerAutopilotVehicleStateListenerManager.invokeAutopilotDataException(header.timestamp.toLong()) } diff --git a/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/adapter/MoGoHandAdasMsgManager.java b/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/adapter/MoGoHandAdasMsgManager.java index 70b6dd7f54..90f6c23382 100644 --- a/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/adapter/MoGoHandAdasMsgManager.java +++ b/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/adapter/MoGoHandAdasMsgManager.java @@ -150,4 +150,9 @@ public class MoGoHandAdasMsgManager implements @Override public void onAutopilotDataException(long timestamp) { } + + @Override + public void onAutopilotAcc(float carAcc) { + + } } \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/can/CanImpl.kt b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/can/CanImpl.kt index d5b6e167e1..67a6be07fb 100644 --- a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/can/CanImpl.kt +++ b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/can/CanImpl.kt @@ -4,15 +4,17 @@ import android.content.* import android.util.* import chassis.Chassis.GearPosition import chassis.Chassis.LightSwitch +import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo import com.mogo.eagle.core.function.api.autopilot.* import com.mogo.eagle.core.function.call.autopilot.* import com.mogo.eagle.core.utilcode.kotlin.* import com.zhjt.mogo_core_function_devatools.status.flow.IFlow import com.zhjt.mogo_core_function_devatools.status.entity.CanStatus import kotlinx.coroutines.* +import mogo.telematics.pad.MessagePad import mogo_msg.MogoReportMsg.MogoReportMessage -internal class CanImpl(ctx: Context): IFlow(ctx), IMoGoAutopilotVehicleStateListener, IMoGoAutopilotStatusListener { +internal class CanImpl(ctx: Context) : IFlow(ctx), IMoGoAutopilotVehicleStateListener, IMoGoAutopilotStatusListener { companion object { const val TAG = "CanImpl" @@ -67,13 +69,18 @@ internal class CanImpl(ctx: Context): IFlow(ctx), IMoGoAutopilotVehic timeOutCheck() } + override fun onAutopilotAcc(carAcc: Float) { + send(CanStatus(isCanEnabled())) + timeOutCheck() + } + private fun timeOutCheck() { job?.safeCancel() launch(Dispatchers.Default) { delay(4000) send(CanStatus(false)) - }.also { job = it } + }.also { job = it } } override fun onDestroy() { diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/DebugSettingView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/DebugSettingView.kt index 4ea05b2f14..90a078343f 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/DebugSettingView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/DebugSettingView.kt @@ -1835,6 +1835,13 @@ class DebugSettingView @JvmOverloads constructor( } } + /** + * 车辆加速度 + */ + override fun onAutopilotAcc(carAcc: Float) { + TODO("Not yet implemented") + } + /** * 吐司提示 */ diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/SteeringWheelView.java b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/SteeringWheelView.java index 4e4f7402fc..a72a6d9c8a 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/SteeringWheelView.java +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/SteeringWheelView.java @@ -171,6 +171,15 @@ public class SteeringWheelView extends ConstraintLayout { Log.d(TAG, "刹车灯:" + String.valueOf(brakeLight)); } + /** + * 车辆加速度 + * @param carAcc + */ + @Override + public void onAutopilotAcc(float carAcc) { + + } + /** * 方向盘转向角 左+右- * @param steering diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/TrafficDataView.java b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/TrafficDataView.java index f63f0f3a3b..ad416c2dab 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/TrafficDataView.java +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/TrafficDataView.java @@ -21,6 +21,8 @@ import com.mogo.eagle.core.utilcode.util.ThreadUtils; import org.jetbrains.annotations.NotNull; +import java.math.BigDecimal; + import chassis.Chassis; /** @@ -66,6 +68,13 @@ public class TrafficDataView extends ConstraintLayout { speedTextView = findViewById(R.id.speedTextView); accTextView = findViewById(R.id.speedAccTextView); } + //onVehicleState + +// @Override +// public void onVehicleState(MessagePad.Header header, VehicleStateOuterClass.VehicleState vehicleState) { +// VehicleState base = new VehicleState(header, vehicleState, sdf); +// DataDistribution.getInstance().addData(base); +// } private final IMoGoAutopilotVehicleStateListener mIMoGoAutopilotVehicleStateListener = new IMoGoAutopilotVehicleStateListener() { /** @@ -128,6 +137,13 @@ public class TrafficDataView extends ConstraintLayout { public void onAutopilotDataException(long timestamp) { } + + @Override + public void onAutopilotAcc(float carAcc) { + Log.d(TAG, "加速度:" + carAcc); + BigDecimal acc = new BigDecimal(String.valueOf(carAcc)).setScale(2); + accTextView.setText(String.valueOf(acc)); + } }; /** @@ -149,11 +165,15 @@ public class TrafficDataView extends ConstraintLayout { } /** - * 车速过快 + * value呈现 */ - public void showWithSpeedValue(int newSpeed) { - speedTextView.setText(newSpeed); - speedImage.setBackgroundResource(newSpeed > 60 ? R.drawable.traffic_data_speed_warning : R.drawable.traffic_data_speed); + public void updateSpeedWithValue(int newSpeed) { + if (speedTextView != null) { + speedTextView.setText(String.valueOf(newSpeed)); + } + if (speedImage != null) { + speedImage.setBackgroundResource(newSpeed > 60 ? R.drawable.traffic_data_speed_warning : R.drawable.traffic_data_speed); + } } } diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/hmi_steering_wheel_bus.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/hmi_steering_wheel_bus.xml index 08ae8a038d..f8a7f886e3 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/hmi_steering_wheel_bus.xml +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/hmi_steering_wheel_bus.xml @@ -87,7 +87,7 @@ android:layout_width="@dimen/dp_390" android:layout_height="wrap_content" android:layout_marginBottom="@dimen/dp_42" - app:defaultColor = "@color/bus_p_default_txt_color" + app:defaultColor = "@color/p_default_txt_color" app:selectColor="@color/bus_p_select_txt_color" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintLeft_toLeftOf="parent" diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/hmi_steering_wheel_taxi.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/hmi_steering_wheel_taxi.xml index 84eda5f572..d56408fae1 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/hmi_steering_wheel_taxi.xml +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/hmi_steering_wheel_taxi.xml @@ -88,7 +88,7 @@ android:layout_width="@dimen/dp_272" android:layout_height="wrap_content" android:layout_marginTop="@dimen/dp_30" - app:defaultColor="@color/taxi_p_default_txt_color" + app:defaultColor="@color/p_default_txt_color" app:selectColor="@color/dark_mode_select_txt_color" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/hmi_tap_position.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/hmi_tap_position.xml index 9d1d739a87..263bee811c 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/hmi_tap_position.xml +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/hmi_tap_position.xml @@ -12,7 +12,7 @@ android:gravity="center" android:text="P" android:textAlignment="center" - + android:textColor="@color/p_default_txt_color" android:textSize="@dimen/dp_46" android:textStyle="bold" app:layout_constraintBottom_toBottomOf="parent" @@ -27,7 +27,7 @@ android:gravity="center" android:text="R" android:textAlignment="center" - + android:textColor="@color/p_default_txt_color" android:textSize="@dimen/dp_46" android:textStyle="bold" app:layout_constraintBottom_toBottomOf="parent" @@ -42,7 +42,7 @@ android:gravity="center" android:text="N" android:textAlignment="center" - + android:textColor="@color/p_default_txt_color" android:textSize="@dimen/dp_46" android:textStyle="bold" app:layout_constraintBottom_toBottomOf="parent" @@ -57,7 +57,7 @@ android:gravity="center" android:text="D" android:textAlignment="center" - + android:textColor="@color/p_default_txt_color" android:textSize="@dimen/dp_46" android:textStyle="bold" app:layout_constraintBottom_toBottomOf="parent" diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/values/color.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/values/color.xml index 7c78ee5f7e..4cd3c89abf 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/values/color.xml +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/values/color.xml @@ -62,8 +62,7 @@ #00FFFFFF #FF343C63 #0043FF - #6E8EC9 - #FF6E8EC9 + #FF6E8EC9 #FFFFFFFF \ No newline at end of file diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotVehicleStateListener.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotVehicleStateListener.kt index bca93e135e..7d6520926d 100644 --- a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotVehicleStateListener.kt +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotVehicleStateListener.kt @@ -1,6 +1,7 @@ package com.mogo.eagle.core.function.api.autopilot import chassis.Chassis +import mogo.telematics.pad.MessagePad /** * 车辆底盘 数据 回调监听 @@ -36,4 +37,9 @@ interface IMoGoAutopilotVehicleStateListener { * 没有自车状态数据 */ fun onAutopilotDataException(timestamp: Long){} + + /** + * 车辆加速度 + */ + fun onAutopilotAcc(carAcc: Float) } \ No newline at end of file diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotVehicleStateListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotVehicleStateListenerManager.kt index 37653bb62d..3c5fef077a 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotVehicleStateListenerManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotVehicleStateListenerManager.kt @@ -4,6 +4,7 @@ import androidx.annotation.Nullable import chassis.Chassis import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotVehicleStateListener import com.mogo.eagle.core.function.call.base.CallerBase +import mogo.telematics.pad.MessagePad import java.util.concurrent.ConcurrentHashMap /** @@ -100,6 +101,18 @@ object CallerAutopilotVehicleStateListenerManager : CallerBase() { } } + /** + * 车辆加速度 + * acc 加速度 + */ + fun invokeAutopilotAcc(carAcc: Float){ + M_AUTOPILOT_VEHICLE_LISTENERS.forEach{ + val listener = it.value + listener.onAutopilotAcc(carAcc) + } + } + + /** * 工控机时间回调 */