From 03e19b8cdea0ddd28da1a1738c5b62f7f97cd2e0 Mon Sep 17 00:00:00 2001
From: yy1717 <fctom1215@outlook.com>
Date: 星期二, 07 一月 2020 13:29:32 +0800
Subject: [PATCH] 修改进程间接口,统一为foo(int, string)

---
 app/src/main/java/safeluck/drive/evaluation/app.java         |    2 +-
 lib/src/main/java/com/anyun/exam/lib/SvrManager.java         |    4 ++--
 lib/src/main/cpp/driver_test.cpp                             |    2 +-
 lib/src/main/aidl/com/anyun/exam/lib/IListenerInterface.aidl |    2 +-
 lib/src/main/java/com/anyun/exam/lib/IAYExamListener.java    |    2 +-
 lib/src/main/aidl/com/anyun/exam/lib/IRemoteInterface.aidl   |    1 +
 lib/src/main/java/com/anyun/exam/lib/RemoteService.java      |   11 ++++++-----
 7 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/app/src/main/java/safeluck/drive/evaluation/app.java b/app/src/main/java/safeluck/drive/evaluation/app.java
index 90930b5..b4f7be0 100644
--- a/app/src/main/java/safeluck/drive/evaluation/app.java
+++ b/app/src/main/java/safeluck/drive/evaluation/app.java
@@ -67,7 +67,7 @@
     }
 
     @Override
-    public void callBackMsg(String json) {
+    public void callBackMsg(int cmd, String json) {
         MyLog.d(TAG, "鏀跺埌==" + json);
         CEventCenter.dispatchEvent("train",0,0,json);
     }
diff --git a/lib/src/main/aidl/com/anyun/exam/lib/IListenerInterface.aidl b/lib/src/main/aidl/com/anyun/exam/lib/IListenerInterface.aidl
index 0bf8dbb..421c6f1 100644
--- a/lib/src/main/aidl/com/anyun/exam/lib/IListenerInterface.aidl
+++ b/lib/src/main/aidl/com/anyun/exam/lib/IListenerInterface.aidl
@@ -9,5 +9,5 @@
      * Demonstrates some basic types that you can use as parameters
      * and return values in AIDL.
      */
-    void onMessageArrived(String json);
+    void onMessageArrived(int cmd, String json);
 }
diff --git a/lib/src/main/aidl/com/anyun/exam/lib/IRemoteInterface.aidl b/lib/src/main/aidl/com/anyun/exam/lib/IRemoteInterface.aidl
index 15d0d3e..a9b6bed 100644
--- a/lib/src/main/aidl/com/anyun/exam/lib/IRemoteInterface.aidl
+++ b/lib/src/main/aidl/com/anyun/exam/lib/IRemoteInterface.aidl
@@ -13,4 +13,5 @@
             void registListener(IListenerInterface i);
             void unRegistListener(IListenerInterface i);
             void add();
+            void SendCmd(int cmd, String value);
 }
diff --git a/lib/src/main/cpp/driver_test.cpp b/lib/src/main/cpp/driver_test.cpp
index 03fe9d4..a2259d3 100644
--- a/lib/src/main/cpp/driver_test.cpp
+++ b/lib/src/main/cpp/driver_test.cpp
@@ -57,7 +57,7 @@
 static Polygon theTurn90Map;
 static Polygon theSSMap;
 
-#define CAR_COORD_STORE_SIZE        11
+#define CAR_COORD_STORE_SIZE        10
 
 struct car_coord_ {
     uint32_t uptime;
diff --git a/lib/src/main/java/com/anyun/exam/lib/IAYExamListener.java b/lib/src/main/java/com/anyun/exam/lib/IAYExamListener.java
index cde1ac5..4f812d9 100644
--- a/lib/src/main/java/com/anyun/exam/lib/IAYExamListener.java
+++ b/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(String json);
+    void callBackMsg(int cmd, String json);
 }
diff --git a/lib/src/main/java/com/anyun/exam/lib/RemoteService.java b/lib/src/main/java/com/anyun/exam/lib/RemoteService.java
index 90bab00..b28979c 100644
--- a/lib/src/main/java/com/anyun/exam/lib/RemoteService.java
+++ b/lib/src/main/java/com/anyun/exam/lib/RemoteService.java
@@ -50,7 +50,10 @@
                 Log.i(TAG,"瀹㈡埛绔皟鐢ㄦ湇鍔$鏂规硶");
         }
 
+        @Override
+        public void SendCmd(int cmd, String value) throws RemoteException {
 
+        }
     };
     @Nullable
     @Override
@@ -78,7 +81,7 @@
                 } catch (InterruptedException e) {
                     e.printStackTrace();
                 }
-                onMessageArrived(String.format("娑堟伅ID锛�%d,璇锋敞鎰忔煡鏀�",msgId++));
+                onMessageArrived(msgId, String.format("娑堟伅ID锛�%d,璇锋敞鎰忔煡鏀�",msgId++));
             }
 
         }
@@ -91,18 +94,16 @@
         mIsServiceDestroyed.set(true);
     }
 
-    private void onMessageArrived(String json){
+    private void onMessageArrived(int cmd, String json){
         int N = mListenerList.getRegisteredCallbackCount();
 
-        Log.d(TAG, "getRegisteredCallbackCount = " + N);
         mListenerList.beginBroadcast();
 
         for (int i = 0; i < N; i++) {
-
             mListener  = mListenerList.getBroadcastItem(i);
             if (mListener != null){
                 try {
-                    mListener.onMessageArrived(json);
+                    mListener.onMessageArrived(cmd, json);
                 } catch (RemoteException e) {
                     e.printStackTrace();
                 }
diff --git a/lib/src/main/java/com/anyun/exam/lib/SvrManager.java b/lib/src/main/java/com/anyun/exam/lib/SvrManager.java
index 8335ad4..823800a 100644
--- a/lib/src/main/java/com/anyun/exam/lib/SvrManager.java
+++ b/lib/src/main/java/com/anyun/exam/lib/SvrManager.java
@@ -123,10 +123,10 @@
      */
     IListenerInterface RemoteCallback = new IListenerInterface.Stub(){
         @Override
-        public void onMessageArrived(String json) throws RemoteException {
+        public void onMessageArrived(int cmd, String json) throws RemoteException {
 
             if (mCallback != null){
-                mCallback.callBackMsg(json);
+                mCallback.callBackMsg(cmd, json);
             }
         }
 

--
Gitblit v1.8.0