wait to finish of mockdata
This commit is contained in:
@@ -617,6 +617,10 @@ public class MockIntentHandler implements IntentHandler {
|
||||
case 55:
|
||||
//开启模拟数据Mock,用于验证算法准确性
|
||||
TimeDelayUploadManager.getInstance().init(context);
|
||||
break;
|
||||
case 56:
|
||||
// 开启数据采集 自车定位和视觉识别
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
package com.mogo.module.service.mocktools;
|
||||
|
||||
import android.os.Environment;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
|
||||
import com.mogo.utils.WorkThreadHandler;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class DataCollectionHandler {
|
||||
|
||||
private static volatile DataCollectionHandler handler;
|
||||
private static final byte[] obj = new byte[0];
|
||||
private volatile boolean openDataCollect = false;
|
||||
|
||||
private Handler mLocationDataCollectHandler;
|
||||
private Handler mRecognizeDataCollectHandler;
|
||||
|
||||
private static final String WRITE_FILE_PATH = Environment.getExternalStorageDirectory().getPath() + File.separator + "mockWrite";
|
||||
|
||||
private DataCollectionHandler() {
|
||||
|
||||
}
|
||||
|
||||
public static DataCollectionHandler getInstance() {
|
||||
if (handler == null) {
|
||||
synchronized (obj) {
|
||||
if (handler == null) {
|
||||
handler = new DataCollectionHandler();
|
||||
}
|
||||
}
|
||||
}
|
||||
return handler;
|
||||
}
|
||||
|
||||
public void start() {
|
||||
openDataCollect = true;
|
||||
}
|
||||
|
||||
public boolean canCollectData() {
|
||||
return openDataCollect;
|
||||
}
|
||||
|
||||
public void collectLocationDataToFile(String locationData) {
|
||||
if (mLocationDataCollectHandler == null) {
|
||||
mLocationDataCollectHandler = new Handler(WorkThreadHandler.newInstance("data-collect-thread").getLooper()) {
|
||||
@Override
|
||||
public void handleMessage(Message msg) {
|
||||
super.handleMessage(msg);
|
||||
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public void collectRecogniseDataToFile() {
|
||||
if (mRecognizeDataCollectHandler == null) {
|
||||
mRecognizeDataCollectHandler = new Handler(WorkThreadHandler.newInstance("recognize-collect-thread").getLooper()) {
|
||||
@Override
|
||||
public void handleMessage(Message msg) {
|
||||
super.handleMessage(msg);
|
||||
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public void stop() {
|
||||
openDataCollect = false;
|
||||
mLocationDataCollectHandler = null;
|
||||
mRecognizeDataCollectHandler = null;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user