1. 接入obu sdk
2. 进行数据转发功能开发
This commit is contained in:
1
.idea/gradle.xml
generated
1
.idea/gradle.xml
generated
@@ -36,6 +36,7 @@
|
||||
<option value="$PROJECT_DIR$/modules/mogo-module-main" />
|
||||
<option value="$PROJECT_DIR$/modules/mogo-module-map" />
|
||||
<option value="$PROJECT_DIR$/modules/mogo-module-media" />
|
||||
<option value="$PROJECT_DIR$/modules/mogo-module-obu" />
|
||||
<option value="$PROJECT_DIR$/modules/mogo-module-search" />
|
||||
<option value="$PROJECT_DIR$/modules/mogo-module-service" />
|
||||
<option value="$PROJECT_DIR$/modules/mogo-module-share" />
|
||||
|
||||
@@ -44,6 +44,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();
|
||||
@@ -68,6 +69,7 @@ public class MogoApplication extends AbsMogoApplication {
|
||||
|
||||
MogoModulePaths.addBaseModule( new MogoModule( ServiceConst.PATH_REFRESH_STRATEGY, ServiceConst.PATH_REFRESH_STRATEGY ) );
|
||||
MogoModulePaths.addBaseModule( new MogoModule( V2XConst.PATH_V2X_UI, V2XConst.PATH_V2X_UI ) );
|
||||
MogoModulePaths.addBaseModule( new MogoModule( MogoServicePaths.PATH_OBU,"moduleObu"));
|
||||
// 暂时去掉推送
|
||||
// MogoModulePaths.addModule(new MogoModule(PushUIConstants.TAG, PushUIConstants.TAG));
|
||||
|
||||
|
||||
@@ -123,6 +123,8 @@ ext {
|
||||
socketsdk : 'com.zhidao.socketsdk:socketsdk:2.1.1',
|
||||
socketsdkconnsvrprotoco : 'com.zhidao.ptech:connsvr-protoco:0.1.23',
|
||||
socketsdkprotobufjava : 'com.google.protobuf:protobuf-java:3.5.1',
|
||||
// OBU
|
||||
moduleobu : 'com.mogo.module:module-obu:${MOGO_MODULE_OBU}',
|
||||
|
||||
//
|
||||
jetbrainsannotationsjava5: "org.jetbrains:annotations-java5:15.0",
|
||||
@@ -154,5 +156,8 @@ ext {
|
||||
// 个人中心的SDK
|
||||
personalsdk : "com.zhidaoauto.person.info:data:1.0.1",
|
||||
tanluupload : "com.mogo.module:module-tanlu-upload:${TANLULIB_VERSION}",
|
||||
|
||||
// obu sdk
|
||||
obusdk : "com.zhidao.enterprise.smartv2x:smartv2x:1.0.0.1"
|
||||
]
|
||||
}
|
||||
@@ -151,4 +151,14 @@ public class DebugConfig {
|
||||
public static void setRequestOnlineCarData( boolean sRequestOnlineCarData ) {
|
||||
DebugConfig.sRequestOnlineCarData = sRequestOnlineCarData;
|
||||
}
|
||||
|
||||
private static boolean useMockObuData;
|
||||
|
||||
public static void setUseMockObuData(boolean use) {
|
||||
useMockObuData = use;
|
||||
}
|
||||
|
||||
public static boolean isUseMockObuData(){
|
||||
return useMockObuData;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,6 +56,8 @@ MOGO_MODULE_MEDIA_VERSION=1.2.1.8
|
||||
MOGO_MODULE_MAIN_LAUNCHER_VERSION = 1.2.1.8
|
||||
MOGO_MODULE_MAIN_INDEPENDENT_VERSION = 1.2.1.8
|
||||
|
||||
MOGO_MODULE_OBU = 1.2.1.8-SNAPSHOT
|
||||
|
||||
|
||||
## 工程外部模块
|
||||
# 探路
|
||||
|
||||
@@ -20,7 +20,11 @@ import com.mogo.map.navi.MogoNaviInfo;
|
||||
import com.mogo.map.navi.MogoTraffic;
|
||||
import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.module.main.registercenter.MogoRegisterCenterHandler;
|
||||
import com.mogo.service.obu.IMogoObuDataChangedListener;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
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;
|
||||
|
||||
@@ -37,7 +41,8 @@ public class EventDispatchCenter implements
|
||||
IMogoCarLocationChangedListener2,
|
||||
IMogoMapListener,
|
||||
IMogoNaviListener2,
|
||||
IMogoLocationListener {
|
||||
IMogoLocationListener,
|
||||
IMogoObuDataChangedListener {
|
||||
|
||||
|
||||
private static volatile EventDispatchCenter sInstance;
|
||||
@@ -459,4 +464,48 @@ 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,27 +8,21 @@ import android.widget.FrameLayout;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.viewpager.widget.ViewPager;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.commons.mvp.MvpActivity;
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
import com.mogo.map.location.IMogoLocationClient;
|
||||
import com.mogo.map.location.IMogoLocationListener;
|
||||
import com.mogo.map.location.MogoLocation;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.marker.IMogoMarkerClickListener;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
import com.mogo.module.common.MogoModule;
|
||||
import com.mogo.module.common.MogoModulePaths;
|
||||
import com.mogo.module.common.map.MapCenterPointStrategy;
|
||||
import com.mogo.module.common.map.Scene;
|
||||
import com.mogo.module.main.cards.MogoModulesHandler;
|
||||
import com.mogo.module.main.cards.MogoModulesManager;
|
||||
import com.mogo.module.main.service.MogoMainService;
|
||||
import com.mogo.module.main.windowview.FloatingViewHandler;
|
||||
import com.mogo.module.service.ServiceConst;
|
||||
import com.mogo.service.IMogoServiceApis;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.fragmentmanager.IMogoFragmentManager;
|
||||
@@ -38,8 +32,6 @@ import com.mogo.service.statusmanager.IMogoStatusManager;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.zhidao.autopilot.support.api.AutopilotServiceManage;
|
||||
|
||||
import org.aspectj.lang.annotation.Around;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -133,6 +125,8 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
||||
mMogoMapService.getHostListenerRegister().registerMarkerClickListener( this );
|
||||
}
|
||||
|
||||
mServiceApis.getObuManager().registerObuDataChangedListener(EventDispatchCenter.getInstance());
|
||||
|
||||
EventDispatchCenter.getInstance().setMapLoadedCallback( () -> {
|
||||
Logger.d( TAG, "map loaded." + Thread.currentThread().getName() );
|
||||
// 加载地图,触发地图加载完毕回调,在初始化其他卡片模块,保证卡片模块可以正确获取地图相关服务。
|
||||
|
||||
@@ -12,9 +12,9 @@ import com.mogo.map.navi.IMogoNaviListener;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.module.IMogoModuleLifecycle;
|
||||
import com.mogo.service.module.IMogoRegisterCenter;
|
||||
import com.mogo.service.obu.IMogoObuDataChangedListener;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
@@ -100,6 +100,16 @@ 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 init( Context context ) {
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import com.mogo.map.navi.IMogoCarLocationChangedListener;
|
||||
import com.mogo.map.navi.IMogoNaviListener;
|
||||
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;
|
||||
@@ -32,6 +33,7 @@ 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 MogoRegisterCenterHandler() {
|
||||
}
|
||||
@@ -122,6 +124,16 @@ 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 init( Context context ) {
|
||||
}
|
||||
@@ -158,6 +170,9 @@ 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();
|
||||
@@ -176,5 +191,4 @@ public class MogoRegisterCenterHandler implements IMogoRegisterCenter {
|
||||
return mCarLocations.values().iterator();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
1
modules/mogo-module-obu/.gitignore
vendored
Normal file
1
modules/mogo-module-obu/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/build
|
||||
51
modules/mogo-module-obu/build.gradle
Normal file
51
modules/mogo-module-obu/build.gradle
Normal file
@@ -0,0 +1,51 @@
|
||||
apply plugin: 'com.android.library'
|
||||
apply plugin: 'kotlin-android'
|
||||
apply plugin: 'kotlin-android-extensions'
|
||||
|
||||
android {
|
||||
compileSdkVersion rootProject.ext.android.compileSdkVersion
|
||||
// buildToolsVersion rootProject.ext.android.buildToolsVersion
|
||||
defaultConfig {
|
||||
minSdkVersion rootProject.ext.android.minSdkVersion
|
||||
targetSdkVersion rootProject.ext.android.targetSdkVersion
|
||||
versionCode Integer.valueOf(VERSION_CODE)
|
||||
versionName getValueFromRootProperties("${project.name.replace("-", "_").toUpperCase()}_VERSION")
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
consumerProguardFiles 'consumer-rules.pro'
|
||||
|
||||
javaCompileOptions {
|
||||
annotationProcessorOptions {
|
||||
arguments = [AROUTER_MODULE_NAME: project.getName()]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
annotationProcessor rootProject.ext.dependencies.aroutercompiler
|
||||
implementation rootProject.ext.dependencies.rxjava
|
||||
implementation rootProject.ext.dependencies.rxandroid
|
||||
|
||||
if (Boolean.valueOf(RELEASE)) {
|
||||
implementation rootProject.ext.dependencies.modulecommon
|
||||
} else {
|
||||
implementation project(':modules:mogo-module-common')
|
||||
}
|
||||
}
|
||||
|
||||
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()
|
||||
0
modules/mogo-module-obu/consumer-rules.pro
Normal file
0
modules/mogo-module-obu/consumer-rules.pro
Normal file
3
modules/mogo-module-obu/gradle.properties
Normal file
3
modules/mogo-module-obu/gradle.properties
Normal file
@@ -0,0 +1,3 @@
|
||||
GROUP=com.mogo.module
|
||||
POM_ARTIFACT_ID=module-obu
|
||||
VERSION_CODE=1
|
||||
21
modules/mogo-module-obu/proguard-rules.pro
vendored
Normal file
21
modules/mogo-module-obu/proguard-rules.pro
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# You can control the set of applied configuration files using the
|
||||
# proguardFiles setting in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.zhidao.mogo.module.obu
|
||||
|
||||
import androidx.test.platform.app.InstrumentationRegistry
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
||||
import org.junit.Assert.*
|
||||
|
||||
/**
|
||||
* Instrumented test, which will execute on an Android device.
|
||||
*
|
||||
* See [testing documentation](http://d.android.com/tools/testing).
|
||||
*/
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
class ExampleInstrumentedTest {
|
||||
@Test
|
||||
fun useAppContext() {
|
||||
// Context of the app under test.
|
||||
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
|
||||
assertEquals("com.zhidao.mogo.module.obu.test", appContext.packageName)
|
||||
}
|
||||
}
|
||||
5
modules/mogo-module-obu/src/main/AndroidManifest.xml
Normal file
5
modules/mogo-module-obu/src/main/AndroidManifest.xml
Normal file
@@ -0,0 +1,5 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.zhidao.mogo.module.obu">
|
||||
|
||||
/
|
||||
</manifest>
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.zhidao.mogo.module.obu
|
||||
|
||||
import com.mogo.service.obu.IMogoObuDataChangedListener
|
||||
import com.mogo.utils.logger.Logger
|
||||
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.disposables.Disposable
|
||||
import io.reactivex.internal.operators.single.SingleSubscribeOn
|
||||
import io.reactivex.schedulers.Schedulers
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
/**
|
||||
* 模拟相关操作及数据的单例类
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
object MockUtil {
|
||||
const val TAG = "MockUtil"
|
||||
private lateinit var dataCallback : IMogoObuDataChangedListener
|
||||
|
||||
private lateinit var intervalObs:Disposable
|
||||
|
||||
fun init(callback: IMogoObuDataChangedListener){
|
||||
Logger.d(TAG, "使用模拟obu数据===")
|
||||
dataCallback = callback
|
||||
intervalMockData()
|
||||
}
|
||||
|
||||
private fun intervalMockData(){
|
||||
intervalObs = Observable.interval(1000,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)
|
||||
}
|
||||
}
|
||||
|
||||
fun destroy(){
|
||||
intervalObs.dispose()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,127 @@
|
||||
package com.zhidao.mogo.module.obu
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Bundle
|
||||
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.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 {
|
||||
companion object{
|
||||
const val TAG = "ObuProvider"
|
||||
}
|
||||
private var dataChangedListener: IMogoObuDataChangedListener? = null
|
||||
|
||||
override fun getNaviListener(): IMogoNaviListener? {
|
||||
return null
|
||||
}
|
||||
|
||||
override fun getLocationListener(): IMogoLocationListener? {
|
||||
return null
|
||||
}
|
||||
|
||||
override fun getType(): Int {
|
||||
return 0
|
||||
}
|
||||
|
||||
override fun getMarkerClickListener(): IMogoMarkerClickListener? {
|
||||
return null
|
||||
}
|
||||
|
||||
override fun init(context: Context) {
|
||||
Logger.d(TAG,"init=======")
|
||||
if (DebugConfig.isUseMockObuData()) {
|
||||
MockUtil.init {
|
||||
Logger.d(TAG, "obu mock callback===$it")
|
||||
|
||||
}
|
||||
} else {
|
||||
// 初始化sdk,注册数据回调等信息
|
||||
V2xController.getInstance().setMessageReceiveListener(this@ObuManager)
|
||||
}
|
||||
}
|
||||
|
||||
override fun getMapListener(): IMogoMapListener? {
|
||||
return null
|
||||
}
|
||||
|
||||
override fun getAppPackage(): String {
|
||||
return ""
|
||||
}
|
||||
|
||||
override fun createView(context: Context?): View? {
|
||||
return null
|
||||
}
|
||||
|
||||
override fun createFragment(context: Context?, data: Bundle?): Fragment? {
|
||||
return null
|
||||
}
|
||||
|
||||
override fun getModuleName(): String {
|
||||
return "moduleObu"
|
||||
}
|
||||
|
||||
override fun getAppName(): String {
|
||||
return ""
|
||||
}
|
||||
|
||||
override fun getCardLifecycle(): IMogoModuleLifecycle? {
|
||||
return null
|
||||
}
|
||||
|
||||
override fun registerObuDataChangedListener(listener: IMogoObuDataChangedListener?) {
|
||||
this.dataChangedListener = listener
|
||||
}
|
||||
|
||||
/**
|
||||
* 车辆位置信息回调接口
|
||||
*/
|
||||
override fun showCarLocationInfo(info: CarLocationInfo?) {
|
||||
Logger.d(TAG,"showCarLocationInfo: ${info?.carId}")
|
||||
dataChangedListener?.showCarLocationInfo(info)
|
||||
}
|
||||
|
||||
/**
|
||||
* UDP 收发消息回调接口
|
||||
*/
|
||||
override fun showOtherInfo(info: String?) {
|
||||
Logger.d(TAG, "showOtherInfo: $info")
|
||||
dataChangedListener?.showOtherInfo(info)
|
||||
}
|
||||
|
||||
/**
|
||||
* 交通信号灯信息回调接口
|
||||
*/
|
||||
override fun showTrafficLightInfo(info: TrafficLightInfo?) {
|
||||
Logger.d(TAG, "showTrafficLightInfo: ${info?.id}")
|
||||
dataChangedListener?.showTrafficLightInfo(info)
|
||||
}
|
||||
|
||||
/**
|
||||
* 场景触发事件信息回调接口
|
||||
*/
|
||||
override fun showCarEventInfo(info: CarEventInfo?) {
|
||||
Logger.d(TAG, "showCarEventInfo: ${info?.type}")
|
||||
dataChangedListener?.showCarEventInfo(info)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.zhidao.mogo.module.obu
|
||||
|
||||
import org.junit.Test
|
||||
|
||||
import org.junit.Assert.*
|
||||
|
||||
/**
|
||||
* Example local unit test, which will execute on the development machine (host).
|
||||
*
|
||||
* See [testing documentation](http://d.android.com/tools/testing).
|
||||
*/
|
||||
class ExampleUnitTest {
|
||||
@Test
|
||||
fun addition_isCorrect() {
|
||||
assertEquals(4, 2 + 2)
|
||||
}
|
||||
}
|
||||
@@ -32,6 +32,7 @@ import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.intent.IMogoIntentListener;
|
||||
import com.mogo.service.intent.IMogoIntentManager;
|
||||
import com.mogo.service.module.IMogoModuleLifecycle;
|
||||
import com.mogo.service.obu.IMogoObuDataChangedListener;
|
||||
import com.mogo.service.share.IMogoShareManager;
|
||||
import com.mogo.utils.TipToast;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
@@ -42,6 +43,9 @@ import org.json.JSONObject;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import com.mogo.commons.analytics.AnalyticsUtils;
|
||||
import com.zhidao.smartv2x.model.obu.CarEventInfo;
|
||||
import com.zhidao.smartv2x.model.obu.CarLocationInfo;
|
||||
import com.zhidao.smartv2x.model.obu.TrafficLightInfo;
|
||||
|
||||
import static com.mogo.module.share.bean.StepAfterAuthKt.STEP_AFTER_AUTH_TYPE_SEEK_HELP;
|
||||
import static com.mogo.module.share.bean.StepAfterAuthKt.STEP_AFTER_AUTH_TYPE_SHOW_DIALOG;
|
||||
@@ -198,6 +202,28 @@ public class ShareControl implements IMogoShareManager, IMogoIntentListener, IMo
|
||||
UPLOAD_ROAD_CONSTRUCTION, this);
|
||||
}
|
||||
|
||||
ServiceApisManager.serviceApis.getRegisterCenterApi().registerObuDataListener("share", new IMogoObuDataChangedListener() {
|
||||
@Override
|
||||
public void showCarLocationInfo(CarLocationInfo info) {
|
||||
Logger.d(TAG, "获取到car location info: " + info.carId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showOtherInfo(String info) {
|
||||
Logger.d(TAG, "获取到other info: " + info);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showTrafficLightInfo(TrafficLightInfo info) {
|
||||
Logger.d(TAG, "获取到traffic light info: " + info.id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showCarEventInfo(CarEventInfo info) {
|
||||
Logger.d(TAG, "获取到car event info: " + info.describe);
|
||||
}
|
||||
});
|
||||
|
||||
Logger.d(TAG,"init over====");
|
||||
}
|
||||
|
||||
|
||||
@@ -41,6 +41,7 @@ dependencies {
|
||||
implementation rootProject.ext.dependencies.arouter
|
||||
annotationProcessor rootProject.ext.dependencies.aroutercompiler
|
||||
api rootProject.ext.dependencies.fresco
|
||||
api rootProject.ext.dependencies.obusdk
|
||||
if (Boolean.valueOf(RELEASE)) {
|
||||
implementation rootProject.ext.dependencies.mogomapapi
|
||||
} else {
|
||||
|
||||
@@ -21,6 +21,7 @@ import com.mogo.service.module.IMogoRegisterCenter;
|
||||
import com.mogo.service.module.IMogoSearchManager;
|
||||
import com.mogo.service.module.IMogoSettingManager;
|
||||
import com.mogo.service.network.IMogoNetwork;
|
||||
import com.mogo.service.obu.IMogoObuManager;
|
||||
import com.mogo.service.share.IMogoShareManager;
|
||||
import com.mogo.service.statusmanager.IMogoMsgCenter;
|
||||
import com.mogo.service.statusmanager.IMogoStatusManager;
|
||||
@@ -201,4 +202,10 @@ public interface IMogoServiceApis extends IProvider {
|
||||
* @return
|
||||
*/
|
||||
IMogoShareManager getShareManager();
|
||||
|
||||
/**
|
||||
* 获取obuManager
|
||||
* @return obuManager
|
||||
*/
|
||||
IMogoObuManager getObuManager();
|
||||
}
|
||||
|
||||
@@ -184,4 +184,10 @@ public class MogoServicePaths {
|
||||
*/
|
||||
@Deprecated
|
||||
public static final String PATH_SHARE = "/extensions/share";
|
||||
|
||||
/**
|
||||
* obu相关接口
|
||||
*/
|
||||
@Deprecated
|
||||
public static final String PATH_OBU = "/obu/api";
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.mogo.map.marker.IMogoMarkerClickListener;
|
||||
import com.mogo.map.navi.IMogoAimlessModeListener;
|
||||
import com.mogo.map.navi.IMogoCarLocationChangedListener;
|
||||
import com.mogo.map.navi.IMogoNaviListener;
|
||||
import com.mogo.service.obu.IMogoObuDataChangedListener;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
@@ -136,4 +137,16 @@ 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);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
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);
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.mogo.service.obu;
|
||||
|
||||
import com.mogo.service.module.IMogoModuleProvider;
|
||||
import com.zhidao.smartv2x.listener.OnMessageReceiveListener;
|
||||
|
||||
/**
|
||||
* obu事件管理器
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public interface IMogoObuManager extends IMogoModuleProvider, OnMessageReceiveListener{
|
||||
void registerObuDataChangedListener(IMogoObuDataChangedListener listener);
|
||||
}
|
||||
@@ -30,6 +30,7 @@ import com.mogo.service.module.IMogoRegisterCenter;
|
||||
import com.mogo.service.module.IMogoSearchManager;
|
||||
import com.mogo.service.module.IMogoSettingManager;
|
||||
import com.mogo.service.network.IMogoNetwork;
|
||||
import com.mogo.service.obu.IMogoObuManager;
|
||||
import com.mogo.service.share.IMogoShareManager;
|
||||
import com.mogo.service.statusmanager.IMogoMsgCenter;
|
||||
import com.mogo.service.statusmanager.IMogoStatusManager;
|
||||
@@ -177,6 +178,11 @@ public class MogoServiceApis implements IMogoServiceApis {
|
||||
return getApiInstance(IMogoShareManager.class,MogoServicePaths.PATH_SHARE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoObuManager getObuManager() {
|
||||
return getApiInstance(IMogoObuManager.class, MogoServicePaths.PATH_OBU);
|
||||
}
|
||||
|
||||
private static < T extends IProvider > T getApiInstance(Class< T > clazz, String path ) {
|
||||
T inst = SingletonsHolder.get( clazz );
|
||||
if ( inst == null ) {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
include ':modules:mogo-module-obu'
|
||||
rootProject.name = 'MogoLauncher'
|
||||
include ':app'
|
||||
include ':foudations:mogo-utils'
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
./gradlew :libraries:mogo-map:clean :libraries:mogo-map:uploadArchives
|
||||
./gradlew :modules:mogo-module-common:clean :modules:mogo-module-common:uploadArchives
|
||||
./gradlew :services:mogo-service:clean :services:mogo-service:uploadArchives
|
||||
./gradlew :modules:mogo-module-obu:clean :modules:mogo-module-obu:uploadArchives
|
||||
./gradlew :modules:mogo-module-map:clean :modules:mogo-module-map:uploadArchives
|
||||
./gradlew :modules:mogo-module-apps:clean :modules:mogo-module-apps:uploadArchives
|
||||
./gradlew :modules:mogo-module-gps-simulator:clean :modules:mogo-module-gps-simulator:uploadArchives
|
||||
|
||||
Reference in New Issue
Block a user