Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        public void hm_sdk_uninitTest()
        {
            UInt32 iResult = SDK_HuaMai.hm_sdk_init();

            SDK_HuaMai.hm_sdk_uninit();
            Assert.AreEqual(Convert.ToUInt32(0), iResult);
        }
Ejemplo n.º 3
0
        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 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);
        }
Ejemplo n.º 5
0
        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);
        }
Ejemplo n.º 6
0
        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);
        }
Ejemplo n.º 7
0
        public void hm_server_connectTest()
        {
            UInt32 iResult = 0;
            int    le      = 0;

            try
            {
                //le = Marshal.SizeOf(typeof(_LOGIN_SERVER_INFO));
                //SDK_HuaMai.hm_sdk_uninit();
                iResult = SDK_HuaMai.hm_sdk_init();
                _LOGIN_SERVER_INFO loginInfo = new _LOGIN_SERVER_INFO();
                //loginInfo.ip = "huamaiyun.com".ToCharArray();
                //loginInfo.port = 80;
                ////loginInfo.user = "******";
                //UTF8Encoding u = new UTF8Encoding();
                //loginInfo.user = "******".ToCharArray();
                //loginInfo.password = "******".ToCharArray();
                //loginInfo.plat_type = "pc".ToCharArray();
                //loginInfo.hard_ver = "Pentium4".ToCharArray();
                //loginInfo.soft_ver = "v1.1.0.1789".ToCharArray() ;
                //loginInfo.keep_time = 1240;
                loginInfo.ip   = "huamaiyun.com";
                loginInfo.port = 80;
                UTF8Encoding    u            = new UTF8Encoding();
                Encoding        e            = Encoding.Default;
                UnicodeEncoding une          = new UnicodeEncoding();
                Encoding        gb2312       = System.Text.Encoding.GetEncoding("gb2312");
                byte[]          b            = une.GetBytes("商丘市视频联网报警中心");
                byte[]          unicodeBytes = Encoding.Convert(Encoding.Default, Encoding.Unicode, b);
                byte[]          Temp_b       = Encoding.Convert(Encoding.Unicode, Encoding.UTF8, unicodeBytes);
                //byte[] Temp_b = new byte[unicodeBytes.Length+1];
                //for (int i = 0; i < unicodeBytes.Length; i++)
                //{
                //    Temp_b[i] = unicodeBytes[i];
                //}
                //for (int i = unicodeBytes.Length; i < Temp_b.Length; i++)
                //{
                //    Temp_b[i] = 0;
                //}
                //loginInfo.user = Encoding.UTF8.GetString(Encoding.Unicode.GetBytes("商丘市视频联网报警中心"));   //成功
                //loginInfo.password = "******";


                loginInfo.user     = "******";    //成功
                loginInfo.password = "******";

                //loginInfo.user = u.GetString(Encoding.Unicode.GetBytes("商丘市视频联网报警中心"));
                //loginInfo.user = u.GetString(u.GetBytes("鍟嗕笜甯傝棰戣仈缃戞姤璀︿腑蹇"));
                //loginInfo.user = u.GetString(b);
                //b = e.GetBytes("2299579");
                //unicodeBytes = Encoding.Convert(Encoding.Default, Encoding.Unicode, b);
                //loginInfo.password = u.GetString(unicodeBytes);
                //loginInfo.password = "******";
                //loginInfo.user = u.GetString(u.GetBytes());
                //loginInfo.user = Marshal.StringToHGlobalAnsi(u.GetString(Temp_b));
                //loginInfo.user = "******";
                //loginInfo.password = "******";
                loginInfo.plat_type = "pc";
                loginInfo.hard_ver  = "Pentium4";
                loginInfo.soft_ver  = "v1.1.0.1789";
                //loginInfo.keep_time = 1;
                IntPtr intptrServerInfo = IntPtr.Zero;
                ////int intErrlog = 0;
                ////UInt32 uiErrlogLength = 0;
                IntPtr iServerInfo = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(_LOGIN_SERVER_INFO)));
                ////IntPtr i = Marshal.AllocHGlobal(nSizeInfoLength);
                Marshal.StructureToPtr(loginInfo, iServerInfo, false);
                string strErr = "";
                //int intErrLength = 0;
                ////int le = Marshal.SizeOf(typeof(_LOGIN_SERVER_INFO));
                ////le = Marshal.SizeOf(typeof(loginInfo.user));
                //le = Marshal.SizeOf(typeof(UInt32));
                //le = Marshal.SizeOf(typeof(ushort));
                ////le = Marshal.SizeOf(typeof(_LOGIN_SERVER_INFO));
                ////le = Marshal.SizeOf(typeof(_LOGIN_SERVER_INFO));
                ////le = Marshal.SizeOf(typeof(_LOGIN_SERVER_INFO));
                ////le = Marshal.SizeOf(typeof(_LOGIN_SERVER_INFO));
                ////le = Marshal.SizeOf(typeof(_LOGIN_SERVER_INFO));
                le      = Marshal.SizeOf(typeof(_LOGIN_SERVER_INFO));
                iResult = SDK_HuaMai.hm_server_connect(iServerInfo, ref intptrServerInfo, 0, 0);
                SDK_HuaMai.hm_server_disconnect(intptrServerInfo);
            }
            catch (Exception ex)
            {
                iResult = 999999;
            }
            finally
            {
                SDK_HuaMai.hm_sdk_uninit();
            }



            Assert.AreEqual(Convert.ToUInt32(0), iResult);
            //Assert.AreEqual(0, le);
        }