-
Notifications
You must be signed in to change notification settings - Fork 183
DotNetSupport
If you've stumbled upon this page, this is referring to in-progress development, and the information within can change at any point before release.
See this branch.
The .NET bindings for SoapySDR give the user access to the full SoapySDR functionality in C#. There are some differences between the C++ API and the .NET API, primarily to better match C# coding conventions and take advantage of native .NET capabilities to provide convenient extensions to the API. These changes will be explained below, and full .NET API documentation is available (TODO: link when uploaded) here.
There is currently no planned Mono support, as CMake only natively supports C# on Windows with MSVC.
The following dependencies are needed to build SoapySDR's .NET bindings. Links to prebuilt installers within.
- MSVC toolkit 1920+ / Visual Studio 16+
- CMake (3.8)+: necessary for native C# support
- SWIG: used to bridge C++ and C#
Per C# API convention, trivial SoapySDR::Device
getters and setters are exposed via properties.
Read-write properties are generally device-wide and independent of RF direction. For example:
- C++:
rate = sdr->getMasterClockRate()
andsdr->setMasterClockRate(rate)
- .NET:
rate = sdr.MasterClockRate
andsdr.MasterClockRate = rate
Device identification getters are now accessed by read-only properties. For example:
- C++:
key = sdr->getHardwareKey()
- .NET:
key = sdr.HardwareKey
TODO
TODO
- Functions that accept
SoapySDR::Kwargs
as arguments on the C++ layer can accept either a string or anyIDictionary<string, string>
subclass.
// Enumerate devices.
var results = Pothosware.SoapySDR.Device.Enumerate();
foreach(var result in results)
System.Console.WriteLine(result);
// Create device instance.
// Args can be user-defined or from the enumeration result.
var args = "driver=rtlsdr";
var sdr = new Pothosware.SoapySDR.Device(args);
// Query device info.
System.Console.WriteLine("Antennas:");
foreach(var antenna in sdr.ListAntennas(Pothosware.SoapySDR.Direction.Rx, 0)))
System.Console.WriteLine(" * " + antenna);
System.Console.WriteLine("Gains:");
foreach(var gain in sdr.ListGains(Pothosware.SoapySDR.Direction.Rx, 0)))
System.Console.WriteLine(" * " + gain);
System.Console.WriteLine("Frequency ranges:");
foreach(var freqRange in sdr.GetFrequencyRange(Pothosware.SoapySDR.Direction.Rx, 0)))
System.Console.WriteLine(" * " + freqRange);
// Apply settings.
sdr.SetSampleRate(Pothosware.SoapySDR.Direction.Rx, 0, 1e6);
sdr.SetFrequency(Pothosware.SoapySDR.Direction.Rx, 0, 912.3e6);
// Setup a stream (complex floats).
var rxStream = sdr.SetupComplexRxStream<float>(new uint[]{0}, "");
rxStream.Activate(); // Start streaming
// Create a reusable array for RX samples.
var buff = new float[rxStream.MTU * 2];
// Receive some samples.
for(var i = 0; i < 10; ++i)
{
Pothosware.SoapySDR.StreamResult streamResult;
var errorCode = rxStream.Read<float>(ref buff, Pothosware.SoapySDR.StreamFlags.None, 0, 0, out streamResult);
System.Console.WriteLine("Error code: " + errorCode);
System.Console.WriteLine("Receive flags: " + streamResult.Flags);
System.Console.WriteLine("Timestamp (ns): " + streamResult.TimeNs);
}
// Shut down the stream.
rxStream.Deactivate();
rxStream.Close();
TODO
- FAQ
- Build guide
- Driver guide
- SoapySDR header files
- Doxygen documentation
- Python binding support
- LuaJIT binding support
- .NET binding support
- GO binding support
- Rust binding support
- Julia binding support
- Pothos SDR Tutorial
- Help and support
- Pothos users' group
- Twitter @pothosware
- IRC chat #pothos
- Slack workspace
- Contract services
- Developer blog
- Contributing
- Donate
- Example support
- Remote access
- Multi device
- Device sharing
- SIMD converters
- Audio devices
- Osmo support
- NovenaRF support
- EVB7 support
- UHD support
- Blade RF support
- Hack RF support
- RTL-SDR support
- SDR Play support
- Radioberry support
- Red Pitaya support
- Lime Suite support
- Airspy support
- Airspy HF+ support
- PlutoSDR support
- Skylark Iris module
- Funcube Dongle Pro+
- IC-R8600 Receiver
- Epiq Sidekiq
- NetSDR support
- XTRX support
- RTL TCP support
- SpyServer support
- Afedri support
- Pothos SDR
- Cubic SDR
- Rx Tools
- LuaRadio
- GNURadio blocks
- Osmocom blocks
- QSpectrumAnalyzer
- RTL433 project
- Welle.io DAB/DAB+
- SDRangel analyzer
- RTLSDR-Airband
- HABDEC RTTY decoder
- LinHPSDR receiver
- HackTV transmitter
- ODR-DabMod
- QUISK SDR
- SigDigger
- Suscan
- SdrGlut
- QRadioLink
- OpenWebRX
- SDR++
- Seify
- Abraca DAB radio