public ObservationLocation() { iProfile = new Utilities.Profile(); iProfile.DeviceType = "Telescope"; iHelper = new Utilities.Util(); iProgID = Telescope.ProgId; if (iProfile.IsRegistered(Telescope.ProgId)) { String storedLongitude; storedLongitude = iProfile.GetValue(iProgID, "Longitude", ""); if (storedLongitude.Length != 0) { iLongitude = Convert.ToDouble(storedLongitude); } else { iLongitude = 0; } } else { iLongitude = 0; } }
public ObservationLocation() { iProfile = new Utilities.Profile(); iProfile.DeviceType = "Telescope"; iHelper = new Utilities.Util(); iProgID = Telescope.ProgId; if (iProfile.IsRegistered(Telescope.ProgId)) { String storedLongitude; storedLongitude = iProfile.GetValue(iProgID, "Longitude", ""); if (storedLongitude.Length != 0) { iLongitude = Convert.ToDouble(storedLongitude); } else { iLongitude = 0; } } else { iLongitude = 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)); }
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)); }
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()); } }
public void ReadProfile() { using (ASCOM.Utilities.Profile p = new Utilities.Profile() { DeviceType = "Telescope" }) { if (p.IsRegistered(Const.wiseTelescopeDriverID)) { DebugLevel d; if (Enum.TryParse <DebugLevel>(p.GetValue(Const.wiseTelescopeDriverID, "SiteDebugLevel", string.Empty, DebugLevel.DebugDefault.ToString()), out d)) { _currentLevel = d; } } } }
// Constructor - Must be public for COM registration! /// <summary> /// Constructor /// </summary> public Telescope() { sysLog.Enabled = true; sysLog.LogMessage("Telescope", "Creating Telescope"); m_AxisRates = new AxisRates[2]; m_AxisRates[0] = new AxisRates(TelescopeAxes.axisPrimary); m_AxisRates[1] = new AxisRates(TelescopeAxes.axisSecondary); m_TrackingRates = new TrackingRates(); Serial theSerial = null; if (_profile.IsRegistered(s_csDriverID)) { _profile.CreateSubKey(s_csDriverID, s_SerialSubKey); string portname = _profile.GetValue(s_csDriverID, "Port", s_SerialSubKey); string baudRate = _profile.GetValue(s_csDriverID, "Baud", s_SerialSubKey); if (portname.Length != 0 && baudRate.Length != 0) { theSerial = new Serial(); theSerial.Port = Convert.ToInt16(portname); theSerial.Speed = (ASCOM.Utilities.SerialSpeed)Convert.ToInt16(baudRate); theSerial.Connected = true; } } else { RegUnregASCOM(true); } Controller = new BoxdorferConnect(theSerial); m_Axes = new Axis.AxisControl[] { new Axis.RaAxisControl(Controller), //new Axis.DecAxisController(Controller); }; RaAxis = m_Axes[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)); }
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)); }