#include <deviceplutosdrscan.h>
Definition at line 27 of file deviceplutosdrscan.h.
◆ getNbDevices()
int DevicePlutoSDRScan::getNbDevices |
( |
| ) |
const |
|
inline |
◆ getSerialAt()
const std::string * DevicePlutoSDRScan::getSerialAt |
( |
unsigned int |
index | ) |
const |
◆ getSerials()
void DevicePlutoSDRScan::getSerials |
( |
std::vector< std::string > & |
serials | ) |
const |
Definition at line 127 of file deviceplutosdrscan.cpp.
References m_scans.
129 std::vector<DeviceScan>::const_iterator it =
m_scans.begin();
132 for (; it !=
m_scans.end(); ++it) {
133 serials.push_back(it->m_serial);
std::vector< DeviceScan > m_scans
◆ getURIAt()
const std::string * DevicePlutoSDRScan::getURIAt |
( |
unsigned int |
index | ) |
const |
◆ getURIFromSerial()
const std::string * DevicePlutoSDRScan::getURIFromSerial |
( |
const std::string & |
serial | ) |
const |
◆ scan()
void DevicePlutoSDRScan::scan |
( |
| ) |
|
Definition at line 29 of file deviceplutosdrscan.cpp.
References i, m_scans, m_serialMap, m_urilMap, and DevicePlutoSDRBox::probeURI().
32 struct iio_scan_context *scan_ctx;
33 struct iio_context_info **info;
35 scan_ctx = iio_create_scan_context(0, 0);
39 qCritical(
"PlutoSDRScan::scan: could not create scan context");
43 num_contexts = iio_scan_context_get_info_list(scan_ctx, &info);
47 qCritical(
"PlutoSDRScan::scan: could not get contexts");
53 if (num_contexts == 0)
55 struct iio_context *ctx = iio_create_network_context(
"pluto.local");
59 m_scans.push_back({std::string(
"PlutoSDR"), std::string(
"networked"), std::string(
"ip:pluto.local")});
62 iio_context_destroy(ctx);
65 for (i = 0; i < num_contexts; i++)
67 const char *description = iio_context_info_get_description(info[i]);
68 const char *uri = iio_context_info_get_uri(info[i]);
74 qDebug(
"PlutoSDRScan::scan: %d: %s [%s]", i, description, uri);
75 char *pch = strstr(const_cast<char*>(description),
"PlutoSDR");
79 m_scans.push_back({std::string(description), std::string(
"TBD"), std::string(uri)});
82 std::regex desc_regex(
".*serial=(.+)");
83 std::smatch desc_match;
84 std::regex_search(
m_scans.back().m_name, desc_match, desc_regex);
86 if (desc_match.size() == 2)
88 m_scans.back().m_serial = desc_match[1];
94 iio_context_info_list_free(info);
95 iio_scan_context_destroy(scan_ctx);
std::vector< DeviceScan > m_scans
std::map< std::string, DeviceScan * > m_urilMap
std::map< std::string, DeviceScan * > m_serialMap
static bool probeURI(const std::string &uri)
◆ m_scans
std::vector<DeviceScan> DevicePlutoSDRScan::m_scans |
|
private |
◆ m_serialMap
std::map<std::string, DeviceScan*> DevicePlutoSDRScan::m_serialMap |
|
private |
◆ m_urilMap
std::map<std::string, DeviceScan*> DevicePlutoSDRScan::m_urilMap |
|
private |
The documentation for this class was generated from the following files: