Przeglądaj źródła

[WallPadMain]
1. 일괄소등 동기화 추가

jglee 2 lat temu
rodzic
commit
e28ce5b4f2

BIN
WallPadMain/libs/WallPadAPI.jar


+ 1 - 0
WallPadMain/src/main/java/kr/co/icontrols/wallpadmain/declare/ID.java

@@ -1052,6 +1052,7 @@ public final class ID {
 
 
         public class COLLECTIVELIGHTCTRL {
         public class COLLECTIVELIGHTCTRL {
             protected final static int BASE = ACTIVITIES.PopupActivity + POPUPS.POPUP_COLLECTIVELIGHTCTRL;
             protected final static int BASE = ACTIVITIES.PopupActivity + POPUPS.POPUP_COLLECTIVELIGHTCTRL;
+            public final static String BR_COLLECTIVELIGHTCTRL = " kr.co.icontrols.wallpadmain.BR_" + "COLLECTIVELIGHTCTRL" + "(" + BASE + ")";
 
 
             public final class ELEMENTS {
             public final class ELEMENTS {
                 public final class IMAGES {
                 public final class IMAGES {

+ 81 - 2
WallPadMain/src/main/java/kr/co/icontrols/wallpadmain/popup/CollectiveLightCTRL.java

@@ -88,13 +88,15 @@ public class CollectiveLightCTRL extends WpadScreen {
             ViewRegistration(layout, TXT_TITLE, getPosition(ID.POPUPS.COLLECTIVELIGHTCTRL.ELEMENTS.TEXTS.TITLE).X, getPosition(ID.POPUPS.COLLECTIVELIGHTCTRL.ELEMENTS.TEXTS.TITLE).Y);
             ViewRegistration(layout, TXT_TITLE, getPosition(ID.POPUPS.COLLECTIVELIGHTCTRL.ELEMENTS.TEXTS.TITLE).X, getPosition(ID.POPUPS.COLLECTIVELIGHTCTRL.ELEMENTS.TEXTS.TITLE).Y);
             TXT_TITLE.setText(strTitle);
             TXT_TITLE.setText(strTitle);
         }
         }
-        
+
+        if(mWallPadAPI!=null) Device_BrRegistration(true);
         displayCollectiveLightStatus();
         displayCollectiveLightStatus();
 	}
 	}
 
 
 	@Override
 	@Override
 	protected void onClose() {
 	protected void onClose() {
 		super.onClose();
 		super.onClose();
+		if(mWallPadAPI!=null) Device_BrRegistration(false);
 		Log.d(TAG, "[END   - Screen] ********************************************");
 		Log.d(TAG, "[END   - Screen] ********************************************");
 	}
 	}
 	
 	
@@ -170,10 +172,87 @@ public class CollectiveLightCTRL extends WpadScreen {
 		return super.addBrActionFilter(action);
 		return super.addBrActionFilter(action);
 	}
 	}
 
 
-	@Override
+
+    /**
+     * 디바이스에 알림 BR 을 등록한다.
+     *
+     * @return (int) - >=0 : 성공, <0 : 실패
+     */
+    private int Device_BrRegistration(boolean OnOff)
+    {
+        Log.d(TAG, "[Device_BrRegistration] - Start (OnOff:" + OnOff + ")");
+
+        String BR_NAME = ID.POPUPS.COLLECTIVELIGHTCTRL.BR_COLLECTIVELIGHTCTRL;
+
+        // 1. Api Load Check
+        if(mWallPadAPI == null)
+        {
+            Log.e(TAG, "[Device_BrRegistration] - mWallPadAPI unload !!!");
+            return -1;
+        }
+
+        if(OnOff)
+        {
+            try
+            {
+                //DebugLogOutput("[Device_BrRegistration] - regChangedBR START");
+                mWallPadAPI.regChangedBR(BR_NAME);
+                //DebugLogOutput("[Device_BrRegistration] - regChangedBR END");
+            }
+            catch (RuntimeException re) {
+                LogUtil.errorLogInfo("", TAG, re);
+                return -101;
+            }
+            catch (Exception e)
+            {
+                Log.e(TAG, "[Device_BrRegistration] - [Exception Error] gasApi.regChangedBR");
+                Log.e(TAG, "[Device_BrRegistration] - " + e.toString());
+                //e.printStackTrace();
+                LogUtil.errorLogInfo("", TAG, e);
+                return -101;
+            }
+            super.addBrActionFilter(BR_NAME);
+        }
+        else
+        {
+            try
+            {
+                //DebugLogOutput("[Device_BrRegistration] - unregChangedBR START");
+                mWallPadAPI.unregChangedBR(BR_NAME);
+                //DebugLogOutput("[Device_BrRegistration] - unregChangedBR END");
+            }
+            catch (RuntimeException re) {
+                LogUtil.errorLogInfo("", TAG, re);
+                return -102;
+            }
+            catch (Exception e)
+            {
+                Log.e(TAG, "[Device_BrRegistration] - [Exception Error] mWallPadAPI.unregChangedBR");
+                Log.e(TAG, "[Device_BrRegistration] - " + e.toString());
+                //e.printStackTrace();
+                LogUtil.errorLogInfo("", TAG, e);
+                return -102;
+            }
+            super.removeBrActionFilter(BR_NAME);
+        }
+
+        return 0;
+    }
+
+
+    @Override
 	protected void onBrReceive(Intent intent) {
 	protected void onBrReceive(Intent intent) {
 		// TODO Auto-generated method stub
 		// TODO Auto-generated method stub
 		super.onBrReceive(intent);
 		super.onBrReceive(intent);
+        String ActionName = intent.getAction();
+
+        Log.d(TAG, "[[[[ onBrReceive ]]]]  ActionName = " + ActionName);
+        if(ActionName.equals(ID.POPUPS.COLLECTIVELIGHTCTRL.BR_COLLECTIVELIGHTCTRL))
+        {
+            Log.d(TAG, "onBrReceive - BR_COLLECTIVELIGHTCTRL");
+            displayCollectiveLightStatus();
+        }
+
 		Common.DebugLog("--------------------onBrReceive ---> intent.getAction(): " + intent.getAction());
 		Common.DebugLog("--------------------onBrReceive ---> intent.getAction(): " + intent.getAction());
 		
 		
 	}
 	}