Files
UnrealEngineUWP/Engine/Source/Developer/IOS/IOSTargetPlatform/Private/IOSTargetDeviceOutput.h
jack porter e4eda780ba Support for Device Output Window iOS log and console command sending using libimobiledevice
#rb Axel.Riffard
#jira UE-103878
#preflight 61d79f4c1f62d3ad4d6a0aee

#ROBOMERGE-AUTHOR: jack.porter
#ROBOMERGE-SOURCE: CL 18539330 in //UE5/Release-5.0/... via CL 18539345
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v899-18417669)

[CL 18539355 by jack porter in ue5-release-engine-test branch]
2022-01-06 21:34:01 -05:00

71 lines
1.8 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "Containers/UnrealString.h"
#include "HAL/Runnable.h"
#include "HAL/RunnableThread.h"
#include "HAL/PlatformProcess.h"
#include "Interfaces/ITargetDeviceOutput.h"
#include "Misc/ConfigCacheIni.h"
#include "HAL/ThreadSafeCounter.h"
class FIOSTargetDevice;
static FString GetLibImobileDeviceExe(const FString& ExeName)
{
FString ToReturn;
#if PLATFORM_WINDOWS
ToReturn = FPaths::ConvertRelativePathToFull(FPaths::EngineDir() / TEXT("Extras/ThirdPartyNotUE/libimobiledevice/x64/"));
#elif PLATFORM_MAC
ToReturn = FPaths::ConvertRelativePathToFull(FPaths::EngineDir() / TEXT("Extras/ThirdPartyNotUE/libimobiledevice/Mac/"));
#else
UE_LOG(LogIOSDeviceHelper, Error, TEXT("The current platform is unsupported by Libimobile library."));
#endif
ToReturn += ExeName;
#if PLATFORM_WINDOWS
ToReturn += TEXT(".exe");
#endif
return ToReturn;
}
class FIOSDeviceOutputReaderRunnable : public FRunnable
{
public:
FIOSDeviceOutputReaderRunnable(const FString& InDeviceUDID, FOutputDevice* Output);
// FRunnable interface.
virtual bool Init(void) override;
virtual void Exit(void) override;
virtual void Stop(void) override;
virtual uint32 Run(void) override;
private:
bool StartSyslogProcess(void);
// > 0 if we've been asked to abort work in progress at the next opportunity
FThreadSafeCounter StopTaskCounter;
FString DeviceUDID;
FOutputDevice* Output;
void* SyslogReadPipe;
void* SyslogWritePipe;
FProcHandle SyslogProcHandle;
};
/**
* Implements a IOS target device output.
*/
class FIOSTargetDeviceOutput : public ITargetDeviceOutput
{
public:
bool Init(const FIOSTargetDevice& TargetDevice, FOutputDevice* Output);
private:
TUniquePtr<FRunnableThread> DeviceOutputThread;
FString DeviceName;
};
#include "IOSTargetDeviceOutput.inl"