File: Registration.cpp

package info (click to toggle)
libxtrx 0.0.1%2Bgit20191219.98458ce-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, trixie
  • size: 544 kB
  • sloc: ansic: 6,598; cpp: 1,857; makefile: 9
file content (40 lines) | stat: -rw-r--r-- 1,021 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include "SoapyXTRX.h"
#include <SoapySDR/Registry.hpp>
#include <SoapySDR/Logger.hpp>

static SoapySDR::KwargsList findIConnection(const SoapySDR::Kwargs &matchArgs)
{
    SoapySDR::KwargsList results;

	xtrx_device_info_t devs[64];
	int res = xtrx_discovery(devs, 64);
	if (res < 0)
		return results;

	for (int i = 0; i < res; i++) {
		SoapySDR::Kwargs xtrxArgs;
		xtrxArgs["type"] = "xtrx";
		xtrxArgs["dev"] = devs[i].uniqname;

		xtrxArgs["module"] = "SoapyXTRX";
		xtrxArgs["media"] = devs[i].proto;
		xtrxArgs["name"] = "XTRX";
		xtrxArgs["addr"] = devs[i].uniqname;
		xtrxArgs["serial"] = devs[i].serial;

		xtrxArgs["driver"] = "xtrx";
		xtrxArgs["label"] = std::string("XTRX: ") + devs[i].uniqname + " (" + devs[i].speed + ")";
		results.push_back(xtrxArgs);
	}

    return results;
}

static SoapySDR::Device *makeIConnection(const SoapySDR::Kwargs &args)
{
    return new SoapyXTRX(args);
}

static SoapySDR::Registry registerIConnection("xtrx", &findIConnection, &makeIConnection, SOAPY_SDR_ABI_VERSION);