diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..94303b2 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +CMakeLists.txt.user +build +.flatpak-builder +dsremoteRepo diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..a4849d5 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,109 @@ +# FILE_SET needs at least 3.23 +cmake_minimum_required(VERSION 3.23) + +project(DSRemote) +set(ID "net.teuniz.dsremote") + +find_package(QT NAMES Qt4 Qt5 Qt6 REQUIRED) +set(QT Qt${QT_VERSION_MAJOR}) + +if (QT_VERSION_MAJOR EQUAL 4) + if (QT_MINOR_VERSION LESS 7 OR (QT_MINOR_VERSION EQUAL 7 AND QT_PATCH_VERSION LESS 1)) + message(FATAL_ERROR "This project needs at least Qt4.7.1") + endif() +elseif( QT_VERSION_MAJOR EQUAL 5) + if (QT_MINOR_VERSION LESS 9 OR (QT_MINOR_VERSION EQUAL 9 AND QT_PATCH_VERSION LESS 1)) + message(FATAL_ERROR "This project needs at least Qt5.9.1") + endif() +endif() + +find_package(${QT} REQUIRED COMPONENTS Widgets Network) + +set(COMPILE_FLAGS "-Wextra -Wshadow -Wformat-nonliteral -Wformat -Wformat-security -Wtype-limits -Wfatal-errors") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${COMPILE_FLAGS}") + +add_compile_definitions(_LARGEFILE64_SOURCE _LARGEFILE_SOURCE) # needed in edflib + +add_subdirectory(third_party) + +set(HEADERS global.h + mainwindow.h + about_dialog.h + utils.h + connection.h + tmc_dev.h + tmc_lan.h + tled.h + edflib.h + signalcurve.h + settings_dialog.h + screen_thread.h + lan_connect_thread.h + read_settings_thread.h + save_data_thread.h + decode_dialog.h + tdial.h + wave_dialog.h + wave_view.h + playback_dialog.h) + +set(SOURCES main.cpp + mainwindow.cpp + mainwindow_constr.cpp + timer_handlers.cpp + save_data.cpp + interface.cpp + serial_decoder.cpp + about_dialog.cpp + utils.c + connection.cpp + tmc_dev.c + tmc_lan.c + tled.cpp + edflib.c + signalcurve.cpp + settings_dialog.cpp + screen_thread.cpp + lan_connect_thread.cpp + read_settings_thread.cpp + save_data_thread.cpp + decode_dialog.cpp + tdial.cpp + wave_dialog.cpp + wave_view.cpp + playback_dialog.cpp) + +set(RESOURCES images.qrc) + +add_executable(${PROJECT_NAME} ${SOURCES} ${RESOURCES}) +target_link_libraries(${PROJECT_NAME} ${QT}::Widgets ${QT}::Network kiss_fft) +set_property(TARGET ${PROJECT_NAME} PROPERTY AUTOMOC ON) +set_property(TARGET ${PROJECT_NAME} PROPERTY AUTORCC ON) +target_sources(${PROJECT_NAME} PRIVATE + FILE_SET HEADERS TYPE HEADERS BASE_DIRS ${CMAKE_CURRENT_SOURCE_DIR} FILES ${HEADERS}) + +install(TARGETS ${PROJECT_NAME}) + +if(UNIX AND NOT APPLE) + foreach(icon 32 64 128 256 512) + install( + FILES images/r_dsremote_${icon}x${icon}.png + DESTINATION share/icons/hicolor/${icon}x${icon}/apps + COMPONENT ${PROJECT_NAME} + RENAME ${ID}.png) + endforeach() + + install( + FILES install/${ID}.appdata.xml + DESTINATION share/metainfo + COMPONENT ${PROJECT_NAME} + ) + + install( + FILES install/${ID}.desktop + DESTINATION share/applications + COMPONENT ${PROJECT_NAME} + ) +endif() + + diff --git a/images/r.xcf b/images/r.xcf index 9331bf1..b2d1d1a 100644 Binary files a/images/r.xcf and b/images/r.xcf differ diff --git a/images/r_dsremote_128x128.png b/images/r_dsremote_128x128.png new file mode 100644 index 0000000..1b5d9b7 Binary files /dev/null and b/images/r_dsremote_128x128.png differ diff --git a/images/r_dsremote_256x256.png b/images/r_dsremote_256x256.png new file mode 100644 index 0000000..0ae8e6d Binary files /dev/null and b/images/r_dsremote_256x256.png differ diff --git a/images/r_dsremote_32x32.png b/images/r_dsremote_32x32.png new file mode 100644 index 0000000..6f8d434 Binary files /dev/null and b/images/r_dsremote_32x32.png differ diff --git a/images/r_dsremote_512x512.png b/images/r_dsremote_512x512.png new file mode 100644 index 0000000..1ad93f5 Binary files /dev/null and b/images/r_dsremote_512x512.png differ diff --git a/images/r_dsremote_64x64.png b/images/r_dsremote_64x64.png new file mode 100644 index 0000000..2016725 Binary files /dev/null and b/images/r_dsremote_64x64.png differ diff --git a/install/flatpak/build.sh b/install/flatpak/build.sh new file mode 100755 index 0000000..75b7fec --- /dev/null +++ b/install/flatpak/build.sh @@ -0,0 +1 @@ + flatpak-builder --force-clean --repo=dsremoteRepo build net.teuniz.dsremote.yml diff --git a/install/flatpak/install.sh b/install/flatpak/install.sh new file mode 100755 index 0000000..51c3a70 --- /dev/null +++ b/install/flatpak/install.sh @@ -0,0 +1,3 @@ +flatpak remove net.teuniz.dsremote +flatpak remote-add dsremoteRepo dsremoteRepo --no-gpg-verify +flatpak install dsremoteRepo net.teuniz.dsremote diff --git a/install/flatpak/net.teuniz.dsremote.yml b/install/flatpak/net.teuniz.dsremote.yml new file mode 100644 index 0000000..92f6882 --- /dev/null +++ b/install/flatpak/net.teuniz.dsremote.yml @@ -0,0 +1,25 @@ +app-id: net.teuniz.dsremote +runtime: org.kde.Platform +runtime-version: 6.4 +sdk: org.kde.Sdk +command: DSRemote +desktop-file-name-suffix: '' # used to create development version +finish-args: + - --socket=wayland + - --socket=fallback-x11 + - --filesystem=home # to save images + - --share=network # for the LAN connection needed + - --device=all # to access usb devices + +modules: + - name: DSRemote + buildsystem: cmake + builddir: true + sources: + - type: dir + path: ../.. + build-options: + cflags: -Wp,-U_FORTIFY_SOURCE # Remove _FORTIFY_SOURCE + cxxflags: -Wp,-U_FORTIFY_SOURCE + env: + CPPFLAGS: -Wp,-U_FORTIFY_SOURCE diff --git a/install/net.teuniz.dsremote.appdata.xml b/install/net.teuniz.dsremote.appdata.xml new file mode 100644 index 0000000..20123f7 --- /dev/null +++ b/install/net.teuniz.dsremote.appdata.xml @@ -0,0 +1,77 @@ + + + net.teuniz.dsremote + net.teuniz.dsremote.desktop + DSRemote + FSFAP + GPL-3.0+ + DSRemote is a program to control and visualize your RigolĀ® oscillosopes + + +

DSRemote is a program to control and visualize your RigolĀ® DS6000 or DS1000Z series oscilloscope from +your Linux desktop via USB or LAN. It will probably work as well with the other series like DS2000A and DS4000 series but +I have no access to all those oscilloscopes so I can not test it

+ +

Features:

+ + +
+ Teunis van Beelen + + + + https://www.teuniz.net/DSRemote/oscilloscope_decode.png + + + https://www.teuniz.net/DSRemote/oscilloscope_with_fft.png + + + + https://www.teuniz.net/DSRemote + https://gitlab.com/Teuniz/DSRemote/-/issues + https://gitlab.com/Teuniz/DSRemote/-/issues + + + + + Release + + + + + + + none + none + none + none + none + none + none + none + none + none + none + none + none + none + none + none + none + none + none + none + none + none + none + none + none + none + none + + +
diff --git a/install/net.teuniz.dsremote.desktop b/install/net.teuniz.dsremote.desktop new file mode 100644 index 0000000..42f62cf --- /dev/null +++ b/install/net.teuniz.dsremote.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Name=DSRemote +Comment=Operate your Rigol oscilloscope from your Linux desktop. +Exec=DSRemote +StartupWMClass=net.teuniz.dsremote +Icon=net.teuniz.dsremote +Terminal=false +Type=Application +Categories=Science;Application;Development; +X-Desktop-File-Install-Version=0.1 diff --git a/interface.cpp b/interface.cpp index 1bf9c9a..1fe0098 100644 --- a/interface.cpp +++ b/interface.cpp @@ -25,8 +25,7 @@ *************************************************************************** */ - - +#include "mainwindow.h" void UI_Mainwindow::navDialChanged(int npos) { diff --git a/mainwindow.cpp b/mainwindow.cpp index a5e751a..c0f91e4 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -27,13 +27,6 @@ #include "mainwindow.h" -#include "mainwindow_constr.cpp" -#include "timer_handlers.cpp" -#include "save_data.cpp" -#include "interface.cpp" -#include "serial_decoder.cpp" - - void UI_Mainwindow::open_settings_dialog() { @@ -91,7 +84,8 @@ void UI_Mainwindow::open_connection() device = tmc_open_usb(dev_str); if(device == NULL) { - snprintf(str, 4096, "Can not open device %s", dev_str); + char* msg = strerror(errno); + snprintf(str, 4096, "Can not open device %s: %s", dev_str, msg); goto OC_OUT_ERROR; } } diff --git a/save_data.cpp b/save_data.cpp index 115f237..5b48a1d 100644 --- a/save_data.cpp +++ b/save_data.cpp @@ -25,6 +25,7 @@ *************************************************************************** */ +#include "mainwindow.h" #define SAV_MEM_BSZ (250000) diff --git a/serial_decoder.cpp b/serial_decoder.cpp index 838f222..7965f55 100644 --- a/serial_decoder.cpp +++ b/serial_decoder.cpp @@ -53,7 +53,7 @@ *************************************************************************** */ - +#include "mainwindow.h" void UI_Mainwindow::serial_decoder(struct device_settings *d_parms) diff --git a/third_party/CMakeLists.txt b/third_party/CMakeLists.txt new file mode 100644 index 0000000..0f65dae --- /dev/null +++ b/third_party/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(kiss_fft) diff --git a/third_party/kiss_fft/CMakeLists.txt b/third_party/kiss_fft/CMakeLists.txt new file mode 100644 index 0000000..3fd825d --- /dev/null +++ b/third_party/kiss_fft/CMakeLists.txt @@ -0,0 +1,5 @@ +add_library(kiss_fft kiss_fft.c kiss_fftr.c) +target_sources(kiss_fft INTERFACE + FILE_SET HEADERS TYPE HEADERS BASE_DIRS ${CMAKE_CURRENT_SOURCE_DIR} FILES kiss_fft.h kiss_fftr.h) +target_sources(kiss_fft PRIVATE + FILE_SET private_headers TYPE HEADERS BASE_DIRS ${CMAKE_CURRENT_SOURCE_DIR} FILES _kiss_fft_guts.h) diff --git a/timer_handlers.cpp b/timer_handlers.cpp index a98bca4..b265c05 100644 --- a/timer_handlers.cpp +++ b/timer_handlers.cpp @@ -25,7 +25,7 @@ *************************************************************************** */ - +#include "mainwindow.h" void UI_Mainwindow::test_timer_handler() diff --git a/tmc_lan.c b/tmc_lan.c index 2e060c4..b47ad59 100644 --- a/tmc_lan.c +++ b/tmc_lan.c @@ -209,6 +209,8 @@ struct tmcdev * tmclan_open(const char *host_or_ip) if(connect(sockfd, (struct sockaddr *) &inet_address, sizeof(struct sockaddr)) < 0) { + char* err = strerror(errno); + printf("Unable to connect to device %s: %s", ip_address, err); return NULL; }