Skip to content

Commit daa8958

Browse files
committed
Added min, max, step to gain.
1 parent 609071e commit daa8958

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

sources/radio/help_structures.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,11 @@ NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(Satellite, id, name, frequency, bandwidth, mo
4545
struct Gain {
4646
std::string name;
4747
double value;
48+
double min;
49+
double max;
50+
double step;
4851
};
49-
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(Gain, name, value)
52+
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT(Gain, name, value, min, max, step)
5053

5154
struct Device {
5255
bool enabled{};

sources/radio/sdr_device_reader.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ std::vector<Gain> getGains(SoapySDR::Device* sdr) {
2828
colored(GREEN, "{}", gainRange.minimum()),
2929
colored(GREEN, "{}", gainRange.maximum()),
3030
colored(GREEN, "{}", gainRange.step()));
31-
gains.emplace_back(gain, gainRange.maximum());
31+
gains.emplace_back(gain, gainRange.maximum(), gainRange.minimum(), gainRange.maximum(), gainRange.step());
3232
}
3333
return gains;
3434
}
@@ -45,6 +45,7 @@ void SdrDeviceReader::updateDevice(Device& device, const SoapySDR::Kwargs args)
4545

4646
device.driver = driver;
4747
device.sample_rates = getSampleRates(sdr);
48+
device.gains = getGains(sdr);
4849

4950
SoapySDR::Device::unmake(sdr);
5051
}
@@ -113,5 +114,11 @@ void SdrDeviceReader::clearDevices(nlohmann::json& json) {
113114
for (auto& device : json.at("devices")) {
114115
device.erase("driver");
115116
device.erase("sample_rates");
117+
118+
for (auto& gain : device.at("gains")) {
119+
gain.erase("min");
120+
gain.erase("max");
121+
gain.erase("step");
122+
}
116123
}
117124
}

0 commit comments

Comments
 (0)