10-08-2012 04:29 AM
Up to now I use CVI to program RFSA module. I am looking to switch over to C#. The NET library for RFSA don't seems to include the class for demodulating IQ signal capture. Nor does it contains a class for converting IQ signal to frequency spectrum. Will they be available in near future.
Best Regards
Shane
10-11-2012 09:35 AM
Hi Shane
Sorry for the delay in responding to your question.
Although there is some native .NET NI-RFSA support, the modulation toolkit and the spectral measurements toolkit are currently only supported using a C API wrapper.
The following MSDN link provides some assistance in invoking Win32 DLLs using C#:
Calling Win32 DLLs in C# with P/Invoke
For demodulating IQ signal capture you will need to invoke the modulation toolkit, and to convert IQ signal to frequency spectrum the spectral measurements toolkit.
You can suggest the development of native .NET support for these toolkits at the NI Measurement Studio Idea Exchange board
Kind Regards
Chris | Applications Engineer NIUK
10-12-2012 02:57 AM
Hello,
Can you please let me know the name of dll files for those toolkits, so i can do DllImport().
Also toolkit have it own paratmeter type such as "SynchronizationParameters". I am ok with simple parameter type like int and double but not sure about customised one.
Thanks
Shane
10-12-2012 08:36 AM
Hi Shane
You actually need to create the C API wrapper from the .lib and .h files which are available. On my PC I found these in the following locations:
Spectral Measurements Toolkit:
C:\Program Files (x86)\National Instruments\Shared\ExternalCompilerSupport\C\include\smt.h
C:\Program Files (x86)\National Instruments\Shared\ExternalCompilerSupport\C\lib32\msvc\nismt.lib
Modulation Toolkit:
C:\Program Files (x86)\National Instruments\Shared\CVI\Include\dModt_Demodulation.h
C:\Program Files (x86)\National Instruments\Shared\CVI\Extlib\msvc\dModt.lib
We only fully support the use of these toolkits using CVI so you will need to refer to external help for information on how to create a C API wrapper from a .lib and .h file. I found the following forum post to look useful: http://www.pcreview.co.uk/forums/lib-and-h-files-get-managed-wrapper-t1360290.html
Let me know how you get on
Kind regards
10-18-2012 08:02 AM
For sake of simplifying I tried to build a managed DLL library with only three functions as seen in attached dummy.cpp and dummy.h
got compiled error
1>------ Build started: Project: dummy, Configuration: Debug Win32 ------
1> stdafx.cpp
1> dllmain.cpp
1> dummy.cpp
1> Creating library C:\dummy\dummy\Debug\dummy.lib and object C:\dummy\dummy\Debug\dummy.exp
1>dummy.obj : error LNK2019: unresolved external symbol _ModtCreateSessionHandle@4 referenced in function "public: static int __cdecl RFwrapper::ModTool::modtCreateSessionHandle(int *)" (?modtCreateSessionHandle@ModTool@RFwrapper@@SAHPAH@Z)
1>dummy.obj : error LNK2019: unresolved external symbol _ModtDestroySessionHandle@4 referenced in function "public: static int __cdecl RFwrapper::ModTool::modtDestroySessionHandle(int)" (?modtDestroySessionHandle@ModTool@RFwrapper@@SAHH@Z)
1>C:\dummy\dummy\Debug\dummy.dll : fatal error LNK1120: 2 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
11-21-2012 03:27 AM
Hi again,
I have been reading up materials on what is needed to make a .NET wrapper on C library. I understand I need to create CLR class. This will restrict me to use only /MD option (Multithread DLL). Also cli::pin_ptr is needed to pin the parameters into managed memory. For this to work C library have to be created in Visual C++ 7 or greater, see site (http://social.msdn.microsoft.com/Forums/eu/vcgeneral/thread/46b05709-a084-4b19-9603-53070afd4e54 ). The toolkit libraries I have is the latest one, made last year.
11-23-2012 09:31 AM
Please see attached cpp & h file. If I comment out ModCreateSessionHandle() and ModDestroySessionHandle() then I can successfully create CLR Class DLL that will be accepted by C#. If either of the two functions is in play when attempting to build DLL then I get error (see attached file). I am stuck here.
11-28-2012
01:20 AM
- last edited on
06-20-2024
02:03 PM
by
Content Cleaner
Hi,
Please let me know if I have misunderstood the issue.
We have .NET Wrappers for both Spectral Measurement Toolkit and Modulation Toolkit: https://www.ni.com/en/support/documentation/supplemental/13/national-instruments--net-support.html
These provide a .NET interface to underlying toolkits. Look at the examples in VB and C# to understand how it works.These wrappers are not as good as the native API (like RFSA) in terms of .NET features, but they provide a more basic .NET interface to NI toolkit API, temporarily untill native API for all toolkits be developed.
Thanks & Regards,
Raghavendra
11-29-2012 02:58 AM
Hi,
I tried SMTDotNetWrapper.zip. I see a dll file. In c# Express I attempted to add reference to this file and get error, see attached.
MTDotNetWrapper unfortunately doesn't cover what I need.
I guess for now I will use our hardware solution for reading message. In any event I will try I will try to make a wrapper at my leisure.
I would appreciate a post here when NET version of both toolkits before closing this stream.
Best Regards
Shane
11-29-2012 04:12 AM
Hi Shane,
nismt.dll is a native dll which means that you cannot add it directly to .NET project via Add Reference..
We created the .NET wrapper file niSMT.cs file which does the DllImport to nismt.dll so that users can have a .NET interface to the toolkit API without having to do DllImport explicitly.
When I checked the SMT example wrappers from the above link it looks like the reference to niSMT.cs file is broken which might have caused the confusion.
Remove the broken link to "niSMT.cs" file and re-add it from correct location. Please follow the steps below and refer to the screenshots attached..
1. Open the SmtContinousZoom example in Visual Studio (I used VS2008 Enterprise Edition but should be same in other versions)
2. Right Click on the Broken "niSMT.cs" link and say "Remove"
3. Right Click on the SmtContinuousZoom.2008 project and "Add->Existing item". A file browser pops up.
4. Navigate to NI-SMTDotNetWrappers260\NI-SMT\V2.6 folder and select niSMT.cs file and "Add As Link" (refer to screenshot attached)
5. The correct link will have a green icon (the broken link has a yellow icon next to the file name)
Right click on project and say "Build". The example should now build without any issues.
Sorry for the broken link!
Thanks & Regards,
Raghavendra