From 3e6b5a316fdf99835865148bcb5119464b625d9a Mon Sep 17 00:00:00 2001
From: yy1717 <fctom1215@outlook.com>
Date: 星期三, 08 一月 2020 14:42:43 +0800
Subject: [PATCH] Merge branch 'master' of https://gitee.com/endian11/DriveJudge
---
lib/src/main/cpp/test_items/park_bottom.cpp | 1
lib/src/main/cpp/test_items/turn_a90.cpp | 1
app/src/main/java/safeluck/drive/evaluation/app.java | 39 +++++++++++-
/dev/null | 32 ----------
lib/src/main/cpp/test_items/park_edge.cpp | 1
app/src/main/java/safeluck/drive/evaluation/adapter/SimpleFragmentAdapter.java | 4
app/src/main/res/layout/layout_rtk_setting.xml | 12 ++++
lib/src/main/cpp/native-lib.cpp | 1
app/src/main/java/safeluck/drive/evaluation/fragment/RTKConfigFragment.java | 56 ++++++++++++++++++
lib/build.gradle | 2
10 files changed, 110 insertions(+), 39 deletions(-)
diff --git a/app/src/main/java/safeluck/drive/evaluation/adapter/SimpleFragmentAdapter.java b/app/src/main/java/safeluck/drive/evaluation/adapter/SimpleFragmentAdapter.java
index 4129fd3..3de4266 100644
--- a/app/src/main/java/safeluck/drive/evaluation/adapter/SimpleFragmentAdapter.java
+++ b/app/src/main/java/safeluck/drive/evaluation/adapter/SimpleFragmentAdapter.java
@@ -9,7 +9,7 @@
import me.yokeyword.fragmentation.SupportFragment;
import safeluck.drive.evaluation.fragment.BaseDatasFragment;
-import safeluck.drive.evaluation.fragment.FtpConfigFragment;
+import safeluck.drive.evaluation.fragment.RTKConfigFragment;
import safeluck.drive.evaluation.fragment.JiaXiaoFragment;
@@ -34,7 +34,7 @@
supportFragment = BaseDatasFragment.newInstance();
break;
case 1:
- supportFragment = FtpConfigFragment.newInstance();
+ supportFragment = RTKConfigFragment.newInstance();
//ftp
break;
case 2:
diff --git a/app/src/main/java/safeluck/drive/evaluation/app.java b/app/src/main/java/safeluck/drive/evaluation/app.java
index 9e4bb24..87d6bb6 100644
--- a/app/src/main/java/safeluck/drive/evaluation/app.java
+++ b/app/src/main/java/safeluck/drive/evaluation/app.java
@@ -18,8 +18,12 @@
import com.google.gson.Gson;
+import org.json.JSONException;
+import org.json.JSONObject;
+
import safeluck.drive.evaluation.DB.failitems.FailedProj;
import safeluck.drive.evaluation.DB.failitems.FailedProjRepository;
+import safeluck.drive.evaluation.bean.RTKConfig;
import safeluck.drive.evaluation.cEventCenter.CEventCenter;
import safeluck.drive.evaluation.util.FileUtil;
import safeluck.drive.evaluation.util.SystemUtil;
@@ -34,7 +38,7 @@
private static final String TAG = "app";
private Gson gson;
-
+ RTKConfig rtkConfig;
@Override
public void onCreate() {
super.onCreate();
@@ -56,6 +60,18 @@
Log.i(TAG, "onCreate: ");
MyLog.createIfNotExist();
Stetho.initializeWithDefaults(this);
+
+ //RTK閰嶇疆淇℃伅
+ rtkConfig = new RTKConfig();
+ rtkConfig.setCity(12);
+ rtkConfig.setImei("460123874561");
+ rtkConfig.setInterval(1);
+ rtkConfig.setIp("47.93.80.84");
+ rtkConfig.setModel("123");
+ rtkConfig.setPhone("2019101500000001");
+ rtkConfig.setPort(12125);
+ rtkConfig.setProvince(23);
+ rtkConfig.setSn("2019101500000001");
}
}
@@ -80,10 +96,25 @@
case Constant.NDK_START:
Toast.makeText(this, "NDK start", Toast.LENGTH_SHORT).show();
break;
+ case Constant.RTK_PLATFORM_REGISTER_STATUS:
+ try {
+ JSONObject jsonObject = new JSONObject();
+ int reg_code = jsonObject.getInt("register_code");
+ String rtkLoginPwd = jsonObject.getString("password");
+ rtkConfig.setPassword(rtkLoginPwd);
+ rtkConfig.setRegistered(reg_code);
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+ break;
+ case Constant.RTK_PLATFORM_REGISTER_RESULT:
+ break;
case Constant.FETCH_RTK_PLATFORM_INFO:
- StringBuffer stringBuffer = FileUtil.readAssetTxtFile(getApplicationContext(),Constant.RTK_CONFIG_JSON);
- MyLog.i(TAG, "RTK閰嶇疆淇℃伅锛�"+stringBuffer.toString());
- AYSdk.getInstance().sendCmd(Constant.PUSH_RTK_PLATFORM_INFO,stringBuffer.toString());
+ if (gson == null){
+ gson = new Gson();
+ }
+ MyLog.i(TAG, "RTK閰嶇疆淇℃伅锛�"+gson.toJson(rtkConfig));
+ AYSdk.getInstance().sendCmd(Constant.PUSH_RTK_PLATFORM_INFO,gson.toJson(rtkConfig));
break;
case Constant.JUDGE_INFO:
FailedProjRepository failedProjRepository = new FailedProjRepository(this);
diff --git a/app/src/main/java/safeluck/drive/evaluation/fragment/FtpConfigFragment.java b/app/src/main/java/safeluck/drive/evaluation/fragment/FtpConfigFragment.java
deleted file mode 100644
index a6f4fc5..0000000
--- a/app/src/main/java/safeluck/drive/evaluation/fragment/FtpConfigFragment.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package safeluck.drive.evaluation.fragment;
-
-import android.os.Bundle;
-import androidx.annotation.NonNull;
-import androidx.annotation.Nullable;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-
-import me.yokeyword.fragmentation.SupportFragment;
-import safeluck.drive.evaluation.R;
-
-/**FTP閰嶇疆UI
- * MyApplication2
- * Created by lzw on 2019/3/20. 11:22:39
- * 閭锛�632393724@qq.com
- * All Rights Saved! Chongqing AnYun Tech co. LTD
- */
-public class FtpConfigFragment extends SupportFragment {
- public static SupportFragment newInstance(){
- return new FtpConfigFragment();
- }
-
- @Nullable
- @Override
- public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
-
-
- View view = inflater.inflate(R.layout.layout_ftp_setting,container,false);
- return view;
- }
-}
diff --git a/app/src/main/java/safeluck/drive/evaluation/fragment/RTKConfigFragment.java b/app/src/main/java/safeluck/drive/evaluation/fragment/RTKConfigFragment.java
new file mode 100644
index 0000000..2988784
--- /dev/null
+++ b/app/src/main/java/safeluck/drive/evaluation/fragment/RTKConfigFragment.java
@@ -0,0 +1,56 @@
+package safeluck.drive.evaluation.fragment;
+
+import android.os.Bundle;
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.EditText;
+
+import com.google.gson.Gson;
+
+import me.yokeyword.fragmentation.SupportFragment;
+import safeluck.drive.evaluation.R;
+import safeluck.drive.evaluation.bean.RTKConfig;
+
+/**FTP閰嶇疆UI
+ * MyApplication2
+ * Created by lzw on 2019/3/20. 11:22:39
+ * 閭锛�632393724@qq.com
+ * All Rights Saved! Chongqing AnYun Tech co. LTD
+ */
+public class RTKConfigFragment extends SupportFragment implements View.OnClickListener {
+
+ private static final String TAG = "RTKConfigFragment";
+
+ private EditText et_ip,et_port,et_city_id,et_city_province,et_phone;
+
+ public static SupportFragment newInstance(){
+ return new RTKConfigFragment();
+ }
+
+ @Nullable
+ @Override
+ public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
+
+
+ View view = inflater.inflate(R.layout.layout_rtk_setting,container,false);
+ initView(view);
+ return view;
+ }
+
+ private void initView(View view) {
+ view.findViewById(R.id.btn_save_rtk).setOnClickListener(this);
+ }
+
+ @Override
+ public void onClick(View v) {
+ switch (v.getId()){
+ case R.id.btn_save_rtk:
+ Gson gson = new Gson();
+ String rtkConfigjson = gson.toJson(RTKConfig.class);
+ break;
+ }
+ }
+}
diff --git a/app/src/main/res/layout/layout_ftp_setting.xml b/app/src/main/res/layout/layout_rtk_setting.xml
similarity index 87%
rename from app/src/main/res/layout/layout_ftp_setting.xml
rename to app/src/main/res/layout/layout_rtk_setting.xml
index 5fcae59..7be4603 100644
--- a/app/src/main/res/layout/layout_ftp_setting.xml
+++ b/app/src/main/res/layout/layout_rtk_setting.xml
@@ -78,6 +78,18 @@
android:text="192"
android:inputType="numberDecimal"
android:background="@android:drawable/editbox_background_normal"/>
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginLeft="10dp"
+ android:text="鐢佃瘽锛�"/>
+ <EditText
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:id="@+id/et_phone"
+ android:text="19234567894"
+ android:inputType="numberDecimal"
+ android:background="@android:drawable/editbox_background_normal"/>
</LinearLayout>
<View
android:layout_width="match_parent"
diff --git a/lib/build.gradle b/lib/build.gradle
index cdc5d5b..af41cde 100644
--- a/lib/build.gradle
+++ b/lib/build.gradle
@@ -14,7 +14,7 @@
externalNativeBuild {
cmake {
- cppFlags ""
+ cppFlags "-std=c++11 -frtti -fexceptions"
}
}
ndk {
diff --git a/lib/src/main/cpp/native-lib.cpp b/lib/src/main/cpp/native-lib.cpp
index 45a0531..0729f69 100644
--- a/lib/src/main/cpp/native-lib.cpp
+++ b/lib/src/main/cpp/native-lib.cpp
@@ -2,6 +2,7 @@
#include <string>
#include <pthread.h>
#include <unistd.h>
+#include <cstdlib>
#include "common/serial_port.h"
#include "jni_log.h"
#include "common/net.h"
diff --git a/lib/src/main/cpp/test_items/park_bottom.cpp b/lib/src/main/cpp/test_items/park_bottom.cpp
index 39d7111..706d6f5 100644
--- a/lib/src/main/cpp/test_items/park_bottom.cpp
+++ b/lib/src/main/cpp/test_items/park_bottom.cpp
@@ -9,6 +9,7 @@
#include "../jni_log.h"
#include "../driver_test.h"
#include <vector>
+#include <cstdlib>
#define DEBUG(fmt, args...) LOGD("<park_bottom> <%s>: " fmt, __func__, ##args)
diff --git a/lib/src/main/cpp/test_items/park_edge.cpp b/lib/src/main/cpp/test_items/park_edge.cpp
index 205013e..6b1d625 100644
--- a/lib/src/main/cpp/test_items/park_edge.cpp
+++ b/lib/src/main/cpp/test_items/park_edge.cpp
@@ -9,6 +9,7 @@
#include "../native-lib.h"
#include <vector>
+#include <cstdlib>
using namespace std;
diff --git a/lib/src/main/cpp/test_items/turn_a90.cpp b/lib/src/main/cpp/test_items/turn_a90.cpp
index 9d031a6..68d1a43 100644
--- a/lib/src/main/cpp/test_items/turn_a90.cpp
+++ b/lib/src/main/cpp/test_items/turn_a90.cpp
@@ -9,6 +9,7 @@
#include "../jni_log.h"
#include <vector>
+#include <cstdlib>
#define DEBUG(fmt, args...) LOGD("<turn_a90> <%s>: " fmt, __func__, ##args)
--
Gitblit v1.8.0