添加红绿灯时长
This commit is contained in:
@@ -209,6 +209,7 @@ dependencies {
|
||||
releaseImplementation rootProject.ext.dependencies.gpssimulatornoop
|
||||
implementation rootProject.ext.dependencies.modulemedia
|
||||
implementation rootProject.ext.dependencies.moduleservice
|
||||
implementation rootProject.ext.dependencies.moduleobu
|
||||
} else {
|
||||
launcherImplementation project(':main-extensions:mogo-module-main-launcher')
|
||||
// launcherImplementation project(':modules:mogo-module-main')
|
||||
@@ -222,6 +223,7 @@ dependencies {
|
||||
releaseImplementation project(':modules:mogo-module-gps-simulator-noop')
|
||||
implementation project(':modules:mogo-module-media')
|
||||
implementation project(':modules:mogo-module-service')
|
||||
implementation project(':modules:mogo-module-obu')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ MOGO_MODULE_MEDIA_VERSION=1.2.1.12-shunyi
|
||||
MOGO_MODULE_MAIN_LAUNCHER_VERSION = 1.2.1.12-shunyi
|
||||
MOGO_MODULE_MAIN_INDEPENDENT_VERSION = 1.2.1.12-shunyi
|
||||
|
||||
MOGO_MODULE_OBU_VERSION = 1.2.1.13-shunyi
|
||||
MOGO_MODULE_OBU_VERSION = 1.2.1.17-shunyi
|
||||
|
||||
|
||||
## 工程外部模块
|
||||
@@ -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.60-shunyi
|
||||
MOGO_MODULE_V2X_VERSION=1.1.67-shunyi
|
||||
# 推送
|
||||
# 推送
|
||||
MOGO_MODULE_PUSH_VERSION=1.1.5.7-shunyi
|
||||
@@ -89,6 +89,7 @@ BOOST_MULTIDEX_VERSION=1.0.0
|
||||
# hook ARouter分包实现
|
||||
HOOKPLUGIN_VERSION=1.0.0
|
||||
|
||||
|
||||
## 产品库必备配置
|
||||
applicationId=com.mogo.launcer
|
||||
applicationName=IntelligentPilot
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
package com.zhidao.mogo.module.obu
|
||||
|
||||
import android.content.Context
|
||||
import android.view.LayoutInflater
|
||||
import android.widget.Button
|
||||
import com.alibaba.android.arouter.launcher.ARouter
|
||||
import com.mogo.service.IMogoServiceApis
|
||||
import com.mogo.service.MogoServicePaths
|
||||
import com.mogo.utils.logger.Logger
|
||||
import com.zhidao.smartv2x.listener.OnMessageReceiveListener
|
||||
import com.zhidao.smartv2x.model.obu.CarEventInfo
|
||||
@@ -23,28 +29,56 @@ object MockUtil {
|
||||
private lateinit var dataCallback : OnMessageReceiveListener
|
||||
|
||||
private lateinit var intervalObs:Disposable
|
||||
private lateinit var intervalObs2:Disposable
|
||||
|
||||
fun init(callback: OnMessageReceiveListener){
|
||||
fun init(context: Context, callback: OnMessageReceiveListener){
|
||||
Logger.d(TAG, "使用模拟obu数据===")
|
||||
dataCallback = callback
|
||||
val api = ARouter.getInstance().build(MogoServicePaths.PATH_SERVICE_APIS).navigation(context) as IMogoServiceApis
|
||||
val view = LayoutInflater.from(context).inflate(R.layout.mock_obu, null)
|
||||
view.findViewById<Button>(R.id.btnVip).setOnClickListener {
|
||||
val carEventInfo = CarEventInfo()
|
||||
carEventInfo.type = "vip变灯提醒"
|
||||
carEventInfo.typeCode = "vip变灯提醒"
|
||||
val r = Random.nextInt(0, 2)
|
||||
carEventInfo.describe = when (r) {
|
||||
0 -> "已更改前方红绿灯状态,可优先通行"
|
||||
else -> "已增加前方绿灯时间,可优先通行"
|
||||
}
|
||||
dataCallback.showCarEventInfo(carEventInfo)
|
||||
}
|
||||
|
||||
view.findViewById<Button>(R.id.btnRoadCondition).setOnClickListener {
|
||||
val carEventInfo = CarEventInfo()
|
||||
carEventInfo.type = "行人碰撞预警"
|
||||
carEventInfo.typeCode = "39"
|
||||
carEventInfo.describe = "这个应该是随便写,反正也不用"
|
||||
dataCallback.showCarEventInfo(carEventInfo)
|
||||
}
|
||||
api.windowManagerApi.addView(view, 960, 500, false)
|
||||
intervalMockData()
|
||||
}
|
||||
|
||||
private fun intervalMockData(){
|
||||
intervalObs = Observable.interval(5000,TimeUnit.MILLISECONDS).map {
|
||||
it.toString()
|
||||
}.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe {
|
||||
// debugCarEvent()
|
||||
}.subscribeOn(io()).observeOn(io()).subscribe {
|
||||
debugTrafficLight()
|
||||
}
|
||||
// intervalObs2 = Observable.interval(5000,TimeUnit.MILLISECONDS).map {
|
||||
// it.toString()
|
||||
// }.subscribeOn(io()).observeOn(AndroidSchedulers.mainThread()).subscribe {
|
||||
// debugCarEvent()
|
||||
// }
|
||||
}
|
||||
|
||||
fun destroy(){
|
||||
intervalObs.dispose()
|
||||
intervalObs2.dispose()
|
||||
}
|
||||
|
||||
private fun debugCarEvent(){
|
||||
val random = Random.nextInt(0, 3)
|
||||
val random = Random.nextInt(0, 4)
|
||||
Logger.d(TAG, "random====$random")
|
||||
val carEventInfo = CarEventInfo()
|
||||
when (random) {
|
||||
@@ -92,6 +126,9 @@ object MockUtil {
|
||||
}
|
||||
|
||||
private fun debugTrafficLight(){
|
||||
Logger.d(TAG,"准备开始红绿灯模拟数据发送===")
|
||||
Thread.sleep(20_000)
|
||||
Logger.d(TAG,"开始红绿灯模拟数据发送===")
|
||||
val trafficLightInfo = TrafficLightInfo()
|
||||
trafficLightInfo.id = "12"
|
||||
// 先来6秒红灯
|
||||
@@ -119,6 +156,7 @@ object MockUtil {
|
||||
dataCallback.showTrafficLightInfo(trafficLightInfo)
|
||||
Thread.sleep(1000)
|
||||
}
|
||||
Logger.d(TAG, "红绿灯模拟数据发送结束====")
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ class ObuManager: IMogoObuManager,Handler.Callback {
|
||||
override fun init(context: Context) {
|
||||
Logger.d(TAG,"init=======")
|
||||
if (DebugConfig.isUseMockObuData()) {
|
||||
MockUtil.init(this)
|
||||
MockUtil.init(context,this)
|
||||
} else {
|
||||
// 初始化sdk,注册数据回调等信息
|
||||
V2xController.getInstance().setMessageReceiveListener(this)
|
||||
|
||||
21
modules/mogo-module-obu/src/main/res/layout/mock_obu.xml
Normal file
21
modules/mogo-module-obu/src/main/res/layout/mock_obu.xml
Normal file
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="horizontal" android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/btnVip"
|
||||
android:text="vip"/>
|
||||
|
||||
<Space
|
||||
android:layout_width="10dp"
|
||||
android:layout_height="wrap_content" />
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/btnRoadCondition"
|
||||
android:text="行人" />
|
||||
|
||||
</LinearLayout>
|
||||
Reference in New Issue
Block a user