Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 46 additions & 2 deletions SoapyLMS7/Streaming.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,17 @@ SoapySDR::ArgInfoList SoapyLMS7::getStreamArgsInfo(const int direction, const si
argInfos.push_back(info);
}

// channel selection
{
SoapySDR::ArgInfo info;
info.value = "0";
info.key = "channel";
info.name = "Channel";
info.description = "List of channels to use, separated by spaces. Defaults to 0.";
info.type = SoapySDR::ArgInfo::INT;
argInfos.push_back(info);
}

//align phase of Rx channels
{
SoapySDR::ArgInfo info;
Expand Down Expand Up @@ -143,8 +154,41 @@ SoapySDR::Stream *SoapyLMS7::setupStream(
config.performanceLatency = 0.5;
config.bufferLength = 0; //auto

//default to channel 0, if none were specified
const std::vector<size_t> &channelIDs = channels.empty() ? std::vector<size_t>{0} : channels;
std::vector<size_t> chans = {};

/* Try to use the channels passed in the `channel` device argument */
if (_deviceArgs.count("channel")) {
const std::string channelstr = _deviceArgs.at("channel");

size_t num;
std::stringstream ss(channelstr);

while (ss >> num) {
chans.push_back(num);
}

if (chans.empty()) {
SoapySDR::logf(SOAPY_SDR_ERROR, "Couldn't parse 'channels' string '%s': it should be a list of integers separated by spaces.", channelstr.c_str());
}
}

if (chans.empty()) {
/* If `channel` was not present, or was not a valid string, try to use channels
* passed as an argument to this function, or default to using channel 0. */
if (channels.empty()) {
/* No channels specified, default to 0. */
chans = std::vector<size_t>{0};
} else {
/* Use the channels from the function argument. */
chans = channels;
}
}

for (auto &ch : chans) {
SoapySDR::logf(SOAPY_SDR_INFO, "Using channel %zu", ch);
}

const std::vector<size_t> &channelIDs = chans;
for(size_t i=0; i<channelIDs.size(); ++i)
{
config.channelID = channelIDs[i];
Expand Down
Loading