-
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 and should 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 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” and should reflect the latest released version.
Once downloaded, the following steps should be taken to build the final DLL that will 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_19.1>>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
- 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” that you can right-click and delete from the Solution Explorer on the right-hand side of the Visual Studio environment.
-
You can then right-click the project name, “ModularInstruments” in the Solution Explorer and select Add>>Existing Item… and navigate to the path:
..\niWLAN_DotNETWrapper_19.1\niWLAN_DotNETWrapper_19.1\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 before moving on by right-clicking the “ModularInstruments” project in the Solutions Explorer and selecting Properties. Make the modifications seen here and save the Solution:
- Now you can right-click on the Solution title, ‘Wrappers’ in the Solutions Explorer and select Add>>New Project… to create a 2nd project in the Wrappers solution. You will create the same type as before (“Class Library (.NET Framework) C#”). This time, you will only need to name the project “RFToolkits” and click “Create”:
- You will then repeat the step of deleting the default “Class1.cs” file and adding the following .cs files: • …\niWLAN_DotNETWrapper_19.1\niWLAN_DotNETWrapper_19.1\DotNetWrappers\NI-WLANA\19.1\Source\niWLANA.cs • …\niWLAN_DotNETWrapper_19.1\niWLAN_DotNETWrapper_19.1\DotNetWrappers\NI-WLANG\19.1\source\niWLANG.cs
Your resulting solution should look like this:
- You then need to right click the project “RFToolkits” and select properties to modify as seen below:
- Now, since the RF Toolkits 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 check the box on and click ‘OK’:
- Finally before the final build you can clean this Solution up by deleting a few of the default References that were added by default with exception of ‘System.dll’ which is used by these wrappers (right-click and ‘Remove’):
Your final Solution should look like this:
- To Build the Class Library (DLL) you will change the build options at the top of the editor window to “Release” and “Any CPU” and then select Build>>Build Solution.
If successful, you should see a message in the output window like this:
- Now that you have built the DLL’s, you should find them in the “Release” folder of the RF Toolkits folder such as: C:\Users\AE-STEG\Desktop\Temp\Wrappers\RFToolkits\bin\Release
- Finally, to call this 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.