Exemple #1
0
        public Device(string deviceName)
            : base(true)
        {
            var handle = Drv.spcm_hOpen(deviceName);

            if (handle == IntPtr.Zero)
            {
                ThrowSpcmException(handle);
            }

            SetHandle(handle);
            InitializeCardProperties();
        }
Exemple #2
0
        public override string AutoOpen(AutoConnect_Window myLoadScreen)
        {
            int iterration = 7;

            Communication_LOG += "Try to connect SPECTRUM:\n";

            //Öffnen
            try
            {
                H_Device = Drv.spcm_hOpen(VISA_or_Channel_Name);
            }
            catch (System.DllNotFoundException)
            {
                Communication_LOG += "FAILED!\n";
                return("DAQ-Unit: Connection was not found!" + Environment.NewLine);
            }

            //Prüfen ob verbindung erfolgreich war, sonst abbrechen
            if ((long)H_Device == 0)
            {
                Communication_LOG += "FAILED!\n";
                return("DAQ-Unit: Connection was not seccessfull!" + Environment.NewLine);
            }
            Communication_LOG += "Seccessful\n";

            myLoadScreen.ChangeTask("Reset ...", iterration);

            //Reseten
            ErrorCode_Spectrum += Reset();

            myLoadScreen.ChangeTask("Change UI ...", iterration);

            //Ab hier verbunden
            IsConnected = true;

            //UI anpassen
            button_OpenClose.Text         = "Close";
            comboBox_Frequency.Enabled    = true;
            comboBox_Range.Enabled        = true;
            numericUpDown_Trigger.Enabled = true;

            return("");
        }
Exemple #3
0
        //********************************************************************************************************************
        //                                         GUI: Open/Close + ComboBoxes
        //********************************************************************************************************************

        #region Open/Close

        public override void Open()
        {
            //Öffnen
            Communication_LOG += "Try to connect SPECTRUM:\n";

            //Öffnen
            try
            {
                H_Device = Drv.spcm_hOpen(VISA_or_Channel_Name);
            }
            catch (System.DllNotFoundException)
            {
                MessageBox.Show("Conection to Spectrum DAQ was NOT found!\nTry again.", "Warning",
                                MessageBoxButtons.OK, MessageBoxIcon.Warning);
                Communication_LOG += "FAILED!\n";
                return;
            }

            //Prüfen ob verbindung erfolgreich war, sonst abbrechen
            if ((long)H_Device == 0)
            {
                MessageBox.Show("Conection to Spectrum DAQ was NOT seccessful!\nTry again.", "Warning",
                                MessageBoxButtons.OK, MessageBoxIcon.Warning);
                Communication_LOG += "FAILED!\n";
                return;
            }
            Communication_LOG += "Seccessful\n";

            //Reseten
            ErrorCode_Spectrum += Reset();

            //Ab hier verbunden
            IsConnected = true;

            //UI anpassen
            button_OpenClose.Text         = "Close";
            comboBox_Frequency.Enabled    = true;
            comboBox_Range.Enabled        = true;
            numericUpDown_Trigger.Enabled = true;
        }
Exemple #4
0
        //********************************************************************************************************************
        //                                         Lokale Functionen
        //********************************************************************************************************************

        #region lokal

        private void Open()
        {
            //Öffnen
            Communication_LOG += "Try to connect SPECTRUM:\n";

            //Öffnen
            IP_Adresse = textBox_IP.Text;
            try
            {
                H_Device = Drv.spcm_hOpen(IP_Adresse);
            }
            catch (System.DllNotFoundException)
            {
                MessageBox.Show("Conection to Spectrum DAQ was NOT found!\nTry again.", "Warning",
                                MessageBoxButtons.OK, MessageBoxIcon.Warning);
                Communication_LOG += "FAILED!\n";
                return;
            }

            //Prüfen ob verbindung erfolgreich war, sonst abbrechen
            if ((long)H_Device == 0)
            {
                MessageBox.Show("Conection to Spectrum DAQ was NOT seccessful!\nTry again.", "Warning",
                                MessageBoxButtons.OK, MessageBoxIcon.Warning);
                Communication_LOG += "FAILED!\n";
                return;
            }
            Communication_LOG += "Seccessful\n";

            //Reseten
            ErrorCode_Spectrum += Reset();

            //Ab hier verbunden
            IsConnected = true;

            //UI anpassen
            button_OpenClose.Text   = "Close";
            Voltage_Trigger.Enabled = true;
        }