merge
This commit is contained in:
@@ -5,22 +5,24 @@ import android.content.Context
|
||||
import androidx.annotation.RequiresPermission
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotControlCmdParameter
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters
|
||||
import com.mogo.eagle.core.data.autopilot.toRouteInfo
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.data.constants.MoGoConfig
|
||||
import com.mogo.eagle.core.data.constants.MogoServicePaths
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_ADAS_IMPL
|
||||
import com.mogo.eagle.core.data.trafficlight.TrafficLightResult
|
||||
import com.mogo.eagle.core.data.trafficlight.toTrafficLightDetail
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotProvider
|
||||
import com.mogo.eagle.core.function.api.map.collect.IMoGoMapDataCollectProvider
|
||||
import com.mogo.eagle.core.function.autopilot.adapter.MoGoAdasListenerImpl
|
||||
import com.mogo.eagle.core.function.autopilot.adapter.MoGoAdasMsgConnectStatusListenerImpl
|
||||
import com.mogo.eagle.core.function.autopilot.adapter.MoGoHandAdasMsgManager
|
||||
import com.mogo.eagle.core.function.autopilot.server.AsyncDataToAutopilotServer
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapDataCollectorManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
|
||||
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr
|
||||
import com.mogo.eagle.core.utilcode.util.GsonUtils
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||
import com.mogo.telematic.MogoProtocolMsg
|
||||
@@ -35,7 +37,6 @@ import com.zhidao.support.adas.high.bean.IPCUpgradeInfo
|
||||
import com.zhidao.support.adas.high.common.Constants
|
||||
import com.zhidao.support.adas.high.common.CupidLogUtils
|
||||
import io.netty.channel.Channel
|
||||
import java.util.*
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
|
||||
@@ -54,47 +55,44 @@ class MoGoAutopilotProvider :
|
||||
get() = TAG
|
||||
|
||||
override fun init(context: Context) {
|
||||
MoGoHandAdasMsgManager.getInstance();
|
||||
Logger.d(TAG, "初始化工控机连接……")
|
||||
MoGoHandAdasMsgManager.getInstance()
|
||||
CallerLogger.i("$M_ADAS_IMPL$TAG", "初始化工控机连接……")
|
||||
mContext = context
|
||||
// 初始化ADAS 域控制器
|
||||
CupidLogUtils.setEnableLog(false)
|
||||
CupidLogUtils.setIsWriteLog(false)
|
||||
// TODO 临时方案,根据不同的身份标识,连接不同的工控机IP
|
||||
if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {// 司机
|
||||
// 注册地图采集功能
|
||||
CallerMapDataCollectorManager.registerOnMapCollectTaskListener(this)
|
||||
// "192.168.1.102"
|
||||
val options = AdasOptions.Builder()
|
||||
.setIpcConnectionMode(AdasOptions.IPC_CONNECTION_MODE.FIXATION)
|
||||
.setIpcFixationIP(AdasManager.getInstance().getIPCFixationIPList(mContext))
|
||||
.setClient(false)
|
||||
.build()
|
||||
.setIpcConnectionMode(AdasOptions.IPC_CONNECTION_MODE.FIXATION)
|
||||
.setIpcFixationIP(AdasManager.getInstance().getIPCFixationIPList(mContext))
|
||||
.setClient(false)
|
||||
.build()
|
||||
|
||||
AdasManager.getInstance().create(context, options)
|
||||
AdasManager.getInstance().create(options, MoGoAdasMsgConnectStatusListenerImpl())
|
||||
NSDNettyManager.getInstance().startNSDNettyServerWithSN(context, object :
|
||||
NettyServerListener<MogoProtocolMsg> {
|
||||
override fun onMessageResponseServer(msg: MogoProtocolMsg?, channel: Channel?) {
|
||||
Logger.d(TAG, "Receive client data is:${msg?.toString()}")
|
||||
CallerLogger.d("$M_ADAS_IMPL$TAG", "Receive client data is:${msg?.toString()}")
|
||||
}
|
||||
|
||||
override fun onStartServer() {
|
||||
ToastUtils.showShort("司机端服务启动成功!")
|
||||
Logger.d(TAG, "onStartServer")
|
||||
}
|
||||
|
||||
override fun onStopServer() {
|
||||
ToastUtils.showLong("司机端服务停止!")
|
||||
Logger.d(TAG, "onStopServer")
|
||||
}
|
||||
|
||||
override fun onChannelConnect(channel: Channel?) {
|
||||
val socketAddress = channel?.remoteAddress().toString()
|
||||
Logger.d(TAG, "Client ip is:${socketAddress}")
|
||||
CallerLogger.d("$M_ADAS_IMPL$TAG", "Client ip is:${socketAddress}")
|
||||
}
|
||||
|
||||
override fun onChannelDisConnect(channel: Channel?) {
|
||||
Logger.d(TAG, "onChannelDisConnect")
|
||||
CallerLogger.d("$M_ADAS_IMPL$TAG", "onChannelDisConnect")
|
||||
}
|
||||
}, MoGoAiCloudClientConfig.getInstance().sn)
|
||||
} else {
|
||||
@@ -103,39 +101,38 @@ class MoGoAutopilotProvider :
|
||||
//FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData = true
|
||||
// "192.168.1.103"
|
||||
val options = AdasOptions
|
||||
.Builder()
|
||||
.setClient(true)
|
||||
.build()
|
||||
AdasManager.getInstance().create(context, options)
|
||||
.Builder()
|
||||
.setClient(true)
|
||||
.build()
|
||||
AdasManager.getInstance().create(options, MoGoAdasMsgConnectStatusListenerImpl())
|
||||
NSDNettyManager.getInstance()
|
||||
.searchAndConnectServer(context, MoGoAiCloudClientConfig.getInstance().sn, object :
|
||||
NettyClientListener<MogoProtocolMsg> {
|
||||
override fun onMessageResponseClient(msg: MogoProtocolMsg?, sign: String?) {
|
||||
Logger.d(TAG, "收到司机端的数据!")
|
||||
// 乘客端收到adas数据直接解析,后续分发解析后的数据流程同司机端
|
||||
msg?.let {
|
||||
AdasManager.getInstance().parseIPCData(it.body)
|
||||
Logger.d(TAG, "解析司机端数据完毕!")
|
||||
}
|
||||
}
|
||||
|
||||
override fun onClientStatusConnectChanged(statusCode: Int, sign: String?) {
|
||||
when (statusCode) {
|
||||
ConnectState.STATUS_CONNECT_SUCCESS -> {
|
||||
Logger.d(TAG, "乘客端连接司机端服务成功! sign is:${sign}")
|
||||
CallerLogger.d("$M_ADAS_IMPL$TAG", "乘客端连接司机端服务成功! sign is:${sign}")
|
||||
}
|
||||
else -> {
|
||||
ToastUtils.showLong("和司机端连接异常!")
|
||||
Logger.d(TAG, "client statusCode is:${statusCode}")
|
||||
CallerLogger.d(
|
||||
"$M_ADAS_IMPL$TAG",
|
||||
"client statusCode is:${statusCode}"
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
//////////////////////////////////注意先后顺序,AdasManager.getInstance().create后才可以设置监听/////////////////////////////////////////////
|
||||
// 监听 adas 连接状态
|
||||
AdasManager.getInstance()
|
||||
.setOnAdasConnectStatusListener(MoGoAdasMsgConnectStatusListenerImpl())
|
||||
|
||||
// 监听ADAS-SDK获取到的工控机数据(乘客也需注册)
|
||||
AdasManager.getInstance().setOnAdasListener(MoGoAdasListenerImpl())
|
||||
// 司机端监听
|
||||
@@ -143,17 +140,15 @@ class MoGoAutopilotProvider :
|
||||
AdasManager.getInstance().setOnMultiDeviceListener { bytes ->
|
||||
// 发送数据给乘客端
|
||||
if (NSDNettyManager.getInstance().isServerStart) {
|
||||
Logger.d(
|
||||
TAG,
|
||||
"司机端透传数据给乘客端!"
|
||||
)
|
||||
NSDNettyManager.getInstance()
|
||||
.sendMsgToAllClients(MogoProtocolMsg(NORMAL_DATA, bytes.size, bytes))
|
||||
} else {
|
||||
Logger.d(TAG, "司机端Server未启动!")
|
||||
CallerLogger.d("$M_ADAS_IMPL$TAG", "司机端Server未启动!")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CallerLogger.i("$M_ADAS_IMPL$TAG", "initServer……")
|
||||
// 同步数据给工控机的服务
|
||||
AsyncDataToAutopilotServer.INSTANCE.initServer()
|
||||
// 同步是否开启美化模式
|
||||
@@ -177,8 +172,9 @@ class MoGoAutopilotProvider :
|
||||
SharedPrefsMgr.getInstance(it).putString(MoGoConfig.AUTOPILOT_IP, autoPilotIp)
|
||||
}
|
||||
// 设置IP地址
|
||||
AdasManager.getInstance().adasOptions.setIpcConnectionMode(AdasOptions.IPC_CONNECTION_MODE.ASSIGN)
|
||||
AdasManager.getInstance().adasOptions.setIpcAssignIP(autoPilotIp)
|
||||
AdasManager.getInstance().adasOptions.ipcConnectionMode =
|
||||
AdasOptions.IPC_CONNECTION_MODE.ASSIGN
|
||||
AdasManager.getInstance().adasOptions.ipcAssignIP = autoPilotIp
|
||||
// 打开通讯连接
|
||||
AdasManager.getInstance().connect()
|
||||
return ""
|
||||
@@ -192,66 +188,75 @@ class MoGoAutopilotProvider :
|
||||
|
||||
override fun onMapCollectStart(cmdId: Int, cmdTime: Long) {
|
||||
val result = recordPackage(2, cmdId)
|
||||
Logger.d(TAG, "开始记录包: [$cmdId, $result]")
|
||||
CallerLogger.d("$M_ADAS_IMPL$TAG", "开始记录包: [$cmdId, $result]")
|
||||
}
|
||||
|
||||
override fun onMapCollectEnd(cmdId: Int, cmdTime: Long) {
|
||||
val result = stopRecord(2, cmdId)
|
||||
Logger.d(TAG, "结束记录包: [$cmdId, $result]")
|
||||
CallerLogger.d("$M_ADAS_IMPL$TAG", "结束记录包: [$cmdId, $result]")
|
||||
}
|
||||
|
||||
override fun startAutoPilot(result: AutopilotControlParameters) {
|
||||
override fun startAutoPilot(controlParameters: AutopilotControlParameters) {
|
||||
if (AdasManager.getInstance().ipcConnectionStatus == Constants.IPC_CONNECTION_STATUS.CONNECTED) {
|
||||
val parameter = AutopilotControlCmdParameter("aiCloudToStartAutopilot", result)
|
||||
AdasManager.getInstance().aiCloudToAdasData(GsonUtils.toJson(parameter))
|
||||
AdasManager.getInstance().sendAutoPilotModeReq(1, 1, controlParameters.toRouteInfo())
|
||||
} else {
|
||||
Logger.e(TAG, "车机与工控机链接失败,无法开启自动驾驶")
|
||||
CallerLogger.e("$M_ADAS_IMPL$TAG", "车机与工控机链接失败,无法开启自动驾驶")
|
||||
}
|
||||
}
|
||||
|
||||
override fun sendTrafficLightData(trafficLightResult: TrafficLightResult) {
|
||||
AdasManager.getInstance().sendTrafficLightData(
|
||||
trafficLightResult.crossId,
|
||||
trafficLightResult.lat,
|
||||
trafficLightResult.lon,
|
||||
trafficLightResult.heading,
|
||||
trafficLightResult.direction,
|
||||
trafficLightResult.lightId,
|
||||
trafficLightResult.laneNo,
|
||||
trafficLightResult.arrowNo,
|
||||
trafficLightResult.flashYellow,
|
||||
trafficLightResult.toTrafficLightDetail()
|
||||
)
|
||||
}
|
||||
|
||||
override fun sendMessageToAutopilot(jsonString: String) {
|
||||
AdasManager.getInstance().sendMessage(jsonString)
|
||||
}
|
||||
|
||||
override fun cancelAutoPilot() {
|
||||
if (AdasManager.getInstance().ipcConnectionStatus == Constants.IPC_CONNECTION_STATUS.CONNECTED) {
|
||||
AdasManager.getInstance().controlAutopilotCarHead()
|
||||
AdasManager.getInstance().sendAutoPilotModeReq(0, 1, null)
|
||||
} else {
|
||||
Logger.e(TAG, "车机与工控机链接失败,无法断开自动驾驶")
|
||||
CallerLogger.e("$M_ADAS_IMPL$TAG", "车机与工控机链接失败,无法断开自动驾驶")
|
||||
}
|
||||
}
|
||||
|
||||
override fun recordPackage(): Boolean {
|
||||
return AdasManager.getInstance()
|
||||
.recordPackage(1, (System.currentTimeMillis() / 1000).toInt())
|
||||
.startRecordPackage((System.currentTimeMillis() / 1000).toInt(), 1)
|
||||
}
|
||||
|
||||
override fun recordPackage(type: Int, id: Int): Boolean {
|
||||
return AdasManager.getInstance().recordPackage(type, id)
|
||||
return AdasManager.getInstance().startRecordPackage(id, type)
|
||||
}
|
||||
|
||||
override fun recordPackage(type: Int, id: Int, duration: Int): Boolean {
|
||||
return AdasManager.getInstance().recordPackage(type, id, duration)
|
||||
return AdasManager.getInstance().startRecordPackage(id, duration, type)
|
||||
}
|
||||
|
||||
override fun stopRecord(type: Int, id: Int): Boolean {
|
||||
return AdasManager.getInstance().stopRecord(type, id)
|
||||
return AdasManager.getInstance().stopRecordPackage(id, type)
|
||||
}
|
||||
|
||||
override fun setEnableLog(isEnableLog: Boolean) {
|
||||
CupidLogUtils.setEnableLog(isEnableLog)
|
||||
}
|
||||
|
||||
override fun setIsWriteLog(isWriteLog: Boolean) {
|
||||
CupidLogUtils.setIsWriteLog(isWriteLog)
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
CallerMapDataCollectorManager.unRegisterOnMapCollectTaskListener(this)
|
||||
}
|
||||
|
||||
override fun setAutoPilotSpeed(speed: Int): Boolean {
|
||||
return AdasManager.getInstance().setSpeed(speed)
|
||||
return AdasManager.getInstance().sendAutopilotSpeedReq(speed.toDouble())
|
||||
}
|
||||
|
||||
override fun setIPCShutDown() {
|
||||
@@ -263,21 +268,24 @@ class MoGoAutopilotProvider :
|
||||
}
|
||||
|
||||
override fun recordCause(key: String?, name: String?, id: String?, reason: String?) {
|
||||
AdasManager.getInstance().recordCause(key, name, id, reason)
|
||||
key?.let {
|
||||
AdasManager.getInstance()
|
||||
.sendRecordCause(it.toLong(), name ?: "", id ?: "", reason ?: "")
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 工控机升级确认
|
||||
*/
|
||||
override fun setIPCUpgradeAffirm() {
|
||||
AdasManager.getInstance().sendBaseInfo(IPCUpgradeInfo.affirm());
|
||||
AdasManager.getInstance().sendBaseInfo(IPCUpgradeInfo.affirm())
|
||||
}
|
||||
|
||||
/**
|
||||
* 工控机升级取消
|
||||
*/
|
||||
override fun setIPCUpgradeCancel() {
|
||||
AdasManager.getInstance().sendBaseInfo(IPCUpgradeInfo.cancel());
|
||||
AdasManager.getInstance().sendBaseInfo(IPCUpgradeInfo.cancel())
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -287,22 +295,36 @@ class MoGoAutopilotProvider :
|
||||
*/
|
||||
override fun setDemoMode(isEnable: Boolean) {
|
||||
if (isEnable) {
|
||||
AdasManager.getInstance().enableDemoMode()
|
||||
AdasManager.getInstance().sendDemoModeReq(1)
|
||||
} else {
|
||||
AdasManager.getInstance().disableDemoMode()
|
||||
AdasManager.getInstance().sendDemoModeReq(0)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 办公室调试使用,强制开启自动驾驶,将 status,pilotmode,control_pilotmode,强追设置为 1
|
||||
* 办公室调试使用,强制开启自动驾驶,将 status,pilotMode,control_pilotMode,强追设置为 1
|
||||
* isEnable = true 开启
|
||||
* isEnable = false 关闭
|
||||
*/
|
||||
override fun setControlAutopilotCarAuto(isEnable: Boolean) {
|
||||
if (isEnable) {
|
||||
AdasManager.getInstance().controlAutopilotCarAuto()
|
||||
AdasManager.getInstance().sendAutoPilotModeReq(1, 0, null)
|
||||
} else {
|
||||
AdasManager.getInstance().controlAutopilotCarHead()
|
||||
AdasManager.getInstance().sendAutoPilotModeReq(0, 0, null)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 请求工控机基础配置信息
|
||||
*/
|
||||
override fun getCarConfig() {
|
||||
AdasManager.getInstance().sendCarConfigReq()
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取全局路径
|
||||
*/
|
||||
override fun getGlobalPath() {
|
||||
AdasManager.getInstance().sendGlobalPathReq()
|
||||
}
|
||||
}
|
||||
@@ -1,365 +0,0 @@
|
||||
package com.mogo.eagle.core.function.autopilot.adapter;
|
||||
|
||||
import static com.mogo.eagle.core.data.deva.chain.ChainConstant.CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_ARRIVE;
|
||||
import static com.mogo.eagle.core.data.deva.chain.ChainConstant.CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_GUARDIAN;
|
||||
import static com.mogo.eagle.core.data.deva.chain.ChainConstant.CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_RECORD;
|
||||
import static com.mogo.eagle.core.data.deva.chain.ChainConstant.CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_ROUTE;
|
||||
import static com.mogo.eagle.core.data.deva.chain.ChainConstant.CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_STATUS;
|
||||
import static com.mogo.eagle.core.data.deva.chain.ChainConstant.CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_WARN;
|
||||
import static com.mogo.eagle.core.data.deva.chain.ChainConstant.CHAIN_ALIAS_CODE_ADAS_MESSAGE_CAR_STATE;
|
||||
import static com.mogo.eagle.core.data.deva.chain.ChainConstant.CHAIN_ALIAS_CODE_ADAS_MESSAGE_RECT_DATA;
|
||||
import static com.mogo.eagle.core.data.deva.chain.ChainConstant.CHAIN_LINK_ADAS;
|
||||
import static com.mogo.eagle.core.data.deva.chain.ChainConstant.CHAIN_LINK_LOG_WEB_SOCKET_DATA;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.mogo.eagle.core.data.autopilot.ADASTrajectoryInfo;
|
||||
import com.mogo.eagle.core.data.autopilot.AutoPilotRecordResult;
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotCarStateInfo;
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotGuardianStatusInfo;
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotRouteInfo;
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotStationInfo;
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo;
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotWarnMessage;
|
||||
import com.mogo.eagle.core.data.config.HdMapBuildConfig;
|
||||
import com.mogo.eagle.core.data.traffic.TrafficData;
|
||||
import com.mogo.eagle.core.function.autopilot.utils.AdasObjectConvertUtils;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotCarStatusListenerManager;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotIdentifyListenerManager;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotPlanningListenerManager;
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.datacenter.SnapshotLocationDataCenter;
|
||||
import com.mogo.module.service.MarkerServiceHandler;
|
||||
import com.zhidao.support.adas.high.AdasManager;
|
||||
import com.zhidao.support.adas.high.OnAdasListener;
|
||||
import com.zhidao.support.adas.high.bean.AutopilotRoute;
|
||||
import com.zhidao.support.adas.high.bean.AutopilotStatus;
|
||||
import com.zhidao.support.adas.high.bean.AutopilotWayArrive;
|
||||
import com.zhidao.support.adas.high.bean.CarLaneInfo;
|
||||
import com.zhidao.support.adas.high.bean.CarStateInfo;
|
||||
import com.zhidao.support.adas.high.bean.IPCUpgradeStateInfo;
|
||||
import com.zhidao.support.adas.high.bean.LightStatueInfo;
|
||||
import com.zhidao.support.adas.high.bean.ObstaclesInfo;
|
||||
import com.zhidao.support.adas.high.bean.RectInfo;
|
||||
import com.zhidao.support.adas.high.bean.SSHResult;
|
||||
import com.zhidao.support.adas.high.bean.TrajectoryInfo;
|
||||
import com.zhidao.support.adas.high.bean.WarnMessageInfo;
|
||||
import com.zhidao.support.adas.high.bean.guardian.AutopilotGuardianInfo;
|
||||
import com.zhidao.support.adas.high.bean.record.AutopilotRecordResult;
|
||||
import com.zhjt.service.chain.ChainLog;
|
||||
import com.zhjt.service.chain.TracingConstants;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/10/22
|
||||
* <p>
|
||||
* 适配ADAS 回调监听分发,这里不做业务,只做数据包装及分发处理
|
||||
*/
|
||||
public class MoGoAdasListenerImpl implements OnAdasListener {
|
||||
private final String TAG = "OnAdasListenerAdapter";
|
||||
|
||||
@ChainLog(linkCode = CHAIN_LINK_ADAS,
|
||||
linkChainLog = CHAIN_LINK_LOG_WEB_SOCKET_DATA,
|
||||
endpoint = TracingConstants.Endpoint.PAD,
|
||||
nodeAliasCode = CHAIN_ALIAS_CODE_ADAS_MESSAGE_RECT_DATA,
|
||||
paramIndexes = {0},
|
||||
clientPkFileName = "sn")
|
||||
@Override
|
||||
public void onRectData(RectInfo rectInfo) {
|
||||
if (HdMapBuildConfig.isMapLoaded) {
|
||||
ArrayList<TrafficData> recognizedListResults = AdasObjectConvertUtils.INSTANCE.regroupTrafficDataData(rectInfo.getModels());
|
||||
CallerAutopilotIdentifyListenerManager.INSTANCE.invokeAutopilotIdentifyDataUpdate(recognizedListResults);
|
||||
}
|
||||
}
|
||||
|
||||
@ChainLog(linkCode = CHAIN_LINK_ADAS,
|
||||
linkChainLog = CHAIN_LINK_LOG_WEB_SOCKET_DATA,
|
||||
endpoint = TracingConstants.Endpoint.PAD,
|
||||
nodeAliasCode = CHAIN_ALIAS_CODE_ADAS_MESSAGE_CAR_STATE,
|
||||
paramIndexes = {0},
|
||||
clientPkFileName = "sn")
|
||||
@Override
|
||||
public void onCarStateData(CarStateInfo carStateInfo) {
|
||||
if (HdMapBuildConfig.isMapLoaded) {
|
||||
// Logger.d(TAG, "--------carStateInfo.toString() = " + carStateInfo.toString());
|
||||
AutopilotCarStateInfo autopilotCarStateInfo = AdasObjectConvertUtils.INSTANCE.fromAdasCarStateInfoObject(carStateInfo);
|
||||
// 将数据通过数据中心分发出去
|
||||
CallerAutopilotCarStatusListenerManager.INSTANCE.invokeAutopilotCarStateData(autopilotCarStateInfo);
|
||||
// 同步给MAP地图
|
||||
adasCarDataCallback(autopilotCarStateInfo);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void adasCarDataCallback(@Nullable AutopilotCarStateInfo stateInfo) {
|
||||
|
||||
if (stateInfo != null && stateInfo.getValues() != null) {
|
||||
//Logger.d(TAG,"同步自车数据给地图……");
|
||||
|
||||
MogoApisHandler.getInstance().getApis().getAdasControllerApi().setLastLat(stateInfo.getValues().getLat());
|
||||
MogoApisHandler.getInstance().getApis().getAdasControllerApi().setLastLon(stateInfo.getValues().getLon());
|
||||
MogoApisHandler.getInstance().getApis().getAdasControllerApi().setSatelliteTime(stateInfo.getValues().getSatelliteTime());
|
||||
JSONObject data = new JSONObject();
|
||||
try {
|
||||
data.putOpt("lon", stateInfo.getValues().getLon());
|
||||
data.putOpt("lat", stateInfo.getValues().getLat());
|
||||
data.putOpt("alt", stateInfo.getValues().getAlt());
|
||||
data.putOpt("speed", stateInfo.getValues().getGnss_speed());
|
||||
data.putOpt("heading", stateInfo.getValues().getHeading());
|
||||
data.putOpt("acceleration", stateInfo.getValues().getAcceleration());
|
||||
data.putOpt("yawRate", stateInfo.getValues().getYaw_rate());
|
||||
data.putOpt("gpsProvider", 1);
|
||||
try {
|
||||
data.putOpt("systemTime", Long.parseLong(stateInfo.getValues().getSystemTime()));
|
||||
} catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
data.putOpt("satelliteTime", Long.parseLong(stateInfo.getValues().getSatelliteTime()));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
data.putOpt("receiverDataTime", Long.parseLong(stateInfo.getValues().getReceiverDataTime()));
|
||||
} catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
data.putOpt("adasSatelliteTime", Long.parseLong(stateInfo.getValues().getAdasSatelliteTime()));
|
||||
} catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
}
|
||||
MarkerServiceHandler.getApis().getMapServiceApi().getMapUIController().syncLocation2Map(data);
|
||||
SnapshotLocationDataCenter.getInstance().syncAdasLocationInfo(data);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ChainLog(linkCode = CHAIN_LINK_ADAS,
|
||||
linkChainLog = CHAIN_LINK_LOG_WEB_SOCKET_DATA,
|
||||
endpoint = TracingConstants.Endpoint.PAD,
|
||||
nodeAliasCode = CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_STATUS,
|
||||
paramIndexes = {0},
|
||||
clientPkFileName = "sn")
|
||||
@Override
|
||||
public void autopilotStatus(AutopilotStatus autopilotStatus) {
|
||||
if (HdMapBuildConfig.isMapLoaded) {
|
||||
AutopilotStatus.ValuesBean autopilotStatusValues = autopilotStatus.getValues();
|
||||
|
||||
if (autopilotStatusValues != null) {
|
||||
// 初始化自动驾驶状态信息
|
||||
AutopilotStatusInfo autopilotStatusInfo = CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo();
|
||||
autopilotStatusInfo.setState(autopilotStatusValues.getState());
|
||||
autopilotStatusInfo.setPilotmode(autopilotStatusValues.getPilotmode());
|
||||
autopilotStatusInfo.setControl_pilotmode(autopilotStatusValues.getControl_pilotmode());
|
||||
autopilotStatusInfo.setReason(autopilotStatusValues.getReason());
|
||||
autopilotStatusInfo.setCamera(autopilotStatusValues.getCamera());
|
||||
autopilotStatusInfo.setRtk(autopilotStatusValues.getRtk());
|
||||
autopilotStatusInfo.setRadar(autopilotStatusValues.getRadar());
|
||||
autopilotStatusInfo.setSpeed(autopilotStatusValues.getSpeed());
|
||||
// 初始化自动驾驶状态信息
|
||||
if (autopilotStatusInfo.getVersion() == null) {
|
||||
autopilotStatusInfo.setVersion(AdasManager.getInstance().getAdasConfig().getVersion());
|
||||
}
|
||||
if (autopilotStatusInfo.getConnectIP() == null) {
|
||||
autopilotStatusInfo.setConnectIP(AdasManager.getInstance().getAdasConfig().getAddress());
|
||||
}
|
||||
if (autopilotStatusInfo.getDockVersion() == null) {
|
||||
autopilotStatusInfo.setDockVersion(AdasManager.getInstance().getAdasConfig().getDockVersion());
|
||||
}
|
||||
|
||||
CallerAutoPilotStatusListenerManager.INSTANCE.invokeAutoPilotStatus();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ChainLog(linkCode = CHAIN_LINK_ADAS,
|
||||
linkChainLog = CHAIN_LINK_LOG_WEB_SOCKET_DATA,
|
||||
endpoint = TracingConstants.Endpoint.PAD,
|
||||
nodeAliasCode = CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_ARRIVE,
|
||||
paramIndexes = {0},
|
||||
clientPkFileName = "sn")
|
||||
@Override
|
||||
public void autopilotArrive(AutopilotWayArrive autopilotWayArrive) {
|
||||
if (HdMapBuildConfig.isMapLoaded) {
|
||||
// Logger.d(TAG, "autopilotArrive : " + autopilotWayArrive);
|
||||
if (autopilotWayArrive != null) {
|
||||
AutopilotWayArrive.ResultBean result = autopilotWayArrive.getResult();
|
||||
if (result != null) {
|
||||
AutopilotWayArrive.ResultBean.EndLatLonBean endLatLon = result.getEndLatLon();
|
||||
if (endLatLon != null) {
|
||||
AutopilotStationInfo stationInfo = new AutopilotStationInfo(result.getCarType(), endLatLon.getLon(), endLatLon.getLat());
|
||||
|
||||
CallerAutoPilotStatusListenerManager.INSTANCE.invokeArriveAtStation(stationInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ChainLog(linkCode = CHAIN_LINK_ADAS,
|
||||
linkChainLog = CHAIN_LINK_LOG_WEB_SOCKET_DATA,
|
||||
endpoint = TracingConstants.Endpoint.PAD,
|
||||
nodeAliasCode = CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_ROUTE,
|
||||
paramIndexes = {0},
|
||||
clientPkFileName = "sn")
|
||||
@Override
|
||||
public void onAutopilotRoute(AutopilotRoute route) {
|
||||
if (HdMapBuildConfig.isMapLoaded) {
|
||||
// Logger.d(TAG, "onAutopilotRoute : " + route.toString());
|
||||
AutopilotRouteInfo autopilotRoute = AdasObjectConvertUtils.INSTANCE.fromAdasAutopilotRoute(route);
|
||||
CallerAutopilotPlanningListenerManager.INSTANCE.invokeAutopilotRotting(autopilotRoute);
|
||||
}
|
||||
}
|
||||
|
||||
// @ChainLog(linkCode = CHAIN_LINK_ADAS,
|
||||
// endpoint = TracingConstants.Endpoint.PAD,
|
||||
// nodeAliasCode = CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_TRAJECTORY,
|
||||
// paramIndexes = {0},
|
||||
// clientPkFileName = "sn")
|
||||
@Override
|
||||
public void onAutopilotTrajectory(List<TrajectoryInfo> trajectoryList) {
|
||||
if (HdMapBuildConfig.isMapLoaded) {
|
||||
// Logger.d(TAG, "onAutopilotTrajectory : " + trajectoryList);
|
||||
ArrayList<ADASTrajectoryInfo> trajectoryInfoArrayList = new ArrayList<>();
|
||||
if (trajectoryList != null && trajectoryList.size() > 0) {
|
||||
for (TrajectoryInfo trajectory : trajectoryList) {
|
||||
ADASTrajectoryInfo adasTrajectoryInfo = new ADASTrajectoryInfo();
|
||||
adasTrajectoryInfo.setLat(trajectory.getLat());
|
||||
adasTrajectoryInfo.setLon(trajectory.getLon());
|
||||
adasTrajectoryInfo.setAcceleration(trajectory.getAcceleration());
|
||||
adasTrajectoryInfo.setAccumulatedDis(trajectory.getAccumulatedDis());
|
||||
adasTrajectoryInfo.setTime(trajectory.getTime());
|
||||
adasTrajectoryInfo.setVelocity(trajectory.getVelocity());
|
||||
adasTrajectoryInfo.setAlt(trajectory.getAlt());
|
||||
adasTrajectoryInfo.setKappa(trajectory.getKappa());
|
||||
adasTrajectoryInfo.setTheta(trajectory.getTheta());
|
||||
trajectoryInfoArrayList.add(adasTrajectoryInfo);
|
||||
}
|
||||
// Log.e(TAG, "time:" + System.currentTimeMillis() + "trajectoryInfoArrayList:" + trajectoryInfoArrayList);
|
||||
}
|
||||
CallerAutopilotPlanningListenerManager.INSTANCE.invokeAutopilotTrajectory(trajectoryInfoArrayList);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotSNRequest() {
|
||||
CallerAutoPilotStatusListenerManager.INSTANCE.invokeAutopilotSNRequest();
|
||||
}
|
||||
|
||||
@ChainLog(linkCode = CHAIN_LINK_ADAS,
|
||||
linkChainLog = CHAIN_LINK_LOG_WEB_SOCKET_DATA,
|
||||
endpoint = TracingConstants.Endpoint.PAD,
|
||||
nodeAliasCode = CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_GUARDIAN,
|
||||
paramIndexes = {0},
|
||||
clientPkFileName = "sn")
|
||||
@Override
|
||||
public void onAutopilotGuardian(AutopilotGuardianInfo guardianInfo) {
|
||||
if (HdMapBuildConfig.isMapLoaded) {
|
||||
AutopilotGuardianStatusInfo autopilotRoute = AdasObjectConvertUtils.INSTANCE.fromAutopilotGuardianInfo(guardianInfo);
|
||||
CallerAutoPilotStatusListenerManager.INSTANCE.invokeAutopilotGuardian(autopilotRoute);
|
||||
}
|
||||
}
|
||||
|
||||
@ChainLog(linkCode = CHAIN_LINK_ADAS,
|
||||
linkChainLog = CHAIN_LINK_LOG_WEB_SOCKET_DATA,
|
||||
endpoint = TracingConstants.Endpoint.PAD,
|
||||
nodeAliasCode = CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_RECORD,
|
||||
paramIndexes = {0},
|
||||
clientPkFileName = "sn")
|
||||
@Override
|
||||
public void onAutopilotRecord(AutopilotRecordResult result) {
|
||||
if (result != null) {
|
||||
AutoPilotRecordResult real = new AutoPilotRecordResult();
|
||||
real.setDiskFree(result.getDiskFree());
|
||||
real.setId(result.getId());
|
||||
real.setDuration(result.getDuration());
|
||||
real.setNote(result.getNote());
|
||||
real.setTotal(result.getTotalSize());
|
||||
real.setType(result.getType());
|
||||
real.setFileName(result.getFilename());
|
||||
real.setKey(result.getKey());
|
||||
real.setStat(result.getStat());
|
||||
real.setTimestamp(result.getTimestamp());
|
||||
CallerAutopilotIdentifyListenerManager.INSTANCE.invokeAutopilotRecordResult(real);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onLightStateData(LightStatueInfo lightStatueInfo) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onObstaclesInfo(ObstaclesInfo obstaclesInfo) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCarLaneInfo(CarLaneInfo carLaneInfo) {
|
||||
|
||||
}
|
||||
|
||||
@ChainLog(linkCode = CHAIN_LINK_ADAS,
|
||||
linkChainLog = CHAIN_LINK_LOG_WEB_SOCKET_DATA,
|
||||
endpoint = TracingConstants.Endpoint.PAD,
|
||||
nodeAliasCode = CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_WARN,
|
||||
paramIndexes = {0},
|
||||
clientPkFileName = "sn")
|
||||
@Override
|
||||
public void onWarnMessage(WarnMessageInfo warnMessageInfo) {
|
||||
final AutopilotWarnMessage warnMessage = AdasObjectConvertUtils.INSTANCE.fromAdasObject(warnMessageInfo);
|
||||
CallerAutopilotIdentifyListenerManager.INSTANCE.invokeAutopilotWarnMessage(warnMessage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onVideoSize(int width, int height) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 工控机升级状态
|
||||
*
|
||||
* @param info 工控机升级状态
|
||||
*/
|
||||
@Override
|
||||
public void onUpgradeStateInfo(IPCUpgradeStateInfo info) {
|
||||
if (info != null) {
|
||||
Logger.d(TAG, "onUpgradeStateInfo " +
|
||||
" upgrade mode=" + info.getUpgradeMode() +
|
||||
" download status=" + info.getDownloadStatus() +
|
||||
" download progress current=" + info.getProgress().getCurrent() +
|
||||
" download progress total=" + info.getProgress().getTotal() +
|
||||
" download version=" + info.getImages() +
|
||||
" upgrade status=" + info.getUpgradeStatus());
|
||||
CallerHmiManager.INSTANCE.showAdUpgradeStatus(info.getUpgradeMode(), info.getDownloadStatus(), info.getProgress().getCurrent(),
|
||||
info.getProgress().getTotal(), info.getImages(), info.getUpgradeStatus());
|
||||
} else {
|
||||
Logger.d(TAG, "onUpgradeStateInfo : upgrade state info is null");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 命令返回结果
|
||||
* @param info 结果返回实体
|
||||
*/
|
||||
@Override
|
||||
public void onSSHResult(SSHResult info) {
|
||||
if(info!=null && "docker restart autocar_default_1".equals(info.cmd)){
|
||||
CallerHmiManager.INSTANCE.showDockerRebootResult(info.code, info.msg);
|
||||
}else{
|
||||
Logger.d(TAG,"onSSHResult : result info is null");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,311 @@
|
||||
package com.mogo.eagle.core.function.autopilot.adapter
|
||||
|
||||
import chassis.VehicleStateOuterClass
|
||||
import com.mogo.eagle.core.data.autopilot.ADASTrajectoryInfo
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.data.config.HdMapBuildConfig
|
||||
import com.mogo.eagle.core.data.chain.ChainConstant.Companion.CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_ARRIVE
|
||||
import com.mogo.eagle.core.data.chain.ChainConstant.Companion.CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_GUARDIAN
|
||||
import com.mogo.eagle.core.data.chain.ChainConstant.Companion.CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_RECORD
|
||||
import com.mogo.eagle.core.data.chain.ChainConstant.Companion.CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_ROUTE
|
||||
import com.mogo.eagle.core.data.chain.ChainConstant.Companion.CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_STATUS
|
||||
import com.mogo.eagle.core.data.chain.ChainConstant.Companion.CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_TRAJECTORY
|
||||
import com.mogo.eagle.core.data.chain.ChainConstant.Companion.CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_WARN
|
||||
import com.mogo.eagle.core.data.chain.ChainConstant.Companion.CHAIN_ALIAS_CODE_ADAS_MESSAGE_CAR_STATE
|
||||
import com.mogo.eagle.core.data.chain.ChainConstant.Companion.CHAIN_ALIAS_CODE_ADAS_MESSAGE_RECT_DATA
|
||||
import com.mogo.eagle.core.data.chain.ChainConstant.Companion.CHAIN_LINK_ADAS
|
||||
import com.mogo.eagle.core.data.chain.ChainConstant.Companion.CHAIN_LINK_LOG_WEB_SOCKET_DATA
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_ADAS_IMPL
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.invokeArriveAtStation
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.invokeAutoPilotStatus
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.invokeAutopilotGuardian
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.invokeAutopilotSNRequest
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotCarConfigListenerManager.invokeAutopilotCarConfigData
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotCarStatusListenerManager.invokeAutopilotCarStateData
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotIdentifyListenerManager.invokeAutopilotIdentifyDataUpdate
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotIdentifyListenerManager.invokeAutopilotRecordResult
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotIdentifyListenerManager.invokeAutopilotWarnMessage
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotPlanningListenerManager.invokeAutopilotRotting
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotPlanningListenerManager.invokeAutopilotTrajectory
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotVehicleStateListenerManager
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager.showAdUpgradeStatus
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager.showDockerRebootResult
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.module.common.MogoApisHandler
|
||||
import com.mogo.module.common.datacenter.SnapshotLocationDataCenter
|
||||
import com.mogo.module.service.MarkerServiceHandler
|
||||
import com.zhidao.support.adas.high.AdasManager
|
||||
import com.zhidao.support.adas.high.OnAdasListener
|
||||
import com.zhidao.support.adas.high.bean.IPCUpgradeStateInfo
|
||||
import com.zhidao.support.adas.high.bean.SSHResult
|
||||
import com.zhidao.support.adas.high.common.ProtocolStatus
|
||||
import com.zhjt.service.chain.ChainLog
|
||||
import com.zhjt.service.chain.TracingConstants.Endpoint.Companion.PAD
|
||||
import mogo.telematics.pad.MessagePad
|
||||
import mogo.telematics.pad.MessagePad.TrackedObject
|
||||
import mogo_msg.MogoReportMsg
|
||||
import record_cache.RecordPanelOuterClass
|
||||
import java.util.*
|
||||
|
||||
/**
|
||||
* @author emArrow
|
||||
* @since 2022/3/11
|
||||
*
|
||||
*
|
||||
* 适配ADAS 回调监听分发,这里不做业务,只做数据包装及分发处理
|
||||
*/
|
||||
class MoGoAdasListenerImpl : OnAdasListener {
|
||||
|
||||
companion object {
|
||||
const val TAG = "OnAdasListenerAdapter"
|
||||
}
|
||||
|
||||
@ChainLog(
|
||||
linkCode = CHAIN_LINK_ADAS,
|
||||
endpoint = PAD,
|
||||
nodeAliasCode = CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_TRAJECTORY,
|
||||
paramIndexes = [0, 1],
|
||||
clientPkFileName = "sn"
|
||||
)
|
||||
override fun onTrajectory(header: MessagePad.Header, trajectory: MessagePad.Trajectory?) {
|
||||
if (HdMapBuildConfig.isMapLoaded) {
|
||||
val trajectoryInfoArrayList = ArrayList<ADASTrajectoryInfo>()
|
||||
if (trajectory != null && trajectory.pointsList.size > 0) {
|
||||
for (trajectory in trajectory.pointsList) {
|
||||
val adasTrajectoryInfo = ADASTrajectoryInfo()
|
||||
adasTrajectoryInfo.lat = trajectory.latitude
|
||||
adasTrajectoryInfo.lon = trajectory.longitude
|
||||
adasTrajectoryInfo.acceleration = trajectory.acceleration
|
||||
adasTrajectoryInfo.accumulatedDis = trajectory.accumulatedDis
|
||||
adasTrajectoryInfo.time = trajectory.time
|
||||
adasTrajectoryInfo.velocity = trajectory.velocity
|
||||
adasTrajectoryInfo.alt = trajectory.altitude
|
||||
adasTrajectoryInfo.kappa = trajectory.kappa
|
||||
adasTrajectoryInfo.theta = trajectory.theta
|
||||
trajectoryInfoArrayList.add(adasTrajectoryInfo)
|
||||
}
|
||||
}
|
||||
invokeAutopilotTrajectory(trajectoryInfoArrayList)
|
||||
}
|
||||
}
|
||||
|
||||
@ChainLog(
|
||||
linkCode = CHAIN_LINK_ADAS,
|
||||
linkChainLog = CHAIN_LINK_LOG_WEB_SOCKET_DATA,
|
||||
endpoint = PAD,
|
||||
nodeAliasCode = CHAIN_ALIAS_CODE_ADAS_MESSAGE_RECT_DATA,
|
||||
paramIndexes = [0, 1],
|
||||
clientPkFileName = "sn"
|
||||
)
|
||||
override fun onTrackedObjects(
|
||||
header: MessagePad.Header,
|
||||
trackedObjects: MessagePad.TrackedObjects
|
||||
) {
|
||||
if (HdMapBuildConfig.isMapLoaded) {
|
||||
invokeAutopilotIdentifyDataUpdate(trackedObjects.objsList as List<TrackedObject>?)
|
||||
}
|
||||
}
|
||||
|
||||
@ChainLog(
|
||||
linkCode = CHAIN_LINK_ADAS,
|
||||
linkChainLog = CHAIN_LINK_LOG_WEB_SOCKET_DATA,
|
||||
endpoint = PAD,
|
||||
nodeAliasCode = CHAIN_ALIAS_CODE_ADAS_MESSAGE_CAR_STATE,
|
||||
paramIndexes = [0, 1],
|
||||
clientPkFileName = "sn"
|
||||
)
|
||||
override fun onGnssInfo(header: MessagePad.Header, gnssInfo: MessagePad.GnssInfo?) {
|
||||
invokeAutopilotCarStateData(gnssInfo)
|
||||
// 同步给MAP地图
|
||||
if (gnssInfo != null) {
|
||||
MogoApisHandler.getInstance().apis.adasControllerApi.lastLat = gnssInfo.latitude
|
||||
MogoApisHandler.getInstance().apis.adasControllerApi.lastLon = gnssInfo.longitude
|
||||
MogoApisHandler.getInstance().apis.adasControllerApi.satelliteTime =
|
||||
java.lang.Double.valueOf(gnssInfo.satelliteTime).toLong()
|
||||
if (1 == FunctionBuildConfig.gpsProvider) {
|
||||
MarkerServiceHandler.getApis().mapServiceApi.mapUIController.syncLocation2Map(
|
||||
gnssInfo
|
||||
)
|
||||
SnapshotLocationDataCenter.getInstance().syncAdasLocationInfo(gnssInfo)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onVehicleState(
|
||||
header: MessagePad.Header,
|
||||
vehicleState: VehicleStateOuterClass.VehicleState?
|
||||
) {
|
||||
if (vehicleState != null) {
|
||||
//转向灯数据
|
||||
CallerAutopilotVehicleStateListenerManager.invokeAutopilotLightSwitchData(vehicleState.light)
|
||||
//刹车灯数据
|
||||
CallerAutopilotVehicleStateListenerManager.invokeAutopilotBrakeLightData(vehicleState.brakeLightStatus)
|
||||
}
|
||||
}
|
||||
|
||||
@ChainLog(
|
||||
linkCode = CHAIN_LINK_ADAS,
|
||||
linkChainLog = CHAIN_LINK_LOG_WEB_SOCKET_DATA,
|
||||
endpoint = PAD,
|
||||
nodeAliasCode = CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_STATUS,
|
||||
paramIndexes = [0, 1],
|
||||
clientPkFileName = "sn"
|
||||
)
|
||||
override fun onAutopilotState(
|
||||
header: MessagePad.Header,
|
||||
autopilotState: MessagePad.AutopilotState?
|
||||
) {
|
||||
if (autopilotState != null) {
|
||||
if (HdMapBuildConfig.isMapLoaded) {
|
||||
// 初始化自动驾驶状态信息
|
||||
val autopilotStatusInfo = getAutoPilotStatusInfo()
|
||||
autopilotStatusInfo.state = autopilotState.state
|
||||
autopilotStatusInfo.pilotmode = autopilotState.autopilotMode
|
||||
autopilotStatusInfo.reason = autopilotState.reason
|
||||
autopilotStatusInfo.camera = autopilotState.camera
|
||||
autopilotStatusInfo.rtk = autopilotState.rtk
|
||||
autopilotStatusInfo.radar = autopilotState.radar
|
||||
autopilotStatusInfo.speed = autopilotState.speed.toFloat()
|
||||
autopilotStatusInfo.version = AdasManager.getInstance().adasVersion
|
||||
if (autopilotStatusInfo.connectIP == null) {
|
||||
autopilotStatusInfo.connectIP = AdasManager.getInstance().ipcConnectedIp
|
||||
}
|
||||
if (autopilotStatusInfo.dockVersion == null) {
|
||||
AdasManager.getInstance().carConfig?.let {
|
||||
autopilotStatusInfo.dockVersion = it.dockVersion
|
||||
}
|
||||
}
|
||||
invokeAutoPilotStatus()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ChainLog(
|
||||
linkCode = CHAIN_LINK_ADAS,
|
||||
linkChainLog = CHAIN_LINK_LOG_WEB_SOCKET_DATA,
|
||||
endpoint = PAD,
|
||||
nodeAliasCode = CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_GUARDIAN,
|
||||
paramIndexes = [0, 1],
|
||||
clientPkFileName = "sn"
|
||||
)
|
||||
override fun onReportMessage(
|
||||
header: MessagePad.Header,
|
||||
mogoReportMessage: MogoReportMsg.MogoReportMessage?
|
||||
) {
|
||||
if (HdMapBuildConfig.isMapLoaded) {
|
||||
invokeAutopilotGuardian(mogoReportMessage)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onBasicInfoReq(
|
||||
header: MessagePad.Header,
|
||||
basicInfoReq: MessagePad.BasicInfoReq?
|
||||
) {
|
||||
invokeAutopilotSNRequest()
|
||||
}
|
||||
|
||||
override fun onCarConfigResp(
|
||||
header: MessagePad.Header,
|
||||
carConfigResp: MessagePad.CarConfigResp?
|
||||
) {
|
||||
if (HdMapBuildConfig.isMapLoaded && carConfigResp != null) {
|
||||
invokeAutopilotCarConfigData(carConfigResp)
|
||||
}
|
||||
}
|
||||
|
||||
@ChainLog(
|
||||
linkCode = CHAIN_LINK_ADAS,
|
||||
linkChainLog = CHAIN_LINK_LOG_WEB_SOCKET_DATA,
|
||||
endpoint = PAD,
|
||||
nodeAliasCode = CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_RECORD,
|
||||
paramIndexes = [0, 1],
|
||||
clientPkFileName = "sn"
|
||||
)
|
||||
override fun onRecordResult(
|
||||
header: MessagePad.Header,
|
||||
recordPanel: RecordPanelOuterClass.RecordPanel?
|
||||
) {
|
||||
if (recordPanel != null) {
|
||||
invokeAutopilotRecordResult(recordPanel)
|
||||
}
|
||||
}
|
||||
|
||||
@ChainLog(
|
||||
linkCode = CHAIN_LINK_ADAS,
|
||||
linkChainLog = CHAIN_LINK_LOG_WEB_SOCKET_DATA,
|
||||
endpoint = PAD,
|
||||
nodeAliasCode = CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_ROUTE,
|
||||
paramIndexes = [0, 1],
|
||||
clientPkFileName = "sn"
|
||||
)
|
||||
override fun onGlobalPathResp(
|
||||
header: MessagePad.Header,
|
||||
globalPathResp: MessagePad.GlobalPathResp?
|
||||
) {
|
||||
if (HdMapBuildConfig.isMapLoaded) {
|
||||
invokeAutopilotRotting(globalPathResp)
|
||||
}
|
||||
}
|
||||
|
||||
@ChainLog(
|
||||
linkCode = CHAIN_LINK_ADAS,
|
||||
linkChainLog = CHAIN_LINK_LOG_WEB_SOCKET_DATA,
|
||||
endpoint = PAD,
|
||||
nodeAliasCode = CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_WARN,
|
||||
paramIndexes = [0, 1],
|
||||
clientPkFileName = "sn"
|
||||
)
|
||||
override fun onWarn(header: MessagePad.Header, warn: MessagePad.Warn?) {
|
||||
invokeAutopilotWarnMessage(warn)
|
||||
}
|
||||
|
||||
@ChainLog(
|
||||
linkCode = CHAIN_LINK_ADAS,
|
||||
linkChainLog = CHAIN_LINK_LOG_WEB_SOCKET_DATA,
|
||||
endpoint = PAD,
|
||||
nodeAliasCode = CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_ARRIVE,
|
||||
paramIndexes = [0, 1],
|
||||
clientPkFileName = "sn"
|
||||
)
|
||||
override fun onArrivalNotification(
|
||||
header: MessagePad.Header,
|
||||
arrivalNotification: MessagePad.ArrivalNotification?
|
||||
) {
|
||||
if (HdMapBuildConfig.isMapLoaded) {
|
||||
invokeArriveAtStation(arrivalNotification)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onUpgradeStateInfo(info: IPCUpgradeStateInfo) {
|
||||
if (info != null) {
|
||||
CallerLogger.d(
|
||||
"$M_ADAS_IMPL$TAG", "onUpgradeStateInfo " +
|
||||
" upgrade mode=" + info.upgradeMode +
|
||||
" download status=" + info.downloadStatus +
|
||||
" download progress current=" + info.progress.current +
|
||||
" download progress total=" + info.progress.total +
|
||||
" download version=" + info.images +
|
||||
" upgrade status=" + info.upgradeStatus
|
||||
)
|
||||
showAdUpgradeStatus(
|
||||
info.upgradeMode, info.downloadStatus, info.progress.current,
|
||||
info.progress.total, info.images, info.upgradeStatus
|
||||
)
|
||||
} else {
|
||||
CallerLogger.w("$M_ADAS_IMPL$TAG", "onUpgradeStateInfo : upgrade state info is null")
|
||||
}
|
||||
}
|
||||
|
||||
override fun onSSHResult(info: SSHResult?) {
|
||||
if (info != null && "docker restart autocar_default_1" == info.cmd) {
|
||||
showDockerRebootResult(info.code, info.msg)
|
||||
} else {
|
||||
CallerLogger.w("$M_ADAS_IMPL$TAG", "onSSHResult : result info is null")
|
||||
}
|
||||
}
|
||||
|
||||
override fun onError(status: ProtocolStatus, bytes: ByteArray) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -2,29 +2,27 @@ package com.mogo.eagle.core.function.autopilot.adapter
|
||||
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
|
||||
import com.mogo.commons.debug.DebugConfig
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotStationInfo
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_ADAS_IMPL
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
|
||||
import com.mogo.eagle.core.function.autopilot.network.AdasServiceModel
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.zhidao.support.adas.high.AdasManager
|
||||
import com.zhidao.support.adas.high.OnAdasConnectStatusListener
|
||||
import com.zhidao.support.adas.high.bean.BasicInfo
|
||||
import com.zhidao.support.adas.high.common.Constants
|
||||
import io.reactivex.Flowable
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||
import io.reactivex.schedulers.Schedulers
|
||||
import mogo.telematics.pad.MessagePad
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
/**
|
||||
* ADAS-SDK与工控机连接状态回调
|
||||
*
|
||||
* @author donghongyu
|
||||
*/
|
||||
class MoGoAdasMsgConnectStatusListenerImpl : OnAdasConnectStatusListener,
|
||||
IMoGoAutopilotStatusListener {
|
||||
private val TAG = "MoGoAdasMsgConnectStatusListenerImpl"
|
||||
private val TAG = "ConnectStatus"
|
||||
|
||||
//自动驾驶状态
|
||||
private var mCurrentAutopilotStatus = -1
|
||||
@@ -35,10 +33,10 @@ class MoGoAdasMsgConnectStatusListenerImpl : OnAdasConnectStatusListener,
|
||||
|
||||
override fun onConnectionIPCStatus(ipcConnectionStatus: Int, reason: String?) {
|
||||
if (ipcConnectionStatus == Constants.IPC_CONNECTION_STATUS.CONNECTED) {
|
||||
Logger.d(TAG, "webSocket 连接成功")
|
||||
CallerLogger.d("$M_ADAS_IMPL$TAG", "webSocket 连接成功")
|
||||
// 初始化自动驾驶状态信息
|
||||
CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().connectIP =
|
||||
AdasManager.getInstance().adasConfig.address
|
||||
AdasManager.getInstance().ipcConnectedIp
|
||||
CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().connectStatus = true
|
||||
CallerAutoPilotStatusListenerManager.invokeAutoPilotStatus()
|
||||
|
||||
@@ -48,17 +46,17 @@ class MoGoAdasMsgConnectStatusListenerImpl : OnAdasConnectStatusListener,
|
||||
// 开启轮训上传自动驾驶状态
|
||||
updateDriveStatusTask()
|
||||
} else if (ipcConnectionStatus == Constants.IPC_CONNECTION_STATUS.DISCONNECTED) {
|
||||
Logger.d(TAG, "webSocket 连接失败 reason:$reason")
|
||||
CallerLogger.d("$M_ADAS_IMPL$TAG", "webSocket 连接失败 reason:$reason")
|
||||
CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().connectIP =
|
||||
AdasManager.getInstance().adasConfig.address
|
||||
AdasManager.getInstance().ipcConnectedIp
|
||||
CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().connectStatus = false
|
||||
CallerAutoPilotStatusListenerManager.invokeAutoPilotStatus()
|
||||
} else if (ipcConnectionStatus == Constants.IPC_CONNECTION_STATUS.CONNECTING) {
|
||||
Logger.d(TAG, "webSocket 正在连接")
|
||||
CallerLogger.d("$M_ADAS_IMPL$TAG", "webSocket 正在连接")
|
||||
} else if (ipcConnectionStatus == Constants.IPC_CONNECTION_STATUS.SEARCH_ADDRESS) {
|
||||
Logger.d(TAG, "webSocket 正在搜索工控机IP")
|
||||
CallerLogger.d("$M_ADAS_IMPL$TAG", "webSocket 正在搜索工控机IP")
|
||||
} else if (ipcConnectionStatus == Constants.IPC_CONNECTION_STATUS.NOT_FOUND_ADDRESS) {
|
||||
Logger.d(TAG, "webSocket 找不到可用IP 传入的IP不可用或固定IP列表中所有IP不可用")
|
||||
CallerLogger.d("$M_ADAS_IMPL$TAG", "webSocket 找不到可用IP 传入的IP不可用或固定IP列表中所有IP不可用")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,10 +68,10 @@ class MoGoAdasMsgConnectStatusListenerImpl : OnAdasConnectStatusListener,
|
||||
syncBasicInfoToAutopilot()
|
||||
}
|
||||
|
||||
override fun onAutopilotArriveAtStation(autopilotWayArrive: AutopilotStationInfo?) {
|
||||
if (autopilotWayArrive != null) {
|
||||
val lon = autopilotWayArrive.lon
|
||||
val lat = autopilotWayArrive.lat
|
||||
override fun onAutopilotArriveAtStation(arrivalNotification: MessagePad.ArrivalNotification?) {
|
||||
if (arrivalNotification != null && arrivalNotification.endLocation != null) {
|
||||
val lon = arrivalNotification.endLocation.longitude
|
||||
val lat = arrivalNotification.endLocation.latitude
|
||||
AdasServiceModel.getInstance().reportSite(lon, lat)
|
||||
}
|
||||
}
|
||||
@@ -89,20 +87,17 @@ class MoGoAdasMsgConnectStatusListenerImpl : OnAdasConnectStatusListener,
|
||||
* 同步SN信息给工控机
|
||||
*/
|
||||
private fun syncBasicInfoToAutopilot() {
|
||||
Logger.d(TAG, "同步PAD的SN给工控机……")
|
||||
val info = BasicInfo()
|
||||
// 设置PAD-SN给工控
|
||||
info.setSn(MoGoAiCloudClientConfig.getInstance().sn)
|
||||
// 设置网络环境
|
||||
info.setNetEnvironment(DebugConfig.getNetMode())
|
||||
AdasManager.getInstance().setBasicInfo(info)
|
||||
CallerLogger.d("$M_ADAS_IMPL$TAG", "同步PAD的SN给工控机……")
|
||||
// 设置PAD-SN给工控,网络环境
|
||||
AdasManager.getInstance()
|
||||
.sendBasicInfoResp(MoGoAiCloudClientConfig.getInstance().sn, DebugConfig.getNetMode())
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传自动驾驶状态任务
|
||||
*/
|
||||
private fun updateDriveStatusTask() {
|
||||
Logger.d(TAG, "updateDriveStatusTask")
|
||||
CallerLogger.d("$M_ADAS_IMPL$TAG", "updateDriveStatusTask")
|
||||
Flowable.interval(0, 5, TimeUnit.SECONDS)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.unsubscribeOn(Schedulers.io())
|
||||
|
||||
@@ -1,28 +1,24 @@
|
||||
package com.mogo.eagle.core.function.autopilot.adapter;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.mogo.eagle.core.data.autopilot.AutoPilotRecordResult;
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotCarStateInfo;
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotWarnMessage;
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
|
||||
import com.mogo.eagle.core.data.traffic.TrafficData;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotCarStateListener;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotIdentifyListener;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotCarStatusListenerManager;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotVehicleStateListener;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotIdentifyListenerManager;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotVehicleStateListenerManager;
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils;
|
||||
import com.mogo.module.common.drawer.IdentifyDataDrawer;
|
||||
import com.zhidao.support.adas.high.bean.CarStateInfo;
|
||||
import com.zhidao.support.obu.ami.AmiClientManager;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import chassis.Chassis;
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
import record_cache.RecordPanelOuterClass;
|
||||
|
||||
public class MoGoHandAdasMsgManager implements
|
||||
IMoGoAutopilotIdentifyListener,
|
||||
IMoGoAutopilotCarStateListener {
|
||||
IMoGoAutopilotVehicleStateListener {
|
||||
|
||||
private final String TAG = "AdasEventManager";
|
||||
|
||||
@@ -30,7 +26,7 @@ public class MoGoHandAdasMsgManager implements
|
||||
|
||||
private MoGoHandAdasMsgManager() {
|
||||
CallerAutopilotIdentifyListenerManager.INSTANCE.addListener(TAG, this);
|
||||
CallerAutopilotCarStatusListenerManager.INSTANCE.addListener(TAG, this);
|
||||
CallerAutopilotVehicleStateListenerManager.INSTANCE.addListener(TAG, this);
|
||||
}
|
||||
|
||||
public static MoGoHandAdasMsgManager getInstance() {
|
||||
@@ -44,40 +40,25 @@ public class MoGoHandAdasMsgManager implements
|
||||
return moGoHandAdasMsgManager;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onAutopilotCarStateData(@Nullable AutopilotCarStateInfo autoPilotCarStateInfo) {
|
||||
// 获取的自动驾驶车辆信息不是空的时候
|
||||
if (autoPilotCarStateInfo != null) {
|
||||
//can数据转发
|
||||
AutopilotCarStateInfo.ValuesBean bean = autoPilotCarStateInfo.getValues();
|
||||
|
||||
if (bean != null) {
|
||||
//转向灯状态 0是正常 1是左转 2是右转
|
||||
//turnLightOften 是sdk适配的字段,后期建议CarStateInfo和AutopilotCarStateInfo统一成一个
|
||||
int turnLight = bean.getTurnLightOften();
|
||||
AmiClientManager.getInstance().setTurnLightState(turnLight);
|
||||
int brakeLight = bean.getBrake_light(); //1刹车灯亮 其他为松开
|
||||
// Logger.d(TAG, "onCarStateData ---- turnLight = " + turnLight + "---brakeLight = " + brakeLight);
|
||||
//设置转向灯
|
||||
if (turnLight == 1 || turnLight == 2) {
|
||||
CallerHmiManager.INSTANCE.showBrakeLight(0);
|
||||
CallerHmiManager.INSTANCE.showTurnLight(turnLight);
|
||||
}
|
||||
|
||||
//设置刹车信息
|
||||
if (turnLight == 0){
|
||||
CallerHmiManager.INSTANCE.showBrakeLight(brakeLight);
|
||||
}
|
||||
} else {
|
||||
Logger.e(TAG, "bean == null ");
|
||||
}
|
||||
public void onAutopilotLightSwitchData(Chassis.LightSwitch lightSwitch) {
|
||||
//can数据转发 转向灯状态 0是正常 1是左转 2是右转
|
||||
if (lightSwitch != null) {
|
||||
int turnLightNum = lightSwitch.getNumber();
|
||||
AmiClientManager.getInstance().setTurnLightState(turnLightNum);
|
||||
//设置转向灯
|
||||
CallerHmiManager.INSTANCE.showTurnLight(turnLightNum);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotBrakeLightData(boolean brakeLight) {
|
||||
//设置刹车信息
|
||||
CallerHmiManager.INSTANCE.showBrakeLight(brakeLight ? 1 : 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotIdentifyDataUpdate(@Nullable ArrayList<TrafficData> trafficData) {
|
||||
public void onAutopilotIdentifyDataUpdate(List<MessagePad.TrackedObject> trafficData) {
|
||||
try {
|
||||
if (FunctionBuildConfig.isDrawIdentifyData) {
|
||||
ThreadUtils.getSinglePool().execute(() ->
|
||||
@@ -92,13 +73,13 @@ public class MoGoHandAdasMsgManager implements
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotWarnMessage(@Nullable AutopilotWarnMessage autopilotWarnMessage) {
|
||||
public void onAutopilotWarnMessage(MessagePad.Warn warn) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onAutopilotRecordResult(AutoPilotRecordResult result) {
|
||||
public void onAutopilotRecordResult(RecordPanelOuterClass.RecordPanel recordPanel) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.mogo.eagle.core.function.autopilot.entity;
|
||||
|
||||
/**
|
||||
* Created by XuYong on 2021/5/28 16:12
|
||||
* Created by SuYong on 2021/5/28 16:12
|
||||
*/
|
||||
public class AutonomousDriveStatusBean {
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.mogo.eagle.core.function.autopilot.entity;
|
||||
|
||||
/**
|
||||
* Created by XuYong on 2021/5/31 16:24
|
||||
* Created by SuYong on 2021/5/31 16:24
|
||||
*/
|
||||
public class ReportSiteBean {
|
||||
private String sn;
|
||||
|
||||
@@ -8,7 +8,6 @@ import com.mogo.eagle.core.function.autopilot.entity.ReportSiteBean;
|
||||
import com.mogo.eagle.core.network.RequestOptions;
|
||||
import com.mogo.eagle.core.network.SubscribeImpl;
|
||||
import com.mogo.eagle.core.network.utils.GsonUtil;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.constants.HostConst;
|
||||
|
||||
@@ -89,7 +88,6 @@ public class AdasServiceModel {
|
||||
@Override
|
||||
public void onSuccess(BaseData o) {
|
||||
super.onSuccess(o);
|
||||
Logger.d(TAG, "autopilotArrive success");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
package com.mogo.eagle.core.function.autopilot.server
|
||||
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotControlCmdParameter
|
||||
import com.mogo.eagle.core.data.trafficlight.TrafficLightResult
|
||||
import com.mogo.eagle.core.function.api.trafficlight.IMoGoTrafficLightListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager
|
||||
import com.mogo.eagle.core.function.call.trafficlight.CallTrafficLightListenerManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
|
||||
import com.mogo.eagle.core.utilcode.util.GsonUtils
|
||||
|
||||
/**
|
||||
* @author xiaoyuzhou
|
||||
@@ -25,12 +22,10 @@ class AsyncDataToAutopilotServer private constructor() : IMoGoTrafficLightListen
|
||||
}
|
||||
|
||||
fun initServer() {
|
||||
Logger.d(TAG, "initServer……")
|
||||
CallTrafficLightListenerManager.registerTrafficLightListener(TAG, this)
|
||||
}
|
||||
|
||||
override fun onTrafficLightStatus(trafficLightResult: TrafficLightResult) {
|
||||
val autopilotControlCmdParameter = AutopilotControlCmdParameter("light", trafficLightResult)
|
||||
CallerAutoPilotManager.sendDataToAutopilot(GsonUtils.toJson(autopilotControlCmdParameter))
|
||||
CallerAutoPilotManager.sendTrafficLightData(trafficLightResult)
|
||||
}
|
||||
}
|
||||
@@ -1,102 +0,0 @@
|
||||
package com.mogo.eagle.core.function.autopilot.utils
|
||||
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotCarStateInfo
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotGuardianStatusInfo
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotRouteInfo
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotWarnMessage
|
||||
import com.mogo.eagle.core.data.enums.TrafficTypeEnum
|
||||
import com.mogo.eagle.core.data.traffic.TrafficData
|
||||
import com.zhidao.support.adas.high.bean.AutopilotRoute
|
||||
import com.zhidao.support.adas.high.bean.CarStateInfo
|
||||
import com.zhidao.support.adas.high.bean.RectInfo
|
||||
import com.zhidao.support.adas.high.bean.WarnMessageInfo
|
||||
import com.zhidao.support.adas.high.bean.guardian.AutopilotGuardianInfo
|
||||
import com.zhidao.utils.common.GsonUtil
|
||||
|
||||
/**
|
||||
* @author xiaoyuzhou
|
||||
* @date 2021/10/18 1:32 下午
|
||||
*/
|
||||
object AdasObjectConvertUtils {
|
||||
val TAG = "AdasObjectConvertUtils"
|
||||
|
||||
fun fromAutopilotGuardianInfo(autopilotGuardianInfo: AutopilotGuardianInfo): AutopilotGuardianStatusInfo? {
|
||||
return GsonUtil.objectFromJson(
|
||||
GsonUtil.jsonFromObject(autopilotGuardianInfo),
|
||||
AutopilotGuardianStatusInfo::class.java
|
||||
)
|
||||
}
|
||||
|
||||
fun fromAdasAutopilotRoute(carStateInfo: AutopilotRoute): AutopilotRouteInfo? {
|
||||
return GsonUtil.objectFromJson(
|
||||
GsonUtil.jsonFromObject(carStateInfo),
|
||||
AutopilotRouteInfo::class.java
|
||||
)
|
||||
}
|
||||
|
||||
fun fromAdasCarStateInfoObject(carStateInfo: CarStateInfo): AutopilotCarStateInfo? {
|
||||
return GsonUtil.objectFromJson(
|
||||
GsonUtil.jsonFromObject(carStateInfo),
|
||||
AutopilotCarStateInfo::class.java
|
||||
)
|
||||
}
|
||||
|
||||
fun fromAdasObject(info: WarnMessageInfo?): AutopilotWarnMessage? {
|
||||
if (info == null) {
|
||||
return null
|
||||
}
|
||||
val warnMessage = AutopilotWarnMessage()
|
||||
warnMessage.content = info.content
|
||||
warnMessage.level = info.level
|
||||
try {
|
||||
warnMessage.type = info.type.toInt()
|
||||
} catch (e: NumberFormatException) {
|
||||
return null
|
||||
}
|
||||
warnMessage.value = info.value
|
||||
return warnMessage
|
||||
}
|
||||
|
||||
fun regroupTrafficDataData(datums: List<RectInfo.RectBean?>?): ArrayList<TrafficData>? {
|
||||
if (datums == null || datums.isEmpty()) {
|
||||
return null
|
||||
}
|
||||
val recognizedListResults: ArrayList<TrafficData> = ArrayList()
|
||||
for (model in datums) {
|
||||
if (model == null) {
|
||||
continue
|
||||
}
|
||||
val recognizedListResult = fromAdasTrafficDataObject(model)
|
||||
if (recognizedListResult != null) {
|
||||
recognizedListResults.add(recognizedListResult)
|
||||
}
|
||||
}
|
||||
return recognizedListResults
|
||||
}
|
||||
|
||||
fun fromAdasTrafficDataObject(model: RectInfo.RectBean?): TrafficData? {
|
||||
if (model == null) {
|
||||
return null
|
||||
}
|
||||
val result = TrafficData()
|
||||
result.uuid = model.uuid
|
||||
result.lat = model.lat
|
||||
result.lon = model.lon
|
||||
result.type = TrafficTypeEnum.getType(model.type.toInt())
|
||||
result.heading = model.heading
|
||||
result.systemTime = model.systemTime.toLong()
|
||||
result.satelliteTime = model.satelliteTime.toLong()
|
||||
result.alt = model.alt
|
||||
result.speed = model.speed
|
||||
result.carId = model.carId
|
||||
result.dataAccuracy = model.dataAccuracy
|
||||
result.distance = model.distance
|
||||
result.threatLevel = model.drawlevel
|
||||
|
||||
//Log.d(TAG, "TrafficData = $result")
|
||||
return result
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -3,8 +3,8 @@ package com.mogo.eagle.core.function.carcorder.service
|
||||
import android.content.Intent
|
||||
import android.hardware.usb.UsbDevice
|
||||
import android.os.IBinder
|
||||
import android.util.Log
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_CORDER
|
||||
import com.mogo.usbcamera.UVCCameraHelper
|
||||
import com.serenegiant.usb.IFrameCallback
|
||||
import com.serenegiant.usb.USBMonitor
|
||||
@@ -51,7 +51,7 @@ class CarcorderService : BaseService() {
|
||||
override fun onCreate() {
|
||||
super.onCreate()
|
||||
if (DEBUG) {
|
||||
Logger.d(TAG, "onCreate……")
|
||||
CallerLogger.d("$M_CORDER$TAG", "onCreate……")
|
||||
}
|
||||
if (mUSBMonitor == null) {
|
||||
mUSBMonitor = USBMonitor(applicationContext, mOnDeviceConnectListener)
|
||||
@@ -63,7 +63,7 @@ class CarcorderService : BaseService() {
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
if (DEBUG) Log.d(TAG, "onDestroy:")
|
||||
if (DEBUG) CallerLogger.d("$M_CORDER$TAG", "onDestroy:")
|
||||
if (mUSBMonitor != null) {
|
||||
mUSBMonitor!!.unregister()
|
||||
mUSBMonitor = null
|
||||
@@ -80,14 +80,14 @@ class CarcorderService : BaseService() {
|
||||
}
|
||||
|
||||
override fun onRebind(intent: Intent) {
|
||||
if (DEBUG) Log.d(TAG, "onRebind:$intent")
|
||||
if (DEBUG) CallerLogger.d("$M_CORDER$TAG", "onRebind:$intent")
|
||||
}
|
||||
|
||||
|
||||
override fun onUnbind(intent: Intent): Boolean {
|
||||
if (DEBUG) Log.d(TAG, "onUnbind:$intent")
|
||||
if (DEBUG) CallerLogger.d("$M_CORDER$TAG", "onUnbind:$intent")
|
||||
|
||||
if (DEBUG) Log.d(TAG, "onUnbind:finished")
|
||||
if (DEBUG) CallerLogger.d("$M_CORDER$TAG", "onUnbind:finished")
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -102,25 +102,25 @@ class CarcorderService : BaseService() {
|
||||
*/
|
||||
private val mOnDeviceConnectListener: OnDeviceConnectListener = object : OnDeviceConnectListener {
|
||||
override fun onAttach(device: UsbDevice) {
|
||||
if (DEBUG) Log.d(TAG, "OnDeviceConnectListener#onAttach:${device.deviceName}---mDeviceList:${mDeviceList?.size}")
|
||||
if (DEBUG) CallerLogger.d("$M_CORDER$TAG", "OnDeviceConnectListener#onAttach:${device.deviceName}---mDeviceList:${mDeviceList?.size}")
|
||||
mUSBMonitor!!.requestPermission(device)
|
||||
}
|
||||
|
||||
override fun onConnect(device: UsbDevice, ctrlBlock: UsbControlBlock, createNew: Boolean) {
|
||||
if (DEBUG) Log.d(TAG, "OnDeviceConnectListener#onConnect:${device.deviceName}")
|
||||
if (DEBUG) CallerLogger.d("$M_CORDER$TAG", "OnDeviceConnectListener#onConnect:${device.deviceName}")
|
||||
openCamera(device, ctrlBlock, createNew)
|
||||
}
|
||||
|
||||
override fun onDisconnect(device: UsbDevice, ctrlBlock: UsbControlBlock) {
|
||||
if (DEBUG) Log.d(TAG, "OnDeviceConnectListener#onDisconnect:${device.deviceName}")
|
||||
if (DEBUG) CallerLogger.d("$M_CORDER$TAG", "OnDeviceConnectListener#onDisconnect:${device.deviceName}")
|
||||
}
|
||||
|
||||
override fun onDettach(device: UsbDevice) {
|
||||
if (DEBUG) Log.d(TAG, "OnDeviceConnectListener#onDettach:${device.deviceName}")
|
||||
if (DEBUG) CallerLogger.d("$M_CORDER$TAG", "OnDeviceConnectListener#onDettach:${device.deviceName}")
|
||||
}
|
||||
|
||||
override fun onCancel(device: UsbDevice) {
|
||||
if (DEBUG) Log.d(TAG, "OnDeviceConnectListener#onCancel:${device.deviceName}")
|
||||
if (DEBUG) CallerLogger.d("$M_CORDER$TAG", "OnDeviceConnectListener#onCancel:${device.deviceName}")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -132,7 +132,7 @@ class CarcorderService : BaseService() {
|
||||
mUVCCamera = UVCCamera()
|
||||
mUVCCamera!!.open(ctrlBlock)
|
||||
mUVCCamera!!.setStatusCallback { statusClass, event, selector, statusAttribute, data ->
|
||||
if (DEBUG) Log.d(TAG, "IStatusCallback#onStatus(statusClass=${statusClass},event=${event},selector=${selector},statusAttribute=${statusAttribute},data=${data})")
|
||||
if (DEBUG) CallerLogger.d("$M_CORDER$TAG", "IStatusCallback#onStatus(statusClass=${statusClass},event=${event},selector=${selector},statusAttribute=${statusAttribute},data=${data})")
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -156,7 +156,7 @@ class CarcorderService : BaseService() {
|
||||
* 视频帧回掉
|
||||
*/
|
||||
private val mIFrameCallback = IFrameCallback { frame ->
|
||||
if (DEBUG) Log.d(TAG, "IFrameCallback#onFrame:${frame}")
|
||||
if (DEBUG) CallerLogger.d("$M_CORDER$TAG", "IFrameCallback#onFrame:${frame}")
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,8 +2,8 @@ package com.mogo.eagle.core.function.carcorder.service
|
||||
|
||||
import android.content.Intent
|
||||
import android.os.IBinder
|
||||
import android.util.Log
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_CORDER
|
||||
import com.serenegiant.usb.common.BaseService
|
||||
|
||||
/**
|
||||
@@ -17,14 +17,14 @@ class LivePushService : BaseService() {
|
||||
override fun onCreate() {
|
||||
super.onCreate()
|
||||
if (DEBUG) {
|
||||
Logger.d(TAG, "onCreate……")
|
||||
CallerLogger.d("$M_CORDER$TAG", "onCreate……")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
if (DEBUG) Log.d(TAG, "onDestroy:")
|
||||
if (DEBUG) CallerLogger.d("$M_CORDER$TAG", "onDestroy:")
|
||||
|
||||
}
|
||||
|
||||
@@ -38,14 +38,14 @@ class LivePushService : BaseService() {
|
||||
}
|
||||
|
||||
override fun onRebind(intent: Intent) {
|
||||
if (DEBUG) Log.d(TAG, "onRebind:$intent")
|
||||
if (DEBUG) CallerLogger.d("$M_CORDER$TAG", "onRebind:$intent")
|
||||
}
|
||||
|
||||
|
||||
override fun onUnbind(intent: Intent): Boolean {
|
||||
if (DEBUG) Log.d(TAG, "onUnbind:$intent")
|
||||
if (DEBUG) CallerLogger.d("$M_CORDER$TAG", "onUnbind:$intent")
|
||||
|
||||
if (DEBUG) Log.d(TAG, "onUnbind:finished")
|
||||
if (DEBUG) CallerLogger.d("$M_CORDER$TAG", "onUnbind:finished")
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
package com.mogo.eagle.core.function.chat.facade.aop
|
||||
|
||||
import android.os.Looper
|
||||
import android.util.Log
|
||||
import com.mogo.commons.debug.DebugConfig
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_CHAT
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import org.aspectj.lang.ProceedingJoinPoint
|
||||
import org.aspectj.lang.reflect.CodeSignature
|
||||
import org.aspectj.lang.reflect.MethodSignature
|
||||
@@ -37,7 +38,7 @@ open class BaseAspectj {
|
||||
if (Looper.myLooper() != Looper.getMainLooper()) {
|
||||
builder.append("[Thread:\"").append(Thread.currentThread().name).append("\"]")
|
||||
}
|
||||
Log.i(asTag(cls), builder.toString())
|
||||
CallerLogger.d(M_CHAT + asTag(cls), builder.toString())
|
||||
}
|
||||
|
||||
fun exitMethod(joinPoint: ProceedingJoinPoint, result: Any?, lengthMill: Long) {
|
||||
@@ -50,10 +51,10 @@ open class BaseAspectj {
|
||||
&& signature.returnType != Void.TYPE
|
||||
|
||||
val builder = StringBuilder("\u21E0 ")
|
||||
.append(methodName)
|
||||
.append("[")
|
||||
.append(lengthMill)
|
||||
.append("ms]")
|
||||
.append(methodName)
|
||||
.append("[")
|
||||
.append(lengthMill)
|
||||
.append("ms]")
|
||||
|
||||
if (hasReturnType) {
|
||||
builder.append(" = ")
|
||||
@@ -61,7 +62,7 @@ open class BaseAspectj {
|
||||
result.toString()
|
||||
})
|
||||
}
|
||||
Log.i(asTag(cls), builder.toString())
|
||||
CallerLogger.d(M_CHAT + asTag(cls), builder.toString())
|
||||
}
|
||||
|
||||
private fun asTag(cls: Class<*>): String {
|
||||
|
||||
@@ -4,14 +4,11 @@ import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.Handler
|
||||
import android.text.TextUtils
|
||||
import android.util.Log
|
||||
import com.gme.TMG.ITMGContext
|
||||
import com.gme.av.sdk.AVError
|
||||
import com.gme.av.sig.AuthBuffer
|
||||
import com.mogo.commons.debug.DebugConfig
|
||||
import com.mogo.eagle.core.function.api.chat.biz.ChatConsts
|
||||
import com.mogo.eagle.core.function.chat.facade.utils.log
|
||||
import com.mogo.eagle.core.utilcode.util.BuildConfig
|
||||
import com.mogo.eagle.core.utilcode.util.Utils
|
||||
import java.lang.ref.WeakReference
|
||||
import java.util.concurrent.atomic.AtomicBoolean
|
||||
@@ -30,7 +27,7 @@ internal object GMEApi {
|
||||
}
|
||||
|
||||
private val Intent.result: Int
|
||||
get() = getIntExtra("result" , -1)
|
||||
get() = getIntExtra("result", -1)
|
||||
|
||||
private val Intent.errorInfo: String
|
||||
get() = getStringExtra("error_info") ?: ""
|
||||
@@ -46,7 +43,7 @@ internal object GMEApi {
|
||||
private var ctx: WeakReference<Context>? = null
|
||||
|
||||
private val tmgCtx by lazy {
|
||||
ITMGContext.GetInstance(ctx?.get()?: Utils.getApp())
|
||||
ITMGContext.GetInstance(ctx?.get() ?: Utils.getApp())
|
||||
}
|
||||
|
||||
private val delegate = object : ITMGContext.ITMGDelegate() {
|
||||
@@ -79,7 +76,7 @@ internal object GMEApi {
|
||||
log(ChatConsts.TAG, "成员进房====$it===ownId:$openId")
|
||||
it.toInt() > 99999
|
||||
}.toTypedArray()
|
||||
if (filtered.isEmpty()) {
|
||||
if (filtered.isEmpty()) {
|
||||
log(ChatConsts.TAG, "成员为空,无操作")
|
||||
return
|
||||
}
|
||||
@@ -95,11 +92,11 @@ internal object GMEApi {
|
||||
}
|
||||
|
||||
fun enableAudio() {
|
||||
Log.d(ChatConsts.TAG, "-- enable audio --- 1 ---")
|
||||
log(ChatConsts.TAG, "-- enable audio --- 1 ---")
|
||||
if (!hasInit.get()) {
|
||||
return
|
||||
}
|
||||
Log.d(ChatConsts.TAG, "-- enable audio --- 2 ---")
|
||||
log(ChatConsts.TAG, "-- enable audio --- 2 ---")
|
||||
val audioCtrl = tmgCtx.GetAudioCtrl()
|
||||
//开启麦克
|
||||
audioCtrl?.EnableMic(true)
|
||||
@@ -112,11 +109,11 @@ internal object GMEApi {
|
||||
}
|
||||
|
||||
fun disableAudio() {
|
||||
Log.d(ChatConsts.TAG, "-- disable audio --- 1 ---")
|
||||
log(ChatConsts.TAG, "-- disable audio --- 1 ---")
|
||||
if (!hasInit.get()) {
|
||||
return
|
||||
}
|
||||
Log.d(ChatConsts.TAG, "-- disable audio --- 2 ---")
|
||||
log(ChatConsts.TAG, "-- disable audio --- 2 ---")
|
||||
val audioCtrl = tmgCtx.GetAudioCtrl()
|
||||
audioCtrl?.EnableSpeaker(false)
|
||||
//开启麦克
|
||||
@@ -190,7 +187,7 @@ internal object GMEApi {
|
||||
return
|
||||
}
|
||||
if (mute) {
|
||||
tmgCtx.GetAudioCtrl()?.SetMicVolume(0)
|
||||
tmgCtx.GetAudioCtrl()?.SetMicVolume(0)
|
||||
} else {
|
||||
tmgCtx.GetAudioCtrl()?.SetMicVolume(100)
|
||||
}
|
||||
@@ -199,17 +196,17 @@ internal object GMEApi {
|
||||
|
||||
sealed class GmeState {
|
||||
|
||||
class InitSuccess(val openId: String): GmeState()
|
||||
class InitSuccess(val openId: String) : GmeState()
|
||||
|
||||
class InitFail(val code: Int): GmeState()
|
||||
class InitFail(val code: Int) : GmeState()
|
||||
|
||||
object EnterRoomSuccess: GmeState()
|
||||
object EnterRoomSuccess : GmeState()
|
||||
|
||||
class EnterRoomFail(val code: Int, val msg: String): GmeState()
|
||||
class EnterRoomFail(val code: Int, val msg: String) : GmeState()
|
||||
|
||||
class UserChangeInRoom(val isEnter: Boolean, val left: Array<String>): GmeState()
|
||||
class UserChangeInRoom(val isEnter: Boolean, val left: Array<String>) : GmeState()
|
||||
|
||||
object ExitRoomSuccess: GmeState()
|
||||
object ExitRoomSuccess : GmeState()
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -33,7 +33,6 @@ class VehicleMonitoringManager : ICheckProvider, IMogoStatusChangedListener {
|
||||
private var hasTipShow = false //是否已经弹框提示
|
||||
var dialog: CheckDialog? = null
|
||||
override fun init(context: Context) {
|
||||
LogUtils.dTag(TAG, "初始化 CheckProvider 模块")
|
||||
mContext = context
|
||||
MogoApisHandler.getInstance().apis.statusManagerApi.registerStatusChangedListener(
|
||||
TAG,
|
||||
|
||||
@@ -7,7 +7,6 @@ import android.animation.ObjectAnimator;
|
||||
import android.animation.ValueAnimator;
|
||||
import android.graphics.Rect;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.ProgressBar;
|
||||
@@ -91,20 +90,15 @@ public class CheckActivity extends AppCompatActivity {
|
||||
mRecyclerView.setAdapter(mCheckAdapter);
|
||||
}
|
||||
|
||||
|
||||
private void checkAction() {
|
||||
CheckNetWork.INSTANCE.checkNetWork(this.getApplicationContext(), new ICheckResultCallBack() {
|
||||
@Override
|
||||
public void callBackWithCheckData(CheckResultData data) {
|
||||
Log.d("CheckActivity", "车辆自检结果是:" + data.toString());
|
||||
ThreadUtils.runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (data != null && mCheckAdapter != null) {
|
||||
mCheckAdapter.errorMsg = null;
|
||||
mCheckAdapter.mCheckResultData = data;
|
||||
mCheckAdapter.notifyDataSetChanged();
|
||||
}
|
||||
ThreadUtils.runOnUiThread(() -> {
|
||||
if (data != null && mCheckAdapter != null) {
|
||||
mCheckAdapter.errorMsg = null;
|
||||
mCheckAdapter.mCheckResultData = data;
|
||||
mCheckAdapter.notifyDataSetChanged();
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -121,7 +115,6 @@ public class CheckActivity extends AppCompatActivity {
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* **************************************************************************************检测动画
|
||||
*/
|
||||
@@ -180,16 +173,12 @@ public class CheckActivity extends AppCompatActivity {
|
||||
public void animatorScanCarBorder(boolean show, int weight) {
|
||||
if (show) {
|
||||
mValueAnimator = ValueAnimator.ofInt(0, weight);
|
||||
} else {
|
||||
}
|
||||
mValueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
|
||||
@Override
|
||||
public void onAnimationUpdate(ValueAnimator animation) {
|
||||
Rect rect = new Rect(0, 0, (int) mValueAnimator.getAnimatedValue(), scanTopImageView.getHeight());
|
||||
setProgressBarRefresh((int) mValueAnimator.getAnimatedValue());
|
||||
scanTopImageView.setClip(rect);
|
||||
tipsImageView.setClip(rect);
|
||||
}
|
||||
mValueAnimator.addUpdateListener(animation -> {
|
||||
Rect rect = new Rect(0, 0, (int) mValueAnimator.getAnimatedValue(), scanTopImageView.getHeight());
|
||||
setProgressBarRefresh((int) mValueAnimator.getAnimatedValue());
|
||||
scanTopImageView.setClip(rect);
|
||||
tipsImageView.setClip(rect);
|
||||
});
|
||||
mValueAnimator.setDuration(DURATION_TIME);
|
||||
mValueAnimator.start();
|
||||
@@ -200,7 +189,7 @@ public class CheckActivity extends AppCompatActivity {
|
||||
*/
|
||||
public void setProgressBarRefresh(int animateValue) {
|
||||
if (mProgressBar != null) {
|
||||
double scale = new BigDecimal((float) animateValue / scanBottomCarImage.getWidth())
|
||||
double scale = BigDecimal.valueOf((float) animateValue / scanBottomCarImage.getWidth())
|
||||
.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue() * 100;
|
||||
if (mProgressBar.getProgress() < 100) {
|
||||
mProgressBar.setProgress((int) scale);
|
||||
@@ -231,7 +220,7 @@ public class CheckActivity extends AppCompatActivity {
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
mCheckAdapter.ondestry();
|
||||
mCheckAdapter.onDestroy();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.mogo.eagle.core.function.check.view;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@@ -23,7 +22,6 @@ import com.mogo.eagle.core.function.check.net.CheckResultData;
|
||||
*/
|
||||
public class CheckAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
||||
|
||||
private static final String TAG = "CheckActivity";
|
||||
LayoutInflater mLayoutInflater;
|
||||
CheckResultData mCheckResultData;
|
||||
private Context mContext;
|
||||
@@ -51,13 +49,11 @@ public class CheckAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
||||
if (viewType == CheckItemInfo.CheckAdapterStyleEnum.ITEM_TYPE_CHECK_TITLE) {
|
||||
View v = mLayoutInflater.inflate(R.layout.check_titel, parent,
|
||||
false);
|
||||
CheckTitleViewHolder holder = new CheckTitleViewHolder(v);
|
||||
return holder;
|
||||
return new CheckTitleViewHolder(v);
|
||||
}
|
||||
View v = mLayoutInflater.inflate(R.layout.check_list, parent,
|
||||
false);
|
||||
CheckListViewHolder holder = new CheckListViewHolder(v);
|
||||
return holder;
|
||||
return new CheckListViewHolder(v);
|
||||
}
|
||||
|
||||
public void dismissDialog() {
|
||||
@@ -66,7 +62,7 @@ public class CheckAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
||||
}
|
||||
}
|
||||
|
||||
public void ondestry() {
|
||||
public void onDestroy() {
|
||||
mContext = null;
|
||||
mCheckInfoListDialog = null;
|
||||
}
|
||||
@@ -74,9 +70,9 @@ public class CheckAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
||||
/**
|
||||
* 顶部view列表
|
||||
*/
|
||||
class CheckTitleViewHolder extends RecyclerView.ViewHolder {
|
||||
private ImageView errorImage;
|
||||
private TextView mTextView;
|
||||
private static class CheckTitleViewHolder extends RecyclerView.ViewHolder {
|
||||
private final ImageView errorImage;
|
||||
private final TextView mTextView;
|
||||
|
||||
public CheckTitleViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
@@ -88,11 +84,11 @@ public class CheckAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
||||
/**
|
||||
* 版本->软件检测
|
||||
*/
|
||||
class CheckListViewHolder extends RecyclerView.ViewHolder {
|
||||
private TextView viewTitle;
|
||||
private static class CheckListViewHolder extends RecyclerView.ViewHolder {
|
||||
private final TextView viewTitle;
|
||||
private TextView iconAutoTitle;
|
||||
private TextView autoRiskState;
|
||||
private ImageView iconAuto;
|
||||
private final TextView autoRiskState;
|
||||
private final ImageView iconAuto;
|
||||
|
||||
public CheckListViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
@@ -135,7 +131,6 @@ public class CheckAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
||||
((CheckListViewHolder) holder).autoRiskState.setText("存在异常项");
|
||||
}
|
||||
((CheckListViewHolder) holder).iconAuto.setOnClickListener(v -> {
|
||||
Log.d(TAG, "硬件检测结果:");
|
||||
if (mCheckInfoListDialog != null) {
|
||||
mCheckInfoListDialog.dismiss();
|
||||
}
|
||||
@@ -155,7 +150,6 @@ public class CheckAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
||||
((CheckListViewHolder) holder).autoRiskState.setText("存在异常项");
|
||||
}
|
||||
((CheckListViewHolder) holder).iconAuto.setOnClickListener(v -> {
|
||||
Log.d(TAG, "系统检测结果:");
|
||||
if (mCheckInfoListDialog != null) {
|
||||
mCheckInfoListDialog.dismiss();
|
||||
}
|
||||
|
||||
@@ -19,9 +19,7 @@ import com.mogo.module.common.dialog.BaseFloatDialog;
|
||||
*/
|
||||
public class CheckDialog extends BaseFloatDialog {
|
||||
|
||||
private ImageView cancel;
|
||||
private boolean showWarning;
|
||||
private TextView checkDetail;
|
||||
private Context mContext;
|
||||
|
||||
public CheckDialog(@NonNull Context context, boolean hasError) {
|
||||
@@ -37,11 +35,11 @@ public class CheckDialog extends BaseFloatDialog {
|
||||
|
||||
public void initView() {
|
||||
setContentView(R.layout.check_dialog);
|
||||
cancel = findViewById(R.id.cancel_button);
|
||||
ImageView cancel = findViewById(R.id.cancel_button);
|
||||
cancel.setOnClickListener(v -> {
|
||||
dismiss();
|
||||
});
|
||||
checkDetail = findViewById(R.id.check_detail);
|
||||
TextView checkDetail = findViewById(R.id.check_detail);
|
||||
checkDetail.setOnClickListener(v -> {
|
||||
dismiss();
|
||||
if (mContext != null) {
|
||||
@@ -50,17 +48,15 @@ public class CheckDialog extends BaseFloatDialog {
|
||||
});
|
||||
|
||||
//根据条件显示体检页面/风险提示
|
||||
if (showWarning == true) {
|
||||
if (showWarning) {
|
||||
findViewById(R.id.error_view).setVisibility(View.VISIBLE);
|
||||
findViewById(R.id.check_view).setVisibility(View.INVISIBLE);
|
||||
|
||||
} else {
|
||||
findViewById(R.id.error_view).setVisibility(View.INVISIBLE);
|
||||
findViewById(R.id.check_view).setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void cancel() {
|
||||
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@ import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.ScrollView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
@@ -25,14 +24,14 @@ public class CheckInfoAdapter extends RecyclerView.Adapter {
|
||||
LayoutInflater mLayoutInflater;
|
||||
private Context mContext;
|
||||
private String mStyle;
|
||||
private List<CheckResultData.CheckListItem> showData;
|
||||
private final List<CheckResultData.CheckListItem> showData;
|
||||
//item类型
|
||||
public static final int ITEM_TYPE_CONTENT = 0;//内容
|
||||
public static final int ITEM_TYPE_BOTTOM = 1;//footer类型
|
||||
//适配UI的空白表格
|
||||
private int mBottomCount = 0;
|
||||
|
||||
public CheckInfoAdapter(Context context, String style, List checkResultData) {
|
||||
public CheckInfoAdapter(Context context, String style, List<CheckResultData.CheckListItem> checkResultData) {
|
||||
mContext = context;
|
||||
mStyle = style;
|
||||
showData = checkResultData;
|
||||
@@ -50,7 +49,7 @@ public class CheckInfoAdapter extends RecyclerView.Adapter {
|
||||
}
|
||||
View v = mLayoutInflater.inflate(R.layout.check_info_adapter, parent,
|
||||
false);
|
||||
CheckInfoAdapter.CheckInfoViewHolder holder = new CheckInfoAdapter.CheckInfoViewHolder(v);
|
||||
CheckInfoAdapter.CheckInfoViewHolder holder = new CheckInfoViewHolder(v);
|
||||
return holder;
|
||||
}
|
||||
|
||||
@@ -62,7 +61,7 @@ public class CheckInfoAdapter extends RecyclerView.Adapter {
|
||||
if (position < showData.size() * 2) {
|
||||
int index = position / 2;
|
||||
CheckResultData.CheckListItem positionItem = showData.get(index);
|
||||
if (isEven(position) == true) {//偶数隐藏图片显示检测指标
|
||||
if (isEven(position)) {//偶数隐藏图片显示检测指标
|
||||
((CheckInfoViewHolder) holder).checkIcon.setVisibility(View.GONE);
|
||||
((CheckInfoViewHolder) holder).mTextView.setText(positionItem.getName());
|
||||
} else {//奇数显示图片和检测指标结果
|
||||
@@ -105,9 +104,9 @@ public class CheckInfoAdapter extends RecyclerView.Adapter {
|
||||
return showData.size() * 2 + mBottomCount;
|
||||
}
|
||||
|
||||
public class CheckInfoViewHolder extends RecyclerView.ViewHolder {
|
||||
private ImageView checkIcon;
|
||||
private TextView mTextView;
|
||||
private static class CheckInfoViewHolder extends RecyclerView.ViewHolder {
|
||||
private final ImageView checkIcon;
|
||||
private final TextView mTextView;
|
||||
|
||||
public CheckInfoViewHolder(View v) {
|
||||
super(v);
|
||||
@@ -116,7 +115,7 @@ public class CheckInfoAdapter extends RecyclerView.Adapter {
|
||||
}
|
||||
}
|
||||
|
||||
public class CheckInfoFooter extends RecyclerView.ViewHolder {
|
||||
private static class CheckInfoFooter extends RecyclerView.ViewHolder {
|
||||
public CheckInfoFooter(View v) {
|
||||
super(v);
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@ import android.graphics.Canvas;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.graphics.drawable.GradientDrawable;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
@@ -19,9 +18,8 @@ import androidx.recyclerview.widget.StaggeredGridLayoutManager;
|
||||
* @since: 9/22/21
|
||||
*/
|
||||
public class CheckInfoGridItemDivider extends RecyclerView.ItemDecoration {
|
||||
private String TAG = getClass().getSimpleName();
|
||||
private static final int[] ATTRS = new int[]{android.R.attr.listDivider};
|
||||
private Drawable divider;
|
||||
private final Drawable divider;
|
||||
|
||||
public CheckInfoGridItemDivider(Context context) {
|
||||
final TypedArray a = context.obtainStyledAttributes(ATTRS);
|
||||
@@ -44,7 +42,6 @@ public class CheckInfoGridItemDivider extends RecyclerView.ItemDecoration {
|
||||
|
||||
@Override
|
||||
public void onDraw(Canvas c, RecyclerView parent, RecyclerView.State state) {
|
||||
|
||||
drawHorizontal(c, parent);
|
||||
drawVertical(c, parent);
|
||||
|
||||
@@ -138,10 +135,7 @@ public class CheckInfoGridItemDivider extends RecyclerView.ItemDecoration {
|
||||
|
||||
//是否为第一行
|
||||
private boolean isFirstRaw(int pos, int spanCount) {
|
||||
if (pos < spanCount) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return pos < spanCount;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -63,7 +63,7 @@ public class CheckInfoListDialog extends BaseFloatDialog {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
List resultData = showInfoResult();
|
||||
List<CheckResultData.CheckListItem> resultData = showInfoResult();
|
||||
CheckInfoAdapter adapter = new CheckInfoAdapter(mContext, mStyle, resultData);
|
||||
mRecyclerView.setAdapter(adapter);
|
||||
//关闭按钮
|
||||
@@ -72,13 +72,13 @@ public class CheckInfoListDialog extends BaseFloatDialog {
|
||||
});
|
||||
}
|
||||
|
||||
public List showInfoResult() {
|
||||
public List<CheckResultData.CheckListItem> showInfoResult() {
|
||||
|
||||
if (result.size() > 0) {
|
||||
result.clear();
|
||||
}
|
||||
try {
|
||||
List<CheckResultData.CheckListItem> checkListResult = new ArrayList();
|
||||
List<CheckResultData.CheckListItem> checkListResult = new ArrayList<CheckResultData.CheckListItem>();
|
||||
try {
|
||||
if (mStyle.equals(CheckItemInfo.CheckInfoStyle.CHECK_INFO_STYLE_DEVICES)) {
|
||||
checkListResult = mCheckResultData.getData().getDevices();
|
||||
|
||||
@@ -15,8 +15,8 @@ import com.mogo.eagle.core.function.check.R;
|
||||
* @since: 9/29/21
|
||||
*/
|
||||
public class CheckInfoRecyclerView extends RecyclerView {
|
||||
private int maxHeight = (int) getContext().getResources().getDimension(R.dimen.check_height);
|
||||
private int maxWeight = (int) getContext().getResources().getDimension(R.dimen.check_width);
|
||||
private final int maxHeight = (int) getContext().getResources().getDimension(R.dimen.check_height);
|
||||
private final int maxWeight = (int) getContext().getResources().getDimension(R.dimen.check_width);
|
||||
|
||||
public CheckInfoRecyclerView(@NonNull Context context) {
|
||||
super(context);
|
||||
|
||||
@@ -6,7 +6,6 @@ import android.util.AttributeSet;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.mogo.eagle.core.utilcode.util.LogUtils;
|
||||
|
||||
/**
|
||||
* @author liujing
|
||||
@@ -32,7 +31,6 @@ class CheckLinearLayout extends LinearLayoutManager {
|
||||
super.onLayoutChildren(recycler, state);
|
||||
} catch (IndexOutOfBoundsException e) {
|
||||
e.printStackTrace();
|
||||
LogUtils.dTag("CheckLinearLayout", "崩溃信息--" + e.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ android {
|
||||
}
|
||||
protobuf {
|
||||
protoc {
|
||||
artifact = rootProject.ext.dependencies.google_protoc
|
||||
artifact = rootProject.ext.dependencies.protoc
|
||||
}
|
||||
generateProtoTasks {
|
||||
all().each { task ->
|
||||
@@ -76,10 +76,9 @@ dependencies {
|
||||
|
||||
implementation rootProject.ext.dependencies.androidx_datastore
|
||||
implementation rootProject.ext.dependencies.androidxroomruntime
|
||||
implementation rootProject.ext.dependencies.androidxroomktx
|
||||
kapt rootProject.ext.dependencies.androidxroomcompiler
|
||||
|
||||
implementation rootProject.ext.dependencies.google_proto_java
|
||||
implementation rootProject.ext.dependencies.androidxroomktx
|
||||
implementation rootProject.ext.dependencies.protobuf_java
|
||||
implementation rootProject.ext.dependencies.androidxappcompat
|
||||
implementation rootProject.ext.dependencies.androidxconstraintlayout
|
||||
implementation rootProject.ext.dependencies.androidxrecyclerview
|
||||
|
||||
@@ -4,13 +4,13 @@ import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.view.View
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.mogo.eagle.core.data.deva.chain.ChainLogParam
|
||||
import com.mogo.eagle.core.data.autopilot.AutoPilotRecordResult
|
||||
import com.mogo.eagle.core.data.chain.ChainLogParam
|
||||
import com.mogo.eagle.core.data.constants.MogoServicePaths
|
||||
import com.mogo.eagle.core.function.api.devatools.IDevaToolsProvider
|
||||
import com.zhjt.mogo_core_function_devatools.badcase.BadCaseManager
|
||||
import com.zhjt.mogo_core_function_devatools.logcatch.MogoLogCatchManager
|
||||
import com.zhjt.mogo_core_function_devatools.trace.TraceManager.Companion.traceManager
|
||||
import record_cache.RecordPanelOuterClass
|
||||
|
||||
@Route(path = MogoServicePaths.PATH_DEVA_TOOLS)
|
||||
class DevaToolsProvider : IDevaToolsProvider {
|
||||
@@ -52,7 +52,7 @@ class DevaToolsProvider : IDevaToolsProvider {
|
||||
BadCaseManager.init(view, onShow, onHide)
|
||||
}
|
||||
|
||||
override fun onReceiveBadCaseRecord(record: AutoPilotRecordResult) {
|
||||
override fun onReceiveBadCaseRecord(record: RecordPanelOuterClass.RecordPanel) {
|
||||
BadCaseManager.onReceiveBadCaseRecord(record)
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@ package com.zhjt.mogo_core_function_devatools.badcase
|
||||
|
||||
import android.transition.AutoTransition
|
||||
import android.transition.TransitionManager
|
||||
import android.util.Log
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.lifecycle.Lifecycle.Event
|
||||
@@ -12,18 +11,20 @@ import androidx.lifecycle.LifecycleEventObserver
|
||||
import androidx.lifecycle.LifecycleOwner
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
|
||||
import com.mogo.eagle.core.data.autopilot.AutoPilotRecordResult
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_DEVA
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.kotlin.lifecycleOwner
|
||||
import com.mogo.eagle.core.utilcode.kotlin.onClick
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||
import com.mogo.eagle.core.utilcode.util.Utils
|
||||
import com.zhjt.mogo_core_function_devatools.badcase.repository.net.api.entity.BadCaseResponse.Reason
|
||||
import com.zhjt.mogo_core_function_devatools.badcase.biz.BadCasePresenter
|
||||
import com.zhjt.mogo_core_function_devatools.badcase.biz.BadCaseView
|
||||
import com.zhjt.mogo_core_function_devatools.badcase.api.entity.BadCaseResponse.Reason
|
||||
import com.zhjt.mogo_core_function_devatools.badcase.mvp.BadCasePresenter
|
||||
import com.zhjt.mogo_core_function_devatools.badcase.mvp.BadCaseView
|
||||
import com.zhjt.mogo_core_function_devatools.badcase.repository.db.entity.AutoPilotRecord
|
||||
import kotlinx.coroutines.*
|
||||
import kotlinx.coroutines.channels.Channel
|
||||
import record_cache.RecordPanelOuterClass
|
||||
import java.lang.ref.WeakReference
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
@@ -35,9 +36,10 @@ internal object BadCaseManager : LifecycleEventObserver {
|
||||
* 超过此时间,case入口自动消失
|
||||
*/
|
||||
|
||||
private val CASE_EXPIRE_DURATION: Long = TimeUnit.HOURS.toMillis(4)/* TimeUnit.SECONDS.toMillis(10) */
|
||||
private val CASE_EXPIRE_DURATION: Long =
|
||||
TimeUnit.HOURS.toMillis(4)/* TimeUnit.SECONDS.toMillis(10) */
|
||||
|
||||
private var onShow: (() -> Unit)? = null
|
||||
private var onShow: (() -> Unit)? = null
|
||||
private var onHide: (() -> Unit)? = null
|
||||
|
||||
private var hideFloat: (() -> Unit)? = null
|
||||
@@ -46,7 +48,7 @@ internal object BadCaseManager : LifecycleEventObserver {
|
||||
private var record: AutoPilotRecord? = null
|
||||
|
||||
@Volatile
|
||||
private var viewHolder : WeakReference<View>? = null
|
||||
private var viewHolder: WeakReference<View>? = null
|
||||
|
||||
@Volatile
|
||||
private var dismissJob: Job? = null
|
||||
@@ -86,22 +88,22 @@ internal object BadCaseManager : LifecycleEventObserver {
|
||||
private fun register() {
|
||||
scope?.launch(Dispatchers.Default) {
|
||||
while (true) {
|
||||
Log.d(TAG, "---- 开始监听BadCase事件 ----")
|
||||
CallerLogger.d("$M_DEVA$TAG", "---- 开始监听BadCase事件 ----")
|
||||
val old = record
|
||||
if (old == null || old.consumed) {
|
||||
Log.d(TAG, "---- 当前事件已消费 -- value: $old")
|
||||
CallerLogger.d("$M_DEVA$TAG", "---- 当前事件已消费 -- value: $old")
|
||||
var receive = channel.receive()
|
||||
var oldT = record?.toLongTime() ?: 0L
|
||||
var newT = receive.toLongTime()
|
||||
if (isValid(oldT, newT)) {
|
||||
record = receive
|
||||
Log.d(TAG, "---- 时间有效,开始展示入口 ---")
|
||||
CallerLogger.d("$M_DEVA$TAG", "---- 时间有效,开始展示入口 ---")
|
||||
withContext(Dispatchers.Main) {
|
||||
showBadCaseInternal(receive)
|
||||
}
|
||||
continue
|
||||
}
|
||||
Log.d(TAG, "---- 时间无效,移除管道中无用数据 ---")
|
||||
CallerLogger.d("$M_DEVA$TAG", "---- 时间无效,移除管道中无用数据 ---")
|
||||
presenter.deleteRecord(receive)
|
||||
while (oldT != 0L && newT != 0L && (newT - oldT) >= CASE_EXPIRE_DURATION) {
|
||||
oldT = newT
|
||||
@@ -110,14 +112,17 @@ internal object BadCaseManager : LifecycleEventObserver {
|
||||
presenter.deleteRecord(receive)
|
||||
}
|
||||
receive.takeIf { it.key != old?.key }?.also {
|
||||
Log.d(TAG, "record: [$record] is displaying for rest ...")
|
||||
CallerLogger.d(
|
||||
"$M_DEVA$TAG",
|
||||
"record: [$record] is displaying for rest ..."
|
||||
)
|
||||
record = receive
|
||||
withContext(Dispatchers.Main) {
|
||||
showBadCaseInternal(it)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Log.d(TAG, "record: [$old] hasn't been consumed~~~~")
|
||||
CallerLogger.d("$M_DEVA$TAG", "record: [$old] hasn't been consumed~~~~")
|
||||
withContext(Dispatchers.Main) {
|
||||
showEntry()
|
||||
}
|
||||
@@ -133,26 +138,26 @@ internal object BadCaseManager : LifecycleEventObserver {
|
||||
val lastModified = presenter.getLastModified()
|
||||
val list = withContext(Dispatchers.IO) {
|
||||
try {
|
||||
Log.d(TAG, " --- 1 ----")
|
||||
Log.d(TAG, "恢复持久化的数据 - 最后修改时间:$lastModified")
|
||||
presenter.getUnConsumedRecords().fold(mutableListOf<AutoPilotRecord>()) {
|
||||
acc, record ->
|
||||
if (isValid(lastModified, record.toLongTime())) {
|
||||
acc.add(record)
|
||||
} else {
|
||||
presenter.deleteRecord(record)
|
||||
CallerLogger.d("$M_DEVA$TAG", " --- 1 ----")
|
||||
CallerLogger.d("$M_DEVA$TAG", "恢复持久化的数据 - 最后修改时间:$lastModified")
|
||||
presenter.getUnConsumedRecords()
|
||||
.fold(mutableListOf<AutoPilotRecord>()) { acc, record ->
|
||||
if (isValid(lastModified, record.toLongTime())) {
|
||||
acc.add(record)
|
||||
} else {
|
||||
presenter.deleteRecord(record)
|
||||
}
|
||||
acc
|
||||
}
|
||||
acc
|
||||
}
|
||||
} catch (t: Throwable) {
|
||||
emptyList()
|
||||
}
|
||||
}
|
||||
if (list.isEmpty()) {
|
||||
Log.d(TAG, "没有要恢复的数据")
|
||||
CallerLogger.d("$M_DEVA$TAG", "没有要恢复的数据")
|
||||
} else {
|
||||
list.forEach {
|
||||
Log.d(TAG, "恢复的接管数据:$it")
|
||||
CallerLogger.d("$M_DEVA$TAG", "恢复的接管数据:$it")
|
||||
channel.send(it)
|
||||
}
|
||||
}
|
||||
@@ -164,7 +169,7 @@ internal object BadCaseManager : LifecycleEventObserver {
|
||||
return oldT == 0L || newT == 0L || (newT - oldT >= 0 && (newT - oldT) < CASE_EXPIRE_DURATION)
|
||||
}
|
||||
|
||||
fun onReceiveBadCaseRecord(record: AutoPilotRecordResult) {
|
||||
fun onReceiveBadCaseRecord(record: RecordPanelOuterClass.RecordPanel) {
|
||||
scope?.launch {
|
||||
val newRecord = record.toRecord()
|
||||
withContext(Dispatchers.IO) {
|
||||
@@ -185,15 +190,16 @@ internal object BadCaseManager : LifecycleEventObserver {
|
||||
hideFloat = null
|
||||
},
|
||||
onSelect = { reason ->
|
||||
val uploadResult = presenter.upload(mutableMapOf<String, String>().also { itx ->
|
||||
itx["carLicense"] = MoGoAiCloudClientConfig.getInstance().sn
|
||||
itx["filename"] = record.fileName ?: ""
|
||||
itx["filesize"] = record.total.toString()
|
||||
itx["key"] = record.key ?: ""
|
||||
itx["reason"] = reason.reason ?: ""
|
||||
itx["duration"] = record.duration.toInt().toString()
|
||||
itx["timestamp"] = record.timestamp
|
||||
})
|
||||
val uploadResult =
|
||||
presenter.upload(mutableMapOf<String, String>().also { itx ->
|
||||
itx["carLicense"] = MoGoAiCloudClientConfig.getInstance().sn
|
||||
itx["filename"] = record.fileName ?: ""
|
||||
itx["filesize"] = record.total.toString()
|
||||
itx["key"] = record.key ?: ""
|
||||
itx["reason"] = reason.reason ?: ""
|
||||
itx["duration"] = record.duration.toInt().toString()
|
||||
itx["timestamp"] = record.timestamp
|
||||
})
|
||||
if (uploadResult == null || uploadResult.code != 200) {
|
||||
ToastUtils.showShort("接管反馈失败")
|
||||
} else {
|
||||
@@ -240,7 +246,10 @@ internal object BadCaseManager : LifecycleEventObserver {
|
||||
}
|
||||
}
|
||||
|
||||
private fun showBadCaseFloat(onDismiss: () -> Unit, onSelect:suspend (reason: Reason) -> Unit) {
|
||||
private fun showBadCaseFloat(
|
||||
onDismiss: () -> Unit,
|
||||
onSelect: suspend (reason: Reason) -> Unit
|
||||
) {
|
||||
val context = viewHolder?.get()?.context ?: Utils.getApp()
|
||||
BadCaseView(context).also {
|
||||
it.register(record, onDismiss, onSelect)
|
||||
@@ -258,7 +267,7 @@ internal object BadCaseManager : LifecycleEventObserver {
|
||||
}
|
||||
}
|
||||
|
||||
fun <T: View> T.toggle(show: Boolean) {
|
||||
fun <T : View> T.toggle(show: Boolean) {
|
||||
val group = (parent as? ViewGroup) ?: return
|
||||
val target = if (show) View.VISIBLE else View.GONE
|
||||
takeIf { it.visibility != target }?.also {
|
||||
@@ -267,15 +276,16 @@ fun <T: View> T.toggle(show: Boolean) {
|
||||
}
|
||||
}
|
||||
|
||||
internal fun AutoPilotRecordResult.toRecord(): AutoPilotRecord = AutoPilotRecord().also {
|
||||
it.id = this.id
|
||||
it.stat = this.stat
|
||||
it.key = this.key
|
||||
it.note = this.note
|
||||
it.type = this.type
|
||||
it.total = this.total
|
||||
it.fileName = this.fileName
|
||||
it.duration = this.duration
|
||||
it.diskFree = this.diskFree
|
||||
it.consumed = false
|
||||
}
|
||||
internal fun RecordPanelOuterClass.RecordPanel.toRecord(): AutoPilotRecord =
|
||||
AutoPilotRecord().also {
|
||||
it.id = this.id
|
||||
it.stat = this.stat
|
||||
it.key = this.key.toString()
|
||||
it.note = this.note
|
||||
it.type = this.type
|
||||
it.total = this.totalSize
|
||||
it.fileName = this.filename
|
||||
it.duration = this.duration.toDouble()
|
||||
it.diskFree = this.diskFree
|
||||
it.consumed = false
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.zhjt.mogo_core_function_devatools.badcase.api
|
||||
|
||||
import com.zhjt.mogo_core_function_devatools.badcase.api.entity.BadCaseResponse
|
||||
import com.zhjt.mogo_core_function_devatools.badcase.api.entity.UploadResult
|
||||
import retrofit2.Response
|
||||
import retrofit2.http.FieldMap
|
||||
import retrofit2.http.FormUrlEncoded
|
||||
import retrofit2.http.GET
|
||||
import retrofit2.http.POST
|
||||
|
||||
internal interface BadCaseApi {
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST("/yycp-vehicle-management-service/tool/badcase/add")
|
||||
suspend fun post(@FieldMap map: Map<String, String>): Response<UploadResult>
|
||||
|
||||
@GET("/yycp-vehicle-management-service/tool/badcase/reasons")
|
||||
suspend fun get(): Response<BadCaseResponse>
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.zhjt.mogo_core_function_devatools.badcase.api.entity
|
||||
|
||||
import androidx.annotation.Keep
|
||||
import com.google.gson.annotations.Expose
|
||||
|
||||
@Keep
|
||||
internal class BadCaseResponse {
|
||||
var code: Int = -1
|
||||
var data: List<Reason>? = null
|
||||
var msg: String? = null
|
||||
var success: Boolean = false
|
||||
var total: Int = -1
|
||||
|
||||
@Expose(serialize = false, deserialize = false)
|
||||
var isBuildIn: Boolean = false
|
||||
|
||||
@Keep
|
||||
class Reason {
|
||||
var id: String? = null
|
||||
var reason: String? = null
|
||||
|
||||
/**
|
||||
* 业务字段,不参与序列化和反序列化
|
||||
*/
|
||||
@Expose(deserialize = false, serialize = false)
|
||||
var isChecked: Boolean = false
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.zhjt.mogo_core_function_devatools.badcase.api.entity
|
||||
|
||||
import androidx.annotation.Keep
|
||||
|
||||
@Keep
|
||||
internal class UploadResult {
|
||||
var code: Int = -1
|
||||
var msg: String? = null
|
||||
var data: Array<String>? = null
|
||||
var success: Boolean = false
|
||||
|
||||
override fun toString(): String {
|
||||
return "UploadResult(code=$code, msg=$msg, data=${data?.contentToString()}, success=$success)"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.zhjt.mogo_core_function_devatools.badcase.mvp
|
||||
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_DEVA
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.zhjt.mogo_core_function_devatools.badcase.BadCaseManager
|
||||
import com.zhjt.mogo_core_function_devatools.badcase.api.entity.UploadResult
|
||||
import com.zhjt.mogo_core_function_devatools.badcase.mvp.biz.IBadCasePresenter
|
||||
import com.zhjt.mogo_core_function_devatools.badcase.repository.Repository
|
||||
import com.zhjt.mogo_core_function_devatools.badcase.repository.db.entity.AutoPilotRecord
|
||||
|
||||
internal class BadCasePresenter : IBadCasePresenter {
|
||||
|
||||
private val repository by lazy {
|
||||
Repository()
|
||||
}
|
||||
|
||||
override suspend fun loadBadCases() = repository.loadBadCases()
|
||||
|
||||
override suspend fun insertRecord(record: AutoPilotRecord) {
|
||||
try {
|
||||
repository.insert(record)
|
||||
} catch (t: Throwable) {
|
||||
CallerLogger.e("$M_DEVA${BadCaseManager.TAG}", "-- 插入数据失败 -- msg: $t")
|
||||
}
|
||||
}
|
||||
|
||||
override suspend fun getUnConsumedRecords(): List<AutoPilotRecord> {
|
||||
return try {
|
||||
repository.getAllUnConsumedRecord() ?: emptyList()
|
||||
} catch (t: Throwable) {
|
||||
CallerLogger.e("$M_DEVA${BadCaseManager.TAG}", "-- 获取所有未消费的数据失败 -- msg: $t")
|
||||
emptyList()
|
||||
}
|
||||
}
|
||||
|
||||
override suspend fun deleteRecord(record: AutoPilotRecord) {
|
||||
try {
|
||||
repository.deleteRecord(record)
|
||||
} catch (t: Throwable) {
|
||||
CallerLogger.e("$M_DEVA${BadCaseManager.TAG}", "-- 删除某条记录失败 -- msg: $t")
|
||||
}
|
||||
}
|
||||
|
||||
override suspend fun upload(map: Map<String, String>): UploadResult? = repository.upload(map)
|
||||
|
||||
override suspend fun updateLastModified(timestamp: Long) {
|
||||
repository.uploadLastModified(timestamp)
|
||||
}
|
||||
|
||||
override suspend fun getLastModified(): Long {
|
||||
CallerLogger.d("$M_DEVA${BadCaseManager.TAG}", " --- 2 ----")
|
||||
return repository.getLastModified()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,176 @@
|
||||
package com.zhjt.mogo_core_function_devatools.badcase.mvp
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.graphics.Color
|
||||
import android.graphics.drawable.ColorDrawable
|
||||
import android.graphics.drawable.GradientDrawable
|
||||
import android.graphics.drawable.StateListDrawable
|
||||
import android.util.AttributeSet
|
||||
import android.util.StateSet
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.ImageView
|
||||
import android.widget.TextView
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.mogo.eagle.core.data.autopilot.AutoPilotRecordResult
|
||||
import com.mogo.eagle.core.utilcode.kotlin.*
|
||||
import com.zhjt.mogo_core_function_devatools.R
|
||||
import com.zhjt.mogo_core_function_devatools.badcase.api.entity.BadCaseResponse.Reason
|
||||
import com.zhjt.mogo_core_function_devatools.badcase.repository.db.entity.AutoPilotRecord
|
||||
import kotlinx.android.synthetic.main.layout_badcase_collect.view.*
|
||||
import kotlinx.coroutines.launch
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.*
|
||||
|
||||
internal class BadCaseView: ConstraintLayout {
|
||||
|
||||
@Volatile
|
||||
private var selectCase: Reason? = null
|
||||
|
||||
@Volatile
|
||||
private var cases: List<Reason>? = null
|
||||
|
||||
private val presenter by lazy {
|
||||
BadCasePresenter()
|
||||
}
|
||||
|
||||
private var onDismiss: (() -> Unit)? = null
|
||||
private var onSelect:(suspend (reason: Reason) -> Unit)? = null
|
||||
|
||||
private val scope by lazy {
|
||||
lifecycleOwner.lifecycleScope
|
||||
}
|
||||
|
||||
private var record: AutoPilotRecord? = null
|
||||
|
||||
constructor(context: Context) : this(context, null)
|
||||
|
||||
constructor(context: Context, attrs: AttributeSet?) : this(context, attrs, 0)
|
||||
|
||||
@SuppressLint("SetTextI18n") constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super(context, attrs, defStyleAttr) {
|
||||
LayoutInflater.from(context).inflate(R.layout.layout_badcase_collect, this, true)
|
||||
background = ColorDrawable(Color.parseColor("#F0151D41"))
|
||||
isClickable = true
|
||||
layoutParams = ViewGroup.LayoutParams(960.toPixels().toInt(), 1528.toPixels().toInt())
|
||||
close?.onClick {
|
||||
onDismiss?.invoke()
|
||||
}
|
||||
cancel?.also {
|
||||
it.background = shape(solid = Color.parseColor("#3B4577"), radius = 16)
|
||||
it.onClick {
|
||||
onDismiss?.invoke()
|
||||
}
|
||||
}
|
||||
ok?.also {
|
||||
val enabled = gradient(radius = 16.toPixels().toInt(), orientation = GradientDrawable.Orientation.LEFT_RIGHT, centerX = 0.06f, startColor = Color.rgb(35, 146, 252), endColor = Color.rgb(28, 75, 252))
|
||||
val disabled = gradient(radius = 16.toPixels().toInt(), orientation = GradientDrawable.Orientation.LEFT_RIGHT, centerX = 0.06f, startColor = Color.rgb(24, 71, 129), endColor = Color.rgb(21, 46, 129))
|
||||
it.background = object : StateListDrawable() {}.also { itx ->
|
||||
itx.addState(intArrayOf(android.R.attr.state_enabled), enabled)
|
||||
itx.addState(StateSet.WILD_CARD, disabled)
|
||||
}
|
||||
it.onClick {
|
||||
selectCase?.run {
|
||||
scope.launch {
|
||||
onSelect?.invoke(this@run)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
scope.launchWhenCreated {
|
||||
time_of_take_over?.text = "接管时间:${SimpleDateFormat("yyyy.MM.dd HH:mm", Locale.getDefault()).format(record?.toLongTime() ?: System.currentTimeMillis())}"
|
||||
showLoading()
|
||||
presenter.loadBadCases().also {
|
||||
cases = it
|
||||
refresh(it)
|
||||
}
|
||||
hideLoading()
|
||||
}
|
||||
}
|
||||
|
||||
private fun refresh(causes: List<Reason>) {
|
||||
cases = causes
|
||||
rv_take_over?.let {
|
||||
it.layoutManager = LinearLayoutManager(it.context, LinearLayoutManager.VERTICAL, false)
|
||||
it.adapter = object : RecyclerView.Adapter<BadCaseViewHolder>() {
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): BadCaseViewHolder = BadCaseViewHolder(LayoutInflater.from(parent.context).inflate(R.layout.layout_badcase_item, parent, false))
|
||||
override fun onBindViewHolder(holder: BadCaseViewHolder, position: Int) {
|
||||
val cases = cases
|
||||
if (cases == null || cases.isEmpty()) {
|
||||
return
|
||||
}
|
||||
if (position >= cases.size) {
|
||||
return
|
||||
}
|
||||
val case = cases[position]
|
||||
holder.bindData(case)
|
||||
}
|
||||
override fun getItemCount(): Int = cases?.size ?: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun showLoading() {
|
||||
pb?.let {
|
||||
it.visibility = View.VISIBLE
|
||||
}
|
||||
}
|
||||
|
||||
private fun hideLoading() {
|
||||
pb?.let {
|
||||
it.visibility = View.INVISIBLE
|
||||
}
|
||||
}
|
||||
|
||||
private inner class BadCaseViewHolder(item: View) : RecyclerView.ViewHolder(item) {
|
||||
|
||||
private val check: ImageView = item.findViewById(R.id.check)
|
||||
private val reason: TextView = item.findViewById(R.id.reason)
|
||||
|
||||
init {
|
||||
check.background = StateListDrawable().also {
|
||||
it.addState(intArrayOf(android.R.attr.state_selected), ContextCompat.getDrawable(itemView.context, R.drawable.icon_ap_badcase_check))
|
||||
it.addState(StateSet.WILD_CARD, ContextCompat.getDrawable(itemView.context, R.drawable.icon_ap_badcase_default))
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("NotifyDataSetChanged")
|
||||
fun bindData(case: Reason) {
|
||||
check.isSelected = case.isChecked
|
||||
reason.text = case.reason ?: ""
|
||||
if (case.isChecked) {
|
||||
ok?.isSelected = true
|
||||
}
|
||||
itemView.onClick {
|
||||
case.isChecked = !case.isChecked
|
||||
selectCase = case
|
||||
cancelOtherChecked(case)
|
||||
ok?.isEnabled = hasCheckedItem()
|
||||
rv_take_over?.adapter?.notifyDataSetChanged()
|
||||
}
|
||||
}
|
||||
|
||||
private fun hasCheckedItem(): Boolean = cases?.find { it.isChecked } != null
|
||||
|
||||
private fun cancelOtherChecked(case: Reason) {
|
||||
val cases = cases
|
||||
if (cases == null || cases.isEmpty()) {
|
||||
return
|
||||
}
|
||||
cases.filterNot { it == case }.forEach {
|
||||
it.isChecked = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun register(record: AutoPilotRecord?, onDismiss: () -> Unit, onSelect:suspend (reason: Reason) -> Unit) {
|
||||
this.record = record
|
||||
this.onDismiss = onDismiss
|
||||
this.onSelect = onSelect
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.zhjt.mogo_core_function_devatools.badcase.mvp.biz
|
||||
|
||||
import com.zhjt.mogo_core_function_devatools.badcase.api.entity.BadCaseResponse.Reason
|
||||
import com.zhjt.mogo_core_function_devatools.badcase.api.entity.UploadResult
|
||||
import com.zhjt.mogo_core_function_devatools.badcase.repository.db.entity.AutoPilotRecord
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
|
||||
|
||||
internal interface IBadCasePresenter {
|
||||
|
||||
suspend fun loadBadCases(): List<Reason>
|
||||
|
||||
suspend fun updateLastModified(timestamp: Long)
|
||||
|
||||
suspend fun getLastModified(): Long
|
||||
|
||||
suspend fun upload(map: Map<String, String>): UploadResult?
|
||||
|
||||
suspend fun insertRecord(record: AutoPilotRecord)
|
||||
|
||||
suspend fun getUnConsumedRecords(): List<AutoPilotRecord>
|
||||
|
||||
suspend fun deleteRecord(record: AutoPilotRecord)
|
||||
}
|
||||
@@ -1,14 +1,16 @@
|
||||
package com.zhjt.mogo_core_function_devatools.badcase.repository
|
||||
|
||||
import android.util.Log
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_DEVA
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.zhjt.mogo_core_function_devatools.badcase.BadCaseManager
|
||||
import com.zhjt.mogo_core_function_devatools.badcase.repository.net.api.entity.BadCaseResponse.Reason
|
||||
import com.zhjt.mogo_core_function_devatools.badcase.repository.net.api.entity.UploadResult
|
||||
import com.zhjt.mogo_core_function_devatools.badcase.api.entity.BadCaseResponse.Reason
|
||||
import com.zhjt.mogo_core_function_devatools.badcase.api.entity.UploadResult
|
||||
import com.zhjt.mogo_core_function_devatools.badcase.repository.db.BadCaseDbModel
|
||||
import com.zhjt.mogo_core_function_devatools.badcase.repository.db.entity.AutoPilotRecord
|
||||
import com.zhjt.mogo_core_function_devatools.badcase.repository.net.BadCaseNetModel
|
||||
import com.zhjt.mogo_core_function_devatools.badcase.repository.store.BadCaseStore
|
||||
|
||||
|
||||
internal class Repository {
|
||||
|
||||
private val net by lazy {
|
||||
@@ -32,12 +34,12 @@ internal class Repository {
|
||||
}
|
||||
|
||||
suspend fun getLastModified(): Long {
|
||||
Log.d(BadCaseManager.TAG, " --- 3 ----")
|
||||
CallerLogger.d("$M_DEVA${BadCaseManager.TAG}", " --- 3 ----")
|
||||
return store.getLastModified()
|
||||
}
|
||||
|
||||
private fun getBuildIn(): List<Reason> {
|
||||
Log.d(BadCaseManager.TAG, "-- load cases from buildin -- 1 --")
|
||||
CallerLogger.d("$M_DEVA${BadCaseManager.TAG}", "-- load cases from buildin -- 1 --")
|
||||
val data = mutableListOf<Reason>()
|
||||
data += Reason().also {
|
||||
it.id = "1"
|
||||
|
||||
@@ -1,17 +1,18 @@
|
||||
package com.zhjt.mogo_core_function_devatools.badcase.repository.net
|
||||
|
||||
import android.util.Log
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_DEVA
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.network.MoGoRetrofitFactory
|
||||
import com.zhjt.mogo_core_function_devatools.badcase.BadCaseManager
|
||||
import com.zhjt.mogo_core_function_devatools.badcase.repository.net.api.BadCaseApi
|
||||
import com.zhjt.mogo_core_function_devatools.badcase.repository.net.api.entity.BadCaseResponse
|
||||
import com.zhjt.mogo_core_function_devatools.badcase.repository.net.api.entity.UploadResult
|
||||
import com.zhjt.mogo_core_function_devatools.badcase.api.BadCaseApi
|
||||
import com.zhjt.mogo_core_function_devatools.badcase.api.entity.BadCaseResponse
|
||||
import com.zhjt.mogo_core_function_devatools.badcase.api.entity.UploadResult
|
||||
import com.zhjt.mogo_core_function_devatools.badcase.consts.BadCaseHost
|
||||
|
||||
internal class BadCaseNetModel {
|
||||
|
||||
suspend fun get(): BadCaseResponse? = try {
|
||||
Log.d(BadCaseManager.TAG, "-- load cases from net -- 1 --")
|
||||
CallerLogger.d("$M_DEVA${BadCaseManager.TAG}", "-- load cases from net -- 1 --")
|
||||
MoGoRetrofitFactory
|
||||
.getInstance(BadCaseHost.getHost())
|
||||
.create(BadCaseApi::class.java)
|
||||
@@ -21,10 +22,10 @@ internal class BadCaseNetModel {
|
||||
it.isSuccessful && body != null && (body.code == 0 || body.code == 200)
|
||||
}
|
||||
?.body()?.also {
|
||||
Log.d(BadCaseManager.TAG, "-- load cases from net -- 2 --")
|
||||
CallerLogger.d("$M_DEVA${BadCaseManager.TAG}", "-- load cases from net -- 2 --")
|
||||
}
|
||||
} catch (t: Throwable) {
|
||||
Log.d(BadCaseManager.TAG, "-- load cases from net -- 3 --")
|
||||
CallerLogger.d("$M_DEVA${BadCaseManager.TAG}", "-- load cases from net -- 3 --")
|
||||
null
|
||||
}
|
||||
|
||||
|
||||
@@ -1,16 +1,20 @@
|
||||
package com.zhjt.mogo_core_function_devatools.badcase.repository.store
|
||||
|
||||
import android.util.Log
|
||||
import androidx.datastore.core.DataStore
|
||||
import androidx.datastore.core.DataStoreFactory
|
||||
import androidx.datastore.core.Serializer
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_DEVA
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.util.Utils
|
||||
import com.zhjt.mogo_core_function_devatools.badcase.BadCaseManager
|
||||
import com.zhjt.mogo_core_function_devatools.badcase.repository.net.api.entity.BadCaseResponse.Reason
|
||||
import com.zhjt.mogo_core_function_devatools.badcase.api.entity.BadCaseResponse.Reason
|
||||
import com.zhjt.mogo_core_function_devatools.badcase.generated.BadCauses
|
||||
import com.zhjt.mogo_core_function_devatools.badcase.generated.Cause
|
||||
import kotlinx.coroutines.*
|
||||
import kotlinx.coroutines.flow.*
|
||||
import kotlinx.coroutines.FlowPreview
|
||||
import kotlinx.coroutines.flow.catch
|
||||
import kotlinx.coroutines.flow.firstOrNull
|
||||
import kotlinx.coroutines.flow.map
|
||||
import kotlinx.coroutines.suspendCancellableCoroutine
|
||||
import java.io.File
|
||||
import java.io.IOException
|
||||
import java.io.InputStream
|
||||
@@ -24,7 +28,7 @@ internal object BadCaseStore {
|
||||
get() = BadCauses.getDefaultInstance()
|
||||
|
||||
override suspend fun readFrom(input: InputStream): BadCauses = suspendCancellableCoroutine {
|
||||
Log.d(BadCaseManager.TAG, "--- readFrom ---")
|
||||
CallerLogger.d("$M_DEVA${BadCaseManager.TAG}", "--- readFrom ---")
|
||||
it.invokeOnCancellation {
|
||||
Thread.currentThread().interrupt()
|
||||
}
|
||||
@@ -35,26 +39,32 @@ internal object BadCaseStore {
|
||||
}
|
||||
}
|
||||
|
||||
override suspend fun writeTo(t: BadCauses, output: OutputStream) = suspendCancellableCoroutine<Unit> {
|
||||
it.invokeOnCancellation {
|
||||
Thread.currentThread().interrupt()
|
||||
override suspend fun writeTo(t: BadCauses, output: OutputStream) =
|
||||
suspendCancellableCoroutine<Unit> {
|
||||
it.invokeOnCancellation {
|
||||
Thread.currentThread().interrupt()
|
||||
}
|
||||
try {
|
||||
t.writeTo(output)
|
||||
it.resumeWith(Result.success(Unit))
|
||||
} catch (t: Throwable) {
|
||||
it.resumeWith(Result.failure(t))
|
||||
}
|
||||
}
|
||||
try {
|
||||
t.writeTo(output)
|
||||
it.resumeWith(Result.success(Unit))
|
||||
} catch (t: Throwable) {
|
||||
it.resumeWith(Result.failure(t))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private val store: DataStore<BadCauses> by lazy {
|
||||
DataStoreFactory.create(serializer = serializer) { File(Utils.getApp().filesDir, "bad_cases.pb") }
|
||||
DataStoreFactory.create(serializer = serializer) {
|
||||
File(
|
||||
Utils.getApp().filesDir,
|
||||
"bad_cases.pb"
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun updateRecords(reasons: List<Reason>): BadCauses {
|
||||
Log.d(BadCaseManager.TAG, "--- updateRecords ---")
|
||||
CallerLogger.d("$M_DEVA${BadCaseManager.TAG}", "--- updateRecords ---")
|
||||
val data = mutableListOf<Cause>()
|
||||
reasons.forEach { itx ->
|
||||
data += Cause.newBuilder().let {
|
||||
@@ -69,14 +79,14 @@ internal object BadCaseStore {
|
||||
}
|
||||
|
||||
suspend fun updateLastModified(timestamp: Long): BadCauses {
|
||||
Log.d(BadCaseManager.TAG, "--- updateLastModified ---")
|
||||
CallerLogger.d("$M_DEVA${BadCaseManager.TAG}", "--- updateLastModified ---")
|
||||
return store.updateData { itx ->
|
||||
itx.toBuilder().setLastModified(timestamp).build()
|
||||
}
|
||||
itx.toBuilder().setLastModified(timestamp).build()
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun getLastModified(): Long {
|
||||
Log.d(BadCaseManager.TAG, " --- 4 ----")
|
||||
CallerLogger.d("$M_DEVA${BadCaseManager.TAG}", " --- 4 ----")
|
||||
return store
|
||||
.data
|
||||
.catch {
|
||||
@@ -92,7 +102,7 @@ internal object BadCaseStore {
|
||||
|
||||
@OptIn(FlowPreview::class)
|
||||
suspend fun records(): List<Reason> {
|
||||
Log.d(BadCaseManager.TAG, "-- load cases from pb -- 1 -- ")
|
||||
CallerLogger.d("$M_DEVA${BadCaseManager.TAG}", "-- load cases from pb -- 1 -- ")
|
||||
val causes = store.data.firstOrNull()
|
||||
return causes?.dataList?.map {
|
||||
Reason().also { itx ->
|
||||
|
||||
@@ -10,13 +10,14 @@ import com.mogo.commons.AbsMogoApplication
|
||||
import com.mogo.commons.debug.DebugConfig
|
||||
import com.mogo.eagle.core.data.app.AppConfigInfo
|
||||
import com.mogo.eagle.core.data.constants.MoGoConfig
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_DEVA
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager
|
||||
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsListenerManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.LogLevel
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
|
||||
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr
|
||||
import com.mogo.eagle.core.utilcode.mogo.toast.TipToast
|
||||
import com.mogo.eagle.core.utilcode.util.LogUtils
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils
|
||||
import com.mogo.module.common.MogoApisHandler
|
||||
import com.mogo.service.cloud.socket.IMogoOnMessageListener
|
||||
@@ -66,9 +67,9 @@ object MogoLogCatchManager : IMogoOnMessageListener<RemoteLogPushContent>, Handl
|
||||
}
|
||||
startCatchLog(logTime)
|
||||
} else {
|
||||
Logger.d(
|
||||
TAG,
|
||||
"logCheck logger : $logger , logCatchDuration : $logCatchDuration"
|
||||
CallerLogger.d(
|
||||
"$M_DEVA$TAG",
|
||||
"logCheck Logger : $logger , logCatchDuration : $logCatchDuration"
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -79,7 +80,7 @@ object MogoLogCatchManager : IMogoOnMessageListener<RemoteLogPushContent>, Handl
|
||||
|
||||
override fun onMsgReceived(obj: RemoteLogPushContent?) {
|
||||
obj?.let {
|
||||
Logger.d(TAG, "收到push消息: $obj")
|
||||
CallerLogger.d("$M_DEVA$TAG", "收到push消息: $obj")
|
||||
when (obj.type) {
|
||||
START_CATCH_LOG -> if (!catchingList.contains(obj.pkgName)) {
|
||||
startCatchLog(obj)
|
||||
@@ -106,7 +107,7 @@ object MogoLogCatchManager : IMogoOnMessageListener<RemoteLogPushContent>, Handl
|
||||
if (catchingList.contains(MANUAL_CATCH_PKG_NAME)) {
|
||||
TipToast.shortTip("已经在抓取日志了,请稍后再试")
|
||||
} else {
|
||||
Logger.d(TAG, "开始抓取日志==== duration : $duration")
|
||||
CallerLogger.d("$M_DEVA$TAG", "开始抓取日志==== duration : $duration")
|
||||
manualContent.type = START_CATCH_LOG
|
||||
manualContent.duration = duration
|
||||
startCatchLog(manualContent)
|
||||
@@ -114,7 +115,7 @@ object MogoLogCatchManager : IMogoOnMessageListener<RemoteLogPushContent>, Handl
|
||||
}
|
||||
|
||||
fun stopCatchLog() {
|
||||
Logger.d(TAG, "结束抓取日志====")
|
||||
CallerLogger.d("$M_DEVA$TAG", "结束抓取日志====")
|
||||
manualContent.type = STOP_CATCH_LOG
|
||||
stopCatchLog(manualContent)
|
||||
}
|
||||
@@ -166,22 +167,18 @@ object MogoLogCatchManager : IMogoOnMessageListener<RemoteLogPushContent>, Handl
|
||||
* 放开Logger的限制
|
||||
*/
|
||||
private fun openLoggerLevel() {
|
||||
LogUtils.getConfig().isLogSwitch = true
|
||||
Logger.init(LogLevel.DEBUG)
|
||||
MoGoAiCloudClient.getInstance().aiCloudClientConfig.isShowDebugLog = true
|
||||
CallerAutoPilotManager.setEnableLog(true)
|
||||
CallerAutoPilotManager.setIsWriteLog(true)
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据状态收紧Logger的限制
|
||||
*/
|
||||
private fun closeLoggerLevel() {
|
||||
LogUtils.getConfig().isLogSwitch = false
|
||||
Logger.init(if (DebugConfig.isDebug()) LogLevel.DEBUG else LogLevel.OFF)
|
||||
MoGoAiCloudClient.getInstance().aiCloudClientConfig.isShowDebugLog = false
|
||||
CallerAutoPilotManager.setEnableLog(false)
|
||||
CallerAutoPilotManager.setIsWriteLog(false)
|
||||
}
|
||||
|
||||
override fun onError(errorCount: Int) {
|
||||
|
||||
@@ -2,14 +2,14 @@ package com.zhjt.mogo_core_function_devatools.trace
|
||||
|
||||
import android.content.Context
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
|
||||
import com.mogo.eagle.core.data.deva.chain.ChainConstant
|
||||
import com.mogo.eagle.core.data.deva.chain.ChainLogParam
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
|
||||
import com.mogo.eagle.core.data.chain.ChainConstant
|
||||
import com.mogo.eagle.core.data.chain.ChainLogParam
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_DEVA
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.util.DeviceUtils
|
||||
import com.mogo.eagle.core.utilcode.util.Utils
|
||||
import com.zhidao.loglib.fw.FileWriteManager
|
||||
import com.zhidao.loglib.fw.FwBuild
|
||||
import com.zhjt.mogo_core_function_devatools.DevaToolsProvider.Companion.MODULE_NAME
|
||||
import com.zhjt.service.chain.core.ChainTraceStarter
|
||||
|
||||
class TraceManager {
|
||||
@@ -19,6 +19,8 @@ class TraceManager {
|
||||
|
||||
companion object {
|
||||
|
||||
const val TAG = "TraceManager"
|
||||
|
||||
val traceManager by lazy(LazyThreadSafetyMode.SYNCHRONIZED) {
|
||||
TraceManager()
|
||||
}
|
||||
@@ -51,7 +53,7 @@ class TraceManager {
|
||||
map.forEach { (type, param) ->
|
||||
val fwBuild = this.fwBuildMap[type]
|
||||
fwBuild?.let {
|
||||
Logger.d(MODULE_NAME, "param : ${param.des} , record : ${param.record}")
|
||||
CallerLogger.d("$M_DEVA$TAG", "param : ${param.des} , record : ${param.record}")
|
||||
it.isRecord = param.record
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,11 +8,9 @@ import android.widget.TextView;
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.mogo.eagle.core.data.dispatch.DispatchAdasAutoPilotLocReceiverBean;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
|
||||
public class DispatchAirportDialog extends DispatchBaseDialog {
|
||||
|
||||
private static final String TAG = "DispatchAirportDialog";
|
||||
private IDispatchRemindClickListener mListener;
|
||||
|
||||
private final TextView tvStartLoc;
|
||||
@@ -67,7 +65,6 @@ public class DispatchAirportDialog extends DispatchBaseDialog {
|
||||
@Override
|
||||
public void addIDispatchRemindListener(IDispatchRemindClickListener listener) {
|
||||
if (listener == null) {
|
||||
Logger.d(TAG, "addIDispatchRemindListener listener is null");
|
||||
return;
|
||||
}
|
||||
this.mListener = listener;
|
||||
|
||||
@@ -8,9 +8,7 @@ import android.os.Message;
|
||||
import com.mogo.cloud.commons.utils.CoordinateUtils;
|
||||
import com.mogo.eagle.core.data.autopilot.ADASTrajectoryInfo;
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters;
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotGuardianStatusInfo;
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotRouteInfo;
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotStationInfo;
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo;
|
||||
import com.mogo.eagle.core.data.dispatch.DispatchAdasAutoPilotLocReceiverBean;
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
@@ -22,7 +20,7 @@ import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotPlanningListenerManager;
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiListenerManager;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.map.navi.IMogoCarLocationChangedListener2;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.zhjt.dispatch.model.DispatchServiceModel;
|
||||
@@ -31,15 +29,18 @@ import com.mogo.service.cloud.socket.IMogoOnMessageListener;
|
||||
import com.zhjt.dispatch.model.IDispatch;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_DISPATCH;
|
||||
import static com.zhjt.dispatch.model.DispatchServiceModel.DISPATCH_RESULT_AFFIRM;
|
||||
import static com.zhjt.dispatch.model.DispatchServiceModel.DISPATCH_RESULT_MANUAL_CANCEL;
|
||||
import static com.zhjt.dispatch.model.DispatchServiceModel.DISPATCH_RESULT_TIMER_CANCEL;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
import mogo_msg.MogoReportMsg;
|
||||
|
||||
//负责监听自动驾驶状态并进行状态上报,自动驾驶路线上报,接收调度指令展示指令弹窗
|
||||
public class DispatchAutoPilotManager implements IMogoOnMessageListener<DispatchAdasAutoPilotLocReceiverBean>
|
||||
, IDispatchRemindClickListener, IMogoCarLocationChangedListener2,
|
||||
@@ -84,7 +85,6 @@ public class DispatchAutoPilotManager implements IMogoOnMessageListener<Dispatch
|
||||
super.handleMessage(msg);
|
||||
if (msg.what == MSG_TYPE_SHOW_DIALOG) {
|
||||
if (dispatchDialogManager.isShowing()) {
|
||||
Logger.d(TAG, "此时已经有调度,又收到调度信息");
|
||||
return;
|
||||
}
|
||||
isDispatch = true;
|
||||
@@ -172,7 +172,7 @@ public class DispatchAutoPilotManager implements IMogoOnMessageListener<Dispatch
|
||||
currentAutopilot.startLatLon = new AutopilotControlParameters.AutoPilotLonLat(receiverBean.getStartLat(), receiverBean.getStartLon());
|
||||
currentAutopilot.endLatLon = new AutopilotControlParameters.AutoPilotLonLat(receiverBean.getEndLat(), receiverBean.getEndLon());
|
||||
currentAutopilot.vehicleType = 10;
|
||||
Logger.d(TAG, "开启自动驾驶====" + currentAutopilot);
|
||||
CallerLogger.INSTANCE.d(M_DISPATCH + TAG, "开启自动驾驶====" + currentAutopilot);
|
||||
CallerAutoPilotManager.INSTANCE.startAutoPilot(currentAutopilot);
|
||||
}
|
||||
|
||||
@@ -230,7 +230,6 @@ public class DispatchAutoPilotManager implements IMogoOnMessageListener<Dispatch
|
||||
}
|
||||
|
||||
public void testEZhouStart() {
|
||||
Logger.d(TAG, "test to trigger mock testEZhouStart");
|
||||
DispatchAdasAutoPilotLocReceiverBean adasAutoPilotLocReceiverBean = new DispatchAdasAutoPilotLocReceiverBean(
|
||||
DispatchAdasAutoPilotLocReceiverBean.DISPATCH_SOURCE_EZHOU, DispatchAdasAutoPilotLocReceiverBean.DISPATCH_TYPE_START, "1",
|
||||
26.825571122, 112.5762410415, "起点---5号跑道",
|
||||
@@ -241,7 +240,6 @@ public class DispatchAutoPilotManager implements IMogoOnMessageListener<Dispatch
|
||||
}
|
||||
|
||||
public void testEZhouStop() {
|
||||
Logger.d(TAG, "test to trigger mock testEZhouStop");
|
||||
DispatchAdasAutoPilotLocReceiverBean adasAutoPilotLocReceiverBean = new DispatchAdasAutoPilotLocReceiverBean(
|
||||
DispatchAdasAutoPilotLocReceiverBean.DISPATCH_SOURCE_EZHOU, DispatchAdasAutoPilotLocReceiverBean.DISPATCH_TYPE_STOP, "1",
|
||||
0.0, 0.0, "",
|
||||
@@ -252,7 +250,6 @@ public class DispatchAutoPilotManager implements IMogoOnMessageListener<Dispatch
|
||||
}
|
||||
|
||||
public void testHengYangStart() {
|
||||
Logger.d(TAG, "test to trigger mock testHengYangStart");
|
||||
DispatchAdasAutoPilotLocReceiverBean adasAutoPilotLocReceiverBean = new DispatchAdasAutoPilotLocReceiverBean(
|
||||
DispatchAdasAutoPilotLocReceiverBean.DISPATCH_SOURCE_HENGYANG, DispatchAdasAutoPilotLocReceiverBean.DISPATCH_TYPE_START, "2",
|
||||
26.825571122, 112.5762410415, "衡阳科学城",
|
||||
@@ -282,11 +279,18 @@ public class DispatchAutoPilotManager implements IMogoOnMessageListener<Dispatch
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotRotting(AutopilotRouteInfo autopilotRoute) {
|
||||
if (autopilotRoute == null || autopilotRoute.getModels() == null || autopilotRoute.getModels().size() == 0) {
|
||||
public void onAutopilotRotting(MessagePad.GlobalPathResp globalPathResp) {
|
||||
if (globalPathResp == null || globalPathResp.getWayPointsList().size() == 0) {
|
||||
return;
|
||||
}
|
||||
DispatchServiceModel.getInstance().uploadAutopilotRoute(autopilotRoute.getModels());
|
||||
List<AutopilotRouteInfo.RouteModels> list = new ArrayList<>();
|
||||
for (MessagePad.Location location : globalPathResp.getWayPointsList()) {
|
||||
AutopilotRouteInfo.RouteModels routeModels = new AutopilotRouteInfo.RouteModels();
|
||||
routeModels.setLat(location.getLatitude());
|
||||
routeModels.setLon(location.getLongitude());
|
||||
list.add(routeModels);
|
||||
}
|
||||
DispatchServiceModel.getInstance().uploadAutopilotRoute(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -296,22 +300,25 @@ public class DispatchAutoPilotManager implements IMogoOnMessageListener<Dispatch
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotArriveAtStation(@Nullable AutopilotStationInfo autopilotWayArrive) {
|
||||
public void onAutopilotArriveAtStation(MessagePad.ArrivalNotification autopilotWayArrive) {
|
||||
if (!isDispatch) {
|
||||
return;
|
||||
}
|
||||
if (autopilotWayArrive == null) {
|
||||
return;
|
||||
}
|
||||
Logger.d(TAG, "onArriveAt data : " + autopilotWayArrive.toString());
|
||||
double endLat = autopilotWayArrive.getLat();
|
||||
double endLon = autopilotWayArrive.getLon();
|
||||
CallerLogger.INSTANCE.d(M_DISPATCH + TAG, "onArriveAt data : " + autopilotWayArrive.toString());
|
||||
if (autopilotWayArrive.getEndLocation() == null) {
|
||||
return;
|
||||
}
|
||||
double endLat = autopilotWayArrive.getEndLocation().getLatitude();
|
||||
double endLon = autopilotWayArrive.getEndLocation().getLongitude();
|
||||
// 计算是不是到了终点
|
||||
float distanceFromSelf = CoordinateUtils.calculateLineDistance(receiverBean.getEndLon(), receiverBean.getEndLat()
|
||||
, endLon, endLat);
|
||||
Logger.d(TAG, "onArriveAt cal distance : " + distanceFromSelf);
|
||||
CallerLogger.INSTANCE.d(M_DISPATCH + TAG, "onArriveAt cal distance : " + distanceFromSelf);
|
||||
if (distanceFromSelf < 10) {
|
||||
Logger.d(TAG, "onArriveAt end location");
|
||||
CallerLogger.INSTANCE.d(M_DISPATCH + TAG, "onArriveAt end location");
|
||||
isDispatch = false;
|
||||
isArriveEnd = true;
|
||||
}
|
||||
@@ -323,7 +330,8 @@ public class DispatchAutoPilotManager implements IMogoOnMessageListener<Dispatch
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotGuardian(@Nullable AutopilotGuardianStatusInfo guardianInfo) {
|
||||
public void onAutopilotGuardian(MogoReportMsg.MogoReportMessage guardianInfo) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -10,12 +10,10 @@ import android.widget.TextView;
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.mogo.eagle.core.data.dispatch.DispatchAdasAutoPilotLocReceiverBean;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
|
||||
|
||||
public class DispatchCarsDialog extends DispatchBaseDialog{
|
||||
public class DispatchCarsDialog extends DispatchBaseDialog {
|
||||
|
||||
private static final String TAG = "DispatchCarsDialog";
|
||||
private static final int MSG_TYPE_TIMER = 0;
|
||||
private static int TIMER = 10;
|
||||
private IDispatchRemindClickListener mListener;
|
||||
@@ -30,9 +28,8 @@ public class DispatchCarsDialog extends DispatchBaseDialog{
|
||||
if (msg.what == MSG_TYPE_TIMER) {
|
||||
if (TIMER > 0) {
|
||||
TIMER--;
|
||||
Logger.d(TAG,"timer : " + TIMER);
|
||||
tvTimer.setText(String.valueOf(TIMER));
|
||||
handler.sendEmptyMessageDelayed(MSG_TYPE_TIMER,1000L);
|
||||
handler.sendEmptyMessageDelayed(MSG_TYPE_TIMER, 1000L);
|
||||
} else {
|
||||
hideDialog();
|
||||
}
|
||||
@@ -70,7 +67,7 @@ public class DispatchCarsDialog extends DispatchBaseDialog{
|
||||
dismissDialog();
|
||||
}
|
||||
|
||||
private void dismissDialog(){
|
||||
private void dismissDialog() {
|
||||
handler.removeMessages(MSG_TYPE_TIMER);
|
||||
TIMER = 10;
|
||||
dismiss();
|
||||
@@ -79,7 +76,6 @@ public class DispatchCarsDialog extends DispatchBaseDialog{
|
||||
@Override
|
||||
public void addIDispatchRemindListener(IDispatchRemindClickListener listener) {
|
||||
if (listener == null) {
|
||||
Logger.d(TAG, "addIDispatchRemindListener listener is null");
|
||||
return;
|
||||
}
|
||||
this.mListener = listener;
|
||||
@@ -87,7 +83,7 @@ public class DispatchCarsDialog extends DispatchBaseDialog{
|
||||
|
||||
@Override
|
||||
public void showDialog(DispatchAdasAutoPilotLocReceiverBean dispatchContent) {
|
||||
if(TextUtils.isEmpty(dispatchContent.getEndLocAddress())){
|
||||
if (TextUtils.isEmpty(dispatchContent.getEndLocAddress())) {
|
||||
return;
|
||||
}
|
||||
show();
|
||||
|
||||
@@ -10,11 +10,9 @@ import android.content.Context;
|
||||
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
import com.mogo.eagle.core.data.dispatch.DispatchAdasAutoPilotLocReceiverBean;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
|
||||
public class DispatchDialogManager {
|
||||
|
||||
private static final String TAG = "DispatchDialogManager";
|
||||
private static volatile DispatchDialogManager manager;
|
||||
private static final byte[] obj = new byte[0];
|
||||
private final Context mContext;
|
||||
@@ -38,7 +36,6 @@ public class DispatchDialogManager {
|
||||
|
||||
public void addIDispatchRemindListener(IDispatchRemindClickListener listener) {
|
||||
if (listener == null) {
|
||||
Logger.d(TAG, "addIDispatchRemindListener listener is null");
|
||||
return;
|
||||
}
|
||||
this.mListener = listener;
|
||||
|
||||
@@ -4,8 +4,6 @@ import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
|
||||
public class DispatchTestPanelBroadCastReceiver extends BroadcastReceiver {
|
||||
|
||||
private static final String TAG = "DispatchTestPanelBroadCastReceiver";
|
||||
@@ -19,7 +17,6 @@ public class DispatchTestPanelBroadCastReceiver extends BroadcastReceiver {
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
try {
|
||||
int sceneType = intent.getIntExtra(BROADCAST_TEST_PANEL_CONTROL_TYPE_EXTRA_KEY, 0);
|
||||
Logger.d(TAG, "textPanelOpenType:" + sceneType);
|
||||
// 分发场景
|
||||
dispatchSceneTest(sceneType);
|
||||
} catch (Exception e) {
|
||||
@@ -33,7 +30,6 @@ public class DispatchTestPanelBroadCastReceiver extends BroadcastReceiver {
|
||||
* @param sceneType 场景类型
|
||||
*/
|
||||
private void dispatchSceneTest(int sceneType) {
|
||||
Logger.d(TAG, "sceneType=" + sceneType);
|
||||
if (sceneType == 0) {
|
||||
DispatchAutoPilotManager.getInstance().testEZhouStart();
|
||||
} else if (sceneType == 1) {
|
||||
|
||||
@@ -12,7 +12,6 @@ import com.mogo.eagle.core.data.dispatch.ReportedRoute;
|
||||
import com.mogo.eagle.core.network.RequestOptions;
|
||||
import com.mogo.eagle.core.network.SubscribeImpl;
|
||||
import com.mogo.eagle.core.network.utils.GsonUtil;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
|
||||
import java.util.HashMap;
|
||||
@@ -25,7 +24,6 @@ import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
public class DispatchServiceModel {
|
||||
|
||||
private static final String TAG = "DispatchServiceModel";
|
||||
private static volatile DispatchServiceModel instance;
|
||||
private static final byte[] obj = new byte[0];
|
||||
|
||||
@@ -73,13 +71,11 @@ public class DispatchServiceModel {
|
||||
@Override
|
||||
public void onNext(BaseData o) {
|
||||
super.onNext(o);
|
||||
//Logger.d(TAG, "uploadAutopilotStatus success");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
super.onError(e);
|
||||
Logger.d(TAG, "uploadAutopilotStatus error : " + e.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -107,13 +103,11 @@ public class DispatchServiceModel {
|
||||
@Override
|
||||
public void onNext(BaseData o) {
|
||||
super.onNext(o);
|
||||
Logger.d(TAG, "uploadAutopilotRoute success");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
super.onError(e);
|
||||
Logger.d(TAG, "uploadAutopilotRoute error : " + e.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -141,14 +135,12 @@ public class DispatchServiceModel {
|
||||
@Override
|
||||
public void onNext(BaseData o) {
|
||||
super.onNext(o);
|
||||
Logger.d(TAG, "dispatchResultUpload success");
|
||||
dispatch.onSuccess();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
super.onError(e);
|
||||
Logger.d(TAG, "dispatchResultUpload error : " + e.getMessage());
|
||||
dispatch.onError(e.getMessage());
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@ package com.mogo.eagle.core.function.hmi;
|
||||
* @date 2021/8/3 4:26 下午
|
||||
*/
|
||||
public class WaringConst {
|
||||
public static String MODULE_NAME = "MODULE_HMI_WARING";
|
||||
|
||||
// V2X 弹窗预警
|
||||
// 是否展示:true-展示,false-关闭
|
||||
|
||||
@@ -9,7 +9,9 @@ import androidx.lifecycle.ProcessLifecycleOwner
|
||||
import com.mogo.eagle.core.function.hmi.notification.enums.SidePattern
|
||||
import com.mogo.eagle.core.function.hmi.notification.interfaces.OnFloatAnimator
|
||||
import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWarningStatusListener
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_HMI
|
||||
import com.mogo.eagle.core.utilcode.reminder.Reminder
|
||||
import com.mogo.eagle.core.utilcode.reminder.api.impl.ViewReminder
|
||||
import com.mogo.eagle.core.utilcode.util.WindowUtils
|
||||
@@ -175,7 +177,7 @@ class WarningFloat {
|
||||
when {
|
||||
// 未设置浮窗布局文件/布局视图,不予创建
|
||||
config.layoutId == null && config.layoutView == null ->
|
||||
Logger.e(TAG, "需要传入 layoutId 或 layoutView ")
|
||||
CallerLogger.e("$M_HMI$TAG", "需要传入 layoutId 或 layoutView ")
|
||||
// 申请浮窗权限
|
||||
else -> {
|
||||
var content: View? = null
|
||||
|
||||
@@ -7,7 +7,6 @@ import android.app.Service
|
||||
import android.content.Context
|
||||
import android.graphics.PixelFormat
|
||||
import android.graphics.Rect
|
||||
import android.util.Log
|
||||
import android.view.Gravity
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
@@ -15,7 +14,8 @@ import android.view.WindowManager
|
||||
import com.mogo.eagle.core.function.hmi.notification.anim.AnimatorManager
|
||||
import com.mogo.eagle.core.function.hmi.notification.enums.ShowPattern
|
||||
import com.mogo.eagle.core.function.hmi.notification.widget.ParentFrameLayout
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_HMI
|
||||
import com.mogo.eagle.core.utilcode.util.WindowUtils
|
||||
|
||||
/**
|
||||
@@ -47,7 +47,7 @@ internal class WarningFloatWindowHelper(
|
||||
config.isShow = true
|
||||
true
|
||||
} else {
|
||||
Logger.e(TAG, "activity 必须是 Activity 的实现")
|
||||
CallerLogger.e("$M_HMI$TAG", "activity 必须是 Activity 的实现")
|
||||
false
|
||||
}
|
||||
}
|
||||
@@ -125,7 +125,6 @@ internal class WarningFloatWindowHelper(
|
||||
fun resetDownTime() {
|
||||
// 设置倒计时指定秒数后自动关闭Window
|
||||
if (config.countDownTime > 0) {
|
||||
Log.d(TAG, "重置弹窗时常")
|
||||
frameLayout?.removeCallbacks(closeWarningTask)
|
||||
frameLayout?.postDelayed(closeWarningTask, config.countDownTime)
|
||||
}
|
||||
@@ -217,7 +216,7 @@ internal class WarningFloatWindowHelper(
|
||||
// removeView是异步删除,在Activity销毁的时候会导致窗口泄漏,所以使用removeViewImmediate直接删除view
|
||||
windowManager.run { if (force) removeViewImmediate(frameLayout) else removeView(frameLayout) }
|
||||
} catch (e: Exception) {
|
||||
Logger.e(TAG, "浮窗关闭出现异常:$e")
|
||||
CallerLogger.e("$M_HMI$TAG", "浮窗关闭出现异常:$e")
|
||||
}
|
||||
|
||||
|
||||
@@ -259,7 +258,6 @@ internal class WarningFloatWindowHelper(
|
||||
// 上中
|
||||
Gravity.CENTER_HORIZONTAL, Gravity.TOP or Gravity.CENTER_HORIZONTAL -> {
|
||||
params.x = (parentRect.right - view.width).shr(1)
|
||||
Log.d(TAG, "layoutParams:${params.x},${params.y}")
|
||||
}
|
||||
// 下中
|
||||
Gravity.BOTTOM or Gravity.CENTER_HORIZONTAL -> {
|
||||
|
||||
@@ -3,8 +3,16 @@ package com.mogo.eagle.core.function.hmi.receiver
|
||||
import android.content.BroadcastReceiver
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import com.alibaba.android.arouter.launcher.ARouter
|
||||
import com.mogo.eagle.core.data.constants.MogoServicePaths
|
||||
import com.mogo.eagle.core.data.notice.NoticeNormalData
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager.showBrakeLight
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager.showTurnLight
|
||||
import com.mogo.eagle.core.function.hmi.WaringConst
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
|
||||
import com.mogo.eagle.core.utilcode.util.SharedPrefs
|
||||
import com.mogo.service.IMogoServiceApis
|
||||
|
||||
/**
|
||||
* 转向灯,刹车
|
||||
|
||||
@@ -3,9 +3,13 @@ package com.mogo.eagle.core.function.hmi.receiver
|
||||
import android.content.BroadcastReceiver
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import com.alibaba.android.arouter.launcher.ARouter
|
||||
import com.mogo.eagle.core.data.constants.MogoServicePaths
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
|
||||
import com.mogo.eagle.core.function.hmi.WaringConst
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_HMI
|
||||
import com.mogo.service.IMogoServiceApis
|
||||
|
||||
/**
|
||||
* V2X 预警广播接收。用于跨应用,跨进程,内部也可以通过这种方式 控制限速标志
|
||||
@@ -17,10 +21,13 @@ class V2XLimitingVelocityBroadcastReceiver : BroadcastReceiver() {
|
||||
|
||||
companion object {
|
||||
private const val TAG = "V2XLimitingVelocityBroadcastReceiver"
|
||||
private var mMogoServiceApis: IMogoServiceApis? = null
|
||||
}
|
||||
|
||||
override fun onReceive(context: Context, intent: Intent) {
|
||||
try {
|
||||
mMogoServiceApis = ARouter.getInstance().build(MogoServicePaths.PATH_SERVICE_APIS)
|
||||
.navigation(context) as IMogoServiceApis
|
||||
mContext = context
|
||||
|
||||
val limitingVelocityIsShow =
|
||||
@@ -34,8 +41,8 @@ class V2XLimitingVelocityBroadcastReceiver : BroadcastReceiver() {
|
||||
0
|
||||
)
|
||||
|
||||
Logger.d(
|
||||
TAG,
|
||||
CallerLogger.d(
|
||||
"$M_HMI$TAG",
|
||||
"limitingVelocityIsShow:$limitingVelocityIsShow limitingVelocitySpeed:$limitingVelocitySpeed"
|
||||
)
|
||||
if (limitingVelocityIsShow) {
|
||||
|
||||
@@ -3,9 +3,11 @@ package com.mogo.eagle.core.function.hmi.receiver
|
||||
import android.content.BroadcastReceiver
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import com.alibaba.android.arouter.launcher.ARouter
|
||||
import com.mogo.eagle.core.data.constants.MogoServicePaths
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
|
||||
import com.mogo.eagle.core.function.hmi.WaringConst
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
|
||||
import com.mogo.service.IMogoServiceApis
|
||||
|
||||
/**
|
||||
* V2X 预警广播接收。用于跨应用,跨进程,内部也可以通过这种方式 触发红绿灯场景
|
||||
@@ -17,10 +19,13 @@ class V2XTrafficLightBroadcastReceiver : BroadcastReceiver() {
|
||||
|
||||
companion object {
|
||||
private const val TAG = "V2XTrafficLightBroadcastReceiver"
|
||||
private var mMogoServiceApis: IMogoServiceApis? = null
|
||||
}
|
||||
|
||||
override fun onReceive(context: Context, intent: Intent) {
|
||||
try {
|
||||
mMogoServiceApis = ARouter.getInstance().build(MogoServicePaths.PATH_SERVICE_APIS)
|
||||
.navigation(context) as IMogoServiceApis
|
||||
mContext = context
|
||||
|
||||
val trafficLightIsShow =
|
||||
@@ -34,10 +39,6 @@ class V2XTrafficLightBroadcastReceiver : BroadcastReceiver() {
|
||||
0
|
||||
)
|
||||
|
||||
Logger.d(
|
||||
TAG,
|
||||
"trafficLightIsShow:$trafficLightIsShow trafficLightCheckType:$trafficLightCheckType"
|
||||
)
|
||||
if (trafficLightIsShow) {
|
||||
// 分发场景
|
||||
dispatchShowWaring(trafficLightCheckType)
|
||||
|
||||
@@ -5,7 +5,8 @@ import android.content.Context
|
||||
import android.content.Intent
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
|
||||
import com.mogo.eagle.core.function.hmi.WaringConst
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_HMI
|
||||
import com.mogo.module.common.enums.EventTypeEnum
|
||||
|
||||
/**
|
||||
@@ -33,8 +34,8 @@ class V2XWarningBroadcastReceiver : BroadcastReceiver() {
|
||||
intent.getStringExtra(WaringConst.BROADCAST_V2X_TTS_CONTENT_EXTRA_KEY)
|
||||
val tag =
|
||||
intent.getStringExtra(WaringConst.BROADCAST_V2X_TAG_EXTRA_KEY)
|
||||
Logger.d(
|
||||
TAG,
|
||||
CallerLogger.d(
|
||||
"$M_HMI$TAG",
|
||||
"v2xType:$v2xType alertContent:$alertContent ttsContent:$ttsContent tag:$tag"
|
||||
)
|
||||
if (v2xIsShow) {
|
||||
|
||||
@@ -3,7 +3,6 @@ package com.mogo.eagle.core.function.hmi.ui
|
||||
import android.animation.Animator
|
||||
import android.os.Bundle
|
||||
import android.text.TextUtils
|
||||
import android.util.Log
|
||||
import android.view.Gravity
|
||||
import android.view.View
|
||||
import android.view.WindowManager
|
||||
@@ -13,10 +12,10 @@ import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.mogo.commons.mvp.MvpFragment
|
||||
import com.mogo.commons.voice.AIAssist
|
||||
import com.mogo.eagle.core.data.autopilot.AdUpgradeStateHelper
|
||||
import com.mogo.eagle.core.data.autopilot.AutoPilotRecordResult
|
||||
import com.mogo.eagle.core.data.camera.CameraEntity
|
||||
import com.mogo.eagle.core.data.config.HmiBuildConfig
|
||||
import com.mogo.eagle.core.data.constants.MoGoFragmentPaths
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_HMI
|
||||
import com.mogo.eagle.core.data.enums.WarningDirectionEnum
|
||||
import com.mogo.eagle.core.data.notice.NoticeNormalData
|
||||
import com.mogo.eagle.core.data.notice.NoticeTrafficStylePushData
|
||||
@@ -27,6 +26,7 @@ import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWarningStatusListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotIdentifyListenerManager
|
||||
import com.mogo.eagle.core.function.call.check.CallerCheckManager
|
||||
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapDataCollectorManager
|
||||
import com.mogo.eagle.core.function.call.monitor.CallerMonitorManager
|
||||
import com.mogo.eagle.core.function.hmi.R
|
||||
@@ -40,13 +40,13 @@ import com.mogo.eagle.core.function.hmi.ui.notice.NoticeNormalBannerView
|
||||
import com.mogo.eagle.core.function.hmi.ui.setting.DebugSettingView
|
||||
import com.mogo.eagle.core.function.hmi.ui.tools.AutoPilotAndCheckView
|
||||
import com.mogo.eagle.core.function.hmi.ui.widget.V2XNotificationView
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||
import com.mogo.eagle.core.utilcode.util.Utils
|
||||
import com.mogo.module.common.enums.EventTypeEnum
|
||||
import kotlinx.android.synthetic.main.fragment_hmi.*
|
||||
import kotlinx.coroutines.*
|
||||
import record_cache.RecordPanelOuterClass
|
||||
import java.util.*
|
||||
|
||||
/**
|
||||
@@ -56,8 +56,8 @@ import java.util.*
|
||||
*/
|
||||
@Route(path = MoGoFragmentPaths.PATH_FRAGMENT_HMI)
|
||||
class MoGoHmiFragment : MvpFragment<MoGoWarningContract.View?, WaringPresenter?>(),
|
||||
IMoGoWaringProvider,
|
||||
MoGoWarningContract.View, IMoGoAutopilotIdentifyListener {
|
||||
IMoGoWaringProvider,
|
||||
MoGoWarningContract.View, IMoGoAutopilotIdentifyListener {
|
||||
private val TAG = "MoGoHmiFragment"
|
||||
|
||||
// DebugSettingView
|
||||
@@ -89,7 +89,6 @@ class MoGoHmiFragment : MvpFragment<MoGoWarningContract.View?, WaringPresenter?>
|
||||
|
||||
override fun vipIdentification(visible: Boolean) {
|
||||
ThreadUtils.runOnUiThread {
|
||||
Logger.d(TAG, "vipIdentification")
|
||||
if (visible) {
|
||||
flVipIdentificationView?.visibility = View.VISIBLE
|
||||
} else {
|
||||
@@ -137,13 +136,13 @@ class MoGoHmiFragment : MvpFragment<MoGoWarningContract.View?, WaringPresenter?>
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalCoroutinesApi::class)
|
||||
override fun onAutopilotRecordResult(record: AutoPilotRecordResult?) {
|
||||
override fun onAutopilotRecordResult(record: RecordPanelOuterClass.RecordPanel) {
|
||||
record ?: return
|
||||
if (HmiBuildConfig.isShowBadCaseView && record.type == 1 && record.stat == 100) {
|
||||
CallerDevaToolsManager.onReceiveBadCaseRecord(record)
|
||||
}
|
||||
if (record.type == 2 && (record.stat == 101 || record.stat == 100)) {
|
||||
CallerMapDataCollectorManager.finish(record.id, record.stat, "", record.fileName
|
||||
CallerMapDataCollectorManager.finish(record.id, record.stat, "", record.filename
|
||||
?: "", record.note ?: "")
|
||||
}
|
||||
}
|
||||
@@ -186,7 +185,6 @@ class MoGoHmiFragment : MvpFragment<MoGoWarningContract.View?, WaringPresenter?>
|
||||
}
|
||||
|
||||
private fun showToolsFloat() {
|
||||
Logger.d(TAG, "showToolsFloat")
|
||||
context?.let {
|
||||
if (toolsViewFloat == null) {
|
||||
if (toolsView == null) {
|
||||
@@ -208,41 +206,41 @@ class MoGoHmiFragment : MvpFragment<MoGoWarningContract.View?, WaringPresenter?>
|
||||
})
|
||||
}
|
||||
toolsViewFloat = WarningFloat.with(it)
|
||||
.setTag("ToolsViewFloat")
|
||||
.setLayout(toolsView!!)
|
||||
.setSidePattern(SidePattern.LEFT)
|
||||
.setGravity(Gravity.LEFT, offsetY = 72)
|
||||
.setImmersionStatusBar(true)
|
||||
.setWindowHeight(WindowManager.LayoutParams.MATCH_PARENT)
|
||||
.setAnimator(object : DefaultAnimator() {
|
||||
override fun enterAnim(
|
||||
view: View,
|
||||
params: WindowManager.LayoutParams,
|
||||
windowManager: WindowManager,
|
||||
sidePattern: SidePattern
|
||||
): Animator? =
|
||||
super.enterAnim(view, params, windowManager, sidePattern)
|
||||
?.apply {
|
||||
interpolator = OvershootInterpolator()
|
||||
}
|
||||
.setTag("ToolsViewFloat")
|
||||
.setLayout(toolsView!!)
|
||||
.setSidePattern(SidePattern.LEFT)
|
||||
.setGravity(Gravity.LEFT, offsetY = 72)
|
||||
.setImmersionStatusBar(true)
|
||||
.setWindowHeight(WindowManager.LayoutParams.MATCH_PARENT)
|
||||
.setAnimator(object : DefaultAnimator() {
|
||||
override fun enterAnim(
|
||||
view: View,
|
||||
params: WindowManager.LayoutParams,
|
||||
windowManager: WindowManager,
|
||||
sidePattern: SidePattern
|
||||
): Animator? =
|
||||
super.enterAnim(view, params, windowManager, sidePattern)
|
||||
?.apply {
|
||||
interpolator = OvershootInterpolator()
|
||||
}
|
||||
|
||||
override fun exitAnim(
|
||||
view: View,
|
||||
params: WindowManager.LayoutParams,
|
||||
windowManager: WindowManager,
|
||||
sidePattern: SidePattern
|
||||
): Animator? =
|
||||
super.exitAnim(view, params, windowManager, sidePattern)
|
||||
?.setDuration(200)
|
||||
})
|
||||
.addWarningStatusListener(object : IMoGoWarningStatusListener {
|
||||
override fun onDismiss() {
|
||||
toolsViewFloat = null
|
||||
toolsView = null
|
||||
// TODO:("")
|
||||
}
|
||||
})
|
||||
.show()
|
||||
override fun exitAnim(
|
||||
view: View,
|
||||
params: WindowManager.LayoutParams,
|
||||
windowManager: WindowManager,
|
||||
sidePattern: SidePattern
|
||||
): Animator? =
|
||||
super.exitAnim(view, params, windowManager, sidePattern)
|
||||
?.setDuration(200)
|
||||
})
|
||||
.addWarningStatusListener(object : IMoGoWarningStatusListener {
|
||||
override fun onDismiss() {
|
||||
toolsViewFloat = null
|
||||
toolsView = null
|
||||
// TODO:("")
|
||||
}
|
||||
})
|
||||
.show()
|
||||
} else {
|
||||
toolsViewFloat?.show()
|
||||
}
|
||||
@@ -336,7 +334,7 @@ class MoGoHmiFragment : MvpFragment<MoGoWarningContract.View?, WaringPresenter?>
|
||||
* 开关DebugView
|
||||
*/
|
||||
override fun toggleDebugView() {
|
||||
Log.d(TAG, "长按显示状态工具栏")
|
||||
CallerLogger.d("$M_HMI$TAG", "长按显示状态工具栏")
|
||||
context?.let {
|
||||
if (mDebugSettingViewFloat != null) {
|
||||
WarningFloat.dismiss(mDebugSettingViewFloat!!.config.floatTag, false)
|
||||
@@ -347,33 +345,33 @@ class MoGoHmiFragment : MvpFragment<MoGoWarningContract.View?, WaringPresenter?>
|
||||
mDebugSettingView = DebugSettingView(it)
|
||||
}
|
||||
mDebugSettingViewFloat = WarningFloat.with(it)
|
||||
.setTag("DebugSettingView")
|
||||
.setLayout(mDebugSettingView!!)
|
||||
.setSidePattern(SidePattern.RIGHT)
|
||||
.setGravity(Gravity.RIGHT, offsetY = 70)
|
||||
.setImmersionStatusBar(true)
|
||||
.setAnimator(object : DefaultAnimator() {
|
||||
override fun enterAnim(
|
||||
view: View,
|
||||
params: WindowManager.LayoutParams,
|
||||
windowManager: WindowManager,
|
||||
sidePattern: SidePattern
|
||||
): Animator? =
|
||||
super.enterAnim(view, params, windowManager, sidePattern)
|
||||
?.apply {
|
||||
interpolator = OvershootInterpolator()
|
||||
}
|
||||
.setTag("DebugSettingView")
|
||||
.setLayout(mDebugSettingView!!)
|
||||
.setSidePattern(SidePattern.RIGHT)
|
||||
.setGravity(Gravity.RIGHT, offsetY = 70)
|
||||
.setImmersionStatusBar(true)
|
||||
.setAnimator(object : DefaultAnimator() {
|
||||
override fun enterAnim(
|
||||
view: View,
|
||||
params: WindowManager.LayoutParams,
|
||||
windowManager: WindowManager,
|
||||
sidePattern: SidePattern
|
||||
): Animator? =
|
||||
super.enterAnim(view, params, windowManager, sidePattern)
|
||||
?.apply {
|
||||
interpolator = OvershootInterpolator()
|
||||
}
|
||||
|
||||
override fun exitAnim(
|
||||
view: View,
|
||||
params: WindowManager.LayoutParams,
|
||||
windowManager: WindowManager,
|
||||
sidePattern: SidePattern
|
||||
): Animator? =
|
||||
super.exitAnim(view, params, windowManager, sidePattern)
|
||||
?.setDuration(200)
|
||||
})
|
||||
.show()
|
||||
override fun exitAnim(
|
||||
view: View,
|
||||
params: WindowManager.LayoutParams,
|
||||
windowManager: WindowManager,
|
||||
sidePattern: SidePattern
|
||||
): Animator? =
|
||||
super.exitAnim(view, params, windowManager, sidePattern)
|
||||
?.setDuration(200)
|
||||
})
|
||||
.show()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -387,7 +385,15 @@ class MoGoHmiFragment : MvpFragment<MoGoWarningContract.View?, WaringPresenter?>
|
||||
* @param tag tag绑定弹窗的标志
|
||||
*/
|
||||
@Synchronized
|
||||
override fun showWarningV2X(v2xType: Int, alertContent: CharSequence?, ttsContent: String?, tag: String?, listenerIMoGo: IMoGoWarningStatusListener?, playTts: Boolean, expireTime: Long) {
|
||||
override fun showWarningV2X(
|
||||
v2xType: Int,
|
||||
alertContent: CharSequence?,
|
||||
ttsContent: String?,
|
||||
tag: String?,
|
||||
listenerIMoGo: IMoGoWarningStatusListener?,
|
||||
playTts: Boolean,
|
||||
expireTime: Long
|
||||
) {
|
||||
lifecycleScope.launchWhenResumed {
|
||||
activity?.let {
|
||||
val floatWindow = mWarningFloat
|
||||
@@ -396,9 +402,9 @@ class MoGoHmiFragment : MvpFragment<MoGoWarningContract.View?, WaringPresenter?>
|
||||
val notificationView = V2XNotificationView(it)
|
||||
notificationView.setWarningIcon(EventTypeEnum.getWarningIcon(v2xType.toString()))
|
||||
val warningContent = alertContent
|
||||
?: EventTypeEnum.getWarningContent(v2xType.toString())
|
||||
?: EventTypeEnum.getWarningContent(v2xType.toString())
|
||||
if (warningContent.isEmpty()) {
|
||||
Logger.e(TAG, "Show warningContent is null or empty!")
|
||||
CallerLogger.e("$M_HMI$TAG", "Show warningContent is null or empty!")
|
||||
return@launchWhenResumed
|
||||
} else {
|
||||
notificationView.setWarningContent(warningContent)
|
||||
@@ -407,48 +413,49 @@ class MoGoHmiFragment : MvpFragment<MoGoWarningContract.View?, WaringPresenter?>
|
||||
WarningFloat.dismiss(floatWindow.config.floatTag, true)
|
||||
}
|
||||
mWarningFloat = WarningFloat.with(it)
|
||||
.setTag(tag)
|
||||
.setLayout(notificationView)
|
||||
.setSidePattern(SidePattern.RESULT_TOP)
|
||||
.setCountDownTime(expireTime)
|
||||
.setGravity(Gravity.CENTER_HORIZONTAL, offsetY = 110)
|
||||
.setImmersionStatusBar(true)
|
||||
.isEnqueue(true)
|
||||
.addWarningStatusListener(listenerIMoGo)
|
||||
.addWarningStatusListener(object : IMoGoWarningStatusListener {
|
||||
override fun onShow() {
|
||||
// 创建弹窗成功才进行TTS播报
|
||||
Logger.d(
|
||||
"MoGoWarningFragment",
|
||||
"mWarningFloat = $mWarningFloat---ttsContent = $ttsContent"
|
||||
)
|
||||
if (mWarningFloat != null && !TextUtils.isEmpty(ttsContent) && playTts) {
|
||||
Logger.d("MoGoWarningFragment", "---> ttsContent = $ttsContent")
|
||||
AIAssist.getInstance(activity)
|
||||
.speakTTSVoice(ttsContent)
|
||||
}
|
||||
.setTag(tag)
|
||||
.setLayout(notificationView)
|
||||
.setSidePattern(SidePattern.RESULT_TOP)
|
||||
.setCountDownTime(expireTime)
|
||||
.setGravity(Gravity.CENTER_HORIZONTAL, offsetY = 110)
|
||||
.setImmersionStatusBar(true)
|
||||
.isEnqueue(true)
|
||||
.addWarningStatusListener(listenerIMoGo)
|
||||
.addWarningStatusListener(object : IMoGoWarningStatusListener {
|
||||
override fun onShow() {
|
||||
// 创建弹窗成功才进行TTS播报
|
||||
CallerLogger.d(
|
||||
"$M_HMI$TAG",
|
||||
"mWarningFloat = $mWarningFloat---ttsContent = $ttsContent"
|
||||
)
|
||||
if (mWarningFloat != null && !TextUtils.isEmpty(ttsContent) && playTts) {
|
||||
CallerLogger.d("$M_HMI$TAG", "---> ttsContent = $ttsContent")
|
||||
AIAssist.getInstance(activity)
|
||||
.speakTTSVoice(ttsContent)
|
||||
}
|
||||
}
|
||||
})
|
||||
.setAnimator(object : DefaultAnimator() {
|
||||
override fun enterAnim(
|
||||
view: View,
|
||||
params: WindowManager.LayoutParams,
|
||||
windowManager: WindowManager,
|
||||
sidePattern: SidePattern
|
||||
): Animator? =
|
||||
super.enterAnim(view, params, windowManager, sidePattern)?.apply {
|
||||
interpolator = OvershootInterpolator()
|
||||
}
|
||||
})
|
||||
.setAnimator(object : DefaultAnimator() {
|
||||
override fun enterAnim(
|
||||
view: View,
|
||||
params: WindowManager.LayoutParams,
|
||||
windowManager: WindowManager,
|
||||
sidePattern: SidePattern
|
||||
): Animator? =
|
||||
super.enterAnim(view, params, windowManager, sidePattern)?.apply {
|
||||
interpolator = OvershootInterpolator()
|
||||
}
|
||||
|
||||
override fun exitAnim(
|
||||
view: View,
|
||||
params: WindowManager.LayoutParams,
|
||||
windowManager: WindowManager,
|
||||
sidePattern: SidePattern
|
||||
): Animator? =
|
||||
super.exitAnim(view, params, windowManager, sidePattern)?.setDuration(200)
|
||||
})
|
||||
.show()
|
||||
override fun exitAnim(
|
||||
view: View,
|
||||
params: WindowManager.LayoutParams,
|
||||
windowManager: WindowManager,
|
||||
sidePattern: SidePattern
|
||||
): Animator? =
|
||||
super.exitAnim(view, params, windowManager, sidePattern)
|
||||
?.setDuration(200)
|
||||
})
|
||||
.show()
|
||||
} else {
|
||||
val notification = floatWindow.config.layoutView as? V2XNotificationView
|
||||
if (alertContent?.isNotEmpty() == true) {
|
||||
@@ -567,42 +574,42 @@ class MoGoHmiFragment : MvpFragment<MoGoWarningContract.View?, WaringPresenter?>
|
||||
mNoticeFloat = it?.let { it1 ->
|
||||
noticeBannerView?.let { it2 ->
|
||||
WarningFloat.with(it1)
|
||||
.setTag(WaringConst.NOTICE_FOR_TRAFFIC_KEY)
|
||||
.setLayout(it2)
|
||||
.setSidePattern(SidePattern.TOP)
|
||||
.setCountDownTime(60 * 1000 * 3)
|
||||
.setGravity(Gravity.CENTER_HORIZONTAL, offsetY = 110)
|
||||
.setImmersionStatusBar(true)
|
||||
.addWarningStatusListener(object : IMoGoWarningStatusListener {
|
||||
override fun onShow() {
|
||||
// 创建弹窗成功才进行TTS播报
|
||||
.setTag(WaringConst.NOTICE_FOR_TRAFFIC_KEY)
|
||||
.setLayout(it2)
|
||||
.setSidePattern(SidePattern.TOP)
|
||||
.setCountDownTime(60 * 1000 * 3)
|
||||
.setGravity(Gravity.CENTER_HORIZONTAL, offsetY = 110)
|
||||
.setImmersionStatusBar(true)
|
||||
.addWarningStatusListener(object : IMoGoWarningStatusListener {
|
||||
override fun onShow() {
|
||||
// 创建弹窗成功才进行TTS播报
|
||||
// AIAssist.getInstance(activity)
|
||||
// .speakTTSVoice("")
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
.setAnimator(object : DefaultAnimator() {
|
||||
override fun enterAnim(
|
||||
view: View,
|
||||
params: WindowManager.LayoutParams,
|
||||
windowManager: WindowManager,
|
||||
sidePattern: SidePattern
|
||||
): Animator? =
|
||||
super.enterAnim(view, params, windowManager, sidePattern)
|
||||
?.apply {
|
||||
interpolator = OvershootInterpolator()
|
||||
}
|
||||
})
|
||||
.setAnimator(object : DefaultAnimator() {
|
||||
override fun enterAnim(
|
||||
view: View,
|
||||
params: WindowManager.LayoutParams,
|
||||
windowManager: WindowManager,
|
||||
sidePattern: SidePattern
|
||||
): Animator? =
|
||||
super.enterAnim(view, params, windowManager, sidePattern)
|
||||
?.apply {
|
||||
interpolator = OvershootInterpolator()
|
||||
}
|
||||
|
||||
override fun exitAnim(
|
||||
view: View,
|
||||
params: WindowManager.LayoutParams,
|
||||
windowManager: WindowManager,
|
||||
sidePattern: SidePattern
|
||||
): Animator? =
|
||||
super.exitAnim(view, params, windowManager, sidePattern)
|
||||
?.setDuration(200)
|
||||
})
|
||||
.show()
|
||||
override fun exitAnim(
|
||||
view: View,
|
||||
params: WindowManager.LayoutParams,
|
||||
windowManager: WindowManager,
|
||||
sidePattern: SidePattern
|
||||
): Animator? =
|
||||
super.exitAnim(view, params, windowManager, sidePattern)
|
||||
?.setDuration(200)
|
||||
})
|
||||
.show()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -617,41 +624,41 @@ class MoGoHmiFragment : MvpFragment<MoGoWarningContract.View?, WaringPresenter?>
|
||||
mNoticeFloat = it.let { it1 ->
|
||||
noticeBannerView?.let { it2 ->
|
||||
WarningFloat.with(it1)
|
||||
.setTag(WaringConst.NOTICE_FOR_NORMAL_KEY)
|
||||
.setLayout(it2)
|
||||
.setSidePattern(SidePattern.TOP)
|
||||
.setCountDownTime(10000)
|
||||
.setGravity(Gravity.CENTER_HORIZONTAL, offsetY = 110)
|
||||
.setImmersionStatusBar(true)
|
||||
.addWarningStatusListener(object : IMoGoWarningStatusListener {
|
||||
override fun onShow() {
|
||||
// 创建弹窗成功才进行TTS播报
|
||||
// AIAssist.getInstance(activity)
|
||||
// .speakTTSVoice("")
|
||||
}
|
||||
})
|
||||
.setAnimator(object : DefaultAnimator() {
|
||||
override fun enterAnim(
|
||||
view: View,
|
||||
params: WindowManager.LayoutParams,
|
||||
windowManager: WindowManager,
|
||||
sidePattern: SidePattern
|
||||
): Animator? =
|
||||
super.enterAnim(view, params, windowManager, sidePattern)
|
||||
?.apply {
|
||||
interpolator = OvershootInterpolator()
|
||||
}
|
||||
.setTag(WaringConst.NOTICE_FOR_NORMAL_KEY)
|
||||
.setLayout(it2)
|
||||
.setSidePattern(SidePattern.TOP)
|
||||
.setCountDownTime(10000)
|
||||
.setGravity(Gravity.CENTER_HORIZONTAL, offsetY = 110)
|
||||
.setImmersionStatusBar(true)
|
||||
.addWarningStatusListener(object : IMoGoWarningStatusListener {
|
||||
override fun onShow() {
|
||||
// 创建弹窗成功才进行TTS播报
|
||||
// AIAssist.getInstance(activity)
|
||||
// .speakTTSVoice("")
|
||||
}
|
||||
})
|
||||
.setAnimator(object : DefaultAnimator() {
|
||||
override fun enterAnim(
|
||||
view: View,
|
||||
params: WindowManager.LayoutParams,
|
||||
windowManager: WindowManager,
|
||||
sidePattern: SidePattern
|
||||
): Animator? =
|
||||
super.enterAnim(view, params, windowManager, sidePattern)
|
||||
?.apply {
|
||||
interpolator = OvershootInterpolator()
|
||||
}
|
||||
|
||||
override fun exitAnim(
|
||||
view: View,
|
||||
params: WindowManager.LayoutParams,
|
||||
windowManager: WindowManager,
|
||||
sidePattern: SidePattern
|
||||
): Animator? =
|
||||
super.exitAnim(view, params, windowManager, sidePattern)
|
||||
?.setDuration(200)
|
||||
})
|
||||
.show()
|
||||
override fun exitAnim(
|
||||
view: View,
|
||||
params: WindowManager.LayoutParams,
|
||||
windowManager: WindowManager,
|
||||
sidePattern: SidePattern
|
||||
): Animator? =
|
||||
super.exitAnim(view, params, windowManager, sidePattern)
|
||||
?.setDuration(200)
|
||||
})
|
||||
.show()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -706,40 +713,40 @@ class MoGoHmiFragment : MvpFragment<MoGoWarningContract.View?, WaringPresenter?>
|
||||
}
|
||||
})
|
||||
cameraViewFloat = WarningFloat.with(it)
|
||||
.setTag("CameraListFloat")
|
||||
.setLayout(cameraListView!!)
|
||||
.setSidePattern(SidePattern.RIGHT)
|
||||
.setGravity(Gravity.RIGHT, -40, 280)
|
||||
.setImmersionStatusBar(true)
|
||||
.setAnimator(object : DefaultAnimator() {
|
||||
override fun enterAnim(
|
||||
view: View,
|
||||
params: WindowManager.LayoutParams,
|
||||
windowManager: WindowManager,
|
||||
sidePattern: SidePattern
|
||||
): Animator? =
|
||||
super.enterAnim(view, params, windowManager, sidePattern)
|
||||
?.apply {
|
||||
interpolator = OvershootInterpolator()
|
||||
}
|
||||
.setTag("CameraListFloat")
|
||||
.setLayout(cameraListView!!)
|
||||
.setSidePattern(SidePattern.RIGHT)
|
||||
.setGravity(Gravity.RIGHT, -40, 280)
|
||||
.setImmersionStatusBar(true)
|
||||
.setAnimator(object : DefaultAnimator() {
|
||||
override fun enterAnim(
|
||||
view: View,
|
||||
params: WindowManager.LayoutParams,
|
||||
windowManager: WindowManager,
|
||||
sidePattern: SidePattern
|
||||
): Animator? =
|
||||
super.enterAnim(view, params, windowManager, sidePattern)
|
||||
?.apply {
|
||||
interpolator = OvershootInterpolator()
|
||||
}
|
||||
|
||||
override fun exitAnim(
|
||||
view: View,
|
||||
params: WindowManager.LayoutParams,
|
||||
windowManager: WindowManager,
|
||||
sidePattern: SidePattern
|
||||
): Animator? =
|
||||
super.exitAnim(view, params, windowManager, sidePattern)
|
||||
?.setDuration(200)
|
||||
})
|
||||
.addWarningStatusListener(object : IMoGoWarningStatusListener {
|
||||
override fun onDismiss() {
|
||||
cameraViewFloat = null
|
||||
cameraListView = null
|
||||
ivCameraIcon.setBackgroundResource(R.drawable.icon_camera_nor)
|
||||
}
|
||||
})
|
||||
.show()
|
||||
override fun exitAnim(
|
||||
view: View,
|
||||
params: WindowManager.LayoutParams,
|
||||
windowManager: WindowManager,
|
||||
sidePattern: SidePattern
|
||||
): Animator? =
|
||||
super.exitAnim(view, params, windowManager, sidePattern)
|
||||
?.setDuration(200)
|
||||
})
|
||||
.addWarningStatusListener(object : IMoGoWarningStatusListener {
|
||||
override fun onDismiss() {
|
||||
cameraViewFloat = null
|
||||
cameraListView = null
|
||||
ivCameraIcon.setBackgroundResource(R.drawable.icon_camera_nor)
|
||||
}
|
||||
})
|
||||
.show()
|
||||
} else {
|
||||
cameraViewFloat?.show()
|
||||
}
|
||||
@@ -767,7 +774,6 @@ class MoGoHmiFragment : MvpFragment<MoGoWarningContract.View?, WaringPresenter?>
|
||||
*/
|
||||
override fun showTurnLight(light: Int) {
|
||||
if (HmiBuildConfig.isShowTurnLightView) {
|
||||
//Log.d("liyz", "showTurnLight light = $light")
|
||||
turnLightView.setTurnLight(light)
|
||||
}
|
||||
}
|
||||
@@ -777,7 +783,6 @@ class MoGoHmiFragment : MvpFragment<MoGoWarningContract.View?, WaringPresenter?>
|
||||
*/
|
||||
override fun showBrakeLight(light: Int) {
|
||||
if (HmiBuildConfig.isShowBrakeLightView) {
|
||||
// Log.d("liyz", "showBrakeLight light = $light")
|
||||
brakeView.setBrakeLight(light)
|
||||
}
|
||||
}
|
||||
@@ -800,12 +805,12 @@ class MoGoHmiFragment : MvpFragment<MoGoWarningContract.View?, WaringPresenter?>
|
||||
* @param upgradeStatus 升级状态
|
||||
*/
|
||||
override fun showAdUpgradeStatus(
|
||||
upgradeMode: Int,
|
||||
downloadStatus: Int,
|
||||
currentProgress: Int,
|
||||
totalProgress: Int,
|
||||
downloadVersion: String,
|
||||
upgradeStatus: Int
|
||||
upgradeMode: Int,
|
||||
downloadStatus: Int,
|
||||
currentProgress: Int,
|
||||
totalProgress: Int,
|
||||
downloadVersion: String,
|
||||
upgradeStatus: Int
|
||||
) {
|
||||
ThreadUtils.runOnUiThread {
|
||||
val tipsView = upgradeTipsView?.invoke()
|
||||
@@ -825,7 +830,14 @@ class MoGoHmiFragment : MvpFragment<MoGoWarningContract.View?, WaringPresenter?>
|
||||
}
|
||||
}
|
||||
//将状态同步到工具箱
|
||||
toolsView?.showAdUpgradeStatus(upgradeMode, downloadStatus, currentProgress, totalProgress, downloadVersion, upgradeStatus)
|
||||
toolsView?.showAdUpgradeStatus(
|
||||
upgradeMode,
|
||||
downloadStatus,
|
||||
currentProgress,
|
||||
totalProgress,
|
||||
downloadVersion,
|
||||
upgradeStatus
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -877,7 +889,7 @@ class MoGoHmiFragment : MvpFragment<MoGoWarningContract.View?, WaringPresenter?>
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
Log.d(TAG, "onDestroy")
|
||||
CallerLogger.d("$M_HMI$TAG", "onDestroy")
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -23,7 +23,8 @@ import com.mogo.cloud.trafficlive.api.MoGoAiCloudTrafficLive
|
||||
import com.mogo.eagle.core.data.camera.CameraEntity
|
||||
import com.mogo.eagle.core.function.call.monitor.CallerMonitorManager
|
||||
import com.mogo.eagle.core.function.hmi.R
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_HMI
|
||||
import com.mogo.eagle.core.widget.media.video.SimpleVideoPlayer
|
||||
import com.shuyu.gsyvideoplayer.GSYVideoManager
|
||||
import com.shuyu.gsyvideoplayer.builder.GSYVideoOptionBuilder
|
||||
@@ -33,7 +34,6 @@ import com.shuyu.gsyvideoplayer.player.PlayerFactory
|
||||
import com.shuyu.gsyvideoplayer.utils.GSYVideoType
|
||||
import kotlinx.android.synthetic.main.view_camera_list.view.*
|
||||
import tv.danmaku.ijk.media.player.IjkMediaPlayer
|
||||
import java.lang.Exception
|
||||
|
||||
/**
|
||||
* @author ChenFufeng
|
||||
@@ -100,16 +100,16 @@ class CameraListView : FrameLayout {
|
||||
when {
|
||||
!cameraEntity.isCarLive() -> {
|
||||
if (!cameraEntity.flvUrl.isNullOrEmpty()) {
|
||||
Logger.d(
|
||||
TAG,
|
||||
CallerLogger.d(
|
||||
"$M_HMI$TAG",
|
||||
"播放地址为:${cameraEntity.flvUrl!!},ip为:${cameraEntity.ip}"
|
||||
)
|
||||
gsyVideoPlay(cameraEntity.flvUrl!!)
|
||||
} else if (!cameraEntity.ip.isNullOrEmpty()) {
|
||||
Logger.d(TAG, "打开推流的摄像头ip为:${cameraEntity.ip}")
|
||||
CallerLogger.d("$M_HMI$TAG", "打开推流的摄像头ip为:${cameraEntity.ip}")
|
||||
CallerMonitorManager.openCameraStream(cameraEntity.ip!!)
|
||||
} else {
|
||||
Logger.e(TAG, "摄像头视频播放地址和ip均为空")
|
||||
CallerLogger.e("$M_HMI$TAG", "摄像头视频播放地址和ip均为空")
|
||||
}
|
||||
}
|
||||
else -> {
|
||||
@@ -145,7 +145,7 @@ class CameraListView : FrameLayout {
|
||||
PlayerFactory.setPlayManager(IjkPlayerManager::class.java)
|
||||
svpPlayer.setPlayListener(object : SimpleVideoPlayer.PlayListener {
|
||||
override fun onPlayEvent(event: Int) {
|
||||
Logger.d(TAG, "onPlayEvent: event is:$event")
|
||||
CallerLogger.d("$M_HMI$TAG", "onPlayEvent: event is:$event")
|
||||
when (event) {
|
||||
SimpleVideoPlayer.PLAY_EVT_PLAY_LOADING -> {
|
||||
// 会出现临时中断后又可以继续播放,需要停掉倒计时
|
||||
@@ -162,7 +162,7 @@ class CameraListView : FrameLayout {
|
||||
}
|
||||
}
|
||||
else -> {
|
||||
Logger.w(TAG, "播放视频异常,event is:$event")
|
||||
CallerLogger.w("$M_HMI$TAG", "播放视频异常,event is:$event")
|
||||
showNoSignalView()
|
||||
if (!valueAnimator.isStarted && !valueAnimator.isRunning) {
|
||||
valueAnimator.start()
|
||||
@@ -217,8 +217,8 @@ class CameraListView : FrameLayout {
|
||||
liveStreamManager.setLiveStatusChangeCallback {
|
||||
textureView
|
||||
.post {
|
||||
handleSnLiveStatus(it)
|
||||
}
|
||||
handleSnLiveStatus(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -250,11 +250,14 @@ class CameraListView : FrameLayout {
|
||||
|
||||
private val trafficCarLiveCallBack = object : ITrafficCarLiveCallBack {
|
||||
override fun onLive(liveSn: String?) {
|
||||
Logger.d(TAG, "onLive")
|
||||
CallerLogger.d("$M_HMI$TAG", "onLive")
|
||||
}
|
||||
|
||||
override fun onFirstFrame() {
|
||||
Logger.d(TAG, "onFirstFrame:isFirstPage is:$isFirstPage,isCarLive is:${isCarLive()}")
|
||||
CallerLogger.d(
|
||||
"$M_HMI$TAG",
|
||||
"onFirstFrame:isFirstPage is:$isFirstPage,isCarLive is:${isCarLive()}"
|
||||
)
|
||||
if (!isFirstPage && isCarLive()) {
|
||||
clickListener?.onShowLive(true)
|
||||
// 会出现临时中断后又可以继续播放,需要停掉倒计时
|
||||
@@ -269,7 +272,7 @@ class CameraListView : FrameLayout {
|
||||
}
|
||||
|
||||
override fun onDisConnect() {
|
||||
Logger.e(TAG, "onDisConnect")
|
||||
CallerLogger.e("$M_HMI$TAG", "onDisConnect")
|
||||
if (!isFirstPage && isCarLive()) {
|
||||
showNoSignalView()
|
||||
if (!valueAnimator.isStarted && !valueAnimator.isRunning) {
|
||||
@@ -279,7 +282,7 @@ class CameraListView : FrameLayout {
|
||||
}
|
||||
|
||||
override fun onError(errorMsg: String?) {
|
||||
Logger.e(TAG, "onError msg is:${errorMsg}")
|
||||
CallerLogger.e("$M_HMI$TAG", "onError msg is:${errorMsg}")
|
||||
if (!isFirstPage && isCarLive()) {
|
||||
// 发生错误
|
||||
showNoSignalView()
|
||||
@@ -299,7 +302,7 @@ class CameraListView : FrameLayout {
|
||||
|
||||
@SuppressLint("NotifyDataSetChanged")
|
||||
fun refreshCameraList(cameraInfoList: List<CameraEntity>?) {
|
||||
Logger.d(TAG, "refreshCameraList")
|
||||
CallerLogger.d("$M_HMI$TAG", "refreshCameraList")
|
||||
this.cameraInfoList.clear()
|
||||
cameraInfoList?.let {
|
||||
this.cameraInfoList.addAll(it)
|
||||
@@ -338,13 +341,16 @@ class CameraListView : FrameLayout {
|
||||
}
|
||||
|
||||
private fun stopLive() {
|
||||
Logger.d(TAG, "stopLive")
|
||||
CallerLogger.d("$M_HMI$TAG", "stopLive")
|
||||
when {
|
||||
!isCarLive() -> {
|
||||
try {
|
||||
GSYVideoManager.releaseAllVideos()
|
||||
} catch (e: Exception) {
|
||||
Logger.e(TAG, "stopLive exception msg is:${e.message},cause is:${e.cause}")
|
||||
CallerLogger.e(
|
||||
"$M_HMI$TAG",
|
||||
"stopLive exception msg is:${e.message},cause is:${e.cause}"
|
||||
)
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
@@ -352,7 +358,7 @@ class CameraListView : FrameLayout {
|
||||
if (!liveSn.isNullOrEmpty()) {
|
||||
MoGoAiCloudTrafficLive.stopCarLive(liveSn)
|
||||
} else {
|
||||
Logger.d(TAG, "StopCarLive sn is null or empty!")
|
||||
CallerLogger.d("$M_HMI$TAG", "StopCarLive sn is null or empty!")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,17 +5,17 @@ import android.app.Activity
|
||||
import android.content.Context
|
||||
import android.hardware.usb.UsbDevice
|
||||
import android.os.Looper
|
||||
import android.util.Log
|
||||
import android.view.*
|
||||
import android.view.animation.OvershootInterpolator
|
||||
import com.mogo.cloud.live.manager.ILiveStreamManager
|
||||
import com.mogo.cloud.live.manager.LiveStreamManagerImpl
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_HMI
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.function.hmi.R
|
||||
import com.mogo.eagle.core.function.hmi.notification.WarningFloat
|
||||
import com.mogo.eagle.core.function.hmi.notification.anim.DefaultAnimator
|
||||
import com.mogo.eagle.core.function.hmi.notification.enums.SidePattern
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
|
||||
import com.mogo.usbcamera.UVCCameraHelper
|
||||
import com.serenegiant.usb.ParentPreviewConstraintLayout
|
||||
import com.serenegiant.usb.widget.CameraViewInterface
|
||||
@@ -116,7 +116,7 @@ class CarcorderPreviewView private constructor(
|
||||
|
||||
private val listener: UVCCameraHelper.OnMyDevConnectListener = object : UVCCameraHelper.OnMyDevConnectListener {
|
||||
override fun onAttachDev(device: UsbDevice?) {
|
||||
Log.d(TAG, "onAttachDev")
|
||||
CallerLogger.d("$M_HMI$TAG", "onAttachDev")
|
||||
// request open permission
|
||||
if (!isRequest) {
|
||||
isRequest = true
|
||||
@@ -125,7 +125,7 @@ class CarcorderPreviewView private constructor(
|
||||
}
|
||||
|
||||
override fun onDettachDev(device: UsbDevice) {
|
||||
Log.d(TAG, "onDettachDev")
|
||||
CallerLogger.d("$M_HMI$TAG", "onDettachDev")
|
||||
// close camera
|
||||
if (isRequest) {
|
||||
isRequest = false
|
||||
@@ -135,7 +135,7 @@ class CarcorderPreviewView private constructor(
|
||||
}
|
||||
|
||||
override fun onConnectDev(device: UsbDevice?, isConnected: Boolean) {
|
||||
Log.d(TAG, "onConnectDev:isConnected=$isConnected")
|
||||
CallerLogger.d("$M_HMI$TAG", "onConnectDev:isConnected=$isConnected")
|
||||
if (!isConnected) {
|
||||
showShortMsg("fail to connect,please check resolution params")
|
||||
isPreview = false
|
||||
@@ -152,8 +152,8 @@ class CarcorderPreviewView private constructor(
|
||||
}
|
||||
Looper.prepare()
|
||||
if (mCameraHelper != null && mCameraHelper!!.isCameraOpened) {
|
||||
Logger.d(TAG, "亮度(brightness):${mCameraHelper!!.getModelValue(UVCCameraHelper.MODE_BRIGHTNESS)}")
|
||||
Logger.d(TAG, "对比度(contrast):${mCameraHelper!!.getModelValue(UVCCameraHelper.MODE_CONTRAST)}")
|
||||
CallerLogger.d("$M_HMI$TAG", "亮度(brightness):${mCameraHelper!!.getModelValue(UVCCameraHelper.MODE_BRIGHTNESS)}")
|
||||
CallerLogger.d("$M_HMI$TAG", "对比度(contrast):${mCameraHelper!!.getModelValue(UVCCameraHelper.MODE_CONTRAST)}")
|
||||
}
|
||||
Looper.loop()
|
||||
}.start()
|
||||
@@ -161,12 +161,12 @@ class CarcorderPreviewView private constructor(
|
||||
}
|
||||
|
||||
override fun onDisConnectDev(device: UsbDevice?) {
|
||||
Log.d(TAG, "onDisConnectDev")
|
||||
CallerLogger.d("$M_HMI$TAG", "onDisConnectDev")
|
||||
showShortMsg("相机断开连接")
|
||||
}
|
||||
|
||||
override fun onCancelDev(device: UsbDevice?) {
|
||||
Log.d(TAG, "onCancelDev:" + device?.deviceName)
|
||||
CallerLogger.d("$M_HMI$TAG", "onCancelDev:" + device?.deviceName)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -183,8 +183,7 @@ class CarcorderPreviewView private constructor(
|
||||
mCameraHelper?.initUSBMonitor(context as Activity, carcorderPreview, listener)
|
||||
|
||||
mCameraHelper?.setOnPreviewFrameListener { nv21Yuv ->
|
||||
Log.d(TAG, "onPreviewResult: " + nv21Yuv.size)
|
||||
//Log.i(TAG, "onVideoFrame byte length: " + bytesLength);
|
||||
CallerLogger.d("$M_HMI$TAG", "onPreviewResult: " + nv21Yuv.size)
|
||||
if (liveStreamManager != null) {
|
||||
// 将摄像头采集的YUV数据推送到ZEGO
|
||||
liveStreamManager!!.notifyYUVData(nv21Yuv, 640, 480, 2)
|
||||
@@ -208,9 +207,9 @@ class CarcorderPreviewView private constructor(
|
||||
// 设置状态回调
|
||||
liveStreamManager!!.setLiveStatusChangeCallback { status ->
|
||||
if (status == 0) {
|
||||
Logger.d(TAG, "直播中……")
|
||||
CallerLogger.d("$M_HMI$TAG", "直播中……")
|
||||
} else {
|
||||
Logger.d(TAG, "直播结束……")
|
||||
CallerLogger.d("$M_HMI$TAG", "直播结束……")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,12 +3,13 @@ package com.mogo.eagle.core.function.hmi.ui.notice
|
||||
import android.content.Context
|
||||
import android.graphics.Bitmap
|
||||
import android.text.TextUtils
|
||||
import android.util.Log
|
||||
import android.view.View
|
||||
import android.widget.ImageView
|
||||
import android.widget.TextView
|
||||
import androidx.lifecycle.LifecycleObserver
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_HMI
|
||||
import com.mogo.eagle.core.data.notice.NoticeNormalData
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.function.hmi.R
|
||||
import com.mogo.eagle.core.utilcode.mogo.glide.GlideApp
|
||||
import com.mogo.eagle.core.utilcode.mogo.glide.GlideRoundedCornersTransform
|
||||
@@ -209,15 +210,15 @@ class NoticeCheckDialog(context: Context) : BaseFloatDialog(context), LifecycleO
|
||||
}
|
||||
|
||||
override fun onClickStop(url: String, vararg objects: Any) {
|
||||
Log.d(TAG, "onClickStop")
|
||||
CallerLogger.d(M_HMI + TAG, "onClickStop")
|
||||
}
|
||||
|
||||
override fun onStartPrepared(url: String, vararg objects: Any) {
|
||||
Log.d(TAG, "onStartPrepared")
|
||||
CallerLogger.d(M_HMI + TAG, "onStartPrepared")
|
||||
}
|
||||
|
||||
override fun onPlayError(url: String, vararg objects: Any) {
|
||||
Log.d(TAG, "onPlayError")
|
||||
CallerLogger.d(M_HMI + TAG, "onPlayError")
|
||||
pushImageView?.visibility = View.GONE
|
||||
pushVideo?.visibility = View.GONE
|
||||
playImageView!!.visibility = View.GONE
|
||||
@@ -244,7 +245,7 @@ class NoticeCheckDialog(context: Context) : BaseFloatDialog(context), LifecycleO
|
||||
override fun onClickStartThumb(url: String, vararg objects: Any) {}
|
||||
override fun onClickBlank(url: String, vararg objects: Any) {}
|
||||
override fun onClickBlankFullscreen(url: String, vararg objects: Any) {
|
||||
Log.d(TAG, "onClickBlankFullscreen")
|
||||
CallerLogger.d(M_HMI + TAG, "onClickBlankFullscreen")
|
||||
}
|
||||
})
|
||||
}).start()
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.mogo.eagle.core.function.hmi.ui.notice;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@@ -10,7 +9,6 @@ import android.widget.TextView;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.mogo.eagle.core.data.notice.NoticeTrafficStyleInfo;
|
||||
import com.mogo.eagle.core.data.notice.NoticeValue;
|
||||
import com.mogo.eagle.core.function.hmi.R;
|
||||
|
||||
@@ -23,7 +21,6 @@ import java.util.List;
|
||||
* @since: 10/26/21
|
||||
*/
|
||||
class NoticeTrafficAdapter extends RecyclerView.Adapter {
|
||||
private String TAG = "AINotice";
|
||||
LayoutInflater mLayoutInflater;
|
||||
private List<NoticeValue> data = new ArrayList();
|
||||
|
||||
@@ -41,8 +38,7 @@ class NoticeTrafficAdapter extends RecyclerView.Adapter {
|
||||
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View v = mLayoutInflater.inflate(R.layout.notice_traffice_info_list_adapter, parent,
|
||||
false);
|
||||
TrafficInfoHolder holder = new TrafficInfoHolder(v);
|
||||
return holder;
|
||||
return new TrafficInfoHolder(v);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -61,13 +57,12 @@ class NoticeTrafficAdapter extends RecyclerView.Adapter {
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
Log.d(TAG, "getItemCount++" + String.valueOf(data.size()));
|
||||
return data.size();
|
||||
}
|
||||
|
||||
public class TrafficInfoHolder extends RecyclerView.ViewHolder {
|
||||
private TextView keyText;
|
||||
private TextView valueText;
|
||||
private static class TrafficInfoHolder extends RecyclerView.ViewHolder {
|
||||
private final TextView keyText;
|
||||
private final TextView valueText;
|
||||
|
||||
public TrafficInfoHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
package com.mogo.eagle.core.function.hmi.ui.notice;
|
||||
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_HMI;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
@@ -20,6 +21,7 @@ import com.mogo.eagle.core.data.notice.NoticeTrafficStylePushData;
|
||||
import com.mogo.eagle.core.data.notice.NoticeValue;
|
||||
import com.mogo.eagle.core.function.api.notice.NoticeNetCallBack;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.function.call.notice.CallerNoticeManager;
|
||||
import com.mogo.eagle.core.function.hmi.R;
|
||||
import com.mogo.eagle.core.utilcode.mogo.glide.GlideApp;
|
||||
@@ -56,12 +58,12 @@ public class NoticeTrafficDialog extends BaseFloatDialog implements LifecycleObs
|
||||
private ImageView close;
|
||||
private ImageView playImageView;
|
||||
private MogoImageView thumbnailImage;
|
||||
private GSYVideoOptionBuilder gsyVideoOptionBuilder = new GSYVideoOptionBuilder();
|
||||
private final GSYVideoOptionBuilder gsyVideoOptionBuilder = new GSYVideoOptionBuilder();
|
||||
private TextView accept;//接受
|
||||
private TextView refuse;//拒绝
|
||||
private TextView connect;//连接
|
||||
private NoticeTrafficAdapter adapter;
|
||||
private ArrayList dataArrayList = new ArrayList();
|
||||
private final ArrayList dataArrayList = new ArrayList();
|
||||
private NoticeTrafficStyleInfo.NoticeTrafficAccountInfo mTrafficStyleInfo;
|
||||
private IMogoServiceApis mServiceApis;
|
||||
|
||||
@@ -82,7 +84,7 @@ public class NoticeTrafficDialog extends BaseFloatDialog implements LifecycleObs
|
||||
playerShow();//视频播放器及接操作按钮
|
||||
recyclerVie();//详情信息列表
|
||||
mServiceApis = MogoApisHandler.getInstance().getApis();
|
||||
mServiceApis.getStatusManagerApi().registerStatusChangedListener(TAG, StatusDescriptor.MAIN_PAGE_IS_BACKGROUND, statusChangedListenerForNotice);
|
||||
mServiceApis.getStatusManagerApi().registerStatusChangedListener(M_HMI + TAG, StatusDescriptor.MAIN_PAGE_IS_BACKGROUND, statusChangedListenerForNotice);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -93,9 +95,7 @@ public class NoticeTrafficDialog extends BaseFloatDialog implements LifecycleObs
|
||||
mVideoPlayer = findViewById(R.id.video_player);
|
||||
thumbnailImage = findViewById(R.id.thumbnail_image);
|
||||
playImageView = this.findViewById(R.id.start_for_traffic);
|
||||
playImageView.setOnClickListener(v -> {
|
||||
startLive();
|
||||
});
|
||||
playImageView.setOnClickListener(v -> startLive());
|
||||
close = findViewById(R.id.notice_traffic_dialog_close);
|
||||
close.setOnClickListener(v -> {
|
||||
releasePlayer();
|
||||
@@ -104,12 +104,8 @@ public class NoticeTrafficDialog extends BaseFloatDialog implements LifecycleObs
|
||||
accept = findViewById(R.id.accept_traffic);
|
||||
refuse = findViewById(R.id.refuse_traffic);
|
||||
connect = findViewById(R.id.notice_connect);
|
||||
accept.setOnClickListener(v -> {
|
||||
feedBackTraffic(1);
|
||||
});
|
||||
refuse.setOnClickListener(v -> {
|
||||
feedBackTraffic(0);
|
||||
});
|
||||
accept.setOnClickListener(v -> feedBackTraffic(1));
|
||||
refuse.setOnClickListener(v -> feedBackTraffic(0));
|
||||
//重新连接
|
||||
connect.setOnClickListener(v -> {
|
||||
netWorkStatus();
|
||||
@@ -127,14 +123,11 @@ public class NoticeTrafficDialog extends BaseFloatDialog implements LifecycleObs
|
||||
playImageView.setVisibility(View.INVISIBLE);
|
||||
thumbnailImage.setVisibility(View.VISIBLE);
|
||||
}
|
||||
mVideoPlayer.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (mVideoPlayer.getCurrentState() == GSYVideoView.CURRENT_STATE_PAUSE) {/*播放中*/
|
||||
resume();
|
||||
} else {
|
||||
pause();
|
||||
}
|
||||
mVideoPlayer.setOnClickListener(v -> {
|
||||
if (mVideoPlayer.getCurrentState() == GSYVideoView.CURRENT_STATE_PAUSE) {/*播放中*/
|
||||
resume();
|
||||
} else {
|
||||
pause();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -179,13 +172,13 @@ public class NoticeTrafficDialog extends BaseFloatDialog implements LifecycleObs
|
||||
parameters.isSpeakVoice = false;
|
||||
parameters.vehicleType = 10;
|
||||
//云平台使用的是火星坐标,自动驾驶需要wgs84
|
||||
double[] gcj02 = CoordinateUtils.transformGcj02toWgs84(mTrafficStyleInfo.getLat(),mTrafficStyleInfo.getLon());
|
||||
double[] gcj02 = CoordinateUtils.transformGcj02toWgs84(mTrafficStyleInfo.getLat(), mTrafficStyleInfo.getLon());
|
||||
AutopilotControlParameters.AutoPilotLonLat startLocation = new AutopilotControlParameters.AutoPilotLonLat
|
||||
(MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLon(),
|
||||
MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLat());
|
||||
parameters.startLatLon = startLocation;
|
||||
AutopilotControlParameters.AutoPilotLonLat endLocation = new AutopilotControlParameters.AutoPilotLonLat
|
||||
(gcj02[0],gcj02[1]);
|
||||
(gcj02[0], gcj02[1]);
|
||||
parameters.endLatLon = endLocation;
|
||||
CallerAutoPilotManager.INSTANCE.startAutoPilot(parameters);
|
||||
}
|
||||
@@ -196,12 +189,8 @@ public class NoticeTrafficDialog extends BaseFloatDialog implements LifecycleObs
|
||||
private void pause() {
|
||||
playImageView.setVisibility(View.VISIBLE);
|
||||
thumbnailImage.setVisibility(View.GONE);
|
||||
playImageView.setOnClickListener(v -> {
|
||||
mVideoPlayer.onVideoResume();
|
||||
});
|
||||
thumbnailImage.setOnClickListener(v -> {
|
||||
mVideoPlayer.onVideoResume();
|
||||
});
|
||||
playImageView.setOnClickListener(v -> mVideoPlayer.onVideoResume());
|
||||
thumbnailImage.setOnClickListener(v -> mVideoPlayer.onVideoResume());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -223,12 +212,8 @@ public class NoticeTrafficDialog extends BaseFloatDialog implements LifecycleObs
|
||||
(20f, GlideRoundedCornersTransform.CornerType.ALL)).into(thumbnailImage);
|
||||
playImageView.setImageResource(R.drawable.notice_video_play);
|
||||
playImageView.setVisibility(View.VISIBLE);
|
||||
playImageView.setOnClickListener(v -> {
|
||||
startLive();
|
||||
});
|
||||
thumbnailImage.setOnClickListener(v -> {
|
||||
startLive();
|
||||
});
|
||||
playImageView.setOnClickListener(v -> startLive());
|
||||
thumbnailImage.setOnClickListener(v -> startLive());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -237,7 +222,7 @@ public class NoticeTrafficDialog extends BaseFloatDialog implements LifecycleObs
|
||||
private void startLive() {
|
||||
if (mPushData != null) {
|
||||
try {
|
||||
Log.d(TAG, "交警事故开始播放视频startLive");
|
||||
CallerLogger.INSTANCE.d(M_HMI + TAG, "交警事故开始播放视频startLive");
|
||||
String videoUrl = mPushData.getPoiImgUrl();
|
||||
gsyVideoOptionBuilder.setUrl(videoUrl).setCacheWithPlay(false).setPlayTag("NoticeTrafficDialog")
|
||||
.build(mVideoPlayer);
|
||||
@@ -253,118 +238,115 @@ public class NoticeTrafficDialog extends BaseFloatDialog implements LifecycleObs
|
||||
}
|
||||
|
||||
private void liveCallBack() {
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Bitmap firstBitmap = BitmapHelper.getVideoThumbnail(mPushData.getPoiImgUrl());/*获取第一帧图*/
|
||||
mVideoPlayer.setVideoAllCallBack(new VideoAllCallBack() {
|
||||
@Override
|
||||
public void onAutoComplete(String url, Object... objects) {
|
||||
complete(firstBitmap);
|
||||
}
|
||||
new Thread(() -> {
|
||||
Bitmap firstBitmap = BitmapHelper.getVideoThumbnail(mPushData.getPoiImgUrl());/*获取第一帧图*/
|
||||
mVideoPlayer.setVideoAllCallBack(new VideoAllCallBack() {
|
||||
@Override
|
||||
public void onAutoComplete(String url, Object... objects) {
|
||||
complete(firstBitmap);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClickResume(String url, Object... objects) {
|
||||
thumbnailImage.setVisibility(View.GONE);
|
||||
playImageView.setVisibility(View.GONE);
|
||||
}
|
||||
@Override
|
||||
public void onClickResume(String url, Object... objects) {
|
||||
thumbnailImage.setVisibility(View.GONE);
|
||||
playImageView.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClickStop(String url, Object... objects) {
|
||||
Log.d(TAG, "onClickStop");
|
||||
}
|
||||
@Override
|
||||
public void onClickStop(String url, Object... objects) {
|
||||
CallerLogger.INSTANCE.d(M_HMI + TAG, "onClickStop");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStartPrepared(String url, Object... objects) {
|
||||
Log.d(TAG, "onStartPrepared");
|
||||
}
|
||||
@Override
|
||||
public void onStartPrepared(String url, Object... objects) {
|
||||
CallerLogger.INSTANCE.d(M_HMI + TAG, "onStartPrepared");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPrepared(String url, Object... objects) {
|
||||
Log.d(TAG, "onPrepared");
|
||||
thumbnailImage.setVisibility(View.GONE);
|
||||
playImageView.setVisibility(View.GONE);
|
||||
connect.setVisibility(View.GONE);
|
||||
}
|
||||
@Override
|
||||
public void onPrepared(String url, Object... objects) {
|
||||
CallerLogger.INSTANCE.d(M_HMI + TAG, "onPrepared");
|
||||
thumbnailImage.setVisibility(View.GONE);
|
||||
playImageView.setVisibility(View.GONE);
|
||||
connect.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClickStartIcon(String url, Object... objects) {
|
||||
Log.d(TAG, "onClickStartIcon");
|
||||
}
|
||||
@Override
|
||||
public void onClickStartIcon(String url, Object... objects) {
|
||||
CallerLogger.INSTANCE.d(M_HMI + TAG, "onClickStartIcon");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClickStartError(String url, Object... objects) {
|
||||
Log.e(TAG, "onClickStartError");
|
||||
}
|
||||
@Override
|
||||
public void onClickStartError(String url, Object... objects) {
|
||||
CallerLogger.INSTANCE.e(M_HMI + TAG, "onClickStartError");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClickStopFullscreen(String url, Object... objects) {
|
||||
Log.d(TAG, "onClickStopFullscreen");
|
||||
}
|
||||
@Override
|
||||
public void onClickStopFullscreen(String url, Object... objects) {
|
||||
CallerLogger.INSTANCE.d(M_HMI + TAG, "onClickStopFullscreen");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClickResumeFullscreen(String url, Object... objects) {
|
||||
}
|
||||
@Override
|
||||
public void onClickResumeFullscreen(String url, Object... objects) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClickSeekbar(String url, Object... objects) {
|
||||
}
|
||||
@Override
|
||||
public void onClickSeekbar(String url, Object... objects) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClickSeekbarFullscreen(String url, Object... objects) {
|
||||
}
|
||||
@Override
|
||||
public void onClickSeekbarFullscreen(String url, Object... objects) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEnterFullscreen(String url, Object... objects) {
|
||||
}
|
||||
@Override
|
||||
public void onEnterFullscreen(String url, Object... objects) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onQuitFullscreen(String url, Object... objects) {
|
||||
}
|
||||
@Override
|
||||
public void onQuitFullscreen(String url, Object... objects) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onQuitSmallWidget(String url, Object... objects) {
|
||||
}
|
||||
@Override
|
||||
public void onQuitSmallWidget(String url, Object... objects) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEnterSmallWidget(String url, Object... objects) {
|
||||
}
|
||||
@Override
|
||||
public void onEnterSmallWidget(String url, Object... objects) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTouchScreenSeekVolume(String url, Object... objects) {
|
||||
}
|
||||
@Override
|
||||
public void onTouchScreenSeekVolume(String url, Object... objects) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTouchScreenSeekPosition(String url, Object... objects) {
|
||||
}
|
||||
@Override
|
||||
public void onTouchScreenSeekPosition(String url, Object... objects) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTouchScreenSeekLight(String url, Object... objects) {
|
||||
}
|
||||
@Override
|
||||
public void onTouchScreenSeekLight(String url, Object... objects) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlayError(String url, Object... objects) {
|
||||
thumbnailImage.setVisibility(View.VISIBLE);
|
||||
connect.setVisibility(View.VISIBLE);
|
||||
Log.d(TAG, "onPlayError");
|
||||
}
|
||||
@Override
|
||||
public void onPlayError(String url, Object... objects) {
|
||||
thumbnailImage.setVisibility(View.VISIBLE);
|
||||
connect.setVisibility(View.VISIBLE);
|
||||
CallerLogger.INSTANCE.d(M_HMI + TAG, "onPlayError");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClickStartThumb(String url, Object... objects) {
|
||||
Log.d(TAG, "onClickStartThumb");
|
||||
}
|
||||
@Override
|
||||
public void onClickStartThumb(String url, Object... objects) {
|
||||
CallerLogger.INSTANCE.d(M_HMI + TAG, "onClickStartThumb");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClickBlank(String url, Object... objects) {
|
||||
}
|
||||
@Override
|
||||
public void onClickBlank(String url, Object... objects) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClickBlankFullscreen(String url, Object... objects) {
|
||||
Log.d(TAG, "onClickBlankFullscreen");
|
||||
@Override
|
||||
public void onClickBlankFullscreen(String url, Object... objects) {
|
||||
CallerLogger.INSTANCE.d(M_HMI + TAG, "onClickBlankFullscreen");
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}).start();
|
||||
}
|
||||
|
||||
@@ -372,11 +354,11 @@ public class NoticeTrafficDialog extends BaseFloatDialog implements LifecycleObs
|
||||
* 获取交通事故详情
|
||||
*/
|
||||
private void requestTrafficInfo() {
|
||||
Log.d(TAG, "requestTrafficInfo");
|
||||
CallerLogger.INSTANCE.d(M_HMI + TAG, "requestTrafficInfo");
|
||||
CallerNoticeManager.getNoticeProvider().requestAccidentInfo(mPushData.getInfoId(), MoGoAiCloudClientConfig.getInstance().getSn(), new NoticeNetCallBack() {
|
||||
@Override
|
||||
public void callBackWithResult(NoticeTrafficStyleInfo trafficInfo) {
|
||||
Log.d(TAG, "交通事故详情::" + trafficInfo);
|
||||
CallerLogger.INSTANCE.d(M_HMI + TAG, "交通事故详情::" + trafficInfo);
|
||||
mTrafficStyleInfo = trafficInfo.getResult().getAccidentInfo();
|
||||
infoRefresh(mTrafficStyleInfo);
|
||||
}
|
||||
@@ -435,7 +417,7 @@ public class NoticeTrafficDialog extends BaseFloatDialog implements LifecycleObs
|
||||
*/
|
||||
private void netWorkStatus() {
|
||||
if (NetworkUtils.isAvailable(getContext())) {
|
||||
Log.d(TAG, "网络可用");
|
||||
CallerLogger.INSTANCE.d(M_HMI + TAG, "网络可用");
|
||||
thumbnailImage.setVisibility(View.GONE);
|
||||
connect.setVisibility(View.GONE);
|
||||
thumbnailImage.setBackgroundResource(R.drawable.notice_traffic_placeholder);
|
||||
@@ -461,17 +443,14 @@ public class NoticeTrafficDialog extends BaseFloatDialog implements LifecycleObs
|
||||
@Override
|
||||
public void dismiss() {
|
||||
super.dismiss();
|
||||
Log.d(TAG, "trafficdialog dismiss");
|
||||
CallerLogger.INSTANCE.d(M_HMI + TAG, "trafficDialog dismiss");
|
||||
releasePlayer();
|
||||
}
|
||||
|
||||
private IMogoStatusChangedListener statusChangedListenerForNotice = new IMogoStatusChangedListener() {
|
||||
@Override
|
||||
public void onStatusChanged(StatusDescriptor descriptor, boolean isTrue) {
|
||||
if (descriptor == StatusDescriptor.MAIN_PAGE_IS_BACKGROUND) {
|
||||
Log.d("AINotice", "onStatusChanged==MAIN_PAGE_IS_BACKGROUND");
|
||||
dismiss();
|
||||
}
|
||||
private final IMogoStatusChangedListener statusChangedListenerForNotice = (descriptor, isTrue) -> {
|
||||
if (descriptor == StatusDescriptor.MAIN_PAGE_IS_BACKGROUND) {
|
||||
CallerLogger.INSTANCE.d(M_HMI + TAG, "onStatusChanged==MAIN_PAGE_IS_BACKGROUND");
|
||||
dismiss();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -16,6 +16,8 @@
|
||||
|
||||
package com.mogo.eagle.core.function.hmi.ui.notice.roundimage;
|
||||
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_HMI;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.content.res.Resources;
|
||||
@@ -28,13 +30,13 @@ import android.graphics.drawable.Drawable;
|
||||
import android.graphics.drawable.LayerDrawable;
|
||||
import android.net.Uri;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.ColorInt;
|
||||
import androidx.annotation.DimenRes;
|
||||
import androidx.annotation.DrawableRes;
|
||||
import androidx.appcompat.widget.AppCompatImageView;
|
||||
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.function.hmi.R;
|
||||
|
||||
|
||||
@@ -271,7 +273,7 @@ public class RoundedImageView extends AppCompatImageView {
|
||||
try {
|
||||
d = rsrc.getDrawable(mResource);
|
||||
} catch (Exception e) {
|
||||
Log.w(TAG, "Unable to find resource: " + mResource, e);
|
||||
CallerLogger.INSTANCE.w(M_HMI + TAG, "Unable to find resource : " + mResource + " exception : " + e);
|
||||
// Don't try again.
|
||||
mResource = 0;
|
||||
}
|
||||
@@ -309,7 +311,7 @@ public class RoundedImageView extends AppCompatImageView {
|
||||
try {
|
||||
d = rsrc.getDrawable(mBackgroundResource);
|
||||
} catch (Exception e) {
|
||||
Log.w(TAG, "Unable to find resource: " + mBackgroundResource, e);
|
||||
CallerLogger.INSTANCE.w(M_HMI + TAG, "Unable to find resource : " + mBackgroundResource + " exception : " + e);
|
||||
// Don't try again.
|
||||
mBackgroundResource = 0;
|
||||
}
|
||||
|
||||
@@ -11,17 +11,13 @@ import com.mogo.commons.AbsMogoApplication
|
||||
import com.mogo.commons.debug.DebugConfig
|
||||
import com.mogo.eagle.core.data.app.AppConfigInfo
|
||||
import com.mogo.eagle.core.data.autopilot.*
|
||||
import com.mogo.eagle.core.data.deva.chain.ChainConstant
|
||||
import com.mogo.eagle.core.data.chain.ChainConstant
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.data.constants.MoGoConfig
|
||||
import com.mogo.eagle.core.data.enums.TrafficTypeEnum
|
||||
import com.mogo.eagle.core.data.map.MogoLocation
|
||||
import com.mogo.eagle.core.data.obu.ObuStatusInfo
|
||||
import com.mogo.eagle.core.data.traffic.TrafficData
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotCarStateListener
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotIdentifyListener
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotPlanningListener
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
|
||||
import com.mogo.eagle.core.function.api.autopilot.*
|
||||
import com.mogo.eagle.core.function.api.devatools.IMoGoDevaToolsListener
|
||||
import com.mogo.eagle.core.function.api.map.listener.IMoGoMapLocationListener
|
||||
import com.mogo.eagle.core.function.api.obu.IMoGoObuStatusListener
|
||||
@@ -53,6 +49,8 @@ import com.mogo.map.uicontroller.VisualAngleMode.MODE_LONG_SIGHT
|
||||
import com.mogo.map.uicontroller.VisualAngleMode.*
|
||||
import com.mogo.module.common.MogoApisHandler
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.*
|
||||
import mogo.telematics.pad.MessagePad
|
||||
import mogo_msg.MogoReportMsg
|
||||
import java.util.*
|
||||
|
||||
/**
|
||||
@@ -62,13 +60,13 @@ import java.util.*
|
||||
* 展示 本机、网络、工控机、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, IMoGoAutopilotIdentifyListener,
|
||||
IMoGoAutopilotPlanningListener {
|
||||
IMoGoAutopilotStatusListener, IMoGoAutopilotCarStateListener,
|
||||
IMoGoMapLocationListener, IMoGoAutopilotIdentifyListener,
|
||||
IMoGoAutopilotPlanningListener, IMoGoAutopilotCarConfigListener {
|
||||
|
||||
private val TAG = "DebugSettingView"
|
||||
|
||||
@@ -76,7 +74,7 @@ class DebugSettingView @JvmOverloads constructor(
|
||||
private var logViewAttach = false
|
||||
|
||||
private var mAutoPilotStatusInfo: AutopilotStatusInfo? = null
|
||||
private var mAutoPilotCarStateInfo: AutopilotCarStateInfo? = null
|
||||
private var mGnssInfo: MessagePad.GnssInfo? = null
|
||||
|
||||
// 感知识别「已知类型」数据个数
|
||||
private var mIdentifyDataSize = 0
|
||||
@@ -127,6 +125,8 @@ class DebugSettingView @JvmOverloads constructor(
|
||||
CallerAutopilotIdentifyListenerManager.addListener(TAG, this)
|
||||
// 添加 规划路径相关回调 监听
|
||||
CallerAutopilotPlanningListenerManager.addListener(TAG, this)
|
||||
// 添加 工控机基础信息回调 监听
|
||||
CallerAutopilotCarConfigListenerManager.addListener(TAG, this)
|
||||
if (logInfoView != null) {
|
||||
logInfoView!!.onEnterForeground()
|
||||
}
|
||||
@@ -251,14 +251,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) }
|
||||
@@ -274,8 +274,8 @@ class DebugSettingView @JvmOverloads constructor(
|
||||
|
||||
// 初始化工控机 IP信息
|
||||
val autoPilotIpAddress =
|
||||
SharedPrefsMgr.getInstance(context)
|
||||
.getString(MoGoConfig.AUTOPILOT_IP, FunctionBuildConfig.adasConnectIP)
|
||||
SharedPrefsMgr.getInstance(context)
|
||||
.getString(MoGoConfig.AUTOPILOT_IP, FunctionBuildConfig.adasConnectIP)
|
||||
|
||||
etAutopilotIP.setText(autoPilotIpAddress)
|
||||
etAutopilotIP.text?.let { etAutopilotIP.setSelection(it.length) }
|
||||
@@ -296,18 +296,18 @@ class DebugSettingView @JvmOverloads constructor(
|
||||
|
||||
// 初始化 GSP数据源 数据
|
||||
rgGpsProvider.check(
|
||||
when (FunctionBuildConfig.gpsProvider) {
|
||||
0 -> {
|
||||
R.id.rbGpsProviderAndroid
|
||||
}
|
||||
1 -> {
|
||||
R.id.rbGpsProviderRTK
|
||||
}
|
||||
2 -> {
|
||||
R.id.rbGpsProviderOBU
|
||||
}
|
||||
else -> R.id.rbGpsProviderAndroid
|
||||
when (FunctionBuildConfig.gpsProvider) {
|
||||
0 -> {
|
||||
R.id.rbGpsProviderAndroid
|
||||
}
|
||||
1 -> {
|
||||
R.id.rbGpsProviderRTK
|
||||
}
|
||||
2 -> {
|
||||
R.id.rbGpsProviderOBU
|
||||
}
|
||||
else -> R.id.rbGpsProviderAndroid
|
||||
}
|
||||
)
|
||||
rgGpsProvider.setOnCheckedChangeListener { group, checkedId ->
|
||||
when (checkedId) {
|
||||
@@ -368,11 +368,9 @@ class DebugSettingView @JvmOverloads constructor(
|
||||
|
||||
tbSelfLog.setOnCheckedChangeListener { _, isChecked ->
|
||||
if (isChecked) {
|
||||
LogUtils.getConfig().isLogSwitch = false
|
||||
Logger.init(LogLevel.OFF)
|
||||
MoGoAiCloudClient.getInstance().aiCloudClientConfig.isShowDebugLog = false
|
||||
} else {
|
||||
LogUtils.getConfig().isLogSwitch = true
|
||||
Logger.init(LogLevel.DEBUG)
|
||||
MoGoAiCloudClient.getInstance().aiCloudClientConfig.isShowDebugLog = true
|
||||
}
|
||||
@@ -380,10 +378,8 @@ class DebugSettingView @JvmOverloads constructor(
|
||||
tbADASLog.setOnCheckedChangeListener { _, isChecked ->
|
||||
if (isChecked) {
|
||||
CallerAutoPilotManager.setEnableLog(true)
|
||||
CallerAutoPilotManager.setIsWriteLog(true)
|
||||
} else {
|
||||
CallerAutoPilotManager.setEnableLog(false)
|
||||
CallerAutoPilotManager.setIsWriteLog(false)
|
||||
}
|
||||
}
|
||||
tbControlView.setOnCheckedChangeListener { _, isChecked ->
|
||||
@@ -395,11 +391,11 @@ 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) {
|
||||
var logTimeStr = etLogCatch.text?.toString()
|
||||
if(logTimeStr.isNullOrEmpty()){
|
||||
if (logTimeStr.isNullOrEmpty()) {
|
||||
logTimeStr = "10"
|
||||
}
|
||||
val logCatchTime = logTimeStr.toInt()
|
||||
@@ -414,20 +410,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()
|
||||
@@ -486,7 +482,8 @@ class DebugSettingView @JvmOverloads constructor(
|
||||
AppConfigInfo.uniqueDeviceId = DeviceIdUtils.getDeviceId(AbsMogoApplication.getApp())
|
||||
}
|
||||
if (AppConfigInfo.widevineIDMd5.isNullOrEmpty()) {
|
||||
AppConfigInfo.widevineIDMd5 = DeviceIdUtils.getWidevineIDWithMd5(AbsMogoApplication.getApp())
|
||||
AppConfigInfo.widevineIDMd5 =
|
||||
DeviceIdUtils.getWidevineIDWithMd5(AbsMogoApplication.getApp())
|
||||
}
|
||||
AppConfigInfo.mogoSN = MoGoAiCloudClient.getInstance().aiCloudClientConfig.sn
|
||||
AppConfigInfo.mogoToken = MoGoAiCloudClient.getInstance().aiCloudClientConfig.token
|
||||
@@ -495,7 +492,7 @@ class DebugSettingView @JvmOverloads constructor(
|
||||
AppConfigInfo.isConnectNet = NetworkUtils.isConnected(context)
|
||||
AppConfigInfo.isConnectSocket = DebugConfig.isDownloadSnapshot()
|
||||
|
||||
when (FunctionBuildConfig.appIdentityMode) {
|
||||
when (FunctionBuildConfig.appIdentityMode) {
|
||||
0x00 -> {// 司机端
|
||||
AppConfigInfo.isDriver = true
|
||||
AppConfigInfo.isConnectedNetty = CallerTelematicManager.getServerStarted()
|
||||
@@ -513,16 +510,16 @@ class DebugSettingView @JvmOverloads constructor(
|
||||
tvAutopilotInfo.text = GsonUtils.toJson(mAutoPilotStatusInfo)
|
||||
|
||||
tvCarInfo.text =
|
||||
"GPS时间:${mAutoPilotCarStateInfo?.values?.satelliteTime}\n" +
|
||||
"自车经纬度:\n${mAutoPilotCarStateInfo?.values?.lon}\n${mAutoPilotCarStateInfo?.values?.lat}\n"
|
||||
"GPS时间:${mGnssInfo?.satelliteTime}\n" +
|
||||
"自车经纬度:\n${mGnssInfo?.longitude}\n${mGnssInfo?.latitude}\n"
|
||||
|
||||
tvIdentifyInfo.text =
|
||||
"「有效类型」感知数据个数:${mIdentifyDataSize}\n" +
|
||||
"「未知类型」感知数据个数:${mUnknownIdentifyDataSize}\n"
|
||||
"「有效类型」感知数据个数:${mIdentifyDataSize}\n" +
|
||||
"「未知类型」感知数据个数:${mUnknownIdentifyDataSize}\n"
|
||||
tvTrajectoryInfoSize.text =
|
||||
"引导线点个数:${mTrajectoryInfoSize}"
|
||||
"引导线点个数:${mTrajectoryInfoSize}"
|
||||
tvRouteInfoSize.text =
|
||||
"全局路径规划点个数:${mRouteInfoSize}"
|
||||
"全局路径规划点个数:${mRouteInfoSize}"
|
||||
|
||||
// 用完之后重制为0,防止节点回掉突然没数据,导致页面显示还是之前的数据情况
|
||||
mIdentifyDataSize = 0
|
||||
@@ -551,34 +548,17 @@ class DebugSettingView @JvmOverloads constructor(
|
||||
AppConfigInfo.isConnectAutopilot = autoPilotStatusInfo.connectStatus
|
||||
}
|
||||
|
||||
override fun onAutopilotArriveAtStation(autopilotWayArrive: AutopilotStationInfo?) {
|
||||
|
||||
override fun onAutopilotCarStateData(gnssInfo: MessagePad.GnssInfo?) {
|
||||
mGnssInfo = gnssInfo
|
||||
}
|
||||
|
||||
override fun onAutopilotCarStateData(autoPilotCarStateInfo: AutopilotCarStateInfo?) {
|
||||
//Logger.d(TAG, "autoPilotCarStateInfo:$autoPilotCarStateInfo")
|
||||
mAutoPilotCarStateInfo = autoPilotCarStateInfo
|
||||
}
|
||||
|
||||
override fun onAutopilotSNRequest() {
|
||||
|
||||
}
|
||||
|
||||
override fun onAutopilotGuardian(guardianInfo: AutopilotGuardianStatusInfo?) {
|
||||
|
||||
}
|
||||
|
||||
override fun onLocationChanged(location: MogoLocation?) {
|
||||
//Logger.d(TAG, "location:$location")
|
||||
}
|
||||
|
||||
override fun onAutopilotIdentifyDataUpdate(trafficData: ArrayList<TrafficData>?) {
|
||||
override fun onAutopilotIdentifyDataUpdate(trafficData: List<MessagePad.TrackedObject>?) {
|
||||
// 重制数据
|
||||
mIdentifyDataSize = 0
|
||||
mUnknownIdentifyDataSize = 0
|
||||
// 遍历计数
|
||||
trafficData?.forEach {
|
||||
if (it.type == TrafficTypeEnum.TYPE_TRAFFIC_ID_WEI_ZHI) {
|
||||
if (it.type == TrafficTypeEnum.TYPE_TRAFFIC_ID_WEI_ZHI.type) {
|
||||
mUnknownIdentifyDataSize++
|
||||
} else {
|
||||
mIdentifyDataSize++
|
||||
@@ -586,19 +566,26 @@ class DebugSettingView @JvmOverloads constructor(
|
||||
}
|
||||
}
|
||||
|
||||
override fun onAutopilotWarnMessage(autopilotWarnMessage: AutopilotWarnMessage?) {
|
||||
|
||||
}
|
||||
|
||||
override fun onAutopilotRecordResult(record: AutoPilotRecordResult?) {
|
||||
|
||||
}
|
||||
|
||||
override fun onAutopilotTrajectory(trajectoryInfos: ArrayList<ADASTrajectoryInfo>) {
|
||||
mTrajectoryInfoSize = trajectoryInfos.size
|
||||
}
|
||||
|
||||
override fun onAutopilotRotting(routeList: AutopilotRouteInfo?) {
|
||||
mRouteInfoSize = routeList?.models?.size ?: 0
|
||||
override fun onAutopilotRotting(globalPathResp: MessagePad.GlobalPathResp?) {
|
||||
mRouteInfoSize = globalPathResp?.wayPointsList?.size ?: 0
|
||||
}
|
||||
|
||||
override fun onAutopilotCarConfig(carConfigResp: MessagePad.CarConfigResp) {
|
||||
//todo pb : 工控机基础信息回调 详见 message CarConfigResp proto
|
||||
|
||||
}
|
||||
|
||||
override fun onAutopilotGuardian(guardianInfo: MogoReportMsg.MogoReportMessage?) {
|
||||
//todo pb : 工控机异常信息回调
|
||||
|
||||
}
|
||||
|
||||
override fun onLocationChanged(location: MogoLocation?) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4,7 +4,6 @@ import android.content.Context
|
||||
import android.widget.TextView
|
||||
import androidx.lifecycle.LifecycleObserver
|
||||
import com.mogo.eagle.core.function.hmi.R
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
|
||||
import com.mogo.module.common.dialog.BaseFloatDialog
|
||||
|
||||
/**
|
||||
@@ -14,10 +13,6 @@ import com.mogo.module.common.dialog.BaseFloatDialog
|
||||
*/
|
||||
class AdUpgradeDialog(context: Context) : BaseFloatDialog(context), LifecycleObserver {
|
||||
|
||||
companion object {
|
||||
const val TAG = "AdUpgradeDialog"
|
||||
}
|
||||
|
||||
private var upgradeConfirm : TextView? = null
|
||||
private var upgradeCancel : TextView? = null
|
||||
|
||||
@@ -30,12 +25,10 @@ class AdUpgradeDialog(context: Context) : BaseFloatDialog(context), LifecycleObs
|
||||
upgradeCancel=findViewById(R.id.tv_upgrade_cancel)
|
||||
|
||||
upgradeConfirm?.setOnClickListener{
|
||||
Logger.i(TAG,"upgradeConfirm click")
|
||||
clickListener?.confirm()
|
||||
dismiss()
|
||||
}
|
||||
upgradeCancel?.setOnClickListener {
|
||||
Logger.i(TAG,"upgradeCancel click")
|
||||
clickListener?.cancel()
|
||||
dismiss()
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@ import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.widget.FrameLayout
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotGuardianStatusInfo
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
|
||||
@@ -140,9 +139,22 @@ class AutoPilotAndCheckView @JvmOverloads constructor(
|
||||
* @param downloadVersion 下载版本
|
||||
* @param upgradeStatus 升级状态
|
||||
*/
|
||||
fun showAdUpgradeStatus(upgradeMode: Int,downloadStatus : Int,currentProgress : Int,totalProgress : Int
|
||||
,downloadVersion : String,upgradeStatus : Int){
|
||||
systemVersionView?.showAdUpgradeStatus(upgradeMode,downloadStatus,currentProgress, totalProgress, downloadVersion, upgradeStatus)
|
||||
fun showAdUpgradeStatus(
|
||||
upgradeMode: Int,
|
||||
downloadStatus: Int,
|
||||
currentProgress: Int,
|
||||
totalProgress: Int,
|
||||
downloadVersion: String,
|
||||
upgradeStatus: Int
|
||||
) {
|
||||
systemVersionView?.showAdUpgradeStatus(
|
||||
upgradeMode,
|
||||
downloadStatus,
|
||||
currentProgress,
|
||||
totalProgress,
|
||||
downloadVersion,
|
||||
upgradeStatus
|
||||
)
|
||||
checkSystemView?.setAdUpgradeStatus(downloadStatus, upgradeStatus)
|
||||
}
|
||||
|
||||
@@ -160,10 +172,6 @@ class AutoPilotAndCheckView @JvmOverloads constructor(
|
||||
connectStatus = autoPilotStatusInfo.connectStatus
|
||||
}
|
||||
|
||||
override fun onAutopilotGuardian(guardianInfo: AutopilotGuardianStatusInfo?) {
|
||||
|
||||
}
|
||||
|
||||
interface ClickListener {
|
||||
fun go2CheckPage()
|
||||
fun onClose(v: View)
|
||||
|
||||
@@ -4,7 +4,6 @@ import android.content.Context
|
||||
import android.widget.TextView
|
||||
import androidx.lifecycle.LifecycleObserver
|
||||
import com.mogo.eagle.core.function.hmi.R
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
|
||||
import com.mogo.module.common.dialog.BaseFloatDialog
|
||||
|
||||
/**
|
||||
@@ -14,10 +13,6 @@ import com.mogo.module.common.dialog.BaseFloatDialog
|
||||
*/
|
||||
class DockerRebootDialog(context: Context): BaseFloatDialog(context), LifecycleObserver {
|
||||
|
||||
companion object {
|
||||
const val TAG = "DockerRebootDialog"
|
||||
}
|
||||
|
||||
private var rebootConfirm : TextView? = null
|
||||
private var rebootCancel : TextView? = null
|
||||
|
||||
@@ -30,12 +25,10 @@ class DockerRebootDialog(context: Context): BaseFloatDialog(context), LifecycleO
|
||||
rebootCancel=findViewById(R.id.tv_reboot_cancel)
|
||||
|
||||
rebootConfirm?.setOnClickListener{
|
||||
Logger.i(TAG,"rebootConfirm click")
|
||||
clickListener?.confirm()
|
||||
dismiss()
|
||||
}
|
||||
rebootCancel?.setOnClickListener {
|
||||
Logger.i(TAG,"rebootCancel click")
|
||||
clickListener?.cancel()
|
||||
dismiss()
|
||||
}
|
||||
|
||||
@@ -3,9 +3,7 @@ package com.mogo.eagle.core.function.hmi.ui.turnlight
|
||||
import android.animation.AnimatorSet
|
||||
import android.animation.ObjectAnimator
|
||||
import android.content.Context
|
||||
import android.os.Looper
|
||||
import android.util.AttributeSet
|
||||
import android.util.Log
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.animation.AlphaAnimation
|
||||
|
||||
@@ -2,17 +2,14 @@ package com.mogo.eagle.core.function.hmi.ui.turnlight
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.util.Log
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.animation.AlphaAnimation
|
||||
import android.view.animation.Animation
|
||||
import android.view.animation.LinearInterpolator
|
||||
import android.widget.FrameLayout
|
||||
import android.widget.ImageView
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import com.mogo.eagle.core.function.hmi.R
|
||||
import kotlinx.android.synthetic.main.view_brake_light_status.view.*
|
||||
import kotlinx.android.synthetic.main.view_turn_light_status.view.*
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.GlobalScope
|
||||
|
||||
@@ -6,14 +6,14 @@ import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotGuardianStatusInfo
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiListenerManager
|
||||
import com.mogo.eagle.core.function.hmi.R
|
||||
import com.mogo.eagle.core.utilcode.util.LogUtils
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_HMI
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
|
||||
import com.mogo.module.common.MogoApisHandler
|
||||
@@ -51,14 +51,14 @@ class AutoPilotStatusView @JvmOverloads constructor(
|
||||
// 自动驾驶状态监听
|
||||
CallerAutoPilotStatusListenerManager.addListener(TAG, this)
|
||||
|
||||
LogUtils.dTag(TAG, "autopilotStatus: $mAutopilotStatus")
|
||||
CallerLogger.d("$M_HMI$TAG", "autopilotStatus: $mAutopilotStatus")
|
||||
setAutoPilotStatus(mAutopilotStatus)
|
||||
}
|
||||
|
||||
override fun onClick(v: View?) {
|
||||
when (mAutopilotStatus) {
|
||||
0 -> {// 不可自动驾驶,adas与工控机没有链接,或工控机异常
|
||||
LogUtils.eTag(TAG, "不可自动驾驶,adas与工控机没有链接,或工控机异常,请检查")
|
||||
CallerLogger.e("$M_HMI$TAG", "不可自动驾驶,adas与工控机没有链接,或工控机异常,请检查")
|
||||
ToastUtils.showShort("不可自动驾驶,adas与工控机没有链接,或工控机异常,请检查")
|
||||
// TODO 这里临时触发自动驾驶能力,测试功过这里删除
|
||||
//CallerHmiListenerManager.invokeCheckAutoPilotBtnListener(true)
|
||||
@@ -128,9 +128,4 @@ class AutoPilotStatusView @JvmOverloads constructor(
|
||||
setAutoPilotStatus(autoPilotStatusInfo.state)
|
||||
}
|
||||
|
||||
override fun onAutopilotGuardian(guardianInfo: AutopilotGuardianStatusInfo?) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -8,7 +8,6 @@ import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import com.mogo.eagle.core.function.api.check.IMogoCheckListener
|
||||
import com.mogo.eagle.core.function.call.check.CallerCheckManager
|
||||
import com.mogo.eagle.core.function.hmi.R
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
|
||||
import kotlinx.android.synthetic.main.view_check_status.view.*
|
||||
|
||||
/**
|
||||
@@ -35,7 +34,6 @@ class CheckStatusView @JvmOverloads constructor(
|
||||
}
|
||||
|
||||
override fun updateMonitoringStatus(state: Int?) {
|
||||
Logger.d(TAG, "updateCheckStatus")
|
||||
if (state == 1) {
|
||||
dismissErrorIcon()
|
||||
} else {
|
||||
@@ -46,14 +44,12 @@ class CheckStatusView @JvmOverloads constructor(
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
Logger.d(TAG, "onAttachedToWindow")
|
||||
//车辆监控
|
||||
CallerCheckManager.registerVehicleMonitoringListener(TAG, this)
|
||||
}
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow()
|
||||
Logger.d(TAG, "onDetachedFromWindow")
|
||||
//车辆监控
|
||||
CallerCheckManager.unregisterListener(TAG)
|
||||
}
|
||||
|
||||
@@ -8,13 +8,14 @@ import android.view.View
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import com.mogo.eagle.core.data.autopilot.AdUpgradeStateHelper
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_HMI
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.function.hmi.R
|
||||
import com.mogo.eagle.core.function.hmi.notification.WarningFloat
|
||||
import com.mogo.eagle.core.function.hmi.ui.tools.DockerRebootDialog
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||
import kotlinx.android.synthetic.main.view_check_system.view.*
|
||||
|
||||
@@ -29,11 +30,11 @@ class CheckSystemView @JvmOverloads constructor(
|
||||
}
|
||||
|
||||
private var connectStatus = false //是否连接工控机
|
||||
private var autopilotStatus:Int ?=null //自动驾驶状态 0代表不可自动驾驶,1代表可自动驾驶,2代表自动驾驶中
|
||||
private var autopilotStatus: Int? = null //自动驾驶状态 0代表不可自动驾驶,1代表可自动驾驶,2代表自动驾驶中
|
||||
private var dockerRebootDialog: DockerRebootDialog? = null
|
||||
|
||||
private var downloadStatus: Int=-1 //下载状态
|
||||
private var upgradeStatus: Int=-1 //升级状态
|
||||
private var downloadStatus: Int = -1 //下载状态
|
||||
private var upgradeStatus: Int = -1 //升级状态
|
||||
|
||||
init {
|
||||
LayoutInflater.from(context).inflate(R.layout.view_check_system, this, true)
|
||||
@@ -47,26 +48,30 @@ class CheckSystemView @JvmOverloads constructor(
|
||||
}
|
||||
viewCheckReboot.setOnClickListener {
|
||||
//dialog
|
||||
if(dockerRebootDialog == null){
|
||||
if (dockerRebootDialog == null) {
|
||||
dockerRebootDialog = DockerRebootDialog(context)
|
||||
dockerRebootDialog?.setClickListener(object : DockerRebootDialog.ClickListener{
|
||||
dockerRebootDialog?.setClickListener(object : DockerRebootDialog.ClickListener {
|
||||
override fun confirm() {
|
||||
if(autopilotStatus==2){
|
||||
if (autopilotStatus == 2) {
|
||||
//当前处于自动驾驶状态,不可进行重启,Toast提示
|
||||
ToastUtils.showShort("请先退出自动驾驶状态")
|
||||
}else if(AdUpgradeStateHelper.showCannotReboot(downloadStatus, upgradeStatus)){
|
||||
} else if (AdUpgradeStateHelper.showCannotReboot(
|
||||
downloadStatus,
|
||||
upgradeStatus
|
||||
)
|
||||
) {
|
||||
//当工控机处于下载或者升级状态,需要先进行升级
|
||||
ToastUtils.showShort("请先完成新自动驾驶系统的下载/升级")
|
||||
} else{
|
||||
} else {
|
||||
//确认重启
|
||||
Logger.i(TAG,"reboot confirm")
|
||||
CallerLogger.d("$M_HMI$TAG", "reboot confirm")
|
||||
CallerAutoPilotManager.setIPCReboot()
|
||||
}
|
||||
}
|
||||
|
||||
override fun cancel() {
|
||||
//取消重启
|
||||
Logger.i(TAG,"reboot cancel")
|
||||
CallerLogger.d("$M_HMI$TAG", "reboot cancel")
|
||||
}
|
||||
|
||||
})
|
||||
@@ -75,9 +80,9 @@ class CheckSystemView @JvmOverloads constructor(
|
||||
}
|
||||
}
|
||||
|
||||
fun setAdUpgradeStatus(downloadStatus : Int,upgradeStatus : Int){
|
||||
this.downloadStatus=downloadStatus
|
||||
this.upgradeStatus=upgradeStatus
|
||||
fun setAdUpgradeStatus(downloadStatus: Int, upgradeStatus: Int) {
|
||||
this.downloadStatus = downloadStatus
|
||||
this.upgradeStatus = upgradeStatus
|
||||
}
|
||||
|
||||
private fun showSystemOperationWindow(view: View) {
|
||||
|
||||
@@ -10,7 +10,6 @@ import com.alibaba.android.arouter.launcher.ARouter
|
||||
import com.mogo.eagle.core.data.constants.MogoServicePaths
|
||||
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
|
||||
@@ -37,6 +36,7 @@ class SpeedPanelView @JvmOverloads constructor(
|
||||
var mLatLng: Location? = null
|
||||
|
||||
var mSpeedLimmit = 60;
|
||||
|
||||
init {
|
||||
initEvent(context)
|
||||
|
||||
@@ -55,7 +55,6 @@ class SpeedPanelView @JvmOverloads constructor(
|
||||
|
||||
private fun initEvent(context: Context) {
|
||||
setOnLongClickListener {
|
||||
Logger.d(TAG, "长按显示状态工具栏")
|
||||
CallerHmiManager.toggleDebugView()
|
||||
false
|
||||
}
|
||||
@@ -65,7 +64,11 @@ class SpeedPanelView @JvmOverloads constructor(
|
||||
override fun run() {
|
||||
if (mLatLng != null) {
|
||||
if (mMogoServiceApis.mapServiceApi != null && mMogoServiceApis.mapServiceApi.mapUIController != null) {
|
||||
mSpeedLimmit = mMogoServiceApis.mapServiceApi.mapUIController.getSpeedLimmit(mLatLng!!.longitude, mLatLng!!.latitude, mLatLng!!.bearing)
|
||||
mSpeedLimmit = mMogoServiceApis.mapServiceApi.mapUIController.getSpeedLimmit(
|
||||
mLatLng!!.longitude,
|
||||
mLatLng!!.latitude,
|
||||
mLatLng!!.bearing
|
||||
)
|
||||
UiThreadHandler.post {
|
||||
val speed = (mLatLng!!.speed * 3.6f).toInt()
|
||||
mSpeedChartView.setArcColor(Color.parseColor(if (speed > mSpeedLimmit) "#DB3137" else "#3E77F6"))
|
||||
|
||||
@@ -7,12 +7,13 @@ import android.view.View
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import com.mogo.eagle.core.data.autopilot.AdUpgradeStateHelper
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_HMI
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.function.hmi.R
|
||||
import com.mogo.eagle.core.function.hmi.ui.tools.AdUpgradeDialog
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
|
||||
import com.mogo.eagle.core.utilcode.util.AppUtils
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
|
||||
@@ -37,58 +38,70 @@ class SystemVersionView @JvmOverloads constructor(
|
||||
}
|
||||
|
||||
private var connectStatus = false
|
||||
private var dockerVersion :String ?=null //工控机版本
|
||||
private var autopilotStatus:Int ?=null //自动驾驶状态 0代表不可自动驾驶,1代表可自动驾驶,2代表自动驾驶中
|
||||
private var adUpgradeDialog : AdUpgradeDialog? = null
|
||||
private var dockerVersion: String? = null //工控机版本
|
||||
private var autopilotStatus: Int? = null //自动驾驶状态 0代表不可自动驾驶,1代表可自动驾驶,2代表自动驾驶中
|
||||
private var adUpgradeDialog: AdUpgradeDialog? = null
|
||||
|
||||
private var upgradeMode: Int=-1 //升级模式
|
||||
private var downloadStatus: Int=-1 //下载状态
|
||||
private var currentProgress: Int=-1 //当前已下载包体大小
|
||||
private var previousProgress: Int=-1 //前一秒的下载进度,用于计算下载剩余时间
|
||||
private var totalProgress: Int=-1 //包体总大小
|
||||
private var downloadVersion: String?=null //工控机docker版本
|
||||
private var upgradeStatus: Int=-1 //升级状态
|
||||
private var upgradeMode: Int = -1 //升级模式
|
||||
private var downloadStatus: Int = -1 //下载状态
|
||||
private var currentProgress: Int = -1 //当前已下载包体大小
|
||||
private var previousProgress: Int = -1 //前一秒的下载进度,用于计算下载剩余时间
|
||||
private var totalProgress: Int = -1 //包体总大小
|
||||
private var downloadVersion: String? = null //工控机docker版本
|
||||
private var upgradeStatus: Int = -1 //升级状态
|
||||
|
||||
init {
|
||||
LayoutInflater.from(context).inflate(R.layout.view_system_version, this, true)
|
||||
initView()
|
||||
}
|
||||
|
||||
private fun initView(){
|
||||
private fun initView() {
|
||||
showCurrentPadVersion()
|
||||
showCurrentAdVersion()
|
||||
|
||||
|
||||
|
||||
//鹰眼版本视图点击事件
|
||||
ivPadVersion.setOnClickListener {
|
||||
Logger.i(TAG,"pad version view clicked")
|
||||
}
|
||||
CallerLogger.i("$M_HMI$$TAG", "pad version view clicked")
|
||||
}
|
||||
//工控机版本视图点击事件
|
||||
ivAdVersion.setOnClickListener {
|
||||
Logger.i(TAG,"ad version view clicked")
|
||||
Logger.i(TAG,"upgradeMode="+upgradeMode+" downloadStatus="+downloadStatus+" upgradeStatus="+upgradeStatus)
|
||||
if(AdUpgradeStateHelper.isDownloading(downloadStatus)){
|
||||
CallerLogger.i("$M_HMI$$TAG", "ad version view clicked")
|
||||
CallerLogger.i(
|
||||
"$M_HMI$$TAG",
|
||||
"upgradeMode=$upgradeMode , downloadStatus=$downloadStatus , upgradeStatus=$upgradeStatus"
|
||||
)
|
||||
if (AdUpgradeStateHelper.isDownloading(downloadStatus)) {
|
||||
//点击Toast提示:下载剩余时间
|
||||
ToastUtils.showShort("预计"+AdUpgradeStateHelper.getRemainingTime(totalProgress,previousProgress,currentProgress)+"下载完成")
|
||||
}else if(AdUpgradeStateHelper.getUpgradeStatus()){
|
||||
ToastUtils.showShort(
|
||||
"预计" + AdUpgradeStateHelper.getRemainingTime(
|
||||
totalProgress,
|
||||
previousProgress,
|
||||
currentProgress
|
||||
) + "下载完成"
|
||||
)
|
||||
} else if (AdUpgradeStateHelper.getUpgradeStatus()) {
|
||||
//工控机状态为“升级中”
|
||||
ToastUtils.showShort("新版本升级中,预计5分钟升级完成")
|
||||
}else if(AdUpgradeStateHelper.isUpgradeFailed(upgradeStatus)){
|
||||
} else if (AdUpgradeStateHelper.isUpgradeFailed(upgradeStatus)) {
|
||||
//如果升级失败,则Toast提示:升级失败,请联系运维人员
|
||||
ToastUtils.showShort("升级失败,请联系运维人员")
|
||||
}else if(AdUpgradeStateHelper.isHintUpgradeMode(upgradeMode) && AdUpgradeStateHelper.isDownloadFinish(downloadStatus,upgradeStatus)){
|
||||
} else if (AdUpgradeStateHelper.isHintUpgradeMode(upgradeMode) && AdUpgradeStateHelper.isDownloadFinish(
|
||||
downloadStatus,
|
||||
upgradeStatus
|
||||
)
|
||||
) {
|
||||
//如果升级模式为“提示升级”,并且下载状态为已经下载完成,点击弹出升级确认弹窗
|
||||
if(adUpgradeDialog == null){
|
||||
if (adUpgradeDialog == null) {
|
||||
adUpgradeDialog = AdUpgradeDialog(context)
|
||||
adUpgradeDialog?.setClickListener(object : AdUpgradeDialog.ClickListener{
|
||||
adUpgradeDialog?.setClickListener(object : AdUpgradeDialog.ClickListener {
|
||||
override fun confirm() {
|
||||
if(autopilotStatus==2){
|
||||
if (autopilotStatus == 2) {
|
||||
//当前处于自动驾驶状态,不可进行升级,Toast提示
|
||||
ToastUtils.showShort("升级前请先退出自动驾驶模式")
|
||||
}else{
|
||||
} else {
|
||||
//确认升级
|
||||
Logger.i(TAG,"upgrade confirm")
|
||||
CallerLogger.i("$M_HMI$$TAG", "upgrade confirm")
|
||||
//设置当前状态为“升级中”
|
||||
AdUpgradeStateHelper.setUpgradeStatus(true)
|
||||
CallerAutoPilotManager.setIPCUpgradeAffirm()
|
||||
@@ -101,7 +114,7 @@ class SystemVersionView @JvmOverloads constructor(
|
||||
|
||||
override fun cancel() {
|
||||
//取消升级
|
||||
Logger.i(TAG,"upgrade cancel")
|
||||
CallerLogger.i("$M_HMI$$TAG", "upgrade cancel")
|
||||
//取消升级命令不下发
|
||||
// CallerAutoPilotManager.setIPCUpgradeCancel()
|
||||
}
|
||||
@@ -124,15 +137,17 @@ class SystemVersionView @JvmOverloads constructor(
|
||||
* @param downloadVersion 下载版本
|
||||
* @param upgradeStatus 升级状态
|
||||
*/
|
||||
fun setAdUpgradeInfo(upgradeMode: Int,downloadStatus: Int,currentProgress: Int,totalProgress: Int,
|
||||
downloadVersion: String,upgradeStatus: Int){
|
||||
this.upgradeMode=upgradeMode
|
||||
this.downloadStatus=downloadStatus
|
||||
this.previousProgress=this.currentProgress
|
||||
this.currentProgress=currentProgress
|
||||
this.totalProgress=totalProgress
|
||||
this.downloadVersion=downloadVersion
|
||||
this.upgradeStatus=upgradeStatus
|
||||
fun setAdUpgradeInfo(
|
||||
upgradeMode: Int, downloadStatus: Int, currentProgress: Int, totalProgress: Int,
|
||||
downloadVersion: String, upgradeStatus: Int
|
||||
) {
|
||||
this.upgradeMode = upgradeMode
|
||||
this.downloadStatus = downloadStatus
|
||||
this.previousProgress = this.currentProgress
|
||||
this.currentProgress = currentProgress
|
||||
this.totalProgress = totalProgress
|
||||
this.downloadVersion = downloadVersion
|
||||
this.upgradeStatus = upgradeStatus
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -144,53 +159,77 @@ class SystemVersionView @JvmOverloads constructor(
|
||||
* @param downloadVersion 下载版本
|
||||
* @param upgradeStatus 升级状态
|
||||
*/
|
||||
fun showAdUpgradeStatus(upgradeMode: Int,downloadStatus: Int,currentProgress: Int,totalProgress: Int
|
||||
,downloadVersion: String,upgradeStatus: Int){
|
||||
fun showAdUpgradeStatus(
|
||||
upgradeMode: Int,
|
||||
downloadStatus: Int,
|
||||
currentProgress: Int,
|
||||
totalProgress: Int,
|
||||
downloadVersion: String,
|
||||
upgradeStatus: Int
|
||||
) {
|
||||
|
||||
GlobalScope.launch(Dispatchers.Main){
|
||||
GlobalScope.launch(Dispatchers.Main) {
|
||||
//设置工控机下载、升级状态信息
|
||||
setAdUpgradeInfo(upgradeMode, downloadStatus, currentProgress, totalProgress, downloadVersion, upgradeStatus)
|
||||
setAdUpgradeInfo(
|
||||
upgradeMode,
|
||||
downloadStatus,
|
||||
currentProgress,
|
||||
totalProgress,
|
||||
downloadVersion,
|
||||
upgradeStatus
|
||||
)
|
||||
|
||||
if(AdUpgradeStateHelper.isDownloading(downloadStatus)){
|
||||
if (AdUpgradeStateHelper.isDownloading(downloadStatus)) {
|
||||
//正在下载,展示“下载中”角标,展示进度条,并设置当前下载进度
|
||||
ivAdStatus?.setImageResource(R.drawable.icon_downloading)
|
||||
adCircularProgressView?.let {
|
||||
it.visibility = View.VISIBLE
|
||||
Logger.i(TAG,"下载中="+"currentProgress="+currentProgress+" totalProgress="+totalProgress+" downloadProgress="+AdUpgradeStateHelper.downloadProgress(currentProgress,totalProgress))
|
||||
CallerLogger.i(
|
||||
"$M_HMI$$TAG",
|
||||
"下载中=currentProgress=$currentProgress , totalProgress=$totalProgress , downloadProgress=" + AdUpgradeStateHelper.downloadProgress(
|
||||
currentProgress,
|
||||
totalProgress
|
||||
)
|
||||
)
|
||||
|
||||
it.setProgress(AdUpgradeStateHelper.downloadProgress(currentProgress,totalProgress))
|
||||
it.setProgress(
|
||||
AdUpgradeStateHelper.downloadProgress(
|
||||
currentProgress,
|
||||
totalProgress
|
||||
)
|
||||
)
|
||||
}
|
||||
}else if(AdUpgradeStateHelper.isDownloadFinish(downloadStatus,upgradeStatus)){
|
||||
} else if (AdUpgradeStateHelper.isDownloadFinish(downloadStatus, upgradeStatus)) {
|
||||
//下载完成,处于可升级状态,展示“可升级”角标,将AD背景变为蓝色,并隐藏下载进度条(当状态为“升级中”时,不进行设置(存在升级命令已下发,但工控机未立即升级现象))
|
||||
if(!AdUpgradeStateHelper.getUpgradeStatus()){
|
||||
if (!AdUpgradeStateHelper.getUpgradeStatus()) {
|
||||
ivAdStatus?.setImageResource(R.drawable.icon_upgradeable)
|
||||
ivAdVersion?.setBackgroundResource(R.drawable.version_upgradeable_background)
|
||||
adCircularProgressView?.visibility = View.GONE
|
||||
if(AdUpgradeStateHelper.isQuietUpgradeMode(upgradeMode)){
|
||||
if (AdUpgradeStateHelper.isQuietUpgradeMode(upgradeMode)) {
|
||||
//如果升级模式为“静默升级”,则下载完成后,调用升级命令进行升级
|
||||
CallerAutoPilotManager.setIPCUpgradeAffirm()
|
||||
AdUpgradeStateHelper.setUpgradeStatus(true)
|
||||
}
|
||||
}
|
||||
|
||||
}else if(AdUpgradeStateHelper.isDownloadFailed(downloadStatus)){
|
||||
} else if (AdUpgradeStateHelper.isDownloadFailed(downloadStatus)) {
|
||||
//下载失败,将状态设为“最新版”角标,并隐藏进度条
|
||||
ivAdStatus?.setImageResource(R.drawable.icon_latest_version)
|
||||
adCircularProgressView?.visibility = View.GONE
|
||||
ivAdVersion?.setBackgroundResource(R.drawable.version_latest_background)
|
||||
} else if(AdUpgradeStateHelper.isUpgradeSuccess(upgradeStatus)){
|
||||
} else if (AdUpgradeStateHelper.isUpgradeSuccess(upgradeStatus)) {
|
||||
//升级成功,将状态设为“最新版”角标,并隐藏进度条
|
||||
ivAdStatus?.setImageResource(R.drawable.icon_latest_version)
|
||||
adCircularProgressView?.visibility = View.GONE
|
||||
AdUpgradeStateHelper.setUpgradeStatus(false)
|
||||
ivAdVersion?.setBackgroundResource(R.drawable.version_latest_background)
|
||||
}else if(AdUpgradeStateHelper.isUpgradeFailed(upgradeStatus)){
|
||||
} else if (AdUpgradeStateHelper.isUpgradeFailed(upgradeStatus)) {
|
||||
//升级失败,将状态设为“升级失败”角标,并隐藏进度条
|
||||
ivAdStatus?.setImageResource(R.drawable.icon_upgrade_failed)
|
||||
adCircularProgressView?.visibility = View.GONE
|
||||
AdUpgradeStateHelper.setUpgradeStatus(false)
|
||||
ivAdVersion?.setBackgroundResource(R.drawable.version_latest_background)
|
||||
}else{
|
||||
} else {
|
||||
//其他状态,均显示“最新版”,并隐藏进度条
|
||||
ivAdStatus?.setImageResource(R.drawable.icon_latest_version)
|
||||
adCircularProgressView?.visibility = View.GONE
|
||||
@@ -205,7 +244,7 @@ class SystemVersionView @JvmOverloads constructor(
|
||||
/**
|
||||
* 展示当前鹰眼版本
|
||||
*/
|
||||
private fun showCurrentPadVersion(){
|
||||
private fun showCurrentPadVersion() {
|
||||
tvPadVersionContent?.let {
|
||||
it.text = AppUtils.getAppVersionName()
|
||||
}
|
||||
@@ -214,11 +253,11 @@ class SystemVersionView @JvmOverloads constructor(
|
||||
/**
|
||||
* 展示当前工控机版本
|
||||
*/
|
||||
private fun showCurrentAdVersion(){
|
||||
private fun showCurrentAdVersion() {
|
||||
UiThreadHandler.post {
|
||||
tvAdVersionContent?.let {
|
||||
// it.text = AdasManager.getInstance().getAdasConfig().getDockVersion())
|
||||
if(!dockerVersion.isNullOrEmpty()){
|
||||
if (!dockerVersion.isNullOrEmpty()) {
|
||||
it.text = dockerVersion
|
||||
}
|
||||
}
|
||||
@@ -239,11 +278,14 @@ class SystemVersionView @JvmOverloads constructor(
|
||||
connectStatus = autoPilotStatusInfo.connectStatus
|
||||
dockerVersion = autoPilotStatusInfo.dockVersion
|
||||
autopilotStatus = autoPilotStatusInfo.state
|
||||
Logger.i(TAG,"onAutopilotStatusResponse connectStatus="+connectStatus+" dockerVersion="+dockerVersion+" autopilotStatus="+autopilotStatus)
|
||||
CallerLogger.i(
|
||||
"$M_HMI$TAG",
|
||||
"onAutopilotStatusResponse connectStatus=$connectStatus , dockerVersion=$dockerVersion , autopilotStatus=$autopilotStatus"
|
||||
)
|
||||
setViewStatus()
|
||||
}
|
||||
|
||||
private fun setViewStatus(){
|
||||
private fun setViewStatus() {
|
||||
showCurrentAdVersion()
|
||||
}
|
||||
|
||||
|
||||
@@ -2,23 +2,14 @@ package com.mogo.eagle.core.function.hmi.ui.widget
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.util.Log
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.widget.RelativeLayout
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_HMI
|
||||
import com.mogo.eagle.core.data.enums.WarningDirectionEnum
|
||||
import com.mogo.eagle.core.data.enums.WarningDirectionEnum.ALERT_WARNING_ALL
|
||||
import com.mogo.eagle.core.data.enums.WarningDirectionEnum.ALERT_WARNING_BOTTOM
|
||||
import com.mogo.eagle.core.data.enums.WarningDirectionEnum.ALERT_WARNING_BOTTOM_LEFT
|
||||
import com.mogo.eagle.core.data.enums.WarningDirectionEnum.ALERT_WARNING_BOTTOM_RIGHT
|
||||
import com.mogo.eagle.core.data.enums.WarningDirectionEnum.ALERT_WARNING_LEFT
|
||||
import com.mogo.eagle.core.data.enums.WarningDirectionEnum.ALERT_WARNING_NON
|
||||
import com.mogo.eagle.core.data.enums.WarningDirectionEnum.ALERT_WARNING_RIGHT
|
||||
import com.mogo.eagle.core.data.enums.WarningDirectionEnum.ALERT_WARNING_TOP
|
||||
import com.mogo.eagle.core.data.enums.WarningDirectionEnum.ALERT_WARNING_TOP_LEFT
|
||||
import com.mogo.eagle.core.data.enums.WarningDirectionEnum.ALERT_WARNING_TOP_RIGHT
|
||||
import com.mogo.eagle.core.data.enums.WarningDirectionEnum.*
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
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 kotlinx.android.synthetic.main.module_hmi_warning_v2x.view.*
|
||||
|
||||
@@ -32,10 +23,12 @@ class V2XWarningView @JvmOverloads constructor(
|
||||
defStyleAttr: Int = 0
|
||||
) : RelativeLayout(context, attrs, defStyleAttr) {
|
||||
|
||||
private val ALL_CLOSE_TIMER = 10000L
|
||||
companion object {
|
||||
private const val ALL_CLOSE_TIMER = 10000L
|
||||
private const val TAG = "V2XWarningView"
|
||||
}
|
||||
|
||||
private val closeWarningTask: Runnable = Runnable {
|
||||
Logger.d("V2XWarningView", "预警红边:倒计时结束")
|
||||
showWarning(ALERT_WARNING_NON)
|
||||
}
|
||||
|
||||
@@ -59,7 +52,7 @@ class V2XWarningView @JvmOverloads constructor(
|
||||
* @param closeTime 倒计时
|
||||
*/
|
||||
fun showWarning(direction: WarningDirectionEnum, closeTime: Long) {
|
||||
Logger.d("V2XWarningView", "预警红边:预警方向->$direction 预警倒计时->$closeTime")
|
||||
CallerLogger.d("$M_HMI$TAG", "预警红边:预警方向->$direction 预警倒计时->$closeTime")
|
||||
UiThreadHandler.post {
|
||||
|
||||
// 如果传入的不是关闭显示,则设置倒计时,定时关闭红框警示
|
||||
@@ -174,7 +167,7 @@ class V2XWarningView @JvmOverloads constructor(
|
||||
hmiWarningLeftImg.visibility = View.GONE
|
||||
}
|
||||
else -> {
|
||||
Log.d("XXX", "Not Support Direction")
|
||||
CallerLogger.d("$M_HMI$TAG", "Not Support Direction")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
package com.mogo.eagle.core.function.main;
|
||||
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_MAIN;
|
||||
|
||||
import android.location.Location;
|
||||
import android.view.MotionEvent;
|
||||
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.eagle.core.function.main.registercenter.MogoRegisterCenterHandler;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.map.listener.IMogoMapListener;
|
||||
import com.mogo.map.location.IMogoLocationListener;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
@@ -17,7 +20,6 @@ import com.mogo.map.navi.IMogoNaviListener;
|
||||
import com.mogo.map.navi.MogoNaviInfo;
|
||||
import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.map.uicontroller.VisualAngleMode;
|
||||
import com.mogo.eagle.core.function.main.registercenter.MogoRegisterCenterHandler;
|
||||
import com.mogo.service.adas.IMogoADASControlStatusChangedListener;
|
||||
import com.zhidao.adasconfig.common.config.EnumCarChatIncognitoMode;
|
||||
import com.zhidao.adasconfig.listener.IAdasSettingUIListener;
|
||||
@@ -49,9 +51,9 @@ public class EventDispatchCenter implements
|
||||
}
|
||||
|
||||
public static EventDispatchCenter getInstance() {
|
||||
if ( sInstance == null ) {
|
||||
synchronized ( EventDispatchCenter.class ) {
|
||||
if ( sInstance == null ) {
|
||||
if (sInstance == null) {
|
||||
synchronized (EventDispatchCenter.class) {
|
||||
if (sInstance == null) {
|
||||
sInstance = new EventDispatchCenter();
|
||||
}
|
||||
}
|
||||
@@ -62,13 +64,13 @@ public class EventDispatchCenter implements
|
||||
private static final String TAG = "DispatchCenter";
|
||||
|
||||
@Override
|
||||
public boolean onMarkerClicked( IMogoMarker marker ) {
|
||||
IMogoMarkerClickListener listener = MogoRegisterCenterHandler.getInstance().getMarkerListener( marker.getOwner() );
|
||||
if ( listener != null ) {
|
||||
public boolean onMarkerClicked(IMogoMarker marker) {
|
||||
IMogoMarkerClickListener listener = MogoRegisterCenterHandler.getInstance().getMarkerListener(marker.getOwner());
|
||||
if (listener != null) {
|
||||
try {
|
||||
return listener.onMarkerClicked( marker );
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "error." );
|
||||
return listener.onMarkerClicked(marker);
|
||||
} catch (Exception e) {
|
||||
CallerLogger.INSTANCE.e(M_MAIN +TAG, "onMarkerClicked error : " + e);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
@@ -76,34 +78,34 @@ public class EventDispatchCenter implements
|
||||
|
||||
@Override
|
||||
public boolean onStaticMarkerClicked(IMogoMarker marker) {
|
||||
ArrayList<IMogoMarkerClickListener> list = MogoRegisterCenterHandler.getInstance().getStaticMarkerListener( marker.getOwner() );
|
||||
if(list == null){
|
||||
ArrayList<IMogoMarkerClickListener> list = MogoRegisterCenterHandler.getInstance().getStaticMarkerListener(marker.getOwner());
|
||||
if (list == null) {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
for (IMogoMarkerClickListener listener : list) {
|
||||
return listener.onStaticMarkerClicked( marker );
|
||||
return listener.onStaticMarkerClicked(marker);
|
||||
}
|
||||
} catch ( Exception e){
|
||||
Logger.e( TAG, e, "error." );
|
||||
} catch (Exception e) {
|
||||
CallerLogger.INSTANCE.e(M_MAIN +TAG, "onStaticMarkerClicked error : " + e);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCarLocationChanged2( Location latLng ) {
|
||||
public void onCarLocationChanged2(Location latLng) {
|
||||
|
||||
Iterator< IMogoCarLocationChangedListener > iterator = MogoRegisterCenterHandler.getInstance().getCarLocationChangedListener();
|
||||
if ( iterator == null ) {
|
||||
Iterator<IMogoCarLocationChangedListener> iterator = MogoRegisterCenterHandler.getInstance().getCarLocationChangedListener();
|
||||
if (iterator == null) {
|
||||
return;
|
||||
}
|
||||
MogoLatLng target = null;
|
||||
while ( iterator.hasNext() ) {
|
||||
while (iterator.hasNext()) {
|
||||
IMogoCarLocationChangedListener listener = iterator.next();
|
||||
if ( listener instanceof IMogoCarLocationChangedListener2 ) {
|
||||
if (listener instanceof IMogoCarLocationChangedListener2) {
|
||||
try {
|
||||
( ( IMogoCarLocationChangedListener2 ) listener ).onCarLocationChanged2( latLng );
|
||||
} catch ( Exception e ) {
|
||||
((IMogoCarLocationChangedListener2) listener).onCarLocationChanged2(latLng);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
@@ -115,118 +117,118 @@ public class EventDispatchCenter implements
|
||||
*
|
||||
* @param callback
|
||||
*/
|
||||
void setMapLoadedCallback( Runnable callback ) {
|
||||
void setMapLoadedCallback(Runnable callback) {
|
||||
this.mMapLoadedCallback = callback;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMapLoaded() {
|
||||
if ( mMapLoadedCallback != null ) {
|
||||
if (mMapLoadedCallback != null) {
|
||||
mMapLoadedCallback.run();
|
||||
mMapLoadedCallback = null;
|
||||
}
|
||||
|
||||
Iterator< IMogoMapListener > iterator = MogoRegisterCenterHandler.getInstance().getMapListeners();
|
||||
if ( iterator == null ) {
|
||||
Iterator<IMogoMapListener> iterator = MogoRegisterCenterHandler.getInstance().getMapListeners();
|
||||
if (iterator == null) {
|
||||
return;
|
||||
}
|
||||
while ( iterator.hasNext() ) {
|
||||
while (iterator.hasNext()) {
|
||||
IMogoMapListener listener = iterator.next();
|
||||
if ( listener != null ) {
|
||||
if (listener != null) {
|
||||
try {
|
||||
listener.onMapLoaded();
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "error." );
|
||||
} catch (Exception e) {
|
||||
CallerLogger.INSTANCE.e(M_MAIN +TAG, "onMapLoaded error : " + e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTouch( MotionEvent motionEvent ) {
|
||||
Iterator< IMogoMapListener > iterator = MogoRegisterCenterHandler.getInstance().getMapListeners();
|
||||
if ( iterator == null ) {
|
||||
public void onTouch(MotionEvent motionEvent) {
|
||||
Iterator<IMogoMapListener> iterator = MogoRegisterCenterHandler.getInstance().getMapListeners();
|
||||
if (iterator == null) {
|
||||
return;
|
||||
}
|
||||
while ( iterator.hasNext() ) {
|
||||
while (iterator.hasNext()) {
|
||||
IMogoMapListener listener = iterator.next();
|
||||
if ( listener != null ) {
|
||||
if (listener != null) {
|
||||
try {
|
||||
listener.onTouch( motionEvent );
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "error." );
|
||||
listener.onTouch(motionEvent);
|
||||
} catch (Exception e) {
|
||||
CallerLogger.INSTANCE.e(M_MAIN +TAG, "onTouch error : " + e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPOIClick( MogoPoi poi ) {
|
||||
Iterator< IMogoMapListener > iterator = MogoRegisterCenterHandler.getInstance().getMapListeners();
|
||||
if ( iterator == null ) {
|
||||
public void onPOIClick(MogoPoi poi) {
|
||||
Iterator<IMogoMapListener> iterator = MogoRegisterCenterHandler.getInstance().getMapListeners();
|
||||
if (iterator == null) {
|
||||
return;
|
||||
}
|
||||
while ( iterator.hasNext() ) {
|
||||
while (iterator.hasNext()) {
|
||||
IMogoMapListener listener = iterator.next();
|
||||
if ( listener != null ) {
|
||||
if (listener != null) {
|
||||
try {
|
||||
listener.onPOIClick( poi );
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "error." );
|
||||
listener.onPOIClick(poi);
|
||||
} catch (Exception e) {
|
||||
CallerLogger.INSTANCE.e(M_MAIN +TAG, "onPOIClick error : " + e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMapClick( MogoLatLng latLng ) {
|
||||
Iterator< IMogoMapListener > iterator = MogoRegisterCenterHandler.getInstance().getMapListeners();
|
||||
if ( iterator == null ) {
|
||||
public void onMapClick(MogoLatLng latLng) {
|
||||
Iterator<IMogoMapListener> iterator = MogoRegisterCenterHandler.getInstance().getMapListeners();
|
||||
if (iterator == null) {
|
||||
return;
|
||||
}
|
||||
while ( iterator.hasNext() ) {
|
||||
while (iterator.hasNext()) {
|
||||
IMogoMapListener listener = iterator.next();
|
||||
if ( listener != null ) {
|
||||
if (listener != null) {
|
||||
try {
|
||||
listener.onMapClick( latLng );
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "error." );
|
||||
listener.onMapClick(latLng);
|
||||
} catch (Exception e) {
|
||||
CallerLogger.INSTANCE.e(M_MAIN +TAG, "onMapClick error : " + e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLockMap( boolean isLock ) {
|
||||
Iterator< IMogoMapListener > iterator = MogoRegisterCenterHandler.getInstance().getMapListeners();
|
||||
if ( iterator == null ) {
|
||||
public void onLockMap(boolean isLock) {
|
||||
Iterator<IMogoMapListener> iterator = MogoRegisterCenterHandler.getInstance().getMapListeners();
|
||||
if (iterator == null) {
|
||||
return;
|
||||
}
|
||||
while ( iterator.hasNext() ) {
|
||||
while (iterator.hasNext()) {
|
||||
IMogoMapListener listener = iterator.next();
|
||||
if ( listener != null ) {
|
||||
if (listener != null) {
|
||||
try {
|
||||
listener.onLockMap( isLock );
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "error." );
|
||||
listener.onLockMap(isLock);
|
||||
} catch (Exception e) {
|
||||
CallerLogger.INSTANCE.e(M_MAIN +TAG, "onLockMap error : " + e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMapModeChanged( EnumMapUI ui ) {
|
||||
Iterator< IMogoMapListener > iterator = MogoRegisterCenterHandler.getInstance().getMapListeners();
|
||||
if ( iterator == null ) {
|
||||
public void onMapModeChanged(EnumMapUI ui) {
|
||||
Iterator<IMogoMapListener> iterator = MogoRegisterCenterHandler.getInstance().getMapListeners();
|
||||
if (iterator == null) {
|
||||
return;
|
||||
}
|
||||
while ( iterator.hasNext() ) {
|
||||
while (iterator.hasNext()) {
|
||||
IMogoMapListener listener = iterator.next();
|
||||
if ( listener != null ) {
|
||||
if (listener != null) {
|
||||
try {
|
||||
listener.onMapModeChanged( ui );
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "error." );
|
||||
listener.onMapModeChanged(ui);
|
||||
} catch (Exception e) {
|
||||
CallerLogger.INSTANCE.e(M_MAIN +TAG, "onMapModeChanged error :" + e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -234,56 +236,56 @@ public class EventDispatchCenter implements
|
||||
|
||||
@Override
|
||||
public void onMapVisualAngleChanged(VisualAngleMode visualAngleMode) {
|
||||
Iterator< IMogoMapListener > iterator = MogoRegisterCenterHandler.getInstance().getMapListeners();
|
||||
if ( iterator == null ) {
|
||||
Iterator<IMogoMapListener> iterator = MogoRegisterCenterHandler.getInstance().getMapListeners();
|
||||
if (iterator == null) {
|
||||
return;
|
||||
}
|
||||
while ( iterator.hasNext() ) {
|
||||
while (iterator.hasNext()) {
|
||||
IMogoMapListener listener = iterator.next();
|
||||
if ( listener != null ) {
|
||||
if (listener != null) {
|
||||
try {
|
||||
listener.onMapVisualAngleChanged( visualAngleMode );
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "error." );
|
||||
listener.onMapVisualAngleChanged(visualAngleMode);
|
||||
} catch (Exception e) {
|
||||
CallerLogger.INSTANCE.e(M_MAIN +TAG, "onMapVisualAngleChanged error : " + e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMapChanged( MogoLatLng location, float zoom, float tilt, float bearing ) {
|
||||
public void onMapChanged(MogoLatLng location, float zoom, float tilt, float bearing) {
|
||||
|
||||
final long start = System.currentTimeMillis();
|
||||
Iterator< IMogoMapListener > iterator = MogoRegisterCenterHandler.getInstance().getMapListeners();
|
||||
if ( iterator == null ) {
|
||||
Iterator<IMogoMapListener> iterator = MogoRegisterCenterHandler.getInstance().getMapListeners();
|
||||
if (iterator == null) {
|
||||
return;
|
||||
}
|
||||
while ( iterator.hasNext() ) {
|
||||
while (iterator.hasNext()) {
|
||||
IMogoMapListener listener = iterator.next();
|
||||
if ( listener != null ) {
|
||||
if (listener != null) {
|
||||
try {
|
||||
listener.onMapChanged( location, zoom, tilt, bearing );
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "error." );
|
||||
listener.onMapChanged(location, zoom, tilt, bearing);
|
||||
} catch (Exception e) {
|
||||
CallerLogger.INSTANCE.e(M_MAIN +TAG, "onMapChanged error :" + e);
|
||||
}
|
||||
}
|
||||
}
|
||||
Logger.i( TAG, "onMapChanged event cost " + ( System.currentTimeMillis() - start ) + "ms" );
|
||||
CallerLogger.INSTANCE.i(M_MAIN +TAG, "onMapChanged event cost " + (System.currentTimeMillis() - start) + "ms");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInitNaviFailure() {
|
||||
Iterator< IMogoNaviListener > iterator = MogoRegisterCenterHandler.getInstance().getNaviListeners();
|
||||
if ( iterator == null ) {
|
||||
Iterator<IMogoNaviListener> iterator = MogoRegisterCenterHandler.getInstance().getNaviListeners();
|
||||
if (iterator == null) {
|
||||
return;
|
||||
}
|
||||
while ( iterator.hasNext() ) {
|
||||
while (iterator.hasNext()) {
|
||||
IMogoNaviListener listener = iterator.next();
|
||||
if ( listener != null ) {
|
||||
if (listener != null) {
|
||||
try {
|
||||
listener.onInitNaviFailure();
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "error." );
|
||||
} catch (Exception e) {
|
||||
CallerLogger.INSTANCE.e(M_MAIN +TAG, "onInitNaviFailure error : " + e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -291,36 +293,36 @@ public class EventDispatchCenter implements
|
||||
|
||||
@Override
|
||||
public void onInitNaviSuccess() {
|
||||
Iterator< IMogoNaviListener > iterator = MogoRegisterCenterHandler.getInstance().getNaviListeners();
|
||||
if ( iterator == null ) {
|
||||
Iterator<IMogoNaviListener> iterator = MogoRegisterCenterHandler.getInstance().getNaviListeners();
|
||||
if (iterator == null) {
|
||||
return;
|
||||
}
|
||||
while ( iterator.hasNext() ) {
|
||||
while (iterator.hasNext()) {
|
||||
IMogoNaviListener listener = iterator.next();
|
||||
if ( listener != null ) {
|
||||
if (listener != null) {
|
||||
try {
|
||||
listener.onInitNaviSuccess();
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "error." );
|
||||
} catch (Exception e) {
|
||||
CallerLogger.INSTANCE.e(M_MAIN +TAG, "onInitNaviSuccess error : " + e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNaviInfoUpdate( MogoNaviInfo naviinfo ) {
|
||||
Iterator< IMogoNaviListener > iterator = MogoRegisterCenterHandler.getInstance().getNaviListeners();
|
||||
public void onNaviInfoUpdate(MogoNaviInfo naviinfo) {
|
||||
Iterator<IMogoNaviListener> iterator = MogoRegisterCenterHandler.getInstance().getNaviListeners();
|
||||
|
||||
if ( iterator == null ) {
|
||||
if (iterator == null) {
|
||||
return;
|
||||
}
|
||||
while ( iterator.hasNext() ) {
|
||||
while (iterator.hasNext()) {
|
||||
IMogoNaviListener listener = iterator.next();
|
||||
if ( listener != null ) {
|
||||
if (listener != null) {
|
||||
try {
|
||||
listener.onNaviInfoUpdate( naviinfo );
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "error." );
|
||||
listener.onNaviInfoUpdate(naviinfo);
|
||||
} catch (Exception e) {
|
||||
CallerLogger.INSTANCE.e(M_MAIN +TAG, "onNaviInfoUpdate error : " + e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -328,18 +330,18 @@ public class EventDispatchCenter implements
|
||||
|
||||
@Override
|
||||
public void onStartNavi() {
|
||||
Iterator< IMogoNaviListener > iterator = MogoRegisterCenterHandler.getInstance().getNaviListeners();
|
||||
Iterator<IMogoNaviListener> iterator = MogoRegisterCenterHandler.getInstance().getNaviListeners();
|
||||
|
||||
if ( iterator == null ) {
|
||||
if (iterator == null) {
|
||||
return;
|
||||
}
|
||||
while ( iterator.hasNext() ) {
|
||||
while (iterator.hasNext()) {
|
||||
IMogoNaviListener listener = iterator.next();
|
||||
if ( listener != null ) {
|
||||
if (listener != null) {
|
||||
try {
|
||||
listener.onStartNavi();
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "error." );
|
||||
} catch (Exception e) {
|
||||
CallerLogger.INSTANCE.e(M_MAIN +TAG, "onStartNavi error : " + e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -347,17 +349,17 @@ public class EventDispatchCenter implements
|
||||
|
||||
@Override
|
||||
public void onStopNavi() {
|
||||
Iterator< IMogoNaviListener > iterator = MogoRegisterCenterHandler.getInstance().getNaviListeners();
|
||||
if ( iterator == null ) {
|
||||
Iterator<IMogoNaviListener> iterator = MogoRegisterCenterHandler.getInstance().getNaviListeners();
|
||||
if (iterator == null) {
|
||||
return;
|
||||
}
|
||||
while ( iterator.hasNext() ) {
|
||||
while (iterator.hasNext()) {
|
||||
IMogoNaviListener listener = iterator.next();
|
||||
if ( listener != null ) {
|
||||
if (listener != null) {
|
||||
try {
|
||||
listener.onStopNavi();
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "error." );
|
||||
} catch (Exception e) {
|
||||
CallerLogger.INSTANCE.e(M_MAIN +TAG, "onStopNavi error : " + e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -365,17 +367,17 @@ public class EventDispatchCenter implements
|
||||
|
||||
@Override
|
||||
public void onCalculateSuccess() {
|
||||
Iterator< IMogoNaviListener > iterator = MogoRegisterCenterHandler.getInstance().getNaviListeners();
|
||||
if ( iterator == null ) {
|
||||
Iterator<IMogoNaviListener> iterator = MogoRegisterCenterHandler.getInstance().getNaviListeners();
|
||||
if (iterator == null) {
|
||||
return;
|
||||
}
|
||||
while ( iterator.hasNext() ) {
|
||||
while (iterator.hasNext()) {
|
||||
IMogoNaviListener listener = iterator.next();
|
||||
if ( listener != null ) {
|
||||
if (listener != null) {
|
||||
try {
|
||||
listener.onCalculateSuccess();
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "error." );
|
||||
} catch (Exception e) {
|
||||
CallerLogger.INSTANCE.e(M_MAIN +TAG, "onCalculateSuccess error : " + e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -383,17 +385,17 @@ public class EventDispatchCenter implements
|
||||
|
||||
@Override
|
||||
public void onoCalculateFailed() {
|
||||
Iterator< IMogoNaviListener > iterator = MogoRegisterCenterHandler.getInstance().getNaviListeners();
|
||||
if ( iterator == null ) {
|
||||
Iterator<IMogoNaviListener> iterator = MogoRegisterCenterHandler.getInstance().getNaviListeners();
|
||||
if (iterator == null) {
|
||||
return;
|
||||
}
|
||||
while ( iterator.hasNext() ) {
|
||||
while (iterator.hasNext()) {
|
||||
IMogoNaviListener listener = iterator.next();
|
||||
if ( listener != null ) {
|
||||
if (listener != null) {
|
||||
try {
|
||||
listener.onoCalculateFailed();
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "error." );
|
||||
} catch (Exception e) {
|
||||
CallerLogger.INSTANCE.e(M_MAIN +TAG, "onoCalculateFailed error : " + e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -401,19 +403,19 @@ public class EventDispatchCenter implements
|
||||
|
||||
|
||||
@Override
|
||||
public void onLocationChanged( MogoLocation location ) {
|
||||
public void onLocationChanged(MogoLocation location) {
|
||||
|
||||
Iterator< IMogoLocationListener > iterator = MogoRegisterCenterHandler.getInstance().getLocationListeners();
|
||||
if ( iterator == null ) {
|
||||
Iterator<IMogoLocationListener> iterator = MogoRegisterCenterHandler.getInstance().getLocationListeners();
|
||||
if (iterator == null) {
|
||||
return;
|
||||
}
|
||||
while ( iterator.hasNext() ) {
|
||||
while (iterator.hasNext()) {
|
||||
IMogoLocationListener listener = iterator.next();
|
||||
if ( listener != null ) {
|
||||
if (listener != null) {
|
||||
try {
|
||||
listener.onLocationChanged( location );
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "error." );
|
||||
listener.onLocationChanged(location);
|
||||
} catch (Exception e) {
|
||||
CallerLogger.INSTANCE.e(M_MAIN +TAG, "onLocationChanged error : " + e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -421,95 +423,95 @@ public class EventDispatchCenter implements
|
||||
|
||||
@Override
|
||||
public void northModel() {
|
||||
Iterator< IMogoADASControlStatusChangedListener > iterator = MogoRegisterCenterHandler.getInstance().getAdasControlStatusChangedListeners();
|
||||
if ( iterator == null ) {
|
||||
Iterator<IMogoADASControlStatusChangedListener> iterator = MogoRegisterCenterHandler.getInstance().getAdasControlStatusChangedListeners();
|
||||
if (iterator == null) {
|
||||
return;
|
||||
}
|
||||
while ( iterator.hasNext() ) {
|
||||
while (iterator.hasNext()) {
|
||||
IMogoADASControlStatusChangedListener listener = iterator.next();
|
||||
if ( listener == null ) {
|
||||
if (listener == null) {
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
listener.onMapUiModeChanged( EnumMapUI.NorthUP_2D );
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "onMapUiModeChanged" );
|
||||
listener.onMapUiModeChanged(EnumMapUI.NorthUP_2D);
|
||||
} catch (Exception e) {
|
||||
CallerLogger.INSTANCE.e(M_MAIN +TAG, "northModel error : " + e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void carHeadUp() {
|
||||
Iterator< IMogoADASControlStatusChangedListener > iterator = MogoRegisterCenterHandler.getInstance().getAdasControlStatusChangedListeners();
|
||||
if ( iterator == null ) {
|
||||
Iterator<IMogoADASControlStatusChangedListener> iterator = MogoRegisterCenterHandler.getInstance().getAdasControlStatusChangedListeners();
|
||||
if (iterator == null) {
|
||||
return;
|
||||
}
|
||||
while ( iterator.hasNext() ) {
|
||||
while (iterator.hasNext()) {
|
||||
IMogoADASControlStatusChangedListener listener = iterator.next();
|
||||
if ( listener == null ) {
|
||||
if (listener == null) {
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
listener.onMapUiModeChanged( EnumMapUI.CarUp_2D );
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "onMapUiModeChanged" );
|
||||
listener.onMapUiModeChanged(EnumMapUI.CarUp_2D);
|
||||
} catch (Exception e) {
|
||||
CallerLogger.INSTANCE.e(M_MAIN +TAG, "carHeadUp error : " + e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void switchCarChat( EnumCarChatIncognitoMode enumCarChatIncognitoMode ) {
|
||||
Iterator< IMogoADASControlStatusChangedListener > iterator = MogoRegisterCenterHandler.getInstance().getAdasControlStatusChangedListeners();
|
||||
if ( iterator == null ) {
|
||||
public void switchCarChat(EnumCarChatIncognitoMode enumCarChatIncognitoMode) {
|
||||
Iterator<IMogoADASControlStatusChangedListener> iterator = MogoRegisterCenterHandler.getInstance().getAdasControlStatusChangedListeners();
|
||||
if (iterator == null) {
|
||||
return;
|
||||
}
|
||||
while ( iterator.hasNext() ) {
|
||||
while (iterator.hasNext()) {
|
||||
IMogoADASControlStatusChangedListener listener = iterator.next();
|
||||
if ( listener == null ) {
|
||||
if (listener == null) {
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
listener.onCarStatusChanged( enumCarChatIncognitoMode == EnumCarChatIncognitoMode.OPEN );
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "onMapUiModeChanged" );
|
||||
listener.onCarStatusChanged(enumCarChatIncognitoMode == EnumCarChatIncognitoMode.OPEN);
|
||||
} catch (Exception e) {
|
||||
CallerLogger.INSTANCE.e(M_MAIN +TAG, "switchCarChat error : " + e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whiteModel() {
|
||||
Iterator< IMogoADASControlStatusChangedListener > iterator = MogoRegisterCenterHandler.getInstance().getAdasControlStatusChangedListeners();
|
||||
if ( iterator == null ) {
|
||||
Iterator<IMogoADASControlStatusChangedListener> iterator = MogoRegisterCenterHandler.getInstance().getAdasControlStatusChangedListeners();
|
||||
if (iterator == null) {
|
||||
return;
|
||||
}
|
||||
while ( iterator.hasNext() ) {
|
||||
while (iterator.hasNext()) {
|
||||
IMogoADASControlStatusChangedListener listener = iterator.next();
|
||||
if ( listener == null ) {
|
||||
if (listener == null) {
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
listener.onMapUiModeChanged( EnumMapUI.Type_Light );
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "onMapUiModeChanged" );
|
||||
listener.onMapUiModeChanged(EnumMapUI.Type_Light);
|
||||
} catch (Exception e) {
|
||||
CallerLogger.INSTANCE.e(M_MAIN +TAG, "whiteModel error : " + e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void blackModel() {
|
||||
Iterator< IMogoADASControlStatusChangedListener > iterator = MogoRegisterCenterHandler.getInstance().getAdasControlStatusChangedListeners();
|
||||
if ( iterator == null ) {
|
||||
Iterator<IMogoADASControlStatusChangedListener> iterator = MogoRegisterCenterHandler.getInstance().getAdasControlStatusChangedListeners();
|
||||
if (iterator == null) {
|
||||
return;
|
||||
}
|
||||
while ( iterator.hasNext() ) {
|
||||
while (iterator.hasNext()) {
|
||||
IMogoADASControlStatusChangedListener listener = iterator.next();
|
||||
if ( listener == null ) {
|
||||
if (listener == null) {
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
listener.onMapUiModeChanged( EnumMapUI.Type_Night );
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "onMapUiModeChanged" );
|
||||
listener.onMapUiModeChanged(EnumMapUI.Type_Night);
|
||||
} catch (Exception e) {
|
||||
CallerLogger.INSTANCE.e(M_MAIN +TAG, "blackModel error : " + e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.mogo.eagle.core.function.main;
|
||||
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_MAIN;
|
||||
import static com.mogo.eagle.core.function.main.MainPresenter.MOGO_PERMISSION_REQUEST_CODE;
|
||||
|
||||
import android.content.Intent;
|
||||
@@ -7,7 +8,6 @@ import android.content.pm.PackageManager;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.provider.Settings;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
@@ -24,12 +24,12 @@ import com.mogo.commons.mvp.MvpActivity;
|
||||
import com.mogo.commons.mvp.MvpFragment;
|
||||
import com.mogo.eagle.core.data.constants.MoGoFragmentPaths;
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.function.main.cards.MogoModulesManager;
|
||||
import com.mogo.eagle.core.function.main.service.MogoMainService;
|
||||
import com.mogo.eagle.core.function.main.utils.DisplayEffectsHelper;
|
||||
import com.mogo.eagle.core.function.main.windowview.FloatingViewHandler;
|
||||
import com.mogo.eagle.core.utilcode.mogo.AppLaunchTimeUtils;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.eagle.core.utilcode.mogo.permissions.PermissionsDialogUtils;
|
||||
import com.mogo.eagle.core.utilcode.mogo.toast.ResourcesHelper;
|
||||
import com.mogo.eagle.core.utilcode.util.NetworkUtils;
|
||||
@@ -159,14 +159,14 @@ public class MainActivity extends MvpActivity<MainView, MainPresenter> implement
|
||||
// 过滤掉异常启动时间
|
||||
if (coldStartTime < 50000) {
|
||||
// 上传冷启动时间coldStartTime
|
||||
Logger.i(TAG, "coldStartTime:" + coldStartTime);
|
||||
CallerLogger.INSTANCE.i(M_MAIN + TAG, "coldStartTime:" + coldStartTime);
|
||||
properties.put("app_launch_coldStartTime", coldStartTime);
|
||||
}
|
||||
} else if (hotStartTime > 0) {
|
||||
// 过滤掉异常启动时间
|
||||
if (hotStartTime < 30000) {
|
||||
// 上传热启动时间hotStartTime
|
||||
Logger.i(TAG, "hotStartTime:" + hotStartTime);
|
||||
CallerLogger.INSTANCE.i(M_MAIN + TAG, "hotStartTime:" + hotStartTime);
|
||||
properties.put("app_launch_hotStartTime", hotStartTime);
|
||||
}
|
||||
}
|
||||
@@ -198,20 +198,17 @@ public class MainActivity extends MvpActivity<MainView, MainPresenter> implement
|
||||
|
||||
if (DebugConfig.isMapBased()) {
|
||||
EventDispatchCenter.getInstance().setMapLoadedCallback(() -> {
|
||||
Logger.d(TAG, "map loaded." + Thread.currentThread().getName());
|
||||
CallerLogger.INSTANCE.d(M_MAIN + TAG, "map loaded." + Thread.currentThread().getName());
|
||||
// 延时加载其他模块
|
||||
getWindow().getDecorView().postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
loadOthersModules();
|
||||
loadFunctionFragment();
|
||||
getWindow().getDecorView().postDelayed(() -> {
|
||||
loadOthersModules();
|
||||
loadFunctionFragment();
|
||||
|
||||
// TODO 这里临时兼容进入VR模式
|
||||
MogoApisHandler.getInstance().getApis().getStatusManagerApi().setVrMode(TAG, true);
|
||||
MogoMapListenerHandler.getInstance().onMapModeChanged(EnumMapUI.Type_VR);
|
||||
}
|
||||
// TODO 这里临时兼容进入VR模式
|
||||
MogoApisHandler.getInstance().getApis().getStatusManagerApi().setVrMode(TAG, true);
|
||||
MogoMapListenerHandler.getInstance().onMapModeChanged(EnumMapUI.Type_VR);
|
||||
}, 3000);
|
||||
Log.i(TAG, "App launch timer cost " + (System.currentTimeMillis() - start) + "ms");
|
||||
CallerLogger.INSTANCE.i(M_MAIN + TAG, "App launch timer cost " + (System.currentTimeMillis() - start) + "ms");
|
||||
});
|
||||
loadFunctionMapView();
|
||||
} else {
|
||||
@@ -279,7 +276,7 @@ public class MainActivity extends MvpActivity<MainView, MainPresenter> implement
|
||||
|
||||
@Override
|
||||
public void loadFunctionFragment() {
|
||||
Logger.d(TAG, "loadFunctionFragment……");
|
||||
CallerLogger.INSTANCE.d(M_MAIN + TAG, "loadFunctionFragment……");
|
||||
// 加载 HMI 图层
|
||||
BaseFragment fragmentHdMap = (BaseFragment) ARouter.getInstance().build(MoGoFragmentPaths.PATH_FRAGMENT_HMI).navigation();
|
||||
addFragment(fragmentHdMap, fragmentHdMap.getTagName(), R.id.module_main_id_waring_fragment);
|
||||
@@ -392,7 +389,7 @@ public class MainActivity extends MvpActivity<MainView, MainPresenter> implement
|
||||
mServiceApis.getMapServiceApi().getMapUIController().destroy();
|
||||
AdasConfigApiController.getInstance().release();
|
||||
mServiceApis.getAdasControllerApi().release();
|
||||
Logger.d(TAG, "destroy.");
|
||||
CallerLogger.INSTANCE.d(M_MAIN + TAG, "destroy.");
|
||||
ContextHolderUtil.releaseContext();
|
||||
MogoModulesManager.getInstance().onDestroy();
|
||||
SchemeIntent.getInstance().clear();
|
||||
@@ -447,7 +444,7 @@ public class MainActivity extends MvpActivity<MainView, MainPresenter> implement
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
Logger.d(TAG, "requestCode: " + requestCode + " resultCode: " + resultCode);
|
||||
CallerLogger.INSTANCE.d(M_MAIN + TAG, "requestCode: " + requestCode + " resultCode: " + resultCode);
|
||||
if (requestCode == REQUEST_CODE_DIALOG) {
|
||||
//申请悬浮窗权限
|
||||
|
||||
@@ -467,7 +464,7 @@ public class MainActivity extends MvpActivity<MainView, MainPresenter> implement
|
||||
fragment = newFragment;
|
||||
}
|
||||
if (fragment == null) {
|
||||
Logger.e(TAG, "add fragment fail cause fragment == null, container is %s", ResourcesHelper.getResNameById(getApplicationContext(), containerId));
|
||||
CallerLogger.INSTANCE.e(M_MAIN + TAG, "add fragment fail cause fragment == null, container is " + ResourcesHelper.getResNameById(getApplicationContext(), containerId));
|
||||
return;
|
||||
}
|
||||
getSupportFragmentManager().beginTransaction()
|
||||
|
||||
@@ -1,18 +1,19 @@
|
||||
package com.mogo.eagle.core.function.main;
|
||||
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_MAIN;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Process;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.eagle.core.function.api.base.IMoGoFunctionProvider;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.service.intent.IMogoIntentListener;
|
||||
import com.mogo.service.statusmanager.StatusDescriptor;
|
||||
@@ -25,17 +26,16 @@ import com.mogo.service.statusmanager.StatusDescriptor;
|
||||
public class MainLauncherActivity extends MainActivity implements IMogoIntentListener {
|
||||
private static final String TAG = "MainLauncherActivity";
|
||||
protected boolean mIsHomeKeyDown = false;
|
||||
private static Handler handlerV2XEvent = new Handler();
|
||||
private final static Handler handlerV2XEvent = new Handler();
|
||||
private static Runnable runnableV2XEvent;
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
DebugConfig.setNeedRequestUserInfo(true);
|
||||
Log.d(TAG, "onCreate");
|
||||
CallerLogger.INSTANCE.i(M_MAIN +TAG, "onCreate");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void initViews() {
|
||||
super.initViews();
|
||||
@@ -71,7 +71,7 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
|
||||
@Override
|
||||
protected void loadOthersModules() {
|
||||
super.loadOthersModules();
|
||||
Logger.d(TAG, "loadOthersModules");
|
||||
CallerLogger.INSTANCE.d(M_MAIN + TAG, "loadOthersModules");
|
||||
loadOCHModule();
|
||||
}
|
||||
|
||||
@@ -113,12 +113,12 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
|
||||
intent.putExtra("type", 0);
|
||||
}
|
||||
sendBroadcast(intent);
|
||||
Logger.d(TAG, "send msg to AI Voice");
|
||||
CallerLogger.INSTANCE.d(M_MAIN + TAG, "send msg to AI Voice");
|
||||
}
|
||||
|
||||
|
||||
private void stopCountDown() {
|
||||
if (handlerV2XEvent != null && runnableV2XEvent != null) {
|
||||
if (runnableV2XEvent != null) {
|
||||
handlerV2XEvent.removeCallbacks(runnableV2XEvent);
|
||||
runnableV2XEvent = null;
|
||||
}
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
package com.mogo.eagle.core.function.main;
|
||||
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_MAIN;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Process;
|
||||
import android.util.Log;
|
||||
|
||||
import com.bytedance.boost_multidex.BoostMultiDex;
|
||||
import com.mogo.cloud.httpdns.MogoHttpDnsConfig;
|
||||
@@ -20,11 +21,10 @@ import com.mogo.eagle.core.data.constants.MoGoConfig;
|
||||
import com.mogo.eagle.core.data.constants.MogoServicePaths;
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
import com.mogo.eagle.core.function.api.chat.biz.ChatConsts;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.function.notice.PushUIConstants;
|
||||
import com.mogo.eagle.core.utilcode.mogo.AppLaunchTimeUtils;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr;
|
||||
import com.mogo.eagle.core.utilcode.util.DeviceUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.ProcessUtils;
|
||||
import com.mogo.map.MapApiPath;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
@@ -38,7 +38,6 @@ import com.mogo.test.crashreport.CrashReportConstants;
|
||||
import com.mogo.test.crashreport.upgrade.UpgradeReportConstants;
|
||||
import com.zhidao.boot.persistent.lib.PersistentManager;
|
||||
import com.zhidao.support.obu.ami.AmiClientManager;
|
||||
import com.zhjt.service.chain.core.ChainTraceStarter;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
@@ -71,7 +70,7 @@ public abstract class MainMoGoApplication extends AbsMogoApplication {
|
||||
|
||||
@Override
|
||||
protected boolean shouldInit() {
|
||||
Logger.w(TAG, "evaluate shouldInit() with: %s", ProcessUtils.getProcessName(Process.myPid()));
|
||||
CallerLogger.INSTANCE.w(M_MAIN + TAG, "evaluate shouldInit() with: " + ProcessUtils.getProcessName(Process.myPid()));
|
||||
return ProcessUtils.isMainProcess(this);
|
||||
}
|
||||
|
||||
@@ -215,7 +214,7 @@ public abstract class MainMoGoApplication extends AbsMogoApplication {
|
||||
e.printStackTrace();
|
||||
httpDnsSimpleLocation = new HttpDnsSimpleLocation("010", 1, 1);
|
||||
}
|
||||
Logger.i(TAG, "使用缓存GPS信息:" + httpDnsSimpleLocation);
|
||||
CallerLogger.INSTANCE.d(M_MAIN+TAG, "使用缓存GPS信息:" + httpDnsSimpleLocation);
|
||||
}
|
||||
return httpDnsSimpleLocation;
|
||||
});
|
||||
@@ -225,7 +224,7 @@ public abstract class MainMoGoApplication extends AbsMogoApplication {
|
||||
new IMoGoTokenCallback() {
|
||||
@Override
|
||||
public void onTokenGot(String token, String sn) {
|
||||
Logger.d("TEST-SOCKET", "onTokenGot ");
|
||||
CallerLogger.INSTANCE.d(M_MAIN+TAG, "onTokenGot ");
|
||||
// 异步初始化NetConfig
|
||||
asyncInit();
|
||||
// HttpDns ttl回调 --- socketTTL
|
||||
@@ -236,7 +235,7 @@ public abstract class MainMoGoApplication extends AbsMogoApplication {
|
||||
|
||||
@Override
|
||||
public void onError(int code, String msg) {
|
||||
Log.d(TAG, "初始化MogoAiCloudSdk failed ,reason : " + msg + " , 未能开启长链服务和初始化Modules服务");
|
||||
CallerLogger.INSTANCE.d(M_MAIN+TAG, "初始化MogoAiCloudSdk failed ,reason : " + msg + " , 未能开启长链服务和初始化Modules服务");
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -247,7 +246,6 @@ public abstract class MainMoGoApplication extends AbsMogoApplication {
|
||||
*/
|
||||
private void connectAmiIp() {
|
||||
String ipAddress = SharedPrefsMgr.getInstance(AbsMogoApplication.getApp().getBaseContext()).getString(MoGoConfig.OBU_IP, "192.168.1.199");
|
||||
//Logger.d("OnAdasListenerAdapter", "application --ipAddress = " + ipAddress);
|
||||
AmiClientManager.getInstance().setObuIp(ipAddress);
|
||||
}
|
||||
|
||||
@@ -265,26 +263,26 @@ public abstract class MainMoGoApplication extends AbsMogoApplication {
|
||||
}
|
||||
|
||||
private void startSocketService() {
|
||||
Logger.d(TAG, "startSocketService");
|
||||
CallerLogger.INSTANCE.d(M_MAIN+TAG, "startSocketService");
|
||||
IMogoServiceApis apis = MogoApisHandler.getInstance().getApis();
|
||||
// 关闭长链服务
|
||||
apis.getSocketManagerApi(getApplicationContext()).destroy();
|
||||
apis.getSocketManagerApi(this).registerLifecycleListener(10020, new IMogoLifecycleListener() {
|
||||
@Override
|
||||
public void onConnectFailure() {
|
||||
Logger.d(TAG, "socket-onConnectFailure");
|
||||
CallerLogger.INSTANCE.d(M_MAIN+TAG, "socket-onConnectFailure");
|
||||
DebugConfig.setDownloadSnapshot(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConnectSuccess() {
|
||||
Logger.d(TAG, "socket-onConnectSuccess");
|
||||
CallerLogger.INSTANCE.d(M_MAIN+TAG, "socket-onConnectSuccess");
|
||||
DebugConfig.setDownloadSnapshot(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConnectLost() {
|
||||
Logger.d(TAG, "socket-onConnectLost");
|
||||
CallerLogger.INSTANCE.d(M_MAIN+TAG, "socket-onConnectLost");
|
||||
DebugConfig.setDownloadSnapshot(false);
|
||||
}
|
||||
});
|
||||
@@ -299,7 +297,7 @@ public abstract class MainMoGoApplication extends AbsMogoApplication {
|
||||
}
|
||||
|
||||
private void initModules() {
|
||||
Logger.d(TAG, "initModules");
|
||||
CallerLogger.INSTANCE.d(M_MAIN+TAG, "initModules");
|
||||
//mogo deva tools
|
||||
MogoModulePaths.addModule(new MogoModule(MogoServicePaths.PATH_DEVA_TOOLS, "IMoGoDevaToolsProvider"));
|
||||
// 初始化 bugly 升级
|
||||
@@ -311,7 +309,7 @@ public abstract class MainMoGoApplication extends AbsMogoApplication {
|
||||
|
||||
MogoModulePaths.addBaseModule(new MogoModule(MapApiPath.PATH, "CustomMapApiBuilder"));
|
||||
MogoModulePaths.addBaseModule(new MogoModule(ServiceConst.PATH_REFRESH_STRATEGY, ServiceConst.PATH_REFRESH_STRATEGY));
|
||||
// MogoModulePaths.addBaseModule(new MogoModule(V2XConst.PATH_V2X_UI, V2XConst.MODULE_NAME));
|
||||
// MogoModulePaths.addBaseModule(new MogoModule(V2XConst.PATH_V2X_UI, V2XConst.MODULE_NAME));
|
||||
|
||||
// 域控制器模块(新)
|
||||
MogoModulePaths.addModuleFunctionServer(new MogoModule(MogoServicePaths.PATH_AUTO_PILOT, "IMoGoAutoPilotProvider"));
|
||||
@@ -352,7 +350,7 @@ public abstract class MainMoGoApplication extends AbsMogoApplication {
|
||||
.getInstance().initManager(this);
|
||||
}
|
||||
|
||||
Log.i(TAG, "App launch timer cost " + (System.currentTimeMillis() - start) + "ms");
|
||||
CallerLogger.INSTANCE.i(M_MAIN+TAG, "App launch timer cost " + (System.currentTimeMillis() - start) + "ms");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
package com.mogo.eagle.core.function.main;
|
||||
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_MAIN;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.utilcode.util.CommonUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.service.IMogoServiceApis;
|
||||
@@ -47,7 +48,7 @@ public class SchemeIntent implements IMogoStatusChangedListener {
|
||||
|
||||
private static class IntentWrapper {
|
||||
public Intent mIntent;
|
||||
public long mDelay = 0L;
|
||||
public long mDelay;
|
||||
|
||||
public IntentWrapper(Intent intent, long delay) {
|
||||
this.mIntent = intent;
|
||||
@@ -118,7 +119,7 @@ public class SchemeIntent implements IMogoStatusChangedListener {
|
||||
handleSwitch2Action(target);
|
||||
break;
|
||||
case "/main/share":
|
||||
Logger.d(TAG, "收到打开分享框的scheme,准备打开分享框");
|
||||
CallerLogger.INSTANCE.d(M_MAIN + TAG, "收到打开分享框的scheme,准备打开分享框");
|
||||
// Map<String, Object> properties = new HashMap<>();
|
||||
// properties.put("from", "1");
|
||||
// mApis.getAnalyticsApi().track("v2x_share_click", properties);
|
||||
@@ -146,7 +147,7 @@ public class SchemeIntent implements IMogoStatusChangedListener {
|
||||
if (TextUtils.isEmpty(type)) {
|
||||
return;
|
||||
}
|
||||
Log.d("语音打开事件面板type", type);
|
||||
CallerLogger.INSTANCE.d(M_MAIN + TAG, "语音打开事件面板" + type);
|
||||
switch (type) {
|
||||
case TYPE_LAUNCH:
|
||||
handleLaunchIntent(target);
|
||||
@@ -179,7 +180,7 @@ public class SchemeIntent implements IMogoStatusChangedListener {
|
||||
* 语音打开事件面板
|
||||
* */
|
||||
private void handleShowEventPanel(int item) {
|
||||
Logger.d(TAG, "语音打开事件面板" + item);
|
||||
CallerLogger.INSTANCE.d(M_MAIN + TAG, "语音打开事件面板" + item);
|
||||
//mApis.getEventPanelManager().showPanelWithSelectedItem(item);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.mogo.eagle.core.function.main.cards;
|
||||
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_MAIN;
|
||||
|
||||
import android.app.Application;
|
||||
import android.content.Context;
|
||||
|
||||
@@ -9,11 +11,11 @@ import com.alibaba.android.arouter.facade.template.IProvider;
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.eagle.core.function.api.base.IMoGoFunctionProvider;
|
||||
import com.mogo.eagle.core.function.api.base.IMoGoFunctionServerProvider;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.function.main.MainActivity;
|
||||
import com.mogo.eagle.core.utilcode.mogo.toast.ResourcesHelper;
|
||||
import com.mogo.module.common.MogoModule;
|
||||
import com.mogo.module.common.MogoModulePaths;
|
||||
import com.mogo.eagle.core.function.main.MainActivity;
|
||||
import com.mogo.service.module.IMogoModuleProvider;
|
||||
|
||||
import java.util.Collection;
|
||||
@@ -34,17 +36,17 @@ public class MogoModulesManager implements MogoModulesHandler {
|
||||
private MainActivity mActivity;
|
||||
private Application mApp;
|
||||
|
||||
private Map< MogoModule, IMogoModuleProvider > mModuleProviders = new HashMap<>();
|
||||
private Map<MogoModule, IMogoModuleProvider> mModuleProviders = new HashMap<>();
|
||||
// 空间换效率
|
||||
private Map< String, IMogoModuleProvider > mModuleNameProviders = new HashMap<>();
|
||||
private Map<String, IMogoModuleProvider> mModuleNameProviders = new HashMap<>();
|
||||
|
||||
// 架构升级后的加载功能模块的方式
|
||||
private Map< MogoModule, IMoGoFunctionProvider> mModuleFunctionProviders = new HashMap<>();
|
||||
private Map< String, IMoGoFunctionProvider> mModuleNameFunctionProviders = new HashMap<>();
|
||||
private Map<MogoModule, IMoGoFunctionProvider> mModuleFunctionProviders = new HashMap<>();
|
||||
private Map<String, IMoGoFunctionProvider> mModuleNameFunctionProviders = new HashMap<>();
|
||||
|
||||
// 架构升级后的加载功能模块的方式
|
||||
private Map< MogoModule, IMoGoFunctionServerProvider> mModuleFunctionServerProviders = new HashMap<>();
|
||||
private Map< String, IMoGoFunctionServerProvider> mModuleNameFunctionServerProviders = new HashMap<>();
|
||||
private Map<MogoModule, IMoGoFunctionServerProvider> mModuleFunctionServerProviders = new HashMap<>();
|
||||
private Map<String, IMoGoFunctionServerProvider> mModuleNameFunctionServerProviders = new HashMap<>();
|
||||
|
||||
private static volatile MogoModulesManager sInstance;
|
||||
|
||||
@@ -52,9 +54,9 @@ public class MogoModulesManager implements MogoModulesHandler {
|
||||
}
|
||||
|
||||
public static MogoModulesManager getInstance() {
|
||||
if ( sInstance == null ) {
|
||||
synchronized ( MogoModulesManager.class ) {
|
||||
if ( sInstance == null ) {
|
||||
if (sInstance == null) {
|
||||
synchronized (MogoModulesManager.class) {
|
||||
if (sInstance == null) {
|
||||
sInstance = new MogoModulesManager();
|
||||
}
|
||||
}
|
||||
@@ -66,9 +68,9 @@ public class MogoModulesManager implements MogoModulesHandler {
|
||||
sInstance = null;
|
||||
}
|
||||
|
||||
public void init( MainActivity activity ) {
|
||||
if ( activity == null ) {
|
||||
throw new NullPointerException( "activity can't be null." );
|
||||
public void init(MainActivity activity) {
|
||||
if (activity == null) {
|
||||
throw new NullPointerException("activity can't be null.");
|
||||
}
|
||||
this.mActivity = activity;
|
||||
mApp = mActivity.getApplication();
|
||||
@@ -84,14 +86,14 @@ public class MogoModulesManager implements MogoModulesHandler {
|
||||
|
||||
@Override
|
||||
public void loadModules() {
|
||||
final List< MogoModule > modules = MogoModulePaths.getModules();
|
||||
if ( modules != null && !modules.isEmpty() ) {
|
||||
for ( MogoModule module : modules ) {
|
||||
Logger.d( TAG, "module.getPath():" + module.getPath() + " name: " + module.getName() );
|
||||
IMogoModuleProvider provider = load( module.getPath() );
|
||||
if ( provider != null ) {
|
||||
mModuleProviders.put( module, provider );
|
||||
mModuleNameProviders.put( module.getName(), provider );
|
||||
final List<MogoModule> modules = MogoModulePaths.getModules();
|
||||
if (modules != null && !modules.isEmpty()) {
|
||||
for (MogoModule module : modules) {
|
||||
CallerLogger.INSTANCE.d(M_MAIN + TAG, "module.getPath():" + module.getPath() + " name: " + module.getName());
|
||||
IMogoModuleProvider provider = load(module.getPath());
|
||||
if (provider != null) {
|
||||
mModuleProviders.put(module, provider);
|
||||
mModuleNameProviders.put(module.getName(), provider);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -99,14 +101,14 @@ public class MogoModulesManager implements MogoModulesHandler {
|
||||
|
||||
@Override
|
||||
public void loadFunctionModules() {
|
||||
final List< MogoModule > modules = MogoModulePaths.getModuleFunctions();
|
||||
if ( modules != null && !modules.isEmpty() ) {
|
||||
for ( MogoModule module : modules ) {
|
||||
Logger.d( TAG, "module.getPath():" + module.getPath() + " name: " + module.getName() );
|
||||
IMoGoFunctionProvider provider = loadFunction( module.getPath() );
|
||||
if ( provider != null ) {
|
||||
mModuleFunctionProviders.put( module, provider );
|
||||
mModuleNameFunctionProviders.put( module.getName(), provider );
|
||||
final List<MogoModule> modules = MogoModulePaths.getModuleFunctions();
|
||||
if (modules != null && !modules.isEmpty()) {
|
||||
for (MogoModule module : modules) {
|
||||
CallerLogger.INSTANCE.d(M_MAIN + TAG, "module.getPath():" + module.getPath() + " name: " + module.getName());
|
||||
IMoGoFunctionProvider provider = loadFunction(module.getPath());
|
||||
if (provider != null) {
|
||||
mModuleFunctionProviders.put(module, provider);
|
||||
mModuleNameFunctionProviders.put(module.getName(), provider);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -114,14 +116,14 @@ public class MogoModulesManager implements MogoModulesHandler {
|
||||
|
||||
@Override
|
||||
public void loadFunctionModulesServer() {
|
||||
final List< MogoModule > modules = MogoModulePaths.getModuleFunctionServers();
|
||||
if ( modules != null && !modules.isEmpty() ) {
|
||||
for ( MogoModule module : modules ) {
|
||||
Logger.d( TAG, "module.getPath():" + module.getPath() + " name: " + module.getName() );
|
||||
IMoGoFunctionServerProvider provider = loadFunctionServer( module.getPath() );
|
||||
if ( provider != null ) {
|
||||
mModuleFunctionServerProviders.put( module, provider );
|
||||
mModuleNameFunctionServerProviders.put( module.getName(), provider );
|
||||
final List<MogoModule> modules = MogoModulePaths.getModuleFunctionServers();
|
||||
if (modules != null && !modules.isEmpty()) {
|
||||
for (MogoModule module : modules) {
|
||||
CallerLogger.INSTANCE.d(M_MAIN + TAG, "module.getPath():" + module.getPath() + " name: " + module.getName());
|
||||
IMoGoFunctionServerProvider provider = loadFunctionServer(module.getPath());
|
||||
if (provider != null) {
|
||||
mModuleFunctionServerProviders.put(module, provider);
|
||||
mModuleNameFunctionServerProviders.put(module.getName(), provider);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -129,124 +131,124 @@ public class MogoModulesManager implements MogoModulesHandler {
|
||||
|
||||
@Override
|
||||
public void loadBaseModule() {
|
||||
List< MogoModule > baseModules = MogoModulePaths.getBaseModules();
|
||||
for ( MogoModule baseModule : baseModules ) {
|
||||
if ( baseModule == null ) {
|
||||
List<MogoModule> baseModules = MogoModulePaths.getBaseModules();
|
||||
for (MogoModule baseModule : baseModules) {
|
||||
if (baseModule == null) {
|
||||
continue;
|
||||
}
|
||||
Logger.d( TAG, "加载基本模块:%s", baseModule.getPath() );
|
||||
loadBaseProvider( baseModule.getPath() );
|
||||
CallerLogger.INSTANCE.d(M_MAIN + TAG, "加载基本模块 : " + baseModule.getPath());
|
||||
loadBaseProvider(baseModule.getPath());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private IProvider loadBaseProvider(String path ) {
|
||||
private IProvider loadBaseProvider(String path) {
|
||||
try {
|
||||
return ( IProvider ) ARouter.getInstance().build( path ).navigation( getContext() );
|
||||
} catch ( Exception e ) {
|
||||
return (IProvider) ARouter.getInstance().build(path).navigation(getContext());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private IMogoModuleProvider load( String path ) {
|
||||
private IMogoModuleProvider load(String path) {
|
||||
try {
|
||||
return ( IMogoModuleProvider ) ARouter.getInstance().build( path ).navigation( getContext() );
|
||||
} catch ( Exception e ) {
|
||||
return (IMogoModuleProvider) ARouter.getInstance().build(path).navigation(getContext());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private IMoGoFunctionProvider loadFunction( String path ) {
|
||||
private IMoGoFunctionProvider loadFunction(String path) {
|
||||
try {
|
||||
return ( IMoGoFunctionProvider ) ARouter.getInstance().build( path ).navigation( getContext() );
|
||||
} catch ( Exception e ) {
|
||||
return (IMoGoFunctionProvider) ARouter.getInstance().build(path).navigation(getContext());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private IMoGoFunctionServerProvider loadFunctionServer(String path ) {
|
||||
private IMoGoFunctionServerProvider loadFunctionServer(String path) {
|
||||
try {
|
||||
return ( IMoGoFunctionServerProvider ) ARouter.getInstance().build( path ).navigation( getContext() );
|
||||
} catch ( Exception e ) {
|
||||
return (IMoGoFunctionServerProvider) ARouter.getInstance().build(path).navigation(getContext());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private void addFragment( IMogoModuleProvider provider, int containerId ) {
|
||||
if ( provider == null ) {
|
||||
Logger.e( TAG, "add fragment fail cause provider == null, container is %s", ResourcesHelper.getResNameById( getApplicationContext(), containerId ) );
|
||||
private void addFragment(IMogoModuleProvider provider, int containerId) {
|
||||
if (provider == null) {
|
||||
CallerLogger.INSTANCE.e(M_MAIN + TAG, "add fragment fail cause provider == null, container is " + ResourcesHelper.getResNameById(getApplicationContext(), containerId));
|
||||
return;
|
||||
}
|
||||
Fragment fragment = null;
|
||||
fragment = mActivity.getSupportFragmentManager().findFragmentByTag( provider.getModuleName() );
|
||||
if ( fragment == null ) {
|
||||
fragment = provider.createFragment( getContext(), null );
|
||||
fragment = mActivity.getSupportFragmentManager().findFragmentByTag(provider.getModuleName());
|
||||
if (fragment == null) {
|
||||
fragment = provider.createFragment(getContext(), null);
|
||||
}
|
||||
if ( fragment == null ) {
|
||||
Logger.e( TAG, "add fragment fail cause fragment == null, container is %s", ResourcesHelper.getResNameById( getApplicationContext(), containerId ) );
|
||||
if (fragment == null) {
|
||||
CallerLogger.INSTANCE.e(M_MAIN + TAG, "add fragment fail cause fragment == null, container is " + ResourcesHelper.getResNameById(getApplicationContext(), containerId));
|
||||
return;
|
||||
}
|
||||
mActivity.getSupportFragmentManager().beginTransaction()
|
||||
.replace( containerId, fragment, provider.getModuleName() )
|
||||
.replace(containerId, fragment, provider.getModuleName())
|
||||
.commitAllowingStateLoss();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
if ( mModuleNameProviders != null ) {
|
||||
Collection< IMogoModuleProvider > modules = mModuleNameProviders.values();
|
||||
if ( modules != null ) {
|
||||
for ( IMogoModuleProvider module : modules ) {
|
||||
if (mModuleNameProviders != null) {
|
||||
Collection<IMogoModuleProvider> modules = mModuleNameProviders.values();
|
||||
if (modules != null) {
|
||||
for (IMogoModuleProvider module : modules) {
|
||||
try {
|
||||
Logger.d( TAG, "destroy module: " + module.getModuleName() );
|
||||
CallerLogger.INSTANCE.d(M_MAIN + TAG, "destroy module: " + module.getModuleName());
|
||||
module.onDestroy();
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "onDestroy" );
|
||||
} catch (Exception e) {
|
||||
CallerLogger.INSTANCE.e(M_MAIN + TAG, e + " onDestroy");
|
||||
}
|
||||
}
|
||||
}
|
||||
mModuleNameProviders.clear();
|
||||
}
|
||||
if ( mModuleProviders != null ) {
|
||||
if (mModuleProviders != null) {
|
||||
mModuleProviders.clear();
|
||||
}
|
||||
if ( mModuleFunctionProviders != null ) {
|
||||
Collection< IMoGoFunctionProvider > modules = mModuleFunctionProviders.values();
|
||||
if ( modules != null ) {
|
||||
for ( IMoGoFunctionProvider module : modules ) {
|
||||
if (mModuleFunctionProviders != null) {
|
||||
Collection<IMoGoFunctionProvider> modules = mModuleFunctionProviders.values();
|
||||
if (modules != null) {
|
||||
for (IMoGoFunctionProvider module : modules) {
|
||||
try {
|
||||
Logger.d( TAG, "destroy module: " + module.getFunctionName() );
|
||||
CallerLogger.INSTANCE.d(M_MAIN + TAG, "destroy module: " + module.getFunctionName());
|
||||
module.onDestroy();
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "onDestroy" );
|
||||
} catch (Exception e) {
|
||||
CallerLogger.INSTANCE.e(M_MAIN + TAG, e + " onDestroy");
|
||||
}
|
||||
}
|
||||
}
|
||||
mModuleNameFunctionProviders.clear();
|
||||
}
|
||||
if ( mModuleFunctionProviders != null ) {
|
||||
if (mModuleFunctionProviders != null) {
|
||||
mModuleFunctionProviders.clear();
|
||||
}
|
||||
if ( mModuleFunctionServerProviders != null ) {
|
||||
Collection< IMoGoFunctionServerProvider > modules = mModuleFunctionServerProviders.values();
|
||||
if ( modules != null ) {
|
||||
for ( IMoGoFunctionServerProvider module : modules ) {
|
||||
if (mModuleFunctionServerProviders != null) {
|
||||
Collection<IMoGoFunctionServerProvider> modules = mModuleFunctionServerProviders.values();
|
||||
if (modules != null) {
|
||||
for (IMoGoFunctionServerProvider module : modules) {
|
||||
try {
|
||||
Logger.d( TAG, "destroy module: " + module.getFunctionName() );
|
||||
CallerLogger.INSTANCE.d(M_MAIN + TAG, "destroy module: " + module.getFunctionName());
|
||||
module.onDestroy();
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "onDestroy" );
|
||||
} catch (Exception e) {
|
||||
CallerLogger.INSTANCE.e(M_MAIN + TAG, e + " onDestroy");
|
||||
}
|
||||
}
|
||||
}
|
||||
mModuleNameFunctionProviders.clear();
|
||||
}
|
||||
if ( mModuleFunctionServerProviders != null ) {
|
||||
if (mModuleFunctionServerProviders != null) {
|
||||
mModuleFunctionServerProviders.clear();
|
||||
}
|
||||
mActivity = null;
|
||||
|
||||
@@ -11,7 +11,6 @@ import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
import com.mogo.eagle.core.network.RequestOptions;
|
||||
import com.mogo.eagle.core.network.SubscribeImpl;
|
||||
import com.mogo.eagle.core.network.utils.GsonUtil;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.eagle.core.utilcode.util.NetworkUtils;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
|
||||
@@ -25,7 +24,6 @@ import okhttp3.RequestBody;
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public class DelayCheckUtil implements Handler.Callback {
|
||||
private static final String TAG = "DelayCheckUtil";
|
||||
private final Handler handler = new Handler(this);
|
||||
|
||||
private static final int MSG_CHECK_NET_CONNECT_STATUS = 1001;
|
||||
@@ -51,11 +49,10 @@ public class DelayCheckUtil implements Handler.Callback {
|
||||
* 每5s检查一下网络状态,网络状态为连接状态时,开始空接口请求以及后续的参数上报
|
||||
*/
|
||||
public void waitingForCheck() {
|
||||
Logger.d(TAG, "waitingForCheck===");
|
||||
handler.sendEmptyMessageDelayed(MSG_CHECK_NET_CONNECT_STATUS, FIRST_CHECK_NET_CONNECT_STATUS_DELAY);
|
||||
}
|
||||
|
||||
private long requestTime, netDelay, requestStartSystemTime,requestEndSystem;
|
||||
private long requestTime, netDelay, requestStartSystemTime, requestEndSystem;
|
||||
|
||||
@Override
|
||||
public boolean handleMessage(Message msg) {
|
||||
@@ -77,43 +74,40 @@ public class DelayCheckUtil implements Handler.Callback {
|
||||
}
|
||||
|
||||
private void startEmptyRequest() {
|
||||
Logger.d(TAG, "start empty request");
|
||||
requestTime = SystemClock.elapsedRealtime();
|
||||
requestStartSystemTime = System.currentTimeMillis();
|
||||
MogoApisHandler.getInstance().getApis().getNetworkApi()
|
||||
.create(DelayCheckApiServices.class, DelayCheckHttpConstant.getBaseUrl())
|
||||
.emptyInterface().subscribeOn(Schedulers.io()).observeOn(Schedulers.io())
|
||||
.subscribe(new SubscribeImpl<BaseData>(RequestOptions.create(context)) {
|
||||
@Override
|
||||
public void onSuccess(BaseData o) {
|
||||
super.onSuccess(o);
|
||||
requestEndSystem = System.currentTimeMillis();
|
||||
netDelay = SystemClock.elapsedRealtime() - requestTime;
|
||||
startUpload();
|
||||
}
|
||||
@Override
|
||||
public void onSuccess(BaseData o) {
|
||||
super.onSuccess(o);
|
||||
requestEndSystem = System.currentTimeMillis();
|
||||
netDelay = SystemClock.elapsedRealtime() - requestTime;
|
||||
startUpload();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
super.onError(e);
|
||||
handler.sendEmptyMessageDelayed(MSG_CHECK_NET_CONNECT_STATUS, CHECK_NET_CONNECT_STATUS_DELAY);
|
||||
}
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
super.onError(e);
|
||||
handler.sendEmptyMessageDelayed(MSG_CHECK_NET_CONNECT_STATUS, CHECK_NET_CONNECT_STATUS_DELAY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String message, int code) {
|
||||
super.onError(message, code);
|
||||
handler.sendEmptyMessageDelayed(MSG_CHECK_NET_CONNECT_STATUS, CHECK_NET_CONNECT_STATUS_DELAY);
|
||||
}
|
||||
});
|
||||
@Override
|
||||
public void onError(String message, int code) {
|
||||
super.onError(message, code);
|
||||
handler.sendEmptyMessageDelayed(MSG_CHECK_NET_CONNECT_STATUS, CHECK_NET_CONNECT_STATUS_DELAY);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void startUpload() {
|
||||
Logger.d(TAG, "start upload");
|
||||
MogoLocation lastLocation = MogoApisHandler.getInstance().getApis().getMapServiceApi().getSingletonLocationClient(context).getLastKnowLocation();
|
||||
if (lastLocation == null) {
|
||||
handler.sendEmptyMessageDelayed(MSG_START_DELAY_CHECK, DELAY_CHECK_DELAY);
|
||||
return;
|
||||
}
|
||||
Logger.d(TAG, "lastLocation: " + lastLocation);
|
||||
DelayCheckUploadRequest request = new DelayCheckUploadRequest();
|
||||
request.setSn(MoGoAiCloudClientConfig.getInstance().getSn());
|
||||
request.setStartTime(requestStartSystemTime);
|
||||
@@ -131,27 +125,26 @@ public class DelayCheckUtil implements Handler.Callback {
|
||||
.create(DelayCheckApiServices.class, DelayCheckHttpConstant.getBaseUrl())
|
||||
.uploadDelayCheckData(params).observeOn(Schedulers.io()).subscribeOn(Schedulers.io())
|
||||
.subscribe(new SubscribeImpl<DelayCheckResponse>(RequestOptions.create(context)) {
|
||||
@Override
|
||||
public void onSuccess(DelayCheckResponse o) {
|
||||
super.onSuccess(o);
|
||||
Logger.d(TAG, "上报时延成功 " + o);
|
||||
DelayCheckResult result = o.getResult();
|
||||
if(result.isNecessary()) {
|
||||
handler.sendEmptyMessageDelayed(MSG_START_DELAY_CHECK, result.getBeatSeconds() * 1000);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void onSuccess(DelayCheckResponse o) {
|
||||
super.onSuccess(o);
|
||||
DelayCheckResult result = o.getResult();
|
||||
if (result.isNecessary()) {
|
||||
handler.sendEmptyMessageDelayed(MSG_START_DELAY_CHECK, result.getBeatSeconds() * 1000L);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String message, int code) {
|
||||
super.onError(message, code);
|
||||
handler.sendEmptyMessageDelayed(MSG_CHECK_NET_CONNECT_STATUS, CHECK_NET_CONNECT_STATUS_DELAY);
|
||||
}
|
||||
@Override
|
||||
public void onError(String message, int code) {
|
||||
super.onError(message, code);
|
||||
handler.sendEmptyMessageDelayed(MSG_CHECK_NET_CONNECT_STATUS, CHECK_NET_CONNECT_STATUS_DELAY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
super.onError(e);
|
||||
handler.sendEmptyMessageDelayed(MSG_CHECK_NET_CONNECT_STATUS, CHECK_NET_CONNECT_STATUS_DELAY);
|
||||
}
|
||||
});
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
super.onError(e);
|
||||
handler.sendEmptyMessageDelayed(MSG_CHECK_NET_CONNECT_STATUS, CHECK_NET_CONNECT_STATUS_DELAY);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,14 +1,16 @@
|
||||
package com.mogo.eagle.core.function.main.monitoring;
|
||||
|
||||
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_MAIN;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.util.Log;
|
||||
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
|
||||
import com.mogo.eagle.core.function.call.check.CallerCheckManager;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
|
||||
/**
|
||||
* @author liujing
|
||||
@@ -33,10 +35,10 @@ public class VehicleMonitoring implements Handler.Callback {
|
||||
|
||||
public void vehicleCheck() {
|
||||
if (AutopilotStatus == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING) {
|
||||
Log.d(TAG, "自动驾驶中...");
|
||||
CallerLogger.INSTANCE.d(M_MAIN + TAG, "自动驾驶中...");
|
||||
mHandler.sendEmptyMessageDelayed(AutopilotStatus, AUTO_CHECK_STATUS_DELAY);
|
||||
} else {
|
||||
Log.d(TAG, "非自动驾驶状态");
|
||||
CallerLogger.INSTANCE.d(M_MAIN + TAG, "非自动驾驶状态");
|
||||
//非自动驾驶状态只展示一次
|
||||
mHandler.sendEmptyMessageDelayed(AutopilotStatus, MANUAL_CHECK_STATUS_DELAY);
|
||||
}
|
||||
@@ -61,7 +63,7 @@ public class VehicleMonitoring implements Handler.Callback {
|
||||
}
|
||||
|
||||
public void vehicleMonitor() {
|
||||
Log.d(TAG, "vehicleMonitor");
|
||||
CallerLogger.INSTANCE.d(M_MAIN + TAG, "vehicleMonitor");
|
||||
CallerCheckManager.checkMonitor(mContext);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.mogo.eagle.core.function.main.service;
|
||||
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_MAIN;
|
||||
|
||||
import android.app.Service;
|
||||
import android.content.Intent;
|
||||
import android.os.IBinder;
|
||||
@@ -10,16 +12,16 @@ import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.eagle.core.data.config.HdMapBuildConfig;
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.function.main.EventDispatchCenter;
|
||||
import com.mogo.eagle.core.function.main.cards.MogoModulesManager;
|
||||
import com.mogo.eagle.core.function.main.delaycheck.DelayCheckUtil;
|
||||
import com.mogo.eagle.core.function.main.monitoring.VehicleMonitoring;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.map.location.IMogoLocationClient;
|
||||
import com.mogo.map.location.IMogoLocationListener;
|
||||
import com.mogo.map.navi.MogoCarLocationChangedListenerRegister;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.eagle.core.function.main.EventDispatchCenter;
|
||||
import com.mogo.eagle.core.function.main.cards.MogoModulesManager;
|
||||
import com.mogo.eagle.core.function.main.delaycheck.DelayCheckUtil;
|
||||
import com.mogo.eagle.core.function.main.monitoring.VehicleMonitoring;
|
||||
import com.mogo.service.IMogoServiceApis;
|
||||
|
||||
public
|
||||
@@ -42,11 +44,11 @@ class MogoMainService extends Service implements IMogoLocationListener {
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
Logger.d(TAG, "基本服务启动");
|
||||
CallerLogger.INSTANCE.d(M_MAIN + TAG, "基本服务启动");
|
||||
mServiceApis = MogoApisHandler.getInstance().getApis();
|
||||
initAndStartLocation();
|
||||
UiThreadHandler.postDelayed(() -> {
|
||||
Logger.d(TAG, "5秒已过,启动基础服务……");
|
||||
CallerLogger.INSTANCE.d(M_MAIN + TAG, "5秒已过,启动基础服务……");
|
||||
loadBaseModules();
|
||||
initADAS();
|
||||
initGpsSimulatorListener();
|
||||
@@ -73,7 +75,7 @@ class MogoMainService extends Service implements IMogoLocationListener {
|
||||
}
|
||||
|
||||
private void initAndStartLocation() {
|
||||
Logger.d(TAG, "开始定位");
|
||||
CallerLogger.INSTANCE.d(M_MAIN + TAG, "开始定位");
|
||||
if (mServiceApis != null) {
|
||||
mLocationClient = mServiceApis.getMapServiceApi().getSingletonLocationClient(AbsMogoApplication.getApp());
|
||||
mLocationClient.addLocationListener(this);
|
||||
@@ -85,12 +87,12 @@ class MogoMainService extends Service implements IMogoLocationListener {
|
||||
* 初始化自车定位监听
|
||||
*/
|
||||
private void initGpsSimulatorListener() {
|
||||
Logger.d(TAG, "注册自车位置监听");
|
||||
CallerLogger.INSTANCE.d(M_MAIN + TAG, "注册自车位置监听");
|
||||
MogoCarLocationChangedListenerRegister.getInstance().registerCarLocationChangedListener(EventDispatchCenter.getInstance());
|
||||
}
|
||||
|
||||
private void loadBaseModules() {
|
||||
Logger.d(TAG, "加载基本模块");
|
||||
CallerLogger.INSTANCE.d(M_MAIN + TAG, "加载基本模块");
|
||||
MogoModulesManager.getInstance().loadBaseModule();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
package com.mogo.eagle.core.function.main.windowview;
|
||||
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_MAIN;
|
||||
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
|
||||
|
||||
/**
|
||||
@@ -16,7 +18,7 @@ import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
*/
|
||||
public class FloatingViewHandler {
|
||||
|
||||
private static final String TAG = "WindowViewHandler";
|
||||
private static final String TAG = "FloatingViewHandler";
|
||||
|
||||
/**
|
||||
* 上次显示的优先级
|
||||
@@ -38,11 +40,11 @@ public class FloatingViewHandler {
|
||||
|
||||
private static FrameLayout sFloatingLayout = null;
|
||||
|
||||
public static void init( FrameLayout frameLayout ) {
|
||||
public static void init(FrameLayout frameLayout) {
|
||||
sFloatingLayout = frameLayout;
|
||||
}
|
||||
|
||||
public static void clear(){
|
||||
public static void clear() {
|
||||
sFloatingLayout = null;
|
||||
}
|
||||
|
||||
@@ -54,20 +56,20 @@ public class FloatingViewHandler {
|
||||
* @param y
|
||||
* @param movable
|
||||
*/
|
||||
public static void addView( View view, int x, int y, boolean movable ) {
|
||||
if ( view == null ) {
|
||||
public static void addView(View view, int x, int y, boolean movable) {
|
||||
if (view == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( sFloatingLayout == null ) {
|
||||
Logger.e( TAG, "no floating frame. " );
|
||||
if (sFloatingLayout == null) {
|
||||
CallerLogger.INSTANCE.e(M_MAIN + TAG, "no floating frame. ");
|
||||
return;
|
||||
}
|
||||
|
||||
FrameLayout.LayoutParams params = new FrameLayout.LayoutParams( ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT );
|
||||
FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
params.leftMargin = x;
|
||||
params.topMargin = y;
|
||||
sFloatingLayout.addView( view, params );
|
||||
sFloatingLayout.addView(view, params);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -77,16 +79,16 @@ public class FloatingViewHandler {
|
||||
* @param params
|
||||
* @param movable
|
||||
*/
|
||||
public static void addView( View view, FrameLayout.LayoutParams params, boolean movable ) {
|
||||
if ( view == null ) {
|
||||
public static void addView(View view, FrameLayout.LayoutParams params, boolean movable) {
|
||||
if (view == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( sFloatingLayout == null ) {
|
||||
Logger.e( TAG, "no floating frame. " );
|
||||
if (sFloatingLayout == null) {
|
||||
CallerLogger.INSTANCE.e(M_MAIN + TAG, "no floating frame. ");
|
||||
return;
|
||||
}
|
||||
sFloatingLayout.addView( view, params );
|
||||
sFloatingLayout.addView(view, params);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -98,27 +100,27 @@ public class FloatingViewHandler {
|
||||
* @param y
|
||||
* @param movable
|
||||
*/
|
||||
public static void addView( View view, int priority, int x, int y, boolean movable ) {
|
||||
if ( view == null ) {
|
||||
public static void addView(View view, int priority, int x, int y, boolean movable) {
|
||||
if (view == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( sFloatingLayout == null ) {
|
||||
Logger.e( TAG, "no floating frame. " );
|
||||
if (sFloatingLayout == null) {
|
||||
CallerLogger.INSTANCE.e(M_MAIN + TAG, "no floating frame. ");
|
||||
return;
|
||||
}
|
||||
|
||||
if ( sView == view ) {
|
||||
Logger.w( TAG, "改布局已添加且没有移除,不操作" );
|
||||
if (sView == view) {
|
||||
CallerLogger.INSTANCE.w(M_MAIN + TAG, "改布局已添加且没有移除,不操作");
|
||||
return;
|
||||
}
|
||||
|
||||
if ( sView != null ) {
|
||||
if ( priority < sPriority ) {
|
||||
Logger.w( TAG, "过滤低优先级布局" );
|
||||
if (sView != null) {
|
||||
if (priority < sPriority) {
|
||||
CallerLogger.INSTANCE.w(M_MAIN + TAG, "过滤低优先级布局");
|
||||
return;
|
||||
}
|
||||
sFloatingLayout.removeView( sView );
|
||||
sFloatingLayout.removeView(sView);
|
||||
}
|
||||
sView = view;
|
||||
sMovable = movable;
|
||||
@@ -136,27 +138,27 @@ public class FloatingViewHandler {
|
||||
* @param params
|
||||
* @param movable
|
||||
*/
|
||||
public static void addView( View view, int priority, FrameLayout.LayoutParams params, boolean movable ) {
|
||||
if ( view == null ) {
|
||||
public static void addView(View view, int priority, FrameLayout.LayoutParams params, boolean movable) {
|
||||
if (view == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( sFloatingLayout == null ) {
|
||||
Logger.e( TAG, "no floating frame. " );
|
||||
if (sFloatingLayout == null) {
|
||||
CallerLogger.INSTANCE.e(M_MAIN + TAG, "no floating frame. ");
|
||||
return;
|
||||
}
|
||||
|
||||
if ( sView == view ) {
|
||||
Logger.w( TAG, "改布局已添加且没有移除,不操作" );
|
||||
if (sView == view) {
|
||||
CallerLogger.INSTANCE.w(M_MAIN + TAG, "改布局已添加且没有移除,不操作");
|
||||
return;
|
||||
}
|
||||
|
||||
if ( sView != null ) {
|
||||
if ( priority < sPriority ) {
|
||||
Logger.w( TAG, "过滤低优先级布局" );
|
||||
if (sView != null) {
|
||||
if (priority < sPriority) {
|
||||
CallerLogger.INSTANCE.w(M_MAIN + TAG, "过滤低优先级布局");
|
||||
return;
|
||||
}
|
||||
sFloatingLayout.removeView( sView );
|
||||
sFloatingLayout.removeView(sView);
|
||||
}
|
||||
sView = view;
|
||||
sMovable = movable;
|
||||
@@ -165,15 +167,15 @@ public class FloatingViewHandler {
|
||||
addView();
|
||||
}
|
||||
|
||||
public static void removeView( View view ) {
|
||||
if ( sFloatingLayout == null ) {
|
||||
public static void removeView(View view) {
|
||||
if (sFloatingLayout == null) {
|
||||
return;
|
||||
}
|
||||
if ( view == null ) {
|
||||
if (view == null) {
|
||||
return;
|
||||
}
|
||||
sFloatingLayout.removeView( view );
|
||||
if ( sView == view ) {
|
||||
sFloatingLayout.removeView(view);
|
||||
if (sView == view) {
|
||||
sView = null;
|
||||
sPriority = Integer.MIN_VALUE;
|
||||
sMovable = false;
|
||||
@@ -182,34 +184,34 @@ public class FloatingViewHandler {
|
||||
}
|
||||
|
||||
private static void addView() {
|
||||
if ( sView == null ) {
|
||||
if (sView == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
FrameLayout.LayoutParams params = sParams;
|
||||
if ( params == null ) {
|
||||
params = new FrameLayout.LayoutParams( ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT );
|
||||
if (params == null) {
|
||||
params = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
params.leftMargin = sX;
|
||||
params.topMargin = sY;
|
||||
}
|
||||
sFloatingLayout.addView( sView, params );
|
||||
sFloatingLayout.addView(sView, params);
|
||||
}
|
||||
|
||||
public static void attachMovementEvent( View view, WindowManager.LayoutParams params ) {
|
||||
if ( view == null ) {
|
||||
public static void attachMovementEvent(View view, WindowManager.LayoutParams params) {
|
||||
if (view == null) {
|
||||
return;
|
||||
}
|
||||
view.setOnTouchListener( ( v, event ) -> {
|
||||
view.setOnTouchListener((v, event) -> {
|
||||
DispatchTouchEventWrapper.getInstance()
|
||||
.attach( view, params )
|
||||
.handle( event );
|
||||
.attach(view, params)
|
||||
.handle(event);
|
||||
return false;
|
||||
} );
|
||||
});
|
||||
}
|
||||
|
||||
public static void setVisible( boolean visible ) {
|
||||
if ( sFloatingLayout != null ) {
|
||||
sFloatingLayout.setVisibility( visible ? View.VISIBLE : View.INVISIBLE );
|
||||
public static void setVisible(boolean visible) {
|
||||
if (sFloatingLayout != null) {
|
||||
sFloatingLayout.setVisibility(visible ? View.VISIBLE : View.INVISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,14 +8,14 @@ import com.mogo.cloud.passport.MoGoAiCloudClient
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
|
||||
import com.mogo.commons.debug.DebugConfig
|
||||
import com.mogo.eagle.core.data.constants.MogoServicePaths
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_MAP
|
||||
import com.mogo.eagle.core.data.map.MogoLocation
|
||||
import com.mogo.eagle.core.function.api.map.collect.IMoGoMapDataCollectProvider
|
||||
import com.mogo.eagle.core.function.api.map.listener.IMoGoMapLocationListener
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapLocationListenerManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
|
||||
import com.zhidaoauto.map.operational.open.GatherApi
|
||||
import com.zhidaoauto.map.operational.open.GatherParams
|
||||
import com.zhidaoauto.map.operational.open.GatherParams.Companion
|
||||
import com.zhidaoauto.map.operational.open.abs.OnTaskListener
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
import java.util.concurrent.CopyOnWriteArrayList
|
||||
@@ -40,7 +40,7 @@ class MoGoMapDataCollectProvider : IMoGoMapDataCollectProvider, OnTaskListener,
|
||||
ConcurrentHashMap()
|
||||
}
|
||||
|
||||
override val functionName: String = TAG
|
||||
override val functionName: String = "$M_MAP$TAG"
|
||||
|
||||
@Volatile
|
||||
private var hasInit = false
|
||||
@@ -60,20 +60,20 @@ class MoGoMapDataCollectProvider : IMoGoMapDataCollectProvider, OnTaskListener,
|
||||
executor.get()?.setCarSn(carSn)
|
||||
}
|
||||
MoGoAiCloudClient.getInstance().addTokenCallbacks(this)
|
||||
Logger.d(TAG, "--------- init --------")
|
||||
Logger.d(TAG, "executor: ${ executor.get()?.hashCode() ?: 0 }")
|
||||
CallerLogger.d("$M_MAP$TAG", "--------- init --------")
|
||||
CallerLogger.d("$M_MAP$TAG", "executor: ${ executor.get()?.hashCode() ?: 0 }")
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
CallerMapLocationListenerManager.removeListener(TAG)
|
||||
Logger.d(TAG, "--------- onDestroy --------")
|
||||
CallerMapLocationListenerManager.removeListener("$M_MAP$TAG")
|
||||
CallerLogger.d("$M_MAP$TAG", "--------- onDestroy --------")
|
||||
executor.get()?.setOnTaskListener(null)
|
||||
listeners.clear()
|
||||
map.clear()
|
||||
}
|
||||
|
||||
override fun registerOnMapCollectTaskListener(listener: IMoGoMapDataCollectProvider.OnMapCollectCmdListener?) {
|
||||
Logger.d(TAG, "--------- registerOnMapCollectTaskListener --------")
|
||||
CallerLogger.d("$M_MAP$TAG", "--------- registerOnMapCollectTaskListener --------")
|
||||
listener ?: return
|
||||
if (listeners.contains(listener)) {
|
||||
return
|
||||
@@ -82,7 +82,7 @@ class MoGoMapDataCollectProvider : IMoGoMapDataCollectProvider, OnTaskListener,
|
||||
}
|
||||
|
||||
override fun unRegisterOnMapCollectTaskListener(listener: IMoGoMapDataCollectProvider.OnMapCollectCmdListener?) {
|
||||
Logger.d(TAG, "--------- unRegisterOnMapCollectTaskListener --------")
|
||||
CallerLogger.d("$M_MAP$TAG", "--------- unRegisterOnMapCollectTaskListener --------")
|
||||
listener ?: return
|
||||
if (!listeners.contains(listener)) {
|
||||
return
|
||||
@@ -97,40 +97,40 @@ class MoGoMapDataCollectProvider : IMoGoMapDataCollectProvider, OnTaskListener,
|
||||
videoPath: String,
|
||||
reason: String
|
||||
) {
|
||||
Logger.d(TAG, "-- finish:[$id, $state, $gpsPath, $videoPath, $reason]")
|
||||
CallerLogger.d("$M_MAP$TAG", "-- finish:[$id, $state, $gpsPath, $videoPath, $reason]")
|
||||
try {
|
||||
if (isInValidStatus()) {
|
||||
Logger.w(TAG, "-- finish: 状态无效")
|
||||
CallerLogger.w("$M_MAP$TAG", "-- finish: 状态无效")
|
||||
return
|
||||
}
|
||||
if (!map.containsKey(id)) {
|
||||
Logger.w(TAG, "-- finish: 无相关指令")
|
||||
CallerLogger.w("$M_MAP$TAG", "-- finish: 无相关指令")
|
||||
return
|
||||
}
|
||||
Logger.d(TAG, "-- finish: 结束任务[$id]")
|
||||
CallerLogger.d("$M_MAP$TAG", "-- finish: 结束任务[$id]")
|
||||
executor.get()?.finishTask(id, state, gpsPath, videoPath, reason)
|
||||
} catch (e : Throwable) {
|
||||
e.printStackTrace()
|
||||
Logger.e(TAG, "-- finish:\n$e");
|
||||
CallerLogger.e("$M_MAP$TAG", "-- finish:\n$e")
|
||||
} finally {
|
||||
map[id] = Status.FINISH
|
||||
}
|
||||
}
|
||||
|
||||
override fun onTaskFinish(id: Int, time: Long) {
|
||||
Logger.d(TAG, "地图模块下发结束采集指令 -> [$id, $time]")
|
||||
CallerLogger.d("$M_MAP$TAG", "地图模块下发结束采集指令 -> [$id, $time]")
|
||||
if (!map.containsKey(id) || map[id] == Status.FINISH) {
|
||||
Logger.w(TAG, "地图模块下发结束采集指令 -> 任务[$id]已经提前完成,无需再次请求自动驾驶模块结束采集")
|
||||
CallerLogger.w("$M_MAP$TAG", "地图模块下发结束采集指令 -> 任务[$id]已经提前完成,无需再次请求自动驾驶模块结束采集")
|
||||
return
|
||||
}
|
||||
Logger.d(TAG, "地图模块下发结束采集指令 -> [$id, $time] -> 调用自动驾驶模块,结束数据采集")
|
||||
CallerLogger.d("$M_MAP$TAG", "地图模块下发结束采集指令 -> [$id, $time] -> 调用自动驾驶模块,结束数据采集")
|
||||
listeners.forEach {
|
||||
it.onMapCollectEnd(id, time)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onTaskStart(id: Int, time: Long) {
|
||||
Logger.d(TAG, "地图模块下发开始采集指令 -> [$id, $time]")
|
||||
CallerLogger.d("$M_MAP$TAG", "地图模块下发开始采集指令 -> [$id, $time]")
|
||||
map[id] = Status.INIT
|
||||
listeners.forEach {
|
||||
it.onMapCollectStart(id, time)
|
||||
@@ -142,7 +142,7 @@ class MoGoMapDataCollectProvider : IMoGoMapDataCollectProvider, OnTaskListener,
|
||||
if (!hasInit) {
|
||||
executor.get()?.also {
|
||||
hasInit = true
|
||||
Logger.d(TAG, "告之地图sdk,定义数据可以用了")
|
||||
CallerLogger.d("$M_MAP$TAG", "告之地图sdk,定义数据可以用了")
|
||||
it.setIsInit()
|
||||
}
|
||||
}
|
||||
@@ -177,7 +177,7 @@ class MoGoMapDataCollectProvider : IMoGoMapDataCollectProvider, OnTaskListener,
|
||||
}
|
||||
|
||||
override fun onTokenGot(token: String?, sn: String?) {
|
||||
Logger.d(TAG, "-- onTokenGot --> $sn")
|
||||
CallerLogger.d("$M_MAP$TAG", "-- onTokenGot --> $sn")
|
||||
sn?.let {
|
||||
executor.get()?.setCarSn(it)
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@ import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.commons.mvp.MvpFragment;
|
||||
import com.mogo.eagle.core.data.constants.MoGoFragmentPaths;
|
||||
import com.mogo.eagle.core.function.api.map.hd.IMoGoMapFragmentProvider;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.map.IMogoMap;
|
||||
import com.mogo.map.IMogoUiSettings;
|
||||
import com.mogo.map.MogoMapView;
|
||||
@@ -35,7 +34,7 @@ public class MapFragment extends MvpFragment< MapView, MapPresenter >
|
||||
private MogoMapView mMogoMapView;
|
||||
private IMogoMap mMogoMap;
|
||||
|
||||
private boolean mIsControllerByOthersStatus = false;
|
||||
private final boolean mIsControllerByOthersStatus = false;
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
@@ -96,7 +95,6 @@ public class MapFragment extends MvpFragment< MapView, MapPresenter >
|
||||
@Override
|
||||
public void onActivityCreated( @Nullable Bundle savedInstanceState ) {
|
||||
super.onActivityCreated( savedInstanceState );
|
||||
Logger.d( TAG, "onActivityCreated" );
|
||||
initMapView();
|
||||
}
|
||||
|
||||
@@ -236,8 +234,6 @@ public class MapFragment extends MvpFragment< MapView, MapPresenter >
|
||||
angle = 16.5f;
|
||||
}
|
||||
return angle;
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
package com.mogo.eagle.core.function.smp;
|
||||
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_MAP;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.location.Location;
|
||||
import android.os.Bundle;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
@@ -32,11 +33,11 @@ import com.mogo.cloud.commons.utils.CoordinateUtils;
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
import com.mogo.eagle.core.function.api.map.listener.IMoGoMapLocationListener;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapLocationListenerManager;
|
||||
import com.mogo.eagle.core.function.map.R;
|
||||
import com.mogo.eagle.core.utilcode.mogo.MapAssetStyleUtils;
|
||||
import com.mogo.eagle.core.function.smp.view.ISmallMapDirectionView;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.eagle.core.widget.RoundLayout;
|
||||
import com.mogo.module.common.utils.DrivingDirectionUtils;
|
||||
|
||||
@@ -64,8 +65,8 @@ public class SmallMapDirectionView
|
||||
private Marker mEndMarker;
|
||||
|
||||
private int zoomLevel = 15;
|
||||
private List<LatLng> mCoordinatesLatLng = new ArrayList<>();
|
||||
private List<MogoLatLng> mCoordinatesLatLngCurrent = new ArrayList<>();
|
||||
private final List<LatLng> mCoordinatesLatLng = new ArrayList<>();
|
||||
private final List<MogoLatLng> mCoordinatesLatLngCurrent = new ArrayList<>();
|
||||
private Polyline mPolyline;
|
||||
private CameraUpdate mCameraUpdate;
|
||||
private Context mContext;
|
||||
@@ -88,11 +89,10 @@ public class SmallMapDirectionView
|
||||
}
|
||||
|
||||
private void initView(Context context) {
|
||||
Logger.d(TAG, "initView");
|
||||
mContext = context;
|
||||
View smpView = LayoutInflater.from(context).inflate(R.layout.module_small_map_view, this);
|
||||
|
||||
mAMapNaviView = (TextureMapView) smpView.findViewById(R.id.aMapNaviView);
|
||||
mAMapNaviView = smpView.findViewById(R.id.aMapNaviView);
|
||||
// rlSmallMapBorder = findViewById(R.id.rlSmallMapBorder);
|
||||
// rlSmallMapBorder.addView(mAMapNaviView);
|
||||
|
||||
@@ -141,19 +141,16 @@ public class SmallMapDirectionView
|
||||
uiSettings.setAllGesturesEnabled(false);// 所有手势
|
||||
uiSettings.setMyLocationButtonEnabled(false); // 显示默认的定位按钮
|
||||
uiSettings.setLogoBottomMargin(-150); //设置Logo下边界距离屏幕底部的边距,设置为负值即可
|
||||
mAMap.setOnMapLoadedListener(new AMap.OnMapLoadedListener() {
|
||||
@Override
|
||||
public void onMapLoaded() {
|
||||
Logger.d(TAG, "smp---onMapLoaded");
|
||||
// 加载自定义样式
|
||||
CustomMapStyleOptions customMapStyleOptions = new CustomMapStyleOptions()
|
||||
.setEnable(true)
|
||||
.setStyleData(MapAssetStyleUtils.getAssetsStyle(getContext()))
|
||||
.setStyleExtraData(MapAssetStyleUtils.getAssetsExtraStyle(getContext()));
|
||||
// 设置自定义样式
|
||||
mAMap.setCustomMapStyle(customMapStyleOptions);
|
||||
mAMapNaviView.getMap().setPointToCenter(mAMapNaviView.getWidth() / 2, mAMapNaviView.getHeight() / 2);
|
||||
}
|
||||
mAMap.setOnMapLoadedListener(() -> {
|
||||
CallerLogger.INSTANCE.d(M_MAP + TAG, "smp---onMapLoaded");
|
||||
// 加载自定义样式
|
||||
CustomMapStyleOptions customMapStyleOptions1 = new CustomMapStyleOptions()
|
||||
.setEnable(true)
|
||||
.setStyleData(MapAssetStyleUtils.getAssetsStyle(getContext()))
|
||||
.setStyleExtraData(MapAssetStyleUtils.getAssetsExtraStyle(getContext()));
|
||||
// 设置自定义样式
|
||||
mAMap.setCustomMapStyle(customMapStyleOptions1);
|
||||
mAMapNaviView.getMap().setPointToCenter(mAMapNaviView.getWidth() / 2, mAMapNaviView.getHeight() / 2);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -166,8 +163,7 @@ public class SmallMapDirectionView
|
||||
|
||||
@Override
|
||||
public void onLocationChanged(@Nullable MogoLocation location) {
|
||||
//Logger.d(TAG, "onCarLocationChanged2 :" + location.getLatitude()+":"+location.getLongitude());
|
||||
if (location == null){
|
||||
if (location == null) {
|
||||
return;
|
||||
}
|
||||
LatLng currentLatLng = new LatLng(location.getLatitude(), location.getLongitude());
|
||||
@@ -192,15 +188,13 @@ public class SmallMapDirectionView
|
||||
// 与结束位置进行 GeoHash 0-12
|
||||
// GeoHash endGeoHash = GeoHash.withCharacterPrecision(endLatLng.latitude, endLatLng.longitude, 7);
|
||||
// GeoHash currentGeoHash = GeoHash.withCharacterPrecision(currentLatLng.latitude, currentLatLng.longitude, 7);
|
||||
// Log.d(MODULE_NAME, "currentGeoHash=" + currentGeoHash);
|
||||
// Log.d(MODULE_NAME, "endGeoHash=" + endGeoHash);
|
||||
|
||||
float calculateDistance = CoordinateUtils.calculateLineDistance(
|
||||
endLatLng.latitude, endLatLng.longitude,
|
||||
currentLatLng.latitude, currentLatLng.longitude
|
||||
);
|
||||
|
||||
Log.d(TAG, "calculateDistance=" + calculateDistance);
|
||||
CallerLogger.INSTANCE.d(M_MAP + TAG, "calculateDistance=" + calculateDistance);
|
||||
if (calculateDistance <= 5) {
|
||||
clearPolyline();
|
||||
mCoordinatesLatLng.clear();
|
||||
@@ -214,7 +208,7 @@ public class SmallMapDirectionView
|
||||
mAMap.moveCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));
|
||||
}
|
||||
|
||||
private void removeLoction(Location latLng) {
|
||||
private void removeLocation(Location latLng) {
|
||||
for (LatLng l : mCoordinatesLatLng) {
|
||||
if (!isPointOnCarFront(latLng, l)) {
|
||||
mCoordinatesLatLng.remove(l);
|
||||
@@ -233,11 +227,7 @@ public class SmallMapDirectionView
|
||||
int diffAngle = DrivingDirectionUtils.getDegreeOfCar2Poi(
|
||||
carLon, carLat, poiLon, poiLat, (int) carAngle);
|
||||
|
||||
if (diffAngle <= 90) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return diffAngle <= 90;
|
||||
}
|
||||
|
||||
|
||||
@@ -249,7 +239,6 @@ public class SmallMapDirectionView
|
||||
// mCoordinatesLatLng.addAll(latLngs);
|
||||
// for (LatLng coordinate : mCoordinatesLatLng) {
|
||||
// mCoordinatesLatLng.add(new LatLng(coordinate.getLat(), coordinate.getLon()));
|
||||
// Log.e("",coordinate.latitude+":"+coordinate.longitude);
|
||||
// }
|
||||
if (mAMap != null) {
|
||||
if (mCoordinatesLatLng.size() > 2) {
|
||||
@@ -288,8 +277,7 @@ public class SmallMapDirectionView
|
||||
CoordinateConverter mCoordinateConverter = new CoordinateConverter(mContext);
|
||||
mCoordinateConverter.from(CoordinateConverter.CoordType.GPS);
|
||||
mCoordinateConverter.coord(new LatLng(mogoLatLng.lat, mogoLatLng.lon));
|
||||
LatLng latLng = mCoordinateConverter.convert();
|
||||
return latLng;
|
||||
return mCoordinateConverter.convert();
|
||||
}
|
||||
|
||||
public List<LatLng> CoordinateConverterFrom84ForList(Context mContext, List<MogoLatLng> mogoLatLngList) {
|
||||
@@ -315,7 +303,7 @@ public class SmallMapDirectionView
|
||||
}
|
||||
}
|
||||
|
||||
public void resetPolyine() {
|
||||
public void resetPolyLine() {
|
||||
mCoordinatesLatLng.clear();
|
||||
if (mPolyline != null) {
|
||||
mPolyline.remove();
|
||||
|
||||
@@ -2,15 +2,11 @@ package com.mogo.eagle.core.function.smp;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.commons.mvp.BaseFragment;
|
||||
import com.mogo.eagle.core.data.autopilot.ADASTrajectoryInfo;
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotGuardianStatusInfo;
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotRouteInfo;
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotStationInfo;
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo;
|
||||
import com.mogo.eagle.core.data.constants.MoGoFragmentPaths;
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
@@ -22,11 +18,13 @@ import com.mogo.eagle.core.function.map.R;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
import mogo_msg.MogoReportMsg;
|
||||
|
||||
/**
|
||||
* @author donghongyu
|
||||
* @date 2021/5/19 10:50 上午
|
||||
@@ -136,38 +134,15 @@ public class SmallMapFragment extends BaseFragment
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotRotting(AutopilotRouteInfo routeList) {
|
||||
if (routeList.getModels() == null || routeList.getModels().size() == 0) {
|
||||
return;
|
||||
}
|
||||
List<MogoLatLng> latLngList = new ArrayList<>();
|
||||
for (AutopilotRouteInfo.RouteModels routeModel : routeList.getModels()) {
|
||||
latLngList.add(new MogoLatLng(routeModel.getLat(), routeModel.getLon()));
|
||||
}
|
||||
Log.e(TAG, "routeResult:" + latLngList.size());
|
||||
if (latLngList.size() > 0) {
|
||||
drawablePolyline(latLngList);
|
||||
} else {
|
||||
clearPolyline();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onAutopilotStatusResponse(@NotNull AutopilotStatusInfo autoPilotStatusInfo) {
|
||||
if (autoPilotStatusInfo.getControl_pilotmode() != 1){
|
||||
if (autoPilotStatusInfo.getPilotmode() != 1) {
|
||||
clearPolyline();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotArriveAtStation(@Nullable AutopilotStationInfo autopilotWayArrive) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotGuardian(@Nullable AutopilotGuardianStatusInfo guardianInfo) {
|
||||
public void onAutopilotArriveAtStation(MessagePad.ArrivalNotification arrivalNotification) {
|
||||
|
||||
}
|
||||
|
||||
@@ -175,4 +150,25 @@ public class SmallMapFragment extends BaseFragment
|
||||
public void onAutopilotSNRequest() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotGuardian(MogoReportMsg.MogoReportMessage guardianInfo) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotRotting(MessagePad.GlobalPathResp globalPathResp) {
|
||||
if (globalPathResp == null || globalPathResp.getWayPointsList().size() == 0) {
|
||||
return;
|
||||
}
|
||||
List<MogoLatLng> latLngList = new ArrayList<>();
|
||||
for (MessagePad.Location routeModel : globalPathResp.getWayPointsList()) {
|
||||
latLngList.add(new MogoLatLng(routeModel.getLatitude(), routeModel.getLongitude()));
|
||||
}
|
||||
if (latLngList.size() > 0) {
|
||||
drawablePolyline(latLngList);
|
||||
} else {
|
||||
clearPolyline();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.mogo.eagle.core.function.live;
|
||||
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_MONITOR;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
@@ -11,8 +13,8 @@ import android.widget.TextView;
|
||||
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.function.monitoring.R;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.eagle.core.widget.LiveRoundLayout;
|
||||
import com.tencent.rtmp.ITXLivePlayListener;
|
||||
import com.tencent.rtmp.TXLiveConstants;
|
||||
@@ -67,7 +69,7 @@ public class CameraLiveGSYVideoView extends LiveRoundLayout {
|
||||
mLivePlayer.enableHardwareDecode(true);
|
||||
|
||||
mLoading = findViewById(R.id.loading);
|
||||
// mLoading.getIndeterminateDrawable().setColorFilter(ContextCompat.getColor(context, R.color.module_live_video_progress_bar_loading_color), PorterDuff.Mode.MULTIPLY);
|
||||
// mLoading.getIndeterminateDrawable().setColorFilter(ContextCompat.getColor(context, R.color.module_live_video_progress_bar_loading_color), PorterDuff.Mode.MULTIPLY);
|
||||
|
||||
mClLoadError = findViewById(R.id.clLoadError);
|
||||
mTvRefreshButton = findViewById(R.id.tvRefreshButton);
|
||||
@@ -108,11 +110,11 @@ public class CameraLiveGSYVideoView extends LiveRoundLayout {
|
||||
mLivePlayer.setPlayListener(new ITXLivePlayListener() {
|
||||
@Override
|
||||
public void onPlayEvent(int event, Bundle bundle) {
|
||||
Logger.w(TAG,
|
||||
CallerLogger.INSTANCE.d(M_MONITOR + TAG,
|
||||
"直播信息= " +
|
||||
"\n播放器:onPlayEvent==" + event +
|
||||
"\nbundle===" + bundle);
|
||||
Logger.d(TAG, "liveUrl = " + liveUrl);
|
||||
"\nbundle===" + bundle +
|
||||
"liveUrl = " + liveUrl);
|
||||
if (event == TXLiveConstants.PLAY_EVT_PLAY_LOADING) {
|
||||
mLoading.setVisibility(VISIBLE);
|
||||
mClLoadError.setVisibility(GONE);
|
||||
@@ -128,13 +130,13 @@ public class CameraLiveGSYVideoView extends LiveRoundLayout {
|
||||
|
||||
@Override
|
||||
public void onNetStatus(Bundle bundle) {
|
||||
Logger.w(TAG, "播放器:onNetStatus===bundle===" + bundle);
|
||||
CallerLogger.INSTANCE.d(M_MONITOR + TAG, "播放器:onNetStatus===bundle===" + bundle);
|
||||
}
|
||||
});
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
Logger.w(TAG, "播放器:onNetStatus e = " + e);
|
||||
CallerLogger.INSTANCE.e(M_MONITOR + TAG, "播放器:onNetStatus e = " + e);
|
||||
mLoading.setVisibility(GONE);
|
||||
mClLoadError.setVisibility(VISIBLE);
|
||||
}
|
||||
@@ -142,7 +144,7 @@ public class CameraLiveGSYVideoView extends LiveRoundLayout {
|
||||
|
||||
public void stopLive(String liveUrl) {
|
||||
try {
|
||||
Logger.w(TAG, "心跳:关闭直播...");
|
||||
CallerLogger.INSTANCE.d(M_MONITOR + TAG, "心跳:关闭直播...");
|
||||
// 暂停
|
||||
mLivePlayer.pause();
|
||||
// true 代表清除最后一帧画面
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
package com.mogo.eagle.core.function.live;
|
||||
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.mogo.cloud.socket.entity.SocketDownData;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.eagle.core.function.live.impl.AbsCameraScenario;
|
||||
import com.mogo.service.windowview.IMogoTopViewStatusListener;
|
||||
|
||||
@@ -35,7 +33,6 @@ public class CameraLiveManager extends AbsCameraScenario<SocketDownData.CloudRoa
|
||||
|
||||
@Override
|
||||
public void init(@Nullable SocketDownData.CloudRoadDataProto cloudRoadData) {
|
||||
Log.d(TAG, "CameraLiveManager init -----> isShowWindow = " + isShowWindow);
|
||||
if (isShowWindow) {
|
||||
close();
|
||||
}
|
||||
@@ -51,7 +48,6 @@ public class CameraLiveManager extends AbsCameraScenario<SocketDownData.CloudRoa
|
||||
|
||||
@Override
|
||||
public void showWindow() {
|
||||
Log.d(TAG, "CameraLiveManager showWindow getV2XWindow = " + getV2XWindow());
|
||||
if (getV2XWindow() != null) {
|
||||
// ViewGroup.LayoutParams layoutParams =
|
||||
// new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
|
||||
@@ -95,19 +91,14 @@ public class CameraLiveManager extends AbsCameraScenario<SocketDownData.CloudRoa
|
||||
|
||||
@Override
|
||||
public void onViewAdded(View view) {
|
||||
Logger.d(TAG, "展示 Window 动画结束");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewRemoved(View view) {
|
||||
Logger.d(TAG, "关闭 Window 动画结束");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeViewAddAnim(View view) {
|
||||
Logger.d(TAG, "展示 Window 开始");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
package com.mogo.eagle.core.function.live;
|
||||
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_MONITOR;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.mogo.cloud.socket.entity.SocketDownData;
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.function.monitoring.R;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.eagle.core.utilcode.mogo.toast.TipToast;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.marker.IMogoMarkerClickListener;
|
||||
@@ -33,7 +34,6 @@ public class CameraLiveNoticeHelper implements IMogoCloudOnMsgListener {
|
||||
|
||||
|
||||
public void init(Context context) {
|
||||
Logger.d(TAG, "init ======= ");
|
||||
mContext = context;
|
||||
|
||||
MoGoAiCloudRealTime.registerOnMsgListener(this);
|
||||
@@ -44,7 +44,6 @@ public class CameraLiveNoticeHelper implements IMogoCloudOnMsgListener {
|
||||
if (mCloudRoadData != null && !TextUtils.isEmpty(mCloudRoadData.getRtmpUrl())) {
|
||||
CameraLiveManager.getInstance().init(mCloudRoadData);
|
||||
} else {
|
||||
Logger.e(TAG, " onMarkerClicked mCloudRoadData == null ");
|
||||
TipToast.shortTip("直播流地址为空");
|
||||
}
|
||||
return false;
|
||||
@@ -67,7 +66,7 @@ public class CameraLiveNoticeHelper implements IMogoCloudOnMsgListener {
|
||||
* @param roadData 道路数据
|
||||
*/
|
||||
private void addVrCameraMarker(SocketDownData.CloudRoadDataProto roadData) {
|
||||
Log.e(TAG, "addVrCameraMarker --lat = " + roadData.getLat() + "--lon =" + roadData.getLon() + "--uuid = " + roadData.getUuid() + "---rtmpUrl =" + roadData.getRtmpUrl());
|
||||
CallerLogger.INSTANCE.e(M_MONITOR + TAG, "addVrCameraMarker --lat = " + roadData.getLat() + "--lon =" + roadData.getLon() + "--uuid = " + roadData.getUuid() + "---rtmpUrl =" + roadData.getRtmpUrl());
|
||||
if (!TextUtils.isEmpty(roadData.getRtmpUrl())) {
|
||||
removeCameraMarker();
|
||||
MogoMarkerOptions options = new MogoMarkerOptions()
|
||||
@@ -94,7 +93,7 @@ public class CameraLiveNoticeHelper implements IMogoCloudOnMsgListener {
|
||||
* @param roadData 道路数据
|
||||
*/
|
||||
private void addNormalCameraMarker(SocketDownData.CloudRoadDataProto roadData) {
|
||||
Log.e(TAG, "addNormalCameraMarker --lat = " + roadData.getLat() + " --lon =" + roadData.getLon() + "--uuid = " + roadData.getUuid() + "---rtmpUrl =" + roadData.getRtmpUrl());
|
||||
CallerLogger.INSTANCE.d(M_MONITOR + TAG, "addNormalCameraMarker --lat = " + roadData.getLat() + " --lon =" + roadData.getLon() + "--uuid = " + roadData.getUuid() + "---rtmpUrl =" + roadData.getRtmpUrl());
|
||||
if (!TextUtils.isEmpty(roadData.getRtmpUrl())) {
|
||||
removeCameraMarker();
|
||||
if (mMogoMarker != null) {
|
||||
@@ -126,18 +125,18 @@ public class CameraLiveNoticeHelper implements IMogoCloudOnMsgListener {
|
||||
if (obj != null) {
|
||||
if (obj.getCamera() != null && !TextUtils.isEmpty(obj.getCamera().getRtmpUrl())) {
|
||||
mCloudRoadData = obj.getCamera();
|
||||
Log.d(TAG, "onMsgReceived getRtmpUrl = " + mCloudRoadData.getRtmpUrl() + "--- isVrMode = " + isVrMode + " ---isVrModeMarker = " + isVrModeMarker + ">>>>mCurrentUuid = " + mCurrentUuid + ">>>mCloudRoadData.getUuid() = " + mCloudRoadData.getUuid());
|
||||
CallerLogger.INSTANCE.d(M_MONITOR + TAG, "onMsgReceived getRtmpUrl = " + mCloudRoadData.getRtmpUrl() + "--- isVrMode = " + isVrMode + " ---isVrModeMarker = " + isVrModeMarker + ">>>>mCurrentUuid = " + mCurrentUuid + ">>>mCloudRoadData.getUuid() = " + mCloudRoadData.getUuid());
|
||||
if (TextUtils.equals(mCurrentUuid, mCloudRoadData.getUuid())) {
|
||||
if (isVrMode == isVrModeMarker) {
|
||||
// do nothing.
|
||||
Log.d(TAG, "-------------1------------");
|
||||
CallerLogger.INSTANCE.d(M_MONITOR + TAG, "-------------1------------");
|
||||
} else {
|
||||
if (isVrMode) {
|
||||
Log.d(TAG, "-------------2------------");
|
||||
CallerLogger.INSTANCE.d(M_MONITOR + TAG, "-------------2------------");
|
||||
addVrCameraMarker(mCloudRoadData);
|
||||
isVrModeMarker = true;
|
||||
} else {
|
||||
Log.d(TAG, "-------------3------------");
|
||||
CallerLogger.INSTANCE.d(M_MONITOR + TAG, "-------------3------------");
|
||||
addNormalCameraMarker(mCloudRoadData);
|
||||
isVrModeMarker = false;
|
||||
}
|
||||
@@ -146,11 +145,11 @@ public class CameraLiveNoticeHelper implements IMogoCloudOnMsgListener {
|
||||
mCurrentUuid = mCloudRoadData.getUuid();
|
||||
// 是否需要延迟
|
||||
if (isVrMode) {
|
||||
Log.d(TAG, "-------------4------------");
|
||||
CallerLogger.INSTANCE.d(M_MONITOR + TAG, "-------------4------------");
|
||||
addVrCameraMarker(mCloudRoadData);
|
||||
isVrModeMarker = true;
|
||||
} else {
|
||||
Log.d(TAG, "-------------5------------");
|
||||
CallerLogger.INSTANCE.d(M_MONITOR + TAG, "-------------5------------");
|
||||
addNormalCameraMarker(mCloudRoadData);
|
||||
isVrModeMarker = false;
|
||||
}
|
||||
@@ -158,20 +157,20 @@ public class CameraLiveNoticeHelper implements IMogoCloudOnMsgListener {
|
||||
} else {
|
||||
//删除marker
|
||||
if (obj.getCamera() != null) {
|
||||
Log.e(TAG, "onMsgReceived RtmpUrl() = " + obj.getCamera().getRtmpUrl());
|
||||
CallerLogger.INSTANCE.e(M_MONITOR + TAG, "onMsgReceived RtmpUrl() = " + obj.getCamera().getRtmpUrl());
|
||||
} else {
|
||||
Log.e(TAG, "obj.getCamera() == null ----------- ");
|
||||
CallerLogger.INSTANCE.e(M_MONITOR + TAG, "obj.getCamera() == null ----------- ");
|
||||
}
|
||||
removeCameraMarker();
|
||||
}
|
||||
} else {
|
||||
Log.e(TAG, "onMsgReceived obj == null ");
|
||||
CallerLogger.INSTANCE.e(M_MONITOR + TAG, "onMsgReceived obj == null ");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMsgSend(long id) {
|
||||
//Logger.d(TAG, "onMsgSend id : " + id);
|
||||
// CallerLogger.INSTANCEger.d(M_MONITOR + TAG, "onMsgSend id : " + id);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.mogo.eagle.core.function.live;
|
||||
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_MONITOR;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Handler;
|
||||
import android.text.TextUtils;
|
||||
@@ -10,10 +12,10 @@ import android.widget.ImageView;
|
||||
import android.widget.RelativeLayout;
|
||||
|
||||
import com.mogo.cloud.socket.entity.SocketDownData;
|
||||
import com.mogo.eagle.core.function.monitoring.R;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.function.live.impl.ICameraWindow;
|
||||
import com.mogo.eagle.core.function.monitoring.R;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.service.imageloader.MogoImageView;
|
||||
|
||||
|
||||
@@ -49,7 +51,7 @@ public class PushCameraLiveWindow extends RelativeLayout implements ICameraWindo
|
||||
}
|
||||
|
||||
public void initView(Context context) {
|
||||
Logger.w(TAG, "initView 。。。。。");
|
||||
CallerLogger.INSTANCE.w(M_MONITOR + TAG, "initView 。。。。。");
|
||||
LayoutInflater.from(context).inflate(R.layout.camera_push_live_video, this);
|
||||
// 详情列表
|
||||
mLiveGSYVideoView = findViewById(R.id.videoPlayer);
|
||||
@@ -66,9 +68,9 @@ public class PushCameraLiveWindow extends RelativeLayout implements ICameraWindo
|
||||
@Override
|
||||
public void show(SocketDownData.CloudRoadDataProto entity) {
|
||||
if (entity != null) {
|
||||
Logger.w(TAG, "更新直播信息 show entity = " + entity);
|
||||
CallerLogger.INSTANCE.w(M_MONITOR + TAG, "更新直播信息 show entity = " + entity);
|
||||
if (!TextUtils.isEmpty(entity.getRtmpUrl())) {
|
||||
Logger.w(TAG, "entity.getRtmpUrl() = " + entity.getRtmpUrl());
|
||||
CallerLogger.INSTANCE.w(M_MONITOR + TAG, "entity.getRtmpUrl() = " + entity.getRtmpUrl());
|
||||
mIvReportHead.setVisibility(INVISIBLE);
|
||||
MogoApisHandler.getInstance().getApis().getImageLoaderApi().displayImage(entity.getRtmpUrl(),
|
||||
mIvReportHead);
|
||||
@@ -101,14 +103,14 @@ public class PushCameraLiveWindow extends RelativeLayout implements ICameraWindo
|
||||
// 倒计时
|
||||
if (runnableV2XEvent == null) {
|
||||
runnableV2XEvent = () -> {
|
||||
//Logger.d(MODULE_NAME, "V2X=== Window 30秒倒计时结束。。。");
|
||||
// CallerLogger.INSTANCE.d(MODULE_NAME, "V2X=== Window 30秒倒计时结束。。。");
|
||||
//TODO 移除窗体
|
||||
};
|
||||
} else {
|
||||
handlerV2XEvent.removeCallbacks(runnableV2XEvent);
|
||||
}
|
||||
|
||||
Logger.d(TAG, "V2X=== Window 展示开始倒计时:" );
|
||||
CallerLogger.INSTANCE.d(M_MONITOR + TAG, "V2X=== Window 展示开始倒计时:");
|
||||
handlerV2XEvent.postDelayed(runnableV2XEvent, 20000);
|
||||
}
|
||||
|
||||
|
||||
@@ -4,10 +4,12 @@ import android.content.Context
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
import android.os.Message
|
||||
import com.mogo.eagle.core.data.camera.*
|
||||
import com.mogo.eagle.core.data.camera.CameraEntity
|
||||
import com.mogo.eagle.core.data.camera.ReqLiveCarBean
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_MONITOR
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.function.monitoring.net.CameraListServices
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
|
||||
import com.mogo.module.common.MogoApisHandler
|
||||
import com.mogo.module.common.constants.HostConst
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||
@@ -15,8 +17,11 @@ import io.reactivex.disposables.Disposable
|
||||
import io.reactivex.schedulers.Schedulers
|
||||
|
||||
class CronTaskManager(private var context: Context?) {
|
||||
private val TAG = "CronTaskManager"
|
||||
private val CRON_TASK_TYPE = 1011
|
||||
|
||||
companion object {
|
||||
private const val TAG = "CronTaskManager"
|
||||
private const val CRON_TASK_TYPE = 1011
|
||||
}
|
||||
|
||||
private val netWork by lazy {
|
||||
MogoApisHandler.getInstance().apis.networkApi
|
||||
@@ -70,10 +75,10 @@ class CronTaskManager(private var context: Context?) {
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe({
|
||||
cameraList = it
|
||||
Logger.d(TAG, "requestCameraList返回结果为:$it")
|
||||
CallerLogger.d("$M_MONITOR$TAG", "requestCameraList返回结果为:$it")
|
||||
}, {
|
||||
it.printStackTrace()
|
||||
Logger.e(TAG, "message is:${it.message}, cause is:${it.cause}")
|
||||
CallerLogger.e("$M_MONITOR$TAG", "message is:${it.message}, cause is:${it.cause}")
|
||||
})
|
||||
}
|
||||
|
||||
@@ -100,16 +105,16 @@ class CronTaskManager(private var context: Context?) {
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe({
|
||||
cameraList = it
|
||||
Logger.d(TAG, "requestDeviceList返回结果为:$it")
|
||||
// CallerLogger.d("$M_MONITOR$TAG", "requestDeviceList返回结果为:$it")
|
||||
}, {
|
||||
it.printStackTrace()
|
||||
Logger.e(
|
||||
TAG,
|
||||
CallerLogger.e(
|
||||
"$M_MONITOR$TAG",
|
||||
"requestDeviceList:message is:${it.message}, cause is:${it.cause}"
|
||||
)
|
||||
})
|
||||
} ?: run {
|
||||
Logger.e(TAG, "CurrentLocation is null!")
|
||||
CallerLogger.e("$M_MONITOR$TAG", "CurrentLocation is null!")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -133,13 +138,16 @@ class CronTaskManager(private var context: Context?) {
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe({
|
||||
carCameraList = it
|
||||
Logger.d(TAG, "requestCarCameraList返回结果为:$it")
|
||||
// CallerLogger.d("$M_MONITOR$TAG", "requestCarCameraList返回结果为:$it")
|
||||
}, {
|
||||
Logger.e(TAG, "message is:${it.message}, cause is:${it.cause}")
|
||||
CallerLogger.e(
|
||||
"$M_MONITOR$TAG",
|
||||
"message is:${it.message}, cause is:${it.cause}"
|
||||
)
|
||||
it.printStackTrace()
|
||||
})
|
||||
} ?: run {
|
||||
Logger.e(TAG, "CurrentLocation is null!")
|
||||
CallerLogger.e("$M_MONITOR$TAG", "CurrentLocation is null!")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -157,14 +165,17 @@ class CronTaskManager(private var context: Context?) {
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe({
|
||||
Logger.d(TAG, "openCameraStream返回结果为:$it")
|
||||
CallerLogger.d("$M_MONITOR$TAG", "openCameraStream返回结果为:$it")
|
||||
it.result?.let { streamResult ->
|
||||
if (!streamResult.flvUrl.isNullOrEmpty()) CallerHmiManager.startRoadCameraLive(
|
||||
streamResult.flvUrl!!
|
||||
)
|
||||
}
|
||||
}, {
|
||||
Logger.e(TAG, "openCameraStream&message is:${it.message}, cause is:${it.cause}")
|
||||
CallerLogger.e(
|
||||
"$M_MONITOR$TAG",
|
||||
"openCameraStream&message is:${it.message}, cause is:${it.cause}"
|
||||
)
|
||||
CallerHmiManager.showNoSignalView()
|
||||
it.printStackTrace()
|
||||
})
|
||||
@@ -182,14 +193,17 @@ class CronTaskManager(private var context: Context?) {
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe({
|
||||
Logger.d(TAG, "reqOpenCameraStream返回结果为:$it")
|
||||
CallerLogger.d("$M_MONITOR$TAG", "reqOpenCameraStream返回结果为:$it")
|
||||
if (!it.flvUrl.isNullOrEmpty()) {
|
||||
CallerHmiManager.startRoadCameraLive(it.flvUrl!!)
|
||||
} else {
|
||||
CallerHmiManager.showNoSignalView()
|
||||
}
|
||||
}, {
|
||||
Logger.e(TAG, "reqOpenCameraStream&message is:${it.message}, cause is:${it.cause}")
|
||||
CallerLogger.e(
|
||||
"$M_MONITOR$TAG",
|
||||
"reqOpenCameraStream&message is:${it.message}, cause is:${it.cause}"
|
||||
)
|
||||
CallerHmiManager.showNoSignalView()
|
||||
it.printStackTrace()
|
||||
})
|
||||
|
||||
@@ -8,7 +8,6 @@ import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.eagle.core.data.camera.CameraEntity;
|
||||
import com.mogo.eagle.core.data.constants.MogoServicePaths;
|
||||
import com.mogo.eagle.core.function.api.monitoring.IMoGoMonitoringProvider;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -30,7 +29,6 @@ public class MoGoMonitoringProvider implements IMoGoMonitoringProvider {
|
||||
|
||||
@Override
|
||||
public void init(Context context) {
|
||||
Logger.d(TAG, "初始化……");
|
||||
mCronTaskManager = new CronTaskManager(context);
|
||||
mCronTaskManager.startCronTask();
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.mogo.eagle.core.function.notice;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.eagle.core.data.constants.MogoServicePaths;
|
||||
@@ -19,8 +18,6 @@ import org.jetbrains.annotations.NotNull;
|
||||
*/
|
||||
@Route(path = MogoServicePaths.PATH_AI_NOTICE)
|
||||
public class NoticeProvider implements IMoGoNoticeProvider {
|
||||
private String TAG = "AINotice";
|
||||
private Context mContext;
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
@@ -35,8 +32,6 @@ public class NoticeProvider implements IMoGoNoticeProvider {
|
||||
|
||||
@Override
|
||||
public void init(Context context) {
|
||||
Log.d(TAG, "init");
|
||||
mContext = context;
|
||||
NoticeSocketManager.getInstance().registerSocketMessageListener(context);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
package com.mogo.eagle.core.function.notice;
|
||||
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_NOTICE;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
import com.mogo.eagle.core.data.notice.NoticeNormalData;
|
||||
import com.mogo.eagle.core.data.notice.NoticeTrafficStylePushData;
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.network.utils.GsonUtil;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.service.cloud.socket.IMogoOnMessageListener;
|
||||
|
||||
@@ -31,27 +32,24 @@ class NoticeSocketManager {
|
||||
}
|
||||
|
||||
public void registerSocketMessageListener(Context context) {
|
||||
Log.d(TAG, "registerSocketMessage");
|
||||
mContext = context;
|
||||
MogoApisHandler.getInstance().getApis().getSocketManagerApi(context).
|
||||
registerOnMessageListener(301001, mtrafficNoticeListener);
|
||||
registerOnMessageListener(301001, mTrafficNoticeListener);
|
||||
MogoApisHandler.getInstance().getApis().getSocketManagerApi(context).
|
||||
registerOnMessageListener(100, mNormalNoticeListener);
|
||||
}
|
||||
|
||||
public void unRegisterSocketMessageListener() {
|
||||
if (mtrafficNoticeListener != null) {
|
||||
MogoApisHandler.getInstance().getApis().getSocketManagerApi(mContext).
|
||||
unregisterOnMessageListener(301001, mtrafficNoticeListener);
|
||||
MogoApisHandler.getInstance().getApis().getSocketManagerApi(mContext).
|
||||
unregisterOnMessageListener(100, mNormalNoticeListener);
|
||||
}
|
||||
MogoApisHandler.getInstance().getApis().getSocketManagerApi(mContext).
|
||||
unregisterOnMessageListener(301001, mTrafficNoticeListener);
|
||||
MogoApisHandler.getInstance().getApis().getSocketManagerApi(mContext).
|
||||
unregisterOnMessageListener(100, mNormalNoticeListener);
|
||||
}
|
||||
|
||||
/**
|
||||
* 普通云公告
|
||||
*/
|
||||
private IMogoOnMessageListener<NoticeNormalData> mNormalNoticeListener = new IMogoOnMessageListener<NoticeNormalData>() {
|
||||
private final IMogoOnMessageListener<NoticeNormalData> mNormalNoticeListener = new IMogoOnMessageListener<NoticeNormalData>() {
|
||||
@Override
|
||||
public Class<NoticeNormalData> target() {
|
||||
return NoticeNormalData.class;
|
||||
@@ -59,11 +57,10 @@ class NoticeSocketManager {
|
||||
|
||||
@Override
|
||||
public void onMsgReceived(NoticeNormalData obj) {
|
||||
Logger.i(TAG, "100-- 普通公告数据:" + GsonUtil.jsonFromObject(obj));
|
||||
CallerLogger.INSTANCE.d(M_NOTICE + TAG, "100-- 普通公告数据:" + GsonUtil.jsonFromObject(obj));
|
||||
if (obj == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
CallerHmiManager.INSTANCE.showNoticeNormalData(obj);
|
||||
}
|
||||
};
|
||||
@@ -71,7 +68,7 @@ class NoticeSocketManager {
|
||||
/**
|
||||
* 交警类型公告弹窗
|
||||
*/
|
||||
private IMogoOnMessageListener<NoticeTrafficStylePushData> mtrafficNoticeListener = new IMogoOnMessageListener<NoticeTrafficStylePushData>() {
|
||||
private final IMogoOnMessageListener<NoticeTrafficStylePushData> mTrafficNoticeListener = new IMogoOnMessageListener<NoticeTrafficStylePushData>() {
|
||||
|
||||
@Override
|
||||
public Class<NoticeTrafficStylePushData> target() {
|
||||
@@ -80,7 +77,7 @@ class NoticeSocketManager {
|
||||
|
||||
@Override
|
||||
public void onMsgReceived(NoticeTrafficStylePushData obj) {
|
||||
Logger.i(TAG, "301001-- 交警类型公告数据:" + GsonUtil.jsonFromObject(obj));
|
||||
CallerLogger.INSTANCE.d(M_NOTICE + TAG, "301001-- 交警类型公告数据:" + GsonUtil.jsonFromObject(obj));
|
||||
CallerHmiManager.INSTANCE.showTrafficBanner(obj);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.mogo.eagle.core.function.notice.network;
|
||||
|
||||
import android.util.ArrayMap;
|
||||
import android.util.Log;
|
||||
|
||||
import com.mogo.cloud.network.NetConstants;
|
||||
import com.mogo.cloud.network.RetrofitFactory;
|
||||
@@ -12,7 +11,6 @@ import com.mogo.eagle.core.data.notice.NoticeTrafficStyleInfo;
|
||||
|
||||
import com.mogo.eagle.core.function.api.notice.NoticeNetCallBack;
|
||||
import com.mogo.eagle.core.network.utils.GsonUtil;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@@ -31,7 +29,6 @@ import okhttp3.RequestBody;
|
||||
* @since: 10/28/21
|
||||
*/
|
||||
public class NoticeNetWorkManager {
|
||||
private String TAG = "AINotice";
|
||||
private static volatile NoticeNetWorkManager requestNoticeManager;
|
||||
private final NoticeApiService mNoticeApiService;
|
||||
|
||||
@@ -68,12 +65,10 @@ public class NoticeNetWorkManager {
|
||||
.subscribe(new Observer<NoticeTrafficStyleInfo>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
Log.d(TAG, "onSubscribe");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull NoticeTrafficStyleInfo noticeTrafficStyleInfo) {
|
||||
Log.d(TAG, "onNext:"+noticeTrafficStyleInfo);
|
||||
if (noticeTrafficStyleInfo.getResult().getAccidentInfo() != null) {
|
||||
callBack.callBackWithResult(noticeTrafficStyleInfo);
|
||||
}
|
||||
@@ -81,12 +76,10 @@ public class NoticeNetWorkManager {
|
||||
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
Log.d(TAG, "requestAccidentInfo--error" + e.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.d(TAG, "onComplete");
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -150,18 +143,15 @@ public class NoticeNetWorkManager {
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull NoticeNormalDetail noticeNormalDetail) {
|
||||
Logger.d(TAG, "onNext ------ ");
|
||||
// CallerHmiManager.INSTANCE.showNormalBanner(noticeNormalDetail);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
Logger.e(TAG, " onError e = " + e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Logger.d(TAG, "onComplete ------ ");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -3,15 +3,15 @@ package com.mogo.eagle.core.function.notice.repository
|
||||
import android.content.Context
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
import android.util.Log
|
||||
import androidx.room.Room
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_NOTICE
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.function.notice.PushUIConstants
|
||||
import com.mogo.eagle.core.function.notice.dao.PushBeanDatabase
|
||||
import com.mogo.eagle.core.function.notice.model.PushBean
|
||||
import com.mogo.eagle.core.function.notice.utils.HandlerUtils
|
||||
import com.mogo.eagle.core.function.notice.view.getApis
|
||||
import com.mogo.eagle.core.function.notice.viewmodel.PushViewModel
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
|
||||
import com.mogo.service.statusmanager.IMogoStatusChangedListener
|
||||
import com.mogo.service.statusmanager.StatusDescriptor
|
||||
import java.util.*
|
||||
@@ -20,7 +20,9 @@ import kotlin.collections.HashSet
|
||||
class PushRepository(mContext: Context) {
|
||||
|
||||
companion object {
|
||||
private const val TAG: String = "PushRepository"
|
||||
private lateinit var appContext: Context
|
||||
|
||||
fun init(context: Context) {
|
||||
appContext = context.applicationContext
|
||||
pushRepository
|
||||
@@ -33,8 +35,6 @@ class PushRepository(mContext: Context) {
|
||||
val pushRepository: PushRepository by lazy {
|
||||
PushRepository(appContext)
|
||||
}
|
||||
|
||||
private const val TAG: String = "PushRepository.kt"
|
||||
}
|
||||
|
||||
// 被中断的push消息仅再次展示一次
|
||||
@@ -54,7 +54,7 @@ class PushRepository(mContext: Context) {
|
||||
|
||||
private val statusChangedListener: IMogoStatusChangedListener =
|
||||
IMogoStatusChangedListener { sd, open ->
|
||||
Log.d("PushRepository", "sd = $sd open = $open")
|
||||
CallerLogger.d("$M_NOTICE$TAG", "sd = $sd , open = $open")
|
||||
}
|
||||
|
||||
init {
|
||||
@@ -74,7 +74,7 @@ class PushRepository(mContext: Context) {
|
||||
}
|
||||
|
||||
private fun startIterate() {
|
||||
Log.d("PushRepository", "startIterate ${pushViewModel.pushBean}")
|
||||
CallerLogger.d("$M_NOTICE$TAG", "startIterate : ${pushViewModel.pushBean}")
|
||||
if (!pushViewModel.isAddWindow()) {
|
||||
val bean = pushBeanQueue.peek()
|
||||
if (bean != null) {
|
||||
@@ -99,7 +99,7 @@ class PushRepository(mContext: Context) {
|
||||
if (singleRePushSet.contains(pushBean)) {
|
||||
return
|
||||
}
|
||||
Logger.d(TAG, "保存待下一次开启")
|
||||
CallerLogger.d("$M_NOTICE$TAG", "保存待下一次开启")
|
||||
singleRePushSet.add(pushBean)
|
||||
pushBeanQueue.offer(pushBean)
|
||||
}
|
||||
@@ -111,7 +111,10 @@ class PushRepository(mContext: Context) {
|
||||
private fun needDelay(bean: PushBean): Boolean {
|
||||
if (locationClient.lastKnowLocation != null) {
|
||||
if (bean.speedLimit > 0 && bean.speedLimit <= locationClient.lastKnowLocation.speed * 18 / 5) {
|
||||
Log.d("PushRepository", "speedLimit" + locationClient.lastKnowLocation.speed)
|
||||
CallerLogger.d(
|
||||
"$M_NOTICE$TAG",
|
||||
"speedLimit : " + locationClient.lastKnowLocation.speed
|
||||
)
|
||||
return true
|
||||
}
|
||||
}
|
||||
@@ -140,7 +143,7 @@ class PushRepository(mContext: Context) {
|
||||
}
|
||||
pushViewModel.pushBean = pushBeanQueue.poll()
|
||||
} catch (e: Exception) {
|
||||
Logger.e(TAG, e, "")
|
||||
CallerLogger.e("$M_NOTICE$TAG", "$e")
|
||||
}
|
||||
if (pushViewModel.pushBean != null) {
|
||||
statusManager.registerStatusChangedListener(
|
||||
|
||||
@@ -3,10 +3,8 @@ package com.mogo.eagle.core.function.notice.test
|
||||
import android.content.BroadcastReceiver
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.util.Log
|
||||
import com.mogo.eagle.core.data.notice.NoticeTrafficStylePushData
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
|
||||
|
||||
/**
|
||||
* @author Jing
|
||||
@@ -14,14 +12,12 @@ import com.mogo.eagle.core.utilcode.mogo.logger.Logger
|
||||
* @since: 10/29/21
|
||||
*/
|
||||
class TestNoticeBroadcastReceiver : BroadcastReceiver() {
|
||||
private val TAG = "AINotice"
|
||||
private var mContext: Context? = null
|
||||
|
||||
override fun onReceive(context: Context?, intent: Intent) {
|
||||
try {
|
||||
mContext = context
|
||||
val sceneType = intent.getIntExtra("sceneType", 0)
|
||||
Logger.d(TAG, "textPanelOpenType:$sceneType")
|
||||
// 分发场景
|
||||
dispatchSceneTest(sceneType)
|
||||
} catch (e: Exception) {
|
||||
@@ -30,7 +26,6 @@ class TestNoticeBroadcastReceiver : BroadcastReceiver() {
|
||||
}
|
||||
|
||||
private fun dispatchSceneTest(sceneType: Int) {
|
||||
Log.d(TAG, "dispatchSceneTest::" + sceneType.toString());
|
||||
if (sceneType == 301001) {
|
||||
val pushData = NoticeTrafficStylePushData()
|
||||
pushData.msg = "交警任务公告"
|
||||
|
||||
@@ -4,7 +4,6 @@ import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.core.view.get
|
||||
import androidx.core.view.isNotEmpty
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
|
||||
|
||||
const val TAG: String = "AnimatorUtils.kt"
|
||||
|
||||
@@ -19,7 +18,6 @@ fun startClearAnimator(root: ViewGroup, runnable: Runnable) {
|
||||
try {
|
||||
withEndAction(runnable)
|
||||
} catch (e: Exception) {
|
||||
Logger.e(TAG, e, "startClearAnimator->withEndAction")
|
||||
}
|
||||
}
|
||||
duration = 200
|
||||
|
||||
@@ -4,7 +4,6 @@ import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.net.Uri
|
||||
import android.text.TextUtils
|
||||
import android.util.Log
|
||||
|
||||
private const val ACTION = "AUTONAVI_STANDARD_BROADCAST_RECV"
|
||||
private const val KEY_TYPE = "KEY_TYPE"
|
||||
@@ -110,7 +109,6 @@ private fun startMap(context: Context, uri: Uri): Boolean {
|
||||
context.sendBroadcast(intent)
|
||||
true
|
||||
} catch (e: NumberFormatException) {
|
||||
Log.e("CustomMessageInfo", e.localizedMessage)
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -277,7 +277,6 @@ class FloatView constructor(
|
||||
// this.x,
|
||||
// -ResourcesHelper.getDimension(context, R.dimen.module_push_ui_width_vertical)
|
||||
// ) {
|
||||
// Logger.d(TAG, "here")
|
||||
// this.x = 0f
|
||||
// mWindowManager.removeViewImmediate(this)
|
||||
// }
|
||||
|
||||
@@ -384,7 +384,6 @@ public class SwipeItemLayout extends ViewGroup {
|
||||
|
||||
void startScroll(int startX, int endX) {
|
||||
if (startX != endX) {
|
||||
// Log.e("scroll - startX - endX", "" + startX + " " + endX);
|
||||
setTouchMode(Mode.FLING);
|
||||
mAbort = false;
|
||||
mScrollToLeft = endX < startX;
|
||||
@@ -394,8 +393,6 @@ public class SwipeItemLayout extends ViewGroup {
|
||||
}
|
||||
|
||||
void startFling(int startX, int xVel) {
|
||||
// Log.e("fling - startX", "" + startX);
|
||||
|
||||
if (xVel > mMinVelocity && startX != 0) {
|
||||
startScroll(startX, 0);
|
||||
return;
|
||||
@@ -426,12 +423,9 @@ public class SwipeItemLayout extends ViewGroup {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
// Log.e("abort", Boolean.toString(mAbort));
|
||||
if (!mAbort) {
|
||||
boolean more = mScroller.computeScrollOffset();
|
||||
int curX = mScroller.getCurrX();
|
||||
// Log.e("curX", "" + curX);
|
||||
|
||||
boolean atEdge = trackMotionScroll(curX - mScrollOffset);
|
||||
if (more && !atEdge) {
|
||||
ViewCompat.postOnAnimation(SwipeItemLayout.this, this);
|
||||
|
||||
@@ -32,7 +32,6 @@ import android.graphics.Shader;
|
||||
import android.graphics.drawable.BitmapDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.graphics.drawable.LayerDrawable;
|
||||
import android.util.Log;
|
||||
import android.widget.ImageView.ScaleType;
|
||||
|
||||
import androidx.annotation.ColorInt;
|
||||
@@ -139,7 +138,6 @@ public class RoundedDrawable extends Drawable {
|
||||
drawable.draw(canvas);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
Log.w(TAG, "Failed to create bitmap from drawable!");
|
||||
bitmap = null;
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user