Fix IAX connect issue, combine some dstar code, change debig output to runtime instead of compile time

main
Doug McLain 1 year ago
parent f050489a92
commit 6d73e2eb4d

@ -230,6 +230,7 @@ Item {
droidstar.set_swid(settingsTab.swidEdit.text);
droidstar.set_pkgid(settingsTab.pkgidEdit.text);
droidstar.set_dmr_options(settingsTab.dmroptsEdit.text);
droidstar.set_dmr_pc(mainTab.privateBox.checked);
droidstar.set_iaxuser(settingsTab.iaxuserEdit.text);
droidstar.set_iaxpass(settingsTab.iaxpassEdit.text);
droidstar.set_iaxnode(settingsTab.iaxnodeEdit.text);

@ -1,5 +1,5 @@
<?xml version="1.0"?>
<manifest package="org.dudetronics.droidstar" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="-- %%INSERT_VERSION_NAME%% --" android:versionCode="74" android:installLocation="auto">
<manifest package="org.dudetronics.droidstar" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="-- %%INSERT_VERSION_NAME%% --" android:versionCode="75" android:installLocation="auto">
<!-- The following comment will be replaced upon deployment with default permissions based on the dependencies of the application.

@ -20,8 +20,6 @@
#include "CRCenc.h"
#include "MMDVMDefines.h"
//#define DEBUG
DCS::DCS()
{
m_mode = "DCS";
@ -40,16 +38,19 @@ void DCS::process_udp()
static bool sd_sync = 0;
static int sd_seq = 0;
static char user_data[21];
buf.resize(200);
int size = m_udp->readDatagram(buf.data(), buf.size(), &sender, &senderPort);
#ifdef DEBUG
fprintf(stderr, "RECV: ");
for(int i = 0; i < size; ++i){
fprintf(stderr, "%02x ", (unsigned char)buf.data()[i]);
}
fprintf(stderr, "\n");
fflush(stderr);
#endif
buf.resize(200);
int size = m_udp->readDatagram(buf.data(), buf.size(), &sender, &senderPort);
if(m_debug){
QDebug debug = qDebug();
debug.noquote();
QString s = "RECV:";
for(int i = 0; i < buf.size(); ++i){
s += " " + QString("%1").arg((uint8_t)buf.data()[i], 2, 16, QChar('0'));
}
debug << s;
}
if(size == 22){ //2 way keep alive ping
m_modeinfo.count++;
m_modeinfo.netmsg.clear();
@ -227,14 +228,16 @@ void DCS::hostname_lookup(QHostInfo i)
m_udp = new QUdpSocket(this);
connect(m_udp, SIGNAL(readyRead()), this, SLOT(process_udp()));
m_udp->writeDatagram(out, m_address, m_modeinfo.port);
#ifdef DEBUG
fprintf(stderr, "CONN: ");
for(int i = 0; i < out.size(); ++i){
fprintf(stderr, "%02x ", (unsigned char)out.data()[i]);
}
fprintf(stderr, "\n");
fflush(stderr);
#endif
if(m_debug){
QDebug debug = qDebug();
debug.noquote();
QString s = "CONN:";
for(int i = 0; i < out.size(); ++i){
s += " " + QString("%1").arg((uint8_t)out.data()[i], 2, 16, QChar('0'));
}
debug << s;
}
}
}
@ -250,14 +253,16 @@ void DCS::send_ping()
out.append('\x00');
out.append(m_module);
m_udp->writeDatagram(out, m_address, m_modeinfo.port);
#ifdef DEBUG
fprintf(stderr, "PING: ");
for(int i = 0; i < out.size(); ++i){
fprintf(stderr, "%02x ", (unsigned char)out.data()[i]);
}
fprintf(stderr, "\n");
fflush(stderr);
#endif
if(m_debug){
QDebug debug = qDebug();
debug.noquote();
QString s = "PING:";
for(int i = 0; i < out.size(); ++i){
s += " " + QString("%1").arg((uint8_t)out.data()[i], 2, 16, QChar('0'));
}
debug << s;
}
}
void DCS::send_disconnect()
@ -269,14 +274,16 @@ void DCS::send_disconnect()
out.append(' ');
out.append('\x00');
m_udp->writeDatagram(out, m_address, m_modeinfo.port);
#ifdef DEBUG
fprintf(stderr, "SEND: ");
for(int i = 0; i < out.size(); ++i){
fprintf(stderr, "%02x ", (unsigned char)out.data()[i]);
}
fprintf(stderr, "\n");
fflush(stderr);
#endif
if(m_debug){
QDebug debug = qDebug();
debug.noquote();
QString s = "DISC:";
for(int i = 0; i < out.size(); ++i){
s += " " + QString("%1").arg((uint8_t)out.data()[i], 2, 16, QChar('0'));
}
debug << s;
}
}
void DCS::format_callsign(QString &s)
@ -340,17 +347,14 @@ void DCS::start_tx()
void DCS::transmit()
{
unsigned char ambe[9];
uint8_t ambe_frame[72];
uint8_t ambe[9];
int16_t pcm[160];
memset(ambe_frame, 0, 72);
memset(ambe, 0, 9);
#ifdef USE_FLITE
if(m_ttsid > 0){
for(int i = 0; i < 160; ++i){
if(m_ttscnt >= tts_audio->num_samples/2){
//audiotx_cnt = 0;
pcm[i] = 0;
}
else{
@ -499,14 +503,15 @@ void DCS::send_frame(uint8_t *ambe)
emit update_output_level(m_audio->level() * 2);
update(m_modeinfo);
#ifdef DEBUG
fprintf(stderr, "SEND:%d: ", txdata.size());
for(int i = 0; i < txdata.size(); ++i){
fprintf(stderr, "%02x ", (unsigned char)txdata.data()[i]);
}
fprintf(stderr, "\n");
fflush(stderr);
#endif
if(m_debug){
QDebug debug = qDebug();
debug.noquote();
QString s = "SEND:";
for(int i = 0; i < txdata.size(); ++i){
s += " " + QString("%1").arg((uint8_t)txdata.data()[i], 2, 16, QChar('0'));
}
debug << s;
}
}
void DCS::get_ambe()

@ -24,8 +24,6 @@
#include "CRCenc.h"
#include "MMDVMDefines.h"
//#define DEBUG
const uint32_t ENCODING_TABLE_1676[] =
{0x0000U, 0x0273U, 0x04E5U, 0x0696U, 0x09C9U, 0x0BBAU, 0x0D2CU, 0x0F5FU, 0x11E2U, 0x1391U, 0x1507U, 0x1774U,
0x182BU, 0x1A58U, 0x1CCEU, 0x1EBDU, 0x21B7U, 0x23C4U, 0x2552U, 0x2721U, 0x287EU, 0x2A0DU, 0x2C9BU, 0x2EE8U,
@ -86,14 +84,17 @@ void DMR::process_udp()
buf.resize(m_udp->pendingDatagramSize());
m_udp->readDatagram(buf.data(), buf.size(), &sender, &senderPort);
#ifdef DEBUG
fprintf(stderr, "RECV: ");
for(int i = 0; i < buf.size(); ++i){
fprintf(stderr, "%02x ", (uint8_t)buf.data()[i]);
}
fprintf(stderr, "\n");
fflush(stderr);
#endif
if(m_debug){
QDebug debug = qDebug();
debug.noquote();
QString s = "RECV:";
for(int i = 0; i < buf.size(); ++i){
s += " " + QString("%1").arg((uint8_t)buf.data()[i], 2, 16, QChar('0'));
}
debug << s;
}
if((m_modeinfo.status != CONNECTED_RW) && (::memcmp(buf.data() + 3, "NAK", 3U) == 0)){
m_modeinfo.status = DISCONNECTED;
}
@ -281,16 +282,16 @@ void DMR::process_udp()
//uint32_t id = (uint32_t)((buf.data()[5] << 16) | ((buf.data()[6] << 8) & 0xff00) | (buf.data()[7] & 0xff));
}
emit update(m_modeinfo);
#ifdef DEBUG
if(out.size() > 0){
fprintf(stderr, "SEND: ");
for(int i = 0; i < out.size(); ++i){
fprintf(stderr, "%02x ", (uint8_t)out.data()[i]);
}
fprintf(stderr, "\n");
fflush(stderr);
}
#endif
if(m_debug && out.size() > 0){
QDebug debug = qDebug();
debug.noquote();
QString s = "SEND:";
for(int i = 0; i < out.size(); ++i){
s += " " + QString("%1").arg((uint8_t)out.data()[i], 2, 16, QChar('0'));
}
debug << s;
}
}
void DMR::setup_connection()
@ -325,14 +326,16 @@ void DMR::hostname_lookup(QHostInfo i)
m_udp = new QUdpSocket(this);
connect(m_udp, SIGNAL(readyRead()), this, SLOT(process_udp()));
m_udp->writeDatagram(out, m_address, m_modeinfo.port);
#ifdef DEBUG
fprintf(stderr, "CONN: ");
for(int i = 0; i < out.size(); ++i){
fprintf(stderr, "%02x ", (uint8_t)out.data()[i]);
}
fprintf(stderr, "\n");
fflush(stderr);
#endif
if(m_debug){
QDebug debug = qDebug();
debug.noquote();
QString s = "CONN:";
for(int i = 0; i < out.size(); ++i){
s += " " + QString("%1").arg((uint8_t)out.data()[i], 2, 16, QChar('0'));
}
debug << s;
}
}
}
@ -346,14 +349,16 @@ void DMR::send_ping()
out.append((m_essid >> 8) & 0xff);
out.append((m_essid >> 0) & 0xff);
m_udp->writeDatagram(out, m_address, m_modeinfo.port);
#ifdef DEBUG
fprintf(stderr, "PING: ");
for(int i = 0; i < out.size(); ++i){
fprintf(stderr, "%02x ", (uint8_t)out.data()[i]);
}
fprintf(stderr, "\n");
fflush(stderr);
#endif
if(m_debug){
QDebug debug = qDebug();
debug.noquote();
QString s = "PING:";
for(int i = 0; i < out.size(); ++i){
s += " " + QString("%1").arg((uint8_t)out.data()[i], 2, 16, QChar('0'));
}
debug << s;
}
}
void DMR::send_disconnect()
@ -369,14 +374,16 @@ void DMR::send_disconnect()
out.append((m_essid >> 8) & 0xff);
out.append((m_essid >> 0) & 0xff);
m_udp->writeDatagram(out, m_address, m_modeinfo.port);
#ifdef DEBUG
fprintf(stderr, "SEND: ");
for(int i = 0; i < out.size(); ++i){
fprintf(stderr, "%02x ", (uint8_t)out.data()[i]);
}
fprintf(stderr, "\n");
fflush(stderr);
#endif
if(m_debug){
QDebug debug = qDebug();
debug.noquote();
QString s = "SEND:";
for(int i = 0; i < out.size(); ++i){
s += " " + QString("%1").arg((uint8_t)out.data()[i], 2, 16, QChar('0'));
}
debug << s;
}
}
void DMR::process_modem_data(QByteArray d)
@ -413,14 +420,16 @@ void DMR::process_modem_data(QByteArray d)
m_udp->writeDatagram(txdata, m_address, m_modeinfo.port);
++m_dmrcnt;
}
#ifdef DEBUG
fprintf(stderr, "SEND:%lld: ", txdata.size());
for(int i = 0; i < txdata.size(); ++i){
fprintf(stderr, "%02x ", (uint8_t)txdata.data()[i]);
}
fprintf(stderr, "\n");
fflush(stderr);
#endif
if(m_debug){
QDebug debug = qDebug();
debug.noquote();
QString s = "SEND:";
for(int i = 0; i < txdata.size(); ++i){
s += " " + QString("%1").arg((uint8_t)txdata.data()[i], 2, 16, QChar('0'));
}
debug << s;
}
}
void DMR::transmit()
@ -517,7 +526,6 @@ void DMR::send_frame()
*/
}
else{
//fprintf(stderr, "DMR TX stopped\n");
get_eot();
build_frame();
m_ttscnt = 0;
@ -533,14 +541,16 @@ void DMR::send_frame()
}
emit update_output_level(m_audio->level() * 8);
emit update(m_modeinfo);
#ifdef DEBUG
fprintf(stderr, "SEND:%lld: ", txdata.size());
for(int i = 0; i < txdata.size(); ++i){
fprintf(stderr, "%02x ", (uint8_t)txdata.data()[i]);
}
fprintf(stderr, "\n");
fflush(stderr);
#endif
if(m_debug){
QDebug debug = qDebug();
debug.noquote();
QString s = "SEND:";
for(int i = 0; i < txdata.size(); ++i){
s += " " + QString("%1").arg((uint8_t)txdata.data()[i], 2, 16, QChar('0'));
}
debug << s;
}
}
uint8_t * DMR::get_eot()
@ -552,7 +562,7 @@ uint8_t * DMR::get_eot()
void DMR::build_frame()
{
qDebug() << "DMR: slot:cc == " << m_txslot << ":" << m_txcc;
//qDebug() << "DMR: slot:cc:flco == " << m_txslot << ":" << m_txcc << ":" << m_flco;
m_dmrFrame[0U] = 'D';
m_dmrFrame[1U] = 'M';
m_dmrFrame[2U] = 'R';

@ -174,13 +174,13 @@ void DroidStar::file_downloaded(QString filename)
emit update_log("Updated " + filename);
{
if(filename == "dplus.txt" && m_protocol == "REF"){
process_ref_hosts();
process_dstar_hosts(m_protocol);
}
else if(filename == "dextra.txt" && m_protocol == "XRF"){
process_xrf_hosts();
process_dstar_hosts(m_protocol);
}
else if(filename == "dcs.txt" && m_protocol == "DCS"){
process_dcs_hosts();
process_dstar_hosts(m_protocol);
}
else if(filename == "YSFHosts.txt" && m_protocol == "YSF"){
process_ysf_hosts();
@ -344,7 +344,16 @@ void DroidStar::process_connect()
m_mode = Mode::create_mode(m_protocol);
m_modethread = new QThread;
m_mode->moveToThread(m_modethread);
m_mode->init(m_callsign, m_dmrid, nxdnid, m_module, m_refname, m_host, m_port, m_ipv6, vocoder, modem, m_capture, m_playback, m_mdirect);
if(m_protocol == "IAX"){
m_mode->set_iax_params(m_iaxuser, m_iaxpassword, m_iaxnode, m_iaxhost, m_iaxport);
m_mode->init(m_callsign, m_dmrid, nxdnid, m_module, m_refname, m_iaxhost, m_iaxport, m_ipv6, vocoder, modem, m_capture, m_playback, m_mdirect);
connect(this, SIGNAL(send_dtmf(QByteArray)), m_mode, SLOT(send_dtmf(QByteArray)));
}
else{
m_mode->init(m_callsign, m_dmrid, nxdnid, m_module, m_refname, m_host, m_port, m_ipv6, vocoder, modem, m_capture, m_playback, m_mdirect);
}
m_mode->set_modem_flags(rxInvert, txInvert, pttInvert, useCOSAsLockout, duplex);
m_mode->set_modem_params(m_modemBaud.toUInt(), rxfreq, txfreq, m_modemTxDelay.toInt(), m_modemRxLevel.toFloat(), m_modemRFLevel.toFloat(), ysfTXHang, m_modemCWIdTxLevel.toFloat(), m_modemDstarTxLevel.toFloat(), m_modemDMRTxLevel.toFloat(), m_modemYSFTxLevel.toFloat(), m_modemP25TxLevel.toFloat(), m_modemNXDNTxLevel.toFloat(), pocsagTXLevel, m17TXLevel);
@ -393,6 +402,7 @@ void DroidStar::process_connect()
connect(this, SIGNAL(slot_changed(int)), m_mode, SLOT(slot_changed(int)));
connect(this, SIGNAL(cc_changed(int)), m_mode, SLOT(cc_changed(int)));
emit dmr_tgid_changed(m_dmr_destid);
emit dmrpc_state_changed(m_pc);
}
if(m_protocol == "M17"){
@ -403,11 +413,6 @@ void DroidStar::process_connect()
}
}
if(m_protocol == "IAX"){
m_mode->set_iax_params(m_iaxuser, m_iaxpassword, m_iaxnode, m_iaxhost, m_iaxport);
connect(this, SIGNAL(send_dtmf(QByteArray)), m_mode, SLOT(send_dtmf(QByteArray)));
}
m_modethread->start();
}
@ -461,34 +466,16 @@ void DroidStar::process_host_change(const QString &h)
void DroidStar::process_mode_change(const QString &m)
{
m_protocol = m;
if(m == "REF"){
process_ref_hosts();
m_label1 = "MYCALL";
m_label2 = "URCALL";
m_label3 = "RPTR1";
m_label4 = "RPTR2";
m_label5 = "Stream ID";
m_label6 = "User txt";
}
if(m == "DCS"){
process_dcs_hosts();
m_label1 = "MYCALL";
m_label2 = "URCALL";
m_label3 = "RPTR1";
m_label4 = "RPTR2";
m_label5 = "Stream ID";
m_label6 = "User txt";
}
if(m == "XRF"){
process_xrf_hosts();
m_label1 = "MYCALL";
m_label2 = "URCALL";
m_label3 = "RPTR1";
m_label4 = "RPTR2";
m_label5 = "Stream ID";
m_label6 = "User txt";
}
m_protocol = m;
if((m == "REF") || (m == "DCS") || (m == "XRF")){
process_dstar_hosts(m);
m_label1 = "MYCALL";
m_label2 = "URCALL";
m_label3 = "RPTR1";
m_label4 = "RPTR2";
m_label5 = "Stream ID";
m_label6 = "User txt";
}
if(m == "YSF"){
process_ysf_hosts();
m_label1 = "Gateway";
@ -697,128 +684,60 @@ void DroidStar::update_custom_hosts(QString h)
m_localhosts = m_settings->value("LOCALHOSTS").toString();
}
void DroidStar::process_ref_hosts()
{
m_hostmap.clear();
m_hostsmodel.clear();
QFileInfo check_file(config_path + "/dplus.txt");
if(check_file.exists() && check_file.isFile()){
QFile f(config_path + "/dplus.txt");
if(f.open(QIODevice::ReadOnly)){
while(!f.atEnd()){
QString l = f.readLine();
if(l.at(0) == '#'){
continue;
}
QStringList ll = l.split('\t');
if(ll.size() > 1){
m_hostmap[ll.at(0).simplified()] = ll.at(1).simplified() + ",20001";
}
}
m_customhosts = m_localhosts.split('\n');
for (const auto& i : qAsConst(m_customhosts)){
QStringList line = i.simplified().split(' ');
if(line.at(0) == "REF"){
m_hostmap[line.at(1).simplified()] = line.at(2).simplified() + "," + line.at(3).simplified();
}
}
QMap<QString, QString>::const_iterator i = m_hostmap.constBegin();
while (i != m_hostmap.constEnd()) {
m_hostsmodel.append(i.key());
++i;
}
}
f.close();
}
else{
download_file("/dplus.txt");
}
}
void DroidStar::process_dcs_hosts()
{
m_hostmap.clear();
m_hostsmodel.clear();
QFileInfo check_file(config_path + "/dcs.txt");
if(check_file.exists() && check_file.isFile()){
QFile f(config_path + "/dcs.txt");
if(f.open(QIODevice::ReadOnly)){
while(!f.atEnd()){
QString l = f.readLine();
if(l.at(0) == '#'){
continue;
}
QStringList ll = l.split('\t');
if(ll.size() > 1){
m_hostmap[ll.at(0).simplified()] = ll.at(1).simplified() + ",30051";
}
}
m_customhosts = m_localhosts.split('\n');
for (const auto& i : qAsConst(m_customhosts)){
QStringList line = i.simplified().split(' ');
if(line.at(0) == "DCS"){
m_hostmap[line.at(1).simplified()] = line.at(2).simplified() + "," + line.at(3).simplified();
}
}
QMap<QString, QString>::const_iterator i = m_hostmap.constBegin();
while (i != m_hostmap.constEnd()) {
m_hostsmodel.append(i.key());
++i;
}
}
f.close();
}
else{
download_file("/dcs.txt");
}
}
void DroidStar::process_xrf_hosts()
void DroidStar::process_dstar_hosts(QString m)
{
m_hostmap.clear();
m_hostsmodel.clear();
QFileInfo check_file(config_path + "/dextra.txt");
if(check_file.exists() && check_file.isFile()){
QFile f(config_path + "/dextra.txt");
if(f.open(QIODevice::ReadOnly)){
while(!f.atEnd()){
QString l = f.readLine();
if(l.at(0) == '#'){
continue;
}
QStringList ll = l.split('\t');
if(ll.size() > 1){
m_hostmap[ll.at(0).simplified()] = ll.at(1).simplified() + ",30001";
}
}
m_hostmap.clear();
m_hostsmodel.clear();
QString filename, port;
if(m == "REF"){
filename = "dplus.txt";
port = "20001";
}
else if(m == "DCS"){
filename = "dcs.txt";
port = "30051";
}
else if(m == "XRF"){
filename = "dextra.txt";
port = "30001";
}
QFileInfo check_file(config_path + "/" + filename);
if(check_file.exists() && check_file.isFile()){
QFile f(config_path + "/" + filename);
if(f.open(QIODevice::ReadOnly)){
while(!f.atEnd()){
QString l = f.readLine();
if(l.at(0) == '#'){
continue;
}
QStringList ll = l.split('\t');
if(ll.size() > 1){
m_hostmap[ll.at(0).simplified()] = ll.at(1).simplified() + "," + port;
}
}
m_customhosts = m_localhosts.split('\n');
for (const auto& i : qAsConst(m_customhosts)){
QStringList line = i.simplified().split(' ');
m_customhosts = m_localhosts.split('\n');
for (const auto& i : qAsConst(m_customhosts)){
QStringList line = i.simplified().split(' ');
if(line.at(0) == "XRF"){
m_hostmap[line.at(1).simplified()] = line.at(2).simplified() + "," + line.at(3).simplified();
}
}
if(line.at(0) == m){
m_hostmap[line.at(1).simplified()] = line.at(2).simplified() + "," + line.at(3).simplified();
}
}
QMap<QString, QString>::const_iterator i = m_hostmap.constBegin();
while (i != m_hostmap.constEnd()) {
m_hostsmodel.append(i.key());
++i;
}
}
f.close();
}
else{
download_file("/dextra.txt");
}
QMap<QString, QString>::const_iterator i = m_hostmap.constBegin();
while (i != m_hostmap.constEnd()) {
m_hostsmodel.append(i.key());
++i;
}
}
f.close();
}
else{
download_file("/" + filename);
}
}
void DroidStar::process_ysf_hosts()
@ -856,7 +775,6 @@ void DroidStar::process_ysf_hosts()
}
}
f.close();
//process_fcs_rooms();
}
else{
download_file("/YSFHosts.txt");

@ -89,8 +89,8 @@ public slots:
void set_url(const QString &url){ m_url = url; save_settings(); }
void set_swid(const QString &swid){ m_swid = swid; save_settings(); }
void set_pkgid(const QString &pkgid){ m_pkgid = pkgid; save_settings(); }
void set_dmr_options(const QString &dmropts) { m_dmropts = dmropts; save_settings(); }
void set_dmr_pc(int pc) { emit dmrpc_state_changed(pc); }
void set_dmr_options(const QString &dmropts) { m_dmropts = dmropts; save_settings(); }
void set_dmr_pc(int pc) { m_pc = pc; emit dmrpc_state_changed(m_pc); }
//void set_host(const QString &host) { m_host = host; save_settings(); }
void set_module(const QString &module) { m_module = module.toStdString()[0]; save_settings(); emit module_changed(m_module);}
void set_protocol(const QString &protocol) { m_protocol = protocol; save_settings(); }
@ -101,9 +101,9 @@ public slots:
void set_iaxnode(const QString &node){ m_iaxnode = node; save_settings(); }
void set_iaxhost(const QString &host){ m_iaxhost = host; save_settings(); }
void set_mycall(const QString &mycall) { m_mycall = mycall; save_settings(); emit mycall_changed(mycall); }
void set_urcall(const QString &urcall) { m_urcall = urcall; save_settings(); emit urcall_changed(urcall); }
void set_rptr1(const QString &rptr1) { m_rptr1 = rptr1; save_settings(); emit rptr1_changed(rptr1); }
void set_rptr2(const QString &rptr2) { m_rptr2 = rptr2; save_settings(); emit rptr2_changed(rptr2); }
void set_urcall(const QString &urcall) { m_urcall = urcall; save_settings(); emit urcall_changed(urcall); }
void set_rptr1(const QString &rptr1) { m_rptr1 = rptr1; save_settings(); emit rptr1_changed(rptr1); qDebug() << "rpt1 == " << m_rptr1; }
void set_rptr2(const QString &rptr2) { m_rptr2 = rptr2; save_settings(); emit rptr2_changed(rptr2); qDebug() << "rpt2 == " << m_rptr2; }
void set_usrtxt(const QString &usrtxt) { m_dstarusertxt = usrtxt; save_settings(); emit usrtxt_changed(usrtxt); }
void set_txtimeout(const QString &t) { m_txtimeout = t.simplified().toUInt(); save_settings();}
void set_toggletx(bool x) { m_toggletx = x; save_settings(); }
@ -279,6 +279,7 @@ private:
QString m_swid;
QString m_pkgid;
QString m_dmropts;
int m_pc;
QString m_saved_refhost;
QString m_saved_dcshost;
QString m_saved_xrfhost;
@ -381,9 +382,7 @@ private slots:
void keepScreenOn();
#endif
void discover_devices();
void process_ref_hosts();
void process_dcs_hosts();
void process_xrf_hosts();
void process_dstar_hosts(QString);
void process_ysf_hosts();
void process_fcs_rooms();
void process_dmr_hosts();

@ -22,7 +22,6 @@
#else
#include <arpa/inet.h>
#endif
//#define DEBUG
#ifdef USE_FLITE
extern "C" {
@ -32,6 +31,8 @@ extern cst_voice * register_cmu_us_awb(const char *);
}
#endif
#define DEBUG
IAX::IAX() :
m_scallno(0),
m_dcallno(0),
@ -159,14 +160,16 @@ void IAX::send_call()
out.append(AST_FORMAT_ULAW);
m_timestamp = QDateTime::currentMSecsSinceEpoch();
m_udp->writeDatagram(out, m_address, m_port);
#ifdef DEBUG
fprintf(stderr, "SEND: ");
for(int i = 0; i < out.size(); ++i){
fprintf(stderr, "%02x ", (unsigned char)out.data()[i]);
}
fprintf(stderr, "\n");
fflush(stderr);
#endif
if(m_debug){
QDebug debug = qDebug();
debug.noquote();
QString s = "SEND:";
for(int i = 0; i < out.size(); ++i){
s += " " + QString("%1").arg((uint8_t)out.data()[i], 2, 16, QChar('0'));
}
debug << s;
}
}
void IAX::send_call_auth()
@ -491,7 +494,9 @@ void IAX::send_disconnect()
void IAX::hostname_lookup(QHostInfo i)
{
qDebug() << "IAX::hostname_lookup()";
if (!i.addresses().isEmpty()) {
qDebug() << "IAX::hostname_lookup() 2";
m_address = i.addresses().first();
m_udp = new QUdpSocket(this);
m_regtimer = new QTimer();

@ -26,8 +26,6 @@
#define M17CHARACTERS " ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-/."
//#define DEBUG
const uint8_t SCRAMBLER[] = {
0x00U, 0x00U, 0xD6U, 0xB5U, 0xE2U, 0x30U, 0x82U, 0xFFU, 0x84U, 0x62U, 0xBAU, 0x4EU, 0x96U, 0x90U, 0xD8U, 0x98U, 0xDDU,
0x5DU, 0x0CU, 0xC8U, 0x52U, 0x43U, 0x91U, 0x1DU, 0xF8U, 0x6EU, 0x68U, 0x2FU, 0x35U, 0xDAU, 0x14U, 0xEAU, 0xCDU, 0x76U,
@ -209,14 +207,16 @@ void M17::process_udp()
buf.resize(m_udp->pendingDatagramSize());
m_udp->readDatagram(buf.data(), buf.size(), &sender, &senderPort);
#ifdef DEBUG
fprintf(stderr, "RECV: ");
for(int i = 0; i < buf.size(); ++i){
fprintf(stderr, "%02x ", (uint8_t)buf.data()[i]);
}
fprintf(stderr, "\n");
fflush(stderr);
#endif
if(m_debug){
QDebug debug = qDebug();
debug.noquote();
QString s = "RECV:";
for(int i = 0; i < buf.size(); ++i){
s += " " + QString("%1").arg((uint8_t)buf.data()[i], 2, 16, QChar('0'));
}
debug << s;
}
if((m_modeinfo.status != CONNECTED_RW) && (buf.size() == 4) && (::memcmp(buf.data(), "NACK", 4U) == 0)){
m_modeinfo.status = DISCONNECTED;
}
@ -338,14 +338,16 @@ void M17::hostname_lookup(QHostInfo i)
m_udp = new QUdpSocket(this);
connect(m_udp, SIGNAL(readyRead()), this, SLOT(process_udp()));
m_udp->writeDatagram(out, m_address, m_modeinfo.port);
#ifdef DEBUG
fprintf(stderr, "CONN: ");
for(int i = 0; i < out.size(); ++i){
fprintf(stderr, "%02x ", (uint8_t)out.data()[i]);
}
fprintf(stderr, "\n");
fflush(stderr);
#endif
if(m_debug){
QDebug debug = qDebug();
debug.noquote();
QString s = "CONN:";
for(int i = 0; i < out.size(); ++i){
s += " " + QString("%1").arg((uint8_t)out.data()[i], 2, 16, QChar('0'));
}
debug << s;
}
}
}
@ -396,6 +398,15 @@ void M17::send_ping()
fprintf(stderr, "\n");
fflush(stderr);
#endif
if(m_debug){
QDebug debug = qDebug();
debug.noquote();
QString s = "PING:";
for(int i = 0; i < out.size(); ++i){
s += " " + QString("%1").arg((uint8_t)out.data()[i], 2, 16, QChar('0'));
}
debug << s;
}
}
void M17::send_disconnect()
@ -418,14 +429,16 @@ void M17::send_disconnect()
out.append('C');
out.append((char *)cs, 6);
m_udp->writeDatagram(out, m_address, m_modeinfo.port);
#ifdef DEBUG
fprintf(stderr, "SEND: ");
for(int i = 0; i < out.size(); ++i){
fprintf(stderr, "%02x ", (uint8_t)out.data()[i]);
}
fprintf(stderr, "\n");
fflush(stderr);
#endif
if(m_debug){
QDebug debug = qDebug();
debug.noquote();
QString s = "SEND:";
for(int i = 0; i < out.size(); ++i){
s += " " + QString("%1").arg((uint8_t)out.data()[i], 2, 16, QChar('0'));
}
debug << s;
}
}
void M17::send_modem_data(QByteArray d)
@ -683,14 +696,16 @@ void M17::process_modem_data(QByteArray d)
txframe.append((char *)&netframe[30], 16);
txframe.append(2, 0x00);
m_udp->writeDatagram(txframe, m_address, m_modeinfo.port);
#ifdef DEBUG
fprintf(stderr, "SEND:%02x:", (uint8_t)txframe.size());
for(int i = 0; i < txframe.size(); ++i){
fprintf(stderr, "%02x ", (uint8_t)txframe.data()[i]);
}
fprintf(stderr, "\n");
fflush(stderr);
#endif
if(m_debug){
QDebug debug = qDebug();
debug.noquote();
QString s = "SEND:";
for(int i = 0; i < txframe.size(); ++i){
s += " " + QString("%1").arg((uint8_t)txframe.data()[i], 2, 16, QChar('0'));
}
debug << s;
}
}
}
}
@ -834,6 +849,15 @@ void M17::transmit()
fprintf(stderr, "\n");
fflush(stderr);
#endif
if(m_debug){
QDebug debug = qDebug();
debug.noquote();
QString s = "SEND:";
for(int i = 0; i < txframe.size(); ++i){
s += " " + QString("%1").arg((uint8_t)txframe.data()[i], 2, 16, QChar('0'));
}
debug << s;
}
}
else{
const uint8_t quiet3200[] = { 0x00, 0x01, 0x43, 0x09, 0xe4, 0x9c, 0x08, 0x21 };
@ -892,14 +916,16 @@ void M17::transmit()
m_modeinfo.frame_number = tx_cnt;
m_modeinfo.streamid = txstreamid;
emit update(m_modeinfo);
#ifdef DEBUG
fprintf(stderr, "LAST:%d: ", txframe.size());
for(int i = 0; i < txframe.size(); ++i){
fprintf(stderr, "%02x ", (uint8_t)txframe.data()[i]);
}
fprintf(stderr, "\n");
fflush(stderr);
#endif
if(m_debug){
QDebug debug = qDebug();
debug.noquote();
QString s = "LAST:";
for(int i = 0; i < txframe.size(); ++i){
s += " " + QString("%1").arg((uint8_t)txframe.data()[i], 2, 16, QChar('0'));
}
debug << s;
}
}
}

@ -97,6 +97,7 @@ void Mode::init(QString callsign, uint32_t dmrid, uint16_t nxdnid, char module,
m_modem = nullptr;
m_ambedev = nullptr;
m_mbevocoder = nullptr;
m_hwrx = false;
m_hwtx = false;
m_tx = false;
@ -128,7 +129,7 @@ void Mode::init(QString callsign, uint32_t dmrid, uint16_t nxdnid, char module,
voice_kal = register_cmu_us_kal16(nullptr);
voice_awb = register_cmu_us_awb(nullptr);
#endif
m_debug = true;
}
void Mode::ambe_connect_status(bool s)
@ -343,6 +344,7 @@ bool Mode::load_vocoder_plugin()
return false;
}
#else
qDebug() << "new vocoder";
m_mbevocoder = new VocoderPlugin();
return true;
#endif
@ -355,7 +357,8 @@ void Mode::deleteLater()
//m_udp->disconnect();
//m_ping_timer->stop();
send_disconnect();
delete m_audio;
delete m_audio;
//if(m_mbevocoder != nullptr) delete m_mbevocoder;
#if !defined(Q_OS_IOS)
if(m_hwtx){
delete m_ambedev;

@ -18,8 +18,6 @@
#include "nxdn.h"
#include <cstring>
//#define DEBUG
const int dvsi_interleave[49] = {
0, 3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36, 39, 41, 43, 45, 47,
1, 4, 7, 10, 13, 16, 19, 22, 25, 28, 31, 34, 37, 40, 42, 44, 46, 48,
@ -60,14 +58,16 @@ void NXDN::process_udp()
buf.resize(m_udp->pendingDatagramSize());
m_udp->readDatagram(buf.data(), buf.size(), &sender, &senderPort);
#ifdef DEBUG
fprintf(stderr, "RECV: ");
for(int i = 0; i < buf.size(); ++i){
fprintf(stderr, "%02x ", (uint8_t)buf.data()[i]);
}
fprintf(stderr, "\n");
fflush(stderr);
#endif
if(m_debug){
QDebug debug = qDebug();
debug.noquote();
QString s = "RECV:";
for(int i = 0; i < buf.size(); ++i){
s += " " + QString("%1").arg((uint8_t)buf.data()[i], 2, 16, QChar('0'));
}
debug << s;
}
if(buf.size() == 17){
if(m_modeinfo.status == CONNECTING){
m_modeinfo.status = CONNECTED_RW;
@ -217,14 +217,16 @@ void NXDN::send_ping(bool disconnect)
out.append((m_modeinfo.gwid >> 8) & 0xff);
out.append((m_modeinfo.gwid >> 0) & 0xff);
m_udp->writeDatagram(out, m_address, m_modeinfo.port);
#ifdef DEBUG
fprintf(stderr, "PING: ");
for(int i = 0; i < out.size(); ++i){
fprintf(stderr, "%02x ", (uint8_t)out.data()[i]);
}
fprintf(stderr, "\n");
fflush(stderr);
#endif
if(m_debug){
QDebug debug = qDebug();
debug.noquote();
QString s = "PING:";
for(int i = 0; i < out.size(); ++i){
s += " " + QString("%1").arg((uint8_t)out.data()[i], 2, 16, QChar('0'));
}
debug << s;
}
}
void NXDN::transmit()
@ -291,14 +293,16 @@ void NXDN::send_frame()
temp_nxdn = get_frame();
txdata.append((char *)temp_nxdn, 43);
m_udp->writeDatagram(txdata, m_address, m_modeinfo.port);
#ifdef DEBUG
fprintf(stderr, "SEND:%lli: ", txdata.size());
for(int i = 0; i < txdata.size(); ++i){
fprintf(stderr, "%02x ", (uint8_t)txdata.data()[i]);
}
fprintf(stderr, "\n");
fflush(stderr);
#endif
if(m_debug){
QDebug debug = qDebug();
debug.noquote();
QString s = "SEND:";
for(int i = 0; i < txdata.size(); ++i){
s += " " + QString("%1").arg((uint8_t)txdata.data()[i], 2, 16, QChar('0'));
}
debug << s;
}
}
else{
fprintf(stderr, "NXDN TX stopped\n");

@ -19,8 +19,6 @@
#include <cstring>
#include "p25.h"
//#define DEBUG
const uint8_t REC62[] = {0x62U, 0x02U, 0x02U, 0x0CU, 0x0BU, 0x12U, 0x64U, 0x00U, 0x00U, 0x80U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U,0x00U, 0x00U, 0x00U, 0x00U, 0x00U};
const uint8_t REC63[] = {0x63U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x02U};
const uint8_t REC64[] = {0x64U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x02U};
@ -65,14 +63,16 @@ void P25::process_udp()
buf.resize(m_udp->pendingDatagramSize());
m_udp->readDatagram(buf.data(), buf.size(), &sender, &senderPort);
#ifdef DEBUG
fprintf(stderr, "RCCV: ");
for(int i = 0; i < buf.size(); ++i){
fprintf(stderr, "%02x ", (uint8_t)buf.data()[i]);
}
fprintf(stderr, "\n");
fflush(stderr);
#endif
if(m_debug){
QDebug debug = qDebug();
debug.noquote();
QString s = "RECV:";
for(int i = 0; i < buf.size(); ++i){
s += " " + QString("%1").arg((uint8_t)buf.data()[i], 2, 16, QChar('0'));
}
debug << s;
}
if(buf.size() == 11){
if(m_modeinfo.status == CONNECTING){
m_modeinfo.status = CONNECTED_RW;
@ -187,14 +187,16 @@ void P25::hostname_lookup(QHostInfo i)
m_udp = new QUdpSocket(this);
connect(m_udp, SIGNAL(readyRead()), this, SLOT(process_udp()));
m_udp->writeDatagram(out, m_address, m_modeinfo.port);
#ifdef DEBUG
fprintf(stderr, "CONN: ");
for(int i = 0; i < out.size(); ++i){
fprintf(stderr, "%02x ", (uint8_t)out.data()[i]);
}
fprintf(stderr, "\n");
fflush(stderr);
#endif
if(m_debug){
QDebug debug = qDebug();
debug.noquote();
QString s = "CONN:";
for(int i = 0; i < out.size(); ++i){
s += " " + QString("%1").arg((uint8_t)out.data()[i], 2, 16, QChar('0'));
}
debug << s;
}
}
}
@ -205,14 +207,16 @@ void P25::send_ping()
out.append(m_modeinfo.callsign.toUtf8());
out.append(10 - m_modeinfo.callsign.size(), ' ');
m_udp->writeDatagram(out, m_address, m_modeinfo.port);
#ifdef DEBUG
fprintf(stderr, "PING: ");
for(int i = 0; i < out.size(); ++i){
fprintf(stderr, "%02x ", (uint8_t)out.data()[i]);
}
fprintf(stderr, "\n");
fflush(stderr);
#endif
if(m_debug){
QDebug debug = qDebug();
debug.noquote();
QString s = "PING:";
for(int i = 0; i < out.size(); ++i){
s += " " + QString("%1").arg((uint8_t)out.data()[i], 2, 16, QChar('0'));
}
debug << s;
}
}
void P25::send_disconnect()
@ -222,14 +226,16 @@ void P25::send_disconnect()
out.append(m_modeinfo.callsign.toUtf8());
out.append(10 - m_modeinfo.callsign.size(), ' ');
m_udp->writeDatagram(out, m_address, m_modeinfo.port);
#ifdef DEBUG
fprintf(stderr, "SEND: ");
for(int i = 0; i < out.size(); ++i){
fprintf(stderr, "%02x ", (uint8_t)out.data()[i]);
}
fprintf(stderr, "\n");
fflush(stderr);
#endif
if(m_debug){
QDebug debug = qDebug();
debug.noquote();
QString s = "SEND:";
for(int i = 0; i < out.size(); ++i){
s += " " + QString("%1").arg((uint8_t)out.data()[i], 2, 16, QChar('0'));
}
debug << s;
}
}
void P25::transmit()
@ -405,14 +411,16 @@ void P25::transmit()
}
emit update_output_level(m_audio->level() * 6);
emit update(m_modeinfo);
#ifdef DEBUG
fprintf(stderr, "SEND: ");
for(int i = 0; i < txdata.size(); ++i){
fprintf(stderr, "%02x ", (uint8_t)txdata.data()[i]);
}
fprintf(stderr, "\n");
fflush(stderr);
#endif
if(m_debug){
QDebug debug = qDebug();
debug.noquote();
QString s = "SEND:";
for(int i = 0; i < txdata.size(); ++i){
s += " " + QString("%1").arg((uint8_t)txdata.data()[i], 2, 16, QChar('0'));
}
debug << s;
}
}
void P25::process_rx_data()

@ -20,7 +20,6 @@
#include "ref.h"
#include "CRCenc.h"
//#define DEBUG
const uint8_t MMDVM_DSTAR_HEADER = 0x10U;
const uint8_t MMDVM_DSTAR_DATA = 0x11U;
@ -50,14 +49,17 @@ void REF::process_udp()
buf.resize(m_udp->pendingDatagramSize());
m_udp->readDatagram(buf.data(), buf.size(), &sender, &senderPort);
#ifdef DEBUG
fprintf(stderr, "RECV: ");
for(int i = 0; i < buf.size(); ++i){
fprintf(stderr, "%02x ", (uint8_t)buf.data()[i]);
}
fprintf(stderr, "\n");
fflush(stderr);
#endif
if(m_debug){
QDebug debug = qDebug();
debug.noquote();
QString s = "RECV:";
for(int i = 0; i < buf.size(); ++i){
s += " " + QString("%1").arg((uint8_t)buf.data()[i], 2, 16, QChar('0'));
}
debug << s;
}
if ((buf.size() == 5) && (buf.data()[0] == 5)){
int x = (::rand() % (999999 - 7245 + 1)) + 7245;
QString serial = "HS" + QString("%1").arg(x, 6, 10, QChar('0'));
@ -77,16 +79,17 @@ void REF::process_udp()
}
emit update(m_modeinfo);
}
#ifdef DEBUG
if(out.size()){
fprintf(stderr, "SEND: ");
for(int i = 0; i < out.size(); ++i){
fprintf(stderr, "%02x ", (uint8_t)out.data()[i]);
}
fprintf(stderr, "\n");
fflush(stderr);
}
#endif
if(m_debug && out.size() > 0){
QDebug debug = qDebug();
debug.noquote();
QString s = "RECV:";
for(int i = 0; i < out.size(); ++i){
s += " " + QString("%1").arg((uint8_t)out.data()[i], 2, 16, QChar('0'));
}
debug << s;
}
if((m_modeinfo.status == CONNECTING) && (buf.size() == 0x08)){
if((memcmp(&buf.data()[4], "OKRW", 4) == 0) || (memcmp(&buf.data()[4], "OKRO", 4) == 0) || (memcmp(&buf.data()[4], "BUSY", 4) == 0)){
m_modeinfo.sw_vocoder_loaded = load_vocoder_plugin();
@ -284,14 +287,16 @@ void REF::hostname_lookup(QHostInfo i)
m_udp = new QUdpSocket(this);
connect(m_udp, SIGNAL(readyRead()), this, SLOT(process_udp()));
m_udp->writeDatagram(out, m_address, m_modeinfo.port);
#ifdef DEBUG
fprintf(stderr, "CONN: ");
for(int i = 0; i < out.size(); ++i){
fprintf(stderr, "%02x ", (uint8_t)out.data()[i]);
}
fprintf(stderr, "\n");
fflush(stderr);
#endif
if(m_debug){
QDebug debug = qDebug();
debug.noquote();
QString s = "CONN:";
for(int i = 0; i < out.size(); ++i){
s += " " + QString("%1").arg((uint8_t)out.data()[i], 2, 16, QChar('0'));
}
debug << s;
}
}
}
@ -302,14 +307,16 @@ void REF::send_ping()
out.append(0x60);
out.append('\x00');
m_udp->writeDatagram(out, m_address, m_modeinfo.port);
#ifdef DEBUG
fprintf(stderr, "PING: ");
for(int i = 0; i < out.size(); ++i){
fprintf(stderr, "%02x ", (uint8_t)out.data()[i]);
}
fprintf(stderr, "\n");
fflush(stderr);
#endif
if(m_debug){
QDebug debug = qDebug();
debug.noquote();
QString s = "PING:";
for(int i = 0; i < out.size(); ++i){
s += " " + QString("%1").arg((uint8_t)out.data()[i], 2, 16, QChar('0'));
}
debug << s;
}
}
void REF::send_disconnect()
@ -321,14 +328,16 @@ void REF::send_disconnect()
out.append('\x00');
out.append('\x00');
m_udp->writeDatagram(out, m_address, m_modeinfo.port);
#ifdef DEBUG
fprintf(stderr, "SEND: ");
for(int i = 0; i < out.size(); ++i){
fprintf(stderr, "%02x ", (uint8_t)out.data()[i]);
}
fprintf(stderr, "\n");
fflush(stderr);
#endif
if(m_debug){
QDebug debug = qDebug();
debug.noquote();
QString s = "DISC:";
for(int i = 0; i < out.size(); ++i){
s += " " + QString("%1").arg((uint8_t)out.data()[i], 2, 16, QChar('0'));
}
debug << s;
}
}
void REF::format_callsign(QString &s)
@ -489,14 +498,16 @@ void REF::send_frame(uint8_t *ambe)
m_modeinfo.frame_number = m_txcnt;
m_udp->writeDatagram(txdata, m_address, m_modeinfo.port);
#ifdef DEBUG
fprintf(stderr, "SEND:%d: ", txdata.size());
for(int i = 0; i < txdata.size(); ++i){
fprintf(stderr, "%02x ", (uint8_t)txdata.data()[i]);
}
fprintf(stderr, "\n");
fflush(stderr);
#endif
if(m_debug){
QDebug debug = qDebug();
debug.noquote();
QString s = "SEND:";
for(int i = 0; i < txdata.size(); ++i){
s += " " + QString("%1").arg((uint8_t)txdata.data()[i], 2, 16, QChar('0'));
}
debug << s;
}
}
txdata.resize(29);
@ -611,14 +622,16 @@ void REF::send_frame(uint8_t *ambe)
m_udp->writeDatagram(txdata, m_address, m_modeinfo.port);
emit update_output_level(m_audio->level() * 2);
emit update(m_modeinfo);
#ifdef DEBUG
fprintf(stderr, "SEND:%d: ", txdata.size());
for(int i = 0; i < txdata.size(); ++i){
fprintf(stderr, "%02x ", (uint8_t)txdata.data()[i]);
}
fprintf(stderr, "\n");
fflush(stderr);
#endif
if(m_debug){
QDebug debug = qDebug();
debug.noquote();
QString s = "SEND:";
for(int i = 0; i < txdata.size(); ++i){
s += " " + QString("%1").arg((uint8_t)txdata.data()[i], 2, 16, QChar('0'));
}
debug << s;
}
}
void REF::get_ambe()

@ -21,8 +21,6 @@
#include "CRCenc.h"
#include "MMDVMDefines.h"
//#define DEBUG
XRF::XRF()
{
m_mode = "XRF";
@ -44,14 +42,17 @@ void XRF::process_udp()
buf.resize(m_udp->pendingDatagramSize());
m_udp->readDatagram(buf.data(), buf.size(), &sender, &senderPort);
#ifdef DEBUG
fprintf(stderr, "RECV: ");
for(int i = 0; i < buf.size(); ++i){
fprintf(stderr, "%02x ", (uint8_t)buf.data()[i]);
}
fprintf(stderr, "\n");
fflush(stderr);
#endif
if(m_debug){
QDebug debug = qDebug();
debug.noquote();
QString s = "RECV:";
for(int i = 0; i < buf.size(); ++i){
s += " " + QString("%1").arg((uint8_t)buf.data()[i], 2, 16, QChar('0'));
}
debug << s;
}
if(buf.size() == 9){
m_modeinfo.count++;
if( (m_modeinfo.stream_state == STREAM_LOST) || (m_modeinfo.stream_state == STREAM_END) ){
@ -243,14 +244,16 @@ void XRF::hostname_lookup(QHostInfo i)
m_udp = new QUdpSocket(this);
connect(m_udp, SIGNAL(readyRead()), this, SLOT(process_udp()));
m_udp->writeDatagram(out, m_address, m_modeinfo.port);
#ifdef DEBUG
fprintf(stderr, "CONN: ");
for(int i = 0; i < out.size(); ++i){
fprintf(stderr, "%02x ", (uint8_t)out.data()[i]);
}
fprintf(stderr, "\n");
fflush(stderr);
#endif
if(m_debug){
QDebug debug = qDebug();
debug.noquote();
QString s = "CONN:";
for(int i = 0; i < out.size(); ++i){
s += " " + QString("%1").arg((uint8_t)out.data()[i], 2, 16, QChar('0'));
}
debug << s;
}
}
}
@ -261,14 +264,16 @@ void XRF::send_ping()
out.append(8 - m_modeinfo.callsign.size(), ' ');
out.append('\x00');
m_udp->writeDatagram(out, m_address, m_modeinfo.port);
#ifdef DEBUG
fprintf(stderr, "PING: ");
for(int i = 0; i < out.size(); ++i){
fprintf(stderr, "%02x ", (uint8_t)out.data()[i]);
}
fprintf(stderr, "\n");
fflush(stderr);
#endif
if(m_debug){
QDebug debug = qDebug();
debug.noquote();
QString s = "PING:";
for(int i = 0; i < out.size(); ++i){
s += " " + QString("%1").arg((uint8_t)out.data()[i], 2, 16, QChar('0'));
}
debug << s;
}
}
void XRF::send_disconnect()
@ -280,14 +285,16 @@ void XRF::send_disconnect()
out.append(' ');
out.append('\x00');
m_udp->writeDatagram(out, m_address, m_modeinfo.port);
#ifdef DEBUG
fprintf(stderr, "SEND: ");
for(int i = 0; i < out.size(); ++i){
fprintf(stderr, "%02x ", (uint8_t)out.data()[i]);
}
fprintf(stderr, "\n");
fflush(stderr);
#endif
if(m_debug){
QDebug debug = qDebug();
debug.noquote();
QString s = "DISC:";
for(int i = 0; i < out.size(); ++i){
s += " " + QString("%1").arg((uint8_t)out.data()[i], 2, 16, QChar('0'));
}
debug << s;
}
}
void XRF::format_callsign(QString &s)
@ -429,12 +436,12 @@ void XRF::send_frame(uint8_t *ambe)
txdata[15] = 0x00;
txdata[16] = 0x00;
txdata[17] = 0x00;
txdata.replace(18, 8, m_txrptr2.toLocal8Bit().data());
txdata.replace(26, 8, m_txrptr1.toLocal8Bit().data());
txdata.replace(34, 8, m_txurcall.toLocal8Bit().data());
txdata.replace(42, 8, m_txmycall.toLocal8Bit().data());
txdata.replace(50, 4, "AMBE");
CCRC::addCCITT161((uint8_t *)txdata.data() + 15, 41);
txdata.replace(18, 8, m_txrptr2.toLocal8Bit().data());
txdata.replace(26, 8, m_txrptr1.toLocal8Bit().data());
txdata.replace(34, 8, m_txurcall.toLocal8Bit().data());
txdata.replace(42, 8, m_txmycall.toLocal8Bit().data());
txdata.replace(50, 4, "AMBE");
CCRC::addCCITT161((uint8_t *)txdata.data() + 15, 41);
m_modeinfo.src = m_txmycall;
m_modeinfo.dst = m_txurcall;
@ -540,14 +547,16 @@ void XRF::send_frame(uint8_t *ambe)
m_udp->writeDatagram(txdata, m_address, m_modeinfo.port);
emit update_output_level(m_audio->level() * 2);
update(m_modeinfo);
#ifdef DEBUG
fprintf(stderr, "SEND:%d: ", txdata.size());
for(int i = 0; i < txdata.size(); ++i){
fprintf(stderr, "%02x ", (uint8_t)txdata.data()[i]);
}
fprintf(stderr, "\n");
fflush(stderr);
#endif
if(m_debug){
QDebug debug = qDebug();
debug.noquote();
QString s = "SEND:";
for(int i = 0; i < txdata.size(); ++i){
s += " " + QString("%1").arg((uint8_t)txdata.data()[i], 2, 16, QChar('0'));
}
debug << s;
}
}
void XRF::get_ambe()

@ -24,7 +24,6 @@
#include <iostream>
#include <cstring>
//#define DEBUG
const uint32_t IMBE_INTERLEAVE[] = {
0, 7, 12, 19, 24, 31, 36, 43, 48, 55, 60, 67, 72, 79, 84, 91, 96, 103, 108, 115, 120, 127, 132, 139,
@ -114,21 +113,24 @@ YSF::~YSF()
void YSF::process_udp()
{
QByteArray buf;
QByteArray out;
QByteArray out;
QHostAddress sender;
quint16 senderPort;
char ysftag[11];
buf.resize(m_udp->pendingDatagramSize());
int p = 5000;
m_udp->readDatagram(buf.data(), buf.size(), &sender, &senderPort);
#ifdef DEBUG
fprintf(stderr, "RECV: ");
for(int i = 0; i < buf.size(); ++i){
fprintf(stderr, "%02x ", (uint8_t)buf.data()[i]);
}
fprintf(stderr, "\n");
fflush(stderr);
#endif
if(m_debug){
QDebug debug = qDebug();
debug.noquote();
QString s = "RECV:";
for(int i = 0; i < buf.size(); ++i){
s += " " + QString("%1").arg((uint8_t)buf.data()[i], 2, 16, QChar('0'));
}
debug << s;
}
if(((buf.size() == 14) && (m_refname.left(3) != "FCS")) || ((buf.size() == 7) && (m_refname.left(3) == "FCS"))){
if(m_modeinfo.status == CONNECTING){
m_modeinfo.status = CONNECTED_RW;
@ -287,14 +289,16 @@ void YSF::hostname_lookup(QHostInfo i)
m_udp = new QUdpSocket(this);
connect(m_udp, SIGNAL(readyRead()), this, SLOT(process_udp()));
m_udp->writeDatagram(out, m_address, m_modeinfo.port);
#ifdef DEBUG
fprintf(stderr, "CONN: ");
for(int i = 0; i < out.size(); ++i){
fprintf(stderr, "%02x ", (uint8_t)out.data()[i]);
}
fprintf(stderr, "\n");
fflush(stderr);
#endif
if(m_debug){
QDebug debug = qDebug();
debug.noquote();
QString s = "CONN:";
for(int i = 0; i < out.size(); ++i){
s += " " + QString("%1").arg((uint8_t)out.data()[i], 2, 16, QChar('0'));
}
debug << s;
}
}
}
@ -320,14 +324,16 @@ void YSF::send_ping()
out.append(10 - m_modeinfo.callsign.size(), ' ');
}
m_udp->writeDatagram(out, m_address, m_modeinfo.port);
#ifdef DEBUG
fprintf(stderr, "PING: ");
for(int i = 0; i < out.size(); ++i){
fprintf(stderr, "%02x ", (uint8_t)out.data()[i]);
}
fprintf(stderr, "\n");
fflush(stderr);
#endif
if(m_debug){
QDebug debug = qDebug();
debug.noquote();
QString s = "PING:";
for(int i = 0; i < out.size(); ++i){
s += " " + QString("%1").arg((uint8_t)out.data()[i], 2, 16, QChar('0'));
}
debug << s;
}
}
void YSF::send_disconnect()
@ -350,14 +356,16 @@ void YSF::send_disconnect()
out.append(10 - m_modeinfo.callsign.size(), ' ');
}
m_udp->writeDatagram(out, m_address, m_modeinfo.port);
#ifdef DEBUG
fprintf(stderr, "SEND: ");
for(int i = 0; i < out.size(); ++i){
fprintf(stderr, "%02x ", (uint8_t)out.data()[i]);
}
fprintf(stderr, "\n");
fflush(stderr);
#endif
if(m_debug){
QDebug debug = qDebug();
debug.noquote();
QString s = "DISC:";
for(int i = 0; i < out.size(); ++i){
s += " " + QString("%1").arg((uint8_t)out.data()[i], 2, 16, QChar('0'));
}
debug << s;
}
}
void YSF::decode_header(uint8_t* data)
@ -687,14 +695,16 @@ void YSF::process_modem_data(QByteArray d)
++m_txcnt;
m_udp->writeDatagram(d, m_address, m_modeinfo.port);
qDebug() << "Sending modem to network.....................................................";
#ifdef DEBUG
fprintf(stderr, "SEND:%d: ", d.size());
for(int i = 0; i < d.size(); ++i){
fprintf(stderr, "%02x ", (uint8_t)d.data()[i]);
}
fprintf(stderr, "\n");
fflush(stderr);
#endif
if(m_debug){
QDebug debug = qDebug();
debug.noquote();
QString s = "SEND:";
for(int i = 0; i < d.size(); ++i){
s += " " + QString("%1").arg((uint8_t)d.data()[i], 2, 16, QChar('0'));
}
debug << s;
}
}
void YSF::transmit()
@ -781,14 +791,16 @@ void YSF::send_frame()
txdata.append((char *)m_ysfFrame, frame_size);
m_udp->writeDatagram(txdata, m_address, m_modeinfo.port);
++m_txcnt;
#ifdef DEBUG
fprintf(stderr, "SEND:%d: ", txdata.size());
for(int i = 0; i < txdata.size(); ++i){
fprintf(stderr, "%02x ", (uint8_t)txdata.data()[i]);
}
fprintf(stderr, "\n");
fflush(stderr);
#endif
if(m_debug){
QDebug debug = qDebug();
debug.noquote();
QString s = "SEND:";
for(int i = 0; i < txdata.size(); ++i){
s += " " + QString("%1").arg((uint8_t)txdata.data()[i], 2, 16, QChar('0'));
}
debug << s;
}
}
else{
fprintf(stderr, "YSF TX stopped\n");

Loading…
Cancel
Save