10-14-2022 03:06 AM
Hello,
Once I got the adapter object returned by the GetAdapterByKeyName method, how do I convert this object into a SequenceAdapter for example
The help says in the remark "To access the properties and methods of a specific adapter, call GetAdapterByKeyName and then query the returned Adapter object for the interface of the desired adapter."
In some languages you can use the expression "Engine.GetAdapterByKeyName("Sequence Adapter).AsSequenceAdapter". But it doesn't seem to work in Python
Does anybody has the solution ?
Thanks
Laurent
Solved! Go to Solution.
10-14-2022 09:39 AM
Before you look at the rest of my ramblings below, could you check one thing for me?
It seems like the expression you wrote below is missing quotation marks after "Sequence Adapter", was that a copy/paste from your Python code or just a typo in the forums? Just to check and be sure.
From looking at the documentation on the GetAdapterByKeyName method, it returns an object adapter
Looking at the SequenceAdapter object documentation, if you've accessed the SequenceAdapter, you should be able to use the method AsAdapter to further access the interface.
https://www.ni.com/docs/en-US/bundle/teststand/page/tsapiref/reftopics/sequenceadapter.htm
Then use the properties and methods of the Adapter object to do what you need to
https://www.ni.com/docs/en-US/bundle/teststand/page/tsapiref/reftopics/adapter.htm
So something like:
Engine.GetAdapterByKeyName("Sequence Adapter").AsAdapter.Configure()
Will launch the Adapter Configuration dialog box for the Sequence Adapter
The only method that I see different between the Adapter object and the SequenceAdapter object is the GetSequenceFile method, so if that's not the one you're looking for you should be able to just treat the Sequence Adapter as a regular Adapter object and do what you need to.