Merge branch 'dev_arch_opt_3.0' into 'dev_robobus-m1-p-app-module_1.0.0_230112_1.0.0'
Dev arch opt 3.0 See merge request zhjt/AndroidApp/MoGoEagleEye!520
This commit is contained in:
@@ -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()
|
||||
}
|
||||
}
|
||||
@@ -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>
|
||||
|
||||
}
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import android.content.Context
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.mogo.eagle.core.data.constants.MogoServicePaths
|
||||
import com.mogo.eagle.core.function.api.telematic.IMogoTelematicProvider
|
||||
import com.mogo.telematic.MogoProtocolMsg
|
||||
import com.mogo.telematic.NSDNettyManager
|
||||
|
||||
@Route(path = MogoServicePaths.PATH_TELEMATIC_PROVIDER)
|
||||
@@ -26,4 +27,16 @@ class MoGoTelematicProvider: IMogoTelematicProvider {
|
||||
override fun getServerToken(): String {
|
||||
return NSDNettyManager.getInstance().serverSn
|
||||
}
|
||||
|
||||
override fun sendMsgToAllClients(type: Int, byteArray: ByteArray) {
|
||||
NSDNettyManager.getInstance().sendMsgToAllClients(
|
||||
MogoProtocolMsg(type, byteArray.size, byteArray)
|
||||
)
|
||||
}
|
||||
|
||||
override fun sendMsgToServer(type: Int, byteArray: ByteArray) {
|
||||
NSDNettyManager.getInstance().sendMogoProtocolMsgToServer(
|
||||
MogoProtocolMsg(type, byteArray.size, byteArray),
|
||||
null)
|
||||
}
|
||||
}
|
||||
@@ -8,10 +8,12 @@ import com.mogo.eagle.core.data.app.AppConfigInfo
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.data.deva.chain.ChainConstant
|
||||
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_LINK_LOG_CONNECT_STATUS
|
||||
import com.mogo.eagle.core.data.telematic.TelematicConstant
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager.setDemoMode
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager.setIgnoreConditionDraw
|
||||
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager
|
||||
import com.mogo.eagle.core.function.call.telematic.CallerTelematicListenerManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.*
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||
@@ -122,6 +124,9 @@ class TeleMsgHandler : IMsgHandler {
|
||||
}
|
||||
}
|
||||
}
|
||||
TelematicConstant.BUSINESS_STRING -> {
|
||||
CallerTelematicListenerManager.invokeReceivedMsg(TelematicConstant.BUSINESS_STRING, it.body)
|
||||
}
|
||||
else -> {
|
||||
}
|
||||
}
|
||||
@@ -166,6 +171,9 @@ class TeleMsgHandler : IMsgHandler {
|
||||
invokeNettyConnResult("司机屏SN未获取到,不发送给乘客屏")
|
||||
}
|
||||
}
|
||||
TelematicConstant.BUSINESS_STRING -> {
|
||||
CallerTelematicListenerManager.invokeReceivedMsg(TelematicConstant.BUSINESS_STRING, it.body)
|
||||
}
|
||||
else -> {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
}
|
||||
|
||||
@@ -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">
|
||||
|
||||
@@ -126,4 +126,9 @@ public class MogoRouteOverlayManager implements
|
||||
@Override
|
||||
public void onAutopilotStatusRespByQuery(@NonNull SystemStatusInfo.StatusInfo status) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotRouteLineId(long lineId) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user