01-25-2017 10:59 AM
In Type Palettes, I tried to get a member type from a type in a *.ini file, the member numeric type is Signed 32 bit integer (as indicated in Properties, C Struct Passing), but when I used Common C Adapter, methods GetStructMemberType(), it returns StructMemberType_Float64. Is this method has a bug, or do I have to use different method to get member numeric type?
Thank you so much for the help.
01-26-2017 01:17 AM
"numeric type is Signed 32 bit integer (as indicated in Properties, C Struct Passing)" - I quess these are properties from "Memory Layout for Property" section, of the Type Properties -> C Struct Passing. So this is just about how number will be processed/held in memory while struct passing, but not its representation in TestStand iteself. So that function GetStructMemberType() returns everything correct - b/c if you'll check representation of number in type properties (right-click - Representation...) you'll see there just 64-bit formats.
Hope, this will help.
01-26-2017 09:54 AM
So is there any way that allow me to extract the Numeric Type in C Struct Passing, "Memory Layout for Property"?
Thanks
01-26-2017 04:18 PM
I could get it by doing this:
RunState.Engine.GetAdapterByKeyName(FlexCAdapterKeyName).AsCommonCAdapter.GetStructMemberType(RunState.Engine.GetTypeDefinition("Name Of Type"), "Lookup String")
For example if I had a type call Foo which was a container with a numeric in it called MyNumber then my function would look like:
RunState.Engine.GetAdapterByKeyName(FlexCAdapterKeyName).AsCommonCAdapter.GetStructMemberType(RunState.Engine.GetTypeDefinition("Foo"), "MyNumber")
This will return the numeric value which represents the enumeration found in the help here:
http://zone.ni.com/reference/en-XX/help/370052P-01/tsapiref/reftopics/structmembertypes/
So for instance Float32 will return a 0.
Hope this helps,
01-30-2017 10:40 AM
This maybe is a dumb question, but how do I start RunState?
01-30-2017 11:05 AM
You have to have an execution. How are you calling the type? Is this done in TestStand or another language?
01-30-2017 11:18 AM
I'm attaching a small example that demonstrates this. Let me know if this helps.
01-30-2017 11:28 AM
This is done in C#, and my program parse the existing sequence file. Basically, this is how I do it, starting with:
_appMgr.LoginOnStart = false;
_appMgr.Start();
_engine = _appMgr.GetEngine();
_dllAdapter = _engine.GetAdapterByKeyName(TS.AdapterKeyNames.FlexCAdapterKeyName) as TSAdp.DllAdapter;
_commonAdapter = _dllAdapter.AsCommonCAdapter();
TSAdp.StructMemberTypes elementType = _commonAdapter.GetStructMemberType(typeDefStructProObj, elementName);
The above elementType always return StructMemberType_Float64, but it is actually 32 bit integer.
01-30-2017 03:23 PM
I don't have a C# compiler on my machine. I tried what you are talking about in LabVIEW only and it works flawlessly. hmmm?
What version of TestStand are you using? I tested mine in 2010.
01-31-2017 08:54 AM - edited 01-31-2017 08:54 AM
NI TestStand 2010. I am new and I don't know why. Thanks for your help