2017-02-07 12:48:17 -05:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2015 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 __POCSAG_TX_H__
|
|
|
|
#define __POCSAG_TX_H__
|
|
|
|
|
|
|
|
#include "ui.hpp"
|
|
|
|
#include "ui_widget.hpp"
|
|
|
|
#include "ui_navigation.hpp"
|
|
|
|
#include "ui_font_fixed_8x16.hpp"
|
|
|
|
#include "ui_receiver.hpp"
|
|
|
|
#include "ui_transmitter.hpp"
|
2017-02-07 14:54:18 -05:00
|
|
|
#include "ui_textentry.hpp"
|
2017-02-07 12:48:17 -05:00
|
|
|
#include "bch_code.hpp"
|
|
|
|
#include "message.hpp"
|
|
|
|
#include "transmitter_model.hpp"
|
2017-02-07 20:19:29 -05:00
|
|
|
#include "pocsag.hpp"
|
|
|
|
|
|
|
|
using namespace pocsag;
|
2017-02-07 12:48:17 -05:00
|
|
|
|
|
|
|
namespace ui {
|
|
|
|
|
|
|
|
class POCSAGTXView : public View {
|
|
|
|
public:
|
|
|
|
POCSAGTXView(NavigationView& nav);
|
|
|
|
~POCSAGTXView();
|
|
|
|
|
2017-02-07 14:54:18 -05:00
|
|
|
POCSAGTXView(const POCSAGTXView&) = delete;
|
|
|
|
POCSAGTXView(POCSAGTXView&&) = delete;
|
|
|
|
POCSAGTXView& operator=(const POCSAGTXView&) = delete;
|
|
|
|
POCSAGTXView& operator=(POCSAGTXView&&) = delete;
|
2017-02-07 12:48:17 -05:00
|
|
|
|
|
|
|
void focus() override;
|
2017-02-07 14:54:18 -05:00
|
|
|
void paint(Painter&) override;
|
2017-02-07 12:48:17 -05:00
|
|
|
|
|
|
|
std::string title() const override { return "POCSAG TX"; };
|
|
|
|
|
|
|
|
private:
|
2017-02-07 14:54:18 -05:00
|
|
|
char buffer[17] = "PORTAPACK";
|
|
|
|
std::string message { };
|
2017-02-07 20:19:29 -05:00
|
|
|
NavigationView& nav_;
|
2017-02-07 12:48:17 -05:00
|
|
|
|
|
|
|
BCHCode BCH_code {
|
|
|
|
{ 1, 0, 1, 0, 0, 1 },
|
|
|
|
5, 31, 21, 2
|
|
|
|
};
|
|
|
|
|
2017-02-07 14:54:18 -05:00
|
|
|
void on_set_text(NavigationView& nav);
|
2017-02-07 12:48:17 -05:00
|
|
|
void on_tx_progress(const int progress, const bool done);
|
2017-02-07 20:19:29 -05:00
|
|
|
bool start_tx();
|
2017-02-07 12:48:17 -05:00
|
|
|
|
2017-02-07 20:19:29 -05:00
|
|
|
Text text_bitrate {
|
|
|
|
{ 3 * 8, 4 * 8, 8 * 8, 16 },
|
|
|
|
"Bitrate:"
|
|
|
|
};
|
|
|
|
OptionsField options_bitrate {
|
|
|
|
{ 11 * 8, 4 * 8 },
|
|
|
|
8,
|
|
|
|
{
|
|
|
|
{ "512 bps ", 0 },
|
|
|
|
{ "1200 bps", 1 },
|
|
|
|
{ "2400 bps", 2 }
|
|
|
|
}
|
2017-02-07 12:48:17 -05:00
|
|
|
};
|
2017-02-07 14:54:18 -05:00
|
|
|
|
|
|
|
Text text_address {
|
2017-02-07 20:19:29 -05:00
|
|
|
{ 3 * 8, 6 * 8, 8 * 8, 16 },
|
2017-02-07 12:48:17 -05:00
|
|
|
"Address:"
|
|
|
|
};
|
2017-02-07 20:19:29 -05:00
|
|
|
SymField field_address {
|
|
|
|
{ 11 * 8, 6 * 8 },
|
2017-02-07 12:48:17 -05:00
|
|
|
7,
|
|
|
|
SymField::SYMFIELD_DEC
|
|
|
|
};
|
|
|
|
|
2017-02-07 20:19:29 -05:00
|
|
|
Text text_type {
|
|
|
|
{ 6 * 8, 8 * 8, 5 * 8, 16 },
|
|
|
|
"Type:"
|
|
|
|
};
|
|
|
|
OptionsField options_type {
|
|
|
|
{ 11 * 8, 8 * 8 },
|
|
|
|
12,
|
2017-02-07 14:54:18 -05:00
|
|
|
{
|
2017-02-07 20:19:29 -05:00
|
|
|
{ "Address only", MessageType::ADDRESS_ONLY },
|
|
|
|
{ "Numeric only", MessageType::NUMERIC_ONLY },
|
|
|
|
{ "Alphanumeric", MessageType::ALPHANUMERIC }
|
2017-02-07 14:54:18 -05:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
Text text_message {
|
2017-02-07 20:19:29 -05:00
|
|
|
{ 3 * 8, 12 * 8, 16 * 8, 16 },
|
2017-02-07 14:54:18 -05:00
|
|
|
""
|
|
|
|
};
|
|
|
|
Button button_message {
|
2017-02-07 20:19:29 -05:00
|
|
|
{ 3 * 8, 14 * 8, 8 * 8, 28 },
|
2017-02-07 14:54:18 -05:00
|
|
|
"Set"
|
|
|
|
};
|
|
|
|
|
2017-02-07 12:48:17 -05:00
|
|
|
ProgressBar progressbar {
|
|
|
|
{ 16, 200, 208, 16 }
|
|
|
|
};
|
|
|
|
|
|
|
|
TransmitterView tx_view {
|
|
|
|
16 * 16,
|
|
|
|
10000,
|
|
|
|
9
|
|
|
|
};
|
|
|
|
|
|
|
|
MessageHandlerRegistration message_handler_tx_done {
|
|
|
|
Message::ID::TXDone,
|
|
|
|
[this](const Message* const p) {
|
|
|
|
const auto message = *reinterpret_cast<const TXDoneMessage*>(p);
|
|
|
|
this->on_tx_progress(message.progress, message.done);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
} /* namespace ui */
|
|
|
|
|
|
|
|
#endif/*__POCSAG_TX_H__*/
|