app/src/main/java/safeluck/drive/evaluation/Constant.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
app/src/main/java/safeluck/drive/evaluation/fragment/NetWorkTrainFragment.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
app/src/main/res/layout/layout_net_train.xml | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
lib/src/main/java/com/anyun/exam/lib/AYSdk.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
lib/src/main/java/com/anyun/exam/lib/IAYExamInterface.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
lib/src/main/java/com/anyun/exam/lib/IAYExamListener.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
lib/src/main/java/com/anyun/exam/lib/RemoteService.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
lib/src/main/java/com/anyun/exam/lib/SvrManager.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
app/src/main/java/safeluck/drive/evaluation/Constant.java
New file @@ -0,0 +1,47 @@ package safeluck.drive.evaluation; /** * MyApplication2 * Created by lzw on 2020/1/7. 18:01:40 * 邮箱:632393724@qq.com * All Rights Saved! Chongqing AnYun Tech co. LTD */ public class Constant { //1.NDK启动指示 public static final int NDK_START= 0x0001; //2.获取RTK平台信息 public static final int FETCH_RTK_PLATFORM_INFO= 0x0002; //3.推送RTK平台信息 public static final int PUSH_RTK_PLATFORM_INFO= 0x8002; //4.RTK平台连接状态 public static final int RTK_PLATFORM_CONNECT_STATUS = 0x0003; //5.RTK平台注册状态 public static final int RTK_PLATFORM_REGISTER_STATUS = 0x0004; //6.RTK平台登录结果 public static final int RTK_PLATFORM_REGISTER_RESULT = 0x0005; //7.获取地图信息 public static final int FETCH_MAP_INFO = 0x0006; //8.推送地图 public static final int PUSH_MAP_INFO = 0x8006; //9.请求车辆轮廓信息 public static final int REQ_VECHILE_PROFILE = 0x0007; //10.推送车辆轮廓信息 public static final int PUSH_VECHILE_PROFILE = 0x8007; //11.请求开关量配置表 public static final int SIGNAL_CONFIG_TABLE = 0x0008; //12.下发开关量配置表 public static final int SIGNAL_CONFIG_RESULT = 0x8008; //13.开始考试{"exam":0} int 0-结束 1-开始 public static final int EXAM_STATUS = 0x8009; //14.NDK考试应答 public static final int EXAM_STATUS_REPLY = 0x0009; //15.GPS信息 public static final int GPS_INFO = 0x000A; //16.RTK信息 public static final int RTK_INFO = 0x000b; //17.评判信息[{"wrong_id":0},{"wrong_id":3}] public static final int JUDGE_INFO = 0x000c; } app/src/main/java/safeluck/drive/evaluation/fragment/NetWorkTrainFragment.java
@@ -2,22 +2,32 @@ import android.os.Bundle; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.ListView; import android.widget.Toast; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import com.anyun.exam.lib.AYSdk; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; import org.json.JSONException; import org.json.JSONObject; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import me.yokeyword.fragmentation.SupportFragment; import safeluck.drive.evaluation.Constant; import safeluck.drive.evaluation.R; import safeluck.drive.evaluation.adapter.ScoreAdapter; import safeluck.drive.evaluation.bean.ScoreBean; @@ -31,6 +41,7 @@ */ public class NetWorkTrainFragment extends SupportFragment implements View.OnClickListener { private static final String TAG = NetWorkTrainFragment.class.getSimpleName(); private ListView mListView ; private Button btn_start_exam; private ScoreAdapter mScoreAdapter; @@ -55,6 +66,7 @@ mListView.setAdapter(mScoreAdapter); btn_start_exam = view.findViewById(R.id.btn_start); btn_start_exam.setOnClickListener(this); view.findViewById(R.id.tv_stop).setOnClickListener(this); mListView.addHeaderView(LayoutInflater.from(_mActivity).inflate(R.layout.layout_score_item,null)); mArrayList.add(new ScoreBean(12,"直角转弯","后轮胎压线")); mArrayList.add(new ScoreBean(100,"倒车入库","未系安全带")); @@ -70,8 +82,30 @@ public void onClick(View v) { switch (v.getId()){ case R.id.btn_start: AYSdk.getInstance().at_sendCmd("AT+BEGIN_EXAM:0\r\n"); try { JSONObject jsonObject = new JSONObject(); jsonObject.put("exam",1); String examJson = jsonObject.toString(); Log.i(TAG, "onClick: "+examJson); AYSdk.getInstance().sendCmd(Constant.EXAM_STATUS,examJson); } catch (JSONException e) { e.printStackTrace(); } break; case R.id.tv_stop: Toast.makeText(_mActivity, "结束考试", Toast.LENGTH_SHORT).show(); try { JSONObject jsonObject = new JSONObject(); jsonObject.put("exam",0); String examJson = jsonObject.toString(); Log.i(TAG, "onClick: "+examJson); AYSdk.getInstance().sendCmd(Constant.EXAM_STATUS,examJson); } catch (JSONException e) { e.printStackTrace(); } break; } } } app/src/main/res/layout/layout_net_train.xml
@@ -42,6 +42,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="呼叫请求" android:id="@+id/tv_stop" android:textColor="@android:color/white" android:padding="10dp" lib/src/main/java/com/anyun/exam/lib/AYSdk.java
@@ -82,9 +82,11 @@ } @Override public void at_sendCmd(String s) { SvrManager.getInstance().at_sendCmd(s); public void sendCmd(int cmd, String s) { SvrManager.getInstance().sendCmd(cmd,s); } } lib/src/main/java/com/anyun/exam/lib/IAYExamInterface.java
@@ -13,5 +13,5 @@ void add(); void registListener(IAYExamListener iayExamListener); void at_sendCmd(String s); void sendCmd(int cmd,String s); } lib/src/main/java/com/anyun/exam/lib/IAYExamListener.java
@@ -9,5 +9,5 @@ * All Rights Saved! Chongqing AnYun Tech co. LTD */ public interface IAYExamListener { void callBackMsg(int cmd, String json); void callBackMsg(int code,String json); } lib/src/main/java/com/anyun/exam/lib/RemoteService.java
@@ -67,7 +67,7 @@ Log.i(TAG,"onCreate()"); speaker = new Speaker(getApplicationContext()); startNative(); // startNative(); new Thread(new Worker()).start(); } lib/src/main/java/com/anyun/exam/lib/SvrManager.java
@@ -69,13 +69,13 @@ } } public void at_sendCmd(String s) { public void sendCmd(int cmd,String s) { if (!checkRemoteIsNull()){ // try { // remoteInterface.at_sendCmd(s); // } catch (RemoteException e) { // e.printStackTrace(); // } try { remoteInterface.SendCmd(cmd,s); } catch (RemoteException e) { e.printStackTrace(); } } } @@ -127,6 +127,7 @@ if (mCallback != null){ mCallback.callBackMsg(cmd, json); } }