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

This commit is contained in:
wangmingjun
2022-10-21 14:51:42 +08:00
44 changed files with 1309 additions and 106 deletions

View File

@@ -59,6 +59,7 @@ import com.mogo.och.common.module.utils.DateTimeUtil;
import com.mogo.och.common.module.utils.NumberFormatUtil;
import com.mogo.och.common.module.utils.PinYinUtil;
import com.mogo.och.common.module.utils.SoundPoolHelper;
import com.mogo.och.common.module.utils.ToastUtilsOch;
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
import com.mogo.service.statusmanager.StatusDescriptor;
@@ -606,10 +607,14 @@ public class BusOrderModel {
@Override
public void onFail(String failMsg) {
if (!NetworkUtils.isConnected(mContext)) {
ToastUtils.showShort("网络异常,请稍后重试");
}else {
ToastUtils.showShort(failMsg);
isArrivedStation = false;
isGoingToNextStation = true;
if (ToastUtilsOch.isCustomFastClick(5000)){
if (!NetworkUtils.isConnected(mContext)) {
ToastUtils.showShort("网络异常,请稍后重试");
}else {
ToastUtils.showShort(failMsg);
}
}
}
});

View File

@@ -4,6 +4,11 @@ import com.mogo.commons.debug.DebugConfig;
import com.mogo.eagle.core.utilcode.util.ToastUtils;
public class ToastUtilsOch {
private static long lastClickTime;
// 两次点击按钮之间的点击间隔不能少于1000毫秒
private static int MIN_CLICK_DELAY_TIME = 1000;
public static void showWithCodeMessage(int code,String message){
if(message==null){
return;
@@ -14,4 +19,15 @@ public class ToastUtilsOch {
ToastUtils.showShort(message);
}
}
public static boolean isCustomFastClick(int customCLickDelayTime) {
MIN_CLICK_DELAY_TIME = customCLickDelayTime;
boolean flag = false;
long curClickTime = System.currentTimeMillis();
if ((curClickTime - lastClickTime) >= MIN_CLICK_DELAY_TIME) {
flag = true;
}
lastClickTime = curClickTime;
return flag;
}
}

View File

@@ -11,6 +11,7 @@ import android.widget.RelativeLayout;
import android.widget.TextView;
import com.elegant.utils.UiThreadHandler;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.utilcode.util.OverlayViewUtils;
import com.mogo.eagle.core.utilcode.util.ToastUtils;
@@ -159,6 +160,7 @@ public class TaxiPassengerStartAutopilotView extends RelativeLayout implements V
}
public void updateStartAutopilotBtnStatus(boolean isClickable){
if (mContext == null) return;
if (isClickable){
mStartAutopilotBtn.setTextColor(
mContext.getResources().getColor(R.color.taxi_p_start_autopilot_txt_color));
@@ -259,6 +261,7 @@ public class TaxiPassengerStartAutopilotView extends RelativeLayout implements V
}
private void updateStatusCountDownOver() {
if (mContext == null) return;
isStarting = false;
startingCarBgAnimatorDrawable(false);
mStartAutopilotBtn.setText(
@@ -273,4 +276,14 @@ public class TaxiPassengerStartAutopilotView extends RelativeLayout implements V
mContext = null;
super.onDetachedFromWindow();
}
@Override
protected void onAttachedToWindow() {
super.onAttachedToWindow();
try {
mContext = AbsMogoApplication.getApp();
}catch (Exception e){
e.printStackTrace();
}
}
}

View File

@@ -101,6 +101,7 @@ import java.net.NetworkInterface;
import java.net.SocketException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.Enumeration;
import java.util.List;
@@ -647,6 +648,11 @@ public class MainActivity extends BaseActivity implements OnAdasListener, OnAdas
titleBtnData.add(Constants.TITLE.SEND_SET_DEMO_MODE_REQ_CLOSE);
titleBtnData.add(Constants.TITLE.SEND_SET_RAIN_MODE_REQ_OPEN);
titleBtnData.add(Constants.TITLE.SEND_SET_RAIN_MODE_REQ_CLOSE);
titleBtnData.add(Constants.TITLE.SEND_DETOURING_OPEN);
titleBtnData.add(Constants.TITLE.SEND_DETOURING_CLOSE);
titleBtnData.add(Constants.TITLE.SEND_DETOURING_SPEED);
titleBtnData.add(Constants.TITLE.SEND_TRIP_INFO);
}
private void initBtnRecyclerView() {
@@ -1186,7 +1192,7 @@ public class MainActivity extends BaseActivity implements OnAdasListener, OnAdas
msg = "未连接司机端";
}
showToastCenter(msg);
return;
// return;
}
switch (data) {
case Constants.TITLE.SEND_SET_AUTOPILOT_MODE_REQ:
@@ -1345,12 +1351,100 @@ public class MainActivity extends BaseActivity implements OnAdasListener, OnAdas
AdasManager.getInstance().sendRainModeReq(0);
break;
case Constants.TITLE.SEND_RECORD_DATA_CONFIG_RESP:
//关闭雨天模式
AdasManager.getInstance().sendRecordDataConfigReq();
//数据采集配置
showRecordDataConfigRespDialog();
break;
case Constants.TITLE.SEND_DETOURING_OPEN:
//绕障类功能开
AdasManager.getInstance().sendDetouring(1);
break;
case Constants.TITLE.SEND_DETOURING_CLOSE:
//绕障类功能关
AdasManager.getInstance().sendDetouring(0);
break;
case Constants.TITLE.SEND_DETOURING_SPEED:
//绕障速度设置
showDetouringSpeedDialog();
break;
case Constants.TITLE.SEND_TRIP_INFO:
//行程信息
AdasManager.getInstance().sendTripInfoReq(1, "", "", false);
break;
}
}
private void showDetouringSpeedDialog() {
AlertDialog.Builder builder1 = new AlertDialog.Builder(this);
builder1.setTitle("绕障速度");
View view1 = getLayoutInflater().inflate(R.layout.dialog_detouring_speed, null);
final EditText et1 = (EditText) view1.findViewById(R.id.et);
builder1.setView(view1);//
builder1.setCancelable(false);//
builder1.setPositiveButton("设置", null);
//设置反面按钮,并做事件处理
builder1.setNegativeButton("取消", null);
AlertDialog alertDialog1 = builder1.show();//显示Dialog对话框
alertDialog1.getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Editable editable = et1.getText();
if (TextUtils.isEmpty(editable)) {
// 条件不成立不能关闭 AlertDialog 窗口
Toast.makeText(MainActivity.this, "请输入速度", Toast.LENGTH_SHORT).show();
return;
}
String temp = et1.getText().toString().trim();
double speed = Double.parseDouble(temp);
AdasManager.getInstance().sendDetouringSpeed(speed);
alertDialog1.dismiss();
}
});
}
private void showRecordDataConfigRespDialog() {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle(Constants.TITLE.SEND_RECORD_DATA_CONFIG_RESP);
View view = getLayoutInflater().inflate(R.layout.dialog_record_data_config_resp, null);
final EditText reqTypeView = view.findViewById(R.id.reqType);
final EditText recordTypeView = view.findViewById(R.id.recordType);
final EditText topicsNeedToCacheView = view.findViewById(R.id.topicsNeedToCache);
builder.setView(view);//
builder.setCancelable(false);//
builder.setPositiveButton("发送", null);
//设置反面按钮,并做事件处理
builder.setNegativeButton("取消", null);
AlertDialog alertDialog = builder.show();//显示Dialog对话框
alertDialog.getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Editable editable = reqTypeView.getText();
if (TextUtils.isEmpty(editable)) {
// 条件不成立不能关闭 AlertDialog 窗口
Toast.makeText(MainActivity.this, "请输入ReqType", Toast.LENGTH_SHORT).show();
return;
}
int reqType = Integer.parseInt(editable.toString().trim());
editable = recordTypeView.getText();
if (TextUtils.isEmpty(editable)) {
Toast.makeText(MainActivity.this, "请输入RecordType", Toast.LENGTH_SHORT).show();
return;
}
int recordType = Integer.parseInt(editable.toString().trim());
List<String> topicsNeedToCache = null;
editable = topicsNeedToCacheView.getText();
if (!TextUtils.isEmpty(editable)) {
String cache = editable.toString().trim();
cache = cache.replace(",", " ").replace("", " ");
String[] caches = cache.split(" ");
topicsNeedToCache = Arrays.asList(caches);
}
AdasManager.getInstance().sendRecordDataConfigReq(reqType, recordType, topicsNeedToCache);
alertDialog.dismiss();
}
});
}
@Override
protected void handleMessage(Message msg) {

View File

@@ -187,6 +187,10 @@ public class Constants {
String SEND_SET_RAIN_MODE_REQ_OPEN = "打开雨天模式";
String SEND_SET_RAIN_MODE_REQ_CLOSE = "关闭雨天模式";
String SEND_RECORD_DATA_CONFIG_RESP = "数据采集配置";
String SEND_DETOURING_OPEN = "绕障类功能开";
String SEND_DETOURING_CLOSE = "绕障类功能关";
String SEND_DETOURING_SPEED = "绕障速度阈值";
String SEND_TRIP_INFO = "行程信息";
}

View File

@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_gravity="center">
<EditText
android:id="@+id/et"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:digits="0123456789."
android:gravity="center"
android:hint="变道绕障的目标障碍物速度阈值"
android:imeOptions="flagNoExtractUi"
android:inputType="number"
android:maxLength="10"
android:maxLines="1"
android:minWidth="100dp"
android:textColor="#000"
android:textSize="16sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="5dp"
android:text="m/s"
android:textColor="#000"
android:textSize="16sp" />
</LinearLayout>

View File

@@ -0,0 +1,93 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.2"
android:gravity="right"
android:text="ReqType"
android:textColor="#000000" />
<EditText
android:id="@+id/reqType"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:hint="0: all,1:获取当前所有topic列表,2:配置需要预加载的topic组合"
android:imeOptions="actionNext"
android:inputType="number"
android:maxLines="1"
android:minWidth="100dp"
android:textColor="#000"
android:textSize="15sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.2"
android:gravity="right"
android:text="RecordType"
android:textColor="#000000" />
<EditText
android:id="@+id/recordType"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:hint="0:不需要修改内置类型的topic组合, 1:需要修改内置类型的topic组合"
android:imeOptions="actionNext"
android:inputType="number"
android:maxLines="1"
android:minWidth="100dp"
android:textColor="#000"
android:textSize="15sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.2"
android:gravity="right"
android:textSize="8sp"
android:text="TopicsNeedToCache"
android:textColor="#000000" />
<EditText
android:id="@+id/topicsNeedToCache"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:hint="逗号间隔"
android:imeOptions="actionNext"
android:inputType="text"
android:maxLines="1"
android:minWidth="100dp"
android:textColor="#000"
android:textSize="15sp" />
</LinearLayout>
</LinearLayout>

View File

@@ -379,6 +379,16 @@ class MoGoAutopilotProvider :
return AdasManager.getInstance().startRecordPackage(id, duration, type, bduration)
}
override fun recordPackage(
type: Int,
id: Int,
duration: Int,
bduration: Int,
topics: List<String>
): Boolean {
return AdasManager.getInstance().startRecordPackage(id, duration, type, bduration, topics)
}
override fun stopRecord(type: Int, id: Int): Boolean {
return AdasManager.getInstance().stopRecordPackage(id, type)
}
@@ -497,17 +507,43 @@ class MoGoAutopilotProvider :
}
/**
* 获取数据采集录制模式配置列表
* 绕障类功能开关
* isEnable = true 开启
* isEnable = false 关闭
* @return boolean
*/
override fun getBadCaseConfig() {
AdasManager.getInstance().sendRecordDataConfigReq()
override fun sendDetouring(isEnable: Boolean): Boolean {
return if(isEnable){
AdasManager.getInstance().sendDetouring(1)
}else{
AdasManager.getInstance().sendDetouring(0)
}
}
/**
* 变道绕障的目标障碍物速度阈值
* @param speed 速度阈值 m/s
* @return boolean
*/
override fun sendDetouringSpeed(speed: Double): Boolean {
return AdasManager.getInstance().sendDetouringSpeed(speed)
}
/**
* 获取数据采集录制模式配置列表
* @param reqType 0: all, 1:获取当前所有topic列表, 2:配置需要预加载的topic组合
* @param recordType 0:不需要修改内置类型的topic组合, 1:需要修改内置类型的topic组合
* @param topicsNeedToCache
* @return boolean
*/
override fun getBadCaseConfig(reqType: Int,recordType: Int,topicsNeedToCache: List<String>): Boolean{
return AdasManager.getInstance().sendRecordDataConfigReq(reqType, recordType, topicsNeedToCache)
}
/**
* 向左变道
*/
override fun sendOperatorChangeLaneLeft() {
// Log.d("liyz", "MoGoAutopilotProvider sendOperatorChangeLaneLeft -------> ")
AdasManager.getInstance().sendOperatorCmdChangeLaneLeft()
}
@@ -515,7 +551,6 @@ class MoGoAutopilotProvider :
* 向右变道
*/
override fun sendOperatorChangeLaneRight() {
// Log.d("liyz", "MoGoAutopilotProvider sendOperatorChangeLaneRight -------> ")
AdasManager.getInstance().sendOperatorCmdChangeLaneRight()
}
@@ -523,7 +558,6 @@ class MoGoAutopilotProvider :
* 发送设置加速度 acc>0加速 acc<0减速 acc=0复位
*/
override fun sendOperatorSetAcceleratedSpeed(cc: Double) {
// Log.d("liyz", "MoGoAutopilotProvider sendOperatorSetAcceleratedSpeed cc $cc ")
AdasManager.getInstance().sendOperatorCmdSetAcceleratedSpeed(cc)
}
@@ -531,10 +565,21 @@ class MoGoAutopilotProvider :
* 鸣笛 value 1: honk 2: stop honking
*/
override fun sendOperatorSetHorn(value: Double) {
// Log.d("liyz", "MoGoAutopilotProvider sendOperatorSetHorn value $value ")
AdasManager.getInstance().sendOperatorCmdSetHorn(value)
}
/**
* 行程信息
* @param type 事件类型, 1:行程开始, 2:行程结束, 3:出站, 4:进站, 5:城市占道施工预警
* @param lineName 路线名, for type 1, 2
* @param stopName 站点名, for type 3, 4
* @param isLastStop
* @return
*/
override fun sendTripInfo(type: Int, lineName: String, stopName: String, isLastStop: Boolean) {
AdasManager.getInstance().sendTripInfoReq(type, lineName, stopName, isLastStop)
}
/**
* 发送工控机所有节点重启命令
*/

View File

@@ -46,6 +46,7 @@ import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotPlanningAction
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotPlanningListenerManager.invokeAutopilotRotting
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotPlanningListenerManager.invokeAutopilotTrajectory
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotPointCloudListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotRecordListenerManager.invokeAutopilotRecordConfig
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotRecordListenerManager.invokeAutopilotRecordResult
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotVehicleStateListenerManager
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
@@ -409,7 +410,9 @@ class MoGoAdasListenerImpl : OnAdasListener {
header: MessagePad.Header?,
config: MessagePad.RecordDataConfig?
) {
if(config!=null){
invokeAutopilotRecordConfig(config)
}
}
/**

View File

@@ -22,8 +22,8 @@ public interface BindingcarApiService {
* @return {@link BindingcarInfo}
*/
@Headers("Content-Type:application/json;charset=UTF-8")
@POST("pad/selectPadByMac")
Observable<BindingcarInfo> getBindingcarInfo(@Header("access_token") String access_token, @Body RequestBody requestBody);
@POST("eagleEye-mis/cmdbapi/pad/selectPadByMac")
Observable<BindingcarInfo> getBindingcarInfo(/*@Header("access_token") String access_token,*/ @Body RequestBody requestBody);
/**
* 绑定和修改绑定车机
@@ -31,7 +31,7 @@ public interface BindingcarApiService {
* @return {@link ModifyBindingcarInfo}
*/
@Headers("Content-Type:application/json;charset=UTF-8")
@POST("pad/updatePadByMac")
Observable<ModifyBindingcarInfo> modifyBindingcarInfo(@Header("access_token") String access_token, @Body RequestBody requestBody);
@POST("eagleEye-mis/cmdbapi/pad/updatePadByMac")
Observable<ModifyBindingcarInfo> modifyBindingcarInfo(/*@Header("access_token") String access_token,*/ @Body RequestBody requestBody);
}

View File

@@ -6,6 +6,7 @@ import android.util.Log;
import com.mogo.commons.constants.SharedPrefsConstants;
import com.mogo.eagle.core.data.bindingcar.BindingcarInfo;
import com.mogo.eagle.core.data.bindingcar.ModifyBindingcarInfo;
import com.mogo.eagle.core.function.BindHostConst;
import com.mogo.eagle.core.function.api.bindingcar.BindingcarCallBack;
import com.mogo.eagle.core.function.bindingcar.R;
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager;
@@ -34,11 +35,10 @@ import okhttp3.RequestBody;
public class BindingcarNetWorkManager {
private static volatile BindingcarNetWorkManager requestNoticeManager;
private final BindingcarApiService mBindingcarApiService;
private String token = "c4a2f30cebf64972bcd11577e1c07f86"; //中台做了接口适配需要这个token
private static final String TAG = "BindingcarNetWorkManager";
private static final String TAG = "BindingcarNetManager";
private BindingcarNetWorkManager() {
mBindingcarApiService = MoGoRetrofitFactory.getInstance(HostConst.BINDING_SN_HOST)
mBindingcarApiService = MoGoRetrofitFactory.getInstance(BindHostConst.getBaseUrl())
.create(BindingcarApiService.class);
}
@@ -60,11 +60,13 @@ public class BindingcarNetWorkManager {
* @param macAddress mac地址
*/
public void getBindingcarInfo(Context context, String macAddress, String widevineIDWithMd5, int screenType) {
// String macAddress = "48:b0:2d:3a:bc:78";
// String macAddress1 = "48:b0:2d:3a:bc:78";
// String macAddress1 = "48:b0:2d:4d:b9:63";
// String sn = "X20202203105S688HZ";
BindingcarRequest request = new BindingcarRequest(macAddress, widevineIDWithMd5, screenType);
RequestBody requestBody = RequestBody.create(MediaType.get("application/json;charset=UTF-8"), GsonUtil.jsonFromObject(request));
mBindingcarApiService.getBindingcarInfo(token, requestBody)
mBindingcarApiService.getBindingcarInfo(requestBody)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Observer<BindingcarInfo>() {
@@ -76,6 +78,7 @@ public class BindingcarNetWorkManager {
public void onNext(@NonNull BindingcarInfo info) {
if (info != null && info.getData() != null) {
CallerLogger.INSTANCE.d(TAG, "getBindingcarInfo onNext info.getData() =" + info.getData().toString());
Log.d(TAG, "getBindingcarInfo onNext info.getData() =" + info.getData().toString());
if (info.getData().getCompare().equals("0")) {
CallerHmiManager.INSTANCE.showBindingcarDialog();
} else if (info.getData().getCompare().equals("3")) {
@@ -84,10 +87,12 @@ public class BindingcarNetWorkManager {
TipToast.shortTip("当前工控机没有入库");
}
//根据车辆类型切换不同的车辆模型
//根据车辆类型切换不同的车辆模型,只针对红旗做处理
// if (info.getData().getVendor().equals("一汽红旗")) { //TODO
// CallerHDMapManager.INSTANCE.changeCurrentIcon(R.raw.xiaobache);
// } else if (info.getData().getVendor().equals("东风")) {
// CallerHDMapManager.INSTANCE.changeCurrentIcon(R.raw.hq_h9);
// }
// else if (info.getData().getVendor().equals("东风汽车集团")) {
// CallerHDMapManager.INSTANCE.changeCurrentIcon(R.raw.chuzuche);
// } else if (info.getData().getVendor().equals("金旅星辰")) {
// CallerHDMapManager.INSTANCE.changeCurrentIcon(R.raw.xiaobache);
@@ -118,7 +123,7 @@ public class BindingcarNetWorkManager {
public void modifyBindingcar(String macAddress, String widevineIDWithMd5, BindingcarCallBack callBack, int screenType) {
BindingcarRequest request = new BindingcarRequest(macAddress, widevineIDWithMd5, screenType);
RequestBody requestBody = RequestBody.create(MediaType.get("application/json;charset=UTF-8"), GsonUtil.jsonFromObject(request));
mBindingcarApiService.modifyBindingcarInfo(token, requestBody)
mBindingcarApiService.modifyBindingcarInfo(requestBody)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Observer<ModifyBindingcarInfo>() {
@@ -130,6 +135,7 @@ public class BindingcarNetWorkManager {
public void onNext(@NonNull ModifyBindingcarInfo info) {
if (info != null) {
callBack.callBackResult(info);
Log.d(TAG, "modifyBindingcar onNext code = " + info.code + "---msg = " + info.msg + "--info.toString() = " + info.toString());
CallerLogger.INSTANCE.d(TAG, "modifyBindingcar onNext code = " + info.code + "---msg = " + info.msg + "--info.toString() = " + info.toString());
}
}

View File

@@ -36,7 +36,6 @@ class DevaToolsProvider : IDevaToolsProvider {
override fun initBiz() {
bizConfigCenter.init(mContext!!)
FuncConfigImpl.init()
traceManager.init(mContext!!)
MogoLogCatchManager.init(mContext!!)
}

View File

@@ -252,8 +252,8 @@ defStyleAttr: Int = 0
override fun onAttachedToWindow() {
super.onAttachedToWindow()
CallerAutopilotRecordListenerManager.addListener(TAG, this)
//获取数据采集录制模式配置列表
CallerAutoPilotManager.getBadCaseConfig()
//获取数据采集录制模式配置列表 TODO
// CallerAutoPilotManager.getBadCaseConfig()
}
override fun onDetachedFromWindow() {

View File

@@ -23,10 +23,7 @@ object FuncConfigImpl {
data: String?
) {
when (type) {
BIZ_BEAUTY_MODE -> FunctionBuildConfig.isDemoMode = state
BIZ_RAIN_MODE -> FunctionBuildConfig.isRainMode = state
BIZ_WARNING_UPLOAD -> FunctionBuildConfig.isReportWarning = state
}
}
}
}
)

View File

@@ -1415,29 +1415,27 @@ class MoGoHmiFragment : MvpFragment<MoGoHmiContract.View?, HmiPresenter?>(),
"EmArrow-1013",
"it code : ${it.code} , state : ${getAutoPilotStatusInfo().state}"
)
if (getAutoPilotStatusInfo().state != STATUS_AUTOPILOT_RUNNING) {
showWarningV2X(
EventTypeEnum.TAKE_OVER_EVENT.poiType,
EventTypeEnum.TAKE_OVER_EVENT.content,
EventTypeEnum.TAKE_OVER_EVENT.tts,
EventTypeEnum.TAKE_OVER_EVENT.poiType,
object : IMoGoWarningStatusListener {
override fun onShow() {
Log.d("EmArrow-1013", "onShow")
takeOver = true
clTakeOverView.visibility = View.VISIBLE
}
showWarningV2X(
EventTypeEnum.TAKE_OVER_EVENT.poiType,
EventTypeEnum.TAKE_OVER_EVENT.content,
EventTypeEnum.TAKE_OVER_EVENT.tts,
EventTypeEnum.TAKE_OVER_EVENT.poiType,
object : IMoGoWarningStatusListener {
override fun onShow() {
Log.d("EmArrow-1013", "onShow")
takeOver = true
clTakeOverView.visibility = View.VISIBLE
}
override fun onDismiss() {
Log.d("EmArrow-1013", "onDismiss")
takeOver = false
clTakeOverView.visibility = View.GONE
}
},
true,
6000L
)
}
override fun onDismiss() {
Log.d("EmArrow-1013", "onDismiss")
takeOver = false
clTakeOverView.visibility = View.GONE
}
},
true,
6000L
)
}
}
}

View File

@@ -9,6 +9,7 @@ import android.graphics.Color
import android.os.Build
import android.text.Html
import android.util.AttributeSet
import android.util.Log
import android.view.LayoutInflater
import android.view.View
import androidx.annotation.RequiresApi
@@ -1857,7 +1858,6 @@ class DebugSettingView @JvmOverloads constructor(
override fun updateBizData(type: String, state: Boolean, lock: Boolean, data: String?) {
when (type) {
BIZ_BEAUTY_MODE -> {
tbIsDemoMode.isClickable = !lock
if(lock){
tbIsDemoMode.background = resources.getDrawable(R.drawable.radio_button_lock_background)
}else{
@@ -1865,7 +1865,6 @@ class DebugSettingView @JvmOverloads constructor(
}
}
BIZ_RAIN_MODE -> {
tbIsRainMode.isClickable = !lock
if(lock){
tbIsRainMode.background = resources.getDrawable(R.drawable.radio_button_lock_background)
}else{
@@ -1873,7 +1872,6 @@ class DebugSettingView @JvmOverloads constructor(
}
}
BIZ_WARNING_UPLOAD -> {
tbReportWarning.isClickable = !lock
if(lock){
tbReportWarning.background = resources.getDrawable(R.drawable.radio_button_lock_background)
}else{
@@ -1882,20 +1880,16 @@ class DebugSettingView @JvmOverloads constructor(
}
BIZ_BAG_RECORD -> {
if (lock) {
btnRecordBag.isClickable = false
btnRecordBag.background = resources.getDrawable(R.drawable.radio_button_lock_background)
} else {
btnRecordBag.isClickable = true
btnRecordBag.requestFocus()
btnRecordBag.background = null
}
}
BIZ_FULL_LOG -> {
if (lock) {
tbLogCatch.isClickable = false
tbLogCatch.background = resources.getDrawable(R.drawable.radio_button_lock_background)
} else {
tbLogCatch.isClickable = true
tbLogCatch.requestFocus()
tbLogCatch.background = null
}

View File

@@ -0,0 +1,159 @@
package com.mogo.eagle.core.function.hmi.ui.setting
import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import android.view.View
import androidx.constraintlayout.widget.ConstraintLayout
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.data.config.HmiBuildConfig
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
import com.mogo.eagle.core.function.call.obu.CallerOBUManager
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
import com.mogo.eagle.core.utilcode.util.ToastUtils
import com.mogo.module.service.routeoverlay.RouteStrategy
import kotlinx.android.synthetic.main.view_sop_setting.view.*
/**
* SOP设置窗口
*/
class SOPSettingView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : ConstraintLayout(context, attrs, defStyleAttr){
init {
LayoutInflater.from(context).inflate(R.layout.view_sop_setting, this, true)
initView()
}
private fun initView() {
//绕障类功能开关
tbObstacleAvoidance.isChecked = FunctionBuildConfig.isDetouring
tbObstacleAvoidance.setOnCheckedChangeListener { _, isChecked ->
CallerAutoPilotManager.sendDetouring(isChecked)
FunctionBuildConfig.isDetouring = isChecked
}
//危险障碍物颜色标记开关
tbMarkingObstacles.setOnCheckedChangeListener { _, isChecked ->
}
//引导线动态效果
tbRouteDynamicEffect.isChecked =
AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode) && !AppIdentityModeUtils.isBus(
FunctionBuildConfig.appIdentityMode
)
tbRouteDynamicEffect.setOnCheckedChangeListener { _, isChecked ->
if (isChecked) {
RouteStrategy.enable(true)
} else {
RouteStrategy.enable(false)
}
}
//红绿灯标识
tbTrafficLight.isChecked = HmiBuildConfig.isShowTrafficLightView
tbTrafficLight.setOnCheckedChangeListener { _, isChecked ->
if(!isChecked){
HmiBuildConfig.isShowTrafficLightView = false
}else{
HmiBuildConfig.isShowTrafficLightView = true
CallerHmiManager.disableWarningTrafficLight()
}
}
//限速标识
tbSpeedLimit.isChecked = HmiBuildConfig.isShowLimitingVelocityView
tbSpeedLimit.setOnCheckedChangeListener { _, isChecked ->
if(isChecked){
HmiBuildConfig.isShowLimitingVelocityView = true
}else{
HmiBuildConfig.isShowLimitingVelocityView = false
CallerHmiManager.disableLimitingVelocity()
}
}
//自车感知到的他车碰撞预警
tbCollisionWarning.setOnCheckedChangeListener { buttonView, isChecked ->
}
// 演示模式,上一次勾选的数据
tbDemoMode.isChecked = FunctionBuildConfig.isDemoMode
// 演示模式
tbDemoMode.setOnCheckedChangeListener { _, isChecked ->
CallerAutoPilotManager.setDemoMode(isChecked)
if (!isChecked) {
//关闭美化模式时,通知工控机
CallerAutoPilotManager.setIPCDemoMode(isChecked)
}
FunctionBuildConfig.isDemoMode = isChecked
}
//只在司机端设置美化模式开关功能
if (AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)) {
tbDemoMode.visibility = View.GONE
}
// 雨天模式,上一次勾选的数据
tbRainMode.isChecked = FunctionBuildConfig.isRainMode
//雨天模式
tbRainMode.setOnCheckedChangeListener { _, isChecked ->
CallerAutoPilotManager.setRainMode(isChecked)
FunctionBuildConfig.isRainMode = isChecked
}
//雨天模式按钮只在司机屏生效,乘客屏不显示
if (AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)) {
tbRainMode.visibility = View.GONE
}
//OBU控制总开关
tbObu.isChecked = CallerOBUManager.isConnected()
tbObu.setOnCheckedChangeListener { _, isChecked ->
if(!isChecked){
if(AppIdentityModeUtils.isTaxi(FunctionBuildConfig.appIdentityMode)){
CallerOBUManager.resetObuIpAddress("192.168.1.199")
}else if(AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode)){
CallerOBUManager.resetObuIpAddress("192.168.8.199")
}
}else{
//断开链接
CallerOBUManager.disConnectObu()
}
}
//变道绕障的目标障碍物速度阈值
tvSpeed.text = "${FunctionBuildConfig.detouringSpeed} m/s"
ivSpeedReduce.setOnClickListener {
if(FunctionBuildConfig.detouringSpeed<=3){
ToastUtils.showShort("阈值小可为3 m/s")
}else{
FunctionBuildConfig.detouringSpeed--
tvSpeed.text = "${FunctionBuildConfig.detouringSpeed} m/s"
}
}
ivSpeedAdd.setOnClickListener {
if(FunctionBuildConfig.detouringSpeed>=7){
ToastUtils.showShort("阈值最大可为7 m/s")
}else{
FunctionBuildConfig.detouringSpeed++
tvSpeed.text = "${FunctionBuildConfig.detouringSpeed} m/s"
}
}
btnSpeedSet.setOnClickListener {
val isSuccess = CallerAutoPilotManager.sendDetouringSpeed(FunctionBuildConfig.detouringSpeed.toDouble())
if(isSuccess == true){
ToastUtils.showShort("变道绕障的目标障碍物速度阈值设置成功")
}else{
ToastUtils.showShort("变道绕障的目标障碍物速度阈值设置失败")
}
}
}
}

View File

@@ -32,18 +32,18 @@ class PerspectiveSwitchView @JvmOverloads constructor(
override fun onClick(v: View?) {
//切换地图的远近视图
if (MogoMapUIController.getInstance().currentMapVisualAngle.isLongSight) {
MogoMarkerManager.getInstance(AbsMogoApplication.getApp())
.visibleAllMarkers()
// MogoMarkerManager.getInstance(AbsMogoApplication.getApp())
// .visibleAllMarkers()
MogoMapUIController.getInstance().changeMapVisualAngle(VisualAngleMode.MODE_MEDIUM_SIGHT, null)
textSwitch.setText(R.string.module_map_model_normal)
} else if (MogoMapUIController.getInstance().currentMapVisualAngle.isMediumSight) {
MogoMarkerManager.getInstance(AbsMogoApplication.getApp())
.inVisibleWithoutMarkers(DataTypes.TYPE_MARKER_ADAS)
// MogoMarkerManager.getInstance(AbsMogoApplication.getApp())
// .inVisibleWithoutMarkers(DataTypes.TYPE_MARKER_ADAS)
MogoMapUIController.getInstance().changeMapVisualAngle(VisualAngleMode.MODE_LONG_SIGHT, null)
textSwitch.setText(R.string.module_map_model_faster)
} else {
MogoMarkerManager.getInstance(AbsMogoApplication.getApp())
.visibleAllMarkers()
// MogoMarkerManager.getInstance(AbsMogoApplication.getApp())
// .visibleAllMarkers()
MogoMapUIController.getInstance().changeMapVisualAngle(VisualAngleMode.MODE_MEDIUM_SIGHT, null)
textSwitch.setText(R.string.module_map_model_normal)
}

View File

@@ -215,7 +215,6 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
if (keyCode == KeyEvent.KEYCODE_VOLUME_UP) { //向上长按 开启自动驾驶
long currentTime = System.currentTimeMillis() / (1000);
long oldTime = SharedPrefsMgr.getInstance(getContext()).getLong("old_time_up", 0);
// Log.d("liyz", "time = " + (currentTime - oldTime));
if (currentTime - oldTime > 6) {
SharedPrefsMgr.getInstance(getContext()).putLong("old_time_up", System.currentTimeMillis() / 1000);
// ToastUtils.showShort("长按 ↑↑↑ 开启自动驾驶");
@@ -456,7 +455,6 @@ 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);
// Log.e("liyz", "showBondedDevice Name:" + device.getName() + " Mac:" + device.getAddress() + "---isConnected = " + isConnected);
mAreadlyConnectedList.add(device);
if (device.getName().equals("JX-05")) { //后面魔戒可能不使用了
SharedPrefsMgr.getInstance(getContext()).putString("BT_MAC", device.getAddress());
@@ -486,7 +484,6 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
* 主动连接最近的一次连接
*/
private void connectBluetooth() {
// Log.d("liyz", "connectBluetooth ----> size() = " + mAreadlyConnectedList.size());
if (mAreadlyConnectedList.size() > 0) {
try {
Method method = BluetoothDevice.class.getMethod("createBond");
@@ -498,7 +495,6 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
}
}
// Log.d("liyz", "connectBluetooth macAddress = " + macAddress + "---pos = " + pos);
if (mAreadlyConnectedList.size() > pos && (pos >= 0)) {
method.invoke(mAreadlyConnectedList.get(pos));
}

View File

@@ -45,13 +45,11 @@ public class BluetoothMonitorReceiver extends BroadcastReceiver {
case BluetoothDevice.ACTION_ACL_CONNECTED:
// Toast.makeText(context, "蓝牙设备已连接", Toast.LENGTH_SHORT).show();
// Log.d("liyz", "蓝牙设备已连接 ----> ");
// SharedPrefsMgr.getInstance(context).putBoolean("BLUETOOTH", true);
break;
case BluetoothDevice.ACTION_ACL_DISCONNECTED:
// SharedPrefsMgr.getInstance(context).putBoolean("BLUETOOTH", false);
// Log.d("liyz", "蓝牙设备已断开 ----> ");
// Toast.makeText(context, "蓝牙设备已断开", Toast.LENGTH_SHORT).show();
EventBus.getDefault().post(new ConnectBluetoothEvent());
break;

Binary file not shown.

After

Width:  |  Height:  |  Size: 387 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 302 B

View File

@@ -0,0 +1,196 @@
<?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="@dimen/dp_800"
android:layout_height="@dimen/dp_1100"
android:background="#FFFFFF">
<!--绕障类功能-->
<ToggleButton
android:id="@+id/tbObstacleAvoidance"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/dp_10"
android:background="@drawable/radio_button_normal_background_right"
android:textColor="#000"
android:textOff="开启绕障类功能"
android:textOn="关闭绕障类功能"
android:textSize="@dimen/dp_24"
app:layout_constraintTop_toTopOf="parent"
/>
<!--危险障碍物颜色标记-->
<ToggleButton
android:id="@+id/tbMarkingObstacles"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/dp_10"
android:background="@drawable/radio_button_normal_background_right"
android:textColor="#000"
android:textOff="开启「危险障碍物颜色标记」"
android:textOn="关闭「危险障碍物颜色标记」"
android:textSize="@dimen/dp_24"
app:layout_constraintTop_toBottomOf="@id/tbObstacleAvoidance"
/>
<!--引导线动态效果-->
<ToggleButton
android:id="@+id/tbRouteDynamicEffect"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/dp_10"
android:background="@drawable/radio_button_normal_background_right"
android:textColor="#000"
android:textOff="开启「引导线动态效果」"
android:textOn="关闭「引导线动态效果」"
android:textSize="@dimen/dp_24"
app:layout_constraintTop_toBottomOf="@id/tbMarkingObstacles"
/>
<!--红绿灯标识-->
<ToggleButton
android:id="@+id/tbTrafficLight"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/dp_10"
android:background="@drawable/radio_button_normal_background_right"
android:textColor="#000"
android:textOff="隐藏红绿灯标识"
android:textOn="展示红绿灯标识"
android:textSize="@dimen/dp_24"
app:layout_constraintTop_toBottomOf="@id/tbRouteDynamicEffect"
/>
<!--限速标识-->
<ToggleButton
android:id="@+id/tbSpeedLimit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/dp_10"
android:background="@drawable/radio_button_normal_background_right"
android:textColor="#000"
android:textOff="展示限速标识"
android:textOn="隐藏限速标识"
android:textSize="@dimen/dp_24"
app:layout_constraintTop_toBottomOf="@id/tbTrafficLight"
/>
<!--自车感知到的他车碰撞预警-->
<ToggleButton
android:id="@+id/tbCollisionWarning"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/dp_10"
android:background="@drawable/radio_button_normal_background_right"
android:textColor="#000"
android:textOff="开启「自车感知到的他车碰撞预警」"
android:textOn="关闭「自车感知到的他车碰撞预警」"
android:textSize="@dimen/dp_24"
app:layout_constraintTop_toBottomOf="@id/tbSpeedLimit"
/>
<ToggleButton
android:id="@+id/tbDemoMode"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/dp_10"
android:background="@drawable/radio_button_normal_background_right"
android:textColor="#000"
android:textOff="开启美化模式"
android:textOn="关闭美化模式"
android:textSize="@dimen/dp_24"
app:layout_constraintTop_toBottomOf="@id/tbCollisionWarning"
/>
<ToggleButton
android:id="@+id/tbRainMode"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/dp_10"
android:background="@drawable/radio_button_normal_background_right"
android:textColor="#000"
android:textOff="开启雨天模式"
android:textOn="关闭雨天模式"
android:textSize="@dimen/dp_24"
app:layout_constraintTop_toBottomOf="@id/tbDemoMode"
/>
<ToggleButton
android:id="@+id/tbObu"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/dp_10"
android:background="@drawable/radio_button_normal_background_right"
android:textColor="#000"
android:textOff="关闭OBU"
android:textOn="开启OBU"
android:textSize="@dimen/dp_24"
app:layout_constraintTop_toBottomOf="@id/tbRainMode"
/>
<TextView
android:id="@+id/tvSpeedThresholdTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="@id/tbObu"
android:text="变道速度阈值:"
android:textSize="18sp"
android:textColor="#1A1A1A"
android:layout_margin="10dp"
/>
<ImageView
android:id="@+id/ivSpeedReduce"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintLeft_toRightOf="@id/tvSpeedThresholdTitle"
app:layout_constraintTop_toTopOf="@id/tvSpeedThresholdTitle"
app:layout_constraintBottom_toBottomOf="@id/tvSpeedThresholdTitle"
android:src="@drawable/icon_reduce"
android:padding="10dp"
/>
<TextView
android:id="@+id/tvSpeed"
android:layout_width="wrap_content"
android:layout_height="0dp"
app:layout_constraintTop_toTopOf="@id/ivSpeedReduce"
app:layout_constraintBottom_toBottomOf="@id/ivSpeedReduce"
app:layout_constraintLeft_toRightOf="@id/ivSpeedReduce"
android:textSize="18sp"
android:gravity="center"
android:background="@drawable/debug_setting_edit_bg"
android:paddingStart="10dp"
android:paddingEnd="10dp"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
/>
<ImageView
android:id="@+id/ivSpeedAdd"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="@id/tvSpeed"
app:layout_constraintBottom_toBottomOf="@id/tvSpeed"
app:layout_constraintLeft_toRightOf="@id/tvSpeed"
android:src="@drawable/icon_add"
android:padding="10dp"
/>
<Button
android:id="@+id/btnSpeedSet"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="@id/ivSpeedAdd"
app:layout_constraintBottom_toBottomOf="@id/ivSpeedAdd"
app:layout_constraintLeft_toRightOf="@id/ivSpeedAdd"
android:text="设置阈值"
android:layout_marginStart="10dp"
/>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_margin="10dp"
android:background="#F0F0F0"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/btnSpeedSet"
/>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -54,5 +54,12 @@ class MoGoObuProvider : IMoGoObuProvider {
}
override fun disConnect() {
MogoPrivateObuManager.INSTANCE.disConnectObu()
}
override fun isConnected(): Boolean {
return MogoPrivateObuManager.INSTANCE.isConnected()
}
}

View File

@@ -77,6 +77,14 @@ class MogoPrivateObuManager private constructor() {
}
}
fun disConnectObu(){
MogoObuManager.getInstance().disConnect()
}
fun isConnected(): Boolean{
return MogoObuManager.getInstance().isConnected
}
private val mogoObuListener: OnMogoObuListener = object : OnMogoObuListener() {
// OBU连接成功
override fun onConnected() {

View File

@@ -483,6 +483,7 @@ object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallb
})
}
AiRoadMarker.receive(Marker(this.roadwork?.center?.point?.lat ?: 0.0, this.roadwork?.center?.point?.lon ?: 0.0, this.roadwork?.center?.road?.bearing?.toDouble() ?: 0.0, null, null, null))
}
// private fun buildRoadEntity(e: V2XMarkerExploreWay, extra: Map<String, Any>? = null): V2XRoadEventEntity { // 记录道路事件

View File

@@ -6,6 +6,7 @@ import android.content.Intent;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import com.mogo.eagle.core.function.v2x.events.scenario.scene.airoad.AiRoadMarker;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi;
import com.mogo.eagle.core.function.v2x.events.consts.V2XConst;
@@ -62,6 +63,7 @@ public class V2XScenarioManager implements IV2XScenarioManager {
Intent intent = new Intent(V2XConst.BROADCAST_SCENE_ACTION);
intent.putExtra(V2XConst.BROADCAST_SCENE_EXTRA_KEY, v2XMessageEntity);
LocalBroadcastManager.getInstance(Utils.getApp()).sendBroadcast(intent);
AiRoadMarker.INSTANCE.clear();
// 如果没有拿到之前的,根据类型分发
switch (v2XMessageEntity.getType()) {
case V2XMessageEntity.V2XTypeEnum.ALERT_ROAD_WARNING:

View File

@@ -3,6 +3,7 @@ package com.mogo.eagle.core.function.v2x.events.scenario.scene.airoad
import android.animation.*
import android.content.*
import android.graphics.*
import android.os.*
import android.view.animation.*
import androidx.core.util.Pair
import androidx.lifecycle.*
@@ -22,6 +23,7 @@ import com.mogo.map.overlay.*
import com.mogo.module.common.entity.*
import com.mogo.module.common.utils.*
import io.netty.util.internal.*
import java.lang.Runnable
import java.util.*
import java.util.concurrent.*
import java.util.concurrent.atomic.*
@@ -49,6 +51,17 @@ object AiRoadMarker {
private val START_COLOR = Color.parseColor("#002ABAD9")
private val END_COLOR = Color.parseColor("#66FF7A30")
private val handler by lazy {
Handler(Looper.getMainLooper())
}
private val checkExpiredTask = Runnable {
val marker = this@AiRoadMarker.marker.get()
if (marker != null) {
unMarker(marker)
}
}
private val markers = ConcurrentSet<Marker>()
private val options by lazy {
@@ -189,6 +202,7 @@ object AiRoadMarker {
fun marker(marker: Marker, drawMarker: Boolean) {
val location = carLocation.get() ?: return
this.marker.set(marker)
//施工中心点前方的自车行驶方向上300米距离
val l1 = MogoMap.getInstance().mogoMap.getCenterLineRangeInfo(marker.poi_lon, marker.poi_lat, location.third.toFloat(), 300f)
//施工中心点后方的自车行驶方向上300米距离
@@ -285,7 +299,7 @@ object AiRoadMarker {
fun clear() {
hideLine()
// V2XAiRoadEventMarker.removeMarkers(null)
V2XAiRoadEventMarker.removeMarkers(null)
}
fun restore() {
@@ -319,6 +333,25 @@ object AiRoadMarker {
return degree < 90
}
fun receive(marker: Marker) {
val cur = this.marker.get()
if (cur == marker) {
val poi = this.marker.get()
val car = this.carLocation.get()
if (poi != null && car != null) {
val distance = DrivingDirectionUtils.distance(car.first, car.second, marker.poi_lon, marker.poi_lat)
if (distance < 300) {
checkExpired()
}
}
}
}
private fun checkExpired() {
handler.removeCallbacks(checkExpiredTask)
handler.postDelayed(checkExpiredTask, 5000)
}
data class Marker(
val poi_lat: Double,
val poi_lon: Double,

View File

@@ -29,6 +29,22 @@ object FunctionBuildConfig {
@JvmField
var isRainMode = false
/**
* 是否开启绕障类功能
* 默认开启
*/
@Volatile
@JvmField
var isDetouring = true
/**
* 变道绕障的目标障碍物速度阈值
* 默认 3 m/s
*/
@Volatile
@JvmField
var detouringSpeed = 3
/**
* 是否是感知优化模式
* 默认开启

View File

@@ -88,6 +88,17 @@ interface IMoGoAutopilotProvider : IMoGoFunctionServerProvider {
*/
fun recordPackage(type: Int,id: Int,duration: Int,bduration: Int): Boolean
/**
* 开启域控制器录制bag包
* @param type 录制类型 1: badcase 2:map 3:rests
* @param id 指令/任务 ID
* @param duration 录制时长
* @param bduration 录制前溯时长
* @param topics 录制Topic集合
* @return true-成功,false-失败
*/
fun recordPackage(type: Int,id: Int,duration: Int,bduration: Int,topics: List<String>): Boolean
/**
* Log 是否显示
*
@@ -152,9 +163,28 @@ interface IMoGoAutopilotProvider : IMoGoFunctionServerProvider {
fun setRainMode(isEnable: Boolean)
/**
* 获取数据采集录制模式配置列表
* 绕障类功能开关
* isEnable = true 开启
* isEnable = false 关闭
* @return boolean
*/
fun getBadCaseConfig()
fun sendDetouring(isEnable: Boolean): Boolean
/**
* 变道绕障的目标障碍物速度阈值
* @param speed 速度阈值 m/s
* @return boolean
*/
fun sendDetouringSpeed(speed: Double): Boolean
/**
* 获取数据采集录制模式配置列表
* @param reqType 0: all, 1:获取当前所有topic列表, 2:配置需要预加载的topic组合
* @param recordType 0:不需要修改内置类型的topic组合, 1:需要修改内置类型的topic组合
* @param topicsNeedToCache
* @return boolean
*/
fun getBadCaseConfig(reqType: Int,recordType: Int,topicsNeedToCache: List<String>): Boolean
/**
* 发送工控机所有节点重启命令
@@ -232,4 +262,14 @@ interface IMoGoAutopilotProvider : IMoGoFunctionServerProvider {
* 鸣笛 开始1结束2
*/
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
*/
fun sendTripInfo(type: Int, lineName: String, stopName: String, isLastStop: Boolean)
}

View File

@@ -11,4 +11,7 @@ interface IMoGoObuProvider : IMoGoFunctionServerProvider {
fun connect(ipAddress: String)
fun disConnect()
fun isConnected(): Boolean
}

View File

@@ -136,6 +136,12 @@ object CallerAutoPilotManager {
}
}
fun recordPackage(type: Int,id: Int,duration: Int,bduration: Int,topics: List<String>){
if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)){
providerApi?.recordPackage(type, id, duration, bduration, topics)
}
}
/**
* 停止录制bag包
*/
@@ -229,12 +235,34 @@ object CallerAutoPilotManager {
}
/**
* 获取数据采集录制模式配置列表
* 绕障类功能开关
* isEnable = true 开启
* isEnable = false 关闭
* @return boolean
*/
fun getBadCaseConfig() {
fun sendDetouring(isEnable: Boolean): Boolean?{
return providerApi?.sendDetouring(isEnable)
}
/**
* 变道绕障的目标障碍物速度阈值
* @param speed 速度阈值 m/s
* @return boolean
*/
fun sendDetouringSpeed(speed: Double): Boolean?{
return providerApi?.sendDetouringSpeed(speed)
}
/**
* 获取数据采集录制模式配置列表
* @param reqType 0: all, 1:获取当前所有topic列表, 2:配置需要预加载的topic组合
* @param recordType 0:不需要修改内置类型的topic组合, 1:需要修改内置类型的topic组合
* @param topicsNeedToCache
*/
fun getBadCaseConfig(reqType: Int,recordType: Int,topicsNeedToCache: List<String>){
// 司机屏才能查询数据采集的配置
if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {
providerApi?.getBadCaseConfig()
providerApi?.getBadCaseConfig(reqType, recordType, topicsNeedToCache)
}
}
@@ -266,6 +294,18 @@ object CallerAutoPilotManager {
providerApi?.sendOperatorSetHorn(value)
}
/**
* 行程信息
* @param type 事件类型, 1:行程开始, 2:行程结束, 3:出站, 4:进站, 5:城市占道施工预警
* @param lineName 路线名, for type 1, 2
* @param stopName 站点名, for type 3, 4
* @param isLastStop 是否终点站
* @return
*/
fun sendTripInfo(type: Int, lineName: String, stopName: String, isLastStop: Boolean) {
providerApi?.sendTripInfo(type, lineName, stopName, isLastStop)
}
/**
* 发送工控机所有节点重启命令
*/

View File

@@ -26,4 +26,19 @@ object CallerOBUManager {
providerApi.connect(ipAddress)
}
/**
* 断开OBU连接
*/
fun disConnectObu(){
providerApi.disConnect()
}
/**
* 获取OBU连接状态
* @return boolean 连接状态
*/
fun isConnected(): Boolean{
return providerApi.isConnected()
}
}

Binary file not shown.

View File

@@ -90,6 +90,17 @@ public class AIAssist {
}
}
/**
* 等级由低到高为0、1、2、3分别对应p3、p2、p1、p0
* @param text
* @param level
*/
public void speakTTSVoiceWithLevel(String text, int level) {
if (mTTS != null) {
mTTS.speakTTSVoiceWithLevel(text, level);
}
}
/**
* 语音播报
*

View File

@@ -85,7 +85,7 @@ MOGO_LOCATION_VERSION=1.4.3.26
MOGO_TELEMATIC_VERSION=1.4.3.26
######## MogoAiCloudSDK Version ########
# 自研地图
MAP_SDK_VERSION=2.5.1.9
MAP_SDK_VERSION=2.6.0.10
MAP_SDK_OPERATION_VERSION=1.1.2.4
# websocket
WEBSOCKET_VERSION=1.1.7

View File

@@ -4,7 +4,7 @@ package mogo.telematics.pad;
enum ProtocolVersion
{
Defaultver = 0;
CurrentVersion = 7; //每次修改proto文件增加1
CurrentVersion = 8; //每次修改proto文件增加1
}
enum MessageType
@@ -50,6 +50,8 @@ enum MessageType
MsgTypeOperatorCmdReq = 0x10116; //操控指令
MsgTypeSubscribeDataReq = 0x10117; //数据订阅、取消订阅请求
MsgTypeSpecialVehicleTaskCmd = 0x10118; //特种车辆命令
MsgTypeSetParamReq = 0x10119; //设置参数命令
MsgTypeTripInfoEvent = 0x1011a; //行程信息
}
message Header
@@ -286,6 +288,7 @@ message RecordData
bool isRecord = 4; //采集指令, true: 采集, false: 停止采集
bool sustain = 5; //是否持续采集
uint32 bduration = 6; //前溯时长
repeated string topics = 7; //topic列表
}
// message definition for MsgTypeRecordResult
@@ -385,7 +388,9 @@ message SetRainModeReq
// message definition for MsgTypeRecordDataConfigReq
message RecordDataConfigReq
{
uint32 reqType = 1; // 0: all, 其他保留
uint32 reqType = 1; // 0: all, 1:获取当前所有topic列表, 2:配置需要预加载的topic组合
uint32 recordType = 2; // 0:不需要修改内置类型的topic组合, 1:需要修改内置类型的topic组合
repeated string topicsNeedToCache = 3;
}
// message definition for MsgTypeRecordDataConfigResp
@@ -393,11 +398,13 @@ message RecordDataType
{
uint32 id = 1; //采集类型id
string desc = 2; //采集类型描述
repeated string topics = 3; //采集类型必须采集的topic列表
}
message RecordDataConfig
{
repeated RecordDataType recordTypes = 1;
repeated string allTopics = 2; //当前所有topic列表
}
// message definition for MsgTypeSubscribeDataReq
@@ -466,3 +473,26 @@ message PlanningActionMsg
//message definition for MsgTypeSpecialVehicleTaskCmd
//refer to special_vehicle_task_cmd.proto for details
//message definition for MsgTypeSetParamReq
message SetOneParam
{
uint32 type = 1; // 0:default 1:绕障类功能开关(bool) 2:变道绕障的目标障碍物速度阈值(double, m/s)
string value = 2; // 转成字符串的值
}
message SetParamReq
{
repeated SetOneParam reqs = 1;
}
//message definition for MsgTypeTripInfoEvent
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
}

View File

@@ -14,6 +14,7 @@ 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;
@@ -46,6 +47,7 @@ import com.zhjt.service.chain.TracingConstants;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.Timer;
@@ -300,6 +302,7 @@ 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));
@@ -362,6 +365,7 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec
CupidLogUtils.i("TimeConsuming", who + " 从接收到解析耗时=" + time + "毫秒");
}
}
//TODO 计算耗时 临时测试
public static void calculateTimeConsumingBusiness(String who, long receiveTime) {
if (CupidLogUtils.isEnableLog()) {
@@ -369,6 +373,7 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec
CupidLogUtils.i("TimeConsuming", who + " 业务处理耗时=" + time + "毫秒");
}
}
/**
* 分发和解析
*
@@ -817,25 +822,39 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec
@Override
public boolean startRecordPackage(int id, int type) {
return sendRecordData(id, 0, type, true, -1);
return sendRecordData(id, 0, type, true, -1, null);
}
@Override
public boolean startRecordPackage(int id, int duration, int type) {
return sendRecordData(id, duration, type, true, -1);
return sendRecordData(id, duration, type, true, -1, null);
}
@Override
public boolean startRecordPackage(int id, int duration, int type, int bduration) {
return sendRecordData(id, duration, type, true, bduration);
return sendRecordData(id, duration, type, true, bduration, null);
}
@Override
public boolean startRecordPackage(int id, int type, List<String> topics) {
return sendRecordData(id, 0, type, true, -1, topics);
}
@Override
public boolean startRecordPackage(int id, int duration, int type, List<String> topics) {
return sendRecordData(id, duration, type, true, -1, topics);
}
@Override
public boolean startRecordPackage(int id, int duration, int type, int bduration, List<String> topics) {
return sendRecordData(id, duration, type, true, bduration, topics);
}
@Override
public boolean stopRecordPackage(int id, int type) {
return sendRecordData(id, 0, type, false, -1);
return sendRecordData(id, 0, type, false, -1, null);
}
/**
* 数据采集请求 主动录制Bag包
* sustain为true时 duration无效
@@ -846,10 +865,11 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec
* @param isRecord 采集指令, true: 采集, false: 停止采集
* @param bduration 前溯时长
* @param sustain 是否持续采集
* @param topics 要录制的Topic列表
* @return boolean
*/
@Override
public boolean sendRecordData(int id, int duration, int type, boolean isRecord, int bduration) {
public boolean sendRecordData(int id, int duration, int type, boolean isRecord, int bduration, List<String> topics) {
boolean sustain = false;
if (isRecord) {
if (duration <= 0) {
@@ -867,6 +887,9 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec
if (bduration > -1) {
builder.setBduration(bduration);
}
if (topics != null && !topics.isEmpty()) {
builder.addAllTopics(topics);
}
MessagePad.RecordData req = builder.build();
return sendPBMessage(MessageType.TYPE_SEND_RECORD_DATA.typeCode, req.toByteArray());
}
@@ -1031,14 +1054,20 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec
/**
* 数据采集配置查询
*
* @param reqType 0: all, 1:获取当前所有topic列表, 2:配置需要预加载的topic组合
* @param recordType 0:不需要修改内置类型的topic组合, 1:需要修改内置类型的topic组合
* @param topicsNeedToCache
* @return boolean
*/
@Override
public boolean sendRecordDataConfigReq() {
MessagePad.RecordDataConfigReq req = MessagePad.RecordDataConfigReq
public boolean sendRecordDataConfigReq(int reqType, int recordType, List<String> topicsNeedToCache) {
MessagePad.RecordDataConfigReq.Builder builder = MessagePad.RecordDataConfigReq
.newBuilder()
.setReqType(0)
.build();
.setReqType(reqType)
.setRecordType(recordType);
if (topicsNeedToCache != null && !topicsNeedToCache.isEmpty())
builder.addAllTopicsNeedToCache(topicsNeedToCache);
MessagePad.RecordDataConfigReq req = builder.build();
return sendPBMessage(MessageType.TYPE_SEND_RECORD_DATA_CONFIG_REQ.typeCode, req.toByteArray());
}
@@ -1194,5 +1223,66 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec
public boolean sendOperatorCmdStopHonking() {
return sendOperatorCmdSetHorn(2);
}
/**
* 设置参数命令
*
* @param type 0:default 1:绕障类功能开关(bool) 2:变道绕障的目标障碍物速度阈值(double, m/s)
* @param value 转成字符串的值
* @return boolean
*/
@Override
public boolean sendSetParamReq(int type, String value) {
MessagePad.SetOneParam oneParam = MessagePad.SetOneParam
.newBuilder().setType(type).setValue(value).build();
MessagePad.SetParamReq req = MessagePad.SetParamReq
.newBuilder()
.addReqs(oneParam)
.build();
return sendPBMessage(MessageType.TYPE_SEND_SET_PARAM_REQ.typeCode, req.toByteArray());
}
/**
* 绕障类功能开关
*
* @param enable 0关闭1开启
* @return boolean
*/
@Override
public boolean sendDetouring(int enable) {
return sendSetParamReq(1, String.valueOf(enable));
}
/**
* 变道绕障的目标障碍物速度阈值
*
* @param speed 速度阈值 m/s
* @return boolean
*/
@Override
public boolean sendDetouringSpeed(double speed) {
return sendSetParamReq(2, String.valueOf(speed));
}
/**
*
* @param type 事件类型, 1:行程开始, 2:行程结束, 3:出站, 4:进站, 5:城市占道施工预警
* @param lineName 路线名, for type 1, 2
* @param stopName 站点名, for type 3, 4
* @param isLastStop
* @return
*/
@Override
public boolean sendTripInfoReq(int type, String lineName, String stopName, boolean isLastStop) {
MessagePad.TripInfoEvent req = MessagePad.TripInfoEvent
.newBuilder()
.setType(type)
.setLineName(lineName)
.setStopName(stopName)
.setIsLastStop(isLastStop)
.build();
return sendPBMessage(MessageType.TYPE_SEND_TRIP_INFO_REQ.typeCode, req.toByteArray());
}
}

View File

@@ -12,6 +12,7 @@ import com.zhidao.support.adas.high.common.MessageType;
import com.zhidao.support.adas.high.common.ReceiveTimeoutManager;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import mogo.telematics.pad.MessagePad;
@@ -332,6 +333,7 @@ public class AdasManager implements IAdasNetCommApi {
* 同下
*
* @param id
* @param duration
* @param type
* @return
*/
@@ -344,7 +346,9 @@ public class AdasManager implements IAdasNetCommApi {
* 同下
*
* @param id
* @param duration
* @param type
* @param bduration
* @return
*/
@Override
@@ -352,6 +356,48 @@ public class AdasManager implements IAdasNetCommApi {
return mChannel != null && mChannel.startRecordPackage(id, duration, type, bduration);
}
/**
* 同下
*
* @param id
* @param type
* @param topics
* @return
*/
@Override
public boolean startRecordPackage(int id, int type, List<String> topics) {
return mChannel != null && mChannel.startRecordPackage(id, type, topics);
}
/**
* 同下
*
* @param id
* @param duration
* @param type
* @param topics
* @return
*/
@Override
public boolean startRecordPackage(int id, int duration, int type, List<String> topics) {
return mChannel != null && mChannel.startRecordPackage(id, duration, type, topics);
}
/**
* 同下
*
* @param id
* @param duration
* @param type
* @param bduration
* @param topics
* @return
*/
@Override
public boolean startRecordPackage(int id, int duration, int type, int bduration, List<String> topics) {
return mChannel != null && mChannel.startRecordPackage(id, duration, type, bduration, topics);
}
/**
* 同下
*
@@ -375,8 +421,8 @@ public class AdasManager implements IAdasNetCommApi {
* @return boolean
*/
@Override
public boolean sendRecordData(int id, int duration, int type, boolean isRecord, int bduration) {
return mChannel != null && mChannel.sendRecordData(id, duration, type, isRecord, bduration);
public boolean sendRecordData(int id, int duration, int type, boolean isRecord, int bduration, List<String> topics) {
return mChannel != null && mChannel.sendRecordData(id, duration, type, isRecord, bduration, topics);
}
/**
@@ -469,11 +515,14 @@ public class AdasManager implements IAdasNetCommApi {
/**
* 数据采集配置查询
*
* @param reqType 0: all, 1:获取当前所有topic列表, 2:配置需要预加载的topic组合
* @param recordType 0:不需要修改内置类型的topic组合, 1:需要修改内置类型的topic组合
* @param topicsNeedToCache
* @return boolean
*/
@Override
public boolean sendRecordDataConfigReq() {
return mChannel != null && mChannel.sendRecordDataConfigReq();
public boolean sendRecordDataConfigReq(int reqType, int recordType, List<String> topicsNeedToCache) {
return mChannel != null && mChannel.sendRecordDataConfigReq(reqType, recordType, topicsNeedToCache);
}
/**
@@ -570,6 +619,52 @@ public class AdasManager implements IAdasNetCommApi {
return mChannel != null && mChannel.sendOperatorCmdStopHonking();
}
/**
* 设置参数命令
*
* @param type 0:default 1:绕障类功能开关(bool) 2:变道绕障的目标障碍物速度阈值(double, m/s)
* @param value 转成字符串的值
* @return boolean
*/
@Override
public boolean sendSetParamReq(int type, String value) {
return mChannel != null && mChannel.sendSetParamReq(type, value);
}
/**
* 绕障类功能开关
*
* @param enable 0关闭1开启
* @return boolean
*/
@Override
public boolean sendDetouring(int enable) {
return mChannel != null && mChannel.sendDetouring(enable);
}
/**
* 变道绕障的目标障碍物速度阈值
*
* @param speed 速度阈值 m/s
* @return boolean
*/
@Override
public boolean sendDetouringSpeed(double speed) {
return mChannel != null && mChannel.sendDetouringSpeed(speed);
}
/**
* 行程信息
* @param type 事件类型, 1:行程开始, 2:行程结束, 3:出站, 4:进站, 5:城市占道施工预警
* @param lineName 路线名, for type 1, 2
* @param stopName 站点名, for type 3, 4
* @param isLastStop 是否终点站
* @return
*/
@Override
public boolean sendTripInfoReq(int type, String lineName, String stopName, boolean isLastStop) {
return mChannel != null && mChannel.sendTripInfoReq(type,lineName,stopName,isLastStop);
}
/**
* 获取工控机固定IP列表

View File

@@ -7,6 +7,7 @@ import com.zhidao.support.adas.high.common.Constants;
import com.zhidao.support.adas.high.common.Define;
import com.zhidao.support.adas.high.common.MessageType;
import java.util.List;
import java.util.Set;
import mogo.telematics.pad.MessagePad;
@@ -132,6 +133,38 @@ public interface IAdasNetCommApi {
*/
boolean startRecordPackage(int id, int duration, int type, int bduration);
/**
* 同下
*
* @param id
* @param type
* @param topics
* @return 加入WS发送消息队列是否成功
*/
boolean startRecordPackage(int id, int type, List<String> topics);
/**
* 同下
*
* @param id
* @param type
* @param topics
* @return 加入WS发送消息队列是否成功
*/
boolean startRecordPackage(int id, int duration, int type, List<String> topics);
/**
* 同下
*
* @param id
* @param duration
* @param type
* @param bduration
* @param topics
* @return 加入WS发送消息队列是否成功
*/
boolean startRecordPackage(int id, int duration, int type, int bduration, List<String> topics);
/**
* 同下
*
@@ -151,7 +184,7 @@ public interface IAdasNetCommApi {
* @param bduration 前溯时长
* @return 加入WS发送消息队列是否成功
*/
boolean sendRecordData(int id, int duration, int type, boolean isRecord, int bduration);
boolean sendRecordData(int id, int duration, int type, boolean isRecord, int bduration, List<String> topics);
/**
* 设置自动驾驶最大速度
@@ -223,11 +256,13 @@ public interface IAdasNetCommApi {
/**
* 数据采集配置查询
* 0: all, 其他保留
*
* @param reqType 0: all, 1:获取当前所有topic列表, 2:配置需要预加载的topic组合
* @param recordType 0:不需要修改内置类型的topic组合, 1:需要修改内置类型的topic组合
* @param topicsNeedToCache
* @return 加入WS发送消息队列是否成功
*/
boolean sendRecordDataConfigReq();
boolean sendRecordDataConfigReq(int reqType, int recordType, List<String> topicsNeedToCache);
/**
* 获取已注册接口
@@ -319,6 +354,43 @@ public interface IAdasNetCommApi {
* @return boolean
*/
boolean sendOperatorCmdStopHonking();
/**
* 设置参数命令
*
* @param type 0:default 1:绕障类功能开关(bool) 2:变道绕障的目标障碍物速度阈值(double, m/s)
* @param value 转成字符串的值
* @return boolean
*/
boolean sendSetParamReq(int type, String value);
/**
* 绕障类功能开关
*
* @param enable 0关闭1开启
* @return boolean
*/
boolean sendDetouring(int enable);
/**
* 变道绕障的目标障碍物速度阈值
*
* @param speed 速度阈值 m/s
* @return boolean
*/
boolean sendDetouringSpeed(double speed);
/**
* 发生行程相关
*
* @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
*/
boolean sendTripInfoReq(int type, String lineName, String stopName, boolean isLastStop);
// TODO 需求暂停 待讨论
// boolean getRoutes();
@@ -349,6 +421,7 @@ public interface IAdasNetCommApi {
*/
void setEnableLog(boolean isEnableLog);
/**
* 获取与当前连接工控机兼容性
* 连接状态=已连接 时正常返回其他状态全部为null

View File

@@ -49,6 +49,8 @@ public enum MessageType {
TYPE_SEND_RECORD_DATA_CONFIG_REQ(MessagePad.MessageType.MsgTypeRecordDataConfigReq, "数据采集配置查询"),
TYPE_RECEIVE_RECORD_DATA_CONFIG_RESP(MessagePad.MessageType.MsgTypeRecordDataConfigResp, "数据采集配置"),
TYPE_SEND_SUBSCRIBE_DATA_REQ(MessagePad.MessageType.MsgTypeSubscribeDataReq, "数据订阅、取消订阅请求"),
TYPE_SEND_SET_PARAM_REQ(MessagePad.MessageType.MsgTypeSetParamReq, "设置参数命令"),
TYPE_SEND_TRIP_INFO_REQ(MessagePad.MessageType.MsgTypeTripInfoEvent, "行程信息"),
//透传 原始pb文件中不存在以下type。由于Java中无法强转所以在mogo-adas-data message_pad.proto中放开注释
TYPE_RECEIVE_PLANNING_DECISION_STATE(MessagePad.MessageType.MsgTypePlanningDecisionState, "Planning决策状态");

View File

@@ -19,7 +19,10 @@ public class HostConst {
public static final String CITY_HOST = "http://dzt-city.zhidaozhixing.com";
public static final String SOCKET_CENTER_DOMAIN = "socketRegion";
public static final String BINDING_SN_HOST = "https://mygateway.zhidaozhixing.com/cmdbapi/"; //中台提供的接口服务
public static final String BINDING_SN_HOST_TEST = "https://mygateway.zhidaozhixing.com/cmdbapitest/"; //中台提供的接口服务测试
// public static final String UPGRADE_APP_HOST_TEST = "http://10.0.200.12:32423?/";
public static final String UPGRADE_APP_HOST = "http://eagle-mis.zhidaozhixing.com/";
public static final String CMDB_HOST = "http://eagle-mis.zhidaozhixing.com/eagleEye-mis/cmdbapi/";
}

View File

@@ -39,6 +39,8 @@ interface IMogoTTS extends IProvider {
*/
void speakTTSVoice( String tts );
void speakTTSVoiceWithLevel( String tts, int level);
/**
* 播放 tts 语音
*

View File

@@ -8,6 +8,9 @@ import android.os.Build;
import android.os.Environment;
import android.provider.Settings;
import android.text.TextUtils;
import android.util.Pair;
import androidx.annotation.MainThread;
import com.aispeech.AIError;
import com.aispeech.DUILiteConfig;
@@ -20,8 +23,6 @@ import com.aispeech.export.engines.AILocalTTSEngine;
import com.aispeech.export.intent.AILocalTTSIntent;
import com.aispeech.export.listeners.AITTSListener;
import com.aispeech.lite.AuthType;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.mogo.cloud.commons.BuildConfig;
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.utilcode.util.ThreadUtils;
@@ -39,6 +40,7 @@ import com.zhidao.voicesdk.callback.OnTtsListener;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
@@ -59,6 +61,10 @@ public class PadTTS implements IMogoTTS, VoiceClient.VoiceCmdCallBack, OnTtsList
private boolean mInitReady = true;
private Context mContext;
// 等级由低到高为0、1、2、3默认为-1表示没有正在tts的
private int curTtsLevel = -1;
private LinkedList<Pair<String, Integer>> linkedList = new LinkedList<>();
public void release() {
CallerLogger.INSTANCE.d(TAG, "release");
ThreadUtils.runOnUiThread(() -> {
@@ -73,6 +79,7 @@ public class PadTTS implements IMogoTTS, VoiceClient.VoiceCmdCallBack, OnTtsList
}
mQAndAMap.clear();
mVoiceClient.release();
curTtsLevel = -1;
if (mEngine != null) {
mEngine.destroy();
mEngine = null;
@@ -344,12 +351,15 @@ public class PadTTS implements IMogoTTS, VoiceClient.VoiceCmdCallBack, OnTtsList
if (mSpeakVoiceMap.containsKey(text)) {
mSpeakVoiceMap.remove(text);
}
curTtsLevel = -1;
mEngine.stop();
}
}
public void stopTts() {
if (mEngine != null && mHasAuth) {
// tts过程中调用stop不会有回调事件
curTtsLevel = -1;
mEngine.stop();
}
}
@@ -367,6 +377,67 @@ public class PadTTS implements IMogoTTS, VoiceClient.VoiceCmdCallBack, OnTtsList
}
}
@MainThread
public void speakTTSVoiceWithLevel(String text, int ttsLevel) {
if (mEngine != null) {
if (ttsLevel == curTtsLevel) {
// 对应p3、p2级别的排队
if (ttsLevel == 0 || ttsLevel == 1) {
CallerLogger.INSTANCE.d(TAG, "===================");
CallerLogger.INSTANCE.d(TAG, "插入消息:" + text + ",level为" + ttsLevel);
insertTts(text, ttsLevel);
return;
} else {
// 打断并合成新的
stopTts();
CallerLogger.INSTANCE.d(TAG, "非Level1同级别打断!");
}
} else {
// 将要TTS的比现在正在TTS的优先级高
if (ttsLevel > curTtsLevel) {
if (curTtsLevel >= 0) {
// 打断并合成高优先级的
stopTts();
}
CallerLogger.INSTANCE.d(TAG, "高优先级打断低级别的!");
} else {
if (ttsLevel == 0 || ttsLevel == 1) {
CallerLogger.INSTANCE.d(TAG, "===================");
CallerLogger.INSTANCE.d(TAG, "插入消息:" + text + ",level为" + ttsLevel);
insertTts(text, ttsLevel);
}
return;
}
}
curTtsLevel = ttsLevel;
// 合成并播放
CallerLogger.INSTANCE.d(TAG, "tts准备合成" + text + ",curTtsLevel为" + curTtsLevel);
mEngine.speak(text, text, mAILocalTTSIntent);
}
}
// 降序插入Tts(目前Level0、1可排队)
private void insertTts(String text, int level) {
int index = -1;
for (int i = linkedList.size() - 1; i >= 0; i--) {
int nodeLevel = linkedList.get(i).second;
// 只有高优先级才插入到前面,等于的情况下是插到后面
if (level > nodeLevel) {
index = i;
}
}
if (index >= 0) {
linkedList.add(index, new Pair(text, level));
} else {
linkedList.addLast(new Pair(text, level));
}
for (Pair<String, Integer> ttsPair:
linkedList) {
CallerLogger.INSTANCE.d(TAG, "tts文本为" + ttsPair.first + ",level为" + ttsPair.second);
}
CallerLogger.INSTANCE.d(TAG, "===================");
}
/**
* 语音播报
*
@@ -669,6 +740,7 @@ public class PadTTS implements IMogoTTS, VoiceClient.VoiceCmdCallBack, OnTtsList
@Override
public void onError(String utteranceId, AIError aiError) {
CallerLogger.INSTANCE.d(TAG, "检测到错误:" + aiError.toString());
curTtsLevel = -1;
IMogoTTSCallback callBack = PadTTS.this.mSpeakVoiceMap.remove(utteranceId);
if (callBack != null) {
callBack.onSpeakError(utteranceId, aiError.getError());
@@ -682,7 +754,9 @@ public class PadTTS implements IMogoTTS, VoiceClient.VoiceCmdCallBack, OnTtsList
@Override
public void onCompletion(String utteranceId) {
curTtsLevel = -1;
CallerLogger.INSTANCE.d(TAG, "播放完成");
ttsNext();
IMogoTTSCallback callBack = PadTTS.this.mSpeakVoiceMap.remove(utteranceId);
if (callBack != null) {
callBack.onSpeakEnd(utteranceId);
@@ -711,6 +785,18 @@ public class PadTTS implements IMogoTTS, VoiceClient.VoiceCmdCallBack, OnTtsList
}
}
@MainThread
private void ttsNext() {
if (!linkedList.isEmpty()) {
Pair<String, Integer> ttsPair = linkedList.removeFirst();
CallerLogger.INSTANCE.i(TAG, "排队播放的下一条文本为:" + ttsPair.first + ",级别为:" + ttsPair.second);
curTtsLevel = ttsPair.second;
speakTTSVoice(ttsPair.first);
} else {
CallerLogger.INSTANCE.i(TAG, "队列为空");
}
}
public static boolean isProcessRunning(Context context, int uid) {
if (context == null) {
return false;