Exemple #1
0
        public ViscaPTZPosition(byte address, bool relative, ViscaPanSpeed panSpeed, ViscaTiltSpeed tiltSpeed, int panPosition, int tiltPosition)
            : base(address)
        {
            _relative      = relative;
            this.PanSpeed  = panSpeed;
            this.TiltSpeed = tiltSpeed;

            _panPositionByte1  = new ViscaVariable("PanPositionByte1", 0);
            _panPositionByte2  = new ViscaVariable("PanPositionByte2", 0);
            _panPositionByte3  = new ViscaVariable("PanPositionByte3", 0);
            _panPositionByte4  = new ViscaVariable("PanPositionByte4", 0);
            _tiltPositionByte1 = new ViscaVariable("TiltPositionByte1", 0);
            _tiltPositionByte2 = new ViscaVariable("TiltPositionByte2", 0);
            _tiltPositionByte3 = new ViscaVariable("TiltPositionByte3", 0);
            _tiltPositionByte4 = new ViscaVariable("TiltPositionByte4", 0);

            PanPosition  = panPosition;
            TiltPosition = tiltPosition;

            Append(new byte[] {
                Visca.Category.PanTilt,
                relative ? Visca.Commands.PanTiltRelative : Visca.Commands.PanTiltAbsolute,
            });
            Append(this.PanSpeed);
            Append(this.TiltSpeed);
            Append(_panPositionByte1);
            Append(_panPositionByte2);
            Append(_panPositionByte3);
            Append(_panPositionByte4);
            Append(_tiltPositionByte1);
            Append(_tiltPositionByte2);
            Append(_tiltPositionByte3);
            Append(_tiltPositionByte4);
        }
Exemple #2
0
 public ViscaPTZDownRight(byte address, ViscaPanSpeed panSpeed, ViscaTiltSpeed tiltSpeed)
     : base(address, panSpeed, tiltSpeed)
 {
     Append(new byte[] {
         Visca.Commands.PanTiltCommands.Down,
         Visca.Commands.PanTiltCommands.Right
     });
 }
Exemple #3
0
 public ViscaPTZUpLeft(byte address, ViscaPanSpeed panSpeed, ViscaTiltSpeed tiltSpeed)
     : base(address, panSpeed, tiltSpeed)
 {
     Append(new byte[] {
         Visca.Commands.PanTiltCommands.Left,
         Visca.Commands.PanTiltCommands.Up
     });
 }
Exemple #4
0
 public ViscaPTZRight(byte address, ViscaPanSpeed panSpeed, ViscaTiltSpeed tiltSpeed)
     : base(address, panSpeed, tiltSpeed)
 {
     Append(new byte[] {
         Visca.Commands.PanTiltCommands.Right,
         Visca.Commands.PanTiltCommands.VerticalStop
     });
 }
Exemple #5
0
 public ViscaPTZDown(byte address, ViscaPanSpeed panSpeed, ViscaTiltSpeed tiltSpeed)
     : base(address, panSpeed, tiltSpeed)
 {
     Append(new byte[] {
         Visca.Commands.PanTiltCommands.HorizontalStop,
         Visca.Commands.PanTiltCommands.Down
     });
 }
Exemple #6
0
 public ViscaPTZCommand(byte address, ViscaPanSpeed panSpeed, ViscaTiltSpeed tiltSpeed)
     : base(address)
 {
     this.PanSpeed  = panSpeed;
     this.TiltSpeed = tiltSpeed;
     Append(new byte[] {
         Visca.Category.PanTilt,
         Visca.Commands.PanTilt,
     });
     Append(this.PanSpeed);
     Append(this.TiltSpeed);
 }
Exemple #7
0
        public ViscaCamera(ViscaCameraId id, ViscaCameraParameters parameters, ViscaProtocolProcessor visca)
        {
            _id = id;

            if (parameters == null)
            {
                _parameters = new ViscaCameraDefaultParameters();
            }
            else
            {
                _parameters = parameters;
            }

            _visca = visca;

            _pollCommands = new List <ViscaInquiry>();

#if SSHARP
            _pollTimer = new CTimer((o) =>
#else
            _pollTimer = new Timer((o) =>
#endif
            {
                Poll();
            }, null, Timeout.Infinite, Timeout.Infinite);

            #region AE Commands Constructors

            _aeCmd     = new ViscaAEMode((byte)id, AEMode.FullAuto);
            _aeInquiry = new ViscaAEInquiry((byte)id, new Action <AEMode>(mode => { updateAE(mode); }));

            #endregion AE Commands Constructors

            #region Aperture Commands Constructors

            _apertureCmd      = new ViscaAperture((byte)id, UpDownMode.Up);
            _apertureValueCmd = new ViscaApertureValue((byte)id, 0);
            _apertureInquiry  = new ViscaApertureInquiry((byte)id, new Action <int>(position => { updateAperture(position); }));

            #endregion Aperture Commands Constructors

            #region BackLight Commands Constructors

            _backLightCmd     = new ViscaBackLight((byte)id, OnOffMode.On);
            _backLightInquiry = new ViscaBackLightInquiry((byte)id, new Action <OnOffMode>(mode => { updateBackLight(mode); }));

            #endregion BackLight Commands Constructors

            #region BGain Commands Constructors

            _bGainCmd      = new ViscaBGain((byte)id, UpDownMode.Up);
            _bGainValueCmd = new ViscaBGainValue((byte)id, 0);
            _bGainInquiry  = new ViscaBGainInquiry((byte)id, new Action <int>(position => { updateBGain(position); }));

            #endregion Gain Commands Constructors

            #region ExpComp Commands Constructors

            _expCompCmd      = new ViscaExpComp((byte)id, UpDownMode.Up);
            _expCompValueCmd = new ViscaExpCompValue((byte)id, 0);
            _expCompInquiry  = new ViscaExpCompInquiry((byte)id, new Action <int>(position => { updateExpComp(position); }));

            #endregion ExpComp Commands Constructors

            #region Focus Commands Constructors

            _focusStopCmd          = new ViscaFocusStop((byte)id);
            _focusFarCmd           = new ViscaFocusFar((byte)id);
            _focusNearCmd          = new ViscaFocusNear((byte)id);
            _focusSpeed            = new ViscaFocusSpeed(_parameters.FocusSpeedLimits);
            _focusFarWithSpeedCmd  = new ViscaFocusFarWithSpeed((byte)id, _focusSpeed);
            _focusNearWithSpeedCmd = new ViscaFocusNearWithSpeed((byte)id, _focusSpeed);
            _focusTriggerCmd       = new ViscaFocusTrigger((byte)id);
            _focusInfinityCmd      = new ViscaFocusInfinity((byte)id);

            _focusNearLimitCmd = new ViscaFocusNearLimit((byte)id, 0x1000);

            _focusAutoCmd       = new ViscaFocusAuto((byte)id, OnOffMode.On);
            _focusAutoToggleCmd = new ViscaFocusAutoToggle((byte)id);
            _focusAutoInquiry   = new ViscaFocusAutoInquiry((byte)id, new Action <OnOffMode>(mode => { updateFocusAuto(mode); }));

            _focusPositionCmd     = new ViscaFocusPosition((byte)id, 0);
            _focusPositionInquiry = new ViscaFocusPositionInquiry((byte)id, new Action <int>(position => { updateFocusPosition(position); }));

            #endregion Focus Commands Constructors

            #region Gain Commands Constructors

            _gainCmd      = new ViscaGain((byte)id, UpDownMode.Up);
            _gainValueCmd = new ViscaGainValue((byte)id, 0);
            _gainInquiry  = new ViscaGainInquiry((byte)id, new Action <int>(position => { updateGain(position); }));

            #endregion Gain Commands Constructors

            #region Iris Commands Constructors

            _irisCmd      = new ViscaIris((byte)id, UpDownMode.Up);
            _irisValueCmd = new ViscaIrisValue((byte)id, 0);
            _irisInquiry  = new ViscaIrisInquiry((byte)id, new Action <int>(position => { updateIris(position); }));

            #endregion Gain Commands Constructors

            #region Memory Commands Constructors

            _memorySetCmd    = new ViscaMemorySet((byte)id, 0);
            _memoryRecallCmd = new ViscaMemoryRecall((byte)id, 0);

            #endregion Memory Commands Constructors

            #region Mute Commands Constructors

            _muteCmd     = new ViscaMute((byte)id, OnOffMode.On);
            _muteInquiry = new ViscaMuteInquiry((byte)id, new Action <OnOffMode>(mode => { updateMute(mode); }));

            #endregion Mute Commands Constructors

            #region Power Commands Constructors

            _powerCmd     = new ViscaPower((byte)id, OnOffMode.On);
            _powerInquiry = new ViscaPowerInquiry((byte)id, new Action <OnOffMode>(mode => { updatePower(mode); }));

            #endregion Power Commands Constructors

            #region PTZ Commands Constructors

            _ptzHome            = new ViscaPTZHome((byte)id);
            _ptzPanSpeed        = new ViscaPanSpeed(_parameters.PanSpeedLimits);
            _ptzTiltSpeed       = new ViscaTiltSpeed(_parameters.TiltSpeedLimits);
            _ptzStop            = new ViscaPTZStop((byte)id, _ptzPanSpeed, _ptzTiltSpeed);
            _ptzUp              = new ViscaPTZUp((byte)id, _ptzPanSpeed, _ptzTiltSpeed);
            _ptzDown            = new ViscaPTZDown((byte)id, _ptzPanSpeed, _ptzTiltSpeed);
            _ptzLeft            = new ViscaPTZLeft((byte)id, _ptzPanSpeed, _ptzTiltSpeed);
            _ptzRight           = new ViscaPTZRight((byte)id, _ptzPanSpeed, _ptzTiltSpeed);
            _ptzUpLeft          = new ViscaPTZUpLeft((byte)id, _ptzPanSpeed, _ptzTiltSpeed);
            _ptzUpRight         = new ViscaPTZUpRight((byte)id, _ptzPanSpeed, _ptzTiltSpeed);
            _ptzDownLeft        = new ViscaPTZDownLeft((byte)id, _ptzPanSpeed, _ptzTiltSpeed);
            _ptzDownRight       = new ViscaPTZDownRight((byte)id, _ptzPanSpeed, _ptzTiltSpeed);
            _ptzAbsolute        = new ViscaPTZPosition((byte)id, false, _ptzPanSpeed, _ptzTiltSpeed, 0, 0);
            _ptzRelative        = new ViscaPTZPosition((byte)id, true, _ptzPanSpeed, _ptzTiltSpeed, 0, 0);
            _ptzPositionInquiry = new ViscaPTZPositionInquiry((byte)id, new Action <int, int>((panPosition, tiltPosition) => { updatePTZPosition(panPosition, tiltPosition); }));

            #endregion PTZ Commands Constructors

            #region RGain Commands Constructors

            _rGainCmd      = new ViscaRGain((byte)id, UpDownMode.Up);
            _rGainValueCmd = new ViscaRGainValue((byte)id, 0);
            _rGainInquiry  = new ViscaRGainInquiry((byte)id, new Action <int>(position => { updateRGain(position); }));

            #endregion RGain Commands Constructors

            #region Shutter Commands Constructors

            _shutterCmd      = new ViscaShutter((byte)id, UpDownMode.Up);
            _shutterValueCmd = new ViscaShutterValue((byte)id, 0);
            _shutterInquiry  = new ViscaShutterInquiry((byte)id, new Action <int>(position => { updateShutter(position); }));

            #endregion Gain Commands Constructors

            #region Title Commands Constructors

            _titleCmd     = new ViscaTitle((byte)id, OnOffMode.On);
            _titleInquiry = new ViscaTitleInquiry((byte)id, new Action <OnOffMode>(mode => { updateTitle(mode); }));

            #endregion Power Commands Constructors

            #region WB Commands Constructors

            _wbCmd     = new ViscaWBMode((byte)id, WBMode.Auto);
            _wbInquiry = new ViscaWBInquiry((byte)id, new Action <WBMode>(mode => { updateWB(mode); }));

            #endregion WB Commands Constructors

            #region WideDynamic Commands Constructors

            _wideDynamicCmd     = new ViscaWideDynamicMode((byte)id, OnOffMode.On);
            _wideDynamicInquiry = new ViscaWideDynamicInquiry((byte)id, new Action <OnOffMode>(mode => { updateWideDynamicMode(mode); }));

            #endregion WideDynamic Commands Constructors

            #region Zoom Commands Constructors

            _zoomStopCmd          = new ViscaZoomStop((byte)id);
            _zoomTeleCmd          = new ViscaZoomTele((byte)id);
            _zoomWideCmd          = new ViscaZoomWide((byte)id);
            _zoomSpeed            = new ViscaZoomSpeed(_parameters.ZoomSpeedLimits);
            _zoomTeleWithSpeedCmd = new ViscaZoomTeleWithSpeed((byte)id, _zoomSpeed);
            _zoomWideWithSpeedCmd = new ViscaZoomWideWithSpeed((byte)id, _zoomSpeed);
            _zoomPositionCmd      = new ViscaZoomPosition((byte)id, 0);
            _zoomPositionInquiry  = new ViscaZoomPositionInquiry((byte)id, new Action <int>(position => { updateZoomPosition(position); }));

            #endregion Zoom Commands Constructors

            _pollCommands.Add(_aeInquiry);
            _pollCommands.Add(_apertureInquiry);
            _pollCommands.Add(_backLightInquiry);
            _pollCommands.Add(_bGainInquiry);
            _pollCommands.Add(_expCompInquiry);
            _pollCommands.Add(_gainInquiry);
            _pollCommands.Add(_focusAutoInquiry);
            _pollCommands.Add(_focusPositionInquiry);
            _pollCommands.Add(_irisInquiry);
            _pollCommands.Add(_muteInquiry);
            _pollCommands.Add(_powerInquiry);
            _pollCommands.Add(_ptzPositionInquiry);
            _pollCommands.Add(_rGainInquiry);
            _pollCommands.Add(_shutterInquiry);
            _pollCommands.Add(_titleInquiry);
            _pollCommands.Add(_wbInquiry);
            _pollCommands.Add(_wideDynamicInquiry);
            _pollCommands.Add(_zoomPositionInquiry);
        }