mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-02-23 16:19:59 -05:00
Added address filter in POCSAG RX
Changed POCSAG log format Console widget knows red, green and blue now
This commit is contained in:
parent
555201b780
commit
3a1e5b8772
@ -24,9 +24,9 @@
|
|||||||
|
|
||||||
#include "baseband_api.hpp"
|
#include "baseband_api.hpp"
|
||||||
|
|
||||||
#include "audio.hpp"
|
|
||||||
#include "portapack.hpp"
|
#include "portapack.hpp"
|
||||||
#include "portapack_persistent_memory.hpp"
|
#include "portapack_persistent_memory.hpp"
|
||||||
|
|
||||||
using namespace portapack;
|
using namespace portapack;
|
||||||
using namespace pocsag;
|
using namespace pocsag;
|
||||||
|
|
||||||
@ -35,8 +35,9 @@ using namespace pocsag;
|
|||||||
|
|
||||||
#include "utility.hpp"
|
#include "utility.hpp"
|
||||||
|
|
||||||
void POCSAGLogger::on_packet(const pocsag::POCSAGPacket& packet, const uint32_t frequency) {
|
void POCSAGLogger::log_raw_data(const pocsag::POCSAGPacket& packet, const uint32_t frequency) {
|
||||||
std::string entry = to_string_dec_uint(frequency) + "Hz " + pocsag::bitrate_str(packet.bitrate()) + " RAW: ";
|
std::string entry = "Raw: F:" + to_string_dec_uint(frequency) + "Hz " +
|
||||||
|
pocsag::bitrate_str(packet.bitrate()) + " Codewords:";
|
||||||
|
|
||||||
// Raw hex dump of all the codewords
|
// Raw hex dump of all the codewords
|
||||||
for (size_t c = 0; c < 16; c++)
|
for (size_t c = 0; c < 16; c++)
|
||||||
@ -45,7 +46,7 @@ void POCSAGLogger::on_packet(const pocsag::POCSAGPacket& packet, const uint32_t
|
|||||||
log_file.write_entry(packet.timestamp(), entry);
|
log_file.write_entry(packet.timestamp(), entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
void POCSAGLogger::on_decoded(
|
void POCSAGLogger::log_decoded(
|
||||||
const pocsag::POCSAGPacket& packet,
|
const pocsag::POCSAGPacket& packet,
|
||||||
const std::string text) {
|
const std::string text) {
|
||||||
|
|
||||||
@ -55,7 +56,6 @@ void POCSAGLogger::on_decoded(
|
|||||||
namespace ui {
|
namespace ui {
|
||||||
|
|
||||||
void POCSAGAppView::update_freq(rf::Frequency f) {
|
void POCSAGAppView::update_freq(rf::Frequency f) {
|
||||||
options_freq.set_selected_index(0); // "Entered"
|
|
||||||
set_target_frequency(f);
|
set_target_frequency(f);
|
||||||
|
|
||||||
portapack::persistent_memory::set_tuned_frequency(f); // Maybe not ?
|
portapack::persistent_memory::set_tuned_frequency(f); // Maybe not ?
|
||||||
@ -63,7 +63,7 @@ void POCSAGAppView::update_freq(rf::Frequency f) {
|
|||||||
auto mhz = to_string_dec_int(f / 1000000, 4);
|
auto mhz = to_string_dec_int(f / 1000000, 4);
|
||||||
auto hz100 = to_string_dec_int((f / 100) % 10000, 4, '0');
|
auto hz100 = to_string_dec_int((f / 100) % 10000, 4, '0');
|
||||||
|
|
||||||
this->button_setfreq.set_text(mhz + "." + hz100);
|
button_setfreq.set_text(mhz + "." + hz100);
|
||||||
}
|
}
|
||||||
|
|
||||||
POCSAGAppView::POCSAGAppView(NavigationView& nav) {
|
POCSAGAppView::POCSAGAppView(NavigationView& nav) {
|
||||||
@ -80,6 +80,8 @@ POCSAGAppView::POCSAGAppView(NavigationView& nav) {
|
|||||||
&button_setfreq,
|
&button_setfreq,
|
||||||
&options_bitrate,
|
&options_bitrate,
|
||||||
&check_log,
|
&check_log,
|
||||||
|
&check_ignore,
|
||||||
|
&sym_ignore,
|
||||||
&console
|
&console
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -93,32 +95,37 @@ POCSAGAppView::POCSAGAppView(NavigationView& nav) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
options_bitrate.on_change = [this](size_t, OptionsField::value_t v) {
|
options_bitrate.on_change = [this](size_t, OptionsField::value_t v) {
|
||||||
this->on_bitrate_changed(v);
|
on_bitrate_changed(v);
|
||||||
};
|
};
|
||||||
options_bitrate.set_selected_index(1); // 1200bps
|
options_bitrate.set_selected_index(1); // 1200bps
|
||||||
|
|
||||||
options_freq.on_change = [this](size_t, OptionsField::value_t v) {
|
options_freq.on_change = [this](size_t, OptionsField::value_t v) {
|
||||||
this->on_band_changed(v);
|
set_target_frequency(v);
|
||||||
|
update_freq(v);
|
||||||
};
|
};
|
||||||
options_freq.set_by_value(target_frequency());
|
options_freq.set_by_value(target_frequency());
|
||||||
|
|
||||||
|
check_ignore.set_value(ignore);
|
||||||
|
check_ignore.on_select = [this](Checkbox&, bool v) {
|
||||||
|
ignore = v;
|
||||||
|
};
|
||||||
|
for (size_t c = 0; c < 7; c++)
|
||||||
|
sym_ignore.set_sym(c, default_ignore[c]);
|
||||||
|
|
||||||
button_setfreq.on_select = [this,&nav](Button&) {
|
button_setfreq.on_select = [this,&nav](Button&) {
|
||||||
auto new_view = nav.push<FrequencyKeypadView>(target_frequency_);
|
auto new_view = nav.push<FrequencyKeypadView>(target_frequency_);
|
||||||
new_view->on_changed = [this](rf::Frequency f) {
|
new_view->on_changed = [this](rf::Frequency f) {
|
||||||
|
options_freq.set_selected_index(0); // Automatically select "Entered"
|
||||||
update_freq(f);
|
update_freq(f);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
logger = std::make_unique<POCSAGLogger>();
|
logger = std::make_unique<POCSAGLogger>();
|
||||||
if (logger) logger->append("pocsag.txt");
|
if (logger)
|
||||||
|
logger->append("pocsag.txt");
|
||||||
/*const auto new_volume = volume_t::decibel(60 - 99) + audio::headphone::volume_range().max;
|
|
||||||
receiver_model.set_headphone_volume(new_volume);
|
|
||||||
audio::output::start();*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
POCSAGAppView::~POCSAGAppView() {
|
POCSAGAppView::~POCSAGAppView() {
|
||||||
//audio::output::stop();
|
|
||||||
receiver_model.disable();
|
receiver_model.disable();
|
||||||
baseband::shutdown();
|
baseband::shutdown();
|
||||||
}
|
}
|
||||||
@ -135,36 +142,38 @@ void POCSAGAppView::set_parent_rect(const Rect new_parent_rect) {
|
|||||||
void POCSAGAppView::on_packet(const POCSAGPacketMessage * message) {
|
void POCSAGAppView::on_packet(const POCSAGPacketMessage * message) {
|
||||||
std::string alphanum_text = "";
|
std::string alphanum_text = "";
|
||||||
|
|
||||||
// Log raw data whatever it contains
|
if (message->packet.flag() != NORMAL)
|
||||||
if (logger && logging)
|
console.writeln("\n\x1B\x01RX ERROR: " + pocsag::flag_str(message->packet.flag()));
|
||||||
logger->on_packet(message->packet, target_frequency());
|
else {
|
||||||
|
pocsag_decode_batch(message->packet, &pocsag_state);
|
||||||
|
|
||||||
if (message->packet.flag() != NORMAL) {
|
if ((ignore) && (pocsag_state.out_type == ADDRESS) && (pocsag_state.address == sym_ignore.value_dec_u32())) {
|
||||||
console.writeln(
|
// Ignore (inform, but no log)
|
||||||
"RX ERROR: " + pocsag::flag_str(message->packet.flag()) +
|
console.write("\n\x1B\x03" + to_string_time(message->packet.timestamp()) +
|
||||||
" Codewords: " + to_string_dec_uint(message->packet[0])
|
" Ignored address " + to_string_dec_uint(pocsag_state.address));
|
||||||
);
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool result = pocsag_decode_batch(message->packet, &pocsag_state);
|
|
||||||
|
|
||||||
if (result) {
|
|
||||||
std::string console_info;
|
std::string console_info;
|
||||||
|
|
||||||
console_info = to_string_time(message->packet.timestamp()) + " ";
|
console_info = "\n\x1B\x02" + to_string_time(message->packet.timestamp());
|
||||||
console_info += "B:" + pocsag::bitrate_str(message->packet.bitrate()); // "B:" caractere add for more visibility
|
console_info += " " + pocsag::bitrate_str(message->packet.bitrate());
|
||||||
console_info += " ADDR:" + to_string_dec_uint(pocsag_state.address);
|
console_info += " ADDR:" + to_string_dec_uint(pocsag_state.address);
|
||||||
console_info += " F" + to_string_dec_uint(pocsag_state.function);
|
console_info += " F" + to_string_dec_uint(pocsag_state.function);
|
||||||
|
|
||||||
|
// Store last received address for POCSAG TX
|
||||||
portapack::persistent_memory::set_pocsag_address(pocsag_state.address);
|
portapack::persistent_memory::set_pocsag_address(pocsag_state.address);
|
||||||
|
|
||||||
if (pocsag_state.out_type == ADDRESS) {
|
if (pocsag_state.out_type == ADDRESS) {
|
||||||
// Address only
|
// Address only
|
||||||
|
|
||||||
console.writeln(console_info);
|
console.write(console_info);
|
||||||
|
|
||||||
if (logger && logging)
|
if (logger && logging) {
|
||||||
logger->on_decoded(message->packet, console_info);
|
logger->log_decoded(message->packet, to_string_dec_uint(pocsag_state.address) +
|
||||||
|
" F" + to_string_dec_uint(pocsag_state.function) +
|
||||||
|
" Address only");
|
||||||
|
}
|
||||||
|
|
||||||
last_address = pocsag_state.address;
|
last_address = pocsag_state.address;
|
||||||
} else if (pocsag_state.out_type == MESSAGE) {
|
} else if (pocsag_state.out_type == MESSAGE) {
|
||||||
@ -173,33 +182,30 @@ void POCSAGAppView::on_packet(const POCSAGPacketMessage * message) {
|
|||||||
|
|
||||||
console.writeln(console_info);
|
console.writeln(console_info);
|
||||||
|
|
||||||
console.writeln("Alpha:" + pocsag_state.output);
|
console.write(pocsag_state.output);
|
||||||
|
|
||||||
if (logger && logging) {
|
|
||||||
logger->on_decoded(message->packet, console_info);
|
|
||||||
logger->on_decoded(message->packet, pocsag_state.output);
|
|
||||||
}
|
|
||||||
|
|
||||||
last_address = pocsag_state.address;
|
last_address = pocsag_state.address;
|
||||||
} else {
|
} else {
|
||||||
// Message continues...
|
// Message continues...
|
||||||
console.writeln(pocsag_state.output);
|
console.write(pocsag_state.output);
|
||||||
|
}
|
||||||
|
|
||||||
if (logger && logging)
|
if (logger && logging)
|
||||||
logger->on_decoded(message->packet, pocsag_state.output);
|
logger->log_decoded(message->packet, to_string_dec_uint(pocsag_state.address) +
|
||||||
}
|
" F" + to_string_dec_uint(pocsag_state.function) +
|
||||||
|
" Alpha: " + pocsag_state.output);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Log raw data whatever it contains
|
||||||
|
if (logger && logging)
|
||||||
|
logger->log_raw_data(message->packet, target_frequency());
|
||||||
}
|
}
|
||||||
|
|
||||||
void POCSAGAppView::on_bitrate_changed(const uint32_t new_bitrate) {
|
void POCSAGAppView::on_bitrate_changed(const uint32_t new_bitrate) {
|
||||||
baseband::set_pocsag(pocsag_bitrates[new_bitrate]);
|
baseband::set_pocsag(pocsag_bitrates[new_bitrate]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void POCSAGAppView::on_band_changed(const uint32_t new_band_frequency) {
|
|
||||||
if (new_band_frequency) set_target_frequency(new_band_frequency);
|
|
||||||
}
|
|
||||||
|
|
||||||
void POCSAGAppView::set_target_frequency(const uint32_t new_value) {
|
void POCSAGAppView::set_target_frequency(const uint32_t new_value) {
|
||||||
target_frequency_ = new_value;
|
target_frequency_ = new_value;
|
||||||
receiver_model.set_tuning_frequency(new_value);
|
receiver_model.set_tuning_frequency(new_value);
|
||||||
|
@ -24,12 +24,9 @@
|
|||||||
#define __POCSAG_APP_H__
|
#define __POCSAG_APP_H__
|
||||||
|
|
||||||
#include "ui_widget.hpp"
|
#include "ui_widget.hpp"
|
||||||
#include "ui_navigation.hpp"
|
|
||||||
#include "ui_receiver.hpp"
|
#include "ui_receiver.hpp"
|
||||||
#include "ui_rssi.hpp"
|
#include "ui_rssi.hpp"
|
||||||
|
|
||||||
#include "event_m0.hpp"
|
|
||||||
|
|
||||||
#include "log_file.hpp"
|
#include "log_file.hpp"
|
||||||
|
|
||||||
#include "pocsag.hpp"
|
#include "pocsag.hpp"
|
||||||
@ -41,8 +38,8 @@ public:
|
|||||||
return log_file.append(filename);
|
return log_file.append(filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
void on_packet(const pocsag::POCSAGPacket& packet, const uint32_t frequency);
|
void log_raw_data(const pocsag::POCSAGPacket& packet, const uint32_t frequency);
|
||||||
void on_decoded(const pocsag::POCSAGPacket& packet, const std::string text);
|
void log_decoded(const pocsag::POCSAGPacket& packet, const std::string text);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
LogFile log_file { };
|
LogFile log_file { };
|
||||||
@ -63,9 +60,10 @@ public:
|
|||||||
private:
|
private:
|
||||||
static constexpr uint32_t initial_target_frequency = 466175000;
|
static constexpr uint32_t initial_target_frequency = 466175000;
|
||||||
static constexpr uint32_t sampling_rate = 3072000;
|
static constexpr uint32_t sampling_rate = 3072000;
|
||||||
//static constexpr uint32_t baseband_bandwidth = 1750000;
|
const uint8_t default_ignore[7] = { 1, 0, 0, 8, 8, 2, 4 };
|
||||||
|
|
||||||
bool logging { true };
|
bool logging { true };
|
||||||
|
bool ignore { false };
|
||||||
uint32_t last_address = 0xFFFFFFFF;
|
uint32_t last_address = 0xFFFFFFFF;
|
||||||
pocsag::POCSAGState pocsag_state { };
|
pocsag::POCSAGState pocsag_state { };
|
||||||
|
|
||||||
@ -79,39 +77,51 @@ private:
|
|||||||
|
|
||||||
static constexpr ui::Dim header_height = 1 * 16;
|
static constexpr ui::Dim header_height = 1 * 16;
|
||||||
|
|
||||||
|
OptionsField options_freq {
|
||||||
|
{ 0 * 8, 0 * 16 },
|
||||||
|
12,
|
||||||
|
{
|
||||||
|
{ "Entered", 0 },
|
||||||
|
{ "BEL Fire", 169625000 },
|
||||||
|
{ "DEU Fire", 448425000 },
|
||||||
|
{ "DEU e-Msg1", 465970000 },
|
||||||
|
{ "DEU e-Msg2", 466075000 },
|
||||||
|
{ "FRA e-Msg1", 466025000 },
|
||||||
|
{ "FRA e-Msg2", 466050000 },
|
||||||
|
{ "FRA e-Msg3", 466075000 },
|
||||||
|
{ "FRA e-Msg4", 466175000 },
|
||||||
|
{ "FRA e-Msg5", 466206250 },
|
||||||
|
{ "FRA e-Msg6", 466231250 },
|
||||||
|
{ "FRA Fire", 173512500 },
|
||||||
|
{ "SWE Minicall1", 169800000 },
|
||||||
|
{ "SWE Minicall2", 161437500 },
|
||||||
|
{ "USA Medical1", 152007500 },
|
||||||
|
{ "USA Medical2", 157450000 },
|
||||||
|
{ "USA Medical3", 163250000 }
|
||||||
|
}
|
||||||
|
};
|
||||||
|
RFAmpField field_rf_amp {
|
||||||
|
{ 13 * 8, 0 * 16 }
|
||||||
|
};
|
||||||
|
LNAGainField field_lna {
|
||||||
|
{ 15 * 8, 0 * 16 }
|
||||||
|
};
|
||||||
|
VGAGainField field_vga {
|
||||||
|
{ 18 * 8, 0 * 16 }
|
||||||
|
};
|
||||||
RSSI rssi {
|
RSSI rssi {
|
||||||
{ 21 * 8, 0, 6 * 8, 4 },
|
{ 21 * 8, 0, 6 * 8, 4 },
|
||||||
};
|
};
|
||||||
|
|
||||||
Channel channel {
|
Channel channel {
|
||||||
{ 21 * 8, 5, 6 * 8, 4 },
|
{ 21 * 8, 5, 6 * 8, 4 },
|
||||||
};
|
};
|
||||||
|
|
||||||
OptionsField options_freq {
|
|
||||||
{ 0 * 8, 0 * 16 },
|
|
||||||
7,
|
|
||||||
{
|
|
||||||
{ "Entered", 0 },
|
|
||||||
{ "FR .025", 466025000 },
|
|
||||||
{ "FR .050", 466050000 },
|
|
||||||
{ "FR .075", 466075000 },
|
|
||||||
{ "FR .175", 466175000 },
|
|
||||||
{ "FR .206", 466206250 },
|
|
||||||
{ "FR .231", 466231250 },
|
|
||||||
{ "DE Pub1", 466075000 },
|
|
||||||
{ "DE Pub2", 465970000 },
|
|
||||||
{ "US 152.", 152007500 },
|
|
||||||
{ "US 157.", 157450000 },
|
|
||||||
{ "US 153.", 163250000 }
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
Button button_setfreq {
|
Button button_setfreq {
|
||||||
{ 0, 20, 11 * 8, 20 },
|
{ 0, 19, 11 * 8, 20 },
|
||||||
"----.----"
|
"----.----"
|
||||||
};
|
};
|
||||||
OptionsField options_bitrate {
|
OptionsField options_bitrate {
|
||||||
{ 12 * 8, 22 },
|
{ 12 * 8, 21 },
|
||||||
7,
|
7,
|
||||||
{
|
{
|
||||||
{ "512bps ", 0 },
|
{ "512bps ", 0 },
|
||||||
@ -120,26 +130,26 @@ private:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
Checkbox check_log {
|
Checkbox check_log {
|
||||||
{ 20 * 8, 22 },
|
{ 22 * 8, 21 },
|
||||||
3,
|
3,
|
||||||
"LOG",
|
"LOG",
|
||||||
true
|
true
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Checkbox check_ignore {
|
||||||
|
{ 1 * 8, 40 },
|
||||||
|
15,
|
||||||
|
"Ignore address:",
|
||||||
|
true
|
||||||
|
};
|
||||||
|
SymField sym_ignore {
|
||||||
|
{ 19 * 8, 40 },
|
||||||
|
7,
|
||||||
|
SymField::SYMFIELD_DEC
|
||||||
|
};
|
||||||
|
|
||||||
Console console {
|
Console console {
|
||||||
{ 0, 48, 240, 256 }
|
{ 0, 4 * 16, 240, 240 }
|
||||||
};
|
|
||||||
|
|
||||||
RFAmpField field_rf_amp {
|
|
||||||
{ 13 * 8, 0 * 16 }
|
|
||||||
};
|
|
||||||
|
|
||||||
LNAGainField field_lna {
|
|
||||||
{ 15 * 8, 0 * 16 }
|
|
||||||
};
|
|
||||||
|
|
||||||
VGAGainField field_vga {
|
|
||||||
{ 18 * 8, 0 * 16 }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
std::unique_ptr<POCSAGLogger> logger { };
|
std::unique_ptr<POCSAGLogger> logger { };
|
||||||
@ -149,9 +159,7 @@ private:
|
|||||||
void update_freq(rf::Frequency f);
|
void update_freq(rf::Frequency f);
|
||||||
|
|
||||||
void on_packet(const POCSAGPacketMessage * message);
|
void on_packet(const POCSAGPacketMessage * message);
|
||||||
void on_show_list();
|
|
||||||
|
|
||||||
void on_band_changed(const uint32_t new_band_frequency);
|
|
||||||
void on_bitrate_changed(const uint32_t new_bitrate);
|
void on_bitrate_changed(const uint32_t new_bitrate);
|
||||||
|
|
||||||
uint32_t target_frequency() const;
|
uint32_t target_frequency() const;
|
||||||
|
@ -33,9 +33,9 @@ namespace pocsag {
|
|||||||
|
|
||||||
std::string bitrate_str(BitRate bitrate) {
|
std::string bitrate_str(BitRate bitrate) {
|
||||||
switch (bitrate) {
|
switch (bitrate) {
|
||||||
case BitRate::FSK512: return "512 ";
|
case BitRate::FSK512: return "512bps ";
|
||||||
case BitRate::FSK1200: return "1200";
|
case BitRate::FSK1200: return "1200bps";
|
||||||
case BitRate::FSK2400: return "2400";
|
case BitRate::FSK2400: return "2400bps";
|
||||||
default: return "????";
|
default: return "????";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -43,7 +43,6 @@ std::string bitrate_str(BitRate bitrate) {
|
|||||||
std::string flag_str(PacketFlag packetflag) {
|
std::string flag_str(PacketFlag packetflag) {
|
||||||
switch (packetflag) {
|
switch (packetflag) {
|
||||||
case PacketFlag::NORMAL: return "OK";
|
case PacketFlag::NORMAL: return "OK";
|
||||||
case PacketFlag::IDLE: return "IDLE";
|
|
||||||
case PacketFlag::TIMED_OUT: return "TIMED OUT";
|
case PacketFlag::TIMED_OUT: return "TIMED OUT";
|
||||||
default: return "";
|
default: return "";
|
||||||
}
|
}
|
||||||
@ -222,7 +221,7 @@ void pocsag_encode(
|
|||||||
} while (char_idx < message_size);
|
} while (char_idx < message_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool pocsag_decode_batch(const POCSAGPacket& batch, POCSAGState * const state) {
|
void pocsag_decode_batch(const POCSAGPacket& batch, POCSAGState * const state) {
|
||||||
uint32_t codeword;
|
uint32_t codeword;
|
||||||
char ascii_char;
|
char ascii_char;
|
||||||
std::string output_text = "";
|
std::string output_text = "";
|
||||||
@ -286,8 +285,6 @@ bool pocsag_decode_batch(const POCSAGPacket& batch, POCSAGState * const state) {
|
|||||||
|
|
||||||
if (state->mode == STATE_HAVE_ADDRESS)
|
if (state->mode == STATE_HAVE_ADDRESS)
|
||||||
state->mode = STATE_CLEAR;
|
state->mode = STATE_CLEAR;
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} /* namespace pocsag */
|
} /* namespace pocsag */
|
||||||
|
@ -78,7 +78,7 @@ void insert_BCH(BCHCode& BCH_code, uint32_t * codeword);
|
|||||||
uint32_t get_digit_code(char code);
|
uint32_t get_digit_code(char code);
|
||||||
void pocsag_encode(const MessageType type, BCHCode& BCH_code, const std::string message,
|
void pocsag_encode(const MessageType type, BCHCode& BCH_code, const std::string message,
|
||||||
const uint32_t address, std::vector<uint32_t>& codewords);
|
const uint32_t address, std::vector<uint32_t>& codewords);
|
||||||
bool pocsag_decode_batch(const POCSAGPacket& batch, POCSAGState * const state);
|
void pocsag_decode_batch(const POCSAGPacket& batch, POCSAGState * const state);
|
||||||
|
|
||||||
} /* namespace pocsag */
|
} /* namespace pocsag */
|
||||||
|
|
||||||
|
@ -41,7 +41,6 @@ enum BitRate : uint32_t {
|
|||||||
|
|
||||||
enum PacketFlag : uint32_t {
|
enum PacketFlag : uint32_t {
|
||||||
NORMAL,
|
NORMAL,
|
||||||
IDLE,
|
|
||||||
TIMED_OUT,
|
TIMED_OUT,
|
||||||
TOO_LONG
|
TOO_LONG
|
||||||
};
|
};
|
||||||
|
@ -501,13 +501,28 @@ void Console::clear() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Console::write(std::string message) {
|
void Console::write(std::string message) {
|
||||||
|
bool escape = false;
|
||||||
|
|
||||||
if (visible) {
|
if (visible) {
|
||||||
const Style& s = style();
|
const Style& s = style();
|
||||||
const Font& font = s.font;
|
const Font& font = s.font;
|
||||||
const auto rect = screen_rect();
|
const auto rect = screen_rect();
|
||||||
|
ui::Color pen_color = s.foreground;
|
||||||
|
|
||||||
for (const auto c : message) {
|
for (const auto c : message) {
|
||||||
|
if (escape) {
|
||||||
|
if (c == '\x01')
|
||||||
|
pen_color = ui::Color::red();
|
||||||
|
else if (c == '\x02')
|
||||||
|
pen_color = ui::Color::green();
|
||||||
|
else if (c == '\x03')
|
||||||
|
pen_color = ui::Color::blue();
|
||||||
|
escape = false;
|
||||||
|
} else {
|
||||||
if (c == '\n') {
|
if (c == '\n') {
|
||||||
crlf();
|
crlf();
|
||||||
|
} else if (c == '\x1B') {
|
||||||
|
escape = true;
|
||||||
} else {
|
} else {
|
||||||
const auto glyph = font.glyph(c);
|
const auto glyph = font.glyph(c);
|
||||||
const auto advance = glyph.advance();
|
const auto advance = glyph.advance();
|
||||||
@ -518,10 +533,11 @@ void Console::write(std::string message) {
|
|||||||
rect.left() + pos.x(),
|
rect.left() + pos.x(),
|
||||||
display.scroll_area_y(pos.y())
|
display.scroll_area_y(pos.y())
|
||||||
};
|
};
|
||||||
display.draw_glyph(pos_glyph, glyph, s.foreground, s.background);
|
display.draw_glyph(pos_glyph, glyph, pen_color, s.background);
|
||||||
pos += { advance.x(), 0 };
|
pos += { advance.x(), 0 };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
buffer = message;
|
buffer = message;
|
||||||
} else {
|
} else {
|
||||||
buffer += message;
|
buffer += message;
|
||||||
@ -663,7 +679,7 @@ void Checkbox::paint(Painter& painter) {
|
|||||||
|
|
||||||
painter.draw_string(
|
painter.draw_string(
|
||||||
{
|
{
|
||||||
static_cast<Coord>(x + 16),
|
static_cast<Coord>(x + 16 + 2),
|
||||||
static_cast<Coord>(y + (16 - label_r.height()) / 2)
|
static_cast<Coord>(y + (16 - label_r.height()) / 2)
|
||||||
},
|
},
|
||||||
paint_style,
|
paint_style,
|
||||||
|
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user