Skip to content

Commit

Permalink
Adding zeromq stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
jeroenbeijer committed Jul 20, 2021
1 parent 246f2cb commit 7802baa
Show file tree
Hide file tree
Showing 33 changed files with 2,458 additions and 126 deletions.
22 changes: 22 additions & 0 deletions JAERO/.qmake.stash
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
QMAKE_CXX.QT_COMPILER_STDCXX = 201402L
QMAKE_CXX.QMAKE_GCC_MAJOR_VERSION = 9
QMAKE_CXX.QMAKE_GCC_MINOR_VERSION = 2
QMAKE_CXX.QMAKE_GCC_PATCH_VERSION = 0
QMAKE_CXX.COMPILER_MACROS = \
QT_COMPILER_STDCXX \
QMAKE_GCC_MAJOR_VERSION \
QMAKE_GCC_MINOR_VERSION \
QMAKE_GCC_PATCH_VERSION
QMAKE_CXX.INCDIRS = \
C:/msys64/mingw64/include/c++/9.2.0 \
C:/msys64/mingw64/include/c++/9.2.0/x86_64-w64-mingw32 \
C:/msys64/mingw64/include/c++/9.2.0/backward \
C:/msys64/mingw64/lib/gcc/x86_64-w64-mingw32/9.2.0/include \
C:/msys64/mingw64/include \
C:/msys64/mingw64/lib/gcc/x86_64-w64-mingw32/9.2.0/include-fixed \
C:/msys64/mingw64/x86_64-w64-mingw32/include
QMAKE_CXX.LIBDIRS = \
C:/msys64/mingw64/lib/gcc/x86_64-w64-mingw32/9.2.0 \
C:/msys64/mingw64/lib/gcc \
C:/msys64/mingw64/x86_64-w64-mingw32/lib \
C:/msys64/mingw64/lib
84 changes: 70 additions & 14 deletions JAERO/JAERO.pro
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ TARGET = JAERO
TEMPLATE = app

INSTALL_PATH = /opt/jaero
JFFT_PATH = ../../JFFT/
JFFT_PATH = C:/work/git_repos/JFFT/
EXT_DEP_PATH=C:/work/svn/JAERO

QMAKE_CXXFLAGS += -std=c++11

Expand Down Expand Up @@ -85,7 +86,9 @@ SOURCES += mainwindow.cpp \
$$JFFT_PATH/jfft.cpp \
util/stdio_utils.cpp \
util/file_utils.cpp \
util/RuntimeError.cpp
util/RuntimeError.cpp\
audioreceiver.cpp


HEADERS += mainwindow.h \
coarsefreqestimate.h \
Expand Down Expand Up @@ -119,18 +122,10 @@ HEADERS += mainwindow.h \
$$JFFT_PATH/jfft.h \
util/stdio_utils.h \
util/file_utils.h \
util/RuntimeError.h
util/RuntimeError.h\
audioreceiver.h


# Tell the qcustomplot header that it will be used as library:
DEFINES += QCUSTOMPLOT_USE_LIBRARY
#qcustom plot is called different names on different systems
win32 {
#message("windows")
LIBS += -lqcustomplot2
} else {
#message("not windows")
LIBS += -lqcustomplot
}

FORMS += mainwindow.ui \
gui_classes/settingsdialog.ui \
Expand Down Expand Up @@ -158,8 +153,46 @@ QMAKE_CXXFLAGS_RELEASE += -O3
# add the desired -O3 if not present
#QMAKE_CXXFLAGS_RELEASE *= -O3



win32 {
#on windows the libcorrect dlls are here
INCLUDEPATH +=$$EXT_DEP_PATH/libcorrect/include
contains(QT_ARCH, i386) {
#message("32-bit")
LIBS += -L$$EXT_DEP_PATH/libcorrect/lib/32
} else {
#message("64-bit")
LIBS += -L$$EXT_DEP_PATH/libcorrect/lib/64
}
LIBS += -llibcorrect
}

win32 {
# libacars support
INCLUDEPATH +=$$EXT_DEP_PATH/libacars-2.1.2
LIBS += -L$$EXT_DEP_PATH/libacars-2.1.2/build/libacars
#in windows use the dynamic lib rather than the static one even when stattically compiling

LIBS += -lacars-2.dll
} else {
LIBS += -lacars-2
}

win32: LIBS += -L$$EXT_DEP_PATH/libzmq/lib/ -llibzmq-v120-mt-4_0_4

INCLUDEPATH += $$EXT_DEP_PATH/libzmq/include
DEPENDPATH += $$EXT_DEP_PATH/libzmq/include

#for static building order seems to matter
LIBS += -lcorrect -lvorbis -lvorbisenc -logg


#for audio compressor
#for static building order seems to matter
LIBS += -lcorrect -lvorbis -lvorbisenc -logg -lacars
INCLUDEPATH += $$EXT_DEP_PATH/libvorbis-1.3.6/include
LIBS += -L$$EXT_DEP_PATH/libvorbis-1.3.6/lib/.libs -lvorbis -lvorbisenc
LIBS += -L$$EXT_DEP_PATH/libogg-1.3.3/src/.libs -logg

#desktop
desktop.path = /usr/share/applications
Expand All @@ -185,3 +218,26 @@ INSTALLS += target
QMAKE_CXXFLAGS += '-Wno-deprecated-copy'

#QMAKE_CXXFLAGS += '-Werror=format-security'

win32: LIBS += -L$$PWD/../../../svn/build-qcustomplot-Desktop_Qt_MinGW_w64_64bit_MSYS2-Release/release/ -lqcustomplot

INCLUDEPATH += $$PWD/../../../svn/qcustomplot
DEPENDPATH += $$PWD/../../../svn/qcustomplot

win32:!win32-g++: PRE_TARGETDEPS += $$PWD/../../../svn/build-qcustomplot-Desktop_Qt_MinGW_w64_64bit_MSYS2-Release/release/qcustomplot.lib
else:win32-g++: PRE_TARGETDEPS += $$PWD/../../../svn/build-qcustomplot-Desktop_Qt_MinGW_w64_64bit_MSYS2-Release/release/libqcustomplot.a

#define where we store everything so when using the command line we don't make the main directory messy.
CONFIG(debug, debug|release) {
DESTDIR = $$PWD/debug
OBJECTS_DIR = $$PWD/tmp/debug/stuff
MOC_DIR = $$PWD/tmp/debug/stuff
UI_DIR = $$PWD/tmp/debug/stuff
RCC_DIR = $$PWD/tmp/debug/stuff
} else {
DESTDIR = $$PWD/release
OBJECTS_DIR = $$PWD/tmp/release/stuff
MOC_DIR = $$PWD/tmp/release/stuff
UI_DIR = $$PWD/tmp/release/stuff
RCC_DIR = $$PWD/tmp/release/stuff
}
38 changes: 31 additions & 7 deletions JAERO/aerol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1407,8 +1407,6 @@ QByteArray &AeroL::Decode(QVector<short> &bits, bool soft)//0 bit --> oldest bit

uchar SEQINDICATOR=((byte1&0xF0)>>4);
uchar SUTYPE=byte1&0x0F;
uchar QNO=((byte2&0xF0)>>4);
uchar REFNO=byte2&0x07;
quint32 AESID=byte3<<8*2|byte4<<8*1|byte5<<8*0;
int GES=byte6;

Expand Down Expand Up @@ -1446,8 +1444,6 @@ QByteArray &AeroL::Decode(QVector<short> &bits, bool soft)//0 bit --> oldest bit

int BytesInSU=0;
if((SUTYPE>=1)&&(SUTYPE<=11))BytesInSU=SUTYPE;
bool SignalingInfoSU=false;
if(SUTYPE==15)SignalingInfoSU=true;

decline+=((QString)" SU %1 of %2. AES: %3 GES: %4").arg(SUindex+1).arg(SUTotal).arg((((QString)"%1").arg(AESID,6, 16, QChar('0'))).toUpper()).arg((((QString)"%1").arg(GES,2, 16, QChar('0'))).toUpper()) ;
/*decline+=" \"";
Expand Down Expand Up @@ -1735,6 +1731,10 @@ QByteArray &AeroL::Decode(QVector<short> &bits, bool soft)//0 bit --> oldest bit
break;
case Log_on_confirm:
decline+="Log_on_confirm";

{
SendLogOnOff(k, "Log on confirm");
}
break;
case Log_control_P_channel_log_off_request:
decline+="Log_control_P_channel_log_off_request";
Expand Down Expand Up @@ -2166,9 +2166,21 @@ void AeroL::SendCAssignment(int k, QString decline)
QString beam = " Global Beam ";
if(byte7&0x80)beam=" Spot Beam ";

item.message = "Receive Freq: " + receive + beam + "Transmit " + transmit + "\r\n" + decline;
emit ACARSsignal(item);
}
void AeroL::SendLogOnOff(int k, QString text)
{
ACARSItem item;
item.isuitem.AESID=((uchar)infofield[k*12-1+2])<<8*2|((uchar)infofield[k*12-1+3])<<8*1|((uchar)infofield[k*12-1+4])<<8*0;
item.isuitem.GESID=infofield[k*12-1+5];

item.hastext = true;
item.downlink = true;
item.nonacars = true;
item.valid = true;

item.message = "Receive Freq: " + receive + beam + "Transmit " + transmit + "\r\n" + decline;
item.message = text;
emit ACARSsignal(item);
}

Expand All @@ -2182,6 +2194,8 @@ QByteArray &AeroL::DecodeC(QVector<short> &bits)
quint16 bit=0;
quint16 soft_bit=0;

QString hex = "000000";

for(int i=0;i<bits.size();i++)
{

Expand Down Expand Up @@ -2394,6 +2408,14 @@ QByteArray &AeroL::DecodeC(QVector<short> &bits)
decline+=" GES = "+infofield.mid(4,1).toHex().toUpper();
decline+=" Call_progress \r\n";
emit Call_progress_Signal(infofield);

QString thex = infofield.mid(1,3).toHex().toUpper();

if(thex.length() == 6)
{
hex = thex;
}

}
break;

Expand Down Expand Up @@ -2457,13 +2479,15 @@ QByteArray &AeroL::DecodeC(QVector<short> &bits)
}
}

// send for external decoding
emit Voicesignal(data, hex);

//25 primary fields. this is where the audio lives in a compressed format
for(int i=0;i<25;i++)
{
emit Voicesignal(data.mid(i*12,12));//send one frame at a time
emit Voicesignal(data.mid(i*12,12));//send one frame at a time
}


// reset for next block
index = -1;
}// end of frame
Expand Down
58 changes: 41 additions & 17 deletions JAERO/aerol.h
Original file line number Diff line number Diff line change
Expand Up @@ -397,26 +397,47 @@ class AeroLScrambler
public:
AeroLScrambler()
{
reset();
}
void reset()
{
QVector<int> state;
position=0;
pre_state.resize(5000);
int tmp[]={1,1,0,1,0,0,1,0,1,0,1,1,0,0,1,-1};
state.clear();
for(int i=0;tmp[i]>=0;i++)state.push_back(tmp[i]);


// populate the vector so we can reuse it
for(int a = 0; a<5000;a++)
{

int val0 = state.at(0)^state.at(14);
pre_state[a]=val0;
for(int i=state.size()-1;i>0;i--)
{
state[i]=state.at(i-1);
}
state[0] =val0;

}
}

void update(QVector<int> &data)
{
for(int j=0;j<data.size();j++)
{
int val0=state.at(0)^state.at(14);
data[j] = data.at(j)^val0;
for(int i=state.size()-1;i>0;i--)state[i]=state.at(i-1);
state[0]=val0;
data[j] = data.at(j)^pre_state.at(position);
position++;
}

}
void reset()
{

position = 0;
}
private:
QVector<int> state;

QVector<int> pre_state;
int position;
};

class PuncturedCode
Expand Down Expand Up @@ -626,7 +647,7 @@ class RTChannelDeleaveFECScram
bool cont = false;


if((((blockptr-(64*5))%(64*3))==0) && (blockptr /64 == 5 || blockptr /64 == targetBlocks || blockptr/64 == 8 || blockptr/64 == 50))
if((((blockptr-(64*5))%(64*3))==0) && (blockptr /64 == 5 || blockptr /64 == targetBlocks || blockptr/64 == 11 || blockptr/64 == 50))
{
cont = true;
}
Expand Down Expand Up @@ -666,6 +687,10 @@ class RTChannelDeleaveFECScram
lastpacketstate=OK_R_Packet;

return OK_R_Packet;
}else{

return Nothing;

}
}

Expand All @@ -682,11 +707,7 @@ class RTChannelDeleaveFECScram
else
{

if(blockptr/64 ==5){
return Nothing;
}

if(blockptr/64 == 8){
if(blockptr/64 == 11){

// we should be able to peek at the SU after the initial SU and figure out the number of SU's in this
// burst
Expand All @@ -703,15 +724,15 @@ class RTChannelDeleaveFECScram

}

targetBlocks = (targetSUSize*3) +2;
targetBlocks = ((targetSUSize+1)*3) +2;

return Nothing;
}

// this should be the target blocks for this T packet
if(blockptr/64 == targetBlocks)
{
for(int i=0;i<targetSUSize;i++)
for(int i=0;i<targetSUSize-3;i++)
{
crcok=crc16.calcusingbitsandcheck(deconvol.data()+(8*6)+(8*12)*i,8*12);

Expand Down Expand Up @@ -890,6 +911,7 @@ class AeroL : public QIODevice
void DataCarrierDetect(bool status);
void ACARSsignal(ACARSItem &acarsitem);
void Errorsignal(QString &error);
void Voicesignal(QByteArray &data, QString &hex);
void Voicesignal(const QByteArray &data);
void CChannelAssignmentSignal(CChannelAssignmentItem &item);
void Call_progress_Signal(QByteArray infofield);
Expand All @@ -915,6 +937,8 @@ public slots:
bool Start();
void Stop();
void SendCAssignment(int k, QString decline);
void SendLogOnOff(int k, QString text);

CChannelAssignmentItem CreateCAssignmentItem(QByteArray su);
QByteArray &Decode(QVector<short> &bits, bool soft = false);
QByteArray &DecodeC(QVector<short> &bits);
Expand Down
7 changes: 7 additions & 0 deletions JAERO/audioburstmskdemodulator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,19 @@ AudioBurstMskDemodulator::AudioBurstMskDemodulator(QObject *parent)
void AudioBurstMskDemodulator::start()
{
BurstMskDemodulator::start();
if(!settings.zmqAudio)
{
if(m_audioInput)m_audioInput->start(this);
}
}

void AudioBurstMskDemodulator::stop()
{
if(!settings.zmqAudio)
{
if(m_audioInput)m_audioInput->stop();

}
BurstMskDemodulator::stop();
}

Expand Down
Loading

0 comments on commit 7802baa

Please sign in to comment.