Skip to content

Commit c70696d

Browse files
committed
Replaced FrequencyFlush with Recording.
1 parent b40a73a commit c70696d

File tree

8 files changed

+20
-11
lines changed

8 files changed

+20
-11
lines changed

sources/radio/blocks/transmission.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,11 +163,11 @@ bool Transmission::isIndexIgnored(const Index& index) const {
163163
return false;
164164
}
165165

166-
std::vector<FrequencyFlush> Transmission::getSortedTransmissions(const std::chrono::milliseconds now) const {
166+
std::vector<Recording> Transmission::getSortedTransmissions(const std::chrono::milliseconds now) const {
167167
std::vector<Index> indexes;
168168
std::transform(m_signals.begin(), m_signals.end(), std::back_inserter(indexes), [](auto& kv) { return kv.first; });
169169
std::sort(indexes.begin(), indexes.end(), [this](const Index& i1, const Index& i2) { return m_signals.at(i1).getPower() > m_signals.at(i2).getPower(); });
170-
std::vector<FrequencyFlush> transmissions;
170+
std::vector<Recording> transmissions;
171171
for (const auto& index : indexes) {
172172
const auto frequency = getTunedFrequency(m_indexToShift(index), m_config.recordingTuningStep());
173173
transmissions.emplace_back(frequency, m_signals.at(index).needFlush(now));

sources/radio/blocks/transmission.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class Transmission : virtual public gr::sync_block {
3434
void updateSignals(const float* avgPower, const float* rawPower, const std::chrono::milliseconds now);
3535
Index getBestIndex(Index index) const;
3636
bool isIndexIgnored(const Index& index) const;
37-
std::vector<FrequencyFlush> getSortedTransmissions(const std::chrono::milliseconds now) const;
37+
std::vector<Recording> getSortedTransmissions(const std::chrono::milliseconds now) const;
3838

3939
const Config& m_config;
4040
const Device& m_device;

sources/radio/help_structures.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#include "help_structures.h"
22

3+
Recording::Recording(const Frequency& shift, const bool& flush) : m_shift(shift), m_flush(flush) {}
4+
35
Satellite::Satellite(const int& id, const std::string& name, const Frequency& frequency, const Frequency& bandwidth, const std::string& modulation)
46
: m_id(id), m_name(name), m_frequency(frequency), m_bandwidth(bandwidth), m_modulation(modulation) {}
57

sources/radio/help_structures.h

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,15 @@
1313

1414
using Frequency = int32_t;
1515
using FrequencyRange = std::pair<Frequency, Frequency>;
16-
using FrequencyFlush = std::pair<Frequency, bool>;
17-
using TransmissionNotification = Notification<std::vector<FrequencyFlush>>;
16+
17+
struct Recording {
18+
Recording(const Frequency& shift, const bool& flush);
19+
20+
Frequency m_shift;
21+
bool m_flush;
22+
};
23+
24+
using TransmissionNotification = Notification<std::vector<Recording>>;
1825
using SimpleComplex = std::complex<int8_t>;
1926

2027
struct Satellite {

sources/radio/scheduler.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,4 @@ void Scheduler::satellitesQuery() {
4747
m_remoteController.satellitesQuery(m_device.getName(), json.dump());
4848
}
4949

50-
void Scheduler::satellitesCallback(const nlohmann::json& json) { Logger::info(LABEL, "received satellites: {}", colored(GREEN, "{}", json.dump())); }
50+
void Scheduler::satellitesCallback(const nlohmann::json& json) { Logger::info(LABEL, "received satellites: {}", colored(GREEN, "{}", json.dump())); }

sources/radio/scheduler.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@ class Scheduler {
2020
std::chrono::milliseconds m_lastUpdateTime;
2121
std::atomic<bool> m_isRunning;
2222
std::thread m_thread;
23-
};
23+
};

sources/radio/sdr_device.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,11 @@ void SdrDevice::setFrequencyRange(FrequencyRange frequencyRange) {
7979
m_blocker->setBlocking(false);
8080
}
8181

82-
void SdrDevice::updateRecordings(const std::vector<FrequencyFlush> sortedShifts) {
82+
void SdrDevice::updateRecordings(const std::vector<Recording> sortedShifts) {
8383
const auto isWaitingForRecording = [&sortedShifts](const Frequency shift) {
84-
return std::find_if(sortedShifts.begin(), sortedShifts.end(), [shift](const FrequencyFlush shiftFlush) {
84+
return std::find_if(sortedShifts.begin(), sortedShifts.end(), [shift](const Recording shiftFlush) {
8585
// improve auto formatter
86-
return shift == shiftFlush.first;
86+
return shift == shiftFlush.m_shift;
8787
}) != sortedShifts.end();
8888
};
8989
const auto getShiftRecorder = [this](const Frequency shift) {

sources/radio/sdr_device.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class SdrDevice {
2424
~SdrDevice();
2525

2626
void setFrequencyRange(FrequencyRange frequencyRange);
27-
void updateRecordings(const std::vector<FrequencyFlush> sortedShifts);
27+
void updateRecordings(const std::vector<Recording> sortedShifts);
2828

2929
private:
3030
Frequency getFrequency() const;

0 commit comments

Comments
 (0)