diff --git a/OCH/bus/passenger/src/jinlvvan/res/drawable/bus_p_roma_checked.png b/OCH/bus/passenger/src/jinlvvan/res/drawable/bus_p_roma_checked.png
new file mode 100644
index 0000000000..7377fd23a7
Binary files /dev/null and b/OCH/bus/passenger/src/jinlvvan/res/drawable/bus_p_roma_checked.png differ
diff --git a/OCH/bus/passenger/src/jinlvvan/res/drawable/bus_p_roma_normal.png b/OCH/bus/passenger/src/jinlvvan/res/drawable/bus_p_roma_normal.png
new file mode 100644
index 0000000000..38e78514d9
Binary files /dev/null and b/OCH/bus/passenger/src/jinlvvan/res/drawable/bus_p_roma_normal.png differ
diff --git a/OCH/bus/passenger/src/jinlvvan/res/drawable/iv_roma_bus_passenger_bg.png b/OCH/bus/passenger/src/jinlvvan/res/drawable/iv_roma_bus_passenger_bg.png
deleted file mode 100644
index 405d2cddaa..0000000000
Binary files a/OCH/bus/passenger/src/jinlvvan/res/drawable/iv_roma_bus_passenger_bg.png and /dev/null differ
diff --git a/OCH/bus/passenger/src/jinlvvan/res/drawable/iv_roma_bus_passenger_press_bg.png b/OCH/bus/passenger/src/jinlvvan/res/drawable/iv_roma_bus_passenger_press_bg.png
deleted file mode 100644
index a0b2ab93d9..0000000000
Binary files a/OCH/bus/passenger/src/jinlvvan/res/drawable/iv_roma_bus_passenger_press_bg.png and /dev/null differ
diff --git a/OCH/bus/passenger/src/jinlvvan/res/drawable/roma_bus_p_bg_selector.xml b/OCH/bus/passenger/src/jinlvvan/res/drawable/roma_bus_p_bg_selector.xml
index 191ec2e51f..96080c5b58 100644
--- a/OCH/bus/passenger/src/jinlvvan/res/drawable/roma_bus_p_bg_selector.xml
+++ b/OCH/bus/passenger/src/jinlvvan/res/drawable/roma_bus_p_bg_selector.xml
@@ -1,8 +1,8 @@
-
-
-
-
-
+
+
+
+
+
\ No newline at end of file
diff --git a/OCH/bus/passenger/src/jinlvvan/res/layout/bus_p_base_fragment.xml b/OCH/bus/passenger/src/jinlvvan/res/layout/bus_p_base_fragment.xml
index 7a510d7c24..3196c03903 100644
--- a/OCH/bus/passenger/src/jinlvvan/res/layout/bus_p_base_fragment.xml
+++ b/OCH/bus/passenger/src/jinlvvan/res/layout/bus_p_base_fragment.xml
@@ -36,16 +36,17 @@
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toRightOf="@+id/video_switch_iv"
app:roma_close="@drawable/roma_bus_p_bg_selector"
- app:roma_open="@drawable/iv_roma_bus_passenger_press_bg" />
+ app:roma_open="@drawable/bus_p_roma_checked" />
-
-
-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
+
{
override fun onSuccess(data: BaseData?) {
- DebugView.printInfoMsg("[开始任务] 请求success")
+ DebugView.printInfoMsg("[开始任务] 请求success,lindId=$lineId")
startAutoPilot() //自驾开启
d(TAG, "startTask onSuccess: data=${GsonUtil.jsonFromObject(data)}")
}
override fun onError() {
super.onError()
- if (!NetworkUtils.isConnected(mContext)){ // 网络异常,接口重试
+ if (!NetworkUtils.isConnected(mContext)) { // 网络异常,接口重试
ToastUtils.showShort("网络出现异常,请稍后重试")
- }else{
+ DebugView.printErrorMsg("[开始任务] 网络出现异常,请稍后重试")
+ } else {
ToastUtils.showShort("开始任务请求出现异常,请稍后重试")
+ DebugView.printErrorMsg("[开始任务] 开始任务请求出现异常,请稍后重试")
}
}
override fun onFail(code: Int, msg: String?) {
- DebugView.printErrorMsg("[开始任务] 请求fail, code=$code, msg=$msg")
+ DebugView.printErrorMsg("[开始任务] 请求fail, code=$code, msg=$msg, lindId=$lineId")
d(TAG, "startTask onFail: code=$code, msg=$msg")
- ToastUtils.showShort("开始任务请求出现异常,请稍后重试,code=$code, msg=$msg")
+ ToastUtils.showShort("开始任务请求出现异常,请稍后重试,code=$code, msg=$msg, lindId=$lineId")
}
})
}
@@ -951,12 +957,15 @@ object TaxiTaskModel {
val listener = it.value
listener.onStartPrepareTask120s(true)
}
- DebugView.printInfoMsg("[PrepareNextTask] 倒计时${TaxiUnmannedConst.TIMER_PREPARE_TASK_INTERVAL_120S/1000}秒后prepareNextTask, siteId=$siteId")
- UiThreadHandler.postDelayed(mPrepareTaskDelay120SRunnable, TaxiUnmannedConst.TIMER_PREPARE_TASK_INTERVAL_120S)
+ DebugView.printInfoMsg("[PrepareNextTask] 倒计时${TaxiUnmannedConst.TIMER_PREPARE_TASK_INTERVAL_120S / 1000}秒后prepareNextTask, siteId=$siteId")
+ UiThreadHandler.postDelayed(
+ mPrepareTaskDelay120SRunnable,
+ TaxiUnmannedConst.TIMER_PREPARE_TASK_INTERVAL_120S
+ )
}
fun removePrepareTaskDelay120S() {
- if (mPrepareTaskDelay120SRunnable != null){
+ if (mPrepareTaskDelay120SRunnable != null) {
DebugView.printInfoMsg("[PrepareNextTask] removeCallbacks, 取消prepareNextTask倒计时")
UiThreadHandler.removeCallbacks(mPrepareTaskDelay120SRunnable)
mTaxiTaskWithOrderCallbackMap.forEach {
@@ -1080,6 +1089,7 @@ object TaxiTaskModel {
paramIndexes = [-1]
)
fun startAutoPilot() {
+ DebugView.printInfoMsg("[启自驾] startAutoPilot")
if (!checkCurrentTaskCondition()) {
e(TAG, "no order or order is empty.")
DebugView.printErrorMsg("[启自驾] 当前订单不存在或异常!")
@@ -1129,8 +1139,7 @@ object TaxiTaskModel {
}
//在订单状态还没流转成功时, 点击了开启自驾按钮, 先去做状态流转成功再启动自驾
- if (mCurrentTaskWithOrder!!.currentStatus == TaskStatusEnum.GetTask.code){
- DebugView.printInfoMsg("[启自驾] startTask ${mCurrentTaskWithOrder!!.lineId}")
+ if (mCurrentTaskWithOrder!!.currentStatus == TaskStatusEnum.GetTask.code) {
startTask(mCurrentTaskWithOrder!!.lineId)
return
}
diff --git a/OCH/taxi/unmanned-passenger/src/main/res/layout/taxi_p_base_fragment.xml b/OCH/taxi/unmanned-passenger/src/main/res/layout/taxi_p_base_fragment.xml
index 264d62e0ae..4d18993fe7 100644
--- a/OCH/taxi/unmanned-passenger/src/main/res/layout/taxi_p_base_fragment.xml
+++ b/OCH/taxi/unmanned-passenger/src/main/res/layout/taxi_p_base_fragment.xml
@@ -79,15 +79,15 @@
app:roma_close="@drawable/roma_taxi_p_bg_selector"
app:roma_open="@drawable/taxi_p_roma_checked" />
-
-
-
-
-
-
-
-
-
+
-
+
diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/ConnectStatusView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/ConnectStatusView.kt
new file mode 100644
index 0000000000..b899aade12
--- /dev/null
+++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/ConnectStatusView.kt
@@ -0,0 +1,205 @@
+package com.mogo.eagle.core.function.hmi.ui.widget
+
+import android.content.Context
+import android.graphics.Color
+import android.util.AttributeSet
+import android.view.LayoutInflater
+import android.widget.RelativeLayout
+import com.mogo.commons.utils.MogoAnalyticUtils
+import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
+import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
+import com.mogo.eagle.core.function.hmi.R
+import com.mogo.eagle.core.utilcode.util.NetworkUtils
+import com.mogo.eagle.core.utilcode.util.NetworkUtils.OnNetworkStatusChangedListener
+import com.mogo.eagle.core.utilcode.util.SpanUtils
+import kotlinx.android.synthetic.main.view_connect_status.view.tvADASStatus
+import kotlinx.android.synthetic.main.view_connect_status.view.tvNetStatus
+
+/**
+ * 当前APP的各种连接状态展示
+ * 网络连接、ADAS、外网
+ */
+class ConnectStatusView @JvmOverloads constructor(
+ context: Context,
+ attrs: AttributeSet? = null,
+ defStyleAttr: Int = 0
+) : RelativeLayout(context, attrs, defStyleAttr), IMoGoAutopilotStatusListener {
+
+ companion object {
+ private const val TAG = "ConnectStatusView"
+ }
+
+ private var onNetworkStatusChangedListener: OnNetworkStatusChangedListener
+
+ // 断开网络的次数
+ private var disconnectNetCount = 0
+ private var disconnectNetTime = 0L
+
+ // 断开ADAS的次数
+ private var disconnectADASCount = 0
+ private var disconnectADASTime = 0L
+
+ init {
+ LayoutInflater.from(context).inflate(R.layout.view_connect_status, this, true)
+ val netSpan = SpanUtils.with(tvNetStatus)
+ netSpan.append("网络连接:")
+ if (NetworkUtils.isConnected()) {
+ netSpan.append("已连接")
+ .setForegroundColor(Color.GREEN)
+ } else {
+ disconnectNetCount++
+ netSpan.append("已断开")
+ .setForegroundColor(Color.RED)
+ netSpan.append("| 断链次数:")
+ .append("$disconnectNetCount")
+ .setForegroundColor(Color.RED)
+ }
+ netSpan.create()
+
+ onNetworkStatusChangedListener = object : OnNetworkStatusChangedListener {
+ override fun onDisconnected() {
+ disconnectNetCount++
+ disconnectNetTime = System.currentTimeMillis()
+ val netSpan = SpanUtils.with(tvNetStatus)
+ netSpan.append("网络连接:")
+ .append("已断开")
+ .setForegroundColor(Color.RED)
+ netSpan.append("| 断链次数:")
+ .append("$disconnectNetCount")
+ .setForegroundColor(Color.RED)
+ netSpan.create()
+ //netSpan.append("断开时常").append("$disconnectNetCount").setForegroundColor(Color.RED)
+
+ // 统计代码
+ val properties: MutableMap = HashMap()
+ properties["连接状态"] = "已断开"
+ properties["重连次数"] = "$disconnectNetCount"
+ MogoAnalyticUtils.track("SYS_NET_STATUS", properties)
+
+ }
+
+ override fun onConnected(networkType: NetworkUtils.NetworkType?) {
+ // 统计代码
+ val properties: MutableMap = HashMap()
+ properties["连接状态"] = "已连接"
+ properties["重连次数"] = "$disconnectNetCount"
+
+ val netSpan = SpanUtils.with(tvNetStatus)
+ netSpan.append("网络连接:")
+ .append("已连接")
+ .setForegroundColor(Color.GREEN)
+ netSpan.append("| 断链次数:")
+ .append("$disconnectNetCount")
+ .setForegroundColor(Color.RED)
+ if (disconnectNetTime != 0L) {
+ netSpan.append("| 断开时常:")
+ .append("${(System.currentTimeMillis() - disconnectNetTime) / 1000} s")
+ .setForegroundColor(Color.RED)
+ properties["断开时常"] =
+ "${(System.currentTimeMillis() - disconnectNetTime) / 1000} s"
+ }
+ netSpan.create()
+
+ MogoAnalyticUtils.track("SYS_NET_STATUS", properties)
+ }
+ }
+ }
+
+ override fun onAutopilotIpcConnectStatusChanged(status: Int, reason: String?) {
+ super.onAutopilotIpcConnectStatusChanged(status, reason)
+ tvADASStatus.post {
+ when (status) {
+ IPC_CONNECTION_STATUS.CONNECTED -> {
+ // 统计代码
+ val properties: MutableMap = HashMap()
+ properties["连接状态"] = "已连接"
+ properties["重连次数"] = "$disconnectADASCount"
+
+ val adasSpan = SpanUtils.with(tvADASStatus)
+ adasSpan.append("ADAS连接:")
+ .append("已连接")
+ .setForegroundColor(Color.GREEN)
+ adasSpan.append("| 重连次数:")
+ .append("$disconnectADASCount")
+ .setForegroundColor(Color.RED)
+
+ if (disconnectADASTime != 0L) {
+ adasSpan.append("| 断开时常:")
+ .append("${(System.currentTimeMillis() - disconnectADASTime) / 1000} s")
+ .setForegroundColor(Color.RED)
+ properties["断开时常"] =
+ "${(System.currentTimeMillis() - disconnectADASTime) / 1000} s"
+ }
+ adasSpan.create()
+
+ MogoAnalyticUtils.track("IPC_CONNECTION_STATUS", properties)
+ }
+
+ IPC_CONNECTION_STATUS.DISCONNECTED -> {
+ disconnectADASCount++
+ disconnectADASTime = System.currentTimeMillis()
+ val adasSpan = SpanUtils.with(tvADASStatus)
+
+ // 统计代码
+ val properties: MutableMap = HashMap()
+ properties["连接状态"] = "已连接"
+ properties["重连次数"] = "$disconnectADASCount"
+
+ MogoAnalyticUtils.track("IPC_CONNECTION_STATUS", properties)
+
+ adasSpan.append("ADAS连接:")
+ .append("已断开")
+ .setForegroundColor(Color.RED)
+
+ adasSpan.append("| 重连次数:")
+ .append("$disconnectADASCount")
+ .setForegroundColor(Color.RED)
+ adasSpan.create()
+ }
+ }
+ }
+ }
+
+ override fun onAttachedToWindow() {
+ super.onAttachedToWindow()
+ NetworkUtils.registerNetworkStatusChangedListener(onNetworkStatusChangedListener)
+ CallerAutoPilotStatusListenerManager.addListener(TAG, this)
+ }
+
+
+ override fun onDetachedFromWindow() {
+ super.onDetachedFromWindow()
+ NetworkUtils.unregisterNetworkStatusChangedListener(onNetworkStatusChangedListener)
+ CallerAutoPilotStatusListenerManager.removeListener(TAG)
+ }
+
+ interface IPC_CONNECTION_STATUS {
+ companion object {
+ /**
+ * 已连接
+ */
+ const val CONNECTED = 0x00
+
+ /**
+ * 未连接
+ */
+ const val DISCONNECTED = 0x01
+
+ /**
+ * 正在连接
+ */
+ const val CONNECTING = 0x02
+
+ /**
+ * 正在搜索IP
+ */
+ const val SEARCH_ADDRESS = 0x03
+
+ /**
+ * 找不到可用IP 传入的IP不可用或固定IP列表中所有IP不可用
+ */
+ const val NOT_FOUND_ADDRESS = 0x04
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/RomaDistanceView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/RomaDistanceView.kt
index c430936723..06166c9c46 100644
--- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/RomaDistanceView.kt
+++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/RomaDistanceView.kt
@@ -1,6 +1,9 @@
package com.mogo.eagle.core.function.hmi.ui.widget
import android.content.Context
+import android.os.Handler
+import android.os.Looper
+import android.os.Message
import android.text.Html
import android.util.AttributeSet
import android.util.Log
@@ -18,13 +21,33 @@ class RomaDistanceView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
-) : ConstraintLayout(context, attrs, defStyleAttr) , IMoGoRomaListener {
+) : ConstraintLayout(context, attrs, defStyleAttr), IMoGoRomaListener {
companion object {
private const val TAG = "RomaDistanceView"
}
private var disChangeColor = false
+ private var dis: Int = 0
+ private val mHandler = object : Handler(Looper.getMainLooper()) {
+ override fun handleMessage(msg: Message) {
+ super.handleMessage(msg)
+ if (msg.what == 1) {
+ if (dis != 0) {
+ if (romaDistanceBg.visibility == View.GONE) {
+ romaDistanceBg.visibility = View.VISIBLE
+ }
+ if (disChangeColor) {
+ romaDistanceMeter.text =
+ Html.fromHtml("漫游距离${dis}米")
+ } else {
+ romaDistanceMeter.text = "漫游距离${dis}米"
+ }
+ }
+ }
+ sendEmptyMessageDelayed(1, 1000)
+ }
+ }
init {
LayoutInflater.from(context).inflate(R.layout.view_roma_distance, this, true)
@@ -34,14 +57,16 @@ class RomaDistanceView @JvmOverloads constructor(
defStyleAttr,
0
)
-// val distanceBg = a.getResourceId(R.styleable.RomaDistanceView_roma_distance_bg,0)
-// if(distanceBg != 0){
-// romaDistanceBg.background = resources.getDrawable(distanceBg)
-// }
- val txtSize = a.getInteger(R.styleable.RomaDistanceView_roma_txt_size,35)
- romaDistanceMeter.setTextSize(TypedValue.COMPLEX_UNIT_PX,
- AutoSizeUtils.dp2px(getContext(),txtSize.toFloat()).toFloat())
- val txtDisColor = a.getBoolean(R.styleable.RomaDistanceView_roma_change_dis_color,false)
+ val distanceBg = a.getResourceId(R.styleable.RomaDistanceView_roma_distance_bg, 0)
+ if (distanceBg != 0) {
+ romaDistanceBg.background = resources.getDrawable(distanceBg)
+ }
+ val txtSize = a.getInteger(R.styleable.RomaDistanceView_roma_txt_size, 35)
+ romaDistanceMeter.setTextSize(
+ TypedValue.COMPLEX_UNIT_PX,
+ AutoSizeUtils.dp2px(getContext(), txtSize.toFloat()).toFloat()
+ )
+ val txtDisColor = a.getBoolean(R.styleable.RomaDistanceView_roma_change_dis_color, false)
disChangeColor = txtDisColor
a.recycle()
}
@@ -54,22 +79,19 @@ class RomaDistanceView @JvmOverloads constructor(
override fun romaStatus(status: Boolean) {
super.romaStatus(status)
if (status) {
- romaDistanceBg.visibility = View.VISIBLE
+ mHandler.sendEmptyMessageDelayed(1, 500)
} else {
+ mHandler.removeMessages(1)
romaDistanceBg.visibility = View.GONE
romaDistanceMeter.text = ""
+ dis = 0
}
}
override fun romaDistance(distance: String) {
super.romaDistance(distance)
- val dis = distance.toDouble().toInt()
- Log.i(TAG, "romaDistance:$distance")
- if(disChangeColor){
- romaDistanceMeter.text = Html.fromHtml("漫游距离${dis}米")
- }else{
- romaDistanceMeter.text = "漫游距离${dis}米"
- }
+ dis = distance.toDouble().toInt()
+ Log.i(TAG, "romaDistance:$dis")
}
override fun onDetachedFromWindow() {
diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/module_main_activity_main.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/module_main_activity_main.xml
index 0b1e1b60cd..e5ef718f8c 100644
--- a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/module_main_activity_main.xml
+++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/module_main_activity_main.xml
@@ -37,4 +37,11 @@
android:layout_height="680dp"
android:layout_gravity="bottom" />
+
+
+
\ No newline at end of file
diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_connect_status.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_connect_status.xml
new file mode 100644
index 0000000000..767fe29dce
--- /dev/null
+++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_connect_status.xml
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_roma_distance.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_roma_distance.xml
index 621006cb4e..8628349a0b 100644
--- a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_roma_distance.xml
+++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_roma_distance.xml
@@ -9,9 +9,8 @@
android:id="@+id/romaDistanceMeter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_marginTop="@dimen/dp_20"
android:layout_gravity="center_horizontal"
- android:gravity="center_horizontal"
+ android:gravity="center"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"