Example #1
0
        public bool Init(string devName, string username, string pwd, string ip, string port)
        {
            H264_DVR_DEVICEINFO dvrdevInfo = new H264_DVR_DEVICEINFO();

            dvrdevInfo.Init();
            int        nError;
            SDK_HANDLE nLoginID = NetSDK.H264_DVR_Login(
                ip.Trim(),
                ushort.Parse(port.Trim()),
                username, pwd,
                ref dvrdevInfo,
                out nError,
                SocketStyle.TCPSOCKET);

            if (nLoginID > 0)
            {
                devInfo.szDevName     = devName;
                devInfo.lLoginID      = nLoginID;
                devInfo.nPort         = Int32.Parse(port);
                devInfo.szIpaddress   = ip;
                devInfo.szUserName    = username;
                devInfo.szPsw         = pwd;
                devInfo.NetDeviceInfo = dvrdevInfo;
                status = 1;
                return(true);
            }

            return(false);
        }
Example #2
0
        public void Login(LoginInfo logininfo)
        {
            H264_DVR_DEVICEINFO OutDev = new H264_DVR_DEVICEINFO();

            OutDev.Init();
            int nError = 0;

            loginUserId = XMNetSDK.H264_DVR_Login(logininfo.Ip, (ushort)logininfo.Port, logininfo.UserName, logininfo.Password, ref OutDev, out nError, SocketStyle.TCPSOCKET);
            if (loginUserId <= 0)
            {
                int nErr = XMNetSDK.H264_DVR_GetLastError();
                throw new Exception("[雄迈]登录失败:" + nErr);
            }
            XMNetSDK.H264_DVR_SetupAlarmChan(loginUserId);
        }