You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
* Multicast delegate Add* calls now return FDelegateHandles, and Remove* calls are now all deprecated, except for a new Remove function which takes a FDelegateHandle. * New FConsoleManager::RegisterConsoleVariableSink_Handle and UnregisterConsoleVariableSink_Handle functions which work in terms of FConsoleVariableSinkHandle. * Timer calls which don't take FTimerHandles are deprecated. * FTicker::AddTicker now returns an FDelegateHandle and is removed by an overloaded Remove function. * DEFINE_ONLINE_DELEGATE* macros now define _Handle variants of the Add/Remove functions which return/take handles. * Various other handle-based registration changes. * Some unity build fixes. * Some simplification of delegate code. * Fixes for lots of existing code to use handle-based registration and unregistration. #codereview robert.manuszewski [CL 2400883 by Steve Robb in Main branch]
81 lines
2.3 KiB
C++
81 lines
2.3 KiB
C++
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
|
|
|
|
#pragma once
|
|
|
|
|
|
/**
|
|
* Implements a class which locates devices based on criteria for use in the Launcher.
|
|
*/
|
|
class FTargetDeviceProxyManager
|
|
: public ITargetDeviceProxyManager
|
|
{
|
|
public:
|
|
|
|
/** Default constructor. */
|
|
FTargetDeviceProxyManager();
|
|
|
|
/** Destructor. */
|
|
virtual ~FTargetDeviceProxyManager();
|
|
|
|
public:
|
|
|
|
// ITargetDeviceProxyLocator interface
|
|
|
|
virtual ITargetDeviceProxyRef FindOrAddProxy(const FString& Name) override;
|
|
virtual ITargetDeviceProxyPtr FindProxy(const FString& Name) override;
|
|
|
|
virtual ITargetDeviceProxyPtr FindProxyDeviceForTargetDevice(const FString& DeviceId) override;
|
|
|
|
virtual void GetProxies(FName TargetPlatformName, bool IncludeUnshared, TArray<ITargetDeviceProxyPtr>& OutProxies) override;
|
|
|
|
DECLARE_DERIVED_EVENT(FTargetDeviceProxyManager, ITargetDeviceProxyManager::FOnTargetDeviceProxyAdded, FOnTargetDeviceProxyAdded);
|
|
virtual FOnTargetDeviceProxyAdded& OnProxyAdded() override
|
|
{
|
|
return ProxyAddedDelegate;
|
|
}
|
|
|
|
DECLARE_DERIVED_EVENT(FTargetDeviceProxyManager, ITargetDeviceProxyManager::FOnTargetDeviceProxyRemoved, FOnTargetDeviceProxyRemoved);
|
|
virtual FOnTargetDeviceProxyRemoved& OnProxyRemoved() override
|
|
{
|
|
return ProxyRemovedDelegate;
|
|
}
|
|
|
|
protected:
|
|
|
|
/** Removes all target device proxies that timed out. */
|
|
void RemoveDeadProxies();
|
|
|
|
/** Pings all target devices on the network. */
|
|
void SendPing();
|
|
|
|
private:
|
|
|
|
/** Handles FTargetDeviceServicePong messages. */
|
|
void HandlePongMessage(const FTargetDeviceServicePong& Message, const IMessageContextRef& Context);
|
|
|
|
/** Handles ticks from the ticker. */
|
|
bool HandleTicker(float DeltaTime);
|
|
|
|
private:
|
|
|
|
/** Holds the message endpoint. */
|
|
FMessageEndpointPtr MessageEndpoint;
|
|
|
|
/** Holds the collection of proxies. */
|
|
TMap<FString, FTargetDeviceProxyPtr> Proxies;
|
|
|
|
private:
|
|
|
|
/** Holds a delegate that is invoked when a target device proxy has been added. */
|
|
FOnTargetDeviceProxyAdded ProxyAddedDelegate;
|
|
|
|
/** Holds a delegate that is invoked when a target device proxy has been removed. */
|
|
FOnTargetDeviceProxyRemoved ProxyRemovedDelegate;
|
|
|
|
/** Holds a delegate to be invoked when the widget ticks. */
|
|
FTickerDelegate TickDelegate;
|
|
|
|
/** Handle to the registered TickDelegate. */
|
|
FDelegateHandle TickDelegateHandle;
|
|
};
|