Skip to content

Commit 592995b

Browse files
committed
Added connected to device.
1 parent daa8958 commit 592995b

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

sources/radio/help_structures.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ struct Gain {
5252
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT(Gain, name, value, min, max, step)
5353

5454
struct Device {
55+
bool connected = false;
5556
bool enabled{};
5657
std::vector<Gain> gains{};
5758
std::string serial{};
@@ -65,4 +66,4 @@ struct Device {
6566

6667
std::string getName() const { return driver + "_" + serial; }
6768
};
68-
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT(Device, enabled, gains, serial, driver, sample_rate, ranges, start_recording_level, stop_recording_level, satellites, sample_rates)
69+
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT(Device, connected, enabled, gains, serial, driver, sample_rate, ranges, start_recording_level, stop_recording_level, satellites, sample_rates)

sources/radio/sdr_device_reader.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ void SdrDeviceReader::updateDevice(Device& device, const SoapySDR::Kwargs args)
4343
throw std::runtime_error("open device failed");
4444
}
4545

46+
device.connected = true;
4647
device.driver = driver;
4748
device.sample_rates = getSampleRates(sdr);
4849
device.gains = getGains(sdr);
@@ -61,6 +62,7 @@ Device SdrDeviceReader::createDevice(const SoapySDR::Kwargs args) {
6162
}
6263

6364
Device device;
65+
device.connected = true;
6466
device.driver = driver;
6567
device.serial = serial;
6668
device.enabled = true;
@@ -112,6 +114,7 @@ void SdrDeviceReader::updateDevices(std::vector<Device>& devices) {
112114

113115
void SdrDeviceReader::clearDevices(nlohmann::json& json) {
114116
for (auto& device : json.at("devices")) {
117+
device.erase("connected");
115118
device.erase("driver");
116119
device.erase("sample_rates");
117120

0 commit comments

Comments
 (0)