Removed graphics dependency and added dependency for libsdrgui. Fixed many cmake bugs after name change

master
ismagom 10 years ago
parent 3d0cc1a9ec
commit c23445b38a

@ -38,24 +38,24 @@ FUNCTION(BuildMex)
#target_include_directories(${BuildMex_MEXNAME}-mat PUBLIC ${MATLAB_INCLUDE_DIR}) #target_include_directories(${BuildMex_MEXNAME}-mat PUBLIC ${MATLAB_INCLUDE_DIR})
set_target_properties(${BuildMex_MEXNAME}-mat PROPERTIES set_target_properties(${BuildMex_MEXNAME}-mat PROPERTIES
SUFFIX "${MATLAB_MEX_EXTENSION}" SUFFIX "${MATLAB_MEX_EXTENSION}"
PREFIX "liblte_" PREFIX "srslte_"
OUTPUT_NAME "${BuildMex_MEXNAME}" OUTPUT_NAME "${BuildMex_MEXNAME}"
COMPILE_FLAGS "-fvisibility=default ${MATLAB_MEX_CFLAGS} -I${MATLAB_INCLUDE_DIR}" COMPILE_FLAGS "-fvisibility=default ${MATLAB_MEX_CFLAGS} -I${MATLAB_INCLUDE_DIR}"
) )
target_link_libraries(${BuildMex_MEXNAME}-mat ${BuildMex_LIBRARIES} ${MATLAB_MEX_LIBRARY}) target_link_libraries(${BuildMex_MEXNAME}-mat ${BuildMex_LIBRARIES} ${MATLAB_MEX_LIBRARY})
install(TARGETS ${BuildMex_MEXNAME}-mat DESTINATION "${MEX_DIR}/liblte/") install(TARGETS ${BuildMex_MEXNAME}-mat DESTINATION "${MEX_DIR}/srslte/")
endif(MATLAB_FOUND) endif(MATLAB_FOUND)
if (OCTAVE_FOUND) if (OCTAVE_FOUND)
add_library(${BuildMex_MEXNAME}-oct SHARED ${BuildMex_SOURCES}) add_library(${BuildMex_MEXNAME}-oct SHARED ${BuildMex_SOURCES})
#target_include_directories(${BuildMex_MEXNAME}-oct PUBLIC ${OCTAVE_INCLUDE_DIR}) #target_include_directories(${BuildMex_MEXNAME}-oct PUBLIC ${OCTAVE_INCLUDE_DIR})
set_target_properties(${BuildMex_MEXNAME}-oct PROPERTIES set_target_properties(${BuildMex_MEXNAME}-oct PROPERTIES
SUFFIX ".${OCTAVE_MEXFILE_EXT}" SUFFIX ".${OCTAVE_MEXFILE_EXT}"
PREFIX "liblte_" PREFIX "srslte_"
OUTPUT_NAME "${BuildMex_MEXNAME}" OUTPUT_NAME "${BuildMex_MEXNAME}"
COMPILE_FLAGS "-fvisibility=default ${OCTAVE_MEX_CFLAGS} -DUNDEF_BOOL -I${OCTAVE_INCLUDE_DIR}" COMPILE_FLAGS "-fvisibility=default ${OCTAVE_MEX_CFLAGS} -DUNDEF_BOOL -I${OCTAVE_INCLUDE_DIR}"
) )
target_link_libraries(${BuildMex_MEXNAME}-oct ${BuildMex_LIBRARIES} ${OCTAVE_LIBRARIES}) target_link_libraries(${BuildMex_MEXNAME}-oct ${BuildMex_LIBRARIES} ${OCTAVE_LIBRARIES})
install(TARGETS ${BuildMex_MEXNAME}-oct DESTINATION "${MEX_DIR}/liblte/") install(TARGETS ${BuildMex_MEXNAME}-oct DESTINATION "${MEX_DIR}/srslte/")
endif (OCTAVE_FOUND) endif (OCTAVE_FOUND)
ENDFUNCTION(BuildMex) ENDFUNCTION(BuildMex)

@ -1,152 +0,0 @@
#
# Copyright 2012-2013 The Iris Project Developers. See the
# COPYRIGHT file at the top-level directory of this distribution
# and at http://www.softwareradiosystems.com/iris/copyright.html.
#
# This file is part of the Iris Project.
#
# Iris is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation, either version 3 of
# the License, or (at your option) any later version.
#
# Iris 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 Lesser General Public License for more details.
#
# A copy of the GNU Lesser General Public License can be found in
# the LICENSE file in the top-level directory of this distribution
# and at http://www.gnu.org/licenses/.
#
# - Try to find the Qwt includes and library
# - Defines the following:
#
# QWT_FOUND - system has Qwt
# QWT_INCLUDE_DIR - where to find qwt.h
# QWT_INCLUDE_DIRS - the qwt include directories
# QWT_LIBRARY - where to find the Qwt library (not for general use)
# QWT_LIBRARIES - the libraries to link against to use Qwt
# QWT_MAJOR_VERSION - major version
# QWT_MINOR_VERSION - minor version
# QWT_PATCH_VERSION - patch version
# QWT_VERSION_STRING - version (ex. 5.2.1)
SET(QWT_FOUND "NO")
SET(HINT_INCLUDE_PATHS $ENV{QWT_DIR}/include
$ENV{QWT_DIR}/src
$ENV{QWTDIR}/include
$ENV{QWTDIR}/src
$ENV{QWT_ROOT}/include
$ENV{QWT_ROOT}/src
$ENV{QWTROOT}/include
$ENV{QWTROOT}/src)
SET(POTENTIAL_INCLUDE_PATHS /usr/local/qwt/include
/usr/local/include
/usr/include/qwt
/usr/include/qwt-qt4
/usr/include/qwt5
/usr/include
/opt/local/include/qwt) #macports path
FIND_PATH(QWT_INCLUDE_DIR qwt.h
HINTS ${HINT_INCLUDE_PATHS}
PATHS ${POTENTIAL_INCLUDE_PATHS}
)
SET(QWT_INCLUDE_DIRS ${QWT_INCLUDE_DIR})
# version
SET(_VERSION_FILE ${QWT_INCLUDE_DIR}/qwt_global.h)
IF(EXISTS ${_VERSION_FILE} )
FILE( STRINGS ${_VERSION_FILE} _VERSION_LINE REGEX "define[ ]+QWT_VERSION_STR")
IF( _VERSION_LINE )
STRING( REGEX REPLACE ".*define[ ]+QWT_VERSION_STR[ ]+\"(.*)\".*" "\\1" QWT_VERSION_STRING "${_VERSION_LINE}" )
STRING( REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)" "\\1" QWT_MAJOR_VERSION "${QWT_VERSION_STRING}" )
STRING( REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)" "\\2" QWT_MINOR_VERSION "${QWT_VERSION_STRING}" )
STRING( REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)" "\\3" QWT_PATCH_VERSION "${QWT_VERSION_STRING}" )
ENDIF()
ENDIF()
# check version
SET( _QWT_VERSION_MATCH TRUE )
IF( Qwt_FIND_VERSION AND QWT_VERSION_STRING )
IF( Qwt_FIND_VERSION_EXACT )
IF( NOT Qwt_FIND_VERSION VERSION_EQUAL QWT_VERSION_STRING )
SET( _QWT_VERSION_MATCH FALSE )
ENDIF()
ELSE()
IF( QWT_VERSION_STRING VERSION_LESS Qwt_FIND_VERSION )
SET( _QWT_VERSION_MATCH FALSE )
ENDIF()
ENDIF()
ENDIF()
SET(QWT_NAMES ${QWT_NAMES} qwt qwt-qt4 qwt5 )
SET(HINT_LIBRARY_PATHS $ENV{QWT_DIR}/lib
$ENV{QWTDIR}/lib
$ENV{QWT_ROOT}/lib
$ENV{QWTROOT}/lib)
SET(POTENTIAL_LIBRARY_PATHS /usr/local/qwt/lib
/usr/local/lib
/usr/lib
/opt/local/lib)
FIND_LIBRARY(QWT_LIBRARY
NAMES ${QWT_NAMES}
HINTS ${HINT_LIBRARY_PATHS}
PATHS ${POTENTIAL_LIBRARY_PATHS}
)
MARK_AS_ADVANCED(QWT_LIBRARY)
IF (QWT_LIBRARY)
IF(WIN32 AND NOT CYGWIN)
SET(QWT_NAMES_DEBUG qwtd qwtd-qt4 qwtd5 )
FIND_LIBRARY(QWT_LIBRARY_DEBUG
NAMES ${QWT_NAMES_DEBUG}
HINTS ${HINT_LIBRARY_PATHS}
PATHS ${POTENTIAL_LIBRARY_PATHS}
)
MARK_AS_ADVANCED(QWT_LIBRARY_DEBUG)
IF(QWT_LIBRARY_DEBUG)
SET(QWT_LIBRARIES optimized ${QWT_LIBRARY} debug ${QWT_LIBRARY_DEBUG} CACHE DOC "QWT library files")
ELSE(QWT_LIBRARY_DEBUG)
SET(QWT_LIBRARIES ${QWT_LIBRARY} CACHE DOC "QWT library files")
ENDIF(QWT_LIBRARY_DEBUG)
ADD_DEFINITIONS(-DQWT_DLL)
ELSE(WIN32 AND NOT CYGWIN)
SET(QWT_LIBRARIES ${QWT_LIBRARY} CACHE DOC "QWT library files")
ENDIF(WIN32 AND NOT CYGWIN)
SET(QWT_FOUND "YES")
IF (CYGWIN)
IF(BUILD_SHARED_LIBS)
# No need to define QWT_USE_DLL here, because it's default for Cygwin.
ELSE(BUILD_SHARED_LIBS)
SET (QWT_DEFINITIONS -DQWT_STATIC)
ENDIF(BUILD_SHARED_LIBS)
ENDIF (CYGWIN)
ENDIF (QWT_LIBRARY)
# handle the QUIETLY and REQUIRED arguments
INCLUDE( FindPackageHandleStandardArgs )
IF( CMAKE_VERSION LESS 2.8.3 )
FIND_PACKAGE_HANDLE_STANDARD_ARGS( Qwt DEFAULT_MSG QWT_LIBRARY QWT_INCLUDE_DIR _QWT_VERSION_MATCH )
ELSE()
FIND_PACKAGE_HANDLE_STANDARD_ARGS( Qwt REQUIRED_VARS QWT_LIBRARY QWT_INCLUDE_DIR _QWT_VERSION_MATCH VERSION_VAR QWT_VERSION_STRING )
ENDIF()
MARK_AS_ADVANCED(QWT_INCLUDE_DIR QWT_LIBRARY)

@ -32,7 +32,7 @@
#include <uhd/utils/msg.hpp> #include <uhd/utils/msg.hpp>
#include "cuhd_handler.hpp" #include "cuhd_handler.hpp"
#include "liblte/cuhd/cuhd.h" #include "srslte/cuhd/cuhd.h"
//#define METADATA_VERBOSE //#define METADATA_VERBOSE

@ -1,48 +0,0 @@
#
# Copyright 2012-2013 The libLTE Developers. See the
# COPYRIGHT file at the top-level directory of this distribution.
#
# This file is part of the libLTE library.
#
# libLTE is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation, either version 3 of
# the License, or (at your option) any later version.
#
# libLTE 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 Lesser General Public License for more details.
#
# A copy of the GNU Lesser General Public License can be found in
# the LICENSE file in the top-level directory of this distribution
# and at http://www.gnu.org/licenses/.
#
########################################################################
# Install headers
########################################################################
INSTALL(DIRECTORY include/
DESTINATION "${INCLUDE_DIR}"
FILES_MATCHING PATTERN "*.h"
PATTERN ".svn" EXCLUDE
)
########################################################################
# Add headers to cmake project (useful for IDEs)
########################################################################
SET(HEADERS_ALL "")
FILE(GLOB headers *)
FOREACH (_header ${headers})
IF(IS_DIRECTORY ${_header})
FILE(GLOB_RECURSE tmp "${_header}/*.h")
LIST(APPEND HEADERS_ALL ${tmp})
ENDIF(IS_DIRECTORY ${_header})
ENDFOREACH()
ADD_CUSTOM_TARGET (add_graphics_headers SOURCES ${HEADERS_ALL})
########################################################################
# Add the subdirectories
########################################################################
ADD_SUBDIRECTORY(lib)

@ -1,50 +0,0 @@
/**
*
* \section COPYRIGHT
*
* Copyright 2013-2014 The srsLTE Developers. See the
* COPYRIGHT file at the top-level directory of this distribution.
*
* \section LICENSE
*
* This file is part of the srsLTE library.
*
* srsLTE is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version.
*
* srsLTE 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 Lesser General Public License for more details.
*
* A copy of the GNU Lesser General Public License can be found in
* the LICENSE file in the top-level directory of this distribution
* and at http://www.gnu.org/licenses/.
*
*/
#ifndef _plot_h
#define _plot_h
#ifdef __cplusplus
extern "C" {
#endif
#include "srslte/config.h"
#include "srslte/graphics/plot/plot_real.h"
#include "srslte/graphics/plot/plot_scatter.h"
#include "srslte/graphics/plot/plot_complex.h"
#include "srslte/graphics/plot/plot_waterfall.h"
SRSLTE_API int plot_init();
SRSLTE_API void plot_exit();
#ifdef __cplusplus
}
#endif
#endif

@ -1,60 +0,0 @@
/**
*
* \section COPYRIGHT
*
* Copyright 2013-2014 The srsLTE Developers. See the
* COPYRIGHT file at the top-level directory of this distribution.
*
* \section LICENSE
*
* This file is part of the srsLTE library.
*
* srsLTE is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version.
*
* srsLTE 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 Lesser General Public License for more details.
*
* A copy of the GNU Lesser General Public License can be found in
* the LICENSE file in the top-level directory of this distribution
* and at http://www.gnu.org/licenses/.
*
*/
#ifndef _plot_complex_h
#define _plot_complex_h
#ifdef __cplusplus
extern "C" {
#endif
#include <stdbool.h>
#include "srslte/config.h"
typedef enum {
Ip, Q, Magnitude, Phase
} plot_complex_id_t;
typedef void* plot_complex_t;
SRSLTE_API int plot_complex_init(plot_complex_t *h);
SRSLTE_API void plot_complex_setTitle(plot_complex_t *h, char *title);
SRSLTE_API void plot_complex_setNewData(plot_complex_t *h, _Complex float *data,
int num_points);
SRSLTE_API void plot_complex_setXAxisAutoScale(plot_complex_t *h, plot_complex_id_t id, bool on);
SRSLTE_API void plot_complex_setYAxisAutoScale(plot_complex_t *h, plot_complex_id_t id, bool on);
SRSLTE_API void plot_complex_setXAxisScale(plot_complex_t *h, plot_complex_id_t id, double xMin, double xMax);
SRSLTE_API void plot_complex_setYAxisScale(plot_complex_t *h, plot_complex_id_t id, double yMin, double yMax);
SRSLTE_API void plot_complex_setXAxisRange(plot_complex_t *h, double xMin, double xMax);
#ifdef __cplusplus
}
#endif
#endif

@ -1,56 +0,0 @@
/**
*
* \section COPYRIGHT
*
* Copyright 2013-2014 The srsLTE Developers. See the
* COPYRIGHT file at the top-level directory of this distribution.
*
* \section LICENSE
*
* This file is part of the srsLTE library.
*
* srsLTE is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version.
*
* srsLTE 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 Lesser General Public License for more details.
*
* A copy of the GNU Lesser General Public License can be found in
* the LICENSE file in the top-level directory of this distribution
* and at http://www.gnu.org/licenses/.
*
*/
#ifndef _plot_real_h
#define _plot_real_h
#ifdef __cplusplus
extern "C" {
#endif
#include <stdbool.h>
#include "srslte/config.h"
typedef void* plot_real_t;
SRSLTE_API int plot_real_init(plot_real_t *h);
SRSLTE_API void plot_real_setTitle(plot_real_t *h, char *title);
SRSLTE_API void plot_real_setNewData(plot_real_t *h, float *data,
int num_points);
SRSLTE_API void plot_real_setXAxisAutoScale(plot_real_t *h, bool on);
SRSLTE_API void plot_real_setYAxisAutoScale(plot_real_t *h, bool on);
SRSLTE_API void plot_real_setXAxisScale(plot_real_t *h, double xMin, double xMax);
SRSLTE_API void plot_real_setYAxisScale(plot_real_t *h, double yMin, double yMax);
SRSLTE_API void plot_real_setXAxisRange(plot_real_t *h, double xMin, double xMax);
SRSLTE_API void plot_real_setLabels(plot_real_t *h, char *xLabel, char *yLabel);
#ifdef __cplusplus
}
#endif
#endif

@ -1,55 +0,0 @@
/**
*
* \section COPYRIGHT
*
* Copyright 2013-2014 The srsLTE Developers. See the
* COPYRIGHT file at the top-level directory of this distribution.
*
* \section LICENSE
*
* This file is part of the srsLTE library.
*
* srsLTE is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version.
*
* srsLTE 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 Lesser General Public License for more details.
*
* A copy of the GNU Lesser General Public License can be found in
* the LICENSE file in the top-level directory of this distribution
* and at http://www.gnu.org/licenses/.
*
*/
#ifndef _plot_scatter_h
#define _plot_scatter_h
#ifdef __cplusplus
extern "C" {
#endif
#include <stdbool.h>
#include "srslte/config.h"
typedef void* plot_scatter_t;
SRSLTE_API int plot_scatter_init(plot_scatter_t *h);
SRSLTE_API void plot_scatter_setTitle(plot_scatter_t *h, char *title);
SRSLTE_API void plot_scatter_setNewData(plot_scatter_t *h, _Complex float *data,
int num_points);
SRSLTE_API void plot_scatter_setXAxisAutoScale(plot_scatter_t *h, bool on);
SRSLTE_API void plot_scatter_setYAxisAutoScale(plot_scatter_t *h, bool on);
SRSLTE_API void plot_scatter_setXAxisScale(plot_scatter_t *h, double xMin, double xMax);
SRSLTE_API void plot_scatter_setYAxisScale(plot_scatter_t *h, double yMin, double yMax);
SRSLTE_API void plot_scatter_setAxisLabels(plot_scatter_t *h, char *xLabel, char *yLabel);
#ifdef __cplusplus
}
#endif
#endif

@ -1,62 +0,0 @@
/**
*
* \section COPYRIGHT
*
* Copyright 2013-2014 The srsLTE Developers. See the
* COPYRIGHT file at the top-level directory of this distribution.
*
* \section LICENSE
*
* This file is part of the srsLTE library.
*
* srsLTE is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version.
*
* srsLTE 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 Lesser General Public License for more details.
*
* A copy of the GNU Lesser General Public License can be found in
* the LICENSE file in the top-level directory of this distribution
* and at http://www.gnu.org/licenses/.
*
*/
#ifndef _plot_waterfall_h
#define _plot_waterfall_h
#ifdef __cplusplus
extern "C" {
#endif
#include <stdbool.h>
#include "srslte/config.h"
typedef void* plot_waterfall_t;
SRSLTE_API int plot_waterfall_init(plot_waterfall_t *h, int numDataPoints, int numRows);
SRSLTE_API void plot_waterfall_setTitle(plot_waterfall_t *h, char *title);
SRSLTE_API void plot_waterfall_appendNewData(plot_waterfall_t *h, float *data,
int num_points);
SRSLTE_API void plot_complex_setPlotXLabel(plot_waterfall_t *h, char *xLabel);
SRSLTE_API void plot_complex_setPlotYLabel(plot_waterfall_t *h, char *yLabel);
SRSLTE_API void plot_waterfall_setPlotXAxisRange(plot_waterfall_t *h, double xMin, double xMax);
SRSLTE_API void plot_waterfall_setPlotXAxisScale(plot_waterfall_t *h, double xMin, double xMax);
SRSLTE_API void plot_waterfall_setPlotYAxisScale(plot_waterfall_t *h, double yMin, double yMax);
SRSLTE_API void plot_waterfall_setSpectrogramXLabel(plot_waterfall_t *h, char* xLabel);
SRSLTE_API void plot_waterfall_setSpectrogramYLabel(plot_waterfall_t *h, char* yLabel);
SRSLTE_API void plot_waterfall_setSpectrogramXAxisRange(plot_waterfall_t *h, double xMin, double xMax);
SRSLTE_API void plot_waterfall_setSpectrogramYAxisRange(plot_waterfall_t *h, double yMin, double yMax);
SRSLTE_API void plot_waterfall_setSpectrogramZAxisScale(plot_waterfall_t *h, double zMin, double zMax);
#ifdef __cplusplus
}
#endif
#endif

@ -1,94 +0,0 @@
#
# Copyright 2012-2013 The libLTE Developers. See the
# COPYRIGHT file at the top-level directory of this distribution.
#
# This file is part of the libLTE library.
#
# libLTE is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation, either version 3 of
# the License, or (at your option) any later version.
#
# libLTE 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 Lesser General Public License for more details.
#
# A copy of the GNU Lesser General Public License can be found in
# the LICENSE file in the top-level directory of this distribution
# and at http://www.gnu.org/licenses/.
#
########################################################################
# Setup Qt and Qwt
########################################################################
FIND_PACKAGE(Qt4)
IF(QT4_FOUND)
INCLUDE(${QT_USE_FILE})
ENDIF(QT4_FOUND)
FIND_PACKAGE(Qwt)
IF(QT4_FOUND AND QWT_FOUND)
INCLUDE_DIRECTORIES(${QWT_INCLUDE_DIRS})
ENDIF(QT4_FOUND AND QWT_FOUND)
########################################################################
# Build the graphics library
########################################################################
file(GLOB modules *)
SET(SOURCES_ALL "")
FOREACH (_module ${modules})
IF(IS_DIRECTORY ${_module})
FILE(GLOB tmp "${_module}/*.cpp")
LIST(APPEND SOURCES_ALL ${tmp})
ENDIF(IS_DIRECTORY ${_module})
ENDFOREACH(_module ${modules})
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../../)
IF(QWT_MAJOR_VERSION LESS 6)
MESSAGE(STATUS "QWT6 is required.")
ENDIF(QWT_MAJOR_VERSION LESS 6)
IF(QT4_FOUND AND QWT_FOUND AND QWT_MAJOR_VERSION EQUAL 6)
QT4_WRAP_CPP(lineplotwraps common/Lineplot.h)
QT4_WRAP_CPP(pointplotwraps common/Pointplot.h)
QT4_WRAP_CPP(spectrogramplotwraps common/Spectrogramplot.h)
QT4_WRAP_CPP(complex complexplot/ComplexWidget.h complexplot/ComplexplotWrapper.h)
QT4_WRAP_CPP(real realplot/RealWidget.h realplot/RealplotWrapper.h)
QT4_WRAP_CPP(scatter scatterplot/ScatterWidget.h scatterplot/ScatterplotWrapper.h)
QT4_WRAP_CPP(waterfall waterfallplot/WaterfallWidget.h waterfallplot/WaterfallplotWrapper.h)
INCLUDE_DIRECTORIES(common complexplot realplot scatterplot waterfallplot ${Boost_INCLUDE_DIRS})
ADD_LIBRARY(graphics SHARED ${eventwraps} ${lineplotwraps} ${pointplotwraps} ${spectrogramplotwraps} ${complex} ${real} ${scatter} ${waterfall} ${SOURCES_ALL} )
TARGET_LINK_LIBRARIES(graphics pthread ${QT_LIBRARIES} ${QWT_LIBRARIES})
INSTALL(TARGETS graphics DESTINATION ${LIBRARY_DIR})
LIBLTE_SET_PIC(graphics)
APPEND_INTERNAL_LIST(OPTIONAL_LIBS graphics)
#ADD_SUBDIRECTORY(complexplot/test)
#ADD_SUBDIRECTORY(realplot/test)
#ADD_SUBDIRECTORY(scatterplot/test)
#ADD_SUBDIRECTORY(waterfallplot/test)
MESSAGE(STATUS " GRAPHICS library will be installed.")
ELSE(QT4_FOUND AND QWT_FOUND AND AND QWT_MAJOR_VERSION EQUAL 6)
MESSAGE(STATUS " QT4 or Qwt6 not found. GRAPHICS library is not generated")
ENDIF(QT4_FOUND AND QWT_FOUND AND QWT_MAJOR_VERSION EQUAL 6)

@ -1,94 +0,0 @@
/**
* \file lib/generic/graphics/qt/common/Events.cpp
* \version 1.0
*
* \section COPYRIGHT
*
* Copyright 2012-2013 The Iris Project Developers. See the
* COPYRIGHT file at the top-level directory of this distribution
* and at http://www.softwareradiosystems.com/iris/copyright.html.
*
* \section LICENSE
*
* This file is part of the Iris Project.
*
* Iris is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version.
*
* Iris 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 Lesser General Public License for more details.
*
* A copy of the GNU Lesser General Public License can be found in
* the LICENSE file in the top-level directory of this distribution
* and at http://www.gnu.org/licenses/.
*
* \section DESCRIPTION
*
* Implementation of events used to pass data to Qt-based classes.
*/
#include "Events.h"
using namespace std;
const QEvent::Type RealDataEvent::type = static_cast<QEvent::Type>(10000);
RealDataEvent::RealDataEvent(double* dataPoints, int numPoints)
: QEvent(QEvent::Type(type))
{
dataPoints_ = new double[numPoints];
numPoints_ = numPoints;
memcpy(dataPoints_, dataPoints, numPoints*sizeof(double));
}
RealDataEvent::RealDataEvent(float* dataPoints, int numPoints)
: QEvent(QEvent::Type(type))
{
dataPoints_ = new double[numPoints];
numPoints_ = numPoints;
for(int i=0;i<numPoints_;i++)
{
dataPoints_[i] = (double)(dataPoints[i]);
}
}
RealDataEvent::~RealDataEvent()
{
delete[] dataPoints_;
}
const QEvent::Type ComplexDataEvent::type = static_cast<QEvent::Type>(10001);
ComplexDataEvent::ComplexDataEvent(complex<double>* dataPoints,
int numPoints)
: QEvent(QEvent::Type(type))
{
dataPoints_ = new complex<double>[numPoints];
numPoints_ = numPoints;
memcpy(dataPoints_, dataPoints, numPoints*sizeof(complex<double>));
}
ComplexDataEvent::ComplexDataEvent(complex<float>* dataPoints,
int numPoints)
: QEvent(QEvent::Type(type))
{
dataPoints_ = new complex<double>[numPoints];
numPoints_ = numPoints;
for(int i=0;i<numPoints_;i++)
{
dataPoints_[i] = complex<double>(dataPoints[i].real(),
dataPoints[i].imag());
}
}
ComplexDataEvent::~ComplexDataEvent()
{
delete[] dataPoints_;
}

@ -1,72 +0,0 @@
/**
* \file lib/generic/graphics/qt/common/Events.h
* \version 1.0
*
* \section COPYRIGHT
*
* Copyright 2012-2013 The Iris Project Developers. See the
* COPYRIGHT file at the top-level directory of this distribution
* and at http://www.softwareradiosystems.com/iris/copyright.html.
*
* \section LICENSE
*
* This file is part of the Iris Project.
*
* Iris is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version.
*
* Iris 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 Lesser General Public License for more details.
*
* A copy of the GNU Lesser General Public License can be found in
* the LICENSE file in the top-level directory of this distribution
* and at http://www.gnu.org/licenses/.
*
* \section DESCRIPTION
*
* Events used to pass data to Qt-based classes.
*/
#ifndef EVENTS_H
#define EVENTS_H
#include <QEvent>
#include <complex>
class RealDataEvent
: public QEvent
{
public:
const static QEvent::Type type;
RealDataEvent(double* dataPoints,
int numPoints);
RealDataEvent(float* dataPoints,
int numPoints);
virtual ~RealDataEvent();
double* dataPoints_;
int numPoints_;
};
class ComplexDataEvent
: public QEvent
{
public:
const static QEvent::Type type;
ComplexDataEvent(std::complex<double>* dataPoints,
int numPoints);
ComplexDataEvent(std::complex<float>* dataPoints,
int numPoints);
virtual ~ComplexDataEvent();
std::complex<double>* dataPoints_;
int numPoints_;
};
#endif // EVENTS_H

@ -1,168 +0,0 @@
/**
* \file lib/generic/graphics/qt/common/Lineplot.cpp
* \version 1.0
*
* \section COPYRIGHT
*
* Copyright 2012-2013 The Iris Project Developers. See the
* COPYRIGHT file at the top-level directory of this distribution
* and at http://www.softwareradiosystems.com/iris/copyright.html.
*
* \section LICENSE
*
* This file is part of the Iris Project.
*
* Iris is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version.
*
* Iris 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 Lesser General Public License for more details.
*
* A copy of the GNU Lesser General Public License can be found in
* the LICENSE file in the top-level directory of this distribution
* and at http://www.gnu.org/licenses/.
*
* \section DESCRIPTION
*
* Implementation of a simple line plotted using a QwtPlot.
*/
#include "Lineplot.h"
#include <algorithm>
class MyZoomer: public QwtPlotZoomer
{
public:
MyZoomer(QwtPlotCanvas *canvas):
QwtPlotZoomer(canvas)
{
setTrackerMode(AlwaysOn);
}
virtual QwtText trackerTextF(const QPointF &pos) const
{
QColor bg(Qt::white);
bg.setAlpha(200);
QwtText text = QwtPlotZoomer::trackerTextF(pos);
text.setBackgroundBrush( QBrush( bg ));
return text;
}
};
Lineplot::Lineplot(QWidget *parent)
:QwtPlot(parent)
,xMin_(0)
,xMax_(0)
{
counter_ = 0;
numPoints_ = 1;
indexPoints_ = new double[numPoints_];
dataPoints_ = new double[numPoints_];
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
QPalette palette;
palette.setColor(canvas()->backgroundRole(), QColor("white"));
canvas()->setPalette(palette);
curve_ = new QwtPlotCurve("Curve");
curve_->setPen(QPen(Qt::blue, 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
curve_->setStyle(QwtPlotCurve::Lines);
curve_->setRawSamples(indexPoints_, dataPoints_, numPoints_);
curve_->setYAxis(QwtPlot::yLeft);
curve_->attach(this);
memset(dataPoints_, 0x0, numPoints_*sizeof(double));
for(int i=0;i<numPoints_;i++)
indexPoints_[i] = i;
enableAxis(QwtPlot::yRight);
QwtScaleWidget *leftAxis = axisWidget(QwtPlot::yLeft);
connect(leftAxis, SIGNAL(scaleDivChanged()), this, SLOT(linkScales()));
setAxisScaleEngine(QwtPlot::xBottom, new QwtLinearScaleEngine);
setAxisScaleEngine(QwtPlot::yLeft, new QwtLinearScaleEngine);
setAxisScaleEngine(QwtPlot::yRight, new QwtLinearScaleEngine);
axisScaleEngine(QwtPlot::xBottom)->setAttribute(QwtScaleEngine::Floating,true);
axisScaleEngine(QwtPlot::yLeft)->setAttribute(QwtScaleEngine::Floating,true);
axisScaleEngine(QwtPlot::yRight)->setAttribute(QwtScaleEngine::Floating,true);
zoomer_ = new MyZoomer(qobject_cast<QwtPlotCanvas*>(canvas()));
zoomer_->setMousePattern(QwtEventPattern::MouseSelect1, Qt::LeftButton);
zoomer_->setMousePattern(QwtEventPattern::MouseSelect2, Qt::LeftButton,
Qt::ControlModifier);
panner_ = new QwtPlotPanner(canvas());
panner_->setMouseButton(Qt::RightButton);
magnifier_ = new QwtPlotMagnifier(canvas());
magnifier_->setMouseButton(Qt::NoButton);
}
Lineplot::~Lineplot()
{
delete[] indexPoints_;
delete[] dataPoints_;
}
void Lineplot::setData(double* data, int n)
{
if(numPoints_ != n)
{
numPoints_ = n;
delete[] indexPoints_;
delete[] dataPoints_;
indexPoints_ = new double[numPoints_];
dataPoints_ = new double[numPoints_];
if(xMin_==xMax_)
{
for(int i=0;i<numPoints_;i++)
indexPoints_[i] = i;
}
else
{
double step = (xMax_-xMin_)/numPoints_;
double val = xMin_;
for(int i=0;i<numPoints_;i++,val+=step)
indexPoints_[i] = val;
}
}
memcpy(dataPoints_, data, numPoints_*sizeof(double));
//Need to setRawSamples again for autoscaling to work
curve_->setRawSamples(indexPoints_, dataPoints_, numPoints_);
resetZoom();
}
void Lineplot::setXAxisRange(double xMin, double xMax)
{
xMin_ = xMin;
xMax_ = xMax;
double step = (xMax_-xMin_)/numPoints_;
double val = xMin_;
for(int i=0;i<numPoints_;i++,val+=step)
indexPoints_[i] = val;
curve_->setRawSamples(indexPoints_, dataPoints_, numPoints_);
}
void Lineplot::resetZoom()
{
zoomer_->setZoomBase(curve_->boundingRect());
}
void Lineplot::linkScales()
{
#if QWT_VERSION < 0x060100
setAxisScaleDiv(QwtPlot::yRight, *axisScaleDiv(QwtPlot::yLeft));
#else // QWT_VERSION < 0x060100
setAxisScaleDiv(QwtPlot::yRight, axisScaleDiv(QwtPlot::yLeft));
#endif // QWT_VERSION < 0x060100
}

@ -1,80 +0,0 @@
/**
* \file lib/generic/graphics/qt/common/Lineplot.h
* \version 1.0
*
* \section COPYRIGHT
*
* Copyright 2012-2013 The Iris Project Developers. See the
* COPYRIGHT file at the top-level directory of this distribution
* and at http://www.softwareradiosystems.com/iris/copyright.html.
*
* \section LICENSE
*
* This file is part of the Iris Project.
*
* Iris is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version.
*
* Iris 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 Lesser General Public License for more details.
*
* A copy of the GNU Lesser General Public License can be found in
* the LICENSE file in the top-level directory of this distribution
* and at http://www.gnu.org/licenses/.
*
* \section DESCRIPTION
*
* A simple line plotted using a QwtPlot.
*/
#ifndef LINEPLOT_H
#define LINEPLOT_H
#include <qapplication.h>
#include <qwt_plot.h>
#include <qwt_painter.h>
#include <qwt_plot_canvas.h>
#include <qwt_plot_curve.h>
#include <qwt_scale_engine.h>
#include <qwt_scale_widget.h>
#include <qwt_plot_zoomer.h>
#include <qwt_plot_panner.h>
#include <qwt_plot_magnifier.h>
class Lineplot
: public QwtPlot
{
Q_OBJECT
public:
Lineplot(QWidget* parent = 0);
virtual ~Lineplot();
void setData(double* data, int n);
void setXAxisRange(double xMin, double xMax);
void resetZoom();
public slots:
void linkScales();
private:
QwtPlotCurve* curve_;
QwtPlotPanner* panner_;
QwtPlotZoomer* zoomer_;
QwtPlotMagnifier* magnifier_;
double* indexPoints_;
double* dataPoints_;
int numPoints_;
int counter_;
double xMin_;
double xMax_;
};
#endif // LINEPLOT_H

@ -1,121 +0,0 @@
/**
* \file lib/generic/graphics/qt/common/Pointplot.h
* \version 1.0
*
* \section COPYRIGHT
*
* Copyright 2012-2013 The Iris Project Developers. See the
* COPYRIGHT file at the top-level directory of this distribution
* and at http://www.softwareradiosystems.com/iris/copyright.html.
*
* \section LICENSE
*
* This file is part of the Iris Project.
*
* Iris is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version.
*
* Iris 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 Lesser General Public License for more details.
*
* A copy of the GNU Lesser General Public License can be found in
* the LICENSE file in the top-level directory of this distribution
* and at http://www.gnu.org/licenses/.
*
* \section DESCRIPTION
*
* Implementation of a plot of complex data values as points on an IQ axis.
*/
#include "Pointplot.h"
#include <algorithm>
using namespace std;
class MyZoomer: public QwtPlotZoomer
{
public:
MyZoomer(QwtPlotCanvas *canvas):
QwtPlotZoomer(canvas)
{
setTrackerMode(AlwaysOn);
}
virtual QwtText trackerTextF(const QPointF &pos) const
{
QColor bg(Qt::white);
bg.setAlpha(200);
QwtText text = QwtPlotZoomer::trackerTextF(pos);
text.setBackgroundBrush( QBrush( bg ));
return text;
}
};
Pointplot::Pointplot(QWidget *parent)
:QwtPlot(parent)
{
counter_ = 0;
numPoints_ = 1;
realPoints_ = new double[numPoints_];
imagPoints_ = new double[numPoints_];
QPalette palette;
palette.setColor(canvas()->backgroundRole(), QColor("white"));
canvas()->setPalette(palette);
setAxisScaleEngine(QwtPlot::xBottom, new QwtLinearScaleEngine);
setAxisTitle(QwtPlot::xBottom, "In-phase");
setAxisScaleEngine(QwtPlot::yLeft, new QwtLinearScaleEngine);
setAxisTitle(QwtPlot::yLeft, "Quadrature");
curve_ = new QwtPlotCurve("Constellation Points");
curve_->attach(this);
curve_->setPen(QPen(Qt::blue, 5, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
curve_->setStyle(QwtPlotCurve::Dots);
curve_->setRawSamples(realPoints_, imagPoints_, numPoints_);
memset(realPoints_, 0x0, numPoints_*sizeof(double));
memset(imagPoints_, 0x0, numPoints_*sizeof(double));
zoomer_ = new MyZoomer(qobject_cast<QwtPlotCanvas*>(canvas()));
zoomer_->setMousePattern(QwtEventPattern::MouseSelect1, Qt::LeftButton);
zoomer_->setMousePattern(QwtEventPattern::MouseSelect2, Qt::LeftButton,
Qt::ControlModifier);
panner_ = new QwtPlotPanner(canvas());
panner_->setMouseButton(Qt::RightButton);
magnifier_ = new QwtPlotMagnifier(canvas());
magnifier_->setMouseButton(Qt::NoButton);
}
Pointplot::~Pointplot()
{
delete[] realPoints_;
delete[] imagPoints_;
}
void Pointplot::setData(double* iData, double* qData, int n)
{
if(numPoints_ != n)
{
numPoints_ = n;
delete[] realPoints_;
delete[] imagPoints_;
realPoints_ = new double[numPoints_];
imagPoints_ = new double[numPoints_];
}
copy(iData, iData+n, realPoints_);
copy(qData, qData+n, imagPoints_);
//Need to setRawSamples again for autoscaling to work
curve_->setRawSamples(realPoints_, imagPoints_, numPoints_);
zoomer_->setZoomBase(curve_->boundingRect());
}

@ -1,76 +0,0 @@
/**
* \file lib/generic/graphics/qt/common/Pointplot.h
* \version 1.0
*
* \section COPYRIGHT
*
* Copyright 2012-2013 The Iris Project Developers. See the
* COPYRIGHT file at the top-level directory of this distribution
* and at http://www.softwareradiosystems.com/iris/copyright.html.
*
* \section LICENSE
*
* This file is part of the Iris Project.
*
* Iris is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version.
*
* Iris 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 Lesser General Public License for more details.
*
* A copy of the GNU Lesser General Public License can be found in
* the LICENSE file in the top-level directory of this distribution
* and at http://www.gnu.org/licenses/.
*
* \section DESCRIPTION
*
* A plot of complex data values as points on an IQ axis.
*/
#ifndef POINTPLOT_H
#define POINTPLOT_H
#include <qapplication.h>
#include <qwt_plot.h>
#include <qwt_painter.h>
#include <qwt_plot_canvas.h>
#include <qwt_plot_curve.h>
#include <qwt_scale_engine.h>
#include <qwt_scale_widget.h>
#include <qwt_plot_zoomer.h>
#include <qwt_plot_panner.h>
#include <qwt_plot_magnifier.h>
#include <complex>
class Pointplot
: public QwtPlot
{
Q_OBJECT
public:
Pointplot(QWidget* parent = 0);
virtual ~Pointplot();
void setData(double* iData, double* qData, int n);
private:
QwtPlotCurve* curve_;
QwtPlotPanner* panner_;
QwtPlotZoomer* zoomer_;
QwtPlotMagnifier* magnifier_;
struct opReal{double operator()(std::complex<double> i) const{return real(i);}};
struct opImag{double operator()(std::complex<double> i) const{return imag(i);}};
double* realPoints_;
double* imagPoints_;
int numPoints_;
int counter_;
};
#endif // POINTPLOT_H

@ -1,199 +0,0 @@
/**
* \file lib/generic/graphics/qt/common/Spectrogramplot.cpp
* \version 1.0
*
* \section COPYRIGHT
*
* Copyright 2012-2013 The Iris Project Developers. See the
* COPYRIGHT file at the top-level directory of this distribution
* and at http://www.softwareradiosystems.com/iris/copyright.html.
*
* \section LICENSE
*
* This file is part of the Iris Project.
*
* Iris is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version.
*
* Iris 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 Lesser General Public License for more details.
*
* A copy of the GNU Lesser General Public License can be found in
* the LICENSE file in the top-level directory of this distribution
* and at http://www.gnu.org/licenses/.
*
* \section DESCRIPTION
*
* A spectrogram plot which acts as a waterfall. New data is plotted
* at the top row of the spectrogram and all old data is shifted
* downwards.
*/
#include <qprinter.h>
#include <qprintdialog.h>
#include <qwt_color_map.h>
#include <qwt_plot_canvas.h>
#include <qwt_plot_spectrogram.h>
#include <qwt_scale_widget.h>
#include <qwt_scale_draw.h>
#include <qwt_plot_layout.h>
#include <qwt_plot_renderer.h>
#include <qwt_matrix_raster_data.h>
#include "Spectrogramplot.h"
class MyZoomer: public QwtPlotZoomer
{
public:
MyZoomer(QwtPlotCanvas *canvas):
QwtPlotZoomer(canvas)
{
setTrackerMode(AlwaysOn);
}
virtual QwtText trackerTextF(const QPointF &pos) const
{
QColor bg(Qt::white);
bg.setAlpha(200);
QwtText text = QwtPlotZoomer::trackerTextF(pos);
text.setBackgroundBrush( QBrush( bg ));
return text;
}
};
//Set up a colormap to use the "jet" colormap from matlab
class ColorMap
:public QwtLinearColorMap
{
public:
ColorMap()
:QwtLinearColorMap(QColor(0,0,189), QColor(132,0,0))
{
double pos;
pos = 1.0/13.0*1.0; addColorStop(pos, QColor(0,0,255));
pos = 1.0/13.0*2.0; addColorStop(pos, QColor(0,66,255));
pos = 1.0/13.0*3.0; addColorStop(pos, QColor(0,132,255));
pos = 1.0/13.0*4.0; addColorStop(pos, QColor(0,189,255));
pos = 1.0/13.0*5.0; addColorStop(pos, QColor(0,255,255));
pos = 1.0/13.0*6.0; addColorStop(pos, QColor(66,255,189));
pos = 1.0/13.0*7.0; addColorStop(pos, QColor(132,255,132));
pos = 1.0/13.0*8.0; addColorStop(pos, QColor(189,255,66));
pos = 1.0/13.0*9.0; addColorStop(pos, QColor(255,255,0));
pos = 1.0/13.0*10.0; addColorStop(pos, QColor(255,189,0));
pos = 1.0/13.0*12.0; addColorStop(pos, QColor(255,66,0));
pos = 1.0/13.0*13.0; addColorStop(pos, QColor(189,0,0));
}
};
Spectrogramplot::Spectrogramplot(int numDataPoints, int numRows, QWidget *parent)
:QwtPlot(parent)
,nData_(numDataPoints)
,nRows_(numRows)
{
spectrogram_ = new QwtPlotSpectrogram();
spectrogram_->setRenderThreadCount(0); // set system specific thread count
data_ = new WaterfallData(nData_, nRows_);
spectrogram_->attach(this);
setAxisScaleEngine(QwtPlot::xBottom, new QwtLinearScaleEngine);
setAxisScaleEngine(QwtPlot::yLeft, new QwtLinearScaleEngine);
axisScaleEngine(QwtPlot::xBottom)->setAttribute(QwtScaleEngine::Floating,true);
axisScaleEngine(QwtPlot::yLeft)->setAttribute(QwtScaleEngine::Floating,true);
spectrogram_->setColorMap(new ColorMap());
spectrogram_->setData(data_);
setXAxisRange(0, nData_);
setYAxisRange(0, nRows_);
setZAxisScale(-1,1);
// LeftButton for the zooming
// MidButton for the panning
// RightButton: zoom out by 1
// Ctrl+RighButton: zoom out to full size
zoomer_ = new MyZoomer(qobject_cast<QwtPlotCanvas*>(canvas()));
zoomer_->setMousePattern(QwtEventPattern::MouseSelect1,
Qt::LeftButton);
zoomer_->setMousePattern(QwtEventPattern::MouseSelect2,
Qt::LeftButton, Qt::ControlModifier);
panner_ = new QwtPlotPanner(canvas());
panner_->setAxisEnabled(QwtPlot::yRight, false);
panner_->setMouseButton(Qt::RightButton);
magnifier_ = new QwtPlotMagnifier(canvas());
magnifier_->setMouseButton(Qt::NoButton);
// Avoid jumping when labels with more/less digits
// appear/disappear when scrolling vertically
const QFontMetrics fm(axisWidget(QwtPlot::yLeft)->font());
QwtScaleDraw *sd = axisScaleDraw(QwtPlot::yLeft);
sd->setMinimumExtent( fm.width("100.00") );
const QColor c(Qt::darkBlue);
zoomer_->setRubberBandPen(c);
zoomer_->setTrackerPen(c);
}
void Spectrogramplot::appendData(double* data, int n)
{
data_->appendData(data, n);
}
void Spectrogramplot::setXAxisRange(double xMin, double xMax)
{
xMin_ = xMin;
xMax_ = xMax;
data_->setInterval( Qt::XAxis, QwtInterval( xMin_, xMax_ ) );
plotLayout()->setAlignCanvasToScales(true);
replot();
}
void Spectrogramplot::setYAxisRange(double yMin, double yMax)
{
yMin_ = yMin;
yMax_ = yMax;
data_->setInterval( Qt::YAxis, QwtInterval( yMin_, yMax_ ) );
plotLayout()->setAlignCanvasToScales(true);
replot();
}
void Spectrogramplot::setZAxisScale(double zMin, double zMax)
{
zMin_ = zMin;
zMax_ = zMax;
data_->setInterval( Qt::ZAxis, QwtInterval( zMin_, zMax_ ) );
//Set up the intensity bar on the right
const QwtInterval zInterval = spectrogram_->data()->interval( Qt::ZAxis );
QwtScaleWidget *rightAxis = axisWidget(QwtPlot::yRight);
rightAxis->setColorBarEnabled(true);
rightAxis->setColorMap( zInterval, new ColorMap());
setAxisScale(QwtPlot::yRight, zInterval.minValue(), zInterval.maxValue() );
enableAxis(QwtPlot::yRight);
plotLayout()->setAlignCanvasToScales(true);
replot();
}
double Spectrogramplot::min()
{
return data_->min();
}
double Spectrogramplot::max()
{
return data_->max();
}
void Spectrogramplot::autoscale()
{
setZAxisScale(min(),max());
}

@ -1,79 +0,0 @@
/**
* \file lib/generic/graphics/qt/common/Spectrogramplot.h
* \version 1.0
*
* \section COPYRIGHT
*
* Copyright 2012-2013 The Iris Project Developers. See the
* COPYRIGHT file at the top-level directory of this distribution
* and at http://www.softwareradiosystems.com/iris/copyright.html.
*
* \section LICENSE
*
* This file is part of the Iris Project.
*
* Iris is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version.
*
* Iris 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 Lesser General Public License for more details.
*
* A copy of the GNU Lesser General Public License can be found in
* the LICENSE file in the top-level directory of this distribution
* and at http://www.gnu.org/licenses/.
*
* \section DESCRIPTION
*
* A spectrogram plot which acts as a waterfall. New data is plotted
* at the top row of the spectrogram and all old data is shifted
* downwards.
*/
#ifndef SPECTROGRAMPLOT_H
#define SPECTROGRAMPLOT_H
#include <qwt_plot.h>
#include <qwt_scale_engine.h>
#include <qwt_scale_widget.h>
#include <qwt_plot_zoomer.h>
#include <qwt_plot_panner.h>
#include <qwt_plot_magnifier.h>
#include <qwt_plot_spectrogram.h>
#include "WaterfallData.h"
class Spectrogramplot
:public QwtPlot
{
Q_OBJECT
public:
Spectrogramplot(int numDataPoints, int numRows, QWidget * = NULL);
void appendData(double* data, int n);
void setXAxisRange(double xMin, double xMax);
void setYAxisRange(double yMin, double yMax);
void setZAxisScale(double zMin, double zMax);
double min();
double max();
void autoscale();
private:
QwtPlotZoomer* zoomer_;
QwtPlotPanner *panner_;
QwtPlotMagnifier *magnifier_;
QwtPlotSpectrogram *spectrogram_;
WaterfallData* data_;
int nData_;
int nRows_;
double xMin_;
double xMax_;
double yMin_;
double yMax_;
double zMin_;
double zMax_;
};
#endif // SPECTROGRAMPLOT_H

@ -1,90 +0,0 @@
#ifndef WATERFALLDATA_H
#define WATERFALLDATA_H
#include <qwt_raster_data.h>
#include <boost/circular_buffer.hpp>
#include <boost/shared_ptr.hpp>
#include <vector>
#include <algorithm>
#include <cmath>
#include <assert.h>
class WaterfallData
:public QwtRasterData
{
public:
typedef std::vector<double> Vec;
typedef boost::shared_ptr< std::vector<double> > VecPtr;
typedef boost::circular_buffer< VecPtr > VecPtrBuf;
typedef VecPtrBuf::iterator VecPtrBufIt;
WaterfallData(int numDataPoints, int numRows)
:QwtRasterData()
,nData_(numDataPoints)
,nRows_(numRows)
,data_(numRows)
{
for(int i=0;i<nRows_;i++)
{
data_.push_front(VecPtr(new std::vector<double>(nData_)));
data_[0]->assign(nData_, 0.0);
}
}
void appendData(double* data, int n)
{
assert(n == nData_);
VecPtr v = data_.front();
v->assign(data, data+n);
data_.push_back(v);
}
double max()
{
Vec maxVec;
for(int i=0;i<nRows_;i++)
{
VecPtr v = data_[i];
maxVec.push_back(*(std::max_element(v->begin(),v->end())));
}
return *(std::max_element(maxVec.begin(),maxVec.end()));
}
double min()
{
Vec minVec;
for(int i=0;i<nRows_;i++)
{
VecPtr v = data_[i];
minVec.push_back(*(std::min_element(v->begin(),v->end())));
}
return *(std::min_element(minVec.begin(),minVec.end()));
}
double value(double x, double y) const
{
double bottom = interval(Qt::YAxis).minValue();
double top = interval(Qt::YAxis).maxValue();
double left = interval(Qt::XAxis).minValue();
double right = interval(Qt::XAxis).maxValue();
double xStep = std::abs(right-left)/nData_;
double yStep = std::abs(top-bottom)/nRows_;
int ix = (x-left) / xStep;
int iy = (y-bottom) / yStep;
if(ix >= nData_)
ix = nData_-1;
if(iy >= nRows_)
iy = nRows_-1;
double ret = (*data_[iy])[ix];
return ret;
}
private:
VecPtrBuf data_;
int nData_;
int nRows_;
};
#endif // WATERFALLDATA_H

@ -1,66 +0,0 @@
/**
*
* \section COPYRIGHT
*
* Copyright 2013-2014 The srsLTE Developers. See the
* COPYRIGHT file at the top-level directory of this distribution.
*
* \section LICENSE
*
* This file is part of the srsLTE library.
*
* srsLTE is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version.
*
* srsLTE 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 Lesser General Public License for more details.
*
* A copy of the GNU Lesser General Public License can be found in
* the LICENSE file in the top-level directory of this distribution
* and at http://www.gnu.org/licenses/.
*
*/
#include "liblte/graphics/plot.h"
#include <stdio.h>
#include <QApplication>
#include <QMainWindow>
#include <unistd.h>
pthread_t thread;
static int plot_initiated=0;
void *qt_thread(void *arg)
{
int argc = 1;
char* argv[] = { const_cast<char *>("srsLTE Visualizer"), NULL };
QApplication app(argc, argv);
app.exec();
pthread_exit(NULL);
}
int plot_init() {
if (!plot_initiated) {
/** FIXME: Set attributes to detachable */
if (pthread_create(&thread, NULL, qt_thread, NULL)) {
perror("phtread_create");
return -1;
}
usleep(100000);
plot_initiated=1;
}
return 0;
}
void plot_exit() {
if (plot_initiated) {
pthread_cancel(thread);
}
plot_initiated=0;
}

@ -1,195 +0,0 @@
#include "ComplexWidget.h"
#include "Lineplot.h"
#include "Events.h"
#include <qlayout.h>
#include <algorithm>
using namespace std;
ComplexWidget::ComplexWidget(QWidget *parent)
:QWidget(parent)
{
i_ = new Lineplot();
q_ = new Lineplot();
m_ = new Lineplot();
p_ = new Lineplot();
i_->setAxisTitle(QwtPlot::xBottom, "In-phase");
q_->setAxisTitle(QwtPlot::xBottom, "Quadrature");
m_->setAxisTitle(QwtPlot::xBottom, "Magnitude");
p_->setAxisTitle(QwtPlot::xBottom, "Phase");
QVBoxLayout* vLayout1 = new QVBoxLayout(this);
vLayout1->addWidget(i_);
vLayout1->addWidget(q_);
vLayout1->addWidget(m_);
vLayout1->addWidget(p_);
numPoints_ = 16;
iData_ = new double[numPoints_];
qData_ = new double[numPoints_];
mData_ = new double[numPoints_];
pData_ = new double[numPoints_];
timerId_ = startTimer(10);
haveNewData_ = false;
}
ComplexWidget::~ComplexWidget()
{
delete i_;
delete q_;
delete m_;
delete p_;
}
void ComplexWidget::customEvent( QEvent * e )
{
if(e->type() == ComplexDataEvent::type)
{
ComplexDataEvent* dataEvent = (ComplexDataEvent*)e;
setData(dataEvent);
}
}
void ComplexWidget::timerEvent(QTimerEvent *event)
{
if(event->timerId() == timerId_)
{
if(haveNewData_)
{
i_->replot();
q_->replot();
m_->replot();
p_->replot();
haveNewData_ = false;
}
return;
}
QWidget::timerEvent(event);
}
void ComplexWidget::setData(ComplexDataEvent* e)
{
if(e->numPoints_ != numPoints_)
{
numPoints_ = e->numPoints_;
delete [] iData_;
delete [] qData_;
delete [] mData_;
delete [] pData_;
iData_ = new double[numPoints_];
qData_ = new double[numPoints_];
mData_ = new double[numPoints_];
pData_ = new double[numPoints_];
}
transform(e->dataPoints_, &e->dataPoints_[numPoints_], iData_, opReal());
transform(e->dataPoints_, &e->dataPoints_[numPoints_], qData_, opImag());
transform(e->dataPoints_, &e->dataPoints_[numPoints_], mData_, opAbs());
transform(e->dataPoints_, &e->dataPoints_[numPoints_], pData_, opArg());
i_->setData(iData_, numPoints_);
q_->setData(qData_, numPoints_);
m_->setData(mData_, numPoints_);
p_->setData(pData_, numPoints_);
haveNewData_ = true;
}
void ComplexWidget::setWidgetTitle(QString title)
{
setWindowTitle(title);
}
void ComplexWidget::setWidgetXAxisScale(int id, double xMin, double xMax)
{
switch(id)
{
case 0:
i_->setAxisScale(QwtPlot::xBottom, xMin, xMax);
break;
case 1:
q_->setAxisScale(QwtPlot::xBottom, xMin, xMax);
break;
case 2:
m_->setAxisScale(QwtPlot::xBottom, xMin, xMax);
break;
case 3:
p_->setAxisScale(QwtPlot::xBottom, xMin, xMax);
break;
default:
break;
}
}
void ComplexWidget::setWidgetYAxisScale(int id, double yMin, double yMax)
{
switch(id)
{
case 0:
i_->setAxisScale(QwtPlot::yLeft, yMin, yMax);
break;
case 1:
q_->setAxisScale(QwtPlot::yLeft, yMin, yMax);
break;
case 2:
m_->setAxisScale(QwtPlot::yLeft, yMin, yMax);
break;
case 3:
p_->setAxisScale(QwtPlot::yLeft, yMin, yMax);
break;
default:
break;
}
}
void ComplexWidget::setWidgetXAxisAutoScale(int id, bool on=true)
{
switch(id)
{
case 0:
i_->setAxisAutoScale(QwtPlot::xBottom, on);
break;
case 1:
q_->setAxisAutoScale(QwtPlot::xBottom, on);
break;
case 2:
m_->setAxisAutoScale(QwtPlot::xBottom, on);
break;
case 3:
p_->setAxisAutoScale(QwtPlot::xBottom, on);
break;
default:
break;
}
}
void ComplexWidget::setWidgetYAxisAutoScale(int id, bool on=true)
{
switch(id)
{
case 0:
i_->setAxisAutoScale(QwtPlot::yLeft, on);
break;
case 1:
q_->setAxisAutoScale(QwtPlot::yLeft, on);
break;
case 2:
m_->setAxisAutoScale(QwtPlot::yLeft, on);
break;
case 3:
p_->setAxisAutoScale(QwtPlot::yLeft, on);
break;
default:
break;
}
}
void ComplexWidget::setWidgetXAxisRange(double xMin, double xMax)
{
i_->setXAxisRange(xMin, xMax);
q_->setXAxisRange(xMin, xMax);
m_->setXAxisRange(xMin, xMax);
p_->setXAxisRange(xMin, xMax);
}

@ -1,53 +0,0 @@
#ifndef COMPLEXWIDGET_H
#define COMPLEXWIDGET_H
#include <qapplication.h>
#include <qwidget.h>
#include <complex>
class ComplexDataEvent;
class Lineplot;
class ComplexWidget
: public QWidget
{
Q_OBJECT
public:
ComplexWidget(QWidget* parent = 0);
virtual ~ComplexWidget();
public slots:
void customEvent( QEvent * e );
void setWidgetTitle(QString title);
void setWidgetXAxisScale(int id, double xMin, double xMax);
void setWidgetYAxisScale(int id, double yMin, double yMax);
void setWidgetXAxisAutoScale(int id, bool on);
void setWidgetYAxisAutoScale(int id, bool on);
void setWidgetXAxisRange(double xMin, double xMax);
protected:
virtual void timerEvent(QTimerEvent *event);
private:
void setData(ComplexDataEvent* e);
Lineplot* i_; //In-phase plot
Lineplot* q_; //Quadrature plot
Lineplot* m_; //Magnitude plot
Lineplot* p_; //Phase plot
struct opReal{double operator()(std::complex<double> i) const{return real(i);}};
struct opImag{double operator()(std::complex<double> i) const{return imag(i);}};
struct opAbs{double operator()(std::complex<double> i) const{return abs(i);}};
struct opArg{double operator()(std::complex<double> i) const{return arg(i);}};
double* iData_;
double* qData_;
double* mData_;
double* pData_;
int numPoints_;
int timerId_;
bool haveNewData_;
};
#endif // COMPLEXWIDGET_H

@ -1,55 +0,0 @@
#include "Complexplot.h"
#include "ComplexplotWrapper.h"
using namespace std;
Complexplot::Complexplot()
{
plot_ = new ComplexplotWrapper;
}
Complexplot::~Complexplot()
{
delete plot_;
}
void Complexplot::setNewData(complex<double>* data, int numPoints)
{
plot_->setNewData(data, numPoints);
}
void Complexplot::setNewData(complex<float>* data, int numPoints)
{
plot_->setNewData(data, numPoints);
}
void Complexplot::setTitle(std::string title)
{
plot_->setTitle(title);
}
void Complexplot::setXAxisAutoScale(PlotId id, bool on=true)
{
plot_->setXAxisAutoScale(id, on);
}
void Complexplot::setYAxisAutoScale(PlotId id, bool on=true)
{
plot_->setYAxisAutoScale(id, on);
}
void Complexplot::setXAxisScale(PlotId id, double xMin, double xMax)
{
plot_->setXAxisScale(id, xMin, xMax);
}
void Complexplot::setYAxisScale(PlotId id, double yMin, double yMax)
{
plot_->setYAxisScale(id, yMin, yMax);
}
void Complexplot::setXAxisRange(double xMin, double xMax)
{
plot_->setXAxisRange(xMin, xMax);
}

@ -1,53 +0,0 @@
#ifndef COMPLEXPLOT_H
#define COMPLEXPLOT_H
#include <string>
#include <complex>
class ComplexplotWrapper;
class Complexplot
{
public:
enum PlotId
{
I,
Q,
Magnitude,
Phase
};
Complexplot();
~Complexplot();
template<class Iterator>
void setNewData(Iterator begin, Iterator end);
void setNewData(std::complex<float>* data, int numPoints);
void setNewData(std::complex<double>* data, int numPoints);
void setTitle(std::string title);
void setXAxisAutoScale(PlotId id, bool on);
void setYAxisAutoScale(PlotId id, bool on);
void setXAxisScale(PlotId id, double xMin, double xMax);
void setYAxisScale(PlotId id, double yMin, double yMax);
void setXAxisRange(double xMin, double xMax);
private:
ComplexplotWrapper* plot_;
};
template<class Iterator>
void Complexplot::setNewData(Iterator begin, Iterator end)
{
int numPoints = end-begin;
std::complex<double>* data = new std::complex<double>[numPoints];
for(int i=0;begin!=end;begin++,i++)
{
data[i] = *begin;
}
setNewData(data, numPoints);
delete[] data;
}
#endif // COMPLEXPLOT_H

@ -1,141 +0,0 @@
#include "ComplexplotWrapper.h"
#include "ComplexWidget.h"
#include "Events.h"
#include <qapplication.h>
#include <QThread>
using namespace std;
ComplexplotWrapper::ComplexplotWrapper()
:widget_(NULL)
,destroyed_(true)
{
if(QCoreApplication::instance() == NULL)
return; //TODO: throw exception here in Iris
if(QCoreApplication::instance()->thread() == QThread::currentThread())
{
connect( this, SIGNAL( createWidgetSignal() ),
this, SLOT(createWidgetSlot()) );
connect( this, SIGNAL( destroyWidgetSignal() ),
this, SLOT(destroyWidgetSlot()) );
connect( this, SIGNAL( destroyWidgetSignalBlocking() ),
this, SLOT(destroyWidgetSlot()) );
}
else
{
connect( this, SIGNAL( createWidgetSignal() ),
this, SLOT(createWidgetSlot()),
Qt::BlockingQueuedConnection );
connect( this, SIGNAL( destroyWidgetSignal() ),
this, SLOT(destroyWidgetSlot()) );
connect( this, SIGNAL( destroyWidgetSignalBlocking() ),
this, SLOT(destroyWidgetSlot()),
Qt::BlockingQueuedConnection );
moveToThread(QCoreApplication::instance()->thread());
}
emit createWidgetSignal();
}
ComplexplotWrapper::~ComplexplotWrapper()
{
if(destroyed_)
emit destroyWidgetSignal();
else
emit destroyWidgetSignalBlocking();
}
void ComplexplotWrapper::createWidgetSlot()
{
widget_ = new ComplexWidget;
destroyed_ = false;
widget_->setAttribute(Qt::WA_DeleteOnClose, true);
connect(widget_, SIGNAL( destroyed() ),
this, SLOT( widgetDestroyed() ));
connect(this, SIGNAL(setWidgetTitle(QString)),
widget_, SLOT(setWidgetTitle(QString)));
connect(this, SIGNAL(setWidgetXAxisScale(int,double,double)),
widget_, SLOT(setWidgetXAxisScale(int,double,double)));
connect(this, SIGNAL(setWidgetYAxisScale(int,double,double)),
widget_, SLOT(setWidgetYAxisScale(int,double,double)));
connect(this, SIGNAL(setWidgetXAxisAutoScale(int,bool)),
widget_, SLOT(setWidgetXAxisAutoScale(int,bool)));
connect(this, SIGNAL(setWidgetYAxisAutoScale(int,bool)),
widget_, SLOT(setWidgetYAxisAutoScale(int,bool)));
connect(this, SIGNAL(setWidgetXAxisRange(double,double)),
widget_, SLOT(setWidgetXAxisRange(double,double)));
widget_->resize( 800, 600 );
widget_->show();
}
void ComplexplotWrapper::destroyWidgetSlot()
{
if(widget_)
delete widget_;
widget_ = NULL;
}
void ComplexplotWrapper::widgetDestroyed()
{
destroyed_ = true;
}
void ComplexplotWrapper::setNewData(complex<double>* data, int numPoints)
{
if(destroyed_)
return;
qApp->postEvent(widget_, new ComplexDataEvent(data, numPoints));
}
void ComplexplotWrapper::setNewData(complex<float>* data, int numPoints)
{
if(destroyed_)
return;
qApp->postEvent(widget_, new ComplexDataEvent(data, numPoints));
}
void ComplexplotWrapper::setTitle(std::string title)
{
if(destroyed_)
return;
QString str = QString::fromUtf8(title.c_str());
emit setWidgetTitle(str);
}
void ComplexplotWrapper::setXAxisAutoScale(int id, bool on=true)
{
if(destroyed_)
return;
emit setWidgetXAxisAutoScale(id, on);
}
void ComplexplotWrapper::setYAxisAutoScale(int id, bool on=true)
{
if(destroyed_)
return;
emit setWidgetYAxisAutoScale(id, on);
}
void ComplexplotWrapper::setXAxisScale(int id, double xMin, double xMax)
{
if(destroyed_)
return;
emit setWidgetXAxisScale(id, xMin, xMax);
}
void ComplexplotWrapper::setYAxisScale(int id, double yMin, double yMax)
{
if(destroyed_)
return;
emit setWidgetYAxisScale(id, yMin, yMax);
}
void ComplexplotWrapper::setXAxisRange(double xMin, double xMax)
{
if(destroyed_)
return;
emit setWidgetXAxisRange(xMin, xMax);
}

@ -1,48 +0,0 @@
#ifndef COMPLEXPLOTWRAPPER_H
#define COMPLEXPLOTWRAPPER_H
#include <qapplication.h>
#include <complex>
class ComplexWidget;
class ComplexplotWrapper
: QObject
{
Q_OBJECT
public:
ComplexplotWrapper();
~ComplexplotWrapper();
void setNewData(std::complex<float>* data, int numPoints);
void setNewData(std::complex<double>* data, int numPoints);
void setTitle(std::string title);
void setXAxisAutoScale(int id, bool on);
void setYAxisAutoScale(int id, bool on);
void setXAxisScale(int id, double xMin, double xMax);
void setYAxisScale(int id, double yMin, double yMax);
void setXAxisRange(double xMin, double xMax);
public slots:
void createWidgetSlot();
void destroyWidgetSlot();
void widgetDestroyed();
signals:
void createWidgetSignal();
void destroyWidgetSignal();
void destroyWidgetSignalBlocking();
void setWidgetTitle(QString title);
void setWidgetXAxisAutoScale(int id, bool on);
void setWidgetYAxisAutoScale(int id, bool on);
void setWidgetXAxisScale(int id, double xMin, double xMax);
void setWidgetYAxisScale(int id, double yMin, double yMax);
void setWidgetXAxisRange(double xMin, double xMax);
private:
ComplexWidget* widget_;
bool destroyed_;
};
#endif // COMPLEXPLOTWRAPPER_H

@ -1,76 +0,0 @@
/**
*
* \section COPYRIGHT
*
* Copyright 2013-2014 The srsLTE Developers. See the
* COPYRIGHT file at the top-level directory of this distribution.
*
* \section LICENSE
*
* This file is part of the srsLTE library.
*
* srsLTE is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version.
*
* srsLTE 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 Lesser General Public License for more details.
*
* A copy of the GNU Lesser General Public License can be found in
* the LICENSE file in the top-level directory of this distribution
* and at http://www.gnu.org/licenses/.
*
*/
#include "liblte/graphics/plot/plot_complex.h"
#include "Complexplot.h"
#include <complex>
int plot_complex_init(plot_complex_t *h) {
*h = (void*) new Complexplot();
return (*h != NULL)?0:-1;
}
void plot_complex_setTitle(plot_complex_t *h, char *title) {
Complexplot *plot = static_cast<Complexplot*>(*h);
plot->setTitle(title);
}
void plot_complex_setNewData(plot_complex_t *h, _Complex float *data,
int num_points) {
Complexplot *plot = static_cast<Complexplot*>(*h);
plot->setNewData(reinterpret_cast<std::complex<float>*> (data), num_points);
}
void plot_complex_setXAxisAutoScale(plot_complex_t *h, plot_complex_id_t id, bool on) {
Complexplot *plot = static_cast<Complexplot*>(*h);
plot->setXAxisAutoScale(static_cast<Complexplot::PlotId> (id), on);
}
void plot_complex_setYAxisAutoScale(plot_complex_t *h, plot_complex_id_t id, bool on) {
Complexplot *plot = static_cast<Complexplot*>(*h);
plot->setYAxisAutoScale(static_cast<Complexplot::PlotId> (id), on);
}
void plot_complex_setXAxisScale(plot_complex_t *h, plot_complex_id_t id, double xMin, double xMax) {
Complexplot *plot = static_cast<Complexplot*>(*h);
plot->setXAxisScale(static_cast<Complexplot::PlotId> (id), xMin, xMax);
}
void plot_complex_setYAxisScale(plot_complex_t *h, plot_complex_id_t id, double yMin, double yMax) {
Complexplot *plot = static_cast<Complexplot*>(*h);
plot->setYAxisScale(static_cast<Complexplot::PlotId> (id), yMin, yMax);
}
void plot_complex_setXAxisRange(plot_complex_t *h, double xMin, double xMax) {
Complexplot *plot = static_cast<Complexplot*>(*h);
plot->setXAxisRange(xMin, xMax);
}

@ -1,31 +0,0 @@
#
# Copyright 2012-2013 The Iris Project Developers. See the
# COPYRIGHT file at the top-level directory of this distribution
# and at http://www.softwareradiosystems.com/iris/copyright.html.
#
# This file is part of the Iris Project.
#
# Iris is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation, either version 3 of
# the License, or (at your option) any later version.
#
# Iris 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 Lesser General Public License for more details.
#
# A copy of the GNU Lesser General Public License can be found in
# the LICENSE file in the top-level directory of this distribution
# and at http://www.gnu.org/licenses/.
#
########################################################################
# Build tests
########################################################################
#turn the test cpp file into an executable with an int main() function
INCLUDE_DIRECTORIES(..)
ADD_EXECUTABLE(complexplot_test complexplot_test.cpp)
TARGET_LINK_LIBRARIES(complexplot_test pthread graphics)
ADD_TEST(complexplot_test complexplot_test)

@ -1,144 +0,0 @@
/**
* \file lib/generic/modulation/Crc_test.cpp
* \version 1.0
*
* \section COPYRIGHT
*
* Copyright 2012-2013 The Iris Project Developers. See the
* COPYRIGHT file at the top-level directory of this distribution
* and at http://www.softwareradiosystems.com/iris/copyright.html.
*
* \section LICENSE
*
* This file is part of the Iris Project.
*
* Iris is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version.
*
* Iris 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 Lesser General Public License for more details.
*
* A copy of the GNU Lesser General Public License can be found in
* the LICENSE file in the top-level directory of this distribution
* and at http://www.gnu.org/licenses/.
*
* \section DESCRIPTION
*
* Main test file for Complexplot class.
*/
#include "Complexplot.h"
#include <pthread.h>
#include <unistd.h>
#include <stdio.h>
#include <qapplication.h>
#include <cstdlib>
#include <complex>
#include <vector>
#define PI 3.14159265358979323846
using namespace std;
typedef vector<complex<float> > FloatVec;
void *threadMain1(void *arg) {
Complexplot plot;
plot.setTitle("Float");
plot.setXAxisRange(0, 2);
plot.setYAxisScale(Complexplot::Magnitude, 0.9, 1.1);
int n = 1024;
float step = 2.0 * PI / n;
complex<float>* data = new complex<float> [n];
for (int i = 0; i < n; i++)
data[i] = polar(1.0f, step * i);
plot.setNewData(data, n);
for (int i = 0; i < n; i++) {
rotate(data, data + 1, data + n);
plot.setNewData(data, n);
usleep(1000);
}
return NULL;
}
void *threadMain2(void *arg) {
Complexplot plot;
plot.setTitle("Double");
plot.setXAxisRange(0, 2);
plot.setYAxisScale(Complexplot::Magnitude, 0.9, 1.1);
int n = 1024;
double step = 2.0 * PI / n;
complex<double>* data = new complex<double> [n];
for (int i = 0; i < n; i++)
data[i] = polar(1.0, step * i);
plot.setNewData(data, n);
for (int i = 0; i < n; i++) {
rotate(data, data + 1, data + n);
plot.setNewData(data, n);
usleep(1000);
}
return NULL;
}
void *threadMain3(void *arg) {
Complexplot plot;
plot.setTitle("FloatVec");
plot.setXAxisRange(0, 2);
plot.setYAxisScale(Complexplot::Magnitude, 0.9, 1.1);
FloatVec data(1024);
int n = data.size();
float step = 2.0 * PI / n;
for (int i = 0; i < n; i++)
data[i] = polar(1.0f, step * i);
plot.setNewData(data.begin(), data.end());
for (int i = 0; i < n; i++) {
rotate(data.begin(), data.begin() + 1, data.end());
plot.setNewData(data.begin(), data.end());
usleep(1000);
}
return NULL;
}
int main(int argc, char *argv[]) {
int argc2 = 1;
char* argv2[] = { const_cast<char *>("Compleplot_Basic_Test"), NULL };
QApplication a(argc2, argv2);
pthread_t threads[3];
int i;
if (pthread_create(&threads[0], NULL, threadMain1, NULL)) {
perror("pthread_create");
exit(-1);
}
if (pthread_create(&threads[1], NULL, threadMain2, NULL)) {
perror("pthread_create");
exit(-1);
}
if (pthread_create(&threads[2], NULL, threadMain3, NULL)) {
perror("pthread_create");
exit(-1);
}
qApp->exec();
for (i=0;i<3;i++) {
pthread_join(threads[i], NULL);
}
exit(0);
}

@ -1,100 +0,0 @@
#include "RealWidget.h"
#include "Lineplot.h"
#include "Events.h"
#include <qlayout.h>
#include <algorithm>
using namespace std;
RealWidget::RealWidget(QWidget *parent)
:QWidget(parent)
{
l_ = new Lineplot();
QVBoxLayout* vLayout1 = new QVBoxLayout(this);
vLayout1->addWidget(l_);
numPoints_ = 16;
dataPoints_ = new double[numPoints_];
timerId_ = startTimer(10);
haveNewData_ = false;
}
RealWidget::~RealWidget()
{
delete l_;
}
void RealWidget::customEvent( QEvent * e )
{
if(e->type() == RealDataEvent::type)
{
RealDataEvent* dataEvent = (RealDataEvent*)e;
setData(dataEvent);
}
}
void RealWidget::timerEvent(QTimerEvent *event)
{
if(event->timerId() == timerId_)
{
if(haveNewData_)
{
l_->replot();
haveNewData_ = false;
}
return;
}
QWidget::timerEvent(event);
}
void RealWidget::setData(RealDataEvent* e)
{
if(e->numPoints_ != numPoints_)
{
numPoints_ = e->numPoints_;
delete [] dataPoints_;
dataPoints_ = new double[numPoints_];
}
for(int i=0;i<numPoints_;i++)
dataPoints_[i] = e->dataPoints_[i];
l_->setData(dataPoints_, numPoints_);
haveNewData_ = true;
}
void RealWidget::setWidgetTitle(QString title)
{
l_->setTitle(title);
}
void RealWidget::setWidgetAxisLabels(QString xLabel, QString yLabel)
{
l_->setAxisTitle(QwtPlot::xBottom, xLabel);
l_->setAxisTitle(QwtPlot::yLeft, yLabel);
}
void RealWidget::setWidgetXAxisScale(double xMin, double xMax)
{
l_->setAxisScale(QwtPlot::xBottom, xMin, xMax);
}
void RealWidget::setWidgetYAxisScale(double yMin, double yMax)
{
l_->setAxisScale(QwtPlot::yLeft, yMin, yMax);
}
void RealWidget::setWidgetXAxisAutoScale(bool on=true)
{
l_->setAxisAutoScale(QwtPlot::xBottom, on);
}
void RealWidget::setWidgetYAxisAutoScale(bool on=true)
{
l_->setAxisAutoScale(QwtPlot::yLeft, on);
}
void RealWidget::setWidgetXAxisRange(double xMin, double xMax)
{
l_->setXAxisRange(xMin, xMax);
}

@ -1,43 +0,0 @@
#ifndef REALWIDGET_H
#define REALWIDGET_H
#include <qapplication.h>
#include <qwidget.h>
#include <complex>
class RealDataEvent;
class Lineplot;
class RealWidget
: public QWidget
{
Q_OBJECT
public:
RealWidget(QWidget* parent = 0);
virtual ~RealWidget();
public slots:
void customEvent( QEvent * e );
void setWidgetTitle(QString title);
void setWidgetAxisLabels(QString xLabel, QString yLabel);
void setWidgetXAxisScale(double xMin, double xMax);
void setWidgetYAxisScale(double yMin, double yMax);
void setWidgetXAxisAutoScale(bool on);
void setWidgetYAxisAutoScale(bool on);
void setWidgetXAxisRange(double xMin, double xMax);
protected:
virtual void timerEvent(QTimerEvent *event);
private:
void setData(RealDataEvent* e);
Lineplot* l_; //The line plot
double* dataPoints_;
int numPoints_;
int timerId_;
bool haveNewData_;
};
#endif // REALWIDGET_H

@ -1,58 +0,0 @@
#include "Realplot.h"
#include "RealplotWrapper.h"
Realplot::Realplot()
{
plot_ = new RealplotWrapper;
}
Realplot::~Realplot()
{
delete plot_;
}
void Realplot::setNewData(double* data, int numPoints)
{
plot_->setNewData(data, numPoints);
}
void Realplot::setNewData(float* data, int numPoints)
{
plot_->setNewData(data, numPoints);
}
void Realplot::setTitle(std::string title)
{
plot_->setTitle(title);
}
void Realplot::setXAxisScale(double xMin, double xMax)
{
plot_->setXAxisScale(xMin, xMax);
}
void Realplot::setYAxisScale(double yMin, double yMax)
{
plot_->setYAxisScale(yMin, yMax);
}
void Realplot::setXAxisAutoScale(bool on=true)
{
plot_->setXAxisAutoScale(on);
}
void Realplot::setYAxisAutoScale(bool on=true)
{
plot_->setYAxisAutoScale(on);
}
void Realplot::setXAxisRange(double xMin, double xMax)
{
plot_->setXAxisRange(xMin, xMax);
}
void Realplot::setLabels(std::string xLabel, std::string yLabel)
{
plot_->setAxisLabels(xLabel, yLabel);
}

@ -1,46 +0,0 @@
#ifndef REALPLOT_H
#define REALPLOT_H
#include <string>
class RealplotWrapper;
class Realplot
{
public:
Realplot();
~Realplot();
template<class Iterator>
void setNewData(Iterator begin, Iterator end);
void setNewData(float* data, int numPoints);
void setNewData(double* data, int numPoints);
void setTitle(std::string title);
void setXAxisScale(double xMin, double xMax);
void setYAxisScale(double yMin, double yMax);
void setXAxisAutoScale(bool on);
void setYAxisAutoScale(bool on);
void setXAxisRange(double xMin, double xMax);
void setLabels(std::string xLabel, std::string yLabel);
private:
RealplotWrapper* plot_;
};
template<class Iterator>
void Realplot::setNewData(Iterator begin, Iterator end)
{
int numPoints = end-begin;
double* data = new double[numPoints];
for(int i=0;begin!=end;begin++,i++)
{
data[i] = *begin;
}
setNewData(data, numPoints);
delete[] data;
}
#endif // REALPLOT_H

@ -1,147 +0,0 @@
#include "RealplotWrapper.h"
#include "RealWidget.h"
#include "Events.h"
#include <qapplication.h>
#include <QThread>
RealplotWrapper::RealplotWrapper()
:widget_(NULL)
,destroyed_(true)
{
if(QCoreApplication::instance() == NULL)
return; //TODO: throw exception here in Iris
if(QCoreApplication::instance()->thread() == QThread::currentThread())
{
connect( this, SIGNAL( createWidgetSignal() ),
this, SLOT(createWidgetSlot()) );
connect( this, SIGNAL( destroyWidgetSignal() ),
this, SLOT(destroyWidgetSlot()) );
connect( this, SIGNAL( destroyWidgetSignalBlocking() ),
this, SLOT(destroyWidgetSlot()) );
}
else
{
connect( this, SIGNAL( createWidgetSignal() ),
this, SLOT(createWidgetSlot()),
Qt::BlockingQueuedConnection );
connect( this, SIGNAL( destroyWidgetSignal() ),
this, SLOT(destroyWidgetSlot()) );
connect( this, SIGNAL( destroyWidgetSignalBlocking() ),
this, SLOT(destroyWidgetSlot()),
Qt::BlockingQueuedConnection );
moveToThread(QCoreApplication::instance()->thread());
}
emit createWidgetSignal();
}
RealplotWrapper::~RealplotWrapper()
{
if(destroyed_)
emit destroyWidgetSignal();
else
emit destroyWidgetSignalBlocking();
}
void RealplotWrapper::createWidgetSlot()
{
widget_ = new RealWidget;
destroyed_ = false;
widget_->setAttribute(Qt::WA_DeleteOnClose, true);
connect(widget_, SIGNAL( destroyed() ),
this, SLOT( widgetDestroyed() ));
connect(this, SIGNAL(setWidgetTitle(QString)),
widget_, SLOT(setWidgetTitle(QString)));
connect(this, SIGNAL(setWidgetAxisLabels(QString, QString)),
widget_, SLOT(setWidgetAxisLabels(QString, QString)));
connect(this, SIGNAL(setWidgetXAxisScale(double,double)),
widget_, SLOT(setWidgetXAxisScale(double,double)));
connect(this, SIGNAL(setWidgetYAxisScale(double,double)),
widget_, SLOT(setWidgetYAxisScale(double,double)));
connect(this, SIGNAL(setWidgetXAxisAutoScale(bool)),
widget_, SLOT(setWidgetXAxisAutoScale(bool)));
connect(this, SIGNAL(setWidgetYAxisAutoScale(bool)),
widget_, SLOT(setWidgetYAxisAutoScale(bool)));
connect(this, SIGNAL(setWidgetXAxisRange(double,double)),
widget_, SLOT(setWidgetXAxisRange(double,double)));
widget_->resize( 800, 600 );
widget_->show();
}
void RealplotWrapper::destroyWidgetSlot()
{
delete widget_;
}
void RealplotWrapper::widgetDestroyed()
{
destroyed_ = true;
}
void RealplotWrapper::setNewData(double* data, int numPoints)
{
if(destroyed_)
return;
qApp->postEvent(widget_, new RealDataEvent(data, numPoints));
}
void RealplotWrapper::setNewData(float* data, int numPoints)
{
if(destroyed_)
return;
qApp->postEvent(widget_, new RealDataEvent(data, numPoints));
}
void RealplotWrapper::setTitle(std::string title)
{
if(destroyed_)
return;
QString str = QString::fromUtf8(title.c_str());
emit setWidgetTitle(str);
}
void RealplotWrapper::setAxisLabels(std::string xLabel, std::string yLabel)
{
if(destroyed_)
return;
QString xStr = QString::fromUtf8(xLabel.c_str());
QString yStr = QString::fromUtf8(yLabel.c_str());
emit setWidgetAxisLabels(xStr, yStr);
}
void RealplotWrapper::setXAxisScale(double xMin, double xMax)
{
if(destroyed_)
return;
emit setWidgetXAxisScale(xMin, xMax);
}
void RealplotWrapper::setYAxisScale(double yMin, double yMax)
{
if(destroyed_)
return;
emit setWidgetYAxisScale(yMin, yMax);
}
void RealplotWrapper::setXAxisAutoScale(bool on=true)
{
if(destroyed_)
return;
emit setWidgetXAxisAutoScale(on);
}
void RealplotWrapper::setYAxisAutoScale(bool on=true)
{
if(destroyed_)
return;
emit setWidgetYAxisAutoScale(on);
}
void RealplotWrapper::setXAxisRange(double xMin, double xMax)
{
if(destroyed_)
return;
emit setWidgetXAxisRange(xMin, xMax);
}

@ -1,49 +0,0 @@
#ifndef REALPLOTWRAPPER_H
#define REALPLOTWRAPPER_H
#include <qapplication.h>
class RealWidget;
class RealplotWrapper
: QObject
{
Q_OBJECT
public:
RealplotWrapper();
~RealplotWrapper();
void setNewData(float* data, int numPoints);
void setNewData(double* data, int numPoints);
void setTitle(std::string title);
void setAxisLabels(std::string xLabel, std::string yLabel);
void setXAxisScale(double xMin, double xMax);
void setYAxisScale(double yMin, double yMax);
void setXAxisAutoScale(bool on);
void setYAxisAutoScale(bool on);
void setXAxisRange(double xMin, double xMax);
public slots:
void createWidgetSlot();
void destroyWidgetSlot();
void widgetDestroyed();
signals:
void createWidgetSignal();
void destroyWidgetSignal();
void destroyWidgetSignalBlocking();
void setWidgetTitle(QString title);
void setWidgetAxisLabels(QString xLabel, QString yLabel);
void setWidgetXAxisScale(double xMin, double xMax);
void setWidgetYAxisScale(double yMin, double yMax);
void setWidgetXAxisAutoScale(bool on);
void setWidgetYAxisAutoScale(bool on);
void setWidgetXAxisRange(double xMin, double xMax);
private:
RealWidget* widget_;
bool destroyed_;
};
#endif // REALPLOTWRAPPER_H

@ -1,79 +0,0 @@
/**
*
* \section COPYRIGHT
*
* Copyright 2013-2014 The srsLTE Developers. See the
* COPYRIGHT file at the top-level directory of this distribution.
*
* \section LICENSE
*
* This file is part of the srsLTE library.
*
* srsLTE is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version.
*
* srsLTE 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 Lesser General Public License for more details.
*
* A copy of the GNU Lesser General Public License can be found in
* the LICENSE file in the top-level directory of this distribution
* and at http://www.gnu.org/licenses/.
*
*/
#include "liblte/graphics/plot/plot_real.h"
#include "Realplot.h"
#include <complex.h>
int plot_real_init(plot_real_t *h) {
*h = (void*) new Realplot();
return (*h != NULL)?0:-1;
}
void plot_real_setTitle(plot_real_t *h, char *title) {
Realplot *plot = static_cast<Realplot*>(*h);
plot->setTitle(title);
}
void plot_real_setNewData(plot_real_t *h, float *data,
int num_points) {
Realplot *plot = static_cast<Realplot*>(*h);
plot->setNewData(data, num_points);
}
void plot_real_setXAxisAutoScale(plot_real_t *h, bool on) {
Realplot *plot = static_cast<Realplot*>(*h);
plot->setXAxisAutoScale(on);
}
void plot_real_setYAxisAutoScale(plot_real_t *h, bool on) {
Realplot *plot = static_cast<Realplot*>(*h);
plot->setYAxisAutoScale(on);
}
void plot_real_setXAxisScale(plot_real_t *h, double xMin, double xMax) {
Realplot *plot = static_cast<Realplot*>(*h);
plot->setXAxisScale(xMin, xMax);
}
void plot_real_setYAxisScale(plot_real_t *h, double yMin, double yMax) {
Realplot *plot = static_cast<Realplot*>(*h);
plot->setYAxisScale(yMin, yMax);
}
void plot_real_setXAxisRange(plot_real_t *h, double xMin, double xMax) {
Realplot *plot = static_cast<Realplot*>(*h);
plot->setXAxisRange(xMin, xMax);
}
void plot_real_setLabels(plot_real_t *h, char *xLabel, char *yLabel) {
Realplot *plot = static_cast<Realplot*>(*h);
plot->setLabels(xLabel, yLabel);
}

@ -1,31 +0,0 @@
#
# Copyright 2012-2013 The Iris Project Developers. See the
# COPYRIGHT file at the top-level directory of this distribution
# and at http://www.softwareradiosystems.com/iris/copyright.html.
#
# This file is part of the Iris Project.
#
# Iris is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation, either version 3 of
# the License, or (at your option) any later version.
#
# Iris 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 Lesser General Public License for more details.
#
# A copy of the GNU Lesser General Public License can be found in
# the LICENSE file in the top-level directory of this distribution
# and at http://www.gnu.org/licenses/.
#
########################################################################
# Build tests
########################################################################
#turn the test cpp file into an executable with an int main() function
INCLUDE_DIRECTORIES(..)
ADD_EXECUTABLE(realplot_test realplot_test.cpp)
TARGET_LINK_LIBRARIES(realplot_test pthread graphics)
ADD_TEST(realplot_test realplot_test)

@ -1,123 +0,0 @@
/**
* \file lib/generic/modulation/Crc_test.cpp
* \version 1.0
*
* \section COPYRIGHT
*
* Copyright 2012-2013 The Iris Project Developers. See the
* COPYRIGHT file at the top-level directory of this distribution
* and at http://www.softwareradiosystems.com/iris/copyright.html.
*
* \section LICENSE
*
* This file is part of the Iris Project.
*
* Iris is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version.
*
* Iris 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 Lesser General Public License for more details.
*
* A copy of the GNU Lesser General Public License can be found in
* the LICENSE file in the top-level directory of this distribution
* and at http://www.gnu.org/licenses/.
*
* \section DESCRIPTION
*
* Main test file for Realplot class.
*/
#include "Realplot.h"
#include <pthread.h>
#include <unistd.h>
#include <stdio.h>
#include <qapplication.h>
#include <cstdlib>
#include <complex>
#include <vector>
typedef std::vector<float> FloatVec;
template<class T>
void getPoints(T* data, int numPoints) {
for (int i = 0; i < numPoints; i++) {
data[i] = 10 * ((T) rand() / RAND_MAX);
}
}
template<class Iterator>
void getPoints(Iterator begin, Iterator end) {
for (; begin != end; begin++) {
*begin = 10 * ((double) rand() / RAND_MAX);
}
}
void *threadMain1(void *arg) {
Realplot plot;
float data[1024];
for (int i = 0; i < 100; i++) {
getPoints(data, 504);
plot.setNewData(data, 504);
usleep(5000);
}
return NULL;
}
void *threadMain2(void *arg) {
Realplot plot;
double data[1024];
for (int i = 0; i < 100; i++) {
getPoints(data, 504);
plot.setNewData(data, 504);
usleep(5000);
}
return NULL;
}
void *threadMain3(void *arg) {
Realplot plot;
FloatVec v(1024);
for (int i = 0; i < 100; i++) {
getPoints(v.begin(), v.end());
plot.setNewData(v.begin(), v.end());
usleep(5000);
}
return NULL;
}
int main(int argc, char *argv[]) {
int argc2 = 1;
char* argv2[] = { const_cast<char *>("Realplot_Basic_Test"), NULL };
QApplication a(argc2, argv2);
pthread_t threads[3];
int i;
if (pthread_create(&threads[0], NULL, threadMain1, NULL)) {
perror("pthread_create");
exit(-1);
}
if (pthread_create(&threads[1], NULL, threadMain2, NULL)) {
perror("pthread_create");
exit(-1);
}
if (pthread_create(&threads[2], NULL, threadMain3, NULL)) {
perror("pthread_create");
exit(-1);
}
qApp->exec();
for (i=0;i<3;i++) {
pthread_join(threads[i], NULL);
}
exit(0);
}

@ -1,100 +0,0 @@
#include "ScatterWidget.h"
#include "Pointplot.h"
#include "Events.h"
#include <qlayout.h>
#include <algorithm>
using namespace std;
ScatterWidget::ScatterWidget(QWidget *parent)
:QWidget(parent)
{
plot_ = new Pointplot();
QVBoxLayout* vLayout1 = new QVBoxLayout(this);
vLayout1->addWidget(plot_);
numPoints_ = 16;
iData_ = new double[numPoints_];
qData_ = new double[numPoints_];
timerId_ = startTimer(10);
haveNewData_ = false;
}
ScatterWidget::~ScatterWidget()
{
delete iData_;
delete qData_;
}
void ScatterWidget::customEvent( QEvent * e )
{
if(e->type() == ComplexDataEvent::type)
{
ComplexDataEvent* dataEvent = (ComplexDataEvent*)e;
setData(dataEvent);
}
}
void ScatterWidget::timerEvent(QTimerEvent *event)
{
if(event->timerId() == timerId_)
{
if(haveNewData_)
{
plot_->replot();
haveNewData_ = false;
}
return;
}
QWidget::timerEvent(event);
}
void ScatterWidget::setData(ComplexDataEvent* e)
{
if(e->numPoints_ != numPoints_)
{
numPoints_ = e->numPoints_;
delete [] iData_;
delete [] qData_;
iData_ = new double[numPoints_];
qData_ = new double[numPoints_];
}
transform(e->dataPoints_, &e->dataPoints_[numPoints_], iData_, opReal());
transform(e->dataPoints_, &e->dataPoints_[numPoints_], qData_, opImag());
plot_->setData(iData_, qData_, numPoints_);
haveNewData_ = true;
}
void ScatterWidget::setWidgetTitle(QString title)
{
plot_->setTitle(title);
}
void ScatterWidget::setWidgetAxisLabels(QString xLabel, QString yLabel)
{
plot_->setAxisTitle(QwtPlot::xBottom, xLabel);
plot_->setAxisTitle(QwtPlot::yLeft, yLabel);
}
void ScatterWidget::setWidgetXAxisScale(double xMin, double xMax)
{
plot_->setAxisScale(QwtPlot::xBottom, xMin, xMax);
}
void ScatterWidget::setWidgetYAxisScale(double yMin, double yMax)
{
plot_->setAxisScale(QwtPlot::yLeft, yMin, yMax);
}
void ScatterWidget::setWidgetXAxisAutoScale(bool on=true)
{
plot_->setAxisAutoScale(QwtPlot::xBottom, on);
}
void ScatterWidget::setWidgetYAxisAutoScale(bool on)
{
plot_->setAxisAutoScale(QwtPlot::yLeft, on);
}

@ -1,46 +0,0 @@
#ifndef SCATTERWIDGET_H
#define SCATTERWIDGET_H
#include <qapplication.h>
#include <qwidget.h>
#include <complex>
class ComplexDataEvent;
class Pointplot;
class ScatterWidget
: public QWidget
{
Q_OBJECT
public:
ScatterWidget(QWidget* parent = 0);
virtual ~ScatterWidget();
public slots:
void customEvent( QEvent * e );
void setWidgetTitle(QString title);
void setWidgetAxisLabels(QString xLabel, QString yLabel);
void setWidgetXAxisScale(double xMin, double xMax);
void setWidgetYAxisScale(double yMin, double yMax);
void setWidgetXAxisAutoScale(bool on);
void setWidgetYAxisAutoScale(bool on);
protected:
virtual void timerEvent(QTimerEvent *event);
private:
void setData(ComplexDataEvent* e);
Pointplot* plot_;
struct opReal{double operator()(std::complex<double> i) const{return real(i);}};
struct opImag{double operator()(std::complex<double> i) const{return imag(i);}};
double* iData_;
double* qData_;
int numPoints_;
int timerId_;
bool haveNewData_;
};
#endif // SCATTERWIDGET_H

@ -1,53 +0,0 @@
#include "Scatterplot.h"
#include "ScatterplotWrapper.h"
Scatterplot::Scatterplot()
{
plot_ = new ScatterplotWrapper;
}
Scatterplot::~Scatterplot()
{
delete plot_;
}
void Scatterplot::setNewData(std::complex<float>* data, int numPoints)
{
plot_->setNewData(data, numPoints);
}
void Scatterplot::setNewData(std::complex<double>* data, int numPoints)
{
plot_->setNewData(data, numPoints);
}
void Scatterplot::setTitle(std::string title)
{
plot_->setTitle(title);
}
void Scatterplot::setXAxisScale(double xMin, double xMax)
{
plot_->setXAxisScale(xMin, xMax);
}
void Scatterplot::setYAxisScale(double yMin, double yMax)
{
plot_->setYAxisScale(yMin, yMax);
}
void Scatterplot::setXAxisAutoScale(bool on=true)
{
plot_->setXAxisAutoScale(on);
}
void Scatterplot::setYAxisAutoScale(bool on=true)
{
plot_->setYAxisAutoScale(on);
}
void Scatterplot::setAxisLabels(std::string xLabel, std::string yLabel)
{
plot_->setAxisLabels(xLabel, yLabel);
}

@ -1,46 +0,0 @@
#ifndef SCATTERPLOT_H
#define SCATTERPLOT_H
#include <string>
#include <complex>
#include "srslte/config.h"
class ScatterplotWrapper;
class Scatterplot
{
public:
Scatterplot();
~Scatterplot();
template<class Iterator>
void setNewData(Iterator begin, Iterator end);
void setNewData(std::complex<float>* data, int numPoints);
void setNewData(std::complex<double>* data, int numPoints);
void setTitle(std::string title);
void setXAxisScale(double xMin, double xMax);
void setYAxisScale(double yMin, double yMax);
void setXAxisAutoScale(bool on);
void setYAxisAutoScale(bool on);
void setAxisLabels(std::string xLabel, std::string yLabel);
private:
ScatterplotWrapper* plot_;
};
template<class Iterator> void Scatterplot::setNewData(Iterator begin, Iterator end)
{
int numPoints = end-begin;
std::complex<double>* data = new std::complex<double>[numPoints];
for(int i=0;begin!=end;begin++,i++)
{
data[i] = *begin;
}
setNewData(data, numPoints);
delete[] data;
}
#endif // SCATTERPLOT_H

@ -1,142 +0,0 @@
#include "ScatterplotWrapper.h"
#include "ScatterWidget.h"
#include "Events.h"
#include <qapplication.h>
#include <QThread>
#include <complex>
using namespace std;
ScatterplotWrapper::ScatterplotWrapper()
:widget_(NULL)
,destroyed_(true)
{
if(QCoreApplication::instance() == NULL)
return; //TODO: throw exception here in Iris
if(QCoreApplication::instance()->thread() == QThread::currentThread())
{
connect( this, SIGNAL(createWidgetSignal()),
this, SLOT(createWidgetSlot()) );
connect( this, SIGNAL(destroyWidgetSignal()),
this, SLOT(destroyWidgetSlot()) );
connect( this, SIGNAL( destroyWidgetSignalBlocking() ),
this, SLOT(destroyWidgetSlot()) );
}
else
{
connect( this, SIGNAL(createWidgetSignal()),
this, SLOT(createWidgetSlot()),
Qt::BlockingQueuedConnection );
connect( this, SIGNAL(destroyWidgetSignal()),
this, SLOT(destroyWidgetSlot()) );
connect( this, SIGNAL( destroyWidgetSignalBlocking() ),
this, SLOT(destroyWidgetSlot()),
Qt::BlockingQueuedConnection );
moveToThread(QCoreApplication::instance()->thread());
}
emit createWidgetSignal();
}
ScatterplotWrapper::~ScatterplotWrapper()
{
if(destroyed_)
emit destroyWidgetSignal();
else
emit destroyWidgetSignalBlocking();
}
void ScatterplotWrapper::createWidgetSlot()
{
widget_ = new ScatterWidget;
destroyed_ = false;
widget_->setAttribute(Qt::WA_DeleteOnClose, true);
connect(widget_, SIGNAL( destroyed() ),
this, SLOT( widgetDestroyed() ));
connect(this, SIGNAL(setWidgetXAxisScale(double,double)),
widget_, SLOT(setWidgetXAxisScale(double,double)));
connect(this, SIGNAL(setWidgetYAxisScale(double,double)),
widget_, SLOT(setWidgetYAxisScale(double,double)));
connect(this, SIGNAL(setWidgetXAxisAutoScale(bool)),
widget_, SLOT(setWidgetXAxisAutoScale(bool)));
connect(this, SIGNAL(setWidgetYAxisAutoScale(bool)),
widget_, SLOT(setWidgetYAxisAutoScale(bool)));
connect(this, SIGNAL(setWidgetTitle(QString)),
widget_, SLOT(setWidgetTitle(QString)));
connect(this, SIGNAL(setWidgetAxisLabels(QString, QString)),
widget_, SLOT(setWidgetAxisLabels(QString, QString)));
widget_->resize( 800, 600 );
widget_->show();
}
void ScatterplotWrapper::destroyWidgetSlot()
{
delete widget_;
}
void ScatterplotWrapper::widgetDestroyed()
{
destroyed_ = true;
}
void ScatterplotWrapper::setNewData(complex<double>* data, int numPoints)
{
if(destroyed_)
return;
qApp->postEvent(widget_, new ComplexDataEvent(data, numPoints));
}
void ScatterplotWrapper::setNewData(complex<float>* data, int numPoints)
{
if(destroyed_)
return;
qApp->postEvent(widget_, new ComplexDataEvent(data, numPoints));
}
void ScatterplotWrapper::setTitle(std::string title)
{
if(destroyed_)
return;
QString str = QString::fromUtf8(title.c_str());
emit setWidgetTitle(str);
}
void ScatterplotWrapper::setXAxisScale(double xMin, double xMax)
{
if(destroyed_)
return;
emit setWidgetXAxisScale(xMin, xMax);
}
void ScatterplotWrapper::setYAxisScale(double yMin, double yMax)
{
if(destroyed_)
return;
emit setWidgetYAxisScale(yMin, yMax);
}
void ScatterplotWrapper::setXAxisAutoScale(bool on=true)
{
if(destroyed_)
return;
emit setWidgetXAxisAutoScale(on);
}
void ScatterplotWrapper::setYAxisAutoScale(bool on=true)
{
if(destroyed_)
return;
emit setWidgetYAxisAutoScale(on);
}
void ScatterplotWrapper::setAxisLabels(std::string xLabel, std::string yLabel)
{
if(destroyed_)
return;
QString xStr = QString::fromUtf8(xLabel.c_str());
QString yStr = QString::fromUtf8(yLabel.c_str());
emit setWidgetAxisLabels(xStr, yStr);
}

@ -1,48 +0,0 @@
#ifndef SCATTERPLOTWRAPPER_H
#define SCATTERPLOTWRAPPER_H
#include <qapplication.h>
#include <complex>
class ScatterWidget;
class ScatterplotWrapper
: QObject
{
Q_OBJECT
public:
ScatterplotWrapper();
~ScatterplotWrapper();
void setNewData(std::complex<float>* data, int numPoints);
void setNewData(std::complex<double>* data, int numPoints);
void setTitle(std::string title);
void setXAxisScale(double xMin, double xMax);
void setYAxisScale(double yMin, double yMax);
void setXAxisAutoScale(bool on);
void setYAxisAutoScale(bool on);
void setAxisLabels(std::string xLabel, std::string yLabel);
public slots:
void createWidgetSlot();
void destroyWidgetSlot();
void widgetDestroyed();
signals:
void createWidgetSignal();
void destroyWidgetSignal();
void destroyWidgetSignalBlocking();
void setWidgetTitle(QString title);
void setWidgetAxisLabels(QString xLabel, QString yLabel);
void setWidgetXAxisScale(double xMin, double xMax);
void setWidgetYAxisScale(double yMin, double yMax);
void setWidgetXAxisAutoScale(bool on);
void setWidgetYAxisAutoScale(bool on);
private:
ScatterWidget* widget_;
bool destroyed_;
};
#endif // SCATTERPLOTWRAPPER_H

@ -1,75 +0,0 @@
/**
*
* \section COPYRIGHT
*
* Copyright 2013-2014 The srsLTE Developers. See the
* COPYRIGHT file at the top-level directory of this distribution.
*
* \section LICENSE
*
* This file is part of the srsLTE library.
*
* srsLTE is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version.
*
* srsLTE 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 Lesser General Public License for more details.
*
* A copy of the GNU Lesser General Public License can be found in
* the LICENSE file in the top-level directory of this distribution
* and at http://www.gnu.org/licenses/.
*
*/
#include "liblte/graphics/plot/plot_scatter.h"
#include "Scatterplot.h"
#include <complex>
int plot_scatter_init(plot_scatter_t *h) {
*h = (void*) new Scatterplot();
return (*h != NULL)?0:-1;
}
void plot_scatter_setTitle(plot_scatter_t *h, char *title) {
Scatterplot *plot = static_cast<Scatterplot*>(*h);
plot->setTitle(title);
}
void plot_scatter_setNewData(plot_scatter_t *h, _Complex float *data,
int num_points) {
Scatterplot *plot = static_cast<Scatterplot*>(*h);
plot->setNewData(reinterpret_cast<std::complex<float>*> (data), num_points);
}
void plot_scatter_setXAxisAutoScale(plot_scatter_t *h, bool on) {
Scatterplot *plot = static_cast<Scatterplot*>(*h);
plot->setXAxisAutoScale(on);
}
void plot_scatter_setYAxisAutoScale(plot_scatter_t *h, bool on) {
Scatterplot *plot = static_cast<Scatterplot*>(*h);
plot->setYAxisAutoScale(on);
}
void plot_scatter_setXAxisScale(plot_scatter_t *h, double xMin, double xMax) {
Scatterplot *plot = static_cast<Scatterplot*>(*h);
plot->setXAxisScale(xMin, xMax);
}
void plot_scatter_setYAxisScale(plot_scatter_t *h, double yMin, double yMax) {
Scatterplot *plot = static_cast<Scatterplot*>(*h);
plot->setYAxisScale(yMin, yMax);
}
void plot_scatter_setAxisLabels(plot_scatter_t *h, char *xLabel, char *yLabel) {
Scatterplot *plot = static_cast<Scatterplot*>(*h);
plot->setAxisLabels(xLabel, yLabel);
}

@ -1,30 +0,0 @@
#
# Copyright 2012-2013 The Iris Project Developers. See the
# COPYRIGHT file at the top-level directory of this distribution
# and at http://www.softwareradiosystems.com/iris/copyright.html.
#
# This file is part of the Iris Project.
#
# Iris is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation, either version 3 of
# the License, or (at your option) any later version.
#
# Iris 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 Lesser General Public License for more details.
#
# A copy of the GNU Lesser General Public License can be found in
# the LICENSE file in the top-level directory of this distribution
# and at http://www.gnu.org/licenses/.
#
########################################################################
# Build tests
########################################################################
INCLUDE_DIRECTORIES(..)
ADD_EXECUTABLE(scatterplot_test scatterplot_test.cpp)
TARGET_LINK_LIBRARIES(scatterplot_test pthread graphics)
ADD_TEST(scatterplot_test scatterplot_test)

@ -1,126 +0,0 @@
/**
* \file lib/generic/modulation/Crc_test.cpp
* \version 1.0
*
* \section COPYRIGHT
*
* Copyright 2012-2013 The Iris Project Developers. See the
* COPYRIGHT file at the top-level directory of this distribution
* and at http://www.softwareradiosystems.com/iris/copyright.html.
*
* \section LICENSE
*
* This file is part of the Iris Project.
*
* Iris is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version.
*
* Iris 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 Lesser General Public License for more details.
*
* A copy of the GNU Lesser General Public License can be found in
* the LICENSE file in the top-level directory of this distribution
* and at http://www.gnu.org/licenses/.
*
* \section DESCRIPTION
*
* Main test file for scatterplot class.
*/
#include "Scatterplot.h"
#include <pthread.h>
#include <unistd.h>
#include <stdio.h>
#include <qapplication.h>
#include <cstdlib>
#include <complex>
#include <vector>
typedef std::complex<float> Cplx;
typedef std::vector<Cplx> CplxVec;
template<class T>
void getPoints(std::complex<T>* data, int numPoints) {
for (int i = 0; i < numPoints; i++) {
data[i] = std::complex<T>(2 * ((T) rand() / RAND_MAX) - 1,
2 * ((T) rand() / RAND_MAX) - 1);
}
}
template<class Iterator>
void getPoints(Iterator begin, Iterator end) {
for (; begin != end; begin++) {
float r = 2 * ((double) rand() / RAND_MAX) - 1;
float i = 2 * ((double) rand() / RAND_MAX) - 1;
*begin = Cplx(r, i);
}
}
void *threadMain1(void *arg) {
Scatterplot plot;
std::complex<float> data[1024];
for (int i = 0; i < 10; i++) {
getPoints(data, 1024);
plot.setNewData(data, 1024);
usleep(100000);
}
return NULL;
}
void *threadMain2(void *arg) {
Scatterplot plot;
std::complex<double> data[1024];
for (int i = 0; i < 10; i++) {
getPoints(data, 1024);
plot.setNewData(data, 1024);
usleep(100000);
}
return NULL;
}
void *threadMain3(void *arg) {
Scatterplot plot;
CplxVec v(1024);
for (int i = 0; i < 10; i++) {
getPoints(v.begin(), v.end());
plot.setNewData(v.begin(), v.end());
usleep(100000);
}
return NULL;
}
int main(int argc, char *argv[]) {
int argc2 = 1;
char* argv2[] = { const_cast<char *>("Scatterplot_Basic_Test"), NULL };
QApplication a(argc2, argv2);
pthread_t threads[3];
int i;
if (pthread_create(&threads[0], NULL, threadMain1, NULL)) {
perror("pthread_create");
exit(-1);
}
if (pthread_create(&threads[1], NULL, threadMain2, NULL)) {
perror("pthread_create");
exit(-1);
}
if (pthread_create(&threads[2], NULL, threadMain3, NULL)) {
perror("pthread_create");
exit(-1);
}
qApp->exec();
for (i=0;i<3;i++) {
pthread_join(threads[i], NULL);
}
exit(0);
}

@ -1,141 +0,0 @@
#include "WaterfallWidget.h"
#include "Spectrogramplot.h"
#include "Lineplot.h"
#include "Events.h"
#include <qlayout.h>
#include <qpushbutton.h>
#include <algorithm>
using namespace std;
WaterfallWidget::WaterfallWidget(int numDataPoints, int numRows, QWidget *parent)
:QWidget(parent)
{
p_ = new Lineplot();
s_ = new Spectrogramplot(numDataPoints, numRows);
b_ = new QPushButton("Autoscale");
connect(b_, SIGNAL(clicked()), this, SLOT(autoscale()));
QVBoxLayout* vLayout1 = new QVBoxLayout(this);
vLayout1->addWidget(p_);vLayout1->setStretch(0,1);
vLayout1->addWidget(s_);vLayout1->setStretch(1,3);
vLayout1->addWidget(b_);
numPoints_ = numDataPoints;
data_ = new double[numPoints_];
timerId_ = startTimer(10);
haveNewData_ = false;
}
WaterfallWidget::~WaterfallWidget()
{
delete p_;
delete s_;
}
void WaterfallWidget::customEvent( QEvent * e )
{
if(e->type() == RealDataEvent::type)
{
RealDataEvent* dataEvent = (RealDataEvent*)e;
appendData(dataEvent);
}
}
void WaterfallWidget::setWidgetTitle(QString title)
{
setWindowTitle(title);
}
void WaterfallWidget::setPlotXLabel(QString xLabel)
{
p_->setAxisTitle(QwtPlot::xBottom, xLabel);
}
void WaterfallWidget::setPlotYLabel(QString yLabel)
{
p_->setAxisTitle(QwtPlot::yLeft, yLabel);
}
void WaterfallWidget::setPlotXAxisRange(double xMin, double xMax)
{
p_->setXAxisRange(xMin, xMax);
}
void WaterfallWidget::setPlotXAxisScale(double xMin, double xMax)
{
p_->setAxisScale(QwtPlot::xBottom, xMin, xMax);
}
void WaterfallWidget::setPlotYAxisScale(double yMin, double yMax)
{
p_->setAxisScale(QwtPlot::yLeft, yMin, yMax);
}
void WaterfallWidget::setSpectrogramXLabel(QString xLabel)
{
s_->setAxisTitle(QwtPlot::xBottom, xLabel);
}
void WaterfallWidget::setSpectrogramYLabel(QString yLabel)
{
s_->setAxisTitle(QwtPlot::yLeft, yLabel);
}
void WaterfallWidget::setSpectrogramXAxisRange(double xMin, double xMax)
{
s_->setXAxisRange(xMin, xMax);
}
void WaterfallWidget::setSpectrogramYAxisRange(double yMin, double yMax)
{
s_->setYAxisRange(yMin, yMax);
}
void WaterfallWidget::setSpectrogramZAxisScale(double zMin, double zMax)
{
s_->setZAxisScale(zMin, zMax);
}
void WaterfallWidget::autoscale()
{
double min = s_->min();
double max = s_->max();
s_->setZAxisScale(min, max);
p_->setAxisAutoScale(QwtPlot::yLeft, false);
p_->setAxisScale(QwtPlot::yLeft, min, max);
}
void WaterfallWidget::timerEvent(QTimerEvent *event)
{
if(event->timerId() == timerId_)
{
if(haveNewData_)
{
p_->replot();
s_->replot();
haveNewData_ = false;
}
return;
}
QWidget::timerEvent(event);
}
void WaterfallWidget::appendData(RealDataEvent* e)
{
if(e->numPoints_ != numPoints_)
{
numPoints_ = e->numPoints_;
delete [] data_;
data_ = new double[numPoints_];
}
memcpy(data_, e->dataPoints_, numPoints_*sizeof(double));
p_->setData(data_, numPoints_);
s_->appendData(data_, numPoints_);
haveNewData_ = true;
}

@ -1,52 +0,0 @@
#ifndef WATERFALLWIDGET_H
#define WATERFALLWIDGET_H
#include <qapplication.h>
#include <qwidget.h>
#include <complex>
class RealDataEvent;
class Lineplot;
class Spectrogramplot;
class QPushButton;
class WaterfallWidget
: public QWidget
{
Q_OBJECT
public:
WaterfallWidget(int numDataPoints, int numRows, QWidget* parent = 0);
virtual ~WaterfallWidget();
public slots:
void customEvent( QEvent * e );
void setWidgetTitle(QString title);
void setPlotXLabel(QString xLabel);
void setPlotYLabel(QString yLabel);
void setPlotXAxisRange(double xMin, double xMax);
void setPlotXAxisScale(double xMin, double xMax);
void setPlotYAxisScale(double yMin, double yMax);
void setSpectrogramXLabel(QString xLabel);
void setSpectrogramYLabel(QString yLabel);
void setSpectrogramXAxisRange(double xMin, double xMax);
void setSpectrogramYAxisRange(double yMin, double yMax);
void setSpectrogramZAxisScale(double zMin, double zMax);
void autoscale();
protected:
virtual void timerEvent(QTimerEvent *event);
private:
void appendData(RealDataEvent* e);
Lineplot* p_;
Spectrogramplot* s_;
QPushButton* b_;
double* data_;
int numPoints_;
int timerId_;
bool haveNewData_;
};
#endif // WATERFALLWIDGET_H

@ -1,80 +0,0 @@
#include "Waterfallplot.h"
#include "WaterfallplotWrapper.h"
using namespace std;
Waterfallplot::Waterfallplot(int numDataPoints, int numRows)
{
plot_ = new WaterfallplotWrapper(numDataPoints, numRows);
}
Waterfallplot::~Waterfallplot()
{
delete plot_;
}
void Waterfallplot::appendNewData(float* data, int numPoints)
{
plot_->appendNewData(data, numPoints);
}
void Waterfallplot::appendNewData(double* data, int numPoints)
{
plot_->appendNewData(data, numPoints);
}
void Waterfallplot::setTitle(std::string title)
{
plot_->setTitle(title);
}
void Waterfallplot::setPlotXLabel(std::string xLabel)
{
plot_->setPlotXLabel(xLabel);
}
void Waterfallplot::setPlotYLabel(std::string yLabel)
{
plot_->setPlotYLabel(yLabel);
}
void Waterfallplot::setPlotXAxisRange(double xMin, double xMax)
{
plot_->setPlotXAxisRange(xMin, xMax);
}
void Waterfallplot::setPlotXAxisScale(double xMin, double xMax)
{
plot_->setPlotXAxisScale(xMin, xMax);
}
void Waterfallplot::setPlotYAxisScale(double yMin, double yMax)
{
plot_->setPlotYAxisScale(yMin, yMax);
}
void Waterfallplot::setSpectrogramXLabel(std::string xLabel)
{
plot_->setSpectrogramXLabel(xLabel);
}
void Waterfallplot::setSpectrogramYLabel(std::string yLabel)
{
plot_->setSpectrogramYLabel(yLabel);
}
void Waterfallplot::setSpectrogramXAxisRange(double xMin, double xMax)
{
plot_->setSpectrogramXAxisRange(xMin, xMax);
}
void Waterfallplot::setSpectrogramYAxisRange(double yMin, double yMax)
{
plot_->setSpectrogramYAxisRange(yMin, yMax);
}
void Waterfallplot::setSpectrogramZAxisScale(double zMin, double zMax)
{
plot_->setSpectrogramZAxisScale(zMin, zMax);
}

@ -1,49 +0,0 @@
#ifndef WATERFALLPLOT_H
#define WATERFALLPLOT_H
#include <string>
class WaterfallplotWrapper;
class Waterfallplot
{
public:
Waterfallplot(int numDataPoints, int numRows);
~Waterfallplot();
template<class Iterator>
void appendNewData(Iterator begin, Iterator end);
void appendNewData(float* data, int numPoints);
void appendNewData(double* data, int numPoints);
void setTitle(std::string title);
void setPlotXLabel(std::string xLabel);
void setPlotYLabel(std::string yLabel);
void setPlotXAxisRange(double xMin, double xMax);
void setPlotXAxisScale(double xMin, double xMax);
void setPlotYAxisScale(double yMin, double yMax);
void setSpectrogramXLabel(std::string xLabel);
void setSpectrogramYLabel(std::string yLabel);
void setSpectrogramXAxisRange(double xMin, double xMax);
void setSpectrogramYAxisRange(double yMin, double yMax);
void setSpectrogramZAxisScale(double zMin, double zMax);
private:
WaterfallplotWrapper* plot_;
};
template<class Iterator>
void Waterfallplot::appendNewData(Iterator begin, Iterator end)
{
int numPoints = end-begin;
double* data = new double[numPoints];
for(int i=0;begin!=end;begin++,i++)
{
data[i] = *begin;
}
appendNewData(data, numPoints);
delete[] data;
}
#endif // WATERFALLPLOT_H

@ -1,187 +0,0 @@
#include "WaterfallplotWrapper.h"
#include "WaterfallWidget.h"
#include "Events.h"
#include <qapplication.h>
#include <QThread>
using namespace std;
WaterfallplotWrapper::WaterfallplotWrapper(int numDataPoints, int numRows)
:widget_(NULL)
,destroyed_(true)
{
if(QCoreApplication::instance() == NULL)
return; //TODO: throw exception here in Iris
if(QCoreApplication::instance()->thread() == QThread::currentThread())
{
connect( this, SIGNAL( createWidgetSignal(int, int) ),
this, SLOT(createWidgetSlot(int, int)) );
connect( this, SIGNAL( destroyWidgetSignal() ),
this, SLOT(destroyWidgetSlot()) );
connect( this, SIGNAL( destroyWidgetSignalBlocking() ),
this, SLOT(destroyWidgetSlot()) );
}
else
{
connect( this, SIGNAL( createWidgetSignal(int, int) ),
this, SLOT(createWidgetSlot(int, int)),
Qt::BlockingQueuedConnection );
connect( this, SIGNAL( destroyWidgetSignal() ),
this, SLOT(destroyWidgetSlot()) );
connect( this, SIGNAL( destroyWidgetSignalBlocking() ),
this, SLOT(destroyWidgetSlot()),
Qt::BlockingQueuedConnection );
moveToThread(QCoreApplication::instance()->thread());
}
emit createWidgetSignal(numDataPoints, numRows);
}
WaterfallplotWrapper::~WaterfallplotWrapper()
{
if(destroyed_)
emit destroyWidgetSignal();
else
emit destroyWidgetSignalBlocking();
}
void WaterfallplotWrapper::createWidgetSlot(int numDataPoints, int numRows)
{
widget_ = new WaterfallWidget(numDataPoints, numRows);
destroyed_ = false;
widget_->setAttribute(Qt::WA_DeleteOnClose, true);
connect(widget_, SIGNAL( destroyed() ),
this, SLOT( widgetDestroyed() ));
connect(this, SIGNAL(setWidgetTitle(QString)),
widget_, SLOT(setWidgetTitle(QString)));
connect(this, SIGNAL(setWidgetPXLabel(QString)),
widget_, SLOT(setPlotXLabel(QString)));
connect(this, SIGNAL(setWidgetPYLabel(QString)),
widget_, SLOT(setPlotYLabel(QString)));
connect(this, SIGNAL(setWidgetPXAxisRange(double, double)),
widget_, SLOT(setPlotXAxisRange(double, double)));
connect(this, SIGNAL(setWidgetPXAxisScale(double, double)),
widget_, SLOT(setPlotXAxisScale(double, double)));
connect(this, SIGNAL(setWidgetPYAxisScale(double, double)),
widget_, SLOT(setPlotYAxisScale(double, double)));
connect(this, SIGNAL(setWidgetSXLabel(QString)),
widget_, SLOT(setSpectrogramXLabel(QString)));
connect(this, SIGNAL(setWidgetSYLabel(QString)),
widget_, SLOT(setSpectrogramYLabel(QString)));
connect(this, SIGNAL(setWidgetSXAxisRange(double, double)),
widget_, SLOT(setSpectrogramXAxisRange(double, double)));
connect(this, SIGNAL(setWidgetSYAxisRange(double, double)),
widget_, SLOT(setSpectrogramYAxisRange(double, double)));
connect(this, SIGNAL(setWidgetSZAxisScale(double, double)),
widget_, SLOT(setSpectrogramZAxisScale(double, double)));
widget_->resize( 800, 600 );
widget_->show();
}
void WaterfallplotWrapper::destroyWidgetSlot()
{
delete widget_;
}
void WaterfallplotWrapper::widgetDestroyed()
{
destroyed_ = true;
}
void WaterfallplotWrapper::appendNewData(float* data, int numPoints)
{
if(destroyed_)
return;
qApp->postEvent(widget_, new RealDataEvent(data, numPoints));
}
void WaterfallplotWrapper::appendNewData(double* data, int numPoints)
{
if(destroyed_)
return;
qApp->postEvent(widget_, new RealDataEvent(data, numPoints));
}
void WaterfallplotWrapper::setTitle(std::string title)
{
if(destroyed_)
return;
QString str = QString::fromUtf8(title.c_str());
emit setWidgetTitle(str);
}
void WaterfallplotWrapper::setPlotXLabel(std::string xLabel)
{
if(destroyed_)
return;
QString str = QString::fromUtf8(xLabel.c_str());
emit setWidgetPXLabel(str);
}
void WaterfallplotWrapper::setPlotYLabel(std::string yLabel)
{
if(destroyed_)
return;
QString str = QString::fromUtf8(yLabel.c_str());
emit setWidgetPYLabel(str);
}
void WaterfallplotWrapper::setPlotXAxisRange(double xMin, double xMax)
{
if(destroyed_)
return;
emit setWidgetPXAxisRange(xMin, xMax);
}
void WaterfallplotWrapper::setPlotXAxisScale(double xMin, double xMax)
{
if(destroyed_)
return;
emit setWidgetPXAxisScale(xMin, xMax);
}
void WaterfallplotWrapper::setPlotYAxisScale(double yMin, double yMax)
{
if(destroyed_)
return;
emit setWidgetPYAxisScale(yMin, yMax);
}
void WaterfallplotWrapper::setSpectrogramXAxisRange(double xMin, double xMax)
{
if(destroyed_)
return;
emit setWidgetSXAxisRange(xMin, xMax);
}
void WaterfallplotWrapper::setSpectrogramXLabel(std::string xLabel)
{
if(destroyed_)
return;
QString str = QString::fromUtf8(xLabel.c_str());
emit setWidgetSXLabel(str);
}
void WaterfallplotWrapper::setSpectrogramYLabel(std::string yLabel)
{
if(destroyed_)
return;
QString str = QString::fromUtf8(yLabel.c_str());
emit setWidgetSYLabel(str);
}
void WaterfallplotWrapper::setSpectrogramYAxisRange(double yMin, double yMax)
{
if(destroyed_)
return;
emit setWidgetSYAxisRange(yMin, yMax);
}
void WaterfallplotWrapper::setSpectrogramZAxisScale(double zMin, double zMax)
{
if(destroyed_)
return;
emit setWidgetSZAxisScale(zMin, zMax);
}

@ -1,57 +0,0 @@
#ifndef WATERFALLPLOTWRAPPER_H
#define WATERFALLPLOTWRAPPER_H
#include <qapplication.h>
class WaterfallWidget;
class WaterfallplotWrapper
: QObject
{
Q_OBJECT
public:
WaterfallplotWrapper(int numDataPoints, int numRows);
~WaterfallplotWrapper();
void appendNewData(float* data, int numPoints);
void appendNewData(double* data, int numPoints);
void setTitle(std::string title);
void setPlotXLabel(std::string xLabel);
void setPlotYLabel(std::string yLabel);
void setPlotXAxisRange(double xMin, double xMax);
void setPlotXAxisScale(double xMin, double xMax);
void setPlotYAxisScale(double yMin, double yMax);
void setSpectrogramXLabel(std::string xLabel);
void setSpectrogramYLabel(std::string yLabel);
void setSpectrogramXAxisRange(double xMin, double xMax);
void setSpectrogramYAxisRange(double yMin, double yMax);
void setSpectrogramZAxisScale(double zMin, double zMax);
public slots:
void createWidgetSlot(int numDataPoints, int numRows);
void destroyWidgetSlot();
void widgetDestroyed();
signals:
void createWidgetSignal(int numDataPoints, int numRows);
void destroyWidgetSignal();
void destroyWidgetSignalBlocking();
void setWidgetTitle(QString title);
void setWidgetPXLabel(QString xLabel);
void setWidgetPYLabel(QString yLabel);
void setWidgetPXAxisRange(double xMin, double xMax);
void setWidgetPXAxisScale(double xMin, double xMax);
void setWidgetPYAxisScale(double yMin, double yMax);
void setWidgetSXLabel(QString xLabel);
void setWidgetSYLabel(QString yLabel);
void setWidgetSXAxisRange(double xMin, double xMax);
void setWidgetSYAxisRange(double yMin, double yMax);
void setWidgetSZAxisScale(double zMin, double zMax);
private:
WaterfallWidget* widget_;
bool destroyed_;
};
#endif // WATERFALLPLOTWRAPPER_H

@ -1,102 +0,0 @@
/**
*
* \section COPYRIGHT
*
* Copyright 2013-2014 The srsLTE Developers. See the
* COPYRIGHT file at the top-level directory of this distribution.
*
* \section LICENSE
*
* This file is part of the srsLTE library.
*
* srsLTE is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version.
*
* srsLTE 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 Lesser General Public License for more details.
*
* A copy of the GNU Lesser General Public License can be found in
* the LICENSE file in the top-level directory of this distribution
* and at http://www.gnu.org/licenses/.
*
*/
#include "liblte/graphics/plot/plot_waterfall.h"
#include "Waterfallplot.h"
#include <complex.h>
int plot_waterfall_init(plot_waterfall_t *h, int numDataPoints, int numRows) {
*h = (void*) new Waterfallplot(numDataPoints, numRows);
return (*h != NULL)?0:-1;
}
void plot_waterfall_setTitle(plot_waterfall_t *h, char *title) {
Waterfallplot *plot = static_cast<Waterfallplot*>(*h);
plot->setTitle(title);
}
void plot_waterfall_appendNewData(plot_waterfall_t *h, float *data,
int num_points) {
Waterfallplot *plot = static_cast<Waterfallplot*>(*h);
plot->appendNewData(data, num_points);
}
void plot_complex_setPlotXLabel(plot_waterfall_t *h, char *xLabel) {
Waterfallplot *plot = static_cast<Waterfallplot*>(*h);
plot->setPlotXLabel(xLabel);
}
void plot_complex_setPlotYLabel(plot_waterfall_t *h, char *yLabel) {
Waterfallplot *plot = static_cast<Waterfallplot*>(*h);
plot->setPlotXLabel(yLabel);
}
void plot_waterfall_setPlotXAxisRange(plot_waterfall_t *h, double xMin, double xMax) {
Waterfallplot *plot = static_cast<Waterfallplot*>(*h);
plot->setPlotXAxisRange(xMin, xMax);
}
void plot_waterfall_setPlotXAxisScale(plot_waterfall_t *h, double xMin, double xMax) {
Waterfallplot *plot = static_cast<Waterfallplot*>(*h);
plot->setPlotXAxisScale(xMin, xMax);
}
void plot_waterfall_setPlotYAxisScale(plot_waterfall_t *h, double yMin, double yMax) {
Waterfallplot *plot = static_cast<Waterfallplot*>(*h);
plot->setPlotYAxisScale(yMin, yMax);
}
void plot_waterfall_setSpectrogramXLabel(plot_waterfall_t *h, char* xLabel) {
Waterfallplot *plot = static_cast<Waterfallplot*>(*h);
plot->setSpectrogramXLabel(xLabel);
}
void plot_waterfall_setSpectrogramYLabel(plot_waterfall_t *h, char* yLabel) {
Waterfallplot *plot = static_cast<Waterfallplot*>(*h);
plot->setSpectrogramYLabel(yLabel);
}
void plot_waterfall_setSpectrogramXAxisRange(plot_waterfall_t *h, double xMin, double xMax) {
Waterfallplot *plot = static_cast<Waterfallplot*>(*h);
plot->setSpectrogramXAxisRange(xMin, xMax);
}
void plot_waterfall_setSpectrogramYAxisRange(plot_waterfall_t *h, double yMin, double yMax) {
Waterfallplot *plot = static_cast<Waterfallplot*>(*h);
plot->setSpectrogramYAxisRange(yMin, yMax);
}
void plot_waterfall_setSpectrogramZAxisScale(plot_waterfall_t *h, double zMin, double zMax) {
Waterfallplot *plot = static_cast<Waterfallplot*>(*h);
plot->setSpectrogramZAxisScale(zMin, zMax);
}

@ -1,32 +0,0 @@
#
# Copyright 2012-2013 The Iris Project Developers. See the
# COPYRIGHT file at the top-level directory of this distribution
# and at http://www.softwareradiosystems.com/iris/copyright.html.
#
# This file is part of the Iris Project.
#
# Iris is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation, either version 3 of
# the License, or (at your option) any later version.
#
# Iris 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 Lesser General Public License for more details.
#
# A copy of the GNU Lesser General Public License can be found in
# the LICENSE file in the top-level directory of this distribution
# and at http://www.gnu.org/licenses/.
#
########################################################################
# Build tests
########################################################################
#turn the test cpp file into an executable with an int main() function
ADD_DEFINITIONS(-DBOOST_TEST_DYN_LINK -DBOOST_TEST_MAIN)
INCLUDE_DIRECTORIES(..)
ADD_EXECUTABLE(waterfallplot_test Waterfallplot_test.cpp)
TARGET_LINK_LIBRARIES(waterfallplot_test ${Boost_LIBRARIES} graphics)
ADD_TEST(waterfallplot_test waterfallplot_test)

@ -1,127 +0,0 @@
/**
* \file lib/generic/modulation/Crc_test.cpp
* \version 1.0
*
* \section COPYRIGHT
*
* Copyright 2012-2013 The Iris Project Developers. See the
* COPYRIGHT file at the top-level directory of this distribution
* and at http://www.softwareradiosystems.com/iris/copyright.html.
*
* \section LICENSE
*
* This file is part of the Iris Project.
*
* Iris is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version.
*
* Iris 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 Lesser General Public License for more details.
*
* A copy of the GNU Lesser General Public License can be found in
* the LICENSE file in the top-level directory of this distribution
* and at http://www.gnu.org/licenses/.
*
* \section DESCRIPTION
*
* Main test file for Waterfallplot class.
*/
#include "Waterfallplot.h"
#include <math.h>
#include <pthread.h>
#include <unistd.h>
#include <stdio.h>
#include <qapplication.h>
#include <cstdlib>
#include <vector>
#define PI 3.14159265358979323846
using namespace std;
void *threadMain1(void *arg) {
int n = 2048;
Waterfallplot plot(n, n);
plot.setTitle("Float");
float step = 1.0 * PI / n;
float* data = new float[n * 2];
for (int i = 0; i < n * 2; i++)
data[i] = sinf(step * i);
for (int i = 0; i < n; i++) {
plot.appendNewData(data + i, n);
usleep(1000);
}
return NULL;
}
void *threadMain2(void *arg) {
int n = 2048;
Waterfallplot plot(n, n);
plot.setTitle("Double");
double step = 2.0 * PI / n;
double* data = new double[n * 2];
for (int i = 0; i < n * 2; i++)
data[i] = sin(step * i);
for (int i = 0; i < n; i++) {
plot.appendNewData(data + i, n);
usleep(1000);
}
return NULL;
}
void *threadMain3(void *arg) {
int n = 2048;
Waterfallplot plot(n, n);
plot.setTitle("FloatVec");
double step = 2.0 * PI / n;
std::vector<float> data;
data.resize(n * 2);
for (int i = 0; i < n * 2; i++)
data[i] = sin(step * i);
for (int i = 0; i < n; i++) {
plot.appendNewData(data.begin() + i, data.begin() + i + n);
usleep(1000);
}
return NULL;
}
int main(int argc, char *argv[]) {
int argc2 = 1;
char* argv2[] = { const_cast<char *>("Waterfallplot_Init_Test"), NULL };
QApplication a(argc2, argv2);
pthread_t threads[3];
int i;
if (pthread_create(&threads[0], NULL, threadMain1, NULL)) {
perror("pthread_create");
exit(-1);
}
if (pthread_create(&threads[1], NULL, threadMain2, NULL)) {
perror("pthread_create");
exit(-1);
}
if (pthread_create(&threads[2], NULL, threadMain3, NULL)) {
perror("pthread_create");
exit(-1);
}
qApp->exec();
for (i = 0; i < 3; i++) {
pthread_join(threads[i], NULL);
}
exit(0);
}

@ -194,7 +194,7 @@ parfor index = 1:numel(SNRdB)
rxSubframe); rxSubframe);
addpath('../../debug/lte/phy/lib/ch_estimation/test') addpath('../../debug/lte/phy/lib/ch_estimation/test')
[est, ~, output] = liblte_chest(rmc.NCellID,rmc.CellRefP,rxSubframe,[0.25 0.5 0.25],[0.1 0.9],mod(rmc.NSubframe,10)); [est, ~, output] = srslte_chest(rmc.NCellID,rmc.CellRefP,rxSubframe,[0.25 0.5 0.25],[0.1 0.9],mod(rmc.NSubframe,10));
%estChannelGrid=reshape(est,size(estChannelGrid)); %estChannelGrid=reshape(est,size(estChannelGrid));

@ -13,7 +13,7 @@ for i=1:length(TBs)
%trblkin=[1, 0]; %trblkin=[1, 0];
[mat, info]=lteDLSCH(enbConfig,pdschConfig,e_bits,trblkin); [mat, info]=lteDLSCH(enbConfig,pdschConfig,e_bits,trblkin);
lib=liblte_dlsch_encode(enbConfig,pdschConfig,e_bits,trblkin); lib=srslte_dlsch_encode(enbConfig,pdschConfig,e_bits,trblkin);
error(i)=mean(abs(double(mat)-double(lib))); error(i)=mean(abs(double(mat)-double(lib)));
end end

@ -28,7 +28,7 @@ for prb=4
subframe_mat = lteULResourceGrid(ueConfig); subframe_mat = lteULResourceGrid(ueConfig);
subframe_mat(ind)=mat; subframe_mat(ind)=mat;
subframe_lib=liblte_srslte_refsignal_pusch(ueConfig,puschConfig); subframe_lib=srslte_srslte_refsignal_pusch(ueConfig,puschConfig);
error(k)=mean(abs(subframe_mat(:)-subframe_lib(:))); error(k)=mean(abs(subframe_mat(:)-subframe_lib(:)));
disp(error(k)) disp(error(k))

@ -12,7 +12,7 @@ Nrealizations=1 ;
preEVM = zeros(length(SNR_values_db),Nrealizations); preEVM = zeros(length(SNR_values_db),Nrealizations);
postEVM_mmse = zeros(length(SNR_values_db),Nrealizations); postEVM_mmse = zeros(length(SNR_values_db),Nrealizations);
postEVM_mmse_lin = zeros(length(SNR_values_db),Nrealizations); postEVM_mmse_lin = zeros(length(SNR_values_db),Nrealizations);
postEVM_liblte = zeros(length(SNR_values_db),Nrealizations); postEVM_srslte = zeros(length(SNR_values_db),Nrealizations);
enb.NDLRB = 6; % Number of resource blocks enb.NDLRB = 6; % Number of resource blocks
@ -152,25 +152,25 @@ addpath('../../debug/lte/phy/lib/ch_estimation/test')
%% Channel Estimation %% Channel Estimation
[estChannel, noiseEst(snr_idx)] = lteDLChannelEstimate(enb,cec,rxGrid); [estChannel, noiseEst(snr_idx)] = lteDLChannelEstimate(enb,cec,rxGrid);
output=[]; output=[];
snrest_liblte = zeros(10,1); snrest_srslte = zeros(10,1);
noise_liblte = zeros(10,1); noise_srslte = zeros(10,1);
rsrp = zeros(1,10); rsrp = zeros(1,10);
for i=0:9 for i=0:9
[d, a, out, snrest_liblte(i+1), noise_liblte(i+1), rsrp(i+1)] = liblte_chest(enb.NCellID,enb.CellRefP,rxGrid(:,i*14+1:(i+1)*14),[0.1 0.8 0.1],[0.1 0.9],i); [d, a, out, snrest_srslte(i+1), noise_srslte(i+1), rsrp(i+1)] = srslte_chest(enb.NCellID,enb.CellRefP,rxGrid(:,i*14+1:(i+1)*14),[0.1 0.8 0.1],[0.1 0.9],i);
output = [output out]; output = [output out];
end end
RSRP = [RSRP rsrp]; RSRP = [RSRP rsrp];
meanRSRP(snr_idx)=mean(rsrp); meanRSRP(snr_idx)=mean(rsrp);
SNR_liblte(snr_idx)=mean(snrest_liblte); SNR_srslte(snr_idx)=mean(snrest_srslte);
noiseEst_liblte(snr_idx)=mean(noise_liblte); noiseEst_srslte(snr_idx)=mean(noise_srslte);
if ~plot_noise_estimation_only if ~plot_noise_estimation_only
%% MMSE Equalization %% MMSE Equalization
eqGrid_mmse = lteEqualizeMMSE(rxGrid, estChannel, noiseEst(snr_idx)); eqGrid_mmse = lteEqualizeMMSE(rxGrid, estChannel, noiseEst(snr_idx));
eqGrid_liblte = reshape(output,size(eqGrid_mmse)); eqGrid_srslte = reshape(output,size(eqGrid_mmse));
% Analysis % Analysis
@ -185,13 +185,13 @@ if ~plot_noise_estimation_only
fprintf('%d-%d: MMSE: %0.3f%%\n', ... fprintf('%d-%d: MMSE: %0.3f%%\n', ...
snr_idx,nreal,postEqualisedEVM_mmse.RMS*100); snr_idx,nreal,postEqualisedEVM_mmse.RMS*100);
postEqualisedEVM_liblte = lteEVM(txGrid,reshape(eqGrid_liblte,size(txGrid))); postEqualisedEVM_srslte = lteEVM(txGrid,reshape(eqGrid_srslte,size(txGrid)));
fprintf('%d-%d: liblte: %0.3f%%\n', ... fprintf('%d-%d: srslte: %0.3f%%\n', ...
snr_idx,nreal,postEqualisedEVM_liblte.RMS*100); snr_idx,nreal,postEqualisedEVM_srslte.RMS*100);
preEVM(snr_idx,nreal) = preEqualisedEVM.RMS; preEVM(snr_idx,nreal) = preEqualisedEVM.RMS;
postEVM_mmse(snr_idx,nreal) = mean([postEqualisedEVM_mmse.RMS]); postEVM_mmse(snr_idx,nreal) = mean([postEqualisedEVM_mmse.RMS]);
postEVM_liblte(snr_idx,nreal) = mean([postEqualisedEVM_liblte.RMS]); postEVM_srslte(snr_idx,nreal) = mean([postEqualisedEVM_srslte.RMS]);
end end
end end
end end
@ -201,8 +201,8 @@ end
if ~plot_noise_estimation_only if ~plot_noise_estimation_only
plot(SNR_values_db, mean(preEVM,2), ... plot(SNR_values_db, mean(preEVM,2), ...
SNR_values_db, mean(postEVM_mmse,2), ... SNR_values_db, mean(postEVM_mmse,2), ...
SNR_values_db, mean(postEVM_liblte,2)) SNR_values_db, mean(postEVM_srslte,2))
legend('No Eq','MMSE-lin','MMSE-liblte') legend('No Eq','MMSE-lin','MMSE-srslte')
grid on grid on
end end
@ -211,11 +211,11 @@ if plot_noise_estimation_only
SNR_matlab = 1./(noiseEst*sqrt(2.0)*enb.CellRefP); SNR_matlab = 1./(noiseEst*sqrt(2.0)*enb.CellRefP);
subplot(1,3,1) subplot(1,3,1)
plot(SNR_values_db, SNR_values_db, SNR_values_db, 10*log10(SNR_liblte),SNR_values_db, 10*log10(SNR_matlab)) plot(SNR_values_db, SNR_values_db, SNR_values_db, 10*log10(SNR_srslte),SNR_values_db, 10*log10(SNR_matlab))
legend('Theory','srsLTE','Matlab') legend('Theory','srsLTE','Matlab')
subplot(1,3,2) subplot(1,3,2)
plot(SNR_values_db, 10*log10(noiseTx), SNR_values_db, 10*log10(noiseEst_liblte),SNR_values_db, 10*log10(noiseEst)) plot(SNR_values_db, 10*log10(noiseTx), SNR_values_db, 10*log10(noiseEst_srslte),SNR_values_db, 10*log10(noiseEst))
legend('Theory','srsLTE','Matlab') legend('Theory','srsLTE','Matlab')
subplot(1,3,3) subplot(1,3,3)

@ -79,7 +79,7 @@ for snr_idx=1:length(SNR_values_db)
errorReal(i,1)=1; errorReal(i,1)=1;
end end
[nof_ports2, pbchSymbols2, pbchBits, ce, ce2, pbchRx2, pbchHest2]= liblte_pbch(enb, rxWaveform, hest, nest); [nof_ports2, pbchSymbols2, pbchBits, ce, ce2, pbchRx2, pbchHest2]= srslte_pbch(enb, rxWaveform, hest, nest);
if (nof_ports2 ~= NofPortsTx) if (nof_ports2 ~= NofPortsTx)
errorReal(i,2)=1; errorReal(i,2)=1;
end end

@ -99,8 +99,8 @@ addpath('../../debug/lte/phy/lib/phch/test')
decoded = zeros(size(SNR_values)); decoded = zeros(size(SNR_values));
decoded_cfi = zeros(size(SNR_values)); decoded_cfi = zeros(size(SNR_values));
decoded_liblte = zeros(size(SNR_values)); decoded_srslte = zeros(size(SNR_values));
decoded_cfi_liblte = zeros(size(SNR_values)); decoded_cfi_srslte = zeros(size(SNR_values));
parfor snr_idx=1:length(SNR_values) parfor snr_idx=1:length(SNR_values)
SNRdB = SNR_values(snr_idx); SNRdB = SNR_values(snr_idx);
@ -145,11 +145,11 @@ parfor snr_idx=1:length(SNR_values)
%% Same with srsLTE %% Same with srsLTE
[rxCFI, pcfichSymbols2, pcfichSymbolsRx2] = liblte_pcfich(enbConfigRx, rxWaveform); [rxCFI, pcfichSymbols2, pcfichSymbolsRx2] = srslte_pcfich(enbConfigRx, rxWaveform);
decoded_cfi_liblte(snr_idx) = decoded_cfi_liblte(snr_idx) + (rxCFI == txCFI); decoded_cfi_srslte(snr_idx) = decoded_cfi_srslte(snr_idx) + (rxCFI == txCFI);
enbConfigRx.CFI = rxCFI; enbConfigRx.CFI = rxCFI;
[found_liblte, llr, pdcchSymbols2] = liblte_pdcch(enbConfigRx, ueConfig.RNTI, rxWaveform); [found_srslte, llr, pdcchSymbols2] = srslte_pdcch(enbConfigRx, ueConfig.RNTI, rxWaveform);
decoded_liblte(snr_idx) = decoded_liblte(snr_idx)+found_liblte; decoded_srslte(snr_idx) = decoded_srslte(snr_idx)+found_srslte;
end end
fprintf('SNR: %.1f\n',SNRdB) fprintf('SNR: %.1f\n',SNRdB)
end end
@ -157,8 +157,8 @@ end
if (Npackets>1) if (Npackets>1)
semilogy(SNR_values,1-decoded/Npackets,'bo-',... semilogy(SNR_values,1-decoded/Npackets,'bo-',...
SNR_values,1-decoded_cfi/Npackets,'bx:',... SNR_values,1-decoded_cfi/Npackets,'bx:',...
SNR_values,1-decoded_liblte/Npackets, 'ro-',... SNR_values,1-decoded_srslte/Npackets, 'ro-',...
SNR_values,1-decoded_cfi_liblte/Npackets,'rx:') SNR_values,1-decoded_cfi_srslte/Npackets,'rx:')
grid on grid on
legend('Matlab all','Matlab cfi', 'srsLTE all', 'srsLTE cfi') legend('Matlab all','Matlab cfi', 'srsLTE all', 'srsLTE cfi')
xlabel('SNR (dB)') xlabel('SNR (dB)')
@ -166,6 +166,6 @@ if (Npackets>1)
axis([min(SNR_values) max(SNR_values) 1/Npackets/10 1]) axis([min(SNR_values) max(SNR_values) 1/Npackets/10 1])
else else
disp(decoded) disp(decoded)
disp(decoded_liblte) disp(decoded_srslte)
end end

@ -54,7 +54,7 @@ cec.InterpWinSize = 1; % Interpolation window size
addpath('../../debug/lte/phy/lib/phch/test') addpath('../../debug/lte/phy/lib/phch/test')
decoded = zeros(size(SNR_values)); decoded = zeros(size(SNR_values));
decoded_liblte = zeros(size(SNR_values)); decoded_srslte = zeros(size(SNR_values));
for snr_idx=1:length(SNR_values) for snr_idx=1:length(SNR_values)
SNRdB = SNR_values(snr_idx); SNRdB = SNR_values(snr_idx);
@ -96,25 +96,25 @@ for snr_idx=1:length(SNR_values)
%% Same with srsLTE %% Same with srsLTE
if (rmccFgOut.PDSCH.TrBlkSizes(sf_idx+1) > 0) if (rmccFgOut.PDSCH.TrBlkSizes(sf_idx+1) > 0)
[dec2, data, pdschRx, pdschSymbols2, deb] = liblte_pdsch(rmccFgOut, rmccFgOut.PDSCH, ... [dec2, data, pdschRx, pdschSymbols2, deb] = srslte_pdsch(rmccFgOut, rmccFgOut.PDSCH, ...
rmccFgOut.PDSCH.TrBlkSizes(sf_idx+1), ... rmccFgOut.PDSCH.TrBlkSizes(sf_idx+1), ...
subframe_waveform); subframe_waveform);
else else
dec2 = 1; dec2 = 1;
end end
decoded_liblte(snr_idx) = decoded_liblte(snr_idx)+dec2; decoded_srslte(snr_idx) = decoded_srslte(snr_idx)+dec2;
end end
if ~isempty(recordedSignal) if ~isempty(recordedSignal)
recordedSignal = recordedSignal(flen*10+1:end); recordedSignal = recordedSignal(flen*10+1:end);
end end
end end
fprintf('SNR: %.1f. Decoded: %d-%d\n',SNRdB, decoded(snr_idx), decoded_liblte(snr_idx)) fprintf('SNR: %.1f. Decoded: %d-%d\n',SNRdB, decoded(snr_idx), decoded_srslte(snr_idx))
end end
if (length(SNR_values)>1) if (length(SNR_values)>1)
semilogy(SNR_values,1-decoded/Npackets/(Nsf+1),'bo-',... semilogy(SNR_values,1-decoded/Npackets/(Nsf+1),'bo-',...
SNR_values,1-decoded_liblte/Npackets/(Nsf+1), 'ro-') SNR_values,1-decoded_srslte/Npackets/(Nsf+1), 'ro-')
grid on; grid on;
legend('Matlab','srsLTE') legend('Matlab','srsLTE')
xlabel('SNR (dB)') xlabel('SNR (dB)')
@ -122,6 +122,6 @@ if (length(SNR_values)>1)
axis([min(SNR_values) max(SNR_values) 1/Npackets/(Nsf+1) 1]) axis([min(SNR_values) max(SNR_values) 1/Npackets/(Nsf+1) 1])
else else
disp(decoded) disp(decoded)
disp(decoded_liblte) disp(decoded_srslte)
end end

@ -24,7 +24,7 @@ for n_rb=1:length(NULRB)
prachConfig.HighSpeed=hs; prachConfig.HighSpeed=hs;
prachConfig.FreqIdx=5; prachConfig.FreqIdx=5;
prachConfig.FreqOffest=5; prachConfig.FreqOffest=5;
lib=liblte_prach(ueConfig,prachConfig); lib=srslte_prach(ueConfig,prachConfig);
[mat, info]=ltePRACH(ueConfig,prachConfig); [mat, info]=ltePRACH(ueConfig,prachConfig);
err=mean(abs(mat(:)-lib(1:length(mat)))); err=mean(abs(mat(:)-lib(1:length(mat))));

@ -51,7 +51,7 @@ for i=1:length(TBs)
subframe_mat(idx)=cw_mat; subframe_mat(idx)=cw_mat;
waveform = lteSCFDMAModulate(ueConfig,subframe_mat,0); waveform = lteSCFDMAModulate(ueConfig,subframe_mat,0);
[waveform_lib, subframe_lib, cwlib]=liblte_srslte_pusch_encode(ueConfig,puschConfig,trblkin,ones(1,cqilen(c)),ri_bit,ack_bit); [waveform_lib, subframe_lib, cwlib]=srslte_srslte_pusch_encode(ueConfig,puschConfig,trblkin,ones(1,cqilen(c)),ri_bit,ack_bit);
err=mean(abs(waveform-waveform_lib)); err=mean(abs(waveform-waveform_lib));
if (err > 10^-6) if (err > 10^-6)
disp(err) disp(err)

@ -26,8 +26,8 @@ for i=1:length(trBlkLenVec)
mat2 = reshape(reshape(mat{1},[],3)',[],1); mat2 = reshape(reshape(mat{1},[],3)',[],1);
out = lteTurboDecode(mat{1}); out = lteTurboDecode(mat{1});
lib=liblte_srslte_rm_turbo_rx(double(codeword),trBlkLen,RV); lib=srslte_srslte_rm_turbo_rx(double(codeword),trBlkLen,RV);
[outLib] = liblte_turbodecoder(lib); [outLib] = srslte_turbodecoder(lib);
if (length(trBlkLenVec) == 1) if (length(trBlkLenVec) == 1)
fprintf('Err mat: %d. Err lib: %d\n',sum(out(1+info.F:trBlkLen+info.F)~=in),sum(outLib(1+info.F:trBlkLen+info.F)~=in)); fprintf('Err mat: %d. Err lib: %d\n',sum(out(1+info.F:trBlkLen+info.F)~=in),sum(outLib(1+info.F:trBlkLen+info.F)~=in));

@ -112,15 +112,15 @@ for snr_idx=1:length(SNR_values)
error(3,snr_idx) = error(3,snr_idx) + ((idx ~= m0 && idx ~= m1)); error(3,snr_idx) = error(3,snr_idx) + ((idx ~= m0 && idx ~= m1));
% srsLTE results % srsLTE results
[n,sf_idx,lt_corr0]=liblte_sss(enb,rxWaveform,'full'); [n,sf_idx,lt_corr0]=srslte_sss(enb,rxWaveform,'full');
[m, idx]=max(lt_corr0); [m, idx]=max(lt_corr0);
error(4,snr_idx) = error(4,snr_idx) + ((idx ~= m0 && idx ~= m1)); error(4,snr_idx) = error(4,snr_idx) + ((idx ~= m0 && idx ~= m1));
[n,sf_idx,lt_corr2]=liblte_sss(enb,rxWaveform,'partial'); [n,sf_idx,lt_corr2]=srslte_sss(enb,rxWaveform,'partial');
[m, idx]=max(lt_corr2); [m, idx]=max(lt_corr2);
error(5,snr_idx) = error(5,snr_idx) + ((idx ~= m0 && idx ~= m1)); error(5,snr_idx) = error(5,snr_idx) + ((idx ~= m0 && idx ~= m1));
[n,sf_idx,lt_corr3]=liblte_sss(enb,rxWaveform,'diff'); [n,sf_idx,lt_corr3]=srslte_sss(enb,rxWaveform,'diff');
[m, idx]=max(lt_corr3); [m, idx]=max(lt_corr3);
error(6,snr_idx) = error(6,snr_idx) + ((idx ~= m0 && idx ~= m1)); error(6,snr_idx) = error(6,snr_idx) + ((idx ~= m0 && idx ~= m1));

@ -26,7 +26,7 @@ for snr_idx=1:length(SNR_values)
noise = N0*complex(randn(size(tx)), randn(size(tx))); % Generate noise noise = N0*complex(randn(size(tx)), randn(size(tx))); % Generate noise
rx=noise+tx; rx=noise+tx;
[rx_offset(i),corr] = lteDLFrameOffset(enb,rx,corrcfg); [rx_offset(i),corr] = lteDLFrameOffset(enb,rx,corrcfg);
[rx_offset_lt(i),corr_lt] = liblte_pss(enb,rx); [rx_offset_lt(i),corr_lt] = srslte_pss(enb,rx);
end end
diff(snr_idx)=sum(abs(rx_offset-tx_offset)); diff(snr_idx)=sum(abs(rx_offset-tx_offset));
diff_lt(snr_idx)=sum(abs(rx_offset_lt-tx_offset)); diff_lt(snr_idx)=sum(abs(rx_offset_lt-tx_offset));

@ -28,7 +28,7 @@ for snr_idx=1:length(SNR_values_db)
decodedData = lteTurboDecode(noisysymbols); decodedData = lteTurboDecode(noisysymbols);
interleavedSymbols = reshape(reshape(noisysymbols,[],3)',1,[]); interleavedSymbols = reshape(reshape(noisysymbols,[],3)',1,[]);
[decodedData2] = liblte_turbodecoder(interleavedSymbols); [decodedData2] = srslte_turbodecoder(interleavedSymbols);
errors1(snr_idx) = errors1(snr_idx) + any(decodedData ~= Data); errors1(snr_idx) = errors1(snr_idx) + any(decodedData ~= Data);
errors2(snr_idx) = errors2(snr_idx) + any(decodedData2 ~= Data); errors2(snr_idx) = errors2(snr_idx) + any(decodedData2 ~= Data);

@ -42,7 +42,7 @@ for i=1:length(TBs)
[mat, info]=lteULSCH(ueConfig,puschConfig,trblkin,ones(1,cqilen(c)),ri_bit,ack_bit,[]); [mat, info]=lteULSCH(ueConfig,puschConfig,trblkin,ones(1,cqilen(c)),ri_bit,ack_bit,[]);
mat(mat==-2)=2; mat(mat==-2)=2;
mat(mat==-1)=3; mat(mat==-1)=3;
[lib]=liblte_ulsch_encode(ueConfig,puschConfig,trblkin,ones(1,cqilen(c)),ri_bit,ack_bit); [lib]=srslte_ulsch_encode(ueConfig,puschConfig,trblkin,ones(1,cqilen(c)),ri_bit,ack_bit);
err=sum(abs(double(mat)-double(lib))); err=sum(abs(double(mat)-double(lib)));
if (err > 0) if (err > 0)
disp(err) disp(err)

@ -28,7 +28,7 @@ for snr_idx=1:length(SNR_values_db)
decodedData = lteConvolutionalDecode(noisysymbols); decodedData = lteConvolutionalDecode(noisysymbols);
interleavedSymbols = reshape(reshape(noisysymbols,[],3)',1,[]); interleavedSymbols = reshape(reshape(noisysymbols,[],3)',1,[]);
[decodedData2, quant] = liblte_viterbi(interleavedSymbols); [decodedData2, quant] = srslte_viterbi(interleavedSymbols);
errors1(snr_idx) = errors1(snr_idx) + any(decodedData ~= Data); errors1(snr_idx) = errors1(snr_idx) + any(decodedData ~= Data);
errors2(snr_idx) = errors2(snr_idx) + any(decodedData2 ~= Data); errors2(snr_idx) = errors2(snr_idx) + any(decodedData2 ~= Data);

@ -46,9 +46,9 @@ ENDIF(OCTAVE_FOUND)
IF (MATLAB_FOUND OR OCTAVE_FOUND) IF (MATLAB_FOUND OR OCTAVE_FOUND)
ADD_LIBRARY(liblte_mex SHARED mexutils.c) ADD_LIBRARY(srslte_mex SHARED mexutils.c)
INSTALL(TARGETS liblte_mex DESTINATION ${LIBRARY_DIR}) INSTALL(TARGETS srslte_mex DESTINATION ${LIBRARY_DIR})
LIBLTE_SET_PIC(liblte_mex) LIBLTE_SET_PIC(srslte_mex)
if (MATLAB_FOUND) if (MATLAB_FOUND)
include_directories(${MATLAB_INCLUDE_DIR}) include_directories(${MATLAB_INCLUDE_DIR})
endif(MATLAB_FOUND) endif(MATLAB_FOUND)

@ -39,7 +39,7 @@ FOREACH (_header ${headers})
LIST(APPEND HEADERS_ALL ${tmp}) LIST(APPEND HEADERS_ALL ${tmp})
ENDIF(IS_DIRECTORY ${_header}) ENDIF(IS_DIRECTORY ${_header})
ENDFOREACH() ENDFOREACH()
ADD_CUSTOM_TARGET (add_lte_phy_headers SOURCES ${HEADERS_ALL}) ADD_CUSTOM_TARGET (add_srslte_headers SOURCES ${HEADERS_ALL})
######################################################################## ########################################################################
# Add subdirectories # Add subdirectories

@ -25,10 +25,10 @@
################################################################# #################################################################
add_executable(hl_example hl_example.c) add_executable(hl_example hl_example.c)
target_link_libraries(hl_example lte_phy) target_link_libraries(hl_example srslte)
add_executable(ll_example ll_example.c) add_executable(ll_example ll_example.c)
target_link_libraries(ll_example lte_phy) target_link_libraries(ll_example srslte)
################################################################# #################################################################
@ -36,27 +36,24 @@ target_link_libraries(ll_example lte_phy)
################################################################# #################################################################
add_executable(synch_file synch_file.c) add_executable(synch_file synch_file.c)
target_link_libraries(synch_file lte_phy) target_link_libraries(synch_file srslte)
LINK_DIRECTORIES(${UHD_LIBRARY_DIRS}) LINK_DIRECTORIES(${UHD_LIBRARY_DIRS})
#################################################################
# Check if UHD C-API and Graphics library are available
#################################################################
LIST(FIND OPTIONAL_LIBS cuhd CUHD_FIND)
LIST(FIND OPTIONAL_LIBS graphics GRAPHICS_FIND)
################################################################# #################################################################
# These two can be compiled without UHD or graphics support # These two can be compiled without UHD or graphics support
################################################################# #################################################################
add_executable(pdsch_ue pdsch_ue.c cuhd_utils.c) add_executable(pdsch_ue pdsch_ue.c cuhd_utils.c)
target_link_libraries(pdsch_ue lte_rrc lte_phy) target_link_libraries(pdsch_ue srslte)
add_executable(pdsch_enodeb pdsch_enodeb.c) add_executable(pdsch_enodeb pdsch_enodeb.c)
target_link_libraries(pdsch_enodeb lte_rrc lte_phy pthread) target_link_libraries(pdsch_enodeb srslte pthread)
LIST(FIND OPTIONAL_LIBS cuhd CUHD_FIND)
IF(${CUHD_FIND} EQUAL -1) IF(${CUHD_FIND} EQUAL -1)
SET_TARGET_PROPERTIES(pdsch_ue PROPERTIES COMPILE_DEFINITIONS "DISABLE_UHD") SET_TARGET_PROPERTIES(pdsch_ue PROPERTIES COMPILE_DEFINITIONS "DISABLE_UHD")
SET_TARGET_PROPERTIES(pdsch_enodeb PROPERTIES COMPILE_DEFINITIONS "DISABLE_UHD") SET_TARGET_PROPERTIES(pdsch_enodeb PROPERTIES COMPILE_DEFINITIONS "DISABLE_UHD")
@ -65,13 +62,13 @@ ELSE(${CUHD_FIND} EQUAL -1)
target_link_libraries(pdsch_enodeb cuhd) target_link_libraries(pdsch_enodeb cuhd)
ENDIF(${CUHD_FIND} EQUAL -1) ENDIF(${CUHD_FIND} EQUAL -1)
IF(${GRAPHICS_FIND} EQUAL -1) FIND_PACKAGE(LIBSDRGUI)
IF(LIBSDRGUI_FOUND)
include_directories(${LIBSDRGUI_INCLUDE_DIRS})
target_link_libraries(pdsch_ue ${LIBSDRGUI_LIBRARIES})
ELSE(LIBSDRGUI_FOUND)
SET_TARGET_PROPERTIES(pdsch_ue PROPERTIES COMPILE_DEFINITIONS "DISABLE_GRAPHICS") SET_TARGET_PROPERTIES(pdsch_ue PROPERTIES COMPILE_DEFINITIONS "DISABLE_GRAPHICS")
SET_TARGET_PROPERTIES(pdsch_enodeb PROPERTIES COMPILE_DEFINITIONS "DISABLE_GRAPHICS") ENDIF(LIBSDRGUI_FOUND)
ELSE(${GRAPHICS_FIND} EQUAL -1)
target_link_libraries(pdsch_ue graphics)
target_link_libraries(pdsch_enodeb graphics)
ENDIF(${GRAPHICS_FIND} EQUAL -1)
################################################################# #################################################################
@ -81,13 +78,13 @@ ENDIF(${GRAPHICS_FIND} EQUAL -1)
IF(${CUHD_FIND} GREATER -1) IF(${CUHD_FIND} GREATER -1)
add_executable(cell_search cell_search.c cuhd_utils.c) add_executable(cell_search cell_search.c cuhd_utils.c)
target_link_libraries(cell_search lte_rrc lte_phy cuhd ) target_link_libraries(cell_search srslte cuhd )
add_executable(prach_ue prach_ue.c cuhd_utils.c) add_executable(prach_ue prach_ue.c cuhd_utils.c)
target_link_libraries(prach_ue lte_rrc lte_phy cuhd) target_link_libraries(prach_ue srslte cuhd)
add_executable(cell_measurement cell_measurement.c cuhd_utils.c) add_executable(cell_measurement cell_measurement.c cuhd_utils.c)
target_link_libraries(cell_measurement cuhd lte_rrc lte_phy) target_link_libraries(cell_measurement cuhd srslte)
MESSAGE(STATUS " UHD examples will be installed.") MESSAGE(STATUS " UHD examples will be installed.")

@ -52,15 +52,15 @@ FOREACH (_module ${modules})
ENDIF(IS_DIRECTORY ${_module}) ENDIF(IS_DIRECTORY ${_module})
ENDFOREACH() ENDFOREACH()
ADD_LIBRARY(lte_phy SHARED ${SOURCES_ALL}) ADD_LIBRARY(srslte SHARED ${SOURCES_ALL})
TARGET_LINK_LIBRARIES(lte_phy m ${FFTW3F_LIBRARIES}) TARGET_LINK_LIBRARIES(srslte m ${FFTW3F_LIBRARIES})
INSTALL(TARGETS lte_phy DESTINATION ${LIBRARY_DIR}) INSTALL(TARGETS srslte DESTINATION ${LIBRARY_DIR})
LIBLTE_SET_PIC(lte_phy) LIBLTE_SET_PIC(srslte)
IF(VOLK_FOUND) IF(VOLK_FOUND)
INCLUDE_DIRECTORIES(${VOLK_INCLUDE_DIRS}) INCLUDE_DIRECTORIES(${VOLK_INCLUDE_DIRS})
SET_TARGET_PROPERTIES(lte_phy PROPERTIES COMPILE_DEFINITIONS "${VOLK_DEFINITIONS}") SET_TARGET_PROPERTIES(srslte PROPERTIES COMPILE_DEFINITIONS "${VOLK_DEFINITIONS}")
TARGET_LINK_LIBRARIES(lte_phy ${VOLK_LIBRARIES}) TARGET_LINK_LIBRARIES(srslte ${VOLK_LIBRARIES})
MESSAGE(STATUS " Compiling with VOLK SIMD library.") MESSAGE(STATUS " Compiling with VOLK SIMD library.")
ELSE(VOLK_FOUND) ELSE(VOLK_FOUND)
MESSAGE(STATUS " VOLK SIMD library NOT found. Using generic implementation.") MESSAGE(STATUS " VOLK SIMD library NOT found. Using generic implementation.")

@ -24,7 +24,7 @@
######################################################################## ########################################################################
ADD_EXECUTABLE(chest_test_dl chest_test_dl.c) ADD_EXECUTABLE(chest_test_dl chest_test_dl.c)
TARGET_LINK_LIBRARIES(chest_test_dl lte_phy) TARGET_LINK_LIBRARIES(chest_test_dl srslte)
ADD_TEST(chest_test_dl_cellid0 chest_test_dl -c 0) ADD_TEST(chest_test_dl_cellid0 chest_test_dl -c 0)
ADD_TEST(chest_test_dl_cellid1 chest_test_dl -c 1) ADD_TEST(chest_test_dl_cellid1 chest_test_dl -c 1)
@ -38,7 +38,7 @@ ADD_TEST(chest_test_dl_cellid2 chest_test_dl -c 2 -r 50)
# Downlink MEX libs # Downlink MEX libs
######################################################################## ########################################################################
BuildMex(MEXNAME chest SOURCES chest_test_dl_mex.c LIBRARIES lte_phy) BuildMex(MEXNAME chest SOURCES chest_test_dl_mex.c LIBRARIES srslte)
######################################################################## ########################################################################
@ -46,10 +46,10 @@ BuildMex(MEXNAME chest SOURCES chest_test_dl_mex.c LIBRARIES lte_phy)
######################################################################## ########################################################################
ADD_EXECUTABLE(refsignal_ul_test_all refsignal_ul_test.c) ADD_EXECUTABLE(refsignal_ul_test_all refsignal_ul_test.c)
TARGET_LINK_LIBRARIES(refsignal_ul_test_all lte_phy) TARGET_LINK_LIBRARIES(refsignal_ul_test_all srslte)
BuildMex(MEXNAME refsignal_pusch SOURCES refsignal_pusch_mex.c LIBRARIES lte_phy liblte_mex) BuildMex(MEXNAME refsignal_pusch SOURCES refsignal_pusch_mex.c LIBRARIES srslte srslte_mex)

@ -24,7 +24,7 @@
######################################################################## ########################################################################
ADD_EXECUTABLE(ofdm_test ofdm_test.c) ADD_EXECUTABLE(ofdm_test ofdm_test.c)
TARGET_LINK_LIBRARIES(ofdm_test lte_phy) TARGET_LINK_LIBRARIES(ofdm_test srslte)
ADD_TEST(ofdm_normal ofdm_test) ADD_TEST(ofdm_normal ofdm_test)
ADD_TEST(ofdm_extended ofdm_test -e) ADD_TEST(ofdm_extended ofdm_test -e)

@ -25,10 +25,10 @@
######################################################################## ########################################################################
ADD_EXECUTABLE(rm_conv_test rm_conv_test.c) ADD_EXECUTABLE(rm_conv_test rm_conv_test.c)
TARGET_LINK_LIBRARIES(rm_conv_test lte_phy) TARGET_LINK_LIBRARIES(rm_conv_test srslte)
ADD_EXECUTABLE(rm_turbo_test rm_turbo_test.c) ADD_EXECUTABLE(rm_turbo_test rm_turbo_test.c)
TARGET_LINK_LIBRARIES(rm_turbo_test lte_phy) TARGET_LINK_LIBRARIES(rm_turbo_test srslte)
ADD_TEST(rm_conv_test_1 rm_conv_test -t 480 -r 1920) ADD_TEST(rm_conv_test_1 rm_conv_test -t 480 -r 1920)
ADD_TEST(rm_conv_test_2 rm_conv_test -t 1920 -r 480) ADD_TEST(rm_conv_test_2 rm_conv_test -t 1920 -r 480)
@ -38,27 +38,27 @@ ADD_TEST(rm_turbo_test_2 rm_turbo_test -t 1920 -r 480 -i 1)
ADD_TEST(rm_turbo_test_1 rm_turbo_test -t 480 -r 1920 -i 2) ADD_TEST(rm_turbo_test_1 rm_turbo_test -t 480 -r 1920 -i 2)
ADD_TEST(rm_turbo_test_2 rm_turbo_test -t 1920 -r 480 -i 3) ADD_TEST(rm_turbo_test_2 rm_turbo_test -t 1920 -r 480 -i 3)
BuildMex(MEXNAME rm_turbo_rx SOURCES rm_turbo_rx_mex.c LIBRARIES lte_phy liblte_mex) BuildMex(MEXNAME rm_turbo_rx SOURCES rm_turbo_rx_mex.c LIBRARIES srslte srslte_mex)
######################################################################## ########################################################################
# Turbo Coder TEST # Turbo Coder TEST
######################################################################## ########################################################################
ADD_EXECUTABLE(turbodecoder_test turbodecoder_test.c) ADD_EXECUTABLE(turbodecoder_test turbodecoder_test.c)
TARGET_LINK_LIBRARIES(turbodecoder_test lte_phy) TARGET_LINK_LIBRARIES(turbodecoder_test srslte)
ADD_TEST(turbodecoder_test_504_1 turbodecoder_test -n 100 -s 1 -l 504 -e 1.0 -t) ADD_TEST(turbodecoder_test_504_1 turbodecoder_test -n 100 -s 1 -l 504 -e 1.0 -t)
ADD_TEST(turbodecoder_test_504_2 turbodecoder_test -n 100 -s 1 -l 504 -e 2.0 -t) ADD_TEST(turbodecoder_test_504_2 turbodecoder_test -n 100 -s 1 -l 504 -e 2.0 -t)
ADD_TEST(turbodecoder_test_6114_1_5 turbodecoder_test -n 100 -s 1 -l 6144 -e 1.5 -t) ADD_TEST(turbodecoder_test_6114_1_5 turbodecoder_test -n 100 -s 1 -l 6144 -e 1.5 -t)
ADD_TEST(turbodecoder_test_known turbodecoder_test -n 1 -s 1 -k -e 0.5) ADD_TEST(turbodecoder_test_known turbodecoder_test -n 1 -s 1 -k -e 0.5)
BuildMex(MEXNAME turbodecoder SOURCES turbodecoder_test_mex.c LIBRARIES lte_phy liblte_mex) BuildMex(MEXNAME turbodecoder SOURCES turbodecoder_test_mex.c LIBRARIES srslte srslte_mex)
######################################################################## ########################################################################
# Viterbi TEST # Viterbi TEST
######################################################################## ########################################################################
ADD_EXECUTABLE(viterbi_test viterbi_test.c) ADD_EXECUTABLE(viterbi_test viterbi_test.c)
TARGET_LINK_LIBRARIES(viterbi_test lte_phy) TARGET_LINK_LIBRARIES(viterbi_test srslte)
ADD_TEST(viterbi_40_0 viterbi_test -n 1000 -s 1 -l 40 -k 7 -t -e 0.0) ADD_TEST(viterbi_40_0 viterbi_test -n 1000 -s 1 -l 40 -k 7 -t -e 0.0)
ADD_TEST(viterbi_40_2 viterbi_test -n 1000 -s 1 -l 40 -k 7 -t -e 2.0) ADD_TEST(viterbi_40_2 viterbi_test -n 1000 -s 1 -l 40 -k 7 -t -e 2.0)
@ -70,14 +70,14 @@ ADD_TEST(viterbi_1000_2 viterbi_test -n 100 -s 1 -l 1000 -k 7 -t -e 2.0)
ADD_TEST(viterbi_1000_3 viterbi_test -n 100 -s 1 -l 1000 -k 7 -t -e 3.0) ADD_TEST(viterbi_1000_3 viterbi_test -n 100 -s 1 -l 1000 -k 7 -t -e 3.0)
ADD_TEST(viterbi_1000_4 viterbi_test -n 100 -s 1 -l 1000 -k 7 -t -e 4.5) ADD_TEST(viterbi_1000_4 viterbi_test -n 100 -s 1 -l 1000 -k 7 -t -e 4.5)
BuildMex(MEXNAME viterbi SOURCES viterbi_test_mex.c LIBRARIES lte_phy liblte_mex) BuildMex(MEXNAME viterbi SOURCES viterbi_test_mex.c LIBRARIES srslte srslte_mex)
######################################################################## ########################################################################
# CRC TEST # CRC TEST
######################################################################## ########################################################################
ADD_EXECUTABLE(crc_test crc_test.c) ADD_EXECUTABLE(crc_test crc_test.c)
TARGET_LINK_LIBRARIES(crc_test lte_phy) TARGET_LINK_LIBRARIES(crc_test srslte)
ADD_TEST(crc_24A crc_test -n 5001 -l 24 -p 0x1864CFB -s 1) ADD_TEST(crc_24A crc_test -n 5001 -l 24 -p 0x1864CFB -s 1)
ADD_TEST(crc_24B crc_test -n 5001 -l 24 -p 0x1800063 -s 1) ADD_TEST(crc_24B crc_test -n 5001 -l 24 -p 0x1800063 -s 1)

@ -24,7 +24,7 @@
######################################################################## ########################################################################
ADD_EXECUTABLE(layermap_test layermap_test.c) ADD_EXECUTABLE(layermap_test layermap_test.c)
TARGET_LINK_LIBRARIES(layermap_test lte_phy) TARGET_LINK_LIBRARIES(layermap_test srslte)
ADD_TEST(layermap_single layermap_test -n 1000 -m single -c 1 -l 1) ADD_TEST(layermap_single layermap_test -n 1000 -m single -c 1 -l 1)
@ -55,7 +55,7 @@ ADD_TEST(layermap_multiplex_28 layermap_test -n 1000 -m multiplex -c 2 -l 8)
######################################################################## ########################################################################
ADD_EXECUTABLE(precoding_test precoding_test.c) ADD_EXECUTABLE(precoding_test precoding_test.c)
TARGET_LINK_LIBRARIES(precoding_test lte_phy) TARGET_LINK_LIBRARIES(precoding_test srslte)
ADD_TEST(precoding_single precoding_test -n 1000 -m single) ADD_TEST(precoding_single precoding_test -n 1000 -m single)
ADD_TEST(precoding_diversity2 precoding_test -n 1000 -m diversity -l 2 -p 2) ADD_TEST(precoding_diversity2 precoding_test -n 1000 -m diversity -l 2 -p 2)

@ -24,7 +24,7 @@
######################################################################## ########################################################################
ADD_EXECUTABLE(modem_test modem_test.c) ADD_EXECUTABLE(modem_test modem_test.c)
TARGET_LINK_LIBRARIES(modem_test lte_phy) TARGET_LINK_LIBRARIES(modem_test srslte)
ADD_TEST(modem_bpsk modem_test -n 1020 -m 1) ADD_TEST(modem_bpsk modem_test -n 1020 -m 1)
ADD_TEST(modem_qpsk modem_test -n 1020 -m 2) ADD_TEST(modem_qpsk modem_test -n 1020 -m 2)
@ -37,7 +37,7 @@ ADD_TEST(modem_qam16_soft modem_test -n 1020 -m 4 -s)
ADD_TEST(modem_qam64_soft modem_test -n 1020 -m 6 -s) ADD_TEST(modem_qam64_soft modem_test -n 1020 -m 6 -s)
ADD_EXECUTABLE(soft_demod_test soft_demod_test.c) ADD_EXECUTABLE(soft_demod_test soft_demod_test.c)
TARGET_LINK_LIBRARIES(soft_demod_test lte_phy) TARGET_LINK_LIBRARIES(soft_demod_test srslte)
ADD_TEST(modem_bpsk_soft_approx soft_demod_test -n 1020 -m 1) ADD_TEST(modem_bpsk_soft_approx soft_demod_test -n 1020 -m 1)
ADD_TEST(modem_qpsk_soft_approx soft_demod_test -n 1020 -m 2) ADD_TEST(modem_qpsk_soft_approx soft_demod_test -n 1020 -m 2)

@ -24,7 +24,7 @@
######################################################################## ########################################################################
ADD_EXECUTABLE(pbch_test pbch_test.c) ADD_EXECUTABLE(pbch_test pbch_test.c)
TARGET_LINK_LIBRARIES(pbch_test lte_phy) TARGET_LINK_LIBRARIES(pbch_test srslte)
ADD_TEST(pbch_test_6 pbch_test -p 1 -n 6 -c 100) ADD_TEST(pbch_test_6 pbch_test -p 1 -n 6 -c 100)
ADD_TEST(pbch_test_62 pbch_test -p 2 -n 6 -c 100) ADD_TEST(pbch_test_62 pbch_test -p 2 -n 6 -c 100)
@ -33,7 +33,7 @@ ADD_TEST(pbch_test_50 pbch_test -p 1 -n 50 -c 50)
ADD_TEST(pbch_test_502 pbch_test -p 2 -n 50 -c 50) ADD_TEST(pbch_test_502 pbch_test -p 2 -n 50 -c 50)
ADD_TEST(pbch_test_504 pbch_test -p 4 -n 50 -c 50) ADD_TEST(pbch_test_504 pbch_test -p 4 -n 50 -c 50)
BuildMex(MEXNAME pbch SOURCES pbch_test_mex.c LIBRARIES lte_phy liblte_mex) BuildMex(MEXNAME pbch SOURCES pbch_test_mex.c LIBRARIES srslte srslte_mex)
######################################################################## ########################################################################
@ -41,7 +41,7 @@ BuildMex(MEXNAME pbch SOURCES pbch_test_mex.c LIBRARIES lte_phy liblte_mex)
######################################################################## ########################################################################
ADD_EXECUTABLE(pcfich_test pcfich_test.c) ADD_EXECUTABLE(pcfich_test pcfich_test.c)
TARGET_LINK_LIBRARIES(pcfich_test lte_phy) TARGET_LINK_LIBRARIES(pcfich_test srslte)
ADD_TEST(pcfich_test_6 pcfich_test -p 1 -n 6) ADD_TEST(pcfich_test_6 pcfich_test -p 1 -n 6)
ADD_TEST(pcfich_test_62 pcfich_test -p 2 -n 6) ADD_TEST(pcfich_test_62 pcfich_test -p 2 -n 6)
@ -50,14 +50,14 @@ ADD_TEST(pcfich_test_10 pcfich_test -p 1 -n 10)
ADD_TEST(pcfich_test_102 pcfich_test -p 2 -n 10) ADD_TEST(pcfich_test_102 pcfich_test -p 2 -n 10)
ADD_TEST(pcfich_test_104 pcfich_test -p 4 -n 10) ADD_TEST(pcfich_test_104 pcfich_test -p 4 -n 10)
BuildMex(MEXNAME pcfich SOURCES pcfich_test_mex.c LIBRARIES lte_phy liblte_mex) BuildMex(MEXNAME pcfich SOURCES pcfich_test_mex.c LIBRARIES srslte srslte_mex)
######################################################################## ########################################################################
# PHICH TEST # PHICH TEST
######################################################################## ########################################################################
ADD_EXECUTABLE(phich_test phich_test.c) ADD_EXECUTABLE(phich_test phich_test.c)
TARGET_LINK_LIBRARIES(phich_test lte_phy) TARGET_LINK_LIBRARIES(phich_test srslte)
ADD_TEST(phich_test_6 phich_test -p 1 -n 6) ADD_TEST(phich_test_6 phich_test -p 1 -n 6)
ADD_TEST(phich_test_62 phich_test -p 2 -n 6) ADD_TEST(phich_test_62 phich_test -p 2 -n 6)
@ -77,48 +77,48 @@ ADD_TEST(phich_test_104 phich_test -p 4 -n 10 -e -l -g 1/2)
######################################################################## ########################################################################
ADD_EXECUTABLE(pdcch_test pdcch_test.c) ADD_EXECUTABLE(pdcch_test pdcch_test.c)
TARGET_LINK_LIBRARIES(pdcch_test lte_phy) TARGET_LINK_LIBRARIES(pdcch_test srslte)
ADD_TEST(pdcch_test pdcch_test) ADD_TEST(pdcch_test pdcch_test)
ADD_EXECUTABLE(dci_unpacking dci_unpacking.c) ADD_EXECUTABLE(dci_unpacking dci_unpacking.c)
TARGET_LINK_LIBRARIES(dci_unpacking lte_phy) TARGET_LINK_LIBRARIES(dci_unpacking srslte)
BuildMex(MEXNAME pdcch SOURCES pdcch_test_mex.c LIBRARIES lte_phy liblte_mex) BuildMex(MEXNAME pdcch SOURCES pdcch_test_mex.c LIBRARIES srslte srslte_mex)
######################################################################## ########################################################################
# PDSCH TEST # PDSCH TEST
######################################################################## ########################################################################
ADD_EXECUTABLE(pdsch_test pdsch_test.c) ADD_EXECUTABLE(pdsch_test pdsch_test.c)
TARGET_LINK_LIBRARIES(pdsch_test lte_phy) TARGET_LINK_LIBRARIES(pdsch_test srslte)
ADD_TEST(pdsch_test_bpsk pdsch_test -l 500 -m 1 -n 50 -r 2) ADD_TEST(pdsch_test_bpsk pdsch_test -l 500 -m 1 -n 50 -r 2)
ADD_TEST(pdsch_test_qpsk pdsch_test -l 1000 -m 2 -n 50 -r 1) ADD_TEST(pdsch_test_qpsk pdsch_test -l 1000 -m 2 -n 50 -r 1)
ADD_TEST(pdsch_test_qam16 pdsch_test -l 50000 -m 4 -n 100) ADD_TEST(pdsch_test_qam16 pdsch_test -l 50000 -m 4 -n 100)
ADD_TEST(pdsch_test_qam64 pdsch_test -l 61664 -m 6 -n 100 -r 0) ADD_TEST(pdsch_test_qam64 pdsch_test -l 61664 -m 6 -n 100 -r 0)
BuildMex(MEXNAME pdsch SOURCES pdsch_test_mex.c LIBRARIES lte_phy liblte_mex) BuildMex(MEXNAME pdsch SOURCES pdsch_test_mex.c LIBRARIES srslte srslte_mex)
BuildMex(MEXNAME dlsch_encode SOURCES dlsch_encode_test_mex.c LIBRARIES lte_phy liblte_mex) BuildMex(MEXNAME dlsch_encode SOURCES dlsch_encode_test_mex.c LIBRARIES srslte srslte_mex)
######################################################################## ########################################################################
# FILE TEST # FILE TEST
######################################################################## ########################################################################
ADD_EXECUTABLE(pbch_file_test pbch_file_test.c) ADD_EXECUTABLE(pbch_file_test pbch_file_test.c)
TARGET_LINK_LIBRARIES(pbch_file_test lte_phy) TARGET_LINK_LIBRARIES(pbch_file_test srslte)
ADD_EXECUTABLE(pcfich_file_test pcfich_file_test.c) ADD_EXECUTABLE(pcfich_file_test pcfich_file_test.c)
TARGET_LINK_LIBRARIES(pcfich_file_test lte_phy) TARGET_LINK_LIBRARIES(pcfich_file_test srslte)
ADD_EXECUTABLE(phich_file_test phich_file_test.c) ADD_EXECUTABLE(phich_file_test phich_file_test.c)
TARGET_LINK_LIBRARIES(phich_file_test lte_phy) TARGET_LINK_LIBRARIES(phich_file_test srslte)
ADD_EXECUTABLE(pdcch_file_test pdcch_file_test.c) ADD_EXECUTABLE(pdcch_file_test pdcch_file_test.c)
TARGET_LINK_LIBRARIES(pdcch_file_test lte_phy) TARGET_LINK_LIBRARIES(pdcch_file_test srslte)
ADD_EXECUTABLE(pdsch_file_test pdsch_file_test.c) ADD_EXECUTABLE(pdsch_file_test pdsch_file_test.c)
TARGET_LINK_LIBRARIES(pdsch_file_test lte_phy) TARGET_LINK_LIBRARIES(pdsch_file_test srslte)
ADD_TEST(pbch_file_test pbch_file_test -i ${CMAKE_CURRENT_SOURCE_DIR}/signal.1.92M.dat) ADD_TEST(pbch_file_test pbch_file_test -i ${CMAKE_CURRENT_SOURCE_DIR}/signal.1.92M.dat)
ADD_TEST(pcfich_file_test pcfich_file_test -c 150 -n 50 -p 2 -i ${CMAKE_CURRENT_SOURCE_DIR}/signal.10M.dat) ADD_TEST(pcfich_file_test pcfich_file_test -c 150 -n 50 -p 2 -i ${CMAKE_CURRENT_SOURCE_DIR}/signal.10M.dat)
@ -131,10 +131,10 @@ ADD_TEST(pdsch_file_test pdsch_file_test -c 1 -f 3 -n 6 -p 1 -i ${CMAKE_CURRENT_
######################################################################## ########################################################################
ADD_EXECUTABLE(pusch_test pusch_test.c) ADD_EXECUTABLE(pusch_test pusch_test.c)
TARGET_LINK_LIBRARIES(pusch_test lte_phy) TARGET_LINK_LIBRARIES(pusch_test srslte)
BuildMex(MEXNAME ulsch_encode SOURCES ulsch_encode_test_mex.c LIBRARIES lte_phy liblte_mex) BuildMex(MEXNAME ulsch_encode SOURCES ulsch_encode_test_mex.c LIBRARIES srslte srslte_mex)
BuildMex(MEXNAME pusch_encode SOURCES pusch_encode_test_mex.c LIBRARIES lte_phy liblte_mex) BuildMex(MEXNAME pusch_encode SOURCES pusch_encode_test_mex.c LIBRARIES srslte srslte_mex)
@ -144,7 +144,7 @@ BuildMex(MEXNAME pusch_encode SOURCES pusch_encode_test_mex.c LIBRARIES lte_phy
######################################################################## ########################################################################
ADD_EXECUTABLE(prach_test prach_test.c) ADD_EXECUTABLE(prach_test prach_test.c)
TARGET_LINK_LIBRARIES(prach_test lte_phy) TARGET_LINK_LIBRARIES(prach_test srslte)
ADD_TEST(prach prach_test) ADD_TEST(prach prach_test)
@ -168,7 +168,7 @@ ADD_TEST(prach_zc2 prach_test -z 2)
ADD_TEST(prach_zc3 prach_test -z 3) ADD_TEST(prach_zc3 prach_test -z 3)
ADD_EXECUTABLE(prach_test_multi prach_test_multi.c) ADD_EXECUTABLE(prach_test_multi prach_test_multi.c)
TARGET_LINK_LIBRARIES(prach_test_multi lte_phy) TARGET_LINK_LIBRARIES(prach_test_multi srslte)
ADD_TEST(prach_test_multi prach_test_multi) ADD_TEST(prach_test_multi prach_test_multi)
@ -178,5 +178,5 @@ ADD_TEST(prach_test_multi_n8 prach_test_multi -n 8)
ADD_TEST(prach_test_multi_n4 prach_test_multi -n 4) ADD_TEST(prach_test_multi_n4 prach_test_multi -n 4)
BuildMex(MEXNAME prach SOURCES prach_test_mex.c LIBRARIES lte_phy liblte_mex) BuildMex(MEXNAME prach SOURCES prach_test_mex.c LIBRARIES srslte srslte_mex)

@ -24,10 +24,10 @@
######################################################################## ########################################################################
ADD_EXECUTABLE(resample_arb_test resample_arb_test.c) ADD_EXECUTABLE(resample_arb_test resample_arb_test.c)
TARGET_LINK_LIBRARIES(resample_arb_test lte_phy) TARGET_LINK_LIBRARIES(resample_arb_test srslte)
ADD_EXECUTABLE(resample_arb_bench resample_arb_bench.c) ADD_EXECUTABLE(resample_arb_bench resample_arb_bench.c)
TARGET_LINK_LIBRARIES(resample_arb_bench lte_phy) TARGET_LINK_LIBRARIES(resample_arb_bench srslte)
ADD_TEST(resample resample_arb_test) ADD_TEST(resample resample_arb_test)

@ -24,7 +24,7 @@
######################################################################## ########################################################################
ADD_EXECUTABLE(scrambling_test scrambling_test.c) ADD_EXECUTABLE(scrambling_test scrambling_test.c)
TARGET_LINK_LIBRARIES(scrambling_test lte_phy) TARGET_LINK_LIBRARIES(scrambling_test srslte)
ADD_TEST(scrambling_pbch_bit scrambling_test -s PBCH -c 50) ADD_TEST(scrambling_pbch_bit scrambling_test -s PBCH -c 50)
ADD_TEST(scrambling_pbch_float scrambling_test -s PBCH -c 50 -f) ADD_TEST(scrambling_pbch_float scrambling_test -s PBCH -c 50 -f)

@ -25,11 +25,14 @@
LIST(FIND OPTIONAL_LIBS cuhd CUHD_FIND) LIST(FIND OPTIONAL_LIBS cuhd CUHD_FIND)
FIND_PACKAGE(LIBSDRGUI)
IF(${CUHD_FIND} GREATER -1) IF(${CUHD_FIND} GREATER -1)
ADD_EXECUTABLE(pss_usrp pss_usrp.c) ADD_EXECUTABLE(pss_usrp pss_usrp.c)
TARGET_LINK_LIBRARIES(pss_usrp lte_phy cuhd) TARGET_LINK_LIBRARIES(pss_usrp srslte cuhd)
IF(LIBSDRGUI_FOUND) IF(LIBSDRGUI_FOUND)
target_link_libraries(pss_usrp graphics) include_directories(${LIBSDRGUI_INCLUDE_DIRS})
target_link_libraries(pss_usrp ${LIBSDRGUI_LIBRARIES})
ELSE(LIBSDRGUI_FOUND) ELSE(LIBSDRGUI_FOUND)
SET_TARGET_PROPERTIES(pss_usrp PROPERTIES COMPILE_DEFINITIONS "DISABLE_GRAPHICS") SET_TARGET_PROPERTIES(pss_usrp PROPERTIES COMPILE_DEFINITIONS "DISABLE_GRAPHICS")
ENDIF(LIBSDRGUI_FOUND) ENDIF(LIBSDRGUI_FOUND)
@ -37,15 +40,15 @@ ENDIF(${CUHD_FIND} GREATER -1)
BuildMex(MEXNAME pss SOURCES pss_mex.c LIBRARIES lte_phy liblte_mex) BuildMex(MEXNAME pss SOURCES pss_mex.c LIBRARIES srslte srslte_mex)
BuildMex(MEXNAME sss SOURCES sss_mex.c LIBRARIES lte_phy liblte_mex) BuildMex(MEXNAME sss SOURCES sss_mex.c LIBRARIES srslte srslte_mex)
######################################################################## ########################################################################
# SYNC TEST # SYNC TEST
######################################################################## ########################################################################
ADD_EXECUTABLE(sync_test sync_test.c) ADD_EXECUTABLE(sync_test sync_test.c)
TARGET_LINK_LIBRARIES(sync_test lte_phy) TARGET_LINK_LIBRARIES(sync_test srslte)
ADD_TEST(sync_test_100 sync_test -o 100 -c 501) ADD_TEST(sync_test_100 sync_test -o 100 -c 501)
ADD_TEST(sync_test_400 sync_test -o 400 -c 2) ADD_TEST(sync_test_400 sync_test -o 400 -c 2)
@ -62,7 +65,7 @@ ADD_TEST(sync_test_400_e sync_test -o 400 -e -p 50 -c 123)
######################################################################## ########################################################################
ADD_EXECUTABLE(cfo_test cfo_test.c) ADD_EXECUTABLE(cfo_test cfo_test.c)
TARGET_LINK_LIBRARIES(cfo_test lte_phy) TARGET_LINK_LIBRARIES(cfo_test srslte)
ADD_TEST(cfo_test_1 cfo_test -f 0.12345 -n 1000) ADD_TEST(cfo_test_1 cfo_test -f 0.12345 -n 1000)
ADD_TEST(cfo_test_2 cfo_test -f 0.99849 -n 1000) ADD_TEST(cfo_test_2 cfo_test -f 0.99849 -n 1000)

@ -346,7 +346,7 @@ cf_t tmpce[SRSLTE_PSS_LEN];
void init_plots() { void init_plots() {
plot_init(); sdrgui_init();
plot_real_init(&pssout); plot_real_init(&pssout);
plot_real_setTitle(&pssout, "PSS xCorr"); plot_real_setTitle(&pssout, "PSS xCorr");
plot_real_setLabels(&pssout, "Index", "Absolute value"); plot_real_setLabels(&pssout, "Index", "Absolute value");

@ -24,7 +24,7 @@
######################################################################## ########################################################################
ADD_EXECUTABLE(dft_test dft_test.c) ADD_EXECUTABLE(dft_test dft_test.c)
TARGET_LINK_LIBRARIES(dft_test lte_phy) TARGET_LINK_LIBRARIES(dft_test srslte)
ADD_TEST(dft_test dft_test) ADD_TEST(dft_test dft_test)
ADD_TEST(dft_reverse dft_test -b) # Backwards first ADD_TEST(dft_reverse dft_test -b) # Backwards first

Loading…
Cancel
Save