package com.ycl.api.YS.config.io; import com.sun.jna.ptr.IntByReference; import com.ycl.api.YS.NetDemo; import com.ycl.api.YS.util.Common; import com.ycl.api.YS.lib.NetDEVSDKLib.*; import javax.swing.*; /** * * @introduction Alarm output information * @description */ public class AlarmOutput { /** * * @introduction Get alarm output information * @description Calling the interface of NETDEV_GetDevConfig * */ public static void getAlarmOutPut() { NetDemo.jComboBoxAlarmOutPutIndex.removeAllItems(); if(null == NetDemo.lpUserID){ JOptionPane.showMessageDialog(null, "Please Login device first.error code"+ NetDemo.netdevsdk.NETDEV_GetLastError()); return; } NETDEV_ALARM_OUTPUT_LIST_S stAlarmOutputList = new NETDEV_ALARM_OUTPUT_LIST_S(); stAlarmOutputList.dwSize=64; stAlarmOutputList.write(); if(NetDemo.pstDeviceInfo.dwDeviceType == NETDEV_DEVICE_TYPE_E.NETDEV_DTYPE_IPC || NetDemo.pstDeviceInfo.dwDeviceType == NETDEV_DEVICE_TYPE_E.NETDEV_DTYPE_IPC_FISHEYE || NetDemo.pstDeviceInfo.dwDeviceType == NETDEV_DEVICE_TYPE_E.NETDEV_DTYPE_IPC_ECONOMIC_FISHEYE || NetDemo.pstDeviceInfo.dwDeviceType == NETDEV_DEVICE_TYPE_E.NETDEV_DTYPE_IPC_ACS) { NetDemo.ChannelID=0; } IntByReference dwBytesReturned = new IntByReference(); boolean bRet = NetDemo.netdevsdk.NETDEV_GetDevConfig(NetDemo.lpUserID, NetDemo.ChannelID, NETDEV_CONFIG_COMMAND_E.NETDEV_GET_ALARM_OUTPUTCFG, stAlarmOutputList.getPointer(), stAlarmOutputList.size(), dwBytesReturned ); if(bRet != true) { JOptionPane.showMessageDialog(null, "Get data failed error code"+ NetDemo.netdevsdk.NETDEV_GetLastError()); System.out.printf("NETDEV_GetDevConfig failed:%d\n", NetDemo.netdevsdk.NETDEV_GetLastError()); return; }else { stAlarmOutputList.read(); if(NetDemo.pstDeviceInfo.dwDeviceType == NETDEV_DEVICE_TYPE_E.NETDEV_DTYPE_VMS) { for(int i =0; i< stAlarmOutputList.dwSize; i++) { NetDemo.jComboBoxAlarmOutPutIndex.addItem(String.valueOf(stAlarmOutputList.astAlarmOutputInfo[i].dwOutputNum)); } }else if(NetDemo.pstDeviceInfo.dwDeviceType == NETDEV_DEVICE_TYPE_E.NETDEV_DTYPE_IPC || NetDemo.pstDeviceInfo.dwDeviceType == NETDEV_DEVICE_TYPE_E.NETDEV_DTYPE_IPC_FISHEYE || NetDemo.pstDeviceInfo.dwDeviceType == NETDEV_DEVICE_TYPE_E.NETDEV_DTYPE_IPC_ECONOMIC_FISHEYE || NetDemo.pstDeviceInfo.dwDeviceType == NETDEV_DEVICE_TYPE_E.NETDEV_DTYPE_IPC_ACS) { for(int i =0; i< stAlarmOutputList.dwSize; i++) { try { if(stAlarmOutputList.astAlarmOutputInfo[i].dwChancelId==0) { if(Common.byteArrayToString(stAlarmOutputList.astAlarmOutputInfo[i].szName).equals("relay_output")) { NetDemo.jComboBoxAlarmOutPutIndex.addItem("A_"+1); }else { NetDemo.jComboBoxAlarmOutPutIndex.addItem("A_"+(Integer.parseInt(Common.byteArrayToString(stAlarmOutputList.astAlarmOutputInfo[i].szName).substring(12,Common.byteArrayToString(stAlarmOutputList.astAlarmOutputInfo[i].szName).length() ))+1)); } }else { NetDemo.jComboBoxAlarmOutPutIndex.addItem("D"+String.valueOf(stAlarmOutputList.astAlarmOutputInfo[i].dwChancelId)+"_"+String.valueOf(1)); } }catch(Exception mt) {} } } else { for(int i =0; i< stAlarmOutputList.dwSize; i++) { if((Common.byteArrayToString(stAlarmOutputList.astAlarmOutputInfo[i].szName).substring(12, 13)).equals("D")) { for(int s=0;s