Pārlūkot izejas kodu

[WallPadMain]
1. ADB 원격 디버깅 추가
- so 파일 교체
- iMap 처리(remote_debug_connect)

2. 가스
- WallpadAPI에서 가스정보 불러오는 경우 아무정보도 못받으면 일반가스가 있는것으로 판단하는 예외처리 추가

3. 버전업
- 2023.03.20.01 -> 2024.05.02.01

jglee 11 mēneši atpakaļ
vecāks
revīzija
bc03cf118b

+ 1 - 1
WallPadMain/src/main/AndroidManifest.xml

@@ -1,7 +1,7 @@
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
     package="kr.co.icontrols.wallpadmain"
     android:versionCode="17"
-    android:versionName="2023.03.20.01">
+    android:versionName="2024.05.02.01">
 
     <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
     <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

+ 9 - 0
WallPadMain/src/main/java/kr/co/icontrols/v40ioctl/V40IOInterface2.java

@@ -53,6 +53,15 @@ public class V40IOInterface2 {
         LcdWakeUp();
     }
 
+    /**
+     * ADB 원격 디버깅
+     */
+    public native void ADBenable(String port);
+
+    public native void ADBdisable();
+
+    public native int ADBstate();
+
     public void setDns(String dns1, String dns2) {
         NetDns1(dns1);
         NetDns2(dns2);

+ 69 - 0
WallPadMain/src/main/java/kr/co/icontrols/wallpadmain/IOInterface.java

@@ -1997,4 +1997,73 @@ public class IOInterface {
         }
     }
 
+
+    /*=======================================================*
+     * ADB 원격 디버깅
+     *=======================================================*/
+
+    /**
+     * Remote ADB Connection enable
+     * IP: WallPad IP
+     * @param port 15000
+     */
+    public void enableADBRemoteConnect(String port) {
+        try {
+            if (Version.getPlatformType() != Version.PLATFORM_TYPE.A40i) {
+                Log.w(TAG, "[enableADBRemoteConnect] Not supported device -> This device is not the A40i device!!");
+                return;
+            }
+
+            Log.d(TAG, "[enableADBRemoteConnect] ===== START =====");
+            ctrlWallpadJNI(true);
+            mV40IOIF_NOUGAT.ADBenable(port);
+        } catch (Exception e) {
+            Log.e(TAG, "[Exception] enableADBRemoteConnect(String port)");
+            e.printStackTrace();
+        }
+    }
+
+    /**
+     * Remote ADB Connection disable
+     */
+    public void disableADBRemoteConnect() {
+        try {
+            if (Version.getPlatformType() != Version.PLATFORM_TYPE.A40i) {
+                Log.w(TAG, "[disableADBRemoteConnect] Not supported device -> This device is not the A40i device!!");
+                return;
+            }
+
+            Log.d(TAG, "[disableADBRemoteConnect] ===== START =====");
+            ctrlWallpadJNI(true);
+            mV40IOIF_NOUGAT.ADBdisable();
+        } catch (Exception e) {
+            Log.e(TAG, "[Exception] disableADBRemoteConnect()");
+            e.printStackTrace();
+        }
+    }
+
+    /**
+     * Remote ADB Connection state check
+     * @return result
+     */
+    public int checkADBRemoteConnect() {
+        int nResult = -1;
+        try {
+            if (Version.getPlatformType() != Version.PLATFORM_TYPE.A40i) {
+                Log.w(TAG, "[checkADBRemoteConnect] Not supported device -> This device is not the A40i device!!");
+                return nResult;
+            }
+
+            Log.d(TAG, "[checkADBRemoteConnect] ===== START =====");
+            ctrlWallpadJNI(true);
+            nResult = mV40IOIF_NOUGAT.ADBstate();
+            ctrlWallpadJNI(false);
+            Log.i(TAG, "[checkADBRemoteConnect] nResult [" + nResult + "]");
+        } catch (Exception e) {
+            Log.e(TAG, "[Exception] checkADBRemoteConnect()");
+            e.printStackTrace();
+        }
+        return nResult;
+    }
+
 }

+ 163 - 1
WallPadMain/src/main/java/kr/co/icontrols/wallpadmain/util/iMapServer.java

@@ -100,6 +100,8 @@ import java.util.GregorianCalendar;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Queue;
+import java.util.Timer;
+import java.util.TimerTask;
 
 import javax.net.ssl.SSLServerSocket;
 import javax.xml.parsers.DocumentBuilder;
@@ -4175,6 +4177,10 @@ public class iMapServer extends Service {
                                 retXML = iCMDProcEntireLightControl(doc); // 전체 조명 제어
                             }
                         }
+                        //jglee - 2024.05.02 원격 디버그 추가
+                        else if( cmd.equalsIgnoreCase("remote_debug_connect")) {
+                            retXML = imapRemoteDebugConnect(doc);
+                        }
                         break;
                     }
                 }
@@ -4240,6 +4246,161 @@ public class iMapServer extends Service {
         }
     }
 
+
+    /** ADB 원격 디버깅 */
+    public String imapRemoteDebugConnect(Document doc) {
+        Log.d(TAG, "[imapRemoteDebugConnect] START -----------");
+        String resultstr = XMLHeader + "<service type=\"reply\" name=\"" + "remote_debug_connect" + "\" result=";
+        String action = "", id = "", pw = "", duration = "", port = "", message = "";
+        try {
+            // action
+            NodeList items = doc.getElementsByTagName("action");
+            Node item = items.item(0);
+            if (item == null) return resultstr += "\"fail\"/> \r\n </imap>";
+
+            Element element = (Element) items.item(0);
+            action = element.getTextContent().replace("\"", "").trim();
+
+            items = doc.getElementsByTagName("account");
+            element = (Element) items.item(0);
+            NamedNodeMap mAttrs = element.getAttributes();
+            int nAttrCnt = mAttrs.getLength();
+            Log.d(TAG, "[imapRemoteDebugConnect] nAttrCnt [" + nAttrCnt + "]");
+            for (int i = 0; i < nAttrCnt; i++) {
+                Node mAttr = mAttrs.item(i);
+                if (i == 0) {
+                    if (!mAttr.getNodeName().equalsIgnoreCase("id"))
+                        return resultstr += "\"fail\"/> \r\n </imap>";
+                    id = mAttr.getNodeValue();
+                }
+                else if (i == 1) {
+                    if (!mAttr.getNodeName().equalsIgnoreCase("pw"))
+                        return resultstr += "\"fail\"/> \r\n </imap>";
+                    pw = mAttr.getNodeValue();
+                }
+                else {
+                    return resultstr += "\"fail\"/> \r\n </imap>";
+                }
+            }
+
+            items = doc.getElementsByTagName("option");
+            element = (Element) items.item(0);
+            mAttrs = element.getAttributes();
+            nAttrCnt = mAttrs.getLength();
+            Log.d(TAG, "[imapRemoteDebugConnect] nAttrCnt [" + nAttrCnt + "]");
+            for (int i = 0; i < nAttrCnt; i++) {
+                Node mAttr = mAttrs.item(i);
+                if (i == 0) {
+                    if (!mAttr.getNodeName().equalsIgnoreCase("duration"))
+                        return resultstr += "\"fail\"/> \r\n </imap>";
+                    duration = mAttr.getNodeValue();
+                }
+                else if (i == 1) {
+                    if (!mAttr.getNodeName().equalsIgnoreCase("port"))
+                        return resultstr += "\"fail\"/> \r\n </imap>";
+                    port = mAttr.getNodeValue();
+                }
+                else {
+                    return resultstr += "\"fail\"/> \r\n </imap>";
+                }
+            }
+
+            items = doc.getElementsByTagName("message");
+            element = (Element) items.item(0);
+            message = element.getTextContent().replace("\"", "").trim();
+
+            Log.d(TAG, "[imapRemoteDebugConnect] action [" + action + "]");
+            Log.d(TAG, "[imapRemoteDebugConnect] id [" + id + "], pw [" + pw + "], duration [" + duration + "], port [" + port + "]");
+            Log.d(TAG, "[imapRemoteDebugConnect] message [" + message + "]");
+
+            if (!checkRemoteDebugAccount(id, pw)) return resultstr += "\"fail\"/> \r\n </imap>";
+
+            if (action.equalsIgnoreCase("enable")) {
+                ctrlRemoteDebugConnect(true, port, Integer.parseInt(duration));
+            }
+            else if (action.equalsIgnoreCase("disable")) {
+                ctrlRemoteDebugConnect(false, port, Integer.parseInt(duration));
+            }
+            else {
+                return resultstr += "\"fail\"/> \r\n </imap>";
+            }
+            return resultstr += "\"ok\"/> \r\n </imap>";
+        } catch (RuntimeException re) {
+            Log.e(TAG, "[imapRemoteDebugConnect] RuntimeException");
+            LogUtil.errorLogInfo("", TAG, re);
+        } catch (Exception e) {
+            Log.e(TAG, "[imapRemoteDebugConnect] Exception");
+            LogUtil.errorLogInfo("", TAG, e);
+        }
+        return resultstr += "\"fail\"/> \r\n </imap>";
+    }
+
+
+    /** ADB 원격 디버깅 계정 정보 확인 */
+    public boolean checkRemoteDebugAccount(String id, String pw) {
+        try {
+            if (id.equals("icontrols")) {
+                if (pw.equals("hdc1208193646#$")) {
+                    Log.i(TAG, "[checkRemoteDebugAccount] Account correct!!");
+                    return true;
+                }
+                else {
+                    Log.w(TAG, "[checkRemoteDebugAccount] PW incorrect!!");
+                    return false;
+                }
+            }
+            else {
+                Log.w(TAG, "[checkRemoteDebugAccount] ID incorrect!!");
+                return false;
+            }
+        } catch (Exception e) {
+            Log.e(TAG, "[Exception] checkRemoteDebugAccount(String id, String pw)");
+            e.printStackTrace();
+            return false;
+        }
+    }
+
+    public void ctrlRemoteDebugConnect(boolean enable, String port, int mins) {
+        try {
+            Log.d(TAG, "[ctrlRemoteDebugConnect] enable [" + enable + "], port [" + port + "], mins [" + mins + "]");
+            if (enable) {
+                if (0 >= nRemoteDebugCntDN) {
+                    RemoteDebugTimer = new Timer();
+                    RemoteDebugTimer.schedule(new RemoteDebugCntDN(), 1000, 60000);
+                    if (mIOInterface.checkADBRemoteConnect() == -1) {
+                        // 미사용중
+                        mIOInterface.enableADBRemoteConnect(port);
+                    }
+                    nRemoteDebugCntDN = mins;
+                }
+            } else {
+                mIOInterface.disableADBRemoteConnect();
+            }
+        } catch (Exception e) {
+            Log.e(TAG, "[Exception] ctrlRemoteDebugConnect()");
+            e.printStackTrace();
+        }
+    }
+
+    public int nRemoteDebugCntDN = 0;
+    Timer RemoteDebugTimer = null;
+    public class RemoteDebugCntDN extends TimerTask {
+        @Override
+        public void run() {
+            try {
+                nRemoteDebugCntDN--;
+                Log.d(TAG, "[RemoteDebugCntDN] nRemoteDebugCntDN [" + nRemoteDebugCntDN + "]");
+                if (0 >= nRemoteDebugCntDN) {
+                    RemoteDebugTimer.cancel();
+                    RemoteDebugTimer = null;
+                }
+            } catch (Exception e) {
+                Log.e(TAG, "[Exception] RemoteDebugCntDN().run() : " + e);
+                e.printStackTrace();
+            }
+        }
+    }
+
 	// " 제거
 	private String trimquotation(String sen) {
 		sen = sen.replaceAll("\"", "");
@@ -6350,7 +6511,8 @@ public class iMapServer extends Service {
                         }
                     }
                     else {
-                        strResult +="         <devinfo name=\"gas\" value=\"0\"/>\r\n";
+                        //jglee - 2024.05.02 월패드 API 처리가 안되는경우에 대한 예외처리 추가
+                        strResult +="         <devinfo name=\"gas\" value=\"1\"/>\r\n";
                         strResult +="         <devinfo name=\"cooktop\" value=\"0\"/>\r\n";
                     }
                 }

BIN
WallPadMain/src/main/jniLibs/armeabi-v7a/libwpd_v40interface2-jni.so


BIN
WallPadMain/src/main/jniLibs/armeabi/libwpd_v40interface2-jni.so