From 0741252310bfea0713b6fc12b044f521a990dd84 Mon Sep 17 00:00:00 2001 From: Doug McLain Date: Wed, 15 Jun 2022 14:32:25 -0400 Subject: [PATCH] ios defines and update readme about ios support --- README.md | 3 +++ audioengine.cpp | 3 +-- audioengine.h | 1 - codec.cpp | 20 +++++++++++++++++++- codec.h | 7 +++++++ dcscodec.cpp | 12 ++++++++++++ dmrcodec.cpp | 12 ++++++++++++ droidstar.cpp | 3 ++- m17codec.cpp | 6 ++++++ main.cpp | 1 + nxdncodec.cpp | 8 ++++++++ refcodec.cpp | 10 ++++++++++ xrfcodec.cpp | 12 ++++++++++++ ysfcodec.cpp | 16 +++++++++++++++- 14 files changed, 108 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index cf32d1a..9c35e8e 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,9 @@ This software connects to M17, Fusion (YSF/FCS, DN and VW modes are supported), This software makes use of software from a number of other open source software projects, including MMDVMHost, MMDVM_CM, mvoice, and others. Not only is software from these projects being used directly, but learning about the various network protocols and encoding/decoding of the various protocols was only possible thanks to the authors of all of these software projects. +# DroidStar for iOS is no more +Apple recently made iOS SDK 15 the minimum requirement for apps on the app store. XCode 13 is required for this SDK, but macOS 11 is required for this version. My mac is a MacBook Pro 13 2012 which is unsupported by macOS 11, so I will no longer be able to provide an iOS version of DroidStar. I bought this MacBook, a used iphone 6s, and paid for a developer account all out of my own pocket to provide a free version of DroidStar for iOS. Since I have no other use for a mac or an iphone, at this time I have no plans to by new apple hardware. + # DudeStar, DroidStar, and Qt The DudeStar application used the Qt Widgets UI, while DroidStar uses the Qt Quick UI. All of the back end C/C++ source code for both projects has always been identical, but because of the different UI APIs, two repositories had to be maintained for the same project. Even though I prefer the Qt widgets UI over the Qt Quick UI for desktop applications, I have combined both projects into a single entity which is now simply called 'DroidStar'. My dudestar repo has been removed from github, but there are plenty of forks of it on github, in case anyone wishes to continue development of that version. diff --git a/audioengine.cpp b/audioengine.cpp index 31cae20..31c98e2 100644 --- a/audioengine.cpp +++ b/audioengine.cpp @@ -17,10 +17,9 @@ #include "audioengine.h" #include -#include #include -#ifdef Q_OS_MACOS +#if defined (Q_OS_MACOS) || defined(Q_OS_IOS) #define MACHAK 1 #else #define MACHAK 0 diff --git a/audioengine.h b/audioengine.h index fd9b1e6..1d304ae 100644 --- a/audioengine.h +++ b/audioengine.h @@ -24,7 +24,6 @@ #include #include #include -#include #define AUDIO_OUT 1 #define AUDIO_IN 0 diff --git a/codec.cpp b/codec.cpp index 2393e60..fb95e4d 100644 --- a/codec.cpp +++ b/codec.cpp @@ -81,9 +81,11 @@ Codec::~Codec() void Codec::ambe_connect_status(bool s) { if(s){ +#if !defined(Q_OS_IOS) m_modeinfo.ambedesc = m_ambedev->get_ambe_description(); m_modeinfo.ambeprodid = m_ambedev->get_ambe_prodid(); m_modeinfo.ambeverstr = m_ambedev->get_ambe_verstring(); +#endif } else{ m_modeinfo.ambeprodid = "Connect failed"; @@ -96,7 +98,9 @@ void Codec::mmdvm_connect_status(bool s) { if(s){ //m_modeinfo.mmdvmdesc = m_modem->get_mmdvm_description(); +#if !defined(Q_OS_IOS) m_modeinfo.mmdvm = m_modem->get_mmdvm_version(); +#endif } else{ m_modeinfo.mmdvm = "Connect failed"; @@ -147,9 +151,11 @@ void Codec::toggle_tx(bool tx) void Codec::start_tx() { +#if !defined(Q_OS_IOS) if(m_hwtx){ m_ambedev->clear_queue(); } +#endif m_txcodecq.clear(); m_tx = true; m_txcnt = 0; @@ -191,7 +197,7 @@ bool Codec::load_vocoder_plugin() #if !defined(Q_OS_ANDROID) && !defined(Q_OS_WIN) config_path += "/dudetronics"; #endif -#if defined(Q_OS_ANDROID) +#if defined(Q_OS_ANDROID) || defined(Q_OS_IOS) QString voc = config_path + "/vocoder_plugin." + QSysInfo::productType() + "." + QSysInfo::currentCpuArchitecture(); #else QString voc = config_path + "/vocoder_plugin." + QSysInfo::kernelType() + "." + QSysInfo::currentCpuArchitecture(); @@ -236,10 +242,20 @@ bool Codec::load_vocoder_plugin() return false; } #endif +#else +#if defined(Q_OS_IOS) + if(QFileInfo::exists(voc)){ + m_mbevocoder = new VocoderPlugin(); + return true; + } + else{ + return false; + } #else m_mbevocoder = new VocoderPlugin(); return true; #endif +#endif } void Codec::deleteLater() @@ -249,12 +265,14 @@ void Codec::deleteLater() //m_ping_timer->stop(); send_disconnect(); delete m_audio; +#if !defined(Q_OS_IOS) if(m_hwtx){ delete m_ambedev; } if(m_modem){ delete m_modem; } +#endif } m_modeinfo.count = 0; QObject::deleteLater(); diff --git a/codec.h b/codec.h index 72c4a48..c6dead6 100644 --- a/codec.h +++ b/codec.h @@ -30,8 +30,10 @@ #include #endif #include "audioengine.h" +#if !defined(Q_OS_IOS) #include "serialambe.h" #include "serialmodem.h" +#endif class Codec : public QObject { @@ -184,8 +186,13 @@ protected: #endif QString m_vocoder; QString m_modemport; +#if defined(Q_OS_IOS) + void *m_modem; + void *m_ambedev; +#else SerialModem *m_modem; SerialAMBE *m_ambedev; +#endif bool m_hwrx; bool m_hwtx; bool m_ipv6; diff --git a/dcscodec.cpp b/dcscodec.cpp index b83cbf4..06cb7df 100755 --- a/dcscodec.cpp +++ b/dcscodec.cpp @@ -65,22 +65,26 @@ void DCSCodec::process_udp() m_hwrx = true; m_hwtx = true; m_modeinfo.hw_vocoder_loaded = true; +#if !defined(Q_OS_IOS) m_ambedev = new SerialAMBE("DCS"); m_ambedev->connect_to_serial(m_vocoder); connect(m_ambedev, SIGNAL(connected(bool)), this, SLOT(ambe_connect_status(bool))); connect(m_ambedev, SIGNAL(data_ready()), this, SLOT(get_ambe())); +#endif } else{ m_hwrx = false; m_hwtx = false; } if(m_modemport != ""){ +#if !defined(Q_OS_IOS) m_modem = new SerialModem("DCS"); m_modem->set_modem_flags(m_rxInvert, m_txInvert, m_pttInvert, m_useCOSAsLockout, m_duplex); 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); 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))); +#endif } m_rxtimer = new QTimer(); connect(m_rxtimer, SIGNAL(timeout()), this, SLOT(process_rx_data())); @@ -388,7 +392,9 @@ void DCSCodec::transmit() } } if(m_hwtx){ +#if !defined(Q_OS_IOS) m_ambedev->encode(pcm); +#endif if(m_tx && (m_txcodecq.size() >= 9)){ for(int i = 0; i < 9; ++i){ ambe[i] = m_txcodecq.dequeue(); @@ -529,6 +535,7 @@ void DCSCodec::send_frame(uint8_t *ambe) void DCSCodec::get_ambe() { +#if !defined(Q_OS_IOS) uint8_t ambe[9]; if(m_ambedev->get_ambe(ambe)){ @@ -536,6 +543,7 @@ void DCSCodec::get_ambe() m_txcodecq.append(ambe[i]); } } +#endif } void DCSCodec::process_rx_data() @@ -559,7 +567,9 @@ void DCSCodec::process_rx_data() for(int i = 0; i < s; ++i){ out.append(m_rxmodemq.dequeue()); } +#if !defined(Q_OS_IOS) m_modem->write(out); +#endif } } @@ -568,12 +578,14 @@ void DCSCodec::process_rx_data() ambe[i] = m_rxcodecq.dequeue(); } if(m_hwrx){ +#if !defined(Q_OS_IOS) m_ambedev->decode(ambe); if(m_ambedev->get_audio(pcm)){ m_audio->write(pcm, 160); emit update_output_level(m_audio->level()); } +#endif } else{ if(m_modeinfo.sw_vocoder_loaded){ diff --git a/dmrcodec.cpp b/dmrcodec.cpp index 6c64581..17435c8 100755 --- a/dmrcodec.cpp +++ b/dmrcodec.cpp @@ -306,22 +306,26 @@ void DMRCodec::setup_connection() m_hwrx = true; m_hwtx = true; m_modeinfo.hw_vocoder_loaded = true; +#if !defined(Q_OS_IOS) m_ambedev = new SerialAMBE("DMR"); m_ambedev->connect_to_serial(m_vocoder); connect(m_ambedev, SIGNAL(connected(bool)), this, SLOT(ambe_connect_status(bool))); connect(m_ambedev, SIGNAL(data_ready()), this, SLOT(get_ambe())); +#endif } else{ m_hwrx = false; m_hwtx = false; } if(m_modemport != ""){ +#if !defined(Q_OS_IOS) m_modem = new SerialModem("DMR"); m_modem->set_modem_flags(m_rxInvert, m_txInvert, m_pttInvert, m_useCOSAsLockout, m_duplex); 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); 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))); +#endif } m_audio = new AudioEngine(m_audioin, m_audioout); m_audio->init(); @@ -468,7 +472,9 @@ void DMRCodec::transmit() } if(m_hwtx){ +#if !defined(Q_OS_IOS) m_ambedev->encode(pcm); +#endif } else{ if(m_modeinfo.sw_vocoder_loaded){ @@ -896,6 +902,7 @@ void DMRCodec::addDMRAudioSync(uint8_t* data, bool duplex) void DMRCodec::get_ambe() { +#if !defined(Q_OS_IOS) uint8_t ambe[9]; if(m_ambedev->get_ambe(ambe)){ @@ -903,6 +910,7 @@ void DMRCodec::get_ambe() m_txcodecq.append(ambe[i]); } } +#endif } void DMRCodec::process_rx_data() @@ -927,7 +935,9 @@ void DMRCodec::process_rx_data() for(int i = 0; i < s; ++i){ out.append(m_rxmodemq.dequeue()); } +#if !defined(Q_OS_IOS) m_modem->write(out); +#endif } cnt = 0; } @@ -937,12 +947,14 @@ void DMRCodec::process_rx_data() ambe[i] = m_rxcodecq.dequeue(); } if(m_hwrx){ +#if !defined(Q_OS_IOS) m_ambedev->decode(ambe); if(m_ambedev->get_audio(pcm)){ m_audio->write(pcm, 160); emit update_output_level(m_audio->level()); } +#endif } else{ if(m_modeinfo.sw_vocoder_loaded){ diff --git a/droidstar.cpp b/droidstar.cpp index 11500b7..d8d7a64 100644 --- a/droidstar.cpp +++ b/droidstar.cpp @@ -121,7 +121,7 @@ void DroidStar::discover_devices() m_modems.append("None"); m_playbacks.append(AudioEngine::discover_audio_devices(AUDIO_OUT)); m_captures.append(AudioEngine::discover_audio_devices(AUDIO_IN)); - +#if !defined(Q_OS_IOS) QMap l = SerialAMBE::discover_devices(); QMap::const_iterator i = l.constBegin(); @@ -130,6 +130,7 @@ void DroidStar::discover_devices() m_modems.append(i.value()); ++i; } +#endif } void DroidStar::download_file(QString f, bool u) diff --git a/m17codec.cpp b/m17codec.cpp index f54bbf9..25394b1 100755 --- a/m17codec.cpp +++ b/m17codec.cpp @@ -231,12 +231,14 @@ void M17Codec::process_udp() m_modeinfo.status = CONNECTED_RW; if(m_modemport != ""){ +#if !defined(Q_OS_IOS) m_modem = new SerialModem("M17"); m_modem->set_modem_flags(m_rxInvert, m_txInvert, m_pttInvert, m_useCOSAsLockout, m_duplex); 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); 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))); +#endif } #ifndef USE_EXTERNAL_CODEC2 m_c2 = new CCodec2(true); @@ -366,12 +368,14 @@ void M17Codec::hostname_lookup(QHostInfo i) void M17Codec::mmdvm_direct_connect() { if(m_modemport != ""){ +#if !defined(Q_OS_IOS) m_modem = new SerialModem("M17"); m_modem->set_modem_flags(m_rxInvert, m_txInvert, m_pttInvert, m_useCOSAsLockout, m_duplex); 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); 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))); +#endif if(m_modeinfo.status == CONNECTING){ m_modeinfo.status = CONNECTED_RW; } @@ -946,7 +950,9 @@ void M17Codec::process_rx_data() for(int i = 0; i < s; ++i){ out.append(m_rxmodemq.dequeue()); } +#if !defined(Q_OS_IOS) m_modem->write(out); +#endif } cnt = 0; } diff --git a/main.cpp b/main.cpp index fcbe352..7dc2edf 100644 --- a/main.cpp +++ b/main.cpp @@ -25,6 +25,7 @@ int main(int argc, char *argv[]) { + //QCoreApplication::setAttribute(Qt::AA_UseOpenGLES); QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QGuiApplication app(argc, argv); diff --git a/nxdncodec.cpp b/nxdncodec.cpp index cbaa94e..44be152 100755 --- a/nxdncodec.cpp +++ b/nxdncodec.cpp @@ -84,10 +84,12 @@ void NXDNCodec::process_udp() m_hwrx = true; m_hwtx = true; m_modeinfo.hw_vocoder_loaded = true; +#if !defined(Q_OS_IOS) m_ambedev = new SerialAMBE("NXDN"); m_ambedev->connect_to_serial(m_vocoder); connect(m_ambedev, SIGNAL(connected(bool)), this, SLOT(ambe_connect_status(bool))); connect(m_ambedev, SIGNAL(data_ready()), this, SLOT(get_ambe())); +#endif } else{ m_hwrx = false; @@ -310,7 +312,9 @@ void NXDNCodec::transmit() } if(m_hwtx){ +#if !defined(Q_OS_IOS) m_ambedev->encode(pcm); +#endif } else{ if(m_modeinfo.sw_vocoder_loaded){ @@ -655,6 +659,7 @@ void NXDNCodec::encode_crc6(uint8_t *d, uint8_t len) void NXDNCodec::get_ambe() { +#if !defined(Q_OS_IOS) uint8_t ambe[7]; if(m_ambedev->get_ambe(ambe)){ @@ -662,6 +667,7 @@ void NXDNCodec::get_ambe() m_txcodecq.append(ambe[i]); } } +#endif } void NXDNCodec::process_rx_data() @@ -683,12 +689,14 @@ void NXDNCodec::process_rx_data() ambe[i] = m_rxcodecq.dequeue(); } if(m_hwrx){ +#if !defined(Q_OS_IOS) m_ambedev->decode(ambe); if(m_ambedev->get_audio(pcm)){ m_audio->write(pcm, 160); emit update_output_level(m_audio->level()); } +#endif } else{ if(m_modeinfo.sw_vocoder_loaded){ diff --git a/refcodec.cpp b/refcodec.cpp index d8971ff..2cf050e 100755 --- a/refcodec.cpp +++ b/refcodec.cpp @@ -94,22 +94,26 @@ void REFCodec::process_udp() m_hwrx = true; m_hwtx = true; m_modeinfo.hw_vocoder_loaded = true; +#if !defined(Q_OS_IOS) m_ambedev = new SerialAMBE("REF"); m_ambedev->connect_to_serial(m_vocoder); connect(m_ambedev, SIGNAL(connected(bool)), this, SLOT(ambe_connect_status(bool))); connect(m_ambedev, SIGNAL(data_ready()), this, SLOT(get_ambe())); +#endif } else{ m_hwrx = false; m_hwtx = false; } if(m_modemport != ""){ +#if !defined(Q_OS_IOS) m_modem = new SerialModem("REF"); m_modem->set_modem_flags(m_rxInvert, m_txInvert, m_pttInvert, m_useCOSAsLockout, m_duplex); 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); 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))); +#endif } m_rxtimer = new QTimer(); connect(m_rxtimer, SIGNAL(timeout()), this, SLOT(process_rx_data())); @@ -442,7 +446,9 @@ void REFCodec::transmit() } if(m_hwtx){ +#if !defined(Q_OS_IOS) m_ambedev->encode(pcm); +#endif if(m_tx && (m_txcodecq.size() >= 9)){ for(int i = 0; i < 9; ++i){ ambe[i] = m_txcodecq.dequeue(); @@ -633,6 +639,7 @@ void REFCodec::send_frame(uint8_t *ambe) void REFCodec::get_ambe() { +#if !defined(Q_OS_IOS) uint8_t ambe[9]; if(m_ambedev->get_ambe(ambe)){ @@ -640,6 +647,7 @@ void REFCodec::get_ambe() m_txcodecq.append(ambe[i]); } } +#endif } void REFCodec::process_rx_data() @@ -672,12 +680,14 @@ void REFCodec::process_rx_data() ambe[i] = m_rxcodecq.dequeue(); } if(m_hwrx){ +#if !defined(Q_OS_IOS) m_ambedev->decode(ambe); if(m_ambedev->get_audio(pcm)){ m_audio->write(pcm, 160); emit update_output_level(m_audio->level()); } +#endif } else{ if(m_modeinfo.sw_vocoder_loaded){ diff --git a/xrfcodec.cpp b/xrfcodec.cpp index fd81e72..73b00f5 100755 --- a/xrfcodec.cpp +++ b/xrfcodec.cpp @@ -65,18 +65,22 @@ void XRFCodec::process_udp() m_hwrx = true; m_hwtx = true; m_modeinfo.hw_vocoder_loaded = true; +#if !defined(Q_OS_IOS) m_ambedev = new SerialAMBE("XRF"); m_ambedev->connect_to_serial(m_vocoder); connect(m_ambedev, SIGNAL(connected(bool)), this, SLOT(ambe_connect_status(bool))); connect(m_ambedev, SIGNAL(data_ready()), this, SLOT(get_ambe())); +#endif } if(m_modemport != ""){ +#if !defined(Q_OS_IOS) m_modem = new SerialModem("XRF"); m_modem->set_modem_flags(m_rxInvert, m_txInvert, m_pttInvert, m_useCOSAsLockout, m_duplex); 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); 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))); +#endif } m_rxtimer = new QTimer(); connect(m_rxtimer, SIGNAL(timeout()), this, SLOT(process_rx_data())); @@ -393,7 +397,9 @@ void XRFCodec::transmit() } } if(m_hwtx){ +#if !defined(Q_OS_IOS) m_ambedev->encode(pcm); +#endif if(m_tx && (m_txcodecq.size() >= 9)){ for(int i = 0; i < 9; ++i){ ambe[i] = m_txcodecq.dequeue(); @@ -566,6 +572,7 @@ void XRFCodec::send_frame(uint8_t *ambe) void XRFCodec::get_ambe() { +#if !defined(Q_OS_IOS) uint8_t ambe[9]; if(m_ambedev->get_ambe(ambe)){ @@ -573,6 +580,7 @@ void XRFCodec::get_ambe() m_txcodecq.append(ambe[i]); } } +#endif } void XRFCodec::process_rx_data() @@ -596,7 +604,9 @@ void XRFCodec::process_rx_data() for(int i = 0; i < s; ++i){ out.append(m_rxmodemq.dequeue()); } +#if !defined(Q_OS_IOS) m_modem->write(out); +#endif } } @@ -605,12 +615,14 @@ void XRFCodec::process_rx_data() ambe[i] = m_rxcodecq.dequeue(); } if(m_hwrx){ +#if !defined(Q_OS_IOS) m_ambedev->decode(ambe); if(m_ambedev->get_audio(pcm)){ m_audio->write(pcm, 160); emit update_output_level(m_audio->level()); } +#endif } else{ if(m_modeinfo.sw_vocoder_loaded){ diff --git a/ysfcodec.cpp b/ysfcodec.cpp index 42a344b..dc0dc69 100755 --- a/ysfcodec.cpp +++ b/ysfcodec.cpp @@ -147,10 +147,12 @@ void YSFCodec::process_udp() m_hwrx = true; m_hwtx = true; m_modeinfo.hw_vocoder_loaded = true; +#if !defined(Q_OS_IOS) m_ambedev = new SerialAMBE("YSF"); m_ambedev->connect_to_serial(m_vocoder); connect(m_ambedev, SIGNAL(connected(bool)), this, SLOT(ambe_connect_status(bool))); connect(m_ambedev, SIGNAL(data_ready()), this, SLOT(get_ambe())); +#endif } else{ m_hwrx = false; @@ -158,12 +160,14 @@ void YSFCodec::process_udp() } if(m_modemport != ""){ +#if !defined(Q_OS_IOS) m_modem = new SerialModem("YSF"); m_modem->set_modem_flags(m_rxInvert, m_txInvert, m_pttInvert, m_useCOSAsLockout, m_duplex); 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); 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))); +#endif } m_audio = new AudioEngine(m_audioin, m_audioout); @@ -689,7 +693,9 @@ void YSFCodec::transmit() } } if(m_hwtx && !m_txfullrate){ +#if !defined(Q_OS_IOS) m_ambedev->encode(pcm); +#endif } else{ if(m_txfullrate){ @@ -730,16 +736,18 @@ void YSFCodec::send_frame() if(m_tx){ m_modeinfo.stream_state = TRANSMITTING; + if(!m_txcnt){ encode_header(); } else{ m_txfullrate ? encode_vw() : encode_dv2(); } - ++m_txcnt; + frame_size = ::memcmp(m_ysfFrame, "YSFD", 4) ? 130 : 155; txdata.append((char *)m_ysfFrame, frame_size); m_udp->writeDatagram(txdata, m_address, m_modeinfo.port); + ++m_txcnt; #ifdef DEBUG fprintf(stderr, "SEND:%d: ", txdata.size()); for(int i = 0; i < txdata.size(); ++i){ @@ -1287,6 +1295,7 @@ void YSFCodec::writeVDMode2Data(uint8_t* data, const uint8_t* dt) void YSFCodec::get_ambe() { +#if !defined(Q_OS_IOS) uint8_t ambe[7]; if(m_ambedev->get_ambe(ambe)){ @@ -1294,6 +1303,7 @@ void YSFCodec::get_ambe() m_txcodecq.append(ambe[i]); } } +#endif } void YSFCodec::process_rx_data() @@ -1317,7 +1327,9 @@ void YSFCodec::process_rx_data() for(int i = 0; i < s; ++i){ out.append(m_rxmodemq.dequeue()); } +#if !defined(Q_OS_IOS) m_modem->write(out); +#endif } cnt = 0; } @@ -1336,12 +1348,14 @@ void YSFCodec::process_rx_data() ambe[i] = m_rxcodecq.dequeue(); } if(m_hwrx){ +#if !defined(Q_OS_IOS) m_ambedev->decode(ambe); if(m_ambedev->get_audio(pcm)){ m_audio->write(pcm, 160); emit update_output_level(m_audio->level()); } +#endif } else{ if(m_modeinfo.sw_vocoder_loaded){