예제 #1
0
        private void InfoIPChannel()
        {
            string HCIP       = ConfigurationManager.AppSettings["HCIP"];
            ushort HCPort     = Convert.ToUInt16(ConfigurationManager.AppSettings["HCPort"]);
            string HCUserName = ConfigurationManager.AppSettings["HCUserName"];
            string HCPassWord = ConfigurationManager.AppSettings["HCPassWord"];

            HC_SDKFactory.DVR_NET_INIT();
            int HCUserID = HC_SDKFactory.Login(HCIP, HCPort, HCUserName, HCPassWord);

            uint   dwSize          = (uint)Marshal.SizeOf(m_struIpParaCfgV40);
            IntPtr ptrIpParaCfgV40 = Marshal.AllocHGlobal((Int32)dwSize);

            Marshal.StructureToPtr(m_struIpParaCfgV40, ptrIpParaCfgV40, false);
            uint dwReturn = 0;

            if (!HCNetSDK_X64.NET_DVR_GetDVRConfig(HCUserID, HCNetSDK_X64.NET_DVR_GET_IPPARACFG_V40, 0, ptrIpParaCfgV40, dwSize, ref dwReturn))
            {
                MessageBox.Show("Net NVR Failed! Code :" + HCNetSDK_X64.NET_DVR_GetLastError());
            }
            else
            {
                m_struIpParaCfgV40  = (HCNetSDK_X64.NET_DVR_IPPARACFG_V40)Marshal.PtrToStructure(ptrIpParaCfgV40, typeof(HCNetSDK_X64.NET_DVR_IPPARACFG_V40));
                dwDCStartChannelNum = (int)m_struIpParaCfgV40.dwStartDChan;
            }
        }
예제 #2
0
        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            //return;
            VGVM = (VideoGroupViewModel)this.DataContext;

            rb1.IsChecked = true;

            string HCIP       = ConfigurationManager.AppSettings["HCIP"];
            ushort HCPort     = Convert.ToUInt16(ConfigurationManager.AppSettings["HCPort"]);
            string HCUserName = ConfigurationManager.AppSettings["HCUserName"];
            string HCPassWord = ConfigurationManager.AppSettings["HCPassWord"];

            HC_SDKFactory.DVR_NET_INIT();
            HCUserID        = HC_SDKFactory.Login(HCIP, HCPort, HCUserName, HCPassWord);
            dwAChanTotalNum = HC_SDKFactory.lpDeviceInfo_X64.byChanNum;
            if (HC_SDKFactory.lpDeviceInfo_X64.byIPChanNum > 0)
            {
                InfoIPChannel();
            }

            if (HCUserID != -1)
            {
                VGVM.WestThroatVideoControl    = HC_SDKFactory.factory(HCUserID, VGVM.TV.WestThroat.Channel + dwDCStartChannelNum, WestThroatVideo, 0);
                VGVM.WestTrackVideoControl     = HC_SDKFactory.factory(HCUserID, VGVM.TV.Track[0].West.Channel + dwDCStartChannelNum, WestTrackVideo, 0);
                VGVM.WestTrackZoomVideoControl = HC_SDKFactory.factory(HCUserID, VGVM.TV.Track[0].West.Channel + dwDCStartChannelNum, WestTrackZoomVideo, 0);

                VGVM.EastTrackZoomVideoControl = HC_SDKFactory.factory(HCUserID, VGVM.TV.Track[0].East.Channel + dwDCStartChannelNum, EastTrackZoomVideo, 0);
                VGVM.EastTrackVideoControl     = HC_SDKFactory.factory(HCUserID, VGVM.TV.Track[0].East.Channel + dwDCStartChannelNum, EastTrackVideo, 0);
                VGVM.EastThroatVideoControl    = HC_SDKFactory.factory(HCUserID, VGVM.TV.EastThroat.Channel + dwDCStartChannelNum, EastThroatVideo, 0);
                VGVM.PlayAll();
            }
        }
예제 #3
0
        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            VGVM = (VideoGroupViewModel)this.DataContext;
            string HCIP       = ConfigurationManager.AppSettings["HCIP"];
            ushort HCPort     = Convert.ToUInt16(ConfigurationManager.AppSettings["HCPort"]);
            string HCUserName = ConfigurationManager.AppSettings["HCUserName"];
            string HCPassWord = ConfigurationManager.AppSettings["HCPassWord"];

            HC_SDKFactory.DVR_NET_INIT();
            HCUserID        = HC_SDKFactory.Login(HCIP, HCPort, HCUserName, HCPassWord);
            dwAChanTotalNum = HC_SDKFactory.lpDeviceInfo_X64.byChanNum;
            if (HC_SDKFactory.lpDeviceInfo_X64.byIPChanNum > 0)
            {
                InfoIPChannel();
            }

            if (HCUserID != -1)
            {
                int  defaultIndex;
                bool b = int.TryParse(ConfigurationManager.AppSettings["DefaultIndex"].ToString(), out defaultIndex);
                if (!b)
                {
                    defaultIndex = 0;
                }
                //VGVM.WestThroatVideoControl = HC_SDKFactory.factory(HCUserID, VGVM.TV.WestThroat.Channel + dwDCStartChannelNum, WestThroatVideo.Handle, 0);
                //VGVM.WestTrackVideoControl = HC_SDKFactory.factory(HCUserID, VGVM.TV.Track[defaultIndex].West.Channel + dwDCStartChannelNum, WestTrackVideo.Handle, 0);
                //VGVM.WestTrackZoomVideoControl = HC_SDKFactory.factory(HCUserID, VGVM.TV.Track[defaultIndex].West.Channel + dwDCStartChannelNum, WestTrackZoomVideo.Handle, 0);
                //VGVM.EastTrackZoomVideoControl = HC_SDKFactory.factory(HCUserID, VGVM.TV.Track[defaultIndex].East.Channel + dwDCStartChannelNum, EastTrackZoomVideo.Handle, 0);
                //VGVM.EastTrackVideoControl = HC_SDKFactory.factory(HCUserID, VGVM.TV.Track[defaultIndex].East.Channel + dwDCStartChannelNum, EastTrackVideo.Handle, 0);
                //VGVM.EastThroatVideoControl = HC_SDKFactory.factory(HCUserID, VGVM.TV.EastThroat.Channel + dwDCStartChannelNum, EastThroatVideo.Handle, 0);
                //VGVM.PlayAll();
            }
        }
예제 #4
0
        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            //return;
            VGVM = (VideoGroupViewModel)this.DataContext;

            rb1.IsChecked = true;

            string HCIP       = ConfigurationManager.AppSettings["HCIP"];
            ushort HCPort     = Convert.ToUInt16(ConfigurationManager.AppSettings["HCPort"]);
            string HCUserName = ConfigurationManager.AppSettings["HCUserName"];
            string HCPassWord = ConfigurationManager.AppSettings["HCPassWord"];

            HC_SDKFactory.DVR_NET_INIT();
            HCUserID        = HC_SDKFactory.Login(HCIP, HCPort, HCUserName, HCPassWord);
            dwAChanTotalNum = HC_SDKFactory.lpDeviceInfo_X64.byChanNum;
            //if (HC_SDKFactory.lpDeviceInfo_X64.byIPChanNum > 0)
            //{
            //    InfoIPChannel();
            //}

            if (HCUserID != -1)
            {
                VGVM.WestThroatVideoControl = HC_SDKFactory.factory(HCUserID, VGVM.TV.WestThroat.Channel + dwDCStartChannelNum + 1, WestThroatVideo.Handle, 0);

                VGVM.WestTrackVideoControl     = HC_SDKFactory.factory(HCUserID, VGVM.TV.Track[0].West.Channel + dwDCStartChannelNum + 1, WestTrackVideo.Handle, 0);
                VGVM.WestTrackZoomVideoControl = HC_SDKFactory.factory(HCUserID, VGVM.TV.Track[0].West.Channel + dwDCStartChannelNum + 1, WestTrackZoomVideo.Handle, 0);

                VGVM.EastTrackZoomVideoControl = HC_SDKFactory.factory(HCUserID, VGVM.TV.Track[0].East.Channel + dwDCStartChannelNum + 1, EastTrackZoomVideo.Handle, 0);
                VGVM.EastTrackVideoControl     = HC_SDKFactory.factory(HCUserID, VGVM.TV.Track[0].East.Channel + dwDCStartChannelNum + 1, EastTrackVideo.Handle, 0);

                VGVM.EastThroatVideoControl = HC_SDKFactory.factory(HCUserID, VGVM.TV.EastThroat.Channel + dwDCStartChannelNum + 1, EastThroatVideo.Handle, 0);
                VGVM.PlayAll();
            }
            //string DVRIPAddress = HCIP; //设备IP地址或者域名
            //Int16 DVRPortNumber = Convert.ToInt16(HCPort);//设备服务端口号
            //string DVRUserName = HCUserName;//设备登录用户名
            //string DVRPassword = HCPassWord;//设备登录密码

            //HCNetSDK_X64.NET_DVR_DEVICEINFO_V30 DeviceInfo = new HCNetSDK_X64.NET_DVR_DEVICEINFO_V30();

            ////登录设备 Login the device
            //HCUserID = HCNetSDK_X64.NET_DVR_Login_V30(DVRIPAddress, DVRPortNumber, DVRUserName, DVRPassword, ref DeviceInfo);
            //if (HCUserID < 0)
            //{
            //    uint iLastErr = HCNetSDK_X64.NET_DVR_GetLastError();

            //    MessageBox.Show("NET_DVR_Login_V30 failed, error code= " + iLastErr);
            //    return;
            //}
            //else
            //{
            //    //登录成功
            //    //MessageBox.Show("Login Success!");
            //    HCNetSDK_X64.NET_DVR_PREVIEWINFO lpPreviewInfo = new HCNetSDK_X64.NET_DVR_PREVIEWINFO();
            //    lpPreviewInfo.hPlayWnd = WestThroatVideo.Handle;//预览窗口
            //    lpPreviewInfo.lChannel = 2;//预te览的设备通道
            //    lpPreviewInfo.dwStreamType = 0;//码流类型:0-主码流,1-子码流,2-码流3,3-码流4,以此类推
            //    lpPreviewInfo.dwLinkMode = 0;//连接方式:0- TCP方式,1- UDP方式,2- 多播方式,3- RTP方式,4-RTP/RTSP,5-RSTP/HTTP
            //    lpPreviewInfo.bBlocked = true; //0- 非阻塞取流,1- 阻塞取流
            //    lpPreviewInfo.dwDisplayBufNum = 1; //播放库播放缓冲区最大缓冲帧数
            //    lpPreviewInfo.byProtoType = 0;
            //    lpPreviewInfo.byPreviewMode = 0;
            //    IntPtr pUser = new IntPtr();//用户数据
            //    //打开预览 Start live view
            //    int m_lRealHandle = HCNetSDK_X64.NET_DVR_RealPlay_V40(HCUserID, ref lpPreviewInfo, null/*RealData*/, pUser);
            //    if (m_lRealHandle < 0)
            //    {
            //        uint iLastErr = HCNetSDK_X64.NET_DVR_GetLastError();
            //        MessageBox.Show("NET_DVR_RealPlay_V40 failed, error code= " + iLastErr);
            //        return;
            //    }
            //}
        }