public int openTspDialog(Session.Pu pu, int channelNo) { foreach (OneDialog dlg in m_tspDialogs) { if (dlg.pu.id.Equals(pu.id, StringComparison.CurrentCultureIgnoreCase) && dlg.channelNo == channelNo) { return(-1); } } IntPtr dialog = IntPtr.Zero; if (BVCU.ManagedLayer_CuOpenTspDialog(m_bvsdkHandle, ref dialog, m_session.Handle, Encoding.UTF8.GetBytes(pu.id), channelNo, m_bvsdkEventHandler.tspDialog_OnEvent, m_bvsdkEventHandler.tspDialog_OnData) == BVCU.BVCU_RESULT_S_OK) { OneDialog dlg = new OneDialog(); dlg.dialogHandle = dialog; dlg.channelNo = channelNo; dlg.pu = pu; m_tspDialogs.Add(dlg); return(0); } return(-1); }
void OnGetPuPtzAttr(IntPtr session, IntPtr puIdPtr, int ptzIndex, IntPtr ptzAttrPtr) { string puId = Marshal.PtrToStringAnsi(puIdPtr); BVCU_PUCFG_PTZAttr ptzAttr = (BVCU_PUCFG_PTZAttr)Marshal.PtrToStructure(ptzAttrPtr, typeof(BVCU_PUCFG_PTZAttr)); Session.Pu pu = m_session.getPu(puId); if (pu != null) { pu.puPtz.Add(ptzAttr); } }
private void treeViewResList_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e) { if (e.Node.Level == TREE_LEVEL_CHANNEL) { Session.Pu pu = m_sdkOperator.Session.getPu(e.Node.Parent.Name); int channelNo = pu.getChannelNo(e.Node.Text); if (channelNo >= BVCU.BVCU_SUBDEV_INDEXMAJOR_MIN_CHANNEL && channelNo < BVCU.BVCU_SUBDEV_INDEXMAJOR_MAX_CHANNEL) { if (m_sdkOperator.Dialog.Count == VIDEO_PANEL_COUNT) { MessageBox.Show("窗口已全部占用"); return; } foreach (Panel panel in m_videoPanels) { if (panel.ContextMenuStrip == null) { panel.ContextMenuStrip = contextMenuStripVideo; Console.WriteLine("Open dialog pu " + pu.id + " channel " + channelNo); m_sdkOperator.Dialog.openBrowse(pu, channelNo, panel); break; } } } else if (channelNo >= BVCU.BVCU_SUBDEV_INDEXMAJOR_MIN_GPS && channelNo < BVCU.BVCU_SUBDEV_INDEXMAJOR_MAX_GPS) { if (m_sdkOperator.Dialog.openGpsDialog(pu, channelNo) == 0) { ListViewItem item = new ListViewItem(); item.Text = pu.id; item.Tag = channelNo; ListViewItem.ListViewSubItem latItem = new ListViewItem.ListViewSubItem(); ListViewItem.ListViewSubItem lngItem = new ListViewItem.ListViewSubItem(); item.SubItems.AddRange(new ListViewItem.ListViewSubItem[] { latItem, lngItem }); listViewGPSData.Items.Add(item); } } else { if (m_sdkOperator.Dialog.openTspDialog(pu, channelNo) == 0) { ListViewItem item = new ListViewItem(); item.Text = pu.id; item.Tag = channelNo; ListViewItem.ListViewSubItem TspData = new ListViewItem.ListViewSubItem(); ListViewItem.ListViewSubItem len = new ListViewItem.ListViewSubItem(); item.SubItems.AddRange(new ListViewItem.ListViewSubItem[] { TspData, len }); listViewGPSData.Items.Add(item); } } } }
void procGetPuList() { treeViewResList.Nodes.Clear(); TreeNode session = new TreeNode(m_sdkOperator.Session.Name); treeViewResList.Nodes.Add(session); for (int i = 0; i < m_sdkOperator.Session.PuList.Count; i++) { Session.Pu pu = (Session.Pu)m_sdkOperator.Session.PuList[i]; TreeNode puNode = new TreeNode(); puNode.Name = pu.id; if (pu.puName.Length == 0) { puNode.Text = pu.id; } else { puNode.Text = pu.puName; } session.Nodes.Add(puNode); bool online = false; foreach (Session.Channel channl in pu.channelList) { TreeNode channelNode = new TreeNode(channl.channelName); if (channl.online) { channelNode.ForeColor = Color.Blue; online = true; } else { channelNode.ForeColor = Color.Gray; } puNode.Nodes.Add(channelNode); } if (online) { puNode.ForeColor = Color.Blue; } else { puNode.ForeColor = Color.Gray; } } }
/* * 打开对话(Dialog) */ public void openBrowse(Session.Pu pu, int channelNo, Panel panel) { try { BVCU_DialogControlParam_Network net = new BVCU_DialogControlParam_Network(0, 5, 1, 3); BVRect dispRect = new BVRect(0, 0, panel.ClientRectangle.Height, panel.ClientRectangle.Width); OneDialog dlg = new OneDialog(); foreach (Session.Channel channel in pu.channelList) { int volume = -1; if (channel.channelNo == channelNo) { if (channel.audioPlayback) { volume = 0; } BVCU.FAILED( BVCU.ManagedLayer_CuBrowsePu(m_bvsdkHandle, ref dlg.dialogHandle, m_session.Handle, Encoding.UTF8.GetBytes(pu.id), channelNo, panel.Handle, ref dispRect, volume, 0, Encoding.UTF8.GetBytes(""), true, ref net, m_bvsdkEventHandler.dialog_OnDialogEvent, m_bvsdkEventHandler.dialog_OnStorageEvent)); break; } } dlg.panel = panel; dlg.pu = pu; dlg.channelNo = channelNo; m_dialogs.Add(dlg); } catch { panel.ContextMenuStrip = null; MessageBox.Show("打开预览失败"); } }