Code examples .Net and C#?

Add useful snippets of code or links to entire SDR projects.
Toontje
Posts: 48
Joined: Fri Aug 07, 2015 8:36 am

Code examples .Net and C#?

Postby Toontje » Tue Mar 22, 2016 12:53 pm

Hi coders!

I want to make a start with understanding how to write an app for the SDRplay using Visual Studio and C#.
Do we have any code examples i can start off with?

Thanks,

Ton.
Last edited by Toontje on Thu Jan 01, 1970 12:00 am, edited 0 times in total.
Reason: No reason

Sasan
Posts: 92
Joined: Sat Jun 27, 2015 1:15 am

Re: Code examples .Net and C#?

Postby Sasan » Tue Mar 22, 2016 11:23 pm

Hi
I wrote a simple console app which saves I/Q streams to a file (which can later be opened in apps like Gqrx or SDRSharp)
It's very basic and does not get command line arguments (all values are hard-coded)
The code is attached.

Note that I'm not a C# programmer and I don't even use Windows a lot, so it's just a proof-of-concept to show how to call the API from C#.
I compiled the code on .NET 3.5 and executed it on Windows 10 to make sure it works.
It calls the mir_sdr_api.dll, found in :
C:\Program Files\MiricsSDR\API\x86 and C:\Program Files\MiricsSDR\API\x64
Does this help you?

P.S: take a look at SDRPlay's sample codes (in C): https://github.com/SDRplay/
and API specification: http://www.sdrplay.com/docs/Mirics_SDR_ ... cation.pdf
Attachments
Program.cs.zip
(1.6 KiB) Downloaded 293 times
Last edited by Sasan on Thu Jan 01, 1970 12:00 am, edited 0 times in total.
Reason: No reason

Toontje
Posts: 48
Joined: Fri Aug 07, 2015 8:36 am

Re: Code examples .Net and C#?

Postby Toontje » Wed Mar 23, 2016 7:22 am

Yes, this helps me a lot!

Thanks!
Last edited by Toontje on Thu Jan 01, 1970 12:00 am, edited 0 times in total.
Reason: No reason

ronkpa
Posts: 5
Joined: Tue Apr 11, 2017 2:01 am

Re: Code examples .Net and C#?

Postby ronkpa » Wed Apr 26, 2017 7:13 pm

Thank you Sasan Program.cs was very helpful. I am creating a C# wrapper based on your work.
The latest API release is 2.10 (11/Apr/2017).
The latest API Specification is 2.09 (22 Dec 2016) says there is only one SetParam command 101=change 1st LO freq.
In your program you use commands 201 and 202. Do you have a later API specification, or did you use another reference?
Thanks again.
Last edited by ronkpa on Thu Jan 01, 1970 12:00 am, edited 0 times in total.
Reason: No reason

Sasan
Posts: 92
Joined: Sat Jun 27, 2015 1:15 am

Re: Code examples .Net and C#?

Postby Sasan » Thu Apr 27, 2017 8:17 am

ronkpa wrote:Thank you Sasan Program.cs was very helpful. I am creating a C# wrapper based on your work.
The latest API release is 2.10 (11/Apr/2017).
The latest API Specification is 2.09 (22 Dec 2016) says there is only one SetParam command 101=change 1st LO freq.
In your program you use commands 201 and 202. Do you have a later API specification, or did you use another reference?
Thanks again.


I don't remember which version I'd used, but the latest API specification says the "mir_sdr_SetParam" function is deprecated and will be removed in future.
(Section 3.2 on http://www.sdrplay.com/docs/Mirics_SDR_ ... cation.pdf
OR section 3.3 on http://www.sdrplay.com/docs/SDRplay_SDR ... cation.pdf)

So I think you can ignore the values I'd used (and the function as well)

Reason: No reason

sdrplay
Posts: 541
Joined: Wed Jan 07, 2015 7:58 am

Re: Code examples .Net and C#?

Postby sdrplay » Sat May 13, 2017 6:40 pm

If you have the c# communication to the API sorted, then you can follow the flow in the play_sdr example we updated on github (http://www.github.com/SDRplay/examples)

Best regards,

SDRplay Support

Reason: No reason


Return to “Code Corner”

Who is online

Users browsing this forum: No registered users and 2 guests