Exemplo n.º 1
0
        static void Main(string[] args)
        {
            // Uncomment the code that's required
#if UseChooser
            // choose the device
            string id = ASCOM.DriverAccess.Telescope.Choose("");
            if (string.IsNullOrEmpty(id))
            {
                return;
            }
            // create this device
            ASCOM.DriverAccess.Telescope device = new ASCOM.DriverAccess.Telescope(id);
#else
            // this can be replaced by this code, it avoids the chooser and creates the driver class directly.
            ASCOM.DriverAccess.ObservingConditions device = new ASCOM.DriverAccess.ObservingConditions("ASCOM.Wise40.VantagePro.ObservingConditions");
#endif
            // now run some tests, adding code to your driver so that the tests will pass.
            // these first tests are common to all drivers.
            Console.WriteLine("name " + device.Name);
            Console.WriteLine("description " + device.Description);
            Console.WriteLine("driverInfo " + device.DriverInfo);
            Console.WriteLine("driverVersion " + device.DriverVersion);

            // TODO add more code to test the driver.
            device.Connected = true;


            device.Connected = false;
            Console.WriteLine("Press Enter to finish");
            Console.ReadLine();
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            // Uncomment the code that's required
#if UseChooser
            // choose the device
            string id = ASCOM.DriverAccess.Telescope.Choose("");
            if (string.IsNullOrEmpty(id))
            {
                return;
            }
            // create this device
            ASCOM.DriverAccess.Telescope device = new ASCOM.DriverAccess.Telescope(id);
#else
            // this can be replaced by this code, it avoids the chooser and creates the driver class directly.
            ASCOM.DriverAccess.Telescope device = new ASCOM.DriverAccess.Telescope("ASCOM.PushToGo.Telescope");
#endif
            // now run some tests, adding code to your driver so that the tests will pass.
            // these first tests are common to all drivers.
            Console.WriteLine("name " + device.Name);
            Console.WriteLine("description " + device.Description);
            Console.WriteLine("DriverInfo " + device.DriverInfo);
            Console.WriteLine("driverVersion " + device.DriverVersion);

            device.Connected = true;

            Console.WriteLine("CurrentPos: " + device.RightAscension + " " + device.Declination);
            Console.WriteLine("CurrentAltAzPos: " + device.Altitude + " " + device.Azimuth);

            Console.WriteLine("PierSide: " + device.SideOfPier.ToString());

            if (device.AtPark)
            {
                device.Unpark();
            }

            device.Tracking = true;

            Console.WriteLine("Test slewing");
            device.SlewToAltAz(15, 50);

            Console.WriteLine("CurrentAltAzPos: " + device.Altitude + " " + device.Azimuth);

            device.GuideRateDeclination = 0.00208903731;

            Console.WriteLine("GuideRate: >" + device.CommandString("speed guide", false) + "<");
            Console.WriteLine("GuideRate: >" + device.CommandString("speed guide", false) + "<");
            Console.WriteLine("GuideRate: >" + device.CommandString("speed guide", false) + "<");
            Console.WriteLine("GuideRate: >" + device.CommandString("speed guide", false) + "<");
            Console.WriteLine("GuideRate: " + device.GuideRateDeclination);

            //Thread.Sleep(500);
            //device.SetupDialog(); // show setup

            //Console.WriteLine("Test homing");
            //device.Park();

            device.Connected = false;
            Console.WriteLine("Press Enter to finish");
            Console.ReadLine();
        }
Exemplo n.º 3
0
        private void buttonConnect_Click(object sender, EventArgs e)
        {
            if (IsConnected)
            {
                timer1.Enabled   = false;
                driver.Connected = false;
            }
            else
            {
                try
                {
                    driver           = new ASCOM.DriverAccess.Telescope(Properties.Settings.Default.DriverId);
                    driver.Connected = true;
                }
                catch (System.IO.IOException ex)
                {
                    //ShowDialog("Connected Set", ex.Message + "\r\n");
                }
                catch (UnauthorizedAccessException ex)
                {
                    //tl.LogMessage("Connected Set", ex.Message + "\r\n");
                }
                catch (System.InvalidOperationException ex)
                {
                    //.LogMessage("Connected Set", ex.Message + "\r\n");
                }

                if (driver.Connected)
                {
                    timer1.Enabled = true;
                }
            }
            SetUIState();
        }
Exemplo n.º 4
0
        static void Main(string[] args)
        {
            // Uncomment the code that's required
            string id = string.Empty;

            // choose the device
            using (ASCOM.Utilities.Chooser chooser = new Utilities.Chooser())
            {
                chooser.DeviceType = "Telescope";
                id = chooser.Choose(string.Empty);
            }

            if (string.IsNullOrEmpty(id))
            {
                return;
            }
            // create this device
            ASCOM.DriverAccess.Telescope device = new ASCOM.DriverAccess.Telescope(id);

            // now run some tests, adding code to your driver so that the tests will pass.
            // these first tests are common to all drivers.
            Console.WriteLine("name " + device.Name);
            Console.WriteLine("description " + device.Description);
            Console.WriteLine("DriverInfo " + device.DriverInfo);
            Console.WriteLine("driverVersion " + device.DriverVersion);

            device.SetupDialog();
            // TODO add more code to test the driver.
            device.Connected = true;

            device.Connected = false;
            Console.WriteLine("Press Enter to finish");
            Console.ReadLine();
        }
Exemplo n.º 5
0
        private void Dispose(bool disposing)
        {
            if (disposed)
            {
                return;
            }

            if (disposing)
            {
                // cleanup managed resources (none to cleanup for now)
            }

            // Clean up the tracelogger and util objects
            if (m_mount != null)
            {
                SharedResources.DisconnectMount();
                m_mount  = null;
                m_camera = null;
            }

            SharedResources.PutTraceLogger();
            tl = null;

            utilities.Dispose();
            utilities = null;
            astroUtilities.Dispose();
            astroUtilities = null;
            transform.Dispose();
            transform = null;

            disposed = true;
        }
Exemplo n.º 6
0
        static void Main(string[] args)
        {
            // Uncomment the code that's required
#if UseChooser
            // choose the device
            string id = ASCOM.DriverAccess.Telescope.Choose("");
            if (string.IsNullOrEmpty(id))
                return;
            // create this device
            ASCOM.DriverAccess.Telescope device = new ASCOM.DriverAccess.Telescope(id);
#else
            // this can be replaced by this code, it avoids the chooser and creates the driver class directly.
            ASCOM.DriverAccess.Telescope device = new ASCOM.DriverAccess.Telescope("ASCOM.Sepikascope001.Telescope");
#endif
            // now run some tests, adding code to your driver so that the tests will pass.
            // these first tests are common to all drivers.
            Console.WriteLine("name " + device.Name);
            Console.WriteLine("description " + device.Description);
            Console.WriteLine("DriverInfo " + device.DriverInfo);
            Console.WriteLine("driverVersion " + device.DriverVersion);

            // TODO add more code to test the driver.
            device.Connected = true;


            device.Connected = false;
            Console.WriteLine("Press Enter to finish");
            Console.ReadLine();
        }
 public override bool RunSetupDialog()
 {
     _oat = new ASCOM.DriverAccess.Telescope("ASCOM.OpenAstroTracker.Telescope");
     _oat.SetupDialog();
     _oat.Dispose();
     _oat = null;
     return(true);
 }
 public void TestDriverProperties()
 {
     using (var device = new ASCOM.DriverAccess.Telescope("ASCOM.EQ500X.Telescope"))
     {
         Assert.AreEqual("Omegon EQ500X", device.Name);
         Assert.AreEqual("ASCOM Telescope Driver for EQ500X.", device.Description);
         Assert.AreEqual("1.2", device.DriverVersion);
         Assert.AreEqual("Omegon EQ500X ASCOM Driver v1.2", device.DriverInfo);
     }
 }
        public ASCOMCommunicationHandler(string device)
        {
            Log.WriteLine($"COMMFACTORY: Creating ASCOM handler for {device} ...");
            _oat = new ASCOM.DriverAccess.Telescope("ASCOM.OpenAstroTracker.Telescope");

            foreach (var action in _oat.SupportedActions)
            {
                Log.WriteLine($"COMMFACTORY: ASCOM handler supported action: {action} ...");
            }
            _oat.Action("Serial:PassThroughCommand", "I#");
        }
Exemplo n.º 10
0
 private void buttonConnect_Click(object sender, EventArgs e)
 {
     if (IsConnected)
     {
         driver.Connected = false;
     }
     else
     {
         driver           = new ASCOM.DriverAccess.Telescope(Properties.Settings.Default.DriverId);
         driver.Connected = true;
     }
     SetUIState();
 }
Exemplo n.º 11
0
 private void buttonConnect_Click(object sender, EventArgs e)
 {
     if (IsConnected)
     {
         driver.Connected = false;
     }
     else
     {
         driver = new ASCOM.DriverAccess.Telescope(Properties.Settings.Default.DriverId);
         driver.Connected = true;
     }
     SetUIState();
 }
Exemplo n.º 12
0
        private void buttonChoose_Click(object sender, EventArgs e)
        {
            string choice = ASCOM.DriverAccess.Telescope.Choose(Properties.Settings.Default.DriverId);

            if (choice != Properties.Settings.Default.DriverId)
            {
                Properties.Settings.Default.DriverId = choice;
                if (driver != null)
                {
                    driver.Dispose();
                    driver = null;
                }
            }
            SetUIState();
        }
Exemplo n.º 13
0
        /// <summary>
        /// Wrapper to reset telescope driver
        /// Later system would reinitiate it itself
        /// </summary>
        public void Reset()
        {
            Connected_flag = false;

            curAzimuth        = -1;
            curAltitude       = -100;
            curRightAscension = -100;
            curDeclination    = -100;
            curSiderealTime   = -100;
            curPierSideStatus = PierSide.pierUnknown;

            curAtPark   = false;
            curTracking = false;

            objTelescope = null;
        }
Exemplo n.º 14
0
 public void TestSimulation()
 {
     using (var device = new ASCOM.DriverAccess.Telescope("ASCOM.EQ500X.Telescope"))
     {
         bool dummy = false;
         Assert.IsFalse(device.Connected);
         Assert.IsFalse(device.CommandBool("isSimulated", dummy));
         Assert.IsTrue(device.CommandBool("Simulated", true));
         Assert.IsTrue(device.CommandBool("isSimulated", dummy));
         device.Connected = true;
         Assert.IsTrue(device.Connected);
         Assert.IsTrue(device.CommandBool("isSimulated", dummy));
         device.Connected = false;
         Assert.IsFalse(device.Connected);
         Assert.IsTrue(device.CommandBool("isSimulated", dummy));
         Assert.IsFalse(device.CommandBool("Simulated", false));
         Assert.IsFalse(device.CommandBool("isSimulated", dummy));
     }
 }
Exemplo n.º 15
0
 public void TestConnection()
 {
     using (var device = new ASCOM.DriverAccess.Telescope("ASCOM.EQ500X.Telescope"))
     {
         bool dummy = false;
         Assert.IsFalse(device.Connected);
         Assert.IsFalse(device.CommandBool("isSimulated", dummy));
         try
         {
             device.Connected = true;
             //Assert.IsTrue(device.Connected);
             //Assert.IsTrue(device.CommandBool("isSimulated", dummy));
             device.Connected = false;
         }
         catch (Exception) { }
         Assert.IsFalse(device.Connected);
         Assert.IsFalse(device.CommandBool("isSimulated", dummy));
     }
 }
Exemplo n.º 16
0
        public static void FreeMount()
        {
            lock (lockObject)
            {
                Debug.Assert(MountUseCnt == 0);

                if (s_mount != null)
                {
                    s_mount.Dispose();
                    s_mount = null;
                }

                if (s_switch != null)
                {
                    s_switch.Dispose();
                    s_switch = null;
                }
            }
        }
Exemplo n.º 17
0
        private void buttonConnect_Click(object sender, EventArgs e)
        {
            if (IsConnected)
            {
                driver.Connected = false;
            }
            else
            {
                driver           = new ASCOM.DriverAccess.Telescope(Properties.Settings.Default.DriverId);
                driver.Connected = true;
                textBox1.Text    = "";

                AzimuthBox.Text    = driver.Azimuth.ToString();
                AltitudeBox.Text   = driver.Altitude.ToString();
                AzimuthInput.Text  = driver.Azimuth.ToString();
                AltitudeInput.Text = driver.Altitude.ToString();
            }
            SetUIState();
        }
 private void buttonConnect_Click(object sender, EventArgs e)
 {
     if (IsConnected)
     {
         driver.Connected = false;
     }
     else
     {
         try
         {
             driver           = new ASCOM.DriverAccess.Telescope(Properties.Settings.Default.DriverId);
             driver.Connected = true;
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message);
         }
     }
     SetUIState();
 }
Exemplo n.º 19
0
        private static void InstantiateMount()
        {
            string mountDriverId, switchDriverId;
            short  switchIdx;

            GetMountDriverIds(out mountDriverId, out switchDriverId, out switchIdx);

            if (mountDriverId.Length == 0)
            {
                throw new InvalidOperationException("Missing mount selection");
            }

            ASCOM.DriverAccess.Telescope mount = null;
            ASCOM.DriverAccess.Switch    sw    = null;
            try
            {
                mount = new ASCOM.DriverAccess.Telescope(mountDriverId);
                if (switchDriverId.Length > 0)
                {
                    sw = new ASCOM.DriverAccess.Switch(switchDriverId);
                }
            }
            catch (Exception)
            {
                mount.Dispose();
                if (sw != null)
                {
                    sw.Dispose();
                }
                throw;
            }

            s_mount     = mount;
            s_switch    = sw;
            s_switchIdx = switchIdx;
        }
Exemplo n.º 20
0
 public void setUp()
 {
     device = new ASCOM.DriverAccess.Telescope("ASCOM.EQ500X.Telescope");
     device.CommandBool("Simulated", true);
 }
        private void buttonConnect_Click(object sender, EventArgs e)
        {
            if (IsConnected)
            {
                driver.Connected = false;
            }
            else
            {
                driver = new ASCOM.DriverAccess.Telescope(Properties.Settings.Default.DriverId);
                driver.Connected = true;
                textBox1.Text = "";

                AzimuthBox.Text = driver.Azimuth.ToString();
                AltitudeBox.Text = driver.Altitude.ToString();
                AzimuthInput.Text = driver.Azimuth.ToString();
                AltitudeInput.Text = driver.Altitude.ToString();
            }
            SetUIState();
        }
 private void buttonConnect_Click(object sender, EventArgs e)
 {
     if (IsConnected)
     {
         driver.Connected = false;
     }
     else
     {
         try
         {
             driver = new ASCOM.DriverAccess.Telescope(Properties.Settings.Default.DriverId);
             driver.Connected = true;
             if (!backgroundWorker1.IsBusy)
                 backgroundWorker1.RunWorkerAsync();
         }
         catch(Exception err)
         {
             driver.Connected = false;
             MessageBox.Show(
                 string.Format("Connection to device failed"),
                 "Connection error",
                 MessageBoxButtons.OK,
                 MessageBoxIcon.Error);
         }
     }
     SetUIState();
 }
 private void Form1_FormClosing(object sender, FormClosingEventArgs e)
 {
     backgroundWorker1.CancelAsync();
     if (IsConnected)
         driver.Connected = false;
     driver.Dispose();
     driver = null;
     //pad = null;
     Properties.Settings.Default.Save();
 }
Exemplo n.º 24
0
 public void tearDown()
 {
     device.Dispose();
     device = null;
 }
Exemplo n.º 25
0
        public void TestDriverSupportedFeatures()
        {
            using (var device = new ASCOM.DriverAccess.Telescope("ASCOM.EQ500X.Telescope"))
            {
                Assert.AreEqual(0, device.SupportedActions.Count);

                /* Moving */
                //Assert.ThrowsException<ASCOM.NotConnectedException>(() => device.MoveAxis(TelescopeAxes.axisPrimary, 0));
                //Assert.ThrowsException<ASCOM.NotConnectedException>(() => device.MoveAxis(TelescopeAxes.axisSecondary, 0));
                Assert.IsTrue(device.CanMoveAxis(TelescopeAxes.axisPrimary));
                Assert.IsTrue(device.CanMoveAxis(TelescopeAxes.axisSecondary));
                Assert.IsFalse(device.CanMoveAxis(TelescopeAxes.axisTertiary));

                /* Tracking */
                Assert.IsFalse(device.CanSetDeclinationRate);
                Assert.IsFalse(device.CanSetRightAscensionRate);
                Assert.IsFalse(device.CanSetTracking);
                //Assert.ThrowsException<ASCOM.PropertyNotImplementedException>(() => device.DeclinationRate);
                Assert.ThrowsException <ASCOM.PropertyNotImplementedException>(() => device.DeclinationRate = 0);
                //Assert.ThrowsException<ASCOM.PropertyNotImplementedException>(() => device.RightAscensionRate);
                Assert.ThrowsException <ASCOM.PropertyNotImplementedException>(() => device.RightAscensionRate = 0);
                //Assert.ThrowsException<ASCOM.PropertyNotImplementedException>(() => device.Tracking);
                //Assert.ThrowsException<ASCOM.PropertyNotImplementedException>(() => device.Tracking = false);
                //Assert.ThrowsException<ASCOM.PropertyNotImplementedException>(() => device.TrackingRate);
                //Assert.ThrowsException<ASCOM.PropertyNotImplementedException>(() => device.TrackingRate = DriveRates.driveSidereal);

                /* Slewing */
                Assert.IsTrue(device.CanSlew);
                Assert.IsFalse(device.CanSlewAltAz);
                Assert.IsFalse(device.CanSlewAltAzAsync);
                Assert.IsTrue(device.CanSlewAsync);
                //Assert.ThrowsException<ASCOM.MethodNotImplementedException>(device.AbortSlew);
                Assert.ThrowsException <ASCOM.MethodNotImplementedException>(() => device.SlewToAltAz(0, 0));
                Assert.ThrowsException <ASCOM.MethodNotImplementedException>(() => device.SlewToAltAzAsync(0, 0));
                //Assert.ThrowsException<ASCOM.MethodNotImplementedException>(() => device.SlewToCoordinates(0, 0));
                //Assert.ThrowsException<ASCOM.MethodNotImplementedException>(() => device.SlewToCoordinatesAsync(0, 0));
                //Assert.ThrowsException<ASCOM.MethodNotImplementedException>(device.SlewToTarget);
                //Assert.ThrowsException<ASCOM.MethodNotImplementedException>(device.SlewToTargetAsync);
                //Assert.ThrowsException<ASCOM.PropertyNotImplementedException>(() => device.Slewing);
                Assert.ThrowsException <ASCOM.MethodNotImplementedException>(() => device.DestinationSideOfPier(0, 0));
                Assert.ThrowsException <ASCOM.PropertyNotImplementedException>(() => device.SlewSettleTime);
                Assert.ThrowsException <ASCOM.PropertyNotImplementedException>(() => device.SlewSettleTime = 0);
                //Assert.ThrowsException<ASCOM.PropertyNotImplementedException>(() => device.TargetDeclination);
                //Assert.ThrowsException<ASCOM.PropertyNotImplementedException>(() => device.TargetDeclination = 0);
                //Assert.ThrowsException<ASCOM.PropertyNotImplementedException>(() => device.TargetRightAscension);
                //Assert.ThrowsException<ASCOM.PropertyNotImplementedException>(() => device.TargetRightAscension = 0);

                /* Parking */
                Assert.IsFalse(device.CanFindHome);
                Assert.IsFalse(device.CanPark);
                Assert.IsFalse(device.CanSetPark);
                Assert.ThrowsException <ASCOM.MethodNotImplementedException>(device.FindHome);
                Assert.ThrowsException <ASCOM.MethodNotImplementedException>(device.FindHome);
                Assert.ThrowsException <ASCOM.MethodNotImplementedException>(device.SetPark);
                Assert.ThrowsException <ASCOM.MethodNotImplementedException>(device.Unpark);
                //Assert.ThrowsException<ASCOM.PropertyNotImplementedException>(() => device.AtHome);
                //Assert.ThrowsException<ASCOM.PropertyNotImplementedException>(() => device.AtPark);

                /* Guiding */
                Assert.IsTrue(device.CanPulseGuide);
                Assert.IsFalse(device.CanSetGuideRates);
                //Assert.ThrowsException<ASCOM.MethodNotImplementedException>(() => device.PulseGuide(GuideDirections.guideEast, 0));
                Assert.ThrowsException <ASCOM.PropertyNotImplementedException>(() => device.GuideRateDeclination);
                Assert.ThrowsException <ASCOM.PropertyNotImplementedException>(() => device.GuideRateDeclination = 0);
                Assert.ThrowsException <ASCOM.PropertyNotImplementedException>(() => device.GuideRateRightAscension);
                Assert.ThrowsException <ASCOM.PropertyNotImplementedException>(() => device.GuideRateRightAscension = 0);
                //Assert.ThrowsException<ASCOM.PropertyNotImplementedException>(() => device.IsPulseGuiding);

                /* Optical */
                Assert.ThrowsException <ASCOM.PropertyNotImplementedException>(() => device.ApertureArea);
                Assert.ThrowsException <ASCOM.PropertyNotImplementedException>(() => device.ApertureDiameter);
                Assert.ThrowsException <ASCOM.PropertyNotImplementedException>(() => device.ApertureArea);
                Assert.ThrowsException <ASCOM.PropertyNotImplementedException>(() => device.DoesRefraction);
                Assert.ThrowsException <ASCOM.PropertyNotImplementedException>(() => device.DoesRefraction = false);
                Assert.ThrowsException <ASCOM.PropertyNotImplementedException>(() => device.FocalLength);
            }
        }