public void saveStstemTime(int timeZone, string Date, String time) { /* Save system time */ NETDEV_TIME_CFG_S stTimeCfg = new NETDEV_TIME_CFG_S(); stTimeCfg.stTime.dwYear = Convert.ToInt32(Date.Split('/')[0]); stTimeCfg.stTime.dwMonth = Convert.ToInt32(Date.Split('/')[1]); stTimeCfg.stTime.dwDay = Convert.ToInt32(Date.Split('/')[2]); stTimeCfg.stTime.dwHour = Convert.ToInt32(time.Split(':')[0]); stTimeCfg.stTime.dwMinute = Convert.ToInt32(time.Split(':')[1]); stTimeCfg.stTime.dwSecond = Convert.ToInt32(time.Split(':')[2]); stTimeCfg.dwTimeZone = (NETDEV_TIME_ZONE_E)timeZone; int iRet = NETDEVSDK.NETDEV_SetSystemTimeCfg(m_deviceInfoList[m_oNetDemo.m_curSelectedTreeDeviceIndex].m_lpDevHandle, ref stTimeCfg); if (NETDEVSDK.TRUE != iRet) { m_oNetDemo.showFailLogInfo(m_oNetDemo.getDeviceInfoList()[m_oNetDemo.m_curSelectedTreeDeviceIndex].m_ip + " chl:" + (m_oNetDemo.m_curSelectedTreeChannelIndex + 1), "Save device system time", NETDEVSDK.NETDEV_GetLastError()); return; } m_oNetDemo.showSuccessLogInfo(m_oNetDemo.getDeviceInfoList()[m_oNetDemo.m_curSelectedTreeDeviceIndex].m_ip + " chl:" + (m_oNetDemo.m_curSelectedTreeChannelIndex + 1), "Save device system time"); m_deviceInfoList[m_oNetDemo.m_curSelectedTreeDeviceIndex].m_channelInfoList[m_oNetDemo.m_curSelectedTreeChannelIndex].m_basicInfo.stSystemTime = stTimeCfg; }
private void okBtn_Click(object sender, EventArgs e) { if (m_oNetDemo.getChannelID() == -1) { return; } int dwChannelID = m_oNetDemo.getChannelID(); IntPtr lpHandle = m_oNetDemo.getDeviceInfoList()[m_oNetDemo.m_CurSelectTreeNodeInfo.dwDeviceIndex].m_lpDevHandle; if (IntPtr.Zero == lpHandle) { MessageBox.Show("Device Handle is 0 ", "warning"); return; } String szPresetName; Int32 lPresetID = -1; try { lPresetID = Convert.ToInt32(this.presetIDText.Text); } catch (FormatException) { return; } szPresetName = this.presetNameText.Text; if (0 >= lPresetID || lPresetID > NETDEVSDK.NETDEV_MAX_PRESET_NUM) { MessageBox.Show("Preset ID invalid.", "warning"); return; } byte[] byPresetName; GetUTF8Buffer(szPresetName, NETDEVSDK.NETDEV_LEN_32, out byPresetName); int bRet = NETDEVSDK.NETDEV_PTZPreset_Other(lpHandle, dwChannelID, (int)NETDEV_PTZ_PRESETCMD_E.NETDEV_PTZ_SET_PRESET, byPresetName, lPresetID); if (NETDEVSDK.TRUE != bRet) { m_oNetDemo.showFailLogInfo(m_oNetDemo.getDeviceInfoList()[m_oNetDemo.m_CurSelectTreeNodeInfo.dwDeviceIndex].m_ip + " chl:" + (m_oNetDemo.getChannelID()), "Set preset", NETDEVSDK.NETDEV_GetLastError()); } else { m_oNetDemo.showSuccessLogInfo(m_oNetDemo.getDeviceInfoList()[m_oNetDemo.m_CurSelectTreeNodeInfo.dwDeviceIndex].m_ip + " chl:" + (m_oNetDemo.getChannelID()), "Set preset"); m_oNetDemo.presetGetBtn_Click(null, null); this.Close(); } }
private void startMonitorBtn_Click(object sender, EventArgs e) { if (monitorListView.Items.Count == 0) { return; } m_oNetDemo.m_cycleMonitorInfo = new GeneralDef.CycleMonitorInfo(); this.stopMonitorBtn.Enabled = true; this.startMonitorBtn.Enabled = false; this.startMonitorBtn.Enabled = false; this.addAllMonitorBtn.Enabled = false; this.addOneMonitorBtn.Enabled = false; this.delAllMonitorBtn.Enabled = false; this.delOneMonitorBtn.Enabled = false; foreach (ListViewItem item in monitorListView.Items) { string strIP = item.SubItems[0].Text; int iChannelID = Convert.ToInt32(item.SubItems[1].Text); for (int i = 0; i < m_oNetDemo.getDeviceInfoList().Count; i++) { if (strIP != m_oNetDemo.getDeviceInfoList()[i].m_ip) { continue; } for (int j = 0; j < m_oNetDemo.getDeviceInfoList()[i].m_channelInfoList.Count; j++) { if (iChannelID == m_oNetDemo.getDeviceInfoList()[i].m_channelInfoList[j].m_devVideoChlInfo.dwChannelID) { GeneralDef.CycleMonitorInfo.CYCLE_MONITOR_CHANNEL_INFO_S cycleMonitorChannelInfo; cycleMonitorChannelInfo.channelID = iChannelID; cycleMonitorChannelInfo.devhandle = m_oNetDemo.getDeviceInfoList()[i].m_lpDevHandle; cycleMonitorChannelInfo.deviceIndex = i; m_oNetDemo.m_cycleMonitorInfo.channelInfoList.Add(cycleMonitorChannelInfo); break; } } break;// Not Found } } m_oNetDemo.m_cycleMonitorInfo.monitorCount = monitorListView.Items.Count; m_oNetDemo.m_cycleMonitorInfo.monitorType = m_iMonitorType; m_oNetDemo.m_cycleMonitorInfo.intervalTime = m_iIntervalTime; m_oNetDemo.m_cycleMonitorInfo.panelNo = m_iPanelNo; m_oNetDemo.startCycleMonitorThread(); }
public void saveStstemTime(int timeZone, string Date, String time) { int dwDeviceIndex = m_oNetDemo.getDeviceIndex(); if (dwDeviceIndex < 0) { return; } /* Save system time */ NETDEV_TIME_CFG_S stTimeCfg = new NETDEV_TIME_CFG_S(); stTimeCfg.stTime.dwYear = Convert.ToInt32(Date.Split('/')[0]); stTimeCfg.stTime.dwMonth = Convert.ToInt32(Date.Split('/')[1]); stTimeCfg.stTime.dwDay = Convert.ToInt32(Date.Split('/')[2]); stTimeCfg.stTime.dwHour = Convert.ToInt32(time.Split(':')[0]); stTimeCfg.stTime.dwMinute = Convert.ToInt32(time.Split(':')[1]); stTimeCfg.stTime.dwSecond = Convert.ToInt32(time.Split(':')[2]); stTimeCfg.dwTimeZone = (NETDEV_TIME_ZONE_E)timeZone; int iRet = NETDEVSDK.NETDEV_SetSystemTimeCfg(m_deviceInfoList[m_oNetDemo.m_CurSelectTreeNodeInfo.dwDeviceIndex].m_lpDevHandle, ref stTimeCfg); if (NETDEVSDK.TRUE != iRet) { m_oNetDemo.showFailLogInfo(m_oNetDemo.getDeviceInfoList()[m_oNetDemo.m_CurSelectTreeNodeInfo.dwDeviceIndex].m_ip + " chl:" + (m_oNetDemo.getChannelID()), "Save device system time", NETDEVSDK.NETDEV_GetLastError()); return; } m_oNetDemo.showSuccessLogInfo(m_oNetDemo.getDeviceInfoList()[m_oNetDemo.m_CurSelectTreeNodeInfo.dwDeviceIndex].m_ip + " chl:" + (m_oNetDemo.getChannelID()), "Save device system time"); if (NETDEMO.NETDEMO_DEVICE_TYPE_E.NETDEMO_DEVICE_VMS == m_deviceInfoList[dwDeviceIndex].m_eDeviceType) { m_deviceInfoList[dwDeviceIndex].stVmsDevInfo.stSystemTime = stTimeCfg; } else { m_deviceInfoList[dwDeviceIndex].m_channelInfoList[m_oNetDemo.getChannelIndex()].m_basicInfo.stSystemTime = stTimeCfg; } }
public PTZExtend(NetDemo netDemo) { this.m_oNetDemo = netDemo; m_deviceInfoList = netDemo.getDeviceInfoList(); m_lpDevHandle = m_deviceInfoList[netDemo.getCurRealPanel().m_deviceIndex].m_lpDevHandle; m_iChannelID = netDemo.getCurRealPanel().m_channelID; m_curRealPlayPanel = netDemo.getCurRealPanel(); m_curSelectedTreeDeviceIndex = netDemo.m_CurSelectTreeNodeInfo.dwDeviceIndex; m_curSelectedTreeChannelIndex = netDemo.getChannelIndex(); InitializeComponent(); m_oPtzControl = new PTZControl(); }
//cycle monitor public CycleMonitor(NetDemo oNetDemo) { InitializeComponent(); m_oNetDemo = oNetDemo; int k = 0; for (int i = 0; i < m_oNetDemo.getDeviceInfoList().Count; i++) { //int correctValue = 0; for (int j = 0; j < m_oNetDemo.getDeviceInfoList()[i].m_channelInfoList.Count; j++) { if (m_oNetDemo.getDeviceInfoList()[i].m_channelInfoList[j].m_devVideoChlInfo.enStatus == (int)NETDEV_CHANNEL_STATUS_E.NETDEV_CHL_STATUS_ONLINE) { if (m_oNetDemo.m_cycleMonitorInfo != null) { if (k < m_oNetDemo.m_cycleMonitorInfo.monitorCount) { ListViewItem oListViewItem = null; if (m_oNetDemo.m_cycleMonitorInfo.channelInfoList[k].channelID == m_oNetDemo.getDeviceInfoList()[i].m_channelInfoList[j].m_devVideoChlInfo.dwChannelID && m_oNetDemo.m_cycleMonitorInfo.channelInfoList[k].devhandle == m_oNetDemo.getDeviceInfoList()[i].m_lpDevHandle) { oListViewItem = new ListViewItem(m_oNetDemo.getDeviceInfoList()[i].m_ip); oListViewItem.SubItems.Add(Convert.ToString(m_oNetDemo.getDeviceInfoList()[i].m_channelInfoList[j].m_devVideoChlInfo.dwChannelID)); this.monitorListView.Items.Add(oListViewItem); oListViewItem.EnsureVisible(); k++; } else { oListViewItem = new ListViewItem(m_oNetDemo.getDeviceInfoList()[i].m_ip); oListViewItem.SubItems.Add(Convert.ToString(m_oNetDemo.getDeviceInfoList()[i].m_channelInfoList[j].m_devVideoChlInfo.dwChannelID)); this.unmonitorListView.Items.Add(oListViewItem); oListViewItem.EnsureVisible(); } } else { ListViewItem oListViewItem = new ListViewItem(m_oNetDemo.getDeviceInfoList()[i].m_ip); oListViewItem.SubItems.Add(Convert.ToString(m_oNetDemo.getDeviceInfoList()[i].m_channelInfoList[j].m_devVideoChlInfo.dwChannelID)); this.unmonitorListView.Items.Add(oListViewItem); oListViewItem.EnsureVisible(); } } else { ListViewItem oListViewItem = new ListViewItem(m_oNetDemo.getDeviceInfoList()[i].m_ip); oListViewItem.SubItems.Add(Convert.ToString(m_oNetDemo.getDeviceInfoList()[i].m_channelInfoList[j].m_devVideoChlInfo.dwChannelID)); this.unmonitorListView.Items.Add(oListViewItem); oListViewItem.EnsureVisible(); } } } } if (m_oNetDemo.m_cycleMonitorInfo != null) { this.cycleMonitorTypeCobBox.SelectedIndex = (int)m_oNetDemo.m_cycleMonitorInfo.monitorType; this.cycleMonitorWinNoCobBox.SelectedIndex = m_oNetDemo.m_cycleMonitorInfo.panelNo; this.monitorIntervalText.Text = Convert.ToString(m_oNetDemo.m_cycleMonitorInfo.intervalTime); this.startMonitorBtn.Enabled = false; this.addAllMonitorBtn.Enabled = false; this.addOneMonitorBtn.Enabled = false; this.delAllMonitorBtn.Enabled = false; this.delOneMonitorBtn.Enabled = false; } else { this.stopMonitorBtn.Enabled = false; } }
public Config(NetDemo oNetDemo) { m_oNetDemo = oNetDemo; m_deviceInfoList = oNetDemo.getDeviceInfoList(); }