public static FocuserSettings FromProfile()
        {
            string focuserID;
            double temperatureOffset;
            bool   loggerEnabled;
            double fastUpdatePeriod;

            using (Profile profile = new Profile())
            {
                profile.DeviceType = "Focuser";
                focuserID          = profile.GetValue(DriverID, _focuserIDProfileName, String.Empty, _focuserIDDefault);
                temperatureOffset  = Convert.ToDouble(profile.GetValue(DriverID, _temperatureOffsetProfileName, String.Empty, _temperatureOffsetDefault), CultureInfo.InvariantCulture);
                loggerEnabled      = Convert.ToBoolean(profile.GetValue(DriverID, _traceStateProfileName, String.Empty, _traceStateDefault));
                fastUpdatePeriod   = Convert.ToDouble(profile.GetValue(DriverID, _fastUpdateProfileName, String.Empty, _fastUpdateDefault), CultureInfo.InvariantCulture);
            }

            // Prevent the user from circumventing the valid fast update by setting the value in the profile store directly.

            fastUpdatePeriod = Math.Max(Globals.FOCUSER_FAST_UPDATE_MIN, Math.Min(fastUpdatePeriod, Globals.FOCUSER_FAST_UPDATE_MAX));

            FocuserSettings settings = new FocuserSettings
            {
                FocuserID         = focuserID,
                TemperatureOffset = temperatureOffset,
                IsLoggingEnabled  = loggerEnabled,
                FastUpdatePeriod  = fastUpdatePeriod
            };

            return(settings);
        }
Exemplo n.º 2
0
        private void SaveFocuserSettings()
        {
            FocuserSettings settings = FocuserSettings.FromProfile();

            settings.FocuserID         = FocuserManager.FocuserID;
            settings.TemperatureOffset = Globals.FocuserTemperatureOffset;
            settings.ToProfile();
        }
Exemplo n.º 3
0
        /// <summary>
        /// Write the device configuration to the  ASCOM  Profile store
        /// </summary>
        internal void SaveProfile()
        {
            FocuserSettings settings = new FocuserSettings
            {
                FocuserID         = FocuserManager.FocuserID,
                TemperatureOffset = Globals.FocuserTemperatureOffset,
                IsLoggingEnabled  = _logger.Enabled
            };

            settings.ToProfile();
        }
Exemplo n.º 4
0
        private static void LoadDeviceSettings()
        {
            TelescopeSettings scopeSettings = TelescopeSettings.FromProfile();

            TelescopeManager.SetTelescopeID(scopeSettings.TelescopeID);

            DomeSettings domeSettings = DomeSettings.FromProfile();

            DomeManager.SetDomeID(domeSettings.DomeID);
            Globals.DomeLayout                  = domeSettings.DomeLayout;
            Globals.DomeAzimuthAdjustment       = domeSettings.AzimuthAdjustment;
            Globals.UsePOTHDomeSlaveCalculation = domeSettings.UsePOTHDomeSlaveCalculation;
            Globals.FindDomeHomeAtStartup       = domeSettings.FindDomeHomeAtStartup;
            FocuserSettings focuserSettings = FocuserSettings.FromProfile();

            FocuserManager.SetFocuserID(focuserSettings.FocuserID);
            Globals.FocuserTemperatureOffset = focuserSettings.TemperatureOffset;
        }
Exemplo n.º 5
0
        public static FocuserSettings FromProfile()
        {
            string focuserID;
            double temperatureOffset;
            bool   loggerEnabled;

            using (Profile profile = new Profile())
            {
                profile.DeviceType = "Focuser";
                focuserID          = profile.GetValue(DriverID, _focuserIDProfileName, String.Empty, _focuserIDDefault);
                temperatureOffset  = Convert.ToDouble(profile.GetValue(DriverID, _temperatureOffsetProfileName, String.Empty, _temperatureOffsetDefault), CultureInfo.InvariantCulture);

                loggerEnabled = Convert.ToBoolean(profile.GetValue(DriverID, _traceStateProfileName, String.Empty, _traceStateDefault));
            }

            FocuserSettings settings = new FocuserSettings
            {
                FocuserID         = focuserID,
                TemperatureOffset = temperatureOffset,
                IsLoggingEnabled  = loggerEnabled
            };

            return(settings);
        }
Exemplo n.º 6
0
        /// <summary>
        /// Read the device configuration from the ASCOM Profile store
        /// </summary>
        internal void ReadProfile()
        {
            FocuserSettings settings = FocuserSettings.FromProfile();

            _logger.Enabled = settings.IsLoggingEnabled;
        }