This commit is contained in:
wangcongtao
2021-01-25 18:42:18 +08:00
parent 0c77c3b98f
commit 0d0c39af67
9 changed files with 103 additions and 5 deletions

View File

@@ -27,6 +27,8 @@ 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.entity.ADASCarStateInfo;
import com.mogo.service.entrance.ButtonIndex;
import com.mogo.utils.CoordinateUtils;
import com.mogo.utils.TipToast;
@@ -35,6 +37,11 @@ import com.mogo.utils.logger.Logger;
import com.mogo.utils.network.utils.GsonUtil;
import com.mogo.utils.storage.SharedPrefsMgr;
import org.json.JSONObject;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
@@ -479,6 +486,58 @@ public class MockIntentHandler implements IntentHandler {
// adb shell am broadcast -a com.mogo.mock --ei oper 41 --ei type 1 直接打点
DebugConfig.setNotSmooth( intent.getIntExtra( "type", 0 ) == 1 );
break;
case 42:
WorkThreadHandler.getInstance().post( () -> {
try {
InputStream is = context.getAssets().open( "coors.json" );
BufferedReader br = new BufferedReader( new InputStreamReader( is ) );
String line = "";
List< ADASCarStateInfo > vals = new ArrayList<>();
while ( ( line = br.readLine() ) != null ) {
String[] json = line.split( " - " );
long time = Long.valueOf( json[0] );
ADASCarStateInfo si = GsonUtil.objectFromJson( json[1], ADASCarStateInfo.class );
// si.getValues().setSatelliteTime( time + "" );
vals.add( si );
}
long interval = -1;
ADASCarStateInfo last = null;
for ( ADASCarStateInfo val : vals ) {
if ( last == null ) {
interval = 0;
} else {
interval = Long.valueOf( val.getValues().getSatelliteTime() ) - Long.valueOf( last.getValues().getSatelliteTime() );
}
last = val;
WorkThreadHandler.getInstance().postDelayed( () -> {
onAdasCarDataCallback( val );
}, interval );
}
} catch ( Exception e ) {
e.printStackTrace();
}
} );
break;
}
}
public void onAdasCarDataCallback( ADASCarStateInfo stateInfo ) {
if ( stateInfo != null && stateInfo.getValues() != null ) {
JSONObject data = new JSONObject();
try {
data.putOpt( "lon", stateInfo.getValues().getLon() );
data.putOpt( "lat", stateInfo.getValues().getLat() );
data.putOpt( "alt", stateInfo.getValues().getAlt() );
data.putOpt( "speed", stateInfo.getValues().getGnss_speed() );
data.putOpt( "satelliteTime", stateInfo.getValues().getSatelliteTime() );
data.putOpt( "heading", stateInfo.getValues().getHeading() );
data.putOpt( "acceleration", stateInfo.getValues().getAcceleration() );
data.putOpt( "yawRate", stateInfo.getValues().getYaw_rate() );
MarkerServiceHandler.getApis().getMapServiceApi().getMapUIController().syncLocation2Map( data );
// SnapshotUploadInTime.getInstance().syncAdasLocationInfo( data );
} catch ( Exception e ) {
e.printStackTrace();
}
}
}