Exemplo n.º 1
0
        private DefVsClient.CHANNEL_CONINFOR GetChConInfor()
        {
            DefVsClient.CHANNEL_CONINFOR sChConInfor = new DefVsClient.CHANNEL_CONINFOR();
            sChConInfor.m_sNetLinkInfo.m_pchFromID = Encoding.Default.GetBytes("900000002001");
            sChConInfor.m_sNetLinkInfo.m_pchToID   = Encoding.Default.GetBytes(m_strCamId);

            byte[] temp  = null;
            byte[] bUser = new byte[12];
            Array.Clear(bUser, 0, 12);
            temp = Encoding.Default.GetBytes("888888");
            Array.Copy(temp, bUser, temp.Length);
            sChConInfor.m_sNetLinkInfo.m_pchUser = bUser;
            byte[] bPass = new byte[12];
            Array.Clear(bPass, 0, 12);
            temp = Encoding.Default.GetBytes("888888");
            Array.Copy(temp, bPass, temp.Length);
            sChConInfor.m_sNetLinkInfo.m_pchPsw    = bPass;
            sChConInfor.m_sNetLinkInfo.m_iTranType = 1;
            byte[] bUrl = new byte[20];
            Array.Clear(bUrl, 0, 20);
            temp = Encoding.Default.GetBytes(m_strSvrIp);
            Array.Copy(temp, bUrl, temp.Length);
            sChConInfor.m_sNetLinkInfo.m_pchUrl = bUrl;
            sChConInfor.m_sNetLinkInfo.m_iPort  = 3000;
            sChConInfor.m_iType       = 0x0201018;
            sChConInfor.m_hVideo      = this.Handle;
            sChConInfor.m_iChNo       = 0;
            sChConInfor.m_iStreamType = 0;
            sChConInfor.m_iBuffNum    = 50;
            return(sChConInfor);
        }
Exemplo n.º 2
0
        //获取视频参数
        public Int32 GetVideoParams(ref Int32 _iBri, ref Int32 _iCon, ref Int32 _iSat, ref Int32 _iHue)
        {
            Int32 iRet = -1;

            if (m_lHandle != -1)
            {
                DefVsClient.PARAM_SET_DATA   ParamSetData = new DefVsClient.PARAM_SET_DATA();
                DefVsClient.CHANNEL_CONINFOR sChConInfor  = GetChConInfor();
                ParamSetData.m_sNetLinkInfo = sChConInfor.m_sNetLinkInfo;
                ParamSetData.m_iChNo        = sChConInfor.m_iChNo;
                ParamSetData.m_iCommand     = (Int32)ParamCmdType.cmdViParam;
                ParamSetData.m_iPriority    = 1;
                iRet = VsClientAPI.VSSP_ClientGetDevParam(ref ParamSetData);
                if (iRet == 0)
                {
                    byte[] byteArray = ParamSetData.m_pchParams;
                    _iBri = byteArray[0];
                    _iCon = byteArray[1];
                    _iSat = byteArray[2];
                    _iHue = byteArray[3];
                }
                else
                {
                    _iBri = 0;
                    _iCon = 0;
                    _iSat = 0;
                    _iHue = 0;
                }
            }
            return(iRet);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 连接视频
        /// </summary>
        public Int32 ConnectVideo(IntPtr _hWnd)
        {
            m_lHandle     = -1;
            m_bRecording  = false;
            m_bConnected  = false;
            m_sChConInfor = new DefVsClient.CHANNEL_CONINFOR();
            m_sChConInfor.m_sNetLinkInfo.m_pchFromID = Encoding.Default.GetBytes("900000000001");
            m_sChConInfor.m_sNetLinkInfo.m_pchToID   = Encoding.Default.GetBytes(m_strDevId + "000");

            byte[] temp  = null;
            byte[] bUser = new byte[12];
            Array.Clear(bUser, 0, 12);
            temp = Encoding.Default.GetBytes("888888");
            Array.Copy(temp, bUser, temp.Length);
            m_sChConInfor.m_sNetLinkInfo.m_pchUser = bUser;
            byte[] bPass = new byte[12];
            Array.Clear(bPass, 0, 12);
            temp = Encoding.Default.GetBytes("888888");
            Array.Copy(temp, bPass, temp.Length);
            m_sChConInfor.m_sNetLinkInfo.m_pchPsw    = bPass;
            m_sChConInfor.m_sNetLinkInfo.m_iTranType = 1;
            byte[] bUrl = new byte[20];
            Array.Clear(bUrl, 0, 20);
            temp = Encoding.Default.GetBytes(m_strMMIp);
            Array.Copy(temp, bUrl, temp.Length);
            m_sChConInfor.m_sNetLinkInfo.m_pchUrl = bUrl;
            m_sChConInfor.m_sNetLinkInfo.m_iPort  = 3000;
            m_sChConInfor.m_iType    = 0x0201018;
            m_sChConInfor.m_hVideo   = _hWnd;
            m_sChConInfor.m_iChNo    = 0;
            m_sChConInfor.m_iBuffNum = 50;
            m_lHandle = VsClientAPI.VSSP_ClientStart(ref m_sChConInfor);
            CloseAudio();
            return(m_lHandle);
        }
Exemplo n.º 4
0
        /// <summary>
        /// 控制前端设备
        /// </summary>
        /// <param name="_iCommond">控制命令</param>
        /// <param name="_iValue">速度值</param>
        /// <param name="_iPriority">控制优先级</param>
        /// <returns>成功返回 0 失败返回 -1</returns>
        public Int32 PTZCtrl(Int32 _iCommond, Int32 _iValue, Int32 _iPriority)
        {
            Int32 iRet = -1;

            DefVsClient.CHANNEL_CONINFOR sChConInfor = new DefVsClient.CHANNEL_CONINFOR();
            sChConInfor.m_sNetLinkInfo.m_pchFromID = Encoding.Default.GetBytes("900000000001");
            sChConInfor.m_sNetLinkInfo.m_pchToID   = Encoding.Default.GetBytes(m_strDevId + "000");
            byte[] temp  = null;
            byte[] bUser = new byte[12];
            Array.Clear(bUser, 0, 12);
            temp = Encoding.Default.GetBytes("888888");
            Array.Copy(temp, bUser, temp.Length);
            sChConInfor.m_sNetLinkInfo.m_pchUser = bUser;
            byte[] bPass = new byte[12];
            Array.Clear(bPass, 0, 12);
            temp = Encoding.Default.GetBytes("888888");
            Array.Copy(temp, bPass, temp.Length);
            sChConInfor.m_sNetLinkInfo.m_pchPsw    = bPass;
            sChConInfor.m_sNetLinkInfo.m_iTranType = 1;
            byte[] bUrl = new byte[20];
            Array.Clear(bUrl, 0, 20);
            temp = Encoding.Default.GetBytes(m_strMMIp);
            Array.Copy(temp, bUrl, temp.Length);
            sChConInfor.m_sNetLinkInfo.m_pchUrl = bUrl;
            sChConInfor.m_sNetLinkInfo.m_iPort  = 3004;
            sChConInfor.m_iType    = 0x0201018;
            sChConInfor.m_iChNo    = 0;
            sChConInfor.m_iBuffNum = 50;

            iRet = VsClientAPI.VSSP_ClientPTZCtrl(ref sChConInfor.m_sNetLinkInfo, sChConInfor.m_iChNo, _iCommond, _iValue, _iPriority, /*m_iExclusivedTime*/ 10);
            return(iRet);
        }
Exemplo n.º 5
0
        // 控制前端设备
        public Int32 PTZCtrl(Int32 _iCommond, Int32 _iValue, Int32 _iPriority)
        {
            Int32 iRet = -1;

            DefVsClient.CHANNEL_CONINFOR sChConInfor = GetChConInfor();
            iRet = VsClientAPI.VSSP_ClientPTZCtrl(ref sChConInfor.m_sNetLinkInfo, sChConInfor.m_iChNo, _iCommond, _iValue, _iPriority, /*m_iExclusivedTime*/ 10);
            return(iRet);
        }
Exemplo n.º 6
0
 /// <summary>
 /// 自己api连接视频
 /// </summary>
 /// <param name="strId">登录摄像机id</param>
 /// <param name="strIp">登录摄像机ip</param>
 /// <param name="strName">登录摄像机名称</param>
 public void ConnectVideoSelf(string strId, string strIp, string strName)
 {
     m_strName  = strName;
     m_strCamId = strId;
     m_strSvrIp = strIp;
     DefVsClient.CHANNEL_CONINFOR sChConInfor = GetChConInfor();
     m_lPlayHandle = VsClientAPI.VSSP_ClientStart(ref sChConInfor);
     if (m_lPlayHandle >= 0)
     {
         m_bConnected = true;
     }
 }
Exemplo n.º 7
0
        //连接视频
        public void ConnectVideo(string strId, string strIp, string strName, int iType, int iChannel, int iLoginHandle = -1)
        {
            m_iType = iType;
            switch (iType)
            {
            case 1:    //自己api
                m_sIp    = strIp;
                m_sCamId = strId;
                m_sName  = strName;
                DefVsClient.CHANNEL_CONINFOR sChConInfor = GetChConInfor();
                m_iPlayHandle = VsClientAPI.VSSP_ClientStart(ref sChConInfor);
                break;

            case 2:    //海康api
                ConnectVideoHik(iLoginHandle, iChannel, strName);
                break;
            }
        }
Exemplo n.º 8
0
        //设置视频参数
        public Int32 SetVideoParams(Int32 _iBri, Int32 _iCon, Int32 _iSat, Int32 _iHue)
        {
            Int32 iRet = -1;

            if (m_lHandle != -1)
            {
                DefVsClient.PARAM_SET_DATA   ParamSetData = new DefVsClient.PARAM_SET_DATA();
                DefVsClient.CHANNEL_CONINFOR sChConInfor  = GetChConInfor();
                ParamSetData.m_sNetLinkInfo = sChConInfor.m_sNetLinkInfo;
                ParamSetData.m_iChNo        = sChConInfor.m_iChNo;
                ParamSetData.m_iCommand     = (Int32)ParamCmdType.cmdViParam;
                ParamSetData.m_iPriority    = 1;
                byte[] byteArray = new byte[4096];
                byteArray[0]             = (byte)_iBri;
                byteArray[1]             = (byte)_iCon;
                byteArray[2]             = (byte)_iSat;
                byteArray[3]             = (byte)_iHue;
                ParamSetData.m_pchParams = byteArray;
                iRet = VsClientAPI.VSSP_ClientSetDevParam(ref ParamSetData);
            }
            return(iRet);
        }