Fix MMDVM rx/tx offset settings, Add MMDVM protocol 2 support, add MMDVM baud setting, add M17 CAN setting for TX (still receives all CAN for now), twaek mic gain slider width, other code cleanups

pull/3/head
Doug McLain 3 years ago
parent 514c03655d
commit ae438466ac

@ -9,6 +9,7 @@ LIBS += -limbe_vocoder
win32:QT += serialport win32:QT += serialport
win32:INCLUDEPATH += /mnt/data/src/mxe/usr/include win32:INCLUDEPATH += /mnt/data/src/mxe/usr/include
win32:LIBS += -L/mnt/data/src/mxe/usr/lib64 win32:LIBS += -L/mnt/data/src/mxe/usr/lib64
#win32:LIBS += -L/mnt/data/src/mxe/usr/lib -lws2_32
win32:QMAKE_LFLAGS += -static win32:QMAKE_LFLAGS += -static
QMAKE_LFLAGS_WINDOWS += --enable-stdcall-fixup QMAKE_LFLAGS_WINDOWS += --enable-stdcall-fixup
RC_ICONS = images/droidstar.ico RC_ICONS = images/droidstar.ico
@ -24,6 +25,7 @@ VERSION_BUILD='$(shell cd $$PWD;git rev-parse --short HEAD)'
DEFINES += VERSION_NUMBER=\"\\\"$${VERSION_BUILD}\\\"\" DEFINES += VERSION_NUMBER=\"\\\"$${VERSION_BUILD}\\\"\"
DEFINES += QT_DEPRECATED_WARNINGS DEFINES += QT_DEPRECATED_WARNINGS
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
DEFINES += VOCODER_PLUGIN
#DEFINES += USE_FLITE #DEFINES += USE_FLITE
HEADERS += \ HEADERS += \

@ -23,8 +23,6 @@ import QtQuick.Controls 2.3
Item { Item {
id: mainTab id: mainTab
//property int rows: 18;
//property bool tts: false;
property int rows: { property int rows: {
if(USE_FLITE){ if(USE_FLITE){
rows = 20; rows = 20;
@ -75,6 +73,7 @@ Item {
property alias comboSlot: _comboSlot property alias comboSlot: _comboSlot
property alias comboCC: _comboCC property alias comboCC: _comboCC
property alias dmrtgidEdit: _dmrtgidEdit property alias dmrtgidEdit: _dmrtgidEdit
property alias comboM17CAN: _comboM17CAN
property alias privateBox: _privateBox property alias privateBox: _privateBox
property alias connectbutton: _connectbutton property alias connectbutton: _connectbutton
property alias sliderMicGain: _slidermicGain property alias sliderMicGain: _slidermicGain
@ -128,7 +127,6 @@ Item {
} }
} }
} }
ComboBox { ComboBox {
id: _comboMode id: _comboMode
property bool loaded: false property bool loaded: false
@ -184,7 +182,6 @@ Item {
} }
} }
ComboBox { ComboBox {
id: _comboCC id: _comboCC
x: (parent.width * 2 / 5 ) x: (parent.width * 2 / 5 )
@ -261,7 +258,7 @@ Item {
droidstar.set_modemYSFTxLevel(settingsTab.modemYSFTXLevelEdit.text); droidstar.set_modemYSFTxLevel(settingsTab.modemYSFTXLevelEdit.text);
droidstar.set_modemP25TxLevel(settingsTab.modemYSFTXLevelEdit.text); droidstar.set_modemP25TxLevel(settingsTab.modemYSFTXLevelEdit.text);
droidstar.set_modemNXDNTxLevel(settingsTab.modemNXDNTXLevelEdit.text); droidstar.set_modemNXDNTxLevel(settingsTab.modemNXDNTXLevelEdit.text);
droidstar.set_modemBaud(settingsTab.modemBaudEdit.text);
droidstar.process_connect(); droidstar.process_connect();
} }
} }
@ -322,7 +319,6 @@ Item {
//console.log("screen size ", parent.width, " x ", parent.height); //console.log("screen size ", parent.width, " x ", parent.height);
} }
} }
TextField { TextField {
id: _editIAXDTMF id: _editIAXDTMF
x: (parent.width / 4) x: (parent.width / 4)
@ -360,7 +356,7 @@ Item {
id: _dmrtgidEdit id: _dmrtgidEdit
x: parent.width / 5 x: parent.width / 5
y: (parent.height / rows + 1) * 2 y: (parent.height / rows + 1) * 2
width: parent.width /5 width: parent.width / 5
height: parent.height / rows height: parent.height / rows
font.pixelSize: parent.height / 35 font.pixelSize: parent.height / 35
selectByMouse: true selectByMouse: true
@ -370,6 +366,27 @@ Item {
droidstar.tgid_text_changed(dmrtgidEdit.text) droidstar.tgid_text_changed(dmrtgidEdit.text)
} }
} }
ComboBox {
visible: false
id: _comboM17CAN
x: parent.width / 5
y: (parent.height / rows + 1) * 2
width: parent.width / 5
height: parent.height / rows;
font.pixelSize: parent.height / 35
currentIndex: 0
model: ["0", "1", "2", "3", "4", "5", "6", "7"]
contentItem: Text {
text: _comboM17CAN.displayText
font: _comboM17CAN.font
leftPadding: 10
verticalAlignment: Text.AlignVCenter
color: _comboM17CAN.enabled ? "white" : "darkgrey"
}
onCurrentTextChanged: {
droidstar.set_modemM17CAN(_comboM17CAN.currentText);
}
}
CheckBox { CheckBox {
id: _swtxBox id: _swtxBox
@ -383,7 +400,6 @@ Item {
droidstar.set_swtx(_swtxBox.checked) droidstar.set_swtx(_swtxBox.checked)
} }
} }
CheckBox { CheckBox {
id: _swrxBox id: _swrxBox
x: (parent.width * 3 / 5) + 5 x: (parent.width * 3 / 5) + 5
@ -423,9 +439,9 @@ Item {
Slider { Slider {
visible: true visible: true
id: _slidermicGain id: _slidermicGain
x: parent.width / 4 x: (parent.width / 4) + 10
y: (parent.height / rows + 1) * 3; y: (parent.height / rows + 1) * 3;
width: (parent.width * 3 / 4) - 10 width: (parent.width * 3 / 4) - 20
height: parent.height / rows; height: parent.height / rows;
value: 0.5 value: 0.5
onValueChanged: { onValueChanged: {
@ -442,7 +458,6 @@ Item {
color: "white" color: "white"
font.pixelSize: parent.height / 30; font.pixelSize: parent.height / 30;
} }
Text { Text {
id: _label2 id: _label2
x: 10 x: 10

@ -69,13 +69,14 @@ Item {
property alias modemYSFTXLevelEdit: _modemYSFTXLevelEdit property alias modemYSFTXLevelEdit: _modemYSFTXLevelEdit
property alias modemP25TXLevelEdit: _modemP25TXLevelEdit property alias modemP25TXLevelEdit: _modemP25TXLevelEdit
property alias modemNXDNTXLevelEdit: _modemNXDNTXLevelEdit property alias modemNXDNTXLevelEdit: _modemNXDNTXLevelEdit
property alias modemBaudEdit: _modemBaudEdit
Flickable { Flickable {
id: flickable id: flickable
anchors.fill: parent anchors.fill: parent
contentWidth: parent.width contentWidth: parent.width
contentHeight: _modemNXDNTXLevelLabel.y + contentHeight: _modemBaudLabel.y +
_modemNXDNTXLevelLabel.height + 10 _modemBaudLabel.height + 10
flickableDirection: Flickable.VerticalFlick flickableDirection: Flickable.VerticalFlick
clip: true clip: true
ScrollBar.vertical: ScrollBar {} ScrollBar.vertical: ScrollBar {}
@ -1047,6 +1048,24 @@ Item {
selectByMouse: true selectByMouse: true
inputMethodHints: "ImhPreferNumbers" inputMethodHints: "ImhPreferNumbers"
} }
Text {
id: _modemBaudLabel
x: 10
y: 1330
width: 100
height: 25
text: qsTr("Baud")
color: "white"
verticalAlignment: Text.AlignVCenter
}
TextField {
id: _modemBaudEdit
x: _modemBaudLabel.x + _modemBaudLabel.width
y: _modemBaudLabel.y
width: 60
height: 25
selectByMouse: true
inputMethodHints: "ImhPreferNumbers"
}
} }
} }

@ -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="61" android:installLocation="auto"> <manifest package="org.dudetronics.droidstar" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="-- %%INSERT_VERSION_NAME%% --" android:versionCode="63" android:installLocation="auto">
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="30"/> <uses-sdk android:minSdkVersion="21" android:targetSdkVersion="30"/>
<!-- 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.

@ -36,8 +36,9 @@ public:
Codec(QString callsign, char module, QString hostname, QString host, int port, bool ipv6, QString vocoder, QString modem, QString audioin, QString audioout); Codec(QString callsign, char module, QString hostname, QString host, int port, bool ipv6, QString vocoder, QString modem, QString audioin, QString audioout);
~Codec(); ~Codec();
void set_modem_flags(bool rxInvert, bool txInvert, bool pttInvert, bool useCOSAsLockout, bool duplex) { m_rxInvert = rxInvert; m_txInvert = txInvert; m_pttInvert = pttInvert; m_useCOSAsLockout = useCOSAsLockout; m_duplex = duplex; } void set_modem_flags(bool rxInvert, bool txInvert, bool pttInvert, bool useCOSAsLockout, bool duplex) { m_rxInvert = rxInvert; m_txInvert = txInvert; m_pttInvert = pttInvert; m_useCOSAsLockout = useCOSAsLockout; m_duplex = duplex; }
void set_modem_params(uint32_t rxfreq, uint32_t txfreq, uint32_t txDelay, float rxLevel, float rfLevel, uint32_t ysfTXHang, float cwIdTXLevel, float dstarTXLevel, float dmrTXLevel, float ysfTXLevel, float p25TXLevel, float nxdnTXLevel, float pocsagTXLevel, float m17TXLevel) void set_modem_params(uint32_t baud, uint32_t rxfreq, uint32_t txfreq, uint32_t txDelay, float rxLevel, float rfLevel, uint32_t ysfTXHang, float cwIdTXLevel, float dstarTXLevel, float dmrTXLevel, float ysfTXLevel, float p25TXLevel, float nxdnTXLevel, float pocsagTXLevel, float m17TXLevel)
{ {
m_baud = baud;
m_rxfreq = rxfreq; m_rxfreq = rxfreq;
m_txfreq = txfreq; m_txfreq = txfreq;
m_txDelay = txDelay; m_txDelay = txDelay;
@ -181,6 +182,7 @@ protected:
bool m_hwtx; bool m_hwtx;
bool m_ipv6; bool m_ipv6;
uint32_t m_baud;
uint32_t m_rxfreq; uint32_t m_rxfreq;
uint32_t m_txfreq; uint32_t m_txfreq;
uint32_t m_dmrColorCode; uint32_t m_dmrColorCode;

@ -80,7 +80,7 @@ void DCSCodec::process_udp()
if(m_modemport != ""){ if(m_modemport != ""){
m_modem = new SerialModem("DCS"); m_modem = new SerialModem("DCS");
m_modem->set_modem_flags(m_rxInvert, m_txInvert, m_pttInvert, m_useCOSAsLockout, m_duplex); m_modem->set_modem_flags(m_rxInvert, m_txInvert, m_pttInvert, m_useCOSAsLockout, m_duplex);
m_modem->set_modem_params(m_rxfreq, m_txfreq, m_txDelay, m_rxLevel, m_rfLevel, m_ysfTXHang, m_cwIdTXLevel, m_dstarTXLevel, m_dmrTXLevel, m_ysfTXLevel, m_p25TXLevel, m_nxdnTXLevel, m_pocsagTXLevel, m_m17TXLevel); m_modem->set_modem_params(m_baud, m_rxfreq, m_txfreq, m_txDelay, m_rxLevel, m_rfLevel, m_ysfTXHang, m_cwIdTXLevel, m_dstarTXLevel, m_dmrTXLevel, m_ysfTXLevel, m_p25TXLevel, m_nxdnTXLevel, m_pocsagTXLevel, m_m17TXLevel);
m_modem->connect_to_serial(m_modemport); m_modem->connect_to_serial(m_modemport);
connect(m_modem, SIGNAL(connected(bool)), this, SLOT(mmdvm_connect_status(bool))); connect(m_modem, SIGNAL(connected(bool)), this, SLOT(mmdvm_connect_status(bool)));
connect(m_modem, SIGNAL(modem_data_ready(QByteArray)), this, SLOT(process_modem_data(QByteArray))); connect(m_modem, SIGNAL(modem_data_ready(QByteArray)), this, SLOT(process_modem_data(QByteArray)));

@ -24,7 +24,7 @@
#include "CRCenc.h" #include "CRCenc.h"
#include "MMDVMDefines.h" #include "MMDVMDefines.h"
#define DEBUG //#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,
@ -327,7 +327,7 @@ void DMRCodec::setup_connection()
if(m_modemport != ""){ if(m_modemport != ""){
m_modem = new SerialModem("DMR"); m_modem = new SerialModem("DMR");
m_modem->set_modem_flags(m_rxInvert, m_txInvert, m_pttInvert, m_useCOSAsLockout, m_duplex); m_modem->set_modem_flags(m_rxInvert, m_txInvert, m_pttInvert, m_useCOSAsLockout, m_duplex);
m_modem->set_modem_params(m_rxfreq, m_txfreq, m_txDelay, m_rxLevel, m_rfLevel, m_ysfTXHang, m_cwIdTXLevel, m_dstarTXLevel, m_dmrTXLevel, m_ysfTXLevel, m_p25TXLevel, m_nxdnTXLevel, m_pocsagTXLevel, m_m17TXLevel); m_modem->set_modem_params(m_baud, m_rxfreq, m_txfreq, m_txDelay, m_rxLevel, m_rfLevel, m_ysfTXHang, m_cwIdTXLevel, m_dstarTXLevel, m_dmrTXLevel, m_ysfTXLevel, m_p25TXLevel, m_nxdnTXLevel, m_pocsagTXLevel, m_m17TXLevel);
m_modem->connect_to_serial(m_modemport); m_modem->connect_to_serial(m_modemport);
connect(m_modem, SIGNAL(connected(bool)), this, SLOT(mmdvm_connect_status(bool))); connect(m_modem, SIGNAL(connected(bool)), this, SLOT(mmdvm_connect_status(bool)));
connect(m_modem, SIGNAL(modem_data_ready(QByteArray)), this, SLOT(process_modem_data(QByteArray))); connect(m_modem, SIGNAL(modem_data_ready(QByteArray)), this, SLOT(process_modem_data(QByteArray)));

@ -320,20 +320,22 @@ void DroidStar::process_connect()
modem = ml.at(1); modem = ml.at(1);
} }
const bool rxInvert = true; const bool txInvert = true;
const bool txInvert = false; const bool rxInvert = false;
const bool pttInvert = false; const bool pttInvert = false;
const bool useCOSAsLockout = 0; const bool useCOSAsLockout = 0;
const uint32_t ysfTXHang = 4; const uint32_t ysfTXHang = 4;
const float pocsagTXLevel = 50; const float pocsagTXLevel = 50;
const float m17TXLevel = 50; const float m17TXLevel = 50;
const bool duplex = m_modemRxFreq.toUInt() != m_modemTxFreq.toUInt(); const bool duplex = m_modemRxFreq.toUInt() != m_modemTxFreq.toUInt();
const int rxfreq = m_modemRxFreq.toInt() + m_modemRxOffset.toInt();
const int txfreq = m_modemTxFreq.toInt() + m_modemTxOffset.toInt();
emit update_log("Connecting to " + m_hostname + ":" + QString::number(m_port) + "..."); emit update_log("Connecting to " + m_hostname + ":" + QString::number(m_port) + "...");
if( (m_protocol == "REF") || ((m_protocol == "XRF") && m_xrf2ref) ){ if( (m_protocol == "REF") || ((m_protocol == "XRF") && m_xrf2ref) ){
m_ref = new REFCodec(m_callsign, m_host, m_module, m_hostname, 20001, false, vocoder, modem, m_playback, m_capture); m_ref = new REFCodec(m_callsign, m_host, m_module, m_hostname, 20001, false, vocoder, modem, m_playback, m_capture);
m_ref->set_modem_flags(rxInvert, txInvert, pttInvert, useCOSAsLockout, duplex); m_ref->set_modem_flags(rxInvert, txInvert, pttInvert, useCOSAsLockout, duplex);
m_ref->set_modem_params(m_modemRxFreq.toInt(), m_modemTxFreq.toInt(), 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_ref->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_modethread = new QThread; m_modethread = new QThread;
m_ref->moveToThread(m_modethread); m_ref->moveToThread(m_modethread);
connect(this, SIGNAL(module_changed(char)), m_ref, SLOT(module_changed(char))); connect(this, SIGNAL(module_changed(char)), m_ref, SLOT(module_changed(char)));
@ -365,7 +367,7 @@ void DroidStar::process_connect()
if(m_protocol == "DCS"){ if(m_protocol == "DCS"){
m_dcs = new DCSCodec(m_callsign, m_host, m_module, m_hostname, m_port, false, vocoder, modem, m_playback, m_capture); m_dcs = new DCSCodec(m_callsign, m_host, m_module, m_hostname, m_port, false, vocoder, modem, m_playback, m_capture);
m_dcs->set_modem_flags(rxInvert, txInvert, pttInvert, useCOSAsLockout, duplex); m_dcs->set_modem_flags(rxInvert, txInvert, pttInvert, useCOSAsLockout, duplex);
m_dcs->set_modem_params(m_modemRxFreq.toInt(), m_modemTxFreq.toInt(), 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_dcs->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_modethread = new QThread; m_modethread = new QThread;
m_dcs->moveToThread(m_modethread); m_dcs->moveToThread(m_modethread);
connect(m_dcs, SIGNAL(update(Codec::MODEINFO)), this, SLOT(update_dcs_data(Codec::MODEINFO))); connect(m_dcs, SIGNAL(update(Codec::MODEINFO)), this, SLOT(update_dcs_data(Codec::MODEINFO)));
@ -395,7 +397,7 @@ void DroidStar::process_connect()
if( (m_protocol == "XRF") && (m_xrf2ref == false) ){ if( (m_protocol == "XRF") && (m_xrf2ref == false) ){
m_xrf = new XRFCodec(m_callsign, m_host, m_module, m_hostname, m_port, false, vocoder, modem, m_playback, m_capture); m_xrf = new XRFCodec(m_callsign, m_host, m_module, m_hostname, m_port, false, vocoder, modem, m_playback, m_capture);
m_xrf->set_modem_flags(rxInvert, txInvert, pttInvert, useCOSAsLockout, duplex); m_xrf->set_modem_flags(rxInvert, txInvert, pttInvert, useCOSAsLockout, duplex);
m_xrf->set_modem_params(m_modemRxFreq.toInt(), m_modemTxFreq.toInt(), 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_xrf->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_modethread = new QThread; m_modethread = new QThread;
m_xrf->moveToThread(m_modethread); m_xrf->moveToThread(m_modethread);
connect(m_xrf, SIGNAL(update(Codec::MODEINFO)), this, SLOT(update_xrf_data(Codec::MODEINFO))); connect(m_xrf, SIGNAL(update(Codec::MODEINFO)), this, SLOT(update_xrf_data(Codec::MODEINFO)));
@ -439,7 +441,7 @@ void DroidStar::process_connect()
m_dmr = new DMRCodec(m_callsign, m_dmrid, m_essid, dmrpass, m_latitude, m_longitude, m_location, m_description, m_freq, m_url, m_swid, m_pkgid, m_dmropts, m_dmr_destid, m_hostname, m_port, false, vocoder, modem, m_playback, m_capture); m_dmr = new DMRCodec(m_callsign, m_dmrid, m_essid, dmrpass, m_latitude, m_longitude, m_location, m_description, m_freq, m_url, m_swid, m_pkgid, m_dmropts, m_dmr_destid, m_hostname, m_port, false, vocoder, modem, m_playback, m_capture);
m_dmr->set_modem_flags(rxInvert, txInvert, pttInvert, useCOSAsLockout, duplex); m_dmr->set_modem_flags(rxInvert, txInvert, pttInvert, useCOSAsLockout, duplex);
m_dmr->set_modem_params(m_modemRxFreq.toInt(), m_modemTxFreq.toInt(), 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_dmr->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_modethread = new QThread; m_modethread = new QThread;
m_dmr->moveToThread(m_modethread); m_dmr->moveToThread(m_modethread);
connect(m_dmr, SIGNAL(update(Codec::MODEINFO)), this, SLOT(update_dmr_data(Codec::MODEINFO))); connect(m_dmr, SIGNAL(update(Codec::MODEINFO)), this, SLOT(update_dmr_data(Codec::MODEINFO)));
@ -463,7 +465,7 @@ void DroidStar::process_connect()
if( (m_protocol == "YSF") || (m_protocol == "FCS") ){ if( (m_protocol == "YSF") || (m_protocol == "FCS") ){
m_ysf = new YSFCodec(m_callsign, m_host, m_hostname, m_port, false, vocoder, modem, m_playback, m_capture); m_ysf = new YSFCodec(m_callsign, m_host, m_hostname, m_port, false, vocoder, modem, m_playback, m_capture);
m_ysf->set_modem_flags(rxInvert, txInvert, pttInvert, useCOSAsLockout, duplex); m_ysf->set_modem_flags(rxInvert, txInvert, pttInvert, useCOSAsLockout, duplex);
m_ysf->set_modem_params(m_modemRxFreq.toInt(), m_modemTxFreq.toInt(), 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_ysf->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_modethread = new QThread; m_modethread = new QThread;
m_ysf->moveToThread(m_modethread); m_ysf->moveToThread(m_modethread);
connect(m_ysf, SIGNAL(update(Codec::MODEINFO)), this, SLOT(update_ysf_data(Codec::MODEINFO))); connect(m_ysf, SIGNAL(update(Codec::MODEINFO)), this, SLOT(update_ysf_data(Codec::MODEINFO)));
@ -521,12 +523,13 @@ void DroidStar::process_connect()
if(m_protocol == "M17"){ if(m_protocol == "M17"){
m_m17 = new M17Codec(m_callsign, m_module, m_host, m_hostname, m_port, false, modem, m_playback, m_capture); m_m17 = new M17Codec(m_callsign, m_module, m_host, m_hostname, m_port, false, modem, m_playback, m_capture);
m_m17->set_modem_flags(rxInvert, txInvert, pttInvert, useCOSAsLockout, duplex); m_m17->set_modem_flags(rxInvert, txInvert, pttInvert, useCOSAsLockout, duplex);
m_m17->set_modem_params(m_modemRxFreq.toInt(), m_modemTxFreq.toInt(), 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_m17->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_modethread = new QThread; m_modethread = new QThread;
m_m17->moveToThread(m_modethread); m_m17->moveToThread(m_modethread);
connect(m_m17, SIGNAL(update(Codec::MODEINFO)), this, SLOT(update_m17_data(Codec::MODEINFO))); connect(m_m17, SIGNAL(update(Codec::MODEINFO)), this, SLOT(update_m17_data(Codec::MODEINFO)));
connect(m_m17, SIGNAL(update_output_level(unsigned short)), this, SLOT(update_output_level(unsigned short))); connect(m_m17, SIGNAL(update_output_level(unsigned short)), this, SLOT(update_output_level(unsigned short)));
connect(this, SIGNAL(m17_rate_changed(int)), m_m17, SLOT(rate_changed(int))); connect(this, SIGNAL(m17_rate_changed(int)), m_m17, SLOT(rate_changed(int)));
connect(this, SIGNAL(m17_can_changed(int)), m_m17, SLOT(can_changed(int)));
connect(this, SIGNAL(input_source_changed(int, QString)), m_m17, SLOT(input_src_changed(int, QString))); connect(this, SIGNAL(input_source_changed(int, QString)), m_m17, SLOT(input_src_changed(int, QString)));
connect(m_modethread, SIGNAL(started()), m_m17, SLOT(send_connect())); connect(m_modethread, SIGNAL(started()), m_m17, SLOT(send_connect()));
connect(m_modethread, SIGNAL(finished()), m_m17, SLOT(deleteLater())); connect(m_modethread, SIGNAL(finished()), m_m17, SLOT(deleteLater()));
@ -759,6 +762,8 @@ void DroidStar::save_settings()
m_settings->setValue("ModemYSFTxLevel", m_modemYSFTxLevel); m_settings->setValue("ModemYSFTxLevel", m_modemYSFTxLevel);
m_settings->setValue("ModemP25TxLevel", m_modemP25TxLevel); m_settings->setValue("ModemP25TxLevel", m_modemP25TxLevel);
m_settings->setValue("ModemNXDNTxLevel", m_modemNXDNTxLevel); m_settings->setValue("ModemNXDNTxLevel", m_modemNXDNTxLevel);
m_settings->setValue("ModemBaud", m_modemBaud);
m_settings->setValue("ModemM17CAN", m_modemM17CAN);
m_settings->setValue("ModemTxInvert", m_modemTxInvert ? "true" : "false"); m_settings->setValue("ModemTxInvert", m_modemTxInvert ? "true" : "false");
m_settings->setValue("ModemRxInvert", m_modemRxInvert ? "true" : "false"); m_settings->setValue("ModemRxInvert", m_modemRxInvert ? "true" : "false");
m_settings->setValue("ModemPTTInvert", m_modemPTTInvert ? "true" : "false"); m_settings->setValue("ModemPTTInvert", m_modemPTTInvert ? "true" : "false");
@ -824,6 +829,8 @@ void DroidStar::process_settings()
m_modemYSFTxLevel = m_settings->value("ModemYSFTxLevel", "50").toString().simplified(); m_modemYSFTxLevel = m_settings->value("ModemYSFTxLevel", "50").toString().simplified();
m_modemP25TxLevel = m_settings->value("ModemP25TxLevel", "50").toString().simplified(); m_modemP25TxLevel = m_settings->value("ModemP25TxLevel", "50").toString().simplified();
m_modemNXDNTxLevel = m_settings->value("ModemNXDNTxLevel", "50").toString().simplified(); m_modemNXDNTxLevel = m_settings->value("ModemNXDNTxLevel", "50").toString().simplified();
m_modemBaud = m_settings->value("ModemBaud", "115200").toString().simplified();
m_modemM17CAN = m_settings->value("ModemM17CAN", "0").toString().simplified();
m_modemTxInvert = (m_settings->value("ModemTxInvert", "true").toString().simplified() == "true") ? true : false; m_modemTxInvert = (m_settings->value("ModemTxInvert", "true").toString().simplified() == "true") ? true : false;
m_modemRxInvert = (m_settings->value("ModemRxInvert", "false").toString().simplified() == "true") ? true : false; m_modemRxInvert = (m_settings->value("ModemRxInvert", "false").toString().simplified() == "true") ? true : false;
m_modemPTTInvert = (m_settings->value("ModemPTTInvert", "false").toString().simplified() == "true") ? true : false; m_modemPTTInvert = (m_settings->value("ModemPTTInvert", "false").toString().simplified() == "true") ? true : false;

@ -56,6 +56,7 @@ signals:
void dmrpc_state_changed(int); void dmrpc_state_changed(int);
void dmr_tgid_changed(unsigned int); void dmr_tgid_changed(unsigned int);
void m17_rate_changed(int); void m17_rate_changed(int);
void m17_can_changed(int);
void send_dtmf(QByteArray); void send_dtmf(QByteArray);
void swtx_state_changed(int); void swtx_state_changed(int);
void swrx_state_changed(int); void swrx_state_changed(int);
@ -140,6 +141,8 @@ public slots:
void set_modemYSFTxLevel(QString m) { m_modemYSFTxLevel = m; save_settings(); } void set_modemYSFTxLevel(QString m) { m_modemYSFTxLevel = m; save_settings(); }
void set_modemP25TxLevel(QString m) { m_modemP25TxLevel = m; save_settings(); } void set_modemP25TxLevel(QString m) { m_modemP25TxLevel = m; save_settings(); }
void set_modemNXDNTxLevel(QString m) { m_modemNXDNTxLevel = m; save_settings(); } void set_modemNXDNTxLevel(QString m) { m_modemNXDNTxLevel = m; save_settings(); }
void set_modemBaud(QString m) { m_modemBaud = m; save_settings(); }
void set_modemM17CAN(QString m) { emit m17_can_changed(m.toInt()); }
void m17_rate_changed(bool r) { emit m17_rate_changed((int)r); } void m17_rate_changed(bool r) { emit m17_rate_changed((int)r); }
void process_connect(); void process_connect();
@ -234,6 +237,8 @@ public slots:
QString get_modemYSFTxLevel() { return m_modemYSFTxLevel; } QString get_modemYSFTxLevel() { return m_modemYSFTxLevel; }
QString get_modemP25TxLevel() { return m_modemP25TxLevel; } QString get_modemP25TxLevel() { return m_modemP25TxLevel; }
QString get_modemNXDNTxLevel() { return m_modemNXDNTxLevel; } QString get_modemNXDNTxLevel() { return m_modemNXDNTxLevel; }
QString get_modemBaud() { return m_modemBaud; }
QString get_modemM17CAN() { return m_modemM17CAN; }
#if defined(Q_OS_ANDROID) #if defined(Q_OS_ANDROID)
QString get_platform() { return QSysInfo::productType(); } QString get_platform() { return QSysInfo::productType(); }
void reset_connect_status(); void reset_connect_status();
@ -374,6 +379,8 @@ private:
QString m_modemYSFTxLevel; QString m_modemYSFTxLevel;
QString m_modemP25TxLevel; QString m_modemP25TxLevel;
QString m_modemNXDNTxLevel; QString m_modemNXDNTxLevel;
QString m_modemBaud;
QString m_modemM17CAN;
bool m_modemTxInvert; bool m_modemTxInvert;
bool m_modemRxInvert; bool m_modemRxInvert;
bool m_modemPTTInvert; bool m_modemPTTInvert;

@ -26,7 +26,7 @@
#define M17CHARACTERS " ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-/." #define M17CHARACTERS " ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-/."
#define DEBUG //#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,
@ -98,6 +98,7 @@ M17Codec::M17Codec(QString callsign, char module, QString hostname, QString host
#else #else
m_txtimerint = 36; m_txtimerint = 36;
m_txcan = 0;
#endif #endif
} }
@ -183,7 +184,7 @@ void M17Codec::process_udp()
if(m_modemport != ""){ if(m_modemport != ""){
m_modem = new SerialModem("M17"); m_modem = new SerialModem("M17");
m_modem->set_modem_flags(m_rxInvert, m_txInvert, m_pttInvert, m_useCOSAsLockout, m_duplex); m_modem->set_modem_flags(m_rxInvert, m_txInvert, m_pttInvert, m_useCOSAsLockout, m_duplex);
m_modem->set_modem_params(m_rxfreq, m_txfreq, m_txDelay, m_rxLevel, m_rfLevel, m_ysfTXHang, m_cwIdTXLevel, m_dstarTXLevel, m_dmrTXLevel, m_ysfTXLevel, m_p25TXLevel, m_nxdnTXLevel, m_pocsagTXLevel, m_m17TXLevel); m_modem->set_modem_params(m_baud, m_rxfreq, m_txfreq, m_txDelay, m_rxLevel, m_rfLevel, m_ysfTXHang, m_cwIdTXLevel, m_dstarTXLevel, m_dmrTXLevel, m_ysfTXLevel, m_p25TXLevel, m_nxdnTXLevel, m_pocsagTXLevel, m_m17TXLevel);
m_modem->connect_to_serial(m_modemport); m_modem->connect_to_serial(m_modemport);
connect(m_modem, SIGNAL(connected(bool)), this, SLOT(mmdvm_connect_status(bool))); connect(m_modem, SIGNAL(connected(bool)), this, SLOT(mmdvm_connect_status(bool)));
connect(m_modem, SIGNAL(modem_data_ready(QByteArray)), this, SLOT(process_modem_data(QByteArray))); connect(m_modem, SIGNAL(modem_data_ready(QByteArray)), this, SLOT(process_modem_data(QByteArray)));
@ -317,7 +318,7 @@ void M17Codec::mmdvm_direct_connect()
if(m_modemport != ""){ if(m_modemport != ""){
m_modem = new SerialModem("M17"); m_modem = new SerialModem("M17");
m_modem->set_modem_flags(m_rxInvert, m_txInvert, m_pttInvert, m_useCOSAsLockout, m_duplex); m_modem->set_modem_flags(m_rxInvert, m_txInvert, m_pttInvert, m_useCOSAsLockout, m_duplex);
m_modem->set_modem_params(m_rxfreq, m_txfreq, m_txDelay, m_rxLevel, m_rfLevel, m_ysfTXHang, m_cwIdTXLevel, m_dstarTXLevel, m_dmrTXLevel, m_ysfTXLevel, m_p25TXLevel, m_nxdnTXLevel, m_pocsagTXLevel, m_m17TXLevel); m_modem->set_modem_params(m_baud, m_rxfreq, m_txfreq, m_txDelay, m_rxLevel, m_rfLevel, m_ysfTXHang, m_cwIdTXLevel, m_dstarTXLevel, m_dmrTXLevel, m_ysfTXLevel, m_p25TXLevel, m_nxdnTXLevel, m_pocsagTXLevel, m_m17TXLevel);
m_modem->connect_to_serial(m_modemport); m_modem->connect_to_serial(m_modemport);
connect(m_modem, SIGNAL(connected(bool)), this, SLOT(mmdvm_connect_status(bool))); connect(m_modem, SIGNAL(connected(bool)), this, SLOT(mmdvm_connect_status(bool)));
connect(m_modem, SIGNAL(modem_data_ready(QByteArray)), this, SLOT(process_modem_data(QByteArray))); connect(m_modem, SIGNAL(modem_data_ready(QByteArray)), this, SLOT(process_modem_data(QByteArray)));
@ -420,9 +421,11 @@ void M17Codec::send_modem_data(QByteArray d)
m_rxmodemq.append(MMDVM_M17_LINK_SETUP); m_rxmodemq.append(MMDVM_M17_LINK_SETUP);
m_rxmodemq.append('\x00'); m_rxmodemq.append('\x00');
for(uint32_t i = 0; i < M17_FRAME_LENGTH_BYTES; ++i){ //for(int j = 0; j < 3; j++){
m_rxmodemq.append(txframe[i]); for(uint32_t i = 0; i < M17_FRAME_LENGTH_BYTES; ++i){
} m_rxmodemq.append(txframe[i]);
}
//}
} }
if(lsfcnt == 0){ if(lsfcnt == 0){
@ -644,8 +647,8 @@ void M17Codec::process_modem_data(QByteArray d)
txframe.append((char *)dst, 6); txframe.append((char *)dst, 6);
//txframe.append((char *)src, 6); //txframe.append((char *)src, 6);
txframe.append((char *)&netframe[6], 6); txframe.append((char *)&netframe[6], 6);
txframe.append('\x00'); txframe.append(netframe[12]);
txframe.append(netframe[13]); // Frame type voice only txframe.append(netframe[13]);
txframe.append(14, 0x00); //Blank nonce txframe.append(14, 0x00); //Blank nonce
txframe.append((char)(netframe[28] >> 8)); txframe.append((char)(netframe[28] >> 8));
txframe.append((char)netframe[29] & 0xff); txframe.append((char)netframe[29] & 0xff);
@ -653,9 +656,9 @@ void M17Codec::process_modem_data(QByteArray d)
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 #ifdef DEBUG
fprintf(stderr, "NETFRAME:%02x:", (uint8_t)d.data()[2]); fprintf(stderr, "SEND:%02x:", (uint8_t)txframe.size());
for(int i = 0; i < 50; ++i){ for(int i = 0; i < txframe.size(); ++i){
fprintf(stderr, "%02x ", netframe[i]); fprintf(stderr, "%02x ", (uint8_t)txframe.data()[i]);
} }
fprintf(stderr, "\n"); fprintf(stderr, "\n");
fflush(stderr); fflush(stderr);
@ -761,8 +764,8 @@ void M17Codec::transmit()
txframe.append(txstreamid & 0xff); txframe.append(txstreamid & 0xff);
txframe.append((char *)dst, 6); txframe.append((char *)dst, 6);
txframe.append((char *)src, 6); txframe.append((char *)src, 6);
txframe.append('\x00'); txframe.append(m_txcan >> 1);
txframe.append(r); txframe.append(((m_txcan << 7) & 0x80U) | r);
txframe.append(14, 0x00); //Blank nonce txframe.append(14, 0x00); //Blank nonce
txframe.append((char)(tx_cnt >> 8)); txframe.append((char)(tx_cnt >> 8));
txframe.append((char)tx_cnt & 0xff); txframe.append((char)tx_cnt & 0xff);

@ -47,6 +47,7 @@ private slots:
void hostname_lookup(QHostInfo i); void hostname_lookup(QHostInfo i);
void mmdvm_direct_connect(); void mmdvm_direct_connect();
void rate_changed(int r) { m_txrate = r; } void rate_changed(int r) { m_txrate = r; }
void can_changed(int c) { m_txcan = c; }
void process_rx_data(); void process_rx_data();
void splitFragmentLICH(const uint8_t*, uint32_t&, uint32_t&, uint32_t&, uint32_t&); void splitFragmentLICH(const uint8_t*, uint32_t&, uint32_t&, uint32_t&, uint32_t&);
void combineFragmentLICH(uint32_t, uint32_t, uint32_t, uint32_t, uint8_t*); void combineFragmentLICH(uint32_t, uint32_t, uint32_t, uint32_t, uint8_t*);
@ -58,6 +59,7 @@ private slots:
uint16_t createCRC16(const uint8_t* in, uint32_t nBytes); uint16_t createCRC16(const uint8_t* in, uint32_t nBytes);
private: private:
int m_txrate; int m_txrate;
uint8_t m_txcan;
}; };
#endif // M17CODEC_H #endif // M17CODEC_H

@ -202,6 +202,7 @@ ApplicationWindow {
mainTab.comboCC.visible = false; mainTab.comboCC.visible = false;
mainTab.element3.visible = false; mainTab.element3.visible = false;
mainTab.dmrtgidEdit.visible = false; mainTab.dmrtgidEdit.visible = false;
mainTab.comboM17CAN.visible = false;
mainTab.privateBox.visible = false; mainTab.privateBox.visible = false;
mainTab.sliderMicGain.value = 0.0; mainTab.sliderMicGain.value = 0.0;
} }
@ -216,6 +217,7 @@ ApplicationWindow {
mainTab.comboCC.visible = false; mainTab.comboCC.visible = false;
mainTab.element3.visible = false; mainTab.element3.visible = false;
mainTab.dmrtgidEdit.visible = false; mainTab.dmrtgidEdit.visible = false;
mainTab.comboM17CAN.visible = false;
mainTab.privateBox.visible = false; mainTab.privateBox.visible = false;
mainTab.sliderMicGain.value = 0.0; mainTab.sliderMicGain.value = 0.0;
} }
@ -230,6 +232,7 @@ ApplicationWindow {
mainTab.comboCC.visible = false; mainTab.comboCC.visible = false;
mainTab.element3.visible = false; mainTab.element3.visible = false;
mainTab.dmrtgidEdit.visible = false; mainTab.dmrtgidEdit.visible = false;
mainTab.comboM17CAN.visible = false;
mainTab.privateBox.visible = false; mainTab.privateBox.visible = false;
mainTab.sliderMicGain.value = 0.0; mainTab.sliderMicGain.value = 0.0;
} }
@ -244,6 +247,7 @@ ApplicationWindow {
mainTab.comboCC.visible = false; mainTab.comboCC.visible = false;
mainTab.element3.visible = false; mainTab.element3.visible = false;
mainTab.dmrtgidEdit.visible = false; mainTab.dmrtgidEdit.visible = false;
mainTab.comboM17CAN.visible = false;
mainTab.privateBox.visible = false; mainTab.privateBox.visible = false;
mainTab.sliderMicGain.value = 0.2; mainTab.sliderMicGain.value = 0.2;
} }
@ -258,6 +262,7 @@ ApplicationWindow {
mainTab.comboCC.visible = false; mainTab.comboCC.visible = false;
mainTab.element3.visible = false; mainTab.element3.visible = false;
mainTab.dmrtgidEdit.visible = false; mainTab.dmrtgidEdit.visible = false;
mainTab.comboM17CAN.visible = false;
mainTab.privateBox.visible = false; mainTab.privateBox.visible = false;
mainTab.sliderMicGain.value = 0.2; mainTab.sliderMicGain.value = 0.2;
} }
@ -270,8 +275,10 @@ ApplicationWindow {
mainTab.comboModule.visible = false; mainTab.comboModule.visible = false;
mainTab.comboSlot.visible = true; mainTab.comboSlot.visible = true;
mainTab.comboCC.visible = true; mainTab.comboCC.visible = true;
mainTab.element3.text = "TGID";
mainTab.element3.visible = true; mainTab.element3.visible = true;
mainTab.dmrtgidEdit.visible = true; mainTab.dmrtgidEdit.visible = true;
mainTab.comboM17CAN.visible = false;
mainTab.privateBox.visible = true; mainTab.privateBox.visible = true;
mainTab.sliderMicGain.value = 0.3; mainTab.sliderMicGain.value = 0.3;
} }
@ -284,8 +291,10 @@ ApplicationWindow {
mainTab.comboModule.visible = false; mainTab.comboModule.visible = false;
mainTab.comboSlot.visible = false; mainTab.comboSlot.visible = false;
mainTab.comboCC.visible = false; mainTab.comboCC.visible = false;
mainTab.element3.text = "TGID";
mainTab.element3.visible = true; mainTab.element3.visible = true;
mainTab.dmrtgidEdit.visible = true; mainTab.dmrtgidEdit.visible = true;
mainTab.comboM17CAN.visible = false;
mainTab.privateBox.visible = false; mainTab.privateBox.visible = false;
mainTab.sliderMicGain.value = 0.3; mainTab.sliderMicGain.value = 0.3;
} }
@ -300,6 +309,7 @@ ApplicationWindow {
mainTab.comboCC.visible = false; mainTab.comboCC.visible = false;
mainTab.element3.visible = false; mainTab.element3.visible = false;
mainTab.dmrtgidEdit.visible = false; mainTab.dmrtgidEdit.visible = false;
mainTab.comboM17CAN.visible = false;
mainTab.privateBox.visible = false; mainTab.privateBox.visible = false;
mainTab.sliderMicGain.value = 0.3; mainTab.sliderMicGain.value = 0.3;
} }
@ -313,8 +323,10 @@ ApplicationWindow {
mainTab.comboModule.visible = true; mainTab.comboModule.visible = true;
mainTab.comboSlot.visible = false; mainTab.comboSlot.visible = false;
mainTab.comboCC.visible = false; mainTab.comboCC.visible = false;
mainTab.element3.visible = false; mainTab.element3.text = "CAN";
mainTab.element3.visible = true;
mainTab.dmrtgidEdit.visible = false; mainTab.dmrtgidEdit.visible = false;
mainTab.comboM17CAN.visible = true;
mainTab.privateBox.visible = false; mainTab.privateBox.visible = false;
mainTab.sliderMicGain.value = 0.5; mainTab.sliderMicGain.value = 0.5;
} }
@ -328,6 +340,7 @@ ApplicationWindow {
mainTab.comboCC.visible = false; mainTab.comboCC.visible = false;
mainTab.element3.visible = false; mainTab.element3.visible = false;
mainTab.dmrtgidEdit.visible = false; mainTab.dmrtgidEdit.visible = false;
mainTab.comboM17CAN.visible = false;
mainTab.privateBox.visible = false; mainTab.privateBox.visible = false;
mainTab.sliderMicGain.value = 0.5; mainTab.sliderMicGain.value = 0.5;
} }
@ -419,6 +432,7 @@ ApplicationWindow {
settingsTab.modemYSFTXLevelEdit.text = droidstar.get_modemYSFTxLevel(); settingsTab.modemYSFTXLevelEdit.text = droidstar.get_modemYSFTxLevel();
settingsTab.modemP25TXLevelEdit.text = droidstar.get_modemP25TxLevel() settingsTab.modemP25TXLevelEdit.text = droidstar.get_modemP25TxLevel()
settingsTab.modemNXDNTXLevelEdit.text = droidstar.get_modemNXDNTxLevel(); settingsTab.modemNXDNTXLevelEdit.text = droidstar.get_modemNXDNTxLevel();
settingsTab.modemBaudEdit.text = droidstar.get_modemBaud();
hostsTab.hostsTextEdit.text = droidstar.get_local_hosts(); hostsTab.hostsTextEdit.text = droidstar.get_local_hosts();
} }

@ -106,7 +106,7 @@ void REFCodec::process_udp()
if(m_modemport != ""){ if(m_modemport != ""){
m_modem = new SerialModem("REF"); m_modem = new SerialModem("REF");
m_modem->set_modem_flags(m_rxInvert, m_txInvert, m_pttInvert, m_useCOSAsLockout, m_duplex); m_modem->set_modem_flags(m_rxInvert, m_txInvert, m_pttInvert, m_useCOSAsLockout, m_duplex);
m_modem->set_modem_params(m_rxfreq, m_txfreq, m_txDelay, m_rxLevel, m_rfLevel, m_ysfTXHang, m_cwIdTXLevel, m_dstarTXLevel, m_dmrTXLevel, m_ysfTXLevel, m_p25TXLevel, m_nxdnTXLevel, m_pocsagTXLevel, m_m17TXLevel); m_modem->set_modem_params(m_baud, m_rxfreq, m_txfreq, m_txDelay, m_rxLevel, m_rfLevel, m_ysfTXHang, m_cwIdTXLevel, m_dstarTXLevel, m_dmrTXLevel, m_ysfTXLevel, m_p25TXLevel, m_nxdnTXLevel, m_pocsagTXLevel, m_m17TXLevel);
m_modem->connect_to_serial(m_modemport); m_modem->connect_to_serial(m_modemport);
connect(m_modem, SIGNAL(connected(bool)), this, SLOT(mmdvm_connect_status(bool))); connect(m_modem, SIGNAL(connected(bool)), this, SLOT(mmdvm_connect_status(bool)));
connect(m_modem, SIGNAL(modem_data_ready(QByteArray)), this, SLOT(process_modem_data(QByteArray))); connect(m_modem, SIGNAL(modem_data_ready(QByteArray)), this, SLOT(process_modem_data(QByteArray)));

@ -23,14 +23,14 @@
//#define DEBUGHW //#define DEBUGHW
SerialModem::SerialModem(QString protocol) SerialModem::SerialModem(QString mode)
{ {
set_mode(protocol); set_mode(mode);
m_dmrDelay = 0; m_dmrDelay = 0;
m_debug = false; m_debug = false;
m_dmrColorCode = 1; m_dmrColorCode = 1;
m_m17support = 1;
m_m17TXHang = 5; m_m17TXHang = 5;
m_ax25Enabled = false;
} }
SerialModem::~SerialModem() SerialModem::~SerialModem()
@ -46,6 +46,7 @@ void SerialModem::set_mode(QString m)
m_p25Enabled = 0; m_p25Enabled = 0;
m_nxdnEnabled = 0; m_nxdnEnabled = 0;
m_pocsagEnabled = 0; m_pocsagEnabled = 0;
m_m17Enabled = 0;
if((m == "REF") || (m == "DCS") || (m == "XRF")){ if((m == "REF") || (m == "DCS") || (m == "XRF")){
m_dstarEnabled = 1; m_dstarEnabled = 1;
@ -77,8 +78,9 @@ void SerialModem::set_modem_flags(bool rxInvert, bool txInvert, bool pttInvert,
m_ysfLoDev = 0; m_ysfLoDev = 0;
} }
void SerialModem::set_modem_params(uint32_t rxfreq, uint32_t txfreq, uint32_t txDelay, float rxLevel, float rfLevel, uint32_t ysfTXHang, float cwIdTXLevel, float dstarTXLevel, float dmrTXLevel, float ysfTXLevel, float p25TXLevel, float nxdnTXLevel, float pocsagTXLevel, float m17TXLevel) void SerialModem::set_modem_params(uint32_t baudrate, uint32_t rxfreq, uint32_t txfreq, uint32_t txDelay, float rxLevel, float rfLevel, uint32_t ysfTXHang, float cwIdTXLevel, float dstarTXLevel, float dmrTXLevel, float ysfTXLevel, float p25TXLevel, float nxdnTXLevel, float pocsagTXLevel, float m17TXLevel)
{ {
m_baudrate = baudrate;
m_rxfreq = rxfreq; m_rxfreq = rxfreq;
m_txfreq = txfreq; m_txfreq = txfreq;
m_txDelay = txDelay; m_txDelay = txDelay;
@ -103,7 +105,7 @@ void SerialModem::connect_to_serial(QString p)
m_serial = &AndroidSerialPort::GetInstance(); m_serial = &AndroidSerialPort::GetInstance();
#endif #endif
m_serial->setPortName(p); m_serial->setPortName(p);
m_serial->setBaudRate(115200); m_serial->setBaudRate(m_baudrate);
m_serial->setDataBits(QSerialPort::Data8); m_serial->setDataBits(QSerialPort::Data8);
m_serial->setStopBits(QSerialPort::OneStop); m_serial->setStopBits(QSerialPort::OneStop);
m_serial->setParity(QSerialPort::NoParity); m_serial->setParity(QSerialPort::NoParity);
@ -207,7 +209,7 @@ void SerialModem::process_modem()
for(int i = 0; i < (s-4); ++i){ for(int i = 0; i < (s-4); ++i){
m_version.append(m_serialdata[4+i]); m_version.append(m_serialdata[4+i]);
} }
qDebug() << "MMDVM: " << m_version; qDebug() << "MMDVM Protocol " << m_protocol << ": " << m_version;
} }
QThread::msleep(100); QThread::msleep(100);
set_freq(); set_freq();
@ -272,11 +274,11 @@ void SerialModem::set_config()
out.append(MMDVM_FRAME_START); out.append(MMDVM_FRAME_START);
if(m_m17support){ if(m_protocol == 1){
out.append(26U); out.append(26U);
} }
else{ else if(m_protocol == 2){
out.append(24U); out.append(40U);
} }
out.append(MMDVM_SET_CONFIG); out.append(MMDVM_SET_CONFIG);
@ -316,29 +318,72 @@ void SerialModem::set_config()
c |= 0x40U; c |= 0x40U;
out.append(c); out.append(c);
out.append(m_txDelay / 10U); // In 10ms units
out.append(MODE_IDLE);
out.append((uint8_t)(m_rxLevel * 2.55F + 0.5F)); if(m_protocol == 1){
out.append((uint8_t)(m_cwIdTXLevel * 2.55F + 0.5F)); out.append(m_txDelay / 10U); // In 10ms units
out.append(m_dmrColorCode); out.append(MODE_IDLE);
out.append(m_dmrDelay); out.append((uint8_t)(m_rxLevel * 2.55F + 0.5F));
out.append(128U); // Was OscOffset out.append((uint8_t)(m_cwIdTXLevel * 2.55F + 0.5F));
out.append((uint8_t)(m_dstarTXLevel * 2.55F + 0.5F)); out.append(m_dmrColorCode);
out.append((uint8_t)(m_dmrTXLevel * 2.55F + 0.5F)); out.append(m_dmrDelay);
out.append((uint8_t)(m_ysfTXLevel * 2.55F + 0.5F)); out.append(128U); // Was OscOffset
out.append((uint8_t)(m_p25TXLevel * 2.55F + 0.5F)); out.append((uint8_t)(m_dstarTXLevel * 2.55F + 0.5F));
out.append((uint8_t)(m_txDCOffset + 128)); out.append((uint8_t)(m_dmrTXLevel * 2.55F + 0.5F));
out.append((uint8_t)(m_rxDCOffset + 128)); out.append((uint8_t)(m_ysfTXLevel * 2.55F + 0.5F));
out.append((uint8_t)(m_nxdnTXLevel * 2.55F + 0.5F)); out.append((uint8_t)(m_p25TXLevel * 2.55F + 0.5F));
out.append((uint8_t)m_ysfTXHang); out.append((uint8_t)(m_txDCOffset + 128));
out.append((uint8_t)(m_pocsagTXLevel * 2.55F + 0.5F)); out.append((uint8_t)(m_rxDCOffset + 128));
out.append((uint8_t)(m_fmTXLevel * 2.55F + 0.5F)); out.append((uint8_t)(m_nxdnTXLevel * 2.55F + 0.5F));
out.append((uint8_t)m_p25TXHang); out.append((uint8_t)m_ysfTXHang);
out.append((uint8_t)m_nxdnTXHang); out.append((uint8_t)(m_pocsagTXLevel * 2.55F + 0.5F));
out.append((uint8_t)(m_fmTXLevel * 2.55F + 0.5F));
if(m_m17support){ out.append((uint8_t)m_p25TXHang);
out.append((uint8_t)m_nxdnTXHang);
out.append((uint8_t)(m_m17TXLevel * 2.55F + 0.5F));
out.append((uint8_t)m_m17TXHang);
}
else if(m_protocol == 2){
c = 0x00U;
if (m_pocsagEnabled)
c |= 0x01U;
if (m_ax25Enabled)
c |= 0x02U;
out.append(c);
out.append(m_txDelay / 10U);
out.append(MODE_IDLE);
out.append((uint8_t)(m_txDCOffset + 128));
out.append((uint8_t)(m_rxDCOffset + 128));
out.append((uint8_t)(m_rxLevel * 2.55F + 0.5F));
out.append((uint8_t)(m_cwIdTXLevel * 2.55F + 0.5F));
out.append((uint8_t)(m_dstarTXLevel * 2.55F + 0.5F));
out.append((uint8_t)(m_dmrTXLevel * 2.55F + 0.5F));
out.append((uint8_t)(m_ysfTXLevel * 2.55F + 0.5F));
out.append((uint8_t)(m_p25TXLevel * 2.55F + 0.5F));
out.append((uint8_t)(m_nxdnTXLevel * 2.55F + 0.5F));
out.append((uint8_t)(m_m17TXLevel * 2.55F + 0.5F)); out.append((uint8_t)(m_m17TXLevel * 2.55F + 0.5F));
out.append((uint8_t)(m_pocsagTXLevel * 2.55F + 0.5F));
out.append((uint8_t)(m_fmTXLevel * 2.55F + 0.5F));
out.append((uint8_t)(m_ax25TXLevel * 2.55F + 0.5F));
out.append('\00');
out.append('\00');
out.append((uint8_t)m_ysfTXHang);
out.append((uint8_t)m_p25TXHang);
out.append((uint8_t)m_nxdnTXHang);
out.append((uint8_t)m_m17TXHang); out.append((uint8_t)m_m17TXHang);
out.append('\00');
out.append('\00');
out.append(m_dmrColorCode);
out.append(m_dmrDelay);
out.append((uint8_t)(m_ax25RXTwist + 128));
out.append(m_ax25TXDelay / 10U);
out.append(m_ax25SlotTime / 10U);
out.append(m_ax25PPersist);
out.append('\00');
out.append('\00');
out.append('\00');
out.append('\00');
out.append('\00');
} }
m_serial->write(out); m_serial->write(out);

@ -34,7 +34,7 @@ public:
~SerialModem(); ~SerialModem();
void set_mode(QString); void set_mode(QString);
void set_modem_flags(bool, bool, bool, bool, bool); void set_modem_flags(bool, bool, bool, bool, bool);
void set_modem_params(uint32_t, uint32_t, uint32_t, float, float, uint32_t, float, float, float, float, float, float, float, float); void set_modem_params(uint32_t, uint32_t, uint32_t, uint32_t, float, float, uint32_t, float, float, float, float, float, float, float, float);
static QMap<QString, QString> discover_devices(); static QMap<QString, QString> discover_devices();
void connect_to_serial(QString); void connect_to_serial(QString);
QString get_mmdvm_version(){ return m_version; } QString get_mmdvm_version(){ return m_version; }
@ -54,6 +54,7 @@ private:
#endif #endif
QString m_version; QString m_version;
uint8_t m_protocol; uint8_t m_protocol;
uint32_t m_baudrate;
QTimer *m_modemtimer; QTimer *m_modemtimer;
uint8_t packet_size; uint8_t packet_size;
QQueue<char> m_serialdata; QQueue<char> m_serialdata;
@ -82,6 +83,11 @@ private:
float m_pocsagTXLevel; float m_pocsagTXLevel;
float m_m17TXLevel; float m_m17TXLevel;
float m_fmTXLevel; float m_fmTXLevel;
float m_ax25TXLevel;
int m_ax25RXTwist;
uint32_t m_ax25TXDelay;
uint32_t m_ax25SlotTime;
uint32_t m_ax25PPersist;
bool m_debug; bool m_debug;
bool m_useCOSAsLockout; bool m_useCOSAsLockout;
bool m_dstarEnabled; bool m_dstarEnabled;
@ -90,9 +96,9 @@ private:
bool m_p25Enabled; bool m_p25Enabled;
bool m_nxdnEnabled; bool m_nxdnEnabled;
bool m_pocsagEnabled; bool m_pocsagEnabled;
bool m_ax25Enabled;
bool m_m17Enabled; bool m_m17Enabled;
bool m_fmEnabled; bool m_fmEnabled;
bool m_m17support;
int m_rxDCOffset; int m_rxDCOffset;
int m_txDCOffset; int m_txDCOffset;
signals: signals:

@ -73,7 +73,7 @@ void XRFCodec::process_udp()
if(m_modemport != ""){ if(m_modemport != ""){
m_modem = new SerialModem("XRF"); m_modem = new SerialModem("XRF");
m_modem->set_modem_flags(m_rxInvert, m_txInvert, m_pttInvert, m_useCOSAsLockout, m_duplex); m_modem->set_modem_flags(m_rxInvert, m_txInvert, m_pttInvert, m_useCOSAsLockout, m_duplex);
m_modem->set_modem_params(m_rxfreq, m_txfreq, m_txDelay, m_rxLevel, m_rfLevel, m_ysfTXHang, m_cwIdTXLevel, m_dstarTXLevel, m_dmrTXLevel, m_ysfTXLevel, m_p25TXLevel, m_nxdnTXLevel, m_pocsagTXLevel, m_m17TXLevel); m_modem->set_modem_params(m_baud, m_rxfreq, m_txfreq, m_txDelay, m_rxLevel, m_rfLevel, m_ysfTXHang, m_cwIdTXLevel, m_dstarTXLevel, m_dmrTXLevel, m_ysfTXLevel, m_p25TXLevel, m_nxdnTXLevel, m_pocsagTXLevel, m_m17TXLevel);
m_modem->connect_to_serial(m_modemport); m_modem->connect_to_serial(m_modemport);
connect(m_modem, SIGNAL(connected(bool)), this, SLOT(mmdvm_connect_status(bool))); connect(m_modem, SIGNAL(connected(bool)), this, SLOT(mmdvm_connect_status(bool)));
connect(m_modem, SIGNAL(modem_data_ready(QByteArray)), this, SLOT(process_modem_data(QByteArray))); connect(m_modem, SIGNAL(modem_data_ready(QByteArray)), this, SLOT(process_modem_data(QByteArray)));

@ -138,7 +138,9 @@ void YSFCodec::process_udp()
connect(m_ping_timer, SIGNAL(timeout()), this, SLOT(send_ping())); connect(m_ping_timer, SIGNAL(timeout()), this, SLOT(send_ping()));
set_fcs_mode(false); set_fcs_mode(false);
//m_mbeenc->set_gain_adjust(2.5); //m_mbeenc->set_gain_adjust(2.5);
#ifdef VOCODER_PLUGIN
m_modeinfo.sw_vocoder_loaded = load_vocoder_plugin(); m_modeinfo.sw_vocoder_loaded = load_vocoder_plugin();
#endif
m_rxtimer = new QTimer(); m_rxtimer = new QTimer();
connect(m_rxtimer, SIGNAL(timeout()), this, SLOT(process_rx_data())); connect(m_rxtimer, SIGNAL(timeout()), this, SLOT(process_rx_data()));
@ -159,7 +161,7 @@ void YSFCodec::process_udp()
if(m_modemport != ""){ if(m_modemport != ""){
m_modem = new SerialModem("YSF"); m_modem = new SerialModem("YSF");
m_modem->set_modem_flags(m_rxInvert, m_txInvert, m_pttInvert, m_useCOSAsLockout, m_duplex); m_modem->set_modem_flags(m_rxInvert, m_txInvert, m_pttInvert, m_useCOSAsLockout, m_duplex);
m_modem->set_modem_params(m_rxfreq, m_txfreq, m_txDelay, m_rxLevel, m_rfLevel, m_ysfTXHang, m_cwIdTXLevel, m_dstarTXLevel, m_dmrTXLevel, m_ysfTXLevel, m_p25TXLevel, m_nxdnTXLevel, m_pocsagTXLevel, m_m17TXLevel); m_modem->set_modem_params(m_baud, m_rxfreq, m_txfreq, m_txDelay, m_rxLevel, m_rfLevel, m_ysfTXHang, m_cwIdTXLevel, m_dstarTXLevel, m_dmrTXLevel, m_ysfTXLevel, m_p25TXLevel, m_nxdnTXLevel, m_pocsagTXLevel, m_m17TXLevel);
m_modem->connect_to_serial(m_modemport); m_modem->connect_to_serial(m_modemport);
connect(m_modem, SIGNAL(connected(bool)), this, SLOT(mmdvm_connect_status(bool))); connect(m_modem, SIGNAL(connected(bool)), this, SLOT(mmdvm_connect_status(bool)));
connect(m_modem, SIGNAL(modem_data_ready(QByteArray)), this, SLOT(process_modem_data(QByteArray))); connect(m_modem, SIGNAL(modem_data_ready(QByteArray)), this, SLOT(process_modem_data(QByteArray)));

Loading…
Cancel
Save