Merge branch 'dev_robotaxi-d-app-module_2120_221017_2.12.0' into dev_robotaxi-d-app-module_2120_yyk_2.12.0

# Conflicts:
#	OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/model/BusOrderModel.java
This commit is contained in:
yangyakun
2022-10-26 15:19:28 +08:00
48 changed files with 1223 additions and 854 deletions

View File

@@ -482,6 +482,7 @@ public class BusOrderModel {
BusSendTripInfoManager.INSTANCE.sendBusTripInfo(BusSendTripInfoManager.END_TRIP
, busRoutesResult.getName()
,""
,""
,false);
}
}
@@ -491,16 +492,27 @@ public class BusOrderModel {
* 服务端返回的OchBusRoutesResult逻辑 离开站为当前站, 到达下一站后才会将下一站置为当前站,
* 车机端展示是离开当前站,下一站设置为当前站, 所以服务端数据回来要做处理,不能直接渲染
*/
private void leaveStationSuccess(int leaveIndex) {
private void leaveStationSuccess(int leaveIndex,String leaveStation,String nextStation) {
onStartAutopilot(leaveIndex);
leaveTTSTips(nextStation);
if (busRoutesResult != null){
boolean isLastStop = false;
if (leaveIndex + 1 == stationList.size() -1){
isLastStop = true;
}
//给bus外屏发送
BusSendTripInfoManager.INSTANCE.sendBusTripInfo(BusSendTripInfoManager.LEAVE_STATION
, busRoutesResult.getName()
,busRoutesResult.getSites().get(leaveIndex).getName()
,false);
,leaveStation
,nextStation
,isLastStop);
}
}
private void onStartAutopilot(int leaveIndex) {
//开启自动驾驶 2.10.0: 如果自动驾驶状态下开启, 非自动驾驶状态下不开启,需手动点击自动驾驶按钮开启
isGoingToNextStation = true;
if (CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo().getState()
@@ -606,6 +618,7 @@ public class BusOrderModel {
}
int arrivedStationIndex = backgroundCurrentStationIndex + 1;
String arriveStation = stationList.get(arrivedStationIndex).getName();
String departureStopName = stationList.get(backgroundCurrentStationIndex).getName();
CallerLogger.INSTANCE.d(M_BUS + TAG,"arriveSiteStation-currentStationIndex = "+ arrivedStationIndex);
BusServiceManager.arriveSiteStation(mContext ,
@@ -618,10 +631,7 @@ public class BusOrderModel {
CallerLogger.INSTANCE.d(M_BUS + TAG,"行程日志-arriveSiteStation success");
queryBusRoutes();
arriveStationSuccess(arrivedStationIndex);
VoiceNotice.showNotice(String.format(mContext
.getString(R.string.bus_arrived_station_tip),
arriveStation));
arriveStationSuccess(arrivedStationIndex,departureStopName,arriveStation);
//5s轮询核销乘客
startOrStopQueryPassengerWriteOff(true);
@@ -642,20 +652,23 @@ public class BusOrderModel {
});
}
private void arriveStationSuccess(int arrivedStationIndex) {
private void arriveStationSuccess(int arrivedStationIndex,String departureStopName,String arriveStation) {
if (busRoutesResult != null){
boolean isLastStop;
boolean isLastStop = false;
if (arrivedStationIndex == busRoutesResult.getSites().size() - 1 ){
isLastStop = true;
}else {
isLastStop = false;
}
//给bus外屏发送
BusSendTripInfoManager.INSTANCE.sendBusTripInfo(BusSendTripInfoManager.ARRIVE_STATION
, busRoutesResult.getName()
,busRoutesResult.getSites().get(arrivedStationIndex).getName()
,departureStopName
,arriveStation
,isLastStop);
}
VoiceNotice.showNotice(String.format(mContext
.getString(R.string.bus_arrived_station_tip),
arriveStation));
}
/**
@@ -681,8 +694,7 @@ public class BusOrderModel {
//需要更改当前站和下一站的状态 然后渲染
startOrStopQueryPassengerWriteOff(false);
queryBusRoutes();
leaveStationSuccess(backgroundCurrentStationIndex);
leaveTTSTips(finalNextStationName);
leaveStationSuccess(backgroundCurrentStationIndex,currentStationName,finalNextStationName);
}
@Override
public void onFail(int code, String failMsg) {
@@ -763,7 +775,7 @@ public class BusOrderModel {
&& !stationList.get(0).isLeaving()){ //默认是第一站到站查询
if (busRoutesResult != null){ // 第一站到站也是行程开始的时候
BusSendTripInfoManager.INSTANCE.sendBusTripInfo(BusSendTripInfoManager.START_TRIP
,busRoutesResult.getName(),"",false);
,busRoutesResult.getName(),"","",false);
}
startOrStopQueryPassengerWriteOff(true);
}

View File

@@ -19,13 +19,17 @@ object BusSendTripInfoManager{
* 行程信息
* @param type 事件类型, 1:行程开始, 2:行程结束, 3:出站, 4:进站, 5:城市占道施工预警
* @param lineName 路线名, for type 1, 2
* @param stopName 站点名, for type 3, 4
* @param isLastStop 是否终点站
* @param departureStopName 出站站点名, for type 3, 4
* @param arrivalStopName 下一站到达站点名, for type 3, 4
* @param isLastStop 是否终点站(下一站或者要到达站)
* @return
*/
fun sendBusTripInfo(type: Int, lineName: String, stationName: String, isLastStop: Boolean) {
fun sendBusTripInfo(type: Int, lineName: String,
departureStopName: String,
arrivalStopName: String,
isLastStop: Boolean) {
d(SceneConstant.M_BUS + "BusSendTripInfoManager", "type: "+ type
+", lineName: "+ lineName + ", stationName: "+stationName+", isLastStop: "+isLastStop)
CallerAutoPilotManager.sendTripInfo(type,lineName,stationName,isLastStop)
+", lineName: "+ lineName + ", stationName: "+arrivalStopName+", isLastStop: "+isLastStop)
CallerAutoPilotManager.sendTripInfo(type,lineName,departureStopName, arrivalStopName, isLastStop)
}
}

View File

@@ -1,6 +1,7 @@
package com.mogo.och.common.module.utils;
import android.content.Context;
import android.location.Location;
import com.amap.api.maps.CoordinateConverter;
import com.amap.api.maps.model.LatLng;
@@ -8,7 +9,9 @@ import com.mogo.cloud.commons.utils.CoordinateUtils;
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import mogo.telematics.pad.MessagePad;
@@ -161,7 +164,7 @@ public class CoordinateCalculateRouteUtil {
// Logger.d(M_TAXI + "calculateRouteSumLength", "点:"+currentIndex+"-------是最近的点------ ");
if (currentIndex == mRoutePoints.size()-1){
latePoints.add(mRoutePoints.get(currentIndex));
}else {
}else if(currentIndex < mRoutePoints.size()-1){
latePoints.addAll(mRoutePoints.subList(currentIndex,mRoutePoints.size()-1));
}
return latePoints;
@@ -202,4 +205,108 @@ public class CoordinateCalculateRouteUtil {
}
return currentIndex;
}
public static float calculateRouteSumLengthByLocation(List<Location> points){
if (null == points || points.size() == 0) return 0;
float sumLength = 0;
//计算全路径总距离
for (int i = 0;i + 1< points.size();i++){
double preLat = points.get(i).getLatitude();
double preLon = points.get(i).getLongitude();
double laLat = points.get(i+1).getLatitude();
double laLon = points.get(i+1).getLongitude();
float length = CoordinateUtils.calculateLineDistance(laLon,laLat,preLon,preLat);
sumLength += length;
}
return sumLength;
}
public static List<Location> coordinateConverterWgsToGcjLocations(Context mContext, List<MessagePad.Location> models) {
//转成MogoLatLng集合
List<Location> list = new ArrayList<>();
for (MessagePad.Location m : models) {
LatLng mogoLatLng = coordinateConverterWgsToGcj(mContext, m);
Location location = new Location("gcj_provider");
location.setBearing((float) m.getHeading());
location.setLatitude(mogoLatLng.latitude);
location.setLongitude(mogoLatLng.longitude);
list.add(location);
}
return list;
}
public static Map<Integer,List<LatLng>> getRemainPointListByCompareNew(int preIndex,
List<Location> mRoutePoints,
Location realLocation) {
Map<Integer,List<LatLng>> routePonits = new HashMap<>();
List<LatLng> latePoints = new ArrayList<>(); // 剩余轨迹集合
int currentIndex = 0; //记录疑似点
if (mRoutePoints.size() > preIndex){
//基础点
Location baseLatLng = mRoutePoints.get(preIndex);
float baseDiffDis = CoordinateUtils.calculateLineDistance(realLocation.getLongitude(),
realLocation.getLatitude()
,baseLatLng.getLongitude(),baseLatLng.getLongitude());// lon,lat, prelon, prelat
for (int i= preIndex; i < mRoutePoints.size(); i++){
Location latLng = mRoutePoints.get(i);
//todo 先看index对应点的方向和realLocation方向是否一致 方向角度不能过90度
if (Math.abs(realLocation.getBearing() - latLng.getBearing()) <= 90){
float diff = CoordinateUtils.calculateLineDistance(realLocation.getLongitude(),
realLocation.getLatitude(),
latLng.getLongitude(),latLng.getLatitude());
if (baseDiffDis > diff ){
// Logger.d(M_TAXI + "calculateRouteSumLength", "点:"+i+"-------先记录点----- ");
baseDiffDis = diff;
currentIndex = i;
}
}
}
Logger.d( "calculateRouteSumLength", "点:"+currentIndex+"-------是最近的点------ ");
if (currentIndex == mRoutePoints.size()-1){
Location location = mRoutePoints.get(currentIndex);
LatLng latLng = new LatLng(location.getLatitude(), location.getLongitude());
latePoints.add(latLng);
}else {
List<Location> locations = mRoutePoints.subList(currentIndex,mRoutePoints.size()-1);
for (Location location: locations) {
LatLng latLng = new LatLng(location.getLatitude(), location.getLongitude());
latePoints.add(latLng);
}
}
routePonits.put(currentIndex,latePoints);
return routePonits;
}
return routePonits;
}
public static int getArrivedPointIndexNew(List<Location> mRoutePoints,
Location realLocation) {
int currentIndex = 0; //记录疑似点 //基础点
Location baseLatLng = mRoutePoints.get(0);
float baseDiffDis = CoordinateUtils.calculateLineDistance(realLocation.getLongitude(),
realLocation.getLatitude()
, baseLatLng.getLongitude(), baseLatLng.getLongitude());// lon,lat, prelon, prelat
for (int i = 0; i < mRoutePoints.size(); i++) {
Location latLng = mRoutePoints.get(i);
//todo 先看index对应点的方向和realLocation方向是否一致 方向角度不能过90度
if (Math.abs(realLocation.getBearing() - latLng.getBearing()) <= 90) {
float diff = CoordinateUtils.calculateLineDistance(realLocation.getLongitude(),
realLocation.getLatitude(),
latLng.getLongitude(), latLng.getLatitude());
if (baseDiffDis > diff) {
// Logger.d(M_TAXI + "calculateRouteSumLength", "点:"+i+"-------先记录点----- ");
baseDiffDis = diff;
currentIndex = i;
}
}
}
Logger.d("calculateRouteSumLength", "点:" + currentIndex + "-------是最近的点------ ");
return currentIndex;
}
}

View File

@@ -1368,7 +1368,11 @@ public class MainActivity extends BaseActivity implements OnAdasListener, OnAdas
break;
case Constants.TITLE.SEND_TRIP_INFO:
//行程信息
AdasManager.getInstance().sendTripInfoReq(1, "", "", false);
AdasManager.getInstance().sendTripInfoReq(1, "x10", "x11", "x12", false);
AdasManager.getInstance().sendTripInfoReq(2, "x13", "x14", "x15", true);
AdasManager.getInstance().sendTripInfoReq(3, "x16", "x17", "x18", false);
AdasManager.getInstance().sendTripInfoReq(4, "x19", "x20", "x21", true);
AdasManager.getInstance().sendTripInfoReq(5, "x22", "x23", "x24", false);
break;
}
}

View File

@@ -571,15 +571,20 @@ class MoGoAutopilotProvider :
}
/**
* 行程信息
* @param type 事件类型, 1:行程开始, 2:行程结束, 3:出站, 4:进站, 5:城市占道施工预警
* @param lineName 路线名, for type 1, 2
* @param stopName 站点名, for type 3, 4
* @param isLastStop
* @return
* 发生行程相关
* type=1或2的时 需要参数 lineName
* type=3或4的时 需要参数 lineName departureStopName arrivalStopName isLastStop
* type=5时 不需要任何参数
*
* @param type 事件类型, 1:行程开始, 2:行程结束, 3:出站, 4:进站, 5:城市占道施工预警
* @param lineName 路线名
* @param departureStopName 出站站点名
* @param arrivalStopName 下一站到达站点名
* @param isLastStop 是否最终站
* @return boolean
*/
override fun sendTripInfo(type: Int, lineName: String, stopName: String, isLastStop: Boolean) {
AdasManager.getInstance().sendTripInfoReq(type, lineName, stopName, isLastStop)
override fun sendTripInfo(type: Int, lineName: String, departureStopName: String,arrivalStopName: String, isLastStop: Boolean) {
AdasManager.getInstance().sendTripInfoReq(type, lineName, departureStopName,arrivalStopName, isLastStop)
}
/**

View File

@@ -1,35 +1,35 @@
package com.zhjt.mogo_core_function_devatools.badcase.biz
package com.zhjt.mogo_core_function_devatools.badcase.biz
import android.content.Context
import android.graphics.Color
import android.graphics.drawable.ColorDrawable
import android.util.AttributeSet
import android.view.LayoutInflater
import android.widget.RadioButton
import android.widget.RadioGroup
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.recyclerview.widget.GridLayoutManager
import com.mogo.eagle.core.data.badcase.RecordTypeEntity
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotRecordListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotRecordListenerManager
import com.mogo.eagle.core.utilcode.util.SizeUtils
import com.mogo.eagle.core.utilcode.util.ThreadUtils
import com.mogo.eagle.core.utilcode.util.ToastUtils
import com.zhjt.mogo_core_function_devatools.R
import com.zhjt.mogo_core_function_devatools.badcase.biz.adapter.RecordTemplateAdapter
import com.zhjt.mogo_core_function_devatools.badcase.consts.BadCaseConfig
import kotlinx.android.synthetic.main.layout_badcase_config.view.*
import mogo.telematics.pad.MessagePad
import java.lang.Exception
/**
/**
* @author XuXinChao
* @description BadCase上报信息配置页面
* @since: 2022/7/5
*/
internal class BadCaseConfigView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : ConstraintLayout(context, attrs, defStyleAttr), IMoGoAutopilotRecordListener {
companion object {
@@ -37,18 +37,21 @@ defStyleAttr: Int = 0
}
private var clickListener: ClickListener? = null
private var recordTemplateAdapter: RecordTemplateAdapter? = null
private var mIdentity = BadCaseConfig.identity
private var mPreviousDuration = BadCaseConfig.previousDuration
private var mBackDuration = BadCaseConfig.backDuration
private var mType = 1
private var recordTypesList = ArrayList<RecordTypeEntity>()
private var caseTopicListDialog: CaseTopicListDialog? = null
init{
init {
LayoutInflater.from(context).inflate(R.layout.layout_badcase_config, this, true)
background = ColorDrawable(Color.parseColor("#F0151D41"))
initView()
}
private fun initView(){
private fun initView() {
//关闭BadCase配置窗口
ivConfigClose.setOnClickListener {
clickListener?.onClose()
@@ -75,41 +78,42 @@ defStyleAttr: Int = 0
//保存配置按钮
tvConfigSave.setOnClickListener {
//判断、保存录制时间信息
val preTimeStr=etInitiativePreTime.text.toString()
val afterTimeStr=etInitiativeAfterTime.text.toString()
val preTimeStr = etInitiativePreTime.text.toString()
val afterTimeStr = etInitiativeAfterTime.text.toString()
try {
if(preTimeStr.isEmpty()){
if (preTimeStr.isEmpty()) {
mPreviousDuration = BadCaseConfig.previousDuration
}else{
} else {
mPreviousDuration = preTimeStr.toInt()
}
if(afterTimeStr.isEmpty()){
if (afterTimeStr.isEmpty()) {
mBackDuration = BadCaseConfig.backDuration
}else{
} else {
mBackDuration = afterTimeStr.toInt()
}
if(mPreviousDuration<0 || mPreviousDuration>30){
if (mPreviousDuration < 0 || mPreviousDuration > 30) {
ToastUtils.showLong("前溯采集时长最长30S")
return@setOnClickListener
}
if(mBackDuration<0 || mBackDuration>300){
if (mBackDuration < 0 || mBackDuration > 300) {
ToastUtils.showLong("采集总时长最长300S")
return@setOnClickListener
}
if((mPreviousDuration+mBackDuration)<5){
if ((mPreviousDuration + mBackDuration) < 5) {
ToastUtils.showLong("采集总时长最短5S")
return@setOnClickListener
}
if((mPreviousDuration+mBackDuration)>300){
if ((mPreviousDuration + mBackDuration) > 300) {
ToastUtils.showLong("采集总时长最长300S")
return@setOnClickListener
}
BadCaseConfig.previousDuration = mPreviousDuration
BadCaseConfig.backDuration = mBackDuration
BadCaseConfig.totalDuration = BadCaseConfig.previousDuration + BadCaseConfig.backDuration
}catch (e: Exception){
BadCaseConfig.totalDuration =
BadCaseConfig.previousDuration + BadCaseConfig.backDuration
} catch (e: Exception) {
ToastUtils.showLong("输入时间格式不合法,请重新输入")
etInitiativePreTime.text = null
etInitiativeAfterTime.text = null
@@ -126,14 +130,14 @@ defStyleAttr: Int = 0
}
//现场恢复
when(BadCaseConfig.identity){
"安全员"->{
when (BadCaseConfig.identity) {
"安全员" -> {
rbSafetyOfficer.isChecked = true
}
"QA、研发"->{
"QA、研发" -> {
rbDeveloper.isChecked = true
}
"产品、运营、演示"->{
"产品、运营、演示" -> {
rbProduct.isChecked = true
}
}
@@ -141,128 +145,67 @@ defStyleAttr: Int = 0
etInitiativePreTime.hint = "${BadCaseConfig.previousDuration}S"
etInitiativeAfterTime.hint = "${BadCaseConfig.backDuration}S"
// val test1 = TestBean(1,"人工接管自动录制")
// val test2 = TestBean(2,"地图采集")
// val test3 = TestBean(3,"画龙问题排查")
// val test4 = TestBean(4,"误识别问题排查")
// val test5 = TestBean(5,"lidar+planning")
// val test6 = TestBean(6,"camera+planning")
// val test7 = TestBean(7,"bus lidar+planning")
// val test8 = TestBean(8,"bus camera+planning")
// val test99 = TestBean(99,"ai data")
//
// val list = ArrayList<TestBean>()
// list.add(test1)
// list.add(test2)
// list.add(test3)
// list.add(test4)
// list.add(test5)
// list.add(test6)
// list.add(test7)
// list.add(test8)
// list.add(test99)
// list.iterator().forEach {
// if(it.id!=99){
// val radioButton = RadioButton(context)
// val lp = RadioGroup.LayoutParams(
// RadioGroup.LayoutParams.WRAP_CONTENT,
// RadioGroup.LayoutParams.WRAP_CONTENT
// )
// //设置RadioButton边距 (int left, int top, int right, int bottom)
// lp.setMargins(
// SizeUtils.dp2px(0f),
// SizeUtils.dp2px(8f),
// SizeUtils.dp2px(10f),
// SizeUtils.dp2px(8f)
// )
// //设置RadioButton背景
// radioButton.setTextColor(Color.WHITE)
//
// radioButton.buttonDrawable = resources.getDrawable(R.drawable.badcase_radio_button_style)
// //设置文字距离四周的距离
// radioButton.setPadding(
// SizeUtils.dp2px(12f),
// SizeUtils.dp2px(5f),
// SizeUtils.dp2px(10f),
// SizeUtils.dp2px(5f)
// )
// radioButton.textSize = SizeUtils.sp2px(9f).toFloat()
// radioButton.id = it.id
// radioButton.isChecked = it.id == BadCaseConfig.type
// //设置文字
// radioButton.text = it.src
// //将radioButton添加到radioGroup中
// rgRecordConfig.addView(radioButton, lp)
// rgRecordConfig.setOnCheckedChangeListener { _, checkedId ->
// mType = checkedId
// }
// }
// }
recordTemplateAdapter = RecordTemplateAdapter()
recordTemplateAdapter?.setListener(object :RecordTemplateAdapter.ClickTemplateListener{
override fun onClick(recordTypeEntity: RecordTypeEntity) {
//弹窗Topic清单列表
showCaseTopicListDialog(recordTypeEntity)
}
})
val gridLayoutManager = GridLayoutManager(context,2)
rvTemplate.layoutManager = gridLayoutManager
rvTemplate.adapter = recordTemplateAdapter
}
fun setClickListener(clickListener: ClickListener) {
this.clickListener = clickListener
}
fun setClickListener(clickListener: ClickListener) {
this.clickListener = clickListener
}
override fun onAutopilotRecordConfig(config: MessagePad.RecordDataConfig) {
super.onAutopilotRecordConfig(config)
ThreadUtils.runOnUiThread{
config.recordTypesList.iterator().forEach {
if(it.id!=99){
val radioButton = RadioButton(context)
val lp = RadioGroup.LayoutParams(
RadioGroup.LayoutParams.WRAP_CONTENT,
RadioGroup.LayoutParams.WRAP_CONTENT
)
//设置RadioButton边距 (int left, int top, int right, int bottom)
lp.setMargins(
SizeUtils.dp2px(0f),
SizeUtils.dp2px(8f),
SizeUtils.dp2px(10f),
SizeUtils.dp2px(8f)
)
//设置RadioButton背景
radioButton.setTextColor(Color.WHITE)
private fun showCaseTopicListDialog(recordTypeEntity: RecordTypeEntity){
if(caseTopicListDialog == null){
caseTopicListDialog = CaseTopicListDialog(context)
}
caseTopicListDialog?.setData(recordTypeEntity)
caseTopicListDialog?.show()
}
radioButton.buttonDrawable = resources.getDrawable(R.drawable.badcase_radio_button_style)
//设置文字距离四周的距离
radioButton.setPadding(
SizeUtils.dp2px(12f),
SizeUtils.dp2px(5f),
SizeUtils.dp2px(10f),
SizeUtils.dp2px(5f)
)
radioButton.textSize = SizeUtils.sp2px(9f).toFloat()
radioButton.id = it.id
radioButton.isChecked = it.id == BadCaseConfig.type
//设置文字
radioButton.text = it.desc
//将radioButton添加到radioGroup中
rgRecordConfig.addView(radioButton, lp)
rgRecordConfig.setOnCheckedChangeListener { _, checkedId ->
mType = checkedId
}
}
}
}
}
override fun onAutopilotRecordConfig(config: MessagePad.RecordDataConfig) {
super.onAutopilotRecordConfig(config)
ThreadUtils.runOnUiThread {
config.recordTypesList.iterator().forEach {
if (it.id != 99){
val topicList = ArrayList<String>()
it.topicsList.iterator().forEach {
topicList.add(it)
}
recordTypesList.add(RecordTypeEntity(it.id,it.desc,topicList))
}
}
if(recordTypesList.size>1){
recordTemplateAdapter?.setData(recordTypesList)
recordTemplateAdapter?.notifyDataSetChanged()
}
}
}
override fun onAttachedToWindow() {
super.onAttachedToWindow()
CallerAutopilotRecordListenerManager.addListener(TAG, this)
//获取数据采集录制模式配置列表 TODO
// CallerAutoPilotManager.getBadCaseConfig()
}
override fun onAttachedToWindow() {
super.onAttachedToWindow()
CallerAutopilotRecordListenerManager.addListener(TAG, this)
//获取数据采集录制模式配置列表
CallerAutoPilotManager.getBadCaseConfig(0, 0, listOf())
recordTypesList.add(RecordTypeEntity(0,"自定义", arrayListOf()))
}
override fun onDetachedFromWindow() {
super.onDetachedFromWindow()
CallerAutopilotRecordListenerManager.removeListener(TAG)
}
override fun onDetachedFromWindow() {
super.onDetachedFromWindow()
CallerAutopilotRecordListenerManager.removeListener(TAG)
recordTypesList.clear()
}
interface ClickListener{
fun onClose()
}
interface ClickListener {
fun onClose()
}
}

View File

@@ -0,0 +1,63 @@
package com.zhjt.mogo_core_function_devatools.badcase.biz;
import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.zhjt.mogo_core_function_devatools.R;
import com.zhjt.mogo_core_function_devatools.badcase.biz.adapter.CaseListAdapter;
import java.util.ArrayList;
/**
* @author XuXinChao
* @description BadCase清单选择对话框
* @since: 2022/10/19
*/
public class CaseListDialog extends Dialog {
private TextView tvCancel;
private RecyclerView rvCaseList;
private CaseListAdapter caseListAdapter;
public CaseListDialog(@NonNull Context context) {
super(context, R.style.bad_case_dialog);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.dialog_case_list);
setCanceledOnTouchOutside(false);
init();
initEvent();
}
private void init() {
tvCancel = findViewById(R.id.tvCancel);
rvCaseList = findViewById(R.id.rvCaseList);
caseListAdapter = new CaseListAdapter();
GridLayoutManager gridLayoutManager = new GridLayoutManager(getContext(),2);
gridLayoutManager.setOrientation(RecyclerView.VERTICAL);
rvCaseList.setLayoutManager(gridLayoutManager);
rvCaseList.setAdapter(caseListAdapter);
ArrayList<String> list = new ArrayList<>();
list.add("红绿灯检测错误");
list.add("接管默认录制");
list.add("行程冲突");
list.add("自定义A");
caseListAdapter.setData(list);
caseListAdapter.notifyDataSetChanged();
}
private void initEvent() {
tvCancel.setOnClickListener(v -> dismiss());
}
}

View File

@@ -0,0 +1,147 @@
package com.zhjt.mogo_core_function_devatools.badcase.biz;
import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.util.Log;
import android.view.KeyEvent;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.mogo.eagle.core.data.badcase.RecordTypeEntity;
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotRecordListener;
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager;
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotRecordListenerManager;
import com.mogo.eagle.core.utilcode.util.ThreadUtils;
import com.zhjt.mogo_core_function_devatools.R;
import com.zhjt.mogo_core_function_devatools.badcase.biz.adapter.TopicListAdapter;
import java.util.ArrayList;
import java.util.List;
import mogo.telematics.pad.MessagePad;
import record_cache.RecordPanelOuterClass;
/**
* @author XuXinChao
* @description BadCase Topic列表选择对话框
* @since: 2022/10/19
*/
public class CaseTopicListDialog extends Dialog implements IMoGoAutopilotRecordListener {
private static final String TAG = "CaseTopicListDialog";
private TextView tvCaseName;
private TextView tvSave;
private TextView tvCancel;
private ImageView ivSearch;
private EditText etSearch;
private RecyclerView rvTopicList;
private TopicListAdapter topicListAdapter;
private String searchStr;
private List<String> allTopicList = new ArrayList<>();
public CaseTopicListDialog(@NonNull Context context) {
super(context, R.style.bad_case_dialog);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.dialog_case_topic_list);
setCanceledOnTouchOutside(false);
CallerAutopilotRecordListenerManager.INSTANCE.addListener(TAG, this);
init();
initEvent();
}
@Override
public void onDetachedFromWindow() {
super.onDetachedFromWindow();
CallerAutopilotRecordListenerManager.INSTANCE.removeListener(TAG);
}
public void setData(RecordTypeEntity recordTypeEntity){
tvCaseName.setText(recordTypeEntity.getDesc());
//获取所有Topic
CallerAutoPilotManager.INSTANCE.getBadCaseConfig(1, 0, new ArrayList<>());
if(recordTypeEntity.getTopicsList().size()>0){
topicListAdapter.setData(recordTypeEntity.getTopicsList());
topicListAdapter.notifyDataSetChanged();
}
}
private void init() {
tvCaseName = findViewById(R.id.tvCaseName);
tvSave = findViewById(R.id.tvSave);
tvCancel = findViewById(R.id.tvCancel);
ivSearch = findViewById(R.id.ivSearch);
etSearch = findViewById(R.id.etSearch);
rvTopicList = findViewById(R.id.rvTopicList);
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getContext());
linearLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
rvTopicList.setLayoutManager(linearLayoutManager);
topicListAdapter = new TopicListAdapter();
rvTopicList.setAdapter(topicListAdapter);
}
private void initEvent() {
etSearch.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 s) {
searchStr = s.toString();
if(searchStr!=null && searchStr.length()>0){
ivSearch.setImageDrawable(getContext().getDrawable(R.drawable.icon_bad_case_delect));
} else {
ivSearch.setImageDrawable(getContext().getDrawable(R.drawable.icon_bad_case_search));
}
//TODO
}
});
ivSearch.setOnClickListener(v -> {
if(searchStr!=null && searchStr.length()>0){
etSearch.setText("");
ivSearch.setImageDrawable(getContext().getDrawable(R.drawable.icon_bad_case_search));
}
});
tvCancel.setOnClickListener(v -> {
dismiss();
});
}
@Override
public void onAutopilotRecordConfig(MessagePad.RecordDataConfig config) {
ThreadUtils.runOnUiThread(() -> {
if(config.getAllTopicsCount()>0){
for(int index=0;index<config.getAllTopicsCount();index++){
allTopicList.add(config.getAllTopics(index));
}
}
});
}
@Override
public void onAutopilotRecordResult(@NonNull RecordPanelOuterClass.RecordPanel recordPanel) {
}
}

View File

@@ -0,0 +1,43 @@
package com.zhjt.mogo_core_function_devatools.badcase.biz.adapter
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import com.zhjt.mogo_core_function_devatools.R
/**
* @author XuXinChao
* @description Case清单列表适配器
* @since: 2022/10/19
*/
class CaseListAdapter: RecyclerView.Adapter<CaseListAdapter.CaseListHolder>() {
private var data:List<String>? = null
fun setData( data: List<String>?){
this.data = data
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): CaseListHolder {
val view = LayoutInflater.from(parent.context)
.inflate(R.layout.item_case_list, parent, false)
return CaseListHolder(view)
}
override fun onBindViewHolder(holder: CaseListHolder, position: Int) {
data?.let {
holder.caseName.text = it[position]
holder.caseName.setOnClickListener {
}
}
}
override fun getItemCount() = data?.size ?: 0
class CaseListHolder(itemView: View) : RecyclerView.ViewHolder(itemView){
var caseName: TextView = itemView.findViewById(R.id.caseName)
}
}

View File

@@ -0,0 +1,55 @@
package com.zhjt.mogo_core_function_devatools.badcase.biz.adapter
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import com.mogo.eagle.core.data.badcase.RecordTypeEntity
import com.zhjt.mogo_core_function_devatools.R
import com.zhjt.mogo_core_function_devatools.badcase.biz.BadCaseConfigView
/**
* @author XuXinChao
* @description 录制模板清单列表适配器
* @since: 2022/10/19
*/
class RecordTemplateAdapter : RecyclerView.Adapter<RecordTemplateAdapter.RecordTemplateHolder>(){
private var data:List<RecordTypeEntity>? = null
private var clickTemplateListener: ClickTemplateListener? = null
fun setData( data: List<RecordTypeEntity>?){
this.data = data
}
fun setListener(listener: ClickTemplateListener){
clickTemplateListener = listener
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecordTemplateHolder {
val view = LayoutInflater.from(parent.context)
.inflate(R.layout.item_record_template, parent, false)
return RecordTemplateHolder(view)
}
override fun onBindViewHolder(holder: RecordTemplateHolder, position: Int) {
data?.let {recordTypeEntity->
holder.caseName.text = recordTypeEntity[position].desc
holder.caseName.setOnClickListener {
clickTemplateListener?.onClick(recordTypeEntity[position])
}
}
}
override fun getItemCount() = data?.size ?: 0
class RecordTemplateHolder(itemView: View): RecyclerView.ViewHolder(itemView){
var caseName: TextView = itemView.findViewById(R.id.caseName)
}
interface ClickTemplateListener{
fun onClick(recordTypeEntity: RecordTypeEntity)
}
}

View File

@@ -0,0 +1,41 @@
package com.zhjt.mogo_core_function_devatools.badcase.biz.adapter
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.CheckBox
import androidx.recyclerview.widget.RecyclerView
import com.zhjt.mogo_core_function_devatools.R
/**
* @author XuXinChao
* @description Topic列表适配器
* @since: 2022/10/19
*/
class TopicListAdapter: RecyclerView.Adapter<TopicListAdapter.TopicListHolder>() {
private var data:List<String>? = null
fun setData( data: List<String>?){
this.data = data
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): TopicListHolder {
val view = LayoutInflater.from(parent.context)
.inflate(R.layout.item_topic_list, parent, false)
return TopicListHolder(view)
}
override fun onBindViewHolder(holder: TopicListHolder, position: Int) {
data?.let{
holder.topic_check_box.text = it[position]
}
}
override fun getItemCount() = data?.size ?: 0
class TopicListHolder(itemView: View) : RecyclerView.ViewHolder(itemView){
var topic_check_box: CheckBox = itemView.findViewById(R.id.topic_check_box);
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 489 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#3B4577" />
<corners android:radius="32px" />
</shape>

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#29305E" />
<corners android:radius="48px" />
</shape>

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#29305E" />
<corners android:radius="20px" />
</shape>

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#2B6EFF" />
<corners android:radius="20px" />
</shape>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/case_list_select" android:state_focused="true" android:state_pressed="true" />
<item android:drawable="@drawable/case_list_select" android:state_focused="false" android:state_pressed="true" />
<item android:drawable="@drawable/case_list_select" android:state_selected="true" />
<item android:drawable="@drawable/case_list_select" android:state_focused="true" />
<item android:drawable="@drawable/case_list_normal" />
</selector>

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#33E1E5FF" />
<corners android:radius="32px" />
</shape>

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#29305E" />
<corners android:radius="32px" />
</shape>

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#3B4577" />
<corners android:radius="24px" />
</shape>

View File

@@ -0,0 +1,61 @@
<?xml version="1.0" encoding="utf-8"?>
<com.mogo.eagle.core.widget.RoundConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="1110px"
android:layout_height="668px"
android:background="#3B4577"
app:roundLayoutRadius="32px"
>
<TextView
android:id="@+id/tvCaseListTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="case清单"
android:textColor="#FFFFFFFF"
android:textSize="56px"
android:gravity="center"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginTop="50px"
/>
<TextView
android:id="@+id/tvCancel"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="取消"
android:textColor="#FFFFFFFF"
android:textSize="52px"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:paddingBottom="50px"
android:gravity="center"
/>
<View
android:id="@+id/viewCancelDivider"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#66B8BFE8"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintBottom_toTopOf="@id/tvCancel"
android:layout_marginBottom="50px"
/>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rvCaseList"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvCaseListTitle"
app:layout_constraintBottom_toTopOf="@id/viewCancelDivider"
android:layout_margin="50px"
/>
</com.mogo.eagle.core.widget.RoundConstraintLayout>

View File

@@ -0,0 +1,126 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="1270px"
android:layout_height="959px"
>
<TextView
android:id="@+id/tvCaseName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#FFFFFFFF"
android:textSize="56px"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginTop="50px"
/>
<View
android:id="@+id/viewVerticalLine"
android:layout_width="2px"
android:layout_height="160px"
android:background="#66B8BFE8"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
/>
<View
android:id="@+id/viewHorizontalLine"
android:layout_width="match_parent"
android:layout_height="2px"
android:background="#66B8BFE8"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintBottom_toTopOf="@id/viewVerticalLine"
/>
<TextView
android:id="@+id/tvSave"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintTop_toBottomOf="@id/viewHorizontalLine"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@id/viewVerticalLine"
android:text="保存"
android:textColor="#FFFFFFFF"
android:textSize="52px"
android:gravity="center"
/>
<TextView
android:id="@+id/tvCancel"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintTop_toBottomOf="@id/viewHorizontalLine"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toRightOf="@id/viewVerticalLine"
app:layout_constraintRight_toRightOf="parent"
android:text="取消"
android:textColor="#FFFFFFFF"
android:textSize="52px"
android:gravity="center"
/>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/clSearchLayout"
android:layout_width="1030px"
android:layout_height="96px"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvCaseName"
android:layout_marginTop="50px"
android:focusable="true"
android:focusableInTouchMode="true"
android:background="@drawable/bad_case_search_bg"
>
<ImageView
android:id="@+id/ivSearch"
android:layout_width="38px"
android:layout_height="42px"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toRightOf="parent"
android:src="@drawable/icon_bad_case_search"
android:layout_marginEnd="40px"
/>
<EditText
android:id="@+id/etSearch"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@id/ivSearch"
android:hint="topic搜索"
android:textSize="38px"
android:textColor="#FFFFFFFF"
android:textColorHint="#B3FFFFFF"
android:background="@null"
android:layout_marginStart="40px"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rvTopicList"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintLeft_toLeftOf="@id/clSearchLayout"
app:layout_constraintRight_toRightOf="@id/clSearchLayout"
app:layout_constraintTop_toBottomOf="@id/clSearchLayout"
app:layout_constraintBottom_toTopOf="@id/viewHorizontalLine"
android:layout_marginTop="50px"
android:layout_marginBottom="20dp"
android:scrollbars="vertical"
android:fadeScrollbars="false"
style="@style/rv_vertical_style"
/>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/caseName"
android:layout_width="430px"
android:layout_height="116px"
android:textColor="#FFFFFFFF"
android:textSize="43px"
android:background="@drawable/case_list_selector"
android:gravity="center"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:clickable="true"
android:focusable="true"
>
</TextView>

View File

@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/caseName"
android:layout_width="wrap_content"
android:layout_height="84px"
android:textColor="#FFFFFFFF"
android:textSize="34px"
android:background="@drawable/case_list_selector"
android:gravity="center"
android:layout_marginTop="20dp"
android:clickable="true"
android:focusable="true"
android:paddingStart="30dp"
android:paddingEnd="30dp"
android:layout_marginStart="20dp"
>
</TextView>

View File

@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<CheckBox xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/topic_check_box"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:button="@drawable/badcase_radio_button_style"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"
android:textColor="#FFFFFFFF"
android:textSize="38px"
android:paddingStart="5dp"
android:gravity="center_vertical"
>
</CheckBox>

View File

@@ -308,6 +308,17 @@
android:layout_marginStart="@dimen/dp_30"
/>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rvTemplate"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintLeft_toLeftOf="@id/tvRecordTemplate"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvRecordTemplate"
android:background="@drawable/template_list_bg"
android:layout_marginTop="@dimen/dp_50"
/>
<RadioGroup
android:id="@+id/rgRecordConfig"
android:layout_width="0dp"

View File

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="bad_case_dialog" parent="@android:style/Theme.Dialog">
<item name="android:windowFrame">@null</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowBackground">@drawable/bad_case_dialog_bg</item>
<item name="android:windowIsFloating">true</item>
<item name="android:windowContentOverlay">@null</item>
</style>
<style name="rv_vertical_style">
<item name="android:scrollbarSize">5dp</item>
<item name="android:scrollbars">horizontal</item>
<item name="android:scrollbarThumbVertical">@drawable/rv_scroll_bar_thumb</item>
<item name="android:scrollbarTrackVertical">@drawable/rv_scroll_bar_track</item>
</style>
</resources>

View File

@@ -751,7 +751,7 @@ class MoGoHmiFragment : MvpFragment<MoGoHmiContract.View?, HmiPresenter?>(),
context?.let { it -> SharedPrefsMgr.getInstance(it).getLong("roadwork", 0) }
if (currentTime - oldTime!! > 60) { //超过一分钟,才会继续播报重复提醒
context?.let { it -> SharedPrefsMgr.getInstance(it).putLong("roadwork", System.currentTimeMillis() / 1000) }
CallerAutoPilotManager.sendTripInfo(5, "", "", false);
CallerAutoPilotManager.sendTripInfo(5, "", "", "", false);
}
}

View File

@@ -43,6 +43,10 @@ class SOPSettingView @JvmOverloads constructor(
}
if(AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode)){
tbMarkingObstacles.visibility = View.GONE
}
//引导线动态效果
tbRouteDynamicEffect.isChecked =
AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode) && !AppIdentityModeUtils.isBus(
@@ -154,6 +158,14 @@ class SOPSettingView @JvmOverloads constructor(
}
}
if(AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode)){
tvSpeedThresholdTitle.visibility = View.GONE
ivSpeedReduce.visibility = View.GONE
tvSpeed.visibility = View.GONE
ivSpeedAdd.visibility = View.GONE
btnSpeedSet.visibility = View.GONE
}
}
}

View File

@@ -71,7 +71,7 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
private BluetoothMonitorReceiver mBluetoothReceiver = null;
private BluetoothAdapter mBluetoothAdapter;
private List<BluetoothDevice> mAreadlyConnectedList = new ArrayList<>();//已连接设备集合
// private List<BluetoothDevice> mAreadlyConnectedList = new ArrayList<>();//已连接设备集合
private int numberA = 0;
private boolean isLongPressA = false;
private int numberB = 0;
@@ -98,13 +98,11 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
super.onResume();
initBluetooth();
mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
if (!mBluetoothAdapter.isEnabled()) {
mBluetoothAdapter.enable();
}
mBluetoothAdapter.startDiscovery();
showBondedDevice(mBluetoothAdapter);
}
@@ -212,30 +210,6 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_VOLUME_UP) { //向上长按 开启自动驾驶
long currentTime = System.currentTimeMillis() / (1000);
long oldTime = SharedPrefsMgr.getInstance(getContext()).getLong("old_time_up", 0);
if (currentTime - oldTime > 6) {
SharedPrefsMgr.getInstance(getContext()).putLong("old_time_up", System.currentTimeMillis() / 1000);
// ToastUtils.showShort("长按 ↑↑↑ 开启自动驾驶");
// CallerAutoPilotManager.INSTANCE.setControlAutopilotCarAuto(true);
CallerAutoPilotManager.INSTANCE.startAutoPilot(CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo().getAutopilotControlParameters());
}
return true;
} else if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN) { //下和中间键盘长按,减速为-2
long currentTime = System.currentTimeMillis() / (1000);
long oldTime = SharedPrefsMgr.getInstance(getContext()).getLong("old_time_down", 0);
if (currentTime - oldTime > 6) {
SharedPrefsMgr.getInstance(getContext()).putLong("old_time_down", System.currentTimeMillis() / 1000);
// ToastUtils.showShort("长按 ↓↓↓ 减速 -2 ");
sendAcc(true, -2);
}
return true;
}
// Log.e("liyz", "onKeyDown keyCode = " + keyCode + "--action = " + event.getAction() + "---" + event);
return super.onKeyDown(keyCode, event);
}
@@ -243,109 +217,112 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
@Override
public boolean dispatchKeyEvent(KeyEvent event) {
// Log.d("liyz", "dispatchKeyEvent code = " + event.getKeyCode() + "--action = " + event.getAction() + "----" + event);
if (event.getKeyCode() == KeyEvent.KEYCODE_A) { //单击向左变道,长按-1
if (event.getAction() == KeyEvent.ACTION_DOWN) {
numberA++;
if (numberA > 2) {
if (!isLongPressA) {
// ToastUtils.showShort("方块 长按A -2 ");
sendAcc(true, -2);
isLongPressA = true;
}
}
} else if (event.getAction() == KeyEvent.ACTION_UP) {
if (numberA == 1) {
// ToastUtils.showShort("方块 点击A -1 ");
sendAcc(true, -1);
}
numberA = 0;
isLongPressA = false;
}
return true;
} else if (event.getKeyCode() == KeyEvent.KEYCODE_B) { //单击向右变道,长按-2
if (event.getAction() == KeyEvent.ACTION_DOWN) {
numberB++;
if (numberB > 2) {
if (!isLongPressB) {
// ToastUtils.showShort("方块 长按B 无操作 ");
isLongPressB = true;
}
}
} else if (event.getAction() == KeyEvent.ACTION_UP) {
if (numberB == 1) {
// ToastUtils.showShort("方块 单击B 复原 ");
sendAcc(false, 0.0);
}
numberB = 0;
isLongPressB = false;
}
return true;
} else if (event.getKeyCode() == KeyEvent.KEYCODE_C) { //单击鸣笛,
if (event.getAction() == KeyEvent.ACTION_DOWN) {
numberC++;
if (numberC > 2) {
if (!isLongPressC) {
// ToastUtils.showShort("方块 长按C 无操作");
isLongPressC = true;
}
}
} else if (event.getAction() == KeyEvent.ACTION_UP) {
if (numberC == 1) {
// ToastUtils.showShort("方块 单击C ← 向左变道 ");
CallerAutoPilotManager.INSTANCE.sendOperatorChangeLaneLeft();
}
numberC = 0;
isLongPressC = false;
}
return true;
} else if (event.getKeyCode() == KeyEvent.KEYCODE_D) { //单击开启自动驾驶,
if (event.getAction() == KeyEvent.ACTION_DOWN) {
numberD++;
if (numberD > 2) {
if (!isLongPressD) {
// ToastUtils.showShort("方块 长按D 无操作");
isLongPressD = true;
}
}
} else if (event.getAction() == KeyEvent.ACTION_UP) {
if (numberD == 1) {
// ToastUtils.showShort("方块 单击D → 向右变道 ");
CallerAutoPilotManager.INSTANCE.sendOperatorChangeLaneRight();
}
numberD = 0;
isLongPressD = false;
}
return true;
} else if (event.getKeyCode() == KeyEvent.KEYCODE_E) { //单击复原,
if (event.getAction() == KeyEvent.ACTION_DOWN) {
numberE++;
if (numberE > 2) {
if (!isLongPressE) {
// ToastUtils.showShort("方块 长按E 鸣笛 ");
CallerAutoPilotManager.INSTANCE.sendOperatorSetHorn(1);
if (timerHorn == null) {
timerHorn = new Timer();
String bluetoothName = SharedPrefsMgr.getInstance(getContext()).getString("BLUETOOTH");
if (bluetoothName.equals("MINI_KEYBOARD")) {
if (event.getKeyCode() == KeyEvent.KEYCODE_A) { //单击向左变道,长按-1
if (event.getAction() == KeyEvent.ACTION_DOWN) {
numberA++;
if (numberA > 2) {
if (!isLongPressA) {
ToastUtils.showShort("方块 长按A -2 ");
sendAcc(true, -2);
isLongPressA = true;
}
timerHorn.schedule(new TimerTask() {
@Override
public void run() {
CallerAutoPilotManager.INSTANCE.sendOperatorSetHorn(2);
timerHorn = null;
}
}, 500);
isLongPressE = true;
}
} else if (event.getAction() == KeyEvent.ACTION_UP) {
if (numberA == 1) {
ToastUtils.showShort("方块 点击A -1 ");
sendAcc(true, -1);
}
numberA = 0;
isLongPressA = false;
}
} else if (event.getAction() == KeyEvent.ACTION_UP) {
if (numberE == 1) {
// ToastUtils.showShort("方块 单击E 开启自动驾驶 ");
return true;
} else if (event.getKeyCode() == KeyEvent.KEYCODE_B) { //单击向右变道,长按-2
if (event.getAction() == KeyEvent.ACTION_DOWN) {
numberB++;
if (numberB > 2) {
if (!isLongPressB) {
ToastUtils.showShort("方块 长按B 无操作 ");
isLongPressB = true;
}
}
} else if (event.getAction() == KeyEvent.ACTION_UP) {
if (numberB == 1) {
ToastUtils.showShort("方块 单击B 复原 ");
sendAcc(false, 0.0);
}
numberB = 0;
isLongPressB = false;
}
return true;
} else if (event.getKeyCode() == KeyEvent.KEYCODE_C) { //单击鸣笛,
if (event.getAction() == KeyEvent.ACTION_DOWN) {
numberC++;
if (numberC > 2) {
if (!isLongPressC) {
ToastUtils.showShort("方块 长按C 无操作");
isLongPressC = true;
}
}
} else if (event.getAction() == KeyEvent.ACTION_UP) {
if (numberC == 1) {
ToastUtils.showShort("方块 单击C ← 向左变道 ");
CallerAutoPilotManager.INSTANCE.sendOperatorChangeLaneLeft();
}
numberC = 0;
isLongPressC = false;
}
return true;
} else if (event.getKeyCode() == KeyEvent.KEYCODE_D) { //单击开启自动驾驶,
if (event.getAction() == KeyEvent.ACTION_DOWN) {
numberD++;
if (numberD > 2) {
if (!isLongPressD) {
ToastUtils.showShort("方块 长按D 无操作");
isLongPressD = true;
}
}
} else if (event.getAction() == KeyEvent.ACTION_UP) {
if (numberD == 1) {
ToastUtils.showShort("方块 单击D → 向右变道 ");
CallerAutoPilotManager.INSTANCE.sendOperatorChangeLaneRight();
}
numberD = 0;
isLongPressD = false;
}
return true;
} else if (event.getKeyCode() == KeyEvent.KEYCODE_E) { //单击复原,
if (event.getAction() == KeyEvent.ACTION_DOWN) {
numberE++;
if (numberE > 2) {
if (!isLongPressE) {
ToastUtils.showShort("方块 长按E 鸣笛 ");
CallerAutoPilotManager.INSTANCE.sendOperatorSetHorn(1);
if (timerHorn == null) {
timerHorn = new Timer();
}
timerHorn.schedule(new TimerTask() {
@Override
public void run() {
CallerAutoPilotManager.INSTANCE.sendOperatorSetHorn(2);
timerHorn = null;
}
}, 500);
isLongPressE = true;
}
}
} else if (event.getAction() == KeyEvent.ACTION_UP) {
if (numberE == 1) {
ToastUtils.showShort("方块 单击E 开启自动驾驶 ");
// CallerAutoPilotManager.INSTANCE.setControlAutopilotCarAuto(true);
CallerAutoPilotManager.INSTANCE.startAutoPilot(CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo().getAutopilotControlParameters());
CallerAutoPilotManager.INSTANCE.startAutoPilot(CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo().getAutopilotControlParameters());
}
numberE = 0;
isLongPressE = false;
}
numberE = 0;
isLongPressE = false;
return true;
}
return true;
}
return super.dispatchKeyEvent(event);
@@ -353,43 +330,6 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
@Override
public boolean dispatchTouchEvent(MotionEvent event) {
// Log.d("liyz", "dispatchTouchEvent event.getX() = " + event.getX() + "--event.getY() = " + event.getY() + "--action = " + event.getAction());
if (event.getX() == -1469.6875 && event.getY() == 530.0) { //向左变道
// ToastUtils.showShort("← 向左变道");
CallerAutoPilotManager.INSTANCE.sendOperatorChangeLaneLeft();
return true;
} else if (event.getX() == -1096.25 && event.getY() == 132.5) { //鸣笛
// ToastUtils.showShort("↑ 鸣笛 ");
CallerAutoPilotManager.INSTANCE.sendOperatorSetHorn(1);
if (timerHorn == null) {
timerHorn = new Timer();
}
timerHorn.schedule(new TimerTask() {
@Override
public void run() {
CallerAutoPilotManager.INSTANCE.sendOperatorSetHorn(2);
timerHorn = null;
}
}, 500);
return true;
} else if (event.getX() == -863.4375 && event.getY() == 690.0) { //向右变道
CallerAutoPilotManager.INSTANCE.sendOperatorChangeLaneRight();
// ToastUtils.showShort("→ 向右变道");
return true;
} else if (event.getX() == -1096.25 && event.getY() == 1099.0) { // -1减速
sendAcc(true, -1);
// ToastUtils.showShort("↓ 减速 -1 ");
return true;
} else if (event.getX() == -1096.25 && event.getY() == 690.0) { //复原
// ToastUtils.showShort("O 复原 ");
sendAcc(false, 0.0);
return true;
}
return super.dispatchTouchEvent(event);
}
@@ -444,10 +384,9 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
/**
* 查找蓝牙连接过的蓝牙设备
*
* @param bluetoothAdapter
*/
private void showBondedDevice(BluetoothAdapter bluetoothAdapter) {
mAreadlyConnectedList.clear();
// mAreadlyConnectedList.clear();
Set<BluetoothDevice> deviceList = bluetoothAdapter.getBondedDevices();
for (BluetoothDevice device : deviceList) {
try {
@@ -455,14 +394,10 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
Method isConnectedMethod = BluetoothDevice.class.getDeclaredMethod("isConnected", (Class[]) null);
isConnectedMethod.setAccessible(true);
boolean isConnected = (boolean) isConnectedMethod.invoke(device, (Object[]) null);
mAreadlyConnectedList.add(device);
if (device.getName().equals("JX-05")) { //后面魔戒可能不使用了
SharedPrefsMgr.getInstance(getContext()).putString("BT_MAC", device.getAddress());
}
if (!isConnected) {
UiThreadHandler.postDelayed(() -> {
connectBluetooth(); //主动连接一次
}, 4000L);
// mAreadlyConnectedList.add(device);
// Log.d("liyz", "-- device.getName() = " + device.getName()); //device.getAddress()
if (device.getName().equals("MINI_KEYBOARD")) {
SharedPrefsMgr.getInstance(getContext()).putString("BLUETOOTH", device.getName());
}
} catch (NoSuchMethodException e) {
e.printStackTrace();
@@ -474,41 +409,11 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
}
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onAutoConnection(ConnectBluetoothEvent event) {
// connectBluetooth();
}
/**
* 主动连接最近的一次连接
*/
private void connectBluetooth() {
if (mAreadlyConnectedList.size() > 0) {
try {
Method method = BluetoothDevice.class.getMethod("createBond");
String macAddress = SharedPrefsMgr.getInstance(getContext()).getString("BT_MAC");
int pos = -1;
for (int i = 0; i < mAreadlyConnectedList.size(); i++) {
if (macAddress.equals(mAreadlyConnectedList.get(i).getAddress())) {
pos = i;
}
}
if (mAreadlyConnectedList.size() > pos && (pos >= 0)) {
method.invoke(mAreadlyConnectedList.get(pos));
}
} catch (NoSuchMethodException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
}
}
}

View File

@@ -329,69 +329,42 @@ object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallb
private fun refreshCarState(location: MogoLocation) {
V2XStatusManager.getInstance().location = location
// V2XAiRoadEventMarker.onLocationChanged(location)
// 只有车速大于 5 的时候进行计算
if (location.speed < 5) return
val v2xPolyline = BridgeApi.v2xPolyline()?.mogoPolyline
val isRoadEventPOIShow = BridgeApi.v2xStatus()?.isRoadEventPOIShow ?: false
val isOtherSeekHelpPOIShow = BridgeApi.v2xStatus()?.isOtherSeekHelpPOIShow ?: false
val v2xStatusManager = V2XStatusManager.getInstance()
if (v2xPolyline != null && (isRoadEventPOIShow or isOtherSeekHelpPOIShow) && v2xStatusManager.targetMoGoLatLng != null) { // 取出原有的绘制线的经纬度点
if (v2xPolyline != null && (isRoadEventPOIShow) && v2xStatusManager.targetMoGoLatLng != null) { // 取出原有的绘制线的经纬度点
// 取出原有的绘制线的经纬度点
val pointsOdl: MutableList<MogoLatLng> = v2xPolyline.points // 重新设置第一个坐标,也就是当前车辆位置
// 重新设置第一个坐标,也就是当前车辆位置
pointsOdl[0] = MogoLatLng(location.latitude, location.longitude)
v2xPolyline.points = pointsOdl
//CallerLogger.d("$M_V2X$TAG", "当前地图的缩放比例为:" + zoomLevel);
val zoomLevel: Float = CallerMapUIServiceManager.getMapUIController()?.zoomLevel ?: 0.0f
//CallerLogger.d("$M_V2X$TAG", "当前地图的缩放比例为:" + zoomLevel);
if (zoomLevel > 0 && zoomLevel <= 17 && BridgeApi.v2xStatus()?.isRoadEventWindowShow == false) { // 缩放地图
if (zoomLevel > 0 && zoomLevel <= 17) { // 缩放地图
val context: Context = context()
MapUtils.zoomMap(v2xStatusManager.targetMoGoLatLng, context)
}
}
// if (DebugConfig.isMapBased()) { // 只有自研车机才有疲劳驾驶检测
// // 只有自研车机才有疲劳驾驶检测
// if (DebugConfig.getCarMachineType() == DebugConfig.CAR_MACHINE_TYPE_SELF_INNOVATE) {
// V2XAlarmServer.getFatigueDrivingShow(location) { drivingShowEntity ->
// CallerLogger.i("$M_V2X$TAG", "疲劳驾驶POI查询结果为: " + GsonUtil.jsonFromObject(drivingShowEntity))
// val style = if (V2XServiceManager.getMoGoStatusManager().isMainPageOnResume()) "1" else "2"
// com.mogo.module.v2x.listener.V2XLocationListener.trackWithType(ALERT_FATIGUE_DRIVING.poiType, drivingShowEntity.getLon(), drivingShowEntity.getLat(), style)
// val v2XMessageEntity = V2XMessageEntity<V2XPushMessageEntity>()
// v2XMessageEntity.type = V2XTypeEnum.ALERT_FATIGUE_DRIVING
// v2XMessageEntity.setContent(drivingShowEntity)
// v2XMessageEntity.isShowState = drivingShowEntity.isShowWindow() // 广播给ADAS Launcher
// ADASUtils.broadcastToADAS(context(), drivingShowEntity)
// V2XScenarioManager.getInstance().handlerMessage(v2XMessageEntity)
// }
// }
// }
// 巡航处理
val v2XRoadEventEntity = V2XAlarmServer.getDriveFrontAlarmEvent(
BridgeApi.v2xMarker()?.v2XRoadEventEntityList,
V2XStatusManager.getInstance().location
) // 距离是否大于10米 && 消息是否不为空
// 距离是否大于10米 && 消息是否不为空
if (v2XRoadEventEntity != null && v2XRoadEventEntity.distance >= 5) { // CallerLogger.w("$M_V2X$TAG",
// //"\nV2X预警--当前导航状态:" + V2XServiceManager.getNavi().isNaviing() +
// //"\nV2X预警--roadEventIsNullCount:" + roadEventIsNullCount +
// "\nV2X预警--当前预警事件:" + v2XRoadEventEntity
// );
// CallerLogger.w("$M_V2X$TAG", "V2X预警--前方数据距离:" + v2XRoadEventEntity.getDistance());
// 触发展示操作
TrackUtils.trackV2xRoadProduceEvent(1)
val v2XMessageEntity = V2XMessageEntity<V2XRoadEventEntity>()
v2XMessageEntity.type = V2XTypeEnum.ALERT_ROAD_WARNING
v2XMessageEntity.content = v2XRoadEventEntity
v2XMessageEntity.isShowState = true
V2XScenarioManager.getInstance().handlerMessage(v2XMessageEntity)
// 存储本地,出行动态作展示
saveLocalStory(V2XTypeEnum.ALERT_ROAD_WARNING, v2XRoadEventEntity.noveltyInfo)
)
if (v2XRoadEventEntity != null) { // CallerLogger.w("$M_V2X$TAG",
val distance = v2XRoadEventEntity.distance
val min = if (EventTypeEnum.AI_ROAD_WORK.poiType == v2XRoadEventEntity.poiType) 0 else 5
Logger.d(TAG, "--- trigger show before ---:data=>[${location.longitude}, ${location.latitude}, ${location.speed}], distance: $distance, minDistance: $min, poiType: ${v2XRoadEventEntity.poiType}")
if (distance >= min) {
Logger.d(TAG, "--- trigger show ---:poiType:" + v2XRoadEventEntity.poiType)
TrackUtils.trackV2xRoadProduceEvent(1)
val v2XMessageEntity = V2XMessageEntity<V2XRoadEventEntity>()
v2XMessageEntity.type = V2XTypeEnum.ALERT_ROAD_WARNING
v2XMessageEntity.content = v2XRoadEventEntity
v2XMessageEntity.isShowState = true
V2XScenarioManager.getInstance().handlerMessage(v2XMessageEntity)
}
}
}
@@ -507,11 +480,6 @@ object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallb
private fun handleRoadMarkerEvent(data: V2XMarkerCardResult) {
try {
BridgeApi.v2xStatus()?.let {
if (it.isRoadEventWindowShow) {
return
}
}
scope.launch(Dispatchers.Default) {
BridgeApi.v2xMarker()?.analysisV2XRoadEvent(data)
}

View File

@@ -1,18 +1,13 @@
package com.mogo.eagle.core.function.v2x.events.alarm;
import android.text.TextUtils;
import com.mogo.eagle.core.data.map.MogoLocation;
import com.mogo.eagle.core.function.v2x.events.utils.DrivingDirectionUtils;
import com.mogo.eagle.core.utilcode.constant.TimeConstants;
import com.mogo.eagle.core.utilcode.util.TimeUtils;
import com.mogo.module.common.entity.MarkerExploreWay;
import com.mogo.module.common.entity.MarkerLocation;
import com.mogo.module.common.entity.V2XRoadEventEntity;
import com.mogo.module.common.enums.EventTypeEnum;
import java.util.HashMap;
import java.util.concurrent.ConcurrentHashMap;
import java.util.Iterator;
import java.util.concurrent.CopyOnWriteArrayList;
import io.netty.util.internal.ConcurrentSet;
/**
* @author donghongyu
@@ -29,11 +24,7 @@ import java.util.concurrent.CopyOnWriteArrayList;
public class V2XAlarmServer {
// 记录道路播报的事件
public static ConcurrentHashMap<V2XRoadEventEntity, String> mAlertRoadEventList = new ConcurrentHashMap<>();
// 记录违章停车播报事件
private static final HashMap<MarkerExploreWay, String> mAlertIllegalParkEventList = new HashMap<>();
private static ConcurrentSet<V2XRoadEventEntity> showedEvents = new ConcurrentSet<>();
/**
* 获取当前车辆前方距离最近的道路事件
*/
@@ -41,9 +32,22 @@ public class V2XAlarmServer {
CopyOnWriteArrayList<V2XRoadEventEntity> v2XRoadEventEntityList,
MogoLocation currentLocation) {
try {
// 检测道路事件是否需UGC问答
V2XEarlyWarningServer.roadEventUgcCheck(currentLocation);
// 60(km/h)
if (!showedEvents.isEmpty()) {
Iterator<V2XRoadEventEntity> iterator = showedEvents.iterator();
while (iterator.hasNext()) {
V2XRoadEventEntity next = iterator.next();
if (next == null) {
continue;
}
MarkerLocation poiLocation = next.getLocation();
if (poiLocation == null) {
continue;
}
if (isOutOfRange(poiLocation.getLon(), poiLocation.getLat(), currentLocation.getLongitude(), currentLocation.getLatitude(), currentLocation.getBearing())) {
iterator.remove();
}
}
}
if (currentLocation != null && v2XRoadEventEntityList != null) {
// 因为集合是按照距离排序后的所以这里检索出来第一个就发出警告
for (V2XRoadEventEntity v2XRoadEventEntity : v2XRoadEventEntityList) {
@@ -73,71 +77,14 @@ public class V2XAlarmServer {
(int) currentLocation.getBearing()
);
if (0 <= eventAngle && eventAngle <= 20) {
// 判断是否已经提示过道路事件
boolean isAlreadyAlert = false;
String lastTime = mAlertRoadEventList.get(v2XRoadEventEntity);
if (!TextUtils.isEmpty(lastTime)) {
long timeSpan = Math.abs(TimeUtils.getTimeSpanByNow(lastTime, TimeConstants.MIN));
// CallerLogger.INSTANCE.w(M_V2X + "V2XAlarmServer",
// "V2X预警--事件ID" + v2XRoadEventEntity.getNoveltyInfo().getInfoId() +
// "\n上一次预警时间" + lastTime +
// "\n距离当前时间" + timeSpan);
// 5分钟内不重复提醒
if (timeSpan < 5) {
isAlreadyAlert = true;
}
if (showedEvents.contains(v2XRoadEventEntity)) {
return null;
}
// 进行提醒
if (!isAlreadyAlert) {
// CallerLogger.INSTANCE.w(M_V2X + "V2XAlarmServer", "V2X预警--车辆与事件信息:" +
// "\n事件详情ID" + v2XRoadEventEntity.getNoveltyInfo().getInfoId() +
// "\n事件详情" + GsonUtil.jsonFromObject(v2XRoadEventEntity.getNoveltyInfo()) +
// "\n距离" + v2XRoadEventEntity.getDistance() + "米" +
// "\n是否已经提醒" + isAlreadyAlert +
// "\n当前车辆-经度:" + currentLocation.getLongitude() +
// "\n当前车辆-经度:" + currentLocation.getLatitude() +
// "\n当前车辆-角度:" + currentLocation.getBearing() +
// "\n道路事件-经度:" + eventLocation.getLon() +
// "\n道路事件-经度:" + eventLocation.getLat() +
// "\n道路事件-角度:" + eventLocation.getAngle() +
// "\n夹角角度" + eventAngle + " 度"
// );
mAlertRoadEventList.put(v2XRoadEventEntity, TimeUtils.getNowString());
return v2XRoadEventEntity;
}
return null;
} else {
// CallerLogger.INSTANCE.w(M_V2X + "V2XAlarmServer", "V2X预警--事件与车头角度夹角过大:" +
// "\n事件详情" + v2XRoadEventEntity.getNoveltyInfo().getInfoId() +
// "\n当前车辆-经度:" + currentLocation.getLongitude() +
// "\n当前车辆-经度:" + currentLocation.getLatitude() +
// "\n当前车辆-角度:" + currentLocation.getBearing() +
// "\n道路事件-经度:" + eventLocation.getLon() +
// "\n道路事件-经度:" + eventLocation.getLat() +
// "\n道路事件-角度:" + eventLocation.getAngle() +
// "\n夹角角度" + eventAngle + " 度"
// );
showedEvents.add(v2XRoadEventEntity);
return v2XRoadEventEntity;
}
} else {
// CallerLogger.INSTANCE.w(M_V2X + "V2XAlarmServer",
// "V2X预警--车头方向与事件方向角度不一致:" +
// "\n事件详情" + v2XRoadEventEntity.getNoveltyInfo().getInfoId() +
// "\n车头方向 " + carBearing +
// "\n事件方向" + eventBearing +
// "\n角度差值" + diffAngle
// );
}
} else {
// CallerLogger.INSTANCE.w(M_V2X + "V2XAlarmServer", "V2X预警--车辆距离事件距离大于500米了" +
// "\n事件详情" + v2XRoadEventEntity.getNoveltyInfo().getInfoId() +
// "\n距离" + v2XRoadEventEntity.getDistance() + "米"
// );
}
} else {
// CallerLogger.INSTANCE.e(M_V2X + "V2XAlarmServer",
// "V2X预警--道路事件没有角度信息" +
// "\n事件详情" + v2XRoadEventEntity.getNoveltyInfo().getInfoId()
// );
}
}
}
@@ -147,4 +94,14 @@ public class V2XAlarmServer {
return null;
}
private static boolean isOutOfRange(double poi_lon, double poi_lat, double car_lon, double car_lat, double car_angle) {
return !isFrontOfCar(poi_lon, poi_lat, car_lon, car_lat, car_angle);
}
private static boolean isFrontOfCar(double poi_lon, double poi_lat, double car_lon, double car_lat, double car_angle) {
double degree = DrivingDirectionUtils.getDegreeOfCar2Poi(car_lon, car_lat, poi_lon, poi_lat, (int)car_angle);
return degree <= 90;
}
}

View File

@@ -1,101 +0,0 @@
package com.mogo.eagle.core.function.v2x.events.alarm;
import android.content.Intent;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import com.mogo.eagle.core.function.v2x.events.consts.V2XConst;
import com.mogo.eagle.core.function.v2x.events.utils.DrivingDirectionUtils;
import com.mogo.eagle.core.utilcode.util.Utils;
import com.mogo.eagle.core.data.map.MogoLocation;
import com.mogo.module.common.entity.MarkerLocation;
import com.mogo.module.common.entity.V2XMessageEntity;
import com.mogo.module.common.entity.V2XRoadEventEntity;
import com.mogo.module.common.enums.EventTypeEnum;
import java.util.ArrayList;
import java.util.Set;
/**
* V2X 道路预警服务
*/
public class V2XEarlyWarningServer {
private static final String TAG = "V2XEarlyWarningServer";
private static ArrayList<String> alertMessageId = new ArrayList<>();
/**
* 对提醒过的道路事件进行UGC检测
*
* @param currentLocation 当前车辆位置
*/
public static void roadEventUgcCheck(MogoLocation currentLocation) {
try {
if (currentLocation != null) {
// 循环已经播报的道路事件将刚行驶过的道路事件进行弹窗交互进行UGC问答
Set<V2XRoadEventEntity> keySet = V2XAlarmServer.mAlertRoadEventList.keySet();
for (V2XRoadEventEntity v2XRoadEventEntity : keySet) {
// 计算车辆距离指定气泡的距离
MarkerLocation eventLocation = v2XRoadEventEntity.getLocation();
double eventAngle = DrivingDirectionUtils.getDegreeOfCar2Poi(
currentLocation.getLongitude(),
currentLocation.getLatitude(),
eventLocation.getLon(),
eventLocation.getLat(),
(int) currentLocation.getBearing()
);
double carBearing = currentLocation.getBearing();
String roadInfoId = v2XRoadEventEntity.getNoveltyInfo().getInfoId();
// 封路、施工、拥堵、拥堵 才会有UGC提示
if (EventTypeEnum.isNeedRoadEventUgc(v2XRoadEventEntity.getPoiType())) {
// CallerLogger.INSTANCE.d(M_V2X + TAG,
// "V2X预警--UGC检测" +
// "\n事件详情" + roadInfoId +
// "\n事件详情" + EventTypeUtils.getPoiTypeStr(v2XRoadEventEntity.getPoiType()) +
// "\n车头方向 " + carBearing +
// "\n车与事件夹角" + eventAngle +
// "\n已经UGC的事件" + GsonUtil.jsonFromObject(alertMessageId)
// );
// 判断是否预警过了
if (!alertMessageId.contains(roadInfoId)) {
// 判断车辆行驶角度是否与事件相反,相反的话表示已经行驶过去了
if (80 <= eventAngle) {
// CallerLogger.INSTANCE.d(M_V2X + TAG, "V2X预警UGC--事件与车头角度夹角过大:" +
// "\n角度" + eventAngle + " 度" +
// "\n事件详情" + roadInfoId +
// "\n库存事件" + V2XAlarmServer.mAlertRoadEventList.size()
// );
// 记录已经 UGC 提醒过的数据
alertMessageId.add(roadInfoId);
// 加载数据源
V2XMessageEntity<V2XRoadEventEntity> v2xMessageEntity = new V2XMessageEntity<>();
// 控制类型
v2xMessageEntity.setType(V2XMessageEntity.V2XTypeEnum.ALERT_EVENT_UGC_WARNING);
// 设置数据
v2xMessageEntity.setContent(v2XRoadEventEntity);
// 控制展示状态
v2xMessageEntity.setShowState(true);
// 弹出UGC
Intent intent = new Intent(V2XConst.BROADCAST_SCENE_HANDLER_ACTION);
intent.putExtra(V2XConst.BROADCAST_SCENE_EXTRA_KEY, v2xMessageEntity);
LocalBroadcastManager.getInstance(Utils.getApp()).sendBroadcast(intent);
}
// 移出已经预警的事件列表
//V2XAlarmServer.mAlertRoadEventList.remove(v2XRoadEventEntity);
}
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
}

View File

@@ -15,26 +15,6 @@ public interface IMoGoV2XStatusManager extends IProvider {
*/
boolean isRoadEventPOIShow();
/**
* 按钮区 V2X道路预警 是否在展示
*/
boolean isRoadEventButtonShow();
/**
* 头部 V2X道路预警 UI 是否在展示
*/
boolean isRoadEventWindowShow();
/**
* 头部 他人车辆故障求助 UI 是否在展示
*/
boolean isOtherSeekHelpWindowShow();
/**
* 地图区域 他人车辆故障求助POI 是否在展示
*/
boolean isOtherSeekHelpPOIShow();
/**
* 设置 V2X道路预警POI 是否在展示
*
@@ -43,67 +23,6 @@ public interface IMoGoV2XStatusManager extends IProvider {
*/
void setRoadEventPOIShow(String tag, boolean show);
/**
* 设置 V2X道路预警 是否在展示
*
* @param tag
* @param show
*/
void setRoadEventButtonShow(String tag, boolean show);
/**
* 设置 右侧2/3 头部 V2X道路预警 是否在展示
*
* @param tag
* @param show
*/
void setRoadEventWindowShow(String tag, boolean show);
/**
* 设置 右侧2/3 头部 V2X的道路直播 是否在展示
*
* @param tag
* @param show
*/
void setRoadLiveCarWindowShow(String tag, boolean show);
/**
* 设置 他人车辆故障求助 UI 是否在展示
*
* @param tag
* @param show
*/
void setOtherSeekHelpWindowShow(String tag, boolean show);
/**
* 设置 右侧2/3 全屏 V2X 场景动画 是否在展示
*
* @param tag
* @param show
*/
void setV2XAnimationWindowShow(String tag, boolean show);
/*
* 道路事件图片/视频资源 全屏
* */
void setV2XRoadVideoWindowShow(String tag, boolean show);
/**
* 设置 模拟直播车机 UI 是否在展示
*
* @param tag
* @param show
*/
void setLiveCarWindowShow(String tag, boolean show);
/**
* 推送弹窗的状态
*
* @param tag
* @param show
*/
void setPushWindowShow(String tag, boolean show);
/**
* 地图区域 推送的 POI 是否在展示
*
@@ -112,11 +31,4 @@ public interface IMoGoV2XStatusManager extends IProvider {
*/
void setPushPOIShow(String tag, boolean show);
/**
* 地图区域 疲劳驾驶 是否在展示
*
* @param tag
* @param show
*/
void setFatigueDrivingWindowShow(String tag, boolean show);
}

View File

@@ -63,7 +63,6 @@ public class MoGoV2XMarkerManager implements IMoGoV2XMarkerManager {
private static final CopyOnWriteArraySet<V2XRoadEventEntity> mV2XRoadEventEntityArrayList = new CopyOnWriteArraySet<>();
// 上次的道路事件的预警Marker
private static IMogoMarker mAlarmInfoMarker;
private static IMogoMarker m3DMarker;
@Override
public void drawableLastAllPOI() {
@@ -81,7 +80,6 @@ public class MoGoV2XMarkerManager implements IMoGoV2XMarkerManager {
CopyOnWriteArrayList<V2XRoadEventEntity> roadEventEntities = new CopyOnWriteArrayList<>();
// 当前车辆数据
MogoLocation currentLocation = V2XStatusManager.getInstance().getLocation();
if (currentLocation != null) {
// 重新计算距离
for (V2XRoadEventEntity v2XRoadEventEntity : mV2XRoadEventEntityArrayList) {
@@ -96,7 +94,6 @@ public class MoGoV2XMarkerManager implements IMoGoV2XMarkerManager {
}
roadEventEntities.add(v2XRoadEventEntity);
}
// 按照与当前车辆距离排序
for (int i = 0; i < roadEventEntities.size(); i++) {
for (int j = i; j > 0; j--) {
@@ -107,37 +104,17 @@ public class MoGoV2XMarkerManager implements IMoGoV2XMarkerManager {
}
}
}
//输出日志查看结果
// for (int i = 0; i < roadEventEntities.size(); i++) {
// CallerLogger.INSTANCE.w(M_V2X + TAG, "V2X===" +
// "事件名称:" + roadEventEntities.get(i).getNoveltyInfo() +
// "\t 事件距离:" + roadEventEntities.get(i).getDistance());
// }
}
return roadEventEntities;
}
@Override
public void analysisV2XRoadEvent(V2XMarkerCardResult markerCardResult) {
boolean isShowEventWindow = false;
boolean isShowEventButton = false;
boolean isOtherSeekHelpWindowShow = false;
IMoGoV2XStatusManager v2xStatus = BridgeApi.INSTANCE.v2xStatus();
if (v2xStatus != null) {
//预警Window状态
isShowEventWindow = v2xStatus.isRoadEventWindowShow();
//预警按钮状态
isShowEventButton = v2xStatus.isRoadEventButtonShow();
//道路求助的window
isOtherSeekHelpWindowShow = v2xStatus.isOtherSeekHelpWindowShow();
}
try {
//当没有预警提示的时候重新绘制地图POI点
if (markerCardResult != null && !isShowEventWindow && !isShowEventButton && !isOtherSeekHelpWindowShow) {
if (markerCardResult != null) {
// 清除上次的道路事件, 这里注意,道路事件的触发和这里是异步操作会触发异常
mV2XRoadEventEntityArrayList.clear();
// 获取探路以及新鲜事儿
List<V2XMarkerExploreWay> exploreWayList = markerCardResult.getExploreWay();
if (exploreWayList != null) {
@@ -149,7 +126,6 @@ public class MoGoV2XMarkerManager implements IMoGoV2XMarkerManager {
v2XRoadEventEntity.setLocation(EntityUtilsKt.toMarkerLocation(markerLocation));
// 探路目前只有上报拥堵
String poi = markerExploreWay.getPoiType();
v2XRoadEventEntity.setPoiType(poi);
v2XRoadEventEntity.setNoveltyInfo(EntityUtilsKt.toMarkExploreWay(markerExploreWay,markerCardResult.getExtras()));
v2XRoadEventEntity.setExpireTime(20000);

View File

@@ -11,7 +11,6 @@ import com.mogo.eagle.core.function.v2x.events.manager.IMoGoV2XStatusManager;
import com.mogo.eagle.core.function.v2x.events.manager.V2XStatusDescriptor;
import com.mogo.service.statusmanager.IMogoStatusManager;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
@@ -53,26 +52,6 @@ public class MoGoV2XStatusManager implements IMoGoV2XStatusManager {
return get_bool_val(V2XStatusDescriptor.RoadEventPOI_UI);
}
@Override
public boolean isRoadEventButtonShow() {
return get_bool_val(V2XStatusDescriptor.RoadEventButton_UI);
}
@Override
public boolean isRoadEventWindowShow() {
return get_bool_val(V2XStatusDescriptor.RoadEventWindow_UI);
}
@Override
public boolean isOtherSeekHelpWindowShow() {
return get_bool_val(V2XStatusDescriptor.OtherSeekHelpWindow_UI);
}
@Override
public boolean isOtherSeekHelpPOIShow() {
return get_bool_val(V2XStatusDescriptor.OtherSeekHelpPOI_UI);
}
@Override
public void setRoadEventPOIShow(String tag, boolean show) {
IMogoStatusManager statusManager = BridgeApi.INSTANCE.statusManager();
@@ -84,62 +63,6 @@ public class MoGoV2XStatusManager implements IMoGoV2XStatusManager {
recordStatusModifier(tag, V2XStatusDescriptor.RoadEventPOI_UI);
}
@Override
public void setRoadEventButtonShow(String tag, boolean show) {
mStatus.put(V2XStatusDescriptor.RoadEventButton_UI, show);
invokeStatusChangedListener(V2XStatusDescriptor.RoadEventButton_UI, show);
recordStatusModifier(tag, V2XStatusDescriptor.RoadEventButton_UI);
}
@Override
public void setRoadEventWindowShow(String tag, boolean show) {
mStatus.put(V2XStatusDescriptor.RoadEventWindow_UI, show);
invokeStatusChangedListener(V2XStatusDescriptor.RoadEventWindow_UI, show);
recordStatusModifier(tag, V2XStatusDescriptor.RoadEventWindow_UI);
}
@Override
public void setRoadLiveCarWindowShow(String tag, boolean show) {
mStatus.put(V2XStatusDescriptor.RoadLiveCarWindow_UI, show);
invokeStatusChangedListener(V2XStatusDescriptor.RoadLiveCarWindow_UI, show);
recordStatusModifier(tag, V2XStatusDescriptor.RoadLiveCarWindow_UI);
}
@Override
public void setOtherSeekHelpWindowShow(String tag, boolean show) {
mStatus.put(V2XStatusDescriptor.OtherSeekHelpWindow_UI, show);
invokeStatusChangedListener(V2XStatusDescriptor.OtherSeekHelpWindow_UI, show);
recordStatusModifier(tag, V2XStatusDescriptor.OtherSeekHelpWindow_UI);
}
@Override
public void setV2XAnimationWindowShow(String tag, boolean show) {
mStatus.put(V2XStatusDescriptor.V2XAnimationWindow_UI, show);
invokeStatusChangedListener(V2XStatusDescriptor.V2XAnimationWindow_UI, show);
recordStatusModifier(tag, V2XStatusDescriptor.V2XAnimationWindow_UI);
}
@Override
public void setV2XRoadVideoWindowShow(String tag, boolean show) {
mStatus.put(V2XStatusDescriptor.V2XAnimationWindow_UI, show);
invokeStatusChangedListener(V2XStatusDescriptor.V2XRoadVideo_UI, show);
recordStatusModifier(tag, V2XStatusDescriptor.V2XRoadVideo_UI);
}
@Override
public void setLiveCarWindowShow(String tag, boolean show) {
mStatus.put(V2XStatusDescriptor.LiveCarWindow_UI, show);
invokeStatusChangedListener(V2XStatusDescriptor.LiveCarWindow_UI, show);
recordStatusModifier(tag, V2XStatusDescriptor.LiveCarWindow_UI);
}
@Override
public void setPushWindowShow(String tag, boolean show) {
mStatus.put(V2XStatusDescriptor.PushWindow_UI, show);
invokeStatusChangedListener(V2XStatusDescriptor.PushWindow_UI, show);
recordStatusModifier(tag, V2XStatusDescriptor.PushWindow_UI);
}
@Override
public void setPushPOIShow(String tag, boolean show) {
@@ -148,14 +71,7 @@ public class MoGoV2XStatusManager implements IMoGoV2XStatusManager {
recordStatusModifier(tag, V2XStatusDescriptor.PushWindowPOI_UI);
}
@Override
public void setFatigueDrivingWindowShow(String tag, boolean show) {
mStatus.put(V2XStatusDescriptor.FatigueDrivingWindow_UI, show);
invokeStatusChangedListener(V2XStatusDescriptor.FatigueDrivingWindow_UI, show);
recordStatusModifier(tag, V2XStatusDescriptor.FatigueDrivingWindow_UI);
}
/**
/**
* 调用所有存储的监听
*
* @param descriptor

View File

@@ -58,10 +58,10 @@ object AiRoadMarker {
}
private val checkExpiredTask = Runnable {
val marker = this@AiRoadMarker.marker.get()
if (marker != null) {
unMarker(marker)
}
// val marker = this@AiRoadMarker.marker.get()
// if (marker != null) {
// unMarker(marker)
// }
}
private val onClearAllMarker = object : OnClearAllMarker {

View File

@@ -1,5 +1,6 @@
package com.mogo.eagle.core.function.v2x.events.scenario.scene.road
import android.graphics.*
import android.util.*
import com.mogo.cloud.commons.utils.*
import com.mogo.eagle.core.data.map.*
@@ -14,6 +15,7 @@ import com.mogo.module.common.utils.*
import java.util.*
import java.util.concurrent.atomic.*
import kotlin.Pair
import kotlin.collections.ArrayList
object V2XAiRoadEventMarker {
@@ -29,6 +31,8 @@ object V2XAiRoadEventMarker {
private val distance = AtomicInteger(0)
private val overlayManager by lazy { MogoOverlayManager.getInstance() }
fun drawMarkers(entity: V2XRoadEventEntity): Pair<IMogoPolyline?, List<IMogoMarker>?>? {
removeMarkers(current.get())
timerTask.get()?.cancel()
@@ -69,7 +73,32 @@ object V2XAiRoadEventMarker {
v2xMarker()?.drawableAlarmPOI(context(), entity, null)
val l2 = entity.noveltyInfo?.location ?: return null
v2xLocation.set(MogoLocation().also { it.longitude = l2.lon; it.latitude = l2.lat; it.bearing = l2.angle.toFloat() })
current.set(Pair(null, markers))
val options = MogoPolylineOptions()
val colors = ArrayList<Int>()
colors.add(Color.argb(204, 237, 172, 21))
colors.add(Color.argb(0, 255, 255, 255))
options.colorValues(colors)
val points = ArrayList<MogoLatLng>()
for (p in polygons) {
points.add(MogoLatLng(p.second, p.first))
}
if (points.size > 2) {
points.add(points[0])
}
options.points(points);
options.useGradient(true)
options.useFacade(true)
options.setGps(false)
options.width(5f)
options.zIndex(75000f)
options.maxIndex(800000f)
val line = overlayManager.addPolyline(options)
current.set(Pair(line, markers))
if (line != null) {
line.isVisible = true
}
}
}
}

View File

@@ -0,0 +1,8 @@
package com.mogo.eagle.core.data.badcase
/**
* @author XuXinChao
* @description BadCase录制模板实体类
* @since: 2022/10/25
*/
data class RecordTypeEntity(var id: Int,var desc: String,var topicsList:ArrayList<String>)

View File

@@ -264,12 +264,17 @@ interface IMoGoAutopilotProvider : IMoGoFunctionServerProvider {
fun sendOperatorSetHorn(value: Double)
/**
* 行程信息
* @param type 事件类型, 1:行程开始, 2:行程结束, 3:出站, 4:进站, 5:城市占道施工预警
* @param lineName 路线名, for type 1, 2
* @param stopName 站点名, for type 3, 4
* @param isLastStop 是否是最后一站
* @return
* 发生行程相关
* type=1或2的时 需要参数 lineName
* type=3或4的时 需要参数 lineName departureStopName arrivalStopName isLastStop
* type=5时 不需要任何参数
*
* @param type 事件类型, 1:行程开始, 2:行程结束, 3:出站, 4:进站, 5:城市占道施工预警
* @param lineName 路线名
* @param departureStopName 出站站点名
* @param arrivalStopName 下一站到达站点名
* @param isLastStop 是否最终站
* @return boolean
*/
fun sendTripInfo(type: Int, lineName: String, stopName: String, isLastStop: Boolean)
fun sendTripInfo(type: Int, lineName: String, departureStopName: String,arrivalStopName: String, isLastStop: Boolean)
}

View File

@@ -259,10 +259,12 @@ object CallerAutoPilotManager {
* @param recordType 0:不需要修改内置类型的topic组合, 1:需要修改内置类型的topic组合
* @param topicsNeedToCache
*/
fun getBadCaseConfig(reqType: Int,recordType: Int,topicsNeedToCache: List<String>){
fun getBadCaseConfig(reqType: Int,recordType: Int,topicsNeedToCache: List<String>): Boolean?{
// 司机屏才能查询数据采集的配置
if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {
providerApi?.getBadCaseConfig(reqType, recordType, topicsNeedToCache)
return providerApi?.getBadCaseConfig(reqType, recordType, topicsNeedToCache)
}else{
return false
}
}
@@ -295,15 +297,20 @@ object CallerAutoPilotManager {
}
/**
* 行程信息
* @param type 事件类型, 1:行程开始, 2:行程结束, 3:出站, 4:进站, 5:城市占道施工预警
* @param lineName 路线名, for type 1, 2
* @param stopName 站点名, for type 3, 4
* @param isLastStop 是否终点站
* @return
* 发生行程相关
* type=1或2的时 需要参数 lineName
* type=3或4的时 需要参数 lineName departureStopName arrivalStopName isLastStop
* type=5时 不需要任何参数
*
* @param type 事件类型, 1:行程开始, 2:行程结束, 3:出站, 4:进站, 5:城市占道施工预警
* @param lineName 路线名
* @param departureStopName 出站站点名
* @param arrivalStopName 下一站到达站点名
* @param isLastStop 是否最终站
* @return boolean
*/
fun sendTripInfo(type: Int, lineName: String, stopName: String, isLastStop: Boolean) {
providerApi?.sendTripInfo(type, lineName, stopName, isLastStop)
fun sendTripInfo(type: Int, lineName: String, departureStopName: String, arrivalStopName: String, isLastStop: Boolean) {
providerApi?.sendTripInfo(type, lineName, departureStopName, arrivalStopName, isLastStop)
}
/**

View File

@@ -489,9 +489,10 @@ message SetParamReq
message TripInfoEvent
{
uint32 type = 1; //事件类型, 1:行程开始, 2:行程结束, 3:出站, 4:进站, 5:城市占道施工预警
string lineName = 2; //路线名, for type 1, 2
string stopName = 3; //站点名, for type 3, 4
bool isLastStop = 4; //是否最终站, for type 3, 4
string lineName = 2; //路线名
string departureStopName = 3; //出站站点名
string arrivalStopName = 4; //下一站到达站点名
bool isLastStop = 5; //下一站到达站是否最终站
}

View File

@@ -14,7 +14,6 @@ import static com.zhidao.support.adas.high.chain.AdasChain.CHAIN_LINK_LOG_WEB_SO
import android.os.SystemClock;
import android.text.TextUtils;
import android.util.Log;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
@@ -302,7 +301,6 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec
if (mSocket == null || bytes == null || bytes.length <= 0) {
return false;
}
Log.d("liyz", "sendWsMessag bytes = " + bytes); //TODO
ByteString byteString = ByteString.of(bytes);
if (!byteString.startsWith(Constants.RAW_MG)) {
CupidLogUtils.e(TAG, "协议不匹配,命令下发失败 bytes=" + ByteUtil.byteArrToHex(bytes));
@@ -1265,22 +1263,35 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec
}
/**
* 发生行程相关
* type=1或2的时 需要参数 lineName
* type=3或4的时 需要参数 lineName departureStopName arrivalStopName isLastStop
* type=5时 不需要任何参数
*
* @param type 事件类型, 1:行程开始, 2:行程结束, 3:出站, 4:进站, 5:城市占道施工预警
* @param lineName 路线名, for type 1, 2
* @param stopName 站点名, for type 3, 4
* @param isLastStop
* @return
* @param type 事件类型, 1:行程开始, 2:行程结束, 3:出站, 4:进站, 5:城市占道施工预警
* @param lineName 路线名
* @param departureStopName 出站站点名
* @param arrivalStopName 下一站到达站点名
* @param isLastStop 是否最终站
* @return boolean
*/
@Override
public boolean sendTripInfoReq(int type, String lineName, String stopName, boolean isLastStop) {
MessagePad.TripInfoEvent req = MessagePad.TripInfoEvent
public boolean sendTripInfoReq(int type, String lineName, String departureStopName, String arrivalStopName, boolean isLastStop) {
MessagePad.TripInfoEvent.Builder builder = MessagePad.TripInfoEvent
.newBuilder()
.setType(type)
.setLineName(lineName)
.setStopName(stopName)
.setIsLastStop(isLastStop)
.build();
.setType(type);
if (type < 5) {
if (lineName != null)
builder.setLineName(lineName);
if (type == 3 || type == 4) {
if (departureStopName != null)
builder.setDepartureStopName(departureStopName);
if (arrivalStopName != null)
builder.setArrivalStopName(arrivalStopName);
builder.setIsLastStop(isLastStop);
}
}
MessagePad.TripInfoEvent req = builder.build();
return sendPBMessage(MessageType.TYPE_SEND_TRIP_INFO_REQ.typeCode, req.toByteArray());
}

View File

@@ -654,16 +654,21 @@ public class AdasManager implements IAdasNetCommApi {
}
/**
* 行程信息
* @param type 事件类型, 1:行程开始, 2:行程结束, 3:出站, 4:进站, 5:城市占道施工预警
* @param lineName 路线名, for type 1, 2
* @param stopName 站点名, for type 3, 4
* @param isLastStop 是否终点站
* @return
* 发生行程相关
* type=1或2的时 需要参数 lineName
* type=3或4的时 需要参数 lineName departureStopName arrivalStopName isLastStop
* type=5时 不需要任何参数
*
* @param type 事件类型, 1:行程开始, 2:行程结束, 3:出站, 4:进站, 5:城市占道施工预警
* @param lineName 路线名
* @param departureStopName 出站站点名
* @param arrivalStopName 下一站到达站点名
* @param isLastStop 是否最终站
* @return boolean
*/
@Override
public boolean sendTripInfoReq(int type, String lineName, String stopName, boolean isLastStop) {
return mChannel != null && mChannel.sendTripInfoReq(type,lineName,stopName,isLastStop);
public boolean sendTripInfoReq(int type, String lineName, String departureStopName, String arrivalStopName, boolean isLastStop) {
return mChannel != null && mChannel.sendTripInfoReq(type, lineName, departureStopName, arrivalStopName, isLastStop);
}
/**

View File

@@ -382,13 +382,18 @@ public interface IAdasNetCommApi {
/**
* 发生行程相关
* type=1或2的时 需要参数 lineName
* type=3或4的时 需要参数 lineName departureStopName arrivalStopName isLastStop
* type=5时 不需要任何参数
*
* @param type 事件类型, 1:行程开始, 2:行程结束, 3:出站, 4:进站, 5:城市占道施工预警
* @param lineName 路线名, for type 1, 2
* @param stopName 站点名, for type 3, 4
* @return boolean 是否最终站, for type 3, 4
* @param type 事件类型, 1:行程开始, 2:行程结束, 3:出站, 4:进站, 5:城市占道施工预警
* @param lineName 路线名
* @param departureStopName 出站站点名
* @param arrivalStopName 下一站到达站点名
* @param isLastStop 是否最终站
* @return boolean
*/
boolean sendTripInfoReq(int type, String lineName, String stopName, boolean isLastStop);
boolean sendTripInfoReq(int type, String lineName, String departureStopName, String arrivalStopName, boolean isLastStop);
// TODO 需求暂停 待讨论

View File

@@ -13,6 +13,8 @@ import system_master.SystemStatusInfo;
/**
* 是否可以启动自动驾驶能力检测
* 目前监控了底盘的一些状态和查询节点状态应答的数据
* 没有使用监控事件报告的原因是因为,部分异常没进行正常恢复通知,例如收到了异常监控数据,但是异常恢复之后没有恢复的通知
*/
public class AutopilotAbilityManager {
private static final String TAG = AutopilotAbilityManager.class.getSimpleName();

View File

@@ -2,7 +2,7 @@ package com.zhidao.support.adas.high.common;
/**
* 监控事件报告中定义的事件以及解释
* 根据260消息定义编写
* 根据290消息定义编写
*/
public class MogoReport {
private static final String RESULT_AUTOPILOT_SYSTEM_UNSTARTED = "RESULT_AUTOPILOT_SYSTEM_UNSTARTED";
@@ -190,6 +190,20 @@ public class MogoReport {
String EXIT_AUTOPILOT_FOR_LOCATION = "EMAP_EXIT_AUTOPILOT_FOR_LOCATION";//因location掉帧强退自动驾驶
String EXIT_AUTOPILOT_FOR_CHASSIS = "EMAP_EXIT_AUTOPILOT_FOR_CHASSIS";//因底盘消息掉帧强退自动驾驶
String EXIT_AUTOPILOT_FOR_DISTANCE = "EMAP_EXIT_AUTOPILOT_FOR_DISTANCE";//因planning起点距离当前过远强退自动驾驶
String EXIT_AUTOPILOT_FOR_BRAKE = "EMAP_EXIT_AUTOPILOT_FOR_BRAKE";//制动踏板干预而强退自动驾驶
String EXIT_AUTOPILOT_FOR_ACCEL = "EMAP_EXIT_AUTOPILOT_FOR_ACCEL";//加速踏板干预而强退自动驾驶
String EXIT_AUTOPILOT_FOR_STEER = "EMAP_EXIT_AUTOPILOT_FOR_STEER";//方向盘干预而强退自动驾驶
String EXIT_AUTOPILOT_FOR_GEAR_SWITCH = "EMAP_EXIT_AUTOPILOT_FOR_GEAR_SWITCH";//档位切换干预而强退自动驾驶
String EXIT_AUTOPILOT_FOR_CHASSIS_NO_RESPONSE = "EMAP_EXIT_AUTOPILOT_FOR_CHASSIS_NO_RESPONSE";//底盘不响应请求而强退自动驾驶
String EXIT_AUTOPILOT_FOR_CHASSIS_UNKNOWN = "EMAP_EXIT_AUTOPILOT_FOR_CHASSIS_UNKNOWN";//底盘退出原因未知而强退自动驾驶
String ENTRY_AUTOPILOT_FOR_CANADAPTER_TIMEOUT = "EMAP_ENTRY_AUTOPILOT_FOR_CANADAPTER_TIMEOUT";//can_adapter消息超时未进入自驾
String ENTRY_AUTOPILOT_FOR_PLANNING_TIMEOUT = "EMAP_ENTRY_AUTOPILOT_FOR_PLANNING_TIMEOUT";//PLANNING消息超时未进自驾
String ENTRY_AUTOPILOT_FOR_LOCATION_TIMEOUT = "EMAP_ENTRY_AUTOPILOT_FOR_LOCATION_TIMEOUT";//定位消息超时未进自驾
String ENTRY_AUTOPILOT_FOR_BRAKE = "EMAP_ENTRY_AUTOPILOT_FOR_BRAKE";//制动踏板干预未进自驾
String ENTRY_AUTOPILOT_FOR_ACCEL = "EMAP_ENTRY_AUTOPILOT_FOR_ACCEL";//加速踏板干预未进自驾
String ENTRY_AUTOPILOT_FOR_STEER = "EMAP_ENTRY_AUTOPILOT_FOR_STEER";//方向盘干预未进自驾
String ENTRY_AUTOPILOT_FOR_GEAR_SWITCH = "EMAP_ENTRY_AUTOPILOT_FOR_GEAR_SWITCH";//档位切换干预未进自驾
String ENTRY_AUTOPILOT_FOR_OTHER_CTL = "EMAP_ENTRY_AUTOPILOT_FOR_OTHER_CTL";//其他干预未进自驾,请检查仪表盘和开关项(如双闪,制动灯灯等 可在msg中补充原因信息
String HADMAP_ENGINE_NO_ROUTING_INFO = "EMAP_HADMAP_ENGINE_NO_ROUTING_INFO";//hadmap_engine算路失败或未找到轨迹文件导致的轨迹文件信息未发布
String HADMAP_NO_TRAJECTORY = "EMAP_HADMAP_NO_TRAJECTORY";//hadmap未发布全局路径
String HADMAP_PLANNING_NO_TRAJECTORY = "EMAP_HADMAP_PLANNING_NO_TRAJECTORY";//local_planning未发布局部轨迹
@@ -213,6 +227,7 @@ public class MogoReport {
String STEER_INFERENCE = "EVHC_STEER_INFERENCE";//由于方向盘干预退出自动驾驶或无法进入自动驾驶
String ACCEL_INFERENCE = "EVHC_ACCEL_INFERENCE";//由于油门干预退出自动驾驶或无法进入自动驾驶
String CSS = "EVHC_CSS";//底盘不允许进入自动驾驶
String GEAR = "EVHC_GEAR";//档位不是D或N档
}
/**
@@ -226,13 +241,15 @@ public class MogoReport {
String NOT_ALLOW_AUTOPILOT_FOR_REMOTE = "ESYS_NOT_ALLOW_AUTOPILOT_FOR_REMOTE";//系统处于远程驾驶中,拒绝进入自动驾驶
String NOT_ALLOW_REBOOT = "ESYS_NOT_ALLOW_REBOOT";//重启拒绝
String TOPIC_FREQ_DROPED = "ESYS_TOPIC_FREQ_DROPED";//存在topic严重掉频
String AUTOPILOT_TAKEN_OVER_BY_REMOTE = "ESYS_AUTOPILOT_TAKEN_OVER_BY_REMOTE";//自动驾驶被远程驾驶接管
@Deprecated
String RTK_STATUS_FAULT = "ESYS_RTK_STATUS_FAULT";//RTK状态持续错误
String AUTOPILOT_TAKEN_OVER_BY_REMOTE = "ESYS_AUTOPILOT_TAKEN_OVER_BY_REMOTE";//自动驾驶被远程驾驶接管
String ROUTING_REQ_TIMEOUT = "ESYS_ROUTING_REQ_TIMEOUT";//自动驾驶开始前routing请求无响应
String PLANNING_CHANGE_FAILIED = "ESYS_PLANNING_CHANGE_FAILIED";//planning版本切换启动失败
String CHECK_TRAJECTORY_FAILURE = "ESYS_CHECK_TRAJECTORY_FAILURE";//轨迹文件检查超时或检查结果无可用轨迹
String FAULT = "ESYS_FAULT";//master启动10分钟仍有agent未连接
String REBOOT_WARNING = "ESYS_REBOOT_WARNING";//命令重启不完全提示(部分模块没有关闭成功)
String CAN_MSG_LOST = "ESYS_CAN_MSG_LOST";//master接收底盘消息超时
}
interface EAGENT {
@@ -246,6 +263,7 @@ public class MogoReport {
interface ECAM {
String INIT = "ECAM_INIT";//相机初始化失败
String CALIB = "ECAM_CALIB";//标定信息读取失败
String GRAB_FATAL = "ECAM_GRAB_FATAL";//相机数据采集异常
}
/**
@@ -281,7 +299,7 @@ public class MogoReport {
String TRA_LOADED = "IMAP_TRA_LOADED";//轨迹文件加载成功
String TRA_ROUTING = "IMAP_TRA_ROUTING";//算路成功
String TRA_TYPE = "IMAP_TRA_TYPE";//加载轨迹类型通知
String ENTRY_AUTOPILOT = "IMAP_ENTRY_AUTOPILOT";//控制进入自动驾驶成功
}
/**
@@ -311,14 +329,16 @@ public class MogoReport {
String CAN_NORMAL = "ISYS_CAN_NORMAL";//底盘状态正常或恢复正常
String REOMTEPILOT_STARTING = "ISYS_REOMTEPILOT_STARTING";//平行驾驶启动中
String REOMTEPILOT_RUNING = "ISYS_REOMTEPILOT_RUNING";//平行驾驶运行中
String SYSTEM_IN_IDLE = "ISYS_SYSTEM_IN_IDLE";//系统进入空闲状态
String SYSTEM_OUT_IDLE = "ISYS_SYSTEM_OUT_IDLE";//系统退出空闲状态
String INIT_TRAJECTORY_START = "ISYS_INIT_TRAJECTORY_START";//轨迹管理_轨迹开始下载
String INIT_TRAJECTORY_SUCCESS = "ISYS_INIT_TRAJECTORY_SUCCESS";//轨迹管理_轨迹下载成功
String INIT_TRAJECTORY_FAILURE = "ISYS_INIT_TRAJECTORY_FAILURE";//轨迹管理_轨迹下载失败本地无对应轨迹
String INIT_TRAJECTORY_WARNING = "ISYS_INIT_TRAJECTORY_WARNING";//轨迹管理_轨迹下载失败本地有对应轨迹认为成功
String INIT_TRAJECTORY_TIMEOUT = "ISYS_INIT_TRAJECTORY_TIMEOUT";//轨迹管理_轨迹下载超时
String SYSTEM_IN_IDLE = "ISYS_SYSTEM_IN_IDLE";//系统进入空闲状态
String SYSTEM_OUT_IDLE = "ISYS_SYSTEM_OUT_IDLE";//系统退出空闲状态
String CONFIG_UPDATE_HADMAP = "ISYS_CONFIG_UPDATE_HADMAP";//高精地图:需要重启升级高精地图
String CONFIG_UPDATE_HADMAP = "ISYS_CONFIG_UPDATE_HADMAP";//需要重启升级高精地图
String CONFIG_UPDATE_AI_MODEL = "ISYS_CONFIG_UPDATE_AI_MODEL";//需要重启升级AI模型
String CONFIG_UPDATE_SLAM_MAP = "ISYS_CONFIG_UPDATE_SLAM_MAP";//需要重启升级SLAM地图
}
interface IAGENT {