Exemplo n.º 1
0
        public void Open(string resourceName)
        {
            try
            {
                // Open the device.
                _v3497x = new Ag3497x(resourceName);

                // Confirm identity.
                _v3497x.SCPI.IDN.Query(out string identity);

                // The second word is the model number.
                string[] words = identity.Split(',');

                if (words[1].Equals("34970A") == false && words[1].Equals("34972A") == false)
                {
                    throw new DeviceCommunicationException("Unexpected device model number.");
                }

                // Introduce yourself.
                _v3497x.SCPI.DISPlay.TEXT.Command("SENSIT");
            }
            catch (Exception ex)
            {
                throw new DeviceCommunicationException("Could not open datalogger."
                                                       + Environment.NewLine + ex.Message);
            }
        }
Exemplo n.º 2
0
        public void Close()
        {
            // Clear any text on the display.
            _v3497x?.SCPI.DISPlay.TEXT.CLEar.Command();

            // Disconnect.
            _v3497x?.Disconnect();

            // Prevent memory leaks.
            ((IDisposable)_v3497x)?.Dispose();

            _v3497x = null;
        }