Ver código fonte

[WallPadMain]
1. iMapServer
- 조명 타입(새로운 타입 : 현산향일체형기본조명)에 대하여 추가(홈2.0)
- 조명(All) 명령어 처리
- 가스 수정(최신 코드로 통일) -> 쿡탑 콘센트와 가스

2. WallPadAPI 최신 적용

jglee 3 anos atrás
pai
commit
12499e3eb8

BIN
WallPadAPI/jar/WallPadAPI.jar


BIN
WallPadAPI/jar/WallPadAPIforSVC.jar


BIN
WallPadDevService/libs/WallPadAPIforSVC.jar


+ 22 - 18
WallPadDevService/src/main/java/com/artncore/wallpaddevservice/driver/Cooktop_Controller.java

@@ -46,6 +46,9 @@ public class Cooktop_Controller extends DeviceManager {
     /** 감지 패킷 수신 횟수  */
     /** 감지 패킷 수신 횟수  */
     private int DetectInputCount = 0;
     private int DetectInputCount = 0;
 
 
+    public static byte GetGasStatus() { return GasStatus; }
+    public static byte GasStatus = -1;
+
     /** 드라이버 내부 변수 */
     /** 드라이버 내부 변수 */
     public class Driver {
     public class Driver {
         private PollingList Polling;
         private PollingList Polling;
@@ -429,12 +432,12 @@ public class Cooktop_Controller extends DeviceManager {
                     byte Index    = ctrDevFormat.param[0];
                     byte Index    = ctrDevFormat.param[0];
                     byte circuitIdx = ctrDevFormat.param[1];
                     byte circuitIdx = ctrDevFormat.param[1];
 
 
-                    // 1. 범위체크
-                    //     1.1. Index
-                    if (!DeviceIndexRangeCheck(Index)) {
-                        Log.w(TAG, "[do_ctrEmm -> setUnitCircuitClose] Param : Index - Out Of Range !!! (Index:" + Index + ")");
-                        return SHMem.retVal = APIErrorCode.FAILSTR + ";" + APIErrorCode.INVALIDPARAMETER;
-                    }
+//                    // 1. 범위체크
+//                    //     1.1. Index
+//                    if (!DeviceIndexRangeCheck(Index)) {
+//                        Log.w(TAG, "[do_ctrEmm -> setUnitCircuitClose] Param : Index - Out Of Range !!! (Index:" + Index + ")");
+//                        return SHMem.retVal = APIErrorCode.FAILSTR + ";" + APIErrorCode.INVALIDPARAMETER;
+//                    }
 
 
                     if (!mDriver.Device[Index].info.bInstall) {
                     if (!mDriver.Device[Index].info.bInstall) {
                         Log.w(TAG, "[do_ctrEmm -> setUnitCircuitClose] Device [" + Index + "]  No Install !!!");
                         Log.w(TAG, "[do_ctrEmm -> setUnitCircuitClose] Device [" + Index + "]  No Install !!!");
@@ -443,16 +446,10 @@ public class Cooktop_Controller extends DeviceManager {
 
 
                     //     1.2. CircuitIdx
                     //     1.2. CircuitIdx
                     if (circuitIdx != define.DEVICE_ALL_OR_NOTHING) {
                     if (circuitIdx != define.DEVICE_ALL_OR_NOTHING) {
-                        if ((circuitIdx < 0) || (circuitIdx >= MAX_CIRCUIT_CNT)) {
+                        if ((circuitIdx < 0)) {
                             Log.w(TAG, "[do_ctrEmm -> setUnitCircuitClose] Param : CircuitIdx - Out Of Range #1 !!! (CircuitIdx:" + circuitIdx + ")");
                             Log.w(TAG, "[do_ctrEmm -> setUnitCircuitClose] Param : CircuitIdx - Out Of Range #1 !!! (CircuitIdx:" + circuitIdx + ")");
                             return SHMem.retVal = APIErrorCode.FAILSTR + ";" + APIErrorCode.INVALIDPARAMETER;
                             return SHMem.retVal = APIErrorCode.FAILSTR + ";" + APIErrorCode.INVALIDPARAMETER;
                         }
                         }
-                        else {
-                            if (circuitIdx > mDriver.Device[Index].info.hCircuitCnt) {
-                                Log.w(TAG, "[do_ctrEmm -> setUnitCircuitClose] Param : CircuitIdx - Out Of Range #2 !!! (CircuitIdx:" + circuitIdx + ")");
-                                return SHMem.retVal = APIErrorCode.FAILSTR + ";" + APIErrorCode.INVALIDPARAMETER;
-                            }
-                        }
                     }
                     }
 
 
                     // 2. Make Ctrl Command
                     // 2. Make Ctrl Command
@@ -974,7 +971,7 @@ public class Cooktop_Controller extends DeviceManager {
                 return null;
                 return null;
             }
             }
 
 
-            if ((circuitId < 0) || (circuitId >= MAX_CIRCUIT_CNT)) {
+            if ((circuitId < 0)) {
                 Log.w(TAG, "[sendSetUnitCircuitStatus] param [circuitId] Out of Range!!! " + circuitId);
                 Log.w(TAG, "[sendSetUnitCircuitStatus] param [circuitId] Out of Range!!! " + circuitId);
                 return null;
                 return null;
             }
             }
@@ -985,7 +982,7 @@ public class Cooktop_Controller extends DeviceManager {
             }
             }
 
 
             // 2. 패킷 데이터 만들기
             // 2. 패킷 데이터 만들기
-            byte id = (byte) (circuitId + 1);
+            byte id = (byte) (circuitId);
             byte[] ReqData = { (byte) id, (byte) status };
             byte[] ReqData = { (byte) id, (byte) status };
 
 
             // 3. 데이터 전송 및 응답
             // 3. 데이터 전송 및 응답
@@ -1095,7 +1092,7 @@ public class Cooktop_Controller extends DeviceManager {
             //     1.2. Details Data Check
             //     1.2. Details Data Check
             //          - D1 : 제어기 ID
             //          - D1 : 제어기 ID
             data = Reply[index++];
             data = Reply[index++];
-            if ((circuitId+1) != data) {
+            if ((circuitId) != data) {
                 Log.w(TAG, "[parsingReply_UnitCircuitCommon] D1 (circuitId) : Circuit is not match!! Req ID [" + ToByteString(circuitId) + ", Rep ID [" + ToByteString(data) + "]");
                 Log.w(TAG, "[parsingReply_UnitCircuitCommon] D1 (circuitId) : Circuit is not match!! Req ID [" + ToByteString(circuitId) + ", Rep ID [" + ToByteString(data) + "]");
                 return null;
                 return null;
             }
             }
@@ -1397,6 +1394,7 @@ public class Cooktop_Controller extends DeviceManager {
             boolean isGasorFireLeak = false;
             boolean isGasorFireLeak = false;
 
 
             if (0 < nCircuitCnt) {
             if (0 < nCircuitCnt) {
+                GasStatus = 1;
                 for (int i = 0; i < nCircuitCnt; i++) {
                 for (int i = 0; i < nCircuitCnt; i++) {
                     circuit[i] = new CooktopCtrl.Circuit();
                     circuit[i] = new CooktopCtrl.Circuit();
                     //          - D1 : 제어기 ID
                     //          - D1 : 제어기 ID
@@ -1405,14 +1403,19 @@ public class Cooktop_Controller extends DeviceManager {
 
 
                     circuit[i].hType = mDriver.Device[deviceIdx].info.hCircuitType[i];
                     circuit[i].hType = mDriver.Device[deviceIdx].info.hCircuitType[i];
 
 
+
                     //          - D2 : 제어기 제어 상태
                     //          - D2 : 제어기 제어 상태
                     data = Reply[index++];
                     data = Reply[index++];
                     circuit[i].hStatus = data;
                     circuit[i].hStatus = data;
 
 
+                    //가스 정보를 가져오기 위해 사용
+                    if(data != 1 && data != 0)
+                        GasStatus = data;
+
                     //          - D3 : 제어기 이상 상태
                     //          - D3 : 제어기 이상 상태
                     data = Reply[index++];
                     data = Reply[index++];
                     circuit[i].hErrorStatus = data;
                     circuit[i].hErrorStatus = data;
-                    
+
                     //여기서 에러가 발생하는게 무엇인지 체크를 해야 함
                     //여기서 에러가 발생하는게 무엇인지 체크를 해야 함
 
 
                     if(ServiceMain.dataBaseLoader.data.wallpadDeviceSet.Get_GasDetect_5time)
                     if(ServiceMain.dataBaseLoader.data.wallpadDeviceSet.Get_GasDetect_5time)
@@ -1497,7 +1500,7 @@ public class Cooktop_Controller extends DeviceManager {
 
 
             /** 개별 회로 제어 요청 */
             /** 개별 회로 제어 요청 */
             public final static byte SetUnitCircuitStatus = (byte) 0x12;
             public final static byte SetUnitCircuitStatus = (byte) 0x12;
-            
+
             /** 개별 회로 이상 상태 해제 요청 */
             /** 개별 회로 이상 상태 해제 요청 */
             public final static byte SetUnitCircuitErrorRelease = (byte) 0x13;
             public final static byte SetUnitCircuitErrorRelease = (byte) 0x13;
 
 
@@ -1738,3 +1741,4 @@ public class Cooktop_Controller extends DeviceManager {
 
 
 
 
 }
 }
+

BIN
WallPadEmergency/libs/WallPadAPI.jar


BIN
WallPadHomeCtrl/libs/WallPadAPI.jar


BIN
WallPadMain/libs/WallPadAPI.jar


+ 274 - 87
WallPadMain/src/main/java/kr/co/icontrols/wallpadmain/util/iMapServer.java

@@ -48,6 +48,7 @@ import com.artncore.commons.DataClasses.MultiSwitch;
 import com.artncore.commons.define;
 import com.artncore.commons.define;
 import com.artncore.deviceinterface.WallPadInterface;
 import com.artncore.deviceinterface.WallPadInterface;
 import com.artncore.wallpadapi.AirQualitySensorAPI;
 import com.artncore.wallpadapi.AirQualitySensorAPI;
+import com.artncore.wallpadapi.CooktopAPI;
 import com.artncore.wallpadapi.DLockAPI;
 import com.artncore.wallpadapi.DLockAPI;
 import com.artncore.wallpadapi.EnergyMeterAPI;
 import com.artncore.wallpadapi.EnergyMeterAPI;
 import com.artncore.wallpadapi.GasAPI;
 import com.artncore.wallpadapi.GasAPI;
@@ -208,6 +209,8 @@ public class iMapServer extends Service {
 	//private boolean mNewDanjiServer = false;
 	//private boolean mNewDanjiServer = false;
     /** 단지서버 타입 1=1.0, 2 = 2.0, 0 = mix*/
     /** 단지서버 타입 1=1.0, 2 = 2.0, 0 = mix*/
 	private int danjiserverType = 1;
 	private int danjiserverType = 1;
+/** 가스밸브를 쿡탑콘센트로 사용 */
+    private boolean bGasAsCooktopOutlet = false;   // 쿡탑콘센트에 가스밸브 프로토콜이 적용된 경우
 
 
     /**
     /**
      * JEFF, 2019.12.31
      * JEFF, 2019.12.31
@@ -2832,6 +2835,10 @@ public class iMapServer extends Service {
                 LogUtil.errorLogInfo("", TAG, e);
                 LogUtil.errorLogInfo("", TAG, e);
             }
             }
 
 
+            WallpadDeviceSet mWallpadDeviceSet = new WallpadDeviceSet(getApplicationContext());
+            bGasAsCooktopOutlet = mWallpadDeviceSet.Get_CookTopConcent_Use();
+            mWallpadDeviceSet.closeDB();
+
 			SvrSock = new iMapSverSocket();
 			SvrSock = new iMapSverSocket();
 			SvrSock.start();
 			SvrSock.start();
 		} catch (IOException e) {
 		} catch (IOException e) {
@@ -6094,6 +6101,15 @@ public class iMapServer extends Service {
                 if (!ServerCheckResult.equals(MOBILE_USER_AUTH_PASSED) && !ServerCheckResult.equals(WEB_USER_AUTH_PASSED)) return ServerCheckResult;
                 if (!ServerCheckResult.equals(MOBILE_USER_AUTH_PASSED) && !ServerCheckResult.equals(WEB_USER_AUTH_PASSED)) return ServerCheckResult;
             }
             }
 
 
+            GasAPI mGasAPI = null;
+            CooktopAPI mCooktopAPI = null;
+            if (mWallPadAPI.GetGasKind() == 1) {
+                mGasAPI = mWallPadAPI.Get_GasController();
+            }
+            else if (mWallPadAPI.GetGasKind() == 2) {
+                mCooktopAPI = mWallPadAPI.Get_CookTopController();
+            }
+
             WallpadiCMDParser DevListCMD = new WallpadiCMDParser(ele);
             WallpadiCMDParser DevListCMD = new WallpadiCMDParser(ele);
             String[] devlist = {"gas", "livinglight", "doorlock", "light", "ventil", "thermostat", "electric", "smartlight", "cooktop"};
             String[] devlist = {"gas", "livinglight", "doorlock", "light", "ventil", "thermostat", "electric", "smartlight", "cooktop"};
             strResult += "\"ok\">\r\n";
             strResult += "\"ok\">\r\n";
@@ -6102,34 +6118,43 @@ public class iMapServer extends Service {
             WallpadDeviceSet devSet = new WallpadDeviceSet(getApplicationContext());
             WallpadDeviceSet devSet = new WallpadDeviceSet(getApplicationContext());
 
 
             for (int i = 0; i < devlist.length; i++) {
             for (int i = 0; i < devlist.length; i++) {
-                if (devlist[i].equals("gas")) {
-                    try {
+                if (devlist[i].equals("cooktop")) {
+                    if (mWallPadAPI.GetGasKind() == 1) {
+                        // 가스밸브
                         int Gasinfo = devSet.Get_GAS_Info();
                         int Gasinfo = devSet.Get_GAS_Info();
-                        if (Gasinfo == 0) strResult +="         <devinfo name=\"gas\" value=\"0\"/>\r\n";
-                        else strResult +="         <devinfo name=\"gas\" value=\"1\"/>\r\n";
-                    } catch (RuntimeException re) {
-                        LogUtil.errorLogInfo("", TAG, re);
-                        strResult +="         <devinfo name=\"gas\" value=\"0\"/>\r\n";
-                    }
-                    catch (Exception e) {
-                        //e.printStackTrace();
-                        LogUtil.errorLogInfo("", TAG, e);
-                        strResult +="         <devinfo name=\"gas\" value=\"0\"/>\r\n";
+                        if (Gasinfo == 1) {
+                            // 사용함
+                            if (bGasAsCooktopOutlet) {
+                                strResult +="         <devinfo name=\"gas\" value=\"0\"/>\r\n";
+                                strResult +="         <devinfo name=\"cooktop\" value=\"1\"/>\r\n";
+                            }
+                            else {
+                                strResult +="         <devinfo name=\"gas\" value=\"1\"/>\r\n";
+                                strResult +="         <devinfo name=\"cooktop\" value=\"0\"/>\r\n";
+                            }
+                        }
+                        else {
+                            // 사용안함
+                            strResult +="         <devinfo name=\"gas\" value=\"0\"/>\r\n";
+                            strResult +="         <devinfo name=\"cooktop\" value=\"0\"/>\r\n";
+                        }
                     }
                     }
-                }
-                else if (devlist[i].equals("cooktop")) {
-                    try {
-                        //int Gooktopinfo = devSet.Get_Cooktop_Info();
-                        int Gooktopinfo = devSet.Get_GAS_Info();
-                        if (Gooktopinfo == 0) strResult +="         <devinfo name=\"cooktop\" value=\"0\"/>\r\n";
-                        else strResult +="         <devinfo name=\"cooktop\" value=\"1\"/>\r\n";
-                    } catch (RuntimeException re) {
-                        LogUtil.errorLogInfo("", TAG, re);
-                        strResult +="         <devinfo name=\"cooktop\" value=\"0\"/>\r\n";
+                    else if (mWallPadAPI.GetGasKind() == 2) {
+                        // 하이브리드 쿡탑
+                        if (mCooktopAPI != null) {
+                            int nGas = 0; int nOutlet = 0;
+                            for (int j = 0; j < mCooktopAPI.data.DeviceCnt; j++) {
+                                for (int k = 0; k < mCooktopAPI.data.DeviceCnt; k++) {
+                                    if (mCooktopAPI.data.Device[j].circuit[i].hType == DataClasses.CooktopCtrl.DEVICE_TYPE.GASVALVE) nGas++;
+                                    else if (mCooktopAPI.data.Device[j].circuit[i].hType == DataClasses.CooktopCtrl.DEVICE_TYPE.OUTLET) nOutlet++;
+                                }
+                            }
+                            strResult +="         <devinfo name=\"gas\" value=\"" + nGas + "\"/>\r\n";
+                            strResult +="         <devinfo name=\"cooktop\" value=\"" + nOutlet + "\"/>\r\n";
+                        }
                     }
                     }
-                    catch (Exception e) {
-                        //e.printStackTrace();
-                        LogUtil.errorLogInfo("", TAG, e);
+                    else {
+                        strResult +="         <devinfo name=\"gas\" value=\"0\"/>\r\n";
                         strResult +="         <devinfo name=\"cooktop\" value=\"0\"/>\r\n";
                         strResult +="         <devinfo name=\"cooktop\" value=\"0\"/>\r\n";
                     }
                     }
                 }
                 }
@@ -6186,6 +6211,9 @@ public class iMapServer extends Service {
                             else if ((lightinfo[0] == 1) && (lightinfo[1] == WallpadDeviceSet.LIGHT_TYPE_LIVING)) {
                             else if ((lightinfo[0] == 1) && (lightinfo[1] == WallpadDeviceSet.LIGHT_TYPE_LIVING)) {
                                 strResult += "         <devinfo name=\"light\" value=\"1\"/>\r\n";
                                 strResult += "         <devinfo name=\"light\" value=\"1\"/>\r\n";
                             }
                             }
+                            else if ((lightinfo[0] == 1) && (lightinfo[1] == WallpadDeviceSet.LIGHT_TYPE_HDC_INTLIGHT_NORMAL)) {
+                                strResult += "         <devinfo name=\"light\" value=\"1\"/>\r\n";
+                            }
                             else {
                             else {
                                 MultiSwitchAPI multisw = mWallPadAPI.Get_MultiSwitchController();
                                 MultiSwitchAPI multisw = mWallPadAPI.Get_MultiSwitchController();
                                 int ret = multisw.Refresh((byte)0xFF, false);
                                 int ret = multisw.Refresh((byte)0xFF, false);
@@ -6221,7 +6249,7 @@ public class iMapServer extends Service {
                                 Log.w(TAG, "[iCMDProcDevList] Not supported!!");
                                 Log.w(TAG, "[iCMDProcDevList] Not supported!!");
                             }
                             }
                         }
                         }
-                        else if (Version.getModelType() == Version.MODEL_TYPE.IHN_1020GL) {
+                        else if (Version.getModelType() == Version.MODEL_TYPE.IHN_1020GL || Version.getModelType() == Version.MODEL_TYPE.IHN_1010GL_I_2443 ) {
                             strResult  += "         <devinfo name=\"livinglight\" value=\"" + lightinfo[2] + "\"/>\r\n";
                             strResult  += "         <devinfo name=\"livinglight\" value=\"" + lightinfo[2] + "\"/>\r\n";
                         }
                         }
                         else {
                         else {
@@ -8472,6 +8500,40 @@ public class iMapServer extends Service {
                     }
                     }
 
 
                 }
                 }
+                else if(lightcmd.unitnum.toLowerCase().equals("all") == true)
+                {
+                    int result = -999;
+                    if(lightCTR!=null)
+                    {
+                        if (lightcmd.ctraction.equalsIgnoreCase("on") == true) {
+                            result = lightCTR.LightControl((byte)0xFF, true);
+                        }
+                        else if (lightcmd.ctraction.equalsIgnoreCase("off") == true) {
+                            result = lightCTR.LightControl((byte)0xFF, false);
+                        }
+
+                        if (result >= 0) {
+                            // 제어 성공
+                            try { Thread.sleep(1000);}
+                            catch (RuntimeException re) {
+                                LogUtil.errorLogInfo("", TAG, re);
+                            }
+                            catch (Exception e) {
+                                LogUtil.errorLogInfo("", TAG, e);
+                            }
+                            lightCTR.Refresh(false);
+
+                            retStr += "result=\"ok\"> \r\n      <action>\"control\"</action>\r\n      <status_map dev_num=\""+lightcmd.devnum+"\" unit_cnt=\""+lightCTR.data.LightCount+"\"/>\r\n";
+                            for(int i=0 ; i< lightCTR.data.LightCount; i++) {
+                                retStr+= "         <status_info unit_num=\"" + String.format("switch%d\" unit_status=\"%s\" />\r\n", i+1, lightCTR.data.LightStatus[i]==true?"on":"off");
+                            }
+                            retStr+="   </service>\r\n</imap>";
+                        }
+                        else {
+                            retStr += "result=\"fail\">\r\n   </service>\r\n</imap>";
+                        }
+                    }
+                }
                 else {
                 else {
                     int num = Integer.parseInt(lightcmd.unitnum.replaceAll("switch", ""));
                     int num = Integer.parseInt(lightcmd.unitnum.replaceAll("switch", ""));
 
 
@@ -8498,6 +8560,7 @@ public class iMapServer extends Service {
                         }
                         }
                 }
                 }
 
 
+
             }
             }
             else {
             else {
                 retStr += "result = \"fail\">\r\n   </service>\r\n</imap>";
                 retStr += "result = \"fail\">\r\n   </service>\r\n</imap>";
@@ -8562,83 +8625,188 @@ public class iMapServer extends Service {
             Node itemaction = itemsaction.item(0);
             Node itemaction = itemsaction.item(0);
             Node text = itemaction.getFirstChild();
             Node text = itemaction.getFirstChild();
             String actionTXT = text.getNodeValue();
             String actionTXT = text.getNodeValue();
-            GasAPI GasValveCTR = mWallPadAPI.Get_GasController();
-
+            //수정
             strResult =  XMLHeader + "   <service type=\"reply\" name=\"remote_access_gas\" result=";
             strResult =  XMLHeader + "   <service type=\"reply\" name=\"remote_access_gas\" result=";
             actionTXT = trimquotation(actionTXT);
             actionTXT = trimquotation(actionTXT);
-
+            GasAPI GasValveCTR = null;
+            CooktopAPI HybridCookTopCTR = null;
+            if(mWallPadAPI.GetGasKind() == 2)
+            {
+                //하이브리드
+                HybridCookTopCTR = mWallPadAPI.Get_CookTopController();
+            }
+            else
+            {
+                GasValveCTR = mWallPadAPI.Get_GasController();
+            }
 
 
             if (actionTXT.equalsIgnoreCase("status")) {
             if (actionTXT.equalsIgnoreCase("status")) {
                 // 가스밸브 상태 조회
                 // 가스밸브 상태 조회
-                if(GasValveCTR!=null)
+                if(mWallPadAPI.GetGasKind() == 2)
                 {
                 {
-                    int ret = GasValveCTR.Refresh((byte)0, false);
-                    if (ret < 0) {
-                        strResult += "\"fail\">\r\n   </service>\r\n</imap>";
-                        return strResult;
-                    }
+                    //하이브리드
+                    if(HybridCookTopCTR!=null)
+                    {
+                        //전체 정보가져오기
+                        int ret = HybridCookTopCTR.Refresh((byte)0xFF, false);
+                        if (ret < 0) {
+                            strResult += "\"fail\">\r\n   </service>\r\n</imap>";
+                            return strResult;
+                        }
+
+                        int OnOpenCount = 0;
+                        int OperationCount = 0;
+                        for(int RoomIndex=0 ; RoomIndex<HybridCookTopCTR.data.Device[0].circuit.length ; RoomIndex++)
+                        {
+                            //  콘센트 ON/OFF 업데이트
+                            if( HybridCookTopCTR.data.Device[0].circuit[RoomIndex].hStatus != DataClasses.CooktopCtrl.DEVICE_STATUS.NOINFO) {
+                                if(HybridCookTopCTR.data.Device[0].circuit[RoomIndex].hStatus == DataClasses.CooktopCtrl.DEVICE_STATUS.OPEN)
+                                {
+                                    OnOpenCount++;
+                                }
+                                else if(HybridCookTopCTR.data.Device[0].circuit[RoomIndex].hStatus == DataClasses.CooktopCtrl.DEVICE_STATUS.WORKING)
+                                {
+                                    OperationCount++;
+                                }
+                            }
+                        }
 
 
-                    if (GasValveCTR.data.DeviceCnt == 2) {
-                        GasValveCTR.Refresh((byte)1, false);
+                        if(OperationCount > 0)
+                        {
+                            valvestatus = "ing";
+                        }
+                        else if(OnOpenCount > 0)
+                        {
+                            valvestatus = "open";
+                        }
+                        else
+                        {
+                            valvestatus = "close";
+                        }
                     }
                     }
+                }
+                else
+                {
+                    if(GasValveCTR!=null)
+                    {
+                        int ret = GasValveCTR.Refresh((byte)0, false);
+                        if (ret < 0) {
+                            strResult += "\"fail\">\r\n   </service>\r\n</imap>";
+                            return strResult;
+                        }
 
 
-                    byte GasStatus = GasAPI.GASSTATUS.Close;
-                    for (int i = 0; i < GasValveCTR.data.DeviceCnt; i++) {
-                        if (GasValveCTR.data.Device[i].GasStatus == GasAPI.GASSTATUS.Operation) {
-                            GasStatus = GasAPI.GASSTATUS.Operation;
-                            break;
+                        if (GasValveCTR.data.DeviceCnt == 2) {
+                            GasValveCTR.Refresh((byte)1, false);
                         }
                         }
 
 
-                        if (GasValveCTR.data.Device[i].GasStatus == GasAPI.GASSTATUS.Open) {
-                            GasStatus = GasAPI.GASSTATUS.Open;
-                            break;
+                        byte GasStatus = GasAPI.GASSTATUS.Close;
+                        for (int i = 0; i < GasValveCTR.data.DeviceCnt; i++) {
+                            if (GasValveCTR.data.Device[i].GasStatus == GasAPI.GASSTATUS.Operation) {
+                                GasStatus = GasAPI.GASSTATUS.Operation;
+                                break;
+                            }
+
+                            if (GasValveCTR.data.Device[i].GasStatus == GasAPI.GASSTATUS.Open) {
+                                GasStatus = GasAPI.GASSTATUS.Open;
+                                break;
+                            }
                         }
                         }
-                    }
 
 
-                    if (GasStatus == GasAPI.GASSTATUS.Close) valvestatus = "close";
-                    else if (GasStatus == GasAPI.GASSTATUS.Open) valvestatus = "open";
-                    else if (GasStatus == GasAPI.GASSTATUS.Operation) valvestatus = "ing";
-                    else valvestatus = "unknown";
+                        if (GasStatus == GasAPI.GASSTATUS.Close) valvestatus = "close";
+                        else if (GasStatus == GasAPI.GASSTATUS.Open) valvestatus = "open";
+                        else if (GasStatus == GasAPI.GASSTATUS.Operation) valvestatus = "ing";
+                        else valvestatus = "unknown";
+                    }
                 }
                 }
-
             }
             }
             else if (actionTXT.equalsIgnoreCase("control")) {
             else if (actionTXT.equalsIgnoreCase("control")) {
                 // 가스밸브 콘트롤
                 // 가스밸브 콘트롤
-                if(GasValveCTR!=null)
+                if(mWallPadAPI.GetGasKind() == 2)
                 {
                 {
-                    int ret = GasValveCTR.SetClose((byte)0xFF);
-                    if (ret < 0) {
-                        strResult += "\"fail\">\r\n   </service>\r\n</imap>";
-                        return strResult;
-                    }
+                    //하이브리드
+                    if(HybridCookTopCTR!=null)
+                    {
+                        int ret = HybridCookTopCTR.setEntireCircuitClose((byte) 0);
+                        if (ret < 0) {
+                            strResult += "\"fail\">\r\n   </service>\r\n</imap>";
+                            return strResult;
+                        }
 
 
-                    ret = GasValveCTR.Refresh((byte)0, false);
-                    if (ret < 0) {
-                        strResult += "\"fail\">\r\n   </service>\r\n</imap>";
-                        return strResult;
-                    }
+                        ret = HybridCookTopCTR.Refresh((byte)0xFF, false);
+                        if (ret < 0) {
+                            strResult += "\"fail\">\r\n   </service>\r\n</imap>";
+                            return strResult;
+                        }
+
+                        int OnOpenCount = 0;
+                        int OperationCount = 0;
+                        for(int RoomIndex=0 ; RoomIndex<HybridCookTopCTR.data.Device[0].circuit.length ; RoomIndex++)
+                        {
+                            //  콘센트 ON/OFF 업데이트
+                            if( HybridCookTopCTR.data.Device[0].circuit[RoomIndex].hStatus != DataClasses.CooktopCtrl.DEVICE_STATUS.NOINFO) {
+                                if(HybridCookTopCTR.data.Device[0].circuit[RoomIndex].hStatus == DataClasses.CooktopCtrl.DEVICE_STATUS.OPEN)
+                                {
+                                    OnOpenCount++;
+                                }
+                                else if(HybridCookTopCTR.data.Device[0].circuit[RoomIndex].hStatus == DataClasses.CooktopCtrl.DEVICE_STATUS.WORKING)
+                                {
+                                    OperationCount++;
+                                }
+                            }
+                        }
 
 
-                    if (GasValveCTR.data.DeviceCnt == 2) {
-                        GasValveCTR.Refresh((byte)1, false);
+                        if(OperationCount > 0)
+                        {
+                            valvestatus = "ing";
+                        }
+                        else if(OnOpenCount > 0)
+                        {
+                            valvestatus = "open";
+                        }
+                        else
+                        {
+                            valvestatus = "close";
+                        }
                     }
                     }
+                }
+                else
+                {
+                    if(GasValveCTR!=null)
+                    {
+                        int ret = GasValveCTR.SetClose((byte)0xFF);
+                        if (ret < 0) {
+                            strResult += "\"fail\">\r\n   </service>\r\n</imap>";
+                            return strResult;
+                        }
 
 
-                    byte GasStatus = GasAPI.GASSTATUS.Close;
-                    for (int i = 0; i < GasValveCTR.data.DeviceCnt; i++) {
-                        if (GasValveCTR.data.Device[i].GasStatus == GasAPI.GASSTATUS.Operation) {
-                            GasStatus = GasAPI.GASSTATUS.Operation;
-                            break;
+                        ret = GasValveCTR.Refresh((byte)0, false);
+                        if (ret < 0) {
+                            strResult += "\"fail\">\r\n   </service>\r\n</imap>";
+                            return strResult;
                         }
                         }
 
 
-                        if (GasValveCTR.data.Device[i].GasStatus == GasAPI.GASSTATUS.Open) {
-                            GasStatus = GasAPI.GASSTATUS.Open;
-                            break;
+                        if (GasValveCTR.data.DeviceCnt == 2) {
+                            GasValveCTR.Refresh((byte)1, false);
+                        }
+
+                        byte GasStatus = GasAPI.GASSTATUS.Close;
+                        for (int i = 0; i < GasValveCTR.data.DeviceCnt; i++) {
+                            if (GasValveCTR.data.Device[i].GasStatus == GasAPI.GASSTATUS.Operation) {
+                                GasStatus = GasAPI.GASSTATUS.Operation;
+                                break;
+                            }
+
+                            if (GasValveCTR.data.Device[i].GasStatus == GasAPI.GASSTATUS.Open) {
+                                GasStatus = GasAPI.GASSTATUS.Open;
+                                break;
+                            }
                         }
                         }
-                    }
 
 
-                    if (GasStatus == GasAPI.GASSTATUS.Close) valvestatus = "close";
-                    else if (GasStatus == GasAPI.GASSTATUS.Open) valvestatus = "open";
-                    else if (GasStatus == GasAPI.GASSTATUS.Operation) valvestatus = "ing";
-                    else valvestatus = "unknown";
+                        if (GasStatus == GasAPI.GASSTATUS.Close) valvestatus = "close";
+                        else if (GasStatus == GasAPI.GASSTATUS.Open) valvestatus = "open";
+                        else if (GasStatus == GasAPI.GASSTATUS.Operation) valvestatus = "ing";
+                        else valvestatus = "unknown";
+                    }
                 }
                 }
 
 
             }
             }
@@ -12656,22 +12824,41 @@ public class iMapServer extends Service {
 
 
                                     if (devSet.Get_GAS_Info() == 1)
                                     if (devSet.Get_GAS_Info() == 1)
                                     {
                                     {
-                                        GasAPI GasCTR = mWallPadAPI.Get_GasController();
+                                        //여기서 신우전자확인이 더 필요함
+                                        GasAPI GasCTR = null;//mWallPadAPI.Get_GasController();
+                                        CooktopAPI HybridCookTopCTR = null;
                                         subunitcnt = "1";
                                         subunitcnt = "1";
                                         devid 	= "0x31";
                                         devid 	= "0x31";
                                         Vender  = "null";
                                         Vender  = "null";
                                         Model   = "null";
                                         Model   = "null";
-                                        if(GasCTR!=null)
+                                        if(mWallPadAPI.GetGasKind() == 2)
                                         {
                                         {
-                                            GasCTR.TRInfo.GetTransactionList(0);
-                                            statusRate = String.format("%d/%d",GasCTR.TRInfo.RecentSuccess, (GasCTR.TRInfo.RecentSuccess+GasCTR.TRInfo.RecentFail));
-                                            double surate = GasCTR.TRInfo.GetSuccessRate(false);
-                                            statusType = surate>70?"good":surate>30?"notgood":"bad";
-                                            message    = "null";
-                                            ControlDEVList+="		<unit type=\"gas\" id=\""+devid+"\" vendor=\""+Vender+"\" model=\""+Model+"\" subunit_cnt=\""+subunitcnt+"\" status_com=\""+statusRate+"\" status_type=\""+statusType+"\" message=\""+message+"\"/>\r\n";
-                                            itemCNT++;
+                                            HybridCookTopCTR = mWallPadAPI.Get_CookTopController();
+                                            if(HybridCookTopCTR!=null)
+                                            {
+                                                HybridCookTopCTR.TRInfo.GetTransactionList(0);
+                                                statusRate = String.format("%d/%d",HybridCookTopCTR.TRInfo.RecentSuccess, (HybridCookTopCTR.TRInfo.RecentSuccess+HybridCookTopCTR.TRInfo.RecentFail));
+                                                double surate = HybridCookTopCTR.TRInfo.GetSuccessRate(false);
+                                                statusType = surate>70?"good":surate>30?"notgood":"bad";
+                                                message    = "null";
+                                                ControlDEVList+="		<unit type=\"gas\" id=\""+devid+"\" vendor=\""+Vender+"\" model=\""+Model+"\" subunit_cnt=\""+subunitcnt+"\" status_com=\""+statusRate+"\" status_type=\""+statusType+"\" message=\""+message+"\"/>\r\n";
+                                                itemCNT++;
+                                            }
+                                        }
+                                        else
+                                        {
+                                            GasCTR = mWallPadAPI.Get_GasController();
+                                            if(GasCTR!=null)
+                                            {
+                                                GasCTR.TRInfo.GetTransactionList(0);
+                                                statusRate = String.format("%d/%d",GasCTR.TRInfo.RecentSuccess, (GasCTR.TRInfo.RecentSuccess+GasCTR.TRInfo.RecentFail));
+                                                double surate = GasCTR.TRInfo.GetSuccessRate(false);
+                                                statusType = surate>70?"good":surate>30?"notgood":"bad";
+                                                message    = "null";
+                                                ControlDEVList+="		<unit type=\"gas\" id=\""+devid+"\" vendor=\""+Vender+"\" model=\""+Model+"\" subunit_cnt=\""+subunitcnt+"\" status_com=\""+statusRate+"\" status_type=\""+statusType+"\" message=\""+message+"\"/>\r\n";
+                                                itemCNT++;
+                                            }
                                         }
                                         }
-
                                     }
                                     }
                                     else
                                     else
                                     {
                                     {

BIN
WallPadOutmodeRun/libs/WallPadAPI.jar


BIN
WallPadSecurity/libs/WallPadAPI.jar