|
@@ -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";
|
|
|
}
|
|
|
}
|