重构obu模块,新增udp通信
This commit is contained in:
2
.idea/misc.xml
generated
2
.idea/misc.xml
generated
@@ -4,7 +4,7 @@
|
||||
<asm skipDebug="false" skipFrames="false" skipCode="false" expandFrames="false" />
|
||||
<groovy codeStyle="LEGACY" />
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="JDK" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
</project>
|
||||
@@ -337,7 +337,7 @@ dependencies {
|
||||
implementation rootProject.ext.dependencies.mogomoduleauth
|
||||
implementation rootProject.ext.dependencies.modulemedia
|
||||
implementation rootProject.ext.dependencies.moduleservice
|
||||
implementation rootProject.ext.dependencies.moduleobu
|
||||
// implementation rootProject.ext.dependencies.moduleobu
|
||||
implementation rootProject.ext.dependencies.modulesplash
|
||||
implementation rootProject.ext.dependencies.moduleV2x
|
||||
implementation rootProject.ext.dependencies.moduletanlu, {
|
||||
@@ -355,7 +355,7 @@ dependencies {
|
||||
implementation project(':modules:mogo-module-authorize')
|
||||
implementation project(':modules:mogo-module-media')
|
||||
implementation project(':modules:mogo-module-service')
|
||||
implementation project(':modules:mogo-module-obu')
|
||||
// implementation project(':modules:mogo-module-obu')
|
||||
implementation project(':modules:mogo-module-splash')
|
||||
implementation project(':modules:mogo-module-v2x')
|
||||
implementation project(':modules:mogo-module-tanlu'), {
|
||||
|
||||
@@ -97,6 +97,7 @@ public class MogoApplication extends AbsMogoApplication {
|
||||
// 碰撞报警模块
|
||||
MogoModulePaths.addModule(new MogoModule(MogoServicePaths.PATH_CRASH_WARNING,
|
||||
"CrashWarning"));
|
||||
|
||||
if ( !DebugConfig.isLauncher() ) {
|
||||
PersistentManager.getInstance().initManager( this );
|
||||
Intent intent = new Intent( this, MogoMainService.class );
|
||||
|
||||
@@ -28,7 +28,7 @@ public class DebugConfig {
|
||||
*
|
||||
* @param sDebug true - 调试模式 false - 非调试模式
|
||||
*/
|
||||
public static void setDebug( boolean sDebug ) {
|
||||
public static void setDebug(boolean sDebug) {
|
||||
DebugConfig.sDebug = sDebug;
|
||||
}
|
||||
|
||||
@@ -83,6 +83,15 @@ public class DebugConfig {
|
||||
|
||||
private static int sCarMachineType = CAR_MACHINE_TYPE_SELF_INNOVATE;
|
||||
|
||||
/**
|
||||
* 西迪obu
|
||||
*/
|
||||
public static final int OBU_TYPE_CIDI = 1;
|
||||
/**
|
||||
* 华砺智行obu
|
||||
*/
|
||||
public static final int OBU_TYPE_HUALI = 2;
|
||||
|
||||
/**
|
||||
* 获取网络环境类型
|
||||
*
|
||||
@@ -102,7 +111,7 @@ public class DebugConfig {
|
||||
* {@link #NET_MODE_DEMO}
|
||||
* {@link #NET_MODE_RELEASE}
|
||||
*/
|
||||
public static void setNetMode( int netMode ) {
|
||||
public static void setNetMode(int netMode) {
|
||||
DebugConfig.sNetMode = netMode;
|
||||
}
|
||||
|
||||
@@ -115,7 +124,7 @@ public class DebugConfig {
|
||||
return sLaunchLocationService;
|
||||
}
|
||||
|
||||
public static void setLaunchLocationService( boolean launchLocationService ) {
|
||||
public static void setLaunchLocationService(boolean launchLocationService) {
|
||||
DebugConfig.sLaunchLocationService = launchLocationService;
|
||||
}
|
||||
|
||||
@@ -128,7 +137,7 @@ public class DebugConfig {
|
||||
return sUseCustomNavi;
|
||||
}
|
||||
|
||||
public static void setUseCustomNavi( boolean sUseCustomNavi ) {
|
||||
public static void setUseCustomNavi(boolean sUseCustomNavi) {
|
||||
DebugConfig.sUseCustomNavi = sUseCustomNavi;
|
||||
}
|
||||
|
||||
@@ -137,8 +146,8 @@ public class DebugConfig {
|
||||
*
|
||||
* @param aiType {@link #AI_TYPE_NOOP} {@link #AI_TYPE_TXZ} {@link #AI_TYPE_SPEECH}
|
||||
*/
|
||||
public static void setAIType( int aiType ) {
|
||||
Logger.d( "DebugConfig", "setAiType: " + aiType );
|
||||
public static void setAIType(int aiType) {
|
||||
Logger.d("DebugConfig", "setAiType: " + aiType);
|
||||
sAIType = aiType;
|
||||
}
|
||||
|
||||
@@ -154,7 +163,7 @@ public class DebugConfig {
|
||||
*
|
||||
* @param type {@link #CAR_MACHINE_TYPE_SELF_INNOVATE} {@link #CAR_MACHINE_TYPE_BYD}
|
||||
*/
|
||||
public static void setCarMachineType( int type ) {
|
||||
public static void setCarMachineType(int type) {
|
||||
sCarMachineType = type;
|
||||
}
|
||||
|
||||
@@ -176,7 +185,7 @@ public class DebugConfig {
|
||||
return sIsLauncher;
|
||||
}
|
||||
|
||||
public static void setLauncher( boolean isLauncher ) {
|
||||
public static void setLauncher(boolean isLauncher) {
|
||||
DebugConfig.sIsLauncher = isLauncher;
|
||||
}
|
||||
|
||||
@@ -186,7 +195,7 @@ public class DebugConfig {
|
||||
return sRequestOnlineCarData;
|
||||
}
|
||||
|
||||
public static void setRequestOnlineCarData( boolean sRequestOnlineCarData ) {
|
||||
public static void setRequestOnlineCarData(boolean sRequestOnlineCarData) {
|
||||
DebugConfig.sRequestOnlineCarData = sRequestOnlineCarData;
|
||||
}
|
||||
|
||||
@@ -199,13 +208,13 @@ public class DebugConfig {
|
||||
return sActiveAIAssistFlag;
|
||||
}
|
||||
|
||||
public static void setActiveAIAssistFlag( boolean sActiveAIAssistFlag ) {
|
||||
public static void setActiveAIAssistFlag(boolean sActiveAIAssistFlag) {
|
||||
DebugConfig.sActiveAIAssistFlag = sActiveAIAssistFlag;
|
||||
}
|
||||
|
||||
private static boolean useMockObuData;
|
||||
|
||||
public static void setUseMockObuData( boolean use ) {
|
||||
public static void setUseMockObuData(boolean use) {
|
||||
useMockObuData = use;
|
||||
}
|
||||
|
||||
@@ -224,13 +233,13 @@ public class DebugConfig {
|
||||
*
|
||||
* @param sProductFlavor
|
||||
*/
|
||||
public static void setProductFlavor( String sProductFlavor ) {
|
||||
public static void setProductFlavor(String sProductFlavor) {
|
||||
DebugConfig.sProductFlavor = sProductFlavor;
|
||||
}
|
||||
|
||||
private static String sSocketAppId;
|
||||
|
||||
public static void setSocketAppId( String sSocketAppId ) {
|
||||
public static void setSocketAppId(String sSocketAppId) {
|
||||
DebugConfig.sSocketAppId = sSocketAppId;
|
||||
}
|
||||
|
||||
@@ -247,14 +256,14 @@ public class DebugConfig {
|
||||
return sRoadEventAnimated;
|
||||
}
|
||||
|
||||
public static void setRoadEventAnimated( boolean sRoadEventAnimated ) {
|
||||
public static void setRoadEventAnimated(boolean sRoadEventAnimated) {
|
||||
DebugConfig.sRoadEventAnimated = sRoadEventAnimated;
|
||||
}
|
||||
|
||||
|
||||
private static boolean sLoadGuideModule = false;
|
||||
|
||||
public static void setLoadGuideModule( boolean sLoadGuideModule ) {
|
||||
public static void setLoadGuideModule(boolean sLoadGuideModule) {
|
||||
DebugConfig.sLoadGuideModule = sLoadGuideModule;
|
||||
}
|
||||
|
||||
@@ -264,17 +273,27 @@ public class DebugConfig {
|
||||
|
||||
private static String SP_GUIDE = "SP_GUIDE_2020_09_09";
|
||||
|
||||
public static String getSpGuide(){
|
||||
public static String getSpGuide() {
|
||||
return SP_GUIDE;
|
||||
}
|
||||
|
||||
private static boolean isSkinSupported = false;
|
||||
|
||||
public static void setSkinSupported( boolean isSkinSupported ) {
|
||||
public static void setSkinSupported(boolean isSkinSupported) {
|
||||
DebugConfig.isSkinSupported = isSkinSupported;
|
||||
}
|
||||
|
||||
public static boolean isSkinSupported() {
|
||||
return isSkinSupported;
|
||||
}
|
||||
|
||||
private static int obuType = OBU_TYPE_HUALI;
|
||||
|
||||
public static int getObuType() {
|
||||
return obuType;
|
||||
}
|
||||
|
||||
public static void setObuType(int type) {
|
||||
obuType = type;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,14 +21,10 @@ import com.mogo.map.navi.MogoTraffic;
|
||||
import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.module.main.registercenter.MogoRegisterCenterHandler;
|
||||
import com.mogo.service.adas.IMogoADASControlStatusChangedListener;
|
||||
import com.mogo.service.obu.IMogoObuDataChangedListener;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.zhidao.adasconfig.common.config.EnumCarChatIncognitoMode;
|
||||
import com.zhidao.adasconfig.listener.IAdasSettingUIListener;
|
||||
import com.zhidao.adasconfig.listener.IAdasSkinStyleListener;
|
||||
import com.zhidao.smartv2x.model.obu.CarEventInfo;
|
||||
import com.zhidao.smartv2x.model.obu.CarLocationInfo;
|
||||
import com.zhidao.smartv2x.model.obu.TrafficLightInfo;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
@@ -46,7 +42,6 @@ public class EventDispatchCenter implements
|
||||
IMogoMapListener,
|
||||
IMogoNaviListener2,
|
||||
IMogoLocationListener,
|
||||
IMogoObuDataChangedListener,
|
||||
IAdasSettingUIListener,
|
||||
IAdasSkinStyleListener {
|
||||
|
||||
@@ -486,50 +481,6 @@ public class EventDispatchCenter implements
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showCarLocationInfo( CarLocationInfo info ) {
|
||||
Iterator< IMogoObuDataChangedListener > iterator = MogoRegisterCenterHandler.getInstance().getObuDataChangedListeners();
|
||||
if ( iterator == null ) {
|
||||
return;
|
||||
}
|
||||
while ( iterator.hasNext() ) {
|
||||
iterator.next().showCarLocationInfo( info );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showOtherInfo( String info ) {
|
||||
Iterator< IMogoObuDataChangedListener > iterator = MogoRegisterCenterHandler.getInstance().getObuDataChangedListeners();
|
||||
if ( iterator == null ) {
|
||||
return;
|
||||
}
|
||||
while ( iterator.hasNext() ) {
|
||||
iterator.next().showOtherInfo( info );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showTrafficLightInfo( TrafficLightInfo info ) {
|
||||
Iterator< IMogoObuDataChangedListener > iterator = MogoRegisterCenterHandler.getInstance().getObuDataChangedListeners();
|
||||
if ( iterator == null ) {
|
||||
return;
|
||||
}
|
||||
while ( iterator.hasNext() ) {
|
||||
iterator.next().showTrafficLightInfo( info );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showCarEventInfo( CarEventInfo info ) {
|
||||
Iterator< IMogoObuDataChangedListener > iterator = MogoRegisterCenterHandler.getInstance().getObuDataChangedListeners();
|
||||
if ( iterator == null ) {
|
||||
return;
|
||||
}
|
||||
while ( iterator.hasNext() ) {
|
||||
iterator.next().showCarEventInfo( info );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void northModel() {
|
||||
Iterator< IMogoADASControlStatusChangedListener > iterator = MogoRegisterCenterHandler.getInstance().getAdasControlStatusChangedListeners();
|
||||
|
||||
@@ -6,9 +6,6 @@ import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.commons.mvp.MvpActivity;
|
||||
@@ -30,7 +27,6 @@ import com.mogo.service.adas.IMogoADASControlStatusChangedListener;
|
||||
import com.mogo.service.fragmentmanager.IMogoFragmentManager;
|
||||
import com.mogo.service.map.IMogoMapService;
|
||||
import com.mogo.service.module.IMogoModuleProvider;
|
||||
import com.mogo.service.obu.IMogoObuManager;
|
||||
import com.mogo.service.statusmanager.IMogoStatusManager;
|
||||
import com.mogo.skin.support.SkinMode;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
@@ -40,6 +36,9 @@ import com.zhidao.autopilot.support.api.AutopilotServiceManage;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-23
|
||||
@@ -159,11 +158,6 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
||||
mMogoMapService.getHostListenerRegister().registerMarkerClickListener( this );
|
||||
}
|
||||
|
||||
IMogoObuManager obuManager = mServiceApis.getObuManager();
|
||||
if(obuManager!=null) {
|
||||
obuManager.registerObuDataChangedListener(EventDispatchCenter.getInstance());
|
||||
}
|
||||
|
||||
if ( DebugConfig.isSkinSupported() ) {
|
||||
initAdasControlStatusListener();
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.adas.IMogoADASControlStatusChangedListener;
|
||||
import com.mogo.service.module.IMogoModuleLifecycle;
|
||||
import com.mogo.service.module.IMogoRegisterCenter;
|
||||
import com.mogo.service.obu.IMogoObuDataChangedListener;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
@@ -101,16 +100,6 @@ public class MogoRegisterCenter implements IMogoRegisterCenter {
|
||||
MogoRegisterCenterHandler.getInstance().unregisterCarLocationChangedListener( tag, listener );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerObuDataListener( String tag, IMogoObuDataChangedListener listener ) {
|
||||
MogoRegisterCenterHandler.getInstance().registerObuDataListener( tag, listener );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterObuDataListener( String tag ) {
|
||||
MogoRegisterCenterHandler.getInstance().unregisterObuDataListener( tag );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerADASControlStatusChangedListener( String tag, IMogoADASControlStatusChangedListener listener ) {
|
||||
MogoRegisterCenterHandler.getInstance().registerADASControlStatusChangedListener( tag, listener );
|
||||
|
||||
@@ -11,7 +11,6 @@ import com.mogo.map.navi.IMogoNaviListener;
|
||||
import com.mogo.service.adas.IMogoADASControlStatusChangedListener;
|
||||
import com.mogo.service.module.IMogoModuleLifecycle;
|
||||
import com.mogo.service.module.IMogoRegisterCenter;
|
||||
import com.mogo.service.obu.IMogoObuDataChangedListener;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
@@ -34,7 +33,6 @@ public class MogoRegisterCenterHandler implements IMogoRegisterCenter {
|
||||
private Map< String, IMogoMarkerClickListener > mMarker = new HashMap<>();
|
||||
private Map< String, IMogoAimlessModeListener > mAimless = new HashMap<>();
|
||||
private Map< String, IMogoCarLocationChangedListener > mCarLocations = new HashMap<>();
|
||||
private Map< String, IMogoObuDataChangedListener > mObus = new HashMap<>();
|
||||
private Map< String, IMogoADASControlStatusChangedListener > mADAS = new HashMap<>();
|
||||
|
||||
private MogoRegisterCenterHandler() {
|
||||
@@ -126,16 +124,6 @@ public class MogoRegisterCenterHandler implements IMogoRegisterCenter {
|
||||
mCarLocations.remove( tag );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerObuDataListener( String tag, IMogoObuDataChangedListener listener ) {
|
||||
mObus.put( tag, listener );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterObuDataListener( String tag ) {
|
||||
mObus.remove( tag );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerADASControlStatusChangedListener( String tag, IMogoADASControlStatusChangedListener listener ) {
|
||||
mADAS.put( tag, listener );
|
||||
@@ -182,10 +170,6 @@ public class MogoRegisterCenterHandler implements IMogoRegisterCenter {
|
||||
return mNavi.values().iterator();
|
||||
}
|
||||
|
||||
public Iterator< IMogoObuDataChangedListener > getObuDataChangedListeners() {
|
||||
return mObus.values().iterator();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator< IMogoLocationListener > getLocationListeners() {
|
||||
return mLocation.values().iterator();
|
||||
|
||||
@@ -39,6 +39,9 @@ dependencies {
|
||||
kapt rootProject.ext.dependencies.aroutercompiler
|
||||
implementation rootProject.ext.dependencies.rxjava
|
||||
implementation rootProject.ext.dependencies.rxandroid
|
||||
|
||||
implementation rootProject.ext.dependencies.obusdk
|
||||
implementation 'com.mogo.module:module-crash-warning:1.1.0'
|
||||
if (Boolean.valueOf(RELEASE)) {
|
||||
implementation rootProject.ext.dependencies.modulecommon
|
||||
} else {
|
||||
|
||||
@@ -26,12 +26,12 @@ import kotlin.random.Random
|
||||
*/
|
||||
object MockUtil {
|
||||
const val TAG = "MockUtil"
|
||||
private lateinit var dataCallback : OnMessageReceiveListener
|
||||
private var dataCallback : OnMessageReceiveListener?=null
|
||||
|
||||
private lateinit var intervalObs:Disposable
|
||||
private lateinit var intervalObs2:Disposable
|
||||
|
||||
fun init(context: Context, callback: OnMessageReceiveListener){
|
||||
fun init(context: Context, callback: OnMessageReceiveListener? = null){
|
||||
Logger.d(TAG, "使用模拟obu数据===")
|
||||
dataCallback = callback
|
||||
val api = ARouter.getInstance().build(MogoServicePaths.PATH_SERVICE_APIS).navigation(context) as IMogoServiceApis
|
||||
@@ -45,7 +45,7 @@ object MockUtil {
|
||||
0 -> "已更改前方红绿灯状态,可优先通行"
|
||||
else -> "已增加前方绿灯时间,可优先通行"
|
||||
}
|
||||
dataCallback.showCarEventInfo(carEventInfo)
|
||||
dataCallback?.showCarEventInfo(carEventInfo)
|
||||
}
|
||||
|
||||
view.findViewById<Button>(R.id.btnRoadCondition).setOnClickListener {
|
||||
@@ -53,7 +53,7 @@ object MockUtil {
|
||||
carEventInfo.type = "行人碰撞预警"
|
||||
carEventInfo.typeCode = "39"
|
||||
carEventInfo.describe = "这个应该是随便写,反正也不用"
|
||||
dataCallback.showCarEventInfo(carEventInfo)
|
||||
dataCallback?.showCarEventInfo(carEventInfo)
|
||||
}
|
||||
api.windowManagerApi.addView(view, 500, 300, false)
|
||||
intervalMockData()
|
||||
@@ -92,21 +92,21 @@ object MockUtil {
|
||||
1 -> "建议50km/h车速行驶"
|
||||
else -> "建议30km/h ~ 50km/h 车速行驶"
|
||||
}
|
||||
dataCallback.showCarEventInfo(carEventInfo)
|
||||
dataCallback?.showCarEventInfo(carEventInfo)
|
||||
}
|
||||
1->{
|
||||
// 前方急刹预警
|
||||
carEventInfo.type = "紧急制动预警"
|
||||
carEventInfo.typeCode = "06"
|
||||
carEventInfo.describe = "这个应该是随便写,反正也不用"
|
||||
dataCallback.showCarEventInfo(carEventInfo)
|
||||
dataCallback?.showCarEventInfo(carEventInfo)
|
||||
}
|
||||
2->{
|
||||
// 行人碰撞预警
|
||||
carEventInfo.type = "行人碰撞预警"
|
||||
carEventInfo.typeCode = "39"
|
||||
carEventInfo.describe = "这个应该是随便写,反正也不用"
|
||||
dataCallback.showCarEventInfo(carEventInfo)
|
||||
dataCallback?.showCarEventInfo(carEventInfo)
|
||||
}
|
||||
3 -> {
|
||||
// vip变灯提醒
|
||||
@@ -117,7 +117,7 @@ object MockUtil {
|
||||
0 -> "已更改前方红绿灯状态,可优先通行"
|
||||
else -> "已增加前方绿灯时间,可优先通行"
|
||||
}
|
||||
dataCallback.showCarEventInfo(carEventInfo)
|
||||
dataCallback?.showCarEventInfo(carEventInfo)
|
||||
}
|
||||
else->{
|
||||
// 其他,不处理
|
||||
@@ -135,7 +135,7 @@ object MockUtil {
|
||||
trafficLightInfo.lightStatus = "R"
|
||||
for (i in 0..5) {
|
||||
trafficLightInfo.surplusTime = (5-i).toString()
|
||||
dataCallback.showTrafficLightInfo(trafficLightInfo)
|
||||
dataCallback?.showTrafficLightInfo(trafficLightInfo)
|
||||
Thread.sleep(1000)
|
||||
}
|
||||
// 停5秒
|
||||
@@ -144,7 +144,7 @@ object MockUtil {
|
||||
trafficLightInfo.lightStatus = "Y"
|
||||
for (i in 0..5) {
|
||||
trafficLightInfo.surplusTime = (5-i).toString()
|
||||
dataCallback.showTrafficLightInfo(trafficLightInfo)
|
||||
dataCallback?.showTrafficLightInfo(trafficLightInfo)
|
||||
Thread.sleep(1000)
|
||||
}
|
||||
// 停5秒
|
||||
@@ -153,7 +153,7 @@ object MockUtil {
|
||||
trafficLightInfo.lightStatus = "G"
|
||||
for (i in 0..5) {
|
||||
trafficLightInfo.surplusTime = (5-i).toString()
|
||||
dataCallback.showTrafficLightInfo(trafficLightInfo)
|
||||
dataCallback?.showTrafficLightInfo(trafficLightInfo)
|
||||
Thread.sleep(1000)
|
||||
}
|
||||
Logger.d(TAG, "红绿灯模拟数据发送结束====")
|
||||
|
||||
@@ -1,136 +1,47 @@
|
||||
package com.zhidao.mogo.module.obu
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Bundle
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
import android.os.Message
|
||||
import android.view.View
|
||||
import androidx.fragment.app.Fragment
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.mogo.commons.debug.DebugConfig
|
||||
import com.mogo.map.listener.IMogoMapListener
|
||||
import com.mogo.map.location.IMogoLocationListener
|
||||
import com.mogo.map.marker.IMogoMarkerClickListener
|
||||
import com.mogo.map.navi.IMogoNaviListener
|
||||
import com.mogo.service.MogoServicePaths
|
||||
import com.mogo.service.module.IMogoModuleLifecycle
|
||||
import com.mogo.service.obu.IMogoObuDataChangedListener
|
||||
import com.mogo.service.obu.IMogoObuManager
|
||||
import com.mogo.utils.logger.Logger
|
||||
import com.zhidao.mogo.module.obu.obu.CidiObu
|
||||
import com.zhidao.mogo.module.obu.obu.HualiObu
|
||||
import com.zhidao.mogo.module.obu.obu.IObu
|
||||
import com.zhidao.mogo.module.obu.obu.IObuCallback
|
||||
import com.zhidao.smartv2x.api.V2xController
|
||||
import com.zhidao.smartv2x.model.obu.CarEventInfo
|
||||
import com.zhidao.smartv2x.model.obu.CarLocationInfo
|
||||
import com.zhidao.smartv2x.model.obu.TrafficLightInfo
|
||||
|
||||
/**
|
||||
* obu provider
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
@Route(path = MogoServicePaths.PATH_OBU)
|
||||
class ObuManager: IMogoObuManager,Handler.Callback {
|
||||
class ObuManager {
|
||||
companion object{
|
||||
const val TAG = "ObuManger"
|
||||
const val MSG_MONITOR_OBU_STATUS = 1001
|
||||
const val DEFAULT_MONITOR_TIME = 10_000L
|
||||
}
|
||||
private var dataChangedListener: IMogoObuDataChangedListener? = null
|
||||
|
||||
private var handler = Handler(Looper.getMainLooper(), this)
|
||||
// private var handler = Handler(Looper.getMainLooper(), this)
|
||||
|
||||
override fun init(context: Context) {
|
||||
private lateinit var obu:IObu
|
||||
|
||||
fun init(context: Context) {
|
||||
Logger.d(TAG,"init=======")
|
||||
if (DebugConfig.isUseMockObuData()) {
|
||||
MockUtil.init(context,this)
|
||||
MockUtil.init(context)
|
||||
} else {
|
||||
// 初始化sdk,注册数据回调等信息
|
||||
V2xController.getInstance().setMessageReceiveListener(this)
|
||||
V2xController.getInstance().init()
|
||||
// V2xController.getInstance().setMessageReceiveListener(this@ObuManager)
|
||||
handler.sendEmptyMessageDelayed(MSG_MONITOR_OBU_STATUS, DEFAULT_MONITOR_TIME)
|
||||
}
|
||||
}
|
||||
|
||||
override fun registerObuDataChangedListener(listener: IMogoObuDataChangedListener?) {
|
||||
this.dataChangedListener = listener
|
||||
}
|
||||
|
||||
/**
|
||||
* 车辆位置信息回调接口
|
||||
*/
|
||||
override fun showCarLocationInfo(info: CarLocationInfo?) {
|
||||
Logger.v(TAG, "thread: ${Thread.currentThread()} showCarLocationInfo: ${info?.carId}")
|
||||
if(!DebugConfig.isUseMockObuData()) {
|
||||
// 不使用模拟数据时候不做此处理
|
||||
// 由于obu会频繁回调此接口,故10秒收不到此数据,则认为obu连接不正常,就断开重连一下
|
||||
handler.removeMessages(MSG_MONITOR_OBU_STATUS)
|
||||
handler.sendEmptyMessageDelayed(MSG_MONITOR_OBU_STATUS, DEFAULT_MONITOR_TIME)
|
||||
}
|
||||
|
||||
handler.post{
|
||||
dataChangedListener?.showCarLocationInfo(info)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* UDP 收发消息回调接口
|
||||
*/
|
||||
override fun showOtherInfo(info: String?) {
|
||||
Logger.d(TAG, "thread: ${Thread.currentThread()} showOtherInfo: $info")
|
||||
handler.post{
|
||||
dataChangedListener?.showOtherInfo(info)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 交通信号灯信息回调接口
|
||||
* 17号路口红绿灯倒计时出现了,如果[TrafficLightInfo.lightStatus]为0,或者说,不为G/Y/R时,此条红绿灯数据无效
|
||||
*/
|
||||
override fun showTrafficLightInfo(info: TrafficLightInfo?) {
|
||||
Logger.d(TAG, "thread: ${Thread.currentThread()} showTrafficLightInfo: $info")
|
||||
Logger.d(TAG, "isTrafficLightInfoValid: ${isTrafficLightInfoValid(info)}")
|
||||
if(isTrafficLightInfoValid(info)) {
|
||||
handler.post {
|
||||
dataChangedListener?.showTrafficLightInfo(info)
|
||||
obu = if(DebugConfig.getObuType() == DebugConfig.OBU_TYPE_CIDI){
|
||||
CidiObu()
|
||||
}else{
|
||||
HualiObu()
|
||||
}
|
||||
obu.init()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断红绿灯信息是否有效
|
||||
*
|
||||
* @return true 有效
|
||||
*/
|
||||
private fun isTrafficLightInfoValid(info:TrafficLightInfo?):Boolean{
|
||||
return info == null||(info.lightStatus=="G"||info.lightStatus=="Y"||info.lightStatus=="R")
|
||||
}
|
||||
|
||||
/**
|
||||
* 场景触发事件信息回调接口
|
||||
*/
|
||||
override fun showCarEventInfo(info: CarEventInfo?) {
|
||||
Logger.d(TAG, "thread: ${Thread.currentThread()} showCarEventInfo: ${info?.type}")
|
||||
handler.post {
|
||||
dataChangedListener?.showCarEventInfo(info)
|
||||
fun registerObuDataChangedListener(listener: IObuCallback?) {
|
||||
if (listener != null) {
|
||||
obu.registerObuCallback(listener)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param msg A [Message][android.os.Message] object
|
||||
* @return True if no further handling is desired
|
||||
*/
|
||||
override fun handleMessage(msg: Message?): Boolean {
|
||||
if (msg?.what == MSG_MONITOR_OBU_STATUS) {
|
||||
// obu未正常连接,需要重新连接
|
||||
Logger.d(TAG,"obu未正常连接,需要重新连接")
|
||||
V2xController.getInstance().release()
|
||||
V2xController.getInstance().setMessageReceiveListener(this)
|
||||
V2xController.getInstance().init()
|
||||
handler.sendEmptyMessageDelayed(MSG_MONITOR_OBU_STATUS, DEFAULT_MONITOR_TIME)
|
||||
// V2xController.getInstance().release()
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.zhidao.mogo.module.obu.obu
|
||||
|
||||
open class BaseObu : IObu {
|
||||
protected var callback: IObuCallback? = null
|
||||
override fun init() {
|
||||
}
|
||||
|
||||
override fun registerObuCallback(callback: IObuCallback) {
|
||||
this.callback = callback
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
package com.zhidao.mogo.module.obu.obu
|
||||
|
||||
import android.os.Handler
|
||||
import android.os.Message
|
||||
import com.mogo.commons.debug.DebugConfig
|
||||
import com.mogo.utils.logger.Logger
|
||||
import com.zhidao.mogo.module.obu.obu.bean.MogoObuEventInfo
|
||||
import com.zhidao.mogo.module.obu.obu.bean.MogoObuLocationInfo
|
||||
import com.zhidao.mogo.module.obu.obu.bean.MogoObuTrafficLightInfo
|
||||
import com.zhidao.smartv2x.api.V2xController
|
||||
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
|
||||
|
||||
/**
|
||||
* 西迪obu
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
class CidiObu : BaseObu(), Handler.Callback, OnMessageReceiveListener {
|
||||
companion object {
|
||||
const val TAG = "CidiObu"
|
||||
const val MSG_MONITOR_OBU_STATUS = 1001
|
||||
const val DEFAULT_MONITOR_TIME = 10_000L
|
||||
}
|
||||
|
||||
private val handler = Handler(this)
|
||||
override fun init() {
|
||||
super.init()
|
||||
// 初始化sdk,注册数据回调等信息
|
||||
V2xController.getInstance().setMessageReceiveListener(this)
|
||||
V2xController.getInstance().init()
|
||||
handler.sendEmptyMessageDelayed(MSG_MONITOR_OBU_STATUS, DEFAULT_MONITOR_TIME)
|
||||
}
|
||||
|
||||
/**
|
||||
* 车辆位置信息回调接口
|
||||
*/
|
||||
override fun showCarLocationInfo(info: CarLocationInfo?) {
|
||||
Logger.v(TAG, "thread: ${Thread.currentThread()} showCarLocationInfo: ${info?.carId}")
|
||||
if (!DebugConfig.isUseMockObuData()) {
|
||||
// 不使用模拟数据时候不做此处理
|
||||
// 由于obu会频繁回调此接口,故10秒收不到此数据,则认为obu连接不正常,就断开重连一下
|
||||
handler.removeMessages(MSG_MONITOR_OBU_STATUS)
|
||||
handler.sendEmptyMessageDelayed(MSG_MONITOR_OBU_STATUS, DEFAULT_MONITOR_TIME)
|
||||
}
|
||||
|
||||
handler.post {
|
||||
if (info == null) {
|
||||
callback?.onLocationInfoCallback(null)
|
||||
}else {
|
||||
callback?.onLocationInfoCallback(MogoObuLocationInfo(info))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* UDP 收发消息回调接口
|
||||
*/
|
||||
override fun showOtherInfo(info: String?) {
|
||||
Logger.d(TAG, "thread: ${Thread.currentThread()} showOtherInfo: $info")
|
||||
}
|
||||
|
||||
/**
|
||||
* 交通信号灯信息回调接口
|
||||
* 17号路口红绿灯倒计时出现了,如果[TrafficLightInfo.lightStatus]为0,或者说,不为G/Y/R时,此条红绿灯数据无效
|
||||
*/
|
||||
override fun showTrafficLightInfo(info: TrafficLightInfo?) {
|
||||
Logger.d(TAG, "thread: ${Thread.currentThread()} showTrafficLightInfo: $info")
|
||||
Logger.d(TAG, "isTrafficLightInfoValid: ${isTrafficLightInfoValid(info)}")
|
||||
if (isTrafficLightInfoValid(info)) {
|
||||
handler.post {
|
||||
if (info == null) {
|
||||
callback?.onTrafficLightInfoCallback(null)
|
||||
}else{
|
||||
callback?.onTrafficLightInfoCallback(MogoObuTrafficLightInfo(info))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断红绿灯信息是否有效
|
||||
*
|
||||
* @return true 有效
|
||||
*/
|
||||
private fun isTrafficLightInfoValid(info: TrafficLightInfo?): Boolean {
|
||||
return info == null || (info.lightStatus == "G" || info.lightStatus == "Y" || info.lightStatus == "R")
|
||||
}
|
||||
|
||||
/**
|
||||
* 场景触发事件信息回调接口
|
||||
*/
|
||||
override fun showCarEventInfo(info: CarEventInfo?) {
|
||||
Logger.d(TAG, "thread: ${Thread.currentThread()} showCarEventInfo: ${info?.type}")
|
||||
handler.post {
|
||||
if (info == null) {
|
||||
callback?.onEventInfoCallback(null)
|
||||
}else{
|
||||
callback?.onEventInfoCallback(MogoObuEventInfo(info))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param msg A [Message][android.os.Message] object
|
||||
* @return True if no further handling is desired
|
||||
*/
|
||||
override fun handleMessage(msg: Message?): Boolean {
|
||||
if (msg?.what == MSG_MONITOR_OBU_STATUS) {
|
||||
// obu未正常连接,需要重新连接
|
||||
Logger.d(TAG, "obu未正常连接,需要重新连接")
|
||||
V2xController.getInstance().release()
|
||||
V2xController.getInstance().setMessageReceiveListener(this)
|
||||
V2xController.getInstance().init()
|
||||
handler.sendEmptyMessageDelayed(MSG_MONITOR_OBU_STATUS, DEFAULT_MONITOR_TIME)
|
||||
// V2xController.getInstance().release()
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.zhidao.mogo.module.obu.obu
|
||||
|
||||
import com.mogo.utils.logger.Logger
|
||||
import com.zhidao.mogo.module.obu.socket.IUdpSocketCallback
|
||||
import com.zhidao.mogo.module.obu.socket.UdpSocketManager
|
||||
import kotlin.concurrent.thread
|
||||
|
||||
/**
|
||||
* 华砺智行obu 苏州演示项目用到的
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
class HualiObu : BaseObu(),IUdpSocketCallback {
|
||||
private val socketManager = UdpSocketManager(this)
|
||||
companion object{
|
||||
const val TAG = "HualiObu"
|
||||
const val IP_ADDRESS = "172.30.33.38"
|
||||
const val PORT = 10005
|
||||
}
|
||||
override fun init() {
|
||||
super.init()
|
||||
socketManager.receiveMsgFrom(IP_ADDRESS, PORT)
|
||||
socketManager.sendMsgTo("Hello ssokit", IP_ADDRESS, PORT)
|
||||
Logger.d(TAG, "init")
|
||||
thread {
|
||||
var count = 0
|
||||
while (true) {
|
||||
Logger.d(TAG,"准备发送测试数据===")
|
||||
socketManager.sendMsgTo("Hello ssokit===$count", IP_ADDRESS, PORT)
|
||||
count++
|
||||
Thread.sleep(1000)
|
||||
if (count == 1000) {
|
||||
Logger.d(TAG, "测试数据结束")
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onMessageReceived(msg: ByteArray) {
|
||||
// todo 处理数据
|
||||
val m = String(msg)
|
||||
Logger.d(TAG, "onMessageReceived: $msg")
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.zhidao.mogo.module.obu.obu
|
||||
|
||||
/**
|
||||
* Obu基本方法
|
||||
* @author tongchenfei
|
||||
*/
|
||||
interface IObu {
|
||||
/**
|
||||
* 初始化
|
||||
*/
|
||||
fun init()
|
||||
|
||||
/**
|
||||
* 注册数据回调
|
||||
*/
|
||||
fun registerObuCallback(callback: IObuCallback)
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.zhidao.mogo.module.obu.obu
|
||||
|
||||
import com.zhidao.mogo.module.obu.obu.bean.MogoObuEventInfo
|
||||
import com.zhidao.mogo.module.obu.obu.bean.MogoObuLocationInfo
|
||||
import com.zhidao.mogo.module.obu.obu.bean.MogoObuTrafficLightInfo
|
||||
|
||||
/**
|
||||
* obu数据回调,目前是根据西迪的数据进行的封装
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
interface IObuCallback {
|
||||
/**
|
||||
* obu事件回调
|
||||
* @param eventInfo 事件信息
|
||||
*/
|
||||
fun onEventInfoCallback(eventInfo:MogoObuEventInfo?)
|
||||
|
||||
/**
|
||||
* obu定位信息回调
|
||||
* @param locationInfo 定位信息
|
||||
*/
|
||||
fun onLocationInfoCallback(locationInfo: MogoObuLocationInfo?)
|
||||
|
||||
/**
|
||||
* obu红绿灯信息回调
|
||||
* @param trafficLightInfo 红绿灯信息
|
||||
*/
|
||||
fun onTrafficLightInfoCallback(trafficLightInfo: MogoObuTrafficLightInfo?)
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.zhidao.mogo.module.obu.obu.bean
|
||||
|
||||
import com.zhidao.smartv2x.model.obu.CarEventInfo
|
||||
|
||||
/**
|
||||
* obu事件数据封装,根据西迪obu数据进行整理
|
||||
*
|
||||
* {"typeCode":"01","type":"前碰撞预警","describe":"等级:1"}
|
||||
*/
|
||||
class MogoObuEventInfo(){
|
||||
var typeCode:String? = null
|
||||
var type:String? = null
|
||||
var describe:String? = null
|
||||
override fun toString(): String {
|
||||
return "MogoObuEventInfo(typeCode=$typeCode, type=$type, describe=$describe)"
|
||||
}
|
||||
|
||||
constructor(info:CarEventInfo):this(){
|
||||
this.typeCode = info.typeCode
|
||||
this.type = info.type
|
||||
this.describe = info.describe
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.zhidao.mogo.module.obu.obu.bean
|
||||
|
||||
import com.zhidao.smartv2x.model.obu.CarLocationInfo
|
||||
|
||||
/**
|
||||
* obu定位信息,根据西迪obu进行封装
|
||||
* {"carId":"1952999795","lat":28.089524299999997,"lng":112.9908293,"speed":"14"," direction":"10112","sateNum":"24","signal":"0"}
|
||||
* @author tongchenfei
|
||||
*/
|
||||
class MogoObuLocationInfo() {
|
||||
var carId: String? = null
|
||||
var lat: Double? = 0.0
|
||||
var lon: Double? = 0.0
|
||||
var speed: String? = null
|
||||
var direction: String? = null
|
||||
var sateNum: String? = null
|
||||
var signal: String? = null
|
||||
override fun toString(): String {
|
||||
return "MogoObuLocationInfo(lat=$lat)"
|
||||
}
|
||||
|
||||
constructor(info:CarLocationInfo?) : this() {
|
||||
this.carId = info?.carId
|
||||
this.lat = info?.lat
|
||||
this.lon = info?.lng
|
||||
this.speed = info?.speed
|
||||
this.direction = info?.direction
|
||||
this.sateNum = info?.sateNum
|
||||
this.signal = info?.signal
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.zhidao.mogo.module.obu.obu.bean
|
||||
|
||||
import com.zhidao.smartv2x.model.obu.TrafficLightInfo
|
||||
|
||||
/**
|
||||
* obu信号灯数据,根据西迪obu进行封装
|
||||
* lightStatus:信号灯的当前状态 G/R/Y 分别对应 绿/红/黄
|
||||
* surplusTime:当前信号灯剩余时间 十进制 单位:秒
|
||||
* lightPriority:保留字段,暂无说明
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
class MogoObuTrafficLightInfo(){
|
||||
var id:String? =null
|
||||
var lightStatus:String? =null
|
||||
var surplusTime:String? =null
|
||||
var lightPriority:String? =null
|
||||
override fun toString(): String {
|
||||
return "MogoObuTrafficLightInfo(id=$id, lightStatus=$lightStatus, surplusTime=$surplusTime, lightPriority=$lightPriority)"
|
||||
}
|
||||
|
||||
constructor(info:TrafficLightInfo):this(){
|
||||
this.id = info.id
|
||||
this.lightStatus = info.lightStatus
|
||||
this.surplusTime = info.surplusTime
|
||||
this.lightPriority = info.lightPriority
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.zhidao.mogo.module.obu.socket
|
||||
|
||||
/**
|
||||
* udp 数据回调
|
||||
*/
|
||||
interface IUdpSocketCallback {
|
||||
/**
|
||||
* udp过来的字节码数据,目前已知数据类型就是ByteArray
|
||||
*
|
||||
* @param msg udp发过来的数据
|
||||
*/
|
||||
fun onMessageReceived(msg: ByteArray)
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.zhidao.mogo.module.obu.socket
|
||||
|
||||
class SimpleAddress(val ip: String, val port: Int) {
|
||||
override fun equals(other: Any?): Boolean {
|
||||
return when (other) {
|
||||
is SimpleAddress -> other.ip == ip && port == port
|
||||
null -> false
|
||||
else -> false
|
||||
}
|
||||
}
|
||||
|
||||
override fun hashCode(): Int {
|
||||
return ip.hashCode() + port.hashCode()
|
||||
}
|
||||
|
||||
override fun toString(): String {
|
||||
return "SimpleAddress(ip='$ip', port=$port)"
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
package com.zhidao.mogo.module.obu.socket
|
||||
|
||||
import android.util.ArrayMap
|
||||
import com.mogo.utils.logger.Logger
|
||||
import java.net.DatagramPacket
|
||||
import java.net.DatagramSocket
|
||||
import java.net.InetAddress
|
||||
import java.util.concurrent.Executors
|
||||
|
||||
/**
|
||||
* udp socket 管理类,统一管理udp socket数据接收和发送
|
||||
*/
|
||||
class UdpSocketManager(private val callback: IUdpSocketCallback? = null) {
|
||||
companion object{
|
||||
const val TAG = "Mogo-UdpSocketManager"
|
||||
}
|
||||
private val socketMap = ArrayMap<SimpleAddress, DatagramSocket>()
|
||||
private val socketExecutor = Executors.newCachedThreadPool()
|
||||
|
||||
@Volatile private var isConnected = false
|
||||
|
||||
fun sendMsgTo(msg:String,ip: String, port: Int) {
|
||||
isConnected = true
|
||||
val address = SimpleAddress(ip, port)
|
||||
socketExecutor.execute(UdpSenderRunnable(address, msg))
|
||||
}
|
||||
|
||||
fun receiveMsgFrom(ip: String, port: Int) {
|
||||
isConnected = true
|
||||
val address = SimpleAddress(ip, port)
|
||||
socketExecutor.execute(UdpReceiverRunnable(address))
|
||||
}
|
||||
|
||||
fun release(){
|
||||
isConnected = false
|
||||
socketMap.forEach {
|
||||
it.value.close()
|
||||
}
|
||||
}
|
||||
|
||||
inner class UdpSenderRunnable(private val address: SimpleAddress,private val msg:String):Runnable{
|
||||
override fun run() {
|
||||
Logger.d(TAG, "${address}准备发送消息: $msg")
|
||||
var socket = socketMap[address]
|
||||
val netAddress = InetAddress.getByName(address.ip)
|
||||
if (socket == null) {
|
||||
socket = DatagramSocket(address.port)
|
||||
socketMap[address] = socket
|
||||
}
|
||||
socket.send(DatagramPacket(msg.toByteArray(), msg.toByteArray().size, netAddress, address.port))
|
||||
}
|
||||
}
|
||||
inner class UdpReceiverRunnable(private val address:SimpleAddress):Runnable{
|
||||
override fun run() {
|
||||
var socket = socketMap[address]
|
||||
Logger.d(TAG, "init receiver: $address")
|
||||
|
||||
if (socket == null) {
|
||||
socket = DatagramSocket(address.port)
|
||||
socketMap[address] = socket
|
||||
}
|
||||
val buffer = ByteArray(1024)
|
||||
val packet = DatagramPacket(buffer, buffer.size)
|
||||
while (isConnected){
|
||||
if(socket.isClosed){
|
||||
break
|
||||
}
|
||||
Logger.d(TAG,"准备接受消息====$address")
|
||||
socket.receive(packet)
|
||||
val msg = ByteArray(buffer.size)
|
||||
System.arraycopy(buffer, 0, msg, 0, buffer.size)
|
||||
callback?.onMessageReceived(msg)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -90,8 +90,7 @@ dependencies {
|
||||
testImplementation 'junit:junit:4.13'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
|
||||
|
||||
compileOnly project(':modules:mogo-module-obu')
|
||||
implementation project(':modules:mogo-module-obu')
|
||||
}
|
||||
|
||||
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()
|
||||
|
||||
@@ -136,7 +136,7 @@ public class V2XModuleProvider implements
|
||||
localBroadcastManager.registerReceiver(localReceiver, intentFilter);
|
||||
|
||||
// obu数据转发初始化
|
||||
V2XObuManager.getInstance().init();
|
||||
V2XObuManager.getInstance().init(context);
|
||||
}
|
||||
|
||||
private void initBiz(Context context) {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.mogo.module.v2x;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
@@ -17,13 +18,15 @@ import com.mogo.module.v2x.scenario.scene.obu.V2XObuEventScenario;
|
||||
import com.mogo.module.v2x.utils.ADASUtils;
|
||||
import com.mogo.module.v2x.utils.DrivingDirectionUtils;
|
||||
import com.mogo.module.v2x.utils.ObuConfig;
|
||||
import com.mogo.service.obu.IMogoObuDataChangedListener;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.zhidao.mogo.module.obu.ObuConstant;
|
||||
import com.zhidao.smartv2x.model.obu.CarEventInfo;
|
||||
import com.zhidao.smartv2x.model.obu.CarLocationInfo;
|
||||
import com.zhidao.smartv2x.model.obu.TrafficLightInfo;
|
||||
import com.zhidao.mogo.module.obu.ObuManager;
|
||||
import com.zhidao.mogo.module.obu.obu.IObuCallback;
|
||||
import com.zhidao.mogo.module.obu.obu.bean.MogoObuEventInfo;
|
||||
import com.zhidao.mogo.module.obu.obu.bean.MogoObuLocationInfo;
|
||||
import com.zhidao.mogo.module.obu.obu.bean.MogoObuTrafficLightInfo;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.util.Map;
|
||||
@@ -36,7 +39,7 @@ import static com.mogo.module.v2x.scenario.scene.obu.V2XObuEventScenario.ACTION_
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public class V2XObuManager implements IMogoObuDataChangedListener, Handler.Callback {
|
||||
public class V2XObuManager implements IObuCallback, Handler.Callback {
|
||||
private static final String TAG = V2XObuManager.class.getSimpleName();
|
||||
|
||||
private static final long DEFAULT_INTERVAL_TIME = 30_000L;
|
||||
@@ -61,9 +64,11 @@ public class V2XObuManager implements IMogoObuDataChangedListener, Handler.Callb
|
||||
private static final long DEFAULT_HIDE_TRAFFIC_LIGHT_DELAY = 1500L;
|
||||
private Handler handler = new Handler(this);
|
||||
|
||||
public void init() {
|
||||
public void init(Context context) {
|
||||
Logger.d(MODULE_NAME, "obuManager初始化--");
|
||||
V2XServiceManager.getMogoRegisterCenter().registerObuDataListener(MODULE_NAME, this);
|
||||
ObuManager obuManager = new ObuManager();
|
||||
obuManager.init(context);
|
||||
obuManager.registerObuDataChangedListener(this);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -71,133 +76,6 @@ public class V2XObuManager implements IMogoObuDataChangedListener, Handler.Callb
|
||||
*/
|
||||
private Map<String, Long> intervalMap = new ArrayMap<>();
|
||||
|
||||
/**
|
||||
* 车辆位置信息回调接口
|
||||
*
|
||||
* @param info 位置信息
|
||||
*/
|
||||
@Override
|
||||
public void showCarLocationInfo(CarLocationInfo info) {
|
||||
if (ObuConfig.useObuLocation) {
|
||||
MogoLocation currentLocation = new MogoLocation();
|
||||
|
||||
CoordinateConverter converter = new CoordinateConverter(V2XServiceManager.getContext());
|
||||
converter.from(CoordinateConverter.CoordType.GPS);
|
||||
LatLng latLng = new LatLng(info.lat, info.lng);
|
||||
converter.coord(latLng);
|
||||
LatLng convert = converter.convert();
|
||||
|
||||
currentLocation.setLatitude(convert.latitude);
|
||||
currentLocation.setLongitude(convert.longitude);
|
||||
currentLocation.setBearing(computeCarAngle(currentLocation));
|
||||
|
||||
V2XObuEventScenario.getInstance().updateLocation(currentLocation);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* UDP 收发消息回调接口
|
||||
*
|
||||
* @param info 消息回调
|
||||
*/
|
||||
@Override
|
||||
public void showOtherInfo(String info) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 交通信号灯信息回调接口
|
||||
*
|
||||
* @param info 信号灯信息
|
||||
*/
|
||||
@Override
|
||||
public void showTrafficLightInfo(TrafficLightInfo info) {
|
||||
handler.removeMessages(MSG_HIDE_TRAFFIC_LIGHT);
|
||||
if (info == null) {
|
||||
Logger.d("V2X_OBU_EVENT", "红绿灯数据为空===");
|
||||
sendTrafficLightStatusToAdas(CALL_ADAS_HIDE_TRAFFIC_LIGHT, null);
|
||||
} else {
|
||||
Logger.d("V2X_OBU_EVENT", "红绿灯数据==" + info);
|
||||
handler.sendEmptyMessageDelayed(MSG_HIDE_TRAFFIC_LIGHT, DEFAULT_HIDE_TRAFFIC_LIGHT_DELAY);
|
||||
sendTrafficLightStatusToAdas(CALL_ADAS_SHOW_TRAFFIC_LIGHT, info);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 场景触发事件信息回调接口
|
||||
*
|
||||
* @param info 场景触发事件信息
|
||||
*/
|
||||
@Override
|
||||
public void showCarEventInfo(CarEventInfo info) {
|
||||
Logger.d("V2X_OBU_EVENT", "carEventInfo==" + info);
|
||||
Long last = intervalMap.get(info.typeCode);
|
||||
if (last == null) {
|
||||
last = 0L;
|
||||
}
|
||||
int eventType = parseObuEvent(info.typeCode);
|
||||
if (eventType == ObuConstant.TYPE_OPTIMAL_SPEED_ADVISORY) {
|
||||
// 加一个容错机制,如果已经驶过绿波车速路口,那么再收到绿波车速obu事件,就不再上报
|
||||
MogoLocation currentLocation = V2XLocationListener.getInstance().getLastCarLocation();
|
||||
double eventAngle = DrivingDirectionUtils.getDegreeOfCar2Poi(
|
||||
currentLocation.getLongitude(),
|
||||
currentLocation.getLatitude(),
|
||||
V2XObuEventScenario.getInstance().getOptimalCrossing().getLon(),
|
||||
V2XObuEventScenario.getInstance().getOptimalCrossing().getLat(),
|
||||
(int) currentLocation.getBearing()
|
||||
);
|
||||
if (0 > eventAngle || eventAngle > 20) {
|
||||
Logger.e(MODULE_NAME, "超出绿波引导点范围,不处理此次事件===" + eventAngle);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (SystemClock.elapsedRealtime() - last > DEFAULT_INTERVAL_TIME) {
|
||||
// 距离上次记录超过三十秒,继续相关逻辑,如果不超过三十秒,忽略此次事件
|
||||
intervalMap.put(info.typeCode, SystemClock.elapsedRealtime());
|
||||
V2XMessageEntity<V2XObuEventEntity> messageEntity = new V2XMessageEntity<>();
|
||||
messageEntity.setType(V2XMessageEntity.V2XTypeEnum.ALERT_OBU_EVENT);
|
||||
switch (eventType) {
|
||||
case ObuConstant
|
||||
.TYPE_OPTIMAL_SPEED_ADVISORY:
|
||||
// 绿波车速引导
|
||||
V2XObuEventEntity optimalEvent = new V2XObuEventEntity();
|
||||
optimalEvent.setType(ObuConstant.TYPE_OPTIMAL_SPEED_ADVISORY);
|
||||
optimalEvent.setDesc(info.describe);
|
||||
messageEntity.setContent(optimalEvent);
|
||||
V2XObuEventScenario.getInstance().init(messageEntity);
|
||||
break;
|
||||
case ObuConstant.TYPE_URGENCY_COLLISION_WARNING:
|
||||
// 前车紧急制动预警
|
||||
V2XObuEventEntity urgencyEvent = new V2XObuEventEntity();
|
||||
urgencyEvent.setType(ObuConstant.TYPE_URGENCY_COLLISION_WARNING);
|
||||
urgencyEvent.setDesc(V2XObuEventScenario.URGENCY_COLLISION_WARN_TEXT);
|
||||
messageEntity.setContent(urgencyEvent);
|
||||
V2XObuEventScenario.getInstance().init(messageEntity);
|
||||
break;
|
||||
case ObuConstant.TYPE_ROAD_USER_COLLISION_WARNING:
|
||||
// 行人预警,给adas发送广播即可
|
||||
V2XPushMessageEntity entity = new V2XPushMessageEntity();
|
||||
// 盲区行人预警的sceneId-100003
|
||||
entity.setSceneId("100003");
|
||||
entity.setTts("前方行人,注意减速");
|
||||
entity.setExpireTime(30_000);
|
||||
entity.setAlarmContent("前方行人,注意减速");
|
||||
ADASUtils.broadcastToADAS(V2XServiceManager.getContext(), entity);
|
||||
break;
|
||||
case ObuConstant.TYPE_CHANGE_LIGHT_FOR_VIP:
|
||||
// vip变灯提醒
|
||||
V2XObuEventEntity changeLightEvent = new V2XObuEventEntity();
|
||||
changeLightEvent.setType(ObuConstant.TYPE_CHANGE_LIGHT_FOR_VIP);
|
||||
changeLightEvent.setDesc(info.describe);
|
||||
messageEntity.setContent(changeLightEvent);
|
||||
V2XObuEventScenario.getInstance().init(messageEntity);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private int parseObuEvent(String type) {
|
||||
switch (type) {
|
||||
case "06":
|
||||
@@ -240,7 +118,7 @@ public class V2XObuManager implements IMogoObuDataChangedListener, Handler.Callb
|
||||
private static final String CALL_ADAS_SHOW_TRAFFIC_LIGHT = "2";
|
||||
private static final String CALL_ADAS_HIDE_TRAFFIC_LIGHT = "1";
|
||||
|
||||
private void sendTrafficLightStatusToAdas(String status, TrafficLightInfo trafficLightInfo) {
|
||||
private void sendTrafficLightStatusToAdas(String status, MogoObuTrafficLightInfo trafficLightInfo) {
|
||||
if (V2XObuEventScenario.getInstance().isInChangeLightForVip()) {
|
||||
status = CALL_ADAS_HIDE_TRAFFIC_LIGHT;
|
||||
}
|
||||
@@ -250,15 +128,15 @@ public class V2XObuManager implements IMogoObuDataChangedListener, Handler.Callb
|
||||
// String action "1" - 隐藏 "2" - 显示
|
||||
json.put("action", status);
|
||||
if (trafficLightInfo != null) {
|
||||
if (trafficLightInfo.lightStatus == null) {
|
||||
if (trafficLightInfo.getLightStatus() == null) {
|
||||
json.put("lightStatus", "G");
|
||||
} else {
|
||||
json.put("lightStatus", trafficLightInfo.lightStatus);
|
||||
json.put("lightStatus", trafficLightInfo.getLightStatus());
|
||||
}
|
||||
if (trafficLightInfo.surplusTime == null) {
|
||||
if (trafficLightInfo.getSurplusTime() == null) {
|
||||
json.put("surplusTime", "0");
|
||||
} else {
|
||||
json.put("surplusTime", trafficLightInfo.surplusTime);
|
||||
json.put("surplusTime", trafficLightInfo.getSurplusTime());
|
||||
}
|
||||
}
|
||||
String data = json.toString();
|
||||
@@ -280,4 +158,107 @@ public class V2XObuManager implements IMogoObuDataChangedListener, Handler.Callb
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEventInfoCallback(MogoObuEventInfo info) {
|
||||
Logger.d("V2X_OBU_EVENT", "carEventInfo==" + info);
|
||||
Long last = intervalMap.get(info.getTypeCode());
|
||||
if (last == null) {
|
||||
last = 0L;
|
||||
}
|
||||
int eventType = parseObuEvent(info.getTypeCode());
|
||||
if (eventType == ObuConstant.TYPE_OPTIMAL_SPEED_ADVISORY) {
|
||||
// 加一个容错机制,如果已经驶过绿波车速路口,那么再收到绿波车速obu事件,就不再上报
|
||||
MogoLocation currentLocation = V2XLocationListener.getInstance().getLastCarLocation();
|
||||
double eventAngle = DrivingDirectionUtils.getDegreeOfCar2Poi(
|
||||
currentLocation.getLongitude(),
|
||||
currentLocation.getLatitude(),
|
||||
V2XObuEventScenario.getInstance().getOptimalCrossing().getLon(),
|
||||
V2XObuEventScenario.getInstance().getOptimalCrossing().getLat(),
|
||||
(int) currentLocation.getBearing()
|
||||
);
|
||||
if (0 > eventAngle || eventAngle > 20) {
|
||||
Logger.e(MODULE_NAME, "超出绿波引导点范围,不处理此次事件===" + eventAngle);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (SystemClock.elapsedRealtime() - last > DEFAULT_INTERVAL_TIME) {
|
||||
// 距离上次记录超过三十秒,继续相关逻辑,如果不超过三十秒,忽略此次事件
|
||||
intervalMap.put(info.getTypeCode(), SystemClock.elapsedRealtime());
|
||||
V2XMessageEntity<V2XObuEventEntity> messageEntity = new V2XMessageEntity<>();
|
||||
messageEntity.setType(V2XMessageEntity.V2XTypeEnum.ALERT_OBU_EVENT);
|
||||
switch (eventType) {
|
||||
case ObuConstant
|
||||
.TYPE_OPTIMAL_SPEED_ADVISORY:
|
||||
// 绿波车速引导
|
||||
V2XObuEventEntity optimalEvent = new V2XObuEventEntity();
|
||||
optimalEvent.setType(ObuConstant.TYPE_OPTIMAL_SPEED_ADVISORY);
|
||||
optimalEvent.setDesc(info.getDescribe());
|
||||
messageEntity.setContent(optimalEvent);
|
||||
V2XObuEventScenario.getInstance().init(messageEntity);
|
||||
break;
|
||||
case ObuConstant.TYPE_URGENCY_COLLISION_WARNING:
|
||||
// 前车紧急制动预警
|
||||
V2XObuEventEntity urgencyEvent = new V2XObuEventEntity();
|
||||
urgencyEvent.setType(ObuConstant.TYPE_URGENCY_COLLISION_WARNING);
|
||||
urgencyEvent.setDesc(V2XObuEventScenario.URGENCY_COLLISION_WARN_TEXT);
|
||||
messageEntity.setContent(urgencyEvent);
|
||||
V2XObuEventScenario.getInstance().init(messageEntity);
|
||||
break;
|
||||
case ObuConstant.TYPE_ROAD_USER_COLLISION_WARNING:
|
||||
// 行人预警,给adas发送广播即可
|
||||
V2XPushMessageEntity entity = new V2XPushMessageEntity();
|
||||
// 盲区行人预警的sceneId-100003
|
||||
entity.setSceneId("100003");
|
||||
entity.setTts("前方行人,注意减速");
|
||||
entity.setExpireTime(30_000);
|
||||
entity.setAlarmContent("前方行人,注意减速");
|
||||
ADASUtils.broadcastToADAS(V2XServiceManager.getContext(), entity);
|
||||
break;
|
||||
case ObuConstant.TYPE_CHANGE_LIGHT_FOR_VIP:
|
||||
// vip变灯提醒
|
||||
V2XObuEventEntity changeLightEvent = new V2XObuEventEntity();
|
||||
changeLightEvent.setType(ObuConstant.TYPE_CHANGE_LIGHT_FOR_VIP);
|
||||
changeLightEvent.setDesc(info.getDescribe());
|
||||
messageEntity.setContent(changeLightEvent);
|
||||
V2XObuEventScenario.getInstance().init(messageEntity);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLocationInfoCallback( MogoObuLocationInfo locationInfo) {
|
||||
if (ObuConfig.useObuLocation) {
|
||||
MogoLocation currentLocation = new MogoLocation();
|
||||
|
||||
CoordinateConverter converter = new CoordinateConverter(V2XServiceManager.getContext());
|
||||
converter.from(CoordinateConverter.CoordType.GPS);
|
||||
LatLng latLng = new LatLng(locationInfo.getLat(), locationInfo.getLon());
|
||||
converter.coord(latLng);
|
||||
LatLng convert = converter.convert();
|
||||
|
||||
currentLocation.setLatitude(convert.latitude);
|
||||
currentLocation.setLongitude(convert.longitude);
|
||||
currentLocation.setBearing(computeCarAngle(currentLocation));
|
||||
|
||||
V2XObuEventScenario.getInstance().updateLocation(currentLocation);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTrafficLightInfoCallback(MogoObuTrafficLightInfo trafficLightInfo) {
|
||||
handler.removeMessages(MSG_HIDE_TRAFFIC_LIGHT);
|
||||
if (trafficLightInfo == null) {
|
||||
Logger.d("V2X_OBU_EVENT", "红绿灯数据为空===");
|
||||
sendTrafficLightStatusToAdas(CALL_ADAS_HIDE_TRAFFIC_LIGHT, null);
|
||||
} else {
|
||||
Logger.d("V2X_OBU_EVENT", "红绿灯数据==" + trafficLightInfo);
|
||||
handler.sendEmptyMessageDelayed(MSG_HIDE_TRAFFIC_LIGHT,
|
||||
DEFAULT_HIDE_TRAFFIC_LIGHT_DELAY);
|
||||
sendTrafficLightStatusToAdas(CALL_ADAS_SHOW_TRAFFIC_LIGHT, trafficLightInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,8 +6,6 @@ import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.os.Message;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.location.MogoLocation;
|
||||
@@ -23,13 +21,15 @@ import com.mogo.module.v2x.scenario.impl.AbsV2XScenario;
|
||||
import com.mogo.module.v2x.utils.DrivingDirectionUtils;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.zhidao.mogo.module.obu.ObuConstant;
|
||||
import com.zhidao.smartv2x.model.obu.CarEventInfo;
|
||||
import com.zhidao.mogo.module.obu.obu.bean.MogoObuEventInfo;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
|
||||
|
||||
/**
|
||||
@@ -99,7 +99,7 @@ public class V2XObuEventScenario extends AbsV2XScenario<V2XObuEventEntity> imple
|
||||
} else if (v2XMessageEntity.getContent().getType() == ObuConstant.TYPE_CHANGE_LIGHT_FOR_VIP) {
|
||||
// vip变灯提醒
|
||||
isInChangeLightForVip = true;
|
||||
V2XObuManager.getInstance().showTrafficLightInfo(null);
|
||||
V2XObuManager.getInstance().onTrafficLightInfoCallback(null);
|
||||
|
||||
if (optimalSpeedMarker == null) {
|
||||
optimalSpeedMarker = new OptimalSpeedMarker();
|
||||
@@ -267,11 +267,11 @@ public class V2XObuEventScenario extends AbsV2XScenario<V2XObuEventEntity> imple
|
||||
//距离小于DEFAULT_VIP_CROSSING_DISTANCE,且夹角在0~20(说明在前方),则触发vip通行
|
||||
defaultTarget = crossing;
|
||||
handler.post(() -> {
|
||||
CarEventInfo eventInfo = new CarEventInfo();
|
||||
eventInfo.type = "vip变灯提醒";
|
||||
eventInfo.typeCode = "vip变灯提醒";
|
||||
eventInfo.describe = "将为您变灯,vip车辆可优先通行";
|
||||
V2XObuManager.getInstance().showCarEventInfo(eventInfo);
|
||||
MogoObuEventInfo eventInfo = new MogoObuEventInfo();
|
||||
eventInfo.setType("vip变灯提醒");
|
||||
eventInfo.setTypeCode("vip变灯提醒");
|
||||
eventInfo.setDescribe("将为您变灯,vip车辆可优先通行");
|
||||
V2XObuManager.getInstance().onEventInfoCallback(eventInfo);
|
||||
});
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -41,7 +41,6 @@ dependencies {
|
||||
implementation rootProject.ext.dependencies.arouter
|
||||
annotationProcessor rootProject.ext.dependencies.aroutercompiler
|
||||
api rootProject.ext.dependencies.fresco
|
||||
api rootProject.ext.dependencies.obusdk
|
||||
api 'com.mogo.module:module-crash-warning:1.1.0'
|
||||
if (Boolean.valueOf(RELEASE)) {
|
||||
api rootProject.ext.dependencies.mogomapapi
|
||||
|
||||
@@ -26,7 +26,6 @@ import com.mogo.service.module.IMogoSettingManager;
|
||||
import com.mogo.service.monitor.IMogoMonitorProvider;
|
||||
import com.mogo.service.network.IMogoNetwork;
|
||||
import com.mogo.service.obu.IMogoCrashWarnProvider;
|
||||
import com.mogo.service.obu.IMogoObuManager;
|
||||
import com.mogo.service.passport.IMogoPassportManager;
|
||||
import com.mogo.service.share.IMogoShareManager;
|
||||
import com.mogo.service.statusmanager.IMogoMsgCenter;
|
||||
@@ -215,13 +214,6 @@ public interface IMogoServiceApis extends IProvider {
|
||||
*/
|
||||
IMogoShareManager getShareManager();
|
||||
|
||||
/**
|
||||
* 获取obuManager
|
||||
*
|
||||
* @return obuManager
|
||||
*/
|
||||
IMogoObuManager getObuManager();
|
||||
|
||||
/**
|
||||
* 获取事件面板manager
|
||||
*
|
||||
|
||||
@@ -8,7 +8,6 @@ import com.mogo.map.navi.IMogoAimlessModeListener;
|
||||
import com.mogo.map.navi.IMogoCarLocationChangedListener;
|
||||
import com.mogo.map.navi.IMogoNaviListener;
|
||||
import com.mogo.service.adas.IMogoADASControlStatusChangedListener;
|
||||
import com.mogo.service.obu.IMogoObuDataChangedListener;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
@@ -138,19 +137,6 @@ public interface IMogoRegisterCenter extends IProvider {
|
||||
*/
|
||||
void unregisterCarLocationChangedListener( String tag, IMogoCarLocationChangedListener listener );
|
||||
|
||||
/**
|
||||
* 注册obu数据变化监听
|
||||
* @param tag 模块tag,目前没有实际作用,只用于解注册时的tag选择
|
||||
* @param listener 回调监听
|
||||
*/
|
||||
void registerObuDataListener(String tag, IMogoObuDataChangedListener listener);
|
||||
|
||||
/**
|
||||
* 注销obu数据变化监听
|
||||
* @param tag 传入与注册时相同的tag
|
||||
*/
|
||||
void unregisterObuDataListener(String tag);
|
||||
|
||||
/**
|
||||
* adas 控制状态变更监听
|
||||
* @param tag
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
package com.mogo.service.obu;
|
||||
|
||||
import com.zhidao.smartv2x.model.obu.CarEventInfo;
|
||||
import com.zhidao.smartv2x.model.obu.CarLocationInfo;
|
||||
import com.zhidao.smartv2x.model.obu.TrafficLightInfo;
|
||||
|
||||
/**
|
||||
* obu数据改变的回调
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public interface IMogoObuDataChangedListener {
|
||||
/**
|
||||
* 车辆位置信息回调接口
|
||||
* @param info 位置信息
|
||||
*/
|
||||
void showCarLocationInfo(CarLocationInfo info);
|
||||
|
||||
/**
|
||||
* UDP 收发消息回调接口
|
||||
*
|
||||
* @param info 消息回调
|
||||
*/
|
||||
void showOtherInfo(String info);
|
||||
|
||||
/**
|
||||
* 交通信号灯信息回调接口
|
||||
*
|
||||
* @param info 信号灯信息
|
||||
*/
|
||||
void showTrafficLightInfo(TrafficLightInfo info);
|
||||
|
||||
/**
|
||||
* 场景触发事件信息回调接口
|
||||
*
|
||||
* @param info 场景触发事件信息
|
||||
*/
|
||||
void showCarEventInfo(CarEventInfo info);
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
package com.mogo.service.obu;
|
||||
|
||||
import com.alibaba.android.arouter.facade.template.IProvider;
|
||||
import com.zhidao.smartv2x.listener.OnMessageReceiveListener;
|
||||
|
||||
/**
|
||||
* obu事件管理器
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public interface IMogoObuManager extends IProvider, OnMessageReceiveListener{
|
||||
void registerObuDataChangedListener(IMogoObuDataChangedListener listener);
|
||||
}
|
||||
@@ -34,7 +34,6 @@ import com.mogo.service.module.IMogoSettingManager;
|
||||
import com.mogo.service.monitor.IMogoMonitorProvider;
|
||||
import com.mogo.service.network.IMogoNetwork;
|
||||
import com.mogo.service.obu.IMogoCrashWarnProvider;
|
||||
import com.mogo.service.obu.IMogoObuManager;
|
||||
import com.mogo.service.passport.IMogoPassportManager;
|
||||
import com.mogo.service.share.IMogoShareManager;
|
||||
import com.mogo.service.statusmanager.IMogoMsgCenter;
|
||||
@@ -45,7 +44,6 @@ import com.mogo.service.tanlu.IMogoTanluUiProvider;
|
||||
import com.mogo.service.windowview.IMogoTopViewManager;
|
||||
import com.mogo.service.windowview.IMogoWindowManager;
|
||||
import com.mogo.skin.support.IMogoSkinSupportInstaller;
|
||||
import com.mogo.skin.support.MogoSkinManager;
|
||||
import com.mogo.skin.support.SkinSupportInstallerConstants;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
@@ -188,11 +186,6 @@ public class MogoServiceApis implements IMogoServiceApis {
|
||||
return getApiInstance( IMogoShareManager.class, MogoServicePaths.PATH_SHARE );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoObuManager getObuManager() {
|
||||
return getApiInstance( IMogoObuManager.class, MogoServicePaths.PATH_OBU );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IEventPanelProvider getEventPanelManager() {
|
||||
return getApiInstance( IEventPanelProvider.class, MogoServicePaths.PATH_EVENT_PANEL );
|
||||
|
||||
Reference in New Issue
Block a user