// Copyright 1998-2014 Epic Games, Inc. All Rights Reserved. /*============================================================================= IOSTargetPlatform.h: Declares the FIOSTargetPlatform class. =============================================================================*/ #pragma once #include "Ticker.h" #if WITH_ENGINE #include "StaticMeshResources.h" #endif // WITH_ENGINE /** * FIOSTargetPlatform, abstraction for cooking iOS platforms */ class FIOSTargetPlatform : public TTargetPlatformBase { public: /** * Default constructor. */ FIOSTargetPlatform(); /** * Destructor. */ ~FIOSTargetPlatform(); public: // Begin TTargetPlatformBase interface virtual bool IsServerOnly( ) const override { return false; } // End TTargetPlatformBase interface public: // Begin ITargetPlatform interface virtual void EnableDeviceCheck(bool OnOff) override; virtual void GetAllDevices( TArray& OutDevices ) const override; virtual ECompressionFlags GetBaseCompressionMethod() const override { return COMPRESS_ZLIB; } virtual bool GenerateStreamingInstallManifest(const TMultiMap& ChunkMap, const TSet& ChunkIDsInUse) const override { return true; } virtual ITargetDevicePtr GetDefaultDevice( ) const override; virtual ITargetDevicePtr GetDevice( const FTargetDeviceId& DeviceId ) override; virtual bool IsRunningPlatform( ) const override { #if PLATFORM_IOS && WITH_EDITOR return true; #else return false; #endif } virtual bool SupportsFeature( ETargetPlatformFeatures::Type Feature ) const override { if (Feature == ETargetPlatformFeatures::Packaging) { // not implemented yet return true; } return TTargetPlatformBase::SupportsFeature(Feature); } virtual bool IsSdkInstalled(bool bProjectHasCode, FString& OutDocumentationPath) const override; virtual int DoesntHaveRequirements(const FString& ProjectPath, bool bProjectHasCode, FString& OutDocumentationPath) const override; #if WITH_ENGINE virtual void GetReflectionCaptureFormats( TArray& OutFormats ) const override { OutFormats.Add(FName(TEXT("EncodedHDR"))); } virtual void GetAllPossibleShaderFormats( TArray& OutFormats ) const override; virtual void GetAllTargetedShaderFormats( TArray& OutFormats ) const override; virtual const class FStaticMeshLODSettings& GetStaticMeshLODSettings( ) const override { return StaticMeshLODSettings; } virtual void GetTextureFormats( const UTexture* Texture, TArray& OutFormats ) const override; virtual const struct FTextureLODSettings& GetTextureLODSettings( ) const override; virtual FName GetWaveFormat( class USoundWave* Wave ) const override; #endif // WITH_ENGINE DECLARE_DERIVED_EVENT(FIOSTargetPlatform, ITargetPlatform::FOnTargetDeviceDiscovered, FOnTargetDeviceDiscovered); virtual FOnTargetDeviceDiscovered& OnDeviceDiscovered( ) override { return DeviceDiscoveredEvent; } DECLARE_DERIVED_EVENT(FIOSTargetPlatform, ITargetPlatform::FOnTargetDeviceLost, FOnTargetDeviceLost); virtual FOnTargetDeviceLost& OnDeviceLost( ) override { return DeviceLostEvent; } // Begin ITargetPlatform interface protected: /** * Sends a ping message over the network to find devices running the launch daemon. */ void PingNetworkDevices( ); private: // Handles when the ticker fires. bool HandleTicker( float DeltaTime ); // Handles received pong messages from the LauncherDaemon. void HandlePongMessage( const FIOSLaunchDaemonPong& Message, const IMessageContextRef& Context ); void HandleDeviceConnected( const FIOSLaunchDaemonPong& Message ); void HandleDeviceDisconnected( const FIOSLaunchDaemonPong& Message ); private: // Contains all discovered IOSTargetDevices over the network. TMap Devices; // Holds a delegate to be invoked when the widget ticks. FTickerDelegate TickDelegate; // Holds the message endpoint used for communicating with the LaunchDaemon. FMessageEndpointPtr MessageEndpoint; #if WITH_ENGINE // Holds the Engine INI settings, for quick use. FConfigFile EngineSettings; // Holds the cache of the target LOD settings. FTextureLODSettings TextureLODSettings; // Holds the static mesh LOD settings. FStaticMeshLODSettings StaticMeshLODSettings; #endif // WITH_ENGINE // holds usb device helper FIOSDeviceHelper DeviceHelper; private: // Holds an event delegate that is executed when a new target device has been discovered. FOnTargetDeviceDiscovered DeviceDiscoveredEvent; // Holds an event delegate that is executed when a target device has been lost, i.e. disconnected or timed out. FOnTargetDeviceLost DeviceLostEvent; };