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

main
Doug McLain 2 years ago
parent f050489a92
commit 6d73e2eb4d

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

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

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

@ -174,13 +174,13 @@ void DroidStar::file_downloaded(QString filename)
emit update_log("Updated " + filename); emit update_log("Updated " + filename);
{ {
if(filename == "dplus.txt" && m_protocol == "REF"){ if(filename == "dplus.txt" && m_protocol == "REF"){
process_ref_hosts(); process_dstar_hosts(m_protocol);
} }
else if(filename == "dextra.txt" && m_protocol == "XRF"){ else if(filename == "dextra.txt" && m_protocol == "XRF"){
process_xrf_hosts(); process_dstar_hosts(m_protocol);
} }
else if(filename == "dcs.txt" && m_protocol == "DCS"){ else if(filename == "dcs.txt" && m_protocol == "DCS"){
process_dcs_hosts(); process_dstar_hosts(m_protocol);
} }
else if(filename == "YSFHosts.txt" && m_protocol == "YSF"){ else if(filename == "YSFHosts.txt" && m_protocol == "YSF"){
process_ysf_hosts(); process_ysf_hosts();
@ -344,7 +344,16 @@ void DroidStar::process_connect()
m_mode = Mode::create_mode(m_protocol); m_mode = Mode::create_mode(m_protocol);
m_modethread = new QThread; m_modethread = new QThread;
m_mode->moveToThread(m_modethread); m_mode->moveToThread(m_modethread);
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->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_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); 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(slot_changed(int)), m_mode, SLOT(slot_changed(int)));
connect(this, SIGNAL(cc_changed(int)), m_mode, SLOT(cc_changed(int))); connect(this, SIGNAL(cc_changed(int)), m_mode, SLOT(cc_changed(int)));
emit dmr_tgid_changed(m_dmr_destid); emit dmr_tgid_changed(m_dmr_destid);
emit dmrpc_state_changed(m_pc);
} }
if(m_protocol == "M17"){ 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(); m_modethread->start();
} }
@ -462,26 +467,8 @@ void DroidStar::process_host_change(const QString &h)
void DroidStar::process_mode_change(const QString &m) void DroidStar::process_mode_change(const QString &m)
{ {
m_protocol = m; m_protocol = m;
if(m == "REF"){ if((m == "REF") || (m == "DCS") || (m == "XRF")){
process_ref_hosts(); 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 == "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_label1 = "MYCALL";
m_label2 = "URCALL"; m_label2 = "URCALL";
m_label3 = "RPTR1"; m_label3 = "RPTR1";
@ -697,96 +684,28 @@ void DroidStar::update_custom_hosts(QString h)
m_localhosts = m_settings->value("LOCALHOSTS").toString(); m_localhosts = m_settings->value("LOCALHOSTS").toString();
} }
void DroidStar::process_ref_hosts() void DroidStar::process_dstar_hosts(QString m)
{
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_hostmap.clear();
m_hostsmodel.clear(); m_hostsmodel.clear();
QFileInfo check_file(config_path + "/dcs.txt"); QString filename, port;
if(check_file.exists() && check_file.isFile()){ if(m == "REF"){
QFile f(config_path + "/dcs.txt"); filename = "dplus.txt";
if(f.open(QIODevice::ReadOnly)){ port = "20001";
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";
}
} }
else if(m == "DCS"){
m_customhosts = m_localhosts.split('\n'); filename = "dcs.txt";
for (const auto& i : qAsConst(m_customhosts)){ port = "30051";
QStringList line = i.simplified().split(' ');
if(line.at(0) == "DCS"){
m_hostmap[line.at(1).simplified()] = line.at(2).simplified() + "," + line.at(3).simplified();
} }
else if(m == "XRF"){
filename = "dextra.txt";
port = "30001";
} }
QMap<QString, QString>::const_iterator i = m_hostmap.constBegin(); QFileInfo check_file(config_path + "/" + filename);
while (i != m_hostmap.constEnd()) {
m_hostsmodel.append(i.key());
++i;
}
}
f.close();
}
else{
download_file("/dcs.txt");
}
}
void DroidStar::process_xrf_hosts()
{
m_hostmap.clear();
m_hostsmodel.clear();
QFileInfo check_file(config_path + "/dextra.txt");
if(check_file.exists() && check_file.isFile()){ if(check_file.exists() && check_file.isFile()){
QFile f(config_path + "/dextra.txt"); QFile f(config_path + "/" + filename);
if(f.open(QIODevice::ReadOnly)){ if(f.open(QIODevice::ReadOnly)){
while(!f.atEnd()){ while(!f.atEnd()){
QString l = f.readLine(); QString l = f.readLine();
@ -795,7 +714,7 @@ void DroidStar::process_xrf_hosts()
} }
QStringList ll = l.split('\t'); QStringList ll = l.split('\t');
if(ll.size() > 1){ if(ll.size() > 1){
m_hostmap[ll.at(0).simplified()] = ll.at(1).simplified() + ",30001"; m_hostmap[ll.at(0).simplified()] = ll.at(1).simplified() + "," + port;
} }
} }
@ -803,7 +722,7 @@ void DroidStar::process_xrf_hosts()
for (const auto& i : qAsConst(m_customhosts)){ for (const auto& i : qAsConst(m_customhosts)){
QStringList line = i.simplified().split(' '); QStringList line = i.simplified().split(' ');
if(line.at(0) == "XRF"){ if(line.at(0) == m){
m_hostmap[line.at(1).simplified()] = line.at(2).simplified() + "," + line.at(3).simplified(); m_hostmap[line.at(1).simplified()] = line.at(2).simplified() + "," + line.at(3).simplified();
} }
} }
@ -817,7 +736,7 @@ void DroidStar::process_xrf_hosts()
f.close(); f.close();
} }
else{ else{
download_file("/dextra.txt"); download_file("/" + filename);
} }
} }
@ -856,7 +775,6 @@ void DroidStar::process_ysf_hosts()
} }
} }
f.close(); f.close();
//process_fcs_rooms();
} }
else{ else{
download_file("/YSFHosts.txt"); download_file("/YSFHosts.txt");

@ -90,7 +90,7 @@ public slots:
void set_swid(const QString &swid){ m_swid = swid; 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_pkgid(const QString &pkgid){ m_pkgid = pkgid; save_settings(); }
void set_dmr_options(const QString &dmropts) { m_dmropts = dmropts; 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_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_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_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(); } void set_protocol(const QString &protocol) { m_protocol = protocol; save_settings(); }
@ -102,8 +102,8 @@ public slots:
void set_iaxhost(const QString &host){ m_iaxhost = host; 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_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_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_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); } 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_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_txtimeout(const QString &t) { m_txtimeout = t.simplified().toUInt(); save_settings();}
void set_toggletx(bool x) { m_toggletx = x; save_settings(); } void set_toggletx(bool x) { m_toggletx = x; save_settings(); }
@ -279,6 +279,7 @@ private:
QString m_swid; QString m_swid;
QString m_pkgid; QString m_pkgid;
QString m_dmropts; QString m_dmropts;
int m_pc;
QString m_saved_refhost; QString m_saved_refhost;
QString m_saved_dcshost; QString m_saved_dcshost;
QString m_saved_xrfhost; QString m_saved_xrfhost;
@ -381,9 +382,7 @@ private slots:
void keepScreenOn(); void keepScreenOn();
#endif #endif
void discover_devices(); void discover_devices();
void process_ref_hosts(); void process_dstar_hosts(QString);
void process_dcs_hosts();
void process_xrf_hosts();
void process_ysf_hosts(); void process_ysf_hosts();
void process_fcs_rooms(); void process_fcs_rooms();
void process_dmr_hosts(); void process_dmr_hosts();

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

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

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

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

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

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

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

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

Loading…
Cancel
Save