diff --git a/Daemons/domedaemon-astrosib.deprecated/Makefile b/Daemons/deprecated/domedaemon-astrosib.deprecated/Makefile
similarity index 100%
rename from Daemons/domedaemon-astrosib.deprecated/Makefile
rename to Daemons/deprecated/domedaemon-astrosib.deprecated/Makefile
diff --git a/Daemons/domedaemon-astrosib.deprecated/Readme.md b/Daemons/deprecated/domedaemon-astrosib.deprecated/Readme.md
similarity index 100%
rename from Daemons/domedaemon-astrosib.deprecated/Readme.md
rename to Daemons/deprecated/domedaemon-astrosib.deprecated/Readme.md
diff --git a/Daemons/domedaemon-astrosib.deprecated/cmdlnopts.c b/Daemons/deprecated/domedaemon-astrosib.deprecated/cmdlnopts.c
similarity index 100%
rename from Daemons/domedaemon-astrosib.deprecated/cmdlnopts.c
rename to Daemons/deprecated/domedaemon-astrosib.deprecated/cmdlnopts.c
diff --git a/Daemons/domedaemon-astrosib.deprecated/cmdlnopts.h b/Daemons/deprecated/domedaemon-astrosib.deprecated/cmdlnopts.h
similarity index 100%
rename from Daemons/domedaemon-astrosib.deprecated/cmdlnopts.h
rename to Daemons/deprecated/domedaemon-astrosib.deprecated/cmdlnopts.h
diff --git a/Daemons/domedaemon-astrosib.deprecated/domeasib.cflags b/Daemons/deprecated/domedaemon-astrosib.deprecated/domeasib.cflags
similarity index 100%
rename from Daemons/domedaemon-astrosib.deprecated/domeasib.cflags
rename to Daemons/deprecated/domedaemon-astrosib.deprecated/domeasib.cflags
diff --git a/Daemons/domedaemon-astrosib.deprecated/domeasib.config b/Daemons/deprecated/domedaemon-astrosib.deprecated/domeasib.config
similarity index 100%
rename from Daemons/domedaemon-astrosib.deprecated/domeasib.config
rename to Daemons/deprecated/domedaemon-astrosib.deprecated/domeasib.config
diff --git a/Daemons/domedaemon-astrosib.deprecated/domeasib.creator b/Daemons/deprecated/domedaemon-astrosib.deprecated/domeasib.creator
similarity index 100%
rename from Daemons/domedaemon-astrosib.deprecated/domeasib.creator
rename to Daemons/deprecated/domedaemon-astrosib.deprecated/domeasib.creator
diff --git a/Daemons/domedaemon-astrosib.deprecated/domeasib.creator.user b/Daemons/deprecated/domedaemon-astrosib.deprecated/domeasib.creator.user
similarity index 100%
rename from Daemons/domedaemon-astrosib.deprecated/domeasib.creator.user
rename to Daemons/deprecated/domedaemon-astrosib.deprecated/domeasib.creator.user
diff --git a/Daemons/domedaemon-astrosib.deprecated/domeasib.cxxflags b/Daemons/deprecated/domedaemon-astrosib.deprecated/domeasib.cxxflags
similarity index 100%
rename from Daemons/domedaemon-astrosib.deprecated/domeasib.cxxflags
rename to Daemons/deprecated/domedaemon-astrosib.deprecated/domeasib.cxxflags
diff --git a/Daemons/domedaemon-astrosib.deprecated/domeasib.files b/Daemons/deprecated/domedaemon-astrosib.deprecated/domeasib.files
similarity index 100%
rename from Daemons/domedaemon-astrosib.deprecated/domeasib.files
rename to Daemons/deprecated/domedaemon-astrosib.deprecated/domeasib.files
diff --git a/Daemons/domedaemon-astrosib.deprecated/domeasib.includes b/Daemons/deprecated/domedaemon-astrosib.deprecated/domeasib.includes
similarity index 100%
rename from Daemons/domedaemon-astrosib.deprecated/domeasib.includes
rename to Daemons/deprecated/domedaemon-astrosib.deprecated/domeasib.includes
diff --git a/Daemons/domedaemon-astrosib.deprecated/main.c b/Daemons/deprecated/domedaemon-astrosib.deprecated/main.c
similarity index 100%
rename from Daemons/domedaemon-astrosib.deprecated/main.c
rename to Daemons/deprecated/domedaemon-astrosib.deprecated/main.c
diff --git a/Daemons/domedaemon-astrosib.deprecated/parseargs.c b/Daemons/deprecated/domedaemon-astrosib.deprecated/parseargs.c
similarity index 100%
rename from Daemons/domedaemon-astrosib.deprecated/parseargs.c
rename to Daemons/deprecated/domedaemon-astrosib.deprecated/parseargs.c
diff --git a/Daemons/domedaemon-astrosib.deprecated/parseargs.h b/Daemons/deprecated/domedaemon-astrosib.deprecated/parseargs.h
similarity index 100%
rename from Daemons/domedaemon-astrosib.deprecated/parseargs.h
rename to Daemons/deprecated/domedaemon-astrosib.deprecated/parseargs.h
diff --git a/Daemons/domedaemon-astrosib.deprecated/socket.c b/Daemons/deprecated/domedaemon-astrosib.deprecated/socket.c
similarity index 100%
rename from Daemons/domedaemon-astrosib.deprecated/socket.c
rename to Daemons/deprecated/domedaemon-astrosib.deprecated/socket.c
diff --git a/Daemons/domedaemon-astrosib.deprecated/socket.h b/Daemons/deprecated/domedaemon-astrosib.deprecated/socket.h
similarity index 100%
rename from Daemons/domedaemon-astrosib.deprecated/socket.h
rename to Daemons/deprecated/domedaemon-astrosib.deprecated/socket.h
diff --git a/Daemons/domedaemon-astrosib.deprecated/term.c b/Daemons/deprecated/domedaemon-astrosib.deprecated/term.c
similarity index 100%
rename from Daemons/domedaemon-astrosib.deprecated/term.c
rename to Daemons/deprecated/domedaemon-astrosib.deprecated/term.c
diff --git a/Daemons/domedaemon-astrosib.deprecated/term.h b/Daemons/deprecated/domedaemon-astrosib.deprecated/term.h
similarity index 100%
rename from Daemons/domedaemon-astrosib.deprecated/term.h
rename to Daemons/deprecated/domedaemon-astrosib.deprecated/term.h
diff --git a/Daemons/domedaemon-astrosib.deprecated/usefull_macros.c b/Daemons/deprecated/domedaemon-astrosib.deprecated/usefull_macros.c
similarity index 100%
rename from Daemons/domedaemon-astrosib.deprecated/usefull_macros.c
rename to Daemons/deprecated/domedaemon-astrosib.deprecated/usefull_macros.c
diff --git a/Daemons/domedaemon-astrosib.deprecated/usefull_macros.h b/Daemons/deprecated/domedaemon-astrosib.deprecated/usefull_macros.h
similarity index 100%
rename from Daemons/domedaemon-astrosib.deprecated/usefull_macros.h
rename to Daemons/deprecated/domedaemon-astrosib.deprecated/usefull_macros.h
diff --git a/Daemons/domedaemon/Makefile b/Daemons/deprecated/domedaemon/Makefile
similarity index 100%
rename from Daemons/domedaemon/Makefile
rename to Daemons/deprecated/domedaemon/Makefile
diff --git a/Daemons/domedaemon/Readme.md b/Daemons/deprecated/domedaemon/Readme.md
similarity index 100%
rename from Daemons/domedaemon/Readme.md
rename to Daemons/deprecated/domedaemon/Readme.md
diff --git a/Daemons/domedaemon/cmdlnopts.c b/Daemons/deprecated/domedaemon/cmdlnopts.c
similarity index 100%
rename from Daemons/domedaemon/cmdlnopts.c
rename to Daemons/deprecated/domedaemon/cmdlnopts.c
diff --git a/Daemons/domedaemon/cmdlnopts.h b/Daemons/deprecated/domedaemon/cmdlnopts.h
similarity index 100%
rename from Daemons/domedaemon/cmdlnopts.h
rename to Daemons/deprecated/domedaemon/cmdlnopts.h
diff --git a/Daemons/domedaemon/dome_readme.koi8-r b/Daemons/deprecated/domedaemon/dome_readme.koi8-r
similarity index 100%
rename from Daemons/domedaemon/dome_readme.koi8-r
rename to Daemons/deprecated/domedaemon/dome_readme.koi8-r
diff --git a/Daemons/domedaemon/main.c b/Daemons/deprecated/domedaemon/main.c
similarity index 100%
rename from Daemons/domedaemon/main.c
rename to Daemons/deprecated/domedaemon/main.c
diff --git a/Daemons/domedaemon/parseargs.c b/Daemons/deprecated/domedaemon/parseargs.c
similarity index 100%
rename from Daemons/domedaemon/parseargs.c
rename to Daemons/deprecated/domedaemon/parseargs.c
diff --git a/Daemons/domedaemon/parseargs.h b/Daemons/deprecated/domedaemon/parseargs.h
similarity index 100%
rename from Daemons/domedaemon/parseargs.h
rename to Daemons/deprecated/domedaemon/parseargs.h
diff --git a/Daemons/domedaemon/socket.c b/Daemons/deprecated/domedaemon/socket.c
similarity index 100%
rename from Daemons/domedaemon/socket.c
rename to Daemons/deprecated/domedaemon/socket.c
diff --git a/Daemons/domedaemon/socket.h b/Daemons/deprecated/domedaemon/socket.h
similarity index 100%
rename from Daemons/domedaemon/socket.h
rename to Daemons/deprecated/domedaemon/socket.h
diff --git a/Daemons/domedaemon/term.c b/Daemons/deprecated/domedaemon/term.c
similarity index 100%
rename from Daemons/domedaemon/term.c
rename to Daemons/deprecated/domedaemon/term.c
diff --git a/Daemons/domedaemon/term.h b/Daemons/deprecated/domedaemon/term.h
similarity index 100%
rename from Daemons/domedaemon/term.h
rename to Daemons/deprecated/domedaemon/term.h
diff --git a/Daemons/domedaemon/usefull_macros.c b/Daemons/deprecated/domedaemon/usefull_macros.c
similarity index 100%
rename from Daemons/domedaemon/usefull_macros.c
rename to Daemons/deprecated/domedaemon/usefull_macros.c
diff --git a/Daemons/domedaemon/usefull_macros.h b/Daemons/deprecated/domedaemon/usefull_macros.h
similarity index 100%
rename from Daemons/domedaemon/usefull_macros.h
rename to Daemons/deprecated/domedaemon/usefull_macros.h
diff --git a/Daemons/netdaemon.deprecated/Makefile b/Daemons/deprecated/netdaemon.deprecated/Makefile
similarity index 100%
rename from Daemons/netdaemon.deprecated/Makefile
rename to Daemons/deprecated/netdaemon.deprecated/Makefile
diff --git a/Daemons/netdaemon.deprecated/Readme.md b/Daemons/deprecated/netdaemon.deprecated/Readme.md
similarity index 100%
rename from Daemons/netdaemon.deprecated/Readme.md
rename to Daemons/deprecated/netdaemon.deprecated/Readme.md
diff --git a/Daemons/netdaemon.deprecated/cmdlnopts.c b/Daemons/deprecated/netdaemon.deprecated/cmdlnopts.c
similarity index 100%
rename from Daemons/netdaemon.deprecated/cmdlnopts.c
rename to Daemons/deprecated/netdaemon.deprecated/cmdlnopts.c
diff --git a/Daemons/netdaemon.deprecated/cmdlnopts.h b/Daemons/deprecated/netdaemon.deprecated/cmdlnopts.h
similarity index 100%
rename from Daemons/netdaemon.deprecated/cmdlnopts.h
rename to Daemons/deprecated/netdaemon.deprecated/cmdlnopts.h
diff --git a/Daemons/netdaemon.deprecated/main.c b/Daemons/deprecated/netdaemon.deprecated/main.c
similarity index 100%
rename from Daemons/netdaemon.deprecated/main.c
rename to Daemons/deprecated/netdaemon.deprecated/main.c
diff --git a/Daemons/netdaemon.deprecated/netdaemon-template.config b/Daemons/deprecated/netdaemon.deprecated/netdaemon-template.config
similarity index 100%
rename from Daemons/netdaemon.deprecated/netdaemon-template.config
rename to Daemons/deprecated/netdaemon.deprecated/netdaemon-template.config
diff --git a/Daemons/netdaemon.deprecated/netdaemon-template.creator b/Daemons/deprecated/netdaemon.deprecated/netdaemon-template.creator
similarity index 100%
rename from Daemons/netdaemon.deprecated/netdaemon-template.creator
rename to Daemons/deprecated/netdaemon.deprecated/netdaemon-template.creator
diff --git a/Daemons/netdaemon.deprecated/netdaemon-template.files b/Daemons/deprecated/netdaemon.deprecated/netdaemon-template.files
similarity index 100%
rename from Daemons/netdaemon.deprecated/netdaemon-template.files
rename to Daemons/deprecated/netdaemon.deprecated/netdaemon-template.files
diff --git a/Daemons/netdaemon.deprecated/netdaemon-template.includes b/Daemons/deprecated/netdaemon.deprecated/netdaemon-template.includes
similarity index 100%
rename from Daemons/netdaemon.deprecated/netdaemon-template.includes
rename to Daemons/deprecated/netdaemon.deprecated/netdaemon-template.includes
diff --git a/Daemons/netdaemon.deprecated/parseargs.c b/Daemons/deprecated/netdaemon.deprecated/parseargs.c
similarity index 100%
rename from Daemons/netdaemon.deprecated/parseargs.c
rename to Daemons/deprecated/netdaemon.deprecated/parseargs.c
diff --git a/Daemons/netdaemon.deprecated/parseargs.h b/Daemons/deprecated/netdaemon.deprecated/parseargs.h
similarity index 100%
rename from Daemons/netdaemon.deprecated/parseargs.h
rename to Daemons/deprecated/netdaemon.deprecated/parseargs.h
diff --git a/Daemons/netdaemon.deprecated/socket.c b/Daemons/deprecated/netdaemon.deprecated/socket.c
similarity index 100%
rename from Daemons/netdaemon.deprecated/socket.c
rename to Daemons/deprecated/netdaemon.deprecated/socket.c
diff --git a/Daemons/netdaemon.deprecated/socket.h b/Daemons/deprecated/netdaemon.deprecated/socket.h
similarity index 100%
rename from Daemons/netdaemon.deprecated/socket.h
rename to Daemons/deprecated/netdaemon.deprecated/socket.h
diff --git a/Daemons/netdaemon.deprecated/term.c b/Daemons/deprecated/netdaemon.deprecated/term.c
similarity index 100%
rename from Daemons/netdaemon.deprecated/term.c
rename to Daemons/deprecated/netdaemon.deprecated/term.c
diff --git a/Daemons/netdaemon.deprecated/term.h b/Daemons/deprecated/netdaemon.deprecated/term.h
similarity index 100%
rename from Daemons/netdaemon.deprecated/term.h
rename to Daemons/deprecated/netdaemon.deprecated/term.h
diff --git a/Daemons/netdaemon.deprecated/usefull_macros.c b/Daemons/deprecated/netdaemon.deprecated/usefull_macros.c
similarity index 100%
rename from Daemons/netdaemon.deprecated/usefull_macros.c
rename to Daemons/deprecated/netdaemon.deprecated/usefull_macros.c
diff --git a/Daemons/netdaemon.deprecated/usefull_macros.h b/Daemons/deprecated/netdaemon.deprecated/usefull_macros.h
similarity index 100%
rename from Daemons/netdaemon.deprecated/usefull_macros.h
rename to Daemons/deprecated/netdaemon.deprecated/usefull_macros.h
diff --git a/Daemons/weatherdaemon.deprecated/Makefile b/Daemons/deprecated/weatherdaemon.deprecated/Makefile
similarity index 100%
rename from Daemons/weatherdaemon.deprecated/Makefile
rename to Daemons/deprecated/weatherdaemon.deprecated/Makefile
diff --git a/Daemons/weatherdaemon.deprecated/Readme.md b/Daemons/deprecated/weatherdaemon.deprecated/Readme.md
similarity index 100%
rename from Daemons/weatherdaemon.deprecated/Readme.md
rename to Daemons/deprecated/weatherdaemon.deprecated/Readme.md
diff --git a/Daemons/weatherdaemon.deprecated/bta_shdata.c b/Daemons/deprecated/weatherdaemon.deprecated/bta_shdata.c
similarity index 100%
rename from Daemons/weatherdaemon.deprecated/bta_shdata.c
rename to Daemons/deprecated/weatherdaemon.deprecated/bta_shdata.c
diff --git a/Daemons/weatherdaemon.deprecated/bta_shdata.h b/Daemons/deprecated/weatherdaemon.deprecated/bta_shdata.h
similarity index 100%
rename from Daemons/weatherdaemon.deprecated/bta_shdata.h
rename to Daemons/deprecated/weatherdaemon.deprecated/bta_shdata.h
diff --git a/Daemons/weatherdaemon.deprecated/chkweather b/Daemons/deprecated/weatherdaemon.deprecated/chkweather
similarity index 100%
rename from Daemons/weatherdaemon.deprecated/chkweather
rename to Daemons/deprecated/weatherdaemon.deprecated/chkweather
diff --git a/Daemons/weatherdaemon.deprecated/cmdlnopts.c b/Daemons/deprecated/weatherdaemon.deprecated/cmdlnopts.c
similarity index 100%
rename from Daemons/weatherdaemon.deprecated/cmdlnopts.c
rename to Daemons/deprecated/weatherdaemon.deprecated/cmdlnopts.c
diff --git a/Daemons/weatherdaemon.deprecated/cmdlnopts.h b/Daemons/deprecated/weatherdaemon.deprecated/cmdlnopts.h
similarity index 100%
rename from Daemons/weatherdaemon.deprecated/cmdlnopts.h
rename to Daemons/deprecated/weatherdaemon.deprecated/cmdlnopts.h
diff --git a/Daemons/weatherdaemon.deprecated/main.c b/Daemons/deprecated/weatherdaemon.deprecated/main.c
similarity index 100%
rename from Daemons/weatherdaemon.deprecated/main.c
rename to Daemons/deprecated/weatherdaemon.deprecated/main.c
diff --git a/Daemons/weatherdaemon.deprecated/socket.c b/Daemons/deprecated/weatherdaemon.deprecated/socket.c
similarity index 100%
rename from Daemons/weatherdaemon.deprecated/socket.c
rename to Daemons/deprecated/weatherdaemon.deprecated/socket.c
diff --git a/Daemons/weatherdaemon.deprecated/socket.h b/Daemons/deprecated/weatherdaemon.deprecated/socket.h
similarity index 100%
rename from Daemons/weatherdaemon.deprecated/socket.h
rename to Daemons/deprecated/weatherdaemon.deprecated/socket.h
diff --git a/Daemons/weatherdaemon.deprecated/term.c b/Daemons/deprecated/weatherdaemon.deprecated/term.c
similarity index 100%
rename from Daemons/weatherdaemon.deprecated/term.c
rename to Daemons/deprecated/weatherdaemon.deprecated/term.c
diff --git a/Daemons/weatherdaemon.deprecated/term.h b/Daemons/deprecated/weatherdaemon.deprecated/term.h
similarity index 100%
rename from Daemons/weatherdaemon.deprecated/term.h
rename to Daemons/deprecated/weatherdaemon.deprecated/term.h
diff --git a/Daemons/weatherdaemon.deprecated/weatherdaemon.cflags b/Daemons/deprecated/weatherdaemon.deprecated/weatherdaemon.cflags
similarity index 100%
rename from Daemons/weatherdaemon.deprecated/weatherdaemon.cflags
rename to Daemons/deprecated/weatherdaemon.deprecated/weatherdaemon.cflags
diff --git a/Daemons/weatherdaemon.deprecated/weatherdaemon.config b/Daemons/deprecated/weatherdaemon.deprecated/weatherdaemon.config
similarity index 100%
rename from Daemons/weatherdaemon.deprecated/weatherdaemon.config
rename to Daemons/deprecated/weatherdaemon.deprecated/weatherdaemon.config
diff --git a/Daemons/weatherdaemon.deprecated/weatherdaemon.creator b/Daemons/deprecated/weatherdaemon.deprecated/weatherdaemon.creator
similarity index 100%
rename from Daemons/weatherdaemon.deprecated/weatherdaemon.creator
rename to Daemons/deprecated/weatherdaemon.deprecated/weatherdaemon.creator
diff --git a/Daemons/weatherdaemon.deprecated/weatherdaemon.creator.user b/Daemons/deprecated/weatherdaemon.deprecated/weatherdaemon.creator.user
similarity index 100%
rename from Daemons/weatherdaemon.deprecated/weatherdaemon.creator.user
rename to Daemons/deprecated/weatherdaemon.deprecated/weatherdaemon.creator.user
diff --git a/Daemons/weatherdaemon.deprecated/weatherdaemon.creator.user.4.9-pre1 b/Daemons/deprecated/weatherdaemon.deprecated/weatherdaemon.creator.user.4.9-pre1
similarity index 100%
rename from Daemons/weatherdaemon.deprecated/weatherdaemon.creator.user.4.9-pre1
rename to Daemons/deprecated/weatherdaemon.deprecated/weatherdaemon.creator.user.4.9-pre1
diff --git a/Daemons/weatherdaemon.deprecated/weatherdaemon.cxxflags b/Daemons/deprecated/weatherdaemon.deprecated/weatherdaemon.cxxflags
similarity index 100%
rename from Daemons/weatherdaemon.deprecated/weatherdaemon.cxxflags
rename to Daemons/deprecated/weatherdaemon.deprecated/weatherdaemon.cxxflags
diff --git a/Daemons/weatherdaemon.deprecated/weatherdaemon.files b/Daemons/deprecated/weatherdaemon.deprecated/weatherdaemon.files
similarity index 100%
rename from Daemons/weatherdaemon.deprecated/weatherdaemon.files
rename to Daemons/deprecated/weatherdaemon.deprecated/weatherdaemon.files
diff --git a/Daemons/weatherdaemon.deprecated/weatherdaemon.includes b/Daemons/deprecated/weatherdaemon.deprecated/weatherdaemon.includes
similarity index 100%
rename from Daemons/weatherdaemon.deprecated/weatherdaemon.includes
rename to Daemons/deprecated/weatherdaemon.deprecated/weatherdaemon.includes
diff --git a/Daemons/weatherdaemon_newmeteo.deprecated/Makefile b/Daemons/deprecated/weatherdaemon_newmeteo.deprecated/Makefile
similarity index 100%
rename from Daemons/weatherdaemon_newmeteo.deprecated/Makefile
rename to Daemons/deprecated/weatherdaemon_newmeteo.deprecated/Makefile
diff --git a/Daemons/weatherdaemon_newmeteo.deprecated/Readme.md b/Daemons/deprecated/weatherdaemon_newmeteo.deprecated/Readme.md
similarity index 100%
rename from Daemons/weatherdaemon_newmeteo.deprecated/Readme.md
rename to Daemons/deprecated/weatherdaemon_newmeteo.deprecated/Readme.md
diff --git a/Daemons/weatherdaemon_newmeteo.deprecated/cmdlnopts.c b/Daemons/deprecated/weatherdaemon_newmeteo.deprecated/cmdlnopts.c
similarity index 100%
rename from Daemons/weatherdaemon_newmeteo.deprecated/cmdlnopts.c
rename to Daemons/deprecated/weatherdaemon_newmeteo.deprecated/cmdlnopts.c
diff --git a/Daemons/weatherdaemon_newmeteo.deprecated/cmdlnopts.h b/Daemons/deprecated/weatherdaemon_newmeteo.deprecated/cmdlnopts.h
similarity index 100%
rename from Daemons/weatherdaemon_newmeteo.deprecated/cmdlnopts.h
rename to Daemons/deprecated/weatherdaemon_newmeteo.deprecated/cmdlnopts.h
diff --git a/Daemons/weatherdaemon_newmeteo.deprecated/main.c b/Daemons/deprecated/weatherdaemon_newmeteo.deprecated/main.c
similarity index 100%
rename from Daemons/weatherdaemon_newmeteo.deprecated/main.c
rename to Daemons/deprecated/weatherdaemon_newmeteo.deprecated/main.c
diff --git a/Daemons/weatherdaemon_newmeteo.deprecated/socket.c b/Daemons/deprecated/weatherdaemon_newmeteo.deprecated/socket.c
similarity index 100%
rename from Daemons/weatherdaemon_newmeteo.deprecated/socket.c
rename to Daemons/deprecated/weatherdaemon_newmeteo.deprecated/socket.c
diff --git a/Daemons/weatherdaemon_newmeteo.deprecated/socket.h b/Daemons/deprecated/weatherdaemon_newmeteo.deprecated/socket.h
similarity index 100%
rename from Daemons/weatherdaemon_newmeteo.deprecated/socket.h
rename to Daemons/deprecated/weatherdaemon_newmeteo.deprecated/socket.h
diff --git a/Daemons/weatherdaemon_newmeteo.deprecated/stat.c b/Daemons/deprecated/weatherdaemon_newmeteo.deprecated/stat.c
similarity index 100%
rename from Daemons/weatherdaemon_newmeteo.deprecated/stat.c
rename to Daemons/deprecated/weatherdaemon_newmeteo.deprecated/stat.c
diff --git a/Daemons/weatherdaemon_newmeteo.deprecated/stat.h b/Daemons/deprecated/weatherdaemon_newmeteo.deprecated/stat.h
similarity index 100%
rename from Daemons/weatherdaemon_newmeteo.deprecated/stat.h
rename to Daemons/deprecated/weatherdaemon_newmeteo.deprecated/stat.h
diff --git a/Daemons/weatherdaemon_newmeteo.deprecated/term.c b/Daemons/deprecated/weatherdaemon_newmeteo.deprecated/term.c
similarity index 100%
rename from Daemons/weatherdaemon_newmeteo.deprecated/term.c
rename to Daemons/deprecated/weatherdaemon_newmeteo.deprecated/term.c
diff --git a/Daemons/weatherdaemon_newmeteo.deprecated/term.h b/Daemons/deprecated/weatherdaemon_newmeteo.deprecated/term.h
similarity index 100%
rename from Daemons/weatherdaemon_newmeteo.deprecated/term.h
rename to Daemons/deprecated/weatherdaemon_newmeteo.deprecated/term.h
diff --git a/Daemons/weatherdaemon_newmeteo.deprecated/weatherdaemon.cflags b/Daemons/deprecated/weatherdaemon_newmeteo.deprecated/weatherdaemon.cflags
similarity index 100%
rename from Daemons/weatherdaemon_newmeteo.deprecated/weatherdaemon.cflags
rename to Daemons/deprecated/weatherdaemon_newmeteo.deprecated/weatherdaemon.cflags
diff --git a/Daemons/weatherdaemon_newmeteo.deprecated/weatherdaemon.config b/Daemons/deprecated/weatherdaemon_newmeteo.deprecated/weatherdaemon.config
similarity index 100%
rename from Daemons/weatherdaemon_newmeteo.deprecated/weatherdaemon.config
rename to Daemons/deprecated/weatherdaemon_newmeteo.deprecated/weatherdaemon.config
diff --git a/Daemons/weatherdaemon_newmeteo.deprecated/weatherdaemon.creator b/Daemons/deprecated/weatherdaemon_newmeteo.deprecated/weatherdaemon.creator
similarity index 100%
rename from Daemons/weatherdaemon_newmeteo.deprecated/weatherdaemon.creator
rename to Daemons/deprecated/weatherdaemon_newmeteo.deprecated/weatherdaemon.creator
diff --git a/Daemons/weatherdaemon_newmeteo.deprecated/weatherdaemon.creator.user b/Daemons/deprecated/weatherdaemon_newmeteo.deprecated/weatherdaemon.creator.user
similarity index 100%
rename from Daemons/weatherdaemon_newmeteo.deprecated/weatherdaemon.creator.user
rename to Daemons/deprecated/weatherdaemon_newmeteo.deprecated/weatherdaemon.creator.user
diff --git a/Daemons/weatherdaemon_newmeteo.deprecated/weatherdaemon.creator.user.4.9-pre1 b/Daemons/deprecated/weatherdaemon_newmeteo.deprecated/weatherdaemon.creator.user.4.9-pre1
similarity index 100%
rename from Daemons/weatherdaemon_newmeteo.deprecated/weatherdaemon.creator.user.4.9-pre1
rename to Daemons/deprecated/weatherdaemon_newmeteo.deprecated/weatherdaemon.creator.user.4.9-pre1
diff --git a/Daemons/weatherdaemon_newmeteo.deprecated/weatherdaemon.creator.user.7bd84e3 b/Daemons/deprecated/weatherdaemon_newmeteo.deprecated/weatherdaemon.creator.user.7bd84e3
similarity index 100%
rename from Daemons/weatherdaemon_newmeteo.deprecated/weatherdaemon.creator.user.7bd84e3
rename to Daemons/deprecated/weatherdaemon_newmeteo.deprecated/weatherdaemon.creator.user.7bd84e3
diff --git a/Daemons/weatherdaemon_newmeteo.deprecated/weatherdaemon.cxxflags b/Daemons/deprecated/weatherdaemon_newmeteo.deprecated/weatherdaemon.cxxflags
similarity index 100%
rename from Daemons/weatherdaemon_newmeteo.deprecated/weatherdaemon.cxxflags
rename to Daemons/deprecated/weatherdaemon_newmeteo.deprecated/weatherdaemon.cxxflags
diff --git a/Daemons/weatherdaemon_newmeteo.deprecated/weatherdaemon.files b/Daemons/deprecated/weatherdaemon_newmeteo.deprecated/weatherdaemon.files
similarity index 100%
rename from Daemons/weatherdaemon_newmeteo.deprecated/weatherdaemon.files
rename to Daemons/deprecated/weatherdaemon_newmeteo.deprecated/weatherdaemon.files
diff --git a/Daemons/weatherdaemon_newmeteo.deprecated/weatherdaemon.includes b/Daemons/deprecated/weatherdaemon_newmeteo.deprecated/weatherdaemon.includes
similarity index 100%
rename from Daemons/weatherdaemon_newmeteo.deprecated/weatherdaemon.includes
rename to Daemons/deprecated/weatherdaemon_newmeteo.deprecated/weatherdaemon.includes
diff --git a/Daemons/domedaemon_baader/.qtcreator/baader_dome.creator.user b/Daemons/domedaemon_baader/.qtcreator/baader_dome.creator.user
new file mode 100644
index 0000000..3a93b01
--- /dev/null
+++ b/Daemons/domedaemon_baader/.qtcreator/baader_dome.creator.user
@@ -0,0 +1,222 @@
+
+
+
+
+
+ EnvironmentId
+ {7bd84e39-ca37-46d3-be9d-99ebea85bc0d}
+
+
+ ProjectExplorer.Project.ActiveTarget
+ 0
+
+
+ ProjectExplorer.Project.EditorSettings
+
+ true
+ true
+ true
+
+ Cpp
+
+ CppGlobal
+
+
+
+ QmlJS
+
+ QmlJSGlobal
+
+
+ 2
+ KOI8-R
+ false
+ 4
+ false
+ 0
+ 80
+ true
+ true
+ 1
+ 0
+ false
+ true
+ false
+ 0
+ true
+ true
+ 0
+ 8
+ true
+ false
+ 1
+ true
+ false
+ true
+ *.md, *.MD, Makefile
+ false
+ true
+ true
+
+
+
+ ProjectExplorer.Project.PluginSettings
+
+
+ true
+ false
+ true
+ true
+ true
+ true
+
+ false
+
+
+ 0
+ true
+
+ true
+ true
+ Builtin.DefaultTidyAndClazy
+ 8
+ true
+
+
+
+ true
+
+ 0
+
+
+
+ ProjectExplorer.Project.Target.0
+
+ Desktop
+ true
+ Desktop
+ Desktop
+ {65a14f9e-e008-4c1b-89df-4eaa4774b6e3}
+ 0
+ 0
+ 0
+
+ /Big/Data/00__Small_tel/C-sources/domedaemon_baader
+
+
+
+ all
+
+ true
+ GenericProjectManager.GenericMakeStep
+
+ 1
+ Build
+ Build
+ ProjectExplorer.BuildSteps.Build
+
+
+
+
+ clean
+
+ true
+ GenericProjectManager.GenericMakeStep
+
+ 1
+ Clean
+ Clean
+ ProjectExplorer.BuildSteps.Clean
+
+ 2
+ false
+
+ false
+
+ Default
+ 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
+ %{RunConfig:Executable:Path}
+
+ 1
+
+ 1
+
+
+ 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
+ %{RunConfig:Executable:Path}
+
+ 1
+
+
+
+ ProjectExplorer.Project.TargetCount
+ 1
+
+
+ Version
+ 22
+
+
diff --git a/Daemons/domedaemon_baader/.qtcreator/project.json b/Daemons/domedaemon_baader/.qtcreator/project.json
new file mode 100644
index 0000000..6bdef87
--- /dev/null
+++ b/Daemons/domedaemon_baader/.qtcreator/project.json
@@ -0,0 +1,6 @@
+{
+ "$schema": "https://download.qt.io/official_releases/qtcreator/latest/installer_source/jsonschemas/project.json",
+ "files.exclude": [
+ ".qtcreator/project.json.user"
+ ]
+}
diff --git a/Daemons/domedaemon_baader/.qtcreator/project.json.user b/Daemons/domedaemon_baader/.qtcreator/project.json.user
new file mode 100644
index 0000000..e2ab388
--- /dev/null
+++ b/Daemons/domedaemon_baader/.qtcreator/project.json.user
@@ -0,0 +1,208 @@
+
+
+
+
+
+ EnvironmentId
+ {7bd84e39-ca37-46d3-be9d-99ebea85bc0d}
+
+
+ ProjectExplorer.Project.ActiveTarget
+ 0
+
+
+ ProjectExplorer.Project.EditorSettings
+
+ true
+ true
+ true
+
+ Cpp
+
+ CppGlobal
+
+
+
+ QmlJS
+
+ QmlJSGlobal
+
+
+ 2
+ KOI8-R
+ false
+ 4
+ false
+ 0
+ 80
+ true
+ true
+ 1
+ 0
+ false
+ true
+ false
+ 0
+ true
+ true
+ 0
+ 8
+ true
+ false
+ 1
+ true
+ false
+ true
+ *.md, *.MD, Makefile
+ false
+ true
+ true
+
+
+
+ ProjectExplorer.Project.PluginSettings
+
+
+ true
+ false
+ true
+ true
+ true
+ true
+
+ false
+
+
+ 0
+ true
+
+ true
+ true
+ Builtin.DefaultTidyAndClazy
+ 8
+ true
+
+
+
+ true
+
+ 0
+
+
+
+ ProjectExplorer.Project.Target.0
+
+ Desktop
+ true
+ Desktop
+ Desktop
+ {65a14f9e-e008-4c1b-89df-4eaa4774b6e3}
+ 0
+ 0
+ 0
+
+ /Big/Data/00__Small_tel/C-sources/domedaemon_baader/build
+
+ 0
+ Build
+ Build
+ ProjectExplorer.BuildSteps.Build
+
+
+ 0
+ Clean
+ Clean
+ ProjectExplorer.BuildSteps.Clean
+
+ 2
+ false
+
+ false
+
+ Default
+ WorkspaceProject.BuildConfiguration
+ 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
+ %{RunConfig:Executable:Path}
+
+ 1
+
+ 1
+
+
+ 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
+ %{RunConfig:Executable:Path}
+
+ 1
+
+
+
+ ProjectExplorer.Project.TargetCount
+ 1
+
+
+ Version
+ 22
+
+
diff --git a/Daemons/domedaemon_baader/Makefile b/Daemons/domedaemon_baader/Makefile
new file mode 100644
index 0000000..3bbbd69
--- /dev/null
+++ b/Daemons/domedaemon_baader/Makefile
@@ -0,0 +1,57 @@
+# run `make DEF=...` to add extra defines
+PROGRAM := domedaemon
+LDFLAGS := -fdata-sections -ffunction-sections -Wl,--gc-sections -Wl,--discard-all
+LDFLAGS += -lusefull_macros
+SRCS := $(wildcard *.c)
+DEFINES := $(DEF) -D_GNU_SOURCE -D_XOPEN_SOURCE=1111
+OBJDIR := mk
+CFLAGS += -O2 -Wall -Wextra -Wno-trampolines -std=gnu99
+OBJS := $(addprefix $(OBJDIR)/, $(SRCS:%.c=%.o))
+DEPS := $(OBJS:.o=.d)
+TARGFILE := $(OBJDIR)/TARGET
+CC = gcc
+#TARGET := RELEASE
+
+ifeq ($(shell test -e $(TARGFILE) && echo -n yes),yes)
+ TARGET := $(file < $(TARGFILE))
+else
+ TARGET := RELEASE
+endif
+
+ifeq ($(TARGET), DEBUG)
+ .DEFAULT_GOAL := debug
+endif
+
+release: $(PROGRAM)
+
+debug: CFLAGS += -DEBUG -Werror
+debug: TARGET := DEBUG
+debug: $(PROGRAM)
+
+$(TARGFILE): $(OBJDIR)
+ @echo -e "\t\tTARGET: $(TARGET)"
+ @echo "$(TARGET)" > $(TARGFILE)
+
+$(PROGRAM) : $(TARGFILE) $(OBJS)
+ @echo -e "\t\tLD $(PROGRAM)"
+ $(CC) $(OBJS) $(LDFLAGS) -o $(PROGRAM)
+
+$(OBJDIR):
+ @mkdir $(OBJDIR)
+
+ifneq ($(MAKECMDGOALS),clean)
+-include $(DEPS)
+endif
+
+$(OBJDIR)/%.o: %.c
+ @echo -e "\t\tCC $<"
+ $(CC) $< -MD -c $(LDFLAGS) $(CFLAGS) $(DEFINES) -o $@
+
+clean:
+ @echo -e "\t\tCLEAN"
+ @rm -rf $(OBJDIR) 2>/dev/null || true
+
+xclean: clean
+ @rm -f $(PROGRAM)
+
+.PHONY: clean xclean
diff --git a/Daemons/domedaemon_baader/baader_dome.cflags b/Daemons/domedaemon_baader/baader_dome.cflags
new file mode 100644
index 0000000..68d5165
--- /dev/null
+++ b/Daemons/domedaemon_baader/baader_dome.cflags
@@ -0,0 +1 @@
+-std=c17
\ No newline at end of file
diff --git a/Daemons/domedaemon_baader/baader_dome.config b/Daemons/domedaemon_baader/baader_dome.config
new file mode 100644
index 0000000..baa1bf1
--- /dev/null
+++ b/Daemons/domedaemon_baader/baader_dome.config
@@ -0,0 +1,3 @@
+// Add predefined macros for your project here. For example:
+// #define THE_ANSWER 42
+#define EBUG
diff --git a/Daemons/domedaemon_baader/baader_dome.creator b/Daemons/domedaemon_baader/baader_dome.creator
new file mode 100644
index 0000000..e94cbbd
--- /dev/null
+++ b/Daemons/domedaemon_baader/baader_dome.creator
@@ -0,0 +1 @@
+[General]
diff --git a/Daemons/domedaemon_baader/baader_dome.cxxflags b/Daemons/domedaemon_baader/baader_dome.cxxflags
new file mode 100644
index 0000000..6435dfc
--- /dev/null
+++ b/Daemons/domedaemon_baader/baader_dome.cxxflags
@@ -0,0 +1 @@
+-std=c++17
\ No newline at end of file
diff --git a/Daemons/domedaemon_baader/baader_dome.files b/Daemons/domedaemon_baader/baader_dome.files
new file mode 100644
index 0000000..9b3fd75
--- /dev/null
+++ b/Daemons/domedaemon_baader/baader_dome.files
@@ -0,0 +1,5 @@
+main.c
+socket.c
+socket.h
+term.c
+term.h
diff --git a/Daemons/domedaemon_baader/baader_dome.includes b/Daemons/domedaemon_baader/baader_dome.includes
new file mode 100644
index 0000000..e69de29
diff --git a/Daemons/domedaemon_baader/dome_readme.koi8-r b/Daemons/domedaemon_baader/dome_readme.koi8-r
new file mode 100644
index 0000000..5db49a9
--- /dev/null
+++ b/Daemons/domedaemon_baader/dome_readme.koi8-r
@@ -0,0 +1,15 @@
+Протокол управления куполом
+
+в случае ошибки коммуникации ответ - d#comerro -> повторить запрос
+в случае ошибки купола ответ - d#domerro
+
+d#opendom - открыть
+d#closdom - закрыть
+d#stopdom - остановить
+d#get_dom - текущее положение
+ ответ: d#posXXXX, X=0 - движение или промежуточное положение, 1 - сегмент полностью открыт, 2 - сегмент полностью закрыт
+d#warning - состояние ошибок
+ ответ: d#erro123, позиции: 1 - дождь, 2 - таймаут, 3 - отключение питания (висит на упсе)
+ значение: 0 - все в порядке, 1 - тревога (купол закрывается)
+d#ask_wea - погодный датчик
+ ответ: d#weaX000, X==1 - дождь или облака
diff --git a/Daemons/domedaemon_baader/main.c b/Daemons/domedaemon_baader/main.c
new file mode 100644
index 0000000..bcbabee
--- /dev/null
+++ b/Daemons/domedaemon_baader/main.c
@@ -0,0 +1,100 @@
+/*
+ * 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
+#include
+
+#include "socket.h"
+#include "term.h"
+
+typedef struct{
+ int help;
+ int verbose;
+ int isunix;
+ int maxclients;
+ int serspeed;
+ double sertmout;
+ char *logfile;
+ char *node;
+ char *termpath;
+ char *pidfile;
+} parameters;
+
+static parameters G = {
+ .maxclients = 2,
+ .serspeed = 9600
+};
+
+static sl_option_t cmdlnopts[] = {
+ {"help", NO_ARGS, NULL, 'h', arg_int, APTR(&G.help), "show this help"},
+ {"verbose", NO_ARGS, NULL, 'v', arg_none, APTR(&G.verbose), "verbose level (each -v adds 1)"},
+ {"logfile", NEED_ARG, NULL, 'l', arg_string, APTR(&G.logfile), "log file name"},
+ {"node", NEED_ARG, NULL, 'n', arg_string, APTR(&G.node), "node \"IP\", \"name:IP\" or path (could be \"\\0path\" for anonymous UNIX-socket)"},
+ {"unixsock", NO_ARGS, NULL, 'u', arg_int, APTR(&G.isunix), "UNIX socket instead of INET"},
+ {"maxclients", NEED_ARG, NULL, 'm', arg_int, APTR(&G.maxclients),"max amount of clients connected to server (default: 2)"},
+ {"pidfile", NEED_ARG, NULL, 'p', arg_string, APTR(&G.pidfile), "PID-file"},
+ {"serialdev", NEED_ARG, NULL, 'd', arg_string, APTR(&G.termpath), "full path to serial device"},
+ {"baudrate", NEED_ARG, NULL, 'b', arg_int, APTR(&G.serspeed), "serial device speed (baud)"},
+ {"sertmout", NEED_ARG, NULL, 'T', arg_double, APTR(&G.sertmout), "serial device timeout (us)"},
+ end_option
+};
+
+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");
+ DBG("Stop server");
+ stopserver();
+ DBG("Close terminal");
+ close_term();
+ DBG("Exit");
+ exit(sig);
+}
+
+
+int main(int argc, char **argv){
+ sl_init();
+ sl_parseargs(&argc, &argv, cmdlnopts);
+ if(G.help) sl_showhelp(-1, cmdlnopts);
+ if(!G.node) ERRX("Point node");
+ if(!G.termpath) ERRX("Point serial device path");
+ sl_check4running((char*)__progname, G.pidfile);
+ sl_loglevel_e lvl = G.verbose + LOGLEVEL_ERR;
+ if(lvl >= LOGLEVEL_AMOUNT) lvl = LOGLEVEL_AMOUNT - 1;
+ if(G.logfile) OPENLOG(G.logfile, lvl, 1);
+ LOGMSG("Started");
+ if(!open_term(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);
+ signal(SIGTSTP, SIG_IGN);
+ signal(SIGHUP, signals);
+ runserver(G.isunix, G.node, G.maxclients);
+ LOGMSG("Ended");
+ DBG("Close");
+ return 0;
+}
diff --git a/Daemons/domedaemon_baader/socket.c b/Daemons/domedaemon_baader/socket.c
new file mode 100644
index 0000000..c2590e3
--- /dev/null
+++ b/Daemons/domedaemon_baader/socket.c
@@ -0,0 +1,357 @@
+/**
+ * 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 "socket.h"
+#include "term.h"
+
+typedef enum{
+ CMD_OPEN,
+ CMD_CLOSE,
+ CMD_STOP,
+ CMD_NONE
+} dome_commands_t;
+
+typedef struct{
+ dome_commands_t cmd;
+ int errcode; // error code
+ char *status; // device status
+ int statlen; // size of `status` buffer
+ double stattime;// time of last status
+ char *weather; // data from weather sensor
+ int weathlen; // length of `weather` buffer
+ double weathtime;// time of last weather
+ pthread_mutex_t mutex;
+} dome_t;
+
+static dome_t Dome = {0};
+
+static sl_sock_t *locksock = NULL;
+static sl_ringbuffer_t *rb = NULL; // incoming serial data
+
+void stopserver(){
+ if(locksock) sl_sock_delete(&locksock);
+ if(rb) sl_RB_delete(&rb);
+}
+
+#if 0
+// flags for standard handlers
+static sl_sock_int_t iflag = {0};
+static sl_sock_double_t dflag = {0};
+static sl_sock_string_t sflag = {0};
+static uint32_t bitflags = 0;
+
+static sl_sock_hresult_e show(sl_sock_t *client, _U_ sl_sock_hitem_t *item, _U_ const char *req){
+ if(locksock && locksock->type != SOCKT_UNIX){
+ if(*client->IP){
+ printf("Client \"%s\" (fd=%d) ask for flags:\n", client->IP, client->fd);
+ }else printf("Can't get client's IP, flags:\n");
+ }else printf("Socket fd=%d asks for flags:\n", client->fd);
+ printf("\tiflag=%" PRId64 ", dflag=%g\n", iflag.val, dflag.val);
+ return RESULT_OK;
+}
+#endif
+
+// send "measuret=..."
+static void sendtmeasured(sl_sock_t *client, double t){
+ char buf[256];
+ snprintf(buf, 255, "measuret=%.3f\n", t);
+ sl_sock_sendstrmessage(client, buf);
+}
+
+static sl_sock_hresult_e dtimeh(sl_sock_t *client, _U_ sl_sock_hitem_t *item, _U_ const char *req){
+ char buf[32];
+ snprintf(buf, 31, "UNIXT=%.3f\n", sl_dtime());
+ sl_sock_sendstrmessage(client, buf);
+ return RESULT_SILENCE;
+}
+
+static sl_sock_hresult_e openh(_U_ sl_sock_t *client, _U_ sl_sock_hitem_t *item, _U_ const char *req){
+ pthread_mutex_lock(&Dome.mutex);
+ Dome.cmd = CMD_OPEN;
+ pthread_mutex_unlock(&Dome.mutex);
+ return RESULT_OK;
+}
+
+static sl_sock_hresult_e closeh(_U_ sl_sock_t *client, _U_ sl_sock_hitem_t *item, _U_ const char *req){
+ pthread_mutex_lock(&Dome.mutex);
+ Dome.cmd = CMD_CLOSE;
+ pthread_mutex_unlock(&Dome.mutex);
+ return RESULT_OK;
+}
+
+static sl_sock_hresult_e stoph(_U_ sl_sock_t *client, _U_ sl_sock_hitem_t *item, _U_ const char *req){
+ pthread_mutex_lock(&Dome.mutex);
+ Dome.cmd = CMD_STOP;
+ pthread_mutex_unlock(&Dome.mutex);
+ return RESULT_OK;
+}
+
+static sl_sock_hresult_e statush(sl_sock_t *client, _U_ sl_sock_hitem_t *item, _U_ const char *req){
+ char buf[256];
+ double t = NAN;
+ int ecode;
+ pthread_mutex_lock(&Dome.mutex);
+ if(!*Dome.status || sl_dtime() - Dome.stattime > 3.*T_INTERVAL) snprintf(buf, 255, "%s=unknown\n", item->key);
+ else{
+ snprintf(buf, 255, "%s=%s\n", item->key, Dome.status);
+ t = Dome.stattime;
+ }
+ sl_sock_sendstrmessage(client, buf);
+ if(!isnan(t)) sendtmeasured(client, t);
+ ecode = Dome.errcode;
+ pthread_mutex_unlock(&Dome.mutex);
+ if(ecode){
+ int l = snprintf(buf, 255, "error=closed");
+ if(ecode > 99){
+ ecode -= 100;
+ int n = snprintf(buf+l, 255-l, "@rain");
+ l += n;
+ }
+ if(ecode > 9){
+ ecode -= 10;
+ int n = snprintf(buf+l, 255-l, "@timeout");
+ l += n;
+ }
+ if(ecode){
+ int n = snprintf(buf+l, 255-l, "@powerloss");
+ l += n;
+ }
+ snprintf(buf+l, 255-l, "\n");
+ sl_sock_sendstrmessage(client, buf);
+ }
+ return RESULT_SILENCE;
+}
+
+static sl_sock_hresult_e weathh(sl_sock_t *client, sl_sock_hitem_t *item, _U_ const char *req){
+ char buf[256];
+ double t = NAN;
+ pthread_mutex_lock(&Dome.mutex);
+ if(!*Dome.weather || sl_dtime() - Dome.weathtime > 3.*T_INTERVAL) snprintf(buf, 255, "%s=unknown\n", item->key);
+ else{
+ snprintf(buf, 255, "%s=%s\n", item->key, Dome.weather);
+ t = Dome.weathtime;
+ }
+ pthread_mutex_unlock(&Dome.mutex);
+ sl_sock_sendstrmessage(client, buf);
+ if(!isnan(t)) sendtmeasured(client, t);
+ return RESULT_SILENCE;
+}
+
+// Too much clients handler
+static void toomuch(int fd){
+ const char m[] = "Try later: too much clients connected\n";
+ send(fd, m, sizeof(m)-1, MSG_NOSIGNAL);
+ shutdown(fd, SHUT_WR);
+ DBG("shutdown, wait");
+ double t0 = sl_dtime();
+ uint8_t buf[8];
+ while(sl_dtime() - t0 < 11.){
+ if(sl_canread(fd)){
+ ssize_t got = read(fd, buf, 8);
+ DBG("Got=%zd", got);
+ if(got < 1) break;
+ }
+ }
+ DBG("Disc after %gs", sl_dtime() - t0);
+ LOGWARN("Client fd=%d tried to connect after MAX reached", fd);
+}
+// new connections handler (return FALSE to reject client)
+static int connected(sl_sock_t *c){
+ if(c->type == SOCKT_UNIX) LOGMSG("New client fd=%d connected", c->fd);
+ else LOGMSG("New client fd=%d, IP=%s connected", c->fd, c->IP);
+ return TRUE;
+}
+// disconnected handler
+static void disconnected(sl_sock_t *c){
+ if(c->type == SOCKT_UNIX) LOGMSG("Disconnected client fd=%d", c->fd);
+ else LOGMSG("Disconnected client fd=%d, IP=%s", c->fd, c->IP);
+}
+// default (unknown key) handler
+static sl_sock_hresult_e defhandler(struct sl_sock *s, const char *str){
+ if(!s || !str) return RESULT_FAIL;
+ sl_sock_sendstrmessage(s, "You entered wrong command:\n```\n");
+ sl_sock_sendstrmessage(s, str);
+ sl_sock_sendstrmessage(s, "\n```\nTry \"help\"\n");
+ return RESULT_SILENCE;
+}
+#if 0
+// if we use this macro, there's no need to run `sl_sock_keyno_init` later
+static sl_sock_keyno_t kph_number = SL_SOCK_KEYNO_DEFAULT;
+// handler for key with optional parameter number
+static sl_sock_hresult_e keyparhandler(struct sl_sock *s, sl_sock_hitem_t *item, const char *req){
+ if(!item->data) return RESULT_FAIL;
+ char buf[1024];
+ int no = sl_sock_keyno_check((sl_sock_keyno_t*)item->data);
+ long long newval = -1;
+ if(req){
+ if(!sl_str2ll(&newval, req) || newval < 0 || newval > 0xffffffff) return RESULT_BADVAL;
+ }
+ printf("no = %d\n", no);
+ if(no < 0){ // flags as a whole
+ if(req) bitflags = (uint32_t)newval;
+ snprintf(buf, 1023, "flags = 0x%08X\n", bitflags);
+ sl_sock_sendstrmessage(s, buf);
+ }else if(no < 32){ // bit access
+ int bitmask = 1 << no;
+ if(req){
+ if(newval) bitflags |= bitmask;
+ else bitflags &= ~bitmask;
+ }
+ snprintf(buf, 1023, "flags[%d] = %d\n", no, bitflags & bitmask ? 1 : 0);
+ sl_sock_sendstrmessage(s, buf);
+ }else return RESULT_BADKEY;
+ return RESULT_SILENCE;
+}
+#endif
+
+static sl_sock_hitem_t handlers[] = {
+#if 0
+ {sl_sock_inthandler, "int", "set/get integer flag", (void*)&iflag},
+ {sl_sock_dblhandler, "dbl", "set/get double flag", (void*)&dflag},
+ {sl_sock_strhandler, "str", "set/get string variable", (void*)&sflag},
+ {keyparhandler, "flags", "set/get bit flags as whole (flags=val) or by bits (flags[bit]=val)", (void*)&kph_number},
+ {show, "show", "show current flags @ server console", NULL},
+#endif
+ {openh, "open", "open dome", NULL},
+ {closeh, "close", "close dome", NULL},
+ {statush, "status", "get dome status", NULL},
+ {stoph, "stop", "stop dome operations", NULL},
+ {weathh, "weather", "weather sensor status", NULL},
+ {dtimeh, "dtime", "get server's UNIX time for all clients connected", NULL},
+ {NULL, NULL, NULL, NULL}
+};
+
+// dome polling; @return TRUE if all OK
+static int poll_device(){
+ char line[256];
+ if(write_cmd(TXT_GETWARN)){
+ DBG("Can't write command warning");
+ return FALSE;
+ }
+ if(write_cmd(TXT_GETSTAT)){
+ DBG("Can't write command getstat");
+ return FALSE;
+ }
+ if(write_cmd(TXT_GETWEAT)){
+ DBG("Can't write command getweath");
+ return FALSE;
+ }
+ int l = 0;
+ do{
+ l = read_term(line, 256);
+ if(l > 0) sl_RB_write(rb, (uint8_t*) line, l);
+ }while(l > 0);
+ pthread_mutex_lock(&Dome.mutex); // prepare user buffers
+ // read ringbuffer, run parser and change buffers in `Dome`
+ while(sl_RB_readline(rb, line, sizeof(line)) > 0){
+ if(strncmp(line, TXT_ANS_STAT, strlen(TXT_ANS_STAT)) == 0){
+ DBG("Got status ans");
+ int stat;
+ Dome.stattime = sl_dtime();
+ if(sscanf(line + strlen(TXT_ANS_STAT), "%d", &stat) == 1){
+ if(stat == 1111)
+ snprintf(Dome.status, Dome.statlen, "opened");
+ else if(stat == 2222)
+ snprintf(Dome.status, Dome.statlen, "closed");
+ else
+ snprintf(Dome.status, Dome.statlen, "intermediate");
+ }
+ }else if(strncmp(line, TXT_ANS_ERR, strlen(TXT_ANS_ERR)) == 0){
+ DBG("Got status errno");
+ int ecode;
+ if(sscanf(line + strlen(TXT_ANS_ERR), "%d", &ecode) == 1){
+ Dome.errcode = ecode;
+ DBG("errcode: %d", ecode);
+ }
+ }else if(strncmp(line, TXT_ANS_WEAT, strlen(TXT_ANS_WEAT)) == 0){
+ DBG("Got weather ans");
+ int weather;
+ Dome.weathtime = sl_dtime();
+ if(sscanf(line + strlen(TXT_ANS_WEAT), "%d", &weather) == 1){
+ if(weather == 0)
+ snprintf(Dome.weather, Dome.weathlen, "good weather");
+ else if (weather == 1)
+ snprintf(Dome.weather, Dome.weathlen, "rain or clouds");
+ else
+ snprintf(Dome.weather, Dome.weathlen, "unknown");
+ }
+ }else{
+ DBG("Unknown answer: %s", line);
+ }
+ }
+ pthread_mutex_unlock(&Dome.mutex);
+ return TRUE;
+}
+
+void runserver(int isunix, const char *node, int maxclients){
+ if(locksock) sl_sock_delete(&locksock);
+ if(rb) sl_RB_delete(&rb);
+ rb = sl_RB_new(BUFSIZ);
+ Dome.cmd = CMD_NONE;
+ FREE(Dome.status);
+ Dome.statlen = STATBUF_SZ;
+ Dome.status = MALLOC(char, STATBUF_SZ);
+ FREE(Dome.weather);
+ Dome.weathlen = STATBUF_SZ;
+ Dome.weather = MALLOC(char, STATBUF_SZ);
+ pthread_mutex_init(&Dome.mutex, NULL);
+ sl_socktype_e type = (isunix) ? SOCKT_UNIX : SOCKT_NET;
+ locksock = sl_sock_run_server(type, node, -1, handlers);
+ sl_sock_changemaxclients(locksock, maxclients);
+ sl_sock_maxclhandler(locksock, toomuch);
+ sl_sock_connhandler(locksock, connected);
+ sl_sock_dischandler(locksock, disconnected);
+ sl_sock_defmsghandler(locksock, defhandler);
+ double tgot = 0.;
+ while(locksock && locksock->connected){
+ usleep(1000);
+ if(!locksock->rthread){
+ WARNX("Server handlers thread is dead");
+ LOGERR("Server handlers thread is dead");
+ break;
+ }
+ if(sl_dtime() - tgot > T_INTERVAL){
+ if(poll_device()) tgot = sl_dtime();
+ }
+ pthread_mutex_lock(&Dome.mutex);
+ if(Dome.cmd != CMD_NONE){
+ switch(Dome.cmd){
+ case CMD_OPEN:
+ DBG("received command: open");
+ if(0 == write_cmd(TXT_OPENDOME)) Dome.cmd = CMD_NONE;
+ break;
+ case CMD_CLOSE:
+ DBG("received command: close");
+ if(0 == write_cmd(TXT_CLOSEDOME)) Dome.cmd = CMD_NONE;
+ break;
+ case CMD_STOP:
+ DBG("received command: stop");
+ if(0 == write_cmd(TXT_STOPDOME)) Dome.cmd = CMD_NONE;
+ break;
+ default:
+ DBG("WTF?");
+ }
+ }
+ pthread_mutex_unlock(&Dome.mutex);
+ }
+ stopserver();
+}
diff --git a/Daemons/domedaemon_baader/socket.h b/Daemons/domedaemon_baader/socket.h
new file mode 100644
index 0000000..dcc2128
--- /dev/null
+++ b/Daemons/domedaemon_baader/socket.h
@@ -0,0 +1,29 @@
+/*
+ * 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 .
+ */
+
+#pragma once
+
+#include
+
+// size of weather/status buffers
+#define STATBUF_SZ 256
+// dome polling interval (clear watchdog & get status)
+#define T_INTERVAL (1.0)
+
+void runserver(int isunix, const char *node, int maxclients);
+void stopserver();
diff --git a/Daemons/domedaemon_baader/term.c b/Daemons/domedaemon_baader/term.c
new file mode 100644
index 0000000..3fbda9c
--- /dev/null
+++ b/Daemons/domedaemon_baader/term.c
@@ -0,0 +1,115 @@
+/*
+ * 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 "term.h"
+
+static sl_tty_t *dev = NULL; // shoul be global to restore if die
+
+// close serial device
+void close_term(){
+ if(dev) sl_tty_close(&dev);
+}
+
+/**
+ * @brief open_term - open serial device
+ * @param path - path to device
+ * @param speed - its speed
+ * @param usec - timeout (us), if < 1e-6 - leave default
+ * @return FALSE if failed
+ */
+int open_term(char *path, int speed, double usec){
+ if(dev) sl_tty_close(&dev);
+ LOGMSG("Try to open serial %s at speed %d", path, speed);
+ DBG("Open serial");
+ dev = sl_tty_new(path, speed, 4096);
+ if(dev) dev = sl_tty_open(dev, 1);
+ if(!dev){
+ LOGERR("Can't open %s with speed %d. Exit.", path, speed);
+ return FALSE;
+ }
+ if(usec >= 1e-6){
+ DBG("set timeout to %gus", usec);
+ if(!sl_tty_tmout(usec)){
+ LOGWARN("Can't set timeout to %gus", usec);
+ WARNX("Can't set timeout to %gus", usec);
+ }
+ }
+ if(speed != dev->speed){
+ LOGWARN("Can't set exact speed! Opened %s at speed %d", dev->portname, dev->speed);
+ WARNX("Can't set speed %d (try %d)", speed, dev->speed);
+ }
+ if(dev) return TRUE;
+ return FALSE;
+}
+
+/**
+ * @brief read_term - read data from serial terminal
+ * @param buf - buffer for data
+ * @param length - size of `buf`
+ * @return amount of data read
+ */
+int read_term(char *buf, int length){
+ static char *bufptr = NULL; // last message, if it was longer than `length`
+ static int lastL = 0;
+ if(!dev || !buf || length < 1) return 0;
+ if(bufptr && lastL){
+ if(length > lastL) length = lastL;
+ DBG("got %d bytes from old record", length);
+ memcpy(buf, bufptr, length);
+ if((lastL -= length) < 1){
+ lastL = 0; bufptr = NULL;
+ }
+ return length;
+ }
+ if(!sl_tty_read(dev)) return 0;
+ DBG("Got from serial %zd bytes", dev->buflen);
+ LOGDBG("Got from serial: %zd bytes", dev->buflen);
+ if(length >= (int)dev->buflen){
+ DBG("Full buffer can be copied");
+ length = (int)dev->buflen;
+ bufptr = NULL;
+ lastL = 0;
+ }else{ // store part of data in buffer
+ lastL = dev->buflen - length;
+ DBG("Store %d bytes for next read", lastL);
+ bufptr = dev->buf + length;
+ }
+ memcpy(buf, dev->buf, length);
+ return length;
+}
+
+/**
+ * @brief write_term - write data
+ * @param buf - buffer
+ * @param length - its length
+ * @return 0 if OK and 1 if failed
+ */
+int write_term(const char *buf, int length){
+ if(!dev || !buf || length < 1) return 0;
+ return sl_tty_write(dev->comfd, buf, length);
+}
+
+// write string command
+int write_cmd(const char *buf){
+ if(!buf || !*buf) return 0;
+ DBG("Ask to write %s", buf);
+ return write_term(buf, strlen(buf));
+}
diff --git a/Daemons/domedaemon_baader/term.h b/Daemons/domedaemon_baader/term.h
new file mode 100644
index 0000000..f59c7b0
--- /dev/null
+++ b/Daemons/domedaemon_baader/term.h
@@ -0,0 +1,36 @@
+/*
+ * 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 .
+ */
+
+#pragma once
+
+// text commands and answers
+#define TXT_GETWARN "d#warning\n"
+#define TXT_OPENDOME "d#opendom\n"
+#define TXT_CLOSEDOME "d#closdom\n"
+#define TXT_STOPDOME "d#stopdom\n"
+#define TXT_GETSTAT "d#get_dom\n"
+#define TXT_GETWEAT "d#ask_wea\n"
+#define TXT_ANS_WEAT "d#wea"
+#define TXT_ANS_STAT "d#pos"
+#define TXT_ANS_ERR "d#erro"
+
+int open_term(char *path, int speed, double usec);
+void close_term();
+int read_term(char *buf, int length);
+int write_term(const char *buf, int length);
+int write_cmd(const char *buf);