示例#1
0
        public void Move(int newPosition)
        {
            string name = "Move:";

            CheckConnected(name, ConnectedState);

            string msg = String.Format(" Position = {0}", newPosition);

            try
            {
                int amount = newPosition;

                if (FocuserManager.Parameters.Absolute)
                {
                    amount = newPosition - Position;
                }

                FocuserManager.MoveFocuserBy(amount);
                msg += _done;
            }
            catch (Exception)
            {
                msg += _failed;

                throw;
            }
            finally
            {
                LogMessage(name, msg);
            }
        }
        private void ChooseFocuser()
        {
            string oldID = FocuserID;
            string newID = FocuserManager.Choose(oldID);

            if (String.IsNullOrEmpty(newID))
            {
                return;
            }

            // Prevent us from choosing ourselves as our Focuser.

            if (newID == Globals.DevHubFocuserID)
            {
                string msg = Globals.DevHubFocuserID + " cannot be chosen as the focuser!";
                ShowMessage(msg, "Invalid Focuser Selected");

                return;
            }

            if (newID != oldID)
            {
                FocuserID = newID;
            }
        }
示例#3
0
        public string Action(string actionName, string actionParameters)
        {
            string retval;

            if (String.IsNullOrEmpty(actionName))
            {
                throw new InvalidValueException("Action method: no actionName was provided.");
            }

            string msg = String.Format("Action {0}, parameters {1}", actionName, actionParameters);

            try
            {
                retval = FocuserManager.Action(actionName, actionParameters);
                msg   += String.Format(", returned {0}{1}", retval, _done);
            }
            catch (Exception)
            {
                msg += _failed;

                throw;
            }
            finally
            {
                LogMessage("Action:", msg);
            }

            return(retval);
        }
示例#4
0
        public void Halt()
        {
            string name = "Halt:";

            CheckConnected(name, ConnectedState);

            string msg = "";

            try
            {
                FocuserManager.Halt();

                msg = _done;
            }
            catch (Exception)
            {
                msg = _failed;

                throw;
            }
            finally
            {
                LogMessage(name, msg);
            }
        }
        private void SetupOK()
        {
            if (!IsTelescopeActive && TelescopeID != TelescopeSetupVm.TelescopeID)
            {
                TelescopeID = TelescopeSetupVm.TelescopeID;
                TelescopeManager.SetTelescopeID(TelescopeID);
            }

            if (!IsDomeActive && DomeID != DomeSetupVm.DomeID)
            {
                DomeID = DomeSetupVm.DomeID;
                DomeManager.SetDomeID(DomeID);
            }

            Globals.DomeLayout = DomeSetupVm.GetLayout();

            if (!IsFocuserActive && FocuserID != FocuserSetupVm.FocuserID)
            {
                FocuserID = FocuserSetupVm.FocuserID;
                FocuserManager.SetFocuserID(FocuserID);
            }

            Globals.SuppressTrayBubble       = SuppressTrayBubble;
            Globals.UseCustomTheme           = UseCustomTheme;
            Globals.FocuserTemperatureOffset = FocuserSetupVm.TemperatureOffset;

            SaveSettings();

            OnRequestClose(true);
        }
        protected void RequestFocuserMove(int delta)
        {
            FocuserBusy = true;

            int moveAmount = delta;

            FocuserManager.MoveFocuserBy(delta);
        }
        public AscomFocuserStatus(FocuserManager mgr)
        {
            Connected = mgr.Connected;
            IsMoving  = mgr.IsMoving;
            Link      = mgr.Link;
            bool IsAbsolute = mgr.Parameters.Absolute;

            Position    = IsAbsolute ? mgr.Position : Int32.MinValue;
            TempComp    = mgr.TempComp;
            Temperature = mgr.Temperature;
        }
示例#8
0
        public void InitializeFromManager(FocuserManager mgr)
        {
            this.Absolute         = mgr.Absolute;
            this.Description      = mgr.Description;
            this.DriverInfo       = mgr.DriverInfo;
            this.DriverVersion    = mgr.DriverVersion;
            this.InterfaceVersion = mgr.InterfaceVersion;
            this.MaxIncrement     = mgr.MaxIncrement;
            this.MaxStep          = mgr.MaxStep;
            this.StepSize         = mgr.StepSize;

            ArrayList arr = mgr.SupportedActions;

            this.SupportedActions = (string[])arr.ToArray(typeof(string));

            this.TempCompAvailable = mgr.TempCompAvailable;
        }
示例#9
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;
        }
示例#10
0
        public void CommandBlind(string command, bool raw)
        {
            string msg = String.Format("Command {0}, Raw {1}", command, raw);

            try
            {
                FocuserManager.CommandBlind(command, raw);
                msg += _done;
            }
            catch (Exception)
            {
                msg += _failed;

                throw;
            }
            finally
            {
                LogMessage("CommandBlind:", msg);
            }
        }
示例#11
0
        public string CommandString(string command, bool raw)
        {
            string retval;
            string msg = String.Format("Command {0}, Raw {1}", command, raw);

            try
            {
                retval = FocuserManager.CommandString(command, raw);
                msg   += String.Format(", Returned {0}{1}.", retval, _done);
            }
            catch (Exception)
            {
                msg += _failed;

                throw;
            }
            finally
            {
                LogMessage("CommandString:", msg);
            }

            return(retval);
        }
        private void ConnectFocuser()
        {
            try
            {
                // Attempt to connect with the scope.

                RegisterStatusUpdateMessage(true);

                bool success = FocuserManager.Connect(FocuserID);

                if (success)
                {
                    IsConnected = true;
                }
                else
                {
                    // No exception, but did not connect!

                    string message = "Use the Activity Log to view any errors!";

                    if (FocuserManager.ConnectException != null)
                    {
                        message = FocuserManager.ConnectException.Message;
                    }

                    ShowMessage(message, "Focuser Connection Error");
                }
            }
            catch (Exception xcp)
            {
                // Connection attempt caused exception.

                string message = String.Format("{0}\r\n{1}", FocuserManager.ConnectError, xcp.Message);
                ShowMessage(message, "Focuser Connection Error");
            }
        }
 private void DisconnectFocuser()
 {
     IsConnected = false;
     FocuserManager.Disconnect();
     Status = null;
 }
        private void ToggleTempComp(object param)
        {
            bool state = (bool)param;

            FocuserManager.SetTemperatureCompensation(state);
        }
 private void HaltFocuser()
 {
     FocuserManager.HaltFocuser();
 }