public HardwareChannel(string serverName, string deviceName, string channelName, string channelDescription, HardwareChannel.HardwareConstants.ChannelTypes ct, NationalInstruments.NI4882.Address gpibAddress, HardwareChannel.HardwareConstants.GPIBDeviceType gpibDeviceType)
     : this(serverName, deviceName, channelName,channelDescription, ct)
 {
     if (this.ChannelType != HardwareConstants.ChannelTypes.gpib)
     {
         throw new Exception("Do not call gpib channel constructor for a non gpib device.");
     }
     this.gpibAddress = gpibAddress;
     this.gpibDeviceType = gpibDeviceType;
 }
 public HardwareChannel(string serverName, string deviceName, string channelName, string channelDescription, HardwareChannel.HardwareConstants.ChannelTypes ct)
 {
     gpibMasquerade = false;
     myGpibMasqueradeType = GpibMasqueradeType.NONE;
     this.serverName = serverName;
     this.deviceName = deviceName;
     this.channelName = channelName;
     this.channelDescription = channelDescription;
     this.channelType = ct;
     this.isUnAssigned = false;
     this.gpibAddress = new NationalInstruments.NI4882.Address();
     this.gpibDeviceType = HardwareConstants.GPIBDeviceType.Unknown;
 }
            //Overriding basical device functionality

            /// <summary>
            /// Initializes the device
            /// </summary>
            /// <returns>Returns true, if initialization succeed</returns>
            public bool InitDevice()
            {
                try
                {
                    GPIB_KEITHLEY_2602A_Adderss = new NationalInstruments.NI4882.Address(_primaryAddress, _secondaryAddress);
                    GPIB_KEITHLEY_2602A_Device  = new NationalInstruments.NI4882.Device(_boardNumber, GPIB_KEITHLEY_2602A_Adderss);

                    GPIB_KEITHLEY_2602A_Device.Clear();

                    GPIB_KEITHLEY_2602A_Device.Write("beeper.enable = 1 ");

                    return(true);
                }
                catch
                {
                    return(false);
                }
            }
Ejemplo n.º 4
0
        static void Main()
        {
            /*
             * // demand high security permissions for Atticus. This may help improve performance?
             *
             * SecurityPermission perm = new SecurityPermission(SecurityPermissionFlag.AllFlags);
             * perm.Assert();
             *
             * */

            try
            {
                AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);

                try
                {
                    NationalInstruments.NI4882.Address      testObject  = new NationalInstruments.NI4882.Address();
                    NationalInstruments.DAQmx.CouplingTypes testObject2 = new NationalInstruments.DAQmx.CouplingTypes();
                }
                catch (Exception)
                {
                    MessageBox.Show("Unable to load National Instruments DAQmx libraries. You may have an older version of these libraries installed. Please install the latest version of DAQmx. Press OK to see the detailed exception.", "Unable to load DAQmx libraries.");
                    throw;
                }



                // Maximum server uptime: 1000 days. Lets see if this solves some of those "disconnection" issues we had
                System.Runtime.Remoting.Lifetime.LifetimeServices.LeaseTime = new TimeSpan(1000, 0, 0, 0, 0);


                ServerSettings serverSettings;
                String         serverSettingsFilesName = FileNameStrings.DefaultServerSettingsDataFile;

                try
                {
                    serverSettings = loadServerSettings(serverSettingsFilesName);
                }
                catch (Exception e)
                {
                    Console.WriteLine("Exception when attempting to load server settings.");
                    Console.WriteLine("Proceeding with blank settings.");
                    serverSettings = new ServerSettings();
                }


                Console.WriteLine("Creating AtticusServerRuntime object...");

                server = new AtticusServerCommunicator(serverSettings);

                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);

                MainServerForm form = new MainServerForm();

                server.updateGUI += form.updateGUI;
                server.registerMessageEventHandler(form.addMessageLogText);



                Application.Run(form);



                saveServerSettings(AppDomain.CurrentDomain.BaseDirectory + FileNameStrings.DefaultServerSettingsDataFile, serverSettings);
            }
            catch (Exception e)
            {
                display_unhandled_exception(e);
            }
        }
Ejemplo n.º 5
0
        static void Main()
        {
            /*
             * // demand high security permissions for Atticus. This may help improve performance?

            SecurityPermission perm = new SecurityPermission(SecurityPermissionFlag.AllFlags);
            perm.Assert();

             * */

            try
            {

                AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);

                try
                {
                    NationalInstruments.NI4882.Address testObject = new NationalInstruments.NI4882.Address();
                    NationalInstruments.DAQmx.CouplingTypes testObject2 = new NationalInstruments.DAQmx.CouplingTypes();
                }
                catch (Exception)
                {
                    MessageBox.Show("Unable to load National Instruments DAQmx libraries. You may have an older version of these libraries installed. Please install the latest version of DAQmx. Press OK to see the detailed exception.", "Unable to load DAQmx libraries.");
                    throw;
                }

                // Maximum server uptime: 1000 days. Lets see if this solves some of those "disconnection" issues we had
                System.Runtime.Remoting.Lifetime.LifetimeServices.LeaseTime = new TimeSpan(1000, 0, 0, 0, 0);

                ServerSettings serverSettings;
                String serverSettingsFilesName = FileNameStrings.DefaultServerSettingsDataFile;

                try
                {
                    serverSettings = loadServerSettings(serverSettingsFilesName);
                }
                catch (Exception e)
                {
                    Console.WriteLine("Exception when attempting to load server settings.");
                    Console.WriteLine("Proceeding with blank settings.");
                    serverSettings = new ServerSettings();
                }

                Console.WriteLine("Creating AtticusServerRuntime object...");

                server = new AtticusServerCommunicator(serverSettings);

                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);

                MainServerForm form = new MainServerForm();

                server.updateGUI += form.updateGUI;
                server.messageLog += form.addMessageLogText;

                Application.Run(form);

                saveServerSettings(AppDomain.CurrentDomain.BaseDirectory +  FileNameStrings.DefaultServerSettingsDataFile, serverSettings);
            }
            catch (Exception e)
            {
                display_unhandled_exception(e);
            }
        }
            //Overriding basical device functionality
            /// <summary>
            /// Initializes the device
            /// </summary>
            /// <returns>Returns true, if initialization succeed</returns>
            public bool InitDevice()
            {
                try
                {
                    GPIB_KEITHLEY_2602A_Adderss = new NationalInstruments.NI4882.Address(_primaryAddress, _secondaryAddress);
                    GPIB_KEITHLEY_2602A_Device = new NationalInstruments.NI4882.Device(_boardNumber, GPIB_KEITHLEY_2602A_Adderss);

                    GPIB_KEITHLEY_2602A_Device.Clear();

                    GPIB_KEITHLEY_2602A_Device.Write("beeper.enable = 1 ");

                    return true;
                }
                catch
                {
                    return false;
                }
            }