[6.2.4] fix bug of request in main thread
This commit is contained in:
@@ -8,7 +8,6 @@ import android.widget.ImageView
|
||||
import android.widget.TextView
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import chassis.Chassis.GearPosition
|
||||
import chassis.Chassis.LightSwitch
|
||||
import chassis.ChassisStatesOuterClass.BMSSystemStates
|
||||
import chassis.ChassisStatesOuterClass.SweeperFuTianTaskSystemStates
|
||||
import com.elegant.utils.UiThreadHandler
|
||||
@@ -27,7 +26,6 @@ import kotlin.math.roundToInt
|
||||
*/
|
||||
class SweeperTrafficDataView : ConstraintLayout,
|
||||
IMoGoBatteryManagementSystemListener,
|
||||
IMoGoChassisLamplightListener,
|
||||
IMoGoChassisGearStateListener,
|
||||
IMoGoSweeperFutianCleanSystemListener {
|
||||
private var tapPositionView //方向盘下方的档位
|
||||
@@ -78,8 +76,6 @@ class SweeperTrafficDataView : ConstraintLayout,
|
||||
super.onAttachedToWindow()
|
||||
//电量
|
||||
CallerBatteryManagementSystemListenerManager.addListener(TAG, this)
|
||||
//转向灯
|
||||
CallerChassisLamplightListenerManager.addListener(TAG, this)
|
||||
//档位
|
||||
CallerChassisGearStateListenerManager.addListener(TAG, this)
|
||||
//清扫车相关数据接口
|
||||
@@ -89,7 +85,6 @@ class SweeperTrafficDataView : ConstraintLayout,
|
||||
override fun onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow()
|
||||
CallerBatteryManagementSystemListenerManager.removeListener(TAG)
|
||||
CallerChassisLamplightListenerManager.removeListener(TAG)
|
||||
CallerChassisGearStateListenerManager.removeListener(TAG)
|
||||
CallerSweeperFutianCleanSystemListenerManager.removeListener(TAG)
|
||||
}
|
||||
@@ -127,14 +122,6 @@ class SweeperTrafficDataView : ConstraintLayout,
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 车辆转向灯
|
||||
* @param directionLight
|
||||
*/
|
||||
override fun onAutopilotLightSwitchData(lightSwitch: LightSwitch?) {
|
||||
//转向灯状态 0是正常 1是左转 2是右转
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置自动驾驶状态
|
||||
*/
|
||||
@@ -163,14 +150,6 @@ class SweeperTrafficDataView : ConstraintLayout,
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 刹车灯
|
||||
* @param brakeLight
|
||||
*/
|
||||
override fun onAutopilotBrakeLightData(brakeLight: Boolean) {
|
||||
d(TAG, "刹车灯:$brakeLight")
|
||||
}
|
||||
|
||||
/**
|
||||
* 方向盘下方的档位
|
||||
* @param gear
|
||||
|
||||
@@ -130,9 +130,10 @@ class SweeperTrafficDataView : ConstraintLayout,
|
||||
tvBattery?.text = "${states.bmsSoc.roundToInt()}%"
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 车辆转向灯
|
||||
* @param directionLight
|
||||
* @param lightSwitch
|
||||
*/
|
||||
override fun onAutopilotLightSwitchData(lightSwitch: LightSwitch?) {
|
||||
//转向灯状态 0是正常 1是左转 2是右转
|
||||
@@ -141,13 +142,6 @@ class SweeperTrafficDataView : ConstraintLayout,
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 刹车灯
|
||||
* @param brakeLight
|
||||
*/
|
||||
override fun onAutopilotBrakeLightData(brakeLight: Boolean) {
|
||||
d(TAG, "刹车灯:$brakeLight")
|
||||
}
|
||||
/**
|
||||
* 方向盘下方的档位
|
||||
* @param gear
|
||||
|
||||
@@ -38,12 +38,12 @@ class FuncConfigNetWorkModel {
|
||||
if (error == null) {
|
||||
error = onError
|
||||
}
|
||||
map["sn"] = MoGoAiCloudClientConfig.getInstance().sn
|
||||
map["mac"] = DeviceUtils.getMacAddress()
|
||||
map["channelVersion"] = AppIdentityModeUtils.getMisChannelCode(FunctionBuildConfig.appIdentityMode)
|
||||
}
|
||||
loader {
|
||||
apiCall {
|
||||
map["sn"] = MoGoAiCloudClientConfig.getInstance().sn
|
||||
map["mac"] = DeviceUtils.getMacAddress()
|
||||
map["channelVersion"] = AppIdentityModeUtils.getMisChannelCode(FunctionBuildConfig.appIdentityMode)
|
||||
getNetWorkApi().funcConfig(map)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,20 +34,20 @@ class IPCUpgradeNetWorkModel {
|
||||
fun upgradeConfirm(images: List<String>,padSn: String,releaseId: String,
|
||||
onSuccess: ((String) -> Unit),onError: ((String) -> Unit)){
|
||||
request<BaseResponse<Any?>> {
|
||||
val requestJson = JSONObject()
|
||||
val imagesJsonArray = JSONArray()
|
||||
images.iterator().forEach {
|
||||
imagesJsonArray.put(it)
|
||||
}
|
||||
requestJson.put("images",imagesJsonArray)
|
||||
requestJson.put("padSn",padSn)
|
||||
requestJson.put("releaseId",releaseId)
|
||||
val requestBody:RequestBody= RequestBody.create(
|
||||
MediaType.parse("application/json; charset=utf-8"),
|
||||
requestJson.toString()
|
||||
)
|
||||
loader{
|
||||
apiCall{
|
||||
val requestJson = JSONObject()
|
||||
val imagesJsonArray = JSONArray()
|
||||
images.iterator().forEach {
|
||||
imagesJsonArray.put(it)
|
||||
}
|
||||
requestJson.put("images",imagesJsonArray)
|
||||
requestJson.put("padSn",padSn)
|
||||
requestJson.put("releaseId",releaseId)
|
||||
val requestBody:RequestBody= RequestBody.create(
|
||||
MediaType.parse("application/json; charset=utf-8"),
|
||||
requestJson.toString()
|
||||
)
|
||||
getNetWorkApi(getBaseUrl()).upgradeConfirm(requestBody)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@ import android.graphics.*
|
||||
import android.graphics.Paint.Style.STROKE
|
||||
import android.os.Handler
|
||||
import android.os.HandlerThread
|
||||
import android.os.SystemClock
|
||||
import android.util.*
|
||||
import android.view.SurfaceHolder
|
||||
import android.view.SurfaceView
|
||||
@@ -15,6 +14,8 @@ import com.mogo.eagle.core.function.api.lookaround.data.*
|
||||
import com.mogo.eagle.core.function.call.autopilot.*
|
||||
import com.mogo.eagle.core.function.call.devatools.*
|
||||
import com.mogo.eagle.core.utilcode.kotlin.*
|
||||
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.ThreadUtils
|
||||
import com.mogo.eagle.core.utilcode.util.Utils
|
||||
import kotlinx.coroutines.*
|
||||
@@ -279,12 +280,11 @@ class M1LookAroundView: SurfaceView, SurfaceHolder.Callback, Runnable, IMoGoChas
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
CallerChassisSteeringStateListenerManager.addListener(TAG, this)
|
||||
Log.d(TAG, "--- 发起订阅 ---")
|
||||
CallerAutoPilotControlManager.setIsSubscribeM1StitchedVideo(true)
|
||||
scope.launch(ThreadUtils.getCpuPool().asCoroutineDispatcher()) {
|
||||
CallerDevaToolsManager.lookAroundProvider()?.flow()?.also { flow ->
|
||||
flow.onEach {
|
||||
Log.d(TAG, "-- onEach ---:$it")
|
||||
CallerLogger.d("$M_HMI$TAG", "-- onEach ---:$it")
|
||||
if (it.isValid()) {
|
||||
data = it
|
||||
handler.get()?.removeCallbacks(this@M1LookAroundView)
|
||||
@@ -307,7 +307,6 @@ class M1LookAroundView: SurfaceView, SurfaceHolder.Callback, Runnable, IMoGoChas
|
||||
override fun onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow()
|
||||
CallerChassisSteeringStateListenerManager.removeListener(TAG)
|
||||
Log.d(TAG, "--- 取消订阅 ---")
|
||||
CallerAutoPilotControlManager.setIsSubscribeM1StitchedVideo(false)
|
||||
handler.get()?.looper?.quitSafely()
|
||||
}
|
||||
|
||||
@@ -18,13 +18,11 @@ import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotPlanningActionsListener;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisBrakeStateListener;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisGearStateListener;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisSteeringStateListener;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisThrottleStateListener;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerPlanningActionsListenerManager;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisBrakeStateListenerManager;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisGearStateListenerManager;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisSteeringStateListenerManager;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisThrottleStateListenerManager;
|
||||
import com.mogo.eagle.core.function.hmi.R;
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils;
|
||||
@@ -33,8 +31,6 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import chassis.Chassis;
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
import chassis.ChassisStatesOuterClass;
|
||||
import planning.RoboSweeperTaskIndexOuterClass;
|
||||
|
||||
/**
|
||||
* @author Jing
|
||||
@@ -42,7 +38,6 @@ import planning.RoboSweeperTaskIndexOuterClass;
|
||||
* @since: 6/24/22
|
||||
*/
|
||||
public class TrafficDataView extends ConstraintLayout implements
|
||||
IMoGoChassisSteeringStateListener,
|
||||
IMoGoChassisGearStateListener ,
|
||||
IMoGoChassisBrakeStateListener,
|
||||
IMoGoChassisThrottleStateListener,
|
||||
@@ -54,9 +49,6 @@ public class TrafficDataView extends ConstraintLayout implements
|
||||
private ImageView speedImage;
|
||||
private ImageView brakeStatus;
|
||||
|
||||
//圆弧颜色
|
||||
private int mArcColor;
|
||||
|
||||
private static final int MSG_SEND_UPDATE = 1;
|
||||
private volatile double acceleration;
|
||||
private volatile float mBrake;
|
||||
@@ -114,7 +106,6 @@ public class TrafficDataView extends ConstraintLayout implements
|
||||
protected void onAttachedToWindow() {
|
||||
super.onAttachedToWindow();
|
||||
handler.sendEmptyMessageDelayed(MSG_SEND_UPDATE, 1000L);
|
||||
CallerChassisSteeringStateListenerManager.INSTANCE.addListener(TAG, this);
|
||||
CallerChassisGearStateListenerManager.INSTANCE.addListener(TAG, this);
|
||||
CallerChassisBrakeStateListenerManager.INSTANCE.addListener(TAG, this);
|
||||
CallerChassisThrottleStateListenerManager.INSTANCE.addListener(TAG, this);
|
||||
@@ -133,7 +124,6 @@ public class TrafficDataView extends ConstraintLayout implements
|
||||
@Override
|
||||
protected void onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow();
|
||||
CallerChassisSteeringStateListenerManager.INSTANCE.removeListener(TAG);
|
||||
CallerChassisGearStateListenerManager.INSTANCE.removeListener(TAG);
|
||||
CallerChassisBrakeStateListenerManager.INSTANCE.removeListener(TAG);
|
||||
CallerChassisThrottleStateListenerManager.INSTANCE.removeListener(TAG);
|
||||
@@ -145,20 +135,8 @@ public class TrafficDataView extends ConstraintLayout implements
|
||||
acceleration = planningActionMsg.getDestinationAcc();
|
||||
}
|
||||
|
||||
/**
|
||||
* 方向盘转向角 左+右-
|
||||
* @param steering
|
||||
*/
|
||||
@Override
|
||||
public void onAutopilotSteeringData(float steering) {
|
||||
if (Math.abs(steering) < 1) {
|
||||
steering = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 档位
|
||||
* @param gear
|
||||
*/
|
||||
@Override
|
||||
public void onAutopilotGearData(@NotNull Chassis.GearPosition gear) {
|
||||
@@ -178,23 +156,6 @@ public class TrafficDataView extends ConstraintLayout implements
|
||||
public void onAutopilotThrottle(float throttle) {
|
||||
mThrottle = throttle;
|
||||
}
|
||||
/**
|
||||
* 设置弧形颜色
|
||||
*
|
||||
* @param value 颜色值
|
||||
*/
|
||||
public void setArcColor(int value) {
|
||||
mArcColor = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置数据
|
||||
*
|
||||
* @param value 当前绘制的值
|
||||
*/
|
||||
public void setValues(int value) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* value呈现
|
||||
|
||||
@@ -29,22 +29,20 @@ class AiCloudIdentifyNetWorkModel private constructor() {
|
||||
onError: ((String) -> Unit)
|
||||
) {
|
||||
request<BaseResponse<Any>> {
|
||||
val map = mutableMapOf<String, Any>()
|
||||
start {
|
||||
map["sn"] = MoGoAiCloudClientConfig.getInstance().sn
|
||||
map["status"] = dataReceive
|
||||
map["startMetre"] = START_METRE
|
||||
map["endMetre"] = END_METRE
|
||||
map["type"] = 1
|
||||
if (lon != 0.0) {
|
||||
map["lon"] = lon
|
||||
}
|
||||
if (lat != 0.0) {
|
||||
map["lat"] = lat
|
||||
}
|
||||
}
|
||||
loader {
|
||||
apiCall {
|
||||
val map = mutableMapOf<String, Any>()
|
||||
map["sn"] = MoGoAiCloudClientConfig.getInstance().sn
|
||||
map["status"] = dataReceive
|
||||
map["startMetre"] = START_METRE
|
||||
map["endMetre"] = END_METRE
|
||||
map["type"] = 1
|
||||
if (lon != 0.0) {
|
||||
map["lon"] = lon
|
||||
}
|
||||
if (lat != 0.0) {
|
||||
map["lat"] = lat
|
||||
}
|
||||
getNetWorkApi().identifyRange(map)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,9 @@ object CallerAutoPilotStatusListenerManager : CallerBase<IMoGoAutopilotStatusLis
|
||||
if (newValue == null) {
|
||||
return@observable
|
||||
}
|
||||
if(newValue == 0L){
|
||||
mAutopilotStatusInfo.isArriveAtStation = false
|
||||
}
|
||||
M_LISTENERS.forEach {
|
||||
val listener = it.value
|
||||
listener.onAutopilotRouteLineId(newValue)
|
||||
@@ -34,7 +37,7 @@ object CallerAutoPilotStatusListenerManager : CallerBase<IMoGoAutopilotStatusLis
|
||||
|
||||
private var autopilotState: Int by Delegates.observable(0) { _, oldValue, newValue ->
|
||||
if (oldValue != newValue) {
|
||||
fixAtStationState(newValue)
|
||||
//todo emArrow chainLog
|
||||
M_LISTENERS.forEach {
|
||||
val listener = it.value
|
||||
listener.onAutopilotStatusResponse(newValue)
|
||||
@@ -42,19 +45,6 @@ object CallerAutoPilotStatusListenerManager : CallerBase<IMoGoAutopilotStatusLis
|
||||
}
|
||||
}
|
||||
|
||||
private fun fixAtStationState(autoPilotMode: Int) {
|
||||
if (autoPilotMode == 2) {
|
||||
//自驾状态下,将到站状态置为false
|
||||
mAutopilotStatusInfo.isArriveAtStation = false
|
||||
} else {
|
||||
//其它状态下, 将到站状态置为false
|
||||
val arriveAtStation = mAutopilotStatusInfo.isArriveAtStation
|
||||
if (arriveAtStation) {
|
||||
mAutopilotStatusInfo.isArriveAtStation = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private var dockerV: String by Delegates.observable("") { _, oldValue, newValue ->
|
||||
if (!oldValue.contentEquals(newValue)) {
|
||||
M_LISTENERS.forEach {
|
||||
|
||||
@@ -51,8 +51,6 @@ dependencies {
|
||||
implementation rootProject.ext.dependencies.arouter
|
||||
annotationProcessor rootProject.ext.dependencies.aroutercompiler
|
||||
implementation rootProject.ext.dependencies.rxjava
|
||||
|
||||
implementation rootProject.ext.dependencies.amapnavi3dmap
|
||||
implementation rootProject.ext.dependencies.analytics
|
||||
|
||||
api 'org.greenrobot:eventbus:3.1.1'
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
package com.mogo.commons.module;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-01-03
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
public class ServiceConst {
|
||||
|
||||
/**
|
||||
* 类型
|
||||
*/
|
||||
public static final String TYPE = "STRATEGY_REFRESH";
|
||||
|
||||
|
||||
/**
|
||||
* 卡片 用户数据
|
||||
*/
|
||||
public static final String CARD_TYPE_USER_DATA = "CARD_TYPE_USER_DATA";
|
||||
|
||||
/**
|
||||
* 卡片 探路数据
|
||||
*/
|
||||
public static final String CARD_TYPE_ROAD_CONDITION = "CARD_TYPE_ROAD_CONDITION";
|
||||
|
||||
/**
|
||||
* 卡片 新鲜事
|
||||
*/
|
||||
public static final String CARD_TYPE_NOVELTY = "CARD_TYPE_NOVELTY";
|
||||
|
||||
}
|
||||
@@ -61,7 +61,7 @@ bytex.ASM_API=ASM7
|
||||
|
||||
################ 外部依赖引用 ################
|
||||
# loglib
|
||||
LOGLIB_VERSION=1.10.6
|
||||
LOGLIB_VERSION=1.10.7
|
||||
######## MogoAiCloudSDK Version ########
|
||||
# 网络请求LOGLIB_VERSION
|
||||
MOGO_NETWORK_VERSION=1.4.7.19
|
||||
|
||||
Reference in New Issue
Block a user