Keysight M8000 Series of BER Test Solutions User Guide 575
Utilities 9
The corresponding IronPython code:
clr.AddReference("mscorlib")
from System import String
from System.Collections.Generic import List
stringLis
t = List[String]()
Using User Defined .NET Assemblies (e.g. Implementations of IBerReader)
In order to reference user defined assemblies, the search path of the
scripting engine needs to be extended. After this is done the assembly
reference can added and the data type imported.
# Add c:\MyLibraries\MyDUT to the search path import sys
sys.path.append("C:\\MyLibraries\\MyDUT")
# reference MyDutCustomBerReader.dll located in
c:\MyLibraries\MyDUT
clr.AddReferenceToFile("MyDutCustomBerReader")
# from the namespace MyNamespace.MyDutCustomBerReader
# that is defined in the previously referenced assembly,
# import the actual data type.
from MyNamespace.MyDutCustomBerReader import
MyDutBerReader
# create an instance of MyDutBerReader
myDUT = MyDutBerReader()
# call a function defined in the data type MyDutBerReader
myDUT.DoSomething()
Using the COM Port to Access the DUT
.NET does provide a dedicated class to work with the computer's COM
ports. This class is implemented in the System assembly.
Importing the SerialPort class
# import SerialPort from System assembly
clr.AddReference("System")
import System.IO.Ports.SerialPort