| | |
| | | import com.google.gson.reflect.TypeToken; |
| | | |
| | | |
| | | import org.json.JSONException; |
| | | import org.json.JSONObject; |
| | | |
| | | import java.lang.reflect.Type; |
| | | import java.util.List; |
| | | import java.util.concurrent.ExecutorService; |
| | |
| | | import safeluck.drive.evaluation.bean.RealTimeCarPos; |
| | | import safeluck.drive.evaluation.cEventCenter.CEventCenter; |
| | | import safeluck.drive.evaluation.cEventCenter.ICEventListener; |
| | | import safeluck.drive.evaluation.util.CThreadPoolExecutor; |
| | | import safeluck.drive.evaluation.util.FileUtil; |
| | | |
| | | |
| | |
| | | */ |
| | | public class MapFragment extends SupportFragment { |
| | | private boolean isDrawing = false; |
| | | private ICEventListener rtcmicEventListener = new ICEventListener() { |
| | | @Override |
| | | public void onCEvent(String topic, int msgCode, int resultCode, final Object obj) { |
| | | if (msgCode == Constant.DEBUG_RTCM){ |
| | | |
| | | CThreadPoolExecutor.runOnMainThread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | Log.i(TAG, "title="+(String)obj); |
| | | toolbar.setTitle((String)obj); |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | }; |
| | | private ICEventListener debugTxticEventListener = new ICEventListener() { |
| | | @Override |
| | | public void onCEvent(String topic, int msgCode, int resultCode, final Object obj) { |
| | | if (msgCode == Constant.DEBUG_TXT){ |
| | | CThreadPoolExecutor.runOnMainThread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | Log.i(TAG, "subtitle="+(String)obj); |
| | | toolbar.setSubtitle((String)obj); |
| | | } |
| | | }); |
| | | |
| | | } |
| | | } |
| | | }; |
| | | |
| | | public static SupportFragment newInstance() { |
| | | return new MapFragment(); |
| | |
| | | @Override |
| | | public void onCEvent(String topic, final int msgCode, int resultCode, final Object obj) { |
| | | |
| | | // CThreadPoolExecutor.runInBackground(new CalRunnable(msgCode,(String)obj)); |
| | | |
| | | producer.execute(new Runnable() { |
| | | @Override |
| | |
| | | |
| | | private String json; |
| | | private int cmd; |
| | | // public CalRunnable(int cmd,String obj) { |
| | | // this.json = obj; |
| | | // this.cmd = cmd; |
| | | // } |
| | | |
| | | @Override |
| | | public void run() { |
| | |
| | | this.cmd = messageRemoteService.msgCode; |
| | | this.json = messageRemoteService.json; |
| | | MyLog.i(TAG, json); |
| | | // if (!(cmd == Constant.REAL_TIME_CAR_POS)){ |
| | | // if (cmd == Constant.DEBUG_RTCM){ |
| | | // stringBuffer.append("\tRTCM:"); |
| | | // try { |
| | | // JSONObject jsonObject = new JSONObject(json); |
| | | // int length = jsonObject.getInt("length"); |
| | | // stringBuffer.append(length); |
| | | // } catch (JSONException e) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | // } |
| | | // if (cmd == Constant.DEBUG_TXT){ |
| | | // try { |
| | | // JSONObject jsonObject = new JSONObject(json); |
| | | // String info = jsonObject.getString("info"); |
| | | // stringBuffer.append("\tinfo:"); |
| | | // stringBuffer.append(info); |
| | | // } catch (JSONException e) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | // |
| | | // } |
| | | // } |
| | | // osd3 = stringBuffer.toString(); |
| | | // if (osd3!=null && osd3.contains("info:")&&osd3.contains("RTCM:")){ |
| | | // |
| | | // stringBuffer.delete(0,stringBuffer.length()); |
| | | // } |
| | | |
| | | |
| | | RealTimeCarPos timeCarPos = gson.fromJson((String) json, RealTimeCarPos.class); |
| | |
| | | public void onAttach(Context context) { |
| | | super.onAttach(context); |
| | | CEventCenter.onBindEvent(true, icEventListener, Constant.REAL_TIME_POS_CAR_TOPIC); |
| | | CEventCenter.onBindEvent(true, rtcmicEventListener, Constant.BIND_RTCM_TOPIC); |
| | | CEventCenter.onBindEvent(true, debugTxticEventListener, Constant.BIND_DEBUG_TXT); |
| | | } |
| | | |
| | | @Override |
| | |
| | | producer.shutdown(); |
| | | consumer.shutdown(); |
| | | CEventCenter.onBindEvent(false, icEventListener, Constant.REAL_TIME_POS_CAR_TOPIC); |
| | | CEventCenter.onBindEvent(false, icEventListener, Constant.BIND_RTCM_TOPIC); |
| | | CEventCenter.onBindEvent(false, icEventListener, Constant.BIND_DEBUG_TXT); |
| | | } |
| | | } |