More work on dstar gps decoding

main
Doug McLain 1 year ago
parent 772ae5acbe
commit 74637287fd

@ -336,7 +336,8 @@ void DroidStar::process_connect()
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);
connect(this, SIGNAL(module_changed(char)), m_mode, SLOT(module_changed(char)));
connect(m_mode, SIGNAL(update(Mode::MODEINFO)), this, SLOT(update_data(Mode::MODEINFO)));
connect(m_mode, SIGNAL(update(Mode::MODEINFO)), this, SLOT(update_data(Mode::MODEINFO)));
connect(m_mode, SIGNAL(update_log(QString)), this, SLOT(updatelog(QString)));
connect(m_mode, SIGNAL(update_output_level(unsigned short)), this, SLOT(update_output_level(unsigned short)));
connect(m_modethread, SIGNAL(started()), m_mode, SLOT(begin_connect()));
connect(m_modethread, SIGNAL(finished()), m_mode, SLOT(deleteLater()));
@ -1341,7 +1342,12 @@ void DroidStar::update_data(Mode::MODEINFO info)
emit update_log(t + " " + m_protocol + " RX lost id: " + QString::number(info.streamid, 16) + " src: " + info.src + " dst: " + info.gw2);
}
}
emit update_data();
emit update_data();
}
void DroidStar::updatelog(QString s)
{
emit update_log(s);
}
void DroidStar::set_input_volume(qreal v)

@ -394,6 +394,7 @@ private slots:
void process_dmr_ids();
void process_nxdn_ids();
void update_data(Mode::MODEINFO);
void updatelog(QString);
void save_settings();
void update_output_level(unsigned short l){ m_outlevel = l;}
//void load_md380_fw();

@ -511,6 +511,7 @@ ApplicationWindow {
mainTab.buttonTX.enabled = true;
mainTab.btntxt.color = "black";
mainTab.agcBox.checked = true;
droidstar.set_debug(settingsTab.debugBox.checked);
}
if(c === 3){
}

@ -98,6 +98,7 @@ public:
QString mmdvm;
QString host;
QString module;
QString gps;
int port;
bool path;
char type;
@ -131,6 +132,7 @@ public:
};
signals:
void update(Mode::MODEINFO);
void update_log(QString);
void update_output_level(unsigned short);
protected slots:
virtual void send_disconnect(){}

@ -44,10 +44,13 @@ void REF::process_udp()
quint16 senderPort;
static bool sd_sync = 0;
static int sd_txt_seq = 0;
static int sd_gps_seq = 0;
static int sd_gps_cnt = 0;
static int sd_hdr_cnt = 0;
static int sd_debug_cnt = 0;
static char user_data[21];
static char gps_data[100];
static QByteArray gps_data;
static uint8_t debug_data[64];
const uint8_t header[5] = {0x80,0x44,0x53,0x56,0x54};
buf.resize(m_udp->pendingDatagramSize());
@ -177,6 +180,8 @@ void REF::process_udp()
qDebug() << "New stream from " << m_modeinfo.src << " to " << m_modeinfo.dst << " id == " << QString::number(m_modeinfo.streamid, 16);
emit update(m_modeinfo);
sd_gps_cnt = 0;
gps_data.clear();
}
}
else{
@ -203,61 +208,82 @@ void REF::process_udp()
if((buf.data()[16] == 0) && (buf.data()[26] == 0x55) && (buf.data()[27] == 0x2d) && (buf.data()[28] == 0x16)){
sd_sync = 1;
sd_txt_seq = 1;
//sd_debug_cnt = 0;
//for(int i = 0; i < 63; i++){
// fprintf(stderr, "%02x ", debug_data[i]);
//}
// fprintf(stderr, "\n");
}
if( sd_sync && (buf.data()[26] & 0xf0) == 0x40){
sd_gps_cnt = (buf.data()[26] & 0x0f);
gps_data[sd_gps_seq] = buf.data()[27] ^ 0x4f;
//debug_data[sd_debug_cnt++] = buf.data()[26] ^ 0x70;
//debug_data[sd_debug_cnt++] = buf.data()[27] ^ 0x4f;
//debug_data[sd_debug_cnt++] = buf.data()[28] ^ 0x93;
char c = buf.data()[26] ^ 0x70;
if( (gps_data[sd_gps_seq] == 0x0a) || (gps_data[sd_gps_seq] == 0x0d) ){
gps_data[sd_gps_seq] = '\0';
sd_gps_seq = 0;
if( sd_sync && !sd_gps_cnt && ((c & 0xf0) == 0x50)){
sd_hdr_cnt = (c & 0x0f);
}
else if(sd_hdr_cnt){
c = 0;
sd_hdr_cnt = 0;
}
if( sd_sync && !sd_gps_cnt && ((c & 0xf0) == 0x30)){
sd_gps_cnt = (c & 0x0f);
c = buf.data()[27] ^ 0x4f;
if( (c == 0x0a) || (c == 0x0d) ){
gps_data.append('\0');
sd_gps_cnt = 0;
qDebug() << "GPS string: " << QString(gps_data);
QTextStream(stderr) << "GPS: " << QString(gps_data) << Qt::endl;
if(gps_data[0] == '$') emit update_log("GPS: " + QString(gps_data));
gps_data.clear();
}
else{
sd_gps_seq++;
sd_gps_cnt--;
gps_data[sd_gps_seq] = buf.data()[28] ^ 0x93;
if( (gps_data[sd_gps_seq] == 0x0a) || (gps_data[sd_gps_seq] == 0x0d) ){
gps_data[sd_gps_seq] = '\0';
sd_gps_seq = 0;
gps_data.append(c);
c = buf.data()[28] ^ 0x93;
if( (c == 0x0a) || (c == 0x0d) ){
gps_data.append('\0');
sd_gps_cnt = 0;
qDebug() << "GPS string: " << QString(gps_data);
QTextStream(stderr) << "GPS: " << QString(gps_data) << Qt::endl;
if(gps_data[0] == '$') emit update_log("GPS: " + QString(gps_data));
gps_data.clear();
}
else{
sd_gps_seq++;
sd_gps_cnt--;
gps_data.append(c);
}
}
}
else if(sd_gps_cnt){
gps_data[sd_gps_seq] = buf.data()[26] ^ 0x70;
if( (gps_data[sd_gps_seq] == 0x0a) || (gps_data[sd_gps_seq] == 0x0d) ){
gps_data[sd_gps_seq] = '\0';
sd_gps_seq = 0;
else if(sd_gps_cnt && (buf.data()[16] != 0)){
if( (c == 0x0a) || (c == 0x0d) ){
gps_data.append('\0');
sd_gps_cnt = 0;
qDebug() << "GPS string: " << QString(gps_data);
QTextStream(stderr) << "GPS: " << QString(gps_data) << Qt::endl;
if(gps_data[0] == '$') emit update_log("GPS: " + QString(gps_data));
gps_data.clear();
}
else{
sd_gps_seq++;
gps_data[sd_gps_seq] = buf.data()[27] ^ 0x4f;
if( (gps_data[sd_gps_seq] == 0x0a) || (gps_data[sd_gps_seq] == 0x0d) ){
gps_data[sd_gps_seq] = '\0';
sd_gps_seq = 0;
gps_data.append(c);
c = buf.data()[27] ^ 0x4f;
if( (c == 0x0a) || (c == 0x0d) ){
gps_data.append('\0');
sd_gps_cnt = 0;
qDebug() << "GPS string: " << QString(gps_data);
QTextStream(stderr) << "GPS: " << QString(gps_data) << Qt::endl;
if(gps_data[0] == '$') emit update_log("GPS: " + QString(gps_data));
gps_data.clear();
}
else{
sd_gps_seq++;
gps_data[sd_gps_seq] = buf.data()[28] ^ 0x93;
if( (gps_data[sd_gps_seq] == 0x0a) || (gps_data[sd_gps_seq] == 0x0d) ){
gps_data[sd_gps_seq] = '\0';
sd_gps_seq = 0;
gps_data.append(c);
c = buf.data()[28] ^ 0x93;
if( (c == 0x0a) || (c == 0x0d) ){
gps_data.append('\0');
sd_gps_cnt = 0;
qDebug() << "GPS string: " << QString(gps_data);
QTextStream(stderr) << "GPS: " << QString(gps_data) << Qt::endl;
if(gps_data[0] == '$') emit update_log("GPS: " + QString(gps_data));
gps_data.clear();
}
else{
sd_gps_seq++;
gps_data.append(c);
}
}
}
@ -306,7 +332,6 @@ void REF::process_udp()
user_data[18] = buf.data()[27] ^ 0x4f;
user_data[19] = buf.data()[28] ^ 0x93;
user_data[20] = '\0';
//if(sd_gps_seq == 0) sd_sync = 0;
sd_txt_seq = 0;
m_modeinfo.usertxt = QString(user_data);
}
@ -331,6 +356,7 @@ void REF::process_udp()
emit update(m_modeinfo);
m_modeinfo.streamid = 0;
sd_sync = 0;
sd_gps_cnt = 0;
}
}
//emit update(m_modeinfo);

Loading…
Cancel
Save