Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            // Uncomment the code that's required
#if UseChooser
            // choose the device
            string id = ASCOM.DriverAccess.Telescope.Choose("");
            if (string.IsNullOrEmpty(id))
            {
                return;
            }
            // create this device
            ASCOM.DriverAccess.Telescope device = new ASCOM.DriverAccess.Telescope(id);
#else
            // this can be replaced by this code, it avoids the chooser and creates the driver class directly.
            ASCOM.DriverAccess.ObservingConditions device = new ASCOM.DriverAccess.ObservingConditions("ASCOM.Wise40.VantagePro.ObservingConditions");
#endif
            // now run some tests, adding code to your driver so that the tests will pass.
            // these first tests are common to all drivers.
            Console.WriteLine("name " + device.Name);
            Console.WriteLine("description " + device.Description);
            Console.WriteLine("driverInfo " + device.DriverInfo);
            Console.WriteLine("driverVersion " + device.DriverVersion);

            // TODO add more code to test the driver.
            device.Connected = true;


            device.Connected = false;
            Console.WriteLine("Press Enter to finish");
            Console.ReadLine();
        }
Ejemplo n.º 2
0
        static void Main(string[] _)
        {
            ASCOM.DriverAccess.ObservingConditions device = new ASCOM.DriverAccess.ObservingConditions("ASCOM.VantagePro.ObservingConditions");

            dynamic json = JsonConvert.DeserializeObject(device.Action("raw-data", ""));

            Console.WriteLine(JsonConvert.SerializeObject(json, Formatting.Indented));
            Console.ReadKey();
        }
Ejemplo n.º 3
0
 private void buttonConnect_Click(object sender, EventArgs e)
 {
     if (IsConnected)
     {
         driver.Connected = false;
     }
     else
     {
         driver           = new ASCOM.DriverAccess.ObservingConditions(Properties.Settings.Default.DriverId);
         driver.Connected = true;
     }
     SetUIState();
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TObsCon"/> class.
        /// Must be public for COM registration.
        /// </summary>
        public SSObservingConditions(string DriverID, byte DriverType)
        {
            MyDriverType = DriverType;
            if (MyDriverType == 0)
            {
                MySSObservingConditions = new ASCOM.DriverAccess.ObservingConditions(DriverID);
            }
            else
            {
                tl = new TraceLogger("", "TObsCon");
                ReadProfile(); // Read device configuration from the ASCOM Profile store

                tl.LogMessage("ObservingConditions", "Starting initialisation");

                connectedState = false;            // Initialise connected to false
                utilities      = new Util();       //Initialise util object
                astroUtilities = new AstroUtils(); // Initialise astro utilities object
                //TODO: Implement your additional construction here

                tl.LogMessage("ObservingConditions", "Completed initialisation");
            }
        }
 private void buttonConnect_Click(object sender, EventArgs e)
 {
     if (IsConnected)
     {
         driver.Connected      = false;
         GetDataButton.Enabled = false;
     }
     else
     {
         try
         {
             driver                = new ASCOM.DriverAccess.ObservingConditions(Properties.Settings.Default.DriverId);
             driver.Connected      = true;
             GetDataButton.Enabled = true;
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message);
         }
     }
     SetUIState();
 }
Ejemplo n.º 6
0
        //static WiseSafeToOperate(Operation op)
        //{
        //    _op = op;
        //}

        public void init()
        {
            driverID = "ASCOM.Wise40.SafeTo" + ((_op == Operation.Open) ? "Open" : "Image") + ".SafetyMonitor";
            ReadProfile(); // Read device configuration from the ASCOM Profile store

            tl         = new TraceLogger("", _op == Operation.Open ? "Wise40.SafeToOpen" : "Wise40.SafeToImage");
            tl.Enabled = debugger.Tracing;
            tl.LogMessage("SafetyMonitor", "Starting initialisation");

            _connected = false; // Initialise connected to false

            try
            {
                boltwood   = new DriverAccess.ObservingConditions("ASCOM.CloudSensor.ObservingConditions");
                vantagePro = new DriverAccess.ObservingConditions("ASCOM.Vantage.ObservingConditions");
            }
            catch
            {
                throw new InvalidOperationException("Could not open weather stations");
            }

            tl.LogMessage("SafetyMonitor", "Completed initialisation");
        }
Ejemplo n.º 7
0
        private void buttonConnect_Click(object sender, EventArgs e)
        {
            if (IsConnected)
            {
                // Disable the button till we are done disconnecting
                buttonConnect.Text    = "Disconnecting, Please Wait...";
                buttonConnect.Enabled = false;

                // Tell the graphing thread to stop
                graphThreadRun = false;

                // Wait for the graphing thread to quit before disconnecting
                while (graphThreadRunning)
                {
                    // Check every second
                    Thread.Sleep(1000);
                }

                // Disconnect
                driver.Connected = false;

                // Enable all unit settings. Graph update thread will exit when driver is not connected
                centigrade.Enabled   = true;
                fahrenheit.Enabled   = true;
                pascals.Enabled      = true;
                hectoPascals.Enabled = true;
                kiloPascals.Enabled  = true;
                mmHr.Enabled         = true;
                inHr.Enabled         = true;
                ms.Enabled           = true;
                kph.Enabled          = true;
                mph.Enabled          = true;
            }
            else
            {
                if (driver == null)
                {
                    driver = new ASCOM.DriverAccess.ObservingConditions(Properties.Settings.Default.DriverId);
                }
                driver.Connected = true;

                // Disable all unit settings before starting graph updates in a thread
                centigrade.Enabled   = false;
                fahrenheit.Enabled   = false;
                pascals.Enabled      = false;
                hectoPascals.Enabled = false;
                kiloPascals.Enabled  = false;
                mmHr.Enabled         = false;
                inHr.Enabled         = false;
                ms.Enabled           = false;
                kph.Enabled          = false;
                mph.Enabled          = false;

                // Start thread to update graphs
                t = new System.Threading.Thread(updateGraphs);
                t.Start();

                // Ask graphing thread to update graphs
                graphThreadRun = true;
            }
            SetUIState();
        }