示例#1
0
        //public OnvifPtz(string ip, int port, string user, string password)
        //{
        //    System.Net.IPAddress.TryParse(ip, out IP);
        //    Port = port;
        //    User = user;
        //    Password = password;

        //    PtzClient = OnvifServices.GetOnvifPTZClient(IP.ToString(), Port, User, Password);
        //    MediaClient = OnvifServices.GetOnvifMediaClient(IP.ToString(), Port, User, Password);
        //}

        public OnvifPtz(string mediaUri, string ptzUri, double deviceTimeOffset, string user, string password)
        {
            User     = user;
            Password = password;

            if (string.IsNullOrEmpty(mediaUri) | string.IsNullOrEmpty(ptzUri))
            {
                throw new Exception("Media and/or PTZ URI is empty or null.  PTZ object cannot be created");
            }

            PtzClient   = OnvifServices.GetOnvifPTZClient(ptzUri, deviceTimeOffset, User, Password);
            MediaClient = OnvifServices.GetOnvifMediaClient(mediaUri, deviceTimeOffset, User, Password);
        }
示例#2
0
        /// <summary>
        /// Instantiates PTZ object with known media profile
        /// </summary>
        /// <param name="mediaUri">Camera's Media URI (from device client GetServices())</param>
        /// <param name="ptzUri">Camera's PTZ URI (from device client GetServices())</param>
        /// <param name="deviceTimeOffset">Difference between device time and client time (seconds)</param>
        /// <param name="mediaProfile">Media Profile to use</param>
        /// <param name="user">Username</param>
        /// <param name="password">Password</param>
        public OnvifPtz(string mediaUri, string ptzUri, double deviceTimeOffset, RTSP_Viewer.OnvifMediaServiceReference.Profile mediaProfile, string user, string password)
        {
            User     = user;
            Password = password;

            if (string.IsNullOrEmpty(mediaUri) | string.IsNullOrEmpty(ptzUri))
            {
                throw new Exception("Media and/or PTZ URI is empty or null.  PTZ object cannot be created");
            }

            PtzClient    = OnvifServices.GetOnvifPTZClient(ptzUri, deviceTimeOffset, User, Password);
            MediaProfile = mediaProfile;

            // Should be able to remove this once all instantiates go through this constructor (only used by GetMediaProfile - which is only necessary if a mediaProfile is not provided)
            MediaClient = OnvifServices.GetOnvifMediaClient(mediaUri, deviceTimeOffset, User, Password);
        }