public void TestProfile()
        {
            Telescope.RegisterASCOM(typeof(Telescope));

            Utilities.Profile theProfile = new Utilities.Profile();
            theProfile.DeviceType = "Telescope";
            Assert.That(theProfile.IsRegistered(Telescope.ProgId));
            ObservationLocation.Reset();
            try
            {
                theProfile.DeleteValue(Telescope.ProgId, "Longitude", "");
            }
            catch (Exception) {}

            ObservationLocation theLocation = ObservationLocation.Location;

            Assert.That(theLocation.Longitude, Is.EqualTo(0.0));

            theProfile.WriteValue(Telescope.ProgId, "Longitude", Convert.ToString(4.12345), "");
            double longitude = Convert.ToDouble(theProfile.GetValue(Telescope.ProgId, "Longitude", ""));

            Assert.That(longitude, Is.EqualTo(4.12345));
            ObservationLocation.Reset();
            theLocation = ObservationLocation.Location;
            Assert.That(theLocation.Longitude, Is.EqualTo(4.12345));

            ObservationLocation.Reset();
            theProfile.DeleteValue(Telescope.ProgId, "Longitude", "");
            theLocation = ObservationLocation.Location;

            Assert.That(theLocation.Longitude, Is.EqualTo(0.0));
        }
Exemple #2
0
 private void CmdOkClick(object sender, EventArgs e)
 {
     using (ASCOM.Utilities.Profile p = new Utilities.Profile())
     {
         p.DeviceType = "Focuser";
         p.WriteValue(Focuser.driverId, "ComPort", (string)cbComPort.SelectedItem);
         p.WriteValue(Focuser.driverId, "SetPos", (string)checkSetPos.Checked.ToString());
         p.WriteValue(Focuser.driverId, "RPM", textBoxRpm.Text);
         if (checkSetPos.Checked)
         {
             p.WriteValue(Focuser.driverId, "Pos", (string)textPos.Text.ToString());
         }
         p.WriteValue(Focuser.driverId, "TempDisp", radioCelcius.Checked ? "C" : "F");
     }
     Dispose();
 }
 private void CmdOkClick(object sender, EventArgs e)
 {
     using (ASCOM.Utilities.Profile p = new Utilities.Profile())
     {
        p.DeviceType = "Focuser";
        p.WriteValue(Focuser.driverId, "ComPort",(string)cbComPort.SelectedItem);
        p.WriteValue(Focuser.driverId, "SetPos", (string)checkSetPos.Checked.ToString());
        p.WriteValue(Focuser.driverId, "RPM", textBoxRpm.Text);
        if (checkSetPos.Checked)
        {
            p.WriteValue(Focuser.driverId, "Pos", (string)textPos.Text.ToString());
        }
        p.WriteValue(Focuser.driverId, "TempDisp", radioCelcius.Checked ? "C" : "F");
     }
     Dispose();
 }
        private void cmdOK_Click(object sender, EventArgs e) // OK button event handler
        {
            if (textBox2.Text == "")
            {
                MessageBox.Show("You must specify a value for Steps per Degree");

                return;
            }
            else
            {
                using (ASCOM.Utilities.Profile p = new Utilities.Profile())
                {
                    p.DeviceType = "Rotator";
                    p.WriteValue(Rotator.driverID, "ComPort", (string)comboBoxComPort.SelectedItem);
                    p.WriteValue(Rotator.driverID, "SetPos", checkBox1.Checked.ToString());
                    // 6-16-16 added 2 lines below
                    //   p.WriteValue(Rotator.driverID, "Reverse", reverseCheckBox1.Checked.ToString());  // motor sitting shaft up turns clockwise with increasing numbers if NOT reversed
                    p.WriteValue(Rotator.driverID, "ContHold", checkBox2.Checked.ToString());


                    p.WriteValue(Rotator.driverID, "StepsPerDegree", textBox2.Text.ToString());
                    //   p.WriteValue(Focuser.driverID, "RPM", textBoxRpm.Text);
                    if (checkBox1.Checked)
                    {
                        p.WriteValue(Rotator.driverID, "Pos", textBox1.Text.ToString());
                    }
                    //    p.WriteValue(Focuser.driverID, "TempDisp", radioCelcius.Checked ? "C" : "F");
                }
                Dispose();



                // Place any validation constraint checks here
                // Update the state variables with results from the dialogue
                Rotator.comPort    = (string)comboBoxComPort.SelectedItem;
                Rotator.traceState = chkTrace.Checked;
            }



            // Place any validation constraint checks here
            // Update the state variables with results from the dialogue
            //Rotator.comPort = (string)comboBoxComPort.SelectedItem;
            //Rotator.tl.Enabled = chkTrace.Checked;
        }
Exemple #5
0
        public void SetupDialog()
        {
            SetupDialogForm F = new SetupDialogForm(this);

            F.RaAxis = m_Axes[0];
            if (F.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                RegUnregASCOM(true);
                if (F.Connection == null)
                {
                    _profile.DeleteSubKey(s_csDriverID, s_SerialSubKey);
                }
                else
                {
                    _profile.CreateSubKey(s_csDriverID, s_SerialSubKey);
                    _profile.WriteValue(s_csDriverID, "Port", F.Connection.Port.ToString(), s_SerialSubKey);
                    _profile.WriteValue(s_csDriverID, "Baud", ((Int16)F.Connection.Speed).ToString(), s_SerialSubKey);
                }
            }
        }
Exemple #6
0
        private void cmdOK_Click(object sender, EventArgs e)
        {
            Properties.Settings.Default.ip_addr = ipaddr.Text;

            using (ASCOM.Utilities.Profile p = new Utilities.Profile())
            {
                p.DeviceType = "Dome";
                p.WriteValue(Dome.driverID, "ip_addr222", (string)ipaddr.Text);
            }

            Close();
        }
        private void cmdOK_Click(object sender, EventArgs e)
        {
            Properties.Settings.Default.ip_addr = ipaddr.Text;

            using(ASCOM.Utilities.Profile p = new Utilities.Profile())
            {
                p.DeviceType = "Dome";
                p.WriteValue(Dome.driverID, "ip_addr222", (string)ipaddr.Text);
            }

            Close();
        }
        private void cmdOK_Click(object sender, EventArgs e)
        {
            using (ASCOM.Utilities.Profile p = new Utilities.Profile())
            {
                p.DeviceType = "Telescope";
                p.WriteValue(Telescope.driverID, "Comport",
                             (string)comboBox1.SelectedItem);
            }

            //   Properties.Settings.Default.CommPort = comboBox1.SelectedItem.ToString();
            Dispose();
            Close();
        }
Exemple #9
0
 public void WriteProfile()
 {
     using (ASCOM.Utilities.Profile p = new Utilities.Profile()
     {
         DeviceType = "Telescope"
     })
     {
         if (!p.IsRegistered(Const.wiseTelescopeDriverID))
         {
             p.Register(Const.wiseTelescopeDriverID, "Wise40 global settings");
         }
         p.WriteValue(Const.wiseTelescopeDriverID, "SiteDebugLevel", Level.ToString());
     }
 }
Exemple #10
0
        private void CmdOkClick(object sender, EventArgs e)
        {
            using (ASCOM.Utilities.Profile p = new Utilities.Profile()) {
                p.DeviceType = "FilterWheel";
                p.WriteValue(FilterWheel.driverId, "ComPort", (string)portsSeries.SelectedItem);
                p.WriteValue(FilterWheel.driverId, "Position1", (string)textBox1.Text);
                p.WriteValue(FilterWheel.driverId, "Position2", (string)textBox2.Text);
                p.WriteValue(FilterWheel.driverId, "Position3", (string)textBox3.Text);
                p.WriteValue(FilterWheel.driverId, "Position4", (string)textBox4.Text);
                p.WriteValue(FilterWheel.driverId, "Position5", (string)textBox5.Text);
            }

            Dispose();
        }
        public void TestLongitude()
        {
            Utilities.Profile theProfile = new Utilities.Profile();
            theProfile.DeviceType = "Telescope";

            theProfile.WriteValue(Telescope.ProgId, "Longitude", Convert.ToString(4.12345), "");
            ObservationLocation.Reset();
            ObservationLocation theLocation = ObservationLocation.Location;

            Assert.That(theLocation.Longitude, Is.EqualTo(4.12345).Within(0.00001));

            NotifyHandler theHandler = new NotifyHandler(theLocation);

            theLocation.Longitude = 12.54321;
            double storedLongitude = Convert.ToDouble(theProfile.GetValue(Telescope.ProgId, "Longitude", ""));

            Assert.That(theLocation.Longitude, Is.EqualTo(12.54321).Within(0.00001));
            Assert.That(storedLongitude, Is.EqualTo(12.54321).Within(0.00001));
            Assert.That(theHandler.nLongitudeChanges, Is.EqualTo(1));
        }
Exemple #12
0
        // OK button event handler
        private void cmdOK_Click(object sender, EventArgs e)
        {
            // Place any validation constraint checks here

            Focuser.comPort = comboBoxComPort.Text; // Update the state variables with results from the dialogue
            Focuser.traceState = chkTrace.Checked;

            // If a new initial position entered pass it to focuser
            if (!String.IsNullOrEmpty(txtInitialPosition.Text))
            {
                Focuser.newInitialPosition = Int32.Parse(txtInitialPosition.Text);
            }
            else
            {
                Focuser.newInitialPosition = 0;
            }

            using (ASCOM.Utilities.Profile p = new Utilities.Profile())
            {
                p.DeviceType = "Focuser";
                p.WriteValue(Focuser.driverID, "ComPort", (string)comboBoxComPort.Text);
            }
        }
Exemple #13
0
        void saveParametersImpl(int port, bool traceState)
        {
           this.tcpPort = port;
           this.traceState = traceState;

           using (ASCOM.Utilities.Profile p = new Utilities.Profile())
           {
               p.DeviceType = deviceType;
               p.WriteValue(this.driverId, Focuser.tcpPortProfileName, "" + port);
               p.WriteValue(this.driverId, Focuser.traceStateProfileName, "" + traceState);
           }
        }
        static SharedResources()
        {
            EventLogger.LogMessage("Creating FocusLynx Shared Resources", System.Diagnostics.TraceLevel.Info);
            // Get the stored TraceLevel from the ASCOM Profile and convert it to a usable type.
            Utilities.Profile p = new Utilities.Profile();
            p.DeviceType = "Focuser";
            string level = p.GetValue(SharedProfileDriverID, "Trace Level", "", System.Diagnostics.TraceLevel.Info.ToString());
            System.Diagnostics.TraceLevel traceLevel = (System.Diagnostics.TraceLevel)Enum.Parse(typeof(System.Diagnostics.TraceLevel), level);
            try { EventLogger.LoggingLevel = traceLevel; }
            catch
            {
                // This means someone keyed in an invalid value for trace level. Fix the problem
                p.WriteValue(SharedProfileDriverID, "Trace Level", System.Diagnostics.TraceLevel.Error.ToString());
                EventLogger.LoggingLevel = System.Diagnostics.TraceLevel.Warning;
                EventLogger.LogMessage("Invalid Trace Level string found in settings profile. Value was: "
                    + level + ". Trace Level has been automatically set to Warning now. Problem automatically resolved!", System.Diagnostics.TraceLevel.Warning);
            }

            //myFocuserManager = FocuserManager.GetInstance();    // Focuser Manager is implemented as a singleton just so that
                                                                // there is no chance of creating multiple instances of it.

            hubFocuser1 = HubFocuserRev2.Instance1;
            hubFocuser2 = HubFocuserRev2.Instance2;
            EventLogger.LogMessage("myFocuserManager Created Successfully!", System.Diagnostics.TraceLevel.Info);
        }
        public void TestLongitude()
        {
            Utilities.Profile theProfile = new Utilities.Profile();
            theProfile.DeviceType = "Telescope";

            theProfile.WriteValue(Telescope.ProgId, "Longitude", Convert.ToString(4.12345), "");
            ObservationLocation.Reset();
            ObservationLocation theLocation = ObservationLocation.Location;
            Assert.That(theLocation.Longitude, Is.EqualTo(4.12345).Within(0.00001));

            NotifyHandler theHandler = new NotifyHandler(theLocation);
            theLocation.Longitude = 12.54321;
            double storedLongitude = Convert.ToDouble(theProfile.GetValue(Telescope.ProgId, "Longitude", ""));
            Assert.That(theLocation.Longitude, Is.EqualTo(12.54321).Within(0.00001));
            Assert.That(storedLongitude,Is.EqualTo(12.54321).Within(0.00001));
            Assert.That(theHandler.nLongitudeChanges, Is.EqualTo(1));
        }
        public void TestProfile()
        {
            Telescope.RegisterASCOM(typeof(Telescope));

            Utilities.Profile theProfile = new Utilities.Profile();
            theProfile.DeviceType = "Telescope";
            Assert.That(theProfile.IsRegistered(Telescope.ProgId));
            ObservationLocation.Reset();
            try
            {
                theProfile.DeleteValue(Telescope.ProgId, "Longitude", "");
            }
            catch(Exception) {}

            ObservationLocation theLocation = ObservationLocation.Location;

            Assert.That(theLocation.Longitude, Is.EqualTo(0.0));

            theProfile.WriteValue(Telescope.ProgId, "Longitude", Convert.ToString(4.12345), "");
            double longitude = Convert.ToDouble(theProfile.GetValue(Telescope.ProgId, "Longitude", ""));
            Assert.That(longitude, Is.EqualTo(4.12345));
            ObservationLocation.Reset();
            theLocation = ObservationLocation.Location;
            Assert.That(theLocation.Longitude, Is.EqualTo(4.12345));

            ObservationLocation.Reset();
            theProfile.DeleteValue(Telescope.ProgId, "Longitude", "");
            theLocation = ObservationLocation.Location;

            Assert.That(theLocation.Longitude, Is.EqualTo(0.0));
        }
Exemple #17
0
        private void cmdOK_Click_1(object sender, EventArgs e)
        {
            if (textBox2.Text == "")
            {
                MessageBox.Show("You must specify a value for Steps per Degree");

                return;
            }
            else
            {
                using (ASCOM.Utilities.Profile p = new Utilities.Profile())
                {
                    p.DeviceType = "Rotator";
                    p.WriteValue(driverID, "ComPort", (string)comboBoxComPort.SelectedItem);
                    //     p.WriteValue(driverID, "SetPos", checkBox1.Checked.ToString());


                    //p.WriteValue(driverID, "SetPos", "false");  //leave this false so needs to be check everytime used


                    // 6-16-16 added 2 lines below
                    //   p.WriteValue(Rotator.driverID, "Reverse", reverseCheckBox1.Checked.ToString());  // motor sitting shaft up turns clockwise with increasing numbers if NOT reversed
                    p.WriteValue(driverID, "ContHold", checkBox2.Checked.ToString());


                    p.WriteValue(driverID, "StepsPerDegree", textBox2.Text.ToString());
                    //   p.WriteValue(Focuser.driverID, "RPM", textBoxRpm.Text);
                    if (checkBox1.Checked)
                    {
                        p.WriteValue(driverID, "Pos", textBox1.Text.ToString());
                    }
                    //    p.WriteValue(Focuser.driverID, "TempDisp", radioCelcius.Checked ? "C" : "F");
                }
                //     Dispose();



                // Place any validation constraint checks here
                // Update the state variables with results from the dialogue



                //   Rotator.comPort = (string)comboBoxComPort.SelectedItem;
                comPort = (string)comboBoxComPort.SelectedItem;
                // Rotator.traceState = chkTrace.Checked;
                traceState     = chkTrace.Checked;
                stepsPerDegree = Convert.ToInt32(textBox2.Text.ToString());
                if (checkBox1.Checked)
                {
                    setPosition = float.Parse(textBox1.Text.ToString());
                }
                //  stepsPerDegree = 150;
            }

            ASCOM.scopefocusServer.Properties.Settings.Default.stepsPerDegree = stepsPerDegree;
            ASCOM.scopefocusServer.Properties.Settings.Default.COMPort        = comPort;
            ASCOM.scopefocusServer.Properties.Settings.Default.traceState     = traceState;
            ASCOM.scopefocusServer.Properties.Settings.Default.ContHold       = checkBox2.Checked;
            ASCOM.scopefocusServer.Properties.Settings.Default.SetPos         = checkBox1.Checked;
            ASCOM.scopefocusServer.Properties.Settings.Default.SetPosValue    = setPosition;
            ASCOM.scopefocusServer.Properties.Settings.Default.Save();


            // Place any validation constraint checks here
            // Update the state variables with results from the dialogue
            //Rotator.comPort = (string)comboBoxComPort.SelectedItem;
            //Rotator.tl.Enabled = chkTrace.Checked;
        }