diff --git a/CMakeLists.txt b/CMakeLists.txt index 47cb6638..6e0a709b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -176,6 +176,9 @@ set(server_module ${lithium_src_dir}/websocket/device/WsDeviceServer.cpp ${lithium_src_dir}/websocket/device/WsCameraInstance.cpp + ${lithium_src_dir}/websocket/device/WsTelescopeInstance.cpp + ${lithium_src_dir}/websocket/device/WsFocuserInstance.cpp + ${lithium_src_dir}/websocket/device/WsFilterInstance.cpp ${lithium_src_dir}/websocket/plugin/WsPluginHub.cpp ${lithium_src_dir}/websocket/plugin/WsPluginInstance.cpp @@ -298,11 +301,17 @@ if(NOT HAS_STD_FORMAT) target_link_libraries(lithium_server fmt::fmt) endif() +target_compile_definitions(lithium_server PRIVATE LOGURU_DEBUG_LOGGING) + target_link_libraries(lithium_server ${CFITSIO_LIBRARIES}) target_link_libraries(lithium_server OpenSSL::SSL OpenSSL::Crypto) target_link_libraries(lithium_server ${ZLIB_LIBRARIES}) target_link_libraries(lithium_server libzip::zip) +if(WIN32) target_link_libraries(lithium_server pugixml-shared) +else() +target_link_libraries(lithium_server pugixml-static) +endif() target_link_libraries(lithium_server sqlite3) target_link_libraries(lithium_server cpp_httplib) target_link_libraries(lithium_server backward) diff --git a/ChangeLog b/ChangeLog index 1eb550cc..babfdcb3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,5 @@ +OpenAPT Update Log + 23w01a update most of the codes , and there is still a long way to go! @@ -36,8 +38,10 @@ big update but not finished big update but not finished - - 23w04a big server update and blackened update + +Lithium Update Log + +23w01a diff --git a/config.h.in b/config.h.in index 6618af8b..2801652f 100644 --- a/config.h.in +++ b/config.h.in @@ -1,5 +1,6 @@ #cmakedefine01 ENABLE_ASYNC #cmakedefine01 ENABLE_NATIVE_SERVER +#cmakedefine01 ENABLE_FASTHASH // I18n #include diff --git a/locale/lithium.pot b/locale/lithium.pot index c2dd79e3..2e23a686 100644 --- a/locale/lithium.pot +++ b/locale/lithium.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: astro_air@126.com\n" -"POT-Creation-Date: 2023-11-11 19:58+0800\n" +"POT-Creation-Date: 2023-11-14 14:21+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -17,271 +17,243 @@ msgstr "" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" -#: E:/msys64/home/Qrm/Lithium/src/device/device_manager.cpp:161 -#, c++-format +#: /workspaces/Lithium/src/device/device_manager.cpp:161 msgid "A device with name {} already exists, please choose a different name" msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/device/indidevice_manager.cpp:278 -#, c++-format +#: /workspaces/Lithium/src/device/indidevice_manager.cpp:278 msgid "Failed to run command: {}" msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/atom/thread/thread.cpp:63 -#, c++-format +#: /workspaces/Lithium/src/atom/thread/thread.cpp:63 msgid "Failed to destroy ThreadManager: {}" msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/atom/thread/thread.cpp:82 +#: /workspaces/Lithium/src/atom/thread/thread.cpp:82 msgid "Thread manager has stopped, cannot add new thread" msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/atom/thread/thread.cpp:100 -#: E:/msys64/home/Qrm/Lithium/src/atom/thread/thread.cpp:122 -#, c++-format +#: /workspaces/Lithium/src/atom/thread/thread.cpp:100 +#: /workspaces/Lithium/src/atom/thread/thread.cpp:122 msgid "Unhandled exception in thread: {}" msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/atom/thread/thread.cpp:128 -#, c++-format +#: /workspaces/Lithium/src/atom/thread/thread.cpp:128 msgid "Added thread: {}" msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/atom/thread/thread.cpp:133 -#, c++-format +#: /workspaces/Lithium/src/atom/thread/thread.cpp:133 msgid "Failed to add thread {}: {}" msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/atom/thread/thread.cpp:149 +#: /workspaces/Lithium/src/atom/thread/thread.cpp:149 msgid "All threads joined" msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/atom/thread/thread.cpp:153 -#, c++-format +#: /workspaces/Lithium/src/atom/thread/thread.cpp:153 msgid "Failed to join all threads: {}" msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/atom/thread/thread.cpp:163 -#: E:/msys64/home/Qrm/Lithium/src/atom/thread/thread.cpp:180 -#: E:/msys64/home/Qrm/Lithium/src/atom/thread/thread.cpp:194 -#: E:/msys64/home/Qrm/Lithium/src/atom/thread/thread.cpp:205 -#, c++-format +#: /workspaces/Lithium/src/atom/thread/thread.cpp:163 +#: /workspaces/Lithium/src/atom/thread/thread.cpp:180 +#: /workspaces/Lithium/src/atom/thread/thread.cpp:194 +#: /workspaces/Lithium/src/atom/thread/thread.cpp:205 msgid "Thread {} not found" msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/atom/thread/thread.cpp:172 -#, c++-format +#: /workspaces/Lithium/src/atom/thread/thread.cpp:172 msgid "Thread {} joined" msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/atom/thread/thread.cpp:184 -#, c++-format +#: /workspaces/Lithium/src/atom/thread/thread.cpp:184 msgid "Failed to join thread {}: {}" msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/atom/thread/thread.cpp:210 -#, c++-format +#: /workspaces/Lithium/src/atom/thread/thread.cpp:210 msgid "Failed to check if thread {} is running: {}" msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/atom/system/process.cpp:76 +#: /workspaces/Lithium/src/atom/system/process.cpp:76 msgid "Failed to create PowerShell process" msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/atom/system/process.cpp:86 -#, c++-format +#: /workspaces/Lithium/src/atom/system/process.cpp:86 msgid "Running command: {}" msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/atom/system/process.cpp:103 -#: E:/msys64/home/Qrm/Lithium/src/atom/system/process.cpp:127 -#: E:/msys64/home/Qrm/Lithium/src/atom/system/process.cpp:148 +#: /workspaces/Lithium/src/atom/system/process.cpp:103 +#: /workspaces/Lithium/src/atom/system/process.cpp:127 +#: /workspaces/Lithium/src/atom/system/process.cpp:148 msgid "Failed to create process" msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/atom/system/process.cpp:113 -#: E:/msys64/home/Qrm/Lithium/src/atom/system/process.cpp:158 -#, c++-format +#: /workspaces/Lithium/src/atom/system/process.cpp:113 +#: /workspaces/Lithium/src/atom/system/process.cpp:158 msgid "Process created: {} (PID: {})" msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/atom/system/process.cpp:137 -#, c++-format +#: /workspaces/Lithium/src/atom/system/process.cpp:137 msgid "Running script: {}" msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/atom/system/process.cpp:175 -#: E:/msys64/home/Qrm/Lithium/src/atom/system/process.cpp:187 -#, c++-format +#: /workspaces/Lithium/src/atom/system/process.cpp:175 +#: /workspaces/Lithium/src/atom/system/process.cpp:187 msgid "Process terminated: {} (PID: {})" msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/atom/system/process.cpp:179 +#: /workspaces/Lithium/src/atom/system/process.cpp:179 msgid "Failed to terminate process" msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/atom/system/process.cpp:195 -#: E:/msys64/home/Qrm/Lithium/src/atom/system/process.cpp:240 +#: /workspaces/Lithium/src/atom/system/process.cpp:195 +#: /workspaces/Lithium/src/atom/system/process.cpp:240 msgid "Process not found" msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/atom/system/process.cpp:210 -#, c++-format +#: /workspaces/Lithium/src/atom/system/process.cpp:210 msgid "Process not found by name: {}" msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/atom/system/process.cpp:255 -#, c++-format +#: /workspaces/Lithium/src/atom/system/process.cpp:255 msgid "Process completed: {} (PID: {})" msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/atom/system/process.cpp:259 +#: /workspaces/Lithium/src/atom/system/process.cpp:259 msgid "Failed to wait for process completion" msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/atom/system/process.cpp:265 +#: /workspaces/Lithium/src/atom/system/process.cpp:265 #, c-format msgid "Process completed: %s (PID: %d)" msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/atom/system/process.cpp:270 +#: /workspaces/Lithium/src/atom/system/process.cpp:270 msgid "All processes completed." msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/atom/system/process.cpp:281 +#: /workspaces/Lithium/src/atom/system/process.cpp:281 msgid "Failed to create process snapshot" msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/atom/system/process.cpp:322 +#: /workspaces/Lithium/src/atom/system/process.cpp:322 msgid "Failed to open /proc directory" msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/atom/system/process.cpp:351 +#: /workspaces/Lithium/src/atom/system/process.cpp:351 msgid "Failed to get process path" msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/atom/system/process.cpp:372 +#: /workspaces/Lithium/src/atom/system/process.cpp:372 msgid "Failed to get process info length" msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/atom/system/process.cpp:379 +#: /workspaces/Lithium/src/atom/system/process.cpp:379 msgid "Failed to allocate memory" msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/atom/system/process.cpp:385 +#: /workspaces/Lithium/src/atom/system/process.cpp:385 msgid "Failed to get process info" msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/atom/system/pid.cpp:94 +#: /workspaces/Lithium/src/atom/system/pid.cpp:94 msgid "CreateToolhelp32Snapshot failed." msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/atom/system/pid.cpp:113 -#, c++-format +#: /workspaces/Lithium/src/atom/system/pid.cpp:113 msgid "Watching process with PID: {}" msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/atom/system/pid.cpp:124 -#, c++-format +#: /workspaces/Lithium/src/atom/system/pid.cpp:124 msgid "Process exited with code: {}" msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/atom/system/pid.cpp:133 +#: /workspaces/Lithium/src/atom/system/pid.cpp:133 msgid "GetExitCodeProcess failed." msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/atom/system/pid.cpp:143 +#: /workspaces/Lithium/src/atom/system/pid.cpp:143 msgid "OpenProcess failed." msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/atom/system/pid.cpp:170 -#, c++-format +#: /workspaces/Lithium/src/atom/system/pid.cpp:170 msgid "Process exited with status: {}" msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/atom/system/pid.cpp:179 -#, c++-format +#: /workspaces/Lithium/src/atom/system/pid.cpp:179 msgid "Process terminated by signal: {}" msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/App.cpp:226 +#: /workspaces/Lithium/src/App.cpp:231 msgid "port the server running on" msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/App.cpp:227 +#: /workspaces/Lithium/src/App.cpp:232 msgid "host the server running on" msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/App.cpp:228 +#: /workspaces/Lithium/src/App.cpp:233 msgid "path to the config file" msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/App.cpp:229 +#: /workspaces/Lithium/src/App.cpp:234 msgid "path to the modules directory" msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/App.cpp:230 +#: /workspaces/Lithium/src/App.cpp:235 msgid "web panel" msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/App.cpp:231 +#: /workspaces/Lithium/src/App.cpp:236 msgid "path to log file" msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/App.cpp:233 +#: /workspaces/Lithium/src/App.cpp:238 msgid "Lithium Command Line Interface:" msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/App.cpp:234 +#: /workspaces/Lithium/src/App.cpp:239 msgid "End." msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/App.cpp:242 +#: /workspaces/Lithium/src/App.cpp:247 #, c-format msgid "Failed to parser command line : %s" msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/App.cpp:263 +#: /workspaces/Lithium/src/App.cpp:268 #, c-format msgid "Command line server port : %d" msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/App.cpp:269 +#: /workspaces/Lithium/src/App.cpp:274 #, c-format msgid "Set server port to %d" msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/LithiumApp.cpp:81 -#, c++-format +#: /workspaces/Lithium/src/LithiumApp.cpp:81 msgid "Failed to load Lithium App , error : {}" msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/LithiumApp.cpp:93 -#, c++-format +#: /workspaces/Lithium/src/LithiumApp.cpp:93 msgid "Get config value: {}" msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/LithiumApp.cpp:99 -#, c++-format +#: /workspaces/Lithium/src/LithiumApp.cpp:99 msgid "Set {} to {}" msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/LithiumApp.cpp:297 -#, c++-format +#: /workspaces/Lithium/src/LithiumApp.cpp:297 msgid "Failed to run chai command : {}" msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/LithiumApp.cpp:315 -#, c++-format +#: /workspaces/Lithium/src/LithiumApp.cpp:315 msgid "Failed to run chai multi command {}" msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/LithiumApp.cpp:328 -#, c++-format +#: /workspaces/Lithium/src/LithiumApp.cpp:328 msgid "Failed to load chaiscript file {}" msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/LithiumApp.cpp:341 -#, c++-format +#: /workspaces/Lithium/src/LithiumApp.cpp:341 msgid "Failed to run chai script {}" msgstr "" diff --git a/locale/po/en_US.UTF-8/lithium.po b/locale/po/en_US.UTF-8/lithium.po index bd5b3fc3..95517c30 100644 --- a/locale/po/en_US.UTF-8/lithium.po +++ b/locale/po/en_US.UTF-8/lithium.po @@ -1,268 +1,240 @@ -#: E:/msys64/home/Qrm/Lithium/src/device/device_manager.cpp:161 -#, c++-format +#: /workspaces/Lithium/src/device/device_manager.cpp:161 msgid "A device with name {} already exists, please choose a different name" msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/device/indidevice_manager.cpp:278 -#, c++-format +#: /workspaces/Lithium/src/device/indidevice_manager.cpp:278 msgid "Failed to run command: {}" msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/atom/thread/thread.cpp:63 -#, c++-format +#: /workspaces/Lithium/src/atom/thread/thread.cpp:63 msgid "Failed to destroy ThreadManager: {}" msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/atom/thread/thread.cpp:82 +#: /workspaces/Lithium/src/atom/thread/thread.cpp:82 msgid "Thread manager has stopped, cannot add new thread" msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/atom/thread/thread.cpp:100 -#: E:/msys64/home/Qrm/Lithium/src/atom/thread/thread.cpp:122 -#, c++-format +#: /workspaces/Lithium/src/atom/thread/thread.cpp:100 +#: /workspaces/Lithium/src/atom/thread/thread.cpp:122 msgid "Unhandled exception in thread: {}" msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/atom/thread/thread.cpp:128 -#, c++-format +#: /workspaces/Lithium/src/atom/thread/thread.cpp:128 msgid "Added thread: {}" msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/atom/thread/thread.cpp:133 -#, c++-format +#: /workspaces/Lithium/src/atom/thread/thread.cpp:133 msgid "Failed to add thread {}: {}" msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/atom/thread/thread.cpp:149 +#: /workspaces/Lithium/src/atom/thread/thread.cpp:149 msgid "All threads joined" msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/atom/thread/thread.cpp:153 -#, c++-format +#: /workspaces/Lithium/src/atom/thread/thread.cpp:153 msgid "Failed to join all threads: {}" msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/atom/thread/thread.cpp:163 -#: E:/msys64/home/Qrm/Lithium/src/atom/thread/thread.cpp:180 -#: E:/msys64/home/Qrm/Lithium/src/atom/thread/thread.cpp:194 -#: E:/msys64/home/Qrm/Lithium/src/atom/thread/thread.cpp:205 -#, c++-format +#: /workspaces/Lithium/src/atom/thread/thread.cpp:163 +#: /workspaces/Lithium/src/atom/thread/thread.cpp:180 +#: /workspaces/Lithium/src/atom/thread/thread.cpp:194 +#: /workspaces/Lithium/src/atom/thread/thread.cpp:205 msgid "Thread {} not found" msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/atom/thread/thread.cpp:172 -#, c++-format +#: /workspaces/Lithium/src/atom/thread/thread.cpp:172 msgid "Thread {} joined" msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/atom/thread/thread.cpp:184 -#, c++-format +#: /workspaces/Lithium/src/atom/thread/thread.cpp:184 msgid "Failed to join thread {}: {}" msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/atom/thread/thread.cpp:210 -#, c++-format +#: /workspaces/Lithium/src/atom/thread/thread.cpp:210 msgid "Failed to check if thread {} is running: {}" msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/atom/system/process.cpp:76 +#: /workspaces/Lithium/src/atom/system/process.cpp:76 msgid "Failed to create PowerShell process" msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/atom/system/process.cpp:86 -#, c++-format +#: /workspaces/Lithium/src/atom/system/process.cpp:86 msgid "Running command: {}" msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/atom/system/process.cpp:103 -#: E:/msys64/home/Qrm/Lithium/src/atom/system/process.cpp:127 -#: E:/msys64/home/Qrm/Lithium/src/atom/system/process.cpp:148 +#: /workspaces/Lithium/src/atom/system/process.cpp:103 +#: /workspaces/Lithium/src/atom/system/process.cpp:127 +#: /workspaces/Lithium/src/atom/system/process.cpp:148 msgid "Failed to create process" msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/atom/system/process.cpp:113 -#: E:/msys64/home/Qrm/Lithium/src/atom/system/process.cpp:158 -#, c++-format +#: /workspaces/Lithium/src/atom/system/process.cpp:113 +#: /workspaces/Lithium/src/atom/system/process.cpp:158 msgid "Process created: {} (PID: {})" msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/atom/system/process.cpp:137 -#, c++-format +#: /workspaces/Lithium/src/atom/system/process.cpp:137 msgid "Running script: {}" msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/atom/system/process.cpp:175 -#: E:/msys64/home/Qrm/Lithium/src/atom/system/process.cpp:187 -#, c++-format +#: /workspaces/Lithium/src/atom/system/process.cpp:175 +#: /workspaces/Lithium/src/atom/system/process.cpp:187 msgid "Process terminated: {} (PID: {})" msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/atom/system/process.cpp:179 +#: /workspaces/Lithium/src/atom/system/process.cpp:179 msgid "Failed to terminate process" msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/atom/system/process.cpp:195 -#: E:/msys64/home/Qrm/Lithium/src/atom/system/process.cpp:240 +#: /workspaces/Lithium/src/atom/system/process.cpp:195 +#: /workspaces/Lithium/src/atom/system/process.cpp:240 msgid "Process not found" msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/atom/system/process.cpp:210 -#, c++-format +#: /workspaces/Lithium/src/atom/system/process.cpp:210 msgid "Process not found by name: {}" msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/atom/system/process.cpp:255 -#, c++-format +#: /workspaces/Lithium/src/atom/system/process.cpp:255 msgid "Process completed: {} (PID: {})" msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/atom/system/process.cpp:259 +#: /workspaces/Lithium/src/atom/system/process.cpp:259 msgid "Failed to wait for process completion" msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/atom/system/process.cpp:265 +#: /workspaces/Lithium/src/atom/system/process.cpp:265 #, c-format msgid "Process completed: %s (PID: %d)" msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/atom/system/process.cpp:270 +#: /workspaces/Lithium/src/atom/system/process.cpp:270 msgid "All processes completed." msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/atom/system/process.cpp:281 +#: /workspaces/Lithium/src/atom/system/process.cpp:281 msgid "Failed to create process snapshot" msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/atom/system/process.cpp:322 +#: /workspaces/Lithium/src/atom/system/process.cpp:322 msgid "Failed to open /proc directory" msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/atom/system/process.cpp:351 +#: /workspaces/Lithium/src/atom/system/process.cpp:351 msgid "Failed to get process path" msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/atom/system/process.cpp:372 +#: /workspaces/Lithium/src/atom/system/process.cpp:372 msgid "Failed to get process info length" msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/atom/system/process.cpp:379 +#: /workspaces/Lithium/src/atom/system/process.cpp:379 msgid "Failed to allocate memory" msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/atom/system/process.cpp:385 +#: /workspaces/Lithium/src/atom/system/process.cpp:385 msgid "Failed to get process info" msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/atom/system/pid.cpp:94 +#: /workspaces/Lithium/src/atom/system/pid.cpp:94 msgid "CreateToolhelp32Snapshot failed." msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/atom/system/pid.cpp:113 -#, c++-format +#: /workspaces/Lithium/src/atom/system/pid.cpp:113 msgid "Watching process with PID: {}" msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/atom/system/pid.cpp:124 -#, c++-format +#: /workspaces/Lithium/src/atom/system/pid.cpp:124 msgid "Process exited with code: {}" msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/atom/system/pid.cpp:133 +#: /workspaces/Lithium/src/atom/system/pid.cpp:133 msgid "GetExitCodeProcess failed." msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/atom/system/pid.cpp:143 +#: /workspaces/Lithium/src/atom/system/pid.cpp:143 msgid "OpenProcess failed." msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/atom/system/pid.cpp:170 -#, c++-format +#: /workspaces/Lithium/src/atom/system/pid.cpp:170 msgid "Process exited with status: {}" msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/atom/system/pid.cpp:179 -#, c++-format +#: /workspaces/Lithium/src/atom/system/pid.cpp:179 msgid "Process terminated by signal: {}" msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/App.cpp:226 +#: /workspaces/Lithium/src/App.cpp:231 msgid "port the server running on" msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/App.cpp:227 +#: /workspaces/Lithium/src/App.cpp:232 msgid "host the server running on" msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/App.cpp:228 +#: /workspaces/Lithium/src/App.cpp:233 msgid "path to the config file" msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/App.cpp:229 +#: /workspaces/Lithium/src/App.cpp:234 msgid "path to the modules directory" msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/App.cpp:230 +#: /workspaces/Lithium/src/App.cpp:235 msgid "web panel" msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/App.cpp:231 +#: /workspaces/Lithium/src/App.cpp:236 msgid "path to log file" msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/App.cpp:233 +#: /workspaces/Lithium/src/App.cpp:238 msgid "Lithium Command Line Interface:" msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/App.cpp:234 +#: /workspaces/Lithium/src/App.cpp:239 msgid "End." msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/App.cpp:242 +#: /workspaces/Lithium/src/App.cpp:247 #, c-format msgid "Failed to parser command line : %s" msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/App.cpp:263 +#: /workspaces/Lithium/src/App.cpp:268 #, c-format msgid "Command line server port : %d" msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/App.cpp:269 +#: /workspaces/Lithium/src/App.cpp:274 #, c-format msgid "Set server port to %d" msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/LithiumApp.cpp:81 -#, c++-format +#: /workspaces/Lithium/src/LithiumApp.cpp:81 msgid "Failed to load Lithium App , error : {}" msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/LithiumApp.cpp:93 -#, c++-format +#: /workspaces/Lithium/src/LithiumApp.cpp:93 msgid "Get config value: {}" msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/LithiumApp.cpp:99 -#, c++-format +#: /workspaces/Lithium/src/LithiumApp.cpp:99 msgid "Set {} to {}" msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/LithiumApp.cpp:297 -#, c++-format +#: /workspaces/Lithium/src/LithiumApp.cpp:297 msgid "Failed to run chai command : {}" msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/LithiumApp.cpp:315 -#, c++-format +#: /workspaces/Lithium/src/LithiumApp.cpp:315 msgid "Failed to run chai multi command {}" msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/LithiumApp.cpp:328 -#, c++-format +#: /workspaces/Lithium/src/LithiumApp.cpp:328 msgid "Failed to load chaiscript file {}" msgstr "" -#: E:/msys64/home/Qrm/Lithium/src/LithiumApp.cpp:341 -#, c++-format +#: /workspaces/Lithium/src/LithiumApp.cpp:341 msgid "Failed to run chai script {}" msgstr "" diff --git a/src/App.cpp b/src/App.cpp index 1a84e021..108ce12f 100644 --- a/src/App.cpp +++ b/src/App.cpp @@ -81,10 +81,15 @@ void run() { DLOG_F(INFO, "Loading App component ..."); + std::string host = Lithium::MyApp->GetConfig("config/server").value("host", "0.0.0.0"); + DLOG_F(INFO, "Host: {}", host); + int port = Lithium::MyApp->GetConfig("config/server").value("port", 8000); + DLOG_F(INFO, "Port: {}", port); + #if ENABLE_IPV6 AppComponent components(Lithium::MyApp->GetConfig("config/server").value("host", "::"), Lithium::MyApp->GetConfig("config/server").value("port", 8000)); // Create scope Environment components #else - AppComponent components(Lithium::MyApp->GetConfig("config/server").value("host", "0.0.0.0"), Lithium::MyApp->GetConfig("config/server").value("port", 8000)); // Create scope Environment components + AppComponent components(host, port); // Create scope Environment components #endif DLOG_F(INFO, "App component loaded"); diff --git a/src/atom/io/compress.cpp b/src/atom/io/compress.cpp index ffcdc595..d76a6ae2 100644 --- a/src/atom/io/compress.cpp +++ b/src/atom/io/compress.cpp @@ -127,7 +127,7 @@ namespace Lithium::File return true; } - bool compress_file(const fs::path &file, gzFile out) + bool compress_file_(const fs::path &file, gzFile out) { std::ifstream in(file, std::ios::binary); if (!in) @@ -143,7 +143,7 @@ namespace Lithium::File { in.close(); gzclose(out); - DLOG_F(ERROR, "Failed to compress file {}", file); + DLOG_F(ERROR, "Failed to compress file {}", file.string()); return false; } } @@ -196,7 +196,7 @@ namespace Lithium::File return true; } - bool compress_folder(const fs::path &folder_name) + bool compress_folder_(const fs::path &folder_name) { auto outfile_name = fmt::format("{}.gz", folder_name.string()); gzFile out = gzopen(outfile_name.c_str(), "wb"); @@ -244,7 +244,7 @@ namespace Lithium::File } else if (entry.is_regular_file()) { - if (!compress_file(entry.path(), out)) + if (!compress_file_(entry.path(), out)) { gzclose(out); return false; @@ -252,10 +252,15 @@ namespace Lithium::File } } gzclose(out); - DLOG_F(INFO, "Compressed folder {} -> {}", folder_name, outfile_name); + DLOG_F(INFO, "Compressed folder {} -> {}", folder_name.string(), outfile_name); return true; } + bool compress_folder(const char *folder_name) + { + return compress_folder_(fs::path(folder_name)); + } + bool extract_zip(const std::string &zip_file, const std::string &destination_folder) { std::ifstream file(zip_file, std::ios::binary); diff --git a/src/config/configor.cpp b/src/config/configor.cpp index d4f9f377..249ba80d 100644 --- a/src/config/configor.cpp +++ b/src/config/configor.cpp @@ -132,7 +132,7 @@ namespace Lithium void ConfigManager::setValue(const std::string &key_path, const json &value) { - std::lock_guard lock(rw_mutex_); + // std::lock_guard lock(rw_mutex_); try { json *p = &config_; @@ -155,7 +155,7 @@ namespace Lithium json ConfigManager::getValue(const std::string &key_path) const { - std::lock_guard lock(rw_mutex_); + // std::lock_guard lock(rw_mutex_); try { const json *p = &config_; diff --git a/src/websocket/device/WsCameraInstance.cpp b/src/websocket/device/WsCameraInstance.cpp index 395dcc4e..27595079 100644 --- a/src/websocket/device/WsCameraInstance.cpp +++ b/src/websocket/device/WsCameraInstance.cpp @@ -40,6 +40,8 @@ Description: WebSocket Device Instance (each device each instance) #include "websocket/template/error_message.hpp" #include "atom/error/error_code.hpp" +#include "core/camera.hpp" + #include "loguru/loguru.hpp" #include "nlohmann/json.hpp" #include "magic_enum/magic_enum.hpp" @@ -85,4 +87,29 @@ void WsCameraInstance::startExposure(const json &m_params) sendMessage(error_message.dump()); return; } +} + +void WsCameraInstance::stopExposure(const json &m_params) +{ + +} + +void WsCameraInstance::getGain(const json &m_params) +{ + +} + +void WsCameraInstance::setGain(const json &m_params) +{ + +} + +void WsCameraInstance::getOffset(const json &m_params) +{ + +} + +void WsCameraInstance::setOffset(const json & m_params) +{ + } \ No newline at end of file diff --git a/src/websocket/device/WsCameraInstance.hpp b/src/websocket/device/WsCameraInstance.hpp index ac69656a..623410b2 100644 --- a/src/websocket/device/WsCameraInstance.hpp +++ b/src/websocket/device/WsCameraInstance.hpp @@ -34,6 +34,8 @@ Description: WebSocket Device Instance (each device each instance) #include "WsDeviceInstance.hpp" +class Camera; + /** * @brief Class representing an instance of a WebSocket Camera * @@ -64,6 +66,15 @@ class WsCameraInstance : public WsDeviceInstance public: void startExposure(const json &m_params); + void stopExosure(const json &m_parmas); + void getGain(const json &m_params); + void setGain(const json &m_params); + void setOffset(const json &m_params); + void getOffset(const json &m_params); + +private: + + std::shared_ptr m_camera; }; #endif // WSCAMERAINSTANCE_HPP diff --git a/src/websocket/device/WsDeviceServer.cpp b/src/websocket/device/WsDeviceServer.cpp index baf68eac..3f597af8 100644 --- a/src/websocket/device/WsDeviceServer.cpp +++ b/src/websocket/device/WsDeviceServer.cpp @@ -31,18 +31,41 @@ Description: WebSocket Device Server #include "WsDeviceServer.hpp" +#include "WsCameraInstance.hpp" +#include "WsFilterInstance.hpp" +#include "WsFocuserInstance.hpp" +#include "WsTelescopeInstance.hpp" + WsDeviceServer::WsDeviceServer() : m_userIdCounter(0) { m_device_switch = std::make_unique &, const oatpp::String &, const oatpp::String &>>(); m_device_switch->registerCase("camera", [this](const std::shared_ptr &socket, const oatpp::String &deviceName, const oatpp::String &deviceHub) { auto hub = getOrCreateHub(deviceHub); - auto device = std::make_shared(socket, hub, deviceName, obtainNewUserId()); + auto device = std::make_shared(socket, hub, deviceName, obtainNewUserId()); socket->setListener(device); hub->addDevice(device); }); m_device_switch->registerCase("telescope", [this](const std::shared_ptr &socket, const oatpp::String &deviceName, const oatpp::String &deviceHub) { auto hub = getOrCreateHub(deviceHub); + auto device = std::make_shared(socket, hub, deviceName, obtainNewUserId()); + socket->setListener(device); + hub->addDevice(device); }); + m_device_switch->registerCase("focuser", [this](const std::shared_ptr &socket, const oatpp::String &deviceName, const oatpp::String &deviceHub) + { + auto hub = getOrCreateHub(deviceHub); + auto device = std::make_shared(socket, hub, deviceName, obtainNewUserId()); + socket->setListener(device); + hub->addDevice(device); }); + m_device_switch->registerCase("filterwheel", [this](const std::shared_ptr &socket, const oatpp::String &deviceName, const oatpp::String &deviceHub) + { + auto hub = getOrCreateHub(deviceHub); + auto device = std::make_shared(socket, hub, deviceName, obtainNewUserId()); + socket->setListener(device); + hub->addDevice(device); }); + m_device_switch->setDefault([this](const std::shared_ptr &socket, const oatpp::String &deviceName, const oatpp::String &deviceHub) + { + auto hub = getOrCreateHub(deviceHub); auto device = std::make_shared(socket, hub, deviceName, obtainNewUserId()); socket->setListener(device); hub->addDevice(device); }); diff --git a/src/websocket/device/WsFilterInstance.cpp b/src/websocket/device/WsFilterInstance.cpp new file mode 100644 index 00000000..374a71c7 --- /dev/null +++ b/src/websocket/device/WsFilterInstance.cpp @@ -0,0 +1,57 @@ +/* + * WsFilterInstance.cpp + * + * Copyright (C) 2023 Max Qian + * + * 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 . + */ + +/************************************************* + +Copyright: 2023 Max Qian. All rights reserved + +Author: Max Qian + +E-mail: astro_air@126.com + +Date: 2023-10-20 + +Description: WebSocket Device Instance (each device each instance) + +**************************************************/ + +#include "WsFilterInstance.hpp" +#include "WsDeviceHub.hpp" + +#include "device/device_manager.hpp" +#include "atom/server/serialize.hpp" +#include "atom/server/deserialize.hpp" + +#include "atom/utils/time.hpp" +#include "websocket/template/error_message.hpp" +#include "atom/error/error_code.hpp" + +#include "loguru/loguru.hpp" +#include "nlohmann/json.hpp" +#include "magic_enum/magic_enum.hpp" + +WsFilterInstance::WsFilterInstance(const std::shared_ptr &socket, + const std::shared_ptr &hub, + const oatpp::String &device_name, + v_int32 userId) + : WsDeviceInstance(socket, hub, device_name, userId) +{ +} + +WsFilterInstance::~WsFilterInstance() +{ +} diff --git a/src/websocket/device/WsFilterInstance.hpp b/src/websocket/device/WsFilterInstance.hpp new file mode 100644 index 00000000..2c0e4731 --- /dev/null +++ b/src/websocket/device/WsFilterInstance.hpp @@ -0,0 +1,67 @@ +/* + * WsFilterInstance.hpp + * + * Copyright (C) 2023 Max Qian + * + * 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 . + */ + +/************************************************* + +Copyright: 2023 Max Qian. All rights reserved + +Author: Max Qian + +E-mail: astro_air@126.com + +Date: 2023-10-20 + +Description: WebSocket Device Instance (each device each instance) + +**************************************************/ + +#ifndef WSFILTERINSTANCE_HPP +#define WSFILTERINSTANCE_HPP + +#include "WsDeviceInstance.hpp" + +/** + * @brief Class representing an instance of a WebSocket Filter + * + */ +class WsFilterInstance : public WsDeviceInstance +{ + +public: + /** + * @brief Construct a new WsFilterInstance object. + * + * @param socket Shared pointer to the AsyncWebSocket object. + * @param hub Shared pointer to the WsDeviceHub object. + * @param device_name Name of the device. + * @param userId Id of the user. + */ + WsFilterInstance(const std::shared_ptr &socket, + const std::shared_ptr &hub, + const oatpp::String &device_name, + v_int32 userId); + + /** + * @brief Destroy the WsFilterInstance object. + * + */ + ~WsFilterInstance(); + +public: +}; + +#endif // WSFILTERINSTANCE_HPP diff --git a/src/websocket/device/WsFocuserInstance.cpp b/src/websocket/device/WsFocuserInstance.cpp new file mode 100644 index 00000000..5e4e7b9d --- /dev/null +++ b/src/websocket/device/WsFocuserInstance.cpp @@ -0,0 +1,57 @@ +/* + * WsFocuserInstance.cpp + * + * Copyright (C) 2023 Max Qian + * + * 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 . + */ + +/************************************************* + +Copyright: 2023 Max Qian. All rights reserved + +Author: Max Qian + +E-mail: astro_air@126.com + +Date: 2023-10-20 + +Description: WebSocket Device Instance (each device each instance) + +**************************************************/ + +#include "WsFocuserInstance.hpp" +#include "WsDeviceHub.hpp" + +#include "device/device_manager.hpp" +#include "atom/server/serialize.hpp" +#include "atom/server/deserialize.hpp" + +#include "atom/utils/time.hpp" +#include "websocket/template/error_message.hpp" +#include "atom/error/error_code.hpp" + +#include "loguru/loguru.hpp" +#include "nlohmann/json.hpp" +#include "magic_enum/magic_enum.hpp" + +WsFocuserInstance::WsFocuserInstance(const std::shared_ptr &socket, + const std::shared_ptr &hub, + const oatpp::String &device_name, + v_int32 userId) + : WsDeviceInstance(socket, hub, device_name, userId) +{ +} + +WsFocuserInstance::~WsFocuserInstance() +{ +} diff --git a/src/websocket/device/WsFocuserInstance.hpp b/src/websocket/device/WsFocuserInstance.hpp new file mode 100644 index 00000000..60939ddc --- /dev/null +++ b/src/websocket/device/WsFocuserInstance.hpp @@ -0,0 +1,68 @@ +/* + * WsFocuserInstance.hpp + * + * Copyright (C) 2023 Max Qian + * + * 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 . + */ + +/************************************************* + +Copyright: 2023 Max Qian. All rights reserved + +Author: Max Qian + +E-mail: astro_air@126.com + +Date: 2023-10-20 + +Description: WebSocket Device Instance (each device each instance) + +**************************************************/ + +#ifndef WSFOCUSERINSTANCE_HPP +#define WSFOCUSERINSTANCE_HPP + +#include "WsDeviceInstance.hpp" + +/** + * @brief Class representing an instance of a WebSocket Focuser + * + */ +class WsFocuserInstance : public WsDeviceInstance +{ + +public: + /** + * @brief Construct a new WsFocuserInstance object. + * + * @param socket Shared pointer to the AsyncWebSocket object. + * @param hub Shared pointer to the WsDeviceHub object. + * @param device_name Name of the device. + * @param userId Id of the user. + */ + WsFocuserInstance(const std::shared_ptr &socket, + const std::shared_ptr &hub, + const oatpp::String &device_name, + v_int32 userId); + + /** + * @brief Destroy the WsFocuserInstance object. + * + */ + ~WsFocuserInstance(); + +public: + +}; + +#endif // WSFOCUSERINSTANCE_HPP diff --git a/src/websocket/device/WsTelescopeInstance.cpp b/src/websocket/device/WsTelescopeInstance.cpp index e69de29b..95b996e7 100644 --- a/src/websocket/device/WsTelescopeInstance.cpp +++ b/src/websocket/device/WsTelescopeInstance.cpp @@ -0,0 +1,88 @@ +/* + * WsTelescopeInstance.cpp + * + * Copyright (C) 2023 Max Qian + * + * 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 . + */ + +/************************************************* + +Copyright: 2023 Max Qian. All rights reserved + +Author: Max Qian + +E-mail: astro_air@126.com + +Date: 2023-10-20 + +Description: WebSocket Device Instance (each device each instance) + +**************************************************/ + +#include "WsTelescopeInstance.hpp" +#include "WsDeviceHub.hpp" + +#include "device/device_manager.hpp" +#include "atom/server/serialize.hpp" +#include "atom/server/deserialize.hpp" + +#include "atom/utils/time.hpp" +#include "websocket/template/error_message.hpp" +#include "atom/error/error_code.hpp" + +#include "loguru/loguru.hpp" +#include "nlohmann/json.hpp" +#include "magic_enum/magic_enum.hpp" + +WsTelescopeInstance::WsTelescopeInstance(const std::shared_ptr &socket, + const std::shared_ptr &hub, + const oatpp::String &device_name, + v_int32 userId) + : WsDeviceInstance(socket, hub, device_name, userId) +{ + LiRegisterFunc("startExopsure", &WsTelescopeInstance::startExposure, this); +} + +WsTelescopeInstance::~WsTelescopeInstance() +{ +} + +void WsTelescopeInstance::startExposure(const json &m_params) +{ + // 实现参数检查 + if (m_params.contains("exposure_time") && m_params["exposure_time"].is_number_integer()) + { + int exposure_time = m_params["exposure_time"]; + if (exposure_time < 1) + { + json error_message = {{"error_code", ServerError::InvalidParameters}, + {"error_message", "exposure_time must be greater than 0"}}; + sendMessage(error_message.dump()); + return; + } + if (exposure_time > 1000000) + { + json error_message = {{"error_code", ServerError::InvalidParameters}, + {"error_message", "exposure_time must be less than 1000000"}}; + sendMessage(error_message.dump()); + return; + } + } + else + { + json error_message = {{"error_code", ServerError::InvalidParameters}, + {"error_message", "exposure_time must be an integer"}}; + sendMessage(error_message.dump()); + return; + } +} \ No newline at end of file diff --git a/src/websocket/device/WsTelescopeInstance.hpp b/src/websocket/device/WsTelescopeInstance.hpp index e69de29b..7305db43 100644 --- a/src/websocket/device/WsTelescopeInstance.hpp +++ b/src/websocket/device/WsTelescopeInstance.hpp @@ -0,0 +1,69 @@ +/* + * WsTelescopeInstance.hpp + * + * Copyright (C) 2023 Max Qian + * + * 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 . + */ + +/************************************************* + +Copyright: 2023 Max Qian. All rights reserved + +Author: Max Qian + +E-mail: astro_air@126.com + +Date: 2023-10-20 + +Description: WebSocket Device Instance (each device each instance) + +**************************************************/ + +#ifndef WSTELESCOPEINSTANCE_HPP +#define WSTELESCOPEINSTANCE_HPP + +#include "WsDeviceInstance.hpp" + +/** + * @brief Class representing an instance of a WebSocket Telescope + * + */ +class WsTelescopeInstance : public WsDeviceInstance +{ + +public: + /** + * @brief Construct a new WsTelescopeInstance object. + * + * @param socket Shared pointer to the AsyncWebSocket object. + * @param hub Shared pointer to the WsDeviceHub object. + * @param device_name Name of the device. + * @param userId Id of the user. + */ + WsTelescopeInstance(const std::shared_ptr &socket, + const std::shared_ptr &hub, + const oatpp::String &device_name, + v_int32 userId); + + /** + * @brief Destroy the WsTelescopeInstance object. + * + */ + ~WsTelescopeInstance(); + +public: + + void startExposure(const json &m_params); +}; + +#endif // WSTELESCOPEINSTANCE_HPP