From 986c3d46f56d4acf7a3a426fa1ea93c1892e94c7 Mon Sep 17 00:00:00 2001 From: donghongyu Date: Wed, 9 Feb 2022 15:30:56 +0800 Subject: [PATCH] =?UTF-8?q?[Change]=20=E5=88=9B=E5=BB=BAUSB-Camera=20sdk?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: donghongyu --- libraries/map-usbcamera/.gitignore | 1 + libraries/map-usbcamera/build.gradle | 66 +++++ libraries/map-usbcamera/consumer-rules.pro | 0 libraries/map-usbcamera/gradle.properties | 3 + libraries/map-usbcamera/proguard-rules.pro | 21 ++ .../src/main/AndroidManifest.xml | 13 + .../map/impl/automap/navi/AutoNaviClient.java | 229 ++++++++++++++++++ .../impl/automap/navi/AutoNaviReceiver.java | 159 ++++++++++++ .../impl/automap/navi/GuideInfoExtraKey.java | 129 ++++++++++ .../mogo/map/impl/automap/navi/MapState.java | 50 ++++ .../map/impl/automap/navi/MapStateValue.java | 28 +++ .../map/impl/automap/navi/MogoMapApi.java | 26 ++ 12 files changed, 725 insertions(+) create mode 100644 libraries/map-usbcamera/.gitignore create mode 100644 libraries/map-usbcamera/build.gradle create mode 100644 libraries/map-usbcamera/consumer-rules.pro create mode 100644 libraries/map-usbcamera/gradle.properties create mode 100644 libraries/map-usbcamera/proguard-rules.pro create mode 100644 libraries/map-usbcamera/src/main/AndroidManifest.xml create mode 100644 libraries/map-usbcamera/src/main/java/com/mogo/map/impl/automap/navi/AutoNaviClient.java create mode 100644 libraries/map-usbcamera/src/main/java/com/mogo/map/impl/automap/navi/AutoNaviReceiver.java create mode 100644 libraries/map-usbcamera/src/main/java/com/mogo/map/impl/automap/navi/GuideInfoExtraKey.java create mode 100644 libraries/map-usbcamera/src/main/java/com/mogo/map/impl/automap/navi/MapState.java create mode 100644 libraries/map-usbcamera/src/main/java/com/mogo/map/impl/automap/navi/MapStateValue.java create mode 100644 libraries/map-usbcamera/src/main/java/com/mogo/map/impl/automap/navi/MogoMapApi.java diff --git a/libraries/map-usbcamera/.gitignore b/libraries/map-usbcamera/.gitignore new file mode 100644 index 0000000000..42afabfd2a --- /dev/null +++ b/libraries/map-usbcamera/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/libraries/map-usbcamera/build.gradle b/libraries/map-usbcamera/build.gradle new file mode 100644 index 0000000000..5fb2f29276 --- /dev/null +++ b/libraries/map-usbcamera/build.gradle @@ -0,0 +1,66 @@ +plugins { + id 'com.android.library' + id 'kotlin-android' + id 'kotlin-android-extensions' + id 'kotlin-kapt' + id 'com.alibaba.arouter' +} + +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' + + //ARouter apt 参数 + kapt { + useBuildCache = false + arguments { + arg("AROUTER_MODULE_NAME", project.getName()) + } + } + } + + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } + } + + compileOptions { + sourceCompatibility 1.8 + targetCompatibility 1.8 + } +} + +dependencies { + implementation fileTree(dir: "libs", include: ["*.jar"]) + + implementation rootProject.ext.dependencies.arouter + kapt rootProject.ext.dependencies.aroutercompiler + + if (Boolean.valueOf(USE_MAVEN_PACKAGE)) { + implementation rootProject.ext.dependencies.mogoutils + implementation rootProject.ext.dependencies.mogomapapi + implementation rootProject.ext.dependencies.mogocommons + implementation rootProject.ext.dependencies.mogomapapi + + implementation rootProject.ext.dependencies.mogo_core_data + } else { + implementation project(':foudations:mogo-utils') + implementation project(':libraries:mogo-map-api') + implementation project(':foudations:mogo-commons') + implementation project(':services:mogo-service-api') + + implementation project(':core:mogo-core-data') + } +} + +apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString() \ No newline at end of file diff --git a/libraries/map-usbcamera/consumer-rules.pro b/libraries/map-usbcamera/consumer-rules.pro new file mode 100644 index 0000000000..e69de29bb2 diff --git a/libraries/map-usbcamera/gradle.properties b/libraries/map-usbcamera/gradle.properties new file mode 100644 index 0000000000..b57696e52a --- /dev/null +++ b/libraries/map-usbcamera/gradle.properties @@ -0,0 +1,3 @@ +GROUP=com.mogo.map +POM_ARTIFACT_ID=map-autonavi +VERSION_CODE=1 \ No newline at end of file diff --git a/libraries/map-usbcamera/proguard-rules.pro b/libraries/map-usbcamera/proguard-rules.pro new file mode 100644 index 0000000000..481bb43481 --- /dev/null +++ b/libraries/map-usbcamera/proguard-rules.pro @@ -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 \ No newline at end of file diff --git a/libraries/map-usbcamera/src/main/AndroidManifest.xml b/libraries/map-usbcamera/src/main/AndroidManifest.xml new file mode 100644 index 0000000000..74341ccd56 --- /dev/null +++ b/libraries/map-usbcamera/src/main/AndroidManifest.xml @@ -0,0 +1,13 @@ + + + + + + + + + + \ No newline at end of file diff --git a/libraries/map-usbcamera/src/main/java/com/mogo/map/impl/automap/navi/AutoNaviClient.java b/libraries/map-usbcamera/src/main/java/com/mogo/map/impl/automap/navi/AutoNaviClient.java new file mode 100644 index 0000000000..87e8d8a351 --- /dev/null +++ b/libraries/map-usbcamera/src/main/java/com/mogo/map/impl/automap/navi/AutoNaviClient.java @@ -0,0 +1,229 @@ +package com.mogo.map.impl.automap.navi; + +import android.content.Context; +import android.content.Intent; +import android.graphics.Rect; +import android.location.Location; + +import com.mogo.eagle.core.data.map.MogoLatLng; +import com.mogo.map.navi.IMogoCarLocationChangedListener2; +import com.mogo.map.navi.IMogoNavi; +import com.mogo.map.navi.MogoCalculatePath; +import com.mogo.map.navi.MogoNaviConfig; +import com.mogo.map.navi.OnCalculatePathItemClickInteraction; +import com.mogo.utils.logger.Logger; + +import java.util.List; + +/** + * @author congtaowang + * @since 2020/6/2 + *

+ * 使用高德车机版导航 + */ +public class AutoNaviClient implements IMogoNavi { + + private static final String TAG = "NaviClient"; + + public static final String ACTION_AUTO_MAP = "AUTONAVI_STANDARD_BROADCAST_RECV"; + + public static final String KEY_TYPE = "KEY_TYPE"; + public static final String SOURCE_APP = "SOURCE_APP"; + public static final String LAT = "LAT"; + public static final String LON = "LON"; + public static final String ENTRY_LAT = "ENTRY_LAT"; + public static final String ENTRY_LON = "ENTRY_LON"; + public static final String DEV = "DEV"; // (int)是否偏移(0:lat 和 lon 是已经加密后的,不需要国测加密; 1:需要国测加密) + + /** + * (必填)(int)导航方式 + * =1(避免收费) + * =2(多策略算路) + * =3 (不走高速) + * =4(躲避拥堵) + * =5(不走高速且避免收费) + * =6(不走高速且躲避拥堵) + * =7(躲避收费且躲避拥堵) + * =8(不走高速躲避收费和拥堵) + * =20 (高速优先) + * =24(高速优先且躲避拥堵) + * =-1(地图内部设置默认规则) + */ + public static final String STYLE = "STYLE"; + + private static volatile AutoNaviClient sInstance; + private final Context mContext; + + private AutoNaviClient( Context context ) { + mContext = context.getApplicationContext(); + } + + public static AutoNaviClient getInstance( Context context ) { + if ( sInstance == null ) { + synchronized ( AutoNaviClient.class ) { + if ( sInstance == null ) { + sInstance = new AutoNaviClient( context ); + } + } + } + return sInstance; + } + + public synchronized void release() { + sInstance = null; + } + + @Override + + public void naviTo( MogoLatLng endPoint ) { + Intent intent = new Intent(); + intent.putExtra( KEY_TYPE, 10038 ); + intent.putExtra( LAT, endPoint.lat ); + intent.putExtra( LON, endPoint.lon ); +// intent.putExtra( ENTRY_LAT, endPoint.lat ); +// intent.putExtra( ENTRY_LON, endPoint.lon ); + intent.putExtra( DEV, 0 ); + intent.putExtra( STYLE, -1 ); + intent.putExtra( SOURCE_APP, "Third App" ); + sendByIntent( intent ); + } + + @Override + public void naviTo( MogoLatLng endPoint, MogoNaviConfig config ) { + naviTo( endPoint ); + } + + @Override + public void naviTo( MogoLatLng endPoint, List< MogoLatLng > wayPoints ) { + naviTo( endPoint ); + } + + @Override + public void naviTo( MogoLatLng endPoint, List< MogoLatLng > wayPoints, MogoNaviConfig config ) { + naviTo( endPoint ); + } + + @Override + public void reCalculateRoute( MogoNaviConfig config ) { + Logger.w( TAG, "高德车机导航,不支持此设置" ); + } + + @Override + public void stopNavi() { + Intent intent = new Intent(); + intent.putExtra( "KEY_TYPE", 10010 ); + sendByIntent( intent ); + } + + @Override + public void startNavi( boolean isRealNavi ) { + Logger.w( TAG, "高德车机导航,不支持此设置" ); + } + + private void sendByIntent( Intent intent ) { + intent.setAction( ACTION_AUTO_MAP ); + intent.addFlags( Intent.FLAG_INCLUDE_STOPPED_PACKAGES ); + mContext.sendBroadcast( intent ); + } + + @Override + public boolean isNaviing() { + return MapState.getInstance().isNaving(); + } + + @Override + public List< MogoCalculatePath > getCalculatedStrategies() { + Logger.w( TAG, "高德车机导航,不支持此设置" ); + return null; + } + + @Override + public List< MogoLatLng > getCalculatedPathPos() { + Logger.w( TAG, "高德车机导航,不支持此设置" ); + return null; + } + + @Override + public OnCalculatePathItemClickInteraction getItemClickInteraction() { + Logger.w( TAG, "高德车机导航,不支持此设置" ); + return null; + } + + @Override + public void setLineClickInteraction( OnCalculatePathItemClickInteraction itemClickInteraction ) { + Logger.w( TAG, "高德车机导航,不支持此设置" ); + } + + @Override + public void clearCalculatePaths() { + Logger.w( TAG, "高德车机导航,不支持此设置" ); + } + + @Override + public void setCalculatePathDisplayBounds( Rect bounds ) { + Logger.w( TAG, "高德车机导航,不支持此设置" ); + } + + @Override + public MogoNaviConfig getNaviConfig() { + Logger.w( TAG, "高德车机导航,不支持此设置" ); + return MogoMapApi.getApiBuilder().getNavi( mContext ).getNaviConfig(); + } + + @Override + public boolean setBroadcastMode( int mode ) { + Logger.w( TAG, "高德车机导航,不支持此设置" ); + return false; + } + + @Override + public List< MogoLatLng > getNaviPathCoordinates() { + Logger.w( TAG, "高德车机导航,不支持此设置" ); + return null; + } + + @Override + public MogoLatLng getCarLocation() { + return MogoMapApi.getApiBuilder().getNavi( mContext ).getCarLocation(); + } + + @Override + public Location getCarLocation2() { + return MogoMapApi.getApiBuilder().getNavi( mContext ).getCarLocation2(); + } + + @Override + public void registerCarLocationChangedListener( IMogoCarLocationChangedListener2 listener ) { + //do not impl + } + + @Override + public void startAimlessMode() { + Logger.w( TAG, "高德车机导航,不支持此设置" ); + } + + @Override + public void stopAimlessMode() { + Logger.w( TAG, "高德车机导航,不支持此设置" ); + } + + @Override + public void setAimlessModeStatus( boolean open ) { + Logger.w( TAG, "高德车机导航,不支持此设置" ); + } + + @Override + public void displayOverview( Rect bounds ) { + Logger.w( TAG, "高德车机导航,不支持此设置" ); + } + + @Override + public void setUseExtraGPSData( boolean use ) { + MogoMapApi.getApiBuilder().getNavi( mContext ).setUseExtraGPSData( use ); + } + + @Override + public void setExtraGPSData( double lon, double lat, float speed, float accuracy, float bearing, long timestamp ) { + MogoMapApi.getApiBuilder().getNavi( mContext ).setExtraGPSData( lon, lat, speed, accuracy, bearing, timestamp ); + } +} diff --git a/libraries/map-usbcamera/src/main/java/com/mogo/map/impl/automap/navi/AutoNaviReceiver.java b/libraries/map-usbcamera/src/main/java/com/mogo/map/impl/automap/navi/AutoNaviReceiver.java new file mode 100644 index 0000000000..ecf250781d --- /dev/null +++ b/libraries/map-usbcamera/src/main/java/com/mogo/map/impl/automap/navi/AutoNaviReceiver.java @@ -0,0 +1,159 @@ +package com.mogo.map.impl.automap.navi; + +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.content.IntentFilter; +import android.text.TextUtils; + +import com.mogo.commons.storage.SpStorage; +import com.mogo.map.navi.MogoNaviInfo; +import com.mogo.map.navi.MogoNaviListenerHandler; +import com.mogo.map.navi.MogoTraffic; +import com.mogo.utils.logger.Logger; + +/** + * @author congtaowang + * @since 2020/6/2 + *

+ * 高德公版地图透出信息广播接收者 + */ +public class AutoNaviReceiver extends BroadcastReceiver { + + private static final String TAG = "AutoNaviReceiver"; + + public static final String ACTION_AUTONAVI_SEND = "AUTONAVI_STANDARD_BROADCAST_SEND"; + private static AutoNaviReceiver autoNaviReceiver; + private static boolean sRegisterFlag = false; + + private static MogoNaviInfo sNaviInfo; + private static MogoTraffic sTraffic; + + + public static void register( Context context ) { + IntentFilter filter = new IntentFilter(); + filter.addAction( ACTION_AUTONAVI_SEND ); + autoNaviReceiver = new AutoNaviReceiver(); + context.registerReceiver( autoNaviReceiver, filter ); + sRegisterFlag = true; + } + + public static void unregister( Context context ) { + if ( autoNaviReceiver != null && sRegisterFlag ) { + try { + context.unregisterReceiver( autoNaviReceiver ); + } catch ( Exception e ) { + Logger.e( TAG, e, "error. " ); + } + } + } + + @Override + public void onReceive( Context context, Intent intent ) { + String action = intent.getAction(); + + if ( !TextUtils.equals( ACTION_AUTONAVI_SEND, action ) ) { + return; + } + + int keyType = intent.getIntExtra( "KEY_TYPE", 0 ); + switch ( keyType ) { + case 10001: + handleAutoNaviInfo( context, intent ); + break; + case 10019: + int state = intent.getIntExtra( "EXTRA_STATE", -1 ); + handleMapStatusChanged( state ); + break; + case 10056: + String json = intent.getStringExtra( "EXTRA_ROAD_INFO" ); + SpStorage.setNavigationTarget( json ); + Logger.d( TAG, json ); + break; + } + } + + /** + * 在导航/巡航/模拟导航中auto主动将变化的引导信息发送给第三方系统 + * + * @param intent + */ + private void handleAutoNaviInfo( Context context, Intent intent ) { + + int type = intent.getIntExtra( GuideInfoExtraKey.TYPE, -1 ); + + int cameraSpeed = intent.getIntExtra( GuideInfoExtraKey.CAMERA_SPEED, 0 ); + int cameraDisc = intent.getIntExtra( GuideInfoExtraKey.CAMERA_DIST, 0 ); + int cameraType = intent.getIntExtra( GuideInfoExtraKey.CAMERA_TYPE, 0 ); + + if ( type == 0 || type == 1 ) { + if ( !MapState.getInstance().isNaving() + && MogoNaviListenerHandler.getInstance().hasDelegateListener() ) { + MapState.getInstance().setNaving( true ); + MogoNaviListenerHandler.getInstance().onStartNavi(); + } + if ( sNaviInfo == null ) { + sNaviInfo = new MogoNaviInfo(); + } + sNaviInfo.setCurrentLimitSpeed( cameraSpeed ); + sNaviInfo.setCurrentRoadName( intent.getStringExtra( GuideInfoExtraKey.CUR_ROAD_NAME ) ); + sNaviInfo.setCurrentSpeed( intent.getIntExtra( GuideInfoExtraKey.CUR_SPEED, 0 ) ); + sNaviInfo.setCurStepRetainDistance( intent.getIntExtra( GuideInfoExtraKey.SEG_REMAIN_DIS, 0 ) ); + sNaviInfo.setCurStepRetainTime( intent.getIntExtra( GuideInfoExtraKey.SEG_REMAIN_TIME, 0 ) ); + sNaviInfo.setIconResId( MogoMapApi.getApiBuilder().getResIdByIconType( context, intent.getIntExtra( GuideInfoExtraKey.NEW_ICON, 0 ) ) ); + sNaviInfo.setNextRoadName( intent.getStringExtra( GuideInfoExtraKey.NEXT_ROAD_NAME ) ); + sNaviInfo.setPathRetainDistance( intent.getIntExtra( GuideInfoExtraKey.ROUTE_REMAIN_DIS, 0 ) ); + sNaviInfo.setPathRetainTime( intent.getIntExtra( GuideInfoExtraKey.ROUTE_REMAIN_TIME, 0 ) ); + MogoNaviListenerHandler.getInstance().onNaviInfoUpdate( sNaviInfo ); + } + if ( sTraffic == null ) { + sTraffic = new MogoTraffic( MapState.getInstance().isAimless() ? MogoTraffic.TYPE_AIM : MogoTraffic.TYPE_NAVI ); + } + sTraffic.setFromType( MapState.getInstance().isAimless() ? MogoTraffic.TYPE_AIM : MogoTraffic.TYPE_NAVI ); + sTraffic.setDistance( cameraDisc ); + sTraffic.setSpeedLimit( cameraSpeed ); + sTraffic.setTrafficType( cameraType ); + MogoNaviListenerHandler.getInstance().onUpdateTraffic2( sTraffic ); + } + + /** + * 当导航发生状态变更时,将相应的状态通知给系统。 + * + * @param state + */ + private void handleMapStatusChanged( int state ) { + if ( state == -1 ) { + return; + } + switch ( state ) { + case MapStateValue.START_NAVI: + case MapStateValue.START_EMULATOR_NAVI: + if ( MapState.getInstance().isNaving() ) { + Logger.w( TAG, "naving..." ); + return; + } + MapState.getInstance().setNaving( true ); + MogoNaviListenerHandler.getInstance().onStartNavi(); + break; + case MapStateValue.STOP_NAVI: + case MapStateValue.STOP_EMULATOR_NAVI: + case MapStateValue.APP_START: // 语音退出导航,感觉是杀掉了高德APP了 + if ( MapState.getInstance().isNaving() ) { + MapState.getInstance().setNaving( false ); + MogoNaviListenerHandler.getInstance().onStopNavi(); + } + break; + case MapStateValue.START_AIMLESS_NAVI: + MapState.getInstance().setAimless( true ); + break; + case MapStateValue.STOP_AIMLESS_NAVI: + MapState.getInstance().setAimless( false ); + break; + case MapStateValue.EXIT_APP: + break; + case MapStateValue.DESTINATION: + MogoNaviListenerHandler.getInstance().onArriveDestination(); + break; + } + } +} diff --git a/libraries/map-usbcamera/src/main/java/com/mogo/map/impl/automap/navi/GuideInfoExtraKey.java b/libraries/map-usbcamera/src/main/java/com/mogo/map/impl/automap/navi/GuideInfoExtraKey.java new file mode 100644 index 0000000000..f71d166564 --- /dev/null +++ b/libraries/map-usbcamera/src/main/java/com/mogo/map/impl/automap/navi/GuideInfoExtraKey.java @@ -0,0 +1,129 @@ +package com.mogo.map.impl.automap.navi; + +//引导信息对应的KEY值机器描述 +public class GuideInfoExtraKey { + /** + * 导航类型,对应的值为int类型 + * 0:GPS导航 + * 1:模拟导航 + * 2:巡航 + */ + public static final String TYPE = "TYPE"; + + /** + * 当前道路名称,对应的值为String类型 + */ + public static final String CUR_ROAD_NAME = "CUR_ROAD_NAME"; + + /** + * 下一道路名,对应的值为String类型 + */ + public static final String NEXT_ROAD_NAME = "NEXT_ROAD_NAME"; + + /** + * 电子眼限速度,对应的值为int类型,无限速则为0,单位:公里/小时 + */ + public static final String CAMERA_SPEED = "CAMERA_SPEED"; + + /** + * 导航转向图标,对应的值为int类型 + */ + public static final String ICON = "ICON"; + + /** + * 导航最新的转向图标,对应的值为int类型 + */ + public static final String NEW_ICON = "NEW_ICON"; + + /** + * 路径剩余距离,对应的值为int类型,单位:米 + */ + public static final String ROUTE_REMAIN_DIS = "ROUTE_REMAIN_DIS"; + /** + * 路径剩余时间,对应的值为int类型,单位:秒 + */ + public static final String ROUTE_REMAIN_TIME = "ROUTE_REMAIN_TIME"; + + /** + * 当前导航段剩余距离,对应的值为int类型,单位:米 + */ + public static final String SEG_REMAIN_DIS = "SEG_REMAIN_DIS"; + + /** + * 当前导航段剩余时间,对应的值为int类型,单位:秒 + */ + public static final String SEG_REMAIN_TIME = "SEG_REMAIN_TIME"; + + /** + * 路径总距离,对应的值为int类型,单位:米 + */ + public static final String ROUTE_ALL_DIS = "ROUTE_ALL_DIS"; + + /** + * 路径总时间,对应的值为int类型,单位:秒 + */ + public static final String ROUTE_ALL_TIME = "ROUTE_ALL_TIME"; + + /** + * 当前车速,对应的值为int类型,单位:公里/小时 + */ + public static final String CUR_SPEED = "CUR_SPEED"; + + /** + * 当前道路类型,对应的值为int类型 + * 0:高速公路 + * 1:国道 + * 2:省道 + * 3:县道 + * 4:乡公路 + * 5:县乡村内部道路 + * 6:主要大街、城市快速道 * 7:主要道路 + * 8:次要道路 + * 9:普通道路 + * 10:非导航道路 + */ + public static final String ROAD_TYPE = "ROAD_TYPE"; + + /** + * 路径剩余时间,对应的值为String类型,单位:天/小时/分钟 比如:1天2小时, 21小时30分 + * 钟(只用于长安) + */ + public static final String ROUTE_REMAIN_TIME_STRING = "ROUTE_REMAIN_TIME_S TRING"; + + /** + * 下下个路名名称,对应的值为String类型 + */ + public static final String NEXT_NEXT_ROAD_NAME = "NEXT_NEXT_ROAD_NAME"; + /** + * 下下个路口转向图标,对应的值为int类型 + */ + + public static final String NEXT_NEXT_TURN_ICON = "NEXT_NEXT_TURN_ICON"; + + /** + * 距离下下个路口剩余距离,对应的值为int类型,单位:米 + */ + public static final String NEXT_SEG_REMAIN_DIS = "NEXT_SEG_REMAIN_DIS"; + + /** + * 距离下下个路口剩余时间,对应的值为int类型,单位:秒 + */ + public static final String NEXT_SEG_REMAIN_TIME = "NEXT_SEG_REMAIN_TIME"; + + /** + * 距离最近的电子眼距离,对应的值为int类型,单位:米 + */ + public static final String CAMERA_DIST = "CAMERA_DIST"; + + /** + * 电子眼类型,对应的值为int类型 + * 0 测速摄像头 + * 1为监控摄像头 + * 2为闯红灯拍照 + * 3为违章拍照 + * 4为公交专用道摄像头 + * 5为应急车道摄像头 + * 6为非机动车道拍照 + */ + public static final String CAMERA_TYPE = "CAMERA_TYPE"; +} \ No newline at end of file diff --git a/libraries/map-usbcamera/src/main/java/com/mogo/map/impl/automap/navi/MapState.java b/libraries/map-usbcamera/src/main/java/com/mogo/map/impl/automap/navi/MapState.java new file mode 100644 index 0000000000..4b4f2ee126 --- /dev/null +++ b/libraries/map-usbcamera/src/main/java/com/mogo/map/impl/automap/navi/MapState.java @@ -0,0 +1,50 @@ +package com.mogo.map.impl.automap.navi; + +public +/** + * @author congtaowang + * @since 2020/6/3 + * + * 高德地图状态 + */ +class MapState { + + private static volatile MapState sInstance; + + private MapState() { + } + + public static MapState getInstance() { + if ( sInstance == null ) { + synchronized ( MapState.class ) { + if ( sInstance == null ) { + sInstance = new MapState(); + } + } + } + return sInstance; + } + + public synchronized void release() { + sInstance = null; + } + + private boolean isNaving = false; + private boolean isAimless = false; + + public boolean isNaving() { + return isNaving; + } + + public void setNaving( boolean naving ) { + isNaving = naving; + } + + public boolean isAimless() { + return isAimless; + } + + public void setAimless( boolean aimless ) { + isAimless = aimless; + } +} diff --git a/libraries/map-usbcamera/src/main/java/com/mogo/map/impl/automap/navi/MapStateValue.java b/libraries/map-usbcamera/src/main/java/com/mogo/map/impl/automap/navi/MapStateValue.java new file mode 100644 index 0000000000..f2913ff1bb --- /dev/null +++ b/libraries/map-usbcamera/src/main/java/com/mogo/map/impl/automap/navi/MapStateValue.java @@ -0,0 +1,28 @@ +package com.mogo.map.impl.automap.navi; + +/** + * @author congtaowang + * @since 2020/6/3 + *

+ * 高德公版地图状态值 + */ +public interface MapStateValue { + + int START_NAVI = 8; + + int STOP_NAVI = 9; + + int START_EMULATOR_NAVI = 10; + + int STOP_EMULATOR_NAVI = 12; + + int START_AIMLESS_NAVI = 24; + + int STOP_AIMLESS_NAVI = 25; + + int EXIT_APP = 45; + + int DESTINATION = 39; + + int APP_START = 0; +} diff --git a/libraries/map-usbcamera/src/main/java/com/mogo/map/impl/automap/navi/MogoMapApi.java b/libraries/map-usbcamera/src/main/java/com/mogo/map/impl/automap/navi/MogoMapApi.java new file mode 100644 index 0000000000..1fe1f6f714 --- /dev/null +++ b/libraries/map-usbcamera/src/main/java/com/mogo/map/impl/automap/navi/MogoMapApi.java @@ -0,0 +1,26 @@ +package com.mogo.map.impl.automap.navi; + +import com.alibaba.android.arouter.launcher.ARouter; +import com.mogo.map.IMogoMapApiBuilder; + +/** + * @author congtaowang + * @since 2020/12/10 + *

+ * 描述 + */ +public class MogoMapApi { + + private static IMogoMapApiBuilder sApiBuilder; + + public static IMogoMapApiBuilder getApiBuilder() { + if (sApiBuilder == null) { + synchronized (AutoNaviClient.class) { + if (sApiBuilder == null) { + sApiBuilder = ARouter.getInstance().navigation(IMogoMapApiBuilder.class); + } + } + } + return sApiBuilder; + } +}