NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Get Code Module Adapter Parameters

Solved!
Go to solution

I've noticed something similar to this has been asked before in the forum over the years, but I can't seem to find the answer I'm looking for.

 

When you add a CVI code module and select the DLL for the module, TestStand will display a list of function names.  When you select one of the functions, the arguments of the function will be displayed in the parameter list.

 

I'm trying to understand what TestStand API call is made to find this information.  I want to call this from .NET, so I'm assuming there is a specific TestStand API call (from Engine, Sequence, etc.) to get this info on demand.

 

Thanks in advance.

0 Kudos
Message 1 of 2
(1,563 Views)
Solution
Accepted by topic author testergi

Module.LoadPrototype is what I needed. Appears the method will only add with number of parameters or data types do not match.

 

Not sure if there is another way, but this helper clears and load before comparing.

 

public static void Compare(string ruleId, AnalysisContext analysisContext, CVIModule cviModule) { Step clonedStep = cviModule.AsCommonCModule().AsModule().Step.AsPropertyObject().Clone("", 0) as Step; CVIModule clonedCviModule = clonedStep.Module as CVIModule; int parameterCount = cviModule.Parameters.Count; for (int count = 1; count < parameterCount; count++) { clonedCviModule.Parameters.Delete(1); } // Load the module's parameters based on DLL. clonedStep.Module.LoadPrototype(0); // First element is the returned value and not compared here. for (int count = 1; count < parameterCount; count++) { CommonCParameter clonedCviModuleParameter = clonedCviModule.Parameters[count].AsCommonCParameter(); CommonCParameter cviModuleParameter = cviModule.Parameters[count].AsCommonCParameter(); if (clonedCviModuleParameter.ParameterName != cviModuleParameter.ParameterName) { string messageText = $"Code Module Parameter Mismatch: Expected '{clonedCviModuleParameter.ParameterName }'; Actual '{cviModuleParameter.ParameterName}'"; AnalysisMessage analysisMessage = analysisContext.NewMessage(ruleId, messageText, cviModuleParameter.AsPropertyObject()); analysisContext.ReportMessage(analysisMessage); } } }

0 Kudos
Message 2 of 2
(1,529 Views)