-
Notifications
You must be signed in to change notification settings - Fork 4
.NET Wrapper Solution Build Process
Please review the readme in the wrappers directory before reading this document.
This guide is intended to show one way that the set of WLAN Toolkit C# wrappers can be converted into a Python invocable DLL utilized by pythonnet for WLAN test applications on the NI platform. This is an unofficial guide that can be used as a starting point for test developers who are tasked with keeping their Python code up to date with the latest version of WLAN Measurement Toolkit (abbreviated WLAN TK). Once created and called from code, it is recommended that the process described below be repeated for future releases to ensure that the latest features and enhancements become accessible to the program developer.
The National Instruments WLAN Toolkit for Generation and Analysis is published at the following location on the NI website: National Instruments .NET Support. The WLAN TK wrapper can be found in the table titled “Download .NET Source Code Wrapper APIs”. It should reflect the latest released version.
Once downloaded, the following steps should be taken to build the assemblies to be used in the Python script via pythonnet.
- Unzip the contents of the .zip file that contains the WLAN TK wrapper. You should have the following contents:
- niWLAN_DotNETWrapper_XX.X>>DotNetWrappers
- common – Contains shipping example using both generation and analysis
- NI-WLANA – Contains all shipping examples and source files for WLAN Analysis TK
- NI-WLANG – Contains all shipping examples and source files for WLAN Generation TK
The WLAN TK wrappers ship with two instrument driver wrappers: niRFSA.cs
and niRFSG.cs
. These wrappers may not be the latest version and may need to be updated to expose the latest features. In that event, you can find the latest driver wrappers here: NI-RFSA and NI-RFSG. Substitute these files for any references to niRFSA.cs
and niRFSG.cs
in this tutorial.
- Open a new Visual Studio project of the type “Class Library (.NET Framework) C#” and click “Next”:
- Configure the project by:
- A. Naming the project “ModularInstruments”
- B. Selecting a good disk location for the source project to be maintained
- C. Naming the solution “Wrappers”
- D. Selecting “.NET Framework 4” from the drop-down list
- E. And clicking “Create”
-
You will start with a default .cs file called
Class1.cs
. Right-click and "Delete" it from the Solution Explorer on the right-hand side of the Visual Studio environment. -
Right-click on the ModularInstruments project in the Solution Explorer and select Add>>Existing Item... Navigate to the path
..\niWLAN_DotNETWrapper_XX.X\niWLAN_DotNETWrapper_XX.X\DotNetWrappers\common\80211OFDMGenerateAndAnalyzeWaveform(Shared LO)\cs
to highlight and add the following:niInteropCommon.cs
niRFSA.cs
niRFSG.cs
The resulting project should look like this in Visual Studio:
- You should then modify the properties of the project by right-clicking the ModularInstruments project in the Solution Explorer and selecting "Properties". Make the modifications seen here and save the solution:
- Next, right-click on the "Wrapper" solution title in the Solution Explorer and select Add>>New Project... You will create the same type of project as before, Class Library (.NET Framework) C#. This time, you will name the project “RFToolkits” and click “Create”:
- You will then repeat steps 4 and 5 by deleting the default
Class1.cs
file and adding the following .cs files:
...\niWLAN_DotNETWrapper_XX.X\niWLAN_DotNETWrapper_XX.X\DotNetWrappers\NI-WLANA\XX.X\Source\niWLANA.cs
...\niWLAN_DotNETWrapper_XX.X\niWLAN_DotNETWrapper_XX.X\DotNetWrappers\NI-WLANG\XX.X\source\niWLANG.cs
Your resulting solution should look like this:
- Now, you need to right-click the project “RFToolkits” and select "Properties" to modify them as seen below:
- Since the RFToolkits project C# wrappers also depend on the namespace contained within the ModularInstruments project, you will need to add a reference to it within the solution. Right-click on “References” under the RFToolkits project in the Solution Explorer and select "Add Reference..." A dialog box will pop-up and you can navigate to the "Projects" tab where you should see the ModularInstruments project as an option that you can select and click "OK":
- Finally, before the final build, you can clean this solution up by deleting (right-click and "Remove") a few of the references that were added by default, with exception of System.dll which is used by these wrappers:
Your final solution should look like this:
- To build the Class Library (DLL), you should change the build options at the top of the editor window to “Release” and “Any CPU”, then select Build>>Build Solution.
If successful, you should see a message in the output window like this:
- Now that you have built the assembies, you will find them in the
Release
folder of theRFToolkits\bin
folder on disk. The path will be similar toC:\Users\AE-STEG\Desktop\Temp\Wrappers\RFToolkits\bin\Release
.
- Finally, to call these assemblies from your Python scripts, you will either modify the code to point to this folder or copy them into a pre-determined location of your choice (in the case that your code already points there).