Ejemplo n.º 1
0
 private void btnCenter_Click(object sender, RoutedEventArgs e)
 {
     if (_motion != null)
     {
         _motion.MotionGotoCenter();
     }
 }
Ejemplo n.º 2
0
        public void Initialize(SettingsBase settings) //throws Exception
        {
            //Get the Foscam camera type (MJPEG or HD)
            FoscamCameraType cameraType;
            string           _cameraType = (string)settings[PTZSettings.SETTING_CAMERA_TYPE];

            if (_cameraType == null || _cameraType == "")
            {
                cameraType = DEFAULT_CAMERA_TYPE;
            }
            else
            if (string.Equals(_cameraType, SETTING_CAMERA_FOSCAM_HD, StringComparison.OrdinalIgnoreCase))
            {
                cameraType = FoscamCameraType.FoscamHD;
            }
            else if (string.Equals(_cameraType, SETTING_CAMERA_FOSCAM_MJPEG, StringComparison.OrdinalIgnoreCase))
            {
                cameraType = FoscamCameraType.FoscamMJPEG;
            }
            else
            {
                throw new ArgumentNullException(PTZSettings.SETTING_CAMERA_TYPE);
            }

            //Get the camera URL
            string url = (string)settings[PTZSettings.SETTING_CAMERA_URL];

            if (url == null || url == "")
            {
                throw new ArgumentNullException(PTZSettings.SETTING_CAMERA_URL);
            }

            //Get the username
            string username = (string)settings[PTZSettings.SETTING_CAMERA_USERNAME] ?? DEFAULT_USERNAME;

            //Get the password
            string password = (string)settings[PTZSettings.SETTING_CAMERA_PASSWORD] ?? DEFAULT_PASSWORD;

            //Create motion and zoom controllers
            _motion = FoscamMotion.CreateFoscamMotionController(cameraType, url, username, password);
            _zoom   = FoscamZoom.CreateFoscamZoomController(cameraType, url, username, password);

            //Create PTZ control UI
            _ptz = new PTZControl()
            {
                MotionController = _motion, ZoomController = _zoom
            };

            _minPanAngle = (double?)settings[PTZSettings.SETTING_MIN_PAN_ANGLE] ?? DEFAULT_MIN_PAN_ANGLE;
            _maxPanAngle = (double?)settings[PTZSettings.SETTING_MAX_PAN_ANGLE] ?? DEFAULT_MAX_PAN_ANGLE;

            _presetCount  = (int?)settings[PTZSettings.SETTING_PRESET_COUNT] ?? DEFAULT_PRESET_COUNT;
            _presetPrefix = (string)settings[PTZSettings.SETTING_PRESET_PREFIX] ?? DEFAULT_PRESET_PREFIX;

            //Unzoom
            ZoomLevel = 0;
            _motion.MotionGotoCenter();
        }