From c23445b38af1b0b6b4d8c7feb873a1f018867e59 Mon Sep 17 00:00:00 2001 From: ismagom Date: Thu, 19 Mar 2015 17:09:38 +0100 Subject: [PATCH] Removed graphics dependency and added dependency for libsdrgui. Fixed many cmake bugs after name change --- cmake/modules/BuildMex.cmake | 8 +- cmake/modules/FindQwt.cmake | 152 ------------- cuhd/lib/CMakeLists.txt | 18 +- cuhd/lib/cuhd_imp.cpp | 2 +- graphics/CMakeLists.txt | 48 ----- graphics/include/srslte/graphics/plot.h | 50 ----- .../srslte/graphics/plot/plot_complex.h | 60 ------ .../include/srslte/graphics/plot/plot_real.h | 56 ----- .../srslte/graphics/plot/plot_scatter.h | 55 ----- .../srslte/graphics/plot/plot_waterfall.h | 62 ------ graphics/lib/CMakeLists.txt | 94 --------- graphics/lib/common/Events.cpp | 94 --------- graphics/lib/common/Events.h | 72 ------- graphics/lib/common/Lineplot.cpp | 168 --------------- graphics/lib/common/Lineplot.h | 80 ------- graphics/lib/common/Pointplot.cpp | 121 ----------- graphics/lib/common/Pointplot.h | 76 ------- graphics/lib/common/Spectrogramplot.cpp | 199 ------------------ graphics/lib/common/Spectrogramplot.h | 79 ------- graphics/lib/common/WaterfallData.h | 90 -------- graphics/lib/common/plot.cpp | 66 ------ graphics/lib/complexplot/ComplexWidget.cpp | 195 ----------------- graphics/lib/complexplot/ComplexWidget.h | 53 ----- graphics/lib/complexplot/Complexplot.cpp | 55 ----- graphics/lib/complexplot/Complexplot.h | 53 ----- .../lib/complexplot/ComplexplotWrapper.cpp | 141 ------------- graphics/lib/complexplot/ComplexplotWrapper.h | 48 ----- graphics/lib/complexplot/plot_complex.cpp | 76 ------- graphics/lib/complexplot/test/CMakeLists.txt | 31 --- .../lib/complexplot/test/complexplot_test.cpp | 144 ------------- graphics/lib/realplot/RealWidget.cpp | 100 --------- graphics/lib/realplot/RealWidget.h | 43 ---- graphics/lib/realplot/Realplot.cpp | 58 ----- graphics/lib/realplot/Realplot.h | 46 ---- graphics/lib/realplot/RealplotWrapper.cpp | 147 ------------- graphics/lib/realplot/RealplotWrapper.h | 49 ----- graphics/lib/realplot/plot_real.cpp | 79 ------- graphics/lib/realplot/test/CMakeLists.txt | 31 --- graphics/lib/realplot/test/realplot_test.cpp | 123 ----------- graphics/lib/scatterplot/ScatterWidget.cpp | 100 --------- graphics/lib/scatterplot/ScatterWidget.h | 46 ---- graphics/lib/scatterplot/Scatterplot.cpp | 53 ----- graphics/lib/scatterplot/Scatterplot.h | 46 ---- .../lib/scatterplot/ScatterplotWrapper.cpp | 142 ------------- graphics/lib/scatterplot/ScatterplotWrapper.h | 48 ----- graphics/lib/scatterplot/plot_scatter.cpp | 75 ------- graphics/lib/scatterplot/test/CMakeLists.txt | 30 --- .../lib/scatterplot/test/scatterplot_test.cpp | 126 ----------- .../lib/waterfallplot/WaterfallWidget.cpp | 141 ------------- graphics/lib/waterfallplot/WaterfallWidget.h | 52 ----- graphics/lib/waterfallplot/Waterfallplot.cpp | 80 ------- graphics/lib/waterfallplot/Waterfallplot.h | 49 ----- .../waterfallplot/WaterfallplotWrapper.cpp | 187 ---------------- .../lib/waterfallplot/WaterfallplotWrapper.h | 57 ----- graphics/lib/waterfallplot/plot_waterfall.cpp | 102 --------- .../lib/waterfallplot/test/CMakeLists.txt | 32 --- .../waterfallplot/test/Waterfallplot_test.cpp | 127 ----------- matlab/tests/diversity_test_rate.m | 2 +- matlab/tests/dlsch_test.m | 2 +- matlab/tests/drms_pusch_test.m | 2 +- matlab/tests/equalizer_test.m | 30 +-- matlab/tests/pbch_bler.m | 2 +- matlab/tests/pdcch_bler.m | 18 +- matlab/tests/pdsch_bler.m | 12 +- matlab/tests/prach_test.m | 2 +- matlab/tests/pusch_test.m | 2 +- matlab/tests/rm_turbo_rx_test.m | 4 +- matlab/tests/sss_test.m | 6 +- matlab/tests/sync_test.m | 2 +- matlab/tests/turbodecoder_bler.m | 2 +- matlab/tests/ulsch_test.m | 2 +- matlab/tests/viterbi_bler.m | 2 +- mex/lib/CMakeLists.txt | 6 +- srslte/CMakeLists.txt | 2 +- srslte/examples/CMakeLists.txt | 35 ++- srslte/lib/CMakeLists.txt | 14 +- srslte/lib/ch_estimation/test/CMakeLists.txt | 8 +- srslte/lib/dft/test/CMakeLists.txt | 2 +- srslte/lib/fec/test/CMakeLists.txt | 16 +- srslte/lib/mimo/test/CMakeLists.txt | 4 +- srslte/lib/modem/test/CMakeLists.txt | 4 +- srslte/lib/phch/test/CMakeLists.txt | 44 ++-- srslte/lib/resampling/test/CMakeLists.txt | 4 +- srslte/lib/scrambling/test/CMakeLists.txt | 2 +- srslte/lib/sync/test/CMakeLists.txt | 15 +- srslte/lib/sync/test/pss_usrp.c | 2 +- srslte/lib/utils/test/CMakeLists.txt | 2 +- 87 files changed, 139 insertions(+), 4726 deletions(-) delete mode 100644 cmake/modules/FindQwt.cmake delete mode 100644 graphics/CMakeLists.txt delete mode 100644 graphics/include/srslte/graphics/plot.h delete mode 100644 graphics/include/srslte/graphics/plot/plot_complex.h delete mode 100644 graphics/include/srslte/graphics/plot/plot_real.h delete mode 100644 graphics/include/srslte/graphics/plot/plot_scatter.h delete mode 100644 graphics/include/srslte/graphics/plot/plot_waterfall.h delete mode 100644 graphics/lib/CMakeLists.txt delete mode 100644 graphics/lib/common/Events.cpp delete mode 100644 graphics/lib/common/Events.h delete mode 100644 graphics/lib/common/Lineplot.cpp delete mode 100644 graphics/lib/common/Lineplot.h delete mode 100644 graphics/lib/common/Pointplot.cpp delete mode 100644 graphics/lib/common/Pointplot.h delete mode 100644 graphics/lib/common/Spectrogramplot.cpp delete mode 100644 graphics/lib/common/Spectrogramplot.h delete mode 100644 graphics/lib/common/WaterfallData.h delete mode 100644 graphics/lib/common/plot.cpp delete mode 100644 graphics/lib/complexplot/ComplexWidget.cpp delete mode 100644 graphics/lib/complexplot/ComplexWidget.h delete mode 100644 graphics/lib/complexplot/Complexplot.cpp delete mode 100644 graphics/lib/complexplot/Complexplot.h delete mode 100644 graphics/lib/complexplot/ComplexplotWrapper.cpp delete mode 100644 graphics/lib/complexplot/ComplexplotWrapper.h delete mode 100644 graphics/lib/complexplot/plot_complex.cpp delete mode 100644 graphics/lib/complexplot/test/CMakeLists.txt delete mode 100644 graphics/lib/complexplot/test/complexplot_test.cpp delete mode 100644 graphics/lib/realplot/RealWidget.cpp delete mode 100644 graphics/lib/realplot/RealWidget.h delete mode 100644 graphics/lib/realplot/Realplot.cpp delete mode 100644 graphics/lib/realplot/Realplot.h delete mode 100644 graphics/lib/realplot/RealplotWrapper.cpp delete mode 100644 graphics/lib/realplot/RealplotWrapper.h delete mode 100644 graphics/lib/realplot/plot_real.cpp delete mode 100644 graphics/lib/realplot/test/CMakeLists.txt delete mode 100644 graphics/lib/realplot/test/realplot_test.cpp delete mode 100644 graphics/lib/scatterplot/ScatterWidget.cpp delete mode 100644 graphics/lib/scatterplot/ScatterWidget.h delete mode 100644 graphics/lib/scatterplot/Scatterplot.cpp delete mode 100644 graphics/lib/scatterplot/Scatterplot.h delete mode 100644 graphics/lib/scatterplot/ScatterplotWrapper.cpp delete mode 100644 graphics/lib/scatterplot/ScatterplotWrapper.h delete mode 100644 graphics/lib/scatterplot/plot_scatter.cpp delete mode 100644 graphics/lib/scatterplot/test/CMakeLists.txt delete mode 100644 graphics/lib/scatterplot/test/scatterplot_test.cpp delete mode 100644 graphics/lib/waterfallplot/WaterfallWidget.cpp delete mode 100644 graphics/lib/waterfallplot/WaterfallWidget.h delete mode 100644 graphics/lib/waterfallplot/Waterfallplot.cpp delete mode 100644 graphics/lib/waterfallplot/Waterfallplot.h delete mode 100644 graphics/lib/waterfallplot/WaterfallplotWrapper.cpp delete mode 100644 graphics/lib/waterfallplot/WaterfallplotWrapper.h delete mode 100644 graphics/lib/waterfallplot/plot_waterfall.cpp delete mode 100644 graphics/lib/waterfallplot/test/CMakeLists.txt delete mode 100644 graphics/lib/waterfallplot/test/Waterfallplot_test.cpp diff --git a/cmake/modules/BuildMex.cmake b/cmake/modules/BuildMex.cmake index ed305d31f..7973a18c7 100644 --- a/cmake/modules/BuildMex.cmake +++ b/cmake/modules/BuildMex.cmake @@ -38,24 +38,24 @@ FUNCTION(BuildMex) #target_include_directories(${BuildMex_MEXNAME}-mat PUBLIC ${MATLAB_INCLUDE_DIR}) set_target_properties(${BuildMex_MEXNAME}-mat PROPERTIES SUFFIX "${MATLAB_MEX_EXTENSION}" - PREFIX "liblte_" + PREFIX "srslte_" OUTPUT_NAME "${BuildMex_MEXNAME}" COMPILE_FLAGS "-fvisibility=default ${MATLAB_MEX_CFLAGS} -I${MATLAB_INCLUDE_DIR}" ) 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) if (OCTAVE_FOUND) add_library(${BuildMex_MEXNAME}-oct SHARED ${BuildMex_SOURCES}) #target_include_directories(${BuildMex_MEXNAME}-oct PUBLIC ${OCTAVE_INCLUDE_DIR}) set_target_properties(${BuildMex_MEXNAME}-oct PROPERTIES SUFFIX ".${OCTAVE_MEXFILE_EXT}" - PREFIX "liblte_" + PREFIX "srslte_" OUTPUT_NAME "${BuildMex_MEXNAME}" COMPILE_FLAGS "-fvisibility=default ${OCTAVE_MEX_CFLAGS} -DUNDEF_BOOL -I${OCTAVE_INCLUDE_DIR}" ) 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) ENDFUNCTION(BuildMex) diff --git a/cmake/modules/FindQwt.cmake b/cmake/modules/FindQwt.cmake deleted file mode 100644 index 3ed74cff7..000000000 --- a/cmake/modules/FindQwt.cmake +++ /dev/null @@ -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) - diff --git a/cuhd/lib/CMakeLists.txt b/cuhd/lib/CMakeLists.txt index 8d792d8c0..4973a89ed 100644 --- a/cuhd/lib/CMakeLists.txt +++ b/cuhd/lib/CMakeLists.txt @@ -23,19 +23,19 @@ FIND_PACKAGE(UHD) IF(UHD_FOUND) - ADD_LIBRARY(cuhd SHARED cuhd_imp.cpp cuhd_utils.c) - INCLUDE_DIRECTORIES(${UHD_INCLUDE_DIRS}) - LINK_DIRECTORIES(${UHD_LIBRARY_DIRS}) - TARGET_LINK_LIBRARIES(cuhd ${UHD_LIBRARIES}) + ADD_LIBRARY(cuhd SHARED cuhd_imp.cpp cuhd_utils.c) + INCLUDE_DIRECTORIES(${UHD_INCLUDE_DIRS}) + LINK_DIRECTORIES(${UHD_LIBRARY_DIRS}) + TARGET_LINK_LIBRARIES(cuhd ${UHD_LIBRARIES}) - LIBLTE_SET_PIC(cuhd) - APPEND_INTERNAL_LIST(OPTIONAL_LIBS cuhd) - INSTALL(TARGETS cuhd DESTINATION ${LIBRARY_DIR}) + LIBLTE_SET_PIC(cuhd) + APPEND_INTERNAL_LIST(OPTIONAL_LIBS cuhd) + INSTALL(TARGETS cuhd DESTINATION ${LIBRARY_DIR}) - MESSAGE(STATUS " cuhd UHD C wrapper will be installed.") + MESSAGE(STATUS " cuhd UHD C wrapper will be installed.") ELSE(UHD_FOUND) - MESSAGE(STATUS " UHD driver not found. CUHD library is not generated") + MESSAGE(STATUS " UHD driver not found. CUHD library is not generated") ENDIF(UHD_FOUND) diff --git a/cuhd/lib/cuhd_imp.cpp b/cuhd/lib/cuhd_imp.cpp index 6461df424..d95e13a1b 100644 --- a/cuhd/lib/cuhd_imp.cpp +++ b/cuhd/lib/cuhd_imp.cpp @@ -32,7 +32,7 @@ #include #include "cuhd_handler.hpp" -#include "liblte/cuhd/cuhd.h" +#include "srslte/cuhd/cuhd.h" //#define METADATA_VERBOSE diff --git a/graphics/CMakeLists.txt b/graphics/CMakeLists.txt deleted file mode 100644 index 8bc50c828..000000000 --- a/graphics/CMakeLists.txt +++ /dev/null @@ -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) - diff --git a/graphics/include/srslte/graphics/plot.h b/graphics/include/srslte/graphics/plot.h deleted file mode 100644 index 1c065d07e..000000000 --- a/graphics/include/srslte/graphics/plot.h +++ /dev/null @@ -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 diff --git a/graphics/include/srslte/graphics/plot/plot_complex.h b/graphics/include/srslte/graphics/plot/plot_complex.h deleted file mode 100644 index b67bf1367..000000000 --- a/graphics/include/srslte/graphics/plot/plot_complex.h +++ /dev/null @@ -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 -#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 diff --git a/graphics/include/srslte/graphics/plot/plot_real.h b/graphics/include/srslte/graphics/plot/plot_real.h deleted file mode 100644 index 7ac7a0520..000000000 --- a/graphics/include/srslte/graphics/plot/plot_real.h +++ /dev/null @@ -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 -#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 diff --git a/graphics/include/srslte/graphics/plot/plot_scatter.h b/graphics/include/srslte/graphics/plot/plot_scatter.h deleted file mode 100644 index cf63f03fc..000000000 --- a/graphics/include/srslte/graphics/plot/plot_scatter.h +++ /dev/null @@ -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 -#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 diff --git a/graphics/include/srslte/graphics/plot/plot_waterfall.h b/graphics/include/srslte/graphics/plot/plot_waterfall.h deleted file mode 100644 index 079309c46..000000000 --- a/graphics/include/srslte/graphics/plot/plot_waterfall.h +++ /dev/null @@ -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 -#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 diff --git a/graphics/lib/CMakeLists.txt b/graphics/lib/CMakeLists.txt deleted file mode 100644 index 40a1e4ce5..000000000 --- a/graphics/lib/CMakeLists.txt +++ /dev/null @@ -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) - - - - diff --git a/graphics/lib/common/Events.cpp b/graphics/lib/common/Events.cpp deleted file mode 100644 index 9276e346a..000000000 --- a/graphics/lib/common/Events.cpp +++ /dev/null @@ -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(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(10001); - -ComplexDataEvent::ComplexDataEvent(complex* dataPoints, - int numPoints) - : QEvent(QEvent::Type(type)) -{ - dataPoints_ = new complex[numPoints]; - numPoints_ = numPoints; - memcpy(dataPoints_, dataPoints, numPoints*sizeof(complex)); -} - -ComplexDataEvent::ComplexDataEvent(complex* dataPoints, - int numPoints) - : QEvent(QEvent::Type(type)) -{ - dataPoints_ = new complex[numPoints]; - numPoints_ = numPoints; - - for(int i=0;i(dataPoints[i].real(), - dataPoints[i].imag()); - } -} - -ComplexDataEvent::~ComplexDataEvent() -{ - delete[] dataPoints_; -} diff --git a/graphics/lib/common/Events.h b/graphics/lib/common/Events.h deleted file mode 100644 index c7a8b9c6c..000000000 --- a/graphics/lib/common/Events.h +++ /dev/null @@ -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 -#include - -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* dataPoints, - int numPoints); - ComplexDataEvent(std::complex* dataPoints, - int numPoints); - virtual ~ComplexDataEvent(); - - std::complex* dataPoints_; - int numPoints_; -}; - -#endif // EVENTS_H diff --git a/graphics/lib/common/Lineplot.cpp b/graphics/lib/common/Lineplot.cpp deleted file mode 100644 index 5fec806a9..000000000 --- a/graphics/lib/common/Lineplot.cpp +++ /dev/null @@ -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 - -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;isetAttribute(QwtScaleEngine::Floating,true); - axisScaleEngine(QwtPlot::yLeft)->setAttribute(QwtScaleEngine::Floating,true); - axisScaleEngine(QwtPlot::yRight)->setAttribute(QwtScaleEngine::Floating,true); - - zoomer_ = new MyZoomer(qobject_cast(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;isetRawSamples(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;isetRawSamples(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 -} diff --git a/graphics/lib/common/Lineplot.h b/graphics/lib/common/Lineplot.h deleted file mode 100644 index 745fae126..000000000 --- a/graphics/lib/common/Lineplot.h +++ /dev/null @@ -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 -#include -#include -#include -#include -#include -#include -#include -#include -#include - -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 diff --git a/graphics/lib/common/Pointplot.cpp b/graphics/lib/common/Pointplot.cpp deleted file mode 100644 index aeb7b9098..000000000 --- a/graphics/lib/common/Pointplot.cpp +++ /dev/null @@ -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 - -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(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()); -} diff --git a/graphics/lib/common/Pointplot.h b/graphics/lib/common/Pointplot.h deleted file mode 100644 index 42ed25fb8..000000000 --- a/graphics/lib/common/Pointplot.h +++ /dev/null @@ -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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -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 i) const{return real(i);}}; - struct opImag{double operator()(std::complex i) const{return imag(i);}}; - - double* realPoints_; - double* imagPoints_; - - int numPoints_; - int counter_; -}; - -#endif // POINTPLOT_H diff --git a/graphics/lib/common/Spectrogramplot.cpp b/graphics/lib/common/Spectrogramplot.cpp deleted file mode 100644 index 596f888e0..000000000 --- a/graphics/lib/common/Spectrogramplot.cpp +++ /dev/null @@ -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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#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(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()); -} diff --git a/graphics/lib/common/Spectrogramplot.h b/graphics/lib/common/Spectrogramplot.h deleted file mode 100644 index 157461070..000000000 --- a/graphics/lib/common/Spectrogramplot.h +++ /dev/null @@ -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 -#include -#include -#include -#include -#include -#include -#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 diff --git a/graphics/lib/common/WaterfallData.h b/graphics/lib/common/WaterfallData.h deleted file mode 100644 index 5f7ff613a..000000000 --- a/graphics/lib/common/WaterfallData.h +++ /dev/null @@ -1,90 +0,0 @@ -#ifndef WATERFALLDATA_H -#define WATERFALLDATA_H - -#include -#include -#include -#include -#include -#include -#include - -class WaterfallData - :public QwtRasterData -{ -public: - typedef std::vector Vec; - typedef boost::shared_ptr< std::vector > 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(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;ibegin(),v->end()))); - } - return *(std::max_element(maxVec.begin(),maxVec.end())); - } - - double min() - { - Vec minVec; - for(int i=0;ibegin(),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 diff --git a/graphics/lib/common/plot.cpp b/graphics/lib/common/plot.cpp deleted file mode 100644 index ca4ddc601..000000000 --- a/graphics/lib/common/plot.cpp +++ /dev/null @@ -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 -#include -#include -#include - -pthread_t thread; -static int plot_initiated=0; - -void *qt_thread(void *arg) -{ - int argc = 1; - char* argv[] = { const_cast("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; -} - diff --git a/graphics/lib/complexplot/ComplexWidget.cpp b/graphics/lib/complexplot/ComplexWidget.cpp deleted file mode 100644 index 39646fc37..000000000 --- a/graphics/lib/complexplot/ComplexWidget.cpp +++ /dev/null @@ -1,195 +0,0 @@ -#include "ComplexWidget.h" -#include "Lineplot.h" -#include "Events.h" - -#include -#include - -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); -} diff --git a/graphics/lib/complexplot/ComplexWidget.h b/graphics/lib/complexplot/ComplexWidget.h deleted file mode 100644 index e50dcff76..000000000 --- a/graphics/lib/complexplot/ComplexWidget.h +++ /dev/null @@ -1,53 +0,0 @@ -#ifndef COMPLEXWIDGET_H -#define COMPLEXWIDGET_H - -#include -#include -#include - -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 i) const{return real(i);}}; - struct opImag{double operator()(std::complex i) const{return imag(i);}}; - struct opAbs{double operator()(std::complex i) const{return abs(i);}}; - struct opArg{double operator()(std::complex i) const{return arg(i);}}; - - double* iData_; - double* qData_; - double* mData_; - double* pData_; - int numPoints_; - int timerId_; - bool haveNewData_; -}; - -#endif // COMPLEXWIDGET_H diff --git a/graphics/lib/complexplot/Complexplot.cpp b/graphics/lib/complexplot/Complexplot.cpp deleted file mode 100644 index 6e520214d..000000000 --- a/graphics/lib/complexplot/Complexplot.cpp +++ /dev/null @@ -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* data, int numPoints) -{ - plot_->setNewData(data, numPoints); -} - -void Complexplot::setNewData(complex* 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); -} - diff --git a/graphics/lib/complexplot/Complexplot.h b/graphics/lib/complexplot/Complexplot.h deleted file mode 100644 index 19c1ccee0..000000000 --- a/graphics/lib/complexplot/Complexplot.h +++ /dev/null @@ -1,53 +0,0 @@ -#ifndef COMPLEXPLOT_H -#define COMPLEXPLOT_H - -#include -#include - -class ComplexplotWrapper; - -class Complexplot -{ -public: - enum PlotId - { - I, - Q, - Magnitude, - Phase - }; - Complexplot(); - ~Complexplot(); - - template - void setNewData(Iterator begin, Iterator end); - void setNewData(std::complex* data, int numPoints); - void setNewData(std::complex* 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 -void Complexplot::setNewData(Iterator begin, Iterator end) -{ - int numPoints = end-begin; - std::complex* data = new std::complex[numPoints]; - - for(int i=0;begin!=end;begin++,i++) - { - data[i] = *begin; - } - - setNewData(data, numPoints); - - delete[] data; -} - -#endif // COMPLEXPLOT_H diff --git a/graphics/lib/complexplot/ComplexplotWrapper.cpp b/graphics/lib/complexplot/ComplexplotWrapper.cpp deleted file mode 100644 index abfc819c2..000000000 --- a/graphics/lib/complexplot/ComplexplotWrapper.cpp +++ /dev/null @@ -1,141 +0,0 @@ -#include "ComplexplotWrapper.h" - -#include "ComplexWidget.h" -#include "Events.h" -#include -#include - -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* data, int numPoints) -{ - if(destroyed_) - return; - qApp->postEvent(widget_, new ComplexDataEvent(data, numPoints)); -} - -void ComplexplotWrapper::setNewData(complex* 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); -} - diff --git a/graphics/lib/complexplot/ComplexplotWrapper.h b/graphics/lib/complexplot/ComplexplotWrapper.h deleted file mode 100644 index 2d64c1b11..000000000 --- a/graphics/lib/complexplot/ComplexplotWrapper.h +++ /dev/null @@ -1,48 +0,0 @@ -#ifndef COMPLEXPLOTWRAPPER_H -#define COMPLEXPLOTWRAPPER_H - -#include -#include - -class ComplexWidget; - -class ComplexplotWrapper - : QObject -{ - Q_OBJECT - -public: - ComplexplotWrapper(); - ~ComplexplotWrapper(); - - void setNewData(std::complex* data, int numPoints); - void setNewData(std::complex* 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 diff --git a/graphics/lib/complexplot/plot_complex.cpp b/graphics/lib/complexplot/plot_complex.cpp deleted file mode 100644 index bb1ebc588..000000000 --- a/graphics/lib/complexplot/plot_complex.cpp +++ /dev/null @@ -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 - - -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(*h); - plot->setTitle(title); -} - -void plot_complex_setNewData(plot_complex_t *h, _Complex float *data, - int num_points) { - Complexplot *plot = static_cast(*h); - plot->setNewData(reinterpret_cast*> (data), num_points); -} - - -void plot_complex_setXAxisAutoScale(plot_complex_t *h, plot_complex_id_t id, bool on) { - Complexplot *plot = static_cast(*h); - plot->setXAxisAutoScale(static_cast (id), on); -} - -void plot_complex_setYAxisAutoScale(plot_complex_t *h, plot_complex_id_t id, bool on) { - Complexplot *plot = static_cast(*h); - plot->setYAxisAutoScale(static_cast (id), on); -} - -void plot_complex_setXAxisScale(plot_complex_t *h, plot_complex_id_t id, double xMin, double xMax) { - Complexplot *plot = static_cast(*h); - plot->setXAxisScale(static_cast (id), xMin, xMax); -} - -void plot_complex_setYAxisScale(plot_complex_t *h, plot_complex_id_t id, double yMin, double yMax) { - Complexplot *plot = static_cast(*h); - plot->setYAxisScale(static_cast (id), yMin, yMax); -} - -void plot_complex_setXAxisRange(plot_complex_t *h, double xMin, double xMax) { - Complexplot *plot = static_cast(*h); - plot->setXAxisRange(xMin, xMax); -} diff --git a/graphics/lib/complexplot/test/CMakeLists.txt b/graphics/lib/complexplot/test/CMakeLists.txt deleted file mode 100644 index 214a73f92..000000000 --- a/graphics/lib/complexplot/test/CMakeLists.txt +++ /dev/null @@ -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) - diff --git a/graphics/lib/complexplot/test/complexplot_test.cpp b/graphics/lib/complexplot/test/complexplot_test.cpp deleted file mode 100644 index e3f7f93de..000000000 --- a/graphics/lib/complexplot/test/complexplot_test.cpp +++ /dev/null @@ -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 -#include -#include -#include -#include -#include -#include - -#define PI 3.14159265358979323846 - -using namespace std; - -typedef vector > 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* data = new complex [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* data = new complex [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("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); -} - diff --git a/graphics/lib/realplot/RealWidget.cpp b/graphics/lib/realplot/RealWidget.cpp deleted file mode 100644 index 85b10844d..000000000 --- a/graphics/lib/realplot/RealWidget.cpp +++ /dev/null @@ -1,100 +0,0 @@ -#include "RealWidget.h" -#include "Lineplot.h" -#include "Events.h" - -#include -#include - -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;idataPoints_[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); -} diff --git a/graphics/lib/realplot/RealWidget.h b/graphics/lib/realplot/RealWidget.h deleted file mode 100644 index b03183f20..000000000 --- a/graphics/lib/realplot/RealWidget.h +++ /dev/null @@ -1,43 +0,0 @@ -#ifndef REALWIDGET_H -#define REALWIDGET_H - -#include -#include -#include - -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 diff --git a/graphics/lib/realplot/Realplot.cpp b/graphics/lib/realplot/Realplot.cpp deleted file mode 100644 index 561f71278..000000000 --- a/graphics/lib/realplot/Realplot.cpp +++ /dev/null @@ -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); -} - diff --git a/graphics/lib/realplot/Realplot.h b/graphics/lib/realplot/Realplot.h deleted file mode 100644 index f495cd3c3..000000000 --- a/graphics/lib/realplot/Realplot.h +++ /dev/null @@ -1,46 +0,0 @@ -#ifndef REALPLOT_H -#define REALPLOT_H - -#include - -class RealplotWrapper; - -class Realplot -{ -public: - Realplot(); - ~Realplot(); - - template - 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 -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 diff --git a/graphics/lib/realplot/RealplotWrapper.cpp b/graphics/lib/realplot/RealplotWrapper.cpp deleted file mode 100644 index 975987621..000000000 --- a/graphics/lib/realplot/RealplotWrapper.cpp +++ /dev/null @@ -1,147 +0,0 @@ -#include "RealplotWrapper.h" - -#include "RealWidget.h" -#include "Events.h" -#include -#include - - -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); -} diff --git a/graphics/lib/realplot/RealplotWrapper.h b/graphics/lib/realplot/RealplotWrapper.h deleted file mode 100644 index b5750c609..000000000 --- a/graphics/lib/realplot/RealplotWrapper.h +++ /dev/null @@ -1,49 +0,0 @@ -#ifndef REALPLOTWRAPPER_H -#define REALPLOTWRAPPER_H - -#include - -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 diff --git a/graphics/lib/realplot/plot_real.cpp b/graphics/lib/realplot/plot_real.cpp deleted file mode 100644 index 7766f4515..000000000 --- a/graphics/lib/realplot/plot_real.cpp +++ /dev/null @@ -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 - - -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(*h); - plot->setTitle(title); -} -void plot_real_setNewData(plot_real_t *h, float *data, - int num_points) { - Realplot *plot = static_cast(*h); - plot->setNewData(data, num_points); - -} - -void plot_real_setXAxisAutoScale(plot_real_t *h, bool on) { - Realplot *plot = static_cast(*h); - plot->setXAxisAutoScale(on); -} - -void plot_real_setYAxisAutoScale(plot_real_t *h, bool on) { - Realplot *plot = static_cast(*h); - plot->setYAxisAutoScale(on); -} - -void plot_real_setXAxisScale(plot_real_t *h, double xMin, double xMax) { - Realplot *plot = static_cast(*h); - plot->setXAxisScale(xMin, xMax); -} - -void plot_real_setYAxisScale(plot_real_t *h, double yMin, double yMax) { - Realplot *plot = static_cast(*h); - plot->setYAxisScale(yMin, yMax); -} - -void plot_real_setXAxisRange(plot_real_t *h, double xMin, double xMax) { - Realplot *plot = static_cast(*h); - plot->setXAxisRange(xMin, xMax); -} - -void plot_real_setLabels(plot_real_t *h, char *xLabel, char *yLabel) { - Realplot *plot = static_cast(*h); - plot->setLabels(xLabel, yLabel); -} diff --git a/graphics/lib/realplot/test/CMakeLists.txt b/graphics/lib/realplot/test/CMakeLists.txt deleted file mode 100644 index 3168de705..000000000 --- a/graphics/lib/realplot/test/CMakeLists.txt +++ /dev/null @@ -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) - diff --git a/graphics/lib/realplot/test/realplot_test.cpp b/graphics/lib/realplot/test/realplot_test.cpp deleted file mode 100644 index 111d07de6..000000000 --- a/graphics/lib/realplot/test/realplot_test.cpp +++ /dev/null @@ -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 -#include -#include -#include -#include -#include -#include - -typedef std::vector FloatVec; - -template -void getPoints(T* data, int numPoints) { - for (int i = 0; i < numPoints; i++) { - data[i] = 10 * ((T) rand() / RAND_MAX); - } -} - -template -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("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); -} diff --git a/graphics/lib/scatterplot/ScatterWidget.cpp b/graphics/lib/scatterplot/ScatterWidget.cpp deleted file mode 100644 index f3f3542a6..000000000 --- a/graphics/lib/scatterplot/ScatterWidget.cpp +++ /dev/null @@ -1,100 +0,0 @@ -#include "ScatterWidget.h" -#include "Pointplot.h" -#include "Events.h" - -#include -#include - -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); -} diff --git a/graphics/lib/scatterplot/ScatterWidget.h b/graphics/lib/scatterplot/ScatterWidget.h deleted file mode 100644 index 1acc7904c..000000000 --- a/graphics/lib/scatterplot/ScatterWidget.h +++ /dev/null @@ -1,46 +0,0 @@ -#ifndef SCATTERWIDGET_H -#define SCATTERWIDGET_H - -#include -#include -#include - -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 i) const{return real(i);}}; - struct opImag{double operator()(std::complex i) const{return imag(i);}}; - - double* iData_; - double* qData_; - int numPoints_; - int timerId_; - bool haveNewData_; -}; - -#endif // SCATTERWIDGET_H diff --git a/graphics/lib/scatterplot/Scatterplot.cpp b/graphics/lib/scatterplot/Scatterplot.cpp deleted file mode 100644 index 343435cc8..000000000 --- a/graphics/lib/scatterplot/Scatterplot.cpp +++ /dev/null @@ -1,53 +0,0 @@ -#include "Scatterplot.h" -#include "ScatterplotWrapper.h" - -Scatterplot::Scatterplot() -{ - plot_ = new ScatterplotWrapper; -} - -Scatterplot::~Scatterplot() -{ - delete plot_; -} - -void Scatterplot::setNewData(std::complex* data, int numPoints) -{ - plot_->setNewData(data, numPoints); -} - -void Scatterplot::setNewData(std::complex* 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); -} - diff --git a/graphics/lib/scatterplot/Scatterplot.h b/graphics/lib/scatterplot/Scatterplot.h deleted file mode 100644 index 5aadf8d82..000000000 --- a/graphics/lib/scatterplot/Scatterplot.h +++ /dev/null @@ -1,46 +0,0 @@ -#ifndef SCATTERPLOT_H -#define SCATTERPLOT_H - -#include -#include -#include "srslte/config.h" - -class ScatterplotWrapper; - -class Scatterplot -{ -public: - Scatterplot(); - ~Scatterplot(); - - template - void setNewData(Iterator begin, Iterator end); - void setNewData(std::complex* data, int numPoints); - void setNewData(std::complex* 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 void Scatterplot::setNewData(Iterator begin, Iterator end) -{ - int numPoints = end-begin; - std::complex* data = new std::complex[numPoints]; - - for(int i=0;begin!=end;begin++,i++) - { - data[i] = *begin; - } - - setNewData(data, numPoints); - - delete[] data; -} - -#endif // SCATTERPLOT_H diff --git a/graphics/lib/scatterplot/ScatterplotWrapper.cpp b/graphics/lib/scatterplot/ScatterplotWrapper.cpp deleted file mode 100644 index 35e7b8238..000000000 --- a/graphics/lib/scatterplot/ScatterplotWrapper.cpp +++ /dev/null @@ -1,142 +0,0 @@ -#include "ScatterplotWrapper.h" - -#include "ScatterWidget.h" -#include "Events.h" -#include -#include -#include - -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* data, int numPoints) -{ - if(destroyed_) - return; - qApp->postEvent(widget_, new ComplexDataEvent(data, numPoints)); -} - -void ScatterplotWrapper::setNewData(complex* 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); -} - diff --git a/graphics/lib/scatterplot/ScatterplotWrapper.h b/graphics/lib/scatterplot/ScatterplotWrapper.h deleted file mode 100644 index e8b72a936..000000000 --- a/graphics/lib/scatterplot/ScatterplotWrapper.h +++ /dev/null @@ -1,48 +0,0 @@ -#ifndef SCATTERPLOTWRAPPER_H -#define SCATTERPLOTWRAPPER_H - -#include -#include - -class ScatterWidget; - -class ScatterplotWrapper - : QObject -{ - Q_OBJECT - -public: - ScatterplotWrapper(); - ~ScatterplotWrapper(); - - void setNewData(std::complex* data, int numPoints); - void setNewData(std::complex* 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 diff --git a/graphics/lib/scatterplot/plot_scatter.cpp b/graphics/lib/scatterplot/plot_scatter.cpp deleted file mode 100644 index 5062c3960..000000000 --- a/graphics/lib/scatterplot/plot_scatter.cpp +++ /dev/null @@ -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 - - - -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(*h); - plot->setTitle(title); -} -void plot_scatter_setNewData(plot_scatter_t *h, _Complex float *data, - int num_points) { - Scatterplot *plot = static_cast(*h); - plot->setNewData(reinterpret_cast*> (data), num_points); - -} - -void plot_scatter_setXAxisAutoScale(plot_scatter_t *h, bool on) { - Scatterplot *plot = static_cast(*h); - plot->setXAxisAutoScale(on); -} - -void plot_scatter_setYAxisAutoScale(plot_scatter_t *h, bool on) { - Scatterplot *plot = static_cast(*h); - plot->setYAxisAutoScale(on); -} - -void plot_scatter_setXAxisScale(plot_scatter_t *h, double xMin, double xMax) { - Scatterplot *plot = static_cast(*h); - plot->setXAxisScale(xMin, xMax); -} - -void plot_scatter_setYAxisScale(plot_scatter_t *h, double yMin, double yMax) { - Scatterplot *plot = static_cast(*h); - plot->setYAxisScale(yMin, yMax); -} - -void plot_scatter_setAxisLabels(plot_scatter_t *h, char *xLabel, char *yLabel) { - Scatterplot *plot = static_cast(*h); - plot->setAxisLabels(xLabel, yLabel); -} diff --git a/graphics/lib/scatterplot/test/CMakeLists.txt b/graphics/lib/scatterplot/test/CMakeLists.txt deleted file mode 100644 index 9b373bca8..000000000 --- a/graphics/lib/scatterplot/test/CMakeLists.txt +++ /dev/null @@ -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) - diff --git a/graphics/lib/scatterplot/test/scatterplot_test.cpp b/graphics/lib/scatterplot/test/scatterplot_test.cpp deleted file mode 100644 index fcc104b7c..000000000 --- a/graphics/lib/scatterplot/test/scatterplot_test.cpp +++ /dev/null @@ -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 -#include -#include -#include -#include -#include -#include - -typedef std::complex Cplx; -typedef std::vector CplxVec; - -template -void getPoints(std::complex* data, int numPoints) { - for (int i = 0; i < numPoints; i++) { - data[i] = std::complex(2 * ((T) rand() / RAND_MAX) - 1, - 2 * ((T) rand() / RAND_MAX) - 1); - } -} - -template -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 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 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("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); -} diff --git a/graphics/lib/waterfallplot/WaterfallWidget.cpp b/graphics/lib/waterfallplot/WaterfallWidget.cpp deleted file mode 100644 index 89846f04b..000000000 --- a/graphics/lib/waterfallplot/WaterfallWidget.cpp +++ /dev/null @@ -1,141 +0,0 @@ -#include "WaterfallWidget.h" -#include "Spectrogramplot.h" -#include "Lineplot.h" -#include "Events.h" - -#include -#include -#include - -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; -} diff --git a/graphics/lib/waterfallplot/WaterfallWidget.h b/graphics/lib/waterfallplot/WaterfallWidget.h deleted file mode 100644 index 63f2c9a71..000000000 --- a/graphics/lib/waterfallplot/WaterfallWidget.h +++ /dev/null @@ -1,52 +0,0 @@ -#ifndef WATERFALLWIDGET_H -#define WATERFALLWIDGET_H - -#include -#include -#include - -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 diff --git a/graphics/lib/waterfallplot/Waterfallplot.cpp b/graphics/lib/waterfallplot/Waterfallplot.cpp deleted file mode 100644 index 64c0d96e3..000000000 --- a/graphics/lib/waterfallplot/Waterfallplot.cpp +++ /dev/null @@ -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); -} - diff --git a/graphics/lib/waterfallplot/Waterfallplot.h b/graphics/lib/waterfallplot/Waterfallplot.h deleted file mode 100644 index f87bb84c0..000000000 --- a/graphics/lib/waterfallplot/Waterfallplot.h +++ /dev/null @@ -1,49 +0,0 @@ -#ifndef WATERFALLPLOT_H -#define WATERFALLPLOT_H - -#include - -class WaterfallplotWrapper; - -class Waterfallplot -{ -public: - Waterfallplot(int numDataPoints, int numRows); - ~Waterfallplot(); - - template - 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 -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 diff --git a/graphics/lib/waterfallplot/WaterfallplotWrapper.cpp b/graphics/lib/waterfallplot/WaterfallplotWrapper.cpp deleted file mode 100644 index 05b7281f0..000000000 --- a/graphics/lib/waterfallplot/WaterfallplotWrapper.cpp +++ /dev/null @@ -1,187 +0,0 @@ -#include "WaterfallplotWrapper.h" - -#include "WaterfallWidget.h" -#include "Events.h" -#include -#include - -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); -} diff --git a/graphics/lib/waterfallplot/WaterfallplotWrapper.h b/graphics/lib/waterfallplot/WaterfallplotWrapper.h deleted file mode 100644 index 119175047..000000000 --- a/graphics/lib/waterfallplot/WaterfallplotWrapper.h +++ /dev/null @@ -1,57 +0,0 @@ -#ifndef WATERFALLPLOTWRAPPER_H -#define WATERFALLPLOTWRAPPER_H - -#include - -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 diff --git a/graphics/lib/waterfallplot/plot_waterfall.cpp b/graphics/lib/waterfallplot/plot_waterfall.cpp deleted file mode 100644 index ed2d3b693..000000000 --- a/graphics/lib/waterfallplot/plot_waterfall.cpp +++ /dev/null @@ -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 - - -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(*h); - plot->setTitle(title); -} - -void plot_waterfall_appendNewData(plot_waterfall_t *h, float *data, - int num_points) { - Waterfallplot *plot = static_cast(*h); - plot->appendNewData(data, num_points); -} - -void plot_complex_setPlotXLabel(plot_waterfall_t *h, char *xLabel) { - Waterfallplot *plot = static_cast(*h); - plot->setPlotXLabel(xLabel); -} - -void plot_complex_setPlotYLabel(plot_waterfall_t *h, char *yLabel) { - Waterfallplot *plot = static_cast(*h); - plot->setPlotXLabel(yLabel); -} - -void plot_waterfall_setPlotXAxisRange(plot_waterfall_t *h, double xMin, double xMax) { - Waterfallplot *plot = static_cast(*h); - plot->setPlotXAxisRange(xMin, xMax); -} - -void plot_waterfall_setPlotXAxisScale(plot_waterfall_t *h, double xMin, double xMax) { - Waterfallplot *plot = static_cast(*h); - plot->setPlotXAxisScale(xMin, xMax); -} - -void plot_waterfall_setPlotYAxisScale(plot_waterfall_t *h, double yMin, double yMax) { - Waterfallplot *plot = static_cast(*h); - plot->setPlotYAxisScale(yMin, yMax); -} - - -void plot_waterfall_setSpectrogramXLabel(plot_waterfall_t *h, char* xLabel) { - Waterfallplot *plot = static_cast(*h); - plot->setSpectrogramXLabel(xLabel); -} - -void plot_waterfall_setSpectrogramYLabel(plot_waterfall_t *h, char* yLabel) { - Waterfallplot *plot = static_cast(*h); - plot->setSpectrogramYLabel(yLabel); -} - -void plot_waterfall_setSpectrogramXAxisRange(plot_waterfall_t *h, double xMin, double xMax) { - Waterfallplot *plot = static_cast(*h); - plot->setSpectrogramXAxisRange(xMin, xMax); -} - -void plot_waterfall_setSpectrogramYAxisRange(plot_waterfall_t *h, double yMin, double yMax) { - Waterfallplot *plot = static_cast(*h); - plot->setSpectrogramYAxisRange(yMin, yMax); -} - -void plot_waterfall_setSpectrogramZAxisScale(plot_waterfall_t *h, double zMin, double zMax) { - Waterfallplot *plot = static_cast(*h); - plot->setSpectrogramZAxisScale(zMin, zMax); -} - diff --git a/graphics/lib/waterfallplot/test/CMakeLists.txt b/graphics/lib/waterfallplot/test/CMakeLists.txt deleted file mode 100644 index 3f5a2dfe3..000000000 --- a/graphics/lib/waterfallplot/test/CMakeLists.txt +++ /dev/null @@ -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) - diff --git a/graphics/lib/waterfallplot/test/Waterfallplot_test.cpp b/graphics/lib/waterfallplot/test/Waterfallplot_test.cpp deleted file mode 100644 index 6be65f77a..000000000 --- a/graphics/lib/waterfallplot/test/Waterfallplot_test.cpp +++ /dev/null @@ -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 -#include -#include -#include -#include -#include -#include - -#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 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("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); - -} diff --git a/matlab/tests/diversity_test_rate.m b/matlab/tests/diversity_test_rate.m index 0cefaca5a..87e8f2f8d 100644 --- a/matlab/tests/diversity_test_rate.m +++ b/matlab/tests/diversity_test_rate.m @@ -194,7 +194,7 @@ parfor index = 1:numel(SNRdB) rxSubframe); 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)); diff --git a/matlab/tests/dlsch_test.m b/matlab/tests/dlsch_test.m index f07bbbe6a..1af1e1b1f 100644 --- a/matlab/tests/dlsch_test.m +++ b/matlab/tests/dlsch_test.m @@ -13,7 +13,7 @@ for i=1:length(TBs) %trblkin=[1, 0]; [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))); end diff --git a/matlab/tests/drms_pusch_test.m b/matlab/tests/drms_pusch_test.m index ec1237f75..84848315f 100644 --- a/matlab/tests/drms_pusch_test.m +++ b/matlab/tests/drms_pusch_test.m @@ -28,7 +28,7 @@ for prb=4 subframe_mat = lteULResourceGrid(ueConfig); 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(:))); disp(error(k)) diff --git a/matlab/tests/equalizer_test.m b/matlab/tests/equalizer_test.m index f093d532c..2c82cdd16 100644 --- a/matlab/tests/equalizer_test.m +++ b/matlab/tests/equalizer_test.m @@ -12,7 +12,7 @@ Nrealizations=1 ; preEVM = zeros(length(SNR_values_db),Nrealizations); postEVM_mmse = 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 @@ -152,25 +152,25 @@ addpath('../../debug/lte/phy/lib/ch_estimation/test') %% Channel Estimation [estChannel, noiseEst(snr_idx)] = lteDLChannelEstimate(enb,cec,rxGrid); output=[]; -snrest_liblte = zeros(10,1); -noise_liblte = zeros(10,1); +snrest_srslte = zeros(10,1); +noise_srslte = zeros(10,1); rsrp = zeros(1,10); 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]; end RSRP = [RSRP rsrp]; meanRSRP(snr_idx)=mean(rsrp); -SNR_liblte(snr_idx)=mean(snrest_liblte); -noiseEst_liblte(snr_idx)=mean(noise_liblte); +SNR_srslte(snr_idx)=mean(snrest_srslte); +noiseEst_srslte(snr_idx)=mean(noise_srslte); if ~plot_noise_estimation_only %% MMSE Equalization eqGrid_mmse = lteEqualizeMMSE(rxGrid, estChannel, noiseEst(snr_idx)); - eqGrid_liblte = reshape(output,size(eqGrid_mmse)); + eqGrid_srslte = reshape(output,size(eqGrid_mmse)); % Analysis @@ -185,13 +185,13 @@ if ~plot_noise_estimation_only fprintf('%d-%d: MMSE: %0.3f%%\n', ... snr_idx,nreal,postEqualisedEVM_mmse.RMS*100); - postEqualisedEVM_liblte = lteEVM(txGrid,reshape(eqGrid_liblte,size(txGrid))); - fprintf('%d-%d: liblte: %0.3f%%\n', ... - snr_idx,nreal,postEqualisedEVM_liblte.RMS*100); + postEqualisedEVM_srslte = lteEVM(txGrid,reshape(eqGrid_srslte,size(txGrid))); + fprintf('%d-%d: srslte: %0.3f%%\n', ... + snr_idx,nreal,postEqualisedEVM_srslte.RMS*100); preEVM(snr_idx,nreal) = preEqualisedEVM.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 @@ -201,8 +201,8 @@ end if ~plot_noise_estimation_only plot(SNR_values_db, mean(preEVM,2), ... SNR_values_db, mean(postEVM_mmse,2), ... - SNR_values_db, mean(postEVM_liblte,2)) - legend('No Eq','MMSE-lin','MMSE-liblte') + SNR_values_db, mean(postEVM_srslte,2)) + legend('No Eq','MMSE-lin','MMSE-srslte') grid on end @@ -211,11 +211,11 @@ if plot_noise_estimation_only SNR_matlab = 1./(noiseEst*sqrt(2.0)*enb.CellRefP); 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') 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') subplot(1,3,3) diff --git a/matlab/tests/pbch_bler.m b/matlab/tests/pbch_bler.m index 59693eb85..e68e3fc8d 100644 --- a/matlab/tests/pbch_bler.m +++ b/matlab/tests/pbch_bler.m @@ -79,7 +79,7 @@ for snr_idx=1:length(SNR_values_db) errorReal(i,1)=1; 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) errorReal(i,2)=1; end diff --git a/matlab/tests/pdcch_bler.m b/matlab/tests/pdcch_bler.m index dba19332e..2964100f3 100644 --- a/matlab/tests/pdcch_bler.m +++ b/matlab/tests/pdcch_bler.m @@ -99,8 +99,8 @@ addpath('../../debug/lte/phy/lib/phch/test') decoded = zeros(size(SNR_values)); decoded_cfi = zeros(size(SNR_values)); -decoded_liblte = zeros(size(SNR_values)); -decoded_cfi_liblte = zeros(size(SNR_values)); +decoded_srslte = zeros(size(SNR_values)); +decoded_cfi_srslte = zeros(size(SNR_values)); parfor snr_idx=1:length(SNR_values) SNRdB = SNR_values(snr_idx); @@ -145,11 +145,11 @@ parfor snr_idx=1:length(SNR_values) %% Same with srsLTE - [rxCFI, pcfichSymbols2, pcfichSymbolsRx2] = liblte_pcfich(enbConfigRx, rxWaveform); - decoded_cfi_liblte(snr_idx) = decoded_cfi_liblte(snr_idx) + (rxCFI == txCFI); + [rxCFI, pcfichSymbols2, pcfichSymbolsRx2] = srslte_pcfich(enbConfigRx, rxWaveform); + decoded_cfi_srslte(snr_idx) = decoded_cfi_srslte(snr_idx) + (rxCFI == txCFI); enbConfigRx.CFI = rxCFI; - [found_liblte, llr, pdcchSymbols2] = liblte_pdcch(enbConfigRx, ueConfig.RNTI, rxWaveform); - decoded_liblte(snr_idx) = decoded_liblte(snr_idx)+found_liblte; + [found_srslte, llr, pdcchSymbols2] = srslte_pdcch(enbConfigRx, ueConfig.RNTI, rxWaveform); + decoded_srslte(snr_idx) = decoded_srslte(snr_idx)+found_srslte; end fprintf('SNR: %.1f\n',SNRdB) end @@ -157,8 +157,8 @@ end if (Npackets>1) semilogy(SNR_values,1-decoded/Npackets,'bo-',... SNR_values,1-decoded_cfi/Npackets,'bx:',... - SNR_values,1-decoded_liblte/Npackets, 'ro-',... - SNR_values,1-decoded_cfi_liblte/Npackets,'rx:') + SNR_values,1-decoded_srslte/Npackets, 'ro-',... + SNR_values,1-decoded_cfi_srslte/Npackets,'rx:') grid on legend('Matlab all','Matlab cfi', 'srsLTE all', 'srsLTE cfi') xlabel('SNR (dB)') @@ -166,6 +166,6 @@ if (Npackets>1) axis([min(SNR_values) max(SNR_values) 1/Npackets/10 1]) else disp(decoded) - disp(decoded_liblte) + disp(decoded_srslte) end diff --git a/matlab/tests/pdsch_bler.m b/matlab/tests/pdsch_bler.m index 49946c9fd..a5b83266b 100644 --- a/matlab/tests/pdsch_bler.m +++ b/matlab/tests/pdsch_bler.m @@ -54,7 +54,7 @@ cec.InterpWinSize = 1; % Interpolation window size addpath('../../debug/lte/phy/lib/phch/test') decoded = zeros(size(SNR_values)); -decoded_liblte = zeros(size(SNR_values)); +decoded_srslte = zeros(size(SNR_values)); for snr_idx=1:length(SNR_values) SNRdB = SNR_values(snr_idx); @@ -96,25 +96,25 @@ for snr_idx=1:length(SNR_values) %% Same with srsLTE 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), ... subframe_waveform); else dec2 = 1; end - decoded_liblte(snr_idx) = decoded_liblte(snr_idx)+dec2; + decoded_srslte(snr_idx) = decoded_srslte(snr_idx)+dec2; end if ~isempty(recordedSignal) recordedSignal = recordedSignal(flen*10+1: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 if (length(SNR_values)>1) 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; legend('Matlab','srsLTE') xlabel('SNR (dB)') @@ -122,6 +122,6 @@ if (length(SNR_values)>1) axis([min(SNR_values) max(SNR_values) 1/Npackets/(Nsf+1) 1]) else disp(decoded) - disp(decoded_liblte) + disp(decoded_srslte) end diff --git a/matlab/tests/prach_test.m b/matlab/tests/prach_test.m index a9a5652ac..5fbee677e 100644 --- a/matlab/tests/prach_test.m +++ b/matlab/tests/prach_test.m @@ -24,7 +24,7 @@ for n_rb=1:length(NULRB) prachConfig.HighSpeed=hs; prachConfig.FreqIdx=5; prachConfig.FreqOffest=5; - lib=liblte_prach(ueConfig,prachConfig); + lib=srslte_prach(ueConfig,prachConfig); [mat, info]=ltePRACH(ueConfig,prachConfig); err=mean(abs(mat(:)-lib(1:length(mat)))); diff --git a/matlab/tests/pusch_test.m b/matlab/tests/pusch_test.m index b10e833b2..4eb4bce5f 100644 --- a/matlab/tests/pusch_test.m +++ b/matlab/tests/pusch_test.m @@ -51,7 +51,7 @@ for i=1:length(TBs) subframe_mat(idx)=cw_mat; 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)); if (err > 10^-6) disp(err) diff --git a/matlab/tests/rm_turbo_rx_test.m b/matlab/tests/rm_turbo_rx_test.m index c25ad3199..4a014189d 100644 --- a/matlab/tests/rm_turbo_rx_test.m +++ b/matlab/tests/rm_turbo_rx_test.m @@ -26,8 +26,8 @@ for i=1:length(trBlkLenVec) mat2 = reshape(reshape(mat{1},[],3)',[],1); out = lteTurboDecode(mat{1}); - lib=liblte_srslte_rm_turbo_rx(double(codeword),trBlkLen,RV); - [outLib] = liblte_turbodecoder(lib); + lib=srslte_srslte_rm_turbo_rx(double(codeword),trBlkLen,RV); + [outLib] = srslte_turbodecoder(lib); 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)); diff --git a/matlab/tests/sss_test.m b/matlab/tests/sss_test.m index 8d3d9377e..f9d4beb83 100644 --- a/matlab/tests/sss_test.m +++ b/matlab/tests/sss_test.m @@ -112,15 +112,15 @@ for snr_idx=1:length(SNR_values) error(3,snr_idx) = error(3,snr_idx) + ((idx ~= m0 && idx ~= m1)); % 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); 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); 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); error(6,snr_idx) = error(6,snr_idx) + ((idx ~= m0 && idx ~= m1)); diff --git a/matlab/tests/sync_test.m b/matlab/tests/sync_test.m index 005b20b67..c1e33d782 100644 --- a/matlab/tests/sync_test.m +++ b/matlab/tests/sync_test.m @@ -26,7 +26,7 @@ for snr_idx=1:length(SNR_values) noise = N0*complex(randn(size(tx)), randn(size(tx))); % Generate noise rx=noise+tx; [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 diff(snr_idx)=sum(abs(rx_offset-tx_offset)); diff_lt(snr_idx)=sum(abs(rx_offset_lt-tx_offset)); diff --git a/matlab/tests/turbodecoder_bler.m b/matlab/tests/turbodecoder_bler.m index 0736c0a50..20bcb888c 100644 --- a/matlab/tests/turbodecoder_bler.m +++ b/matlab/tests/turbodecoder_bler.m @@ -28,7 +28,7 @@ for snr_idx=1:length(SNR_values_db) decodedData = lteTurboDecode(noisysymbols); interleavedSymbols = reshape(reshape(noisysymbols,[],3)',1,[]); - [decodedData2] = liblte_turbodecoder(interleavedSymbols); + [decodedData2] = srslte_turbodecoder(interleavedSymbols); errors1(snr_idx) = errors1(snr_idx) + any(decodedData ~= Data); errors2(snr_idx) = errors2(snr_idx) + any(decodedData2 ~= Data); diff --git a/matlab/tests/ulsch_test.m b/matlab/tests/ulsch_test.m index fec74586c..53c0d8d25 100644 --- a/matlab/tests/ulsch_test.m +++ b/matlab/tests/ulsch_test.m @@ -42,7 +42,7 @@ for i=1:length(TBs) [mat, info]=lteULSCH(ueConfig,puschConfig,trblkin,ones(1,cqilen(c)),ri_bit,ack_bit,[]); mat(mat==-2)=2; 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))); if (err > 0) disp(err) diff --git a/matlab/tests/viterbi_bler.m b/matlab/tests/viterbi_bler.m index f2a74dfdb..2c27d9ee5 100644 --- a/matlab/tests/viterbi_bler.m +++ b/matlab/tests/viterbi_bler.m @@ -28,7 +28,7 @@ for snr_idx=1:length(SNR_values_db) decodedData = lteConvolutionalDecode(noisysymbols); 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); errors2(snr_idx) = errors2(snr_idx) + any(decodedData2 ~= Data); diff --git a/mex/lib/CMakeLists.txt b/mex/lib/CMakeLists.txt index cf9c6dcc8..896b51709 100644 --- a/mex/lib/CMakeLists.txt +++ b/mex/lib/CMakeLists.txt @@ -46,9 +46,9 @@ ENDIF(OCTAVE_FOUND) IF (MATLAB_FOUND OR OCTAVE_FOUND) - ADD_LIBRARY(liblte_mex SHARED mexutils.c) - INSTALL(TARGETS liblte_mex DESTINATION ${LIBRARY_DIR}) - LIBLTE_SET_PIC(liblte_mex) + ADD_LIBRARY(srslte_mex SHARED mexutils.c) + INSTALL(TARGETS srslte_mex DESTINATION ${LIBRARY_DIR}) + LIBLTE_SET_PIC(srslte_mex) if (MATLAB_FOUND) include_directories(${MATLAB_INCLUDE_DIR}) endif(MATLAB_FOUND) diff --git a/srslte/CMakeLists.txt b/srslte/CMakeLists.txt index 4a5379480..30f978d66 100644 --- a/srslte/CMakeLists.txt +++ b/srslte/CMakeLists.txt @@ -39,7 +39,7 @@ FOREACH (_header ${headers}) LIST(APPEND HEADERS_ALL ${tmp}) ENDIF(IS_DIRECTORY ${_header}) ENDFOREACH() -ADD_CUSTOM_TARGET (add_lte_phy_headers SOURCES ${HEADERS_ALL}) +ADD_CUSTOM_TARGET (add_srslte_headers SOURCES ${HEADERS_ALL}) ######################################################################## # Add subdirectories diff --git a/srslte/examples/CMakeLists.txt b/srslte/examples/CMakeLists.txt index 95b5be5e5..8c41a79bd 100644 --- a/srslte/examples/CMakeLists.txt +++ b/srslte/examples/CMakeLists.txt @@ -25,10 +25,10 @@ ################################################################# 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) -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) -target_link_libraries(synch_file lte_phy) +target_link_libraries(synch_file srslte) 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 ################################################################# 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) -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) SET_TARGET_PROPERTIES(pdsch_ue 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) 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_enodeb PROPERTIES COMPILE_DEFINITIONS "DISABLE_GRAPHICS") -ELSE(${GRAPHICS_FIND} EQUAL -1) - target_link_libraries(pdsch_ue graphics) - target_link_libraries(pdsch_enodeb graphics) -ENDIF(${GRAPHICS_FIND} EQUAL -1) +ENDIF(LIBSDRGUI_FOUND) ################################################################# @@ -81,13 +78,13 @@ ENDIF(${GRAPHICS_FIND} EQUAL -1) IF(${CUHD_FIND} GREATER -1) 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) - 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) - target_link_libraries(cell_measurement cuhd lte_rrc lte_phy) + target_link_libraries(cell_measurement cuhd srslte) MESSAGE(STATUS " UHD examples will be installed.") diff --git a/srslte/lib/CMakeLists.txt b/srslte/lib/CMakeLists.txt index 527239303..fb8b4c5e3 100644 --- a/srslte/lib/CMakeLists.txt +++ b/srslte/lib/CMakeLists.txt @@ -52,16 +52,16 @@ FOREACH (_module ${modules}) ENDIF(IS_DIRECTORY ${_module}) ENDFOREACH() -ADD_LIBRARY(lte_phy SHARED ${SOURCES_ALL}) -TARGET_LINK_LIBRARIES(lte_phy m ${FFTW3F_LIBRARIES}) -INSTALL(TARGETS lte_phy DESTINATION ${LIBRARY_DIR}) -LIBLTE_SET_PIC(lte_phy) +ADD_LIBRARY(srslte SHARED ${SOURCES_ALL}) +TARGET_LINK_LIBRARIES(srslte m ${FFTW3F_LIBRARIES}) +INSTALL(TARGETS srslte DESTINATION ${LIBRARY_DIR}) +LIBLTE_SET_PIC(srslte) IF(VOLK_FOUND) INCLUDE_DIRECTORIES(${VOLK_INCLUDE_DIRS}) - SET_TARGET_PROPERTIES(lte_phy PROPERTIES COMPILE_DEFINITIONS "${VOLK_DEFINITIONS}") - TARGET_LINK_LIBRARIES(lte_phy ${VOLK_LIBRARIES}) - MESSAGE(STATUS " Compiling with VOLK SIMD library.") + SET_TARGET_PROPERTIES(srslte PROPERTIES COMPILE_DEFINITIONS "${VOLK_DEFINITIONS}") + TARGET_LINK_LIBRARIES(srslte ${VOLK_LIBRARIES}) + MESSAGE(STATUS " Compiling with VOLK SIMD library.") ELSE(VOLK_FOUND) MESSAGE(STATUS " VOLK SIMD library NOT found. Using generic implementation.") ENDIF(VOLK_FOUND) diff --git a/srslte/lib/ch_estimation/test/CMakeLists.txt b/srslte/lib/ch_estimation/test/CMakeLists.txt index 69ab98f52..2ded0a94f 100644 --- a/srslte/lib/ch_estimation/test/CMakeLists.txt +++ b/srslte/lib/ch_estimation/test/CMakeLists.txt @@ -24,7 +24,7 @@ ######################################################################## 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_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 ######################################################################## -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) -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) diff --git a/srslte/lib/dft/test/CMakeLists.txt b/srslte/lib/dft/test/CMakeLists.txt index a9c7e1921..f01278d66 100644 --- a/srslte/lib/dft/test/CMakeLists.txt +++ b/srslte/lib/dft/test/CMakeLists.txt @@ -24,7 +24,7 @@ ######################################################################## 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_extended ofdm_test -e) diff --git a/srslte/lib/fec/test/CMakeLists.txt b/srslte/lib/fec/test/CMakeLists.txt index 06882b75e..696283de0 100644 --- a/srslte/lib/fec/test/CMakeLists.txt +++ b/srslte/lib/fec/test/CMakeLists.txt @@ -25,10 +25,10 @@ ######################################################################## 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) -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_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_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 ######################################################################## 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_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_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 ######################################################################## 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_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_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 ######################################################################## 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_24B crc_test -n 5001 -l 24 -p 0x1800063 -s 1) diff --git a/srslte/lib/mimo/test/CMakeLists.txt b/srslte/lib/mimo/test/CMakeLists.txt index fab534951..9f3ff616b 100644 --- a/srslte/lib/mimo/test/CMakeLists.txt +++ b/srslte/lib/mimo/test/CMakeLists.txt @@ -24,7 +24,7 @@ ######################################################################## 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) @@ -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) -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_diversity2 precoding_test -n 1000 -m diversity -l 2 -p 2) diff --git a/srslte/lib/modem/test/CMakeLists.txt b/srslte/lib/modem/test/CMakeLists.txt index 0804c5d56..fa8dd1726 100644 --- a/srslte/lib/modem/test/CMakeLists.txt +++ b/srslte/lib/modem/test/CMakeLists.txt @@ -24,7 +24,7 @@ ######################################################################## 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_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_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_qpsk_soft_approx soft_demod_test -n 1020 -m 2) diff --git a/srslte/lib/phch/test/CMakeLists.txt b/srslte/lib/phch/test/CMakeLists.txt index b5a067a16..533c932ac 100644 --- a/srslte/lib/phch/test/CMakeLists.txt +++ b/srslte/lib/phch/test/CMakeLists.txt @@ -24,7 +24,7 @@ ######################################################################## 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_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_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) -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_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_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 ######################################################################## 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_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) -TARGET_LINK_LIBRARIES(pdcch_test lte_phy) +TARGET_LINK_LIBRARIES(pdcch_test srslte) ADD_TEST(pdcch_test pdcch_test) 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 ######################################################################## 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_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_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 dlsch_encode SOURCES dlsch_encode_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 srslte srslte_mex) ######################################################################## # FILE TEST ######################################################################## 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) -TARGET_LINK_LIBRARIES(pcfich_file_test lte_phy) +TARGET_LINK_LIBRARIES(pcfich_file_test srslte) 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) -TARGET_LINK_LIBRARIES(pdcch_file_test lte_phy) +TARGET_LINK_LIBRARIES(pdcch_file_test srslte) 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(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) -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 pusch_encode SOURCES pusch_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 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) -TARGET_LINK_LIBRARIES(prach_test lte_phy) +TARGET_LINK_LIBRARIES(prach_test srslte) 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_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) @@ -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) - 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) diff --git a/srslte/lib/resampling/test/CMakeLists.txt b/srslte/lib/resampling/test/CMakeLists.txt index 5deb366e8..cb6bac623 100644 --- a/srslte/lib/resampling/test/CMakeLists.txt +++ b/srslte/lib/resampling/test/CMakeLists.txt @@ -24,10 +24,10 @@ ######################################################################## 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) -TARGET_LINK_LIBRARIES(resample_arb_bench lte_phy) +TARGET_LINK_LIBRARIES(resample_arb_bench srslte) ADD_TEST(resample resample_arb_test) diff --git a/srslte/lib/scrambling/test/CMakeLists.txt b/srslte/lib/scrambling/test/CMakeLists.txt index 0509ed5c6..f95f0eafa 100644 --- a/srslte/lib/scrambling/test/CMakeLists.txt +++ b/srslte/lib/scrambling/test/CMakeLists.txt @@ -24,7 +24,7 @@ ######################################################################## 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_float scrambling_test -s PBCH -c 50 -f) diff --git a/srslte/lib/sync/test/CMakeLists.txt b/srslte/lib/sync/test/CMakeLists.txt index 3b2d441ba..6a0b5d187 100644 --- a/srslte/lib/sync/test/CMakeLists.txt +++ b/srslte/lib/sync/test/CMakeLists.txt @@ -25,11 +25,14 @@ LIST(FIND OPTIONAL_LIBS cuhd CUHD_FIND) +FIND_PACKAGE(LIBSDRGUI) + IF(${CUHD_FIND} GREATER -1) 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) - target_link_libraries(pss_usrp graphics) + include_directories(${LIBSDRGUI_INCLUDE_DIRS}) + target_link_libraries(pss_usrp ${LIBSDRGUI_LIBRARIES}) ELSE(LIBSDRGUI_FOUND) SET_TARGET_PROPERTIES(pss_usrp PROPERTIES COMPILE_DEFINITIONS "DISABLE_GRAPHICS") 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 sss SOURCES sss_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 srslte srslte_mex) ######################################################################## # SYNC TEST ######################################################################## 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_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) -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_2 cfo_test -f 0.99849 -n 1000) diff --git a/srslte/lib/sync/test/pss_usrp.c b/srslte/lib/sync/test/pss_usrp.c index 26f5d4573..99f9c37a1 100644 --- a/srslte/lib/sync/test/pss_usrp.c +++ b/srslte/lib/sync/test/pss_usrp.c @@ -346,7 +346,7 @@ cf_t tmpce[SRSLTE_PSS_LEN]; void init_plots() { - plot_init(); + sdrgui_init(); plot_real_init(&pssout); plot_real_setTitle(&pssout, "PSS xCorr"); plot_real_setLabels(&pssout, "Index", "Absolute value"); diff --git a/srslte/lib/utils/test/CMakeLists.txt b/srslte/lib/utils/test/CMakeLists.txt index 16acfe092..31d3a8d90 100644 --- a/srslte/lib/utils/test/CMakeLists.txt +++ b/srslte/lib/utils/test/CMakeLists.txt @@ -24,7 +24,7 @@ ######################################################################## 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_reverse dft_test -b) # Backwards first