[2.13.0] change the host location and fix bug of token problem

This commit is contained in:
zhongchao
2022-11-30 15:22:13 +08:00
parent 573bc5a385
commit 0d6938262c
25 changed files with 56 additions and 367 deletions

View File

@@ -204,7 +204,6 @@ class MoGoAdasListenerImpl : OnAdasListener {
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
@@ -214,7 +213,6 @@ class MoGoAdasListenerImpl : OnAdasListener {
}
AdasManager.getInstance().carConfig?.let {
autopilotStatusInfo.dockVersion = it.dockVersion
AppConfigInfo.dockerVersion = it.dockVersion
}
CallerLogger.d("Upgrade", "origin = ${autopilotStatusInfo.connectStatus} -----now = ${AppConfigInfo.isConnectAutopilot} ")
AppConfigInfo.isConnectAutopilot = autopilotStatusInfo.connectStatus
@@ -320,9 +318,11 @@ class MoGoAdasListenerImpl : OnAdasListener {
) {
if (carConfigResp != null) {
//todo emArrow startUp时确认数据完整性
AppConfigInfo.dockerVersion = carConfigResp.dockVersion
AppConfigInfo.plateNumber = carConfigResp.plateNumber//车牌号
AppConfigInfo.iPCMacAddress = carConfigResp.macAddress//工控机MAC地址
AppConfigInfo.protocolVersionNumber = carConfigResp.protocolVersionValue//工控机协议版本
AppConfigInfo.isConnectAutopilot = true
invokeAutopilotCarConfigData(carConfigResp)
}
}

View File

@@ -1,13 +1,10 @@
package com.mogo.eagle.core.function.autopilot.adapter
import android.annotation.SuppressLint
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
import com.mogo.commons.debug.DebugConfig.*
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
import com.mogo.eagle.core.function.api.cloud.IMoGoCloudListener
import com.mogo.eagle.core.function.autopilot.network.AdasServiceModel
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.cloud.CallerCloudListenerManager
@@ -22,9 +19,6 @@ import com.zhidao.support.adas.high.common.Constants
import com.zhidao.support.adas.high.common.Constants.ENVIRONMENT.*
import com.zhidao.support.adas.high.common.Constants.TERMINAL_ROLE.DRIVER
import com.zhidao.support.adas.high.common.Constants.TERMINAL_ROLE.PASSENGER
import mogo.telematics.pad.MessagePad
import java.util.*
import java.util.concurrent.atomic.AtomicBoolean
/**
* ADAS-SDK与工控机连接状态回调
@@ -33,18 +27,8 @@ class MoGoAdasMsgConnectStatusListenerImpl : OnAdasConnectStatusListener,
IMoGoAutopilotStatusListener, IMoGoCloudListener {
private val TAG = "ConnectStatus"
//自动驾驶状态
private var mCurrentAutopilotStatus = -1
//自动驾驶车速度
private var mCurrentAutopilotSpeed = 0f
private var connectStatus = false
private val hasUploadTaskLaunched by lazy { AtomicBoolean(false) }
private val timer = Timer()
init {
CallerCloudListenerManager.registerCloudListener(TAG, this)
}
@@ -65,8 +49,6 @@ class MoGoAdasMsgConnectStatusListenerImpl : OnAdasConnectStatusListener,
CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().connectStatus = true
// 同步SN给工控机
syncBasicInfoToAutopilot()
// 开启轮询上传自动驾驶状态
updateDriveStatusTask()
//每次工控机连接成功后,需同步当前设置的美化模式状态
CallerAutoPilotManager.setDemoMode(FunctionBuildConfig.isDemoMode)
//当连接状态是关闭美化模式时,同步给工控机
@@ -89,8 +71,6 @@ class MoGoAdasMsgConnectStatusListenerImpl : OnAdasConnectStatusListener,
AdasManager.getInstance().ipcConnectedPort
CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().connectStatus = false
//与工控机断开连接,需要重置自动驾驶状态(包括上传至云平台缓存信息),等待连接成功后同步状态信息
mCurrentAutopilotStatus = 0
mCurrentAutopilotSpeed = 0.0f
CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().state = 0
CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().pilotmode = 0
} else if (ipcConnectionStatus == Constants.IPC_CONNECTION_STATUS.CONNECTING) {
@@ -117,21 +97,6 @@ class MoGoAdasMsgConnectStatusListenerImpl : OnAdasConnectStatusListener,
syncBasicInfoToAutopilot()
}
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)
}
}
override fun onAutopilotStatusResponse(autoPilotStatusInfo: AutopilotStatusInfo) {
val state = autoPilotStatusInfo.state
val speed = autoPilotStatusInfo.speed
mCurrentAutopilotStatus = state
mCurrentAutopilotSpeed = speed
}
/**
* 同步SN信息给工控机
*/
@@ -174,23 +139,6 @@ class MoGoAdasMsgConnectStatusListenerImpl : OnAdasConnectStatusListener,
}
}
/**
* 上传自动驾驶状态任务
*/
@SuppressLint("CheckResult")
private fun updateDriveStatusTask() {
if (hasUploadTaskLaunched.compareAndSet(false, true)) {
timer.schedule(object : TimerTask() {
override fun run() {
CallerLogger.d("$M_ADAS_IMPL$TAG", "updateDriveStatusTask")
AdasServiceModel.getInstance()
.updateDriveStatus(mCurrentAutopilotStatus, mCurrentAutopilotSpeed)
}
}, 0, 5000)
}
}
override fun tokenGot(token: String, sn: String) {
syncBasicInfoToAutopilot(sn)
}

View File

@@ -1,41 +0,0 @@
package com.mogo.eagle.core.function.autopilot.entity;
/**
* Created by SuYong on 2021/5/28 16:12
*/
public class AutonomousDriveStatusBean {
private String sn;
private int status;
private float vehicleSpeed;
public AutonomousDriveStatusBean(String sn, int status, float vehicleSpeed) {
this.sn = sn;
this.status = status;
this.vehicleSpeed = vehicleSpeed;
}
public String getSn() {
return sn;
}
public void setSn(String sn) {
this.sn = sn;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public float getVehicleSpeed() {
return vehicleSpeed;
}
public void setVehicleSpeed(float vehicleSpeed) {
this.vehicleSpeed = vehicleSpeed;
}
}

View File

@@ -1,40 +0,0 @@
package com.mogo.eagle.core.function.autopilot.entity;
/**
* Created by SuYong on 2021/5/31 16:24
*/
public class ReportSiteBean {
private String sn;
private double lon;
private double lat;
public ReportSiteBean(String sn, double lon, double lat) {
this.sn = sn;
this.lon = lon;
this.lat = lat;
}
public String getSn() {
return sn;
}
public void setSn(String sn) {
this.sn = sn;
}
public double getLon() {
return lon;
}
public void setLon(double lon) {
this.lon = lon;
}
public double getLat() {
return lat;
}
public void setLat(double lat) {
this.lat = lat;
}
}

View File

@@ -1,95 +0,0 @@
package com.mogo.eagle.core.function.autopilot.network;
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
import com.mogo.commons.context.ContextHolderUtil;
import com.mogo.eagle.core.data.BaseData;
import com.mogo.eagle.core.function.autopilot.entity.AutonomousDriveStatusBean;
import com.mogo.eagle.core.function.autopilot.entity.ReportSiteBean;
import com.mogo.eagle.core.network.MoGoRetrofitFactory;
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.data.constants.HostConst;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;
import okhttp3.MediaType;
import okhttp3.RequestBody;
/**
* 将自动驾驶状态及站点信息上传给云平台,云平台会根据此数据做路线的绘制
*
* @author dongghongyu
*/
public class AdasServiceModel {
private static final String TAG = "AdasServiceModel";
private static volatile AdasServiceModel instance;
private static final byte[] obj = new byte[0];
private final IAdasApiService mAdasApiService;
private AdasServiceModel() {
this.mAdasApiService = MoGoRetrofitFactory.getInstance(HostConst.DATA_SERVICE_HOST).create(IAdasApiService.class);
}
public static AdasServiceModel getInstance() {
if (instance == null) {
synchronized (obj) {
if (instance == null) {
instance = new AdasServiceModel();
}
}
}
return instance;
}
public void updateDriveStatus(int autoPilotStatus, float autoPilotSpeed) {
String sn = MoGoAiCloudClientConfig.getInstance().getSn();
AutonomousDriveStatusBean request = new AutonomousDriveStatusBean(sn, autoPilotStatus, autoPilotSpeed);
RequestBody requestBody = RequestBody.create(MediaType.get("application/json;charset=UTF-8"), GsonUtil.jsonFromObject(request));
mAdasApiService.updateAutonomousDriveStatus(requestBody).
subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread())
.subscribe(new SubscribeImpl<BaseData>(RequestOptions.create(ContextHolderUtil.getContext())) {
@Override
public void onError(String message, int code) {
super.onError(message, code);
}
@Override
public void onError(Throwable e) {
super.onError(e);
}
@Override
public void onSuccess(BaseData o) {
super.onSuccess(o);
}
});
}
public void reportSite(double lon, double lat) {
String sn = MoGoAiCloudClientConfig.getInstance().getSn();
ReportSiteBean reportSiteBean = new ReportSiteBean(sn, lon, lat);
RequestBody requestBody = RequestBody.create(MediaType.get("application/json;charset=UTF-8"), GsonUtil.jsonFromObject(reportSiteBean));
mAdasApiService.updateReportSite(requestBody).
subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread())
.subscribe(new SubscribeImpl<BaseData>(RequestOptions.create(ContextHolderUtil.getContext())) {
@Override
public void onError(String message, int code) {
super.onError(message, code);
}
@Override
public void onError(Throwable e) {
super.onError(e);
}
@Override
public void onSuccess(BaseData o) {
super.onSuccess(o);
}
});
}
}

View File

@@ -1,31 +0,0 @@
package com.mogo.eagle.core.function.autopilot.network;
import com.mogo.eagle.core.data.BaseData;
import io.reactivex.Observable;
import okhttp3.RequestBody;
import retrofit2.http.Body;
import retrofit2.http.Headers;
import retrofit2.http.POST;
public interface IAdasApiService {
/**
* 上传自动驾驶状态接口
* @param requestBody
* @return
*/
@Headers({"Content-Type:application/json;charset=UTF-8"})
@POST("/dataService/autonomousDrive/updateAutonomousDriveStatus")
Observable<BaseData> updateAutonomousDriveStatus(@Body RequestBody requestBody);
/**
* 站点上报 用于网约车业务 云平台绘制路线使用
* @param requestBody
* @return
*/
@Headers({"Content-Type:application/json;charset=UTF-8"})
@POST("/dataService/autonomousDrive/reportSite")
Observable<BaseData> updateReportSite(@Body RequestBody requestBody);
}

View File

@@ -1,26 +0,0 @@
package com.mogo.eagle.core.function
import com.mogo.commons.debug.DebugConfig
/**
* cmdb 域名
*/
class BindHostConst {
companion object {
private const val UPGRADE_APP_HOST_DEV = "https://eagle-qa.zhidaozhixing.com/"
private const val UPGRADE_APP_HOST = "http://eagle-mis.zhidaozhixing.com/"
@JvmStatic
fun getBaseUrl(): String {
return when (DebugConfig.getNetMode()) {
DebugConfig.NET_MODE_DEV -> UPGRADE_APP_HOST_DEV
DebugConfig.NET_MODE_QA -> UPGRADE_APP_HOST_DEV
DebugConfig.NET_MODE_DEMO -> UPGRADE_APP_HOST
DebugConfig.NET_MODE_RELEASE -> UPGRADE_APP_HOST
else -> UPGRADE_APP_HOST
}
}
}
}

View File

@@ -5,8 +5,8 @@ import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_BIN
import android.content.Context;
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
import com.mogo.commons.constants.HostConst;
import com.mogo.eagle.core.data.bindingcar.UpgradeAppInfo;
import com.mogo.eagle.core.function.BindHostConst;
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager;
import com.mogo.eagle.core.network.MoGoRetrofitFactory;
import com.mogo.eagle.core.network.utils.GsonUtil;
@@ -33,7 +33,7 @@ public class UpgradeAppNetWorkManager {
private UpgradeAppNetWorkManager() {
mUpgradeApiService = MoGoRetrofitFactory.getInstance(BindHostConst.getBaseUrl())
mUpgradeApiService = MoGoRetrofitFactory.getInstance(HostConst.Companion.getHost())
.create(UpgradeApiService.class);
}

View File

@@ -3,10 +3,10 @@ package com.mogo.eagle.core.function.bindingcar.network;
import android.content.Context;
import android.util.Log;
import com.mogo.commons.constants.HostConst;
import com.mogo.commons.constants.SharedPrefsConstants;
import com.mogo.eagle.core.data.bindingcar.BindingcarInfo;
import com.mogo.eagle.core.data.bindingcar.ModifyBindingcarInfo;
import com.mogo.eagle.core.function.BindHostConst;
import com.mogo.eagle.core.function.api.bindingcar.BindingcarCallBack;
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager;
import com.mogo.eagle.core.network.MoGoRetrofitFactory;
@@ -35,7 +35,7 @@ public class BindingcarNetWorkManager {
private static final String TAG = "BindingcarNetManager";
private BindingcarNetWorkManager() {
mBindingcarApiService = MoGoRetrofitFactory.getInstance(BindHostConst.getBaseUrl())
mBindingcarApiService = MoGoRetrofitFactory.getInstance(HostConst.Companion.getHost())
.create(BindingcarApiService.class);
}

View File

@@ -1,7 +1,7 @@
package com.mogo.eagle.core.function.check.net;
import com.mogo.eagle.core.network.MoGoRetrofitFactory;
import com.mogo.eagle.core.data.constants.HostConst;
import com.mogo.commons.constants.HostConst;
/**
* @author liujing

View File

@@ -1,22 +0,0 @@
package com.zhjt.mogo_core_function_devatools.funcconfig.network
import com.mogo.commons.debug.DebugConfig
class FuncConfigHost {
companion object{
private const val HOST_DEV = "https://eagle-qa.zhidaozhixing.com"
private const val HOST_RELEASE = "https://eagle.zhidaozhixing.com"
fun get(): String{
return when (DebugConfig.getNetMode()) {
DebugConfig.NET_MODE_DEV -> HOST_DEV
DebugConfig.NET_MODE_QA -> HOST_DEV
DebugConfig.NET_MODE_DEMO -> HOST_RELEASE
DebugConfig.NET_MODE_RELEASE -> HOST_RELEASE
else -> HOST_RELEASE
}
}
}
}

View File

@@ -1,6 +1,7 @@
package com.zhjt.mogo_core_function_devatools.funcconfig.network
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
import com.mogo.commons.constants.HostConst
import com.mogo.eagle.core.data.BaseResponse
import com.mogo.eagle.core.network.MoGoRetrofitFactory
import com.mogo.eagle.core.network.apiCall
@@ -11,7 +12,7 @@ import com.zhjt.service_biz.FuncConfig
class FuncConfigNetWorkModel {
private fun getNetWorkApi(baseUrl: String = FuncConfigHost.get()): FuncConfigApiService {
private fun getNetWorkApi(baseUrl: String = HostConst.getHost()): FuncConfigApiService {
return MoGoRetrofitFactory.getInstanceNoCallAdapter(baseUrl)
.create(FuncConfigApiService::class.java)
}

View File

@@ -4,7 +4,7 @@ import com.mogo.eagle.core.data.Response
import com.mogo.eagle.core.network.MoGoRetrofitFactory
import com.mogo.eagle.core.network.apiResponseCall
import com.mogo.eagle.core.network.request
import com.mogo.eagle.core.data.constants.HostConst
import com.mogo.commons.constants.HostConst
import com.zhjt.mogo_core_function_devatools.upgrade.network.HostConst.Companion.getBaseUrl
class UpgradeVersionNetWorkModel {

View File

@@ -1,7 +1,7 @@
package com.zhjt.dispatch.model;
import static com.mogo.commons.context.ContextHolderUtil.getContext;
import static com.mogo.eagle.core.data.constants.HostConst.DATA_SERVICE_HOST;
import static com.mogo.commons.constants.HostConst.DATA_SERVICE_HOST;
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
import com.mogo.eagle.core.data.BaseData;

View File

@@ -1,7 +0,0 @@
package com.mogo.eagle.core.function.overview
class OverViewConst {
companion object {
const val CLOUD_HOST = "https://eagle-qa.zhidaozhixing.com"
}
}

View File

@@ -1,8 +1,8 @@
package com.mogo.eagle.core.function.overview.vm
import androidx.lifecycle.*
import com.mogo.commons.constants.HostConst
import com.mogo.eagle.core.data.map.Infrastructure
import com.mogo.eagle.core.function.overview.OverViewConst
import com.mogo.eagle.core.function.overview.OverviewDao
import com.mogo.eagle.core.function.overview.remote.OverViewServiceApi
import com.mogo.eagle.core.function.overview.remote.V2XEvent
@@ -10,7 +10,6 @@ import com.mogo.eagle.core.network.MoGoRetrofitFactory
import io.reactivex.Observable
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.disposables.Disposable
import io.reactivex.functions.Consumer
import io.reactivex.schedulers.Schedulers
import kotlinx.coroutines.launch
import java.util.concurrent.TimeUnit
@@ -79,7 +78,7 @@ class OverViewModel(
// 1分钟查询一次
disposable = Observable.interval(0, 60000, TimeUnit.SECONDS)
.flatMap {
MoGoRetrofitFactory.getInstance(OverViewConst.CLOUD_HOST)
MoGoRetrofitFactory.getInstance(HostConst.getHost())
.create(OverViewServiceApi::class.java)
.queryAllV2XEventsByLineId(lineId, sn)
.map {

View File

@@ -12,7 +12,7 @@ import com.mogo.eagle.core.network.MoGoRetrofitFactory
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_MONITOR
import com.mogo.map.MogoLocationClient
import com.mogo.eagle.core.data.constants.HostConst
import com.mogo.commons.constants.HostConst
import io.reactivex.Observable
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.disposables.Disposable

View File

@@ -1,7 +1,7 @@
package com.mogo.eagle.core.function.v2x.events.network;
import com.mogo.eagle.core.network.MoGoRetrofitFactory;
import com.mogo.eagle.core.data.constants.HostConst;
import com.mogo.commons.constants.HostConst;
/**
* 应对不同接口对应不同服务域名的工厂累

View File

@@ -8,7 +8,7 @@ import com.mogo.eagle.core.network.MoGoRetrofitFactory
import com.mogo.eagle.core.network.apiCall
import com.mogo.eagle.core.network.cancel
import com.mogo.eagle.core.network.request
import com.mogo.eagle.core.data.constants.HostConst.CITY_HOST
import com.mogo.commons.constants.HostConst.CITY_HOST
class TrafficLightNetWorkModel {

View File

@@ -6,7 +6,7 @@ import com.mogo.eagle.core.data.v2x.VipRequest
import com.mogo.eagle.core.network.MoGoRetrofitFactory
import com.mogo.eagle.core.network.apiCall
import com.mogo.eagle.core.network.request
import com.mogo.eagle.core.data.constants.HostConst.DATA_SERVICE_HOST
import com.mogo.commons.constants.HostConst.DATA_SERVICE_HOST
class VipNetWorkModel {