//是否是演示(美化)模式,会存在SP中,方便做现场恢复
FunctionBuildConfig.isDemoMode
当前APP的身份模式
0 = 司机模式(默认)
1 = 乘客模式(部分功能受到影响)
FunctionBuildConfig.appIdentityMode

Signed-off-by: donghongyu <donghongyu@zhidaoauto.com>
This commit is contained in:
donghongyu
2022-01-25 17:42:43 +08:00
parent d2ab2e09aa
commit 71898883e5
20 changed files with 223 additions and 287 deletions

View File

@@ -6,9 +6,11 @@ import androidx.annotation.RequiresPermission
import com.alibaba.android.arouter.facade.annotation.Route
import com.mogo.eagle.core.data.autopilot.AutopilotControlCmdParameter
import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters
import com.mogo.eagle.core.data.constants.MoGoConfig
import com.mogo.eagle.core.data.constants.MogoServicePaths
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotProvider
import com.mogo.eagle.core.function.autopilot.server.AsyncDataToAutopilotServer
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr
import com.mogo.eagle.core.utilcode.util.GsonUtils
import com.mogo.eagle.core.utilcode.util.LogUtils
import com.mogo.eagle.core.utilcode.util.ThreadUtils
@@ -23,13 +25,15 @@ import java.util.concurrent.TimeUnit
*/
@Route(path = MogoServicePaths.PATH_AUTO_PILOT)
class MoGoAutopilotProvider :
IMoGoAutopilotProvider {
IMoGoAutopilotProvider {
private val TAG = "MoGoAutoPilotProvider"
private var mContext: Context? = null
override val functionName: String
get() = TAG
override fun init(context: Context) {
mContext = context
// 初始化ADAS 域控制器
//AdasManager.getInstance().create(context)
AsyncDataToAutopilotServer.INSTANCE.initServer()
@@ -47,6 +51,8 @@ class MoGoAutopilotProvider :
ThreadUtils.executeBySingleWithDelay(object : ThreadUtils.SimpleTask<String>() {
@RequiresPermission(permission.INTERNET)
override fun doInBackground(): String {
// 保存本地 AutoPilot IP地址
mContext?.let { SharedPrefsMgr.getInstance(it).putString(MoGoConfig.AUTOPILOT_IP, autoPilotIp) }
// 设置IP地址
AdasManager.getInstance().setIPCIp(autoPilotIp)
// 打开通讯连接
@@ -83,7 +89,7 @@ class MoGoAutopilotProvider :
override fun recordPackage(): Boolean {
return AdasManager.getInstance()
.recordPackage(1, (System.currentTimeMillis() / 1000).toInt())
.recordPackage(1, (System.currentTimeMillis() / 1000).toInt())
}
override fun setEnableLog(isEnableLog: Boolean) {

View File

@@ -50,11 +50,11 @@ import kotlinx.android.synthetic.main.view_debug_setting.view.*
* 展示 本机、网络、工控机、OBU等状态信息支持设置IP等参数进行调试
*/
class DebugSettingView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : ConstraintLayout(context, attrs, defStyleAttr), IMoGoObuStatusListener,
IMoGoAutopilotStatusListener, IMoGoAutopilotCarStateListener, IMoGoMapLocationListener {
IMoGoAutopilotStatusListener, IMoGoAutopilotCarStateListener, IMoGoMapLocationListener {
private val TAG = "DebugSettingView"
@@ -146,14 +146,14 @@ class DebugSettingView @JvmOverloads constructor(
tvObuInfo.text = CallerObuListenerManager.getObuStatusInfoJsonString()
tvAutopilotInfo.text =
CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfoJsonString()
CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfoJsonString()
// 绘制应用基本信息
drawAppInfo()
// 初始化OBU IP信息
val ipAddress =
SharedPrefsMgr.getInstance(context).getString(MoGoConfig.OBU_IP, "192.168.1.199")
SharedPrefsMgr.getInstance(context).getString(MoGoConfig.OBU_IP, "192.168.1.199")
etObuIP.setText(ipAddress)
etObuIP.text?.let { etObuIP.setSelection(it.length) }
@@ -169,7 +169,7 @@ class DebugSettingView @JvmOverloads constructor(
// 初始化工控机 IP信息
val autoPilotIpAddress =
SharedPrefsMgr.getInstance(context).getString(MoGoConfig.AUTOPILOT_IP, "192.168.1.102")
SharedPrefsMgr.getInstance(context).getString(MoGoConfig.AUTOPILOT_IP, "192.168.1.102")
etAutopilotIP.setText(autoPilotIpAddress)
etAutopilotIP.text?.let { etAutopilotIP.setSelection(it.length) }
@@ -178,8 +178,6 @@ class DebugSettingView @JvmOverloads constructor(
val autoPilotIp = etAutopilotIP.text.toString()
if (autoPilotIp.isNotEmpty()) {
CallerAutoPilotManager.resetIpAddress(autoPilotIp)
// 保存本地 AutoPilot IP地址
SharedPrefsMgr.getInstance(context).putString(MoGoConfig.AUTOPILOT_IP, autoPilotIp)
} else {
ToastUtils.showShort("请输入正确的IP地址")
}
@@ -190,21 +188,20 @@ class DebugSettingView @JvmOverloads constructor(
CallerAutoPilotManager.recordPackage()
}
// 初始化 GSP数据源 数据
rgGpsProvider.check(
when (FunctionBuildConfig.gpsProvider) {
0 -> {
R.id.rbGpsProviderAndroid
when (FunctionBuildConfig.gpsProvider) {
0 -> {
R.id.rbGpsProviderAndroid
}
1 -> {
R.id.rbGpsProviderRTK
}
2 -> {
R.id.rbGpsProviderOBU
}
else -> R.id.rbGpsProviderAndroid
}
1 -> {
R.id.rbGpsProviderRTK
}
2 -> {
R.id.rbGpsProviderOBU
}
else -> R.id.rbGpsProviderAndroid
}
)
rgGpsProvider.setOnCheckedChangeListener { group, checkedId ->
when (checkedId) {
@@ -222,14 +219,14 @@ class DebugSettingView @JvmOverloads constructor(
// 初始化 感知数据是否绘制 选择情况
rgIsDrawIdentifyData.check(
when (FunctionBuildConfig.isDrawIdentifyData) {
true -> {
R.id.rbDraw
when (FunctionBuildConfig.isDrawIdentifyData) {
true -> {
R.id.rbDraw
}
false -> {
R.id.rbDoNotDraw
}
}
false -> {
R.id.rbDoNotDraw
}
}
)
rgIsDrawIdentifyData.setOnCheckedChangeListener { group, checkedId ->
when (checkedId) {
@@ -242,37 +239,16 @@ class DebugSettingView @JvmOverloads constructor(
}
}
/*// 切换地图中心点视角
tbChangeCarCenter100.setOnClickListener {
CallerHDMapManager.changeMaoViewAngle(1)
// 演示模式,上一次勾选的数据
val isDemoMode =
SharedPrefsMgr.getInstance(context).getBoolean(MoGoConfig.IS_DEMO_MODE, false)
rbIsDemoMode.isChecked = isDemoMode
// 演示模式
rbIsDemoMode.setOnCheckedChangeListener { buttonView, isChecked ->
FunctionBuildConfig.isDemoMode = isChecked
SharedPrefsMgr.getInstance(context).putBoolean(MoGoConfig.IS_DEMO_MODE, isChecked)
}
tbChangeCarQuarter100.setOnClickListener {
CallerHDMapManager.changeMaoViewAngle(2)
}
tbChangeCarTwoFifths100.setOnClickListener {
CallerHDMapManager.changeMaoViewAngle(3)
}
tbChangeCarTwoFifths80.setOnClickListener {
CallerHDMapManager.changeMaoViewAngle(4)
}
tbChangeCAR_AFTER_30_FRONT_80.setOnClickListener {
CallerHDMapManager.changeMaoViewAngle(5)
}
tbChangeCAR_AFTER_30_FRONT_100.setOnClickListener {
CallerHDMapManager.changeMaoViewAngle(6)
}
tbChangeCAR_AFTER_30_FRONT_120.setOnClickListener {
CallerHDMapManager.changeMaoViewAngle(7)
}
tbChangeCAR_AFTER_40_FRONT_80.setOnClickListener {
CallerHDMapManager.changeMaoViewAngle(8)
}
tbChangeCAR_AFTER_40_FRONT_100.setOnClickListener {
CallerHDMapManager.changeMaoViewAngle(9)
}
tbChangeCAR_AFTER_40_FRONT_120.setOnClickListener {
CallerHDMapManager.changeMaoViewAngle(10)
}*/
tbSelfLog.setOnCheckedChangeListener { buttonView, isChecked ->
if (isChecked) {
@@ -305,7 +281,7 @@ class DebugSettingView @JvmOverloads constructor(
}
tbLogCatch.isChecked =
SharedPrefsMgr.getInstance(context).getBoolean(MoGoConfig.CATCH_LOG, false)
SharedPrefsMgr.getInstance(context).getBoolean(MoGoConfig.CATCH_LOG, false)
tbLogCatch.setOnCheckedChangeListener { _, isChecked ->
if (isChecked) {
CallerDevaToolsManager.startCatchLog()
@@ -316,20 +292,20 @@ class DebugSettingView @JvmOverloads constructor(
}
}
CallerDevaToolsListenerManager.registerDevaToolsLogCatchListener(TAG,
object : IMoGoDevaToolsListener {
override fun onLogCatchClose() {
super.onLogCatchClose()
tbLogCatch.isChecked = false
}
object : IMoGoDevaToolsListener {
override fun onLogCatchClose() {
super.onLogCatchClose()
tbLogCatch.isChecked = false
}
override fun onLogCatch(lineLog: String) {
logInfoView?.let {
if (logViewAttach) {
it.onLogCatch(lineLog)
override fun onLogCatch(lineLog: String) {
logInfoView?.let {
if (logViewAttach) {
it.onLogCatch(lineLog)
}
}
}
}
})
})
tbLogDebugView.setOnCheckedChangeListener { _, isChecked ->
if (isChecked) {
logInfoView = LogInfoView()

View File

@@ -9,7 +9,9 @@ import android.widget.FrameLayout
import com.alibaba.android.arouter.launcher.ARouter
import com.mogo.eagle.core.data.constants.MogoServicePaths
import com.mogo.eagle.core.data.map.MogoLatLng
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
import com.mogo.map.navi.IMogoCarLocationChangedListener2
import com.mogo.service.IMogoServiceApis
@@ -53,7 +55,11 @@ class SpeedPanelView @JvmOverloads constructor(
}
private fun initEvent(context: Context) {
setOnLongClickListener {
Logger.d(TAG, "长按显示状态工具栏")
CallerHmiManager.toggleDebugView()
false
}
}
private val timerTask = object : TimerTask() {
@@ -99,12 +105,6 @@ class SpeedPanelView @JvmOverloads constructor(
override fun onCarLocationChanged2(latLng: Location) {
mLatLng = latLng
// UiThreadHandler.post {
// val speed = (latLng.speed * 3.6f).toInt()
// mSpeedChartView.setArcColor(Color.parseColor(if (speed > 60) "#DB3137" else "#3E77F6"))
// mSpeedChartView.setValues(speed)
// setBackgroundResource(if (speed > 60) R.drawable.yi_biao_pan_bg_speeding else R.drawable.yi_biao_pan_bg_nor)
// }
}
}

View File

@@ -31,26 +31,26 @@
android:textSize="@dimen/dp_34"
android:textStyle="bold" />
<!-- <LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<!-- <LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="PAD系统时间"
android:textColor="#000"
android:textSize="@dimen/dp_36" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="PAD系统时间"
android:textColor="#000"
android:textSize="@dimen/dp_36" />
<TextClock
android:id="@+id/tvNowTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:format12Hour="yyyy年MM月dd日 EEEE aa HH:mm:ss"
android:format24Hour="yyyy年MM月dd日 EEEE aa HH:mm:ss"
android:textColor="#000"
android:textSize="@dimen/dp_36" />
</LinearLayout>-->
<TextClock
android:id="@+id/tvNowTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:format12Hour="yyyy年MM月dd日 EEEE aa HH:mm:ss"
android:format24Hour="yyyy年MM月dd日 EEEE aa HH:mm:ss"
android:textColor="#000"
android:textSize="@dimen/dp_36" />
</LinearLayout>-->
<TextView
android:id="@+id/tvAppInfo"
@@ -166,7 +166,8 @@
android:layout_margin="2dp"
android:gravity="center"
android:text="切换 顶视角"
android:textSize="@dimen/dp_34"/>
android:textSize="@dimen/dp_34" />
<Button
android:id="@+id/changesight_back_btn"
android:layout_width="wrap_content"
@@ -174,7 +175,8 @@
android:layout_margin="2dp"
android:gravity="center"
android:text="切换 后方来车视角"
android:textSize="@dimen/dp_34"/>
android:textSize="@dimen/dp_34" />
<Button
android:id="@+id/changesight_cross_btn"
android:layout_width="wrap_content"
@@ -182,7 +184,7 @@
android:layout_margin="2dp"
android:gravity="center"
android:text="切换 十字路口视角"
android:textSize="@dimen/dp_34"/>
android:textSize="@dimen/dp_34" />
<Button
android:id="@+id/changesight_far_btn"
@@ -191,7 +193,8 @@
android:layout_margin="2dp"
android:gravity="center"
android:text="切换 远视角"
android:textSize="@dimen/dp_34"/>
android:textSize="@dimen/dp_34" />
<Button
android:id="@+id/reset_changesight"
android:layout_width="wrap_content"
@@ -199,96 +202,8 @@
android:layout_margin="2dp"
android:gravity="center"
android:text="恢复视角"
android:textSize="@dimen/dp_34"/>
<!-- <Button
android:id="@+id/tbChangeCarCenter100"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="2dp"
android:gravity="center"
android:text="切换 CAR_CENTER_100"
android:textSize="@dimen/dp_34" />
android:textSize="@dimen/dp_34" />
<Button
android:id="@+id/tbChangeCarQuarter100"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="2dp"
android:gravity="center"
android:text="切换 CAR_QUARTER_100"
android:textSize="@dimen/dp_34" />
<Button
android:id="@+id/tbChangeCarTwoFifths100"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="2dp"
android:gravity="center"
android:text="切换 CAR_TWO_FIFTHS_100"
android:textSize="@dimen/dp_34" />
<Button
android:id="@+id/tbChangeCarTwoFifths80"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="2dp"
android:gravity="center"
android:text="切换 CAR_TWO_FIFTHS_80"
android:textSize="@dimen/dp_34" />
<Button
android:id="@+id/tbChangeCAR_AFTER_30_FRONT_80"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="2dp"
android:gravity="center"
android:text="切换 CAR_AFTER_30_FRONT_80"
android:textSize="@dimen/dp_34" />
<Button
android:id="@+id/tbChangeCAR_AFTER_30_FRONT_100"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="2dp"
android:gravity="center"
android:text="切换 CAR_AFTER_30_FRONT_100"
android:textSize="@dimen/dp_34" />
<Button
android:id="@+id/tbChangeCAR_AFTER_30_FRONT_120"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="2dp"
android:gravity="center"
android:text="切换 CAR_AFTER_30_FRONT_120"
android:textSize="@dimen/dp_34" />
<Button
android:id="@+id/tbChangeCAR_AFTER_40_FRONT_80"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="2dp"
android:gravity="center"
android:text="切换 CAR_AFTER_40_FRONT_80"
android:textSize="@dimen/dp_34" />
<Button
android:id="@+id/tbChangeCAR_AFTER_40_FRONT_100"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="2dp"
android:gravity="center"
android:text="切换 CAR_AFTER_40_FRONT_100"
android:textSize="@dimen/dp_34" />
<Button
android:id="@+id/tbChangeCAR_AFTER_40_FRONT_120"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="2dp"
android:gravity="center"
android:text="切换 CAR_AFTER_40_FRONT_120"
android:textSize="@dimen/dp_34" />-->
</com.google.android.flexbox.FlexboxLayout>
@@ -440,6 +355,14 @@
</RadioGroup>
<CheckBox
android:id="@+id/rbIsDemoMode"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="@dimen/dp_10"
android:text="选中开启美化模式"
android:textColor="#000"
android:textSize="@dimen/dp_34" />
</LinearLayout>
@@ -504,6 +427,7 @@
android:textColor="#000"
android:textSize="@dimen/dp_34"
android:textStyle="bold" />
<androidx.appcompat.widget.AppCompatEditText
android:id="@+id/etAutopilotIP"
android:layout_width="match_parent"

View File

@@ -54,6 +54,7 @@ public abstract class MainMoGoApplication extends AbsMogoApplication {
@Override
public void onCreate() {
initBuildConfig();
initConfigWithSP();
super.onCreate();
if (!shouldInit()) {
return;
@@ -79,6 +80,11 @@ public abstract class MainMoGoApplication extends AbsMogoApplication {
*/
protected abstract void initBuildConfig();
/**
* 从SP本地设置中恢复数据
*/
protected abstract void initConfigWithSP();
/**
* 初始化异常采集配置
*/