2017-01-10 14:45:40 -05:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2016 Jared Boone, ShareBrained Technology, Inc.
|
|
|
|
* Copyright (C) 2016 Furrtek
|
|
|
|
*
|
|
|
|
* This file is part of PortaPack.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2, or (at your option)
|
|
|
|
* any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; see the file COPYING. If not, write to
|
|
|
|
* the Free Software Foundation, Inc., 51 Franklin Street,
|
|
|
|
* Boston, MA 02110-1301, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __REPLAY_APP_HPP__
|
|
|
|
#define __REPLAY_APP_HPP__
|
|
|
|
|
|
|
|
#include "ui_widget.hpp"
|
|
|
|
#include "ui_navigation.hpp"
|
|
|
|
#include "ui_receiver.hpp"
|
2017-12-06 19:58:25 -05:00
|
|
|
#include "replay_thread.hpp"
|
2017-01-10 14:45:40 -05:00
|
|
|
#include "ui_spectrum.hpp"
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <memory>
|
|
|
|
|
|
|
|
namespace ui {
|
|
|
|
|
|
|
|
class ReplayAppView : public View {
|
|
|
|
public:
|
|
|
|
ReplayAppView(NavigationView& nav);
|
|
|
|
~ReplayAppView();
|
|
|
|
|
|
|
|
void on_hide() override;
|
2017-12-06 08:20:51 -05:00
|
|
|
void set_parent_rect(const Rect new_parent_rect) override;
|
2017-01-10 14:45:40 -05:00
|
|
|
void focus() override;
|
|
|
|
|
2017-12-06 19:58:25 -05:00
|
|
|
std::string title() const override { return "Replay"; };
|
|
|
|
|
2017-01-10 14:45:40 -05:00
|
|
|
private:
|
2017-03-23 17:28:21 -04:00
|
|
|
NavigationView& nav_;
|
|
|
|
|
2017-12-06 19:58:25 -05:00
|
|
|
static constexpr ui::Dim header_height = 3 * 16;
|
2017-03-23 17:28:21 -04:00
|
|
|
|
2018-02-22 02:04:19 -05:00
|
|
|
uint32_t sample_rate = 0;
|
Add Gain_TX control to the Replay App
Current Replay App , shows in the user menu a UI to select two kind of controls for the RF output level :
1-) LNA GAIN (0..40 ) dB => but it has no TX effect because it is the RX-LNA . GAIN
2-) RF AMP (0 / +14dBm , (that was correct , we have two IC's , RX / TX ) (sw is controlling weill .
Note, although SW Version 1.40 do not leave to control drictly the GAIN TX
, that Replay App , in fact, it was using the inheritated selected GAIN TX from any previous usage of MIC App.
That Pull request alllows now to have the following controls
1-) GAIN TX (0..47 ) dB (now it is OK
2-) RF AMP (0 / +14dBm , (that was correct , we have two IC's , RX / TX ) (sw is controlling weill .
Remakrs : After the change , now we can control the GAIN TX , but not "in the fly" . When we are in the Replay loop , any change of the FREQUENCY or GAIN TX will be ignored , till we play STOP / START the loop again. (but the AMP RF (0 /+14 dBs) it works in the loop withouth any problems (same as before ) .
2021-07-15 12:15:44 -04:00
|
|
|
int32_t tx_gain { 47 };
|
2021-12-05 10:18:52 -05:00
|
|
|
bool rf_amp { true }; // aux private var to store temporal, Replay App rf_amp user selection.
|
2017-12-06 19:58:25 -05:00
|
|
|
static constexpr uint32_t baseband_bandwidth = 2500000;
|
|
|
|
const size_t read_size { 16384 };
|
|
|
|
const size_t buffer_count { 3 };
|
2017-01-10 14:45:40 -05:00
|
|
|
|
2017-12-06 19:58:25 -05:00
|
|
|
void on_file_changed(std::filesystem::path new_file_path);
|
2017-01-10 14:45:40 -05:00
|
|
|
void on_target_frequency_changed(rf::Frequency f);
|
2017-12-06 19:58:25 -05:00
|
|
|
void on_tx_progress(const uint32_t progress);
|
|
|
|
|
2017-01-10 14:45:40 -05:00
|
|
|
void set_target_frequency(const rf::Frequency new_value);
|
2017-12-06 19:58:25 -05:00
|
|
|
rf::Frequency target_frequency() const;
|
|
|
|
|
|
|
|
void toggle();
|
2017-12-10 23:14:54 -05:00
|
|
|
void start();
|
|
|
|
void stop(const bool do_loop);
|
|
|
|
bool is_active() const;
|
2017-12-06 19:58:25 -05:00
|
|
|
void set_ready();
|
2017-12-10 23:14:54 -05:00
|
|
|
void handle_replay_thread_done(const uint32_t return_code);
|
|
|
|
void file_error();
|
2017-12-06 19:58:25 -05:00
|
|
|
|
|
|
|
std::filesystem::path file_path { };
|
|
|
|
std::unique_ptr<ReplayThread> replay_thread { };
|
|
|
|
bool ready_signal { false };
|
2017-01-10 14:45:40 -05:00
|
|
|
|
2017-12-08 16:46:16 -05:00
|
|
|
Labels labels {
|
Add Gain_TX control to the Replay App
Current Replay App , shows in the user menu a UI to select two kind of controls for the RF output level :
1-) LNA GAIN (0..40 ) dB => but it has no TX effect because it is the RX-LNA . GAIN
2-) RF AMP (0 / +14dBm , (that was correct , we have two IC's , RX / TX ) (sw is controlling weill .
Note, although SW Version 1.40 do not leave to control drictly the GAIN TX
, that Replay App , in fact, it was using the inheritated selected GAIN TX from any previous usage of MIC App.
That Pull request alllows now to have the following controls
1-) GAIN TX (0..47 ) dB (now it is OK
2-) RF AMP (0 / +14dBm , (that was correct , we have two IC's , RX / TX ) (sw is controlling weill .
Remakrs : After the change , now we can control the GAIN TX , but not "in the fly" . When we are in the Replay loop , any change of the FREQUENCY or GAIN TX will be ignored , till we play STOP / START the loop again. (but the AMP RF (0 /+14 dBs) it works in the loop withouth any problems (same as before ) .
2021-07-15 12:15:44 -04:00
|
|
|
{ { 10 * 8, 2 * 16 }, "GAIN A:", Color::light_grey() }
|
2017-12-08 16:46:16 -05:00
|
|
|
};
|
|
|
|
|
2017-12-10 23:14:54 -05:00
|
|
|
Button button_open {
|
|
|
|
{ 0 * 8, 0 * 16, 10 * 8, 2 * 16 },
|
|
|
|
"Open file"
|
2017-12-06 19:58:25 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
Text text_filename {
|
2018-02-22 02:04:19 -05:00
|
|
|
{ 11 * 8, 0 * 16, 12 * 8, 16 },
|
2017-12-06 19:58:25 -05:00
|
|
|
"-"
|
|
|
|
};
|
2018-02-22 02:04:19 -05:00
|
|
|
Text text_sample_rate {
|
|
|
|
{ 24 * 8, 0 * 16, 6 * 8, 16 },
|
|
|
|
"-"
|
|
|
|
};
|
|
|
|
|
2017-12-06 19:58:25 -05:00
|
|
|
Text text_duration {
|
2017-12-10 23:14:54 -05:00
|
|
|
{ 11 * 8, 1 * 16, 6 * 8, 16 },
|
2017-12-06 19:58:25 -05:00
|
|
|
"-"
|
|
|
|
};
|
|
|
|
ProgressBar progressbar {
|
2017-12-10 23:14:54 -05:00
|
|
|
{ 18 * 8, 1 * 16, 12 * 8, 16 }
|
2017-12-06 19:58:25 -05:00
|
|
|
};
|
|
|
|
|
2017-12-10 23:14:54 -05:00
|
|
|
FrequencyField field_frequency {
|
|
|
|
{ 0 * 8, 2 * 16 },
|
|
|
|
};
|
Add Gain_TX control to the Replay App
Current Replay App , shows in the user menu a UI to select two kind of controls for the RF output level :
1-) LNA GAIN (0..40 ) dB => but it has no TX effect because it is the RX-LNA . GAIN
2-) RF AMP (0 / +14dBm , (that was correct , we have two IC's , RX / TX ) (sw is controlling weill .
Note, although SW Version 1.40 do not leave to control drictly the GAIN TX
, that Replay App , in fact, it was using the inheritated selected GAIN TX from any previous usage of MIC App.
That Pull request alllows now to have the following controls
1-) GAIN TX (0..47 ) dB (now it is OK
2-) RF AMP (0 / +14dBm , (that was correct , we have two IC's , RX / TX ) (sw is controlling weill .
Remakrs : After the change , now we can control the GAIN TX , but not "in the fly" . When we are in the Replay loop , any change of the FREQUENCY or GAIN TX will be ignored , till we play STOP / START the loop again. (but the AMP RF (0 /+14 dBs) it works in the loop withouth any problems (same as before ) .
2021-07-15 12:15:44 -04:00
|
|
|
|
|
|
|
NumberField field_rfgain {
|
|
|
|
{ 14 * 8, 2 * 16 },
|
|
|
|
2,
|
|
|
|
{ 0, 47 },
|
|
|
|
1,
|
|
|
|
' '
|
2017-12-10 23:14:54 -05:00
|
|
|
};
|
2021-12-05 10:18:52 -05:00
|
|
|
NumberField field_rfamp { // previously I was using "RFAmpField field_rf_amp" but that is general Receiver amp setting.
|
|
|
|
{ 19 * 8, 2 * 16 },
|
|
|
|
2,
|
|
|
|
{ 0, 14 }, // this time we will display GUI , 0 or 14 dBs same as Mic App
|
|
|
|
14,
|
|
|
|
' '
|
2017-12-10 23:14:54 -05:00
|
|
|
};
|
|
|
|
Checkbox check_loop {
|
|
|
|
{ 21 * 8, 2 * 16 },
|
|
|
|
4,
|
|
|
|
"Loop",
|
|
|
|
true
|
|
|
|
};
|
|
|
|
ImageButton button_play {
|
|
|
|
{ 28 * 8, 2 * 16, 2 * 8, 1 * 16 },
|
|
|
|
&bitmap_play,
|
|
|
|
Color::green(),
|
|
|
|
Color::black()
|
2017-01-10 14:45:40 -05:00
|
|
|
};
|
|
|
|
|
2017-12-06 08:20:51 -05:00
|
|
|
spectrum::WaterfallWidget waterfall { };
|
2017-12-06 19:58:25 -05:00
|
|
|
|
|
|
|
MessageHandlerRegistration message_handler_replay_thread_error {
|
|
|
|
Message::ID::ReplayThreadDone,
|
|
|
|
[this](const Message* const p) {
|
|
|
|
const auto message = *reinterpret_cast<const ReplayThreadDoneMessage*>(p);
|
2017-12-10 23:14:54 -05:00
|
|
|
this->handle_replay_thread_done(message.return_code);
|
2017-12-06 19:58:25 -05:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
MessageHandlerRegistration message_handler_fifo_signal {
|
|
|
|
Message::ID::RequestSignal,
|
|
|
|
[this](const Message* const p) {
|
|
|
|
const auto message = static_cast<const RequestSignalMessage*>(p);
|
|
|
|
if (message->signal == RequestSignalMessage::Signal::FillRequest) {
|
|
|
|
this->set_ready();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
MessageHandlerRegistration message_handler_tx_progress {
|
|
|
|
Message::ID::TXProgress,
|
|
|
|
[this](const Message* const p) {
|
|
|
|
const auto message = *reinterpret_cast<const TXProgressMessage*>(p);
|
|
|
|
this->on_tx_progress(message.progress);
|
|
|
|
}
|
|
|
|
};
|
2017-01-10 14:45:40 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
} /* namespace ui */
|
|
|
|
|
|
|
|
#endif/*__REPLAY_APP_HPP__*/
|