Example #1
0
        public System.Drawing.Image DIOSnapPicture(UInt64 dwStrmId)
        {
            MyLog4Net.ILogExtension.DebugWithDebugView(MyLog4Net.Container.Instance.Log, "IVXStreamIOSDKProtocol StrmRealSnap dwStrmId:" + dwStrmId);
            string filename = Environment.GetFolderPath(Environment.SpecialFolder.Templates) + "\\" + DateTime.Now.ToString("yyyyMMddHHmmssfff") + ".bmp";
            UInt32 retVal   = IVXStreamIOSDKProtocol.StrmRealSnap(dwStrmId, filename);

            if (retVal > 0)
            {
                DIO_GetError(retVal);
            }
            System.Drawing.Image img = null;
            if (System.IO.File.Exists(filename))
            {
                try
                {
                    Image temp = System.Drawing.Image.FromFile(filename);
                    img = new Bitmap(temp);
                    temp.Dispose();
                }
                catch (Exception ex)
                {
                    MyLog4Net.ILogExtension.DebugWithDebugView(MyLog4Net.Container.Instance.Log, "IVXStreamIOSDKProtocol StrmRealSnap error:" + ex.ToString());
                }
                try
                {
                    System.IO.File.Delete(filename);
                }
                catch
                { }
            }
            MyLog4Net.ILogExtension.DebugWithDebugView(MyLog4Net.Container.Instance.Log, "IVXStreamIOSDKProtocol DIOSnapPicture ret:" + 0);

            return(img);
        }
Example #2
0
        public List <TDIO_ChannelInfo> DIOQueryChannelList(uint loginid, string devname = "")
        {
            MyLog4Net.ILogExtension.DebugWithDebugView(MyLog4Net.Container.Instance.Log, "IVXStreamIOSDKProtocol StrmGetChlInfo loginid:" + loginid + ",devname:" + devname);
            IntPtr ptr    = Marshal.AllocHGlobal(1000);
            uint   ChlNum = 0;

            IVXStreamIOSDKProtocol.StrmGetChlNum(loginid, out ChlNum);
            IntPtr pchlinfo = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(CHLSINFO)) * (int)ChlNum);
            uint   retVal   = IVXStreamIOSDKProtocol.StrmGetChlInfo(loginid, ChlNum, pchlinfo);

            if (retVal > 0)
            {
                DIO_GetError(retVal);
            }
            List <TDIO_ChannelInfo> ret = new List <TDIO_ChannelInfo>();
            StringBuilder           sb  = new StringBuilder();

            for (int i = 0; i < ChlNum; i++)
            {
                CHLSINFO         temp = (CHLSINFO)Marshal.PtrToStructure(pchlinfo + Marshal.SizeOf(typeof(CHLSINFO)) * i, typeof(CHLSINFO));
                TDIO_ChannelInfo info = new TDIO_ChannelInfo();
                info.szChannelId   = string.IsNullOrEmpty(devname) ? temp.ChlId : devname + " " + temp.ChlId;
                info.szChannelName = temp.ChlName;
                //info.szRest = temp.Rest;
                info.szRest = loginid.ToString();
                //if (temp.Status == 1)
                ret.Add(info);
                sb.AppendLine("szChannelId:" + info.szChannelId + ",szChannelName:" + info.szChannelName + ",szRest:" + info.szRest);
            }

            MyLog4Net.ILogExtension.DebugWithDebugView(MyLog4Net.Container.Instance.Log, "IVXStreamIOSDKProtocol StrmGetChlInfo ret:" + 0 + ",list:" + sb.ToString());
            return(ret);
        }
Example #3
0
        public List <GBDevInfo> DIOQueryDeviceList(E_VDA_NET_STORE_DEV_PROTOCOL_TYPE type)
        {
            MyLog4Net.ILogExtension.DebugWithDebugView(MyLog4Net.Container.Instance.Log, "IVXStreamIOSDKProtocol StrmGetDevInfo type:" + type);
            IntPtr ptr    = Marshal.AllocHGlobal(1000);
            uint   ChlNum = 0;

            IVXStreamIOSDKProtocol.StrmGetDevNum(type, out ChlNum);
            IntPtr pchlinfo = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(GBDevInfo)) * (int)ChlNum);
            uint   retVal   = IVXStreamIOSDKProtocol.StrmGetDevInfo(type, ChlNum, pchlinfo);

            if (retVal > 0)
            {
                DIO_GetError(retVal);
            }
            List <GBDevInfo> ret = new List <GBDevInfo>();
            StringBuilder    sb  = new StringBuilder();

            for (int i = 0; i < ChlNum; i++)
            {
                GBDevInfo temp = (GBDevInfo)Marshal.PtrToStructure(pchlinfo + Marshal.SizeOf(typeof(GBDevInfo)) * i, typeof(GBDevInfo));
                ret.Add(temp);
                sb.AppendLine("DevId:" + temp.DevId + ",LoginId:" + temp.LoginId);
            }

            MyLog4Net.ILogExtension.DebugWithDebugView(MyLog4Net.Container.Instance.Log, "IVXStreamIOSDKProtocol StrmGetDevInfo ret:" + 0 + ",list:" + sb.ToString());
            return(ret);
        }
Example #4
0
        public uint DIOGetVer(out TDIO_Version ver)
        {
            MyLog4Net.ILogExtension.DebugWithDebugView(MyLog4Net.Container.Instance.Log, "IVXStreamIOSDKProtocol StrmGetver ");
            IntPtr version = Marshal.AllocHGlobal(256);
            UInt32 retVal  = IVXStreamIOSDKProtocol.StrmGetver(version);


            MyLog4Net.ILogExtension.DebugWithDebugView(MyLog4Net.Container.Instance.Log, "IVXStreamIOSDKProtocol StrmGetver ret:" + 0);
            ver       = new TDIO_Version();
            ver.szVer = Marshal.PtrToStringAuto(version);
            return(0);
        }
Example #5
0
        public uint DIOCloseStrm(UInt64 dwStrmId)
        {
            MyLog4Net.ILogExtension.DebugWithDebugView(MyLog4Net.Container.Instance.Log, "IVXStreamIOSDKProtocol StrmRealStop dwStrmId:" + dwStrmId);
            UInt32 retVal = IVXStreamIOSDKProtocol.StrmRealStop(dwStrmId);

            if (retVal > 0)
            {
                DIO_GetError((uint)retVal);
            }

            MyLog4Net.ILogExtension.DebugWithDebugView(MyLog4Net.Container.Instance.Log, "IVXStreamIOSDKProtocol StrmRealStop ret:" + retVal);
            return(retVal);
        }
Example #6
0
        public uint DIOInit()
        {
            MyLog4Net.ILogExtension.DebugWithDebugView(MyLog4Net.Container.Instance.Log, "IVXStreamIOSDKProtocol StrmInit ");
            UInt32 retVal = IVXStreamIOSDKProtocol.StrmInit();

            if (retVal > 0)
            {
                DIO_GetError(retVal);
            }

            MyLog4Net.ILogExtension.DebugWithDebugView(MyLog4Net.Container.Instance.Log, "IVXStreamIOSDKProtocol StrmInit ret:" + 0);
            return(0);
        }
Example #7
0
        public uint DIOStartRealPlayStrm(uint loginid, string pChannelId, IntPtr hWnd, out UInt64 pdwRealStrmId)
        {
            m_STATENOTECALLBACK = OnSTATENOTECALLBACK;
            if (pChannelId.Contains(" "))
            {
                pChannelId = pChannelId.Substring(pChannelId.LastIndexOf(' ') + 1);
            }
            MyLog4Net.ILogExtension.DebugWithDebugView(MyLog4Net.Container.Instance.Log, "IVXStreamIOSDKProtocol StrmRealStartPlay loginid:" + loginid + ",pChannelId:" + pChannelId + ",hWnd:" + hWnd.ToInt64());
            UInt64 retVal = IVXStreamIOSDKProtocol.StrmRealStartPlay(loginid, hWnd, pChannelId, m_STATENOTECALLBACK, IntPtr.Zero, out pdwRealStrmId);

            if (retVal > 0)
            {
                DIO_GetError((uint)retVal);
            }

            MyLog4Net.ILogExtension.DebugWithDebugView(MyLog4Net.Container.Instance.Log, "IVXStreamIOSDKProtocol StrmRealStartPlay ret:" + retVal + ",pdwRealStrmId:" + pdwRealStrmId);
            return((uint)retVal);
        }
Example #8
0
        public uint DIOLoginDevice(uint dwConnType, string pIp,
                                   ushort uPort, string pUser, string pPassword, uint dwTimeout, out uint pdwLoginId)
        {
            MyLog4Net.ILogExtension.DebugWithDebugView(MyLog4Net.Container.Instance.Log, string.Format("IVXStreamIOSDKProtocol StrmLogin dwConnType:{0}"
                                                                                                       + ",pIp:{1}"
                                                                                                       + ",uPort:{2}"
                                                                                                       + ",pUser:{3}"
                                                                                                       + ",pPassword:{4}"
                                                                                                       + ",dwTimeout:{5}"
                                                                                                       , dwConnType
                                                                                                       , pIp
                                                                                                       , uPort
                                                                                                       , pUser
                                                                                                       , pPassword
                                                                                                       , dwTimeout));
            if ((E_VDA_NET_STORE_DEV_PROTOCOL_TYPE)dwConnType == E_VDA_NET_STORE_DEV_PROTOCOL_TYPE.E_DEV_PROTOCOL_CONTYPE_GB28181_PROTOCOL)
            {
                IntPtr ServerIp = Marshal.StringToHGlobalAnsi(pIp);
                IntPtr RtpRecIp = Marshal.StringToHGlobalAnsi("192.168.137.121");
                UInt32 retVal   = IVXStreamIOSDKProtocol.StrmConnect((E_VDA_NET_STORE_DEV_PROTOCOL_TYPE)dwConnType, ServerIp, uPort, RtpRecIp, 6006);
                pdwLoginId = 1;
                if (retVal > 0)
                {
                    pdwLoginId = 0;
                    DIO_GetError(retVal);
                }

                MyLog4Net.ILogExtension.DebugWithDebugView(MyLog4Net.Container.Instance.Log, "IVXStreamIOSDKProtocol StrmConnect ret:" + retVal + ",pdwLoginId:" + pdwLoginId);
                return(retVal);
            }
            else
            {
                UInt32 retVal = IVXStreamIOSDKProtocol.StrmLogin((E_VDA_NET_STORE_DEV_PROTOCOL_TYPE)dwConnType, pIp, uPort, pUser, pPassword, out pdwLoginId);

                if (retVal > 0)
                {
                    pdwLoginId = 0;
                    DIO_GetError(retVal);
                }

                MyLog4Net.ILogExtension.DebugWithDebugView(MyLog4Net.Container.Instance.Log, "IVXStreamIOSDKProtocol StrmLogin ret:" + retVal + ",pdwLoginId:" + pdwLoginId);
                return(retVal);
            }
        }
Example #9
0
        public System.Drawing.Image DIOSnapPictureEx(UInt64 dwStrmId)
        {
            MyLog4Net.ILogExtension.DebugWithDebugView(MyLog4Net.Container.Instance.Log, "IVXStreamIOSDKProtocol StrmGrabPictureData dwStrmId:" + dwStrmId);


            int    buflen     = Common.MAX_PIC_DATA_LEN;
            IntPtr picbuf     = IntPtr.Zero;
            int    picdatalen = 0;

            uint retVal = IVXStreamIOSDKProtocol.StrmGrabPictureData(dwStrmId, picbuf, out picdatalen, eSNAP_TYPE.SNAP_BMP);

            if (picdatalen > buflen && picdatalen > 0)
            {
                if (picbuf != IntPtr.Zero)
                {
                    Marshal.FreeHGlobal(picbuf);
                }

                buflen     = picdatalen;
                picbuf     = Marshal.AllocHGlobal((int)buflen);
                picdatalen = 0;
                retVal     = IVXStreamIOSDKProtocol.StrmGrabPictureData(dwStrmId, picbuf, out picdatalen, eSNAP_TYPE.SNAP_BMP);
            }

            if (retVal > 0)
            {
                DIO_GetError(retVal);
            }
            System.Drawing.Image img = null;//DataModel.Common.GetImage(picbuf, (int)buflen);
            if (picbuf != IntPtr.Zero)
            {
                img = Common.GetImage(picbuf, (int)buflen);
                Marshal.FreeHGlobal(picbuf);
            }

            MyLog4Net.ILogExtension.DebugWithDebugView(MyLog4Net.Container.Instance.Log, "IVXStreamIOSDKProtocol StrmGrabPictureData ret:" + 0);

            return(img);
        }
Example #10
0
        public List <TDIO_StrmFileInfo> DIOQueryFileList(uint loginid, string pChannelId, DateTime st, DateTime et)
        {
            MyLog4Net.ILogExtension.DebugWithDebugView(MyLog4Net.Container.Instance.Log, "IVXStreamIOSDKProtocol StrmGetVideoInfo loginid:" + loginid + ",pChannelId:" + pChannelId + ",st:" + st.ToString("yyyyMMddHHmmss") + ",et:" + et.ToString("yyyyMMddHHmmss"));
            IntPtr ptr    = Marshal.AllocHGlobal(1000);
            uint   ChlNum = 0;
            TDIO_QueryFileCondition query = new TDIO_QueryFileCondition()
            {
                tStart = DataModel.Common.ConvertLinuxTime(st),
                tStop  = DataModel.Common.ConvertLinuxTime(et),
                szRest = "",
            };

            IVXStreamIOSDKProtocol.StrmGetVideoNum(loginid, pChannelId, ref query, out ChlNum);
            IntPtr pchlinfo = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(TDIO_StrmFileInfo)) * (int)ChlNum);
            uint   retVal   = IVXStreamIOSDKProtocol.StrmGetVideoInfo(loginid, pChannelId, ref query, ChlNum, pchlinfo);

            if (retVal > 0)
            {
                DIO_GetError(retVal);
            }
            List <TDIO_StrmFileInfo> ret = new List <TDIO_StrmFileInfo>();
            StringBuilder            sb  = new StringBuilder();

            for (int i = 0; i < ChlNum; i++)
            {
                TDIO_StrmFileInfo temp = (TDIO_StrmFileInfo)Marshal.PtrToStructure(pchlinfo + Marshal.SizeOf(typeof(TDIO_StrmFileInfo)) * i, typeof(TDIO_StrmFileInfo));
                if (temp.qwFileSize == 0)
                {
                    continue;
                }
                ret.Add(temp);
                sb.AppendLine(string.Format("szFileId:{0},tStart:{1},tStop:{2},qwFileSize:{3}", temp.szFileId, temp.tStart, temp.tStop, temp.qwFileSize));
            }

            MyLog4Net.ILogExtension.DebugWithDebugView(MyLog4Net.Container.Instance.Log, "IVXStreamIOSDKProtocol StrmGetVideoInfo ret:" + 0 + ",list:" + sb.ToString());
            return(ret);
        }
Example #11
0
        public bool GetPlayResolution(UInt64 dwStrmId, out UInt32 pdwWidth, out UInt32 pdwHeight)
        {
            MyLog4Net.ILogExtension.DebugWithDebugView(MyLog4Net.Container.Instance.Log, string.Format("IVXStreamIOSDKProtocol StrmGetResolution dwStrmId:{0}"
                                                                                                       , dwStrmId
                                                                                                       ));

            uint retVal = IVXStreamIOSDKProtocol.StrmGetResolution(dwStrmId, out pdwWidth, out pdwHeight);

            if (retVal > 0)
            {
                // 调用失败,抛异常
                DIO_GetError(retVal);
            }


            MyLog4Net.ILogExtension.DebugWithDebugView(MyLog4Net.Container.Instance.Log, string.Format("IVXStreamIOSDKProtocol StrmGetResolution ret:{0}"
                                                                                                       + ",pdwWidth:{1}"
                                                                                                       + ",pdwHeight:{2}"
                                                                                                       , retVal
                                                                                                       , pdwWidth
                                                                                                       , pdwHeight
                                                                                                       ));
            return(retVal > 0);
        }