Merge branch 'dev_arch_opt_3.0' into dev_robosweeper-d_app-module_221230_1.1.0
# Conflicts: # OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/fragment/BaseSweeperTabFragment.java # OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/fragment/SweeperFragment.java # OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/presenter/SweeperPresenter.java # OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/ui/SweeperOperatePanelView.java # app_ipc_monitoring/src/main/java/com/zhidao/adas/client/DataDistribution.java # app_ipc_monitoring/src/main/java/com/zhidao/adas/client/ui/MainActivity.java # app_mogo_magic_ring/src/main/java/com/zhidao/adas/magic/ui/MainActivity.java # core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/adapter/MoGoHandAdasMsgManager.java # core/function-impl/mogo-core-function-bindingcar/src/main/java/com/mogo/eagle/core/function/bindingcar/BindingcarProvider.java # core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/autopilot/adapter/MoGoAdasListenerImpl.kt # core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/can/CanImpl.kt # core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/DebugSettingView.kt # core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/SteeringWheelView.java # core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/TrafficDataView.java # core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotVehicleStateListener.kt # core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotVehicleStateListenerManager.kt # libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/OnAdasListener.java # libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/msg/MyMessageFactory.java # libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/msg/VehicleStateMessage.java
@@ -1,79 +0,0 @@
|
||||
plugins {
|
||||
id 'com.android.library'
|
||||
id 'kotlin-android'
|
||||
id 'kotlin-android-extensions'
|
||||
id 'kotlin-kapt'
|
||||
id 'com.alibaba.arouter'
|
||||
}
|
||||
android {
|
||||
compileSdkVersion rootProject.ext.android.compileSdkVersion
|
||||
// buildToolsVersion rootProject.ext.android.buildToolsVersion
|
||||
defaultConfig {
|
||||
minSdkVersion rootProject.ext.android.minSdkVersion
|
||||
targetSdkVersion rootProject.ext.android.targetSdkVersion
|
||||
versionCode Integer.valueOf(VERSION_CODE)
|
||||
versionName getValueFromRootProperties("${project.name.replace("-", "_").toUpperCase()}_VERSION")
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
consumerProguardFiles 'consumer-rules.pro'
|
||||
//ARouter apt 参数
|
||||
kapt {
|
||||
useBuildCache = false
|
||||
arguments {
|
||||
arg("AROUTER_MODULE_NAME", project.getName())
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||
implementation rootProject.ext.dependencies.kotlinstdlibjdk7
|
||||
implementation rootProject.ext.dependencies.androidxccorektx
|
||||
implementation rootProject.ext.dependencies.androidxappcompat
|
||||
implementation rootProject.ext.dependencies.androidxconstraintlayout
|
||||
implementation rootProject.ext.dependencies.arouter
|
||||
implementation rootProject.ext.dependencies.rxandroid
|
||||
|
||||
kapt rootProject.ext.dependencies.aroutercompiler
|
||||
|
||||
implementation rootProject.ext.dependencies.mogoami
|
||||
implementation rootProject.ext.dependencies.mogoaicloudtelematic
|
||||
|
||||
if (Boolean.valueOf(USE_MAVEN_PACKAGE)) {
|
||||
implementation rootProject.ext.dependencies.mogo_core_data
|
||||
implementation rootProject.ext.dependencies.modulecommon
|
||||
implementation rootProject.ext.dependencies.moduleservice
|
||||
|
||||
implementation rootProject.ext.dependencies.mogo_core_utils
|
||||
implementation rootProject.ext.dependencies.mogo_core_network
|
||||
implementation rootProject.ext.dependencies.mogo_core_function_api
|
||||
implementation rootProject.ext.dependencies.mogo_core_function_call
|
||||
implementation project(':libraries:mogo-adas')
|
||||
} else {
|
||||
implementation project(':modules:mogo-module-common')
|
||||
|
||||
implementation project(':core:mogo-core-data')
|
||||
implementation project(':core:mogo-core-utils')
|
||||
implementation project(':core:mogo-core-network')
|
||||
implementation project(':core:mogo-core-function-api')
|
||||
implementation project(':core:mogo-core-function-call')
|
||||
implementation project(':libraries:mogo-adas')
|
||||
}
|
||||
}
|
||||
|
||||
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()
|
||||
@@ -1,3 +0,0 @@
|
||||
GROUP=com.mogo.eagle.core.function.impl
|
||||
POM_ARTIFACT_ID=autopilot
|
||||
VERSION_CODE=1
|
||||
@@ -1,203 +0,0 @@
|
||||
package com.mogo.eagle.core.function.autopilot.adapter;
|
||||
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_DEVA;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
|
||||
import com.mogo.eagle.core.data.constants.MoGoConfig;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotCarConfigListener;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotCarStateListener;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotVehicleStateListener;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotCarConfigListenerManager;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotCarStatusListenerManager;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotVehicleStateListenerManager;
|
||||
import com.mogo.eagle.core.function.call.bindingcar.CallerBindingcarManager;
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager;
|
||||
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import chassis.Chassis;
|
||||
import chassis.ChassisStatesOuterClass;
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
import planning.RoboSweeperTaskIndexOuterClass;
|
||||
|
||||
public class MoGoHandAdasMsgManager implements
|
||||
IMoGoAutopilotVehicleStateListener,
|
||||
IMoGoAutopilotCarConfigListener,
|
||||
IMoGoAutopilotCarStateListener {
|
||||
|
||||
private final String TAG = "AdasEventManager";
|
||||
|
||||
private static volatile MoGoHandAdasMsgManager moGoHandAdasMsgManager;
|
||||
private Context mContext;
|
||||
|
||||
private MoGoHandAdasMsgManager(Context context) {
|
||||
CallerAutopilotVehicleStateListenerManager.INSTANCE.addListener(TAG, this);
|
||||
CallerAutopilotCarConfigListenerManager.INSTANCE.addListener(TAG, this);
|
||||
CallerAutopilotCarStatusListenerManager.INSTANCE.addListener(TAG, this);
|
||||
mContext = context;
|
||||
}
|
||||
|
||||
public static MoGoHandAdasMsgManager getInstance(Context context) {
|
||||
if (moGoHandAdasMsgManager == null) {
|
||||
synchronized (MoGoHandAdasMsgManager.class) {
|
||||
if (moGoHandAdasMsgManager == null) {
|
||||
moGoHandAdasMsgManager = new MoGoHandAdasMsgManager(context);
|
||||
}
|
||||
}
|
||||
}
|
||||
return moGoHandAdasMsgManager;
|
||||
}
|
||||
|
||||
private int turnLightTimes = 0;
|
||||
private boolean isOnTurnLight = false;
|
||||
private int turnLight = 0;
|
||||
private volatile boolean isShowTurnLight = false;
|
||||
private int brakeLight = -1;
|
||||
|
||||
|
||||
public void getConfig() {
|
||||
com.elegant.utils.UiThreadHandler.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
CallerAutoPilotManager.INSTANCE.getCarConfig();
|
||||
}
|
||||
}, 0);
|
||||
}
|
||||
|
||||
private int setTurnLightState(int turn_light) {
|
||||
if (turn_light == 0) {
|
||||
if (isOnTurnLight) {
|
||||
if (turnLightTimes >= 10) {
|
||||
isOnTurnLight = false;
|
||||
turnLight = 0;
|
||||
}
|
||||
turnLightTimes++;
|
||||
}
|
||||
} else if (turn_light == 1) {
|
||||
turnLightTimes = 0;
|
||||
isOnTurnLight = true;
|
||||
turnLight = 1;
|
||||
} else if (turn_light == 2) {
|
||||
turnLightTimes = 0;
|
||||
isOnTurnLight = true;
|
||||
turnLight = 2;
|
||||
}
|
||||
return turnLight;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotLightSwitchData(Chassis.LightSwitch lightSwitch) {
|
||||
//can数据转发 转向灯状态 0是正常 1是左转 2是右转
|
||||
// if (!AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode)) { //小巴不展示
|
||||
if (lightSwitch != null) {
|
||||
int state = setTurnLightState(lightSwitch.getNumber());
|
||||
CallerLogger.INSTANCE.d(M_DEVA + "TurnLight", "---onAutopilotLightSwitchData ---state = " + state + "---lightSwitch.getNumber() = " + lightSwitch.getNumber());
|
||||
if (state == 1 || state == 2) {
|
||||
isShowTurnLight = true;
|
||||
CallerHmiManager.INSTANCE.showBrakeLight(0);
|
||||
} else {
|
||||
isShowTurnLight = false;
|
||||
}
|
||||
CallerHmiManager.INSTANCE.showTurnLight(state);
|
||||
}
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotBrakeLightData(boolean brakeLight) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotCarConfig(@NotNull MessagePad.CarConfigResp carConfigResp) {
|
||||
if (carConfigResp != null && !TextUtils.isEmpty(carConfigResp.getMacAddress())) {
|
||||
Log.d("Upgrade", "MoGoHandAdasMsgManager address = " + carConfigResp.getMacAddress());
|
||||
CallerBindingcarManager.getBindingcarProvider().getBindingcarInfo(carConfigResp.getMacAddress(), MoGoAiCloudClientConfig.getInstance().getSn());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotCarStateData(@Nullable MessagePad.GnssInfo gnssInfo) {
|
||||
//根据加速度判断 是否刹车
|
||||
// if (!AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode)) { //小巴不展示
|
||||
if (gnssInfo != null) {
|
||||
//设置刹车信息
|
||||
if (gnssInfo.getAcceleration() < SharedPrefsMgr.getInstance(mContext).getFloat(MoGoConfig.BRAKE_ACCELERATION_THRESHOLD, -2.5F)) {
|
||||
brakeLight = 1;
|
||||
} else {
|
||||
brakeLight = 0;
|
||||
}
|
||||
CallerLogger.INSTANCE.d(M_DEVA + "BrakeLight", "---onAutopilotLightSwitchData ---Acceleration = " + gnssInfo.getAcceleration() + "-- brakeLight = " + brakeLight);
|
||||
if (!isShowTurnLight) {
|
||||
CallerHmiManager.INSTANCE.showBrakeLight(brakeLight);
|
||||
}
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 车辆方向盘转向角回调
|
||||
*
|
||||
* @param steering 方向盘转向角
|
||||
*/
|
||||
@Override
|
||||
public void onAutopilotSteeringData(float steering) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 车辆挂挡档位
|
||||
*
|
||||
* @param gear 档位
|
||||
*/
|
||||
@Override
|
||||
public void onAutopilotGearData(@NotNull Chassis.GearPosition gear) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotDataException(long timestamp) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotAcc(float carAcc) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotThrottle(float throttle) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotBrake(float brake) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onSweeperFutianCleanSystemState(ChassisStatesOuterClass.SweeperFuTianTaskSystemStates cleanSystemState) {
|
||||
|
||||
}
|
||||
@Override
|
||||
public void onSweeperFutianTaskIndexData(@NonNull RoboSweeperTaskIndexOuterClass.RoboSweeperTaskIndex roboSweeperTaskIndex) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBMSSystemStates(@NonNull ChassisStatesOuterClass.BMSSystemStates bmsSystemStates) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,84 +0,0 @@
|
||||
plugins {
|
||||
id 'com.android.library'
|
||||
id 'kotlin-android'
|
||||
id 'kotlin-android-extensions'
|
||||
id 'kotlin-kapt'
|
||||
id 'com.alibaba.arouter'
|
||||
}
|
||||
android {
|
||||
compileSdkVersion rootProject.ext.android.compileSdkVersion
|
||||
// buildToolsVersion rootProject.ext.android.buildToolsVersion
|
||||
defaultConfig {
|
||||
minSdkVersion rootProject.ext.android.minSdkVersion
|
||||
targetSdkVersion rootProject.ext.android.targetSdkVersion
|
||||
versionCode Integer.valueOf(VERSION_CODE)
|
||||
versionName getValueFromRootProperties("${project.name.replace("-", "_").toUpperCase()}_VERSION")
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
consumerProguardFiles 'consumer-rules.pro'
|
||||
//ARouter apt 参数
|
||||
kapt {
|
||||
useBuildCache = false
|
||||
arguments {
|
||||
arg("AROUTER_MODULE_NAME", project.getName())
|
||||
}
|
||||
}
|
||||
|
||||
javaCompileOptions{
|
||||
annotationProcessorOptions{
|
||||
arguments = ["room.schemaLocation":"$projectDir/schemas".toString()]
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
kotlinOptions {
|
||||
jvmTarget = "1.8"
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||
implementation rootProject.ext.dependencies.kotlinstdlibjdk7
|
||||
implementation rootProject.ext.dependencies.arouter
|
||||
implementation rootProject.ext.dependencies.rxandroid
|
||||
implementation rootProject.ext.dependencies.androidxroomruntime
|
||||
implementation rootProject.ext.dependencies.androidxroomktx
|
||||
implementation rootProject.ext.dependencies.litezxing
|
||||
kapt rootProject.ext.dependencies.androidxroomcompiler
|
||||
kapt rootProject.ext.dependencies.aroutercompiler
|
||||
|
||||
if (Boolean.valueOf(USE_MAVEN_PACKAGE)) {
|
||||
implementation rootProject.ext.dependencies.mogocommons
|
||||
implementation rootProject.ext.dependencies.mogoserviceapi
|
||||
implementation rootProject.ext.dependencies.modulecommon
|
||||
|
||||
implementation rootProject.ext.dependencies.mogo_core_data
|
||||
implementation rootProject.ext.dependencies.mogo_core_utils
|
||||
implementation rootProject.ext.dependencies.mogo_core_network
|
||||
implementation rootProject.ext.dependencies.mogo_core_function_call
|
||||
} else {
|
||||
implementation project(":foudations:mogo-commons")
|
||||
implementation project(':services:mogo-service-api')
|
||||
implementation project(':modules:mogo-module-common')
|
||||
|
||||
implementation project(':core:mogo-core-data')
|
||||
implementation project(':core:mogo-core-utils')
|
||||
implementation project(':core:mogo-core-network')
|
||||
implementation project(':core:mogo-core-function-call')
|
||||
}
|
||||
}
|
||||
|
||||
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()
|
||||
@@ -1,3 +0,0 @@
|
||||
GROUP=com.mogo.eagle.core.function.impl
|
||||
POM_ARTIFACT_ID=notice
|
||||
VERSION_CODE=1
|
||||
@@ -1,9 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.mogo.eagle.core.function.bindingcar">
|
||||
|
||||
<application>
|
||||
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
@@ -1,187 +0,0 @@
|
||||
package com.mogo.eagle.core.function.bindingcar;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.eagle.core.data.bindingcar.ModifyBindingcarInfo;
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
|
||||
import com.mogo.eagle.core.data.config.HmiBuildConfig;
|
||||
import com.mogo.eagle.core.data.constants.MogoServicePaths;
|
||||
import com.mogo.eagle.core.function.api.bindingcar.BindingcarCallBack;
|
||||
import com.mogo.eagle.core.function.api.bindingcar.IMoGoBindingcarProvider;
|
||||
import com.mogo.eagle.core.function.appupgrade.network.UpgradeAppNetWorkManager;
|
||||
import com.mogo.eagle.core.function.bindingcar.network.BindingcarNetWorkManager;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager;
|
||||
import com.mogo.eagle.core.function.call.bindingcar.CallerBindingcarManager;
|
||||
import com.mogo.eagle.core.function.ipcupgrade.IPCUpgradeManager;
|
||||
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils;
|
||||
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr;
|
||||
import com.mogo.eagle.core.utilcode.mogo.toast.TipToast;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description 绑定sn
|
||||
* @since: 3/26/22
|
||||
*/
|
||||
@Route(path = MogoServicePaths.PATH_BINDING_CAR)
|
||||
public class BindingcarProvider implements IMoGoBindingcarProvider {
|
||||
|
||||
private Context mContext;
|
||||
private volatile String mAddress;
|
||||
private volatile String mWidevineIDWithMd5; //google 数字版权
|
||||
private volatile int mScreenType = -1;
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String getFunctionName() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
IPCUpgradeManager.Companion.getINSTANCE().destroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(Context context) {
|
||||
mContext = context;
|
||||
IPCUpgradeManager.Companion.getINSTANCE().initServer(context);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取macaddress,每次连接请求一次
|
||||
*
|
||||
* @param macAddress
|
||||
*/
|
||||
@Override
|
||||
public void getBindingcarInfo(String macAddress, String widevineIDWithMd5) {
|
||||
Log.d("Upgrade", "getBindingcarInfo macAddress = " + macAddress + "--widevineIDWithMd5 = " + widevineIDWithMd5);
|
||||
mAddress = macAddress;
|
||||
mWidevineIDWithMd5 = widevineIDWithMd5;
|
||||
if (getScreenType() == 1) { //司机屏
|
||||
driverScreen(macAddress, widevineIDWithMd5);
|
||||
} else if (getScreenType() == 2) { //乘客屏
|
||||
passengerScreen(macAddress, widevineIDWithMd5);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 确认升级工控机docker版本
|
||||
* @param images docker列表
|
||||
* @param padSn SN
|
||||
* @param releaseId 任务ID
|
||||
*/
|
||||
@Override
|
||||
public void upgradeConfirm(List<String> images, String padSn, String releaseId) {
|
||||
IPCUpgradeManager.Companion.getINSTANCE().upgradeConfirm(images, padSn, releaseId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取新工控机docker版本
|
||||
* @param padSn SN
|
||||
* @param dockerVersion 当前工控机版本
|
||||
*/
|
||||
@Override
|
||||
public void queryContainers(String padSn,String dockerVersion) {
|
||||
IPCUpgradeManager.Companion.getINSTANCE().queryContainers(padSn,dockerVersion);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void modifyCarInfo(BindingcarCallBack callBack) {
|
||||
BindingcarNetWorkManager.getInstance().modifyBindingcar(mAddress, mWidevineIDWithMd5, callBack, getScreenType());
|
||||
}
|
||||
|
||||
private void driverScreen(String macAddress, String widevineIDWithMd5) {
|
||||
long currentHour = System.currentTimeMillis() / (1000 * 60);
|
||||
long oldHour = SharedPrefsMgr.getInstance(mContext).getLong("typeDriver", 0);
|
||||
//如果2分钟内频繁调,需要拦截,业务导致的会多次请求工控机信息
|
||||
if (HmiBuildConfig.isShowSnBindingView) {
|
||||
if (currentHour - oldHour > 1) {
|
||||
SharedPrefsMgr.getInstance(mContext).putLong("typeDriver", System.currentTimeMillis() / (1000 * 60));
|
||||
BindingcarNetWorkManager.getInstance().getBindingcarInfo(mContext, macAddress, widevineIDWithMd5, getScreenType());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void passengerScreen(String macAddress, String widevineIDWithMd5) {
|
||||
long currentHour = System.currentTimeMillis() / (1000 * 60);
|
||||
long oldHour = SharedPrefsMgr.getInstance(mContext).getLong("typePassenger", 0);
|
||||
//如果2分钟内频繁调,需要拦截,业务导致的会多次请求工控机信息
|
||||
if (HmiBuildConfig.isShowSnBindingView) {
|
||||
if (currentHour - oldHour > 1) {
|
||||
SharedPrefsMgr.getInstance(mContext).putLong("typePassenger", System.currentTimeMillis() / (1000 * 60));
|
||||
BindingcarNetWorkManager.getInstance().getBindingcarInfo(mContext, macAddress, widevineIDWithMd5, getScreenType());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 以后可能废弃
|
||||
* @return
|
||||
*/
|
||||
private int getScreenType() {
|
||||
int screenType = -1;
|
||||
if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {
|
||||
screenType = 1; //司机屏
|
||||
}
|
||||
|
||||
if (AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)) {
|
||||
screenType = 2; //乘客屏
|
||||
}
|
||||
return screenType;
|
||||
}
|
||||
|
||||
private int getCarType() {
|
||||
int carType = -1;
|
||||
if(AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode)) {
|
||||
carType = 1; //bus
|
||||
}
|
||||
|
||||
if(AppIdentityModeUtils.isTaxi(FunctionBuildConfig.appIdentityMode)) {
|
||||
carType = 2; //taxi
|
||||
}
|
||||
|
||||
return carType;
|
||||
|
||||
}
|
||||
|
||||
private String getCarScreenType() {
|
||||
String screenType = "";
|
||||
if(AppIdentityModeUtils.isTaxi(FunctionBuildConfig.appIdentityMode) && AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)) {
|
||||
screenType = "1"; //taxi乘客端
|
||||
}
|
||||
|
||||
if(AppIdentityModeUtils.isTaxi(FunctionBuildConfig.appIdentityMode) && AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {
|
||||
screenType = "2"; //taxi司机端
|
||||
}
|
||||
|
||||
if(AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode) && AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)) {
|
||||
screenType = "3"; //bus 乘客端
|
||||
}
|
||||
|
||||
if(AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode) && AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {
|
||||
screenType = "4"; //bus 司机端
|
||||
}
|
||||
|
||||
if(AppIdentityModeUtils.isSweeper(FunctionBuildConfig.appIdentityMode) && AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {
|
||||
screenType = "6"; //清扫车 司机端
|
||||
}
|
||||
|
||||
return screenType;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询app是否需要升级
|
||||
*/
|
||||
@Override
|
||||
public void queryAppUpgrade() {
|
||||
UpgradeAppNetWorkManager.getInstance().getAppUpgradeInfo(mContext, mAddress, getCarScreenType());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,175 +0,0 @@
|
||||
package com.mogo.eagle.core.function.bindingcar.network;
|
||||
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_BINDING;
|
||||
|
||||
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.data.config.HdMapBuildConfig;
|
||||
import com.mogo.eagle.core.function.api.bindingcar.BindingcarCallBack;
|
||||
import com.mogo.eagle.core.function.bindingcar.R;
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager;
|
||||
import com.mogo.eagle.core.function.call.map.CallerHDMapManager;
|
||||
import com.mogo.eagle.core.network.MoGoRetrofitFactory;
|
||||
import com.mogo.eagle.core.network.utils.GsonUtil;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
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.GsonUtils;
|
||||
|
||||
import io.reactivex.Observer;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.annotations.NonNull;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
import okhttp3.MediaType;
|
||||
import okhttp3.RequestBody;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description 绑定车机网络请求
|
||||
* @since: 3/25/22
|
||||
*/
|
||||
public class BindingcarNetWorkManager {
|
||||
private static volatile BindingcarNetWorkManager requestNoticeManager;
|
||||
private final BindingcarApiService mBindingcarApiService;
|
||||
private static final String TAG = "BindingcarNetManager";
|
||||
|
||||
private BindingcarNetWorkManager() {
|
||||
mBindingcarApiService = MoGoRetrofitFactory.getInstance(HostConst.getHost())
|
||||
.create(BindingcarApiService.class);
|
||||
}
|
||||
|
||||
public static BindingcarNetWorkManager getInstance() {
|
||||
if (requestNoticeManager == null) {
|
||||
synchronized (BindingcarNetWorkManager.class) {
|
||||
if (requestNoticeManager == null) {
|
||||
requestNoticeManager = new BindingcarNetWorkManager();
|
||||
}
|
||||
}
|
||||
}
|
||||
return requestNoticeManager;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取绑定的车辆信息
|
||||
*
|
||||
* @param macAddress mac地址
|
||||
*/
|
||||
public void getBindingcarInfo(Context context, String macAddress, String widevineIDWithMd5, int screenType) {
|
||||
// String macAddress1 = "48:b0:2d:4d:33:40";
|
||||
// String sn = "X2020220417KA94QIN";
|
||||
|
||||
BindingcarRequest request = new BindingcarRequest(macAddress, widevineIDWithMd5, screenType);
|
||||
RequestBody requestBody = RequestBody.create(MediaType.get("application/json;charset=UTF-8"), GsonUtil.jsonFromObject(request));
|
||||
mBindingcarApiService.getBindingcarInfo(requestBody)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<BindingcarInfo>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull BindingcarInfo info) {
|
||||
if (info != null && info.getData() != null) {
|
||||
CallerLogger.INSTANCE.d(M_BINDING + TAG, "getBindingcarInfo onNext info.getData() =" + info.getData().toString());
|
||||
//根据车辆类型切换不同的车辆模型,只针对红旗做处理
|
||||
updateCarVrIconRes(info.getData().getBrandId());
|
||||
switch (info.getData().getCompare()) {
|
||||
case "0":
|
||||
CallerHmiManager.INSTANCE.showBindingcarDialog();
|
||||
break;
|
||||
case "3":
|
||||
CallerHmiManager.INSTANCE.showModifyBindingcarDialog();
|
||||
break;
|
||||
case "null":
|
||||
TipToast.shortTip("当前工控机没有入库");
|
||||
break;
|
||||
}
|
||||
SharedPrefsMgr.getInstance(context).putString(SharedPrefsConstants.CAR_INFO, GsonUtils.toJson(info.getData()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
CallerLogger.INSTANCE.e(M_BINDING + TAG, "getBindingcarInfo onError e = " + e.toString() + "---e.getMessage = " + e.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 绑定和修改绑定车辆
|
||||
* mac: 48:b0:2d:3a:9c:19
|
||||
*/
|
||||
public void modifyBindingcar(String macAddress, String widevineIDWithMd5, BindingcarCallBack callBack, int screenType) {
|
||||
// String macAddress1 = "48:b0:2d:4d:33:40";
|
||||
// String sn = "X2020220417KA94QIN";
|
||||
BindingcarRequest request = new BindingcarRequest(macAddress, widevineIDWithMd5, screenType);
|
||||
RequestBody requestBody = RequestBody.create(MediaType.get("application/json;charset=UTF-8"), GsonUtil.jsonFromObject(request));
|
||||
mBindingcarApiService.modifyBindingcarInfo(requestBody)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<ModifyBindingcarInfo>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull ModifyBindingcarInfo info) {
|
||||
if (info != null) {
|
||||
callBack.callBackResult(info);
|
||||
CallerLogger.INSTANCE.d(M_BINDING + TAG, "modifyBindingcar onNext code = " + info.code + "---msg = " + info.msg + "--info.toString() = " + info.toString());
|
||||
updateCarVrIconRes(info.getData().getBrandId());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
CallerLogger.INSTANCE.e(M_BINDING + TAG, "modifyBindingcar onError e = " + e.toString() + "---e.getMessage = " + e.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void updateCarVrIconRes(String brandId){
|
||||
if(brandId == null || brandId.isEmpty()){
|
||||
return;
|
||||
}
|
||||
CallerLogger.INSTANCE.d(M_BINDING + TAG,"updateCarVrIconRes : " + brandId);
|
||||
switch (brandId){
|
||||
case "1":
|
||||
CallerHDMapManager.INSTANCE.changeCurrentIcon(R.raw.chuzuche);
|
||||
HdMapBuildConfig.currentCarVrIconRes =R.raw.chuzuche;
|
||||
break;
|
||||
case "2":
|
||||
CallerHDMapManager.INSTANCE.changeCurrentIcon(R.raw.hq_h9);
|
||||
HdMapBuildConfig.currentCarVrIconRes =R.raw.hq_h9;
|
||||
break;
|
||||
case "3":
|
||||
CallerHDMapManager.INSTANCE.changeCurrentIcon(R.raw.xiaobache);
|
||||
HdMapBuildConfig.currentCarVrIconRes =R.raw.xiaobache;
|
||||
break;
|
||||
default:
|
||||
CallerHDMapManager.INSTANCE.changeCurrentIcon(R.raw.chuzuche);
|
||||
HdMapBuildConfig.currentCarVrIconRes =R.raw.chuzuche;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
package com.mogo.eagle.core.function.bindingcar.network;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description
|
||||
* @since: 11/15/21
|
||||
*/
|
||||
public class BindingcarRequest {
|
||||
private String mac;
|
||||
private String sn;
|
||||
private int type;
|
||||
|
||||
public BindingcarRequest(String mac, String sn, int type) {
|
||||
this.mac = mac;
|
||||
this.sn = sn;
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getMac() {
|
||||
return mac;
|
||||
}
|
||||
|
||||
public void setMac(String mac) {
|
||||
this.mac = mac;
|
||||
}
|
||||
|
||||
public String getSn() {
|
||||
return sn;
|
||||
}
|
||||
|
||||
public void setSn(String sn) {
|
||||
this.sn = sn;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(int type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "BindingcarRequest{" +
|
||||
"mac='" + mac + '\'' +
|
||||
", sn='" + sn + '\'' +
|
||||
", type=" + type +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,7 @@ plugins {
|
||||
|
||||
android {
|
||||
compileSdkVersion rootProject.ext.android.compileSdkVersion
|
||||
// buildToolsVersion rootProject.ext.android.buildToolsVersion
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion rootProject.ext.android.minSdkVersion
|
||||
targetSdkVersion rootProject.ext.android.targetSdkVersion
|
||||
@@ -17,7 +17,6 @@ android {
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
consumerProguardFiles 'consumer-rules.pro'
|
||||
|
||||
//ARouter apt 参数
|
||||
kapt {
|
||||
useBuildCache = false
|
||||
@@ -25,6 +24,13 @@ android {
|
||||
arg("AROUTER_MODULE_NAME", project.getName())
|
||||
}
|
||||
}
|
||||
|
||||
javaCompileOptions{
|
||||
annotationProcessorOptions{
|
||||
arguments = ["room.schemaLocation":"$projectDir/schemas".toString()]
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
@@ -39,36 +45,24 @@ android {
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
kotlinOptions {
|
||||
jvmTarget = '1.8'
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||
implementation rootProject.ext.dependencies.kotlinstdlibjdk7
|
||||
implementation rootProject.ext.dependencies.coroutinescore
|
||||
implementation rootProject.ext.dependencies.arouter
|
||||
kapt rootProject.ext.dependencies.aroutercompiler
|
||||
|
||||
if (Boolean.valueOf(USE_MAVEN_PACKAGE)) {
|
||||
implementation rootProject.ext.dependencies.mogoserviceapi
|
||||
implementation rootProject.ext.dependencies.modulecommon
|
||||
|
||||
implementation project(':libraries:map-usbcamera')
|
||||
implementation rootProject.ext.dependencies.rxandroid
|
||||
|
||||
implementation rootProject.ext.dependencies.mogo_core_utils
|
||||
implementation rootProject.ext.dependencies.mogo_core_function_api
|
||||
implementation rootProject.ext.dependencies.mogo_core_function_call
|
||||
implementation rootProject.ext.dependencies.mogo_core_data
|
||||
}else {
|
||||
implementation project(':services:mogo-service-api')
|
||||
implementation project(':modules:mogo-module-common')
|
||||
|
||||
implementation project(':libraries:map-usbcamera')
|
||||
|
||||
implementation project(':core:mogo-core-utils')
|
||||
implementation project(':core:mogo-core-function-api')
|
||||
implementation project(':core:mogo-core-function-call')
|
||||
implementation project(':core:mogo-core-data')
|
||||
}
|
||||
implementation project(':foudations:mogo-commons')
|
||||
implementation project(':core:mogo-core-data')
|
||||
implementation project(':core:mogo-core-utils')
|
||||
implementation project(':core:mogo-core-network')
|
||||
implementation project(':core:mogo-core-function-call')
|
||||
}
|
||||
|
||||
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()
|
||||
@@ -1,3 +1,3 @@
|
||||
GROUP=com.mogo.eagle.core.function.impl
|
||||
POM_ARTIFACT_ID=check
|
||||
POM_ARTIFACT_ID=biz
|
||||
VERSION_CODE=1
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.mogo.eagle.core.function.autopilot">
|
||||
package="com.mogo.eagle.core.function.biz">
|
||||
|
||||
</manifest>
|
||||
@@ -0,0 +1,66 @@
|
||||
package com.mogo.eagle.function.biz
|
||||
|
||||
import android.content.Context
|
||||
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.biz.IMoGoFuncBizProvider
|
||||
import com.mogo.eagle.core.function.api.biz.IMoGoNoticeNetCallBack
|
||||
import com.mogo.eagle.function.biz.dispatch.DispatchAutoPilotManager.Companion.dispatchAutoPilotManager
|
||||
import com.mogo.eagle.function.biz.monitoring.CronTaskManager.Companion.cronTaskManager
|
||||
import com.mogo.eagle.function.biz.notice.NoticeSocketManager.Companion.noticeSocketManager
|
||||
import com.mogo.eagle.function.biz.notice.network.NoticeNetWorkManager
|
||||
|
||||
@Route(path = MogoServicePaths.PATH_FUNC_BIZ)
|
||||
class FuncBizProvider : IMoGoFuncBizProvider {
|
||||
|
||||
override val functionName: String
|
||||
get() = "FuncBiz"
|
||||
|
||||
override fun init(context: Context) {
|
||||
noticeSocketManager.init(context)
|
||||
dispatchAutoPilotManager.init(context)
|
||||
cronTaskManager.startCronTask()
|
||||
}
|
||||
|
||||
override fun feedBackNoticeTraffic(infoId: String, sn: String, accept: Int) {
|
||||
NoticeNetWorkManager.getInstance().sendAccidentAcceptStatus(infoId, sn, accept)
|
||||
}
|
||||
|
||||
override fun requestAccidentInfo(infoId: String, sn: String, callBack: IMoGoNoticeNetCallBack) {
|
||||
NoticeNetWorkManager.getInstance().requestAccidentInfo(infoId, sn, callBack)
|
||||
}
|
||||
|
||||
override fun dispatchAffirm() {
|
||||
dispatchAutoPilotManager.affirm()
|
||||
}
|
||||
|
||||
override fun dispatchCancel(manualTrigger: Boolean) {
|
||||
dispatchAutoPilotManager.cancel(manualTrigger)
|
||||
}
|
||||
|
||||
override fun testDispatch(sceneType: Int) {
|
||||
dispatchAutoPilotManager.testDispatch(sceneType)
|
||||
}
|
||||
|
||||
override val getCameraList: List<CameraEntity>
|
||||
get() = cronTaskManager.getCameraList()
|
||||
|
||||
override fun openCameraStream(cameraIp: String) {
|
||||
cronTaskManager.reqOpenCameraStream(cameraIp)
|
||||
}
|
||||
|
||||
override fun openCameraStream(cameraIp: String, success: (String) -> Unit, error: (Throwable) -> Unit) {
|
||||
cronTaskManager.reqOpenCameraStream(cameraIp, success, error)
|
||||
}
|
||||
|
||||
override fun closeCameraLive() {
|
||||
cronTaskManager.clear()
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
noticeSocketManager.release()
|
||||
dispatchAutoPilotManager.release()
|
||||
cronTaskManager.release()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,290 @@
|
||||
package com.mogo.eagle.function.biz.dispatch
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Handler
|
||||
import android.os.Message
|
||||
import com.mogo.aicloud.services.socket.IMogoOnMessageListener
|
||||
import com.mogo.aicloud.services.socket.MogoAiCloudSocketManager
|
||||
import com.mogo.cloud.commons.utils.CoordinateUtils
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotRouteInfo
|
||||
import com.mogo.eagle.core.data.dispatch.DispatchAdasAutoPilotLocReceiverBean
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoPlanningRottingListener
|
||||
import com.mogo.eagle.core.function.api.hmi.autopilot.IMoGoCheckAutoPilotBtnListener
|
||||
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.CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerPlanningRottingListenerManager
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiListenerManager
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
|
||||
import com.mogo.eagle.function.biz.dispatch.network.DispatchServiceModel.Companion.DISPATCH_RESULT_AFFIRM
|
||||
import com.mogo.eagle.function.biz.dispatch.network.DispatchServiceModel.Companion.DISPATCH_RESULT_MANUAL_CANCEL
|
||||
import com.mogo.eagle.function.biz.dispatch.network.DispatchServiceModel.Companion.DISPATCH_RESULT_TIMER_CANCEL
|
||||
import com.mogo.eagle.function.biz.dispatch.network.DispatchServiceModel.Companion.dispatchServiceModel
|
||||
import mogo.telematics.pad.MessagePad
|
||||
|
||||
|
||||
//负责监听自动驾驶状态并进行状态上报,自动驾驶路线上报,接收调度指令展示指令弹窗
|
||||
class DispatchAutoPilotManager private constructor() :
|
||||
IMogoOnMessageListener<DispatchAdasAutoPilotLocReceiverBean>,
|
||||
IMoGoCheckAutoPilotBtnListener,
|
||||
IMoGoPlanningRottingListener,
|
||||
IMoGoAutopilotStatusListener {
|
||||
|
||||
companion object {
|
||||
private const val TAG = "DispatchAutoPilotManager"
|
||||
|
||||
private const val MSG_SOCKET_TYPE = 501000
|
||||
private const val MSG_TYPE_SHOW_DIALOG = 0
|
||||
private const val MSG_TYPE_UPLOAD_AUTOPILOT_STATUS = 1
|
||||
|
||||
val dispatchAutoPilotManager by lazy(LazyThreadSafetyMode.SYNCHRONIZED) {
|
||||
DispatchAutoPilotManager()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private var mContext: Context? = null
|
||||
private var receiverBean: DispatchAdasAutoPilotLocReceiverBean? = null
|
||||
private var isDispatch = false
|
||||
private var isArriveEnd = false
|
||||
|
||||
private val handler: Handler = object : Handler() {
|
||||
override fun handleMessage(msg: Message) {
|
||||
super.handleMessage(msg)
|
||||
if (msg.what == MSG_TYPE_SHOW_DIALOG) {
|
||||
isDispatch = true
|
||||
isArriveEnd = false
|
||||
val msgData: DispatchAdasAutoPilotLocReceiverBean =
|
||||
msg.obj as DispatchAdasAutoPilotLocReceiverBean
|
||||
CallerHmiManager.showDispatchDialog(msgData)
|
||||
} else if (msg.what == MSG_TYPE_UPLOAD_AUTOPILOT_STATUS) {
|
||||
dispatchServiceModel.uploadAutopilotStatus(
|
||||
getAutoPilotStatusInfo().state,
|
||||
getAutoPilotStatusInfo().reason
|
||||
)
|
||||
sendEmptyMessageDelayed(MSG_TYPE_UPLOAD_AUTOPILOT_STATUS, 1000L)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun init(context: Context) {
|
||||
mContext = context
|
||||
MogoAiCloudSocketManager.getInstance(context)
|
||||
.registerOnMessageListener(MSG_SOCKET_TYPE, this)
|
||||
// 添加自动驾驶按钮选中监听
|
||||
CallerHmiListenerManager.addListener(TAG, this)
|
||||
// 添加 规划路径相关回调 监听
|
||||
CallerPlanningRottingListenerManager.addListener(TAG, this)
|
||||
// 添加 ADAS状态 监听
|
||||
CallerAutoPilotStatusListenerManager.addListener(TAG, this)
|
||||
handler.sendEmptyMessageDelayed(MSG_TYPE_UPLOAD_AUTOPILOT_STATUS, 1000L)
|
||||
}
|
||||
|
||||
fun release() {
|
||||
// 添加自动驾驶按钮选中监听
|
||||
CallerHmiListenerManager.removeListener(TAG)
|
||||
// 添加 规划路径相关回调 监听
|
||||
CallerPlanningRottingListenerManager.removeListener(TAG)
|
||||
// 添加 ADAS状态 监听
|
||||
CallerAutoPilotStatusListenerManager.removeListener(TAG)
|
||||
}
|
||||
|
||||
override fun target(): Class<DispatchAdasAutoPilotLocReceiverBean> {
|
||||
return DispatchAdasAutoPilotLocReceiverBean::class.java
|
||||
}
|
||||
|
||||
override fun onMsgReceived(adasAutoPilotLocReceiverBean: DispatchAdasAutoPilotLocReceiverBean?) {
|
||||
if (adasAutoPilotLocReceiverBean != null && adasAutoPilotLocReceiverBean.startLat != 0.0 && adasAutoPilotLocReceiverBean.startLon != 0.0) {
|
||||
receiverBean = adasAutoPilotLocReceiverBean
|
||||
val message = Message()
|
||||
message.what = MSG_TYPE_SHOW_DIALOG
|
||||
message.obj = adasAutoPilotLocReceiverBean
|
||||
handler.sendMessage(message)
|
||||
}
|
||||
}
|
||||
|
||||
private fun startAutoPilot() {
|
||||
val currentAutopilot = AutopilotControlParameters()
|
||||
currentAutopilot.isSpeakVoice = false
|
||||
val wayLatLon: MutableList<AutopilotControlParameters.AutoPilotLonLat> = ArrayList()
|
||||
receiverBean?.let {
|
||||
if (it.stopsList != null) {
|
||||
for (mogoLatLng in receiverBean!!.stopsList) {
|
||||
wayLatLon.add(
|
||||
AutopilotControlParameters.AutoPilotLonLat(
|
||||
mogoLatLng.lat,
|
||||
mogoLatLng.lon
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
currentAutopilot.wayLatLons = wayLatLon
|
||||
currentAutopilot.startLatLon =
|
||||
AutopilotControlParameters.AutoPilotLonLat(it.startLat, it.startLon)
|
||||
currentAutopilot.endLatLon =
|
||||
AutopilotControlParameters.AutoPilotLonLat(it.endLat, it.endLon)
|
||||
currentAutopilot.vehicleType = 10
|
||||
CallerLogger.d(SceneConstant.Companion.M_DISPATCH + TAG, "开启自动驾驶====$currentAutopilot")
|
||||
CallerAutoPilotManager.startAutoPilot(currentAutopilot)
|
||||
}
|
||||
}
|
||||
|
||||
fun affirm() {
|
||||
CallerHmiManager.dismissDispatchDialog()
|
||||
dispatchServiceModel.dispatchResultUpload(DISPATCH_RESULT_AFFIRM)
|
||||
}
|
||||
|
||||
fun cancel(manualTrigger: Boolean) {
|
||||
CallerHmiManager.dismissDispatchDialog()
|
||||
dispatchServiceModel.dispatchResultUpload(
|
||||
if (manualTrigger) DISPATCH_RESULT_MANUAL_CANCEL else DISPATCH_RESULT_TIMER_CANCEL
|
||||
)
|
||||
}
|
||||
|
||||
override fun onCheck(isChecked: Boolean) {
|
||||
if (isChecked) {
|
||||
// 确保到达终点后,再次点击,不会有回馈,并且在下次调开始时,才会重置
|
||||
if (isArriveEnd) {
|
||||
return
|
||||
}
|
||||
//todo 确认是否要根据停靠时自动驾驶状态,再次开启自动驾驶
|
||||
// 确保处于调度中并且返回的自动驾驶状态为1才开启自动驾驶
|
||||
// 上述等待鄂州项目复盘后,产品输出完成方案后再进操作!!!
|
||||
if (isDispatch) {
|
||||
startAutoPilot()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onAutopilotRotting(globalPathResp: MessagePad.GlobalPathResp?) {
|
||||
if (globalPathResp == null || globalPathResp.wayPointsList.isEmpty()) {
|
||||
return
|
||||
}
|
||||
val list: MutableList<AutopilotRouteInfo.RouteModels> = ArrayList()
|
||||
for (location in globalPathResp.wayPointsList) {
|
||||
val routeModels = AutopilotRouteInfo.RouteModels()
|
||||
routeModels.lat = location.latitude
|
||||
routeModels.lon = location.longitude
|
||||
list.add(routeModels)
|
||||
}
|
||||
dispatchServiceModel.uploadAutopilotRoute(list)
|
||||
}
|
||||
|
||||
override fun onAutopilotArriveAtStation(arrivalNotification: MessagePad.ArrivalNotification?) {
|
||||
if (!isDispatch) {
|
||||
return
|
||||
}
|
||||
if (arrivalNotification == null) {
|
||||
return
|
||||
}
|
||||
if (receiverBean == null) {
|
||||
return
|
||||
}
|
||||
|
||||
CallerLogger.d(
|
||||
SceneConstant.Companion.M_DISPATCH + TAG,
|
||||
"onArriveAt data : $arrivalNotification"
|
||||
)
|
||||
|
||||
if (arrivalNotification.endLocation == null) {
|
||||
return
|
||||
}
|
||||
val endLat: Double = arrivalNotification.endLocation.latitude
|
||||
val endLon: Double = arrivalNotification.endLocation.longitude
|
||||
// 计算是不是到了终点
|
||||
val distanceFromSelf: Float = CoordinateUtils.calculateLineDistance(
|
||||
receiverBean!!.endLon, receiverBean!!.endLat, endLon, endLat
|
||||
)
|
||||
CallerLogger.d(
|
||||
SceneConstant.Companion.M_DISPATCH + TAG,
|
||||
"onArriveAt cal distance : $distanceFromSelf"
|
||||
)
|
||||
if (distanceFromSelf < 10) {
|
||||
CallerLogger.d(SceneConstant.Companion.M_DISPATCH + TAG, "onArriveAt end location")
|
||||
isDispatch = false
|
||||
isArriveEnd = true
|
||||
}
|
||||
}
|
||||
|
||||
fun testDispatch(sceneType: Int) {
|
||||
when (sceneType) {
|
||||
0 -> testEZhouStart()
|
||||
1 -> testEZhouStop()
|
||||
2 -> testHengYangStart()
|
||||
3 -> testDispatchResultUpload()//验证自动驾驶调度上报接口
|
||||
}
|
||||
}
|
||||
|
||||
private fun testEZhouStart() {
|
||||
val adasAutoPilotLocReceiverBean = DispatchAdasAutoPilotLocReceiverBean(
|
||||
DispatchAdasAutoPilotLocReceiverBean.DISPATCH_SOURCE_EZHOU,
|
||||
DispatchAdasAutoPilotLocReceiverBean.DISPATCH_TYPE_START,
|
||||
"1",
|
||||
26.825571122,
|
||||
112.5762410415,
|
||||
"起点---5号跑道",
|
||||
26.825571122,
|
||||
112.5762410415,
|
||||
"终点---鄂州机场",
|
||||
"5分钟",
|
||||
"AR453航班",
|
||||
"你车需执行编号ca1098次航班的引导任务,从A区A1到B区B1",
|
||||
System.currentTimeMillis(),
|
||||
ArrayList<MogoLatLng>()
|
||||
)
|
||||
receiverBean = adasAutoPilotLocReceiverBean
|
||||
CallerHmiManager.showDispatchDialog(adasAutoPilotLocReceiverBean)
|
||||
}
|
||||
|
||||
private fun testEZhouStop() {
|
||||
val adasAutoPilotLocReceiverBean = DispatchAdasAutoPilotLocReceiverBean(
|
||||
DispatchAdasAutoPilotLocReceiverBean.DISPATCH_SOURCE_EZHOU,
|
||||
DispatchAdasAutoPilotLocReceiverBean.DISPATCH_TYPE_STOP,
|
||||
"1",
|
||||
0.0,
|
||||
0.0,
|
||||
"",
|
||||
0.0,
|
||||
0.0,
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
System.currentTimeMillis(),
|
||||
ArrayList<MogoLatLng>()
|
||||
)
|
||||
receiverBean = adasAutoPilotLocReceiverBean
|
||||
CallerHmiManager.showDispatchDialog(adasAutoPilotLocReceiverBean)
|
||||
}
|
||||
|
||||
private fun testHengYangStart() {
|
||||
val adasAutoPilotLocReceiverBean = DispatchAdasAutoPilotLocReceiverBean(
|
||||
DispatchAdasAutoPilotLocReceiverBean.DISPATCH_SOURCE_HENGYANG,
|
||||
DispatchAdasAutoPilotLocReceiverBean.DISPATCH_TYPE_START,
|
||||
"2",
|
||||
26.825571122,
|
||||
112.5762410415,
|
||||
"衡阳科学城",
|
||||
26.825571122,
|
||||
112.5762410415,
|
||||
"衡阳首钢集团",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
System.currentTimeMillis(),
|
||||
ArrayList<MogoLatLng>()
|
||||
)
|
||||
receiverBean = adasAutoPilotLocReceiverBean
|
||||
CallerHmiManager.showDispatchDialog(adasAutoPilotLocReceiverBean)
|
||||
}
|
||||
|
||||
private fun testDispatchResultUpload() {
|
||||
dispatchServiceModel.dispatchResultUpload(DISPATCH_RESULT_AFFIRM)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,140 @@
|
||||
package com.mogo.eagle.function.biz.dispatch.network
|
||||
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
|
||||
import com.mogo.commons.constants.HostConst
|
||||
import com.mogo.commons.context.ContextHolderUtil
|
||||
import com.mogo.eagle.core.data.BaseData
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotRouteInfo.RouteModels
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotStatus
|
||||
import com.mogo.eagle.core.data.dispatch.ReportDispatchResult
|
||||
import com.mogo.eagle.core.data.dispatch.ReportedRoute
|
||||
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 io.reactivex.android.schedulers.AndroidSchedulers
|
||||
import io.reactivex.schedulers.Schedulers
|
||||
import java.util.*
|
||||
|
||||
class DispatchServiceModel private constructor() {
|
||||
|
||||
companion object {
|
||||
|
||||
const val DISPATCH_RESULT_AFFIRM = 0
|
||||
const val DISPATCH_RESULT_MANUAL_CANCEL = 1
|
||||
const val DISPATCH_RESULT_TIMER_CANCEL = 2
|
||||
|
||||
val dispatchServiceModel by lazy(LazyThreadSafetyMode.SYNCHRONIZED) {
|
||||
DispatchServiceModel()
|
||||
}
|
||||
}
|
||||
|
||||
private var mAdasApiService: IDispatchAdasApiService =
|
||||
MoGoRetrofitFactory.getInstance(HostConst.DATA_SERVICE_HOST).create(
|
||||
IDispatchAdasApiService::class.java
|
||||
)
|
||||
|
||||
/**
|
||||
* 上报自动驾驶状态
|
||||
*/
|
||||
fun uploadAutopilotStatus(state: Int, reason: String?) {
|
||||
val autopilotStatus = AutopilotStatus()
|
||||
autopilotStatus.action = "autopilotstate"
|
||||
val valuesBean = AutopilotStatus.ValuesBean()
|
||||
valuesBean.state = state
|
||||
valuesBean.reason = reason
|
||||
autopilotStatus.values = valuesBean
|
||||
val sn = MoGoAiCloudClientConfig.getInstance().sn
|
||||
val reportedRoute = ReportedRoute(sn, autopilotStatus.values)
|
||||
val map: MutableMap<String, Any> = HashMap()
|
||||
map["sn"] = sn
|
||||
map["data"] = GsonUtil.jsonFromObject(reportedRoute)
|
||||
mAdasApiService.uploadAutopilotState(map)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(object :
|
||||
SubscribeImpl<BaseData>(RequestOptions.create(ContextHolderUtil.getContext())) {
|
||||
override fun onNext(o: BaseData) {
|
||||
super.onNext(o)
|
||||
}
|
||||
|
||||
override fun onError(e: Throwable) {
|
||||
super.onError(e)
|
||||
}
|
||||
|
||||
override fun onSuccess(o: BaseData) {
|
||||
super.onSuccess(o)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 上报自动驾驶路线
|
||||
*
|
||||
* @param list 路线集合
|
||||
*/
|
||||
fun uploadAutopilotRoute(list: List<RouteModels?>?) {
|
||||
val sn = MoGoAiCloudClientConfig.getInstance().sn
|
||||
val reportedRoute = ReportedRoute(sn, GsonUtil.jsonFromObject(list))
|
||||
val map: MutableMap<String, Any> = HashMap()
|
||||
map["sn"] = sn
|
||||
map["data"] = GsonUtil.jsonFromObject(reportedRoute)
|
||||
mAdasApiService.uploadAutopilotRoute(map)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(object :
|
||||
SubscribeImpl<BaseData>(RequestOptions.create(ContextHolderUtil.getContext())) {
|
||||
override fun onNext(o: BaseData) {
|
||||
super.onNext(o)
|
||||
}
|
||||
|
||||
override fun onError(e: Throwable) {
|
||||
super.onError(e)
|
||||
}
|
||||
|
||||
override fun onSuccess(o: BaseData) {
|
||||
super.onSuccess(o)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 上报调度处理结果
|
||||
*
|
||||
* @param dispatchResultType int
|
||||
*/
|
||||
fun dispatchResultUpload(
|
||||
dispatchResultType: Int,
|
||||
onSuccess: ((BaseData) -> Unit)? = null,
|
||||
onError: ((String) -> Unit)? = null
|
||||
) {
|
||||
val sn = MoGoAiCloudClientConfig.getInstance().sn
|
||||
val reportDispatchResult = ReportDispatchResult(sn, dispatchResultType)
|
||||
val map: MutableMap<String, Any> = HashMap()
|
||||
map["sn"] = sn
|
||||
map["data"] = GsonUtil.jsonFromObject(reportDispatchResult)
|
||||
mAdasApiService.uploadDispatchResult(map)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(object :
|
||||
SubscribeImpl<BaseData>(RequestOptions.create(ContextHolderUtil.getContext())) {
|
||||
override fun onNext(o: BaseData) {
|
||||
super.onNext(o)
|
||||
onSuccess?.invoke(o)
|
||||
}
|
||||
|
||||
override fun onError(e: Throwable) {
|
||||
super.onError(e)
|
||||
if (!e.message.isNullOrBlank()) {
|
||||
onError?.invoke(e.message!!)
|
||||
} else {
|
||||
onError?.invoke("上报失败")
|
||||
}
|
||||
}
|
||||
|
||||
override fun onSuccess(o: BaseData) {
|
||||
super.onSuccess(o)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.mogo.eagle.function.biz.dispatch.network
|
||||
|
||||
import com.mogo.eagle.core.data.BaseData
|
||||
import io.reactivex.Observable
|
||||
import retrofit2.http.FieldMap
|
||||
import retrofit2.http.FormUrlEncoded
|
||||
import retrofit2.http.POST
|
||||
|
||||
interface IDispatchAdasApiService {
|
||||
/**
|
||||
* 上报自动驾驶路径 服务于业务调度
|
||||
*
|
||||
* @param parameters map
|
||||
* @return [BaseData]
|
||||
*/
|
||||
@FormUrlEncoded
|
||||
@POST("/dataService/autoDriver/receiveCarPreSetPath")
|
||||
fun uploadAutopilotRoute(@FieldMap parameters: Map<String, Any>): Observable<BaseData>
|
||||
|
||||
/**
|
||||
* 上报自动驾驶调度处理结果 服务于业务调度
|
||||
*
|
||||
* @param parameters map
|
||||
* @return [BaseData]
|
||||
*/
|
||||
@FormUrlEncoded
|
||||
@POST("/dataService/autoDriver/receiverDestSiteResult")
|
||||
fun uploadDispatchResult(@FieldMap parameters: MutableMap<String, Any>): Observable<BaseData>
|
||||
|
||||
/**
|
||||
* 上报自动驾驶状态 服务于业务调度
|
||||
*
|
||||
* @param parameters map
|
||||
* @return [BaseData]
|
||||
*/
|
||||
@FormUrlEncoded
|
||||
@POST("/dataService/autoDriver/receiveAutopilotState")
|
||||
fun uploadAutopilotState(@FieldMap parameters: MutableMap<String, Any>): Observable<BaseData>
|
||||
}
|
||||
@@ -1,28 +1,32 @@
|
||||
package com.mogo.eagle.core.function.monitoring
|
||||
package com.mogo.eagle.function.biz.monitoring
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
import android.os.Message
|
||||
import com.mogo.commons.constants.HostConst
|
||||
import com.mogo.commons.utils.RetryWithDelay
|
||||
import com.mogo.eagle.core.data.camera.CameraEntity
|
||||
import com.mogo.eagle.core.data.camera.ReqLiveCarBean
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
|
||||
import com.mogo.eagle.core.function.monitoring.net.CameraListServices
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapLocationListenerManager
|
||||
import com.mogo.eagle.function.biz.monitoring.net.ICameraListServices
|
||||
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 io.reactivex.Observable
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||
import io.reactivex.disposables.Disposable
|
||||
import io.reactivex.schedulers.Schedulers
|
||||
|
||||
class CronTaskManager(private var context: Context?) {
|
||||
class CronTaskManager {
|
||||
|
||||
companion object {
|
||||
private const val TAG = "CronTaskManager"
|
||||
private const val CRON_TASK_TYPE = 1011
|
||||
|
||||
val cronTaskManager by lazy(LazyThreadSafetyMode.SYNCHRONIZED){
|
||||
CronTaskManager()
|
||||
}
|
||||
}
|
||||
|
||||
// 请求路侧摄像头
|
||||
@@ -57,7 +61,7 @@ class CronTaskManager(private var context: Context?) {
|
||||
private fun requestCameraList() {
|
||||
// 衡阳可直播的摄像头有限,先写死roadId便于调试
|
||||
disposable = MoGoRetrofitFactory.getInstance(HostConst.CAMERA_STREAM_HOST)
|
||||
.create(CameraListServices::class.java)
|
||||
.create(ICameraListServices::class.java)
|
||||
.getCameraList("10849")
|
||||
.subscribeOn(Schedulers.io())
|
||||
.map { cameraListInfo ->
|
||||
@@ -86,9 +90,9 @@ class CronTaskManager(private var context: Context?) {
|
||||
* 请求路口一定范围内的设备信息(包含:摄像头、灯)
|
||||
*/
|
||||
private fun requestDeviceList() {
|
||||
MogoLocationClient.getInstance(context).lastKnowLocation?.let { location ->
|
||||
CallerMapLocationListenerManager.getCurrentLocation()?.let { location ->
|
||||
disposable = MoGoRetrofitFactory.getInstance(HostConst.CITY_HOST)
|
||||
.create(CameraListServices::class.java)
|
||||
.create(ICameraListServices::class.java)
|
||||
.getDeviceList(location.longitude, location.latitude, 500)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.map { cameraListInfo ->
|
||||
@@ -114,15 +118,15 @@ class CronTaskManager(private var context: Context?) {
|
||||
"requestDeviceList:message is:${it.message}, cause is:${it.cause}"
|
||||
)
|
||||
})
|
||||
} ?: run {
|
||||
}?: run {
|
||||
CallerLogger.e("$M_MONITOR$TAG", "CurrentLocation is null!")
|
||||
}
|
||||
}
|
||||
|
||||
private fun requestCarCameraList() {
|
||||
MogoLocationClient.getInstance(context).lastKnowLocation?.let { location ->
|
||||
CallerMapLocationListenerManager.getCurrentLocation()?.let { location ->
|
||||
carDisposable = MoGoRetrofitFactory.getInstance(HostConst.CITY_HOST)
|
||||
.create(CameraListServices::class.java)
|
||||
.create(ICameraListServices::class.java)
|
||||
.getCarCameraList(ReqLiveCarBean(location.longitude, location.latitude))
|
||||
.subscribeOn(Schedulers.io())
|
||||
.map { liveCarCameraInfo ->
|
||||
@@ -161,7 +165,7 @@ class CronTaskManager(private var context: Context?) {
|
||||
if (!it.isDisposed) it.dispose()
|
||||
}
|
||||
streamDisposable = MoGoRetrofitFactory.getInstance(HostConst.OPEN_CAMERA_STREAM_HOST)
|
||||
.create(CameraListServices::class.java)
|
||||
.create(ICameraListServices::class.java)
|
||||
.openCameraStream(cameraIp)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
@@ -190,7 +194,7 @@ class CronTaskManager(private var context: Context?) {
|
||||
if (!it.isDisposed) it.dispose()
|
||||
}
|
||||
streamDisposable = MoGoRetrofitFactory.getInstance(HostConst.CITY_HOST)
|
||||
.create(CameraListServices::class.java)
|
||||
.create(ICameraListServices::class.java)
|
||||
.reqOpenCameraStream(cameraIp)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
@@ -219,7 +223,7 @@ class CronTaskManager(private var context: Context?) {
|
||||
if (!it.isDisposed) it.dispose()
|
||||
}
|
||||
streamDisposable2 = MoGoRetrofitFactory.getInstance(HostConst.CITY_HOST)
|
||||
.create(CameraListServices::class.java)
|
||||
.create(ICameraListServices::class.java)
|
||||
.reqOpenCameraStreamWithRetry(cameraIp)
|
||||
.flatMap {
|
||||
if (it.code != 200 && it.code != 0) {
|
||||
@@ -268,8 +272,7 @@ class CronTaskManager(private var context: Context?) {
|
||||
}
|
||||
}
|
||||
|
||||
fun onDestroy() {
|
||||
context = null
|
||||
fun release() {
|
||||
disposable?.dispose()
|
||||
carDisposable?.dispose()
|
||||
streamDisposable?.let {
|
||||
@@ -1,11 +1,11 @@
|
||||
package com.mogo.eagle.core.function.monitoring.net
|
||||
package com.mogo.eagle.function.biz.monitoring.net
|
||||
|
||||
import com.mogo.eagle.core.data.camera.*
|
||||
import io.reactivex.Observable
|
||||
import io.reactivex.Single
|
||||
import retrofit2.http.*
|
||||
|
||||
interface CameraListServices {
|
||||
interface ICameraListServices {
|
||||
@GET("/yycp-smartTransportationAiCloud-service/eagle/device/list")
|
||||
fun getCameraList(@Query("roadId") roadId: String?): Single<CameraListInfo?>
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
package com.mogo.eagle.function.biz.notice
|
||||
|
||||
import android.content.Context
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
|
||||
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager.saveMsgBox
|
||||
import com.mogo.aicloud.services.socket.MogoAiCloudSocketManager
|
||||
import com.mogo.aicloud.services.socket.IMogoOnMessageListener
|
||||
import com.mogo.eagle.core.data.notice.NoticeNormalData
|
||||
import java.lang.Class
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
|
||||
import com.mogo.eagle.core.data.msgbox.NoticeFrCloudMsg
|
||||
import com.mogo.eagle.core.data.msgbox.MsgBoxBean
|
||||
import com.mogo.eagle.core.data.msgbox.MsgBoxType
|
||||
import com.mogo.eagle.core.data.notice.NoticeTrafficStylePushData
|
||||
import com.mogo.eagle.core.network.utils.GsonUtil
|
||||
|
||||
/**
|
||||
* @author Jing
|
||||
* @description 云公告注册、反注册
|
||||
* @since: 10/27/21
|
||||
*/
|
||||
internal class NoticeSocketManager {
|
||||
|
||||
private var mContext: Context? = null
|
||||
|
||||
companion object {
|
||||
private const val TAG = "NoticeSocketManager"
|
||||
|
||||
val noticeSocketManager:NoticeSocketManager by lazy(LazyThreadSafetyMode.SYNCHRONIZED){
|
||||
NoticeSocketManager()
|
||||
}
|
||||
}
|
||||
|
||||
fun init(context: Context) {
|
||||
mContext = context
|
||||
MogoAiCloudSocketManager.getInstance(context)
|
||||
.registerOnMessageListener(301001, mTrafficNoticeListener)
|
||||
MogoAiCloudSocketManager.getInstance(context)
|
||||
.registerOnMessageListener(100, mNormalNoticeListener)
|
||||
}
|
||||
|
||||
fun release() {
|
||||
MogoAiCloudSocketManager.getInstance(mContext)
|
||||
.unregisterOnMessageListener(301001, mTrafficNoticeListener)
|
||||
MogoAiCloudSocketManager.getInstance(mContext)
|
||||
.unregisterOnMessageListener(100, mNormalNoticeListener)
|
||||
}
|
||||
|
||||
/**
|
||||
* 普通云公告
|
||||
*/
|
||||
private val mNormalNoticeListener: IMogoOnMessageListener<NoticeNormalData> =
|
||||
object : IMogoOnMessageListener<NoticeNormalData> {
|
||||
override fun target(): Class<NoticeNormalData> {
|
||||
return NoticeNormalData::class.java
|
||||
}
|
||||
|
||||
override fun onMsgReceived(obj: NoticeNormalData?) {
|
||||
if (obj == null) {
|
||||
return
|
||||
}
|
||||
d(SceneConstant.M_NOTICE + TAG, "100-- 普通公告数据:" + GsonUtil.jsonFromObject(obj))
|
||||
val noticeFromCloudMsg = NoticeFrCloudMsg(obj, null, 0)
|
||||
saveMsgBox(MsgBoxBean(MsgBoxType.NOTICE, noticeFromCloudMsg))
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 交警类型公告弹窗
|
||||
*/
|
||||
private val mTrafficNoticeListener: IMogoOnMessageListener<NoticeTrafficStylePushData> =
|
||||
object : IMogoOnMessageListener<NoticeTrafficStylePushData> {
|
||||
override fun target(): Class<NoticeTrafficStylePushData> {
|
||||
return NoticeTrafficStylePushData::class.java
|
||||
}
|
||||
|
||||
override fun onMsgReceived(obj: NoticeTrafficStylePushData?) {
|
||||
if (obj == null) {
|
||||
return
|
||||
}
|
||||
d(SceneConstant.M_NOTICE + TAG, "301001-- 交警类型公告数据:" + GsonUtil.jsonFromObject(obj))
|
||||
val noticeFromCloudMsg = NoticeFrCloudMsg(null, obj, 1)
|
||||
saveMsgBox(MsgBoxBean(MsgBoxType.NOTICE, noticeFromCloudMsg))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.eagle.core.function.notice.network;
|
||||
package com.mogo.eagle.function.biz.notice.network;
|
||||
|
||||
import com.mogo.eagle.core.data.BaseData;
|
||||
import com.mogo.eagle.core.data.notice.NoticeNormalDetail;
|
||||
@@ -19,7 +19,7 @@ import retrofit2.http.QueryMap;
|
||||
* @description 云公告相关的短链请求接口定义
|
||||
* @since: 10/28/21
|
||||
*/
|
||||
public interface NoticeApiService {
|
||||
public interface INoticeApiService {
|
||||
/**
|
||||
* 获取道路事故详情
|
||||
*
|
||||
@@ -30,7 +30,6 @@ public interface NoticeApiService {
|
||||
@POST("/deva/accidentInfoManage/queryMyAccidentHandleInfo/server/v1")
|
||||
Observable<NoticeTrafficStyleInfo> getAccidentInfo(@Body RequestBody requestBody);
|
||||
|
||||
|
||||
/**
|
||||
* 反馈对交警事故的操作
|
||||
*
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.eagle.core.function.notice.network;
|
||||
package com.mogo.eagle.function.biz.notice.network;
|
||||
|
||||
import android.util.ArrayMap;
|
||||
|
||||
@@ -7,9 +7,10 @@ import com.mogo.cloud.network.RetrofitFactory;
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClient;
|
||||
import com.mogo.eagle.core.data.BaseData;
|
||||
import com.mogo.eagle.core.data.notice.NoticeNormalDetail;
|
||||
import com.mogo.eagle.core.data.notice.NoticeRequest;
|
||||
import com.mogo.eagle.core.data.notice.NoticeTrafficStyleInfo;
|
||||
|
||||
import com.mogo.eagle.core.function.api.notice.NoticeNetCallBack;
|
||||
import com.mogo.eagle.core.function.api.biz.IMoGoNoticeNetCallBack;
|
||||
import com.mogo.eagle.core.network.utils.GsonUtil;
|
||||
|
||||
import java.util.HashMap;
|
||||
@@ -30,11 +31,11 @@ import okhttp3.RequestBody;
|
||||
*/
|
||||
public class NoticeNetWorkManager {
|
||||
private static volatile NoticeNetWorkManager requestNoticeManager;
|
||||
private final NoticeApiService mNoticeApiService;
|
||||
private final INoticeApiService mNoticeApiService;
|
||||
|
||||
private NoticeNetWorkManager() {
|
||||
mNoticeApiService = RetrofitFactory.INSTANCE.getInstance(NetConstants.DEVA_HOST)
|
||||
.create(NoticeApiService.class);
|
||||
.create(INoticeApiService.class);
|
||||
}
|
||||
|
||||
public static NoticeNetWorkManager getInstance() {
|
||||
@@ -54,8 +55,7 @@ public class NoticeNetWorkManager {
|
||||
* @param infoId 事故id
|
||||
* @param callBack 回调
|
||||
*/
|
||||
public void requestAccidentInfo(String infoId, String sn,NoticeNetCallBack callBack) {
|
||||
|
||||
public void requestAccidentInfo(String infoId, String sn, IMoGoNoticeNetCallBack callBack) {
|
||||
NoticeRequest request = new NoticeRequest(infoId);
|
||||
RequestBody requestBody = RequestBody.create(MediaType.get("application/json;charset=UTF-8"),
|
||||
GsonUtil.jsonFromObject(request));
|
||||
@@ -143,7 +143,6 @@ public class NoticeNetWorkManager {
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull NoticeNormalDetail noticeNormalDetail) {
|
||||
// CallerHmiManager.INSTANCE.showNormalBanner(noticeNormalDetail);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1 +0,0 @@
|
||||
/build
|
||||
@@ -1,3 +0,0 @@
|
||||
GROUP=com.mogo.eagle.core.function.impl
|
||||
POM_ARTIFACT_ID=carcorder
|
||||
VERSION_CODE=1
|
||||
@@ -1,21 +0,0 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# You can control the set of applied configuration files using the
|
||||
# proguardFiles setting in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
||||
@@ -1,17 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.mogo.eagle.core.function.carcorder">
|
||||
|
||||
<application>
|
||||
<service
|
||||
android:name=".service.CarcorderService"
|
||||
android:enabled="true"
|
||||
android:exported="true"
|
||||
android:process=":uvcservice">
|
||||
<intent-filter>
|
||||
<action android:name="com.mogo.launcher.action.CARCORDER_SERVICE" />
|
||||
</intent-filter>
|
||||
</service>
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
@@ -1,162 +0,0 @@
|
||||
package com.mogo.eagle.core.function.carcorder.service
|
||||
|
||||
import android.content.Intent
|
||||
import android.hardware.usb.UsbDevice
|
||||
import android.os.IBinder
|
||||
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
|
||||
import com.serenegiant.usb.USBMonitor.OnDeviceConnectListener
|
||||
import com.serenegiant.usb.USBMonitor.UsbControlBlock
|
||||
import com.serenegiant.usb.UVCCamera
|
||||
import com.serenegiant.usb.common.BaseService
|
||||
import com.serenegiant.usb.encoder.MediaVideoBufferEncoder
|
||||
|
||||
/**
|
||||
* 行车记录仪服务
|
||||
* @author donghongyu
|
||||
*/
|
||||
class CarcorderService : BaseService() {
|
||||
private val DEBUG = true
|
||||
val TAG = CarcorderService::class.java.name
|
||||
|
||||
// 挂载的USB设备集合
|
||||
private var mDeviceList: List<UsbDevice>? = null
|
||||
|
||||
// USB 设备连接工具
|
||||
private var mUSBMonitor: USBMonitor? = null
|
||||
|
||||
// 用于接入UVC摄像机
|
||||
private var mUVCCamera: UVCCamera? = null
|
||||
|
||||
// 相机控制
|
||||
private var mCtrlBlock: UsbControlBlock? = null
|
||||
|
||||
/**
|
||||
* 配置相机基本按书
|
||||
*/
|
||||
private val previewWidth = 640
|
||||
private val previewHeight = 480
|
||||
|
||||
// Default using MJPEG
|
||||
// if your device is connected,but have no images
|
||||
// please try to change it to FRAME_FORMAT_YUYV
|
||||
val FRAME_FORMAT_MJPEG: Int = UVCCamera.FRAME_FORMAT_MJPEG
|
||||
val MODE_BRIGHTNESS = UVCCamera.PU_BRIGHTNESS
|
||||
val MODE_CONTRAST = UVCCamera.PU_CONTRAST
|
||||
private val mFrameFormat = UVCCameraHelper.FRAME_FORMAT_MJPEG
|
||||
|
||||
override fun onCreate() {
|
||||
super.onCreate()
|
||||
if (DEBUG) {
|
||||
CallerLogger.d("$M_CORDER$TAG", "onCreate……")
|
||||
}
|
||||
if (mUSBMonitor == null) {
|
||||
mUSBMonitor = USBMonitor(applicationContext, mOnDeviceConnectListener)
|
||||
mUSBMonitor!!.register()
|
||||
mDeviceList = mUSBMonitor!!.deviceList
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
if (DEBUG) CallerLogger.d("$M_CORDER$TAG", "onDestroy:")
|
||||
if (mUSBMonitor != null) {
|
||||
mUSBMonitor!!.unregister()
|
||||
mUSBMonitor = null
|
||||
}
|
||||
}
|
||||
|
||||
override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
|
||||
return super.onStartCommand(intent, flags, startId)
|
||||
}
|
||||
|
||||
|
||||
override fun onBind(intent: Intent): IBinder? {
|
||||
return null
|
||||
}
|
||||
|
||||
override fun onRebind(intent: Intent) {
|
||||
if (DEBUG) CallerLogger.d("$M_CORDER$TAG", "onRebind:$intent")
|
||||
}
|
||||
|
||||
|
||||
override fun onUnbind(intent: Intent): Boolean {
|
||||
if (DEBUG) CallerLogger.d("$M_CORDER$TAG", "onUnbind:$intent")
|
||||
|
||||
if (DEBUG) CallerLogger.d("$M_CORDER$TAG", "onUnbind:finished")
|
||||
return true
|
||||
}
|
||||
|
||||
//**********************************************************************************************************************************
|
||||
private val mSync: Any = Any()
|
||||
|
||||
private val mVideoEncoder: MediaVideoBufferEncoder? = null
|
||||
|
||||
|
||||
/**
|
||||
* USB 设备连接监听
|
||||
*/
|
||||
private val mOnDeviceConnectListener: OnDeviceConnectListener = object : OnDeviceConnectListener {
|
||||
override fun onAttach(device: UsbDevice) {
|
||||
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) CallerLogger.d("$M_CORDER$TAG", "OnDeviceConnectListener#onConnect:${device.deviceName}")
|
||||
openCamera(device, ctrlBlock, createNew)
|
||||
}
|
||||
|
||||
override fun onDisconnect(device: UsbDevice, ctrlBlock: UsbControlBlock) {
|
||||
if (DEBUG) CallerLogger.d("$M_CORDER$TAG", "OnDeviceConnectListener#onDisconnect:${device.deviceName}")
|
||||
}
|
||||
|
||||
override fun onDettach(device: UsbDevice) {
|
||||
if (DEBUG) CallerLogger.d("$M_CORDER$TAG", "OnDeviceConnectListener#onDettach:${device.deviceName}")
|
||||
}
|
||||
|
||||
override fun onCancel(device: UsbDevice) {
|
||||
if (DEBUG) CallerLogger.d("$M_CORDER$TAG", "OnDeviceConnectListener#onCancel:${device.deviceName}")
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 连接相机
|
||||
*/
|
||||
private fun openCamera(device: UsbDevice, ctrlBlock: UsbControlBlock, createNew: Boolean) {
|
||||
if (mUVCCamera == null) {
|
||||
mUVCCamera = UVCCamera()
|
||||
mUVCCamera!!.open(ctrlBlock)
|
||||
mUVCCamera!!.setStatusCallback { statusClass, event, selector, statusAttribute, data ->
|
||||
if (DEBUG) CallerLogger.d("$M_CORDER$TAG", "IStatusCallback#onStatus(statusClass=${statusClass},event=${event},selector=${selector},statusAttribute=${statusAttribute},data=${data})")
|
||||
}
|
||||
|
||||
try {
|
||||
mUVCCamera!!.setPreviewSize(UVCCamera.DEFAULT_PREVIEW_WIDTH, UVCCamera.DEFAULT_PREVIEW_HEIGHT, UVCCamera.FRAME_FORMAT_MJPEG)
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
try {
|
||||
mUVCCamera!!.setPreviewSize(UVCCamera.DEFAULT_PREVIEW_WIDTH, UVCCamera.DEFAULT_PREVIEW_HEIGHT, UVCCamera.DEFAULT_PREVIEW_MODE)
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
mUVCCamera!!.destroy()
|
||||
}
|
||||
}
|
||||
|
||||
mUVCCamera!!.setFrameCallback(mIFrameCallback, UVCCamera.PIXEL_FORMAT_YUV420SP)
|
||||
mUVCCamera!!.startPreview()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 视频帧回掉
|
||||
*/
|
||||
private val mIFrameCallback = IFrameCallback { frame ->
|
||||
if (DEBUG) CallerLogger.d("$M_CORDER$TAG", "IFrameCallback#onFrame:${frame}")
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,53 +0,0 @@
|
||||
package com.mogo.eagle.core.function.carcorder.service
|
||||
|
||||
import android.content.Intent
|
||||
import android.os.IBinder
|
||||
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
|
||||
|
||||
/**
|
||||
* 行车记录仪服务
|
||||
* @author donghongyu
|
||||
*/
|
||||
class LivePushService : BaseService() {
|
||||
private val DEBUG = true
|
||||
val TAG = LivePushService::class.java.name
|
||||
|
||||
override fun onCreate() {
|
||||
super.onCreate()
|
||||
if (DEBUG) {
|
||||
CallerLogger.d("$M_CORDER$TAG", "onCreate……")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
if (DEBUG) CallerLogger.d("$M_CORDER$TAG", "onDestroy:")
|
||||
|
||||
}
|
||||
|
||||
override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
|
||||
return super.onStartCommand(intent, flags, startId)
|
||||
}
|
||||
|
||||
|
||||
override fun onBind(intent: Intent): IBinder? {
|
||||
return null
|
||||
}
|
||||
|
||||
override fun onRebind(intent: Intent) {
|
||||
if (DEBUG) CallerLogger.d("$M_CORDER$TAG", "onRebind:$intent")
|
||||
}
|
||||
|
||||
|
||||
override fun onUnbind(intent: Intent): Boolean {
|
||||
if (DEBUG) CallerLogger.d("$M_CORDER$TAG", "onUnbind:$intent")
|
||||
|
||||
if (DEBUG) CallerLogger.d("$M_CORDER$TAG", "onUnbind:finished")
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -61,18 +61,14 @@ dependencies {
|
||||
implementation rootProject.ext.dependencies.androidxrecyclerview
|
||||
|
||||
if (Boolean.valueOf(USE_MAVEN_PACKAGE)) {
|
||||
implementation rootProject.ext.dependencies.modulecommon
|
||||
implementation rootProject.ext.dependencies.moduleservice
|
||||
implementation rootProject.ext.dependencies.mogo_core_data
|
||||
implementation rootProject.ext.dependencies.mogo_core_utils
|
||||
implementation rootProject.ext.dependencies.mogo_core_function_api
|
||||
implementation rootProject.ext.dependencies.mogo_core_function_call
|
||||
implementation rootProject.ext.dependencies.mogo_core_res
|
||||
} else {
|
||||
implementation project(':modules:mogo-module-common')
|
||||
implementation project(':foudations:mogo-commons')
|
||||
implementation project(':core:mogo-core-data')
|
||||
implementation project(':core:mogo-core-utils')
|
||||
implementation project(':core:mogo-core-function-api')
|
||||
implementation project(':core:mogo-core-function-call')
|
||||
implementation project(':core:mogo-core-res')
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ import com.mogo.eagle.core.function.api.chat.biz.IMCallType.CALL_TYPE_DEFAULT
|
||||
import com.mogo.eagle.core.function.api.chat.biz.IMCallType.CALL_TYPE_VEHICLE_TEAM
|
||||
import com.mogo.eagle.core.function.api.chat.biz.IMCallType.CALL_TYPE_VOICE
|
||||
import com.mogo.eagle.core.function.api.chat.biz.IMType.*
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapLocationListenerManager
|
||||
import com.mogo.eagle.core.function.chat.facade.analytics.ChatAnalyticsFacade
|
||||
import com.mogo.eagle.core.function.chat.facade.audio.AudioFocusFacade
|
||||
import com.mogo.eagle.core.function.chat.facade.bridge.BridgeApi
|
||||
@@ -34,11 +35,10 @@ import com.mogo.eagle.core.function.chat.facade.net.ChatServiceModel
|
||||
import com.mogo.eagle.core.function.chat.facade.net.bean.CallRequestParam
|
||||
import com.mogo.eagle.core.function.chat.facade.net.bean.ConnectStatusParam
|
||||
import com.mogo.eagle.core.function.chat.facade.socket.SocketConnectManager
|
||||
import com.mogo.eagle.core.function.chat.facade.utils.log
|
||||
import com.mogo.eagle.core.function.chat.facade.voice.VoiceControlFacade
|
||||
import com.mogo.eagle.core.utilcode.kotlin.safeCancel
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
|
||||
import com.mogo.eagle.core.utilcode.util.Utils
|
||||
import com.mogo.map.MogoLocationClient
|
||||
import kotlinx.coroutines.*
|
||||
import kotlinx.coroutines.android.asCoroutineDispatcher
|
||||
import kotlinx.coroutines.channels.Channel
|
||||
@@ -137,7 +137,7 @@ object MoGoChatFacade: IMoGoChatFacade {
|
||||
}
|
||||
|
||||
private var callStatus by Delegates.observable(INIT_CALL) { _, _, newValue ->
|
||||
log(ChatConsts.TAG, "call-status: ${newValue.toText()}")
|
||||
Logger.d(ChatConsts.TAG, "call-status: ${newValue.toText()}")
|
||||
}
|
||||
|
||||
@ExperimentalCoroutinesApi
|
||||
@@ -148,7 +148,7 @@ object MoGoChatFacade: IMoGoChatFacade {
|
||||
}
|
||||
|
||||
private var callType by Delegates.observable(CALL_TYPE_DEFAULT) { _, oldValue, newValue ->
|
||||
log(ChatConsts.TAG, "call type change: oldValue: $oldValue - newValue: $newValue")
|
||||
Logger.d(ChatConsts.TAG, "call type change: oldValue: $oldValue - newValue: $newValue")
|
||||
}
|
||||
|
||||
private val sender by lazy { AtomicReference<UserInfo>(null) }
|
||||
@@ -171,7 +171,7 @@ object MoGoChatFacade: IMoGoChatFacade {
|
||||
|
||||
@ExperimentalCoroutinesApi
|
||||
private fun initSocketService() {
|
||||
log(ChatConsts.TAG, "-- initSocketService --")
|
||||
Logger.d(ChatConsts.TAG, "-- initSocketService --")
|
||||
SocketConnectManager.setOnMsgReceiveCb {
|
||||
handleMessage(it)
|
||||
}
|
||||
@@ -181,7 +181,7 @@ object MoGoChatFacade: IMoGoChatFacade {
|
||||
@ExperimentalCoroutinesApi
|
||||
private fun handleMessage(msg: String) {
|
||||
mainScope.launch {
|
||||
log(ChatConsts.TAG, "长链下行消息: $msg")
|
||||
Logger.d(ChatConsts.TAG, "长链下行消息: $msg")
|
||||
val map = Gson().fromJson<Map<String, Any>>(msg, Map::class.java)
|
||||
val temp = map ?: return@launch
|
||||
val msgType = temp["msgType"]
|
||||
@@ -189,12 +189,12 @@ object MoGoChatFacade: IMoGoChatFacade {
|
||||
when(val t = msgType.toInt()) {
|
||||
0 -> {
|
||||
val openId = (temp["localUserId"] as? Double ?: return@launch).toInt().toString()
|
||||
log(ChatConsts.TAG, "handleMessage --- openId:$openId")
|
||||
Logger.d(ChatConsts.TAG, "handleMessage --- openId:$openId")
|
||||
//初始化房间
|
||||
GMEApi.init(context(), openId = openId, cb = gmeCallback)
|
||||
}
|
||||
else ->
|
||||
log(ChatConsts.TAG, "handleMessage --- $t")
|
||||
Logger.d(ChatConsts.TAG, "handleMessage --- $t")
|
||||
}
|
||||
} else {
|
||||
val message = withContext(Dispatchers.Default) { Gson().fromJson(msg, Message::class.java) } ?: return@launch
|
||||
@@ -207,7 +207,7 @@ object MoGoChatFacade: IMoGoChatFacade {
|
||||
when(message.type.toCallType()) {
|
||||
CALL_TYPE_VOICE -> {
|
||||
if (GMEApi.isRoomEntered() && callType == CALL_TYPE_VEHICLE_TEAM) {
|
||||
log(ChatConsts.TAG, "收到来电进房消息,此时正在车队通话。需要挂断电话")
|
||||
Logger.d(ChatConsts.TAG, "收到来电进房消息,此时正在车队通话。需要挂断电话")
|
||||
try {
|
||||
serverApi.requestConnectStatus(ConnectStatusParam(MoGoAiCloudClientConfig.getInstance().sn, message.snSender, message.roomId, PUSH_MSG_HANG_UP, message.type))
|
||||
} catch (t : Throwable) {
|
||||
@@ -230,7 +230,7 @@ object MoGoChatFacade: IMoGoChatFacade {
|
||||
callType = message.type.toCallType()
|
||||
channel4SocketMsg.send(message)
|
||||
}
|
||||
else -> log(ChatConsts.TAG, "-- 接收者同意通话,但是呼叫类型不对: ${message.type}")
|
||||
else -> Logger.d(ChatConsts.TAG, "-- 接收者同意通话,但是呼叫类型不对: ${message.type}")
|
||||
}
|
||||
}
|
||||
PUSH_MSG_DENY_ENTER -> {
|
||||
@@ -238,12 +238,12 @@ object MoGoChatFacade: IMoGoChatFacade {
|
||||
when(message.type.toCallType()) {
|
||||
CALL_TYPE_VOICE -> {
|
||||
if (GMEApi.isRoomEntered() && callType == CALL_TYPE_VEHICLE_TEAM) {
|
||||
log(ChatConsts.TAG, "已经进房,收到被拒绝消息,则不处理(为兼容车队需求),否则会引发退房操作")
|
||||
Logger.d(ChatConsts.TAG, "已经进房,收到被拒绝消息,则不处理(为兼容车队需求),否则会引发退房操作")
|
||||
return@launch
|
||||
}
|
||||
if (callStatus == READY_TO_CALL_RECEIVER && message.snReceiver == MoGoAiCloudClientConfig.getInstance().sn) {
|
||||
//如果当前是来电状态,并且收到拒绝消息,说明呼叫方呼出又挂断
|
||||
log(ChatConsts.TAG, "呼叫方呼出后,又挂断")
|
||||
Logger.d(ChatConsts.TAG, "呼叫方呼出后,又挂断")
|
||||
onCallingInterrupt?.get()?.invoke(false, message.toUser())
|
||||
return@launch
|
||||
}
|
||||
@@ -260,7 +260,7 @@ object MoGoChatFacade: IMoGoChatFacade {
|
||||
callType = message.type.toCallType()
|
||||
channel4SocketMsg.send(message)
|
||||
}
|
||||
else -> log(ChatConsts.TAG, "-- 接收者拒绝,但是呼叫类型不对: ${message.type}")
|
||||
else -> Logger.d(ChatConsts.TAG, "-- 接收者拒绝,但是呼叫类型不对: ${message.type}")
|
||||
}
|
||||
}
|
||||
PUSH_MSG_HANG_UP -> {
|
||||
@@ -289,7 +289,7 @@ object MoGoChatFacade: IMoGoChatFacade {
|
||||
channel4SocketMsg.send(message)
|
||||
}
|
||||
}
|
||||
else -> log(ChatConsts.TAG, "-- 收到来电,但是呼叫类型不对: ${message.type}")
|
||||
else -> Logger.d(ChatConsts.TAG, "-- 收到来电,但是呼叫类型不对: ${message.type}")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -411,7 +411,7 @@ object MoGoChatFacade: IMoGoChatFacade {
|
||||
return@async
|
||||
}
|
||||
is UserChangeInRoom -> {
|
||||
log(ChatConsts.TAG, "openIds: ${state.left.joinToString(",")}")
|
||||
Logger.d(ChatConsts.TAG, "openIds: ${state.left.joinToString(",")}")
|
||||
if (!state.isEnter && state.left.isEmpty()) {
|
||||
exitRoom()
|
||||
continue
|
||||
@@ -439,7 +439,7 @@ object MoGoChatFacade: IMoGoChatFacade {
|
||||
when(msg.status) {
|
||||
PUSH_MSG_AGREE_ENTER -> {
|
||||
//接收方同意进房
|
||||
log(ChatConsts.TAG, "[Call] - [Agree] - roomId: $roomId-msg: $msg")
|
||||
Logger.d(ChatConsts.TAG, "[Call] - [Agree] - roomId: $roomId-msg: $msg")
|
||||
if (roomId == msg.roomId) {
|
||||
if (callType == CALL_TYPE_VOICE) {
|
||||
send(CallState.AgreeCall(false, msg))
|
||||
@@ -455,7 +455,7 @@ object MoGoChatFacade: IMoGoChatFacade {
|
||||
}
|
||||
PUSH_MSG_DENY_ENTER -> {
|
||||
//接收方拒绝进房
|
||||
log(ChatConsts.TAG, "[Call] - [Refuse] - roomId: $roomId-msg: $msg")
|
||||
Logger.d(ChatConsts.TAG, "[Call] - [Refuse] - roomId: $roomId-msg: $msg")
|
||||
if (roomId == msg.roomId) {
|
||||
teamMembers.set(msg.teamMember ?: emptyList())
|
||||
if (callType == CALL_TYPE_VOICE) {
|
||||
@@ -470,7 +470,7 @@ object MoGoChatFacade: IMoGoChatFacade {
|
||||
}
|
||||
|
||||
PUSH_MSG_HANG_UP -> {
|
||||
log(ChatConsts.TAG, "[Call] - [hangUp] - roomId: $roomId-msg: $msg")
|
||||
Logger.d(ChatConsts.TAG, "[Call] - [hangUp] - roomId: $roomId-msg: $msg")
|
||||
teamMembers.set(msg.teamMember ?: emptyList())
|
||||
if (callType == CALL_TYPE_VOICE) {
|
||||
send(CallState.HangUp(false, msg))
|
||||
@@ -496,7 +496,7 @@ object MoGoChatFacade: IMoGoChatFacade {
|
||||
}
|
||||
}
|
||||
}.catch {
|
||||
log(ChatConsts.TAG, "unknow exption:$it")
|
||||
Logger.d(ChatConsts.TAG, "unknow exption:$it")
|
||||
emit(CallState.Error(CallState.CODE_UNKNOWN_ERROR, "[Call] - ${it.message ?: "未知异常"}"))
|
||||
}.onCompletion {
|
||||
resetState()
|
||||
@@ -581,7 +581,7 @@ object MoGoChatFacade: IMoGoChatFacade {
|
||||
}
|
||||
//告之服务器给发送方下发接收通话消息
|
||||
try {
|
||||
val location = MogoLocationClient.getInstance(context())?.lastKnowLocation
|
||||
val location = CallerMapLocationListenerManager.getCurrentLocation()
|
||||
val response = serverApi.requestConnectStatus(ConnectStatusParam(MoGoAiCloudClientConfig.getInstance().sn, sn, roomId, PUSH_MSG_AGREE_ENTER, CALL_TYPE_VOICE.type).also {
|
||||
it.nickName = mySelf.get().name
|
||||
it.headImgUrl = mySelf.get().icon
|
||||
@@ -612,7 +612,7 @@ object MoGoChatFacade: IMoGoChatFacade {
|
||||
val msg = channel4SocketMsg.receive()
|
||||
when(msg.status) {
|
||||
PUSH_MSG_HANG_UP -> {
|
||||
log(ChatConsts.TAG, "[Answer] - [hangUp] - msg -> $msg")
|
||||
Logger.d(ChatConsts.TAG, "[Answer] - [hangUp] - msg -> $msg")
|
||||
if (callType == CALL_TYPE_VOICE) {
|
||||
send(AnswerState.HangUp(false, msg))
|
||||
exitRoom()
|
||||
@@ -623,18 +623,18 @@ object MoGoChatFacade: IMoGoChatFacade {
|
||||
}
|
||||
}
|
||||
PUSH_MSG_AGREE_ENTER -> {
|
||||
log(ChatConsts.TAG, "[Answer] - [Agree] - msg -> $msg")
|
||||
Logger.d(ChatConsts.TAG, "[Answer] - [Agree] - msg -> $msg")
|
||||
if (callType.isTeam()) {
|
||||
//接受车队邀请
|
||||
log(ChatConsts.TAG, "[Answer] - [Agree] - [Team] - msg -> $msg")
|
||||
Logger.d(ChatConsts.TAG, "[Answer] - [Agree] - [Team] - msg -> $msg")
|
||||
send(AnswerState.AcceptTeamInvite(msg))
|
||||
teamMembers.set(msg.teamMember)
|
||||
}
|
||||
}
|
||||
PUSH_MSG_DENY_ENTER -> {
|
||||
log(ChatConsts.TAG, "[Answer] - [hangUp] - msg -> $msg")
|
||||
Logger.d(ChatConsts.TAG, "[Answer] - [hangUp] - msg -> $msg")
|
||||
if (callType.isTeam()) {
|
||||
log(ChatConsts.TAG, "[Answer] - [hangUp] - [Team] - msg -> $msg")
|
||||
Logger.d(ChatConsts.TAG, "[Answer] - [hangUp] - [Team] - msg -> $msg")
|
||||
send(AnswerState.RefuseTeamInvite(msg))
|
||||
teamMembers.set(msg.teamMember)
|
||||
}
|
||||
@@ -670,7 +670,7 @@ object MoGoChatFacade: IMoGoChatFacade {
|
||||
return@async
|
||||
}
|
||||
is UserChangeInRoom -> {
|
||||
log(ChatConsts.TAG, "openIds: ${state.left.joinToString(",")}")
|
||||
Logger.d(ChatConsts.TAG, "openIds: ${state.left.joinToString(",")}")
|
||||
if (!state.isEnter && state.left.isEmpty()) {
|
||||
exitRoom()
|
||||
continue
|
||||
@@ -705,7 +705,7 @@ object MoGoChatFacade: IMoGoChatFacade {
|
||||
}
|
||||
}
|
||||
}.catch {
|
||||
log(ChatConsts.TAG, "unknow exption:$it")
|
||||
Logger.d(ChatConsts.TAG, "unknow exption:$it")
|
||||
emit(AnswerState.Error(AnswerState.CODE_UNKNOWN_ERROR, it.message ?: "未知异常"))
|
||||
}.onCompletion {
|
||||
resetState()
|
||||
@@ -812,7 +812,7 @@ object MoGoChatFacade: IMoGoChatFacade {
|
||||
}
|
||||
val response = serverApi.inviteJoinVehicleTeam(CallRequestParam().also {
|
||||
val user = mySelf.get()
|
||||
val location = MogoLocationClient.getInstance(context())?.lastKnowLocation
|
||||
val location = CallerMapLocationListenerManager.getCurrentLocation()
|
||||
it.snSender = mySn
|
||||
it.snReceiver = sn
|
||||
it.nickName = user.name
|
||||
@@ -885,7 +885,7 @@ object MoGoChatFacade: IMoGoChatFacade {
|
||||
return@async
|
||||
}
|
||||
is UserChangeInRoom -> {
|
||||
log(ChatConsts.TAG, "openIds: ${state.left.joinToString(",")}")
|
||||
Logger.d(ChatConsts.TAG, "openIds: ${state.left.joinToString(",")}")
|
||||
if (!state.isEnter && state.left.isEmpty()) {
|
||||
exitRoom()
|
||||
continue
|
||||
@@ -958,7 +958,7 @@ object MoGoChatFacade: IMoGoChatFacade {
|
||||
}
|
||||
//告之服务器给发送方下发接收通话消息
|
||||
try {
|
||||
val location = MogoLocationClient.getInstance(context())?.lastKnowLocation
|
||||
val location = CallerMapLocationListenerManager.getCurrentLocation()
|
||||
val response = serverApi.requestConnectStatus(ConnectStatusParam(MoGoAiCloudClientConfig.getInstance().sn, sn, roomId, PUSH_MSG_AGREE_ENTER, CALL_TYPE_VEHICLE_TEAM.type).also {
|
||||
it.nickName = mySelf.get().name
|
||||
it.headImgUrl = mySelf.get().icon
|
||||
@@ -993,15 +993,15 @@ object MoGoChatFacade: IMoGoChatFacade {
|
||||
}
|
||||
when(msg.status) {
|
||||
PUSH_MSG_HANG_UP -> {
|
||||
log(ChatConsts.TAG, "[JoinTeam] - [hangUp] - msg -> $msg")
|
||||
Logger.d(ChatConsts.TAG, "[JoinTeam] - [hangUp] - msg -> $msg")
|
||||
teamMembers.set(msg.teamMember ?: emptyList())
|
||||
}
|
||||
PUSH_MSG_AGREE_ENTER -> {
|
||||
log(ChatConsts.TAG, "[JoinTeam] - [Agree] - msg -> $msg")
|
||||
Logger.d(ChatConsts.TAG, "[JoinTeam] - [Agree] - msg -> $msg")
|
||||
teamMembers.set(msg.teamMember ?: emptyList())
|
||||
}
|
||||
PUSH_MSG_DENY_ENTER -> {
|
||||
log(ChatConsts.TAG, "[JoinTeam] - [Deny] - msg -> $msg")
|
||||
Logger.d(ChatConsts.TAG, "[JoinTeam] - [Deny] - msg -> $msg")
|
||||
teamMembers.set(msg.teamMember ?: emptyList())
|
||||
}
|
||||
}
|
||||
@@ -1040,7 +1040,7 @@ object MoGoChatFacade: IMoGoChatFacade {
|
||||
return@async
|
||||
}
|
||||
is UserChangeInRoom -> {
|
||||
log(ChatConsts.TAG, "openIds: ${state.left.joinToString(",")}")
|
||||
Logger.d(ChatConsts.TAG, "openIds: ${state.left.joinToString(",")}")
|
||||
if (!state.isEnter && state.left.isEmpty()) {
|
||||
exitRoom()
|
||||
continue
|
||||
@@ -1083,7 +1083,7 @@ object MoGoChatFacade: IMoGoChatFacade {
|
||||
try {
|
||||
client.stopHeartBeat()
|
||||
} catch (t: Throwable) {
|
||||
log(ChatConsts.TAG, "$t")
|
||||
Logger.d(ChatConsts.TAG, "$t")
|
||||
}
|
||||
channel4GmeState.safeCancel()
|
||||
channel4SocketMsg.safeCancel()
|
||||
|
||||
@@ -2,7 +2,6 @@ package com.mogo.eagle.core.function.chat.facade.analytics
|
||||
|
||||
import com.mogo.commons.analytics.AnalyticsUtils
|
||||
import com.mogo.eagle.core.function.api.chat.biz.IMoGoAnalyticsFacade
|
||||
import com.mogo.eagle.core.function.chat.facade.bridge.BridgeApi
|
||||
|
||||
object ChatAnalyticsFacade: IMoGoAnalyticsFacade {
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ import android.os.Looper
|
||||
import com.mogo.eagle.core.function.api.chat.biz.ChatConsts
|
||||
import com.mogo.eagle.core.function.api.chat.biz.IMoGoAudioFocusFacade
|
||||
import com.mogo.eagle.core.function.chat.facade.bridge.BridgeApi
|
||||
import com.mogo.eagle.core.function.chat.facade.utils.log
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
|
||||
import kotlinx.coroutines.*
|
||||
import kotlinx.coroutines.android.asCoroutineDispatcher
|
||||
import java.util.concurrent.TimeUnit.SECONDS
|
||||
@@ -40,7 +40,7 @@ object AudioFocusFacade: IMoGoAudioFocusFacade {
|
||||
private var hasAudioFocus = false
|
||||
|
||||
override fun requireAudioFocus(onGetFocus: () -> Unit) {
|
||||
log(ChatConsts.TAG, "requireDuck===$hasAudioFocus")
|
||||
Logger.d(ChatConsts.TAG, "requireDuck===$hasAudioFocus")
|
||||
scope.launch {
|
||||
if (!hasAudioFocus) {
|
||||
while (true) {
|
||||
@@ -79,7 +79,7 @@ object AudioFocusFacade: IMoGoAudioFocusFacade {
|
||||
}
|
||||
|
||||
override fun releaseAudioFocus() {
|
||||
log(ChatConsts.TAG, "releaseDuck===$hasAudioFocus")
|
||||
Logger.d(ChatConsts.TAG, "releaseDuck===$hasAudioFocus")
|
||||
focusJob.get()?.takeIf { it.isActive }?.cancel()
|
||||
scope.launch {
|
||||
if (hasAudioFocus) {
|
||||
@@ -101,7 +101,7 @@ object AudioFocusFacade: IMoGoAudioFocusFacade {
|
||||
|
||||
private class MyAudioFocusChangeListener : OnAudioFocusChangeListener {
|
||||
override fun onAudioFocusChange(focusChange: Int) {
|
||||
log(ChatConsts.TAG, "onAudioFocusChange: $focusChange")
|
||||
Logger.d(ChatConsts.TAG, "onAudioFocusChange: $focusChange")
|
||||
when (focusChange) {
|
||||
AudioManager.AUDIOFOCUS_GAIN -> {
|
||||
hasAudioFocus = true
|
||||
|
||||
@@ -8,7 +8,7 @@ import com.gme.TMG.ITMGContext
|
||||
import com.gme.av.sdk.AVError
|
||||
import com.gme.av.sig.AuthBuffer
|
||||
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.mogo.logger.Logger
|
||||
import com.mogo.eagle.core.utilcode.util.Utils
|
||||
import java.lang.ref.WeakReference
|
||||
import java.util.concurrent.atomic.AtomicBoolean
|
||||
@@ -66,22 +66,22 @@ internal object GMEApi {
|
||||
if (type == ITMGContext.ITMG_MAIN_EVENT_TYPE.ITMG_MAIN_EVNET_TYPE_USER_UPDATE) {
|
||||
val eventId = data.eventId
|
||||
val users = data.users
|
||||
log(ChatConsts.TAG, "RoomMembersUpdate: ${users.joinToString(",")}")
|
||||
Logger.d(ChatConsts.TAG, "RoomMembersUpdate: ${users.joinToString(",")}")
|
||||
if (users.isEmpty()) {
|
||||
log(ChatConsts.TAG, "没人了,准备退房")
|
||||
Logger.d(ChatConsts.TAG, "没人了,准备退房")
|
||||
cb?.invoke(GmeState.UserChangeInRoom(isEnter = false, emptyArray()))
|
||||
return
|
||||
}
|
||||
val filtered = users.filter {
|
||||
log(ChatConsts.TAG, "成员进房====$it===ownId:$openId")
|
||||
Logger.d(ChatConsts.TAG, "成员进房====$it===ownId:$openId")
|
||||
it.toInt() > 99999
|
||||
}.toTypedArray()
|
||||
if (filtered.isEmpty()) {
|
||||
log(ChatConsts.TAG, "成员为空,无操作")
|
||||
Logger.d(ChatConsts.TAG, "成员为空,无操作")
|
||||
return
|
||||
}
|
||||
if (eventId == ITMGContext.ITMG_EVENT_ID_USER_ENTER) {
|
||||
log(ChatConsts.TAG, "成员进房==去掉99999====$filtered")
|
||||
Logger.d(ChatConsts.TAG, "成员进房==去掉99999====$filtered")
|
||||
cb?.invoke(GmeState.UserChangeInRoom(isEnter = true, filtered))
|
||||
}
|
||||
if (eventId == ITMGContext.ITMG_EVENT_ID_USER_EXIT) {
|
||||
@@ -92,11 +92,11 @@ internal object GMEApi {
|
||||
}
|
||||
|
||||
fun enableAudio() {
|
||||
log(ChatConsts.TAG, "-- enable audio --- 1 ---")
|
||||
Logger.d(ChatConsts.TAG, "-- enable audio --- 1 ---")
|
||||
if (!hasInit.get()) {
|
||||
return
|
||||
}
|
||||
log(ChatConsts.TAG, "-- enable audio --- 2 ---")
|
||||
Logger.d(ChatConsts.TAG, "-- enable audio --- 2 ---")
|
||||
val audioCtrl = tmgCtx.GetAudioCtrl()
|
||||
//开启麦克
|
||||
audioCtrl?.EnableMic(true)
|
||||
@@ -109,11 +109,11 @@ internal object GMEApi {
|
||||
}
|
||||
|
||||
fun disableAudio() {
|
||||
log(ChatConsts.TAG, "-- disable audio --- 1 ---")
|
||||
Logger.d(ChatConsts.TAG, "-- disable audio --- 1 ---")
|
||||
if (!hasInit.get()) {
|
||||
return
|
||||
}
|
||||
log(ChatConsts.TAG, "-- disable audio --- 2 ---")
|
||||
Logger.d(ChatConsts.TAG, "-- disable audio --- 2 ---")
|
||||
val audioCtrl = tmgCtx.GetAudioCtrl()
|
||||
audioCtrl?.EnableSpeaker(false)
|
||||
//开启麦克
|
||||
@@ -122,7 +122,7 @@ internal object GMEApi {
|
||||
|
||||
fun init(ctx: Context, openId: String, cb: ((s: GmeState) -> Unit)? = null) {
|
||||
if (hasInit.get()) {
|
||||
log(ChatConsts.TAG, "Error: GmeApi has initialized.")
|
||||
Logger.d(ChatConsts.TAG, "Error: GmeApi has initialized.")
|
||||
return
|
||||
}
|
||||
hasInit.set(true)
|
||||
@@ -143,7 +143,7 @@ internal object GMEApi {
|
||||
cb?.invoke(GmeState.InitFail(ret))
|
||||
}
|
||||
} catch (t: Throwable) {
|
||||
log(ChatConsts.TAG, "GMEAPI - error: $t")
|
||||
Logger.d(ChatConsts.TAG, "GMEAPI - error: $t")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import android.media.MediaPlayer
|
||||
import android.os.Build
|
||||
import com.mogo.eagle.core.function.api.chat.biz.ChatConsts
|
||||
import com.mogo.eagle.core.function.api.chat.biz.IMoGoMediaFacade
|
||||
import com.mogo.eagle.core.function.chat.facade.utils.log
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
|
||||
import java.lang.ref.WeakReference
|
||||
import java.util.concurrent.atomic.AtomicReference
|
||||
|
||||
@@ -32,29 +32,29 @@ internal object MedialControlFacade : IMoGoMediaFacade {
|
||||
isLooping = isLoop
|
||||
prepareAsync()
|
||||
setOnPreparedListener { player ->
|
||||
log(ChatConsts.TAG,"real play 准备播放音频====")
|
||||
Logger.d(ChatConsts.TAG,"real play 准备播放音频====")
|
||||
player.start()
|
||||
}
|
||||
setOnCompletionListener { player ->
|
||||
log(ChatConsts.TAG,"播放完成====")
|
||||
Logger.d(ChatConsts.TAG,"播放完成====")
|
||||
player.reset()
|
||||
}
|
||||
}
|
||||
} catch (t: Throwable) {
|
||||
log(ChatConsts.TAG, "播放铃声异常:$t")
|
||||
Logger.d(ChatConsts.TAG, "播放铃声异常:$t")
|
||||
}
|
||||
}
|
||||
|
||||
override fun release() {
|
||||
try {
|
||||
val player = this.player.get()?.get() ?: return
|
||||
log(ChatConsts.TAG,"release 释放音频播放====")
|
||||
Logger.d(ChatConsts.TAG,"release 释放音频播放====")
|
||||
player.run {
|
||||
resetStatus(this)
|
||||
release()
|
||||
}
|
||||
} catch (t: Throwable) {
|
||||
log(ChatConsts.TAG, "释放MediaPlay异常: $t")
|
||||
Logger.d(ChatConsts.TAG, "释放MediaPlay异常: $t")
|
||||
} finally {
|
||||
player.set(null)
|
||||
}
|
||||
|
||||
@@ -3,17 +3,16 @@ package com.mogo.eagle.core.function.chat.facade.net
|
||||
import com.google.gson.Gson
|
||||
import com.google.gson.JsonObject
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
|
||||
import com.mogo.commons.AbsMogoApplication
|
||||
import com.mogo.eagle.core.data.BaseResponse
|
||||
import com.mogo.eagle.core.data.chat.UserInfo
|
||||
import com.mogo.eagle.core.function.api.chat.biz.ChatConsts
|
||||
import com.mogo.eagle.core.function.api.chat.biz.IMCallType.CALL_TYPE_VOICE
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapLocationListenerManager
|
||||
import com.mogo.eagle.core.function.chat.facade.consts.ChatHttp
|
||||
import com.mogo.eagle.core.function.chat.facade.consts.ChatHttp.Companion.getConfig
|
||||
import com.mogo.eagle.core.function.chat.facade.net.bean.*
|
||||
import com.mogo.eagle.core.function.chat.facade.utils.log
|
||||
import com.mogo.map.MogoLocationClient
|
||||
import com.mogo.eagle.core.network.MoGoRetrofitFactory
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
|
||||
import retrofit2.http.*
|
||||
|
||||
|
||||
@@ -70,12 +69,13 @@ internal class ChatServiceModel {
|
||||
suspend fun requestConnectStatus(params: ConnectStatusParam): BaseResponse<Any> {
|
||||
val map = hashMapOf<String, String>()
|
||||
val sn = MoGoAiCloudClientConfig.getInstance().sn
|
||||
val location = MogoLocationClient.getInstance(AbsMogoApplication.getApp())?.lastKnowLocation
|
||||
|
||||
val location = CallerMapLocationListenerManager.getCurrentLocation()
|
||||
if (location != null) {
|
||||
params.lon = location.longitude
|
||||
params.lat = location.latitude
|
||||
}
|
||||
log(ChatConsts.TAG, "connectStatusParam:$params")
|
||||
Logger.d(ChatConsts.TAG, "connectStatusParam:$params")
|
||||
map["sn"] = MoGoAiCloudClientConfig.getInstance().sn
|
||||
map["data"] = Gson().toJson(params)
|
||||
return if (params.type == CALL_TYPE_VOICE.type) {
|
||||
@@ -93,7 +93,7 @@ internal class ChatServiceModel {
|
||||
|
||||
suspend fun inviteJoinVehicleTeam(param: CallRequestParam): BaseResponse<Any> {
|
||||
val map = hashMapOf<String, String>()
|
||||
log(ChatConsts.TAG, "inviteJoinVehicleTeam paras: $param")
|
||||
Logger.d(ChatConsts.TAG, "inviteJoinVehicleTeam paras: $param")
|
||||
map["sn"] = MoGoAiCloudClientConfig.getInstance().sn
|
||||
map["data"] = Gson().toJson(param)
|
||||
return apiCall {
|
||||
@@ -104,12 +104,12 @@ internal class ChatServiceModel {
|
||||
|
||||
suspend fun requestRoomInfo(param: CallRequestParam): BaseResponse<RoomInfo> {
|
||||
val map = hashMapOf<String, String>()
|
||||
val location = MogoLocationClient.getInstance(AbsMogoApplication.getApp())?.lastKnowLocation
|
||||
val location = CallerMapLocationListenerManager.getCurrentLocation()
|
||||
if (location != null) {
|
||||
param.lat = location.latitude
|
||||
param.lon = location.longitude
|
||||
}
|
||||
log(ChatConsts.TAG, "roomParam:$param")
|
||||
Logger.d(ChatConsts.TAG, "roomParam:$param")
|
||||
map["data"] = Gson().toJson(param)
|
||||
return apiCall {
|
||||
getNetWorkApi()?.requestRoomInfo(map) ?: throw IllegalStateException("apis is null.")
|
||||
|
||||
@@ -7,7 +7,7 @@ import com.mogo.eagle.core.function.api.chat.biz.ChatConsts
|
||||
import com.mogo.eagle.core.function.chat.facade.consts.ChatHttp
|
||||
import com.mogo.eagle.core.function.chat.facade.consts.SOCKET_HAND_SHAKE
|
||||
import com.mogo.eagle.core.function.chat.facade.consts.SOCKET_HEART_BEAT
|
||||
import com.mogo.eagle.core.function.chat.facade.utils.log
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
|
||||
import com.mogo.websocket.ISocketMsgCallBack
|
||||
import com.mogo.websocket.ISocketMsgSetting
|
||||
import com.mogo.websocket.SocketClient
|
||||
@@ -46,13 +46,13 @@ internal object SocketConnectManager {
|
||||
|
||||
private val socketMsgSetting: ISocketMsgSetting = object : ISocketMsgSetting {
|
||||
override fun getHandShakeMsg(): String {
|
||||
log(ChatConsts.TAG, "getHandShakeMsg")
|
||||
Logger.d(ChatConsts.TAG, "getHandShakeMsg")
|
||||
val socketMsg = HeartBeat(SOCKET_HAND_SHAKE, MoGoAiCloudClientConfig.getInstance().sn)
|
||||
return Gson().toJson(socketMsg)
|
||||
}
|
||||
|
||||
override fun getHeartBeatMsg(): String {
|
||||
log(ChatConsts.TAG, "getHeartBeatMsg")
|
||||
Logger.d(ChatConsts.TAG, "getHeartBeatMsg")
|
||||
val socketMsg = HeartBeat(SOCKET_HEART_BEAT, MoGoAiCloudClientConfig.getInstance().sn, roomId.get())
|
||||
return Gson().toJson(socketMsg)
|
||||
}
|
||||
@@ -60,25 +60,25 @@ internal object SocketConnectManager {
|
||||
|
||||
private val socketMsgCallBack: ISocketMsgCallBack = object : ISocketMsgCallBack {
|
||||
override fun onConnectOpen() {
|
||||
log(ChatConsts.TAG, "onConnectOpen ---> ")
|
||||
Logger.d(ChatConsts.TAG, "onConnectOpen ---> ")
|
||||
}
|
||||
|
||||
override fun handleError(e: Exception) {
|
||||
log(ChatConsts.TAG, "handleError ---> msg: ${e.message}")
|
||||
Logger.d(ChatConsts.TAG, "handleError ---> msg: ${e.message}")
|
||||
client.stopHeartBeat()
|
||||
}
|
||||
|
||||
override fun onConnectClose() {
|
||||
log(ChatConsts.TAG, "onConnectClose ---> stop web socket thread ,and ready to reconnect")
|
||||
Logger.d(ChatConsts.TAG, "onConnectClose ---> stop web socket thread ,and ready to reconnect")
|
||||
client.stop()
|
||||
log(ChatConsts.TAG, "onConnectClose ---> stop Heart Beat")
|
||||
Logger.d(ChatConsts.TAG, "onConnectClose ---> stop Heart Beat")
|
||||
client.stopHeartBeat()
|
||||
log(ChatConsts.TAG, "ready to reconnect")
|
||||
Logger.d(ChatConsts.TAG, "ready to reconnect")
|
||||
client.reConnect()
|
||||
}
|
||||
|
||||
override fun handleMessage(message: String) {
|
||||
log(ChatConsts.TAG, "handleMessage ---> $message")
|
||||
Logger.d(ChatConsts.TAG, "handleMessage ---> $message")
|
||||
msgCallback?.invoke(message)
|
||||
}
|
||||
}
|
||||
@@ -91,7 +91,7 @@ internal object SocketConnectManager {
|
||||
client.disConnect()
|
||||
client.stop()
|
||||
} catch (t: Throwable) {
|
||||
log(ChatConsts.TAG, "IMService -- destroy -- ex: $t")
|
||||
Logger.d(ChatConsts.TAG, "IMService -- destroy -- ex: $t")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -28,7 +28,6 @@ import com.mogo.eagle.core.function.chat.facade.MoGoChatFacade
|
||||
import com.mogo.eagle.core.function.chat.facade.OnCallingInterrupt
|
||||
import com.mogo.eagle.core.function.chat.facade.OnInComingCallback
|
||||
import com.mogo.eagle.core.function.chat.facade.bridge.BridgeApi
|
||||
import com.mogo.eagle.core.function.chat.facade.utils.log
|
||||
import com.mogo.eagle.core.function.chat.facade.voice.VoiceControlFacade.REQUEST_CLOUD_VOICE_CALL
|
||||
import com.mogo.eagle.core.utilcode.kotlin.*
|
||||
import com.mogo.eagle.core.utilcode.mogo.glide.transform.GlideRoundedCornersTransform
|
||||
@@ -40,6 +39,7 @@ import kotlinx.coroutines.flow.*
|
||||
import kotlinx.coroutines.selects.select
|
||||
import java.util.concurrent.atomic.AtomicReference
|
||||
import com.mogo.eagle.core.utilcode.mogo.glide.GlideApp
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.*
|
||||
@@ -111,7 +111,7 @@ internal class CallChatWindowManager {
|
||||
private val onInComingCall = object : OnInComingCallback {
|
||||
override fun invoke(isTeam: Boolean, user: UserInfo) {
|
||||
if (isTeam) {
|
||||
log(TAG, "车队邀请,不做处理....")
|
||||
Logger.d(TAG, "车队邀请,不做处理....")
|
||||
} else {
|
||||
showInComingView(user)
|
||||
}
|
||||
@@ -121,7 +121,7 @@ internal class CallChatWindowManager {
|
||||
private val onCallInterrupt = object : OnCallingInterrupt {
|
||||
override fun invoke(isTeam: Boolean, user: UserInfo) {
|
||||
if (isTeam) {
|
||||
log(TAG, "车队邀请拒绝,不做处理....")
|
||||
Logger.d(TAG, "车队邀请拒绝,不做处理....")
|
||||
} else {
|
||||
onCallInterrupt()
|
||||
}
|
||||
@@ -152,7 +152,7 @@ internal class CallChatWindowManager {
|
||||
speak(REQUEST_CLOUD_VOICE_CALL)
|
||||
calling()
|
||||
} catch (t: Throwable) {
|
||||
log(TAG, "来电呼叫异常:$t")
|
||||
Logger.d(TAG, "来电呼叫异常:$t")
|
||||
}
|
||||
}.also { ring = it }
|
||||
answer.onClick {
|
||||
@@ -177,20 +177,20 @@ internal class CallChatWindowManager {
|
||||
timer = inComingTimer(user, incomingView)
|
||||
launch(Dispatchers.Main) {
|
||||
val d1 = async {
|
||||
log(TAG, "监听对方呼出,又挂断状态...")
|
||||
Logger.d(TAG, "监听对方呼出,又挂断状态...")
|
||||
var interrupted = interrupt.receive()
|
||||
while (!interrupted) {
|
||||
interrupted = interrupt.receive()
|
||||
}
|
||||
log(TAG, "收到对方呼出又挂断状态...")
|
||||
Logger.d(TAG, "收到对方呼出又挂断状态...")
|
||||
}
|
||||
val d2 = async {
|
||||
log(TAG, "监听拒绝状态...")
|
||||
Logger.d(TAG, "监听拒绝状态...")
|
||||
var isRefuse = refused.receive()
|
||||
while (!isRefuse) {
|
||||
isRefuse = refused.receive()
|
||||
}
|
||||
log(TAG, "收到拒绝状态, 隐藏来电界面")
|
||||
Logger.d(TAG, "收到拒绝状态, 隐藏来电界面")
|
||||
}
|
||||
val state = select<Int> {
|
||||
d1.onAwait { 1 }
|
||||
@@ -198,11 +198,11 @@ internal class CallChatWindowManager {
|
||||
}
|
||||
when (state) {
|
||||
1 -> {
|
||||
log(TAG, "由于对方呼出又挂断,导致来电界面隐藏")
|
||||
Logger.d(TAG, "由于对方呼出又挂断,导致来电界面隐藏")
|
||||
d2.safeCancel()
|
||||
}
|
||||
2 -> {
|
||||
log(TAG, "由于自己主动拒接,导致来电界面隐藏")
|
||||
Logger.d(TAG, "由于自己主动拒接,导致来电界面隐藏")
|
||||
d1.safeCancel()
|
||||
}
|
||||
}
|
||||
@@ -278,9 +278,9 @@ internal class CallChatWindowManager {
|
||||
}
|
||||
|
||||
private fun CoroutineScope.inComingTimer(user: UserInfo, incomingView: View) = launch {
|
||||
log(TAG, "延迟30s消失计时开始...")
|
||||
Logger.d(TAG, "延迟30s消失计时开始...")
|
||||
delay(DEFAULT_MAX_DIALING_TIME)
|
||||
log(TAG, "延迟30s消失计时结束...")
|
||||
Logger.d(TAG, "延迟30s消失计时结束...")
|
||||
doRefuse(user, false, incomingView, false)
|
||||
hide(incomingView)
|
||||
releaseAudioAndVoice()
|
||||
@@ -324,20 +324,20 @@ internal class CallChatWindowManager {
|
||||
isCallingShow = true
|
||||
launch(Dispatchers.Main) {
|
||||
val d1 = async {
|
||||
log(ChatConsts.TAG, "等着新用户进来...")
|
||||
Logger.d(ChatConsts.TAG, "等着新用户进来...")
|
||||
var isNewUserEnter = callerEnter.receive()
|
||||
while (!isNewUserEnter) {
|
||||
isNewUserEnter = callerEnter.receive()
|
||||
}
|
||||
//新用户进来了
|
||||
log(ChatConsts.TAG, "新用户进来了...")
|
||||
Logger.d(ChatConsts.TAG, "新用户进来了...")
|
||||
callingTimer()
|
||||
.collect {
|
||||
timer.text = parseTime(it)
|
||||
}
|
||||
}
|
||||
val d2 = async {
|
||||
log(ChatConsts.TAG, "等着退房通知...")
|
||||
Logger.d(ChatConsts.TAG, "等着退房通知...")
|
||||
var exit = exitRoom.receive()
|
||||
while (!exit) {
|
||||
exit = exitRoom.receive()
|
||||
@@ -349,10 +349,10 @@ internal class CallChatWindowManager {
|
||||
}
|
||||
when (state) {
|
||||
1 -> {
|
||||
log(TAG, "通话中, 计时任务结束了(不般不会发生)...")
|
||||
Logger.d(TAG, "通话中, 计时任务结束了(不般不会发生)...")
|
||||
}
|
||||
2 -> {
|
||||
log(TAG, "收到退房通知,可以移除通话状态的界面了...")
|
||||
Logger.d(TAG, "收到退房通知,可以移除通话状态的界面了...")
|
||||
d1.safeCancel()
|
||||
}
|
||||
}
|
||||
@@ -459,7 +459,7 @@ internal class CallChatWindowManager {
|
||||
exitRoom()
|
||||
},
|
||||
onError = { code, msg, extra ->
|
||||
log(TAG, "-- 应答失败 --: code:: $code; msg:: $msg; extra:: $extra")
|
||||
Logger.d(TAG, "-- 应答失败 --: code:: $code; msg:: $msg; extra:: $extra")
|
||||
when (code) {
|
||||
AnswerState.CODE_ANSWER_SOCKET_DISCONNECT -> {
|
||||
ToastUtils.showShort("连接已断开")
|
||||
@@ -513,7 +513,7 @@ internal class CallChatWindowManager {
|
||||
onError.invoke(it.code, it.msg, it.extra)
|
||||
}
|
||||
else -> {
|
||||
log(ChatConsts.TAG, "[Answer][Other]-> $it")
|
||||
Logger.d(ChatConsts.TAG, "[Answer][Other]-> $it")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -535,7 +535,7 @@ internal class CallChatWindowManager {
|
||||
}
|
||||
},
|
||||
onError = { code, msg, extra ->
|
||||
log(TAG, "-- 拒绝失败 --: code:: $code; msg:: $msg; extra:: $extra")
|
||||
Logger.d(TAG, "-- 拒绝失败 --: code:: $code; msg:: $msg; extra:: $extra")
|
||||
if (isAnswerFail) {
|
||||
ToastUtils.showShort("应答异常")
|
||||
} else {
|
||||
@@ -569,7 +569,7 @@ internal class CallChatWindowManager {
|
||||
onError.invoke(itx.code, itx.msg, itx.extra)
|
||||
}
|
||||
else -> {
|
||||
log(ChatConsts.TAG, "[Refuse][Other]-> $it")
|
||||
Logger.d(ChatConsts.TAG, "[Refuse][Other]-> $it")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -581,10 +581,10 @@ internal class CallChatWindowManager {
|
||||
hangUp(
|
||||
user,
|
||||
onSuccess = {
|
||||
log(TAG, "挂断接口请求成功,等着退房...")
|
||||
Logger.d(TAG, "挂断接口请求成功,等着退房...")
|
||||
},
|
||||
onError = { code, msg, extra ->
|
||||
log(TAG, "挂断异常:code: $code; msg: $msg, ; extra: $extra")
|
||||
Logger.d(TAG, "挂断异常:code: $code; msg: $msg, ; extra: $extra")
|
||||
ToastUtils.showShort("挂断异常")
|
||||
})
|
||||
|
||||
@@ -638,14 +638,14 @@ internal class CallChatWindowManager {
|
||||
}
|
||||
is HangUpState.Error -> {
|
||||
hasHangUpped = false
|
||||
log(
|
||||
Logger.d(
|
||||
TAG,
|
||||
"-- 挂断失败 --: code:: ${itx.code}; msg:: ${itx.msg}; extra:: ${itx.extra}"
|
||||
)
|
||||
onError.invoke(itx.code, itx.msg, itx.extra)
|
||||
}
|
||||
else -> {
|
||||
log(ChatConsts.TAG, "[HangUp][Other]-> $it")
|
||||
Logger.d(ChatConsts.TAG, "[HangUp][Other]-> $it")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
@file:JvmName("LogUtil")
|
||||
|
||||
package com.mogo.eagle.core.function.chat.facade.utils
|
||||
|
||||
import com.mogo.eagle.core.function.chat.facade.aop.DebugLog
|
||||
|
||||
|
||||
@DebugLog
|
||||
fun log(tag: String, msg: String) {}
|
||||
@@ -10,7 +10,7 @@ import com.mogo.commons.voice.IMogoVoiceCmdCallBack
|
||||
import com.mogo.eagle.core.function.api.chat.biz.IMoGoVoiceControlFacade
|
||||
import com.mogo.eagle.core.function.api.chat.biz.IMoGoVoiceControlFacade.IMoGoVoiceCallback
|
||||
import com.mogo.eagle.core.function.chat.facade.bridge.BridgeApi
|
||||
import com.mogo.eagle.core.function.chat.facade.utils.log
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
|
||||
import java.lang.ref.WeakReference
|
||||
import java.util.concurrent.CopyOnWriteArrayList
|
||||
import java.util.concurrent.atomic.AtomicBoolean
|
||||
@@ -64,27 +64,27 @@ object VoiceControlFacade: IMoGoVoiceControlFacade, IMogoVoiceCmdCallBack, IMogo
|
||||
.forEach {
|
||||
when (itx) {
|
||||
VOICE_REGISTER_CANCEL_CALL -> {
|
||||
log(TAG, "语音免唤醒 取消打电话")
|
||||
Logger.d(TAG, "语音免唤醒 取消打电话")
|
||||
it.get()?.onVoiceCancelCall()
|
||||
}
|
||||
VOICE_REGISTER_INVITE_JOIN_TEAM -> {
|
||||
log(TAG, "语音免唤醒 邀請加入车队")
|
||||
Logger.d(TAG, "语音免唤醒 邀請加入车队")
|
||||
it.get()?.onVoiceInviteJoinTeam()
|
||||
}
|
||||
VOICE_REGISTER_JOIN_TEAM -> {
|
||||
log(TAG, "语音免唤醒 加入车队")
|
||||
Logger.d(TAG, "语音免唤醒 加入车队")
|
||||
it.get()?.onVoiceJoinTeam()
|
||||
}
|
||||
VOICE_REGISTER_REFUSE_JOIN_TEAM -> {
|
||||
log(TAG, "语音免唤醒 拒绝加入车队")
|
||||
Logger.d(TAG, "语音免唤醒 拒绝加入车队")
|
||||
it.get()?.onVoiceRefuseJoinTeam()
|
||||
}
|
||||
VOICE_INTENT_ANSWER_CALL -> {
|
||||
log(TAG, "语音免唤醒 接收电话邀请")
|
||||
Logger.d(TAG, "语音免唤醒 接收电话邀请")
|
||||
it.get()?.onVoiceAnswerCall()
|
||||
}
|
||||
VOICE_INTENT_REFUSE_CALL -> {
|
||||
log(TAG, "语音免唤醒 来电拒接")
|
||||
Logger.d(TAG, "语音免唤醒 来电拒接")
|
||||
it.get()?.onVoiceRefuseCall()
|
||||
}
|
||||
}
|
||||
@@ -125,14 +125,14 @@ object VoiceControlFacade: IMoGoVoiceControlFacade, IMogoVoiceCmdCallBack, IMogo
|
||||
}
|
||||
|
||||
override fun registerInviteJoinTeam(context: Context, listener: IMoGoVoiceCallback) {
|
||||
log(TAG, "registerInviteJoinTeam")
|
||||
Logger.d(TAG, "registerInviteJoinTeam")
|
||||
listeners += WeakReference(listener)
|
||||
AIAssist.getInstance(context)
|
||||
.registerUnWakeupCommand(VOICE_REGISTER_INVITE_JOIN_TEAM, customInviteJoinTeamArray, this)
|
||||
}
|
||||
|
||||
override fun registerJoinTeam(context: Context, listener: IMoGoVoiceCallback) {
|
||||
log(TAG, "registerJoinTeam")
|
||||
Logger.d(TAG, "registerJoinTeam")
|
||||
listeners += WeakReference(listener)
|
||||
AIAssist.getInstance(context)
|
||||
.registerUnWakeupCommand(VOICE_REGISTER_JOIN_TEAM, customJoinTeamArray, this)
|
||||
@@ -170,19 +170,19 @@ object VoiceControlFacade: IMoGoVoiceControlFacade, IMogoVoiceCmdCallBack, IMogo
|
||||
|
||||
override fun onCmdAction(speakText: String?) {
|
||||
super.onCmdAction(speakText)
|
||||
log(TAG, "onCmdAction ---> ")
|
||||
Logger.d(TAG, "onCmdAction ---> ")
|
||||
this@VoiceControlFacade.onCmdAgree?.get()?.invoke(true)
|
||||
}
|
||||
|
||||
override fun onCmdCancel(speakText: String?) {
|
||||
super.onCmdCancel(speakText)
|
||||
log(TAG, "onCmdCancel ---> ")
|
||||
Logger.d(TAG, "onCmdCancel ---> ")
|
||||
this@VoiceControlFacade.onCmdAgree?.get()?.invoke(false)
|
||||
}
|
||||
|
||||
override fun onSpeakEnd(speakText: String?) {
|
||||
super.onSpeakEnd(speakText)
|
||||
log(TAG, "onSpeakEnd ---> ")
|
||||
Logger.d(TAG, "onSpeakEnd ---> ")
|
||||
this@VoiceControlFacade.onSpeechFinish?.get()?.invoke()
|
||||
}
|
||||
})
|
||||
@@ -205,10 +205,10 @@ object VoiceControlFacade: IMoGoVoiceControlFacade, IMogoVoiceCmdCallBack, IMogo
|
||||
|
||||
override fun onIntentReceived(cmd: String?, intent: Intent?) {
|
||||
val command = cmd ?: return
|
||||
log(TAG, "handleOnIntentCmd: cmd -> $command")
|
||||
Logger.d(TAG, "handleOnIntentCmd: cmd -> $command")
|
||||
when (command) {
|
||||
VOICE_INTENT_CANCEL_CALL_COMMAND, VOICE_INTENT_REFUSE_CALL -> {
|
||||
log(TAG, "语音唤醒 取消打电话")
|
||||
Logger.d(TAG, "语音唤醒 取消打电话")
|
||||
listeners
|
||||
.filter {
|
||||
it.get() != null
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
/build
|
||||
@@ -1,39 +0,0 @@
|
||||
# 状态检测模块
|
||||
硬件检测范围
|
||||
主激光雷达
|
||||
侧激光雷达-2个
|
||||
ADAS长焦摄像头-前
|
||||
ADAS广角摄像头-前
|
||||
ADAS标准摄像头-前
|
||||
ADAS广角摄像头-后
|
||||
RTK设备
|
||||
OUB设备
|
||||
PAD
|
||||
路由器
|
||||
|
||||
自动驾驶软件检测范围 节点
|
||||
车控节点
|
||||
轨迹地图加载节点
|
||||
轨迹规划节点
|
||||
定位转化节点
|
||||
融合节点
|
||||
yolov5节点(包含红绿灯检测)
|
||||
激光雷达渲染节点
|
||||
摄像头驱动节点
|
||||
gnss定位驱动节点
|
||||
中激光驱动节点
|
||||
左激光解码节点
|
||||
左激光驱动节点
|
||||
右激光解码节点
|
||||
右激光驱动节点
|
||||
监控节点
|
||||
通讯交互节点
|
||||
轨迹录制节点
|
||||
can车辆控制节点
|
||||
鹰眼
|
||||
|
||||
版本更新
|
||||
自动驾驶版本
|
||||
鹰眼版本
|
||||
|
||||
功能隐藏 不用适配
|
||||
@@ -1,82 +0,0 @@
|
||||
plugins {
|
||||
id 'com.android.library'
|
||||
id 'kotlin-android'
|
||||
id 'kotlin-android-extensions'
|
||||
id 'kotlin-kapt'
|
||||
id 'com.alibaba.arouter'
|
||||
}
|
||||
android {
|
||||
compileSdkVersion rootProject.ext.android.compileSdkVersion
|
||||
defaultConfig {
|
||||
minSdkVersion rootProject.ext.android.minSdkVersion
|
||||
targetSdkVersion rootProject.ext.android.targetSdkVersion
|
||||
versionCode Integer.valueOf(VERSION_CODE)
|
||||
versionName getValueFromRootProperties("${project.name.replace("-", "_").toUpperCase()}_VERSION")
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
consumerProguardFiles 'consumer-rules.pro'
|
||||
|
||||
//ARouter apt 参数
|
||||
kapt {
|
||||
useBuildCache = false
|
||||
arguments {
|
||||
arg("AROUTER_MODULE_NAME", project.getName())
|
||||
}
|
||||
}
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||
implementation rootProject.ext.dependencies.androidxappcompat
|
||||
implementation rootProject.ext.dependencies.androidxrecyclerview
|
||||
implementation rootProject.ext.dependencies.androidxconstraintlayout
|
||||
implementation rootProject.ext.dependencies.arouter
|
||||
implementation rootProject.ext.dependencies.coroutinesandroid
|
||||
implementation rootProject.ext.dependencies.coroutinescore
|
||||
implementation rootProject.ext.dependencies.rxandroid
|
||||
implementation rootProject.ext.dependencies.kotlinstdlibjdk7
|
||||
implementation rootProject.ext.dependencies.material
|
||||
|
||||
kapt rootProject.ext.dependencies.aroutercompiler
|
||||
|
||||
if (Boolean.valueOf(USE_MAVEN_PACKAGE)) {
|
||||
implementation rootProject.ext.dependencies.mogocommons
|
||||
implementation rootProject.ext.dependencies.mogoserviceapi
|
||||
|
||||
implementation rootProject.ext.dependencies.modulecommon
|
||||
implementation rootProject.ext.dependencies.moduleservice
|
||||
implementation rootProject.ext.dependencies.callchatprovider
|
||||
|
||||
implementation rootProject.ext.dependencies.mogo_core_data
|
||||
implementation rootProject.ext.dependencies.mogo_core_utils
|
||||
implementation rootProject.ext.dependencies.mogo_core_network
|
||||
implementation rootProject.ext.dependencies.mogo_core_function_call
|
||||
|
||||
} else {
|
||||
implementation project(":foudations:mogo-commons")
|
||||
implementation project(':services:mogo-service-api')
|
||||
|
||||
implementation project(':modules:mogo-module-common')
|
||||
|
||||
implementation project(':core:mogo-core-data')
|
||||
implementation project(':core:mogo-core-utils')
|
||||
implementation project(':core:mogo-core-network')
|
||||
implementation project(':core:mogo-core-function-call')
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()
|
||||
@@ -1,21 +0,0 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# You can control the set of applied configuration files using the
|
||||
# proguardFiles setting in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
||||
@@ -1,12 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.mogo.eagle.core.function.check">
|
||||
|
||||
<application>
|
||||
<activity
|
||||
android:name="com.mogo.eagle.core.function.check.view.CheckActivity"
|
||||
android:launchMode="singleTask"
|
||||
android:screenOrientation="landscape" />
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
@@ -1,130 +0,0 @@
|
||||
package com.mogo.eagle.core.function.check
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.mogo.commons.module.status.IMogoStatusChangedListener
|
||||
import com.mogo.commons.module.status.MogoStatusManager
|
||||
import com.mogo.commons.module.status.StatusDescriptor
|
||||
import com.mogo.eagle.core.data.constants.MogoServicePaths
|
||||
import com.mogo.eagle.core.function.api.check.ICheckProvider
|
||||
import com.mogo.eagle.core.function.api.check.IMogoCheckListener
|
||||
import com.mogo.eagle.core.function.check.api.ICheckResultCallBack
|
||||
import com.mogo.eagle.core.function.check.net.CheckNetWork.checkNetWork
|
||||
import com.mogo.eagle.core.function.check.net.CheckResultData
|
||||
import com.mogo.eagle.core.function.check.view.CheckActivity
|
||||
import com.mogo.eagle.core.function.check.view.CheckDialog
|
||||
import com.mogo.eagle.core.function.report.IPCReportManager
|
||||
import com.mogo.eagle.core.utilcode.util.*
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
|
||||
/**
|
||||
* 鹰眼系统、自动驾驶系统 检测模块
|
||||
*
|
||||
* @date 4/21/21 3:39 PM
|
||||
* 需求地址
|
||||
* wiki:http://wiki.zhidaohulian.com/pages/viewpage.action?pageId=58204952
|
||||
*/
|
||||
@Route(path = MogoServicePaths.PATH_CHECK)
|
||||
class VehicleMonitoringManager : ICheckProvider, IMogoStatusChangedListener {
|
||||
private val TAG = "VehicleMonitoringManager"
|
||||
private var mContext: Context? = null
|
||||
private val mListeners: ConcurrentHashMap<String, IMogoCheckListener> = ConcurrentHashMap()
|
||||
private var hasTipShow = false //是否已经弹框提示
|
||||
var dialog: CheckDialog? = null
|
||||
|
||||
override val functionName: String
|
||||
get() = "VehicleMonitoringManager"
|
||||
|
||||
override fun init(context: Context) {
|
||||
mContext = context
|
||||
MogoStatusManager.getInstance().registerStatusChangedListener(TAG,
|
||||
StatusDescriptor.MAIN_PAGE_RESUME,
|
||||
this)
|
||||
//开启工控机监控节点上报服务
|
||||
IPCReportManager.INSTANCE.initServer()
|
||||
}
|
||||
|
||||
override fun registerVehicleMonitoringListener(module: String, listener: IMogoCheckListener) {
|
||||
mListeners[module] = listener
|
||||
}
|
||||
|
||||
override fun unregisterListener(module: String) {
|
||||
mListeners.remove(module)
|
||||
}
|
||||
|
||||
override fun startCheckActivity(context: Context) {
|
||||
val starter = Intent(context, CheckActivity::class.java)
|
||||
starter.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
context.startActivity(starter)
|
||||
}
|
||||
|
||||
override fun showCheckDialog(context: Context) {
|
||||
showDialog(context)
|
||||
}
|
||||
|
||||
override fun checkMonitor(context: Context) {
|
||||
checkNetWork( context, object : ICheckResultCallBack {
|
||||
override fun callBackWithCheckData(data: CheckResultData) {
|
||||
updateMonitoringStatus(TAG, data.data.vehicle.state)
|
||||
if (data.data.vehicle.state == 1) {
|
||||
hasTipShow = false
|
||||
} else {
|
||||
if (!hasTipShow) {
|
||||
showDialog(context)
|
||||
hasTipShow = true //已弹框
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun callBackWithError(message: String, code: Int) {
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 指标异常弹框
|
||||
*/
|
||||
private fun showDialog(context: Context) {
|
||||
try {
|
||||
if (AppStateManager.isActive() && AppUtils.isAppRunning(
|
||||
AppUtils.getAppPackageName()
|
||||
) && ActivityUtils.getTopActivity() !is CheckActivity
|
||||
) {
|
||||
if (dialog != null) {
|
||||
dialog!!.dismiss()
|
||||
}
|
||||
dialog = CheckDialog(context, true)
|
||||
dialog!!.show()
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
|
||||
override fun updateMonitoringStatus(module: String, state: Int) {
|
||||
for (listener in mListeners) {
|
||||
listener.value.updateMonitoringStatus(state)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onStatusChanged(descriptor: StatusDescriptor, isTrue: Boolean) {
|
||||
if (descriptor == StatusDescriptor.MAIN_PAGE_RESUME) {
|
||||
if (!isTrue) {
|
||||
if (dialog != null && dialog!!.isShowing) {
|
||||
dialog!!.dismiss()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
//停止工控机监控节点上报服务
|
||||
MogoStatusManager.getInstance().unregisterStatusChangedListener(TAG,
|
||||
StatusDescriptor.MAIN_PAGE_RESUME,
|
||||
this)
|
||||
IPCReportManager.INSTANCE.destroy()
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
package com.mogo.eagle.core.function.check.api;
|
||||
|
||||
import com.mogo.eagle.core.function.check.net.CheckResultData;
|
||||
|
||||
/**
|
||||
* @author liujing
|
||||
* @description 自车检测结果回调
|
||||
* @since: 9/28/21
|
||||
*/
|
||||
public interface ICheckResultCallBack {
|
||||
void callBackWithCheckData(CheckResultData data);
|
||||
|
||||
void callBackWithError(String message, int code);
|
||||
}
|
||||
@@ -1,138 +0,0 @@
|
||||
package com.mogo.eagle.core.function.check.model;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* @author liujing
|
||||
* @description 描述
|
||||
* @since: 7/28/21
|
||||
*/
|
||||
public class CheckItemInfo implements Serializable {
|
||||
//view类型
|
||||
private int style;
|
||||
//view顶端标题
|
||||
private String viewTitle;
|
||||
|
||||
//icon 下第一行title 自动驾驶软件\鹰眼系统
|
||||
private String title;
|
||||
|
||||
private String value;
|
||||
private ArrayList itemList;
|
||||
//是否存在异常
|
||||
private boolean usual;
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public ArrayList getItemList() {
|
||||
return itemList;
|
||||
}
|
||||
|
||||
public void setItemList(ArrayList itemList) {
|
||||
this.itemList = itemList;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public boolean isUsual() {
|
||||
return usual;
|
||||
}
|
||||
|
||||
public void setUsual(boolean usual) {
|
||||
this.usual = usual;
|
||||
}
|
||||
|
||||
public int getStyle() {
|
||||
return style;
|
||||
}
|
||||
|
||||
public void setStyle(int style) {
|
||||
this.style = style;
|
||||
}
|
||||
|
||||
public String getViewTitle() {
|
||||
return viewTitle;
|
||||
}
|
||||
|
||||
public void setViewTitle(String viewTitle) {
|
||||
this.viewTitle = viewTitle;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "CheckItemInfo{" +
|
||||
"style=" + style +
|
||||
", viewTitle='" + viewTitle + '\'' +
|
||||
", title='" + title + '\'' +
|
||||
", value='" + value + '\'' +
|
||||
", itemList=" + itemList +
|
||||
", usual=" + usual +
|
||||
'}';
|
||||
}
|
||||
|
||||
public static class DetailItem implements Serializable {
|
||||
private boolean usual;
|
||||
private String title;
|
||||
private String value;
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public boolean isUsual() {
|
||||
return usual;
|
||||
}
|
||||
|
||||
public void setUsual(boolean usual) {
|
||||
this.usual = usual;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "DetailItem{" +
|
||||
"usual=" + usual +
|
||||
", title='" + title + '\'' +
|
||||
", value='" + value + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
public interface CheckAdapterStyleEnum {
|
||||
int ITEM_TYPE_CHECK_TITLE = 0;
|
||||
int ITEM_TYPE_CHECK_LIST = 1;
|
||||
int ITEM_TYPE_CHECK_IMAGE = 2;
|
||||
}
|
||||
|
||||
public interface CheckInfoStyle {
|
||||
String CHECK_INFO_STYLE_DEVICES = "devices";
|
||||
String CHECK_INFO_STYLE_SOFT = "soft";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
package com.mogo.eagle.core.function.check.net;
|
||||
|
||||
import com.mogo.commons.constants.HostConst;
|
||||
import com.mogo.eagle.core.network.MoGoRetrofitFactory;
|
||||
|
||||
/**
|
||||
* @author liujing
|
||||
* @description 描述
|
||||
* @since: 8/13/21
|
||||
*/
|
||||
public class CheckApiServiceFactory {
|
||||
private static CheckApiServices mDataApiService;
|
||||
|
||||
/**
|
||||
* 获取指定域名下的 API 服务
|
||||
*/
|
||||
public static CheckApiServices getApiService(String netHost) {
|
||||
return MoGoRetrofitFactory.getInstance(netHost).create(CheckApiServices.class);
|
||||
}
|
||||
|
||||
public static CheckApiServices getDataApiService() {
|
||||
if (mDataApiService == null) {
|
||||
synchronized (CheckApiServiceFactory.class) {
|
||||
if (mDataApiService == null) {
|
||||
mDataApiService = getApiService(HostConst.DATA_SERVICE_HOST);
|
||||
}
|
||||
}
|
||||
}
|
||||
return mDataApiService;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
package com.mogo.eagle.core.function.check.net;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import retrofit2.http.GET;
|
||||
import retrofit2.http.QueryMap;
|
||||
|
||||
/**
|
||||
* @author liujing
|
||||
* @description 描述
|
||||
* @since: 8/13/21
|
||||
*/
|
||||
public interface CheckApiServices {
|
||||
|
||||
@GET("/yycp-vehicle-management-service/monitor/license/detail")
|
||||
Observable<CheckResultData> loadMonitorDetail(@QueryMap Map<String, Object> param);
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
package com.mogo.eagle.core.function.check.net
|
||||
|
||||
import android.content.Context
|
||||
import com.elegant.network.ParamsBuilder
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
|
||||
import com.mogo.eagle.core.function.check.api.ICheckResultCallBack
|
||||
import com.mogo.eagle.core.network.RequestOptions
|
||||
import com.mogo.eagle.core.network.SubscribeImpl
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||
import io.reactivex.schedulers.Schedulers
|
||||
|
||||
/**
|
||||
* @author liujing
|
||||
* @description 自测检测网络请求类
|
||||
* @since: 10/12/21
|
||||
*/
|
||||
|
||||
object CheckNetWork {
|
||||
|
||||
//网络请求,获取自车检测结果(工控机上报云端)
|
||||
fun checkNetWork(context: Context, callbackFlow: ICheckResultCallBack) {
|
||||
val params = ParamsBuilder.of(false)
|
||||
.append("sn", MoGoAiCloudClientConfig.getInstance().sn)
|
||||
.build()
|
||||
|
||||
CheckApiServiceFactory.getDataApiService().loadMonitorDetail(params)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(object : SubscribeImpl<CheckResultData>(RequestOptions.create(context)) {
|
||||
override fun onSuccess(o: CheckResultData) {
|
||||
super.onSuccess(o)
|
||||
ThreadUtils.runOnUiThread { callbackFlow?.callBackWithCheckData(o) }
|
||||
}
|
||||
|
||||
override fun onError(message: String, code: Int) {
|
||||
super.onError(message, code)
|
||||
ThreadUtils.runOnUiThread { callbackFlow?.callBackWithError(message, code) }
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,278 +0,0 @@
|
||||
package com.mogo.eagle.core.function.check.net;
|
||||
|
||||
import com.mogo.eagle.core.data.BaseData;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author liujing
|
||||
* @description 描述
|
||||
* @since: 8/13/21
|
||||
*/
|
||||
public class CheckResultData extends BaseData {
|
||||
private Data data;
|
||||
private boolean success;
|
||||
|
||||
public Data getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(Data data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public boolean isSuccess() {
|
||||
return success;
|
||||
}
|
||||
|
||||
public void setSuccess(boolean success) {
|
||||
this.success = success;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "CheckResultData{" +
|
||||
"data=" + data +
|
||||
", success=" + success +
|
||||
'}';
|
||||
}
|
||||
|
||||
public static class Data implements Serializable{
|
||||
private Vehicle vehicle;
|
||||
private List<CheckListItem> soft;
|
||||
private List<CheckListItem> devices;
|
||||
private Integer deviceState = 1;//硬件状态
|
||||
private Integer softState = 0;//系统(软件)状态
|
||||
|
||||
public Vehicle getVehicle() {
|
||||
return vehicle;
|
||||
}
|
||||
|
||||
public void setVehicle(Vehicle vehicle) {
|
||||
this.vehicle = vehicle;
|
||||
}
|
||||
|
||||
public List<CheckListItem> getSoft() {
|
||||
return soft;
|
||||
}
|
||||
|
||||
public void setSoft(List<CheckListItem> soft) {
|
||||
this.soft = soft;
|
||||
}
|
||||
|
||||
public List<CheckListItem> getDevices() {
|
||||
return devices;
|
||||
}
|
||||
|
||||
public void setDevices(List<CheckListItem> devices) {
|
||||
this.devices = devices;
|
||||
}
|
||||
|
||||
public Integer getSoftState() {
|
||||
return softState;
|
||||
}
|
||||
|
||||
public void setSoftState(Integer softState) {
|
||||
this.softState = softState;
|
||||
}
|
||||
|
||||
public Integer getDeviceState() {
|
||||
return deviceState;
|
||||
}
|
||||
|
||||
public void setDeviceState(Integer deviceState) {
|
||||
this.deviceState = deviceState;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Data{" +
|
||||
"vehicle=" + vehicle +
|
||||
", soft=" + soft +
|
||||
", devices=" + devices +
|
||||
", softState=" + softState +
|
||||
", deviceState=" + deviceState +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
public static class Vehicle implements Serializable {
|
||||
private String id;
|
||||
private String sn;
|
||||
private String vin;
|
||||
private String carBrand;
|
||||
private String carLicense;
|
||||
private String carType;
|
||||
private String userName;
|
||||
private String userPhone;
|
||||
private String carImage;
|
||||
private double createTime;
|
||||
private Integer state;
|
||||
private Integer ipcState;
|
||||
private Integer autoState;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getSn() {
|
||||
return sn;
|
||||
}
|
||||
|
||||
public void setSn(String sn) {
|
||||
this.sn = sn;
|
||||
}
|
||||
|
||||
public String getVin() {
|
||||
return vin;
|
||||
}
|
||||
|
||||
public void setVin(String vin) {
|
||||
this.vin = vin;
|
||||
}
|
||||
|
||||
public String getCarBrand() {
|
||||
return carBrand;
|
||||
}
|
||||
|
||||
public void setCarBrand(String carBrand) {
|
||||
this.carBrand = carBrand;
|
||||
}
|
||||
|
||||
public String getCarLicense() {
|
||||
return carLicense;
|
||||
}
|
||||
|
||||
public void setCarLicense(String carLicense) {
|
||||
this.carLicense = carLicense;
|
||||
}
|
||||
|
||||
public String getCarType() {
|
||||
return carType;
|
||||
}
|
||||
|
||||
public void setCarType(String carType) {
|
||||
this.carType = carType;
|
||||
}
|
||||
|
||||
public String getUserName() {
|
||||
return userName;
|
||||
}
|
||||
|
||||
public void setUserName(String userName) {
|
||||
this.userName = userName;
|
||||
}
|
||||
|
||||
public String getUserPhone() {
|
||||
return userPhone;
|
||||
}
|
||||
|
||||
public void setUserPhone(String userPhone) {
|
||||
this.userPhone = userPhone;
|
||||
}
|
||||
|
||||
public String getCarImage() {
|
||||
return carImage;
|
||||
}
|
||||
|
||||
public void setCarImage(String carImage) {
|
||||
this.carImage = carImage;
|
||||
}
|
||||
|
||||
public double getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(double createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public Integer getState() {
|
||||
return state;
|
||||
}
|
||||
|
||||
public void setState(Integer state) {
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
public Integer getIpcState() {
|
||||
return ipcState;
|
||||
}
|
||||
|
||||
public void setIpcState(Integer ipcState) {
|
||||
this.ipcState = ipcState;
|
||||
}
|
||||
|
||||
public Integer getAutoState() {
|
||||
return autoState;
|
||||
}
|
||||
|
||||
public void setAutoState(Integer autoState) {
|
||||
this.autoState = autoState;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "vehicle{" +
|
||||
"id='" + id + '\'' +
|
||||
", sn='" + sn + '\'' +
|
||||
", vin='" + vin + '\'' +
|
||||
", carBrand='" + carBrand + '\'' +
|
||||
", carLicense='" + carLicense + '\'' +
|
||||
", carType='" + carType + '\'' +
|
||||
", userName='" + userName + '\'' +
|
||||
", userPhone='" + userPhone + '\'' +
|
||||
", carImage='" + carImage + '\'' +
|
||||
", createTime='" + createTime + '\'' +
|
||||
", state='" + state + '\'' +
|
||||
", ipcState='" + ipcState + '\'' +
|
||||
", autoState='" + autoState + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
public static class CheckListItem implements Serializable{
|
||||
private String name;
|
||||
private String stateValue;
|
||||
private List<CheckResultData.CheckListItem> items;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Object getStateValue() {
|
||||
return stateValue;
|
||||
}
|
||||
|
||||
public void setStateValue(String stateValue) {
|
||||
this.stateValue = stateValue;
|
||||
}
|
||||
|
||||
public List getItems() {
|
||||
return items;
|
||||
}
|
||||
|
||||
public void setItems(List items) {
|
||||
this.items = items;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "soft{" +
|
||||
"name='" + name + '\'' +
|
||||
", stateValue=" + stateValue +
|
||||
", items=" + items +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,225 +0,0 @@
|
||||
package com.mogo.eagle.core.function.check.view;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.animation.AnimatorListenerAdapter;
|
||||
import android.animation.AnimatorSet;
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.animation.ValueAnimator;
|
||||
import android.graphics.Rect;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.ProgressBar;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.mogo.eagle.core.function.check.R;
|
||||
import com.mogo.eagle.core.function.check.api.ICheckResultCallBack;
|
||||
import com.mogo.eagle.core.function.check.net.CheckNetWork;
|
||||
import com.mogo.eagle.core.function.check.net.CheckResultData;
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils;
|
||||
import com.mogo.eagle.core.utilcode.mogo.view.SpacesItemDecoration;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @author liujing
|
||||
* @description 车辆监控页面首页
|
||||
* @since: 7/27/21
|
||||
*/
|
||||
public class CheckActivity extends AppCompatActivity {
|
||||
|
||||
private RecyclerView mRecyclerView;
|
||||
private static CheckResultData sCheckResultData;
|
||||
private ImageView mImageView;
|
||||
//车模
|
||||
private ImageView scanBottomCarImage;
|
||||
//扫描束
|
||||
private ImageView scanLineImage;
|
||||
//车辆模型顶部色值加深车模
|
||||
private ImageViewClipBounds scanTopImageView;
|
||||
//车模顶部小部件图片
|
||||
private ImageViewClipBounds tipsImageView;
|
||||
//动画组
|
||||
private AnimatorSet setAnimation = null;
|
||||
private ValueAnimator mValueAnimator;
|
||||
private float movement = 1162f;
|
||||
//进度条
|
||||
private ProgressBar mProgressBar;
|
||||
private final static long DURATION_TIME = 1000;
|
||||
private CheckAdapter mCheckAdapter;
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_check);
|
||||
initView();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStart() {
|
||||
super.onStart();
|
||||
animation();
|
||||
checkAction();
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表View初始化
|
||||
*/
|
||||
public void initView() {
|
||||
setAnimation = new AnimatorSet();
|
||||
mImageView = findViewById(R.id.btnBack);
|
||||
scanBottomCarImage = findViewById(R.id.scan_car_image);
|
||||
scanLineImage = findViewById(R.id.scan_line_image);
|
||||
scanTopImageView = findViewById(R.id.scan_car_top_image);
|
||||
tipsImageView = findViewById(R.id.scan_car_tips);
|
||||
mProgressBar = findViewById(R.id.check_progress);
|
||||
mImageView.setOnClickListener(v -> {
|
||||
finish();
|
||||
});
|
||||
|
||||
mRecyclerView = findViewById(R.id.check_list);
|
||||
CheckLinearLayout linearLayoutManager =
|
||||
new CheckLinearLayout(this, CheckLinearLayout.VERTICAL, false);
|
||||
mRecyclerView.addItemDecoration(new SpacesItemDecoration((int) getResources().getDimension(R.dimen.check_item_space_vr)));
|
||||
mRecyclerView.setLayoutManager(linearLayoutManager);
|
||||
mCheckAdapter = new CheckAdapter(CheckActivity.this, sCheckResultData);
|
||||
mRecyclerView.setAdapter(mCheckAdapter);
|
||||
}
|
||||
|
||||
private void checkAction() {
|
||||
CheckNetWork.INSTANCE.checkNetWork(this.getApplicationContext(), new ICheckResultCallBack() {
|
||||
@Override
|
||||
public void callBackWithCheckData(CheckResultData data) {
|
||||
ThreadUtils.runOnUiThread(() -> {
|
||||
if (data != null && mCheckAdapter != null) {
|
||||
mCheckAdapter.errorMsg = null;
|
||||
mCheckAdapter.mCheckResultData = data;
|
||||
mCheckAdapter.notifyDataSetChanged();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void callBackWithError(String message, int code) {
|
||||
if (message != null) {
|
||||
mCheckAdapter.errorMsg = message;
|
||||
mCheckAdapter.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* **************************************************************************************检测动画
|
||||
*/
|
||||
public void animation() {
|
||||
ObjectAnimator animatorX = ObjectAnimator.ofFloat(scanLineImage, "translationX",
|
||||
scanBottomCarImage.getWidth(), 0);
|
||||
ObjectAnimator animatorAl = ObjectAnimator.ofFloat(scanLineImage, "alpha",
|
||||
0, 1);
|
||||
setAnimation.playTogether(animatorX, animatorAl);
|
||||
setAnimation.setDuration(DURATION_TIME);
|
||||
setAnimation.start();
|
||||
setAnimation.addListener(new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
super.onAnimationEnd(animation);
|
||||
if (scanTopImageView != null) {
|
||||
movement = (float) scanTopImageView.getWidth();
|
||||
scanLineImage.setVisibility(View.VISIBLE);
|
||||
scanTopImageView.setVisibility(View.VISIBLE);
|
||||
tipsImageView.setVisibility(View.VISIBLE);
|
||||
}
|
||||
if (scanLineImage != null) {
|
||||
scanLineImage
|
||||
.animate()
|
||||
.translationX(movement)
|
||||
.setDuration(DURATION_TIME)
|
||||
.setListener(new Animator.AnimatorListener() {
|
||||
@Override
|
||||
public void onAnimationStart(Animator animation) {
|
||||
animatorScanCarBorder(true, scanTopImageView.getWidth());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationCancel(Animator animation) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationRepeat(Animator animation) {
|
||||
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 扫描动画:实现扫描束位移+顶部深色车模及检测元件的显示
|
||||
*/
|
||||
public void animatorScanCarBorder(boolean show, int weight) {
|
||||
if (show) {
|
||||
mValueAnimator = ValueAnimator.ofInt(0, weight);
|
||||
}
|
||||
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();
|
||||
}
|
||||
|
||||
/**
|
||||
* 进度条状态刷新
|
||||
*/
|
||||
public void setProgressBarRefresh(int animateValue) {
|
||||
if (mProgressBar != null) {
|
||||
double scale = BigDecimal.valueOf((float) animateValue / scanBottomCarImage.getWidth())
|
||||
.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue() * 100;
|
||||
if (mProgressBar.getProgress() < 100) {
|
||||
mProgressBar.setProgress((int) scale);
|
||||
} else {
|
||||
findViewById(R.id.animationLayout).setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
if (mCheckAdapter != null) {
|
||||
mCheckAdapter.dismissDialog();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onRestart() {
|
||||
super.onRestart();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
mCheckAdapter.onDestroy();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,192 +0,0 @@
|
||||
package com.mogo.eagle.core.function.check.view;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.mogo.eagle.core.function.check.R;
|
||||
import com.mogo.eagle.core.function.check.model.CheckItemInfo;
|
||||
import com.mogo.eagle.core.function.check.net.CheckResultData;
|
||||
|
||||
|
||||
/**
|
||||
* @author liujing
|
||||
* @description 检测首页单元格
|
||||
* @since: 7/27/21
|
||||
*/
|
||||
public class CheckAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
||||
|
||||
LayoutInflater mLayoutInflater;
|
||||
CheckResultData mCheckResultData;
|
||||
private Context mContext;
|
||||
CheckInfoListDialog mCheckInfoListDialog;
|
||||
String errorMsg;
|
||||
|
||||
public CheckAdapter(@NonNull Context context, @NonNull CheckResultData checkResult) {
|
||||
mContext = context;
|
||||
mCheckResultData = checkResult;
|
||||
mLayoutInflater = LayoutInflater.from(mContext);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemViewType(int position) {
|
||||
if (position == 0) {
|
||||
return CheckItemInfo.CheckAdapterStyleEnum.ITEM_TYPE_CHECK_TITLE;
|
||||
|
||||
}
|
||||
return CheckItemInfo.CheckAdapterStyleEnum.ITEM_TYPE_CHECK_LIST;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
if (viewType == CheckItemInfo.CheckAdapterStyleEnum.ITEM_TYPE_CHECK_TITLE) {
|
||||
View v = mLayoutInflater.inflate(R.layout.check_titel, parent,
|
||||
false);
|
||||
return new CheckTitleViewHolder(v);
|
||||
}
|
||||
View v = mLayoutInflater.inflate(R.layout.check_list, parent,
|
||||
false);
|
||||
return new CheckListViewHolder(v);
|
||||
}
|
||||
|
||||
public void dismissDialog() {
|
||||
if (mCheckInfoListDialog != null && mCheckInfoListDialog.isShowing()) {
|
||||
mCheckInfoListDialog.dismiss();
|
||||
}
|
||||
}
|
||||
|
||||
public void onDestroy() {
|
||||
mContext = null;
|
||||
mCheckInfoListDialog = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 顶部view列表
|
||||
*/
|
||||
private static class CheckTitleViewHolder extends RecyclerView.ViewHolder {
|
||||
private final ImageView errorImage;
|
||||
private final TextView mTextView;
|
||||
|
||||
public CheckTitleViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
errorImage = itemView.findViewById(R.id.check_tip_image);
|
||||
mTextView = itemView.findViewById(R.id.check_title);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 版本->软件检测
|
||||
*/
|
||||
private static class CheckListViewHolder extends RecyclerView.ViewHolder {
|
||||
private final TextView viewTitle;
|
||||
private TextView iconAutoTitle;
|
||||
private final TextView autoRiskState;
|
||||
private final ImageView iconAuto;
|
||||
|
||||
public CheckListViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
viewTitle = itemView.findViewById(R.id.list_item_title);
|
||||
//自动驾驶
|
||||
iconAuto = itemView.findViewById(R.id.icon_auto);
|
||||
iconAutoTitle = itemView.findViewById(R.id.icon_auto_title);
|
||||
autoRiskState = itemView.findViewById(R.id.auto_risk_state);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
|
||||
if (errorMsg != null) {
|
||||
errorMsgShow(holder, position);
|
||||
}
|
||||
|
||||
if (mCheckResultData == null || mCheckResultData.getData() == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
if (position == 0) {
|
||||
if (mCheckResultData.getData().getVehicle().getState() == 1) {
|
||||
((CheckTitleViewHolder) holder).errorImage.setImageResource(R.drawable.check_right);
|
||||
((CheckTitleViewHolder) holder).mTextView.setText("车辆自检正常");
|
||||
} else {
|
||||
((CheckTitleViewHolder) holder).errorImage.setImageResource(R.drawable.check_wrong);
|
||||
((CheckTitleViewHolder) holder).mTextView.setText("车辆存在异常项");
|
||||
}
|
||||
} else if (position == 1) {
|
||||
((CheckListViewHolder) holder).viewTitle.setText("硬件检测:");
|
||||
if (mCheckResultData.getData().getDeviceState() == 1) {
|
||||
((CheckListViewHolder) holder).autoRiskState.setTextColor(
|
||||
(mContext.getResources().getColor(R.color.check_little_btn_green)));
|
||||
((CheckListViewHolder) holder).autoRiskState.setText("运行正常");
|
||||
} else {
|
||||
((CheckListViewHolder) holder).autoRiskState.setTextColor(
|
||||
(mContext.getResources().getColor(R.color.check_icon_error_color)));
|
||||
((CheckListViewHolder) holder).autoRiskState.setText("存在异常项");
|
||||
}
|
||||
((CheckListViewHolder) holder).iconAuto.setOnClickListener(v -> {
|
||||
if (mCheckInfoListDialog != null) {
|
||||
mCheckInfoListDialog.dismiss();
|
||||
}
|
||||
mCheckInfoListDialog = new CheckInfoListDialog(mContext, CheckItemInfo.CheckInfoStyle.CHECK_INFO_STYLE_DEVICES, mCheckResultData);
|
||||
mCheckInfoListDialog.show();
|
||||
|
||||
});
|
||||
} else if (position == 2) {
|
||||
((CheckListViewHolder) holder).viewTitle.setText("系统检测:");
|
||||
if (mCheckResultData.getData().getSoftState() == 1) {
|
||||
((CheckListViewHolder) holder).autoRiskState.setTextColor(
|
||||
(mContext.getResources().getColor(R.color.check_little_btn_green)));
|
||||
((CheckListViewHolder) holder).autoRiskState.setText("运行正常");
|
||||
} else {
|
||||
((CheckListViewHolder) holder).autoRiskState.setTextColor(
|
||||
(mContext.getResources().getColor(R.color.check_icon_error_color)));
|
||||
((CheckListViewHolder) holder).autoRiskState.setText("存在异常项");
|
||||
}
|
||||
((CheckListViewHolder) holder).iconAuto.setOnClickListener(v -> {
|
||||
if (mCheckInfoListDialog != null) {
|
||||
mCheckInfoListDialog.dismiss();
|
||||
}
|
||||
mCheckInfoListDialog = new CheckInfoListDialog(mContext, CheckItemInfo.CheckInfoStyle.CHECK_INFO_STYLE_SOFT, mCheckResultData);
|
||||
mCheckInfoListDialog.show();
|
||||
});
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void errorMsgShow(@NonNull RecyclerView.ViewHolder holder, int position) {
|
||||
switch (position) {
|
||||
case 0:
|
||||
((CheckTitleViewHolder) holder).mTextView.setText(errorMsg);
|
||||
break;
|
||||
case 1:
|
||||
((CheckListViewHolder) holder).viewTitle.setText("硬件检测:");
|
||||
((CheckListViewHolder) holder).autoRiskState.setText(errorMsg);
|
||||
((CheckListViewHolder) holder).autoRiskState.setTextColor(
|
||||
(mContext.getResources().getColor(R.color.check_icon_error_color)));
|
||||
break;
|
||||
case 2:
|
||||
((CheckListViewHolder) holder).viewTitle.setText("系统检测:");
|
||||
((CheckListViewHolder) holder).autoRiskState.setText(errorMsg);
|
||||
((CheckListViewHolder) holder).autoRiskState.setTextColor(
|
||||
(mContext.getResources().getColor(R.color.check_icon_error_color)));
|
||||
break;
|
||||
default:
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return 3;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,78 +0,0 @@
|
||||
package com.mogo.eagle.core.function.check.view;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.os.Build;
|
||||
import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.mogo.eagle.core.function.call.check.CallerCheckManager;
|
||||
import com.mogo.eagle.core.function.check.R;
|
||||
|
||||
/**
|
||||
* @author liujing
|
||||
* @description 车辆监控弹框提示(长时间未检测或者后台任务检测出现问题的弹框)
|
||||
* 第一版本为添加长时间未检测的提示框,因为逻辑冲突,二期需求与产品确认,UI公用
|
||||
* @since: 7/30/21
|
||||
*/
|
||||
public class CheckDialog extends Dialog {
|
||||
|
||||
private boolean showWarning;
|
||||
private Context mContext;
|
||||
|
||||
public CheckDialog(@NonNull Context context, boolean hasError) {
|
||||
super(context,R.style.CheckInfoDialogStyle);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
getWindow().setType(WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY);
|
||||
} else {
|
||||
getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
|
||||
}
|
||||
getWindow().addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
|
||||
| WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION
|
||||
| WindowManager.LayoutParams.FLAG_LOCAL_FOCUS_MODE);
|
||||
mContext = context;
|
||||
showWarning = hasError;
|
||||
initView();
|
||||
}
|
||||
|
||||
public CheckDialog(@NonNull Context context, int themeResId) {
|
||||
super(context, themeResId);
|
||||
}
|
||||
|
||||
public void initView() {
|
||||
setContentView(R.layout.check_dialog);
|
||||
ImageView cancel = findViewById(R.id.cancel_button);
|
||||
cancel.setOnClickListener(v -> {
|
||||
dismiss();
|
||||
});
|
||||
TextView checkDetail = findViewById(R.id.check_detail);
|
||||
checkDetail.setOnClickListener(v -> {
|
||||
dismiss();
|
||||
if (mContext != null) {
|
||||
CallerCheckManager.startCheckActivity(mContext);
|
||||
}
|
||||
});
|
||||
|
||||
//根据条件显示体检页面/风险提示
|
||||
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() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dismiss() {
|
||||
super.dismiss();
|
||||
}
|
||||
}
|
||||
@@ -1,131 +0,0 @@
|
||||
package com.mogo.eagle.core.function.check.view;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.mogo.eagle.core.function.check.R;
|
||||
import com.mogo.eagle.core.function.check.net.CheckResultData;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author liujing
|
||||
* @description 点击自动驾驶icon显示各个检测指标结果
|
||||
* @since: 9/23/21
|
||||
*/
|
||||
public class CheckInfoAdapter extends RecyclerView.Adapter {
|
||||
LayoutInflater mLayoutInflater;
|
||||
private Context mContext;
|
||||
private String mStyle;
|
||||
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.CheckListItem> checkResultData) {
|
||||
mContext = context;
|
||||
mStyle = style;
|
||||
showData = checkResultData;
|
||||
mLayoutInflater = LayoutInflater.from(context);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
if (viewType == ITEM_TYPE_BOTTOM) {
|
||||
View v = mLayoutInflater.inflate(R.layout.check_recycler_footer, parent,
|
||||
false);
|
||||
CheckInfoAdapter.CheckInfoFooter holder = new CheckInfoAdapter.CheckInfoFooter(v);
|
||||
return holder;
|
||||
}
|
||||
View v = mLayoutInflater.inflate(R.layout.check_info_adapter, parent,
|
||||
false);
|
||||
CheckInfoAdapter.CheckInfoViewHolder holder = new CheckInfoViewHolder(v);
|
||||
return holder;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
|
||||
try {
|
||||
if (holder instanceof CheckInfoAdapter.CheckInfoViewHolder) {
|
||||
if (position < showData.size() * 2) {
|
||||
int index = position / 2;
|
||||
CheckResultData.CheckListItem positionItem = showData.get(index);
|
||||
if (isEven(position)) {//偶数隐藏图片显示检测指标
|
||||
((CheckInfoViewHolder) holder).checkIcon.setVisibility(View.GONE);
|
||||
((CheckInfoViewHolder) holder).mTextView.setText(positionItem.getName());
|
||||
} else {//奇数显示图片和检测指标结果
|
||||
((CheckInfoViewHolder) holder).checkIcon.setVisibility(View.VISIBLE);
|
||||
String state = (String) positionItem.getStateValue();
|
||||
if (state.equals("1")) {
|
||||
((CheckInfoViewHolder) holder).mTextView.setText("正常");
|
||||
((CheckInfoViewHolder) holder).checkIcon.setImageResource(R.drawable.check_right);
|
||||
} else if ((state.equals("0"))) {
|
||||
((CheckInfoViewHolder) holder).mTextView.setText("异常");
|
||||
((CheckInfoViewHolder) holder).checkIcon.setImageResource(R.drawable.check_wrong);
|
||||
} else {
|
||||
((CheckInfoViewHolder) holder).mTextView.setText(state);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public boolean isEven(int position) {
|
||||
if (position % 2 == 0) {
|
||||
System.out.println("偶数");
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
if (isEven(showData.size())) {
|
||||
mBottomCount = 0;
|
||||
} else {
|
||||
mBottomCount = 1;
|
||||
}
|
||||
return showData.size() * 2 + mBottomCount;
|
||||
}
|
||||
|
||||
private static class CheckInfoViewHolder extends RecyclerView.ViewHolder {
|
||||
private final ImageView checkIcon;
|
||||
private final TextView mTextView;
|
||||
|
||||
public CheckInfoViewHolder(View v) {
|
||||
super(v);
|
||||
checkIcon = v.findViewById(R.id.info_check_icon);
|
||||
mTextView = v.findViewById(R.id.info_result_tx);
|
||||
}
|
||||
}
|
||||
|
||||
private static class CheckInfoFooter extends RecyclerView.ViewHolder {
|
||||
public CheckInfoFooter(View v) {
|
||||
super(v);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemViewType(int position) {
|
||||
if (position > showData.size() * 2) {
|
||||
return ITEM_TYPE_BOTTOM;
|
||||
}
|
||||
return ITEM_TYPE_CONTENT;
|
||||
}
|
||||
}
|
||||
@@ -1,160 +0,0 @@
|
||||
package com.mogo.eagle.core.function.check.view;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.graphics.drawable.GradientDrawable;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.recyclerview.widget.StaggeredGridLayoutManager;
|
||||
|
||||
/**
|
||||
* @author liujing
|
||||
* @description 网格布局网格绘制类
|
||||
* @since: 9/22/21
|
||||
*/
|
||||
public class CheckInfoGridItemDivider extends RecyclerView.ItemDecoration {
|
||||
private static final int[] ATTRS = new int[]{android.R.attr.listDivider};
|
||||
private final Drawable divider;
|
||||
|
||||
public CheckInfoGridItemDivider(Context context) {
|
||||
final TypedArray a = context.obtainStyledAttributes(ATTRS);
|
||||
divider = a.getDrawable(0);
|
||||
a.recycle();
|
||||
}
|
||||
|
||||
public CheckInfoGridItemDivider(Drawable drawable) {
|
||||
divider = drawable;
|
||||
}
|
||||
|
||||
public CheckInfoGridItemDivider(int height, int color) {
|
||||
GradientDrawable shapeDrawable = new GradientDrawable();
|
||||
shapeDrawable.setColor(color);
|
||||
shapeDrawable.setShape(GradientDrawable.RECTANGLE);
|
||||
shapeDrawable.setSize(height, height);
|
||||
divider = shapeDrawable;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onDraw(Canvas c, RecyclerView parent, RecyclerView.State state) {
|
||||
drawHorizontal(c, parent);
|
||||
drawVertical(c, parent);
|
||||
|
||||
}
|
||||
|
||||
private int getSpanCount(RecyclerView parent) {
|
||||
// 列数
|
||||
int spanCount = -1;
|
||||
RecyclerView.LayoutManager layoutManager = parent.getLayoutManager();
|
||||
if (layoutManager instanceof GridLayoutManager) {
|
||||
|
||||
spanCount = ((GridLayoutManager) layoutManager).getSpanCount();
|
||||
} else if (layoutManager instanceof StaggeredGridLayoutManager) {
|
||||
spanCount = ((StaggeredGridLayoutManager) layoutManager)
|
||||
.getSpanCount();
|
||||
}
|
||||
return spanCount;
|
||||
}
|
||||
|
||||
public void drawHorizontal(Canvas c, RecyclerView parent) {
|
||||
int childCount = parent.getChildCount(); //获取可见item的数量
|
||||
int spanCount = getSpanCount(parent);
|
||||
for (int i = 0; i < childCount; i++) {
|
||||
final View child = parent.getChildAt(i);
|
||||
final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child
|
||||
.getLayoutParams();
|
||||
final int left = child.getLeft() - params.leftMargin;
|
||||
final int right = child.getRight() + params.rightMargin
|
||||
+ divider.getIntrinsicWidth();
|
||||
final int top = child.getBottom() + params.bottomMargin;
|
||||
final int bottom = top + divider.getIntrinsicHeight();
|
||||
divider.setBounds(left, top, right, bottom);
|
||||
divider.draw(c);
|
||||
if (i < spanCount) { //画第一行顶部的分割线
|
||||
drawHorizontalForFirstRow(c, child);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void drawHorizontalForFirstRow(Canvas c, View child) {
|
||||
final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child
|
||||
.getLayoutParams();
|
||||
int left = child.getLeft() - params.leftMargin - divider.getIntrinsicWidth();
|
||||
int top = child.getTop() - params.topMargin - divider.getIntrinsicHeight();
|
||||
int right = child.getRight() + params.rightMargin + divider.getIntrinsicWidth();
|
||||
int bottom = top + divider.getIntrinsicHeight();
|
||||
divider.setBounds(left, top, right, bottom);
|
||||
divider.draw(c);
|
||||
}
|
||||
|
||||
private void drawVerticalForFirstColum(Canvas c, View child) {
|
||||
final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child
|
||||
.getLayoutParams();//在父布局的
|
||||
int left = child.getLeft() - params.leftMargin - divider.getIntrinsicWidth();
|
||||
int top = child.getTop() - params.topMargin;
|
||||
int right = child.getLeft() - params.leftMargin;
|
||||
int bottom = top + child.getHeight() + divider.getIntrinsicHeight();
|
||||
divider.setBounds(left, top, right, bottom);
|
||||
divider.draw(c);
|
||||
}
|
||||
|
||||
public void drawVertical(Canvas c, RecyclerView parent) {
|
||||
final int childCount = parent.getChildCount();
|
||||
for (int i = 0; i < childCount; i++) {
|
||||
final View child = parent.getChildAt(i);
|
||||
|
||||
final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child
|
||||
.getLayoutParams();
|
||||
final int top = child.getTop() - params.topMargin;
|
||||
final int bottom = child.getBottom() + params.bottomMargin;
|
||||
final int left = child.getRight() + params.rightMargin;
|
||||
final int right = left + divider.getIntrinsicWidth();
|
||||
divider.setBounds(left, top, right, bottom);
|
||||
divider.draw(c);
|
||||
if (isFirstColum(parent, i, getSpanCount(parent))) { //画第一列左边分割线
|
||||
drawVerticalForFirstColum(c, child);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//是否为第一列
|
||||
private boolean isFirstColum(RecyclerView parent, int pos, int spanCount) {
|
||||
RecyclerView.LayoutManager layoutManager = parent.getLayoutManager();
|
||||
if (layoutManager instanceof GridLayoutManager) { //网格布局
|
||||
if ((pos + 1) % spanCount == 1) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//是否为第一行
|
||||
private boolean isFirstRaw(int pos, int spanCount) {
|
||||
return pos < spanCount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getItemOffsets(Rect outRect, int itemPosition,
|
||||
RecyclerView parent) {
|
||||
int spanCount = getSpanCount(parent); //列数
|
||||
|
||||
if (itemPosition == 0) { //第一行第一个,四边都画
|
||||
outRect.set(divider.getIntrinsicWidth(), divider.getIntrinsicHeight(),
|
||||
divider.getIntrinsicWidth(), divider.getIntrinsicHeight());
|
||||
} else if (isFirstRaw(itemPosition, spanCount)) { //第一行,画上下右三边
|
||||
outRect.set(0, divider.getIntrinsicHeight(), divider.getIntrinsicWidth(), divider.getIntrinsicHeight());
|
||||
} else if (isFirstColum(parent, itemPosition, spanCount)) { //第一列,画左右下三边
|
||||
outRect.set(divider.getIntrinsicWidth(), 0, divider.getIntrinsicWidth(), divider.getIntrinsicHeight());
|
||||
} else { //其他,画右下两边
|
||||
outRect.set(0, 0, divider.getIntrinsicWidth(), divider.getIntrinsicHeight());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,124 +0,0 @@
|
||||
package com.mogo.eagle.core.function.check.view;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.os.Build;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
|
||||
import com.mogo.eagle.core.function.check.R;
|
||||
import com.mogo.eagle.core.function.check.model.CheckItemInfo;
|
||||
import com.mogo.eagle.core.function.check.net.CheckResultData;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author liujing
|
||||
* @description 检测指标详情弹框
|
||||
* @since: 9/22/21
|
||||
*/
|
||||
public class CheckInfoListDialog extends Dialog {
|
||||
|
||||
private static final String TAG = "CheckInfoListDialog";
|
||||
private CheckInfoRecyclerView mRecyclerView;
|
||||
private Context mContext;
|
||||
private TextView titleView;
|
||||
private int span;
|
||||
private String mStyle;
|
||||
private CheckResultData mCheckResultData;
|
||||
private final List<CheckResultData.CheckListItem> result = new ArrayList<>();
|
||||
|
||||
public CheckInfoListDialog(@NonNull Context context, String style, CheckResultData checkResultData) {
|
||||
super(context,R.style.CheckInfoDialogStyle);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
getWindow().setType(WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY);
|
||||
} else {
|
||||
getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
|
||||
}
|
||||
getWindow().addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
|
||||
| WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION
|
||||
| WindowManager.LayoutParams.FLAG_LOCAL_FOCUS_MODE);
|
||||
mContext = context;
|
||||
mStyle = style;
|
||||
mCheckResultData = checkResultData;
|
||||
initView();
|
||||
}
|
||||
|
||||
public CheckInfoListDialog(@NonNull Context context, int themeResId) {
|
||||
super(context, themeResId);
|
||||
}
|
||||
|
||||
public void initView() {
|
||||
setContentView(R.layout.check_info_list);
|
||||
mRecyclerView = findViewById(R.id.check_list_recycler);
|
||||
titleView = findViewById(R.id.check_info_title);
|
||||
if (mStyle.equals(CheckItemInfo.CheckInfoStyle.CHECK_INFO_STYLE_DEVICES)) {
|
||||
titleView.setText("硬件自检结果");
|
||||
} else {
|
||||
titleView.setText("系统自检结果");
|
||||
}
|
||||
//网格布局
|
||||
GridLayoutManager layoutManager = new GridLayoutManager(mContext, 4);
|
||||
mRecyclerView.setLayoutManager(layoutManager);
|
||||
layoutManager.setOrientation(GridLayoutManager.VERTICAL);
|
||||
//网格绘制
|
||||
try {
|
||||
CheckInfoGridItemDivider gridLayoutDivider = new CheckInfoGridItemDivider(1,
|
||||
(mContext.getResources().getColor(R.color.check_info_position_line_color)));
|
||||
mRecyclerView.addItemDecoration(gridLayoutDivider);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
List<CheckResultData.CheckListItem> resultData = showInfoResult();
|
||||
CheckInfoAdapter adapter = new CheckInfoAdapter(mContext, mStyle, resultData);
|
||||
mRecyclerView.setAdapter(adapter);
|
||||
//关闭按钮
|
||||
findViewById(R.id.cancel_info_list_button).setOnClickListener(v -> {
|
||||
dismiss();
|
||||
});
|
||||
}
|
||||
|
||||
public List<CheckResultData.CheckListItem> showInfoResult() {
|
||||
|
||||
if (result.size() > 0) {
|
||||
result.clear();
|
||||
}
|
||||
try {
|
||||
List<CheckResultData.CheckListItem> checkListResult = new ArrayList<CheckResultData.CheckListItem>();
|
||||
try {
|
||||
if (mStyle.equals(CheckItemInfo.CheckInfoStyle.CHECK_INFO_STYLE_DEVICES)) {
|
||||
checkListResult = mCheckResultData.getData().getDevices();
|
||||
} else {
|
||||
checkListResult = mCheckResultData.getData().getSoft();
|
||||
}
|
||||
for (CheckResultData.CheckListItem item : checkListResult) {
|
||||
if (item.getStateValue() != null) {
|
||||
result.addAll(checkListResult);
|
||||
}
|
||||
if (item.getItems() != null) {
|
||||
result.addAll(item.getItems());
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public void cancel() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dismiss() {
|
||||
super.dismiss();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
package com.mogo.eagle.core.function.check.view;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.mogo.eagle.core.function.check.R;
|
||||
|
||||
/**
|
||||
* @author liujing
|
||||
* @description 列表自适应高+限高
|
||||
* @since: 9/29/21
|
||||
*/
|
||||
public class CheckInfoRecyclerView extends RecyclerView {
|
||||
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);
|
||||
}
|
||||
|
||||
public CheckInfoRecyclerView(@NonNull Context context, @Nullable AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
public CheckInfoRecyclerView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onMeasure(int widthSpec, int heightSpec) {
|
||||
super.onMeasure(widthSpec, heightSpec);
|
||||
int limitHeight = getMeasuredHeight();
|
||||
if (getMeasuredHeight() > maxHeight) {
|
||||
limitHeight = maxHeight;
|
||||
}
|
||||
setMeasuredDimension(maxWeight, limitHeight);
|
||||
}
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
package com.mogo.eagle.core.function.check.view;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
|
||||
/**
|
||||
* @author liujing
|
||||
* @description 描述
|
||||
* @since: 7/27/21
|
||||
*/
|
||||
class CheckLinearLayout extends LinearLayoutManager {
|
||||
public CheckLinearLayout(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public CheckLinearLayout(Context context, int orientation, boolean reverseLayout) {
|
||||
super(context, orientation, reverseLayout);
|
||||
}
|
||||
|
||||
public CheckLinearLayout(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
|
||||
super(context, attrs, defStyleAttr, defStyleRes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLayoutChildren(RecyclerView.Recycler recycler, RecyclerView.State state) {
|
||||
try {
|
||||
super.onLayoutChildren(recycler, state);
|
||||
} catch (IndexOutOfBoundsException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,57 +0,0 @@
|
||||
package com.mogo.eagle.core.function.check.view;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Rect;
|
||||
import android.util.AttributeSet;
|
||||
|
||||
import androidx.appcompat.widget.AppCompatImageView;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @author donghongyu
|
||||
* @date 2019-08-22
|
||||
*/
|
||||
public class ImageViewClipBounds extends AppCompatImageView {
|
||||
Rect mClipBounds = null;
|
||||
|
||||
public ImageViewClipBounds(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public ImageViewClipBounds(Context context, AttributeSet attrs) {
|
||||
this(context, attrs, 0);
|
||||
}
|
||||
|
||||
public ImageViewClipBounds(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDraw(Canvas canvas) {
|
||||
if (mClipBounds != null) {
|
||||
// clip bounds ignore scroll
|
||||
canvas.clipRect(mClipBounds);
|
||||
}
|
||||
super.onDraw(canvas);
|
||||
}
|
||||
|
||||
public void setClip(Rect clipBounds) {
|
||||
if (Objects.equals(clipBounds, mClipBounds)) {
|
||||
return;
|
||||
}
|
||||
if (clipBounds != null) {
|
||||
if (mClipBounds == null) {
|
||||
mClipBounds = new Rect(clipBounds);
|
||||
} else {
|
||||
mClipBounds.set(clipBounds);
|
||||
}
|
||||
} else {
|
||||
mClipBounds = null;
|
||||
}
|
||||
invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 3.3 KiB |
|
Before Width: | Height: | Size: 4.7 KiB |
@@ -1,10 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<corners android:radius="6dp" />
|
||||
|
||||
<gradient
|
||||
android:angle="180"
|
||||
android:endColor="#2B6EFF"
|
||||
android:startColor="#3DCCFF" />
|
||||
</shape>
|
||||
@@ -1,18 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<shape>
|
||||
<solid android:color="@color/check_info_position_line_color" />
|
||||
</shape>
|
||||
</item>
|
||||
<item
|
||||
android:left="@dimen/dp_3"
|
||||
android:right="@dimen/dp_1"
|
||||
android:top="@dimen/dp_3"
|
||||
android:bottom="@dimen/dp_1">
|
||||
<shape>
|
||||
<solid android:color="@color/check_info_title_back" />
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
</layer-list>
|
||||
@@ -1,11 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<corners android:radius="@dimen/dp_30" />
|
||||
<gradient
|
||||
android:angle="180"
|
||||
android:endColor="@color/check_list_item_back"
|
||||
android:startColor="@color/check_list_item_back"
|
||||
android:type="linear" />
|
||||
|
||||
</shape>
|
||||
@@ -1,14 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<size
|
||||
android:width="@dimen/check_little_btn_width"
|
||||
android:height="@dimen/check_little_btn_width" />
|
||||
//填充
|
||||
<solid android:color="@color/check_little_btn_solid" />
|
||||
//描边
|
||||
<stroke
|
||||
android:width="2dp"
|
||||
android:color="@color/check_little_btn" />
|
||||
|
||||
</shape>
|
||||
@@ -1,14 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<size
|
||||
android:width="@dimen/check_little_btn_width"
|
||||
android:height="@dimen/check_little_btn_width" />
|
||||
//填充
|
||||
<solid android:color="@color/check_little_btn_solid_green" />
|
||||
//描边
|
||||
<stroke
|
||||
android:width="2dp"
|
||||
android:color="@color/check_little_btn_green" />
|
||||
|
||||
</shape>
|
||||
@@ -1,29 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:id="@android:id/background">
|
||||
<shape>
|
||||
<corners android:radius="@dimen/dp_33" />
|
||||
<solid android:color="#0B1030" />
|
||||
</shape>
|
||||
</item>
|
||||
<item android:id="@android:id/progress">
|
||||
<scale android:scaleWidth="100%">
|
||||
<shape>
|
||||
<corners android:radius="@dimen/dp_33" />
|
||||
<solid android:color="#3DCCFF" />
|
||||
<gradient
|
||||
android:angle="180"
|
||||
android:endColor="#2B6EFF"
|
||||
android:startColor="#3DCCFF" />
|
||||
</shape>
|
||||
</scale>
|
||||
</item>
|
||||
<item android:id="@android:id/secondaryProgress">
|
||||
<scale android:scaleWidth="100%">
|
||||
<shape>
|
||||
<corners android:radius="@dimen/dp_33" />
|
||||
<solid android:color="#0B1030" />
|
||||
</shape>
|
||||
</scale>
|
||||
</item>
|
||||
</layer-list>
|
||||
@@ -1,11 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<stroke
|
||||
android:width="3dp"
|
||||
android:color="@color/check_info_shape_color" />
|
||||
<padding
|
||||
android:bottom="2dp"
|
||||
android:left="2dp"
|
||||
android:right="2dp"
|
||||
android:top="0dp" />
|
||||
</shape>
|
||||
|
Before Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 362 KiB |
|
Before Width: | Height: | Size: 379 KiB |
|
Before Width: | Height: | Size: 65 KiB |
|
Before Width: | Height: | Size: 347 KiB |
@@ -1,18 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<shape>
|
||||
<solid android:color="@color/check_info_position_line_color" />
|
||||
</shape>
|
||||
</item>
|
||||
<item
|
||||
android:left="@dimen/dp_2"
|
||||
android:right="0dp"
|
||||
android:top="0dp"
|
||||
android:bottom="0dp">
|
||||
<shape>
|
||||
<solid android:color="@color/check_info_title_back" />
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
</layer-list>
|
||||
@@ -1,13 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item
|
||||
android:bottom="0dp"
|
||||
android:left="0dp"
|
||||
android:right="0dp"
|
||||
android:top="0dp">
|
||||
<shape>
|
||||
<solid android:color="@color/check_info_title_back" />
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
</layer-list>
|
||||
@@ -1,11 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<stroke
|
||||
android:width="3dp"
|
||||
android:color="@color/check_info_shape_color" />
|
||||
<padding
|
||||
android:bottom="0dp"
|
||||
android:left="2dp"
|
||||
android:right="2dp"
|
||||
android:top="2dp" />
|
||||
</shape>
|
||||
|
Before Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 4.2 KiB |
|
Before Width: | Height: | Size: 6.2 KiB |
|
Before Width: | Height: | Size: 5.4 KiB |
|
Before Width: | Height: | Size: 4.7 KiB |
|
Before Width: | Height: | Size: 5.5 KiB |
|
Before Width: | Height: | Size: 4.5 KiB |
|
Before Width: | Height: | Size: 5.6 KiB |
|
Before Width: | Height: | Size: 5.3 KiB |
|
Before Width: | Height: | Size: 4.0 KiB |
|
Before Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 16 KiB |
@@ -1,105 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/blue_back_color"
|
||||
tools:context="com.mogo.eagle.core.function.check.view.CheckActivity">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/check_list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/btnBack"
|
||||
android:layout_width="@dimen/dp_106"
|
||||
android:layout_height="@dimen/dp_106"
|
||||
android:layout_marginLeft="@dimen/dp_50"
|
||||
android:layout_marginTop="@dimen/dp_50"
|
||||
android:src="@drawable/dark_clore_close"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/animationLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/blue_back_color">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/scan_car_image"
|
||||
android:layout_width="@dimen/check_scan_width"
|
||||
android:layout_height="@dimen/check_scan_height"
|
||||
android:layout_marginTop="@dimen/dp_400"
|
||||
android:src="@drawable/check_scan_first"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<com.mogo.eagle.core.function.check.view.ImageViewClipBounds
|
||||
android:id="@+id/scan_car_top_image"
|
||||
android:layout_width="@dimen/check_scan_width"
|
||||
android:layout_height="@dimen/check_scan_height"
|
||||
android:scaleType="fitXY"
|
||||
android:src="@drawable/check_scan_second"
|
||||
android:visibility="invisible"
|
||||
app:layout_constraintLeft_toLeftOf="@id/scan_car_image"
|
||||
app:layout_constraintTop_toTopOf="@id/scan_car_image" />
|
||||
|
||||
|
||||
<com.mogo.eagle.core.function.check.view.ImageViewClipBounds
|
||||
android:id="@+id/scan_car_tips"
|
||||
android:layout_width="@dimen/check_scan_width"
|
||||
android:layout_height="@dimen/check_scan_height"
|
||||
android:layout_marginLeft="@dimen/dp_699"
|
||||
android:layout_marginTop="@dimen/dp_400"
|
||||
android:layout_marginRight="@dimen/dp_699"
|
||||
android:scaleType="fitEnd"
|
||||
android:src="@drawable/check_scan_tips"
|
||||
android:visibility="invisible"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/check_progress_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_120"
|
||||
android:text="自动驾驶车辆体检中,请稍候……"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="@dimen/dp_42"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/scan_car_image" />
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/check_progress"
|
||||
style="@style/check_progressBar_scale"
|
||||
android:layout_width="@dimen/dp_520"
|
||||
android:layout_height="@dimen/dp_12"
|
||||
android:layout_marginTop="@dimen/dp_57"
|
||||
android:max="100"
|
||||
android:progress="0"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/check_progress_text" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/scan_line_image"
|
||||
android:layout_width="@dimen/dp_25"
|
||||
android:layout_height="@dimen/dp_652"
|
||||
android:layout_marginTop="@dimen/dp_370"
|
||||
android:src="@drawable/scan_tip_line"
|
||||
app:layout_constraintLeft_toLeftOf="@id/scan_car_image"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -1,121 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="1529dp"
|
||||
android:layout_height="720dp"
|
||||
android:layout_gravity="center"
|
||||
android:background="@drawable/check_dialog_back">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/cancel_button"
|
||||
android:layout_width="@dimen/dp_106"
|
||||
android:layout_height="@dimen/dp_106"
|
||||
android:layout_marginLeft="@dimen/dp_30"
|
||||
android:layout_marginTop="@dimen/dp_30"
|
||||
android:src="@drawable/dark_clore_close"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView"
|
||||
android:layout_width="@dimen/dp_795"
|
||||
android:layout_height="@dimen/dp_484"
|
||||
android:layout_marginEnd="@dimen/dp_50"
|
||||
android:layout_marginBottom="@dimen/dp_78"
|
||||
android:src="@drawable/check_tip_image"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/error_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_97"
|
||||
android:layout_marginTop="@dimen/dp_225"
|
||||
android:visibility="visible"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/error_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="自动驾驶车辆存在风险"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="@dimen/dp_54"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintStart_toStartOf="@id/error_view"
|
||||
app:layout_constraintTop_toTopOf="@id/error_view" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/error_image"
|
||||
android:layout_width="@dimen/dp_56"
|
||||
android:layout_height="@dimen/dp_56"
|
||||
android:layout_marginTop="@dimen/dp_25"
|
||||
android:src="@drawable/check_wrong"
|
||||
app:layout_constraintTop_toBottomOf="@id/error_title"
|
||||
tools:ignore="MissingConstraints" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/error_txt"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_26"
|
||||
android:layout_marginTop="@dimen/dp_23"
|
||||
android:text="软件运行异常"
|
||||
android:textColor="@color/check_tip_error_color"
|
||||
android:textSize="@dimen/dp_38"
|
||||
app:layout_constraintLeft_toRightOf="@+id/error_image"
|
||||
app:layout_constraintTop_toBottomOf="@id/error_title" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/check_detail"
|
||||
android:layout_width="@dimen/dp_287"
|
||||
android:layout_height="@dimen/dp_100"
|
||||
android:layout_marginTop="@dimen/dp_70"
|
||||
android:background="@drawable/check_detail"
|
||||
android:gravity="center"
|
||||
android:text="查看详情"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="@dimen/check_button_text_size"
|
||||
app:layout_constraintTop_toBottomOf="@id/error_image"
|
||||
tools:ignore="MissingConstraints" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/check_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_133"
|
||||
android:layout_marginTop="@dimen/dp_200"
|
||||
android:visibility="invisible"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/check_text_view"
|
||||
android:layout_width="@dimen/dp_520"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="您的自动驾驶系统已经很久没有进行体检了,建议立即体检。"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="@dimen/dp_44"
|
||||
tools:ignore="MissingConstraints" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/check_button"
|
||||
android:layout_width="@dimen/dp_287"
|
||||
android:layout_height="@dimen/dp_100"
|
||||
android:layout_marginTop="@dimen/dp_70"
|
||||
android:background="@drawable/check_button"
|
||||
android:gravity="center"
|
||||
android:text="立即体检"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="@dimen/check_button_text_size"
|
||||
app:layout_constraintTop_toBottomOf="@id/check_text_view"
|
||||
tools:ignore="MissingConstraints" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -1,314 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginStart="@dimen/dp_100"
|
||||
android:layout_marginTop="@dimen/dp_15"
|
||||
android:layout_marginEnd="@dimen/dp_100"
|
||||
android:layout_marginBottom="@dimen/dp_15"
|
||||
android:background="@drawable/check_list_item_back">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_50"
|
||||
android:layout_marginTop="@dimen/dp_50"
|
||||
android:gravity="left"
|
||||
android:text="硬件检测:"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="@dimen/dp_42"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_goneMarginTop="@dimen/dp_50" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/description"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_50"
|
||||
android:text="(下面 1 项存在异常)"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="@dimen/dp_42"
|
||||
app:layout_constraintLeft_toRightOf="@+id/title"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<!--角激光文字-->
|
||||
<TextView
|
||||
android:id="@+id/jiaoJiGuangTop_txt"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_above="@+id/check_image"
|
||||
android:layout_marginStart="@dimen/dp_1000"
|
||||
android:layout_marginTop="@dimen/dp_236"
|
||||
android:gravity="center"
|
||||
android:text="角激光"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="@dimen/dp_42"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
<!--车辆模型-->
|
||||
<RelativeLayout
|
||||
android:id="@+id/check_image"
|
||||
android:layout_width="@dimen/check_hard_ware_image_width"
|
||||
android:layout_height="@dimen/check_hard_ware_image_height"
|
||||
android:layout_marginLeft="@dimen/dp_460"
|
||||
android:layout_marginTop="144dp"
|
||||
android:background="@drawable/check_scan_first"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
<!--Pad-->
|
||||
<ImageView
|
||||
android:id="@+id/pad"
|
||||
android:layout_width="@dimen/dp_95"
|
||||
android:layout_height="@dimen/dp_145"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginStart="@dimen/dp_292"
|
||||
android:src="@drawable/pad_unusual" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/pad_txt"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignStart="@+id/pad"
|
||||
android:layout_alignEnd="@+id/pad"
|
||||
android:layout_centerVertical="true"
|
||||
android:gravity="center"
|
||||
android:text="Pad"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="@dimen/dp_42" />
|
||||
<!--前摄像头3-->
|
||||
<TextView
|
||||
android:id="@+id/camera_front_txt"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_above="@+id/camera"
|
||||
android:layout_marginStart="@dimen/dp_434"
|
||||
android:layout_marginBottom="@dimen/dp_42"
|
||||
android:gravity="center"
|
||||
android:text="摄像头"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="@dimen/dp_42" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/camera"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginStart="@dimen/dp_65"
|
||||
android:layout_toEndOf="@+id/pad"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/top"
|
||||
android:layout_width="@dimen/dp_56"
|
||||
android:layout_height="@dimen/dp_56"
|
||||
android:src="@drawable/camera_usual" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/middle"
|
||||
android:layout_width="@dimen/dp_56"
|
||||
android:layout_height="@dimen/dp_56"
|
||||
android:layout_marginTop="@dimen/dp_10"
|
||||
android:src="@drawable/camera_usual" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/bottom"
|
||||
android:layout_width="@dimen/dp_56"
|
||||
android:layout_height="@dimen/dp_56"
|
||||
android:layout_marginTop="@dimen/dp_10"
|
||||
android:src="@drawable/camera_usual" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<!--角激光-->
|
||||
<ImageView
|
||||
android:id="@+id/jiaoJiGuangTop"
|
||||
android:layout_width="@dimen/dp_70"
|
||||
android:layout_height="@dimen/dp_70"
|
||||
android:layout_marginLeft="@dimen/dp_57"
|
||||
android:layout_marginTop="@dimen/dp_100"
|
||||
android:layout_toEndOf="@+id/camera"
|
||||
android:src="@drawable/zhujiguang_usual" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/jiaoJiGuangBottom"
|
||||
android:layout_width="@dimen/dp_70"
|
||||
android:layout_height="@dimen/dp_70"
|
||||
android:layout_alignTop="@+id/jiaoJiGuangTop"
|
||||
android:layout_marginLeft="@dimen/dp_57"
|
||||
android:layout_marginTop="@dimen/dp_440"
|
||||
android:layout_toEndOf="@+id/camera"
|
||||
android:src="@drawable/zhujiguang_usual" />
|
||||
<!--主激光-->
|
||||
<ImageView
|
||||
android:id="@+id/zhujiguang"
|
||||
android:layout_width="@dimen/dp_140"
|
||||
android:layout_height="@dimen/dp_140"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginLeft="@dimen/dp_77"
|
||||
android:layout_toEndOf="@+id/camera"
|
||||
android:src="@drawable/zhujiguang_usual" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/zhujiguang_txt"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignStart="@+id/zhujiguang"
|
||||
android:layout_alignEnd="@+id/zhujiguang"
|
||||
android:layout_centerVertical="true"
|
||||
android:gravity="center"
|
||||
android:text="主激光"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="@dimen/dp_42" />
|
||||
<!--RTK-->
|
||||
<ImageView
|
||||
android:id="@+id/rtk"
|
||||
android:layout_width="@dimen/dp_140"
|
||||
android:layout_height="@dimen/dp_80"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginLeft="@dimen/dp_48"
|
||||
android:layout_toEndOf="@+id/zhujiguang"
|
||||
android:src="@drawable/rtk_usual" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/rtk_txt"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignStart="@+id/rtk"
|
||||
android:layout_alignEnd="@+id/rtk"
|
||||
android:layout_centerVertical="true"
|
||||
android:gravity="center"
|
||||
android:text="RTK"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="@dimen/dp_42" />
|
||||
<!--摄像头-后1-->
|
||||
<ImageView
|
||||
android:id="@+id/camera_begind"
|
||||
android:layout_width="@dimen/dp_56"
|
||||
android:layout_height="@dimen/dp_56"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginStart="@dimen/dp_78"
|
||||
android:layout_toEndOf="@+id/rtk"
|
||||
android:src="@drawable/camera_usual" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/camera_begind_txt"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_above="@+id/camera_begind"
|
||||
android:layout_marginStart="@dimen/dp_972"
|
||||
android:layout_marginBottom="@dimen/dp_42"
|
||||
android:gravity="center"
|
||||
android:text="摄像头"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="@dimen/dp_42" />
|
||||
<!--路由器-->
|
||||
<ImageView
|
||||
android:id="@+id/luyouqi"
|
||||
android:layout_width="@dimen/dp_77"
|
||||
android:layout_height="@dimen/dp_90"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginStart="@dimen/dp_38"
|
||||
android:layout_toEndOf="@+id/camera_begind"
|
||||
android:src="@drawable/luyouqi_usual" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/luyouqi_txt"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/luyouqi"
|
||||
android:layout_marginStart="@dimen/check_luyouqi_start"
|
||||
android:layout_marginTop="@dimen/dp_42"
|
||||
android:gravity="center"
|
||||
android:text="路由器"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="@dimen/dp_42" />
|
||||
|
||||
<!--OBU-->
|
||||
<ImageView
|
||||
android:id="@+id/obu"
|
||||
android:layout_width="@dimen/dp_140"
|
||||
android:layout_height="@dimen/dp_80"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginStart="@dimen/dp_15"
|
||||
android:layout_marginTop="@dimen/dp_140"
|
||||
android:layout_toEndOf="@+id/luyouqi"
|
||||
android:src="@drawable/obu_unusual" />
|
||||
|
||||
</RelativeLayout>
|
||||
<!--角激光文字-->
|
||||
<TextView
|
||||
android:id="@+id/jiaoJiGuangBottom_txt"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/check_image"
|
||||
android:layout_marginStart="@dimen/dp_1000"
|
||||
android:gravity="center"
|
||||
android:text="角激光"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="@dimen/dp_42"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/check_image" />
|
||||
<!--OBU文案-->
|
||||
<TextView
|
||||
android:id="@+id/obu_top_txt"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_above="@+id/check_image"
|
||||
android:layout_marginStart="@dimen/check_obu_start"
|
||||
android:layout_marginTop="@dimen/dp_236"
|
||||
android:gravity="center"
|
||||
android:text="OBU"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="@dimen/dp_42"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/error_tip"
|
||||
android:layout_width="@dimen/dp_42"
|
||||
android:layout_height="@dimen/dp_42"
|
||||
android:layout_marginLeft="@dimen/dp_907"
|
||||
android:layout_marginTop="@dimen/dp_177"
|
||||
android:background="@drawable/check_little_btn"
|
||||
android:backgroundTint="@color/check_tip_error_color"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/check_image" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/unusual_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/dp_24"
|
||||
android:text="设备故障"
|
||||
android:textColor="@android:color/white"
|
||||
app:layout_constraintLeft_toRightOf="@+id/error_tip"
|
||||
app:layout_constraintTop_toTopOf="@+id/error_tip" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/error_tip_green"
|
||||
android:layout_width="@dimen/dp_42"
|
||||
android:layout_height="@dimen/dp_42"
|
||||
android:layout_marginLeft="@dimen/dp_160"
|
||||
android:layout_marginTop="88dp"
|
||||
android:background="@drawable/check_little_btn_green"
|
||||
app:layout_constraintLeft_toRightOf="@id/unusual_title"
|
||||
app:layout_constraintTop_toBottomOf="@+id/check_image" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/usual_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/dp_24"
|
||||
android:text="设备正常"
|
||||
android:textColor="@android:color/white"
|
||||
app:layout_constraintLeft_toRightOf="@+id/error_tip_green"
|
||||
app:layout_constraintTop_toTopOf="@+id/error_tip_green" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -1,38 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="@dimen/dp_405"
|
||||
android:layout_height="@dimen/dp_127"
|
||||
android:layout_gravity="left">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="@dimen/dp_38"
|
||||
android:layout_marginRight="@dimen/dp_10"
|
||||
android:gravity="left"
|
||||
android:paddingRight="@dimen/dp_25"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/info_check_icon"
|
||||
android:layout_width="@dimen/dp_40"
|
||||
android:layout_height="@dimen/dp_40"
|
||||
android:layout_marginRight="@dimen/dp_24"
|
||||
android:layout_gravity="center" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/info_result_tx"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="end"
|
||||
android:gravity="left"
|
||||
android:maxLines="2"
|
||||
android:textColor="#fff"
|
||||
android:textSize="@dimen/dp_38"
|
||||
app:layout_constraintLeft_toRightOf="@+id/info_check_icon" />
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -1,78 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="1900dp"
|
||||
android:layout_height="1140dp"
|
||||
android:layout_gravity="center"
|
||||
android:background="@drawable/check_dialog_back">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/cancel_info_list_button"
|
||||
android:layout_width="@dimen/dp_106"
|
||||
android:layout_height="@dimen/dp_106"
|
||||
android:layout_marginLeft="@dimen/dp_30"
|
||||
android:layout_marginTop="@dimen/dp_30"
|
||||
android:src="@drawable/dark_clore_close"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/check_info_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_70"
|
||||
android:gravity="center"
|
||||
android:text="自检结果"
|
||||
android:textColor="#fff"
|
||||
android:textSize="@dimen/dp_42"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<include
|
||||
android:id="@+id/check_title_item"
|
||||
layout="@layout/check_info_title_item"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_127"
|
||||
android:layout_marginLeft="@dimen/dp_143"
|
||||
android:layout_marginTop="@dimen/dp_66"
|
||||
android:layout_marginRight="@dimen/dp_143"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/check_info_title"></include>
|
||||
|
||||
<View
|
||||
android:id="@+id/line_top"
|
||||
android:layout_width="3dp"
|
||||
android:layout_height="@dimen/dp_127"
|
||||
android:layout_marginTop="@dimen/dp_66"
|
||||
android:background="@color/check_info_shape_color"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/check_list_recycler"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/check_info_title"
|
||||
app:layout_constraintVertical_bias="0.0" />
|
||||
|
||||
<com.mogo.eagle.core.function.check.view.CheckInfoRecyclerView
|
||||
android:id="@+id/check_list_recycler"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/dp_143"
|
||||
android:layout_marginRight="@dimen/dp_143"
|
||||
android:layout_marginBottom="@dimen/dp_80"
|
||||
android:background="@drawable/check_recycler_shape"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/check_title_item" />
|
||||
|
||||
<View
|
||||
android:layout_width="3dp"
|
||||
android:layout_height="0dp"
|
||||
android:background="@color/check_info_shape_color"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/check_list_recycler"
|
||||
app:layout_constraintEnd_toEndOf="@id/check_list_recycler"
|
||||
app:layout_constraintStart_toStartOf="@id/check_list_recycler"
|
||||
app:layout_constraintTop_toTopOf="@id/check_list_recycler" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||