Example #1
0
        private void HuaMaiVideo_OnRecvRealTimeVideo(IntPtr iUser, IntPtr iFrmae, UInt32 err)
        {
            if (err != Convert.ToUInt32(0))
            {
                return;
            }
            if (iPort == IntPtr.Zero)
            {
                return;
            }
            var result = Marshal.PtrToStructure(iFrmae, typeof(SDK_HuaMai._FRAME_DATA));

            SDK_HuaMai._FRAME_DATA     Data = (SDK_HuaMai._FRAME_DATA)result;
            SDK_HuaMai._RAW_FRAME_TYPE Type = (SDK_HuaMai._RAW_FRAME_TYPE)Data.frame_info.frame_type;
            switch (Type)
            {
            case SDK_HuaMai._RAW_FRAME_TYPE.HME_RFT_P:
            case SDK_HuaMai._RAW_FRAME_TYPE.HME_RFT_I:
            case SDK_HuaMai._RAW_FRAME_TYPE.HME_RFT_H265_P:
            case SDK_HuaMai._RAW_FRAME_TYPE.HME_RFT_H265_I:
                SDK_HuaMai.hm_video_display_input_data(iPort, Data.frame_stream, Data.frame_len, true);
                VideoPlayCallback(new VideoPlayCallbackValue {
                    evType = Enum_VideoPlayEventType.VideoPlay
                });
                VideoPlayState = Enum_VideoPlayState.InPlayState;
                break;

            default:
                //不做操作
                break;
            }
        }
        private void btnStart_Click(object sender, EventArgs e)
        {
            UInt32 iResult = 0;

            if (!GetNode_BySN("E322213C04245"))
            {
                Release();
                return;
            }
            if (!LoginDev())
            {
                Release();
                return;
            }
            if (!OpenRealVideo())
            {
                Release();
                return;
            }
            if (!StartVideo())
            {
                Release();
            }
            SDK_HuaMai.DISPLAY_OPTION disp_op = new SDK_HuaMai.DISPLAY_OPTION();
            disp_op.dm = SDK_HuaMai.DISPLAY_MODE.HME_DM_DX;
            disp_op.pq = SDK_HuaMai.PIC_QUALITY.HME_PQ_HIGHT;
            //IntPtr iWnd = pictureBox1.Handle;
            iResult = SDK_HuaMai.hm_video_display_open_port(pictureBox1.Handle, ref disp_op, ref iPort);
            iResult = SDK_HuaMai.hm_video_display_start(iPort, 0, 0, 25);
            listBox1.Items.Add(iPort.ToString());
            intCountt = 0;
        }
        public void Init()
        {
            //MessageBox.Show(VideoPlayControl.ProgConstants.c_strHuaMaiSDKFilePath);
            //ProgConstants.c_strHuaMaiSDKFilePath = Environment.CurrentDirectory + ProgConstants.c_strHuaMaiSDKFilePath;
            UInt32 iResult      = 0;
            UInt32 Temp_iResult = 0;
            //NODE_TYPE_INFO typeInfo = NODE_TYPE_INFO.HME_NT_NODE;
            string strDevUrl = "";

            #region 基本信息初始化
            Temp_iResult = SDK_HuaMai.hm_sdk_init();
            SDK_HuaMai._LOGIN_SERVER_INFO loginInfo = new SDK_HuaMai._LOGIN_SERVER_INFO();
            loginInfo.ip   = "huamaiyun.com";
            loginInfo.port = 80;
            //loginInfo.user = u.GetString(Encoding.Unicode.GetBytes("商丘市视频联网报警中心"));   //成功
            //loginInfo.password = "******";
            //loginInfo.user = Encoding.UTF8.GetString(Encoding.Unicode.GetBytes("商丘市视频联网报警中心"));   //成功
            //loginInfo.password = "******";
            loginInfo.user      = "******";
            loginInfo.password  = "******";
            loginInfo.plat_type = "pc";
            loginInfo.hard_ver  = "Pentium4";
            loginInfo.soft_ver  = "v1.1.0.1789";
            IntPtr iServerInfo = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(SDK_HuaMai._LOGIN_SERVER_INFO)));
            Marshal.StructureToPtr(loginInfo, iServerInfo, false);
            Temp_iResult = SDK_HuaMai.hm_server_connect(iServerInfo, ref intptrServer, 0, 0);
            #endregion
            Temp_iResult = SDK_HuaMai.hm_server_get_device_list(intptrServer);
            Temp_iResult = SDK_HuaMai.hm_server_get_transfer_info(intptrServer);
            Temp_iResult = SDK_HuaMai.hm_server_get_tree(intptrServer, ref intptrTree);
            Temp_iResult = SDK_HuaMai.hm_server_get_root(intptrTree, ref iRootNode);
            Temp_iResult = SDK_HuaMai.hm_server_get_children_count(iRootNode, ref intCount);
        }
        private void Frm_Temp_TestVideoPlay_ResizeEnd(object sender, EventArgs e)
        {
            return;

            intCountResizeEnd++;
            label4.Text = intCountResizeEnd.ToString();
            if (!GetNode_BySN("E322213C04245"))
            {
                Release();
                return;
            }
            if (!LoginDev())
            {
                Release();
                return;
            }
            if (!OpenRealVideo())
            {
                Release();
                return;
            }
            if (!StartVideo())
            {
                Release();
            }
            SDK_HuaMai.DISPLAY_OPTION disp_op = new SDK_HuaMai.DISPLAY_OPTION();
            disp_op.dm = SDK_HuaMai.DISPLAY_MODE.HME_DM_DX;
            disp_op.pq = SDK_HuaMai.PIC_QUALITY.HME_PQ_HIGHT;
            //IntPtr iWnd = pictureBox1.Handle;
            iPort = IntPtr.Zero;
            SDK_HuaMai.hm_video_display_open_port(pictureBox1.Handle, ref disp_op, ref iPort);
            SDK_HuaMai.hm_video_display_start(iPort, 0, 0, 25);
            listBox1.Items.Add(iPort.ToString());
        }
        public void Init()
        {
            UInt32 iResult      = 0;
            UInt32 Temp_iResult = 0;
            //NODE_TYPE_INFO typeInfo = NODE_TYPE_INFO.HME_NT_NODE;
            string strDevUrl = "";

            #region 基本信息初始化
            Temp_iResult = SDK_HuaMai.hm_sdk_init();
            _LOGIN_SERVER_INFO loginInfo = new _LOGIN_SERVER_INFO();
            loginInfo.ip        = "huamaiyun.com";
            loginInfo.port      = 80;
            loginInfo.user      = "******";
            loginInfo.password  = "******";
            loginInfo.plat_type = "pc";
            loginInfo.hard_ver  = "Pentium4";
            loginInfo.soft_ver  = "v1.1.0.1789";
            IntPtr iServerInfo = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(_LOGIN_SERVER_INFO)));
            Marshal.StructureToPtr(loginInfo, iServerInfo, false);
            Temp_iResult = SDK_HuaMai.hm_server_connect(iServerInfo, ref intptrServer, 0, 0);
            #endregion
            Temp_iResult = SDK_HuaMai.hm_server_get_device_list(intptrServer);
            Temp_iResult = SDK_HuaMai.hm_server_get_transfer_info(intptrServer);
            Temp_iResult = SDK_HuaMai.hm_server_get_tree(intptrServer, ref intptrTree);
            Temp_iResult = SDK_HuaMai.hm_server_get_root(intptrTree, ref iRootNode);
            Temp_iResult = SDK_HuaMai.hm_server_get_children_count(iRootNode, ref intCount);
        }
        public bool GetNode_ByIndex(IntPtr iNodo, int intindex)
        {
            UInt32 Temp_iResult = 0;

            Temp_iResult = SDK_HuaMai.hm_server_get_child_at(iNodo, intindex, ref iNode);
            return(Temp_iResult == 0);
        }
        public void hm_pu_open_videoTest()
        {
            UInt32 iResult      = 0;
            UInt32 Temp_iResult = 0;

            Init();
            if (!GetNode_ByIndex(iRootNode, 3))
            {
                Release();
                Assert.Fail();
            }
            IntPtr        iDev   = IntPtr.Zero;
            _CONNECT_INFO config = new _CONNECT_INFO();

            config.ct    = CLIENT_TYPE.CT_PC;
            config.cp    = CONNECT_PRI.CPI_DEF;
            config.cm    = CONNECT_MODE.CM_DEF;
            Temp_iResult = SDK_HuaMai.hm_pu_login_ex(iNode, ref config, ref iDev);
            _OPEN_VIDEO_PARAM para = new _OPEN_VIDEO_PARAM();

            para.channel = 0;
            para.cs_type = CODE_STREAM.HMS_CS_MAJOR;
            IntPtr iUserData = Marshal.StringToHGlobalAnsi("hongdongcheng");

            para.data    = iUserData;
            para.vs_type = VIDEO_STREAM.HMS_VS_REAL;
            //para.cb_data =  OnRecvRealTimeVideo;
            IntPtr iOpenVideo = IntPtr.Zero;

            iResult = SDK_HuaMai.hm_pu_open_video(iDev, ref para, ref iOpenVideo);
            Release();
            Assert.AreEqual(Convert.ToUInt32(0), iResult);
        }
        public void hm_sdk_uninitTest()
        {
            UInt32 iResult = SDK_HuaMai.hm_sdk_init();

            SDK_HuaMai.hm_sdk_uninit();
            Assert.AreEqual(Convert.ToUInt32(0), iResult);
        }
        public void hm_server_connectTest1()
        {
            UInt32 iResult      = 0;
            UInt32 Temp_iResult = 0;

            try
            {
                Temp_iResult = SDK_HuaMai.hm_sdk_init();
                _LOGIN_SERVER_INFO loginInfo = new _LOGIN_SERVER_INFO();
                loginInfo.ip        = "huamaiyun.com";
                loginInfo.port      = 80;
                loginInfo.user      = "******";
                loginInfo.password  = "******";
                loginInfo.plat_type = "pc";
                loginInfo.hard_ver  = "Pentium4";
                loginInfo.soft_ver  = "v1.1.0.1789";
                IntPtr iServerInfo = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(_LOGIN_SERVER_INFO)));
                Marshal.StructureToPtr(loginInfo, iServerInfo, false);
                IntPtr intptrServerInfo = IntPtr.Zero;
                iResult      = SDK_HuaMai.hm_server_connect(iServerInfo, ref intptrServerInfo, 0, 0);
                Temp_iResult = SDK_HuaMai.hm_server_disconnect(intptrServerInfo);
            }
            catch (Exception ex)
            {
                iResult = 999999;
            }
            finally
            {
                Temp_iResult = SDK_HuaMai.hm_sdk_uninit();
            }
            Assert.AreEqual(Convert.ToUInt32(0), iResult);
        }
        public void hm_pu_start_videoTest()
        {
            UInt32 iResult = 0;

            Init();
            if (!GetNode_ByIndex(iRootNode, 3))
            {
                Release();
                Assert.Fail();
            }
            if (!LoginDev())
            {
                Release();
                Assert.Fail();
            }
            if (!OpenRealVideo())
            {
                Release();
                Assert.Fail();
            }
            videoRes = new OPEN_VIDEO_RES();
            iResult  = SDK_HuaMai.hm_pu_start_video(iOpenVideo, ref videoRes);
            Thread.Sleep(100000);
            Release();
            Assert.AreEqual(Convert.ToUInt32(0), iResult);
        }
        public void Release()
        {
            UInt32 Temp_iResult = 0;

            Temp_iResult = SDK_HuaMai.hm_server_release_tree(intptrTree);
            Temp_iResult = SDK_HuaMai.hm_server_disconnect(intptrServer);
        }
 private void button1_Click(object sender, EventArgs e)
 {
     SDK_HuaMai.hm_video_display_close_port(iPort);
     iPort = IntPtr.Zero;
     SDK_HuaMai.hm_pu_stop_video(iOpenVideo);
     SDK_HuaMai.hm_pu_close_video(iOpenVideo);
     SDK_HuaMai.hm_pu_logout(iDev);
 }
        public void hm_server_get_child_atTest()
        {
            UInt32 iResult      = 0;
            UInt32 Temp_iResult = 0;

            try
            {
                #region 基本记录信息
                Temp_iResult = SDK_HuaMai.hm_sdk_init();
                _LOGIN_SERVER_INFO loginInfo = new _LOGIN_SERVER_INFO();
                loginInfo.ip        = "huamaiyun.com";
                loginInfo.port      = 80;
                loginInfo.user      = "******";
                loginInfo.password  = "******";
                loginInfo.plat_type = "pc";
                loginInfo.hard_ver  = "Pentium4";
                loginInfo.soft_ver  = "v1.1.0.1789";
                IntPtr iServerInfo = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(_LOGIN_SERVER_INFO)));
                Marshal.StructureToPtr(loginInfo, iServerInfo, false);
                IntPtr intptrServer = IntPtr.Zero;
                Temp_iResult = SDK_HuaMai.hm_server_connect(iServerInfo, ref intptrServer, 0, 0);
                #endregion
                Temp_iResult = SDK_HuaMai.hm_server_get_device_list(intptrServer);
                Temp_iResult = SDK_HuaMai.hm_server_get_transfer_info(intptrServer);
                IntPtr intptrTree = IntPtr.Zero;
                Temp_iResult = SDK_HuaMai.hm_server_get_tree(intptrServer, ref intptrTree);
                IntPtr iRootNode = IntPtr.Zero;
                Temp_iResult = SDK_HuaMai.hm_server_get_root(intptrTree, ref iRootNode);
                int intCount = 0;
                Temp_iResult = SDK_HuaMai.hm_server_get_children_count(iRootNode, ref intCount);

                string strSN  = "E322213C04245";
                IntPtr iDevSN = Marshal.StringToHGlobalAnsi(strSN);
                //IntPtr iNode = SDK_HuaMai.hm_server_find_device_by_sn(intptrTree, iDevSN);

                if (iNode == IntPtr.Zero)
                {
                    iResult = Convert.ToUInt32(1);
                }
                else
                {
                    iResult = Convert.ToUInt32(0);
                }

                Temp_iResult = SDK_HuaMai.hm_server_release_tree(intptrTree);
                Temp_iResult = SDK_HuaMai.hm_server_disconnect(intptrServer);
            }
            catch (Exception ex)
            {
                iResult = 999999;
            }
            finally
            {
                Temp_iResult = SDK_HuaMai.hm_sdk_uninit();
            }
            Assert.AreEqual(Convert.ToUInt32(0), iResult);
        }
        public bool GetNode_BySN(string strSN)
        {
            UInt32 iResult = 0;

            iResult = SDK_HuaMai.hm_server_find_device_by_sn(intptrTree, strSN, ref iNode);
            if (iResult == Convert.ToUInt32(0) && iNode != IntPtr.Zero)
            {
                return(true);
            }
            return(false);
        }
        public bool StartOpenVideo()
        {
            UInt32 iResult = 0;

            videoRes = new OPEN_VIDEO_RES();
            iResult  = SDK_HuaMai.hm_pu_start_video(iOpenVideo, ref videoRes);
            if (Convert.ToUInt32(0) == iResult)
            {
                return(true);
            }
            return(false);
        }
        public void hm_server_find_device_by_snTest()
        {
            UInt32 iResult = 0;

            Init();
            string strDevSN = "E322213C04245";
            //string strDevSN = "E3235433C04245";
            IntPtr iDevSN = Marshal.StringToHGlobalUni(strDevSN);
            IntPtr iNode  = IntPtr.Zero;

            iResult = SDK_HuaMai.hm_server_find_device_by_sn(intptrTree, strDevSN, ref iNode);
            Release();
            Assert.AreEqual(Convert.ToUInt32(0), iResult);
        }
        public bool LoginDev()
        {
            UInt32        iResult = 0;
            _CONNECT_INFO config  = new _CONNECT_INFO();

            config.ct = CLIENT_TYPE.CT_PC;
            config.cp = CONNECT_PRI.CPI_DEF;
            config.cm = CONNECT_MODE.CM_DEF;
            iResult   = SDK_HuaMai.hm_pu_login_ex(iNode, ref config, ref iDev);
            if (iResult == Convert.ToUInt32(0))
            {
                return(true);
            }
            return(false);
        }
        private void Frm_Temp_TestVideoPlay_ResizeBegin(object sender, EventArgs e)
        {
            return;

            SDK_HuaMai.hm_video_display_close_port(iPort);
            iPort = IntPtr.Zero;
            SDK_HuaMai.hm_pu_stop_video(iOpenVideo);
            SDK_HuaMai.hm_pu_close_video(iOpenVideo);
            SDK_HuaMai.hm_pu_logout(iDev);
            return;

            //SDK_HuaMai.hm_video_display_stop(iPort);
            intCountResizeBegin++;
            label3.Text = intCountResizeBegin.ToString();
        }
        public void hm_server_is_onlineTest()
        {
            UInt32 iResult  = 0;
            bool   bolOnlie = false;

            Init();
            if (!GetNode_ByIndex(iRootNode, 3))
            {
                Release();
                Assert.Fail();
            }
            iResult = SDK_HuaMai.hm_server_is_online(iNode, ref bolOnlie);
            Release();
            Assert.IsTrue(bolOnlie);
        }
Example #20
0
 public bool VideoClose()
 {
     SDK_HuaMai.hm_video_display_close_port(iPort);
     iPort = IntPtr.Zero;
     SDK_HuaMai.hm_pu_stop_video(iOpenVideo);
     SDK_HuaMai.hm_pu_close_video(iOpenVideo);
     iOpenVideo = IntPtr.Zero;
     SDK_HuaMai.hm_pu_logout(iDev);
     iDev           = IntPtr.Zero;
     VideoPlayState = Enum_VideoPlayState.NotInPlayState;
     VideoPlayCallback(new VideoPlayCallbackValue {
         evType = Enum_VideoPlayEventType.VideoClose
     });
     return(true);
 }
        public void hm_server_get_node_typeTest()
        {
            UInt32         iResult  = 0;
            NODE_TYPE_INFO typeInfo = NODE_TYPE_INFO.HME_NT_NODE;

            Init();
            if (!GetNode_ByIndex(iRootNode, 3))
            {
                Release();
                Assert.Fail();
            }
            iResult = SDK_HuaMai.hm_server_get_node_type(iNode, ref typeInfo);
            Release();
            Assert.AreEqual(NODE_TYPE_INFO.HME_NT_NODE, typeInfo);
        }
        private void OnRecvRealTimeVideo(IntPtr iUser, IntPtr iFrmae, UInt32 err)
        {
            //intCountttt++;
            //if (intCountttt > 100)
            //{
            //    return;
            //}
            if (err != Convert.ToUInt32(0))
            {
                return;
            }
            if (iPort == IntPtr.Zero)
            {
                string x = "1";
                return;
            }
            var result = Marshal.PtrToStructure(iFrmae, typeof(SDK_HuaMai._FRAME_DATA));

            SDK_HuaMai._FRAME_DATA A = (SDK_HuaMai._FRAME_DATA)result;
            //int intx = (int)A.frame_len;
            SDK_HuaMai._RAW_FRAME_TYPE xx = (SDK_HuaMai._RAW_FRAME_TYPE)A.frame_info.frame_type;
            if (A.frame_len < 10)
            {
                string zzz = "1";
            }
            switch (xx)
            {
            case SDK_HuaMai._RAW_FRAME_TYPE.HME_RFT_P:
            case SDK_HuaMai._RAW_FRAME_TYPE.HME_RFT_I:
            case SDK_HuaMai._RAW_FRAME_TYPE.HME_RFT_H265_P:
            case SDK_HuaMai._RAW_FRAME_TYPE.HME_RFT_H265_I:
                try
                {
                    SDK_HuaMai.hm_video_display_input_data(iPort, A.frame_stream, A.frame_len, true);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                }
                break;

            default:
                //不做操作
                break;
            }
        }
        public void hm_server_device_urlTest()
        {
            UInt32 iResult = 0;
            string strUrl  = "";

            Init();
            if (!GetNode_ByIndex(iRootNode, 3))
            {
                Release();
                Assert.Fail();
            }
            IntPtr iDevUrl = IntPtr.Zero;

            iResult = SDK_HuaMai.hm_server_get_device_url(iNode, ref iDevUrl);
            strUrl  = Marshal.PtrToStringAnsi(iDevUrl);
            Release();
            Assert.AreEqual("", strUrl);
        }
        public bool OpenRealVideo()
        {
            UInt32            iResult = 0;
            _OPEN_VIDEO_PARAM para    = new _OPEN_VIDEO_PARAM();

            para.channel = 0;
            para.cs_type = CODE_STREAM.HMS_CS_MAJOR;
            IntPtr iUserData = Marshal.StringToHGlobalAnsi("hongdongcheng");

            para.data    = iUserData;
            para.vs_type = VIDEO_STREAM.HMS_VS_REAL;
            para.cb_data = new SDK_HuaMai.cb_pu_data(OnRecvRealTimeVideo);
            iResult      = SDK_HuaMai.hm_pu_open_video(iDev, ref para, ref iOpenVideo);
            if (iResult == Convert.ToUInt32(0))
            {
                return(true);
            }
            return(false);
        }
        public void hm_video_display_open_portTest()
        {
            UInt32 iResult      = 0;
            UInt32 Temp_iResult = 0;

            Init();
            if (!GetNode_ByIndex(iRootNode, 3))
            {
                Release();
                Assert.Fail();
            }
            if (!LoginDev())
            {
                Release();
                Assert.Fail();
            }
            if (!OpenRealVideo())
            {
                Release();
                Assert.Fail();
            }
            if (!StartOpenVideo())
            {
                Release();
                Assert.Fail();
            }
            FrmPlay.MinimizeBox   = false;
            FrmPlay.MaximizeBox   = false;
            FrmPlay.StartPosition = FormStartPosition.CenterScreen;
            FrmPlay.Width         = 640;
            FrmPlay.Height        = 300;
            FrmPlay.Show();
            DISPLAY_OPTION disp_op = new DISPLAY_OPTION();

            disp_op.dm = DISPLAY_MODE.HME_DM_DX;
            disp_op.pq = PIC_QUALITY.HME_PQ_HIGHT;
            iResult    = SDK_HuaMai.hm_video_display_open_port(FrmPlay.Handle, ref disp_op, ref iPort);
            Thread.Sleep(10000);
            Temp_iResult = hm_video_display_stop(iPort);
            Release();
            Assert.AreEqual(Convert.ToUInt32(0), iResult);
        }
        public void hm_server_login_exTest()
        {
            UInt32 iResult = 0;

            Init();
            if (!GetNode_ByIndex(iRootNode, 3))
            {
                Release();
                Assert.Fail();
            }
            IntPtr        iDev   = IntPtr.Zero;
            _CONNECT_INFO config = new _CONNECT_INFO();

            config.ct = CLIENT_TYPE.CT_PC;
            config.cp = CONNECT_PRI.CPI_DEF;
            config.cm = CONNECT_MODE.CM_DEF;
            iResult   = SDK_HuaMai.hm_pu_login_ex(iNode, ref config, ref iDev);
            Release();
            Assert.AreEqual(Convert.ToUInt32(0), iResult);
        }
        public void hm_pu_loginTest()
        {
            UInt32 iResult = 0;

            try
            {
                IntPtr i;
                iResult = SDK_HuaMai.hm_sdk_init();
                iResult = SDK_HuaMai.hm_pu_login("huamaiyun.com", 80, "AB66616C00609", "商丘市视频联网报警中心", "2299578", out i);
            }
            catch (Exception ex)
            {
                iResult = 999999;
            }
            finally
            {
                SDK_HuaMai.hm_sdk_uninit();
            }
            Assert.AreEqual(Convert.ToUInt32(0), iResult);
        }
        public bool DisplayOpenPort()
        {
            UInt32 iResult = 0;

            FrmPlay.MinimizeBox   = false;
            FrmPlay.MaximizeBox   = false;
            FrmPlay.StartPosition = FormStartPosition.CenterScreen;
            FrmPlay.Width         = 640;
            FrmPlay.Height        = 300;
            //FrmPlay.Show();
            DISPLAY_OPTION disp_op = new DISPLAY_OPTION();

            disp_op.dm = DISPLAY_MODE.HME_DM_DX;
            disp_op.pq = PIC_QUALITY.HME_PQ_HIGHT;
            iResult    = SDK_HuaMai.hm_video_display_open_port(FrmPlay.Handle, ref disp_op, ref iPort);
            if (Convert.ToUInt32(0) == iResult)
            {
                return(true);
            }
            return(false);
        }
        public void hm_server_get_node_nameTest()
        {
            UInt32 iResult    = 0;
            string strDevName = "";

            Init();
            if (!GetNode_ByIndex(iRootNode, 9))
            {
                Release();
                Assert.Fail();
            }
            IntPtr iDevName = IntPtr.Zero;

            iResult = SDK_HuaMai.hm_server_get_node_name(iNode, ref iDevName);
            string Temp_strDevName = Marshal.PtrToStringAnsi(iDevName);

            Temp_strDevName = Temp_strDevName.Replace('?', '0');
            strDevName      = Encoding.UTF8.GetString(Encoding.Default.GetBytes(Temp_strDevName));
            //strDevName = Encoding.UTF8.GetString(Encoding.Default.GetBytes(Encoding.UTF8.GetString(Encoding.UTF8.GetBytes(Temp_strDevName))));
            Release();
            Assert.AreEqual("", strDevName);
        }
        private void button2_Click(object sender, EventArgs e)
        {
            UInt32 iResult = 0;

            intCountt++;
            bolFlagg = true;
            if (bolFlag)
            {
                this.Text = intCountt.ToString();
                if (!GetNode_BySN("E322213C04245"))
                {
                    Release();
                    return;
                }
                if (!LoginDev())
                {
                    Release();
                    return;
                }
                if (!OpenRealVideo())
                {
                    Release();
                    return;
                }
                if (!StartVideo())
                {
                    Release();
                }
                SDK_HuaMai.DISPLAY_OPTION disp_op = new SDK_HuaMai.DISPLAY_OPTION();
                disp_op.dm = SDK_HuaMai.DISPLAY_MODE.HME_DM_DX;
                disp_op.pq = SDK_HuaMai.PIC_QUALITY.HME_PQ_HIGHT;
                //IntPtr iWnd = pictureBox1.Handle;
                iResult   = SDK_HuaMai.hm_video_display_open_port(pictureBox1.Handle, ref disp_op, ref iPort);
                iResult   = SDK_HuaMai.hm_video_display_start(iPort, videoRes.image_width, videoRes.image_height, videoRes.fps);
                intCountt = 0;
            }
        }