Browse Source

모바일앱 명칭 전달 관련 수정. 일부 코드정리.

jslee(madeinlab) 3 years ago
parent
commit
33e3526a8b

+ 0 - 8
WallPadDevService/src/main/java/com/artncore/wallpaddevservice/driver/Knx_SystemAircon_Controller.java

@@ -1614,14 +1614,6 @@ public class Knx_SystemAircon_Controller extends DeviceManager
             ErrorCode |= 0x1;
         }
 
-        WallpadStatusData wsda = new WallpadStatusData(ServiceMain.svcContext);
-        int before = wsda.GetHeatingRoomNum();
-        wsda.closeDB();
-        if(before != info.InsideAirconCount)
-        {
-            //SendHeatingRoomNumBR(info.InsideAirconCount);
-        }
-
         if(DriverInfo.Vendor != info.Vendor)       { bChanged = true; ErrorCode |= 0x2; }
         if(DriverInfo.AirconStatus != info.AirconStatus)       { bChanged = true; ErrorCode |= 0x3; }
 

+ 4 - 1
WallPadHomeCtrl/src/main/java/kr/co/icontrols/wallpadhomectrl/screen/screen_heating/HeatingV2MainScreen.java

@@ -923,7 +923,10 @@ public class HeatingV2MainScreen extends WpadScreen {
 
                 // 설정온도 표시
                 if (Data_DriveModeConverterOnOff(index)) drawSetTemper(pos, roomData.SetTemp);
-                else roomView[index].TXT_TEMPER_SET.setText("");
+                else {
+                    if(roomView[index]!=null)
+                        roomView[index].TXT_TEMPER_SET.setText("");
+                }
             }
 
             // 하단 전체방 외출 or 일시정지 버튼 활성화 비활성화

+ 53 - 135
WallPadMain/src/main/java/kr/co/icontrols/wallpadmain/util/iMapServer.java

@@ -98,6 +98,7 @@ import java.net.ServerSocket;
 import java.net.Socket;
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Calendar;
 import java.util.Date;
 import java.util.GregorianCalendar;
@@ -2947,6 +2948,7 @@ public class iMapServer extends Service {
     String remote_get_home_devices1;
     String remote_get_home_devices2;
     String remote_get_home_devices3;
+    int skipCount = 0;
 
     /**
      * activity로부터 binding 된 Messenger
@@ -4958,6 +4960,10 @@ public class iMapServer extends Service {
             String[] RoomList = {"room1", "room2", "room3", "room4", "room5", "room6", "room7", "room8"};
             tempercmd.actionTXT = trimquotation(tempercmd.actionTXT);
 
+            String[] knxRoomNameList = getRoomNameFromDBV2(define.ROOM_NAME_HEATING);
+
+            if(knxRoomNameList==null)   knxRoomNameList = mDefaultRoomNameList_Heating;
+
             // 난방 종류를 얻어온다.
             int HeatingKind = mWallPadAPI.GetHeatingKind();
             HeatingV1API heatingV1API = null;
@@ -5144,7 +5150,7 @@ public class iMapServer extends Service {
                             resultStr += "      <status_map dev_num=\"" + (i+1) + "\" unit_cnt = \"1\"/>\r\n";
 
                             if (target.equalsIgnoreCase(REMOTETYPE_SVR2MOBILEAUTH) || target.equalsIgnoreCase(REMOTETYPE_SVR2WEB)) {
-                                resultStr += "         <status_info unit_num=\"" + RoomList[i] + "\" unit_status=\"" + drvmode + "\" room_name=\"" + mDefaultRoomNameList_Heating[i] + "\"/>\r\n";
+                                resultStr += "         <status_info unit_num=\"" + RoomList[i] + "\" unit_status=\"" + drvmode + "\" room_name=\"" + knxRoomNameList[i] + "\"/>\r\n";
                             } else {
                                 resultStr += "         <status_info unit_num=\"" + RoomList[i] + "\" unit_status=\"" + drvmode + "\"/>\r\n";
                             }
@@ -8403,47 +8409,13 @@ public class iMapServer extends Service {
                     LivingLightCount = 1;
             }
 
-            WallpadStatusData DBMGR = null;
-            DBMGR = new WallpadStatusData(getApplicationContext());
-            AddressSet addc = DBMGR.getAddressMGR(); //DB에서 동호 정보 받아옴
-            DBMGR.closeDB();
-
             //기준층 명칭
-            String[] mDefaultRoomNameList = new String[]{"거실", "침실4", "침실1", "파우더룸", "침실2", "주방1", "침실3",
-                    "복도1", "욕실1", "욕실2","보조주방","욕실3","욕실4","욕실5","복도2", "현관", "신발장", "창고", "주방2", "간이주방"};
-
-            String[] mEtypeRoomNameList = new String[]{"거실", "침실1", "침실2", "침실3", "식당", "주방", "드레스룸1",
-                    "서재", "다용도실", "메이드룸","욕실1","파우더룸","간이주방","테라스계단","오픈라운지","스위치1","스위치2","스위치3","스위치4","스위치5","스위치6","스위치7","스위치8"};
-
-            String [] knxRoomNameList = null;
-
-            // 기준층 A, B, C 타입과 D타입 2003호 , E타입 2001호 구분하여 처리
-            if(Integer.parseInt(addc.Ho) == 2001 || Integer.parseInt(addc.Ho) == 2003)
-            {
-                knxRoomNameList = mEtypeRoomNameList;
-                Log.d(TAG, "yskim[iCMDProcChumDamSmartLightControl] mEtypeRoomNameList");
-            }
-            else
-            {
-                knxRoomNameList = mDefaultRoomNameList;
-                Log.d(TAG, "yskim[iCMDProcChumDamSmartLightControl] mDefaultRoomNameList");
-            }
-
-            WallpadDeviceSet devSet = new WallpadDeviceSet(getApplicationContext());
-            String[] strValue = devSet.GetSettingData("KNX명칭");
-            devSet.closeDB();
+            String[] defaultNameList = new String[]{"거실", "침실4", "침실1", "파우더룸", "침실2", "주방1", "침실3",
+                    "복도1", "욕실1", "욕실2","보조주방","욕실3","욕실4","욕실5","복도2", "현관", "신발장", "창고", "주방2", "드레스룸2", "서재1", "작업실","드레스룸3","추가룸1","추가룸2","추가룸3","추가룸4","추가룸5"};
 
-            // 현대건설 더 펜트하우스 서버에서 설정된 명칭이 있다면 그 명칭을 사용하도록 한다.
-            if( strValue != null ) {
-                String strLight = strValue[1].substring( (strValue[1].indexOf("조명(") + 3) , (strValue[1].indexOf(")난방(")));
-                String strHeating = strValue[1].substring( (strValue[1].indexOf("난방(") + 3) , (strValue[1].indexOf(")에어컨(")));
-                String strAircon = strValue[1].substring( (strValue[1].indexOf("에어컨(") + 4) , (strValue[1].indexOf("))")));
-//            DebugLogOutput("[Create] - room name strlight "  + strLight);
-//            DebugLogOutput("[Create] - room name strHeating "  + strHeating);
-//            DebugLogOutput("[Create] - room name strAircon "  + strAircon);
-                if( strLight != null)knxRoomNameList = strLight.split("_");
-            }
+            String[] knxRoomNameList = getRoomNameFromDBV2(define.ROOM_NAME_LIGHT);
 
+            if(knxRoomNameList==null)   knxRoomNameList = defaultNameList;
 
             int BadLightCount = KnxApi.data.MasterController.Info.Bad_EnergyMeterCount;
             int totalLightCount = LivingLightCount + BadLightCount;
@@ -9486,7 +9458,6 @@ public class iMapServer extends Service {
                     else if (attr.getNodeName().equalsIgnoreCase("msg_no")) msgno = attr.getNodeValue();
                 }
             }
-            Log.e(TAG, "[yskim] iCMDProcSysairconControl() iCMDProcSysairconControl : ");
 
             // 단지서버 2.0 사용하는 경우, 모바일 인증 또는 단지 웹 제어 비밀번호 인증 필요 (JEFF, 2019.07.26)
             if (NewServerUse()) {
@@ -9523,51 +9494,17 @@ public class iMapServer extends Service {
             String [] aMode = {"auto","cool","dehum","blow","heat"};
             String strResultStatus = "";
 
-            WallpadStatusData DBMGR = null;
-            DBMGR = new WallpadStatusData(getApplicationContext());
-            AddressSet addc = DBMGR.getAddressMGR(); //DB에서 동호 정보 받아옴
-            DBMGR.closeDB();
-
             //기준층 명칭
-            String[] mDefaultRoomNameList = new String[]{"거실", "침실4", "침실1", "파우더룸", "침실2", "주방1", "침실3",
-                    "복도1", "욕실1", "욕실2","보조주방","욕실3","욕실4","욕실5","복도2", "현관", "신발장", "창고", "주방2", "간이주방"};
+            String[] defaultNameList = new String[]{"거실", "침실4", "침실1", "파우더룸", "침실2", "주방1", "침실3",
+                    "복도1", "욕실1", "욕실2","보조주방","욕실3","욕실4","욕실5","복도2", "현관", "신발장", "창고", "주방2", "드레스룸2", "서재1", "작업실","드레스룸3","추가룸1","추가룸2","추가룸3","추가룸4","추가룸5"};
 
-            String[] mEtypeRoomNameList = new String[]{"거실", "침실1", "침실2", "침실3", "식당", "주방", "드레스룸1",
-                    "서재", "다용도실", "메이드룸","욕실1","파우더룸","간이주방","테라스계단","오픈라운지" ,"스위치1","스위치2","스위치3","스위치4","스위치5","스위치6","스위치7","스위치8"};
+            String[] knxRoomNameList = getRoomNameFromDBV2(define.ROOM_NAME_SYSTEMAIRCON);
 
-            String [] knxRoomNameList = null;
+            if(knxRoomNameList==null)   knxRoomNameList = defaultNameList;
 
             String [] mTextWindType = {"자동", "약", "중", "강"};
             String m_TextWindRange = "자동/약/중/강";
 
-            // 기준층 A, B, C 타입과 D타입 2003호 , E타입 2001호 구분하여 처리
-            if(Integer.parseInt(addc.Ho) == 2001 || Integer.parseInt(addc.Ho) == 2003)
-            {
-                knxRoomNameList = mEtypeRoomNameList;
-                Log.e(TAG, "yskim[iCMDProcKNXConcentControl] mEtypeRoomNameList");
-            }
-            else
-            {
-                knxRoomNameList = mDefaultRoomNameList;
-                Log.e(TAG, "yskim[iCMDProcKNXConcentControl] mDefaultRoomNameList");
-            }
-
-            WallpadDeviceSet devSet = new WallpadDeviceSet(getApplicationContext());
-            String[] strValue = devSet.GetSettingData("KNX명칭");
-            devSet.closeDB();
-
-            // 현대건설 더 펜트하우스 서버에서 설정된 명칭이 있다면 그 명칭을 사용하도록 한다.
-            if( strValue != null ) {
-                String strLight = strValue[1].substring( (strValue[1].indexOf("조명(") + 3) , (strValue[1].indexOf(")난방(")));
-                String strHeating = strValue[1].substring( (strValue[1].indexOf("난방(") + 3) , (strValue[1].indexOf(")에어컨(")));
-                String strAircon = strValue[1].substring( (strValue[1].indexOf("에어컨(") + 4) , (strValue[1].indexOf("))")));
-//            DebugLogOutput("[Create] - room name strlight "  + strLight);
-//            DebugLogOutput("[Create] - room name strHeating "  + strHeating);
-//            DebugLogOutput("[Create] - room name strAircon "  + strAircon);
-                if( strAircon != null)knxRoomNameList = strAircon.split("_");
-            }
-
-
             WallpadDeviceSet mWallpadDeviceSet = new WallpadDeviceSet(getApplicationContext());
             int nResult = mWallpadDeviceSet.Get_DistributionPannelType_Info();
             mWallpadDeviceSet.closeDB();
@@ -9589,7 +9526,7 @@ public class iMapServer extends Service {
                 int ret = (byte) airconAPI.Refresh((byte) 0xFF, false);
                 if (devnum.equalsIgnoreCase("all")) {
 
-                    Log.e(TAG, "[yskim] iCMDProcSysairconControl() iCMDProcSysairconControl : airconTestMode : " + airconTestMode + " nCount : " + nCount );
+                    Log.d(TAG, "[yskim] iCMDProcSysairconControl() iCMDProcSysairconControl : airconTestMode : " + airconTestMode + " nCount : " + nCount );
                     if (airconTestMode == false && ret < 0) {
                         retStr += " \"fail\" >\r\n   </service>\r\n</imap>";
                         return retStr;
@@ -9648,7 +9585,7 @@ public class iMapServer extends Service {
                 CtrList = ctraction.split("/");
                 for( int k = 0 ; k < CtrList.length; k++)
                 {
-                    Log.e(TAG, "[yskim] iCMDProcSysairconControl() iCMDProcSysairconControl : CtrList[k] : " + k + " CtrList[k] : " + CtrList[k]);
+                    Log.d(TAG, "[yskim] iCMDProcSysairconControl() iCMDProcSysairconControl : CtrList[k] : " + k + " CtrList[k] : " + CtrList[k]);
                 }
                 strResultStatus = "";
                 int ret = (byte) airconAPI.Refresh((byte) 0xFF, false);
@@ -13032,7 +12969,12 @@ public class iMapServer extends Service {
                         || Version.getModelType() == Version.MODEL_TYPE.IHN_D101K || Version.getModelType() == Version.MODEL_TYPE.IHN_D101K_I
                         || Version.getModelType() == Version.MODEL_TYPE.IHN_D101_I_OCF) {
                     //다른층의 디바이스 정보를 받아와서 미리 가지고 있어야 한다.
-                    sendMsgToActivity(1234);
+                    if(skipCount==0) {
+                        sendMsgToActivity(1234);
+                        Log.d(TAG, "sendMsgToActivity!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!11");
+                    }
+                    skipCount++;
+                    if(skipCount==3) skipCount = 0 ;
                 }
                 try {
                     Thread.sleep(10000);
@@ -15320,7 +15262,9 @@ public class iMapServer extends Service {
 
                     if (nCheckResult > 0) return MOBILE_USER_AUTH_PASSED;
                     else {
-                        Log.w(TAG, "[checkRemoteCtrlAuthentication] isExistMobileDevice [" + mWallpadMobileDeviceData.isExistMobileDevice(twinid) + "]");
+                        //Log.w(TAG, "[checkRemoteCtrlAuthentication] isExistMobileDevice [" + mWallpadMobileDeviceData.isExistMobileDevice(twinid) + "]");
+                        //닫은 DB에 접근하여서 수정.
+                        Log.w(TAG, "[checkRemoteCtrlAuthentication] isExistMobileDevice [" + nCheckResult + "]");
                         strReplyMsg += " result=\"deny\">\r\n   </service>\r\n</imap>";
                         return strReplyMsg;
                     }
@@ -16276,12 +16220,10 @@ public class iMapServer extends Service {
     boolean bRoomNameLog = true;
     public static final int HEATING = 1;
     public static final int LIGHT = 2;
-    private String[] mRoomNameList_Light = null; //조명 방 명칭
-    private String[] mRoomNameList_Heating = null; //난방 방 명칭
-    private String[] mDefaultRoomNameList = new String[]{"거실", "방1", "방2", "방3", "방4", "방5", "방6", "방7", "방8"};
     private String[] mDefaultRoomNameList_Light = new String[]{"거실", "주방", "방1", "방2", "방3", "방4", "방5", "방6", "방7"};
     private String[] mDefaultRoomNameList_Light_HS = new String[]{"거실", "방1", "방2", "방3", "방4", "방5", "방6", "방7", "방8"};
-    private String[] mDefaultRoomNameList_Heating = new String[]{"거실", "방1", "방2", "방3", "방4", "방5", "방6", "방7", "방8"};
+    private String[] mDefaultRoomNameList_Heating = new String[]{"거실", "침실4", "침실1", "파우더룸", "침실2", "주방1", "침실3",
+            "복도1", "욕실1", "욕실2","보조주방","욕실3","욕실4","욕실5","복도2", "현관", "신발장", "창고", "주방2", "간이주방"};
     private String[] mDefaultRoomNameList_Heating_easymode = new String[]{"거실", "방1", "방2", "방3", "방4", "방5", "방6", "방7", "방8"};
 
     /**
@@ -16365,55 +16307,6 @@ public class iMapServer extends Service {
     private void getRoomName() {
         try {
             Log.i(TAG, "[getRoomName] ====================");
-//            WallpadDeviceSet wallpadDeviceSet = new WallpadDeviceSet(getApplicationContext());
-//            boolean bRoomNameEach = wallpadDeviceSet.GetEachRoomNameInfo();
-//            wallpadDeviceSet.closeDB();
-//            Log.i(TAG, "[getRoomName] bRoomNameEach [" + bRoomNameEach + "]");
-//
-//            if (bRoomNameEach) {
-//                // 명칭 난방, 조명 분리 사용
-//                mRoomNameList_Light = getDBRoomName(LIGHT);
-//                if (mRoomNameList_Light == null) {
-//                    mRoomNameList_Light = mDefaultRoomNameList_Light;
-//                }
-//
-//                if (getEasyModeUXUsage()) {
-//                    mRoomNameList_Heating = mDefaultRoomNameList_Heating_easymode;
-//                }
-//                else {
-//                    mRoomNameList_Heating = getDBRoomName(HEATING);
-//                    if (mRoomNameList_Heating == null) {
-//                        mRoomNameList_Heating = mDefaultRoomNameList_Heating;
-//                    }
-//                }
-//            }
-//            else {
-//                // 명칭 통합사용
-//                mRoomNameList_Light = getDBRoomName();
-//                if (mRoomNameList_Light == null) {
-//                    mRoomNameList_Light = mDefaultRoomNameList;
-//                }
-//
-//                if (getEasyModeUXUsage()) {
-//                    mRoomNameList_Heating = mDefaultRoomNameList_Heating_easymode;
-//                }
-//                else {
-//                    mRoomNameList_Heating = getDBRoomName();
-//                    if (mRoomNameList_Heating == null) {
-//                        mRoomNameList_Heating = mDefaultRoomNameList;
-//                    }
-//                }
-//            }
-//
-//            if (bRoomNameLog) {
-//                for (int i = 0; i < mRoomNameList_Light.length; i++) {
-//                    Log.i(TAG, "[getRoomName] mRoomNameList_Light[" + i + "] " + mRoomNameList_Light[i]);
-//                }
-//
-//                for (int i = 0; i < mRoomNameList_Heating.length; i++) {
-//                    Log.i(TAG, "[getRoomName] mRoomNameList_Heating[" + i + "] " + mRoomNameList_Heating[i]);
-//                }
-//            }
         } catch (RuntimeException re) {
             LogUtil.errorLogInfo("", TAG, re);
         } catch (Exception e) {
@@ -17004,6 +16897,31 @@ public class iMapServer extends Service {
         }
     }
 
+    private String[] getRoomNameFromDBV2(String strDeviceType) {
+        try {
+            String[] RoomNameList = null;
+            WallpadStatusData wallpadStatusData = new WallpadStatusData(getApplicationContext());
+            RoomNameList = wallpadStatusData.GetDevRoomNameList(strDeviceType);
+            wallpadStatusData.closeDB();
+
+            if (RoomNameList == null) {
+                Log.e(TAG, "[getRoomNameFromDBV2] - RoomNameList is null !!!");
+                return null;
+            }
+
+            Log.i(TAG, "[getRoomNameFromDBV2] RoomNameList " + Arrays.toString(RoomNameList));
+
+            return RoomNameList;
+        } catch (RuntimeException re) {
+            LogUtil.errorLogInfo("", TAG, re);
+        } catch (Exception e) {
+            Log.e(TAG, "[Exception] getRoomNameFromDBV2(int Device)");
+            //e.printStackTrace();
+            LogUtil.errorLogInfo("", TAG, e);
+        }
+        return null;
+    }
+
 
 //    private void demoPushMsg()
 //    {