NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

In Python, how to call GetAdapterByKeyName and then query the returned Adapter object for the interface of the desired adapter

Solved!
Go to solution

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

0 Kudos
Message 1 of 2
(1,266 Views)
Solution
Accepted by topic author Laurent_B

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.

Jorr-El
Systems Engineer
Testeract: Automated Test Specialists
Message 2 of 2
(1,229 Views)