Exemple #1
0
        public TelescopeState GetCurrentState()
        {
            var rv = new TelescopeState();
            var sw = new Stopwatch();

            try
            {
                sw.Start();

                rv.AtHome = m_Telescope.AtHome;
                rv.AtPark = m_Telescope.AtPark;

                rv.Altitude = m_Telescope.Altitude;
                rv.Azimuth = m_Telescope.Azimuth;
                rv.RightAscension = m_Telescope.RightAscension;
                rv.Declination = m_Telescope.Declination;

                rv.GuideRateRightAscension = m_Telescope.GuideRateRightAscension;
                rv.GuideRateDeclination = m_Telescope.GuideRateDeclination;
                rv.RightAscensionRate = m_Telescope.RightAscensionRate;
                rv.DeclinationRate = m_Telescope.DeclinationRate;

                try
                {
                    rv.TargetRightAscension = m_Telescope.TargetRightAscension;
                }
                catch (Exception)
                {
                    rv.TargetRightAscension = double.NaN;
                }

                try
                {
                    rv.TargetDeclination = m_Telescope.TargetDeclination;
                }
                catch (Exception)
                {
                    rv.TargetDeclination = double.NaN;
                }
            }
            catch (Exception ex)
            {
                Trace.WriteLine(ex.GetFullStackTrace());
            }
            finally
            {
                sw.Stop();
                Trace.WriteLine(string.Format("Telescope.GetCurrentState() took {0} ms", (int)sw.ElapsedMilliseconds));
            }

            return rv;
        }
        private void OnTelescopeState(TelescopeState state)
        {
            try
            {
                NativeHelpers.CurrentTelescopePosition = string.Format("{0};{1}", AstroConvert.ToStringValue(state.RightAscension, "HHh MMm SSs"), AstroConvert.ToStringValue(state.Declination, "+DDo MM' SS.T\""));
            }
            catch
            { }

            EventHelper.RaiseEvent(TelescopeStateUpdated, state);
        }
Exemple #3
0
        public void TelescopeStateUpdated(TelescopeState state)
        {
            m_LastTelescopeState = state;
            UpdateConnectedDevicesState();

            #if DEBUG
            Trace.WriteLine(state.AsSerialized().OuterXml);
            #endif
        }
Exemple #4
0
 public void TelescopeConnectionChanged(ASCOMConnectionState state)
 {
     RefreshASCOMStatusControls(state, tssASCOMTelescope);
     if (state == ASCOMConnectionState.Connected || state == ASCOMConnectionState.Ready)
     {
         tsbTelControl.Text = "Control Telescope";
         tsbTelControl.Enabled = true;
     }
     else if (state == ASCOMConnectionState.Disconnected || state == ASCOMConnectionState.Engaged)
     {
         tsbTelControl.Text = "Connect to Telescope";
         tsbTelControl.Enabled = true;
         m_LastTelescopeState = null;
         UpdateConnectedDevicesState();
     }
     else
     {
         tsbTelControl.Enabled = false;
     }
 }
 void TelescopeStateUpdated(TelescopeState state)
 {
     TelescopePositionChanged(new TelescopeEquatorialPosition()
         {
             RightAscension = state.RightAscension,
             Declination = state.Declination
         });
 }
Exemple #6
0
        void observatoryController_TelescopeStateUpdated(TelescopeState state)
        {
            if (Math.Abs(m_RAHours - state.RightAscension)/240 > 2 || Math.Abs(m_DEDegrees - state.Declination)/3600 > 2)
            {
                m_RAHours = state.RightAscension;
                m_DEDegrees = state.Declination;

                m_TelescopePositionIsKnown = false;
            }
            else
            {
                m_TelescopePositionIsKnown = true;
            }
        }