diff --git a/goldenmaster/Plugins/ApiGear/Source/ApiGear/Public/AbstractApiGearConnection.h b/goldenmaster/Plugins/ApiGear/Source/ApiGear/Public/AbstractApiGearConnection.h index 1fbd49a64..945dcfe5d 100644 --- a/goldenmaster/Plugins/ApiGear/Source/ApiGear/Public/AbstractApiGearConnection.h +++ b/goldenmaster/Plugins/ApiGear/Source/ApiGear/Public/AbstractApiGearConnection.h @@ -8,8 +8,10 @@ #include "AbstractApiGearConnection.generated.h" /** - * @brief Abstract base for IApiGearConnection implementation - * Implements state management and handles common reconnection functionality. Exposes delegates. + * Abstract base for IApiGearConnection implementation. + * Handles common reconnection functionality. + * Keeps the connection state updated. + * Exposes delegates for getting notifications of the connection state. * Does not add the actual connection handling - it needs to be implemented by the final connection. */ UCLASS(Abstract, NotBlueprintable) @@ -19,6 +21,7 @@ class APIGEAR_API UAbstractApiGearConnection : public UObject, public IApiGearCo public: explicit UAbstractApiGearConnection(const FObjectInitializer& ObjectInitializer); + FApiGearConnectionIsConnectedDelegate& GetIsConnectedChangedDelegate() override; FApiGearConnectionStateChangedDelegate& GetConnectionStateChangedDelegate() override; @@ -29,6 +32,8 @@ class APIGEAR_API UAbstractApiGearConnection : public UObject, public IApiGearCo void OnDisconnected(bool bReconnect) final; void Connect() final; void Disconnect() final; + + /* Use this function to block AutoReconnect behavior temporarily until the connection is disconnected. */ void StopReconnecting() override; bool IsConnected() PURE_VIRTUAL(UAbstractApiGearConnection::IsConnected, return false;); @@ -43,19 +48,39 @@ class APIGEAR_API UAbstractApiGearConnection : public UObject, public IApiGearCo private: void SetConnectionState(EApiGearConnectionState State); + /** + * Implement in derived class to provide actual logic specific for your connection for when network connection is established. + * Should not be used directly, instead use OnConnected(). + */ virtual void OnConnected_Implementation() PURE_VIRTUAL(UAbstractApiGearConnection::OnConnected_Implementation, ); + /** + * Implement in derived class to provide actual logic specific for your connection for when the network connection is over + * Should not be used directly, instead use OnDisonnected(). + */ virtual void OnDisconnected_Implementation(bool bReconnect) PURE_VIRTUAL(UAbstractApiGearConnection::OnDisconnected_Implementation, ); + /** + * Implement in derived class to provide actual logic specific for your connection to establish a connection + * Should not be used directly, instead use Connect(). + */ virtual void Connect_Implementation() PURE_VIRTUAL(UAbstractApiGearConnection::Connect_Implementation, ); + /** + * Implement in derived class to provide actual logic specific for your connection to close connection + * Should not be used directly, instead use Disconnect(). + */ virtual void Disconnect_Implementation() PURE_VIRTUAL(UAbstractApiGearConnection::Disconnect_Implementation, ); FApiGearConnectionIsConnectedDelegate IsConnectedChanged; FApiGearConnectionStateChangedDelegate ConnectionStateChanged; + /** If set to true, the connection if not running will try to reconnect with a time interval, until succeeded */ bool bIsAutoReconnectEnabled; + /** Used when the bIsAutoReconnectEnabled is on but reconnection functionality needs to be temporarily stop for disconnecting. */ bool bStopReconnectingRequested; + /** Reconnection timer*/ ApiGear::FDelegateHandle RetryTickerHandle; + /** Reconnection timer delegate*/ FTickerDelegate RetryTickerDelegate; EApiGearConnectionState ConnectionState; diff --git a/goldenmaster/Plugins/ApiGear/Source/ApiGear/Public/ApiGearConnection.h b/goldenmaster/Plugins/ApiGear/Source/ApiGear/Public/ApiGearConnection.h index eb5e189a1..99a0ae547 100644 --- a/goldenmaster/Plugins/ApiGear/Source/ApiGear/Public/ApiGearConnection.h +++ b/goldenmaster/Plugins/ApiGear/Source/ApiGear/Public/ApiGearConnection.h @@ -18,12 +18,12 @@ enum class EApiGearConnectionState : uint8 Connected UMETA(Displayname = "Connected") }; -/// Used when Network Layer Connection changes its state to connected(true) or any other connection state (false). +/** Used when Network Layer Connection changes its state to connected(true) or any other connection state(false). */ DECLARE_MULTICAST_DELEGATE_OneParam(FApiGearConnectionIsConnectedDelegate, bool); -/// Used when Network Layer Connection changes its state. +/** Used when Network Layer Connection changes its state. */ DECLARE_MULTICAST_DELEGATE_OneParam(FApiGearConnectionStateChangedDelegate, EApiGearConnectionState); /** - * @brief Used when the interface client changes its subscription status: + * Used when the interface client changes its subscription status: * either is plugged in the network and ready to use with protocol of your choice (true) * or it won't be able to properly communicate with server side (false). * An established network connection (ConnectionIsConnectedDelegate with true parameter) is often necessary, but not sufficient (depending on your setup and used protocol) @@ -32,11 +32,12 @@ DECLARE_MULTICAST_DELEGATE_OneParam(FApiGearConnectionStateChangedDelegate, EApi DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FApiGearRemoteApiSubscriptionStatusChangedDelegate, bool, IsSubscribed); /** - * @brief An interface for all connections meant to be used by ApiGear + * An interface for all connections meant to be used by ApiGear * ensures all connections have: * - settings for reconnection * - current state * - general state and settings accessors + * @see AbstractApiGearConnection for implementation of common functionality. */ UINTERFACE(MinimalAPI, meta = (CannotImplementInterfaceInBlueprint)) class UApiGearConnection : public UInterface @@ -49,26 +50,42 @@ class APIGEAR_API IApiGearConnection GENERATED_BODY() public: + /** Returns a delegate for notifications informing whether connection is ready to use + * @see ApiGearConnectionIsConnectedDelegate + */ virtual FApiGearConnectionIsConnectedDelegate& GetIsConnectedChangedDelegate() = 0; + /** Returns a delegate for notifications informing about the connection state. + * @see FApiGearConnectionStateChangedDelegate + */ virtual FApiGearConnectionStateChangedDelegate& GetConnectionStateChangedDelegate() = 0; UFUNCTION(BlueprintCallable, Category = "ApiGear|Connection") virtual void Configure(FString InServerURL, bool bInAutoReconnectEnabled) = 0; UFUNCTION(BlueprintCallable, Category = "ApiGear|Connection") + /** Call this function to request connection to be established */ virtual void Connect() = 0; UFUNCTION(BlueprintCallable, Category = "ApiGear|Connection") + /** A callback for when the network connection is established, + * Use to finalize connect related actions in the implemented connection, + * For notifications on when connection is disconnected use GetIsConnectedChangedDelegate or ApiGearConnectionStateChangedDelegate. + */ virtual void OnConnected() = 0; UFUNCTION(BlueprintCallable, Category = "ApiGear|Connection") + /** Call this function to request closing connection. */ virtual void Disconnect() = 0; UFUNCTION(BlueprintCallable, Category = "ApiGear|Connection") + /** A callback for when the network connection has closed, + * use to finalize disconnect-related actions in the implemented connection. + * For notifications on when connection is disconnected use GetIsConnectedChangedDelegate or ApiGearConnectionStateChangedDelegate. + */ virtual void OnDisconnected(bool bReconnect) = 0; UFUNCTION(BlueprintCallable, Category = "ApiGear|Connection") virtual bool IsConnected() = 0; UFUNCTION(BlueprintCallable, Category = "ApiGear|Connection") virtual void StopReconnecting() = 0; - /** Returns the endpoint identifier for this connection, e.g. simulation or phone_service */ + /** Returns the endpoint identifier for this connection, e.g. simulation or phone_service*/ UFUNCTION(BlueprintCallable, Category = "ApiGear|Connection") virtual FString GetUniqueEndpointIdentifier() const = 0; @@ -76,7 +93,7 @@ class APIGEAR_API IApiGearConnection UFUNCTION(BlueprintCallable, Category = "ApiGear|Connection") virtual FString GetServerURL() const = 0; - /** Returns the type identifier for this connection, e.g. olink */ + /** Returns the identifier of protocol used for this connection, e.g. olink */ UFUNCTION(BlueprintCallable, Category = "ApiGear|Connection") virtual FString GetConnectionProtocolIdentifier() const = 0; diff --git a/goldenmaster/Plugins/ApiGear/Source/ApiGear/Public/ApiGearConnectionsStore.h b/goldenmaster/Plugins/ApiGear/Source/ApiGear/Public/ApiGearConnectionsStore.h index 3c190bfcb..659968021 100644 --- a/goldenmaster/Plugins/ApiGear/Source/ApiGear/Public/ApiGearConnectionsStore.h +++ b/goldenmaster/Plugins/ApiGear/Source/ApiGear/Public/ApiGearConnectionsStore.h @@ -13,12 +13,13 @@ APIGEAR_API DECLARE_LOG_CATEGORY_EXTERN(LogApiGearConnectionsStore, Log, All); /** - * Implements the connections store for the ApiGear plugin. + * Creates and stores connections based on configured connections in settings. + * @see ApiGearSettings * - * Can handle all connections which inherit from the IApiGearConnection interface. - * To register your own protocol, you need to call RegisterConnectionFactory - * before this class/module is initialized. The ApiGearOLink module is an example - * how this can be done. + * Handles all connections which inherit from the IApiGearConnection interface. + * @warning For custom protocols make sure you've registered your own protocol factory with a RegisterConnectionFactory. + * before this class/module is initialized. + * You may use implemented ApiGearOLink module as an example. */ UCLASS(BlueprintType) class APIGEAR_API UApiGearConnectionsStore : public UEngineSubsystem @@ -30,7 +31,11 @@ class APIGEAR_API UApiGearConnectionsStore : public UEngineSubsystem /** A type of function for creating connections*/ using FConnectionFactoryFunction = TFunction(UObject*, FString)>; - /** register factories for different types of connections */ + /** + * Register custom factories of connections. + * This function must be called before this class or module are initialized. + * @see ApiGearOLink. + */ static bool RegisterConnectionFactory(FString ConnectionTypeIdentifier, FConnectionFactoryFunction FactoryFunction); // USubssystem functions @@ -62,6 +67,7 @@ class APIGEAR_API UApiGearConnectionsStore : public UEngineSubsystem UFUNCTION(BlueprintCallable, Category = "ApiGear|ConnectionsStore") TArray GetAvailableProtocols() const; + /** Replaces ApiGear plugin settings configured for the project with all currently added connections. */ UFUNCTION(BlueprintCallable, Category = "ApiGear|ConnectionsStore") void OverwriteAndSaveConnectionsToSettings() const; diff --git a/goldenmaster/Plugins/ApiGear/Source/ApiGear/Public/ApiGearSettings.h b/goldenmaster/Plugins/ApiGear/Source/ApiGear/Public/ApiGearSettings.h index aec7813bc..405b1009f 100644 --- a/goldenmaster/Plugins/ApiGear/Source/ApiGear/Public/ApiGearSettings.h +++ b/goldenmaster/Plugins/ApiGear/Source/ApiGear/Public/ApiGearSettings.h @@ -7,7 +7,7 @@ #include "Engine/EngineTypes.h" #include "ApiGearSettings.generated.h" -/** Settings per connection for ApiGear plugins */ +/** Settings for a connection in ApiGear plugins */ USTRUCT() struct FApiGearConnectionSetting { @@ -19,23 +19,36 @@ struct FApiGearConnectionSetting */ FString ProtocolIdentifier{"olink"}; - /** Choose the server to connect to */ + /** + * Choose the server to connect to + * this is a full address with a port + * It will be used "as is", so if you need any pre or post fixes like + * "ws://" make sure the field contains it. + */ UPROPERTY(EditAnywhere, config, Category = ApiGearConnectionSetting) FString URL{TEXT("ws://127.0.0.1:8000/ws")}; - /** Choose whether to automatically reconnect */ + /** Enable reconnect functionality for connection, also automatically starts the connection for the first time */ UPROPERTY(EditAnywhere, config, Category = ApiGearConnectionSetting) bool AutoReconnectEnabled{false}; }; /** - * Implements the settings for the ApiGear plugin. + * Stores settings for each connection and other network related settings for ApiGear plugin. + * For each connection settings a connections is created by ApiGearConnectionsStore on startup, + * For other custom protocols make sure that a factory for it is added to ApiGearConnectionsStore. + * @see ApiGearConnectionsStore */ UCLASS(Config = Engine, DefaultConfig) class APIGEAR_API UApiGearSettings : public UObject { GENERATED_UCLASS_BODY() - /** Choose the server to connect to */ + /** + * Url of tracer server to connect to. + * This is a full address with a port + * It will be used "as is", so if you need any pre or post fixes like + * "ws://" make sure the field contains it. + */ UPROPERTY(EditAnywhere, config, Category = TracerSetup, meta = (ConfigRestartRequired = true)) FString Tracer_URL; @@ -47,15 +60,20 @@ class APIGEAR_API UApiGearSettings : public UObject UPROPERTY(EditAnywhere, config, Category = TracerSetup, meta = (ConfigRestartRequired = true)) bool Tracer_EnableDebugLog; - /** Save and overwrite runtime modifications to the connections on exit */ + /** + * Save and overwrite runtime modifications to the connections on exit. + * The property is checked on exit. + * If set to false, all the changes (compared with the startup) will be lost, even if it was set to true during application lifetime. + * You still can save current settings state during editing regardless of this property with a ApiGearConnectionsStore::OverwriteAndSaveConnectionsToSettings function. + */ UPROPERTY(EditAnywhere, config, Category = ConnectionSetup, meta = (ConfigRestartRequired = true, Display = "Use runtime changes instead of settings")) bool bSaveRuntimeEdit; - // Automatically start + /** Automatically starts the Hosted OLink Server. */ UPROPERTY(EditAnywhere, config, Category = OLinkHostSetup) bool OLINK_AutoStart; - // On which Port to listen + /** Port on which Hosted OLink Server is listening.*/ UPROPERTY(EditAnywhere, config, Category = OLinkHostSetup) uint32 OLINK_Port; diff --git a/goldenmaster/Plugins/ApiGear/Source/ApiGear/Public/ApiGearTicker.h b/goldenmaster/Plugins/ApiGear/Source/ApiGear/Public/ApiGearTicker.h index dcdde7604..ffb855b82 100644 --- a/goldenmaster/Plugins/ApiGear/Source/ApiGear/Public/ApiGearTicker.h +++ b/goldenmaster/Plugins/ApiGear/Source/ApiGear/Public/ApiGearTicker.h @@ -4,6 +4,7 @@ #include "Runtime/Launch/Resources/Version.h" #include "Containers/Ticker.h" +/** This is a a helper file to provide version independent ticker functionality */ namespace ApiGear { #if (ENGINE_MAJOR_VERSION >= 5) diff --git a/goldenmaster/Plugins/ApiGear/Source/ApiGear/Public/apigear.json.adapter.h b/goldenmaster/Plugins/ApiGear/Source/ApiGear/Public/apigear.json.adapter.h index 9529ff12e..446300d97 100644 --- a/goldenmaster/Plugins/ApiGear/Source/ApiGear/Public/apigear.json.adapter.h +++ b/goldenmaster/Plugins/ApiGear/Source/ApiGear/Public/apigear.json.adapter.h @@ -8,16 +8,40 @@ #define JSON_NOEXCEPTION 1 #include +/** + * Converts json formated data into FString. + * The functions signature must follow the nlohmann from_jason function rules. + * It is automatically called in usage j.get(); + * @param j an input json formated data + * @param p FString that will be filled with data from j. + * In case data is malformed or not convertible to FString the function will throw. + */ static void from_json(const nlohmann::json& j, FString& p) { p = FString(UTF8_TO_TCHAR(j.get().c_str())); } +/** + * Converts FString into json formated data. + * The functions signature must follow the nlohmann to_json function rules. + * It is automatically called in usage j = p; + * @param j a json type data that will be filled with data from p + * @param p an input from which json data will be filled. + */ static void to_json(nlohmann::json& j, const FString& value) { j = TCHAR_TO_UTF8(*value); } +/** + * Converts json formated data into TArray of T type elements. + * The T type needs to be either std type or have its from_json function. + * The functions signature must follow the nlohmann from_jason function rules. + * It is automatically called in usage j.get>(); + * @param j an input json formated data + * @param p FString that will be filled with data from j. + * In case data is malformed or not convertible to FString the function will throw. + */ template void from_json(const nlohmann::json& j, TArray& p) { @@ -29,6 +53,14 @@ void from_json(const nlohmann::json& j, TArray& p) } } +/** + * Converts TArray of T type elements into json formated data. + * The T type needs to be either std type or have its to_json function. + * The functions signature must follow the nlohmann to_json function rules. + * It is automatically called in usage j = p; + * @param j a json type data that will be filled with data from p + * @param p an input from which json data will be filled. + */ template void to_json(nlohmann::json& j, const TArray& p) { diff --git a/goldenmaster/Plugins/ApiGear/Source/ApiGearOLink/Public/unrealolink.h b/goldenmaster/Plugins/ApiGear/Source/ApiGearOLink/Public/unrealolink.h index 00f2fb317..a2dfbb0d2 100644 --- a/goldenmaster/Plugins/ApiGear/Source/ApiGearOLink/Public/unrealolink.h +++ b/goldenmaster/Plugins/ApiGear/Source/ApiGearOLink/Public/unrealolink.h @@ -1,93 +1,93 @@ -#pragma once - -#include "AbstractApiGearConnection.h" -#include "apigearolink.h" -THIRD_PARTY_INCLUDES_START -#include "olink/clientnode.h" -#include "olink/clientregistry.h" -THIRD_PARTY_INCLUDES_END -#include "WebSocketsModule.h" -#include "IWebSocket.h" -#include "Containers/Queue.h" -#include "HAL/CriticalSection.h" -#include "ApiGearTicker.h" -#include "unrealolink.generated.h" - -DECLARE_LOG_CATEGORY_EXTERN(LogApiGearOLink, Log, All); - -class APIGEAROLINK_API OLinkFactory -{ -public: - static TScriptInterface Create(UObject* Outer, FString UniqueConnectionIdentifier); -}; - -UCLASS(BlueprintType, Displayname = "ApiGear ObjectLink Connection", Category = "ApiGear|Connection") -class APIGEAROLINK_API UUnrealOLink final : public UAbstractApiGearConnection -{ - GENERATED_BODY() -public: - explicit UUnrealOLink(const FObjectInitializer& ObjectInitializer); - virtual ~UUnrealOLink(); - - void Configure(FString InServerURL, bool bInAutoReconnectEnabled) override; - - void log(const FString& logMessage); - void handleTextMessage(const std::string& message); - - void linkObjectSource(const std::string& name); - void unlinkObjectSource(const std::string& name); - - // UAbstractApiGearConnection - void Connect_Implementation() final; - void Disconnect_Implementation() final; - void OnConnected_Implementation() final; - void OnDisconnected_Implementation(bool bReconnect) final; - bool IsConnected() override; - - /** Returns the endpoint identifier for this connection, e.g. ip:port or #connID */ - FString GetUniqueEndpointIdentifier() const override; - FString GetConnectionProtocolIdentifier() const override - { - return ApiGearOLinkProtocolIdentifier; - }; - - std::shared_ptr node() - { - return m_node; - }; - - FString GetServerURL() const override - { - return m_serverURL; - }; - -private: - bool bInitialized = false; - void open(const FString& url); - /* - * Helper method for sending messages, should be used from one thread, here achieved with scheduling task to main thread. - * see m_processMessageTaskTimerHandle - */ - void processMessages(); - /* - * Sends queued messages - * Uses m_flushMessagesMutex, to ensure it called only once at one time. - * It is not thread safe function - uses a m_socket and m_queue which are not guarded separately across the UUnrealOLink - */ - void flushMessages(); - - TArray ListLinkedObjects; - - DEFINE_LOG_CATEGORY(LogApiGearOLink); - - // Delegate handle for scheduled process message task - ApiGear::FDelegateHandle m_processMessageTaskTimerHandle; - - TSharedPtr m_socket; - FString m_serverURL; - ApiGear::ObjectLink::ClientRegistry m_registry; - std::shared_ptr m_node; - TQueue m_queue; - // Mutex for flushMessages(). - FCriticalSection m_flushMessagesMutex; -}; +#pragma once + +#include "AbstractApiGearConnection.h" +#include "apigearolink.h" +THIRD_PARTY_INCLUDES_START +#include "olink/clientnode.h" +#include "olink/clientregistry.h" +THIRD_PARTY_INCLUDES_END +#include "WebSocketsModule.h" +#include "IWebSocket.h" +#include "Containers/Queue.h" +#include "HAL/CriticalSection.h" +#include "ApiGearTicker.h" +#include "unrealolink.generated.h" + +DECLARE_LOG_CATEGORY_EXTERN(LogApiGearOLink, Log, All); + +class APIGEAROLINK_API OLinkFactory +{ +public: + static TScriptInterface Create(UObject* Outer, FString UniqueConnectionIdentifier); +}; + +UCLASS(BlueprintType, Displayname = "ApiGear ObjectLink Connection", Category = "ApiGear|Connection") +class APIGEAROLINK_API UUnrealOLink final : public UAbstractApiGearConnection +{ + GENERATED_BODY() +public: + explicit UUnrealOLink(const FObjectInitializer& ObjectInitializer); + virtual ~UUnrealOLink(); + + void Configure(FString InServerURL, bool bInAutoReconnectEnabled) override; + + void log(const FString& logMessage); + void handleTextMessage(const std::string& message); + + void linkObjectSource(const std::string& name); + void unlinkObjectSource(const std::string& name); + + // UAbstractApiGearConnection + void Connect_Implementation() final; + void Disconnect_Implementation() final; + void OnConnected_Implementation() final; + void OnDisconnected_Implementation(bool bReconnect) final; + bool IsConnected() override; + + /** Returns the endpoint identifier for this connection, e.g. ip:port or #connID */ + FString GetUniqueEndpointIdentifier() const override; + FString GetConnectionProtocolIdentifier() const override + { + return ApiGearOLinkProtocolIdentifier; + }; + + std::shared_ptr node() + { + return m_node; + }; + + FString GetServerURL() const override + { + return m_serverURL; + }; + +private: + bool bInitialized = false; + void open(const FString& url); + /* + * Helper method for sending messages, should be used from one thread, here achieved with scheduling task to main thread. + * see m_processMessageTaskTimerHandle + */ + void processMessages(); + /* + * Sends queued messages + * Uses m_flushMessagesMutex, to ensure it called only once at one time. + * It is not thread safe function - uses a m_socket and m_queue which are not guarded separately across the UUnrealOLink + */ + void flushMessages(); + + TArray ListLinkedObjects; + + DEFINE_LOG_CATEGORY(LogApiGearOLink); + + // Delegate handle for scheduled process message task + ApiGear::FDelegateHandle m_processMessageTaskTimerHandle; + + TSharedPtr m_socket; + FString m_serverURL; + ApiGear::ObjectLink::ClientRegistry m_registry; + std::shared_ptr m_node; + TQueue m_queue; + // Mutex for flushMessages(). + FCriticalSection m_flushMessagesMutex; +}; diff --git a/rules.yaml b/rules.yaml index 76f70201f..314be989e 100644 --- a/rules.yaml +++ b/rules.yaml @@ -1,354 +1,354 @@ -engines: - cli: ">= v0.35.0" -features: - - name: api - scopes: - - match: module - prefix: "Plugins/{{Camel .Module.Name}}/Source/{{Camel .Module.Name}}/" - documents: - - source: "module/Source/module/Public/Generated/api/module.h.tpl" - target: "Public/Generated/api/{{Camel .Module.Name}}_apig.h" - - source: "module/Source/module/Public/Generated/api/data.h.tpl" - target: "Public/Generated/api/{{Camel .Module.Name}}_data.h" - - source: "module/Source/module/Private/Generated/api/data.cpp.tpl" - target: "Private/Generated/api/{{Camel .Module.Name}}_data.cpp" - - source: "module/Source/module/Private/Generated/LogCategories.h.tpl" - target: "Private/Generated/{{Camel .Module.Name}}LogCategories.h" - - source: "module/Source/module/Private/Generated/LogCategories.cpp.tpl" - target: "Private/Generated/{{Camel .Module.Name}}LogCategories.cpp" - - match: interface - prefix: "Plugins/{{Camel .Module.Name}}/Source/{{Camel .Module.Name}}/" - documents: - - source: "module/Source/module/Public/Generated/api/interface.h.tpl" - target: "Public/Generated/api/{{Camel .Module.Name}}{{Camel .Interface.Name}}Interface.h" - - source: "module/Source/module/Public/Generated/api/abstract.h.tpl" - target: "Public/Generated/api/Abstract{{Camel .Module.Name}}{{Camel .Interface.Name}}.h" - - source: "module/Source/module/Private/Generated/api/abstract.cpp.tpl" - target: "Private/Generated/api/Abstract{{Camel .Module.Name}}{{Camel .Interface.Name}}.cpp" - - name: apigear_olinkproto - scopes: - - match: system - prefix: "Plugins/ApiGear/Source/ThirdParty/OLinkProtocolLibrary/" - documents: - - source: "ApiGear/Source/ThirdParty/OLinkProtocolLibrary/OLinkProtocolLibrary.Build.cs" - target: "OLinkProtocolLibrary.Build.cs" - raw: true - - source: "ApiGear/Source/ThirdParty/OLinkProtocolLibrary/Private/OLinkProtocolLibraryModule.cpp" - target: "Private/OLinkProtocolLibraryModule.cpp" - raw: true - - source: "ApiGear/Source/ThirdParty/OLinkProtocolLibrary/Public/olink/clientnode.h" - target: "Public/olink/clientnode.h" - raw: true - - source: "ApiGear/Source/ThirdParty/OLinkProtocolLibrary/Private/clientnode.cpp" - target: "Private/clientnode.cpp" - raw: true - - source: "ApiGear/Source/ThirdParty/OLinkProtocolLibrary/Public/olink/clientregistry.h" - target: "Public/olink/clientregistry.h" - raw: true - - source: "ApiGear/Source/ThirdParty/OLinkProtocolLibrary/Private/clientregistry.cpp" - target: "Private/clientregistry.cpp" - raw: true - - source: "ApiGear/Source/ThirdParty/OLinkProtocolLibrary/Public/olink/core/basenode.h" - target: "Public/olink/core/basenode.h" - raw: true - - source: "ApiGear/Source/ThirdParty/OLinkProtocolLibrary/Private/core/basenode.cpp" - target: "Private/core/basenode.cpp" - raw: true - - source: "ApiGear/Source/ThirdParty/OLinkProtocolLibrary/Public/olink/remotenode.h" - target: "Public/olink/remotenode.h" - raw: true - - source: "ApiGear/Source/ThirdParty/OLinkProtocolLibrary/Public/olink/iremotenode.h" - target: "Public/olink/iremotenode.h" - raw: true - - source: "ApiGear/Source/ThirdParty/OLinkProtocolLibrary/Public/olink/remoteregistry.h" - target: "Public/olink/remoteregistry.h" - raw: true - - source: "ApiGear/Source/ThirdParty/OLinkProtocolLibrary/Private/remoteregistry.cpp" - target: "Private/remoteregistry.cpp" - raw: true - - source: "ApiGear/Source/ThirdParty/OLinkProtocolLibrary/Private/remotenode.cpp" - target: "Private/remotenode.cpp" - raw: true - - source: "ApiGear/Source/ThirdParty/OLinkProtocolLibrary/Public/olink/consolelogger.h" - target: "Public/olink/consolelogger.h" - raw: true - - source: "ApiGear/Source/ThirdParty/OLinkProtocolLibrary/Private/consolelogger.cpp" - target: "Private/consolelogger.cpp" - raw: true - - source: "ApiGear/Source/ThirdParty/OLinkProtocolLibrary/Public/olink/iclientnode.h" - target: "Public/olink/iclientnode.h" - raw: true - - source: "ApiGear/Source/ThirdParty/OLinkProtocolLibrary/Public/olink/core/protocol.h" - target: "Public/olink/core/protocol.h" - raw: true - - source: "ApiGear/Source/ThirdParty/OLinkProtocolLibrary/Private/core/protocol.cpp" - target: "Private/core/protocol.cpp" - raw: true - - source: "ApiGear/Source/ThirdParty/OLinkProtocolLibrary/Public/olink/core/olink_common.h" - target: "Public/olink/core/olink_common.h" - raw: true - - source: "ApiGear/Source/ThirdParty/OLinkProtocolLibrary/Public/olink/iobjectsink.h" - target: "Public/olink/iobjectsink.h" - raw: true - - source: "ApiGear/Source/ThirdParty/OLinkProtocolLibrary/Public/olink/iobjectsource.h" - target: "Public/olink/iobjectsource.h" - raw: true - - source: "ApiGear/Source/ThirdParty/OLinkProtocolLibrary/Public/olink/core/types.h" - target: "Public/olink/core/types.h" - raw: true - - source: "ApiGear/Source/ThirdParty/OLinkProtocolLibrary/Private/core/types.cpp" - target: "Private/core/types.cpp" - raw: true - - source: "ApiGear/Source/ThirdParty/OLinkProtocolLibrary/Public/olink/core/uniqueidobjectstorage.h" - target: "Public/olink/core/uniqueidobjectstorage.h" - raw: true - - name: apigear - requires: - - apigear_olink - scopes: - - match: system - prefix: "Plugins/ApiGear/" - documents: - - source: "ApiGear/Source/ApiGear/apigear.Build.cs" - target: "Source/ApiGear/apigear.Build.cs" - raw: true - - source: "ApiGear/apigear.uplugin" - target: "apigear.uplugin" - raw: true - - source: "ApiGear/Config/FilterPlugin.ini" - target: "Config/FilterPlugin.ini" - raw: true - - source: "ApiGear/Source/ApiGear/Public/tracer.h" - target: "Source/ApiGear/Public/tracer.h" - raw: true - - source: "ApiGear/Source/ApiGear/Private/tracer.cpp" - target: "Source/ApiGear/Private/tracer.cpp" - raw: true - - source: "ApiGear/Source/ApiGear/Public/apigear.h" - target: "Source/ApiGear/Public/apigear.h" - raw: true - - source: "ApiGear/Source/ApiGear/Public/ApiGearConnection.h" - target: "Source/ApiGear/Public/ApiGearConnection.h" - raw: true - - source: "ApiGear/Source/ApiGear/Public/AbstractApiGearConnection.h" - target: "Source/ApiGear/Public/AbstractApiGearConnection.h" - raw: true - - source: "ApiGear/Source/ApiGear/Private/AbstractApiGearConnection.cpp" - target: "Source/ApiGear/Private/AbstractApiGearConnection.cpp" - raw: true - - source: "ApiGear/Source/ApiGear/Public/ApiGearTicker.h" - target: "Source/ApiGear/Public/ApiGearTicker.h" - raw: true - - source: "ApiGear/Source/ApiGear/Public/ApiGearLogCategories.h" - target: "Source/ApiGear/Public/ApiGearLogCategories.h" - raw: true - - source: "ApiGear/Source/ApiGear/Private/ApiGearLogCategories.cpp" - target: "Source/ApiGear/Private/ApiGearLogCategories.cpp" - raw: true - - source: "ApiGear/Source/ApiGear/Public/apigear.json.adapter.h" - target: "Source/ApiGear/Public/apigear.json.adapter.h" - raw: true - - source: "ApiGear/Source/ApiGear/Private/apigear.cpp" - target: "Source/ApiGear/Private/apigear.cpp" - raw: true - - source: "ApiGear/Source/ApiGearEditor/Public/ApiGearEditor.h" - target: "Source/ApiGearEditor/Public/ApiGearEditor.h" - raw: true - - source: "ApiGear/Source/ApiGearEditor/Private/ApiGearEditor.cpp" - target: "Source/ApiGearEditor/Private/ApiGearEditor.cpp" - raw: true - - source: "ApiGear/Resources/Icon40.png" - target: "Resources/Icon40.png" - raw: true - - source: "ApiGear/Resources/Icon128.png" - target: "Resources/Icon128.png" - raw: true - - source: "ApiGear/Source/ApiGearEditor/Public/ApiGearEditorStyle.h" - target: "Source/ApiGearEditor/Public/ApiGearEditorStyle.h" - raw: true - - source: "ApiGear/Source/ApiGearEditor/Private/ApiGearEditorStyle.cpp" - target: "Source/ApiGearEditor/Private/ApiGearEditorStyle.cpp" - raw: true - - source: "ApiGear/Source/ApiGearEditor/Public/ApiGearEditorCommands.h" - target: "Source/ApiGearEditor/Public/ApiGearEditorCommands.h" - raw: true - - source: "ApiGear/Source/ApiGearEditor/Private/ApiGearEditorCommands.cpp" - target: "Source/ApiGearEditor/Private/ApiGearEditorCommands.cpp" - raw: true - - source: "ApiGear/Source/ApiGear/Public/ApiGearSettings.h" - target: "Source/ApiGear/Public/ApiGearSettings.h" - raw: true - - source: "ApiGear/Source/ApiGear/Private/ApiGearSettings.cpp" - target: "Source/ApiGear/Private/ApiGearSettings.cpp" - raw: true - - source: "ApiGear/Source/ApiGear/Public/ApiGearConnectionsStore.h" - target: "Source/ApiGear/Public/ApiGearConnectionsStore.h" - raw: true - - source: "ApiGear/Source/ApiGear/Private/ApiGearConnectionsStore.cpp" - target: "Source/ApiGear/Private/ApiGearConnectionsStore.cpp" - raw: true - - source: "ApiGear/Source/ApiGearEditor/ApiGearEditor.Build.cs" - target: "Source/ApiGearEditor/ApiGearEditor.Build.cs" - raw: true - - source: "ApiGear/Source/ThirdParty/nlohmannJsonLibrary/nlohmannJsonLibrary.Build.cs" - target: "Source/ThirdParty/nlohmannJsonLibrary/nlohmannJsonLibrary.Build.cs" - raw: true - - source: "ApiGear/Source/ThirdParty/nlohmannJsonLibrary/Public/nlohmann/json.hpp" - target: "Source/ThirdParty/nlohmannJsonLibrary/Public/nlohmann/json.hpp" - raw: true - - name: apigear_olink - requires: - - apigear_olinkproto - scopes: - - match: system - prefix: "Plugins/ApiGear/" - documents: - - source: "ApiGear/Source/ApiGearOLink/apigearolink.Build.cs" - target: "Source/ApiGearOLink/apigearolink.Build.cs" - raw: true - - source: "ApiGear/Source/ApiGearOLink/Public/apigearolink.h" - target: "Source/ApiGearOLink/Public/apigearolink.h" - raw: true - - source: "ApiGear/Source/ApiGearOLink/Private/apigearolink.cpp" - target: "Source/ApiGearOLink/Private/apigearolink.cpp" - raw: true - - source: "ApiGear/Source/ApiGearOLink/Private/unrealolink.cpp" - target: "Source/ApiGearOLink/Private/unrealolink.cpp" - raw: true - - source: "ApiGear/Source/ApiGearOLink/Public/unrealolink.h" - target: "Source/ApiGearOLink/Public/unrealolink.h" - raw: true - - source: "ApiGear/Source/ApiGearOLink/Private/unrealolinksink.cpp" - target: "Source/ApiGearOLink/Private/unrealolinksink.cpp" - raw: true - - source: "ApiGear/Source/ApiGearOLink/Public/unrealolinksink.h" - target: "Source/ApiGearOLink/Public/unrealolinksink.h" - raw: true - - source: "ApiGear/Source/ApiGearOLink/Private/UnrealOLinkHost.cpp" - target: "Source/ApiGearOLink/Private/UnrealOLinkHost.cpp" - raw: true - - source: "ApiGear/Source/ApiGearOLink/Public/UnrealOLinkHost.h" - target: "Source/ApiGearOLink/Public/UnrealOLinkHost.h" - raw: true - - source: "ApiGear/Source/ApiGearOLink/Private/OLinkHostConnection.h" - target: "Source/ApiGearOLink/Private/OLinkHostConnection.h" - raw: true - - source: "ApiGear/Source/ApiGearOLink/Private/OLinkHostConnection.cpp" - target: "Source/ApiGearOLink/Private/OLinkHostConnection.cpp" - raw: true - - source: "ApiGear/Source/ApiGearOLink/Private/OLinkHostPrivate.h" - target: "Source/ApiGearOLink/Private/OLinkHostPrivate.h" - raw: true - - source: "ApiGear/Source/ApiGearOLink/Private/OLinkHostPrivate.cpp" - target: "Source/ApiGearOLink/Private/OLinkHostPrivate.cpp" - raw: true - - name: stubs - requires: - - api - scopes: - - match: module - prefix: "Plugins/{{Camel .Module.Name}}/" - documents: - - source: "module/Source/module/Private/Tests/testbase.h.tpl" - target: "Source/{{Camel .Module.Name}}/Private/Tests/{{Camel .Module.Name}}TestBase.h" - preserve: true - - match: interface - prefix: "Plugins/{{Camel .Module.Name}}/" - documents: - - source: "module/Source/module/Public/Implementation/implementation.h.tpl" - target: "Source/{{Camel .Module.Name}}/Public/Implementation/{{Camel .Module.Name}}{{Camel .Interface.Name}}.h" - preserve: true - - source: "module/Source/module/Private/Implementation/implementation.cpp.tpl" - target: "Source/{{Camel .Module.Name}}/Private/Implementation/{{Camel .Module.Name}}{{Camel .Interface.Name}}.cpp" - preserve: true - - source: "module/Source/module/Private/Tests/implementationtest.cpp.tpl" - target: "Source/{{Camel .Module.Name}}/Private/Tests/{{Camel .Module.Name}}{{Camel .Interface.Name}}Tests.cpp" - preserve: true - - name: plugin - scopes: - - match: system - documents: - - source: "buildPlugins.bat.tpl" - target: "buildPlugins.bat" - - source: "buildPlugins.sh.tpl" - target: "buildPlugins.sh" - - match: module - prefix: "Plugins/{{Camel .Module.Name}}/" - documents: - - source: "module/Config/FilterPlugin.ini" - target: "Config/FilterPlugin.ini" - raw: true - - source: "module/Source/module/pluginname.uplugin.tpl" - target: "{{Camel .Module.Name}}.uplugin" - - source: "module/Source/module/Public/pluginnamesettings.h.tpl" - target: "Source/{{Camel .Module.Name}}/Public/{{Camel .Module.Name}}Settings.h" - - source: "module/Source/module/Private/pluginnamesettings.cpp.tpl" - target: "Source/{{Camel .Module.Name}}/Private/{{Camel .Module.Name}}Settings.cpp" - - source: "module/Source/moduleeditor/Public/pluginnameconnectionsettings.h.tpl" - target: "Source/{{Camel .Module.Name}}Editor/Public/{{Camel .Module.Name}}ConnectionSettings.h" - - source: "module/Source/moduleeditor/Private/pluginnameconnectionsettings.cpp.tpl" - target: "Source/{{Camel .Module.Name}}Editor/Private/{{Camel .Module.Name}}ConnectionSettings.cpp" - - source: "module/Source/moduleeditor/Public/pluginnameeditor.h.tpl" - target: "Source/{{Camel .Module.Name}}Editor/Public/{{Camel .Module.Name}}Editor.h" - - source: "module/Source/moduleeditor/Private/pluginnameeditor.cpp.tpl" - target: "Source/{{Camel .Module.Name}}Editor/Private/{{Camel .Module.Name}}Editor.cpp" - - source: "module/Source/moduleeditor/pluginnameeditor.Build.cs.tpl" - target: "Source/{{Camel .Module.Name}}Editor/{{Camel .Module.Name}}Editor.Build.cs" - - source: "module/Source/module/pluginname.Build.cs.tpl" - target: "Source/{{Camel .Module.Name}}/{{Camel .Module.Name}}.Build.cs" - - source: "module/Source/module/Public/pluginname.h.tpl" - target: "Source/{{Camel .Module.Name}}/Public/{{Camel .Module.Name}}.h" - - source: "module/Source/module/Private/pluginname.cpp.tpl" - target: "Source/{{Camel .Module.Name}}/Private/{{Camel .Module.Name}}.cpp" - - name: monitor - requires: - - api - - plugin - - apigear - scopes: - - match: module - prefix: "Plugins/{{Camel .Module.Name}}/" - documents: - - source: "module/Source/module/Private/Generated/Monitor/pluginfactory.h.tpl" - target: "Source/{{Camel .Module.Name}}/Private/Generated/Monitor/{{Camel .Module.Name}}Factory.h" - - source: "module/Source/module/Private/Generated/Monitor/pluginfactory.cpp.tpl" - target: "Source/{{Camel .Module.Name}}/Private/Generated/Monitor/{{Camel .Module.Name}}Factory.cpp" - - source: "module/Source/module/Private/Generated/api/json.adapter.h.tpl" - target: "Source/{{Camel .Module.Name}}/Private/Generated/api/{{Camel .Module.Name}}.json.adapter.h" - - source: "module/Source/module/Private/Generated/Monitor/trace.h.tpl" - target: "Source/{{Camel .Module.Name}}/Private/Generated/Monitor/{{Camel .Module.Name}}.trace.h" - - source: "module/Source/module/Private/Generated/Monitor/trace.cpp.tpl" - target: "Source/{{Camel .Module.Name}}/Private/Generated/Monitor/{{Camel .Module.Name}}.trace.cpp" - - match: interface - prefix: "Plugins/{{Camel .Module.Name}}/" - documents: - - source: "module/Source/module/Public/Generated/Monitor/loggingdecorator.h.tpl" - target: "Source/{{Camel .Module.Name}}/Public/Generated/Monitor/{{Camel .Module.Name}}{{Camel .Interface.Name}}LoggingDecorator.h" - - source: "module/Source/module/Private/Generated/Monitor/loggingdecorator.cpp.tpl" - target: "Source/{{Camel .Module.Name}}/Private/Generated/Monitor/{{Camel .Module.Name}}{{Camel .Interface.Name}}LoggingDecorator.cpp" - - name: olink - requires: - - api - - plugin - - apigear_olink - scopes: - - match: module - prefix: "Plugins/{{Camel .Module.Name}}/" - documents: - - source: "module/Source/module/Private/Generated/api/json.adapter.h.tpl" - target: "Source/{{Camel .Module.Name}}/Private/Generated/api/{{Camel .Module.Name}}.json.adapter.h" - - match: interface - prefix: "Plugins/{{Camel .Module.Name}}/" - documents: - - source: "module/Source/module/Public/Generated/OLink/olinkclient.h.tpl" - target: "Source/{{Camel .Module.Name}}/Public/Generated/OLink/{{Camel .Module.Name}}{{Camel .Interface.Name}}OLinkClient.h" - - source: "module/Source/module/Private/Generated/OLink/olinkclient.cpp.tpl" - target: "Source/{{Camel .Module.Name}}/Private/Generated/OLink/{{Camel .Module.Name}}{{Camel .Interface.Name}}OLinkClient.cpp" - - source: "module/Source/module/Public/Generated/OLink/olinkadapter.h.tpl" - target: "Source/{{Camel .Module.Name}}/Public/Generated/OLink/{{Camel .Module.Name}}{{Camel .Interface.Name}}OLinkAdapter.h" - - source: "module/Source/module/Private/Generated/OLink/olinkadapter.cpp.tpl" - target: "Source/{{Camel .Module.Name}}/Private/Generated/OLink/{{Camel .Module.Name}}{{Camel .Interface.Name}}OLinkAdapter.cpp" - - source: "module/Source/module/Private/Generated/OLink/olinksource.h.tpl" - target: "Source/{{Camel .Module.Name}}/Private/Generated/OLink/{{Camel .Module.Name}}{{Camel .Interface.Name}}OLinkSource.h" - - source: "module/Source/module/Private/Generated/OLink/olinksource.cpp.tpl" - target: "Source/{{Camel .Module.Name}}/Private/Generated/OLink/{{Camel .Module.Name}}{{Camel .Interface.Name}}OLinkSource.cpp" +engines: + cli: ">= v0.35.0" +features: + - name: api + scopes: + - match: module + prefix: "Plugins/{{Camel .Module.Name}}/Source/{{Camel .Module.Name}}/" + documents: + - source: "module/Source/module/Public/Generated/api/module.h.tpl" + target: "Public/Generated/api/{{Camel .Module.Name}}_apig.h" + - source: "module/Source/module/Public/Generated/api/data.h.tpl" + target: "Public/Generated/api/{{Camel .Module.Name}}_data.h" + - source: "module/Source/module/Private/Generated/api/data.cpp.tpl" + target: "Private/Generated/api/{{Camel .Module.Name}}_data.cpp" + - source: "module/Source/module/Private/Generated/LogCategories.h.tpl" + target: "Private/Generated/{{Camel .Module.Name}}LogCategories.h" + - source: "module/Source/module/Private/Generated/LogCategories.cpp.tpl" + target: "Private/Generated/{{Camel .Module.Name}}LogCategories.cpp" + - match: interface + prefix: "Plugins/{{Camel .Module.Name}}/Source/{{Camel .Module.Name}}/" + documents: + - source: "module/Source/module/Public/Generated/api/interface.h.tpl" + target: "Public/Generated/api/{{Camel .Module.Name}}{{Camel .Interface.Name}}Interface.h" + - source: "module/Source/module/Public/Generated/api/abstract.h.tpl" + target: "Public/Generated/api/Abstract{{Camel .Module.Name}}{{Camel .Interface.Name}}.h" + - source: "module/Source/module/Private/Generated/api/abstract.cpp.tpl" + target: "Private/Generated/api/Abstract{{Camel .Module.Name}}{{Camel .Interface.Name}}.cpp" + - name: apigear_olinkproto + scopes: + - match: system + prefix: "Plugins/ApiGear/Source/ThirdParty/OLinkProtocolLibrary/" + documents: + - source: "ApiGear/Source/ThirdParty/OLinkProtocolLibrary/OLinkProtocolLibrary.Build.cs" + target: "OLinkProtocolLibrary.Build.cs" + raw: true + - source: "ApiGear/Source/ThirdParty/OLinkProtocolLibrary/Private/OLinkProtocolLibraryModule.cpp" + target: "Private/OLinkProtocolLibraryModule.cpp" + raw: true + - source: "ApiGear/Source/ThirdParty/OLinkProtocolLibrary/Public/olink/clientnode.h" + target: "Public/olink/clientnode.h" + raw: true + - source: "ApiGear/Source/ThirdParty/OLinkProtocolLibrary/Private/clientnode.cpp" + target: "Private/clientnode.cpp" + raw: true + - source: "ApiGear/Source/ThirdParty/OLinkProtocolLibrary/Public/olink/clientregistry.h" + target: "Public/olink/clientregistry.h" + raw: true + - source: "ApiGear/Source/ThirdParty/OLinkProtocolLibrary/Private/clientregistry.cpp" + target: "Private/clientregistry.cpp" + raw: true + - source: "ApiGear/Source/ThirdParty/OLinkProtocolLibrary/Public/olink/core/basenode.h" + target: "Public/olink/core/basenode.h" + raw: true + - source: "ApiGear/Source/ThirdParty/OLinkProtocolLibrary/Private/core/basenode.cpp" + target: "Private/core/basenode.cpp" + raw: true + - source: "ApiGear/Source/ThirdParty/OLinkProtocolLibrary/Public/olink/remotenode.h" + target: "Public/olink/remotenode.h" + raw: true + - source: "ApiGear/Source/ThirdParty/OLinkProtocolLibrary/Public/olink/iremotenode.h" + target: "Public/olink/iremotenode.h" + raw: true + - source: "ApiGear/Source/ThirdParty/OLinkProtocolLibrary/Public/olink/remoteregistry.h" + target: "Public/olink/remoteregistry.h" + raw: true + - source: "ApiGear/Source/ThirdParty/OLinkProtocolLibrary/Private/remoteregistry.cpp" + target: "Private/remoteregistry.cpp" + raw: true + - source: "ApiGear/Source/ThirdParty/OLinkProtocolLibrary/Private/remotenode.cpp" + target: "Private/remotenode.cpp" + raw: true + - source: "ApiGear/Source/ThirdParty/OLinkProtocolLibrary/Public/olink/consolelogger.h" + target: "Public/olink/consolelogger.h" + raw: true + - source: "ApiGear/Source/ThirdParty/OLinkProtocolLibrary/Private/consolelogger.cpp" + target: "Private/consolelogger.cpp" + raw: true + - source: "ApiGear/Source/ThirdParty/OLinkProtocolLibrary/Public/olink/iclientnode.h" + target: "Public/olink/iclientnode.h" + raw: true + - source: "ApiGear/Source/ThirdParty/OLinkProtocolLibrary/Public/olink/core/protocol.h" + target: "Public/olink/core/protocol.h" + raw: true + - source: "ApiGear/Source/ThirdParty/OLinkProtocolLibrary/Private/core/protocol.cpp" + target: "Private/core/protocol.cpp" + raw: true + - source: "ApiGear/Source/ThirdParty/OLinkProtocolLibrary/Public/olink/core/olink_common.h" + target: "Public/olink/core/olink_common.h" + raw: true + - source: "ApiGear/Source/ThirdParty/OLinkProtocolLibrary/Public/olink/iobjectsink.h" + target: "Public/olink/iobjectsink.h" + raw: true + - source: "ApiGear/Source/ThirdParty/OLinkProtocolLibrary/Public/olink/iobjectsource.h" + target: "Public/olink/iobjectsource.h" + raw: true + - source: "ApiGear/Source/ThirdParty/OLinkProtocolLibrary/Public/olink/core/types.h" + target: "Public/olink/core/types.h" + raw: true + - source: "ApiGear/Source/ThirdParty/OLinkProtocolLibrary/Private/core/types.cpp" + target: "Private/core/types.cpp" + raw: true + - source: "ApiGear/Source/ThirdParty/OLinkProtocolLibrary/Public/olink/core/uniqueidobjectstorage.h" + target: "Public/olink/core/uniqueidobjectstorage.h" + raw: true + - name: apigear + requires: + - apigear_olink + scopes: + - match: system + prefix: "Plugins/ApiGear/" + documents: + - source: "ApiGear/Source/ApiGear/apigear.Build.cs" + target: "Source/ApiGear/apigear.Build.cs" + raw: true + - source: "ApiGear/apigear.uplugin" + target: "apigear.uplugin" + raw: true + - source: "ApiGear/Config/FilterPlugin.ini" + target: "Config/FilterPlugin.ini" + raw: true + - source: "ApiGear/Source/ApiGear/Public/tracer.h" + target: "Source/ApiGear/Public/tracer.h" + raw: true + - source: "ApiGear/Source/ApiGear/Private/tracer.cpp" + target: "Source/ApiGear/Private/tracer.cpp" + raw: true + - source: "ApiGear/Source/ApiGear/Public/apigear.h" + target: "Source/ApiGear/Public/apigear.h" + raw: true + - source: "ApiGear/Source/ApiGear/Public/ApiGearConnection.h" + target: "Source/ApiGear/Public/ApiGearConnection.h" + raw: true + - source: "ApiGear/Source/ApiGear/Public/AbstractApiGearConnection.h" + target: "Source/ApiGear/Public/AbstractApiGearConnection.h" + raw: true + - source: "ApiGear/Source/ApiGear/Private/AbstractApiGearConnection.cpp" + target: "Source/ApiGear/Private/AbstractApiGearConnection.cpp" + raw: true + - source: "ApiGear/Source/ApiGear/Public/ApiGearTicker.h" + target: "Source/ApiGear/Public/ApiGearTicker.h" + raw: true + - source: "ApiGear/Source/ApiGear/Public/ApiGearLogCategories.h" + target: "Source/ApiGear/Public/ApiGearLogCategories.h" + raw: true + - source: "ApiGear/Source/ApiGear/Private/ApiGearLogCategories.cpp" + target: "Source/ApiGear/Private/ApiGearLogCategories.cpp" + raw: true + - source: "ApiGear/Source/ApiGear/Public/apigear.json.adapter.h" + target: "Source/ApiGear/Public/apigear.json.adapter.h" + raw: true + - source: "ApiGear/Source/ApiGear/Private/apigear.cpp" + target: "Source/ApiGear/Private/apigear.cpp" + raw: true + - source: "ApiGear/Source/ApiGearEditor/Public/ApiGearEditor.h" + target: "Source/ApiGearEditor/Public/ApiGearEditor.h" + raw: true + - source: "ApiGear/Source/ApiGearEditor/Private/ApiGearEditor.cpp" + target: "Source/ApiGearEditor/Private/ApiGearEditor.cpp" + raw: true + - source: "ApiGear/Resources/Icon40.png" + target: "Resources/Icon40.png" + raw: true + - source: "ApiGear/Resources/Icon128.png" + target: "Resources/Icon128.png" + raw: true + - source: "ApiGear/Source/ApiGearEditor/Public/ApiGearEditorStyle.h" + target: "Source/ApiGearEditor/Public/ApiGearEditorStyle.h" + raw: true + - source: "ApiGear/Source/ApiGearEditor/Private/ApiGearEditorStyle.cpp" + target: "Source/ApiGearEditor/Private/ApiGearEditorStyle.cpp" + raw: true + - source: "ApiGear/Source/ApiGearEditor/Public/ApiGearEditorCommands.h" + target: "Source/ApiGearEditor/Public/ApiGearEditorCommands.h" + raw: true + - source: "ApiGear/Source/ApiGearEditor/Private/ApiGearEditorCommands.cpp" + target: "Source/ApiGearEditor/Private/ApiGearEditorCommands.cpp" + raw: true + - source: "ApiGear/Source/ApiGear/Public/ApiGearSettings.h" + target: "Source/ApiGear/Public/ApiGearSettings.h" + raw: true + - source: "ApiGear/Source/ApiGear/Private/ApiGearSettings.cpp" + target: "Source/ApiGear/Private/ApiGearSettings.cpp" + raw: true + - source: "ApiGear/Source/ApiGear/Public/ApiGearConnectionsStore.h" + target: "Source/ApiGear/Public/ApiGearConnectionsStore.h" + raw: true + - source: "ApiGear/Source/ApiGear/Private/ApiGearConnectionsStore.cpp" + target: "Source/ApiGear/Private/ApiGearConnectionsStore.cpp" + raw: true + - source: "ApiGear/Source/ApiGearEditor/ApiGearEditor.Build.cs" + target: "Source/ApiGearEditor/ApiGearEditor.Build.cs" + raw: true + - source: "ApiGear/Source/ThirdParty/nlohmannJsonLibrary/nlohmannJsonLibrary.Build.cs" + target: "Source/ThirdParty/nlohmannJsonLibrary/nlohmannJsonLibrary.Build.cs" + raw: true + - source: "ApiGear/Source/ThirdParty/nlohmannJsonLibrary/Public/nlohmann/json.hpp" + target: "Source/ThirdParty/nlohmannJsonLibrary/Public/nlohmann/json.hpp" + raw: true + - name: apigear_olink + requires: + - apigear_olinkproto + scopes: + - match: system + prefix: "Plugins/ApiGear/" + documents: + - source: "ApiGear/Source/ApiGearOLink/apigearolink.Build.cs" + target: "Source/ApiGearOLink/apigearolink.Build.cs" + raw: true + - source: "ApiGear/Source/ApiGearOLink/Public/apigearolink.h" + target: "Source/ApiGearOLink/Public/apigearolink.h" + raw: true + - source: "ApiGear/Source/ApiGearOLink/Private/apigearolink.cpp" + target: "Source/ApiGearOLink/Private/apigearolink.cpp" + raw: true + - source: "ApiGear/Source/ApiGearOLink/Private/unrealolink.cpp" + target: "Source/ApiGearOLink/Private/unrealolink.cpp" + raw: true + - source: "ApiGear/Source/ApiGearOLink/Public/unrealolink.h" + target: "Source/ApiGearOLink/Public/unrealolink.h" + raw: true + - source: "ApiGear/Source/ApiGearOLink/Private/unrealolinksink.cpp" + target: "Source/ApiGearOLink/Private/unrealolinksink.cpp" + raw: true + - source: "ApiGear/Source/ApiGearOLink/Public/unrealolinksink.h" + target: "Source/ApiGearOLink/Public/unrealolinksink.h" + raw: true + - source: "ApiGear/Source/ApiGearOLink/Private/UnrealOLinkHost.cpp" + target: "Source/ApiGearOLink/Private/UnrealOLinkHost.cpp" + raw: true + - source: "ApiGear/Source/ApiGearOLink/Public/UnrealOLinkHost.h" + target: "Source/ApiGearOLink/Public/UnrealOLinkHost.h" + raw: true + - source: "ApiGear/Source/ApiGearOLink/Private/OLinkHostConnection.h" + target: "Source/ApiGearOLink/Private/OLinkHostConnection.h" + raw: true + - source: "ApiGear/Source/ApiGearOLink/Private/OLinkHostConnection.cpp" + target: "Source/ApiGearOLink/Private/OLinkHostConnection.cpp" + raw: true + - source: "ApiGear/Source/ApiGearOLink/Private/OLinkHostPrivate.h" + target: "Source/ApiGearOLink/Private/OLinkHostPrivate.h" + raw: true + - source: "ApiGear/Source/ApiGearOLink/Private/OLinkHostPrivate.cpp" + target: "Source/ApiGearOLink/Private/OLinkHostPrivate.cpp" + raw: true + - name: stubs + requires: + - api + scopes: + - match: module + prefix: "Plugins/{{Camel .Module.Name}}/" + documents: + - source: "module/Source/module/Private/Tests/testbase.h.tpl" + target: "Source/{{Camel .Module.Name}}/Private/Tests/{{Camel .Module.Name}}TestBase.h" + preserve: true + - match: interface + prefix: "Plugins/{{Camel .Module.Name}}/" + documents: + - source: "module/Source/module/Public/Implementation/implementation.h.tpl" + target: "Source/{{Camel .Module.Name}}/Public/Implementation/{{Camel .Module.Name}}{{Camel .Interface.Name}}.h" + preserve: true + - source: "module/Source/module/Private/Implementation/implementation.cpp.tpl" + target: "Source/{{Camel .Module.Name}}/Private/Implementation/{{Camel .Module.Name}}{{Camel .Interface.Name}}.cpp" + preserve: true + - source: "module/Source/module/Private/Tests/implementationtest.cpp.tpl" + target: "Source/{{Camel .Module.Name}}/Private/Tests/{{Camel .Module.Name}}{{Camel .Interface.Name}}Tests.cpp" + preserve: true + - name: plugin + scopes: + - match: system + documents: + - source: "buildPlugins.bat.tpl" + target: "buildPlugins.bat" + - source: "buildPlugins.sh.tpl" + target: "buildPlugins.sh" + - match: module + prefix: "Plugins/{{Camel .Module.Name}}/" + documents: + - source: "module/Config/FilterPlugin.ini" + target: "Config/FilterPlugin.ini" + raw: true + - source: "module/Source/module/pluginname.uplugin.tpl" + target: "{{Camel .Module.Name}}.uplugin" + - source: "module/Source/module/Public/pluginnamesettings.h.tpl" + target: "Source/{{Camel .Module.Name}}/Public/{{Camel .Module.Name}}Settings.h" + - source: "module/Source/module/Private/pluginnamesettings.cpp.tpl" + target: "Source/{{Camel .Module.Name}}/Private/{{Camel .Module.Name}}Settings.cpp" + - source: "module/Source/moduleeditor/Public/pluginnameconnectionsettings.h.tpl" + target: "Source/{{Camel .Module.Name}}Editor/Public/{{Camel .Module.Name}}ConnectionSettings.h" + - source: "module/Source/moduleeditor/Private/pluginnameconnectionsettings.cpp.tpl" + target: "Source/{{Camel .Module.Name}}Editor/Private/{{Camel .Module.Name}}ConnectionSettings.cpp" + - source: "module/Source/moduleeditor/Public/pluginnameeditor.h.tpl" + target: "Source/{{Camel .Module.Name}}Editor/Public/{{Camel .Module.Name}}Editor.h" + - source: "module/Source/moduleeditor/Private/pluginnameeditor.cpp.tpl" + target: "Source/{{Camel .Module.Name}}Editor/Private/{{Camel .Module.Name}}Editor.cpp" + - source: "module/Source/moduleeditor/pluginnameeditor.Build.cs.tpl" + target: "Source/{{Camel .Module.Name}}Editor/{{Camel .Module.Name}}Editor.Build.cs" + - source: "module/Source/module/pluginname.Build.cs.tpl" + target: "Source/{{Camel .Module.Name}}/{{Camel .Module.Name}}.Build.cs" + - source: "module/Source/module/Public/pluginname.h.tpl" + target: "Source/{{Camel .Module.Name}}/Public/{{Camel .Module.Name}}.h" + - source: "module/Source/module/Private/pluginname.cpp.tpl" + target: "Source/{{Camel .Module.Name}}/Private/{{Camel .Module.Name}}.cpp" + - name: monitor + requires: + - api + - plugin + - apigear + scopes: + - match: module + prefix: "Plugins/{{Camel .Module.Name}}/" + documents: + - source: "module/Source/module/Private/Generated/Monitor/pluginfactory.h.tpl" + target: "Source/{{Camel .Module.Name}}/Private/Generated/Monitor/{{Camel .Module.Name}}Factory.h" + - source: "module/Source/module/Private/Generated/Monitor/pluginfactory.cpp.tpl" + target: "Source/{{Camel .Module.Name}}/Private/Generated/Monitor/{{Camel .Module.Name}}Factory.cpp" + - source: "module/Source/module/Private/Generated/api/json.adapter.h.tpl" + target: "Source/{{Camel .Module.Name}}/Private/Generated/api/{{Camel .Module.Name}}.json.adapter.h" + - source: "module/Source/module/Private/Generated/Monitor/trace.h.tpl" + target: "Source/{{Camel .Module.Name}}/Private/Generated/Monitor/{{Camel .Module.Name}}.trace.h" + - source: "module/Source/module/Private/Generated/Monitor/trace.cpp.tpl" + target: "Source/{{Camel .Module.Name}}/Private/Generated/Monitor/{{Camel .Module.Name}}.trace.cpp" + - match: interface + prefix: "Plugins/{{Camel .Module.Name}}/" + documents: + - source: "module/Source/module/Public/Generated/Monitor/loggingdecorator.h.tpl" + target: "Source/{{Camel .Module.Name}}/Public/Generated/Monitor/{{Camel .Module.Name}}{{Camel .Interface.Name}}LoggingDecorator.h" + - source: "module/Source/module/Private/Generated/Monitor/loggingdecorator.cpp.tpl" + target: "Source/{{Camel .Module.Name}}/Private/Generated/Monitor/{{Camel .Module.Name}}{{Camel .Interface.Name}}LoggingDecorator.cpp" + - name: olink + requires: + - api + - plugin + - apigear_olink + scopes: + - match: module + prefix: "Plugins/{{Camel .Module.Name}}/" + documents: + - source: "module/Source/module/Private/Generated/api/json.adapter.h.tpl" + target: "Source/{{Camel .Module.Name}}/Private/Generated/api/{{Camel .Module.Name}}.json.adapter.h" + - match: interface + prefix: "Plugins/{{Camel .Module.Name}}/" + documents: + - source: "module/Source/module/Public/Generated/OLink/olinkclient.h.tpl" + target: "Source/{{Camel .Module.Name}}/Public/Generated/OLink/{{Camel .Module.Name}}{{Camel .Interface.Name}}OLinkClient.h" + - source: "module/Source/module/Private/Generated/OLink/olinkclient.cpp.tpl" + target: "Source/{{Camel .Module.Name}}/Private/Generated/OLink/{{Camel .Module.Name}}{{Camel .Interface.Name}}OLinkClient.cpp" + - source: "module/Source/module/Public/Generated/OLink/olinkadapter.h.tpl" + target: "Source/{{Camel .Module.Name}}/Public/Generated/OLink/{{Camel .Module.Name}}{{Camel .Interface.Name}}OLinkAdapter.h" + - source: "module/Source/module/Private/Generated/OLink/olinkadapter.cpp.tpl" + target: "Source/{{Camel .Module.Name}}/Private/Generated/OLink/{{Camel .Module.Name}}{{Camel .Interface.Name}}OLinkAdapter.cpp" + - source: "module/Source/module/Private/Generated/OLink/olinksource.h.tpl" + target: "Source/{{Camel .Module.Name}}/Private/Generated/OLink/{{Camel .Module.Name}}{{Camel .Interface.Name}}OLinkSource.h" + - source: "module/Source/module/Private/Generated/OLink/olinksource.cpp.tpl" + target: "Source/{{Camel .Module.Name}}/Private/Generated/OLink/{{Camel .Module.Name}}{{Camel .Interface.Name}}OLinkSource.cpp" diff --git a/templates/ApiGear/Source/ApiGear/Public/AbstractApiGearConnection.h b/templates/ApiGear/Source/ApiGear/Public/AbstractApiGearConnection.h index 1fbd49a64..945dcfe5d 100644 --- a/templates/ApiGear/Source/ApiGear/Public/AbstractApiGearConnection.h +++ b/templates/ApiGear/Source/ApiGear/Public/AbstractApiGearConnection.h @@ -8,8 +8,10 @@ #include "AbstractApiGearConnection.generated.h" /** - * @brief Abstract base for IApiGearConnection implementation - * Implements state management and handles common reconnection functionality. Exposes delegates. + * Abstract base for IApiGearConnection implementation. + * Handles common reconnection functionality. + * Keeps the connection state updated. + * Exposes delegates for getting notifications of the connection state. * Does not add the actual connection handling - it needs to be implemented by the final connection. */ UCLASS(Abstract, NotBlueprintable) @@ -19,6 +21,7 @@ class APIGEAR_API UAbstractApiGearConnection : public UObject, public IApiGearCo public: explicit UAbstractApiGearConnection(const FObjectInitializer& ObjectInitializer); + FApiGearConnectionIsConnectedDelegate& GetIsConnectedChangedDelegate() override; FApiGearConnectionStateChangedDelegate& GetConnectionStateChangedDelegate() override; @@ -29,6 +32,8 @@ class APIGEAR_API UAbstractApiGearConnection : public UObject, public IApiGearCo void OnDisconnected(bool bReconnect) final; void Connect() final; void Disconnect() final; + + /* Use this function to block AutoReconnect behavior temporarily until the connection is disconnected. */ void StopReconnecting() override; bool IsConnected() PURE_VIRTUAL(UAbstractApiGearConnection::IsConnected, return false;); @@ -43,19 +48,39 @@ class APIGEAR_API UAbstractApiGearConnection : public UObject, public IApiGearCo private: void SetConnectionState(EApiGearConnectionState State); + /** + * Implement in derived class to provide actual logic specific for your connection for when network connection is established. + * Should not be used directly, instead use OnConnected(). + */ virtual void OnConnected_Implementation() PURE_VIRTUAL(UAbstractApiGearConnection::OnConnected_Implementation, ); + /** + * Implement in derived class to provide actual logic specific for your connection for when the network connection is over + * Should not be used directly, instead use OnDisonnected(). + */ virtual void OnDisconnected_Implementation(bool bReconnect) PURE_VIRTUAL(UAbstractApiGearConnection::OnDisconnected_Implementation, ); + /** + * Implement in derived class to provide actual logic specific for your connection to establish a connection + * Should not be used directly, instead use Connect(). + */ virtual void Connect_Implementation() PURE_VIRTUAL(UAbstractApiGearConnection::Connect_Implementation, ); + /** + * Implement in derived class to provide actual logic specific for your connection to close connection + * Should not be used directly, instead use Disconnect(). + */ virtual void Disconnect_Implementation() PURE_VIRTUAL(UAbstractApiGearConnection::Disconnect_Implementation, ); FApiGearConnectionIsConnectedDelegate IsConnectedChanged; FApiGearConnectionStateChangedDelegate ConnectionStateChanged; + /** If set to true, the connection if not running will try to reconnect with a time interval, until succeeded */ bool bIsAutoReconnectEnabled; + /** Used when the bIsAutoReconnectEnabled is on but reconnection functionality needs to be temporarily stop for disconnecting. */ bool bStopReconnectingRequested; + /** Reconnection timer*/ ApiGear::FDelegateHandle RetryTickerHandle; + /** Reconnection timer delegate*/ FTickerDelegate RetryTickerDelegate; EApiGearConnectionState ConnectionState; diff --git a/templates/ApiGear/Source/ApiGear/Public/ApiGearConnection.h b/templates/ApiGear/Source/ApiGear/Public/ApiGearConnection.h index eb5e189a1..99a0ae547 100644 --- a/templates/ApiGear/Source/ApiGear/Public/ApiGearConnection.h +++ b/templates/ApiGear/Source/ApiGear/Public/ApiGearConnection.h @@ -18,12 +18,12 @@ enum class EApiGearConnectionState : uint8 Connected UMETA(Displayname = "Connected") }; -/// Used when Network Layer Connection changes its state to connected(true) or any other connection state (false). +/** Used when Network Layer Connection changes its state to connected(true) or any other connection state(false). */ DECLARE_MULTICAST_DELEGATE_OneParam(FApiGearConnectionIsConnectedDelegate, bool); -/// Used when Network Layer Connection changes its state. +/** Used when Network Layer Connection changes its state. */ DECLARE_MULTICAST_DELEGATE_OneParam(FApiGearConnectionStateChangedDelegate, EApiGearConnectionState); /** - * @brief Used when the interface client changes its subscription status: + * Used when the interface client changes its subscription status: * either is plugged in the network and ready to use with protocol of your choice (true) * or it won't be able to properly communicate with server side (false). * An established network connection (ConnectionIsConnectedDelegate with true parameter) is often necessary, but not sufficient (depending on your setup and used protocol) @@ -32,11 +32,12 @@ DECLARE_MULTICAST_DELEGATE_OneParam(FApiGearConnectionStateChangedDelegate, EApi DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FApiGearRemoteApiSubscriptionStatusChangedDelegate, bool, IsSubscribed); /** - * @brief An interface for all connections meant to be used by ApiGear + * An interface for all connections meant to be used by ApiGear * ensures all connections have: * - settings for reconnection * - current state * - general state and settings accessors + * @see AbstractApiGearConnection for implementation of common functionality. */ UINTERFACE(MinimalAPI, meta = (CannotImplementInterfaceInBlueprint)) class UApiGearConnection : public UInterface @@ -49,26 +50,42 @@ class APIGEAR_API IApiGearConnection GENERATED_BODY() public: + /** Returns a delegate for notifications informing whether connection is ready to use + * @see ApiGearConnectionIsConnectedDelegate + */ virtual FApiGearConnectionIsConnectedDelegate& GetIsConnectedChangedDelegate() = 0; + /** Returns a delegate for notifications informing about the connection state. + * @see FApiGearConnectionStateChangedDelegate + */ virtual FApiGearConnectionStateChangedDelegate& GetConnectionStateChangedDelegate() = 0; UFUNCTION(BlueprintCallable, Category = "ApiGear|Connection") virtual void Configure(FString InServerURL, bool bInAutoReconnectEnabled) = 0; UFUNCTION(BlueprintCallable, Category = "ApiGear|Connection") + /** Call this function to request connection to be established */ virtual void Connect() = 0; UFUNCTION(BlueprintCallable, Category = "ApiGear|Connection") + /** A callback for when the network connection is established, + * Use to finalize connect related actions in the implemented connection, + * For notifications on when connection is disconnected use GetIsConnectedChangedDelegate or ApiGearConnectionStateChangedDelegate. + */ virtual void OnConnected() = 0; UFUNCTION(BlueprintCallable, Category = "ApiGear|Connection") + /** Call this function to request closing connection. */ virtual void Disconnect() = 0; UFUNCTION(BlueprintCallable, Category = "ApiGear|Connection") + /** A callback for when the network connection has closed, + * use to finalize disconnect-related actions in the implemented connection. + * For notifications on when connection is disconnected use GetIsConnectedChangedDelegate or ApiGearConnectionStateChangedDelegate. + */ virtual void OnDisconnected(bool bReconnect) = 0; UFUNCTION(BlueprintCallable, Category = "ApiGear|Connection") virtual bool IsConnected() = 0; UFUNCTION(BlueprintCallable, Category = "ApiGear|Connection") virtual void StopReconnecting() = 0; - /** Returns the endpoint identifier for this connection, e.g. simulation or phone_service */ + /** Returns the endpoint identifier for this connection, e.g. simulation or phone_service*/ UFUNCTION(BlueprintCallable, Category = "ApiGear|Connection") virtual FString GetUniqueEndpointIdentifier() const = 0; @@ -76,7 +93,7 @@ class APIGEAR_API IApiGearConnection UFUNCTION(BlueprintCallable, Category = "ApiGear|Connection") virtual FString GetServerURL() const = 0; - /** Returns the type identifier for this connection, e.g. olink */ + /** Returns the identifier of protocol used for this connection, e.g. olink */ UFUNCTION(BlueprintCallable, Category = "ApiGear|Connection") virtual FString GetConnectionProtocolIdentifier() const = 0; diff --git a/templates/ApiGear/Source/ApiGear/Public/ApiGearConnectionsStore.h b/templates/ApiGear/Source/ApiGear/Public/ApiGearConnectionsStore.h index 3c190bfcb..659968021 100644 --- a/templates/ApiGear/Source/ApiGear/Public/ApiGearConnectionsStore.h +++ b/templates/ApiGear/Source/ApiGear/Public/ApiGearConnectionsStore.h @@ -13,12 +13,13 @@ APIGEAR_API DECLARE_LOG_CATEGORY_EXTERN(LogApiGearConnectionsStore, Log, All); /** - * Implements the connections store for the ApiGear plugin. + * Creates and stores connections based on configured connections in settings. + * @see ApiGearSettings * - * Can handle all connections which inherit from the IApiGearConnection interface. - * To register your own protocol, you need to call RegisterConnectionFactory - * before this class/module is initialized. The ApiGearOLink module is an example - * how this can be done. + * Handles all connections which inherit from the IApiGearConnection interface. + * @warning For custom protocols make sure you've registered your own protocol factory with a RegisterConnectionFactory. + * before this class/module is initialized. + * You may use implemented ApiGearOLink module as an example. */ UCLASS(BlueprintType) class APIGEAR_API UApiGearConnectionsStore : public UEngineSubsystem @@ -30,7 +31,11 @@ class APIGEAR_API UApiGearConnectionsStore : public UEngineSubsystem /** A type of function for creating connections*/ using FConnectionFactoryFunction = TFunction(UObject*, FString)>; - /** register factories for different types of connections */ + /** + * Register custom factories of connections. + * This function must be called before this class or module are initialized. + * @see ApiGearOLink. + */ static bool RegisterConnectionFactory(FString ConnectionTypeIdentifier, FConnectionFactoryFunction FactoryFunction); // USubssystem functions @@ -62,6 +67,7 @@ class APIGEAR_API UApiGearConnectionsStore : public UEngineSubsystem UFUNCTION(BlueprintCallable, Category = "ApiGear|ConnectionsStore") TArray GetAvailableProtocols() const; + /** Replaces ApiGear plugin settings configured for the project with all currently added connections. */ UFUNCTION(BlueprintCallable, Category = "ApiGear|ConnectionsStore") void OverwriteAndSaveConnectionsToSettings() const; diff --git a/templates/ApiGear/Source/ApiGear/Public/ApiGearSettings.h b/templates/ApiGear/Source/ApiGear/Public/ApiGearSettings.h index aec7813bc..405b1009f 100644 --- a/templates/ApiGear/Source/ApiGear/Public/ApiGearSettings.h +++ b/templates/ApiGear/Source/ApiGear/Public/ApiGearSettings.h @@ -7,7 +7,7 @@ #include "Engine/EngineTypes.h" #include "ApiGearSettings.generated.h" -/** Settings per connection for ApiGear plugins */ +/** Settings for a connection in ApiGear plugins */ USTRUCT() struct FApiGearConnectionSetting { @@ -19,23 +19,36 @@ struct FApiGearConnectionSetting */ FString ProtocolIdentifier{"olink"}; - /** Choose the server to connect to */ + /** + * Choose the server to connect to + * this is a full address with a port + * It will be used "as is", so if you need any pre or post fixes like + * "ws://" make sure the field contains it. + */ UPROPERTY(EditAnywhere, config, Category = ApiGearConnectionSetting) FString URL{TEXT("ws://127.0.0.1:8000/ws")}; - /** Choose whether to automatically reconnect */ + /** Enable reconnect functionality for connection, also automatically starts the connection for the first time */ UPROPERTY(EditAnywhere, config, Category = ApiGearConnectionSetting) bool AutoReconnectEnabled{false}; }; /** - * Implements the settings for the ApiGear plugin. + * Stores settings for each connection and other network related settings for ApiGear plugin. + * For each connection settings a connections is created by ApiGearConnectionsStore on startup, + * For other custom protocols make sure that a factory for it is added to ApiGearConnectionsStore. + * @see ApiGearConnectionsStore */ UCLASS(Config = Engine, DefaultConfig) class APIGEAR_API UApiGearSettings : public UObject { GENERATED_UCLASS_BODY() - /** Choose the server to connect to */ + /** + * Url of tracer server to connect to. + * This is a full address with a port + * It will be used "as is", so if you need any pre or post fixes like + * "ws://" make sure the field contains it. + */ UPROPERTY(EditAnywhere, config, Category = TracerSetup, meta = (ConfigRestartRequired = true)) FString Tracer_URL; @@ -47,15 +60,20 @@ class APIGEAR_API UApiGearSettings : public UObject UPROPERTY(EditAnywhere, config, Category = TracerSetup, meta = (ConfigRestartRequired = true)) bool Tracer_EnableDebugLog; - /** Save and overwrite runtime modifications to the connections on exit */ + /** + * Save and overwrite runtime modifications to the connections on exit. + * The property is checked on exit. + * If set to false, all the changes (compared with the startup) will be lost, even if it was set to true during application lifetime. + * You still can save current settings state during editing regardless of this property with a ApiGearConnectionsStore::OverwriteAndSaveConnectionsToSettings function. + */ UPROPERTY(EditAnywhere, config, Category = ConnectionSetup, meta = (ConfigRestartRequired = true, Display = "Use runtime changes instead of settings")) bool bSaveRuntimeEdit; - // Automatically start + /** Automatically starts the Hosted OLink Server. */ UPROPERTY(EditAnywhere, config, Category = OLinkHostSetup) bool OLINK_AutoStart; - // On which Port to listen + /** Port on which Hosted OLink Server is listening.*/ UPROPERTY(EditAnywhere, config, Category = OLinkHostSetup) uint32 OLINK_Port; diff --git a/templates/ApiGear/Source/ApiGear/Public/ApiGearTicker.h b/templates/ApiGear/Source/ApiGear/Public/ApiGearTicker.h index dcdde7604..ffb855b82 100644 --- a/templates/ApiGear/Source/ApiGear/Public/ApiGearTicker.h +++ b/templates/ApiGear/Source/ApiGear/Public/ApiGearTicker.h @@ -4,6 +4,7 @@ #include "Runtime/Launch/Resources/Version.h" #include "Containers/Ticker.h" +/** This is a a helper file to provide version independent ticker functionality */ namespace ApiGear { #if (ENGINE_MAJOR_VERSION >= 5) diff --git a/templates/ApiGear/Source/ApiGear/Public/apigear.json.adapter.h b/templates/ApiGear/Source/ApiGear/Public/apigear.json.adapter.h index 9529ff12e..446300d97 100644 --- a/templates/ApiGear/Source/ApiGear/Public/apigear.json.adapter.h +++ b/templates/ApiGear/Source/ApiGear/Public/apigear.json.adapter.h @@ -8,16 +8,40 @@ #define JSON_NOEXCEPTION 1 #include +/** + * Converts json formated data into FString. + * The functions signature must follow the nlohmann from_jason function rules. + * It is automatically called in usage j.get(); + * @param j an input json formated data + * @param p FString that will be filled with data from j. + * In case data is malformed or not convertible to FString the function will throw. + */ static void from_json(const nlohmann::json& j, FString& p) { p = FString(UTF8_TO_TCHAR(j.get().c_str())); } +/** + * Converts FString into json formated data. + * The functions signature must follow the nlohmann to_json function rules. + * It is automatically called in usage j = p; + * @param j a json type data that will be filled with data from p + * @param p an input from which json data will be filled. + */ static void to_json(nlohmann::json& j, const FString& value) { j = TCHAR_TO_UTF8(*value); } +/** + * Converts json formated data into TArray of T type elements. + * The T type needs to be either std type or have its from_json function. + * The functions signature must follow the nlohmann from_jason function rules. + * It is automatically called in usage j.get>(); + * @param j an input json formated data + * @param p FString that will be filled with data from j. + * In case data is malformed or not convertible to FString the function will throw. + */ template void from_json(const nlohmann::json& j, TArray& p) { @@ -29,6 +53,14 @@ void from_json(const nlohmann::json& j, TArray& p) } } +/** + * Converts TArray of T type elements into json formated data. + * The T type needs to be either std type or have its to_json function. + * The functions signature must follow the nlohmann to_json function rules. + * It is automatically called in usage j = p; + * @param j a json type data that will be filled with data from p + * @param p an input from which json data will be filled. + */ template void to_json(nlohmann::json& j, const TArray& p) { diff --git a/templates/ApiGear/Source/ApiGearOLink/Public/unrealolink.h b/templates/ApiGear/Source/ApiGearOLink/Public/unrealolink.h index 00f2fb317..a2dfbb0d2 100644 --- a/templates/ApiGear/Source/ApiGearOLink/Public/unrealolink.h +++ b/templates/ApiGear/Source/ApiGearOLink/Public/unrealolink.h @@ -1,93 +1,93 @@ -#pragma once - -#include "AbstractApiGearConnection.h" -#include "apigearolink.h" -THIRD_PARTY_INCLUDES_START -#include "olink/clientnode.h" -#include "olink/clientregistry.h" -THIRD_PARTY_INCLUDES_END -#include "WebSocketsModule.h" -#include "IWebSocket.h" -#include "Containers/Queue.h" -#include "HAL/CriticalSection.h" -#include "ApiGearTicker.h" -#include "unrealolink.generated.h" - -DECLARE_LOG_CATEGORY_EXTERN(LogApiGearOLink, Log, All); - -class APIGEAROLINK_API OLinkFactory -{ -public: - static TScriptInterface Create(UObject* Outer, FString UniqueConnectionIdentifier); -}; - -UCLASS(BlueprintType, Displayname = "ApiGear ObjectLink Connection", Category = "ApiGear|Connection") -class APIGEAROLINK_API UUnrealOLink final : public UAbstractApiGearConnection -{ - GENERATED_BODY() -public: - explicit UUnrealOLink(const FObjectInitializer& ObjectInitializer); - virtual ~UUnrealOLink(); - - void Configure(FString InServerURL, bool bInAutoReconnectEnabled) override; - - void log(const FString& logMessage); - void handleTextMessage(const std::string& message); - - void linkObjectSource(const std::string& name); - void unlinkObjectSource(const std::string& name); - - // UAbstractApiGearConnection - void Connect_Implementation() final; - void Disconnect_Implementation() final; - void OnConnected_Implementation() final; - void OnDisconnected_Implementation(bool bReconnect) final; - bool IsConnected() override; - - /** Returns the endpoint identifier for this connection, e.g. ip:port or #connID */ - FString GetUniqueEndpointIdentifier() const override; - FString GetConnectionProtocolIdentifier() const override - { - return ApiGearOLinkProtocolIdentifier; - }; - - std::shared_ptr node() - { - return m_node; - }; - - FString GetServerURL() const override - { - return m_serverURL; - }; - -private: - bool bInitialized = false; - void open(const FString& url); - /* - * Helper method for sending messages, should be used from one thread, here achieved with scheduling task to main thread. - * see m_processMessageTaskTimerHandle - */ - void processMessages(); - /* - * Sends queued messages - * Uses m_flushMessagesMutex, to ensure it called only once at one time. - * It is not thread safe function - uses a m_socket and m_queue which are not guarded separately across the UUnrealOLink - */ - void flushMessages(); - - TArray ListLinkedObjects; - - DEFINE_LOG_CATEGORY(LogApiGearOLink); - - // Delegate handle for scheduled process message task - ApiGear::FDelegateHandle m_processMessageTaskTimerHandle; - - TSharedPtr m_socket; - FString m_serverURL; - ApiGear::ObjectLink::ClientRegistry m_registry; - std::shared_ptr m_node; - TQueue m_queue; - // Mutex for flushMessages(). - FCriticalSection m_flushMessagesMutex; -}; +#pragma once + +#include "AbstractApiGearConnection.h" +#include "apigearolink.h" +THIRD_PARTY_INCLUDES_START +#include "olink/clientnode.h" +#include "olink/clientregistry.h" +THIRD_PARTY_INCLUDES_END +#include "WebSocketsModule.h" +#include "IWebSocket.h" +#include "Containers/Queue.h" +#include "HAL/CriticalSection.h" +#include "ApiGearTicker.h" +#include "unrealolink.generated.h" + +DECLARE_LOG_CATEGORY_EXTERN(LogApiGearOLink, Log, All); + +class APIGEAROLINK_API OLinkFactory +{ +public: + static TScriptInterface Create(UObject* Outer, FString UniqueConnectionIdentifier); +}; + +UCLASS(BlueprintType, Displayname = "ApiGear ObjectLink Connection", Category = "ApiGear|Connection") +class APIGEAROLINK_API UUnrealOLink final : public UAbstractApiGearConnection +{ + GENERATED_BODY() +public: + explicit UUnrealOLink(const FObjectInitializer& ObjectInitializer); + virtual ~UUnrealOLink(); + + void Configure(FString InServerURL, bool bInAutoReconnectEnabled) override; + + void log(const FString& logMessage); + void handleTextMessage(const std::string& message); + + void linkObjectSource(const std::string& name); + void unlinkObjectSource(const std::string& name); + + // UAbstractApiGearConnection + void Connect_Implementation() final; + void Disconnect_Implementation() final; + void OnConnected_Implementation() final; + void OnDisconnected_Implementation(bool bReconnect) final; + bool IsConnected() override; + + /** Returns the endpoint identifier for this connection, e.g. ip:port or #connID */ + FString GetUniqueEndpointIdentifier() const override; + FString GetConnectionProtocolIdentifier() const override + { + return ApiGearOLinkProtocolIdentifier; + }; + + std::shared_ptr node() + { + return m_node; + }; + + FString GetServerURL() const override + { + return m_serverURL; + }; + +private: + bool bInitialized = false; + void open(const FString& url); + /* + * Helper method for sending messages, should be used from one thread, here achieved with scheduling task to main thread. + * see m_processMessageTaskTimerHandle + */ + void processMessages(); + /* + * Sends queued messages + * Uses m_flushMessagesMutex, to ensure it called only once at one time. + * It is not thread safe function - uses a m_socket and m_queue which are not guarded separately across the UUnrealOLink + */ + void flushMessages(); + + TArray ListLinkedObjects; + + DEFINE_LOG_CATEGORY(LogApiGearOLink); + + // Delegate handle for scheduled process message task + ApiGear::FDelegateHandle m_processMessageTaskTimerHandle; + + TSharedPtr m_socket; + FString m_serverURL; + ApiGear::ObjectLink::ClientRegistry m_registry; + std::shared_ptr m_node; + TQueue m_queue; + // Mutex for flushMessages(). + FCriticalSection m_flushMessagesMutex; +};