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
#	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
#	core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/TrafficDataView.java
This commit is contained in:
bxb
2023-03-01 09:35:07 +08:00
207 changed files with 4556 additions and 1509 deletions

View File

@@ -56,6 +56,7 @@ import org.greenrobot.eventbus.EventBus;
import java.util.Objects;
import bag_manager.BagManagerOuterClass;
import mogo.telematics.pad.MessagePad;
import record_cache.RecordPanelOuterClass;
@@ -320,6 +321,10 @@ public abstract class BaseBusTabFragment<V extends IView, P extends Presenter<V>
public void onAutopilotRecordConfig(@NonNull MessagePad.RecordDataConfig config) {
}
@Override
public void onBagManagerResult(@NonNull BagManagerOuterClass.BagManager bagManager) {
}
/**
* 测试到站
*/
@@ -428,8 +433,6 @@ public abstract class BaseBusTabFragment<V extends IView, P extends Presenter<V>
}
private void changeAutopilotBtnView(int autopilotStatus, boolean isAnimateRunning) {
CallerLogger.INSTANCE.d(M_BUS + TAG, "onStateChangeChangeAutopilotBtnView: "
+ autopilotStatus + "isAnimateRunning = " + isAnimateRunning);
if (isAnimateRunning && IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING
!= autopilotStatus) {
// 主动开启自动驾驶中不为2为0、1则继续loading

View File

@@ -71,6 +71,4 @@ dependencies {
api project(':core:function-impl:mogo-core-function-map')
}
compileOnly project(':libraries:mogo-adas')
}

View File

@@ -2,7 +2,6 @@ package com.mogo.och.common.module.manager
import android.Manifest
import android.content.Context
import com.mogo.commons.debug.DebugConfig
import com.mogo.commons.module.status.IMogoStatusChangedListener
import com.mogo.commons.module.status.MogoStatusManager
import com.mogo.commons.module.status.StatusDescriptor
@@ -17,6 +16,7 @@ import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.disposables.Disposable
import io.reactivex.schedulers.Schedulers
import java.util.concurrent.TimeUnit
import kotlin.properties.Delegates
/**
* @author: wangmingjun
@@ -26,26 +26,40 @@ object AbnormalFactorsLoopManager : IMogoStatusChangedListener {
const val TAG = "AbnormalFactorsLoopManager"
private const val LOOP_TIME = 10 *1000L
private const val LOOP_TIME = 10 * 1000L
private const val LOOP_DELAY = 5 * 1000L
private var socketStatus: Boolean = false
private var socketStatus by Delegates.observable(false) { _, _, newValue ->
if (AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)) {
return@observable
}
if (FunctionBuildConfig.isDemoMode) {
return@observable
}
if (newValue) {
ToastUtils.showLong("长链接状态恢复")
} else {
ToastUtils.showLong("长链接异常,请开启相应权限或者查看网络")
}
}
private var looperDisposable : Disposable? = null
private var looperDisposable: Disposable? = null
fun startLoopAbnormalFactors(context: Context){
if (looperDisposable != null && !looperDisposable!!.isDisposed){
fun startLoopAbnormalFactors(context: Context) {
if (looperDisposable != null && !looperDisposable!!.isDisposed) {
return
}
i(TAG, "startLoopAbnormalFactors()")
looperDisposable = Observable.interval(LOOP_DELAY, LOOP_TIME, TimeUnit.MILLISECONDS)
.map { aLong -> aLong+1 }
.map { aLong -> aLong + 1 }
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe{ aLong -> checkAbnormalFactors(context)}
.subscribe { aLong -> checkAbnormalFactors(context) }
//长链接监听
MogoStatusManager.getInstance().registerStatusChangedListener(TAG,
StatusDescriptor.CLOUD_SOCKET,this)
MogoStatusManager.getInstance().registerStatusChangedListener(
TAG,
StatusDescriptor.CLOUD_SOCKET, this
)
}
private fun checkAbnormalFactors(context: Context) {
@@ -54,14 +68,15 @@ object AbnormalFactorsLoopManager : IMogoStatusChangedListener {
var networkStatus = false
//定位权限
locationStatusPermsStatus = !(!PermissionUtil.isLocServiceEnable(context) || !PermissionUtil.checkPermission(
context, *arrayOf(
Manifest.permission.ACCESS_FINE_LOCATION
)
))
locationStatusPermsStatus =
!(!PermissionUtil.isLocServiceEnable(context) || !PermissionUtil.checkPermission(
context, *arrayOf(
Manifest.permission.ACCESS_FINE_LOCATION
)
))
//网络状态或者网络权限是否打开
if (NetworkUtils.isConnected(context)){
if (NetworkUtils.isConnected(context)) {
networkStatus = true
}
//长链接状态 socketStatus
@@ -70,28 +85,27 @@ object AbnormalFactorsLoopManager : IMogoStatusChangedListener {
if (!locationStatusPermsStatus) toastStr += "定位服务异常 "
if (!networkStatus) toastStr += " 网络异常 "
//乘客屏不显示长链接异常
if (!socketStatus && !AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)) toastStr += " 长链接异常 "
i(TAG, "abnormal_factors_Str = $toastStr")
if (!FunctionBuildConfig.isDemoMode && toastStr !== ""){
if (!FunctionBuildConfig.isDemoMode && toastStr !== "") {
ToastUtils.showLong(toastStr + "请开启相应权限或者查看网络")
}
}
fun stopLoopAbnormalFactors(){
fun stopLoopAbnormalFactors() {
looperDisposable!!.dispose()
looperDisposable == null
MogoStatusManager.getInstance().unregisterStatusChangedListener(TAG,
StatusDescriptor.CLOUD_SOCKET,this)
MogoStatusManager.getInstance().unregisterStatusChangedListener(
TAG,
StatusDescriptor.CLOUD_SOCKET, this
)
}
override fun onStatusChanged(descriptor: StatusDescriptor?, isTrue: Boolean) {
//长链接监听、
if (StatusDescriptor.CLOUD_SOCKET == descriptor){
if (StatusDescriptor.CLOUD_SOCKET == descriptor) {
socketStatus = isTrue
}
}

View File

@@ -46,6 +46,9 @@ import java.util.List;
import androidx.annotation.NonNull;
import androidx.constraintlayout.widget.Group;
import androidx.fragment.app.FragmentTransaction;
import bag_manager.BagManagerOuterClass;
import mogo.telematics.pad.MessagePad;
import record_cache.RecordPanelOuterClass;
/**
* 网约车基础Fragment主要负责布局通用界面处理站点面板和通话面板互斥情况
@@ -222,6 +225,26 @@ public abstract class BaseSweeperTabFragment<V extends IView, P extends Presente
CallerAutopilotRecordListenerManager.INSTANCE.removeListener(TAG);
}
@Override
public void onAutopilotRecordResult(@Nullable RecordPanelOuterClass.RecordPanel recordPanel) {
// if (!HmiBuildConfig.isShowBadCaseView && recordPanel != null && recordPanel.getType() == 1 && recordPanel.getStat() == 100) {
// CallerDevaToolsManager.INSTANCE.onReceiveBadCaseRecord(recordPanel);
// }
}
@Override
public void onAutopilotRecordConfig(@NonNull MessagePad.RecordDataConfig config) {
}
@Override
public void onBagManagerResult(@NonNull BagManagerOuterClass.BagManager bagManager) {
}
/**
* 测试到站
*/
protected abstract void debugArrivedStation();
private void initListener() {
MogoMapListenerHandler.Companion.getMogoMapListenerHandler().registerHostMapListener(TAG, this);
mCloseNavIcon.setOnClickListener(this);

View File

@@ -53,6 +53,7 @@ import com.mogo.och.taxi.R;
import java.util.Arrays;
import java.util.Objects;
import bag_manager.BagManagerOuterClass;
import mogo.telematics.pad.MessagePad;
import record_cache.RecordPanelOuterClass;
@@ -386,6 +387,10 @@ public abstract class BaseTaxiTabFragment<V extends IView, P extends Presenter<V
public void onAutopilotRecordConfig(@NonNull MessagePad.RecordDataConfig config) {
}
@Override
public void onBagManagerResult(@NonNull BagManagerOuterClass.BagManager bagManager) {
}
/**
* 改变自动驾驶状态
*

View File

@@ -38,3 +38,15 @@
3. demo: 演示环境(大部分时候都是测试环境)
## 区分 flavor 功能引入
## 不能启动自动驾驶的档位
| 车型 | 配置所在文件 | 档位 | 配置 |
|:-|:-|:-|:-|
| 东风、红旗 | fOchTaxi.gradle、fOchTaxiPassenger.gradle | P、R | buildConfigField 'java.util.Set<chassis.Chassis.GearPosition>', 'UNABLE_LAUNCH_AUTOPILOT_GEAR', 'new java.util.HashSet<chassis.Chassis.GearPosition>(){{add(chassis.Chassis.GearPosition.GEAR_P);add(chassis.Chassis.GearPosition.GEAR_R);}}' |
| 金旅小巴 | fOchBus.gradle、fOchBusPassenger.gradle、fOchShuttle.gradle、fOchShuttlePassenger.gradle | N、R | buildConfigField 'java.util.Set<chassis.Chassis.GearPosition>', 'UNABLE_LAUNCH_AUTOPILOT_GEAR', 'new java.util.HashSet<chassis.Chassis.GearPosition>(){{add(chassis.Chassis.GearPosition.GEAR_N);add(chassis.Chassis.GearPosition.GEAR_R);}}' |
| M1 | fOchBusPassengerM1.gradle | 不限制档位 | buildConfigField 'java.util.Set<chassis.Chassis.GearPosition>', 'UNABLE_LAUNCH_AUTOPILOT_GEAR', 'null' |
| M2 | fOchBusPassengerM2.gradle | N、P、R | buildConfigField 'java.util.Set<chassis.Chassis.GearPosition>', 'UNABLE_LAUNCH_AUTOPILOT_GEAR', 'new java.util.HashSet<chassis.Chassis.GearPosition>(){{add(chassis.Chassis.GearPosition.GEAR_N);add(chassis.Chassis.GearPosition.GEAR_P);add(chassis.Chassis.GearPosition.GEAR_R);}}' |
| 清扫车 | fOchSweeper.gradle | N | buildConfigField 'java.util.Set<chassis.Chassis.GearPosition>', 'UNABLE_LAUNCH_AUTOPILOT_GEAR', 'new java.util.HashSet<chassis.Chassis.GearPosition>(){{add(chassis.Chassis.GearPosition.GEAR_N);}}' |
| 开沃 | 暂无 | 不限制档位 | buildConfigField 'java.util.Set<chassis.Chassis.GearPosition>', 'UNABLE_LAUNCH_AUTOPILOT_GEAR', 'null' |

View File

@@ -1,7 +1,7 @@
import java.text.SimpleDateFormat
import groovy.json.JsonSlurper
import groovy.json.JsonOutput
import groovy.json.JsonSlurper
import java.text.SimpleDateFormat
apply plugin: 'com.android.application'
apply plugin: 'com.alibaba.arouter'
@@ -204,7 +204,7 @@ android {
}
}
flavorDimensions "business","product", "basic", "env"
flavorDimensions "business", "product", "basic", "env"
productFlavors {
// launcher app
@@ -231,24 +231,24 @@ android {
sweeper {
dimension "business"
}
shuttle{
shuttle {
dimension "business"
}
// 配置网络环境QA、线上、演示
qa {
dimension "env"
buildConfigField 'int', 'NET_ENV', '2'
buildConfigField 'String', 'URLs', "\"${readFileToJson("qa").replace("\"","\\\"")}\""
buildConfigField 'String', 'URLs', "\"${readFileToJson("qa").replace("\"", "\\\"")}\""
}
online {
dimension "env"
buildConfigField 'int', 'NET_ENV', '3'
buildConfigField 'String', 'URLs', "\"${readFileToJson("online").replace("\"","\\\"")}\""
buildConfigField 'String', 'URLs', "\"${readFileToJson("online").replace("\"", "\\\"")}\""
}
demo {
dimension "env"
buildConfigField 'int', 'NET_ENV', '4'
buildConfigField 'String', 'URLs', "\"${readFileToJson("demo").replace("\"","\\\"")}\""
buildConfigField 'String', 'URLs', "\"${readFileToJson("demo").replace("\"", "\\\"")}\""
}
}
@@ -266,13 +266,13 @@ android {
def names = variant.flavors*.name
//要检查特定的构建类型请使用variant.buildType.name ==“ <buildType>”
// region 过滤noop 的flavors 不带och业务的
if (names.contains("noop")&&!names.contains("fPadLenovo")) {
if (names.contains("noop") && !names.contains("fPadLenovo")) {
//Gradle会忽略满足上述条件的所有变体
setIgnore(true)
}
// endregion
// region 过滤sweper 的flavors
if (names.contains("sweeper")&&!names.contains("fPadLenovoOchSweeper")) {
if (names.contains("sweeper") && !names.contains("fPadLenovoOchSweeper")) {
//Gradle会忽略满足上述条件的所有变体
setIgnore(true)
}
@@ -281,9 +281,9 @@ android {
// region 过滤shuttle 的flavors
if (names.contains("shuttle")) {
//Gradle会忽略满足上述条件的所有变体
if(names.contains("fPadLenovoOchBus")){
}else if(names.contains("fPadLenovoOchBusPassenger")){
}else {
if (names.contains("fPadLenovoOchBus")) {
} else if (names.contains("fPadLenovoOchBusPassenger")) {
} else {
setIgnore(true)
}
}
@@ -291,11 +291,11 @@ android {
// region 过滤taxibase 的flavors
if (names.contains("taxibase")) {
//Gradle会忽略满足上述条件的所有变体
if(names.contains("fPadLenovoOchTaxi")){
}else if(names.contains("fPadLenovoOchTaxiPassenger")){
}else if(names.contains("fPadLenovo")){
}else if(names.contains("fMultiDisplayOchTaxi")){
}else {
if (names.contains("fPadLenovoOchTaxi")) {
} else if (names.contains("fPadLenovoOchTaxiPassenger")) {
} else if (names.contains("fPadLenovo")) {
} else if (names.contains("fMultiDisplayOchTaxi")) {
} else {
setIgnore(true)
}
}
@@ -303,10 +303,10 @@ android {
// region 过滤taxibase 的flavors
if (names.contains("busbase")) {
//Gradle会忽略满足上述条件的所有变体
if(names.contains("fPadLenovoOchBus")){
}else if(names.contains("fPadLenovoOchBusPassenger")){
}else if(names.contains("fMultiDisplayOchBus")){
}else {
if (names.contains("fPadLenovoOchBus")) {
} else if (names.contains("fPadLenovoOchBusPassenger")) {
} else if (names.contains("fMultiDisplayOchBus")) {
} else {
setIgnore(true)
}
}
@@ -335,8 +335,6 @@ aspectjx {
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
//Crash日志收集
// implementation rootProject.ext.dependencies.crashSdk
implementation rootProject.ext.dependencies.androidxappcompat
implementation rootProject.ext.dependencies.arouter
implementation rootProject.ext.dependencies.boostmultidex
@@ -346,41 +344,23 @@ dependencies {
implementation rootProject.ext.dependencies.android_start_up
implementation rootProject.ext.dependencies.lancetx_runtime
implementation rootProject.ext.dependencies.mogocustommap
implementation project(':core:function-impl:mogo-core-function-startup')
implementation project(':libraries:map-usbcamera')
// // 暂不使用Shizuku-API
// implementation rootProject.ext.dependencies.shizuku_provider
if (Boolean.valueOf(USE_MAVEN_PACKAGE)) {
implementation rootProject.ext.dependencies.ttspad
implementation rootProject.ext.dependencies.mogo_core_function_hmi
implementation rootProject.ext.dependencies.mogocommons
implementation rootProject.ext.dependencies.mogo_core_utils
implementation rootProject.ext.dependencies.mogo_core_function_map
implementation rootProject.ext.dependencies.mogo_core_function_datacenter
implementation rootProject.ext.dependencies.mogo_core_function_devatools
implementation rootProject.ext.dependencies.mogo_core_function_chat
implementation rootProject.ext.dependencies.mogo_core_function_biz
implementation rootProject.ext.dependencies.mogo_core_function_call
androidTestImplementation rootProject.ext.dependencies.mogo_core_function_call
androidTestImplementation rootProject.ext.dependencies.mogo_core_res
} else {
implementation project(':tts:tts-pad')
implementation project(':core:function-impl:mogo-core-function-hmi')
implementation project(':core:function-impl:mogo-core-function-map')
implementation project(':core:function-impl:mogo-core-function-datacenter')
implementation project(':core:function-impl:mogo-core-function-devatools')
implementation project(':core:function-impl:mogo-core-function-chat')
implementation project(':core:function-impl:mogo-core-function-biz')
implementation project(':core:mogo-core-function-call')
implementation project(':core:mogo-core-utils')
implementation project(':core:mogo-core-res')
implementation project(':foudations:mogo-commons')
implementation project(':tts:tts-pad')
implementation project(':core:function-impl:mogo-core-function-startup')
implementation project(':core:function-impl:mogo-core-function-devatools')
implementation project(':core:function-impl:mogo-core-function-datacenter')
implementation project(':core:function-impl:mogo-core-function-biz')
implementation project(':core:function-impl:mogo-core-function-hmi')
implementation project(':core:function-impl:mogo-core-function-map')
implementation project(':core:function-impl:mogo-core-function-chat')
implementation project(':foudations:mogo-commons')
implementation project(':core:mogo-core-function-call')
implementation project(':core:mogo-core-utils')
implementation project(':core:mogo-core-res')
androidTestImplementation project(':core:mogo-core-function-call')
androidTestImplementation project(':core:mogo-core-res')
}
androidTestImplementation project(':core:mogo-core-function-call')
androidTestImplementation project(':core:mogo-core-res')
apply from: "./functions/och.gradle"
@@ -496,10 +476,10 @@ boolean isReleaseBuild() {
return false
}
Object readFileToJson(env){
Object readFileToJson(env) {
try {
def businessType = project.hasProperty('business')
if(businessType){
if (businessType) {
println("businessType${businessType}----${business}")
}
// 加载config.json 文件
@@ -507,11 +487,11 @@ Object readFileToJson(env){
def jsonSlurper = new JsonSlurper()
// 解析json
def config = jsonSlurper.parse(file)
def flavorNames = variantName()
def flavorNames = variantName()
def jsonOutput = new JsonOutput()
config.each {key, value ->
config.each { key, value ->
// 匹配flavor对应的 json
if(flavorNames.toLowerCase().contains(key)){
if (flavorNames.toLowerCase().contains(key)) {
return jsonOutput.toJson(value.get(env))
}
}
@@ -526,12 +506,12 @@ Object readFileToJson(env){
def variantName() {
def taskName = getGradle().getStartParameter().getTaskRequests().toString()
def split = taskName.split(":")
if (split.length > 2){
return split[2].toString().split("]")[0].replace("assemble","")
}else {
if(taskName.contains("bus")) {
if (split.length > 2) {
return split[2].toString().split("]")[0].replace("assemble", "")
} else {
if (taskName.contains("bus")) {
return "busbase"
}else {
} else {
return "taxibase"
}
}

View File

@@ -41,6 +41,9 @@ project.android.productFlavors {
// 构建 是否支持多屏异显异交互
buildConfigField 'boolean', 'IS_MULTI_DISPLAY', 'true'
//不能启动自驾的档位
buildConfigField 'java.util.Set<chassis.Chassis.GearPosition>', 'UNABLE_LAUNCH_AUTOPILOT_GEAR', 'null'
}
}

View File

@@ -46,6 +46,9 @@ project.android.productFlavors {
// 构建 是否支持多屏异显异交互
buildConfigField 'boolean', 'IS_MULTI_DISPLAY', 'true'
//不能启动自驾的档位
buildConfigField 'java.util.Set<chassis.Chassis.GearPosition>', 'UNABLE_LAUNCH_AUTOPILOT_GEAR', 'null'
}
}

View File

@@ -43,5 +43,8 @@ project.android.productFlavors {
// 构建 是否支持多屏异显异交互
buildConfigField 'boolean', 'IS_MULTI_DISPLAY', 'false'
//不能启动自驾的档位
buildConfigField 'java.util.Set<chassis.Chassis.GearPosition>', 'UNABLE_LAUNCH_AUTOPILOT_GEAR', 'null'
}
}

View File

@@ -46,5 +46,8 @@ project.android.productFlavors {
// 构建 是否支持多屏异显异交互
buildConfigField 'boolean', 'IS_MULTI_DISPLAY', 'false'
//Bus不能启动自驾的档位
buildConfigField 'java.util.Set<chassis.Chassis.GearPosition>', 'UNABLE_LAUNCH_AUTOPILOT_GEAR', 'new java.util.HashSet<chassis.Chassis.GearPosition>(){{add(chassis.Chassis.GearPosition.GEAR_N);add(chassis.Chassis.GearPosition.GEAR_R);}}'
}
}

View File

@@ -44,5 +44,8 @@ project.android.productFlavors {
// 构建 是否支持多屏异显异交互
buildConfigField 'boolean', 'IS_MULTI_DISPLAY', 'true'
//Bus不能启动自驾的档位
buildConfigField 'java.util.Set<chassis.Chassis.GearPosition>', 'UNABLE_LAUNCH_AUTOPILOT_GEAR', 'new java.util.HashSet<chassis.Chassis.GearPosition>(){{add(chassis.Chassis.GearPosition.GEAR_N);add(chassis.Chassis.GearPosition.GEAR_R);}}'
}
}

View File

@@ -46,5 +46,8 @@ project.android.productFlavors {
// 构建 是否支持多屏异显异交互
buildConfigField 'boolean', 'IS_MULTI_DISPLAY', 'false'
//清扫车不能启动自驾的档位
buildConfigField 'java.util.Set<chassis.Chassis.GearPosition>', 'UNABLE_LAUNCH_AUTOPILOT_GEAR', 'new java.util.HashSet<chassis.Chassis.GearPosition>(){{add(chassis.Chassis.GearPosition.GEAR_N);}}'
}
}

View File

@@ -47,6 +47,9 @@ project.android.productFlavors {
// 构建 是否支持多屏异显异交互
buildConfigField 'boolean', 'IS_MULTI_DISPLAY', 'false'
//Taxi不能启动自驾的档位
buildConfigField 'java.util.Set<chassis.Chassis.GearPosition>', 'UNABLE_LAUNCH_AUTOPILOT_GEAR', 'new java.util.HashSet<chassis.Chassis.GearPosition>(){{add(chassis.Chassis.GearPosition.GEAR_P);add(chassis.Chassis.GearPosition.GEAR_R);}}'
}
}

View File

@@ -46,6 +46,9 @@ project.android.productFlavors {
// 构建 是否支持多屏异显异交互
buildConfigField 'boolean', 'IS_MULTI_DISPLAY', 'true'
//Taxi不能启动自驾的档位
buildConfigField 'java.util.Set<chassis.Chassis.GearPosition>', 'UNABLE_LAUNCH_AUTOPILOT_GEAR', 'new java.util.HashSet<chassis.Chassis.GearPosition>(){{add(chassis.Chassis.GearPosition.GEAR_P);add(chassis.Chassis.GearPosition.GEAR_R);}}'
}
}

View File

@@ -426,6 +426,6 @@
-keep class com.squareup.haha.guava.collect.*{*;}
-keep class **.zego.**{*;}
#-----科大讯飞语音合成-----
-keep class com.iflytek.**{*;}

View File

@@ -1,7 +1,6 @@
package com.mogo.functions.test
import android.os.Debug
import android.util.Log
import androidx.test.core.app.ActivityScenario
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.LargeTest
@@ -30,7 +29,6 @@ class RxJavaBackPressureTest {
fun before() {
launch = ActivityScenario.launch(MainLauncherActivity::class.java)
RxJavaPlugins.setErrorHandler {
Log.e("RxJava2", it.message, it)
}
}

View File

@@ -18,6 +18,7 @@
android:theme="@style/AppTheme.App"
android:usesCleartextTraffic="true"
tools:replace="android:label">
<meta-data
android:name="design_width_in_dp"
android:value="2560"/>
@@ -25,27 +26,6 @@
android:name="design_height_in_dp"
android:value="1600"/>
<!-- <provider-->
<!-- android:name="com.rousetime.android_startup.provider.StartupProvider"-->
<!-- android:authorities="${applicationId}.android_startup"-->
<!-- android:exported="false" >-->
<!-- <meta-data-->
<!-- android:name="com.mogo.launcher.stageone.HttpDnsStartUp"-->
<!-- android:value="android.startup" />-->
<!-- <meta-data-->
<!-- android:name="com.mogo.launcher.stageone.MogoStartupProviderConfig"-->
<!-- android:value="android.startup.provider.config" />-->
<!-- </provider>-->
<!-- &lt;!&ndash; 暂不使用Shizuku-API &ndash;&gt;-->
<!-- <provider-->
<!-- android:name="rikka.shizuku.ShizukuProvider"-->
<!-- android:authorities="${applicationId}.shizuku"-->
<!-- android:enabled="true"-->
<!-- android:exported="true"-->
<!-- android:multiprocess="false"-->
<!-- android:permission="android.permission.INTERACT_ACROSS_USERS_FULL" />-->
<!-- 配置APP ID -->
<meta-data
android:name="BUGLY_APPID"

View File

@@ -11,9 +11,7 @@ import android.util.Log;
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FilenameFilter;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringWriter;

View File

@@ -39,6 +39,8 @@ object ConfigStartUp {
FunctionBuildConfig.appIdentityMode = BuildConfig.APP_IDENTITY_MODE
// 各个module需要的url
FunctionBuildConfig.urlJson = GsonUtils.fromJson(BuildConfig.URLs, UrlConfig::class.java)
//不能启动自动驾驶的档位
FunctionBuildConfig.unableLaunchAutopilotGear = BuildConfig.UNABLE_LAUNCH_AUTOPILOT_GEAR
// // 这里影响当前Activity的身份信息多进程先保持与原来一样主进程为司机端:passenger 进程为乘客端 TODO 暂时不启用,仅做洱海交付,独立乘客屏+宣传视频
// if (ProcessUtils.getCurrentProcessName().contains(":passenger")) {

View File

@@ -64,6 +64,12 @@ android {
driver {
dimension "multi_device"
buildConfigField 'boolean', 'IS_CLIENT', 'false'
buildConfigField 'java.util.Set<chassis.Chassis.GearPosition>', 'UNABLE_LAUNCH_AUTOPILOT_GEAR_TAXI', 'new java.util.HashSet<chassis.Chassis.GearPosition>(){{add(chassis.Chassis.GearPosition.GEAR_P);add(chassis.Chassis.GearPosition.GEAR_R);}}'
buildConfigField 'java.util.Set<chassis.Chassis.GearPosition>', 'UNABLE_LAUNCH_AUTOPILOT_GEAR_BUS', 'new java.util.HashSet<chassis.Chassis.GearPosition>(){{add(chassis.Chassis.GearPosition.GEAR_N);add(chassis.Chassis.GearPosition.GEAR_R);}}'
buildConfigField 'java.util.Set<chassis.Chassis.GearPosition>', 'UNABLE_LAUNCH_AUTOPILOT_GEAR_M1', 'null'
buildConfigField 'java.util.Set<chassis.Chassis.GearPosition>', 'UNABLE_LAUNCH_AUTOPILOT_GEAR_M2', 'new java.util.HashSet<chassis.Chassis.GearPosition>(){{add(chassis.Chassis.GearPosition.GEAR_N);add(chassis.Chassis.GearPosition.GEAR_P);add(chassis.Chassis.GearPosition.GEAR_R);}}'
buildConfigField 'java.util.Set<chassis.Chassis.GearPosition>', 'UNABLE_LAUNCH_AUTOPILOT_GEAR_SWEEPER', 'new java.util.HashSet<chassis.Chassis.GearPosition>(){{add(chassis.Chassis.GearPosition.GEAR_N);}}'
buildConfigField 'java.util.Set<chassis.Chassis.GearPosition>', 'UNABLE_LAUNCH_AUTOPILOT_GEAR_VAN', 'null'
}
}
@@ -94,6 +100,6 @@ dependencies {
// implementation project(':core:mogo-core-utils')
implementation 'org.greenrobot:eventbus:3.2.0'
implementation 'com.android.support:multidex:1.0.3'
implementation 'com.mogo.cloud:telematic:1.3.59'
// implementation 'com.mogo.cloud:telematic:1.3.59'//注释掉司机端 乘客端
implementation 'com.jcraft:jsch:0.1.55'
}

View File

@@ -4,8 +4,13 @@ import android.app.Application;
import com.zhidao.adas.client.utils.CrashHandler;
import chassis.Chassis;
public class App extends Application {
public static App INSTANCE;
public Chassis.GearPosition gear;
@Override
public void onCreate() {
super.onCreate();

View File

@@ -2,19 +2,9 @@ package com.zhidao.adas.client;
import android.util.Pair;
import com.zhidao.adas.client.bean.ArrivalNotification;
import com.zhidao.adas.client.bean.AutopilotState;
import com.zhidao.adas.client.bean.BagManagerCmd;
import com.zhidao.adas.client.bean.BaseInfo;
import com.zhidao.adas.client.bean.BasicInfoReq;
import com.zhidao.adas.client.bean.CarConfigResp;
import com.zhidao.adas.client.bean.ChassisStates;
import com.zhidao.adas.client.bean.DataShow;
import com.zhidao.adas.client.bean.ErrorData;
import com.zhidao.adas.client.bean.FSMFunctionStates;
import com.zhidao.adas.client.bean.GlobalPathResp;
import com.zhidao.adas.client.bean.GnssInfo;
import com.zhidao.adas.client.bean.MogoReportMessage;
import com.zhidao.adas.client.bean.ObuMap;
import com.zhidao.adas.client.bean.ObuRsi;
import com.zhidao.adas.client.bean.ObuRsm;
@@ -43,6 +33,8 @@ import java.util.Locale;
import java.util.concurrent.Future;
import java.util.concurrent.LinkedBlockingQueue;
import mogo.telematics.pad.MessagePad;
/**
* 数据分发
*/
@@ -192,8 +184,8 @@ public class DataDistribution {
}
public String cutDown(String str) {
if (isCutDown && str.length() > 650) {
str = str.substring(0, 650) + "\n已缩短。如需查看完整数据请勾选日志缩短复选框";
if (isCutDown && str.length() > 850) {
str = str.substring(0, 850) + "\n已缩短。如需查看完整数据请勾选日志缩短复选框";
}
return str;
}
@@ -422,6 +414,222 @@ public class DataDistribution {
}
if (listener != null && Constants.TITLE.RECEIVE_ERROR.equals(listener.first)) {
listener.second.onRefresh();
if (data.header == null) {
if (data instanceof ErrorData) {
listErrorData.add(0, new DataShow(listErrorDataSize++, time + str));
if (listErrorData.size() > 100) {
listErrorData.remove(listErrorData.size() - 1);
}
if (listener != null && Constants.TITLE.RECEIVE_ERROR.equals(listener.first)) {
listener.second.onRefresh();
}
} else if (data instanceof OriginalPointCloudData) {
listOriginalPointCloud.add(0, new DataShow(listOriginalPointCloudSize++, time + str));
if (listOriginalPointCloud.size() > LIST_SIZE) {
listOriginalPointCloud.remove(listOriginalPointCloud.size() - 1);
}
if (listener != null && Constants.TITLE.RECEIVE_POINT_CLOUD_ORIGINAL.equals(listener.first)) {
listener.second.onRefresh();
}
}
} else {
MessagePad.MessageType messageType = data.header.getMsgType();
if (messageType == MessagePad.MessageType.MsgTypeTrajectory) {
listTrajectory.add(0, new DataShow(listTrajectorySize++, time + str));
if (listTrajectory.size() > LIST_SIZE) {
listTrajectory.remove(listTrajectory.size() - 1);
}
if (listener != null && Constants.TITLE.RECEIVE_TRAJECTORY.equals(listener.first)) {
listener.second.onRefresh();
}
} else if (messageType == MessagePad.MessageType.MsgTypeTrackedObjects) {
listTrackedObjects.add(0, new DataShow(listTrackedObjectsSize++, time + str));
if (listTrackedObjects.size() > LIST_SIZE) {
listTrackedObjects.remove(listTrackedObjects.size() - 1);
}
if (listener != null && Constants.TITLE.RECEIVE_TRACKED_OBJECTS.equals(listener.first)) {
listener.second.onRefresh();
}
} else if (messageType == MessagePad.MessageType.MsgTypePlanningObjects) {
listPlanningObjects.add(0, new DataShow(listPlanningObjectsSize++, time + str));
if (listPlanningObjects.size() > LIST_SIZE) {
listPlanningObjects.remove(listPlanningObjects.size() - 1);
}
if (listener != null && Constants.TITLE.RECEIVE_PLANNING_OBJECTS.equals(listener.first)) {
listener.second.onRefresh();
}
} else if (messageType == MessagePad.MessageType.MsgTypePlanningDecisionState) {
listPlanningDecisionState.add(0, new DataShow(listPlanningDecisionStateSize++, time + str));
if (listPlanningDecisionState.size() > LIST_SIZE) {
listPlanningDecisionState.remove(listPlanningDecisionState.size() - 1);
}
if (listener != null && Constants.TITLE.RECEIVE_PLANNING_DECISION_STATE.equals(listener.first)) {
listener.second.onRefresh();
}
} else if (messageType == MessagePad.MessageType.MsgTypeGnssInfo) {
listGnssInfo.add(0, new DataShow(listGnssInfoSize++, time + str));
if (listGnssInfo.size() > LIST_SIZE) {
listGnssInfo.remove(listGnssInfo.size() - 1);
}
if (listener != null && Constants.TITLE.RECEIVE_GNSS_INFO.equals(listener.first)) {
listener.second.onRefresh();
}
} else if (messageType == MessagePad.MessageType.MsgTypeVehicleState) {
listVehicleState.add(0, new DataShow(listVehicleStateSize++, time + str));
if (listVehicleState.size() > LIST_SIZE) {
listVehicleState.remove(listVehicleState.size() - 1);
}
if (listener != null && Constants.TITLE.RECEIVE_VEHICLE_STATE.equals(listener.first)) {
listener.second.onRefresh();
}
} else if (messageType == MessagePad.MessageType.MsgTypeChassisStates) {
listChassisStates.add(0, new DataShow(listChassisStatesSize++, time + str));
if (listChassisStates.size() > LIST_SIZE) {
listChassisStates.remove(listChassisStates.size() - 1);
}
if (listener != null && Constants.TITLE.RECEIVE_CHASSIS_STATES.equals(listener.first)) {
listener.second.onRefresh();
}
} else if (messageType == MessagePad.MessageType.MsgTypeAutopilotState) {
listAutopilotState.add(0, new DataShow(listAutopilotStateSize++, time + str));
if (listAutopilotState.size() > LIST_SIZE) {
listAutopilotState.remove(listAutopilotState.size() - 1);
}
if (listener != null && Constants.TITLE.RECEIVE_AUTOPILOT_STATE.equals(listener.first)) {
listener.second.onRefresh();
}
} else if (messageType == MessagePad.MessageType.MsgTypeReportMessage) {
listMogoReportMessage.add(0, new DataShow(listMogoReportMessageSize++, time + str));
if (listMogoReportMessage.size() > LIST_SIZE) {
listMogoReportMessage.remove(listMogoReportMessage.size() - 1);
}
if (listener != null && Constants.TITLE.RECEIVE_REPORT_MESSAGE.equals(listener.first)) {
listener.second.onRefresh();
}
} else if (messageType == MessagePad.MessageType.MsgTypePredictionObstacleTrajectory) {
listPredictionObstacleTrajectory.add(0, new DataShow(listPredictionObstacleTrajectorySize++, time + str));
if (listPredictionObstacleTrajectory.size() > LIST_SIZE) {
listPredictionObstacleTrajectory.remove(listPredictionObstacleTrajectory.size() - 1);
}
if (listener != null && Constants.TITLE.RECEIVE_PREDICTION_OBSTACLE_TRAJECTORY.equals(listener.first)) {
listener.second.onRefresh();
}
} else if (messageType == MessagePad.MessageType.MsgTypeCarConfigResp) {
if (listener != null && Constants.TITLE.TITLE_CAR_CONFIG_RESP.equals(listener.first)) {
listener.second.onRefresh();
}
} else if (messageType == MessagePad.MessageType.MsgTypeRecordResult) {
listRecordPanel.add(0, new DataShow(listRecordPanelSize++, time + str));
if (listRecordPanel.size() > LIST_SIZE) {
listRecordPanel.remove(listRecordPanel.size() - 1);
}
if (listener != null && Constants.TITLE.RECEIVE_RECORD_RESULT.equals(listener.first)) {
listener.second.onRefresh();
}
} else if (messageType == MessagePad.MessageType.MsgTypeBagManagerCmd) {
listBagManagerCmd.add(0, new DataShow(listBagManagerCmdSize++, time + str));
if (listBagManagerCmd.size() > LIST_SIZE) {
listBagManagerCmd.remove(listBagManagerCmd.size() - 1);
}
if (listener != null && Constants.TITLE.RECEIVE_BAG_MANAGER_CMD.equals(listener.first)) {
listener.second.onRefresh();
}
} else if (messageType == MessagePad.MessageType.MsgTypeGlobalPathResp) {
listGlobalPathResp.add(0, new DataShow(listGlobalPathRespSize++, time + str));
if (listGlobalPathResp.size() > LIST_SIZE) {
listGlobalPathResp.remove(listGlobalPathResp.size() - 1);
}
if (listener != null && Constants.TITLE.RECEIVE_GLOBAL_PATH_RESP.equals(listener.first)) {
listener.second.onRefresh();
}
} else if (messageType == MessagePad.MessageType.MsgTypeWarn) {
listWarn.add(0, new DataShow(listWarnSize++, time + str));
if (listWarn.size() > LIST_SIZE) {
listWarn.remove(listWarn.size() - 1);
}
if (listener != null && Constants.TITLE.RECEIVE_WARN.equals(listener.first)) {
listener.second.onRefresh();
}
} else if (messageType == MessagePad.MessageType.MsgTypeArrivalNotification) {
listArrivalNotification.add(0, new DataShow(listArrivalNotificationSize++, time + str));
if (listArrivalNotification.size() > LIST_SIZE) {
listArrivalNotification.remove(listArrivalNotification.size() - 1);
}
if (listener != null && Constants.TITLE.RECEIVE_ARRIVAL_NOTIFICATION.equals(listener.first)) {
listener.second.onRefresh();
}
} else if (messageType == MessagePad.MessageType.MsgTypeStatusQueryResp) {
listStatusInfo.add(0, new DataShow(listStatusInfoSize++, time + str));
if (listStatusInfo.size() > LIST_SIZE) {
listStatusInfo.remove(listStatusInfo.size() - 1);
}
if (listener != null && Constants.TITLE.RECEIVE_STATUS_QUERY_RESP.equals(listener.first)) {
listener.second.onRefresh();
}
} else if (messageType == MessagePad.MessageType.MsgTypeRecordDataConfigResp) {
listRecordDataConfig.add(0, new DataShow(listRecordDataConfigSize++, time + str));
if (listRecordDataConfig.size() > LIST_SIZE) {
listRecordDataConfig.remove(listRecordDataConfig.size() - 1);
}
if (listener != null && Constants.TITLE.RECEIVE_RECORD_DATA_CONFIG_RESP.equals(listener.first)) {
listener.second.onRefresh();
}
} else if (messageType == MessagePad.MessageType.MsgTypeSweeperTaskIndexData) {
listRoboSweeperTaskIndex.add(0, new DataShow(listRoboSweeperTaskIndexSize++, time + str));
if (listRoboSweeperTaskIndex.size() > LIST_SIZE) {
listRoboSweeperTaskIndex.remove(listRoboSweeperTaskIndex.size() - 1);
}
if (listener != null && Constants.TITLE.RECEIVE_SWEEPER_TASK_INDEX_DATA.equals(listener.first)) {
listener.second.onRefresh();
}
} else if (messageType == MessagePad.MessageType.MsgTypeFunctionStates) {
listFSMFunctionStates.add(0, new DataShow(listFSMFunctionStatesSize++, time + str));
if (listFSMFunctionStates.size() > LIST_SIZE) {
listFSMFunctionStates.remove(listFSMFunctionStates.size() - 1);
}
if (listener != null && Constants.TITLE.RECEIVE_FUNCTION_STATES.equals(listener.first)) {
listener.second.onRefresh();
}
} else if (data instanceof PerceptionTrafficLight) {
listPerceptionTrafficLight.add(0, new DataShow(listPerceptionTrafficLightSize++, time + str));
if (listPerceptionTrafficLight.size() > LIST_SIZE) {
listPerceptionTrafficLight.remove(listPerceptionTrafficLight.size() - 1);
}
if (listener != null && Constants.TITLE.RECEIVE_PERCEPTION_TRAFFIC_LIGHT.equals(listener.first)) {
listener.second.onPerceptionTrafficLight((PerceptionTrafficLight) data);
}
} else if (data instanceof ObuSpat) {
listObuSpat.add(0, new DataShow(listObuSpatSize++, time + str));
if (listObuSpat.size() > LIST_SIZE) {
listObuSpat.remove(listObuSpat.size() - 1);
}
if (listener != null && Constants.TITLE.RECEIVE_OBU_SPAT.equals(listener.first)) {
listener.second.onRefresh();
}
} else if (data instanceof ObuRsi) {
listObuRsi.add(0, new DataShow(listObuRsiSize++, time + str));
if (listObuRsi.size() > LIST_SIZE) {
listObuRsi.remove(listObuRsi.size() - 1);
}
if (listener != null && Constants.TITLE.RECEIVE_OBU_RSI.equals(listener.first)) {
listener.second.onRefresh();
}
} else if (data instanceof ObuRsm) {
listObuRsm.add(0, new DataShow(listObuRsmSize++, time + str));
if (listObuRsm.size() > LIST_SIZE) {
listObuRsm.remove(listObuRsm.size() - 1);
}
if (listener != null && Constants.TITLE.RECEIVE_OBU_RSM.equals(listener.first)) {
listener.second.onRefresh();
}
} else if (data instanceof ObuMap) {
listObuMap.add(0, new DataShow(listObuMapSize++, time + str));
if (listObuMap.size() > LIST_SIZE) {
listObuMap.remove(listObuMap.size() - 1);
}
if (listener != null && Constants.TITLE.RECEIVE_OBU_MAP.equals(listener.first)) {
listener.second.onRefresh();
}
}
}
return temp;

View File

@@ -1,23 +0,0 @@
package com.zhidao.adas.client.bean;
import com.google.protobuf.TextFormat;
import java.text.SimpleDateFormat;
import mogo.telematics.pad.MessagePad;
public class ArrivalNotification extends BaseInfo {
public final MessagePad.ArrivalNotification bean;
public ArrivalNotification(MessagePad.Header header, MessagePad.ArrivalNotification bean, SimpleDateFormat sdf) {
super("接收", bean.getSerializedSize(), header, sdf);
this.bean = bean;
}
@Override
public String toString() {
return super.toString() + TextFormat.printer().escapingNonAscii(false).printToString(bean);
}
}

View File

@@ -1,24 +0,0 @@
package com.zhidao.adas.client.bean;
import com.google.protobuf.TextFormat;
import java.text.SimpleDateFormat;
import mogo.telematics.pad.MessagePad;
public class AutopilotState extends BaseInfo {
public final MessagePad.AutopilotState bean;
public AutopilotState(MessagePad.Header header, MessagePad.AutopilotState bean, SimpleDateFormat sdf) {
super("接收", bean.getSerializedSize(), header, sdf);
this.bean = bean;
}
@Override
public String toString() {
return super.toString() + TextFormat.printer().escapingNonAscii(false).printToString(bean);
}
}

View File

@@ -1,24 +0,0 @@
package com.zhidao.adas.client.bean;
import com.google.protobuf.TextFormat;
import java.text.SimpleDateFormat;
import bag_manager.BagManagerOuterClass;
import mogo.telematics.pad.MessagePad;
public class BagManagerCmd extends BaseInfo {
public final BagManagerOuterClass.BagManager bean;
public BagManagerCmd(MessagePad.Header header, BagManagerOuterClass.BagManager bean, SimpleDateFormat sdf) {
super("接收", bean.getSerializedSize(), header, sdf);
this.bean = bean;
}
@Override
public String toString() {
return super.toString() + TextFormat.printer().escapingNonAscii(false).printToString(bean);
}
}

View File

@@ -1,23 +0,0 @@
package com.zhidao.adas.client.bean;
import com.google.protobuf.TextFormat;
import java.text.SimpleDateFormat;
import mogo.telematics.pad.MessagePad;
public class BasicInfoReq extends BaseInfo {
public final MessagePad.BasicInfoReq bean;
public BasicInfoReq(MessagePad.Header header, MessagePad.BasicInfoReq bean, SimpleDateFormat sdf) {
super("接收", bean.getSerializedSize(), header, sdf);
this.bean = bean;
}
@Override
public String toString() {
return super.toString() + TextFormat.printer().escapingNonAscii(false).printToString(bean);
}
}

View File

@@ -1,23 +0,0 @@
package com.zhidao.adas.client.bean;
import com.google.protobuf.TextFormat;
import java.text.SimpleDateFormat;
import mogo.telematics.pad.MessagePad;
public class CarConfigResp extends BaseInfo {
public final MessagePad.CarConfigResp bean;
public CarConfigResp(MessagePad.Header header, MessagePad.CarConfigResp bean, SimpleDateFormat sdf) {
super("接收", bean.getSerializedSize(), header, sdf);
this.bean = bean;
}
@Override
public String toString() {
return super.toString() + TextFormat.printer().escapingNonAscii(false).printToString(bean);
}
}

View File

@@ -1,24 +0,0 @@
package com.zhidao.adas.client.bean;
import com.google.protobuf.TextFormat;
import java.text.SimpleDateFormat;
import chassis.ChassisStatesOuterClass;
import mogo.telematics.pad.MessagePad;
public class ChassisStates extends BaseInfo {
public final ChassisStatesOuterClass.ChassisStates bean;
public ChassisStates(MessagePad.Header header, ChassisStatesOuterClass.ChassisStates bean, SimpleDateFormat sdf) {
super("接收", bean.getSerializedSize(), header, sdf);
this.bean = bean;
}
@Override
public String toString() {
return super.toString() + TextFormat.printer().escapingNonAscii(false).printToString(bean);
}
}

View File

@@ -1,24 +0,0 @@
package com.zhidao.adas.client.bean;
import com.google.protobuf.TextFormat;
import java.text.SimpleDateFormat;
import function_state_management.FunctionStates;
import mogo.telematics.pad.MessagePad;
public class FSMFunctionStates extends BaseInfo {
public final FunctionStates.FSMFunctionStates bean;
public FSMFunctionStates(MessagePad.Header header, FunctionStates.FSMFunctionStates bean, SimpleDateFormat sdf) {
super("接收", bean.getSerializedSize(), header, sdf);
this.bean = bean;
}
@Override
public String toString() {
return super.toString() + TextFormat.printer().escapingNonAscii(false).printToString(bean);
}
}

View File

@@ -1,23 +0,0 @@
package com.zhidao.adas.client.bean;
import com.google.protobuf.TextFormat;
import java.text.SimpleDateFormat;
import mogo.telematics.pad.MessagePad;
public class GlobalPathResp extends BaseInfo {
public final MessagePad.GlobalPathResp bean;
public GlobalPathResp(MessagePad.Header header, MessagePad.GlobalPathResp bean, SimpleDateFormat sdf) {
super("接收", bean.getSerializedSize(), header, sdf);
this.bean = bean;
}
@Override
public String toString() {
return super.toString() + TextFormat.printer().escapingNonAscii(false).printToString(bean);
}
}

View File

@@ -1,24 +0,0 @@
package com.zhidao.adas.client.bean;
import com.google.protobuf.TextFormat;
import java.text.SimpleDateFormat;
import mogo.telematics.pad.MessagePad;
public class GnssInfo extends BaseInfo {
public final MessagePad.GnssInfo bean;
public GnssInfo(MessagePad.Header header, MessagePad.GnssInfo bean, SimpleDateFormat sdf) {
super("接收", bean.getSerializedSize(), header, sdf);
this.bean = bean;
}
@Override
public String toString() {
return super.toString() + TextFormat.printer().escapingNonAscii(false).printToString(bean);
}
}

View File

@@ -1,25 +0,0 @@
package com.zhidao.adas.client.bean;
import com.google.protobuf.TextFormat;
import java.text.SimpleDateFormat;
import mogo.telematics.pad.MessagePad;
import mogo_msg.MogoReportMsg;
public class MogoReportMessage extends BaseInfo {
public final MogoReportMsg.MogoReportMessage bean;
public MogoReportMessage(MessagePad.Header header, MogoReportMsg.MogoReportMessage bean, SimpleDateFormat sdf) {
super("接收", bean.getSerializedSize(), header, sdf);
this.bean = bean;
}
@Override
public String toString() {
return super.toString() + TextFormat.printer().escapingNonAscii(false).printToString(bean);
}
}

View File

@@ -2,6 +2,7 @@ package com.zhidao.adas.client.bean;
import com.google.protobuf.TextFormat;
import com.mogo.support.obu.ObuScene;
import com.zhidao.support.adas.high.common.ByteUtil;
import java.text.SimpleDateFormat;
@@ -18,7 +19,7 @@ public class ObuMap extends BaseInfo {
@Override
public String toString() {
return super.toString() + TextFormat.printer().escapingNonAscii(false).printToString(bean);
return super.toString() + "Payload原始数据" + ByteUtil.byteArrToHex(bean.toByteArray()) + '\n' + TextFormat.printer().escapingNonAscii(false).printToString(bean);
}
}

View File

@@ -2,6 +2,7 @@ package com.zhidao.adas.client.bean;
import com.google.protobuf.TextFormat;
import com.mogo.support.obu.ObuScene;
import com.zhidao.support.adas.high.common.ByteUtil;
import java.text.SimpleDateFormat;
@@ -18,7 +19,7 @@ public class ObuRsi extends BaseInfo {
@Override
public String toString() {
return super.toString() + TextFormat.printer().escapingNonAscii(false).printToString(bean);
return super.toString() + "Payload原始数据" + ByteUtil.byteArrToHex(bean.toByteArray()) + '\n' + TextFormat.printer().escapingNonAscii(false).printToString(bean);
}
}

View File

@@ -2,6 +2,7 @@ package com.zhidao.adas.client.bean;
import com.google.protobuf.TextFormat;
import com.mogo.support.obu.ObuScene;
import com.zhidao.support.adas.high.common.ByteUtil;
import java.text.SimpleDateFormat;
@@ -18,7 +19,7 @@ public class ObuRsm extends BaseInfo {
@Override
public String toString() {
return super.toString() + TextFormat.printer().escapingNonAscii(false).printToString(bean);
return super.toString() + "Payload原始数据" + ByteUtil.byteArrToHex(bean.toByteArray()) + '\n' + TextFormat.printer().escapingNonAscii(false).printToString(bean);
}
}

View File

@@ -2,6 +2,7 @@ package com.zhidao.adas.client.bean;
import com.google.protobuf.TextFormat;
import com.mogo.support.obu.ObuScene;
import com.zhidao.support.adas.high.common.ByteUtil;
import java.text.SimpleDateFormat;
@@ -18,7 +19,7 @@ public class ObuSpat extends BaseInfo {
@Override
public String toString() {
return super.toString() + TextFormat.printer().escapingNonAscii(false).printToString(bean);
return super.toString() + "Payload原始数据" + ByteUtil.byteArrToHex(bean.toByteArray()) + '\n' + TextFormat.printer().escapingNonAscii(false).printToString(bean);
}
}

View File

@@ -1,24 +0,0 @@
package com.zhidao.adas.client.bean;
import com.google.protobuf.TextFormat;
import java.text.SimpleDateFormat;
import mogo.telematics.pad.MessagePad;
import mogo.v2x.ObuWarningEvent;
public class ObuWarningData extends BaseInfo {
public final ObuWarningEvent.ObuWarningData bean;
public ObuWarningData(MessagePad.Header header, ObuWarningEvent.ObuWarningData bean, SimpleDateFormat sdf) {
super("接收", bean.getSerializedSize(), header, sdf);
this.bean = bean;
}
@Override
public String toString() {
return super.toString() + TextFormat.printer().escapingNonAscii(false).printToString(bean);
}
}

View File

@@ -1,6 +1,7 @@
package com.zhidao.adas.client.bean;
import com.google.protobuf.TextFormat;
import com.zhidao.support.adas.high.common.ByteUtil;
import java.text.SimpleDateFormat;
@@ -18,7 +19,7 @@ public class PerceptionTrafficLight extends BaseInfo {
@Override
public String toString() {
return super.toString() + TextFormat.printer().escapingNonAscii(false).printToString(bean);
return super.toString() + "Payload原始数据" + ByteUtil.byteArrToHex(bean.toByteArray()) + '\n' + TextFormat.printer().escapingNonAscii(false).printToString(bean);
}
}

View File

@@ -1,23 +0,0 @@
package com.zhidao.adas.client.bean;
import com.google.protobuf.TextFormat;
import java.text.SimpleDateFormat;
import mogo.telematics.pad.MessagePad;
public class PlanningDecisionState extends BaseInfo {
public final MessagePad.PlanningActionMsg bean;
public PlanningDecisionState(MessagePad.Header header, MessagePad.PlanningActionMsg bean, SimpleDateFormat sdf) {
super("接收", bean.getSerializedSize(), header, sdf);
this.bean = bean;
}
@Override
public String toString() {
return super.toString() + TextFormat.printer().escapingNonAscii(false).printToString(bean);
}
}

View File

@@ -1,23 +0,0 @@
package com.zhidao.adas.client.bean;
import com.google.protobuf.TextFormat;
import java.text.SimpleDateFormat;
import mogo.telematics.pad.MessagePad;
public class PlanningObjects extends BaseInfo {
public final MessagePad.PlanningObjects bean;
public PlanningObjects(MessagePad.Header header, MessagePad.PlanningObjects bean, SimpleDateFormat sdf) {
super("接收", bean.getSerializedSize(), header, sdf);
this.bean = bean;
}
@Override
public String toString() {
return super.toString() + TextFormat.printer().escapingNonAscii(false).printToString(bean);
}
}

View File

@@ -1,24 +0,0 @@
package com.zhidao.adas.client.bean;
import com.google.protobuf.TextFormat;
import java.text.SimpleDateFormat;
import mogo.telematics.pad.MessagePad;
import prediction.Prediction;
public class PredictionObstacleTrajectory extends BaseInfo {
public final Prediction.mPredictionObjects bean;
public PredictionObstacleTrajectory(MessagePad.Header header, Prediction.mPredictionObjects bean, SimpleDateFormat sdf) {
super("接收", bean.getSerializedSize(), header, sdf);
this.bean = bean;
}
@Override
public String toString() {
return super.toString() + TextFormat.printer().escapingNonAscii(false).printToString(bean);
}
}

View File

@@ -0,0 +1,25 @@
package com.zhidao.adas.client.bean;
import com.google.protobuf.GeneratedMessageV3;
import com.google.protobuf.TextFormat;
import com.zhidao.support.adas.high.common.ByteUtil;
import java.text.SimpleDateFormat;
import mogo.telematics.pad.MessagePad;
public class ReceiveData extends BaseInfo {
public final GeneratedMessageV3 bean;
public ReceiveData(MessagePad.Header header, GeneratedMessageV3 bean, SimpleDateFormat sdf) {
super("接收", bean.getSerializedSize(), header, sdf);
this.bean = bean;
}
@Override
public String toString() {
return super.toString() + "Payload原始数据" + ByteUtil.byteArrToHex(bean.toByteArray()) + '\n' + TextFormat.printer().escapingNonAscii(false).printToString(bean);
}
}

View File

@@ -1,22 +0,0 @@
package com.zhidao.adas.client.bean;
import com.google.protobuf.TextFormat;
import java.text.SimpleDateFormat;
import mogo.telematics.pad.MessagePad;
public class RecordDataConfig extends BaseInfo {
public final MessagePad.RecordDataConfig bean;
public RecordDataConfig(MessagePad.Header header, MessagePad.RecordDataConfig bean, SimpleDateFormat sdf) {
super("接收", bean.getSerializedSize(), header, sdf);
this.bean = bean;
}
@Override
public String toString() {
return super.toString() + TextFormat.printer().escapingNonAscii(false).printToString(bean);
}
}

View File

@@ -1,24 +0,0 @@
package com.zhidao.adas.client.bean;
import com.google.protobuf.TextFormat;
import java.text.SimpleDateFormat;
import mogo.telematics.pad.MessagePad;
import record_cache.RecordPanelOuterClass;
public class RecordPanel extends BaseInfo {
public final RecordPanelOuterClass.RecordPanel bean;
public RecordPanel(MessagePad.Header header, RecordPanelOuterClass.RecordPanel bean, SimpleDateFormat sdf) {
super("接收", bean.getSerializedSize(), header, sdf);
this.bean = bean;
}
@Override
public String toString() {
return super.toString() + TextFormat.printer().escapingNonAscii(false).printToString(bean);
}
}

View File

@@ -1,24 +0,0 @@
package com.zhidao.adas.client.bean;
import com.google.protobuf.TextFormat;
import java.text.SimpleDateFormat;
import mogo.telematics.pad.MessagePad;
import planning.RoboSweeperTaskIndexOuterClass;
public class RoboSweeperTaskIndex extends BaseInfo {
public final RoboSweeperTaskIndexOuterClass.RoboSweeperTaskIndex bean;
public RoboSweeperTaskIndex(MessagePad.Header header, RoboSweeperTaskIndexOuterClass.RoboSweeperTaskIndex bean, SimpleDateFormat sdf) {
super("接收", bean.getSerializedSize(), header, sdf);
this.bean = bean;
}
@Override
public String toString() {
return super.toString() + TextFormat.printer().escapingNonAscii(false).printToString(bean);
}
}

View File

@@ -1,24 +0,0 @@
package com.zhidao.adas.client.bean;
import com.google.protobuf.TextFormat;
import java.text.SimpleDateFormat;
import mogo.telematics.pad.MessagePad;
import system_master.SystemStatusInfo;
public class StatusInfo extends BaseInfo {
public final SystemStatusInfo.StatusInfo bean;
public StatusInfo(MessagePad.Header header, SystemStatusInfo.StatusInfo bean, SimpleDateFormat sdf) {
super("接收", bean.getSerializedSize(), header, sdf);
this.bean = bean;
}
@Override
public String toString() {
return super.toString() + TextFormat.printer().escapingNonAscii(false).printToString(bean);
}
}

View File

@@ -1,21 +0,0 @@
package com.zhidao.adas.client.bean;
import com.google.protobuf.TextFormat;
import java.text.SimpleDateFormat;
import mogo.telematics.pad.MessagePad;
public class TrackedObjects extends BaseInfo {
private MessagePad.TrackedObjects bean;
public TrackedObjects(MessagePad.Header header, MessagePad.TrackedObjects bean, SimpleDateFormat sdf) {
super("接收", bean.getSerializedSize(), header, sdf);
this.bean = bean;
}
@Override
public String toString() {
return super.toString() + TextFormat.printer().escapingNonAscii(false).printToString(bean);
}
}

View File

@@ -1,21 +0,0 @@
package com.zhidao.adas.client.bean;
import com.google.protobuf.TextFormat;
import java.text.SimpleDateFormat;
import mogo.telematics.pad.MessagePad;
public class Trajectory extends BaseInfo {
public final MessagePad.Trajectory bean;
public Trajectory(MessagePad.Header header, MessagePad.Trajectory bean, SimpleDateFormat sdf) {
super("接收", bean.getSerializedSize(), header, sdf);
this.bean = bean;
}
@Override
public String toString() {
return super.toString() + TextFormat.printer().escapingNonAscii(false).printToString(bean);
}
}

View File

@@ -1,21 +0,0 @@
package com.zhidao.adas.client.bean;
import com.google.protobuf.TextFormat;
import java.text.SimpleDateFormat;
import mogo.telematics.pad.MessagePad;
public class Warn extends BaseInfo {
public final MessagePad.Warn bean;
public Warn(MessagePad.Header header, MessagePad.Warn bean, SimpleDateFormat sdf) {
super("接收", bean.getSerializedSize(), header, sdf);
this.bean = bean;
}
@Override
public String toString() {
return super.toString() + TextFormat.printer().escapingNonAscii(false).printToString(bean);
}
}

View File

@@ -1,7 +1,5 @@
package com.zhidao.adas.client.ui;
import static com.mogo.telematic.MogoProtocolMsg.NORMAL_DATA;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
@@ -45,11 +43,7 @@ import androidx.recyclerview.widget.SimpleItemAnimator;
import com.google.protobuf.TextFormat;
import com.mogo.support.obu.ObuScene;
import com.mogo.telematic.MogoProtocolMsg;
import com.mogo.telematic.NSDNettyManager;
import com.mogo.telematic.client.listener.NettyClientListener;
import com.mogo.telematic.client.status.ConnectState;
import com.mogo.telematic.server.netty.NettyServerListener;
import com.zhidao.adas.client.App;
import com.zhidao.adas.client.BuildConfig;
import com.zhidao.adas.client.DataDistribution;
import com.zhidao.adas.client.R;
@@ -57,30 +51,15 @@ import com.zhidao.adas.client.adapter.InfoTitleAdapter;
import com.zhidao.adas.client.base.BaseActivity;
import com.zhidao.adas.client.base.BaseAdapter;
import com.zhidao.adas.client.base.BaseFragment;
import com.zhidao.adas.client.bean.ArrivalNotification;
import com.zhidao.adas.client.bean.AutopilotState;
import com.zhidao.adas.client.bean.BagManagerCmd;
import com.zhidao.adas.client.bean.BasicInfoReq;
import com.zhidao.adas.client.bean.CarConfigResp;
import com.zhidao.adas.client.bean.ChassisStates;
import com.zhidao.adas.client.bean.ErrorData;
import com.zhidao.adas.client.bean.FSMFunctionStates;
import com.zhidao.adas.client.bean.GlobalPathResp;
import com.zhidao.adas.client.bean.GnssInfo;
import com.zhidao.adas.client.bean.IPCConnectState;
import com.zhidao.adas.client.bean.MogoReportMessage;
import com.zhidao.adas.client.bean.ObuMap;
import com.zhidao.adas.client.bean.ObuRsi;
import com.zhidao.adas.client.bean.ObuRsm;
import com.zhidao.adas.client.bean.ObuSpat;
import com.zhidao.adas.client.bean.OriginalPointCloudData;
import com.zhidao.adas.client.bean.PerceptionTrafficLight;
import com.zhidao.adas.client.bean.PlanningDecisionState;
import com.zhidao.adas.client.bean.PlanningObjects;
import com.zhidao.adas.client.bean.PredictionObstacleTrajectory;
import com.zhidao.adas.client.bean.RecordDataConfig;
import com.zhidao.adas.client.bean.RecordPanel;
import com.zhidao.adas.client.bean.RoboSweeperTaskIndex;
import com.zhidao.adas.client.bean.ReceiveData;
import com.zhidao.adas.client.bean.SpecialVehicleBean;
import com.zhidao.adas.client.bean.StatusInfo;
import com.zhidao.adas.client.bean.TrackedObjects;
@@ -98,14 +77,12 @@ import com.zhidao.support.adas.high.AdasManager;
import com.zhidao.support.adas.high.AdasOptions;
import com.zhidao.support.adas.high.OnAdasConnectStatusListener;
import com.zhidao.support.adas.high.OnAdasListener;
import com.zhidao.support.adas.high.OnMultiDeviceListener;
import com.zhjt.mogo.adas.data.bean.AutopilotStatistics;
import com.zhidao.support.adas.high.bean.VersionCompatibility;
import com.zhidao.support.adas.high.common.ByteUtil;
import com.zhidao.support.adas.high.common.Constants.IPC_CONNECTION_STATUS;
import com.zhidao.support.adas.high.common.CupidLogUtils;
import com.zhidao.support.adas.high.common.ProtocolStatus;
import com.zhidao.support.adas.high.common.ReceiveTimeoutManager;
import com.zhjt.mogo.adas.data.bean.AutopilotStatistics;
import java.net.Inet4Address;
import java.net.InetAddress;
@@ -123,7 +100,6 @@ import java.util.concurrent.ScheduledExecutorService;
import bag_manager.BagManagerOuterClass;
import chassis.ChassisStatesOuterClass;
import function_state_management.FunctionStates;
import io.netty.channel.Channel;
import mogo.telematics.pad.MessagePad;
import mogo_msg.MogoReportMsg;
import perception.TrafficLightOuterClass;
@@ -877,39 +853,46 @@ public class MainActivity extends BaseActivity implements OnAdasListener, OnAdas
@Override
public void onTrajectory(MessagePad.Header header, MessagePad.Trajectory trajectory) {
Trajectory base = new Trajectory(header, trajectory, sdf);
ReceiveData base = new ReceiveData(header, trajectory, sdf);
DataDistribution.getInstance().addData(base);
}
@Override
public void onTrackedObjects(MessagePad.Header header, MessagePad.TrackedObjects trackedObjects) {
TrackedObjects base = new TrackedObjects(header, trackedObjects, sdf);
ReceiveData base = new ReceiveData(header, trackedObjects, sdf);
DataDistribution.getInstance().addData(base);
}
@Override
public void onGnssInfo(MessagePad.Header header, MessagePad.GnssInfo gnssInfo) {
GnssInfo base = new GnssInfo(header, gnssInfo, sdf);
ReceiveData base = new ReceiveData(header, gnssInfo, sdf);
DataDistribution.getInstance().addData(base);
}
@Override
public void onVehicleState(MessagePad.Header header, VehicleStateOuterClass.VehicleState vehicleState) {
App.INSTANCE.gear = vehicleState.getGear();
ReceiveData base = new ReceiveData(header, vehicleState, sdf);
DataDistribution.getInstance().addData(base);
}
@Override
public void onChassisStates(MessagePad.Header header, ChassisStatesOuterClass.ChassisStates chassisStates) {
ChassisStates base = new ChassisStates(header, chassisStates, sdf);
App.INSTANCE.gear = chassisStates.getGearSystemStates().getGearPosition();
ReceiveData base = new ReceiveData(header, chassisStates, sdf);
DataDistribution.getInstance().addData(base);
}
@Override
public void onAutopilotState(MessagePad.Header header, MessagePad.AutopilotState autopilotState) {
AutopilotState base = new AutopilotState(header, autopilotState, sdf);
ReceiveData base = new ReceiveData(header, autopilotState, sdf);
DataDistribution.getInstance().addData(base);
}
@Override
public void onReportMessage(MessagePad.Header header, MogoReportMsg.MogoReportMessage mogoReportMessage) {
MogoReportMessage base = new MogoReportMessage(header, mogoReportMessage, sdf);
ReceiveData base = new ReceiveData(header, mogoReportMessage, sdf);
DataDistribution.getInstance().addData(base);
}
@@ -921,7 +904,7 @@ public class MainActivity extends BaseActivity implements OnAdasListener, OnAdas
@Override
public void onPredictionObstacleTrajectory(MessagePad.Header header, Prediction.mPredictionObjects predictionObjects) {
PredictionObstacleTrajectory base = new PredictionObstacleTrajectory(header, predictionObjects, sdf);
ReceiveData base = new ReceiveData(header, predictionObjects, sdf);
DataDistribution.getInstance().addData(base);
}
@@ -960,32 +943,32 @@ public class MainActivity extends BaseActivity implements OnAdasListener, OnAdas
@Override
public void onPlanningObjects(MessagePad.Header header, MessagePad.PlanningObjects planningObjects) {
PlanningObjects base = new PlanningObjects(header, planningObjects, sdf);
ReceiveData base = new ReceiveData(header, planningObjects, sdf);
DataDistribution.getInstance().addData(base);
}
@Override
public void onBasicInfoReq(MessagePad.Header header, MessagePad.BasicInfoReq basicInfoReq) {
BasicInfoReq info = new BasicInfoReq(header, basicInfoReq, sdf);
DataDistribution.getInstance().addData(info);
ReceiveData base = new ReceiveData(header, basicInfoReq, sdf);
DataDistribution.getInstance().addData(base);
AdasManager.getInstance().sendBasicInfoResp("", 0, com.zhidao.support.adas.high.common.Constants.TERMINAL_ROLE.DEBUG);
runOnUiThread(new Runnable() {
@Override
public void run() {
showToastCenter("收到车机基础信息请求:" + info.toString());
showToastCenter("收到车机基础信息请求:" + base.toString());
}
});
}
@Override
public void onCarConfigResp(MessagePad.Header header, MessagePad.CarConfigResp carConfigResp) {
CarConfigResp base = new CarConfigResp(header, carConfigResp, sdf);
ReceiveData base = new ReceiveData(header, carConfigResp, sdf);
DataDistribution.getInstance().addData(base);
}
@Override
public void onRecordResult(MessagePad.Header header, RecordPanelOuterClass.RecordPanel recordPanel) {
RecordPanel base = new RecordPanel(header, recordPanel, sdf);
ReceiveData base = new ReceiveData(header, recordPanel, sdf);
DataDistribution.getInstance().addData(base);
recordKey = recordPanel.getKey();
recordFileName = recordPanel.getFilename();
@@ -993,37 +976,37 @@ public class MainActivity extends BaseActivity implements OnAdasListener, OnAdas
@Override
public void onGlobalPathResp(MessagePad.Header header, MessagePad.GlobalPathResp globalPathResp) {
GlobalPathResp base = new GlobalPathResp(header, globalPathResp, sdf);
ReceiveData base = new ReceiveData(header, globalPathResp, sdf);
DataDistribution.getInstance().addData(base);
}
@Override
public void onWarn(MessagePad.Header header, MessagePad.Warn warn) {
Warn base = new Warn(header, warn, sdf);
ReceiveData base = new ReceiveData(header, warn, sdf);
DataDistribution.getInstance().addData(base);
}
@Override
public void onArrivalNotification(MessagePad.Header header, MessagePad.ArrivalNotification arrivalNotification) {
ArrivalNotification base = new ArrivalNotification(header, arrivalNotification, sdf);
ReceiveData base = new ReceiveData(header, arrivalNotification, sdf);
DataDistribution.getInstance().addData(base);
}
@Override
public void onStatusQueryResp(MessagePad.Header header, SystemStatusInfo.StatusInfo statusInfo) {
StatusInfo base = new StatusInfo(header, statusInfo, sdf);
ReceiveData base = new ReceiveData(header, statusInfo, sdf);
DataDistribution.getInstance().addData(base);
}
@Override
public void onRecordDataConfigResp(MessagePad.Header header, MessagePad.RecordDataConfig config) {
RecordDataConfig base = new RecordDataConfig(header, config, sdf);
ReceiveData base = new ReceiveData(header, config, sdf);
DataDistribution.getInstance().addData(base);
}
@Override
public void onPlanningActionMsg(MessagePad.Header header, MessagePad.PlanningActionMsg planningActionMsg) {
PlanningDecisionState base = new PlanningDecisionState(header, planningActionMsg, sdf);
ReceiveData base = new ReceiveData(header, planningActionMsg, sdf);
DataDistribution.getInstance().addData(base);
}
@@ -1054,19 +1037,19 @@ public class MainActivity extends BaseActivity implements OnAdasListener, OnAdas
@Override
public void onFunctionStates(MessagePad.Header header, FunctionStates.FSMFunctionStates functionStates) {
FSMFunctionStates base = new FSMFunctionStates(header, functionStates, sdf);
ReceiveData base = new ReceiveData(header, functionStates, sdf);
DataDistribution.getInstance().addData(base);
}
@Override
public void onSweeperTaskIndexData(MessagePad.Header header, RoboSweeperTaskIndexOuterClass.RoboSweeperTaskIndex roboSweeperTaskIndex) {
RoboSweeperTaskIndex base = new RoboSweeperTaskIndex(header, roboSweeperTaskIndex, sdf);
ReceiveData base = new ReceiveData(header, roboSweeperTaskIndex, sdf);
DataDistribution.getInstance().addData(base);
}
@Override
public void onBagManagerCmd(MessagePad.Header header, BagManagerOuterClass.BagManager bagManager) {
BagManagerCmd base = new BagManagerCmd(header, bagManager, sdf);
ReceiveData base = new ReceiveData(header, bagManager, sdf);
DataDistribution.getInstance().addData(base);
}
@@ -1076,6 +1059,7 @@ public class MainActivity extends BaseActivity implements OnAdasListener, OnAdas
if (BuildConfig.IS_CLIENT) {
/*—————————————作为乘客端———————————*/
options = new AdasOptions.Builder().setClient(true).build();
/*乘客端启动 注释掉
NSDNettyManager.getInstance().searchAndConnectServer(this, "1234", new NettyClientListener<MogoProtocolMsg>() {
@Override
@@ -1095,7 +1079,7 @@ public class MainActivity extends BaseActivity implements OnAdasListener, OnAdas
getHandler().sendEmptyMessage(WHAT_DRIVER_IP);
onUpdateConnectStateView();
}
});
});*/
} else {
/*—————————————作为司机端———————————*/
int mode = Constants.getIpcConnectionMode(this);
@@ -1118,6 +1102,7 @@ public class MainActivity extends BaseActivity implements OnAdasListener, OnAdas
break;
}
/*司机端启动 注释掉
NSDNettyManager.getInstance().startNSDNettyServerWithSN(this, new NettyServerListener<MogoProtocolMsg>() {
@Override
public void onMessageResponseServer(MogoProtocolMsg msg, Channel channel) {
@@ -1144,10 +1129,12 @@ public class MainActivity extends BaseActivity implements OnAdasListener, OnAdas
public void onChannelDisConnect(Channel channel) {
Log.i(TAG, "onChannelDisConnect channel=" + channel.id());
}
}, "1234567");
}, "1234567");*/
}
options.setUnableLaunchAutopilotGear(BuildConfig.UNABLE_LAUNCH_AUTOPILOT_GEAR_TAXI);
AdasManager.getInstance().create(options, this);
AdasManager.getInstance().setOnAdasListener(this);
/*两端数据转发 注释掉
AdasManager.getInstance().setOnMultiDeviceListener(new OnMultiDeviceListener() {
@Override
public void onForwardingDriverIPCMessage(byte[] bytes) {
@@ -1165,7 +1152,7 @@ public class MainActivity extends BaseActivity implements OnAdasListener, OnAdas
.sendMogoProtocolMsgToServer(new MogoProtocolMsg(NORMAL_DATA, bytes.length, bytes), null);
Log.i(TAG, "乘客屏发送数据=" + ByteUtil.byteArrToHex(bytes));
}
});
});*/
}
@@ -1579,7 +1566,7 @@ public class MainActivity extends BaseActivity implements OnAdasListener, OnAdas
break;
case WHAT_DRIVER_IP:
ipcIp.setVisibility(View.VISIBLE);
ipcIp.setText("司机IP" + NSDNettyManager.getInstance().getConnServerIp());
// ipcIp.setText("司机IP" + NSDNettyManager.getInstance().getConnServerIp());
break;
case WHAT_IPC_CONNECT_STATE:
if (floatWindow != null) {

View File

@@ -13,6 +13,8 @@ import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.Toast;
@@ -23,6 +25,7 @@ import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.recyclerview.widget.SimpleItemAnimator;
import com.zhidao.adas.client.App;
import com.zhidao.adas.client.BuildConfig;
import com.zhidao.adas.client.R;
import com.zhidao.adas.client.adapter.ConfigAdapter;
@@ -36,15 +39,18 @@ import com.zhidao.support.adas.high.bean.VersionCompatibility;
import com.zhidao.support.adas.high.common.Constants;
import com.zhidao.support.adas.high.common.CupidLogUtils;
import com.zhidao.support.adas.high.common.MessageType;
import com.zhidao.support.adas.high.common.autopilot.ability.AutopilotAbilityManager;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.Set;
import chassis.Chassis;
import mogo.telematics.pad.MessagePad;
/**
@@ -61,12 +67,17 @@ public class VersionFragment extends BaseFragment {
private CheckBox unregistered_check_all;
private TextView hint_registered;
private TextView hint_unregistered;
private TextView can;
private TextView gear_influence;
private TextView gear;
private TextView title_gear;
private RadioButton rb_taxi;
private RadioGroup rg;
private ConfigAdapter adapter;
private InterfaceAdapter unregisteredAdapter;
private InterfaceAdapter registeredAdapter;
private int role = Constants.TERMINAL_ROLE.DEBUG;//角色 默认调试屏
public VersionFragment() {
@@ -131,6 +142,12 @@ public class VersionFragment extends BaseFragment {
Button btn2 = view.findViewById(R.id.btn2);
ipsView = view.findViewById(R.id.ips_view);
recyclerView = view.findViewById(R.id.config_list);
rb_taxi = view.findViewById(R.id.rb_taxi);
can = view.findViewById(R.id.can);
gear_influence = view.findViewById(R.id.gear_influence);
gear = view.findViewById(R.id.gear);
title_gear = view.findViewById(R.id.title_gear);
rg = view.findViewById(R.id.rg);
initFragmentRecyclerView();
CupidLogUtils.w("InfoFragment===>" + title);
tvTitle.setText(title);
@@ -173,7 +190,36 @@ public class VersionFragment extends BaseFragment {
view.findViewById(R.id.line1).setVisibility(View.GONE);
tvTitle.setText("版本");
}
rg.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
if (checkedId == R.id.rb_taxi) {
AutopilotAbilityManager.getInstance().setUnableLaunchAutopilotGear(BuildConfig.UNABLE_LAUNCH_AUTOPILOT_GEAR_TAXI);
gear("TAXI", Arrays.toString(BuildConfig.UNABLE_LAUNCH_AUTOPILOT_GEAR_TAXI.toArray()));
} else if (checkedId == R.id.rb_bus) {
AutopilotAbilityManager.getInstance().setUnableLaunchAutopilotGear(BuildConfig.UNABLE_LAUNCH_AUTOPILOT_GEAR_BUS);
gear("BUS", Arrays.toString(BuildConfig.UNABLE_LAUNCH_AUTOPILOT_GEAR_BUS.toArray()));
} else if (checkedId == R.id.rb_sweeper) {
AutopilotAbilityManager.getInstance().setUnableLaunchAutopilotGear(BuildConfig.UNABLE_LAUNCH_AUTOPILOT_GEAR_SWEEPER);
gear("SWEEPER", Arrays.toString(BuildConfig.UNABLE_LAUNCH_AUTOPILOT_GEAR_SWEEPER.toArray()));
} else if (checkedId == R.id.rb_m1) {
AutopilotAbilityManager.getInstance().setUnableLaunchAutopilotGear(BuildConfig.UNABLE_LAUNCH_AUTOPILOT_GEAR_M1);
gear("M1", "无限制");
} else if (checkedId == R.id.rb_m2) {
AutopilotAbilityManager.getInstance().setUnableLaunchAutopilotGear(BuildConfig.UNABLE_LAUNCH_AUTOPILOT_GEAR_M2);
gear("M1", Arrays.toString(BuildConfig.UNABLE_LAUNCH_AUTOPILOT_GEAR_M2.toArray()));
} else if (checkedId == R.id.rb_van) {
AutopilotAbilityManager.getInstance().setUnableLaunchAutopilotGear(BuildConfig.UNABLE_LAUNCH_AUTOPILOT_GEAR_VAN);
gear("VAN", "无限制");
}
}
});
gear("TAXI", Arrays.toString(BuildConfig.UNABLE_LAUNCH_AUTOPILOT_GEAR_TAXI.toArray()));
}
private void gear(String car, String gear) {
title_gear.setText(car + "不能启动自动驾驶的档位:");
this.gear.setText(gear);
}
//根据连接状态更新数据
@@ -215,43 +261,62 @@ public class VersionFragment extends BaseFragment {
list.add(new Config("ADAS LIB版本:", AdasManager.getInstance().getAdasVersion()));
list.add(new Config("APP构建时间:", BuildConfig.BUILD_TIME));
list.add(getAutopilotAbilityConfig(""));
adapter.setData(list);
}
private Config getAutopilotAbilityConfig(String value) {
return new Config("能否启动自动驾驶:", value);
private String gear() {
StringBuilder builder = new StringBuilder();
Chassis.GearPosition gear = App.INSTANCE.gear;
if (gear != null) {
boolean b = AutopilotAbilityManager.getInstance().isLaunchAutopilot(gear);
builder.append(" 当前档位:").append(gear.name());
builder.append(" 是否可以启动自驾:").append(b);
}
return builder.toString();
}
private String getAutopilotAbilityConfig(String value) {
return value;
}
public void autopilotAbility(boolean isAutopilotAbility, String unableAutopilotReason) {
List<Config> list = adapter.getData();
if (list != null) {
Config temp = getAutopilotAbilityConfig(isAutopilotAbility + ",原因:" + unableAutopilotReason);
int index = list.indexOf(temp);
if (index < 0) {
list.add(temp);
if (getActivity() != null)
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
adapter.notifyItemInserted(list.size() - 1);
}
});
} else {
Config config = list.get(index);
config.cover(temp);
config.color = RandomColor.randomColor();
if (getActivity() != null)
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
adapter.notifyItemChanged(index);
}
});
}
if (getActivity() != null)
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
can.setTextColor(getResources().getColor(RandomColor.randomColor()));
can.setText(getAutopilotAbilityConfig(isAutopilotAbility + ",原因:" + unableAutopilotReason));
gear_influence.setTextColor(getResources().getColor(RandomColor.randomColor()));
gear_influence.setText(gear());
}
});
}
private void updateRefreshConfig(List<Config> list, Config temp) {
int index = list.indexOf(temp);
if (index < 0) {
list.add(temp);
if (getActivity() != null)
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
adapter.notifyItemInserted(list.size() - 1);
}
});
} else {
Config config = list.get(index);
config.cover(temp);
config.color = RandomColor.randomColor();
if (getActivity() != null)
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
adapter.notifyItemChanged(index);
}
});
}
}
@Override

View File

@@ -33,12 +33,155 @@
android:layout_margin="20dp"
android:orientation="horizontal">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/config_list"
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1" />
android:layout_weight="1">
<LinearLayout
android:id="@+id/layout_gear_influence"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="档位影响:"
android:textStyle="bold" />
<TextView
android:id="@+id/gear_influence"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
<LinearLayout
android:id="@+id/layout_gear"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal"
app:layout_constraintBottom_toTopOf="@id/layout_gear_influence"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent">
<TextView
android:id="@+id/title_gear"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="车型档位:"
android:textStyle="bold" />
<TextView
android:id="@+id/gear"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
<LinearLayout
android:id="@+id/layout_can"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal"
app:layout_constraintBottom_toTopOf="@id/layout_gear"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="能否启动自动驾驶:"
android:textStyle="bold" />
<TextView
android:id="@+id/can"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
<LinearLayout
android:id="@+id/layout_car"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal"
app:layout_constraintBottom_toTopOf="@id/layout_can"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent">
<TextView
android:id="@+id/car_type"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="当前车型:"
android:textStyle="bold" />
<RadioGroup
android:id="@+id/rg"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_toEndOf="@id/car_type"
android:orientation="horizontal">
<RadioButton
android:id="@+id/rb_taxi"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="true"
android:text="TAXI" />
<RadioButton
android:id="@+id/rb_bus"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="BUS" />
<RadioButton
android:id="@+id/rb_sweeper"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="SWEEPER" />
<RadioButton
android:id="@+id/rb_m1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="M1" />
<RadioButton
android:id="@+id/rb_m2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="M2" />
<RadioButton
android:id="@+id/rb_van"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="VAN" />
</RadioGroup>
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/config_list"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintBottom_toTopOf="@id/layout_car"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<View
android:id="@+id/line1"

View File

@@ -19,7 +19,7 @@
<color name="connect_status_search_address">#1E90FF</color>
<color name="color1">#FFC0CB</color>
<color name="color2">#FF8F00</color>
<color name="color3">#FFE500</color>
<color name="color4">#B9ED3E</color>
<color name="color3">#FF33FF</color>
<color name="color4">#669900</color>
<color name="color5">#2EEDEB</color>
</resources>

View File

@@ -93,7 +93,7 @@ ext {
// obu sdk
obusdk : "com.zhidao.enterprise.smartv2x:smartv2x:1.0.0.3",
mogoobu : 'com.mogo.support.obu:mogo-obu:1.1.0_beta1',
mogoobu : 'com.mogo.support.obu:mogo-obu:1.1.0_beta3',
// google
googlezxing : "com.google.zxing:core:3.3.3",
@@ -142,6 +142,7 @@ ext {
ttszhi : "com.mogo.tts:tts-zhi:${TTS_ZHI_VERSION}",
ttspad : "com.mogo.tts:tts-pad:${TTS_ZHI_VERSION}",
ttsnoop : "com.mogo.tts:tts-noop:${TTS_NOOP_VERSION}",
ttsiflytek : "com.mogo.tts:tts-iflytek :${TTS_IFLYTEK_VERSION}",
//========================= 网约车 Maven 版本管理 =========================
mogooch : "com.mogo.och:och:${MOGO_OCH_VERSION}",
@@ -198,10 +199,6 @@ ext {
androidx_datastore : "androidx.datastore:datastore:1.0.0",
android_start_up : "com.mogo:android-startup:1.0.1",
//========================= Shizuku ======================
shizuku_api : "dev.rikka.shizuku:api:12.1.0",
shizuku_provider : "dev.rikka.shizuku:provider:12.1.0",
//========================= Koom ======================
koomnative : "com.kuaishou.koom:koom-native-leak-static:2.2.0",
koomxhook : "com.kuaishou.koom:xhook-static:2.2.0",

View File

@@ -41,6 +41,7 @@ class DispatchAutoPilotManager private constructor() :
private const val MSG_SOCKET_TYPE = 501000
private const val MSG_TYPE_SHOW_DIALOG = 0
private const val MSG_TYPE_UPLOAD_AUTOPILOT_STATUS = 1
private const val MSG_TYPE_UPLOAD_AUTOPILOT_ROTTING = 2
val dispatchAutoPilotManager by lazy(LazyThreadSafetyMode.SYNCHRONIZED) {
DispatchAutoPilotManager()
@@ -68,6 +69,16 @@ class DispatchAutoPilotManager private constructor() :
getAutoPilotStatusInfo().reason
)
sendEmptyMessageDelayed(MSG_TYPE_UPLOAD_AUTOPILOT_STATUS, 1000L)
} else if(msg.what == MSG_TYPE_UPLOAD_AUTOPILOT_ROTTING){
val data = msg.obj as MessagePad.GlobalPathResp
val list: MutableList<AutopilotRouteInfo.RouteModels> = ArrayList()
for (location in data.wayPointsList) {
val routeModels = AutopilotRouteInfo.RouteModels()
routeModels.lat = location.latitude
routeModels.lon = location.longitude
list.add(routeModels)
}
dispatchServiceModel.uploadAutopilotRoute(list)
}
}
}
@@ -165,14 +176,10 @@ class DispatchAutoPilotManager private constructor() :
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)
val message = Message()
message.what = MSG_TYPE_UPLOAD_AUTOPILOT_ROTTING
message.obj = globalPathResp
handler.sendMessage(message)
}
override fun onAutopilotArriveAtStation(arrivalNotification: MessagePad.ArrivalNotification?) {

View File

@@ -76,7 +76,7 @@ class DispatchServiceModel private constructor() {
fun uploadAutopilotRoute(list: List<RouteModels?>?) {
val sn = MoGoAiCloudClientConfig.getInstance().sn
val reportedRoute = ReportedRoute(sn, GsonUtil.jsonFromObject(list))
val map: MutableMap<String, Any> = HashMap()
val map: MutableMap<String, String> = HashMap()
map["sn"] = sn
map["data"] = GsonUtil.jsonFromObject(reportedRoute)
mAdasApiService.uploadAutopilotRoute(map)

View File

@@ -15,7 +15,7 @@ interface IDispatchAdasApiService {
*/
@FormUrlEncoded
@POST("eagle-eye-dns/eagle-eye-dns/dataService/autoDriver/receiveCarPreSetPath")
fun uploadAutopilotRoute(@FieldMap parameters: Map<String, Any>): Observable<BaseData>
fun uploadAutopilotRoute(@FieldMap parameters: Map<String, String>): Observable<BaseData>
/**
* 上报自动驾驶调度处理结果 服务于业务调度

View File

@@ -5,9 +5,12 @@ import com.mogo.eagle.core.data.enums.DataSourceType
import com.mogo.eagle.core.data.msgbox.MsgBoxBean
import com.mogo.eagle.core.data.msgbox.MsgBoxType
import com.mogo.eagle.core.data.msgbox.V2XMsg
import com.mogo.eagle.core.data.obu.MogoObuConst
import com.mogo.eagle.core.function.api.obu.IMoGoObuSaveMessageListener
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager
import com.mogo.eagle.core.function.call.obu.CallerObuSaveMessageListenerManager
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
/**
* 处理obu分发出来在消息盒子展示的消息
@@ -27,24 +30,41 @@ object V2xObuEventManager : IMoGoObuSaveMessageListener {
CallerObuSaveMessageListenerManager.removeListener(TAG)
}
private val obuDataMap = mutableMapOf<String, Long>()
/**
* @param type 事件id类似与uuid
* @param content 事件内容
* @param tts 事件语音播报
* @param tts 事件语音播报 //30秒内同一个事件只出现一次 TODO 临时添加,后面宏宇统一在数据中心处理
*/
override fun onMoGoObuSaveMessage(type: String, content: String, tts: String, source: DataSourceType) {
CallerMsgBoxManager.saveMsgBox(
MsgBoxBean(
MsgBoxType.V2X,
V2XMsg(
type,
content,
tts
)
).apply {
sourceType = source
if (content.isNotEmpty()) {
if (obuDataMap.containsKey(type)) {
var oldTime = obuDataMap[type]
var timeDiff = (System.currentTimeMillis() - oldTime!!) / 1000
if (timeDiff < 30) {
return
}
obuDataMap.remove(type)
obuDataMap[type] = System.currentTimeMillis()
} else {
obuDataMap[type] = System.currentTimeMillis()
}
)
CallerLogger.d("${SceneConstant.M_OBU}${TAG}", "onMoGoObuSaveMessage type = $type ---content = $content ---tts = $tts ")
CallerMsgBoxManager.saveMsgBox(
MsgBoxBean(
MsgBoxType.V2X,
V2XMsg(
type,
content,
tts
)
).apply {
sourceType = source
}
)
}
}
fun release() {

View File

@@ -44,7 +44,7 @@ MogoObuManager.getInstance().init(Context context);
```
## 连接
```java
//默认192.168.1.199
//默认
MogoObuManager.getInstance().connect();
//自定义 IP
MogoObuManager.getInstance().connect(String ip);

View File

@@ -45,28 +45,30 @@ android {
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation rootProject.ext.dependencies.androidxccorektx
implementation rootProject.ext.dependencies.androidxappcompat
implementation rootProject.ext.dependencies.arouter
implementation rootProject.ext.dependencies.rxandroid
kapt rootProject.ext.dependencies.aroutercompiler
implementation rootProject.ext.dependencies.androidxroomruntime
kapt rootProject.ext.dependencies.androidxroomcompiler
implementation rootProject.ext.dependencies.androidxroomktx
implementation rootProject.ext.dependencies.mogoaicloudtelematic
implementation project(':libraries:mogo-obu')
implementation project(':libraries:mogo-adas')
if (Boolean.valueOf(USE_MAVEN_PACKAGE)) {
implementation rootProject.ext.dependencies.mogo_core_utils
implementation rootProject.ext.dependencies.mogo_core_function_call
implementation rootProject.ext.dependencies.mogocommons
implementation rootProject.ext.dependencies.androidxccorektx
implementation rootProject.ext.dependencies.androidxappcompat
implementation project(':libraries:mogo-obu')
implementation project(':libraries:mogo-adas')
implementation project(":foudations:mogo-aicloud-services-sdk")
implementation project(':core:mogo-core-data')
} else {
implementation project(':core:mogo-core-utils')
implementation rootProject.ext.dependencies.androidxccorektx
implementation rootProject.ext.dependencies.androidxappcompat
implementation rootProject.ext.dependencies.arouter
implementation rootProject.ext.dependencies.rxandroid
kapt rootProject.ext.dependencies.aroutercompiler
implementation rootProject.ext.dependencies.androidxroomruntime
kapt rootProject.ext.dependencies.androidxroomcompiler
implementation rootProject.ext.dependencies.androidxroomktx
implementation project(':libraries:mogo-obu')
implementation project(':libraries:mogo-adas')
implementation rootProject.ext.dependencies.mogoaicloudtelematic
implementation project(':core:mogo-core-function-call')
implementation project(':foudations:mogo-commons')
implementation project(":foudations:mogo-commons")
}
}
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()
//apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()

View File

@@ -3,7 +3,6 @@ package com.mogo.eagle.core.function.datacenter.aicloud
import android.content.Context
import com.alibaba.android.arouter.facade.annotation.Route
import com.mogo.cloud.socket.SocketManager
import com.mogo.commons.AbsMogoApplication
import com.mogo.eagle.core.data.constants.MogoServicePaths
import com.mogo.eagle.core.function.api.base.IMoGoFunctionServerProvider
@@ -13,13 +12,15 @@ class AiCloudSocketBizProvider : IMoGoFunctionServerProvider {
get() = "AiCloudSocketBizProvider"
override fun init(context: Context?) {
SocketManager.getInstance().init(AbsMogoApplication.getApp(), 0.0, 0.0)
SocketManager.getInstance().registerOnMessageListener(401012, V2XMessageListener401012())
SocketManager.getInstance().registerOnMessageListener(401018, V2XMessageListener401018())
SocketManager.getInstance().registerOnMessageListener(402000, V2XMessageListener402000())
SocketManager.getInstance().registerOnMessageListener(404000, V2XMessageListener404000())
//SocketManager.getInstance().registerOnMessageListener(503000, V2XMessageListener503000())
SocketManager.getInstance().registerOnMessageListener(70001, V2XMessageListener70001())
context?.let {
SocketManager.getInstance().init(it, 0.0, 0.0)
SocketManager.getInstance().registerOnMessageListener(401012, V2XMessageListener401012())
SocketManager.getInstance().registerOnMessageListener(401018, V2XMessageListener401018())
SocketManager.getInstance().registerOnMessageListener(402000, V2XMessageListener402000())
SocketManager.getInstance().registerOnMessageListener(404000, V2XMessageListener404000())
//SocketManager.getInstance().registerOnMessageListener(503000, V2XMessageListener503000())
SocketManager.getInstance().registerOnMessageListener(70001, V2XMessageListener70001())
}
}
override fun onDestroy() {

View File

@@ -3,12 +3,14 @@ package com.mogo.eagle.core.function.datacenter.autopilot
import android.Manifest.permission
import android.content.Context
import androidx.annotation.RequiresPermission
import bag_manager.BagManagerOuterClass
import chassis.SpecialVehicleTaskCmdOuterClass
import com.alibaba.android.arouter.facade.annotation.Route
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters
import com.mogo.eagle.core.data.autopilot.toAutoPilotLine
import com.mogo.eagle.core.data.autopilot.toRouteInfo
import com.mogo.eagle.core.data.badcase.BagManagerEntity
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.data.constants.MoGoConfig
import com.mogo.eagle.core.data.constants.MogoServicePaths
@@ -52,7 +54,7 @@ import com.zhidao.support.adas.high.common.Constants
import com.zhidao.support.adas.high.common.Constants.IPC_CONNECTION_STATUS
import com.zhidao.support.adas.high.common.CupidLogUtils
import com.zhidao.support.adas.high.common.MessageType
import com.zhidao.support.adas.high.common.MogoReport
import com.zhjt.mogo.adas.data.bean.MogoReport
import com.zhjt.service.chain.ChainLog
import com.zhjt.service.chain.TracingConstants
import io.netty.channel.Channel
@@ -105,7 +107,7 @@ class MoGoAutopilotControlProvider :
.setIpcConnectionMode(AdasOptions.IPC_CONNECTION_MODE.FIXATION)
.setIpcFixationIP(AdasManager.getInstance().getIPCFixationIPList(mContext))
.setClient(false)
.setIdentityMode(FunctionBuildConfig.appIdentityMode)
.setUnableLaunchAutopilotGear(FunctionBuildConfig.unableLaunchAutopilotGear)
// .setSubscribeInterfaceOptions(subscribeInterfaceOptions)//
.build()
@@ -196,7 +198,7 @@ class MoGoAutopilotControlProvider :
val options = AdasOptions
.Builder()
.setClient(true)
.setIdentityMode(FunctionBuildConfig.appIdentityMode)
.setUnableLaunchAutopilotGear(FunctionBuildConfig.unableLaunchAutopilotGear)
.build()
AdasManager.getInstance()
.create(options, MoGoAdasMsgConnectStatusListenerImpl())
@@ -224,7 +226,7 @@ class MoGoAutopilotControlProvider :
.setIpcConnectionMode(AdasOptions.IPC_CONNECTION_MODE.FIXATION)
.setIpcFixationIP(AdasManager.getInstance().getIPCFixationIPList(mContext))
.setClient(false)// 乘客端直连工控机改为false
.setIdentityMode(FunctionBuildConfig.appIdentityMode)
.setUnableLaunchAutopilotGear(FunctionBuildConfig.unableLaunchAutopilotGear)
.build()
AdasManager.getInstance().create(options, MoGoAdasMsgConnectStatusListenerImpl())
//////////////////////////////////注意先后顺序AdasManager.getInstance().create后才可以设置监听/////////////////////////////////////////////
@@ -546,6 +548,108 @@ class MoGoAutopilotControlProvider :
return AdasManager.getInstance().sendRecordDataConfigReq(reqType, recordType, topicsNeedToCache)
}
/**
* 获取数据采集录制模式配置列表
* @param reqType 0: all, 1:获取当前所有topic列表, 2:配置需要预加载的topic组合
* @param recordType 0:不需要修改内置类型的topic组合, 1:需要修改内置类型的topic组合
* @param topicsNeedToCache
* @return boolean
*/
override fun sendBagManagerCmd(bagManagerEntity: BagManagerEntity): Boolean {
val bagManager = BagManagerOuterClass.BagManager
.newBuilder()
.setReqType(bagManagerEntity.reqType)
.setKeyReq(bagManagerEntity.keyReq)
// 更新包附加信息,发送请求且reqType=5时有效
val descReq = BagManagerOuterClass.BagDescription
.newBuilder()
bagManagerEntity.descReq?.let {
descReq.description = it.description
descReq.hasAudio = it.hasAudio
descReq.audioUrl = it.audioUrl
descReq.setReportBI(it.reportBI)
}
bagManager.descReq = descReq.build()
// 空间使用信息,获取响应且reqType=1时有效
for(diskSpaceInfoEntity in bagManagerEntity.spaceInfoResp){
val spaceInfoResp = BagManagerOuterClass.BagSpaceInfo
.newBuilder()
val diskSpaceInfo = BagManagerOuterClass.SpaceInfo
.newBuilder()
.setDirectory(diskSpaceInfoEntity.diskSpaceInfo.directory)
.setTotal(diskSpaceInfoEntity.diskSpaceInfo.total)
.setFree(diskSpaceInfoEntity.diskSpaceInfo.free)
.setUsed(diskSpaceInfoEntity.diskSpaceInfo.used)
.build()
spaceInfoResp
.setHost(diskSpaceInfoEntity.host).diskSpaceInfo = diskSpaceInfo
for(entity in diskSpaceInfoEntity.BagDirsSpaceInfo){
val bagDirsSpaceInfo = BagManagerOuterClass.SpaceInfo
.newBuilder()
.setDirectory(entity.directory)
.setTotal(entity.total)
.setFree(entity.free)
.setUsed(entity.used)
.build()
spaceInfoResp.addBagDirsSpaceInfo(bagDirsSpaceInfo)
}
bagManager.addSpaceInfoResp(spaceInfoResp.build())
}
// 包信息列表,获取响应且reqType=2时有效
for(bagsInfoRespEntity in bagManagerEntity.bagsInfoResp){
if(bagsInfoRespEntity.itemType == 0){
// 包描述信息
val bagDescription = BagManagerOuterClass.BagDescription
.newBuilder()
bagsInfoRespEntity.description?.let {
bagDescription.description = it.description
bagDescription.hasAudio = it.hasAudio
bagDescription.audioUrl = it.audioUrl
bagDescription.setReportBI(it.reportBI)
}
val bagsInfoResp = BagManagerOuterClass.BagInfo
.newBuilder()
.setKey(bagsInfoRespEntity.key)
.setTotalSize(bagsInfoRespEntity.totalSize)
.setTimestamp(bagsInfoRespEntity.timestamp)
.setBagPath(bagsInfoRespEntity.bagPath)
.setMergeStat(bagsInfoRespEntity.mergeStat)
.setUploadStat(bagsInfoRespEntity.uploadStat)
.setDescription(bagDescription.build())
// 子包信息
for(subBagEntity in bagsInfoRespEntity.subBags){
val subBag = BagManagerOuterClass.SubBag
.newBuilder()
.setKey(subBagEntity.key)
.setHost(subBagEntity.host)
.setSize(subBagEntity.size)
.build()
bagsInfoResp.addSubBags(subBag)
}
bagManager.addBagsInfoResp(bagsInfoResp)
}
}
//反馈上传cos桶结果,获取响应且reqType=3时有效
val uploadCosResp = BagManagerOuterClass.UploadCosStat
.newBuilder()
bagManagerEntity.uploadCosResp?.let {
uploadCosResp.key = it.key
uploadCosResp.stat = it.stat
uploadCosResp.message = it.message
bagManager.uploadCosResp = uploadCosResp.build()
}
return AdasManager.getInstance().sendBagManagerCmd(bagManager.build())
}
/**
* 向左变道
*/
@@ -644,27 +748,29 @@ class MoGoAutopilotControlProvider :
}
override fun connectSpecifiedServer(ip: String) {
NSDNettyManager.getInstance().connectSpecifiedServer(
ip,
NettyTcpServer.SERVER_PORT,
MoGoAiCloudClientConfig.getInstance().sn,
object : NettyClientListener<MogoProtocolMsg> {
override fun onMessageResponseClient(
msg: MogoProtocolMsg?,
sign: String?,
channel: Channel
) {
msgHandler.handleMsgFromServer(msg, channel)
}
ThreadUtils.getIoPool().submit {
NSDNettyManager.getInstance().connectSpecifiedServer(
ip,
NettyTcpServer.SERVER_PORT,
MoGoAiCloudClientConfig.getInstance().sn,
object : NettyClientListener<MogoProtocolMsg> {
override fun onMessageResponseClient(
msg: MogoProtocolMsg?,
sign: String?,
channel: Channel
) {
msgHandler.handleMsgFromServer(msg, channel)
}
override fun onClientStatusConnectChanged(
statusCode: Int,
sign: String?,
channel: Channel
) {
msgHandler.handleClientConnStatus(statusCode, sign, channel)
}
})
override fun onClientStatusConnectChanged(
statusCode: Int,
sign: String?,
channel: Channel
) {
msgHandler.handleClientConnStatus(statusCode, sign, channel)
}
})
}
}
/**

View File

@@ -1,6 +1,5 @@
package com.mogo.eagle.core.function.datacenter.autopilot.adapter
import android.content.Context
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
import com.mogo.commons.debug.DebugConfig.*
import com.mogo.eagle.core.data.config.FunctionBuildConfig

View File

@@ -1,7 +1,5 @@
package com.mogo.eagle.core.function.datacenter.location
import com.mogo.commons.AbsMogoApplication
import com.mogo.commons.constants.SharedPrefsConstants
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.data.enums.DataSourceType
import com.mogo.eagle.core.data.map.MogoLocation
@@ -13,7 +11,6 @@ import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ02Lis
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager
import com.mogo.eagle.core.function.call.map.CallerGaoDeMapLocationListenerManager
import com.mogo.eagle.core.function.call.obu.CallerObuLocationWGS84ListenerManager
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr
import com.mogo.eagle.core.utilcode.util.MultiDisplayUtils
import com.mogo.eagle.core.utilcode.util.TimeUtils
import mogo.telematics.pad.MessagePad
@@ -119,25 +116,6 @@ object MoGoLocationDispatcher :
}
}
// 本地SP缓存城市Code
val cityCode = mogoLocation.cityCode
if (cityCode != null && cityCode.isNotEmpty()) {
mCityCode = mogoLocation.cityCode
SharedPrefsMgr.getInstance(AbsMogoApplication.getApp())
.putString(SharedPrefsConstants.LOCATION_CITY_CODE, cityCode)
SharedPrefsMgr.getInstance(AbsMogoApplication.getApp())
.putString(
SharedPrefsConstants.LOCATION_LATITUDE,
mogoLocation.latitude.toString()
)
SharedPrefsMgr.getInstance(AbsMogoApplication.getApp())
.putString(
SharedPrefsConstants.LOCATION_LONGITUDE,
mogoLocation.longitude.toString()
)
}
}
/**

View File

@@ -4,6 +4,7 @@ import android.content.Context
import com.alibaba.android.arouter.facade.annotation.Route
import com.mogo.eagle.core.data.constants.MoGoConfig
import com.mogo.eagle.core.data.constants.MogoServicePaths
import com.mogo.eagle.core.data.obu.MogoObuConst
import com.mogo.eagle.core.function.api.obu.IMoGoObuProvider
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_OBU
@@ -18,7 +19,6 @@ import com.mogo.eagle.core.utilcode.util.CommonUtils
class MoGoObuProvider : IMoGoObuProvider {
private val TAG = "MoGoObuProvider"
private var mContext: Context? = null
private val taxiObuIp = "192.168.1.199" //obu的taxi和bus的ip已经全部统一成1网段ip
override val functionName: String
get() = TAG
@@ -36,7 +36,7 @@ class MoGoObuProvider : IMoGoObuProvider {
mContext = context
mContext?.let {
val ipAddress =
SharedPrefsMgr.getInstance(context).getString(MoGoConfig.OBU_IP, taxiObuIp)
SharedPrefsMgr.getInstance(context).getString(MoGoConfig.OBU_IP, MogoObuConst.OBU_DEFAULT_IP)
//mogo obu
MogoPrivateObuNewManager.INSTANCE.connectObu(
it,
@@ -44,6 +44,9 @@ class MoGoObuProvider : IMoGoObuProvider {
CommonUtils.getIpAddressString()
)
}
//监听obu版本数据
MogoPrivateObuNewManager.INSTANCE.readSystemConfig()
}
/**
@@ -74,4 +77,12 @@ class MoGoObuProvider : IMoGoObuProvider {
override fun setObuLog(isChecked: Boolean) {
MogoPrivateObuNewManager.INSTANCE.setObuLog(isChecked)
}
override fun uploadObuPack(filePathArray: Array<String>) {
MogoPrivateObuNewManager.INSTANCE.uploadObuPack(filePathArray)
}
override fun deleteObuFile() {
MogoPrivateObuNewManager.INSTANCE.deleteObuFile()
}
}

View File

@@ -229,6 +229,7 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuWarningRsiListener
//限速预警, ADD处理一次
MogoObuConstants.RSI_SCENE_TYPE.SLW.toString() -> {
appId = EventTypeEnumNew.TYPE_USECASE_ID_ROAD_SPEED_LIMIT.poiType
alertContent = EventTypeEnumNew.getWarningContent(appId)
ttsContent = EventTypeEnumNew.getWarningTts(appId)
}
@@ -241,6 +242,9 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuWarningRsiListener
when (status) {
// 添加
MogoObuConstants.STATUS.ADD -> {
if (alertContent.isEmpty() || ttsContent.isEmpty()) {
return
}
saveObuToDcData(appId, alertContent, ttsContent)
showWarning(appId, alertContent, ttsContent, direction)
}
@@ -501,6 +505,9 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuWarningRsiListener
"${M_OBU}${TAG}",
"MogoObuDcCombineManager changeTrafficLightStatus 闯红灯 --------> ttsContent = $ttsContent ---alertContent = $alertContent "
)
if (alertContent.isEmpty() || ttsContent.isEmpty()) {
return
}
saveObuToDcData(EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType, alertContent, ttsContent)
showWarning(EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType, alertContent, ttsContent, WarningDirectionEnum.ALERT_WARNING_NON)
}
@@ -538,6 +545,9 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuWarningRsiListener
)
val maxSpeed = currentLight.suggestMaxSpeed * 3.6
if (maxSpeed > 0) {
if (alertContent.isEmpty() || ttsContent.isEmpty()) {
return
}
saveObuToDcData(EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType, alertContent, ttsContent)
showWarning(EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType, alertContent, ttsContent, WarningDirectionEnum.ALERT_WARNING_NON)
}

View File

@@ -4,10 +4,12 @@ import android.content.Context
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.data.config.HmiBuildConfig
import com.mogo.eagle.core.data.enums.*
import com.mogo.eagle.core.data.obu.MogoObuConst
import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWarningStatusListener
import com.mogo.eagle.core.function.api.map.angle.Default
import com.mogo.eagle.core.function.api.map.angle.TooClose
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
import com.mogo.eagle.core.function.call.map.CallerVisualAngleManager
@@ -18,8 +20,10 @@ import com.mogo.eagle.core.function.call.obu.CallerObuWarningListenerManager
import com.mogo.eagle.core.function.call.v2x.CallerLimitingVelocityListenerManager
import com.mogo.eagle.core.function.call.v2x.CallerTrafficLightListenerManager
import com.mogo.eagle.core.function.datacenter.obu.utils.TrafficDataConvertUtilsNew
import com.mogo.eagle.core.utilcode.breakpoint.Config
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_OBU
import com.mogo.eagle.core.utilcode.util.FileUtils
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
import com.mogo.support.obu.ObuBase
import com.mogo.support.obu.ObuScene
@@ -31,6 +35,8 @@ import com.mogo.support.obu.model.*
import com.mogo.support.obu.option.MogoObuCom
import com.mogo.support.obu.option.MogoObuLog
import com.mogo.support.obu.option.MogoObuOptions
import com.mogo.support.obu.upgrade.ObuSoftwareUpgradeStatus
import com.mogo.support.obu.upgrade.OnUpgradeListener
import com.zhidao.support.obu.ObuManager
import com.zhidao.support.obu.OnObuListener
import mogo.telematics.pad.MessagePad
@@ -42,7 +48,7 @@ import kotlin.math.roundToInt
* @since 2021/8/23
* @description 自研OBU 管理
*/
class MogoPrivateObuNewManager private constructor() {
class MogoPrivateObuNewManager private constructor() : OnUpgradeListener {
companion object {
val INSTANCE: MogoPrivateObuNewManager by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) {
MogoPrivateObuNewManager()
@@ -50,9 +56,12 @@ class MogoPrivateObuNewManager private constructor() {
}
private var mObuStatusInfo = CallerObuConnectListenerManager.getObuStatusInfo()
private var mContext: Context? = null
var mVersionName: String? = null
fun connectObu(context: Context, obuIpAddress: String, padIpAddress: String) {
ObuManager.getInstance().registerObuListener(mogoObuListener)
mContext = context
val com = MogoObuCom.newBuilder()
.setLocalIp(padIpAddress)
.setComType(MogoObuComType.UDP)
@@ -82,6 +91,65 @@ class MogoPrivateObuNewManager private constructor() {
ObuManager.getInstance().connect(options)
}
/**
* 上传obu文件的状态, 升级成功需要删除obu的文件和解压文件夹
*/
override fun onUpgradeStatus(status: ObuSoftwareUpgradeStatus?, t: Throwable?) {
CallerLogger.d("$M_OBU${MogoObuConst.TAG_UPGRADE_OBU}", "onUpgradeStatus status = $status ")
//上传完成就相当于成功了,立即升级,比上电升级,只是多了一个重启
if (status == ObuSoftwareUpgradeStatus.UPLOAD_FINISH|| status == ObuSoftwareUpgradeStatus.EXEC_UPGRADE_PROGRAM_FINISH
|| status == ObuSoftwareUpgradeStatus.CONNECTION_FAILED|| status == ObuSoftwareUpgradeStatus.AUTHENTICATION_FAILED
|| status == ObuSoftwareUpgradeStatus.CHANNEL_ABNORMITY|| status == ObuSoftwareUpgradeStatus.UPGRADE_PACKAGE_ERROR
|| status == ObuSoftwareUpgradeStatus.UPGRADE_PACKAGE_CHECK_FAILED || status == ObuSoftwareUpgradeStatus.PACKAGE_UPLOAD_FAILED
|| status == ObuSoftwareUpgradeStatus.EXEC_UPGRADE_PROGRAM_FAILED || status == ObuSoftwareUpgradeStatus.UNKNOWN) {
deleteObuFile()
}
}
/**
* 当前的obu版本
*/
override fun onCurrentVersion(version: MogoObuSystemBConfigData) {
CallerLogger.d("$M_OBU${MogoObuConst.TAG_UPGRADE_OBU}", "onCurrentVersion version = ${version.version}")
if (!version.version.isNullOrEmpty()) {
mVersionName = version.version
CallerDevaToolsManager.queryObuUpgrade(version.version)
}
}
/**
* 删除obu相关的文件夹
*/
fun deleteObuFile(){
UiThreadHandler.post {
var isDeleteSuccess = FileUtils.delete(Config.downLoadObuPath)
var isDeleteUnzipSuccess = FileUtils.delete(Config.downLoadUnzipObuPath)
CallerLogger.d("$M_OBU${MogoObuConst.TAG_UPGRADE_OBU}", "deleteObuFile isDeleteSuccess = $isDeleteSuccess ----isDeleteUnzipSuccess = $isDeleteUnzipSuccess")
}
}
/**
* 监听obu
*/
fun readSystemConfig() {
ObuManager.getInstance().readSystemBConfig(mContext, MogoObuConst.OBU_DEFAULT_IP, this)
}
/**
* 传递obu升级包给硬件
* @param upgradePackage 升级包文件绝对路径 只能包含 升级包MD5文件和升级包文件
* @param isUpgradeNow 是否立即升级
* falseOBU设备下次上电时执行升级程序
* ture: OBU设备立即执行升级程序 TODO 警告:执行立即升级时请确保车辆是静止状态。车辆在运行过程中升级设备可能会影响驾驶,严重时可能造成安全隐患!!!
* @param listener 升级回调
* @return 是否调用成功
*/
fun uploadObuPack(filePathArray: Array<String>) {
CallerLogger.d("$M_OBU${MogoObuConst.TAG_UPGRADE_OBU}", " uploadObuPack filePathArray = $filePathArray")
ObuManager.getInstance().uploadUpgradePackage(MogoObuConst.OBU_DEFAULT_IP, filePathArray,true,this)
}
/**
* 断开新obu
*/
@@ -100,6 +168,9 @@ class MogoPrivateObuNewManager private constructor() {
return ObuManager.getInstance().connectStatus == MogoObuConstants.CONNECT_STATUS.CONNECTED
}
/**
* 设置obu sdk日志的输出
*/
fun setObuLog(isChecked: Boolean) {
ObuManager.getInstance().setEnableLog(isChecked)
val builder: MogoObuLog.Builder =
@@ -110,6 +181,9 @@ class MogoPrivateObuNewManager private constructor() {
ObuManager.getInstance().logConfig(builder.build())
}
/**
* obu 回调监听
*/
private val mogoObuListener: OnObuListener = object : OnObuListener {
/**
* 连接状态的改变
@@ -154,11 +228,14 @@ class MogoPrivateObuNewManager private constructor() {
if (HmiBuildConfig.isShowObuV2vView) {
if (data.warningMsg != null) {
// 更新数据远车数据之前要匹配uuid
TrafficDataConvertUtilsNew.cvxRvInfoIndInfo2TrafficData(data.vehBasicsMsg)
?.let {
CallerMapUIServiceManager.getMarkerService()
?.updateITrafficLocationInfo(it)
}
data.vehBasicsMsg?.let {
TrafficDataConvertUtilsNew.cvxRvInfoIndInfo2TrafficData(it)
?.let { data ->
CallerMapUIServiceManager.getMarkerService()?.updateITrafficLocationInfo(data)
}
}.also {
CallerLogger.e("$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}", "cvxRvInfoIndInfo2TrafficData 数据转换异常,请检查参数是否齐全")
}
CallerLogger.d("$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}", data.toString())
//预警信息,预警类型 threat_level 2、3
@@ -607,12 +684,9 @@ class MogoPrivateObuNewManager private constructor() {
when (appId) {
//前向碰撞预警
MogoObuConstants.V2X_WARNING_TYPE.FCW.toString() -> {
if (FunctionBuildConfig.isObuWarningFusionUnion) {
if (FunctionBuildConfig.isObuWarningFusionUnion && level == 3) {
alertContent = "前车距离过近"
ttsContent = "前车距离过近"
CallerObuWarningListenerManager.invokeTrackerFusionData(
ObuManager.getInstance().obuRvToTrackedObject(info)
)
} else {
alertContent =
EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_FCW.poiType)
@@ -952,7 +1026,12 @@ class MogoPrivateObuNewManager private constructor() {
* 保存obu直连数据到消息盒子
*/
private fun saveObuData(type: String, content: String, tts: String) {
CallerObuSaveMessageListenerManager.invokeObuSaveMessage(type, content, tts, DataSourceType.OBU)
CallerObuSaveMessageListenerManager.invokeObuSaveMessage(
type,
content,
tts,
DataSourceType.OBU
)
}
/**

View File

@@ -6,9 +6,6 @@ import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_OBU
import com.mogo.support.obu.ObuBase
import com.mogo.support.obu.ObuScene
import com.mogo.support.obu.model.MogoObuRsiWarningData
import com.mogo.support.obu.model.MogoObuRsmWarningData
import com.mogo.support.obu.model.MogoObuRvWarningData
/**
* @description 自研obu数据转换
@@ -23,10 +20,6 @@ object TrafficDataConvertUtilsNew {
* OBU 远车 转换交通元素数据,是否需要
*/
fun cvxRvInfoIndInfo2TrafficData(info: ObuBase.VehicleBasics): TrafficData? {
if (info == null) {
CallerLogger.e("$M_OBU$TAG", "cvxRvInfoIndInfo2TrafficData 数据转换异常,请检查参数是否齐全")
return null
}
val trafficData = TrafficData()
trafficData.type = TrafficTypeEnum.TYPE_TRAFFIC_ID_TA_CHE
trafficData.uuid = info.id
@@ -59,7 +52,7 @@ object TrafficDataConvertUtilsNew {
* OBU 预警事件 转换交通元素数据 他车预警
*/
fun cvxV2vThreatIndInfo2TrafficData(info: ObuScene.RvWarningData): TrafficData? {
if (info?.vehBasicsMsg == null || info.warningMsg == null) {
if (info.vehBasicsMsg == null || info.warningMsg == null) {
CallerLogger.e("$M_OBU$TAG", "数据转换异常,请检查参数是否齐全")
return null
}
@@ -70,7 +63,7 @@ object TrafficDataConvertUtilsNew {
trafficData.heading = info.vehBasicsMsg.heading
trafficData.speed = info.vehBasicsMsg.speed
// 判断车辆V2X预警级别调整车辆颜色
if (info.warningMsg.warningDataList != null) {
if (info.warningMsg.warningDataList != null && info.warningMsg.warningDataList.size > 0) {
trafficData.threatLevel = info.warningMsg.warningDataList[0].warningLevel
} else {
trafficData.threatLevel = 1
@@ -123,7 +116,7 @@ object TrafficDataConvertUtilsNew {
}
// 判断车辆V2X预警级别调整车辆颜色
if (info.warningMsg != null && info.warningMsg.warningDataList != null) {
if (info.warningMsg != null && info.warningMsg.warningDataList != null && info.warningMsg.warningDataList.size > 0) {
trafficData.threatLevel = info.warningMsg.warningDataList[0].warningLevel
} else {
trafficData.threatLevel = 1

View File

@@ -158,6 +158,10 @@ class DevaToolsProvider : IDevaToolsProvider {
BadCaseManager.showBadCaseConfigWindow(ctx)
}
override fun showBadCaseManagerView(context: Context) {
BadCaseManager.showBadCaseManagerWindow(context)
}
override fun downLoadPackage(downloadKey: String, downloadUrl: String) {
upgradeManager.downLoadPackage(mContext!!, downloadKey, downloadUrl)
}
@@ -239,4 +243,8 @@ class DevaToolsProvider : IDevaToolsProvider {
}
override fun apmEnvProvider(): IApmEnvProvider = apmEnvProvider
override fun queryObuUpgrade(obuVersionName: String) {
bindingCarManager.queryObuUpgrade(obuVersionName)
}
}

View File

@@ -2,12 +2,16 @@ package com.zhjt.mogo_core_function_devatools.apm
import android.os.Process
import android.text.TextUtils
import android.util.*
import android.widget.Toast
import com.mogo.commons.debug.DebugConfig
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_ALIAS_CODE_INIT_ENV_RESTART
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_LINK_INIT
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_LINK_LOG_CONNECT_STATUS
import com.mogo.eagle.core.function.api.devatools.apm.*
import com.mogo.eagle.core.utilcode.util.*
import com.zhjt.mogo_core_function_devatools.apm.config.*
import com.zhjt.service.chain.ChainLog
import com.zhjt.service.chain.TracingConstants.Endpoint.Companion.PAD
import kotlinx.coroutines.*
import java.util.concurrent.atomic.AtomicBoolean
import java.util.concurrent.atomic.AtomicReference
@@ -53,7 +57,6 @@ object ApmEnvProviderImpl: IApmEnvProvider, CoroutineScope {
return
}
launch {
Log.d(TAG, "onEnvChanged[1]:[buildType: $buildType, netType:$netType, dockerVersion:$dockerVersion]")
var buildTypeChanged = false
if (ApmEnvConfig.getBuildType() != buildType) {
buildTypeChanged = true
@@ -80,10 +83,9 @@ object ApmEnvProviderImpl: IApmEnvProvider, CoroutineScope {
isEnvValid = buildType == "0" || (buildType == "1" && netType == DebugConfig.NET_MODE_RELEASE.toString() && dockerVersion.endsWith("release", true))
}
val appRelaunched = ApmEnvConfig.isAppRelaunched()
Log.d(TAG, "onEnvChanged[2]: buildTypeChanged: $buildTypeChanged, netTypeChanged: $netTypeChanged, dockerVersionChanged:$dockerVersionChanged], isAppLaunched:$appRelaunched")
if ((!isEnvValid || (buildTypeChanged || netTypeChanged || dockerVersionChanged)) && !appRelaunched) {
ApmEnvConfig.setAppRelaunched(true)
restartApp()
restartApp("buildType:$buildType,netType:$netType,dockerVersion:$dockerVersion")
return@launch
}
if (isFirstDockerVersionSet) {
@@ -108,9 +110,16 @@ object ApmEnvProviderImpl: IApmEnvProvider, CoroutineScope {
}
}
private fun restartApp() {
@ChainLog(
linkChainLog = CHAIN_LINK_LOG_CONNECT_STATUS,
linkCode = CHAIN_LINK_INIT,
endpoint = PAD,
nodeAliasCode = CHAIN_ALIAS_CODE_INIT_ENV_RESTART,
paramIndexes = [0],
clientPkFileName = "sn"
)
private fun restartApp(envStr:String) {
launch(Dispatchers.Main) {
Log.d(TAG, "restartApp ---")
Toast.makeText(Utils.getApp(), "发现系统环境不一致,正在重启...", Toast.LENGTH_SHORT).show()
delay(50)
Utils.getApp().startActivity(Utils.getApp().packageManager.getLaunchIntentForPackage(Utils.getApp().packageName))

View File

@@ -101,6 +101,22 @@ internal object BadCaseManager : LifecycleEventObserver, IMoGoAutopilotRecordLis
}
}
/**
* 展示BadCase录包管理页面
*/
fun showBadCaseManagerWindow(context: Context){
val badCaseManagerView = BadCaseManagerView(context)
badCaseManagerView.setOnClickListener(object: BadCaseManagerView.ClickListener{
override fun onClose() {
hideFloat?.invoke()
hideFloat = null
}
})
context.enqueuePop(badCaseManagerView,AutoSizeUtils.dp2px(context,960f), WindowManager.LayoutParams.MATCH_PARENT, key = "BadCaseManagerView").also {
hideFloat = it
}
}
/**
* 主动采集BadCase
*/

View File

@@ -20,7 +20,6 @@ import com.zhjt.mogo_core_function_devatools.badcase.biz.adapter.RecordTemplateA
import com.zhjt.mogo_core_function_devatools.badcase.consts.BadCaseConfig
import kotlinx.android.synthetic.main.layout_badcase_config.view.*
import mogo.telematics.pad.MessagePad
import java.lang.Exception
/**

View File

@@ -0,0 +1,521 @@
package com.zhjt.mogo_core_function_devatools.badcase.biz
import android.app.Activity
import android.content.Context
import android.graphics.Color
import android.graphics.drawable.ColorDrawable
import android.os.Handler
import android.util.AttributeSet
import android.util.Log
import android.view.LayoutInflater
import android.view.View
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.recyclerview.widget.LinearLayoutManager
import bag_manager.BagManagerOuterClass
import com.mogo.eagle.core.data.badcase.BagDescriptionEntity
import com.mogo.eagle.core.data.badcase.BagInfoEntity
import com.mogo.eagle.core.data.badcase.BagManagerEntity
import com.mogo.eagle.core.data.badcase.SubBagEntity
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotRecordListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotRecordListenerManager
import com.mogo.eagle.core.utilcode.util.ToastUtils
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
import com.zhidao.loglib.download.DownloadManager
import com.zhjt.mogo_core_function_devatools.R
import com.zhjt.mogo_core_function_devatools.badcase.biz.adapter.BagManagerListAdapter
import com.zhjt.mogo_core_function_devatools.badcase.consts.BadCaseConfig.bagManagerList
import com.zhjt.mogo_core_function_devatools.badcase.record.Audition
import kotlinx.android.synthetic.main.layout_badcase_manager.view.*
import java.util.*
/**
* @author XuXinChao
* @description BadCase录包管理页面
* @since: 2022/12/15
*/
class BadCaseManagerView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : ConstraintLayout(context, attrs, defStyleAttr), IMoGoAutopilotRecordListener {
companion object {
const val TAG = "BadCaseManagerView"
}
private var bagManagerListAdapter: BagManagerListAdapter ?= null
private var bagManagerEntity: BagManagerEntity = BagManagerEntity()
private var clickListener: ClickListener? = null
private var bagUploadDialog: BagUploadDialog ?= null
private var spaceTotal: Long = 0 //总空间
private var spaceUsed: Long = 0 //已用空间
private var spaceFree: Long = 0 //可用空间
private var selectedBagNum = 0 //选中Bag包的数量
private var selectedBagSize: Long = 0 //选中Bag包的大小
private val audioSavePath = "/mnt/sdcard/mogo/"
private var isNameModify = false
private val deleteDataList: ArrayList<BagInfoEntity> = ArrayList()
init {
LayoutInflater.from(context).inflate(R.layout.layout_badcase_manager, this, true)
initView()
}
private fun initView(){
background = ColorDrawable(Color.parseColor("#F0151D41"))
clLayout.setOnClickListener {
}
//关闭BadCase管理窗口
ivManagerClose.setOnClickListener {
clickListener?.onClose()
}
//一键全选
tvSelectAll.setOnClickListener {
if(bagManagerEntity.bagsInfoResp.size>0){
selectedBagSize = 0
selectedBagNum = 0
bagManagerList.clear()
for(selectBagInfo in bagManagerEntity.bagsInfoResp){
if(selectBagInfo.itemType == 0){
selectBagInfo.selectStatus = true
selectedBagSize += selectBagInfo.totalSize
bagManagerList.add(selectBagInfo)
selectedBagNum++
}
}
//显示选择包的个数和大小
tvSelectedBagSize.text = "已选${selectedBagNum}个包,共${selectedBagSize/(1000*1024*1024)}G"
tvSelectedBagSize.visibility = View.VISIBLE
bagManagerListAdapter?.setData(bagManagerEntity.bagsInfoResp)
}
}
//取消选中
tvCancelSelect.setOnClickListener {
if(bagManagerEntity.bagsInfoResp.size>0){
for(cancelBagInfo in bagManagerEntity.bagsInfoResp){
cancelBagInfo.selectStatus = false
bagManagerList.remove(cancelBagInfo)
}
selectedBagNum = 0
selectedBagSize = 0
tvSelectedBagSize.visibility = View.GONE
bagManagerListAdapter?.setData(bagManagerEntity.bagsInfoResp)
}
}
//上传Cos桶
tvUploadCloud.setOnClickListener {
if(bagManagerList.size>0){
bagManagerEntity.reqType = 3
bagManagerEntity.keyReq = bagManagerList[0].key
Log.i("sendBagManagerCmd","bagManagerEntity.keyReq="+bagManagerEntity.keyReq)
CallerAutoPilotControlManager.sendBagManagerCmd(bagManagerEntity)
bagUploadDialog = BagUploadDialog(context)
bagUploadDialog?.setListener { //删除选择,取消上传
bagManagerList.clear()
if (bagManagerEntity.bagsInfoResp.size > 0) {
for (cancelBagInfo in bagManagerEntity.bagsInfoResp) {
if(cancelBagInfo.itemType == 0){
cancelBagInfo.selectStatus = false
bagManagerList.remove(cancelBagInfo)
}
}
selectedBagNum = 0
selectedBagSize = 0
tvSelectedBagSize.visibility = View.GONE
bagManagerListAdapter?.setData(bagManagerEntity.bagsInfoResp)
}
}
bagUploadDialog?.show()
bagUploadDialog?.setAllUpload(selectedBagNum,selectedBagSize)
}else{
ToastUtils.showShort("请先选择要上传的Bag包")
}
}
//删除Bag包
tvDeleteSelect.setOnClickListener {
if(bagManagerList.size>0){
bagManagerEntity.reqType = 4
bagManagerEntity.keyReq = bagManagerList[0].key
CallerAutoPilotControlManager.sendBagManagerCmd(bagManagerEntity)
}else{
ToastUtils.showShort("请先选择要删除的Bag包")
}
}
bagManagerListAdapter = BagManagerListAdapter()
bagManagerListAdapter?.setListener(object :BagManagerListAdapter.BagClickListener{
override fun onClick(bagInfoEntity: BagInfoEntity, isChecked: Boolean) {
if(isChecked){
bagInfoEntity.selectStatus = true
bagManagerList.add(bagInfoEntity)
selectedBagNum++
selectedBagSize += bagInfoEntity.totalSize
tvSelectedBagSize.text = "已选${selectedBagNum}个包,共${selectedBagSize/(1000*1024*1024)}G"
tvSelectedBagSize.visibility = View.VISIBLE
}else{
bagInfoEntity.selectStatus = false
bagManagerList.remove(bagInfoEntity)
selectedBagNum--
selectedBagSize -= bagInfoEntity.totalSize
if(selectedBagNum == 0){
tvSelectedBagSize.visibility = View.GONE
}else{
tvSelectedBagSize.text = "已选${selectedBagNum}个包,共${selectedBagSize/(1000*1024*1024)}G"
tvSelectedBagSize.visibility = View.VISIBLE
}
}
}
override fun uploadBI(bagInfoEntity: BagInfoEntity) {
//展示上报弹窗
val initiativeBadCaseWindow = InitiativeBadCaseWindow(context as Activity)
initiativeBadCaseWindow.setClickListener(object: InitiativeBadCaseWindow.ClickListener{
override fun closeWindow() {
initiativeBadCaseWindow.hideFloatWindow()
}
})
initiativeBadCaseWindow.showReportBIWindow(bagInfoEntity)
}
override fun editDescription(key: Long, description: BagDescriptionEntity) {
//编辑Bag包描述信息
isNameModify = true
bagManagerEntity.reqType = 5
bagManagerEntity.keyReq = key
bagManagerEntity.descReq = description
CallerAutoPilotControlManager.sendBagManagerCmd(bagManagerEntity)
}
override fun bagAudio(key: Long, audioUrl: String) {
DownloadManager.getInstance().init(context)
val downUrl = audioUrl.replace("http://petchfile-1255510688.cos.ap-beijing.myqcloud.com/","")
DownloadManager.getInstance().download(downUrl,
audioSavePath,"${key}.wav")
//延迟播放
Handler().postDelayed({
//音频文件播放
Audition.getInstance().playOrStop("${audioSavePath}${key}.wav")
}, 1500)
}
})
val linearLayoutManager = LinearLayoutManager(context)
rvBagList.layoutManager = linearLayoutManager
rvBagList.adapter = bagManagerListAdapter
//音频文件播放
// Audition.getInstance().playOrStop("/mnt/sdcard/mogo/test.wav")
//
// 音频下载
// DownloadManager.getInstance().init(context)
// DownloadManager.getInstance().download("CarPad/mogopadlog/X20202111230C01YYW/2023-01-30/Audio_1675049657187_BadCase.wav",
// "/mnt/sdcard/mogo/","test13.wav")
}
fun setOnClickListener(clickListener: ClickListener) {
this.clickListener = clickListener
}
interface ClickListener {
fun onClose()
}
override fun onBagManagerResult(bagManager: BagManagerOuterClass.BagManager) {
super.onBagManagerResult(bagManager)
UiThreadHandler.post {
Log.i(TAG,"onBagManagerResult Start")
Log.i(TAG,"keyReq="+bagManager.keyReq)
Log.i(TAG,"reqType="+bagManager.reqType)
Log.i(TAG,"uploadCosResp stat="+bagManager.uploadCosResp.stat)
Log.i(TAG,"descReq description="+bagManager.descReq.description
+" audioUrl="+bagManager.descReq.audioUrl
+" reportBI="+bagManager.descReq.reportBI
+" hasAudio="+bagManager.descReq.hasAudio)
for(logBag in bagManager.bagsInfoRespList){
Log.i(TAG,"bagPath="+logBag.bagPath)
Log.i(TAG,"timestamp="+logBag.timestamp)
Log.i(TAG,"description="+logBag.description)
Log.i(TAG,"key="+logBag.key)
Log.i(TAG,"mergeStat="+logBag.mergeStat)
Log.i(TAG,"totalSize="+logBag.totalSize)
Log.i(TAG,"uploadStat="+logBag.uploadStat)
}
Log.i(TAG,"onBagManagerResult End")
//获取空间使用信息
if(bagManager.reqType == 1){
//遍历各个主机的硬盘空间信息
if(bagManager.spaceInfoRespCount>0){
spaceTotal = 0
spaceUsed = 0
spaceFree = 0
for(spaceInfo in bagManager.spaceInfoRespList){
spaceInfo.diskSpaceInfo?.let {
spaceTotal += it.total
spaceUsed += it.used
spaceFree += it.free
}
}
//展示空间使用情况
//已使用空间
tvUsedSpaceContent.text = "${(spaceUsed/(1000*1024*1024L))}G"
//可使用空间
tvFreeSpaceContent.text = "${(spaceFree/(1000*1024*1024L))}G"
//进度条展示空间
pbSpacePercent.progress = (spaceUsed*100/spaceTotal).toInt()
}
}
//遍历所有bag
else if(bagManager.reqType == 2){
clBagHaveDataLayout.visibility = View.VISIBLE
clBagNoDataLayout.visibility = View.GONE
if(bagManager.bagsInfoRespCount>0){
bagManagerEntity.bagsInfoResp.clear()
val originBagInfoList = ArrayList<BagInfoEntity>()
for(bagInfo in bagManager.bagsInfoRespList){
bagInfo?.let {
val descriptionEntity = BagDescriptionEntity(it.description.description,it.description.hasAudio,it.description.audioUrl,it.description.reportBI)
val bagInfoEntity = BagInfoEntity()
bagInfoEntity.key = it.key
bagInfoEntity.totalSize = it.totalSize
bagInfoEntity.timestamp = it.timestamp
bagInfoEntity.bagPath = it.bagPath
bagInfoEntity.mergeStat = it.mergeStat
bagInfoEntity.uploadStat = it.uploadStat
bagInfoEntity.itemType = 0
bagInfoEntity.description = descriptionEntity
for(subBag in it.subBagsList){
val subBagEntity = SubBagEntity(subBag.key,subBag.host,subBag.size)
bagInfoEntity.subBags.add(subBagEntity)
}
originBagInfoList.add(bagInfoEntity)
//对数组按照时间顺序进行倒序排序
originBagInfoList.sortWith(Comparator { o1, o2 ->
o2.timestamp.compareTo(o1.timestamp)
})
}
}
for(originBagInfo in originBagInfoList){
originBagInfo.let {
it.timestamp.let { time ->
val month = time.substring(4,6)
val day = time.substring(6,8)
val timeStr = "${month}${day}"
var containTime = false
for(bag in bagManagerEntity.bagsInfoResp){
if(bag.timeStr == timeStr){
containTime = true
}
}
if(!containTime || bagManagerEntity.bagsInfoResp.size ==0){
//增加时间的
val bagInfoTimeEntity = BagInfoEntity()
bagInfoTimeEntity.itemType = 1
bagInfoTimeEntity.timeStr = timeStr
bagInfoTimeEntity.timestamp = time.substring(0,8)
bagManagerEntity.bagsInfoResp.add(bagInfoTimeEntity)
}
var containKey = false
for(bagInfoContain in bagManagerEntity.bagsInfoResp){
if(bagInfoContain.key == it.key){
containKey = true
}
}
if(!containKey){
bagManagerEntity.bagsInfoResp.add(it)
}
}
}
}
//更新List
bagManagerListAdapter?.setData(bagManagerEntity.bagsInfoResp)
}
// 开启定时查询速度
Timer().schedule(timerTaskRefresh, Date(), 60*1000)
}
//上传Cos
else if(bagManager.reqType == 3){
//此处应循环上传Cos
val uploadIterator = bagManagerEntity.bagsInfoResp.iterator()
while(uploadIterator.hasNext()){
val uploadBagInfo = uploadIterator.next()
if(uploadBagInfo.key == bagManager.uploadCosResp.key && bagManager.uploadCosResp.stat!=1){
bagManagerList.remove(uploadBagInfo)
if(bagManagerList.size>0){
var remainSize = 0L
for(bagInfo in bagManagerList){
remainSize += bagInfo.totalSize
}
bagUploadDialog?.updateRemainUpload(bagManagerList.size,remainSize)
//执行下一个上传Bag命令
bagManagerEntity.reqType = 3
bagManagerEntity.keyReq = bagManagerList[0].key
Log.i("sendBagManagerCmd","bagManagerEntity.keyReq="+bagManagerEntity.keyReq)
CallerAutoPilotControlManager.sendBagManagerCmd(bagManagerEntity)
}
}
}
//上传Cos执行完成
if(bagManagerList.size == 0 && selectedBagNum != 0){
ToastUtils.showShort("上传命令完成")
bagUploadDialog?.uploadCompleted()
tvCancelSelect.performClick()
}
when (bagManager.uploadCosResp.stat) {
0 -> {
ToastUtils.showShort("${bagManager.uploadCosResp.key} 上传cos桶成功")
}
1 -> {
//执行中
}
2 -> {
ToastUtils.showShort("${bagManager.uploadCosResp.key} 上传cos桶执行python失败")
}
3 -> {
ToastUtils.showShort("${bagManager.uploadCosResp.key} 上传cos桶拷贝过程失败")
}
4 -> {
ToastUtils.showShort("${bagManager.uploadCosResp.key} 上传cos桶合并过程失败")
}
5 -> {
ToastUtils.showShort("${bagManager.uploadCosResp.key} 上传cos桶上传过程失败")
}
else -> {
ToastUtils.showShort("${bagManager.uploadCosResp.key} 上传cos桶 ${bagManager.uploadCosResp.message}")
}
}
}
//删除Bag
else if(bagManager.reqType == 4){
//收到此回调就删除对应key的Bag
val iterator = bagManagerEntity.bagsInfoResp.iterator()
while(iterator.hasNext()){
val deleteBagInfo = iterator.next()
if(deleteBagInfo.key == bagManager.keyReq){
iterator.remove()
bagManagerList.remove(deleteBagInfo)
//更新列表
// bagManagerListAdapter?.setData(bagManagerEntity.bagsInfoResp)
}
}
//遍历列表如当天Bag全部删除同时把日期标题也删除更新列表
deleteDataList.clear()
val titleIterator = bagManagerEntity.bagsInfoResp.iterator()
while(titleIterator.hasNext()){
val titleBagInfo = titleIterator.next()
if(titleBagInfo.itemType == 1){
val bagIterator = bagManagerEntity.bagsInfoResp.iterator()
var hasBag = false
var bagBagInfo: BagInfoEntity ?= null
while(bagIterator.hasNext()){
bagBagInfo = bagIterator.next()
if(bagBagInfo.itemType == 0){
bagBagInfo.timestamp.let {
if(it.contains(titleBagInfo.timestamp)){
hasBag = true
}
}
}
}
if(!hasBag){
// bagIterator.remove()
titleBagInfo.let { deleteDataList.add(it) }
}
}
}
if(deleteDataList.isNotEmpty()){
val deleteIterator = bagManagerEntity.bagsInfoResp.iterator()
while(deleteIterator.hasNext()){
val deleteInfo = deleteIterator.next()
if(deleteDataList.contains(deleteInfo)){
deleteIterator.remove()
}
}
}
if(bagManagerList.size == 0){
tvCancelSelect.performClick()
}
if(bagManagerList.size>0){
//继续执行删除命令
bagManagerEntity.reqType = 4
bagManagerEntity.keyReq = bagManagerList[0].key
CallerAutoPilotControlManager.sendBagManagerCmd(bagManagerEntity)
}
//更新列表
bagManagerListAdapter?.setData(bagManagerEntity.bagsInfoResp)
}
//修改bag附加信息
else if(bagManager.reqType == 5){
//更新Bag包上报状态
for(bagInfo in bagManagerEntity.bagsInfoResp){
if(bagInfo.key == bagManager.keyReq){
bagInfo.description?.let {
it.reportBI = bagManager.descReq.reportBI
it.description = bagManager.descReq.description
it.hasAudio = bagManager.descReq.hasAudio
it.audioUrl = bagManager.descReq.audioUrl
}
}
}
if(!isNameModify){
//更新List
bagManagerListAdapter?.setData(bagManagerEntity.bagsInfoResp)
}
isNameModify = false
}
}
}
override fun onAttachedToWindow() {
super.onAttachedToWindow()
CallerAutopilotRecordListenerManager.addListener(TAG, this)
bagManagerEntity.reqType = 2
//遍历所有bag
CallerAutoPilotControlManager.sendBagManagerCmd(bagManagerEntity)
}
override fun onDetachedFromWindow() {
super.onDetachedFromWindow()
CallerAutopilotRecordListenerManager.removeListener(TAG)
try {
timerTaskRefresh.cancel()
} catch (e: Exception) {
e.printStackTrace()
}
}
private val timerTaskRefresh = object : TimerTask() {
override fun run() {
UiThreadHandler.post {
//获取空间使用信息,每隔1分钟获取一次
bagManagerEntity.reqType = 1
CallerAutoPilotControlManager.sendBagManagerCmd(bagManagerEntity)
}
}
}
}

View File

@@ -0,0 +1,121 @@
package com.zhjt.mogo_core_function_devatools.badcase.biz;
import android.annotation.SuppressLint;
import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.view.WindowManager;
import android.widget.ProgressBar;
import android.widget.TextView;
import androidx.annotation.NonNull;
import com.zhjt.mogo_core_function_devatools.R;
import java.text.DecimalFormat;
/**
* @author XuXinChao
* @description Bag包上传进度展示弹窗
* @since: 2022/2/1
*/
public class BagUploadDialog extends Dialog {
private TextView tvCancelUpload;//取消上传
private TextView tvCancel;//取消
private TextView tvUploadDetail;//上传详情
private ProgressBar viewUploadProgress;//上传进度条
private int totalNum = 0;
private Long totalSize = 0L;
private int remainNum = 0;
private Long remainSize = 0L;
private BagUploadListener uploadListener;
private DecimalFormat format = new DecimalFormat("0.0");
public BagUploadDialog(@NonNull Context context) {
super(context, R.style.bad_case_dialog);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.dialog_bag_upload);
WindowManager.LayoutParams params = getWindow().getAttributes();
params.height = 688;
params.width = 1110;
getWindow().setAttributes(params);//向WindowManager设置属性
setCanceledOnTouchOutside(false);
init();
initEvent();
}
private void init(){
tvCancelUpload = findViewById(R.id.tvCancelUpload);
tvCancel = findViewById(R.id.tvCancel);
tvUploadDetail = findViewById(R.id.tvUploadDetail);
viewUploadProgress = findViewById(R.id.viewUploadProgress);
}
private void initEvent(){
//取消上传
tvCancelUpload.setOnClickListener(v -> {
if(uploadListener!=null){
uploadListener.cancelUpload();
}
dismiss();
});
//取消
tvCancel.setOnClickListener(v -> {
dismiss();
});
}
@Override
public void onAttachedToWindow() {
super.onAttachedToWindow();
}
@Override
public void onDetachedFromWindow() {
super.onDetachedFromWindow();
}
public void setListener(BagUploadListener listener){
uploadListener = listener;
}
@SuppressLint("SetTextI18n")
public void setAllUpload(int totalNum, Long totalSize){
this.totalNum = totalNum;
this.totalSize = totalSize;
//更新进度条和进度文字
String totalStr = format.format((totalSize/(1000*1024*1024.0)));
tvUploadDetail.setText("共计"+totalNum+"个包 ("+totalStr+"G) 已上传"+(0)+"个包 ("
+0+"G) 剩余"+totalNum+"个包 ("+ totalStr+"G)");
}
@SuppressLint("SetTextI18n")
public void updateRemainUpload(int remainNum, Long remainSize){
this.remainNum = remainNum;
this.remainSize = remainSize;
//更新进度条和进度文字
String updateTotalStr = format.format((totalSize/(1000*1024*1024.0)));
String updateUploadStr = format.format(((totalSize-remainSize)/(1000*1024*1024.0)));
String updateRemainStr = format.format((remainSize/(1000*1024*1024.0)));
tvUploadDetail.setText("共计"+totalNum+"个包 ("+updateTotalStr+"G) 已上传"+(totalNum-remainNum)+"个包 ("
+updateUploadStr+"G) 剩余"+remainNum+"个包 ("+ updateRemainStr +"G)");
viewUploadProgress.setProgress((totalNum-remainNum)*100/totalNum);
}
public void uploadCompleted(){
dismiss();
}
interface BagUploadListener{
//取消上传
void cancelUpload();
}
}

View File

@@ -20,6 +20,7 @@ import com.zhjt.mogo_core_function_devatools.badcase.consts.BadCaseConfig;
import java.util.ArrayList;
import bag_manager.BagManagerOuterClass;
import mogo.telematics.pad.MessagePad;
import record_cache.RecordPanelOuterClass;
@@ -116,4 +117,8 @@ public class CaseListDialog extends Dialog implements IMoGoAutopilotRecordListen
caseListAdapter.notifyDataSetChanged();
});
}
@Override
public void onBagManagerResult(@NonNull BagManagerOuterClass.BagManager bagManager) {
}
}

View File

@@ -28,6 +28,7 @@ import com.zhjt.mogo_core_function_devatools.badcase.consts.BadCaseConfig;
import java.util.ArrayList;
import java.util.List;
import bag_manager.BagManagerOuterClass;
import mogo.telematics.pad.MessagePad;
import record_cache.RecordPanelOuterClass;
@@ -203,4 +204,8 @@ public class CaseTopicListDialog extends Dialog implements IMoGoAutopilotRecordL
@Override
public void onAutopilotRecordResult(@NonNull RecordPanelOuterClass.RecordPanel recordPanel) {
}
@Override
public void onBagManagerResult(@NonNull BagManagerOuterClass.BagManager bagManager) {
}
}

View File

@@ -13,6 +13,9 @@ import android.widget.ImageView
import android.widget.TextView
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
import com.mogo.eagle.core.data.app.AppConfigInfo
import com.mogo.eagle.core.data.badcase.BagDescriptionEntity
import com.mogo.eagle.core.data.badcase.BagInfoEntity
import com.mogo.eagle.core.data.badcase.BagManagerEntity
import com.mogo.eagle.core.data.badcase.RecordCaseEntity
import com.mogo.eagle.core.data.map.MogoLocation
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotRecordListener
@@ -36,8 +39,10 @@ import com.zhjt.mogo_core_function_devatools.badcase.consts.BadCaseConfig
import com.zhjt.mogo_core_function_devatools.badcase.record.RecordManager
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch
import mogo.telematics.pad.MessagePad
import record_cache.RecordPanelOuterClass
import java.io.File
import java.lang.StringBuilder
import java.util.*
@@ -77,17 +82,17 @@ class InitiativeBadCaseWindow constructor(activity: Activity) : View.OnTouchList
private lateinit var tvInitiativeCancel: TextView
private var audioStatus = false
private var audioFileName: String? = null //录音文件名称
private var audioFileName:String?=null //录音文件名称
private var uploadReason: StringBuilder = StringBuilder() //上报原因,标签
@Volatile
private var recordKey: String? = null //录制bag包key
private var recordKey: String?=null //录制bag包key
@Volatile
private var recordFileName: String? = null //录制文件包名
private var longitude: Double? = null
private var latitude: Double? = null
private var recordFileName: String?=null //录制文件包名
private var longitude: Double?=null
private var latitude: Double?=null
private var bagManagerEntity: BagManagerEntity = BagManagerEntity()
private var mInViewX = 0f
private var mInViewY = 0f
@@ -107,9 +112,8 @@ class InitiativeBadCaseWindow constructor(activity: Activity) : View.OnTouchList
}
@SuppressLint("SetTextI18n")
private fun initFloatWindow() {
mFloatLayout =
LayoutInflater.from(mActivity).inflate(R.layout.view_initiative_bad_case, null) as View
private fun initFloatWindow(){
mFloatLayout = LayoutInflater.from(mActivity).inflate(R.layout.view_initiative_bad_case, null) as View
mFloatLayout.setOnTouchListener(this)
tvInitiativeNum = mFloatLayout.findViewById(R.id.tvInitiativeNum)
@@ -128,17 +132,16 @@ class InitiativeBadCaseWindow constructor(activity: Activity) : View.OnTouchList
tvInitiativeReport = mFloatLayout.findViewById(R.id.tvInitiativeReport)
tvInitiativeCancel = mFloatLayout.findViewById(R.id.tvInitiativeCancel)
if (BadCaseConfig.windowNum < 1) {
if(BadCaseConfig.windowNum<1){
BadCaseConfig.windowNum = 1
}
tvInitiativeNum.text = BadCaseConfig.windowNum.toString()
BadCaseConfig.windowNum++
tvInitiativeTime.text =
"时间:${millis2String(System.currentTimeMillis(), TimeUtils.getHourMinSecondFormat())}"
tvInitiativeTime.text = "时间:${millis2String(System.currentTimeMillis(),TimeUtils.getHourMinSecondFormat())}"
tvInitiativeIdentity.text = "身份:${BadCaseConfig.identity}"
//采集结果回调监听
CallerAutopilotRecordListenerManager.addListener(this.hashCode().toString(), this)
CallerAutopilotRecordListenerManager.addListener(this.hashCode().toString(),this)
// 添加 ADAS车辆状态&定位 监听
CallerChassisLocationWGS84ListenerManager.addListener(this.hashCode().toString(), this)
viewAudioButton.setOnClickListener {
@@ -147,37 +150,37 @@ class InitiativeBadCaseWindow constructor(activity: Activity) : View.OnTouchList
}
tvInitiativeReport.setOnClickListener {
if (!rbOne.isChecked && !rbTwo.isChecked && !rbThree.isChecked &&
!rbFour.isChecked && !rbFive.isChecked && !rbSix.isChecked
) {
if(!rbOne.isChecked && !rbTwo.isChecked && !rbThree.isChecked &&
!rbFour.isChecked && !rbFive.isChecked && !rbSix.isChecked){
TipToast.shortTip("请选择至少一个Case")
return@setOnClickListener
}
if (rbOne.isChecked) {
uploadReason.clear()
if(rbOne.isChecked){
uploadReason.append("严重画龙 ")
}
if (rbTwo.isChecked) {
if(rbTwo.isChecked){
uploadReason.append("速度过慢 ")
}
if (rbThree.isChecked) {
if(rbThree.isChecked){
uploadReason.append("感知、定位、地图等其他 ")
}
if (rbFour.isChecked) {
if(rbFour.isChecked){
uploadReason.append("速度过快 ")
}
if (rbFive.isChecked) {
if(rbFive.isChecked){
uploadReason.append("存在碰撞风险 ")
}
if (rbSix.isChecked) {
if(rbSix.isChecked){
uploadReason.append("点刹、顿挫")
}
if (audioStatus) {
if(audioStatus){
audioStatus = !audioStatus
setAudio(audioStatus)
Handler().postDelayed({
uploadAudio()
}, 1000)
} else {
uploadAudio()
},1000)
}else{
uploadAudio()
}
}
@@ -200,10 +203,10 @@ class InitiativeBadCaseWindow constructor(activity: Activity) : View.OnTouchList
}
}
var countDownTimer: CountDownTimer? = null
var countDownTimer: CountDownTimer?=null
private fun setAudio(status: Boolean) {
if (status) {
private fun setAudio(status: Boolean){
if(status){
//开始录音
audioFileName = "Audio_${System.currentTimeMillis()}_BadCase"
RecordManager.getInstance().start(audioFileName)
@@ -211,11 +214,11 @@ class InitiativeBadCaseWindow constructor(activity: Activity) : View.OnTouchList
viewAudioButton.setImageResource(R.drawable.icon_bad_case_audio_select)
tvAudioCountDown.visibility = View.VISIBLE
//开始倒计时
if (countDownTimer == null) {
if(countDownTimer==null){
countDownTimer = object : CountDownTimer(60000, 1000) {
override fun onTick(millisUntilFinished: Long) {
tvAudioCountDown.text = "${millisUntilFinished / 1000}S"
tvAudioCountDown.text = "${millisUntilFinished/1000}S"
}
override fun onFinish() {
@@ -228,7 +231,7 @@ class InitiativeBadCaseWindow constructor(activity: Activity) : View.OnTouchList
}
countDownTimer?.start()
}
} else {
}else{
//结束倒计时
countDownTimer?.cancel()
countDownTimer?.onFinish()
@@ -238,13 +241,11 @@ class InitiativeBadCaseWindow constructor(activity: Activity) : View.OnTouchList
}
private fun uploadAudio() {
private fun uploadAudio(){
val singlePath = "/mnt/sdcard/mogo/DataCollection/${audioFileName}.wav"
val file = File(singlePath)
if (file.exists()) {
LogInfoManagerFactory.createAudioUpload(mActivity.applicationContext,
"Audio",
singlePath,
if(file.exists()){
LogInfoManagerFactory.createAudioUpload(mActivity.applicationContext,"Audio",singlePath,
object : OnUploadListener {
override fun onUploadSuccess(filePath: String, downloadUrl: String) {
CallerLogger.d("$M_DEVA$TAG", "语音文件上传成功downloadUrl=$downloadUrl")
@@ -260,7 +261,7 @@ class InitiativeBadCaseWindow constructor(activity: Activity) : View.OnTouchList
removeUploadListener(singlePath)
}
})
} else {
}else{
//上传到服务器
upload(null)
}
@@ -270,7 +271,7 @@ class InitiativeBadCaseWindow constructor(activity: Activity) : View.OnTouchList
* 将语音文件上传Cos监听移除
* @param filePath 文件路径
*/
private fun removeUploadListener(filePath: String) {
private fun removeUploadListener(filePath: String){
val pkgInfo: List<String> = filePath.substring(
filePath.lastIndexOf("/") + 1,
filePath.lastIndexOf(".")
@@ -283,21 +284,21 @@ class InitiativeBadCaseWindow constructor(activity: Activity) : View.OnTouchList
* 将记录上传到服务器
* @param downloadUrl 语音文件下载地址
*/
private fun upload(downloadUrl: String?) {
GlobalScope.launch {
private fun upload(downloadUrl: String?){
GlobalScope.launch{
val uploadResult = presenter.upload(mutableMapOf<String, String>().also { itx ->
itx["carLicense"] = AppConfigInfo.plateNumber ?: "" //车牌号
itx["filename"] = recordFileName ?: "" //bag包文件地址
itx["carLicense"] = AppConfigInfo.plateNumber?:"" //车牌号
itx["filename"] = recordFileName?:"" //bag包文件地址
itx["filesize"] = "0" //bag包文件大小
itx["key"] = recordKey ?: "" //key
itx["reason"] = uploadReason.toString() ?: "" //采集原因
itx["key"] = recordKey?:"" //key
itx["reason"] = uploadReason.toString() //采集原因
itx["duration"] = BadCaseConfig.totalDuration.toString() //采集时长固定为20S
itx["startTime"] = System.currentTimeMillis().toString() //上报时间(时间戳格式)
itx["channel"] = "1" //渠道
itx["carSn"] = MoGoAiCloudClientConfig.getInstance().sn //SN
itx["userRole"] = BadCaseConfig.identity //采集者角色
itx["audioUrl"] = downloadUrl ?: "" //音频COS地址
itx["mapVersion"] = BadCaseConfig.dockerVersion ?: "" //工控机版本
itx["audioUrl"] = downloadUrl?:"" //音频COS地址
itx["mapVersion"] = BadCaseConfig.dockerVersion ?:"" //工控机版本
itx["eyeVersion"] = AppUtils.getAppVersionName() //鹰眼版本
itx["coordinate"] = "latitude:${latitude};longitude:${longitude}" //坐标
@@ -306,6 +307,15 @@ class InitiativeBadCaseWindow constructor(activity: Activity) : View.OnTouchList
TipToast.shortTip("上报失败")
} else {
TipToast.shortTip("上报成功")
//将上报BI的结果同步给工控机记录保存
recordKey?.let {
val hasAudio = downloadUrl != null
val descReqEntity = BagDescriptionEntity(uploadReason.toString(),hasAudio,downloadUrl.toString(),true)
bagManagerEntity.reqType = 5
bagManagerEntity.keyReq = it.toLong()
bagManagerEntity.descReq = descReqEntity
CallerAutoPilotControlManager.sendBagManagerCmd(bagManagerEntity)
}
BadCaseConfig.windowNum--
clickListener?.closeWindow()
}
@@ -346,19 +356,28 @@ class InitiativeBadCaseWindow constructor(activity: Activity) : View.OnTouchList
mWindowParams!!.y = metrics.heightPixels - BarUtils.getStatusBarHeight()-950
mWindowManager!!.addView(mFloatLayout, mWindowParams)
//开启录包
if (recordCaseEntity != null) {
CallerAutoPilotControlManager.recordPackage(
recordCaseEntity.caseId,
Random(SystemClock.elapsedRealtime()).nextInt(),
BadCaseConfig.totalDuration,
BadCaseConfig.previousDuration,
recordCaseEntity.topicList
)
} else {
CallerAutoPilotControlManager.recordPackage(
BadCaseConfig.type, Random(SystemClock.elapsedRealtime()).nextInt(),
BadCaseConfig.totalDuration, BadCaseConfig.previousDuration
)
if(recordCaseEntity!=null){
CallerAutoPilotControlManager.recordPackage(recordCaseEntity.caseId,Random(SystemClock.elapsedRealtime()).nextInt(),
BadCaseConfig.totalDuration, BadCaseConfig.previousDuration,recordCaseEntity.topicList)
}else{
CallerAutoPilotControlManager.recordPackage(BadCaseConfig.type,Random(SystemClock.elapsedRealtime()).nextInt(),
BadCaseConfig.totalDuration, BadCaseConfig.previousDuration)
}
}
}
fun showReportBIWindow(bagInfoEntity: BagInfoEntity){
if (mFloatLayout.parent == null) {
val metrics = DisplayMetrics()
// 默认固定位置,靠屏幕右边缘的中间
mWindowManager!!.defaultDisplay.getMetrics(metrics)
mWindowParams!!.x = metrics.widthPixels
mWindowParams!!.y = metrics.heightPixels - BarUtils.getStatusBarHeight()-950
mWindowManager!!.addView(mFloatLayout, mWindowParams)
//已经录包无需再次启动录包,只要将录包信息同步到弹窗
bagInfoEntity.let {
recordKey = it.key.toString()
recordFileName = it.bagPath
}
}
}
@@ -373,13 +392,12 @@ class InitiativeBadCaseWindow constructor(activity: Activity) : View.OnTouchList
override fun onAutopilotRecordResult(recordPanel: RecordPanelOuterClass.RecordPanel) {
CallerLogger.d("${M_DEVA}${TAG}", "-- 收到工控机录制任务回调 -- $recordPanel")
ThreadUtils.runOnUiThread {
if (recordKey == null) {
if(recordKey==null){
recordKey = recordPanel.key.toString()
BadCaseConfig.recordKeyList.add(recordPanel.key)
}
if (recordFileName == null) {
if(recordFileName==null){
recordFileName = recordPanel.filename
}
}

View File

@@ -6,6 +6,8 @@ import android.graphics.Color
import android.graphics.PixelFormat
import android.os.CountDownTimer
import android.os.Handler
import android.os.Parcel
import android.os.Parcelable
import android.util.DisplayMetrics
import android.view.*
import android.widget.CheckBox
@@ -15,10 +17,13 @@ import android.widget.TextView
import com.google.android.flexbox.FlexboxLayout
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
import com.mogo.eagle.core.data.app.AppConfigInfo
import com.mogo.eagle.core.data.badcase.BagDescriptionEntity
import com.mogo.eagle.core.data.badcase.BagManagerEntity
import com.mogo.eagle.core.data.map.MogoLocation
import com.mogo.eagle.core.data.msgbox.MsgBoxBean
import com.mogo.eagle.core.data.msgbox.RecordBagMsg
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationWGS84Listener
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
@@ -28,12 +33,13 @@ import com.mogo.eagle.core.utilcode.util.*
import com.mogo.eagle.core.utilcode.util.TimeUtils.millis2String
import com.zhidao.loglib.call.LogInfoManagerFactory
import com.zhidao.loglib.upload.OnUploadListener
import com.zhidao.loglib.upload.UploadManager
import com.zhjt.mogo_core_function_devatools.R
import com.zhjt.mogo_core_function_devatools.badcase.consts.BadCaseConfig
import com.zhjt.mogo_core_function_devatools.badcase.record.RecordManager
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch
import mogo.telematics.pad.MessagePad
import com.zhidao.loglib.upload.UploadManager
import me.jessyan.autosize.utils.AutoSizeUtils
import org.greenrobot.eventbus.EventBus
import java.io.File
@@ -56,14 +62,16 @@ class PassiveBadCaseWindow constructor(activity: Activity) : View.OnTouchListene
private lateinit var mFloatLayout: View
private var audioStatus = false
private var audioFileName: String? = null //录音文件名称
private var audioFileName:String?=null //录音文件名称
private var bagManagerEntity: BagManagerEntity = BagManagerEntity()
private var uploadReason: String = String() //上报原因,标签
private var recordKey: String? = null //录制bag包key
private var recordFileName: String? = null //录制文件包名
private var boxBean: MsgBoxBean? = null
private var longitude: Double? = null
private var latitude: Double? = null
private var recordKey: String?=null //录制bag包key
private var recordFileName: String?=null //录制文件包名
private var boxBean: MsgBoxBean ?= null
private var longitude: Double?=null
private var latitude: Double?=null
private var mInViewX = 0f
private var mInViewY = 0f
@@ -73,7 +81,7 @@ class PassiveBadCaseWindow constructor(activity: Activity) : View.OnTouchListene
private var mInScreenY = 0f
private var clickListener: ClickListener? = null
var countDownTimer: CountDownTimer? = null
var countDownTimer: CountDownTimer?=null
private lateinit var tvPassiveNum: TextView
private lateinit var tvPassiveTime: TextView
@@ -96,9 +104,8 @@ class PassiveBadCaseWindow constructor(activity: Activity) : View.OnTouchListene
}
@SuppressLint("SetTextI18n")
private fun initFloatWindow() {
mFloatLayout =
LayoutInflater.from(mActivity).inflate(R.layout.view_passive_bad_case, null) as View
private fun initFloatWindow(){
mFloatLayout = LayoutInflater.from(mActivity).inflate(R.layout.view_passive_bad_case, null) as View
mFloatLayout.setOnTouchListener(this)
tvPassiveNum = mFloatLayout.findViewById(R.id.tvPassiveNum)
tvPassiveTime = mFloatLayout.findViewById(R.id.tvPassiveTime)
@@ -108,13 +115,12 @@ class PassiveBadCaseWindow constructor(activity: Activity) : View.OnTouchListene
tvPassiveReport = mFloatLayout.findViewById(R.id.tvPassiveReport)
tvPassiveCancel = mFloatLayout.findViewById(R.id.tvPassiveCancel)
flReasonLayout = mFloatLayout.findViewById(R.id.flReasonLayout)
if (BadCaseConfig.windowNum < 1) {
if(BadCaseConfig.windowNum<1){
BadCaseConfig.windowNum = 1
}
tvPassiveNum.text = BadCaseConfig.windowNum.toString()
BadCaseConfig.windowNum++
tvPassiveTime.text =
"时间:${millis2String(System.currentTimeMillis(), TimeUtils.getHourMinSecondFormat())}"
tvPassiveTime.text = "时间:${millis2String(System.currentTimeMillis(),TimeUtils.getHourMinSecondFormat())}"
tvPassiveIdentity.text = "身份:${BadCaseConfig.identity}"
// 添加 ADAS车辆状态&定位 监听
CallerChassisLocationWGS84ListenerManager.addListener(TAG, this)
@@ -124,17 +130,17 @@ class PassiveBadCaseWindow constructor(activity: Activity) : View.OnTouchListene
}
tvPassiveReport.setOnClickListener {
if (uploadReason.isEmpty()) {
if(uploadReason.isEmpty()){
TipToast.shortTip("请选择至少一个Case")
return@setOnClickListener
}
if (audioStatus) {
if(audioStatus){
audioStatus = !audioStatus
setAudio(audioStatus)
Handler().postDelayed({
uploadAudio()
}, 1000)
} else {
},1000)
}else{
uploadAudio()
}
//删除记录
@@ -162,8 +168,8 @@ class PassiveBadCaseWindow constructor(activity: Activity) : View.OnTouchListene
}
}
private fun setAudio(status: Boolean) {
if (status) {
private fun setAudio(status: Boolean){
if(status){
//开始录音
audioFileName = "Audio_${System.currentTimeMillis()}_BadCase"
RecordManager.getInstance().start(audioFileName)
@@ -171,11 +177,11 @@ class PassiveBadCaseWindow constructor(activity: Activity) : View.OnTouchListene
viewAudioButton.setImageResource(R.drawable.icon_bad_case_audio_select)
tvAudioCountDown.visibility = View.VISIBLE
//开始倒计时
if (countDownTimer == null) {
if(countDownTimer==null){
countDownTimer = object : CountDownTimer(60000, 1000) {
override fun onTick(millisUntilFinished: Long) {
tvAudioCountDown.text = "${millisUntilFinished / 1000}S"
tvAudioCountDown.text = "${millisUntilFinished/1000}S"
}
override fun onFinish() {
@@ -188,7 +194,7 @@ class PassiveBadCaseWindow constructor(activity: Activity) : View.OnTouchListene
}
countDownTimer?.start()
}
} else {
}else{
//结束倒计时
countDownTimer?.cancel()
countDownTimer?.onFinish()
@@ -198,13 +204,11 @@ class PassiveBadCaseWindow constructor(activity: Activity) : View.OnTouchListene
}
private fun uploadAudio() {
private fun uploadAudio(){
val singlePath = "/mnt/sdcard/mogo/DataCollection/${audioFileName}.wav"
val file = File(singlePath)
if (file.exists()) {
LogInfoManagerFactory.createAudioUpload(mActivity.applicationContext,
"Audio",
singlePath,
if(file.exists()){
LogInfoManagerFactory.createAudioUpload(mActivity.applicationContext,"Audio",singlePath,
object : OnUploadListener {
override fun onUploadSuccess(filePath: String, downloadUrl: String) {
CallerLogger.d("$M_DEVA$TAG", "语音文件上传成功downloadUrl=$downloadUrl")
@@ -220,7 +224,7 @@ class PassiveBadCaseWindow constructor(activity: Activity) : View.OnTouchListene
removeUploadListener(singlePath)
}
})
} else {
}else{
//上传到服务器
upload(null)
}
@@ -230,7 +234,7 @@ class PassiveBadCaseWindow constructor(activity: Activity) : View.OnTouchListene
* 将语音文件上传Cos监听移除
* @param filePath 文件路径
*/
private fun removeUploadListener(filePath: String) {
private fun removeUploadListener(filePath: String){
val pkgInfo: List<String> = filePath.substring(
filePath.lastIndexOf("/") + 1,
filePath.lastIndexOf(".")
@@ -243,21 +247,21 @@ class PassiveBadCaseWindow constructor(activity: Activity) : View.OnTouchListene
* 将记录上传到服务器
* @param downloadUrl 语音文件下载地址
*/
private fun upload(downloadUrl: String?) {
GlobalScope.launch {
private fun upload(downloadUrl: String?){
GlobalScope.launch{
val uploadResult = presenter.upload(mutableMapOf<String, String>().also { itx ->
itx["carLicense"] = AppConfigInfo.plateNumber ?: "" //车牌号
itx["filename"] = recordFileName ?: "" //bag包文件地址
itx["carLicense"] = AppConfigInfo.plateNumber?:"" //车牌号
itx["filename"] = recordFileName?:"" //bag包文件地址
itx["filesize"] = "0" //bag包文件大小
itx["key"] = recordKey ?: "" //key
itx["key"] = recordKey?:"" //key
itx["reason"] = uploadReason //采集原因
itx["duration"] = BadCaseConfig.totalDuration.toString() //采集时长固定为20S
itx["startTime"] = System.currentTimeMillis().toString() //上报时间(时间戳格式)
itx["channel"] = "0" //渠道
itx["carSn"] = MoGoAiCloudClientConfig.getInstance().sn //SN
itx["userRole"] = BadCaseConfig.identity //采集者角色
itx["audioUrl"] = downloadUrl ?: "" //音频COS地址
itx["mapVersion"] = BadCaseConfig.dockerVersion ?: "" //工控机版本
itx["audioUrl"] = downloadUrl?:"" //音频COS地址
itx["mapVersion"] = BadCaseConfig.dockerVersion ?:"" //工控机版本
itx["eyeVersion"] = AppUtils.getAppVersionName() //鹰眼版本
itx["coordinate"] = "latitude:${latitude};longitude:${longitude}" //坐标
@@ -266,6 +270,15 @@ class PassiveBadCaseWindow constructor(activity: Activity) : View.OnTouchListene
TipToast.shortTip("上报失败")
} else {
TipToast.shortTip("上报成功")
//将上报BI的结果同步给工控机记录保存
recordKey?.let {
val hasAudio = downloadUrl != null
val descReqEntity = BagDescriptionEntity(uploadReason,hasAudio,downloadUrl.toString(),true)
bagManagerEntity.reqType = 5
bagManagerEntity.keyReq = it.toLong()
bagManagerEntity.descReq = descReqEntity
CallerAutoPilotControlManager.sendBagManagerCmd(bagManagerEntity)
}
BadCaseConfig.windowNum--
clickListener?.closeWindow()
}
@@ -309,33 +322,28 @@ class PassiveBadCaseWindow constructor(activity: Activity) : View.OnTouchListene
// 默认固定位置,靠屏幕右边缘的中间
mWindowManager!!.defaultDisplay.getMetrics(metrics)
mWindowParams!!.x = metrics.widthPixels
mWindowParams!!.y = metrics.heightPixels - BarUtils.getStatusBarHeight() - 950
mWindowParams!!.y = metrics.heightPixels - BarUtils.getStatusBarHeight()-950
mWindowManager!!.addView(mFloatLayout, mWindowParams)
}
GlobalScope.launch {
GlobalScope.launch{
presenter.loadBadCases(true).also {
ThreadUtils.runOnUiThread {
it.iterator().forEach {
val checkBox = CheckBox(mActivity)
checkBox.setTextColor(Color.WHITE)
val lp = FlexboxLayout.LayoutParams(
FlexboxLayout.LayoutParams.WRAP_CONTENT,
FlexboxLayout.LayoutParams.WRAP_CONTENT
)
checkBox.buttonDrawable =
mActivity.resources.getDrawable(R.drawable.badcase_radio_button_style)
checkBox.setPadding(
val lp = FlexboxLayout.LayoutParams(FlexboxLayout.LayoutParams.WRAP_CONTENT,
FlexboxLayout.LayoutParams.WRAP_CONTENT)
checkBox.buttonDrawable = mActivity.resources.getDrawable(R.drawable.badcase_radio_button_style)
checkBox.setPadding(SizeUtils.dp2px(10f),
SizeUtils.dp2px(10f),
SizeUtils.dp2px(10f),
SizeUtils.dp2px(10f),
SizeUtils.dp2px(10f)
)
checkBox.textSize = AutoSizeUtils.dp2px(mActivity, 18f).toFloat()
SizeUtils.dp2px(10f))
checkBox.textSize = AutoSizeUtils.dp2px(mActivity,18f).toFloat()
checkBox.text = it.reason
checkBox.isChecked = it.isChecked
checkBox.setOnCheckedChangeListener(this@PassiveBadCaseWindow)
flReasonLayout.addView(checkBox, lp)
flReasonLayout.addView(checkBox,lp)
}
}
}
@@ -345,13 +353,13 @@ class PassiveBadCaseWindow constructor(activity: Activity) : View.OnTouchListene
override fun onCheckedChanged(buttonView: CompoundButton?, isChecked: Boolean) {
buttonView?.text?.let {
if (isChecked) {
if (!uploadReason.contains(it)) {
if(isChecked){
if(!uploadReason.contains(it)){
uploadReason += it
}
} else {
if (uploadReason.contains(it)) {
uploadReason = uploadReason.replace(it.toString(), "")
}else{
if(uploadReason.contains(it)){
uploadReason = uploadReason.replace(it.toString(),"")
}
}
@@ -365,7 +373,7 @@ class PassiveBadCaseWindow constructor(activity: Activity) : View.OnTouchListene
if (mFloatLayout.parent != null) mWindowManager!!.removeView(mFloatLayout)
}
fun setRecord(msgBoxBean: MsgBoxBean) {
fun setRecord(msgBoxBean: MsgBoxBean){
boxBean = msgBoxBean
val recordBagMsg = (msgBoxBean.bean as RecordBagMsg)
recordKey = recordBagMsg.key.toString()

View File

@@ -0,0 +1,87 @@
package com.zhjt.mogo_core_function_devatools.badcase.biz;
import android.app.Activity;
import android.app.Dialog;
import android.os.Bundle;
import android.view.WindowManager;
import android.widget.TextView;
import androidx.annotation.NonNull;
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager;
import com.zhjt.mogo_core_function_devatools.R;
/**
* @author XuXinChao
* @description BadCase车端磁盘空间已满预警弹窗
* @since: 2022/2/1
*/
public class SpaceWarningDialog extends Dialog {
private TextView tvCleanDisk;//清理磁盘
private TextView tvCancel;//取消
private Activity mActivity;
private ClickListener clickListener;
public SpaceWarningDialog(@NonNull Activity activity) {
super(activity, R.style.bad_case_dialog);
mActivity = activity;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.dialog_space_warning);
WindowManager.LayoutParams params = getWindow().getAttributes();
params.height = 688;
params.width = 1110;
getWindow().setAttributes(params);//向WindowManager设置属性
setCanceledOnTouchOutside(false);
init();
initEvent();
}
private void init(){
tvCleanDisk = findViewById(R.id.tvCleanDisk);
tvCancel = findViewById(R.id.tvCancel);
}
private void initEvent(){
//清理磁盘
tvCleanDisk.setOnClickListener(v -> {
//跳转录包管理页面
// if(mActivity!=null){
// CallerDevaToolsManager.INSTANCE.showBadCaseManagerView(mActivity);
// }
if(clickListener!=null){
clickListener.showBadCaseManagerView();
}
dismiss();
});
//取消
tvCancel.setOnClickListener(v -> {
//取消弹窗
dismiss();
});
}
public void setClickListener(ClickListener clickListener){
this.clickListener = clickListener;
}
@Override
public void onAttachedToWindow() {
super.onAttachedToWindow();
}
@Override
public void onDetachedFromWindow() {
super.onDetachedFromWindow();
}
public interface ClickListener{
void showBadCaseManagerView();
}
}

View File

@@ -0,0 +1,175 @@
package com.zhjt.mogo_core_function_devatools.badcase.biz.adapter
import android.text.Editable
import android.text.TextWatcher
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.CheckBox
import android.widget.EditText
import android.widget.ImageView
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import com.mogo.eagle.core.data.badcase.BagDescriptionEntity
import com.mogo.eagle.core.data.badcase.BagInfoEntity
import com.zhjt.mogo_core_function_devatools.R
import java.text.DecimalFormat
/**
* @author XuXinChao
* @description Bag包管理列表适配器
* @since: 2022/12/19
*/
class BagManagerListAdapter: RecyclerView.Adapter<RecyclerView.ViewHolder>() {
private var data:List<BagInfoEntity> ?= null
private var bagClickListener: BagClickListener ?= null
private val format = DecimalFormat("0.00")
fun setData(data: List<BagInfoEntity>?){
this.data = data
notifyDataSetChanged()
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
if(viewType == 1){
val view = LayoutInflater.from(parent.context)
.inflate(R.layout.item_bag_time_title,parent,false)
return BagTimeTitleHolder(view)
}else{
val view = LayoutInflater.from(parent.context)
.inflate(R.layout.item_bag_manager, parent, false)
return BagManagerListHolder(view)
}
}
override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
when(holder){
is BagTimeTitleHolder ->{
data?.let {
holder.tvBagTimeTitle.text = it[position].timeStr
}
}
is BagManagerListHolder->{
data?.let {
val bagInfoEntity = it[position]
holder.cbBagSelect.setOnCheckedChangeListener(null)
holder.cbBagSelect.isChecked = bagInfoEntity.selectStatus
holder.cbBagSelect.tag = bagInfoEntity
holder.cbBagSelect.setOnCheckedChangeListener { _, isChecked ->
bagClickListener?.onClick(bagInfoEntity,isChecked)
}
val textWatcher: TextWatcher = object : TextWatcher {
override fun beforeTextChanged(
charSequence: CharSequence,
i: Int,
i1: Int,
i2: Int
) {
}
override fun onTextChanged(charSequence: CharSequence, i: Int, i1: Int, i2: Int) {}
override fun afterTextChanged(editable: Editable) {
bagInfoEntity.description?.let { desc->
val descriptionStr = editable.toString()
if(desc.description != descriptionStr){
desc.description = descriptionStr
bagClickListener?.editDescription(bagInfoEntity.key,desc)
}
}
}
}
holder.etBagNameEdit.onFocusChangeListener =
View.OnFocusChangeListener { p0, hasFocus ->
val edit = p0 as EditText
if(hasFocus){
edit.addTextChangedListener(textWatcher)
}else{
edit.removeTextChangedListener(textWatcher)
}
}
bagInfoEntity.description?.let { des->
if(des.reportBI){
//已上报
holder.tvBagReportStatus.text = "已上报"
holder.tvBagReportStatus.setBackgroundResource(R.drawable.bag_reported_button_bg)
}else{
//未上报
holder.tvBagReportStatus.text = "上报"
holder.tvBagReportStatus.setBackgroundResource(R.drawable.bag_report_button_bg)
holder.tvBagReportStatus.setOnClickListener {
bagClickListener?.uploadBI(bagInfoEntity)
}
}
if(des.description.isEmpty()){
holder.etBagNameEdit.setText(bagInfoEntity.key.toString())
}else{
holder.etBagNameEdit.setText(des.description)
}
}
if(bagInfoEntity.description?.hasAudio == true){
holder.ivBagAudio.visibility = View.VISIBLE
holder.ivBagAudio.setOnClickListener {
bagInfoEntity.description?.let { description->
bagClickListener?.bagAudio(bagInfoEntity.key,description.audioUrl)
}
}
}else{
holder.ivBagAudio.visibility = View.INVISIBLE
}
//大小
val bagSize = format.format(bagInfoEntity.totalSize/(1000*1024*1024.0))
holder.tvBagSize.text = "${bagSize}G"
//时间
bagInfoEntity.timestamp?.let { time->
val hour = time.substring(8,10)
val min = time.substring(10,12)
val second = time.substring(12,14)
holder.tvBagTime.text = "${hour}:${min}:${second}"
}
}
}
}
}
override fun getItemCount() = data?.size ?: 0
override fun getItemViewType(position: Int): Int {
return data!![position].itemType
}
class BagTimeTitleHolder(itemView: View): RecyclerView.ViewHolder(itemView){
var tvBagTimeTitle: TextView = itemView.findViewById(R.id.tvBagTimeTitle)
}
class BagManagerListHolder(itemView: View) : RecyclerView.ViewHolder(itemView){
var cbBagSelect: CheckBox = itemView.findViewById(R.id.cbBagSelect)
var etBagNameEdit: EditText = itemView.findViewById(R.id.etBagNameEdit)
var tvBagReportStatus: TextView = itemView.findViewById(R.id.tvBagReportStatus)
var ivBagAudio: ImageView = itemView.findViewById(R.id.ivBagAudio)
var tvBagTime: TextView = itemView.findViewById(R.id.tvBagTime)
var tvBagSize: TextView = itemView.findViewById(R.id.tvBagSize)
}
fun setListener(listener: BagClickListener){
bagClickListener = listener
}
interface BagClickListener{
//选择Bag包
fun onClick(bagInfoEntity: BagInfoEntity,isChecked: Boolean)
//上报BI平台
fun uploadBI(bagInfoEntity: BagInfoEntity)
//编辑Bag包描述信息
fun editDescription(key: Long,description: BagDescriptionEntity)
//听录音
fun bagAudio(key: Long,audioUrl: String)
}
}

View File

@@ -1,5 +1,7 @@
package com.zhjt.mogo_core_function_devatools.badcase.consts
import com.mogo.eagle.core.data.badcase.BagInfoEntity
/**
* @author XuXinChao
* @description 录包配置参数
@@ -32,5 +34,8 @@ object BadCaseConfig {
//自定义Topic清单列表
@JvmField
var customTopicList: ArrayList<String> = ArrayList()
//Bag包管理列表
@JvmField
var bagManagerList: ArrayList<BagInfoEntity> = ArrayList()
}

View File

@@ -0,0 +1,103 @@
package com.zhjt.mogo_core_function_devatools.badcase.record;
import android.media.AudioManager;
import android.media.MediaPlayer;
import android.text.TextUtils;
//播放试听
public class Audition implements MediaPlayer.OnPreparedListener, MediaPlayer.OnCompletionListener{
private static volatile Audition INSTANCE;
public MediaPlayer mediaPlayer;
private String oldPath;
private OnAuditionListener listener;
public interface OnAuditionListener {
void onAuditionCompletion();
}
public void registerOnAuditionListener(OnAuditionListener listener) {
this.listener = listener;
}
public void unregisterOnAuditionListener() {
this.listener = null;
}
private Audition() {
}
public static Audition getInstance() {
if (INSTANCE == null) {
synchronized (Audition.class) {
if (INSTANCE == null) {
INSTANCE = new Audition();
}
}
}
return INSTANCE;
}
public boolean isPlaying() {
return mediaPlayer != null && mediaPlayer.isPlaying();
}
private void play(String path) {
oldPath = path;
if (mediaPlayer != null) {
mediaPlayer.release();
mediaPlayer = null;
}
if (mediaPlayer == null) {
mediaPlayer = new MediaPlayer();
mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
mediaPlayer.setOnPreparedListener(this);
mediaPlayer.setOnCompletionListener(this);
}
try {
mediaPlayer.setDataSource(path);
} catch (Exception e) {
e.printStackTrace();
}
mediaPlayer.prepareAsync();
}
public void stop() {
oldPath = null;
if (mediaPlayer != null) {
mediaPlayer.stop();
mediaPlayer.reset();
}
}
public boolean playOrStop(String path) {
if (!TextUtils.equals(oldPath, path)) {
play(path);
return true;
} else {
stop();
return false;
}
}
public void onDestroy() {
stop();
mediaPlayer = null;
}
@Override
public void onPrepared(MediaPlayer mp) {
mp.start();
}
@Override
public void onCompletion(MediaPlayer mp) {
oldPath = null;
if (listener != null) {
listener.onAuditionCompletion();
}
}
}

View File

@@ -9,11 +9,14 @@ import com.mogo.eagle.core.data.app.AppConfigInfo.role
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.obu.MogoObuConst
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotCarConfigListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotCarConfigListenerManager
import com.mogo.eagle.core.function.call.obu.CallerObuApiManager
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils.isDriver
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils.isPassenger
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_DEVA
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr
import com.zhjt.mogo_core_function_devatools.upgrade.IPCUpgradeManager.Companion.ipcUpgradeManager
@@ -59,9 +62,6 @@ class BindingCarManager : IMoGoAutopilotCarConfigListener {
if (carConfigResp != null && !TextUtils.isEmpty(carConfigResp.macAddress)) {
Log.d("Upgrade", "MoGoHandAdasMsgManager address = " + carConfigResp.macAddress)
getBindingCarInfo(carConfigResp.macAddress, MoGoAiCloudClientConfig.getInstance().sn)
//obu的升级,只需要司机屏连接
queryObuUpgrade(carConfigResp.macAddress)
}
}
@@ -164,14 +164,18 @@ class BindingCarManager : IMoGoAutopilotCarConfigListener {
fun queryAppUpgrade() {
UpgradeAppNetWorkManager.getInstance()
.getAppUpgradeInfo(mContext, mAddress, role.toString() + "")
}
/**
* 司机屏 处理obu升级即可,乘客屏不需要处理
*
* obu的升级,只需要司机屏连接
*/
private fun queryObuUpgrade(macAddress: String) {
ObuUpgradeAppNetWorkManager.getInstance().getObuUpgradeInfo(mContext, macAddress)
fun queryObuUpgrade(obuVersionName: String) {
if (screenType == 1) {
CallerLogger.d("${SceneConstant.M_OBU}${MogoObuConst.TAG_UPGRADE_OBU}","queryObuUpgrade isConnected = ${CallerObuApiManager.isConnected()} --- mAddress = $mAddress")
ObuUpgradeAppNetWorkManager.getInstance().getObuUpgradeInfo(mContext, mAddress, obuVersionName)
}
}
}

View File

@@ -56,8 +56,6 @@ class BindingCarNetWorkManager private constructor() {
widevineIDWithMd5: String?,
screenType: Int
) {
// String macAddress1 = "48:b0:2d:4d:33:40";
// String sn = "X2020220417KA94QIN";
val request = BindingCarRequest(
macAddress,
widevineIDWithMd5,
@@ -152,29 +150,39 @@ class BindingCarNetWorkManager private constructor() {
}
private fun updateCarVrIconRes(brandId: String?) {
d(SceneConstant.M_BINDING + TAG, "CarModelChange : ${DebugConfig.isCarModelChange()}")
if(!DebugConfig.isCarModelChange()){
return
}
if (brandId == null || brandId.isEmpty()) {
return
}
d(SceneConstant.M_BINDING + TAG, "getDefaultId() : ${getDefaultId()} ---- brandId = $brandId")
if (getDefaultId() == brandId) {
return
}
d(SceneConstant.M_BINDING + TAG, "updateCarVrIconRes : $brandId")
when (brandId) {
"1" -> {
"1" -> { //东风
CallerMapUIServiceManager.getMapUIController()?.changeCurrentIcon(R.raw.chuzuche)
HdMapBuildConfig.currentCarVrIconRes = R.raw.chuzuche
}
"2" -> {
"2" -> { //红旗
CallerMapUIServiceManager.getMapUIController()?.changeCurrentIcon(R.raw.hq_h9)
HdMapBuildConfig.currentCarVrIconRes = R.raw.hq_h9
}
"3" -> {
"3" -> { //金旅
CallerMapUIServiceManager.getMapUIController()?.changeCurrentIcon(R.raw.xiaobache)
HdMapBuildConfig.currentCarVrIconRes = R.raw.xiaobache
}
"4" -> { //开沃
CallerMapUIServiceManager.getMapUIController()?.changeCurrentIcon(R.raw.xiaobache)
HdMapBuildConfig.currentCarVrIconRes = R.raw.xiaobache
}
"5" -> { //福田
CallerMapUIServiceManager.getMapUIController()?.changeCurrentIcon(R.raw.huanwei)
HdMapBuildConfig.currentCarVrIconRes = R.raw.huanwei
}
else -> {
CallerMapUIServiceManager.getMapUIController()?.changeCurrentIcon(R.raw.chuzuche)
HdMapBuildConfig.currentCarVrIconRes = R.raw.chuzuche
@@ -186,6 +194,8 @@ class BindingCarNetWorkManager private constructor() {
return when (HdMapBuildConfig.currentCarVrIconRes) {
R.raw.chuzuche -> "1"
R.raw.xiaobache -> "3"
R.raw.xiaobache -> "4"
R.raw.huanwei -> "5"
else -> "1"
}
}

View File

@@ -66,7 +66,7 @@ class SceneManager {
sceneModuleTAG.map[TAXI] = SceneModule(true, M_TAXI)
sceneModuleTAG.map[TAXI_P] = SceneModule(true, M_TAXI_P)
sceneModuleTAG.map[SWEEPER] = SceneModule(true, M_SWEEPER)
sceneModuleTAG.map[OTHER] = SceneModule(false, M_OTHER)
sceneModuleTAG.map[OTHER] = SceneModule(true, M_OTHER)
sceneLogTAG.map[TAXI] = SceneTAG(false)
sceneLogTAG.map[BUS] = SceneTAG(false)

View File

@@ -3,17 +3,17 @@ package com.zhjt.mogo_core_function_devatools.upgrade;
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_BINDING;
import android.content.Context;
import android.util.Log;
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
import com.mogo.commons.constants.HostConst;
import com.mogo.eagle.core.data.bindingcar.UpgradeAppInfo;
import com.mogo.eagle.core.data.obu.MogoObuConst;
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager;
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager;
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.util.AppUtils;
import io.reactivex.Observer;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.annotations.NonNull;
@@ -50,15 +50,15 @@ public class ObuUpgradeAppNetWorkManager {
/**
* 获取obu升级信息obu升级服务端使用app升级接口根据screenType区分类型
* mac 工控机mac地址
* mac 工控机mac地址
* screenType 类型
*/
public void getObuUpgradeInfo(Context context, String mac) {
public void getObuUpgradeInfo(Context context, String mac, String versionName) {
// String sn = "X20202203105S688HZ";
// String mac = "48:b0:2d:3a:bc:78";
// String mac1 = "48:b0:2d:4d:33:40";
String sn = MoGoAiCloudClientConfig.getInstance().getSn();
String obuVersionName = String.valueOf(AppUtils.getAppVersionCode()); // TODO 获取obu的版本号, string和int 服务端处理
CallerLogger.INSTANCE.d(M_BINDING + TAG, "getObuUpgradeInfo mac = " + mac + "---sn = " + sn + "---obuVersionName =" + obuVersionName);
CallerLogger.INSTANCE.d(M_BINDING + TAG, "getObuUpgradeInfo mac = " + mac + " ---sn = " + sn + " ---versionName = " + versionName);
UpgradeAppRequest request = new UpgradeAppRequest(sn, mac, "7");
RequestBody requestBody = RequestBody.create(MediaType.get("application/json;charset=UTF-8"), GsonUtil.jsonFromObject(request));
mUpgradeApiService.getUpgradeInfo(requestBody)
@@ -72,10 +72,9 @@ public class ObuUpgradeAppNetWorkManager {
@Override
public void onNext(@NonNull UpgradeAppInfo info) {
if (info != null && info.result != null) {
CallerLogger.INSTANCE.d(M_BINDING + TAG, "getObuUpgradeInfo url = " + info.result.getAppUrl() + "----name = " + info.result.getVersionName() + "--obuVersionName =" + obuVersionName + "--info.result = " + info.result);
if (!String.valueOf(info.result.getVersionName()).equals(obuVersionName)) {
//下载 TAG和文件名 TODO
CallerDevaToolsManager.INSTANCE.downLoadPackage("OBU", info.result.getAppUrl());
CallerLogger.INSTANCE.d(M_BINDING + TAG, "getObuUpgradeInfo appFileName = " + info.result.getAppFileName() + " ----url = " + info.result.getAppUrl() + " ----name = " + info.result.getVersionName() + " --obuVersionName =" + versionName + " ---info.result = " + info.result);
if (!String.valueOf(info.result.getVersionName()).equals(versionName)) { //判断是否下载,当文件名称不一致的时候,就下载
CallerDevaToolsManager.INSTANCE.downLoadPackage(info.result.getAppFileName(), info.result.getAppUrl());
}
} else {
CallerLogger.INSTANCE.d(M_BINDING + TAG, "getObuUpgradeInfo onNext info == null");
@@ -84,7 +83,7 @@ public class ObuUpgradeAppNetWorkManager {
@Override
public void onError(Throwable e) {
CallerLogger.INSTANCE.e(M_BINDING + TAG, "getObuUpgradeInfo e = " + e);
}
@Override

View File

@@ -4,14 +4,17 @@ import android.app.NotificationManager
import android.content.Context
import androidx.core.app.NotificationCompat
import com.elegant.utils.UiThreadHandler
import com.mogo.eagle.core.data.obu.MogoObuConst
import com.mogo.eagle.core.function.api.devatools.IMogoDevaToolsUpgradeListener
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsUpgradeListenerManager
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager.updateStatusBarDownloadView
import com.mogo.eagle.core.function.call.obu.CallerObuApiManager
import com.mogo.eagle.core.utilcode.breakpoint.Config
import com.mogo.eagle.core.utilcode.breakpoint.bean.ThreadBean
import com.mogo.eagle.core.utilcode.breakpoint.callback.IDownload
import com.mogo.eagle.core.utilcode.breakpoint.utils.DownloadUtils
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_DEVA
import com.mogo.eagle.core.utilcode.util.AppUtils
import com.mogo.eagle.core.utilcode.util.ZipUtils
@@ -29,12 +32,18 @@ class UpgradeManager : IDownload {
}
private var map: Map<String, String>? = null
private var mDownloadFileName: String? = null
fun downLoadPackage(context: Context, downloadKey: String,downloadUrl: String) {
CallerLogger.d("${SceneConstant.M_OBU}${MogoObuConst.TAG_UPGRADE_OBU}", "UpgradeManager downLoadPackage = " + downloadUrl?.contains(".zip") + "----downloadKey = $downloadKey ---downloadUrl = $downloadUrl")
if (downloadUrl?.contains(".zip")) {
mDownloadFileName = downloadKey
}
DownloadUtils.downLoad(
context,
downloadUrl,
Config.downLoadPath,
if (downloadUrl?.contains(".zip")) Config.downLoadObuPath else Config.downLoadPath,
downloadKey,
5,
this
@@ -81,7 +90,7 @@ class UpgradeManager : IDownload {
}
override fun onFinished(downloadUrl: String?, threadBean: ThreadBean?) {
if (downloadUrl != null) {
if (downloadUrl != null) { //TODO 需要判断是否是apk文件
AppUtils.installApp(Config.downLoadPath + downloadUrl.substring(downloadUrl.lastIndexOf("/") + 1))
}
if (downloadUrl != null) {
@@ -119,7 +128,7 @@ class UpgradeManager : IDownload {
}
/**
* 鹰眼app下载监听
* 鹰眼app下载监听 liyz
*/
fun updateUpgradeProgress(context: Context) {
val builder = NotificationCompat.Builder(context)
@@ -148,7 +157,8 @@ class UpgradeManager : IDownload {
}, 1000)
}
override fun onError(url: String?, errorMsg: String?) {}
override fun onError(url: String?, errorMsg: String?) {
}
})
}
@@ -162,23 +172,37 @@ class UpgradeManager : IDownload {
override fun onStart(url: String?) {}
override fun onPause(url: String?) {}
override fun onProgress(url: String?, length: Int) {
}
override fun onFinished(url: String?) {
//下载完成,解压文件 TODO
//下载完成,解压文件
try {
val files = ZipUtils.unzipFile("", "")
//传给obu升级
val files = ZipUtils.unzipFile(Config.downLoadObuPath + mDownloadFileName, Config.downLoadUnzipObuPath)
CallerLogger.d("${SceneConstant.M_OBU}${MogoObuConst.TAG_UPGRADE_OBU}", " onFinished file = ${Config.downLoadObuPath + mDownloadFileName} -----files = $files ")
//1传给obu升级,升级成功2需要删除相应文件夹
var md5Path = ""
var tarPath = ""
for (f in files) {
if (f.path.contains(".md5")) {
md5Path = f.path
}
if (f.path.contains(".gz")) {
tarPath = f.path
}
}
CallerLogger.d("${SceneConstant.M_OBU}${MogoObuConst.TAG_UPGRADE_OBU}", "updateObuUpgradeStatus ---md5Path = $md5Path -----tarPath = $tarPath ")
CallerObuApiManager.uploadObuPack(arrayOf(md5Path, tarPath))
} catch (e: IOException) {
//解压失败
//解压失败,删除文件夹
CallerObuApiManager.deleteObuFile()
e.printStackTrace()
}
}
override fun onError(url: String?, errorMsg: String?) {}
override fun onError(url: String?, errorMsg: String?) {
//下载失败,删除文件夹
CallerObuApiManager.deleteObuFile()
}
})
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:startColor="#BB791C"
android:endColor="#BB791C"
android:angle="0"
/>
<corners android:radius="13px" />
</shape>

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:startColor="#566195"
android:endColor="#566195"
android:angle="0"
/>
<corners android:radius="13px" />
</shape>

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:startColor="#3B4577"
android:endColor="#3B4577"
android:angle="0"
/>
<corners android:radius="13px" />
</shape>

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:startColor="#3B4577"
android:endColor="#3B4577"
android:angle="0"
/>
<corners android:radius="16px" />
</shape>

Binary file not shown.

After

Width:  |  Height:  |  Size: 926 B

View File

@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<!-- solid指定形状的填充色只有android:color一个属性 -->
<gradient
android:startColor="#3B4577"
android:endColor="#7CF6FF"
/>
<!-- padding设置内容区域离边界的间距 -->
<!-- corners设置圆角只适用于rectangle -->
<!-- <corners android:bottomRightRadius="20dp"-->
<!-- android:topRightRadius="20dp"/>-->
<corners android:radius="30px"
/>
</shape>

View File

@@ -0,0 +1,31 @@
<?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="30px"
/>
<solid android:color="#3B4577"/>
<stroke
android:color="#7CF6FF"
android:width="1.5px"
/>
</shape>
</item>
<item android:id="@android:id/secondaryProgress">
<scale android:scaleWidth="100%">
<shape>
<corners android:topRightRadius="30px"
android:bottomRightRadius="30px"/>
<solid android:color="#7CF6FF"/>
</shape>
</scale>
</item>
<item android:id="@android:id/progress">
<scale android:scaleWidth="100%"
android:drawable="@drawable/progress_bar_ct" />
</item>
</layer-list>

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:startColor="#029DFF"
android:endColor="#0056FF"
android:angle="0"
/>
<corners android:radius="13px" />
</shape>

View File

@@ -0,0 +1,27 @@
<?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="0dp" />
<gradient
android:startColor="#33A682"
android:endColor="#4ADD80"
/>
</shape>
</item>
<!-- 设置进度条颜色 -->
<item android:id="@android:id/progress">
<clip>
<shape>
<corners android:radius="0dp" />
<gradient
android:startColor="#FFD900"
android:endColor="#FFAB00"
/>
</shape>
</clip>
</item>
</layer-list>

View File

@@ -0,0 +1,38 @@
<?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="21px" />
<gradient
android:startColor="#3B4577"
android:endColor="#D71B0E"
/>
<stroke
android:color="#FF807C"
android:width="1.5px"
/>
</shape>
</item>
<!-- 设置进度条颜色 -->
<item android:id="@android:id/progress">
<clip>
<shape>
<corners
android:bottomLeftRadius="21px"
android:bottomRightRadius="21px"
android:topLeftRadius="21px"
android:topRightRadius="21px"
/>
<gradient
android:startColor="#06D1ED"
android:endColor="#06D1ED"
android:type="radial"
/>
</shape>
</clip>
</item>
</layer-list>

Some files were not shown because too many files have changed in this diff Show More