概述
我的思路是这样的,既然我开发的应用是仿造replay的,我只要在前面找到的几个代码的地方复制出一个副本,稍加修改(改名),然后把加出来的代码文件加入对应CMakeLists里就行。
我分了几步。
第一步,在portapack主界面上先增加了一个按钮,这个按钮暂时还是连到replay上。
第二步,对这个按钮就行修改,改图标(改图标还需要上网找图片,然后生成数据)。
第三步,开始改动界面上新增按钮背后对应的app界面,但是这个app还对应于原来的那个后台处理程序。
第四步,增加对应的后台处理程序,使得界面上的新增按钮的app有了完全独立的后台处理程序。
第一步:
打开ui_navigation.cpp,找到如下部分,按照注释更改。
SystemMenuView::SystemMenuView(NavigationView& nav) {
add_items({
{ "Play dead", ui::Color::red(), &bitmap_icon_playdead, [&nav](){ nav.push<PlayDeadView>(); } },
{ "Receivers", ui::Color::dark_cyan(), &bitmap_icon_receivers, [&nav](){ nav.push<ReceiversMenuView>(); } },
{ "Transmit", ui::Color::green(), &bitmap_icon_transmit, [&nav](){ nav.push<TransmittersMenuView>(); } },
{ "Capture", ui::Color::blue(), &bitmap_icon_capture, [&nav](){ nav.push<CaptureAppView>(); } },
{ "Replay", ui::Color::purple(), &bitmap_icon_replay, [&nav](){ nav.push<ReplayAppView>(); } },
{ "GPS Sim", ui::Color::white(), &bitmap_icon_replay, [&nav]() { nav.push<ReplayAppView>(); } },
//这一行是我们自己增加的,只改了名字和颜色
{ "Calls", ui::Color::yellow(), &bitmap_icon_closecall, [&nav](){ nav.push<SearchView>(); } },
{ "Scanner", ui::Color::orange(), &bitmap_icon_scanner, [&nav](){ nav.push<ScannerView>(); } },
{ "Utilities", ui::Color::light_grey(), &bitmap_icon_utilities, [&nav](){ nav.push<UtilitiesMenuView>(); } },
{ "Settings", ui::Color::cyan(), &bitmap_icon_setup, [&nav](){ nav.push<SettingsMenuView>(); } },
//{ "Debug", ui::Color::cyan(), nullptr, [&nav](){ nav.push<DebugMenuView>(); } },
{ "HackRF", ui::Color::cyan(), &bitmap_icon_hackrf, [this, &nav](){ hackrf_mode(nav); } },
{ "About", ui::Color::cyan(), nullptr, [&nav](){ nav.push<AboutView>(); } }
});
set_highlighted(1); // Startup selection is "Receivers"
}
原来的主界面:
改完了以后可以看到主界面是这样的:
第二步:
还是打开ui_navigation.cpp,根据注释找到对应位置更改。
SystemMenuView::SystemMenuView(NavigationView& nav) {
add_items({
{ "Play dead", ui::Color::red(), &bitmap_icon_playdead, [&nav](){ nav.push<PlayDeadView>(); } },
{ "Receivers", ui::Color::dark_cyan(), &bitmap_icon_receivers, [&nav](){ nav.push<ReceiversMenuView>(); } },
{ "Transmit", ui::Color::green(), &bitmap_icon_transmit, [&nav](){ nav.push<TransmittersMenuView>(); } },
{ "Capture", ui::Color::blue(), &bitmap_icon_capture, [&nav](){ nav.push<CaptureAppView>(); } },
{ "Replay", ui::Color::purple(), &bitmap_icon_replay, [&nav](){ nav.push<ReplayAppView>(); } },
{ "GPS Sim", ui::Color::white(), &bitmap_gps_sim, [&nav]()
{ nav.push< ReplayAppView >(); } },
//我们现在把图标从bitmap_icon_replay改为bitmap_gps_sim
{ "Calls", ui::Color::yellow(), &bitmap_icon_closecall, [&nav](){ nav.push<SearchView>(); } },
{ "Scanner", ui::Color::orange(), &bitmap_icon_scanner, [&nav](){ nav.push<ScannerView>(); } },
{ "Utilities", ui::Color::light_grey(), &bitmap_icon_utilities, [&nav](){ nav.push<UtilitiesMenuView>(); } },
{ "Settings", ui::Color::cyan(), &bitmap_icon_setup, [&nav](){ nav.push<SettingsMenuView>(); } },
//{ "Debug", ui::Color::cyan(), nullptr, [&nav](){ nav.push<DebugMenuView>(); } },
{ "HackRF", ui::Color::cyan(), &bitmap_icon_hackrf, [this, &nav](){ hackrf_mode(nav); } },
{ "About", ui::Color::cyan(), nullptr, [&nav](){ nav.push<AboutView>(); } }
});
set_highlighted(1); // Startup selection is "Receivers"
}
但是现在bitmap_gps_sim是没有的,我们如果现在编译会报错。我搜索了一下,被它替换的bitmap_icon_replay在bitmap.hpp中出现过,片段如下:
static constexpr uint8_t bitmap_icon_replay_data[] = {
0x00, 0x00,
0xC0, 0x07,
0xF0, 0x1F,
0x79, 0x3C,
0x1D, 0x70,
0x0F, 0x60,
0x07, 0xE0,
0x1F, 0xC0,
0x00, 0xC0,
0x00, 0xE0,
0x00, 0x60,
0x00, 0x70,
0x30, 0x3C,
0xE0, 0x0F,
0x80, 0x03,
0x00, 0x00,
};
static constexpr Bitmap bitmap_icon_replay {
{ 16, 16 }, bitmap_icon_replay_data
};
也就是说,我们要想办法把图标生成出这样的数据,然后仿照这样的格式填进去就行。
我找到了firmware/tools/make_bitmap.py,根据代码的要求,只要找到宽高能被8整除的png图片,放到一个文件夹里,然后运行:
python make_bitmap.py 文件夹名
就能够生成对应的bitmap.hpp文件了,然后把需要的部分代码复制出来到原来的bitmap.hpp里去就行。
我找到如下图标
然后生成了数据:
static constexpr uint8_t bitmap_gps_sim_data[] = {
0x00, 0x00,
0x00, 0x00,
0x40, 0x06,
0x20, 0x00,
0x10, 0x10,
0x08, 0x10,
0x00, 0x20,
0x00, 0x00,
0x08, 0x00,
0x08, 0x00,
0x08, 0x10,
0x10, 0x00,
0x40, 0x0C,
0xC0, 0x02,
0x00, 0x00,
0x00, 0x00,
};
static constexpr Bitmap bitmap_gps_sim {
{ 16, 16 }, bitmap_gps_sim_data
};
注意图标的文件名和生成的代码的变量名是对应的,这个名字后面也要用到ui_navigation的代码里,要保持一致,否则找不到这段数据。
这样改完了编译烧录后主界面会变为这样:
但是点GPS Sim进去后出来的界面和点replay的界面是一样的。
第三步:
首先要仿照replay_app.cpp和replay_app.hpp,生成gps_sim_app.cpp和gps_sim_app.hpp,放到firmware/applicaition/app下。
gps_sim_app.cpp
#include "gps_sim_app.hpp"
#include "string_format.hpp"
#include "ui_fileman.hpp"
#include "io_file.hpp"
#include "baseband_api.hpp"
#include "portapack.hpp"
#include "portapack_persistent_memory.hpp"
using namespace portapack;
namespace ui {
void GpsSimAppView::set_ready() {
ready_signal = true;
}
void GpsSimAppView::on_file_changed(std::filesystem::path new_file_path) {
File data_file, info_file;
char file_data[257];
// Get file size
auto data_open_error = data_file.open("/" + new_file_path.string());
if (data_open_error.is_valid()) {
file_error();
return;
}
file_path = new_file_path;
// Get original record frequency if available
std::filesystem::path info_file_path = file_path;
info_file_path.replace_extension(u".TXT");
sample_rate = 500000;
auto info_open_error = info_file.open("/" + info_file_path.string());
if (!info_open_error.is_valid()) {
memset(file_data, 0, 257);
auto read_size = info_file.read(file_data, 256);
if (!read_size.is_error()) {
auto pos1 = strstr(file_data, "center_frequency=");
if (pos1) {
pos1 += 17;
field_frequency.set_value(strtoll(pos1, nullptr, 10));
}
auto pos2 = strstr(file_data, "sample_rate=");
if (pos2) {
pos2 += 12;
sample_rate = strtoll(pos2, nullptr, 10);
}
}
}
text_sample_rate.set(unit_auto_scale(sample_rate, 3, 1) + "Hz");
auto file_size = data_file.size();
auto duration = (file_size * 1000) / (1 * 2 * sample_rate);
progressbar.set_max(file_size);
text_filename.set(file_path.filename().string().substr(0, 12));
text_duration.set(to_string_time_ms(duration));
button_play.focus();
}
void GpsSimAppView::on_tx_progress(const uint32_t progress) {
progressbar.set_value(progress);
}
void GpsSimAppView::focus() {
button_open.focus();
}
void GpsSimAppView::file_error() {
nav_.display_modal("Error", "File read error.");
}
bool GpsSimAppView::is_active() const {
return (bool)replay_thread;
}
void GpsSimAppView::toggle() {
if( is_active() ) {
stop(false);
} else {
start();
}
}
void GpsSimAppView::start() {
stop(false);
std::unique_ptr<stream::Reader> reader;
auto p = std::make_unique<FileReader>();
auto open_error = p->open(file_path);
if( open_error.is_valid() ) {
file_error();
} else {
reader = std::move(p);
}
if( reader ) {
button_play.set_bitmap(&bitmap_stop);
baseband::set_sample_rate(sample_rate * 4);
replay_thread = std::make_unique<ReplayThread>(
std::move(reader),
read_size, buffer_count,
&ready_signal,
[](uint32_t return_code) {
ReplayThreadDoneMessage message { return_code };
EventDispatcher::send_message(message);
}
);
}
radio::enable({
receiver_model.tuning_frequency(),
sample_rate * 4,
baseband_bandwidth,
rf::Direction::Transmit,
receiver_model.rf_amp(),
static_cast<int8_t>(receiver_model.lna()),
static_cast<int8_t>(receiver_model.vga())
});
}
void GpsSimAppView::stop(const bool do_loop) {
if( is_active() )
replay_thread.reset();
if (do_loop && check_loop.value()) {
start();
} else {
radio::disable();
button_play.set_bitmap(&bitmap_play);
}
ready_signal = false;
}
void GpsSimAppView::handle_replay_thread_done(const uint32_t return_code) {
if (return_code == ReplayThread::END_OF_FILE) {
stop(true);
} else if (return_code == ReplayThread::READ_ERROR) {
stop(false);
file_error();
}
progressbar.set_value(0);
}
GpsSimAppView::GpsSimAppView(
NavigationView& nav
) : nav_ (nav)
{
baseband::run_image(portapack::spi_flash::image_tag_replay);
add_children({
&labels,
&button_open,
&text_filename,
&text_sample_rate,
&text_duration,
&progressbar,
&field_frequency,
&field_lna,
&field_rf_amp,
&check_loop,
&button_play,
&waterfall,
});
field_frequency.set_value(target_frequency());
field_frequency.set_step(receiver_model.frequency_step());
field_frequency.on_change = [this](rf::Frequency f) {
this->on_target_frequency_changed(f);
};
field_frequency.on_edit = [this, &nav]() {
// TODO: Provide separate modal method/scheme?
auto new_view = nav.push<FrequencyKeypadView>(this->target_frequency());
new_view->on_changed = [this](rf::Frequency f) {
this->on_target_frequency_changed(f);
this->field_frequency.set_value(f);
};
};
field_frequency.set_step(5000);
button_play.on_select = [this](ImageButton&) {
this->toggle();
};
button_open.on_select = [this, &nav](Button&) {
auto open_view = nav.push<FileLoadView>(".C8");
open_view->on_changed = [this](std::filesystem::path new_file_path) {
on_file_changed(new_file_path);
};
};
}
GpsSimAppView::~GpsSimAppView() {
radio::disable();
baseband::shutdown();
}
void GpsSimAppView::on_hide() {
// TODO: Terrible kludge because widget system doesn't notify Waterfall that
// it's being shown or hidden.
waterfall.on_hide();
View::on_hide();
}
void GpsSimAppView::set_parent_rect(const Rect new_parent_rect) {
View::set_parent_rect(new_parent_rect);
const ui::Rect waterfall_rect { 0, header_height, new_parent_rect.width(), new_parent_rect.height() - header_height };
waterfall.set_parent_rect(waterfall_rect);
}
void GpsSimAppView::on_target_frequency_changed(rf::Frequency f) {
set_target_frequency(f);
}
void GpsSimAppView::set_target_frequency(const rf::Frequency new_value) {
persistent_memory::set_tuned_frequency(new_value);;
}
rf::Frequency GpsSimAppView::target_frequency() const {
return persistent_memory::tuned_frequency();
}
} /* namespace ui */
gps_sim_app.hpp
#ifndef __GPS_SIM_APP_HPP__
#define __GPS_SIM_APP_HPP__
#include "ui_widget.hpp"
#include "ui_navigation.hpp"
#include "ui_receiver.hpp"
#include "replay_thread.hpp"
#include "ui_spectrum.hpp"
#include <string>
#include <memory>
namespace ui {
class GpsSimAppView : public View {
public:
GpsSimAppView(NavigationView& nav);
~GpsSimAppView();
void on_hide() override;
void set_parent_rect(const Rect new_parent_rect) override;
void focus() override;
std::string title() const override { return "GPS Simulator"; };
private:
NavigationView& nav_;
static constexpr ui::Dim header_height = 3 * 16;
uint32_t sample_rate = 0;
static constexpr uint32_t baseband_bandwidth = 2000000;
const size_t read_size { 16384 };
const size_t buffer_count { 3 };
void on_file_changed(std::filesystem::path new_file_path);
void on_target_frequency_changed(rf::Frequency f);
void on_tx_progress(const uint32_t progress);
void set_target_frequency(const rf::Frequency new_value);
rf::Frequency target_frequency() const;
void toggle();
void start();
void stop(const bool do_loop);
bool is_active() const;
void set_ready();
void handle_replay_thread_done(const uint32_t return_code);
void file_error();
std::filesystem::path file_path { };
std::unique_ptr<ReplayThread> replay_thread { };
bool ready_signal { false };
Labels labels {
{ { 10 * 8, 2 * 16 }, "LNA: A:", Color::light_grey() }
};
Button button_open {
{ 0 * 8, 0 * 16, 10 * 8, 2 * 16 },
"Open file"
};
Text text_filename {
{ 11 * 8, 0 * 16, 12 * 8, 16 },
"-"
};
Text text_sample_rate {
{ 24 * 8, 0 * 16, 6 * 8, 16 },
"-"
};
Text text_duration {
{ 11 * 8, 1 * 16, 6 * 8, 16 },
"-"
};
ProgressBar progressbar {
{ 18 * 8, 1 * 16, 12 * 8, 16 }
};
FrequencyField field_frequency {
{ 0 * 8, 2 * 16 },
};
LNAGainField field_lna {
{ 14 * 8, 2 * 16 }
};
RFAmpField field_rf_amp {
{ 19 * 8, 2 * 16 }
};
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()
};
spectrum::WaterfallWidget waterfall { };
MessageHandlerRegistration message_handler_replay_thread_error {
Message::ID::ReplayThreadDone,
[this](const Message* const p) {
const auto message = *reinterpret_cast<const ReplayThreadDoneMessage*>(p);
this->handle_replay_thread_done(message.return_code);
}
};
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);
}
};
};
} /* namespace ui */
#endif/*__GPS_SIM_APP_HPP__*/
然后在firmware/application/CMakeLists.txt中找到apps/replay_app.cpp,在它下方插入apps/gps_sim_app.cpp。如下:
apps/replay_app.cpp
apps/gps_sim_app.cpp
然后打开ui_navigation.cpp,开头加上#include "gps_sim_app.hpp"
然后也是ui_navigation.cpp里下面要改GPS Sim的nav.push调用的窗口
SystemMenuView::SystemMenuView(NavigationView& nav) {
add_items({
{ "Play dead", ui::Color::red(), &bitmap_icon_playdead, [&nav](){ nav.push<PlayDeadView>(); } },
{ "Receivers", ui::Color::dark_cyan(), &bitmap_icon_receivers, [&nav](){ nav.push<ReceiversMenuView>(); } },
{ "Transmit", ui::Color::green(), &bitmap_icon_transmit, [&nav](){ nav.push<TransmittersMenuView>(); } },
{ "Capture", ui::Color::blue(), &bitmap_icon_capture, [&nav](){ nav.push<CaptureAppView>(); } },
{ "Replay", ui::Color::purple(), &bitmap_icon_replay, [&nav](){ nav.push<ReplayAppView>(); } },
{ "GPS Sim", ui::Color::white(), &bitmap_gps_sim, [&nav]()
{ nav.push<GpsSimAppView>(); } }, //注意nav.push这改为另一个界面了
{ "Calls", ui::Color::yellow(), &bitmap_icon_closecall, [&nav](){ nav.push<SearchView>(); } },
{ "Scanner", ui::Color::orange(), &bitmap_icon_scanner, [&nav](){ nav.push<ScannerView>(); } },
{ "Utilities", ui::Color::light_grey(), &bitmap_icon_utilities, [&nav](){ nav.push<UtilitiesMenuView>(); } },
{ "Settings", ui::Color::cyan(), &bitmap_icon_setup, [&nav](){ nav.push<SettingsMenuView>(); } },
//{ "Debug", ui::Color::cyan(), nullptr, [&nav](){ nav.push<DebugMenuView>(); } },
{ "HackRF", ui::Color::cyan(), &bitmap_icon_hackrf, [this, &nav](){ hackrf_mode(nav); } },
{ "About", ui::Color::cyan(), nullptr, [&nav](){ nav.push<AboutView>(); } }
});
set_highlighted(1); // Startup selection is "Receivers"
}
第三步做完了以后点GPS Sim会看到类似下面的界面,可以看到标题已经变了,我还打开了之前准备好的一个GPS数据文件,区别会更明显。
第四步:
第三步的gps_sim_app.cpp里的第183行,image_tag_replay改为image_tag_gps。
baseband::run_image(portapack::spi_flash::image_tag_gps);
这样这个界面程序在执行的时候就会去寻找另一个后台处理程序了,但是暂时它是找不到的。我们需要在firmware/baseband里仿照proc_replay.app和proc_replay.hpp增加proc_gps_sim.cpp和proc_gps_sim.hpp两个文件。然后在firmware/common/里找到spi_image.hpp里,找到。image_tag_replay,仿照它增加image_tag_gps。
constexpr image_tag_t image_tag_replay { 'P', 'R', 'E', 'P' };
constexpr image_tag_t image_tag_gps { 'P', 'G', 'P', 'S' };
这样每次界面程序去找image_tag_gps就会去找PGPS了,这个PGPS如何对应到proc_gps_sim.cpp呢?这也是我们接下去要做的。
打开firmware/baseband/CMakeLists.txt 找到###Replay
### Replay
set(MODE_CPPSRC
proc_replay.cpp
)
DeclareTargets(PREP replay)
### GPS Simulator
set(MODE_CPPSRC
proc_gps_sim.cpp
)
DeclareTargets(PGPS gps_sim)
然后仿照它写下### GPS Simulator后面的内容,看到最下面的DeclareTargets里有PGPS,也就是说每次调用PGPS,都会去找proc_gps_sim.cpp编译出的程序。
最后附上我目前的proc_gps_sim.cpp和proc_gps_sim.hpp
proc_gps_sim.cpp
#include "proc_gps_sim.hpp"
#include "sine_table_int8.hpp"
#include "portapack_shared_memory.hpp"
#include "event_m4.hpp"
#include "utility.hpp"
ReplayProcessor::ReplayProcessor() {
channel_filter_pass_f = taps_200k_decim_1.pass_frequency_normalized * 1000000; // 162760.416666667
channel_filter_stop_f = taps_200k_decim_1.stop_frequency_normalized * 1000000; // 337239.583333333
spectrum_samples = 0;
channel_spectrum.set_decimation_factor(1);
configured = false;
}
void ReplayProcessor::execute(const buffer_c8_t& buffer) {
/* 4MHz, 2048 samples */
if (!configured) return;
// File data is in C16 format, we need C8
// File samplerate is 500kHz, we're at 4MHz
// iq_buffer can only be 512 C16 samples (RAM limitation)
// To fill up the 2048-sample C8 buffer, we need:
// 2048 samples * 2 bytes per sample = 4096 bytes
// Since we're oversampling by 4M/500k = 8, we only need 2048/8 = 256 samples from the file and duplicate them 8 times each
// So 256 * 4 bytes per sample (C16) = 1024 bytes from the file
if( stream ) { //sizeof(*buffer.p) = sizeof(C8) = 2*int8 = 2 bytes //buffer.count = 2048
const size_t bytes_to_read = sizeof(*buffer.p) * 1 * (buffer.count / 8); // *2 (C16), /8 (oversampling) should be == 1024
bytes_read += stream->read(iq_buffer.p, bytes_to_read);
}
// Fill and "stretch"
for (size_t i = 0; i < buffer.count; i++) {
/*if (i & 3) {
buffer.p[i] = buffer.p[i - 1];
} else {
auto re_out = iq_buffer.p[i >> 3].real() ;
auto im_out = iq_buffer.p[i >> 3].imag() ;
buffer.p[i] = { (int8_t)re_out, (int8_t)im_out };
}*/
if (i % 8 != 0) {
buffer.p[i] = buffer.p[i - 1];
} else {
auto re_out = iq_buffer.p[i/8].real() ;
auto im_out = iq_buffer.p[i/8].imag() ;
buffer.p[i] = { (int8_t)re_out, (int8_t)im_out };
}
/*
auto re_out = iq_buffer.p[i].real() ;
auto im_out = iq_buffer.p[i].imag() ;
buffer.p[i] = { (int8_t)re_out, (int8_t)im_out };*/
}
spectrum_samples += buffer.count;
if( spectrum_samples >= spectrum_interval_samples ) {
spectrum_samples -= spectrum_interval_samples;
//channel_spectrum.feed(iq_buffer, channel_filter_pass_f, channel_filter_stop_f);
txprogress_message.progress = bytes_read; // Inform UI about progress
txprogress_message.done = false;
shared_memory.application_queue.push(txprogress_message);
}
}
void ReplayProcessor::on_message(const Message* const message) {
switch(message->id) {
case Message::ID::UpdateSpectrum:
case Message::ID::SpectrumStreamingConfig:
channel_spectrum.on_message(message);
break;
case Message::ID::SamplerateConfig:
samplerate_config(*reinterpret_cast<const SamplerateConfigMessage*>(message));
break;
case Message::ID::ReplayConfig:
configured = false;
bytes_read = 0;
replay_config(*reinterpret_cast<const ReplayConfigMessage*>(message));
break;
// App has prefilled the buffers, we're ready to go now
case Message::ID::FIFOData:
configured = true;
break;
default:
break;
}
}
void ReplayProcessor::samplerate_config(const SamplerateConfigMessage& message) {
baseband_fs = message.sample_rate;
baseband_thread.set_sampling_rate(baseband_fs);
spectrum_interval_samples = baseband_fs / spectrum_rate_hz;
}
void ReplayProcessor::replay_config(const ReplayConfigMessage& message) {
if( message.config ) {
stream = std::make_unique<StreamOutput>(message.config);
// Tell application that the buffers and FIFO pointers are ready, prefill
shared_memory.application_queue.push(sig_message);
} else {
stream.reset();
}
}
int main() {
EventDispatcher event_dispatcher { std::make_unique<ReplayProcessor>() };
event_dispatcher.run();
return 0;
}
proc_gps_sim.hpp
#ifndef __PROC_GPS_SIM_HPP__
#define __PROC_GPS_SIM_HPP__
#include "baseband_processor.hpp"
#include "baseband_thread.hpp"
#include "spectrum_collector.hpp"
#include "stream_output.hpp"
#include <array>
#include <memory>
class ReplayProcessor : public BasebandProcessor {
public:
ReplayProcessor();
void execute(const buffer_c8_t& buffer) override;
void on_message(const Message* const message) override;
private:
size_t baseband_fs = 0;
static constexpr auto spectrum_rate_hz = 50.0f;
BasebandThread baseband_thread { baseband_fs, this, NORMALPRIO + 20, baseband::Direction::Transmit };
std::array<complex8_t, 256> iq { };
const buffer_c8_t iq_buffer {
iq.data(),
iq.size(),
baseband_fs /4
};
uint32_t channel_filter_pass_f = 0;
uint32_t channel_filter_stop_f = 0;
std::unique_ptr<StreamOutput> stream { };
SpectrumCollector channel_spectrum { };
size_t spectrum_interval_samples = 0;
size_t spectrum_samples = 0;
bool configured { false };
uint32_t bytes_read { 0 };
void samplerate_config(const SamplerateConfigMessage& message);
void replay_config(const ReplayConfigMessage& message);
TXProgressMessage txprogress_message { };
RequestSignalMessage sig_message { RequestSignalMessage::Signal::FillRequest };
};
#endif/*__PROC_GPS_SIM_HPP__*/
下一篇文章会仔细分析我写的gps_sim_app.cpp,gps_sim_app.hpp,proc_gps_sim.cpp,proc_gps_sim.hpp这4个文件,以及我碰到的问题。
这些问题和GPS信号与iq数据处理有关。
但是以上做的这几个步骤已经可以看作是写一个新的应用的流程了。
最后
以上就是温暖外套为你收集整理的Portapack应用开发教程(三)开发步骤的全部内容,希望文章能够帮你解决Portapack应用开发教程(三)开发步骤所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复