mirror of
https://github.com/JvanKatwijk/dab-cmdline
synced 2025-10-05 23:52:50 +02:00
test version with file input
This commit is contained in:
11
README.md
11
README.md
@@ -170,6 +170,17 @@ The API
|
||||
The API specification, in dab-api.h, contains a specification of the
|
||||
types for the callback functions and a specification for the real API functions.
|
||||
===============================================================================
|
||||
E X P E R I M E N T A L
|
||||
|
||||
One of the issues still to be resolved is the handling of data. As an
|
||||
experiment a callback fnction was added that is called from within the
|
||||
tdc handler. In example-2 a simple TCP server was added, one that just
|
||||
writes out packaged tdc frames.
|
||||
The package structure is : an 8 byte header followed by the frame data.
|
||||
The header starts with a -1 0 -1 0 pattern, followed by a two byte length,
|
||||
followed by a zero, followed by a 0 for frametype 0 and 0xFF for frametype 1.
|
||||
|
||||
A simple "reader" (client), using qt is included in the sources.
|
||||
|
||||
Copyright (C) 2016, 2017
|
||||
Jan van Katwijk (J.vanKatwijk@gmail.com)
|
||||
|
@@ -114,6 +114,10 @@ typedef struct {
|
||||
// dynamic label data, embedded in the audio stream, is sent as string
|
||||
typedef void (*dataOut_t)(std::string, void *);
|
||||
//
|
||||
// byte oriented data, emitted by various dataHandlers, is sent
|
||||
// as array of uint8_t values (packed bytes)
|
||||
typedef void (*bytesOut_t)(uint8_t *, int16_t, void *);
|
||||
|
||||
// the quality of the DAB data is reflected in 1 number in case
|
||||
// of DAB, and 3 in case of DAB+,
|
||||
// the first number indicates the percentage of dab packages that
|
||||
@@ -155,6 +159,7 @@ void *dabInit (deviceHandler *,
|
||||
fib_quality_t fib_qualityHandler,
|
||||
audioOut_t audioOut_Handler,
|
||||
dataOut_t dataOut_Handler,
|
||||
bytesOut_t bytesOut,
|
||||
programdata_t programdataHandler,
|
||||
programQuality_t program_qualityHandler,
|
||||
void *userData);
|
||||
|
@@ -29,6 +29,7 @@
|
||||
|
||||
#include <stdint.h>
|
||||
#include <complex>
|
||||
#include <thread>
|
||||
using namespace std;
|
||||
|
||||
class deviceHandler {
|
||||
@@ -53,6 +54,7 @@ protected:
|
||||
int32_t lastFrequency;
|
||||
int32_t vfoOffset;
|
||||
int theGain;
|
||||
virtual void run (void);
|
||||
};
|
||||
#endif
|
||||
|
||||
|
@@ -47,6 +47,8 @@ bool deviceHandler::restartReader (void) {
|
||||
void deviceHandler::stopReader (void) {
|
||||
}
|
||||
|
||||
void deviceHandler::run (void) {
|
||||
}
|
||||
|
||||
int32_t deviceHandler::getSamples (std::complex<float> *v,
|
||||
int32_t amount) {
|
||||
|
151
devices/wavfiles/wavfiles.cpp
Normal file
151
devices/wavfiles/wavfiles.cpp
Normal file
@@ -0,0 +1,151 @@
|
||||
#
|
||||
/*
|
||||
* Copyright (C) 2013 .. 2017
|
||||
* Jan van Katwijk (J.vanKatwijk@gmail.com)
|
||||
* Lazy Chair Computing
|
||||
*
|
||||
* This file is part of the DAB library
|
||||
* DAB library is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* DAB library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with DAB library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/time.h>
|
||||
#include <time.h>
|
||||
#include <cstring>
|
||||
#include "wavfiles.h"
|
||||
|
||||
static inline
|
||||
int64_t getMyTime (void) {
|
||||
struct timeval tv;
|
||||
|
||||
gettimeofday (&tv, NULL);
|
||||
return ((int64_t)tv. tv_sec * 1000000 + (int64_t)tv. tv_usec);
|
||||
}
|
||||
|
||||
#define __BUFFERSIZE 8 * 32768
|
||||
|
||||
wavFiles::wavFiles (std::string f) {
|
||||
SF_INFO *sf_info;
|
||||
|
||||
fileName = f;
|
||||
_I_Buffer = new RingBuffer<std::complex<float>>(__BUFFERSIZE);
|
||||
|
||||
sf_info = (SF_INFO *)alloca (sizeof (SF_INFO));
|
||||
sf_info -> format = 0;
|
||||
filePointer = sf_open (f. c_str (), SFM_READ, sf_info);
|
||||
if (filePointer == NULL) {
|
||||
fprintf (stderr, "file %s no legitimate sound file\n",
|
||||
f. c_str ());
|
||||
throw (24);
|
||||
}
|
||||
if ((sf_info -> samplerate != 2048000) ||
|
||||
(sf_info -> channels != 2)) {
|
||||
fprintf (stderr, "This is not a recorded DAB file, sorry\n");
|
||||
sf_close (filePointer);
|
||||
throw (25);
|
||||
}
|
||||
currPos = 0;
|
||||
running. store (false);
|
||||
}
|
||||
|
||||
wavFiles::~wavFiles (void) {
|
||||
if (running. load ())
|
||||
workerHandle. join ();
|
||||
running. store (false);
|
||||
sf_close (filePointer);
|
||||
delete _I_Buffer;
|
||||
}
|
||||
|
||||
bool wavFiles::restartReader (void) {
|
||||
workerHandle = std::thread (wavFiles::run, this);
|
||||
return true;
|
||||
}
|
||||
|
||||
void wavFiles::stopReader (void) {
|
||||
if (running. load ())
|
||||
workerHandle. join ();
|
||||
running. store (false);
|
||||
}
|
||||
//
|
||||
// size is in I/Q pairs
|
||||
// Note that the caller ensures that there are sufficient samples
|
||||
// in the buffer
|
||||
int32_t wavFiles::getSamples (std::complex<float> *V, int32_t size) {
|
||||
int32_t amount;
|
||||
if (filePointer == NULL)
|
||||
return 0;
|
||||
if (!running. load ())
|
||||
return 0;
|
||||
amount = _I_Buffer -> getDataFromBuffer (V, size);
|
||||
return amount;
|
||||
}
|
||||
|
||||
int32_t wavFiles::Samples (void) {
|
||||
return _I_Buffer -> GetRingBufferReadAvailable ();
|
||||
}
|
||||
//
|
||||
// The actual interface to the filereader is in a separate thread
|
||||
void wavFiles::run (wavFiles *p) {
|
||||
int32_t t, i;
|
||||
std::complex<float> *bi;
|
||||
int32_t bufferSize = 32768;
|
||||
int64_t period;
|
||||
int64_t nextStop;
|
||||
|
||||
p -> running. store (true);
|
||||
period = (32768 * 1000) / 2048; // full IQś read
|
||||
fprintf (stderr, "Period = %ld\n", period);
|
||||
bi = new std::complex<float> [bufferSize];
|
||||
nextStop = getMyTime ();
|
||||
while (p -> running. load ()) {
|
||||
while (p -> _I_Buffer -> WriteSpace () < bufferSize) {
|
||||
if (!p -> running. load ())
|
||||
break;
|
||||
usleep (100);
|
||||
}
|
||||
|
||||
nextStop += period;
|
||||
t = p -> readBuffer (bi, bufferSize);
|
||||
if (t < bufferSize) {
|
||||
for (i = t; i < bufferSize; i ++)
|
||||
bi [i] = 0;
|
||||
t = bufferSize;
|
||||
}
|
||||
p -> _I_Buffer -> putDataIntoBuffer (bi, bufferSize);
|
||||
if (nextStop - getMyTime () > 0)
|
||||
usleep (nextStop - getMyTime ());
|
||||
}
|
||||
fprintf (stderr, "taak voor replay eindigt hier\n");
|
||||
delete [] bi;
|
||||
}
|
||||
/*
|
||||
* length is number of uints that we read.
|
||||
*/
|
||||
int32_t wavFiles::readBuffer (std::complex<float> *data, int32_t length) {
|
||||
int32_t i, n;
|
||||
float temp [2 * length];
|
||||
|
||||
n = sf_readf_float (filePointer, temp, length);
|
||||
if (n < length) {
|
||||
sf_seek (filePointer, 0, SEEK_SET);
|
||||
fprintf (stderr, "End of file, restarting\n");
|
||||
}
|
||||
for (i = 0; i < n; i ++)
|
||||
data [i] = std::complex<float> (temp [2 * i], temp [2 * i + 1]);
|
||||
return n & ~01;
|
||||
}
|
||||
|
55
devices/wavfiles/wavfiles.h
Normal file
55
devices/wavfiles/wavfiles.h
Normal file
@@ -0,0 +1,55 @@
|
||||
#
|
||||
/*
|
||||
* Copyright (C) 2013 .. 2017
|
||||
* Jan van Katwijk (J.vanKatwijk@gmail.com)
|
||||
* Lazy Chair Computing
|
||||
*
|
||||
* This file is part of the Qt-DAB program
|
||||
* Qt-DAB is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Qt-DAB is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Qt-DAB; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
#ifndef __WAV_FILES__
|
||||
#define __WAV_FILES__
|
||||
|
||||
#include <sndfile.h>
|
||||
#include "ringbuffer.h"
|
||||
#include "device-handler.h"
|
||||
#include <thread>
|
||||
#include <atomic>
|
||||
|
||||
|
||||
class wavFiles: public deviceHandler {
|
||||
public:
|
||||
wavFiles (std::string);
|
||||
~wavFiles (void);
|
||||
int32_t getSamples (std::complex<float> *, int32_t);
|
||||
uint8_t myIdentity (void);
|
||||
int32_t Samples (void);
|
||||
bool restartReader (void);
|
||||
void stopReader (void);
|
||||
|
||||
private:
|
||||
std::string fileName;
|
||||
static void run (wavFiles *);
|
||||
int32_t readBuffer (std::complex<float> *, int32_t);
|
||||
RingBuffer<std::complex<float>> *_I_Buffer;
|
||||
std::thread workerHandle;
|
||||
int32_t bufferSize;
|
||||
SNDFILE *filePointer;
|
||||
std::atomic<bool> running;
|
||||
int64_t currPos;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@@ -2,7 +2,7 @@
|
||||
/*
|
||||
* Copyright (C) 2009, 2010, 2011
|
||||
* Jan van Katwijk (J.vanKatwijk@gmail.com)
|
||||
* Lazy Chair Programming
|
||||
* Lazy Chair Computing
|
||||
*
|
||||
* This file is part of the main program for the DAB library
|
||||
*
|
||||
|
@@ -2,7 +2,7 @@
|
||||
/*
|
||||
* Copyright (C) 2009, 2010, 2011
|
||||
* Jan van Katwijk (J.vanKatwijk@gmail.com)
|
||||
* Lazy Chair Programming
|
||||
* Lazy Chair Computing
|
||||
*
|
||||
* This file is part of the main program for the DAB library
|
||||
*
|
||||
|
@@ -2,7 +2,7 @@
|
||||
/*
|
||||
* Copyright (C) 2013, 2014, 2015, 2016, 2017
|
||||
* Jan van Katwijk (J.vanKatwijk@gmail.com)
|
||||
* Lazy Chair Programming
|
||||
* Lazy Chair Computing
|
||||
*
|
||||
* This file is part of the Qt-DAB program
|
||||
* Qt-DAB is free software; you can redistribute it and/or modify
|
||||
|
@@ -113,6 +113,13 @@ void dataOut_Handler (std::string dynamicLabel, void *ctx) {
|
||||
(void)ctx;
|
||||
// fprintf (stderr, "%s\n", dynamicLabel. c_str ());
|
||||
}
|
||||
|
||||
static
|
||||
void bytesOut_Handler (uint8_t *data, int16_t amount, void *ctx) {
|
||||
(void)data;
|
||||
(void)amount;
|
||||
(void)ctx;
|
||||
}
|
||||
//
|
||||
// The function is called from within the library with
|
||||
// a buffer full of PCM samples. We pass them on to the
|
||||
@@ -274,6 +281,7 @@ deviceHandler *theDevice;
|
||||
fibQuality,
|
||||
pcmHandler,
|
||||
dataOut_Handler,
|
||||
bytesOut_Handler,
|
||||
programdataHandler,
|
||||
mscQuality,
|
||||
NULL
|
||||
|
@@ -2,7 +2,7 @@
|
||||
/*
|
||||
* Copyright (C) 2011, 2012, 2013
|
||||
* Jan van Katwijk (J.vanKatwijk@gmail.com)
|
||||
* Lazy Chair Programming
|
||||
* Lazy Chair Computing
|
||||
*
|
||||
* This file is part of the main program of the DAB library
|
||||
*
|
||||
|
@@ -42,7 +42,14 @@ if(DEFINED RTLSDR)
|
||||
set(objectName dab-rtlsdr-2)
|
||||
endif ()
|
||||
|
||||
#
|
||||
if(DEFINED WAVFILES)
|
||||
set(WAVFILES true)
|
||||
set(objectName dab-files)
|
||||
endif ()
|
||||
|
||||
#if (DEFINED_SERVER)
|
||||
add_definitions(-DHAVE_SERVER)
|
||||
#endif
|
||||
#########################################################################
|
||||
find_package (PkgConfig)
|
||||
|
||||
@@ -161,6 +168,29 @@ endif ()
|
||||
|
||||
add_definitions (-DHAVE_RTLSDR)
|
||||
endif()
|
||||
|
||||
if (WAVFILES)
|
||||
include_directories (
|
||||
../devices/wavfiles/
|
||||
)
|
||||
|
||||
set (${objectName}_HDRS
|
||||
${${objectName}_HDRS}
|
||||
../devices/wavfiles/wavfiles.h
|
||||
)
|
||||
|
||||
set (${objectName}_SRCS
|
||||
${${objectName}_SRCS}
|
||||
../devices/wavfiles/wavfiles.cpp
|
||||
)
|
||||
find_package(LibSndFile)
|
||||
if (NOT LIBSNDFILE_FOUND)
|
||||
message(FATAL_ERROR "please install libsndfile")
|
||||
endif ()
|
||||
list(APPEND extraLibs ${LIBSNDFILE_LIBRARY})
|
||||
|
||||
add_definitions (-DHAVE_WAVFILES)
|
||||
endif()
|
||||
#######################################################################
|
||||
#
|
||||
# Here we really start
|
||||
@@ -169,6 +199,7 @@ endif ()
|
||||
${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}
|
||||
.
|
||||
./
|
||||
./server-thread
|
||||
../
|
||||
../library
|
||||
../library/includes
|
||||
@@ -189,6 +220,7 @@ endif ()
|
||||
./audio-base.h
|
||||
./audiosink.h
|
||||
./newconverter.h
|
||||
./server-thread/tcp-server.h
|
||||
../devices/device-handler.h
|
||||
../library/includes/dab-class.h
|
||||
../library/includes/dab-constants.h
|
||||
@@ -230,6 +262,7 @@ endif ()
|
||||
./audiosink.cpp
|
||||
./newconverter.cpp
|
||||
./band-handler.cpp
|
||||
./server-thread/tcp-server.cpp
|
||||
../devices/device-handler.cpp
|
||||
../library/src/dab-class.cpp
|
||||
../library/src/ofdm/ofdm-processor.cpp
|
||||
|
@@ -5,3 +5,23 @@ All callbacks are defined, most of them with an empty body.
|
||||
|
||||
Feel free to improve the program
|
||||
|
||||
Points to note:
|
||||
|
||||
bytesOut is a new callback function, a function that is called
|
||||
from the tdc handler (and later may be from others as well)
|
||||
|
||||
The data parameter is a packet with a 4 byte header
|
||||
byte 0 is 0xFF
|
||||
byte 1 is 0x00
|
||||
byte 2 is 0xFF
|
||||
byte 3 is 0x00
|
||||
byte 4 is the high byte of the 16 bit size
|
||||
byte 5 is the low byte of the 16 bit size
|
||||
byte 6 is 0x00
|
||||
byte 7 is 0 for packet type 0, 0xFF for packet type 1
|
||||
|
||||
Note that the lenngth is the length of the data part, so not taking the
|
||||
header into account
|
||||
|
||||
The bytesOut function puts the data into a simple TCP server that can be
|
||||
read from port 8888 (depending on the configuration).
|
||||
|
@@ -2,7 +2,7 @@
|
||||
/*
|
||||
* Copyright (C) 2011, 2012, 2013
|
||||
* Jan van Katwijk (J.vanKatwijk@gmail.com)
|
||||
* Lazy Chair Programming
|
||||
* Lazy Chair Computing
|
||||
*
|
||||
* This file is part of the main program for the DAB library
|
||||
*
|
||||
|
@@ -2,7 +2,7 @@
|
||||
/*
|
||||
* Copyright (C) 2009, 2010, 2011
|
||||
* Jan van Katwijk (J.vanKatwijk@gmail.com)
|
||||
* Lazy Chair Programming
|
||||
* Lazy Chair Computing
|
||||
*
|
||||
* This file is part of the main program for the DAB library
|
||||
*
|
||||
|
@@ -2,7 +2,7 @@
|
||||
/*
|
||||
* Copyright (C) 2011, 2012, 2013
|
||||
* Jan van Katwijk (J.vanKatwijk@gmail.com)
|
||||
* Lazy Chair Programming
|
||||
* Lazy Chair Computing
|
||||
*
|
||||
* This file is part of the main program of the DAB library
|
||||
*
|
||||
|
@@ -2,7 +2,7 @@
|
||||
/*
|
||||
* Copyright (C) 2009, 2010, 2011
|
||||
* Jan van Katwijk (J.vanKatwijk@gmail.com)
|
||||
* Lazy Chair Programming
|
||||
* Lazy Chair Computing
|
||||
*
|
||||
* This file is part of the main program for the DAB library
|
||||
*
|
||||
|
@@ -2,9 +2,10 @@
|
||||
/*
|
||||
* Copyright (C) 2013, 2014, 2015, 2016, 2017
|
||||
* Jan van Katwijk (J.vanKatwijk@gmail.com)
|
||||
* Lazy Chair Programming
|
||||
* Lazy Chair Computing
|
||||
*
|
||||
* This file is part of the DAB library
|
||||
*
|
||||
* DAB library is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
|
@@ -2,7 +2,7 @@
|
||||
/*
|
||||
* Copyright (C) 2013, 2014, 2015, 2016, 2017
|
||||
* Jan van Katwijk (J.vanKatwijk@gmail.com)
|
||||
* Lazy Chair Programming
|
||||
* Lazy Chair Computing
|
||||
*
|
||||
* This file is part of the Qt-DAB program
|
||||
* Qt-DAB is free software; you can redistribute it and/or modify
|
||||
|
13
example-2/client/.qmake.stash
Normal file
13
example-2/client/.qmake.stash
Normal file
@@ -0,0 +1,13 @@
|
||||
QMAKE_DEFAULT_INCDIRS = \
|
||||
/usr/include/c++/6.4.1 \
|
||||
/usr/include/c++/6.4.1/x86_64-redhat-linux \
|
||||
/usr/include/c++/6.4.1/backward \
|
||||
/usr/lib/gcc/x86_64-redhat-linux/6.4.1/include \
|
||||
/usr/local/include \
|
||||
/usr/include
|
||||
QMAKE_DEFAULT_LIBDIRS = \
|
||||
/usr/lib/gcc/x86_64-redhat-linux/6.4.1 \
|
||||
/usr/lib64 \
|
||||
/lib64 \
|
||||
/usr/lib \
|
||||
/lib
|
BIN
example-2/client/Client
Normal file
BIN
example-2/client/Client
Normal file
Binary file not shown.
593
example-2/client/Makefile
Normal file
593
example-2/client/Makefile
Normal file
@@ -0,0 +1,593 @@
|
||||
#############################################################################
|
||||
# Makefile for building: Client
|
||||
# Generated by qmake (3.0) (Qt 5.7.1)
|
||||
# Project: client.pro
|
||||
# Template: app
|
||||
# Command: /usr/bin/qmake-qt5 -o Makefile client.pro
|
||||
#############################################################################
|
||||
|
||||
MAKEFILE = Makefile
|
||||
|
||||
####### Compiler, tools and options
|
||||
|
||||
CC = gcc
|
||||
CXX = g++
|
||||
DEFINES = -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB
|
||||
CFLAGS = -pipe -O2 -Wall -W -D_REENTRANT -fPIC $(DEFINES)
|
||||
CXXFLAGS = -pipe -O2 -Wall -W -D_REENTRANT -fPIC $(DEFINES)
|
||||
INCPATH = -I. -I. -isystem /usr/include/qt5 -isystem /usr/include/qt5/QtWidgets -isystem /usr/include/qt5/QtGui -isystem /usr/include/qt5/QtNetwork -isystem /usr/include/qt5/QtCore -I. -I. -I/usr/lib64/qt5/mkspecs/linux-g++
|
||||
QMAKE = /usr/bin/qmake-qt5
|
||||
DEL_FILE = rm -f
|
||||
CHK_DIR_EXISTS= test -d
|
||||
MKDIR = mkdir -p
|
||||
COPY = cp -f
|
||||
COPY_FILE = cp -f
|
||||
COPY_DIR = cp -f -R
|
||||
INSTALL_FILE = install -m 644 -p
|
||||
INSTALL_PROGRAM = install -m 755 -p
|
||||
INSTALL_DIR = cp -f -R
|
||||
DEL_FILE = rm -f
|
||||
SYMLINK = ln -f -s
|
||||
DEL_DIR = rmdir
|
||||
MOVE = mv -f
|
||||
TAR = tar -cf
|
||||
COMPRESS = gzip -9f
|
||||
DISTNAME = Client1.0.0
|
||||
DISTDIR = /usr/shared/sdr-j-development/systems/dab-cmdline/example-2/client/.tmp/Client1.0.0
|
||||
LINK = g++
|
||||
LFLAGS = -Wl,-O1
|
||||
LIBS = $(SUBLIBS) -lQt5Widgets -lQt5Gui -lQt5Network -lQt5Core -lGL -lpthread
|
||||
AR = ar cqs
|
||||
RANLIB =
|
||||
SED = sed
|
||||
STRIP = strip
|
||||
|
||||
####### Output directory
|
||||
|
||||
OBJECTS_DIR = ./
|
||||
|
||||
####### Files
|
||||
|
||||
SOURCES = client.cpp \
|
||||
main.cpp moc_client.cpp
|
||||
OBJECTS = client.o \
|
||||
main.o \
|
||||
moc_client.o
|
||||
DIST = /usr/lib64/qt5/mkspecs/features/spec_pre.prf \
|
||||
/usr/lib64/qt5/mkspecs/common/unix.conf \
|
||||
/usr/lib64/qt5/mkspecs/common/linux.conf \
|
||||
/usr/lib64/qt5/mkspecs/common/sanitize.conf \
|
||||
/usr/lib64/qt5/mkspecs/common/gcc-base.conf \
|
||||
/usr/lib64/qt5/mkspecs/common/gcc-base-unix.conf \
|
||||
/usr/lib64/qt5/mkspecs/common/g++-base.conf \
|
||||
/usr/lib64/qt5/mkspecs/common/g++-unix.conf \
|
||||
/usr/lib64/qt5/mkspecs/qconfig.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_3dcore.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_3dcore_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_3dextras.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_3dextras_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_3dinput.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_3dinput_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_3dlogic.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_3dlogic_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_3dquick.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_3dquick_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_3dquickextras.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_3dquickextras_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_3dquickinput.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_3dquickinput_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_3dquickrender.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_3dquickrender_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_3drender.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_3drender_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_bluetooth.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_bluetooth_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_bootstrap_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_clucene_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_concurrent.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_concurrent_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_core.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_core_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_dbus.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_dbus_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_designer.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_designer_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_designercomponents_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_eglfs_device_lib_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_eglfs_kms_support_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_enginio.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_enginio_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_gui.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_gui_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_help.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_help_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_location.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_location_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_multimedia.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_multimedia_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_multimediawidgets.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_multimediawidgets_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_network.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_network_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_nfc.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_nfc_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_opengl.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_opengl_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_openglextensions.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_openglextensions_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_packetprotocol_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_platformsupport_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_positioning.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_positioning_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_printsupport.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_printsupport_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_qml.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_qml_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_qmldebug_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_qmldevtools_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_qmltest.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_qmltest_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_qtmultimediaquicktools_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_quick.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_quick_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_quickparticles_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_quickwidgets.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_quickwidgets_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_script.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_script_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_scripttools.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_scripttools_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_sensors.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_sensors_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_serialport.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_serialport_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_sql.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_sql_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_svg.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_svg_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_testlib.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_testlib_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_uiplugin.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_uitools.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_uitools_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_waylandclient.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_waylandclient_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_waylandcompositor.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_waylandcompositor_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_webchannel.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_webchannel_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_webkit.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_webkitwidgets.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_websockets.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_websockets_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_widgets.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_widgets_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_x11extras.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_x11extras_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_xcb_qpa_lib_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_xml.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_xml_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_xmlpatterns.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_xmlpatterns_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/features/qt_functions.prf \
|
||||
/usr/lib64/qt5/mkspecs/features/qt_config.prf \
|
||||
/usr/lib64/qt5/mkspecs/linux-g++/qmake.conf \
|
||||
/usr/lib64/qt5/mkspecs/features/spec_post.prf \
|
||||
.qmake.stash \
|
||||
/usr/lib64/qt5/mkspecs/features/exclusive_builds.prf \
|
||||
/usr/lib64/qt5/mkspecs/features/toolchain.prf \
|
||||
/usr/lib64/qt5/mkspecs/features/default_pre.prf \
|
||||
/usr/lib64/qt5/mkspecs/features/resolve_config.prf \
|
||||
/usr/lib64/qt5/mkspecs/features/default_post.prf \
|
||||
/usr/lib64/qt5/mkspecs/features/warn_on.prf \
|
||||
/usr/lib64/qt5/mkspecs/features/qt.prf \
|
||||
/usr/lib64/qt5/mkspecs/features/resources.prf \
|
||||
/usr/lib64/qt5/mkspecs/features/moc.prf \
|
||||
/usr/lib64/qt5/mkspecs/features/unix/opengl.prf \
|
||||
/usr/lib64/qt5/mkspecs/features/uic.prf \
|
||||
/usr/lib64/qt5/mkspecs/features/unix/thread.prf \
|
||||
/usr/lib64/qt5/mkspecs/features/file_copies.prf \
|
||||
/usr/lib64/qt5/mkspecs/features/testcase_targets.prf \
|
||||
/usr/lib64/qt5/mkspecs/features/exceptions.prf \
|
||||
/usr/lib64/qt5/mkspecs/features/yacc.prf \
|
||||
/usr/lib64/qt5/mkspecs/features/lex.prf \
|
||||
client.pro client.h \
|
||||
constants.h client.cpp \
|
||||
main.cpp
|
||||
QMAKE_TARGET = Client
|
||||
DESTDIR =
|
||||
TARGET = Client
|
||||
|
||||
|
||||
first: all
|
||||
####### Build rules
|
||||
|
||||
$(TARGET): ui_widget.h $(OBJECTS)
|
||||
$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS)
|
||||
|
||||
Makefile: client.pro /usr/lib64/qt5/mkspecs/linux-g++/qmake.conf /usr/lib64/qt5/mkspecs/features/spec_pre.prf \
|
||||
/usr/lib64/qt5/mkspecs/common/unix.conf \
|
||||
/usr/lib64/qt5/mkspecs/common/linux.conf \
|
||||
/usr/lib64/qt5/mkspecs/common/sanitize.conf \
|
||||
/usr/lib64/qt5/mkspecs/common/gcc-base.conf \
|
||||
/usr/lib64/qt5/mkspecs/common/gcc-base-unix.conf \
|
||||
/usr/lib64/qt5/mkspecs/common/g++-base.conf \
|
||||
/usr/lib64/qt5/mkspecs/common/g++-unix.conf \
|
||||
/usr/lib64/qt5/mkspecs/qconfig.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_3dcore.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_3dcore_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_3dextras.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_3dextras_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_3dinput.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_3dinput_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_3dlogic.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_3dlogic_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_3dquick.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_3dquick_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_3dquickextras.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_3dquickextras_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_3dquickinput.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_3dquickinput_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_3dquickrender.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_3dquickrender_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_3drender.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_3drender_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_bluetooth.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_bluetooth_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_bootstrap_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_clucene_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_concurrent.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_concurrent_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_core.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_core_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_dbus.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_dbus_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_designer.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_designer_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_designercomponents_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_eglfs_device_lib_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_eglfs_kms_support_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_enginio.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_enginio_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_gui.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_gui_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_help.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_help_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_location.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_location_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_multimedia.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_multimedia_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_multimediawidgets.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_multimediawidgets_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_network.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_network_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_nfc.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_nfc_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_opengl.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_opengl_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_openglextensions.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_openglextensions_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_packetprotocol_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_platformsupport_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_positioning.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_positioning_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_printsupport.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_printsupport_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_qml.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_qml_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_qmldebug_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_qmldevtools_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_qmltest.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_qmltest_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_qtmultimediaquicktools_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_quick.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_quick_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_quickparticles_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_quickwidgets.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_quickwidgets_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_script.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_script_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_scripttools.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_scripttools_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_sensors.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_sensors_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_serialport.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_serialport_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_sql.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_sql_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_svg.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_svg_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_testlib.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_testlib_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_uiplugin.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_uitools.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_uitools_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_waylandclient.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_waylandclient_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_waylandcompositor.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_waylandcompositor_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_webchannel.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_webchannel_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_webkit.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_webkitwidgets.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_websockets.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_websockets_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_widgets.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_widgets_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_x11extras.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_x11extras_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_xcb_qpa_lib_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_xml.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_xml_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_xmlpatterns.pri \
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_xmlpatterns_private.pri \
|
||||
/usr/lib64/qt5/mkspecs/features/qt_functions.prf \
|
||||
/usr/lib64/qt5/mkspecs/features/qt_config.prf \
|
||||
/usr/lib64/qt5/mkspecs/linux-g++/qmake.conf \
|
||||
/usr/lib64/qt5/mkspecs/features/spec_post.prf \
|
||||
.qmake.stash \
|
||||
/usr/lib64/qt5/mkspecs/features/exclusive_builds.prf \
|
||||
/usr/lib64/qt5/mkspecs/features/toolchain.prf \
|
||||
/usr/lib64/qt5/mkspecs/features/default_pre.prf \
|
||||
/usr/lib64/qt5/mkspecs/features/resolve_config.prf \
|
||||
/usr/lib64/qt5/mkspecs/features/default_post.prf \
|
||||
/usr/lib64/qt5/mkspecs/features/warn_on.prf \
|
||||
/usr/lib64/qt5/mkspecs/features/qt.prf \
|
||||
/usr/lib64/qt5/mkspecs/features/resources.prf \
|
||||
/usr/lib64/qt5/mkspecs/features/moc.prf \
|
||||
/usr/lib64/qt5/mkspecs/features/unix/opengl.prf \
|
||||
/usr/lib64/qt5/mkspecs/features/uic.prf \
|
||||
/usr/lib64/qt5/mkspecs/features/unix/thread.prf \
|
||||
/usr/lib64/qt5/mkspecs/features/file_copies.prf \
|
||||
/usr/lib64/qt5/mkspecs/features/testcase_targets.prf \
|
||||
/usr/lib64/qt5/mkspecs/features/exceptions.prf \
|
||||
/usr/lib64/qt5/mkspecs/features/yacc.prf \
|
||||
/usr/lib64/qt5/mkspecs/features/lex.prf \
|
||||
client.pro \
|
||||
/usr/lib64/libQt5Widgets.prl \
|
||||
/usr/lib64/libQt5Gui.prl \
|
||||
/usr/lib64/libQt5Network.prl \
|
||||
/usr/lib64/libQt5Core.prl
|
||||
$(QMAKE) -o Makefile client.pro
|
||||
/usr/lib64/qt5/mkspecs/features/spec_pre.prf:
|
||||
/usr/lib64/qt5/mkspecs/common/unix.conf:
|
||||
/usr/lib64/qt5/mkspecs/common/linux.conf:
|
||||
/usr/lib64/qt5/mkspecs/common/sanitize.conf:
|
||||
/usr/lib64/qt5/mkspecs/common/gcc-base.conf:
|
||||
/usr/lib64/qt5/mkspecs/common/gcc-base-unix.conf:
|
||||
/usr/lib64/qt5/mkspecs/common/g++-base.conf:
|
||||
/usr/lib64/qt5/mkspecs/common/g++-unix.conf:
|
||||
/usr/lib64/qt5/mkspecs/qconfig.pri:
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_3dcore.pri:
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_3dcore_private.pri:
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_3dextras.pri:
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_3dextras_private.pri:
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_3dinput.pri:
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_3dinput_private.pri:
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_3dlogic.pri:
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_3dlogic_private.pri:
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_3dquick.pri:
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_3dquick_private.pri:
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_3dquickextras.pri:
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_3dquickextras_private.pri:
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_3dquickinput.pri:
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_3dquickinput_private.pri:
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_3dquickrender.pri:
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_3dquickrender_private.pri:
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_3drender.pri:
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_3drender_private.pri:
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_bluetooth.pri:
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_bluetooth_private.pri:
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_bootstrap_private.pri:
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_clucene_private.pri:
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_concurrent.pri:
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_concurrent_private.pri:
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_core.pri:
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_core_private.pri:
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_dbus.pri:
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_dbus_private.pri:
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_designer.pri:
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_designer_private.pri:
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_designercomponents_private.pri:
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_eglfs_device_lib_private.pri:
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_eglfs_kms_support_private.pri:
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_enginio.pri:
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_enginio_private.pri:
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_gui.pri:
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_gui_private.pri:
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_help.pri:
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_help_private.pri:
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_location.pri:
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_location_private.pri:
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_multimedia.pri:
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_multimedia_private.pri:
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_multimediawidgets.pri:
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_multimediawidgets_private.pri:
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_network.pri:
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_network_private.pri:
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_nfc.pri:
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_nfc_private.pri:
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_opengl.pri:
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_opengl_private.pri:
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_openglextensions.pri:
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_openglextensions_private.pri:
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_packetprotocol_private.pri:
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_platformsupport_private.pri:
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_positioning.pri:
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_positioning_private.pri:
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_printsupport.pri:
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_printsupport_private.pri:
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_qml.pri:
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_qml_private.pri:
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_qmldebug_private.pri:
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_qmldevtools_private.pri:
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_qmltest.pri:
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_qmltest_private.pri:
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_qtmultimediaquicktools_private.pri:
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_quick.pri:
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_quick_private.pri:
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_quickparticles_private.pri:
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_quickwidgets.pri:
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_quickwidgets_private.pri:
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_script.pri:
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_script_private.pri:
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_scripttools.pri:
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_scripttools_private.pri:
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_sensors.pri:
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_sensors_private.pri:
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_serialport.pri:
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_serialport_private.pri:
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_sql.pri:
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_sql_private.pri:
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_svg.pri:
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_svg_private.pri:
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_testlib.pri:
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_testlib_private.pri:
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_uiplugin.pri:
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_uitools.pri:
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_uitools_private.pri:
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_waylandclient.pri:
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_waylandclient_private.pri:
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_waylandcompositor.pri:
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_waylandcompositor_private.pri:
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_webchannel.pri:
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_webchannel_private.pri:
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_webkit.pri:
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_webkitwidgets.pri:
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_websockets.pri:
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_websockets_private.pri:
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_widgets.pri:
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_widgets_private.pri:
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_x11extras.pri:
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_x11extras_private.pri:
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_xcb_qpa_lib_private.pri:
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_xml.pri:
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_xml_private.pri:
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_xmlpatterns.pri:
|
||||
/usr/lib64/qt5/mkspecs/modules/qt_lib_xmlpatterns_private.pri:
|
||||
/usr/lib64/qt5/mkspecs/features/qt_functions.prf:
|
||||
/usr/lib64/qt5/mkspecs/features/qt_config.prf:
|
||||
/usr/lib64/qt5/mkspecs/linux-g++/qmake.conf:
|
||||
/usr/lib64/qt5/mkspecs/features/spec_post.prf:
|
||||
.qmake.stash:
|
||||
/usr/lib64/qt5/mkspecs/features/exclusive_builds.prf:
|
||||
/usr/lib64/qt5/mkspecs/features/toolchain.prf:
|
||||
/usr/lib64/qt5/mkspecs/features/default_pre.prf:
|
||||
/usr/lib64/qt5/mkspecs/features/resolve_config.prf:
|
||||
/usr/lib64/qt5/mkspecs/features/default_post.prf:
|
||||
/usr/lib64/qt5/mkspecs/features/warn_on.prf:
|
||||
/usr/lib64/qt5/mkspecs/features/qt.prf:
|
||||
/usr/lib64/qt5/mkspecs/features/resources.prf:
|
||||
/usr/lib64/qt5/mkspecs/features/moc.prf:
|
||||
/usr/lib64/qt5/mkspecs/features/unix/opengl.prf:
|
||||
/usr/lib64/qt5/mkspecs/features/uic.prf:
|
||||
/usr/lib64/qt5/mkspecs/features/unix/thread.prf:
|
||||
/usr/lib64/qt5/mkspecs/features/file_copies.prf:
|
||||
/usr/lib64/qt5/mkspecs/features/testcase_targets.prf:
|
||||
/usr/lib64/qt5/mkspecs/features/exceptions.prf:
|
||||
/usr/lib64/qt5/mkspecs/features/yacc.prf:
|
||||
/usr/lib64/qt5/mkspecs/features/lex.prf:
|
||||
client.pro:
|
||||
/usr/lib64/libQt5Widgets.prl:
|
||||
/usr/lib64/libQt5Gui.prl:
|
||||
/usr/lib64/libQt5Network.prl:
|
||||
/usr/lib64/libQt5Core.prl:
|
||||
qmake: FORCE
|
||||
@$(QMAKE) -o Makefile client.pro
|
||||
|
||||
qmake_all: FORCE
|
||||
|
||||
|
||||
all: Makefile $(TARGET)
|
||||
|
||||
dist: distdir FORCE
|
||||
(cd `dirname $(DISTDIR)` && $(TAR) $(DISTNAME).tar $(DISTNAME) && $(COMPRESS) $(DISTNAME).tar) && $(MOVE) `dirname $(DISTDIR)`/$(DISTNAME).tar.gz . && $(DEL_FILE) -r $(DISTDIR)
|
||||
|
||||
distdir: FORCE
|
||||
@test -d $(DISTDIR) || mkdir -p $(DISTDIR)
|
||||
$(COPY_FILE) --parents $(DIST) $(DISTDIR)/
|
||||
$(COPY_FILE) --parents /usr/lib64/qt5/mkspecs/features/data/dummy.cpp $(DISTDIR)/
|
||||
$(COPY_FILE) --parents client.h constants.h $(DISTDIR)/
|
||||
$(COPY_FILE) --parents client.cpp main.cpp $(DISTDIR)/
|
||||
$(COPY_FILE) --parents widget.ui $(DISTDIR)/
|
||||
|
||||
|
||||
clean: compiler_clean
|
||||
-$(DEL_FILE) $(OBJECTS)
|
||||
-$(DEL_FILE) *~ core *.core
|
||||
|
||||
|
||||
distclean: clean
|
||||
-$(DEL_FILE) $(TARGET)
|
||||
-$(DEL_FILE) .qmake.stash
|
||||
-$(DEL_FILE) Makefile
|
||||
|
||||
|
||||
####### Sub-libraries
|
||||
|
||||
mocclean: compiler_moc_header_clean compiler_moc_source_clean
|
||||
|
||||
mocables: compiler_moc_header_make_all compiler_moc_source_make_all
|
||||
|
||||
check: first
|
||||
|
||||
benchmark: first
|
||||
|
||||
compiler_rcc_make_all:
|
||||
compiler_rcc_clean:
|
||||
compiler_moc_predefs_make_all: moc_predefs.h
|
||||
compiler_moc_predefs_clean:
|
||||
-$(DEL_FILE) moc_predefs.h
|
||||
moc_predefs.h: /usr/lib64/qt5/mkspecs/features/data/dummy.cpp
|
||||
g++ -pipe -O2 -Wall -W -dM -E -o moc_predefs.h /usr/lib64/qt5/mkspecs/features/data/dummy.cpp
|
||||
|
||||
compiler_moc_header_make_all: moc_client.cpp
|
||||
compiler_moc_header_clean:
|
||||
-$(DEL_FILE) moc_client.cpp
|
||||
moc_client.cpp: constants.h \
|
||||
ui_widget.h \
|
||||
client.h \
|
||||
moc_predefs.h \
|
||||
/usr/lib64/qt5/bin/moc
|
||||
/usr/lib64/qt5/bin/moc $(DEFINES) --include ./moc_predefs.h -I/usr/lib64/qt5/mkspecs/linux-g++ -I/usr/shared/sdr-j-development/systems/dab-cmdline/example-2/client -I/usr/shared/sdr-j-development/systems/dab-cmdline/example-2/client -I/usr/include/qt5 -I/usr/include/qt5/QtWidgets -I/usr/include/qt5/QtGui -I/usr/include/qt5/QtNetwork -I/usr/include/qt5/QtCore -I/usr/include/c++/6.4.1 -I/usr/include/c++/6.4.1/x86_64-redhat-linux -I/usr/include/c++/6.4.1/backward -I/usr/lib/gcc/x86_64-redhat-linux/6.4.1/include -I/usr/local/include -I/usr/include client.h -o moc_client.cpp
|
||||
|
||||
compiler_moc_source_make_all:
|
||||
compiler_moc_source_clean:
|
||||
compiler_uic_make_all: ui_widget.h
|
||||
compiler_uic_clean:
|
||||
-$(DEL_FILE) ui_widget.h
|
||||
ui_widget.h: widget.ui \
|
||||
/usr/lib64/qt5/bin/uic
|
||||
/usr/lib64/qt5/bin/uic widget.ui -o ui_widget.h
|
||||
|
||||
compiler_yacc_decl_make_all:
|
||||
compiler_yacc_decl_clean:
|
||||
compiler_yacc_impl_make_all:
|
||||
compiler_yacc_impl_clean:
|
||||
compiler_lex_make_all:
|
||||
compiler_lex_clean:
|
||||
compiler_clean: compiler_moc_predefs_clean compiler_moc_header_clean compiler_uic_clean
|
||||
|
||||
####### Compile
|
||||
|
||||
client.o: client.cpp client.h \
|
||||
constants.h \
|
||||
ui_widget.h
|
||||
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o client.o client.cpp
|
||||
|
||||
main.o: main.cpp client.h \
|
||||
constants.h \
|
||||
ui_widget.h
|
||||
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o main.o main.cpp
|
||||
|
||||
moc_client.o: moc_client.cpp
|
||||
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_client.o moc_client.cpp
|
||||
|
||||
####### Install
|
||||
|
||||
install: FORCE
|
||||
|
||||
uninstall: FORCE
|
||||
|
||||
FORCE:
|
||||
|
165
example-2/client/client.cpp
Normal file
165
example-2/client/client.cpp
Normal file
@@ -0,0 +1,165 @@
|
||||
#
|
||||
/*
|
||||
* Copyright (C) 2015
|
||||
* Jan van Katwijk (J.vanKatwijk@gmail.com)
|
||||
* Lazy Chair Computing
|
||||
*
|
||||
* This file is part of the SDR-J.
|
||||
* Many of the ideas as implemented in SDR-J are derived from
|
||||
* other work, made available through the GNU general Public License.
|
||||
* All copyrights of the original authors are recognized.
|
||||
*
|
||||
* SDR-J is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* SDR-J is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with SDR-J; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Communication via network to a DAB receiver to
|
||||
* show the tdc data
|
||||
*/
|
||||
|
||||
#include <QSettings>
|
||||
#include <QLabel>
|
||||
#include <QMessageBox>
|
||||
#include <QtNetwork>
|
||||
#include <QTcpSocket>
|
||||
#include <QHostAddress>
|
||||
#include "client.h"
|
||||
//
|
||||
|
||||
Client::Client (QWidget *parent):QDialog (parent) {
|
||||
int16_t i;
|
||||
setupUi (this);
|
||||
connected = false;
|
||||
connect (connectButton, SIGNAL (clicked (void)),
|
||||
this, SLOT (wantConnect (void)));
|
||||
connect (terminateButton, SIGNAL (clicked (void)),
|
||||
this, SLOT (terminate (void)));
|
||||
state -> setText ("waiting to start");
|
||||
|
||||
connectionTimer = new QTimer ();
|
||||
connectionTimer -> setInterval (1000);
|
||||
connect (connectionTimer, SIGNAL (timeout (void)),
|
||||
this, SLOT (timerTick (void)));
|
||||
}
|
||||
//
|
||||
|
||||
Client::~Client (void) {
|
||||
connected = false;
|
||||
}
|
||||
//
|
||||
void Client::wantConnect (void) {
|
||||
QString ipAddress;
|
||||
int16_t i;
|
||||
QList<QHostAddress> ipAddressesList = QNetworkInterface::allAddresses();
|
||||
|
||||
if (connected)
|
||||
return;
|
||||
// use the first non-localhost IPv4 address
|
||||
for (i = 0; i < ipAddressesList.size(); ++i) {
|
||||
if (ipAddressesList.at (i) != QHostAddress::LocalHost &&
|
||||
ipAddressesList. at (i). toIPv4Address ()) {
|
||||
ipAddress = ipAddressesList. at(i). toString();
|
||||
break;
|
||||
}
|
||||
}
|
||||
// if we did not find one, use IPv4 localhost
|
||||
if (ipAddress. isEmpty())
|
||||
ipAddress = QHostAddress (QHostAddress::LocalHost).toString ();
|
||||
hostLineEdit -> setText (ipAddress);
|
||||
|
||||
hostLineEdit -> setInputMask ("000.000.000.000");
|
||||
// Setting default IP address
|
||||
state -> setText ("Give IP address, return");
|
||||
connect (hostLineEdit, SIGNAL (returnPressed (void)),
|
||||
this, SLOT (setConnection (void)));
|
||||
}
|
||||
|
||||
// if / when a return is pressed in the line edit,
|
||||
// a signal appears and we are able to collect the
|
||||
// inserted text. The format is the IP-V4 format.
|
||||
// Using this text, we try to connect,
|
||||
void Client::setConnection (void) {
|
||||
QString s = hostLineEdit -> text ();
|
||||
QHostAddress theAddress = QHostAddress (s);
|
||||
int32_t basePort;
|
||||
basePort = 8888;
|
||||
disconnect (hostLineEdit, SIGNAL (returnPressed (void)),
|
||||
this, SLOT (setConnection (void)));
|
||||
//
|
||||
// The streamer will provide us with the raw data
|
||||
streamer. connectToHost (theAddress, basePort);
|
||||
if (!streamer. waitForConnected (2000)) {
|
||||
QMessageBox::warning (this, tr ("client"),
|
||||
tr ("setting up stream failed\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
connected = true;
|
||||
state -> setText ("Connected");
|
||||
connect (&streamer, SIGNAL (readyRead (void)),
|
||||
this, SLOT (readData (void)));
|
||||
connectionTimer -> start (1000);
|
||||
}
|
||||
|
||||
// These functions are typical for network use
|
||||
void Client::readData (void) {
|
||||
QByteArray d;
|
||||
int16_t i;
|
||||
|
||||
d. resize (4 * 512);
|
||||
while (streamer. bytesAvailable () > 4 * 512) {
|
||||
streamer. read (d. data (), d. size ());
|
||||
for (i = 0; i < d. size (); i ++)
|
||||
handle ((uint8_t)(d [i]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
#define SEARCH_HEADER 0
|
||||
#define HEADER_FOUND 1
|
||||
|
||||
int searchState = SEARCH_HEADER;
|
||||
|
||||
void Client::handle (uint8_t d) {
|
||||
int16_t i;
|
||||
if (searchState == SEARCH_HEADER) {
|
||||
headertester. shift (d);
|
||||
if (headertester. hasHeader ()) {
|
||||
toRead = headertester. length ();
|
||||
searchState = HEADER_FOUND;
|
||||
headertester. reset ();
|
||||
}
|
||||
return;
|
||||
}
|
||||
toRead --;
|
||||
// handle the data element
|
||||
if (toRead == 0)
|
||||
searchState = SEARCH_HEADER;
|
||||
}
|
||||
|
||||
void Client::terminate (void) {
|
||||
if (connected) {
|
||||
streamer. close ();
|
||||
}
|
||||
accept ();
|
||||
}
|
||||
|
||||
void Client::timerTick (void) {
|
||||
if (streamer. state () == QAbstractSocket::UnconnectedState) {
|
||||
state -> setText ("not connected");
|
||||
connected = false;
|
||||
connectionTimer -> stop ();
|
||||
}
|
||||
}
|
||||
|
66
example-2/client/client.h
Normal file
66
example-2/client/client.h
Normal file
@@ -0,0 +1,66 @@
|
||||
#
|
||||
/*
|
||||
* Copyright (C) 2015
|
||||
* Jan van Katwijk (J.vanKatwijk@gmail.com)
|
||||
* Lazy Chair Computing
|
||||
*
|
||||
* This file is part of the SDR-J.
|
||||
* Many of the ideas as implemented in SDR-J are derived from
|
||||
* other work, made available through the GNU general Public License.
|
||||
* All copyrights of the original authors are recognized.
|
||||
*
|
||||
* SDR-J is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* SDR-J is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with SDR-J; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Communication via network to a DAB receiver to
|
||||
* show the tdc data
|
||||
*/
|
||||
|
||||
#ifndef __TDC_CLIENT__
|
||||
#define __TDC_CLIENT__
|
||||
#include "constants.h"
|
||||
#include <QDialog>
|
||||
#include <QSettings>
|
||||
#include <QLabel>
|
||||
#include <QMessageBox>
|
||||
#include <QTcpSocket>
|
||||
#include <QHostAddress>
|
||||
#include <QTimer>
|
||||
#include "ui_widget.h"
|
||||
#include "header-test.h"
|
||||
//
|
||||
|
||||
class Client:public QDialog, public Ui_widget {
|
||||
Q_OBJECT
|
||||
public:
|
||||
Client (QWidget *parent = NULL);
|
||||
~Client (void);
|
||||
|
||||
bool connected;
|
||||
private slots:
|
||||
void wantConnect (void);
|
||||
void setConnection (void);
|
||||
void readData (void);
|
||||
void handle (uint8_t);
|
||||
void terminate (void);
|
||||
void timerTick (void);
|
||||
private:
|
||||
QTcpSocket streamer;
|
||||
QTimer *connectionTimer;
|
||||
headerTest headertester;
|
||||
int16_t toRead;
|
||||
};
|
||||
#endif
|
||||
|
||||
|
18
example-2/client/client.pro
Normal file
18
example-2/client/client.pro
Normal file
@@ -0,0 +1,18 @@
|
||||
#
|
||||
TEMPLATE = app
|
||||
CONFIG += console
|
||||
QT += core gui network widgets
|
||||
|
||||
INCLUDEPATH += .
|
||||
|
||||
HEADERS = ./client.h \
|
||||
./constants.h
|
||||
|
||||
SOURCES = ./client.cpp main.cpp
|
||||
TARGET = Client
|
||||
FORMS += ./widget.ui
|
||||
|
||||
unix{
|
||||
DESTDIR = .
|
||||
}
|
||||
|
81
example-2/client/constants.h
Normal file
81
example-2/client/constants.h
Normal file
@@ -0,0 +1,81 @@
|
||||
#
|
||||
/*
|
||||
* Copyright (C) 2011, 2012, 2013
|
||||
* Jan van Katwijk (J.vanKatwijk@gmail.com)
|
||||
* Lazy Chair Programming
|
||||
*
|
||||
* This file is part of the SDR-J
|
||||
* Many of the ideas as implemented in SDR-J are derived from
|
||||
* other work, made available through the GNU general Public License.
|
||||
* All copyrights of the original authors are recognized.
|
||||
*
|
||||
* SDR-J is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* SDR-J is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with SDR-J; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#
|
||||
#ifndef __SOUND_CONSTANTS
|
||||
#define __SOUND_CONSTANTS
|
||||
|
||||
#include <math.h>
|
||||
#include <complex>
|
||||
#include <stdint.h>
|
||||
#include <unistd.h>
|
||||
#include <limits>
|
||||
#include "stdlib.h"
|
||||
|
||||
using namespace std;
|
||||
#include <malloc.h>
|
||||
|
||||
#ifdef __MINGW32__
|
||||
#include "windows.h"
|
||||
#else
|
||||
#include "alloca.h"
|
||||
#endif
|
||||
|
||||
/*
|
||||
*/
|
||||
typedef float DSPFLOAT;
|
||||
|
||||
typedef std::complex<DSPFLOAT> DSPCOMPLEX;
|
||||
|
||||
#define MINIMUM(x, y) ((x) < (y) ? x : y)
|
||||
#define MAXIMUM(x, y) ((x) > (y) ? x : y)
|
||||
|
||||
// common, simple but useful, functions
|
||||
static inline
|
||||
bool isIndeterminate (DSPFLOAT x) {
|
||||
return x != x;
|
||||
}
|
||||
|
||||
static inline
|
||||
bool isInfinite (double x) {
|
||||
return x == numeric_limits<DSPFLOAT>::infinity ();
|
||||
}
|
||||
//
|
||||
static inline
|
||||
DSPCOMPLEX cmul (DSPCOMPLEX x, float y) {
|
||||
return DSPCOMPLEX (real (x) * y, imag (x) * y);
|
||||
}
|
||||
|
||||
static inline
|
||||
DSPCOMPLEX cdiv (DSPCOMPLEX x, float y) {
|
||||
return DSPCOMPLEX (real (x) / y, imag (x) / y);
|
||||
}
|
||||
|
||||
static inline
|
||||
float get_db (DSPFLOAT x) {
|
||||
return 20 * log10 ((x + 1) / (float)(256 * 65536));
|
||||
}
|
||||
#endif
|
71
example-2/client/header-test.h
Normal file
71
example-2/client/header-test.h
Normal file
@@ -0,0 +1,71 @@
|
||||
|
||||
#ifndef __HEADER_TEST__
|
||||
#define __HEADER_TEST__
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
|
||||
class headerTest {
|
||||
private:
|
||||
uint8_t b [8];
|
||||
int16_t counter;
|
||||
public:
|
||||
headerTest (void) {
|
||||
counter = 0;
|
||||
}
|
||||
~headerTest (void) {
|
||||
}
|
||||
|
||||
void shift (uint8_t d) {
|
||||
if ((counter == 0) && (d == 0xFF)) {
|
||||
b [counter ++] = 0xFF;
|
||||
return;
|
||||
}
|
||||
if ((counter == 1) && (d == 0x00)) {
|
||||
b [counter ++] = 0x00;
|
||||
return;
|
||||
}
|
||||
if ((counter == 2) && (d == 0xFF)) {
|
||||
b [counter ++] = 0xFF;
|
||||
return;
|
||||
}
|
||||
if ((counter == 3) && (d == 0x00)) {
|
||||
b [counter ++] = 0x00;
|
||||
return;
|
||||
}
|
||||
if (counter == 4) {
|
||||
b [counter ++] = d;
|
||||
return;
|
||||
}
|
||||
if (counter == 5) {
|
||||
b [counter ++] = d;
|
||||
return;
|
||||
}
|
||||
if ((counter == 6) && (d == 0x00)) {
|
||||
b [counter ++] = d;
|
||||
return;
|
||||
}
|
||||
if ((counter == 7) && ((d == 0x00) || (d = 0xFF))) {
|
||||
b [counter ++] = d;
|
||||
fprintf (stderr, "header detected, %o %o %o (%d)\n",
|
||||
b [4], b [5], b [7],
|
||||
(b [4] << 8) | (b [5] & 0xFF));
|
||||
return;
|
||||
}
|
||||
counter = 0;
|
||||
}
|
||||
|
||||
void reset (void) {
|
||||
counter = 0;
|
||||
}
|
||||
|
||||
bool hasHeader (void) {
|
||||
return counter == 8;
|
||||
}
|
||||
|
||||
int16_t length () {
|
||||
return (b [4] << 8) | b [5];
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
51
example-2/client/main.cpp
Normal file
51
example-2/client/main.cpp
Normal file
@@ -0,0 +1,51 @@
|
||||
#
|
||||
/*
|
||||
* Copyright (C) 2008, 2009, 2010, 2011, 2012
|
||||
* Jan van Katwijk (J.vanKatwijk@gmail.com)
|
||||
* Lazy Chair programming
|
||||
*
|
||||
* This file is part of the SDR-J.
|
||||
* Many of the ideas as implemented in SDR-J are derived from
|
||||
* other work, made available through the GNU general Public License.
|
||||
* All copyrights of the original authors are recognized.
|
||||
*
|
||||
* SDR-J is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* SDR-J is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with SDR-J; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Main program
|
||||
*/
|
||||
#include <QApplication>
|
||||
#include <QDir>
|
||||
#include "client.h"
|
||||
|
||||
|
||||
#ifdef __MINGW32__
|
||||
#include "windows.h"
|
||||
#endif
|
||||
|
||||
int main (int argc, char **argv) {
|
||||
Client *myClient;
|
||||
|
||||
QApplication a (argc, argv);
|
||||
myClient = new Client ();
|
||||
myClient -> show ();
|
||||
a. exec ();
|
||||
/*
|
||||
* done:
|
||||
*/
|
||||
fflush (stdout);
|
||||
fflush (stderr);
|
||||
qDebug ("It is done\n");
|
||||
}
|
||||
|
320
example-2/client/ringbuffer.h
Normal file
320
example-2/client/ringbuffer.h
Normal file
@@ -0,0 +1,320 @@
|
||||
#
|
||||
/*
|
||||
* $Id: pa_ringbuffer.c 1738 2011-08-18 11:47:28Z rossb $
|
||||
* Portable Audio I/O Library
|
||||
* Ring Buffer utility.
|
||||
*
|
||||
* Author: Phil Burk, http://www.softsynth.com
|
||||
* modified for SMP safety on Mac OS X by Bjorn Roche
|
||||
* modified for SMP safety on Linux by Leland Lucius
|
||||
* also, allowed for const where possible
|
||||
* modified for multiple-byte-sized data elements by Sven Fischer
|
||||
*
|
||||
* Note that this is safe only for a single-thread reader and a
|
||||
* single-thread writer.
|
||||
*
|
||||
* This program uses the PortAudio Portable Audio Library.
|
||||
* For more information see: http://www.portaudio.com
|
||||
* Copyright (c) 1999-2000 Ross Bencina and Phil Burk
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files
|
||||
* (the "Software"), to deal in the Software without restriction,
|
||||
* including without limitation the rights to use, copy, modify, merge,
|
||||
* publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
* and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
|
||||
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
*
|
||||
* Copyright (C) 2008, 2009, 2010
|
||||
* Jan van Katwijk (J.vanKatwijk@gmail.com)
|
||||
* Lazy Chair Computing
|
||||
*
|
||||
* The ringbuffer here is a rewrite of the ringbuffer used in the PA code
|
||||
* All rights remain with their owners
|
||||
* This file is part of the SDR-J.
|
||||
* Many of the ideas as implemented in SDR-J are derived from
|
||||
* other work, made available through the GNU general Public License.
|
||||
* All copyrights of the original authors are recognized.
|
||||
*
|
||||
* SDR-J is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* SDR-J is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with SDR-J; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef __RINGBUFFER
|
||||
#define __RINGBUFFER
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
/*
|
||||
* a simple ringbuffer, lockfree, however only for a
|
||||
* single reader and a single writer.
|
||||
* Mostly used for getting samples from or to the soundcard
|
||||
*/
|
||||
#if defined(__APPLE__)
|
||||
# include <libkern/OSAtomic.h>
|
||||
/* Here are the memory barrier functions. Mac OS X only provides
|
||||
full memory barriers, so the three types of barriers are the same,
|
||||
however, these barriers are superior to compiler-based ones. */
|
||||
# define PaUtil_FullMemoryBarrier() OSMemoryBarrier()
|
||||
# define PaUtil_ReadMemoryBarrier() OSMemoryBarrier()
|
||||
# define PaUtil_WriteMemoryBarrier() OSMemoryBarrier()
|
||||
#elif defined(__GNUC__)
|
||||
/* GCC >= 4.1 has built-in intrinsics. We'll use those */
|
||||
# if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1)
|
||||
# define PaUtil_FullMemoryBarrier() __sync_synchronize()
|
||||
# define PaUtil_ReadMemoryBarrier() __sync_synchronize()
|
||||
# define PaUtil_WriteMemoryBarrier() __sync_synchronize()
|
||||
/* as a fallback, GCC understands volatile asm and "memory" to mean it
|
||||
* should not reorder memory read/writes */
|
||||
# elif defined( __PPC__ )
|
||||
# define PaUtil_FullMemoryBarrier() asm volatile("sync":::"memory")
|
||||
# define PaUtil_ReadMemoryBarrier() asm volatile("sync":::"memory")
|
||||
# define PaUtil_WriteMemoryBarrier() asm volatile("sync":::"memory")
|
||||
# elif defined( __i386__ ) || defined( __i486__ ) || defined( __i586__ ) || defined( __i686__ ) || defined( __x86_64__ )
|
||||
# define PaUtil_FullMemoryBarrier() asm volatile("mfence":::"memory")
|
||||
# define PaUtil_ReadMemoryBarrier() asm volatile("lfence":::"memory")
|
||||
# define PaUtil_WriteMemoryBarrier() asm volatile("sfence":::"memory")
|
||||
# else
|
||||
# ifdef ALLOW_SMP_DANGERS
|
||||
# warning Memory barriers not defined on this system or system unknown
|
||||
# warning For SMP safety, you should fix this.
|
||||
# define PaUtil_FullMemoryBarrier()
|
||||
# define PaUtil_ReadMemoryBarrier()
|
||||
# define PaUtil_WriteMemoryBarrier()
|
||||
# else
|
||||
# error Memory barriers are not defined on this system. You can still compile by defining ALLOW_SMP_DANGERS, but SMP safety will not be guaranteed.
|
||||
# endif
|
||||
# endif
|
||||
#else
|
||||
# ifdef ALLOW_SMP_DANGERS
|
||||
# warning Memory barriers not defined on this system or system unknown
|
||||
# warning For SMP safety, you should fix this.
|
||||
# define PaUtil_FullMemoryBarrier()
|
||||
# define PaUtil_ReadMemoryBarrier()
|
||||
# define PaUtil_WriteMemoryBarrier()
|
||||
# else
|
||||
# error Memory barriers are not defined on this system. You can still compile by defining ALLOW_SMP_DANGERS, but SMP safety will not be guaranteed.
|
||||
# endif
|
||||
#endif
|
||||
|
||||
template <class elementtype>
|
||||
class RingBuffer {
|
||||
private:
|
||||
uint32_t bufferSize;
|
||||
volatile uint32_t writeIndex;
|
||||
volatile uint32_t readIndex;
|
||||
uint32_t bigMask;
|
||||
uint32_t smallMask;
|
||||
char *buffer;
|
||||
public:
|
||||
RingBuffer (uint32_t elementCount) {
|
||||
if (((elementCount - 1) & elementCount) != 0)
|
||||
elementCount = 4 * 16384; /* default */
|
||||
|
||||
bufferSize = elementCount;
|
||||
buffer = new char [2 * bufferSize * sizeof (elementtype)];
|
||||
writeIndex = 0;
|
||||
readIndex = 0;
|
||||
smallMask = (elementCount)- 1;
|
||||
bigMask = (elementCount * 2) - 1;
|
||||
}
|
||||
|
||||
~RingBuffer () {
|
||||
delete[] buffer;
|
||||
}
|
||||
|
||||
/*
|
||||
* functions for checking available data for reading and space
|
||||
* for writing
|
||||
*/
|
||||
uint32_t GetRingBufferReadAvailable (void) {
|
||||
return (writeIndex - readIndex) & bigMask;
|
||||
}
|
||||
|
||||
//int32_t ReadSpace (void){
|
||||
// return GetRingBufferReadAvailable ();
|
||||
//}
|
||||
|
||||
uint32_t GetRingBufferWriteAvailable (void) {
|
||||
return bufferSize - GetRingBufferReadAvailable ();
|
||||
}
|
||||
|
||||
int32_t WriteSpace (void) {
|
||||
return GetRingBufferWriteAvailable ();
|
||||
}
|
||||
|
||||
void FlushRingBuffer () {
|
||||
writeIndex = 0;
|
||||
readIndex = 0;
|
||||
}
|
||||
/* ensure that previous writes are seen before we update the write index
|
||||
(write after write)
|
||||
*/
|
||||
int32_t AdvanceRingBufferWriteIndex (int32_t elementCount) {
|
||||
PaUtil_WriteMemoryBarrier();
|
||||
return writeIndex = (writeIndex + elementCount) & bigMask;
|
||||
}
|
||||
|
||||
/* ensure that previous reads (copies out of the ring buffer) are
|
||||
* always completed before updating (writing) the read index.
|
||||
* (write-after-read) => full barrier
|
||||
*/
|
||||
int32_t AdvanceRingBufferReadIndex (int32_t elementCount) {
|
||||
PaUtil_FullMemoryBarrier();
|
||||
return readIndex = (readIndex + elementCount) & bigMask;
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
** Get address of region(s) to which we can write data.
|
||||
** If the region is contiguous, size2 will be zero.
|
||||
** If non-contiguous, size2 will be the size of second region.
|
||||
** Returns room available to be written or elementCount, whichever is smaller.
|
||||
*/
|
||||
int32_t GetRingBufferWriteRegions (uint32_t elementCount,
|
||||
void **dataPtr1, int32_t *sizePtr1,
|
||||
void **dataPtr2, int32_t *sizePtr2 ) {
|
||||
uint32_t index;
|
||||
uint32_t available = GetRingBufferWriteAvailable ();
|
||||
|
||||
if (elementCount > available)
|
||||
elementCount = available;
|
||||
|
||||
/* Check to see if write is not contiguous. */
|
||||
index = writeIndex & smallMask;
|
||||
if ((index + elementCount) > bufferSize ) {
|
||||
/* Write data in two blocks that wrap the buffer. */
|
||||
int32_t firstHalf = bufferSize - index;
|
||||
*dataPtr1 = &buffer[index * sizeof(elementtype)];
|
||||
*sizePtr1 = firstHalf;
|
||||
*dataPtr2 = &buffer [0];
|
||||
*sizePtr2 = elementCount - firstHalf;
|
||||
}
|
||||
else { // fits
|
||||
*dataPtr1 = &buffer [index * sizeof(elementtype)];
|
||||
*sizePtr1 = elementCount;
|
||||
*dataPtr2 = NULL;
|
||||
*sizePtr2 = 0;
|
||||
}
|
||||
|
||||
if (available > 0)
|
||||
PaUtil_FullMemoryBarrier(); /* (write-after-read) => full barrier */
|
||||
|
||||
return elementCount;
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
** Get address of region(s) from which we can read data.
|
||||
** If the region is contiguous, size2 will be zero.
|
||||
** If non-contiguous, size2 will be the size of second region.
|
||||
** Returns room available to be read or elementCount, whichever is smaller.
|
||||
*/
|
||||
int32_t GetRingBufferReadRegions (uint32_t elementCount,
|
||||
void **dataPtr1, int32_t *sizePtr1,
|
||||
void **dataPtr2, int32_t *sizePtr2) {
|
||||
uint32_t index;
|
||||
uint32_t available = GetRingBufferReadAvailable (); /* doesn't use memory barrier */
|
||||
|
||||
if (elementCount > available)
|
||||
elementCount = available;
|
||||
|
||||
/* Check to see if read is not contiguous. */
|
||||
index = readIndex & smallMask;
|
||||
if ((index + elementCount) > bufferSize) {
|
||||
/* Write data in two blocks that wrap the buffer. */
|
||||
int32_t firstHalf = bufferSize - index;
|
||||
*dataPtr1 = &buffer [index * sizeof(elementtype)];
|
||||
*sizePtr1 = firstHalf;
|
||||
*dataPtr2 = &buffer [0];
|
||||
*sizePtr2 = elementCount - firstHalf;
|
||||
}
|
||||
else {
|
||||
*dataPtr1 = &buffer [index * sizeof(elementtype)];
|
||||
*sizePtr1 = elementCount;
|
||||
*dataPtr2 = NULL;
|
||||
*sizePtr2 = 0;
|
||||
}
|
||||
|
||||
if (available)
|
||||
PaUtil_ReadMemoryBarrier(); /* (read-after-read) => read barrier */
|
||||
|
||||
return elementCount;
|
||||
}
|
||||
|
||||
int32_t putDataIntoBuffer (const void *data, int32_t elementCount) {
|
||||
int32_t size1, size2, numWritten;
|
||||
void *data1;
|
||||
void *data2;
|
||||
|
||||
numWritten = GetRingBufferWriteRegions (elementCount,
|
||||
&data1, &size1,
|
||||
&data2, &size2 );
|
||||
if (size2 > 0) {
|
||||
memcpy (data1, data, size1 * sizeof(elementtype));
|
||||
data = ((char *)data) + size1 * sizeof(elementtype);
|
||||
memcpy (data2, data, size2 * sizeof(elementtype));
|
||||
}
|
||||
else
|
||||
memcpy (data1, data, size1 * sizeof(elementtype));
|
||||
|
||||
AdvanceRingBufferWriteIndex (numWritten );
|
||||
return numWritten;
|
||||
}
|
||||
|
||||
int32_t getDataFromBuffer (void *data, int32_t elementCount ) {
|
||||
int32_t size1, size2, numRead;
|
||||
void *data1;
|
||||
void *data2;
|
||||
|
||||
numRead = GetRingBufferReadRegions (elementCount,
|
||||
&data1, &size1,
|
||||
&data2, &size2 );
|
||||
if (size2 > 0) {
|
||||
memcpy (data, data1, size1 * sizeof(elementtype));
|
||||
data = ((char *)data) + size1 * sizeof(elementtype);
|
||||
memcpy (data, data2, size2 * sizeof(elementtype));
|
||||
}
|
||||
else
|
||||
memcpy (data, data1, size1 * sizeof(elementtype));
|
||||
|
||||
AdvanceRingBufferReadIndex (numRead );
|
||||
return numRead;
|
||||
}
|
||||
|
||||
int32_t skipDataInBuffer (uint32_t n_values) {
|
||||
// ensure that we have the correct read and write indices
|
||||
PaUtil_FullMemoryBarrier ();
|
||||
if (n_values > GetRingBufferReadAvailable ())
|
||||
n_values = GetRingBufferReadAvailable ();
|
||||
AdvanceRingBufferReadIndex (n_values);
|
||||
return n_values;
|
||||
}
|
||||
|
||||
};
|
||||
#endif
|
||||
|
68
example-2/client/widget.ui
Normal file
68
example-2/client/widget.ui
Normal file
@@ -0,0 +1,68 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>widget</class>
|
||||
<widget class="QDialog" name="widget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>230</width>
|
||||
<height>195</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Dialog</string>
|
||||
</property>
|
||||
<widget class="QPushButton" name="connectButton">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>10</y>
|
||||
<width>131</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>connect</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" name="hostLineEdit">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>30</y>
|
||||
<width>131</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="state">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>130</y>
|
||||
<width>131</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="terminateButton">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>150</x>
|
||||
<y>10</y>
|
||||
<width>71</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>quit</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
@@ -37,8 +37,13 @@
|
||||
#include "airspy-handler.h"
|
||||
#elif HAVE_RTLSDR
|
||||
#include "rtlsdr-handler.h"
|
||||
#elif HAVE_WAVFILES
|
||||
#include "wavfiles.h"
|
||||
#endif
|
||||
#include <atomic>
|
||||
#ifdef DATA_STREAMER
|
||||
#include "tcp-server.h"
|
||||
#endif
|
||||
|
||||
using std::cerr;
|
||||
using std::endl;
|
||||
@@ -63,6 +68,10 @@ std::atomic<bool>ensembleRecognized;
|
||||
static
|
||||
audioSink *soundOut = NULL;
|
||||
|
||||
#ifdef DATA_STREAMER
|
||||
tcpServer tdcServer (8888);
|
||||
#endif
|
||||
|
||||
std::string programName = "Classic FM";
|
||||
int32_t serviceIdentifier = -1;
|
||||
|
||||
@@ -113,6 +122,20 @@ void dataOut_Handler (std::string dynamicLabel, void *ctx) {
|
||||
(void)ctx;
|
||||
// fprintf (stderr, "%s\n", dynamicLabel. c_str ());
|
||||
}
|
||||
|
||||
static
|
||||
void bytesOut_Handler (uint8_t *data, int16_t amount, void *ctx) {
|
||||
#ifdef DATA_STREAMER
|
||||
fprintf (stderr, ">>>>>>>>>>>>>>%o %o %o (%d %d)\n",
|
||||
data [4], data [5], data [7],
|
||||
(data [4] << 8) | data [5], amount);
|
||||
tdcServer. sendData (data, amount);
|
||||
#else
|
||||
(void)data;
|
||||
(void)amount;
|
||||
#endif
|
||||
(void)ctx;
|
||||
}
|
||||
//
|
||||
// The function is called from within the library with
|
||||
// a buffer full of PCM samples. We pass them on to the
|
||||
@@ -145,7 +168,11 @@ static
|
||||
void mscQuality (int16_t fe, int16_t rsE, int16_t aacE, void *ctx) {
|
||||
// fprintf (stderr, "msc quality = %d %d %d\n", fe, rsE, aacE);
|
||||
}
|
||||
|
||||
|
||||
static
|
||||
void tdcData (uint8_t *data, int16_t amount) {
|
||||
}
|
||||
|
||||
int main (int argc, char **argv) {
|
||||
// Default values
|
||||
uint8_t theMode = 1;
|
||||
@@ -155,22 +182,36 @@ int16_t ppmCorrection = 0;
|
||||
int theGain = 35; // scale = 0 .. 100
|
||||
std::string soundChannel = "default";
|
||||
int16_t latency = 10;
|
||||
int16_t waitingTime = 10;
|
||||
bool autogain = false;
|
||||
int opt;
|
||||
struct sigaction sigact;
|
||||
bandHandler dabBand;
|
||||
deviceHandler *theDevice;
|
||||
#ifdef HAVE_WAVFILES
|
||||
std::string fileName;
|
||||
#endif
|
||||
|
||||
fprintf (stderr, "dab_cmdline,\n \
|
||||
Copyright 2017 J van Katwijk, Lazy Chair Computing\n");
|
||||
timeSynced. store (false);
|
||||
timesyncSet. store (false);
|
||||
run. store (false);
|
||||
|
||||
while ((opt = getopt (argc, argv, "M:B:C:P:G:A:L:S:Q")) != -1) {
|
||||
//
|
||||
// For file input we do not need options like Q, G and C,
|
||||
// We do need an option to specify the filename
|
||||
#ifndef HAVE_WAVFILES
|
||||
while ((opt = getopt (argc, argv, "W:M:B:C:P:G:A:L:S:Q")) != -1) {
|
||||
#else
|
||||
while ((opt = getopt (argc, argv, "W:M:B:P:A:L:S:F:")) != -1) {
|
||||
#endif
|
||||
fprintf (stderr, "opt = %c\n", opt);
|
||||
switch (opt) {
|
||||
|
||||
case 'W':
|
||||
waitingTime = atoi (optarg);
|
||||
break;
|
||||
|
||||
case 'M':
|
||||
theMode = atoi (optarg);
|
||||
if (!(theMode == 1) || (theMode == 2) || (theMode == 4))
|
||||
@@ -182,9 +223,6 @@ deviceHandler *theDevice;
|
||||
L_BAND : BAND_III;
|
||||
break;
|
||||
|
||||
case 'C':
|
||||
theChannel = std::string (optarg);
|
||||
break;
|
||||
|
||||
case 'P':
|
||||
programName = optarg;
|
||||
@@ -193,6 +231,10 @@ deviceHandler *theDevice;
|
||||
case 'p':
|
||||
ppmCorrection = atoi (optarg);
|
||||
break;
|
||||
#ifndef HAVE_WAVFILES
|
||||
case 'C':
|
||||
theChannel = std::string (optarg);
|
||||
break;
|
||||
|
||||
case 'G':
|
||||
theGain = atoi (optarg);
|
||||
@@ -201,6 +243,11 @@ deviceHandler *theDevice;
|
||||
case 'Q':
|
||||
autogain = true;
|
||||
break;
|
||||
#else
|
||||
case 'F':
|
||||
fileName = std::string (optarg);
|
||||
break;
|
||||
#endif
|
||||
|
||||
case 'A':
|
||||
soundChannel = optarg;
|
||||
@@ -225,9 +272,6 @@ deviceHandler *theDevice;
|
||||
sigact.sa_handler = sighandler;
|
||||
sigemptyset(&sigact.sa_mask);
|
||||
sigact.sa_flags = 0;
|
||||
// sigaction(SIGINT, &sigact, NULL);
|
||||
// sigaction(SIGTERM, &sigact, NULL);
|
||||
// sigaction(SIGQUIT, &sigact, NULL);
|
||||
bool err;
|
||||
|
||||
int32_t frequency = dabBand. Frequency (theBand, theChannel);
|
||||
@@ -248,6 +292,8 @@ deviceHandler *theDevice;
|
||||
ppmCorrection,
|
||||
theGain,
|
||||
autogain);
|
||||
#elif HAVE_WAVFILES
|
||||
theDevice = new wavFiles (fileName);
|
||||
#endif
|
||||
}
|
||||
catch (int e) {
|
||||
@@ -255,14 +301,14 @@ deviceHandler *theDevice;
|
||||
exit (32);
|
||||
}
|
||||
//
|
||||
// We have a device
|
||||
// We have a device, so bind the audio out
|
||||
soundOut = new audioSink (latency, soundChannel, &err);
|
||||
if (err) {
|
||||
fprintf (stderr, "no valid sound channel, fatal\n");
|
||||
exit (33);
|
||||
}
|
||||
//
|
||||
// and a sound device
|
||||
// and with a sound device we can create a "backend"
|
||||
theRadio = new dabClass (theDevice,
|
||||
theMode,
|
||||
NULL, // no spectrum shown
|
||||
@@ -274,6 +320,7 @@ deviceHandler *theDevice;
|
||||
fibQuality,
|
||||
pcmHandler,
|
||||
dataOut_Handler,
|
||||
bytesOut_Handler,
|
||||
programdataHandler,
|
||||
mscQuality,
|
||||
NULL
|
||||
@@ -296,7 +343,8 @@ deviceHandler *theDevice;
|
||||
theRadio -> startProcessing ();
|
||||
|
||||
int timeOut = 0;
|
||||
while (!timesyncSet. load () && (++timeOut < 5))
|
||||
// while (!timesyncSet. load () && (++timeOut < 5))
|
||||
while (++timeOut < waitingTime)
|
||||
sleep (1);
|
||||
|
||||
if (!timeSynced. load ()) {
|
||||
|
@@ -2,7 +2,7 @@
|
||||
/*
|
||||
* Copyright (C) 2011, 2012, 2013
|
||||
* Jan van Katwijk (J.vanKatwijk@gmail.com)
|
||||
* Lazy Chair Programming
|
||||
* Lazy Chair Computing
|
||||
*
|
||||
* This file is part of the main program of the DAB library
|
||||
*
|
||||
|
@@ -2,7 +2,7 @@
|
||||
/*
|
||||
* Copyright (C) 2011, 2012, 2013
|
||||
* Jan van Katwijk (J.vanKatwijk@gmail.com)
|
||||
* Lazy Chair Programming
|
||||
* Lazy Chair Computing
|
||||
*
|
||||
* This file is part of the main program of the DAB library
|
||||
*
|
||||
|
124
example-2/server-thread/tcp-server.cpp
Normal file
124
example-2/server-thread/tcp-server.cpp
Normal file
@@ -0,0 +1,124 @@
|
||||
#
|
||||
/*
|
||||
* Copyright (C) 2016, 2017
|
||||
* Jan van Katwijk (J.vanKatwijk@gmail.com)
|
||||
* Lazy Chair Computing
|
||||
*
|
||||
* This file is part of the DAB-library
|
||||
* DAB-library is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* DAB-library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with DAB-library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Simple streaming server, for e.g. epg data and tpg data
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <ringbuffer.h>
|
||||
#include <arpa/inet.h>
|
||||
#include "tcp-server.h"
|
||||
|
||||
tcpServer::tcpServer (int port) {
|
||||
buffer = new RingBuffer<uint8_t> (32 * 32768);
|
||||
connected. store (false);
|
||||
threadHandle = std::thread (&tcpServer::run, this, port);
|
||||
}
|
||||
|
||||
tcpServer::~tcpServer (void) {
|
||||
if (running. load ()) {
|
||||
running. store (false);
|
||||
usleep (1000);
|
||||
threadHandle. join ();
|
||||
}
|
||||
delete buffer;
|
||||
}
|
||||
|
||||
void tcpServer::sendData (uint8_t *data, int32_t amount) {
|
||||
if (connected)
|
||||
buffer -> putDataIntoBuffer (data, amount);
|
||||
}
|
||||
#define BUF_SIZE 1024
|
||||
|
||||
void tcpServer::run (int port) {
|
||||
// Variables for writing a server.
|
||||
/*
|
||||
* 1. Getting the address data structure.
|
||||
* 2. Opening a new socket.
|
||||
* 3. Bind to the socket.
|
||||
* 4. Listen to the socket.
|
||||
* 5. Accept Connection.
|
||||
* 6. Receive Data.
|
||||
* 7. Close Connection.
|
||||
*/
|
||||
int socket_desc , client_sock , c , read_size;
|
||||
struct sockaddr_in server , client;
|
||||
|
||||
//Create socket
|
||||
socket_desc = socket(AF_INET , SOCK_STREAM , 0);
|
||||
if (socket_desc == -1) {
|
||||
fprintf (stderr, "Could not create socket");
|
||||
return;
|
||||
}
|
||||
fprintf (stderr, "Socket created");
|
||||
running. store (true);
|
||||
// Prepare the sockaddr_in structure
|
||||
server.sin_family = AF_INET;
|
||||
server.sin_addr.s_addr = INADDR_ANY;
|
||||
server.sin_port = htons (port);
|
||||
|
||||
// Bind
|
||||
if (bind (socket_desc,
|
||||
(struct sockaddr *)&server , sizeof(server)) < 0) {
|
||||
// print the error message
|
||||
perror ("bind failed. Error");
|
||||
return;
|
||||
}
|
||||
|
||||
fprintf (stderr, "I am now accepting connections ...\n");
|
||||
// Listen
|
||||
listen (socket_desc , 3);
|
||||
while (running) {
|
||||
// Accept a new connection and return back the socket desciptor
|
||||
c = sizeof(struct sockaddr_in);
|
||||
|
||||
// accept connection from an incoming client
|
||||
client_sock = accept (socket_desc,
|
||||
(struct sockaddr *)&client,
|
||||
(socklen_t*)&c);
|
||||
if (client_sock < 0) {
|
||||
perror("accept failed");
|
||||
return;
|
||||
}
|
||||
fprintf (stderr, "Connection accepted");
|
||||
connected = true;
|
||||
try {
|
||||
uint8_t localBuffer [BUF_SIZE];
|
||||
int16_t amount;
|
||||
int status;
|
||||
while (running. load ()) {
|
||||
while (running. load () &&
|
||||
(buffer -> GetRingBufferReadAvailable () < BUF_SIZE))
|
||||
usleep (1000);
|
||||
amount = buffer -> getDataFromBuffer (localBuffer, BUF_SIZE);
|
||||
status = send (client_sock, localBuffer, amount ,0);
|
||||
if (status == -1) {
|
||||
throw (22);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (int e) {}
|
||||
connected = false;
|
||||
}
|
||||
// Close the socket before we finish
|
||||
close (socket_desc);
|
||||
running. store (false);
|
||||
}
|
51
example-2/server-thread/tcp-server.h
Normal file
51
example-2/server-thread/tcp-server.h
Normal file
@@ -0,0 +1,51 @@
|
||||
#
|
||||
/*
|
||||
* Copyright (C) 2016, 2017
|
||||
* Jan van Katwijk (J.vanKatwijk@gmail.com)
|
||||
* Lazy Chair Programming
|
||||
*
|
||||
* This file is part of the DAB-library
|
||||
* DAB-library is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* DAB-library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with DAB-library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Simple streaming server, for e.g. epg data and tpg data
|
||||
*/
|
||||
|
||||
#ifndef __TCP_SERVER__
|
||||
#define __TCP_SERVER__
|
||||
|
||||
#include <stdint.h>
|
||||
#include <ringbuffer.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netdb.h>
|
||||
#include <string>
|
||||
#include <thread>
|
||||
#include <unistd.h>
|
||||
#include <atomic>
|
||||
|
||||
class tcpServer {
|
||||
public:
|
||||
tcpServer (std::string);
|
||||
~tcpServer (void);
|
||||
void sendData (uint8_t *, int32_t);
|
||||
void run (std::string port);
|
||||
private:
|
||||
std::thread threadHandle;
|
||||
RingBuffer<uint8_t> *buffer;
|
||||
std::atomic<bool> running;
|
||||
std::atomic<bool> connected;
|
||||
};
|
||||
#endif
|
||||
|
@@ -36,6 +36,7 @@ void *dabInit (deviceHandler *theDevice,
|
||||
fib_quality_t fib_qualityHandler,
|
||||
audioOut_t audioOut_Handler,
|
||||
dataOut_t dataOut_Handler,
|
||||
bytesOut_t bytesOut_Handler,
|
||||
programdata_t programdataHandler,
|
||||
programQuality_t program_qualityHandler,
|
||||
void *userData) {
|
||||
@@ -50,6 +51,7 @@ dabClass *theClass = new dabClass (theDevice,
|
||||
fib_qualityHandler,
|
||||
audioOut_Handler,
|
||||
dataOut_Handler,
|
||||
bytesOut_Handler,
|
||||
programdataHandler,
|
||||
program_qualityHandler,
|
||||
userData);
|
||||
|
@@ -2,9 +2,9 @@
|
||||
/*
|
||||
* Copyright (C) 2015
|
||||
* Jan van Katwijk (J.vanKatwijk@gmail.com)
|
||||
* Lazy Chair Programming
|
||||
* Lazy Chair Computing
|
||||
*
|
||||
* This file is part of the SDR-J (JSDR).
|
||||
* This file is part of the DAB library of the SDR-J (JSDR).
|
||||
* SDR-J is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
@@ -23,14 +23,14 @@
|
||||
#ifndef __DAB_DATA__
|
||||
#define __DAB_DATA__
|
||||
|
||||
#include "dab-virtual.h"
|
||||
#include "ringbuffer.h"
|
||||
#include <stdio.h>
|
||||
#include <thread>
|
||||
#include <mutex>
|
||||
#include <atomic>
|
||||
#include <condition_variable>
|
||||
|
||||
#include "dab-api.h"
|
||||
#include "dab-virtual.h"
|
||||
#include "ringbuffer.h"
|
||||
|
||||
class dabProcessor;
|
||||
class protection;
|
||||
@@ -46,7 +46,8 @@ public:
|
||||
int16_t protLevel,
|
||||
uint8_t DGflag,
|
||||
int16_t FEC_scheme,
|
||||
bool show_crcErrors);
|
||||
bytesOut_t bytesOut,
|
||||
void *userData);
|
||||
~dabData (void);
|
||||
int32_t process (int16_t *, int16_t);
|
||||
void stopRunning (void);
|
||||
|
@@ -2,32 +2,33 @@
|
||||
/*
|
||||
* Copyright (C) 2015
|
||||
* Jan van Katwijk (J.vanKatwijk@gmail.com)
|
||||
* Lazy Chair Programming
|
||||
* Lazy Chair Computing
|
||||
*
|
||||
* This file is part of the SDR-J (JSDR).
|
||||
* SDR-J is free software; you can redistribute it and/or modify
|
||||
* This file is part of the DAB library of the SDR-J software
|
||||
* DAB library is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* SDR-J is distributed in the hope that it will be useful,
|
||||
* DAB library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with SDR-J; if not, write to the Free Software
|
||||
* along with DAB library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
#
|
||||
#ifndef __DATA_PROCESSOR
|
||||
#define __DATA_PROCESSOR
|
||||
#ifndef __DATA_PROCESSOR__
|
||||
#define __DATA_PROCESSOR__
|
||||
|
||||
#include "dab-processor.h"
|
||||
#include "dab-virtual.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <vector>
|
||||
#include "dab-api.h"
|
||||
#include "dab-processor.h"
|
||||
#include "dab-virtual.h"
|
||||
|
||||
class virtual_dataHandler;
|
||||
|
||||
@@ -38,7 +39,8 @@ public:
|
||||
int16_t appType,
|
||||
uint8_t DGflag,
|
||||
int16_t FEC_scheme,
|
||||
bool show_crcErrors);
|
||||
bytesOut_t bytesOut,
|
||||
void *ctx);
|
||||
~dataProcessor (void);
|
||||
void addtoFrame (uint8_t *);
|
||||
private:
|
||||
@@ -47,7 +49,8 @@ private:
|
||||
int16_t appType;
|
||||
uint8_t DGflag;
|
||||
int16_t FEC_scheme;
|
||||
bool show_crcErrors;
|
||||
bytesOut_t bytesOut;
|
||||
void *ctx;
|
||||
int16_t crcErrors;
|
||||
int16_t handledPackets;
|
||||
std::vector<uint8_t> series;
|
||||
|
@@ -18,16 +18,18 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Qt-DAB; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#ifndef __TDC_DATAHANDLER__
|
||||
#define __TDC_DATAHANDLER__
|
||||
|
||||
#include "dab-api.h"
|
||||
#include "dab-constants.h"
|
||||
#include "virtual-datahandler.h"
|
||||
|
||||
class tdc_dataHandler : public virtual_dataHandler {
|
||||
public:
|
||||
tdc_dataHandler (int16_t appType);
|
||||
tdc_dataHandler (int16_t appType,
|
||||
bytesOut_t bytesOut, void *ctx);
|
||||
~tdc_dataHandler (void);
|
||||
void add_mscDatagroup (std::vector<uint8_t>);
|
||||
private:
|
||||
@@ -36,7 +38,8 @@ private:
|
||||
int32_t handleFrame_type_1 (uint8_t *data,
|
||||
int32_t offset, int32_t length);
|
||||
bool serviceComponentFrameheaderCRC (uint8_t *, int16_t, int16_t);
|
||||
|
||||
bytesOut_t bytesOut;
|
||||
void *ctx;
|
||||
};
|
||||
#endif
|
||||
|
||||
|
@@ -44,6 +44,7 @@ public:
|
||||
mscHandler (uint8_t,
|
||||
audioOut_t,
|
||||
dataOut_t,
|
||||
bytesOut_t,
|
||||
programQuality_t,
|
||||
void *);
|
||||
~mscHandler (void);
|
||||
@@ -55,6 +56,7 @@ public:
|
||||
private:
|
||||
audioOut_t soundOut;
|
||||
dataOut_t dataOut;
|
||||
bytesOut_t bytesOut;
|
||||
programQuality_t programQuality;
|
||||
void *userData;
|
||||
dabParams params;
|
||||
|
@@ -58,6 +58,7 @@ public:
|
||||
fib_quality_t fib_qualityHandler,
|
||||
audioOut_t audioOut_Handler,
|
||||
dataOut_t dataOut_Handler,
|
||||
bytesOut_t bytesOut_Handler,
|
||||
programdata_t programdataHandler,
|
||||
programQuality_t program_qualityHandler,
|
||||
void *ctx);
|
||||
|
@@ -38,7 +38,8 @@
|
||||
int16_t protLevel,
|
||||
uint8_t DGflag,
|
||||
int16_t FEC_scheme,
|
||||
bool show_crcErrors) {
|
||||
bytesOut_t bytesOut,
|
||||
void *ctx) {
|
||||
int32_t i;
|
||||
this -> DSCTy = DSCTy;
|
||||
this -> packetAddress = packetAddress;
|
||||
@@ -54,7 +55,8 @@ int32_t i;
|
||||
appType,
|
||||
DGflag,
|
||||
FEC_scheme,
|
||||
show_crcErrors);
|
||||
bytesOut,
|
||||
ctx);
|
||||
outV = new uint8_t [bitRate * 24];
|
||||
interleaveData = new int16_t *[16]; // the size
|
||||
for (i = 0; i < 16; i ++) {
|
||||
|
@@ -35,21 +35,23 @@
|
||||
int16_t appType,
|
||||
uint8_t DGflag,
|
||||
int16_t FEC_scheme,
|
||||
bool show_crcErrors) {
|
||||
bytesOut_t bytesOut,
|
||||
void *ctx) {
|
||||
|
||||
this -> bitRate = bitRate;
|
||||
this -> DSCTy = DSCTy;
|
||||
this -> appType = appType;
|
||||
this -> DGflag = DGflag;
|
||||
this -> FEC_scheme = FEC_scheme;
|
||||
this -> show_crcErrors = show_crcErrors;
|
||||
this -> bytesOut = bytesOut;
|
||||
this -> ctx = ctx;
|
||||
switch (DSCTy) {
|
||||
default:
|
||||
my_dataHandler = new virtual_dataHandler ();
|
||||
break;
|
||||
|
||||
case 5: // do know yet
|
||||
my_dataHandler = new tdc_dataHandler (appType);
|
||||
my_dataHandler = new tdc_dataHandler (appType, bytesOut, ctx);
|
||||
break;
|
||||
|
||||
case 60:
|
||||
@@ -59,9 +61,6 @@
|
||||
|
||||
packetState = 0;
|
||||
streamAddress = -1;
|
||||
//
|
||||
handledPackets = 0;
|
||||
crcErrors = 0;
|
||||
}
|
||||
|
||||
dataProcessor::~dataProcessor (void) {
|
||||
@@ -110,11 +109,6 @@ uint16_t i;
|
||||
// if (usefulLength > 0)
|
||||
// fprintf (stderr, "CI = %d, address = %d, usefulLength = %d\n",
|
||||
// continuityIndex, address, usefulLength);
|
||||
if (show_crcErrors && (++handledPackets >= 500)) {
|
||||
// we could do something here
|
||||
crcErrors = 0;
|
||||
handledPackets = 0;
|
||||
}
|
||||
|
||||
(void)continuityIndex;
|
||||
(void)command;
|
||||
|
@@ -22,14 +22,17 @@
|
||||
|
||||
#include "tdc-datahandler.h"
|
||||
|
||||
tdc_dataHandler::tdc_dataHandler (int16_t appType) {
|
||||
tdc_dataHandler::tdc_dataHandler (int16_t appType,
|
||||
bytesOut_t bytesOut,
|
||||
void *ctx) {
|
||||
this -> bytesOut = bytesOut;
|
||||
this -> ctx = ctx;
|
||||
}
|
||||
|
||||
tdc_dataHandler::~tdc_dataHandler (void) {
|
||||
}
|
||||
|
||||
void tdc_dataHandler::add_mscDatagroup (std::vector<uint8_t> m) {
|
||||
//void tdc_dataHandler::add_mscDatagroup (QByteArray &m) {
|
||||
int32_t offset = 0;
|
||||
uint8_t *data = (uint8_t *)(m. data ());
|
||||
int32_t size = m. size ();
|
||||
@@ -52,6 +55,7 @@ uint16_t crc;
|
||||
uint16_t syncword = getBits (data, offset, 16);
|
||||
int16_t length = getBits (data, offset + 16, 16);
|
||||
uint16_t crc = getBits (data, offset + 32, 16);
|
||||
|
||||
uint8_t frametypeIndicator =
|
||||
getBits (data, offset + 48, 8);
|
||||
if ((length < 0) || (length >= (size - offset) / 8))
|
||||
@@ -85,7 +89,7 @@ uint16_t crc;
|
||||
offset = handleFrame_type_1 (data, offset + 7 * 8, length);
|
||||
else
|
||||
return; // failure
|
||||
fprintf (stderr, "offset is now %d\n", offset);
|
||||
// fprintf (stderr, "offset is now %d\n", offset);
|
||||
if (offset < 0)
|
||||
return;
|
||||
}
|
||||
@@ -95,50 +99,82 @@ int32_t tdc_dataHandler::handleFrame_type_0 (uint8_t *data,
|
||||
int32_t offset, int32_t length) {
|
||||
int16_t i;
|
||||
int16_t noS = getBits (data, offset, 8);
|
||||
fprintf (stderr, "frametype 0 :");
|
||||
for (i = 0; i < noS; i ++)
|
||||
fprintf (stderr, "%o %o %o ", getBits (data, offset + 8, 8),
|
||||
getBits (data, offset + 16, 8),
|
||||
getBits (data, offset + 24, 8));
|
||||
fprintf (stderr, "\n");
|
||||
return offset + length * 8;
|
||||
uint8_t buffer [length + 8];
|
||||
|
||||
buffer [0] = 0xFF;
|
||||
buffer [1] = 0x00;
|
||||
buffer [2] = 0xFF;
|
||||
buffer [3] = 0x00;
|
||||
buffer [4] = length >> 8;
|
||||
buffer [5] = length & 0xFF;
|
||||
buffer [6] = 0;
|
||||
buffer [7] = 0;
|
||||
|
||||
for (i = 0; i < length; i ++)
|
||||
buffer [8 + i] = getBits (data, offset + i * 8, 8);
|
||||
|
||||
if (bytesOut != NULL)
|
||||
bytesOut (buffer, length + 8, ctx);
|
||||
// fprintf (stderr, "frametype 0 :");
|
||||
// for (i = 0; i < noS; i ++)
|
||||
// fprintf (stderr, "%o %o %o ", getBits (data, offset + 8, 8),
|
||||
// getBits (data, offset + 16, 8),
|
||||
// getBits (data, offset + 24, 8));
|
||||
// fprintf (stderr, "\n");
|
||||
return offset + length * 8;
|
||||
}
|
||||
|
||||
int32_t tdc_dataHandler::handleFrame_type_1 (uint8_t *data,
|
||||
int32_t offset, int32_t length) {
|
||||
int16_t i;
|
||||
fprintf (stderr, " frametype 1 met %o %o %o\n",
|
||||
getBits (data, offset, 8),
|
||||
getBits (data, offset + 8, 8),
|
||||
getBits (data, offset + 16, 8));
|
||||
uint8_t buffer [length + 8];
|
||||
|
||||
fprintf (stderr, "encryption %d\n", getBits (data, offset + 24, 8));
|
||||
if (getBits (data, offset + 24, 8) == 0) { // encryption 0
|
||||
int llength = length - 5;
|
||||
int loffset = offset + 32;
|
||||
do {
|
||||
fprintf (stderr, "component identifier = %d\n",
|
||||
getBits (data, loffset + 0, 8));
|
||||
fprintf (stderr, "fieldlength = %d\n",
|
||||
getBits (data, loffset + 8, 16));
|
||||
fprintf (stderr, "header crc = %o\n",
|
||||
getBits (data, loffset + 24, 16));
|
||||
if (serviceComponentFrameheaderCRC (data, loffset, llength))
|
||||
fprintf (stderr, "ready to handle component frame\n");
|
||||
else
|
||||
fprintf (stderr, "crc check failed\n");
|
||||
if (getBits (data, loffset + 0, 8) == 0) {
|
||||
for (i = 0; i < 30; i ++)
|
||||
fprintf (stderr, "%o ", getBits (data, loffset + 40 + 8 * i, 8));
|
||||
fprintf (stderr, "\n");
|
||||
}
|
||||
int16_t fieldLength = getBits (data, loffset + 8, 16);
|
||||
llength -= fieldLength + 5;
|
||||
loffset += fieldLength * 8 + 5 * 8;
|
||||
} while (llength > 0);
|
||||
}
|
||||
else
|
||||
fprintf (stderr, "need to decompress\n");
|
||||
buffer [0] = 0xFF;
|
||||
buffer [1] = 0x00;
|
||||
buffer [2] = 0xFF;
|
||||
buffer [3] = 0x00;
|
||||
buffer [4] = length >> 8;
|
||||
buffer [5] = length & 0xFF;
|
||||
buffer [6] = 0;
|
||||
buffer [7] = 0xFF;
|
||||
|
||||
for (i = 0; i < length; i ++)
|
||||
buffer [8 + i] = getBits (data, offset + i * 8, 8);
|
||||
|
||||
if (bytesOut != NULL)
|
||||
bytesOut (buffer, length + 8, ctx);
|
||||
// fprintf (stderr, " frametype 1 met %o %o %o\n",
|
||||
// getBits (data, offset, 8),
|
||||
// getBits (data, offset + 8, 8),
|
||||
// getBits (data, offset + 16, 8));
|
||||
//
|
||||
// fprintf (stderr, "encryption %d\n", getBits (data, offset + 24, 8));
|
||||
// if (getBits (data, offset + 24, 8) == 0) { // encryption 0
|
||||
// int llength = length - 5;
|
||||
// int loffset = offset + 32;
|
||||
// do {
|
||||
// fprintf (stderr, "component identifier = %d\n",
|
||||
// getBits (data, loffset + 0, 8));
|
||||
// fprintf (stderr, "fieldlength = %d\n",
|
||||
// getBits (data, loffset + 8, 16));
|
||||
// fprintf (stderr, "header crc = %o\n",
|
||||
// getBits (data, loffset + 24, 16));
|
||||
// if (serviceComponentFrameheaderCRC (data, loffset, llength))
|
||||
// fprintf (stderr, "ready to handle component frame\n");
|
||||
// else
|
||||
// fprintf (stderr, "crc check failed\n");
|
||||
// if (getBits (data, loffset + 0, 8) == 0) {
|
||||
// for (i = 0; i < 30; i ++)
|
||||
// fprintf (stderr, "%o ", getBits (data, loffset + 40 + 8 * i, 8));
|
||||
// fprintf (stderr, "\n");
|
||||
// }
|
||||
// int16_t fieldLength = getBits (data, loffset + 8, 16);
|
||||
// llength -= fieldLength + 5;
|
||||
// loffset += fieldLength * 8 + 5 * 8;
|
||||
// } while (llength > 0);
|
||||
// }
|
||||
// else
|
||||
// fprintf (stderr, "need to decompress\n");
|
||||
|
||||
return offset + length * 8;
|
||||
}
|
||||
|
@@ -39,11 +39,13 @@
|
||||
mscHandler::mscHandler (uint8_t Mode,
|
||||
audioOut_t soundOut,
|
||||
dataOut_t dataOut,
|
||||
bytesOut_t bytesOut,
|
||||
programQuality_t mscQuality,
|
||||
void *userData):
|
||||
params (Mode) {
|
||||
this -> soundOut = soundOut;
|
||||
this -> dataOut = dataOut;
|
||||
this -> bytesOut = bytesOut;
|
||||
this -> programQuality = mscQuality;
|
||||
this -> userData = userData;
|
||||
|
||||
@@ -161,7 +163,8 @@ int16_t *myBegin;
|
||||
new_protLevel,
|
||||
new_DGflag,
|
||||
new_FEC_scheme,
|
||||
false);
|
||||
bytesOut,
|
||||
userData);
|
||||
}
|
||||
//
|
||||
// these we need for actual processing
|
||||
|
@@ -41,6 +41,7 @@
|
||||
fib_quality_t fib_qualityHandler,
|
||||
audioOut_t audioOut_Handler,
|
||||
dataOut_t dataOut_Handler,
|
||||
bytesOut_t bytesOut_Handler,
|
||||
programdata_t programdataHandler,
|
||||
programQuality_t program_qualityHandler,
|
||||
void *ctx):
|
||||
@@ -51,6 +52,7 @@
|
||||
the_mscHandler (Mode,
|
||||
audioOut_Handler,
|
||||
dataOut_Handler,
|
||||
bytesOut_Handler,
|
||||
program_qualityHandler,
|
||||
ctx) {
|
||||
this -> inputDevice = inputDevice;
|
||||
|
@@ -4,6 +4,8 @@ Since we need an interface file between the DAB library and the python
|
||||
program, a CMakeLists.txt file is include with which a library can be
|
||||
generated that includes the interface file.
|
||||
|
||||
Note: you need to have numpy and sounddevice installed
|
||||
|
||||
Normal way of creating such a library is
|
||||
mkdir build
|
||||
cd build
|
||||
|
@@ -2,7 +2,7 @@
|
||||
/*
|
||||
* Copyright (C) 2017
|
||||
* Jan van Katwijk (J.vanKatwijk@gmail.com)
|
||||
* Lazy Chair Programming
|
||||
* Lazy Chair Computing
|
||||
*
|
||||
* This file is the python wrapper for the DAB-library.
|
||||
* DAB-library is free software; you can redistribute it and/or modify
|
||||
@@ -70,6 +70,9 @@ deviceHandler *theDevice;
|
||||
// void *); // context
|
||||
// typedef void (*dataOut_t) (std::string,
|
||||
// void *);
|
||||
// typedef void (*bytesOut_t) (uint8_t *,
|
||||
// int16_t,
|
||||
// void *);
|
||||
// typedef void (*systemdata_t) (bool,
|
||||
// int16_t,
|
||||
// int32_t,
|
||||
@@ -296,6 +299,7 @@ PyGILState_STATE gstate;
|
||||
// fib_quality_t fib_qualityHandler,
|
||||
// audioOut_t audioOut_Handler,
|
||||
// dataOut_t dataOut_Handler,
|
||||
// bytesOut_t bytesOut_Handler,
|
||||
// programdata_t programdataHandler,
|
||||
// programQuality_t program_qualityHandler,
|
||||
// void *userData);
|
||||
@@ -465,6 +469,7 @@ void *result;
|
||||
(fib_quality_t) &callback_fibQuality,
|
||||
(audioOut_t) &callback_audioOut,
|
||||
(dataOut_t) &callback_dataOut,
|
||||
(bytesOut_t) NULL,
|
||||
(programdata_t) &callback_programdata,
|
||||
(programQuality_t) &callback_programQuality,
|
||||
NULL
|
||||
|
@@ -2,7 +2,7 @@
|
||||
/*
|
||||
* Copyright (C) 2017
|
||||
* Jan van Katwijk (J.vanKatwijk@gmail.com)
|
||||
* Lazy Chair Programming
|
||||
* Lazy Chair Computing
|
||||
*
|
||||
* This file is part of simpleDab
|
||||
* simpleDab is free software; you can redistribute it and/or modify
|
||||
@@ -174,6 +174,7 @@ const char **t;
|
||||
fibQuality_Handler,
|
||||
audioOut_Handler,
|
||||
dataOut_Handler,
|
||||
NULL,
|
||||
programdata_Handler,
|
||||
mscQuality_Handler,
|
||||
this // context, userData
|
||||
|
Reference in New Issue
Block a user