dev
This commit is contained in:
1
.idea/gradle.xml
generated
1
.idea/gradle.xml
generated
@@ -58,6 +58,7 @@
|
||||
<option value="$PROJECT_DIR$/modules/mogo-module-tanlu" />
|
||||
<option value="$PROJECT_DIR$/modules/mogo-module-v2x" />
|
||||
<option value="$PROJECT_DIR$/modules/mogo-module-widgets" />
|
||||
<option value="$PROJECT_DIR$/modules/mogo-modules-mvision" />
|
||||
<option value="$PROJECT_DIR$/services" />
|
||||
<option value="$PROJECT_DIR$/services/mogo-service" />
|
||||
<option value="$PROJECT_DIR$/services/mogo-service-api" />
|
||||
|
||||
@@ -372,6 +372,7 @@ dependencies {
|
||||
implementation rootProject.ext.dependencies.mogomonitor
|
||||
implementation rootProject.ext.dependencies.mogomoduleback
|
||||
implementation rootProject.ext.dependencies.guideshow
|
||||
implementation rootProject.ext.dependencies.mogomodulemachinevision
|
||||
} else {
|
||||
implementation project(':foudations:mogo-commons')
|
||||
implementation project(':foudations:mogo-base-websocket-sdk')
|
||||
@@ -390,6 +391,7 @@ dependencies {
|
||||
implementation project(':modules:mogo-module-monitor')
|
||||
implementation project(':modules:mogo-module-back')
|
||||
implementation project(':modules:mogo-module-guide')
|
||||
implementation project(':modules:mogo-modules-mvision')
|
||||
}
|
||||
|
||||
apply from: "./functions/perform.gradle"
|
||||
|
||||
@@ -17,6 +17,7 @@ import com.mogo.module.carchatting.card.CallChatConstant;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.MogoModule;
|
||||
import com.mogo.module.common.MogoModulePaths;
|
||||
import com.mogo.module.machine.vision.IMogoMachineVisionProvider;
|
||||
import com.mogo.module.main.service.MogoMainService;
|
||||
import com.mogo.module.media.MediaConstants;
|
||||
import com.mogo.module.push.base.PushUIConstants;
|
||||
@@ -89,8 +90,8 @@ public class MogoApplication extends AbsMogoApplication {
|
||||
MogoModulePaths.addBaseModule( new MogoModule( MogoServicePaths.PATH_MOGO_MONITOR, "MogoMonitor" ) );
|
||||
MogoModulePaths.addModule( new MogoModule( PushUIConstants.PATH, PushUIConstants.NAME ) );
|
||||
// 碰撞报警模块
|
||||
MogoModulePaths.addModule(new MogoModule(MogoServicePaths.PATH_CRASH_WARNING,
|
||||
"CrashWarning"));
|
||||
MogoModulePaths.addModule( new MogoModule( MogoServicePaths.PATH_CRASH_WARNING, "CrashWarning" ) );
|
||||
MogoModulePaths.addModule( new MogoModule( IMogoMachineVisionProvider.path, "IMogoMachineVisionProvider" ) );
|
||||
|
||||
if ( !DebugConfig.isLauncher() ) {
|
||||
PersistentManager.getInstance().initManager( this );
|
||||
@@ -122,7 +123,7 @@ public class MogoApplication extends AbsMogoApplication {
|
||||
DebugConfig.setUseCustomNavi( BuildConfig.USE_CUSTOM_NAVI );
|
||||
DebugConfig.setLauncher( BuildConfig.IS_LAUNCHER );
|
||||
DebugConfig.setActiveAIAssistFlag( BuildConfig.AI_ASSIST_ACTIVE_STAUTS );
|
||||
DebugConfig.setUseMockObuData(false);
|
||||
DebugConfig.setUseMockObuData( false );
|
||||
ObuConfig.useObuLocation = false;
|
||||
DebugConfig.setCarMachineType( BuildConfig.CAR_MACHINE_TYPE );
|
||||
DebugConfig.setProductFlavor( BuildConfig.FLAVOR_product );
|
||||
@@ -132,7 +133,7 @@ public class MogoApplication extends AbsMogoApplication {
|
||||
DebugConfig.setSupportedSearchDestinationOnlineCarList( BuildConfig.IS_SUPPORTED_SEARCH_DESTINATION_ONLINE_CAR_LIST );
|
||||
DebugConfig.setScheduleCalculateNotHomeCompanyDistanceForPush( BuildConfig.IS_SUPPORT_SCHEDULE_CALCULATE_NOT_HOME_COMPANY_DISTANCE_FOR_PUSH );
|
||||
DebugConfig.setSupportLauncherCardRefreshStrategy( BuildConfig.IS_SUPPORT_LAUNCHER_CARD_REFRESH_STRATEGY );
|
||||
DebugConfig.setObuType(BuildConfig.OBU_TYPE);
|
||||
DebugConfig.setObuType( BuildConfig.OBU_TYPE );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -94,7 +94,7 @@ targetSdkVersion : 22,
|
||||
mogoutils : "com.mogo.commons:mogo-utils:${MOGO_UTILS_VERSION}",
|
||||
mapamap : "com.mogo.map:map-amap:${MAP_AMAP_VERSION}",
|
||||
mapautomap : "com.mogo.map:map-autonavi:${MAP_AUTONAVI_VERSION}",
|
||||
mapcustom : "com.mogo.map:map-custom:${MAP_CUSTOM_VERSION}",
|
||||
mapcustom : "com.mogo.map:map-custom:${MAP_CUSTOM_VERSION}",
|
||||
mogomap : "com.mogo.map:mogo-map:${MOGO_MAP_VERSION}",
|
||||
mogomapapi : "com.mogo.map:mogo-map-api:${MOGO_MAP_API_VERSION}",
|
||||
modulecommon : "com.mogo.module:module-common:${MOGO_MODULE_COMMON_VERSION}",
|
||||
@@ -164,7 +164,7 @@ targetSdkVersion : 22,
|
||||
tanluupload : "com.mogo.module:module-tanlu-upload:${TANLULIB_VERSION}",
|
||||
|
||||
// obu sdk
|
||||
obusdk : "com.zhidao.enterprise.smartv2x:smartv2x:1.0.0.3",
|
||||
obusdk : "com.zhidao.enterprise.smartv2x:smartv2x:1.0.0.3",
|
||||
// 左侧面板
|
||||
moduleleftpanel : "com.mogo.module:module-left-panel:${MOGO_MODULE_LEFT_PANEL_VERSION}",
|
||||
// 左侧面板空实现
|
||||
@@ -174,7 +174,7 @@ targetSdkVersion : 22,
|
||||
// 基础服务实现
|
||||
mogobaseservicesdk : "com.mogo.base:services-sdk:${MOGO_BASE_SERVICES_SDK_VERSION}",
|
||||
mogobaseserviceapk : "com.mogo.base:services-apk:${MOGO_BASE_SERVICES_APK_VERSION}",
|
||||
mogobasewebsocketsdk : "com.mogo.base:websocket-sdk:${MOGO_BASE_WEBSOCKET_SDK_VERSION}",
|
||||
mogobasewebsocketsdk : "com.mogo.base:websocket-sdk:${MOGO_BASE_WEBSOCKET_SDK_VERSION}",
|
||||
// loglib
|
||||
mogologlib : "com.mogo.module:module-loglib:${LOGLIB_VERSION}",
|
||||
// monitor
|
||||
@@ -214,6 +214,8 @@ targetSdkVersion : 22,
|
||||
ttsdi : "com.mogo.tts:tts-di:${TTS_DI_VERSION}",
|
||||
ttszhi : "com.mogo.tts:tts-zhi:${TTS_ZHI_VERSION}",
|
||||
ttsnoop : "com.mogo.tts:tts-noop:${TTS_NOOP_VERSION}",
|
||||
|
||||
mogomodulemachinevision : "com.mogo.module:module-machine-vision:${MOGO_MODULES_MVISION_VERSION}",
|
||||
]
|
||||
|
||||
}
|
||||
@@ -106,6 +106,7 @@ TTS_ZHI_VERSION=1.0.0
|
||||
TTS_NOOP_VERSION=1.0.0
|
||||
# 自研地图
|
||||
MAP_CUSTOM_VERSION=1.2.1.9
|
||||
MOGO_MODULES_MVISION_VERSION=1.0.0
|
||||
|
||||
######## 外部依赖引用
|
||||
# 车聊聊
|
||||
|
||||
@@ -41,12 +41,6 @@ public class MogoMapView extends MogoBaseMapView implements ILifeCycle {
|
||||
@Override
|
||||
protected void addDleMaps() {
|
||||
|
||||
if ( !MogoMapDelegateFactory.isUseCustom() ) {
|
||||
|
||||
} else {
|
||||
|
||||
}
|
||||
|
||||
mCustomMapView = new CustomMapView().create( getContext() );
|
||||
if ( mCustomMapView != null ) {
|
||||
final View mapView = mCustomMapView.getMapView();
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
// ShapshotSetData.aidl
|
||||
package com.mogo.module.common.entity;
|
||||
parcelable MogoSnapshotSetData;
|
||||
@@ -0,0 +1,10 @@
|
||||
// IMachineVisionInterface.aidl
|
||||
package com.mogo.module.common.machinevision;
|
||||
import com.mogo.module.common.entity.MogoSnapshotSetData;
|
||||
|
||||
// Declare any non-default types here with import statements
|
||||
|
||||
interface IMachineVisionInterface {
|
||||
|
||||
oneway void postData(in MogoSnapshotSetData data);
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.mogo.module.common.entity;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/10/26
|
||||
*
|
||||
* 描述
|
||||
*/
|
||||
class MogoSnapshotSetData implements Parcelable {
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel( Parcel dest, int flags ) {
|
||||
}
|
||||
|
||||
public MogoSnapshotSetData() {
|
||||
}
|
||||
|
||||
protected MogoSnapshotSetData( Parcel in ) {
|
||||
}
|
||||
|
||||
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];
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -416,7 +416,6 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
}
|
||||
|
||||
private void enterVrMode(){
|
||||
mApis.getStatusManagerApi().setVrMode(TYPE_ENTRANCE, true);
|
||||
tvEnterVrMode.setVisibility(View.GONE);
|
||||
mMove2CurrentLocation.setVisibility(View.GONE);
|
||||
mUploadRoadCondition.setVisibility(View.GONE);
|
||||
@@ -430,7 +429,6 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
|
||||
private void exitVrMode(){
|
||||
EntranceViewHolder.getInstance().forceHideNoticeView();
|
||||
mApis.getStatusManagerApi().setVrMode(TYPE_ENTRANCE, false);
|
||||
tvEnterVrMode.setVisibility(View.VISIBLE);
|
||||
mMove2CurrentLocation.setVisibility(View.VISIBLE);
|
||||
mUploadRoadCondition.setVisibility(View.VISIBLE);
|
||||
|
||||
@@ -53,10 +53,13 @@ import com.mogo.module.service.refresh.AutoRefreshStrategy;
|
||||
import com.mogo.module.service.refresh.CustomRefreshStrategy;
|
||||
import com.mogo.module.service.refresh.RefreshObject;
|
||||
import com.mogo.module.service.strategy.CarIconDisplayStrategy;
|
||||
import com.mogo.module.service.vrmode.VrModeController;
|
||||
import com.mogo.module.service.websocket.LocationResult;
|
||||
import com.mogo.module.service.websocket.OnePerSecondSendContent;
|
||||
import com.mogo.service.adas.IMogoADASController;
|
||||
import com.mogo.service.adas.entity.ADASRecognizedResult;
|
||||
import com.mogo.service.connection.IMogoOnWebSocketMessageListener;
|
||||
import com.mogo.service.connection.WebSocketMsgType;
|
||||
import com.mogo.service.fragmentmanager.FragmentStackTransactionListener;
|
||||
import com.mogo.service.fragmentmanager.IMogoFragmentManager;
|
||||
import com.mogo.service.intent.IMogoIntentListener;
|
||||
@@ -78,6 +81,7 @@ import com.mogo.utils.network.utils.GsonUtil;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -361,6 +365,11 @@ public class MogoServices implements IMogoMapListener,
|
||||
MarkerServiceHandler.getApis().getMapServiceApi().getMarkerManager( mContext ).removeMarkers();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onVrModeChanged( boolean isVrMode ) {
|
||||
VrModeController.getInstance().onVrModeChanged( isVrMode );
|
||||
}
|
||||
};
|
||||
|
||||
public void init( Context context ) {
|
||||
@@ -378,6 +387,7 @@ public class MogoServices implements IMogoMapListener,
|
||||
mStatusManager.registerStatusChangedListener( ServiceConst.TYPE, StatusDescriptor.MAIN_PAGE_RESUME, statusChangedListener );
|
||||
mStatusManager.registerStatusChangedListener( ServiceConst.TYPE, StatusDescriptor.SEEK_HELPING, statusChangedListener );
|
||||
mStatusManager.registerStatusChangedListener( ServiceConst.TYPE, StatusDescriptor.ACC_STATUS, statusChangedListener );
|
||||
mStatusManager.registerStatusChangedListener( ServiceConst.TYPE, StatusDescriptor.VR_MODE, statusChangedListener );
|
||||
mStatusManager.setAIAssistReady( TAG, AIAssist.getInstance( mContext ).hasFlush() );
|
||||
|
||||
registerMogoReceiver( context );
|
||||
@@ -449,22 +459,35 @@ public class MogoServices implements IMogoMapListener,
|
||||
LocationResult locationResult = null;
|
||||
if ( lastCarLocation != null ) {
|
||||
locationResult = new LocationResult();
|
||||
locationResult.alt = lastCarLocation.getAltitude();
|
||||
locationResult.heading = lastCarLocation.getBearing();
|
||||
locationResult.lat = lastCarLocation.getLatitude();
|
||||
locationResult.lon = lastCarLocation.getLongitude();
|
||||
locationResult.satelliteTime = lastCarLocation.getTime();
|
||||
locationResult.systemTime = System.currentTimeMillis();
|
||||
locationResult.speed = lastCarLocation.getSpeed();
|
||||
locationResult.lastCoordinate = new LocationResult.LocationInfo();
|
||||
locationResult.lastCoordinate.alt = lastCarLocation.getAltitude();
|
||||
locationResult.lastCoordinate.heading = lastCarLocation.getBearing();
|
||||
locationResult.lastCoordinate.lat = lastCarLocation.getLatitude();
|
||||
locationResult.lastCoordinate.lon = lastCarLocation.getLongitude();
|
||||
locationResult.lastCoordinate.satelliteTime = lastCarLocation.getTime();
|
||||
locationResult.lastCoordinate.systemTime = System.currentTimeMillis();
|
||||
locationResult.lastCoordinate.speed = lastCarLocation.getSpeed();
|
||||
locationResult.coordinates = new ArrayList<>();
|
||||
locationResult.sn = com.mogo.commons.network.Utils.getSn();
|
||||
locationResult.mortonCode = MortonCode.wrapEncodeMorton( locationResult.lon, locationResult.lat );
|
||||
locationResult.mortonCode = MortonCode.wrapEncodeMorton( locationResult.lastCoordinate.lon, locationResult.lastCoordinate.lat );
|
||||
}
|
||||
List< ADASRecognizedResult > recognizedResults = MarkerServiceHandler.getADASController().getLastADASRecognizedResult();
|
||||
OnePerSecondSendContent content = new OnePerSecondSendContent();
|
||||
content.self = locationResult;
|
||||
content.adas = recognizedResults;
|
||||
//todo 通过 websocket 发送内容
|
||||
|
||||
Logger.d( TAG, GsonUtil.jsonFromObject( content ) );
|
||||
MarkerServiceHandler.getApis().getWebSocketManagerApi( mContext ).sendMsg( content, new IMogoOnWebSocketMessageListener() {
|
||||
@Override
|
||||
public WebSocketMsgType getDownLinkType() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WebSocketMsgType getUpLinkType() {
|
||||
return WebSocketMsgType.MSG_TYPE_UPLINK_CAR_DATA;
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
private void initWorkThread() {
|
||||
|
||||
@@ -13,7 +13,7 @@ public
|
||||
abstract class StatusChangedAdapter implements IMogoStatusChangedListener {
|
||||
|
||||
@Override
|
||||
public void onStatusChanged( StatusDescriptor descriptor, boolean isTrue ) {
|
||||
public final void onStatusChanged( StatusDescriptor descriptor, boolean isTrue ) {
|
||||
switch ( descriptor ) {
|
||||
case USER_INTERACTED:
|
||||
onUserInteracted( isTrue );
|
||||
@@ -30,6 +30,9 @@ abstract class StatusChangedAdapter implements IMogoStatusChangedListener {
|
||||
case ACC_STATUS:
|
||||
onAccStatusChanged( isTrue );
|
||||
break;
|
||||
case VR_MODE:
|
||||
onVrModeChanged( isTrue );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,4 +45,6 @@ abstract class StatusChangedAdapter implements IMogoStatusChangedListener {
|
||||
public abstract void onSeekHelpingStatusChanged( boolean isSeekingHelping );
|
||||
|
||||
public abstract void onAccStatusChanged( boolean accOn );
|
||||
|
||||
public abstract void onVrModeChanged( boolean isVrMode );
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ import com.mogo.module.common.entity.MarkerOnlineCar;
|
||||
import com.mogo.module.common.entity.MarkerResponse;
|
||||
import com.mogo.module.common.entity.MarkerShareMusic;
|
||||
import com.mogo.module.common.entity.MarkerShowEntity;
|
||||
import com.mogo.module.common.entity.MogoSnapshotSetData;
|
||||
import com.mogo.module.service.MarkerServiceHandler;
|
||||
import com.mogo.module.service.R;
|
||||
import com.mogo.module.service.ServiceConst;
|
||||
@@ -32,8 +33,11 @@ import com.mogo.module.service.Utils;
|
||||
import com.mogo.module.service.network.RefreshCallback;
|
||||
import com.mogo.module.service.network.RefreshModel;
|
||||
import com.mogo.module.service.utils.ViewUtils;
|
||||
import com.mogo.module.service.vrmode.VrModeController;
|
||||
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;
|
||||
@@ -128,6 +132,33 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
}
|
||||
|
||||
} );
|
||||
|
||||
MarkerServiceHandler.getApis().getWebSocketManagerApi( mContext )
|
||||
.registerOnWebSocketMessageListener( new IMogoOnWebSocketMessageListener< MogoSnapshotSetData >() {
|
||||
|
||||
@Override
|
||||
public WebSocketMsgType getUpLinkType() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WebSocketMsgType getDownLinkType() {
|
||||
return WebSocketMsgType.MSG_TYPE_DOWNLINK_CAR_DATA;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMsgReceived( MogoSnapshotSetData data ) {
|
||||
if ( data == null ) {
|
||||
return;
|
||||
}
|
||||
VrModeController.getInstance().renderMogoSnapshotSetData( data );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError( String errorMsg ) {
|
||||
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,109 @@
|
||||
package com.mogo.module.service.vrmode;
|
||||
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.ServiceConnection;
|
||||
import android.os.IBinder;
|
||||
|
||||
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
|
||||
*
|
||||
* 描述
|
||||
*/
|
||||
class VrModeController {
|
||||
|
||||
private static final String TAG = "VrModeController";
|
||||
|
||||
private static volatile VrModeController sInstance;
|
||||
private volatile IMachineVisionInterface mMachineVisionInterface;
|
||||
private ServiceConnection mServiceConnection;
|
||||
|
||||
private VrModeController() {
|
||||
}
|
||||
|
||||
public static VrModeController getInstance() {
|
||||
if ( sInstance == null ) {
|
||||
synchronized ( VrModeController.class ) {
|
||||
if ( sInstance == null ) {
|
||||
sInstance = new VrModeController();
|
||||
}
|
||||
}
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
public synchronized void release() {
|
||||
sInstance = null;
|
||||
}
|
||||
|
||||
private Object readResolve() {
|
||||
// 阻止反序列化,必须实现 Serializable 接口
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
public void onVrModeChanged( boolean isVrMode ) {
|
||||
if ( isVrMode ) {
|
||||
bindVrModeService();
|
||||
} else {
|
||||
unbindVrModeService();
|
||||
}
|
||||
}
|
||||
|
||||
private void bindVrModeService() {
|
||||
Intent intent = new Intent();
|
||||
intent.setComponent( new ComponentName( "com.mogo.launcher.f", "com.mogo.module.machine.vision.MachineVisionMapService" ) );
|
||||
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 );
|
||||
}
|
||||
|
||||
private void unbindVrModeService() {
|
||||
if ( mServiceConnection != null ) {
|
||||
try {
|
||||
AbsMogoApplication.getApp().unbindService( mServiceConnection );
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "unbindVrModeService" );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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" );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.mogo.module.service.websocket;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
@@ -10,12 +12,18 @@ public
|
||||
class LocationResult {
|
||||
|
||||
public String sn;
|
||||
public double lat;
|
||||
public double lon;
|
||||
public double heading;
|
||||
public long systemTime;
|
||||
public long satelliteTime;
|
||||
public double alt;
|
||||
public double speed;
|
||||
public long mortonCode;
|
||||
|
||||
public LocationInfo lastCoordinate;
|
||||
public List< LocationInfo > coordinates;
|
||||
|
||||
public static class LocationInfo {
|
||||
public double lat;
|
||||
public double lon;
|
||||
public double heading;
|
||||
public long systemTime;
|
||||
public long satelliteTime;
|
||||
public double alt;
|
||||
public double speed;
|
||||
}
|
||||
}
|
||||
|
||||
1
modules/mogo-modules-mvision/.gitignore
vendored
Normal file
1
modules/mogo-modules-mvision/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/build
|
||||
60
modules/mogo-modules-mvision/build.gradle
Normal file
60
modules/mogo-modules-mvision/build.gradle
Normal file
@@ -0,0 +1,60 @@
|
||||
apply plugin: 'com.android.library'
|
||||
apply plugin: 'com.alibaba.arouter'
|
||||
|
||||
android {
|
||||
compileSdkVersion rootProject.ext.android.compileSdkVersion
|
||||
// buildToolsVersion rootProject.ext.android.buildToolsVersion
|
||||
defaultConfig {
|
||||
minSdkVersion rootProject.ext.android.minSdkVersion
|
||||
targetSdkVersion rootProject.ext.android.targetSdkVersion
|
||||
versionCode Integer.valueOf(VERSION_CODE)
|
||||
versionName getValueFromRootProperties("${project.name.replace("-", "_").toUpperCase()}_VERSION")
|
||||
|
||||
javaCompileOptions {
|
||||
annotationProcessorOptions {
|
||||
arguments = [AROUTER_MODULE_NAME: project.getName()]
|
||||
}
|
||||
}
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
consumerProguardFiles 'consumer-rules.pro'
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
targetCompatibility 1.8
|
||||
sourceCompatibility 1.8
|
||||
}
|
||||
|
||||
}
|
||||
dependencies {
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||
|
||||
implementation rootProject.ext.dependencies.androidxappcompat
|
||||
implementation rootProject.ext.dependencies.androidxconstraintlayout
|
||||
implementation rootProject.ext.dependencies.arouter
|
||||
annotationProcessor rootProject.ext.dependencies.aroutercompiler
|
||||
if (Boolean.valueOf(RELEASE)) {
|
||||
api rootProject.ext.dependencies.mogomap
|
||||
api rootProject.ext.dependencies.mogomapapi
|
||||
api rootProject.ext.dependencies.mogoutils
|
||||
api rootProject.ext.dependencies.mogocommons
|
||||
api rootProject.ext.dependencies.mogoserviceapi
|
||||
implementation rootProject.ext.dependencies.modulecommon
|
||||
} else {
|
||||
api project(":libraries:mogo-map")
|
||||
api project(":libraries:mogo-map-api")
|
||||
api project(":foudations:mogo-utils")
|
||||
api project(":foudations:mogo-commons")
|
||||
api project(':services:mogo-service-api')
|
||||
implementation project(':modules:mogo-module-common')
|
||||
}
|
||||
}
|
||||
|
||||
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()
|
||||
0
modules/mogo-modules-mvision/consumer-rules.pro
Normal file
0
modules/mogo-modules-mvision/consumer-rules.pro
Normal file
3
modules/mogo-modules-mvision/gradle.properties
Normal file
3
modules/mogo-modules-mvision/gradle.properties
Normal file
@@ -0,0 +1,3 @@
|
||||
GROUP=com.mogo.module
|
||||
POM_ARTIFACT_ID=module-machine-vision
|
||||
VERSION_CODE=1
|
||||
21
modules/mogo-modules-mvision/proguard-rules.pro
vendored
Normal file
21
modules/mogo-modules-mvision/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,26 @@
|
||||
package com.mogo.module.machine.vision;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.test.platform.app.InstrumentationRegistry;
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Instrumented test, which will execute on an Android device.
|
||||
*
|
||||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||
*/
|
||||
@RunWith( AndroidJUnit4.class )
|
||||
public class ExampleInstrumentedTest {
|
||||
@Test
|
||||
public void useAppContext() {
|
||||
// Context of the app under test.
|
||||
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
|
||||
assertEquals( "com.mogo.module.machine.vision.test", appContext.getPackageName() );
|
||||
}
|
||||
}
|
||||
10
modules/mogo-modules-mvision/src/main/AndroidManifest.xml
Normal file
10
modules/mogo-modules-mvision/src/main/AndroidManifest.xml
Normal file
@@ -0,0 +1,10 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.mogo.module.machine.vision">
|
||||
|
||||
<application>
|
||||
<service
|
||||
android:name=".MachineVisionMapService"
|
||||
android:exported="false"
|
||||
android:process=":machinevision" />
|
||||
</application>
|
||||
</manifest>
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.mogo.module.machine.vision;
|
||||
|
||||
import com.mogo.service.module.IMogoModuleProvider;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/10/27
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
interface IMogoMachineVisionProvider extends IMogoModuleProvider {
|
||||
|
||||
String path = "/machinevision/api";
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
package com.mogo.module.machine.vision;
|
||||
|
||||
import android.app.Service;
|
||||
import android.content.Intent;
|
||||
import android.content.ServiceConnection;
|
||||
import android.os.IBinder;
|
||||
import android.os.RemoteException;
|
||||
import android.view.Gravity;
|
||||
|
||||
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;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/10/26
|
||||
*
|
||||
* 描述
|
||||
*/
|
||||
class MachineVisionMapService extends Service {
|
||||
|
||||
private static final String TAG = "MachineVisionMapService";
|
||||
|
||||
private IBinder mBinder;
|
||||
|
||||
private WindowManagerView mMachineVisionMapViewManager;
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public IBinder onBind( Intent intent ) {
|
||||
mBinder = new MachineVisionMapServiceBinder();
|
||||
addMachineVisionMapView();
|
||||
Logger.d( TAG, "onBind" );
|
||||
return mBinder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onUnbind( Intent intent ) {
|
||||
if ( mMachineVisionMapViewManager != null && mMachineVisionMapViewManager.isShowing() ) {
|
||||
mMachineVisionMapViewManager.dismiss();
|
||||
}
|
||||
mMachineVisionMapViewManager = null;
|
||||
Logger.d( TAG, "onUnbind" );
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRebind( Intent intent ) {
|
||||
super.onRebind( intent );
|
||||
addMachineVisionMapView();
|
||||
Logger.d( TAG, "onRebind" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
}
|
||||
|
||||
public class MachineVisionMapServiceBinder extends IMachineVisionInterface.Stub {
|
||||
|
||||
private static final String TAG = "MachineVisionMapServiceBinder";
|
||||
|
||||
@Override
|
||||
public void postData( MogoSnapshotSetData data ) throws RemoteException {
|
||||
Logger.d( TAG, "current Thread:%s", Thread.currentThread().getName() );
|
||||
MachineVisionMapViewHandler.getInstance().renderSnapshotSetData( data );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void linkToDeath( @NonNull DeathRecipient recipient, int flags ) {
|
||||
super.linkToDeath( recipient, flags );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean unlinkToDeath( @NonNull DeathRecipient recipient, int flags ) {
|
||||
return super.unlinkToDeath( recipient, flags );
|
||||
}
|
||||
}
|
||||
|
||||
private void addMachineVisionMapView() {
|
||||
mMachineVisionMapViewManager = new WindowManagerView.Builder( getApplicationContext() )
|
||||
.contentView( R.layout.module_mvision_layout_view )
|
||||
.size(
|
||||
getResources().getDimensionPixelOffset( R.dimen.module_mvision_view_width ),
|
||||
getResources().getDimensionPixelOffset( R.dimen.module_mvision_view_height )
|
||||
)
|
||||
.position(
|
||||
getResources().getDimensionPixelOffset( R.dimen.module_mvision_view_x ),
|
||||
getResources().getDimensionPixelOffset( R.dimen.module_mvision_view_y )
|
||||
)
|
||||
.gravity( Gravity.TOP | Gravity.LEFT )
|
||||
.showInWindowManager();
|
||||
|
||||
MachineVisionMapViewHandler.getInstance().setMachineVisionMapView( mMachineVisionMapViewManager.findViewById( R.id.module_mvision_map_view ) );
|
||||
mMachineVisionMapViewManager.show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
if ( mMachineVisionMapViewManager != null ) {
|
||||
mMachineVisionMapViewManager.dismiss();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.mogo.module.machine.vision;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.mogo.map.IMogoMapView;
|
||||
import com.mogo.map.impl.custom.CustomMapView;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/10/26
|
||||
*
|
||||
* 描述
|
||||
*/
|
||||
class MachineVisionMapView extends FrameLayout {
|
||||
|
||||
private static final String TAG = "MachineVisionMapView";
|
||||
|
||||
public MachineVisionMapView( Context context ) {
|
||||
this( context, null );
|
||||
}
|
||||
|
||||
public MachineVisionMapView( Context context, @Nullable AttributeSet attrs ) {
|
||||
this( context, attrs, 0 );
|
||||
}
|
||||
|
||||
public MachineVisionMapView( Context context, @Nullable AttributeSet attrs, int defStyleAttr ) {
|
||||
super( context, attrs, defStyleAttr );
|
||||
addMapView();
|
||||
}
|
||||
|
||||
private void addMapView() {
|
||||
IMogoMapView machineMapView = new CustomMapView().create( getContext() );
|
||||
if ( machineMapView != null ) {
|
||||
final View mapView = machineMapView.getMapView();
|
||||
if ( mapView != null ) {
|
||||
addView( mapView, new FrameLayout.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT ) );
|
||||
} else {
|
||||
Logger.e( TAG, "create MapView instance failed." );
|
||||
}
|
||||
} else {
|
||||
Logger.e( TAG, "create IMogoMapView instance failed." );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.mogo.module.machine.vision;
|
||||
|
||||
import com.mogo.module.common.entity.MogoSnapshotSetData;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/10/27
|
||||
*
|
||||
* 描述
|
||||
*/
|
||||
class MachineVisionMapViewHandler {
|
||||
|
||||
private static volatile MachineVisionMapViewHandler sInstance;
|
||||
|
||||
private MachineVisionMapViewHandler() {
|
||||
}
|
||||
|
||||
public static MachineVisionMapViewHandler getInstance() {
|
||||
if ( sInstance == null ) {
|
||||
synchronized ( MachineVisionMapViewHandler.class ) {
|
||||
if ( sInstance == null ) {
|
||||
sInstance = new MachineVisionMapViewHandler();
|
||||
}
|
||||
}
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
public synchronized void release() {
|
||||
sInstance = null;
|
||||
mMachineVisionMapView = null;
|
||||
}
|
||||
|
||||
private Object readResolve() {
|
||||
// 阻止反序列化,必须实现 Serializable 接口
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
private MachineVisionMapView mMachineVisionMapView;
|
||||
|
||||
public void setMachineVisionMapView( MachineVisionMapView mMachineVisionMapView ) {
|
||||
this.mMachineVisionMapView = mMachineVisionMapView;
|
||||
}
|
||||
|
||||
public void renderSnapshotSetData( MogoSnapshotSetData data ) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.mogo.module.machine.vision;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/10/27
|
||||
*
|
||||
* 描述
|
||||
*/
|
||||
@Route( path = IMogoMachineVisionProvider.path)
|
||||
class MogoMachineVisionProvider implements IMogoMachineVisionProvider {
|
||||
|
||||
private static final String TAG = "MogoMachineVisionProvider";
|
||||
|
||||
private Intent mMachineVisionServiceIntent;
|
||||
|
||||
@Override
|
||||
public Fragment createFragment( Context context, Bundle data ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View createView( Context context ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public String getModuleName() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getType() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init( Context context ) {
|
||||
mMachineVisionServiceIntent = new Intent( context, MachineVisionMapService.class );
|
||||
context.startService( mMachineVisionServiceIntent );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
if ( mMachineVisionServiceIntent != null ) {
|
||||
AbsMogoApplication.getApp().stopService( mMachineVisionServiceIntent );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<com.mogo.module.machine.vision.MachineVisionMapView
|
||||
android:id="@+id/module_mvision_map_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
</FrameLayout>
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<dimen name="module_mvision_view_width">600px</dimen>
|
||||
<dimen name="module_mvision_view_height">480px</dimen>
|
||||
<dimen name="module_mvision_view_x">300px</dimen>
|
||||
<dimen name="module_mvision_view_y">100px</dimen>
|
||||
</resources>
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.mogo.module.machine.vision;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Example local unit test, which will execute on the development machine (host).
|
||||
*
|
||||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||
*/
|
||||
public class ExampleUnitTest {
|
||||
@Test
|
||||
public void addition_isCorrect() {
|
||||
assertEquals( 4, 2 + 2 );
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
include ':modules:mogo-modules-mvision'
|
||||
include ':foudations:mogo-base-websocket-sdk'
|
||||
include ':tts:tts-base'
|
||||
include ':tts:tts-di'
|
||||
|
||||
Reference in New Issue
Block a user