add test code
This commit is contained in:
2
.idea/misc.xml
generated
2
.idea/misc.xml
generated
@@ -8,7 +8,7 @@
|
||||
<asm skipDebug="false" skipFrames="false" skipCode="false" expandFrames="false" />
|
||||
<groovy codeStyle="LEGACY" />
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="false" project-jdk-name="12" project-jdk-type="JavaSDK">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="12" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
</project>
|
||||
@@ -67,7 +67,7 @@ dependencies {
|
||||
implementation project(':foudations:mogo-commons')
|
||||
}
|
||||
|
||||
implementation 'com.zhidaoauto.machine:map:1.0.0-vr-8.4.6'
|
||||
implementation 'com.zhidaoauto.machine:map:1.0.0-vr-8.4.7'
|
||||
// implementation 'com.zhidaoauto.machine:map:1.0.0-vr-test-3.4'
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,14 @@
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
<!--adas数据-->
|
||||
<receiver android:name=".receiver.AdasDataBroadcastReceiver">
|
||||
<intent-filter>
|
||||
<action android:name="com.v2x.adas_data_broadcast" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
<receiver android:name=".receiver.TestPanelBroadcastReceiver">
|
||||
<intent-filter>
|
||||
<action android:name="com.v2x.test_panel_control" />
|
||||
@@ -25,13 +33,6 @@
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
<!--adas数据-->
|
||||
<receiver android:name=".receiver.AdasDataBroadcastReceiver">
|
||||
<intent-filter>
|
||||
<action android:name="com.v2x.adas_data_broadcast" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
|
||||
@@ -34,6 +34,7 @@ import com.mogo.module.common.utils.Const;
|
||||
import com.mogo.module.v2x.entity.net.V2XSeekHelpRes;
|
||||
import com.mogo.module.v2x.entity.net.V2XStrategyPushRes;
|
||||
import com.mogo.module.v2x.network.V2XRefreshCallback;
|
||||
import com.mogo.module.v2x.receiver.AdasDataBroadcastReceiver;
|
||||
import com.mogo.module.v2x.receiver.SceneBroadcastReceiver;
|
||||
import com.mogo.module.v2x.scenario.impl.V2XScenarioManager;
|
||||
import com.mogo.module.v2x.scenario.scene.livecar.V2XVoiceCallLiveBiz;
|
||||
@@ -302,6 +303,9 @@ public class V2XModuleProvider implements
|
||||
V2XServiceManager.getV2XMarkerService().startAutoRefresh();
|
||||
// 锁车就是将地图视图移植中心点,因为行驶中的车和地图要相对的跟随
|
||||
V2XServiceManager.getMapUIController().recoverLockMode();
|
||||
Log.d("liyz", "V2XModuleProvider ------> ");
|
||||
//注册adas数据通道
|
||||
V2XWaringManager.getInstance().registerAdasSocketMessage(mContext);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.mogo.module.v2x;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.map.MogoLatLng;
|
||||
@@ -108,8 +109,6 @@ public class V2XServiceManager {
|
||||
private static IMoGoV2XStatusManager moGoV2XStatusManager;
|
||||
private static IMoGoWarnPolylineManager moGoWarnPolylineManager;
|
||||
|
||||
List<ADASRecognizedResult> resultList = new ArrayList<>();
|
||||
|
||||
|
||||
private V2XServiceManager() {
|
||||
|
||||
@@ -164,34 +163,6 @@ public class V2XServiceManager {
|
||||
moGoWarnPolylineManager = (IMoGoWarnPolylineManager) ARouter.getInstance().build(MoGoV2XServicePaths.PATH_V2X_WARN_POLYLINE_MANAGER).navigation(context);
|
||||
|
||||
moGoV2XStatusManager = (IMoGoV2XStatusManager) ARouter.getInstance().build(MoGoV2XServicePaths.PATH_V2X_STATUS_MANAGER).navigation(context);
|
||||
|
||||
List<MogoLatLng> lonLats = new ArrayList<>();
|
||||
|
||||
// adas 每隔一秒传递的他车或行人数据
|
||||
mIMogoADASController.addAdasRecognizedDataCallback(resultList -> {
|
||||
// 绘制近景识别到的车辆,行人和二轮车 TODO
|
||||
AdasRecognizedResultDrawer.getInstance().renderAdasRecognizedResult( resultList );
|
||||
|
||||
//清理
|
||||
V2XServiceManager.getMoGoWarnPolylineManager().clearLine();
|
||||
|
||||
// 绘制连接线 TODO 来的是列表数据
|
||||
// V2XServiceManager.getMoGoWarnPolylineManager().drawableWarnPolyline(context, roadEventEntity);
|
||||
|
||||
//更新数据
|
||||
for (ADASRecognizedResult result : resultList) {
|
||||
MogoLatLng latLng = new MogoLatLng(result.lat, result.lon);
|
||||
lonLats.add(latLng);
|
||||
}
|
||||
|
||||
IMogoPolyline mMogoPolyline = V2XServiceManager.getMoGoWarnPolylineManager().getMogoWarnPolyline();
|
||||
mMogoPolyline.setPoints(lonLats);
|
||||
|
||||
} );
|
||||
|
||||
//绘制自车数据 liyz
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -342,4 +313,12 @@ public class V2XServiceManager {
|
||||
public static IEventPanelProvider getEventPanelProvider() {
|
||||
return mIEventPanelProvider;
|
||||
}
|
||||
|
||||
public static IMogoADASController getmIMogoADASController() {
|
||||
return mIMogoADASController;
|
||||
}
|
||||
|
||||
public static void setmIMogoADASController(IMogoADASController mIMogoADASController) {
|
||||
V2XServiceManager.mIMogoADASController = mIMogoADASController;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,151 @@
|
||||
package com.mogo.module.v2x;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.overlay.IMogoPolyline;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.drawer.AdasRecognizedResultDrawer;
|
||||
import com.mogo.module.v2x.entity.model.DrawLineInfo;
|
||||
import com.mogo.module.v2x.listener.V2XMessageListener_401011;
|
||||
import com.mogo.realtime.entity.ADASRecognizedResult;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static com.mogo.module.v2x.V2XServiceManager.getContext;
|
||||
|
||||
/**
|
||||
* desc : V2X报警事件管理,这里进行报警事件的分发处理,包括了adas数据
|
||||
*/
|
||||
public class V2XWaringManager {
|
||||
|
||||
List<MogoLatLng> lonLats = new ArrayList<>();
|
||||
List<ADASRecognizedResult> resultList = new ArrayList<>();
|
||||
private Context mContext;
|
||||
|
||||
private static V2XWaringManager mV2XWaringManager;
|
||||
//TODO 需要修改
|
||||
private V2XMessageListener_401011 v2XMessageListener_401011;
|
||||
|
||||
|
||||
private V2XWaringManager() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取操作实体
|
||||
*/
|
||||
public static synchronized V2XWaringManager getInstance() {
|
||||
synchronized (V2XWaringManager.class) {
|
||||
if (mV2XWaringManager == null) {
|
||||
mV2XWaringManager = new V2XWaringManager();
|
||||
}
|
||||
}
|
||||
return mV2XWaringManager;
|
||||
}
|
||||
|
||||
/**
|
||||
* 注册长链接消息处理
|
||||
*/
|
||||
public void registerAdasSocketMessage(Context context) {
|
||||
Logger.d("liyz", "开始注册Socket通道....");
|
||||
mContext = context;
|
||||
|
||||
register401011();
|
||||
handleAdasData();
|
||||
}
|
||||
|
||||
/**
|
||||
* 反注册消息通道,不再进行接受
|
||||
*/
|
||||
public void unregisterAdasSocketMessage() {
|
||||
Logger.w("liyz", "反注册Socket通道....");
|
||||
if (v2XMessageListener_401011 != null) {
|
||||
V2XServiceManager
|
||||
.getMoGoSocketManager()
|
||||
.unregisterOnMessageListener(401011, v2XMessageListener_401011);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 道路事件,行人
|
||||
*/
|
||||
private void register401011() {
|
||||
v2XMessageListener_401011 = new V2XMessageListener_401011();
|
||||
// 道路事件,在线车辆绘制
|
||||
V2XServiceManager
|
||||
.getMoGoSocketManager()
|
||||
.registerOnMessageListener(
|
||||
401011,
|
||||
v2XMessageListener_401011
|
||||
);
|
||||
}
|
||||
|
||||
public V2XMessageListener_401011 getV2XMessageListener_401011() {
|
||||
return v2XMessageListener_401011;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 处理adas返回的数据
|
||||
*/
|
||||
private void handleAdasData() {
|
||||
Log.d("liyz", "V2XWaringManager ---- handleAdasData ---0-- ");
|
||||
//清理
|
||||
V2XServiceManager.getMoGoWarnPolylineManager().clearLine();
|
||||
|
||||
// 绘制连接线 TODO 来的是列表数据
|
||||
DrawLineInfo info1 = new DrawLineInfo();
|
||||
MogoLatLng startLatlng1 = new MogoLatLng(39.968919,116.407642);
|
||||
MogoLatLng endLatlng1 = new MogoLatLng(39.977173,116.417555);
|
||||
info1.setStartLocation(startLatlng1);
|
||||
info1.setEndLocation(endLatlng1);
|
||||
V2XServiceManager.getMoGoWarnPolylineManager().drawableWarnPolyline(getContext(), info1);
|
||||
|
||||
|
||||
// adas 每隔一秒传递的他车或行人数据
|
||||
V2XServiceManager.getmIMogoADASController().addAdasRecognizedDataCallback(resultList -> {
|
||||
// 绘制近景识别到的车辆,行人和二轮车 TODO
|
||||
AdasRecognizedResultDrawer.getInstance().renderAdasRecognizedResult( resultList );
|
||||
Log.d("liyz", "V2XWaringManager ---- handleAdasData ----- ");
|
||||
|
||||
//清理
|
||||
V2XServiceManager.getMoGoWarnPolylineManager().clearLine();
|
||||
|
||||
// 绘制连接线 TODO 来的是列表数据
|
||||
DrawLineInfo info = new DrawLineInfo();
|
||||
MogoLatLng startLatlng = new MogoLatLng(39.969247,116.407299);
|
||||
MogoLatLng endLatlng = new MogoLatLng(39.971089,116.407384);
|
||||
info.setStartLocation(startLatlng);
|
||||
info.setEndLocation(endLatlng);
|
||||
V2XServiceManager.getMoGoWarnPolylineManager().drawableWarnPolyline(mContext, info);
|
||||
|
||||
//更新数据
|
||||
for (ADASRecognizedResult result : resultList) {
|
||||
MogoLatLng latLng = new MogoLatLng(result.lat, result.lon);
|
||||
lonLats.add(latLng);
|
||||
}
|
||||
IMogoPolyline mMogoPolyline = V2XServiceManager.getMoGoWarnPolylineManager().getMogoWarnPolyline();
|
||||
mMogoPolyline.setPoints(lonLats);
|
||||
|
||||
} );
|
||||
|
||||
double lon = MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLon();
|
||||
double lat = MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLat();
|
||||
Log.d("liyz", "lon = " + lon + "----lat = " + lat);
|
||||
|
||||
//绘制自车数据 liyz
|
||||
// DrawLineInfo info = new DrawLineInfo();
|
||||
// MogoLatLng startLatlng = new MogoLatLng(lat,lon); //我的位置
|
||||
// MogoLatLng endLatlng = new MogoLatLng(39.971089,); //交点位置
|
||||
// info.setStartLocation(startLatlng);
|
||||
// info.setEndLocation(endLatlng);
|
||||
// V2XServiceManager.getMoGoWarnPolylineManager().drawableWarnPolyline(mContext, info);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.mogo.module.v2x.manager.impl;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.map.MogoLatLng;
|
||||
@@ -22,7 +23,6 @@ import java.util.List;
|
||||
*/
|
||||
@Route(path = MoGoV2XServicePaths.PATH_V2X_WARN_POLYLINE_MANAGER)
|
||||
public class MoGoWarnPolylineManager implements IMoGoWarnPolylineManager {
|
||||
private static final String TAG = "MoGoWarnPolylineManager";
|
||||
private static IMogoPolyline mMogoPolyline;
|
||||
|
||||
|
||||
@@ -39,25 +39,27 @@ public class MoGoWarnPolylineManager implements IMoGoWarnPolylineManager {
|
||||
// 渐变色
|
||||
List<Integer> colors = new ArrayList<>();
|
||||
|
||||
if (info.getType().equals("1")) { //预警 TODO
|
||||
colors.add(0xFFFFA31A);
|
||||
colors.add(0xFFFFA31A);
|
||||
} else {
|
||||
colors.add(0xFFE32F46);
|
||||
colors.add(0xFFE32F46);
|
||||
}
|
||||
// if (info.getType().equals("1")) { //预警 TODO
|
||||
// colors.add(0xFFFFA31A);
|
||||
// colors.add(0xFFFFA31A);
|
||||
// } else {
|
||||
// colors.add(0xFFE32F46);
|
||||
// colors.add(0xFFE32F46);
|
||||
// }
|
||||
|
||||
colors.add(0xFF3036);
|
||||
colors.add(0xFF3036);
|
||||
|
||||
// 线条粗细,渐变,渐变色值
|
||||
options.width(30).useGradient(true).colorValues(colors);
|
||||
|
||||
options.width(60).useGradient(true).colorValues(colors);
|
||||
// 当前车辆位置
|
||||
options.add(info.getStartLocation());
|
||||
|
||||
// 目标车辆位置
|
||||
options.add(info.getStartLocation());
|
||||
options.add(info.getEndLocation());
|
||||
|
||||
// 绘制线的对象
|
||||
mMogoPolyline = V2XServiceManager.getMogoOverlayManager().addPolyline(options);
|
||||
Log.d("liyz", "MoGoWarnPolylineManager drawableWarnPolyline -----> ");
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
||||
@@ -3,8 +3,10 @@ package com.mogo.module.v2x.receiver;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.util.Log;
|
||||
|
||||
import com.mogo.module.v2x.V2XConst;
|
||||
import com.mogo.module.v2x.V2XWaringManager;
|
||||
import com.mogo.realtime.entity.ADASRecognizedResult;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.mogo.utils.network.utils.GsonUtil;
|
||||
@@ -17,10 +19,11 @@ public class AdasDataBroadcastReceiver extends BroadcastReceiver {
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
try {
|
||||
ADASRecognizedResult adasResult = (ADASRecognizedResult) intent.getSerializableExtra(V2XConst.BROADCAST_ADAS_EXTRA_KEY);
|
||||
Logger.d("AdasDataBroadcastReceiver", "adasResult:" + GsonUtil.jsonFromObject(adasResult));
|
||||
|
||||
// V2XScenarioManager.getInstance().handlerMessage(adasResult);
|
||||
// ADASRecognizedResult adasResult = (ADASRecognizedResult) intent.getSerializableExtra(V2XConst.BROADCAST_ADAS_EXTRA_KEY);
|
||||
// Logger.d("liyz", "AdasDataBroadcastReceiver -->" + GsonUtil.jsonFromObject(adasResult));
|
||||
String adasResult = (String) intent.getSerializableExtra(V2XConst.BROADCAST_ADAS_EXTRA_KEY);
|
||||
Log.d("liyz", "AdasDataBroadcastReceiver -----> ");
|
||||
V2XWaringManager.getInstance().registerAdasSocketMessage(context);
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.mogo.module.v2x.receiver;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.util.Log;
|
||||
|
||||
import com.mogo.module.v2x.V2XConst;
|
||||
import com.mogo.module.common.entity.V2XMessageEntity;
|
||||
@@ -24,6 +25,7 @@ public class SceneBroadcastReceiver extends BroadcastReceiver {
|
||||
try {
|
||||
V2XMessageEntity v2XMessageEntity = (V2XMessageEntity) intent.getSerializableExtra(V2XConst.BROADCAST_SCENE_EXTRA_KEY);
|
||||
//Logger.d(TAG, "v2XMessageEntity:" + GsonUtil.jsonFromObject(v2XMessageEntity));
|
||||
Log.d("liyz", "SceneBroadcastReceiver ------->");
|
||||
V2XScenarioManager.getInstance().handlerMessage(v2XMessageEntity);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
||||
@@ -66,6 +66,7 @@ public class V2XTestConsoleWindow extends ConstraintLayout {
|
||||
private Button mBtnTriggerTrafficSearch;
|
||||
private Button mBtnTriggerRecommendRouteEvent;
|
||||
private ToggleButton nBtnTriggerVR;
|
||||
private Button mBtnAdasDataWarn;
|
||||
|
||||
private Button btnTriggerRearVIPCarTip,
|
||||
btnTriggerVehicleBrakes,
|
||||
@@ -129,6 +130,7 @@ public class V2XTestConsoleWindow extends ConstraintLayout {
|
||||
mBtnTriggerTrafficSearch = findViewById(R.id.btnTriggerTrafficSearch);
|
||||
mBtnTriggerRecommendRouteEvent = findViewById(R.id.btnTriggerRecommendRouteEvent);
|
||||
nBtnTriggerVR = findViewById(R.id.btnTriggerVR);
|
||||
mBtnAdasDataWarn = findViewById(R.id.btnAdasDataWarn);
|
||||
|
||||
switch (showType) {
|
||||
case 0:
|
||||
@@ -301,6 +303,12 @@ public class V2XTestConsoleWindow extends ConstraintLayout {
|
||||
LocalBroadcastManager.getInstance(getContext()).sendBroadcast(intent);
|
||||
});
|
||||
|
||||
mBtnAdasDataWarn.setOnClickListener(v -> {
|
||||
Intent intent = new Intent(V2XConst.BROADCAST_ADAS_SCENE_HANDLER_ACTION);
|
||||
intent.putExtra(V2XConst.BROADCAST_ADAS_EXTRA_KEY, "23");
|
||||
getContext().sendBroadcast(intent);
|
||||
});
|
||||
|
||||
mBtnTriggerTrafficSearch.setOnClickListener(v -> V2XServiceManager.getIMogoTrafficUploadProvider().verifyCurrentTrafficStatus());
|
||||
|
||||
mBtnTriggerRecommendRouteEvent.setOnClickListener(view -> {
|
||||
|
||||
@@ -461,7 +461,22 @@
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnAdasDataWarn"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/dp_10"
|
||||
android:layout_marginBottom="@dimen/dp_10"
|
||||
android:background="#8BC34A"
|
||||
android:padding="@dimen/dp_10"
|
||||
android:text="adas预警数据发送"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="@dimen/dp_22"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
</com.google.android.flexbox.FlexboxLayout>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
Reference in New Issue
Block a user