public void hm_server_get_user_infoTest() { UInt32 iResult = 0; UInt32 Temp_iResult = 0; try { IntPtr i; 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; Temp_iResult = SDK_HuaMai.hm_server_connect(iServerInfo, ref intptrServerInfo, 0, 0); Temp_iResult = SDK_HuaMai.hm_server_get_device_list(intptrServerInfo); _USER_INFO userInfo = new _USER_INFO(); IntPtr iUserInfo = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(_USER_INFO))); int intLength = Marshal.SizeOf(typeof(_USER_INFO)); iResult = SDK_HuaMai.hm_server_get_user_info(intptrServerInfo, ref iUserInfo); 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 static extern UInt32 hm_server_get_user_info(IntPtr iServer, ref _USER_INFO userInfo);