Merge remote-tracking branch 'origin/master'
| | |
| | | apply plugin: 'com.android.application' |
| | | apply plugin: 'kotlin-android-extensions' |
| | | apply plugin: 'kotlin-android' |
| | | |
| | | android { |
| | | compileSdkVersion 28 |
| | |
| | | implementation 'com.google.code.gson:gson:2.8.6' |
| | | implementation 'com.facebook.stetho:stetho:1.5.0' |
| | | implementation project(path: ':im_lib') |
| | | implementation "androidx.core:core-ktx:+" |
| | | implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.1.0" |
| | | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" |
| | | } |
| | | repositories { |
| | | mavenCentral() |
| | | } |
| | |
| | | public class Constant { |
| | | public static final String CRITERIAFOR_I_JSON = "criteria_I.json"; |
| | | public static final String CRITERIAFOR_II_JSON = "criteria_II.json"; |
| | | public static final String RTK_CONFIG_UPDATE_JSON = "RTK_CONFIG_UPDATE_JSON"; |
| | | public static final String RTK_CONFIG_PHONE = "RTK_CONFIG_PHONE"; |
| | | public static final String RTK_CONFIG_IMEI = "RTK_CONFIG_IMEI"; |
| | | public static final String RTK_CONFIG_SN = "sn"; |
| | | } |
| | |
| | | package safeluck.drive.evaluation.DB.appstatusdb; |
| | | |
| | | import android.content.Context; |
| | | import android.util.Log; |
| | | |
| | | import androidx.annotation.NonNull; |
| | | import androidx.work.Worker; |
| | |
| | | public Result doWork() { |
| | | String[] str = getInputData().getStringArray(Constant.APP_STATUS); |
| | | JSONObject jsonObject = null; |
| | | Log.i(TAG,"doWork:"+str[0]+": "+str[1]); |
| | | try { |
| | | jsonObject = new JSONObject(str[1]); |
| | | switch (str[0]) { |
| | |
| | | |
| | | @Update |
| | | void update(RTKConfig rtkConfig); |
| | | @Query("Update rtkconfig_table SET sn=:sn ,imei=:imei ,phone=:phone where _id =0") |
| | | void update(String sn,String imei,String phone); |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package safeluck.drive.evaluation.DB.rtktb |
| | | |
| | | import android.content.Context |
| | | import android.text.TextUtils |
| | | import android.util.Log |
| | | import androidx.work.Worker |
| | | import androidx.work.WorkerParameters |
| | | import org.json.JSONObject |
| | | import safeluck.drive.evaluation.DB.Constant |
| | | import safeluck.drive.evaluation.DB.WorkRoomDataBase |
| | | |
| | | class RTKConfigUpdateWorker(context:Context, workerParams: WorkerParameters) :Worker(context, workerParams){ |
| | | |
| | | val TAG:String = "RTKConfigUpdateWorker" |
| | | |
| | | override fun doWork(): Result { |
| | | |
| | | var data = inputData.getString(Constant.RTK_CONFIG_UPDATE_JSON) |
| | | Log.i(TAG,"更新RTK_config imei phone sn="+data) |
| | | var imei:String="" |
| | | var phone:String="" |
| | | var sn:String="" |
| | | if (!TextUtils.isEmpty(data)){ |
| | | var jsonObject: JSONObject? = null |
| | | jsonObject = JSONObject(data) |
| | | sn = jsonObject.getString(Constant.RTK_CONFIG_SN) |
| | | Log.i(TAG,"sn="+sn) |
| | | imei = sn |
| | | phone = sn |
| | | } |
| | | var rtkConfigDao = WorkRoomDataBase.getWorkRoomDataBase(applicationContext).rtkConfigDao.also { |
| | | it.update(sn, imei, phone) |
| | | } |
| | | return Result.success() |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | package safeluck.drive.evaluation.DB.rtktb; |
| | | |
| | | import android.content.Context; |
| | | import android.util.Log; |
| | | |
| | | import androidx.annotation.NonNull; |
| | | import androidx.work.Worker; |
| | |
| | | @NonNull |
| | | @Override |
| | | public Result doWork() { |
| | | |
| | | try { |
| | | InputStream inputStream = getApplicationContext().getAssets().open(Constant.RTK_CONFIG_JSON); |
| | | InputStreamReader inputStreamReader = new InputStreamReader(inputStream); |
| | |
| | | |
| | | import android.text.TextUtils; |
| | | import android.util.Log; |
| | | import android.view.Window; |
| | | import android.view.WindowManager; |
| | | import android.widget.Toast; |
| | | |
| | | |
| | |
| | | protected void onCreate(Bundle savedInstanceState) { |
| | | super.onCreate(savedInstanceState); |
| | | //全屏 |
| | | |
| | | requestWindowFeature(Window.FEATURE_NO_TITLE); |
| | | getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN); |
| | | setContentView(R.layout.activity_main); |
| | | // TODO |
| | | // 进行tcp连接 |
| | |
| | | |
| | | @Override |
| | | public void onConnecting() { |
| | | |
| | | MyLog.i(TAG,"TCP onConnecting"); |
| | | } |
| | | |
| | | @Override |
| | | public void onConnected() { |
| | | ExamPlatformData.getInstance().setExamplatformStatus(ExamPlatformData.TCP_CONNECTED); |
| | | MyLog.i(TAG,"TCP连接成功"); |
| | | //TODO 判断SPUtils 是否保存有des密码;如果没有则进行注册JKMessage0100,如果有密码则进行鉴权JKMessage0101 |
| | | String hexPwd = (String) SPUtils.get(this,SPUtils.DES_HEX_PWD,""); |
| | |
| | | |
| | | @Override |
| | | public void onConnectFailed() { |
| | | ExamPlatformData.getInstance().setExamplatformStatus(ExamPlatformData.TCP_DISCONNECT); |
| | | MyLog.i(TAG,"TCP连接失败"); |
| | | } |
| | | |
| | |
| | | import safeluck.drive.evaluation.DB.failitems.FailedProj_select; |
| | | import safeluck.drive.evaluation.DB.gps.GpsInfoWorker; |
| | | import safeluck.drive.evaluation.DB.rtktb.RTKConfig; |
| | | import safeluck.drive.evaluation.DB.rtktb.RTKConfigUpdateWorker; |
| | | import safeluck.drive.evaluation.DB.rtktb.RTKWorkRepository; |
| | | import safeluck.drive.evaluation.bean.ExamPlatformData; |
| | | import safeluck.drive.evaluation.cEventCenter.CEvent; |
| | |
| | | } |
| | | |
| | | private String lastStr; |
| | | private String lastSn; |
| | | @Override |
| | | public void callBackMsg(final int cmd, String json) { |
| | | String strConent = String.format("收到命令[%d],Json内容为%s", cmd, json); |
| | |
| | | CEventCenter.dispatchEvent(Constant.BIND_DEBUG_TXT,cmd,0,json); |
| | | break; |
| | | case Constant.MCU_SN: |
| | | String sn = null; |
| | | try { |
| | | JSONObject rtkConfigUpdtea = new JSONObject(json); |
| | | sn = rtkConfigUpdtea.getString("sn"); |
| | | sn = rtkConfigUpdtea.put(safeluck.drive.evaluation.DB.Constant.RTK_CONFIG_SN,sn).toString(); |
| | | } catch (JSONException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | if (sn.equalsIgnoreCase(lastSn)){ |
| | | |
| | | }else{ |
| | | lastSn = sn; |
| | | Data data = new Data.Builder().putString(safeluck.drive.evaluation.DB.Constant.RTK_CONFIG_UPDATE_JSON,sn).build(); |
| | | OneTimeWorkRequest rtkConfigUpdateWorker= new OneTimeWorkRequest.Builder(RTKConfigUpdateWorker.class).setInputData(data).build(); |
| | | WorkManager.getInstance(getAppContext()).enqueue(rtkConfigUpdateWorker); |
| | | } |
| | | CEventCenter.dispatchEvent(Constant.BIND_MCUINFO_TOPIC,cmd,0,json); |
| | | break; |
| | | case Constant.IC_ID: |
| | |
| | | double longitude = jsSpeed.getDouble("longitude"); |
| | | double altitude = jsSpeed.getDouble("altitude"); |
| | | double speed = jsSpeed.getDouble("speed"); |
| | | Log.i(TAG, "RTK info speed: "+speed); |
| | | int qf = jsSpeed.getInt("qf"); |
| | | double track_ture = jsSpeed.getDouble("track_ture"); |
| | | String utc = jsSpeed.getString("utc"); |
| | |
| | | AttachInfo attachInfo = new AttachInfo(); |
| | | attachInfo.attach_message_id = Integer.parseInt(String.valueOf(0x40)); |
| | | attachInfo.attach_message_length = 4; |
| | | Log.i(TAG, "attachInfo.attach_message_id ="+attachInfo.attach_message_id ); |
| | | if (attachInfo.attach_message_id == 0x41){ |
| | | Log.i(TAG, "onClick: 41"); |
| | | attachInfo.attach_data="00000000"; |
| | | }else{ |
| | | |
| | |
| | | } |
| | | |
| | | jkMessage0206.attachInfo = attachInfo; |
| | | Log.i(TAG, "位置上报="+jkMessage0206.toString()); |
| | | MessageProcessor.getInstance().sendMessage(jkMessage0206); |
| | | |
| | | } catch (JSONException e) { |
| | |
| | | |
| | | import androidx.lifecycle.LiveData; |
| | | import androidx.lifecycle.ViewModelProviders; |
| | | import androidx.work.Data; |
| | | import androidx.work.OneTimeWorkRequest; |
| | | import androidx.work.WorkManager; |
| | | |
| | | import com.anyun.exam.lib.MyLog; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.Random; |
| | | |
| | | import safeluck.drive.evaluation.Constant; |
| | | import safeluck.drive.evaluation.DB.appstatusdb.AppStatusWorker; |
| | | import safeluck.drive.evaluation.app; |
| | | import safeluck.drive.evaluation.util.SPUtils; |
| | | import safeluck.drive.evaluation.viewmodels.ExamPlatformModel; |
| | |
| | | private static final ExamPlatformData ourInstance = new ExamPlatformData(); |
| | | |
| | | private int exam_id =12345;//考试唯一ID |
| | | |
| | | public static final int TCP_DISCONNECT = 1; |
| | | public static final int TCP_CONNECTED = 2;///2-未连接(tcp连接不上) |
| | | public static final int DEV_NOT_REGISTERED = 3; |
| | | public static final int DEV_REGISTERED = 4; |
| | | public static final int DEV_NOT_LOGIN = 5; |
| | | public static final int DEV_LOGIN = 6; |
| | | private static HashMap<Integer,String> examPlatformStrs = new HashMap<>(); |
| | | static { |
| | | examPlatformStrs.put(TCP_DISCONNECT,"未连接"); |
| | | examPlatformStrs.put(TCP_CONNECTED,"已连接"); |
| | | examPlatformStrs.put(DEV_NOT_REGISTERED,"未注册"); |
| | | examPlatformStrs.put(DEV_REGISTERED,"已注册"); |
| | | examPlatformStrs.put(DEV_NOT_LOGIN,"未登录"); |
| | | examPlatformStrs.put(DEV_LOGIN,"已登录"); |
| | | } |
| | | private static final String WORK_PLATFORM_STATUS = " work_platform"; |
| | | |
| | | |
| | | private int examplatformStatus =1;//1-未连接(tcp连接不上) 3-未注册(设备没有注册) 5-未登录(鉴权未通过) |
| | | |
| | | private String id;//身份证 |
| | | |
| | |
| | | carPath = (String) SPUtils.get(app.getAppContext(),SPUtils.CAR_PATH,""); |
| | | return carPath; |
| | | } |
| | | |
| | | public int getExamplatformStatus() { |
| | | return examplatformStatus; |
| | | } |
| | | |
| | | public void setExamplatformStatus(int examplatformStatus) { |
| | | String[] conn_strs = new String[2]; |
| | | conn_strs[0] = Constant.WORK_PLATFORM_STATUS_COLUMN; |
| | | conn_strs[1] = "{"+WORK_PLATFORM_STATUS+":"+examplatformStatus+"}"; |
| | | //RTK平台连接状态 |
| | | Data connStatusData = new Data.Builder().putStringArray(Constant.APP_STATUS,conn_strs).build(); |
| | | OneTimeWorkRequest oneTimeWorkRequest = new OneTimeWorkRequest.Builder(AppStatusWorker.class). |
| | | setInputData(connStatusData).build(); |
| | | WorkManager.getInstance(app.getAppContext()).enqueue(oneTimeWorkRequest); |
| | | this.examplatformStatus = examplatformStatus; |
| | | } |
| | | |
| | | public String getExamplatformStatusStr(int work_platform) { |
| | | |
| | | return examPlatformStrs.get(work_platform); |
| | | } |
| | | } |
| | |
| | | @Override |
| | | public void onDetach() { |
| | | super.onDetach(); |
| | | CEventCenter.onBindEvent(true,icEventListener,Constant.BIND_MCUINFO_TOPIC); |
| | | CEventCenter.onBindEvent(false,icEventListener,Constant.BIND_MCUINFO_TOPIC); |
| | | } |
| | | } |
| | |
| | | import androidx.appcompat.widget.Toolbar; |
| | | import androidx.databinding.DataBindingUtil; |
| | | |
| | | import com.anyun.exam.lib.MyLog; |
| | | import com.anyun.im_lib.util.ByteUtil; |
| | | import com.google.gson.Gson; |
| | | |
| | |
| | | private TextView textView_turnLight,tv_speed,tv_engine; |
| | | private Toolbar toolbar; |
| | | private Gson gson= new Gson(); |
| | | private Handler handler = new Handler(); |
| | | private LayoutCheckSignalBinding bingding; |
| | | private List<Integer> gpios = new ArrayList<>(); |
| | | Drawable leftGreen ; |
| | | Drawable leftGray ; |
| | | private int index =0 ; |
| | | private ICEventListener icEventListener = new ICEventListener() { |
| | | @Override |
| | | public void onCEvent(String topic, int msgCode, int resultCode, Object obj) { |
| | | if (msgCode==Constant.MCU_SN){ |
| | | final MCUInfo mcuInfo = gson.fromJson((String)obj, MCUInfo.class); |
| | | if (mcuInfo != null){ |
| | | bingding.getRoot().post(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | |
| | | gpios.clear(); |
| | | for (int i = 0; i < 16; i++) { |
| | | |
| | | gpios.add( ByteUtil.getBitStatus(mcuInfo.getGpio(),i)); |
| | | } |
| | | MyLog.i("mcu info gpio"+mcuInfo.getGpio()); |
| | | |
| | | bingding.tvRoateSpeed.setText(String.valueOf(mcuInfo.getEngine())); |
| | | bingding.tvDangweiNum.setText(String.valueOf(mcuInfo.getSpeed())); |
| | | handler.post(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | bingding.tvRoateSpeed.setText(String.valueOf(mcuInfo.getEngine())); |
| | | bingding.tvDangweiNum.setText(String.valueOf(mcuInfo.getSpeed())); |
| | | |
| | | for (int i = 0; i < gpios.size(); i++) { |
| | | Log.i(TAG, "run: gpio["+i+"]="+gpios.get(i)); |
| | | } |
| | | bingding.inpsetSignalSlice.tvSeatBelt.setCompoundDrawablesWithIntrinsicBounds(gpios.get(0)==VALIAD_NUM?leftGreen:leftGray,null,null,null); |
| | | bingding.inpsetSignalSlice.tvTrunLeft.setCompoundDrawablesWithIntrinsicBounds(gpios.get(1)==VALIAD_NUM?leftGreen:leftGray,null,null,null); |
| | | bingding.inpsetSignalSlice.tvTurnRight.setCompoundDrawablesWithIntrinsicBounds(gpios.get(2)==VALIAD_NUM?leftGreen:leftGray,null,null,null); |
| | | bingding.inpsetSignalSlice.tvParkingBrake.setCompoundDrawablesWithIntrinsicBounds(gpios.get(3)==VALIAD_NUM?leftGreen:leftGray,null,null,null); |
| | | bingding.inpsetSignalSlice.tvFootBrake.setCompoundDrawablesWithIntrinsicBounds(gpios.get(4)==VALIAD_NUM?leftGreen:leftGray,null,null,null); |
| | | bingding.inpsetSignalSlice.tvLowLamp.setCompoundDrawablesWithIntrinsicBounds(gpios.get(5)==VALIAD_NUM?leftGreen:leftGray,null,null,null); |
| | | bingding.inpsetSignalSlice.tvHighBeam.setCompoundDrawablesWithIntrinsicBounds(gpios.get(6)==VALIAD_NUM?leftGreen:leftGray,null,null,null); |
| | | |
| | | bingding.inpsetSignalSlice.tvSeatBelt.setCompoundDrawablesWithIntrinsicBounds(gpios.get(0)==VALIAD_NUM?leftGreen:leftGray,null,null,null); |
| | | bingding.inpsetSignalSlice.tvTrunLeft.setCompoundDrawablesWithIntrinsicBounds(gpios.get(1)==VALIAD_NUM?leftGreen:leftGray,null,null,null); |
| | | bingding.inpsetSignalSlice.tvTurnRight.setCompoundDrawablesWithIntrinsicBounds(gpios.get(2)==VALIAD_NUM?leftGreen:leftGray,null,null,null); |
| | | bingding.inpsetSignalSlice.tvParkingBrake.setCompoundDrawablesWithIntrinsicBounds(gpios.get(3)==VALIAD_NUM?leftGreen:leftGray,null,null,null); |
| | | bingding.inpsetSignalSlice.tvFootBrake.setCompoundDrawablesWithIntrinsicBounds(gpios.get(4)==VALIAD_NUM?leftGreen:leftGray,null,null,null); |
| | | bingding.inpsetSignalSlice.tvLowLamp.setCompoundDrawablesWithIntrinsicBounds(gpios.get(5)==VALIAD_NUM?leftGreen:leftGray,null,null,null); |
| | | bingding.inpsetSignalSlice.tvHighBeam.setCompoundDrawablesWithIntrinsicBounds(gpios.get(6)==VALIAD_NUM?leftGreen:leftGray,null,null,null); |
| | | |
| | | bingding.inpsetSignalSlice.tvGateLock.setCompoundDrawablesWithIntrinsicBounds(gpios.get(7)==VALIAD_NUM?leftGreen:leftGray,null,null,null); |
| | | bingding.inpsetSignalSlice.tvNullEngine.setCompoundDrawablesWithIntrinsicBounds(gpios.get(8)==VALIAD_NUM?leftGreen:leftGray,null,null,null); |
| | | bingding.inpsetSignalSlice.tvGearOne.setCompoundDrawablesWithIntrinsicBounds(gpios.get(9)==VALIAD_NUM?leftGreen:leftGray,null,null,null); |
| | | bingding.inpsetSignalSlice.tvGearTwo.setCompoundDrawablesWithIntrinsicBounds(gpios.get(10)==VALIAD_NUM?leftGreen:leftGray,null,null,null); |
| | | bingding.inpsetSignalSlice.tvGearThree.setCompoundDrawablesWithIntrinsicBounds(gpios.get(11)==VALIAD_NUM?leftGreen:leftGray,null,null,null); |
| | | bingding.inpsetSignalSlice.tvGearFour.setCompoundDrawablesWithIntrinsicBounds(gpios.get(12)==VALIAD_NUM?leftGreen:leftGray,null,null,null); |
| | | bingding.inpsetSignalSlice.tvGearFive.setCompoundDrawablesWithIntrinsicBounds(gpios.get(13)==VALIAD_NUM?leftGreen:leftGray,null,null,null); |
| | | bingding.inpsetSignalSlice.tvWindingOne.setCompoundDrawablesWithIntrinsicBounds(gpios.get(14)==VALIAD_NUM?leftGreen:leftGray,null,null,null); |
| | | bingding.inpsetSignalSlice.tvWindingTwo.setCompoundDrawablesWithIntrinsicBounds(gpios.get(15)==VALIAD_NUM?leftGreen:leftGray,null,null,null); |
| | | bingding.inpsetSignalSlice.tvGateLock.setCompoundDrawablesWithIntrinsicBounds(gpios.get(7)==VALIAD_NUM?leftGreen:leftGray,null,null,null); |
| | | bingding.inpsetSignalSlice.tvNullEngine.setCompoundDrawablesWithIntrinsicBounds(gpios.get(8)==VALIAD_NUM?leftGreen:leftGray,null,null,null); |
| | | bingding.inpsetSignalSlice.tvGearOne.setCompoundDrawablesWithIntrinsicBounds(gpios.get(9)==VALIAD_NUM?leftGreen:leftGray,null,null,null); |
| | | bingding.inpsetSignalSlice.tvGearTwo.setCompoundDrawablesWithIntrinsicBounds(gpios.get(10)==VALIAD_NUM?leftGreen:leftGray,null,null,null); |
| | | bingding.inpsetSignalSlice.tvGearThree.setCompoundDrawablesWithIntrinsicBounds(gpios.get(11)==VALIAD_NUM?leftGreen:leftGray,null,null,null); |
| | | bingding.inpsetSignalSlice.tvGearFour.setCompoundDrawablesWithIntrinsicBounds(gpios.get(12)==VALIAD_NUM?leftGreen:leftGray,null,null,null); |
| | | bingding.inpsetSignalSlice.tvGearFive.setCompoundDrawablesWithIntrinsicBounds(gpios.get(13)==VALIAD_NUM?leftGreen:leftGray,null,null,null); |
| | | bingding.inpsetSignalSlice.tvWindingOne.setCompoundDrawablesWithIntrinsicBounds(gpios.get(14)==VALIAD_NUM?leftGreen:leftGray,null,null,null); |
| | | bingding.inpsetSignalSlice.tvWindingTwo.setCompoundDrawablesWithIntrinsicBounds(gpios.get(15)==VALIAD_NUM?leftGreen:leftGray,null,null,null); |
| | | } |
| | | }); |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | } |
| | | }; |
| | | |
| | |
| | | @Override |
| | | public void onDetach() { |
| | | super.onDetach(); |
| | | CEventCenter.onBindEvent(true,icEventListener,Constant.BIND_MCUINFO_TOPIC); |
| | | CEventCenter.onBindEvent(false,icEventListener,Constant.BIND_MCUINFO_TOPIC); |
| | | } |
| | | } |
| | |
| | | import android.graphics.Path; |
| | | import android.os.Bundle; |
| | | import android.os.Handler; |
| | | import android.text.TextUtils; |
| | | import android.util.Log; |
| | | import android.view.LayoutInflater; |
| | | import android.view.SurfaceHolder; |
| | |
| | | import androidx.appcompat.widget.Toolbar; |
| | | |
| | | |
| | | import com.anyun.exam.lib.AYSdk; |
| | | import com.anyun.exam.lib.MyLog; |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.reflect.TypeToken; |
| | |
| | | import safeluck.drive.evaluation.Constant; |
| | | import safeluck.drive.evaluation.R; |
| | | import safeluck.drive.evaluation.bean.ExamMap; |
| | | import safeluck.drive.evaluation.bean.ExamPlatformData; |
| | | import safeluck.drive.evaluation.bean.RealTimeCarPos; |
| | | import safeluck.drive.evaluation.cEventCenter.CEventCenter; |
| | | import safeluck.drive.evaluation.cEventCenter.ICEventListener; |
| | |
| | | paint.setColor(Color.BLACK); |
| | | |
| | | Path path = new Path(); |
| | | |
| | | Log.i(TAG, "DrawMap: map.length:"+map.length); |
| | | if (map.length != 9) { |
| | | Log.d(TAG, "DrawMap X = " + String.format("%f", (float) (base_x + (map[0][0] - min_x) * scale_x)) + " Y = " + String.format("%f", (float) (base_y + (map[0][1] - min_y) * scale_y))); |
| | | path.moveTo((float) (base_x + (map[0][0] - min_x) * scale_x), (float) (base_y + (map[0][1] - min_y) * scale_y)); |
| | |
| | | canvas2.drawPath(path, paint); |
| | | |
| | | path.moveTo((float) (base_x + (car[body.get(0)][0] - min_x) * scale_x), (float) (base_y + (car[body.get(0)][1] - min_y) * scale_y)); |
| | | for (int i = 1; i < body.size(); i++) |
| | | for (int i = 1; i < body.size(); i++){ |
| | | Log.d(TAG, "for 循环 DrawMap to X = " + (float) (base_x + (car[body.get(i)][0] - min_x) * scale_x)+ " Y = " + (float) (base_y + (car[body.get(i)][1] - min_y) * scale_y)); |
| | | path.lineTo((float) (base_x + (car[body.get(i)][0] - min_x) * scale_x), (float) (base_y + (car[body.get(i)][1] - min_y) * scale_y)); |
| | | } |
| | | |
| | | path.close(); |
| | | |
| | |
| | | // 3 - 侧方停车 |
| | | // 4 - 曲线行驶 |
| | | // 5 - 直角转弯 |
| | | StringBuffer buffer=null; |
| | | List<ExamMap> examMaps; |
| | | String newmap = null; |
| | | String mapPath = ExamPlatformData.getInstance().getMapPath(); |
| | | if (!TextUtils.isEmpty(mapPath)){ |
| | | MyLog.i("调用更新Map路径后的地图"+mapPath); |
| | | byte[] fileContent = FileUtil.readFile(mapPath); |
| | | if (fileContent != null){ |
| | | newmap= new String(fileContent); |
| | | Log.i(TAG, "文件内容:"+newmap); |
| | | }else{ |
| | | MyLog.i(String.format("文件:%s不存在",mapPath)); |
| | | } |
| | | }else{ |
| | | buffer = FileUtil.readAssetTxtFile(_mActivity,Constant.MAP); |
| | | } |
| | | |
| | | |
| | | StringBuffer buffer = FileUtil.readAssetTxtFile(_mActivity,Constant.MAP); |
| | | Type type = new TypeToken<List<ExamMap>>(){}.getType(); |
| | | if (buffer != null){ |
| | | List<ExamMap> examMaps = gson.fromJson(buffer.toString().trim(), type); |
| | | examMaps= gson.fromJson(buffer.toString().trim(), type); |
| | | }else{ |
| | | examMaps = gson.fromJson(newmap.trim(),type); |
| | | } |
| | | |
| | | |
| | | |
| | |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | |
| | | DrawMap(mainAnt, map, car, body, tire); |
| | | } |
| | | } |
| | |
| | | private int item_id;//扣分分数总和 |
| | | private ExamStatusViewModel examStatusViewModel; |
| | | private static final int ADD_DATA = 1; |
| | | private TextView tv_speed,tv_total_score,tv_sat_num,tv_name,tv_id; |
| | | private TextView tv_speed,tv_total_score,tv_sat_num,tv_name,tv_id,tv_work_platform; |
| | | private double speed=0.0; |
| | | private ImageView iv_rtk_status,iv_head; |
| | | |
| | |
| | | if (appStatus != null){ |
| | | Log.i(TAG, "onChanged: "+appStatus.toString()); |
| | | iv_rtk_status.getDrawable().setLevel(appStatus.getRtk_connect_status()); |
| | | tv_work_platform.setText(getString(R.string.platform_status,ExamPlatformData.getInstance().getExamplatformStatusStr(appStatus.getWork_platform()))); |
| | | tv_sat_num.setText(String.valueOf(appStatus.getDefault_observe1()).length()==1?"0"+appStatus.getDefault_observe1():String.valueOf(appStatus.getDefault_observe1())); |
| | | } |
| | | } |
| | |
| | | houseView = view.findViewById(R.id.hv); |
| | | tv_name = view.findViewById(R.id.tv_name); |
| | | tv_id = view.findViewById(R.id.tv_ID); |
| | | tv_work_platform = view.findViewById(R.id.platform); |
| | | |
| | | iv_rtk_status = view.findViewById(R.id.iv_rtk_connect); |
| | | iv_head = view.findViewById(R.id.iv_head); |
| | |
| | | package safeluck.drive.evaluation.im; |
| | | |
| | | import android.content.Context; |
| | | import android.net.ConnectivityManager; |
| | | import android.net.NetworkInfo; |
| | | |
| | | import com.anyun.exam.lib.MyLog; |
| | | import com.anyun.im_lib.listener.OnEventListener; |
| | | |
| | | import safeluck.drive.evaluation.app; |
| | | import safeluck.drive.evaluation.platformMessage.JKMessage0002; |
| | | import safeluck.drive.evaluation.platformMessage.utils.MessageEscaper; |
| | | |
| | |
| | | |
| | | @Override |
| | | public boolean isNetWorkAvailable() { |
| | | return true; |
| | | ConnectivityManager connectivityManager = (ConnectivityManager) app.getAppContext().getSystemService(Context.CONNECTIVITY_SERVICE); |
| | | NetworkInfo networkInfo = connectivityManager.getActiveNetworkInfo(); |
| | | MyLog.i("IsNetworkAvaliable"+networkInfo!=null&&networkInfo.isConnected()); |
| | | return networkInfo!=null&&networkInfo.isConnected(); |
| | | } |
| | | |
| | | /** |
| | |
| | | import safeluck.drive.evaluation.Constant; |
| | | import safeluck.drive.evaluation.DB.StudentInfoUpdateWork; |
| | | import safeluck.drive.evaluation.app; |
| | | import safeluck.drive.evaluation.bean.ExamPlatformData; |
| | | import safeluck.drive.evaluation.platformMessage.JK2019MessageBase; |
| | | import safeluck.drive.evaluation.platformMessage.JKMessage0001; |
| | | import safeluck.drive.evaluation.platformMessage.JKMessage0100; |
| | |
| | | JKMessage0101 jkMessage0101 = new JKMessage0101(); |
| | | jkMessage0101.des =((JKMessage8100) jk2019MessageBase).des; |
| | | jkMessage0101.timestamp = (int) System.currentTimeMillis(); |
| | | ExamPlatformData.getInstance().setExamplatformStatus(ExamPlatformData.DEV_REGISTERED); |
| | | }else{ |
| | | ExamPlatformData.getInstance().setExamplatformStatus(ExamPlatformData.DEV_REGISTERED); |
| | | } |
| | | }else if (jk2019MessageBase instanceof JKMessage8001){ |
| | | JKMessage8001 jkMessage8001 = (JKMessage8001) jk2019MessageBase; |
| | | String hexMessageId = jkMessage8001.respMessageId; |
| | | if (hexMessageId.equalsIgnoreCase("0101")){ |
| | | MyLog.i(PlatFormConstant.TAG,"鉴权成功"); |
| | | ExamPlatformData.getInstance().setExamplatformStatus(ExamPlatformData.DEV_LOGIN); |
| | | }else{ |
| | | ExamPlatformData.getInstance().setExamplatformStatus(ExamPlatformData.DEV_NOT_LOGIN); |
| | | } |
| | | }else if (jk2019MessageBase instanceof JKMessage8201){ |
| | | JKMessage8201 jkMessage8201 = (JKMessage8201) jk2019MessageBase; |
| | |
| | | } |
| | | //计算消息体长度 |
| | | String hex = super.toString(); |
| | | Log.i(PlatFormConstant.TAG, "toString: 消息体长度:"+hex); |
| | | // Log.i(PlatFormConstant.TAG, "toString: 消息体长度:"+hex); |
| | | int message_head_len = 19; |
| | | if(this.isMultiPacket()) |
| | | { |
| | |
| | | |
| | | @Override |
| | | public String encode(String str) { |
| | | Log.i(TAG, "encode: "+str); |
| | | if(str==null||"".equalsIgnoreCase(str)) |
| | | { |
| | | // str ="00000000000"; |
| | |
| | | android:layout_height="match_parent" |
| | | tools:context=".MainActivity"> |
| | | |
| | | |
| | | <FrameLayout |
| | | android:id="@+id/fl_container" |
| | | android:layout_width="match_parent" |
| | |
| | | android:layout_width="0dp" |
| | | android:layout_weight="4" |
| | | android:layout_height="match_parent" |
| | | android:padding="5dp" |
| | | android:paddingTop="2dp" |
| | | android:paddingBottom="2dp" |
| | | android:paddingLeft="5dp" |
| | | android:paddingRight="5dp" |
| | | android:gravity="center" |
| | | android:orientation="vertical" |
| | | android:background="@color/train_bg" |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <ScrollView |
| | | <LinearLayout |
| | | xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" |
| | | android:layout_height="match_parent" |
| | | android:orientation="vertical" |
| | | android:background="@color/home_bg_color"> |
| | | |
| | | <include layout="@layout/networktoolbar"/> |
| | | <LinearLayout |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:id="@+id/ll" |
| | | android:orientation="vertical"> |
| | | <include android:layout_marginBottom="10dp" android:layout_width="match_parent" android:layout_height="120dp" android:id="@+id/profile" layout="@layout/profile_layout"/> |
| | | <include android:layout_marginBottom="10dp" android:layout_width="match_parent" android:layout_height="170dp" layout="@layout/layout_net_train"/> |
| | | <include android:layout_marginBottom="2dp" android:layout_width="match_parent" android:layout_height="110dp" android:id="@+id/profile" layout="@layout/profile_layout"/> |
| | | <include android:layout_marginBottom="2dp" android:layout_width="match_parent" android:layout_height="140dp" layout="@layout/layout_net_train"/> |
| | | |
| | | <include android:layout_marginBottom="10dp" android:layout_width="match_parent" android:layout_height="240dp" layout="@layout/layout_stu_score"/> |
| | | <include android:layout_marginBottom="2dp" android:layout_width="match_parent" android:layout_height="match_parent" layout="@layout/layout_stu_score"/> |
| | | </LinearLayout> |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | </ScrollView> |
| | | </LinearLayout> |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <layout> |
| | | <com.google.android.material.appbar.AppBarLayout |
| | | xmlns:android="http://schemas.android.com/apk/res/android" |
| | | xmlns:app="http://schemas.android.com/apk/res-auto" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:theme="@style/AppTheme.AppBarOverlay"> |
| | | |
| | | <androidx.appcompat.widget.Toolbar |
| | | android:id="@+id/toolbar" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="@dimen/actionbarsizehalf" |
| | | android:background="?attr/colorPrimary" |
| | | android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" |
| | | app:popupTheme="@style/AppTheme.NoActionBar.PopupOverlay" |
| | | app:titleTextAppearance="@style/Toolbar_TextAppearance_White"> |
| | | <TextView |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:text="02" |
| | | android:gravity="center" |
| | | android:drawableLeft="@drawable/gps" |
| | | android:textColor="@android:color/white" /> |
| | | <ImageView |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:id="@+id/iv_rtk_connect" |
| | | android:layout_marginLeft="50dp" |
| | | android:src="@drawable/antennaxml"/> |
| | | <TextView |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:layout_gravity="center" |
| | | android:id="@+id/network_time" |
| | | android:singleLine="true" |
| | | android:textColor="@android:color/white" |
| | | android:text="12:34:33"/> |
| | | <TextView |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:id="@+id/platform" |
| | | android:singleLine="true" |
| | | android:layout_gravity="end" |
| | | android:textColor="@android:color/white" |
| | | android:text="@string/platform_status"/> |
| | | </androidx.appcompat.widget.Toolbar> |
| | | </com.google.android.material.appbar.AppBarLayout> |
| | | </layout> |
| | |
| | | </LinearLayout> |
| | | |
| | | <RelativeLayout |
| | | android:visibility="gone" |
| | | android:layout_width="0dp" |
| | | android:layout_height="90dp" |
| | | android:layout_marginLeft="10dp" |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <resources> |
| | | <dimen name="bottombar_height">0dp</dimen> |
| | | <dimen name="actionbarsizehalf">28dp</dimen> |
| | | </resources> |
| | |
| | | <string name="mcu_info">协处理器信息:</string> |
| | | <string name="chesu">车速:</string> |
| | | <string name="engine">转速:</string> |
| | | <string name="platform_status">考试平台:%1$s</string> |
| | | </resources> |
| | |
| | | // Top-level build file where you can add configuration options common to all sub-projects/modules. |
| | | |
| | | buildscript { |
| | | ext.kotlin_version = '1.3.70' |
| | | repositories { |
| | | google() |
| | | jcenter() |
| | |
| | | lifecycleVersion = '2.1.0' |
| | | } |
| | | dependencies { |
| | | classpath 'com.android.tools.build:gradle:3.4.0' |
| | | |
| | | classpath 'com.android.tools.build:gradle:3.5.0' |
| | | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" |
| | | |
| | | // NOTE: Do not place your application dependencies here; they belong |
| | | // in the individual module build.gradle files |
| | | } |
| | |
| | | |
| | | if (channel == null){ |
| | | MyLog.i("PlatformMessage", "sendMsg fail,channel为空"+msg); |
| | | return; |
| | | } |
| | | try { |
| | | MyLog.i("PlatformMessage", "sendMsg: "+ BytesUtils.bytesToHexString(msg)); |
| | |
| | | public static byte[] subArray(byte[] srcBytes, int begin, int length) { |
| | | byte[] bytes = new byte[length]; |
| | | System.arraycopy(srcBytes,begin,bytes,0,length); |
| | | Log.i("ArrayUtils", "subArray: "+byte2HexStr(bytes)); |
| | | return bytes; |
| | | } |
| | | } |
| | |
| | | #include "../utils/xconvert.h" |
| | | |
| | | #include <vector> |
| | | #include <cstdlib> |
| | | |
| | | using namespace std; |
| | | |