[2.13.0-arch-opt] merge 2.14.0 line id func

This commit is contained in:
zhongchao
2023-02-14 15:17:40 +08:00
parent 5f363baab6
commit 4f25b0fd43
15 changed files with 171 additions and 1 deletions

View File

@@ -334,6 +334,11 @@ public class BusPassengerModel {
private final IMoGoAutopilotStatusListener mGoAutopilotStatusListener = new IMoGoAutopilotStatusListener(){
@Override
public void onAutopilotRouteLineId(long lineId) {
}
@Override
public void onAutopilotIpcConnectStatusChanged(int status, @Nullable String reason) {
}

View File

@@ -267,6 +267,11 @@ public class BusPresenter extends Presenter<BusFragment>
onAutopilotStatusResponse(info);
}
@Override
public void onAutopilotRouteLineId(long lineId) {
}
@Override
public void onAutopilotGuardian(MogoReportMsg.MogoReportMessage guardianInfo) {
BusTrajectoryManager.getInstance().onAutopilotGuardian(guardianInfo);

View File

@@ -161,6 +161,11 @@ public class SweeperPresenter extends Presenter<SweeperFragment>
}
@Override
public void onAutopilotRouteLineId(long lineId) {
}
@Override
public void onAutopilotStatusResponse(@NotNull AutopilotStatusInfo autopilotStatusInfo) {
if (autopilotStatusInfo == null) return;

View File

@@ -499,6 +499,10 @@ public class TaxiPassengerModel implements IOCHTaxiPassengerNaviChangedCallback
private final IMoGoAutopilotStatusListener mGoAutopilotStatusListener = new IMoGoAutopilotStatusListener(){
@Override
public void onAutopilotRouteLineId(long lineId) {
}
@Override
public void onAutopilotIpcConnectStatusChanged(int status, @Nullable String reason) {

View File

@@ -1144,6 +1144,11 @@ public class TaxiModel {
private final IMoGoAutopilotStatusListener mGoAutopilotStatusListener = new IMoGoAutopilotStatusListener() {
@Override
public void onAutopilotRouteLineId(long lineId) {
}
@Override
public void onAutopilotIpcConnectStatusChanged(int status, @Nullable String reason) {
}

View File

@@ -4,15 +4,18 @@ import android.content.Context
import com.alibaba.android.arouter.facade.annotation.Route
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
import com.mogo.eagle.core.data.camera.CameraEntity
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.data.constants.MogoServicePaths
import com.mogo.eagle.core.function.api.biz.IMoGoFuncBizProvider
import com.mogo.eagle.core.function.api.biz.IMoGoNoticeNetCallBack
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
import com.mogo.eagle.function.biz.dispatch.DispatchAutoPilotManager.Companion.dispatchAutoPilotManager
import com.mogo.eagle.function.biz.monitoring.CronTaskManager.Companion.cronTaskManager
import com.mogo.eagle.function.biz.notice.NoticeSocketManager.Companion.noticeSocketManager
import com.mogo.eagle.function.biz.notice.network.NoticeNetWorkManager
import com.mogo.eagle.function.biz.v2x.overview.OverViewDataManager
import com.mogo.eagle.function.biz.v2x.overview.db.OverviewDb
import com.mogo.eagle.function.biz.v2x.road.LineUploadManager
import com.mogo.eagle.function.biz.v2x.trafficlight.core.MogoTrafficLightManager
import com.mogo.eagle.function.biz.v2x.vip.VipCarManager
@@ -22,13 +25,19 @@ class FuncBizProvider : IMoGoFuncBizProvider {
override val functionName: String
get() = "FuncBiz"
private var mContext:Context? = null
override fun init(context: Context) {
mContext = context
noticeSocketManager.init(context)
dispatchAutoPilotManager.init(context)
cronTaskManager.startCronTask()
OverviewDb.getDb(context)
MogoTrafficLightManager.INSTANCE.initServer(context)
VipCarManager.INSTANCE.initServer(context)
if(AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)){
LineUploadManager.getInstance(context)?.init()
}
// RedLightWarningManager.INSTANCE.listenTrafficLight()
}
@@ -81,6 +90,11 @@ class FuncBizProvider : IMoGoFuncBizProvider {
cronTaskManager.release()
VipCarManager.INSTANCE.destroy()
if(AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)){
mContext?.let {
LineUploadManager.getInstance(it)?.onDestroy()
}
}
// RedLightWarningManager.INSTANCE.onDestroy()
}
}

View File

@@ -0,0 +1,16 @@
package com.mogo.eagle.function.biz.v2x.road
import com.mogo.eagle.core.data.BaseData
import com.mogo.eagle.core.data.v2x.LineUploadData
import io.reactivex.Observable
import retrofit2.http.Body
import retrofit2.http.Headers
import retrofit2.http.POST
interface ILineUploadApi {
@Headers("Content-type:application/json;charset=UTF-8" )
@POST( "" )
fun uploadLineId(@Body lineId: LineUploadData): Observable<BaseData>
}

View File

@@ -0,0 +1,75 @@
package com.mogo.eagle.function.biz.v2x.road
import android.content.Context
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
import com.mogo.commons.constants.HostConst.DATA_CENTER_HOST
import com.mogo.eagle.core.data.v2x.LineUploadData
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
import com.mogo.eagle.core.network.MoGoRetrofitFactory
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.disposables.Disposable
import io.reactivex.schedulers.Schedulers
class LineUploadManager private constructor(context: Context) : IMoGoAutopilotStatusListener {
companion object {
private const val TAG = "LineUploadManager"
@Volatile
private var lineUploadManager: LineUploadManager? = null
@Synchronized
fun getInstance(context: Context): LineUploadManager? {
if (lineUploadManager == null) {
synchronized(LineUploadManager::class.java) {
if (lineUploadManager == null) {
lineUploadManager = LineUploadManager(context)
}
}
}
return lineUploadManager
}
}
private var mContext: Context? = null
private var disposable: Disposable? = null
init {
mContext = context
}
fun init() {
CallerAutoPilotStatusListenerManager.addListener(TAG, this)
}
override fun onAutopilotRouteLineId(lineId: Long) {
super.onAutopilotRouteLineId(lineId)
if (lineId > 0) {
uploadLine(lineId)
}
}
private fun uploadLine(lineId: Long) {
val lineUploadData = LineUploadData(lineId, MoGoAiCloudClientConfig.getInstance().sn)
disposable = MoGoRetrofitFactory.getInstance(DATA_CENTER_HOST)
.create(ILineUploadApi::class.java)
.uploadLineId(lineUploadData)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe({ data ->
CallerLogger.d(TAG, " uploadLine : $data")
}, {
CallerLogger.d(TAG, "e : ${it.message}")
})
}
fun onDestroy() {
mContext = null
disposable?.dispose()
CallerAutoPilotStatusListenerManager.removeListener(TAG)
}
}

View File

@@ -104,6 +104,11 @@ public class SteeringWheelView extends ConstraintLayout implements
private final IMoGoAutopilotStatusListener mGoAutopilotStatusListener = new IMoGoAutopilotStatusListener() {
@Override
public void onAutopilotRouteLineId(long lineId) {
}
@Override
public void onAutopilotIpcConnectStatusChanged(int status, @Nullable String reason) {
}

View File

@@ -71,6 +71,7 @@
<declare-styleable name="SteeringBrakeView">
<attr name="day_light_mode" format="boolean"/>
<attr name="brakeView" format="boolean"/>
</declare-styleable>
<declare-styleable name="PncActionsView">

View File

@@ -126,4 +126,9 @@ public class MogoRouteOverlayManager implements
@Override
public void onAutopilotStatusRespByQuery(@NonNull SystemStatusInfo.StatusInfo status) {
}
@Override
public void onAutopilotRouteLineId(long lineId) {
}
}

View File

@@ -0,0 +1,6 @@
package com.mogo.eagle.core.data.v2x
/**
* 路线上报
*/
data class LineUploadData(val lineId:Long,val sn:String)

View File

@@ -44,7 +44,12 @@ interface IMoGoAutopilotStatusListener {
/**
* 工控机主动查询 AdasManager#sendStatusQueryReq(),后会收到如下回调
*/
fun onAutopilotStatusRespByQuery(status: SystemStatusInfo.StatusInfo) { }
fun onAutopilotStatusRespByQuery(status: SystemStatusInfo.StatusInfo) {}
/**
* 自动驾驶路线ID回调
*/
fun onAutopilotRouteLineId(lineId: Long){}
companion object {
/**

View File

@@ -7,6 +7,9 @@ import com.mogo.eagle.core.function.call.base.CallerBase
import com.mogo.eagle.core.utilcode.util.GsonUtils
import mogo.telematics.pad.MessagePad
import mogo_msg.MogoReportMsg
import system_master.*
import java.util.concurrent.ConcurrentHashMap
import kotlin.properties.Delegates
import system_master.SystemStatusInfo
/**
@@ -20,6 +23,20 @@ object CallerAutoPilotStatusListenerManager : CallerBase<IMoGoAutopilotStatusLis
@Volatile
private var mAutopilotStatusInfo: AutopilotStatusInfo = AutopilotStatusInfo()
private var lineId: Long? by Delegates.observable(0) { _, _, newValue ->
if(newValue == null){
return@observable
}
M_AUTOPILOT_STATUS_LISTENERS.forEach {
val listener = it.value
listener.onAutopilotRouteLineId(newValue)
}
}
// 存储所有注册了监听的对象invokeXXXX进行遍历回调将信息同步
private val M_AUTOPILOT_STATUS_LISTENERS: ConcurrentHashMap<String, IMoGoAutopilotStatusListener> =
ConcurrentHashMap()
@Volatile
private var autoPilotMessageCode: String = ""
@@ -167,6 +184,7 @@ object CallerAutoPilotStatusListenerManager : CallerBase<IMoGoAutopilotStatusLis
*/
fun updateAutopilotControlParameters(autopilotControlParameters: AutopilotControlParameters? = null) {
mAutopilotStatusInfo.autopilotControlParameters = autopilotControlParameters
lineId = autopilotControlParameters?.autoPilotLine?.lineId
invokeAutoPilotStatus(mAutopilotStatusInfo)
}
}

View File

@@ -12,6 +12,7 @@ public class HostConst {
public static final String CAMERA_STREAM_HOST = "http://dzt-smartTransportationAiCloud.zhidaozhixing.com";
public static final String OPEN_CAMERA_STREAM_HOST = "http://10.0.16.6:18080";
public static final String DATA_CENTER_HOST = "http://dzt-data-center.zhidaozhixing.com";
public static final String CITY_HOST = "http://dzt-city.zhidaozhixing.com";
public static final String SOCKET_CENTER_DOMAIN = "socketRegion";