From 42a08c6b994bc1d6ff34b49348cf2ab86d8026b1 Mon Sep 17 00:00:00 2001 From: Timo Hilger Date: Mon, 16 Mar 2026 12:01:54 +0100 Subject: [PATCH 1/4] updated serial com plugin with helper functions + added Spie Implementation for hardware button setup --- Unreal/Content/Project/BP/BP_SerialCom_v4_UE510_SPIE.uasset | 3 +++ Unreal/Content/SPIE/Maps/M_SPIE_Startup.umap | 4 ++-- .../Content/UE_BLUEPRINTS/BP_SerialCom_v4_UE510.uasset | 4 ++-- .../UE_BLUEPRINTS/BP_SerialCom_v4_UE510_WithKeys.uasset | 3 +++ 4 files changed, 10 insertions(+), 4 deletions(-) create mode 100644 Unreal/Content/Project/BP/BP_SerialCom_v4_UE510_SPIE.uasset create mode 100644 Unreal/Plugins/SerialCOM/Content/UE_BLUEPRINTS/BP_SerialCom_v4_UE510_WithKeys.uasset diff --git a/Unreal/Content/Project/BP/BP_SerialCom_v4_UE510_SPIE.uasset b/Unreal/Content/Project/BP/BP_SerialCom_v4_UE510_SPIE.uasset new file mode 100644 index 0000000..8841f19 --- /dev/null +++ b/Unreal/Content/Project/BP/BP_SerialCom_v4_UE510_SPIE.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7a6050e8f5f9aebe639fa5df144bdd47ed186fbfd2f8772b9a2caf8513bf59ba +size 128728 diff --git a/Unreal/Content/SPIE/Maps/M_SPIE_Startup.umap b/Unreal/Content/SPIE/Maps/M_SPIE_Startup.umap index 1b8a567..234f666 100644 --- a/Unreal/Content/SPIE/Maps/M_SPIE_Startup.umap +++ b/Unreal/Content/SPIE/Maps/M_SPIE_Startup.umap @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b0ff162767bd091f655d038a36ed3c5941b73d688b814ec3dc03cd2d2fc4b6f6 -size 174928 +oid sha256:22902e449b4a7b336258b9cf620d4353e8f6e1c77fefcedcc6efe2437ae880f2 +size 177482 diff --git a/Unreal/Plugins/SerialCOM/Content/UE_BLUEPRINTS/BP_SerialCom_v4_UE510.uasset b/Unreal/Plugins/SerialCOM/Content/UE_BLUEPRINTS/BP_SerialCom_v4_UE510.uasset index 0706808..b0be44f 100644 --- a/Unreal/Plugins/SerialCOM/Content/UE_BLUEPRINTS/BP_SerialCom_v4_UE510.uasset +++ b/Unreal/Plugins/SerialCOM/Content/UE_BLUEPRINTS/BP_SerialCom_v4_UE510.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4c06bac00b9b5a4083503d2f88b8b37c91e9492de02a6bdc51c073b0640ff619 -size 209148 +oid sha256:e11c9c55e327519c5fd98f5858a5303140baeff7b45433f63fb9dc6612419f44 +size 168499 diff --git a/Unreal/Plugins/SerialCOM/Content/UE_BLUEPRINTS/BP_SerialCom_v4_UE510_WithKeys.uasset b/Unreal/Plugins/SerialCOM/Content/UE_BLUEPRINTS/BP_SerialCom_v4_UE510_WithKeys.uasset new file mode 100644 index 0000000..bd3f152 --- /dev/null +++ b/Unreal/Plugins/SerialCOM/Content/UE_BLUEPRINTS/BP_SerialCom_v4_UE510_WithKeys.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:905f46425b2ee064cd939d362dd97d02ea97f236f12ff573ecdb32241bba9b31 +size 113183 From 8c42cdae3978f19c70122507c29c0ab4ee07c0d5 Mon Sep 17 00:00:00 2001 From: Timo Hilger Date: Mon, 16 Mar 2026 12:36:37 +0100 Subject: [PATCH 2/4] updated serial states and button optics --- Unreal/Content/Project/BP/BP_SerialCom_v4_UE510_SPIE.uasset | 2 +- Unreal/Content/SPIE/BP/BP_SPIE_Manager_Child.uasset | 4 ++-- Unreal/Content/SPIE/Maps/M_SPIE_Startup.umap | 4 ++-- Unreal/Content/SPIE/Widgets/WBP_Spie_MicrophoneButton.uasset | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Unreal/Content/Project/BP/BP_SerialCom_v4_UE510_SPIE.uasset b/Unreal/Content/Project/BP/BP_SerialCom_v4_UE510_SPIE.uasset index 8841f19..cd9f7b3 100644 --- a/Unreal/Content/Project/BP/BP_SerialCom_v4_UE510_SPIE.uasset +++ b/Unreal/Content/Project/BP/BP_SerialCom_v4_UE510_SPIE.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7a6050e8f5f9aebe639fa5df144bdd47ed186fbfd2f8772b9a2caf8513bf59ba +oid sha256:1a3d19ffc6765942d581823d02c83e703352536c384394e9eeb5788b0499d7b9 size 128728 diff --git a/Unreal/Content/SPIE/BP/BP_SPIE_Manager_Child.uasset b/Unreal/Content/SPIE/BP/BP_SPIE_Manager_Child.uasset index 25f512f..bab7eaa 100644 --- a/Unreal/Content/SPIE/BP/BP_SPIE_Manager_Child.uasset +++ b/Unreal/Content/SPIE/BP/BP_SPIE_Manager_Child.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2e80f550415b8b1f1799bd1dbcc77376239be79796ccf0aad20b800d91120e51 -size 758775 +oid sha256:fdf6f0356069b9be5803e781f2d333f6fa6cacc08ffca5304b72277857188f5f +size 758427 diff --git a/Unreal/Content/SPIE/Maps/M_SPIE_Startup.umap b/Unreal/Content/SPIE/Maps/M_SPIE_Startup.umap index 234f666..d696239 100644 --- a/Unreal/Content/SPIE/Maps/M_SPIE_Startup.umap +++ b/Unreal/Content/SPIE/Maps/M_SPIE_Startup.umap @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:22902e449b4a7b336258b9cf620d4353e8f6e1c77fefcedcc6efe2437ae880f2 -size 177482 +oid sha256:52011c4a223bdc4a96fac9bbe4bd3a5e910b4660e959a01470c977273c5b7714 +size 177725 diff --git a/Unreal/Content/SPIE/Widgets/WBP_Spie_MicrophoneButton.uasset b/Unreal/Content/SPIE/Widgets/WBP_Spie_MicrophoneButton.uasset index 6ed02e2..2d079f2 100644 --- a/Unreal/Content/SPIE/Widgets/WBP_Spie_MicrophoneButton.uasset +++ b/Unreal/Content/SPIE/Widgets/WBP_Spie_MicrophoneButton.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7bc1175d3fcc1e5ddfea0eea926ec374724161a850ea4b670e616c4bf075ccce -size 384261 +oid sha256:a9c3d09538305e416ed7c2678561b7ee4f21b88a27306052cfa03f151eba37ab +size 414061 From 5953dc64ffd57c822396657c224f43433ce38623 Mon Sep 17 00:00:00 2001 From: Timo Hilger Date: Mon, 16 Mar 2026 13:57:39 +0100 Subject: [PATCH 3/4] updated source with function library to get all ports and init serial com + visual updates --- .../BP/BP_SerialCom_v4_UE510_SPIE.uasset | 4 +- .../Widgets/WBP_Spie_MicrophoneButton.uasset | 4 +- .../BP_SerialCom_v4_UE510.uasset | 4 +- .../Source/SPIE_Avatar/SerialPortLibrary.cpp | 96 +++++++++++++++++++ Unreal/Source/SPIE_Avatar/SerialPortLibrary.h | 15 +++ 5 files changed, 117 insertions(+), 6 deletions(-) create mode 100644 Unreal/Source/SPIE_Avatar/SerialPortLibrary.cpp create mode 100644 Unreal/Source/SPIE_Avatar/SerialPortLibrary.h diff --git a/Unreal/Content/Project/BP/BP_SerialCom_v4_UE510_SPIE.uasset b/Unreal/Content/Project/BP/BP_SerialCom_v4_UE510_SPIE.uasset index cd9f7b3..96cedd9 100644 --- a/Unreal/Content/Project/BP/BP_SerialCom_v4_UE510_SPIE.uasset +++ b/Unreal/Content/Project/BP/BP_SerialCom_v4_UE510_SPIE.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1a3d19ffc6765942d581823d02c83e703352536c384394e9eeb5788b0499d7b9 -size 128728 +oid sha256:ba1b930bf5f0dda852a03fdde7ca6e13a991e5d6537a22b34101487b14c4bc47 +size 214063 diff --git a/Unreal/Content/SPIE/Widgets/WBP_Spie_MicrophoneButton.uasset b/Unreal/Content/SPIE/Widgets/WBP_Spie_MicrophoneButton.uasset index 2d079f2..3649f38 100644 --- a/Unreal/Content/SPIE/Widgets/WBP_Spie_MicrophoneButton.uasset +++ b/Unreal/Content/SPIE/Widgets/WBP_Spie_MicrophoneButton.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a9c3d09538305e416ed7c2678561b7ee4f21b88a27306052cfa03f151eba37ab -size 414061 +oid sha256:12e1d7bcc1e4f20cf16f6cb9e09dc5a2484165bce343fc84cbbd33421ae36d01 +size 414491 diff --git a/Unreal/Plugins/SerialCOM/Content/UE_BLUEPRINTS/BP_SerialCom_v4_UE510.uasset b/Unreal/Plugins/SerialCOM/Content/UE_BLUEPRINTS/BP_SerialCom_v4_UE510.uasset index b0be44f..8880133 100644 --- a/Unreal/Plugins/SerialCOM/Content/UE_BLUEPRINTS/BP_SerialCom_v4_UE510.uasset +++ b/Unreal/Plugins/SerialCOM/Content/UE_BLUEPRINTS/BP_SerialCom_v4_UE510.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e11c9c55e327519c5fd98f5858a5303140baeff7b45433f63fb9dc6612419f44 -size 168499 +oid sha256:63f4d65b71405e426b460ae0f6486fc03de943eec55a83743ad5136745737d06 +size 195216 diff --git a/Unreal/Source/SPIE_Avatar/SerialPortLibrary.cpp b/Unreal/Source/SPIE_Avatar/SerialPortLibrary.cpp new file mode 100644 index 0000000..f79b069 --- /dev/null +++ b/Unreal/Source/SPIE_Avatar/SerialPortLibrary.cpp @@ -0,0 +1,96 @@ +// Fill out your copyright notice in the Description page of Project Settings. + + +#include "SerialPortLibrary.h" + +#if PLATFORM_WINDOWS +#include "Windows/AllowWindowsPlatformTypes.h" +#include +#include +#include "Windows/HideWindowsPlatformTypes.h" + +#pragma comment(lib, "setupapi.lib") +#endif + +TArray USerialPortLibrary::GetAvailableSerialPorts() +{ + TArray Ports; + +#if PLATFORM_WINDOWS + // Query registry for all COM ports + HKEY hKey; + if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, TEXT("HARDWARE\\DEVICEMAP\\SERIALCOMM"), + 0, KEY_READ, &hKey) == ERROR_SUCCESS) + { + DWORD Index = 0; + TCHAR ValueName[256]; + TCHAR ValueData[256]; + DWORD ValueNameSize = 256; + DWORD ValueDataSize = 256 * sizeof(TCHAR); + DWORD Type; + + while (RegEnumValue(hKey, Index++, ValueName, &ValueNameSize, + nullptr, &Type, (LPBYTE)ValueData, &ValueDataSize) == ERROR_SUCCESS) + { + Ports.Add(FString(ValueData)); + ValueNameSize = 256; + ValueDataSize = 256 * sizeof(TCHAR); + } + RegCloseKey(hKey); + } +#endif + + return Ports; +} + +TArray USerialPortLibrary::GetAvailableSerialPortsWithNames() +{ + TArray Ports; + +#if PLATFORM_WINDOWS + // Use SetupAPI to get port + friendly device name + HDEVINFO DeviceInfoSet = SetupDiGetClassDevs( + nullptr, TEXT("USB"), nullptr, + DIGCF_PRESENT | DIGCF_ALLCLASSES + ); + + if (DeviceInfoSet == INVALID_HANDLE_VALUE) + return Ports; + + SP_DEVINFO_DATA DeviceInfoData; + DeviceInfoData.cbSize = sizeof(SP_DEVINFO_DATA); + + for (DWORD i = 0; SetupDiEnumDeviceInfo(DeviceInfoSet, i, &DeviceInfoData); i++) + { + TCHAR FriendlyName[256] = {}; + TCHAR PortName[256] = {}; + + // Get friendly name (e.g. "Arduino Uno (COM3)") + SetupDiGetDeviceRegistryProperty(DeviceInfoSet, &DeviceInfoData, + SPDRP_FRIENDLYNAME, nullptr, (PBYTE)FriendlyName, sizeof(FriendlyName), nullptr); + + // Get COM port from device registry key + HKEY DevKey = SetupDiOpenDevRegKey(DeviceInfoSet, &DeviceInfoData, + DICS_FLAG_GLOBAL, 0, DIREG_DEV, KEY_READ); + + if (DevKey != INVALID_HANDLE_VALUE) + { + DWORD PortNameSize = sizeof(PortName); + RegQueryValueEx(DevKey, TEXT("PortName"), nullptr, + nullptr, (LPBYTE)PortName, &PortNameSize); + RegCloseKey(DevKey); + + if (wcslen(PortName) > 0 && wcslen(FriendlyName) > 0) + { + // Format: "COM3|Arduino Uno (COM3)" + FString Entry = FString::Printf(TEXT("%s|%s"), PortName, FriendlyName); + Ports.Add(Entry); + } + } + } + + SetupDiDestroyDeviceInfoList(DeviceInfoSet); +#endif + + return Ports; +} \ No newline at end of file diff --git a/Unreal/Source/SPIE_Avatar/SerialPortLibrary.h b/Unreal/Source/SPIE_Avatar/SerialPortLibrary.h new file mode 100644 index 0000000..e446039 --- /dev/null +++ b/Unreal/Source/SPIE_Avatar/SerialPortLibrary.h @@ -0,0 +1,15 @@ +#pragma once +#include "CoreMinimal.h" +#include "Kismet/BlueprintFunctionLibrary.h" +#include "SerialPortLibrary.generated.h" + +UCLASS() +class SPIE_AVATAR_API USerialPortLibrary : public UBlueprintFunctionLibrary +{ + GENERATED_BODY() +public: + UFUNCTION(BlueprintPure, Category = "Serial Port") + static TArray GetAvailableSerialPorts(); + UFUNCTION(BlueprintPure, Category = "Serial Port") + static TArray GetAvailableSerialPortsWithNames(); +}; From cc1fdf2fbc5f722bbbf7135b82e4dd4fd5f2a1fd Mon Sep 17 00:00:00 2001 From: Timo Hilger Date: Mon, 16 Mar 2026 14:20:20 +0100 Subject: [PATCH 4/4] update for automatic port setup and config fallback options --- .../Project/BP/BP_SerialCom_v4_UE510_SPIE.uasset | 4 ++-- Unreal/Content/Schema/Spie_Config.schema.json | 12 ++++++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/Unreal/Content/Project/BP/BP_SerialCom_v4_UE510_SPIE.uasset b/Unreal/Content/Project/BP/BP_SerialCom_v4_UE510_SPIE.uasset index 96cedd9..05948dc 100644 --- a/Unreal/Content/Project/BP/BP_SerialCom_v4_UE510_SPIE.uasset +++ b/Unreal/Content/Project/BP/BP_SerialCom_v4_UE510_SPIE.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ba1b930bf5f0dda852a03fdde7ca6e13a991e5d6537a22b34101487b14c4bc47 -size 214063 +oid sha256:a79f564666a3451d7aeebb1eda05184616a687e54b94b0974f3d9158ba1fd268 +size 233888 diff --git a/Unreal/Content/Schema/Spie_Config.schema.json b/Unreal/Content/Schema/Spie_Config.schema.json index 7644e0c..6969e2a 100644 --- a/Unreal/Content/Schema/Spie_Config.schema.json +++ b/Unreal/Content/Schema/Spie_Config.schema.json @@ -21,6 +21,14 @@ "category": "SPIE Management Board" } }, + { + "ButtonSerialPort": + { + "type": "integer", + "default": 3, + "category": "SPIE Management Board" + } + }, { "AvatarInstance": { @@ -70,7 +78,7 @@ "SpieRecordButtonScale": { "type": "float", - "default": 1, + "default": 0.84999999999999998, "category": "Spie_ONE_VisualSetup" } }, @@ -101,7 +109,7 @@ "MicrofonMaxInputLevel": { "type": "float", - "default": 0.02, + "default": 0.050000000000000003, "category": "Spie_ONE_VisualSetup" } },