Пример #1
0
        public void H264_DVR_PTZControlTest()
        {
            int  iLogin    = -1;
            int  intResult = 0;
            bool bolResult = false;

            SDKState.XMSDK_Init();
            H264_DVR_DEVICEINFO OutDev;
            int nError = 0;

            iLogin = SDK_XMSDK.H264_DVR_Login_Cloud("4bba3f71cdd143cb", 34567, "admin", "123456", out OutDev, out nError, "");
            H264_DVR_CLIENTINFO playstru = new H264_DVR_CLIENTINFO();

            playstru.nChannel = 0;
            //playstru.nChannel = 0;
            playstru.nStream = 0;
            playstru.nMode   = 1;
            playstru.hWnd    = IntPtr.Zero;
            int m_iPlayhandle = SDK_XMSDK.H264_DVR_RealPlay(Convert.ToInt32(iLogin), ref playstru);

            bolResult = SDK_XMSDK.H264_DVR_PTZControl(iLogin, 0, Convert.ToInt32(SDK_XMSDK.PTZ_ControlType.PAN_LEFTTOP), false, 10);
            //bolResult = SDK_XMSDK.H264_DVR_PTZControl(1, 0,1, false, 4);
            //(long lLoginID, int nChannelNo, long lPTZCommand, bool bStop DEF_PARAM(0), long lSpeed DEF_PARAM(4));
            Thread.Sleep(1000);
            SDK_XMSDK.H264_DVR_PTZControl(iLogin, 0, Convert.ToInt32(SDK_XMSDK.PTZ_ControlType.PAN_RIGTHDOWN), true, 0);
            //SDK_XMSDK.H264_DVR_PTZControl(iLogin, 1, Convert.ToInt64(SDK_XMSDK.PTZ_ControlType.TILT_DOWN), false, 100);
            //bool bolResult = SDK_XMSDK.H264_DVR_PTZControl(Convert.ToInt32(lLogin), CurrentCameraInfo.Channel, Convert.ToInt32(XMVideoPtzType), !bolStart, CurrentVideoPlaySet.PTZSpeed);
            SDK_XMSDK.H264_DVR_Logout(Convert.ToInt32(intResult));
            SDKState.XMSDK_Release();
            Assert.IsTrue(bolResult);
        }
Пример #2
0
        public bool VideoPTZControl(Enum_VideoPTZControl PTZControl, bool bolStart)
        {
            bool bolResult = false;

            SDK_XMSDK.PTZ_ControlType XMVideoPtzType = SDK_XMSDK.PTZ_ControlType.EXTPTZ_TOTAL;
            //云台控制类型改变
            switch (PTZControl) //云视通仅 上下
            {
            case Enum_VideoPTZControl.PTZControl_Up:
                XMVideoPtzType = SDK_XMSDK.PTZ_ControlType.TILT_UP;
                break;

            case Enum_VideoPTZControl.PTZControl_Down:
                XMVideoPtzType = SDK_XMSDK.PTZ_ControlType.TILT_DOWN;
                break;

            case Enum_VideoPTZControl.PTZControl_Left:
                XMVideoPtzType = SDK_XMSDK.PTZ_ControlType.PAN_LEFT;
                break;

            case Enum_VideoPTZControl.PTZControl_Right:
                XMVideoPtzType = SDK_XMSDK.PTZ_ControlType.PAN_RIGHT;
                break;

            case Enum_VideoPTZControl.PTZControl_LeftUp:
                XMVideoPtzType = SDK_XMSDK.PTZ_ControlType.PAN_LEFTTOP;
                break;

            case Enum_VideoPTZControl.PTZControl_LeftDown:
                XMVideoPtzType = SDK_XMSDK.PTZ_ControlType.PAN_LEFTDOWN;
                break;

            case Enum_VideoPTZControl.PTZControl_RightUp:
                XMVideoPtzType = SDK_XMSDK.PTZ_ControlType.PAN_RIGTHTOP;
                break;

            case Enum_VideoPTZControl.PTZControl_RightDown:
                XMVideoPtzType = SDK_XMSDK.PTZ_ControlType.PAN_RIGTHDOWN;
                break;
            }
            if (XMVideoPtzType != SDK_XMSDK.PTZ_ControlType.EXTPTZ_TOTAL)
            {
                bool bolTemp = !bolStart;
                if (lLogin > 0)
                {
                    bolResult = SDK_XMSDK.H264_DVR_PTZControl(lLogin, CurrentCameraInfo.Channel - 1, Convert.ToInt32(XMVideoPtzType), bolTemp, CurrentVideoPlaySet.PTZSpeed);
                }
            }
            return(bolResult);
        }