add new func of mockData

This commit is contained in:
zhongchao
2021-05-17 16:50:17 +08:00
parent 5ea48d4f35
commit 9f2eb25774
6 changed files with 145 additions and 113 deletions

View File

@@ -95,7 +95,7 @@ class CustomMapApiBuilder implements IMogoMapApiBuilder {
public IMogoMapView getMapView( Context context ) {
Log.d(TAG,"setDebugMode==true");
NavAutoApi.INSTANCE.init( context, MapParams.Companion.init()
.setDebugMode( true )
.setDebugMode( false )
.setCoordinateType( MapParams.COORDINATETYPE_GCJ02 )
.setPerspectiveMode( MapParams.MAP_PERSPECTIVE_2D )
.setZoom( 20 )

View File

@@ -35,6 +35,7 @@ import com.mogo.module.common.uploadintime.SnapshotLocationController;
import com.mogo.module.service.MarkerServiceHandler;
import com.mogo.module.service.R;
import com.mogo.module.service.status.EnvStatusManager;
import com.mogo.module.service.timedelay.TimeDelayUploadManager;
import com.mogo.realtime.entity.ADASRecognizedResult;
import com.mogo.realtime.entity.CloudRoadData;
import com.mogo.realtime.entity.MogoSnapshotSetData;
@@ -617,6 +618,10 @@ public class MockIntentHandler implements IntentHandler {
case 54:
mTimeTickCarHandler.sendEmptyMessageDelayed(1, 0L);
break;
case 55:
//开启模拟数据Mock用于验证算法准确性
TimeDelayUploadManager.getInstance().init(context);
break;
}
}

View File

@@ -0,0 +1,50 @@
package com.mogo.module.service.network.bean;
public class MockSocketReceiverData {
public static final int MOCK_RECEIVER_STATUS_START = 0;
public static final int MOCK_RECEIVER_STATUS_STOP = 1;
private int status;
private double lat;
private double lon;
private double heading;
private long systemTime;
private long satelliteTime;
public int getStatus() {
return status;
}
public double getLat() {
return lat;
}
public double getLon() {
return lon;
}
public double getHeading() {
return heading;
}
public long getSystemTime() {
return systemTime;
}
public long getSatelliteTime() {
return satelliteTime;
}
@Override
public String toString() {
return "MockSocketReceiverData{" +
"status=" + status +
", lat=" + lat +
", lon=" + lon +
", heading=" + heading +
", systemTime=" + systemTime +
", satelliteTime=" + satelliteTime +
'}';
}
}

View File

@@ -1,23 +1,44 @@
package com.mogo.module.service.timedelay;
import android.content.Context;
import android.os.Handler;
import android.os.Message;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.uploadintime.SnapshotLocationController;
import com.mogo.module.service.MarkerServiceHandler;
import com.mogo.module.service.network.bean.MockSocketReceiverData;
import com.mogo.realtime.api.MoGoAiCloudRealTime;
import com.mogo.realtime.entity.MogoSnapshotSetData;
import com.mogo.realtime.socket.IMogoCloudOnMsgListener;
import com.mogo.service.connection.IMogoOnMessageListener;
import com.mogo.utils.WorkThreadHandler;
import com.mogo.utils.logger.Logger;
import org.json.JSONException;
import org.json.JSONObject;
import static com.mogo.module.service.network.bean.MockSocketReceiverData.MOCK_RECEIVER_STATUS_START;
/**
* 接收服务端模拟定位数据对下发数据做实时Post上报统计时延
*/
public class TimeDelayUploadManager implements IMogoOnMessageListener {
public class TimeDelayUploadManager implements IMogoOnMessageListener<MockSocketReceiverData>, IMogoCloudOnMsgListener {
private static final String TAG = "TimeDelayUploadManager";
private volatile static TimeDelayUploadManager timeDelayUploadManager;
private static final int MSG_SOCKET_TYPE = 403000;
private static final int MOCK_MSG = 1;
private boolean isMockData = false;
private MockSocketReceiverData mMockData;
private long mRecordSatelliteTime; //todo 后续多点模拟用
private TimeDelayUploadManager() {
}
public TimeDelayUploadManager getInstance() {
public static TimeDelayUploadManager getInstance() {
if (timeDelayUploadManager == null) {
synchronized (TimeDelayUploadManager.class) {
if (timeDelayUploadManager == null) {
@@ -31,16 +52,71 @@ public class TimeDelayUploadManager implements IMogoOnMessageListener {
public void init(Context mContext) {
MogoApisHandler.getInstance()
.getApis()
.getSocketManagerApi(mContext).registerOnMessageListener(MSG_SOCKET_TYPE,this);
.getSocketManagerApi(mContext).registerOnMessageListener(MSG_SOCKET_TYPE, this);
MoGoAiCloudRealTime.registerOnMsgListener(this);
}
private final Handler mockHandler = new Handler(WorkThreadHandler.newInstance("mock-algorithm-work-thread").getLooper()) {
@Override
public void handleMessage(Message msg) {
super.handleMessage(msg);
if (msg.what == MOCK_MSG) {
//改变地图定位数据,触发自车移动
JSONObject jo = new JSONObject();
try {
jo.put("lon", mMockData.getLon());
jo.put("lat", mMockData.getLat());
jo.put("heading", mMockData.getHeading());
jo.put("systemTime", System.currentTimeMillis());
jo.put("satelliteTime", System.currentTimeMillis());
} catch (JSONException e) {
e.printStackTrace();
}
Logger.d(TAG, "更改自车定位点");
MarkerServiceHandler.getApis().getMapServiceApi().getMapUIController().syncLocation2Map(jo);
Logger.d(TAG, "同步定位信息,用于上报");
SnapshotLocationController.getInstance().syncAdasLocationInfo(jo);
mockHandler.sendEmptyMessageDelayed(MOCK_MSG, 50);
}
}
};
@Override
public Class<MockSocketReceiverData> target() {
return MockSocketReceiverData.class;
}
//接收socket数据
@Override
public void onMsgReceived(MockSocketReceiverData mockData) {
Logger.d(TAG, "onMsgReceived obj : " + mockData.toString());
if (mockData.getStatus() == MOCK_RECEIVER_STATUS_START) {
isMockData = true;
//开启定位模拟
mMockData = mockData;
mRecordSatelliteTime = mockData.getSatelliteTime();
mockHandler.sendEmptyMessage(MOCK_MSG);
} else {
isMockData = false;
//停止定位模拟
if (mockHandler.hasMessages(MOCK_MSG)) {
mockHandler.removeMessages(MOCK_MSG);
mMockData = null;
mRecordSatelliteTime = 0;
}
}
}
@Override
public Class target() {
return null;
public void onMsgSend(long id) {
}
//接收实时数据监听回调,用于给服务端上报时延
@Override
public void onMsgReceived(Object obj) {
public void onMsgReceived(MogoSnapshotSetData mogoSnapshotSetData) {
if (isMockData) {
//接口数据上报
}
}
}

View File

@@ -6,6 +6,12 @@
<dimen name="module_v2x_road_event_icon_width">133px</dimen>
<dimen name="module_v2x_road_event_icon_height">133px</dimen>
<dimen name="module_ext_top_view_no_link_width_in_vr_mode">778px</dimen>
<dimen name="module_v2x_event_see_live_window_height_vr">687px</dimen>
<dimen name="module_v2x_event_window_top_margin_vr">200px</dimen>
<dimen name="module_v2x_event_window_close_distance">10px</dimen>
<dimen name="module_v2x_event_window_height_vr_for_item">487px</dimen>
<dimen name="module_v2x_event_window_width_vr">778px</dimen>
<dimen name="module_v2x_fatigue_driving_window_height_ground">234px</dimen>
<dimen name="module_v2x_fault_help_width">1067px</dimen>

View File

@@ -1,105 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<resources>
<!--联想PAD适配-->
<dimen name="module_main_v2x_animation_width">800px</dimen>
<dimen name="module_v2x_search_marginLeft">32px</dimen>
<dimen name="module_v2x_operation_panel_share_goneMarginRight">32px</dimen>
<dimen name="module_v2x_push_img_height">390px</dimen>
<dimen name="module_v2x_push_img_container_height">410px</dimen>
<dimen name="module_v2x_event_icon_size">160px</dimen>
<dimen name="module_v2x_event_distance_text">60px</dimen>
<dimen name="module_v2x_event_distance_title">40px</dimen>
<dimen name="module_v2x_history_event_icon_size">80px</dimen>
<dimen name="module_ext_top_view_no_link_width_in_vr_mode">778px</dimen>
<dimen name="module_v2x_event_see_live_window_height_vr">687px</dimen>
<dimen name="module_v2x_event_window_top_margin_vr">200px</dimen>
<dimen name="module_v2x_event_window_close_distance">10px</dimen>
<dimen name="module_v2x_event_window_height_vr_for_item">487px</dimen>
<dimen name="module_v2x_event_window_width_vr">778px</dimen>
<dimen name="module_v2x_surrounding_item_bottom_size">15px</dimen>
<dimen name="module_v2x_map_left">550px</dimen>
<dimen name="module_v2x_map_top">200px</dimen>
<dimen name="module_v2x_map_right">200px</dimen>
<dimen name="module_v2x_map_bottom">100px</dimen>
<dimen name="module_v2x_surrounding_top_height">90px</dimen>
<dimen name="module_v2x_surrounding_top_bt_width">162px</dimen>
<dimen name="module_v2x_surrounding_top_bt_height">64px</dimen>
<dimen name="module_v2x_surrounding_empty_iv_margin_top">80px</dimen>
<dimen name="module_v2x_surrounding_empty_tv_margin_top">26px</dimen>
<dimen name="module_v2x_surrounding_empty_bt_width">270px</dimen>
<dimen name="module_v2x_surrounding_empty_bt_height">86px</dimen>
<dimen name="module_v2x_surrounding_empty_bt_margin_top">58px</dimen>
<dimen name="module_v2x_surrounding_root_margin_left">48px</dimen>
<dimen name="module_v2x_surrounding_margin_left">48px</dimen>
<dimen name="module_v2x_surrounding_empty_image_height">349px</dimen>
<dimen name="module_v2x_surrounding_item_width">465px</dimen>
<dimen name="module_v2x_surrounding_item_height">306px</dimen>
<dimen name="module_v2x_surrounding_item_bottom">77px</dimen>
<dimen name="module_v2x_surrounding_item_bottom_image_height">50px</dimen>
<dimen name="module_v2x_surrounding_item_marigin_left">28px</dimen>
<dimen name="module_v2x_surrounding_item_marigin_bottom_left">16px</dimen>
<dimen name="module_v2x_panel_surrounding_marginbottom">5px</dimen>
<dimen name="module_v2x_panel_surrounding_stance">80px</dimen>
<dimen name="module_v2x_surrounding_top">22px</dimen>
<dimen name="module_v2x_surrounding_list_margin_left">20px</dimen>
<dimen name="module_v2x_surrounding_item_margin_left">30px</dimen>
<dimen name="module_v2x_surrounding_refresh_bt_radius">42px</dimen>
<dimen name="module_v2x_surrounding_top_textsize">30px</dimen>
<dimen name="module_v2x_surrounding_item_bottom_left_textsize">36px</dimen>
<dimen name="module_v2x_surrounding_item_bottom_right_textsize">30px</dimen>
<dimen name="module_v2x_surrounding_item_maigin_left">50px</dimen>
<dimen name="module_v2x_panel_width">120px</dimen>
<dimen name="module_v2x_panel_tab_height">158px</dimen>
<!--适配 V2X 弹窗 UI-->
<dimen name="module_v2x_event_type_title_text_size">20px</dimen>
<dimen name="module_v2x_event_title_text_size">36px</dimen>
<dimen name="module_v2x_event_sub_title_text_size">28px</dimen>
<dimen name="module_v2x_event_head_size">55px</dimen>
<dimen name="module_v2x_event_live_error_text_size">36px</dimen>
<dimen name="module_v2x_live_window_height">310px</dimen>
<dimen name="module_v2x_event_button_size">110px</dimen>
<dimen name="module_v2x_event_button_size_detail">120px</dimen>
<!--道路事件 高的弹窗-->
<dimen name="module_v2x_event_image_height">270px</dimen>
<dimen name="module_v2x_event_image_width">480px</dimen>
<dimen name="module_v2x_event_window_height">330px</dimen>
<dimen name="module_v2x_event_window_height_ground">450px</dimen>
<!--疲劳驾驶、违章停车、道路求助-->
<dimen name="module_v2x_fatigue_driving_window_height_ground">200px</dimen>
<dimen name="module_v2x_event_help_head_size">75px</dimen>
<dimen name="module_v2x_event_help_title_text_size">32px</dimen>
<dimen name="module_v2x_event_help_sub_title_text_size">26px</dimen>
<dimen name="module_v2x_event_help_distance_text_size">80px</dimen>
<dimen name="module_v2x_event_parking_text_size">34px</dimen>
<!--最优路线-->
<dimen name="module_v2x_event_warning_type_image_size">133px</dimen>
<dimen name="module_v2x_event_warning_type_text_size">42px</dimen>
<!--适配 V2X 弹窗 UI-->
<dimen name="module_v2x_event_panel_btn_x">940px</dimen>
<dimen name="module_v2x_event_panel_btn_y">701px</dimen>
<dimen name="v2x_driving_width">150px</dimen>
<dimen name="v2x_driving_heigt">46px</dimen>
<dimen name="v2x_recommond_route_size">26px</dimen>
</resources>