:wq
[3.4.0] fix bug of ui in pnc action view and door status invoke, remove dispatch upload autopilot status
This commit is contained in:
@@ -15,7 +15,6 @@ import com.mogo.eagle.core.function.api.autopilot.IMoGoPlanningRottingListener
|
||||
import com.mogo.eagle.core.function.api.hmi.autopilot.IMoGoCheckAutoPilotBtnListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.getState
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerPlanningRottingListenerManager
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiListenerManager
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
|
||||
@@ -49,8 +48,7 @@ class DispatchAutoPilotManager private constructor() :
|
||||
|
||||
private const val MSG_SOCKET_TYPE = 501000
|
||||
private const val MSG_TYPE_SHOW_DIALOG = 0
|
||||
private const val MSG_TYPE_UPLOAD_AUTOPILOT_STATUS = 1
|
||||
private const val MSG_TYPE_UPLOAD_AUTOPILOT_ROTTING = 2
|
||||
private const val MSG_TYPE_UPLOAD_AUTOPILOT_ROTTING = 1
|
||||
|
||||
val dispatchAutoPilotManager by lazy(LazyThreadSafetyMode.SYNCHRONIZED) {
|
||||
DispatchAutoPilotManager()
|
||||
@@ -72,9 +70,6 @@ class DispatchAutoPilotManager private constructor() :
|
||||
val msgData: DispatchAdasAutoPilotLocReceiverBean =
|
||||
msg.obj as DispatchAdasAutoPilotLocReceiverBean
|
||||
CallerHmiManager.showDispatchDialog(msgData)
|
||||
} else if (msg.what == MSG_TYPE_UPLOAD_AUTOPILOT_STATUS) {
|
||||
dispatchServiceModel.uploadAutopilotStatus(getState(), "")
|
||||
sendEmptyMessageDelayed(MSG_TYPE_UPLOAD_AUTOPILOT_STATUS, 1000L)
|
||||
} else if(msg.what == MSG_TYPE_UPLOAD_AUTOPILOT_ROTTING){
|
||||
val data = msg.obj as MessagePad.GlobalPathResp
|
||||
val list: MutableList<AutopilotRouteInfo.RouteModels> = ArrayList()
|
||||
@@ -99,7 +94,6 @@ class DispatchAutoPilotManager private constructor() :
|
||||
CallerPlanningRottingListenerManager.addListener(TAG, this)
|
||||
// 添加 ADAS状态 监听
|
||||
CallerAutoPilotStatusListenerManager.addListener(TAG, this)
|
||||
handler.sendEmptyMessageDelayed(MSG_TYPE_UPLOAD_AUTOPILOT_STATUS, 1000L)
|
||||
}
|
||||
|
||||
fun release() {
|
||||
|
||||
@@ -5,7 +5,6 @@ import com.mogo.commons.constants.HostConst
|
||||
import com.mogo.commons.context.ContextHolderUtil
|
||||
import com.mogo.eagle.core.data.BaseData
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotRouteInfo.RouteModels
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotStatus
|
||||
import com.mogo.eagle.core.data.biz.dispatch.ReportDispatchResult
|
||||
import com.mogo.eagle.core.data.biz.dispatch.ReportedRoute
|
||||
import com.mogo.eagle.core.network.MoGoRetrofitFactory
|
||||
@@ -38,43 +37,6 @@ class DispatchServiceModel private constructor() {
|
||||
IDispatchAdasApiService::class.java
|
||||
)
|
||||
|
||||
/**
|
||||
* 上报自动驾驶状态
|
||||
*/
|
||||
fun uploadAutopilotStatus(state: Int, reason: String?) {
|
||||
val autopilotStatus = AutopilotStatus()
|
||||
autopilotStatus.action = "autopilotstate"
|
||||
val valuesBean = AutopilotStatus.ValuesBean()
|
||||
valuesBean.state = state
|
||||
valuesBean.reason = reason
|
||||
autopilotStatus.values = valuesBean
|
||||
val sn = MoGoAiCloudClientConfig.getInstance().sn
|
||||
val reportedRoute = ReportedRoute(
|
||||
sn,
|
||||
autopilotStatus.values
|
||||
)
|
||||
val map: MutableMap<String, Any> = HashMap()
|
||||
map["sn"] = sn
|
||||
map["data"] = GsonUtil.jsonFromObject(reportedRoute)
|
||||
mAdasApiService.uploadAutopilotState(map)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(object :
|
||||
SubscribeImpl<BaseData>(RequestOptions.create(ContextHolderUtil.getContext())) {
|
||||
override fun onNext(o: BaseData) {
|
||||
super.onNext(o)
|
||||
}
|
||||
|
||||
override fun onError(e: Throwable) {
|
||||
super.onError(e)
|
||||
}
|
||||
|
||||
override fun onSuccess(o: BaseData) {
|
||||
super.onSuccess(o)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 上报自动驾驶路线
|
||||
*
|
||||
|
||||
@@ -27,13 +27,4 @@ interface IDispatchAdasApiService {
|
||||
@POST("eagle-eye-dns/dataService/autoDriver/receiverDestSiteResult")
|
||||
fun uploadDispatchResult(@FieldMap parameters: MutableMap<String, Any>): Observable<BaseData>
|
||||
|
||||
/**
|
||||
* 上报自动驾驶状态 服务于业务调度
|
||||
*
|
||||
* @param parameters map
|
||||
* @return [BaseData]
|
||||
*/
|
||||
@FormUrlEncoded
|
||||
@POST("eagle-eye-dns/dataService/autoDriver/receiveAutopilotState")
|
||||
fun uploadAutopilotState(@FieldMap parameters: MutableMap<String, Any>): Observable<BaseData>
|
||||
}
|
||||
@@ -44,6 +44,7 @@ class MogoTrafficLightManager : IMoGoChassisLocationGCJ02Listener {
|
||||
|
||||
private var mThreadHandler: Handler? = null
|
||||
|
||||
//todo 优化looper,需要考虑回调数据线程同步
|
||||
fun initServer(context: Context) {
|
||||
mContext = context
|
||||
CallerChassisLocationGCJ02ListenerManager.addListener(TAG, this)
|
||||
|
||||
@@ -26,14 +26,12 @@ class TrafficLightNetWorkModel {
|
||||
onError: ((String) -> Unit),
|
||||
) {
|
||||
request<BaseResponse<RoadIDResult>>("requestRoadID") {
|
||||
val map = hashMapOf<String, String>()
|
||||
start {
|
||||
val roadIDRequestData = RoadIDRequestData(tileID, lat, lon, bearing)
|
||||
map["sn"] = MoGoAiCloudClientConfig.getInstance().sn
|
||||
map["data"] = GsonUtils.toJson(roadIDRequestData)
|
||||
}
|
||||
loader {
|
||||
apiCall {
|
||||
val map = hashMapOf<String, String>()
|
||||
val roadIDRequestData = RoadIDRequestData(tileID, lat, lon, bearing)
|
||||
map["sn"] = MoGoAiCloudClientConfig.getInstance().sn
|
||||
map["data"] = GsonUtils.toJson(roadIDRequestData)
|
||||
getNetWorkApi().getFrontRoadID(map)
|
||||
}
|
||||
}
|
||||
@@ -74,12 +72,12 @@ class TrafficLightNetWorkModel {
|
||||
if (roadId == null) {
|
||||
return@start
|
||||
}
|
||||
val trafficLightRequestData = TrafficLightRequestData(lat, lon, bearing, roadId)
|
||||
map["sn"] = MoGoAiCloudClientConfig.getInstance().sn
|
||||
map["data"] = GsonUtils.toJson(trafficLightRequestData)
|
||||
}
|
||||
loader {
|
||||
apiCall {
|
||||
val trafficLightRequestData = TrafficLightRequestData(lat, lon, bearing, roadId!!)
|
||||
map["sn"] = MoGoAiCloudClientConfig.getInstance().sn
|
||||
map["data"] = GsonUtils.toJson(trafficLightRequestData)
|
||||
getNetWorkApi().getTrafficLight(map)
|
||||
}
|
||||
}
|
||||
@@ -112,14 +110,12 @@ class TrafficLightNetWorkModel {
|
||||
) {
|
||||
request<BaseResponse<TrafficLightControl>> {
|
||||
val map = hashMapOf<String, String>()
|
||||
start {
|
||||
val trafficLightRequestData =
|
||||
ChangeLightRequestData(lightId, crossingNo, heading, controlTime)
|
||||
map["sn"] = MoGoAiCloudClientConfig.getInstance().sn
|
||||
map["data"] = GsonUtils.toJson(trafficLightRequestData)
|
||||
}
|
||||
loader {
|
||||
apiCall {
|
||||
val trafficLightRequestData =
|
||||
ChangeLightRequestData(lightId, crossingNo, heading, controlTime)
|
||||
map["sn"] = MoGoAiCloudClientConfig.getInstance().sn
|
||||
map["data"] = GsonUtils.toJson(trafficLightRequestData)
|
||||
getNetWorkApi().changeLight(map)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,7 +40,6 @@ class PncActionsView @JvmOverloads constructor(
|
||||
private var mTrafficLightResult: TrafficLightResult? = null
|
||||
|
||||
private val bgResources: Int
|
||||
private val topMargin: Float
|
||||
private val txtSize: Float
|
||||
|
||||
init {
|
||||
@@ -50,10 +49,6 @@ class PncActionsView @JvmOverloads constructor(
|
||||
R.styleable.PncActionsView_background_resource,
|
||||
R.drawable.pnc_actions_bg
|
||||
)
|
||||
topMargin = a.getDimension(
|
||||
R.styleable.PncActionsView_pnc_top_margin,
|
||||
resources.getDimension(R.dimen.dp_30)
|
||||
)
|
||||
txtSize = a.getDimension(
|
||||
R.styleable.PncActionsView_pnc_size,
|
||||
resources.getDimension(R.dimen.dp_34)
|
||||
@@ -63,7 +58,6 @@ class PncActionsView @JvmOverloads constructor(
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
(tvHmiPncActions.layoutParams as MarginLayoutParams).topMargin = topMargin.toInt()
|
||||
tvHmiPncActions.setTextSize(COMPLEX_UNIT_PX, txtSize)
|
||||
|
||||
CallerAutoPilotStatusListenerManager.addListener(TAG, this)
|
||||
@@ -81,7 +75,7 @@ class PncActionsView @JvmOverloads constructor(
|
||||
override fun onAutopilotStatusResponse(state: Int) {
|
||||
if (state != STATUS_AUTOPILOT_RUNNING) {
|
||||
UiThreadHandler.post {
|
||||
this.background = null
|
||||
tvHmiPncActions.background = null
|
||||
tvHmiPncActions.text = ""
|
||||
}
|
||||
}
|
||||
@@ -117,15 +111,15 @@ class PncActionsView @JvmOverloads constructor(
|
||||
}
|
||||
// update view
|
||||
if (actions.isNullOrEmpty()) {
|
||||
this.background = null
|
||||
tvHmiPncActions.background = null
|
||||
tvHmiPncActions.text = ""
|
||||
} else {
|
||||
this.background =
|
||||
tvHmiPncActions.background =
|
||||
AppCompatResources.getDrawable(context, bgResources)
|
||||
tvHmiPncActions.text = actions
|
||||
}
|
||||
} else {
|
||||
this.background = null
|
||||
tvHmiPncActions.background = null
|
||||
tvHmiPncActions.text = ""
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,12 +2,15 @@
|
||||
<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="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvHmiPncActions"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingStart="@dimen/dp_70"
|
||||
android:paddingBottom="@dimen/dp_5"
|
||||
android:paddingEnd="@dimen/dp_70"
|
||||
android:gravity="center"
|
||||
android:textColor="#FFFFFF"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
|
||||
@@ -85,7 +85,6 @@
|
||||
|
||||
<declare-styleable name="PncActionsView">
|
||||
<attr name="background_resource" format="reference"/>
|
||||
<attr name="pnc_top_margin" format="dimension"/>
|
||||
<attr name="pnc_size" format="dimension"/>
|
||||
</declare-styleable>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user