Exemplo n.º 1
0
        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));
        }
Exemplo n.º 2
0
        /**
         * @brief
         * Constructor
         *
         * It is private since it should ONLY be constructed from the singleton
         * access function
         */
        internal LocalSiderialTime()
        {
            iLocation   = ObservationLocation.Location;
            iBaseUTC    = iLocation.UTC;
            iBaseGAST   = GST(iBaseUTC);
            iBaseLAST   = iBaseGAST + iLocation.Longitude * 24.0 / 360.0;
            iTimeOffset = 0;

            iLocation.PropertyChanged += new PropertyChangedEventHandler(NotifiedHandler);
        }
Exemplo n.º 3
0
        /**
         * @brief
         * Constructor
         *
         * It is private since it should ONLY be constructed from the singleton
         * access function
         */
        internal LocalSiderialTime()
        {
            iLocation = ObservationLocation.Location;
            iBaseUTC = iLocation.UTC;
            iBaseGAST = GST(iBaseUTC);
            iBaseLAST = iBaseGAST + iLocation.Longitude * 24.0 / 360.0;
            iTimeOffset = 0;

            iLocation.PropertyChanged += new PropertyChangedEventHandler(NotifiedHandler);
        }
Exemplo n.º 4
0
        public void IsSingleton()
        {
            //Telescope.RegisterASCOM(typeof(Telescope));

            Utilities.Profile theProfile = new Utilities.Profile();
            theProfile.DeviceType = "Telescope";
            Assert.That(theProfile.IsRegistered(Telescope.ProgId));

            ObservationLocation theLocation = ObservationLocation.Location;

            Assert.That(theLocation != null);
            Assert.That(theLocation, Is.SameAs(ObservationLocation.Location));
        }
Exemplo n.º 5
0
        public SetupDialogForm(Telescope aTelescope)
        {
            iLocation = ObservationLocation.Location;
            LST       = LocalSiderialTime.LST;
            _updateList.Add(LST);
            iLocation.Longitude = -4.12345;

            RaAxis = aTelescope.RaAxis;
            Driver = aTelescope;

            InitializeComponent();
            //txtLST.DataBindings.Add("Text", iLST, "LAST_String", false, System.Windows.Forms.DataSourceUpdateMode.Never, null, "T");
            ctrlLon.DataBindings.Add("Value", iLocation, "Longitude", false, System.Windows.Forms.DataSourceUpdateMode.Never);

            Connection = Driver.Controller.Connection;

            // Create a list of serial ports on the system
            Ports = SerialPort.GetPortNames();
            comboPorts.Items.Add("Select a port");
            comboPorts.Items.AddRange(Ports);
            if (Connection != null)
            {
                string portName = String.Format("COM{0}", Connection.Port);
                comboPorts.SelectedItem = portName;
            }
            else
            {
                comboPorts.SelectedIndex = 0;
            }

            foreach (SerialSpeed speed in baudList)
            {
                int value = (int)speed;
                comboBaudRate.Items.Add(value.ToString());
            }

            if (Connection != null)
            {
                string selectedItem = ((Int16)Connection.Speed).ToString();
                comboBaudRate.SelectedItem = selectedItem;
            }
            else
            {
                comboBaudRate.SelectedIndex = 3; // default is 9600 baud
            }


            this.setupDialogFormBindingSource.DataSource = this;
            this.TestAngle = AAnet.Angle.FromDegrees(24.12345);
        }
Exemplo n.º 6
0
        public SetupDialogForm(Telescope aTelescope)
        {
            iLocation = ObservationLocation.Location;
            LST = LocalSiderialTime.LST;
            _updateList.Add(LST);
            iLocation.Longitude = -4.12345;

            RaAxis = aTelescope.RaAxis;
            Driver = aTelescope;

            InitializeComponent();
            //txtLST.DataBindings.Add("Text", iLST, "LAST_String", false, System.Windows.Forms.DataSourceUpdateMode.Never, null, "T");
            ctrlLon.DataBindings.Add("Value", iLocation, "Longitude", false, System.Windows.Forms.DataSourceUpdateMode.Never);

            Connection = Driver.Controller.Connection;

            // Create a list of serial ports on the system
            Ports = SerialPort.GetPortNames();
            comboPorts.Items.Add("Select a port");
            comboPorts.Items.AddRange(Ports);
            if (Connection != null)
            {
                string portName = String.Format("COM{0}", Connection.Port);
                comboPorts.SelectedItem = portName;
            }
            else
            {
                comboPorts.SelectedIndex = 0;
            }

            foreach (SerialSpeed speed in baudList)
            {
                int value = (int)speed;
                comboBaudRate.Items.Add(value.ToString());
            }

            if (Connection != null)
            {
                string selectedItem = ((Int16)Connection.Speed).ToString();
                comboBaudRate.SelectedItem = selectedItem;
            }
            else
            {
                comboBaudRate.SelectedIndex = 3; // default is 9600 baud
            }

            this.setupDialogFormBindingSource.DataSource = this;
            this.TestAngle = AAnet.Angle.FromDegrees(24.12345);
        }
Exemplo n.º 7
0
        public void TestLAST()
        {
            LocalSiderialTime   theLST      = LocalSiderialTime.LST;
            ObservationLocation theLocation = ObservationLocation.Location;

            theLocation.Longitude = 0.0;
            Assert.That(theLST.LAST, Is.EqualTo(theLST.GAST));

            double   oldGAST = theLST.iBaseGAST;
            DateTime theDate = new DateTime(1978, 11, 13, 4, 34, 0);

            theLocation.UTC = theDate;

            Assert.That(theLST.LAST, Is.EqualTo(8.0295394).Within(0.0000005));

            theLocation.Longitude = 4.0; // 4 degrees east => +(4 / 15) hours;
            Assert.That(theLST.LAST, Is.EqualTo(theLST.GAST + (4.0 / 15)).Within(0.0000001));
        }
Exemplo n.º 8
0
        public void TestUTC()
        {
            ObservationLocation.Reset();
            ObservationLocation theLocation = ObservationLocation.Location;

            Assert.That(theLocation.UTC, Is.EqualTo(DateTime.UtcNow));

            NotifyHandler theHandler = new NotifyHandler(theLocation);
            DateTime      theDate    = DateTime.UtcNow;

            theLocation.UTC = theDate.AddHours(2);
            DateTime theNewDate = theLocation.UTC;

            Assert.That(theNewDate.Date, Is.EqualTo(theDate.Date));
            Assert.That(theNewDate.Hour, Is.EqualTo(theDate.Hour + 2));
            Assert.That(theNewDate.Second, Is.EqualTo(theDate.Second));
            Assert.That(theNewDate.Minute, Is.EqualTo(theDate.Minute));
            Assert.That(theHandler.nUtcChanges, Is.EqualTo(1));
        }
Exemplo n.º 9
0
        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));
        }
Exemplo n.º 10
0
 internal static void Reset()
 {
     sLocation = null;
 }
Exemplo n.º 11
0
 internal static void Reset()
 {
     sLocation = null;
 }