This commit is contained in:
tongchenfei
2020-06-28 10:00:32 +08:00
parent 02452f0549
commit 2cf3bc8463
5 changed files with 47 additions and 27 deletions

View File

@@ -43,6 +43,7 @@ public class MogoApplication extends AbsMogoApplication {
DebugConfig.setLaunchLocationService(BuildConfig.LAUNCH_LOCATION_SERVICE);
DebugConfig.setUseCustomNavi(BuildConfig.USE_CUSTOM_NAVI);
DebugConfig.setLauncher(BuildConfig.IS_LAUNCHER);
DebugConfig.setUseMockObuData(true);
super.onCreate();
// Crash 日志收集
final long start = System.currentTimeMillis();
@@ -66,6 +67,7 @@ public class MogoApplication extends AbsMogoApplication {
MogoModulePaths.addModule(new MogoModule(MogoServicePaths.PATH_SHARE, "ShareControl"));
MogoModulePaths.addBaseModule( new MogoModule( ServiceConst.PATH_REFRESH_STRATEGY, ServiceConst.PATH_REFRESH_STRATEGY ) );
MogoModulePaths.addBaseModule(new MogoModule(MogoServicePaths.PATH_OBU,"moduleObu"));
MogoModulePaths.addBaseModule( new MogoModule( V2XConst.PATH_V2X_UI, V2XConst.PATH_V2X_UI ) );
// 暂时去掉推送
// MogoModulePaths.addModule(new MogoModule(PushUIConstants.TAG, PushUIConstants.TAG));

View File

@@ -73,7 +73,7 @@ MOGO_MODULE_GUIDESHOW_PROVIDER_VERSION=1.0.2-SNAPSHOT
# 在线车辆F
MOGO_MODULE_ONLINECAR_VERSION=1.0.3.2
# v2x
MOGO_MODULE_V2X_VERSION=1.1.36
MOGO_MODULE_V2X_VERSION=1.1.36-SNAPSHOT
# 推送
MOGO_MODULE_PUSH_VERSION=1.0.1
# 广告资源位

View File

@@ -126,10 +126,10 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
mMogoMapService.getHostListenerRegister().registerMarkerClickListener( this );
}
// IMogoObuManager obuManager = mServiceApis.getObuManager();
// if(obuManager!=null) {
// obuManager.registerObuDataChangedListener(EventDispatchCenter.getInstance());
// }
IMogoObuManager obuManager = mServiceApis.getObuManager();
if(obuManager!=null) {
obuManager.registerObuDataChangedListener(EventDispatchCenter.getInstance());
}
EventDispatchCenter.getInstance().setMapLoadedCallback( () -> {
Logger.d( TAG, "map loaded." + Thread.currentThread().getName() );

View File

@@ -34,10 +34,7 @@ android {
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation rootProject.ext.dependencies.kotlinstdlibjdk7
implementation rootProject.ext.dependencies.androidxappcompat
implementation rootProject.ext.dependencies.androidxrecyclerview
implementation rootProject.ext.dependencies.androidxccorektx
implementation rootProject.ext.dependencies.androidxconstraintlayout
implementation rootProject.ext.dependencies.arouter
kapt rootProject.ext.dependencies.aroutercompiler
implementation rootProject.ext.dependencies.rxjava

View File

@@ -1,18 +1,16 @@
package com.zhidao.mogo.module.obu
import com.mogo.service.obu.IMogoObuDataChangedListener
import com.mogo.utils.logger.Logger
import com.zhidao.smartv2x.listener.OnMessageReceiveListener
import com.zhidao.smartv2x.model.obu.CarEventInfo
import com.zhidao.smartv2x.model.obu.CarLocationInfo
import com.zhidao.smartv2x.model.obu.TrafficLightInfo
import io.reactivex.Observable
import io.reactivex.Scheduler
import io.reactivex.Single
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.disposables.Disposable
import io.reactivex.internal.operators.single.SingleSubscribeOn
import io.reactivex.schedulers.Schedulers
import io.reactivex.schedulers.Schedulers.io
import java.util.concurrent.TimeUnit
import kotlin.random.Random
/**
* 模拟相关操作及数据的单例类
@@ -32,21 +30,44 @@ object MockUtil {
}
private fun intervalMockData(){
intervalObs = Observable.interval(1000,TimeUnit.MILLISECONDS).map {
intervalObs = Observable.interval(5000,TimeUnit.MILLISECONDS).map {
it.toString()
}.subscribe {
val carLocationInfo = CarLocationInfo()
carLocationInfo.carId = "carLocation$it"
dataCallback.showCarLocationInfo(carLocationInfo)
val other = "other$it"
dataCallback.showOtherInfo(other)
val eventInfo = CarEventInfo()
eventInfo.describe = "event des $it"
eventInfo.type = "event type $it"
dataCallback.showCarEventInfo(eventInfo)
val traffic = TrafficLightInfo()
traffic.id = "traffic $it"
dataCallback.showTrafficLightInfo(traffic)
}.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe {
val random = Random.nextInt(0, 3)
Logger.d(TAG, "random====$random")
val carEventInfo = CarEventInfo()
when (random) {
0->{
// 绿波引导
carEventInfo.type = ObuConstant.TYPE_OPTIMAL_SPEED_ADVISORY.toString()
carEventInfo.typeCode = ObuConstant.TYPE_OPTIMAL_SPEED_ADVISORY.toString()
val r = Random.nextInt(0, 3)
carEventInfo.describe = when (r) {
0 -> "保持当前车速行驶!"
1 -> "建议50km/h车速行驶"
else -> "建议30km/h ~ 50km/h 车速行驶"
}
dataCallback.showCarEventInfo(carEventInfo)
}
1->{
// 前方急刹预警
carEventInfo.type = ObuConstant.TYPE_URGENCY_COLLISION_WARNING.toString()
carEventInfo.typeCode = ObuConstant.TYPE_URGENCY_COLLISION_WARNING.toString()
carEventInfo.describe = "这个应该是随便写,反正也不用"
dataCallback.showCarEventInfo(carEventInfo)
}
2->{
// 行人碰撞预警
carEventInfo.type = ObuConstant.TYPE_ROAD_USER_COLLISION_WARNING.toString()
carEventInfo.typeCode = ObuConstant.TYPE_ROAD_USER_COLLISION_WARNING.toString()
carEventInfo.describe = "这个应该是随便写,反正也不用"
dataCallback.showCarEventInfo(carEventInfo)
}
else->{
// 其他,不处理
}
}
}
}