static void Main(string[] args) { // Uncomment the code that's required #if UseChooser // choose the device string id = ASCOM.DriverAccess.Dome.Choose(""); if (string.IsNullOrEmpty(id)) { return; } // create this device ASCOM.DriverAccess.Dome device = new ASCOM.DriverAccess.Dome(id); #else // this can be replaced by this code, it avoids the chooser and creates the driver class directly. ASCOM.DriverAccess.Dome device = new ASCOM.DriverAccess.Dome("ASCOM.Wise40.Dome"); #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(); }
private void ButtonConnect_Click(object sender, EventArgs e) { if (IsConnected) { driver.Connected = false; } else { driver = new ASCOM.DriverAccess.Dome(Properties.Settings.Default.DriverId); driver.Connected = true; } SetUIState(); }
private void buttonConnect_Click(object sender, EventArgs e) { driver = new ASCOM.DriverAccess.Dome(DriverId); if (buttonConnect.Text == "Connect") { driver.Connected = true; timer1.Enabled = true; buttonOpenShutter.Enabled = true; buttonCloseShutter.Enabled = true; buttonConnect.Text = "Disconnect"; } else { timer1.Enabled = false; buttonOpenShutter.Enabled = false; buttonCloseShutter.Enabled = false; driver.Connected = false; buttonConnect.Text = "Connect"; } }
private void buttonConnect_Click(object sender, EventArgs e) { if (IsConnected) { driver.Connected = false; driver = null; } else { //don't create new when re-clicking existing if (driver == null) { driver = new ASCOM.DriverAccess.Dome(Properties.Settings.Default.DriverId); } //try to make a connection driver.Connected = true; if (!driver.Connected) { MessageBox.Show("Unable to connect - check logs", "Connection error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } SetUIState(); }
static void Main(string[] args) { // choose the device int timedout = 0; //turn the dome by time, not bearing DateTime dt = new System.DateTime(); ASCOM.DriverAccess.Dome device; // Uncomment the code that's required #if UseChooser string id = ASCOM.DriverAccess.Dome.Choose(""); if (string.IsNullOrEmpty(id)) return; try { // create this device device = new ASCOM.DriverAccess.Dome(id); #else // this can be replaced by this code, it avoids the chooser and creates the driver class directly. try { device = new ASCOM.DriverAccess.Dome("ASCOM.Skybadger.Dome"); #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); System.Threading.Thread.Sleep(500); #if TEST1_CONNECTIVITY // TODO add more code to test the driver. Console.WriteLine("Setting 'Connected' to 'True'"); device.Connected = true; if (device.Connected) { String output; Console.WriteLine(" 'CanFindHome' set to: " + device.CanFindHome); Console.WriteLine(" 'CanSetPark' set to: " + device.CanSetPark); Console.WriteLine(" 'CanPark' set to: " + device.CanPark); Console.WriteLine(" 'CanSetAltitude' set to: " + device.CanSetAltitude); Console.WriteLine(" 'CanSetAzimuth' set to: " + device.CanSetAzimuth); Console.WriteLine(" 'CanSetPark' set to: " + device.CanSetPark); Console.WriteLine(" 'CanSetShutter' set to: " + device.CanSetShutter); Console.WriteLine(" 'CanSlave' set to: " + device.CanSlave); Console.WriteLine(" 'CanSyncAzimuth' set to: " + device.CanSyncAzimuth); Console.WriteLine("Press Enter to continue"); Console.ReadLine(); Console.WriteLine("Setting 'Connected' to 'False'"); } device.Connected = false; } catch (ASCOM.DriverException dex) { Console.WriteLine(" ASCOM exception : " + dex.Message); if (dex.InnerException != null) Console.WriteLine(" +inner exception : " + dex.InnerException); } #endif #if TEST2_MOTOR_CONTROL try { dt = System.DateTime.Now.AddSeconds(20); Console.WriteLine(String.Format("Timeout set to {0}", dt)); output = device.CommandString("rotateRight", false); Console.WriteLine(" rotateRight requested: " + output); do { output = device.CommandString("Bearing", false); Console.WriteLine(" Bearing: " + output); output = device.CommandString("Voltage", false); Console.WriteLine(" Voltage: " + output); System.Threading.Thread.Sleep(1000); Console.WriteLine(String.Format("Time: {0}", System.DateTime.Now )); timedout= DateTime.Compare(dt, System.DateTime.Now); } while ( timedout > 0 ); if ( device.Slewing) device.AbortSlew(); Console.WriteLine("Press Enter to continue"); Console.ReadLine(); dt = System.DateTime.Now.AddSeconds(20); Console.WriteLine(String.Format("Timeout set to {0}", dt)); output = device.CommandString("rotateRight", false); Console.WriteLine(" RotateRight requested " + output); do { output = device.CommandString("Bearing", false); Console.WriteLine(" Bearing: " + output ); output = device.CommandString("Voltage", false); Console.WriteLine(" Voltage: " + output); System.Threading.Thread.Sleep(1000); Console.WriteLine(String.Format("Time: {0}", System.DateTime.Now)); timedout = DateTime.Compare(dt, System.DateTime.Now); } while (timedout > 0); if (device.Slewing) device.AbortSlew(); } } catch( ASCOM.DriverException dex ) { Console.WriteLine(" ASCOM exception : " + dex.Message); if ( dex.InnerException != null ) Console.WriteLine ( " +inner exception : " + dex.InnerException); } #endif #if TEST3_ASYNC_MOTOR String output; device = new ASCOM.DriverAccess.Dome("ASCOM.Skybadger.Dome"); device.Connected = true; //Console.WriteLine(String.Format("Slewing to : {0}", 180)); device.SlewToAzimuth(180); do { output = device.CommandString("Bearing", false); Console.WriteLine(" Bearing: " + output ); System.Threading.Thread.Sleep(1000); }while( device.Slewing ); Console.WriteLine("Press Enter to SetPark"); Console.ReadLine(); device.SetPark(); Console.WriteLine(String.Format("Slewing to : {0}", 90)); device.SlewToAzimuth(90); do { output = device.CommandString("Bearing", false); Console.WriteLine(" Bearing: " + output ); System.Threading.Thread.Sleep(1000); }while( device.Slewing ); Console.WriteLine(String.Format("Slewing to : {0}", 270)); device.SlewToAzimuth(270); do { output = device.CommandString("Bearing", false); Console.WriteLine(" Bearing: " + output ); System.Threading.Thread.Sleep(1000); }while( device.Slewing ); /* Console.WriteLine(String.Format("Slewing to : {0}", 180)); device.SlewToAzimuth(180); do { output = device.CommandString("Bearing", false); Console.WriteLine(" Bearing: " + output ); System.Threading.Thread.Sleep(1000); }while( device.Slewing ); Console.WriteLine(String.Format("Slewing to : {0}", 180)); do { output = device.CommandString("Bearing", false); Console.WriteLine(" Bearing: " + output ); }while( device.Slewing ); */ if ( device.CanPark) device.Park(); Console.WriteLine("Press Enter to disconnect"); Console.ReadLine(); device.Connected = false; device = null; Console.WriteLine("Disconnected"); }
public frmInit() { InitializeComponent(); dome = new ASCOM.DriverAccess.Dome(domeID); }
private void button1_Click_1(object sender, EventArgs e) { driver = new ASCOM.DriverAccess.Dome(DriverId); driver.SetupDialog(); }
/// <summary> /// Wrapper to reset dome driver /// Later system would reinitiate it itself /// </summary> public void Reset() { Connected_flag = false; curShutterStatus = ShutterState.shutterError; objDome = null; }
static void Main(string[] args) { // Uncomment the code that's required #if UseChooser // choose the device string id = ASCOM.DriverAccess.Dome.Choose(""); if (string.IsNullOrEmpty(id)) { return; } // create this device ASCOM.DriverAccess.Dome device = new ASCOM.DriverAccess.Dome(id); #else // this can be replaced by this code, it avoids the chooser and creates the driver class directly. ASCOM.DriverAccess.Dome device = new ASCOM.DriverAccess.Dome("ASCOM.GowerCDome.Dome"); #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); Console.WriteLine("ERAS"); // TODO add more code to test the driver. // trying to display the setup dialog.... // device.SetupDialog(); /* * int difference = 0; * int diffmod = 0; * int divider = 360; * double taz = 350.0; * double caz = 20.0; * String direction = ""; * int part1, part2, part3; * * //Console.Write("New Target Azimuth value ? a number > 360 exits the routine :"); * * while (taz < 361.0) * { * * * Console.Write("New Target Azimuth value ? a number > 360 exits the routine :"); // invite user input for azimuth tests * * String response = Console.ReadLine(); * * if (double.TryParse(response, out taz)) * * Console.Write("New Current Azimuth value ? a number > 360 exits the routine :"); // invite user input for azimuth tests * * response = Console.ReadLine(); * * if (double.TryParse(response, out caz)) * * difference = (int)(caz - taz); * //difference = Math.Abs(difference); * part1 = (int)(difference/360); * if (difference<0) * { * part1 = -1; * } * part2 = part1 * 360; * part3 = difference - part2; * * Console.WriteLine("difference = " + difference); * Console.WriteLine("part1 = " + part1); * Console.WriteLine("part2 = " + part2); * Console.WriteLine("part3 = " + part3); * * for (int i =1; i<500; i++) * { * difference = difference - 360; * if (difference < 360) * { * break; * } * * } * * * diffmod = part3; * * if (diffmod >= 180) * { * direction = "CL"; * } * else * { * direction = "CC"; * } * * Console.WriteLine("diffmod = " + diffmod); * Console.WriteLine("direction = " + direction); * * } * */ device.Connected = true; double pkazimuth = 2.00; // for tests while (pkazimuth < 360.0) // coninuous loop for testing { Console.WriteLine("connection status " + device.Connected); // show connection status // Console.WriteLine("Slewing status " + device.Slewing); Console.Write("New Azimuth value ? a number > 360 exits the routine :"); // invite user input for azimuth tests string response = Console.ReadLine(); double result; if (double.TryParse(response, out result)) { pkazimuth = result; } Console.WriteLine("Requested Target is " + pkazimuth); if (pkazimuth > 360.0) // leave the while loop if pkazimuth >360 { Console.WriteLine("Requested Stop "); break; } // for tests device.SlewToAzimuth(pkazimuth); // test the slew to azimuth System.Threading.Thread.Sleep(500); while (device.Slewing) { Console.WriteLine("Current Azimuth = "); // test the dome azimuth Console.WriteLine(device.Azimuth); System.Threading.Thread.Sleep(1000); // serial needs time after each command Console.WriteLine("Slewing Status " + device.Slewing); // test the slewing status System.Threading.Thread.Sleep(500); //device.SlewToAzimuth(pkazimuth); // test the slew to azimuth reverse direction // System.Threading.Thread.Sleep(1000); } Console.WriteLine("Azimuth = "); // test the dome azimuth Console.WriteLine(device.Azimuth); } // endwhle pkazimuth Console.WriteLine("Press Enter to finish"); Console.ReadLine(); device.Connected = false; } //end static void main