diff --git a/app_ipc_monitoring/src/main/java/com/zhidao/adas/client/ui/MainActivity.java b/app_ipc_monitoring/src/main/java/com/zhidao/adas/client/ui/MainActivity.java index eb77663d3c..8bd832812b 100644 --- a/app_ipc_monitoring/src/main/java/com/zhidao/adas/client/ui/MainActivity.java +++ b/app_ipc_monitoring/src/main/java/com/zhidao/adas/client/ui/MainActivity.java @@ -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 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) { diff --git a/app_ipc_monitoring/src/main/java/com/zhidao/adas/client/utils/Constants.java b/app_ipc_monitoring/src/main/java/com/zhidao/adas/client/utils/Constants.java index 520893fde8..2ee184f5b2 100644 --- a/app_ipc_monitoring/src/main/java/com/zhidao/adas/client/utils/Constants.java +++ b/app_ipc_monitoring/src/main/java/com/zhidao/adas/client/utils/Constants.java @@ -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 = "行程信息"; } diff --git a/app_ipc_monitoring/src/main/res/layout/dialog_detouring_speed.xml b/app_ipc_monitoring/src/main/res/layout/dialog_detouring_speed.xml new file mode 100644 index 0000000000..717530d7f6 --- /dev/null +++ b/app_ipc_monitoring/src/main/res/layout/dialog_detouring_speed.xml @@ -0,0 +1,30 @@ + + + + + + + \ No newline at end of file diff --git a/app_ipc_monitoring/src/main/res/layout/dialog_record_data_config_resp.xml b/app_ipc_monitoring/src/main/res/layout/dialog_record_data_config_resp.xml new file mode 100644 index 0000000000..c71fb1bec7 --- /dev/null +++ b/app_ipc_monitoring/src/main/res/layout/dialog_record_data_config_resp.xml @@ -0,0 +1,93 @@ + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/MoGoAutopilotProvider.kt b/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/MoGoAutopilotProvider.kt index 48884b3af1..caec9aab44 100644 --- a/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/MoGoAutopilotProvider.kt +++ b/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/MoGoAutopilotProvider.kt @@ -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 + ): 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,10 +507,37 @@ 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): Boolean{ + return AdasManager.getInstance().sendRecordDataConfigReq(reqType, recordType, topicsNeedToCache) } /** @@ -531,6 +568,18 @@ class MoGoAutopilotProvider : 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) + } + /** * 发送工控机所有节点重启命令 */ diff --git a/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/adapter/MoGoAdasListenerImpl.kt b/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/adapter/MoGoAdasListenerImpl.kt index 0402c87379..086731087f 100644 --- a/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/adapter/MoGoAdasListenerImpl.kt +++ b/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/adapter/MoGoAdasListenerImpl.kt @@ -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) + } } /** diff --git a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/biz/BadCaseConfigView.kt b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/biz/BadCaseConfigView.kt index f7d92b33d0..23af1a9edf 100644 --- a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/biz/BadCaseConfigView.kt +++ b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/biz/BadCaseConfigView.kt @@ -252,8 +252,8 @@ defStyleAttr: Int = 0 override fun onAttachedToWindow() { super.onAttachedToWindow() CallerAutopilotRecordListenerManager.addListener(TAG, this) - //获取数据采集录制模式配置列表 - CallerAutoPilotManager.getBadCaseConfig() + //获取数据采集录制模式配置列表 TODO +// CallerAutoPilotManager.getBadCaseConfig() } override fun onDetachedFromWindow() { diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/SOPSettingView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/SOPSettingView.kt new file mode 100644 index 0000000000..ae03721b01 --- /dev/null +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/SOPSettingView.kt @@ -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("变道绕障的目标障碍物速度阈值设置失败") + } + } + + } + +} \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xxhdpi/icon_add.png b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xxhdpi/icon_add.png new file mode 100644 index 0000000000..429d1196be Binary files /dev/null and b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xxhdpi/icon_add.png differ diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xxhdpi/icon_reduce.png b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xxhdpi/icon_reduce.png new file mode 100644 index 0000000000..aa10f4b5de Binary files /dev/null and b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xxhdpi/icon_reduce.png differ diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_sop_setting.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_sop_setting.xml new file mode 100644 index 0000000000..105f81a5cd --- /dev/null +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_sop_setting.xml @@ -0,0 +1,196 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +