add MoGoAiCloud sdk --> socket passport replace origin logic
This commit is contained in:
3
.idea/gradle.xml
generated
3
.idea/gradle.xml
generated
@@ -24,6 +24,8 @@
|
||||
<option value="$PROJECT_DIR$/foudations/httpdns-mogo" />
|
||||
<option value="$PROJECT_DIR$/foudations/httpdns-noop" />
|
||||
<option value="$PROJECT_DIR$/foudations/httpdns-tencent" />
|
||||
<option value="$PROJECT_DIR$/foudations/mogo-aicloud-services-apk" />
|
||||
<option value="$PROJECT_DIR$/foudations/mogo-aicloud-services-sdk" />
|
||||
<option value="$PROJECT_DIR$/foudations/mogo-base-services-apk" />
|
||||
<option value="$PROJECT_DIR$/foudations/mogo-base-services-sdk" />
|
||||
<option value="$PROJECT_DIR$/foudations/mogo-base-websocket-sdk" />
|
||||
@@ -89,6 +91,7 @@
|
||||
</set>
|
||||
</option>
|
||||
<option name="resolveModulePerSourceSet" value="false" />
|
||||
<option name="useQualifiedModuleNames" value="true" />
|
||||
</GradleProjectSettings>
|
||||
</option>
|
||||
</component>
|
||||
|
||||
@@ -587,6 +587,7 @@ dependencies {
|
||||
implementation project(':foudations:httpdns-mogo')
|
||||
}
|
||||
|
||||
apply from: "./functions/aicloudservices.gradle"
|
||||
apply from: "./functions/basedmap.gradle"
|
||||
apply from: "./functions/perform.gradle"
|
||||
apply from: "./functions/baseservices.gradle"
|
||||
|
||||
37
app/functions/aicloudservices.gradle
Normal file
37
app/functions/aicloudservices.gradle
Normal file
@@ -0,0 +1,37 @@
|
||||
// 基础服务:仅比亚迪渠道用sdk方式实现,其他都基于apk基础服务
|
||||
//todo SDK版本 待替换
|
||||
project.dependencies {
|
||||
if (Boolean.valueOf(RELEASE)) {
|
||||
bydautoImplementation rootProject.ext.dependencies.mogoaicloudservicesdk
|
||||
|
||||
d82xImplementation rootProject.ext.dependencies.mogoaicloudserviceapk
|
||||
em1Implementation rootProject.ext.dependencies.mogoaicloudserviceapk
|
||||
em2Implementation rootProject.ext.dependencies.mogoaicloudserviceapk
|
||||
d8xxImplementation rootProject.ext.dependencies.mogoaicloudserviceapk
|
||||
d80xImplementation rootProject.ext.dependencies.mogoaicloudserviceapk
|
||||
em4Implementation rootProject.ext.dependencies.mogoaicloudserviceapk
|
||||
e8xxImplementation rootProject.ext.dependencies.mogoaicloudserviceapk
|
||||
f8xxImplementation rootProject.ext.dependencies.mogoaicloudserviceapk
|
||||
f80xImplementation rootProject.ext.dependencies.mogoaicloudserviceapk
|
||||
f8AmapImplementation rootProject.ext.dependencies.mogoaicloudserviceapk
|
||||
em3Implementation rootProject.ext.dependencies.mogoaicloudserviceapk
|
||||
fochtaxiImplementation rootProject.ext.dependencies.mogoaicloudserviceapk
|
||||
fochbusImplementation rootProject.ext.dependencies.mogoaicloudserviceapk
|
||||
} else {
|
||||
bydautoImplementation project(':foudations:mogo-aicloud-services-sdk')
|
||||
|
||||
d82xImplementation project(':foudations:mogo-aicloud-services-apk')
|
||||
em1Implementation project(':foudations:mogo-aicloud-services-apk')
|
||||
em2Implementation project(':foudations:mogo-aicloud-services-apk')
|
||||
d8xxImplementation project(':foudations:mogo-aicloud-services-apk')
|
||||
d80xImplementation project(':foudations:mogo-aicloud-services-apk')
|
||||
em4Implementation project(':foudations:mogo-aicloud-services-apk')
|
||||
e8xxImplementation project(':foudations:mogo-aicloud-services-apk')
|
||||
f8xxImplementation project(':foudations:mogo-aicloud-services-apk')
|
||||
f80xImplementation project(':foudations:mogo-aicloud-services-apk')
|
||||
f8AmapImplementation project(':foudations:mogo-aicloud-services-apk')
|
||||
em3Implementation project(':foudations:mogo-aicloud-services-apk')
|
||||
fochtaxiImplementation project(':foudations:mogo-aicloud-services-apk')
|
||||
fochbusImplementation project(':foudations:mogo-aicloud-services-apk')
|
||||
}
|
||||
}
|
||||
@@ -22,6 +22,7 @@ import com.mogo.module.main.service.MogoMainService;
|
||||
import com.mogo.module.push.base.PushUIConstants;
|
||||
import com.mogo.module.service.ServiceConst;
|
||||
import com.mogo.module.share.constant.ShareConstants;
|
||||
import com.mogo.realtime.api.MoGoAiCloudRealTime;
|
||||
import com.mogo.service.map.IMogoSmallMapProvider;
|
||||
import com.mogo.module.v2x.V2XConst;
|
||||
import com.mogo.module.v2x.utils.ObuConfig;
|
||||
@@ -189,24 +190,8 @@ public class MogoApplication extends AbsMogoApplication {
|
||||
}
|
||||
|
||||
private void preparePassportEnvironment( IMogoServiceApis apis, Runnable after ) {
|
||||
apis.getPassportManagerApi().requestTicket( new IMogoTicketCallback() {
|
||||
@Override
|
||||
public void onTicketGot( String ticket ) {
|
||||
Logger.d( TAG, "ticket = %s", ticket );
|
||||
}
|
||||
//todo 开启MoGoAiCloud云基础服务
|
||||
|
||||
@Override
|
||||
public void onError( int code, String msg ) {
|
||||
Logger.w( TAG, "code = %s, msg = %s", code, msg );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoginSuccess( String token, String sn ) {
|
||||
if ( after != null ) {
|
||||
after.run();
|
||||
}
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
private void prepareSocketAndLocationServices( IMogoServiceApis apis ) {
|
||||
@@ -217,7 +202,6 @@ public class MogoApplication extends AbsMogoApplication {
|
||||
apis.getLocationInfoApi().provideLocation( location );
|
||||
} );
|
||||
}
|
||||
apis.getWebSocketManagerApi( getApplicationContext() ).init( getApplicationContext(), DebugConfig.getSocketAppId() );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -229,6 +229,17 @@ ext {
|
||||
mogoochbus : "com.mogo.och:och-bus:${MOGO_OCH_BUS_VERSION}",
|
||||
mogoochtaxi : "com.mogo.och:och-taxi:${MOGO_OCH_TAXI_VERSION}",
|
||||
mogoochnoop : "com.mogo.och:och-noop:${MOGO_OCH_NOOP_VERSION}",
|
||||
|
||||
mogoaicloudserviceapk : "com.mogo.aicloud.services:services-apk:${MOGO_AICLOUD_SERVICES_APK_VERSION}",
|
||||
mogoaicloudservicesdk : "com.mogo.aicloud.services:services-sdk:${MOGO_AICLOUD_SERVICES_SDK_VERSION}",
|
||||
|
||||
mogoaicloudsocket : "com.mogo.cloud:socket:${MOGO_SOCKET_VERSION}",
|
||||
mogoaicloudpassport : "com.mogo.cloud:passport:${MOGO_PASSPORT_VERSION}",
|
||||
mogoaicloudnetwork : "com.mogo.cloud:network:${MOGO_NETWORK_VERSION}",
|
||||
mogoaicloudlive : "com.mogo.cloud:live:${MOGO_LIVE_VERSION}",
|
||||
mogoaicloudrealtime : "com.mogo.cloud:realtime:${MOGO_REALTIME_VERSION}",
|
||||
mogoaicloudtanlu : "com.mogo.cloud:tanlu:${MOGO_TANLU_VERSION}",
|
||||
mogoaicloudtrafficlive : "com.mogo.cloud:trafficlive:${MOGO_TRAFFICLIVE_VERSION}",
|
||||
]
|
||||
|
||||
}
|
||||
1
foudations/mogo-aicloud-services-apk/.gitignore
vendored
Normal file
1
foudations/mogo-aicloud-services-apk/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/build
|
||||
42
foudations/mogo-aicloud-services-apk/build.gradle
Normal file
42
foudations/mogo-aicloud-services-apk/build.gradle
Normal file
@@ -0,0 +1,42 @@
|
||||
plugins {
|
||||
id 'com.android.library'
|
||||
}
|
||||
|
||||
android {
|
||||
compileSdkVersion rootProject.ext.android.compileSdkVersion
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion rootProject.ext.android.minSdkVersion
|
||||
targetSdkVersion rootProject.ext.android.targetSdkVersion
|
||||
versionCode Integer.valueOf(VERSION_CODE)
|
||||
versionName getValueFromRootProperties("${project.name.replace("-", "_").toUpperCase()}_VERSION")
|
||||
|
||||
consumerProguardFiles "consumer-rules.pro"
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation rootProject.ext.dependencies.mogoaicloudsocket
|
||||
implementation rootProject.ext.dependencies.mogoaicloudpassport
|
||||
|
||||
if (Boolean.valueOf(RELEASE)) {
|
||||
implementation rootProject.ext.dependencies.mogoutils
|
||||
implementation rootProject.ext.dependencies.mogoserviceapi
|
||||
} else {
|
||||
implementation project(":foudations:mogo-utils")
|
||||
implementation project(":services:mogo-service-api")
|
||||
}
|
||||
}
|
||||
|
||||
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()
|
||||
3
foudations/mogo-aicloud-services-apk/gradle.properties
Normal file
3
foudations/mogo-aicloud-services-apk/gradle.properties
Normal file
@@ -0,0 +1,3 @@
|
||||
GROUP=com.mogo.aicloud.services
|
||||
POM_ARTIFACT_ID=services-apk
|
||||
VERSION_CODE=1
|
||||
21
foudations/mogo-aicloud-services-apk/proguard-rules.pro
vendored
Normal file
21
foudations/mogo-aicloud-services-apk/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,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.mogo.aicloud.services">
|
||||
|
||||
</manifest>
|
||||
@@ -0,0 +1,63 @@
|
||||
package com.mogo.aicloud.services.locationinfo;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.annotation.Keep;
|
||||
|
||||
import com.mogo.map.location.MogoLocation;
|
||||
import com.mogo.service.locationinfo.IMogoLocationInfoService;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/7/16
|
||||
*
|
||||
* 位置服务
|
||||
*/
|
||||
@Keep
|
||||
class MogoLocationInfoServices implements IMogoLocationInfoService {
|
||||
|
||||
private static final String TAG = "MogoLocationInfoServices-apk";
|
||||
|
||||
private static volatile MogoLocationInfoServices sInstance;
|
||||
|
||||
private MogoLocationInfoServices() {
|
||||
}
|
||||
|
||||
@Keep
|
||||
public static MogoLocationInfoServices getInstance() {
|
||||
if ( sInstance == null ) {
|
||||
synchronized ( MogoLocationInfoServices.class ) {
|
||||
if ( sInstance == null ) {
|
||||
sInstance = new MogoLocationInfoServices();
|
||||
}
|
||||
}
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
public synchronized void release() {
|
||||
sInstance = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void provideLocation( MogoLocation location ) {
|
||||
Logger.d( TAG, "apk - provideLocation" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start() {
|
||||
Logger.d( TAG, "apk - start" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop() {
|
||||
Logger.d( TAG, "apk - stop" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init( Context context ) {
|
||||
Logger.d( TAG, "apk - init" );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
package com.mogo.aicloud.services.passport;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.annotation.Keep;
|
||||
|
||||
import com.mogo.cloud.passport.IMoGoTokenCallback;
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClient;
|
||||
import com.mogo.service.passport.IMogoPassportManager;
|
||||
import com.mogo.service.passport.IMogoTicketCallback;
|
||||
|
||||
public
|
||||
/*
|
||||
* @author congtaowang
|
||||
* @since 2020/7/16
|
||||
*
|
||||
* 描述
|
||||
*/
|
||||
@Keep
|
||||
class PassportManager implements IMogoPassportManager {
|
||||
|
||||
private static volatile PassportManager sInstance;
|
||||
private IMogoTicketCallback mCallBack;
|
||||
|
||||
private PassportManager() {
|
||||
MoGoAiCloudClient.getInstance().addTokenCallbacks(new IMoGoTokenCallback() {
|
||||
@Override
|
||||
public void onTokenGot(String token, String sn) {
|
||||
if (mCallBack != null) {
|
||||
mCallBack.onTicketGot(token);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(int code, String msg) {
|
||||
if (mCallBack != null) {
|
||||
mCallBack.onError(code, msg);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Keep
|
||||
public static PassportManager getInstance() {
|
||||
if (sInstance == null) {
|
||||
synchronized (PassportManager.class) {
|
||||
if (sInstance == null) {
|
||||
sInstance = new PassportManager();
|
||||
}
|
||||
}
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
public synchronized void release() {
|
||||
mCallBack = null;
|
||||
sInstance = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void requestTicket(final IMogoTicketCallback callback) {
|
||||
this.mCallBack = callback;
|
||||
MoGoAiCloudClient.getInstance().refreshToken();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(Context context) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,153 @@
|
||||
package com.mogo.aicloud.services.socket;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.annotation.Keep;
|
||||
|
||||
import com.mogo.cloud.socket.IMogoCloudSocketMsgAckListener;
|
||||
import com.mogo.cloud.socket.IMogoCloudSocketOnMessageListener;
|
||||
import com.mogo.cloud.socket.SocketManager;
|
||||
import com.mogo.service.connection.IMogoMsgAckListener;
|
||||
import com.mogo.service.connection.IMogoOnMessageListener;
|
||||
import com.mogo.service.connection.IMogoSocketManager;
|
||||
import com.mogo.service.connection.MsgBody;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.zhidao.ptech.connsvr.commom.protocol.MogoCommon;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
/**
|
||||
* @author arrow
|
||||
* @since 2021-02-22
|
||||
* <p>
|
||||
* 长链实现:基于 netty
|
||||
*/
|
||||
@Keep
|
||||
public class MogoAiCloudSocketManager implements IMogoSocketManager {
|
||||
|
||||
private static final String TAG = "SocketManager-apk";
|
||||
|
||||
private static volatile MogoAiCloudSocketManager sInstance;
|
||||
private String mAppId;
|
||||
|
||||
private MogoAiCloudSocketManager(Context context) {
|
||||
}
|
||||
|
||||
@Keep
|
||||
public static MogoAiCloudSocketManager getInstance(Context context) {
|
||||
if (sInstance == null) {
|
||||
synchronized (MogoAiCloudSocketManager.class) {
|
||||
if (sInstance == null) {
|
||||
sInstance = new MogoAiCloudSocketManager(context);
|
||||
}
|
||||
}
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
/**
|
||||
* 管理消息分发
|
||||
* <p>
|
||||
* key - msgType
|
||||
*/
|
||||
private final Map<Integer, List<IMogoOnMessageListener>> mListeners = new ConcurrentHashMap<>();
|
||||
|
||||
/**
|
||||
* 管理消息回执
|
||||
* <p>
|
||||
* key - msgId
|
||||
*/
|
||||
private final Map<Long, IMogoMsgAckListener> mAckListeners = new ConcurrentHashMap<>();
|
||||
|
||||
@Override
|
||||
public void init(Context context, String appId) {
|
||||
this.mAppId = appId;
|
||||
SocketManager.getInstance().init(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerOnMessageListener(int msgType, IMogoOnMessageListener listener) {
|
||||
if (mListeners.containsKey(msgType)) {
|
||||
com.mogo.cloud.utils.logger.Logger.w(TAG, "msgType %d is exist.", msgType);
|
||||
return;
|
||||
}
|
||||
if (!mListeners.containsKey(msgType)) {
|
||||
mListeners.put(msgType, new ArrayList<>());
|
||||
}
|
||||
mListeners.get(msgType).add(listener);
|
||||
SocketManager.getInstance().registerOnMessageListener(msgType, mogoCloudSocketOnMessageListener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterOnMessageListener(int msgType) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterOnMessageListener(int msgType, IMogoOnMessageListener listener) {
|
||||
if (listener == null) {
|
||||
return;
|
||||
}
|
||||
if (!mListeners.containsKey(msgType)) {
|
||||
return;
|
||||
}
|
||||
List<IMogoOnMessageListener> listeners = mListeners.get(msgType);
|
||||
if (listeners != null) {
|
||||
listeners.remove(listener);
|
||||
}
|
||||
SocketManager.getInstance().unregisterOnMessageListener(msgType, mogoCloudSocketOnMessageListener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendMsg(MsgBody body, IMogoMsgAckListener listener) {
|
||||
Logger.d(TAG, "sendMsg.");
|
||||
mAckListeners.put(body.getMsgId(), listener);
|
||||
com.mogo.cloud.socket.MsgBody msgBody = new com.mogo.cloud.socket.MsgBody();
|
||||
msgBody.msgType(body.getMsgType());
|
||||
msgBody.ack(body.isAck());
|
||||
msgBody.content(body.getContent());
|
||||
SocketManager.getInstance().sendMsg(mAppId, MogoCommon.Product.mogoBussiness.getNumber(), msgBody, mogoCloudSocketMsgAckListener);
|
||||
}
|
||||
|
||||
public synchronized void release() {
|
||||
SocketManager.getInstance().release();
|
||||
mListeners.clear();
|
||||
sInstance = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(Context context) {
|
||||
|
||||
}
|
||||
|
||||
private final IMogoCloudSocketMsgAckListener mogoCloudSocketMsgAckListener = msgId -> mAckListeners.get(msgId).onAck(msgId);
|
||||
|
||||
private final IMogoCloudSocketOnMessageListener mogoCloudSocketOnMessageListener = new IMogoCloudSocketOnMessageListener() {
|
||||
@Override
|
||||
public Class<Object> target(int msgType) {
|
||||
List<IMogoOnMessageListener> listeners = mListeners.get(msgType);
|
||||
if (listeners != null) {
|
||||
return listeners.get(0).target();
|
||||
} else {
|
||||
return Object.class;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMsgReceived(int msgType, Object obj) {
|
||||
Logger.d(TAG,"onMsgReceived obj className : " + obj.getClass().getName());
|
||||
List<IMogoOnMessageListener> listeners = mListeners.get(msgType);
|
||||
if (listeners != null && !listeners.isEmpty()) {
|
||||
for (IMogoOnMessageListener listener : listeners) {
|
||||
if (listener != null) {
|
||||
Logger.d(TAG, "received msgId = %s, content = %s", mAckListeners.get(msgType), obj);
|
||||
listener.onMsgReceived(obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
1
foudations/mogo-aicloud-services-sdk/.gitignore
vendored
Normal file
1
foudations/mogo-aicloud-services-sdk/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/build
|
||||
44
foudations/mogo-aicloud-services-sdk/build.gradle
Normal file
44
foudations/mogo-aicloud-services-sdk/build.gradle
Normal file
@@ -0,0 +1,44 @@
|
||||
plugins {
|
||||
id 'com.android.library'
|
||||
}
|
||||
|
||||
android {
|
||||
compileSdkVersion rootProject.ext.android.compileSdkVersion
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion rootProject.ext.android.minSdkVersion
|
||||
targetSdkVersion rootProject.ext.android.targetSdkVersion
|
||||
versionCode Integer.valueOf(VERSION_CODE)
|
||||
versionName getValueFromRootProperties("${project.name.replace("-", "_").toUpperCase()}_VERSION")
|
||||
|
||||
consumerProguardFiles "consumer-rules.pro"
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation rootProject.ext.dependencies.mogoaicloudsocket
|
||||
implementation rootProject.ext.dependencies.mogoaicloudpassport
|
||||
|
||||
if (Boolean.valueOf(RELEASE)) {
|
||||
implementation rootProject.ext.dependencies.mogoutils
|
||||
implementation rootProject.ext.dependencies.mogocommons
|
||||
implementation rootProject.ext.dependencies.mogoserviceapi
|
||||
} else {
|
||||
implementation project(":foudations:mogo-utils")
|
||||
implementation project(":foudations:mogo-commons")
|
||||
implementation project(":services:mogo-service-api")
|
||||
}
|
||||
}
|
||||
|
||||
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()
|
||||
3
foudations/mogo-aicloud-services-sdk/gradle.properties
Normal file
3
foudations/mogo-aicloud-services-sdk/gradle.properties
Normal file
@@ -0,0 +1,3 @@
|
||||
GROUP=com.mogo.aicloud.services
|
||||
POM_ARTIFACT_ID=services-sdk
|
||||
VERSION_CODE=1
|
||||
21
foudations/mogo-aicloud-services-sdk/proguard-rules.pro
vendored
Normal file
21
foudations/mogo-aicloud-services-sdk/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,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.mogo.aicloud.services">
|
||||
|
||||
</manifest>
|
||||
@@ -0,0 +1,79 @@
|
||||
package com.mogo.aicloud.services.locationinfo;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.annotation.Keep;
|
||||
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.map.location.MogoLocation;
|
||||
import com.mogo.service.locationinfo.IMogoLocationInfoService;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.zhidao.locupload.LocUploadConfig;
|
||||
import com.zhidao.locupload.LocUploadManager;
|
||||
|
||||
public
|
||||
/*
|
||||
* @author congtaowang
|
||||
* @since 2020/7/16
|
||||
*
|
||||
* 位置服务
|
||||
*/
|
||||
@Keep
|
||||
class MogoLocationInfoServices implements IMogoLocationInfoService {
|
||||
|
||||
private static final String TAG = "MogoLocationInfoServices-sdk";
|
||||
|
||||
private static volatile MogoLocationInfoServices sInstance;
|
||||
private MogoLocation mLocation;
|
||||
|
||||
private MogoLocationInfoServices() {
|
||||
}
|
||||
|
||||
@Keep
|
||||
public static MogoLocationInfoServices getInstance() {
|
||||
if ( sInstance == null ) {
|
||||
synchronized ( MogoLocationInfoServices.class ) {
|
||||
if ( sInstance == null ) {
|
||||
sInstance = new MogoLocationInfoServices();
|
||||
}
|
||||
}
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
public synchronized void release() {
|
||||
sInstance = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void provideLocation( MogoLocation location ) {
|
||||
mLocation = location;
|
||||
Logger.d( TAG, "sdk - provideLocation" );
|
||||
}
|
||||
|
||||
public MogoLocation getLocation() {
|
||||
return mLocation;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start() {
|
||||
LocUploadManager.getInstance().startUpload();
|
||||
Logger.d( TAG, "sdk - start" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop() {
|
||||
LocUploadManager.getInstance().stopUpload();
|
||||
Logger.d( TAG, "sdk - stop" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init( Context context ) {
|
||||
LocUploadConfig.instance().
|
||||
setAppId( DebugConfig.getSocketAppId() ).
|
||||
setContext( context.getApplicationContext() ).
|
||||
setLoggable( DebugConfig.isDebug() ).
|
||||
setLocInterval( 2000L );
|
||||
Logger.d( TAG, "sdk - init" );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
package com.mogo.aicloud.services.locationinfo;
|
||||
|
||||
import com.elegant.spi.annotations.Service;
|
||||
import com.zhidao.locupload.location.LocationServiceProvider;
|
||||
|
||||
public
|
||||
/*
|
||||
* @author congtaowang
|
||||
* @since 2020/7/16
|
||||
*
|
||||
* 描述
|
||||
*/
|
||||
@Service( value = LocationServiceProvider.class )
|
||||
class MogoLocationSource extends LocationServiceProvider {
|
||||
|
||||
@Override
|
||||
public float getBearing() {
|
||||
if ( MogoLocationInfoServices.getInstance().getLocation() != null ) {
|
||||
return MogoLocationInfoServices.getInstance().getLocation().getBearing();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getAccuracy() {
|
||||
if ( MogoLocationInfoServices.getInstance().getLocation() != null ) {
|
||||
return MogoLocationInfoServices.getInstance().getLocation().getAccuracy();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getProvider() {
|
||||
if ( MogoLocationInfoServices.getInstance().getLocation() != null ) {
|
||||
return MogoLocationInfoServices.getInstance().getLocation().getProvider();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getSpeed() {
|
||||
if ( MogoLocationInfoServices.getInstance().getLocation() != null ) {
|
||||
return MogoLocationInfoServices.getInstance().getLocation().getSpeed();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getAltitude() {
|
||||
if ( MogoLocationInfoServices.getInstance().getLocation() != null ) {
|
||||
return MogoLocationInfoServices.getInstance().getLocation().getAltitude();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAdCode() {
|
||||
if ( MogoLocationInfoServices.getInstance().getLocation() != null ) {
|
||||
return MogoLocationInfoServices.getInstance().getLocation().getAdCode();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLocType() {
|
||||
if ( MogoLocationInfoServices.getInstance().getLocation() != null ) {
|
||||
return MogoLocationInfoServices.getInstance().getLocation().getLocType();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getLatitude() {
|
||||
if ( MogoLocationInfoServices.getInstance().getLocation() != null ) {
|
||||
return MogoLocationInfoServices.getInstance().getLocation().getLatitude();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getLongitude() {
|
||||
if ( MogoLocationInfoServices.getInstance().getLocation() != null ) {
|
||||
return MogoLocationInfoServices.getInstance().getLocation().getLongitude();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getTime() {
|
||||
if ( MogoLocationInfoServices.getInstance().getLocation() != null ) {
|
||||
return MogoLocationInfoServices.getInstance().getLocation().getTime();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCityCode() {
|
||||
if ( MogoLocationInfoServices.getInstance().getLocation() != null ) {
|
||||
return MogoLocationInfoServices.getInstance().getLocation().getCityCode();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCityName() {
|
||||
if ( MogoLocationInfoServices.getInstance().getLocation() != null ) {
|
||||
return MogoLocationInfoServices.getInstance().getLocation().getCityName();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getGpsAccuracyStatus() {
|
||||
if ( MogoLocationInfoServices.getInstance().getLocation() != null ) {
|
||||
return MogoLocationInfoServices.getInstance().getLocation().getGpsAccuracyStatus();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSatellites() {
|
||||
if ( MogoLocationInfoServices.getInstance().getLocation() != null ) {
|
||||
return MogoLocationInfoServices.getInstance().getLocation().getSatellite();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCarStatus() {
|
||||
// 常开状态
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
package com.mogo.aicloud.services.passport;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.annotation.Keep;
|
||||
|
||||
import com.mogo.cloud.passport.IMoGoTokenCallback;
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClient;
|
||||
import com.mogo.service.passport.IMogoPassportManager;
|
||||
import com.mogo.service.passport.IMogoTicketCallback;
|
||||
|
||||
public
|
||||
/*
|
||||
* @author congtaowang
|
||||
* @since 2020/7/16
|
||||
*
|
||||
* 描述
|
||||
*/
|
||||
@Keep
|
||||
class PassportManager implements IMogoPassportManager {
|
||||
|
||||
private static volatile PassportManager sInstance;
|
||||
private IMogoTicketCallback mCallBack;
|
||||
|
||||
private PassportManager() {
|
||||
MoGoAiCloudClient.getInstance().addTokenCallbacks(new IMoGoTokenCallback() {
|
||||
@Override
|
||||
public void onTokenGot(String token, String sn) {
|
||||
if (mCallBack != null) {
|
||||
mCallBack.onTicketGot(token);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(int code, String msg) {
|
||||
if (mCallBack != null) {
|
||||
mCallBack.onError(code, msg);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Keep
|
||||
public static PassportManager getInstance() {
|
||||
if (sInstance == null) {
|
||||
synchronized (PassportManager.class) {
|
||||
if (sInstance == null) {
|
||||
sInstance = new PassportManager();
|
||||
}
|
||||
}
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
public synchronized void release() {
|
||||
mCallBack = null;
|
||||
sInstance = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void requestTicket(final IMogoTicketCallback callback) {
|
||||
this.mCallBack = callback;
|
||||
MoGoAiCloudClient.getInstance().refreshToken();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(Context context) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,153 @@
|
||||
package com.mogo.aicloud.services.socket;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.annotation.Keep;
|
||||
|
||||
import com.mogo.cloud.socket.IMogoCloudSocketMsgAckListener;
|
||||
import com.mogo.cloud.socket.IMogoCloudSocketOnMessageListener;
|
||||
import com.mogo.cloud.socket.SocketManager;
|
||||
import com.mogo.service.connection.IMogoMsgAckListener;
|
||||
import com.mogo.service.connection.IMogoOnMessageListener;
|
||||
import com.mogo.service.connection.IMogoSocketManager;
|
||||
import com.mogo.service.connection.MsgBody;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.zhidao.ptech.connsvr.commom.protocol.MogoCommon;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
/**
|
||||
* @author arrow
|
||||
* @since 2021-02-22
|
||||
* <p>
|
||||
* 长链实现:基于 netty
|
||||
*/
|
||||
@Keep
|
||||
public class MogoAiCloudSocketManager implements IMogoSocketManager {
|
||||
|
||||
private static final String TAG = "SocketManager-apk";
|
||||
|
||||
private static volatile MogoAiCloudSocketManager sInstance;
|
||||
private String mAppId;
|
||||
|
||||
private MogoAiCloudSocketManager(Context context) {
|
||||
}
|
||||
|
||||
@Keep
|
||||
public static MogoAiCloudSocketManager getInstance(Context context) {
|
||||
if (sInstance == null) {
|
||||
synchronized (MogoAiCloudSocketManager.class) {
|
||||
if (sInstance == null) {
|
||||
sInstance = new MogoAiCloudSocketManager(context);
|
||||
}
|
||||
}
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
/**
|
||||
* 管理消息分发
|
||||
* <p>
|
||||
* key - msgType
|
||||
*/
|
||||
private final Map<Integer, List<IMogoOnMessageListener>> mListeners = new ConcurrentHashMap<>();
|
||||
|
||||
/**
|
||||
* 管理消息回执
|
||||
* <p>
|
||||
* key - msgId
|
||||
*/
|
||||
private final Map<Long, IMogoMsgAckListener> mAckListeners = new ConcurrentHashMap<>();
|
||||
|
||||
@Override
|
||||
public void init(Context context, String appId) {
|
||||
this.mAppId = appId;
|
||||
SocketManager.getInstance().init(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerOnMessageListener(int msgType, IMogoOnMessageListener listener) {
|
||||
if (mListeners.containsKey(msgType)) {
|
||||
com.mogo.cloud.utils.logger.Logger.w(TAG, "msgType %d is exist.", msgType);
|
||||
return;
|
||||
}
|
||||
if (!mListeners.containsKey(msgType)) {
|
||||
mListeners.put(msgType, new ArrayList<>());
|
||||
}
|
||||
mListeners.get(msgType).add(listener);
|
||||
SocketManager.getInstance().registerOnMessageListener(msgType, mogoCloudSocketOnMessageListener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterOnMessageListener(int msgType) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterOnMessageListener(int msgType, IMogoOnMessageListener listener) {
|
||||
if (listener == null) {
|
||||
return;
|
||||
}
|
||||
if (!mListeners.containsKey(msgType)) {
|
||||
return;
|
||||
}
|
||||
List<IMogoOnMessageListener> listeners = mListeners.get(msgType);
|
||||
if (listeners != null) {
|
||||
listeners.remove(listener);
|
||||
}
|
||||
SocketManager.getInstance().unregisterOnMessageListener(msgType, mogoCloudSocketOnMessageListener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendMsg(MsgBody body, IMogoMsgAckListener listener) {
|
||||
Logger.d(TAG, "sendMsg.");
|
||||
mAckListeners.put(body.getMsgId(), listener);
|
||||
com.mogo.cloud.socket.MsgBody msgBody = new com.mogo.cloud.socket.MsgBody();
|
||||
msgBody.msgType(body.getMsgType());
|
||||
msgBody.ack(body.isAck());
|
||||
msgBody.content(body.getContent());
|
||||
SocketManager.getInstance().sendMsg(mAppId, MogoCommon.Product.mogoBussiness.getNumber(), msgBody, mogoCloudSocketMsgAckListener);
|
||||
}
|
||||
|
||||
public synchronized void release() {
|
||||
SocketManager.getInstance().release();
|
||||
mListeners.clear();
|
||||
sInstance = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(Context context) {
|
||||
|
||||
}
|
||||
|
||||
private final IMogoCloudSocketMsgAckListener mogoCloudSocketMsgAckListener = msgId -> mAckListeners.get(msgId).onAck(msgId);
|
||||
|
||||
private final IMogoCloudSocketOnMessageListener mogoCloudSocketOnMessageListener = new IMogoCloudSocketOnMessageListener() {
|
||||
@Override
|
||||
public Class<Object> target(int msgType) {
|
||||
List<IMogoOnMessageListener> listeners = mListeners.get(msgType);
|
||||
if (listeners != null) {
|
||||
return listeners.get(0).target();
|
||||
} else {
|
||||
return Object.class;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMsgReceived(int msgType, Object obj) {
|
||||
Logger.d(TAG,"onMsgReceived obj className : " + obj.getClass().getName());
|
||||
List<IMogoOnMessageListener> listeners = mListeners.get(msgType);
|
||||
if (listeners != null && !listeners.isEmpty()) {
|
||||
for (IMogoOnMessageListener listener : listeners) {
|
||||
if (listener != null) {
|
||||
Logger.d(TAG, "received msgId = %s, content = %s", mAckListeners.get(msgType), obj);
|
||||
listener.onMsgReceived(obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -8,12 +8,11 @@ import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.map.location.MogoLocation;
|
||||
import com.mogo.service.locationinfo.IMogoLocationInfoService;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.zhidao.locupload.LocEnvironment;
|
||||
import com.zhidao.locupload.LocUploadConfig;
|
||||
import com.zhidao.locupload.LocUploadManager;
|
||||
|
||||
public
|
||||
/**
|
||||
/*
|
||||
* @author congtaowang
|
||||
* @since 2020/7/16
|
||||
*
|
||||
|
||||
@@ -153,6 +153,30 @@ WEBSOCKET_VERSION=1.1.7
|
||||
# loglib
|
||||
LOGLIB_VERSION = 1.0.4
|
||||
|
||||
######## MogoAiCloudSDK Version
|
||||
# 网络请求
|
||||
MOGO_NETWORK_VERSION=1.0.32-SNAPSHOT
|
||||
# 鉴权
|
||||
MOGO_PASSPORT_VERSION=1.0.32-SNAPSHOT
|
||||
# 常链接
|
||||
MOGO_SOCKET_VERSION=1.0.32-SNAPSHOT
|
||||
# 数据采集
|
||||
MOGO_REALTIME_VERSION=1.0.32-SNAPSHOT
|
||||
# 探路,道路事件发布,获取
|
||||
MOGO_TANLU_VERSION=1.0.32-SNAPSHOT
|
||||
# 直播推流
|
||||
MOGO_LIVE_VERSION=1.0.32-SNAPSHOT
|
||||
# 直播拉流
|
||||
MOGO_TRAFFICLIVE_VERSION=1.0.32-SNAPSHOT
|
||||
|
||||
######## Foundation MogoAiCloud Module
|
||||
# mogoAiCloud apk services
|
||||
MOGO_AICLOUD_SERVICES_APK_VERSION=1.0.0-SNAPSHOT
|
||||
# mogoAiCloud sdk services
|
||||
MOGO_AICLOUD_SERVICES_SDK_VERSION=1.0.0-SNAPSHOT
|
||||
|
||||
|
||||
|
||||
## 产品库必备配置,产品库自动对versionCode和versionName版本进行升级
|
||||
applicationId=com.mogo.launcer
|
||||
applicationName=IntelligentPilot
|
||||
|
||||
@@ -33,6 +33,9 @@ dependencies {
|
||||
implementation rootProject.ext.dependencies.androidxconstraintlayout
|
||||
implementation rootProject.ext.dependencies.arouter
|
||||
implementation rootProject.ext.dependencies.callchatprovider
|
||||
|
||||
api rootProject.ext.dependencies.mogoaicloudrealtime
|
||||
|
||||
api "com.mogo.libs:hook:1.0"
|
||||
if (Boolean.valueOf(RELEASE)) {
|
||||
api rootProject.ext.dependencies.mogomap
|
||||
|
||||
@@ -15,9 +15,9 @@ import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.R;
|
||||
import com.mogo.module.common.api.CallChatApi;
|
||||
import com.mogo.module.common.constants.DataTypes;
|
||||
import com.mogo.module.common.entity.CloudLocationInfo;
|
||||
import com.mogo.module.common.entity.CloudRoadData;
|
||||
import com.mogo.module.common.entity.MogoSnapshotSetData;
|
||||
import com.mogo.realtime.entity.CloudLocationInfo;
|
||||
import com.mogo.realtime.entity.CloudRoadData;
|
||||
import com.mogo.realtime.entity.MogoSnapshotSetData;
|
||||
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
|
||||
import com.mogo.service.statusmanager.StatusDescriptor;
|
||||
import com.mogo.utils.ThreadPoolService;
|
||||
@@ -34,7 +34,7 @@ import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
public
|
||||
/**
|
||||
/*
|
||||
* @author congtaowang
|
||||
* @since 2020/10/28
|
||||
*
|
||||
@@ -76,9 +76,9 @@ class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClickListen
|
||||
}
|
||||
|
||||
// 云端 marker 缓存
|
||||
private Map< String, IMogoMarker > mCloudSnapshotMarkersCaches = new ConcurrentHashMap<>();
|
||||
private final Map< String, IMogoMarker > mCloudSnapshotMarkersCaches = new ConcurrentHashMap<>();
|
||||
|
||||
private Map< String, CloudRoadData > mLastPositions = new ConcurrentHashMap<>();
|
||||
private final Map< String, CloudRoadData > mLastPositions = new ConcurrentHashMap<>();
|
||||
|
||||
private boolean mIsVrMode = false;
|
||||
|
||||
@@ -89,9 +89,7 @@ class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClickListen
|
||||
public void onStatusChanged( StatusDescriptor descriptor, boolean isTrue ) {
|
||||
Logger.d( TAG, "%s - %s", descriptor, isTrue );
|
||||
mChangeCarModeStatus = true;
|
||||
ThreadPoolService.execute( () -> {
|
||||
clearOldStyleMarkers();
|
||||
} );
|
||||
ThreadPoolService.execute(this::clearOldStyleMarkers);
|
||||
}
|
||||
|
||||
private void clearOldStyleMarkers() {
|
||||
@@ -118,7 +116,7 @@ class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClickListen
|
||||
/**
|
||||
* 其他车辆、rsu 车辆数据
|
||||
*
|
||||
* @param data
|
||||
* @param data 自车周边数据
|
||||
*/
|
||||
public void renderSnapshotData( MogoSnapshotSetData data,
|
||||
boolean machineVision ) {
|
||||
@@ -237,24 +235,24 @@ class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClickListen
|
||||
/**
|
||||
* vr 模式下显示合并数据,否则只显示上报位置的车辆
|
||||
*
|
||||
* @param dataList
|
||||
* @param data 道路数据集合
|
||||
*/
|
||||
private void filterData( List< CloudRoadData > dataList ) {
|
||||
if ( dataList == null || dataList.isEmpty() ) {
|
||||
private void filterData( List<CloudRoadData> data ) {
|
||||
if ( data == null || data.isEmpty() ) {
|
||||
return;
|
||||
}
|
||||
if ( MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) {
|
||||
return;
|
||||
}
|
||||
List< CloudRoadData > newList = new ArrayList<>();
|
||||
for ( CloudRoadData cloudRoadData : dataList ) {
|
||||
for ( CloudRoadData cloudRoadData : data ) {
|
||||
if ( cloudRoadData.getFromType() != CloudRoadData.FROM_MY_LOCATION ) {
|
||||
continue;
|
||||
}
|
||||
newList.add( cloudRoadData );
|
||||
}
|
||||
dataList.clear();
|
||||
dataList.addAll( newList );
|
||||
data.clear();
|
||||
data.addAll( newList );
|
||||
}
|
||||
|
||||
private void bindClickListener( IMogoMarker marker ) {
|
||||
@@ -267,7 +265,7 @@ class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClickListen
|
||||
/**
|
||||
* 过滤本次数据中,不存在的 marker
|
||||
*
|
||||
* @param data
|
||||
* @param data 道路数据集合
|
||||
*/
|
||||
private void purgeCloudSnapshotData( List< CloudRoadData > data ) {
|
||||
if ( data == null || data.isEmpty() ) {
|
||||
|
||||
@@ -1,250 +0,0 @@
|
||||
package com.mogo.module.common.entity;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 云端道路数据
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public class CloudRoadData implements Parcelable {
|
||||
|
||||
public static final int FROM_MY_LOCATION = 1;
|
||||
public static final int FROM_ADAS = 2;
|
||||
public static final int FROM_ROAD_UNIT = 3;
|
||||
|
||||
/**
|
||||
* 物体类型
|
||||
*/
|
||||
private int type = -1;
|
||||
|
||||
private int fromType;
|
||||
|
||||
private double lat;
|
||||
private double lon;
|
||||
|
||||
private String uuid;
|
||||
private String sn;
|
||||
|
||||
private double speed;
|
||||
private double heading;
|
||||
|
||||
private long systemTime;
|
||||
private long satelliteTime;
|
||||
|
||||
/**
|
||||
* 红绿灯状态 1红 2绿 3黄
|
||||
*/
|
||||
private int lightStatus;//
|
||||
/**
|
||||
* 红绿灯剩余时间 读秒
|
||||
*/
|
||||
private int lightLeftTime;
|
||||
/**
|
||||
* 视频流直播地址
|
||||
*/
|
||||
private String rtmpUrl;//
|
||||
|
||||
private double distance;//距离
|
||||
|
||||
private List< CloudLocationInfo > coordinates;
|
||||
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType( int type ) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public double getLat() {
|
||||
return lat;
|
||||
}
|
||||
|
||||
public void setLat( double lat ) {
|
||||
this.lat = lat;
|
||||
}
|
||||
|
||||
public double getLon() {
|
||||
return lon;
|
||||
}
|
||||
|
||||
public void setLon( double lon ) {
|
||||
this.lon = lon;
|
||||
}
|
||||
|
||||
public double getSpeed() {
|
||||
return speed;
|
||||
}
|
||||
|
||||
public void setSpeed( double speed ) {
|
||||
this.speed = speed;
|
||||
}
|
||||
|
||||
public long getSystemTime() {
|
||||
return systemTime;
|
||||
}
|
||||
|
||||
public void setSystemTime( long systemTime ) {
|
||||
this.systemTime = systemTime;
|
||||
}
|
||||
|
||||
public int getLightStatus() {
|
||||
return lightStatus;
|
||||
}
|
||||
|
||||
public void setLightStatus( int lightStatus ) {
|
||||
this.lightStatus = lightStatus;
|
||||
}
|
||||
|
||||
public int getLightLeftTime() {
|
||||
return lightLeftTime;
|
||||
}
|
||||
|
||||
public void setLightLeftTime( int lightLeftTime ) {
|
||||
this.lightLeftTime = lightLeftTime;
|
||||
}
|
||||
|
||||
public String getRtmpUrl() {
|
||||
return rtmpUrl;
|
||||
}
|
||||
|
||||
public void setRtmpUrl( String rtmpUrl ) {
|
||||
this.rtmpUrl = rtmpUrl;
|
||||
}
|
||||
|
||||
public double getDistance() {
|
||||
return distance * 1000;
|
||||
}
|
||||
|
||||
public void setDistance( double distance ) {
|
||||
this.distance = distance;
|
||||
}
|
||||
|
||||
public List< CloudLocationInfo > getCoordinates() {
|
||||
return coordinates;
|
||||
}
|
||||
|
||||
public void setCoordinates( List< CloudLocationInfo > coordinates ) {
|
||||
this.coordinates = coordinates;
|
||||
}
|
||||
|
||||
public void setUuid( String uuid ) {
|
||||
this.uuid = uuid;
|
||||
}
|
||||
|
||||
public String getUuid() {
|
||||
return uuid;
|
||||
}
|
||||
|
||||
public String getSn() {
|
||||
return sn;
|
||||
}
|
||||
|
||||
public double getHeading() {
|
||||
return heading;
|
||||
}
|
||||
|
||||
public void setHeading( double heading ) {
|
||||
this.heading = heading;
|
||||
}
|
||||
|
||||
public long getSatelliteTime() {
|
||||
return satelliteTime;
|
||||
}
|
||||
|
||||
public void setSatelliteTime( long satelliteTime ) {
|
||||
this.satelliteTime = satelliteTime;
|
||||
}
|
||||
|
||||
public String getUniqueKey() {
|
||||
if ( !TextUtils.isEmpty( uuid ) ) {
|
||||
return uuid;
|
||||
}
|
||||
return sn;
|
||||
}
|
||||
|
||||
public int getFromType() {
|
||||
return fromType;
|
||||
}
|
||||
|
||||
public void setFromType( int fromType ) {
|
||||
this.fromType = fromType;
|
||||
}
|
||||
|
||||
public CloudRoadData() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals( Object o ) {
|
||||
if ( this == o ) {
|
||||
return true;
|
||||
}
|
||||
if ( o == null || getClass() != o.getClass() ) {
|
||||
return false;
|
||||
}
|
||||
CloudRoadData that = ( CloudRoadData ) o;
|
||||
return Double.compare( that.lat, lat ) == 0 &&
|
||||
Double.compare( that.lon, lon ) == 0;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel( Parcel dest, int flags ) {
|
||||
dest.writeInt( this.type );
|
||||
dest.writeInt( this.fromType );
|
||||
dest.writeDouble( this.lat );
|
||||
dest.writeDouble( this.lon );
|
||||
dest.writeString( this.uuid );
|
||||
dest.writeString( this.sn );
|
||||
dest.writeDouble( this.speed );
|
||||
dest.writeDouble( this.heading );
|
||||
dest.writeLong( this.systemTime );
|
||||
dest.writeLong( this.satelliteTime );
|
||||
dest.writeInt( this.lightStatus );
|
||||
dest.writeInt( this.lightLeftTime );
|
||||
dest.writeString( this.rtmpUrl );
|
||||
dest.writeDouble( this.distance );
|
||||
dest.writeTypedList( this.coordinates );
|
||||
}
|
||||
|
||||
protected CloudRoadData( Parcel in ) {
|
||||
this.type = in.readInt();
|
||||
this.fromType = in.readInt();
|
||||
this.lat = in.readDouble();
|
||||
this.lon = in.readDouble();
|
||||
this.uuid = in.readString();
|
||||
this.sn = in.readString();
|
||||
this.speed = in.readDouble();
|
||||
this.heading = in.readDouble();
|
||||
this.systemTime = in.readLong();
|
||||
this.satelliteTime = in.readLong();
|
||||
this.lightStatus = in.readInt();
|
||||
this.lightLeftTime = in.readInt();
|
||||
this.rtmpUrl = in.readString();
|
||||
this.distance = in.readDouble();
|
||||
this.coordinates = in.createTypedArrayList( CloudLocationInfo.CREATOR );
|
||||
}
|
||||
|
||||
public static final Creator< CloudRoadData > CREATOR = new Creator< CloudRoadData >() {
|
||||
@Override
|
||||
public CloudRoadData createFromParcel( Parcel source ) {
|
||||
return new CloudRoadData( source );
|
||||
}
|
||||
|
||||
@Override
|
||||
public CloudRoadData[] newArray( int size ) {
|
||||
return new CloudRoadData[size];
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -1,151 +0,0 @@
|
||||
package com.mogo.module.common.entity;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/10/26
|
||||
*
|
||||
* 描述
|
||||
*/
|
||||
class MogoSnapshotSetData implements Parcelable {
|
||||
|
||||
private String msgId;
|
||||
|
||||
private long time;
|
||||
|
||||
//过期时间
|
||||
private long expire;
|
||||
|
||||
//总数据集合
|
||||
private List<CloudRoadData> allList;
|
||||
|
||||
// 近景adas数据
|
||||
private List<CloudRoadData> nearList;
|
||||
|
||||
//红绿灯
|
||||
private CloudRoadData trafficLight;
|
||||
|
||||
//路边摄像头
|
||||
private CloudRoadData camera;
|
||||
|
||||
// 自车速度 本地添加
|
||||
public double curSpeed = 0.0;
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MogoSnapshotSetData{" +
|
||||
"msgId='" + msgId + '\'' +
|
||||
", time=" + time +
|
||||
", expire=" + expire +
|
||||
", allList=" + allList +
|
||||
", nearList=" + nearList +
|
||||
", camera=" + camera +
|
||||
", curSpeed=" + curSpeed +
|
||||
'}';
|
||||
}
|
||||
|
||||
public String getMsgId() {
|
||||
return msgId;
|
||||
}
|
||||
|
||||
public void setMsgId(String msgId) {
|
||||
this.msgId = msgId;
|
||||
}
|
||||
|
||||
public long getTime() {
|
||||
return time;
|
||||
}
|
||||
|
||||
public void setTime(long time) {
|
||||
this.time = time;
|
||||
}
|
||||
|
||||
public long getExpire() {
|
||||
return expire;
|
||||
}
|
||||
|
||||
public void setExpire(long expire) {
|
||||
this.expire = expire;
|
||||
}
|
||||
|
||||
public List<CloudRoadData> getAllList() {
|
||||
return allList;
|
||||
}
|
||||
|
||||
public void setAllList(List<CloudRoadData> allList) {
|
||||
this.allList = allList;
|
||||
}
|
||||
|
||||
public CloudRoadData getTrafficLight() {
|
||||
return trafficLight;
|
||||
}
|
||||
|
||||
public void setTrafficLight(CloudRoadData trafficLight) {
|
||||
this.trafficLight = trafficLight;
|
||||
}
|
||||
|
||||
public CloudRoadData getCamera() {
|
||||
return camera;
|
||||
}
|
||||
|
||||
public void setCamera(CloudRoadData camera) {
|
||||
this.camera = camera;
|
||||
}
|
||||
|
||||
public List< CloudRoadData > getNearList() {
|
||||
return nearList;
|
||||
}
|
||||
|
||||
public void setNearList( List< CloudRoadData > nearList ) {
|
||||
this.nearList = nearList;
|
||||
}
|
||||
|
||||
public MogoSnapshotSetData() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel( Parcel dest, int flags ) {
|
||||
dest.writeString( this.msgId );
|
||||
dest.writeLong( this.time );
|
||||
dest.writeLong( this.expire );
|
||||
dest.writeTypedList( this.allList );
|
||||
dest.writeTypedList( this.nearList );
|
||||
dest.writeParcelable( this.trafficLight, flags );
|
||||
dest.writeParcelable( this.camera, flags );
|
||||
dest.writeDouble( this.curSpeed );
|
||||
}
|
||||
|
||||
protected MogoSnapshotSetData( Parcel in ) {
|
||||
this.msgId = in.readString();
|
||||
this.time = in.readLong();
|
||||
this.expire = in.readLong();
|
||||
this.allList = in.createTypedArrayList( CloudRoadData.CREATOR );
|
||||
this.nearList = in.createTypedArrayList( CloudRoadData.CREATOR );
|
||||
this.trafficLight = in.readParcelable( CloudRoadData.class.getClassLoader() );
|
||||
this.camera = in.readParcelable( CloudRoadData.class.getClassLoader() );
|
||||
this.curSpeed = in.readDouble();
|
||||
}
|
||||
|
||||
public static final Creator< MogoSnapshotSetData > CREATOR = new Creator< MogoSnapshotSetData >() {
|
||||
@Override
|
||||
public MogoSnapshotSetData createFromParcel( Parcel source ) {
|
||||
return new MogoSnapshotSetData( source );
|
||||
}
|
||||
|
||||
@Override
|
||||
public MogoSnapshotSetData[] newArray( int size ) {
|
||||
return new MogoSnapshotSetData[size];
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -8,9 +8,9 @@ import androidx.annotation.Nullable;
|
||||
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.entity.CloudRoadData;
|
||||
import com.mogo.module.extensions.R;
|
||||
import com.mogo.module.extensions.live.impl.AbsCameraScenario;
|
||||
import com.mogo.realtime.entity.CloudRoadData;
|
||||
import com.mogo.service.windowview.IMogoTopViewStatusListener;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
|
||||
@@ -10,10 +10,9 @@ import android.widget.ImageView;
|
||||
import android.widget.RelativeLayout;
|
||||
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.entity.CloudRoadData;
|
||||
import com.mogo.module.extensions.R;
|
||||
import com.mogo.module.extensions.live.listener.CameraLiveWindowStatusListener;
|
||||
import com.mogo.module.extensions.live.impl.ICameraWindow;
|
||||
import com.mogo.realtime.entity.CloudRoadData;
|
||||
import com.mogo.service.imageloader.MogoImageView;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
@@ -24,13 +23,12 @@ import com.mogo.utils.logger.Logger;
|
||||
*/
|
||||
public class PushCameraLiveWindow extends RelativeLayout implements ICameraWindow<CloudRoadData> {
|
||||
private static final String TAG = "PushCameraLiveWindow";
|
||||
private Context mContext;
|
||||
private CameraLiveGSYVideoView mLiveGSYVideoView;
|
||||
private MogoImageView mIvReportHead;
|
||||
private ImageView pushVideoClose;
|
||||
|
||||
// 直播30秒自动关闭
|
||||
private static Handler handlerV2XEvent = new Handler();
|
||||
private static final Handler handlerV2XEvent = new Handler();
|
||||
private static Runnable runnableV2XEvent;
|
||||
|
||||
public PushCameraLiveWindow() {
|
||||
@@ -47,7 +45,6 @@ public class PushCameraLiveWindow extends RelativeLayout implements ICameraWindo
|
||||
|
||||
public PushCameraLiveWindow(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
mContext = context;
|
||||
initView(context);
|
||||
}
|
||||
|
||||
@@ -91,11 +88,10 @@ public class PushCameraLiveWindow extends RelativeLayout implements ICameraWindo
|
||||
@Override
|
||||
public void close() {
|
||||
// 停止倒计时
|
||||
if (handlerV2XEvent != null && runnableV2XEvent != null) {
|
||||
if (runnableV2XEvent != null) {
|
||||
handlerV2XEvent.removeCallbacks(runnableV2XEvent);
|
||||
runnableV2XEvent = null;
|
||||
}
|
||||
|
||||
//移除窗体
|
||||
MogoApisHandler.getInstance().getApis().getTopViewManager().removeViewNoLinkage(this);
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ package com.mogo.module.extensions.live.impl;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.mogo.module.common.entity.CloudRoadData;
|
||||
import com.mogo.realtime.entity.CloudRoadData;
|
||||
|
||||
|
||||
public abstract class AbsCameraScenario<T> implements ICameraScenario {
|
||||
|
||||
@@ -6,19 +6,17 @@ import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.view.View;
|
||||
|
||||
import com.mogo.map.location.IMogoLocationListener;
|
||||
import com.mogo.map.location.MogoLocation;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.entity.CloudRoadData;
|
||||
import com.mogo.module.common.entity.MogoSnapshotSetData;
|
||||
import com.mogo.module.extensions.navi.VrModeNavInfoView;
|
||||
import com.mogo.realtime.api.MoGoAiCloudRealTime;
|
||||
import com.mogo.realtime.entity.MogoSnapshotSetData;
|
||||
import com.mogo.realtime.socket.IMogoCloudOnMsgListener;
|
||||
import com.mogo.service.adas.IMogoAdasWarnMessageCallback;
|
||||
import com.mogo.service.adas.MogoADASWarnType;
|
||||
import com.mogo.service.adas.entity.ADASWarnMessage;
|
||||
import com.mogo.service.connection.IMogoOnWebSocketMessageListener;
|
||||
import com.mogo.service.connection.WebSocketMsgType;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import org.json.JSONArray;
|
||||
@@ -30,7 +28,7 @@ import org.json.JSONObject;
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public class AdasNoticeHelper implements IMogoAdasWarnMessageCallback, IMogoLocationListener,
|
||||
Handler.Callback, IMogoOnWebSocketMessageListener<MogoSnapshotSetData> {
|
||||
Handler.Callback, IMogoCloudOnMsgListener {
|
||||
private static final String TAG = "AdasNoticeHelper";
|
||||
|
||||
private static final int MSG_HIDE_TRAFFIC_LIGHT_BY_OBU = 1001;
|
||||
@@ -77,8 +75,7 @@ public class AdasNoticeHelper implements IMogoAdasWarnMessageCallback, IMogoLoca
|
||||
MogoApisHandler.getInstance().getApis().getAdasControllerApi().addAdasWarnMessageCallback(this);
|
||||
MogoApisHandler.getInstance().getApis().getRegisterCenterApi().registerMogoLocationListener(TAG, this);
|
||||
// 先不监听服务端下发消息
|
||||
// MogoApisHandler.getInstance().getApis().getWebSocketManagerApi(context).registerOnWebSocketMessageListener(this);
|
||||
|
||||
// MoGoAiCloudRealTime.registerOnMsgListener(this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -89,7 +86,8 @@ public class AdasNoticeHelper implements IMogoAdasWarnMessageCallback, IMogoLoca
|
||||
MogoApisHandler.getInstance().getApis().getAdasControllerApi().showADAS();
|
||||
MogoApisHandler.getInstance().getApis().getAdasControllerApi().removeAdasWarnMessageCallback(this);
|
||||
MogoApisHandler.getInstance().getApis().getRegisterCenterApi().unregisterMogoLocationListener(TAG);
|
||||
// MogoApisHandler.getInstance().getApis().getWebSocketManagerApi(context).unregisterOnWebSocketMessageListener(this);
|
||||
// 先不监听服务端下发消息
|
||||
// MoGoAiCloudRealTime.unRegisterOnMsgListener(this);
|
||||
context.unregisterReceiver(adasReceiver);
|
||||
}
|
||||
}
|
||||
@@ -200,13 +198,8 @@ public class AdasNoticeHelper implements IMogoAdasWarnMessageCallback, IMogoLoca
|
||||
}
|
||||
|
||||
@Override
|
||||
public WebSocketMsgType getDownLinkType() {
|
||||
return WebSocketMsgType.MSG_TYPE_DOWNLINK_CAR_DATA;
|
||||
}
|
||||
public void onMsgSend(long id) {
|
||||
|
||||
@Override
|
||||
public Class<MogoSnapshotSetData> target() {
|
||||
return MogoSnapshotSetData.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -8,17 +8,16 @@ import android.util.Log;
|
||||
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.marker.IMogoMarkerClickListener;
|
||||
import com.mogo.map.marker.MogoMarkerOptions;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.entity.CloudRoadData;
|
||||
import com.mogo.module.common.entity.MogoSnapshotSetData;
|
||||
import com.mogo.module.extensions.R;
|
||||
import com.mogo.module.extensions.live.CameraLiveManager;
|
||||
import com.mogo.module.extensions.live.CameraWindow3DAdapter;
|
||||
import com.mogo.module.extensions.live.PushDataType;
|
||||
import com.mogo.service.connection.IMogoOnWebSocketMessageListener;
|
||||
import com.mogo.service.connection.WebSocketMsgType;
|
||||
import com.mogo.realtime.api.MoGoAiCloudRealTime;
|
||||
import com.mogo.realtime.entity.CloudRoadData;
|
||||
import com.mogo.realtime.entity.MogoSnapshotSetData;
|
||||
import com.mogo.realtime.socket.IMogoCloudOnMsgListener;
|
||||
import com.mogo.utils.TipToast;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
@@ -26,7 +25,7 @@ import com.mogo.utils.logger.Logger;
|
||||
/**
|
||||
* vr模式下,摄像头消息 AdasNoticeHelper
|
||||
*/
|
||||
public class CameraLiveNoticeHelper implements IMogoOnWebSocketMessageListener<MogoSnapshotSetData> {
|
||||
public class CameraLiveNoticeHelper implements IMogoCloudOnMsgListener {
|
||||
private static final String TAG = "CameraLiveNoticeHelper";
|
||||
private Context mContext;
|
||||
private static IMogoMarker mMogoMarker;
|
||||
@@ -40,28 +39,25 @@ public class CameraLiveNoticeHelper implements IMogoOnWebSocketMessageListener<M
|
||||
Logger.d(TAG, "init ======= ");
|
||||
mContext = context;
|
||||
|
||||
MogoApisHandler.getInstance().getApis().getWebSocketManagerApi(mContext).registerOnWebSocketMessageListener(this);
|
||||
MogoApisHandler.getInstance().getApis().getRegisterCenterApi().registerMogoMarkerClickListener(PushDataType.TYPE_PUSH_CAMERA_DATA, new IMogoMarkerClickListener() {
|
||||
@Override
|
||||
public boolean onMarkerClicked(IMogoMarker marker) {
|
||||
//点击的marker的具体数据
|
||||
if (mCloudRoadData != null && !TextUtils.isEmpty(mCloudRoadData.getRtmpUrl())) {
|
||||
CameraLiveManager.getInstance().init(mCloudRoadData);
|
||||
} else {
|
||||
Logger.e(TAG, " onMarkerClicked mCloudRoadData == null ");
|
||||
TipToast.shortTip("直播流地址为空");
|
||||
}
|
||||
|
||||
return false;
|
||||
MoGoAiCloudRealTime.registerOnMsgListener(this);
|
||||
MogoApisHandler.getInstance().getApis().getRegisterCenterApi().registerMogoMarkerClickListener(PushDataType.TYPE_PUSH_CAMERA_DATA, marker -> {
|
||||
//点击的marker的具体数据
|
||||
if (mCloudRoadData != null && !TextUtils.isEmpty(mCloudRoadData.getRtmpUrl())) {
|
||||
CameraLiveManager.getInstance().init(mCloudRoadData);
|
||||
} else {
|
||||
Logger.e(TAG, " onMarkerClicked mCloudRoadData == null ");
|
||||
TipToast.shortTip("直播流地址为空");
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
// loadMarker(false);
|
||||
}
|
||||
|
||||
public void release() {
|
||||
MogoApisHandler.getInstance().getApis().getWebSocketManagerApi(mContext).unregisterOnWebSocketMessageListener(this);
|
||||
MogoApisHandler.getInstance().getApis().getRegisterCenterApi().unregisterMogoMarkerClickListener( PushDataType.TYPE_PUSH_CAMERA_DATA );
|
||||
MoGoAiCloudRealTime.unRegisterOnMsgListener(this);
|
||||
MogoApisHandler.getInstance().getApis().getRegisterCenterApi().unregisterMogoMarkerClickListener(PushDataType.TYPE_PUSH_CAMERA_DATA);
|
||||
mCloudRoadData = null;
|
||||
mContext = null;
|
||||
}
|
||||
@@ -69,37 +65,18 @@ public class CameraLiveNoticeHelper implements IMogoOnWebSocketMessageListener<M
|
||||
public void enterVrMode() {
|
||||
Logger.d(TAG, "进入vr模式=========");
|
||||
isVrMode = true;
|
||||
|
||||
// loadMarker(true);
|
||||
}
|
||||
|
||||
public void exitVrMode() {
|
||||
Logger.d(TAG, "退出vr模式=========");
|
||||
isVrMode = false;
|
||||
|
||||
// loadMarker(false);
|
||||
}
|
||||
|
||||
//test
|
||||
private void loadMarker(boolean isVrMode) {
|
||||
mCloudRoadData = new CloudRoadData();
|
||||
mCloudRoadData.setRtmpUrl("rtmp://58.200.131.2:1935/livetv/hunantv");
|
||||
|
||||
mCloudRoadData.setLat(40.200583);
|
||||
mCloudRoadData.setLon(116.738538);
|
||||
mCloudRoadData.setUuid("10011");
|
||||
if (isVrMode) {
|
||||
addVrCameraMarker(mCloudRoadData);
|
||||
} else {
|
||||
addNormalCameraMarker(mCloudRoadData);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* PushRoadConditionDrawer
|
||||
* vr模式
|
||||
*
|
||||
* @param roadData
|
||||
* @param roadData 道路数据
|
||||
*/
|
||||
private void addVrCameraMarker(CloudRoadData roadData) {
|
||||
Log.e(TAG, "addVrCameraMarker --lat = " + roadData.getLat() + "--lon =" + roadData.getLon() + "--uuid = " + roadData.getUuid() + "---rtmpUrl =" + roadData.getRtmpUrl());
|
||||
@@ -126,7 +103,7 @@ public class CameraLiveNoticeHelper implements IMogoOnWebSocketMessageListener<M
|
||||
/**
|
||||
* 普通模式
|
||||
*
|
||||
* @param roadData
|
||||
* @param roadData 道路数据
|
||||
*/
|
||||
private void addNormalCameraMarker(CloudRoadData roadData) {
|
||||
Log.e(TAG, "addNormalCameraMarker --lat = " + roadData.getLat() + " --lon =" + roadData.getLon() + "--uuid = " + roadData.getUuid() + "---rtmpUrl =" + roadData.getRtmpUrl());
|
||||
@@ -157,22 +134,7 @@ public class CameraLiveNoticeHelper implements IMogoOnWebSocketMessageListener<M
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public WebSocketMsgType getDownLinkType() {
|
||||
return WebSocketMsgType.MSG_TYPE_DOWNLINK_CAR_DATA;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<MogoSnapshotSetData> target() {
|
||||
return MogoSnapshotSetData.class;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param obj
|
||||
*/
|
||||
@Override
|
||||
public void onMsgReceived(MogoSnapshotSetData obj) {
|
||||
Logger.d(TAG, "onMsgReceived cameralive : " + obj);
|
||||
private void renderMarker(MogoSnapshotSetData obj) {
|
||||
if (obj != null) {
|
||||
if (obj.getCamera() != null && !TextUtils.isEmpty(obj.getCamera().getRtmpUrl())) {
|
||||
mCloudRoadData = obj.getCamera();
|
||||
@@ -209,7 +171,7 @@ public class CameraLiveNoticeHelper implements IMogoOnWebSocketMessageListener<M
|
||||
if (obj.getCamera() != null) {
|
||||
Log.e(TAG, "onMsgReceived RtmpUrl() = " + obj.getCamera().getRtmpUrl());
|
||||
} else {
|
||||
Log.e(TAG,"obj.getCamera() == null ----------- ");
|
||||
Log.e(TAG, "obj.getCamera() == null ----------- ");
|
||||
}
|
||||
removeCameraMarker();
|
||||
}
|
||||
@@ -218,4 +180,14 @@ public class CameraLiveNoticeHelper implements IMogoOnWebSocketMessageListener<M
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMsgSend(long id) {
|
||||
Logger.d(TAG, "onMsgSend id : " + id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMsgReceived(MogoSnapshotSetData mogoSnapshotSetData) {
|
||||
Logger.d(TAG, "onMsgReceived mogoSnapshotSetData : " + mogoSnapshotSetData);
|
||||
renderMarker(mogoSnapshotSetData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@ import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.os.Message;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.MotionEvent;
|
||||
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
@@ -49,6 +48,7 @@ import com.mogo.module.service.refresh.RefreshObject;
|
||||
import com.mogo.module.service.strategy.CarIconDisplayStrategy;
|
||||
import com.mogo.module.service.ttsConfig.TtsConfigModleData;
|
||||
import com.mogo.module.service.uploadintime.SnapshotUploadInTime;
|
||||
import com.mogo.realtime.api.MoGoAiCloudRealTime;
|
||||
import com.mogo.service.adas.IMogoADASController;
|
||||
import com.mogo.service.adas.IMogoAdasCarDataCallback;
|
||||
import com.mogo.service.adas.entity.ADASCarStateInfo;
|
||||
@@ -67,7 +67,6 @@ import com.mogo.utils.NetworkUtils;
|
||||
import com.mogo.utils.WorkThreadHandler;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.util.List;
|
||||
@@ -394,7 +393,7 @@ public class MogoServices implements IMogoMapListener,
|
||||
mContext.sendBroadcast( intent );
|
||||
|
||||
if ( DebugConfig.isNeedUploadCoordinatesDurationInTime() ) {
|
||||
SnapshotUploadInTime.getInstance().start( mContext );
|
||||
MoGoAiCloudRealTime.startRealTime( mContext, DebugConfig.getSocketAppId() );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -929,6 +928,7 @@ public class MogoServices implements IMogoMapListener,
|
||||
@Override
|
||||
public void destroy() {
|
||||
Logger.d( TAG, "MogoServices do nothings." );
|
||||
MoGoAiCloudRealTime.stopRealTime();
|
||||
}
|
||||
|
||||
public Location getLastCarLocation() {
|
||||
|
||||
@@ -27,7 +27,6 @@ import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.dialog.WMDialog;
|
||||
import com.mogo.module.service.MarkerServiceHandler;
|
||||
import com.mogo.module.service.R;
|
||||
import com.mogo.module.service.uploadintime.SnapshotUploadInTime;
|
||||
import com.mogo.service.adas.RemoteControlAutoPilotParameters;
|
||||
import com.mogo.service.adas.entity.ADASCarStateInfo;
|
||||
import com.mogo.service.entrance.ButtonIndex;
|
||||
|
||||
@@ -13,7 +13,6 @@ import com.mogo.map.marker.IMogoMarkerClickListener;
|
||||
import com.mogo.map.marker.IMogoMarkerManager;
|
||||
import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.module.common.ModuleNames;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.api.CallChatApi;
|
||||
import com.mogo.module.common.drawer.AdasRecognizedResultDrawer;
|
||||
import com.mogo.module.common.drawer.MarkerDrawer;
|
||||
@@ -29,26 +28,24 @@ import com.mogo.module.common.entity.MarkerOnlineCar;
|
||||
import com.mogo.module.common.entity.MarkerResponse;
|
||||
import com.mogo.module.common.entity.MarkerShowEntity;
|
||||
import com.mogo.module.common.utils.CloudPoiManager;
|
||||
import com.mogo.module.common.entity.MogoSnapshotSetData;
|
||||
import com.mogo.module.service.MarkerServiceHandler;
|
||||
import com.mogo.module.service.MogoServices;
|
||||
import com.mogo.module.service.R;
|
||||
import com.mogo.module.service.ServiceConst;
|
||||
import com.mogo.module.service.network.RefreshCallback;
|
||||
import com.mogo.module.service.network.RefreshModel;
|
||||
import com.mogo.module.service.vrmode.VrModeController;
|
||||
import com.mogo.realtime.api.MoGoAiCloudRealTime;
|
||||
import com.mogo.realtime.entity.MogoSnapshotSetData;
|
||||
import com.mogo.realtime.socket.IMogoCloudOnMsgListener;
|
||||
import com.mogo.service.adas.IMogoADASControlStatusChangedListener;
|
||||
import com.mogo.service.connection.IMogoOnMessageListener;
|
||||
import com.mogo.service.connection.IMogoOnWebSocketMessageListener;
|
||||
import com.mogo.service.connection.WebSocketMsgType;
|
||||
import com.mogo.service.module.IMogoBizActionDoneListener;
|
||||
import com.mogo.utils.ResourcesHelper;
|
||||
import com.mogo.utils.ThreadPoolService;
|
||||
import com.mogo.utils.UiThreadHandler;
|
||||
import com.mogo.utils.ViewUtils;
|
||||
import com.mogo.utils.WorkThreadHandler;
|
||||
import com.zhidao.carchattingprovider.ICallChatResponse;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.zhidao.carchattingprovider.ICallChatResponse;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
@@ -67,7 +64,7 @@ import java.util.Map;
|
||||
* version: 1.0
|
||||
*/
|
||||
public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
IMogoOnMessageListener< MarkerResponse >,
|
||||
IMogoOnMessageListener<MarkerResponse>,
|
||||
IMogoBizActionDoneListener,
|
||||
IMogoADASControlStatusChangedListener {
|
||||
private static final String TAG = "MapMarkerManager";
|
||||
@@ -91,8 +88,8 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
}
|
||||
|
||||
public static synchronized MapMarkerManager getInstance() {
|
||||
synchronized ( MapMarkerManager.class ) {
|
||||
if ( mMarkerManager == null ) {
|
||||
synchronized (MapMarkerManager.class) {
|
||||
if (mMarkerManager == null) {
|
||||
mMarkerManager = new MapMarkerManager();
|
||||
}
|
||||
}
|
||||
@@ -103,86 +100,61 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
/**
|
||||
* 初始化大而全的 Marker 管理
|
||||
*
|
||||
* @param context
|
||||
* @param context 上下文对象
|
||||
*/
|
||||
public void init( Context context ) {
|
||||
public void init(Context context) {
|
||||
|
||||
if ( mContext != null ) {
|
||||
if (mContext != null) {
|
||||
return;
|
||||
}
|
||||
|
||||
mContext = context.getApplicationContext();
|
||||
mRefreshModel = new RefreshModel( mContext );
|
||||
CloudPoiManager.getInstance().updateFromConfig( context );
|
||||
MarkerServiceHandler.getActionManager().registerBizActionDoneListener( this );
|
||||
MarkerServiceHandler.getApis().getRegisterCenterApi().registerADASControlStatusChangedListener( TAG, this );
|
||||
mRefreshModel = new RefreshModel(mContext);
|
||||
CloudPoiManager.getInstance().updateFromConfig(context);
|
||||
MarkerServiceHandler.getActionManager().registerBizActionDoneListener(this);
|
||||
MarkerServiceHandler.getApis().getRegisterCenterApi().registerADASControlStatusChangedListener(TAG, this);
|
||||
|
||||
if ( CallChatApi.getInstance().getApiProvider() != null ) {
|
||||
CallChatApi.getInstance().getApiProvider().registerUserWindowStatusListener( TAG, mContext, new ICallChatResponse() {
|
||||
if (CallChatApi.getInstance().getApiProvider() != null) {
|
||||
CallChatApi.getInstance().getApiProvider().registerUserWindowStatusListener(TAG, mContext, new ICallChatResponse() {
|
||||
|
||||
@Override
|
||||
public void userWindowStatus( boolean show ) {
|
||||
public void userWindowStatus(boolean show) {
|
||||
try {
|
||||
if ( mLastCheckMarker == null ) {
|
||||
if (mLastCheckMarker == null) {
|
||||
return;
|
||||
}
|
||||
if ( TextUtils.equals( mLastCheckMarker.getOwner(), ModuleNames.CARD_TYPE_USER_DATA )
|
||||
&& !show ) {
|
||||
closeMarker( mLastCheckMarker );
|
||||
if (TextUtils.equals(mLastCheckMarker.getOwner(), ModuleNames.CARD_TYPE_USER_DATA)
|
||||
&& !show) {
|
||||
closeMarker(mLastCheckMarker);
|
||||
}
|
||||
} catch ( Exception e ) {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
} );
|
||||
});
|
||||
|
||||
// 每隔一秒下发的数据
|
||||
MarkerServiceHandler.getApis().getWebSocketManagerApi( mContext )
|
||||
.registerOnWebSocketMessageListener( new IMogoOnWebSocketMessageListener< MogoSnapshotSetData >() {
|
||||
MoGoAiCloudRealTime.registerOnMsgListener(new IMogoCloudOnMsgListener() {
|
||||
@Override
|
||||
public void onMsgSend(long id) {
|
||||
|
||||
@Override
|
||||
public WebSocketMsgType getUpLinkType() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public WebSocketMsgType getDownLinkType() {
|
||||
return WebSocketMsgType.MSG_TYPE_DOWNLINK_CAR_DATA;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class< MogoSnapshotSetData > target() {
|
||||
return MogoSnapshotSetData.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMsgReceived( MogoSnapshotSetData data ) {
|
||||
// if ( !MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) {
|
||||
//// return;
|
||||
// }
|
||||
//
|
||||
// if ( MogoServices.getInstance().getLastCarLocation() != null ) {
|
||||
// data.curSpeed = MogoServices.getInstance().getLastCarLocation().getSpeed();
|
||||
// }
|
||||
SnapshotSetDataDrawer.getInstance().renderSnapshotData( data, false );
|
||||
// VrModeController.getInstance().renderMogoSnapshotSetData( data );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError( String errorMsg ) {
|
||||
|
||||
}
|
||||
} );
|
||||
@Override
|
||||
public void onMsgReceived(MogoSnapshotSetData mogoSnapshotSetData) {
|
||||
SnapshotSetDataDrawer.getInstance().renderSnapshotData(mogoSnapshotSetData, false);
|
||||
}
|
||||
});
|
||||
// adas 每隔一秒传递的数据
|
||||
MarkerServiceHandler.getApis().getAdasControllerApi().addAdasRecognizedDataCallback( resultList -> {
|
||||
MarkerServiceHandler.getApis().getAdasControllerApi().addAdasRecognizedDataCallback(resultList -> {
|
||||
double speed = 0.0;
|
||||
if ( MogoServices.getInstance().getLastCarLocation() != null ) {
|
||||
if (MogoServices.getInstance().getLastCarLocation() != null) {
|
||||
speed = MogoServices.getInstance().getLastCarLocation().getSpeed();
|
||||
}
|
||||
// 绘制近景识别到的车辆,每秒绘制一次
|
||||
AdasRecognizedResultDrawer.getInstance().renderAdasRecognizedResult( resultList, false, speed );
|
||||
} );
|
||||
AdasRecognizedResultDrawer.getInstance().renderAdasRecognizedResult(resultList, false, speed);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -190,32 +162,32 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
* 地图上的Marker点击回调
|
||||
*/
|
||||
@Override
|
||||
public boolean onMarkerClicked( IMogoMarker marker ) {
|
||||
public boolean onMarkerClicked(IMogoMarker marker) {
|
||||
try {
|
||||
boolean result = switchMarkerOpenStatus( marker );
|
||||
if ( !result ) {
|
||||
updateCarUserInfoWindow( marker );
|
||||
boolean result = switchMarkerOpenStatus(marker);
|
||||
if (!result) {
|
||||
updateCarUserInfoWindow(marker);
|
||||
return false;
|
||||
}
|
||||
|
||||
Map< String, Object > properties = new HashMap<>();
|
||||
Map<String, Object> properties = new HashMap<>();
|
||||
|
||||
if ( marker.getObject() instanceof MarkerShowEntity ) {
|
||||
final String sn = MarkerDrawer.getInstance().getCarSnFromMarker( marker );
|
||||
if ( TextUtils.isEmpty( sn ) ) {
|
||||
if (marker.getObject() instanceof MarkerShowEntity) {
|
||||
final String sn = MarkerDrawer.getInstance().getCarSnFromMarker(marker);
|
||||
if (TextUtils.isEmpty(sn)) {
|
||||
return false;
|
||||
}
|
||||
properties.put( "sn", sn );
|
||||
if ( ( ( MarkerShowEntity ) marker.getObject() ).getBindObj() instanceof MarkerExploreWay ) {
|
||||
MarkerExploreWay exploreWay = ( MarkerExploreWay ) ( ( MarkerShowEntity ) marker.getObject() ).getBindObj();
|
||||
properties.put( "dbid", exploreWay.getInfoId() );
|
||||
properties.put( "type", exploreWay.getPoiType() );
|
||||
} else if ( ( ( MarkerShowEntity ) marker.getObject() ).getBindObj() instanceof MarkerOnlineCar ) {
|
||||
properties.put( "type", "10000" );
|
||||
properties.put("sn", sn);
|
||||
if (((MarkerShowEntity) marker.getObject()).getBindObj() instanceof MarkerExploreWay) {
|
||||
MarkerExploreWay exploreWay = (MarkerExploreWay) ((MarkerShowEntity) marker.getObject()).getBindObj();
|
||||
properties.put("dbid", exploreWay.getInfoId());
|
||||
properties.put("type", exploreWay.getPoiType());
|
||||
} else if (((MarkerShowEntity) marker.getObject()).getBindObj() instanceof MarkerOnlineCar) {
|
||||
properties.put("type", "10000");
|
||||
}
|
||||
}
|
||||
MarkerServiceHandler.getMogoAnalytics().track( "v2x_road_click", properties );
|
||||
} catch ( Exception e ) {
|
||||
MarkerServiceHandler.getMogoAnalytics().track("v2x_road_click", properties);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return false;
|
||||
@@ -224,144 +196,142 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
/**
|
||||
* 切换当前选中marker和上一个选中的状态
|
||||
*
|
||||
* @param marker
|
||||
* @return
|
||||
* @param marker 地图marker抽象对象
|
||||
* @return markerOpenStatus
|
||||
*/
|
||||
private boolean switchMarkerOpenStatus( IMogoMarker marker ) {
|
||||
if ( mLastCheckMarker != null ) {
|
||||
private boolean switchMarkerOpenStatus(IMogoMarker marker) {
|
||||
if (mLastCheckMarker != null) {
|
||||
// 判断点击的是否是同一个
|
||||
if ( marker.equals( mLastCheckMarker ) ) {
|
||||
if (marker.equals(mLastCheckMarker)) {
|
||||
return false;
|
||||
}
|
||||
// 将上次选中 Marker 设置为未选中状态
|
||||
closeMarker( mLastCheckMarker );
|
||||
closeMarker(mLastCheckMarker);
|
||||
}
|
||||
|
||||
// 将当前的Marker设置为选中
|
||||
openMarker( marker );
|
||||
openMarker(marker);
|
||||
return true;
|
||||
}
|
||||
|
||||
// 展开气泡
|
||||
private void openMarker( IMogoMarker mogoMarker ) {
|
||||
if ( mogoMarker == null ) {
|
||||
private void openMarker(IMogoMarker mogoMarker) {
|
||||
if (mogoMarker == null) {
|
||||
return;
|
||||
}
|
||||
mLastCheckMarker = mogoMarker;
|
||||
// 在线车辆点击使用infoWindow
|
||||
if ( TextUtils.equals( mogoMarker.getOwner(), ModuleNames.CARD_TYPE_USER_DATA ) ) {
|
||||
updateCarUserInfoWindow( mogoMarker );
|
||||
if (TextUtils.equals(mogoMarker.getOwner(), ModuleNames.CARD_TYPE_USER_DATA)) {
|
||||
updateCarUserInfoWindow(mogoMarker);
|
||||
} else {
|
||||
Object object = mogoMarker.getObject();
|
||||
if ( object instanceof MarkerShowEntity ) {
|
||||
MarkerShowEntity markerShowEntity = ( MarkerShowEntity ) object;
|
||||
markerShowEntity.setChecked( true );
|
||||
IMarkerView markerView = MapMarkerAdapter.getMarkerView( mContext, markerShowEntity, mogoMarker.getMogoMarkerOptions() );
|
||||
markerView.setMarker( mogoMarker );
|
||||
if ( markerView instanceof OnlineCarMarkerView ) {
|
||||
if (object instanceof MarkerShowEntity) {
|
||||
MarkerShowEntity markerShowEntity = (MarkerShowEntity) object;
|
||||
markerShowEntity.setChecked(true);
|
||||
IMarkerView markerView = MapMarkerAdapter.getMarkerView(mContext, markerShowEntity, mogoMarker.getMogoMarkerOptions());
|
||||
markerView.setMarker(mogoMarker);
|
||||
if (markerView instanceof OnlineCarMarkerView) {
|
||||
try {
|
||||
mogoMarker.setIcon( markerView.getBitmap( ( ( MarkerOnlineCar ) markerShowEntity.getBindObj() ).getCarInfo().getVehicleType() ) );
|
||||
} catch ( Exception e ) {
|
||||
mogoMarker.setIcon( markerView.getBitmap( 0 ) );
|
||||
mogoMarker.setIcon(markerView.getBitmap(((MarkerOnlineCar) markerShowEntity.getBindObj()).getCarInfo().getVehicleType()));
|
||||
} catch (Exception e) {
|
||||
mogoMarker.setIcon(markerView.getBitmap(0));
|
||||
}
|
||||
} else {
|
||||
if ( MarkerServiceHandler.getApis().getStatusManagerApi().isVrMode() ) {
|
||||
if (MarkerServiceHandler.getApis().getStatusManagerApi().isVrMode()) {
|
||||
mogoMarker.hideInfoWindow();
|
||||
mogoMarker.showInfoWindow();
|
||||
} else {
|
||||
mogoMarker.setIcon( ViewUtils.fromView( markerView.getView() ) );
|
||||
mogoMarker.setIcon(ViewUtils.fromView(markerView.getView()));
|
||||
}
|
||||
}
|
||||
mogoMarker.setToTop();
|
||||
}
|
||||
}
|
||||
if ( !MarkerServiceHandler.getApis().getStatusManagerApi().isVrMode() ) {
|
||||
MarkerServiceHandler.getMogoStatusManager().setUserInteractionStatus( TAG, true, false );
|
||||
MarkerServiceHandler.getMapUIController().moveToCenter( mogoMarker.getPosition(), DebugConfig.isRoadEventAnimated() );
|
||||
if (!MarkerServiceHandler.getApis().getStatusManagerApi().isVrMode()) {
|
||||
MarkerServiceHandler.getMogoStatusManager().setUserInteractionStatus(TAG, true, false);
|
||||
MarkerServiceHandler.getMapUIController().moveToCenter(mogoMarker.getPosition(), DebugConfig.isRoadEventAnimated());
|
||||
}
|
||||
}
|
||||
|
||||
private void updateCarUserInfoWindow( IMogoMarker marker ) {
|
||||
if ( marker != null && !marker.isDestroyed() ) {
|
||||
private void updateCarUserInfoWindow(IMogoMarker marker) {
|
||||
if (marker != null && !marker.isDestroyed()) {
|
||||
try {
|
||||
if ( !TextUtils.equals( marker.getOwner(), ModuleNames.CARD_TYPE_USER_DATA ) ) {
|
||||
if (!TextUtils.equals(marker.getOwner(), ModuleNames.CARD_TYPE_USER_DATA)) {
|
||||
return;
|
||||
}
|
||||
marker.setIcon( OnlineCarMarkerView.getInstance().getSelectedBitmap( getCarVehicleType( marker ) ) );
|
||||
MarkerOnlineCar onlineCar = ( MarkerOnlineCar ) ( ( MarkerShowEntity ) marker.getObject() ).getBindObj();
|
||||
CallChatApi.getInstance().showUserWindow( mContext, onlineCar );
|
||||
} catch ( Exception e ) {
|
||||
marker.setIcon(OnlineCarMarkerView.getInstance().getSelectedBitmap(getCarVehicleType(marker)));
|
||||
MarkerOnlineCar onlineCar = (MarkerOnlineCar) ((MarkerShowEntity) marker.getObject()).getBindObj();
|
||||
CallChatApi.getInstance().showUserWindow(mContext, onlineCar);
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 折叠气泡
|
||||
private void closeMarker( IMogoMarker mogoMarker ) {
|
||||
if ( mogoMarker == null ) {
|
||||
private void closeMarker(IMogoMarker mogoMarker) {
|
||||
if (mogoMarker == null) {
|
||||
return;
|
||||
}
|
||||
// 在线车辆点击使用infoWindow
|
||||
if ( TextUtils.equals( mogoMarker.getOwner(), ModuleNames.CARD_TYPE_USER_DATA ) ) {
|
||||
mogoMarker.setIcon( OnlineCarMarkerView.getInstance().getBitmap( getCarVehicleType( mogoMarker ) ) );
|
||||
if (TextUtils.equals(mogoMarker.getOwner(), ModuleNames.CARD_TYPE_USER_DATA)) {
|
||||
mogoMarker.setIcon(OnlineCarMarkerView.getInstance().getBitmap(getCarVehicleType(mogoMarker)));
|
||||
} else {
|
||||
Object object = mogoMarker.getObject();
|
||||
if ( object != null ) {
|
||||
MarkerShowEntity markerShowEntity = ( MarkerShowEntity ) object;
|
||||
markerShowEntity.setChecked( false );
|
||||
IMarkerView markerView = MapMarkerAdapter.getMarkerView( mContext, markerShowEntity, mogoMarker.getMogoMarkerOptions() );
|
||||
markerView.setMarker( mogoMarker );
|
||||
if ( markerView instanceof OnlineCarMarkerView ) {
|
||||
if (object != null) {
|
||||
MarkerShowEntity markerShowEntity = (MarkerShowEntity) object;
|
||||
markerShowEntity.setChecked(false);
|
||||
IMarkerView markerView = MapMarkerAdapter.getMarkerView(mContext, markerShowEntity, mogoMarker.getMogoMarkerOptions());
|
||||
markerView.setMarker(mogoMarker);
|
||||
if (markerView instanceof OnlineCarMarkerView) {
|
||||
try {
|
||||
mogoMarker.setIcon( markerView.getBitmap( ( ( MarkerOnlineCar ) markerShowEntity.getBindObj() ).getCarInfo().getVehicleType() ) );
|
||||
} catch ( Exception e ) {
|
||||
mogoMarker.setIcon( markerView.getBitmap( 0 ) );
|
||||
mogoMarker.setIcon(markerView.getBitmap(((MarkerOnlineCar) markerShowEntity.getBindObj()).getCarInfo().getVehicleType()));
|
||||
} catch (Exception e) {
|
||||
mogoMarker.setIcon(markerView.getBitmap(0));
|
||||
}
|
||||
} else {
|
||||
if ( MarkerServiceHandler.getApis().getStatusManagerApi().isVrMode() ) {
|
||||
if (MarkerServiceHandler.getApis().getStatusManagerApi().isVrMode()) {
|
||||
mogoMarker.hideInfoWindow();
|
||||
mogoMarker.showInfoWindow();
|
||||
} else {
|
||||
mogoMarker.setIcon( ViewUtils.fromView( markerView.getView() ) );
|
||||
mogoMarker.setIcon(ViewUtils.fromView(markerView.getView()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private int getCarVehicleType( IMogoMarker marker ) {
|
||||
private int getCarVehicleType(IMogoMarker marker) {
|
||||
try {
|
||||
return ( ( MarkerOnlineCar )
|
||||
( ( MarkerShowEntity ) marker.getObject() ).getBindObj() )
|
||||
return ((MarkerOnlineCar)
|
||||
((MarkerShowEntity) marker.getObject()).getBindObj())
|
||||
.getCarInfo()
|
||||
.getVehicleType();
|
||||
} catch ( Exception e ) {
|
||||
} catch (Exception e) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
// 绘制Marker
|
||||
public synchronized void drawMapMarker( MarkerResponse response ) {
|
||||
public synchronized void drawMapMarker(MarkerResponse response) {
|
||||
|
||||
if ( response == null || response.getResult() == null ) {
|
||||
if (response == null || response.getResult() == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( MarkerServiceHandler.getMogoStatusManager().isSearchUIShow() ) {
|
||||
if (MarkerServiceHandler.getMogoStatusManager().isSearchUIShow()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 解析不同的Marker类型,然后对应的进行绘制
|
||||
|
||||
mLastDataResult = response.getResult();
|
||||
UiThreadHandler.post( () -> {
|
||||
dispatchDataToBiz();
|
||||
} );
|
||||
UiThreadHandler.post(this::dispatchDataToBiz);
|
||||
|
||||
drawMarkerByCurrentType( mLastDataResult );
|
||||
drawMarkerByCurrentType(mLastDataResult);
|
||||
|
||||
// 在首页时才埋点
|
||||
if ( MarkerServiceHandler.getMogoStatusManager().isMainPageOnResume() ) {
|
||||
trackData( mLastDataResult );
|
||||
if (MarkerServiceHandler.getMogoStatusManager().isMainPageOnResume()) {
|
||||
trackData(mLastDataResult);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -370,17 +340,17 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
*
|
||||
* @param markerCardResult
|
||||
*/
|
||||
private synchronized void drawMarkerByCurrentType( MarkerCardResult markerCardResult ) {
|
||||
private synchronized void drawMarkerByCurrentType(MarkerCardResult markerCardResult) {
|
||||
|
||||
if ( markerCardResult == null ) {
|
||||
if (markerCardResult == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( MarkerServiceHandler.getMogoStatusManager().isSearchUIShow() ) {
|
||||
if (MarkerServiceHandler.getMogoStatusManager().isSearchUIShow()) {
|
||||
return;
|
||||
}
|
||||
|
||||
drawAllMarker( markerCardResult );
|
||||
drawAllMarker(markerCardResult);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -388,9 +358,9 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
*
|
||||
* @param markerCardResult
|
||||
*/
|
||||
private void drawAllMarker( MarkerCardResult markerCardResult ) {
|
||||
List< MarkerExploreWay > exploreWayList = markerCardResult.getExploreWay();
|
||||
RoadConditionDrawer.getInstance().drawRoadConditionMarker( exploreWayList, ServiceConst.MAX_AMOUNT_ALL, this );
|
||||
private void drawAllMarker(MarkerCardResult markerCardResult) {
|
||||
List<MarkerExploreWay> exploreWayList = markerCardResult.getExploreWay();
|
||||
RoadConditionDrawer.getInstance().drawRoadConditionMarker(exploreWayList, ServiceConst.MAX_AMOUNT_ALL, this);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -398,51 +368,51 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
*
|
||||
* @param markerCardResult
|
||||
*/
|
||||
private void trackData( MarkerCardResult markerCardResult ) {
|
||||
if ( markerCardResult == null ) {
|
||||
private void trackData(MarkerCardResult markerCardResult) {
|
||||
if (markerCardResult == null) {
|
||||
return;
|
||||
}
|
||||
List< MarkerExploreWay > exploreWayList = markerCardResult.getExploreWay();
|
||||
List<MarkerExploreWay> exploreWayList = markerCardResult.getExploreWay();
|
||||
|
||||
JSONArray array = new JSONArray();
|
||||
int size = 0;
|
||||
size = exploreWayList == null ? 0 : exploreWayList.size();
|
||||
final Map< String, Integer > typeCounterMap = new HashMap<>();
|
||||
for ( int i = 0; i < size; i++ ) {
|
||||
MarkerExploreWay exploreWay = exploreWayList.get( i );
|
||||
final Map<String, Integer> typeCounterMap = new HashMap<>();
|
||||
for (int i = 0; i < size; i++) {
|
||||
MarkerExploreWay exploreWay = exploreWayList.get(i);
|
||||
String poiType = exploreWay.getPoiType();
|
||||
int counter = 0;
|
||||
if ( !typeCounterMap.containsKey( poiType ) ) {
|
||||
if (!typeCounterMap.containsKey(poiType)) {
|
||||
counter = 0;
|
||||
} else {
|
||||
counter = typeCounterMap.get( poiType );
|
||||
counter = typeCounterMap.get(poiType);
|
||||
}
|
||||
typeCounterMap.put( poiType, counter + 1 );
|
||||
typeCounterMap.put(poiType, counter + 1);
|
||||
}
|
||||
if ( !typeCounterMap.isEmpty() ) {
|
||||
for ( Map.Entry< String, Integer > entry : typeCounterMap.entrySet() ) {
|
||||
if ( entry == null || entry.getKey() == null ) {
|
||||
if (!typeCounterMap.isEmpty()) {
|
||||
for (Map.Entry<String, Integer> entry : typeCounterMap.entrySet()) {
|
||||
if (entry == null || entry.getKey() == null) {
|
||||
continue;
|
||||
}
|
||||
JSONObject object = new JSONObject();
|
||||
try {
|
||||
object.put( "type", entry.getKey() );
|
||||
object.put( "num", entry.getValue() );
|
||||
array.put( object );
|
||||
} catch ( JSONException e ) {
|
||||
object.put("type", entry.getKey());
|
||||
object.put("num", entry.getValue());
|
||||
array.put(object);
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
if ( array.length() == 0 ) {
|
||||
if (array.length() == 0) {
|
||||
return;
|
||||
}
|
||||
final Map< String, Object > properties = new HashMap<>();
|
||||
properties.put( "data", array.toString() );
|
||||
MarkerServiceHandler.getMogoAnalytics().track( "v2x_data_get", properties );
|
||||
} catch ( Exception e ) {
|
||||
final Map<String, Object> properties = new HashMap<>();
|
||||
properties.put("data", array.toString());
|
||||
MarkerServiceHandler.getMogoAnalytics().track("v2x_data_get", properties);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
@@ -453,11 +423,11 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
* 仅在数据刷新的时候分发
|
||||
*/
|
||||
private void dispatchDataToBiz() {
|
||||
if ( mLastDataResult == null ) {
|
||||
if (mLastDataResult == null) {
|
||||
return;
|
||||
}
|
||||
List< MarkerExploreWay > exploreWayList = mLastDataResult.getExploreWay();
|
||||
dispatchDataToBis( ServiceConst.CARD_TYPE_ROAD_CONDITION, exploreWayList == null ? new ArrayList<>() : exploreWayList );
|
||||
List<MarkerExploreWay> exploreWayList = mLastDataResult.getExploreWay();
|
||||
dispatchDataToBis(ServiceConst.CARD_TYPE_ROAD_CONDITION, exploreWayList == null ? new ArrayList<>() : exploreWayList);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -466,13 +436,13 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
* @param biz
|
||||
* @param object
|
||||
*/
|
||||
private void dispatchDataToBis( String biz, Object object ) {
|
||||
if ( TextUtils.isEmpty( biz ) ) {
|
||||
private void dispatchDataToBis(String biz, Object object) {
|
||||
if (TextUtils.isEmpty(biz)) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
MarkerServiceHandler.getDataManager().syncData( biz, object );
|
||||
} catch ( Exception e ) {
|
||||
MarkerServiceHandler.getDataManager().syncData(biz, object);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
@@ -483,45 +453,45 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
* @param markerShowEntity marker 绘制数据实体
|
||||
* @return 绘制的Marker
|
||||
*/
|
||||
public synchronized IMogoMarker drawMapMarker( MarkerShowEntity markerShowEntity, int zIndex ) {
|
||||
public synchronized IMogoMarker drawMapMarker(MarkerShowEntity markerShowEntity, int zIndex) {
|
||||
try {
|
||||
return MarkerDrawer.getInstance().drawMapMarkerImpl( markerShowEntity, zIndex, this );
|
||||
} catch ( Exception e ) {
|
||||
return MarkerDrawer.getInstance().drawMapMarkerImpl(markerShowEntity, zIndex, this);
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class< MarkerResponse > target() {
|
||||
public Class<MarkerResponse> target() {
|
||||
return MarkerResponse.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMsgReceived( final MarkerResponse response ) {
|
||||
if ( ignoreDrawRequest() ) {
|
||||
public void onMsgReceived(final MarkerResponse response) {
|
||||
if (ignoreDrawRequest()) {
|
||||
return;
|
||||
}
|
||||
runOnTargetThread( () -> {
|
||||
drawMapMarker( response );
|
||||
} );
|
||||
runOnTargetThread(() -> {
|
||||
drawMapMarker(response);
|
||||
});
|
||||
}
|
||||
|
||||
public void onSyncMarkerResponse( MarkerResponse response ) {
|
||||
if ( ignoreDrawRequest() ) {
|
||||
public void onSyncMarkerResponse(MarkerResponse response) {
|
||||
if (ignoreDrawRequest()) {
|
||||
return;
|
||||
}
|
||||
runOnTargetThread( () -> {
|
||||
drawMapMarker( response );
|
||||
} );
|
||||
runOnTargetThread(() -> {
|
||||
drawMapMarker(response);
|
||||
});
|
||||
}
|
||||
|
||||
public void syncLocation( double lon, double lat ) {
|
||||
mCarLatLng = new MogoLatLng( lat, lon );
|
||||
public void syncLocation(double lon, double lat) {
|
||||
mCarLatLng = new MogoLatLng(lat, lon);
|
||||
}
|
||||
|
||||
public void getOnlineCarDataByAutoRefreshStrategy( MogoLatLng latlng ) {
|
||||
UiThreadHandler.removeCallbacks( runnable );
|
||||
getOnlineCarDataImpl( latlng, false, false, ServiceConst.ONLINE_SEARCH_LIMIT, ServiceConst.ONLINE_SEARCH_RADIUS, false );
|
||||
public void getOnlineCarDataByAutoRefreshStrategy(MogoLatLng latlng) {
|
||||
UiThreadHandler.removeCallbacks(runnable);
|
||||
getOnlineCarDataImpl(latlng, false, false, ServiceConst.ONLINE_SEARCH_LIMIT, ServiceConst.ONLINE_SEARCH_RADIUS, false);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -531,24 +501,24 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
* @param limit
|
||||
* @param radius
|
||||
*/
|
||||
public void getOnlineCarDataByVoiceControl( MogoLatLng latLng,
|
||||
boolean onlyFocus,
|
||||
boolean onlySameCity,
|
||||
int limit,
|
||||
int radius ) {
|
||||
UiThreadHandler.removeCallbacks( runnable );
|
||||
getOnlineCarDataImpl( latLng, onlyFocus, onlySameCity, limit, radius, true );
|
||||
public void getOnlineCarDataByVoiceControl(MogoLatLng latLng,
|
||||
boolean onlyFocus,
|
||||
boolean onlySameCity,
|
||||
int limit,
|
||||
int radius) {
|
||||
UiThreadHandler.removeCallbacks(runnable);
|
||||
getOnlineCarDataImpl(latLng, onlyFocus, onlySameCity, limit, radius, true);
|
||||
}
|
||||
|
||||
private Runnable runnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
getOnlineCarDataImpl( mCarLatLng, false, false, ServiceConst.ONLINE_SEARCH_LIMIT, ServiceConst.ONLINE_SEARCH_RADIUS, false );
|
||||
getOnlineCarDataImpl(mCarLatLng, false, false, ServiceConst.ONLINE_SEARCH_LIMIT, ServiceConst.ONLINE_SEARCH_RADIUS, false);
|
||||
}
|
||||
};
|
||||
|
||||
public void stopAutoRefresh() {
|
||||
UiThreadHandler.removeCallbacks( runnable );
|
||||
UiThreadHandler.removeCallbacks(runnable);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -567,82 +537,82 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
boolean onlySameCity,
|
||||
int limit,
|
||||
int radius,
|
||||
boolean fitBounds ) {
|
||||
boolean fitBounds) {
|
||||
|
||||
if ( DebugConfig.isNeedUploadCoordinatesDurationInTime() ) {
|
||||
Logger.d( TAG, Log.getStackTraceString( new Throwable() ) );
|
||||
if (DebugConfig.isNeedUploadCoordinatesDurationInTime()) {
|
||||
Logger.d(TAG, Log.getStackTraceString(new Throwable()));
|
||||
return;
|
||||
}
|
||||
|
||||
if ( DebugConfig.isDebug() ) {
|
||||
if ( !DebugConfig.isRequestOnlineCarData() ) {
|
||||
if (DebugConfig.isDebug()) {
|
||||
if (!DebugConfig.isRequestOnlineCarData()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if ( mCarLatLng == null ) {
|
||||
if (mCarLatLng == null) {
|
||||
mCarLatLng = latLng;
|
||||
}
|
||||
|
||||
if ( latLng == null ) {
|
||||
if (latLng == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ignoreOnlineCarRequest() ) {
|
||||
if (ignoreOnlineCarRequest()) {
|
||||
removeCarMarkers();
|
||||
return;
|
||||
}
|
||||
|
||||
mRefreshModel.queryOnLineCarWithRoute( latLng, onlyFocus, onlySameCity, radius, limit, false, new RefreshCallback() {
|
||||
mRefreshModel.queryOnLineCarWithRoute(latLng, onlyFocus, onlySameCity, radius, limit, false, new RefreshCallback() {
|
||||
@Override
|
||||
public void onSuccess( Object o ) {
|
||||
MarkerResponse data = ( MarkerResponse ) o;
|
||||
public void onSuccess(Object o) {
|
||||
MarkerResponse data = (MarkerResponse) o;
|
||||
MarkerCardResult result = data.getResult();
|
||||
if ( result == null ) {
|
||||
if (result == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
List< MarkerOnlineCar > onlineCarList = result.getOnlineCar();
|
||||
if ( MarkerServiceHandler.getMogoStatusManager().isSearchUIShow() ) {
|
||||
List<MarkerOnlineCar> onlineCarList = result.getOnlineCar();
|
||||
if (MarkerServiceHandler.getMogoStatusManager().isSearchUIShow()) {
|
||||
return;
|
||||
}
|
||||
final int size = onlineCarList == null ? 0 : onlineCarList.size();
|
||||
|
||||
if ( mMarkerDisplayBounds == null ) {
|
||||
if (mMarkerDisplayBounds == null) {
|
||||
mMarkerDisplayBounds = new Rect(
|
||||
ResourcesHelper.getDimensionPixelSize( AbsMogoApplication.getApp(), R.dimen.module_service_marker_bounds_leftMargin ),
|
||||
ResourcesHelper.getDimensionPixelSize( AbsMogoApplication.getApp(), R.dimen.module_service_marker_bounds_topMargin ),
|
||||
ResourcesHelper.getDimensionPixelSize( AbsMogoApplication.getApp(), R.dimen.module_service_marker_bounds_rightMargin ),
|
||||
ResourcesHelper.getDimensionPixelSize( AbsMogoApplication.getApp(), R.dimen.module_service_marker_bounds_bottomMargin )
|
||||
ResourcesHelper.getDimensionPixelSize(AbsMogoApplication.getApp(), R.dimen.module_service_marker_bounds_leftMargin),
|
||||
ResourcesHelper.getDimensionPixelSize(AbsMogoApplication.getApp(), R.dimen.module_service_marker_bounds_topMargin),
|
||||
ResourcesHelper.getDimensionPixelSize(AbsMogoApplication.getApp(), R.dimen.module_service_marker_bounds_rightMargin),
|
||||
ResourcesHelper.getDimensionPixelSize(AbsMogoApplication.getApp(), R.dimen.module_service_marker_bounds_bottomMargin)
|
||||
);
|
||||
}
|
||||
|
||||
runOnTargetThread( () -> {
|
||||
trackData( size );
|
||||
OnlineCarDrawer.getInstance().drawOnlineCarMarkers( onlineCarList, Integer.MAX_VALUE, fitBounds, fitBounds, mMarkerDisplayBounds, latLng, MapMarkerManager.this );
|
||||
UiThreadHandler.postDelayed( runnable, SMOOTH_DURATION * 1000 );
|
||||
} );
|
||||
runOnTargetThread(() -> {
|
||||
trackData(size);
|
||||
OnlineCarDrawer.getInstance().drawOnlineCarMarkers(onlineCarList, Integer.MAX_VALUE, fitBounds, fitBounds, mMarkerDisplayBounds, latLng, MapMarkerManager.this);
|
||||
UiThreadHandler.postDelayed(runnable, SMOOTH_DURATION * 1000);
|
||||
});
|
||||
}
|
||||
|
||||
private void trackData( int size ) {
|
||||
private void trackData(int size) {
|
||||
JSONArray array = new JSONArray();
|
||||
JSONObject object = new JSONObject();
|
||||
try {
|
||||
object.put( "type", "10000" );
|
||||
object.put( "num", size );
|
||||
array.put( object );
|
||||
} catch ( JSONException e ) {
|
||||
object.put("type", "10000");
|
||||
object.put("num", size);
|
||||
array.put(object);
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
if ( array.length() == 0 ) {
|
||||
if (array.length() == 0) {
|
||||
return;
|
||||
}
|
||||
final Map< String, Object > properties = new HashMap<>();
|
||||
properties.put( "data", array.toString() );
|
||||
MarkerServiceHandler.getMogoAnalytics().track( "v2x_data_get", properties );
|
||||
final Map<String, Object> properties = new HashMap<>();
|
||||
properties.put("data", array.toString());
|
||||
MarkerServiceHandler.getMogoAnalytics().track("v2x_data_get", properties);
|
||||
}
|
||||
} );
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -655,7 +625,7 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
}
|
||||
|
||||
private void removeCarMarkers() {
|
||||
MarkerServiceHandler.getMarkerManager().removeMarkers( ModuleNames.CARD_TYPE_USER_DATA );
|
||||
MarkerServiceHandler.getMarkerManager().removeMarkers(ModuleNames.CARD_TYPE_USER_DATA);
|
||||
}
|
||||
|
||||
|
||||
@@ -667,11 +637,11 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
|| MarkerServiceHandler.getApis().getStatusManagerApi().isVrMode();
|
||||
}
|
||||
|
||||
private void runOnTargetThread( Runnable runnable ) {
|
||||
if ( runnable == null ) {
|
||||
private void runOnTargetThread(Runnable runnable) {
|
||||
if (runnable == null) {
|
||||
return;
|
||||
}
|
||||
ThreadPoolService.execute( runnable );
|
||||
ThreadPoolService.execute(runnable);
|
||||
}
|
||||
|
||||
public String getCurrentModuleName() {
|
||||
@@ -679,25 +649,25 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBizActionDone( String biz, int position, Object data ) {
|
||||
if ( data instanceof MarkerShowEntity && ( ( MarkerShowEntity ) data ).getMarker() != null ) {
|
||||
switchMarkerOpenStatus( ( ( MarkerShowEntity ) data ).getMarker() );
|
||||
public void onBizActionDone(String biz, int position, Object data) {
|
||||
if (data instanceof MarkerShowEntity && ((MarkerShowEntity) data).getMarker() != null) {
|
||||
switchMarkerOpenStatus(((MarkerShowEntity) data).getMarker());
|
||||
} else {
|
||||
IMogoMarkerManager markerManager = MarkerServiceHandler.getMarkerManager();
|
||||
List< IMogoMarker > markers = markerManager.getMarkers( biz );
|
||||
if ( markers != null ) {
|
||||
List<IMogoMarker> markers = markerManager.getMarkers(biz);
|
||||
if (markers != null) {
|
||||
try {
|
||||
IMogoMarker marker = markers.get( position );
|
||||
switchMarkerOpenStatus( marker );
|
||||
} catch ( Exception e ) {
|
||||
IMogoMarker marker = markers.get(position);
|
||||
switchMarkerOpenStatus(marker);
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMapUiModeChanged( EnumMapUI mapUI ) {
|
||||
switch ( mapUI ) {
|
||||
public void onMapUiModeChanged(EnumMapUI mapUI) {
|
||||
switch (mapUI) {
|
||||
case Type_Light:
|
||||
case Type_Night:
|
||||
// if ( !AppUtils.isAppForeground( mContext ) ) {
|
||||
@@ -709,18 +679,18 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
}
|
||||
|
||||
public void redrawMarkerByStyleChanged() {
|
||||
if ( mLastDataResult != null ) {
|
||||
runOnTargetThread( () -> {
|
||||
MarkerServiceHandler.getMarkerManager().removeMarkers( ModuleNames.CARD_TYPE_ROAD_CONDITION );
|
||||
drawMarkerByCurrentType( mLastDataResult );
|
||||
if (mLastDataResult != null) {
|
||||
runOnTargetThread(() -> {
|
||||
MarkerServiceHandler.getMarkerManager().removeMarkers(ModuleNames.CARD_TYPE_ROAD_CONDITION);
|
||||
drawMarkerByCurrentType(mLastDataResult);
|
||||
mLastCheckMarker = null;
|
||||
} );
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public void onCloseCurrentSelectedMarker() {
|
||||
if ( mLastCheckMarker != null && !mLastCheckMarker.isDestroyed() ) {
|
||||
closeMarker( mLastCheckMarker );
|
||||
if (mLastCheckMarker != null && !mLastCheckMarker.isDestroyed()) {
|
||||
closeMarker(mLastCheckMarker);
|
||||
mLastCheckMarker = null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.mogo.module.service.spi;
|
||||
|
||||
import com.elegant.spi.annotations.Service;
|
||||
import com.mogo.module.service.MarkerServiceHandler;
|
||||
import com.mogo.realtime.api.IRealTimeProvider;
|
||||
import com.mogo.realtime.entity.ADASRecognizedResult;
|
||||
import com.mogo.realtime.entity.CloudLocationInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service(value = IRealTimeProvider.class)
|
||||
public class SPIRealTimeUpload implements IRealTimeProvider {
|
||||
|
||||
@Override
|
||||
public List<ADASRecognizedResult> getLastADASRecognizedResult() {
|
||||
//todo 待200ms 数据联调结束后 代码合并 更换类 ---> ADASRecognizedResult
|
||||
// return MarkerServiceHandler.getADASController().getLastADASRecognizedResult();
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CloudLocationInfo> getLocationMsg() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -5,15 +5,12 @@ import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.ServiceConnection;
|
||||
import android.os.IBinder;
|
||||
import android.os.RemoteException;
|
||||
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.module.common.entity.MogoSnapshotSetData;
|
||||
import com.mogo.module.common.machinevision.IMachineVisionInterface;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
public
|
||||
/**
|
||||
/*
|
||||
* @author congtaowang
|
||||
* @since 2020/10/27
|
||||
*
|
||||
@@ -24,7 +21,6 @@ class VrModeController {
|
||||
private static final String TAG = "VrModeController";
|
||||
|
||||
private static volatile VrModeController sInstance;
|
||||
private volatile IMachineVisionInterface mMachineVisionInterface;
|
||||
private ServiceConnection mServiceConnection;
|
||||
|
||||
private VrModeController() {
|
||||
@@ -70,22 +66,18 @@ class VrModeController {
|
||||
AbsMogoApplication.getApp().bindService( intent, mServiceConnection = new ServiceConnection() {
|
||||
@Override
|
||||
public void onServiceConnected( ComponentName name, IBinder service ) {
|
||||
mMachineVisionInterface = IMachineVisionInterface.Stub.asInterface( service );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onServiceDisconnected( ComponentName name ) {
|
||||
mMachineVisionInterface = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindingDied( ComponentName name ) {
|
||||
mMachineVisionInterface = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNullBinding( ComponentName name ) {
|
||||
mMachineVisionInterface = null;
|
||||
}
|
||||
}, Context.BIND_AUTO_CREATE );
|
||||
}
|
||||
@@ -102,34 +94,8 @@ class VrModeController {
|
||||
}
|
||||
|
||||
public void onMainPageResumeStatusChanged( boolean isResume ) {
|
||||
if ( mMachineVisionInterface != null ) {
|
||||
if ( isResume ) {
|
||||
try {
|
||||
mMachineVisionInterface.showViewIfExist();
|
||||
} catch ( RemoteException e ) {
|
||||
Logger.e( TAG, e, "onMainPageResumeStatusChanged" );
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
mMachineVisionInterface.hideViewIfExist();
|
||||
} catch ( RemoteException e ) {
|
||||
Logger.e( TAG, e, "onMainPageResumeStatusChanged" );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void renderMogoSnapshotSetData( MogoSnapshotSetData data ) {
|
||||
if ( data == null ) {
|
||||
return;
|
||||
}
|
||||
if ( mMachineVisionInterface == null ) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
mMachineVisionInterface.postData( data );
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "postData" );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3,15 +3,11 @@ package com.mogo.module.small.map;
|
||||
import android.app.Service;
|
||||
import android.content.Intent;
|
||||
import android.os.IBinder;
|
||||
import android.os.RemoteException;
|
||||
import android.view.Gravity;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.mogo.module.common.entity.MogoSnapshotSetData;
|
||||
import com.mogo.module.common.machinevision.IMachineVisionInterface;
|
||||
import com.mogo.module.common.wm.WindowManagerView;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
@@ -21,7 +17,6 @@ import com.mogo.utils.logger.Logger;
|
||||
*/
|
||||
public class SmallMapService extends Service {
|
||||
private static final String TAG = "MachineVisionMapService";
|
||||
private IBinder mBinder;
|
||||
|
||||
private WindowManagerView mWindowManagerView;
|
||||
private SmallMapDirectionView mSmallMapDirectionView;
|
||||
@@ -37,8 +32,7 @@ public class SmallMapService extends Service {
|
||||
@Override
|
||||
public IBinder onBind(Intent intent) {
|
||||
Logger.d(TAG, "onBind");
|
||||
mBinder = new SmallMapServiceBinder();
|
||||
return mBinder;
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -91,44 +85,4 @@ public class SmallMapService extends Service {
|
||||
mWindowManagerView.show();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 小地图与大地图之间进程通讯
|
||||
*/
|
||||
public class SmallMapServiceBinder extends IMachineVisionInterface.Stub {
|
||||
|
||||
@Override
|
||||
public void linkToDeath(@NonNull DeathRecipient recipient, int flags) {
|
||||
super.linkToDeath(recipient, flags);
|
||||
Logger.d(TAG, "linkToDeath");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean unlinkToDeath(@NonNull DeathRecipient recipient, int flags) {
|
||||
Logger.d(TAG, "unlinkToDeath");
|
||||
|
||||
return super.unlinkToDeath(recipient, flags);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postData(MogoSnapshotSetData data) throws RemoteException {
|
||||
Logger.d(TAG, "postData");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hideViewIfExist() throws RemoteException {
|
||||
Logger.d(TAG, "hideViewIfExist");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showViewIfExist() throws RemoteException {
|
||||
Logger.d(TAG, "showViewIfExist");
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,6 +33,14 @@ public interface IMogoWebSocketManager<T> extends IProvider {
|
||||
* @param body 消息体
|
||||
* @param listener 回执监听
|
||||
*/
|
||||
void sendMsg( T body, IMogoOnWebSocketMessageListener listener );
|
||||
default void sendMsg( T body, IMogoOnWebSocketMessageListener listener ){
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 停止socket服务
|
||||
*/
|
||||
default void stop(){
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ public class MsgBody {
|
||||
/**
|
||||
* 消息内容
|
||||
*/
|
||||
private Object mContent;
|
||||
private byte[] mContent;
|
||||
|
||||
public MsgBody msgType( int msgType ) {
|
||||
this.mMsgType = msgType;
|
||||
@@ -48,7 +48,7 @@ public class MsgBody {
|
||||
return this;
|
||||
}
|
||||
|
||||
public MsgBody content( Object object ) {
|
||||
public MsgBody content( byte[] object ) {
|
||||
this.mContent = object;
|
||||
return this;
|
||||
}
|
||||
@@ -65,7 +65,7 @@ public class MsgBody {
|
||||
return mMsgId;
|
||||
}
|
||||
|
||||
public Object getContent() {
|
||||
public byte[] getContent() {
|
||||
return mContent;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,7 +50,6 @@ dependencies {
|
||||
implementation rootProject.ext.dependencies.mogocommons
|
||||
implementation rootProject.ext.dependencies.mogoserviceapi
|
||||
implementation rootProject.ext.dependencies.modulecommon
|
||||
implementation rootProject.ext.dependencies.modulecommon
|
||||
} else {
|
||||
api project(":libraries:mogo-map")
|
||||
implementation project(":libraries:mogo-map-api")
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
include ':foudations:mogo-aicloud-services-sdk'
|
||||
include ':foudations:mogo-aicloud-services-apk'
|
||||
include ':foudations:httpdns-mogo'
|
||||
include ':modules:mogo-module-smp'
|
||||
include ':app2'
|
||||
|
||||
Reference in New Issue
Block a user