Esempio n. 1
0
 public void SyncToCoordinates(double RightAscension, double Declination)
 {
     if (AtPark)
     {
         throw new ASCOM.InvalidOperationException("SyncToCoordinates - Parked");
     }
     if ((RightAscension < 0) | (RightAscension > 24))
     {
         throw new InvalidValueException("RightAscension", RightAscension.ToString(), "0 to 24");
     }
     if ((Declination < -90) | (Declination > 90))
     {
         throw new InvalidValueException("Declination", RightAscension.ToString(), "-90 to 90");
     }
     TargetRightAscension = RightAscension;
     TargetDeclination    = Declination;
     if (IsConnected)
     {
         SwitchProperty OnCoordSetProperty = (SwitchProperty)device.GetProperty("MOUNT_ON_COORDINATES_SET");
         if (OnCoordSetProperty != null)
         {
             OnCoordSetProperty.SetSingleValue("SYNC", true);
             NumberProperty MountEquatorialProperty = (NumberProperty)device.GetProperty("MOUNT_EQUATORIAL_COORDINATES");
             if (MountEquatorialProperty != null)
             {
                 MountEquatorialProperty.SetSingleValue("RA", RightAscension);
                 MountEquatorialProperty.SetSingleValue("DEC", Declination);
                 return;
             }
             throw new ASCOM.InvalidOperationException("SyncToCoordinates - missing MOUNT_EQUATORIAL_COORDINATES property");
         }
         throw new ASCOM.InvalidOperationException("SyncToCoordinates - missing MOUNT_ON_COORDINATES_SET property");
     }
     throw new ASCOM.InvalidOperationException("SyncToCoordinates - not connected");
 }
Esempio n. 2
0
        public void AbortExposure()
        {
            SwitchProperty property = (SwitchProperty)device.GetProperty("CCD_ABORT_EXPOSURE");

            if (property != null)
            {
                property.SetSingleValue("ABORT_EXPOSURE", true);
            }
        }
Esempio n. 3
0
 virtual protected void propertyAdded(Property property)
 {
     if (property.DeviceName == deviceName)
     {
         Log("def" + property);
         if (property.Name == "CONFIG")
         {
             configProperty = (SwitchProperty)property;
             waitFor.Hide(ref waitingForConfigProperty);
         }
         else if (property.Name == "CONNECTION")
         {
             connectionProperty = (SwitchProperty)property;
             waitFor.Hide(ref waitingForConnectionProperty);
         }
     }
     propertyChanged(property);
 }
Esempio n. 4
0
 public void Unpark()
 {
     if (IsConnected)
     {
         SwitchProperty MountParkProperty = (SwitchProperty)device.GetProperty("MOUNT_PARK");
         if (MountParkProperty != null)
         {
             MountParkProperty.SetSingleValue("UNPARKED", true);
             do
             {
                 Thread.Sleep(100);
             }while (MountParkProperty.State == Property.States.Busy);
             return;
         }
         throw new ASCOM.InvalidOperationException("Unpark - missing MOUNT_PARK property");
     }
     throw new ASCOM.InvalidOperationException("Unpark - not connected");
 }
Esempio n. 5
0
 public void AbortSlew()
 {
     if (IsConnected)
     {
         if (AtPark)
         {
             throw new ASCOM.InvalidOperationException("AbortSlew - Parked");
         }
         SwitchProperty MountAbortMotionProperty = (SwitchProperty)device.GetProperty("MOUNT_ABORT_MOTION");
         if (MountAbortMotionProperty != null)
         {
             MountAbortMotionProperty.SetSingleValue("ABORT_MOTION", true);
             return;
         }
         throw new ASCOM.InvalidOperationException("AbortSlew - missing MOUNT_ABORT_MOTION property");
     }
     throw new ASCOM.InvalidOperationException("AbortSlew - not connected");
 }
Esempio n. 6
0
        public void StartExposure(double Duration, bool Light)
        {
            if (Duration < 0.0)
            {
                throw new InvalidValueException("StartExposure", Duration.ToString(), "0.0 upwards");
            }
            if (frameWidth * horizontalBin > ccdWidth)
            {
                throw new InvalidValueException("StartExposure " + frameWidth + "*" + horizontalBin, frameWidth.ToString(), ccdWidth.ToString());
            }
            if (frameHeight * verticalBin > ccdHeight)
            {
                throw new InvalidValueException("StartExposure " + frameHeight + "*" + verticalBin, frameHeight.ToString(), ccdHeight.ToString());
            }
            if (frameLeft * horizontalBin > ccdWidth)
            {
                throw new InvalidValueException("StartExposure " + frameLeft + "*" + horizontalBin, frameLeft.ToString(), ccdWidth.ToString());
            }
            if (frameTop * verticalBin > ccdHeight)
            {
                throw new InvalidValueException("StartExposure " + frameHeight + "*" + verticalBin, frameTop.ToString(), ccdHeight.ToString());
            }
            exposureDuration = Duration;
            exposureStart    = DateTime.Now;
            cameraImageReady = false;
            firstExposure    = false;
            NumberProperty n = (NumberProperty)device.GetProperty("CCD_BIN");

            if (n != null)
            {
                ((NumberItem)n.GetItem("HORIZONTAL")).Value = horizontalBin;
                ((NumberItem)n.GetItem("VERTICAL")).Value   = verticalBin;
                n.Change();
            }
            n = (NumberProperty)device.GetProperty("CCD_FRAME");
            if (n != null)
            {
                ((NumberItem)n.GetItem("LEFT")).Value   = frameLeft * horizontalBin;
                ((NumberItem)n.GetItem("TOP")).Value    = frameTop * verticalBin;
                ((NumberItem)n.GetItem("WIDTH")).Value  = frameWidth * horizontalBin;
                ((NumberItem)n.GetItem("HEIGHT")).Value = frameHeight * verticalBin;
                n.Change();
            }
            if (hasGain)
            {
                n = (NumberProperty)device.GetProperty("CCD_GAIN");
                n.SetSingleValue("GAIN", gain);
            }
            SwitchProperty s = (SwitchProperty)device.GetProperty("CCD_FRAME_TYPE");

            if (s != null)
            {
                if (Light)
                {
                    s.SetSingleValue("LIGHT", true);
                }
                else
                {
                    s.SetSingleValue("DARK", true);
                }
            }
            s = (SwitchProperty)device.GetProperty("CCD_IMAGE_FORMAT");
            if (s != null)
            {
                s.SetSingleValue("RAW", true);
            }
            n           = (NumberProperty)device.GetProperty("CCD_EXPOSURE");
            cameraState = CameraStates.cameraExposing;
            n.SetSingleValue("EXPOSURE", Duration);
            while (cameraState == CameraStates.cameraExposing)
            {
                Thread.Sleep(100);
            }
        }
Esempio n. 7
0
        public void MoveAxis(TelescopeAxes Axis, double Rate)
        {
            if (IsConnected)
            {
                if (AtPark)
                {
                    throw new ASCOM.InvalidOperationException("MoveAxis - Parked");
                }
                if (Axis != TelescopeAxes.axisPrimary && Axis != TelescopeAxes.axisSecondary)
                {
                    throw new InvalidValueException("CanMoveAxis - Axis", Axis.ToString(), "0 to 2");
                }
                if (!(Rate == 0 || (Rate >= 1 && Rate <= 4) || (Rate >= -4 && Rate <= -1)))
                {
                    throw new InvalidValueException("CanMoveAxis - Rate", Rate.ToString(), "0, 1 to 4");
                }
                SwitchProperty SlewRateProperty = (SwitchProperty)device.GetProperty("MOUNT_SLEW_RATE");
                if (SlewRateProperty != null)
                {
                    switch ((int)Rate)
                    {
                    case 1:
                        SlewRateProperty.SetSingleValue("GUIDE", true);
                        break;

                    case 2:
                        SlewRateProperty.SetSingleValue("CENTERING", true);
                        break;

                    case 3:
                        SlewRateProperty.SetSingleValue("FIND", true);
                        break;

                    case 4:
                        SlewRateProperty.SetSingleValue("MAX", true);
                        break;
                    }
                    if (Axis == TelescopeAxes.axisPrimary)
                    {
                        SwitchProperty MotionNSProperty = (SwitchProperty)device.GetProperty("MOUNT_MOTION_DEC");
                        if (MotionNSProperty != null)
                        {
                            if (Rate > 0)
                            {
                                MotionNSProperty.SetSingleValue("NORTH", true);
                            }
                            else if (Rate < 0)
                            {
                                MotionNSProperty.SetSingleValue("SOUTH", true);
                            }
                            else
                            {
                                MotionNSProperty.SetSingleValue("NORTH", false);
                                MotionNSProperty.SetSingleValue("SOUTH", false);
                            }
                            return;
                        }
                        throw new ASCOM.InvalidOperationException("MoveAxis - missing MOUNT_MOTION_DEC property");
                    }
                    else
                    {
                        SwitchProperty MotionNSProperty = (SwitchProperty)device.GetProperty("MOUNT_MOTION_RA");
                        if (MotionNSProperty != null)
                        {
                            if (Rate > 0)
                            {
                                MotionNSProperty.SetSingleValue("WEST", true);
                            }
                            else if (Rate < 0)
                            {
                                MotionNSProperty.SetSingleValue("EAST", true);
                            }
                            else
                            {
                                MotionNSProperty.SetSingleValue("WEST", false);
                                MotionNSProperty.SetSingleValue("EAST", false);
                            }
                            return;
                        }
                        throw new ASCOM.InvalidOperationException("MoveAxis - missing MOUNT_MOTION_RA property");
                    }
                }
                throw new ASCOM.InvalidOperationException("MoveAxis - missing MOUNT_SLEW_RATE property");
            }
            throw new ASCOM.InvalidOperationException("MoveAxis - not connected");
        }