Ejemplo n.º 1
0
        private void button2_Click(object sender, EventArgs e)
        {
            CameraInfo cInfo = CurrentVideoInfo.Cameras.Values.First();

            SDK_TDWYSDK.CLIENTINFO tInfo = new SDK_TDWYSDK.CLIENTINFO
            {
                m_iServerID  = m_iLogonId,
                m_iTimeout   = 20,
                m_iNetMode   = 1,
                m_iChannelNo = cInfo.Channel - 1,
                m_iStreamNO  = 1,
                m_cNetFile   = new char[255],
                m_cRemoteIP  = new char[16],
            };
            Array.Copy(CurrentVideoInfo.DVSAddress.ToArray(), tInfo.m_cRemoteIP, CurrentVideoInfo.DVSAddress.Length);
            //开始接收一路视频数据

            UInt32 uiConID = 0;
            int    iRet    = SDK_TDWYSDK.NetClient_StartRecv(ref uiConID, ref tInfo, null);

            m_iConnectId = (Int32)uiConID;
        }
Ejemplo n.º 2
0
        private void VideoEnvironment_TDWY_MAIN_NOTIFYEvent(Int32 _ulLogonID, Int32 _iWparam, IntPtr _iLParam, IntPtr _iUser)
        {
            if (_ulLogonID == _iLogonID)
            {
                int iMsg = _iWparam & 0xffff;
                //表示属于当前信息登录信息
                switch (iMsg)
                {
                //登陆状态消息
                //param1 登陆IP
                //param2 登陆ID
                //param3 登陆状态
                case NetSDKMsg.WCM_LOGON_NOTIFY:
                    Int32 iStatus = _iLParam.ToInt32();
                    if (iStatus == NetSDKMsg.LOGON_SUCCESS)
                    {
                        VideoPlayCallback(new VideoPlayCallbackValue {
                            evType = Enum_VideoPlayEventType.LoginSuccess
                        });
                        //初始化通道列表
                        //Int32 iChanNum = 0;
                        //SDK_TDWY.NetClient_GetChannelNum(_iLogonID, ref iChanNum);
                        CLIENTINFO channel = new CLIENTINFO
                        {
                            m_iServerID  = _iLogonID,
                            m_iTimeout   = 20,
                            m_iNetMode   = 1,
                            m_iChannelNo = CurrentCameraInfo.Channel - 1,
                            m_iStreamNO  = (CurrentVideoPlaySet.PlayStream == Enum.Enum_VideoStream.SubStream) ? 1 : 0,
                            m_cNetFile   = new char[255],
                            m_cRemoteIP  = new char[16],
                        };
                        Array.Copy(CurrentVideoInfo.DVSAddress.ToArray(), channel.m_cRemoteIP, CurrentVideoInfo.DVSAddress.Length);
                        //开始接收一路视频数据
                        UInt32 uiConID = 0;
                        int    iRet    = SDK_TDWYSDK.NetClient_StartRecv(ref uiConID, ref channel, null);

                        VideoPlayCallback(new VideoPlayCallbackValue {
                            evType = Enum_VideoPlayEventType.RequestConn
                        });
                        if (iRet < 0)
                        {
                            //操作失败
                            VideoPlayCallback(new VideoPlayCallbackValue {
                                evType = Enum_VideoPlayEventType.RequestVideoTimeout
                            });
                        }
                        m_iConnectId = Convert.ToInt32(uiConID);
                    }
                    else
                    {
                        //触发相关时间进行提示
                        VideoPlayCallback(new VideoPlayCallbackValue {
                            evType = Enum_VideoPlayEventType.DevLoginException
                        });
                        Console.WriteLine("登录失败,Status:" + iStatus);
                    }
                    break;

                case NetSDKMsg.WCM_VIDEO_HEAD_EX:
                    RECT rect = new RECT();
                    SDK_TDWYSDK.NetClient_StartPlay(m_iConnectId, intptrPlayMain, rect, 0);
                    VideoPlayCallback(new VideoPlayCallbackValue {
                        evType = Enum_VideoPlayEventType.VideoPlay
                    });
                    break;

                case NetSDKMsg.WCM_ERR_DIGITCHANNEL_NOT_ENABLED:
                    VideoPlayCallback(new VideoPlayCallbackValue {
                        evType = Enum_VideoPlayEventType.RequestVideoTimeout
                    });
                    break;

                default:
                    Console.WriteLine("TDWY- MyMAIN_NOTIFY_V4: " + iMsg);
                    break;
                }
            }
        }