Merge branch 'local_282_navi' into feat_overview_mode_282

This commit is contained in:
liujing
2022-06-29 11:29:05 +08:00
13 changed files with 89 additions and 23 deletions

View File

@@ -74,7 +74,7 @@ public abstract class BaseBusTabFragment<V extends IView, P extends Presenter<V>
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<V extends IView, P extends Presenter<V>
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<V extends IView, P extends Presenter<V>
});
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<V extends IView, P extends Presenter<V>
*/
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

View File

@@ -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())
}

View File

@@ -150,4 +150,9 @@ public class MoGoHandAdasMsgManager implements
@Override
public void onAutopilotDataException(long timestamp) {
}
@Override
public void onAutopilotAcc(float carAcc) {
}
}

View File

@@ -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<CanStatus>(ctx), IMoGoAutopilotVehicleStateListener, IMoGoAutopilotStatusListener {
internal class CanImpl(ctx: Context) : IFlow<CanStatus>(ctx), IMoGoAutopilotVehicleStateListener, IMoGoAutopilotStatusListener {
companion object {
const val TAG = "CanImpl"
@@ -67,13 +69,18 @@ internal class CanImpl(ctx: Context): IFlow<CanStatus>(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() {

View File

@@ -1835,6 +1835,13 @@ class DebugSettingView @JvmOverloads constructor(
}
}
/**
* 车辆加速度
*/
override fun onAutopilotAcc(carAcc: Float) {
TODO("Not yet implemented")
}
/**
* 吐司提示
*/

View File

@@ -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

View File

@@ -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);
}
}
}

View File

@@ -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"

View File

@@ -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"

View File

@@ -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"

View File

@@ -62,8 +62,7 @@
<color name="hmi_clear_00">#00FFFFFF</color>
<color name="acc_default_txt_color">#FF343C63</color>
<color name="bus_p_select_txt_color">#0043FF</color>
<color name="bus_p_default_txt_color">#6E8EC9</color>
<color name="taxi_p_default_txt_color">#FF6E8EC9</color>
<color name="p_default_txt_color">#FF6E8EC9</color>
<color name="dark_mode_select_txt_color">#FFFFFFFF</color>
</resources>

View File

@@ -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)
}

View File

@@ -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)
}
}
/**
* 工控机时间回调
*/