From 34f30562dd80c91a00e27565c5e358ef8aaae4f5 Mon Sep 17 00:00:00 2001 From: PA Dev Bot <344001113+pa-devbot@users.noreply.github.com> Date: Mon, 9 Nov 2026 20:12:06 +0000 Subject: [PATCH] Sockets: add a ServerSocket factory alias Mirror ClientSocket.h: pick ServerSocket_WinSocket on Windows and ServerSocket_POSIX elsewhere, so callers don't have to include a platform-specific backend. The Qt backend stays available for callers that want to integrate with a Qt event loop. --- Common/Cpp/Sockets/ServerSocket.h | 31 ++++++++++++++++++++++++++ SerialPrograms/cmake/SourceFiles.cmake | 1 + 2 files changed, 32 insertions(+) create mode 100644 Common/Cpp/Sockets/ServerSocket.h diff --git a/Common/Cpp/Sockets/ServerSocket.h b/Common/Cpp/Sockets/ServerSocket.h new file mode 100644 index 0000000000..643080340f --- /dev/null +++ b/Common/Cpp/Sockets/ServerSocket.h @@ -0,0 +1,31 @@ +/* Server Socket + * + * From: https://github.com/PokemonAutomation/ + * + * The default AbstractServerSocket backend for the current platform, + * mirroring "ClientSocket.h". The Qt backend (ServerSocket_Qt) exists + * for callers that need to integrate with a Qt event loop; it is not + * the default. + * + */ + +#ifndef PokemonAutomation_ServerSocket_H +#define PokemonAutomation_ServerSocket_H + + + +#ifdef _WIN32 +#include "ServerSocket_WinSocket.h" +namespace PokemonAutomation{ + using ServerSocket = ServerSocket_WinSocket; +} +#else +#include "ServerSocket_POSIX.h" +namespace PokemonAutomation{ + using ServerSocket = ServerSocket_POSIX; +} +#endif + + + +#endif diff --git a/SerialPrograms/cmake/SourceFiles.cmake b/SerialPrograms/cmake/SourceFiles.cmake index f8077299f9..f71bb0f96c 100644 --- a/SerialPrograms/cmake/SourceFiles.cmake +++ b/SerialPrograms/cmake/SourceFiles.cmake @@ -416,6 +416,7 @@ file(GLOB LIBRARY_SOURCES ../Common/Cpp/Sockets/ServerSocket_POSIX.h ../Common/Cpp/Sockets/ServerSocket_WinSocket.h ../Common/Cpp/Sockets/ServerSocket_Qt.h + ../Common/Cpp/Sockets/ServerSocket.h ../Common/Cpp/Sockets/Sockets_Tests.cpp ../Common/Cpp/Sockets/Sockets_Tests.h ../Common/Cpp/StreamConnections/MockDevice.cpp