mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-12-25 20:22:10 -05:00
SDRPlay support: source plugin interim state (1) compiles
This commit is contained in:
parent
0d4426b8f4
commit
863522d9ff
@ -535,6 +535,7 @@ if (BUILD_DEBIAN)
|
||||
add_subdirectory(libhackrf)
|
||||
add_subdirectory(librtlsdr)
|
||||
add_subdirectory(libbladerf)
|
||||
add_subdirectory(libsdrplay)
|
||||
endif (BUILD_DEBIAN)
|
||||
|
||||
add_subdirectory(plugins)
|
||||
|
27
cmake/Modules/FindLibSDRPlay.cmake
Normal file
27
cmake/Modules/FindLibSDRPlay.cmake
Normal file
@ -0,0 +1,27 @@
|
||||
if(NOT LIBSDRPLAY_FOUND)
|
||||
pkg_check_modules (LIBSDRPLAY_PKG libsdrplay)
|
||||
find_path(LIBSDRPLAY_INCLUDE_DIRS NAMES mirsdrapi-rsp.h
|
||||
PATHS
|
||||
${LIBSDRPLAY_PKG_INCLUDE_DIRS}
|
||||
/usr/include
|
||||
/usr/local/include
|
||||
)
|
||||
|
||||
find_library(LIBSDRPLAY_LIBRARIES NAMES mirsdrapi-rsp
|
||||
PATHS
|
||||
${LIBSDRPLAY_PKG_LIBRARY_DIRS}
|
||||
/usr/lib
|
||||
/usr/local/lib
|
||||
)
|
||||
|
||||
if(LIBSDRPLAY_INCLUDE_DIRS AND LIBSDRPLAY_LIBRARIES)
|
||||
set(LIBSDRPLAY_FOUND TRUE CACHE INTERNAL "libsdrplay found")
|
||||
message(STATUS "Found libsdrplay: ${LIBSDRPLAY_INCLUDE_DIRS}, ${LIBSDRPLAY_LIBRARIES}")
|
||||
else(LIBSDRPLAY_INCLUDE_DIRS AND LIBSDRPLAY_LIBRARIES)
|
||||
set(LIBSDRPLAY_FOUND FALSE CACHE INTERNAL "libsdrplay found")
|
||||
message(STATUS "libsdrplay not found.")
|
||||
endif(LIBSDRPLAY_INCLUDE_DIRS AND LIBSDRPLAY_LIBRARIES)
|
||||
|
||||
mark_as_advanced(LIBSDRPLAY_LIBRARIES LIBSDRPLAY_INCLUDE_DIRS)
|
||||
|
||||
endif(NOT LIBSDRPLAY_FOUND)
|
8
debian/changelog
vendored
8
debian/changelog
vendored
@ -1,8 +1,14 @@
|
||||
sdrangel (2.3.0-1) unstable; urgency=medium
|
||||
|
||||
* SDRPlay support: new input source plugin
|
||||
|
||||
-- Edouard Griffiths, F4EXB <f4exb06@gmail.com> Sun, 13 Nov 2016 23:14:18 +0100
|
||||
|
||||
sdrangel (2.2.2-1) unstable; urgency=medium
|
||||
|
||||
* Baseband Halfband FIR filter optimizations
|
||||
|
||||
-- Edouard Griffiths, F4EXB <f4exb06@gmail.com> Wed, 02 Nov 2016 14:15:15 +0100
|
||||
-- Edouard Griffiths, F4EXB <f4exb06@gmail.com> Wed, 11 Nov 2016 12:25:34 +0100
|
||||
|
||||
sdrangel (2.2.1-1) unstable; urgency=medium
|
||||
|
||||
|
@ -42,6 +42,14 @@ if(LIBUSB_FOUND AND LIBHACKRF_FOUND)
|
||||
add_subdirectory(hackrf)
|
||||
endif(LIBUSB_FOUND AND LIBHACKRF_FOUND)
|
||||
|
||||
find_package(LibSDRPlay)
|
||||
if(LIBUSB_FOUND AND LIBSDRPLAY_FOUND)
|
||||
add_subdirectory(sdrplay)
|
||||
message(STATUS "LibSDRPlay found")
|
||||
else(LIBUSB_FOUND AND LIBSDRPLAY_FOUND)
|
||||
message(STATUS "LibSDRPlay NOT found")
|
||||
endif(LIBUSB_FOUND AND LIBSDRPLAY_FOUND)
|
||||
|
||||
#find_package(LibNANOMSG)
|
||||
#if(LIBNANOMSG_FOUND)
|
||||
# add_subdirectory(sdrdaemon)
|
||||
|
64
plugins/samplesource/sdrplay/CMakeLists.txt
Normal file
64
plugins/samplesource/sdrplay/CMakeLists.txt
Normal file
@ -0,0 +1,64 @@
|
||||
project(sdrplay)
|
||||
|
||||
set(sdrplay_SOURCES
|
||||
sdrplaygui.cpp
|
||||
sdrplayinput.cpp
|
||||
sdrplayplugin.cpp
|
||||
sdrplaysettings.cpp
|
||||
sdrplaythread.cpp
|
||||
)
|
||||
|
||||
set(sdrplay_HEADERS
|
||||
sdrplaygui.h
|
||||
sdrplayinput.h
|
||||
sdrplayplugin.h
|
||||
sdrplaysettings.h
|
||||
sdrplaythread.h
|
||||
)
|
||||
|
||||
set(sdrplay_FORMS
|
||||
sdrplaygui.ui
|
||||
)
|
||||
|
||||
if (BUILD_DEBIAN)
|
||||
include_directories(
|
||||
.
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
${LIBSDRPLAYSRC}
|
||||
)
|
||||
else (BUILD_DEBIAN)
|
||||
include_directories(
|
||||
.
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
${LIBSDRPLAY_INCLUDE_DIRS}
|
||||
)
|
||||
endif (BUILD_DEBIAN)
|
||||
|
||||
add_definitions(-DQT_PLUGIN)
|
||||
add_definitions(-DQT_SHARED)
|
||||
|
||||
qt5_wrap_ui(sdrplay_FORMS_HEADERS ${sdrplay_FORMS})
|
||||
|
||||
add_library(inputsdrplay SHARED
|
||||
${sdrplay_SOURCES}
|
||||
${sdrplay_HEADERS_MOC}
|
||||
${sdrplay_FORMS_HEADERS}
|
||||
)
|
||||
|
||||
if (BUILD_DEBIAN)
|
||||
target_link_libraries(inputsdrplay
|
||||
${QT_LIBRARIES}
|
||||
sdrplay
|
||||
sdrbase
|
||||
)
|
||||
else (BUILD_DEBIAN)
|
||||
target_link_libraries(inputsdrplay
|
||||
${QT_LIBRARIES}
|
||||
${LIBSDRPLAY_LIBRARIES}
|
||||
sdrbase
|
||||
)
|
||||
endif (BUILD_DEBIAN)
|
||||
|
||||
qt5_use_modules(inputsdrplay Core Widgets)
|
||||
|
||||
install(TARGETS inputsdrplay DESTINATION lib/plugins/samplesource)
|
824
plugins/samplesource/sdrplay/sdrplaygui.cpp
Normal file
824
plugins/samplesource/sdrplay/sdrplaygui.cpp
Normal file
@ -0,0 +1,824 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2016 Edouard Griffiths, F4EXB //
|
||||
// //
|
||||
// This program is free software; you can redistribute it and/or modify //
|
||||
// it under the terms of the GNU General Public License as published by //
|
||||
// the Free Software Foundation as version 3 of the License, or //
|
||||
// //
|
||||
// This program is distributed in the hope that it will be useful, //
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||
// GNU General Public License V3 for more details. //
|
||||
// //
|
||||
// You should have received a copy of the GNU General Public License //
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <QDebug>
|
||||
#include <QMessageBox>
|
||||
|
||||
#include "sdrplaygui.h"
|
||||
|
||||
#include <device/devicesourceapi.h>
|
||||
#include <dsp/filerecord.h>
|
||||
|
||||
#include "ui_sdrplaygui.h"
|
||||
#include "gui/colormapper.h"
|
||||
#include "gui/glspectrum.h"
|
||||
#include "dsp/dspengine.h"
|
||||
#include "dsp/dspcommands.h"
|
||||
|
||||
// ====================================================================
|
||||
|
||||
unsigned int SDRPlayGui::m_bbGr[m_nbBands][m_nbGRValues] = {
|
||||
{ // 10k - 12M
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
|
||||
11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45,
|
||||
46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58,
|
||||
40, 41, 42, 53, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59
|
||||
},
|
||||
{ // 12 - 30M
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
|
||||
11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45,
|
||||
46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58,
|
||||
40, 41, 42, 53, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59
|
||||
},
|
||||
{ // 30 - 60M
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
|
||||
11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45,
|
||||
46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58,
|
||||
40, 41, 42, 53, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59
|
||||
},
|
||||
{ // 60 - 120M
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
|
||||
5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
|
||||
35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58,
|
||||
40, 41, 42, 53, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59
|
||||
},
|
||||
{ // 120 - 250M
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
|
||||
5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
|
||||
35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58,
|
||||
40, 41, 42, 53, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59
|
||||
},
|
||||
{ // 250 - 420M
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
|
||||
11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45,
|
||||
46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58,
|
||||
40, 41, 42, 53, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59
|
||||
},
|
||||
{ // 420M - 1G
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
|
||||
5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
|
||||
35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58,
|
||||
40, 41, 42, 53, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
|
||||
59, 59, 59, 59, 59, 59, 59, 59, 59, 59,
|
||||
59, 59, 59, 59, 59, 59, 59,
|
||||
|
||||
},
|
||||
{ // 1 - 2G
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
|
||||
3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
|
||||
35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58,
|
||||
40, 41, 42, 53, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
|
||||
59, 59, 59, 59, 59, 59, 59, 59, 59, 59,
|
||||
59, 59, 59, 59, 59, 59, 59,
|
||||
}
|
||||
};
|
||||
|
||||
unsigned int SDRPlayGui::m_lnaGr[m_nbBands][m_nbGRValues] = {
|
||||
{ // 10k - 12M
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0,
|
||||
24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
|
||||
24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
|
||||
24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
|
||||
24, 24, 24, 24,
|
||||
24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
|
||||
24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
|
||||
24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
|
||||
24, 24,
|
||||
},
|
||||
{ // 12 - 30M
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0,
|
||||
24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
|
||||
24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
|
||||
24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
|
||||
24, 24, 24, 24,
|
||||
24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
|
||||
24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
|
||||
24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
|
||||
24, 24,
|
||||
},
|
||||
{ // 30 - 60M
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0,
|
||||
24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
|
||||
24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
|
||||
24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
|
||||
24, 24, 24, 24,
|
||||
24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
|
||||
24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
|
||||
24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
|
||||
24, 24,
|
||||
},
|
||||
{ // 60 - 120M
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 24,
|
||||
24, 24, 24, 24,
|
||||
24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
|
||||
24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
|
||||
24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
|
||||
24, 24, 24, 24,
|
||||
24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
|
||||
24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
|
||||
24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
|
||||
24, 24,
|
||||
},
|
||||
{ // 120 - 250M
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 24,
|
||||
24, 24, 24, 24,
|
||||
24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
|
||||
24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
|
||||
24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
|
||||
24, 24, 24, 24,
|
||||
24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
|
||||
24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
|
||||
24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
|
||||
24, 24,
|
||||
},
|
||||
{ // 250 - 420M
|
||||
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0,
|
||||
24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
|
||||
24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
|
||||
24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
|
||||
24, 24, 24, 24,
|
||||
24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
|
||||
24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
|
||||
24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
|
||||
24, 24,
|
||||
},
|
||||
{ // 420M - 1G
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 7, 7, 7, 7, 7, 7, 7, 7,
|
||||
7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
|
||||
7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
|
||||
7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
|
||||
7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
|
||||
7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
|
||||
7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
|
||||
7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
|
||||
7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
|
||||
7, 7, 7,
|
||||
},
|
||||
{ // 1 - 2G
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
|
||||
7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
|
||||
7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
|
||||
7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
|
||||
7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
|
||||
7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
|
||||
7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
|
||||
7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
|
||||
7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
|
||||
7, 7, 7,
|
||||
}
|
||||
};
|
||||
|
||||
unsigned int SDRPlayGui::m_mixerGr[m_nbBands][m_nbGRValues] = {
|
||||
{ // 10k - 12M
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 19, 19, 19, 19, 19, 19, 19,
|
||||
19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
|
||||
19, 19, 19,
|
||||
},
|
||||
{ // 12 - 30M
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 19, 19, 19, 19, 19, 19, 19,
|
||||
19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
|
||||
19, 19, 19,
|
||||
},
|
||||
{ // 30 - 60M
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 19, 19, 19, 19, 19, 19, 19,
|
||||
19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
|
||||
19, 19, 19,
|
||||
},
|
||||
{ // 60 - 120M
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 19, 19, 19, 19, 19, 19, 19,
|
||||
19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
|
||||
19, 19, 19,
|
||||
},
|
||||
{ // 120 - 250M
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 19, 19, 19, 19, 19, 19, 19,
|
||||
19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
|
||||
19, 19, 19,
|
||||
},
|
||||
{ // 250 - 420M
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 19, 19, 19, 19, 19, 19, 19,
|
||||
19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
|
||||
19, 19, 19,
|
||||
},
|
||||
{ // 420M - 1G
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 19, 19, 19, 19,
|
||||
19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
|
||||
19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
|
||||
19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
|
||||
19, 19, 19,
|
||||
},
|
||||
{ // 1 - 2G
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 19, 19, 19, 19,
|
||||
19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
|
||||
19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
|
||||
19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
|
||||
19, 19, 19,
|
||||
}
|
||||
};
|
||||
|
||||
// ====================================================================
|
||||
|
||||
SDRPlayGui::SDRPlayGui(DeviceSourceAPI *deviceAPI, QWidget* parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::SDRPlayGui),
|
||||
m_deviceAPI(deviceAPI)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
ui->centerFrequency->setColorMapper(ColorMapper(ColorMapper::ReverseGold));
|
||||
ui->centerFrequency->setValueRange(7, 10U, 12000U);
|
||||
|
||||
ui->fBand->clear();
|
||||
for (int i = 0; i < SDRPlayBands::getNbBands(); i++)
|
||||
{
|
||||
ui->fBand->addItem(SDRPlayBands::getBandName(i));
|
||||
}
|
||||
|
||||
ui->ifFrequency->clear();
|
||||
for (int i = 0; i < SDRPlayIF::getNbIFs(); i++)
|
||||
{
|
||||
ui->ifFrequency->addItem(QString::number(SDRPlayIF::getIF(i)));
|
||||
}
|
||||
|
||||
ui->mirDCCorr->clear();
|
||||
for (int i = 0; i < SDRPlayDCCorr::getNbDCCorrs(); i++)
|
||||
{
|
||||
ui->mirDCCorr->addItem(SDRPlayDCCorr::getDCCorrName(i));
|
||||
}
|
||||
|
||||
ui->samplerate->clear();
|
||||
for (int i = 0; i < SDRPlaySampleRates::getNbRates(); i++)
|
||||
{
|
||||
ui->samplerate->addItem(QString::number(SDRPlaySampleRates::getRate(i)));
|
||||
}
|
||||
|
||||
ui->bandwidth->clear();
|
||||
for (int i = 0; i < SDRPlayBandwidths::getNbBandwidths(); i++)
|
||||
{
|
||||
ui->bandwidth->addItem(QString::number(SDRPlayBandwidths::getBandwidth(i)));
|
||||
}
|
||||
|
||||
connect(&m_updateTimer, SIGNAL(timeout()), this, SLOT(updateHardware()));
|
||||
connect(&m_statusTimer, SIGNAL(timeout()), this, SLOT(updateStatus()));
|
||||
m_statusTimer.start(500);
|
||||
|
||||
displaySettings();
|
||||
|
||||
// TODO:
|
||||
// m_sampleSource = new SDRPlayInput(m_deviceAPI);
|
||||
// m_deviceAPI->setSource(m_sampleSource);
|
||||
|
||||
connect(m_sampleSource->getOutputMessageQueueToGUI(), SIGNAL(messageEnqueued()), this, SLOT(handleSourceMessages()));
|
||||
m_deviceAPI->setSource(m_sampleSource);
|
||||
|
||||
char recFileNameCStr[30];
|
||||
sprintf(recFileNameCStr, "test_%d.sdriq", m_deviceAPI->getDeviceUID());
|
||||
m_fileSink = new FileRecord(std::string(recFileNameCStr));
|
||||
m_deviceAPI->addSink(m_fileSink);
|
||||
|
||||
connect(m_deviceAPI->getDeviceOutputMessageQueue(), SIGNAL(messageEnqueued()), this, SLOT(handleDSPMessages()), Qt::QueuedConnection);
|
||||
}
|
||||
|
||||
SDRPlayGui::~SDRPlayGui()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void SDRPlayGui::destroy()
|
||||
{
|
||||
delete this;
|
||||
}
|
||||
|
||||
void SDRPlayGui::setName(const QString& name)
|
||||
{
|
||||
setObjectName(name);
|
||||
}
|
||||
|
||||
QString SDRPlayGui::getName() const
|
||||
{
|
||||
return objectName();
|
||||
}
|
||||
|
||||
void SDRPlayGui::resetToDefaults()
|
||||
{
|
||||
m_settings.resetToDefaults();
|
||||
displaySettings();
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
qint64 SDRPlayGui::getCenterFrequency() const
|
||||
{
|
||||
return m_settings.m_centerFrequency;
|
||||
}
|
||||
|
||||
void SDRPlayGui::setCenterFrequency(qint64 centerFrequency)
|
||||
{
|
||||
m_settings.m_centerFrequency = centerFrequency;
|
||||
displaySettings();
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
QByteArray SDRPlayGui::serialize() const
|
||||
{
|
||||
return m_settings.serialize();
|
||||
}
|
||||
|
||||
bool SDRPlayGui::deserialize(const QByteArray& data)
|
||||
{
|
||||
if(m_settings.deserialize(data))
|
||||
{
|
||||
displaySettings();
|
||||
sendSettings();
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
resetToDefaults();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool SDRPlayGui::handleMessage(const Message& message)
|
||||
{
|
||||
if (SDRPlayInput::MsgReportSDRPlay::match(message))
|
||||
{
|
||||
displaySettings();
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void SDRPlayGui::displaySettings()
|
||||
{
|
||||
ui->centerFrequency->setValue(m_settings.m_centerFrequency / 1000);
|
||||
|
||||
ui->ppm->setValue(m_settings.m_LOppmTenths);
|
||||
ui->ppmText->setText(QString("%1").arg(QString::number(m_settings.m_LOppmTenths/10.0, 'f', 1)));
|
||||
|
||||
ui->samplerate->setCurrentIndex(m_settings.m_devSampleRateIndex);
|
||||
|
||||
ui->dcOffset->setChecked(m_settings.m_dcBlock);
|
||||
ui->iqImbalance->setChecked(m_settings.m_iqCorrection);
|
||||
|
||||
ui->fBand->setCurrentIndex(m_settings.m_frequencyBandIndex);
|
||||
ui->ifFrequency->setCurrentIndex(m_settings.m_ifFrequencyIndex);
|
||||
ui->mirDCCorr->setCurrentIndex(m_settings.m_mirDcCorrIndex);
|
||||
ui->mirDCCorrTrackTime->setValue(m_settings.m_mirDcCorrTrackTimeIndex);
|
||||
ui->mirDCCorrTrackTimeText->setText(tr("%1us").arg(m_settings.m_mirDcCorrIndex * 3));
|
||||
ui->samplerate->setCurrentIndex(m_settings.m_devSampleRateIndex);
|
||||
|
||||
ui->decim->setCurrentIndex(m_settings.m_log2Decim);
|
||||
ui->fcPos->setCurrentIndex((int) m_settings.m_fcPos);
|
||||
|
||||
ui->gr->setValue(m_settings.m_gainRedctionIndex);
|
||||
|
||||
char grStrChr[20];
|
||||
|
||||
sprintf(grStrChr, "%02d-%02d-%02d",
|
||||
24 - m_lnaGr[m_settings.m_frequencyBandIndex][m_settings.m_gainRedctionIndex],
|
||||
19 - m_mixerGr[m_settings.m_frequencyBandIndex][m_settings.m_gainRedctionIndex],
|
||||
59 - m_bbGr[m_settings.m_frequencyBandIndex][m_settings.m_gainRedctionIndex]);
|
||||
|
||||
ui->grText->setText(QString(grStrChr));
|
||||
}
|
||||
|
||||
void SDRPlayGui::sendSettings()
|
||||
{
|
||||
if(!m_updateTimer.isActive())
|
||||
m_updateTimer.start(100);
|
||||
}
|
||||
|
||||
void SDRPlayGui::updateHardware()
|
||||
{
|
||||
qDebug() << "SDRPlayGui::updateHardware";
|
||||
SDRPlayInput::MsgConfigureSDRPlay* message = SDRPlayInput::MsgConfigureSDRPlay::create( m_settings);
|
||||
m_sampleSource->getInputMessageQueue()->push(message);
|
||||
m_updateTimer.stop();
|
||||
}
|
||||
|
||||
void SDRPlayGui::on_centerFrequency_changed(quint64 value)
|
||||
{
|
||||
m_settings.m_centerFrequency = ui->centerFrequency->getValue();
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void SDRPlayGui::on_ppm_valueChanged(int value)
|
||||
{
|
||||
m_settings.m_LOppmTenths = value;
|
||||
ui->ppmText->setText(QString("%1").arg(QString::number(m_settings.m_LOppmTenths/10.0, 'f', 1)));
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void SDRPlayGui::on_dcOffset_toggled(bool checked)
|
||||
{
|
||||
m_settings.m_dcBlock = checked;
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void SDRPlayGui::on_iqImbalance_toggled(bool checked)
|
||||
{
|
||||
m_settings.m_iqCorrection = checked;
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void SDRPlayGui::on_fBband_currentIndexChanged(int index)
|
||||
{
|
||||
ui->centerFrequency->setValueRange(
|
||||
7,
|
||||
SDRPlayBands::getBandLow(index),
|
||||
SDRPlayBands::getBandHigh(index));
|
||||
|
||||
ui->centerFrequency->setValue((SDRPlayBands::getBandLow(index)+SDRPlayBands::getBandHigh(index)) / 2);
|
||||
m_settings.m_centerFrequency = ui->centerFrequency->getValue();
|
||||
m_settings.m_frequencyBandIndex = index;
|
||||
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void SDRPlayGui::on_mirDCCorr_currentIndexChanged(int index)
|
||||
{
|
||||
m_settings.m_mirDcCorrIndex = index;
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void SDRPlayGui::on_mirDCCorrTrackTime_valueChanged(int value)
|
||||
{
|
||||
m_settings.m_mirDcCorrTrackTimeIndex = value;
|
||||
ui->mirDCCorrTrackTimeText->setText(tr("%1us").arg(m_settings.m_mirDcCorrIndex * 3));
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void SDRPlayGui::on_bandwidth_currentIndexChanged(int index)
|
||||
{
|
||||
m_settings.m_bandwidthIndex = index;
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void SDRPlayGui::on_samplerate_currentIndexChanged(int index)
|
||||
{
|
||||
m_settings.m_devSampleRateIndex = index;
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void SDRPlayGui::on_decim_currentIndexChanged(int index)
|
||||
{
|
||||
m_settings.m_log2Decim = index;
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void SDRPlayGui::on_fcPos_currentIndexChanged(int index)
|
||||
{
|
||||
m_settings.m_fcPos = (SDRPlaySettings::fcPos_t) index;
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void SDRPlayGui::on_gr_valueChanged(int value)
|
||||
{
|
||||
m_settings.m_gainRedctionIndex = value;
|
||||
|
||||
char grStrChr[20];
|
||||
|
||||
sprintf(grStrChr, "%02d-%02d-%02d",
|
||||
24 - m_lnaGr[m_settings.m_frequencyBandIndex][m_settings.m_gainRedctionIndex],
|
||||
19 - m_mixerGr[m_settings.m_frequencyBandIndex][m_settings.m_gainRedctionIndex],
|
||||
59 - m_bbGr[m_settings.m_frequencyBandIndex][m_settings.m_gainRedctionIndex]);
|
||||
|
||||
ui->grText->setText(QString(grStrChr));
|
||||
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
// ====================================================================
|
||||
|
||||
unsigned int SDRPlaySampleRates::m_rates[m_nb_rates] = {
|
||||
2000, // 0
|
||||
2048, // 1
|
||||
2304, // 2
|
||||
2400, // 3
|
||||
3072, // 4
|
||||
3200, // 5
|
||||
4000, // 6
|
||||
4096, // 7
|
||||
4608, // 8
|
||||
4800, // 9
|
||||
5000, // 10
|
||||
6000, // 11
|
||||
6144, // 12
|
||||
8000, // 13
|
||||
8192, // 14
|
||||
9216, // 15
|
||||
9600, // 16
|
||||
10000, // 17
|
||||
};
|
||||
|
||||
unsigned int SDRPlaySampleRates::getRate(unsigned int rate_index)
|
||||
{
|
||||
if (rate_index < m_nb_rates)
|
||||
{
|
||||
return m_rates[rate_index];
|
||||
}
|
||||
else
|
||||
{
|
||||
return m_rates[0];
|
||||
}
|
||||
}
|
||||
|
||||
unsigned int SDRPlaySampleRates::getRateIndex(unsigned int rate)
|
||||
{
|
||||
for (unsigned int i=0; i < m_nb_rates; i++)
|
||||
{
|
||||
if (rate == m_rates[i])
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned int SDRPlaySampleRates::getNbRates()
|
||||
{
|
||||
return SDRPlaySampleRates::m_nb_rates;
|
||||
}
|
||||
|
||||
// ====================================================================
|
||||
|
||||
unsigned int SDRPlayBandwidths::m_bw[m_nb_bw] = {
|
||||
200, // 0
|
||||
300, // 1
|
||||
600, // 2
|
||||
1536, // 3
|
||||
5000, // 4
|
||||
6000, // 5
|
||||
7000, // 6
|
||||
8000, // 7
|
||||
};
|
||||
|
||||
unsigned int SDRPlayBandwidths::getBandwidth(unsigned int bandwidth_index)
|
||||
{
|
||||
if (bandwidth_index < m_nb_bw)
|
||||
{
|
||||
return m_bw[bandwidth_index];
|
||||
}
|
||||
else
|
||||
{
|
||||
return m_bw[0];
|
||||
}
|
||||
}
|
||||
|
||||
unsigned int SDRPlayBandwidths::getBandwidthIndex(unsigned int bandwidth)
|
||||
{
|
||||
for (unsigned int i=0; i < m_nb_bw; i++)
|
||||
{
|
||||
if (bandwidth == m_bw[i])
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned int SDRPlayBandwidths::getNbBandwidths()
|
||||
{
|
||||
return SDRPlayBandwidths::m_nb_bw;
|
||||
}
|
||||
|
||||
// ====================================================================
|
||||
|
||||
unsigned int SDRPlayIF::m_if[m_nb_if] = {
|
||||
0, // 0
|
||||
450, // 1
|
||||
1620, // 2
|
||||
2048, // 3
|
||||
};
|
||||
|
||||
unsigned int SDRPlayIF::getIF(unsigned int if_index)
|
||||
{
|
||||
if (if_index < m_nb_if)
|
||||
{
|
||||
return m_if[if_index];
|
||||
}
|
||||
else
|
||||
{
|
||||
return m_if[0];
|
||||
}
|
||||
}
|
||||
|
||||
unsigned int SDRPlayIF::getIFIndex(unsigned int iff)
|
||||
{
|
||||
for (unsigned int i=0; i < m_nb_if; i++)
|
||||
{
|
||||
if (iff == m_if[i])
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned int SDRPlayIF::getNbIFs()
|
||||
{
|
||||
return SDRPlayIF::m_nb_if;
|
||||
}
|
||||
|
||||
// ====================================================================
|
||||
|
||||
/** Lower frequency bound in kHz inclusive */
|
||||
unsigned int SDRPlayBands::m_bandLow[m_nb_bands] = {
|
||||
10, // 0
|
||||
12000, // 1
|
||||
30000, // 2
|
||||
60000, // 3
|
||||
120000, // 4
|
||||
250000, // 5
|
||||
420000, // 6
|
||||
1000000, // 7
|
||||
};
|
||||
|
||||
/** Lower frequency bound in kHz exclusive */
|
||||
unsigned int SDRPlayBands::m_bandHigh[m_nb_bands] = {
|
||||
12000, // 0
|
||||
30000, // 1
|
||||
60000, // 2
|
||||
120000, // 3
|
||||
250000, // 4
|
||||
420000, // 5
|
||||
1000000, // 6
|
||||
2000000, // 7
|
||||
};
|
||||
|
||||
const char* SDRPlayBands::m_bandName[m_nb_bands] = {
|
||||
"10k-12M", // 0
|
||||
"12-30M", // 1
|
||||
"30-60M", // 2
|
||||
"60-120M", // 3
|
||||
"120-250M", // 4
|
||||
"250-420M", // 5
|
||||
"420M-1G", // 6
|
||||
"1-2G", // 7
|
||||
};
|
||||
|
||||
QString SDRPlayBands::getBandName(unsigned int band_index)
|
||||
{
|
||||
if (band_index < m_nb_bands)
|
||||
{
|
||||
return QString(m_bandName[band_index]);
|
||||
}
|
||||
else
|
||||
{
|
||||
return QString(m_bandName[0]);
|
||||
}
|
||||
}
|
||||
|
||||
unsigned int SDRPlayBands::getBandLow(unsigned int band_index)
|
||||
{
|
||||
if (band_index < m_nb_bands)
|
||||
{
|
||||
return m_bandLow[band_index];
|
||||
}
|
||||
else
|
||||
{
|
||||
return m_bandLow[0];
|
||||
}
|
||||
}
|
||||
|
||||
unsigned int SDRPlayBands::getBandHigh(unsigned int band_index)
|
||||
{
|
||||
if (band_index < m_nb_bands)
|
||||
{
|
||||
return m_bandHigh[band_index];
|
||||
}
|
||||
else
|
||||
{
|
||||
return m_bandHigh[0];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
unsigned int SDRPlayBands::getNbBands()
|
||||
{
|
||||
return SDRPlayBands::m_nb_bands;
|
||||
}
|
||||
|
||||
// ====================================================================
|
||||
|
||||
const char* SDRPlayDCCorr::m_dcCorrName[m_nb_dcCorrs] = {
|
||||
"None", // 0
|
||||
"Per1", // 1
|
||||
"Per2", // 2
|
||||
"Per3", // 3
|
||||
"1Shot", // 4
|
||||
"Cont", // 5
|
||||
};
|
||||
|
||||
QString SDRPlayDCCorr::getDCCorrName(unsigned int dcCorr_index)
|
||||
{
|
||||
if (dcCorr_index < m_nb_dcCorrs)
|
||||
{
|
||||
return QString(m_dcCorrName[dcCorr_index]);
|
||||
}
|
||||
else
|
||||
{
|
||||
return QString(m_dcCorrName[0]);
|
||||
}
|
||||
}
|
||||
|
||||
unsigned int SDRPlayDCCorr::getNbDCCorrs()
|
||||
{
|
||||
return SDRPlayDCCorr::m_nb_dcCorrs;
|
||||
}
|
145
plugins/samplesource/sdrplay/sdrplaygui.h
Normal file
145
plugins/samplesource/sdrplay/sdrplaygui.h
Normal file
@ -0,0 +1,145 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2016 Edouard Griffiths, F4EXB //
|
||||
// //
|
||||
// This program is free software; you can redistribute it and/or modify //
|
||||
// it under the terms of the GNU General Public License as published by //
|
||||
// the Free Software Foundation as version 3 of the License, or //
|
||||
// //
|
||||
// This program is distributed in the hope that it will be useful, //
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||
// GNU General Public License V3 for more details. //
|
||||
// //
|
||||
// You should have received a copy of the GNU General Public License //
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef PLUGINS_SAMPLESOURCE_SDRPLAY_SDRPLAYGUI_H_
|
||||
#define PLUGINS_SAMPLESOURCE_SDRPLAY_SDRPLAYGUI_H_
|
||||
|
||||
#include <QTimer>
|
||||
#include "plugin/plugingui.h"
|
||||
|
||||
#include "sdrplayinput.h"
|
||||
#include "sdrplaysettings.h"
|
||||
|
||||
class DeviceSampleSource;
|
||||
class DeviceSourceAPI;
|
||||
class FileRecord;
|
||||
|
||||
namespace Ui {
|
||||
class SDRPlayGui;
|
||||
}
|
||||
|
||||
class SDRPlayGui : public QWidget, public PluginGUI {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit SDRPlayGui(DeviceSourceAPI *deviceAPI, QWidget* parent = NULL);
|
||||
virtual ~SDRPlayGui();
|
||||
void destroy();
|
||||
|
||||
void setName(const QString& name);
|
||||
QString getName() const;
|
||||
|
||||
virtual void resetToDefaults();
|
||||
virtual qint64 getCenterFrequency() const;
|
||||
virtual void setCenterFrequency(qint64 centerFrequency);
|
||||
virtual QByteArray serialize() const;
|
||||
virtual bool deserialize(const QByteArray& data);
|
||||
virtual bool handleMessage(const Message& message);
|
||||
|
||||
private:
|
||||
Ui::SDRPlayGui* ui;
|
||||
|
||||
DeviceSourceAPI* m_deviceAPI;
|
||||
SDRPlaySettings m_settings;
|
||||
QTimer m_updateTimer;
|
||||
QTimer m_statusTimer;
|
||||
DeviceSampleSource* m_sampleSource;
|
||||
FileRecord *m_fileSink; //!< File sink to record device I/Q output
|
||||
int m_sampleRate;
|
||||
quint64 m_deviceCenterFrequency; //!< Center frequency in device
|
||||
int m_lastEngineState;
|
||||
|
||||
static const unsigned int m_nbGRValues = 103;
|
||||
static const unsigned int m_nbBands = 8;
|
||||
static unsigned int m_bbGr[m_nbBands][m_nbGRValues];
|
||||
static unsigned int m_lnaGr[m_nbBands][m_nbGRValues];
|
||||
static unsigned int m_mixerGr[m_nbBands][m_nbGRValues];
|
||||
|
||||
void displaySettings();
|
||||
void sendSettings();
|
||||
|
||||
private slots:
|
||||
void updateHardware();
|
||||
void on_centerFrequency_changed(quint64 value);
|
||||
void on_ppm_valueChanged(int value);
|
||||
void on_dcOffset_toggled(bool checked);
|
||||
void on_iqImbalance_toggled(bool checked);
|
||||
void on_fBband_currentIndexChanged(int index);
|
||||
void on_mirDCCorr_currentIndexChanged(int index);
|
||||
void on_mirDCCorrTrackTime_valueChanged(int value);
|
||||
void on_bandwidth_currentIndexChanged(int index);
|
||||
void on_samplerate_currentIndexChanged(int index);
|
||||
void on_decim_currentIndexChanged(int index);
|
||||
void on_fcPos_currentIndexChanged(int index);
|
||||
void on_gr_valueChanged(int value);
|
||||
};
|
||||
|
||||
|
||||
// ====================================================================
|
||||
|
||||
class SDRPlaySampleRates {
|
||||
public:
|
||||
static unsigned int getRate(unsigned int rate_index);
|
||||
static unsigned int getRateIndex(unsigned int rate);
|
||||
static unsigned int getNbRates();
|
||||
private:
|
||||
static const unsigned int m_nb_rates = 18;
|
||||
static unsigned int m_rates[m_nb_rates];
|
||||
};
|
||||
|
||||
class SDRPlayBandwidths {
|
||||
public:
|
||||
static unsigned int getBandwidth(unsigned int bandwidth_index);
|
||||
static unsigned int getBandwidthIndex(unsigned int bandwidth);
|
||||
static unsigned int getNbBandwidths();
|
||||
private:
|
||||
static const unsigned int m_nb_bw = 8;
|
||||
static unsigned int m_bw[m_nb_bw];
|
||||
};
|
||||
|
||||
class SDRPlayIF {
|
||||
public:
|
||||
static unsigned int getIF(unsigned int if_index);
|
||||
static unsigned int getIFIndex(unsigned int iff);
|
||||
static unsigned int getNbIFs();
|
||||
private:
|
||||
static const unsigned int m_nb_if = 4;
|
||||
static unsigned int m_if[m_nb_if];
|
||||
};
|
||||
|
||||
class SDRPlayBands {
|
||||
public:
|
||||
static QString getBandName(unsigned int band_index);
|
||||
static unsigned int getBandLow(unsigned int band_index);
|
||||
static unsigned int getBandHigh(unsigned int band_index);
|
||||
static unsigned int getNbBands();
|
||||
private:
|
||||
static const unsigned int m_nb_bands = 8;
|
||||
static unsigned int m_bandLow[m_nb_bands];
|
||||
static unsigned int m_bandHigh[m_nb_bands];
|
||||
static const char* m_bandName[m_nb_bands];
|
||||
};
|
||||
|
||||
class SDRPlayDCCorr {
|
||||
public:
|
||||
static QString getDCCorrName(unsigned int dcCorr_index);
|
||||
static unsigned int getNbDCCorrs();
|
||||
private:
|
||||
static const unsigned int m_nb_dcCorrs = 6;
|
||||
static const char* m_dcCorrName[m_nb_dcCorrs];
|
||||
};
|
||||
|
||||
#endif /* PLUGINS_SAMPLESOURCE_SDRPLAY_SDRPLAYGUI_H_ */
|
651
plugins/samplesource/sdrplay/sdrplaygui.ui
Normal file
651
plugins/samplesource/sdrplay/sdrplaygui.ui
Normal file
@ -0,0 +1,651 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>SDRPlayGui</class>
|
||||
<widget class="QWidget" name="SDRPlayGui">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>291</width>
|
||||
<height>210</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>210</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Sans Serif</family>
|
||||
<pointsize>9</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>SDRPlay</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="spacing">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_freq">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="deviceUILayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="deviceButtonsLayout">
|
||||
<item>
|
||||
<widget class="ButtonSwitch" name="startStop">
|
||||
<property name="toolTip">
|
||||
<string>start/stop acquisition</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../../sdrbase/resources/res.qrc">
|
||||
<normaloff>:/play.png</normaloff>
|
||||
<normalon>:/stop.png</normalon>:/play.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="ButtonSwitch" name="record">
|
||||
<property name="toolTip">
|
||||
<string>Toggle record I/Q samples from device</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../../sdrbase/resources/res.qrc">
|
||||
<normaloff>:/record_off.png</normaloff>
|
||||
<normalon>:/record_on.png</normalon>:/record_off.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="deviceRateLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="deviceRateLabel">
|
||||
<property name="toolTip">
|
||||
<string>I/Q sample rate kS/s</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>00000k</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="freqLeftSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="ValueDial" name="centerFrequency" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Maximum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>32</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Monospace</family>
|
||||
<pointsize>20</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="cursor">
|
||||
<cursorShape>SizeVerCursor</cursorShape>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::StrongFocus</enum>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Tuner center frequency in kHz</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="freqUnits">
|
||||
<property name="text">
|
||||
<string> kHz</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="freqRightlSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout_ppm">
|
||||
<property name="spacing">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<item row="0" column="1">
|
||||
<widget class="QSlider" name="ppm">
|
||||
<property name="toolTip">
|
||||
<string>Local Oscillator ppm correction</string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>-200</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>200</number>
|
||||
</property>
|
||||
<property name="pageStep">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QLabel" name="ppmText">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>0.0</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="ppmLabel">
|
||||
<property name="text">
|
||||
<string>LO ppm</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout_corr">
|
||||
<item row="1" column="2">
|
||||
<widget class="ButtonSwitch" name="iqImbalance">
|
||||
<property name="toolTip">
|
||||
<string>Automatic IQ imbalance correction</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>IQ</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="ButtonSwitch" name="dcOffset">
|
||||
<property name="toolTip">
|
||||
<string>Automatic DC offset removal</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>DC</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="5">
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="corrLabel">
|
||||
<property name="text">
|
||||
<string>Auto</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="6">
|
||||
<widget class="QComboBox" name="fBand">
|
||||
<property name="toolTip">
|
||||
<string>Frequency band</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="7">
|
||||
<widget class="QComboBox" name="ifFrequency">
|
||||
<property name="toolTip">
|
||||
<string>IF frequency in kHz</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_freq">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout_samplerate">
|
||||
<property name="spacing">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<item row="0" column="6">
|
||||
<widget class="QComboBox" name="bandwidth">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>70</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>IF bandwidth in kHz</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="4">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="5">
|
||||
<widget class="QLabel" name="bandwidthLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>BW </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="7">
|
||||
<widget class="QLabel" name="bandwidthUnit">
|
||||
<property name="text">
|
||||
<string>kHz</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="8">
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QComboBox" name="mirDCCorr">
|
||||
<property name="toolTip">
|
||||
<string>MirSDR DC auto tracking</string>
|
||||
</property>
|
||||
<property name="currentText" stdset="0">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>-1</number>
|
||||
</property>
|
||||
<property name="maxVisibleItems">
|
||||
<number>5</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QDial" name="mirDCCorrTrackTime">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>MirSDR DC auto tracking time in uS</string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>63</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>35</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QLabel" name="mirDCCorrTrackTimeText">
|
||||
<property name="text">
|
||||
<string>105uS</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout_decim" columnstretch="0,0,0,0,0,0,0,0">
|
||||
<property name="spacing">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<item row="0" column="3">
|
||||
<widget class="QLabel" name="label_decim">
|
||||
<property name="text">
|
||||
<string>Dec</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="4">
|
||||
<widget class="QComboBox" name="decim">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Decimation factor</string>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>1</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>2</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>4</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>8</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>16</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>32</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>64</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="5">
|
||||
<widget class="QLabel" name="label_fcPos">
|
||||
<property name="text">
|
||||
<string>Fp</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="6">
|
||||
<widget class="QComboBox" name="fcPos">
|
||||
<property name="toolTip">
|
||||
<string>Relative position of device center frequency</string>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Inf</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Sup</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Cen</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="7">
|
||||
<spacer name="fcPosRightSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="samplerate">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>70</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Sample rate in kS/s</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="samplerateLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>SR</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QLabel" name="samplerateUnit">
|
||||
<property name="text">
|
||||
<string>kS/s</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_lna">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout_vga1">
|
||||
<property name="spacing">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<item row="0" column="1">
|
||||
<widget class="QSlider" name="gr">
|
||||
<property name="toolTip">
|
||||
<string>Gain reduction</string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>102</number>
|
||||
</property>
|
||||
<property name="pageStep">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>35</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QLabel" name="grText">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>LNA-Mixer-BaseBand gains in dB</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>24-19-59</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="grLabel">
|
||||
<property name="text">
|
||||
<string>GR</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_vga1">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="padLayout">
|
||||
<item>
|
||||
<spacer name="verticalPadSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_vga2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>ValueDial</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>gui/valuedial.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>ButtonSwitch</class>
|
||||
<extends>QToolButton</extends>
|
||||
<header>gui/buttonswitch.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="../../../sdrbase/resources/res.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
204
plugins/samplesource/sdrplay/sdrplayinput.cpp
Normal file
204
plugins/samplesource/sdrplay/sdrplayinput.cpp
Normal file
@ -0,0 +1,204 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2016 Edouard Griffiths, F4EXB //
|
||||
// //
|
||||
// This program is free software; you can redistribute it and/or modify //
|
||||
// it under the terms of the GNU General Public License as published by //
|
||||
// the Free Software Foundation as version 3 of the License, or //
|
||||
// //
|
||||
// This program is distributed in the hope that it will be useful, //
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||
// GNU General Public License V3 for more details. //
|
||||
// //
|
||||
// You should have received a copy of the GNU General Public License //
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <QDebug>
|
||||
|
||||
#include "util/simpleserializer.h"
|
||||
#include "dsp/dspcommands.h"
|
||||
#include "dsp/dspengine.h"
|
||||
#include "sdrplaygui.h"
|
||||
#include "sdrplayinput.h"
|
||||
|
||||
#include <device/devicesourceapi.h>
|
||||
|
||||
#include "sdrplaythread.h"
|
||||
|
||||
MESSAGE_CLASS_DEFINITION(SDRPlayInput::MsgConfigureSDRPlay, Message)
|
||||
MESSAGE_CLASS_DEFINITION(SDRPlayInput::MsgReportSDRPlay, Message)
|
||||
|
||||
SDRPlayInput::SDRPlayInput(DeviceSourceAPI *deviceAPI) :
|
||||
m_deviceAPI(deviceAPI),
|
||||
m_settings(),
|
||||
m_sdrPlayThread(0),
|
||||
m_deviceDescription("SDRPlay"),
|
||||
m_samplesPerPacket(4096)
|
||||
{
|
||||
}
|
||||
|
||||
SDRPlayInput::~SDRPlayInput()
|
||||
{
|
||||
stop();
|
||||
}
|
||||
|
||||
bool SDRPlayInput::init(const Message& cmd)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool SDRPlayInput::start(int device)
|
||||
{
|
||||
mir_sdr_ErrT r;
|
||||
QMutexLocker mutexLocker(&m_mutex);
|
||||
|
||||
if (!m_sampleFifo.setSize(96000 * 4))
|
||||
{
|
||||
qCritical("SDRPlayInput::start: could not allocate SampleFifo");
|
||||
return false;
|
||||
}
|
||||
|
||||
if((m_sdrPlayThread = new SDRPlayThread(&m_sampleFifo)) == 0)
|
||||
{
|
||||
qFatal("SDRPlayInput::start: failed to create thread");
|
||||
return false;
|
||||
}
|
||||
|
||||
int agcSetPoint = m_settings.m_gainRedctionIndex;
|
||||
double sampleRateMHz = SDRPlaySampleRates::getRate(m_settings.m_devSampleRateIndex) / 1e3;
|
||||
double frequencyMHz = m_settings.m_centerFrequency / 1e6;
|
||||
int infoOverallGr;
|
||||
|
||||
mir_sdr_DCoffsetIQimbalanceControl(1, 0);
|
||||
mir_sdr_AgcControl(mir_sdr_AGC_DISABLE, agcSetPoint, 0, 0, 0, 0, 1);
|
||||
|
||||
r = mir_sdr_StreamInit(
|
||||
&agcSetPoint,
|
||||
sampleRateMHz,
|
||||
frequencyMHz,
|
||||
mir_sdr_BW_1_536,
|
||||
mir_sdr_IF_Zero,
|
||||
1, /* LNA */
|
||||
&infoOverallGr,
|
||||
0, /* use internal gr tables according to band */
|
||||
&m_samplesPerPacket,
|
||||
m_sdrPlayThread->streamCallback,
|
||||
callbackGC,
|
||||
0);
|
||||
|
||||
m_sdrPlayThread->startWork();
|
||||
}
|
||||
|
||||
void SDRPlayInput::stop()
|
||||
{
|
||||
mir_sdr_ErrT r;
|
||||
QMutexLocker mutexLocker(&m_mutex);
|
||||
|
||||
r = mir_sdr_StreamUninit();
|
||||
|
||||
if (r != mir_sdr_Success)
|
||||
{
|
||||
qCritical("SDRPlayInput::stop: stream uninit failed with code %d", (int) r);
|
||||
}
|
||||
|
||||
if(m_sdrPlayThread != 0)
|
||||
{
|
||||
m_sdrPlayThread->stopWork();
|
||||
delete m_sdrPlayThread;
|
||||
m_sdrPlayThread = 0;
|
||||
}
|
||||
}
|
||||
|
||||
const QString& SDRPlayInput::getDeviceDescription() const
|
||||
{
|
||||
return m_deviceDescription;
|
||||
}
|
||||
|
||||
int SDRPlayInput::getSampleRate() const
|
||||
{
|
||||
int rate = SDRPlaySampleRates::getRate(m_settings.m_devSampleRateIndex);
|
||||
return ((rate * 1000) / (1<<m_settings.m_log2Decim));
|
||||
}
|
||||
|
||||
quint64 SDRPlayInput::getCenterFrequency() const
|
||||
{
|
||||
return m_settings.m_centerFrequency;
|
||||
}
|
||||
|
||||
bool SDRPlayInput::handleMessage(const Message& message)
|
||||
{
|
||||
if (MsgConfigureSDRPlay::match(message))
|
||||
{
|
||||
MsgConfigureSDRPlay& conf = (MsgConfigureSDRPlay&) message;
|
||||
qDebug() << "SDRPlayInput::handleMessage: MsgConfigureSDRPlay";
|
||||
|
||||
bool success = applySettings(conf.getSettings(), false);
|
||||
|
||||
if (!success)
|
||||
{
|
||||
qDebug("SDRPlayInput::handleMessage: config error");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool SDRPlayInput::applySettings(const SDRPlaySettings& settings, bool force)
|
||||
{
|
||||
bool forwardChange = false;
|
||||
QMutexLocker mutexLocker(&m_mutex);
|
||||
|
||||
if (m_settings.m_dcBlock != settings.m_dcBlock)
|
||||
{
|
||||
m_settings.m_dcBlock = settings.m_dcBlock;
|
||||
m_deviceAPI->configureCorrections(m_settings.m_dcBlock, m_settings.m_iqCorrection);
|
||||
}
|
||||
|
||||
if (m_settings.m_iqCorrection != settings.m_iqCorrection)
|
||||
{
|
||||
m_settings.m_iqCorrection = settings.m_iqCorrection;
|
||||
m_deviceAPI->configureCorrections(m_settings.m_dcBlock, m_settings.m_iqCorrection);
|
||||
}
|
||||
|
||||
if ((m_settings.m_log2Decim != settings.m_log2Decim) || force)
|
||||
{
|
||||
m_settings.m_log2Decim = settings.m_log2Decim;
|
||||
forwardChange = true;
|
||||
|
||||
if (m_sdrPlayThread != 0)
|
||||
{
|
||||
m_sdrPlayThread->setLog2Decimation(m_settings.m_log2Decim);
|
||||
qDebug() << "SDRPlayInput: set decimation to " << (1<<m_settings.m_log2Decim);
|
||||
}
|
||||
}
|
||||
|
||||
if ((m_settings.m_fcPos != settings.m_fcPos) || force)
|
||||
{
|
||||
m_settings.m_fcPos = settings.m_fcPos;
|
||||
|
||||
if (m_sdrPlayThread != 0)
|
||||
{
|
||||
m_sdrPlayThread->setFcPos((int) m_settings.m_fcPos);
|
||||
qDebug() << "SDRPlayInput: set fc pos (enum) to " << (int) m_settings.m_fcPos;
|
||||
}
|
||||
}
|
||||
|
||||
if (forwardChange)
|
||||
{
|
||||
int sampleRate = getSampleRate();
|
||||
DSPSignalNotification *notif = new DSPSignalNotification(sampleRate, m_settings.m_centerFrequency);
|
||||
m_deviceAPI->getDeviceInputMessageQueue()->push(notif);
|
||||
}
|
||||
}
|
||||
|
||||
void SDRPlayInput::callbackGC(unsigned int gRdB, unsigned int lnaGRdB, void *cbContext)
|
||||
{
|
||||
return;
|
||||
}
|
92
plugins/samplesource/sdrplay/sdrplayinput.h
Normal file
92
plugins/samplesource/sdrplay/sdrplayinput.h
Normal file
@ -0,0 +1,92 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2016 Edouard Griffiths, F4EXB //
|
||||
// //
|
||||
// This program is free software; you can redistribute it and/or modify //
|
||||
// it under the terms of the GNU General Public License as published by //
|
||||
// the Free Software Foundation as version 3 of the License, or //
|
||||
// //
|
||||
// This program is distributed in the hope that it will be useful, //
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||
// GNU General Public License V3 for more details. //
|
||||
// //
|
||||
// You should have received a copy of the GNU General Public License //
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef PLUGINS_SAMPLESOURCE_SDRPLAY_SDRPLAYINPUT_H_
|
||||
#define PLUGINS_SAMPLESOURCE_SDRPLAY_SDRPLAYINPUT_H_
|
||||
|
||||
#include <dsp/devicesamplesource.h>
|
||||
|
||||
#include "sdrplaysettings.h"
|
||||
#include <mirsdrapi-rsp.h>
|
||||
#include <QString>
|
||||
|
||||
class DeviceSourceAPI;
|
||||
class SDRPlayThread;
|
||||
|
||||
class SDRPlayInput : public DeviceSampleSource {
|
||||
public:
|
||||
class MsgConfigureSDRPlay : public Message {
|
||||
MESSAGE_CLASS_DECLARATION
|
||||
|
||||
public:
|
||||
const SDRPlaySettings& getSettings() const { return m_settings; }
|
||||
|
||||
static MsgConfigureSDRPlay* create(const SDRPlaySettings& settings)
|
||||
{
|
||||
return new MsgConfigureSDRPlay(settings);
|
||||
}
|
||||
|
||||
private:
|
||||
SDRPlaySettings m_settings;
|
||||
|
||||
MsgConfigureSDRPlay(const SDRPlaySettings& settings) :
|
||||
Message(),
|
||||
m_settings(settings)
|
||||
{ }
|
||||
};
|
||||
|
||||
class MsgReportSDRPlay : public Message {
|
||||
MESSAGE_CLASS_DECLARATION
|
||||
|
||||
public:
|
||||
static MsgReportSDRPlay* create()
|
||||
{
|
||||
return new MsgReportSDRPlay();
|
||||
}
|
||||
|
||||
protected:
|
||||
MsgReportSDRPlay() :
|
||||
Message()
|
||||
{ }
|
||||
};
|
||||
|
||||
SDRPlayInput(DeviceSourceAPI *deviceAPI);
|
||||
virtual ~SDRPlayInput();
|
||||
|
||||
virtual bool init(const Message& message);
|
||||
virtual bool start(int device);
|
||||
virtual void stop();
|
||||
|
||||
virtual const QString& getDeviceDescription() const;
|
||||
virtual int getSampleRate() const;
|
||||
virtual quint64 getCenterFrequency() const;
|
||||
|
||||
virtual bool handleMessage(const Message& message);
|
||||
|
||||
private:
|
||||
bool applySettings(const SDRPlaySettings& settings, bool force);
|
||||
static void callbackGC(unsigned int gRdB, unsigned int lnaGRdB, void *cbContext);
|
||||
|
||||
DeviceSourceAPI *m_deviceAPI;
|
||||
QMutex m_mutex;
|
||||
SDRPlaySettings m_settings;
|
||||
SDRPlayThread* m_sdrPlayThread;
|
||||
QString m_deviceDescription;
|
||||
|
||||
int m_samplesPerPacket;
|
||||
};
|
||||
|
||||
#endif /* PLUGINS_SAMPLESOURCE_SDRPLAY_SDRPLAYINPUT_H_ */
|
111
plugins/samplesource/sdrplay/sdrplayplugin.cpp
Normal file
111
plugins/samplesource/sdrplay/sdrplayplugin.cpp
Normal file
@ -0,0 +1,111 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2016 Edouard Griffiths, F4EXB //
|
||||
// //
|
||||
// This program is free software; you can redistribute it and/or modify //
|
||||
// it under the terms of the GNU General Public License as published by //
|
||||
// the Free Software Foundation as version 3 of the License, or //
|
||||
// //
|
||||
// This program is distributed in the hope that it will be useful, //
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||
// GNU General Public License V3 for more details. //
|
||||
// //
|
||||
// You should have received a copy of the GNU General Public License //
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <QtPlugin>
|
||||
#include <QAction>
|
||||
#include <libusb-1.0/libusb.h>
|
||||
#include "plugin/pluginapi.h"
|
||||
#include "util/simpleserializer.h"
|
||||
#include "sdrplaygui.h"
|
||||
#include "sdrplayplugin.h"
|
||||
#include <device/devicesourceapi.h>
|
||||
|
||||
const PluginDescriptor SDRPlayPlugin::m_pluginDescriptor = {
|
||||
QString("SDRPlay Input"),
|
||||
QString("2.3.0"),
|
||||
QString("(c) Edouard Griffiths, F4EXB"),
|
||||
QString("https://github.com/f4exb/sdrangel"),
|
||||
true,
|
||||
QString("https://github.com/f4exb/sdrangel")
|
||||
};
|
||||
|
||||
const QString SDRPlayPlugin::m_deviceTypeID = SDRPLAY_DEVICE_TYPE_ID;
|
||||
|
||||
SDRPlayPlugin::SDRPlayPlugin(QObject* parent) :
|
||||
QObject(parent)
|
||||
{
|
||||
}
|
||||
|
||||
const PluginDescriptor& SDRPlayPlugin::getPluginDescriptor() const
|
||||
{
|
||||
return m_pluginDescriptor;
|
||||
}
|
||||
|
||||
void SDRPlayPlugin::initPlugin(PluginAPI* pluginAPI)
|
||||
{
|
||||
pluginAPI->registerSampleSource(m_deviceTypeID, this);
|
||||
}
|
||||
|
||||
PluginInterface::SamplingDevices SDRPlayPlugin::enumSampleSources()
|
||||
{
|
||||
// USB device:
|
||||
// New USB device found, idVendor=1df7, idProduct=2500
|
||||
// New USB device strings: Mfr=0, Product=0, SerialNumber=0
|
||||
|
||||
libusb_context *usb_context = 0;
|
||||
ssize_t num_devs;
|
||||
SamplingDevices result;
|
||||
libusb_device **devs;
|
||||
libusb_device *dev;
|
||||
int i = 0;
|
||||
|
||||
if (libusb_init(&usb_context)) {
|
||||
return result;
|
||||
}
|
||||
|
||||
num_devs = libusb_get_device_list(usb_context, &devs);
|
||||
|
||||
if (num_devs > 0)
|
||||
{
|
||||
while ((dev = devs[i++]) != 0)
|
||||
{
|
||||
struct libusb_device_descriptor desc;
|
||||
struct libusb_config_descriptor *conf_desc = 0;
|
||||
int res = libusb_get_device_descriptor(dev, &desc);
|
||||
unsigned short dev_vid = desc.idVendor;
|
||||
unsigned short dev_pid = desc.idProduct;
|
||||
|
||||
if ((dev_vid == 0x1df7) && (dev_pid == 0x2500))
|
||||
{
|
||||
QString displayedName(QString("SDRPlay[0] 0"));
|
||||
|
||||
result.append(SamplingDevice(displayedName,
|
||||
m_deviceTypeID,
|
||||
QString("0"),
|
||||
0));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
libusb_free_device_list(devs, 1);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
PluginGUI* SDRPlayPlugin::createSampleSourcePluginGUI(const QString& sourceId,QWidget **widget, DeviceSourceAPI *deviceAPI)
|
||||
{
|
||||
if(sourceId == m_deviceTypeID)
|
||||
{
|
||||
SDRPlayGui* gui = new SDRPlayGui(deviceAPI);
|
||||
*widget = gui;
|
||||
return gui;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
47
plugins/samplesource/sdrplay/sdrplayplugin.h
Normal file
47
plugins/samplesource/sdrplay/sdrplayplugin.h
Normal file
@ -0,0 +1,47 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2016 Edouard Griffiths, F4EXB //
|
||||
// //
|
||||
// This program is free software; you can redistribute it and/or modify //
|
||||
// it under the terms of the GNU General Public License as published by //
|
||||
// the Free Software Foundation as version 3 of the License, or //
|
||||
// //
|
||||
// This program is distributed in the hope that it will be useful, //
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||
// GNU General Public License V3 for more details. //
|
||||
// //
|
||||
// You should have received a copy of the GNU General Public License //
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef PLUGINS_SAMPLESOURCE_SDRPLAY_SDRPLAYPLUGIN_H_
|
||||
#define PLUGINS_SAMPLESOURCE_SDRPLAY_SDRPLAYPLUGIN_H_
|
||||
|
||||
#include <QObject>
|
||||
#include "plugin/plugininterface.h"
|
||||
|
||||
class PluginAPI;
|
||||
|
||||
#define SDRPLAY_DEVICE_TYPE_ID "sdrangel.samplesource.sdrplay"
|
||||
|
||||
class SDRPlayPlugin : public QObject, public PluginInterface {
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(PluginInterface)
|
||||
Q_PLUGIN_METADATA(IID SDRPLAY_DEVICE_TYPE_ID)
|
||||
|
||||
public:
|
||||
explicit SDRPlayPlugin(QObject* parent = NULL);
|
||||
|
||||
const PluginDescriptor& getPluginDescriptor() const;
|
||||
void initPlugin(PluginAPI* pluginAPI);
|
||||
|
||||
virtual SamplingDevices enumSampleSources();
|
||||
virtual PluginGUI* createSampleSourcePluginGUI(const QString& sourceId, QWidget **widget, DeviceSourceAPI *deviceAPI);
|
||||
|
||||
static const QString m_deviceTypeID;
|
||||
|
||||
private:
|
||||
static const PluginDescriptor m_pluginDescriptor;
|
||||
};
|
||||
|
||||
#endif /* PLUGINS_SAMPLESOURCE_SDRPLAY_SDRPLAYPLUGIN_H_ */
|
99
plugins/samplesource/sdrplay/sdrplaysettings.cpp
Normal file
99
plugins/samplesource/sdrplay/sdrplaysettings.cpp
Normal file
@ -0,0 +1,99 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2015 Edouard Griffiths, F4EXB //
|
||||
// //
|
||||
// This program is free software; you can redistribute it and/or modify //
|
||||
// it under the terms of the GNU General Public License as published by //
|
||||
// the Free Software Foundation as version 3 of the License, or //
|
||||
// //
|
||||
// This program is distributed in the hope that it will be useful, //
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||
// GNU General Public License V3 for more details. //
|
||||
// //
|
||||
// You should have received a copy of the GNU General Public License //
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "sdrplaysettings.h"
|
||||
|
||||
#include <QtGlobal>
|
||||
#include "util/simpleserializer.h"
|
||||
|
||||
SDRPlaySettings::SDRPlaySettings()
|
||||
{
|
||||
resetToDefaults();
|
||||
}
|
||||
|
||||
void SDRPlaySettings::resetToDefaults()
|
||||
{
|
||||
m_centerFrequency = 7040*1000;
|
||||
m_LOppmTenths = 0;
|
||||
m_frequencyBandIndex = 0;
|
||||
m_ifFrequencyIndex = 0;
|
||||
m_mirDcCorrIndex = 0;
|
||||
m_mirDcCorrTrackTimeIndex = 1;
|
||||
m_bandwidthIndex = 0;
|
||||
m_devSampleRateIndex = 0;
|
||||
m_gainRedctionIndex = 35;
|
||||
m_log2Decim = 0;
|
||||
m_fcPos = FC_POS_CENTER;
|
||||
m_dcBlock = false;
|
||||
m_iqCorrection = false;
|
||||
}
|
||||
|
||||
QByteArray SDRPlaySettings::serialize() const
|
||||
{
|
||||
SimpleSerializer s(1);
|
||||
|
||||
s.writeS32(1, m_LOppmTenths);
|
||||
s.writeU32(2, m_frequencyBandIndex);
|
||||
s.writeU32(3, m_ifFrequencyIndex);
|
||||
s.writeU32(4, m_mirDcCorrIndex);
|
||||
s.writeU32(5, m_mirDcCorrTrackTimeIndex);
|
||||
s.writeU32(6, m_bandwidthIndex);
|
||||
s.writeU32(7, m_devSampleRateIndex);
|
||||
s.writeU32(8, m_gainRedctionIndex);
|
||||
s.writeU32(9, m_log2Decim);
|
||||
s.writeS32(10, (int) m_fcPos);
|
||||
s.writeBool(11, m_dcBlock);
|
||||
s.writeBool(12, m_iqCorrection);
|
||||
|
||||
return s.final();
|
||||
}
|
||||
|
||||
bool SDRPlaySettings::deserialize(const QByteArray& data)
|
||||
{
|
||||
SimpleDeserializer d(data);
|
||||
|
||||
if (!d.isValid())
|
||||
{
|
||||
resetToDefaults();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (d.getVersion() == 1)
|
||||
{
|
||||
int intval;
|
||||
|
||||
d.readS32(1, &m_LOppmTenths, 0);
|
||||
d.readU32(2, &m_frequencyBandIndex, 0);
|
||||
d.readU32(3, &m_ifFrequencyIndex, 0);
|
||||
d.readU32(4, &m_mirDcCorrIndex, 0);
|
||||
d.readU32(5, &m_mirDcCorrTrackTimeIndex, 1);
|
||||
d.readU32(6, &m_bandwidthIndex, 0);
|
||||
d.readU32(7, &m_devSampleRateIndex, 0);
|
||||
d.readU32(8, &m_gainRedctionIndex, 35);
|
||||
d.readU32(9, &m_log2Decim, 0);
|
||||
d.readS32(10, &intval, 0);
|
||||
m_fcPos = (fcPos_t) intval;
|
||||
d.readBool(11, &m_dcBlock, false);
|
||||
d.readBool(12, &m_iqCorrection, false);
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
resetToDefaults();
|
||||
return false;
|
||||
}
|
||||
}
|
50
plugins/samplesource/sdrplay/sdrplaysettings.h
Normal file
50
plugins/samplesource/sdrplay/sdrplaysettings.h
Normal file
@ -0,0 +1,50 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2016 Edouard Griffiths, F4EXB //
|
||||
// //
|
||||
// This program is free software; you can redistribute it and/or modify //
|
||||
// it under the terms of the GNU General Public License as published by //
|
||||
// the Free Software Foundation as version 3 of the License, or //
|
||||
// //
|
||||
// This program is distributed in the hope that it will be useful, //
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||
// GNU General Public License V3 for more details. //
|
||||
// //
|
||||
// You should have received a copy of the GNU General Public License //
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _SDRPLAY_SDRPLAYSETTINGS_H_
|
||||
#define _SDRPLAY_SDRPLAYSETTINGS_H_
|
||||
|
||||
#include <stdint.h>
|
||||
#include <QByteArray>
|
||||
|
||||
struct SDRPlaySettings {
|
||||
typedef enum {
|
||||
FC_POS_INFRA = 0,
|
||||
FC_POS_SUPRA,
|
||||
FC_POS_CENTER
|
||||
} fcPos_t;
|
||||
|
||||
uint64_t m_centerFrequency;
|
||||
int32_t m_LOppmTenths;
|
||||
uint32_t m_frequencyBandIndex;
|
||||
uint32_t m_ifFrequencyIndex;
|
||||
uint32_t m_mirDcCorrIndex;
|
||||
uint32_t m_mirDcCorrTrackTimeIndex;
|
||||
uint32_t m_bandwidthIndex;
|
||||
uint32_t m_devSampleRateIndex;
|
||||
uint32_t m_gainRedctionIndex;
|
||||
uint32_t m_log2Decim;
|
||||
fcPos_t m_fcPos;
|
||||
bool m_dcBlock;
|
||||
bool m_iqCorrection;
|
||||
|
||||
SDRPlaySettings();
|
||||
void resetToDefaults();
|
||||
QByteArray serialize() const;
|
||||
bool deserialize(const QByteArray& data);
|
||||
};
|
||||
|
||||
#endif /* _SDRPLAY_SDRPLAYSETTINGS_H_ */
|
193
plugins/samplesource/sdrplay/sdrplaythread.cpp
Normal file
193
plugins/samplesource/sdrplay/sdrplaythread.cpp
Normal file
@ -0,0 +1,193 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2016 Edouard Griffiths, F4EXB //
|
||||
// //
|
||||
// This program is free software; you can redistribute it and/or modify //
|
||||
// it under the terms of the GNU General Public License as published by //
|
||||
// the Free Software Foundation as version 3 of the License, or //
|
||||
// //
|
||||
// This program is distributed in the hope that it will be useful, //
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||
// GNU General Public License V3 for more details. //
|
||||
// //
|
||||
// You should have received a copy of the GNU General Public License //
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include "sdrplaythread.h"
|
||||
#include "dsp/samplesinkfifo.h"
|
||||
|
||||
SDRPlayThread *SDRPlayThread::m_this = 0;
|
||||
|
||||
SDRPlayThread::SDRPlayThread(SampleSinkFifo* sampleFifo, QObject* parent) :
|
||||
QThread(parent),
|
||||
m_running(false),
|
||||
m_convertBuffer(SDRPLAY_INIT_NBSAMPLES),
|
||||
m_sampleFifo(sampleFifo),
|
||||
m_log2Decim(0),
|
||||
m_fcPos(0)
|
||||
{
|
||||
m_this = this;
|
||||
}
|
||||
|
||||
SDRPlayThread::~SDRPlayThread()
|
||||
{
|
||||
stopWork();
|
||||
m_this = 0;
|
||||
}
|
||||
|
||||
void SDRPlayThread::startWork()
|
||||
{
|
||||
m_startWaitMutex.lock();
|
||||
start();
|
||||
while(!m_running)
|
||||
m_startWaiter.wait(&m_startWaitMutex, 100);
|
||||
m_startWaitMutex.unlock();
|
||||
}
|
||||
|
||||
void SDRPlayThread::stopWork()
|
||||
{
|
||||
m_running = false;
|
||||
wait();
|
||||
}
|
||||
|
||||
void SDRPlayThread::setLog2Decimation(unsigned int log2_decim)
|
||||
{
|
||||
m_log2Decim = log2_decim;
|
||||
}
|
||||
|
||||
void SDRPlayThread::setFcPos(int fcPos)
|
||||
{
|
||||
m_fcPos = fcPos;
|
||||
}
|
||||
|
||||
void SDRPlayThread::streamCallback(
|
||||
short *xi,
|
||||
short *xq,
|
||||
unsigned int firstSampleNum,
|
||||
int grChanged,
|
||||
int rfChanged,
|
||||
int fsChanged,
|
||||
unsigned int numSamples,
|
||||
unsigned int reset,
|
||||
void *cbContext)
|
||||
{
|
||||
m_this->callback(xi, xq, numSamples);
|
||||
}
|
||||
|
||||
void SDRPlayThread::callback(short *xi, short *xq, unsigned int numSamples)
|
||||
{
|
||||
if (m_convertBuffer.size() < numSamples)
|
||||
{
|
||||
m_convertBuffer.resize(numSamples);
|
||||
}
|
||||
|
||||
SampleVector::iterator it = m_convertBuffer.begin();
|
||||
|
||||
if (m_log2Decim == 0)
|
||||
{
|
||||
m_decimators.decimate1(&it, xi, xq, numSamples);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_fcPos == 0) // Infra
|
||||
{
|
||||
switch (m_log2Decim)
|
||||
{
|
||||
case 1:
|
||||
m_decimators.decimate2_inf(&it, xi, xq, numSamples);
|
||||
break;
|
||||
case 2:
|
||||
m_decimators.decimate4_inf(&it, xi, xq, numSamples);
|
||||
break;
|
||||
case 3:
|
||||
m_decimators.decimate8_inf(&it, xi, xq, numSamples);
|
||||
break;
|
||||
case 4:
|
||||
m_decimators.decimate16_inf(&it, xi, xq, numSamples);
|
||||
break;
|
||||
case 5:
|
||||
m_decimators.decimate32_inf(&it, xi, xq, numSamples);
|
||||
break;
|
||||
case 6:
|
||||
m_decimators.decimate64_inf(&it, xi, xq, numSamples);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (m_fcPos == 1) // Supra
|
||||
{
|
||||
switch (m_log2Decim)
|
||||
{
|
||||
case 1:
|
||||
m_decimators.decimate2_sup(&it, xi, xq, numSamples);
|
||||
break;
|
||||
case 2:
|
||||
m_decimators.decimate4_sup(&it, xi, xq, numSamples);
|
||||
break;
|
||||
case 3:
|
||||
m_decimators.decimate8_sup(&it, xi, xq, numSamples);
|
||||
break;
|
||||
case 4:
|
||||
m_decimators.decimate16_sup(&it, xi, xq, numSamples);
|
||||
break;
|
||||
case 5:
|
||||
m_decimators.decimate32_sup(&it, xi, xq, numSamples);
|
||||
break;
|
||||
case 6:
|
||||
m_decimators.decimate64_sup(&it, xi, xq, numSamples);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (m_fcPos == 2) // Center
|
||||
{
|
||||
switch (m_log2Decim)
|
||||
{
|
||||
case 1:
|
||||
m_decimators.decimate2_cen(&it, xi, xq, numSamples);
|
||||
break;
|
||||
case 2:
|
||||
m_decimators.decimate4_cen(&it, xi, xq, numSamples);
|
||||
break;
|
||||
case 3:
|
||||
m_decimators.decimate8_cen(&it, xi, xq, numSamples);
|
||||
break;
|
||||
case 4:
|
||||
m_decimators.decimate16_cen(&it, xi, xq, numSamples);
|
||||
break;
|
||||
case 5:
|
||||
m_decimators.decimate32_cen(&it, xi, xq, numSamples);
|
||||
break;
|
||||
case 6:
|
||||
m_decimators.decimate64_cen(&it, xi, xq, numSamples);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_sampleFifo->write(m_convertBuffer.begin(), it);
|
||||
}
|
||||
|
||||
void SDRPlayThread::run()
|
||||
{
|
||||
int res;
|
||||
|
||||
m_running = true;
|
||||
m_startWaiter.wakeAll();
|
||||
|
||||
while(m_running)
|
||||
{
|
||||
sleep(1);
|
||||
}
|
||||
|
||||
m_running = false;
|
||||
}
|
||||
|
||||
|
70
plugins/samplesource/sdrplay/sdrplaythread.h
Normal file
70
plugins/samplesource/sdrplay/sdrplaythread.h
Normal file
@ -0,0 +1,70 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2016 Edouard Griffiths, F4EXB //
|
||||
// //
|
||||
// This program is free software; you can redistribute it and/or modify //
|
||||
// it under the terms of the GNU General Public License as published by //
|
||||
// the Free Software Foundation as version 3 of the License, or //
|
||||
// //
|
||||
// This program is distributed in the hope that it will be useful, //
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||
// GNU General Public License V3 for more details. //
|
||||
// //
|
||||
// You should have received a copy of the GNU General Public License //
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef PLUGINS_SAMPLESOURCE_SDRPLAY_SDRPLAYTHREAD_H_
|
||||
#define PLUGINS_SAMPLESOURCE_SDRPLAY_SDRPLAYTHREAD_H_
|
||||
|
||||
#include <QThread>
|
||||
#include <QMutex>
|
||||
#include <QWaitCondition>
|
||||
#include <mirsdrapi-rsp.h>
|
||||
#include "dsp/samplesinkfifo.h"
|
||||
#include "dsp/decimators.h"
|
||||
|
||||
#define SDRPLAY_INIT_NBSAMPLES (1<<14)
|
||||
|
||||
class SDRPlayThread : public QThread {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
SDRPlayThread(SampleSinkFifo* sampleFifo, QObject* parent = NULL);
|
||||
~SDRPlayThread();
|
||||
|
||||
void startWork();
|
||||
void stopWork();
|
||||
void setLog2Decimation(unsigned int log2_decim);
|
||||
void setFcPos(int fcPos);
|
||||
|
||||
static void streamCallback (
|
||||
short *xi,
|
||||
short *xq,
|
||||
unsigned int firstSampleNum,
|
||||
int grChanged,
|
||||
int rfChanged,
|
||||
int fsChanged,
|
||||
unsigned int numSamples,
|
||||
unsigned int reset,
|
||||
void *cbContext);
|
||||
|
||||
private:
|
||||
QMutex m_startWaitMutex;
|
||||
QWaitCondition m_startWaiter;
|
||||
bool m_running;
|
||||
|
||||
SampleVector m_convertBuffer;
|
||||
SampleSinkFifo* m_sampleFifo;
|
||||
|
||||
unsigned int m_log2Decim;
|
||||
int m_fcPos;
|
||||
static SDRPlayThread *m_this;
|
||||
|
||||
Decimators<qint16, SDR_SAMP_SZ, 12> m_decimators;
|
||||
|
||||
void run();
|
||||
void callback(short *xi, short *xq, unsigned int numSamples);
|
||||
};
|
||||
|
||||
#endif /* PLUGINS_SAMPLESOURCE_SDRPLAY_SDRPLAYTHREAD_H_ */
|
File diff suppressed because it is too large
Load Diff
@ -84,7 +84,7 @@
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p>Version 2.2.2 - Copyright (C) 2015-2016 Edouard Griffiths, F4EXB. </p><p>Code at <a href="https://github.com/f4exb/sdrangel"><span style=" text-decoration: underline; color:#0000ff;">https://github.com/f4exb/sdrangel</span></a> This is a complete redesign from RTL-SDRangelove at <a href="https://github.com/hexameron/rtl-sdrangelove"><span style=" text-decoration: underline; color:#0000ff;">https://github.com/hexameron/rtl-sdrangelove</span></a></p><p>Many thanks to the original developers:</p><p>The osmocom developer team - especially horizon, Hoernchen &amp; tnt.</p><p>Christian Daniel from maintech GmbH.</p><p>John Greb (hexameron) for the contributions in RTL-SDRangelove</p><p>The following rules apply to the SDRangel main application and libsdrbase:<br/>This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program 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. You should have received a copy of the GNU General Public License along with this program. If not, see <a href="http://www.gnu.org/licenses/"><span style=" text-decoration: underline; color:#0000ff;">http://www.gnu.org/licenses/</span></a>.</p><p>For the license of installed plugins, look into the plugin list.</p></body></html></string>
|
||||
<string><html><head/><body><p>Version 2.3.0 - Copyright (C) 2015-2016 Edouard Griffiths, F4EXB. </p><p>Code at <a href="https://github.com/f4exb/sdrangel"><span style=" text-decoration: underline; color:#0000ff;">https://github.com/f4exb/sdrangel</span></a> This is a complete redesign from RTL-SDRangelove at <a href="https://github.com/hexameron/rtl-sdrangelove"><span style=" text-decoration: underline; color:#0000ff;">https://github.com/hexameron/rtl-sdrangelove</span></a></p><p>Many thanks to the original developers:</p><p>The osmocom developer team - especially horizon, Hoernchen &amp; tnt.</p><p>Christian Daniel from maintech GmbH.</p><p>John Greb (hexameron) for the contributions in RTL-SDRangelove</p><p>The following rules apply to the SDRangel main application and libsdrbase:<br/>This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program 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. You should have received a copy of the GNU General Public License along with this program. If not, see <a href="http://www.gnu.org/licenses/"><span style=" text-decoration: underline; color:#0000ff;">http://www.gnu.org/licenses/</span></a>.</p><p>For the license of installed plugins, look into the plugin list.</p></body></html></string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
|
@ -450,7 +450,7 @@ void MainWindow::savePresetSettings(Preset* preset, int tabIndex)
|
||||
void MainWindow::createStatusBar()
|
||||
{
|
||||
QString qtVersionStr = QString("Qt %1 ").arg(QT_VERSION_STR);
|
||||
m_showSystemWidget = new QLabel("SDRangel v2.2.2 " + qtVersionStr + QSysInfo::prettyProductName(), this);
|
||||
m_showSystemWidget = new QLabel("SDRangel v2.3.0 " + qtVersionStr + QSysInfo::prettyProductName(), this);
|
||||
statusBar()->addPermanentWidget(m_showSystemWidget);
|
||||
|
||||
m_dateTimeWidget = new QLabel(tr("Date"), this);
|
||||
|
Loading…
Reference in New Issue
Block a user