Browse Source

환기 멀티 제어 작업

jslee(madeinlab) 3 years ago
parent
commit
a4ca51e497

+ 2 - 1
WallPadDevService/src/main/java/com/artncore/wallpaddevservice/ServiceMain.java

@@ -1867,7 +1867,8 @@ public class ServiceMain extends Service {
 						"<driver name = \"ElectricRange_Controller\"      module =\"Ctrl_Module1\"               startaddr = \"0xE1\"    endaddr = \"0xE2\"    option = \"null\"  />"+
 						"<driver name = \"DLock_Driver\"                  module =\"Ctrl_Module1\"               startaddr = \"0x41\"    endaddr = \"0x41\"    option = \"null\"  />"+
 						"<driver name = \"FP_DLock_Driver\"               module =\"Ctrl_Module1\"               startaddr = \"0x48\"    endaddr = \"0x48\"    option = \"null\"  />"+
-						"<driver name = \"Knx_Ventilation_Driver\"            module =\"Ctrl_Module1\"               startaddr = \"0x61\"    endaddr = \"0x68\"    option = \"null\"  />"+
+						//"<driver name = \"Knx_Ventilation_Driver\"            module =\"Ctrl_Module1\"               startaddr = \"0x61\"    endaddr = \"0x68\"    option = \"null\"  />"+
+						"<driver name = \"Ventilation_Driver\"            module =\"Ctrl_Module1\"               startaddr = \"0x61\"    endaddr = \"0x68\"    option = \"null\"  />"+
 						"<driver name = \"HeatingFinder_Driver\"          module =\"Ctrl_Module1\"               startaddr = \"0x21\"    endaddr = \"0x2F\"    option = \"null\"  />"+
 						"<driver name = \"HeatingV1_Driver\"              module =\"Ctrl_Module1\"               startaddr = \"0x21\"    endaddr = \"0x21\"    option = \"null\"  />"+
 						"<driver name = \"HeatingV2_Driver\"              module =\"Ctrl_Module1\"               startaddr = \"0x28\"    endaddr = \"0x28\"    option = \"null\"  />"+

+ 1 - 0
WallPadHomeCtrl/build.gradle

@@ -85,4 +85,5 @@ dependencies {
     implementation files('libs/WallPadSupport.jar')
     implementation files('libs/EasyModbusJava.jar')
     implementation 'com.google.code.gson:gson:2.8.5'
+    implementation files('libs/modbus4Android-1.2.jar')
 }

BIN
WallPadHomeCtrl/libs/modbus4Android-1.2.jar


+ 25 - 5
WallPadHomeCtrl/src/main/java/kr/co/icontrols/wallpadhomectrl/MainActivity.java

@@ -85,6 +85,7 @@ import kr.co.icontrols.wallpadhomectrl.screen.screen_light.LightHdcLivKnxMainScr
 import kr.co.icontrols.wallpadhomectrl.screen.screen_light.LightHdcLivMainScreen;
 import kr.co.icontrols.wallpadhomectrl.screen.screen_light.LightHdcNEachMainScreen;
 import kr.co.icontrols.wallpadhomectrl.screen.screen_light.LightKnxMainScreen;
+import kr.co.icontrols.wallpadhomectrl.screen.screen_multi.VentilationMainTestScreen;
 import kr.co.icontrols.wallpadhomectrl.screen.screen_purity.PurityMainScreen;
 import kr.co.icontrols.wallpadhomectrl.screen.screen_venti.VentiEasymodeScreen;
 import kr.co.icontrols.wallpadhomectrl.screen.screen_venti.VentiMainScreen;
@@ -1213,6 +1214,8 @@ public class MainActivity extends WpadActivity {
 							setChangeScreen(API_Menu.SubMenuCtrl.Gas, false);
 						} else if (mCurrentScreenId == API_Menu.SubMenuCtrl.SystemAircon) {
 							setChangeScreen(API_Menu.SubMenuCtrl.SystemAircon, false);
+						} else if (mCurrentScreenId == API_Menu.SubMenuCtrl.ChangAir_Normal) {
+							setChangeScreen(API_Menu.SubMenuCtrl.ChangAir_Normal, false);
 						}
 					}else {
 						//다른층
@@ -1226,6 +1229,8 @@ public class MainActivity extends WpadActivity {
 							StartMultiControl(ID.screen.GasTestScreen, index+1);
 						} else if (mCurrentScreenId == API_Menu.SubMenuCtrl.SystemAircon) {
 							StartMultiControl(ID.screen.SystemAirconTest1Screen, index+1);
+						} else if (mCurrentScreenId == API_Menu.SubMenuCtrl.ChangAir_Normal) {
+							StartMultiControl(ID.screen.VentiMainTestScreen, index+1);
 						}
 					}
 				}
@@ -1752,8 +1757,11 @@ public class MainActivity extends WpadActivity {
 								if (nDistributionPanelType == Version.DISTRIBUTION_MODEL.KNX_DIST) {
 									//고급향은 환기가 3개임. KNX 쪽으로 우선 분기를 태움.
 									SetTitleText(API_Menu.SubMenuCtrl.Name_Venti);
-									knxVentiMainScreen = new KnxVentiMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE, nScreenId);
-									super.setCurrentScreen(knxVentiMainScreen);
+									//고급향 환기 테스트 때문에 임시로 바꿈.
+									//knxVentiMainScreen = new KnxVentiMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE, nScreenId);
+									//super.setCurrentScreen(knxVentiMainScreen);
+									ventilationMainScreen = new VentilationMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE, nScreenId);
+									super.setCurrentScreen(ventilationMainScreen);
 								}
 								else {
 									SetTitleText(API_Menu.SubMenuCtrl.Name_Venti);
@@ -1765,6 +1773,8 @@ public class MainActivity extends WpadActivity {
 							setAIRBackBtnVisible(false);
 							setKccDimmBtnVisible(false);
 							setVentilBackBtnVisible(false);
+							setMultiBtnVisible(true);
+
 							result = true;
 						}
 						else {
@@ -1788,8 +1798,11 @@ public class MainActivity extends WpadActivity {
 								else {
 									if (nDistributionPanelType == Version.DISTRIBUTION_MODEL.KNX_DIST) {
 										SetTitleText(API_Menu.SubMenuCtrl.Name_Venti);
-										knxVentiMainScreen = new KnxVentiMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE, nScreenId);
-										super.setCurrentScreen(knxVentiMainScreen);
+										//테스트 때문에 바꿈
+										//knxVentiMainScreen = new KnxVentiMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE, nScreenId);
+										//super.setCurrentScreen(knxVentiMainScreen);
+										ventilationMainScreen = new VentilationMainScreen(this, ScreenLayout, wpapi, OPERATION_MODE, nScreenId);
+										super.setCurrentScreen(ventilationMainScreen);
 										setManualBtnVisible(false, 1019);
 									}
 									else {
@@ -1808,6 +1821,8 @@ public class MainActivity extends WpadActivity {
 								setAIRBackBtnVisible(false);
 								setKccDimmBtnVisible(false);
 								setVentilBackBtnVisible(false);
+								setMultiBtnVisible(true);
+
 								result = true;
 							}
 						}
@@ -2005,11 +2020,16 @@ public class MainActivity extends WpadActivity {
 					mCurrentMultiScreenId = ID.screen.HeatingV2TestScreen;
 					result = true;
 					break;
-				case ID.screen.GasTestScreen: // sub - 공지사항 내용
+				case ID.screen.GasTestScreen: // 가스
 					HybridCookTopTestScreen hybridCookTopTestScreen = new HybridCookTopTestScreen(this, ScreenLayout, wpapi, OPERATION_MODE);
 					super.setCurrentScreen(hybridCookTopTestScreen);
 					result = true;
 					break;
+				case ID.screen.VentiMainTestScreen: // 환기
+					VentilationMainTestScreen ventilationMainTestScreen = new VentilationMainTestScreen(this, ScreenLayout, wpapi, OPERATION_MODE, nScreenId);
+					super.setCurrentScreen(ventilationMainTestScreen);
+					result = true;
+					break;
 
 				default:
 					result = false;

+ 1 - 1
WallPadHomeCtrl/src/main/java/kr/co/icontrols/wallpadhomectrl/declare/Common.java

@@ -401,7 +401,7 @@ public final class Common
             public final static int CONCENT  	= MENU_BASE + 2;
             public final static int HEATING  	= MENU_BASE + 3;
             public final static int AIRCON  	= MENU_BASE + 4;
-            public final static int PURITY  	= MENU_BASE + 5;
+            public final static int VENTI     	= MENU_BASE + 5;
             public final static int GAS      	= MENU_BASE + 6;
             public final static int CURTAIN  	= MENU_BASE + 7;
         }

+ 1 - 0
WallPadHomeCtrl/src/main/java/kr/co/icontrols/wallpadhomectrl/declare/ID.java

@@ -31,6 +31,7 @@ public final class ID
 		public final static int LightHdcLivPopupScreen						  = 3900;
 
 		public final static int VentiMainScreen			                      = 4000;
+		public final static int VentiMainTestScreen			                  = 4010;
 		public final static int VentiPopupReservationScreen					  = 4100;        // 환기 - 팝업 - 예약
 		public final static int VentiPopupAlarmScreen           			  = 4200;        // 환기 - 팝업 - 알림
 		public final static int VentiPopupServiceScreen           			  = 4300;        // 환기 케어 서비스 팝업

+ 42 - 1
WallPadHomeCtrl/src/main/java/kr/co/icontrols/wallpadhomectrl/screen/screen_multi/ParkingDoorMainScreen.java

@@ -15,6 +15,9 @@ import com.artncore.wallpadapi.DLockAPI;
 import com.artncore.wallpadapi.WallPadAPI;
 import com.artncore.wallpadapi.WallPadDevAPI;
 import com.util.LogUtil;
+import com.zgkxzx.modbus4And.requset.ModbusParam;
+import com.zgkxzx.modbus4And.requset.ModbusReq;
+import com.zgkxzx.modbus4And.requset.OnRequestBack;
 
 import java.io.IOException;
 
@@ -132,6 +135,25 @@ public class ParkingDoorMainScreen extends WpadScreen {
             if (MainActivity.getHideMenuOn())
                 transactionDisplay = new TransactionDisplay(true, (WallPadDevAPI) dLockAPI, (WpadScreen) this);
         }
+
+        ModbusReq.getInstance().setParam(new ModbusParam()
+                .setHost("10.0.215.2")
+                .setPort(502)
+                .setEncapsulated(false)
+                .setKeepAlive(true)
+                .setTimeout(2000)
+                .setRetries(0))
+                .init(new OnRequestBack<String>() {
+                    @Override
+                    public void onSuccess(String s) {
+                        Log.d(TAG, "onSuccess " + s);
+                    }
+
+                    @Override
+                    public void onFailed(String msg) {
+                        Log.d(TAG, "onFailed " + msg);
+                    }
+                });
     }
 
     // =================================================================================================
@@ -301,16 +323,35 @@ public class ParkingDoorMainScreen extends WpadScreen {
     {
         DebugLogOutput("[Device_DoorOpen] - Start");
 
+        ModbusReq.getInstance().writeCoil(new OnRequestBack<String>() {
+            @Override
+            public void onSuccess(String s) {
+                Log.e(TAG, "writeCoil onSuccess " + s);
+            }
+
+            @Override
+            public void onFailed(String msg) {
+                Log.e(TAG, "writeCoil onFailed " + msg);
+            }
+        },91,1,true);
+
 
         try {
             new Thread(){
                 public void run(){
                     ModbusClient modbusClient = new ModbusClient("10.0.215.2", 502);
+                    //Increase the Connection Timeout to 5 seconds
+                    modbusClient.setConnectionTimeout(5000);
                     try {
                         modbusClient.Connect();
-                        modbusClient.WriteSingleRegister(00, 0000);
+                        modbusClient.WriteSingleCoil(0004, true);
                     } catch (IOException | ModbusException e) {
                         e.printStackTrace();
+                        try {
+                            modbusClient.Disconnect();
+                        } catch (IOException ioException) {
+                            ioException.printStackTrace();
+                        }
                     }
 
                 }