From 7e369976b51f3971741a9efc6896d9809715d8c4 Mon Sep 17 00:00:00 2001 From: Edward Emelianov Date: Fri, 15 May 2026 14:44:21 +0300 Subject: [PATCH] weather check for astrosib dome daemon --- .../Weather_chk/CMakeLists.txt | 0 .../{ => deprecated}/Weather_chk/Readme.md | 0 .../{ => deprecated}/Weather_chk/cmdlnopts.c | 0 .../{ => deprecated}/Weather_chk/cmdlnopts.h | 0 .../{ => deprecated}/Weather_chk/main.c | 0 .../Weather_chk/weatherchk.cflags | 0 .../Weather_chk/weatherchk.config | 0 .../Weather_chk/weatherchk.creator | 0 .../Weather_chk/weatherchk.creator.user | 0 .../Weather_chk/weatherchk.creator.user.22 | 0 .../Weather_chk/weatherchk.cxxflags | 0 .../Weather_chk/weatherchk.files | 0 .../Weather_chk/weatherchk.includes | 0 Daemons/{ => deprecated}/netdaemon/Makefile | 0 Daemons/{ => deprecated}/netdaemon/Readme.md | 0 .../{ => deprecated}/netdaemon/cmdlnopts.c | 0 .../{ => deprecated}/netdaemon/cmdlnopts.h | 0 Daemons/{ => deprecated}/netdaemon/main.c | 0 .../netdaemon/netdaemon-template.cflags | 0 .../netdaemon/netdaemon-template.config | 0 .../netdaemon/netdaemon-template.creator | 0 .../netdaemon/netdaemon-template.creator.user | 0 .../netdaemon-template.creator.user.4.9-pre1 | 0 .../netdaemon/netdaemon-template.cxxflags | 0 .../netdaemon/netdaemon-template.files | 0 .../netdaemon/netdaemon-template.includes | 0 Daemons/{ => deprecated}/netdaemon/socket.c | 0 Daemons/{ => deprecated}/netdaemon/socket.h | 0 Daemons/{ => deprecated}/netdaemon/term.c | 0 Daemons/{ => deprecated}/netdaemon/term.h | 0 .../{ => deprecated}/weatherdaemon/Makefile | 0 .../{ => deprecated}/weatherdaemon/Readme.md | 0 .../weatherdaemon/bta_shdata.c | 0 .../weatherdaemon/bta_shdata.h | 0 .../weatherdaemon/cmdlnopts.c | 0 .../weatherdaemon/cmdlnopts.h | 0 Daemons/{ => deprecated}/weatherdaemon/main.c | 0 .../{ => deprecated}/weatherdaemon/socket.c | 0 .../{ => deprecated}/weatherdaemon/socket.h | 0 Daemons/{ => deprecated}/weatherdaemon/term.c | 0 Daemons/{ => deprecated}/weatherdaemon/term.h | 0 .../weatherdaemon/weatherdaemon.cflags | 0 .../weatherdaemon/weatherdaemon.config | 0 .../weatherdaemon/weatherdaemon.creator | 0 .../weatherdaemon/weatherdaemon.creator.user | 0 .../weatherdaemon.creator.user.4.9-pre1 | 0 .../weatherdaemon.creator.user.7bd84e3 | 0 .../weatherdaemon/weatherdaemon.cxxflags | 0 .../weatherdaemon/weatherdaemon.files | 0 .../weatherdaemon/weatherdaemon.includes | 0 .../weatherdaemon_newmeteo/Makefile | 0 .../weatherdaemon_newmeteo/Readme.md | 0 .../weatherdaemon_newmeteo/cmdlnopts.c | 0 .../weatherdaemon_newmeteo/cmdlnopts.h | 0 .../weatherdaemon_newmeteo/main.c | 0 .../weatherdaemon_newmeteo/socket.c | 0 .../weatherdaemon_newmeteo/socket.h | 0 .../weatherdaemon_newmeteo/stat.c | 0 .../weatherdaemon_newmeteo/stat.h | 0 .../weatherdaemon_newmeteo/term.c | 0 .../weatherdaemon_newmeteo/term.h | 0 .../weatherdaemon.cflags | 0 .../weatherdaemon.config | 0 .../weatherdaemon.creator | 0 .../weatherdaemon.creator.user | 0 .../weatherdaemon.creator.user.4.9-pre1 | 0 .../weatherdaemon.creator.user.7bd84e3 | 0 .../weatherdaemon.cxxflags | 0 .../weatherdaemon.files | 0 .../weatherdaemon.includes | 0 Daemons/domedaemon-astrosib/CMakeLists.txt | 5 +- Daemons/domedaemon-astrosib/dome.c | 2 + .../domedaemon-astrosib.cflags | 2 +- .../domedaemon-astrosib.config | 1 + .../domedaemon-astrosib.creator.user | 58 ++++++-- .../domedaemon-astrosib.cxxflags | 2 +- .../domedaemon-astrosib.files | 2 + Daemons/domedaemon-astrosib/header.c | 132 ++++++++++++++++++ Daemons/domedaemon-astrosib/header.h | 23 +++ Daemons/domedaemon-astrosib/main.c | 75 ++++++++-- Daemons/domedaemon-astrosib/server.c | 67 ++++++++- Daemons/domedaemon-astrosib/server.h | 9 ++ .../.qtcreator/baader_dome.creator.user | 4 +- Daemons/domedaemon_baader/main.c | 8 +- Daemons/domedaemon_baader/socket.c | 2 +- Daemons/weatherdaemon/chkweather | 24 ---- 86 files changed, 361 insertions(+), 55 deletions(-) rename Auxiliary_utils/{ => deprecated}/Weather_chk/CMakeLists.txt (100%) rename Auxiliary_utils/{ => deprecated}/Weather_chk/Readme.md (100%) rename Auxiliary_utils/{ => deprecated}/Weather_chk/cmdlnopts.c (100%) rename Auxiliary_utils/{ => deprecated}/Weather_chk/cmdlnopts.h (100%) rename Auxiliary_utils/{ => deprecated}/Weather_chk/main.c (100%) rename Auxiliary_utils/{ => deprecated}/Weather_chk/weatherchk.cflags (100%) rename Auxiliary_utils/{ => deprecated}/Weather_chk/weatherchk.config (100%) rename Auxiliary_utils/{ => deprecated}/Weather_chk/weatherchk.creator (100%) rename Auxiliary_utils/{ => deprecated}/Weather_chk/weatherchk.creator.user (100%) rename Auxiliary_utils/{ => deprecated}/Weather_chk/weatherchk.creator.user.22 (100%) rename Auxiliary_utils/{ => deprecated}/Weather_chk/weatherchk.cxxflags (100%) rename Auxiliary_utils/{ => deprecated}/Weather_chk/weatherchk.files (100%) rename Auxiliary_utils/{ => deprecated}/Weather_chk/weatherchk.includes (100%) rename Daemons/{ => deprecated}/netdaemon/Makefile (100%) rename Daemons/{ => deprecated}/netdaemon/Readme.md (100%) rename Daemons/{ => deprecated}/netdaemon/cmdlnopts.c (100%) rename Daemons/{ => deprecated}/netdaemon/cmdlnopts.h (100%) rename Daemons/{ => deprecated}/netdaemon/main.c (100%) rename Daemons/{ => deprecated}/netdaemon/netdaemon-template.cflags (100%) rename Daemons/{ => deprecated}/netdaemon/netdaemon-template.config (100%) rename Daemons/{ => deprecated}/netdaemon/netdaemon-template.creator (100%) rename Daemons/{ => deprecated}/netdaemon/netdaemon-template.creator.user (100%) rename Daemons/{ => deprecated}/netdaemon/netdaemon-template.creator.user.4.9-pre1 (100%) rename Daemons/{ => deprecated}/netdaemon/netdaemon-template.cxxflags (100%) rename Daemons/{ => deprecated}/netdaemon/netdaemon-template.files (100%) rename Daemons/{ => deprecated}/netdaemon/netdaemon-template.includes (100%) rename Daemons/{ => deprecated}/netdaemon/socket.c (100%) rename Daemons/{ => deprecated}/netdaemon/socket.h (100%) rename Daemons/{ => deprecated}/netdaemon/term.c (100%) rename Daemons/{ => deprecated}/netdaemon/term.h (100%) rename Daemons/{ => deprecated}/weatherdaemon/Makefile (100%) rename Daemons/{ => deprecated}/weatherdaemon/Readme.md (100%) rename Daemons/{ => deprecated}/weatherdaemon/bta_shdata.c (100%) rename Daemons/{ => deprecated}/weatherdaemon/bta_shdata.h (100%) rename Daemons/{ => deprecated}/weatherdaemon/cmdlnopts.c (100%) rename Daemons/{ => deprecated}/weatherdaemon/cmdlnopts.h (100%) rename Daemons/{ => deprecated}/weatherdaemon/main.c (100%) rename Daemons/{ => deprecated}/weatherdaemon/socket.c (100%) rename Daemons/{ => deprecated}/weatherdaemon/socket.h (100%) rename Daemons/{ => deprecated}/weatherdaemon/term.c (100%) rename Daemons/{ => deprecated}/weatherdaemon/term.h (100%) rename Daemons/{ => deprecated}/weatherdaemon/weatherdaemon.cflags (100%) rename Daemons/{ => deprecated}/weatherdaemon/weatherdaemon.config (100%) rename Daemons/{ => deprecated}/weatherdaemon/weatherdaemon.creator (100%) rename Daemons/{ => deprecated}/weatherdaemon/weatherdaemon.creator.user (100%) rename Daemons/{ => deprecated}/weatherdaemon/weatherdaemon.creator.user.4.9-pre1 (100%) rename Daemons/{ => deprecated}/weatherdaemon/weatherdaemon.creator.user.7bd84e3 (100%) rename Daemons/{ => deprecated}/weatherdaemon/weatherdaemon.cxxflags (100%) rename Daemons/{ => deprecated}/weatherdaemon/weatherdaemon.files (100%) rename Daemons/{ => deprecated}/weatherdaemon/weatherdaemon.includes (100%) rename Daemons/{ => deprecated}/weatherdaemon_newmeteo/Makefile (100%) rename Daemons/{ => deprecated}/weatherdaemon_newmeteo/Readme.md (100%) rename Daemons/{ => deprecated}/weatherdaemon_newmeteo/cmdlnopts.c (100%) rename Daemons/{ => deprecated}/weatherdaemon_newmeteo/cmdlnopts.h (100%) rename Daemons/{ => deprecated}/weatherdaemon_newmeteo/main.c (100%) rename Daemons/{ => deprecated}/weatherdaemon_newmeteo/socket.c (100%) rename Daemons/{ => deprecated}/weatherdaemon_newmeteo/socket.h (100%) rename Daemons/{ => deprecated}/weatherdaemon_newmeteo/stat.c (100%) rename Daemons/{ => deprecated}/weatherdaemon_newmeteo/stat.h (100%) rename Daemons/{ => deprecated}/weatherdaemon_newmeteo/term.c (100%) rename Daemons/{ => deprecated}/weatherdaemon_newmeteo/term.h (100%) rename Daemons/{ => deprecated}/weatherdaemon_newmeteo/weatherdaemon.cflags (100%) rename Daemons/{ => deprecated}/weatherdaemon_newmeteo/weatherdaemon.config (100%) rename Daemons/{ => deprecated}/weatherdaemon_newmeteo/weatherdaemon.creator (100%) rename Daemons/{ => deprecated}/weatherdaemon_newmeteo/weatherdaemon.creator.user (100%) rename Daemons/{ => deprecated}/weatherdaemon_newmeteo/weatherdaemon.creator.user.4.9-pre1 (100%) rename Daemons/{ => deprecated}/weatherdaemon_newmeteo/weatherdaemon.creator.user.7bd84e3 (100%) rename Daemons/{ => deprecated}/weatherdaemon_newmeteo/weatherdaemon.cxxflags (100%) rename Daemons/{ => deprecated}/weatherdaemon_newmeteo/weatherdaemon.files (100%) rename Daemons/{ => deprecated}/weatherdaemon_newmeteo/weatherdaemon.includes (100%) create mode 100644 Daemons/domedaemon-astrosib/header.c create mode 100644 Daemons/domedaemon-astrosib/header.h delete mode 100644 Daemons/weatherdaemon/chkweather diff --git a/Auxiliary_utils/Weather_chk/CMakeLists.txt b/Auxiliary_utils/deprecated/Weather_chk/CMakeLists.txt similarity index 100% rename from Auxiliary_utils/Weather_chk/CMakeLists.txt rename to Auxiliary_utils/deprecated/Weather_chk/CMakeLists.txt diff --git a/Auxiliary_utils/Weather_chk/Readme.md b/Auxiliary_utils/deprecated/Weather_chk/Readme.md similarity index 100% rename from Auxiliary_utils/Weather_chk/Readme.md rename to Auxiliary_utils/deprecated/Weather_chk/Readme.md diff --git a/Auxiliary_utils/Weather_chk/cmdlnopts.c b/Auxiliary_utils/deprecated/Weather_chk/cmdlnopts.c similarity index 100% rename from Auxiliary_utils/Weather_chk/cmdlnopts.c rename to Auxiliary_utils/deprecated/Weather_chk/cmdlnopts.c diff --git a/Auxiliary_utils/Weather_chk/cmdlnopts.h b/Auxiliary_utils/deprecated/Weather_chk/cmdlnopts.h similarity index 100% rename from Auxiliary_utils/Weather_chk/cmdlnopts.h rename to Auxiliary_utils/deprecated/Weather_chk/cmdlnopts.h diff --git a/Auxiliary_utils/Weather_chk/main.c b/Auxiliary_utils/deprecated/Weather_chk/main.c similarity index 100% rename from Auxiliary_utils/Weather_chk/main.c rename to Auxiliary_utils/deprecated/Weather_chk/main.c diff --git a/Auxiliary_utils/Weather_chk/weatherchk.cflags b/Auxiliary_utils/deprecated/Weather_chk/weatherchk.cflags similarity index 100% rename from Auxiliary_utils/Weather_chk/weatherchk.cflags rename to Auxiliary_utils/deprecated/Weather_chk/weatherchk.cflags diff --git a/Auxiliary_utils/Weather_chk/weatherchk.config b/Auxiliary_utils/deprecated/Weather_chk/weatherchk.config similarity index 100% rename from Auxiliary_utils/Weather_chk/weatherchk.config rename to Auxiliary_utils/deprecated/Weather_chk/weatherchk.config diff --git a/Auxiliary_utils/Weather_chk/weatherchk.creator b/Auxiliary_utils/deprecated/Weather_chk/weatherchk.creator similarity index 100% rename from Auxiliary_utils/Weather_chk/weatherchk.creator rename to Auxiliary_utils/deprecated/Weather_chk/weatherchk.creator diff --git a/Auxiliary_utils/Weather_chk/weatherchk.creator.user b/Auxiliary_utils/deprecated/Weather_chk/weatherchk.creator.user similarity index 100% rename from Auxiliary_utils/Weather_chk/weatherchk.creator.user rename to Auxiliary_utils/deprecated/Weather_chk/weatherchk.creator.user diff --git a/Auxiliary_utils/Weather_chk/weatherchk.creator.user.22 b/Auxiliary_utils/deprecated/Weather_chk/weatherchk.creator.user.22 similarity index 100% rename from Auxiliary_utils/Weather_chk/weatherchk.creator.user.22 rename to Auxiliary_utils/deprecated/Weather_chk/weatherchk.creator.user.22 diff --git a/Auxiliary_utils/Weather_chk/weatherchk.cxxflags b/Auxiliary_utils/deprecated/Weather_chk/weatherchk.cxxflags similarity index 100% rename from Auxiliary_utils/Weather_chk/weatherchk.cxxflags rename to Auxiliary_utils/deprecated/Weather_chk/weatherchk.cxxflags diff --git a/Auxiliary_utils/Weather_chk/weatherchk.files b/Auxiliary_utils/deprecated/Weather_chk/weatherchk.files similarity index 100% rename from Auxiliary_utils/Weather_chk/weatherchk.files rename to Auxiliary_utils/deprecated/Weather_chk/weatherchk.files diff --git a/Auxiliary_utils/Weather_chk/weatherchk.includes b/Auxiliary_utils/deprecated/Weather_chk/weatherchk.includes similarity index 100% rename from Auxiliary_utils/Weather_chk/weatherchk.includes rename to Auxiliary_utils/deprecated/Weather_chk/weatherchk.includes diff --git a/Daemons/netdaemon/Makefile b/Daemons/deprecated/netdaemon/Makefile similarity index 100% rename from Daemons/netdaemon/Makefile rename to Daemons/deprecated/netdaemon/Makefile diff --git a/Daemons/netdaemon/Readme.md b/Daemons/deprecated/netdaemon/Readme.md similarity index 100% rename from Daemons/netdaemon/Readme.md rename to Daemons/deprecated/netdaemon/Readme.md diff --git a/Daemons/netdaemon/cmdlnopts.c b/Daemons/deprecated/netdaemon/cmdlnopts.c similarity index 100% rename from Daemons/netdaemon/cmdlnopts.c rename to Daemons/deprecated/netdaemon/cmdlnopts.c diff --git a/Daemons/netdaemon/cmdlnopts.h b/Daemons/deprecated/netdaemon/cmdlnopts.h similarity index 100% rename from Daemons/netdaemon/cmdlnopts.h rename to Daemons/deprecated/netdaemon/cmdlnopts.h diff --git a/Daemons/netdaemon/main.c b/Daemons/deprecated/netdaemon/main.c similarity index 100% rename from Daemons/netdaemon/main.c rename to Daemons/deprecated/netdaemon/main.c diff --git a/Daemons/netdaemon/netdaemon-template.cflags b/Daemons/deprecated/netdaemon/netdaemon-template.cflags similarity index 100% rename from Daemons/netdaemon/netdaemon-template.cflags rename to Daemons/deprecated/netdaemon/netdaemon-template.cflags diff --git a/Daemons/netdaemon/netdaemon-template.config b/Daemons/deprecated/netdaemon/netdaemon-template.config similarity index 100% rename from Daemons/netdaemon/netdaemon-template.config rename to Daemons/deprecated/netdaemon/netdaemon-template.config diff --git a/Daemons/netdaemon/netdaemon-template.creator b/Daemons/deprecated/netdaemon/netdaemon-template.creator similarity index 100% rename from Daemons/netdaemon/netdaemon-template.creator rename to Daemons/deprecated/netdaemon/netdaemon-template.creator diff --git a/Daemons/netdaemon/netdaemon-template.creator.user b/Daemons/deprecated/netdaemon/netdaemon-template.creator.user similarity index 100% rename from Daemons/netdaemon/netdaemon-template.creator.user rename to Daemons/deprecated/netdaemon/netdaemon-template.creator.user diff --git a/Daemons/netdaemon/netdaemon-template.creator.user.4.9-pre1 b/Daemons/deprecated/netdaemon/netdaemon-template.creator.user.4.9-pre1 similarity index 100% rename from Daemons/netdaemon/netdaemon-template.creator.user.4.9-pre1 rename to Daemons/deprecated/netdaemon/netdaemon-template.creator.user.4.9-pre1 diff --git a/Daemons/netdaemon/netdaemon-template.cxxflags b/Daemons/deprecated/netdaemon/netdaemon-template.cxxflags similarity index 100% rename from Daemons/netdaemon/netdaemon-template.cxxflags rename to Daemons/deprecated/netdaemon/netdaemon-template.cxxflags diff --git a/Daemons/netdaemon/netdaemon-template.files b/Daemons/deprecated/netdaemon/netdaemon-template.files similarity index 100% rename from Daemons/netdaemon/netdaemon-template.files rename to Daemons/deprecated/netdaemon/netdaemon-template.files diff --git a/Daemons/netdaemon/netdaemon-template.includes b/Daemons/deprecated/netdaemon/netdaemon-template.includes similarity index 100% rename from Daemons/netdaemon/netdaemon-template.includes rename to Daemons/deprecated/netdaemon/netdaemon-template.includes diff --git a/Daemons/netdaemon/socket.c b/Daemons/deprecated/netdaemon/socket.c similarity index 100% rename from Daemons/netdaemon/socket.c rename to Daemons/deprecated/netdaemon/socket.c diff --git a/Daemons/netdaemon/socket.h b/Daemons/deprecated/netdaemon/socket.h similarity index 100% rename from Daemons/netdaemon/socket.h rename to Daemons/deprecated/netdaemon/socket.h diff --git a/Daemons/netdaemon/term.c b/Daemons/deprecated/netdaemon/term.c similarity index 100% rename from Daemons/netdaemon/term.c rename to Daemons/deprecated/netdaemon/term.c diff --git a/Daemons/netdaemon/term.h b/Daemons/deprecated/netdaemon/term.h similarity index 100% rename from Daemons/netdaemon/term.h rename to Daemons/deprecated/netdaemon/term.h diff --git a/Daemons/weatherdaemon/Makefile b/Daemons/deprecated/weatherdaemon/Makefile similarity index 100% rename from Daemons/weatherdaemon/Makefile rename to Daemons/deprecated/weatherdaemon/Makefile diff --git a/Daemons/weatherdaemon/Readme.md b/Daemons/deprecated/weatherdaemon/Readme.md similarity index 100% rename from Daemons/weatherdaemon/Readme.md rename to Daemons/deprecated/weatherdaemon/Readme.md diff --git a/Daemons/weatherdaemon/bta_shdata.c b/Daemons/deprecated/weatherdaemon/bta_shdata.c similarity index 100% rename from Daemons/weatherdaemon/bta_shdata.c rename to Daemons/deprecated/weatherdaemon/bta_shdata.c diff --git a/Daemons/weatherdaemon/bta_shdata.h b/Daemons/deprecated/weatherdaemon/bta_shdata.h similarity index 100% rename from Daemons/weatherdaemon/bta_shdata.h rename to Daemons/deprecated/weatherdaemon/bta_shdata.h diff --git a/Daemons/weatherdaemon/cmdlnopts.c b/Daemons/deprecated/weatherdaemon/cmdlnopts.c similarity index 100% rename from Daemons/weatherdaemon/cmdlnopts.c rename to Daemons/deprecated/weatherdaemon/cmdlnopts.c diff --git a/Daemons/weatherdaemon/cmdlnopts.h b/Daemons/deprecated/weatherdaemon/cmdlnopts.h similarity index 100% rename from Daemons/weatherdaemon/cmdlnopts.h rename to Daemons/deprecated/weatherdaemon/cmdlnopts.h diff --git a/Daemons/weatherdaemon/main.c b/Daemons/deprecated/weatherdaemon/main.c similarity index 100% rename from Daemons/weatherdaemon/main.c rename to Daemons/deprecated/weatherdaemon/main.c diff --git a/Daemons/weatherdaemon/socket.c b/Daemons/deprecated/weatherdaemon/socket.c similarity index 100% rename from Daemons/weatherdaemon/socket.c rename to Daemons/deprecated/weatherdaemon/socket.c diff --git a/Daemons/weatherdaemon/socket.h b/Daemons/deprecated/weatherdaemon/socket.h similarity index 100% rename from Daemons/weatherdaemon/socket.h rename to Daemons/deprecated/weatherdaemon/socket.h diff --git a/Daemons/weatherdaemon/term.c b/Daemons/deprecated/weatherdaemon/term.c similarity index 100% rename from Daemons/weatherdaemon/term.c rename to Daemons/deprecated/weatherdaemon/term.c diff --git a/Daemons/weatherdaemon/term.h b/Daemons/deprecated/weatherdaemon/term.h similarity index 100% rename from Daemons/weatherdaemon/term.h rename to Daemons/deprecated/weatherdaemon/term.h diff --git a/Daemons/weatherdaemon/weatherdaemon.cflags b/Daemons/deprecated/weatherdaemon/weatherdaemon.cflags similarity index 100% rename from Daemons/weatherdaemon/weatherdaemon.cflags rename to Daemons/deprecated/weatherdaemon/weatherdaemon.cflags diff --git a/Daemons/weatherdaemon/weatherdaemon.config b/Daemons/deprecated/weatherdaemon/weatherdaemon.config similarity index 100% rename from Daemons/weatherdaemon/weatherdaemon.config rename to Daemons/deprecated/weatherdaemon/weatherdaemon.config diff --git a/Daemons/weatherdaemon/weatherdaemon.creator b/Daemons/deprecated/weatherdaemon/weatherdaemon.creator similarity index 100% rename from Daemons/weatherdaemon/weatherdaemon.creator rename to Daemons/deprecated/weatherdaemon/weatherdaemon.creator diff --git a/Daemons/weatherdaemon/weatherdaemon.creator.user b/Daemons/deprecated/weatherdaemon/weatherdaemon.creator.user similarity index 100% rename from Daemons/weatherdaemon/weatherdaemon.creator.user rename to Daemons/deprecated/weatherdaemon/weatherdaemon.creator.user diff --git a/Daemons/weatherdaemon/weatherdaemon.creator.user.4.9-pre1 b/Daemons/deprecated/weatherdaemon/weatherdaemon.creator.user.4.9-pre1 similarity index 100% rename from Daemons/weatherdaemon/weatherdaemon.creator.user.4.9-pre1 rename to Daemons/deprecated/weatherdaemon/weatherdaemon.creator.user.4.9-pre1 diff --git a/Daemons/weatherdaemon/weatherdaemon.creator.user.7bd84e3 b/Daemons/deprecated/weatherdaemon/weatherdaemon.creator.user.7bd84e3 similarity index 100% rename from Daemons/weatherdaemon/weatherdaemon.creator.user.7bd84e3 rename to Daemons/deprecated/weatherdaemon/weatherdaemon.creator.user.7bd84e3 diff --git a/Daemons/weatherdaemon/weatherdaemon.cxxflags b/Daemons/deprecated/weatherdaemon/weatherdaemon.cxxflags similarity index 100% rename from Daemons/weatherdaemon/weatherdaemon.cxxflags rename to Daemons/deprecated/weatherdaemon/weatherdaemon.cxxflags diff --git a/Daemons/weatherdaemon/weatherdaemon.files b/Daemons/deprecated/weatherdaemon/weatherdaemon.files similarity index 100% rename from Daemons/weatherdaemon/weatherdaemon.files rename to Daemons/deprecated/weatherdaemon/weatherdaemon.files diff --git a/Daemons/weatherdaemon/weatherdaemon.includes b/Daemons/deprecated/weatherdaemon/weatherdaemon.includes similarity index 100% rename from Daemons/weatherdaemon/weatherdaemon.includes rename to Daemons/deprecated/weatherdaemon/weatherdaemon.includes diff --git a/Daemons/weatherdaemon_newmeteo/Makefile b/Daemons/deprecated/weatherdaemon_newmeteo/Makefile similarity index 100% rename from Daemons/weatherdaemon_newmeteo/Makefile rename to Daemons/deprecated/weatherdaemon_newmeteo/Makefile diff --git a/Daemons/weatherdaemon_newmeteo/Readme.md b/Daemons/deprecated/weatherdaemon_newmeteo/Readme.md similarity index 100% rename from Daemons/weatherdaemon_newmeteo/Readme.md rename to Daemons/deprecated/weatherdaemon_newmeteo/Readme.md diff --git a/Daemons/weatherdaemon_newmeteo/cmdlnopts.c b/Daemons/deprecated/weatherdaemon_newmeteo/cmdlnopts.c similarity index 100% rename from Daemons/weatherdaemon_newmeteo/cmdlnopts.c rename to Daemons/deprecated/weatherdaemon_newmeteo/cmdlnopts.c diff --git a/Daemons/weatherdaemon_newmeteo/cmdlnopts.h b/Daemons/deprecated/weatherdaemon_newmeteo/cmdlnopts.h similarity index 100% rename from Daemons/weatherdaemon_newmeteo/cmdlnopts.h rename to Daemons/deprecated/weatherdaemon_newmeteo/cmdlnopts.h diff --git a/Daemons/weatherdaemon_newmeteo/main.c b/Daemons/deprecated/weatherdaemon_newmeteo/main.c similarity index 100% rename from Daemons/weatherdaemon_newmeteo/main.c rename to Daemons/deprecated/weatherdaemon_newmeteo/main.c diff --git a/Daemons/weatherdaemon_newmeteo/socket.c b/Daemons/deprecated/weatherdaemon_newmeteo/socket.c similarity index 100% rename from Daemons/weatherdaemon_newmeteo/socket.c rename to Daemons/deprecated/weatherdaemon_newmeteo/socket.c diff --git a/Daemons/weatherdaemon_newmeteo/socket.h b/Daemons/deprecated/weatherdaemon_newmeteo/socket.h similarity index 100% rename from Daemons/weatherdaemon_newmeteo/socket.h rename to Daemons/deprecated/weatherdaemon_newmeteo/socket.h diff --git a/Daemons/weatherdaemon_newmeteo/stat.c b/Daemons/deprecated/weatherdaemon_newmeteo/stat.c similarity index 100% rename from Daemons/weatherdaemon_newmeteo/stat.c rename to Daemons/deprecated/weatherdaemon_newmeteo/stat.c diff --git a/Daemons/weatherdaemon_newmeteo/stat.h b/Daemons/deprecated/weatherdaemon_newmeteo/stat.h similarity index 100% rename from Daemons/weatherdaemon_newmeteo/stat.h rename to Daemons/deprecated/weatherdaemon_newmeteo/stat.h diff --git a/Daemons/weatherdaemon_newmeteo/term.c b/Daemons/deprecated/weatherdaemon_newmeteo/term.c similarity index 100% rename from Daemons/weatherdaemon_newmeteo/term.c rename to Daemons/deprecated/weatherdaemon_newmeteo/term.c diff --git a/Daemons/weatherdaemon_newmeteo/term.h b/Daemons/deprecated/weatherdaemon_newmeteo/term.h similarity index 100% rename from Daemons/weatherdaemon_newmeteo/term.h rename to Daemons/deprecated/weatherdaemon_newmeteo/term.h diff --git a/Daemons/weatherdaemon_newmeteo/weatherdaemon.cflags b/Daemons/deprecated/weatherdaemon_newmeteo/weatherdaemon.cflags similarity index 100% rename from Daemons/weatherdaemon_newmeteo/weatherdaemon.cflags rename to Daemons/deprecated/weatherdaemon_newmeteo/weatherdaemon.cflags diff --git a/Daemons/weatherdaemon_newmeteo/weatherdaemon.config b/Daemons/deprecated/weatherdaemon_newmeteo/weatherdaemon.config similarity index 100% rename from Daemons/weatherdaemon_newmeteo/weatherdaemon.config rename to Daemons/deprecated/weatherdaemon_newmeteo/weatherdaemon.config diff --git a/Daemons/weatherdaemon_newmeteo/weatherdaemon.creator b/Daemons/deprecated/weatherdaemon_newmeteo/weatherdaemon.creator similarity index 100% rename from Daemons/weatherdaemon_newmeteo/weatherdaemon.creator rename to Daemons/deprecated/weatherdaemon_newmeteo/weatherdaemon.creator diff --git a/Daemons/weatherdaemon_newmeteo/weatherdaemon.creator.user b/Daemons/deprecated/weatherdaemon_newmeteo/weatherdaemon.creator.user similarity index 100% rename from Daemons/weatherdaemon_newmeteo/weatherdaemon.creator.user rename to Daemons/deprecated/weatherdaemon_newmeteo/weatherdaemon.creator.user diff --git a/Daemons/weatherdaemon_newmeteo/weatherdaemon.creator.user.4.9-pre1 b/Daemons/deprecated/weatherdaemon_newmeteo/weatherdaemon.creator.user.4.9-pre1 similarity index 100% rename from Daemons/weatherdaemon_newmeteo/weatherdaemon.creator.user.4.9-pre1 rename to Daemons/deprecated/weatherdaemon_newmeteo/weatherdaemon.creator.user.4.9-pre1 diff --git a/Daemons/weatherdaemon_newmeteo/weatherdaemon.creator.user.7bd84e3 b/Daemons/deprecated/weatherdaemon_newmeteo/weatherdaemon.creator.user.7bd84e3 similarity index 100% rename from Daemons/weatherdaemon_newmeteo/weatherdaemon.creator.user.7bd84e3 rename to Daemons/deprecated/weatherdaemon_newmeteo/weatherdaemon.creator.user.7bd84e3 diff --git a/Daemons/weatherdaemon_newmeteo/weatherdaemon.cxxflags b/Daemons/deprecated/weatherdaemon_newmeteo/weatherdaemon.cxxflags similarity index 100% rename from Daemons/weatherdaemon_newmeteo/weatherdaemon.cxxflags rename to Daemons/deprecated/weatherdaemon_newmeteo/weatherdaemon.cxxflags diff --git a/Daemons/weatherdaemon_newmeteo/weatherdaemon.files b/Daemons/deprecated/weatherdaemon_newmeteo/weatherdaemon.files similarity index 100% rename from Daemons/weatherdaemon_newmeteo/weatherdaemon.files rename to Daemons/deprecated/weatherdaemon_newmeteo/weatherdaemon.files diff --git a/Daemons/weatherdaemon_newmeteo/weatherdaemon.includes b/Daemons/deprecated/weatherdaemon_newmeteo/weatherdaemon.includes similarity index 100% rename from Daemons/weatherdaemon_newmeteo/weatherdaemon.includes rename to Daemons/deprecated/weatherdaemon_newmeteo/weatherdaemon.includes diff --git a/Daemons/domedaemon-astrosib/CMakeLists.txt b/Daemons/domedaemon-astrosib/CMakeLists.txt index 65cd7ba..da40070 100644 --- a/Daemons/domedaemon-astrosib/CMakeLists.txt +++ b/Daemons/domedaemon-astrosib/CMakeLists.txt @@ -15,7 +15,7 @@ message("VER: ${VERSION}") option(DEBUG "Compile in debug mode" OFF) # default flags -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -W -Wextra -std=gnu99") +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -W -Wextra -std=c23") if(DEBUG) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Og -g3 -ggdb -fno-builtin-strlen -Werror") add_definitions(-DEBUG) @@ -53,11 +53,12 @@ target_include_directories(${PROJ} PUBLIC ${MODULES_INCLUDE_DIRS}) # -L target_link_directories(${PROJ} PUBLIC ${MODULES_LIBRARY_DIRS}) # -l -target_link_libraries(${PROJ} ${MODULES_LIBRARIES}) +target_link_libraries(${PROJ} ${MODULES_LIBRARIES} -lweather) # -D add_definitions( -DPACKAGE_VERSION=\"${VERSION}\" -DMINOR_VERSION=\"${MINOR_VERSION}\" -DMID_VERSION=\"${MID_VERSION}\" -DMAJOR_VERSION=\"${MAJOR_VESION}\" + -D_GNU_SOURCE ) # Installation of the program diff --git a/Daemons/domedaemon-astrosib/dome.c b/Daemons/domedaemon-astrosib/dome.c index bb11ba2..6fe8e14 100644 --- a/Daemons/domedaemon-astrosib/dome.c +++ b/Daemons/domedaemon-astrosib/dome.c @@ -21,6 +21,7 @@ #include "astrosib_proto.h" #include "dome.h" +#include "header.h" // number of relay turning on/off motors power #define MOTRELAY_NO 1 @@ -269,5 +270,6 @@ ret: if(state == DOME_S_IDLE) status_req_interval = STATUSREQ_IDLE; else status_req_interval = STATUSREQ_MOVE; pthread_mutex_unlock(&serialmutex); + write_header(); return st; } diff --git a/Daemons/domedaemon-astrosib/domedaemon-astrosib.cflags b/Daemons/domedaemon-astrosib/domedaemon-astrosib.cflags index 68d5165..a07354f 100644 --- a/Daemons/domedaemon-astrosib/domedaemon-astrosib.cflags +++ b/Daemons/domedaemon-astrosib/domedaemon-astrosib.cflags @@ -1 +1 @@ --std=c17 \ No newline at end of file +-std=c23 \ No newline at end of file diff --git a/Daemons/domedaemon-astrosib/domedaemon-astrosib.config b/Daemons/domedaemon-astrosib/domedaemon-astrosib.config index e0284f4..24e2ef7 100644 --- a/Daemons/domedaemon-astrosib/domedaemon-astrosib.config +++ b/Daemons/domedaemon-astrosib/domedaemon-astrosib.config @@ -1,2 +1,3 @@ // Add predefined macros for your project here. For example: // #define THE_ANSWER 42 +#define _XOPEN_SOURCE 666 diff --git a/Daemons/domedaemon-astrosib/domedaemon-astrosib.creator.user b/Daemons/domedaemon-astrosib/domedaemon-astrosib.creator.user index f5d82e5..0ad9ba6 100644 --- a/Daemons/domedaemon-astrosib/domedaemon-astrosib.creator.user +++ b/Daemons/domedaemon-astrosib/domedaemon-astrosib.creator.user @@ -1,6 +1,6 @@ - + EnvironmentId @@ -86,12 +86,14 @@ true + 0 ProjectExplorer.Project.Target.0 Desktop + true Desktop Desktop {91347f2c-5221-46a7-80b1-0a054ca02f79} @@ -109,8 +111,8 @@ GenericProjectManager.GenericMakeStep 1 - Сборка - Сборка + Build + Build ProjectExplorer.BuildSteps.Build @@ -122,8 +124,8 @@ GenericProjectManager.GenericMakeStep 1 - Очистка - Очистка + Clean + Clean ProjectExplorer.BuildSteps.Clean 2 @@ -133,13 +135,49 @@ По умолчанию GenericProjectManager.GenericBuildConfiguration + 0 + 0 + + + 0 + Deploy + Deploy + ProjectExplorer.BuildSteps.Deploy + + 1 + + false + ProjectExplorer.DefaultDeployConfiguration + + 1 + + true + true + 0 + true + + + + 2 + + false + -e cpu-cycles --call-graph dwarf,4096 -F 250 + + ProjectExplorer.CustomExecutableRunConfiguration + + false + + true + true + + 1 1 0 - Развёртывание - Развёртывание + Deploy + Deploy ProjectExplorer.BuildSteps.Deploy 1 @@ -153,6 +191,7 @@ true 0 true + 2 @@ -163,6 +202,7 @@ ProjectExplorer.CustomExecutableRunConfiguration false + true true @@ -173,10 +213,6 @@ ProjectExplorer.Project.TargetCount 1 - - ProjectExplorer.Project.Updater.FileVersion - 22 - Version 22 diff --git a/Daemons/domedaemon-astrosib/domedaemon-astrosib.cxxflags b/Daemons/domedaemon-astrosib/domedaemon-astrosib.cxxflags index 6435dfc..ea5966d 100644 --- a/Daemons/domedaemon-astrosib/domedaemon-astrosib.cxxflags +++ b/Daemons/domedaemon-astrosib/domedaemon-astrosib.cxxflags @@ -1 +1 @@ --std=c++17 \ No newline at end of file +-std=c++23 \ No newline at end of file diff --git a/Daemons/domedaemon-astrosib/domedaemon-astrosib.files b/Daemons/domedaemon-astrosib/domedaemon-astrosib.files index 0050f0e..e19b365 100644 --- a/Daemons/domedaemon-astrosib/domedaemon-astrosib.files +++ b/Daemons/domedaemon-astrosib/domedaemon-astrosib.files @@ -1,6 +1,8 @@ astrosib_proto.h dome.c dome.h +header.c +header.h main.c server.c server.h diff --git a/Daemons/domedaemon-astrosib/header.c b/Daemons/domedaemon-astrosib/header.c new file mode 100644 index 0000000..7d5a641 --- /dev/null +++ b/Daemons/domedaemon-astrosib/header.c @@ -0,0 +1,132 @@ +/* + * This file is part of the baader_dome project. + * Copyright 2026 Edward V. Emelianov . + * + * 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 3 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. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include +#include +#include +#include + +#include "header.h" +#include "dome.h" +#include "server.h" + +#define VAL_LEN 22 + +static char *headername = NULL; +static char *dome_name = NULL; + +static int printhdr(int fd, const char *key, const char *val, const char *cmnt){ + char tmp[81]; + char tk[9]; + if(strlen(key) > 8){ + snprintf(tk, 8, "%s", key); + key = tk; + } + if(cmnt){ + snprintf(tmp, 81, "%-8s= %-21s / %s", key, val, cmnt); + }else{ + snprintf(tmp, 81, "%-8s= %s", key, val); + } + size_t l = strlen(tmp); + tmp[l] = '\n'; + ++l; + if(write(fd, tmp, l) != (ssize_t)l){ + WARN("write()"); + return 1; + } + return 0; +} + +// return TRUE if can write to given header file +int header_create(const char *file){ + if(!file) return FALSE; + FILE *hf = fopen(file, "w"); + if(!hf) return FALSE; + unlink(file); + if(headername) FREE(headername); + headername = strdup(file); + return TRUE; +} + +// set given `name` for telescope name +void domename(const char *name){ + if(dome_name) FREE(dome_name); + if(name){ + int l = strlen(name) + 3; + dome_name = MALLOC(char, l); + snprintf(dome_name, l, "'%s'", name); + } +} + +const char* stringst[] = { + [DOME_S_IDLE] = "idle", + [DOME_S_MOVING] = "moving", + [DOME_S_ERROR] = "error", +}; + +void write_header(){ + if(!headername) return; + char aname[PATH_MAX]; + char val[VAL_LEN]; +#define WRHDR(k, v, c) do{if(printhdr(fd, k, v, c)){goto returning;}}while(0) + snprintf(aname, PATH_MAX-1, "%sXXXXXX", headername); + int fd = mkstemp(aname); + if(fd < 0){ + LOGWARN("Can't write header file: mkstemp()"); + return; + } + fchmod(fd, 0644); + dome_status_t st; + dome_state_t curstate = get_dome_state(); + double stattime = get_dome_status(&st); + if(get_forbidden()) WRHDR("OPERATIO", "'FORBIDDEN'", "Observations are forbidden"); + if(dome_name) WRHDR("DOME", dome_name, "Dome manufacturer/name"); + int idx = (int)curstate; + if(idx < 0 || idx > DOME_S_ERROR) idx = DOME_S_ERROR; + snprintf(val, VAL_LEN, "'%s'", stringst[idx]); + WRHDR("DOMESTAT", val, "Dome status"); + snprintf(val, VAL_LEN, "'%s'", textst(st.coverstate[0])); + WRHDR("DOMECVR1", val, "Dome cover 1 status"); + snprintf(val, VAL_LEN, "'%s'", textst(st.coverstate[1])); + WRHDR("DOMECVR2", val, "Dome cover 2 status"); + snprintf(val, VAL_LEN, "%d", st.encoder[0]); + WRHDR("DOMEANG1", val, "Dome cover 1 angle"); + snprintf(val, VAL_LEN, "%d", st.encoder[1]); + WRHDR("DOMEANG2", val, "Dome cover 2 angle"); + snprintf(val, VAL_LEN, "%d", st.relay[0]); + WRHDR("DOMERLY1", val, "Dome relay1 state"); + snprintf(val, VAL_LEN, "%d", st.relay[1]); + WRHDR("DOMERLY2", val, "Dome relay2 state"); + snprintf(val, VAL_LEN, "%d", st.relay[2]); + WRHDR("DOMERLY3", val, "Dome relay3 state"); + if(st.israin) WRHDR("DOMERAIN", "1", "Dome rain sensor armed"); + snprintf(val, VAL_LEN, "%.3f", stattime); + char timebuf[BUFSIZ]; + time_t t = (time_t) stattime; + struct tm *tmp; + tmp = localtime(&t); + if(!tmp || 0 == strftime(timebuf, BUFSIZ, "Measurement time: %F %T", tmp)){ + LOGERR("localtime() returned NULL"); + goto returning; + } + WRHDR("TDOMMEAS", val, timebuf); +#undef WRHDR +returning: + close(fd); + rename(aname, headername); +} diff --git a/Daemons/domedaemon-astrosib/header.h b/Daemons/domedaemon-astrosib/header.h new file mode 100644 index 0000000..553e7b1 --- /dev/null +++ b/Daemons/domedaemon-astrosib/header.h @@ -0,0 +1,23 @@ +/* + * This file is part of the domedaemon-astrosib project. + * Copyright 2026 Edward V. Emelianov . + * + * 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 3 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. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +void write_header(); +int header_create(const char *file); +void domename(const char *name); diff --git a/Daemons/domedaemon-astrosib/main.c b/Daemons/domedaemon-astrosib/main.c index 903142c..c35467f 100644 --- a/Daemons/domedaemon-astrosib/main.c +++ b/Daemons/domedaemon-astrosib/main.c @@ -23,6 +23,7 @@ #include //prctl #include +#include "header.h" #include "server.h" // TCP socket port @@ -31,45 +32,101 @@ #define DEFAULT_SERSPEED 9600 // serial polling timeout - 100ms #define DEFAULT_SERTMOUT 100000 +#define DEFAULT_PIDFILE "/tmp/domedaemon.pid" +#define DEFAULT_HEADERFILE "/tmp/dome.fits" +#define DEFAULT_DOMENAME "Astrosib" + +static pid_t childpid = 0; +static sl_tty_t *serial = NULL; typedef struct{ + int help; char *device; // serial device name char *node; // port to connect or UNIX socket name char *logfile; // logfile name + char *pidfile; // PID-file path + char *headerfile; // path to FITS-header with dome parameters + char *dome_name; // name of dome int isunix; // open UNIX-socket instead of TCP int verbose; // verbose level } parameters; + static parameters G = { .node = DEFAULT_PORT, + .pidfile = DEFAULT_PIDFILE, + .headerfile = DEFAULT_HEADERFILE, + .dome_name = DEFAULT_DOMENAME, }; -static int help; static sl_option_t cmdlnopts[] = { - {"help", NO_ARGS, NULL, 'h', arg_int, APTR(&help), "show this help"}, + {"help", NO_ARGS, NULL, 'h', arg_int, APTR(&G.help), "show this help"}, {"device", NEED_ARG, NULL, 'd', arg_string, APTR(&G.device), "serial device name"}, {"node", NEED_ARG, NULL, 'n', arg_string, APTR(&G.node), "UNIX socket name or network port to connect (default: " DEFAULT_PORT ")"}, {"logfile", NEED_ARG, NULL, 'l', arg_string, APTR(&G.logfile), "save logs to file"}, {"unix", NO_ARGS, NULL, 'u', arg_int, APTR(&G.isunix), "open UNIX-socket instead of TCP"}, {"verbose", NO_ARGS, NULL, 'v', arg_none, APTR(&G.verbose), "logging verbose level (each -v adds one)"}, + {"pidfile", NEED_ARG, NULL, 'p', arg_string, APTR(&G.pidfile), "full path to PID-file (default: " DEFAULT_PIDFILE ")"}, + {"headerfile",NEED_ARG, NULL, 'H', arg_string, APTR(&G.headerfile),"full path to output FITS-header (default: " DEFAULT_HEADERFILE ")"}, + {"domename",NEED_ARG, NULL, 'N', arg_string, APTR(&G.dome_name), "dome name in FITS-header (default: " DEFAULT_DOMENAME ")"}, end_option }; +void sl_iffound_deflt(pid_t pid){ + WARNX("Another copy of this process found, pid=%d. Exit.", pid); + exit(1); // don't run `signals` to protect foreign PID-file from removal +} + +// SIGUSR1 - FORBID observations +// SIGUSR2 - allow void signals(int sig){ if(sig){ - signal(sig, SIG_IGN); - DBG("Get signal %d, quit.\n", sig); - LOGERR("Exit with status %d", sig); - }else LOGERR("Exit"); + if(signals != signal(sig, SIG_IGN)) exit(sig); // function called "as is", before sig registration + if(childpid == 0){ // child -> test USR1/USR2 + LOGDBG("Child gotta signal %d", sig); + if(sig == SIGUSR1){ + forbid_observations(1); + LOGMSG("Got signal `observations forbidden`"); + signal(sig, signals); + return; + }else if(sig == SIGUSR2){ + forbid_observations(0); + LOGMSG("Got signal `observations permitted`"); + signal(sig, signals); + return; + } + } + LOGDBG("Get signal %d, quit.\n", sig); + } + if(childpid == 0){ + DBG("Stop server"); + LOGMSG("Stop server"); + stopserver(); + DBG("Close terminal"); + LOGMSG("Close terminal"); + if(serial) sl_tty_close(&serial); + }else{ + if(G.pidfile){ + LOGMSG("Unlink %s", G.pidfile); + usleep(10000); + unlink(G.pidfile); + } + } + LOGERR("Exit with status %d", sig); exit(sig); } int main(int argc, char **argv){ sl_init(); sl_parseargs(&argc, &argv, cmdlnopts); - if(help) sl_showhelp(-1, cmdlnopts); + if(G.help) sl_showhelp(-1, cmdlnopts); if(!G.node) ERRX("Point node"); if(!G.device) ERRX("Point path to serial device"); + if(!header_create(G.headerfile)) + ERRX("Cannot write into '%s'", G.headerfile); + domename(G.dome_name); + sl_check4running((char*)__progname, G.pidfile); + if(sl_daemonize()) ERR("Can't daemonize!"); sl_loglevel_e lvl = G.verbose + LOGLEVEL_ERR; if(lvl >= LOGLEVEL_AMOUNT) lvl = LOGLEVEL_AMOUNT - 1; if(G.logfile) OPENLOG(G.logfile, lvl, 1); @@ -79,6 +136,8 @@ int main(int argc, char **argv){ signal(SIGQUIT, signals); signal(SIGTSTP, SIG_IGN); signal(SIGHUP, signals); + signal(SIGUSR1, SIG_IGN); + signal(SIGUSR2, SIG_IGN); #ifndef EBUG time_t lastd = 0; while(1){ // guard for dead processes @@ -101,7 +160,7 @@ int main(int argc, char **argv){ } #endif sl_socktype_e type = (G.isunix) ? SOCKT_UNIX : SOCKT_NETLOCAL; - sl_tty_t *serial = sl_tty_new(G.device, DEFAULT_SERSPEED, 4096); + serial = sl_tty_new(G.device, DEFAULT_SERSPEED, 4096); if(serial) serial = sl_tty_open(serial, 1); if(!serial){ LOGERR("Can't open serial device %s", G.device); diff --git a/Daemons/domedaemon-astrosib/server.c b/Daemons/domedaemon-astrosib/server.c index 23ac560..5f6f2cd 100644 --- a/Daemons/domedaemon-astrosib/server.c +++ b/Daemons/domedaemon-astrosib/server.c @@ -18,15 +18,22 @@ #include #include +#include #include #include #include #include +#include #include "dome.h" // max age time of last status - 30s -#define STATUS_MAX_AGE (30.) +#define STATUS_MAX_AGE (30.) + +// if there's no signal from weather over `WEATHER_LOST` seconds, close the dome +#define WEATHER_LOST (300.) +// interval of weather polling +#define WEATH_POLL (5.) // commands #define CMD_UNIXT "unixt" @@ -41,6 +48,13 @@ // main socket static sl_sock_t *s = NULL; +// external (manual) signal "deny/allow" +static atomic_bool ForbidObservations = 0; // ==1 if all is forbidden -> close dome and not allow to open +// weather don't allow to open +static atomic_bool BadWeather = 0; + +#define CHKALLOWED() do{if(ForbidObservations || BadWeather){return RESULT_FAIL;}}while(0) + /////// handlers // unixt - send to ALL clients static sl_sock_hresult_e dtimeh(sl_sock_t *c, _U_ sl_sock_hitem_t *item, _U_ const char *req){ @@ -60,7 +74,7 @@ static sl_sock_hresult_e statush(sl_sock_t *c, _U_ sl_sock_hitem_t *item, _U_ co sl_sock_sendstrmessage(c, buf); return RESULT_SILENCE; } -static const char *textst(int coverstate){ +const char *textst(int coverstate){ switch(coverstate){ case COVER_INTERMEDIATE: return "intermediate"; case COVER_OPENED: return "opened"; @@ -110,16 +124,19 @@ static sl_sock_hresult_e domecmd(dome_cmd_t cmd){ return RESULT_OK; } static sl_sock_hresult_e opendome(_U_ sl_sock_t *c, _U_ sl_sock_hitem_t *item, _U_ const char *req){ + CHKALLOWED(); return domecmd(DOME_OPEN); } static sl_sock_hresult_e closedome(_U_ sl_sock_t *c, _U_ sl_sock_hitem_t *item, _U_ const char *req){ return domecmd(DOME_CLOSE); } static sl_sock_hresult_e stopdome(_U_ sl_sock_t *c, _U_ sl_sock_hitem_t *item, _U_ const char *req){ + CHKALLOWED(); // don't allow to stop closing on forbidden state return domecmd(DOME_STOP); } // half open/close static sl_sock_hresult_e halfmove(sl_sock_t *c, sl_sock_hitem_t *item, const char *req){ + CHKALLOWED(); char buf[128]; int N = item->key[sizeof(CMD_HALF) - 1] - '0'; if(N < 1 || N > 2) return RESULT_BADKEY; @@ -196,6 +213,7 @@ void server_run(sl_socktype_e type, const char *node, sl_tty_t *serial){ LOGERR("server_run(): wrong parameters"); ERRX("server_run(): wrong parameters"); } + weather_data_t weather; dome_serialdev(serial); s = sl_sock_run_server(type, node, -1, handlers); if(!s) ERRX("Can't create socket and/or run threads"); @@ -203,14 +221,59 @@ void server_run(sl_socktype_e type, const char *node, sl_tty_t *serial){ sl_sock_maxclhandler(s, toomuch); sl_sock_connhandler(s, connected); sl_sock_dischandler(s, disconnected); + double tnow = sl_dtime(), tweather = 0.; + int cmdclosed = 0; while(s && s->connected){ if(!s->rthread){ LOGERR("Server handlers thread is dead"); break; } + if(tnow - tweather > WEATH_POLL){ + if(0 == get_weather_data(&weather)){ // got OK -> check if observations are forbidden + tweather = tnow; + int bad = 0; + if((double)weather.last_update - tnow > WEATHER_LOST) bad = 1; + if(weather.forceoff || weather.rain || weather.weather > WEATHER_BAD) bad = 1; + if(bad) BadWeather = 1; + else BadWeather = 0; + }else{ + if(tnow - tweather > WEATHER_LOST) BadWeather = 1; // lost weather IPC + } + } // finite state machine polling dome_poll(DOME_POLL, 0); + if(ForbidObservations || BadWeather){ + if(0 == cmdclosed){ + if(DOME_S_ERROR != dome_poll(DOME_CLOSE, 0)){ + LOGERR("Send command 'close' due to forbidden state"); + cmdclosed = 1; + } + } + } } sl_sock_delete(&s); ERRX("Server handlers thread is dead"); } + +void stopserver(){ + if(s && s->connected){ + s->connected = 0; + usleep(5000); + if(s) sl_sock_delete(&s); + } +} + +void forbid_observations(int forbid){ + if(forbid){ + ForbidObservations = true; + LOGWARN("Got forbidden signal"); + }else{ + ForbidObservations = false; + LOGWARN("Got allowed signal"); + } + DBG("Change ForbidObservations=%d", forbid); +} + +int get_forbidden(){ + return (ForbidObservations || BadWeather); +} diff --git a/Daemons/domedaemon-astrosib/server.h b/Daemons/domedaemon-astrosib/server.h index 1d4d78c..98504a0 100644 --- a/Daemons/domedaemon-astrosib/server.h +++ b/Daemons/domedaemon-astrosib/server.h @@ -20,4 +20,13 @@ #include +// size of weather/status buffers +#define STATBUF_SZ 256 +// dome polling interval (clear watchdog & get status) +#define T_INTERVAL (5.0) + void server_run(sl_socktype_e type, const char *node, sl_tty_t *serial); +const char *textst(int coverstate); +void stopserver(); +void forbid_observations(int forbid); +int get_forbidden(); diff --git a/Daemons/domedaemon_baader/.qtcreator/baader_dome.creator.user b/Daemons/domedaemon_baader/.qtcreator/baader_dome.creator.user index 9aa141d..1c48c97 100644 --- a/Daemons/domedaemon_baader/.qtcreator/baader_dome.creator.user +++ b/Daemons/domedaemon_baader/.qtcreator/baader_dome.creator.user @@ -1,6 +1,6 @@ - + EnvironmentId @@ -155,6 +155,7 @@ true 0 true + 2 @@ -191,6 +192,7 @@ true 0 true + 2 diff --git a/Daemons/domedaemon_baader/main.c b/Daemons/domedaemon_baader/main.c index 64b3f69..62cabac 100644 --- a/Daemons/domedaemon_baader/main.c +++ b/Daemons/domedaemon_baader/main.c @@ -136,10 +136,6 @@ int main(int argc, char **argv){ if(lvl >= LOGLEVEL_AMOUNT) lvl = LOGLEVEL_AMOUNT - 1; if(G.logfile) OPENLOG(G.logfile, lvl, 1); LOGMSG("Started"); - if(!term_open(G.termpath, G.serspeed, G.sertmout)){ - LOGERR("Can't open %s", G.termpath); - ERRX("Fatal error"); - } signal(SIGTERM, signals); signal(SIGINT, signals); signal(SIGQUIT, signals); @@ -163,6 +159,10 @@ int main(int argc, char **argv){ // react for USRx only in child signal(SIGUSR1, signals); signal(SIGUSR2, signals); + if(!term_open(G.termpath, G.serspeed, G.sertmout)){ + LOGERR("Can't open %s", G.termpath); + ERRX("Fatal error"); + } runserver(G.isunix, G.node, G.maxclients); LOGERR("Server error -> exit"); return 0; diff --git a/Daemons/domedaemon_baader/socket.c b/Daemons/domedaemon_baader/socket.c index c60102e..4c0bed5 100644 --- a/Daemons/domedaemon_baader/socket.c +++ b/Daemons/domedaemon_baader/socket.c @@ -309,7 +309,7 @@ void runserver(int isunix, const char *node, int maxclients){ if(bad) BadWeather = 1; else BadWeather = 0; }else{ - if(tweather - tnow > WEATHER_LOST) BadWeather = 1; // lost weather IPC + if(tnow - tweather > WEATHER_LOST) BadWeather = 1; // lost weather IPC } if(poll_device()){ tgot = tnow; diff --git a/Daemons/weatherdaemon/chkweather b/Daemons/weatherdaemon/chkweather deleted file mode 100644 index 9f87051..0000000 --- a/Daemons/weatherdaemon/chkweather +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash - -badsky=1700 -[ $# = 1 ] && badsky=$1 - -export http_proxy="" - -Q="192.168.70.33:12345" -ANS=$(curl $Q 2>/dev/null) -retval=$? -[ $retval -ne "0" ] && exit $retval -[ "$ANS" = "No data" ] && exit 2 -Rain=1 -Clouds=0 -Wind=100 -eval $ANS -retval=0 -clouds=$(echo "$Clouds" | sed 's/\..*//g') -wind=$(echo "$Wind" | sed 's/\..*//g') -[ $Rain -ne "0" ] && retval=1 -[ $clouds -lt "$badsky" ] && retval=1 -[ $wind -gt "15" ] && retval=1 -echo "$ANS" -exit $retval