public DriverAdapterBase(string name, bool idQuery, bool reset, string options) { DriverOptions = new Dictionary <string, string>(); IIviConfigStore ConfigStore = LoadConfigStore(); IviDriverSession CurrentDriver = ConfigStore.GetDriverSession(name); // Parse Options from Ivi driver setup ParseDriverOptions(DriverOptions, CurrentDriver.DriverSetup); // Parse Options from parameter ParseDriverOptions(DriverOptions, options); if (DriverOptions.ContainsKey("TargetName") && !DriverOptions["TargetName"].Equals(string.Empty)) { CurrentDriver = ConfigStore.GetDriverSession(DriverOptions["TargetName"]); } if (CurrentDriver.SoftwareModule == null) { new Exception(string.Format("Software Module not configured for driver session {0}", DriverOptions["TargetName"])); } TargetDriverName = CurrentDriver.Name; TargetDriverPrefix = CurrentDriver.SoftwareModule.Prefix; TargetLibraryFileName = CurrentDriver.SoftwareModule.ModulePath; string TargetSoftwareModuleName = CurrentDriver.SoftwareModuleName; string DriverSetup = CurrentDriver.DriverSetup; if (!Path.IsPathRooted(TargetLibraryFileName)) { string IviPath = (string)Registry.LocalMachine.OpenSubKey("SOFTWARE\\IVI").GetValue("IviStandardRootDir"); TargetLibraryFileName = Path.Combine(IviPath, "Bin\\" + TargetLibraryFileName); } LoadLibrary(); InitDynamicAssemblyBuilder(); DriverFunctionInterop(); interopClassType = typeBuilder.CreateType(); DriverInterop = (Adapter.IviCInterop.IviDriver)CreateInstanse(); ViSessionStatusCheck(DriverInterop.init(TargetDriverName, idQuery, reset, ref ViSession)); driverOperation = (IIviDriverOperation) new DriverOperation(this); identity = (IIviDriverIdentity) new DriverIdentity(this, TargetSoftwareModuleName); utility = (IIviDriverUtility) new DriverUtility(this); Marshal.ReleaseComObject(CurrentDriver); Marshal.ReleaseComObject(ConfigStore); }
public void DriverIdentity() { IIviDriverIdentity Identity = Driver.Identity; Assert.IsNotNull(Identity); Assert.AreEqual("IVI driver for Agilent Technologies 34401A Digital Multi Meter", Identity.Description); Assert.AreEqual("Ag34401", Identity.Identifier); Assert.AreEqual("1.2.5.0", Identity.Revision); Assert.AreEqual("Agilent Technologies", Identity.InstrumentManufacturer); Assert.AreEqual("34401A", Identity.InstrumentModel); Assert.AreEqual("Sim1.2.5.0", Identity.InstrumentFirmwareRevision); Assert.AreEqual(3, Identity.SpecificationMajorVersion); // Error with 34401 Driver // Assert.AreEqual(0, Identity.SpecificationMinorVersion); string SupportedInstrumentModels = "34401A"; Assert.AreEqual(SupportedInstrumentModels.Split(','), Identity.GetSupportedInstrumentModels()); string GetGroupCapabilities = "IviDmmBase,IviDmmACMeasurement,IviDmmFrequencyMeasurement,IviDmmMultiPoint,IviDmmTriggerSlope,IviDmmSoftwareTrigger,IviDmmDeviceInfo,IviDmmAutoRangeValue,IviDmmAutoZero"; Assert.AreEqual(GetGroupCapabilities.Split(','), Identity.GetGroupCapabilities()); }
public override bool Initialize(out string outMessage, out IIviDriverIdentity identity) { identity = null; try { outMessage = string.Empty; driver = new KtRFPowerMeter(); string initOptions = "QueryInstrStatus=true, Simulate=false, DriverSetup= Model=, Trace=false, TraceName=c:\\temp\\traceOut"; bool idquery = true; bool reset = true; identity = driver.Identity; // Initialize the driver. See driver help topic "Initializing the IVI-COM Driver" for additional information driver.Initialize(m_resourceDesc, idquery, reset, initOptions); driver.System.Preset(); // Wait for the preset to complete and wiat for 10 seconds driver.System.IOTimeout = 20000; // Select Channel A and set INIT:CONT OFF ChannelA = (KtRFPowerMeterChannel)driver.Channels.get_Item("A"); ChannelB = (KtRFPowerMeterChannel)driver.Channels.get_Item("B"); Measurement = driver.Measurements2.get_Item2("1"); ChannelA.Trigger.ContinuousEnabled = true; m_continues = ChannelA.Trigger.ContinuousEnabled; return(true); } catch (Exception ex) { outMessage = ex.Message; return(false); } }
public virtual bool Initialize(out string outMessage, out IIviDriverIdentity identity) { identity = null; outMessage = "not imlemented"; return(true); }