package utils; import com.alibaba.fastjson.JSON; import com.ruoyi.code.camera.domain.CameraNetFtp; import com.ruoyi.common.core.page.R; import com.ruoyi.common.utils.StringUtils; import com.sun.jna.NativeLong; import com.sun.jna.Pointer; import com.sun.jna.Structure; import com.sun.jna.ptr.IntByReference; import sdk.java.common.GlobalTool; import sdk.java.lib.DataUtils; import sdk.java.lib.netmanager.NetDefs; import sdk.java.lib.netmanager.NetEnums; import sdk.java.lib.netmanager.NetEnums.EM_DEVICE_CFG_TYPE; import sdk.java.lib.netmanager.NetEnums.EM_WHITE_BALANCE; import sdk.java.lib.netmanager.NetLib; import sdk.java.lib.netmanager.NetStructs; import sdk.java.lib.netmanager.NetStructs.*; import javax.swing.*; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; import javax.swing.table.DefaultTableModel; import javax.swing.table.JTableHeader; import javax.swing.table.TableCellRenderer; import javax.swing.table.TableColumn; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.*; public class run_device_cfg implements ActionListener, ListSelectionListener { private JFrame m_frame; private JTextField m_jtf_ip; private JTextField m_jtf_port; private JTextField m_jtf_username; private JTextField m_jtf_password; private JTable m_table_result; private DefaultTableModel m_tableModel; private JButton m_btn_login; private JButton m_btn_logout; private JButton m_btn_refresh; private JButton m_btn_set; private JList m_list_cfg_type; /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// private NativeLong m_loginID = new NativeLong(0); private JLabel m_lbl_notify; private Object m_curStuObj = null; private Map m_mapIndexToCfgType = new HashMap(); /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /** * Create the application. */ public run_device_cfg() { // initialize(); initilizeRyNetLib(); } /** * Initialize the contents of the frame. */ private void initialize() { m_frame = new JFrame(); m_frame.setTitle("设备配置"); m_frame.setBounds(100, 100, 694, 683); Toolkit kit = Toolkit.getDefaultToolkit(); int x = kit.getScreenSize().width/2 - this.m_frame.getWidth()/2; int y = kit.getScreenSize().height/2 - this.m_frame.getHeight()/2; m_frame.setLocation(x, y); m_frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); m_frame.getContentPane().setLayout(null); JLabel lblIp = new JLabel("IP:"); lblIp.setBounds(10, 10, 79, 15); m_frame.getContentPane().add(lblIp); JLabel lblPort = new JLabel("Port:"); lblPort.setBounds(10, 35, 79, 15); m_frame.getContentPane().add(lblPort); JLabel lblUsername = new JLabel("Username:"); lblUsername.setBounds(10, 60, 79, 15); m_frame.getContentPane().add(lblUsername); JLabel lblPassword = new JLabel("Password:"); lblPassword.setBounds(10, 85, 79, 15); m_frame.getContentPane().add(lblPassword); m_jtf_ip = new JTextField(); m_jtf_ip.setBounds(99, 7, 224, 21); m_frame.getContentPane().add(m_jtf_ip); m_jtf_ip.setColumns(10); m_jtf_port = new JTextField(); m_jtf_port.setBounds(99, 32, 224, 21); m_frame.getContentPane().add(m_jtf_port); m_jtf_port.setColumns(10); m_jtf_username = new JTextField(); m_jtf_username.setBounds(99, 57, 224, 21); m_frame.getContentPane().add(m_jtf_username); m_jtf_username.setColumns(10); m_jtf_password = new JTextField(); m_jtf_password.setBounds(99, 82, 224, 21); m_frame.getContentPane().add(m_jtf_password); m_jtf_password.setColumns(10); m_btn_login = new JButton("登陆"); m_btn_login.addActionListener(this); m_btn_login.setBounds(408, 31, 93, 23); m_frame.getContentPane().add(m_btn_login); m_btn_logout = new JButton("登出"); m_btn_logout.addActionListener(this); m_btn_logout.setEnabled(false); m_btn_logout.setBounds(511, 31, 93, 23); m_frame.getContentPane().add(m_btn_logout); JLabel label = new JLabel("选择配置类型:"); label.setBounds(10, 143, 138, 15); m_frame.getContentPane().add(label); m_list_cfg_type = new JList(); m_list_cfg_type.addListSelectionListener(this); m_list_cfg_type.setEnabled(false); m_list_cfg_type.setBounds(10, 168, 194, 402); JScrollPane listScrollPane = new JScrollPane(m_list_cfg_type); listScrollPane.setBounds(10, 168, 194, 402); m_frame.getContentPane().add(listScrollPane); Vector columTitle = new Vector(); columTitle.addElement("查询内容"); columTitle.addElement("值"); Vector> data = new Vector>(); m_tableModel = new DefaultTableModel(data, columTitle); m_table_result = new JTable(m_tableModel); m_table_result.setEnabled(false); m_table_result.setBounds(10, 232, 227, 257); m_table_result.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); JScrollPane jsp = new JScrollPane(m_table_result); jsp.setBounds(214, 168, 454, 402); m_frame.getContentPane().add(jsp); m_lbl_notify = new JLabel(""); m_lbl_notify.setBounds(10, 613, 658, 15); m_frame.getContentPane().add(m_lbl_notify); m_btn_refresh = new JButton("刷新"); m_btn_refresh.addActionListener(this); m_btn_refresh.setBounds(472, 580, 93, 23); m_frame.getContentPane().add(m_btn_refresh); m_btn_set = new JButton("修改"); m_btn_set.addActionListener(this); m_btn_set.setBounds(575, 580, 93, 23); m_frame.getContentPane().add(m_btn_set); } private void addListItems() { Vector listData = new Vector(); int index = 0; listData.addElement("设备系统配置"); m_mapIndexToCfgType.put(index, EM_DEVICE_CFG_TYPE.DEVICE_CFG_SYS); index++; listData.addElement("网络配置"); m_mapIndexToCfgType.put(index, EM_DEVICE_CFG_TYPE.DEVICE_CFG_NET); index++; listData.addElement("时间配置"); m_mapIndexToCfgType.put(index, EM_DEVICE_CFG_TYPE.DEVICE_CFG_SYS_TIME); index++; listData.addElement("夏令时配置"); m_mapIndexToCfgType.put(index, EM_DEVICE_CFG_TYPE.DEVICE_CFG_TIME_DST); index++; listData.addElement("NTP配置"); m_mapIndexToCfgType.put(index, EM_DEVICE_CFG_TYPE.DEVICE_CFG_NTP); index++; listData.addElement("通道配置"); m_mapIndexToCfgType.put(index, EM_DEVICE_CFG_TYPE.DEVICE_CFG_CHANNEL); index++; listData.addElement("录像配置"); m_mapIndexToCfgType.put(index, EM_DEVICE_CFG_TYPE.DEVICE_CFG_RECORD); index++; listData.addElement("串口配置"); m_mapIndexToCfgType.put(index, EM_DEVICE_CFG_TYPE.DEVICE_CFG_SERIAL_PORT); index++; listData.addElement("对讲配置"); m_mapIndexToCfgType.put(index, EM_DEVICE_CFG_TYPE.DEVICE_CFG_TALK); index++; listData.addElement("自动维护配置"); m_mapIndexToCfgType.put(index, EM_DEVICE_CFG_TYPE.DEVICE_CFG_AUTO_MAINTAIN); index++; listData.addElement("人脸识别规则配置"); m_mapIndexToCfgType.put(index, EM_DEVICE_CFG_TYPE.DEVICE_CFG_FACE_RECOGNIZE_RULES); index++; listData.addElement("抓拍模式配置"); m_mapIndexToCfgType.put(index, EM_DEVICE_CFG_TYPE.DEVICE_CFG_CAPTURE_MODE); index++; listData.addElement("抓拍张数配置"); m_mapIndexToCfgType.put(index, EM_DEVICE_CFG_TYPE.DEVICE_CFG_SNAP_TIMES); index++; listData.addElement("Web HTTP/HTTPS 配置"); m_mapIndexToCfgType.put(index, EM_DEVICE_CFG_TYPE.DEVICE_CFG_WEB); index++; listData.addElement("RTSP 配置"); m_mapIndexToCfgType.put(index, EM_DEVICE_CFG_TYPE.DEVICE_CFG_RTSP); index++; listData.addElement("NetService 配置"); m_mapIndexToCfgType.put(index, EM_DEVICE_CFG_TYPE.DEVICE_CFG_NET_SERVICE); index++; listData.addElement("端口配置"); m_mapIndexToCfgType.put(index, EM_DEVICE_CFG_TYPE.DEVICE_CFG_NET_PORT); index++; listData.addElement("WIFI使能配置 设置或者获取wifi使能配置"); m_mapIndexToCfgType.put(index, EM_DEVICE_CFG_TYPE.DEVICE_CFG_WIFI_ENABLE); index++; listData.addElement("WIFI操作配置;包括扫描;链接;断开链接"); m_mapIndexToCfgType.put(index, EM_DEVICE_CFG_TYPE.DEVICE_CFG_WIFI_OPERATE); index++; listData.addElement("水印配置"); m_mapIndexToCfgType.put(index, EM_DEVICE_CFG_TYPE.DEVICE_CFG_WATERMARK); index++; listData.addElement("摄像头属性配置"); m_mapIndexToCfgType.put(index, EM_DEVICE_CFG_TYPE.DEVICE_CFG_CAMERA); index++; listData.addElement("视频OSD叠加配置"); m_mapIndexToCfgType.put(index, EM_DEVICE_CFG_TYPE.DEVICE_CFG_VIDEO_OSD); index++; listData.addElement("存储配置"); m_mapIndexToCfgType.put(index, EM_DEVICE_CFG_TYPE.DEVICE_CFG_STORAGE); index++; listData.addElement("网络存储传输配置"); m_mapIndexToCfgType.put(index, EM_DEVICE_CFG_TYPE.DEVICE_CFG_NET_STORAGE_TRANS); index++; listData.addElement("Telnet配置"); m_mapIndexToCfgType.put(index, EM_DEVICE_CFG_TYPE.DEVICE_CFG_TELNET); index++; listData.addElement("日志搜索"); m_mapIndexToCfgType.put(index, EM_DEVICE_CFG_TYPE.DEVICE_CFG_LOGSEARCH); index++; listData.addElement("黑白名单"); m_mapIndexToCfgType.put(index, EM_DEVICE_CFG_TYPE.DEVICE_CFG_NETWHITEBLACK); index++; listData.addElement("用户管理"); m_mapIndexToCfgType.put(index, EM_DEVICE_CFG_TYPE.DEVICE_CFG_USER); index++; listData.addElement("获取在线用户"); m_mapIndexToCfgType.put(index, EM_DEVICE_CFG_TYPE.DEVICE_CFG_USER_ONLINE); index++; listData.addElement("抠图配置"); m_mapIndexToCfgType.put(index, EM_DEVICE_CFG_TYPE.DEVICE_CFG_SNAP_CUTOUT); index++; listData.addElement("叠加与抓图配置"); m_mapIndexToCfgType.put(index, EM_DEVICE_CFG_TYPE.DEVICE_CFG_OVERLAP_PIC); index++; listData.addElement("人脸检测智能场景配置"); m_mapIndexToCfgType.put(index, EM_DEVICE_CFG_TYPE.DEVICE_CFG_INTELLI_SCENE_FACE_DETECT); index++; listData.addElement("人脸检测规则配置"); m_mapIndexToCfgType.put(index, EM_DEVICE_CFG_TYPE.DEVICE_CFG_INTELLI_RULE_FACE_DETECT); index++; listData.addElement("人脸检测统计配置"); m_mapIndexToCfgType.put(index, EM_DEVICE_CFG_TYPE.DEVICE_CFG_INTELLI_RULE_FACE_DETECT_STAT); index++; listData.addElement("报警参数"); m_mapIndexToCfgType.put(index, EM_DEVICE_CFG_TYPE.DEVICE_CFG_ALARM_PARAM); index++; listData.addElement("编码配置"); m_mapIndexToCfgType.put(index, EM_DEVICE_CFG_TYPE.DEVICE_CFG_ENCODE_PARAM); index++; listData.addElement("GB28181参数配置"); m_mapIndexToCfgType.put(index, EM_DEVICE_CFG_TYPE.DEVICE_CFG_GB28181_PARAM); index++; listData.addElement("ONVIF 配置"); m_mapIndexToCfgType.put(index, EM_DEVICE_CFG_TYPE.DEVICE_CFG_ONVIF); index++; listData.addElement("云服务配置"); m_mapIndexToCfgType.put(index, EM_DEVICE_CFG_TYPE.DEVICE_CFG_CLOUD_SERVICE); index++; listData.addElement("ZK配置"); m_mapIndexToCfgType.put(index, EM_DEVICE_CFG_TYPE.DEVICE_CFG_ZK); index++; // 添加内容 m_list_cfg_type.setListData(listData); } private void initilizeRyNetLib() { NetLib.instance.Net_Init(null, null); } protected void finalize() { NetLib.instance.Net_Exit(); } private boolean checkParams() { String tmp = this.m_jtf_ip.getText().trim(); if(tmp.isEmpty()) { return false; } tmp = this.m_jtf_port.getText().trim(); if(tmp.isEmpty()) { return false; } tmp = this.m_jtf_username.getText().trim(); if(tmp.isEmpty()) { return false; } tmp = this.m_jtf_password.getText().trim(); if(tmp.isEmpty()) { return false; } return true; } private void setNotifyInfo(String info) { m_lbl_notify.setText(info); } private void refreshEnables() { boolean bLogin = 0 != this.m_loginID.longValue() ? true : false; this.m_btn_login.setEnabled(!bLogin); this.m_btn_logout.setEnabled(bLogin); this.m_list_cfg_type.setEnabled(bLogin); this.m_tableModel.setRowCount(0); } /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// private void autoFitTabelColums(JTable myTable) { JTableHeader header = myTable.getTableHeader(); int nRowCount = myTable.getRowCount(); Enumeration columns = myTable.getColumnModel().getColumns(); while(columns.hasMoreElements()) { TableColumn column = (TableColumn) columns.nextElement(); int nCol = header.getColumnModel().getColumnIndex(column.getIdentifier()); TableCellRenderer tableHeaderRenderer = (TableCellRenderer) header.getDefaultRenderer().getTableCellRendererComponent( myTable, column.getIdentifier(), false, false, -1, nCol); int nWidth = (int) ((Container) tableHeaderRenderer).getPreferredSize().getWidth(); for(int nRow=0; nRow> tableContent, String strContent, String strValue) { Vector rowData = new Vector(); rowData.addElement(strContent); rowData.addElement(strValue); tableContent.addElement(rowData); } private void ui_refreshTableContent(Vector> tableContent) { for(int i=0; i> tableContent = new Vector>(); if(EM_DEVICE_CFG_TYPE.DEVICE_CFG_SYS == command) { STU_SYS_INFO stuSysInfo = new STU_SYS_INFO(); DataUtils.sdk_data_ptrToStructure(ptrOutBuffer, stuSysInfo); m_curStuObj = stuSysInfo; insertSysInfo(tableContent, stuSysInfo); } else if(EM_DEVICE_CFG_TYPE.DEVICE_CFG_NET == command) { STU_CFG_ALL_NETCARD stuCfgAllNetCard = new STU_CFG_ALL_NETCARD(); DataUtils.sdk_data_ptrToStructure(ptrOutBuffer, stuCfgAllNetCard); m_curStuObj = stuCfgAllNetCard; insertAllNetCard(tableContent, stuCfgAllNetCard); } else if(EM_DEVICE_CFG_TYPE.DEVICE_CFG_SYS_TIME == command) { STU_TIME stuTime = new STU_TIME(); DataUtils.sdk_data_ptrToStructure(ptrOutBuffer, stuTime); m_curStuObj = stuTime; insertStuTime(tableContent, stuTime); } else if(EM_DEVICE_CFG_TYPE.DEVICE_CFG_TIME_DST == command) { STU_CFG_DST stuCfgDst = new STU_CFG_DST(); DataUtils.sdk_data_ptrToStructure(ptrOutBuffer, stuCfgDst); m_curStuObj = stuCfgDst; insertCfgDst(tableContent, stuCfgDst); } else if(EM_DEVICE_CFG_TYPE.DEVICE_CFG_NTP == command) { STU_CFG_NTP stuCfgNtp = new STU_CFG_NTP(); DataUtils.sdk_data_ptrToStructure(ptrOutBuffer, stuCfgNtp); m_curStuObj = stuCfgNtp; insertCfgNtp(tableContent, stuCfgNtp); } else if(EM_DEVICE_CFG_TYPE.DEVICE_CFG_RECORD == command) { STU_CFG_RECORD stuCfgRecord = new STU_CFG_RECORD(); DataUtils.sdk_data_ptrToStructure(ptrOutBuffer, stuCfgRecord); m_curStuObj = stuCfgRecord; insertCfgRecord(tableContent, stuCfgRecord); } else if(EM_DEVICE_CFG_TYPE.DEVICE_CFG_SERIAL_PORT == command) { STU_CFG_COM stuCfgCom = new STU_CFG_COM(); DataUtils.sdk_data_ptrToStructure(ptrOutBuffer, stuCfgCom); m_curStuObj = stuCfgCom; insertCfgCom(tableContent, stuCfgCom); } else if(EM_DEVICE_CFG_TYPE.DEVICE_CFG_AUTO_MAINTAIN == command) { STU_CFG_AUTO_MAINTAIN stuCfgAutoMaintain = new STU_CFG_AUTO_MAINTAIN(); DataUtils.sdk_data_ptrToStructure(ptrOutBuffer, stuCfgAutoMaintain); m_curStuObj = stuCfgAutoMaintain; insertCfgAutoMain(tableContent, stuCfgAutoMaintain); } else if(EM_DEVICE_CFG_TYPE.DEVICE_CFG_FACE_RECOGNIZE_RULES == command) { STU_CFG_FACE_GROUP_RECOGNIZE_RULES stuCfgFaceGroupRecRules = new STU_CFG_FACE_GROUP_RECOGNIZE_RULES(); DataUtils.sdk_data_ptrToStructure(ptrOutBuffer, stuCfgFaceGroupRecRules); m_curStuObj = stuCfgFaceGroupRecRules; insertCfgFaceGroupRecResult(tableContent, stuCfgFaceGroupRecRules); } else if(EM_DEVICE_CFG_TYPE.DEVICE_CFG_CAPTURE_MODE == command) { STU_CFG_CAPTURE_MODE stuCfgCapMode = new STU_CFG_CAPTURE_MODE(); DataUtils.sdk_data_ptrToStructure(ptrOutBuffer, stuCfgCapMode); m_curStuObj = stuCfgCapMode; insertCfgCapMode(tableContent, stuCfgCapMode); } else if(EM_DEVICE_CFG_TYPE.DEVICE_CFG_SNAP_TIMES == command) { STU_CFG_SNAP_TIMES stuCfgSnapTimes = new STU_CFG_SNAP_TIMES(); DataUtils.sdk_data_ptrToStructure(ptrOutBuffer, stuCfgSnapTimes); m_curStuObj = stuCfgSnapTimes; insertCfgSnapTimes(tableContent, stuCfgSnapTimes); } else if(EM_DEVICE_CFG_TYPE.DEVICE_CFG_WEB == command) { STU_CFG_NET_WEB stuCfgNetWeb = new STU_CFG_NET_WEB(); DataUtils.sdk_data_ptrToStructure(ptrOutBuffer, stuCfgNetWeb); m_curStuObj = stuCfgNetWeb; insertCfgNetWeb(tableContent, stuCfgNetWeb); } else if(EM_DEVICE_CFG_TYPE.DEVICE_CFG_RTSP == command) { STU_CFG_NET_RTSP stuCfgNetRtsp = new STU_CFG_NET_RTSP(); DataUtils.sdk_data_ptrToStructure(ptrOutBuffer, stuCfgNetRtsp); m_curStuObj = stuCfgNetRtsp; insertCfgNetRtsp(tableContent, stuCfgNetRtsp); } else if(EM_DEVICE_CFG_TYPE.DEVICE_CFG_NET_SERVICE == command) { STU_CFG_NET_SERVICE stuCfgNetService = new STU_CFG_NET_SERVICE(); DataUtils.sdk_data_ptrToStructure(ptrOutBuffer, stuCfgNetService); m_curStuObj = stuCfgNetService; insertCfgNetService(tableContent, stuCfgNetService); } else if(EM_DEVICE_CFG_TYPE.DEVICE_CFG_NET_PORT == command) { STU_CFG_NET_PORT stuCfgNetPort = new STU_CFG_NET_PORT(); DataUtils.sdk_data_ptrToStructure(ptrOutBuffer, stuCfgNetPort); m_curStuObj = stuCfgNetPort; insertCfgNetService(tableContent, stuCfgNetPort); } else if(EM_DEVICE_CFG_TYPE.DEVICE_CFG_WIFI_ENABLE == command) { STU_CFG_WIFI_CONFIG stuCfgWifiConfig = new STU_CFG_WIFI_CONFIG(); DataUtils.sdk_data_ptrToStructure(ptrOutBuffer, stuCfgWifiConfig); m_curStuObj = stuCfgWifiConfig; insertCfgWifiConfig(tableContent, stuCfgWifiConfig); } else if(EM_DEVICE_CFG_TYPE.DEVICE_CFG_WATERMARK == command) { STU_CFG_WATER_MARK stuCfgWaterMark = new STU_CFG_WATER_MARK(); DataUtils.sdk_data_ptrToStructure(ptrOutBuffer, stuCfgWaterMark); m_curStuObj = stuCfgWaterMark; insertCfgWaterMark(tableContent, stuCfgWaterMark); } else if(EM_DEVICE_CFG_TYPE.DEVICE_CFG_CAMERA == command) { STU_CFG_CAMERA stuCfgCamera = new STU_CFG_CAMERA(); DataUtils.sdk_data_ptrToStructure(ptrOutBuffer, stuCfgCamera); m_curStuObj = stuCfgCamera; insertCfgCamera(tableContent, stuCfgCamera); } else if(EM_DEVICE_CFG_TYPE.DEVICE_CFG_VIDEO_OSD == command) { STU_CFG_VIDEO_OSD stuCfgVideoOsd = new STU_CFG_VIDEO_OSD(); DataUtils.sdk_data_ptrToStructure(ptrOutBuffer, stuCfgVideoOsd); m_curStuObj = stuCfgVideoOsd; insertCfgVideoOsd(tableContent, stuCfgVideoOsd); } else if(EM_DEVICE_CFG_TYPE.DEVICE_CFG_STORAGE == command) { STU_CFG_STORAGE stuCfgStorage = new STU_CFG_STORAGE(); DataUtils.sdk_data_ptrToStructure(ptrOutBuffer, stuCfgStorage); m_curStuObj = stuCfgStorage; insertCfgStorage(tableContent, stuCfgStorage); } else if(EM_DEVICE_CFG_TYPE.DEVICE_CFG_NET_STORAGE_TRANS == command) { STU_CFG_NET_STORAGE_TRANS stuCfgNetStorageTrans = new STU_CFG_NET_STORAGE_TRANS(); DataUtils.sdk_data_ptrToStructure(ptrOutBuffer, stuCfgNetStorageTrans); m_curStuObj = stuCfgNetStorageTrans; insertCfgNetStorageTrans(tableContent, stuCfgNetStorageTrans); } else if(EM_DEVICE_CFG_TYPE.DEVICE_CFG_TELNET == command) { STU_CFG_TELNET stuCfgTelnet = new STU_CFG_TELNET(); DataUtils.sdk_data_ptrToStructure(ptrOutBuffer, stuCfgTelnet); m_curStuObj = stuCfgTelnet; insertCfgTelnet(tableContent, stuCfgTelnet); } else if(EM_DEVICE_CFG_TYPE.DEVICE_CFG_LOGSEARCH == command) { STU_CFG_LOG stuCfgLog = new STU_CFG_LOG(); DataUtils.sdk_data_ptrToStructure(ptrOutBuffer, stuCfgLog); m_curStuObj = stuCfgLog; insertCfgLog(tableContent, stuCfgLog); } else if(EM_DEVICE_CFG_TYPE.DEVICE_CFG_NETWHITEBLACK == command) { STU_CFG_NET_WB_INFO stuCfgNetWbInfo = new STU_CFG_NET_WB_INFO(); DataUtils.sdk_data_ptrToStructure(ptrOutBuffer, stuCfgNetWbInfo); m_curStuObj = stuCfgNetWbInfo; insertCfgNetWbInfo(tableContent, stuCfgNetWbInfo); } else if(EM_DEVICE_CFG_TYPE.DEVICE_CFG_USER == command) { STU_CFG_USER_GET stuCfgUser = new STU_CFG_USER_GET(); DataUtils.sdk_data_ptrToStructure(ptrOutBuffer, stuCfgUser); m_curStuObj = stuCfgUser; insertCfgUser(tableContent, stuCfgUser); } else if(EM_DEVICE_CFG_TYPE.DEVICE_CFG_USER_ONLINE == command) { STU_CFG_USER_ONLINE_ITEMS stuCfgUserOnlineItems = new STU_CFG_USER_ONLINE_ITEMS(); DataUtils.sdk_data_ptrToStructure(ptrOutBuffer, stuCfgUserOnlineItems); m_curStuObj = stuCfgUserOnlineItems; insertCfgUserOnline(tableContent, stuCfgUserOnlineItems); } else if(EM_DEVICE_CFG_TYPE.DEVICE_CFG_SNAP_CUTOUT == command) { STU_CFG_SNAP_CUTOUT stuCfgSnapCutout = new STU_CFG_SNAP_CUTOUT(); DataUtils.sdk_data_ptrToStructure(ptrOutBuffer, stuCfgSnapCutout); m_curStuObj = stuCfgSnapCutout; insertCfgSnapCutout(tableContent, stuCfgSnapCutout); } else if(EM_DEVICE_CFG_TYPE.DEVICE_CFG_OVERLAP_PIC == command) { STU_CFG_OVERLAP_PIC stuCfgOverlapPic = new STU_CFG_OVERLAP_PIC(); DataUtils.sdk_data_ptrToStructure(ptrOutBuffer, stuCfgOverlapPic); m_curStuObj = stuCfgOverlapPic; insertCfgOverlapPic(tableContent, stuCfgOverlapPic); } else if(EM_DEVICE_CFG_TYPE.DEVICE_CFG_INTELLI_SCENE_FACE_DETECT == command) { STU_CFG_INTELLI_SCENE_FACE_DETECT stuCfgIntelliSceneFaceDetect = new STU_CFG_INTELLI_SCENE_FACE_DETECT(); DataUtils.sdk_data_ptrToStructure(ptrOutBuffer, stuCfgIntelliSceneFaceDetect); m_curStuObj = stuCfgIntelliSceneFaceDetect; insertCfgIntelliSceneFaceDetect(tableContent, stuCfgIntelliSceneFaceDetect); } else if(EM_DEVICE_CFG_TYPE.DEVICE_CFG_INTELLI_RULE_FACE_DETECT == command) { STU_CFG_INTELLI_RULE_FACE_DETECT stuCfgIntelliRuleFaceDetect = new STU_CFG_INTELLI_RULE_FACE_DETECT(); DataUtils.sdk_data_ptrToStructure(ptrOutBuffer, stuCfgIntelliRuleFaceDetect); m_curStuObj = stuCfgIntelliRuleFaceDetect; insertCfgIntelliRuleFaceDetect(tableContent, stuCfgIntelliRuleFaceDetect); } else if(EM_DEVICE_CFG_TYPE.DEVICE_CFG_INTELLI_RULE_FACE_DETECT_STAT == command) { STU_CFG_INTELLI_RULE_FACE_STATISTIC stuCfgIntelliRuleFaceSta = new STU_CFG_INTELLI_RULE_FACE_STATISTIC(); DataUtils.sdk_data_ptrToStructure(ptrOutBuffer, stuCfgIntelliRuleFaceSta); m_curStuObj = stuCfgIntelliRuleFaceSta; insertCfgIntelliRuleFaceSta(tableContent, stuCfgIntelliRuleFaceSta); } else if(EM_DEVICE_CFG_TYPE.DEVICE_CFG_ALARM_PARAM == command) { STU_CFG_ALARM_PARAM stuCfgAlarmParam = new STU_CFG_ALARM_PARAM(); DataUtils.sdk_data_ptrToStructure(ptrOutBuffer, stuCfgAlarmParam); m_curStuObj = stuCfgAlarmParam; insertCfgAlarmParam(tableContent, stuCfgAlarmParam); } else if(EM_DEVICE_CFG_TYPE.DEVICE_CFG_ENCODE_PARAM == command) { STU_CFG_ENCODE_PARAM stuCfgEncodeParam = new STU_CFG_ENCODE_PARAM(); DataUtils.sdk_data_ptrToStructure(ptrOutBuffer, stuCfgEncodeParam); m_curStuObj = stuCfgEncodeParam; insertCfgEncodeParam(tableContent, stuCfgEncodeParam); } else if(EM_DEVICE_CFG_TYPE.DEVICE_CFG_GB28181_PARAM == command) { STU_CFG_GB28181_PARAM.ByReference stuCfgGB28181Param = new STU_CFG_GB28181_PARAM.ByReference(); DataUtils.sdk_data_ptrToStructure(ptrOutBuffer, stuCfgGB28181Param); m_curStuObj = stuCfgGB28181Param; insertCfgGB28181Param(tableContent, stuCfgGB28181Param); } else if(EM_DEVICE_CFG_TYPE.DEVICE_CFG_ONVIF == command) { STU_CFG_ONVIF stuCfgOnvif = new STU_CFG_ONVIF(); DataUtils.sdk_data_ptrToStructure(ptrOutBuffer, stuCfgOnvif); m_curStuObj = stuCfgOnvif; insertCfgOnvif(tableContent, stuCfgOnvif); } else if(EM_DEVICE_CFG_TYPE.DEVICE_CFG_CLOUD_SERVICE == command) { STU_CFG_CLOUD_SERVICE stuCfgCloudService = new STU_CFG_CLOUD_SERVICE(); DataUtils.sdk_data_ptrToStructure(ptrOutBuffer, stuCfgCloudService); m_curStuObj = stuCfgCloudService; insertCfgCloudService(tableContent, stuCfgCloudService); } else if(EM_DEVICE_CFG_TYPE.DEVICE_CFG_ZK == command) { STU_CFG_ZK_SERVICE stuCfgZkService = new STU_CFG_ZK_SERVICE(); DataUtils.sdk_data_ptrToStructure(ptrOutBuffer, stuCfgZkService); m_curStuObj = stuCfgZkService; insertCfgZkService(tableContent, stuCfgZkService); } ui_refreshTableContent(tableContent); } private void insertSysInfo(Vector> tableContent, STU_SYS_INFO stuSysInfo) { String value = 1 == stuSysInfo.bAppAutoStart ? "支持" : "不支持"; insertRow(tableContent, "应用程序是否自启动", value); value = String.format("%d", stuSysInfo.nSupportLangNum); insertRow(tableContent, "支持的语言种数", value); value = DataUtils.sdk_data_byteArrayToString(stuSysInfo.szLanguages, GlobalTool.getEncodeType()); insertRow(tableContent, "语言", value); // 处理器信息 value = String.format("%d", stuSysInfo.nProcessorNum); insertRow(tableContent, "处理器个数", value); for(int i=0; i> tableContent, STU_CFG_ALL_NETCARD stuCfgAllNetCard) { String value = String.format("%d", stuCfgAllNetCard.uNetCardNum); insertRow(tableContent, "真实的网卡数量", value); value = DataUtils.sdk_data_byteArrayToString(stuCfgAllNetCard.szDefaultNetCard, GlobalTool.getEncodeType()); insertRow(tableContent, "默认网卡名称", value); for(int i=0; i> tableContent, STU_TIME stuTime) { String value = String.format("%d", stuTime.nYear); insertRow(tableContent, "年", value); value = String.format("%d", stuTime.nMonth); insertRow(tableContent, "月", value); value = String.format("%d", stuTime.nDay); insertRow(tableContent, "日", value); value = String.format("%d", stuTime.nHour); insertRow(tableContent, "时", value); value = String.format("%d", stuTime.nMinute); insertRow(tableContent, "分", value); value = String.format("%d", stuTime.nSecond); insertRow(tableContent, "秒", value); } private void insertCfgDst(Vector> tableContent, STU_CFG_DST stuCfgDst) { String value = 1 == stuCfgDst.bEnable ? "是" : "否"; insertRow(tableContent, "是否使能", value); value = String.format("%d", stuCfgDst.iTimeZone); insertRow(tableContent, "正数标示东,负数标示西,[-12 ~ 13]", value); value = String.format("%02d-%02d-%02d-%02d", stuCfgDst.stuDstStartTime.iMouth, stuCfgDst.stuDstStartTime.iWeek, stuCfgDst.stuDstStartTime.iDay, stuCfgDst.stuDstStartTime.iHour); insertRow(tableContent, "开始时间(月-周-日-时)", value); value = String.format("%02d-%02d-%02d-%02d", stuCfgDst.stuDstEndTime.iMouth, stuCfgDst.stuDstEndTime.iWeek, stuCfgDst.stuDstEndTime.iDay, stuCfgDst.stuDstEndTime.iHour); insertRow(tableContent, "结束时间(月-周-日-时)", value); } private void insertCfgNtp(Vector> tableContent, STU_CFG_NTP stuCfgNtp) { String value = DataUtils.sdk_data_byteArrayToString(stuCfgNtp.szDomainName, GlobalTool.getEncodeType()); insertRow(tableContent, "域名称", value); } private void insertCfgRecord(Vector> tableContent, STU_CFG_RECORD stuCfgRecord) { String value = String.format("%d", stuCfgRecord.stuRecordPlan.bControlMode); insertRow(tableContent, "录像模式 0-自动,1-手动,2-关闭", value); for(int i=0; i> tableContent, STU_CFG_COM stuCfgCom) { String value = String.format("%d", stuCfgCom.uNums); insertRow(tableContent, "串口数目", value); for(int i=0; i> tableContent, STU_CFG_AUTO_MAINTAIN stuCfgAutoMaintain) { String value = 1 == stuCfgAutoMaintain.bEnable ? "是" : "否"; insertRow(tableContent, "是否使能", value); value = String.format("%d", stuCfgAutoMaintain.uWeekDay); insertRow(tableContent, "周几重启,[0-6],0代表周日,6代表周六", value); value = String.format("%d", stuCfgAutoMaintain.uHour); insertRow(tableContent, "几点重启,[0-23]", value); } private void insertCfgFaceGroupRecResult(Vector> tableContent, STU_CFG_FACE_GROUP_RECOGNIZE_RULES stuCfgFaceGroupRecRules) { String value = String.format("%d", stuCfgFaceGroupRecRules.nRuleCount); insertRow(tableContent, "人脸识别规则实际数目", value); for(int i=0; i> tableContent, STU_CFG_CAPTURE_MODE stuCfgCapMode) { String value = String.format("%d", stuCfgCapMode.nMatchMode); insertRow(tableContent, "抓拍匹配模式,0-非实时匹配,1-实时匹配", value); value = DataUtils.sdk_data_byteArrayToString(stuCfgCapMode.szMode, GlobalTool.getEncodeType()); insertRow(tableContent, "抓拍模式", value); } private void insertCfgSnapTimes(Vector> tableContent, STU_CFG_SNAP_TIMES stuCfgSnapTimes) { String value = String.format("%d", stuCfgSnapTimes.nRuleFaceDetectCapNum); insertRow(tableContent, "人脸检测抓拍张数,-1 表示不设置", value); value = String.format("%d", stuCfgSnapTimes.nRuleTrafficPassCapNum); insertRow(tableContent, "交通卡口抓拍张数,-1 表示不设置", value); } private void insertCfgNetWeb(Vector> tableContent, STU_CFG_NET_WEB stuCfgNetWeb) { String value = String.format("%d", stuCfgNetWeb.uHttpEnable); insertRow(tableContent, "使能开关,0 - 禁用;1 - 开启", value); value = String.format("%d", stuCfgNetWeb.uHttpPort); insertRow(tableContent, "http 端口", value); value = String.format("%d", stuCfgNetWeb.uHttpsEnable); insertRow(tableContent, "使能开关,0 - 禁用;1 - 开启", value); value = String.format("%d", stuCfgNetWeb.uHttpsPort); insertRow(tableContent, "https 端口", value); } private void insertCfgNetRtsp(Vector> tableContent, STU_CFG_NET_RTSP stuCfgNetRtsp) { String value = String.format("%d", stuCfgNetRtsp.nEnable); insertRow(tableContent, "使能开关,0 - 禁用;1 - 开启", value); value = String.format("%d", stuCfgNetRtsp.nRtspPort); insertRow(tableContent, "rtsp 端口", value); value = String.format("%d", stuCfgNetRtsp.nMaxConnectNum); insertRow(tableContent, "最大连接数", value); value = String.format("%d", stuCfgNetRtsp.stuRtp.uStartPort); insertRow(tableContent, "rtp 起始端口", value); value = String.format("%d", stuCfgNetRtsp.stuRtp.uEndPort); insertRow(tableContent, "rtp 结束端口", value); } private void insertCfgNetService(Vector> tableContent, STU_CFG_NET_SERVICE stuCfgNetService) { String value = String.format("%d", stuCfgNetService.uTcpPort); insertRow(tableContent, "数据传输服务 TCP 端口", value); value = String.format("%d", stuCfgNetService.uUdpPort); insertRow(tableContent, "数据传输服务 UDP 端口", value); value = String.format("%d", stuCfgNetService.uMaxConnectNum); insertRow(tableContent, "最大连接数", value); } private void insertCfgNetService(Vector> tableContent, STU_CFG_NET_PORT stuCfgNetPort) { String value = String.format("%d", stuCfgNetPort.uHttpPort); insertRow(tableContent, "http端口", value); value = String.format("%d", stuCfgNetPort.uHttpsPort); insertRow(tableContent, "https端口", value); value = String.format("%d", stuCfgNetPort.uRtspPort); insertRow(tableContent, "rtsp端口", value); value = String.format("%d", stuCfgNetPort.uServerPort); insertRow(tableContent, "server端口", value); } private void insertCfgWifiConfig(Vector> tableContent, STU_CFG_WIFI_CONFIG stuCfgWifiConfig) { String value = 1 == stuCfgWifiConfig.bEnable ? "是" : "否"; insertRow(tableContent, "wifi使能", value); } private void insertCfgWaterMark(Vector> tableContent, STU_CFG_WATER_MARK stuCfgWaterMark) { String value = 1 == stuCfgWaterMark.bEnable ? "是" : "否"; insertRow(tableContent, "是否添加水印", value); value = DataUtils.sdk_data_byteArrayToString(stuCfgWaterMark.szData, GlobalTool.getEncodeType()); insertRow(tableContent, "水印信息", value); value = DataUtils.sdk_data_byteArrayToString(stuCfgWaterMark.szKey, GlobalTool.getEncodeType()); insertRow(tableContent, "水印密钥", value); } private void insertCfgCamera(Vector> tableContent, STU_CFG_CAMERA stuCfgCamera) { String value = String.format("%d", stuCfgCamera.stuDayNightParam.byMode); insertRow(tableContent, "色彩切换模式,0-总是彩色,1-根据亮度或时间自动切换,2-总是黑白", value); value = String.format("%d", stuCfgCamera.stuDayNightParam.byDayNightSensitivity); insertRow(tableContent, "日夜模式切换灵敏度,范围1-3", value); value = String.format("%d", stuCfgCamera.stuDayNightParam.byDayNightSwitchDelay); insertRow(tableContent, "日夜模式切换延迟时间 单位秒,范围2-10", value); value = String.format("%d", stuCfgCamera.stuColor[0].byBrightness); insertRow(tableContent, "白天亮度", value); value = String.format("%d", stuCfgCamera.stuColor[0].byContrast); insertRow(tableContent, "白天对比度", value); value = String.format("%d", stuCfgCamera.stuColor[0].bySaturation); insertRow(tableContent, "白天饱和度", value); value = String.format("%d", stuCfgCamera.stuColor[0].byHue); insertRow(tableContent, "白天色调", value); value = String.format("%d", stuCfgCamera.stuColor[1].byBrightness); insertRow(tableContent, "夜晚亮度", value); value = String.format("%d", stuCfgCamera.stuColor[1].byContrast); insertRow(tableContent, "夜晚对比度", value); value = String.format("%d", stuCfgCamera.stuColor[1].bySaturation); insertRow(tableContent, "夜晚饱和度", value); value = String.format("%d", stuCfgCamera.stuColor[1].byHue); insertRow(tableContent, "夜晚色调", value); value = String.format("%d", stuCfgCamera.stuColor[2].byBrightness); insertRow(tableContent, "其他时段亮度", value); value = String.format("%d", stuCfgCamera.stuColor[2].byContrast); insertRow(tableContent, "其他时段对比度", value); value = String.format("%d", stuCfgCamera.stuColor[2].bySaturation); insertRow(tableContent, "其他时段饱和度", value); value = String.format("%d", stuCfgCamera.stuColor[2].byHue); insertRow(tableContent, "其他时段色调", value); value = 1 == stuCfgCamera.stuIris[0].bIrisAuto ? "是" : "否"; insertRow(tableContent, "白天自动光圈使能", value); value = String.format("%d", stuCfgCamera.stuIris[0].byIrisType); insertRow(tableContent, "白天光圈类型,0-正序光圈P90,1-反序光圈P90,2-DC光圈,3-固定光圈", value); value = String.format("%d", stuCfgCamera.stuIris[0].dwIris); insertRow(tableContent, "白天精确的手动光圈大小", value); value = 1 == stuCfgCamera.stuIris[1].bIrisAuto ? "是" : "否"; insertRow(tableContent, "黑夜自动光圈使能", value); value = String.format("%d", stuCfgCamera.stuIris[1].byIrisType); insertRow(tableContent, "黑夜光圈类型,0-正序光圈P90,1-反序光圈P90,2-DC光圈,3-固定光圈", value); value = String.format("%d", stuCfgCamera.stuIris[1].dwIris); insertRow(tableContent, "黑夜精确的手动光圈大小", value); value = 1 == stuCfgCamera.stuIris[2].bIrisAuto ? "是" : "否"; insertRow(tableContent, "其他时段自动光圈使能", value); value = String.format("%d", stuCfgCamera.stuIris[2].byIrisType); insertRow(tableContent, "其他时段光圈类型,0-正序光圈P90,1-反序光圈P90,2-DC光圈,3-固定光圈", value); value = String.format("%d", stuCfgCamera.stuIris[2].dwIris); insertRow(tableContent, "其他时段精确的手动光圈大小", value); value = String.format("%d", stuCfgCamera.stu3DDenoise.byTridimDenoise); insertRow(tableContent, "是否开启3D降噪,0-关闭,1-开启,2-只开启视频,3-只开启图片", value); value = String.format("%d", stuCfgCamera.stu3DDenoise.byTridimIntensity[0]); insertRow(tableContent, "视频三维降噪时域降噪强度,范围0~100", value); value = String.format("%d", stuCfgCamera.stu3DDenoise.byTridimIntensity[1]); insertRow(tableContent, "图片三维降噪时域降噪强度,范围0~100", value); value = String.format("%d", stuCfgCamera.stu3DDenoise.byTridimIntensitySpatial[0]); insertRow(tableContent, "视频三维降噪空域降噪强度,范围0~100", value); value = String.format("%d", stuCfgCamera.stu3DDenoise.byTridimIntensitySpatial[1]); insertRow(tableContent, "图片三维降噪空域降噪强度,范围0~100", value); value = String.format("%d", stuCfgCamera.stueExposure[0].bGainAuto); insertRow(tableContent, "视频自动增益", value); value = String.format("%d", stuCfgCamera.stueExposure[0].byGainMin); insertRow(tableContent, "视频自动增益下限,范围0~100,小于GainMax", value); value = String.format("%d", stuCfgCamera.stueExposure[0].byGainMax); insertRow(tableContent, "视频自动增益上限,范围0~100", value); value = String.format("%d", stuCfgCamera.stueExposure[0].byGain); insertRow(tableContent, "视频固定增益调节,0~100", value); value = String.format("%d", stuCfgCamera.stueExposure[1].bGainAuto); insertRow(tableContent, "图片流自动增益", value); value = String.format("%d", stuCfgCamera.stueExposure[1].byGainMin); insertRow(tableContent, "图片流自动增益下限,范围0~100,小于GainMax", value); value = String.format("%d", stuCfgCamera.stueExposure[1].byGainMax); insertRow(tableContent, "图片流自动增益上限,范围0~100", value); value = String.format("%d", stuCfgCamera.stueExposure[1].byGain); insertRow(tableContent, "图片流固定增益调节,0~100", value); value = String.format("%d", stuCfgCamera.stueExposure[2].bGainAuto); insertRow(tableContent, "抓拍帧自动增益", value); value = String.format("%d", stuCfgCamera.stueExposure[2].byGainMin); insertRow(tableContent, "抓拍帧自动增益下限,范围0~100,小于GainMax", value); value = String.format("%d", stuCfgCamera.stueExposure[2].byGainMax); insertRow(tableContent, "抓拍帧自动增益上限,范围0~100", value); value = String.format("%d", stuCfgCamera.stueExposure[2].byGain); insertRow(tableContent, "抓拍帧固定增益调节,0~100", value); value = getWhiteBalanceString(stuCfgCamera.stuWhiteBalance[0].emWhiteBalance); insertRow(tableContent, "视频白平衡模式", value); value = String.format("%d", stuCfgCamera.stuWhiteBalance[0].byColorTemperatureLevel); insertRow(tableContent, "视频色温等级调节,白平衡为\"自定义色温等级\"模式下有效 0~255", value); value = String.format("%d", stuCfgCamera.stuWhiteBalance[0].byGainRed); insertRow(tableContent, "视频红色增益调节,白平衡为\"自定义\"模式下有效 0~100", value); value = String.format("%d", stuCfgCamera.stuWhiteBalance[0].byGainBlue); insertRow(tableContent, "视频蓝色增益调节,白平衡为\"自定义\"模式下有效 0~100", value); value = String.format("%d", stuCfgCamera.stuWhiteBalance[0].byGainGreen); insertRow(tableContent, "视频绿色增益调节,白平衡为\"自定义\"模式下有效 0~100", value); value = String.format("%d", stuCfgCamera.stuWhiteBalance[0].byPartWhiteBalanceWeight); insertRow(tableContent, "视频权重参数,用来调整局部白平衡和全局白平衡的权重比例 范围0-100", value); value = getWhiteBalanceString(stuCfgCamera.stuWhiteBalance[1].emWhiteBalance); insertRow(tableContent, "图片流白平衡模式", value); value = String.format("%d", stuCfgCamera.stuWhiteBalance[1].byColorTemperatureLevel); insertRow(tableContent, "图片流色温等级调节,白平衡为\"自定义色温等级\"模式下有效 0~255", value); value = String.format("%d", stuCfgCamera.stuWhiteBalance[1].byGainRed); insertRow(tableContent, "图片流红色增益调节,白平衡为\"自定义\"模式下有效 0~100", value); value = String.format("%d", stuCfgCamera.stuWhiteBalance[1].byGainBlue); insertRow(tableContent, "图片流蓝色增益调节,白平衡为\"自定义\"模式下有效 0~100", value); value = String.format("%d", stuCfgCamera.stuWhiteBalance[1].byGainGreen); insertRow(tableContent, "图片流绿色增益调节,白平衡为\"自定义\"模式下有效 0~100", value); value = String.format("%d", stuCfgCamera.stuWhiteBalance[1].byPartWhiteBalanceWeight); insertRow(tableContent, "图片流权重参数,用来调整局部白平衡和全局白平衡的权重比例 范围0-100", value); value = getWhiteBalanceString(stuCfgCamera.stuWhiteBalance[2].emWhiteBalance); insertRow(tableContent, "抓拍帧白平衡模式", value); value = String.format("%d", stuCfgCamera.stuWhiteBalance[2].byColorTemperatureLevel); insertRow(tableContent, "抓拍帧色温等级调节,白平衡为\"自定义色温等级\"模式下有效 0~255", value); value = String.format("%d", stuCfgCamera.stuWhiteBalance[2].byGainRed); insertRow(tableContent, "抓拍帧红色增益调节,白平衡为\"自定义\"模式下有效 0~100", value); value = String.format("%d", stuCfgCamera.stuWhiteBalance[2].byGainBlue); insertRow(tableContent, "抓拍帧蓝色增益调节,白平衡为\"自定义\"模式下有效 0~100", value); value = String.format("%d", stuCfgCamera.stuWhiteBalance[2].byGainGreen); insertRow(tableContent, "抓拍帧绿色增益调节,白平衡为\"自定义\"模式下有效 0~100", value); value = String.format("%d", stuCfgCamera.stuWhiteBalance[2].byPartWhiteBalanceWeight); insertRow(tableContent, "抓拍帧权重参数,用来调整局部白平衡和全局白平衡的权重比例,范围0-100", value); value = String.format("%d", stuCfgCamera.stuDefog[0].byMode); insertRow(tableContent, "白天透雾模式,0-关闭,1-自动,2-手动", value); value = String.format("%d", stuCfgCamera.stuDefog[0].nValue); insertRow(tableContent, "白天手动模式强度", value); value = String.format("%d", stuCfgCamera.stuDefog[1].byMode); insertRow(tableContent, "黑夜透雾模式,0-关闭,1-自动,2-手动", value); value = String.format("%d", stuCfgCamera.stuDefog[1].nValue); insertRow(tableContent, "黑夜手动模式强度", value); value = String.format("%d", stuCfgCamera.stuDefog[2].byMode); insertRow(tableContent, "其它时段透雾模式,0-关闭,1-自动,2-手动", value); value = String.format("%d", stuCfgCamera.stuDefog[2].nValue); insertRow(tableContent, "其它时段手动模式强度", value); value = String.format("%d", stuCfgCamera.stuMetering.byMode); insertRow(tableContent, "测光类型, 0-全局测光,1-局部测光,2-背光补偿,3-强光抑制", value); value = String.format("%d", stuCfgCamera.stuMetering.byIntensity); insertRow(tableContent, "测光强度,0-关闭,1-弱,2-中,3-强", value); } private String getWhiteBalanceString(int emWhiteBalance) { String str = ""; if(EM_WHITE_BALANCE.WHITEBALANCE_DISABLE == emWhiteBalance) { str = "禁止"; } else if(EM_WHITE_BALANCE.WHITEBALANCE_AUTO == emWhiteBalance) { str = "自动"; } else if(EM_WHITE_BALANCE.WHITEBALANCE_SUNNY == emWhiteBalance) { str = "晴天,7500K左右"; } else if(EM_WHITE_BALANCE.WHITEBALANCE_CLOUDY == emWhiteBalance) { str = "阴天,7500K左右"; } else if(EM_WHITE_BALANCE.WHITEBALANCE_HOME == emWhiteBalance) { str = "家,5000K左右"; } else if(EM_WHITE_BALANCE.WHITEBALANCE_OFFICE == emWhiteBalance) { str = "办公,4400K左右"; } else if(EM_WHITE_BALANCE.WHITEBALANCE_NIGHT == emWhiteBalance) { str = "夜晚,2800K左右"; } else if(EM_WHITE_BALANCE.WHITEBALANCE_CT_HIGH == emWhiteBalance) { str = "高色温区间"; } else if(EM_WHITE_BALANCE.WHITEBALANCE_CT_LOW == emWhiteBalance) { str = "低色温区间"; } else if(EM_WHITE_BALANCE.WHITEBALANCE_CT_AUTO == emWhiteBalance) { str = "自动色温区间"; } else if(EM_WHITE_BALANCE.WHITEBALANCE_CT_CUSTOM == emWhiteBalance) { str = "自定义色温等级"; } else if(EM_WHITE_BALANCE.WHITEBALANCE_PART == emWhiteBalance) { str = "自定义多区域白平衡"; } else { str = "未知"; } return str; } private void insertCfgVideoOsd(Vector> tableContent, STU_CFG_VIDEO_OSD stuCfgVideoOsd) { String value = String.format("%d", stuCfgVideoOsd.byFontSize); insertRow(tableContent, "字体大小 24/32/48...", value); value = String.format("%d", stuCfgVideoOsd.byFontType); insertRow(tableContent, "字体类型 0-宋体 1-楷体 2-雅黑", value); value = 1 == stuCfgVideoOsd.stuChannelOsd.bEnable ? "是" : "否"; insertRow(tableContent, "通道OSD使能", value); value = String.format("%d, %d, %d, %d", stuCfgVideoOsd.stuChannelOsd.stuRect.nLeft, stuCfgVideoOsd.stuChannelOsd.stuRect.nTop, stuCfgVideoOsd.stuChannelOsd.stuRect.nRight, stuCfgVideoOsd.stuChannelOsd.stuRect.nBottom); insertRow(tableContent, "通道OSD显示位置【0-8192】坐标系", value); value = DataUtils.sdk_data_byteArrayToString(stuCfgVideoOsd.stuChannelOsd.szText, GlobalTool.getEncodeType()); insertRow(tableContent, "通道OSD标题", value); value = 1 == stuCfgVideoOsd.stuTimeOsd.bEnable ? "是" : "否"; insertRow(tableContent, "时间OSD使能", value); value = 1 == stuCfgVideoOsd.stuTimeOsd.bShowWeek ? "是" : "否"; insertRow(tableContent, "时间OSD使能", value); value = String.format("%d, %d, %d, %d", stuCfgVideoOsd.stuTimeOsd.stuRect.nLeft, stuCfgVideoOsd.stuTimeOsd.stuRect.nTop, stuCfgVideoOsd.stuTimeOsd.stuRect.nRight, stuCfgVideoOsd.stuTimeOsd.stuRect.nBottom); insertRow(tableContent, "时间OSD显示位置【0-8192】坐标系", value); value = String.format("%d", stuCfgVideoOsd.nRealCustomOsdCount); insertRow(tableContent, "自定义OSD个数", value); for(int i=0; i> tableContent, STU_CFG_STORAGE stuCfgStorage) { String value = 1 == stuCfgStorage.stuStorPoint[0].bSupportFtp ? "是" : "否"; insertRow(tableContent, "录像支持ftp", value); value = 1 == stuCfgStorage.stuStorPoint[0].bSupportLocal ? "是" : "否"; insertRow(tableContent, "录像支持本地", value); value = 1 == stuCfgStorage.stuStorPoint[0].bSupportUsb ? "是" : "否"; insertRow(tableContent, "录像支持usb", value); value = 1 == stuCfgStorage.stuStorPoint[1].bSupportFtp ? "是" : "否"; insertRow(tableContent, "抓图支持ftp", value); value = 1 == stuCfgStorage.stuStorPoint[1].bSupportLocal ? "是" : "否"; insertRow(tableContent, "抓图支持本地", value); value = 1 == stuCfgStorage.stuStorPoint[1].bSupportUsb ? "是" : "否"; insertRow(tableContent, "抓图支持usb", value); value = 1 == stuCfgStorage.stuStoragePolicy.bOverWrite ? "是" : "否"; insertRow(tableContent, "存储空间是否满覆盖", value); value = 1 == stuCfgStorage.stuStoragePolicy.bEmergenceStorage ? "是" : "否"; insertRow(tableContent, "是否紧急存储,否为使用本地存储", value); } private void insertCfgNetStorageTrans(Vector> tableContent, STU_CFG_NET_STORAGE_TRANS stuCfgNetStorageTrans) { String value = String.format("%d", stuCfgNetStorageTrans.uItemCount); insertRow(tableContent, "网络存储配置个数", value); for(int i=0; i> tableContent, STU_CFG_TELNET stuCfgTelnet) { String value = 1 == stuCfgTelnet.bEnable ? "是" : "否"; insertRow(tableContent, "Telnet使能", value); } private void insertCfgLog(Vector> tableContent, STU_CFG_LOG stuCfgLog) { String value = DataUtils.sdk_data_byteArrayToString(stuCfgLog.stuSearchCondition.cStartTime, GlobalTool.getEncodeType()); insertRow(tableContent, "日志查询开始时间", value); value = DataUtils.sdk_data_byteArrayToString(stuCfgLog.stuSearchCondition.cEndTime, GlobalTool.getEncodeType()); insertRow(tableContent, "日志查询结束时间", value); value = DataUtils.sdk_data_byteArrayToString(stuCfgLog.stuSearchCondition.cMainType, GlobalTool.getEncodeType()); insertRow(tableContent, "主日志类型,空则查询所有主类型", value); value = DataUtils.sdk_data_byteArrayToString(stuCfgLog.stuSearchCondition.cSubType, GlobalTool.getEncodeType()); insertRow(tableContent, "次日志类型,空则查询所有子类型", value); value = String.format("%d", stuCfgLog.stuLogResult.uTotal); insertRow(tableContent, "查询到的总共的日志条数", value); value = String.format("%d", stuCfgLog.stuLogResult.uCurAmount); insertRow(tableContent, "当前返回的日志条数", value); for(int i=0; i> tableContent, STU_CFG_NET_WB_INFO stuCfgNetWbInfo) { String value = String.format("%d", stuCfgNetWbInfo.bType); insertRow(tableContent, "黑白名单类型:0-无;1-黑名单,2-白名单", value); value = String.format("%d", stuCfgNetWbInfo.uIPv4Count); insertRow(tableContent, "IPv4 黑白名单信息个数", value); for(int i=0; i> tableContent, STU_CFG_USER_GET stuCfgUser) { String value = String.format("%d", stuCfgUser.uActualCount); insertRow(tableContent, "需要获取的用户个数", value); for(int i=0; i> tableContent, STU_CFG_USER_ONLINE_ITEMS stuCfgUserOnlineItems) { String value = String.format("%d", stuCfgUserOnlineItems.uActualCount); insertRow(tableContent, "需要获取的用户个数", value); for(int i=0; i> tableContent, STU_CFG_SNAP_CUTOUT stuCfgSnapCutout) { String value = 1 == stuCfgSnapCutout.bEnable ? "是" : "否"; insertRow(tableContent, "抠图配置使能", value); value = String.format("%d", stuCfgSnapCutout.nType); insertRow(tableContent, "抠图配置类型,-1 表示无效; 0是人脸抠图; 1是半身抠图; 2是全身抠图; 3是车牌抠图", value); } private void insertCfgOverlapPic(Vector> tableContent, STU_CFG_OVERLAP_PIC stuCfgOverlapPic) { String value = 1 == stuCfgOverlapPic.stuOverLap.bMajorStreamIntelliTrack ? "是" : "否"; insertRow(tableContent, "是否叠加跟踪信息", value); value = 1 == stuCfgOverlapPic.stuOverLap.bMajorStreamDebug ? "是" : "否"; insertRow(tableContent, "是否叠加调试信息", value); value = 1 == stuCfgOverlapPic.stuGrapPic.bPictureUpload ? "是" : "否"; insertRow(tableContent, "是否显示背景图", value); } private void insertCfgIntelliSceneFaceDetect(Vector> tableContent, STU_CFG_INTELLI_SCENE_FACE_DETECT stuCfgIntelliSceneFaceDetect) { String value = DataUtils.sdk_data_byteArrayToString(stuCfgIntelliSceneFaceDetect.szClass, GlobalTool.getEncodeType()); insertRow(tableContent, "业务大类, 不可设置", value); value = DataUtils.sdk_data_byteArrayToString(stuCfgIntelliSceneFaceDetect.szAlgorithm, GlobalTool.getEncodeType()); insertRow(tableContent, "算法版本,不可设置", value); value = String.format("%d", stuCfgIntelliSceneFaceDetect.stuParam.nFaceSize); insertRow(tableContent, "抓拍人脸的最小像素", value); value = String.format("%d", stuCfgIntelliSceneFaceDetect.stuParam.nAnalyseInterval); insertRow(tableContent, "算法处理间隔, 单位 ms,范围 0-2000,0 表示不作限制", value); value = String.format("%d", stuCfgIntelliSceneFaceDetect.stuParam.nAnalyseCount); insertRow(tableContent, "满足过滤阈值的最大处理次数,范围 0-20", value); value = String.format("%f", stuCfgIntelliSceneFaceDetect.stuParam.fPoseRoll); insertRow(tableContent, "最大转头角度;roll 角度", value); value = String.format("%f", stuCfgIntelliSceneFaceDetect.stuParam.fPosePitch); insertRow(tableContent, "最大点头角度;picth 角度", value); value = String.format("%f", stuCfgIntelliSceneFaceDetect.stuParam.fPoseYaw); insertRow(tableContent, "最大摇头角度;yaw 角度", value); value = String.format("%f", stuCfgIntelliSceneFaceDetect.stuParam.fBlurThreshold); insertRow(tableContent, "抓拍人脸的模糊程度约束", value); value = String.format("%d, %d, %d, %d", stuCfgIntelliSceneFaceDetect.stuParam.stuDetectRect.nLeft, stuCfgIntelliSceneFaceDetect.stuParam.stuDetectRect.nTop, stuCfgIntelliSceneFaceDetect.stuParam.stuDetectRect.nRight, stuCfgIntelliSceneFaceDetect.stuParam.stuDetectRect.nBottom); insertRow(tableContent, "人脸检测区域 [0-8192]坐标系", value); } private void insertCfgIntelliRuleFaceDetect(Vector> tableContent, STU_CFG_INTELLI_RULE_FACE_DETECT stuCfgIntelliRuleFaceDetect) { String value = 1 == stuCfgIntelliRuleFaceDetect.bEnable ? "是" : "否"; insertRow(tableContent, "人脸检测规则使能", value); value = DataUtils.sdk_data_byteArrayToString(stuCfgIntelliRuleFaceDetect.szClass, GlobalTool.getEncodeType()); insertRow(tableContent, "业务大类, 不可设置", value); value = DataUtils.sdk_data_byteArrayToString(stuCfgIntelliRuleFaceDetect.szType, GlobalTool.getEncodeType()); insertRow(tableContent, "业务小类, 不可设置", value); value = DataUtils.sdk_data_byteArrayToString(stuCfgIntelliRuleFaceDetect.szName, GlobalTool.getEncodeType()); insertRow(tableContent, "规则名称, 不可设置", value); value = 1 == stuCfgIntelliRuleFaceDetect.stuConfig.bRecogniseFace ? "是" : "否"; insertRow(tableContent, "是否需要识别属性", value); value = String.format("%d", stuCfgIntelliRuleFaceDetect.stuConfig.nSnapInterval); insertRow(tableContent, "抓拍间隔,单位 ms", value); value = String.format("%d", stuCfgIntelliRuleFaceDetect.stuConfig.nQualityThreshold); insertRow(tableContent, "质量阈值 [0-100],小于阈值的图片会被过滤", value); value = 1 == stuCfgIntelliRuleFaceDetect.stuEventHandler.bRecordEnable ? "是" : "否"; insertRow(tableContent, "视频分析联动 录像使能", value); value = String.format("%d", stuCfgIntelliRuleFaceDetect.stuEventHandler.nRecordLatch); insertRow(tableContent, "视频分析联动 预录时间 [10s-300s],单位:秒", value); value = String.format("%d", stuCfgIntelliRuleFaceDetect.stuEventHandler.nRecordChannelNum); insertRow(tableContent, "视频分析联动 实际录像通道个数", value); value = 1 == stuCfgIntelliRuleFaceDetect.stuEventHandler.bAlarmOutEnable ? "是" : "否"; insertRow(tableContent, "视频分析联动 报警输出使能", value); value = String.format("%d", stuCfgIntelliRuleFaceDetect.stuEventHandler.nAlarmOutLatch); insertRow(tableContent, "视频分析联动 报警输入停止后,输出延时时间 [1s,300s],单位:秒", value); value = String.format("%d", stuCfgIntelliRuleFaceDetect.stuEventHandler.nAlarmOutChannelNum); insertRow(tableContent, "视频分析联动 实际报警输出通道个数", value); value = 1 == stuCfgIntelliRuleFaceDetect.stuEventHandler.bCaptureEnable ? "是" : "否"; insertRow(tableContent, "视频分析联动 抓图使能", value); value = String.format("%d", stuCfgIntelliRuleFaceDetect.stuEventHandler.nCapturePreRecordTime); insertRow(tableContent, "视频分析联动 图片关联录像的预录时间,不能大于通用的预录时间,单位:秒", value); value = String.format("%d", stuCfgIntelliRuleFaceDetect.stuEventHandler.nCaptureChannelNum); insertRow(tableContent, "视频分析联动 实际抓图通道数", value); } private void insertCfgIntelliRuleFaceSta(Vector> tableContent, STU_CFG_INTELLI_RULE_FACE_STATISTIC stuCfgIntelliRuleFaceSta) { String value = 1 == stuCfgIntelliRuleFaceSta.bEnable ? "是" : "否"; insertRow(tableContent, "人脸检测统计规则使能", value); value = DataUtils.sdk_data_byteArrayToString(stuCfgIntelliRuleFaceSta.szClass, GlobalTool.getEncodeType()); insertRow(tableContent, "业务大类, 不可设置", value); value = DataUtils.sdk_data_byteArrayToString(stuCfgIntelliRuleFaceSta.szType, GlobalTool.getEncodeType()); insertRow(tableContent, "业务小类, 不可设置", value); value = DataUtils.sdk_data_byteArrayToString(stuCfgIntelliRuleFaceSta.szName, GlobalTool.getEncodeType()); insertRow(tableContent, "规则名称, 不可设置", value); value = String.format("%d", stuCfgIntelliRuleFaceSta.stuConfig.nInterval); insertRow(tableContent, "统计周期, 单位 s", value); } private void insertCfgAlarmParam(Vector> tableContent, STU_CFG_ALARM_PARAM stuCfgAlarmParam) { String value = String.format("%d", stuCfgAlarmParam.uAlarmInChannels); insertRow(tableContent, "报警输入通道数", value); for(int i=0; i> tableContent, STU_CFG_ENCODE_PARAM stuCfgEncodeParam) { int nMaxCnt = stuCfgEncodeParam.stuEncodeConfig.uMainStreamNums; String value = String.format("%d", nMaxCnt); insertRow(tableContent, "主码流个数", value); insertCfrEncodeInfoRow(tableContent, stuCfgEncodeParam.stuEncodeConfig.stuMainStreamEncodeConfig, nMaxCnt, "主码流"); nMaxCnt = stuCfgEncodeParam.stuEncodeConfig.uExtraStreamNums; value = String.format("%d", nMaxCnt); insertRow(tableContent, "辅码流个数", value); insertCfrEncodeInfoRow(tableContent, stuCfgEncodeParam.stuEncodeConfig.stuExtraStreamEncodeConfig, nMaxCnt, "辅码流"); nMaxCnt = stuCfgEncodeParam.stuEncodeConfig.uCaptureStreamNums; value = String.format("%d", nMaxCnt); insertRow(tableContent, "抓图码流个数", value); insertCfrEncodeInfoRow(tableContent, stuCfgEncodeParam.stuEncodeConfig.stuCaptureStreamEncodeConfig, nMaxCnt, "抓图码流"); } private void insertCfrEncodeInfoRow( Vector> tableContent, STU_CFG_ENCODE_CONFIG_PARAM[] stuCfgEncodeCfgParamList, int nMaxCnt, String strStreamType) { for(int i=0; i> tableContent, STU_CFG_GB28181_PARAM stuCfgGB28181Param) { String value = 1 == stuCfgGB28181Param.bEnable ? "是" : "否"; insertRow(tableContent, "GB28181 配置参数 使能", value); value = String.format("%d", stuCfgGB28181Param.uAlarmInChannelNum); insertRow(tableContent, "报警输入通道数", value); value = DataUtils.sdk_data_byteArrayToString(stuCfgGB28181Param.cAlarmInId, GlobalTool.getEncodeType()); insertRow(tableContent, "报警输入通道编号", value); value = String.format("%d", stuCfgGB28181Param.uChannelNum); insertRow(tableContent, "通道总数", value); value = DataUtils.sdk_data_byteArrayToString(stuCfgGB28181Param.cChannelId, GlobalTool.getEncodeType()); insertRow(tableContent, "通道编号", value); value = DataUtils.sdk_data_byteArrayToString(stuCfgGB28181Param.cCivilCode, GlobalTool.getEncodeType()); insertRow(tableContent, "行政区识别码", value); value = DataUtils.sdk_data_byteArrayToString(stuCfgGB28181Param.cUserName, GlobalTool.getEncodeType()); insertRow(tableContent, "用户名,即设备id", value); value = DataUtils.sdk_data_byteArrayToString(stuCfgGB28181Param.cPassword, GlobalTool.getEncodeType()); insertRow(tableContent, "注册密码", value); value = String.format("%d", stuCfgGB28181Param.uKeepAliveInterval); insertRow(tableContent, "心跳时间间隔", value); value = String.format("%d", stuCfgGB28181Param.uLocalSipPort); insertRow(tableContent, "本地sip端口号", value); value = String.format("%d", stuCfgGB28181Param.uMaxTimeoutCount); insertRow(tableContent, "最大心跳超时时间", value); value = DataUtils.sdk_data_byteArrayToString(stuCfgGB28181Param.cSipDomain, GlobalTool.getEncodeType()); insertRow(tableContent, "域名", value); value = DataUtils.sdk_data_byteArrayToString(stuCfgGB28181Param.cSipServerId, GlobalTool.getEncodeType()); insertRow(tableContent, "SIP 服务器 ID", value); value = DataUtils.sdk_data_byteArrayToString(stuCfgGB28181Param.cSipServerIP, GlobalTool.getEncodeType()); insertRow(tableContent, "SIP 服务器 IP", value); value = String.format("%d", stuCfgGB28181Param.uSipServerPort); insertRow(tableContent, "SIP 服务器端口", value); } private void insertCfgOnvif(Vector> tableContent, STU_CFG_ONVIF stuCfgOnvif) { String value = 1 == stuCfgOnvif.bEnable ? "是" : "否"; insertRow(tableContent, "ONVIF 使能", value); } private void insertCfgCloudService(Vector> tableContent, STU_CFG_CLOUD_SERVICE stuCfgCloudService) { String value = 1 == stuCfgCloudService.bEnable ? "是" : "否"; insertRow(tableContent, "云服务 使能", value); value = String.format("%d", stuCfgCloudService.uPort); insertRow(tableContent, "服务端口", value); value = DataUtils.sdk_data_byteArrayToString(stuCfgCloudService.szAddress, GlobalTool.getEncodeType()); insertRow(tableContent, "服务地址、域名", value); } private void insertCfgZkService(Vector> tableContent, STU_CFG_ZK_SERVICE stuCfgZkService) { String value = String.format("%d", stuCfgZkService.uRealCount); insertRow(tableContent, "ZK服务配置个数", value); for(int i=0; i= i+1){ arr[i] = newArr[i]; }else { arr[i] = 0; } } return arr; } private Pointer createStuCfgStorage(IntByReference inBufferSize) { STU_CFG_STORAGE stuCfgStorage = (STU_CFG_STORAGE) m_curStuObj; int nNewValue = (stuCfgStorage.stuStorPoint[0].bSupportFtp + 1) % 2; stuCfgStorage.stuStorPoint[0].bSupportFtp = nNewValue; nNewValue = (stuCfgStorage.stuStorPoint[0].bSupportLocal + 1) % 2; stuCfgStorage.stuStorPoint[0].bSupportLocal = nNewValue; nNewValue = (stuCfgStorage.stuStorPoint[0].bSupportUsb + 1) % 2; stuCfgStorage.stuStorPoint[0].bSupportUsb = nNewValue; /* * * * */ inBufferSize.setValue(stuCfgStorage.size()); Pointer ptrInBuffer = DataUtils.sdk_data_createPtr(inBufferSize.getValue()); DataUtils.sdk_data_structureToPtr(stuCfgStorage, ptrInBuffer, 0); return ptrInBuffer; } private Pointer createStuCfgVideoOsd(IntByReference inBufferSize) { STU_CFG_VIDEO_OSD stuCfgVideoOsd = (STU_CFG_VIDEO_OSD) m_curStuObj; int nNewValue = (stuCfgVideoOsd.byFontType + 1) % 3; stuCfgVideoOsd.byFontType = (byte) nNewValue; nNewValue = (stuCfgVideoOsd.stuChannelOsd.bEnable + 1) % 2; stuCfgVideoOsd.stuChannelOsd.bEnable = nNewValue; if(1 == nNewValue) { stuCfgVideoOsd.stuChannelOsd.stuRect.nLeft = 50; stuCfgVideoOsd.stuChannelOsd.stuRect.nTop = 50; stuCfgVideoOsd.stuChannelOsd.stuRect.nRight = 90; stuCfgVideoOsd.stuChannelOsd.stuRect.nBottom = 90; } else { stuCfgVideoOsd.stuChannelOsd.stuRect.nLeft = 0; stuCfgVideoOsd.stuChannelOsd.stuRect.nTop = 8191; stuCfgVideoOsd.stuChannelOsd.stuRect.nRight = 0; stuCfgVideoOsd.stuChannelOsd.stuRect.nBottom = 8191; } /* * * * */ inBufferSize.setValue(stuCfgVideoOsd.size()); Pointer ptrInBuffer = DataUtils.sdk_data_createPtr(inBufferSize.getValue()); DataUtils.sdk_data_structureToPtr(stuCfgVideoOsd, ptrInBuffer, 0); return ptrInBuffer; } private Pointer createStuCfgCamera(IntByReference inBufferSize) { STU_CFG_CAMERA stuCfgCamera = (STU_CFG_CAMERA) m_curStuObj; int nNewValue = (stuCfgCamera.stuDayNightParam.byMode + 1) % 3; stuCfgCamera.stuDayNightParam.byMode = (byte) nNewValue; stuCfgCamera.stuDayNightParam.byDayNightSensitivity = 3; stuCfgCamera.stuDayNightParam.byDayNightSwitchDelay = 9; stuCfgCamera.stuColor[0].byBrightness = 50; nNewValue = (stuCfgCamera.stuIris[0].bIrisAuto + 1) % 2; stuCfgCamera.stuIris[0].bIrisAuto = (byte) nNewValue; nNewValue = (stuCfgCamera.stu3DDenoise.byTridimDenoise + 1) % 4; stuCfgCamera.stu3DDenoise.byTridimDenoise = (byte) nNewValue; /* * * * */ inBufferSize.setValue(stuCfgCamera.size()); Pointer ptrInBuffer = DataUtils.sdk_data_createPtr(inBufferSize.getValue()); DataUtils.sdk_data_structureToPtr(stuCfgCamera, ptrInBuffer, 0); return ptrInBuffer; } private Pointer createStuCfgWaterMark(IntByReference inBufferSize) { STU_CFG_WATER_MARK stuCfgWaterMark = (STU_CFG_WATER_MARK) m_curStuObj; int nNewValue = (stuCfgWaterMark.bEnable + 1) % 2; stuCfgWaterMark.bEnable = nNewValue; /* * * * */ inBufferSize.setValue(stuCfgWaterMark.size()); Pointer ptrInBuffer = DataUtils.sdk_data_createPtr(inBufferSize.getValue()); DataUtils.sdk_data_structureToPtr(stuCfgWaterMark, ptrInBuffer, 0); return ptrInBuffer; } private Pointer createStuCfgWifiEnale(IntByReference inBufferSize) { STU_CFG_WIFI_CONFIG stuCfgWifiConfig = (STU_CFG_WIFI_CONFIG) m_curStuObj; int nNewValue = (stuCfgWifiConfig.bEnable + 1) % 2; stuCfgWifiConfig.bEnable = nNewValue; /* * * * */ inBufferSize.setValue(stuCfgWifiConfig.size()); Pointer ptrInBuffer = DataUtils.sdk_data_createPtr(inBufferSize.getValue()); DataUtils.sdk_data_structureToPtr(stuCfgWifiConfig, ptrInBuffer, 0); return ptrInBuffer; } private Pointer createStuCfgNetPort(IntByReference inBufferSize) { STU_CFG_NET_PORT stuCfgNetPort = (STU_CFG_NET_PORT) m_curStuObj; /* * * * */ inBufferSize.setValue(stuCfgNetPort.size()); Pointer ptrInBuffer = DataUtils.sdk_data_createPtr(inBufferSize.getValue()); DataUtils.sdk_data_structureToPtr(stuCfgNetPort, ptrInBuffer, 0); return ptrInBuffer; } private Pointer createStuCfgNetService(IntByReference inBufferSize) { STU_CFG_NET_SERVICE stuCfgNetService = (STU_CFG_NET_SERVICE) m_curStuObj; /* * * * */ inBufferSize.setValue(stuCfgNetService.size()); Pointer ptrInBuffer = DataUtils.sdk_data_createPtr(inBufferSize.getValue()); DataUtils.sdk_data_structureToPtr(stuCfgNetService, ptrInBuffer, 0); return ptrInBuffer; } private Pointer createStuCfgRtsp(IntByReference inBufferSize) { STU_CFG_NET_RTSP stuCfgNetRtsp = (STU_CFG_NET_RTSP) m_curStuObj; if(1 == stuCfgNetRtsp.nEnable) { stuCfgNetRtsp.nRtspPort = 554; stuCfgNetRtsp.nMaxConnectNum = 15; stuCfgNetRtsp.stuRtp.uStartPort = 20000; stuCfgNetRtsp.stuRtp.uEndPort = 40000; } /* * * * */ inBufferSize.setValue(stuCfgNetRtsp.size()); Pointer ptrInBuffer = DataUtils.sdk_data_createPtr(inBufferSize.getValue()); DataUtils.sdk_data_structureToPtr(stuCfgNetRtsp, ptrInBuffer, 0); return ptrInBuffer; } private Pointer createStuCfgWeb(IntByReference inBufferSize) { STU_CFG_NET_WEB stuCfgNetWeb = (STU_CFG_NET_WEB) m_curStuObj; if(1 == stuCfgNetWeb.uHttpEnable) { stuCfgNetWeb.uHttpPort = 80; } /* * * * */ inBufferSize.setValue(stuCfgNetWeb.size()); Pointer ptrInBuffer = DataUtils.sdk_data_createPtr(inBufferSize.getValue()); DataUtils.sdk_data_structureToPtr(stuCfgNetWeb, ptrInBuffer, 0); return ptrInBuffer; } private Pointer createStuCfgSnapTimes(IntByReference inBufferSize) { STU_CFG_SNAP_TIMES stuCfgSnapTimes = (STU_CFG_SNAP_TIMES) m_curStuObj; if(1 == stuCfgSnapTimes.nRuleFaceDetectCapNum) stuCfgSnapTimes.nRuleFaceDetectCapNum = 5; else stuCfgSnapTimes.nRuleFaceDetectCapNum = 1; if(1 == stuCfgSnapTimes.nRuleTrafficPassCapNum) stuCfgSnapTimes.nRuleTrafficPassCapNum = 5; else stuCfgSnapTimes.nRuleTrafficPassCapNum = 1; /* * * * */ inBufferSize.setValue(stuCfgSnapTimes.size()); Pointer ptrInBuffer = DataUtils.sdk_data_createPtr(inBufferSize.getValue()); DataUtils.sdk_data_structureToPtr(stuCfgSnapTimes, ptrInBuffer, 0); return ptrInBuffer; } private Pointer createStuCfgCaptureMode(IntByReference inBufferSize) { STU_CFG_CAPTURE_MODE stuCfgCapMode = (STU_CFG_CAPTURE_MODE) m_curStuObj; int nNewValue = (stuCfgCapMode.nMatchMode + 1) % 2; stuCfgCapMode.nMatchMode = nNewValue; String strMode = DataUtils.sdk_data_byteArrayToString(stuCfgCapMode.szMode, GlobalTool.getEncodeType()); for(int i=0; i curSelIndex) return false; this.m_tableModel.setRowCount(0); int command = m_mapIndexToCfgType.get(curSelIndex); IntByReference outBufferSize = new IntByReference(0); Pointer ptrOutBuffer = initStuData(command, outBufferSize); IntByReference nReturnSize = new IntByReference(0); if(null == ptrOutBuffer) return false; boolean bResult = NetLib.instance.Net_GetDeviceCfg( m_loginID, command, 0, ptrOutBuffer, outBufferSize.getValue(), nReturnSize, 6000); if(!bResult) { int error = NetLib.instance.Net_LastError(); String strError = String.format("Net_GetDeviceCfg fail, command = %d, errorCode = %d", command, error); System.out.println(strError); return false; } displayParsedData(command, ptrOutBuffer); return true; } private boolean setDeviceCfg() { if(-1 == this.m_list_cfg_type.getSelectedIndex()) return false; int nCommand = m_mapIndexToCfgType.get(this.m_list_cfg_type.getSelectedIndex()); IntByReference inBufferSize = new IntByReference(0); Pointer ptrInBuffer = createStuBuffer(nCommand, inBufferSize); if(null == ptrInBuffer) return false; System.out.println("ptrInBuffer="+JSON.toJSON(ptrInBuffer).toString()); System.out.println("inBufferSize="+ inBufferSize.getValue()); boolean bResult = NetLib.instance.Net_SetDeviceCfg( m_loginID, nCommand, 0, ptrInBuffer, inBufferSize.getValue(), 6000); if(!bResult) { int error = NetLib.instance.Net_LastError(); String strError = String.format("Net_SetDeviceCfg fail, command = %d, errorCode = %d", nCommand, error); System.out.println(strError); return false; } getDeviceCfg(); return true; } //////////////////////////////////////////////////////////////////////////////////////////////////////////// private boolean onBtnLogin() { if(checkParams()) { int nPort = Integer.parseInt(m_jtf_port.getText()); IntByReference nError = new IntByReference(0); this.m_loginID = NetLib.instance.Net_LoginDevice(m_jtf_ip.getText(), nPort, m_jtf_username.getText(), m_jtf_password.getText(), null, nError); if(0 == this.m_loginID.longValue()) { JOptionPane.showMessageDialog(null, "登陆失败", "提示", JOptionPane.ERROR_MESSAGE); int error = NetLib.instance.Net_LastError(); String strError = String.format("Net_LoginDevice fail, errorCode = %d", error); System.out.println(strError); setNotifyInfo("登陆失败"); return false; } setNotifyInfo("登陆成功"); // 添加 addListItems(); refreshEnables(); } return true; } private void onBtnLogout() { if(0 != this.m_loginID.longValue()) { boolean bResult = NetLib.instance.Net_LogoutDevice(this.m_loginID); if(!bResult) { int error = NetLib.instance.Net_LastError(); String strError = String.format("Net_GetAllFaceGroups fail, errorCode = %d", error); System.out.println(strError); setNotifyInfo("登出失败"); return; } setNotifyInfo("登出成功"); this.m_loginID = new NativeLong(0); this.m_list_cfg_type.setSelectedIndex(-1); this.m_list_cfg_type.setListData(new Vector()); refreshEnables(); } } private void onBtnRefreshCfgTypeList() { if(getDeviceCfg()) { setNotifyInfo("查询成功"); } else { setNotifyInfo("查询失败"); } } private void onBtnSet() { if(setDeviceCfg()) { setNotifyInfo("设置成功"); } else { setNotifyInfo("设置失败"); } } /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @Override public void actionPerformed(ActionEvent e) { Object obj = e.getSource(); if(obj == this.m_btn_login) { onBtnLogin(); } else if(obj == this.m_btn_logout) { onBtnLogout(); } else if(obj == this.m_btn_refresh) { onBtnRefreshCfgTypeList(); } else if(obj == this.m_btn_set) { onBtnSet(); } } @Override public void valueChanged(ListSelectionEvent e) { Object obj = e.getSource(); if(obj == this.m_list_cfg_type && this.m_list_cfg_type.getValueIsAdjusting()) { onBtnRefreshCfgTypeList(); } } /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /** * Launch the application. */ public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { run_device_cfg window = new run_device_cfg(); window.m_frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } ////////////////////////////////////////////////////////// public void startCfg(){ String strIp="192.168.1.64"; int nPort= 27778; String strUsername="admin"; String strPassword="admin123"; String strDevSN="8R23R300003"; IntByReference nError = new IntByReference(0); NativeLong loginID = NetLib.instance.Net_LoginDevice(strIp, nPort, strUsername, strPassword, null, nError); System.out.println("loginID = "+loginID); //bRealtimeEnable为0时 bOfflineEnable只能为0 int bRealtimeEnable = 0; int bOfflineEnable = 0; String szAddress = "192.168.1.1"; int uFtpPort = 22; String szUserName = "test"; String szPassword = "test123"; boolean result = setDeviceFtpCfg(loginID, bRealtimeEnable, bOfflineEnable, szAddress, uFtpPort, szUserName, szPassword,""); System.out.println("result = " + result); } public Map getLigntCfg(NativeLong loginID){ int nCommand = EM_DEVICE_CFG_TYPE.DEVICE_CFG_SOC_CONSTANT_LAMP; NetStructs.STU_CFG_SOC_CONSTANT_LAMP_PARAM cfgSupplementLightItem = getCfgSupplementLightItem(loginID,nCommand); NetStructs.STU_CFG_SOC_CONSTANT_LAMP_ITEM item = cfgSupplementLightItem.stSOCLamps[0]; System.out.println(JSON.toJSON(item).toString()); // 工作模式 EM_DEV_SUP_LIGHT_MODE (0-强制关闭 1-强制开启 2-自动 3-自动时间) int emMode = item.emMode; //亮度预设值,取值范围为0~100,无光敏时使用 int nPreValue = item.nPreValue; // 常亮灯亮度,范围[0, 100] int nBrightness = item.nBrightness; NetStructs.STU_TIME_SECTION_SCHEDULE timeInterval = item.stuWeekTimeSection.stuTimeDay[0].stuTimeSection[0]; NetStructs.STU_TIME_SECTION_SCHEDULE timeInterval2 = item.stuWeekTimeSection.stuTimeDay[0].stuTimeSection[1]; int isEnable = timeInterval.bValue; int startHour = timeInterval.nStartHour; int startMinute = timeInterval.nStartMinute; int startSecond = timeInterval.nStartSecond; int endHour = timeInterval.nEndHour; int endMinute = timeInterval.nEndMinute; int endSecond = timeInterval.nEndSecond; int isEnable2 = timeInterval2.bValue; int startHour2 = timeInterval2.nStartHour; int startMinute2 = timeInterval2.nStartMinute; int startSecond2 = timeInterval2.nStartSecond; int endHour2 = timeInterval2.nEndHour; int endMinute2 = timeInterval2.nEndMinute; int endSecond2 = timeInterval2.nEndSecond; System.out.println("emMode="+emMode); System.out.println("nPreValue="+nPreValue); System.out.println("nBrightness="+nBrightness); System.out.println("isEnable="+isEnable); System.out.println("startHour="+startHour); System.out.println("startMinute="+startMinute); System.out.println("startSecond="+startSecond); System.out.println("endHour="+endHour); System.out.println("endMinute="+endMinute); System.out.println("endSecond="+endSecond); Map map = new HashMap<>(); map.put("emMode",emMode); map.put("nPreValue",nPreValue); map.put("nBrightness",nBrightness); map.put("isEnable",isEnable); map.put("startHour",startHour); map.put("startMinute",startMinute); map.put("startSecond",startSecond); map.put("endHour",endHour); map.put("endMinute",endMinute); map.put("endSecond",endSecond); map.put("isEnable2",isEnable2); map.put("startHour2",startHour2); map.put("startMinute2",startMinute2); map.put("startSecond2",startSecond2); map.put("endHour2",endHour2); map.put("endMinute2",endMinute2); map.put("endSecond2",endSecond2); return map; } /** * * @param loginID 登录id * @param emMode 工作模式 EM_DEV_SUP_LIGHT_MODE * @param nPreValue 亮度预设值,取值范围为0~100,无光敏时使用 * @param nBrightness 常亮灯亮度,范围[0, 100] * @param startTime 开始时间 时:分:秒 * @param endTime 结束时间 时:分:秒 */ public boolean setLightCfg(NativeLong loginID,int emMode,int nPreValue,int nBrightness,String startTime , String endTime,String startTime2,String endTime2){ //10:10:11 int startHour = Integer.parseInt(startTime.substring(0,2)); int startMinute = Integer.parseInt(startTime.substring(3,5)); int startSecond = Integer.parseInt(startTime.substring(6,8)); int endHour = Integer.parseInt(endTime.substring(0,2)); int endMinute = Integer.parseInt(endTime.substring(3,5)); int endSecond = Integer.parseInt(endTime.substring(6,8)); int startHour2 = Integer.parseInt(startTime2.substring(0,2)); int startMinute2 = Integer.parseInt(startTime2.substring(3,5)); int startSecond2 = Integer.parseInt(startTime2.substring(6,8)); int endHour2 = Integer.parseInt(endTime2.substring(0,2)); int endMinute2 = Integer.parseInt(endTime2.substring(3,5)); int endSecond2 = Integer.parseInt(endTime2.substring(6,8)); int nCommand = EM_DEVICE_CFG_TYPE.DEVICE_CFG_SOC_CONSTANT_LAMP; NetStructs.STU_CFG_SOC_CONSTANT_LAMP_PARAM cfgSupplementLightItem = getCfgSupplementLightItem(loginID,nCommand); cfgSupplementLightItem.stSOCLamps[0].emMode = emMode; cfgSupplementLightItem.stSOCLamps[0].nPreValue = nPreValue; cfgSupplementLightItem.stSOCLamps[0].nBrightness = nBrightness; if(emMode == NetEnums.EM_DEV_SUP_LIGHT_MODE.EM_DEV_SUP_LIGHT_MODE_AUTO_TIME) for (NetStructs.STU_DAY_TIME_SECTION_SCHEDULE s : cfgSupplementLightItem.stSOCLamps[0].stuWeekTimeSection.stuTimeDay) { s.stuTimeSection[0].bValue = (byte) 1; s.stuTimeSection[0].nStartHour= startHour; s.stuTimeSection[0].nStartMinute= startMinute; s.stuTimeSection[0].nStartSecond= startSecond; s.stuTimeSection[0].nEndHour= endHour; s.stuTimeSection[0].nEndMinute= endMinute; s.stuTimeSection[0].nEndSecond= endSecond; s.stuTimeSection[1].bValue = (byte) 1; s.stuTimeSection[1].nStartHour= startHour2; s.stuTimeSection[1].nStartMinute= startMinute2; s.stuTimeSection[1].nStartSecond= startSecond2; s.stuTimeSection[1].nEndHour= endHour2; s.stuTimeSection[1].nEndMinute= endMinute2; s.stuTimeSection[1].nEndSecond= endSecond2; } IntByReference inBufferSize = new IntByReference(0); inBufferSize.setValue(cfgSupplementLightItem.size()); Pointer ptrInBuffer = DataUtils.sdk_data_createPtr(inBufferSize.getValue()); assert ptrInBuffer != null; DataUtils.sdk_data_structureToPtr(cfgSupplementLightItem, ptrInBuffer, 0); boolean result = NetLib.instance.Net_SetDeviceCfg( loginID, nCommand, 0, ptrInBuffer, inBufferSize.getValue(), 6000); System.out.println("set light config result = " + result); return result; } public NetStructs.STU_CFG_SOC_CONSTANT_LAMP_PARAM getCfgSupplementLightItem(NativeLong loginID, int nCommand){ IntByReference outBufferSize = new IntByReference(0); IntByReference nReturnSize = new IntByReference(0); Pointer ptrOutBuffer = initStuData(nCommand, outBufferSize); boolean bResult = NetLib.instance.Net_GetDeviceCfg( loginID, nCommand, 0, ptrOutBuffer, outBufferSize.getValue(), nReturnSize, 6000); if(!bResult) { int error = NetLib.instance.Net_LastError(); String strError = String.format("Net_GetDeviceCfg fail, command = %d, errorCode = %d", nCommand, error); System.out.println(strError); return null; } NetStructs.STU_CFG_SOC_CONSTANT_LAMP_PARAM cfg = new NetStructs.STU_CFG_SOC_CONSTANT_LAMP_PARAM(); DataUtils.sdk_data_ptrToStructure(ptrOutBuffer, cfg); return cfg; } /** * * @param bRealtimeEnable 使能 0-否 1-是 * @param szAddress 服务地址 * @param bOfflineEnable 断网续传 0-否 1-是 * @param uFtpPort 端口 * @param szUserName 用户名 * @param szPassword 密码 * @return */ public boolean setDeviceFtpCfg(NativeLong loginID, int bRealtimeEnable,int bOfflineEnable,String szAddress,int uFtpPort,String szUserName,String szPassword,String szPathRule){ //上传图片路径规则 if(StringUtils.isBlank(szPathRule)) { szPathRule = "/%n/%Y-%M-%D/%Y_%M_%D_%h_%m_%s.jpg"; } byte[] szPathRuleBytes = getNewArray(160,DataUtils.sdk_data_stringToByteArray(szPathRule,GlobalTool.getEncodeType())); //路径编码类型 int emPathEncodeType = 0; byte[] szAddressBytes = getNewArray(64,DataUtils.sdk_data_stringToByteArray(szAddress,GlobalTool.getEncodeType())); byte[] szUserNameBytes = getNewArray(64,DataUtils.sdk_data_stringToByteArray(szUserName,GlobalTool.getEncodeType())); byte[] szPasswordBytes = getNewArray(64,DataUtils.sdk_data_stringToByteArray(szPassword,GlobalTool.getEncodeType())); // 句柄 - 网络存储传输配置 int nCommand = EM_DEVICE_CFG_TYPE.DEVICE_CFG_NET_STORAGE_TRANS; STU_CFG_NET_STORAGE_TRANS stuCfgNetStorageTrans = getStuCfgNetStorageTrans(loginID,nCommand); IntByReference inBufferSize = new IntByReference(0); Pointer ptrInBuffer = getDeviceCfgPointer(stuCfgNetStorageTrans,inBufferSize,bRealtimeEnable,bOfflineEnable,szAddressBytes,uFtpPort,szUserNameBytes,szPasswordBytes,szPathRuleBytes,emPathEncodeType); if(null == ptrInBuffer) return false; System.out.println("ptrInBuffer="+JSON.toJSON(ptrInBuffer).toString()); System.out.println("inBufferSize="+ inBufferSize.getValue()); boolean bResult2 = NetLib.instance.Net_SetDeviceCfg( loginID, nCommand, 0, ptrInBuffer, inBufferSize.getValue(), 6000); if(!bResult2) { int error = NetLib.instance.Net_LastError(); String strError = String.format("Net_SetDeviceCfg fail, command = %d, errorCode = %d", nCommand, error); System.out.println(strError); return false; } System.out.println("33333333333333333333333333333333"); STU_CFG_NET_STORAGE_TRANS stuCfgNetStorageTrans2 = getStuCfgNetStorageTrans(loginID,nCommand); System.out.println(JSON.toJSON(stuCfgNetStorageTrans2.stuItemArray[1]).toString()); return true; } public STU_CFG_NET_STORAGE_TRANS getStuCfgNetStorageTrans(NativeLong loginID, int nCommand){ IntByReference outBufferSize = new IntByReference(0); IntByReference nReturnSize = new IntByReference(0); Pointer ptrOutBuffer = initStuData(nCommand, outBufferSize); boolean bResult = NetLib.instance.Net_GetDeviceCfg( loginID, nCommand, 0, ptrOutBuffer, outBufferSize.getValue(), nReturnSize, 6000); if(!bResult) { int error = NetLib.instance.Net_LastError(); String strError = String.format("Net_GetDeviceCfg fail, command = %d, errorCode = %d", nCommand, error); System.out.println(strError); return null; } STU_CFG_NET_STORAGE_TRANS stuCfgNetStorageTrans = new STU_CFG_NET_STORAGE_TRANS(); DataUtils.sdk_data_ptrToStructure(ptrOutBuffer, stuCfgNetStorageTrans); return stuCfgNetStorageTrans; } public Pointer getDeviceCfgPointer(STU_CFG_NET_STORAGE_TRANS stuCfgNetStorageTrans,IntByReference inBufferSize,int bRealtimeEnable, int bOfflineEnable,byte[] szAddress,int uFtpPort, byte[] szUserName,byte[] szPassword,byte[] szPathRule,int emPathEncodeType){ if(0 < stuCfgNetStorageTrans.uItemCount) { for(int i=0; i getHttpReverseRegister(NativeLong loginID){ int nCommand = EM_DEVICE_CFG_TYPE.DEVICE_CFG_HTTP_REVERSE_REGISTER; NetStructs.STU_CFG_HTTP_REGISTER_PARAM cfg = getCfgHttpReverseRegister(loginID,nCommand); System.out.println(JSON.toJSON(cfg)); // 0:禁用,1:启用 int bEnable = cfg.bEnable; //心跳地址 String heartUrl = DataUtils.sdk_data_byteArrayToString(cfg.szMessageURL, GlobalTool.getEncodeType()); //推图地址 String pushPicUrl = DataUtils.sdk_data_byteArrayToString(cfg.szPushPictureURL, GlobalTool.getEncodeType()); //心跳间隔,单位秒 int heartbeatInterval = cfg.nHeartbeatInterval; Map map = new HashMap<>(); map.put("bEnable",bEnable); map.put("heartUrl",heartUrl); map.put("pushPicUrl",pushPicUrl); map.put("heartbeatInterval",heartbeatInterval); return map; } public R setHttpReverseRegister(NativeLong loginID,int bEnable,String heartUrl,String pushPicUrl,int heartbeatInterval){ int nCommand = EM_DEVICE_CFG_TYPE.DEVICE_CFG_HTTP_REVERSE_REGISTER; NetStructs.STU_CFG_HTTP_REGISTER_PARAM cfg = getCfgHttpReverseRegister(loginID,nCommand); cfg.bEnable = bEnable; cfg.szMessageURL = DataUtils.sdk_data_stringToByteArray(heartUrl, GlobalTool.getEncodeType());; cfg.szPushPictureURL = DataUtils.sdk_data_stringToByteArray(pushPicUrl, GlobalTool.getEncodeType());; cfg.nHeartbeatInterval = heartbeatInterval; IntByReference inBufferSize = new IntByReference(0); inBufferSize.setValue(cfg.size()); Pointer ptrInBuffer = DataUtils.sdk_data_createPtr(inBufferSize.getValue()); DataUtils.sdk_data_structureToPtr(cfg, ptrInBuffer, 0); boolean bResult2 = NetLib.instance.Net_SetDeviceCfg( loginID, nCommand, 0, ptrInBuffer, inBufferSize.getValue(), 6000); if(!bResult2) { int error = NetLib.instance.Net_LastError(); String strError = String.format("Net_setHttpReverseRegister fail, command = %d, errorCode = %d", nCommand, error); System.out.println(strError); return R.error(500,strError); } return R.ok(); } public R initHttpReverseRegister(NativeLong loginID){ int nCommand = EM_DEVICE_CFG_TYPE.DEVICE_CFG_HTTP_REVERSE_REGISTER; NetStructs.STU_CFG_HTTP_REGISTER_PARAM cfg = getCfgHttpReverseRegister(loginID,nCommand); cfg.bEnable = 1; cfg.szMessageURL = DataUtils.sdk_data_stringToByteArray("http://121.40.203.197/control-api/api/camera/heart", GlobalTool.getEncodeType());; cfg.szPushPictureURL = DataUtils.sdk_data_stringToByteArray("http://121.40.203.197/control-api/api/getPicJson", GlobalTool.getEncodeType());; cfg.nHeartbeatInterval = 50; IntByReference inBufferSize = new IntByReference(0); inBufferSize.setValue(cfg.size()); Pointer ptrInBuffer = DataUtils.sdk_data_createPtr(inBufferSize.getValue()); DataUtils.sdk_data_structureToPtr(cfg, ptrInBuffer, 0); boolean bResult2 = NetLib.instance.Net_SetDeviceCfg( loginID, nCommand, 0, ptrInBuffer, inBufferSize.getValue(), 6000); if(!bResult2) { int error = NetLib.instance.Net_LastError(); String strError = String.format("Net_setHttpReverseRegister fail, command = %d, errorCode = %d", nCommand, error); System.out.println(strError); return R.error(500,strError); } return R.ok(); } public R clearHttpReverseRegister(NativeLong loginID){ int nCommand = EM_DEVICE_CFG_TYPE.DEVICE_CFG_HTTP_REVERSE_REGISTER; NetStructs.STU_CFG_HTTP_REGISTER_PARAM cfg = getCfgHttpReverseRegister(loginID,nCommand); cfg.bEnable = 1; cfg.szMessageURL = new byte[256];; cfg.szPushPictureURL = new byte[256]; cfg.nHeartbeatInterval = 50; IntByReference inBufferSize = new IntByReference(0); inBufferSize.setValue(cfg.size()); Pointer ptrInBuffer = DataUtils.sdk_data_createPtr(inBufferSize.getValue()); DataUtils.sdk_data_structureToPtr(cfg, ptrInBuffer, 0); boolean bResult2 = NetLib.instance.Net_SetDeviceCfg( loginID, nCommand, 0, ptrInBuffer, inBufferSize.getValue(), 6000); if(!bResult2) { int error = NetLib.instance.Net_LastError(); String strError = String.format("Net_setHttpReverseRegister fail, command = %d, errorCode = %d", nCommand, error); System.out.println(strError); return R.error(500,strError); } return R.ok(); } public NetStructs.STU_CFG_HTTP_REGISTER_PARAM getCfgHttpReverseRegister(NativeLong loginID, int nCommand){ IntByReference outBufferSize = new IntByReference(0); IntByReference nReturnSize = new IntByReference(0); Pointer ptrOutBuffer = initStuData(nCommand, outBufferSize); boolean bResult = NetLib.instance.Net_GetDeviceCfg( loginID, nCommand, 0, ptrOutBuffer, outBufferSize.getValue(), nReturnSize, 6000); if(!bResult) { int error = NetLib.instance.Net_LastError(); String strError = String.format("Net_HttpReverseRegisterCfg fail, command = %d, errorCode = %d", nCommand, error); System.out.println(strError); return null; } NetStructs.STU_CFG_HTTP_REGISTER_PARAM cfg = new NetStructs.STU_CFG_HTTP_REGISTER_PARAM(); DataUtils.sdk_data_ptrToStructure(ptrOutBuffer, cfg); return cfg; } public Map getAutoRegister(NativeLong loginID){ int nCommand = EM_DEVICE_CFG_TYPE.DEVICE_CFG_AUTO_REGISTER; STU_CFG_AUTO_REGISTER_PARAM cfg = getAutoRegister(loginID,nCommand); System.out.println(JSON.toJSON(cfg)); // 0:禁用,1:启用 // int bEnable = cfg.bEnable; // //服务器地址 // String serverAddress = DataUtils.sdk_data_byteArrayToString(cfg.szServerAddress, GlobalTool.getEncodeType()); // //端口号 // int port = cfg.nPort; // Map map = new HashMap<>(); // map.put("bEnable",bEnable); // map.put("serverAddress",serverAddress); // map.put("port",port); // return map; return null; } public R setAutoRegister(NativeLong loginID,int bEnable,String serverAddress,int port){ int nCommand = EM_DEVICE_CFG_TYPE.DEVICE_CFG_AUTO_REGISTER; NetStructs.STU_CFG_AUTO_REGISTER_PARAM cfg = getAutoRegister(loginID,nCommand); cfg.bEnable = bEnable; cfg.szServerAddress = DataUtils.sdk_data_stringToByteArray(serverAddress, GlobalTool.getEncodeType());; cfg.nPort = port; IntByReference inBufferSize = new IntByReference(0); inBufferSize.setValue(cfg.size()); Pointer ptrInBuffer = DataUtils.sdk_data_createPtr(inBufferSize.getValue()); DataUtils.sdk_data_structureToPtr(cfg, ptrInBuffer, 0); boolean bResult2 = NetLib.instance.Net_SetDeviceCfg( loginID, nCommand, 0, ptrInBuffer, inBufferSize.getValue(), 6000); if(!bResult2) { int error = NetLib.instance.Net_LastError(); String strError = String.format("Net_setAutoRegister fail, command = %d, errorCode = %d", nCommand, error); System.out.println(strError); return R.error(500,strError); } return R.ok(); } public STU_CFG_AUTO_REGISTER_PARAM getAutoRegister(NativeLong loginID, int nCommand){ IntByReference outBufferSize = new IntByReference(0); IntByReference nReturnSize = new IntByReference(0); Pointer ptrOutBuffer = initStuData(nCommand, outBufferSize); boolean bResult = NetLib.instance.Net_GetDeviceCfg( loginID, nCommand, 0, ptrOutBuffer, outBufferSize.getValue(), nReturnSize, 6000); if(!bResult) { int error = NetLib.instance.Net_LastError(); String strError = String.format("Net_AutoRegisterCfg fail, command = %d, errorCode = %d", nCommand, error); System.out.println(strError); return null; } STU_CFG_AUTO_REGISTER_PARAM cfg = new STU_CFG_AUTO_REGISTER_PARAM(); DataUtils.sdk_data_ptrToStructure(ptrOutBuffer, cfg); return cfg; } }