Page 1 of 1

Interfacing KSDR in C/C++

Posted: Sat May 04, 2019 8:14 am
by Jacky2k
Hi everyone,

I'd like to buy a KSDR for some applications I have in mind but I could not find out yet how to interface the KSDR from my own software. In my case this is a C++ application. Is there some sort of C/C++ library that sits on top of librtlsdr or do I have to control the KSDR (the noise source) manually and do the correlation/correction my self?
Best regards,
Fabian

Re: Interfacing KSDR in C/C++

Posted: Sat May 04, 2019 5:21 pm
by kb3cs
grab a copy of the KSDR code and see how it's done

Re: Interfacing KSDR in C/C++

Posted: Sat May 04, 2019 7:36 pm
by Jacky2k
OK, so no C library?
I know how to do it, but I am lazy and was hoping to save some time ;)

Re: Interfacing KSDR in C/C++

Posted: Sat May 04, 2019 10:36 pm
by kb3cs
but allow yourself a full review of the existing code first before declaring yourself too lazy to be lazy :geek:

Re: Interfacing KSDR in C/C++

Posted: Sun May 05, 2019 1:09 am
by rtlsdrblog
The code is all open source, so please feel free to take a look. It's not in API form though, you'd need to build your own interface.

The core C code handles the RTL-SDR driver interface and control, plus the syncing and gate functions. The Python code does the DSP and GUI. You can see how the Python code interfaces with the core C code, and then build a similar interface in your C++ program.

Re: Interfacing KSDR in C/C++

Posted: Sun May 12, 2019 8:12 am
by Stromeko
I've had a quick look, but there aren't really any comments (and still lots of occurences of Hydra). It would be highly appreciated if the general structure of the code and the layout of the FIFO / control channels was explained somewhere.

From my reading of the code (mostly just the C) the most highlevel structure is this: a thread per receiver to read into a circular buffer. Syncing the receivers produces an offset into each circular buffer (except one, I guess) to align the samples. Control (configuring the receivers) goes through some sort of FIFO and is then dispatched to all four receivers.

One of the questions I have is if you need to re-sync after each control change?