Browse Source

[WallPadDevService]
1. 서브 월패드 경우, 처리 추가
- ISS 멀티스위치만 활성화됨

jglee 2 years ago
parent
commit
ca2791058c

+ 52 - 0
WallPadDevService/src/main/java/com/artncore/wallpaddevservice/ServiceMain.java

@@ -183,6 +183,12 @@ public class ServiceMain extends Service {
 	public static CurtainV1_Controller CurtainV1_LivingRoom_controller;
 	// 전동커튼_안방
 	public static CurtainV1_Controller CurtainV1_Room_controller;
+	
+	// 서브 월패드
+	public static boolean bUseAsSubWallPad = false;
+
+	// 서브 월패드 - 조명 직접제어
+	public static int[] naSubWallPadLight;
 
 	/** 공용 드라이버  끝 */
 
@@ -2407,6 +2413,20 @@ public class ServiceMain extends Service {
 
 						"</drivermap> </lookup_tables>";
 			}
+			else if (bUseAsSubWallPad && naSubWallPadLight!=null && naSubWallPadLight.length == 2 && naSubWallPadLight[1] == WallpadDeviceSet.SUBWPD_CTR_DIRECT) {
+				// 서브월패드 조명 직접 제어인경우만 사용
+				Log.d(TAG, "LoadDefaultConfig - jglee");
+
+				default_cfg = "<?xml version=\"1.0\" encoding=\"utf-8\"?>"+
+						"<lookup_tables> <portmap>"+
+						"<comport name = \"com2\"    baudrate = \"9600\"    module =\"Ctrl_Module1\"              type = \"Polling\"  timeout = \"100\"     option = \"null\"    />"+
+						"</portmap>   <drivermap> " +
+
+						// COM2 - Ctrl_Module1
+						"<driver name = \"MultiSwitch_Driver\"            module =\"Ctrl_Module1\"              startaddr = \"0x51\"    endaddr = \"0x58\"    option = \"null\"  />"+
+
+						"</drivermap> </lookup_tables>";
+			}
 			else {
 				// 일반
 				default_cfg = "<?xml version=\"1.0\" encoding=\"utf-8\"?>"+
@@ -2534,6 +2554,15 @@ public class ServiceMain extends Service {
 			return -1;
 		}
 
+		//서브 월패드 사용 유무 체크
+		bUseAsSubWallPad = GetSubWpdUse();
+		if(bUseAsSubWallPad)
+		{
+			Log.d(TAG, "SubWallPadUse - jglee");
+			naSubWallPadLight = GetSubWallPadLightType();
+			Log.d(TAG, "GetSubWallPadLightType - jglee");
+		}
+
 		Handlercnt = 0;
 		if (!load_config()) {
 			ServiceLog("Service Start Fail");
@@ -2982,5 +3011,28 @@ public class ServiceMain extends Service {
 		return bResult;
 	}
 
+	/**
+	 * 서브월패드 조명 타입
+	 * @return
+	 */
+	public static int[] GetSubWallPadLightType()
+	{
+		int[] naSubWallPadLightType = null;
+		try {
+			WallpadDeviceSet mWallpadDeviceSet = new WallpadDeviceSet(svcContext);
+			naSubWallPadLightType = mWallpadDeviceSet.GetSubWpdDirect_Light();
+			mWallpadDeviceSet.closeDB();
+		} catch (RuntimeException re) {
+			LogUtil.errorLogInfo("", TAG, re);
+			return null;
+		} catch (Exception e) {
+			Log.e(TAG, "[Exception] getLHGatewayUsage()");
+			//e.printStackTrace();
+			LogUtil.errorLogInfo("", TAG, e);
+			return null;
+		}
+		return naSubWallPadLightType;
+	}
+
 
 }