add mock data

This commit is contained in:
lixiaopeng
2021-04-19 18:10:54 +08:00
parent b675432059
commit 56d0a5b812
7 changed files with 69 additions and 2 deletions

View File

@@ -1 +0,0 @@
{"systemTime":1615529718585,"satelliteTime":1615529718585,"lon":116.411411222501,"lat":39.9753341630918,"alt":34.4018669128417,"heading":0.342695406938048,"speed":0.003303937,"type":3,"uuid":"2_1"}

View File

@@ -1 +0,0 @@
{"systemTime":1615529718585,"satelliteTime":1615529718585,"lon":116.411411222501,"lat":39.9753341630918,"alt":34.4018669128417,"heading":0.342695406938048,"speed":0.003303937,"type":3,"uuid":"2_1"}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -625,6 +625,9 @@ public class MockIntentHandler implements IntentHandler {
boolean isUseAdasRecognize = intent.getBooleanExtra( "status", false );
DebugConfig.setUseAdasRecognize( isUseAdasRecognize );
break;
case 54:
mTimeTickCarHandler.sendEmptyMessageDelayed( 1, 0L );
break;
}
}
@@ -679,6 +682,7 @@ public class MockIntentHandler implements IntentHandler {
}
}
private Handler mLocationMockHandler = new Handler( WorkThreadHandler.newInstance( "loc-mock-thread" ).getLooper() ) {
@Override
public void handleMessage( Message msg ) {
@@ -740,9 +744,28 @@ public class MockIntentHandler implements IntentHandler {
}
roadSizeBr = null;
}
} else if (msg.what == 8) {
try {
handleMockAdasCarIntent();
} catch ( Exception e ) {
try {
if ( readers2 != null ) {
for ( BufferedReader reader : readers2 ) {
if (reader != null) {
reader.close();
}
}
}
} catch ( IOException ex ) {
ex.printStackTrace();
}
readers2 = null;
}
}
}
};
private Handler mLocationMockHandler1 = new Handler( WorkThreadHandler.newInstance( "loc-mock-thread1" ).getLooper() ) {
@Override
public void handleMessage( Message msg ) {
@@ -780,6 +803,19 @@ public class MockIntentHandler implements IntentHandler {
}
};
private Handler mTimeTickCarHandler = new Handler( WorkThreadHandler.newInstance( "loc-time-mock-thread" ).getLooper() ) {
@Override
public void handleMessage( Message msg ) {
super.handleMessage( msg );
mLocDelay += 50;
if ( mLocDelay > 4_000L ) {
mLocationMockHandler1.sendEmptyMessageDelayed( 1, 0L );
}
mLocationMockHandler.sendEmptyMessageDelayed( 8, 0L );
mTimeTickCarHandler.sendEmptyMessageDelayed( 0, 50L );
}
};
private BufferedReader br;
private boolean handleMockLocationIntent() throws Exception {
@@ -792,6 +828,7 @@ public class MockIntentHandler implements IntentHandler {
throw new Exception( "end of file." );
}
JSONObject jo = new JSONObject( line );
//改变rtk定位数据触发自车移动
MarkerServiceHandler.getApis().getMapServiceApi().getMapUIController().syncLocation2Map( jo );
Log.i( "mock-timer-loc-map", "cost " + ( System.currentTimeMillis() - start ) + "ms" );
SnapshotLocationController.getInstance().syncAdasLocationInfo( jo );
@@ -830,6 +867,7 @@ public class MockIntentHandler implements IntentHandler {
}
private BufferedReader[] readers = null;
private BufferedReader[] readers2 = null;
private boolean handleMockAdasIntent() throws Exception {
final long start = System.currentTimeMillis();
@@ -858,6 +896,33 @@ public class MockIntentHandler implements IntentHandler {
return true;
}
private boolean handleMockAdasCarIntent() throws Exception {
final long start = System.currentTimeMillis();
if ( readers2 == null ) {
readers2 = new BufferedReader[3];
for ( int i = 0; i < 3; i++ ) {
readers2[i] = new BufferedReader( new InputStreamReader( AbsMogoApplication.getApp().getAssets().open( "adascar" + i + ".txt" ) ) );
}
}
List< ADASRecognizedResult > allList = new ArrayList<>();
for ( BufferedReader reader : readers2 ) {
String line = reader.readLine();
ADASRecognizedResult adasRecognizedResult = GsonUtil.objectFromJson( line, ADASRecognizedResult.class );
if ( adasRecognizedResult != null ) {
allList.add( adasRecognizedResult );
}
}
AdasRec adasRec = new AdasRec();
adasRec.models = allList;
MogoApisHandler.getInstance().getApis().getAdasControllerApi().mockAdasRecognized( GsonUtil.jsonFromObject( adasRec ) );
Log.i( "mock-timer-adas", "cost " + ( System.currentTimeMillis() - start ) + "ms" );
return true;
}
public static class AdasRec{
public String action = "view";
public List<ADASRecognizedResult> models;

View File

@@ -330,6 +330,7 @@ public class MogoADASController implements IMogoADASController {
Logger.w( TAG, "--->action is null" );
return;
}
//识别的他车移动操作
mAdasMessageFactory.createMessage( action ).handlerMsg( GsonUtil.getGson(), mOnAdasListener, detectResult );
} catch ( JSONException e ) {
e.printStackTrace();