diff --git a/.gitignore b/.gitignore index 715b38f..242a311 100644 --- a/.gitignore +++ b/.gitignore @@ -24,7 +24,6 @@ *.lai *.la *.a -*.lib # Executables *.exe diff --git a/InteractiveControl/.gitignore b/InteractiveControl/.gitignore new file mode 100644 index 0000000..242a311 --- /dev/null +++ b/InteractiveControl/.gitignore @@ -0,0 +1,75 @@ +# ---> UnrealEngine +# Visual Studio 2015 user specific files +.vs/ + +# Compiled Object files +*.slo +*.lo +*.o +*.obj + +# Precompiled Headers +*.gch +*.pch + +# Compiled Dynamic libraries +*.so +*.dylib +*.dll + +# Fortran module files +*.mod + +# Compiled Static libraries +*.lai +*.la +*.a + +# Executables +*.exe +*.out +*.app +*.ipa + +# These project files can be generated by the engine +*.xcodeproj +*.xcworkspace +*.sln +*.suo +*.opensdf +*.sdf +*.VC.db +*.VC.opendb + +# Precompiled Assets +SourceArt/**/*.png +SourceArt/**/*.tga + +# Binary Files +Binaries/* +Plugins/**/Binaries/* + +# Builds +Build/* + +# Whitelist PakBlacklist-.txt files +!Build/*/ +Build/*/** +!Build/*/PakBlacklist*.txt + +# Don't ignore icon files in Build +!Build/**/*.ico + +# Built data for maps +*_BuiltData.uasset + +# Configuration files generated by the Editor +Saved/* + +# Compiled source files for the engine to use +Intermediate/* +Plugins/**/Intermediate/* + +# Cache files for the editor to use +DerivedDataCache/* + diff --git a/InteractiveControl/Content/Main.umap b/InteractiveControl/Content/Main.umap index a8d2ed4..4108a62 100644 --- a/InteractiveControl/Content/Main.umap +++ b/InteractiveControl/Content/Main.umap @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7df7274a532c0e93a11179ebca449bb1b524a0b805d781e3dd8723a05caa6c9b +oid sha256:0fd11e37775bef5e585cf9e7f87cab9d6fbb52cacabb0a7b951cb1f51c113dcc size 8763 diff --git a/InteractiveControl/Content/UI/Main.uasset b/InteractiveControl/Content/UI/Main.uasset index cc694f6..8cc4228 100644 --- a/InteractiveControl/Content/UI/Main.uasset +++ b/InteractiveControl/Content/UI/Main.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:743cd2221f72e58176506bd4b53020c2ebff86ebbcb815bb723906cecb6a3cf8 -size 272271 +oid sha256:3eb1687a1ae4ba9e18d31021e3e6759d9eb334ecdd5bf3c6a8c03e93cd1e6b64 +size 272415 diff --git a/InteractiveControl/Content/UI/Page1.uasset b/InteractiveControl/Content/UI/Page1.uasset index e186119..a316d81 100644 --- a/InteractiveControl/Content/UI/Page1.uasset +++ b/InteractiveControl/Content/UI/Page1.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f528073cf26e4d122daac335af83895f4a46978513d6bb206e77e52bfcfaa81c -size 77141 +oid sha256:4818570d7c96c4f9c5ab60949d02ee0a2e9106e8d0dddd04f86d0e29425b708d +size 77312 diff --git a/InteractiveControl/Content/UI/Page2.uasset b/InteractiveControl/Content/UI/Page2.uasset index b40c050..df8a2a1 100644 --- a/InteractiveControl/Content/UI/Page2.uasset +++ b/InteractiveControl/Content/UI/Page2.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:60a139154ea414f68a53d166710dc9e5254d2e9552a1abe54f45a9215a07466e -size 72084 +oid sha256:2141850049d35520b763ce894f577adf8b79f822eff5ac6d1746948a1b6d1b8f +size 72453 diff --git a/InteractiveControl/Content/UI/Page3.uasset b/InteractiveControl/Content/UI/Page3.uasset index cf03de3..c6b9f25 100644 --- a/InteractiveControl/Content/UI/Page3.uasset +++ b/InteractiveControl/Content/UI/Page3.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8e7fb6658dbaeba7d2f49539481c9e86d5f67ef409f8ac3188c1ee86f8874b9b -size 128137 +oid sha256:908f022e7d628309a993517f8802dd3b4660b960d16531a79a2a03601d2d9fa4 +size 127813 diff --git a/InteractiveControl/Content/UI/Page4.uasset b/InteractiveControl/Content/UI/Page4.uasset index 91cd074..3182e2e 100644 --- a/InteractiveControl/Content/UI/Page4.uasset +++ b/InteractiveControl/Content/UI/Page4.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:fe40bc7e9940147e4db9d346931860d8d3f06f7a873df4e83feb1c85c8584982 -size 127780 +oid sha256:7371d061d376c2663b0c54e8b8652ffd3fe5ae0a51b845665c72fb22c6d1a0d4 +size 127335 diff --git a/InteractiveControl/Content/UI/Page5.uasset b/InteractiveControl/Content/UI/Page5.uasset index f79fdea..37a3a71 100644 --- a/InteractiveControl/Content/UI/Page5.uasset +++ b/InteractiveControl/Content/UI/Page5.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:5f472ca17b7c51fc568bc2de1e7c5d237faf0adc4640c36fd812326ee51c303f -size 127840 +oid sha256:c52929cf986d5267f5718869a7aad14bc32779c51f515a7c50579acc6894f00c +size 127134 diff --git a/InteractiveControl/Content/UI/Page6_0.uasset b/InteractiveControl/Content/UI/Page6_0.uasset index cc59ca2..5eed810 100644 --- a/InteractiveControl/Content/UI/Page6_0.uasset +++ b/InteractiveControl/Content/UI/Page6_0.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7a6406dfff2017ce6dd53be5a349115ca70fd55cdb0e1e5c06f0e428438cd1dd -size 139159 +oid sha256:acb4b8df587807ccb89bdd8ab2f4ad5cfbd16ba34415520731e1a2df7f73775b +size 138572 diff --git a/InteractiveControl/Content/UI/Page6_sub.uasset b/InteractiveControl/Content/UI/Page6_sub.uasset index e6e5adf..53451c2 100644 --- a/InteractiveControl/Content/UI/Page6_sub.uasset +++ b/InteractiveControl/Content/UI/Page6_sub.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:59166ceac0776066fa3b21a6aaf16d24baf1ec0bb66ed2ad519a0c4b318c7302 -size 298765 +oid sha256:7abdd86a8095f4c32d9419a13de9b1ea04d328b49e3d62768c4e092ff5da41c0 +size 341885 diff --git a/InteractiveControl/Content/blueprint/BP_PC.uasset b/InteractiveControl/Content/blueprint/BP_PC.uasset index 9a75c2f..f10a8dd 100644 --- a/InteractiveControl/Content/blueprint/BP_PC.uasset +++ b/InteractiveControl/Content/blueprint/BP_PC.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:25736f6564013ad27fd41d4bd5673b91bcd6de0fe35701be1cb14435b7b57bb9 -size 68961 +oid sha256:2300d2cc555f4d7fcc977e464666cfcbb30c1eb1cb36f8adc7494f11f702407d +size 85119 diff --git a/InteractiveControl/Plugins/SimpleUDPTCPSocketClient/Resources/Icon128.png b/InteractiveControl/Plugins/SimpleUDPTCPSocketClient/Resources/Icon128.png new file mode 100644 index 0000000..65c8b36 Binary files /dev/null and b/InteractiveControl/Plugins/SimpleUDPTCPSocketClient/Resources/Icon128.png differ diff --git a/InteractiveControl/Plugins/SimpleUDPTCPSocketClient/SocketClient.uplugin b/InteractiveControl/Plugins/SimpleUDPTCPSocketClient/SocketClient.uplugin new file mode 100644 index 0000000..fda9ed0 --- /dev/null +++ b/InteractiveControl/Plugins/SimpleUDPTCPSocketClient/SocketClient.uplugin @@ -0,0 +1,30 @@ +{ + "FileVersion": 3, + "Version": 255, + "VersionName": "2.55", + "FriendlyName": "SimpleTCPUDPSocketClient", + "Description": "TCP and UDP Blueprint Socket Client", + "Category": "Sockets", + "CreatedBy": "Socke", + "CreatedByURL": "", + "DocsURL": "http://virtualbird.de/ue4Doku/SimpleTCPUDPSocketClient2/", + "MarketplaceURL": "com.epicgames.launcher://ue/marketplace/content/5d4ddd5493ce4d2295ef9be6c67eff82", + "SupportURL": "mailto:unrealmarketplace@virtualbird.de", + "EngineVersion": "5.3.0", + "CanContainContent": false, + "Installed": true, + "Modules": [ + { + "Name": "SocketClient", + "Type": "Runtime", + "LoadingPhase": "PreLoadingScreen", + "PlatformAllowList": [ + "Win64", + "Mac", + "IOS", + "Android", + "Linux" + ] + } + ] +} \ No newline at end of file diff --git a/InteractiveControl/Plugins/SimpleUDPTCPSocketClient/Source/SocketClient/Private/DNSClientSocketClient.cpp b/InteractiveControl/Plugins/SimpleUDPTCPSocketClient/Source/SocketClient/Private/DNSClientSocketClient.cpp new file mode 100644 index 0000000..ec9c836 --- /dev/null +++ b/InteractiveControl/Plugins/SimpleUDPTCPSocketClient/Source/SocketClient/Private/DNSClientSocketClient.cpp @@ -0,0 +1,115 @@ +// Copyright 2017-2019 David Romanski (Socke). All Rights Reserved. + +#include "DNSClientSocketClient.h" + +UDNSClientSocketClient::UDNSClientSocketClient(const FObjectInitializer& ObjectInitializer) + : Super(ObjectInitializer) { +} + + +void UDNSClientSocketClient::resolveDomain(ISocketSubsystem* socketSubSystem, FString domainP, bool useDNSCache, FString dnsIP) { + domain = domainP; + resolving = true; + if (useDNSCache) { + if (dnsCache.Find(domain) != nullptr) { + ip = *dnsCache.Find(domain); + resolving = false; + return; + } + } + FIPv4Endpoint Endpoint; + FString socketName; + //FIPv4Endpoint::Parse("127.0.0.1:12345", Endpoint); + //socket = FUdpSocketBuilder(*socketName).AsReusable().WithBroadcast().BoundToEndpoint(Endpoint); + socket = FUdpSocketBuilder(*socketName).AsReusable().WithBroadcast(); + if (socket == nullptr || socket == NULL) { + UE_LOG(LogTemp, Error, TEXT("UE4 could not init a UDP socket to resolve %s on %s."), *domain, *dnsIP); + resolving = false; + return; + } + else { + FTimespan ThreadWaitTime = FTimespan::FromMilliseconds(100); + FUdpSocketReceiver* udpSocketReceiver = new FUdpSocketReceiver(socket, ThreadWaitTime, TEXT("UE4 DNSClient")); + udpSocketReceiver->OnDataReceived().BindUObject(this, &UDNSClientSocketClient::UDPReceiver); + udpSocketReceiver->Start(); + + TSharedRef addr = socketSubSystem->CreateInternetAddr(); + bool bIsValid; + addr->SetIp(*dnsIP, bIsValid); + addr->SetPort(53); + if (bIsValid) { + TArray dnsRequest; + //id (ramdom choose) + dnsRequest.Add(0x22); + dnsRequest.Add(0x76); + //head + dnsRequest.Add(0x1); + dnsRequest.Add(0x0); + dnsRequest.Add(0x0); + dnsRequest.Add(0x1); + dnsRequest.Add(0x0); + dnsRequest.Add(0x0); + dnsRequest.Add(0x0); + dnsRequest.Add(0x0); + dnsRequest.Add(0x0); + dnsRequest.Add(0x0); + + //domain + //split in domain parts than add the length as byte and the part as bytes + TArray domainParts; + domain.ParseIntoArray(domainParts, TEXT("."), true); + for (int i = 0; i < domainParts.Num(); i++) { + FTCHARToUTF8 Convert(*domainParts[i]); + dnsRequest.Add(Convert.Length()); + dnsRequest.Append((uint8*)Convert.Get(), Convert.Length()); + } + //foot + dnsRequest.Add(0x0); + dnsRequest.Add(0x0); + dnsRequest.Add(0x1); + dnsRequest.Add(0x0); + dnsRequest.Add(0x1); + int32 sent; + socket->SendTo((uint8*)dnsRequest.GetData(), dnsRequest.Num(), sent, *addr); + } + } + +} + +void UDNSClientSocketClient::UDPReceiver(const FArrayReaderPtr& ArrayReaderPtr, const FIPv4Endpoint& EndPt) { + + //TSharedPtr peerAddr = EndPt.ToInternetAddr(); + //FString ip = peerAddr->ToString(false); + //int32 port = peerAddr->GetPort(); + ////UE_LOG(LogTemp, Error, TEXT("peerAddr:%s port:%i"), *peerAddr->ToString(false), peerAddr->GetPort()); + + + + TArray byteArray; + byteArray.Append(ArrayReaderPtr->GetData(), ArrayReaderPtr->Num()); + + FString ipAdress; + if (byteArray.Num() > 10) { + for (int32 i = (byteArray.Num() - 4); i < byteArray.Num(); i++) { + uint32 ipTmp = byteArray.GetData()[i] << 0; + ipAdress += FString::FromInt(ipTmp) + "."; + } + } + + ipAdress.RemoveFromEnd("."); + + //UE_LOG(LogTemp, Display, TEXT("DNS Resolved IP:%s"), *recvMessage); + + ip = ipAdress; + dnsCache.Add(domain, ip); + + resolving = false; +} + +bool UDNSClientSocketClient::isResloving() { + return resolving; +} + +FString UDNSClientSocketClient::getIP() { + return ip; +} diff --git a/InteractiveControl/Plugins/SimpleUDPTCPSocketClient/Source/SocketClient/Private/FileFunctionsSocketClient.cpp b/InteractiveControl/Plugins/SimpleUDPTCPSocketClient/Source/SocketClient/Private/FileFunctionsSocketClient.cpp new file mode 100644 index 0000000..f3bbbf7 --- /dev/null +++ b/InteractiveControl/Plugins/SimpleUDPTCPSocketClient/Source/SocketClient/Private/FileFunctionsSocketClient.cpp @@ -0,0 +1,572 @@ +// Copyright 2017-2019 David Romanski (Socke). All Rights Reserved. + +#include "FileFunctionsSocketClient.h" + +UFileFunctionsSocketClient* UFileFunctionsSocketClient::fileFunctionsSocketClient; + +UFileFunctionsSocketClient::UFileFunctionsSocketClient(const FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer) { + fileFunctionsSocketClient = this; +} + +UFileFunctionsSocketClient* UFileFunctionsSocketClient::getFileFunctionsSocketClientTarget() { + return fileFunctionsSocketClient; +} + +FString UFileFunctionsSocketClient::getCleanDirectory(EFileFunctionsSocketClientDirectoryType directoryType, FString filePath) { + if (directoryType == EFileFunctionsSocketClientDirectoryType::E_ad) { + return FPaths::ConvertRelativePathToFull(filePath); + } + else { + FString ProjectDir = FPaths::ProjectDir(); + return FPaths::ConvertRelativePathToFull(ProjectDir + filePath); + } +} + +void UFileFunctionsSocketClient::writeBytesToFile(EFileFunctionsSocketClientDirectoryType directoryType, FString filePath, TArray bytes, bool& success) { + success = FFileHelper::SaveArrayToFile(bytes, *getCleanDirectory(directoryType, filePath)); +} + +void UFileFunctionsSocketClient::addBytesToFileAndCloseIt(EFileFunctionsSocketClientDirectoryType directoryType, FString filePath, TArray bytes, bool& success) { + FArchive* writer = IFileManager::Get().CreateFileWriter(*getCleanDirectory(directoryType, filePath), EFileWrite::FILEWRITE_Append); + if (!writer) { + success = false; + return; + } + writer->Seek(writer->TotalSize()); + writer->Serialize(bytes.GetData(), bytes.Num()); + writer->Close(); + delete writer; + + success = true; +} + +//void UFileFunctionsSocketClient::splittFile(EFileFunctionsSocketClientDirectoryType directoryType, FString filePath, int32 parts, bool& success){ +// if (parts <= 0) +// parts = 1; +// FArchive* reader = IFileManager::Get().CreateFileReader(*getCleanDirectory(directoryType, filePath)); +// if (!reader) { +// success = false; +// return; +// } +// +// int64 splittAfterBytes = reader->TotalSize()/ ((int64)parts); +// TArray bytes; +// +// for (int32 i = 0; i < parts; i++){ +// bytes.AddUninitialized(splittAfterBytes); +// reader->Serialize(bytes.GetData(), splittAfterBytes); +// if (FFileHelper::SaveArrayToFile(bytes, *getCleanDirectory(directoryType, filePath)) == false) { +// success = false; +// return; +// } +// splittAfterBytes = +// reader->Seek(); +// } +// +//} + +TArray UFileFunctionsSocketClient::readBytesFromFile(EFileFunctionsSocketClientDirectoryType directoryType, FString filePath, bool& success) { + TArray result; + success = FFileHelper::LoadFileToArray(result, *getCleanDirectory(directoryType, filePath)); + return result; +} + +void UFileFunctionsSocketClient::readStringFromFile(EFileFunctionsSocketClientDirectoryType directoryType, FString filePath, bool& success, FString& data) { + data.Empty(); + success = FFileHelper::LoadFileToString(data, *getCleanDirectory(directoryType, filePath)); +} + +void UFileFunctionsSocketClient::writeStringToFile(EFileFunctionsSocketClientDirectoryType directoryType, FString data, FString filePath, EFileFunctionsSocketClientEncodingOptions fileEncoding, bool& success) { + success = FFileHelper::SaveStringToFile(data, *getCleanDirectory(directoryType, filePath), (FFileHelper::EEncodingOptions)fileEncoding); +} + + + +void UFileFunctionsSocketClient::getMD5FromFile(EFileFunctionsSocketClientDirectoryType directoryType, FString filePath, bool& success, FString& MD5) { + getMD5FromFileAbsolutePath(getCleanDirectory(directoryType, filePath), success, MD5); +} + +void UFileFunctionsSocketClient::getMD5FromFileAbsolutePath(FString filePath, bool& success, FString& MD5) { + MD5.Empty(); + FArchive* reader = IFileManager::Get().CreateFileReader(*filePath); + if (!reader) { + success = false; + return; + } + + TArray byteArrayTmp; + int64 totalSize = reader->TotalSize(); + int64 loadedBytes = 0; + int64 leftUploadBytes = 1024; + + + if (totalSize < leftUploadBytes) + leftUploadBytes = totalSize; + + + uint8 Digest[16]; + FMD5 Md5Gen; + + while ((loadedBytes + leftUploadBytes) <= totalSize) { + byteArrayTmp.Reset(leftUploadBytes); + byteArrayTmp.AddUninitialized(leftUploadBytes); + reader->Serialize(byteArrayTmp.GetData(), byteArrayTmp.Num()); + loadedBytes += leftUploadBytes; + reader->Seek(loadedBytes); + + Md5Gen.Update(byteArrayTmp.GetData(), byteArrayTmp.Num()); + } + + leftUploadBytes = totalSize - loadedBytes; + if (leftUploadBytes > 0) { + byteArrayTmp.Reset(leftUploadBytes); + byteArrayTmp.AddUninitialized(leftUploadBytes); + reader->Serialize(byteArrayTmp.GetData(), byteArrayTmp.Num()); + loadedBytes += leftUploadBytes; + Md5Gen.Update(byteArrayTmp.GetData(), byteArrayTmp.Num()); + } + + if (reader != nullptr) { + reader->Close(); + delete reader; + } + + if (totalSize != loadedBytes) { + success = false; + return; + } + + Md5Gen.Final(Digest); + for (int32 i = 0; i < 16; i++) { + MD5 += FString::Printf(TEXT("%02x"), Digest[i]); + } + + success = true; +} + +void UFileFunctionsSocketClient::stringToBase64String(FString string, FString& base64String) { + base64String.Empty(); + FTCHARToUTF8 Convert(*string); + TArray bytes; + bytes.Append(((uint8*)((ANSICHAR*)Convert.Get())), Convert.Length()); + base64String = FBase64::Encode(bytes); +} + +void UFileFunctionsSocketClient::base64StringToString(FString& string, FString base64String) { + string.Empty(); + TArray bytes; + if (FBase64::Decode(*base64String, bytes)) { + bytes.Add(0x00);// null-terminator + char* Data = (char*)bytes.GetData(); + string = FString(UTF8_TO_TCHAR(Data)); + } +} + + +void UFileFunctionsSocketClient::bytesToBase64String(TArray bytes, FString& base64String) { + base64String.Empty(); + base64String = FBase64::Encode(bytes); +} + +TArray UFileFunctionsSocketClient::base64StringToBytes(FString base64String, bool& success) { + TArray fileData; + if (base64String.Len() % 2 != 0 || base64String.Len() < 4) { + success = false; + return fileData; + } + success = FBase64::Decode(*base64String, fileData); + return fileData; +} + +void UFileFunctionsSocketClient::fileToBase64String(EFileFunctionsSocketClientDirectoryType directoryType, FString filePath, bool& success, FString& base64String, FString& fileName) { + base64String.Empty(); + fileName.Empty(); + TArray fileData; + if (!FFileHelper::LoadFileToArray(fileData, *getCleanDirectory(directoryType, filePath))) { + success = false; + return; + } + base64String = FBase64::Encode(fileData); + success = true; +} + +bool UFileFunctionsSocketClient::fileExists(EFileFunctionsSocketClientDirectoryType directoryType, FString filePath) { + return FPaths::FileExists(*getCleanDirectory(directoryType, filePath)); +} + +bool UFileFunctionsSocketClient::fileExistsAbsolutePath(FString filePath) { + return FPaths::FileExists(*filePath); +} + +bool UFileFunctionsSocketClient::directoryExists(EFileFunctionsSocketClientDirectoryType directoryType, FString path) { + return FPaths::DirectoryExists(*getCleanDirectory(directoryType, path)); +} + +int64 UFileFunctionsSocketClient::fileSize(EFileFunctionsSocketClientDirectoryType directoryType, FString filePath) { + return FPlatformFileManager::Get().GetPlatformFile().FileSize(*getCleanDirectory(directoryType, filePath)); +} + +int64 UFileFunctionsSocketClient::fileSizeAbsolutePath(FString filePath) { + return FPlatformFileManager::Get().GetPlatformFile().FileSize(*filePath); +} + +bool UFileFunctionsSocketClient::deleteFile(EFileFunctionsSocketClientDirectoryType directoryType, FString filePath) { + return FPlatformFileManager::Get().GetPlatformFile().DeleteFile(*getCleanDirectory(directoryType, filePath)); +} + +bool UFileFunctionsSocketClient::deleteFileAbsolutePath(FString filePath) { + return FPlatformFileManager::Get().GetPlatformFile().DeleteFile(*filePath); +} + + +bool UFileFunctionsSocketClient::deleteDirectory(EFileFunctionsSocketClientDirectoryType directoryType, FString filePath) { + return FPlatformFileManager::Get().GetPlatformFile().DeleteDirectory(*getCleanDirectory(directoryType, filePath)); +} + +bool UFileFunctionsSocketClient::isReadOnly(EFileFunctionsSocketClientDirectoryType directoryType, FString filePath) { + return FPlatformFileManager::Get().GetPlatformFile().IsReadOnly(*getCleanDirectory(directoryType, filePath)); +} + +bool UFileFunctionsSocketClient::moveFile(EFileFunctionsSocketClientDirectoryType directoryTypeTo, FString filePathTo, EFileFunctionsSocketClientDirectoryType directoryTypeFrom, FString filePathFrom) { + return FPlatformFileManager::Get().GetPlatformFile().MoveFile(*getCleanDirectory(directoryTypeTo, filePathTo), *getCleanDirectory(directoryTypeFrom, filePathFrom)); +} + +bool UFileFunctionsSocketClient::setReadOnly(EFileFunctionsSocketClientDirectoryType directoryType, FString filePath, bool bNewReadOnlyValue) { + return FPlatformFileManager::Get().GetPlatformFile().SetReadOnly(*getCleanDirectory(directoryType, filePath), bNewReadOnlyValue); +} + +FDateTime UFileFunctionsSocketClient::getTimeStamp(EFileFunctionsSocketClientDirectoryType directoryType, FString filePath) { + return FPlatformFileManager::Get().GetPlatformFile().GetTimeStamp(*getCleanDirectory(directoryType, filePath)); +} + +void UFileFunctionsSocketClient::setTimeStamp(EFileFunctionsSocketClientDirectoryType directoryType, FString filePath, FDateTime DateTime) { + FPlatformFileManager::Get().GetPlatformFile().SetTimeStamp(*getCleanDirectory(directoryType, filePath), DateTime); +} + +FDateTime UFileFunctionsSocketClient::getAccessTimeStamp(EFileFunctionsSocketClientDirectoryType directoryType, FString filePath) { + return FPlatformFileManager::Get().GetPlatformFile().GetAccessTimeStamp(*getCleanDirectory(directoryType, filePath)); +} + +FString UFileFunctionsSocketClient::getFilenameOnDisk(EFileFunctionsSocketClientDirectoryType directoryType, FString filePath) { + return FPlatformFileManager::Get().GetPlatformFile().GetFilenameOnDisk(*getCleanDirectory(directoryType, filePath)); +} + +bool UFileFunctionsSocketClient::createDirectory(EFileFunctionsSocketClientDirectoryType directoryType, FString path) { + return FPlatformFileManager::Get().GetPlatformFile().CreateDirectory(*getCleanDirectory(directoryType, path)); +} + +void UFileFunctionsSocketClient::getAllFilesFromDirectory(EFileFunctionsSocketClientDirectoryType directoryType, FString filePath, int32& count, TArray& files, TArray& filePaths, FString fileType) { + if (filePath.Len() < 1) { + return; + } + files.Empty(); + filePaths.Empty(); + + FString dir = getCleanDirectory(directoryType, filePath); + FPaths::NormalizeDirectoryName(filePath); + + if (!FPaths::DirectoryExists(dir)) { + return; + } + IFileManager& FileManager = IFileManager::Get(); + + dir += "/" + fileType; + + FileManager.FindFiles(files, *dir, true, false); + + + filePath += "/"; + for (int32 i = 0; i < files.Num(); i++) { + filePaths.Add((filePath + files[i])); + //UE_LOG(LogTemp, Display, TEXT("->%s"), *files[i]); + } + count = files.Num(); +} + +FFileFunctionsSocketClientOpenFile UFileFunctionsSocketClient::openFile(EFileFunctionsSocketClientDirectoryType directoryType, FString filePath){ + + FArchive* writer = IFileManager::Get().CreateFileWriter(*getCleanDirectory(directoryType, filePath), EFileWrite::FILEWRITE_Append); + FFileFunctionsSocketClientOpenFile file; + file.writer = writer; + return file; +} + +int64 UFileFunctionsSocketClient::addBytesToFile(FFileFunctionsSocketClientOpenFile openFile, TArray bytes){ + //UE_LOG(LogTemp, Warning, TEXT("xxxxx WRITE: %i"), bytes.Num()); + if (openFile.writer != nullptr) { + openFile.writer->Seek(openFile.writer->TotalSize()); + openFile.writer->Serialize(bytes.GetData(), bytes.Num()); + //openFile.writer->Flush(); + return openFile.writer->TotalSize(); + } + return 0; +} + +void UFileFunctionsSocketClient::closeFile(FFileFunctionsSocketClientOpenFile openFile){ + if (openFile.writer != nullptr) { + openFile.writer->Close(); + openFile.writer = nullptr; + } +} + + +bool UFileFunctionsSocketClient::encryptFileWithAES(EFileFunctionsSocketClientDirectoryType directoryType, FString filePath, FString newFileName, FString key, bool writeEncryptedFileSizeToFile){ + + if (filePath.IsEmpty() || newFileName.IsEmpty() || key.Len() != 32) { + UE_LOG(LogTemp, Error, TEXT("encryptFileWithAES: FilePath or newFileName empty or wrong key length. The key must consist of 32 ANSI compatible characters.")); + return false; + } + + FString dir = getCleanDirectory(directoryType, filePath); + FString fileName = FPaths::GetCleanFilename(dir); + int64 fileSize = FPlatformFileManager::Get().GetPlatformFile().FileSize(*dir); + + TArray64 data; + if (!FFileHelper::LoadFileToArray(data, *dir)) { + UE_LOG(LogTemp, Error, TEXT("encryptFileWithAES: File could not be loaded: %s"),*dir); + return false; + } + + const int64 encryptedFileSize = Align(data.Num(), FAES::AESBlockSize); + + if (data.Num() < encryptedFileSize) { + data.AddUninitialized(encryptedFileSize - data.Num()); + } + + FAES::EncryptData(data.GetData(), encryptedFileSize, TCHAR_TO_ANSI(*key)); + + dir = dir.Replace(*fileName, *newFileName); + if (FPaths::FileExists(*dir)) { + FPlatformFileManager::Get().GetPlatformFile().DeleteFile(*dir); + } + + FArchive* writer = IFileManager::Get().CreateFileWriter(*dir, EFileWrite::FILEWRITE_Append); + if (!writer) { + UE_LOG(LogTemp, Error, TEXT("encryptFileWithAES: File could not be saved: %s"), *dir); + data.Empty(); + return false; + } + + if (writeEncryptedFileSizeToFile) { + TArray byteArray; + union { + int64 tmpVal; + uint8 tmpArray[8]; + } u; + u.tmpVal = fileSize; + byteArray.AddZeroed(8); + + FMemory::Memcpy(byteArray.GetData(), u.tmpArray, 8); + writer->Serialize(byteArray.GetData(), byteArray.Num()); + byteArray.Empty(); + } + + writer->Serialize(data.GetData(), data.Num()); + writer->Close(); + delete writer; + + data.Empty(); + + + return true; +} + +bool UFileFunctionsSocketClient::decryptFileWithAES(EFileFunctionsSocketClientDirectoryType directoryType, FString filePath, FString newFileName, FString key, + bool hasEncryptedFileSizeInFile, int64 originalFileLength){ + + if (filePath.IsEmpty() || newFileName.IsEmpty() || key.Len() != 32) { + UE_LOG(LogTemp, Error, TEXT("decryptFileWithAES: FilePath or newFileName empty or wrong key length. The key must consist of 32 ANSI compatible characters.")); + return false; + } + + FString dir = getCleanDirectory(directoryType, filePath); + FString fileName = FPaths::GetCleanFilename(dir); + int64 fileSize = FPlatformFileManager::Get().GetPlatformFile().FileSize(*dir); + + FArchive* reader = IFileManager::Get().CreateFileReader(*dir); + if (!reader) { + UE_LOG(LogTemp, Error, TEXT("decryptFileWithAES: File could not be loaded: %s"), *dir); + return false; + } + + if (hasEncryptedFileSizeInFile) { + TArray bytes; + bytes.AddZeroed(8); + reader->Serialize(bytes.GetData(), bytes.Num()); + FMemory::Memcpy(&originalFileLength, bytes.GetData(), 8); + bytes.Empty(); + fileSize = fileSize-8; + } + + if (fileSize < originalFileLength) { + originalFileLength = fileSize; + UE_LOG(LogTemp, Warning, TEXT("decryptFileWithAES: The encrypted file size is smaller than the original file size. File may be corrupted: %s"), *dir); + return false; + } + + TArray64 data; + data.AddUninitialized(fileSize); + reader->Serialize(data.GetData(), data.Num()); + reader->Close(); + delete reader; + + + const int64 encryptedFileSize = Align(data.Num(), FAES::AESBlockSize); + if (data.Num() < encryptedFileSize) { + UE_LOG(LogTemp, Error, TEXT("decryptFileWithAES: Wrong data length. File could not be decrypted: %s"),*dir); + return false; + } + + FAES::DecryptData(data.GetData(), encryptedFileSize, TCHAR_TO_ANSI(*key)); + + dir = dir.Replace(*fileName, *newFileName); + if (FPaths::FileExists(*dir)) { + FPlatformFileManager::Get().GetPlatformFile().DeleteFile(*dir); + } + + FArchive* writer = IFileManager::Get().CreateFileWriter(*dir, EFileWrite::FILEWRITE_Append); + if (!writer) { + UE_LOG(LogTemp, Error, TEXT("encryptFileWithAES: File could not be saved: %s"), *dir); + data.Empty(); + return false; + } + writer->Serialize(data.GetData(), originalFileLength); + writer->Close(); + delete writer; + + data.Empty(); + return true; +} + +FString UFileFunctionsSocketClient::encryptMessageWithAES(FString message, FString key) { + + if (message.IsEmpty() || key.Len() != 32) { + UE_LOG(LogTemp, Error, TEXT("encryptMessageWithAES:Message empty or wrong key length. The key must consist of 32 ANSI compatible characters.")); + return FString(); + } + + TArray data = FStringToByteArray(message); + data.Add(0x00);// null-terminator + const int64 encryptedFileSize = Align(data.Num(), FAES::AESBlockSize); + + if (data.Num() < encryptedFileSize){ + data.AddUninitialized(encryptedFileSize-data.Num()); + } + + FAES::EncryptData(data.GetData(), encryptedFileSize, TCHAR_TO_ANSI(*key)); + + FString encryptedBase64String = FString(); + bytesToBase64String(data, encryptedBase64String); + + data.Empty(); + + return encryptedBase64String; +} + +FString UFileFunctionsSocketClient::decryptMessageWithAES(FString message, FString key) { + if (message.IsEmpty() || key.Len() != 32) { + UE_LOG(LogTemp, Error, TEXT("decryptMessageFromAES: Message empty or wrong key length. The key must consist of 32 ANSI compatible characters.")); + return FString(); + } + + bool success = false; + TArray data = base64StringToBytes(message, success); + + + const int64 encryptedFileSize = Align(data.Num(), FAES::AESBlockSize); + if (data.Num() < encryptedFileSize) { + UE_LOG(LogTemp, Error, TEXT("decryptMessageFromAES: Wrong string length. Message could not be decrypted.")); + return FString(); + } + + FAES::DecryptData(data.GetData(), encryptedFileSize, TCHAR_TO_ANSI(*key)); + + FString s = FString(UTF8_TO_TCHAR((char*)data.GetData())); + + data.Empty(); + + return s; +} + + +TArray UFileFunctionsSocketClient::FStringToByteArray(FString s) { + FTCHARToUTF8 Convert(*s); + TArray data; + data.Append((uint8*)Convert.Get(), Convert.Length()); + return data; +} + + +FString UFileFunctionsSocketClient::int64ToString(int64 Num) { + FString str = FString(); + const TCHAR* DigitToChar = TEXT("9876543210123456789"); + constexpr int64 ZeroDigitIndex = 9; + bool bIsNumberNegative = Num < 0; + const int64 TempBufferSize = 32; // 32 is big enough + TCHAR TempNum[TempBufferSize]; + int64 TempAt = TempBufferSize; // fill the temp string from the top down. + + // Convert to string assuming base ten. + do + { + TempNum[--TempAt] = DigitToChar[ZeroDigitIndex + (Num % 10)]; + Num /= 10; + } while (Num); + + if (bIsNumberNegative) + { + TempNum[--TempAt] = TEXT('-'); + } + + const TCHAR* CharPtr = TempNum + TempAt; + const int64 NumChars = TempBufferSize - TempAt; + str.Append(CharPtr, NumChars); + + return str; +} + + + + +void UFileFunctionsSocketClient::readBytesFromFileInPartsAsync(EFileFunctionsSocketClientDirectoryType directoryType, FString filePath, int32 bufferSize, float delayBetweenReadsInSeconds) { + UFileFunctionsSocketClient::getFileFunctionsSocketClientTarget()->readBytesFromFileInPartsAsyncInternal(directoryType, filePath, bufferSize, delayBetweenReadsInSeconds); +} + +void UFileFunctionsSocketClient::readBytesFromFileInPartsAsyncInternal(EFileFunctionsSocketClientDirectoryType directoryType, FString filePath, int32 bufferSize, float delayBetweenReadsInSeconds) { + + FString dir = UFileFunctionsSocketClient::getCleanDirectory(directoryType, filePath); + + if (readFileInPartsThreads.Find(*dir) != nullptr) { + UE_LOG(LogTemp, Warning, TEXT("ReadBytesFromFileInPartsAsync: %s is being read already. Operation canceled."), *dir); + return; + } + + FReadFileInPartsSocketClientThread* readThread = new FReadFileInPartsSocketClientThread(dir, bufferSize, delayBetweenReadsInSeconds); + readFileInPartsThreads.Add(dir, readThread); +} + +void UFileFunctionsSocketClient::cancelReadBytesFromFileInParts(EFileFunctionsSocketClientDirectoryType directoryType, FString filePath) { + UFileFunctionsSocketClient::getFileFunctionsSocketClientTarget()->cancelReadBytesFromFileInPartsInternal(directoryType, filePath); +} + +void UFileFunctionsSocketClient::cancelReadBytesFromFileInPartsInternal(EFileFunctionsSocketClientDirectoryType directoryType, FString filePath) { + FString dir = UFileFunctionsSocketClient::getCleanDirectory(directoryType, filePath); + + if (readFileInPartsThreads.Find(*dir) != nullptr) { + (*readFileInPartsThreads.Find(*dir))->stopThread(); + } +} + +void UFileFunctionsSocketClient::cleanReadBytesFromFileInParts(FString cleanDir) { + if (readFileInPartsThreads.Find(*cleanDir) != nullptr) { + readFileInPartsThreads.Remove(*cleanDir); + } +} + +//void UFileFunctionsSocketClient::changeDelayInBytesFromFileInParts(EFileFunctionsSocketClientDirectoryType directoryType, FString filePath, float delayBetweenReadsInSeconds) { +// FString dir = UFileFunctionsSocketClient::getCleanDirectory(directoryType, filePath); +// +// if (readFileInPartsThreads.Find(*dir) != nullptr) { +// (*readFileInPartsThreads.Find(*dir))->setDelayBetweenReadsInSeconds(delayBetweenReadsInSeconds); +// } +//} diff --git a/InteractiveControl/Plugins/SimpleUDPTCPSocketClient/Source/SocketClient/Private/SocketClient.cpp b/InteractiveControl/Plugins/SimpleUDPTCPSocketClient/Source/SocketClient/Private/SocketClient.cpp new file mode 100644 index 0000000..27b18e3 --- /dev/null +++ b/InteractiveControl/Plugins/SimpleUDPTCPSocketClient/Source/SocketClient/Private/SocketClient.cpp @@ -0,0 +1,23 @@ +// Copyright 2017-2019 David Romanski (Socke). All Rights Reserved. +#include "SocketClient.h" + +#define LOCTEXT_NAMESPACE "FSocketClientModule" + +bool FSocketClientModule::isShuttingDown; + +void FSocketClientModule::StartupModule() +{ + // This code will execute after your module is loaded into memory; the exact timing is specified in the .uplugin file per-module + +} + +void FSocketClientModule::ShutdownModule() +{ + // This function may be called during shutdown to clean up your module. For modules that support dynamic reloading, + // we call this function before unloading the module. + isShuttingDown = true; +} + +#undef LOCTEXT_NAMESPACE + +IMPLEMENT_MODULE(FSocketClientModule, SocketClient) \ No newline at end of file diff --git a/InteractiveControl/Plugins/SimpleUDPTCPSocketClient/Source/SocketClient/Private/SocketClientAsyncNodes.cpp b/InteractiveControl/Plugins/SimpleUDPTCPSocketClient/Source/SocketClient/Private/SocketClientAsyncNodes.cpp new file mode 100644 index 0000000..88e911a --- /dev/null +++ b/InteractiveControl/Plugins/SimpleUDPTCPSocketClient/Source/SocketClient/Private/SocketClientAsyncNodes.cpp @@ -0,0 +1,82 @@ +// Copyright 2022 David Romanski(Socke). All Rights Reserved. + +#include "SocketClientAsyncNodes.h" + + +/*--- TCP -------------------------------------------------------------------------------------------------------------*/ + +UTCPConnectAsyncNode* UTCPConnectAsyncNode::socketClientTCPConnectionAsyncNode(FString domainOrI, ESocketClientIPType ipType, int32 port, + EReceiveFilterClient receiveFilters, ESocketClientTCPSeparator messageWrapping, FString optionalCustomConnectionID, bool disableNaglesAlgorithm) { + + UTCPConnectAsyncNode* instance = NewObject(); + + instance->domainOrIP = domainOrI; + instance->ipType = ipType; + instance->port = port; + instance->receiveFilters = receiveFilters; + instance->messageWrapping = messageWrapping; + instance->optionalCustomConnectionID = optionalCustomConnectionID; + instance->disableNaglesAlgorithm = disableNaglesAlgorithm; + + instance->AddToRoot(); + + //The node is only visible in Blueprints if the function is declared in a UBlueprintAsyncActionBase class. + //Therefore an instance of itself is created here. + return instance; +} + +void UTCPConnectAsyncNode::Activate() { + USocketClientBPLibrary::getSocketClientTarget()->connectSocketClientTCPNonStatic(domainOrIP, ipType, port, receiveFilters, + messageWrapping,optionalCustomConnectionID, connectionID, this, disableNaglesAlgorithm); +} + +void UTCPConnectAsyncNode::triggerConnectionEvent(bool success, FString clientConnectionID, FString serverMessage){ + if (success) { + OnConnect.Broadcast(serverMessage, clientConnectionID, "", TArray()); + } + else { + OnDisconnect.Broadcast(serverMessage, clientConnectionID, "", TArray()); + } +} + +void UTCPConnectAsyncNode::triggerMessageEvent(TArray byteDataArray, FString clientConnectionID, FString serverMessage){ + OnServerMessage.Broadcast("",clientConnectionID,serverMessage,byteDataArray); +} + + +/*--- UDP -------------------------------------------------------------------------------------------------------------*/ + +UUDPInitAsyncNode* UUDPInitAsyncNode::socketClientInitUDPReceiverAsyncNode(FString domainOrIP,ESocketClientIPType ipType, int32 port, + EReceiveFilterClient receiveFilter, int32 maxPacketSize) { + + UUDPInitAsyncNode* instance = NewObject(); + + instance->domainOrIP = domainOrIP; + instance->ipType = ipType; + instance->port = port; + instance->receiveFilter = receiveFilter; + instance->maxPacketSize = maxPacketSize; + instance->AddToRoot(); + + //The node is only visible in Blueprints if the function is declared in a UBlueprintAsyncActionBase class. + //Therefore an instance of itself is created here. + return instance; +} + +void UUDPInitAsyncNode::Activate() { + USocketClientBPLibrary::getSocketClientTarget()->socketClientInitUDPReceiverNonStatic(connectionID, this,domainOrIP, ipType, port, + receiveFilter, maxPacketSize); +} + +void UUDPInitAsyncNode::triggerInitEvent(bool success, FString clientConnectionID, FString serverMessage) { + if (success) { + OnSuccess.Broadcast(serverMessage, clientConnectionID,"",0, "", TArray()); + } + else { + OnFail.Broadcast(serverMessage, clientConnectionID, "",0,"", TArray()); + } +} + +void UUDPInitAsyncNode::triggerMessageEvent(TArray byteDataArray, FString clientConnectionID, FString serverMessage, FString peerIP, int32 peerPort) { + OnServerMessage.Broadcast("", clientConnectionID,peerIP, peerPort, serverMessage, byteDataArray); +} \ No newline at end of file diff --git a/InteractiveControl/Plugins/SimpleUDPTCPSocketClient/Source/SocketClient/Private/SocketClientBPLibrary.cpp b/InteractiveControl/Plugins/SimpleUDPTCPSocketClient/Source/SocketClient/Private/SocketClientBPLibrary.cpp new file mode 100644 index 0000000..a405955 --- /dev/null +++ b/InteractiveControl/Plugins/SimpleUDPTCPSocketClient/Source/SocketClient/Private/SocketClientBPLibrary.cpp @@ -0,0 +1,734 @@ +// Copyright 2017-2019 David Romanski (Socke). All Rights Reserved. + +#include "SocketClientBPLibrary.h" +#include "SocketClient.h" + +USocketClientBPLibrary* USocketClientBPLibrary::socketClientBPLibrary; + +USocketClientBPLibrary::USocketClientBPLibrary(const FObjectInitializer& ObjectInitializer) + : Super(ObjectInitializer) { + + socketClientBPLibrary = this; + + if (socketClientCleanerThread == nullptr) + socketClientCleanerThread = new FSocketClientCleanerThread(); +} + +/*Delegate functions*/ +void USocketClientBPLibrary::socketClientTCPConnectionEventDelegate(const bool success, const FString message, const FString clientConnectionIDP) {} +void USocketClientBPLibrary::receiveTCPMessageEventDelegate(const FString message, const TArray& byteArray, const FString clientConnectionIDP) {} +void USocketClientBPLibrary::socketClientUDPConnectionEventDelegate(const bool success, const FString message, const FString clientConnectionID) {} +void USocketClientBPLibrary::receiveUDPMessageEventDelegate(const FString message, const TArray& byteArray, const FString IP, const int32 port,const FString clientConnectionID) {} +void USocketClientBPLibrary::transferFileOverTCPProgressEventDelegate(const FString clientConnectionID, const FString filePath, const float percent, const float mbit, const int64 bytesSend, const int64 fileSize){} +void USocketClientBPLibrary::fileTransferOverTCPInfoEventDelegate(const FString message, const FString clientConnectionID, const FString filePath, const bool success){} +void USocketClientBPLibrary::readBytesFromFileInPartsEventDelegate(const int64 fileSize, const int64 position, const bool end, const TArray& byteArray){} + + +USocketClientBPLibrary::~USocketClientBPLibrary() { + +} + +USocketClientBPLibrary* USocketClientBPLibrary::getSocketClientTarget() { + return socketClientBPLibrary; +} + + + +FString USocketClientBPLibrary::getLocalIP() { + bool canBind = false; + TSharedRef localIp = USocketClientBPLibrary::getSocketClientTarget()->getSocketSubSystem()->GetLocalHostAddr(*GLog, canBind); + + if (localIp->IsValid()) { + FString localIP = localIp->ToString(false); + if (localIP.Equals("127.0.0.1")) { + UE_LOG(LogTemp, Error, TEXT("Could not detect the local IP.")); + return "0.0.0.0"; + } + return localIp->ToString(false); + } + else { + UE_LOG(LogTemp, Error, TEXT("Could not detect the local IP.")); + } + return "0.0.0.0"; +} + + +void USocketClientBPLibrary::connectSocketClientTCP(FString domainOrIP, ESocketClientIPType ipType, int32 port, EReceiveFilterClient receiveFilters, + ESocketClientTCPSeparator messageSeparator, FString optionalCustomConnectionID, FString& connectionID, bool disableNaglesAlgorithm){ + USocketClientBPLibrary::getSocketClientTarget()->connectSocketClientTCPNonStatic(domainOrIP, ipType, port, receiveFilters, + messageSeparator,optionalCustomConnectionID, connectionID, nullptr,disableNaglesAlgorithm); +} + +void USocketClientBPLibrary::connectSocketClientTCPNonStatic(FString domain, ESocketClientIPType ipType, int32 port, EReceiveFilterClient receiveFilter, + ESocketClientTCPSeparator messageSeparator, FString optionalCustomConnectionID, FString& connectionID, UTCPConnectAsyncNode* tcpConnectAsyncNode, bool noPacketDelay) { + + USocketClientTCPClient* tcpClient = NewObject(USocketClientTCPClient::StaticClass()); + if (optionalCustomConnectionID.IsEmpty()) { + connectionID = FGuid::NewGuid().ToString(); + } + else { + connectionID = optionalCustomConnectionID; + if (tcpClients.Find(connectionID) != nullptr) { + FString serverMessage = "An existing connection with this ID was found. Connection establishment was aborted"; + UE_LOG(LogTemp, Warning, TEXT("An existing connection with this ID was found. Connection establishment was aborted. %s"), *connectionID); + onsocketClientTCPConnectionEventDelegate.Broadcast(false, serverMessage, connectionID); + + tcpClient->onsocketClientTCPConnectionEventDelegate.Broadcast(false, serverMessage, connectionID); + if (tcpConnectAsyncNode != nullptr) { + tcpConnectAsyncNode->triggerConnectionEvent(false, connectionID, serverMessage); + } + + return; + } + } + + tcpClients.Add(connectionID, tcpClient); + tcpClient->connect(this, domain, ipType, port, receiveFilter, messageSeparator, connectionID,tcpConnectAsyncNode, noPacketDelay, false); +} + +void USocketClientBPLibrary::socketClientSendTCP(FString connectionID, FString message, TArray byteArray, bool addLineBreak){ + USocketClientBPLibrary::getSocketClientTarget()->socketClientSendTCPNonStatic(connectionID, message, byteArray, addLineBreak); +} + +void USocketClientBPLibrary::socketClientSendTCPNonStatic(FString connectionID,FString message, TArray byteArray, bool addLineBreak) { + + if (connectionID.IsEmpty() || tcpClients.Find(connectionID) == nullptr) { + //don't send to many error messages. one second = 10000000 ticks + if (((FDateTime::Now().GetTicks()) - lastErrorMessageTime) >= 10000000) { + UE_LOG(LogTemp, Error, TEXT("Connection not found (socketClientSendTCPMessage). %s"), *connectionID); + lastErrorMessageTime = FDateTime::Now().GetTicks(); + } + return; + } + + if (message.Len() > 0) { + if (addLineBreak) { + message.Append("\r\n"); + } + } + + + + USocketClientTCPClient* tcpClient = *tcpClients.Find(connectionID); + tcpClient->sendMessage(message, byteArray); + +} + +void USocketClientBPLibrary::socketClientSendFileOverTCP(FString& connectionID, FString domainOrIP, ESocketClientIPType ipType, int32 port, + EFileFunctionsSocketClientDirectoryType directoryType, FString filePath, FString token, FString Aes256bitKey){ + + USocketClientBPLibrary::getSocketClientTarget()->socketClientSendFileOverTCPNonStatic(connectionID, domainOrIP, ipType, + port, directoryType, filePath, token, Aes256bitKey); +} + +void USocketClientBPLibrary::socketClientSendFileOverTCPNonStatic(FString& connectionID, FString domainOrIP, ESocketClientIPType ipType, + int32 port, EFileFunctionsSocketClientDirectoryType directoryType, FString filePath, FString token, FString Aes256bitKey){ + + USocketClientTCPClient* tcpClient = NewObject(USocketClientTCPClient::StaticClass()); + connectionID = FGuid::NewGuid().ToString(); + tcpClients.Add(connectionID, tcpClient); + tcpClient->sendFile(this, connectionID, domainOrIP, ipType, port, directoryType, filePath, token, Aes256bitKey); +} + +void USocketClientBPLibrary::socketClientRequestFileOverTCP(FString& connectionID, FString domainOrIP, ESocketClientIPType ipType, int32 port, + EFileFunctionsSocketClientDirectoryType directoryType, FString downloadDirectory, bool resume, FString token, FString Aes256bitKey){ + + USocketClientBPLibrary::getSocketClientTarget()->socketClientRequestFileOverTCPNonStatic(connectionID, domainOrIP, ipType, port, + directoryType, downloadDirectory, resume, token, Aes256bitKey); +} + +void USocketClientBPLibrary::socketClientRequestFileOverTCPNonStatic(FString& connectionID, FString domainOrIP, ESocketClientIPType ipType, int32 port, + EFileFunctionsSocketClientDirectoryType directoryType, FString downloadDirectory, bool resume, FString token, FString Aes256bitKey) { + USocketClientTCPClient* tcpClient = NewObject(USocketClientTCPClient::StaticClass()); + connectionID = FGuid::NewGuid().ToString(); + tcpClients.Add(connectionID, tcpClient); + tcpClient->requestFile(this, connectionID, domainOrIP, ipType, port, directoryType, downloadDirectory, resume,token, Aes256bitKey); +} + + + +void USocketClientBPLibrary::closeSocketClientConnectionTCP(FString connectionID){ + USocketClientBPLibrary::getSocketClientTarget()->closeSocketClientConnectionTCPNonStatic(connectionID); +} + +void USocketClientBPLibrary::closeSocketClientConnectionTCPNonStatic(FString connectionID){ + if (connectionID.IsEmpty()) { + return; + } + + if (tcpClients.Find(connectionID) == nullptr) { + UE_LOG(LogTemp, Error, TEXT("Connection not found (closeSocketClientTCPConnection). %s"), *connectionID); + return; + } + + USocketClientTCPClient* tcpClient = *tcpClients.Find(connectionID); + if (tcpClient != nullptr) { + if (tcpClient->isRun()) { + tcpClient->closeConnection(); + } + } + tcpClients.Remove(connectionID); + tcpClient = nullptr; +} + +void USocketClientBPLibrary::closeAllSocketClientConnectionsTCP(){ + USocketClientBPLibrary::getSocketClientTarget()->closeAllSocketClientConnectionsTCPNonStatic(); +} + +void USocketClientBPLibrary::closeAllSocketClientConnectionsTCPNonStatic(){ + + TArray tmpArray; + tcpClients.GetKeys(tmpArray); + + for (int32 i = 0; i < tmpArray.Num(); i++){ + closeSocketClientConnectionTCPNonStatic(tmpArray[i]); + } + +} + +void USocketClientBPLibrary::getTCPConnectionByConnectionID(FString connectionID, bool& found, USocketClientTCPClient*& connection){ + USocketClientBPLibrary::getSocketClientTarget()->getTCPConnectionByConnectionIDNonStatic(connectionID, found, connection); +} + +void USocketClientBPLibrary::getTCPConnectionByConnectionIDNonStatic(FString connectionID, bool& found, USocketClientTCPClient* &connection){ + if (connectionID.IsEmpty() || tcpClients.Find(connectionID) == nullptr) { + found = false; + connection = nullptr; + return; + } + + found = true; + connection = *tcpClients.Find(connectionID); +} + +bool USocketClientBPLibrary::isTCPConnected(FString connectionID){ + return USocketClientBPLibrary::getSocketClientTarget()->isTCPConnectedNonStatic(connectionID); +} + +bool USocketClientBPLibrary::isTCPConnectedNonStatic(FString connectionID){ + if (connectionID.IsEmpty() || tcpClients.Find(connectionID) == nullptr) { + return false; + } + + USocketClientTCPClient* tcpClient = *tcpClients.Find(connectionID); + if (tcpClient->isRun() && tcpClient->isConnected()) { + return true; + } + + return false; +} + + +void USocketClientBPLibrary::socketClientInitUDPReceiver(FString& connectionID, FString domainOrIP, ESocketClientIPType ipType, int32 port, EReceiveFilterClient receiveFilter, int32 maxPacketSize){ + USocketClientBPLibrary::getSocketClientTarget()->socketClientInitUDPReceiverNonStatic(connectionID,nullptr, domainOrIP, ipType, port, receiveFilter, maxPacketSize); +} + +void USocketClientBPLibrary::socketClientInitUDPReceiverNonStatic(FString& connectionID, UUDPInitAsyncNode* udpInitAsyncNode, FString domain, + ESocketClientIPType ipType, int32 port, EReceiveFilterClient receiveFilter, int32 maxPacketSize) { + + FString key = domain + FString::FromInt(port); + if (udpClients.Find(key) != nullptr) { + USocketClientUDP* udpClient = *udpClients.Find(key); + connectionID = udpClient->getConnectionID(); + FString info = "Connection already present:" + domain + ":" + FString::FromInt(port); + onsocketClientUDPConnectionEventDelegate.Broadcast(true,info , connectionID); + if (udpInitAsyncNode != nullptr) { + udpInitAsyncNode->triggerInitEvent(true, connectionID, info); + } + return; + } + + USocketClientUDP* udpClient = NewObject(USocketClientUDP::StaticClass()); + connectionID = FGuid::NewGuid().ToString(); + udpClients.Add(connectionID, udpClient); + udpClients.Add(key, udpClient); + udpClient->init(this, udpInitAsyncNode, domain, ipType, port, receiveFilter, connectionID, maxPacketSize); +} + + +void USocketClientBPLibrary::socketClientSendUDP(FString domainOrIP, ESocketClientIPType ipType, int32 port, FString message, TArray byteArray, bool addLineBreak, FString connectionID){ + USocketClientBPLibrary::getSocketClientTarget()->socketClientSendUDPNonStatic(domainOrIP, ipType, port, message, byteArray, addLineBreak, connectionID); +} + +void USocketClientBPLibrary::socketClientSendUDPNonStatic(FString domain, ESocketClientIPType ipType, int32 port, FString message, TArray byteArray, bool addLineBreak, FString clientConnectionIDP) { + + if (clientConnectionIDP.IsEmpty() || udpClients.Find(clientConnectionIDP) == nullptr) { + //don't send to many error messages. one second = 10000000 ticks + if (((FDateTime::Now().GetTicks()) - lastErrorMessageTime) >= 10000000) { + UE_LOG(LogTemp, Error, TEXT("Connection not found (socketClientSendUDPMessage). %s"), *clientConnectionIDP); + lastErrorMessageTime = FDateTime::Now().GetTicks(); + } + return; + } + + if (message.Len() > 0 && addLineBreak) { + message.Append("\r\n"); + } + USocketClientUDP* udpClient = *udpClients.Find(clientConnectionIDP); + udpClient->sendUDPMessage(domain, ipType, port, message, byteArray); +} + + + +void USocketClientBPLibrary::closeSocketClientConnectionUDP(FString connectionID){ + USocketClientBPLibrary::getSocketClientTarget()->closeSocketClientConnectionUDPNonStatic(connectionID); +} + +void USocketClientBPLibrary::closeSocketClientConnectionUDPNonStatic(FString connectionID) { + if (connectionID.IsEmpty()) { + return; + } + if (udpClients.Find(connectionID) == nullptr) { + UE_LOG(LogTemp, Warning, TEXT("Connection not found (closeSocketClientUDPConnection). %s"), *connectionID); + return; + } + + USocketClientUDP* udpClient = *udpClients.Find(connectionID); + udpClient->closeUDPConnection(); + udpClients.Remove(connectionID); + + FString key = udpClient->getDomainOrIP() + FString::FromInt(udpClient->getPort()); + udpClients.Remove(key); + udpClient = nullptr; +} + +void USocketClientBPLibrary::getUDPInitializationByConnectionID(FString connectionID, bool& found, USocketClientUDP*& connection){ + USocketClientBPLibrary::getSocketClientTarget()->getUDPInitializationByConnectionIDNonStatic(connectionID, found, connection); +} + +void USocketClientBPLibrary::getUDPInitializationByConnectionIDNonStatic(FString connectionID, bool& found, USocketClientUDP*& connection){ + if (connectionID.IsEmpty() || udpClients.Find(connectionID) == nullptr) { + found = false; + connection = nullptr; + return; + } + + found = true; + connection = *udpClients.Find(connectionID); +} + +bool USocketClientBPLibrary::isUDPInitialized(FString connectionID){ + return USocketClientBPLibrary::getSocketClientTarget()->isUDPInitializedNonStatic(connectionID); +} + +bool USocketClientBPLibrary::isUDPInitializedNonStatic(FString connectionID){ + if (connectionID.IsEmpty() || udpClients.Find(connectionID) == nullptr) { + return false; + } + + return (*udpClients.Find(connectionID))->isRun(); +} + +void USocketClientBPLibrary::changeSocketPlatform(ESocketPlatformClient platform) { + USocketClientBPLibrary::getSocketClientTarget()->systemSocketPlatform = platform; +} + +FString USocketClientBPLibrary::resolveDomain(FString serverDomainP, ESocketClientIPType ipType) { + + FString* cachedDomainPointer = domainCache.Find(serverDomainP); + if (cachedDomainPointer != nullptr) { + return *cachedDomainPointer; + } + + //is IPv4? + if (ipType == ESocketClientIPType::E_ipv4) { + TArray ipNumbers; + int32 lineCount = serverDomainP.ParseIntoArray(ipNumbers, TEXT("."), true); + if (lineCount == 4 && serverDomainP.Len() <= 15 && serverDomainP.Len() >= 7) { + domainCache.Add(serverDomainP, serverDomainP); + return serverDomainP; + } + } + + //is IPv6? Just a simple check + if (ipType == ESocketClientIPType::E_ipv6) { + TArray ipNumbers; + int32 lineCount = serverDomainP.ParseIntoArray(ipNumbers, TEXT(":"), true); + if (lineCount >= 2) { + domainCache.Add(serverDomainP, serverDomainP); + return serverDomainP; + } + } + + //resolve Domain + ISocketSubsystem* sSS = USocketClientBPLibrary::getSocketSubSystem(); + + FResolveInfo* ResolveInfo = sSS->GetHostByName(TCHAR_TO_ANSI(*serverDomainP)); + while (!ResolveInfo->IsComplete()); + + int32 errorCode = ResolveInfo->GetErrorCode(); + if (errorCode == 0) { + const FInternetAddr* Addr = &ResolveInfo->GetResolvedAddress(); + uint32 OutIP = 0; + FString adr = Addr->ToString(false); + domainCache.Add(serverDomainP, adr); + return adr; + } + else { + if (dnsClient == nullptr) + dnsClient = NewObject(UDNSClientSocketClient::StaticClass()); + dnsClient->resolveDomain(sSS, serverDomainP); + int32 timeout = 1000; + while (dnsClient->isResloving() && timeout > 0) { + timeout -= 10; + FPlatformProcess::Sleep(0.01); + } + FString adr = dnsClient->getIP(); + domainCache.Add(serverDomainP, adr); + return adr; + } + + return serverDomainP; +} + +void USocketClientBPLibrary::cleanConnection(FSocketClientPluginSession& session){ + socketClientCleanerThread->addSession(session); +} + + +void USocketClientBPLibrary::changeCleanerThreadSettingsOnClient(bool showLogs, int32 minLiveTimeInSeconds){ + if (USocketClientBPLibrary::getSocketClientTarget()->socketClientCleanerThread != nullptr) { + USocketClientBPLibrary::getSocketClientTarget()->socketClientCleanerThread->changeSettings(showLogs, minLiveTimeInSeconds); + } +} + +void USocketClientBPLibrary::getSystemType(ESocketClientSystem& system) { +#if PLATFORM_ANDROID + system = ESocketClientSystem::Android; + return; +#endif +#if PLATFORM_IOS + system = ESocketClientSystem::IOS; + return; +#endif +#if PLATFORM_WINDOWS + system = ESocketClientSystem::Windows; + return; +#endif +#if PLATFORM_LINUX + system = ESocketClientSystem::Linux; + return; +#endif +#if PLATFORM_MAC + system = ESocketClientSystem::Mac; + return; +#endif +} + +TArray USocketClientBPLibrary::parseHexToBytes(FString hex) { + TArray bytes; + + if (hex.Contains(" ")) { + hex = hex.Replace(TEXT(" "), TEXT("")); + } + + if (hex.Len() % 2 != 0) { + UE_LOG(LogTemp, Error, TEXT("This is not a valid hex string: %s"), *hex); + return bytes; + } + + + TArray charArray = hex.GetCharArray(); + for (int32 i = 0; i < (charArray.Num() - 1); i++) { + if (CheckTCharIsHex(charArray[i]) == false) { + UE_LOG(LogTemp, Error, TEXT("This is not a valid hex string: %s"), *hex); + return bytes; + } + } + + + bytes.AddZeroed(hex.Len() / 2); + HexToBytes(hex, bytes.GetData()); + + return bytes; +} + +FString USocketClientBPLibrary::parseHexToString(FString hex) { + TArray bytes = parseHexToBytes(hex); + bytes.Add(0x00);// null-terminator + char* Data = (char*)bytes.GetData(); + return FString(UTF8_TO_TCHAR(Data)); +} + +FString USocketClientBPLibrary::parseBytesToHex(TArray bytes) { + FString hex; + hex = BytesToHex(bytes.GetData(), bytes.Num()); + return hex; +} + +TArray USocketClientBPLibrary::parseHexToBytesPure(FString hex) { + return parseHexToBytes(hex); +} + +FString USocketClientBPLibrary::parseHexToStringPure(FString hex) { + return parseHexToString(hex); +} + +FString USocketClientBPLibrary::parseBytesToHexPure(TArray bytes) { + return parseBytesToHex(bytes); +} + +void USocketClientBPLibrary::parseBytesToFloat(TArray bytes, float& value) { + + if (bytes.Num() != 4) { + UE_LOG(LogTemp, Error, TEXT("ParseBytesToFloat: Cannot convert bytes to float. Array must contain 4 bytes but has %i bytes."), bytes.Num()); + return; + } + + FMemory::Memcpy(&value, bytes.GetData(), 4); + +} + +void USocketClientBPLibrary::parseBytesToInteger(TArray bytes, int32& value) { + + + if (bytes.Num() != 4) { + UE_LOG(LogTemp, Error, TEXT("ParseBytesToInteger: Cannot convert bytes to integer. Array must contain 4 bytes but has %i bytes."), bytes.Num()); + return; + } + + FMemory::Memcpy(&value, bytes.GetData(), 4); +} + +void USocketClientBPLibrary::parseBytesToInteger64(TArray bytes, int64& value) { + + + if (bytes.Num() != 8) { + UE_LOG(LogTemp, Error, TEXT("ParseBytesToInteger64: Cannot convert bytes to integer. Array must contain 8 bytes but has %i bytes."), bytes.Num()); + return; + } + + FMemory::Memcpy(&value, bytes.GetData(), 8); +} + +void USocketClientBPLibrary::parseBytesToFloatPure(TArray bytes, float& value){ + parseBytesToFloat(bytes, value); +} + +void USocketClientBPLibrary::parseBytesToIntegerPure(TArray bytes, int32& value){ + parseBytesToInteger(bytes, value); +} + +void USocketClientBPLibrary::parseBytesToInteger64Pure(TArray bytes, int64& value){ + parseBytesToInteger64(bytes, value); +} + +void USocketClientBPLibrary::parseBytesToFloatEndian(TArray bytes, float& littleEndian, float& bigEndian) { + littleEndian = 0.f; + bigEndian = 0.f; + + if (bytes.Num() != 4) { + UE_LOG(LogTemp, Error, TEXT("ParseBytesToFloat: Cannot convert bytes to float. Array must contain 4 bytes but has %i bytes."), bytes.Num()); + return; + } + + uint8 littleEndianChar[] = { bytes[0], bytes[1], bytes[2], bytes[3] }; + FMemory::Memcpy(&littleEndian, &littleEndianChar, sizeof(littleEndian)); + + uint8 bigEndianChar[] = { bytes[3], bytes[2], bytes[1], bytes[0] }; + FMemory::Memcpy(&bigEndian, &bigEndianChar, sizeof(bigEndian)); +} + +void USocketClientBPLibrary::parseBytesToIntegerEndian(TArray bytes, int32& littleEndian, int32& bigEndian){ + littleEndian = 0; + bigEndian = 0; + + if (bytes.Num() != 4){ + UE_LOG(LogTemp, Error, TEXT("ParseBytesToInteger: Cannot convert bytes to integer. Array must contain 4 bytes but has %i bytes."), bytes.Num()); + return; + } + + + uint8 littleEndianChar[] = { bytes[0], bytes[1], bytes[2], bytes[3] }; + FMemory::Memcpy(&littleEndian, &littleEndianChar, sizeof(littleEndian)); + + uint8 bigEndianChar[] = { bytes[3], bytes[2], bytes[1], bytes[0] }; + FMemory::Memcpy(&bigEndian, &bigEndianChar, sizeof(bigEndian)); +} + +void USocketClientBPLibrary::parseBytesToInteger64Endian(TArray bytes, int64& littleEndian, int64& bigEndian) { + littleEndian = 0; + bigEndian = 0; + + if (bytes.Num() != 8) { + UE_LOG(LogTemp, Error, TEXT("ParseBytesToInteger64: Cannot convert bytes to integer. Array must contain 8 bytes but has %i bytes."), bytes.Num()); + return; + }return; + + uint8 littleEndianChar[] = { bytes[0], bytes[1], bytes[2], bytes[3],bytes[4], bytes[5], bytes[6], bytes[7] }; + FMemory::Memcpy(&littleEndian, &littleEndianChar, sizeof(littleEndian)); + + uint8 bigEndianChar[] = { bytes[7], bytes[6], bytes[5], bytes[4], bytes[3], bytes[2], bytes[1], bytes[0] }; + FMemory::Memcpy(&bigEndian, &bigEndianChar, sizeof(bigEndian)); +} + +void USocketClientBPLibrary::parseFloatToBytes(TArray& byteArray, float value, bool switchByteOrder){ + union { + float tmpVal; + uint8 tmpArray[4]; + } u; + u.tmpVal = value; + byteArray.AddUninitialized(4); + + FMemory::Memcpy(byteArray.GetData(), u.tmpArray, 4); + + if (switchByteOrder) { + byteArray.SwapMemory(3, 0); + byteArray.SwapMemory(2, 1); + } +} + +void USocketClientBPLibrary::parseIntegerToBytes(TArray& byteArray, int32 value, bool switchByteOrder){ + union { + int32 tmpVal; + uint8 tmpArray[4]; + } u; + u.tmpVal = value; + byteArray.AddUninitialized(4); + + FMemory::Memcpy(byteArray.GetData(), u.tmpArray, 4); + + if (switchByteOrder) { + byteArray.SwapMemory(3, 0); + byteArray.SwapMemory(2, 1); + } +} + +void USocketClientBPLibrary::parseInteger64ToBytes(TArray& byteArray, int64 value, bool switchByteOrder){ + union { + int64 tmpVal; + uint8 tmpArray[8]; + } u; + u.tmpVal = value; + byteArray.AddUninitialized(8); + + FMemory::Memcpy(byteArray.GetData(), u.tmpArray, 8); + + if (switchByteOrder) { + byteArray.SwapMemory(7, 0); + byteArray.SwapMemory(6, 1); + byteArray.SwapMemory(5, 2); + byteArray.SwapMemory(4, 3); + } +} + +void USocketClientBPLibrary::parseFloatToBytesPure(TArray& byteArray, float value, bool switchByteOrder){ + parseFloatToBytes(byteArray, value, switchByteOrder); +} + +void USocketClientBPLibrary::parseIntegerToBytesPure(TArray& byteArray, int32 value, bool switchByteOrder){ + parseIntegerToBytes(byteArray, value, switchByteOrder); +} + +void USocketClientBPLibrary::parseInteger64ToBytesPure(TArray& byteArray, int64 value, bool switchByteOrder){ + parseInteger64ToBytes(byteArray, value, switchByteOrder); +} + +void USocketClientBPLibrary::parseBytesToFloatArrayPure(TArray& value, TArray bytes) { + if (bytes.Num() == 0 && bytes.Num() % 4 != 0) + return; + value.Empty(); + value.AddUninitialized(bytes.Num() / 4); + FMemory::Memcpy(value.GetData(), bytes.GetData(), bytes.Num()); +} + +void USocketClientBPLibrary::parseBytesToIntegerArrayPure(TArray& value, TArray bytes) { + if (bytes.Num() == 0 && bytes.Num() % 4 != 0) + return; + value.Empty(); + value.AddUninitialized(bytes.Num() / 4); + FMemory::Memcpy(value.GetData(), bytes.GetData(), bytes.Num()); +} + +void USocketClientBPLibrary::parseBytesToInteger64ArrayPure(TArray& value, TArray bytes) { + if (bytes.Num() == 0 && bytes.Num() % 8 != 0) + return; + value.Empty(); + value.AddUninitialized(bytes.Num() / 8); + FMemory::Memcpy(value.GetData(), bytes.GetData(), bytes.Num()); +} + +void USocketClientBPLibrary::parseFloatArrayToBytesPure(TArray& byteArray, TArray value) { + byteArray.Empty(); + byteArray.AddUninitialized(value.Num() * 4); + FMemory::Memcpy(byteArray.GetData(), value.GetData(), value.Num() * 4); +} + +void USocketClientBPLibrary::parseIntegerArrayToBytesPure(TArray& byteArray, TArray value) { + byteArray.Empty(); + byteArray.AddUninitialized(value.Num() * 4); + FMemory::Memcpy(byteArray.GetData(), value.GetData(), value.Num() * 4); +} + +void USocketClientBPLibrary::parseInteger64ArrayToBytesPure(TArray& byteArray, TArray value) { + byteArray.Empty(); + byteArray.AddUninitialized(value.Num() * 8); + FMemory::Memcpy(byteArray.GetData(), value.GetData(), value.Num() * 8); +} + +void USocketClientBPLibrary::changeTCPSeparatorStringOnClient(FString separator) { + USocketClientBPLibrary::getSocketClientTarget()->changeTCPSeparatorStringOnClientNonStatic(separator); +} + +void USocketClientBPLibrary::changeTCPSeparatorStringOnClientNonStatic(FString separator) { + tcpStringSeparator = separator; +} + +void USocketClientBPLibrary::changeTCPSeparatorByteOnClient(uint8 separator) { + USocketClientBPLibrary::getSocketClientTarget()->changeTCPSeparatorByteOnClientNonStatic(separator); +} + +void USocketClientBPLibrary::changeTCPSeparatorByteOnClientNonStatic(uint8 separator) { + tcpByteSeparator = separator; +} + + + + +int32 USocketClientBPLibrary::getUniquePlayerID(APlayerController* playerController) { + if (playerController == nullptr || playerController->GetLocalPlayer() == nullptr) + return 0; + return playerController->GetLocalPlayer()->GetUniqueID(); +} + +FString USocketClientBPLibrary::getRandomID(){ + return FGuid::NewGuid().ToString(); +} + + +void USocketClientBPLibrary::getTcpSeparator(uint8& byteSeparator, FString& stringSeparator){ + stringSeparator = tcpStringSeparator; + byteSeparator = tcpByteSeparator; +} + +ISocketSubsystem* USocketClientBPLibrary::getSocketSubSystem() { + switch (USocketClientBPLibrary::getSocketClientTarget()->systemSocketPlatform) + { + case ESocketPlatformClient::E_SSC_SYSTEM: + return ISocketSubsystem::Get(PLATFORM_SOCKETSUBSYSTEM); + case ESocketPlatformClient::E_SSC_WINDOWS: + return ISocketSubsystem::Get(FName(TEXT("WINDOWS"))); + case ESocketPlatformClient::E_SSC_MAC: + return ISocketSubsystem::Get(FName(TEXT("MAC"))); + case ESocketPlatformClient::E_SSC_IOS: + return ISocketSubsystem::Get(FName(TEXT("IOS"))); + case ESocketPlatformClient::E_SSC_UNIX: + return ISocketSubsystem::Get(FName(TEXT("UNIX"))); + case ESocketPlatformClient::E_SSC_ANDROID: + return ISocketSubsystem::Get(FName(TEXT("ANDROID"))); + case ESocketPlatformClient::E_SSC_PS4: + return ISocketSubsystem::Get(FName(TEXT("PS4"))); + case ESocketPlatformClient::E_SSC_XBOXONE: + return ISocketSubsystem::Get(FName(TEXT("XBOXONE"))); + case ESocketPlatformClient::E_SSC_HTML5: + return ISocketSubsystem::Get(FName(TEXT("HTML5"))); + case ESocketPlatformClient::E_SSC_SWITCH: + return ISocketSubsystem::Get(FName(TEXT("SWITCH"))); + case ESocketPlatformClient::E_SSC_DEFAULT: + return ISocketSubsystem::Get(); + default: + return ISocketSubsystem::Get(PLATFORM_SOCKETSUBSYSTEM); + } +} + + diff --git a/InteractiveControl/Plugins/SimpleUDPTCPSocketClient/Source/SocketClient/Private/SocketClientCleanerThread.cpp b/InteractiveControl/Plugins/SimpleUDPTCPSocketClient/Source/SocketClient/Private/SocketClientCleanerThread.cpp new file mode 100644 index 0000000..c252858 --- /dev/null +++ b/InteractiveControl/Plugins/SimpleUDPTCPSocketClient/Source/SocketClient/Private/SocketClientCleanerThread.cpp @@ -0,0 +1,67 @@ +// Copyright 2022 David Romanski (Socke). All Rights Reserved. + +#include "SocketClientCleanerThread.h" + +FSocketClientCleanerThread::FSocketClientCleanerThread() { + FString threadName = "FSocketClientPluginCleanerThread_" + FGuid::NewGuid().ToString(); + thread = FRunnableThread::Create(this, *threadName, 0, EThreadPriority::TPri_Lowest); +} + + +void FSocketClientCleanerThread::addSession(FSocketClientPluginSession& session) { + session.addToCleanerTime = FDateTime::Now().GetTicks(); + sessionQueue.Enqueue(session); +} + +void FSocketClientCleanerThread::changeSettings(bool showLogsP, int32 minLiveTimeInSecondsP) { + showLogs = showLogsP; + minLiveTimeInSeconds = minLiveTimeInSecondsP; +} + +uint32 FSocketClientCleanerThread::Run() { + while (true) { + TArray tryItAgain; + + if (showLogs && sessionQueue.IsEmpty()) { + UE_LOG(LogTemp, Display, TEXT("SocketClient: Cleaner: No connections available to clean up.")); + } + + while (sessionQueue.IsEmpty() == false) { + FSocketClientPluginSession session; + sessionQueue.Dequeue(session); + + + //one second = 10000000 ticks + if ((FDateTime::Now().GetTicks() - session.addToCleanerTime) < (10000000 * minLiveTimeInSeconds)) { + tryItAgain.Add(session); + continue; + } + + if (showLogs) { + UE_LOG(LogTemp, Display, TEXT("SocketClient: Clean connection: %s"), *session.clientID); + } + + + delete session.tcpSendThread; + delete session.tcpRecieverThread; + + delete session.tcpFileHandlerThread; + + delete session.udpSocketReceiver; + delete session.udpSendDataThead; + delete session.udpReceiveDataThread; + + delete session.socket; + + } + + for (int32 i = 0; i < tryItAgain.Num(); i++) { + sessionQueue.Enqueue(tryItAgain[i]); + } + tryItAgain.Empty(); + + + FPlatformProcess::Sleep(minLiveTimeInSeconds); + } + return 0; +}; \ No newline at end of file diff --git a/InteractiveControl/Plugins/SimpleUDPTCPSocketClient/Source/SocketClient/Private/SocketClientTCP.cpp b/InteractiveControl/Plugins/SimpleUDPTCPSocketClient/Source/SocketClient/Private/SocketClientTCP.cpp new file mode 100644 index 0000000..9ce3b3a --- /dev/null +++ b/InteractiveControl/Plugins/SimpleUDPTCPSocketClient/Source/SocketClient/Private/SocketClientTCP.cpp @@ -0,0 +1,181 @@ +// Copyright 2017-2019 David Romanski (Socke). All Rights Reserved. + +#include "SocketClientTCP.h" + + +USocketClientTCPClient::USocketClientTCPClient(const FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer) { + //This prevents the garbage collector from killingand deleting the class from RAM. + this->AddToRoot(); + onsocketClientTCPConnectionEventDelegate.AddDynamic(this, &USocketClientTCPClient::connectionEvent); +} + + +void USocketClientTCPClient::socketClientTCPConnectionEventDelegate(const bool success, const FString message, const FString clientConnectionID) {} +void USocketClientTCPClient::receiveTCPMessageEventDelegate(const FString message, const TArray& byteArray, const FString clientConnectionID){} +void USocketClientTCPClient::transferFileOverTCPProgressEventDelegate(const FString clientConnectionID, const FString filePathP, const float percent, const float mbit, const int64 bytesTransferred, const int64 fileSize) {} +void USocketClientTCPClient::fileTransferOverTCPInfoEventDelegate(const FString message, const FString clientConnectionID, const FString filePathP, const bool success) {} + +void USocketClientTCPClient::connectionEvent(bool success, FString message, FString clientConnectionID){ + connected = success; +} + +void USocketClientTCPClient::connect(USocketClientBPLibrary* mainLibP, FString domainOrIP, ESocketClientIPType ipType, int32 port, EReceiveFilterClient receiveFilter, + ESocketClientTCPSeparator messageWrappingP, FString connectionIDP, UTCPConnectAsyncNode* tcpConnectAsyncNodeP, bool noPacketDelay, bool noPacketBlocking){ + mainLib = mainLibP; + connectionID = connectionIDP; + messageWrapping = messageWrappingP; + tcpConnectAsyncNode = tcpConnectAsyncNodeP; + USocketClientBPLibrary::socketClientBPLibrary->getTcpSeparator(tcpByteSeparator, tcpStringSeparator); + tcpReceiveDataThread = new FSocketClientTCPReceiveDataThread(mainLib, connectionID, receiveFilter, domainOrIP, ipType, port,this,noPacketDelay,noPacketBlocking); +} + +void USocketClientTCPClient::sendMessage(FString message, TArray byteArray){ + if (run && tcpSendThread != nullptr) { + tcpSendThread->sendMessage(message, byteArray); + } +} + +void USocketClientTCPClient::sendFile(USocketClientBPLibrary* mainLibP, FString connectionIDP, FString domainOrIP, ESocketClientIPType ipType, int32 port, EFileFunctionsSocketClientDirectoryType directoryType, FString filePathP, FString token, FString Aes256bitKey){ + mainLib = mainLibP; + connectionID = connectionIDP; + aesKey = Aes256bitKey; + fileToken = token; + sendOrReceive = 0; + filePath = UFileFunctionsSocketClient::getCleanDirectory(directoryType, filePathP); + tcpFileConnectionThread = new FSocketClientTCPFileHandlerThread(mainLib, connectionID, domainOrIP, ipType, port, this); +} + +void USocketClientTCPClient::requestFile(USocketClientBPLibrary* mainLibP, FString connectionIDP, FString domainOrIP, ESocketClientIPType ipType, int32 port, EFileFunctionsSocketClientDirectoryType directoryType, FString filePathP, bool resumeP, FString token, FString Aes256bitKey) { + mainLib = mainLibP; + connectionID = connectionIDP; + aesKey = Aes256bitKey; + fileToken = token; + sendOrReceive = 1; + resume = resumeP; + filePath = UFileFunctionsSocketClient::getCleanDirectory(directoryType, filePathP); + tcpFileConnectionThread = new FSocketClientTCPFileHandlerThread(mainLib, connectionID, domainOrIP, ipType, port, this); +} + +void USocketClientTCPClient::closeConnection(){ + + setRun(false); + + if (tcpFileConnectionThread != nullptr) { + tcpFileConnectionThread->triggerFileTransferOverTCPInfoEvent("Data transfer aborted.", connectionID, filePath, false, mainLib, this); + } + + if (tcpSendThread != nullptr) { + tcpSendThread->pauseThread(false); + } + + + if (mainLib != nullptr) { + FSocketClientPluginSession connectionSession = FSocketClientPluginSession(); + connectionSession.tcpRecieverThread = tcpReceiveDataThread; + connectionSession.tcpSendThread = tcpSendThread; + //connectionSession.tcpSendFileThread = fileSendThread; + connectionSession.tcpFileHandlerThread = tcpFileConnectionThread; + connectionSession.socket = socket; + connectionSession.clientID = connectionID; + mainLib->cleanConnection(connectionSession); + } +} + +bool USocketClientTCPClient::isRun(){ + return run; +} + +void USocketClientTCPClient::setRun(bool runP) { + run = runP; +} + +FString USocketClientTCPClient::getConnectionID(){ + return connectionID; +} + +FString USocketClientTCPClient::getAesKey(){ + return aesKey; +} + +FString USocketClientTCPClient::getFileToken(){ + return fileToken; +} + +FString USocketClientTCPClient::getFilePath() { + return filePath; +} + +void USocketClientTCPClient::setSocket(FSocket* socketP){ + socket = socketP; +} + +FSocket* USocketClientTCPClient::getSocket(){ + return socket; +} + +void USocketClientTCPClient::createSendThread(){ + tcpSendThread = new FSocketClientTCPSendDataThead(mainLib, this, connectionID); +} + +void USocketClientTCPClient::getTcpSeparator(FString& stringSeparator, uint8& byteSeparator, ESocketClientTCPSeparator& messageWrappingP) { + messageWrappingP = messageWrapping; + stringSeparator = tcpStringSeparator; + tcpByteSeparator = byteSeparator; +} + +FString USocketClientTCPClient::encryptMessage(FString message) { + return UFileFunctionsSocketClient::encryptMessageWithAES(message, aesKey); +} + +FString USocketClientTCPClient::decryptMessage(FString message) { + return UFileFunctionsSocketClient::decryptMessageWithAES(message, aesKey); +} + +void USocketClientTCPClient::readDataLength(TArray& byteDataArray, int32& byteLenght) { + if (FGenericPlatformProperties::IsLittleEndian() && byteDataArray[0] == 0x00) { + FMemory::Memcpy(&byteLenght, byteDataArray.GetData() + 1, 4); + } + else { + //endian fits not. swap bytes that contains the length + byteDataArray.SwapMemory(1, 4); + byteDataArray.SwapMemory(2, 3); + FMemory::Memcpy(&byteLenght, byteDataArray.GetData() + 1, 4); + } +} + +bool USocketClientTCPClient::isSendFile(){ + return (sendOrReceive == 0); +} + +bool USocketClientTCPClient::isReceiveFile(){ + return (sendOrReceive == 1); +} + +bool USocketClientTCPClient::hasResume(){ + return resume; +} + +bool USocketClientTCPClient::isConnected() +{ + return connected; +} + +void USocketClientTCPClient::deleteFile(FString filePathP){ + UFileFunctionsSocketClient::deleteFileAbsolutePath(filePathP); +} + +void USocketClientTCPClient::getMD5FromFileAbsolutePath(FString filePathP, bool& success, FString& MD5) { + UFileFunctionsSocketClient::getMD5FromFileAbsolutePath(filePathP, success, MD5); +} + +int64 USocketClientTCPClient::fileSize(FString filePathP) { + return UFileFunctionsSocketClient::fileSizeAbsolutePath(filePathP); +} + +USocketClientBPLibrary* USocketClientTCPClient::getMainLib() { + return mainLib; +} + +FString USocketClientTCPClient::int64ToString(int64 num) { + return UFileFunctionsSocketClient::int64ToString(num); +} diff --git a/InteractiveControl/Plugins/SimpleUDPTCPSocketClient/Source/SocketClient/Private/SocketClientTCPFileHandlerThread.cpp b/InteractiveControl/Plugins/SimpleUDPTCPSocketClient/Source/SocketClient/Private/SocketClientTCPFileHandlerThread.cpp new file mode 100644 index 0000000..9929315 --- /dev/null +++ b/InteractiveControl/Plugins/SimpleUDPTCPSocketClient/Source/SocketClient/Private/SocketClientTCPFileHandlerThread.cpp @@ -0,0 +1,592 @@ +// Copyright 2022 David Romanski (Socke). All Rights Reserved. + +#include "SocketClientTCPFileHandlerThread.h" + + +FSocketClientTCPFileHandlerThread::FSocketClientTCPFileHandlerThread(USocketClientBPLibrary* socketClientP, FString clientConnectionIDP, FString ipOrDomainP, ESocketClientIPType ipTypeP, int32 portP, USocketClientTCPClient* tcpClientP) : + socketClient(socketClientP), + clientConnectionID(clientConnectionIDP), + ipOrDomain(ipOrDomainP), + ipType(ipTypeP), + port(portP), + tcpClient(tcpClientP) { + FString threadName = "FServerFileConnectionThread" + FGuid::NewGuid().ToString(); + thread = FRunnableThread::Create(this, *threadName, 0, EThreadPriority::TPri_Normal); +} + +FSocketClientTCPFileHandlerThread::~FSocketClientTCPFileHandlerThread() { + delete thread; +} + +uint32 FSocketClientTCPFileHandlerThread::Run() { + //UE_LOG(LogTemp, Display, TEXT("DoWork:%s"),*(FDateTime::Now()).ToString()); + FString ip = socketClient->resolveDomain(ipOrDomain, ipType); + int32 portGlobal = port; + FString clientConnectionIDGlobal = clientConnectionID; + USocketClientBPLibrary* socketClientGlobal = socketClient; + USocketClientTCPClient* tcpClientGlobal = tcpClient; + + + + //UE_LOG(LogTemp, Warning, TEXT("Tread:%s:%i"),*ip, port); + ISocketSubsystem* sSS = USocketClientBPLibrary::getSocketSubSystem(); + if (sSS == nullptr) { + AsyncTask(ENamedThreads::GameThread, [ip, portGlobal, clientConnectionIDGlobal, socketClientGlobal, tcpClientGlobal]() { + if (socketClientGlobal != nullptr) + socketClientGlobal->onsocketClientTCPConnectionEventDelegate.Broadcast(false, "Connection failed(1). SocketSubSystem does not exist." + ip + ":" + FString::FromInt(portGlobal) + "|" + clientConnectionIDGlobal, clientConnectionIDGlobal); + if (tcpClientGlobal != nullptr) + tcpClientGlobal->onsocketClientTCPConnectionEventDelegate.Broadcast(false, "Connection failed(1). SocketSubSystem does not exist." + ip + ":" + FString::FromInt(portGlobal) + "|" + clientConnectionIDGlobal, clientConnectionIDGlobal); + }); + return 0; + } + TSharedRef addr = sSS->CreateInternetAddr(); + bool bIsValid; + addr->SetIp(*ip, bIsValid); + addr->SetPort(port); + + if (bIsValid) { + // create the socket + FSocket* socket = sSS->CreateSocket(NAME_Stream, TEXT("socketClient"), addr->GetProtocolType()); + tcpClient->setSocket(socket); + + + // try to connect to the server + if (socket == nullptr || socket->Connect(*addr) == false) { + const TCHAR* socketErr = sSS->GetSocketError(SE_GET_LAST_ERROR_CODE); + AsyncTask(ENamedThreads::GameThread, [ip, portGlobal, clientConnectionIDGlobal, socketClientGlobal, tcpClientGlobal, socketErr]() { + if (socketClientGlobal != nullptr) + socketClientGlobal->onsocketClientTCPConnectionEventDelegate.Broadcast(false, "Connection failed(2):" + FString(socketErr) + "|" + ip + ":" + FString::FromInt(portGlobal) + "|" + clientConnectionIDGlobal, clientConnectionIDGlobal); + if (tcpClientGlobal != nullptr) + tcpClientGlobal->onsocketClientTCPConnectionEventDelegate.Broadcast(false, "Connection failed(2):" + FString(socketErr) + "|" + ip + ":" + FString::FromInt(portGlobal) + "|" + clientConnectionIDGlobal, clientConnectionIDGlobal); + }); + } + else { + //connected + AsyncTask(ENamedThreads::GameThread, [ip, portGlobal, clientConnectionIDGlobal, tcpClientGlobal, socketClientGlobal]() { + if (socketClientGlobal != nullptr) + socketClientGlobal->onsocketClientTCPConnectionEventDelegate.Broadcast(true, "Connection successful:" + ip + ":" + FString::FromInt(portGlobal) + "|" + clientConnectionIDGlobal, clientConnectionIDGlobal); + if (tcpClientGlobal != nullptr) + tcpClientGlobal->onsocketClientTCPConnectionEventDelegate.Broadcast(true, "Connection successful:" + ip + ":" + FString::FromInt(portGlobal) + "|" + clientConnectionIDGlobal, clientConnectionIDGlobal); + }); + + + tcpClient->setRun(true); + + if (tcpClient->isReceiveFile()) { + doRequestFileFromServer(socket); + } + else { + if (tcpClient->isSendFile()) { + doSendFileToServer(socket); + } + } + } + + + AsyncTask(ENamedThreads::GameThread, [ip, portGlobal, clientConnectionIDGlobal, tcpClientGlobal, socketClientGlobal]() { + if (socketClientGlobal != nullptr) { + socketClientGlobal->onsocketClientTCPConnectionEventDelegate.Broadcast(false, "Connection close:" + ip + ":" + FString::FromInt(portGlobal) + "|" + clientConnectionIDGlobal, clientConnectionIDGlobal); + if (tcpClientGlobal != nullptr) + tcpClientGlobal->onsocketClientTCPConnectionEventDelegate.Broadcast(false, "Connection close:" + ip + ":" + FString::FromInt(portGlobal) + "|" + clientConnectionIDGlobal, clientConnectionIDGlobal); + } + }); + + USocketClientBPLibrary::getSocketClientTarget()->closeSocketClientConnectionTCPNonStatic(clientConnectionID); + + + + tcpClient->setRun(false); + if (socket != nullptr) { + socket->Close(); + } + } + else { + AsyncTask(ENamedThreads::GameThread, [ip, portGlobal, clientConnectionIDGlobal, tcpClientGlobal, socketClientGlobal]() { + if (socketClientGlobal != nullptr) + socketClientGlobal->onsocketClientTCPConnectionEventDelegate.Broadcast(false, "Connection failed(3). IP not valid:" + ip + ":" + FString::FromInt(portGlobal) + "|" + clientConnectionIDGlobal, clientConnectionIDGlobal); + if (tcpClientGlobal != nullptr) + tcpClientGlobal->onsocketClientTCPConnectionEventDelegate.Broadcast(false, "Connection failed(3). IP not valid:" + ip + ":" + FString::FromInt(portGlobal) + "|" + clientConnectionIDGlobal, clientConnectionIDGlobal); + }); + } + + return 0; +} + +void FSocketClientTCPFileHandlerThread::doRequestFileFromServer(FSocket* socket){ + FString filePath = tcpClient->getFilePath(); + + if (!FPaths::DirectoryExists(filePath)) { + triggerFileTransferOverTCPInfoEvent("Data transmission aborted. Directory not found.", clientConnectionID, filePath, false, socketClient, tcpClient); + tcpClient->setRun(false); + return; + } + + + FString message = "REQUEST_FILE_FROM_SERVER_|_" + tcpClient->getFileToken(); + sendMessageToServer(message, socket); + + message = readMessageFromServer(socket); + + if (message.StartsWith("REQUEST_FILE_FROM_SERVER_ACCEPTED_|_" + tcpClient->getFileToken())) { + TArray lines; + message.ParseIntoArray(lines, TEXT("_|_"), true); + + + if (lines.Num() == 5) { + if (lines[0].Equals("REQUEST_FILE_FROM_SERVER_ACCEPTED") && lines[1].Len() > 0 && lines[2].Len() > 0 && lines[3].Len() > 0 && lines[4].Len() > 0) { + FArchive* writer = nullptr; + FString md5Server = lines[2]; + int64 fileSize = FCString::Atoi64(*lines[3]); + if (filePath.EndsWith("/")) { + filePath += lines[4]; + } + else { + filePath += "/" + lines[4]; + } + + + int64 fileSizeOnClient = 0; + + if (FPaths::FileExists(filePath)) { + fileSizeOnClient = tcpClient->fileSize(filePath); + if (tcpClient->hasResume()) { + writer = IFileManager::Get().CreateFileWriter(*filePath, EFileWrite::FILEWRITE_Append); + } + else { + writer = IFileManager::Get().CreateFileWriter(*filePath); + } + } + else { + writer = IFileManager::Get().CreateFileWriter(*filePath); + } + + if (writer == nullptr) { + triggerFileTransferOverTCPInfoEvent("File could not be created. ", clientConnectionID, filePath, false, socketClient, tcpClient); + tcpClient->setRun(false); + return; + } + + + + if (writer->TotalSize() >= fileSize) { + writer->Close(); + delete writer; + triggerFileTransferOverTCPInfoEvent("File on the client has the same size or is larger than the file on the server.", clientConnectionID, filePath, false, socketClient, tcpClient); + tcpClient->setRun(false); + return; + } + + + //downloadFile = true; + int64 bytesDownloaded = writer->TotalSize(); + + message = "REQUEST_FILE_FROM_SERVER_ACCEPTED_|_" + tcpClient->getFileToken() + "_|_" + tcpClient->int64ToString(bytesDownloaded); + sendMessageToServer(message, socket); + + int64 lastTimeWithData = 0; + int64 ticks1 = 0; + int64 ticks2 = 0; + int64 ticksDownload = 0; + int64 lastByte = 0; + uint32 dataSize = 0; + TArray buffer; + while (socket != nullptr && tcpClient->isRun()) { + + ticks1 = FDateTime::Now().GetTicks(); + socket->Wait(ESocketWaitConditions::WaitForRead, FTimespan::FromSeconds(waitForRead)); + ticks2 = FDateTime::Now().GetTicks(); + + bool hasData = socket->HasPendingData(dataSize); + if (!hasData && ticks1 == ticks2) { + triggerFileTransferOverTCPInfoEvent("Connection broken.", clientConnectionID, filePath, false, socketClient, tcpClient); + tcpClient->setRun(false); + break; + } + + // UE_LOG(LogTemp, Display, TEXT("download %i"),dataSize); + + if (hasData) { + lastTimeWithData = FDateTime::Now().GetTicks(); + + //downlnoad + int32 bytesRead = 0; + buffer.Empty(); + buffer.SetNumUninitialized(dataSize); + if (socket->Recv(buffer.GetData(), buffer.Num(), bytesRead)) { + writer->Serialize(buffer.GetData(), buffer.Num()); + + //show progress each second + if ((ticksDownload + 10000000) <= FDateTime::Now().GetTicks()) { + writer->Flush(); + int64 bytesTransferredLastSecond = bytesDownloaded - lastByte; + //float speed = ((float)bytesTransferredLastSecond) / 125000; + float mbit = ((float)bytesTransferredLastSecond) / 1024 / 1024 * 8; + float sent = ((float)bytesDownloaded) / 1048576; + float left = 0; + float percent = 0; + if (fileSize > 0) { + left = ((float)(fileSize - bytesDownloaded)) / 1048576; + percent = ((float)bytesDownloaded / (float)fileSize * 100); + } + + + triggerTransferFileEvent(clientConnectionID, filePath, socketClient, tcpClient, percent, mbit, bytesDownloaded, fileSize); + + ticksDownload = FDateTime::Now().GetTicks(); + lastByte = bytesDownloaded; + } + bytesDownloaded += bytesRead; + } + if (bytesDownloaded >= fileSize) { + + if (writer != nullptr) { + writer->Close(); + delete writer; + writer = nullptr; + } + + sendEndMessage(filePath, tcpClient->getFileToken(), md5Server, clientConnectionID, socket, socketClient, tcpClient); + + //transfer file finish + triggerTransferFileEvent(clientConnectionID, filePath, socketClient, tcpClient, 100, 0, bytesDownloaded, fileSize); + tcpClient->setRun(false); + } + + } + //no data time out + else { + //one second = 10000000 ticks + //5 seconds timeout + // UE_LOG(LogTemp, Display, TEXT("timeout %i"),(FDateTime::Now().GetTicks() - lastTimeWithData)); + if ((FDateTime::Now().GetTicks() - lastTimeWithData) >= 50000000) { + triggerFileTransferOverTCPInfoEvent("Connection timeout", clientConnectionID, filePath, false, socketClient, tcpClient); + tcpClient->setRun(false); + break; + } + } + } + buffer.Empty(); + if (writer != nullptr) { + writer->Close(); + delete writer; + writer = nullptr; + } + } + } + } + +} + +void FSocketClientTCPFileHandlerThread::doSendFileToServer(FSocket* socket){ + FString filePath = tcpClient->getFilePath(); + + if (!FPaths::FileExists(filePath)) { + triggerFileTransferOverTCPInfoEvent("Data transmission aborted. File not found.", clientConnectionID, filePath, false, socketClient, tcpClient); + tcpClient->setRun(false); + return; + } + + + int64 fileSize = tcpClient->fileSize(filePath); + bool md5okay = false; + FString md5 = FString(); + tcpClient->getMD5FromFileAbsolutePath(filePath, md5okay, md5); + FString fileAuthMessage = "SEND_FILE_TO_SERVER_|_" + tcpClient->getFileToken() + "_|_" + md5 + "_|_" + FPaths::GetCleanFilename(filePath) + "_|_" + tcpClient->int64ToString(fileSize); + sendMessageToServer(fileAuthMessage, socket); + + FString message = readMessageFromServer(socket); + + + if (message.StartsWith("SEND_FILE_TO_SERVER_ACCEPTED_|_" + tcpClient->getFileToken())) { + if (message.RemoveFromStart("SEND_FILE_TO_SERVER_ACCEPTED_|_" + tcpClient->getFileToken() + "_|_")) { + int64 startPosition = FCString::Atoi64(*message); + + // upload file + + FArchive* reader = IFileManager::Get().CreateFileReader(*filePath); + if (reader == nullptr || reader->TotalSize() == 0) { + if (reader != nullptr) { + reader->Close(); + } + tcpClient->setRun(false); + return; + } + + + fileSize = reader->TotalSize(); + /*int64 ticks1 = 0; + int64 ticks2 = 0;*/ + int64 readSize = 0; + int64 lastPosition = startPosition; + int64 bytesSentSinceLastTick = 0; + + int32 bufferSize = 1024 * 64; + int32 dataSendBySocket = 0; + + float percent = 0.f; + float mbit = 0.f; + + TArray buffer; + + int64 lastTimeTicks = FDateTime::Now().GetTicks(); + + if (bufferSize > fileSize) { + bufferSize = fileSize; + } + + if (lastPosition > 0) { + reader->Seek(lastPosition); + } + + while (tcpClient->isRun() && lastPosition < fileSize) { + if ((lastPosition + bufferSize) > fileSize) { + bufferSize = fileSize - lastPosition; + } + + //buffer.Reset(bufferSize); + buffer.Empty(); + buffer.AddUninitialized(bufferSize); + + reader->Serialize(buffer.GetData(), buffer.Num()); + lastPosition += buffer.Num(); + + //UE_LOG(LogTemp, Warning, TEXT("Send: %i"),buffer.Num()); + + //ticks1 = FDateTime::Now().GetTicks(); + socket->Send(buffer.GetData(), buffer.Num(), dataSendBySocket); + //socket->Wait(ESocketWaitConditions::WaitForWrite, FTimespan::FromSeconds(0.001)); + //ticks2 = FDateTime::Now().GetTicks(); + + if (dataSendBySocket == 0 || dataSendBySocket != buffer.Num()) { + triggerFileTransferOverTCPInfoEvent("Data transmission aborted. Connection possibly broken.", clientConnectionID, filePath, false, socketClient, tcpClient); + tcpClient->setRun(false); + return; + } + + //slowdown for tests + //FPlatformProcess::Sleep(0.01f); + + //fire event every second + //one second = 10000000 ticks + if (((FDateTime::Now().GetTicks()) - lastTimeTicks) >= 10000000) { + mbit = ((float)lastPosition - (float)bytesSentSinceLastTick) / 1024 / 1024 * 8; + lastTimeTicks = FDateTime::Now().GetTicks(); + bytesSentSinceLastTick = lastPosition; + + percent = ((float)lastPosition / fileSize) * 100; + triggerTransferFileEvent(clientConnectionID, filePath, socketClient, tcpClient, percent, mbit, lastPosition, fileSize); + } + + } + + mbit = ((float)lastPosition - (float)bytesSentSinceLastTick) / 1024 / 1024 * 8; + percent = ((float)lastPosition / fileSize) * 100; + + triggerTransferFileEvent(clientConnectionID, filePath, socketClient, tcpClient, percent, mbit, lastPosition, fileSize); + + buffer.Empty(); + if (reader != nullptr) { + reader->Close(); + reader = nullptr; + } + + + message = readMessageFromServer(socket); + + if (message.StartsWith("SEND_FILE_TO_SERVER_END_|_" + tcpClient->getFileToken())) { + if (message.RemoveFromStart("SEND_FILE_TO_SERVER_END_|_" + tcpClient->getFileToken() + "_|_")) { + if (message.Equals("OKAY")) { + triggerFileTransferOverTCPInfoEvent("Data transmission successful. ", clientConnectionID, filePath, true, socketClient, tcpClient); + tcpClient->setRun(false); + } + else { + triggerFileTransferOverTCPInfoEvent("There was an error during data transmission. File may be corrupted or incomplete. ", clientConnectionID, filePath, false, socketClient, tcpClient); + tcpClient->setRun(false); + } + } + else { + triggerFileTransferOverTCPInfoEvent("Data transmission aborted. Wrong answer from the server (3). ", clientConnectionID, filePath, false, socketClient, tcpClient); + tcpClient->setRun(false); + } + } + } + else { + triggerFileTransferOverTCPInfoEvent("Data transmission aborted. Wrong answer from the server (2). ", clientConnectionID, filePath, false, socketClient, tcpClient); + tcpClient->setRun(false); + return; + } + } + else { + if (message.StartsWith("SEND_FILE_TO_SERVER_END_|_" + tcpClient->getFileToken())) { + if (message.RemoveFromStart("SEND_FILE_TO_SERVER_END_|_" + tcpClient->getFileToken() + "_|_")) { + if (message.Equals("OKAY")) { + triggerFileTransferOverTCPInfoEvent("Data transmission successful. ", clientConnectionID, filePath, true, socketClient, tcpClient); + tcpClient->setRun(false); + } + else { + triggerFileTransferOverTCPInfoEvent("There was an error during data transmission. File may be corrupted or incomplete. ", clientConnectionID, filePath, false, socketClient, tcpClient); + tcpClient->setRun(false); + } + } + else { + triggerFileTransferOverTCPInfoEvent("Data transmission aborted. Wrong answer from the server (3). ", clientConnectionID, filePath, false, socketClient, tcpClient); + tcpClient->setRun(false); + } + } + else { + triggerFileTransferOverTCPInfoEvent("Data transmission aborted. Wrong answer from the server (1). ", clientConnectionID, filePath, false, socketClient, tcpClient); + tcpClient->setRun(false); + } + } + +} + +void FSocketClientTCPFileHandlerThread::sendMessageToServer(FString message, FSocket* socket){ + message = tcpClient->encryptMessage(message); + + TArray byteCache; + FTCHARToUTF8 Convert(*message); + int32 sent = 0; + if (FGenericPlatformProperties::IsLittleEndian()) { + byteCache.Add(0x00); + } + else { + byteCache.Add(0x01); + } + byteCache.SetNum(5); + int32 dataLength = Convert.Length(); + FMemory::Memcpy(byteCache.GetData() + 1, &dataLength, 4); + byteCache.Append((uint8*)Convert.Get(), Convert.Length()); + + socket->Send(byteCache.GetData(), byteCache.Num(), sent); + byteCache.Empty(); +} + +void FSocketClientTCPFileHandlerThread::triggerFileTransferOverTCPInfoEvent(FString messageP, FString clientConnectionIDP, FString filePathP, bool successP, USocketClientBPLibrary* socketClientP, USocketClientTCPClient* tcpClientP) { + AsyncTask(ENamedThreads::GameThread, [messageP, clientConnectionIDP, filePathP, successP, socketClientP, tcpClientP]() { + if (socketClientP != nullptr) + socketClientP->onfileTransferOverTCPInfoEventDelegate.Broadcast(messageP, clientConnectionIDP, filePathP, successP); + if (tcpClientP != nullptr) + tcpClientP->onfileTransferOverTCPInfoEventDelegate.Broadcast(messageP, clientConnectionIDP, filePathP, successP); + }); +} + +void FSocketClientTCPFileHandlerThread::triggerTransferFileEvent(FString clientConnectionIDP, FString filePathP, USocketClientBPLibrary* socketClientP, USocketClientTCPClient* tcpClientP, float percentP, float mbitP, int64 transferredP, int64 fileSizeP) { + AsyncTask(ENamedThreads::GameThread, [clientConnectionIDP, socketClientP, filePathP, tcpClientP, percentP, mbitP, transferredP, fileSizeP]() { + if (socketClientP != nullptr) + socketClientP->ontransferFileOverTCPProgressEventDelegate.Broadcast(clientConnectionIDP, filePathP, percentP, mbitP, transferredP, fileSizeP); + if (tcpClientP != nullptr) + tcpClientP->ontransferFileOverTCPProgressEventDelegate.Broadcast(clientConnectionIDP, filePathP, percentP, mbitP, transferredP, fileSizeP); + }); +} + +void FSocketClientTCPFileHandlerThread::sendEndMessage(FString fullFilePathP, FString tokenP, FString md5ServerP, FString clientConnectionIDP, FSocket* clientSocketP, USocketClientBPLibrary* socketClientP, USocketClientTCPClient* tcpClientP) { + bool md5okay = false; + FString md5Client = FString(); + tcpClientP->getMD5FromFileAbsolutePath(fullFilePathP, md5okay, md5Client); + + FString response = "REQUEST_FILE_FROM_SERVER_END_|_" + tokenP + "_|_"; + + if (md5okay && md5ServerP.Equals(md5Client)) { + triggerFileTransferOverTCPInfoEvent("File successfully received.", clientConnectionIDP, fullFilePathP, true, socketClientP, tcpClientP); + + response += "OKAY"; + } + else { + triggerFileTransferOverTCPInfoEvent("File received but MD5 does not match. Corrupted file will be deleted if resume is not disabled.", clientConnectionIDP, fullFilePathP, false, socketClientP, tcpClientP); + response += "MD5ERROR"; + if (tcpClientP->hasResume()) { + tcpClientP->deleteFile(fullFilePathP); + } + } + + sendMessageToServer(response, clientSocketP); +} + + +FString FSocketClientTCPFileHandlerThread::readMessageFromServer(FSocket* socket){ + int64 ticks1 = 0; + int64 ticks2 = 0; + int32 lastDataLengthFromHeader = 0; + FString message = FString(); + TArray byteDataArrayCache; + TArray byteDataArray; + + uint32 dataSize = 0; + TArray lines; + while (tcpClient->isRun() && socket != nullptr) { + + ticks1 = FDateTime::Now().GetTicks(); + socket->Wait(ESocketWaitConditions::WaitForRead, FTimespan::FromSeconds(waitForRead)); + ticks2 = FDateTime::Now().GetTicks(); + + bool hasData = socket->HasPendingData(dataSize); + + if (!hasData && ticks1 == ticks2) { + //if (showFTPLogs) { + // UE_LOG(LogTemp, Warning, TEXT("FTP Client: TCP connection broken.")); + //} + //fireConnectionEvent(false, 0, "TCP connection broken."); + return "TCP connection broken."; + } + + if (!hasData) { + return message; + } + + + if (hasData) { + TArray dataFromSocket; + dataFromSocket.SetNumUninitialized(dataSize); + int32 BytesRead = 0; + if (socket->Recv(dataFromSocket.GetData(), dataFromSocket.Num(), BytesRead)) { + if (lastDataLengthFromHeader == 0 && dataFromSocket.Num() >= 5) { + + tcpClient->readDataLength(dataFromSocket, lastDataLengthFromHeader); + + if (dataFromSocket.Num() == 5) { + dataFromSocket.Empty(); + continue; + } + + byteDataArrayCache.Append(dataFromSocket.GetData() + 5, dataFromSocket.Num() - 5); + dataFromSocket.Empty(); + } + else { + byteDataArrayCache.Append(dataFromSocket.GetData(), dataFromSocket.Num()); + } + + int32 maxLoops = 1000;//to prevent endless loop + + while (byteDataArrayCache.Num() > 0 && byteDataArrayCache.Num() >= lastDataLengthFromHeader && maxLoops > 0) { + maxLoops--; + + byteDataArray.Append(byteDataArrayCache.GetData(), lastDataLengthFromHeader); + byteDataArrayCache.RemoveAt(0, lastDataLengthFromHeader, true); + + if (byteDataArrayCache.Num() == 0) { + lastDataLengthFromHeader = 0; + break; + } + + if (byteDataArrayCache.Num() > 5) { + tcpClient->readDataLength(byteDataArrayCache, lastDataLengthFromHeader); + byteDataArrayCache.RemoveAt(0, 5, true); + } + } + + byteDataArray.Add(0x00);// null-terminator + message = FString(UTF8_TO_TCHAR((char*)byteDataArray.GetData())); + byteDataArray.Empty(); + if (message.IsEmpty() == false) { + message = tcpClient->decryptMessage(message); + } + return message; + } + } + } + if (message.IsEmpty() == false) { + message = tcpClient->decryptMessage(message); + } + return message; +} \ No newline at end of file diff --git a/InteractiveControl/Plugins/SimpleUDPTCPSocketClient/Source/SocketClient/Private/SocketClientTCPReceiveDataThread.cpp b/InteractiveControl/Plugins/SimpleUDPTCPSocketClient/Source/SocketClient/Private/SocketClientTCPReceiveDataThread.cpp new file mode 100644 index 0000000..ba91ca6 --- /dev/null +++ b/InteractiveControl/Plugins/SimpleUDPTCPSocketClient/Source/SocketClient/Private/SocketClientTCPReceiveDataThread.cpp @@ -0,0 +1,288 @@ +// Copyright 2022 David Romanski (Socke). All Rights Reserved. + +#include "SocketClientTCPReceiveDataThread.h" + + +FSocketClientTCPReceiveDataThread::FSocketClientTCPReceiveDataThread(USocketClientBPLibrary* socketClientBPLibraryP, FString clientConnectionIDP, + EReceiveFilterClient receiveFilterP, FString ipOrDomainP, ESocketClientIPType ipTypeP, int32 portP, + USocketClientTCPClient* tcpClientP, bool noPacketDelayP, bool noPacketBlockingP) : + socketClientBPLibrary(socketClientBPLibraryP), + clientConnectionID(clientConnectionIDP), + receiveFilter(receiveFilterP), + ipOrDomain(ipOrDomainP), + ipType(ipTypeP), + port(portP), + tcpClient(tcpClientP), + noPacketDelay(noPacketDelayP), + noPacketBlocking(noPacketBlockingP) { + FString threadName = "FServerConnectionThread" + FGuid::NewGuid().ToString(); + thread = FRunnableThread::Create(this, *threadName, 0, EThreadPriority::TPri_Normal); +} + +FSocketClientTCPReceiveDataThread::~FSocketClientTCPReceiveDataThread() { + if (tcpClient != nullptr && tcpClient->tcpConnectAsyncNode != nullptr) { + tcpClient->tcpConnectAsyncNode = nullptr; + } + delete thread; +} + + + +uint32 FSocketClientTCPReceiveDataThread::Run() { + //UE_LOG(LogTemp, Display, TEXT("DoWork:%s"),*(FDateTime::Now()).ToString()); + FString ip = socketClientBPLibrary->resolveDomain(ipOrDomain, ipType); + int32 portGlobal = port; + FString clientConnectionIDGlobal = clientConnectionID; + USocketClientBPLibrary* socketClientGlobal = socketClientBPLibrary; + USocketClientTCPClient* tcpClientGlobal = tcpClient; + + //message wrapping + FString stringSeparator = FString(); + uint8 byteSeparator = 0x00; + ESocketClientTCPSeparator messageWrapping = ESocketClientTCPSeparator::E_None; + tcpClient->getTcpSeparator(stringSeparator, byteSeparator, messageWrapping); + + TArray stringSeparatorArray = stringSeparator.GetCharArray(); + if (stringSeparatorArray.Num() > 0 && stringSeparatorArray.Last() == 0x00) { + stringSeparatorArray.RemoveAt(stringSeparatorArray.Num() - 1, 1, true); + } + + if (messageWrapping == ESocketClientTCPSeparator::E_LengthSeparator && stringSeparatorArray.Num() == 0) { + messageWrapping = ESocketClientTCPSeparator::E_None; + UE_LOG(LogTemp, Warning, TEXT("Socket Client Plugin: Separator mode is set to String but there is no String Separator. Mode changed to none.")); + } + + + //UE_LOG(LogTemp, Warning, TEXT("Tread:%s:%i"),*ip, port); + ISocketSubsystem* sSS = USocketClientBPLibrary::getSocketSubSystem(); + if (sSS == nullptr) { + FString info = "Connection failed(1). SocketSubSystem does not exist.:" + ip + ":" + FString::FromInt(portGlobal) + "|" + clientConnectionIDGlobal; + triggerConnectionEvent(false, clientConnectionID, info, tcpClientGlobal, socketClientGlobal); + return 0; + } + TSharedRef addr = sSS->CreateInternetAddr(); + bool bIsValid; + addr->SetIp(*ip, bIsValid); + addr->SetPort(port); + + if (bIsValid) { + // create the socket + FSocket* socket = sSS->CreateSocket(NAME_Stream, TEXT("socketClient"), addr->GetProtocolType()); + tcpClient->setSocket(socket); + + + //socket options + if (socket != nullptr) { + socket->SetNoDelay(noPacketDelay); + socket->SetNonBlocking(noPacketBlocking); + + tcpClient->setRun(true); + } + + // try to connect to the server + if (socket == nullptr || socket->Connect(*addr) == false) { + const TCHAR* socketErr = sSS->GetSocketError(SE_GET_LAST_ERROR_CODE); + FString info = "Connection failed(2):" + FString(socketErr) + "|" + ip + ":" + FString::FromInt(portGlobal) + "|" + clientConnectionIDGlobal; + triggerConnectionEvent(false, clientConnectionID, info, tcpClientGlobal, socketClientGlobal); + } + else { + FString info = "Connection successful:" + ip + ":" + FString::FromInt(portGlobal) + "|" + clientConnectionIDGlobal; + triggerConnectionEvent(true, clientConnectionID, info, tcpClientGlobal, socketClientGlobal); + + tcpClient->createSendThread(); + int64 ticks1; + int64 ticks2; + TArray byteDataArray; + TArray byteDataArrayCache; + FString mainMessage; + bool inCollectMessageStatus = false; + int32 lastDataLengthFromHeader = 0; + + + uint32 dataSize; + while (socket != nullptr && tcpClient->isRun()) { + + //ESocketConnectionState::SCS_Connected does not work https://issues.unrealengine.com/issue/UE-27542 + //Compare ticks is a workaround to get a disconnect. clientSocket->Wait() stop working after disconnect. (Another bug?) + //If it doesn't wait any longer, ticks1 and ticks2 should be the same == disconnect. + ticks1 = FDateTime::Now().GetTicks(); + socket->Wait(ESocketWaitConditions::WaitForRead, FTimespan::FromSeconds(1)); + ticks2 = FDateTime::Now().GetTicks(); + + bool hasData = socket->HasPendingData(dataSize); + if (!hasData && ticks1 == ticks2) { + UE_LOG(LogTemp, Display, TEXT("Socket Client: Connection aborted or closed by the server: %s"),*clientConnectionID); + break; + } + + if (hasData) { + TArray dataFromSocket; + dataFromSocket.SetNumUninitialized(dataSize); + int32 BytesRead = 0; + if (socket->Recv(dataFromSocket.GetData(), dataFromSocket.Num(), BytesRead)) { + + switch (messageWrapping) + { + case ESocketClientTCPSeparator::E_None: + triggerMessageEvent(dataFromSocket, clientConnectionIDGlobal, tcpClientGlobal, socketClientGlobal); + break; + + case ESocketClientTCPSeparator::E_ByteSeparator: + + for (int32 i = 0; i < dataFromSocket.Num(); i++) { + byteDataArrayCache.Add(dataFromSocket[i]); + if (dataFromSocket[i] == byteSeparator) { + triggerMessageEvent(byteDataArrayCache, clientConnectionIDGlobal, tcpClientGlobal, socketClientGlobal, false); + byteDataArrayCache.Empty(); + } + } + + break; + + case ESocketClientTCPSeparator::E_StringSeparator: + for (int32 i = 0; i < dataFromSocket.Num(); i++) { + ; + if ((TCHAR)dataFromSocket[i] == stringSeparatorArray[0]) { + bool found = true; + for (int32 j = 1; j < stringSeparatorArray.Num(); j++) { + i++; + if (dataFromSocket.Num() <= (i)) { + found = false; + break; + } + if ((TCHAR)dataFromSocket[i] != stringSeparatorArray[j]) { + found = false; + break; + } + } + if (found) { + triggerMessageEvent(byteDataArrayCache, clientConnectionIDGlobal, tcpClientGlobal, socketClientGlobal, true); + byteDataArrayCache.Empty(); + } + } + else { + byteDataArrayCache.Add(dataFromSocket[i]); + } + } + break; + + case ESocketClientTCPSeparator::E_LengthSeparator: + if (lastDataLengthFromHeader == 0 && dataFromSocket.Num() >= 5) { + + tcpClient->readDataLength(dataFromSocket, lastDataLengthFromHeader); + + if (dataFromSocket.Num() == 5) { + dataFromSocket.Empty(); + continue; + } + + byteDataArrayCache.Append(dataFromSocket.GetData() + 5, dataFromSocket.Num() - 5); + dataFromSocket.Empty(); + } + else { + byteDataArrayCache.Append(dataFromSocket.GetData(), dataFromSocket.Num()); + } + + int32 maxLoops = 1000;//to prevent endless loop + + while (byteDataArrayCache.Num() > 0 && byteDataArrayCache.Num() >= lastDataLengthFromHeader && maxLoops > 0) { + maxLoops--; + + byteDataArray.Append(byteDataArrayCache.GetData(), lastDataLengthFromHeader); + byteDataArrayCache.RemoveAt(0, lastDataLengthFromHeader, true); + + + triggerMessageEvent(byteDataArray, clientConnectionIDGlobal, tcpClientGlobal, socketClientGlobal); + //UE_LOG(LogTemp, Display, TEXT("%s"), *mainMessage); + byteDataArray.Empty(); + + if (byteDataArrayCache.Num() == 0) { + lastDataLengthFromHeader = 0; + break; + } + + if (byteDataArrayCache.Num() > 5) { + tcpClient->readDataLength(byteDataArrayCache, lastDataLengthFromHeader); + byteDataArrayCache.RemoveAt(0, 5, true); + } + + } + break; + } + + + } + mainMessage.Empty(); + byteDataArray.Empty(); + dataFromSocket.Empty(); + } + } + + + info = "Connection close:" + ip + ":" + FString::FromInt(portGlobal) + "|" + clientConnectionIDGlobal; + triggerConnectionEvent(false, clientConnectionID, info, tcpClientGlobal, socketClientGlobal); + } + + + if (socket != nullptr) { + socket->Close(); + } + + if (tcpClient->isRun()) { + socketClientBPLibrary->closeSocketClientConnectionTCPNonStatic(clientConnectionID); + //tcpClient->closeConnection(); + } + } + else { + FString info = "Connection failed(3). IP not valid:" + ip + ":" + FString::FromInt(portGlobal) + "|" + clientConnectionIDGlobal; + triggerConnectionEvent(false, clientConnectionID,info,tcpClientGlobal, socketClientGlobal); + } + + return 0; +} + + +void FSocketClientTCPReceiveDataThread::triggerConnectionEvent(bool succsess, FString clientConnectionIDGlobal, FString serverMessage, USocketClientTCPClient* tcpClientGlobal, USocketClientBPLibrary* socketClientGlobal){ + + AsyncTask(ENamedThreads::GameThread, [succsess, serverMessage, clientConnectionIDGlobal, tcpClientGlobal, socketClientGlobal]() { + if (socketClientGlobal != nullptr) { + socketClientGlobal->onsocketClientTCPConnectionEventDelegate.Broadcast(succsess, serverMessage, clientConnectionIDGlobal); + } + if (tcpClientGlobal != nullptr) { + tcpClientGlobal->onsocketClientTCPConnectionEventDelegate.Broadcast(succsess, serverMessage, clientConnectionIDGlobal); + if (tcpClientGlobal->tcpConnectAsyncNode != nullptr) { + tcpClientGlobal->tcpConnectAsyncNode->triggerConnectionEvent(succsess, clientConnectionIDGlobal, serverMessage); + } + } + }); +} + +void FSocketClientTCPReceiveDataThread::triggerMessageEvent(TArray& byteDataArray, FString& clientConnectionIDGlobal, USocketClientTCPClient* tcpClientGlobal, + USocketClientBPLibrary* socketClientGlobal, bool addNullTerminator) { + + + FString mainMessage = FString(); + if (receiveFilter == EReceiveFilterClient::E_SAB || receiveFilter == EReceiveFilterClient::E_S) { + if (addNullTerminator) + byteDataArray.Add(0x00);// null-terminator + mainMessage = FString(UTF8_TO_TCHAR((char*)byteDataArray.GetData())); + if (receiveFilter == EReceiveFilterClient::E_S) { + byteDataArray.Empty(); + } + } + + //switch to gamethread + AsyncTask(ENamedThreads::GameThread, [mainMessage, byteDataArray, clientConnectionIDGlobal, tcpClientGlobal, socketClientGlobal]() { + if (socketClientGlobal != nullptr) { + socketClientGlobal->onreceiveTCPMessageEventDelegate.Broadcast(mainMessage, byteDataArray, clientConnectionIDGlobal); + } + if (tcpClientGlobal != nullptr) { + tcpClientGlobal->onreceiveTCPMessageEventDelegate.Broadcast(mainMessage, byteDataArray, clientConnectionIDGlobal); + if (tcpClientGlobal->tcpConnectAsyncNode != nullptr) { + tcpClientGlobal->tcpConnectAsyncNode->triggerMessageEvent(byteDataArray, clientConnectionIDGlobal,mainMessage); + } + } + }); + mainMessage.Empty(); +} + diff --git a/InteractiveControl/Plugins/SimpleUDPTCPSocketClient/Source/SocketClient/Private/SocketClientTCPSendDataThread.cpp b/InteractiveControl/Plugins/SimpleUDPTCPSocketClient/Source/SocketClient/Private/SocketClientTCPSendDataThread.cpp new file mode 100644 index 0000000..587fdea --- /dev/null +++ b/InteractiveControl/Plugins/SimpleUDPTCPSocketClient/Source/SocketClient/Private/SocketClientTCPSendDataThread.cpp @@ -0,0 +1,167 @@ +// Copyright 2022 David Romanski (Socke). All Rights Reserved. + +#include "SocketClientTCPSendDataThead.h" + + +FSocketClientTCPSendDataThead::FSocketClientTCPSendDataThead(USocketClientBPLibrary* socketClientLibP, USocketClientTCPClient* tcpClientP, FString clientConnectionIDP) : + socketClientLib(socketClientLibP), + tcpClient(tcpClientP), + clientConnectionID(clientConnectionIDP) { + FString threadName = "FSendDataToServerThread" + FGuid::NewGuid().ToString(); + thread = FRunnableThread::Create(this, *threadName, 0, EThreadPriority::TPri_Normal); +} + +FSocketClientTCPSendDataThead::~FSocketClientTCPSendDataThead() { + delete thread; +} + +uint32 FSocketClientTCPSendDataThead::Run(){ + + if (tcpClient == nullptr) { + UE_LOG(LogTemp, Error, TEXT("Class is not initialized.")); + return 0; + } + + /*if (GEngine) + GEngine->AddOnScreenDebugMessage(-1, 20.0f, FColor::Green, TEXT("tcp socket 1"));*/ + + FString clientConnectionIDGlobal = clientConnectionID; + USocketClientBPLibrary* socketClientLibGlobal = socketClientLib; + + //message wrapping + FString stringSeparator = FString(); + uint8 byteSeparator = 0x00; + ESocketClientTCPSeparator messageWrapping = ESocketClientTCPSeparator::E_None; + tcpClient->getTcpSeparator(stringSeparator, byteSeparator, messageWrapping); + + TArray stringSeparatorArray = stringSeparator.GetCharArray(); + if (stringSeparatorArray.Num() > 0 && stringSeparatorArray.Last() == 0x00) { + stringSeparatorArray.RemoveAt(stringSeparatorArray.Num() - 1, 1, true); + } + + if (messageWrapping == ESocketClientTCPSeparator::E_LengthSeparator && stringSeparatorArray.Num() == 0) { + messageWrapping = ESocketClientTCPSeparator::E_None; + UE_LOG(LogTemp, Warning, TEXT("Socket Client Plugin: Separator mode is set to String but there is no String Separator. Mode changed to none.")); + } + + // get the socket + FSocket* socket = tcpClient->getSocket(); + int32 sent = 0; + + while (tcpClient->isRun()) { + + // try to connect to the server + if (socket == NULL || socket == nullptr) { + UE_LOG(LogTemp, Error, TEXT("Connection not exist.")); + //AsyncTask(ENamedThreads::GameThread, [clientConnectionIDGlobal, socketClientLibGlobal]() { + // if (socketClientLibGlobal != nullptr) { + // socketClientLibGlobal->onsocketClientTCPConnectionEventDelegate.Broadcast(false, "Connection not exist:" + clientConnectionIDGlobal, clientConnectionIDGlobal); + // socketClientLibGlobal->closeSocketClientConnection(); + // } + //}); + break; + } + + if (socket != nullptr && tcpClient->isRun()) { + + while (messageQueue.IsEmpty() == false) { + FString m; + messageQueue.Dequeue(m); + FTCHARToUTF8 Convert(*m); + sent = 0; + + TArray byteCache; + + switch (messageWrapping) + { + case ESocketClientTCPSeparator::E_None: + byteCache.Append((uint8*)Convert.Get(), Convert.Length()); + break; + case ESocketClientTCPSeparator::E_ByteSeparator: + byteCache.Append((uint8*)Convert.Get(), Convert.Length()); + byteCache.Add(byteSeparator); + break; + case ESocketClientTCPSeparator::E_StringSeparator: + { + m += stringSeparator; + FTCHARToUTF8 ConvertWithSeparator(*m); + byteCache.Append((uint8*)ConvertWithSeparator.Get(), ConvertWithSeparator.Length()); + } + break; + case ESocketClientTCPSeparator::E_LengthSeparator: + if (FGenericPlatformProperties::IsLittleEndian()) { + byteCache.Add(0x00); + } + else { + byteCache.Add(0x01); + } + byteCache.SetNum(5); + int32 dataLength = Convert.Length(); + FMemory::Memcpy(byteCache.GetData() + 1, &dataLength, 4); + byteCache.Append((uint8*)Convert.Get(), Convert.Length()); + break; + } + + socket->Send(byteCache.GetData(), byteCache.Num(), sent); + } + + while (byteArrayQueue.IsEmpty() == false) { + + TArray byteCache; + byteArrayQueue.Dequeue(byteCache); + sent = 0; + + switch (messageWrapping) + { + case ESocketClientTCPSeparator::E_ByteSeparator: + byteCache.Add(byteSeparator); + break; + case ESocketClientTCPSeparator::E_StringSeparator: + { + FTCHARToUTF8 ConvertWithSeparator(*stringSeparator); + byteCache.Append((uint8*)ConvertWithSeparator.Get(), ConvertWithSeparator.Length()); + } + break; + case ESocketClientTCPSeparator::E_LengthSeparator: + byteCache.InsertZeroed(0, 5); + if (FGenericPlatformProperties::IsLittleEndian() == false) { + uint8 a = 0x01; + FMemory::Memcpy(byteCache.GetData(), &a, 1); + } + int32 dataLength = byteCache.Num() - 5; + FMemory::Memcpy(byteCache.GetData() + 1, &dataLength, 4); + break; + } + + socket->Send(byteCache.GetData(), byteCache.Num(), sent); + + } + + } + + if (tcpClient->isRun()) { + pauseThread(true); + //workaround. suspend do not work on all platforms. lets sleep + while (paused && tcpClient->isRun()) { + FPlatformProcess::Sleep(0.01); + } + } + } + return 0; +} + + +void FSocketClientTCPSendDataThead::sendMessage(FString messageP, TArray byteArrayP) { + if (messageP.Len() > 0) + messageQueue.Enqueue(messageP); + if (byteArrayP.Num() > 0) + byteArrayQueue.Enqueue(byteArrayP); + pauseThread(false); +} + + +void FSocketClientTCPSendDataThead::pauseThread(bool pause) { + paused = pause; + if (thread != nullptr) + thread->Suspend(pause); +} \ No newline at end of file diff --git a/InteractiveControl/Plugins/SimpleUDPTCPSocketClient/Source/SocketClient/Private/SocketClientUDP.cpp b/InteractiveControl/Plugins/SimpleUDPTCPSocketClient/Source/SocketClient/Private/SocketClientUDP.cpp new file mode 100644 index 0000000..35d9eb4 --- /dev/null +++ b/InteractiveControl/Plugins/SimpleUDPTCPSocketClient/Source/SocketClient/Private/SocketClientUDP.cpp @@ -0,0 +1,148 @@ +// Copyright 2017-2019 David Romanski (Socke). All Rights Reserved. + +#include "SocketClientUDP.h" + + +USocketClientUDP::USocketClientUDP(const FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer) { + this->AddToRoot(); +} + + + +void USocketClientUDP::socketClientUDPConnectionEventDelegate(const bool success, const FString message, const FString clientConnectionIDP){} +void USocketClientUDP::receiveUDPMessageEventDelegate(const FString message, const TArray& byteArray, const FString IPP, const int32 portP, const FString clientConnectionIDP) {} + +void USocketClientUDP::init(USocketClientBPLibrary* socketClientLibP, UUDPInitAsyncNode* udpInitAsyncNodeP, FString domainOrIPP, + ESocketClientIPType ipType, int32 portP, EReceiveFilterClient receiveFilterP, FString connectionIDP, + int32 maxPacketSizeP) { + socketClientBPLibrary = socketClientLibP; + receiveFilter = receiveFilterP; + connectionID = connectionIDP; + domainOrIP = domainOrIPP; + port = portP; + udpInitAsyncNode = udpInitAsyncNodeP; + + maxPacketSize = maxPacketSizeP; + if (maxPacketSize < 1 || maxPacketSize > 65507) + maxPacketSize = 65507; + + UDPThread = new FSocketClientUDPReceiveDataThread(this, socketClientLibP, domainOrIPP, portP, ipType); +} + + +void USocketClientUDP::sendUDPMessage(FString domainOrIPP, ESocketClientIPType ipType, int32 portP, FString message, TArray byteArray){ + if (UDPSendThread != nullptr) { + UDPSendThread->addData(message, byteArray, domainOrIPP, portP, ipType); + } +} + +void USocketClientUDP::closeUDPConnection() { + + if (udpSocketReceiver != nullptr) { + udpSocketReceiver->Stop(); + } + + setRun(false); + if (UDPSendThread != nullptr) { + UDPSendThread->pauseThread(false); + } + + if (socketClientBPLibrary != nullptr) { + FSocketClientPluginSession connectionSession = FSocketClientPluginSession(); + connectionSession.udpSocketReceiver = udpSocketReceiver; + connectionSession.udpSendDataThead = UDPSendThread; + connectionSession.udpReceiveDataThread = UDPThread; + connectionSession.socket = socket; + connectionSession.clientID = connectionID; + socketClientBPLibrary->cleanConnection(connectionSession); + } + + //udpInitAsyncNode = nullptr; +} + + +void USocketClientUDP::UDPReceiver(const FArrayReaderPtr& ArrayReaderPtr, const FIPv4Endpoint& EndPt) { + + if (FSocketClientModule::isShuttingDown) + return; + + TSharedPtr peerAddr = EndPt.ToInternetAddr(); + FString ipGlobal = peerAddr->ToString(false); + int32 portGlobal = peerAddr->GetPort(); + + TArray byteArray; + if (receiveFilter == EReceiveFilterClient::E_SAB || receiveFilter == EReceiveFilterClient::E_B) { + byteArray.Append(ArrayReaderPtr->GetData(), ArrayReaderPtr->Num()); + } + + FString recvMessage; + if (receiveFilter == EReceiveFilterClient::E_SAB || receiveFilter == EReceiveFilterClient::E_S) { + ArrayReaderPtr->Add(0x00);// null-terminator + char* Data = (char*)ArrayReaderPtr->GetData(); + recvMessage = FString(UTF8_TO_TCHAR(Data)); + } + + //switch to gamethread + USocketClientBPLibrary* socketClientBPLibraryGlobal = socketClientBPLibrary; + USocketClientUDP* udpClientGlobal = this; + FString clientConnectionIDGlobal = connectionID; + UUDPInitAsyncNode* udpInitAsyncNodeGlobal = udpInitAsyncNode; + AsyncTask(ENamedThreads::GameThread, [udpInitAsyncNodeGlobal, udpClientGlobal, recvMessage, byteArray, ipGlobal, portGlobal, socketClientBPLibraryGlobal, clientConnectionIDGlobal]() { + if (FSocketClientModule::isShuttingDown) + return; + socketClientBPLibraryGlobal->onreceiveUDPMessageEventDelegate.Broadcast(recvMessage, byteArray, ipGlobal, portGlobal, clientConnectionIDGlobal); + udpClientGlobal->onreceiveUDPMessageEventDelegate.Broadcast(recvMessage, byteArray, ipGlobal, portGlobal, clientConnectionIDGlobal); + if (udpInitAsyncNodeGlobal != nullptr) { + udpInitAsyncNodeGlobal->triggerMessageEvent(byteArray, clientConnectionIDGlobal, recvMessage, ipGlobal, portGlobal); + } + }); +} + +bool USocketClientUDP::isRun(){ + return run; +} + +void USocketClientUDP::setRun(bool runP){ + run = runP; +} + +FSocket* USocketClientUDP::getSocket(){ + return socket; +} + +void USocketClientUDP::setSocket(FSocket* socketP){ + socket = socketP; +} + +void USocketClientUDP::setUDPSocketReceiver(FUdpSocketReceiver* udpSocketReceiverP){ + udpSocketReceiver = udpSocketReceiverP; +} + +FString USocketClientUDP::getIP(){ + return domainOrIP; +} + +void USocketClientUDP::setIP(FString ipP){ + domainOrIP = ipP; +} + +int32 USocketClientUDP::getPort(){ + return port; +} + +FString USocketClientUDP::getDomainOrIP(){ + return domainOrIP; +} + +FString USocketClientUDP::getConnectionID(){ + return connectionID; +} + +void USocketClientUDP::setUDPSendThread(FSocketClientUDPSendDataThead* udpSendThreadP){ + UDPSendThread = udpSendThreadP; +} + +int32 USocketClientUDP::getMaxPacketSize() +{ + return maxPacketSize; +} diff --git a/InteractiveControl/Plugins/SimpleUDPTCPSocketClient/Source/SocketClient/Private/SocketClientUDPReceiveDataThread.cpp b/InteractiveControl/Plugins/SimpleUDPTCPSocketClient/Source/SocketClient/Private/SocketClientUDPReceiveDataThread.cpp new file mode 100644 index 0000000..b02fa65 --- /dev/null +++ b/InteractiveControl/Plugins/SimpleUDPTCPSocketClient/Source/SocketClient/Private/SocketClientUDPReceiveDataThread.cpp @@ -0,0 +1,117 @@ +// Copyright 2022 David Romanski (Socke). All Rights Reserved. + +#include "SocketClientUDPReceiveDataThread.h" + + +FSocketClientUDPReceiveDataThread::FSocketClientUDPReceiveDataThread(USocketClientUDP* udpClientP, USocketClientBPLibrary* socketClientP, FString ipP, int32 portP, ESocketClientIPType ipTypeP) : + udpClient(udpClientP), + socketClient(socketClientP), + ipGlobal(ipP), + portGlobal(portP), + ipType(ipTypeP) { + FString threadName = "FServerUDPConnectionThread_" + FGuid::NewGuid().ToString(); + thread = FRunnableThread::Create(this, *threadName, 0, EThreadPriority::TPri_Normal); +} + +FSocketClientUDPReceiveDataThread::~FSocketClientUDPReceiveDataThread() { + if (udpClient != nullptr && udpClient->udpInitAsyncNode != nullptr) { + udpClient->udpInitAsyncNode = nullptr; + } + delete thread; +} + +void FSocketClientUDPReceiveDataThread::triggerInitEvent(bool success, USocketClientUDP* udpClientP, USocketClientBPLibrary* socketClientP, + FString serverMessage, FString connectionID){ + AsyncTask(ENamedThreads::GameThread, [success, udpClientP, socketClientP, serverMessage, connectionID]() { + if (socketClientP != nullptr) + socketClientP->onsocketClientUDPConnectionEventDelegate.Broadcast(success, serverMessage, connectionID); + if (udpClientP != nullptr) { + udpClientP->onsocketClientUDPConnectionEventDelegate.Broadcast(success, serverMessage, connectionID); + if (udpClientP->udpInitAsyncNode != nullptr) { + udpClientP->udpInitAsyncNode->triggerInitEvent(success, connectionID, serverMessage); + } + } + }); +} + +uint32 FSocketClientUDPReceiveDataThread::Run() { + + USocketClientUDP* udpClientGlobal = udpClient; + FString ip = socketClient->resolveDomain(ipGlobal, ipType); + udpClient->setIP(ip); + int32 port = portGlobal; + FString connectionID = udpClient->getConnectionID(); + + + if (socket == nullptr || socket == NULL) { + + FString endpointAdress = ip + ":" + FString::FromInt(port); + FIPv4Endpoint Endpoint; + + // create the socket + FString socketName; + ISocketSubsystem* socketSubsystem = USocketClientBPLibrary::getSocketSubSystem(); + + TSharedPtr addr = socketSubsystem->CreateInternetAddr(); + bool validIP = true; + addr->SetPort(port); + addr->SetIp(*ip, validIP); + + + if (!validIP) { + UE_LOG(LogTemp, Error, TEXT("SocketClient UDP. Can't set ip")); + triggerInitEvent(false, udpClient, socketClient, "SocketClient UDP. Can't set ip", connectionID); + return 0; + } + + socket = socketSubsystem->CreateSocket(NAME_DGram, *socketName, addr->GetProtocolType()); + + + if (socket == nullptr || socket == NULL) { + const TCHAR* SocketErr = socketSubsystem->GetSocketError(SE_GET_LAST_ERROR_CODE); + UE_LOG(LogTemp, Error, TEXT("UE could not init a UDP socket. You can only create listening connections on local IPs. An external IP must be redirected to a local IP in your router. %s:%i. Error: %s"), *ip, port, SocketErr); + triggerInitEvent(false, udpClient, socketClient, "(Error 0) UE could not init a UDP socket. You can only create listening connections on local IPs. An external IP must be redirected to a local IP in your router." + addr->ToString(true) + " Error:" + SocketErr, connectionID); + return 0; + } + + if (!socket->SetRecvErr()) { + UE_LOG(LogTemp, Error, TEXT("SocketClient UDP. Can't set recverr")); + } + + + if (socket == nullptr || socket == NULL || !validIP) { + const TCHAR* SocketErr = socketSubsystem->GetSocketError(SE_GET_LAST_ERROR_CODE); + UE_LOG(LogTemp, Error, TEXT("UE could not init a UDP socket. You can only create listening connections on local IPs. An external IP must be redirected to a local IP in your router. %s:%i. Error: %s"), *ip, port, SocketErr); + triggerInitEvent(false, udpClient, socketClient, "(Error 1) UE could not init a UDP socket. You can only create listening connections on local IPs. An external IP must be redirected to a local IP in your router." + addr->ToString(true) + " Error:" + SocketErr, connectionID); + return 0; + } + socket->SetReuseAddr(true); + socket->SetNonBlocking(true); + socket->SetBroadcast(true); + + if (!socket->Bind(*addr)) { + const TCHAR* SocketErr = socketSubsystem->GetSocketError(SE_GET_LAST_ERROR_CODE); + UE_LOG(LogTemp, Error, TEXT("UE could not init a UDP socket. You can only create listening connections on local IPs. An external IP must be redirected to a local IP in your router. %s:%i. Error: %s"), *ip, port, SocketErr); + triggerInitEvent(false, udpClient, socketClient, "(Error 2) UE could not init a UDP socket. You can only create listening connections on local IPs. An external IP must be redirected to a local IP in your router." + addr->ToString(true) + " Error:" + SocketErr, connectionID); + return 0; + } + + + + FTimespan ThreadWaitTime = FTimespan::FromMilliseconds(100); + FUdpSocketReceiver* udpSocketReceiver = new FUdpSocketReceiver(socket, ThreadWaitTime, TEXT("SocketClientBPLibUDPReceiverThread")); + udpSocketReceiver->OnDataReceived().BindUObject(udpClient, &USocketClientUDP::UDPReceiver); + udpSocketReceiver->Start(); + udpClient->setUDPSocketReceiver(udpSocketReceiver); + + udpClient->setSocket(socket); + udpClient->setRun(true); + udpClient->setUDPSendThread(new FSocketClientUDPSendDataThead(udpClient, socketClient, ip, port)); + + + triggerInitEvent(true, udpClient, socketClient, "Init UDP Connection OK. " + addr->ToString(true), connectionID); + + } + thread = nullptr; + return 0; +} \ No newline at end of file diff --git a/InteractiveControl/Plugins/SimpleUDPTCPSocketClient/Source/SocketClient/Private/SocketClientUDPSendDataThead.cpp b/InteractiveControl/Plugins/SimpleUDPTCPSocketClient/Source/SocketClient/Private/SocketClientUDPSendDataThead.cpp new file mode 100644 index 0000000..c5178a6 --- /dev/null +++ b/InteractiveControl/Plugins/SimpleUDPTCPSocketClient/Source/SocketClient/Private/SocketClientUDPSendDataThead.cpp @@ -0,0 +1,146 @@ +// Copyright 2022 David Romanski (Socke). All Rights Reserved. + +#include "SocketClientUDPSendDataThead.h" + +FSocketClientUDPSendDataThead::FSocketClientUDPSendDataThead(USocketClientUDP* udpClientP, USocketClientBPLibrary* socketClientP, FString mySocketipP, int32 mySocketportP) : + udpClient(udpClientP), + socketClient(socketClientP), + mySocketip(mySocketipP), + mySocketport(mySocketportP) { + FString threadName = "FServerUDPSendMessageThread_" + FGuid::NewGuid().ToString(); + thread = FRunnableThread::Create(this, *threadName, 0, EThreadPriority::TPri_Normal); +} + +FSocketClientUDPSendDataThead::~FSocketClientUDPSendDataThead() { + delete thread; +} + +uint32 FSocketClientUDPSendDataThead::Run() { + + FSocket* socket = udpClient->getSocket(); + FString connectionID = udpClient->getConnectionID(); + maxPacketSize = udpClient->getMaxPacketSize(); + + while (udpClient->isRun() && socket != nullptr) { + + + if (udpClient->isRun() && (messageQueue.IsEmpty() == false || byteArrayQueue.IsEmpty() == false)) { + + int32 sent = 0; + TArray byteArray; + if (validInternetAdress) { + while (messageQueue.IsEmpty() == false) { + FString m; + messageQueue.Dequeue(m); + FTCHARToUTF8 Convert(*m); + byteArray.Append((uint8*)Convert.Get(), Convert.Length()); + sendBytes(socket, byteArray, sent, internetAdress); + } + + while (byteArrayQueue.IsEmpty() == false) { + byteArrayQueue.Dequeue(byteArray); + sendBytes(socket, byteArray, sent, internetAdress); + } + + } + else { + UE_LOG(LogTemp, Error, TEXT("Can't send to %s:%i . Adress not valid."), *sendToip, sendToport); + } + + } + + if (udpClient->isRun()) { + pauseThread(true); + //workaround. suspend do not work on all platforms. lets sleep + while (paused && udpClient->isRun()) { + FPlatformProcess::Sleep(0.01); + } + } + } + + if (socket != nullptr) { + socket->Close(); + socket = nullptr; + udpClient->setSocket(nullptr); + } + + + USocketClientBPLibrary* socketClientTMP = socketClient; + USocketClientUDP* udpClientGlobal = udpClient; + FString ipGlobal = mySocketip; + int32 portGlobal = mySocketport; + AsyncTask(ENamedThreads::GameThread, [socketClientTMP, udpClientGlobal, ipGlobal, portGlobal, connectionID]() { + if (socketClientTMP != nullptr) + socketClientTMP->onsocketClientUDPConnectionEventDelegate.Broadcast(false, "UDP connection closed. " + ipGlobal + ":" + FString::FromInt(portGlobal), connectionID); + if (udpClientGlobal != nullptr) + udpClientGlobal->onsocketClientUDPConnectionEventDelegate.Broadcast(false, "UDP connection closed. " + ipGlobal + ":" + FString::FromInt(portGlobal), connectionID); + }); + + + thread = nullptr; + return 0; +} + + +void FSocketClientUDPSendDataThead::addData(FString messageP, TArray byteArrayP, FString domainOrIP, int32 port, ESocketClientIPType ipType) { + + //new adress? + if (sendToport != port || sendToDomainOrIP.Equals(domainOrIP) == false) { + + sendToDomainOrIP = domainOrIP; + sendToip = socketClient->resolveDomain(domainOrIP, ipType); + sendToport = port; + + internetAdress->SetIp(*sendToip, validInternetAdress); + internetAdress->SetPort(sendToport); + if (!validInternetAdress) { + //don't send to many error messages. one second = 10000000 ticks + if (((FDateTime::Now().GetTicks()) - lastErrorMessageTime) >= 10000000) { + UE_LOG(LogTemp, Error, TEXT("Can't create Adress %s:%i"), *sendToip, sendToport); + lastErrorMessageTime = FDateTime::Now().GetTicks(); + } + return; + } + } + if (!validInternetAdress) { + return; + } + + if (messageP.Len() > 0) + messageQueue.Enqueue(messageP); + if (byteArrayP.Num() > 0) + byteArrayQueue.Enqueue(byteArrayP); + pauseThread(false); + +} + +void FSocketClientUDPSendDataThead::pauseThread(bool pause) { + paused = pause; + if (thread != nullptr) + thread->Suspend(pause); +} + +void FSocketClientUDPSendDataThead::sendBytes(FSocket*& socketP, TArray& byteArray, int32& sent, TSharedRef& addr) { + if (byteArray.Num() > maxPacketSize) { + TArray byteArrayTemp; + for (int32 i = 0; i < byteArray.Num(); i++) { + byteArrayTemp.Add(byteArray[i]); + if (byteArrayTemp.Num() == maxPacketSize) { + sent = 0; + socketP->SendTo(byteArrayTemp.GetData(), byteArrayTemp.Num(), sent, *addr); + byteArrayTemp.Empty(); + } + } + if (byteArrayTemp.Num() > 0) { + sent = 0; + socketP->SendTo(byteArrayTemp.GetData(), byteArrayTemp.Num(), sent, *addr); + byteArrayTemp.Empty(); + } + } + else { + sent = 0; + socketP->SendTo(byteArray.GetData(), byteArray.Num(), sent, *addr); + } + + byteArray.Empty(); +} \ No newline at end of file diff --git a/InteractiveControl/Plugins/SimpleUDPTCPSocketClient/Source/SocketClient/Public/DNSClientSocketClient.h b/InteractiveControl/Plugins/SimpleUDPTCPSocketClient/Source/SocketClient/Public/DNSClientSocketClient.h new file mode 100644 index 0000000..b636c91 --- /dev/null +++ b/InteractiveControl/Plugins/SimpleUDPTCPSocketClient/Source/SocketClient/Public/DNSClientSocketClient.h @@ -0,0 +1,28 @@ +// Copyright 2017-2019 David Romanski (Socke). All Rights Reserved. + +#pragma once + +#include "SocketClient.h" +#include "DNSClientSocketClient.generated.h" + +UCLASS() +class SOCKETCLIENT_API UDNSClientSocketClient : public UObject +{ + GENERATED_UCLASS_BODY() + +public: + void resolveDomain(ISocketSubsystem* socketSubSystem, FString domain, bool useDNSCache = true, FString dnsIP = FString("8.8.8.8")); + + void UDPReceiver(const FArrayReaderPtr& ArrayReaderPtr, const FIPv4Endpoint& EndPt); + + FSocket* socket = nullptr; + + bool isResloving(); + FString getIP(); + +private: + bool resolving; + FString ip; + FString domain; + TMap dnsCache; +}; \ No newline at end of file diff --git a/InteractiveControl/Plugins/SimpleUDPTCPSocketClient/Source/SocketClient/Public/FileFunctionsSocketClient.h b/InteractiveControl/Plugins/SimpleUDPTCPSocketClient/Source/SocketClient/Public/FileFunctionsSocketClient.h new file mode 100644 index 0000000..47d7bcf --- /dev/null +++ b/InteractiveControl/Plugins/SimpleUDPTCPSocketClient/Source/SocketClient/Public/FileFunctionsSocketClient.h @@ -0,0 +1,271 @@ +// Copyright 2017-2019 David Romanski (Socke). All Rights Reserved. +#pragma once + +#include "SocketClient.h" +#include "SocketClientBPLibrary.h" +#include "FileFunctionsSocketClient.generated.h" + +class FReadFileInPartsSocketClientThread; + + +UCLASS(Blueprintable, BlueprintType) +class SOCKETCLIENT_API UFileFunctionsSocketClient : public UObject +{ + GENERATED_UCLASS_BODY() + +public: + + UFUNCTION() + static UFileFunctionsSocketClient* getFileFunctionsSocketClientTarget(); + static UFileFunctionsSocketClient* fileFunctionsSocketClient; + + + + + static FString getCleanDirectory(EFileFunctionsSocketClientDirectoryType directoryType, FString filePath); + + UFUNCTION(BlueprintCallable, Category = "SocketClient|SpecialFunctions|File") + static void writeBytesToFile(EFileFunctionsSocketClientDirectoryType directoryType, FString filePath, TArray bytes, bool& success); + UFUNCTION(BlueprintCallable, Category = "SocketClient|SpecialFunctions|File") + static void addBytesToFileAndCloseIt(EFileFunctionsSocketClientDirectoryType directoryType, FString filePath, TArray bytes, bool& success); + //UFUNCTION(BlueprintCallable, Category = "SocketClient|SpecialFunctions|File") + // static void splittFile(EFileFunctionsSocketClientDirectoryType directoryType, FString filePath, int32 parts, bool& success); + UFUNCTION(BlueprintCallable, Category = "SocketClient|SpecialFunctions|File") + static TArray readBytesFromFile(EFileFunctionsSocketClientDirectoryType directoryType, FString filePath, bool &success); + UFUNCTION(BlueprintCallable, Category = "SocketClient|SpecialFunctions|File") + static void readStringFromFile(EFileFunctionsSocketClientDirectoryType directoryType, FString filePath, bool& success, FString& data); + UFUNCTION(BlueprintCallable, Category = "SocketClient|SpecialFunctions|File") + static void writeStringToFile(EFileFunctionsSocketClientDirectoryType directoryType, FString data, FString filePath, EFileFunctionsSocketClientEncodingOptions fileEncoding, bool& success); + UFUNCTION(BlueprintCallable, Category = "SocketClient|SpecialFunctions|File") + static void getMD5FromFile(EFileFunctionsSocketClientDirectoryType directoryType, FString filePath, bool& success, FString& MD5); + UFUNCTION(BlueprintCallable, Category = "SocketClient|SpecialFunctions|File") + static void getMD5FromFileAbsolutePath(FString filePath, bool& success, FString& MD5); + UFUNCTION(BlueprintCallable, Category = "SocketClient|SpecialFunctions|File") + static void stringToBase64String(FString string, FString& base64String); + UFUNCTION(BlueprintCallable, Category = "SocketClient|SpecialFunctions|File") + static void base64StringToString(FString& string, FString base64String); + UFUNCTION(BlueprintCallable, Category = "SocketClient|SpecialFunctions|File") + static void bytesToBase64String(TArray bytes, FString& base64String); + UFUNCTION(BlueprintCallable, Category = "SocketClient|SpecialFunctions|File") + static TArray base64StringToBytes(FString base64String, bool& success); + UFUNCTION(BlueprintCallable, Category = "SocketClient|SpecialFunctions|File") + static void fileToBase64String(EFileFunctionsSocketClientDirectoryType directoryType, FString filePath, bool& success, FString& base64String, FString& fileName); + UFUNCTION(BlueprintCallable, Category = "SocketClient|SpecialFunctions|File") + static bool fileExists(EFileFunctionsSocketClientDirectoryType directoryType, FString filePath); + UFUNCTION(BlueprintCallable, Category = "SocketClient|SpecialFunctions|File") + static bool fileExistsAbsolutePath(FString filePath); + UFUNCTION(BlueprintCallable, Category = "SocketClient|SpecialFunctions|File") + static bool directoryExists(EFileFunctionsSocketClientDirectoryType directoryType, FString path); + UFUNCTION(BlueprintCallable, Category = "SocketClient|SpecialFunctions|File") + static int64 fileSize(EFileFunctionsSocketClientDirectoryType directoryType, FString filePath); + UFUNCTION(BlueprintCallable, Category = "SocketClient|SpecialFunctions|File") + static int64 fileSizeAbsolutePath(FString filePath); + UFUNCTION(BlueprintCallable, Category = "SocketClient|SpecialFunctions|File") + static bool deleteFile(EFileFunctionsSocketClientDirectoryType directoryType, FString filePath); + UFUNCTION(BlueprintCallable, Category = "SocketServer|SpecialFunctions|File") + static bool deleteFileAbsolutePath(FString filePath); + /** Delete a directory and return true if the directory was deleted or otherwise does not exist. **/ + UFUNCTION(BlueprintCallable, Category = "SocketClient|SpecialFunctions|File") + static bool deleteDirectory(EFileFunctionsSocketClientDirectoryType directoryType, FString filePath); + /** Return true if the file is read only. **/ + UFUNCTION(BlueprintCallable, Category = "SocketClient|SpecialFunctions|File") + static bool isReadOnly(EFileFunctionsSocketClientDirectoryType directoryType, FString filePath); + /** Attempt to move a file. Return true if successful. Will not overwrite existing files. **/ + UFUNCTION(BlueprintCallable, Category = "SocketClient|SpecialFunctions|File") + static bool moveFile(EFileFunctionsSocketClientDirectoryType directoryTypeTo, FString filePathTo, EFileFunctionsSocketClientDirectoryType directoryTypeFrom, FString filePathFrom); + /** Attempt to change the read only status of a file. Return true if successful. **/ + UFUNCTION(BlueprintCallable, Category = "SocketClient|SpecialFunctions|File") + static bool setReadOnly(EFileFunctionsSocketClientDirectoryType directoryType, FString filePath, bool bNewReadOnlyValue); + /** Return the modification time of a file. Returns FDateTime::MinValue() on failure **/ + UFUNCTION(BlueprintCallable, Category = "SocketClient|SpecialFunctions|File") + static FDateTime getTimeStamp(EFileFunctionsSocketClientDirectoryType directoryType, FString filePath); + /** Sets the modification time of a file **/ + UFUNCTION(BlueprintCallable, Category = "SocketClient|SpecialFunctions|File") + static void setTimeStamp(EFileFunctionsSocketClientDirectoryType directoryType, FString filePath, FDateTime DateTime); + /** Return the last access time of a file. Returns FDateTime::MinValue() on failure **/ + UFUNCTION(BlueprintCallable, Category = "SocketClient|SpecialFunctions|File") + static FDateTime getAccessTimeStamp(EFileFunctionsSocketClientDirectoryType directoryType, FString filePath); + /** For case insensitive filesystems, returns the full path of the file with the same case as in the filesystem */ + UFUNCTION(BlueprintCallable, Category = "SocketClient|SpecialFunctions|File") + static FString getFilenameOnDisk(EFileFunctionsSocketClientDirectoryType directoryType, FString filePath); + /** Create a directory and return true if the directory was created or already existed. **/ + UFUNCTION(BlueprintCallable, Category = "SocketClient|SpecialFunctions|File") + static bool createDirectory(EFileFunctionsSocketClientDirectoryType directoryType, FString path); + UFUNCTION(BlueprintCallable, Category = "SocketClient|SpecialFunctions|File") + static void getAllFilesFromDirectory(EFileFunctionsSocketClientDirectoryType directoryType, FString filePath, int32& count, TArray& files, TArray& filePaths, FString fileType ="*.*"); + + + + /** + * Encrypts an file with AES in 256bit + * @param filePath The path must contain the file at the end. + * @param newFileName New name for the encrypted file without path. It can also take the same name of the unencrypted file. But the file will be overwritten. Possible data loss. + * @param keyIn256Bit The key must be a string with 32 characters. Please use ANSI characters only! + * @param writeEncryptedFileSizeToFile To decrypt the file correctly the size of the original file is needed. With true the size is written as int64 (8 byte) at the beginning of the file. + */ + UFUNCTION(BlueprintCallable, Category = "SocketClient|SpecialFunctions|AES") + static bool encryptFileWithAES(EFileFunctionsSocketClientDirectoryType directoryType, FString filePath, FString newFileName, FString keyIn256Bit, bool writeEncryptedFileSizeToFile = true); + + /** + * Decrypts an file that has been encrypted in AES with 256bit + * @param filePath The path must contain the file at the end. + * @param newFileName New name for the decrypted file without path. It can also take the same name of the dencrypted file. But the file will be overwritten. Possible data loss. + * @param keyIn256Bit The key must be a string with 32 characters. Please use ANSI characters only! + * @param hasEncryptedFileSizeInFile To decrypt the file correctly the size of the original file is needed. With true the size is read from the first 8 bytes in the file. + * @param originalFileSize To decrypt the file correctly the size of the original file is needed. If the size of the original file is not in the first bytes of the file, you must specify it here. + */ + UFUNCTION(BlueprintCallable, Category = "SocketClient|SpecialFunctions|AES") + static bool decryptFileWithAES(EFileFunctionsSocketClientDirectoryType directoryType, FString filePath, FString newFileName, FString keyIn256Bit, bool hasEncryptedFileSizeInFile = true, int64 originalFileSize = 0); + + /** + * Encrypts a string with AES in 256bit and returns the encrypted string as Base64 string. + * @param message The string to be encrypted + * @param keyIn256Bit The key must be a string with 32 characters. Please use ANSI characters only! + */ + UFUNCTION(BlueprintCallable, Category = "SocketClient|SpecialFunctions|AES") + static FString encryptMessageWithAES(FString message, FString keyIn256Bit); + + /** + * Decrypts a Base64 string that has been encrypted in AES with 256bit and returns the string. + * @param message The string to be decrypted + * @param keyIn256Bit The key must be a string with 32 characters. Please use ANSI characters only! + */ + UFUNCTION(BlueprintCallable, Category = "SocketClient|SpecialFunctions|AES") + static FString decryptMessageWithAES(FString encryptedBase64Message, FString keyIn256Bit); + + UFUNCTION(BlueprintCallable, BlueprintPure, Category = "SocketClient|SpecialFunctions|String") + static FString int64ToString(int64 num); + + + + UFUNCTION(BlueprintCallable, Category = "SocketClient|SpecialFunctions|File") + static struct FFileFunctionsSocketClientOpenFile openFile(EFileFunctionsSocketClientDirectoryType directoryType, FString filePath); + UFUNCTION(BlueprintCallable, Category = "SocketClient|SpecialFunctions|File") + static int64 addBytesToFile(struct FFileFunctionsSocketClientOpenFile openFile, TArraybytes); + UFUNCTION(BlueprintCallable, Category = "SocketClient|SpecialFunctions|File") + static void closeFile(struct FFileFunctionsSocketClientOpenFile openFile); + + /** + * With this function you can read a file piece by piece. This reduces the RAM consumption to almost zero and files can be read in infinite size. + *@param bufferSize In bytes. This is the size of the file pieces that are being read. + *@param delayBetweenReadsInSeconds Specified in seconds. The higher the value, the slower the file is read (0.0001 minimum). When sending data over the network/internet, please make sure not to send data too fast. SSDs can read data much faster than you can send it over a network. This means that the data ends up in some buffers (RAM) and can also cause them to overflow. + */ + UFUNCTION(BlueprintCallable, Category = "SocketClient|SpecialFunctions|File", meta = (AdvancedDisplay = 2)) + static void readBytesFromFileInPartsAsync(EFileFunctionsSocketClientDirectoryType directoryType, FString filePath, int32 bufferSize = 65536, float delayBetweenReadsInSeconds = 0.01f); + void readBytesFromFileInPartsAsyncInternal(EFileFunctionsSocketClientDirectoryType directoryType, FString filePath, int32 bufferSize = 65536, float delayBetweenReadsInSeconds = 0.01f); + UFUNCTION(BlueprintCallable, Category = "SocketClient|SpecialFunctions|File") + static void cancelReadBytesFromFileInParts(EFileFunctionsSocketClientDirectoryType directoryType, FString filePath); + void cancelReadBytesFromFileInPartsInternal(EFileFunctionsSocketClientDirectoryType directoryType, FString filePath); + void cleanReadBytesFromFileInParts(FString cleanDir); + //UFUNCTION(BlueprintCallable, Category = "SocketClient|SpecialFunctions|File") + // static void changeDelayInBytesFromFileInParts(EFileFunctionsSocketClientDirectoryType directoryType, FString filePath, float delayBetweenReadsInSeconds = 0.1f); + //void changeDelayInBytesFromFileInPartsInternal(EFileFunctionsSocketClientDirectoryType directoryType, FString filePath, float delayBetweenReadsInSeconds = 0.1f); + + + TMap readFileInPartsThreads; + +private: + static TArray FStringToByteArray(FString s); + + +}; + +/* asynchronous Thread*/ +class SOCKETCLIENT_API FReadFileInPartsSocketClientThread : public FRunnable { + +public: + + FReadFileInPartsSocketClientThread(FString cleanDirP, int32 bufferSizeP, float delayBetweenReadsInSecondsP) : + cleanDir(cleanDirP), + bufferSize(bufferSizeP), + delayBetweenReadsInSeconds(delayBetweenReadsInSecondsP) + { + FString threadName = "FReadFileInPartsSocketClientThread" + FGuid::NewGuid().ToString(); + thread = FRunnableThread::Create(this, *threadName, 0, EThreadPriority::TPri_Normal); + } + + virtual uint32 Run() override { + + FArchive* reader = IFileManager::Get().CreateFileReader(*cleanDir); + if (reader == nullptr || reader->TotalSize() == 0) { + AsyncTask(ENamedThreads::GameThread, []() { + USocketClientBPLibrary::getSocketClientTarget()->onreadBytesFromFileInPartsEventDelegate.Broadcast(0, 0, true, TArray()); + }); + if (reader != nullptr) { + reader->Close(); + } + delete reader; + return 0; + } + + if (delayBetweenReadsInSeconds <= 0) { + delayBetweenReadsInSeconds = 0.0001f; + } + + int64 fileSize = reader->TotalSize(); + int64 readSize = 0; + int64 lastPosition = 0; + TArray buffer; + + if (bufferSize > fileSize) { + bufferSize = fileSize; + } + + while (run && lastPosition < fileSize) { + if ((lastPosition + bufferSize) > fileSize) { + bufferSize = fileSize - lastPosition; + } + + //buffer.Reset(bufferSize); + buffer.Empty(); + buffer.AddUninitialized(bufferSize); + + reader->Serialize(buffer.GetData(), buffer.Num()); + lastPosition += buffer.Num(); + + //UE_LOG(LogTemp, Warning, TEXT("xxxxx READ: %i"), buffer.Num()); + + + AsyncTask(ENamedThreads::GameThread, [fileSize, lastPosition, buffer]() { + USocketClientBPLibrary::getSocketClientTarget()->onreadBytesFromFileInPartsEventDelegate.Broadcast(fileSize, lastPosition, false, buffer); + }); + + FPlatformProcess::Sleep(delayBetweenReadsInSeconds); + + } + + AsyncTask(ENamedThreads::GameThread, [fileSize, lastPosition]() { + USocketClientBPLibrary::getSocketClientTarget()->onreadBytesFromFileInPartsEventDelegate.Broadcast(fileSize, lastPosition, true, TArray()); + }); + + UFileFunctionsSocketClient::getFileFunctionsSocketClientTarget()->cleanReadBytesFromFileInParts(cleanDir); + //buffer.Empty(); + if (reader != nullptr) { + reader->Close(); + } + delete reader; + thread = nullptr; + return 0; + } + + void stopThread() { + run = false; + } + + void setDelayBetweenReadsInSeconds(float d) { + delayBetweenReadsInSeconds = d; + if (delayBetweenReadsInSeconds <= 0) { + delayBetweenReadsInSeconds = 0.001f; + } + } + + +protected: + bool run = true; + FString cleanDir; + int32 bufferSize; + float delayBetweenReadsInSeconds; + //USocketClientBPLibrary* mainLib = USocketClientBPLibrary::getSocketClientTarget(); + + FRunnableThread* thread = nullptr; +}; diff --git a/InteractiveControl/Plugins/SimpleUDPTCPSocketClient/Source/SocketClient/Public/SocketClient.h b/InteractiveControl/Plugins/SimpleUDPTCPSocketClient/Source/SocketClient/Public/SocketClient.h new file mode 100644 index 0000000..92d3ded --- /dev/null +++ b/InteractiveControl/Plugins/SimpleUDPTCPSocketClient/Source/SocketClient/Public/SocketClient.h @@ -0,0 +1,179 @@ +// Copyright 2017-2019 David Romanski (Socke). All Rights Reserved. + +#pragma once + +#include "CoreMinimal.h" +#include "Sockets.h" +#include "SocketSubsystem.h" +#include "Interfaces/IPv4/IPv4Endpoint.h" +#include "Common/UdpSocketReceiver.h" +#include "Common/UdpSocketBuilder.h" +#include "GameFramework/PlayerController.h" +#include "Engine/LocalPlayer.h" +#include "Kismet/BlueprintFunctionLibrary.h" +#include "Kismet/BlueprintAsyncActionBase.h" +#include "Async/Async.h" +#include "HAL/PlatformFileManager.h" +#include "HAL/FileManager.h" +#include "Containers/Queue.h" +#include "Misc/FileHelper.h" +#include "Misc/Paths.h" +#include "Misc/Base64.h" +#include "Misc/SecureHash.h" +#include "Misc/AES.h" +#include "Modules/ModuleManager.h" +#include "Runtime/Launch/Resources/Version.h" +#if ENGINE_MAJOR_VERSION == 5 & ENGINE_MINOR_VERSION >= 2 +#include "IPAddressAsyncResolve.h" +#endif +#include "SocketClient.generated.h" + + +class FSocketClientTCPReceiveDataThread; +class FSocketClientTCPSendDataThead; + +class FSocketClientTCPFileHandlerThread; + +class FUdpSocketReceiver; +class FSocketClientUDPReceiveDataThread; +class FSocketClientUDPSendDataThead; + +class UTCPConnectAsyncNode; +class UUDPInitAsyncNode; + +USTRUCT(BlueprintType) +struct FFileFunctionsSocketClientOpenFile +{ + GENERATED_USTRUCT_BODY() + + FArchive* writer = nullptr; + +}; + +USTRUCT() +struct FSocketClientPluginSession +{ + GENERATED_USTRUCT_BODY() + + int64 addToCleanerTime = 0; + FString clientID = FString(); + FSocket* socket = nullptr; + + FSocketClientTCPSendDataThead* tcpSendThread = nullptr; + FSocketClientTCPReceiveDataThread* tcpRecieverThread = nullptr; + + FSocketClientTCPFileHandlerThread* tcpFileHandlerThread = nullptr; + + FUdpSocketReceiver* udpSocketReceiver = nullptr; + FSocketClientUDPSendDataThead* udpSendDataThead = nullptr; + FSocketClientUDPReceiveDataThread* udpReceiveDataThread = nullptr; + +}; + + +UENUM(BlueprintType) +enum class EFileFunctionsSocketClientDirectoryType : uint8 +{ + E_gd UMETA(DisplayName = "Game directory"), + E_ad UMETA(DisplayName = "Absolute directory") +}; + + +UENUM(BlueprintType) +enum class EFileFunctionsSocketClientEncodingOptions : uint8 +{ + E_AutoDetect UMETA(DisplayName = "AutoDetect"), + E_ForceAnsi UMETA(DisplayName = "ForceAnsi"), + E_ForceUnicode UMETA(DisplayName = "ForceUnicode"), + E_ForceUTF8 UMETA(DisplayName = "ForceUTF8"), + E_ForceUTF8WithoutBOM UMETA(DisplayName = "ForceUTF8WithoutBOM") +}; + +UENUM(BlueprintType) +enum class EReceiveFilterClient : uint8 +{ + E_SAB UMETA(DisplayName = "Message And Bytes"), + E_S UMETA(DisplayName = "Message"), + E_B UMETA(DisplayName = "Bytes") + +}; + + +UENUM(BlueprintType) +enum class ESocketPlatformClient : uint8 +{ + E_SSC_SYSTEM UMETA(DisplayName = "System"), + E_SSC_DEFAULT UMETA(DisplayName = "Auto"), + E_SSC_WINDOWS UMETA(DisplayName = "WINDOWS"), + E_SSC_MAC UMETA(DisplayName = "MAC"), + E_SSC_IOS UMETA(DisplayName = "IOS"), + E_SSC_UNIX UMETA(DisplayName = "UNIX"), + E_SSC_ANDROID UMETA(DisplayName = "ANDROID"), + E_SSC_PS4 UMETA(DisplayName = "PS4"), + E_SSC_XBOXONE UMETA(DisplayName = "XBOXONE"), + E_SSC_HTML5 UMETA(DisplayName = "HTML5"), + E_SSC_SWITCH UMETA(DisplayName = "SWITCH") + +}; + +UENUM(BlueprintType) +enum class ESocketClientIPType : uint8 +{ + E_ipv4 UMETA(DisplayName = "IPv4"), + E_ipv6 UMETA(DisplayName = "IPv6") +}; + + +UENUM(BlueprintType) +enum class ESocketClientTCPSeparator : uint8 +{ + E_None UMETA(DisplayName = "None"), + E_ByteSeparator UMETA(DisplayName = "Separate via one Byte"), + E_StringSeparator UMETA(DisplayName = "Separate via String"), + E_LengthSeparator UMETA(DisplayName = "Separate by Length") + +}; + + + + +#ifndef __FileFunctionsSocketClient +#define __FileFunctionsSocketClient +#include "FileFunctionsSocketClient.h" +#endif + +#ifndef __SocketClientCleanerThread +#define __SocketClientCleanerThread +#include "SocketClientCleanerThread.h" +#endif + +#ifndef __SocketClientAsyncNodes +#define __SocketClientAsyncNodes +#include "SocketClientAsyncNodes.h" +#endif + +#ifndef __SocketClientBPLibrary +#define __SocketClientBPLibrary +#include "SocketClientBPLibrary.h" +#endif + +#ifndef __SocketClientTCP +#define __SocketClientTCP +#include "SocketClientTCP.h" +#endif + +#ifndef __SocketClientUDP +#define __SocketClientUDP +#include "SocketClientUDP.h" +#endif + +class FSocketClientModule : public IModuleInterface +{ +public: + + /** IModuleInterface implementation */ + virtual void StartupModule() override; + virtual void ShutdownModule() override; + + static bool isShuttingDown; +}; \ No newline at end of file diff --git a/InteractiveControl/Plugins/SimpleUDPTCPSocketClient/Source/SocketClient/Public/SocketClientAsyncNodes.h b/InteractiveControl/Plugins/SimpleUDPTCPSocketClient/Source/SocketClient/Public/SocketClientAsyncNodes.h new file mode 100644 index 0000000..6d8f88b --- /dev/null +++ b/InteractiveControl/Plugins/SimpleUDPTCPSocketClient/Source/SocketClient/Public/SocketClientAsyncNodes.h @@ -0,0 +1,119 @@ +// Copyright 2022 David Romanski(Socke). All Rights Reserved. + +#pragma once + +#include "SocketClient.h" + +#ifndef __SocketClientBPLibrary +#define __SocketClientBPLibrary +#include "SocketClientBPLibrary.h" +#endif + +#include "SocketClientAsyncNodes.generated.h" + + +/*--- TCP -------------------------------------------------------------------------------------------------------------*/ + + +UCLASS() +class SOCKETCLIENT_API UTCPConnectAsyncNode : public UBlueprintAsyncActionBase +{ + GENERATED_BODY() + + +public: + DECLARE_DYNAMIC_MULTICAST_DELEGATE_FourParams(FTCPConnectDelegate, const FString, connenctionInfo, const FString, clientConnectionID, + const FString, messageFromServer, const TArray&, byteArrayFromServer); + + UPROPERTY(BlueprintAssignable) + FTCPConnectDelegate OnConnect; + + UPROPERTY(BlueprintAssignable) + FTCPConnectDelegate OnDisconnect; + + UPROPERTY(BlueprintAssignable) + FTCPConnectDelegate OnServerMessage; + + /** + * Connect to a TCP Server + * @param domainOrIP IP or Domain of your server + * @param ipType + * @param port + * @param receiveFilter This allows you to decide which data type you want to receive. If you receive files it makes no sense to convert them into a string. + * @param messageWrapping It may be that data packets are split or merged when transmitted over TCP in order to optimize the transmission. For example, if you send "Hello" two times in a row very quickly, it can happen that "HelloHa" and "llo" arrive. To counteract this circumstance there are options to separate the data packets. + * @param optionalCustomConnectionID Instead of an automatically generated ConnectionID you can use your own ID with this parameter. + * @param disableNaglesAlgorithm Don't change it if you don't know what this option is for! With this you can disable the TCP Nagle's algorithm to send (in LAN) very small data packets faster. + **/ + UFUNCTION(BlueprintCallable, Category = "SocketClient|TCP", meta = (BlueprintInternalUseOnly = "true", AdvancedDisplay = 6)) + static UTCPConnectAsyncNode* socketClientTCPConnectionAsyncNode(FString domainOrIP, ESocketClientIPType ipType, int32 port, EReceiveFilterClient receiveFilters, + ESocketClientTCPSeparator messageWrapping, FString optionalCustomConnectionID, bool disableNaglesAlgorithm = false); + + + virtual void Activate() override; + + void triggerConnectionEvent(bool success, FString clientConnectionID, FString serverMessage); + void triggerMessageEvent(TArray byteDataArray, FString clientConnectionID, FString serverMessage); + +private: + UTCPConnectAsyncNode* instance = nullptr; + FString domainOrIP = "0.0.0.0"; + ESocketClientIPType ipType = ESocketClientIPType::E_ipv4; + int32 port = 9999; + EReceiveFilterClient receiveFilters = EReceiveFilterClient::E_SAB; + ESocketClientTCPSeparator messageWrapping = ESocketClientTCPSeparator::E_None; + FString optionalCustomConnectionID = FString(); + FString connectionID = FString(); + bool disableNaglesAlgorithm = false; +}; + + +/*--- UDP -------------------------------------------------------------------------------------------------------------*/ + + +UCLASS() +class SOCKETCLIENT_API UUDPInitAsyncNode : public UBlueprintAsyncActionBase +{ + GENERATED_BODY() + + +public: + DECLARE_DYNAMIC_MULTICAST_DELEGATE_SixParams(FUDPInitDelegate, const FString, initializationInfo, const FString, clientConnectionID, + const FString, peerIP,const int32, peerPort, + const FString, messageFromServer, const TArray&, byteArrayFromServer); + + UPROPERTY(BlueprintAssignable) + FUDPInitDelegate OnSuccess; + + UPROPERTY(BlueprintAssignable) + FUDPInitDelegate OnFail; + + UPROPERTY(BlueprintAssignable) + FUDPInitDelegate OnServerMessage; + + /** + *Opens a connection on specific ip and port and listen on it. + *@param DomainOrIP IP or Domain to listen on. 0.0.0.0 means that data can be received on all local IPs. + *@param port port to listen on + *@param receiveFilter This allows you to decide which data type you want to receive. If you receive files it makes no sense to convert them into a string. + *@param maxPacketSize sets the maximum UDP packet size. More than 65507 is not possible. + */ + UFUNCTION(BlueprintCallable, Category = "SocketClient|UDP", meta = (BlueprintInternalUseOnly = "true", AdvancedDisplay = 5)) + static UUDPInitAsyncNode* socketClientInitUDPReceiverAsyncNode(FString domainOrIP = "0.0.0.0", + ESocketClientIPType ipType = ESocketClientIPType::E_ipv4, int32 port = 8888, + EReceiveFilterClient receiveFilter = EReceiveFilterClient::E_SAB, int32 maxPacketSize = 65507); + + + virtual void Activate() override; + + void triggerInitEvent(bool success, FString clientConnectionID, FString serverMessage); + void triggerMessageEvent(TArray byteDataArray, FString clientConnectionID, FString serverMessage, FString peerIP, int32 peerPort); + +private: + UUDPInitAsyncNode* instance = nullptr; + FString domainOrIP = "0.0.0.0"; + ESocketClientIPType ipType = ESocketClientIPType::E_ipv4; + int32 port = 8888; + EReceiveFilterClient receiveFilter = EReceiveFilterClient::E_SAB; + int32 maxPacketSize = 65507; + FString connectionID = FString(); +}; diff --git a/InteractiveControl/Plugins/SimpleUDPTCPSocketClient/Source/SocketClient/Public/SocketClientBPLibrary.h b/InteractiveControl/Plugins/SimpleUDPTCPSocketClient/Source/SocketClient/Public/SocketClientBPLibrary.h new file mode 100644 index 0000000..b136784 --- /dev/null +++ b/InteractiveControl/Plugins/SimpleUDPTCPSocketClient/Source/SocketClient/Public/SocketClientBPLibrary.h @@ -0,0 +1,374 @@ +// Copyright 2017-2019 David Romanski (Socke). All Rights Reserved. + +#pragma once + +#include "SocketClient.h" +#include "SocketClientBPLibrary.generated.h" + +class FSocketClientCleanerThread; + +UENUM(BlueprintType) +enum class ESocketClientSystem : uint8 +{ + Android, + IOS, + Windows, + Linux, + Mac +}; + +UENUM(BlueprintType) +enum class ESocketClientDirectoryType : uint8 +{ + E_gd UMETA(DisplayName = "Game directory"), + E_ad UMETA(DisplayName = "Absolute directory") +}; + + +class USocketClientTCPClient; +class USocketClientUDP; +class FSocketClientUDPReceiveDataThread; +//class FReadFileInPartsThread; + +UCLASS() +class SOCKETCLIENT_API USocketClientBPLibrary : public UObject +{ + GENERATED_UCLASS_BODY() + +public: + + ~USocketClientBPLibrary(); + + + //Delegates + DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FsocketClientTCPConnectionEventDelegate, bool, success, FString, message, FString, clientConnectionID); + DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FreceiveTCPMessageEventDelegate, FString, message, const TArray&, byteArray, FString, clientConnectionID); + DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FsocketClientUDPConnectionEventDelegate, bool, success, FString, message, FString, clientConnectionID); + DECLARE_DYNAMIC_MULTICAST_DELEGATE_FiveParams(FreceiveUDPMessageEventDelegate, FString, message, const TArray&, byteArray, FString, IP_FromSender, int32, portFromSender, FString, clientConnectionID); + DECLARE_DYNAMIC_MULTICAST_DELEGATE_FourParams(FreadBytesFromFileInPartsEventDelegate, int64, fileSize, int64, position,bool, end, const TArray&, byteArray); + DECLARE_DYNAMIC_MULTICAST_DELEGATE_SixParams(FtransferFileOverTCPProgressEventDelegate, FString, clientConnectionID, FString, filePath, float, percent, float, mbit, int64, bytesTransferred, int64, fileSize); + DECLARE_DYNAMIC_MULTICAST_DELEGATE_FourParams(FfileTransferOverTCPInfoEventDelegate, FString, message, FString, clientConnectionID, FString, filePath, bool, success); + + + UFUNCTION() + void socketClientTCPConnectionEventDelegate(const bool success, const FString message, const FString clientConnectionID); + UPROPERTY(BlueprintAssignable, Category = "SocketClient|TCP|Events|ConnectionInfo") + FsocketClientTCPConnectionEventDelegate onsocketClientTCPConnectionEventDelegate; + UFUNCTION() + void receiveTCPMessageEventDelegate(const FString message, const TArray& byteArray, const FString clientConnectionID); + UPROPERTY(BlueprintAssignable, Category = "SocketClient|TCP|Events|ReceiveMessage") + FreceiveTCPMessageEventDelegate onreceiveTCPMessageEventDelegate; + UFUNCTION() + void socketClientUDPConnectionEventDelegate(const bool success, const FString message, const FString clientConnectionID); + UPROPERTY(BlueprintAssignable, Category = "SocketClient|UDP|Events|ConnectionInfo") + FsocketClientUDPConnectionEventDelegate onsocketClientUDPConnectionEventDelegate; + UFUNCTION() + void receiveUDPMessageEventDelegate(const FString message, const TArray& byteArray, const FString IP, const int32 port,const FString clientConnectionID); + UPROPERTY(BlueprintAssignable, Category = "SocketClient|UDP|Events|ReceiveMessage") + FreceiveUDPMessageEventDelegate onreceiveUDPMessageEventDelegate; + UFUNCTION() + void readBytesFromFileInPartsEventDelegate(const int64 fileSize, const int64 position,const bool end, const TArray& byteArray); + UPROPERTY(BlueprintAssignable, Category = "SocketClient|SpecialFunctions|File|Events|ReadBytesFromFileInPartsAsync") + FreadBytesFromFileInPartsEventDelegate onreadBytesFromFileInPartsEventDelegate; + UFUNCTION() + void transferFileOverTCPProgressEventDelegate(const FString clientConnectionID,const FString filePath, const float percent, const float mbit, const int64 bytesTransferred, const int64 fileSize); + UPROPERTY(BlueprintAssignable, Category = "SocketClient|TCP|Events|File|transferFileOverTCPProgress") + FtransferFileOverTCPProgressEventDelegate ontransferFileOverTCPProgressEventDelegate; + UFUNCTION() + void fileTransferOverTCPInfoEventDelegate(const FString message, const FString clientConnectionID, const FString filePath, const bool success); + UPROPERTY(BlueprintAssignable, Category = "SocketClient|TCP|Events|File|FileTransferOverTCPInfo") + FfileTransferOverTCPInfoEventDelegate onfileTransferOverTCPInfoEventDelegate; + + + /** + * Get an instance of this library. This allows non-static functions to be called. + */ + UFUNCTION(BlueprintCallable, BlueprintPure, Category = "SocketClient") + static USocketClientBPLibrary* getSocketClientTarget(); + static USocketClientBPLibrary* socketClientBPLibrary; + + + + /** + * Connect to a TCP Server + * @param domainOrIP IP or Domain of your server + * @param ipType + * @param port + * @param receiveFilter This allows you to decide which data type you want to receive. If you receive files it makes no sense to convert them into a string. + * @param messageSeparator It may be that data packets are split or merged when transmitted over TCP in order to optimize the transmission. For example, if you send "Hello" two times in a row very quickly, it can happen that "HelloHa" and "llo" arrive. To counteract this circumstance there are options to separate the data packets. + * @param optionalCustomConnectionID Instead of an automatically generated ConnectionID you can use your own ID with this parameter. + * @param disableNaglesAlgorithm Don't change it if you don't know what this option is for! With this you can disable the TCP Nagle's algorithm to send (in LAN) very small data packets faster. + **/ + UFUNCTION(BlueprintCallable, Category = "SocketClient|TCP", meta = (AdvancedDisplay = 6)) + static void connectSocketClientTCP(FString domainOrIP, ESocketClientIPType ipType, int32 port, EReceiveFilterClient receiveFilters, + ESocketClientTCPSeparator messageSeparator, FString optionalCustomConnectionID, FString& connectionID, bool disableNaglesAlgorithm = false); + void connectSocketClientTCPNonStatic(FString domainOrIP, ESocketClientIPType ipType, int32 port, EReceiveFilterClient receiveFilters, + ESocketClientTCPSeparator messageSeparator,FString optionalCustomConnectionID, FString &connectionID, UTCPConnectAsyncNode* tcpConnectAsyncNode, bool disableNaglesAlgorithm = false); + + + /** + * Sends a string or byte array to the server. + *@param connectionID The ID to an existing connection. + *@param message String to send + *@param byteArray bytes to send + *@param addLineBreak add a line break at the end + */ + UFUNCTION(BlueprintCallable, Category = "SocketClient|TCP", meta = (AutoCreateRefTerm = "byteArray")) + static void socketClientSendTCP(FString connectionID, FString message, TArray byteArray, bool addLineBreak = true); + void socketClientSendTCPNonStatic(FString connectionID, FString message, TArray byteArray, bool addLineBreak = true); + + /** + * Sends files as a kind of stream. This allows extremely large files to be sent since they do not have to be loaded into RAM beforehand. At the end of the transfer a MD5 checksum is created and compared between client and server to exclude errors during the transfer. + *@param connectionID The ID to an existing connection. + *@param domainOrIP IP or Domain of your server + *@param directoryType Absolute or relative directory. Absolute directory starts at the disk (e.g. Windows C:\). A relative directory starts one level higher than the Content directory in the project or game. + *@param filePath Directory including the file to be sent. + *@param token The token is a unique ID that the client and server must know. The server knows from the token in which directory the file should be saved. + *@param Aes256bitKey The AES key must consist of 32 ASCII characters. The communication between client and server is encrypted via AES in 256bit. Therefore a key must be entered. + */ + UFUNCTION(BlueprintCallable, Category = "SocketClient|TCP") + static void socketClientSendFileOverTCP(FString& connectionID, FString domainOrIP, ESocketClientIPType ipType, int32 port, EFileFunctionsSocketClientDirectoryType directoryType, FString filePath, FString token, FString Aes256bitKey); + void socketClientSendFileOverTCPNonStatic(FString& connectionID, FString domainOrIP, ESocketClientIPType ipType, int32 port, EFileFunctionsSocketClientDirectoryType directoryType, FString filePath, FString token, FString Aes256bitKey); + + /** + * Lets the server send a file to this client as a kind of stream. This allows extremely large files to be sent since they do not have to be loaded into RAM beforehand. At the end of the transfer a MD5 checksum is created and compared between client and server to exclude errors during the transfer. + *@param connectionID The ID to an existing connection. + *@param domainOrIP IP or Domain of your server + *@param directoryType Absolute or relative directory. Absolute directory starts at the disk (e.g. Windows C:\). A relative directory starts one level higher than the Content directory in the project or game. + *@param filePath Directory including the file to be sent. + *@param token The token is a unique ID that the client and server must know. The server recognizes by the toke what kind of file should be sent. + *@param Aes256bitKey The AES key must consist of 32 ASCII characters. The communication between client and server is encrypted via AES in 256bit. Therefore a key must be entered. + */ + UFUNCTION(BlueprintCallable, Category = "SocketClient|TCP") + static void socketClientRequestFileOverTCP(FString& connectionID, FString domainOrIP, ESocketClientIPType ipType, int32 port, EFileFunctionsSocketClientDirectoryType directoryType, FString downloadDirectory, bool resume, FString token, FString Aes256bitKey); + void socketClientRequestFileOverTCPNonStatic(FString& connectionID, FString domainOrIP, ESocketClientIPType ipType, int32 port, EFileFunctionsSocketClientDirectoryType directoryType, FString downloadDirectory, bool resume, FString token, FString Aes256bitKey); + + /** + * Terminates an existing connection. + *@param connectionID The ID to an existing connection. + */ + UFUNCTION(BlueprintCallable, Category = "SocketClient|TCP") + static void closeSocketClientConnectionTCP(FString connectionID); + void closeSocketClientConnectionTCPNonStatic(FString connectionID); + + /** + * Terminates all connections. + */ + UFUNCTION(BlueprintCallable, Category = "SocketClient|TCP") + static void closeAllSocketClientConnectionsTCP(); + void closeAllSocketClientConnectionsTCPNonStatic(); + + + /** + * Useful if you want to attach events to a certain connection. + */ + UFUNCTION(BlueprintCallable, Category = "SocketClient|TCP") + static void getTCPConnectionByConnectionID(FString connectionID, bool &found, USocketClientTCPClient* &connection); + void getTCPConnectionByConnectionIDNonStatic(FString connectionID, bool& found, USocketClientTCPClient*& connection); + + + UFUNCTION(BlueprintCallable, Category = "SocketClient|TCP") + static bool isTCPConnected(FString connectionID); + bool isTCPConnectedNonStatic(FString connectionID); + + + /** + *Opens a connection on specific ip and port and listen on it. + *@param DomainOrIP IP or Domain to listen on. 0.0.0.0 means that data can be received on all local IPs. + *@param port port to listen on + *@param receiveFilter This allows you to decide which data type you want to receive. If you receive files it makes no sense to convert them into a string. + *@param maxPacketSize sets the maximum UDP packet size. More than 65507 is not possible. + */ + UFUNCTION(BlueprintCallable, Category = "SocketClient|UDP") + static void socketClientInitUDPReceiver(FString& connectionID, FString domainOrIP = "0.0.0.0", ESocketClientIPType ipType = ESocketClientIPType::E_ipv4, int32 port = 8888, EReceiveFilterClient receiveFilter = EReceiveFilterClient::E_SAB, int32 maxPacketSize = 65507); + void socketClientInitUDPReceiverNonStatic(FString& connectionID, UUDPInitAsyncNode* udpInitAsyncNode, FString domainOrIP = "0.0.0.0", ESocketClientIPType ipType = ESocketClientIPType::E_ipv4, int32 port = 8888, EReceiveFilterClient receiveFilter = EReceiveFilterClient::E_SAB, int32 maxPacketSize = 65507); + + /** + * A ConnectionID must be created first with "socketClientInitUDPReceiver". Messages and bytes can be sent to different hosts with the same ConnectionID. + *@param DomainOrIP target IP or Domain + *@param port target port + *@param message String to send + *@param addLineBreak add a line break at the end + *@param uniqueID is optional and required when multiple connections to the same server (same ip and port) shall be established. You can use getUniquePlayerID + */ + UFUNCTION(BlueprintCallable, Category = "SocketClient|UDP", meta = (AutoCreateRefTerm = "byteArray")) + static void socketClientSendUDP(FString domainOrIP, ESocketClientIPType ipType, int32 port, FString message, TArray byteArray, bool addLineBreak = true, FString connectionID = ""); + void socketClientSendUDPNonStatic(FString domainOrIP, ESocketClientIPType ipType, int32 port, FString message, TArray byteArray, bool addLineBreak = true, FString connectionID = ""); + + /** + * Terminates an existing connection. + *@param connectionID The ID to an existing connection. + */ + UFUNCTION(BlueprintCallable, Category = "SocketClient|UDP") + static void closeSocketClientConnectionUDP(FString connectionID); + void closeSocketClientConnectionUDPNonStatic(FString connectionID); + + /** + * Useful if you want to attach events to a certain connection. + */ + UFUNCTION(BlueprintCallable, Category = "SocketClient|UDP") + static void getUDPInitializationByConnectionID(FString connectionID, bool& found, USocketClientUDP*& connection); + void getUDPInitializationByConnectionIDNonStatic(FString connectionID, bool& found, USocketClientUDP*& connection); + + + UFUNCTION(BlueprintCallable, Category = "SocketClient|UDP") + static bool isUDPInitialized(FString connectionID); + bool isUDPInitializedNonStatic(FString connectionID); + + /** + *Trying to determine the local IP. It uses a function in the engine that does not work on all devices. On Windows and Linux it seems to work very well. Very bad on Android. 0.0.0.0 will be returned if it doesn't work. + */ + UFUNCTION(BlueprintCallable, Category = "SocketClient|SpecialFunctions") + static FString getLocalIP(); + + + /** + *UE4 uses different socket connections. When Steam is active, Steam Sockets are used for all connections. This leads to problems if you want to use Steam but not Steam Sockets. Therefore you can change the sockets to "System". + *@param ESocketPlatformServer System = Windows on Windows, Mac = Mac on Mac ect. + */ + UFUNCTION(BlueprintCallable, Category = "SocketClient|SpecialFunctions") + static void changeSocketPlatform(ESocketPlatformClient platform); + + + /** + *The cleaner thread is a thread that runs endlessly and deletes data remnants from closed/broken connections from RAM. + *@param showLogs Writes to the logs when data remnants are deleted. + *@param minLiveTimeInSeconds When a connection is closed it is passed to the cleaner thread. The thread ignores the connection for "minLiveTimeInSeconds" until it clears the data. This is necessary because sometimes connections need some time to be closed completely. + */ + UFUNCTION(BlueprintCallable, Category = "SocketClient|SpecialFunctions") + static void changeCleanerThreadSettingsOnClient(bool showLogs, int32 minLiveTimeInSeconds = 10); + + /** + * Returns which system you are currently use. (Windows, OSX, IOS ...) + */ + UFUNCTION(BlueprintCallable, Category = "SocketClient|SpecialFunctions", Meta = (ExpandEnumAsExecs = "system")) + static void getSystemType(ESocketClientSystem& system); + + UFUNCTION(BlueprintCallable, BlueprintPure, Category = "SocketClient|SpecialFunctions") + static int32 getUniquePlayerID(APlayerController* playerController = nullptr); + + UFUNCTION(BlueprintCallable, BlueprintPure, Category = "SocketClient|SpecialFunctions") + static FString getRandomID(); + + UFUNCTION(BlueprintCallable, Category = "SocketClient|SpecialFunctions|Hex") + static TArray parseHexToBytes(FString hex); + + UFUNCTION(BlueprintCallable, Category = "SocketClient|SpecialFunctions|Hex") + static FString parseHexToString(FString hex); + + UFUNCTION(BlueprintCallable, Category = "SocketClient|SpecialFunctions|Hex") + static FString parseBytesToHex(TArray bytes); + + UFUNCTION(BlueprintCallable, BlueprintPure, Category = "SocketClient|SpecialFunctions|Hex") + static TArray parseHexToBytesPure(FString hex); + + UFUNCTION(BlueprintCallable, BlueprintPure, Category = "SocketClient|SpecialFunctions|Hex") + static FString parseHexToStringPure(FString hex); + + UFUNCTION(BlueprintCallable, BlueprintPure, Category = "SocketClient|SpecialFunctions|Hex") + static FString parseBytesToHexPure(TArray bytes); + + + //number stuff + UFUNCTION(BlueprintCallable, Category = "SocketClient|SpecialFunctions|Number") + static void parseBytesToFloat(TArray bytes, float& value); + + UFUNCTION(BlueprintCallable, Category = "SocketClient|SpecialFunctions|Number") + static void parseBytesToInteger(TArray bytes, int32& value); + + UFUNCTION(BlueprintCallable, Category = "SocketClient|SpecialFunctions|Number") + static void parseBytesToInteger64(TArray bytes, int64& value); + + UFUNCTION(BlueprintCallable, BlueprintPure, Category = "SocketClient|SpecialFunctions|Number") + static void parseBytesToFloatPure(TArray bytes, float& value); + + UFUNCTION(BlueprintCallable, BlueprintPure, Category = "SocketClient|SpecialFunctions|Number") + static void parseBytesToIntegerPure(TArray bytes, int32& value); + + UFUNCTION(BlueprintCallable, BlueprintPure, Category = "SocketClient|SpecialFunctions|Number") + static void parseBytesToInteger64Pure(TArray bytes, int64& value); + + UFUNCTION(BlueprintCallable, Category = "SocketClient|SpecialFunctions|Number") + static void parseBytesToFloatEndian(TArray bytes, float& littleEndian, float& bigEndian); + + UFUNCTION(BlueprintCallable, Category = "SocketClient|SpecialFunctions|Number") + static void parseBytesToIntegerEndian(TArray bytes, int32& littleEndian, int32& bigEndian); + + UFUNCTION(BlueprintCallable, Category = "SocketClient|SpecialFunctions|Number") + static void parseBytesToInteger64Endian(TArray bytes, int64& littleEndian, int64& bigEndian); + + UFUNCTION(BlueprintCallable, Category = "SocketClient|SpecialFunctions|Number", meta = (AutoCreateRefTerm = "byteArray")) + static void parseFloatToBytes(TArray& byteArray, float value, bool switchByteOrder = false); + + UFUNCTION(BlueprintCallable, Category = "SocketClient|SpecialFunctions|Number", meta = (AutoCreateRefTerm = "byteArray")) + static void parseIntegerToBytes(TArray& byteArray, int32 value, bool switchByteOrder = false); + + UFUNCTION(BlueprintCallable, Category = "SocketClient|SpecialFunctions|Number", meta = (AutoCreateRefTerm = "byteArray")) + static void parseInteger64ToBytes(TArray& byteArray, int64 value, bool switchByteOrder = false); + + UFUNCTION(BlueprintCallable, BlueprintPure, Category = "SocketClient|SpecialFunctions|Number", meta = (AutoCreateRefTerm = "byteArray")) + static void parseFloatToBytesPure(TArray& byteArray, float value, bool switchByteOrder = false); + + UFUNCTION(BlueprintCallable, BlueprintPure, Category = "SocketClient|SpecialFunctions|Number", meta = (AutoCreateRefTerm = "byteArray")) + static void parseIntegerToBytesPure(TArray& byteArray, int32 value, bool switchByteOrder = false); + + UFUNCTION(BlueprintCallable, BlueprintPure, Category = "SocketClient|SpecialFunctions|Number", meta = (AutoCreateRefTerm = "byteArray")) + static void parseInteger64ToBytesPure(TArray& byteArray, int64 value, bool switchByteOrder = false); + + + UFUNCTION(BlueprintCallable, BlueprintPure, Category = "SocketClient|SpecialFunctions|Number", meta = (AutoCreateRefTerm = "value")) + static void parseBytesToFloatArrayPure(TArray& value, TArray bytes); + + UFUNCTION(BlueprintCallable, BlueprintPure, Category = "SocketClient|SpecialFunctions|Number", meta = (AutoCreateRefTerm = "value")) + static void parseBytesToIntegerArrayPure(TArray& value, TArray bytes); + + UFUNCTION(BlueprintCallable, BlueprintPure, Category = "SocketClient|SpecialFunctions|Number", meta = (AutoCreateRefTerm = "value")) + static void parseBytesToInteger64ArrayPure(TArray& value, TArray bytes); + + + UFUNCTION(BlueprintCallable, BlueprintPure, Category = "SocketClient|SpecialFunctions|Number", meta = (AutoCreateRefTerm = "byteArray")) + static void parseFloatArrayToBytesPure(TArray& byteArray, TArray value); + + UFUNCTION(BlueprintCallable, BlueprintPure, Category = "SocketClient|SpecialFunctions|Number", meta = (AutoCreateRefTerm = "byteArray")) + static void parseIntegerArrayToBytesPure(TArray& byteArray, TArray value); + + UFUNCTION(BlueprintCallable, BlueprintPure, Category = "SocketClient|SpecialFunctions|Number", meta = (AutoCreateRefTerm = "byteArray")) + static void parseInteger64ArrayToBytesPure(TArray& byteArray, TArray value); + + + + UFUNCTION(BlueprintCallable, Category = "SocketClient|TCP") + static void changeTCPSeparatorStringOnClient(FString separator = "(~{"); + void changeTCPSeparatorStringOnClientNonStatic(FString separator); + + UFUNCTION(BlueprintCallable, Category = "SocketClient|TCP") + static void changeTCPSeparatorByteOnClient(uint8 separator = 0x00); + void changeTCPSeparatorByteOnClientNonStatic(uint8 separator); + + + void getTcpSeparator(uint8& byteSeparator, FString& stringSeparator); + + static ISocketSubsystem* getSocketSubSystem(); + + FString resolveDomain(FString domain, ESocketClientIPType ipType); + //ue4 domain resolve does not work with steam. this is my own dns client + class UDNSClientSocketClient* dnsClient = nullptr; + TMap domainCache; + + + void cleanConnection(FSocketClientPluginSession& session); + +private: + ESocketPlatformClient systemSocketPlatform; + + TMap tcpClients; + TMap udpClients; + //TMap readFileInPartsThreads; + + int64 lastErrorMessageTime = 0; + + FString tcpStringSeparator = "(~{"; + uint8 tcpByteSeparator = 0x00; + + FSocketClientCleanerThread* socketClientCleanerThread = nullptr; +}; diff --git a/InteractiveControl/Plugins/SimpleUDPTCPSocketClient/Source/SocketClient/Public/SocketClientCleanerThread.h b/InteractiveControl/Plugins/SimpleUDPTCPSocketClient/Source/SocketClient/Public/SocketClientCleanerThread.h new file mode 100644 index 0000000..8565d6f --- /dev/null +++ b/InteractiveControl/Plugins/SimpleUDPTCPSocketClient/Source/SocketClient/Public/SocketClientCleanerThread.h @@ -0,0 +1,26 @@ +// Copyright 2022 David Romanski (Socke). All Rights Reserved. + +#pragma once + +#include "SocketClient.h" + + +class SOCKETCLIENT_API FSocketClientCleanerThread : public FRunnable { + +public: + + FSocketClientCleanerThread(); + + + virtual uint32 Run() override; + + void addSession(FSocketClientPluginSession& session); + void changeSettings(bool showLogs, int32 minLiveTimeInSeconds); + +private: + bool showLogs = false; + int32 minLiveTimeInSeconds = 10; + FRunnableThread* thread = nullptr; + TQueue sessionQueue; +}; + diff --git a/InteractiveControl/Plugins/SimpleUDPTCPSocketClient/Source/SocketClient/Public/SocketClientTCP.h b/InteractiveControl/Plugins/SimpleUDPTCPSocketClient/Source/SocketClient/Public/SocketClientTCP.h new file mode 100644 index 0000000..8d35887 --- /dev/null +++ b/InteractiveControl/Plugins/SimpleUDPTCPSocketClient/Source/SocketClient/Public/SocketClientTCP.h @@ -0,0 +1,106 @@ +// Copyright 2017-2019 David Romanski (Socke). All Rights Reserved. +#pragma once + +#include "SocketClient.h" +#include "SocketClientTCPReceiveDataThread.h" +#include "SocketClientTCPSendDataThead.h" +#include "SocketClientTCPFileHandlerThread.h" +#include "SocketClientTCP.generated.h" + +class USocketServerBPLibrary; + +UCLASS(Blueprintable, BlueprintType) +class SOCKETCLIENT_API USocketClientTCPClient : public UObject +{ + GENERATED_UCLASS_BODY() + +public: + + //Delegates + DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FsocketClientTCPConnectionEventDelegate, bool, success, FString, message, FString, clientConnectionID); + DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FreceiveTCPMessageEventDelegate, FString, message, const TArray&, byteArray, FString, clientConnectionID); + DECLARE_DYNAMIC_MULTICAST_DELEGATE_SixParams(FtransferFileOverTCPProgressEventDelegate, FString, clientConnectionID, FString, filePath, float, percent, float, mbit, int64, bytesTransferred, int64, fileSize); + DECLARE_DYNAMIC_MULTICAST_DELEGATE_FourParams(FfileTransferOverTCPInfoEventDelegate, FString, message, FString, clientConnectionID, FString, filePath, bool, success); + + UFUNCTION() + void socketClientTCPConnectionEventDelegate(const bool success, const FString message, const FString clientConnectionID); + UPROPERTY(BlueprintAssignable, Category = "SocketClient|TCP|Events|ConnectionInfo") + FsocketClientTCPConnectionEventDelegate onsocketClientTCPConnectionEventDelegate; + UFUNCTION() + void receiveTCPMessageEventDelegate(const FString message, const TArray& byteArray, const FString clientConnectionID); + UPROPERTY(BlueprintAssignable, Category = "SocketClient|TCP|Events|ReceiveMessage") + FreceiveTCPMessageEventDelegate onreceiveTCPMessageEventDelegate; + UFUNCTION() + void transferFileOverTCPProgressEventDelegate(const FString clientConnectionID, const FString filePath, const float percent, const float mbit, const int64 bytesTransferred, const int64 fileSize); + UPROPERTY(BlueprintAssignable, Category = "SocketClient|TCP|Events|File|transferFileOverTCPProgress") + FtransferFileOverTCPProgressEventDelegate ontransferFileOverTCPProgressEventDelegate; + UFUNCTION() + void fileTransferOverTCPInfoEventDelegate(const FString message, const FString clientConnectionID, const FString filePath, const bool success); + UPROPERTY(BlueprintAssignable, Category = "SocketClient|TCP|Events|File|FileTransferOverTCPInfo") + FfileTransferOverTCPInfoEventDelegate onfileTransferOverTCPInfoEventDelegate; + + UFUNCTION() + void connectionEvent(bool success, FString message, FString clientConnectionID); + + void connect(USocketClientBPLibrary* mainLib, FString domainOrIP, ESocketClientIPType ipType, int32 port, EReceiveFilterClient receiveFilter, + ESocketClientTCPSeparator messageWrapping, FString connectionID, UTCPConnectAsyncNode* tcpConnectAsyncNode, bool noPacketDelay = false, bool noPacketBlocking = false); + void sendMessage(FString message, TArray byteArray); + void sendFile(USocketClientBPLibrary* mainLib, FString connectionID, FString domainOrIP, ESocketClientIPType ipType, int32 port, EFileFunctionsSocketClientDirectoryType directoryType, FString filePath, FString token, FString Aes256bitKey); + void requestFile(USocketClientBPLibrary* mainLib, FString connectionID, FString domainOrIP, ESocketClientIPType ipType, int32 port, EFileFunctionsSocketClientDirectoryType directoryType, FString filePath,bool resume, FString token, FString Aes256bitKey); + + void closeConnection(); + + bool isRun(); + void setRun(bool runP); + FString getConnectionID(); + FString getAesKey(); + FString getFileToken(); + FString getFilePath(); + + void setSocket(FSocket* socket); + FSocket* getSocket(); + USocketClientBPLibrary* getMainLib(); + + void createSendThread(); + //void createFileSendThread(int64 startPosition); + FString encryptMessage(FString message); + FString decryptMessage(FString message); + void readDataLength(TArray& byteDataArray, int32& byteLenght); + bool isSendFile(); + bool isReceiveFile(); + bool hasResume(); + bool isConnected(); + void deleteFile(FString filePathP); + void getMD5FromFileAbsolutePath(FString filePath, bool& success, FString& MD5); + int64 fileSize(FString filePath); + FString int64ToString(int64 num); + void getTcpSeparator(FString& stringSeparator, uint8& byteSeparator, ESocketClientTCPSeparator& messageWrapping); + + UTCPConnectAsyncNode* tcpConnectAsyncNode = nullptr; + +private: + + bool run = false; + bool connected = false; + bool resume = false; + int32 sendOrReceive = -1; //0 == send, 1 == receive; + FString connectionID = FString(); + FString aesKey = FString(); + FString fileToken = FString(); + FString filePath = FString(); + + + FSocket* socket = nullptr; + + FSocketClientTCPReceiveDataThread* tcpReceiveDataThread = nullptr; + FSocketClientTCPSendDataThead* tcpSendThread = nullptr; + FSocketClientTCPFileHandlerThread* tcpFileConnectionThread = nullptr; + //FSocketClientTCPSendFileThread* fileSendThread = nullptr; + USocketClientBPLibrary* mainLib = nullptr; + + + ESocketClientTCPSeparator messageWrapping; + FString tcpStringSeparator = "(~{"; + uint8 tcpByteSeparator = 0x00; + +}; \ No newline at end of file diff --git a/InteractiveControl/Plugins/SimpleUDPTCPSocketClient/Source/SocketClient/Public/SocketClientTCPFileHandlerThread.h b/InteractiveControl/Plugins/SimpleUDPTCPSocketClient/Source/SocketClient/Public/SocketClientTCPFileHandlerThread.h new file mode 100644 index 0000000..b8445e9 --- /dev/null +++ b/InteractiveControl/Plugins/SimpleUDPTCPSocketClient/Source/SocketClient/Public/SocketClientTCPFileHandlerThread.h @@ -0,0 +1,46 @@ +// Copyright 2022 David Romanski (Socke). All Rights Reserved. + +#pragma once + +#include "SocketClient.h" + + +class SOCKETCLIENT_API FSocketClientTCPFileHandlerThread : public FRunnable { + +public: + + FSocketClientTCPFileHandlerThread(USocketClientBPLibrary* socketClientP, FString clientConnectionIDP, FString ipOrDomainP, ESocketClientIPType ipTypeP, + int32 portP, USocketClientTCPClient* tcpClientP); + + ~FSocketClientTCPFileHandlerThread(); + + virtual uint32 Run() override; + + void doRequestFileFromServer(FSocket* socket); + void doSendFileToServer(FSocket* socket); + + void sendMessageToServer(FString message, FSocket* socket); + + void triggerFileTransferOverTCPInfoEvent(FString messageP, FString clientConnectionIDP, FString filePathP, bool successP, + USocketClientBPLibrary* socketClientP, USocketClientTCPClient* tcpClientP); + + void triggerTransferFileEvent(FString clientConnectionIDP, FString filePathP, USocketClientBPLibrary* socketClientP, + USocketClientTCPClient* tcpClientP, float percentP, float mbitP, int64 transferredP, int64 fileSizeP); + + void sendEndMessage(FString fullFilePathP, FString tokenP, FString md5ServerP, FString clientConnectionIDP, FSocket* clientSocketP, + USocketClientBPLibrary* socketClientP, USocketClientTCPClient* tcpClientP); + + FString readMessageFromServer(FSocket* socket); + +private: + USocketClientBPLibrary* socketClient = nullptr; + //USocketClientBPLibrary* oldClient; + FString clientConnectionID; + FString originalIP; + FString ipOrDomain; + ESocketClientIPType ipType; + int32 port; + USocketClientTCPClient* tcpClient = nullptr; + FRunnableThread* thread = nullptr; + double waitForRead = 30; +}; diff --git a/InteractiveControl/Plugins/SimpleUDPTCPSocketClient/Source/SocketClient/Public/SocketClientTCPReceiveDataThread.h b/InteractiveControl/Plugins/SimpleUDPTCPSocketClient/Source/SocketClient/Public/SocketClientTCPReceiveDataThread.h new file mode 100644 index 0000000..e106896 --- /dev/null +++ b/InteractiveControl/Plugins/SimpleUDPTCPSocketClient/Source/SocketClient/Public/SocketClientTCPReceiveDataThread.h @@ -0,0 +1,41 @@ +// Copyright 2022 David Romanski (Socke). All Rights Reserved. + +#pragma once + +#include "SocketClient.h" + + +class SOCKETCLIENT_API FSocketClientTCPReceiveDataThread : public FRunnable { + +public: + + FSocketClientTCPReceiveDataThread(USocketClientBPLibrary* socketClientBPLibraryP, FString clientConnectionIDP, EReceiveFilterClient receiveFilterP, + FString ipOrDomainP, ESocketClientIPType ipTypeP,int32 portP, USocketClientTCPClient* tcpClientP, bool noPacketDelayP, bool noPacketBlockingP); + + ~FSocketClientTCPReceiveDataThread(); + + virtual uint32 Run() override; + + + void triggerConnectionEvent(bool succsess, FString clientConnectionIDGlobal, FString serverMessage, USocketClientTCPClient* tcpClientGlobal, + USocketClientBPLibrary* socketClientGlobal); + void triggerMessageEvent(TArray& byteDataArray, FString& clientConnectionIDGlobal, USocketClientTCPClient* tcpClientGlobal, + USocketClientBPLibrary* socketClientGlobal, bool addNullTerminator = true); + + +private: + USocketClientBPLibrary* socketClientBPLibrary = nullptr; + //USocketClientBPLibrary* oldClient; + FString clientConnectionID; + FString originalIP; + EReceiveFilterClient receiveFilter; + FString ipOrDomain; + ESocketClientIPType ipType; + int32 port; + USocketClientTCPClient* tcpClient = nullptr; + bool noPacketDelay = false; + bool noPacketBlocking = false; + + + FRunnableThread* thread = nullptr; +}; diff --git a/InteractiveControl/Plugins/SimpleUDPTCPSocketClient/Source/SocketClient/Public/SocketClientTCPSendDataThead.h b/InteractiveControl/Plugins/SimpleUDPTCPSocketClient/Source/SocketClient/Public/SocketClientTCPSendDataThead.h new file mode 100644 index 0000000..4c0e41e --- /dev/null +++ b/InteractiveControl/Plugins/SimpleUDPTCPSocketClient/Source/SocketClient/Public/SocketClientTCPSendDataThead.h @@ -0,0 +1,32 @@ +// Copyright 2022 David Romanski (Socke). All Rights Reserved. + +#pragma once + +#include "SocketClient.h" + +class SOCKETCLIENT_API FSocketClientTCPSendDataThead : public FRunnable { + +public: + + FSocketClientTCPSendDataThead(USocketClientBPLibrary* socketClientLibP, USocketClientTCPClient* tcpClientP, FString clientConnectionIDP); + + ~FSocketClientTCPSendDataThead(); + + virtual uint32 Run() override; + void sendMessage(FString messageP, TArray byteArrayP); + void pauseThread(bool pause); + + +private: + TQueue messageQueue; + TQueue> byteArrayQueue; + USocketClientBPLibrary* socketClientLib; + USocketClientTCPClient* tcpClient = nullptr; + FString clientConnectionID; + FRunnableThread* thread = nullptr; + bool run = true; + bool paused = false; + bool blah = true; +}; + + diff --git a/InteractiveControl/Plugins/SimpleUDPTCPSocketClient/Source/SocketClient/Public/SocketClientUDP.h b/InteractiveControl/Plugins/SimpleUDPTCPSocketClient/Source/SocketClient/Public/SocketClientUDP.h new file mode 100644 index 0000000..ed6d57e --- /dev/null +++ b/InteractiveControl/Plugins/SimpleUDPTCPSocketClient/Source/SocketClient/Public/SocketClientUDP.h @@ -0,0 +1,73 @@ +// Copyright 2017-2019 David Romanski (Socke). All Rights Reserved. +#pragma once + +#include "SocketClient.h" +#include "SocketClientUDPSendDataThead.h" +#include "SocketClientUDPReceiveDataThread.h" +#include "SocketClientUDP.generated.h" + + +class USocketClientBPLibrary; + +UCLASS(Blueprintable, BlueprintType) +class SOCKETCLIENT_API USocketClientUDP : public UObject +{ + GENERATED_UCLASS_BODY() + +public: + + //Delegates + DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FsocketClientUDPConnectionEventDelegate, bool, success, FString, message, FString, clientConnectionID); + DECLARE_DYNAMIC_MULTICAST_DELEGATE_FiveParams(FreceiveUDPMessageEventDelegate, FString, message, const TArray&, byteArray, FString, IP_FromSender, int32, portFromSender, FString, clientConnectionID); + + UFUNCTION() + void socketClientUDPConnectionEventDelegate(const bool success, const FString message, const FString clientConnectionID); + UPROPERTY(BlueprintAssignable, Category = "SocketClient|UDP|Events|ConnectionInfo") + FsocketClientUDPConnectionEventDelegate onsocketClientUDPConnectionEventDelegate; + UFUNCTION() + void receiveUDPMessageEventDelegate(const FString message, const TArray& byteArray, const FString IP, const int32 port, const FString clientConnectionID); + UPROPERTY(BlueprintAssignable, Category = "SocketClient|UDP|Events|ReceiveMessage") + FreceiveUDPMessageEventDelegate onreceiveUDPMessageEventDelegate; + + void init(USocketClientBPLibrary* socketClientLibP, UUDPInitAsyncNode* udpInitAsyncNode, FString domain, ESocketClientIPType ipType, int32 port, EReceiveFilterClient receiveFilter, FString clientConnectionID, int32 maxPacketSize = 65507); + void sendUDPMessage(FString domainOrIP, ESocketClientIPType ipType, int32 port, FString message, TArray byteArray); + void closeUDPConnection(); + void UDPReceiver(const FArrayReaderPtr& ArrayReaderPtr, const FIPv4Endpoint& EndPt); + + + bool isRun(); + void setRun(bool runP); + + FSocket* getSocket(); + void setSocket(FSocket* socketP); + + void setUDPSocketReceiver(FUdpSocketReceiver* udpSocketReceiver); + + FString getIP(); + void setIP(FString ipP); + int32 getPort(); + FString getDomainOrIP(); + + FString getConnectionID(); + void setUDPSendThread(FSocketClientUDPSendDataThead* udpSendThreadP); + + int32 getMaxPacketSize(); + + UUDPInitAsyncNode* udpInitAsyncNode = nullptr; + +private: + bool run = false; + EReceiveFilterClient receiveFilter; + FString connectionID; + FString domainOrIP; + int32 port = 0; + int32 maxPacketSize = 65507; + + USocketClientBPLibrary* socketClientBPLibrary = nullptr; + + FUdpSocketReceiver* udpSocketReceiver = nullptr; + FSocket* socket = nullptr; + FSocketClientUDPReceiveDataThread* UDPThread = nullptr; + FSocketClientUDPSendDataThead* UDPSendThread = nullptr; +}; + diff --git a/InteractiveControl/Plugins/SimpleUDPTCPSocketClient/Source/SocketClient/Public/SocketClientUDPReceiveDataThread.h b/InteractiveControl/Plugins/SimpleUDPTCPSocketClient/Source/SocketClient/Public/SocketClientUDPReceiveDataThread.h new file mode 100644 index 0000000..ad372eb --- /dev/null +++ b/InteractiveControl/Plugins/SimpleUDPTCPSocketClient/Source/SocketClient/Public/SocketClientUDPReceiveDataThread.h @@ -0,0 +1,30 @@ +// Copyright 2022 David Romanski (Socke). All Rights Reserved. + +#pragma once + +#include "SocketClient.h" + + +class SOCKETCLIENT_API FSocketClientUDPReceiveDataThread : public FRunnable { + +public: + + FSocketClientUDPReceiveDataThread(USocketClientUDP* udpClientP, USocketClientBPLibrary* socketClientP, FString ipP, int32 portP, ESocketClientIPType ipTypeP); + + ~FSocketClientUDPReceiveDataThread(); + + void triggerInitEvent(bool success, USocketClientUDP* udpClientP, USocketClientBPLibrary* socketClientP, FString serverMessage, FString connectionID); + + virtual uint32 Run() override; + + +private : + USocketClientUDP* udpClient = nullptr; + USocketClientBPLibrary* socketClient = nullptr; + FRunnableThread* thread = nullptr; + FString ipGlobal; + int32 portGlobal; + ESocketClientIPType ipType = ESocketClientIPType::E_ipv4; + FSocket* socket = nullptr; + bool reuseSocket = false; +}; diff --git a/InteractiveControl/Plugins/SimpleUDPTCPSocketClient/Source/SocketClient/Public/SocketClientUDPSendDataThead.h b/InteractiveControl/Plugins/SimpleUDPTCPSocketClient/Source/SocketClient/Public/SocketClientUDPSendDataThead.h new file mode 100644 index 0000000..a1000c2 --- /dev/null +++ b/InteractiveControl/Plugins/SimpleUDPTCPSocketClient/Source/SocketClient/Public/SocketClientUDPSendDataThead.h @@ -0,0 +1,37 @@ +// Copyright 2022 David Romanski (Socke). All Rights Reserved. + +#pragma once + +#include "SocketClient.h" + +class SOCKETCLIENT_API FSocketClientUDPSendDataThead : public FRunnable { + +public: + + FSocketClientUDPSendDataThead(USocketClientUDP* udpClientP, USocketClientBPLibrary* socketClientP, FString mySocketipP, int32 mySocketportP); + + ~FSocketClientUDPSendDataThead(); + + virtual uint32 Run() override; + void addData(FString messageP, TArray byteArrayP, FString domainOrIP, int32 port, ESocketClientIPType ipType); + void pauseThread(bool pause); + void sendBytes(FSocket*& socketP, TArray& byteArray, int32& sent, TSharedRef& addr); + +private: + USocketClientUDP* udpClient = nullptr; + USocketClientBPLibrary* socketClient = nullptr; + FString mySocketip; + int32 mySocketport = 0; + FString sendToip; + int32 sendToport = 0; + FString sendToDomainOrIP = FString(); + FRunnableThread* thread = nullptr; + bool paused; + TQueue messageQueue; + TQueue> byteArrayQueue; + int32 maxPacketSize = 65507; + bool validInternetAdress = false; + TSharedRef internetAdress = USocketClientBPLibrary::getSocketSubSystem()->CreateInternetAddr(); + int64 lastErrorMessageTime = 0; +}; + diff --git a/InteractiveControl/Plugins/SimpleUDPTCPSocketClient/Source/SocketClient/SocketClient.Build.cs b/InteractiveControl/Plugins/SimpleUDPTCPSocketClient/Source/SocketClient/SocketClient.Build.cs new file mode 100644 index 0000000..07a9532 --- /dev/null +++ b/InteractiveControl/Plugins/SimpleUDPTCPSocketClient/Source/SocketClient/SocketClient.Build.cs @@ -0,0 +1,57 @@ +// Copyright 2017-2020 David Romanski (Socke). All Rights Reserved. + +using UnrealBuildTool; + +public class SocketClient : ModuleRules +{ + public SocketClient(ReadOnlyTargetRules Target) : base(Target) + { + PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs; + + PublicIncludePaths.AddRange( + new string[] { + } + ); + + + PrivateIncludePaths.AddRange( + new string[] { + "SocketClient/Private", + } + ); + + + PublicDependencyModuleNames.AddRange( + new string[] + { + "Core", + "Networking", + "Sockets" + + // ... add other public dependencies that you statically link with here ... + } + ); + + + PrivateDependencyModuleNames.AddRange( + new string[] + { + "CoreUObject", + "Engine", + "Networking", + "Sockets", + "Slate", + "SlateCore" + // ... add private dependencies that you statically link with here ... + } + ); + + + DynamicallyLoadedModuleNames.AddRange( + new string[] + { + // ... add any modules that your module loads dynamically here ... + } + ); + } +} diff --git a/SpaceStudioClient/.gitignore b/SpaceStudioClient/.gitignore new file mode 100644 index 0000000..242a311 --- /dev/null +++ b/SpaceStudioClient/.gitignore @@ -0,0 +1,75 @@ +# ---> UnrealEngine +# Visual Studio 2015 user specific files +.vs/ + +# Compiled Object files +*.slo +*.lo +*.o +*.obj + +# Precompiled Headers +*.gch +*.pch + +# Compiled Dynamic libraries +*.so +*.dylib +*.dll + +# Fortran module files +*.mod + +# Compiled Static libraries +*.lai +*.la +*.a + +# Executables +*.exe +*.out +*.app +*.ipa + +# These project files can be generated by the engine +*.xcodeproj +*.xcworkspace +*.sln +*.suo +*.opensdf +*.sdf +*.VC.db +*.VC.opendb + +# Precompiled Assets +SourceArt/**/*.png +SourceArt/**/*.tga + +# Binary Files +Binaries/* +Plugins/**/Binaries/* + +# Builds +Build/* + +# Whitelist PakBlacklist-.txt files +!Build/*/ +Build/*/** +!Build/*/PakBlacklist*.txt + +# Don't ignore icon files in Build +!Build/**/*.ico + +# Built data for maps +*_BuiltData.uasset + +# Configuration files generated by the Editor +Saved/* + +# Compiled source files for the engine to use +Intermediate/* +Plugins/**/Intermediate/* + +# Cache files for the editor to use +DerivedDataCache/* + diff --git a/SpaceStudioClient/Config/DefaultEngine.ini b/SpaceStudioClient/Config/DefaultEngine.ini index fa2cd8d..0b7c835 100644 --- a/SpaceStudioClient/Config/DefaultEngine.ini +++ b/SpaceStudioClient/Config/DefaultEngine.ini @@ -1,7 +1,8 @@ [/Script/EngineSettings.GameMapsSettings] -GameDefaultMap=/Engine/Maps/Templates/OpenWorld +GameDefaultMap=/Game/Main.Main +EditorStartupMap=/Game/Main.Main [/Script/WindowsTargetPlatform.WindowsTargetSettings] DefaultGraphicsRHI=DefaultGraphicsRHI_DX12 diff --git a/SpaceStudioClient/Config/DefaultGame.ini b/SpaceStudioClient/Config/DefaultGame.ini index 059fca6..ab5937b 100644 --- a/SpaceStudioClient/Config/DefaultGame.ini +++ b/SpaceStudioClient/Config/DefaultGame.ini @@ -2,3 +2,93 @@ [/Script/EngineSettings.GeneralProjectSettings] ProjectID=C5CBDA014AD60DA47558CEB13DA4AD3C + +[/Script/UnrealEd.ProjectPackagingSettings] +Build=IfProjectHasCode +BuildConfiguration=PPBC_Development +BuildTarget= +FullRebuild=False +ForDistribution=False +IncludeDebugFiles=False +BlueprintNativizationMethod=Disabled +bIncludeNativizedAssetsInProjectGeneration=False +bExcludeMonolithicEngineHeadersInNativizedCode=False +UsePakFile=False +bUseIoStore=False +bUseZenStore=False +bMakeBinaryConfig=False +bGenerateChunks=False +bGenerateNoChunks=False +bChunkHardReferencesOnly=False +bForceOneChunkPerFile=False +MaxChunkSize=0 +bBuildHttpChunkInstallData=False +HttpChunkInstallDataDirectory=(Path="") +WriteBackMetadataToAssetRegistry=Disabled +bCompressed=True +PackageCompressionFormat=Oodle +bForceUseProjectCompressionFormatIgnoreHardwareOverride=False +PackageAdditionalCompressionOptions= +PackageCompressionMethod=Kraken +PackageCompressionLevel_DebugDevelopment=4 +PackageCompressionLevel_TestShipping=5 +PackageCompressionLevel_Distribution=7 +PackageCompressionMinBytesSaved=1024 +PackageCompressionMinPercentSaved=5 +bPackageCompressionEnableDDC=False +PackageCompressionMinSizeToConsiderDDC=0 +HttpChunkInstallDataVersion= +IncludePrerequisites=True +IncludeAppLocalPrerequisites=False +bShareMaterialShaderCode=True +bDeterministicShaderCodeOrder=False +bSharedMaterialNativeLibraries=True +ApplocalPrerequisitesDirectory=(Path="") +IncludeCrashReporter=False +InternationalizationPreset=English +-CulturesToStage=en ++CulturesToStage=en +LocalizationTargetCatchAllChunkId=0 +bCookAll=False +bCookMapsOnly=False +bSkipEditorContent=False +bSkipMovies=False +-IniKeyDenylist=KeyStorePassword +-IniKeyDenylist=KeyPassword +-IniKeyDenylist=rsa.privateexp +-IniKeyDenylist=rsa.modulus +-IniKeyDenylist=rsa.publicexp +-IniKeyDenylist=aes.key +-IniKeyDenylist=SigningPublicExponent +-IniKeyDenylist=SigningModulus +-IniKeyDenylist=SigningPrivateExponent +-IniKeyDenylist=EncryptionKey +-IniKeyDenylist=DevCenterUsername +-IniKeyDenylist=DevCenterPassword +-IniKeyDenylist=IOSTeamID +-IniKeyDenylist=SigningCertificate +-IniKeyDenylist=MobileProvision +-IniKeyDenylist=IniKeyDenylist +-IniKeyDenylist=IniSectionDenylist ++IniKeyDenylist=KeyStorePassword ++IniKeyDenylist=KeyPassword ++IniKeyDenylist=rsa.privateexp ++IniKeyDenylist=rsa.modulus ++IniKeyDenylist=rsa.publicexp ++IniKeyDenylist=aes.key ++IniKeyDenylist=SigningPublicExponent ++IniKeyDenylist=SigningModulus ++IniKeyDenylist=SigningPrivateExponent ++IniKeyDenylist=EncryptionKey ++IniKeyDenylist=DevCenterUsername ++IniKeyDenylist=DevCenterPassword ++IniKeyDenylist=IOSTeamID ++IniKeyDenylist=SigningCertificate ++IniKeyDenylist=MobileProvision ++IniKeyDenylist=IniKeyDenylist ++IniKeyDenylist=IniSectionDenylist +-IniSectionDenylist=HordeStorageServers +-IniSectionDenylist=StorageServers ++IniSectionDenylist=HordeStorageServers ++IniSectionDenylist=StorageServers + diff --git a/SpaceStudioClient/Content/Blueprints/BP_MediaPlayerController.uasset b/SpaceStudioClient/Content/Blueprints/BP_MediaPlayerController.uasset new file mode 100644 index 0000000..7425050 --- /dev/null +++ b/SpaceStudioClient/Content/Blueprints/BP_MediaPlayerController.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:31c97d4e0759c7bd7309eb9d81a794baa888d161a8676cd9878e4b441eb584ca +size 375071 diff --git a/SpaceStudioClient/Content/Blueprints/BP_UDPMessageProcessor.uasset b/SpaceStudioClient/Content/Blueprints/BP_UDPMessageProcessor.uasset new file mode 100644 index 0000000..a5f5121 --- /dev/null +++ b/SpaceStudioClient/Content/Blueprints/BP_UDPMessageProcessor.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4e9e48603abf867176c7fafb57020d8341f1f047565b217c63194442023b9972 +size 152649 diff --git a/SpaceStudioClient/Content/Blueprints/BP_Windows.uasset b/SpaceStudioClient/Content/Blueprints/BP_Windows.uasset new file mode 100644 index 0000000..d656fdc --- /dev/null +++ b/SpaceStudioClient/Content/Blueprints/BP_Windows.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0b0823f1114c4359f7db05ba99a5e3a8d6a7c1b56e36b3ee8382a13b539e225b +size 114839 diff --git a/SpaceStudioClient/Content/Blueprints/UI/M_KinentBodys.uasset b/SpaceStudioClient/Content/Blueprints/UI/M_KinentBodys.uasset new file mode 100644 index 0000000..ad9bc9b --- /dev/null +++ b/SpaceStudioClient/Content/Blueprints/UI/M_KinentBodys.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2bf8990ca519192977ea848366f0ebc30bbf91597a6fe587cb20118e85ba6e3d +size 13729 diff --git a/SpaceStudioClient/Content/Blueprints/UI/WB_Wall_A.uasset b/SpaceStudioClient/Content/Blueprints/UI/WB_Wall_A.uasset new file mode 100644 index 0000000..9ec49c7 --- /dev/null +++ b/SpaceStudioClient/Content/Blueprints/UI/WB_Wall_A.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4825780ab27f16df7d7bb156ebb636bf30583f367ae30cd82180a6a765f53504 +size 62234 diff --git a/SpaceStudioClient/Content/Blueprints/UI/WB_Wall_B.uasset b/SpaceStudioClient/Content/Blueprints/UI/WB_Wall_B.uasset new file mode 100644 index 0000000..49d5424 --- /dev/null +++ b/SpaceStudioClient/Content/Blueprints/UI/WB_Wall_B.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a20820ef18b4713dae8c1dd3284003cf562dd14ef0d001f28a65b1b61de5aa0e +size 62623 diff --git a/SpaceStudioClient/Content/Blueprints/UI/WB_Wall_C.uasset b/SpaceStudioClient/Content/Blueprints/UI/WB_Wall_C.uasset new file mode 100644 index 0000000..1060580 --- /dev/null +++ b/SpaceStudioClient/Content/Blueprints/UI/WB_Wall_C.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f732583b554419c0363d1289fb9ac0011b707eba15aeda8ab8dd127cee4cf259 +size 62559 diff --git a/SpaceStudioClient/Content/Main.umap b/SpaceStudioClient/Content/Main.umap new file mode 100644 index 0000000..939b92e --- /dev/null +++ b/SpaceStudioClient/Content/Main.umap @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f050857d72c3f11406dbff3c57b9d882db7b225f733b3e698fa005c0a0212100 +size 12124 diff --git a/SpaceStudioClient/Content/MediaPlayer/MediaPlayerA.uasset b/SpaceStudioClient/Content/MediaPlayer/MediaPlayerA.uasset new file mode 100644 index 0000000..0316a1e --- /dev/null +++ b/SpaceStudioClient/Content/MediaPlayer/MediaPlayerA.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6d60eb934b81511437f7616ab555de5c6dac6f56564e5fa032e5917f13b81867 +size 1421 diff --git a/SpaceStudioClient/Content/MediaPlayer/MediaPlayerB.uasset b/SpaceStudioClient/Content/MediaPlayer/MediaPlayerB.uasset new file mode 100644 index 0000000..c1efc0b --- /dev/null +++ b/SpaceStudioClient/Content/MediaPlayer/MediaPlayerB.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:08318f3be457ddddb59dcf2700c70108cf124c23b4377d080f780e09454a1993 +size 1360 diff --git a/SpaceStudioClient/Content/MediaPlayer/MediaPlayerC.uasset b/SpaceStudioClient/Content/MediaPlayer/MediaPlayerC.uasset new file mode 100644 index 0000000..7954e32 --- /dev/null +++ b/SpaceStudioClient/Content/MediaPlayer/MediaPlayerC.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a488855cb4f41777f3ad9a5356e17fe79c8bcefd7c4f476f83103273b3828b8a +size 1360 diff --git a/SpaceStudioClient/Content/TextureRender2D/MediaPlayerA_Video.uasset b/SpaceStudioClient/Content/TextureRender2D/MediaPlayerA_Video.uasset new file mode 100644 index 0000000..d2760c5 --- /dev/null +++ b/SpaceStudioClient/Content/TextureRender2D/MediaPlayerA_Video.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8e7f1985256ea208950f74730eb127840adf00516f9047c806092b72f057ca93 +size 11546 diff --git a/SpaceStudioClient/Content/TextureRender2D/MediaPlayerB_Video.uasset b/SpaceStudioClient/Content/TextureRender2D/MediaPlayerB_Video.uasset new file mode 100644 index 0000000..a8bb511 --- /dev/null +++ b/SpaceStudioClient/Content/TextureRender2D/MediaPlayerB_Video.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:28a1062b791f2fba807c9fc92511ecc151bfeeecda9dff9d2fb685fa33db5447 +size 11447 diff --git a/SpaceStudioClient/Content/TextureRender2D/MediaPlayerC_Video.uasset b/SpaceStudioClient/Content/TextureRender2D/MediaPlayerC_Video.uasset new file mode 100644 index 0000000..f7b76f0 --- /dev/null +++ b/SpaceStudioClient/Content/TextureRender2D/MediaPlayerC_Video.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bcab4310b969e637c9d4895949d76987de434bf2be23f1c92dc0afdfbfbf2e97 +size 11447 diff --git a/SpaceStudioClient/Content/TextureRender2D/TextureRenderTarget2D_A.uasset b/SpaceStudioClient/Content/TextureRender2D/TextureRenderTarget2D_A.uasset new file mode 100644 index 0000000..c6d7024 --- /dev/null +++ b/SpaceStudioClient/Content/TextureRender2D/TextureRenderTarget2D_A.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7c725fddea127c6fae5db0c6319d727a311898f4c26bc2e69a837b5f235ecda1 +size 4137 diff --git a/SpaceStudioClient/Content/TextureRender2D/TextureRenderTarget2D_C.uasset b/SpaceStudioClient/Content/TextureRender2D/TextureRenderTarget2D_C.uasset new file mode 100644 index 0000000..119509a --- /dev/null +++ b/SpaceStudioClient/Content/TextureRender2D/TextureRenderTarget2D_C.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2eb5400b29c3e075c64f4c2db254d5258b07e2c2297818b381089974615ed1f4 +size 4368 diff --git a/SpaceStudioClient/Plugins/MultiWindow/Content/MultiWindow/ExampleMap_MW.umap b/SpaceStudioClient/Plugins/MultiWindow/Content/MultiWindow/ExampleMap_MW.umap new file mode 100644 index 0000000..0c87ab5 --- /dev/null +++ b/SpaceStudioClient/Plugins/MultiWindow/Content/MultiWindow/ExampleMap_MW.umap @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cdfafd66d439d047a11fcb245981fca7c496d1bd54e66d4696ec80de33e087cf +size 114784 diff --git a/SpaceStudioClient/Plugins/MultiWindow/Content/MultiWindow/Textures/T_Close.uasset b/SpaceStudioClient/Plugins/MultiWindow/Content/MultiWindow/Textures/T_Close.uasset new file mode 100644 index 0000000..54604ad --- /dev/null +++ b/SpaceStudioClient/Plugins/MultiWindow/Content/MultiWindow/Textures/T_Close.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cf8183dc7af86daf88e5d75f8b695f2d6014c719e1323a67deb8611e55fe2626 +size 12426 diff --git a/SpaceStudioClient/Plugins/MultiWindow/Content/MultiWindow/Textures/T_Maximize.uasset b/SpaceStudioClient/Plugins/MultiWindow/Content/MultiWindow/Textures/T_Maximize.uasset new file mode 100644 index 0000000..9b30546 --- /dev/null +++ b/SpaceStudioClient/Plugins/MultiWindow/Content/MultiWindow/Textures/T_Maximize.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:116a3e699c259a2fd66da7a523147c5ff026b7e17928260a2f2d04127ebc91ec +size 11697 diff --git a/SpaceStudioClient/Plugins/MultiWindow/Content/MultiWindow/Textures/T_Minimize.uasset b/SpaceStudioClient/Plugins/MultiWindow/Content/MultiWindow/Textures/T_Minimize.uasset new file mode 100644 index 0000000..06920b5 --- /dev/null +++ b/SpaceStudioClient/Plugins/MultiWindow/Content/MultiWindow/Textures/T_Minimize.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b4f26de925ce74ab242b2ad4ac045e60e7c8ff753bd73cf3295bf91fec7df5b2 +size 9666 diff --git a/SpaceStudioClient/Plugins/MultiWindow/Content/MultiWindow/Textures/T_Restore.uasset b/SpaceStudioClient/Plugins/MultiWindow/Content/MultiWindow/Textures/T_Restore.uasset new file mode 100644 index 0000000..22642aa --- /dev/null +++ b/SpaceStudioClient/Plugins/MultiWindow/Content/MultiWindow/Textures/T_Restore.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:299cabf21f5859d980f8f16794f4c4ea4592c5b53940af3a3bb15e33ffd23517 +size 12439 diff --git a/SpaceStudioClient/Plugins/MultiWindow/Content/MultiWindow/WBP_MW_Main.uasset b/SpaceStudioClient/Plugins/MultiWindow/Content/MultiWindow/WBP_MW_Main.uasset new file mode 100644 index 0000000..179ea0f --- /dev/null +++ b/SpaceStudioClient/Plugins/MultiWindow/Content/MultiWindow/WBP_MW_Main.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d9296df685c553201d0e05914233901b1048c858f9f972578d8d5bec2de16761 +size 85144 diff --git a/SpaceStudioClient/Plugins/MultiWindow/Content/MultiWindow/WBP_MW_Template.uasset b/SpaceStudioClient/Plugins/MultiWindow/Content/MultiWindow/WBP_MW_Template.uasset new file mode 100644 index 0000000..c14d30d --- /dev/null +++ b/SpaceStudioClient/Plugins/MultiWindow/Content/MultiWindow/WBP_MW_Template.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fbad15b51b2fe75b840014538349b099bee5ea9aad1e8372e8e16660d9fccc67 +size 148322 diff --git a/SpaceStudioClient/Plugins/MultiWindow/MultiWindow.uplugin b/SpaceStudioClient/Plugins/MultiWindow/MultiWindow.uplugin new file mode 100644 index 0000000..94c338c --- /dev/null +++ b/SpaceStudioClient/Plugins/MultiWindow/MultiWindow.uplugin @@ -0,0 +1,28 @@ +{ + "FileVersion": 3, + "Version": 1, + "VersionName": "1.0", + "FriendlyName": "MultiWindow", + "Description": "", + "Category": "Other", + "CreatedBy": "YWT20", + "CreatedByURL": "https://www.unrealengine.com/marketplace/en-US/profile/YWT20", + "DocsURL": "", + "MarketplaceURL": "com.epicgames.launcher://ue/marketplace/content/1056b6c5d31c49809416547f44545453", + "SupportURL": "https://www.youtube.com/channel/UCWYg44Cjom34vYb1Zedt__A?view_as=subscriber", + "EngineVersion": "5.3.0", + "CanContainContent": true, + "Installed": true, + "Modules": [ + { + "Name": "MultiWindow", + "Type": "Runtime", + "LoadingPhase": "PreLoadingScreen", + "PlatformAllowList": [ + "Win64", + "Mac", + "Linux" + ] + } + ] +} \ No newline at end of file diff --git a/SpaceStudioClient/Plugins/MultiWindow/Resources/Icon128.png b/SpaceStudioClient/Plugins/MultiWindow/Resources/Icon128.png new file mode 100644 index 0000000..1231d4a Binary files /dev/null and b/SpaceStudioClient/Plugins/MultiWindow/Resources/Icon128.png differ diff --git a/SpaceStudioClient/Plugins/MultiWindow/Source/MultiWindow/MultiWindow.Build.cs b/SpaceStudioClient/Plugins/MultiWindow/Source/MultiWindow/MultiWindow.Build.cs new file mode 100644 index 0000000..2c7cc2d --- /dev/null +++ b/SpaceStudioClient/Plugins/MultiWindow/Source/MultiWindow/MultiWindow.Build.cs @@ -0,0 +1,59 @@ +/************************************************************************/ +/* Author: YWT20 */ +/* Expected release year : 2024 */ +/************************************************************************/ + +using UnrealBuildTool; + +public class MultiWindow : ModuleRules +{ + public MultiWindow(ReadOnlyTargetRules Target) : base(Target) + { + PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs; + + PublicIncludePaths.AddRange( + new string[] { + // ... add public include paths required here ... + } + ); + + + PrivateIncludePaths.AddRange( + new string[] { + // ... add other private include paths required here ... + } + ); + + + PublicDependencyModuleNames.AddRange( + new string[] + { + "Core", + // ... add other public dependencies that you statically link with here ... + } + ); + + + PrivateDependencyModuleNames.AddRange( + new string[] + { + "CoreUObject", + "Engine", + "Slate", + "SlateCore", + "UMG", + "InputCore", + "ApplicationCore", + // ... add private dependencies that you statically link with here ... + } + ); + + + DynamicallyLoadedModuleNames.AddRange( + new string[] + { + // ... add any modules that your module loads dynamically here ... + } + ); + } +} diff --git a/SpaceStudioClient/Plugins/MultiWindow/Source/MultiWindow/Private/MultiWindow.cpp b/SpaceStudioClient/Plugins/MultiWindow/Source/MultiWindow/Private/MultiWindow.cpp new file mode 100644 index 0000000..e49f15b --- /dev/null +++ b/SpaceStudioClient/Plugins/MultiWindow/Source/MultiWindow/Private/MultiWindow.cpp @@ -0,0 +1,25 @@ +/************************************************************************/ +/* Author: YWT20 */ +/* Expected release year : 2024 */ +/************************************************************************/ + +#include "MultiWindow.h" + +#define LOCTEXT_NAMESPACE "FMultiWindowModule" + +void FMultiWindowModule::StartupModule() +{ + // This code will execute after your module is loaded into memory; the exact timing is specified in the .uplugin file per-module + +} + +void FMultiWindowModule::ShutdownModule() +{ + // This function may be called during shutdown to clean up your module. For modules that support dynamic reloading, + // we call this function before unloading the module. + +} + +#undef LOCTEXT_NAMESPACE + +IMPLEMENT_MODULE(FMultiWindowModule, MultiWindow) \ No newline at end of file diff --git a/SpaceStudioClient/Plugins/MultiWindow/Source/MultiWindow/Private/MultiWindowActor.cpp b/SpaceStudioClient/Plugins/MultiWindow/Source/MultiWindow/Private/MultiWindowActor.cpp new file mode 100644 index 0000000..8e21aa2 --- /dev/null +++ b/SpaceStudioClient/Plugins/MultiWindow/Source/MultiWindow/Private/MultiWindowActor.cpp @@ -0,0 +1,242 @@ +/************************************************************************/ +/* Author: YWT20 */ +/* Expected release year : 2024 */ +/************************************************************************/ + + +#include "MultiWindowActor.h" +#include "Components/Widget.h" +#include "Widgets/SWindow.h" +#include "Widgets/Layout/SConstraintCanvas.h" +#include "Engine.h" +#include + + +AMultiWindowActor::AMultiWindowActor() +{ + PrimaryActorTick.bCanEverTick = true; +} + +void AMultiWindowActor::BeginPlay() +{ + Super::BeginPlay(); + viewPort = GEngine->GameViewport->Viewport; +} + +void AMultiWindowActor::EndPlay(const EEndPlayReason::Type EndPlayReason) +{ + Super::EndPlay(EndPlayReason); + SetWindowClose(); +} + +void AMultiWindowActor::Tick(float DeltaTime) +{ + Super::Tick(DeltaTime); + UpdateContentDPI(); + + if (WindowPos != GetWindowPositoin()) + { + WindowPos = GetWindowPositoin(); + OnWindowMoved.Broadcast(WindowPos); + } + + if (ForceFocusToGameViewport && !viewPort->HasFocus()) + { + if (!timerHandle.IsValid()) + { + GetWorldTimerManager().SetTimer(timerHandle, this, &AMultiWindowActor::CheckFocus, focusTime, false); + } + } +} + +void AMultiWindowActor::InitWindow(TSharedPtr InWindow, UUserWidget* InContentWidget) +{ + if (IsPendingKillPending()) return; + + window = InWindow; + contentWidget = InContentWidget; + window->GetOnWindowClosedEvent().AddUObject(this, &AMultiWindowActor::EventOnWindowClose); + WindowPos = GetWindowPositoin(); + + window->GetOnWindowActivatedEvent().AddLambda([&]() { + OnWindowActivated.Broadcast(); + }); + window->GetOnWindowDeactivatedEvent().AddLambda([&]() { + OnWindowDeactivated.Broadcast(); + }); +} + +void AMultiWindowActor::UpdateContentDPI() +{ + if (bIsAutoContentDPIScale && WindowOriginSize != GetWindowSize()) + { + FVector2D TempWindowDPI = GetWindowSize() / WindowOriginSize; + if (TempWindowDPI != WindowDPI) + { + WindowDPI = TempWindowDPI; + contentWidget->SetRenderScale(WindowDPI); + } + } +} + +void AMultiWindowActor::CheckFocus() +{ + if (!viewPort->HasFocus()) + { + FSlateApplication::Get().SetAllUserFocusToGameViewport(); + } + GetWorldTimerManager().ClearTimer(timerHandle); +} + +void AMultiWindowActor::SetWindowShow(bool bIsShow) +{ + if (window.IsValid()) + { + if (bIsShow) + { + window->ShowWindow(); + } + else + { + window->HideWindow(); + } + } +} + +void AMultiWindowActor::SetWindowContentWidget(UUserWidget* ContentWidget) +{ + if (ContentWidget && window.IsValid()) + { + window->SetContent(ContentWidget->TakeWidget()); + contentWidget = ContentWidget; + } +} + +UUserWidget* AMultiWindowActor::GetWindowContentWidget() +{ + return contentWidget; +} + +void AMultiWindowActor::SetWindowSize(FVector2D WindowSize) +{ + if (window) + { + window->Resize(WindowSize); + WindowOriginSize = WindowSize; + } +} + +void AMultiWindowActor::SetWindowPosition(FVector2D WindowPosition) +{ + if (window) + { + window->MoveWindowTo(WindowPosition); + } +} + +FVector2D AMultiWindowActor::GetWindowSize() +{ + if (window) + { + FVector2D tempSize = window->GetSizeInScreen(); + FMargin tempBorderSize = window->GetWindowBorderSize(false); + tempSize.X -= tempBorderSize.GetDesiredSize().X; + tempSize.Y -= tempBorderSize.GetDesiredSize().Y + window->GetTitleBarSize().Get(); + return tempSize; + } + return FVector2D(); +} + +FVector2D AMultiWindowActor::GetWindowPositoin() +{ + if (window) + { + FVector2D tempSize = window->GetPositionInScreen(); + return tempSize; + } + return FVector2D(); +} + +//FVector2D AMultiWindowActor::GetWindowDPI() +//{ +// return WindowDPI; +//} + +void AMultiWindowActor::SetWindowTitle(const FString& WindowTitle) +{ + if (window) + { + window->SetTitle(FText::FromString(WindowTitle)); + } +} + +void AMultiWindowActor::SetWindowMaximize() +{ + if (window) + { + window->Maximize(); + } +} + +void AMultiWindowActor::SetWindowRestore() +{ + if (window) + { + window->Restore(); + } +} + +void AMultiWindowActor::SetWindowMinimize() +{ + if (window) + { + window->Minimize(); + } +} + +void AMultiWindowActor::SetWindowClose() +{ + if (window) + { + if (OnWindowClose.IsBound()) + { + OnWindowClose.Broadcast(); + } + OnWindowClose.Clear(); + + window->GetOnWindowClosedEvent().RemoveAll(this); + window->GetOnWindowActivatedEvent().RemoveAll(this); + window->GetOnWindowDeactivatedEvent().RemoveAll(this); + + //window->DestroyWindowImmediately(); + window->RequestDestroyWindow(); + window.Reset(); + Destroy(); + } +} + +FText AMultiWindowActor::GetWindowTitle() +{ + if (window) + { + return window->GetTitle(); + } + return FText(); +} + +void AMultiWindowActor::SetDPIScaleFactor(const float Factor) +{ + if (window) + { + window->SetDPIScaleFactor(Factor); + } +} + +float AMultiWindowActor::GetDPIScaleFactor() const +{ + if (window) + { + return window->GetDPIScaleFactor(); + } + return 0.0f; +} diff --git a/SpaceStudioClient/Plugins/MultiWindow/Source/MultiWindow/Private/MultiWindowBPLibrary.cpp b/SpaceStudioClient/Plugins/MultiWindow/Source/MultiWindow/Private/MultiWindowBPLibrary.cpp new file mode 100644 index 0000000..d07d5a6 --- /dev/null +++ b/SpaceStudioClient/Plugins/MultiWindow/Source/MultiWindow/Private/MultiWindowBPLibrary.cpp @@ -0,0 +1,171 @@ +/************************************************************************/ +/* Author: YWT20 */ +/* Expected release year : 2024 */ +/************************************************************************/ + +#include "MultiWindowBPLibrary.h" +#include "Engine.h" +#include "Blueprint/UserWidget.h" +#include "SMWindow.h" +#include "Components/Widget.h" +#include "Widgets/SWidget.h" +#include "Widgets/Layout/SConstraintCanvas.h" +#include "Framework/Application/SlateApplication.h" +#include "Engine/GameViewportClient.h" +#include "GenericPlatform/GenericApplication.h" +#include "GameFramework/GameUserSettings.h" +#include "MultiWindow.h" + + +UMultiWindowBPLibrary::UMultiWindowBPLibrary(const FObjectInitializer& ObjectInitializer) + : Super(ObjectInitializer) +{ + +} + +bool UMultiWindowBPLibrary::CreateMultiWindow( + UObject* WorldContextObject, + UUserWidget* ContentWidget, + AMultiWindowActor*& MultiWindowActor, + FVector2D WindowPositon, + FVector2D WindowSize, + bool bIsAutoCenter, + bool bIsCreateTitle, + FString WindowTitle, + float WindowBorderMarginLeft, + float WindowBorderMarginTop, + float WindowBorderMarginRight, + float WindowBorderMarginBottom, + EWindowSizingRule WindowSizingRule, + bool bIsAutoContentDPIScale, + bool IsTopmostWindow, + bool ForceFocusToGameViewport +) +{ + TSharedPtr window = SNew(SMWindow) + .Title(FText::FromString(WindowTitle)) + .ScreenPosition(WindowPositon) + .ClientSize(WindowSize) + .FocusWhenFirstShown(true) + .HasCloseButton(true) + .IsTopmostWindow(IsTopmostWindow) + .SupportsMaximize(true) + .LayoutBorder(FMargin(WindowBorderMarginLeft, WindowBorderMarginTop, WindowBorderMarginRight, WindowBorderMarginBottom)) + .SupportsMinimize(true) + .CreateTitleBar(bIsCreateTitle) + .AutoCenter(bIsAutoCenter ? (EAutoCenter::PrimaryWorkArea) : (EAutoCenter::None)) + .SizingRule((ESizingRule)WindowSizingRule); + + if (!window.IsValid()) { return false; } + + window->SetViewportSizeDrivenByWindow(true); + FSlateApplication& slateApp = FSlateApplication::Get(); + + + TArray> OutWindows; + + slateApp.GetAllVisibleWindowsOrdered(OutWindows); + + if (TSharedPtr MainMenu = OutWindows[0]) + { + slateApp.AddWindowAsNativeChild(window.ToSharedRef(), MainMenu.ToSharedRef()); + } + else + { + slateApp.AddWindow(window.ToSharedRef(), true); + } + + if (ContentWidget) + { + window->SetContent(ContentWidget->TakeWidget()); + } + window->SetWindowMode(EWindowMode::Windowed); + if (UWorld* World = GEngine->GetWorldFromContextObjectChecked(WorldContextObject)) { + MultiWindowActor = World->SpawnActor(FVector::ZeroVector, FRotator::ZeroRotator); + MultiWindowActor->InitWindow(window, ContentWidget); + MultiWindowActor->WindowOriginSize = WindowSize; + MultiWindowActor->bIsAutoContentDPIScale = bIsAutoContentDPIScale; + MultiWindowActor->ForceFocusToGameViewport = ForceFocusToGameViewport; + window->MultiWindowActor = MultiWindowActor; + } + + return true; +} + +bool UMultiWindowBPLibrary::CreateRelativeMultiWindow(UObject* WorldContextObject, UUserWidget* ContentWidget, AMultiWindowActor*& MultiWindowActor, int32 MonitorIndex, FVector2D WindowPositon, FVector2D WindowSize, bool bIsAutoCenter, bool bIsCreateTitle, FString WindowTitle, float WindowBorderMarginLeft, float WindowBorderMarginTop, float WindowBorderMarginRight, float WindowBorderMarginBottom, EWindowSizingRule WindowSizingRule, bool bIsAutoContentDPIScale, bool IsTopmostWindow, bool ForceFocusToGameViewport) +{ + CreateMultiWindow(WorldContextObject, ContentWidget, MultiWindowActor, WindowPositon, WindowSize, bIsAutoCenter, bIsCreateTitle, WindowTitle, WindowBorderMarginLeft, WindowBorderMarginTop, WindowBorderMarginRight, WindowBorderMarginBottom, WindowSizingRule, bIsAutoContentDPIScale, IsTopmostWindow); + + if (MonitorIndex < 0) return false; + + FDisplayMetrics displayMetrics; + displayMetrics.RebuildDisplayMetrics(displayMetrics); + + if (!displayMetrics.MonitorInfo.IsValidIndex(MonitorIndex)) return false; + FMonitorInfo monitorInfo = displayMetrics.MonitorInfo[MonitorIndex]; + + if (!GEngine) return false; + + if (bIsAutoCenter) + { + WindowPositon = FVector2D(monitorInfo.WorkArea.Left, monitorInfo.WorkArea.Top); + WindowPositon += FVector2D(monitorInfo.NativeWidth * 0.5f, monitorInfo.NativeHeight * 0.5f); + WindowPositon -= WindowSize / 2; + } + else + { + WindowPositon += FVector2D(monitorInfo.WorkArea.Left, monitorInfo.WorkArea.Top); + } + + + MultiWindowActor->ForceFocusToGameViewport = ForceFocusToGameViewport; + MultiWindowActor->SetWindowPosition(WindowPositon); + return true; +} + +bool UMultiWindowBPLibrary::CreateMultiWindowByMonitor(UObject* WorldContextObject, UUserWidget* ContentWidget, AMultiWindowActor*& MultiWindowActor, int32 MonitorIndex, bool bIsCreateTitle, FString WindowTitle, bool ForceFocusToGameViewport) +{ + CreateMultiWindow(WorldContextObject, ContentWidget, MultiWindowActor, FVector2D(), FVector2D(800.0f, 640.0f), false, bIsCreateTitle, WindowTitle, 0, 0, 0, 0, EWindowSizingRule::FixedSize, false, true); + if (MonitorIndex < 0) return false; + + FDisplayMetrics displayMetrics; + displayMetrics.RebuildDisplayMetrics(displayMetrics); + + if (!displayMetrics.MonitorInfo.IsValidIndex(MonitorIndex)) return false; + FMonitorInfo monitorInfo = displayMetrics.MonitorInfo[MonitorIndex]; + + if (!GEngine) return false; + + MultiWindowActor->SetWindowPosition(FVector2D(monitorInfo.WorkArea.Left, monitorInfo.WorkArea.Top)); + MultiWindowActor->ForceFocusToGameViewport = ForceFocusToGameViewport; + MultiWindowActor->SetWindowMaximize(); + + return true; +} + +int32 UMultiWindowBPLibrary::GetMonitorCount() +{ + FDisplayMetrics displayMetrics; + displayMetrics.RebuildDisplayMetrics(displayMetrics); + return displayMetrics.MonitorInfo.Num(); +} + +int32 UMultiWindowBPLibrary::GetPrimaryMonitorIndex() +{ + FDisplayMetrics displayMetrics; + displayMetrics.RebuildDisplayMetrics(displayMetrics); + + for (int32 i = 0; i < displayMetrics.MonitorInfo.Num(); i++) + { + if (displayMetrics.MonitorInfo[i].bIsPrimary) return i; + } + + return -1; +} + +void UMultiWindowBPLibrary::MW_PrintToLog() +{ + FDisplayMetrics displayMetrics; + displayMetrics.RebuildDisplayMetrics(displayMetrics); + displayMetrics.PrintToLog(); +} diff --git a/SpaceStudioClient/Plugins/MultiWindow/Source/MultiWindow/Private/SMWindow.cpp b/SpaceStudioClient/Plugins/MultiWindow/Source/MultiWindow/Private/SMWindow.cpp new file mode 100644 index 0000000..c5b2ed8 --- /dev/null +++ b/SpaceStudioClient/Plugins/MultiWindow/Source/MultiWindow/Private/SMWindow.cpp @@ -0,0 +1,44 @@ +/************************************************************************/ +/* Author: YWT20 */ +/* Expected release year : 2024 */ +/************************************************************************/ + + +#include "SMWindow.h" +#include "MultiWindowActor.h" + +FReply SMWindow::OnKeyChar(const FGeometry& MyGeometry, const FCharacterEvent& InCharacterEvent) +{ + if (MultiWindowActor) + { + return MultiWindowActor->contentWidget->OnKeyChar(MyGeometry, InCharacterEvent).NativeReply; + } + return FReply::Unhandled(); +} + +FReply SMWindow::OnPreviewKeyDown(const FGeometry& MyGeometry, const FKeyEvent& InKeyEvent) +{ + if (MultiWindowActor) + { + return MultiWindowActor->contentWidget->OnPreviewKeyDown(MyGeometry, InKeyEvent).NativeReply; + } + return FReply::Unhandled(); +} + +FReply SMWindow::OnKeyDown(const FGeometry& MyGeometry, const FKeyEvent& InKeyEvent) +{ + if (MultiWindowActor) + { + return MultiWindowActor->contentWidget->OnKeyDown(MyGeometry, InKeyEvent).NativeReply; + } + return FReply::Unhandled(); +} + +FReply SMWindow::OnKeyUp(const FGeometry& MyGeometry, const FKeyEvent& InKeyEvent) +{ + if (MultiWindowActor) + { + return MultiWindowActor->contentWidget->OnKeyUp(MyGeometry, InKeyEvent).NativeReply; + } + return FReply::Unhandled(); +} diff --git a/SpaceStudioClient/Plugins/MultiWindow/Source/MultiWindow/Public/MultiWindow.h b/SpaceStudioClient/Plugins/MultiWindow/Source/MultiWindow/Public/MultiWindow.h new file mode 100644 index 0000000..9413f59 --- /dev/null +++ b/SpaceStudioClient/Plugins/MultiWindow/Source/MultiWindow/Public/MultiWindow.h @@ -0,0 +1,17 @@ +/************************************************************************/ +/* Author: YWT20 */ +/* Expected release year : 2024 */ +/************************************************************************/ + +#pragma once + +#include "Modules/ModuleManager.h" + +class FMultiWindowModule : public IModuleInterface +{ +public: + + /** IModuleInterface implementation */ + virtual void StartupModule() override; + virtual void ShutdownModule() override; +}; diff --git a/SpaceStudioClient/Plugins/MultiWindow/Source/MultiWindow/Public/MultiWindowActor.h b/SpaceStudioClient/Plugins/MultiWindow/Source/MultiWindow/Public/MultiWindowActor.h new file mode 100644 index 0000000..6c7fad6 --- /dev/null +++ b/SpaceStudioClient/Plugins/MultiWindow/Source/MultiWindow/Public/MultiWindowActor.h @@ -0,0 +1,147 @@ +/************************************************************************/ +/* Author: YWT20 */ +/* Expected release year : 2024 */ +/************************************************************************/ + +#pragma once +#include "CoreMinimal.h" +#include "Blueprint/UserWidget.h" +#include "GameFramework/Actor.h" +#include "Framework/Application/SlateApplication.h" +#include "TimerManager.h" +#include "MultiWindowActor.generated.h" + +DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnWindowEvent); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnWindowMovedEvent, FVector2D, pos); + +UCLASS() +class MULTIWINDOW_API AMultiWindowActor : public AActor +{ + GENERATED_BODY() + +public: + AMultiWindowActor(); + +protected: + virtual void BeginPlay() override; + + virtual void EndPlay(const EEndPlayReason::Type EndPlayReason) override; +public: + virtual void Tick(float DeltaTime) override; + + TSharedPtr window = nullptr; + + UUserWidget* contentWidget; + + FViewport* viewPort; + + FTimerHandle timerHandle; +public: + FVector2D WindowOriginSize; + + FVector2D WindowPos; + + FVector2D WindowDPI; + + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "MultiWindow") + float focusTime = 0.25f; + + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "MultiWindow") + bool ForceFocusToGameViewport; + + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "MultiWindow") + bool bIsAutoContentDPIScale; + + // Invoked when the window is about to be closed. + UPROPERTY(BlueprintAssignable, Category = "MultiWindow|Event") + FOnWindowEvent OnWindowClose; + + // Invoked when the window has been activated. + UPROPERTY(BlueprintAssignable, Category = "MultiWindow|Event") + FOnWindowEvent OnWindowActivated; + + // Invoked when the window has been deactivated. + UPROPERTY(BlueprintAssignable, Category = "MultiWindow|Event") + FOnWindowEvent OnWindowDeactivated; + + UPROPERTY(BlueprintAssignable, Category = "MultiWindow|Event") + FOnWindowMovedEvent OnWindowMoved; + +public: + void EventOnWindowClose(const TSharedRef& InSWindow) + { + if (IsPendingKillPending()) return; + if (OnWindowClose.IsBound()) + { + OnWindowClose.Broadcast(); + } + }; + +public: + // Initialize multi-window data + void InitWindow(TSharedPtr InWindow, UUserWidget* InContentWidget); + + void UpdateContentDPI(); + + void CheckFocus(); + + // Set the window visible + UFUNCTION(BlueprintCallable, Category = "MultiWindow") + void SetWindowShow(bool bIsShow); + + // Set the widget content for this window + UFUNCTION(BlueprintCallable, Category = "MultiWindow") + void SetWindowContentWidget(UUserWidget* ContentWidget); + + // Set the widget content for this window + UFUNCTION(BlueprintPure, Category = "MultiWindow") + UUserWidget* GetWindowContentWidget(); + + // Resize the window to be dpi scaled NewClientSize immediately + UFUNCTION(BlueprintCallable, Category = "MultiWindow") + void SetWindowSize(FVector2D WindowSize); + + UFUNCTION(BlueprintPure, Category = "MultiWindow") + FVector2D GetWindowSize(); + + UFUNCTION(BlueprintCallable, Category = "MultiWindow") + void SetWindowPosition(FVector2D WindowPosition); + + UFUNCTION(BlueprintPure, Category = "MultiWindow") + FVector2D GetWindowPositoin(); + + //UFUNCTION(BlueprintPure, Category = "MultiWindow") + // FVector2D GetWindowDPI(); + + // Sets the current window title + UFUNCTION(BlueprintCallable, Category = "MultiWindow") + void SetWindowTitle(const FString& WindowTitle); + + // Maximize window size + UFUNCTION(BlueprintCallable, Category = "MultiWindow") + void SetWindowMaximize(); + + // Restore window size + UFUNCTION(BlueprintCallable, Category = "MultiWindow") + void SetWindowRestore(); + + // Minimize window size + UFUNCTION(BlueprintCallable, Category = "MultiWindow") + void SetWindowMinimize(); + + // Close the window + UFUNCTION(BlueprintCallable, Category = "MultiWindow") + void SetWindowClose(); + + // Grabs the current window title + UFUNCTION(BlueprintPure, Category = "MultiWindow | V2") + FText GetWindowTitle(); + + // Overrides the DPI scale factor of the native window + UFUNCTION(BlueprintCallable, Category = "MultiWindow | V2") + void SetDPIScaleFactor(const float Factor); + + // Returns the DPI scale factor of the native window + UFUNCTION(BlueprintPure, Category = "MultiWindow | V2") + float GetDPIScaleFactor() const; +}; diff --git a/SpaceStudioClient/Plugins/MultiWindow/Source/MultiWindow/Public/MultiWindowBPLibrary.h b/SpaceStudioClient/Plugins/MultiWindow/Source/MultiWindow/Public/MultiWindowBPLibrary.h new file mode 100644 index 0000000..0fc5fe3 --- /dev/null +++ b/SpaceStudioClient/Plugins/MultiWindow/Source/MultiWindow/Public/MultiWindowBPLibrary.h @@ -0,0 +1,96 @@ +/************************************************************************/ +/* Author: YWT20 */ +/* Expected release year : 2024 */ +/************************************************************************/ + +#pragma once + +#include "Kismet/BlueprintFunctionLibrary.h" +#include "MultiWindowActor.h" +#include "MultiWindowBPLibrary.generated.h" + +UENUM(BlueprintType) +enum class EWindowSizingRule : uint8 +{ + /* The windows size fixed and cannot be resized **/ + FixedSize, + + /** The window size is computed from its content and cannot be resized by users */ + Autosized, + + /** The window can be resized by users */ + UserSized, +}; + +UCLASS() +class UMultiWindowBPLibrary : public UBlueprintFunctionLibrary +{ + GENERATED_UCLASS_BODY() +public: + // Create new window + UFUNCTION(BlueprintCallable, Category = "MultiWindow | V1", meta = (WorldContext = "WorldContextObject", AdvancedDisplay = "5")) + static bool CreateMultiWindow( + UObject* WorldContextObject, + UUserWidget* ContentWidget, + AMultiWindowActor*& MultiWindowActor, + FVector2D WindowPositon = FVector2D(0, 0), + FVector2D WindowSize = FVector2D(500, 500), + bool bIsAutoCenter = false, + bool bIsCreateTitle = true, + FString WindowTitle = FString(TEXT("MultiWindow")), + float WindowBorderMarginLeft = 5.0f, + float WindowBorderMarginTop = 5.0f, + float WindowBorderMarginRight = 5.0f, + float WindowBorderMarginBottom = 5.0f, + EWindowSizingRule WindowSizingRule = EWindowSizingRule::UserSized, + bool bIsAutoContentDPIScale = false, + bool IsTopmostWindow = false, + bool ForceFocusToGameViewport = false + ); + + // Create new relative window + UFUNCTION(BlueprintCallable, Category = "MultiWindow | V2", meta = (WorldContext = "WorldContextObject", AdvancedDisplay = "5")) + static bool CreateRelativeMultiWindow( + UObject* WorldContextObject, + UUserWidget* ContentWidget, + AMultiWindowActor*& MultiWindowActor, + int32 MonitorIndex, + FVector2D WindowPositon = FVector2D(0, 0), + FVector2D WindowSize = FVector2D(500, 500), + bool bIsAutoCenter = false, + bool bIsCreateTitle = true, + FString WindowTitle = FString(TEXT("MultiWindow")), + float WindowBorderMarginLeft = 5.0f, + float WindowBorderMarginTop = 5.0f, + float WindowBorderMarginRight = 5.0f, + float WindowBorderMarginBottom = 5.0f, + EWindowSizingRule WindowSizingRule = EWindowSizingRule::UserSized, + bool bIsAutoContentDPIScale = false, + bool IsTopmostWindow = false, + bool ForceFocusToGameViewport = false + ); + + // Create new window by Monitor + UFUNCTION(BlueprintCallable, Category = "MultiWindow | V2", meta = (WorldContext = "WorldContextObject")) + static bool CreateMultiWindowByMonitor( + UObject* WorldContextObject, + UUserWidget* ContentWidget, + AMultiWindowActor*& MultiWindowActor, + int32 MonitorIndex, + bool bIsCreateTitle = false, + FString WindowTitle = FString(TEXT("MultiWindow")), + bool ForceFocusToGameViewport = false + ); + + // Get monitor count + UFUNCTION(BlueprintPure, Category = "MultiWindow | V2") + static int32 GetMonitorCount(); + + // Get primary monitor index + UFUNCTION(BlueprintPure, Category = "MultiWindow | V2") + static int32 GetPrimaryMonitorIndex(); + + // Logs out display metrics + UFUNCTION(BlueprintCallable, Category = "MultiWindow | V2") + static void MW_PrintToLog(); +}; diff --git a/SpaceStudioClient/Plugins/MultiWindow/Source/MultiWindow/Public/SMWindow.h b/SpaceStudioClient/Plugins/MultiWindow/Source/MultiWindow/Public/SMWindow.h new file mode 100644 index 0000000..978c72e --- /dev/null +++ b/SpaceStudioClient/Plugins/MultiWindow/Source/MultiWindow/Public/SMWindow.h @@ -0,0 +1,27 @@ +/************************************************************************/ +/* Author: YWT20 */ +/* Expected release year : 2024 */ +/************************************************************************/ + +#pragma once + +#include "Framework/Application/SlateApplication.h" +#include "Widgets/SWindow.h" + + +/** + * + */ +class MULTIWINDOW_API SMWindow : public SWindow +{ +public: + class AMultiWindowActor* MultiWindowActor; +public: + virtual FReply OnKeyChar(const FGeometry& MyGeometry, const FCharacterEvent& InCharacterEvent) override; + + virtual FReply OnPreviewKeyDown(const FGeometry& MyGeometry, const FKeyEvent& InKeyEvent) override; + + virtual FReply OnKeyDown(const FGeometry& MyGeometry, const FKeyEvent& InKeyEvent) override; + + virtual FReply OnKeyUp(const FGeometry& MyGeometry, const FKeyEvent& InKeyEvent) override; +}; diff --git a/SpaceStudioClient/Plugins/NeoKinectUnreal/NeoKinectUnreal.uplugin b/SpaceStudioClient/Plugins/NeoKinectUnreal/NeoKinectUnreal.uplugin new file mode 100644 index 0000000..3fffbbc --- /dev/null +++ b/SpaceStudioClient/Plugins/NeoKinectUnreal/NeoKinectUnreal.uplugin @@ -0,0 +1,26 @@ +{ + "FileVersion": 3, + "Version": 2, + "VersionName": "1.2", + "FriendlyName": "NeoKinect", + "Description": "Allow Blueprints to use the Kinect v2 sensor capabilities.", + "Category": "Input Devices", + "CreatedBy": "Rodrigo Villani", + "CreatedByURL": "http://rvillani.com", + "DocsURL": "http://files.rvillani.com/neokinect/NeoKinect-QuickStart.pdf", + "MarketplaceURL": "com.epicgames.launcher://ue/marketplace/content/130cfe979a6e4159b634d4b1d23e60da", + "SupportURL": "mailto:contact@rvillani.com", + "EngineVersion": "5.3.0", + "CanContainContent": false, + "Installed": true, + "Modules": [ + { + "Name": "NeoKinectUnreal", + "Type": "Runtime", + "LoadingPhase": "Default", + "PlatformAllowList": [ + "Win64" + ] + } + ] +} \ No newline at end of file diff --git a/SpaceStudioClient/Plugins/NeoKinectUnreal/Resources/Icon128.png b/SpaceStudioClient/Plugins/NeoKinectUnreal/Resources/Icon128.png new file mode 100644 index 0000000..b7550c1 Binary files /dev/null and b/SpaceStudioClient/Plugins/NeoKinectUnreal/Resources/Icon128.png differ diff --git a/SpaceStudioClient/Plugins/NeoKinectUnreal/Source/NeoKinectUnreal/NeoKinectUnreal.Build.cs b/SpaceStudioClient/Plugins/NeoKinectUnreal/Source/NeoKinectUnreal/NeoKinectUnreal.Build.cs new file mode 100644 index 0000000..a0fef70 --- /dev/null +++ b/SpaceStudioClient/Plugins/NeoKinectUnreal/Source/NeoKinectUnreal/NeoKinectUnreal.Build.cs @@ -0,0 +1,68 @@ +// Copyright 2015-2023 Rodrigo Villani Pereira + +using System.IO; +using UnrealBuildTool; + +public class NeoKinectUnreal : ModuleRules +{ + public NeoKinectUnreal(ReadOnlyTargetRules Target) : base(Target) + { + PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs; + + PrivateIncludePaths.AddRange(new[] + { + "NeoKinectUnreal/Private" + // ... add other private include paths required here ... + }); + + PublicDependencyModuleNames.AddRange(new[] + { + "Core", + "CoreUObject", + // ... add other public dependencies that you statically link with here ... + }); + + PrivateDependencyModuleNames.AddRange(new[] + { + "Engine", + "RenderCore", + "RHI", + // ... add private dependencies that you statically link with here ... + }); + + string thirdPartyPath = Path.GetFullPath(Path.Combine(ModuleDirectory, "../ThirdParty/")); + + string neoKinectPath = Path.Combine(thirdPartyPath, "NeoKinect"); + string kinectPath = Path.Combine(thirdPartyPath, "Kinect"); + + PublicSystemLibraryPaths.Add(Path.Combine(neoKinectPath, "Lib")); + PublicIncludePaths.Add(Path.Combine(neoKinectPath, "Inc")); + PublicSystemLibraryPaths.Add(Path.Combine(kinectPath, "Lib")); + PublicIncludePaths.Add(Path.Combine(kinectPath, "Inc")); + + const string FaceLibraryName = "Kinect20.Face"; + + // Add static libraries + PublicSystemLibraries.AddRange(new[] + { + "NeoKinect.lib", + "Kinect20.lib", + FaceLibraryName + ".lib" + }); + + // Add dynamic libraries + const string KinectFaceDllName = FaceLibraryName + ".dll"; + PublicDelayLoadDLLs.AddRange(new[] + { + KinectFaceDllName + }); + + // Define library name for code to be able to check for its presence + PrivateDefinitions.Add("KINECT_FACE_DLL_NAME=\"" + KinectFaceDllName + "\""); + + // Stage face library files when packaging + const string ProjectDLLDir = "$(ProjectDir)/Binaries/Win64"; + RuntimeDependencies.Add(Path.Combine(ProjectDLLDir, KinectFaceDllName)); + RuntimeDependencies.Add(Path.Combine(ProjectDLLDir, "NuiDatabase/..."), StagedFileType.NonUFS); + } +} diff --git a/SpaceStudioClient/Plugins/NeoKinectUnreal/Source/NeoKinectUnreal/Private/KinectThread.cpp b/SpaceStudioClient/Plugins/NeoKinectUnreal/Source/NeoKinectUnreal/Private/KinectThread.cpp new file mode 100644 index 0000000..715a86e --- /dev/null +++ b/SpaceStudioClient/Plugins/NeoKinectUnreal/Source/NeoKinectUnreal/Private/KinectThread.cpp @@ -0,0 +1,329 @@ +// Copyright 2015-2023 Rodrigo Villani Pereira + +#include "KinectThread.h" + +#include "HAL/RunnableThread.h" + +/*----------------------------------------------------------------------------- + ThreadFrameBuffer +-----------------------------------------------------------------------------*/ + +using namespace NeoKinect; + +FThreadFrameBuffer::~FThreadFrameBuffer() +{ + DeallocateBuffers(); +} + +void FThreadFrameBuffer::Configure( + KinectFrameType Frame, + KinectPixelFormat Format, + KinectCoordinateSpace Space, + bool IsRemapped) +{ + this->FrameType = Frame; + this->PixelFormat = Format; + this->TargetSpace = Space; + this->bRemapped = IsRemapped; +} + +bool FThreadFrameBuffer::AllocateBuffers(uint32 Size) +{ + TRACE_CPUPROFILER_EVENT_SCOPE_TEXT(*FString::Printf(TEXT("Kinect_AllocateBuffers_%d"), FrameType)); + + if (IsAllocated()) + { + return true; + } + + Buffer = new uint8[Size]; + BackBuffer = new uint8[Size]; + return Buffer && BackBuffer; +} + +void FThreadFrameBuffer::DeallocateBuffers() +{ + TRACE_CPUPROFILER_EVENT_SCOPE_TEXT(*FString::Printf(TEXT("Kinect_DeallocateBuffers_%d"), FrameType)); + + bIsNew = false; + + if (Buffer) + { + Lock(); + delete[] Buffer; + Buffer = nullptr; + Unlock(); + } + + if (BackBuffer) + { + LockWrite(); + delete[] BackBuffer; + BackBuffer = nullptr; + UnlockWrite(); + } +} + +bool FThreadFrameBuffer::IsAllocated() const +{ + return Buffer && BackBuffer; +} + +const uint8* FThreadFrameBuffer::GetReadBuffer(bool bConsume /*= true*/) +{ + if (bConsume) + { + if (Buffer && bIsNew) + { + bIsNew = false; + return Buffer; + } + return nullptr; + } + + return Buffer; +} + +uint8* FThreadFrameBuffer::GetWriteBuffer() const +{ + return BackBuffer; +} + +void FThreadFrameBuffer::SetDirty() +{ + SwapBuffers(); + bIsNew = true; +} + +void FThreadFrameBuffer::SwapBuffers() +{ + TRACE_CPUPROFILER_EVENT_SCOPE_TEXT(*FString::Printf(TEXT("Kinect_SwapBuffers_%d"), FrameType)); + + Lock(); + + uint8* Temp = Buffer; + Buffer = BackBuffer; + BackBuffer = Temp; + + Unlock(); +} + +bool FThreadFrameBuffer::TryLock() +{ + return ReadMutex.TryLock(); +} + +void FThreadFrameBuffer::Lock() +{ + ReadMutex.Lock(); +} + +void FThreadFrameBuffer::Unlock() +{ + ReadMutex.Unlock(); +} + +void FThreadFrameBuffer::LockWrite() +{ + WriteMutex.Lock(); +} + +void FThreadFrameBuffer::UnlockWrite() +{ + WriteMutex.Unlock(); +} + + +/*----------------------------------------------------------------------------- + KinectThread +-----------------------------------------------------------------------------*/ + +FKinectThread* FKinectThread::Runnable = nullptr; +FCriticalSection FKinectThread::BodiesFacesCritSec; + +FThreadFrameBuffer FKinectThread::FrameBuffers[static_cast(EKinectFrame::Count)]; +bool FKinectThread::bUseBodyTracking = false; +bool FKinectThread::bUseFaceTracking = false; + +FKinectThread::FKinectThread(KinectSensor *pSensor) : + pKinect(pSensor), + bBodiesDirty(false), + bFacesDirty(false) +{ + Thread = FRunnableThread::Create(this, TEXT("FKinectThread")); // Windows give 8MB memory by default + if (!Thread) + UE_LOG(KinectThreadLog, Error, TEXT("Failed to create Kinect thread!")); +} + +FKinectThread::~FKinectThread() +{ + if (Thread) delete Thread; + Thread = nullptr; +} + +FKinectThread* FKinectThread::InitKinectPolling(KinectSensor *pSensor) +{ + // Create new instance of thread if it does not exist and the platform + // supports multi threading. + if (!Runnable && FPlatformProcess::SupportsMultithreading()) + { + Runnable = new FKinectThread(pSensor); + } + return Runnable; +} + +void FKinectThread::EnsureCompletion() +{ + TRACE_CPUPROFILER_EVENT_SCOPE(Kinect_EnsureThreadCompletion) + + Stop(); + if (Thread) + Thread->WaitForCompletion(); +} + +void FKinectThread::Shutdown() +{ + TRACE_CPUPROFILER_EVENT_SCOPE(Kinect_ShutdownThread) + + if (Runnable) + { + Runnable->EnsureCompletion(); + delete Runnable; + Runnable = nullptr; + } +} + +const KinectBody* FKinectThread::GetBodiesData() +{ + if (bBodiesDirty) + { + bBodiesDirty = false; + return Bodies; + } + return nullptr; +} + +const KinectFace* FKinectThread::GetFacesData() +{ + if (bFacesDirty) + { + bFacesDirty = false; + return Faces; + } + return nullptr; +} + +bool FKinectThread::Init() +{ + UE_LOG(KinectThreadLog, Log, TEXT("Kinect thread initialized.")); + return true; +} + +uint32 FKinectThread::Run() +{ + constexpr float UpdateInterval = 1.f / cDesiredFPS; + + UE_LOG(KinectThreadLog, Log, TEXT("Kinect thread running.")); + + // while not told to stop this thread + while (StopTaskCounter.GetValue() == 0) + { + // try locking any frames necessary + constexpr int FrameTypesCount = static_cast(KinectFrameType::Count); + + TRACE_CPUPROFILER_EVENT_SCOPE(KinectThread_Run) + + { + TRACE_CPUPROFILER_EVENT_SCOPE(Kinect_LockFrames) + for (int i = 0; i < FrameTypesCount; ++i) + { + const KinectFrameType FrameType = static_cast(i); + if (pKinect->GetIsUsingFrame(FrameType)) + { + pKinect->LockLatestFrame(FrameType); + } + } + } + + if (bUseBodyTracking) + { + TRACE_CPUPROFILER_EVENT_SCOPE(Kinect_GetBodyData) + // process bodies before face tracking - face tracking depends on bodies data + BodiesFacesCritSec.Lock(); + if (pKinect->GetLatestFrameData(Bodies)) + { + bBodiesDirty = true; + } + BodiesFacesCritSec.Unlock(); + } + + if (bUseFaceTracking) + { + TRACE_CPUPROFILER_EVENT_SCOPE(Kinect_GetFaceData) + // process face tracking + BodiesFacesCritSec.Lock(); + if (pKinect->GetLatestFrameData(Faces)) + { + bFacesDirty = true; + } + BodiesFacesCritSec.Unlock(); + } + + // update any necessary buffers + for (FThreadFrameBuffer& FrameBuffer : FrameBuffers) + { + TRACE_CPUPROFILER_EVENT_SCOPE_TEXT(*FString::Printf(TEXT("Kinect_UpdateBuffer_%d"), FrameBuffer.FrameType)); + if (FrameBuffer.IsAllocated() && pKinect->GetIsFrameLocked(FrameBuffer.FrameType)) + { + FrameBuffer.LockWrite(); + // If this is a remapped type, use the correct function. + // If the update works, marks buffer as new + if (FrameBuffer.bRemapped) + { + if (pKinect->GetRemappedFrameData( + FrameBuffer.FrameType, FrameBuffer.TargetSpace, + FrameBuffer.GetWriteBuffer(), FrameBuffer.PixelFormat)) + { + FrameBuffer.SetDirty(); + } + } + else + { + uint8* Buffer = FrameBuffer.GetWriteBuffer(); + if (pKinect->GetLatestFrameData( + FrameBuffer.FrameType, Buffer, + FrameBuffer.PixelFormat)) + { + FrameBuffer.SetDirty(); + } + } + FrameBuffer.UnlockWrite(); + } + } + + { + TRACE_CPUPROFILER_EVENT_SCOPE(Kinect_UnlockFrames) + // unlock frames + for (int i = 0; i < FrameTypesCount; ++i) + { + pKinect->UnlockLatestFrame(static_cast(i)); + } + } + + // give time for Kinect to update its frames. + FPlatformProcess::Sleep(UpdateInterval); + } + + // ended successfully! + return 0; +} + +void FKinectThread::Stop() +{ + StopTaskCounter.Increment(); +} + +void FKinectThread::Exit() +{ + UE_LOG(KinectThreadLog, Log, TEXT("Kinect thread ended.")); +} diff --git a/SpaceStudioClient/Plugins/NeoKinectUnreal/Source/NeoKinectUnreal/Private/NeoKinectBody.cpp b/SpaceStudioClient/Plugins/NeoKinectUnreal/Source/NeoKinectUnreal/Private/NeoKinectBody.cpp new file mode 100644 index 0000000..77684a2 --- /dev/null +++ b/SpaceStudioClient/Plugins/NeoKinectUnreal/Source/NeoKinectUnreal/Private/NeoKinectBody.cpp @@ -0,0 +1,547 @@ +// Copyright 2015-2023 Rodrigo Villani Pereira + +#include "NeoKinectBody.h" + +#include "Helpers/GuardedNeoKinect.h" + +#include "NeoKinectManager.h" + +UNeoKinectBody::UNeoKinectBody() + : BodyIndex(0), + TrackingId(0), + bIsTracked(false), + bIsRestricted(false), + HandLeftState(EKinectHandState::NotTracked), + HandLeftTrackingState(EKinectTrackingState::NotTracked), + HandRightState(EKinectHandState::NotTracked), + HandRightTrackingState(EKinectTrackingState::NotTracked), + LeanTrackingState(EKinectTrackingState::NotTracked), + Lean(FVector2D(0.f, 0.f)) +{ + using namespace NeoKinect; + + Joints.SetNum(KinectJointCount); + + for (int32 JointIdx = 0; JointIdx < KinectJointCount; ++JointIdx) + { + Joints[JointIdx].Type = static_cast(JointIdx); + } +} + +UNeoKinectBody::~UNeoKinectBody() +{ + Joints.Empty(); +} + +void UNeoKinectBody::GetHandStateAsExec(EKinectBodySide Hand, EKinectHandState& States) +{ + if (Hand == EKinectBodySide::Left) + { + States = HandLeftState; + } + else + { + States = HandRightState; + } +} + +EKinectHandState UNeoKinectBody::GetHandState(EKinectBodySide Hand) const +{ + if (Hand == EKinectBodySide::Left) + return HandLeftState; + else + return HandRightState; +} + +void UNeoKinectBody::GetHandConfidenceAsExec(EKinectBodySide Hand, EKinectTrackingState& States) +{ + if (Hand == EKinectBodySide::Left) + { + States = HandLeftTrackingState; + } + else + { + States = HandRightTrackingState; + } +} + +EKinectTrackingState UNeoKinectBody::GetHandConfidence(EKinectBodySide Hand) const +{ + if (Hand == EKinectBodySide::Left) + return HandLeftTrackingState; + else + return HandRightTrackingState; +} + +void UNeoKinectBody::GetLeanConfidenceAsExec(EKinectTrackingState& States) +{ + States = LeanTrackingState; +} + +TArray UNeoKinectBody::GetJoints() +{ + return Joints; +} + +FVector UNeoKinectBody::GetJointLocation(EKinectJointType Joint) +{ + return Joints[static_cast(Joint)].Location; +} + +FRotator UNeoKinectBody::GetJointOrientation(EKinectJointType Joint) +{ + return Joints[static_cast(Joint)].Orientation; +} + +FVector UNeoKinectBody::GetJointLocationColor(EKinectJointType Joint) +{ + return Joints[static_cast(Joint)].ColorLocation; +} + +FRotator UNeoKinectBody::GetJointOrientationColor(EKinectJointType Joint) +{ + return Joints[static_cast(Joint)].ColorOrientation; +} + +void UNeoKinectBody::GetJointConfidenceAsExec(EKinectJointType Joint, EKinectTrackingState& States) +{ + States = Joints[static_cast(Joint)].Confidence; +} + +EKinectTrackingState UNeoKinectBody::GetJointConfidence(EKinectJointType Joint) +{ + return Joints[static_cast(Joint)].Confidence; +} + +float UNeoKinectBody::GetJointsDistance(EKinectJointType JointA, EKinectJointType JointB) +{ + return FVector::Dist(Joints[static_cast(JointB)].Location, Joints[static_cast(JointA)].Location); +} + +float UNeoKinectBody::GetBoneLength(EKinectJointType Joint) +{ + const FVector p1 = Joints[static_cast(Joint)].Location; + switch (Joint) + { + case EKinectJointType::SpineBase: + return FVector::Dist(p1, Joints[static_cast(EKinectJointType::SpineMid)].Location); + case EKinectJointType::SpineMid: + return FVector::Dist(p1, Joints[static_cast(EKinectJointType::SpineBase)].Location); + case EKinectJointType::Neck: + return FVector::Dist(p1, Joints[static_cast(EKinectJointType::SpineShoulder)].Location); + case EKinectJointType::Head: + return FVector::Dist(p1, Joints[static_cast(EKinectJointType::Neck)].Location); + case EKinectJointType::ShoulderLeft: + return FVector::Dist(p1, Joints[static_cast(EKinectJointType::SpineShoulder)].Location); + case EKinectJointType::ElbowLeft: + return FVector::Dist(p1, Joints[static_cast(EKinectJointType::ShoulderLeft)].Location); + case EKinectJointType::WristLeft: + return FVector::Dist(p1, Joints[static_cast(EKinectJointType::ElbowLeft)].Location); + case EKinectJointType::HandLeft: + return FVector::Dist(p1, Joints[static_cast(EKinectJointType::WristLeft)].Location); + case EKinectJointType::ShoulderRight: + return FVector::Dist(p1, Joints[static_cast(EKinectJointType::SpineShoulder)].Location); + case EKinectJointType::ElbowRight: + return FVector::Dist(p1, Joints[static_cast(EKinectJointType::ShoulderRight)].Location); + case EKinectJointType::WristRight: + return FVector::Dist(p1, Joints[static_cast(EKinectJointType::ElbowRight)].Location); + case EKinectJointType::HandRight: + return FVector::Dist(p1, Joints[static_cast(EKinectJointType::WristRight)].Location); + case EKinectJointType::HipLeft: + return FVector::Dist(p1, Joints[static_cast(EKinectJointType::SpineBase)].Location); + case EKinectJointType::KneeLeft: + return FVector::Dist(p1, Joints[static_cast(EKinectJointType::HipLeft)].Location); + case EKinectJointType::AnkleLeft: + return FVector::Dist(p1, Joints[static_cast(EKinectJointType::KneeLeft)].Location); + case EKinectJointType::FootLeft: + return FVector::Dist(p1, Joints[static_cast(EKinectJointType::AnkleLeft)].Location); + case EKinectJointType::HipRight: + return FVector::Dist(p1, Joints[static_cast(EKinectJointType::SpineBase)].Location); + case EKinectJointType::KneeRight: + return FVector::Dist(p1, Joints[static_cast(EKinectJointType::HipRight)].Location); + case EKinectJointType::AnkleRight: + return FVector::Dist(p1, Joints[static_cast(EKinectJointType::KneeRight)].Location); + case EKinectJointType::FootRight: + return FVector::Dist(p1, Joints[static_cast(EKinectJointType::AnkleRight)].Location); + case EKinectJointType::SpineShoulder: + return FVector::Dist(p1, Joints[static_cast(EKinectJointType::SpineMid)].Location); + case EKinectJointType::HandTipLeft: + return FVector::Dist(p1, Joints[static_cast(EKinectJointType::WristLeft)].Location); + case EKinectJointType::ThumbLeft: + return FVector::Dist(p1, Joints[static_cast(EKinectJointType::HandLeft)].Location); + case EKinectJointType::HandTipRight: + return FVector::Dist(p1, Joints[static_cast(EKinectJointType::WristRight)].Location); + case EKinectJointType::ThumbRight: + return FVector::Dist(p1, Joints[static_cast(EKinectJointType::HandRight)].Location); + default: + return 0.f; + } +} + +float UNeoKinectBody::JointDotVector(EKinectJointType Joint, FVector Vector) +{ + Vector.Normalize(); + return FVector::DotProduct( + Vector, + FRotationMatrix(Joints[static_cast(Joint)].Orientation).GetScaledAxis(EAxis::Z)); +} + +void UNeoKinectBody::UpdateFromKinectBody(const NeoKinect::KinectBody& kBody, const NeoKinect::KinectSensor& Sensor) +{ + using namespace NeoKinect; + + // For throwing BeginTrack/Lost events after update + bool bWasTracked = bIsTracked; + + ClippedEdges.Left = kBody.clippedEdges.left; + ClippedEdges.Right = kBody.clippedEdges.right; + ClippedEdges.Top = kBody.clippedEdges.top; + ClippedEdges.Bottom = kBody.clippedEdges.bottom; + + bIsTracked = kBody.isTracked; + bIsRestricted = kBody.isRestricted; + TrackingId = kBody.trackingId; + + HandLeftState = static_cast(kBody.handLeftState); + HandLeftTrackingState = static_cast(kBody.handLeftTrackingState); + + HandRightState = static_cast(kBody.handRightState); + HandRightTrackingState = static_cast(kBody.handRightTrackingState); + + LeanTrackingState = static_cast(kBody.leanTrackingState); + Lean.Set(kBody.lean.x, kBody.lean.y); + + // update joints only if being tracked + if (bIsTracked) + { + // camera space joints transforms + for (int32 j = 0; j < KinectJointCount; ++j) + { + FKinectJoint& uJoint = Joints[j]; + KinectJoint joint = kBody.joints[j]; + + uJoint.Confidence = static_cast(joint.trackingState); + uJoint.Location.Set( + joint.position.Z * 100.f, + -joint.position.X * 100.f, + joint.position.Y * 100.f); + + // Quaternion conversion from Kinect camera's coord system to Unreal's + FQuat Quat = FQuat( + -joint.orientation.z, + joint.orientation.x, + -joint.orientation.y, + joint.orientation.w + ); + // In order to match the joints orientations to Unreal Mannequin, we + // still have some problems: + // - Kinect's bones extend along its UP axis, which is Z in Unreal. + // But Unreal's Mannequin skeleton's bones extend along X (as it is + // in Maya). So we re-create the orientation swapping the axes. + // + // - Some bones extend towards X, some against it. That's good for doing + // mirrored rotations in the animation software, so we'll keep it here + // by flipping some axes. + // + // - The pelvis and spine bones front axis is the same as the limbs side axis. + // In the Mannequin these match up, so we'll have to invert some here. +#define JNT_ID(Name) static_cast(EKinectJointType::Name) + + uint8 JointIndex = static_cast(uJoint.Type); + + if (JointIndex <= JNT_ID(Head) || JointIndex == JNT_ID(SpineShoulder)) + { // for spine bones + uJoint.Orientation = FRotationMatrix::MakeFromXZ( + Quat.GetAxisZ(), + Quat.GetAxisY()).Rotator(); + } + else if (JointIndex <= JNT_ID(WristLeft) + || JointIndex >= JNT_ID(HipRight) && JointIndex <= JNT_ID(FootRight)) + { // for left arm and right leg + uJoint.Orientation = FRotationMatrix::MakeFromXZ( + Quat.GetAxisZ(), + Quat.GetAxisX()).Rotator(); + } + else if ( (JointIndex >= JNT_ID(ShoulderRight) && JointIndex <= JNT_ID(WristRight)) + || (JointIndex >= JNT_ID(HipLeft) && JointIndex <= JNT_ID(FootLeft)) + || JointIndex == JNT_ID(HandTipRight) || JointIndex == JNT_ID(ThumbRight) + ) + { // for right arm and left leg + uJoint.Orientation = FRotationMatrix::MakeFromXZ( + -Quat.GetAxisZ(), + -Quat.GetAxisX()).Rotator(); + } + else if (JointIndex == JNT_ID(HandTipLeft) || JointIndex == JNT_ID(ThumbLeft)) + { // Left hand + uJoint.Orientation = FRotationMatrix::MakeFromXZ( + Quat.GetAxisZ(), + Quat.GetAxisX()).Rotator(); + } + else if (JointIndex == JNT_ID(HandLeft)) + { // left hand + uJoint.Orientation = FRotationMatrix::MakeFromXZ( + Quat.GetAxisZ(), + -Quat.GetAxisX()).Rotator(); + } + else if (JointIndex == JNT_ID(HandRight)) + { // right hand + uJoint.Orientation = FRotationMatrix::MakeFromXZ( + -Quat.GetAxisZ(), + Quat.GetAxisX()).Rotator(); + } +#undef JNT_ID + + } // camera space joints transforms + + if (UNeoKinectManager::IsUsingJointsColorSpaceTransforms()) + { + // color space with depth joints transforms + for (int32 j = 0; j < KinectJointCount; ++j) + { + FKinectJoint& uJoint = Joints[j]; + KinectJoint joint = kBody.joints[j]; + + // Convert camera space location to color space with depth + Vector3 ColorDepthLocation = UNeoKinectManager::CameraLocationToColorWithDepth(Vector3(joint.position)); + if (ColorDepthLocation.IsZero()) + { + // fallback for when the joint can not be seen in color camera + if (uJoint.Type == EKinectJointType::SpineBase) // oh shit! Our reference is gone! + { + uJoint.ColorLocation = uJoint.Location; + continue; + } + + FKinectJoint &SpineBase = Joints[static_cast(EKinectJointType::SpineBase)]; + uJoint.ColorLocation = SpineBase.ColorLocation + uJoint.Location - SpineBase.Location; + continue; + } + + uJoint.ColorLocation.Set( + ColorDepthLocation.z * 100.0f, + -ColorDepthLocation.x * 100.0f, + ColorDepthLocation.y * 100.0f); + } // color space with depth joints transforms + + // orientations in color space with depth +#define JOINT(Name) Joints[static_cast(EKinectJointType::Name)] +#define J_DIR(FromJoint, ToJoint) JOINT(ToJoint).ColorLocation - JOINT(FromJoint).ColorLocation +#define J_ROT(JointName, Twist) JOINT(JointName).ColorOrientation = FRotationMatrix::MakeFromX##Twist(XDir, Twist##Dir).Rotator() + + FVector XDir, YDir, ZDir, Dir1, Dir2; + FQuat Rot1, Rot2, RLerp; + float JointsDot; + + // Spine Base + XDir = J_DIR(SpineBase, SpineMid); + ZDir = J_DIR(HipLeft, HipRight); + J_ROT(SpineBase, Z); + + // Spine Middle + // same XDir + ZDir = (ZDir + J_DIR(ShoulderLeft, ShoulderRight)) / 2.0f; // intermediary between hip and shoulders twist + J_ROT(SpineMid, Z); + + // Spine Shoulder + XDir = J_DIR(SpineMid, SpineShoulder); + ZDir = J_DIR(ShoulderLeft, ShoulderRight); + J_ROT(SpineShoulder, Z); + + // Neck + XDir = J_DIR(SpineShoulder, Neck); + // same ZDir + J_ROT(Neck, Z); + + // Head + XDir = J_DIR(Neck, Head); + // same ZDir + J_ROT(Head, Z); + + // shoulder left + XDir = J_DIR(SpineShoulder, ShoulderLeft); + ZDir = J_DIR(SpineMid, SpineShoulder); + J_ROT(ShoulderLeft, Z); + + // elbow left + XDir = J_DIR(ShoulderLeft, ElbowLeft); + // interpolate between a rot for fully stretched arm and one for bent + Dir1 = FVector::CrossProduct(J_DIR(ElbowLeft, WristLeft), J_DIR(ElbowLeft, ShoulderLeft)); // bent + Rot1 = FRotationMatrix::MakeFromXZ(XDir, Dir1).ToQuat(); // bent + Dir2 = FRotationMatrix(JOINT(ShoulderLeft).ColorOrientation).GetScaledAxis(EAxis::Y); // stretched + Rot2 = FRotationMatrix::MakeFromXY(XDir, Dir2).ToQuat(); // stretched + Dir1 = J_DIR(ShoulderLeft, ElbowLeft); Dir2 = J_DIR(ElbowLeft, WristLeft); + Dir1.Normalize(); Dir2.Normalize(); + JointsDot = FVector::DotProduct(Dir1, Dir2); + RLerp = FQuat::Slerp(Rot2, Rot1, + FMath::Clamp(FMath::Acos(JointsDot) / 0.349f /*~20°*/, 0.f, 1.f) + ); + RLerp.Normalize(); + JOINT(ElbowLeft).ColorOrientation = RLerp.Rotator(); + + // wrist left + XDir = J_DIR(ElbowLeft, WristLeft); + YDir = J_DIR(HandLeft, ThumbLeft); + J_ROT(WristLeft, Y); + + // hand left + XDir = J_DIR(WristLeft, HandTipLeft); + ZDir = J_DIR(ThumbLeft, HandLeft); + J_ROT(HandLeft, Z); + + // hand tip Left + JOINT(HandTipLeft).ColorOrientation = JOINT(HandLeft).ColorOrientation; + + // thumb left + XDir = J_DIR(HandLeft, ThumbLeft); + YDir = FRotationMatrix(JOINT(HandLeft).ColorOrientation).GetScaledAxis(EAxis::Y); + J_ROT(ThumbLeft, Y); + + // shoulder right + XDir = J_DIR(ShoulderRight, SpineShoulder); + ZDir = J_DIR(SpineShoulder, SpineMid); + J_ROT(ShoulderRight, Z); + + // elbow right + XDir = J_DIR(ElbowRight, ShoulderRight); + // interpolate between a rot for fully stretched arm and one for bent + Dir1 = FVector::CrossProduct(J_DIR(ElbowRight, WristRight), J_DIR(ElbowRight, ShoulderRight)); // bent + Rot1 = FRotationMatrix::MakeFromXZ(XDir, Dir1).ToQuat(); // bent + Dir2 = FRotationMatrix(JOINT(ShoulderRight).ColorOrientation).GetScaledAxis(EAxis::Y); // stretched + Rot2 = FRotationMatrix::MakeFromXY(XDir, Dir2).ToQuat(); // stretched + Dir1 = J_DIR(ShoulderRight, ElbowRight); Dir2 = J_DIR(ElbowRight, WristRight); + Dir1.Normalize(); Dir2.Normalize(); + JointsDot = FVector::DotProduct(Dir1, Dir2); + RLerp = FQuat::Slerp(Rot2, Rot1, + FMath::Clamp(FMath::Acos(JointsDot) / 0.349f /*~20°*/, 0.f, 1.f) + ); + RLerp.Normalize(); + JOINT(ElbowRight).ColorOrientation = RLerp.Rotator(); + + // wrist right + XDir = J_DIR(WristRight, ElbowRight); + YDir = J_DIR(ThumbRight, HandRight); + J_ROT(WristRight, Y); + + // hand right + XDir = J_DIR(HandTipRight, WristRight); + ZDir = -YDir; + J_ROT(HandRight, Z); + + // hand tip right + JOINT(HandTipRight).ColorOrientation = JOINT(HandRight).ColorOrientation; + + // thumb right + XDir = J_DIR(ThumbRight, HandRight); + YDir = FRotationMatrix(JOINT(HandRight).ColorOrientation).GetScaledAxis(EAxis::Y); + J_ROT(ThumbRight, Y); + + // Hip Left + XDir = J_DIR(HipLeft, SpineBase); + ZDir = J_DIR(SpineMid, SpineBase); + J_ROT(HipLeft, Z); + + // Knee left + XDir = J_DIR(KneeLeft, HipLeft); + Dir1 = FVector::CrossProduct(J_DIR(KneeLeft, AnkleLeft), J_DIR(KneeLeft, HipLeft)); // bent + Rot1 = FRotationMatrix::MakeFromXZ(XDir, Dir1).ToQuat(); // bent + Dir2 = FRotationMatrix(JOINT(SpineMid).ColorOrientation).GetScaledAxis(EAxis::Y); // stretched + Rot2 = FRotationMatrix::MakeFromXY(XDir, Dir2).ToQuat(); // stretched + Dir1 = J_DIR(HipLeft, KneeLeft); Dir2 = J_DIR(KneeLeft, AnkleLeft); + Dir1.Normalize(); Dir2.Normalize(); + JointsDot = FVector::DotProduct(Dir1, Dir2); + RLerp = FQuat::Slerp(Rot2, Rot1, FMath::Clamp((FMath::Acos(JointsDot) - 0.2618f) / 0.5236f, 0.f, 1.f)); + RLerp.Normalize(); + JOINT(KneeLeft).ColorOrientation = RLerp.Rotator(); + + // ankle left + XDir = J_DIR(AnkleLeft, KneeLeft); + ZDir = FRotationMatrix(JOINT(KneeLeft).ColorOrientation).GetScaledAxis(EAxis::Z); + J_ROT(AnkleLeft, Z); + + // foot left + // same X and Z dirs + J_ROT(FootLeft, Z); + + // hip right + XDir = J_DIR(SpineBase, HipRight); + ZDir = J_DIR(SpineBase, SpineMid); + J_ROT(HipRight, Z); + + // Knee Right + XDir = J_DIR(HipRight, KneeRight); + Dir1 = FVector::CrossProduct(J_DIR(KneeRight, AnkleRight), J_DIR(KneeRight, HipRight)); // bent + Rot1 = FRotationMatrix::MakeFromXZ(XDir, Dir1).ToQuat(); // bent + Dir2 = -FRotationMatrix(JOINT(SpineMid).ColorOrientation).GetScaledAxis(EAxis::Y); // stretched + Rot2 = FRotationMatrix::MakeFromXY(XDir, Dir2).ToQuat(); // stretched + Dir1 = J_DIR(HipRight, KneeRight); Dir2 = J_DIR(KneeRight, AnkleRight); + Dir1.Normalize(); Dir2.Normalize(); + JointsDot = FVector::DotProduct(Dir1, Dir2); + RLerp = FQuat::Slerp(Rot2, Rot1, FMath::Clamp((FMath::Acos(JointsDot) - 0.2618f) / 0.5236f, 0.f, 1.f)); + RLerp.Normalize(); + JOINT(KneeRight).ColorOrientation = RLerp.Rotator(); + + // Ankle right + XDir = J_DIR(KneeRight, AnkleRight); + ZDir = FRotationMatrix(JOINT(KneeRight).ColorOrientation).GetScaledAxis(EAxis::Z); + J_ROT(AnkleRight, Z); + + // foot right + // same X and Z dirs + J_ROT(FootRight, Z); +#undef JOINT +#undef J_DIR +#undef J_ROT + } // if (bUsingJointsColorSpaceTransforms) + } // if (bIsTracked) + + if (bWasTracked != bIsTracked) + { + if (bIsTracked) + OnBodyBeginTrack.Broadcast(BodyIndex); + else + OnBodyLost.Broadcast(BodyIndex); + } +} + +void UNeoKinectBody::Reset() +{ + using namespace NeoKinect; + + ClippedEdges.Left = + ClippedEdges.Right = + ClippedEdges.Top = + ClippedEdges.Bottom = false; + + bIsTracked = false; + bIsRestricted = false; + TrackingId = 0Ui64; + + HandLeftState = EKinectHandState::NotTracked; + HandLeftTrackingState = EKinectTrackingState::NotTracked; + + HandRightState = EKinectHandState::NotTracked; + HandRightTrackingState = EKinectTrackingState::NotTracked; + + LeanTrackingState = EKinectTrackingState::NotTracked; + Lean.Set(0.f, 0.f); + + if (Joints.Num() != KinectJointCount) + return; + + for (int32 j = 0; j < KinectJointCount; ++j) + { + if (!Joints.IsValidIndex(j)) + continue; + FKinectJoint& Joint = Joints[j]; + + Joint.Confidence = EKinectTrackingState::NotTracked; + Joint.Location.Set(0.f, 0.f, 0.f); + Joint.ColorLocation.Set(0.f, 0.f, 0.f); + Joint.Orientation.Roll = + Joint.Orientation.Pitch = + Joint.Orientation.Yaw = 0.f; + Joint.ColorOrientation.Roll = + Joint.ColorOrientation.Pitch = + Joint.ColorOrientation.Yaw = 0.f; + } +} diff --git a/SpaceStudioClient/Plugins/NeoKinectUnreal/Source/NeoKinectUnreal/Private/NeoKinectFace.cpp b/SpaceStudioClient/Plugins/NeoKinectUnreal/Source/NeoKinectUnreal/Private/NeoKinectFace.cpp new file mode 100644 index 0000000..f08ad34 --- /dev/null +++ b/SpaceStudioClient/Plugins/NeoKinectUnreal/Source/NeoKinectUnreal/Private/NeoKinectFace.cpp @@ -0,0 +1,216 @@ +// Copyright 2015-2023 Rodrigo Villani Pereira + +#include "NeoKinectFace.h" +#include "NeoKinectBody.h" +#include "NeoKinectManager.h" + +void FIntBoundingBox::FromRectI(const RectI& Rect) +{ + Left = Rect.Left; + Top = Rect.Top; + Right = Rect.Right; + Bottom = Rect.Bottom; +} + +void FFacePoints2D::FromKinectFacePoints(const NeoKinect::KinectFacePoints& Points) +{ + LeftEye.X = Points.leftEye.x; + LeftEye.Y = Points.leftEye.y; + + RightEye.X = Points.rightEye.x; + RightEye.Y = Points.rightEye.y; + + Nose.X = Points.nose.x; + Nose.Y = Points.nose.y; + + LeftMouthCorner.X = Points.leftMouthCorner.x; + LeftMouthCorner.Y = Points.leftMouthCorner.y; + + RightMouthCorner.X = Points.rightMouthCorner.x; + RightMouthCorner.Y = Points.rightMouthCorner.y; +} + +void FFacePoints3D::FromKinectFacePoints(const NeoKinect::KinectFacePoints& ColorPoints) +{ + NeoKinect::Vector3 Location = UNeoKinectManager::ColorWithDepthFromColorOnly(ColorPoints.leftEye) * 100.f; + LeftEye.Set(-Location.z, Location.x, Location.y); + + Location = UNeoKinectManager::ColorWithDepthFromColorOnly(ColorPoints.rightEye) * 100.f; + RightEye.Set(-Location.z, Location.x, Location.y); + + Location = UNeoKinectManager::ColorWithDepthFromColorOnly(ColorPoints.nose) * 100.f; + Nose.Set(-Location.z, Location.x, Location.y); + + Location = UNeoKinectManager::ColorWithDepthFromColorOnly(ColorPoints.leftMouthCorner) * 100.f; + LeftMouthCorner.Set(-Location.z, Location.x, Location.y); + + Location = UNeoKinectManager::ColorWithDepthFromColorOnly(ColorPoints.rightMouthCorner) * 100.f; + RightMouthCorner.Set(-Location.z, Location.x, Location.y); +} + +UNeoKinectFace::UNeoKinectFace() + : Index(INDEX_NONE) + , bIsTracked(false) + , TrackingId(INDEX_NONE) + , IsEngaged(EDetectionResult::Unknown) + , IsHappy(EDetectionResult::Unknown) + , IsLookingAway(EDetectionResult::Unknown) + , IsMouthMoved(EDetectionResult::Unknown) + , IsMouthOpen(EDetectionResult::Unknown) + , IsLeftEyeClosed(EDetectionResult::Unknown) + , IsRightEyeClosed(EDetectionResult::Unknown) + , IsWearingGlasses(EDetectionResult::Unknown) +{} + +UNeoKinectFace::~UNeoKinectFace() +{} + +void UNeoKinectFace::GetEyeClosedAsExec(EKinectBodySide Eye, EDetectionResult& Result) +{ + if (Eye == EKinectBodySide::Left) + { + Result = IsLeftEyeClosed; + } + else + { + Result = IsRightEyeClosed; + } +} + +EDetectionResult UNeoKinectFace::GetEyeClosed(EKinectBodySide Eye) const +{ + if (Eye == EKinectBodySide::Left) + return IsLeftEyeClosed; + + return IsRightEyeClosed; +} + +void UNeoKinectFace::GetIsEngagedAsExec(EDetectionResult& Result) +{ + Result = IsEngaged; +} + +void UNeoKinectFace::GetIsHappyAsExec(EDetectionResult& Result) +{ + Result = IsHappy; +} + +void UNeoKinectFace::GetIsLookingAwayAsExec(EDetectionResult& Result) +{ + Result = IsLookingAway; +} + +void UNeoKinectFace::GetIsMouthMovedAsExec(EDetectionResult& Result) +{ + Result = IsMouthMoved; +} + +void UNeoKinectFace::GetIsMouthOpenAsExec(EDetectionResult& Result) +{ + Result = IsMouthOpen; +} + +void UNeoKinectFace::GetIsWearingGlassesAsExec(EDetectionResult& Result) +{ + Result = IsWearingGlasses; +} + +bool UNeoKinectFace::IsFromBody(const UNeoKinectBody* Body) const +{ + return Body->TrackingId == TrackingId; +} + +void UNeoKinectFace::UpdateFromKinectFace(const NeoKinect::KinectFace& kFace) +{ + const bool bWasTracked = bIsTracked; + + bIsTracked = kFace.bIsTracked; + TrackingId = kFace.trackingId; + + ColorBoundingBox.FromRectI(kFace.boxColor); + InfraredBoundingBox.FromRectI(kFace.boxInfrared); + + ColorAlignmentPoints.FromKinectFacePoints(kFace.pointsColor); + InfraredAlignmentPoints.FromKinectFacePoints(kFace.pointsInfrared); + ColorWithDepthAlignmentPoints.FromKinectFacePoints(kFace.pointsColor); + + /* Camera space face transform */ + Location.Set( + kFace.pivot.Z * 100.f, + -kFace.pivot.X * 100.f, + kFace.pivot.Y * 100.f); + + const FQuat Quat = FQuat( + -kFace.rotation.z, + kFace.rotation.x, + -kFace.rotation.y, + kFace.rotation.w + ); + Orientation = FRotationMatrix::MakeFromXZ( + Quat.GetAxisZ(), + -Quat.GetAxisY()).Rotator(); + + /* Color space face location */ + if (UNeoKinectManager::IsUsingJointsColorSpaceTransforms()) + { + using namespace NeoKinect; + // Convert camera space location to color space with depth + const Vector3 ColorDepthLocation = UNeoKinectManager::CameraLocationToColorWithDepth(Vector3(kFace.pivot)); + if (ColorDepthLocation.IsZero()) + { + ColorLocation = Location; + } + else + { + ColorLocation.Set( + ColorDepthLocation.z * 100.0f, + -ColorDepthLocation.x * 100.0f, + ColorDepthLocation.y * 100.0f); + } + } + + IsEngaged = static_cast(kFace.isEngaged); + IsHappy = static_cast(kFace.isHappy); + IsLookingAway = static_cast(kFace.isLookingAway); + IsMouthMoved = static_cast(kFace.isMouthMoved); + IsMouthOpen = static_cast(kFace.isMouthOpen); + IsLeftEyeClosed = static_cast(kFace.isLeftEyeClosed); + IsRightEyeClosed = static_cast(kFace.isRightEyeClosed); + IsWearingGlasses = static_cast(kFace.isWearingGlasses); + + if (bWasTracked != bIsTracked) + { + if (bIsTracked) + OnFaceBeginTrack.Broadcast(Index); + else + OnFaceLost.Broadcast(Index); + } +} + +void UNeoKinectFace::Reset() +{ + bIsTracked = false; + TrackingId = 0ULL; + + ColorBoundingBox = FIntBoundingBox(); + InfraredBoundingBox = FIntBoundingBox(); + + ColorAlignmentPoints = FFacePoints2D(); + InfraredAlignmentPoints = FFacePoints2D(); + + Location.Set(0.f, 0.f, 0.f); + ColorLocation = Location; + + Orientation.Yaw = + Orientation.Pitch = + Orientation.Roll = 0.f; + + IsEngaged = + IsHappy = + IsLookingAway = + IsMouthMoved = + IsMouthOpen = + IsLeftEyeClosed = + IsRightEyeClosed = + IsWearingGlasses = EDetectionResult::Unknown; +} diff --git a/SpaceStudioClient/Plugins/NeoKinectUnreal/Source/NeoKinectUnreal/Private/NeoKinectManager.cpp b/SpaceStudioClient/Plugins/NeoKinectUnreal/Source/NeoKinectUnreal/Private/NeoKinectManager.cpp new file mode 100644 index 0000000..adc1ee3 --- /dev/null +++ b/SpaceStudioClient/Plugins/NeoKinectUnreal/Source/NeoKinectUnreal/Private/NeoKinectManager.cpp @@ -0,0 +1,1311 @@ +// Copyright 2015-2023 Rodrigo Villani Pereira + +#include "NeoKinectManager.h" +#include "KinectThread.h" +#include "NeoKinectBody.h" +#include "NeoKinectFace.h" + +#include "RenderingThread.h" +#include "TextureResource.h" +#include "Containers/Ticker.h" +#include "Engine/TextureDefines.h" +#include "Engine/TextureRenderTarget2D.h" +#include "HAL/PlatformProcess.h" +#include "UObject/Package.h" + +using namespace NeoKinect; + +//~ STRUCTS METHODS +#pragma region Structs + +FFrameTextureData::~FFrameTextureData() +{ + Release(); +} + +bool FFrameTextureData::IsTextureValid() const +{ + if (!IsValid(Texture) || UFrameType == EKinectFrame::Count) + return false; + + const FThreadFrameBuffer &ThreadBuffer = FKinectThread::FrameBuffers[static_cast(UFrameType)]; + return ThreadBuffer.IsAllocated(); +} + +void FFrameTextureData::Release() +{ + if (UFrameType == EKinectFrame::Count) + return; + + FThreadFrameBuffer &ThreadBuffer = FKinectThread::FrameBuffers[static_cast(UFrameType)]; + ThreadBuffer.DeallocateBuffers(); + + if (IsValid(Texture)) + { + Texture->ReleaseResource(); + Texture->RemoveFromRoot(); + Texture->ConditionalBeginDestroy(); + } + Texture = nullptr; +} + +FrameDescription FFrameTextureData::GetFrameDescription(const KinectSensor *Kinect) const +{ + return Kinect->GetFrameDescription(KFrameType); +} + +#pragma endregion Structs + +//~ STATICS +#pragma region Statics + +KinectSensor* UNeoKinectManager::Kinect = nullptr; +FKinectThread* UNeoKinectManager::KinectThread = nullptr; +//bool UNeoKinectManager::bAutoShutdown = false; + +bool UNeoKinectManager::bUsingBodyFrame = false; +bool UNeoKinectManager::bUsingJointsColorSpaceTransforms = false; +bool UNeoKinectManager::bUsingFaceFrame = false; + +TArray UNeoKinectManager::Bodies; +TArray UNeoKinectManager::Faces; +FFrameTextureData UNeoKinectManager::FramesData[static_cast(EKinectFrame::Count)]; + +UNeoKinectManager* UNeoKinectManager::EventsDispatcher = nullptr; +FTSTicker::FDelegateHandle UNeoKinectManager::TickerHandle; + + +#pragma endregion Statics + +//~ INITIALIZATION / UNINITIALIZATION +#pragma region Initialization_Uninitialization + +UNeoKinectManager::UNeoKinectManager() +{ + if (!Kinect) return; + + // Bind to the bodies and faces tracking events + for (int32 i = 0; i < KinectBodyCount; ++i) + { + Bodies[i]->OnBodyBeginTrack.AddUniqueDynamic(this, &UNeoKinectManager::BodyBeginTrackBroadcast); + Bodies[i]->OnBodyLost.AddUniqueDynamic(this, &UNeoKinectManager::BodyLostBroadcast); + Faces[i]->OnFaceBeginTrack.AddUniqueDynamic(this, &UNeoKinectManager::FaceBeginTrackBroadcast); + Faces[i]->OnFaceLost.AddUniqueDynamic(this, &UNeoKinectManager::FaceLostBroadcast); + } +} + +UNeoKinectManager::~UNeoKinectManager() +{ + OnBodyBeginTrack.Clear(); + OnBodyLost.Clear(); + OnFaceBeginTrack.Clear(); + OnFaceLost.Clear(); + + UninitSensor(); + this->RemoveFromRoot(); + EventsDispatcher = nullptr; +} + +void UNeoKinectManager::InitStatics() +{ + // do we actually need to init? + if (!(Bodies.Num() != KinectBodyCount || Faces.Num() != KinectBodyCount + || Bodies[2]->BodyIndex != 2 || Faces[2]->Index != 2 + || FramesData[2].UFrameType != EKinectFrame::NormalizedDepth)) + return; // if none of the above were true + + // reset any allocated memory + Bodies.Empty(KinectBodyCount); + Faces.Empty(KinectBodyCount); + for (FFrameTextureData& FrameData : FramesData) + { + FrameData.Release(); + } + + Bodies.SetNum(KinectBodyCount, true); + Faces.SetNum(KinectBodyCount, true); + + for (int32 i = 0; i < KinectBodyCount; ++i) + { + Bodies[i] = NewObject(); + Bodies[i]->AddToRoot(); + Bodies[i]->BodyIndex = i; + Faces[i] = NewObject(); + Faces[i]->AddToRoot(); + Faces[i]->Index = i; + } + + FFrameTextureData* FrameData = &FramesData[static_cast(EKinectFrame::Color)]; + FrameData->UPixelFormat = EPixelFormat::PF_B8G8R8A8; + FrameData->KPixelFormat = KinectPixelFormat::B8G8R8A8; + FrameData->Width = KinectColorWidth; + FrameData->Height = KinectColorHeight; + FrameData->PixelSize = 4; + FrameData->KFrameType = KinectFrameType::Color; + FrameData->bRemapped = false; + FrameData->bIsSRGB = true; + + FrameData = &FramesData[static_cast(EKinectFrame::Depth)]; + FrameData->UPixelFormat = EPixelFormat::PF_G16; + FrameData->KPixelFormat = KinectPixelFormat::G16; + FrameData->Width = KinectDepthWidth; + FrameData->Height = KinectDepthHeight; + FrameData->PixelSize = 2; + FrameData->KFrameType = KinectFrameType::Depth; + FrameData->bRemapped = false; + + FrameData = &FramesData[static_cast(EKinectFrame::NormalizedDepth)]; + FrameData->UPixelFormat = EPixelFormat::PF_B8G8R8A8; + FrameData->KPixelFormat = KinectPixelFormat::B8G8R8A8; + FrameData->Width = KinectDepthWidth; + FrameData->Height = KinectDepthHeight; + FrameData->PixelSize = 4; + FrameData->KFrameType = KinectFrameType::Depth; + FrameData->bRemapped = false; + + FrameData = &FramesData[static_cast(EKinectFrame::BodyIndex)]; + FrameData->UPixelFormat = EPixelFormat::PF_G8; + FrameData->KPixelFormat = KinectPixelFormat::G8; + FrameData->Width = KinectDepthWidth; + FrameData->Height = KinectDepthHeight; + FrameData->PixelSize = 1; + FrameData->KFrameType = KinectFrameType::BodyIndex; + FrameData->bRemapped = false; + + FrameData = &FramesData[static_cast(EKinectFrame::BodyIndexColor)]; + FrameData->UPixelFormat = EPixelFormat::PF_B8G8R8A8; + FrameData->KPixelFormat = KinectPixelFormat::B8G8R8A8; + FrameData->Width = KinectDepthWidth; + FrameData->Height = KinectDepthHeight; + FrameData->PixelSize = 4; + FrameData->KFrameType = KinectFrameType::BodyIndex; + FrameData->bRemapped = false; + FrameData->bIsSRGB = true; + + FrameData = &FramesData[static_cast(EKinectFrame::Color_DepthSpace)]; + FrameData->UPixelFormat = EPixelFormat::PF_B8G8R8A8; + FrameData->KPixelFormat = KinectPixelFormat::B8G8R8A8; + FrameData->Width = KinectDepthWidth; + FrameData->Height = KinectDepthHeight; + FrameData->PixelSize = 4; + FrameData->KFrameType = KinectFrameType::Color; + FrameData->bRemapped = true; + FrameData->TargetSpace = KinectCoordinateSpace::Depth; + FrameData->bIsSRGB = true; + + FrameData = &FramesData[static_cast(EKinectFrame::Depth_ColorSpace)]; + FrameData->UPixelFormat = EPixelFormat::PF_G16; + FrameData->KPixelFormat = KinectPixelFormat::G16; + FrameData->Width = KinectColorWidth; + FrameData->Height = KinectColorHeight; + FrameData->PixelSize = 2; + FrameData->KFrameType = KinectFrameType::Depth; + FrameData->bRemapped = true; + FrameData->TargetSpace = KinectCoordinateSpace::Color; + + FrameData = &FramesData[static_cast(EKinectFrame::BodyIndex_ColorSpace)]; + FrameData->UPixelFormat = EPixelFormat::PF_G8; + FrameData->KPixelFormat = KinectPixelFormat::G8; + FrameData->Width = KinectColorWidth; + FrameData->Height = KinectColorHeight; + FrameData->PixelSize = 1; + FrameData->KFrameType = KinectFrameType::BodyIndex; + FrameData->bRemapped = true; + FrameData->TargetSpace = KinectCoordinateSpace::Color; + + FrameData = &FramesData[static_cast(EKinectFrame::Infrared)]; + FrameData->UPixelFormat = EPixelFormat::PF_G16; + FrameData->KPixelFormat = KinectPixelFormat::G16; + FrameData->Width = KinectDepthWidth; + FrameData->Height = KinectDepthHeight; + FrameData->PixelSize = 2; + FrameData->KFrameType = KinectFrameType::Infrared; + FrameData->bRemapped = false; + + FrameData = &FramesData[static_cast(EKinectFrame::LongExposureInfrared)]; + FrameData->UPixelFormat = EPixelFormat::PF_G16; + FrameData->KPixelFormat = KinectPixelFormat::G16; + FrameData->Width = KinectDepthWidth; + FrameData->Height = KinectDepthHeight; + FrameData->PixelSize = 2; + FrameData->KFrameType = KinectFrameType::LongExposureInfrared; + FrameData->bRemapped = false; + + for (int32 i = 0; i < static_cast(EKinectFrame::Count); ++i) + { + FFrameTextureData& fd = FramesData[i]; + + fd.UFrameType = static_cast(i); + fd.BufferSize = fd.Width * fd.Height * fd.PixelSize; + } +} +#pragma endregion Initialization_Uninitialization + +//~ BLUEPRINT FUNCTIONS +#pragma region Blueprint_Functions + +UNeoKinectManager* UNeoKinectManager::GetKinectEventsDispatcher() +{ + return EventsDispatcher; +} + +/* +* BASICS +*/ +#pragma region Basics + +void UNeoKinectManager::InitSensor() +{ + if (!Kinect) + { + Kinect = new KinectSensor(); + if (Kinect->InitSensor()) + { + UE_LOG(NeoKinectLog, Warning, TEXT("Kinect sensor initialized.")); + // start Kinect polling thread + KinectThread = FKinectThread::InitKinectPolling(Kinect); + InitStatics(); + + // set bodies, faces and textures update timer + TickerHandle = FTSTicker::GetCoreTicker().AddTicker(FTickerDelegate::CreateStatic(&OnTick), 1.0f / 60.0f); + + // prepare the events handler + if (!EventsDispatcher) + { + EventsDispatcher = NewObject(); + EventsDispatcher->AddToRoot(); + } + } + else + { + UE_LOG(NeoKinectLog, Error, TEXT("Kinect sensor failed to initialize.")); + Kinect = nullptr; + } + } +} + +bool UNeoKinectManager::IsKinectAvailable() +{ + return Kinect != nullptr && Kinect->IsSensorAvailable(); +} + +void UNeoKinectManager::UninitSensor() +{ + // end Kinect polling thread + if (KinectThread) + { + KinectThread->Shutdown(); + KinectThread = nullptr; + } + + // release frame textures + for (FFrameTextureData& FrameData : FramesData) + { + FrameData.Release(); + } + + // zero bodies and faces values + ResetBodies(); + ResetFaces(); + + // get global timer manager (World independent) + FTSTicker::GetCoreTicker().RemoveTicker(TickerHandle); + + if (Kinect) // release sensor + { + SetUseBodyFrame(false); + SetUseFaceFrame(false); + + Kinect->UninitSensor(); + UE_LOG(NeoKinectLog, Warning, TEXT("Kinect sensor uninitialized.")); + delete Kinect; + Kinect = nullptr; + } +} + +KinectSensor* UNeoKinectManager::GetSensor() +{ + return Kinect; +} + +/*void UNeoKinectManager::SetAutoShutdown(const bool bValue) +{ + bAutoShutdown = bValue; +} + +bool UNeoKinectManager::GetAutoShutdown() +{ + return bAutoShutdown; +}*/ + +float UNeoKinectManager::GetSensorTilt() +{ + if (!Kinect) + { + UE_LOG(NeoKinectLog, Warning, + TEXT("Tried to call %S without initializing the sensor"), __FUNCTION__); + return 0.0f; + } + return Kinect->GetSensorTilt(); +} + +FVector UNeoKinectManager::GetGroundPlane(float &Height) +{ + if (!Kinect) + { + UE_LOG(NeoKinectLog, Warning, + TEXT("Tried to call %S without initializing the sensor"), __FUNCTION__); + Height = 0.0f; + return FVector(0.0f); + } + + const Vector4 FloorClipPlane = Kinect->GetFloorClipPlane(); + Height = FloorClipPlane.w * 100.0f; + return FVector( + -FloorClipPlane.z, + FloorClipPlane.x, + FloorClipPlane.y + ); +} + +#pragma endregion Basics + +#pragma region Exposure + +void UNeoKinectManager::SetAutoExposure(float exposureCompensation /* = 0.0f */) +{ + if (!Kinect) + { + UE_LOG(NeoKinectLog, Warning, + TEXT("Tried to call %S without initializing the sensor"), __FUNCTION__); + return; + } + + Kinect->SetAutoExposure(exposureCompensation); +} + +void UNeoKinectManager::SetSemiAutoExposure(float pseudoExposureTime) +{ + if (!Kinect) + { + UE_LOG(NeoKinectLog, Warning, + TEXT("Tried to call %S without initializing the sensor"), __FUNCTION__); + return; + } + + Kinect->SetSemiAutoExposure(pseudoExposureTime); +} + +void UNeoKinectManager::SetManualExposure(float frameExposureTime, float analogGain) +{ + if (!Kinect) + { + UE_LOG(NeoKinectLog, Warning, + TEXT("Tried to call %S without initializing the sensor"), __FUNCTION__); + return; + } + + Kinect->SetManualExposure(frameExposureTime, analogGain); +} + +#pragma endregion Exposure + +#pragma region Remapping + +FVector UNeoKinectManager::CameraLocationToColorWithDepth(const FVector& CameraLocation) +{ + Vector3 KinectLocation( + -CameraLocation.Y * 0.01f, + CameraLocation.Z * 0.01f, + CameraLocation.X * 0.01f); + + KinectLocation = CameraLocationToColorWithDepth(KinectLocation); + + return FVector( + KinectLocation.z, + -KinectLocation.x, + KinectLocation.y) * 100.0f; +} + +Vector3 UNeoKinectManager::CameraLocationToColorWithDepth(Vector3 CameraLocation) +{ + if (!Kinect) + { + UE_LOG(NeoKinectLog, Warning, + TEXT("Tried to call %S without initializing the sensor"), __FUNCTION__); + return Vector3(0.0f); + } + + Vector2 ColorLocation; + + if (Kinect->GetRemappedPoint(KinectCoordinateSpace::Camera, KinectCoordinateSpace::Color, + CameraLocation, ColorLocation + )) + { + // when the joint can not be seen in color camera + if (ColorLocation.x == -std::numeric_limits::infinity() + || ColorLocation.y == -std::numeric_limits::infinity()) + { + return Vector3(0.0f); + } + + static const FrameDescription ColorDescription = Kinect->GetFrameDescription(KinectFrameType::Color); + const float HalfWidth = static_cast(ColorDescription.width >> 1); // half frame width + const float HalfHeight = static_cast(ColorDescription.height >> 1); // half frame height + const float HalfFovH = FMath::DegreesToRadians(ColorDescription.horizontalFieldOfView / 2.f); // half horizontal FOV in radians + const float HalfFovV = FMath::DegreesToRadians(ColorDescription.verticalFieldOfView / 2.f); // half vertical FOV in radians + const float HoriCornerTan = FMath::Tan(HalfFovH); + const float VertCornerTan = FMath::Tan(HalfFovV); + + const float xPct = (ColorLocation.x - HalfWidth) / HalfWidth; + const float yPct = (ColorLocation.y - HalfHeight) / HalfHeight; + + // position at z = 1m from the camera + const float x = xPct * HoriCornerTan; + const float y = -yPct * VertCornerTan; + const Vector3 Direction(x, y, 1.0f); + + return Direction * CameraLocation.z; + } + + return Vector3(0.0f); +} + +FVector2D UNeoKinectManager::CameraLocationToColorPoint(const FVector& CameraLocation) +{ + if (!Kinect) + { + UE_LOG(NeoKinectLog, Warning, + TEXT("Tried to call %S without initializing the sensor"), __FUNCTION__); + return FVector2D(0.0f, 0.0f); + } + + const Vector3 KinectLocation( + -CameraLocation.Y * 0.01f, + CameraLocation.Z * 0.01f, + CameraLocation.X * 0.01f); + Vector2 ColorPoint; + + if (Kinect->GetRemappedPoint(KinectCoordinateSpace::Camera, KinectCoordinateSpace::Color, + KinectLocation, ColorPoint)) + { + return FVector2D(ColorPoint.x, ColorPoint.y); + } + + return FVector2D(0.0f, 0.0f); +} + +FVector2D UNeoKinectManager::CameraLocationToDepthPoint(const FVector& CameraLocation) +{ + if (!Kinect) + { + UE_LOG(NeoKinectLog, Warning, + TEXT("Tried to call %S without initializing the sensor"), __FUNCTION__); + return FVector2D(0.0f, 0.0f); + } + + const Vector3 KinectLocation( + -CameraLocation.Y * 0.01f, + CameraLocation.Z * 0.01f, + CameraLocation.X * 0.01f); + Vector2 DepthPoint; + + if (Kinect->GetRemappedPoint(KinectCoordinateSpace::Camera, KinectCoordinateSpace::Depth, + KinectLocation, DepthPoint)) + { + return FVector2D(DepthPoint.x, DepthPoint.y); + } + + return FVector2D(0.0f, 0.0f); +} + +Vector3 UNeoKinectManager::ColorWithDepthFromColorOnly(const Vector2& ColorLocation) +{ + if (!Kinect) + { + UE_LOG(NeoKinectLog, Warning, + TEXT("Tried to call %S without initializing the sensor"), __FUNCTION__); + return Vector3(0.0f); + } + + const uint16 Depth = Kinect->SampleDepthFromColorCoords(ColorLocation); + + if (!Kinect || Depth == 0 /* invalid depth */) + return Vector3(0.0f); + + const float DepthMeters = static_cast(Depth) * 0.001f; + + static const FrameDescription ColorDescription = Kinect->GetFrameDescription(KinectFrameType::Color); + const float HalfWidth = static_cast(ColorDescription.width >> 1); // half frame width + const float HalfHeight = static_cast(ColorDescription.height >> 1); // half frame height + const float HalfFovH = FMath::DegreesToRadians(ColorDescription.horizontalFieldOfView / 2.f); // half horizontal FOV in radians + const float HalfFovV = FMath::DegreesToRadians(ColorDescription.verticalFieldOfView / 2.f); // half vertical FOV in radians + const float HoriCornerTan = FMath::Tan(HalfFovH); + const float VertCornerTan = FMath::Tan(HalfFovV); + + const float xPct = (ColorLocation.x - HalfWidth) / HalfWidth; + const float yPct = (ColorLocation.y - HalfHeight) / HalfHeight; + + // normal axis + const float xNormal = FMath::Sin(FMath::Atan(xPct * HoriCornerTan)); + const float yNormal = FMath::Sin(FMath::Atan(-yPct * VertCornerTan)); + const Vector3 Direction( + xNormal, + yNormal, + FMath::Sqrt(1 - (yNormal * yNormal + xNormal * xNormal)) + ); + + return Direction * DepthMeters; +} + +FVector2D UNeoKinectManager::DepthPointToColorPoint(FVector2D DepthPoint) +{ + if (!Kinect) + { + UE_LOG(NeoKinectLog, Warning, + TEXT("Tried to call %S without initializing the sensor"), __FUNCTION__); + return FVector2D(0.0f, 0.0f); + } + + const Vector2 Depth(DepthPoint.X, DepthPoint.Y); + Vector2 ColorPoint; + + if (Kinect->GetRemappedPoint(KinectCoordinateSpace::Depth, KinectCoordinateSpace::Color, + Depth, ColorPoint)) + { + return FVector2D(ColorPoint.x, ColorPoint.y); + } + + return FVector2D(0.0f, 0.0f); +} + +FVector UNeoKinectManager::DepthPointToCameraLocation(FVector2D DepthPoint) +{ + if (!Kinect) + { + UE_LOG(NeoKinectLog, Warning, + TEXT("Tried to call %S without initializing the sensor"), __FUNCTION__); + return FVector(0.0f); + } + + const Vector2 Depth(DepthPoint.X, DepthPoint.Y); + Vector3 Result; + + if (Kinect->GetRemappedPoint(KinectCoordinateSpace::Depth, KinectCoordinateSpace::Camera, + Depth, Result)) + { + return FVector(Result.z, -Result.x, Result.y) * 100.0f; + } + + return FVector(0.0f); +} + +FVector2D UNeoKinectManager::ColorPointToDepthPoint(FVector2D ColorPoint) +{ + if (!Kinect) + { + UE_LOG(NeoKinectLog, Warning, + TEXT("Tried to call %S without initializing the sensor"), __FUNCTION__); + return FVector2D(0.0f, 0.0f); + } + + const Vector2 Color(ColorPoint.X, ColorPoint.Y); + Vector2 DepthPoint; + + if (!Kinect->GetRemappedPoint(KinectCoordinateSpace::Color, KinectCoordinateSpace::Depth, + Color, DepthPoint)) + return FVector2D(0.0f, 0.0f); + + return FVector2D(DepthPoint.x, DepthPoint.y); +} + +#pragma endregion Remapping + +/* +* TEXTURES +*/ +#pragma region Textures + +FVector2D UNeoKinectManager::GetFrameFieldOfView(EKinectFrame FrameType) +{ + if (!Kinect) + { + UE_LOG(NeoKinectLog, Warning, + TEXT("Tried to call %S without initializing the sensor"), __FUNCTION__); + return FVector2D(0.0f, 0.0f); + } + const FrameDescription fd = FramesData[static_cast(FrameType)].GetFrameDescription(Kinect); + + return FVector2D(fd.horizontalFieldOfView, fd.verticalFieldOfView); +} + +FIntPoint UNeoKinectManager::GetFrameSize(EKinectFrame FrameType) +{ + if (!Kinect) + { + UE_LOG(NeoKinectLog, Warning, + TEXT("Tried to call %S without initializing the sensor"), __FUNCTION__); + return FIntPoint(0, 0); + } + + const FFrameTextureData& Frame = FramesData[static_cast(FrameType)]; + if (Frame.bRemapped) + { + return FIntPoint(Frame.Width, Frame.Height); + } + else + { + const FrameDescription fd = Frame.GetFrameDescription(Kinect); + + return FIntPoint(fd.width, fd.height); + } +} + +UTextureRenderTarget2D* UNeoKinectManager::SetUseFrame(EKinectFrame FrameType, bool bEnable) +{ + if (!Kinect) + { + UE_LOG(NeoKinectLog, Warning, + TEXT("Tried to call %S without initializing the sensor"), __FUNCTION__); + return nullptr; + } + + FFrameTextureData& FrameData = FramesData[static_cast(FrameType)]; + + if (bEnable) + { + if (FrameData.IsTextureValid()) + return FrameData.Texture; + + // if it's a remapped type, we'll need the depth frame + if (FrameData.bRemapped) + { + if (!Kinect->SetUseFrame(KinectFrameType::Depth)) // if depth frame fails to be used + return nullptr; + } + + // configures and allocate the buffer memory + FThreadFrameBuffer &ThreadBuffer = FKinectThread::FrameBuffers[static_cast(FrameType)]; + ThreadBuffer.Configure(FrameData.KFrameType, FrameData.KPixelFormat, + FrameData.TargetSpace, FrameData.bRemapped); + // checks if allocation was successful + if (!ThreadBuffer.AllocateBuffers(FrameData.BufferSize)) + { + UE_LOG(NeoKinectLog, Error, TEXT("Failed to allocate memory for texture buffer!")); + return nullptr; + } + + // alert Kinect of frame usage + if (!Kinect->SetUseFrame(FrameData.KFrameType)) + return nullptr; + + // create the GPU texture + FrameData.Texture = CreateTexture( + FrameData.Width, FrameData.Height, + FrameData.UPixelFormat, FrameData.bIsSRGB); + + return FrameData.Texture; + } + else // bEnable == false + { + // Free unused resources + ReleaseFrameResources(FrameData); + return nullptr; + } +} + +bool UNeoKinectManager::GetIsUsingFrame(EKinectFrame FrameType) +{ + const FFrameTextureData& FrameData = FramesData[static_cast(FrameType)]; + + return FrameData.IsTextureValid(); +} + +UTextureRenderTarget2D* UNeoKinectManager::GetFrame(EKinectFrame FrameType) +{ + const FFrameTextureData& FrameData = FramesData[static_cast(FrameType)]; + + if (FrameData.IsTextureValid()) + return FrameData.Texture; + + return nullptr; +} + +float UNeoKinectManager::GetDepthFramePixel(FVector2D Coordinate) +{ + if (!Kinect) + { + UE_LOG(NeoKinectLog, Warning, + TEXT("Tried to call %S without initializing the sensor"), __FUNCTION__); + return 0.0f; + } + + return static_cast(Kinect->SampleDepthFrame(Vector2(Coordinate.X, Coordinate.Y))) * 0.1f; +} + +float UNeoKinectManager::GetDepthFromColorFramePixel(FVector2D Coordinate) +{ + if (!Kinect) + { + UE_LOG(NeoKinectLog, Warning, + TEXT("Tried to call %S without initializing the sensor"), __FUNCTION__); + return 0.0f; + } + + return static_cast(Kinect->SampleDepthFromColorCoords(Vector2(Coordinate.X, Coordinate.Y))) * 0.1f; +} + +FLinearColor UNeoKinectManager::GetColorFramePixel(FVector2D Coordinate) +{ + if (!Kinect) + { + UE_LOG(NeoKinectLog, Warning, + TEXT("Tried to call %S without initializing the sensor"), __FUNCTION__); + return FLinearColor(); + } + if (!IsUsingColor()) + { + UE_LOG(NeoKinectLog, Warning, + TEXT("Tried to call %S but the Color frame is not in use"), __FUNCTION__); + return FLinearColor(); + } + + FThreadFrameBuffer& ThreadBuffer(FKinectThread::FrameBuffers[static_cast(EKinectFrame::Color)]); + uint8 const *Buffer = ThreadBuffer.GetReadBuffer(false); + if (!Buffer) return FLinearColor(); + + const static uint32 ColorWidth = GetFrameSize(EKinectFrame::Color).X; + const static uint32 ColorHeight = GetFrameSize(EKinectFrame::Color).Y; + + if (static_cast(Coordinate.X) >= ColorWidth || static_cast(Coordinate.Y) >= ColorHeight) + { + UE_LOG(NeoKinectLog, Warning, + TEXT("%S: coordinates were beyond frame dimensions and were clamped."), __FUNCTION__); + Coordinate.X = FMath::Min(ColorWidth - 1, static_cast(Coordinate.X)); + Coordinate.Y = FMath::Min(ColorHeight - 1, static_cast(Coordinate.Y)); + } + + ThreadBuffer.Lock(); + const FLinearColor Color = *(reinterpret_cast( + Buffer + 4 * (ColorWidth * static_cast(Coordinate.Y) + static_cast(Coordinate.X)) + )); + ThreadBuffer.Unlock(); + + return Color; +} +#pragma endregion Textures + +/* +* BODIES / JOINTS +*/ +#pragma region Bodies_Joints + +TArray UNeoKinectManager::GetBodies() +{ + if (!Kinect) + { + UE_LOG(NeoKinectLog, Warning, + TEXT("Tried to call %S without initializing the sensor"), __FUNCTION__); + return TArray(); + } + SetUseBodyFrame(); + + return Bodies; +} + +TArray UNeoKinectManager::GetTrackedBodies() +{ + if (!Kinect) + { + UE_LOG(NeoKinectLog, Warning, + TEXT("Tried to call %S without initializing the sensor"), __FUNCTION__); + return TArray(); + } + SetUseBodyFrame(); + + TArray tBodies; + tBodies.Reserve(KinectBodyCount); + for (UNeoKinectBody*& Body : Bodies) + { + if (Body->bIsTracked) + tBodies.Add(Body); + } + + return tBodies; +} + +UNeoKinectBody* UNeoKinectManager::GetNearestBody(bool& HasBody) +{ + if (!Kinect) + { + UE_LOG(NeoKinectLog, Warning, + TEXT("Tried to call %S without initializing the sensor"), __FUNCTION__); + return nullptr; + } + + SetUseBodyFrame(); + + UNeoKinectBody* nBody = nullptr; + for (UNeoKinectBody*& Body : Bodies) + { + if (Body->bIsTracked) + { + // if no nearest body + if (nBody == nullptr) nBody = Body; + // else, if current body's hip is nearest from the sensor than nBody's + else if (nBody->Joints[static_cast(EKinectJointType::SpineBase)].Location.Size() > + Body->Joints[static_cast(EKinectJointType::SpineBase)].Location.Size()) + nBody = Body; + } + } + HasBody = nBody != nullptr; + return nBody; +} + +void UNeoKinectManager::SetUseJointsColorSpaceTransforms(const bool bUse) +{ + if (bUsingJointsColorSpaceTransforms == bUse) return; + + bUsingJointsColorSpaceTransforms = bUse; + if (!bUse && Kinect) + { + for (UNeoKinectBody *& uBody : Bodies) + { + for (FKinectJoint &Joint : uBody->Joints) + { + Joint.ColorLocation = FVector::ZeroVector; + Joint.ColorOrientation = FRotator::ZeroRotator; + } + } + } +} + +bool UNeoKinectManager::IsUsingJointsColorSpaceTransforms() +{ + return Kinect && bUsingJointsColorSpaceTransforms; +} + +int32 UNeoKinectManager::BodyToIndex(const UNeoKinectBody* Body) +{ + return Body->BodyIndex; +} + +UNeoKinectBody* UNeoKinectManager::IndexToBody(const int32 Index) +{ + if (Index < 0 || Index >= Bodies.Num()) + return Bodies[0]; + return Bodies[Index]; +} + +int32 UNeoKinectManager::JointToIndex(const EKinectJointType Joint) +{ + return static_cast(Joint); +} + +EKinectJointType UNeoKinectManager::IndexToJoint(const int32 Index) +{ + return static_cast(Index >= KinectJointCount || Index < 0 ? 0 : Index); +} +#pragma endregion Bodies_Joints + +/* +* FACE TRACKING +*/ +#pragma region Face_Tracking + +TArray UNeoKinectManager::GetFaces() +{ + if (!Kinect) + { + UE_LOG(NeoKinectLog, Warning, + TEXT("Tried to call %S without initializing the sensor"), __FUNCTION__); + return TArray(); + } + + SetUseFaceFrame(); + + return Faces; +} + +TArray UNeoKinectManager::GetTrackedFaces() +{ + if (!Kinect) + { + UE_LOG(NeoKinectLog, Warning, + TEXT("Tried to call %S without initializing the sensor"), __FUNCTION__); + return TArray(); + } + + SetUseFaceFrame(); + + TArray tFaces; + tFaces.Reserve(KinectBodyCount); + for (UNeoKinectFace*& Face : Faces) + { + if (Face->bIsTracked) + tFaces.Add(Face); + } + + return tFaces; +} + +UNeoKinectFace* UNeoKinectManager::GetNearestFace(bool& HasAnyFace) +{ + if (!Kinect) + { + UE_LOG(NeoKinectLog, Warning, + TEXT("Tried to call %S without initializing the sensor"), __FUNCTION__); + return nullptr; + } + + SetUseFaceFrame(); + + UNeoKinectFace* nFace = nullptr; + for (UNeoKinectFace*& Face : Faces) + { + if (Face->bIsTracked) + { + // if no nearest face + if (nFace == nullptr) nFace = Face; + // else, if current face's pivot is nearest from the sensor than nFace's + else if (nFace->Location.Size() > Face->Location.Size()) + nFace = Face; + } + } + HasAnyFace = nFace != nullptr; + return nFace; +} + +int32 UNeoKinectManager::FaceToIndex(const UNeoKinectFace *Face) +{ + return Face->Index; +} + +UNeoKinectFace* UNeoKinectManager::IndexToFace(const int32 Index) +{ + if (Index < 0 || Index >= Faces.Num()) + return Faces[0]; + return Faces[Index]; +} +#pragma endregion Face_Tracking + +/* +* CONSTANTS +*/ +#pragma region Constants + +int32 UNeoKinectManager::GetTrackableBodyCount() +{ + return KinectBodyCount; +} + +int32 UNeoKinectManager::GetTrackableFaceCount() +{ + return KinectBodyCount; +} + +int32 UNeoKinectManager::GetJointCount() +{ + return KinectJointCount; +} +#pragma endregion Constants + +#pragma endregion Blueprint_Functions + +#pragma region NonBlueprintable + +#pragma region Utils + +bool UNeoKinectManager::OnTick(float DeltaTime) +{ + TRACE_CPUPROFILER_EVENT_SCOPE(Kinect_Tick) + + if (Kinect && Kinect->IsSensorAvailable() && KinectThread) + { + /* + Read the data from the Kinect polling thread and update stuff as necessary + */ + + // try locking body and face data. If it doesn't work, leave to next frame. + if (bUsingBodyFrame && KinectThread->bBodiesDirty + && FKinectThread::BodiesFacesCritSec.TryLock()) + { + // process bodies before face tracking - face tracking depends on bodies data + ProcessBodies(KinectThread->GetBodiesData()); + + FKinectThread::BodiesFacesCritSec.Unlock(); + } + + if (bUsingFaceFrame && KinectThread->bFacesDirty + && FKinectThread::BodiesFacesCritSec.TryLock()) + { + ProcessFaces(KinectThread->GetFacesData()); + + FKinectThread::BodiesFacesCritSec.Unlock(); + } + + // Update textures on GPU from render thread + ENQUEUE_RENDER_COMMAND(FUpdateFrames)([](FRHICommandListImmediate& RHICmdList){ UpdateFrames(); }); + } + return true; +} + +bool UNeoKinectManager::IsUsingDepth() +{ + for (const FFrameTextureData& fd : FramesData) + { + if ((fd.KFrameType == KinectFrameType::Depth || fd.bRemapped) + && fd.IsTextureValid()) + return true; + } + return false; +} + +bool UNeoKinectManager::IsUsingBodyIndex() +{ + for (const FFrameTextureData& fd : FramesData) + { + if (fd.KFrameType == KinectFrameType::BodyIndex && fd.IsTextureValid()) + return true; + } + return false; +} + +bool UNeoKinectManager::IsUsingColor() +{ + for (const FFrameTextureData& fd : FramesData) + { + if (fd.KFrameType == KinectFrameType::Color && fd.IsTextureValid()) + return true; + } + return false; +} +#pragma endregion Utils + +//~ TEXTURES +#pragma region Textures + +UTextureRenderTarget2D* UNeoKinectManager::CreateTexture(int32 Width, int32 Height, EPixelFormat PixelFormat, bool sRGB) +{ + // Create the texture + UTextureRenderTarget2D* Texture = NewObject( + GetTransientPackage(), + NAME_None, + EObjectFlags::RF_Transient); + check(Texture); +#if WITH_EDITORONLY_DATA + Texture->MipGenSettings = TMGS_NoMipmaps; +#endif // WITH_EDITORONLY_DATA + Texture->OverrideFormat = PixelFormat; + Texture->RenderTargetFormat = [&PixelFormat, &sRGB]() + { + switch (PixelFormat) + { + case EPixelFormat::PF_G8: return ETextureRenderTargetFormat::RTF_R8; + case EPixelFormat::PF_G16: return ETextureRenderTargetFormat::RTF_R16f; + case EPixelFormat::PF_B8G8R8A8: + if (sRGB) + return ETextureRenderTargetFormat::RTF_RGBA8_SRGB; + return ETextureRenderTargetFormat::RTF_RGBA8; + + default:; + } + return ETextureRenderTargetFormat::RTF_RGBA8; + }(); + Texture->bAutoGenerateMips = false; + Texture->SRGB = sRGB; + Texture->bForceLinearGamma = !sRGB; + Texture->InitAutoFormat(Width, Height); + Texture->UpdateResource(); + Texture->AddToRoot(); + + return Texture; +} + +void UNeoKinectManager::UpdateFrames() +{ + // if the game thread issued a shutdown, the textures may become invalid at any time + // so, we check first + if (Kinect) + { + // Update the textures whose buffer is new + constexpr int32 n = static_cast(EKinectFrame::Count); + for (int32 i = 0; i < n; ++i) + { + FFrameTextureData& FrameData(FramesData[static_cast(i)]); + FThreadFrameBuffer& ThreadBuffer(FKinectThread::FrameBuffers[static_cast(i)]); + const uint8* Buffer = ThreadBuffer.GetReadBuffer(); + + if (Buffer && FrameData.IsTextureValid()) + { + ThreadBuffer.Lock(); + { + RHIUpdateTexture2D( + FrameData.Texture->GetRenderTargetResource()->GetRenderTargetTexture(), + 0, + FUpdateTextureRegion2D(0, 0, 0, 0, FrameData.Width, FrameData.Height), + FrameData.Width * FrameData.PixelSize, + Buffer + ); + } + ThreadBuffer.Unlock(); + } + } + } +} + +void UNeoKinectManager::ReleaseFrameResources(FFrameTextureData& FrameData) +{ + FrameData.Release(); + + switch (FrameData.KFrameType) + { + case KinectFrameType::Color: + if (!IsUsingColor() && Kinect) + Kinect->SetUseFrame(KinectFrameType::Color, false); + break; + + case KinectFrameType::Depth: + if (!IsUsingDepth() && Kinect) + Kinect->SetUseFrame(KinectFrameType::Depth, false); + break; + + case KinectFrameType::BodyIndex: + if (!IsUsingBodyIndex() && Kinect) + Kinect->SetUseFrame(KinectFrameType::BodyIndex, false); + + default: + break; + } +} + +#pragma endregion Textures + +//~ BODY PROCESSING +#pragma region Body_Process + +void UNeoKinectManager::SetUseBodyFrame(bool bUse) +{ + if (bUse == bUsingBodyFrame) return; + if (!Kinect) + { + UE_LOG(NeoKinectLog, Warning, + TEXT("Tried to call %S without initializing the sensor"), __FUNCTION__); + return; + } + + Kinect->SetUseFrame(KinectFrameType::Body, bUse); + + FKinectThread::BodiesFacesCritSec.Lock(); + FKinectThread::bUseBodyTracking = bUse; + FKinectThread::BodiesFacesCritSec.Unlock(); + + bUsingBodyFrame = bUse; +} + +void UNeoKinectManager::ProcessBodies(const KinectBody* KBodies) +{ + if (!KBodies) + { + return; + } + + TRACE_CPUPROFILER_EVENT_SCOPE(Kinect_ProcessBodies) + + for (int32 i = 0; i < KinectBodyCount; ++i) + { + UNeoKinectManager::Bodies[i]->UpdateFromKinectBody(KBodies[i], *Kinect); + } +} + +void UNeoKinectManager::ResetBodies() +{ + for (int32 i = 0; i < KinectBodyCount; ++i) + { + if (!Bodies.IsValidIndex(i)) continue; + Bodies[i]->Reset(); + } +} +#pragma endregion Body_Process + +//~ FACE TRACKING PROCESSING +#pragma region Face_Process + +void UNeoKinectManager::SetUseFaceFrame(bool bUse) +{ + if (bUse == bUsingFaceFrame) return; + if (!Kinect) + { + UE_LOG(NeoKinectLog, Warning, + TEXT("Tried to call %S without initializing the sensor"), __FUNCTION__); + return; + } + + if (bUse) + { + if (!FPlatformProcess::GetDllHandle(TEXT(KINECT_FACE_DLL_NAME))) + { + UE_LOG(NeoKinectLog, Error, + TEXT("Tried to use face tracking, but face dll %S wasn't found."), KINECT_FACE_DLL_NAME); + return; + } + + // Face pivot and tracking solving depends on body data + SetUseBodyFrame(); + } + + Kinect->SetUseFrame(KinectFrameType::Face, bUse); + + FKinectThread::BodiesFacesCritSec.Lock(); + FKinectThread::bUseFaceTracking = bUse; + FKinectThread::BodiesFacesCritSec.Unlock(); + + bUsingFaceFrame = bUse; +} + +void UNeoKinectManager::ProcessFaces(const KinectFace* KFaces) +{ + if (!KFaces) + { + return; + } + + TRACE_CPUPROFILER_EVENT_SCOPE(Kinect_ProcessBodies) + + for (int32 i = 0; i < KinectBodyCount; ++i) + { + UNeoKinectManager::Faces[i]->UpdateFromKinectFace(KFaces[i]); + } +} + +void UNeoKinectManager::ResetFaces() +{ + for (int32 i = 0; i < KinectBodyCount; ++i) + { + if (!Faces.IsValidIndex(i)) continue; + Faces[i]->Reset(); + } +} +#pragma endregion Face_Process + +void UNeoKinectManager::BodyBeginTrackBroadcast(int32 BodyIndex) +{ + OnBodyBeginTrack.Broadcast(Bodies[BodyIndex]); +} + +void UNeoKinectManager::BodyLostBroadcast(int32 BodyIndex) +{ + OnBodyLost.Broadcast(Bodies[BodyIndex]); +} + +void UNeoKinectManager::FaceBeginTrackBroadcast(int32 FaceIndex) +{ + OnFaceBeginTrack.Broadcast(Faces[FaceIndex]); +} + +void UNeoKinectManager::FaceLostBroadcast(int32 FaceIndex) +{ + OnFaceLost.Broadcast(Faces[FaceIndex]); +} + +#pragma endregion NonBlueprintable diff --git a/SpaceStudioClient/Plugins/NeoKinectUnreal/Source/NeoKinectUnreal/Private/NeoKinectUnreal.cpp b/SpaceStudioClient/Plugins/NeoKinectUnreal/Source/NeoKinectUnreal/Private/NeoKinectUnreal.cpp new file mode 100644 index 0000000..c9b62a2 --- /dev/null +++ b/SpaceStudioClient/Plugins/NeoKinectUnreal/Source/NeoKinectUnreal/Private/NeoKinectUnreal.cpp @@ -0,0 +1,5 @@ +// Copyright 2015-2023 Rodrigo Villani Pereira + +#include "Modules/ModuleManager.h" + +IMPLEMENT_MODULE(FDefaultModuleImpl, NeoKinectUnreal) diff --git a/SpaceStudioClient/Plugins/NeoKinectUnreal/Source/NeoKinectUnreal/Public/Helpers/GuardedNeoKinect.h b/SpaceStudioClient/Plugins/NeoKinectUnreal/Source/NeoKinectUnreal/Public/Helpers/GuardedNeoKinect.h new file mode 100644 index 0000000..aa7c167 --- /dev/null +++ b/SpaceStudioClient/Plugins/NeoKinectUnreal/Source/NeoKinectUnreal/Public/Helpers/GuardedNeoKinect.h @@ -0,0 +1,10 @@ +// Copyright 2015-2023 Rodrigo Villani Pereira + +#pragma once + +#include "Windows/AllowWindowsPlatformTypes.h" +#pragma warning(push) +#pragma warning(disable : 4471) +#include "NeoKinect.h" +#pragma warning(pop) +#include "Windows/HideWindowsPlatformTypes.h" diff --git a/SpaceStudioClient/Plugins/NeoKinectUnreal/Source/NeoKinectUnreal/Public/KinectThread.h b/SpaceStudioClient/Plugins/NeoKinectUnreal/Source/NeoKinectUnreal/Public/KinectThread.h new file mode 100644 index 0000000..5b24b7d --- /dev/null +++ b/SpaceStudioClient/Plugins/NeoKinectUnreal/Source/NeoKinectUnreal/Public/KinectThread.h @@ -0,0 +1,127 @@ +// Copyright 2015-2023 Rodrigo Villani Pereira + +#pragma once + +#include "Helpers/GuardedNeoKinect.h" +#include "NeoKinectEnums.h" + +#include + +#include "CoreMinimal.h" +#include "HAL/Runnable.h" + +DECLARE_LOG_CATEGORY_CLASS(KinectThreadLog, Log, All); + +struct FThreadFrameBuffer +{ + NeoKinect::KinectFrameType FrameType = NeoKinect::KinectFrameType::Count; + NeoKinect::KinectPixelFormat PixelFormat = NeoKinect::KinectPixelFormat::None; + NeoKinect::KinectCoordinateSpace TargetSpace = NeoKinect::KinectCoordinateSpace::Count; + bool bRemapped = false; + + ~FThreadFrameBuffer(); + + void Configure( + NeoKinect::KinectFrameType Frame, + NeoKinect::KinectPixelFormat PixelFormat, + NeoKinect::KinectCoordinateSpace Space, + bool IsRemapped); + bool AllocateBuffers(uint32 Size); + void DeallocateBuffers(); + bool IsAllocated() const; + + // Returns an updated buffer. If it was already consumed, return nullptr + const uint8* GetReadBuffer(bool bConsume = true); + uint8* GetWriteBuffer() const; + + void SetDirty(); + + bool TryLock(); + void Lock(); + void Unlock(); + + void LockWrite(); + void UnlockWrite(); + +private: + std::atomic bIsNew = false; + uint8 *Buffer = nullptr; + uint8 *BackBuffer = nullptr; + FCriticalSection ReadMutex; + FCriticalSection WriteMutex; + + void SwapBuffers(); +}; + +// Kinect polling thread +class FKinectThread : public FRunnable +{ +private: + /* + Kinect updates its frames, at most, at 30fps. + But, as some of them will be available at slightly different times, I'll poll + it at double that rate to be sure. + */ + static constexpr float cDesiredFPS = 60.f; + + // Singleton instance, can access the thread any time via static accessor, if it is active + static FKinectThread *Runnable; + // Thread to run FRunnable on + FRunnableThread *Thread; + // Stop this thread? Uses Thread Safe Counter + FThreadSafeCounter StopTaskCounter; + + // Kinect sensor + NeoKinect::KinectSensor *pKinect; + + // Bodies data + NeoKinect::KinectBody Bodies[NeoKinect::KinectBodyCount]; + + // Face tracking data + NeoKinect::KinectFace Faces[NeoKinect::KinectBodyCount]; + +public: + // Constructor + FKinectThread(NeoKinect::KinectSensor *pSensor); + // Destructor + ~FKinectThread() override; + + // Frames data. These control which frame buffers should or not be updated. + static FThreadFrameBuffer FrameBuffers[static_cast(EKinectFrame::Count)]; + // Controls whether body data should be read + static bool bUseBodyTracking; + // True if body data was updated since last reading + bool bBodiesDirty; + // Controls whether face tracking data should be read + static bool bUseFaceTracking; + // True if faces data was updated since last reading + bool bFacesDirty; + + // Mutex for body/face data thread safety + static FCriticalSection BodiesFacesCritSec; + + /* + Start the thread and the worker from static (easy access) + This code ensures only 1 KinectThread will be able to run at a time. + This function returns a handle to the newly started instance. + */ + static FKinectThread *InitKinectPolling(NeoKinect::KinectSensor *pSensor); + + // Makes sure this thread has stopped properly + void EnsureCompletion(); + + // Shuts down the thread. Static so it can easily be called from outside the thread context + static void Shutdown(); + + // Gets last polled bodies data. Returns nullptr if no new data + const NeoKinect::KinectBody *GetBodiesData(); + // Gets last polled faces data. Returns nullptr if no new data + const NeoKinect::KinectFace *GetFacesData(); + + // Begin FRunnable interface + virtual bool Init() override; + virtual uint32 Run() override; + virtual void Stop() override; + virtual void Exit() override; + // End FRunnable interface +}; diff --git a/SpaceStudioClient/Plugins/NeoKinectUnreal/Source/NeoKinectUnreal/Public/NeoKinectBody.h b/SpaceStudioClient/Plugins/NeoKinectUnreal/Source/NeoKinectUnreal/Public/NeoKinectBody.h new file mode 100644 index 0000000..96c35a2 --- /dev/null +++ b/SpaceStudioClient/Plugins/NeoKinectUnreal/Source/NeoKinectUnreal/Public/NeoKinectBody.h @@ -0,0 +1,297 @@ +// Copyright 2015-2023 Rodrigo Villani Pereira + +#pragma once + +#include "CoreMinimal.h" +#include "NeoKinectEnums.h" + +#include "NeoKinectBody.generated.h" + +namespace NeoKinect +{ + struct KinectBody; + class KinectSensor; +} + +/** + * Joint properties. + * + * The Location and Orientation of joints, by default, is given in camera space, + * which center is a point in the Kinect sensor not matching the color camera. + * So, to use joints over the color frame image, these coordinates must be reprojected. + * To get these reprojected values, use ColorLocation and ColorOrientation. + */ +USTRUCT(BlueprintType, Category = "NeoKinect|Structs") +struct FKinectJoint +{ + GENERATED_BODY() + + /** Joint type. */ + UPROPERTY(BlueprintReadOnly, Category = "NeoKinect|Body|Joints") + EKinectJointType Type; + /** Joint tracking confidence. */ + UPROPERTY(BlueprintReadOnly, Category = "NeoKinect|Body|Joints") + EKinectTrackingState Confidence; + + /** Joint location relative to Kinect sensor in camera space. */ + UPROPERTY(BlueprintReadOnly, Category = "NeoKinect|Body|Joints", Meta = (Keywords = "position translation transform camera")) + FVector Location; + /** Joint orientation relative to Kinect sensor in camera space. */ + UPROPERTY(BlueprintReadOnly, Category = "NeoKinect|Body|Joints", Meta = (Keywords = "transform rotation angles camera")) + FRotator Orientation; + + /** Joint location relative to Kinect sensor in color space with depth. */ + UPROPERTY(BlueprintReadOnly, Category = "NeoKinect|Body|Joints", Meta = (Keywords = "position translation transform color")) + FVector ColorLocation; + /** Joint orientation relative to Kinect sensor in color space. */ + UPROPERTY(BlueprintReadOnly, Category = "NeoKinect|Body|Joints", Meta = (Keywords = "transform rotation angles color")) + FRotator ColorOrientation; + + FKinectJoint() : + Type(EKinectJointType::AnkleLeft), + Confidence(EKinectTrackingState::NotTracked), + Location(FVector::ZeroVector), + Orientation(FRotator::ZeroRotator), + ColorLocation(FVector::ZeroVector), + ColorOrientation(FRotator::ZeroRotator) + {} +}; + +/** +* Which edges are clipping a body on the view frustum. +*/ +USTRUCT(BlueprintType, Category = "NeoKinect|Structs") +struct FKinectClippedEdges +{ + GENERATED_BODY() + + UPROPERTY(BlueprintReadOnly, Category = "NeoKinect|Body") + bool Left; + UPROPERTY(BlueprintReadOnly, Category = "NeoKinect|Body") + bool Right; + UPROPERTY(BlueprintReadOnly, Category = "NeoKinect|Body") + bool Top; + UPROPERTY(BlueprintReadOnly, Category = "NeoKinect|Body") + bool Bottom; + + FKinectClippedEdges() : + Left(false), Right(false), Top(false), Bottom(false) + {} +}; + +/** +* Represents a trackable body. +*/ +UCLASS(BlueprintType, Category = "NeoKinect|Body") +class NEOKINECTUNREAL_API UNeoKinectBody : public UObject +{ + GENERATED_BODY() + +public: + DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FBodyTrackDelegate, int32, BodyIndex); + + UNeoKinectBody(); + ~UNeoKinectBody() override; + + /** Retrieves this body index (0~5). */ + UPROPERTY(BlueprintReadOnly, Category = "NeoKinect|Body") + int32 BodyIndex; + /** Body's unique Tracking ID. */ + UPROPERTY() + int64 TrackingId; + + /** Body clipped edges from the sensor's view. */ + UPROPERTY(BlueprintReadOnly, Category = "NeoKinect|Body", Meta = (Keywords = "cut borders")) + FKinectClippedEdges ClippedEdges; + + /** If this body represents a tracked user. */ + UPROPERTY(BlueprintReadOnly, Category = "NeoKinect|Body") + bool bIsTracked; + /** If body's movement is restricted somehow. */ + UPROPERTY(BlueprintReadOnly, Category = "NeoKinect|Body") + bool bIsRestricted; + + /** Left hand pose */ + UPROPERTY(BlueprintReadOnly, Category = "NeoKinect|Body|Hands") + EKinectHandState HandLeftState; + /** Left hand tracking state */ + UPROPERTY(BlueprintReadOnly, Category = "NeoKinect|Body|Hands") + EKinectTrackingState HandLeftTrackingState; + + /** Right hand pose */ + UPROPERTY(BlueprintReadOnly, Category = "NeoKinect|Body|Hands") + EKinectHandState HandRightState; + /** Right hand tracking state */ + UPROPERTY(BlueprintReadOnly, Category = "NeoKinect|Body|Hands") + EKinectTrackingState HandRightTrackingState; + + /** Body lean tracking confidence. */ + UPROPERTY(BlueprintReadOnly, Category = "NeoKinect|Body") + EKinectTrackingState LeanTrackingState; + /** + * Body lean. + * Ranges from -1 to 1 being left to right in X and back to front in Y. + * Values of -1 and 1 represent roughly 45 degrees of inclination. + */ + UPROPERTY(BlueprintReadOnly, Category = "NeoKinect|Body", Meta = (Keywords = "inclination")) + FVector2D Lean; + + UPROPERTY() + TArray Joints; + + /** Called when this Body object starts tracking an user */ + UPROPERTY(BlueprintAssignable, Category = "NeoKinect|Body") + FBodyTrackDelegate OnBodyBeginTrack; + + /** Called when this Body object loses track of its user */ + UPROPERTY(BlueprintAssignable, Category = "NeoKinect|Body") + FBodyTrackDelegate OnBodyLost; + + /** + * Get Left/Right hand state as execution pins. + * Useful for redirecting code path, like the Branch node. + * + * @param Hand Which hand? + * @param States Current Hand state. + */ + UFUNCTION(BlueprintCallable, Category = "NeoKinect|Body|Hands", Meta = (ExpandEnumAsExecs = "States")) + void GetHandStateAsExec(EKinectBodySide Hand, EKinectHandState& States); + + /** + * Get Left/Right hand state. + * + * @param Hand Which hand? + * @return Current Hand state. + */ + UFUNCTION(BlueprintPure, Category = "SamrtKinect|Body|Hands") + EKinectHandState GetHandState(EKinectBodySide Hand) const; + + /** + * Get Left/Right hand tracking state as execution pins. + * Useful for redirecting code path, like the Branch node. + * + * @param Hand Which hand? + * @param States Current Hand tracking state. + */ + UFUNCTION(BlueprintCallable, Category = "NeoKinect|Body|Hands", Meta = (ExpandEnumAsExecs = "States")) + void GetHandConfidenceAsExec(EKinectBodySide Hand, EKinectTrackingState& States); + + /** + * Get Left/Right hand tracking state. + * + * @param Hand Which hand? + * @return Current Hand tracking state. + */ + UFUNCTION(BlueprintPure, Category = "NeoKinect|Body|Hands") + EKinectTrackingState GetHandConfidence(EKinectBodySide Hand) const; + + /** + * Get body lean tracking confidence as execution pins. + * Useful for redirecting code path, like the Branch node. + * + * @param States Lean tracking state. + */ + UFUNCTION(BlueprintCallable, Category = "NeoKinect|Body", Meta = (ExpandEnumAsExecs = "States", Keywords = "inclination")) + void GetLeanConfidenceAsExec(EKinectTrackingState& States); + + /** + * Contains this body's each joint tracking state and transform. + * + * @return This body's each joint tracking state and transform. + */ + UFUNCTION(BlueprintPure, Category = "NeoKinect|Body|Joints") + TArray GetJoints(); + + /** + * Get a Joint's location relative to Kinect sensor. + * + * @param Joint The joint type. + * @return Joint's location relative to Kinect sensor. + */ + UFUNCTION(BlueprintPure, Category = "NeoKinect|Body|Joints", Meta = (Keywords = "position translation transform")) + FVector GetJointLocation(EKinectJointType Joint); + + /** + * Get a Joint's orientation relative to Kinect sensor. + * + * @param Joint The joint type. + * @return Joint's orientation relative to Kinect sensor. + */ + UFUNCTION(BlueprintPure, Category = "NeoKinect|Body|Joints", Meta = (Keywords = "rotation angles transform")) + FRotator GetJointOrientation(EKinectJointType Joint); + + /** + * Get a Joint's location relative to Kinect sensor aligned with the Color frame. + * So, if a camera is created with the same FOV as the Kinect Color camera's and + * the Color frame texture is used as background, this location will align perfectly + * with the corresponding joint in the Color image. + * + * @param Joint The joint type. + * @return Joint's location relative to Kinect sensor. + */ + UFUNCTION(BlueprintPure, Category = "NeoKinect|Body|Joints", Meta = (Keywords = "position translation transform")) + FVector GetJointLocationColor(EKinectJointType Joint); + + /** + * Get a Joint's orientation relative to Kinect sensor aligned with the Color + * aligned joint location. + * + * @param Joint The joint type. + * @return Joint's orientation relative to Kinect sensor. + */ + UFUNCTION(BlueprintPure, Category = "NeoKinect|Body|Joints", Meta = (Keywords = "rotation angles transform")) + FRotator GetJointOrientationColor(EKinectJointType Joint); + + /** + * Get a Joint's tracking confidence as exec pins. + * Useful for redirecting the code path, like the Branch node. + * + * @param Joint The joint type. + * @param States Joint's tracking confidence. + */ + UFUNCTION(BlueprintCallable, Category = "NeoKinect|Body|Joints", Meta = (ExpandEnumAsExecs = "States")) + void GetJointConfidenceAsExec(EKinectJointType Joint, EKinectTrackingState& States); + + /** + * Get a Joint's tracking confidence. + * + * @param Joint The joint type. + * @return Joint's tracking confidence. + */ + UFUNCTION(BlueprintPure, Category = "NeoKinect|Body|Joints") + EKinectTrackingState GetJointConfidence(EKinectJointType Joint); + + /** + * Calculate the distance between two joints in the Kinect sensor space. + * + * @param JointA First joint. + * @param JointB Second joint. + * @return Distance between the two joints. + */ + UFUNCTION(BlueprintPure, Category = "NeoKinect|Body|Joints", Meta = (Keywords = "size length")) + float GetJointsDistance(EKinectJointType JointA, EKinectJointType JointB); + + /** + * Calculate the distance from a Joint's location to it's parent's location. + * Useful for getting bone sizes. Eg.: for Left Elbow, the result will be the + * distance from Left Elbow to Left Shoulder. Spine Base is the skeleton's root, + * so it will return 0. + * + * @param Joint The joint type. + * @return Distance from Joint to it's parent. + */ + UFUNCTION(BlueprintPure, Category = "NeoKinect|Body|Joints", Meta = (Keywords = "size length")) + float GetBoneLength(EKinectJointType Joint); + + /** + * The Dot product between a Joint direction and a Vector. + * + * @return -1 ~ 1: 1 = same direction as vector. -1 = opposite from vector. + */ + UFUNCTION(BlueprintPure, Category = "NeoKinect|Body|Joints", Meta = (Keywords = "pointing direction lookat")) + float JointDotVector(EKinectJointType Joint, FVector Vector); + + void UpdateFromKinectBody(const NeoKinect::KinectBody& kBody, const NeoKinect::KinectSensor& Sensor); + + void Reset(); +}; diff --git a/SpaceStudioClient/Plugins/NeoKinectUnreal/Source/NeoKinectUnreal/Public/NeoKinectEnums.h b/SpaceStudioClient/Plugins/NeoKinectUnreal/Source/NeoKinectUnreal/Public/NeoKinectEnums.h new file mode 100644 index 0000000..66d0c5b --- /dev/null +++ b/SpaceStudioClient/Plugins/NeoKinectUnreal/Source/NeoKinectUnreal/Public/NeoKinectEnums.h @@ -0,0 +1,134 @@ +// Copyright 2015-2023 Rodrigo Villani Pereira + +#pragma once + +#include "CoreMinimal.h" +#include "NeoKinectEnums.generated.h" + +/** +* The types of frames that can be read from the Kinect sensor. +*/ +UENUM(BlueprintType, Category = "NeoKinect|Enums") +enum class EKinectFrame : uint8 +{ + /** Normal camera texture. Standard RGBA format (alpha = 1) */ + Color = 0, + /** Depth sensor texture. Red channel only. Values are in millimeters */ + Depth = 1, + /** Depth sensor ranging from 0 to 1. Standard RGBA format (alpha = 1) */ + NormalizedDepth = 2, + /** Body index value in Red channel. In material editor, multiply Red by 255 + * to get actual index value (0~5) */ + BodyIndex = 3, + /** Body indexes with a color for each index. Standard RGBA format. + * Alpha = 1 where there's a body, 0 otherwise */ + BodyIndexColor = 4 UMETA(DisplayName = "Colored Body Index"), + /** Not implemented */ + Color_DepthSpace = 5 UMETA(DisplayName = "Color in Depth Space"), + /** Depth sensor image remapped to fit the color frame. Red channel only. + * Values in millimeters, 0 where remapping is not possible. */ + Depth_ColorSpace = 6 UMETA(DisplayName = "Depth in Color Space"), + /** Body index values remapped to fit the bodies in the color frame. + * Red channel only. In material editor, multiply Red by 255 to get actual + * index value (0~5). */ + BodyIndex_ColorSpace= 7 UMETA(DisplayName = "Body Index in Color Space"), + /** Infrared sensor image. Red channel only, usually very dark. */ + Infrared = 8, + /** Long exposure infrared sensor image. Red channel only. Can lower the + * sensor's FPS to get brighter image */ + LongExposureInfrared= 9, + /** Cast to int to get the number of frame types */ + Count = 10 +}; + +/** +* Body sides. +*/ +UENUM(BlueprintType, Category = "NeoKinect|Enums") +enum class EKinectBodySide : uint8 +{ + Left = 0, + Right = 1 +}; + +/** +* Possible hand states +*/ +UENUM(BlueprintType, Category = "NeoKinect|Enums") +enum class EKinectHandState : uint8 +{ + /** Pretty close to NotTracked. */ + Unknown = 0, + NotTracked = 1, + Open = 2, + Closed = 3, + /** Closed hand with index and middle fingers pointing up, near each other */ + Lasso = 4 +}; + +/** +* Tracking confidence. +*/ +UENUM(BlueprintType, Category = "NeoKinect|Enums") +enum class EKinectTrackingState : uint8 +{ + NotTracked = 0, + /** Tracked by deduction. Sometimes good, many times terrible. */ + Inferred = 1, + Tracked = 2 +}; + +/** +* The joints that the Kinect sensor tracks on each body. 25 total. +*/ +UENUM(BlueprintType, Category = "NeoKinect|Enums") +enum class EKinectJointType : uint8 +{ + /** Near the pelvis */ + SpineBase = 0, + /** Near the stomach */ + SpineMid = 1 UMETA(DisplayName = "Spine Middle"), + Neck = 2, + Head = 3, + ShoulderLeft = 4 UMETA(DisplayName = "Left Shoulder"), + ElbowLeft = 5 UMETA(DisplayName = "Left Elbow"), + WristLeft = 6 UMETA(DisplayName = "Left Wrist"), + /** In the palm center */ + HandLeft = 7 UMETA(DisplayName = "Left Hand"), + ShoulderRight = 8 UMETA(DisplayName = "Right Shoulder"), + ElbowRight = 9 UMETA(DisplayName = "Right Elbow"), + WristRight = 10 UMETA(DisplayName = "Right Wrist"), + /** In the palm center */ + HandRight = 11 UMETA(DisplayName = "Right Hand"), + /** Femur/Hip joint */ + HipLeft = 12 UMETA(DisplayName = "Left Hip"), + KneeLeft = 13 UMETA(DisplayName = "Left Knee"), + AnkleLeft = 14 UMETA(DisplayName = "Left Ankle"), + /** Tip of the foot */ + FootLeft = 15 UMETA(DisplayName = "Left Foot"), + /** Femur/Hip joint */ + HipRight = 16 UMETA(DisplayName = "Right Hip"), + KneeRight = 17 UMETA(DisplayName = "Right Knee"), + AnkleRight = 18 UMETA(DisplayName = "Right Ankle"), + /** Tip of the foot */ + FootRight = 19 UMETA(DisplayName = "Right Foot"), + /** Between the collar bones */ + SpineShoulder = 20, + HandTipLeft = 21 UMETA(DisplayName = "Left Hand Tip"), + ThumbLeft = 22 UMETA(DisplayName = "Left Thumb"), + HandTipRight = 23 UMETA(DisplayName = "Right Hand Tip"), + ThumbRight = 24 UMETA(DisplayName = "Right Thumb") +}; + +/** +* Face properties detection results +*/ +UENUM(BlueprintType, Category = "NeoKinect|Enums") +enum class EDetectionResult : uint8 +{ + Unknown = 0, + No = 1, + /** Consider it more as a "No" */ + Maybe = 2, + Yes = 3 +}; diff --git a/SpaceStudioClient/Plugins/NeoKinectUnreal/Source/NeoKinectUnreal/Public/NeoKinectFace.h b/SpaceStudioClient/Plugins/NeoKinectUnreal/Source/NeoKinectUnreal/Public/NeoKinectFace.h new file mode 100644 index 0000000..add9cd6 --- /dev/null +++ b/SpaceStudioClient/Plugins/NeoKinectUnreal/Source/NeoKinectUnreal/Public/NeoKinectFace.h @@ -0,0 +1,290 @@ +// Copyright 2015-2023 Rodrigo Villani Pereira + +#pragma once + +#include "NeoKinectEnums.h" + +#include "Windows/AllowWindowsPlatformTypes.h" +#pragma warning(push) +#pragma warning(disable : 4471) +#include "Kinect.Face.h" +#pragma warning(pop) +#include "Windows/HideWindowsPlatformTypes.h" + +#include "NeoKinectFace.generated.h" + +class UNeoKinectBody; + +namespace NeoKinect +{ + struct KinectFace; + struct KinectFacePoints; +} + +/** +* Describes the edges of a rectangle in a texture (int values) +*/ +USTRUCT(BlueprintType, Category = "NeoKinect|Structs") +struct FIntBoundingBox +{ + GENERATED_BODY() + + // Left rectangle edge + UPROPERTY(BlueprintReadOnly, Category = "NeoKinect|Face") + int32 Left = 0; + // Top rectangle edge + UPROPERTY(BlueprintReadOnly, Category = "NeoKinect|Face") + int32 Top = 0; + // Right rectangle edge + UPROPERTY(BlueprintReadOnly, Category = "NeoKinect|Face") + int32 Right = 0; + // Bottom rectangle edge + UPROPERTY(BlueprintReadOnly, Category = "NeoKinect|Face") + int32 Bottom = 0; + + void FromRectI(const RectI& Rect); +}; + +/** +* Lists the 2D of each face alignment point. +*/ +USTRUCT(BlueprintType, Category = "NeoKinect|Structs") +struct FFacePoints2D +{ + GENERATED_BODY() + + // Left eye location + UPROPERTY(BlueprintReadOnly, Category = "NeoKinect|Face") + FVector2D LeftEye = FVector2D::Zero(); + // Right eye location + UPROPERTY(BlueprintReadOnly, Category = "NeoKinect|Face") + FVector2D RightEye = FVector2D::Zero(); + // Nose location + UPROPERTY(BlueprintReadOnly, Category = "NeoKinect|Face") + FVector2D Nose = FVector2D::Zero(); + // Left mouth corner location + UPROPERTY(BlueprintReadOnly, Category = "NeoKinect|Face") + FVector2D LeftMouthCorner = FVector2D::Zero(); + // Right mouth corner location + UPROPERTY(BlueprintReadOnly, Category = "NeoKinect|Face") + FVector2D RightMouthCorner = FVector2D::Zero(); + + void FromKinectFacePoints(const NeoKinect::KinectFacePoints& Points); +}; + +/** +* Lists the 3D locations of each face alignment point. +*/ +USTRUCT(BlueprintType, Category = "NeoKinect|Structs") +struct FFacePoints3D +{ + GENERATED_BODY() + + // Left eye location + UPROPERTY(BlueprintReadOnly, Category = "NeoKinect|Face") + FVector LeftEye = FVector::Zero(); + // Right eye location + UPROPERTY(BlueprintReadOnly, Category = "NeoKinect|Face") + FVector RightEye = FVector::Zero(); + // Nose location + UPROPERTY(BlueprintReadOnly, Category = "NeoKinect|Face") + FVector Nose = FVector::Zero(); + // Left mouth corner location + UPROPERTY(BlueprintReadOnly, Category = "NeoKinect|Face") + FVector LeftMouthCorner = FVector::Zero(); + // Right mouth corner location + UPROPERTY(BlueprintReadOnly, Category = "NeoKinect|Face") + FVector RightMouthCorner = FVector::Zero(); + + void FromKinectFacePoints(const NeoKinect::KinectFacePoints& ColorPoints); +}; + +/** +* Represents a trackable body's face. +*/ +UCLASS(BlueprintType, Category = "NeoKinect|Face") +class NEOKINECTUNREAL_API UNeoKinectFace : public UObject +{ + GENERATED_BODY() + +public: + DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FFaceTrackDelegate, int32, FaceIndex); + + UNeoKinectFace(); + ~UNeoKinectFace() override; + + // This face's index in the faces array + UPROPERTY(BlueprintReadOnly, Category = "NeoKinect|Face") + int32 Index; + + // If this face is being tracked. + UPROPERTY(BlueprintReadOnly, Category = "NeoKinect|Face") + bool bIsTracked; + + // Face tracking Id. Matches it's body TrackingId. + UPROPERTY() + int64 TrackingId; + + // The face bounding box in Color space. + UPROPERTY(BlueprintReadOnly, Category = "NeoKinect|Face") + FIntBoundingBox ColorBoundingBox; + + // The face bounding box in Depth space. + UPROPERTY(BlueprintReadOnly, Category = "NeoKinect|Face") + FIntBoundingBox InfraredBoundingBox; + + // The face alignment points in Color space. + UPROPERTY(BlueprintReadOnly, Category = "NeoKinect|Face") + FFacePoints2D ColorAlignmentPoints; + + // The face alignment points in Depth space. + UPROPERTY(BlueprintReadOnly, Category = "NeoKinect|Face") + FFacePoints2D InfraredAlignmentPoints; + + /** + * The face alignment points aligned with the Color frame from the camera's + * point of view, at a distance taken from Depth frame. + * For this to have valid values the remapped Depth in Color Space frame must be activated. + */ + UPROPERTY(BlueprintReadOnly, Category = "NeoKinect|Face") + FFacePoints3D ColorWithDepthAlignmentPoints; + + // The face rotation. + UPROPERTY(BlueprintReadOnly, Meta = (Keywords = "rotation quaternion angles transform"), Category = "NeoKinect|Face") + FRotator Orientation; + + // The head pivot location. + UPROPERTY(BlueprintReadOnly, Meta = (Keywords = "location position center head translation transform"), Category = "NeoKinect|Face") + FVector Location; + + /** Head location aligned with the Color frame and with depth. + * Only valid if color transforms were activated using SetUseJointsColorSpaceTransforms */ + UPROPERTY(BlueprintReadOnly, Category = "NeoKinect|Face") + FVector ColorLocation; + + // Is the user engaged? + UPROPERTY(BlueprintReadOnly, Category = "NeoKinect|Face") + EDetectionResult IsEngaged; + + // Does the user looks happy? + UPROPERTY(BlueprintReadOnly, Category = "NeoKinect|Face") + EDetectionResult IsHappy; + + // Is the user looking away? + UPROPERTY(BlueprintReadOnly, Category = "NeoKinect|Face") + EDetectionResult IsLookingAway; + + // Did the user mouth move? + UPROPERTY(BlueprintReadOnly, Category = "NeoKinect|Face") + EDetectionResult IsMouthMoved; + + // Is the user mouth opened? + UPROPERTY(BlueprintReadOnly, Category = "NeoKinect|Face") + EDetectionResult IsMouthOpen; + + // Is the user left eye closed? + UPROPERTY(BlueprintReadOnly, Category = "NeoKinect|Face") + EDetectionResult IsLeftEyeClosed; + + // Is the user right eye closed? + UPROPERTY(BlueprintReadOnly, Category = "NeoKinect|Face") + EDetectionResult IsRightEyeClosed; + + // Is the user wearing glasses? + UPROPERTY(BlueprintReadOnly, Category = "NeoKinect|Face") + EDetectionResult IsWearingGlasses; + + /** Called when this face object starts tracking a user's face */ + UPROPERTY(BlueprintAssignable, Category = "NeoKinect|Face") + FFaceTrackDelegate OnFaceBeginTrack; + + /** Called when this face object loses its user's face */ + UPROPERTY(BlueprintAssignable, Category = "NeoKinect|Face") + FFaceTrackDelegate OnFaceLost; + + /** + * Checks if left/right eye is closed and use the result as execution pins. + * Useful for redirecting code path, like the Branch node. + * + * @param Eye Which eye? + * @param Result Is selected eye closed? Consider 'Maybe' more as a 'No'. + */ + UFUNCTION(BlueprintCallable, Category = "NeoKinect|Face", Meta = (ExpandEnumAsExecs = "Result")) + void GetEyeClosedAsExec(EKinectBodySide Eye, EDetectionResult& Result); + + /** + * Checks if left/right eye is closed. + * + * @param Eye Which eye? + * @return Is selected eye closed? Consider 'Maybe' more as a 'No'. + */ + UFUNCTION(BlueprintPure, Category = "NeoKinect|Face") + EDetectionResult GetEyeClosed(EKinectBodySide Eye) const; + + /** + * Get IsEngaged as execution pins. + * Useful for redirecting code path, like the Branch node. + * + * @param Result Consider 'Maybe' more as a 'No'. + */ + UFUNCTION(BlueprintCallable, Category = "NeoKinect|Face", Meta = (ExpandEnumAsExecs = "Result")) + void GetIsEngagedAsExec(EDetectionResult& Result); + + /** + * Gets IsHappy as execution pins. + * Useful for redirecting code path, like the Branch node. + * + * @param Result Consider 'Maybe' more as a 'No'. + */ + UFUNCTION(BlueprintCallable, Category = "NeoKinect|Face", Meta = (ExpandEnumAsExecs = "Result")) + void GetIsHappyAsExec(EDetectionResult& Result); + + /** + * Gets IsLookingAway as execution pins. + * Useful for redirecting code path, like the Branch node. + * + * @param Result Consider 'Maybe' more as a 'No'. + */ + UFUNCTION(BlueprintCallable, Category = "NeoKinect|Face", Meta = (ExpandEnumAsExecs = "Result")) + void GetIsLookingAwayAsExec(EDetectionResult& Result); + + /** + * Gets IsMouthMoved as execution pins. + * Useful for redirecting code path, like the Branch node. + * + * @param Result Consider 'Maybe' more as a 'No'. + */ + UFUNCTION(BlueprintCallable, Category = "NeoKinect|Face", Meta = (ExpandEnumAsExecs = "Result")) + void GetIsMouthMovedAsExec(EDetectionResult& Result); + + /** + * Gets IsMouthOpen as execution pins. + * Useful for redirecting code path, like the Branch node. + * + * @param Result Consider 'Maybe' more as a 'No'. + */ + UFUNCTION(BlueprintCallable, Category = "NeoKinect|Face", Meta = (ExpandEnumAsExecs = "Result")) + void GetIsMouthOpenAsExec(EDetectionResult& Result); + + /** + * Gets IsWearingGlasses as execution pins. + * Useful for redirecting code path, like the Branch node. + * + * @param Result Consider 'Maybe' more as a 'No'. + */ + UFUNCTION(BlueprintCallable, Category = "NeoKinect|Face", Meta = (ExpandEnumAsExecs = "Result")) + void GetIsWearingGlassesAsExec(EDetectionResult& Result); + + /** + * Checks if this face belongs to the passed Body instance. + * + * @param Body The body to test from. + * @return True if this face belongs to the passed body. + */ + UFUNCTION(BlueprintPure, Category = "NeoKinect|Face") + bool IsFromBody(const UNeoKinectBody* Body) const; + + void UpdateFromKinectFace(const NeoKinect::KinectFace& kFace); + + void Reset(); +}; diff --git a/SpaceStudioClient/Plugins/NeoKinectUnreal/Source/NeoKinectUnreal/Public/NeoKinectManager.h b/SpaceStudioClient/Plugins/NeoKinectUnreal/Source/NeoKinectUnreal/Public/NeoKinectManager.h new file mode 100644 index 0000000..2e726bf --- /dev/null +++ b/SpaceStudioClient/Plugins/NeoKinectUnreal/Source/NeoKinectUnreal/Public/NeoKinectManager.h @@ -0,0 +1,612 @@ +// Copyright 2015-2023 Rodrigo Villani Pereira + +#pragma once + +#include "Helpers/GuardedNeoKinect.h" + +#include "NeoKinectEnums.h" +#include "PixelFormat.h" +#include "Containers/Ticker.h" + +#include "NeoKinectManager.generated.h" + +class FKinectThread; +class UNeoKinectBody; +class UNeoKinectFace; +class UTextureRenderTarget2D; + +DECLARE_LOG_CATEGORY_CLASS(NeoKinectLog, Log, All); + +/** Structure to manage Kinect frame types lifetime and updating */ +struct FFrameTextureData +{ + UTextureRenderTarget2D *Texture = nullptr; + uint32 Width = 0; + uint32 Height = 0; + uint32 PixelSize = 0; + uint32 BufferSize = 0; + EPixelFormat UPixelFormat = EPixelFormat::PF_Unknown; + NeoKinect::KinectPixelFormat KPixelFormat = NeoKinect::KinectPixelFormat::None; + EKinectFrame UFrameType = EKinectFrame::Count; + NeoKinect::KinectFrameType KFrameType = NeoKinect::KinectFrameType::Count; + NeoKinect::KinectCoordinateSpace TargetSpace = NeoKinect::KinectCoordinateSpace::Count; + bool bIsSRGB = false; + bool bRemapped = false; + + ~FFrameTextureData(); + + inline bool IsTextureValid() const; + void Release(); + NeoKinect::FrameDescription GetFrameDescription(const NeoKinect::KinectSensor *Kinect) const; +}; + +/** +* Access the Kinect v2 sensor capabilities. +* +* When using any Remapped type of frame or any Coordinate Remapping methods, +* Depth frame use will automatically be switched on, since those functionalities +* depend on it. But don't worry about performance. The depth frame will only +* get written and updated to a texture on the GPU if the user explicitly +* asks for it using SetUseFrame(). +* +* When using Face Tracking, Body Tracking will also be automatically switched on. +* Face Tracking depends on Body Tracking for the head pivot position and for +* fixing issues when looking for a Face. +*/ +UCLASS(Category = "NeoKinect", BlueprintType) +class NEOKINECTUNREAL_API UNeoKinectManager : public UObject +{ + GENERATED_BODY() + +public: + + /** Stores the bodies that Kinect can track. The array is created only once + * and lasts until the end of the program. */ + static TArray Bodies; + /** Stores the faces that Kinect can track. The array is created only once + * and lasts until the end of the program. */ + static TArray Faces; + /** Stores all the possible frame types Kinect or the program can create. + * The array is created only once and lasts until the end of the program. */ + static FFrameTextureData FramesData[static_cast(EKinectFrame::Count)]; + + DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FBodyTrackDelegate, UNeoKinectBody*, Body); + DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FFaceTrackDelegate, UNeoKinectFace*, Face); + + /** Constructor: used only to bind the static dispatcher to the bodies/faces + * tracking events. */ + UNeoKinectManager(); + /** Destructor: unbind the static dispatcher events and makes sure to + * un-initialize the Kinect sensor before the program exits. */ + ~UNeoKinectManager() override; + + /*------------------------------------------------------------------------- + EVENTS + -------------------------------------------------------------------------*/ + +private: + /** Class singleton used to give Blueprints access to the tracking events. */ + static UNeoKinectManager* EventsDispatcher; + +public: + /** Called when the Kinect sensor has just detected a new user's body. */ + UPROPERTY(BlueprintAssignable, Category = "NeoKinect") + FBodyTrackDelegate OnBodyBeginTrack; + + /** Called when the Kinect sensor has just lost track of a user's body. */ + UPROPERTY(BlueprintAssignable, Category = "NeoKinect") + FBodyTrackDelegate OnBodyLost; + + /** Called when the Kinect sensor has just detected a new user's face. */ + UPROPERTY(BlueprintAssignable, Category = "NeoKinect") + FFaceTrackDelegate OnFaceBeginTrack; + + /** Called when the Kinect sensor has just lost track of a user's face. */ + UPROPERTY(BlueprintAssignable, Category = "NeoKinect") + FFaceTrackDelegate OnFaceLost; + + /** + * Use the object result of this function to bind to the Kinect body/face + * tracking events. You can also bind to individual bodies/faces using their + * respective objects. + * + * @return Kinect events dispatcher object. + */ + UFUNCTION(BlueprintPure, Category = "NeoKinect") + static UNeoKinectManager* GetKinectEventsDispatcher(); + + /*//////////////////////////////////////////////////////////////////////////// + + BLUEPRINT FUNCTIONS + + ////////////////////////////////////////////////////////////////////////////*/ + + /* + * BASICS + */ + + /** + * Initializes the Kinect sensor. + * + * Even though this function always works without errors, check if the sensor + * has really started by calling IsKinectAvailable. It can take a while, so + * check in intervals until it does. + */ + UFUNCTION(BlueprintCallable, meta = (DisplayName = "Init Kinect Sensor", Keywords = "turn on initialize enable start begin"), Category = "NeoKinect") + static void InitSensor(); + + /** + * Returns if sensor is already on. + * + * It may take a while for the sensor to initialize, so keep checking. If it + * takes too long, either there's no connected sensor or it's malfunctioning. + * + * @return true if Sensor is available and operational. + */ + UFUNCTION(BlueprintPure, meta = (Keywords = "on working works usable"), Category = "NeoKinect") + static bool IsKinectAvailable(); + + /** + * Use very carefully! Will shutdown the sensor and also invalidate any of its + * frame textures (color, depth etc). Make sure you call this when none of them + * are in use (preferably when quitting the game). Remember: with great power, + * comes great responsibility! + */ + UFUNCTION(BlueprintCallable, meta = (DisplayName = "Uninit Kinect Sensor", Keywords = "turn off uninitialize disable end"), Category = "NeoKinect") + static void UninitSensor(); + + /** + * Retrieves the Kinect sensor or NULL if not initialized. + * + * @return The Kinect sensor or NULL if not initialized. + */ + static NeoKinect::KinectSensor* GetSensor(); + + /** + * Gets sensor tilt in degrees. It represents the pitch of the sensor in Unreal + * coordinates (X pointing the same direction as the Kinect camera). Negative + * values mean it's pointing down. + * + * @return Kinect sensor tilt in degrees. Negative values mean it's pointing down. + */ + UFUNCTION(BlueprintPure, Category = "NeoKinect", meta = (DisplayName = "Get Kinect Tilt")) + static float GetSensorTilt(); + + /** + * Kinect height from the ground and ground normal. Only works if the sensor + * can see the ground. + * Bodies reading must be in use, as this data is read from the Body frames. + * + * @param Height Kinect distance from the ground + * @return Ground normal + */ + UFUNCTION(BlueprintPure, Category = "NeoKinect", meta = (DisplayName = "Get Kinect Ground Plane", Keywords = "height normal location floor")) + static FVector GetGroundPlane(float &Height); + + /* + * EXPOSURE CONTROL + */ + + /* + * Fully automatic exposure setting with exposure compensation. Only affects the Color frame. + * @param exposureCompensation Negative value gives an underexposed image, + * positive gives an overexposed image. + */ + UFUNCTION(BlueprintCallable, Category = "NeoKinect|ColorExposure", meta = (DisplayName = "Set Kinect to Auto Exposure", Keywords = "image frame color brightness")) + static void SetAutoExposure(float exposureCompensation = 0.0f); + + /* + * Sets a pseudo-exposure time in ms. Only affects the Color frame. + * + * The actual frame integration time is set to a multiple of fluorescent light period + * that is shorter than the requested time e.g. requesting 16 ms will set 10 ms + * in Australia (100Hz), 8.33 ms in USA (120Hz). + * The gain is automatically set to compensate for the reduced integration time. + * + * Requesting less than a single fluorescent light period will set the integration time + * to the requested value. + * + * To set the shortest non-flickering integration period for any country, simply set + * a pseudo-exposure time of between (10.0, 16.667) ms, which will automatically drop + * the integration time to 10 or 8.3 ms depending on country, while setting the analog + * gain control to a brighter value. + * + * @param pseudoExposureTime Pseudo-exposure time in ms. [0.0, 640]ms + */ + UFUNCTION(BlueprintCallable, Category = "NeoKinect|ColorExposure", meta = (DisplayName = "Set Kinect to Semi Auto Exposure", Keywords = "image frame color brightness")) + static void SetSemiAutoExposure(float pseudoExposureTime); + + /* + * Manually set frame exposure time in ms and analog gain. Only affects the Color frame. + * @param frameExposureTime Time of exposure for each frame, in ms. [0.0, 640]ms + * @param analogGain Exposure analog gain. + */ + UFUNCTION(BlueprintCallable, Category = "NeoKinect|ColorExposure", meta = (DisplayName = "Set Kinect to Manual Exposure", Keywords = "image frame color brightness")) + static void SetManualExposure(float frameExposureTime, float analogGain); + + /* + * COORDINATE REMAPPING + */ + + /** + * Converts a 3D location in Camera space to Color space with depth, so the new + * location matches the Color frame position from camera's point of view + * without turning into 2D. + * + * @param CameraLocation The 3D Camera space coordinate to be converted (in Unreal units) + * @return Realigned 3D coordinate that matches the Color frame from the camera's + * point of view (in Unreal units) + */ + UFUNCTION(BlueprintPure, Category = "NeoKinect|Remapping", Meta = (Keywords = "convert coordinate space remap")) + static FVector CameraLocationToColorWithDepth(const FVector& CameraLocation); + /** Native NeoKinect implementation of the above */ + static NeoKinect::Vector3 CameraLocationToColorWithDepth(NeoKinect::Vector3 CameraLocation); + + /** + * Remaps a 3D camera location to a 2D point in the Color frame. + * + * @param CameraLocation The 3D Camera space coordinate to be remapped (in Unreal units) + * @return The point location in the Color frame that matches the Camera + * location input (in pixels) + */ + UFUNCTION(BlueprintPure, Category = "NeoKinect|Remapping", Meta = (Keywords = "convert coordinate space remap")) + static FVector2D CameraLocationToColorPoint(const FVector& CameraLocation); + + /** + * Remaps a 3D camera location to a point in the Depth frame. + * + * @param CameraLocation The 3D Camera space coordinate to be remapped (in Unreal units) + * @return The point location in the Depth frame that matches the Camera + * location input (in pixels) + */ + UFUNCTION(BlueprintPure, Category = "NeoKinect|Remapping", Meta = (Keywords = "convert coordinate space remap")) + static FVector2D CameraLocationToDepthPoint(const FVector& CameraLocation); + + /** + * Creates a Color with depth point from a Color point only. Viewed from the + * camera perspective, this point aligns with the Color frame without losing + * it's depth. + * + * This method uses the remapped Color buffer in Depth space so, for it to + * work, the Depth in Color Space frame must be in use. + * + * @param ColorLocation A point in the Color frame to be remapped (in pixels) + * @return The 3D version of the Color point (in Unreal units) + */ + static NeoKinect::Vector3 ColorWithDepthFromColorOnly(const NeoKinect::Vector2& ColorLocation); + + /** + * Remaps a point location from the Depth frame to the Color frame. + * + * @param DepthPoint A point in the Depth frame (in pixels) + * @return Remapped Depth frame point to a Color frame point (in pixels) + */ + UFUNCTION(BlueprintPure, Category = "NeoKinect|Remapping", Meta = (Keywords = "convert coordinate space remap")) + static FVector2D DepthPointToColorPoint(FVector2D DepthPoint); + + /** + * Remaps a point location from the Depth frame to the 3D camera space. + * + * @param DepthPoint A point in the Depth frame (in pixels) + * @return Remapped Depth frame point to a 3D Camera location (in Unreal units) + */ + UFUNCTION(BlueprintPure, Category = "NeoKinect|Remapping", Meta = (Keywords = "convert coordinate space remap")) + static FVector DepthPointToCameraLocation(FVector2D DepthPoint); + + /** + * Remaps a point from the Color frame to the Depth frame. + * + * @param ColorPoint A point in the Color frame (in pixels) + * @return Color point remapped to its related location in the Depth frame (in pixels) + */ + UFUNCTION(BlueprintPure, Category = "NeoKinect|Remapping", Meta = (Keywords = "convert coordinate space remap")) + static FVector2D ColorPointToDepthPoint(FVector2D ColorPoint); + + + /* + * TEXTURES (Color, Depth etc) + */ + + /** + * Get a frame horizontal and vertical field of view. + * + * @param FrameType The frame type to request the FOV from. + * @return x = horizontal FOV, y = vertical FOV + */ + UFUNCTION(BlueprintPure, Category = "NeoKinect|Frames", Meta = (Keywords = "width height FOV texture angle field of view", DisplayName = "Get Kinect FOV")) + static FVector2D GetFrameFieldOfView(EKinectFrame FrameType); + + /** + * Get a frame texture width and height in pixels. + * + * @param FrameType The frame type to request the size from. + * @return x = width, y = height + */ + UFUNCTION(BlueprintPure, Category = "NeoKinect|Frames", Meta = (Keywords = "width height texture resolution", DisplayName = "Get Kinect Frame Size")) + static FIntPoint GetFrameSize(EKinectFrame FrameType); + + /** + * Enables or disables updating of a Kinect frame type. + * + * @param FrameType The frame type to enable/disable + * @param bEnable If the selected frame type should be enabled + * @return The Frame texture. Null if Enable = false. + */ + UFUNCTION(BlueprintCallable, Category = "NeoKinect|Frames", Meta = (Keywords = "texture sensor camera enable disable toggle", DisplayName = "Set Use Kinect Frame")) + static UTextureRenderTarget2D* SetUseFrame(EKinectFrame FrameType, bool bEnable); + + /** + * Returns if a Kinect frame type is enabled. If it is, it means you can get + * it's texture with GetFrame. + * + * @param FrameType The frame type to ask for. + * @return If FrameType is enabled or not. + */ + UFUNCTION(BlueprintPure, Category = "NeoKinect|Frames", Meta = (Keywords = "texture sensor camera enabled", DisplayName = "Get Is Using Kinect Frame")) + static bool GetIsUsingFrame(EKinectFrame FrameType); + + /** + * Get the texture that represents the requested frame type. + * + * @param FrameType The frame type to get the texture from. + * @return The texture that represents the requested frame type. Null if it has + * not been enabled. + */ + UFUNCTION(BlueprintPure, Category = "NeoKinect|Frames", Meta = (Keywords = "texture sensor camera", DisplayName = "Get Kinect Frame")) + static UTextureRenderTarget2D* GetFrame(EKinectFrame FrameType); + + /** + * Gets the depth value from a specific pixel on the Depth frame. + * + * @param Coordinate A point in the Depth frame (in pixels) + * @return The Depth value (distance from the Kinect sensor) in the input point + * (in centimeters) + */ + UFUNCTION(BlueprintPure, Category = "NeoKinect|Frames", Meta = (Keywords = "sample texture sensor camera")) + static float GetDepthFramePixel(FVector2D Coordinate); + + /** + * Gets the depth value from a specific pixel on the Color frame + * + * @param Coordinate A point in the Color frame (in pixels) + * @return The Depth value (distance from the Kinect sensor) in the input point + * (in centimeters) + */ + UFUNCTION(BlueprintPure, Category = "NeoKinect|Frames", Meta = (Keywords = "sample texture remap")) + static float GetDepthFromColorFramePixel(FVector2D Coordinate); + + /** + * Gets the color value from a specific pixel on the Color frame. + * + * @param Coordinate A point in the Color frame (in pixels) + * @return The Color value in the input point + */ + UFUNCTION(BlueprintPure, Category = "NeoKinect|Frames", Meta = (Keywords = "sample texture sensor camera")) + static FLinearColor GetColorFramePixel(FVector2D Coordinate); + + /* + * BODIES / JOINTS + */ + + /** + * Array of all bodies (tracked and not tracked). + * The bodies in the array are updated automatically, so you don't need to + * request the array more than once. + * + * @return Bodies array. + */ + UFUNCTION(BlueprintPure, Category = "NeoKinect|Body", meta = (DisplayName = "Get Kinect Bodies")) + static TArray GetBodies(); + + /** + * Array with only the currently tracked bodies. + * + * @return The currently tracked bodies. + */ + UFUNCTION(BlueprintPure, Category = "NeoKinect|Body", meta = (DisplayName = "Get Kinect Tracked Bodies")) + static TArray GetTrackedBodies(); + + /** + * Gets tracked body whose Spine Base joint is nearest to the Kinect sensor. + * + * @param HasBody If there's at least one tracked body. + * @return The nearest body from the sensor. Null if no bodies are tracked. + */ + UFUNCTION(BlueprintPure, Category = "NeoKinect|Body", meta = (DisplayName = "Get Kinect Nearest Body")) + static UNeoKinectBody* GetNearestBody(bool& HasBody); + + /** + * Toggle the use of Color texture aligned joint locations and orientations. + * + * Calculating these remapped transforms introduce a small overhead, so it's + * disabled by default and reading the Color values from a Joint will return + * Zero values until this is enabled. + * + * @param bUse Enable usage of Joints' Color space transforms? + */ + UFUNCTION(BlueprintCallable, Category = "NeoKinect|Body", meta = (Keywords = "joints remap")) + static void SetUseJointsColorSpaceTransforms(const bool bUse); + + /** + * Return if Joints' Color space transforms usage is enabled + * + * @return True if Joints' Color space transforms usage is enabled + */ + UFUNCTION(BlueprintPure, Category = "NeoKinect|Body") + static bool IsUsingJointsColorSpaceTransforms(); + + /** + * Cast a Body in the bodies array to its index number. + * + * @param Body The body instance. + * @return Body index. + */ + UFUNCTION(BlueprintPure, Category = "NeoKinect|Body", Meta = (CompactNodeTitle = "->", Keywords = "convert cast")) + static int32 BodyToIndex(const UNeoKinectBody* Body); + + /** + * Cast an index to a body from the bodies array. + * + * @param Index Index. + * @return Body instance. If index > 5 or index < 0, it's the body at index 0. + */ + UFUNCTION(BlueprintPure, Category = "NeoKinect|Body", Meta = (CompactNodeTitle = "->", Keywords = "convert cast")) + static UNeoKinectBody* IndexToBody(const int32 Index); + + /** + * Cast the Joint type to its joint index number. + * + * @param Joint Joint type. + * @return Index. + */ + UFUNCTION(BlueprintPure, Category = "NeoKinect|Body|Joints", Meta = (CompactNodeTitle = "->", Keywords = "convert cast", BlueprintThreadSafe)) + static int32 JointToIndex(const EKinectJointType Joint); + + /** + * Cast a joint index to its Joint type. + * + * @param Index Index. + * @return Joint type. If index >= joint count or index < 0, it's Spine Base joint. + */ + UFUNCTION(BlueprintPure, Category = "NeoKinect|Body|Joints", Meta = (CompactNodeTitle = "->", Keywords = "convert cast")) + static EKinectJointType IndexToJoint(const int32 Index); + + /* + * FACE TRACKING + */ + + /** + * Array of faces (tracked and not tracked). The faces instances are updated + * automatically, so you don't need to request the array more than once. + * + * @return Faces array. + */ + UFUNCTION(BlueprintPure, Category = "NeoKinect|Face", meta = (DisplayName = "Get Kinect Faces")) + static TArray GetFaces(); + + /** + * Array with only the currently tracked faces. + * + * @return The currently tracked faces. + */ + UFUNCTION(BlueprintPure, Category = "NeoKinect|Face", meta = (DisplayName = "Get Kinect Tracked Faces")) + static TArray GetTrackedFaces(); + + /** + * Gets tracked face whose Head joint is nearest from the sensor. + * + * @param bHasAnyFace If there's at least one tracked face. + * @return The nearest face from the sensor. Null if no faces are tracked. + */ + UFUNCTION(BlueprintPure, Category = "NeoKinect|Face", meta = (DisplayName = "Get Kinect Nearest Face")) + static UNeoKinectFace* GetNearestFace(bool& bHasAnyFace); + + /** + * Cast a Face to its index number. + * + * @param Face The face instance. + * @return Face index. + */ + UFUNCTION(BlueprintPure, Category = "NeoKinect|Face", Meta = (CompactNodeTitle = "->", Keywords = "convert cast")) + static int32 FaceToIndex(const UNeoKinectFace* Face); + + /** + * Cast a face index to a Face object. + * + * @param Index Index. + * @return Face instance. If index > 5 or index < 0, it's the face at index 0. + */ + UFUNCTION(BlueprintPure, Category = "NeoKinect|Face", Meta = (CompactNodeTitle = "->", Keywords = "convert cast")) + static UNeoKinectFace* IndexToFace(const int32 Index); + + /* + * CONSTANTS + */ + + /** + * The number of bodies the Kinect device can track simultaneously. + * + * @return The number of bodies the Kinect device can track simultaneously. + */ + UFUNCTION(BlueprintPure, Category = "NeoKinect|Constants", meta = (Keywords = "length number size capability")) + static int32 GetTrackableBodyCount(); + + /** + * The number of faces the Kinect device can track simultaneously. + * + * @return The number of faces the Kinect device can track simultaneously. + */ + UFUNCTION(BlueprintPure, Category = "NeoKinect|Constants", meta = (Keywords = "length number size capability")) + static int32 GetTrackableFaceCount(); + + /** + * The number of joints the Kinect device can track in each tracked body. + * + * @return The number of joints the Kinect device can track in each tracked body. + */ + UFUNCTION(BlueprintPure, Category = "NeoKinect|Constants", meta = (Keywords = "length number size capability")) + static int32 GetJointCount(); + + /*//////////////////////////////////////////////////////////////////////////// + + BLUEPRINT FUNCTIONS END + + ////////////////////////////////////////////////////////////////////////////*/ + + +private: + /** NeoKinect API sensor */ + static NeoKinect::KinectSensor* Kinect; + /** Does the sensor polling */ + static FKinectThread* KinectThread; + /** FTicker handle so we can stop ticking after disconnecting from the sensor */ + static FTSTicker::FDelegateHandle TickerHandle; + + //TODO: figure out a way to know when a level is unloaded + //static bool bAutoShutdown; + + /** Should we read and update the bodies data each frame? */ + static bool bUsingBodyFrame; + /** Should we remap the bodies transforms into 3D Color space each frame? */ + static bool bUsingJointsColorSpaceTransforms; + /** Should we read and update the faces data each frame? */ + static bool bUsingFaceFrame; + + /** Initialize the bodies, faces and frames arrays */ + static void InitStatics(); + /** Updates bodies, faces and frames each frame */ + static bool OnTick(float DeltaTime); + + static bool IsUsingDepth(); + static bool IsUsingBodyIndex(); + static bool IsUsingColor(); + /** Creates a 2D dynamic texture for frames usage */ + static UTextureRenderTarget2D* CreateTexture(int32 Width, int32 Height, EPixelFormat PixelFormat, bool sRGB); + /** Updates all currently enabled frames. Executed in the Render thread */ + static void UpdateFrames(); + /** Delete frames textures memory */ + static void ReleaseFrameResources(FFrameTextureData&); + + /** Enable/disable bodies frame reading */ + static void SetUseBodyFrame(bool bUse = true); + /** Converts bodies joints transforms to Unreal coordinate space */ + static void ProcessBodies(const NeoKinect::KinectBody* KBodies); + /** Zero all bodies values. Used when disconnecting from the sensor */ + static void ResetBodies(); + + /** Enable/disable faces frame reading */ + static void SetUseFaceFrame(bool bUse = true); + /** Converts faces points transforms to Unreal coordinate space */ + static void ProcessFaces(const NeoKinect::KinectFace* KFaces); + /** Zero all faces values. Used when disconnecting from the sensor */ + static void ResetFaces(); + + UFUNCTION() + void BodyBeginTrackBroadcast(int32 BodyIndex); + UFUNCTION() + void BodyLostBroadcast(int32 BodyIndex); + UFUNCTION() + void FaceBeginTrackBroadcast(int32 FaceIndex); + UFUNCTION() + void FaceLostBroadcast(int32 FaceIndex); +}; diff --git a/SpaceStudioClient/Plugins/NeoKinectUnreal/Source/ThirdParty/Kinect/Inc/Kinect.Face.h b/SpaceStudioClient/Plugins/NeoKinectUnreal/Source/ThirdParty/Kinect/Inc/Kinect.Face.h new file mode 100644 index 0000000..7e848b9 --- /dev/null +++ b/SpaceStudioClient/Plugins/NeoKinectUnreal/Source/ThirdParty/Kinect/Inc/Kinect.Face.h @@ -0,0 +1,3096 @@ + + +/* this ALWAYS GENERATED file contains the definitions for the interfaces */ + + + /* File created by MIDL compiler version 8.00.0595 */ +/* at Sun Oct 19 13:16:54 2014 + */ +/* Compiler settings for ..\..\idl\Kinect.Face.idl: + Oicf, W1, Zp8, env=Win64 (32b run), target_arch=AMD64 8.00.0595 + protocol : dce , ms_ext, c_ext, robust + error checks: allocation ref bounds_check enum stub_data + VC __declspec() decoration level: + __declspec(uuid()), __declspec(selectany), __declspec(novtable) + DECLSPEC_UUID(), MIDL_INTERFACE() +*/ +/* @@MIDL_FILE_HEADING( ) */ + +#pragma warning( disable: 4049 ) /* more than 64k source lines */ + + +/* verify that the version is high enough to compile this file*/ +#ifndef __REQUIRED_RPCNDR_H_VERSION__ +#define __REQUIRED_RPCNDR_H_VERSION__ 475 +#endif + +/* verify that the version is high enough to compile this file*/ +#ifndef __REQUIRED_RPCSAL_H_VERSION__ +#define __REQUIRED_RPCSAL_H_VERSION__ 100 +#endif + +#include "rpc.h" +#include "rpcndr.h" + +#ifndef __RPCNDR_H_VERSION__ +#error this stub requires an updated version of +#endif // __RPCNDR_H_VERSION__ + +#ifndef COM_NO_WINDOWS_H +#include "windows.h" +#include "ole2.h" +#endif /*COM_NO_WINDOWS_H*/ + +#ifndef __Kinect2EFace_h__ +#define __Kinect2EFace_h__ + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +#pragma once +#endif + +/* Forward Declarations */ + +#ifndef __IFaceFrameSource_FWD_DEFINED__ +#define __IFaceFrameSource_FWD_DEFINED__ +typedef interface IFaceFrameSource IFaceFrameSource; + +#endif /* __IFaceFrameSource_FWD_DEFINED__ */ + + +#ifndef __IFaceFrameReader_FWD_DEFINED__ +#define __IFaceFrameReader_FWD_DEFINED__ +typedef interface IFaceFrameReader IFaceFrameReader; + +#endif /* __IFaceFrameReader_FWD_DEFINED__ */ + + +#ifndef __IFaceFrameReference_FWD_DEFINED__ +#define __IFaceFrameReference_FWD_DEFINED__ +typedef interface IFaceFrameReference IFaceFrameReference; + +#endif /* __IFaceFrameReference_FWD_DEFINED__ */ + + +#ifndef __IFaceFrameArrivedEventArgs_FWD_DEFINED__ +#define __IFaceFrameArrivedEventArgs_FWD_DEFINED__ +typedef interface IFaceFrameArrivedEventArgs IFaceFrameArrivedEventArgs; + +#endif /* __IFaceFrameArrivedEventArgs_FWD_DEFINED__ */ + + +#ifndef __IFaceFrame_FWD_DEFINED__ +#define __IFaceFrame_FWD_DEFINED__ +typedef interface IFaceFrame IFaceFrame; + +#endif /* __IFaceFrame_FWD_DEFINED__ */ + + +#ifndef __IFaceFrameResult_FWD_DEFINED__ +#define __IFaceFrameResult_FWD_DEFINED__ +typedef interface IFaceFrameResult IFaceFrameResult; + +#endif /* __IFaceFrameResult_FWD_DEFINED__ */ + + +#ifndef __ITrackingIdLostEventArgs_FWD_DEFINED__ +#define __ITrackingIdLostEventArgs_FWD_DEFINED__ +typedef interface ITrackingIdLostEventArgs ITrackingIdLostEventArgs; + +#endif /* __ITrackingIdLostEventArgs_FWD_DEFINED__ */ + + +#ifndef __ICollectionStatusChangedEventArgs_FWD_DEFINED__ +#define __ICollectionStatusChangedEventArgs_FWD_DEFINED__ +typedef interface ICollectionStatusChangedEventArgs ICollectionStatusChangedEventArgs; + +#endif /* __ICollectionStatusChangedEventArgs_FWD_DEFINED__ */ + + +#ifndef __ICaptureStatusChangedEventArgs_FWD_DEFINED__ +#define __ICaptureStatusChangedEventArgs_FWD_DEFINED__ +typedef interface ICaptureStatusChangedEventArgs ICaptureStatusChangedEventArgs; + +#endif /* __ICaptureStatusChangedEventArgs_FWD_DEFINED__ */ + + +#ifndef __IFaceAlignment_FWD_DEFINED__ +#define __IFaceAlignment_FWD_DEFINED__ +typedef interface IFaceAlignment IFaceAlignment; + +#endif /* __IFaceAlignment_FWD_DEFINED__ */ + + +#ifndef __IFaceModel_FWD_DEFINED__ +#define __IFaceModel_FWD_DEFINED__ +typedef interface IFaceModel IFaceModel; + +#endif /* __IFaceModel_FWD_DEFINED__ */ + + +#ifndef __IFaceModelBuilder_FWD_DEFINED__ +#define __IFaceModelBuilder_FWD_DEFINED__ +typedef interface IFaceModelBuilder IFaceModelBuilder; + +#endif /* __IFaceModelBuilder_FWD_DEFINED__ */ + + +#ifndef __IFaceModelData_FWD_DEFINED__ +#define __IFaceModelData_FWD_DEFINED__ +typedef interface IFaceModelData IFaceModelData; + +#endif /* __IFaceModelData_FWD_DEFINED__ */ + + +#ifndef __IHighDefinitionFaceFrameReference_FWD_DEFINED__ +#define __IHighDefinitionFaceFrameReference_FWD_DEFINED__ +typedef interface IHighDefinitionFaceFrameReference IHighDefinitionFaceFrameReference; + +#endif /* __IHighDefinitionFaceFrameReference_FWD_DEFINED__ */ + + +#ifndef __IHighDefinitionFaceFrameArrivedEventArgs_FWD_DEFINED__ +#define __IHighDefinitionFaceFrameArrivedEventArgs_FWD_DEFINED__ +typedef interface IHighDefinitionFaceFrameArrivedEventArgs IHighDefinitionFaceFrameArrivedEventArgs; + +#endif /* __IHighDefinitionFaceFrameArrivedEventArgs_FWD_DEFINED__ */ + + +#ifndef __IHighDefinitionFaceFrameSource_FWD_DEFINED__ +#define __IHighDefinitionFaceFrameSource_FWD_DEFINED__ +typedef interface IHighDefinitionFaceFrameSource IHighDefinitionFaceFrameSource; + +#endif /* __IHighDefinitionFaceFrameSource_FWD_DEFINED__ */ + + +#ifndef __IHighDefinitionFaceFrameReader_FWD_DEFINED__ +#define __IHighDefinitionFaceFrameReader_FWD_DEFINED__ +typedef interface IHighDefinitionFaceFrameReader IHighDefinitionFaceFrameReader; + +#endif /* __IHighDefinitionFaceFrameReader_FWD_DEFINED__ */ + + +#ifndef __IHighDefinitionFaceFrame_FWD_DEFINED__ +#define __IHighDefinitionFaceFrame_FWD_DEFINED__ +typedef interface IHighDefinitionFaceFrame IHighDefinitionFaceFrame; + +#endif /* __IHighDefinitionFaceFrame_FWD_DEFINED__ */ + + +/* header files for imported files */ +#include "oaidl.h" +#include "ocidl.h" +#include "mmreg.h" +#include "Kinect.h" + +#ifdef __cplusplus +extern "C"{ +#endif + + +/* interface __MIDL_itf_Kinect2EFace_0000_0000 */ +/* [local] */ + + +#ifndef _FacePointType_ +#define _FacePointType_ +typedef enum _FacePointType FacePointType; + + +enum _FacePointType + { + FacePointType_None = -1, + FacePointType_EyeLeft = 0, + FacePointType_EyeRight = 1, + FacePointType_Nose = 2, + FacePointType_MouthCornerLeft = 3, + FacePointType_MouthCornerRight = 4, + FacePointType_Count = ( FacePointType_MouthCornerRight + 1 ) + } ; +#endif // _FacePointType_ +#ifndef _FaceFrameFeatures_ +#define _FaceFrameFeatures_ +typedef enum _FaceFrameFeatures FaceFrameFeatures; + + +enum _FaceFrameFeatures + { + FaceFrameFeatures_None = 0, + FaceFrameFeatures_BoundingBoxInInfraredSpace = 0x1, + FaceFrameFeatures_PointsInInfraredSpace = 0x2, + FaceFrameFeatures_BoundingBoxInColorSpace = 0x4, + FaceFrameFeatures_PointsInColorSpace = 0x8, + FaceFrameFeatures_RotationOrientation = 0x10, + FaceFrameFeatures_Happy = 0x20, + FaceFrameFeatures_RightEyeClosed = 0x40, + FaceFrameFeatures_LeftEyeClosed = 0x80, + FaceFrameFeatures_MouthOpen = 0x100, + FaceFrameFeatures_MouthMoved = 0x200, + FaceFrameFeatures_LookingAway = 0x400, + FaceFrameFeatures_Glasses = 0x800, + FaceFrameFeatures_FaceEngagement = 0x1000 + } ; +#endif // _FaceFrameFeatures_ +#ifndef _FaceProperty_ +#define _FaceProperty_ +typedef enum _FaceProperty FaceProperty; + + +enum _FaceProperty + { + FaceProperty_Happy = 0, + FaceProperty_Engaged = 1, + FaceProperty_WearingGlasses = 2, + FaceProperty_LeftEyeClosed = 3, + FaceProperty_RightEyeClosed = 4, + FaceProperty_MouthOpen = 5, + FaceProperty_MouthMoved = 6, + FaceProperty_LookingAway = 7, + FaceProperty_Count = ( FaceProperty_LookingAway + 1 ) + } ; +#endif // _FaceProperty_ +#ifndef _HighDetailFacePoints_ +#define _HighDetailFacePoints_ +typedef enum _HighDetailFacePoints HighDetailFacePoints; + + +enum _HighDetailFacePoints + { + HighDetailFacePoints_LefteyeInnercorner = 210, + HighDetailFacePoints_LefteyeOutercorner = 469, + HighDetailFacePoints_LefteyeMidtop = 241, + HighDetailFacePoints_LefteyeMidbottom = 1104, + HighDetailFacePoints_RighteyeInnercorner = 843, + HighDetailFacePoints_RighteyeOutercorner = 1117, + HighDetailFacePoints_RighteyeMidtop = 731, + HighDetailFacePoints_RighteyeMidbottom = 1090, + HighDetailFacePoints_LefteyebrowInner = 346, + HighDetailFacePoints_LefteyebrowOuter = 140, + HighDetailFacePoints_LefteyebrowCenter = 222, + HighDetailFacePoints_RighteyebrowInner = 803, + HighDetailFacePoints_RighteyebrowOuter = 758, + HighDetailFacePoints_RighteyebrowCenter = 849, + HighDetailFacePoints_MouthLeftcorner = 91, + HighDetailFacePoints_MouthRightcorner = 687, + HighDetailFacePoints_MouthUpperlipMidtop = 19, + HighDetailFacePoints_MouthUpperlipMidbottom = 1072, + HighDetailFacePoints_MouthLowerlipMidtop = 10, + HighDetailFacePoints_MouthLowerlipMidbottom = 8, + HighDetailFacePoints_NoseTip = 18, + HighDetailFacePoints_NoseBottom = 14, + HighDetailFacePoints_NoseBottomleft = 156, + HighDetailFacePoints_NoseBottomright = 783, + HighDetailFacePoints_NoseTop = 24, + HighDetailFacePoints_NoseTopleft = 151, + HighDetailFacePoints_NoseTopright = 772, + HighDetailFacePoints_ForeheadCenter = 28, + HighDetailFacePoints_LeftcheekCenter = 412, + HighDetailFacePoints_RightcheekCenter = 933, + HighDetailFacePoints_Leftcheekbone = 458, + HighDetailFacePoints_Rightcheekbone = 674, + HighDetailFacePoints_ChinCenter = 4, + HighDetailFacePoints_LowerjawLeftend = 1307, + HighDetailFacePoints_LowerjawRightend = 1327 + } ; +#endif // _HighDetailFacePoints_ +#ifndef _FaceShapeAnimations_ +#define _FaceShapeAnimations_ +typedef enum _FaceShapeAnimations FaceShapeAnimations; + + +enum _FaceShapeAnimations + { + FaceShapeAnimations_JawOpen = 0, + FaceShapeAnimations_LipPucker = 1, + FaceShapeAnimations_JawSlideRight = 2, + FaceShapeAnimations_LipStretcherRight = 3, + FaceShapeAnimations_LipStretcherLeft = 4, + FaceShapeAnimations_LipCornerPullerLeft = 5, + FaceShapeAnimations_LipCornerPullerRight = 6, + FaceShapeAnimations_LipCornerDepressorLeft = 7, + FaceShapeAnimations_LipCornerDepressorRight = 8, + FaceShapeAnimations_LeftcheekPuff = 9, + FaceShapeAnimations_RightcheekPuff = 10, + FaceShapeAnimations_LefteyeClosed = 11, + FaceShapeAnimations_RighteyeClosed = 12, + FaceShapeAnimations_RighteyebrowLowerer = 13, + FaceShapeAnimations_LefteyebrowLowerer = 14, + FaceShapeAnimations_LowerlipDepressorLeft = 15, + FaceShapeAnimations_LowerlipDepressorRight = 16, + FaceShapeAnimations_Count = ( FaceShapeAnimations_LowerlipDepressorRight + 1 ) + } ; +#endif // _FaceShapeAnimations_ +#ifndef _FaceShapeDeformations_ +#define _FaceShapeDeformations_ +typedef enum _FaceShapeDeformations FaceShapeDeformations; + + +enum _FaceShapeDeformations + { + FaceShapeDeformations_PCA01 = 0, + FaceShapeDeformations_PCA02 = 1, + FaceShapeDeformations_PCA03 = 2, + FaceShapeDeformations_PCA04 = 3, + FaceShapeDeformations_PCA05 = 4, + FaceShapeDeformations_PCA06 = 5, + FaceShapeDeformations_PCA07 = 6, + FaceShapeDeformations_PCA08 = 7, + FaceShapeDeformations_PCA09 = 8, + FaceShapeDeformations_PCA10 = 9, + FaceShapeDeformations_Chin03 = 10, + FaceShapeDeformations_Forehead00 = 11, + FaceShapeDeformations_Cheeks02 = 12, + FaceShapeDeformations_Cheeks01 = 13, + FaceShapeDeformations_MouthBag01 = 14, + FaceShapeDeformations_MouthBag02 = 15, + FaceShapeDeformations_Eyes02 = 16, + FaceShapeDeformations_MouthBag03 = 17, + FaceShapeDeformations_Forehead04 = 18, + FaceShapeDeformations_Nose00 = 19, + FaceShapeDeformations_Nose01 = 20, + FaceShapeDeformations_Nose02 = 21, + FaceShapeDeformations_MouthBag06 = 22, + FaceShapeDeformations_MouthBag05 = 23, + FaceShapeDeformations_Cheeks00 = 24, + FaceShapeDeformations_Mask03 = 25, + FaceShapeDeformations_Eyes03 = 26, + FaceShapeDeformations_Nose03 = 27, + FaceShapeDeformations_Eyes08 = 28, + FaceShapeDeformations_MouthBag07 = 29, + FaceShapeDeformations_Eyes00 = 30, + FaceShapeDeformations_Nose04 = 31, + FaceShapeDeformations_Mask04 = 32, + FaceShapeDeformations_Chin04 = 33, + FaceShapeDeformations_Forehead05 = 34, + FaceShapeDeformations_Eyes06 = 35, + FaceShapeDeformations_Eyes11 = 36, + FaceShapeDeformations_Nose05 = 37, + FaceShapeDeformations_Mouth07 = 38, + FaceShapeDeformations_Cheeks08 = 39, + FaceShapeDeformations_Eyes09 = 40, + FaceShapeDeformations_Mask10 = 41, + FaceShapeDeformations_Mouth09 = 42, + FaceShapeDeformations_Nose07 = 43, + FaceShapeDeformations_Nose08 = 44, + FaceShapeDeformations_Cheeks07 = 45, + FaceShapeDeformations_Mask07 = 46, + FaceShapeDeformations_MouthBag09 = 47, + FaceShapeDeformations_Nose06 = 48, + FaceShapeDeformations_Chin02 = 49, + FaceShapeDeformations_Eyes07 = 50, + FaceShapeDeformations_Cheeks10 = 51, + FaceShapeDeformations_Rim20 = 52, + FaceShapeDeformations_Mask22 = 53, + FaceShapeDeformations_MouthBag15 = 54, + FaceShapeDeformations_Chin01 = 55, + FaceShapeDeformations_Cheeks04 = 56, + FaceShapeDeformations_Eyes17 = 57, + FaceShapeDeformations_Cheeks13 = 58, + FaceShapeDeformations_Mouth02 = 59, + FaceShapeDeformations_MouthBag12 = 60, + FaceShapeDeformations_Mask19 = 61, + FaceShapeDeformations_Mask20 = 62, + FaceShapeDeformations_Forehead06 = 63, + FaceShapeDeformations_Mouth13 = 64, + FaceShapeDeformations_Mask25 = 65, + FaceShapeDeformations_Chin05 = 66, + FaceShapeDeformations_Cheeks20 = 67, + FaceShapeDeformations_Nose09 = 68, + FaceShapeDeformations_Nose10 = 69, + FaceShapeDeformations_MouthBag27 = 70, + FaceShapeDeformations_Mouth11 = 71, + FaceShapeDeformations_Cheeks14 = 72, + FaceShapeDeformations_Eyes16 = 73, + FaceShapeDeformations_Mask29 = 74, + FaceShapeDeformations_Nose15 = 75, + FaceShapeDeformations_Cheeks11 = 76, + FaceShapeDeformations_Mouth16 = 77, + FaceShapeDeformations_Eyes19 = 78, + FaceShapeDeformations_Mouth17 = 79, + FaceShapeDeformations_MouthBag36 = 80, + FaceShapeDeformations_Mouth15 = 81, + FaceShapeDeformations_Cheeks25 = 82, + FaceShapeDeformations_Cheeks16 = 83, + FaceShapeDeformations_Cheeks18 = 84, + FaceShapeDeformations_Rim07 = 85, + FaceShapeDeformations_Nose13 = 86, + FaceShapeDeformations_Mouth18 = 87, + FaceShapeDeformations_Cheeks19 = 88, + FaceShapeDeformations_Rim21 = 89, + FaceShapeDeformations_Mouth22 = 90, + FaceShapeDeformations_Nose18 = 91, + FaceShapeDeformations_Nose16 = 92, + FaceShapeDeformations_Rim22 = 93, + FaceShapeDeformations_Count = ( FaceShapeDeformations_Rim22 + 1 ) + } ; +#endif // _FaceShapeDeformations_ +#ifndef _FaceAlignmentQuality_ +#define _FaceAlignmentQuality_ +typedef enum _FaceAlignmentQuality FaceAlignmentQuality; + + +enum _FaceAlignmentQuality + { + FaceAlignmentQuality_High = 0, + FaceAlignmentQuality_Low = 1 + } ; +#endif // _FaceAlignmentQuality_ +#ifndef _FaceModelBuilderCollectionStatus_ +#define _FaceModelBuilderCollectionStatus_ +typedef enum _FaceModelBuilderCollectionStatus FaceModelBuilderCollectionStatus; + + +enum _FaceModelBuilderCollectionStatus + { + FaceModelBuilderCollectionStatus_Complete = 0, + FaceModelBuilderCollectionStatus_MoreFramesNeeded = 0x1, + FaceModelBuilderCollectionStatus_FrontViewFramesNeeded = 0x2, + FaceModelBuilderCollectionStatus_LeftViewsNeeded = 0x4, + FaceModelBuilderCollectionStatus_RightViewsNeeded = 0x8, + FaceModelBuilderCollectionStatus_TiltedUpViewsNeeded = 0x10 + } ; +#endif // _FaceModelBuilderCollectionStatus_ +#ifndef _FaceModelBuilderCaptureStatus_ +#define _FaceModelBuilderCaptureStatus_ +typedef enum _FaceModelBuilderCaptureStatus FaceModelBuilderCaptureStatus; + + +enum _FaceModelBuilderCaptureStatus + { + FaceModelBuilderCaptureStatus_GoodFrameCapture = 0, + FaceModelBuilderCaptureStatus_OtherViewsNeeded = 1, + FaceModelBuilderCaptureStatus_LostFaceTrack = 2, + FaceModelBuilderCaptureStatus_FaceTooFar = 3, + FaceModelBuilderCaptureStatus_FaceTooNear = 4, + FaceModelBuilderCaptureStatus_MovingTooFast = 5, + FaceModelBuilderCaptureStatus_SystemError = 6 + } ; +#endif // _FaceModelBuilderCaptureStatus_ +#ifndef _FaceModelBuilderAttributes_ +#define _FaceModelBuilderAttributes_ +typedef enum _FaceModelBuilderAttributes FaceModelBuilderAttributes; + + +enum _FaceModelBuilderAttributes + { + FaceModelBuilderAttributes_None = 0, + FaceModelBuilderAttributes_SkinColor = 0x1, + FaceModelBuilderAttributes_HairColor = 0x2 + } ; +#endif // _FaceModelBuilderAttributes_ +#ifndef _RectI_ +#define _RectI_ +typedef struct _RectI + { + INT32 Left; + INT32 Top; + INT32 Right; + INT32 Bottom; + } RectI; + +#endif // _RectI_ + + + + + + + + + + + + + + + + + + + + + +extern RPC_IF_HANDLE __MIDL_itf_Kinect2EFace_0000_0000_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_Kinect2EFace_0000_0000_v0_0_s_ifspec; + +#ifndef __IFaceFrameSource_INTERFACE_DEFINED__ +#define __IFaceFrameSource_INTERFACE_DEFINED__ + +/* interface IFaceFrameSource */ +/* [object][local][uuid] */ + + +EXTERN_C const IID IID_IFaceFrameSource; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("3A348391-43AD-F7D8-437D-D790FA5833DE") + IFaceFrameSource : public IUnknown + { + public: + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_IsActive( + /* [annotation][out][retval] */ + _Out_ BOOLEAN *isActive) = 0; + + virtual HRESULT STDMETHODCALLTYPE OpenReader( + /* [annotation][out][retval] */ + _COM_Outptr_ IFaceFrameReader **reader) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_KinectSensor( + /* [annotation][out][retval] */ + _COM_Outptr_ IKinectSensor **sensor) = 0; + + virtual HRESULT STDMETHODCALLTYPE SubscribeTrackingIdLost( + /* [annotation][out][retval] */ + _Out_ WAITABLE_HANDLE *waitableHandle) = 0; + + virtual HRESULT STDMETHODCALLTYPE UnsubscribeTrackingIdLost( + /* [annotation][in] */ + _In_ WAITABLE_HANDLE waitableHandle) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetTrackingIdLostEventData( + /* [annotation][in] */ + _In_ WAITABLE_HANDLE waitableHandle, + /* [annotation][out][retval] */ + _Out_ ITrackingIdLostEventArgs **eventData) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_TrackingId( + /* [annotation][out][retval] */ + _Out_ UINT64 *trackingId) = 0; + + virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_TrackingId( + /* [annotation][in] */ + _In_ const UINT64 trackingId) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_IsTrackingIdValid( + /* [annotation][out][retval] */ + _Out_ BOOLEAN *isTrackingIdValid) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_FaceFrameFeatures( + /* [annotation][out][retval] */ + _Out_ DWORD *faceFrameFeatures) = 0; + + virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_FaceFrameFeatures( + /* [annotation][in] */ + _In_ const DWORD faceFrameFeatures) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IFaceFrameSourceVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IFaceFrameSource * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IFaceFrameSource * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IFaceFrameSource * This); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_IsActive )( + IFaceFrameSource * This, + /* [annotation][out][retval] */ + _Out_ BOOLEAN *isActive); + + HRESULT ( STDMETHODCALLTYPE *OpenReader )( + IFaceFrameSource * This, + /* [annotation][out][retval] */ + _COM_Outptr_ IFaceFrameReader **reader); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_KinectSensor )( + IFaceFrameSource * This, + /* [annotation][out][retval] */ + _COM_Outptr_ IKinectSensor **sensor); + + HRESULT ( STDMETHODCALLTYPE *SubscribeTrackingIdLost )( + IFaceFrameSource * This, + /* [annotation][out][retval] */ + _Out_ WAITABLE_HANDLE *waitableHandle); + + HRESULT ( STDMETHODCALLTYPE *UnsubscribeTrackingIdLost )( + IFaceFrameSource * This, + /* [annotation][in] */ + _In_ WAITABLE_HANDLE waitableHandle); + + HRESULT ( STDMETHODCALLTYPE *GetTrackingIdLostEventData )( + IFaceFrameSource * This, + /* [annotation][in] */ + _In_ WAITABLE_HANDLE waitableHandle, + /* [annotation][out][retval] */ + _Out_ ITrackingIdLostEventArgs **eventData); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_TrackingId )( + IFaceFrameSource * This, + /* [annotation][out][retval] */ + _Out_ UINT64 *trackingId); + + /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_TrackingId )( + IFaceFrameSource * This, + /* [annotation][in] */ + _In_ const UINT64 trackingId); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_IsTrackingIdValid )( + IFaceFrameSource * This, + /* [annotation][out][retval] */ + _Out_ BOOLEAN *isTrackingIdValid); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_FaceFrameFeatures )( + IFaceFrameSource * This, + /* [annotation][out][retval] */ + _Out_ DWORD *faceFrameFeatures); + + /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_FaceFrameFeatures )( + IFaceFrameSource * This, + /* [annotation][in] */ + _In_ const DWORD faceFrameFeatures); + + END_INTERFACE + } IFaceFrameSourceVtbl; + + interface IFaceFrameSource + { + CONST_VTBL struct IFaceFrameSourceVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IFaceFrameSource_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IFaceFrameSource_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IFaceFrameSource_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IFaceFrameSource_get_IsActive(This,isActive) \ + ( (This)->lpVtbl -> get_IsActive(This,isActive) ) + +#define IFaceFrameSource_OpenReader(This,reader) \ + ( (This)->lpVtbl -> OpenReader(This,reader) ) + +#define IFaceFrameSource_get_KinectSensor(This,sensor) \ + ( (This)->lpVtbl -> get_KinectSensor(This,sensor) ) + +#define IFaceFrameSource_SubscribeTrackingIdLost(This,waitableHandle) \ + ( (This)->lpVtbl -> SubscribeTrackingIdLost(This,waitableHandle) ) + +#define IFaceFrameSource_UnsubscribeTrackingIdLost(This,waitableHandle) \ + ( (This)->lpVtbl -> UnsubscribeTrackingIdLost(This,waitableHandle) ) + +#define IFaceFrameSource_GetTrackingIdLostEventData(This,waitableHandle,eventData) \ + ( (This)->lpVtbl -> GetTrackingIdLostEventData(This,waitableHandle,eventData) ) + +#define IFaceFrameSource_get_TrackingId(This,trackingId) \ + ( (This)->lpVtbl -> get_TrackingId(This,trackingId) ) + +#define IFaceFrameSource_put_TrackingId(This,trackingId) \ + ( (This)->lpVtbl -> put_TrackingId(This,trackingId) ) + +#define IFaceFrameSource_get_IsTrackingIdValid(This,isTrackingIdValid) \ + ( (This)->lpVtbl -> get_IsTrackingIdValid(This,isTrackingIdValid) ) + +#define IFaceFrameSource_get_FaceFrameFeatures(This,faceFrameFeatures) \ + ( (This)->lpVtbl -> get_FaceFrameFeatures(This,faceFrameFeatures) ) + +#define IFaceFrameSource_put_FaceFrameFeatures(This,faceFrameFeatures) \ + ( (This)->lpVtbl -> put_FaceFrameFeatures(This,faceFrameFeatures) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IFaceFrameSource_INTERFACE_DEFINED__ */ + + +#ifndef __IFaceFrameReader_INTERFACE_DEFINED__ +#define __IFaceFrameReader_INTERFACE_DEFINED__ + +/* interface IFaceFrameReader */ +/* [object][local][uuid] */ + + +EXTERN_C const IID IID_IFaceFrameReader; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("AD0D735F-4E42-82BB-5C03-1BBE5E24CB19") + IFaceFrameReader : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE SubscribeFrameArrived( + /* [annotation][out][retval] */ + _Out_ WAITABLE_HANDLE *waitableHandle) = 0; + + virtual HRESULT STDMETHODCALLTYPE UnsubscribeFrameArrived( + /* [annotation][in] */ + _In_ WAITABLE_HANDLE waitableHandle) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetFrameArrivedEventData( + /* [annotation][in] */ + _In_ WAITABLE_HANDLE waitableHandle, + /* [annotation][out][retval] */ + _Out_ IFaceFrameArrivedEventArgs **eventData) = 0; + + virtual HRESULT STDMETHODCALLTYPE AcquireLatestFrame( + /* [annotation][out][retval] */ + _COM_Outptr_result_maybenull_ IFaceFrame **faceFrame) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_IsPaused( + /* [annotation][out][retval] */ + _Out_ BOOLEAN *isPaused) = 0; + + virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_IsPaused( + BOOLEAN isPaused) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_FaceFrameSource( + /* [annotation][out][retval] */ + _COM_Outptr_ IFaceFrameSource **faceFrameSource) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IFaceFrameReaderVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IFaceFrameReader * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IFaceFrameReader * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IFaceFrameReader * This); + + HRESULT ( STDMETHODCALLTYPE *SubscribeFrameArrived )( + IFaceFrameReader * This, + /* [annotation][out][retval] */ + _Out_ WAITABLE_HANDLE *waitableHandle); + + HRESULT ( STDMETHODCALLTYPE *UnsubscribeFrameArrived )( + IFaceFrameReader * This, + /* [annotation][in] */ + _In_ WAITABLE_HANDLE waitableHandle); + + HRESULT ( STDMETHODCALLTYPE *GetFrameArrivedEventData )( + IFaceFrameReader * This, + /* [annotation][in] */ + _In_ WAITABLE_HANDLE waitableHandle, + /* [annotation][out][retval] */ + _Out_ IFaceFrameArrivedEventArgs **eventData); + + HRESULT ( STDMETHODCALLTYPE *AcquireLatestFrame )( + IFaceFrameReader * This, + /* [annotation][out][retval] */ + _COM_Outptr_result_maybenull_ IFaceFrame **faceFrame); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_IsPaused )( + IFaceFrameReader * This, + /* [annotation][out][retval] */ + _Out_ BOOLEAN *isPaused); + + /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_IsPaused )( + IFaceFrameReader * This, + BOOLEAN isPaused); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_FaceFrameSource )( + IFaceFrameReader * This, + /* [annotation][out][retval] */ + _COM_Outptr_ IFaceFrameSource **faceFrameSource); + + END_INTERFACE + } IFaceFrameReaderVtbl; + + interface IFaceFrameReader + { + CONST_VTBL struct IFaceFrameReaderVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IFaceFrameReader_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IFaceFrameReader_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IFaceFrameReader_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IFaceFrameReader_SubscribeFrameArrived(This,waitableHandle) \ + ( (This)->lpVtbl -> SubscribeFrameArrived(This,waitableHandle) ) + +#define IFaceFrameReader_UnsubscribeFrameArrived(This,waitableHandle) \ + ( (This)->lpVtbl -> UnsubscribeFrameArrived(This,waitableHandle) ) + +#define IFaceFrameReader_GetFrameArrivedEventData(This,waitableHandle,eventData) \ + ( (This)->lpVtbl -> GetFrameArrivedEventData(This,waitableHandle,eventData) ) + +#define IFaceFrameReader_AcquireLatestFrame(This,faceFrame) \ + ( (This)->lpVtbl -> AcquireLatestFrame(This,faceFrame) ) + +#define IFaceFrameReader_get_IsPaused(This,isPaused) \ + ( (This)->lpVtbl -> get_IsPaused(This,isPaused) ) + +#define IFaceFrameReader_put_IsPaused(This,isPaused) \ + ( (This)->lpVtbl -> put_IsPaused(This,isPaused) ) + +#define IFaceFrameReader_get_FaceFrameSource(This,faceFrameSource) \ + ( (This)->lpVtbl -> get_FaceFrameSource(This,faceFrameSource) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IFaceFrameReader_INTERFACE_DEFINED__ */ + + +#ifndef __IFaceFrameReference_INTERFACE_DEFINED__ +#define __IFaceFrameReference_INTERFACE_DEFINED__ + +/* interface IFaceFrameReference */ +/* [object][local][uuid] */ + + +EXTERN_C const IID IID_IFaceFrameReference; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("78E06811-4C53-A4BD-4CE7-8C995CAD882F") + IFaceFrameReference : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE AcquireFrame( + /* [annotation][out][retval] */ + _COM_Outptr_result_maybenull_ IFaceFrame **faceFrame) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_RelativeTime( + /* [annotation][out][retval] */ + _Out_ TIMESPAN *relativeTime) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IFaceFrameReferenceVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IFaceFrameReference * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IFaceFrameReference * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IFaceFrameReference * This); + + HRESULT ( STDMETHODCALLTYPE *AcquireFrame )( + IFaceFrameReference * This, + /* [annotation][out][retval] */ + _COM_Outptr_result_maybenull_ IFaceFrame **faceFrame); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_RelativeTime )( + IFaceFrameReference * This, + /* [annotation][out][retval] */ + _Out_ TIMESPAN *relativeTime); + + END_INTERFACE + } IFaceFrameReferenceVtbl; + + interface IFaceFrameReference + { + CONST_VTBL struct IFaceFrameReferenceVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IFaceFrameReference_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IFaceFrameReference_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IFaceFrameReference_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IFaceFrameReference_AcquireFrame(This,faceFrame) \ + ( (This)->lpVtbl -> AcquireFrame(This,faceFrame) ) + +#define IFaceFrameReference_get_RelativeTime(This,relativeTime) \ + ( (This)->lpVtbl -> get_RelativeTime(This,relativeTime) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IFaceFrameReference_INTERFACE_DEFINED__ */ + + +#ifndef __IFaceFrameArrivedEventArgs_INTERFACE_DEFINED__ +#define __IFaceFrameArrivedEventArgs_INTERFACE_DEFINED__ + +/* interface IFaceFrameArrivedEventArgs */ +/* [object][local][uuid] */ + + +EXTERN_C const IID IID_IFaceFrameArrivedEventArgs; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("C270AC82-4C03-3BC6-F13E-E680AE7964DA") + IFaceFrameArrivedEventArgs : public IUnknown + { + public: + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_FrameReference( + /* [annotation][out][retval] */ + _COM_Outptr_ IFaceFrameReference **faceFrameReference) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IFaceFrameArrivedEventArgsVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IFaceFrameArrivedEventArgs * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IFaceFrameArrivedEventArgs * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IFaceFrameArrivedEventArgs * This); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_FrameReference )( + IFaceFrameArrivedEventArgs * This, + /* [annotation][out][retval] */ + _COM_Outptr_ IFaceFrameReference **faceFrameReference); + + END_INTERFACE + } IFaceFrameArrivedEventArgsVtbl; + + interface IFaceFrameArrivedEventArgs + { + CONST_VTBL struct IFaceFrameArrivedEventArgsVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IFaceFrameArrivedEventArgs_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IFaceFrameArrivedEventArgs_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IFaceFrameArrivedEventArgs_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IFaceFrameArrivedEventArgs_get_FrameReference(This,faceFrameReference) \ + ( (This)->lpVtbl -> get_FrameReference(This,faceFrameReference) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IFaceFrameArrivedEventArgs_INTERFACE_DEFINED__ */ + + +#ifndef __IFaceFrame_INTERFACE_DEFINED__ +#define __IFaceFrame_INTERFACE_DEFINED__ + +/* interface IFaceFrame */ +/* [object][local][uuid] */ + + +EXTERN_C const IID IID_IFaceFrame; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("5A59B4D1-489E-7211-9676-44AF6E22E247") + IFaceFrame : public IUnknown + { + public: + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_FaceFrameResult( + /* [annotation][out][retval] */ + _COM_Outptr_result_maybenull_ IFaceFrameResult **faceFrameResult) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_TrackingId( + /* [annotation][out][retval] */ + _Out_ UINT64 *trackingId) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_IsTrackingIdValid( + /* [annotation][out][retval] */ + _Out_ BOOLEAN *isTrackingIdValid) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_RelativeTime( + /* [annotation][out][retval] */ + _Out_ TIMESPAN *relativeTime) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_FaceFrameSource( + /* [annotation][out][retval] */ + _COM_Outptr_ IFaceFrameSource **faceFrameSource) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_BodyFrameReference( + /* [annotation][out][retval] */ + _COM_Outptr_ IBodyFrameReference **bodyFrameReference) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_ColorFrameReference( + /* [annotation][out][retval] */ + _COM_Outptr_ IColorFrameReference **colorFrameReference) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_DepthFrameReference( + /* [annotation][out][retval] */ + _COM_Outptr_ IDepthFrameReference **depthFrameReference) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_InfraredFrameReference( + /* [annotation][out][retval] */ + _COM_Outptr_ IInfraredFrameReference **infraredFrameReference) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IFaceFrameVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IFaceFrame * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IFaceFrame * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IFaceFrame * This); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_FaceFrameResult )( + IFaceFrame * This, + /* [annotation][out][retval] */ + _COM_Outptr_result_maybenull_ IFaceFrameResult **faceFrameResult); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_TrackingId )( + IFaceFrame * This, + /* [annotation][out][retval] */ + _Out_ UINT64 *trackingId); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_IsTrackingIdValid )( + IFaceFrame * This, + /* [annotation][out][retval] */ + _Out_ BOOLEAN *isTrackingIdValid); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_RelativeTime )( + IFaceFrame * This, + /* [annotation][out][retval] */ + _Out_ TIMESPAN *relativeTime); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_FaceFrameSource )( + IFaceFrame * This, + /* [annotation][out][retval] */ + _COM_Outptr_ IFaceFrameSource **faceFrameSource); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_BodyFrameReference )( + IFaceFrame * This, + /* [annotation][out][retval] */ + _COM_Outptr_ IBodyFrameReference **bodyFrameReference); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_ColorFrameReference )( + IFaceFrame * This, + /* [annotation][out][retval] */ + _COM_Outptr_ IColorFrameReference **colorFrameReference); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_DepthFrameReference )( + IFaceFrame * This, + /* [annotation][out][retval] */ + _COM_Outptr_ IDepthFrameReference **depthFrameReference); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_InfraredFrameReference )( + IFaceFrame * This, + /* [annotation][out][retval] */ + _COM_Outptr_ IInfraredFrameReference **infraredFrameReference); + + END_INTERFACE + } IFaceFrameVtbl; + + interface IFaceFrame + { + CONST_VTBL struct IFaceFrameVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IFaceFrame_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IFaceFrame_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IFaceFrame_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IFaceFrame_get_FaceFrameResult(This,faceFrameResult) \ + ( (This)->lpVtbl -> get_FaceFrameResult(This,faceFrameResult) ) + +#define IFaceFrame_get_TrackingId(This,trackingId) \ + ( (This)->lpVtbl -> get_TrackingId(This,trackingId) ) + +#define IFaceFrame_get_IsTrackingIdValid(This,isTrackingIdValid) \ + ( (This)->lpVtbl -> get_IsTrackingIdValid(This,isTrackingIdValid) ) + +#define IFaceFrame_get_RelativeTime(This,relativeTime) \ + ( (This)->lpVtbl -> get_RelativeTime(This,relativeTime) ) + +#define IFaceFrame_get_FaceFrameSource(This,faceFrameSource) \ + ( (This)->lpVtbl -> get_FaceFrameSource(This,faceFrameSource) ) + +#define IFaceFrame_get_BodyFrameReference(This,bodyFrameReference) \ + ( (This)->lpVtbl -> get_BodyFrameReference(This,bodyFrameReference) ) + +#define IFaceFrame_get_ColorFrameReference(This,colorFrameReference) \ + ( (This)->lpVtbl -> get_ColorFrameReference(This,colorFrameReference) ) + +#define IFaceFrame_get_DepthFrameReference(This,depthFrameReference) \ + ( (This)->lpVtbl -> get_DepthFrameReference(This,depthFrameReference) ) + +#define IFaceFrame_get_InfraredFrameReference(This,infraredFrameReference) \ + ( (This)->lpVtbl -> get_InfraredFrameReference(This,infraredFrameReference) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IFaceFrame_INTERFACE_DEFINED__ */ + + +#ifndef __IFaceFrameResult_INTERFACE_DEFINED__ +#define __IFaceFrameResult_INTERFACE_DEFINED__ + +/* interface IFaceFrameResult */ +/* [object][local][uuid] */ + + +EXTERN_C const IID IID_IFaceFrameResult; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("8873C3F1-445F-BD37-404C-ED92C2906523") + IFaceFrameResult : public IUnknown + { + public: + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_RelativeTime( + /* [annotation][out][retval] */ + _Out_ TIMESPAN *relativeTime) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_FaceFrameFeatures( + /* [annotation][out][retval] */ + _Out_ DWORD *faceFrameFeatures) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_TrackingId( + /* [annotation][out][retval] */ + _Out_ UINT64 *trackingId) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_FaceRotationQuaternion( + /* [annotation][out][retval] */ + _Out_ Vector4 *rotationQuaternion) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_FaceBoundingBoxInColorSpace( + /* [annotation][out][retval] */ + _Out_ RectI *boundingBox) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_FaceBoundingBoxInInfraredSpace( + /* [annotation][out][retval] */ + _Out_ RectI *boundingBox) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetFacePointsInColorSpace( + /* [annotation][in][annotation] */ + _In_ const UINT capacity, + /* [annotation][size_is][out] */ + _Out_writes_all_(capacity) PointF *facePoints) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetFacePointsInInfraredSpace( + /* [annotation][in][annotation] */ + _In_ const UINT capacity, + /* [annotation][size_is][out] */ + _Out_writes_all_(capacity) PointF *facePoints) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetFaceProperties( + /* [annotation][in][annotation] */ + _In_ const UINT capacity, + /* [annotation][size_is][out] */ + _Out_writes_all_(capacity) DetectionResult *detectionResults) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IFaceFrameResultVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IFaceFrameResult * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IFaceFrameResult * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IFaceFrameResult * This); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_RelativeTime )( + IFaceFrameResult * This, + /* [annotation][out][retval] */ + _Out_ TIMESPAN *relativeTime); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_FaceFrameFeatures )( + IFaceFrameResult * This, + /* [annotation][out][retval] */ + _Out_ DWORD *faceFrameFeatures); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_TrackingId )( + IFaceFrameResult * This, + /* [annotation][out][retval] */ + _Out_ UINT64 *trackingId); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_FaceRotationQuaternion )( + IFaceFrameResult * This, + /* [annotation][out][retval] */ + _Out_ Vector4 *rotationQuaternion); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_FaceBoundingBoxInColorSpace )( + IFaceFrameResult * This, + /* [annotation][out][retval] */ + _Out_ RectI *boundingBox); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_FaceBoundingBoxInInfraredSpace )( + IFaceFrameResult * This, + /* [annotation][out][retval] */ + _Out_ RectI *boundingBox); + + HRESULT ( STDMETHODCALLTYPE *GetFacePointsInColorSpace )( + IFaceFrameResult * This, + /* [annotation][in][annotation] */ + _In_ const UINT capacity, + /* [annotation][size_is][out] */ + _Out_writes_all_(capacity) PointF *facePoints); + + HRESULT ( STDMETHODCALLTYPE *GetFacePointsInInfraredSpace )( + IFaceFrameResult * This, + /* [annotation][in][annotation] */ + _In_ const UINT capacity, + /* [annotation][size_is][out] */ + _Out_writes_all_(capacity) PointF *facePoints); + + HRESULT ( STDMETHODCALLTYPE *GetFaceProperties )( + IFaceFrameResult * This, + /* [annotation][in][annotation] */ + _In_ const UINT capacity, + /* [annotation][size_is][out] */ + _Out_writes_all_(capacity) DetectionResult *detectionResults); + + END_INTERFACE + } IFaceFrameResultVtbl; + + interface IFaceFrameResult + { + CONST_VTBL struct IFaceFrameResultVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IFaceFrameResult_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IFaceFrameResult_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IFaceFrameResult_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IFaceFrameResult_get_RelativeTime(This,relativeTime) \ + ( (This)->lpVtbl -> get_RelativeTime(This,relativeTime) ) + +#define IFaceFrameResult_get_FaceFrameFeatures(This,faceFrameFeatures) \ + ( (This)->lpVtbl -> get_FaceFrameFeatures(This,faceFrameFeatures) ) + +#define IFaceFrameResult_get_TrackingId(This,trackingId) \ + ( (This)->lpVtbl -> get_TrackingId(This,trackingId) ) + +#define IFaceFrameResult_get_FaceRotationQuaternion(This,rotationQuaternion) \ + ( (This)->lpVtbl -> get_FaceRotationQuaternion(This,rotationQuaternion) ) + +#define IFaceFrameResult_get_FaceBoundingBoxInColorSpace(This,boundingBox) \ + ( (This)->lpVtbl -> get_FaceBoundingBoxInColorSpace(This,boundingBox) ) + +#define IFaceFrameResult_get_FaceBoundingBoxInInfraredSpace(This,boundingBox) \ + ( (This)->lpVtbl -> get_FaceBoundingBoxInInfraredSpace(This,boundingBox) ) + +#define IFaceFrameResult_GetFacePointsInColorSpace(This,capacity,facePoints) \ + ( (This)->lpVtbl -> GetFacePointsInColorSpace(This,capacity,facePoints) ) + +#define IFaceFrameResult_GetFacePointsInInfraredSpace(This,capacity,facePoints) \ + ( (This)->lpVtbl -> GetFacePointsInInfraredSpace(This,capacity,facePoints) ) + +#define IFaceFrameResult_GetFaceProperties(This,capacity,detectionResults) \ + ( (This)->lpVtbl -> GetFaceProperties(This,capacity,detectionResults) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IFaceFrameResult_INTERFACE_DEFINED__ */ + + +#ifndef __ITrackingIdLostEventArgs_INTERFACE_DEFINED__ +#define __ITrackingIdLostEventArgs_INTERFACE_DEFINED__ + +/* interface ITrackingIdLostEventArgs */ +/* [object][local][uuid] */ + + +EXTERN_C const IID IID_ITrackingIdLostEventArgs; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("1EFE99CA-4356-FED8-D564-BDA0CB6F15C4") + ITrackingIdLostEventArgs : public IUnknown + { + public: + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_TrackingId( + /* [annotation][out][retval] */ + _Out_ UINT64 *trackingId) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ITrackingIdLostEventArgsVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ITrackingIdLostEventArgs * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ITrackingIdLostEventArgs * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ITrackingIdLostEventArgs * This); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_TrackingId )( + ITrackingIdLostEventArgs * This, + /* [annotation][out][retval] */ + _Out_ UINT64 *trackingId); + + END_INTERFACE + } ITrackingIdLostEventArgsVtbl; + + interface ITrackingIdLostEventArgs + { + CONST_VTBL struct ITrackingIdLostEventArgsVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ITrackingIdLostEventArgs_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ITrackingIdLostEventArgs_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ITrackingIdLostEventArgs_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ITrackingIdLostEventArgs_get_TrackingId(This,trackingId) \ + ( (This)->lpVtbl -> get_TrackingId(This,trackingId) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ITrackingIdLostEventArgs_INTERFACE_DEFINED__ */ + + +#ifndef __ICollectionStatusChangedEventArgs_INTERFACE_DEFINED__ +#define __ICollectionStatusChangedEventArgs_INTERFACE_DEFINED__ + +/* interface ICollectionStatusChangedEventArgs */ +/* [object][local][uuid] */ + + +EXTERN_C const IID IID_ICollectionStatusChangedEventArgs; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("B48D57AD-A414-4542-BE89-C4898816A678") + ICollectionStatusChangedEventArgs : public IUnknown + { + public: + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_PreviousCollectionStatus( + /* [annotation][out][retval] */ + _Out_ FaceModelBuilderCollectionStatus *pCollectionStatus) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ICollectionStatusChangedEventArgsVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ICollectionStatusChangedEventArgs * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ICollectionStatusChangedEventArgs * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ICollectionStatusChangedEventArgs * This); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_PreviousCollectionStatus )( + ICollectionStatusChangedEventArgs * This, + /* [annotation][out][retval] */ + _Out_ FaceModelBuilderCollectionStatus *pCollectionStatus); + + END_INTERFACE + } ICollectionStatusChangedEventArgsVtbl; + + interface ICollectionStatusChangedEventArgs + { + CONST_VTBL struct ICollectionStatusChangedEventArgsVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ICollectionStatusChangedEventArgs_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ICollectionStatusChangedEventArgs_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ICollectionStatusChangedEventArgs_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ICollectionStatusChangedEventArgs_get_PreviousCollectionStatus(This,pCollectionStatus) \ + ( (This)->lpVtbl -> get_PreviousCollectionStatus(This,pCollectionStatus) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ICollectionStatusChangedEventArgs_INTERFACE_DEFINED__ */ + + +#ifndef __ICaptureStatusChangedEventArgs_INTERFACE_DEFINED__ +#define __ICaptureStatusChangedEventArgs_INTERFACE_DEFINED__ + +/* interface ICaptureStatusChangedEventArgs */ +/* [object][local][uuid] */ + + +EXTERN_C const IID IID_ICaptureStatusChangedEventArgs; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("BD8BA0B8-6CD5-4051-9246-01A15D023BA9") + ICaptureStatusChangedEventArgs : public IUnknown + { + public: + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_PreviousCaptureStatus( + /* [annotation][out][retval] */ + _Out_ FaceModelBuilderCaptureStatus *pCaptureStatus) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ICaptureStatusChangedEventArgsVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ICaptureStatusChangedEventArgs * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ICaptureStatusChangedEventArgs * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ICaptureStatusChangedEventArgs * This); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_PreviousCaptureStatus )( + ICaptureStatusChangedEventArgs * This, + /* [annotation][out][retval] */ + _Out_ FaceModelBuilderCaptureStatus *pCaptureStatus); + + END_INTERFACE + } ICaptureStatusChangedEventArgsVtbl; + + interface ICaptureStatusChangedEventArgs + { + CONST_VTBL struct ICaptureStatusChangedEventArgsVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ICaptureStatusChangedEventArgs_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ICaptureStatusChangedEventArgs_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ICaptureStatusChangedEventArgs_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ICaptureStatusChangedEventArgs_get_PreviousCaptureStatus(This,pCaptureStatus) \ + ( (This)->lpVtbl -> get_PreviousCaptureStatus(This,pCaptureStatus) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ICaptureStatusChangedEventArgs_INTERFACE_DEFINED__ */ + + +#ifndef __IFaceAlignment_INTERFACE_DEFINED__ +#define __IFaceAlignment_INTERFACE_DEFINED__ + +/* interface IFaceAlignment */ +/* [object][local][uuid] */ + + +EXTERN_C const IID IID_IFaceAlignment; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("38DFFDE8-2C4D-476D-B1DF-43EF4529F2AF") + IFaceAlignment : public IUnknown + { + public: + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_FaceOrientation( + /* [annotation][out][retval] */ + _Out_ Vector4 *faceOrientation) = 0; + + virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_FaceOrientation( + Vector4 faceOrientation) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_HeadPivotPoint( + /* [annotation][out][retval] */ + _Out_ CameraSpacePoint *headPivotPoint) = 0; + + virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_HeadPivotPoint( + CameraSpacePoint headPivotPoint) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_FaceBoundingBox( + /* [annotation][out][retval] */ + _Out_ RectI *boundingBox) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetAnimationUnits( + UINT capacity, + /* [annotation][size_is][out] */ + _Out_writes_all_(capacity) float *animationUnits) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Quality( + /* [annotation][out][retval] */ + _Out_ FaceAlignmentQuality *quality) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IFaceAlignmentVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IFaceAlignment * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IFaceAlignment * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IFaceAlignment * This); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_FaceOrientation )( + IFaceAlignment * This, + /* [annotation][out][retval] */ + _Out_ Vector4 *faceOrientation); + + /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_FaceOrientation )( + IFaceAlignment * This, + Vector4 faceOrientation); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_HeadPivotPoint )( + IFaceAlignment * This, + /* [annotation][out][retval] */ + _Out_ CameraSpacePoint *headPivotPoint); + + /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_HeadPivotPoint )( + IFaceAlignment * This, + CameraSpacePoint headPivotPoint); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_FaceBoundingBox )( + IFaceAlignment * This, + /* [annotation][out][retval] */ + _Out_ RectI *boundingBox); + + HRESULT ( STDMETHODCALLTYPE *GetAnimationUnits )( + IFaceAlignment * This, + UINT capacity, + /* [annotation][size_is][out] */ + _Out_writes_all_(capacity) float *animationUnits); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Quality )( + IFaceAlignment * This, + /* [annotation][out][retval] */ + _Out_ FaceAlignmentQuality *quality); + + END_INTERFACE + } IFaceAlignmentVtbl; + + interface IFaceAlignment + { + CONST_VTBL struct IFaceAlignmentVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IFaceAlignment_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IFaceAlignment_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IFaceAlignment_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IFaceAlignment_get_FaceOrientation(This,faceOrientation) \ + ( (This)->lpVtbl -> get_FaceOrientation(This,faceOrientation) ) + +#define IFaceAlignment_put_FaceOrientation(This,faceOrientation) \ + ( (This)->lpVtbl -> put_FaceOrientation(This,faceOrientation) ) + +#define IFaceAlignment_get_HeadPivotPoint(This,headPivotPoint) \ + ( (This)->lpVtbl -> get_HeadPivotPoint(This,headPivotPoint) ) + +#define IFaceAlignment_put_HeadPivotPoint(This,headPivotPoint) \ + ( (This)->lpVtbl -> put_HeadPivotPoint(This,headPivotPoint) ) + +#define IFaceAlignment_get_FaceBoundingBox(This,boundingBox) \ + ( (This)->lpVtbl -> get_FaceBoundingBox(This,boundingBox) ) + +#define IFaceAlignment_GetAnimationUnits(This,capacity,animationUnits) \ + ( (This)->lpVtbl -> GetAnimationUnits(This,capacity,animationUnits) ) + +#define IFaceAlignment_get_Quality(This,quality) \ + ( (This)->lpVtbl -> get_Quality(This,quality) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IFaceAlignment_INTERFACE_DEFINED__ */ + + +#ifndef __IFaceModel_INTERFACE_DEFINED__ +#define __IFaceModel_INTERFACE_DEFINED__ + +/* interface IFaceModel */ +/* [object][local][uuid] */ + + +EXTERN_C const IID IID_IFaceModel; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("7B28C340-B6D0-44AC-8CF0-2D3F568C7D7E") + IFaceModel : public IUnknown + { + public: + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Scale( + /* [annotation][out][retval] */ + _Out_ float *scale) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_SkinColor( + /* [annotation][out][retval] */ + _Out_ UINT32 *skinColor) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_HairColor( + /* [annotation][out][retval] */ + _Out_ UINT32 *hairColor) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetFaceShapeDeformations( + UINT32 capacity, + /* [annotation][size_is][out] */ + _Out_writes_all_(capacity) float *faceShapeDeformations) = 0; + + virtual HRESULT STDMETHODCALLTYPE CalculateVerticesForAlignment( + /* [annotation][in] */ + _In_ IFaceAlignment *faceAlignment, + UINT capacity, + /* [annotation][size_is][out] */ + _Out_writes_all_(capacity) CameraSpacePoint *vertices) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IFaceModelVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IFaceModel * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IFaceModel * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IFaceModel * This); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Scale )( + IFaceModel * This, + /* [annotation][out][retval] */ + _Out_ float *scale); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_SkinColor )( + IFaceModel * This, + /* [annotation][out][retval] */ + _Out_ UINT32 *skinColor); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_HairColor )( + IFaceModel * This, + /* [annotation][out][retval] */ + _Out_ UINT32 *hairColor); + + HRESULT ( STDMETHODCALLTYPE *GetFaceShapeDeformations )( + IFaceModel * This, + UINT32 capacity, + /* [annotation][size_is][out] */ + _Out_writes_all_(capacity) float *faceShapeDeformations); + + HRESULT ( STDMETHODCALLTYPE *CalculateVerticesForAlignment )( + IFaceModel * This, + /* [annotation][in] */ + _In_ IFaceAlignment *faceAlignment, + UINT capacity, + /* [annotation][size_is][out] */ + _Out_writes_all_(capacity) CameraSpacePoint *vertices); + + END_INTERFACE + } IFaceModelVtbl; + + interface IFaceModel + { + CONST_VTBL struct IFaceModelVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IFaceModel_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IFaceModel_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IFaceModel_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IFaceModel_get_Scale(This,scale) \ + ( (This)->lpVtbl -> get_Scale(This,scale) ) + +#define IFaceModel_get_SkinColor(This,skinColor) \ + ( (This)->lpVtbl -> get_SkinColor(This,skinColor) ) + +#define IFaceModel_get_HairColor(This,hairColor) \ + ( (This)->lpVtbl -> get_HairColor(This,hairColor) ) + +#define IFaceModel_GetFaceShapeDeformations(This,capacity,faceShapeDeformations) \ + ( (This)->lpVtbl -> GetFaceShapeDeformations(This,capacity,faceShapeDeformations) ) + +#define IFaceModel_CalculateVerticesForAlignment(This,faceAlignment,capacity,vertices) \ + ( (This)->lpVtbl -> CalculateVerticesForAlignment(This,faceAlignment,capacity,vertices) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IFaceModel_INTERFACE_DEFINED__ */ + + +#ifndef __IFaceModelBuilder_INTERFACE_DEFINED__ +#define __IFaceModelBuilder_INTERFACE_DEFINED__ + +/* interface IFaceModelBuilder */ +/* [object][local][uuid] */ + + +EXTERN_C const IID IID_IFaceModelBuilder; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("BD92A663-1D1E-4CCF-B202-66DD49834BBE") + IFaceModelBuilder : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE SubscribeCollectionStatusChanged( + /* [annotation][out][retval] */ + _Out_ WAITABLE_HANDLE *waitableHandle) = 0; + + virtual HRESULT STDMETHODCALLTYPE UnsubscribeCollectionStatusChanged( + /* [annotation][in] */ + _In_ WAITABLE_HANDLE waitableHandle) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetCollectionStatusChangedEventData( + /* [annotation][in] */ + _In_ WAITABLE_HANDLE waitableHandle, + /* [annotation][out][retval] */ + _Out_ ICollectionStatusChangedEventArgs **eventData) = 0; + + virtual HRESULT STDMETHODCALLTYPE SubscribeCaptureStatusChanged( + /* [annotation][out][retval] */ + _Out_ WAITABLE_HANDLE *waitableHandle) = 0; + + virtual HRESULT STDMETHODCALLTYPE UnsubscribeCaptureStatusChanged( + /* [annotation][in] */ + _In_ WAITABLE_HANDLE waitableHandle) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetCaptureStatusChangedEventData( + /* [annotation][in] */ + _In_ WAITABLE_HANDLE waitableHandle, + /* [annotation][out][retval] */ + _Out_ ICaptureStatusChangedEventArgs **eventData) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_CollectionStatus( + /* [annotation][out][retval] */ + _Out_ FaceModelBuilderCollectionStatus *currrentCollectionStatus) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_CaptureStatus( + /* [annotation][out][retval] */ + _Out_ FaceModelBuilderCaptureStatus *currentCaptureStatus) = 0; + + virtual HRESULT STDMETHODCALLTYPE BeginFaceDataCollection( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetFaceData( + /* [annotation][out][retval] */ + _COM_Outptr_ IFaceModelData **faceModelData) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IFaceModelBuilderVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IFaceModelBuilder * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IFaceModelBuilder * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IFaceModelBuilder * This); + + HRESULT ( STDMETHODCALLTYPE *SubscribeCollectionStatusChanged )( + IFaceModelBuilder * This, + /* [annotation][out][retval] */ + _Out_ WAITABLE_HANDLE *waitableHandle); + + HRESULT ( STDMETHODCALLTYPE *UnsubscribeCollectionStatusChanged )( + IFaceModelBuilder * This, + /* [annotation][in] */ + _In_ WAITABLE_HANDLE waitableHandle); + + HRESULT ( STDMETHODCALLTYPE *GetCollectionStatusChangedEventData )( + IFaceModelBuilder * This, + /* [annotation][in] */ + _In_ WAITABLE_HANDLE waitableHandle, + /* [annotation][out][retval] */ + _Out_ ICollectionStatusChangedEventArgs **eventData); + + HRESULT ( STDMETHODCALLTYPE *SubscribeCaptureStatusChanged )( + IFaceModelBuilder * This, + /* [annotation][out][retval] */ + _Out_ WAITABLE_HANDLE *waitableHandle); + + HRESULT ( STDMETHODCALLTYPE *UnsubscribeCaptureStatusChanged )( + IFaceModelBuilder * This, + /* [annotation][in] */ + _In_ WAITABLE_HANDLE waitableHandle); + + HRESULT ( STDMETHODCALLTYPE *GetCaptureStatusChangedEventData )( + IFaceModelBuilder * This, + /* [annotation][in] */ + _In_ WAITABLE_HANDLE waitableHandle, + /* [annotation][out][retval] */ + _Out_ ICaptureStatusChangedEventArgs **eventData); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_CollectionStatus )( + IFaceModelBuilder * This, + /* [annotation][out][retval] */ + _Out_ FaceModelBuilderCollectionStatus *currrentCollectionStatus); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_CaptureStatus )( + IFaceModelBuilder * This, + /* [annotation][out][retval] */ + _Out_ FaceModelBuilderCaptureStatus *currentCaptureStatus); + + HRESULT ( STDMETHODCALLTYPE *BeginFaceDataCollection )( + IFaceModelBuilder * This); + + HRESULT ( STDMETHODCALLTYPE *GetFaceData )( + IFaceModelBuilder * This, + /* [annotation][out][retval] */ + _COM_Outptr_ IFaceModelData **faceModelData); + + END_INTERFACE + } IFaceModelBuilderVtbl; + + interface IFaceModelBuilder + { + CONST_VTBL struct IFaceModelBuilderVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IFaceModelBuilder_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IFaceModelBuilder_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IFaceModelBuilder_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IFaceModelBuilder_SubscribeCollectionStatusChanged(This,waitableHandle) \ + ( (This)->lpVtbl -> SubscribeCollectionStatusChanged(This,waitableHandle) ) + +#define IFaceModelBuilder_UnsubscribeCollectionStatusChanged(This,waitableHandle) \ + ( (This)->lpVtbl -> UnsubscribeCollectionStatusChanged(This,waitableHandle) ) + +#define IFaceModelBuilder_GetCollectionStatusChangedEventData(This,waitableHandle,eventData) \ + ( (This)->lpVtbl -> GetCollectionStatusChangedEventData(This,waitableHandle,eventData) ) + +#define IFaceModelBuilder_SubscribeCaptureStatusChanged(This,waitableHandle) \ + ( (This)->lpVtbl -> SubscribeCaptureStatusChanged(This,waitableHandle) ) + +#define IFaceModelBuilder_UnsubscribeCaptureStatusChanged(This,waitableHandle) \ + ( (This)->lpVtbl -> UnsubscribeCaptureStatusChanged(This,waitableHandle) ) + +#define IFaceModelBuilder_GetCaptureStatusChangedEventData(This,waitableHandle,eventData) \ + ( (This)->lpVtbl -> GetCaptureStatusChangedEventData(This,waitableHandle,eventData) ) + +#define IFaceModelBuilder_get_CollectionStatus(This,currrentCollectionStatus) \ + ( (This)->lpVtbl -> get_CollectionStatus(This,currrentCollectionStatus) ) + +#define IFaceModelBuilder_get_CaptureStatus(This,currentCaptureStatus) \ + ( (This)->lpVtbl -> get_CaptureStatus(This,currentCaptureStatus) ) + +#define IFaceModelBuilder_BeginFaceDataCollection(This) \ + ( (This)->lpVtbl -> BeginFaceDataCollection(This) ) + +#define IFaceModelBuilder_GetFaceData(This,faceModelData) \ + ( (This)->lpVtbl -> GetFaceData(This,faceModelData) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IFaceModelBuilder_INTERFACE_DEFINED__ */ + + +#ifndef __IFaceModelData_INTERFACE_DEFINED__ +#define __IFaceModelData_INTERFACE_DEFINED__ + +/* interface IFaceModelData */ +/* [object][local][uuid] */ + + +EXTERN_C const IID IID_IFaceModelData; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("ABD8D92D-E579-466E-BD9E-232E0134BCE0") + IFaceModelData : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE ProduceFaceModel( + /* [annotation][out][retval] */ + _COM_Outptr_result_maybenull_ IFaceModel **faceModel) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IFaceModelDataVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IFaceModelData * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IFaceModelData * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IFaceModelData * This); + + HRESULT ( STDMETHODCALLTYPE *ProduceFaceModel )( + IFaceModelData * This, + /* [annotation][out][retval] */ + _COM_Outptr_result_maybenull_ IFaceModel **faceModel); + + END_INTERFACE + } IFaceModelDataVtbl; + + interface IFaceModelData + { + CONST_VTBL struct IFaceModelDataVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IFaceModelData_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IFaceModelData_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IFaceModelData_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IFaceModelData_ProduceFaceModel(This,faceModel) \ + ( (This)->lpVtbl -> ProduceFaceModel(This,faceModel) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IFaceModelData_INTERFACE_DEFINED__ */ + + +#ifndef __IHighDefinitionFaceFrameReference_INTERFACE_DEFINED__ +#define __IHighDefinitionFaceFrameReference_INTERFACE_DEFINED__ + +/* interface IHighDefinitionFaceFrameReference */ +/* [object][local][uuid] */ + + +EXTERN_C const IID IID_IHighDefinitionFaceFrameReference; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("16806807-70B9-4D0C-A74B-E807783969C3") + IHighDefinitionFaceFrameReference : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE AcquireFrame( + /* [annotation][out][retval] */ + _COM_Outptr_ IHighDefinitionFaceFrame **highDefinitonFaceFrame) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_RelativeTime( + /* [annotation][out][retval] */ + _Out_ TIMESPAN *relativeTime) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IHighDefinitionFaceFrameReferenceVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IHighDefinitionFaceFrameReference * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IHighDefinitionFaceFrameReference * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IHighDefinitionFaceFrameReference * This); + + HRESULT ( STDMETHODCALLTYPE *AcquireFrame )( + IHighDefinitionFaceFrameReference * This, + /* [annotation][out][retval] */ + _COM_Outptr_ IHighDefinitionFaceFrame **highDefinitonFaceFrame); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_RelativeTime )( + IHighDefinitionFaceFrameReference * This, + /* [annotation][out][retval] */ + _Out_ TIMESPAN *relativeTime); + + END_INTERFACE + } IHighDefinitionFaceFrameReferenceVtbl; + + interface IHighDefinitionFaceFrameReference + { + CONST_VTBL struct IHighDefinitionFaceFrameReferenceVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IHighDefinitionFaceFrameReference_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IHighDefinitionFaceFrameReference_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IHighDefinitionFaceFrameReference_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IHighDefinitionFaceFrameReference_AcquireFrame(This,highDefinitonFaceFrame) \ + ( (This)->lpVtbl -> AcquireFrame(This,highDefinitonFaceFrame) ) + +#define IHighDefinitionFaceFrameReference_get_RelativeTime(This,relativeTime) \ + ( (This)->lpVtbl -> get_RelativeTime(This,relativeTime) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IHighDefinitionFaceFrameReference_INTERFACE_DEFINED__ */ + + +#ifndef __IHighDefinitionFaceFrameArrivedEventArgs_INTERFACE_DEFINED__ +#define __IHighDefinitionFaceFrameArrivedEventArgs_INTERFACE_DEFINED__ + +/* interface IHighDefinitionFaceFrameArrivedEventArgs */ +/* [object][local][uuid] */ + + +EXTERN_C const IID IID_IHighDefinitionFaceFrameArrivedEventArgs; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("9B0BAB99-4EC6-4CAB-83F4-3A3C9D864333") + IHighDefinitionFaceFrameArrivedEventArgs : public IUnknown + { + public: + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_FrameReference( + /* [annotation][out][retval] */ + _COM_Outptr_ IHighDefinitionFaceFrameReference **highDefinitonFaceFrameReference) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IHighDefinitionFaceFrameArrivedEventArgsVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IHighDefinitionFaceFrameArrivedEventArgs * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IHighDefinitionFaceFrameArrivedEventArgs * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IHighDefinitionFaceFrameArrivedEventArgs * This); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_FrameReference )( + IHighDefinitionFaceFrameArrivedEventArgs * This, + /* [annotation][out][retval] */ + _COM_Outptr_ IHighDefinitionFaceFrameReference **highDefinitonFaceFrameReference); + + END_INTERFACE + } IHighDefinitionFaceFrameArrivedEventArgsVtbl; + + interface IHighDefinitionFaceFrameArrivedEventArgs + { + CONST_VTBL struct IHighDefinitionFaceFrameArrivedEventArgsVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IHighDefinitionFaceFrameArrivedEventArgs_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IHighDefinitionFaceFrameArrivedEventArgs_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IHighDefinitionFaceFrameArrivedEventArgs_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IHighDefinitionFaceFrameArrivedEventArgs_get_FrameReference(This,highDefinitonFaceFrameReference) \ + ( (This)->lpVtbl -> get_FrameReference(This,highDefinitonFaceFrameReference) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IHighDefinitionFaceFrameArrivedEventArgs_INTERFACE_DEFINED__ */ + + +#ifndef __IHighDefinitionFaceFrameSource_INTERFACE_DEFINED__ +#define __IHighDefinitionFaceFrameSource_INTERFACE_DEFINED__ + +/* interface IHighDefinitionFaceFrameSource */ +/* [object][local][uuid] */ + + +EXTERN_C const IID IID_IHighDefinitionFaceFrameSource; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("E6F33685-BEFC-48CA-B81A-B6A8A79C32FE") + IHighDefinitionFaceFrameSource : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE SubscribeTrackingIdLost( + /* [annotation][out][retval] */ + _Out_ WAITABLE_HANDLE *waitableHandle) = 0; + + virtual HRESULT STDMETHODCALLTYPE UnsubscribeTrackingIdLost( + /* [annotation][in] */ + _In_ WAITABLE_HANDLE waitableHandle) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetTrackingIdLostEventData( + /* [annotation][in] */ + _In_ WAITABLE_HANDLE waitableHandle, + /* [annotation][out][retval] */ + _Out_ ITrackingIdLostEventArgs **eventData) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_IsOnline( + /* [annotation][out][retval] */ + _Out_ BOOLEAN *isOnline) = 0; + + virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_IsOnline( + BOOLEAN isOnline) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_IsActive( + /* [annotation][out][retval] */ + _Out_ BOOLEAN *isActive) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_TrackingId( + /* [annotation][out][retval] */ + _Out_ UINT64 *trackingId) = 0; + + virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_TrackingId( + UINT64 trackingId) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_IsTrackingIdValid( + /* [annotation][out][retval] */ + _Out_ BOOLEAN *isTrackingIdValid) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_TrackingQuality( + /* [annotation][out][retval] */ + _Out_ FaceAlignmentQuality *trackingQuality) = 0; + + virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_TrackingQuality( + FaceAlignmentQuality trackingQuality) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_FaceModel( + /* [annotation][out][retval] */ + _COM_Outptr_ IFaceModel **faceModel) = 0; + + virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_FaceModel( + /* [annotation][in] */ + _In_ IFaceModel *faceModel) = 0; + + virtual HRESULT STDMETHODCALLTYPE OpenReader( + /* [annotation][out][retval] */ + _COM_Outptr_ IHighDefinitionFaceFrameReader **reader) = 0; + + virtual HRESULT STDMETHODCALLTYPE OpenModelBuilder( + FaceModelBuilderAttributes enabledAttributes, + /* [annotation][out][retval] */ + _COM_Outptr_ IFaceModelBuilder **modelbuilder) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_KinectSensor( + /* [annotation][out][retval] */ + _COM_Outptr_ IKinectSensor **sensor) = 0; + + virtual HRESULT STDMETHODCALLTYPE FeedAndCalculateFrameData( + /* [annotation][in] */ + _In_ IBody *body, + UINT infraredCapacity, + /* [annotation][size_is][in] */ + _In_reads_(infraredCapacity) UINT16 *infraredFrameBuffer, + UINT colorCapacity, + /* [annotation][size_is][in] */ + _In_reads_(colorCapacity) BYTE *colorFrameBuffer, + UINT depthCapacity, + /* [annotation][size_is][in] */ + _In_reads_(depthCapacity) UINT16 *depthFrameBuffer) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IHighDefinitionFaceFrameSourceVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IHighDefinitionFaceFrameSource * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IHighDefinitionFaceFrameSource * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IHighDefinitionFaceFrameSource * This); + + HRESULT ( STDMETHODCALLTYPE *SubscribeTrackingIdLost )( + IHighDefinitionFaceFrameSource * This, + /* [annotation][out][retval] */ + _Out_ WAITABLE_HANDLE *waitableHandle); + + HRESULT ( STDMETHODCALLTYPE *UnsubscribeTrackingIdLost )( + IHighDefinitionFaceFrameSource * This, + /* [annotation][in] */ + _In_ WAITABLE_HANDLE waitableHandle); + + HRESULT ( STDMETHODCALLTYPE *GetTrackingIdLostEventData )( + IHighDefinitionFaceFrameSource * This, + /* [annotation][in] */ + _In_ WAITABLE_HANDLE waitableHandle, + /* [annotation][out][retval] */ + _Out_ ITrackingIdLostEventArgs **eventData); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_IsOnline )( + IHighDefinitionFaceFrameSource * This, + /* [annotation][out][retval] */ + _Out_ BOOLEAN *isOnline); + + /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_IsOnline )( + IHighDefinitionFaceFrameSource * This, + BOOLEAN isOnline); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_IsActive )( + IHighDefinitionFaceFrameSource * This, + /* [annotation][out][retval] */ + _Out_ BOOLEAN *isActive); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_TrackingId )( + IHighDefinitionFaceFrameSource * This, + /* [annotation][out][retval] */ + _Out_ UINT64 *trackingId); + + /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_TrackingId )( + IHighDefinitionFaceFrameSource * This, + UINT64 trackingId); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_IsTrackingIdValid )( + IHighDefinitionFaceFrameSource * This, + /* [annotation][out][retval] */ + _Out_ BOOLEAN *isTrackingIdValid); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_TrackingQuality )( + IHighDefinitionFaceFrameSource * This, + /* [annotation][out][retval] */ + _Out_ FaceAlignmentQuality *trackingQuality); + + /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_TrackingQuality )( + IHighDefinitionFaceFrameSource * This, + FaceAlignmentQuality trackingQuality); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_FaceModel )( + IHighDefinitionFaceFrameSource * This, + /* [annotation][out][retval] */ + _COM_Outptr_ IFaceModel **faceModel); + + /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_FaceModel )( + IHighDefinitionFaceFrameSource * This, + /* [annotation][in] */ + _In_ IFaceModel *faceModel); + + HRESULT ( STDMETHODCALLTYPE *OpenReader )( + IHighDefinitionFaceFrameSource * This, + /* [annotation][out][retval] */ + _COM_Outptr_ IHighDefinitionFaceFrameReader **reader); + + HRESULT ( STDMETHODCALLTYPE *OpenModelBuilder )( + IHighDefinitionFaceFrameSource * This, + FaceModelBuilderAttributes enabledAttributes, + /* [annotation][out][retval] */ + _COM_Outptr_ IFaceModelBuilder **modelbuilder); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_KinectSensor )( + IHighDefinitionFaceFrameSource * This, + /* [annotation][out][retval] */ + _COM_Outptr_ IKinectSensor **sensor); + + HRESULT ( STDMETHODCALLTYPE *FeedAndCalculateFrameData )( + IHighDefinitionFaceFrameSource * This, + /* [annotation][in] */ + _In_ IBody *body, + UINT infraredCapacity, + /* [annotation][size_is][in] */ + _In_reads_(infraredCapacity) UINT16 *infraredFrameBuffer, + UINT colorCapacity, + /* [annotation][size_is][in] */ + _In_reads_(colorCapacity) BYTE *colorFrameBuffer, + UINT depthCapacity, + /* [annotation][size_is][in] */ + _In_reads_(depthCapacity) UINT16 *depthFrameBuffer); + + END_INTERFACE + } IHighDefinitionFaceFrameSourceVtbl; + + interface IHighDefinitionFaceFrameSource + { + CONST_VTBL struct IHighDefinitionFaceFrameSourceVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IHighDefinitionFaceFrameSource_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IHighDefinitionFaceFrameSource_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IHighDefinitionFaceFrameSource_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IHighDefinitionFaceFrameSource_SubscribeTrackingIdLost(This,waitableHandle) \ + ( (This)->lpVtbl -> SubscribeTrackingIdLost(This,waitableHandle) ) + +#define IHighDefinitionFaceFrameSource_UnsubscribeTrackingIdLost(This,waitableHandle) \ + ( (This)->lpVtbl -> UnsubscribeTrackingIdLost(This,waitableHandle) ) + +#define IHighDefinitionFaceFrameSource_GetTrackingIdLostEventData(This,waitableHandle,eventData) \ + ( (This)->lpVtbl -> GetTrackingIdLostEventData(This,waitableHandle,eventData) ) + +#define IHighDefinitionFaceFrameSource_get_IsOnline(This,isOnline) \ + ( (This)->lpVtbl -> get_IsOnline(This,isOnline) ) + +#define IHighDefinitionFaceFrameSource_put_IsOnline(This,isOnline) \ + ( (This)->lpVtbl -> put_IsOnline(This,isOnline) ) + +#define IHighDefinitionFaceFrameSource_get_IsActive(This,isActive) \ + ( (This)->lpVtbl -> get_IsActive(This,isActive) ) + +#define IHighDefinitionFaceFrameSource_get_TrackingId(This,trackingId) \ + ( (This)->lpVtbl -> get_TrackingId(This,trackingId) ) + +#define IHighDefinitionFaceFrameSource_put_TrackingId(This,trackingId) \ + ( (This)->lpVtbl -> put_TrackingId(This,trackingId) ) + +#define IHighDefinitionFaceFrameSource_get_IsTrackingIdValid(This,isTrackingIdValid) \ + ( (This)->lpVtbl -> get_IsTrackingIdValid(This,isTrackingIdValid) ) + +#define IHighDefinitionFaceFrameSource_get_TrackingQuality(This,trackingQuality) \ + ( (This)->lpVtbl -> get_TrackingQuality(This,trackingQuality) ) + +#define IHighDefinitionFaceFrameSource_put_TrackingQuality(This,trackingQuality) \ + ( (This)->lpVtbl -> put_TrackingQuality(This,trackingQuality) ) + +#define IHighDefinitionFaceFrameSource_get_FaceModel(This,faceModel) \ + ( (This)->lpVtbl -> get_FaceModel(This,faceModel) ) + +#define IHighDefinitionFaceFrameSource_put_FaceModel(This,faceModel) \ + ( (This)->lpVtbl -> put_FaceModel(This,faceModel) ) + +#define IHighDefinitionFaceFrameSource_OpenReader(This,reader) \ + ( (This)->lpVtbl -> OpenReader(This,reader) ) + +#define IHighDefinitionFaceFrameSource_OpenModelBuilder(This,enabledAttributes,modelbuilder) \ + ( (This)->lpVtbl -> OpenModelBuilder(This,enabledAttributes,modelbuilder) ) + +#define IHighDefinitionFaceFrameSource_get_KinectSensor(This,sensor) \ + ( (This)->lpVtbl -> get_KinectSensor(This,sensor) ) + +#define IHighDefinitionFaceFrameSource_FeedAndCalculateFrameData(This,body,infraredCapacity,infraredFrameBuffer,colorCapacity,colorFrameBuffer,depthCapacity,depthFrameBuffer) \ + ( (This)->lpVtbl -> FeedAndCalculateFrameData(This,body,infraredCapacity,infraredFrameBuffer,colorCapacity,colorFrameBuffer,depthCapacity,depthFrameBuffer) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IHighDefinitionFaceFrameSource_INTERFACE_DEFINED__ */ + + +#ifndef __IHighDefinitionFaceFrameReader_INTERFACE_DEFINED__ +#define __IHighDefinitionFaceFrameReader_INTERFACE_DEFINED__ + +/* interface IHighDefinitionFaceFrameReader */ +/* [object][local][uuid] */ + + +EXTERN_C const IID IID_IHighDefinitionFaceFrameReader; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("FAB67369-E051-4790-8A1D-1CEDB9DE86CA") + IHighDefinitionFaceFrameReader : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE SubscribeFrameArrived( + /* [annotation][out][retval] */ + _Out_ WAITABLE_HANDLE *waitableHandle) = 0; + + virtual HRESULT STDMETHODCALLTYPE UnsubscribeFrameArrived( + /* [annotation][in] */ + _In_ WAITABLE_HANDLE waitableHandle) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetFrameArrivedEventData( + /* [annotation][in] */ + _In_ WAITABLE_HANDLE waitableHandle, + /* [annotation][out][retval] */ + _Out_ IHighDefinitionFaceFrameArrivedEventArgs **eventData) = 0; + + virtual HRESULT STDMETHODCALLTYPE AcquireLatestFrame( + /* [annotation][out][retval] */ + _COM_Outptr_ IHighDefinitionFaceFrame **faceFrame) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_IsPaused( + /* [annotation][out][retval] */ + _Out_ BOOLEAN *isPaused) = 0; + + virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_IsPaused( + BOOLEAN isPaused) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_HighDefinitionFaceFrameSource( + /* [annotation][out][retval] */ + _COM_Outptr_ IHighDefinitionFaceFrameSource **highDefinitionFaceFrameSource) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IHighDefinitionFaceFrameReaderVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IHighDefinitionFaceFrameReader * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IHighDefinitionFaceFrameReader * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IHighDefinitionFaceFrameReader * This); + + HRESULT ( STDMETHODCALLTYPE *SubscribeFrameArrived )( + IHighDefinitionFaceFrameReader * This, + /* [annotation][out][retval] */ + _Out_ WAITABLE_HANDLE *waitableHandle); + + HRESULT ( STDMETHODCALLTYPE *UnsubscribeFrameArrived )( + IHighDefinitionFaceFrameReader * This, + /* [annotation][in] */ + _In_ WAITABLE_HANDLE waitableHandle); + + HRESULT ( STDMETHODCALLTYPE *GetFrameArrivedEventData )( + IHighDefinitionFaceFrameReader * This, + /* [annotation][in] */ + _In_ WAITABLE_HANDLE waitableHandle, + /* [annotation][out][retval] */ + _Out_ IHighDefinitionFaceFrameArrivedEventArgs **eventData); + + HRESULT ( STDMETHODCALLTYPE *AcquireLatestFrame )( + IHighDefinitionFaceFrameReader * This, + /* [annotation][out][retval] */ + _COM_Outptr_ IHighDefinitionFaceFrame **faceFrame); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_IsPaused )( + IHighDefinitionFaceFrameReader * This, + /* [annotation][out][retval] */ + _Out_ BOOLEAN *isPaused); + + /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_IsPaused )( + IHighDefinitionFaceFrameReader * This, + BOOLEAN isPaused); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_HighDefinitionFaceFrameSource )( + IHighDefinitionFaceFrameReader * This, + /* [annotation][out][retval] */ + _COM_Outptr_ IHighDefinitionFaceFrameSource **highDefinitionFaceFrameSource); + + END_INTERFACE + } IHighDefinitionFaceFrameReaderVtbl; + + interface IHighDefinitionFaceFrameReader + { + CONST_VTBL struct IHighDefinitionFaceFrameReaderVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IHighDefinitionFaceFrameReader_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IHighDefinitionFaceFrameReader_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IHighDefinitionFaceFrameReader_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IHighDefinitionFaceFrameReader_SubscribeFrameArrived(This,waitableHandle) \ + ( (This)->lpVtbl -> SubscribeFrameArrived(This,waitableHandle) ) + +#define IHighDefinitionFaceFrameReader_UnsubscribeFrameArrived(This,waitableHandle) \ + ( (This)->lpVtbl -> UnsubscribeFrameArrived(This,waitableHandle) ) + +#define IHighDefinitionFaceFrameReader_GetFrameArrivedEventData(This,waitableHandle,eventData) \ + ( (This)->lpVtbl -> GetFrameArrivedEventData(This,waitableHandle,eventData) ) + +#define IHighDefinitionFaceFrameReader_AcquireLatestFrame(This,faceFrame) \ + ( (This)->lpVtbl -> AcquireLatestFrame(This,faceFrame) ) + +#define IHighDefinitionFaceFrameReader_get_IsPaused(This,isPaused) \ + ( (This)->lpVtbl -> get_IsPaused(This,isPaused) ) + +#define IHighDefinitionFaceFrameReader_put_IsPaused(This,isPaused) \ + ( (This)->lpVtbl -> put_IsPaused(This,isPaused) ) + +#define IHighDefinitionFaceFrameReader_get_HighDefinitionFaceFrameSource(This,highDefinitionFaceFrameSource) \ + ( (This)->lpVtbl -> get_HighDefinitionFaceFrameSource(This,highDefinitionFaceFrameSource) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IHighDefinitionFaceFrameReader_INTERFACE_DEFINED__ */ + + +#ifndef __IHighDefinitionFaceFrame_INTERFACE_DEFINED__ +#define __IHighDefinitionFaceFrame_INTERFACE_DEFINED__ + +/* interface IHighDefinitionFaceFrame */ +/* [object][local][uuid] */ + + +EXTERN_C const IID IID_IHighDefinitionFaceFrame; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("303A5D6F-1825-41D0-BA14-647FDC7D8A89") + IHighDefinitionFaceFrame : public IUnknown + { + public: + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_RelativeTime( + /* [annotation][out][retval] */ + _Out_ TIMESPAN *timeCounter) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_HighDefinitionFaceFrameSource( + /* [annotation][out][retval] */ + _COM_Outptr_ IHighDefinitionFaceFrameSource **highDefinitionFaceFrameSource) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_BodyFrameReference( + /* [annotation][out][retval] */ + _COM_Outptr_ IBodyFrameReference **bodyFrameReference) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_ColorFrameReference( + /* [annotation][out][retval] */ + _COM_Outptr_ IColorFrameReference **colorFrameReference) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_DepthFrameReference( + /* [annotation][out][retval] */ + _COM_Outptr_ IDepthFrameReference **depthFrameReference) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_InfraredFrameReference( + /* [annotation][out][retval] */ + _COM_Outptr_ IInfraredFrameReference **infraredFrameReference) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_IsTrackingIdValid( + /* [annotation][out][retval] */ + _Out_ BOOLEAN *isTrackingIdValid) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_IsFaceTracked( + /* [annotation][out][retval] */ + _Out_ BOOLEAN *isFaceTracked) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_TrackingId( + /* [annotation][out][retval] */ + _Out_ UINT64 *trackingId) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_FaceModel( + /* [annotation][out][retval] */ + _COM_Outptr_result_maybenull_ IFaceModel **faceModel) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_FaceAlignmentQuality( + /* [annotation][out][retval] */ + _Out_ FaceAlignmentQuality *quality) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetAndRefreshFaceAlignmentResult( + /* [annotation][in] */ + _In_ IFaceAlignment *faceAlignmentResults) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IHighDefinitionFaceFrameVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IHighDefinitionFaceFrame * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IHighDefinitionFaceFrame * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IHighDefinitionFaceFrame * This); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_RelativeTime )( + IHighDefinitionFaceFrame * This, + /* [annotation][out][retval] */ + _Out_ TIMESPAN *timeCounter); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_HighDefinitionFaceFrameSource )( + IHighDefinitionFaceFrame * This, + /* [annotation][out][retval] */ + _COM_Outptr_ IHighDefinitionFaceFrameSource **highDefinitionFaceFrameSource); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_BodyFrameReference )( + IHighDefinitionFaceFrame * This, + /* [annotation][out][retval] */ + _COM_Outptr_ IBodyFrameReference **bodyFrameReference); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_ColorFrameReference )( + IHighDefinitionFaceFrame * This, + /* [annotation][out][retval] */ + _COM_Outptr_ IColorFrameReference **colorFrameReference); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_DepthFrameReference )( + IHighDefinitionFaceFrame * This, + /* [annotation][out][retval] */ + _COM_Outptr_ IDepthFrameReference **depthFrameReference); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_InfraredFrameReference )( + IHighDefinitionFaceFrame * This, + /* [annotation][out][retval] */ + _COM_Outptr_ IInfraredFrameReference **infraredFrameReference); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_IsTrackingIdValid )( + IHighDefinitionFaceFrame * This, + /* [annotation][out][retval] */ + _Out_ BOOLEAN *isTrackingIdValid); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_IsFaceTracked )( + IHighDefinitionFaceFrame * This, + /* [annotation][out][retval] */ + _Out_ BOOLEAN *isFaceTracked); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_TrackingId )( + IHighDefinitionFaceFrame * This, + /* [annotation][out][retval] */ + _Out_ UINT64 *trackingId); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_FaceModel )( + IHighDefinitionFaceFrame * This, + /* [annotation][out][retval] */ + _COM_Outptr_result_maybenull_ IFaceModel **faceModel); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_FaceAlignmentQuality )( + IHighDefinitionFaceFrame * This, + /* [annotation][out][retval] */ + _Out_ FaceAlignmentQuality *quality); + + HRESULT ( STDMETHODCALLTYPE *GetAndRefreshFaceAlignmentResult )( + IHighDefinitionFaceFrame * This, + /* [annotation][in] */ + _In_ IFaceAlignment *faceAlignmentResults); + + END_INTERFACE + } IHighDefinitionFaceFrameVtbl; + + interface IHighDefinitionFaceFrame + { + CONST_VTBL struct IHighDefinitionFaceFrameVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IHighDefinitionFaceFrame_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IHighDefinitionFaceFrame_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IHighDefinitionFaceFrame_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IHighDefinitionFaceFrame_get_RelativeTime(This,timeCounter) \ + ( (This)->lpVtbl -> get_RelativeTime(This,timeCounter) ) + +#define IHighDefinitionFaceFrame_get_HighDefinitionFaceFrameSource(This,highDefinitionFaceFrameSource) \ + ( (This)->lpVtbl -> get_HighDefinitionFaceFrameSource(This,highDefinitionFaceFrameSource) ) + +#define IHighDefinitionFaceFrame_get_BodyFrameReference(This,bodyFrameReference) \ + ( (This)->lpVtbl -> get_BodyFrameReference(This,bodyFrameReference) ) + +#define IHighDefinitionFaceFrame_get_ColorFrameReference(This,colorFrameReference) \ + ( (This)->lpVtbl -> get_ColorFrameReference(This,colorFrameReference) ) + +#define IHighDefinitionFaceFrame_get_DepthFrameReference(This,depthFrameReference) \ + ( (This)->lpVtbl -> get_DepthFrameReference(This,depthFrameReference) ) + +#define IHighDefinitionFaceFrame_get_InfraredFrameReference(This,infraredFrameReference) \ + ( (This)->lpVtbl -> get_InfraredFrameReference(This,infraredFrameReference) ) + +#define IHighDefinitionFaceFrame_get_IsTrackingIdValid(This,isTrackingIdValid) \ + ( (This)->lpVtbl -> get_IsTrackingIdValid(This,isTrackingIdValid) ) + +#define IHighDefinitionFaceFrame_get_IsFaceTracked(This,isFaceTracked) \ + ( (This)->lpVtbl -> get_IsFaceTracked(This,isFaceTracked) ) + +#define IHighDefinitionFaceFrame_get_TrackingId(This,trackingId) \ + ( (This)->lpVtbl -> get_TrackingId(This,trackingId) ) + +#define IHighDefinitionFaceFrame_get_FaceModel(This,faceModel) \ + ( (This)->lpVtbl -> get_FaceModel(This,faceModel) ) + +#define IHighDefinitionFaceFrame_get_FaceAlignmentQuality(This,quality) \ + ( (This)->lpVtbl -> get_FaceAlignmentQuality(This,quality) ) + +#define IHighDefinitionFaceFrame_GetAndRefreshFaceAlignmentResult(This,faceAlignmentResults) \ + ( (This)->lpVtbl -> GetAndRefreshFaceAlignmentResult(This,faceAlignmentResults) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IHighDefinitionFaceFrame_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_Kinect2EFace_0000_0018 */ +/* [local] */ + +HRESULT WINAPI CreateFaceFrameSource(_In_ IKinectSensor* sensor, _In_ const UINT64 initialTrackingId, _In_ const DWORD initialFaceFrameFeatures, _COM_Outptr_ IFaceFrameSource** ppSource); +HRESULT WINAPI CreateHighDefinitionFaceFrameSource(_In_ IKinectSensor* sensor, _COM_Outptr_ IHighDefinitionFaceFrameSource** hdFaceFrameSource); +HRESULT WINAPI CreateFaceAlignment(_COM_Outptr_ IFaceAlignment** ppFaceAlignment); +HRESULT WINAPI CreateFaceModel(float scale, UINT32 capacity, _In_reads_(capacity) float* pDeformations, _COM_Outptr_ IFaceModel** ppFaceModel); +HRESULT WINAPI GetFaceModelVertexCount(_Out_ UINT32* pVertexCount); +HRESULT WINAPI GetFaceModelTriangleCount(_Out_ UINT32* pTriangleCount); +HRESULT WINAPI GetFaceModelTriangles(UINT32 capacity, _Out_writes_all_(capacity) UINT32* triangeVertices); + + +extern RPC_IF_HANDLE __MIDL_itf_Kinect2EFace_0000_0018_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_Kinect2EFace_0000_0018_v0_0_s_ifspec; + +/* Additional Prototypes for ALL interfaces */ + +/* end of Additional Prototypes */ + +#ifdef __cplusplus +} +#endif + +#endif + + diff --git a/SpaceStudioClient/Plugins/NeoKinectUnreal/Source/ThirdParty/Kinect/Inc/Kinect.INPC.h b/SpaceStudioClient/Plugins/NeoKinectUnreal/Source/ThirdParty/Kinect/Inc/Kinect.INPC.h new file mode 100644 index 0000000..5a26175 --- /dev/null +++ b/SpaceStudioClient/Plugins/NeoKinectUnreal/Source/ThirdParty/Kinect/Inc/Kinect.INPC.h @@ -0,0 +1,298 @@ + + +/* this ALWAYS GENERATED file contains the definitions for the interfaces */ + + + /* File created by MIDL compiler version 8.00.0595 */ +/* at Sun Oct 19 12:54:09 2014 + */ +/* Compiler settings for ..\..\idl\Kinect.INPC.idl: + Oicf, W1, Zp8, env=Win64 (32b run), target_arch=AMD64 8.00.0595 + protocol : dce , ms_ext, c_ext, robust + error checks: allocation ref bounds_check enum stub_data + VC __declspec() decoration level: + __declspec(uuid()), __declspec(selectany), __declspec(novtable) + DECLSPEC_UUID(), MIDL_INTERFACE() +*/ +/* @@MIDL_FILE_HEADING( ) */ + +#pragma warning( disable: 4049 ) /* more than 64k source lines */ + + +/* verify that the version is high enough to compile this file*/ +#ifndef __REQUIRED_RPCNDR_H_VERSION__ +#define __REQUIRED_RPCNDR_H_VERSION__ 475 +#endif + +/* verify that the version is high enough to compile this file*/ +#ifndef __REQUIRED_RPCSAL_H_VERSION__ +#define __REQUIRED_RPCSAL_H_VERSION__ 100 +#endif + +#include "rpc.h" +#include "rpcndr.h" + +#ifndef __RPCNDR_H_VERSION__ +#error this stub requires an updated version of +#endif // __RPCNDR_H_VERSION__ + +#ifndef COM_NO_WINDOWS_H +#include "windows.h" +#include "ole2.h" +#endif /*COM_NO_WINDOWS_H*/ + +#ifndef __Kinect2EINPC_h__ +#define __Kinect2EINPC_h__ + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +#pragma once +#endif + +/* Forward Declarations */ + +#ifndef __INotifyPropertyChanged_FWD_DEFINED__ +#define __INotifyPropertyChanged_FWD_DEFINED__ +typedef interface INotifyPropertyChanged INotifyPropertyChanged; + +#endif /* __INotifyPropertyChanged_FWD_DEFINED__ */ + + +#ifndef __IPropertyChangedEventArgs_FWD_DEFINED__ +#define __IPropertyChangedEventArgs_FWD_DEFINED__ +typedef interface IPropertyChangedEventArgs IPropertyChangedEventArgs; + +#endif /* __IPropertyChangedEventArgs_FWD_DEFINED__ */ + + +/* header files for imported files */ +#include "oaidl.h" +#include "ocidl.h" +#include "mmreg.h" + +#ifdef __cplusplus +extern "C"{ +#endif + + +/* interface __MIDL_itf_Kinect2EINPC_0000_0000 */ +/* [local] */ + + +typedef INT_PTR WAITABLE_HANDLE; + +typedef INT64 TIMESPAN; + + + + + +extern RPC_IF_HANDLE __MIDL_itf_Kinect2EINPC_0000_0000_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_Kinect2EINPC_0000_0000_v0_0_s_ifspec; + +#ifndef __INotifyPropertyChanged_INTERFACE_DEFINED__ +#define __INotifyPropertyChanged_INTERFACE_DEFINED__ + +/* interface INotifyPropertyChanged */ +/* [object][local][uuid] */ + + +EXTERN_C const IID IID_INotifyPropertyChanged; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("D27A5C77-32E9-4283-A046-9D693E29E3E7") + INotifyPropertyChanged : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE SubscribePropertyChanged( + /* [annotation][out][retval] */ + _Out_ WAITABLE_HANDLE *waitableHandle) = 0; + + virtual HRESULT STDMETHODCALLTYPE UnsubscribePropertyChanged( + /* [annotation][in] */ + _In_ WAITABLE_HANDLE waitableHandle) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetPropertyChangedEventData( + /* [annotation][in] */ + _In_ WAITABLE_HANDLE waitableHandle, + UINT bufferSize, + /* [annotation][out][retval] */ + _Out_writes_z_(bufferSize) WCHAR *propertyName) = 0; + + }; + + +#else /* C style interface */ + + typedef struct INotifyPropertyChangedVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + INotifyPropertyChanged * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + INotifyPropertyChanged * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + INotifyPropertyChanged * This); + + HRESULT ( STDMETHODCALLTYPE *SubscribePropertyChanged )( + INotifyPropertyChanged * This, + /* [annotation][out][retval] */ + _Out_ WAITABLE_HANDLE *waitableHandle); + + HRESULT ( STDMETHODCALLTYPE *UnsubscribePropertyChanged )( + INotifyPropertyChanged * This, + /* [annotation][in] */ + _In_ WAITABLE_HANDLE waitableHandle); + + HRESULT ( STDMETHODCALLTYPE *GetPropertyChangedEventData )( + INotifyPropertyChanged * This, + /* [annotation][in] */ + _In_ WAITABLE_HANDLE waitableHandle, + UINT bufferSize, + /* [annotation][out][retval] */ + _Out_writes_z_(bufferSize) WCHAR *propertyName); + + END_INTERFACE + } INotifyPropertyChangedVtbl; + + interface INotifyPropertyChanged + { + CONST_VTBL struct INotifyPropertyChangedVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define INotifyPropertyChanged_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define INotifyPropertyChanged_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define INotifyPropertyChanged_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define INotifyPropertyChanged_SubscribePropertyChanged(This,waitableHandle) \ + ( (This)->lpVtbl -> SubscribePropertyChanged(This,waitableHandle) ) + +#define INotifyPropertyChanged_UnsubscribePropertyChanged(This,waitableHandle) \ + ( (This)->lpVtbl -> UnsubscribePropertyChanged(This,waitableHandle) ) + +#define INotifyPropertyChanged_GetPropertyChangedEventData(This,waitableHandle,bufferSize,propertyName) \ + ( (This)->lpVtbl -> GetPropertyChangedEventData(This,waitableHandle,bufferSize,propertyName) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __INotifyPropertyChanged_INTERFACE_DEFINED__ */ + + +#ifndef __IPropertyChangedEventArgs_INTERFACE_DEFINED__ +#define __IPropertyChangedEventArgs_INTERFACE_DEFINED__ + +/* interface IPropertyChangedEventArgs */ +/* [object][local][uuid] */ + + +EXTERN_C const IID IID_IPropertyChangedEventArgs; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("574E9321-9DD9-41C8-BC51-C11F3F38D6B5") + IPropertyChangedEventArgs : public IUnknown + { + public: + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_PropertyName( + UINT bufferSize, + /* [annotation][out][retval] */ + _Out_writes_z_(bufferSize) WCHAR *propertyName) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IPropertyChangedEventArgsVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IPropertyChangedEventArgs * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IPropertyChangedEventArgs * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IPropertyChangedEventArgs * This); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_PropertyName )( + IPropertyChangedEventArgs * This, + UINT bufferSize, + /* [annotation][out][retval] */ + _Out_writes_z_(bufferSize) WCHAR *propertyName); + + END_INTERFACE + } IPropertyChangedEventArgsVtbl; + + interface IPropertyChangedEventArgs + { + CONST_VTBL struct IPropertyChangedEventArgsVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IPropertyChangedEventArgs_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IPropertyChangedEventArgs_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IPropertyChangedEventArgs_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IPropertyChangedEventArgs_get_PropertyName(This,bufferSize,propertyName) \ + ( (This)->lpVtbl -> get_PropertyName(This,bufferSize,propertyName) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IPropertyChangedEventArgs_INTERFACE_DEFINED__ */ + + +/* Additional Prototypes for ALL interfaces */ + +/* end of Additional Prototypes */ + +#ifdef __cplusplus +} +#endif + +#endif + + diff --git a/SpaceStudioClient/Plugins/NeoKinectUnreal/Source/ThirdParty/Kinect/Inc/Kinect.h b/SpaceStudioClient/Plugins/NeoKinectUnreal/Source/ThirdParty/Kinect/Inc/Kinect.h new file mode 100644 index 0000000..80887b5 --- /dev/null +++ b/SpaceStudioClient/Plugins/NeoKinectUnreal/Source/ThirdParty/Kinect/Inc/Kinect.h @@ -0,0 +1,10667 @@ + + +/* this ALWAYS GENERATED file contains the definitions for the interfaces */ + + + /* File created by MIDL compiler version 8.00.0595 */ +/* at Sun Oct 19 12:54:08 2014 + */ +/* Compiler settings for ..\..\idl\Kinect.COM.idl: + Oicf, W1, Zp8, env=Win64 (32b run), target_arch=AMD64 8.00.0595 + protocol : dce , ms_ext, c_ext, robust + error checks: allocation ref bounds_check enum stub_data + VC __declspec() decoration level: + __declspec(uuid()), __declspec(selectany), __declspec(novtable) + DECLSPEC_UUID(), MIDL_INTERFACE() +*/ +/* @@MIDL_FILE_HEADING( ) */ + +#pragma warning( disable: 4049 ) /* more than 64k source lines */ + + +/* verify that the version is high enough to compile this file*/ +#ifndef __REQUIRED_RPCNDR_H_VERSION__ +#define __REQUIRED_RPCNDR_H_VERSION__ 475 +#endif + +/* verify that the version is high enough to compile this file*/ +#ifndef __REQUIRED_RPCSAL_H_VERSION__ +#define __REQUIRED_RPCSAL_H_VERSION__ 100 +#endif + +#include "rpc.h" +#include "rpcndr.h" + +#ifndef __RPCNDR_H_VERSION__ +#error this stub requires an updated version of +#endif // __RPCNDR_H_VERSION__ + +#ifndef COM_NO_WINDOWS_H +#include "windows.h" +#include "ole2.h" +#endif /*COM_NO_WINDOWS_H*/ + +#ifndef __Kinect_h__ +#define __Kinect_h__ + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +#pragma once +#endif + +/* Forward Declarations */ + +#ifndef __IKinectSensor_FWD_DEFINED__ +#define __IKinectSensor_FWD_DEFINED__ +typedef interface IKinectSensor IKinectSensor; + +#endif /* __IKinectSensor_FWD_DEFINED__ */ + + +#ifndef __IIsAvailableChangedEventArgs_FWD_DEFINED__ +#define __IIsAvailableChangedEventArgs_FWD_DEFINED__ +typedef interface IIsAvailableChangedEventArgs IIsAvailableChangedEventArgs; + +#endif /* __IIsAvailableChangedEventArgs_FWD_DEFINED__ */ + + +#ifndef __IFrameDescription_FWD_DEFINED__ +#define __IFrameDescription_FWD_DEFINED__ +typedef interface IFrameDescription IFrameDescription; + +#endif /* __IFrameDescription_FWD_DEFINED__ */ + + +#ifndef __IFrameCapturedEventArgs_FWD_DEFINED__ +#define __IFrameCapturedEventArgs_FWD_DEFINED__ +typedef interface IFrameCapturedEventArgs IFrameCapturedEventArgs; + +#endif /* __IFrameCapturedEventArgs_FWD_DEFINED__ */ + + +#ifndef __IMultiSourceFrameReader_FWD_DEFINED__ +#define __IMultiSourceFrameReader_FWD_DEFINED__ +typedef interface IMultiSourceFrameReader IMultiSourceFrameReader; + +#endif /* __IMultiSourceFrameReader_FWD_DEFINED__ */ + + +#ifndef __IMultiSourceFrameArrivedEventArgs_FWD_DEFINED__ +#define __IMultiSourceFrameArrivedEventArgs_FWD_DEFINED__ +typedef interface IMultiSourceFrameArrivedEventArgs IMultiSourceFrameArrivedEventArgs; + +#endif /* __IMultiSourceFrameArrivedEventArgs_FWD_DEFINED__ */ + + +#ifndef __IMultiSourceFrameReference_FWD_DEFINED__ +#define __IMultiSourceFrameReference_FWD_DEFINED__ +typedef interface IMultiSourceFrameReference IMultiSourceFrameReference; + +#endif /* __IMultiSourceFrameReference_FWD_DEFINED__ */ + + +#ifndef __IMultiSourceFrame_FWD_DEFINED__ +#define __IMultiSourceFrame_FWD_DEFINED__ +typedef interface IMultiSourceFrame IMultiSourceFrame; + +#endif /* __IMultiSourceFrame_FWD_DEFINED__ */ + + +#ifndef __IColorFrameReference_FWD_DEFINED__ +#define __IColorFrameReference_FWD_DEFINED__ +typedef interface IColorFrameReference IColorFrameReference; + +#endif /* __IColorFrameReference_FWD_DEFINED__ */ + + +#ifndef __IColorFrameArrivedEventArgs_FWD_DEFINED__ +#define __IColorFrameArrivedEventArgs_FWD_DEFINED__ +typedef interface IColorFrameArrivedEventArgs IColorFrameArrivedEventArgs; + +#endif /* __IColorFrameArrivedEventArgs_FWD_DEFINED__ */ + + +#ifndef __IColorFrameSource_FWD_DEFINED__ +#define __IColorFrameSource_FWD_DEFINED__ +typedef interface IColorFrameSource IColorFrameSource; + +#endif /* __IColorFrameSource_FWD_DEFINED__ */ + + +#ifndef __IColorFrameReader_FWD_DEFINED__ +#define __IColorFrameReader_FWD_DEFINED__ +typedef interface IColorFrameReader IColorFrameReader; + +#endif /* __IColorFrameReader_FWD_DEFINED__ */ + + +#ifndef __IColorFrame_FWD_DEFINED__ +#define __IColorFrame_FWD_DEFINED__ +typedef interface IColorFrame IColorFrame; + +#endif /* __IColorFrame_FWD_DEFINED__ */ + + +#ifndef __IDepthFrameReference_FWD_DEFINED__ +#define __IDepthFrameReference_FWD_DEFINED__ +typedef interface IDepthFrameReference IDepthFrameReference; + +#endif /* __IDepthFrameReference_FWD_DEFINED__ */ + + +#ifndef __IDepthFrameArrivedEventArgs_FWD_DEFINED__ +#define __IDepthFrameArrivedEventArgs_FWD_DEFINED__ +typedef interface IDepthFrameArrivedEventArgs IDepthFrameArrivedEventArgs; + +#endif /* __IDepthFrameArrivedEventArgs_FWD_DEFINED__ */ + + +#ifndef __IDepthFrameSource_FWD_DEFINED__ +#define __IDepthFrameSource_FWD_DEFINED__ +typedef interface IDepthFrameSource IDepthFrameSource; + +#endif /* __IDepthFrameSource_FWD_DEFINED__ */ + + +#ifndef __IDepthFrameReader_FWD_DEFINED__ +#define __IDepthFrameReader_FWD_DEFINED__ +typedef interface IDepthFrameReader IDepthFrameReader; + +#endif /* __IDepthFrameReader_FWD_DEFINED__ */ + + +#ifndef __IDepthFrame_FWD_DEFINED__ +#define __IDepthFrame_FWD_DEFINED__ +typedef interface IDepthFrame IDepthFrame; + +#endif /* __IDepthFrame_FWD_DEFINED__ */ + + +#ifndef __IBodyFrameReference_FWD_DEFINED__ +#define __IBodyFrameReference_FWD_DEFINED__ +typedef interface IBodyFrameReference IBodyFrameReference; + +#endif /* __IBodyFrameReference_FWD_DEFINED__ */ + + +#ifndef __IBodyFrameArrivedEventArgs_FWD_DEFINED__ +#define __IBodyFrameArrivedEventArgs_FWD_DEFINED__ +typedef interface IBodyFrameArrivedEventArgs IBodyFrameArrivedEventArgs; + +#endif /* __IBodyFrameArrivedEventArgs_FWD_DEFINED__ */ + + +#ifndef __IBodyFrameSource_FWD_DEFINED__ +#define __IBodyFrameSource_FWD_DEFINED__ +typedef interface IBodyFrameSource IBodyFrameSource; + +#endif /* __IBodyFrameSource_FWD_DEFINED__ */ + + +#ifndef __IBodyFrameReader_FWD_DEFINED__ +#define __IBodyFrameReader_FWD_DEFINED__ +typedef interface IBodyFrameReader IBodyFrameReader; + +#endif /* __IBodyFrameReader_FWD_DEFINED__ */ + + +#ifndef __IBodyFrame_FWD_DEFINED__ +#define __IBodyFrame_FWD_DEFINED__ +typedef interface IBodyFrame IBodyFrame; + +#endif /* __IBodyFrame_FWD_DEFINED__ */ + + +#ifndef __IBody_FWD_DEFINED__ +#define __IBody_FWD_DEFINED__ +typedef interface IBody IBody; + +#endif /* __IBody_FWD_DEFINED__ */ + + +#ifndef __IBodyIndexFrameReference_FWD_DEFINED__ +#define __IBodyIndexFrameReference_FWD_DEFINED__ +typedef interface IBodyIndexFrameReference IBodyIndexFrameReference; + +#endif /* __IBodyIndexFrameReference_FWD_DEFINED__ */ + + +#ifndef __IBodyIndexFrameArrivedEventArgs_FWD_DEFINED__ +#define __IBodyIndexFrameArrivedEventArgs_FWD_DEFINED__ +typedef interface IBodyIndexFrameArrivedEventArgs IBodyIndexFrameArrivedEventArgs; + +#endif /* __IBodyIndexFrameArrivedEventArgs_FWD_DEFINED__ */ + + +#ifndef __IBodyIndexFrameSource_FWD_DEFINED__ +#define __IBodyIndexFrameSource_FWD_DEFINED__ +typedef interface IBodyIndexFrameSource IBodyIndexFrameSource; + +#endif /* __IBodyIndexFrameSource_FWD_DEFINED__ */ + + +#ifndef __IBodyIndexFrameReader_FWD_DEFINED__ +#define __IBodyIndexFrameReader_FWD_DEFINED__ +typedef interface IBodyIndexFrameReader IBodyIndexFrameReader; + +#endif /* __IBodyIndexFrameReader_FWD_DEFINED__ */ + + +#ifndef __IBodyIndexFrame_FWD_DEFINED__ +#define __IBodyIndexFrame_FWD_DEFINED__ +typedef interface IBodyIndexFrame IBodyIndexFrame; + +#endif /* __IBodyIndexFrame_FWD_DEFINED__ */ + + +#ifndef __IInfraredFrameReference_FWD_DEFINED__ +#define __IInfraredFrameReference_FWD_DEFINED__ +typedef interface IInfraredFrameReference IInfraredFrameReference; + +#endif /* __IInfraredFrameReference_FWD_DEFINED__ */ + + +#ifndef __IInfraredFrameArrivedEventArgs_FWD_DEFINED__ +#define __IInfraredFrameArrivedEventArgs_FWD_DEFINED__ +typedef interface IInfraredFrameArrivedEventArgs IInfraredFrameArrivedEventArgs; + +#endif /* __IInfraredFrameArrivedEventArgs_FWD_DEFINED__ */ + + +#ifndef __IInfraredFrameSource_FWD_DEFINED__ +#define __IInfraredFrameSource_FWD_DEFINED__ +typedef interface IInfraredFrameSource IInfraredFrameSource; + +#endif /* __IInfraredFrameSource_FWD_DEFINED__ */ + + +#ifndef __IInfraredFrameReader_FWD_DEFINED__ +#define __IInfraredFrameReader_FWD_DEFINED__ +typedef interface IInfraredFrameReader IInfraredFrameReader; + +#endif /* __IInfraredFrameReader_FWD_DEFINED__ */ + + +#ifndef __IInfraredFrame_FWD_DEFINED__ +#define __IInfraredFrame_FWD_DEFINED__ +typedef interface IInfraredFrame IInfraredFrame; + +#endif /* __IInfraredFrame_FWD_DEFINED__ */ + + +#ifndef __ILongExposureInfraredFrameReference_FWD_DEFINED__ +#define __ILongExposureInfraredFrameReference_FWD_DEFINED__ +typedef interface ILongExposureInfraredFrameReference ILongExposureInfraredFrameReference; + +#endif /* __ILongExposureInfraredFrameReference_FWD_DEFINED__ */ + + +#ifndef __ILongExposureInfraredFrameArrivedEventArgs_FWD_DEFINED__ +#define __ILongExposureInfraredFrameArrivedEventArgs_FWD_DEFINED__ +typedef interface ILongExposureInfraredFrameArrivedEventArgs ILongExposureInfraredFrameArrivedEventArgs; + +#endif /* __ILongExposureInfraredFrameArrivedEventArgs_FWD_DEFINED__ */ + + +#ifndef __ILongExposureInfraredFrameSource_FWD_DEFINED__ +#define __ILongExposureInfraredFrameSource_FWD_DEFINED__ +typedef interface ILongExposureInfraredFrameSource ILongExposureInfraredFrameSource; + +#endif /* __ILongExposureInfraredFrameSource_FWD_DEFINED__ */ + + +#ifndef __ILongExposureInfraredFrameReader_FWD_DEFINED__ +#define __ILongExposureInfraredFrameReader_FWD_DEFINED__ +typedef interface ILongExposureInfraredFrameReader ILongExposureInfraredFrameReader; + +#endif /* __ILongExposureInfraredFrameReader_FWD_DEFINED__ */ + + +#ifndef __ILongExposureInfraredFrame_FWD_DEFINED__ +#define __ILongExposureInfraredFrame_FWD_DEFINED__ +typedef interface ILongExposureInfraredFrame ILongExposureInfraredFrame; + +#endif /* __ILongExposureInfraredFrame_FWD_DEFINED__ */ + + +#ifndef __IAudioBeam_FWD_DEFINED__ +#define __IAudioBeam_FWD_DEFINED__ +typedef interface IAudioBeam IAudioBeam; + +#endif /* __IAudioBeam_FWD_DEFINED__ */ + + +#ifndef __IAudioBeamList_FWD_DEFINED__ +#define __IAudioBeamList_FWD_DEFINED__ +typedef interface IAudioBeamList IAudioBeamList; + +#endif /* __IAudioBeamList_FWD_DEFINED__ */ + + +#ifndef __IAudioBeamFrameList_FWD_DEFINED__ +#define __IAudioBeamFrameList_FWD_DEFINED__ +typedef interface IAudioBeamFrameList IAudioBeamFrameList; + +#endif /* __IAudioBeamFrameList_FWD_DEFINED__ */ + + +#ifndef __IAudioBeamFrame_FWD_DEFINED__ +#define __IAudioBeamFrame_FWD_DEFINED__ +typedef interface IAudioBeamFrame IAudioBeamFrame; + +#endif /* __IAudioBeamFrame_FWD_DEFINED__ */ + + +#ifndef __IAudioBeamSubFrame_FWD_DEFINED__ +#define __IAudioBeamSubFrame_FWD_DEFINED__ +typedef interface IAudioBeamSubFrame IAudioBeamSubFrame; + +#endif /* __IAudioBeamSubFrame_FWD_DEFINED__ */ + + +#ifndef __IAudioBeamFrameReference_FWD_DEFINED__ +#define __IAudioBeamFrameReference_FWD_DEFINED__ +typedef interface IAudioBeamFrameReference IAudioBeamFrameReference; + +#endif /* __IAudioBeamFrameReference_FWD_DEFINED__ */ + + +#ifndef __IAudioBodyCorrelation_FWD_DEFINED__ +#define __IAudioBodyCorrelation_FWD_DEFINED__ +typedef interface IAudioBodyCorrelation IAudioBodyCorrelation; + +#endif /* __IAudioBodyCorrelation_FWD_DEFINED__ */ + + +#ifndef __IAudioBeamFrameArrivedEventArgs_FWD_DEFINED__ +#define __IAudioBeamFrameArrivedEventArgs_FWD_DEFINED__ +typedef interface IAudioBeamFrameArrivedEventArgs IAudioBeamFrameArrivedEventArgs; + +#endif /* __IAudioBeamFrameArrivedEventArgs_FWD_DEFINED__ */ + + +#ifndef __IAudioBeamFrameReader_FWD_DEFINED__ +#define __IAudioBeamFrameReader_FWD_DEFINED__ +typedef interface IAudioBeamFrameReader IAudioBeamFrameReader; + +#endif /* __IAudioBeamFrameReader_FWD_DEFINED__ */ + + +#ifndef __IAudioSource_FWD_DEFINED__ +#define __IAudioSource_FWD_DEFINED__ +typedef interface IAudioSource IAudioSource; + +#endif /* __IAudioSource_FWD_DEFINED__ */ + + +#ifndef __ICoordinateMapper_FWD_DEFINED__ +#define __ICoordinateMapper_FWD_DEFINED__ +typedef interface ICoordinateMapper ICoordinateMapper; + +#endif /* __ICoordinateMapper_FWD_DEFINED__ */ + + +#ifndef __ICoordinateMappingChangedEventArgs_FWD_DEFINED__ +#define __ICoordinateMappingChangedEventArgs_FWD_DEFINED__ +typedef interface ICoordinateMappingChangedEventArgs ICoordinateMappingChangedEventArgs; + +#endif /* __ICoordinateMappingChangedEventArgs_FWD_DEFINED__ */ + + +#ifndef __IColorCameraSettings_FWD_DEFINED__ +#define __IColorCameraSettings_FWD_DEFINED__ +typedef interface IColorCameraSettings IColorCameraSettings; + +#endif /* __IColorCameraSettings_FWD_DEFINED__ */ + + +#ifndef __IBodyHandPair_FWD_DEFINED__ +#define __IBodyHandPair_FWD_DEFINED__ +typedef interface IBodyHandPair IBodyHandPair; + +#endif /* __IBodyHandPair_FWD_DEFINED__ */ + + +#ifndef __IKinectCoreWindow_FWD_DEFINED__ +#define __IKinectCoreWindow_FWD_DEFINED__ +typedef interface IKinectCoreWindow IKinectCoreWindow; + +#endif /* __IKinectCoreWindow_FWD_DEFINED__ */ + + +#ifndef __IKinectGestureRecognizer_FWD_DEFINED__ +#define __IKinectGestureRecognizer_FWD_DEFINED__ +typedef interface IKinectGestureRecognizer IKinectGestureRecognizer; + +#endif /* __IKinectGestureRecognizer_FWD_DEFINED__ */ + + +#ifndef __IKinectGestureRecognizerSelectionHandler_FWD_DEFINED__ +#define __IKinectGestureRecognizerSelectionHandler_FWD_DEFINED__ +typedef interface IKinectGestureRecognizerSelectionHandler IKinectGestureRecognizerSelectionHandler; + +#endif /* __IKinectGestureRecognizerSelectionHandler_FWD_DEFINED__ */ + + +#ifndef __IKinectGestureRecognizerManipulationHandler_FWD_DEFINED__ +#define __IKinectGestureRecognizerManipulationHandler_FWD_DEFINED__ +typedef interface IKinectGestureRecognizerManipulationHandler IKinectGestureRecognizerManipulationHandler; + +#endif /* __IKinectGestureRecognizerManipulationHandler_FWD_DEFINED__ */ + + +#ifndef __IKinectHoldingEventArgs_FWD_DEFINED__ +#define __IKinectHoldingEventArgs_FWD_DEFINED__ +typedef interface IKinectHoldingEventArgs IKinectHoldingEventArgs; + +#endif /* __IKinectHoldingEventArgs_FWD_DEFINED__ */ + + +#ifndef __IKinectManipulationCompletedEventArgs_FWD_DEFINED__ +#define __IKinectManipulationCompletedEventArgs_FWD_DEFINED__ +typedef interface IKinectManipulationCompletedEventArgs IKinectManipulationCompletedEventArgs; + +#endif /* __IKinectManipulationCompletedEventArgs_FWD_DEFINED__ */ + + +#ifndef __IKinectManipulationInertiaStartingEventArgs_FWD_DEFINED__ +#define __IKinectManipulationInertiaStartingEventArgs_FWD_DEFINED__ +typedef interface IKinectManipulationInertiaStartingEventArgs IKinectManipulationInertiaStartingEventArgs; + +#endif /* __IKinectManipulationInertiaStartingEventArgs_FWD_DEFINED__ */ + + +#ifndef __IKinectManipulationStartedEventArgs_FWD_DEFINED__ +#define __IKinectManipulationStartedEventArgs_FWD_DEFINED__ +typedef interface IKinectManipulationStartedEventArgs IKinectManipulationStartedEventArgs; + +#endif /* __IKinectManipulationStartedEventArgs_FWD_DEFINED__ */ + + +#ifndef __IKinectManipulationUpdatedEventArgs_FWD_DEFINED__ +#define __IKinectManipulationUpdatedEventArgs_FWD_DEFINED__ +typedef interface IKinectManipulationUpdatedEventArgs IKinectManipulationUpdatedEventArgs; + +#endif /* __IKinectManipulationUpdatedEventArgs_FWD_DEFINED__ */ + + +#ifndef __IKinectPointerDevice_FWD_DEFINED__ +#define __IKinectPointerDevice_FWD_DEFINED__ +typedef interface IKinectPointerDevice IKinectPointerDevice; + +#endif /* __IKinectPointerDevice_FWD_DEFINED__ */ + + +#ifndef __IKinectPointerEventArgs_FWD_DEFINED__ +#define __IKinectPointerEventArgs_FWD_DEFINED__ +typedef interface IKinectPointerEventArgs IKinectPointerEventArgs; + +#endif /* __IKinectPointerEventArgs_FWD_DEFINED__ */ + + +#ifndef __IKinectPointerPoint_FWD_DEFINED__ +#define __IKinectPointerPoint_FWD_DEFINED__ +typedef interface IKinectPointerPoint IKinectPointerPoint; + +#endif /* __IKinectPointerPoint_FWD_DEFINED__ */ + + +#ifndef __IKinectPointerPointProperties_FWD_DEFINED__ +#define __IKinectPointerPointProperties_FWD_DEFINED__ +typedef interface IKinectPointerPointProperties IKinectPointerPointProperties; + +#endif /* __IKinectPointerPointProperties_FWD_DEFINED__ */ + + +#ifndef __IKinectPressingCompletedEventArgs_FWD_DEFINED__ +#define __IKinectPressingCompletedEventArgs_FWD_DEFINED__ +typedef interface IKinectPressingCompletedEventArgs IKinectPressingCompletedEventArgs; + +#endif /* __IKinectPressingCompletedEventArgs_FWD_DEFINED__ */ + + +#ifndef __IKinectPressingStartedEventArgs_FWD_DEFINED__ +#define __IKinectPressingStartedEventArgs_FWD_DEFINED__ +typedef interface IKinectPressingStartedEventArgs IKinectPressingStartedEventArgs; + +#endif /* __IKinectPressingStartedEventArgs_FWD_DEFINED__ */ + + +#ifndef __IKinectPressingUpdatedEventArgs_FWD_DEFINED__ +#define __IKinectPressingUpdatedEventArgs_FWD_DEFINED__ +typedef interface IKinectPressingUpdatedEventArgs IKinectPressingUpdatedEventArgs; + +#endif /* __IKinectPressingUpdatedEventArgs_FWD_DEFINED__ */ + + +#ifndef __IKinectTappedEventArgs_FWD_DEFINED__ +#define __IKinectTappedEventArgs_FWD_DEFINED__ +typedef interface IKinectTappedEventArgs IKinectTappedEventArgs; + +#endif /* __IKinectTappedEventArgs_FWD_DEFINED__ */ + + +/* header files for imported files */ +#include "oaidl.h" +#include "ocidl.h" +#include "mmreg.h" +#include "Kinect.INPC.h" + +#ifdef __cplusplus +extern "C"{ +#endif + + +/* interface __MIDL_itf_Kinect2ECOM_0000_0000 */ +/* [local] */ + + +typedef INT_PTR WAITABLE_HANDLE; + +typedef INT64 TIMESPAN; + +#ifndef _KinectCapabilities_ +#define _KinectCapabilities_ +typedef enum _KinectCapabilities KinectCapabilities; + + +enum _KinectCapabilities + { + KinectCapabilities_None = 0, + KinectCapabilities_Vision = 0x1, + KinectCapabilities_Audio = 0x2, + KinectCapabilities_Face = 0x4, + KinectCapabilities_Expressions = 0x8, + KinectCapabilities_Gamechat = 0x10 + } ; +#endif // _KinectCapabilities_ +#ifndef _FrameSourceTypes_ +#define _FrameSourceTypes_ +typedef enum _FrameSourceTypes FrameSourceTypes; + + +enum _FrameSourceTypes + { + FrameSourceTypes_None = 0, + FrameSourceTypes_Color = 0x1, + FrameSourceTypes_Infrared = 0x2, + FrameSourceTypes_LongExposureInfrared = 0x4, + FrameSourceTypes_Depth = 0x8, + FrameSourceTypes_BodyIndex = 0x10, + FrameSourceTypes_Body = 0x20, + FrameSourceTypes_Audio = 0x40 + } ; +#endif // _FrameSourceTypes_ +#ifndef _ColorImageFormat_ +#define _ColorImageFormat_ +typedef enum _ColorImageFormat ColorImageFormat; + + +enum _ColorImageFormat + { + ColorImageFormat_None = 0, + ColorImageFormat_Rgba = 1, + ColorImageFormat_Yuv = 2, + ColorImageFormat_Bgra = 3, + ColorImageFormat_Bayer = 4, + ColorImageFormat_Yuy2 = 5 + } ; +#endif // _ColorImageFormat_ +#ifndef _HandState_ +#define _HandState_ +typedef enum _HandState HandState; + + +enum _HandState + { + HandState_Unknown = 0, + HandState_NotTracked = 1, + HandState_Open = 2, + HandState_Closed = 3, + HandState_Lasso = 4 + } ; +#endif // _HandState_ +#ifndef _Expression_ +#define _Expression_ +typedef enum _Expression Expression; + + +enum _Expression + { + Expression_Neutral = 0, + Expression_Happy = 1, + Expression_Count = ( Expression_Happy + 1 ) + } ; +#endif // _Expression_ +#ifndef _DetectionResult_ +#define _DetectionResult_ +typedef enum _DetectionResult DetectionResult; + + +enum _DetectionResult + { + DetectionResult_Unknown = 0, + DetectionResult_No = 1, + DetectionResult_Maybe = 2, + DetectionResult_Yes = 3 + } ; +#endif // _DetectionResult_ +#ifndef _TrackingConfidence_ +#define _TrackingConfidence_ +typedef enum _TrackingConfidence TrackingConfidence; + + +enum _TrackingConfidence + { + TrackingConfidence_Low = 0, + TrackingConfidence_High = 1 + } ; +#endif // _TrackingConfidence_ +#ifndef _Activity_ +#define _Activity_ +typedef enum _Activity Activity; + + +enum _Activity + { + Activity_EyeLeftClosed = 0, + Activity_EyeRightClosed = 1, + Activity_MouthOpen = 2, + Activity_MouthMoved = 3, + Activity_LookingAway = 4, + Activity_Count = ( Activity_LookingAway + 1 ) + } ; +#endif // _Activity_ +#ifndef _Appearance_ +#define _Appearance_ +typedef enum _Appearance Appearance; + + +enum _Appearance + { + Appearance_WearingGlasses = 0, + Appearance_Count = ( Appearance_WearingGlasses + 1 ) + } ; +#endif // _Appearance_ +#ifndef _JointType_ +#define _JointType_ +typedef enum _JointType JointType; + + +enum _JointType + { + JointType_SpineBase = 0, + JointType_SpineMid = 1, + JointType_Neck = 2, + JointType_Head = 3, + JointType_ShoulderLeft = 4, + JointType_ElbowLeft = 5, + JointType_WristLeft = 6, + JointType_HandLeft = 7, + JointType_ShoulderRight = 8, + JointType_ElbowRight = 9, + JointType_WristRight = 10, + JointType_HandRight = 11, + JointType_HipLeft = 12, + JointType_KneeLeft = 13, + JointType_AnkleLeft = 14, + JointType_FootLeft = 15, + JointType_HipRight = 16, + JointType_KneeRight = 17, + JointType_AnkleRight = 18, + JointType_FootRight = 19, + JointType_SpineShoulder = 20, + JointType_HandTipLeft = 21, + JointType_ThumbLeft = 22, + JointType_HandTipRight = 23, + JointType_ThumbRight = 24, + JointType_Count = ( JointType_ThumbRight + 1 ) + } ; +#endif // _JointType_ +#ifndef _TrackingState_ +#define _TrackingState_ +typedef enum _TrackingState TrackingState; + + +enum _TrackingState + { + TrackingState_NotTracked = 0, + TrackingState_Inferred = 1, + TrackingState_Tracked = 2 + } ; +#endif // _TrackingState_ +#ifndef _FrameEdges_ +#define _FrameEdges_ +typedef enum _FrameEdges FrameEdges; + + +enum _FrameEdges + { + FrameEdge_None = 0, + FrameEdge_Right = 0x1, + FrameEdge_Left = 0x2, + FrameEdge_Top = 0x4, + FrameEdge_Bottom = 0x8 + } ; +#endif // _FrameEdges_ +#ifndef _FrameCapturedStatus_ +#define _FrameCapturedStatus_ +typedef enum _FrameCapturedStatus FrameCapturedStatus; + + +enum _FrameCapturedStatus + { + FrameCapturedStatus_Unknown = 0, + FrameCapturedStatus_Queued = 1, + FrameCapturedStatus_Dropped = 2 + } ; +#endif // _FrameCapturedStatus_ +#ifndef _AudioBeamMode_ +#define _AudioBeamMode_ +typedef enum _AudioBeamMode AudioBeamMode; + + +enum _AudioBeamMode + { + AudioBeamMode_Automatic = 0, + AudioBeamMode_Manual = 1 + } ; +#endif // _AudioBeamMode_ +#ifndef _KinectAudioCalibrationState_ +#define _KinectAudioCalibrationState_ +typedef enum _KinectAudioCalibrationState KinectAudioCalibrationState; + + +enum _KinectAudioCalibrationState + { + KinectAudioCalibrationState_Unknown = 0, + KinectAudioCalibrationState_CalibrationRequired = 1, + KinectAudioCalibrationState_Calibrated = 2 + } ; +#endif // _KinectAudioCalibrationState_ +#ifndef _Vector4_ +#define _Vector4_ +typedef struct _Vector4 + { + float x; + float y; + float z; + float w; + } Vector4; + +#endif // _Vector4_ +#ifndef _PointF_ +#define _PointF_ +typedef struct _PointF + { + float X; + float Y; + } PointF; + +#endif // _PointF_ +#ifndef _RectF_ +#define _RectF_ +typedef struct _RectF + { + float X; + float Y; + float Width; + float Height; + } RectF; + +#endif // _RectF_ +#ifndef _ColorSpacePoint_ +#define _ColorSpacePoint_ +typedef struct _ColorSpacePoint + { + float X; + float Y; + } ColorSpacePoint; + +#endif // _ColorSpacePoint_ +#ifndef _DepthSpacePoint_ +#define _DepthSpacePoint_ +typedef struct _DepthSpacePoint + { + float X; + float Y; + } DepthSpacePoint; + +#endif // _DepthSpacePoint_ +#ifndef _CameraSpacePoint_ +#define _CameraSpacePoint_ +typedef struct _CameraSpacePoint + { + float X; + float Y; + float Z; + } CameraSpacePoint; + +#endif // _CameraSpacePoint_ +#ifndef _Joint_ +#define _Joint_ +typedef struct _Joint + { + JointType JointType; + CameraSpacePoint Position; + TrackingState TrackingState; + } Joint; + +#endif // _Joint_ +#ifndef _JointOrientation_ +#define _JointOrientation_ +typedef struct _JointOrientation + { + JointType JointType; + Vector4 Orientation; + } JointOrientation; + +#endif // _JointOrientation_ +#ifndef _CameraIntrinsics_ +#define _CameraIntrinsics_ +typedef struct _CameraIntrinsics + { + float FocalLengthX; + float FocalLengthY; + float PrincipalPointX; + float PrincipalPointY; + float RadialDistortionSecondOrder; + float RadialDistortionFourthOrder; + float RadialDistortionSixthOrder; + } CameraIntrinsics; + +#endif // _CameraIntrinsics_ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +extern RPC_IF_HANDLE __MIDL_itf_Kinect2ECOM_0000_0000_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_Kinect2ECOM_0000_0000_v0_0_s_ifspec; + +#ifndef __IKinectSensor_INTERFACE_DEFINED__ +#define __IKinectSensor_INTERFACE_DEFINED__ + +/* interface IKinectSensor */ +/* [object][local][uuid] */ + + +EXTERN_C const IID IID_IKinectSensor; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("3C6EBA94-0DE1-4360-B6D4-653A10794C8B") + IKinectSensor : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE SubscribeIsAvailableChanged( + /* [annotation][out][retval] */ + _Out_ WAITABLE_HANDLE *waitableHandle) = 0; + + virtual HRESULT STDMETHODCALLTYPE UnsubscribeIsAvailableChanged( + /* [annotation][in] */ + _In_ WAITABLE_HANDLE waitableHandle) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetIsAvailableChangedEventData( + /* [annotation][in] */ + _In_ WAITABLE_HANDLE waitableHandle, + /* [annotation][out][retval] */ + _Out_ IIsAvailableChangedEventArgs **eventData) = 0; + + virtual HRESULT STDMETHODCALLTYPE Open( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE Close( void) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_IsOpen( + /* [annotation][out][retval] */ + _Out_ BOOLEAN *isOpen) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_IsAvailable( + /* [annotation][out][retval] */ + _Out_ BOOLEAN *isAvailable) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_ColorFrameSource( + /* [annotation][out][retval] */ + _COM_Outptr_ IColorFrameSource **colorFrameSource) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_DepthFrameSource( + /* [annotation][out][retval] */ + _COM_Outptr_ IDepthFrameSource **depthFrameSource) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_BodyFrameSource( + /* [annotation][out][retval] */ + _COM_Outptr_ IBodyFrameSource **bodyFrameSource) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_BodyIndexFrameSource( + /* [annotation][out][retval] */ + _COM_Outptr_ IBodyIndexFrameSource **bodyIndexFrameSource) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_InfraredFrameSource( + /* [annotation][out][retval] */ + _COM_Outptr_ IInfraredFrameSource **infraredFrameSource) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_LongExposureInfraredFrameSource( + /* [annotation][out][retval] */ + _COM_Outptr_ ILongExposureInfraredFrameSource **longExposureInfraredFrameSource) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_AudioSource( + /* [annotation][out][retval] */ + _COM_Outptr_ IAudioSource **audioSource) = 0; + + virtual HRESULT STDMETHODCALLTYPE OpenMultiSourceFrameReader( + DWORD enabledFrameSourceTypes, + /* [annotation][out][retval] */ + _COM_Outptr_ IMultiSourceFrameReader **multiSourceFrameReader) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_CoordinateMapper( + /* [annotation][out][retval] */ + _COM_Outptr_ ICoordinateMapper **coordinateMapper) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_UniqueKinectId( + UINT bufferSize, + /* [annotation][out][retval] */ + _Out_writes_z_(bufferSize) WCHAR *uniqueKinectId) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_KinectCapabilities( + /* [annotation][out][retval] */ + _Out_ DWORD *capabilities) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IKinectSensorVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IKinectSensor * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IKinectSensor * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IKinectSensor * This); + + HRESULT ( STDMETHODCALLTYPE *SubscribeIsAvailableChanged )( + IKinectSensor * This, + /* [annotation][out][retval] */ + _Out_ WAITABLE_HANDLE *waitableHandle); + + HRESULT ( STDMETHODCALLTYPE *UnsubscribeIsAvailableChanged )( + IKinectSensor * This, + /* [annotation][in] */ + _In_ WAITABLE_HANDLE waitableHandle); + + HRESULT ( STDMETHODCALLTYPE *GetIsAvailableChangedEventData )( + IKinectSensor * This, + /* [annotation][in] */ + _In_ WAITABLE_HANDLE waitableHandle, + /* [annotation][out][retval] */ + _Out_ IIsAvailableChangedEventArgs **eventData); + + HRESULT ( STDMETHODCALLTYPE *Open )( + IKinectSensor * This); + + HRESULT ( STDMETHODCALLTYPE *Close )( + IKinectSensor * This); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_IsOpen )( + IKinectSensor * This, + /* [annotation][out][retval] */ + _Out_ BOOLEAN *isOpen); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_IsAvailable )( + IKinectSensor * This, + /* [annotation][out][retval] */ + _Out_ BOOLEAN *isAvailable); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_ColorFrameSource )( + IKinectSensor * This, + /* [annotation][out][retval] */ + _COM_Outptr_ IColorFrameSource **colorFrameSource); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_DepthFrameSource )( + IKinectSensor * This, + /* [annotation][out][retval] */ + _COM_Outptr_ IDepthFrameSource **depthFrameSource); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_BodyFrameSource )( + IKinectSensor * This, + /* [annotation][out][retval] */ + _COM_Outptr_ IBodyFrameSource **bodyFrameSource); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_BodyIndexFrameSource )( + IKinectSensor * This, + /* [annotation][out][retval] */ + _COM_Outptr_ IBodyIndexFrameSource **bodyIndexFrameSource); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_InfraredFrameSource )( + IKinectSensor * This, + /* [annotation][out][retval] */ + _COM_Outptr_ IInfraredFrameSource **infraredFrameSource); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_LongExposureInfraredFrameSource )( + IKinectSensor * This, + /* [annotation][out][retval] */ + _COM_Outptr_ ILongExposureInfraredFrameSource **longExposureInfraredFrameSource); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_AudioSource )( + IKinectSensor * This, + /* [annotation][out][retval] */ + _COM_Outptr_ IAudioSource **audioSource); + + HRESULT ( STDMETHODCALLTYPE *OpenMultiSourceFrameReader )( + IKinectSensor * This, + DWORD enabledFrameSourceTypes, + /* [annotation][out][retval] */ + _COM_Outptr_ IMultiSourceFrameReader **multiSourceFrameReader); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_CoordinateMapper )( + IKinectSensor * This, + /* [annotation][out][retval] */ + _COM_Outptr_ ICoordinateMapper **coordinateMapper); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_UniqueKinectId )( + IKinectSensor * This, + UINT bufferSize, + /* [annotation][out][retval] */ + _Out_writes_z_(bufferSize) WCHAR *uniqueKinectId); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_KinectCapabilities )( + IKinectSensor * This, + /* [annotation][out][retval] */ + _Out_ DWORD *capabilities); + + END_INTERFACE + } IKinectSensorVtbl; + + interface IKinectSensor + { + CONST_VTBL struct IKinectSensorVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IKinectSensor_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IKinectSensor_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IKinectSensor_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IKinectSensor_SubscribeIsAvailableChanged(This,waitableHandle) \ + ( (This)->lpVtbl -> SubscribeIsAvailableChanged(This,waitableHandle) ) + +#define IKinectSensor_UnsubscribeIsAvailableChanged(This,waitableHandle) \ + ( (This)->lpVtbl -> UnsubscribeIsAvailableChanged(This,waitableHandle) ) + +#define IKinectSensor_GetIsAvailableChangedEventData(This,waitableHandle,eventData) \ + ( (This)->lpVtbl -> GetIsAvailableChangedEventData(This,waitableHandle,eventData) ) + +#define IKinectSensor_Open(This) \ + ( (This)->lpVtbl -> Open(This) ) + +#define IKinectSensor_Close(This) \ + ( (This)->lpVtbl -> Close(This) ) + +#define IKinectSensor_get_IsOpen(This,isOpen) \ + ( (This)->lpVtbl -> get_IsOpen(This,isOpen) ) + +#define IKinectSensor_get_IsAvailable(This,isAvailable) \ + ( (This)->lpVtbl -> get_IsAvailable(This,isAvailable) ) + +#define IKinectSensor_get_ColorFrameSource(This,colorFrameSource) \ + ( (This)->lpVtbl -> get_ColorFrameSource(This,colorFrameSource) ) + +#define IKinectSensor_get_DepthFrameSource(This,depthFrameSource) \ + ( (This)->lpVtbl -> get_DepthFrameSource(This,depthFrameSource) ) + +#define IKinectSensor_get_BodyFrameSource(This,bodyFrameSource) \ + ( (This)->lpVtbl -> get_BodyFrameSource(This,bodyFrameSource) ) + +#define IKinectSensor_get_BodyIndexFrameSource(This,bodyIndexFrameSource) \ + ( (This)->lpVtbl -> get_BodyIndexFrameSource(This,bodyIndexFrameSource) ) + +#define IKinectSensor_get_InfraredFrameSource(This,infraredFrameSource) \ + ( (This)->lpVtbl -> get_InfraredFrameSource(This,infraredFrameSource) ) + +#define IKinectSensor_get_LongExposureInfraredFrameSource(This,longExposureInfraredFrameSource) \ + ( (This)->lpVtbl -> get_LongExposureInfraredFrameSource(This,longExposureInfraredFrameSource) ) + +#define IKinectSensor_get_AudioSource(This,audioSource) \ + ( (This)->lpVtbl -> get_AudioSource(This,audioSource) ) + +#define IKinectSensor_OpenMultiSourceFrameReader(This,enabledFrameSourceTypes,multiSourceFrameReader) \ + ( (This)->lpVtbl -> OpenMultiSourceFrameReader(This,enabledFrameSourceTypes,multiSourceFrameReader) ) + +#define IKinectSensor_get_CoordinateMapper(This,coordinateMapper) \ + ( (This)->lpVtbl -> get_CoordinateMapper(This,coordinateMapper) ) + +#define IKinectSensor_get_UniqueKinectId(This,bufferSize,uniqueKinectId) \ + ( (This)->lpVtbl -> get_UniqueKinectId(This,bufferSize,uniqueKinectId) ) + +#define IKinectSensor_get_KinectCapabilities(This,capabilities) \ + ( (This)->lpVtbl -> get_KinectCapabilities(This,capabilities) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IKinectSensor_INTERFACE_DEFINED__ */ + + +#ifndef __IIsAvailableChangedEventArgs_INTERFACE_DEFINED__ +#define __IIsAvailableChangedEventArgs_INTERFACE_DEFINED__ + +/* interface IIsAvailableChangedEventArgs */ +/* [object][local][uuid] */ + + +EXTERN_C const IID IID_IIsAvailableChangedEventArgs; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("3A6DD52E-967F-4982-B3D9-74B9E1A044C9") + IIsAvailableChangedEventArgs : public IUnknown + { + public: + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_IsAvailable( + /* [annotation][out][retval] */ + _Out_ BOOLEAN *isAvailable) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IIsAvailableChangedEventArgsVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IIsAvailableChangedEventArgs * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IIsAvailableChangedEventArgs * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IIsAvailableChangedEventArgs * This); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_IsAvailable )( + IIsAvailableChangedEventArgs * This, + /* [annotation][out][retval] */ + _Out_ BOOLEAN *isAvailable); + + END_INTERFACE + } IIsAvailableChangedEventArgsVtbl; + + interface IIsAvailableChangedEventArgs + { + CONST_VTBL struct IIsAvailableChangedEventArgsVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IIsAvailableChangedEventArgs_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IIsAvailableChangedEventArgs_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IIsAvailableChangedEventArgs_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IIsAvailableChangedEventArgs_get_IsAvailable(This,isAvailable) \ + ( (This)->lpVtbl -> get_IsAvailable(This,isAvailable) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IIsAvailableChangedEventArgs_INTERFACE_DEFINED__ */ + + +#ifndef __IFrameDescription_INTERFACE_DEFINED__ +#define __IFrameDescription_INTERFACE_DEFINED__ + +/* interface IFrameDescription */ +/* [object][local][uuid] */ + + +EXTERN_C const IID IID_IFrameDescription; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("21F6EFB7-EB6D-48F4-9C08-181A87BF0C98") + IFrameDescription : public IUnknown + { + public: + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Width( + /* [annotation][out][retval] */ + _Out_range_(512, 1920) int *width) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Height( + /* [annotation][out][retval] */ + _Out_range_(424, 1080) int *height) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_HorizontalFieldOfView( + /* [annotation][out][retval] */ + _Out_ float *horizontalFieldOfView) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_VerticalFieldOfView( + /* [annotation][out][retval] */ + _Out_ float *verticalFieldOfView) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_DiagonalFieldOfView( + /* [annotation][out][retval] */ + _Out_ float *diagonalFieldOfView) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_LengthInPixels( + /* [annotation][out][retval] */ + _Out_range_(512*424, 1920*1080) unsigned int *lengthInPixels) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_BytesPerPixel( + /* [annotation][out][retval] */ + _Out_range_(1, 4) unsigned int *bytesPerPixel) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IFrameDescriptionVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IFrameDescription * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IFrameDescription * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IFrameDescription * This); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Width )( + IFrameDescription * This, + /* [annotation][out][retval] */ + _Out_range_(512, 1920) int *width); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Height )( + IFrameDescription * This, + /* [annotation][out][retval] */ + _Out_range_(424, 1080) int *height); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_HorizontalFieldOfView )( + IFrameDescription * This, + /* [annotation][out][retval] */ + _Out_ float *horizontalFieldOfView); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_VerticalFieldOfView )( + IFrameDescription * This, + /* [annotation][out][retval] */ + _Out_ float *verticalFieldOfView); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_DiagonalFieldOfView )( + IFrameDescription * This, + /* [annotation][out][retval] */ + _Out_ float *diagonalFieldOfView); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_LengthInPixels )( + IFrameDescription * This, + /* [annotation][out][retval] */ + _Out_range_(512*424, 1920*1080) unsigned int *lengthInPixels); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_BytesPerPixel )( + IFrameDescription * This, + /* [annotation][out][retval] */ + _Out_range_(1, 4) unsigned int *bytesPerPixel); + + END_INTERFACE + } IFrameDescriptionVtbl; + + interface IFrameDescription + { + CONST_VTBL struct IFrameDescriptionVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IFrameDescription_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IFrameDescription_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IFrameDescription_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IFrameDescription_get_Width(This,width) \ + ( (This)->lpVtbl -> get_Width(This,width) ) + +#define IFrameDescription_get_Height(This,height) \ + ( (This)->lpVtbl -> get_Height(This,height) ) + +#define IFrameDescription_get_HorizontalFieldOfView(This,horizontalFieldOfView) \ + ( (This)->lpVtbl -> get_HorizontalFieldOfView(This,horizontalFieldOfView) ) + +#define IFrameDescription_get_VerticalFieldOfView(This,verticalFieldOfView) \ + ( (This)->lpVtbl -> get_VerticalFieldOfView(This,verticalFieldOfView) ) + +#define IFrameDescription_get_DiagonalFieldOfView(This,diagonalFieldOfView) \ + ( (This)->lpVtbl -> get_DiagonalFieldOfView(This,diagonalFieldOfView) ) + +#define IFrameDescription_get_LengthInPixels(This,lengthInPixels) \ + ( (This)->lpVtbl -> get_LengthInPixels(This,lengthInPixels) ) + +#define IFrameDescription_get_BytesPerPixel(This,bytesPerPixel) \ + ( (This)->lpVtbl -> get_BytesPerPixel(This,bytesPerPixel) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IFrameDescription_INTERFACE_DEFINED__ */ + + +#ifndef __IFrameCapturedEventArgs_INTERFACE_DEFINED__ +#define __IFrameCapturedEventArgs_INTERFACE_DEFINED__ + +/* interface IFrameCapturedEventArgs */ +/* [object][local][uuid] */ + + +EXTERN_C const IID IID_IFrameCapturedEventArgs; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("24CBAB8E-DF1A-4FA8-827E-C1B27A44A3A1") + IFrameCapturedEventArgs : public IUnknown + { + public: + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_FrameType( + /* [annotation][out][retval] */ + _Out_ FrameSourceTypes *frameType) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_FrameStatus( + /* [annotation][out][retval] */ + _Out_ FrameCapturedStatus *frameStatus) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_RelativeTime( + /* [annotation][out][retval] */ + _Out_ TIMESPAN *relativeTime) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IFrameCapturedEventArgsVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IFrameCapturedEventArgs * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IFrameCapturedEventArgs * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IFrameCapturedEventArgs * This); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_FrameType )( + IFrameCapturedEventArgs * This, + /* [annotation][out][retval] */ + _Out_ FrameSourceTypes *frameType); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_FrameStatus )( + IFrameCapturedEventArgs * This, + /* [annotation][out][retval] */ + _Out_ FrameCapturedStatus *frameStatus); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_RelativeTime )( + IFrameCapturedEventArgs * This, + /* [annotation][out][retval] */ + _Out_ TIMESPAN *relativeTime); + + END_INTERFACE + } IFrameCapturedEventArgsVtbl; + + interface IFrameCapturedEventArgs + { + CONST_VTBL struct IFrameCapturedEventArgsVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IFrameCapturedEventArgs_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IFrameCapturedEventArgs_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IFrameCapturedEventArgs_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IFrameCapturedEventArgs_get_FrameType(This,frameType) \ + ( (This)->lpVtbl -> get_FrameType(This,frameType) ) + +#define IFrameCapturedEventArgs_get_FrameStatus(This,frameStatus) \ + ( (This)->lpVtbl -> get_FrameStatus(This,frameStatus) ) + +#define IFrameCapturedEventArgs_get_RelativeTime(This,relativeTime) \ + ( (This)->lpVtbl -> get_RelativeTime(This,relativeTime) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IFrameCapturedEventArgs_INTERFACE_DEFINED__ */ + + +#ifndef __IMultiSourceFrameReader_INTERFACE_DEFINED__ +#define __IMultiSourceFrameReader_INTERFACE_DEFINED__ + +/* interface IMultiSourceFrameReader */ +/* [object][local][uuid] */ + + +EXTERN_C const IID IID_IMultiSourceFrameReader; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("C0F6432B-9FFE-4AB3-A683-F37C72BBB158") + IMultiSourceFrameReader : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE SubscribeMultiSourceFrameArrived( + /* [annotation][out][retval] */ + _Out_ WAITABLE_HANDLE *waitableHandle) = 0; + + virtual HRESULT STDMETHODCALLTYPE UnsubscribeMultiSourceFrameArrived( + /* [annotation][in] */ + _In_ WAITABLE_HANDLE waitableHandle) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetMultiSourceFrameArrivedEventData( + /* [annotation][in] */ + _In_ WAITABLE_HANDLE waitableHandle, + /* [annotation][out][retval] */ + _Out_ IMultiSourceFrameArrivedEventArgs **eventData) = 0; + + virtual HRESULT STDMETHODCALLTYPE AcquireLatestFrame( + /* [annotation][out][retval] */ + _COM_Outptr_ IMultiSourceFrame **multiSourceFrame) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_FrameSourceTypes( + /* [annotation][out][retval] */ + _Out_ DWORD *enabledFrameSourceTypes) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_IsPaused( + /* [annotation][out][retval] */ + _Out_ BOOLEAN *isPaused) = 0; + + virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_IsPaused( + BOOLEAN isPaused) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_KinectSensor( + /* [annotation][out][retval] */ + _COM_Outptr_ IKinectSensor **sensor) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IMultiSourceFrameReaderVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IMultiSourceFrameReader * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IMultiSourceFrameReader * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IMultiSourceFrameReader * This); + + HRESULT ( STDMETHODCALLTYPE *SubscribeMultiSourceFrameArrived )( + IMultiSourceFrameReader * This, + /* [annotation][out][retval] */ + _Out_ WAITABLE_HANDLE *waitableHandle); + + HRESULT ( STDMETHODCALLTYPE *UnsubscribeMultiSourceFrameArrived )( + IMultiSourceFrameReader * This, + /* [annotation][in] */ + _In_ WAITABLE_HANDLE waitableHandle); + + HRESULT ( STDMETHODCALLTYPE *GetMultiSourceFrameArrivedEventData )( + IMultiSourceFrameReader * This, + /* [annotation][in] */ + _In_ WAITABLE_HANDLE waitableHandle, + /* [annotation][out][retval] */ + _Out_ IMultiSourceFrameArrivedEventArgs **eventData); + + HRESULT ( STDMETHODCALLTYPE *AcquireLatestFrame )( + IMultiSourceFrameReader * This, + /* [annotation][out][retval] */ + _COM_Outptr_ IMultiSourceFrame **multiSourceFrame); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_FrameSourceTypes )( + IMultiSourceFrameReader * This, + /* [annotation][out][retval] */ + _Out_ DWORD *enabledFrameSourceTypes); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_IsPaused )( + IMultiSourceFrameReader * This, + /* [annotation][out][retval] */ + _Out_ BOOLEAN *isPaused); + + /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_IsPaused )( + IMultiSourceFrameReader * This, + BOOLEAN isPaused); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_KinectSensor )( + IMultiSourceFrameReader * This, + /* [annotation][out][retval] */ + _COM_Outptr_ IKinectSensor **sensor); + + END_INTERFACE + } IMultiSourceFrameReaderVtbl; + + interface IMultiSourceFrameReader + { + CONST_VTBL struct IMultiSourceFrameReaderVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IMultiSourceFrameReader_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IMultiSourceFrameReader_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IMultiSourceFrameReader_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IMultiSourceFrameReader_SubscribeMultiSourceFrameArrived(This,waitableHandle) \ + ( (This)->lpVtbl -> SubscribeMultiSourceFrameArrived(This,waitableHandle) ) + +#define IMultiSourceFrameReader_UnsubscribeMultiSourceFrameArrived(This,waitableHandle) \ + ( (This)->lpVtbl -> UnsubscribeMultiSourceFrameArrived(This,waitableHandle) ) + +#define IMultiSourceFrameReader_GetMultiSourceFrameArrivedEventData(This,waitableHandle,eventData) \ + ( (This)->lpVtbl -> GetMultiSourceFrameArrivedEventData(This,waitableHandle,eventData) ) + +#define IMultiSourceFrameReader_AcquireLatestFrame(This,multiSourceFrame) \ + ( (This)->lpVtbl -> AcquireLatestFrame(This,multiSourceFrame) ) + +#define IMultiSourceFrameReader_get_FrameSourceTypes(This,enabledFrameSourceTypes) \ + ( (This)->lpVtbl -> get_FrameSourceTypes(This,enabledFrameSourceTypes) ) + +#define IMultiSourceFrameReader_get_IsPaused(This,isPaused) \ + ( (This)->lpVtbl -> get_IsPaused(This,isPaused) ) + +#define IMultiSourceFrameReader_put_IsPaused(This,isPaused) \ + ( (This)->lpVtbl -> put_IsPaused(This,isPaused) ) + +#define IMultiSourceFrameReader_get_KinectSensor(This,sensor) \ + ( (This)->lpVtbl -> get_KinectSensor(This,sensor) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IMultiSourceFrameReader_INTERFACE_DEFINED__ */ + + +#ifndef __IMultiSourceFrameArrivedEventArgs_INTERFACE_DEFINED__ +#define __IMultiSourceFrameArrivedEventArgs_INTERFACE_DEFINED__ + +/* interface IMultiSourceFrameArrivedEventArgs */ +/* [object][local][uuid] */ + + +EXTERN_C const IID IID_IMultiSourceFrameArrivedEventArgs; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("3532F40B-D908-451D-BBF4-6CA73B782558") + IMultiSourceFrameArrivedEventArgs : public IUnknown + { + public: + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_FrameReference( + /* [annotation][out][retval] */ + _COM_Outptr_ IMultiSourceFrameReference **frames) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IMultiSourceFrameArrivedEventArgsVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IMultiSourceFrameArrivedEventArgs * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IMultiSourceFrameArrivedEventArgs * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IMultiSourceFrameArrivedEventArgs * This); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_FrameReference )( + IMultiSourceFrameArrivedEventArgs * This, + /* [annotation][out][retval] */ + _COM_Outptr_ IMultiSourceFrameReference **frames); + + END_INTERFACE + } IMultiSourceFrameArrivedEventArgsVtbl; + + interface IMultiSourceFrameArrivedEventArgs + { + CONST_VTBL struct IMultiSourceFrameArrivedEventArgsVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IMultiSourceFrameArrivedEventArgs_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IMultiSourceFrameArrivedEventArgs_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IMultiSourceFrameArrivedEventArgs_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IMultiSourceFrameArrivedEventArgs_get_FrameReference(This,frames) \ + ( (This)->lpVtbl -> get_FrameReference(This,frames) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IMultiSourceFrameArrivedEventArgs_INTERFACE_DEFINED__ */ + + +#ifndef __IMultiSourceFrameReference_INTERFACE_DEFINED__ +#define __IMultiSourceFrameReference_INTERFACE_DEFINED__ + +/* interface IMultiSourceFrameReference */ +/* [object][local][uuid] */ + + +EXTERN_C const IID IID_IMultiSourceFrameReference; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("DD70E845-E283-4DD1-8DAF-FC259AC5F9E3") + IMultiSourceFrameReference : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE AcquireFrame( + /* [annotation][out][retval] */ + _COM_Outptr_ IMultiSourceFrame **frame) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IMultiSourceFrameReferenceVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IMultiSourceFrameReference * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IMultiSourceFrameReference * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IMultiSourceFrameReference * This); + + HRESULT ( STDMETHODCALLTYPE *AcquireFrame )( + IMultiSourceFrameReference * This, + /* [annotation][out][retval] */ + _COM_Outptr_ IMultiSourceFrame **frame); + + END_INTERFACE + } IMultiSourceFrameReferenceVtbl; + + interface IMultiSourceFrameReference + { + CONST_VTBL struct IMultiSourceFrameReferenceVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IMultiSourceFrameReference_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IMultiSourceFrameReference_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IMultiSourceFrameReference_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IMultiSourceFrameReference_AcquireFrame(This,frame) \ + ( (This)->lpVtbl -> AcquireFrame(This,frame) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IMultiSourceFrameReference_INTERFACE_DEFINED__ */ + + +#ifndef __IMultiSourceFrame_INTERFACE_DEFINED__ +#define __IMultiSourceFrame_INTERFACE_DEFINED__ + +/* interface IMultiSourceFrame */ +/* [object][local][uuid] */ + + +EXTERN_C const IID IID_IMultiSourceFrame; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("29A63AFB-76CE-4359-895A-997F1E094D1C") + IMultiSourceFrame : public IUnknown + { + public: + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_ColorFrameReference( + /* [annotation][out][retval] */ + _COM_Outptr_ IColorFrameReference **colorFrameReference) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_DepthFrameReference( + /* [annotation][out][retval] */ + _COM_Outptr_ IDepthFrameReference **depthFrameReference) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_BodyFrameReference( + /* [annotation][out][retval] */ + _COM_Outptr_ IBodyFrameReference **bodyFrameReference) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_BodyIndexFrameReference( + /* [annotation][out][retval] */ + _COM_Outptr_ IBodyIndexFrameReference **bodyIndexFrameReference) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_InfraredFrameReference( + /* [annotation][out][retval] */ + _COM_Outptr_ IInfraredFrameReference **infraredFrameReference) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_LongExposureInfraredFrameReference( + /* [annotation][out][retval] */ + _COM_Outptr_ ILongExposureInfraredFrameReference **longExposureInfraredFrameReference) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IMultiSourceFrameVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IMultiSourceFrame * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IMultiSourceFrame * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IMultiSourceFrame * This); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_ColorFrameReference )( + IMultiSourceFrame * This, + /* [annotation][out][retval] */ + _COM_Outptr_ IColorFrameReference **colorFrameReference); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_DepthFrameReference )( + IMultiSourceFrame * This, + /* [annotation][out][retval] */ + _COM_Outptr_ IDepthFrameReference **depthFrameReference); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_BodyFrameReference )( + IMultiSourceFrame * This, + /* [annotation][out][retval] */ + _COM_Outptr_ IBodyFrameReference **bodyFrameReference); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_BodyIndexFrameReference )( + IMultiSourceFrame * This, + /* [annotation][out][retval] */ + _COM_Outptr_ IBodyIndexFrameReference **bodyIndexFrameReference); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_InfraredFrameReference )( + IMultiSourceFrame * This, + /* [annotation][out][retval] */ + _COM_Outptr_ IInfraredFrameReference **infraredFrameReference); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_LongExposureInfraredFrameReference )( + IMultiSourceFrame * This, + /* [annotation][out][retval] */ + _COM_Outptr_ ILongExposureInfraredFrameReference **longExposureInfraredFrameReference); + + END_INTERFACE + } IMultiSourceFrameVtbl; + + interface IMultiSourceFrame + { + CONST_VTBL struct IMultiSourceFrameVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IMultiSourceFrame_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IMultiSourceFrame_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IMultiSourceFrame_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IMultiSourceFrame_get_ColorFrameReference(This,colorFrameReference) \ + ( (This)->lpVtbl -> get_ColorFrameReference(This,colorFrameReference) ) + +#define IMultiSourceFrame_get_DepthFrameReference(This,depthFrameReference) \ + ( (This)->lpVtbl -> get_DepthFrameReference(This,depthFrameReference) ) + +#define IMultiSourceFrame_get_BodyFrameReference(This,bodyFrameReference) \ + ( (This)->lpVtbl -> get_BodyFrameReference(This,bodyFrameReference) ) + +#define IMultiSourceFrame_get_BodyIndexFrameReference(This,bodyIndexFrameReference) \ + ( (This)->lpVtbl -> get_BodyIndexFrameReference(This,bodyIndexFrameReference) ) + +#define IMultiSourceFrame_get_InfraredFrameReference(This,infraredFrameReference) \ + ( (This)->lpVtbl -> get_InfraredFrameReference(This,infraredFrameReference) ) + +#define IMultiSourceFrame_get_LongExposureInfraredFrameReference(This,longExposureInfraredFrameReference) \ + ( (This)->lpVtbl -> get_LongExposureInfraredFrameReference(This,longExposureInfraredFrameReference) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IMultiSourceFrame_INTERFACE_DEFINED__ */ + + +#ifndef __IColorFrameReference_INTERFACE_DEFINED__ +#define __IColorFrameReference_INTERFACE_DEFINED__ + +/* interface IColorFrameReference */ +/* [object][local][uuid] */ + + +EXTERN_C const IID IID_IColorFrameReference; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("5CC49E38-9BBD-48BE-A770-FD30EA405247") + IColorFrameReference : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE AcquireFrame( + /* [annotation][out][retval] */ + _COM_Outptr_ IColorFrame **colorFrame) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_RelativeTime( + /* [annotation][out][retval] */ + _Out_ TIMESPAN *relativeTime) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IColorFrameReferenceVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IColorFrameReference * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IColorFrameReference * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IColorFrameReference * This); + + HRESULT ( STDMETHODCALLTYPE *AcquireFrame )( + IColorFrameReference * This, + /* [annotation][out][retval] */ + _COM_Outptr_ IColorFrame **colorFrame); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_RelativeTime )( + IColorFrameReference * This, + /* [annotation][out][retval] */ + _Out_ TIMESPAN *relativeTime); + + END_INTERFACE + } IColorFrameReferenceVtbl; + + interface IColorFrameReference + { + CONST_VTBL struct IColorFrameReferenceVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IColorFrameReference_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IColorFrameReference_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IColorFrameReference_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IColorFrameReference_AcquireFrame(This,colorFrame) \ + ( (This)->lpVtbl -> AcquireFrame(This,colorFrame) ) + +#define IColorFrameReference_get_RelativeTime(This,relativeTime) \ + ( (This)->lpVtbl -> get_RelativeTime(This,relativeTime) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IColorFrameReference_INTERFACE_DEFINED__ */ + + +#ifndef __IColorFrameArrivedEventArgs_INTERFACE_DEFINED__ +#define __IColorFrameArrivedEventArgs_INTERFACE_DEFINED__ + +/* interface IColorFrameArrivedEventArgs */ +/* [object][local][uuid] */ + + +EXTERN_C const IID IID_IColorFrameArrivedEventArgs; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("82A2E32F-4AE5-4614-88BB-DCC5AE0CEAED") + IColorFrameArrivedEventArgs : public IUnknown + { + public: + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_FrameReference( + /* [annotation][out][retval] */ + _COM_Outptr_ IColorFrameReference **colorFrameReference) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IColorFrameArrivedEventArgsVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IColorFrameArrivedEventArgs * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IColorFrameArrivedEventArgs * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IColorFrameArrivedEventArgs * This); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_FrameReference )( + IColorFrameArrivedEventArgs * This, + /* [annotation][out][retval] */ + _COM_Outptr_ IColorFrameReference **colorFrameReference); + + END_INTERFACE + } IColorFrameArrivedEventArgsVtbl; + + interface IColorFrameArrivedEventArgs + { + CONST_VTBL struct IColorFrameArrivedEventArgsVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IColorFrameArrivedEventArgs_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IColorFrameArrivedEventArgs_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IColorFrameArrivedEventArgs_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IColorFrameArrivedEventArgs_get_FrameReference(This,colorFrameReference) \ + ( (This)->lpVtbl -> get_FrameReference(This,colorFrameReference) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IColorFrameArrivedEventArgs_INTERFACE_DEFINED__ */ + + +#ifndef __IColorFrameSource_INTERFACE_DEFINED__ +#define __IColorFrameSource_INTERFACE_DEFINED__ + +/* interface IColorFrameSource */ +/* [object][local][uuid] */ + + +EXTERN_C const IID IID_IColorFrameSource; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("57621D82-D8EE-4783-B412-F7E019C96CFD") + IColorFrameSource : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE SubscribeFrameCaptured( + /* [annotation][out][retval] */ + _Out_ WAITABLE_HANDLE *waitableHandle) = 0; + + virtual HRESULT STDMETHODCALLTYPE UnsubscribeFrameCaptured( + /* [annotation][in] */ + _In_ WAITABLE_HANDLE waitableHandle) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetFrameCapturedEventData( + /* [annotation][in] */ + _In_ WAITABLE_HANDLE waitableHandle, + /* [annotation][out][retval] */ + _Out_ IFrameCapturedEventArgs **eventData) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_IsActive( + /* [annotation][out][retval] */ + _Out_ BOOLEAN *isActive) = 0; + + virtual HRESULT STDMETHODCALLTYPE OpenReader( + /* [annotation][out][retval] */ + _COM_Outptr_ IColorFrameReader **reader) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateFrameDescription( + ColorImageFormat format, + /* [annotation][out][retval] */ + _COM_Outptr_ IFrameDescription **frameDescription) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_FrameDescription( + /* [annotation][out][retval] */ + _COM_Outptr_ IFrameDescription **rawFrameDescription) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_KinectSensor( + /* [annotation][out][retval] */ + _COM_Outptr_ IKinectSensor **sensor) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IColorFrameSourceVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IColorFrameSource * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IColorFrameSource * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IColorFrameSource * This); + + HRESULT ( STDMETHODCALLTYPE *SubscribeFrameCaptured )( + IColorFrameSource * This, + /* [annotation][out][retval] */ + _Out_ WAITABLE_HANDLE *waitableHandle); + + HRESULT ( STDMETHODCALLTYPE *UnsubscribeFrameCaptured )( + IColorFrameSource * This, + /* [annotation][in] */ + _In_ WAITABLE_HANDLE waitableHandle); + + HRESULT ( STDMETHODCALLTYPE *GetFrameCapturedEventData )( + IColorFrameSource * This, + /* [annotation][in] */ + _In_ WAITABLE_HANDLE waitableHandle, + /* [annotation][out][retval] */ + _Out_ IFrameCapturedEventArgs **eventData); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_IsActive )( + IColorFrameSource * This, + /* [annotation][out][retval] */ + _Out_ BOOLEAN *isActive); + + HRESULT ( STDMETHODCALLTYPE *OpenReader )( + IColorFrameSource * This, + /* [annotation][out][retval] */ + _COM_Outptr_ IColorFrameReader **reader); + + HRESULT ( STDMETHODCALLTYPE *CreateFrameDescription )( + IColorFrameSource * This, + ColorImageFormat format, + /* [annotation][out][retval] */ + _COM_Outptr_ IFrameDescription **frameDescription); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_FrameDescription )( + IColorFrameSource * This, + /* [annotation][out][retval] */ + _COM_Outptr_ IFrameDescription **rawFrameDescription); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_KinectSensor )( + IColorFrameSource * This, + /* [annotation][out][retval] */ + _COM_Outptr_ IKinectSensor **sensor); + + END_INTERFACE + } IColorFrameSourceVtbl; + + interface IColorFrameSource + { + CONST_VTBL struct IColorFrameSourceVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IColorFrameSource_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IColorFrameSource_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IColorFrameSource_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IColorFrameSource_SubscribeFrameCaptured(This,waitableHandle) \ + ( (This)->lpVtbl -> SubscribeFrameCaptured(This,waitableHandle) ) + +#define IColorFrameSource_UnsubscribeFrameCaptured(This,waitableHandle) \ + ( (This)->lpVtbl -> UnsubscribeFrameCaptured(This,waitableHandle) ) + +#define IColorFrameSource_GetFrameCapturedEventData(This,waitableHandle,eventData) \ + ( (This)->lpVtbl -> GetFrameCapturedEventData(This,waitableHandle,eventData) ) + +#define IColorFrameSource_get_IsActive(This,isActive) \ + ( (This)->lpVtbl -> get_IsActive(This,isActive) ) + +#define IColorFrameSource_OpenReader(This,reader) \ + ( (This)->lpVtbl -> OpenReader(This,reader) ) + +#define IColorFrameSource_CreateFrameDescription(This,format,frameDescription) \ + ( (This)->lpVtbl -> CreateFrameDescription(This,format,frameDescription) ) + +#define IColorFrameSource_get_FrameDescription(This,rawFrameDescription) \ + ( (This)->lpVtbl -> get_FrameDescription(This,rawFrameDescription) ) + +#define IColorFrameSource_get_KinectSensor(This,sensor) \ + ( (This)->lpVtbl -> get_KinectSensor(This,sensor) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IColorFrameSource_INTERFACE_DEFINED__ */ + + +#ifndef __IColorFrameReader_INTERFACE_DEFINED__ +#define __IColorFrameReader_INTERFACE_DEFINED__ + +/* interface IColorFrameReader */ +/* [object][local][uuid] */ + + +EXTERN_C const IID IID_IColorFrameReader; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("9BEA498C-C59C-4653-AAF9-D884BAB7C35B") + IColorFrameReader : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE SubscribeFrameArrived( + /* [annotation][out][retval] */ + _Out_ WAITABLE_HANDLE *waitableHandle) = 0; + + virtual HRESULT STDMETHODCALLTYPE UnsubscribeFrameArrived( + /* [annotation][in] */ + _In_ WAITABLE_HANDLE waitableHandle) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetFrameArrivedEventData( + /* [annotation][in] */ + _In_ WAITABLE_HANDLE waitableHandle, + /* [annotation][out][retval] */ + _Out_ IColorFrameArrivedEventArgs **eventData) = 0; + + virtual HRESULT STDMETHODCALLTYPE AcquireLatestFrame( + /* [annotation][out][retval] */ + _COM_Outptr_ IColorFrame **colorFrame) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_IsPaused( + /* [annotation][out][retval] */ + _Out_ BOOLEAN *isPaused) = 0; + + virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_IsPaused( + BOOLEAN isPaused) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_ColorFrameSource( + /* [annotation][out][retval] */ + _COM_Outptr_ IColorFrameSource **colorFrameSource) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IColorFrameReaderVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IColorFrameReader * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IColorFrameReader * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IColorFrameReader * This); + + HRESULT ( STDMETHODCALLTYPE *SubscribeFrameArrived )( + IColorFrameReader * This, + /* [annotation][out][retval] */ + _Out_ WAITABLE_HANDLE *waitableHandle); + + HRESULT ( STDMETHODCALLTYPE *UnsubscribeFrameArrived )( + IColorFrameReader * This, + /* [annotation][in] */ + _In_ WAITABLE_HANDLE waitableHandle); + + HRESULT ( STDMETHODCALLTYPE *GetFrameArrivedEventData )( + IColorFrameReader * This, + /* [annotation][in] */ + _In_ WAITABLE_HANDLE waitableHandle, + /* [annotation][out][retval] */ + _Out_ IColorFrameArrivedEventArgs **eventData); + + HRESULT ( STDMETHODCALLTYPE *AcquireLatestFrame )( + IColorFrameReader * This, + /* [annotation][out][retval] */ + _COM_Outptr_ IColorFrame **colorFrame); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_IsPaused )( + IColorFrameReader * This, + /* [annotation][out][retval] */ + _Out_ BOOLEAN *isPaused); + + /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_IsPaused )( + IColorFrameReader * This, + BOOLEAN isPaused); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_ColorFrameSource )( + IColorFrameReader * This, + /* [annotation][out][retval] */ + _COM_Outptr_ IColorFrameSource **colorFrameSource); + + END_INTERFACE + } IColorFrameReaderVtbl; + + interface IColorFrameReader + { + CONST_VTBL struct IColorFrameReaderVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IColorFrameReader_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IColorFrameReader_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IColorFrameReader_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IColorFrameReader_SubscribeFrameArrived(This,waitableHandle) \ + ( (This)->lpVtbl -> SubscribeFrameArrived(This,waitableHandle) ) + +#define IColorFrameReader_UnsubscribeFrameArrived(This,waitableHandle) \ + ( (This)->lpVtbl -> UnsubscribeFrameArrived(This,waitableHandle) ) + +#define IColorFrameReader_GetFrameArrivedEventData(This,waitableHandle,eventData) \ + ( (This)->lpVtbl -> GetFrameArrivedEventData(This,waitableHandle,eventData) ) + +#define IColorFrameReader_AcquireLatestFrame(This,colorFrame) \ + ( (This)->lpVtbl -> AcquireLatestFrame(This,colorFrame) ) + +#define IColorFrameReader_get_IsPaused(This,isPaused) \ + ( (This)->lpVtbl -> get_IsPaused(This,isPaused) ) + +#define IColorFrameReader_put_IsPaused(This,isPaused) \ + ( (This)->lpVtbl -> put_IsPaused(This,isPaused) ) + +#define IColorFrameReader_get_ColorFrameSource(This,colorFrameSource) \ + ( (This)->lpVtbl -> get_ColorFrameSource(This,colorFrameSource) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IColorFrameReader_INTERFACE_DEFINED__ */ + + +#ifndef __IColorFrame_INTERFACE_DEFINED__ +#define __IColorFrame_INTERFACE_DEFINED__ + +/* interface IColorFrame */ +/* [object][local][uuid] */ + + +EXTERN_C const IID IID_IColorFrame; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("39D05803-8803-4E86-AD9F-13F6954E4ACA") + IColorFrame : public IUnknown + { + public: + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_RawColorImageFormat( + /* [annotation][out][retval] */ + _Out_ ColorImageFormat *rawColorImageFormat) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_FrameDescription( + /* [annotation][out][retval] */ + _COM_Outptr_ IFrameDescription **rawFrameDescription) = 0; + + virtual HRESULT STDMETHODCALLTYPE CopyRawFrameDataToArray( + UINT capacity, + /* [annotation][size_is][out] */ + _Out_writes_all_(capacity) BYTE *frameData) = 0; + + virtual HRESULT STDMETHODCALLTYPE AccessRawUnderlyingBuffer( + /* [annotation][out] */ + _Out_ UINT *capacity, + /* [annotation][size_is][size_is][out] */ + _Outptr_result_buffer_(*capacity) BYTE **buffer) = 0; + + virtual HRESULT STDMETHODCALLTYPE CopyConvertedFrameDataToArray( + UINT capacity, + /* [annotation][size_is][out] */ + _Out_writes_all_(capacity) BYTE *frameData, + ColorImageFormat colorFormat) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateFrameDescription( + ColorImageFormat format, + /* [annotation][out][retval] */ + _COM_Outptr_ IFrameDescription **frameDescription) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_ColorCameraSettings( + /* [annotation][out][retval] */ + _COM_Outptr_ IColorCameraSettings **colorCameraSettings) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_RelativeTime( + /* [annotation][out][retval] */ + _Out_ TIMESPAN *relativeTime) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_ColorFrameSource( + /* [annotation][out][retval] */ + _COM_Outptr_ IColorFrameSource **colorFrameSource) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IColorFrameVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IColorFrame * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IColorFrame * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IColorFrame * This); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_RawColorImageFormat )( + IColorFrame * This, + /* [annotation][out][retval] */ + _Out_ ColorImageFormat *rawColorImageFormat); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_FrameDescription )( + IColorFrame * This, + /* [annotation][out][retval] */ + _COM_Outptr_ IFrameDescription **rawFrameDescription); + + HRESULT ( STDMETHODCALLTYPE *CopyRawFrameDataToArray )( + IColorFrame * This, + UINT capacity, + /* [annotation][size_is][out] */ + _Out_writes_all_(capacity) BYTE *frameData); + + HRESULT ( STDMETHODCALLTYPE *AccessRawUnderlyingBuffer )( + IColorFrame * This, + /* [annotation][out] */ + _Out_ UINT *capacity, + /* [annotation][size_is][size_is][out] */ + _Outptr_result_buffer_(*capacity) BYTE **buffer); + + HRESULT ( STDMETHODCALLTYPE *CopyConvertedFrameDataToArray )( + IColorFrame * This, + UINT capacity, + /* [annotation][size_is][out] */ + _Out_writes_all_(capacity) BYTE *frameData, + ColorImageFormat colorFormat); + + HRESULT ( STDMETHODCALLTYPE *CreateFrameDescription )( + IColorFrame * This, + ColorImageFormat format, + /* [annotation][out][retval] */ + _COM_Outptr_ IFrameDescription **frameDescription); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_ColorCameraSettings )( + IColorFrame * This, + /* [annotation][out][retval] */ + _COM_Outptr_ IColorCameraSettings **colorCameraSettings); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_RelativeTime )( + IColorFrame * This, + /* [annotation][out][retval] */ + _Out_ TIMESPAN *relativeTime); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_ColorFrameSource )( + IColorFrame * This, + /* [annotation][out][retval] */ + _COM_Outptr_ IColorFrameSource **colorFrameSource); + + END_INTERFACE + } IColorFrameVtbl; + + interface IColorFrame + { + CONST_VTBL struct IColorFrameVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IColorFrame_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IColorFrame_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IColorFrame_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IColorFrame_get_RawColorImageFormat(This,rawColorImageFormat) \ + ( (This)->lpVtbl -> get_RawColorImageFormat(This,rawColorImageFormat) ) + +#define IColorFrame_get_FrameDescription(This,rawFrameDescription) \ + ( (This)->lpVtbl -> get_FrameDescription(This,rawFrameDescription) ) + +#define IColorFrame_CopyRawFrameDataToArray(This,capacity,frameData) \ + ( (This)->lpVtbl -> CopyRawFrameDataToArray(This,capacity,frameData) ) + +#define IColorFrame_AccessRawUnderlyingBuffer(This,capacity,buffer) \ + ( (This)->lpVtbl -> AccessRawUnderlyingBuffer(This,capacity,buffer) ) + +#define IColorFrame_CopyConvertedFrameDataToArray(This,capacity,frameData,colorFormat) \ + ( (This)->lpVtbl -> CopyConvertedFrameDataToArray(This,capacity,frameData,colorFormat) ) + +#define IColorFrame_CreateFrameDescription(This,format,frameDescription) \ + ( (This)->lpVtbl -> CreateFrameDescription(This,format,frameDescription) ) + +#define IColorFrame_get_ColorCameraSettings(This,colorCameraSettings) \ + ( (This)->lpVtbl -> get_ColorCameraSettings(This,colorCameraSettings) ) + +#define IColorFrame_get_RelativeTime(This,relativeTime) \ + ( (This)->lpVtbl -> get_RelativeTime(This,relativeTime) ) + +#define IColorFrame_get_ColorFrameSource(This,colorFrameSource) \ + ( (This)->lpVtbl -> get_ColorFrameSource(This,colorFrameSource) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IColorFrame_INTERFACE_DEFINED__ */ + + +#ifndef __IDepthFrameReference_INTERFACE_DEFINED__ +#define __IDepthFrameReference_INTERFACE_DEFINED__ + +/* interface IDepthFrameReference */ +/* [object][local][uuid] */ + + +EXTERN_C const IID IID_IDepthFrameReference; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("20621E5E-ABC9-4EBD-A7EE-4C77EDD0152A") + IDepthFrameReference : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE AcquireFrame( + /* [annotation][out][retval] */ + _COM_Outptr_ IDepthFrame **depthFrame) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_RelativeTime( + /* [annotation][out][retval] */ + _Out_ TIMESPAN *relativeTime) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IDepthFrameReferenceVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDepthFrameReference * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDepthFrameReference * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDepthFrameReference * This); + + HRESULT ( STDMETHODCALLTYPE *AcquireFrame )( + IDepthFrameReference * This, + /* [annotation][out][retval] */ + _COM_Outptr_ IDepthFrame **depthFrame); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_RelativeTime )( + IDepthFrameReference * This, + /* [annotation][out][retval] */ + _Out_ TIMESPAN *relativeTime); + + END_INTERFACE + } IDepthFrameReferenceVtbl; + + interface IDepthFrameReference + { + CONST_VTBL struct IDepthFrameReferenceVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDepthFrameReference_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IDepthFrameReference_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IDepthFrameReference_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IDepthFrameReference_AcquireFrame(This,depthFrame) \ + ( (This)->lpVtbl -> AcquireFrame(This,depthFrame) ) + +#define IDepthFrameReference_get_RelativeTime(This,relativeTime) \ + ( (This)->lpVtbl -> get_RelativeTime(This,relativeTime) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IDepthFrameReference_INTERFACE_DEFINED__ */ + + +#ifndef __IDepthFrameArrivedEventArgs_INTERFACE_DEFINED__ +#define __IDepthFrameArrivedEventArgs_INTERFACE_DEFINED__ + +/* interface IDepthFrameArrivedEventArgs */ +/* [object][local][uuid] */ + + +EXTERN_C const IID IID_IDepthFrameArrivedEventArgs; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("2B01BCB8-29D7-4726-860C-6DA56664AA81") + IDepthFrameArrivedEventArgs : public IUnknown + { + public: + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_FrameReference( + /* [annotation][out][retval] */ + _COM_Outptr_ IDepthFrameReference **depthFrameReference) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IDepthFrameArrivedEventArgsVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDepthFrameArrivedEventArgs * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDepthFrameArrivedEventArgs * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDepthFrameArrivedEventArgs * This); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_FrameReference )( + IDepthFrameArrivedEventArgs * This, + /* [annotation][out][retval] */ + _COM_Outptr_ IDepthFrameReference **depthFrameReference); + + END_INTERFACE + } IDepthFrameArrivedEventArgsVtbl; + + interface IDepthFrameArrivedEventArgs + { + CONST_VTBL struct IDepthFrameArrivedEventArgsVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDepthFrameArrivedEventArgs_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IDepthFrameArrivedEventArgs_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IDepthFrameArrivedEventArgs_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IDepthFrameArrivedEventArgs_get_FrameReference(This,depthFrameReference) \ + ( (This)->lpVtbl -> get_FrameReference(This,depthFrameReference) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IDepthFrameArrivedEventArgs_INTERFACE_DEFINED__ */ + + +#ifndef __IDepthFrameSource_INTERFACE_DEFINED__ +#define __IDepthFrameSource_INTERFACE_DEFINED__ + +/* interface IDepthFrameSource */ +/* [object][local][uuid] */ + + +EXTERN_C const IID IID_IDepthFrameSource; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("C428D558-5E46-490A-B699-D1DDDAA24150") + IDepthFrameSource : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE SubscribeFrameCaptured( + /* [annotation][out][retval] */ + _Out_ WAITABLE_HANDLE *waitableHandle) = 0; + + virtual HRESULT STDMETHODCALLTYPE UnsubscribeFrameCaptured( + /* [annotation][in] */ + _In_ WAITABLE_HANDLE waitableHandle) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetFrameCapturedEventData( + /* [annotation][in] */ + _In_ WAITABLE_HANDLE waitableHandle, + /* [annotation][out][retval] */ + _Out_ IFrameCapturedEventArgs **eventData) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_IsActive( + /* [annotation][out][retval] */ + _Out_ BOOLEAN *isActive) = 0; + + virtual HRESULT STDMETHODCALLTYPE OpenReader( + /* [annotation][out][retval] */ + _COM_Outptr_ IDepthFrameReader **reader) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_DepthMinReliableDistance( + /* [annotation][out][retval] */ + _Out_ UINT16 *depthMinReliableDistance) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_DepthMaxReliableDistance( + /* [annotation][out][retval] */ + _Out_ UINT16 *depthMaxReliableDistance) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_FrameDescription( + /* [annotation][out][retval] */ + _COM_Outptr_ IFrameDescription **frameDescription) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_KinectSensor( + /* [annotation][out][retval] */ + _COM_Outptr_ IKinectSensor **sensor) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IDepthFrameSourceVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDepthFrameSource * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDepthFrameSource * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDepthFrameSource * This); + + HRESULT ( STDMETHODCALLTYPE *SubscribeFrameCaptured )( + IDepthFrameSource * This, + /* [annotation][out][retval] */ + _Out_ WAITABLE_HANDLE *waitableHandle); + + HRESULT ( STDMETHODCALLTYPE *UnsubscribeFrameCaptured )( + IDepthFrameSource * This, + /* [annotation][in] */ + _In_ WAITABLE_HANDLE waitableHandle); + + HRESULT ( STDMETHODCALLTYPE *GetFrameCapturedEventData )( + IDepthFrameSource * This, + /* [annotation][in] */ + _In_ WAITABLE_HANDLE waitableHandle, + /* [annotation][out][retval] */ + _Out_ IFrameCapturedEventArgs **eventData); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_IsActive )( + IDepthFrameSource * This, + /* [annotation][out][retval] */ + _Out_ BOOLEAN *isActive); + + HRESULT ( STDMETHODCALLTYPE *OpenReader )( + IDepthFrameSource * This, + /* [annotation][out][retval] */ + _COM_Outptr_ IDepthFrameReader **reader); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_DepthMinReliableDistance )( + IDepthFrameSource * This, + /* [annotation][out][retval] */ + _Out_ UINT16 *depthMinReliableDistance); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_DepthMaxReliableDistance )( + IDepthFrameSource * This, + /* [annotation][out][retval] */ + _Out_ UINT16 *depthMaxReliableDistance); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_FrameDescription )( + IDepthFrameSource * This, + /* [annotation][out][retval] */ + _COM_Outptr_ IFrameDescription **frameDescription); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_KinectSensor )( + IDepthFrameSource * This, + /* [annotation][out][retval] */ + _COM_Outptr_ IKinectSensor **sensor); + + END_INTERFACE + } IDepthFrameSourceVtbl; + + interface IDepthFrameSource + { + CONST_VTBL struct IDepthFrameSourceVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDepthFrameSource_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IDepthFrameSource_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IDepthFrameSource_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IDepthFrameSource_SubscribeFrameCaptured(This,waitableHandle) \ + ( (This)->lpVtbl -> SubscribeFrameCaptured(This,waitableHandle) ) + +#define IDepthFrameSource_UnsubscribeFrameCaptured(This,waitableHandle) \ + ( (This)->lpVtbl -> UnsubscribeFrameCaptured(This,waitableHandle) ) + +#define IDepthFrameSource_GetFrameCapturedEventData(This,waitableHandle,eventData) \ + ( (This)->lpVtbl -> GetFrameCapturedEventData(This,waitableHandle,eventData) ) + +#define IDepthFrameSource_get_IsActive(This,isActive) \ + ( (This)->lpVtbl -> get_IsActive(This,isActive) ) + +#define IDepthFrameSource_OpenReader(This,reader) \ + ( (This)->lpVtbl -> OpenReader(This,reader) ) + +#define IDepthFrameSource_get_DepthMinReliableDistance(This,depthMinReliableDistance) \ + ( (This)->lpVtbl -> get_DepthMinReliableDistance(This,depthMinReliableDistance) ) + +#define IDepthFrameSource_get_DepthMaxReliableDistance(This,depthMaxReliableDistance) \ + ( (This)->lpVtbl -> get_DepthMaxReliableDistance(This,depthMaxReliableDistance) ) + +#define IDepthFrameSource_get_FrameDescription(This,frameDescription) \ + ( (This)->lpVtbl -> get_FrameDescription(This,frameDescription) ) + +#define IDepthFrameSource_get_KinectSensor(This,sensor) \ + ( (This)->lpVtbl -> get_KinectSensor(This,sensor) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IDepthFrameSource_INTERFACE_DEFINED__ */ + + +#ifndef __IDepthFrameReader_INTERFACE_DEFINED__ +#define __IDepthFrameReader_INTERFACE_DEFINED__ + +/* interface IDepthFrameReader */ +/* [object][local][uuid] */ + + +EXTERN_C const IID IID_IDepthFrameReader; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("81C0C0AB-6E6C-45CB-8625-A5F4D38759A4") + IDepthFrameReader : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE SubscribeFrameArrived( + /* [annotation][out][retval] */ + _Out_ WAITABLE_HANDLE *waitableHandle) = 0; + + virtual HRESULT STDMETHODCALLTYPE UnsubscribeFrameArrived( + /* [annotation][in] */ + _In_ WAITABLE_HANDLE waitableHandle) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetFrameArrivedEventData( + /* [annotation][in] */ + _In_ WAITABLE_HANDLE waitableHandle, + /* [annotation][out][retval] */ + _Out_ IDepthFrameArrivedEventArgs **eventData) = 0; + + virtual HRESULT STDMETHODCALLTYPE AcquireLatestFrame( + /* [annotation][out][retval] */ + _COM_Outptr_ IDepthFrame **depthFrame) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_IsPaused( + /* [annotation][out][retval] */ + _Out_ BOOLEAN *isPaused) = 0; + + virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_IsPaused( + BOOLEAN isPaused) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_DepthFrameSource( + /* [annotation][out][retval] */ + _COM_Outptr_ IDepthFrameSource **depthFrameSource) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IDepthFrameReaderVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDepthFrameReader * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDepthFrameReader * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDepthFrameReader * This); + + HRESULT ( STDMETHODCALLTYPE *SubscribeFrameArrived )( + IDepthFrameReader * This, + /* [annotation][out][retval] */ + _Out_ WAITABLE_HANDLE *waitableHandle); + + HRESULT ( STDMETHODCALLTYPE *UnsubscribeFrameArrived )( + IDepthFrameReader * This, + /* [annotation][in] */ + _In_ WAITABLE_HANDLE waitableHandle); + + HRESULT ( STDMETHODCALLTYPE *GetFrameArrivedEventData )( + IDepthFrameReader * This, + /* [annotation][in] */ + _In_ WAITABLE_HANDLE waitableHandle, + /* [annotation][out][retval] */ + _Out_ IDepthFrameArrivedEventArgs **eventData); + + HRESULT ( STDMETHODCALLTYPE *AcquireLatestFrame )( + IDepthFrameReader * This, + /* [annotation][out][retval] */ + _COM_Outptr_ IDepthFrame **depthFrame); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_IsPaused )( + IDepthFrameReader * This, + /* [annotation][out][retval] */ + _Out_ BOOLEAN *isPaused); + + /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_IsPaused )( + IDepthFrameReader * This, + BOOLEAN isPaused); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_DepthFrameSource )( + IDepthFrameReader * This, + /* [annotation][out][retval] */ + _COM_Outptr_ IDepthFrameSource **depthFrameSource); + + END_INTERFACE + } IDepthFrameReaderVtbl; + + interface IDepthFrameReader + { + CONST_VTBL struct IDepthFrameReaderVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDepthFrameReader_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IDepthFrameReader_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IDepthFrameReader_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IDepthFrameReader_SubscribeFrameArrived(This,waitableHandle) \ + ( (This)->lpVtbl -> SubscribeFrameArrived(This,waitableHandle) ) + +#define IDepthFrameReader_UnsubscribeFrameArrived(This,waitableHandle) \ + ( (This)->lpVtbl -> UnsubscribeFrameArrived(This,waitableHandle) ) + +#define IDepthFrameReader_GetFrameArrivedEventData(This,waitableHandle,eventData) \ + ( (This)->lpVtbl -> GetFrameArrivedEventData(This,waitableHandle,eventData) ) + +#define IDepthFrameReader_AcquireLatestFrame(This,depthFrame) \ + ( (This)->lpVtbl -> AcquireLatestFrame(This,depthFrame) ) + +#define IDepthFrameReader_get_IsPaused(This,isPaused) \ + ( (This)->lpVtbl -> get_IsPaused(This,isPaused) ) + +#define IDepthFrameReader_put_IsPaused(This,isPaused) \ + ( (This)->lpVtbl -> put_IsPaused(This,isPaused) ) + +#define IDepthFrameReader_get_DepthFrameSource(This,depthFrameSource) \ + ( (This)->lpVtbl -> get_DepthFrameSource(This,depthFrameSource) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IDepthFrameReader_INTERFACE_DEFINED__ */ + + +#ifndef __IDepthFrame_INTERFACE_DEFINED__ +#define __IDepthFrame_INTERFACE_DEFINED__ + +/* interface IDepthFrame */ +/* [object][local][uuid] */ + + +EXTERN_C const IID IID_IDepthFrame; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("D8600853-8835-44F9-84A7-E617CDD7DFDD") + IDepthFrame : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE CopyFrameDataToArray( + UINT capacity, + /* [annotation][size_is][out] */ + _Out_writes_all_(capacity) UINT16 *frameData) = 0; + + virtual HRESULT STDMETHODCALLTYPE AccessUnderlyingBuffer( + /* [annotation][out] */ + _Out_ UINT *capacity, + /* [annotation][size_is][size_is][out] */ + _Outptr_result_buffer_(*capacity) UINT16 **buffer) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_FrameDescription( + /* [annotation][out][retval] */ + _COM_Outptr_ IFrameDescription **frameDescription) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_RelativeTime( + /* [annotation][out][retval] */ + _Out_ TIMESPAN *relativeTime) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_DepthFrameSource( + /* [annotation][out][retval] */ + _COM_Outptr_ IDepthFrameSource **depthFrameSource) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_DepthMinReliableDistance( + /* [annotation][out][retval] */ + _Out_ USHORT *depthMinReliableDistance) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_DepthMaxReliableDistance( + /* [annotation][out][retval] */ + _Out_ USHORT *depthMaxReliableDistance) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IDepthFrameVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDepthFrame * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDepthFrame * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDepthFrame * This); + + HRESULT ( STDMETHODCALLTYPE *CopyFrameDataToArray )( + IDepthFrame * This, + UINT capacity, + /* [annotation][size_is][out] */ + _Out_writes_all_(capacity) UINT16 *frameData); + + HRESULT ( STDMETHODCALLTYPE *AccessUnderlyingBuffer )( + IDepthFrame * This, + /* [annotation][out] */ + _Out_ UINT *capacity, + /* [annotation][size_is][size_is][out] */ + _Outptr_result_buffer_(*capacity) UINT16 **buffer); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_FrameDescription )( + IDepthFrame * This, + /* [annotation][out][retval] */ + _COM_Outptr_ IFrameDescription **frameDescription); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_RelativeTime )( + IDepthFrame * This, + /* [annotation][out][retval] */ + _Out_ TIMESPAN *relativeTime); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_DepthFrameSource )( + IDepthFrame * This, + /* [annotation][out][retval] */ + _COM_Outptr_ IDepthFrameSource **depthFrameSource); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_DepthMinReliableDistance )( + IDepthFrame * This, + /* [annotation][out][retval] */ + _Out_ USHORT *depthMinReliableDistance); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_DepthMaxReliableDistance )( + IDepthFrame * This, + /* [annotation][out][retval] */ + _Out_ USHORT *depthMaxReliableDistance); + + END_INTERFACE + } IDepthFrameVtbl; + + interface IDepthFrame + { + CONST_VTBL struct IDepthFrameVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDepthFrame_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IDepthFrame_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IDepthFrame_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IDepthFrame_CopyFrameDataToArray(This,capacity,frameData) \ + ( (This)->lpVtbl -> CopyFrameDataToArray(This,capacity,frameData) ) + +#define IDepthFrame_AccessUnderlyingBuffer(This,capacity,buffer) \ + ( (This)->lpVtbl -> AccessUnderlyingBuffer(This,capacity,buffer) ) + +#define IDepthFrame_get_FrameDescription(This,frameDescription) \ + ( (This)->lpVtbl -> get_FrameDescription(This,frameDescription) ) + +#define IDepthFrame_get_RelativeTime(This,relativeTime) \ + ( (This)->lpVtbl -> get_RelativeTime(This,relativeTime) ) + +#define IDepthFrame_get_DepthFrameSource(This,depthFrameSource) \ + ( (This)->lpVtbl -> get_DepthFrameSource(This,depthFrameSource) ) + +#define IDepthFrame_get_DepthMinReliableDistance(This,depthMinReliableDistance) \ + ( (This)->lpVtbl -> get_DepthMinReliableDistance(This,depthMinReliableDistance) ) + +#define IDepthFrame_get_DepthMaxReliableDistance(This,depthMaxReliableDistance) \ + ( (This)->lpVtbl -> get_DepthMaxReliableDistance(This,depthMaxReliableDistance) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IDepthFrame_INTERFACE_DEFINED__ */ + + +#ifndef __IBodyFrameReference_INTERFACE_DEFINED__ +#define __IBodyFrameReference_INTERFACE_DEFINED__ + +/* interface IBodyFrameReference */ +/* [object][local][uuid] */ + + +EXTERN_C const IID IID_IBodyFrameReference; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("C3A1733C-5F84-443B-9659-2F2BE250C97D") + IBodyFrameReference : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE AcquireFrame( + /* [annotation][out][retval] */ + _COM_Outptr_ IBodyFrame **bodyFrame) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_RelativeTime( + /* [annotation][out][retval] */ + _Out_ TIMESPAN *relativeTime) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IBodyFrameReferenceVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IBodyFrameReference * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IBodyFrameReference * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IBodyFrameReference * This); + + HRESULT ( STDMETHODCALLTYPE *AcquireFrame )( + IBodyFrameReference * This, + /* [annotation][out][retval] */ + _COM_Outptr_ IBodyFrame **bodyFrame); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_RelativeTime )( + IBodyFrameReference * This, + /* [annotation][out][retval] */ + _Out_ TIMESPAN *relativeTime); + + END_INTERFACE + } IBodyFrameReferenceVtbl; + + interface IBodyFrameReference + { + CONST_VTBL struct IBodyFrameReferenceVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IBodyFrameReference_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IBodyFrameReference_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IBodyFrameReference_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IBodyFrameReference_AcquireFrame(This,bodyFrame) \ + ( (This)->lpVtbl -> AcquireFrame(This,bodyFrame) ) + +#define IBodyFrameReference_get_RelativeTime(This,relativeTime) \ + ( (This)->lpVtbl -> get_RelativeTime(This,relativeTime) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IBodyFrameReference_INTERFACE_DEFINED__ */ + + +#ifndef __IBodyFrameArrivedEventArgs_INTERFACE_DEFINED__ +#define __IBodyFrameArrivedEventArgs_INTERFACE_DEFINED__ + +/* interface IBodyFrameArrivedEventArgs */ +/* [object][local][uuid] */ + + +EXTERN_C const IID IID_IBodyFrameArrivedEventArgs; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("BF5CCA0E-00C1-4D48-837F-AB921E6AEE01") + IBodyFrameArrivedEventArgs : public IUnknown + { + public: + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_FrameReference( + /* [annotation][out][retval] */ + _COM_Outptr_ IBodyFrameReference **bodyFrameReference) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IBodyFrameArrivedEventArgsVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IBodyFrameArrivedEventArgs * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IBodyFrameArrivedEventArgs * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IBodyFrameArrivedEventArgs * This); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_FrameReference )( + IBodyFrameArrivedEventArgs * This, + /* [annotation][out][retval] */ + _COM_Outptr_ IBodyFrameReference **bodyFrameReference); + + END_INTERFACE + } IBodyFrameArrivedEventArgsVtbl; + + interface IBodyFrameArrivedEventArgs + { + CONST_VTBL struct IBodyFrameArrivedEventArgsVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IBodyFrameArrivedEventArgs_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IBodyFrameArrivedEventArgs_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IBodyFrameArrivedEventArgs_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IBodyFrameArrivedEventArgs_get_FrameReference(This,bodyFrameReference) \ + ( (This)->lpVtbl -> get_FrameReference(This,bodyFrameReference) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IBodyFrameArrivedEventArgs_INTERFACE_DEFINED__ */ + + +#ifndef __IBodyFrameSource_INTERFACE_DEFINED__ +#define __IBodyFrameSource_INTERFACE_DEFINED__ + +/* interface IBodyFrameSource */ +/* [object][local][uuid] */ + + +EXTERN_C const IID IID_IBodyFrameSource; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("BB94A78A-458C-4608-AC69-34FEAD1E3BAE") + IBodyFrameSource : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE SubscribeFrameCaptured( + /* [annotation][out][retval] */ + _Out_ WAITABLE_HANDLE *waitableHandle) = 0; + + virtual HRESULT STDMETHODCALLTYPE UnsubscribeFrameCaptured( + /* [annotation][in] */ + _In_ WAITABLE_HANDLE waitableHandle) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetFrameCapturedEventData( + /* [annotation][in] */ + _In_ WAITABLE_HANDLE waitableHandle, + /* [annotation][out][retval] */ + _Out_ IFrameCapturedEventArgs **eventData) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_IsActive( + /* [annotation][out][retval] */ + _Out_ BOOLEAN *isActive) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_BodyCount( + /* [annotation][out][retval] */ + _Out_ INT32 *bodyCount) = 0; + + virtual HRESULT STDMETHODCALLTYPE OpenReader( + /* [annotation][out][retval] */ + _COM_Outptr_ IBodyFrameReader **reader) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_KinectSensor( + /* [annotation][out][retval] */ + _COM_Outptr_ IKinectSensor **sensor) = 0; + + virtual HRESULT STDMETHODCALLTYPE OverrideHandTracking( + UINT64 trackingId) = 0; + + virtual HRESULT STDMETHODCALLTYPE OverrideAndReplaceHandTracking( + UINT64 oldTrackingId, + UINT64 newTrackingId) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IBodyFrameSourceVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IBodyFrameSource * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IBodyFrameSource * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IBodyFrameSource * This); + + HRESULT ( STDMETHODCALLTYPE *SubscribeFrameCaptured )( + IBodyFrameSource * This, + /* [annotation][out][retval] */ + _Out_ WAITABLE_HANDLE *waitableHandle); + + HRESULT ( STDMETHODCALLTYPE *UnsubscribeFrameCaptured )( + IBodyFrameSource * This, + /* [annotation][in] */ + _In_ WAITABLE_HANDLE waitableHandle); + + HRESULT ( STDMETHODCALLTYPE *GetFrameCapturedEventData )( + IBodyFrameSource * This, + /* [annotation][in] */ + _In_ WAITABLE_HANDLE waitableHandle, + /* [annotation][out][retval] */ + _Out_ IFrameCapturedEventArgs **eventData); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_IsActive )( + IBodyFrameSource * This, + /* [annotation][out][retval] */ + _Out_ BOOLEAN *isActive); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_BodyCount )( + IBodyFrameSource * This, + /* [annotation][out][retval] */ + _Out_ INT32 *bodyCount); + + HRESULT ( STDMETHODCALLTYPE *OpenReader )( + IBodyFrameSource * This, + /* [annotation][out][retval] */ + _COM_Outptr_ IBodyFrameReader **reader); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_KinectSensor )( + IBodyFrameSource * This, + /* [annotation][out][retval] */ + _COM_Outptr_ IKinectSensor **sensor); + + HRESULT ( STDMETHODCALLTYPE *OverrideHandTracking )( + IBodyFrameSource * This, + UINT64 trackingId); + + HRESULT ( STDMETHODCALLTYPE *OverrideAndReplaceHandTracking )( + IBodyFrameSource * This, + UINT64 oldTrackingId, + UINT64 newTrackingId); + + END_INTERFACE + } IBodyFrameSourceVtbl; + + interface IBodyFrameSource + { + CONST_VTBL struct IBodyFrameSourceVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IBodyFrameSource_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IBodyFrameSource_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IBodyFrameSource_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IBodyFrameSource_SubscribeFrameCaptured(This,waitableHandle) \ + ( (This)->lpVtbl -> SubscribeFrameCaptured(This,waitableHandle) ) + +#define IBodyFrameSource_UnsubscribeFrameCaptured(This,waitableHandle) \ + ( (This)->lpVtbl -> UnsubscribeFrameCaptured(This,waitableHandle) ) + +#define IBodyFrameSource_GetFrameCapturedEventData(This,waitableHandle,eventData) \ + ( (This)->lpVtbl -> GetFrameCapturedEventData(This,waitableHandle,eventData) ) + +#define IBodyFrameSource_get_IsActive(This,isActive) \ + ( (This)->lpVtbl -> get_IsActive(This,isActive) ) + +#define IBodyFrameSource_get_BodyCount(This,bodyCount) \ + ( (This)->lpVtbl -> get_BodyCount(This,bodyCount) ) + +#define IBodyFrameSource_OpenReader(This,reader) \ + ( (This)->lpVtbl -> OpenReader(This,reader) ) + +#define IBodyFrameSource_get_KinectSensor(This,sensor) \ + ( (This)->lpVtbl -> get_KinectSensor(This,sensor) ) + +#define IBodyFrameSource_OverrideHandTracking(This,trackingId) \ + ( (This)->lpVtbl -> OverrideHandTracking(This,trackingId) ) + +#define IBodyFrameSource_OverrideAndReplaceHandTracking(This,oldTrackingId,newTrackingId) \ + ( (This)->lpVtbl -> OverrideAndReplaceHandTracking(This,oldTrackingId,newTrackingId) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IBodyFrameSource_INTERFACE_DEFINED__ */ + + +#ifndef __IBodyFrameReader_INTERFACE_DEFINED__ +#define __IBodyFrameReader_INTERFACE_DEFINED__ + +/* interface IBodyFrameReader */ +/* [object][local][uuid] */ + + +EXTERN_C const IID IID_IBodyFrameReader; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("45532DF5-A63C-418F-A39F-C567936BC051") + IBodyFrameReader : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE SubscribeFrameArrived( + /* [annotation][out][retval] */ + _Out_ WAITABLE_HANDLE *waitableHandle) = 0; + + virtual HRESULT STDMETHODCALLTYPE UnsubscribeFrameArrived( + /* [annotation][in] */ + _In_ WAITABLE_HANDLE waitableHandle) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetFrameArrivedEventData( + /* [annotation][in] */ + _In_ WAITABLE_HANDLE waitableHandle, + /* [annotation][out][retval] */ + _Out_ IBodyFrameArrivedEventArgs **eventData) = 0; + + virtual HRESULT STDMETHODCALLTYPE AcquireLatestFrame( + /* [annotation][out][retval] */ + _COM_Outptr_ IBodyFrame **bodyFrame) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_IsPaused( + /* [annotation][out][retval] */ + _Out_ BOOLEAN *isPaused) = 0; + + virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_IsPaused( + BOOLEAN isPaused) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_BodyFrameSource( + /* [annotation][out][retval] */ + _COM_Outptr_ IBodyFrameSource **bodyFrameSource) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IBodyFrameReaderVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IBodyFrameReader * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IBodyFrameReader * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IBodyFrameReader * This); + + HRESULT ( STDMETHODCALLTYPE *SubscribeFrameArrived )( + IBodyFrameReader * This, + /* [annotation][out][retval] */ + _Out_ WAITABLE_HANDLE *waitableHandle); + + HRESULT ( STDMETHODCALLTYPE *UnsubscribeFrameArrived )( + IBodyFrameReader * This, + /* [annotation][in] */ + _In_ WAITABLE_HANDLE waitableHandle); + + HRESULT ( STDMETHODCALLTYPE *GetFrameArrivedEventData )( + IBodyFrameReader * This, + /* [annotation][in] */ + _In_ WAITABLE_HANDLE waitableHandle, + /* [annotation][out][retval] */ + _Out_ IBodyFrameArrivedEventArgs **eventData); + + HRESULT ( STDMETHODCALLTYPE *AcquireLatestFrame )( + IBodyFrameReader * This, + /* [annotation][out][retval] */ + _COM_Outptr_ IBodyFrame **bodyFrame); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_IsPaused )( + IBodyFrameReader * This, + /* [annotation][out][retval] */ + _Out_ BOOLEAN *isPaused); + + /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_IsPaused )( + IBodyFrameReader * This, + BOOLEAN isPaused); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_BodyFrameSource )( + IBodyFrameReader * This, + /* [annotation][out][retval] */ + _COM_Outptr_ IBodyFrameSource **bodyFrameSource); + + END_INTERFACE + } IBodyFrameReaderVtbl; + + interface IBodyFrameReader + { + CONST_VTBL struct IBodyFrameReaderVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IBodyFrameReader_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IBodyFrameReader_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IBodyFrameReader_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IBodyFrameReader_SubscribeFrameArrived(This,waitableHandle) \ + ( (This)->lpVtbl -> SubscribeFrameArrived(This,waitableHandle) ) + +#define IBodyFrameReader_UnsubscribeFrameArrived(This,waitableHandle) \ + ( (This)->lpVtbl -> UnsubscribeFrameArrived(This,waitableHandle) ) + +#define IBodyFrameReader_GetFrameArrivedEventData(This,waitableHandle,eventData) \ + ( (This)->lpVtbl -> GetFrameArrivedEventData(This,waitableHandle,eventData) ) + +#define IBodyFrameReader_AcquireLatestFrame(This,bodyFrame) \ + ( (This)->lpVtbl -> AcquireLatestFrame(This,bodyFrame) ) + +#define IBodyFrameReader_get_IsPaused(This,isPaused) \ + ( (This)->lpVtbl -> get_IsPaused(This,isPaused) ) + +#define IBodyFrameReader_put_IsPaused(This,isPaused) \ + ( (This)->lpVtbl -> put_IsPaused(This,isPaused) ) + +#define IBodyFrameReader_get_BodyFrameSource(This,bodyFrameSource) \ + ( (This)->lpVtbl -> get_BodyFrameSource(This,bodyFrameSource) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IBodyFrameReader_INTERFACE_DEFINED__ */ + + +#ifndef __IBodyFrame_INTERFACE_DEFINED__ +#define __IBodyFrame_INTERFACE_DEFINED__ + +/* interface IBodyFrame */ +/* [object][local][uuid] */ + + +EXTERN_C const IID IID_IBodyFrame; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("52884F1F-94D7-4B57-BF87-9226950980D5") + IBodyFrame : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE GetAndRefreshBodyData( + UINT capacity, + /* [annotation][size_is][out][in] */ + _Inout_updates_all_(capacity) IBody **bodies) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_FloorClipPlane( + /* [annotation][out][retval] */ + _Out_ Vector4 *floorClipPlane) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_RelativeTime( + /* [annotation][out][retval] */ + _Out_ TIMESPAN *relativeTime) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_BodyFrameSource( + /* [annotation][out][retval] */ + _COM_Outptr_ IBodyFrameSource **bodyFrameSource) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IBodyFrameVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IBodyFrame * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IBodyFrame * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IBodyFrame * This); + + HRESULT ( STDMETHODCALLTYPE *GetAndRefreshBodyData )( + IBodyFrame * This, + UINT capacity, + /* [annotation][size_is][out][in] */ + _Inout_updates_all_(capacity) IBody **bodies); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_FloorClipPlane )( + IBodyFrame * This, + /* [annotation][out][retval] */ + _Out_ Vector4 *floorClipPlane); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_RelativeTime )( + IBodyFrame * This, + /* [annotation][out][retval] */ + _Out_ TIMESPAN *relativeTime); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_BodyFrameSource )( + IBodyFrame * This, + /* [annotation][out][retval] */ + _COM_Outptr_ IBodyFrameSource **bodyFrameSource); + + END_INTERFACE + } IBodyFrameVtbl; + + interface IBodyFrame + { + CONST_VTBL struct IBodyFrameVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IBodyFrame_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IBodyFrame_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IBodyFrame_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IBodyFrame_GetAndRefreshBodyData(This,capacity,bodies) \ + ( (This)->lpVtbl -> GetAndRefreshBodyData(This,capacity,bodies) ) + +#define IBodyFrame_get_FloorClipPlane(This,floorClipPlane) \ + ( (This)->lpVtbl -> get_FloorClipPlane(This,floorClipPlane) ) + +#define IBodyFrame_get_RelativeTime(This,relativeTime) \ + ( (This)->lpVtbl -> get_RelativeTime(This,relativeTime) ) + +#define IBodyFrame_get_BodyFrameSource(This,bodyFrameSource) \ + ( (This)->lpVtbl -> get_BodyFrameSource(This,bodyFrameSource) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IBodyFrame_INTERFACE_DEFINED__ */ + + +#ifndef __IBody_INTERFACE_DEFINED__ +#define __IBody_INTERFACE_DEFINED__ + +/* interface IBody */ +/* [object][local][uuid] */ + + +EXTERN_C const IID IID_IBody; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("46AEF731-98B0-4D18-827B-933758678F4A") + IBody : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE GetJoints( + /* [annotation] */ + _Pre_equal_to_(JointType_Count) UINT capacity, + /* [annotation][size_is][out] */ + _Out_writes_all_(capacity) Joint *joints) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetJointOrientations( + /* [annotation] */ + _Pre_equal_to_(JointType_Count) UINT capacity, + /* [annotation][size_is][out] */ + _Out_writes_all_(capacity) JointOrientation *jointOrientations) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Engaged( + /* [annotation][out][retval] */ + _Out_ DetectionResult *detectionResult) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetExpressionDetectionResults( + /* [annotation] */ + _Pre_equal_to_(Expression_Count) UINT capacity, + /* [annotation][size_is][out] */ + _Out_writes_all_(capacity) DetectionResult *detectionResults) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetActivityDetectionResults( + /* [annotation] */ + _Pre_equal_to_(Activity_Count) UINT capacity, + /* [annotation][size_is][out] */ + _Out_writes_all_(capacity) DetectionResult *detectionResults) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetAppearanceDetectionResults( + /* [annotation] */ + _Pre_equal_to_(Appearance_Count) UINT capacity, + /* [annotation][size_is][out] */ + _Out_writes_all_(capacity) DetectionResult *detectionResults) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_HandLeftState( + /* [annotation][out][retval] */ + _Out_ HandState *handState) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_HandLeftConfidence( + /* [annotation][out][retval] */ + _Out_ TrackingConfidence *confidence) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_HandRightState( + /* [annotation][out][retval] */ + _Out_ HandState *handState) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_HandRightConfidence( + /* [annotation][out][retval] */ + _Out_ TrackingConfidence *confidence) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_ClippedEdges( + /* [annotation][out][retval] */ + _Out_ DWORD *clippedEdges) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_TrackingId( + /* [annotation][out][retval] */ + _Out_ UINT64 *trackingId) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_IsTracked( + /* [annotation][out][retval] */ + _Out_ BOOLEAN *tracked) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_IsRestricted( + /* [annotation][out][retval] */ + _Out_ BOOLEAN *isRestricted) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Lean( + /* [annotation][out][retval] */ + _Out_ PointF *amount) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_LeanTrackingState( + /* [annotation][out][retval] */ + _Out_ TrackingState *trackingState) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IBodyVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IBody * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IBody * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IBody * This); + + HRESULT ( STDMETHODCALLTYPE *GetJoints )( + IBody * This, + /* [annotation] */ + _Pre_equal_to_(JointType_Count) UINT capacity, + /* [annotation][size_is][out] */ + _Out_writes_all_(capacity) Joint *joints); + + HRESULT ( STDMETHODCALLTYPE *GetJointOrientations )( + IBody * This, + /* [annotation] */ + _Pre_equal_to_(JointType_Count) UINT capacity, + /* [annotation][size_is][out] */ + _Out_writes_all_(capacity) JointOrientation *jointOrientations); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Engaged )( + IBody * This, + /* [annotation][out][retval] */ + _Out_ DetectionResult *detectionResult); + + HRESULT ( STDMETHODCALLTYPE *GetExpressionDetectionResults )( + IBody * This, + /* [annotation] */ + _Pre_equal_to_(Expression_Count) UINT capacity, + /* [annotation][size_is][out] */ + _Out_writes_all_(capacity) DetectionResult *detectionResults); + + HRESULT ( STDMETHODCALLTYPE *GetActivityDetectionResults )( + IBody * This, + /* [annotation] */ + _Pre_equal_to_(Activity_Count) UINT capacity, + /* [annotation][size_is][out] */ + _Out_writes_all_(capacity) DetectionResult *detectionResults); + + HRESULT ( STDMETHODCALLTYPE *GetAppearanceDetectionResults )( + IBody * This, + /* [annotation] */ + _Pre_equal_to_(Appearance_Count) UINT capacity, + /* [annotation][size_is][out] */ + _Out_writes_all_(capacity) DetectionResult *detectionResults); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_HandLeftState )( + IBody * This, + /* [annotation][out][retval] */ + _Out_ HandState *handState); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_HandLeftConfidence )( + IBody * This, + /* [annotation][out][retval] */ + _Out_ TrackingConfidence *confidence); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_HandRightState )( + IBody * This, + /* [annotation][out][retval] */ + _Out_ HandState *handState); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_HandRightConfidence )( + IBody * This, + /* [annotation][out][retval] */ + _Out_ TrackingConfidence *confidence); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_ClippedEdges )( + IBody * This, + /* [annotation][out][retval] */ + _Out_ DWORD *clippedEdges); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_TrackingId )( + IBody * This, + /* [annotation][out][retval] */ + _Out_ UINT64 *trackingId); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_IsTracked )( + IBody * This, + /* [annotation][out][retval] */ + _Out_ BOOLEAN *tracked); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_IsRestricted )( + IBody * This, + /* [annotation][out][retval] */ + _Out_ BOOLEAN *isRestricted); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Lean )( + IBody * This, + /* [annotation][out][retval] */ + _Out_ PointF *amount); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_LeanTrackingState )( + IBody * This, + /* [annotation][out][retval] */ + _Out_ TrackingState *trackingState); + + END_INTERFACE + } IBodyVtbl; + + interface IBody + { + CONST_VTBL struct IBodyVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IBody_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IBody_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IBody_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IBody_GetJoints(This,capacity,joints) \ + ( (This)->lpVtbl -> GetJoints(This,capacity,joints) ) + +#define IBody_GetJointOrientations(This,capacity,jointOrientations) \ + ( (This)->lpVtbl -> GetJointOrientations(This,capacity,jointOrientations) ) + +#define IBody_get_Engaged(This,detectionResult) \ + ( (This)->lpVtbl -> get_Engaged(This,detectionResult) ) + +#define IBody_GetExpressionDetectionResults(This,capacity,detectionResults) \ + ( (This)->lpVtbl -> GetExpressionDetectionResults(This,capacity,detectionResults) ) + +#define IBody_GetActivityDetectionResults(This,capacity,detectionResults) \ + ( (This)->lpVtbl -> GetActivityDetectionResults(This,capacity,detectionResults) ) + +#define IBody_GetAppearanceDetectionResults(This,capacity,detectionResults) \ + ( (This)->lpVtbl -> GetAppearanceDetectionResults(This,capacity,detectionResults) ) + +#define IBody_get_HandLeftState(This,handState) \ + ( (This)->lpVtbl -> get_HandLeftState(This,handState) ) + +#define IBody_get_HandLeftConfidence(This,confidence) \ + ( (This)->lpVtbl -> get_HandLeftConfidence(This,confidence) ) + +#define IBody_get_HandRightState(This,handState) \ + ( (This)->lpVtbl -> get_HandRightState(This,handState) ) + +#define IBody_get_HandRightConfidence(This,confidence) \ + ( (This)->lpVtbl -> get_HandRightConfidence(This,confidence) ) + +#define IBody_get_ClippedEdges(This,clippedEdges) \ + ( (This)->lpVtbl -> get_ClippedEdges(This,clippedEdges) ) + +#define IBody_get_TrackingId(This,trackingId) \ + ( (This)->lpVtbl -> get_TrackingId(This,trackingId) ) + +#define IBody_get_IsTracked(This,tracked) \ + ( (This)->lpVtbl -> get_IsTracked(This,tracked) ) + +#define IBody_get_IsRestricted(This,isRestricted) \ + ( (This)->lpVtbl -> get_IsRestricted(This,isRestricted) ) + +#define IBody_get_Lean(This,amount) \ + ( (This)->lpVtbl -> get_Lean(This,amount) ) + +#define IBody_get_LeanTrackingState(This,trackingState) \ + ( (This)->lpVtbl -> get_LeanTrackingState(This,trackingState) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IBody_INTERFACE_DEFINED__ */ + + +#ifndef __IBodyIndexFrameReference_INTERFACE_DEFINED__ +#define __IBodyIndexFrameReference_INTERFACE_DEFINED__ + +/* interface IBodyIndexFrameReference */ +/* [object][local][uuid] */ + + +EXTERN_C const IID IID_IBodyIndexFrameReference; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("D0EA0519-F7E7-4B1E-B3D8-03B3C002795F") + IBodyIndexFrameReference : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE AcquireFrame( + /* [annotation][out][retval] */ + _COM_Outptr_ IBodyIndexFrame **bodyIndexFrame) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_RelativeTime( + /* [annotation][out][retval] */ + _Out_ TIMESPAN *relativeTime) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IBodyIndexFrameReferenceVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IBodyIndexFrameReference * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IBodyIndexFrameReference * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IBodyIndexFrameReference * This); + + HRESULT ( STDMETHODCALLTYPE *AcquireFrame )( + IBodyIndexFrameReference * This, + /* [annotation][out][retval] */ + _COM_Outptr_ IBodyIndexFrame **bodyIndexFrame); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_RelativeTime )( + IBodyIndexFrameReference * This, + /* [annotation][out][retval] */ + _Out_ TIMESPAN *relativeTime); + + END_INTERFACE + } IBodyIndexFrameReferenceVtbl; + + interface IBodyIndexFrameReference + { + CONST_VTBL struct IBodyIndexFrameReferenceVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IBodyIndexFrameReference_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IBodyIndexFrameReference_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IBodyIndexFrameReference_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IBodyIndexFrameReference_AcquireFrame(This,bodyIndexFrame) \ + ( (This)->lpVtbl -> AcquireFrame(This,bodyIndexFrame) ) + +#define IBodyIndexFrameReference_get_RelativeTime(This,relativeTime) \ + ( (This)->lpVtbl -> get_RelativeTime(This,relativeTime) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IBodyIndexFrameReference_INTERFACE_DEFINED__ */ + + +#ifndef __IBodyIndexFrameArrivedEventArgs_INTERFACE_DEFINED__ +#define __IBodyIndexFrameArrivedEventArgs_INTERFACE_DEFINED__ + +/* interface IBodyIndexFrameArrivedEventArgs */ +/* [object][local][uuid] */ + + +EXTERN_C const IID IID_IBodyIndexFrameArrivedEventArgs; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("10B7E92E-B4F2-4A36-A459-06B2A4B249DF") + IBodyIndexFrameArrivedEventArgs : public IUnknown + { + public: + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_FrameReference( + /* [annotation][out][retval] */ + _COM_Outptr_ IBodyIndexFrameReference **bodyIndexFrameReference) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IBodyIndexFrameArrivedEventArgsVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IBodyIndexFrameArrivedEventArgs * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IBodyIndexFrameArrivedEventArgs * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IBodyIndexFrameArrivedEventArgs * This); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_FrameReference )( + IBodyIndexFrameArrivedEventArgs * This, + /* [annotation][out][retval] */ + _COM_Outptr_ IBodyIndexFrameReference **bodyIndexFrameReference); + + END_INTERFACE + } IBodyIndexFrameArrivedEventArgsVtbl; + + interface IBodyIndexFrameArrivedEventArgs + { + CONST_VTBL struct IBodyIndexFrameArrivedEventArgsVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IBodyIndexFrameArrivedEventArgs_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IBodyIndexFrameArrivedEventArgs_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IBodyIndexFrameArrivedEventArgs_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IBodyIndexFrameArrivedEventArgs_get_FrameReference(This,bodyIndexFrameReference) \ + ( (This)->lpVtbl -> get_FrameReference(This,bodyIndexFrameReference) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IBodyIndexFrameArrivedEventArgs_INTERFACE_DEFINED__ */ + + +#ifndef __IBodyIndexFrameSource_INTERFACE_DEFINED__ +#define __IBodyIndexFrameSource_INTERFACE_DEFINED__ + +/* interface IBodyIndexFrameSource */ +/* [object][local][uuid] */ + + +EXTERN_C const IID IID_IBodyIndexFrameSource; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("010F2A40-DC58-44A5-8E57-329A583FEC08") + IBodyIndexFrameSource : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE SubscribeFrameCaptured( + /* [annotation][out][retval] */ + _Out_ WAITABLE_HANDLE *waitableHandle) = 0; + + virtual HRESULT STDMETHODCALLTYPE UnsubscribeFrameCaptured( + /* [annotation][in] */ + _In_ WAITABLE_HANDLE waitableHandle) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetFrameCapturedEventData( + /* [annotation][in] */ + _In_ WAITABLE_HANDLE waitableHandle, + /* [annotation][out][retval] */ + _Out_ IFrameCapturedEventArgs **eventData) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_IsActive( + /* [annotation][out][retval] */ + _Out_ BOOLEAN *isActive) = 0; + + virtual HRESULT STDMETHODCALLTYPE OpenReader( + /* [annotation][out][retval] */ + _COM_Outptr_ IBodyIndexFrameReader **reader) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_FrameDescription( + /* [annotation][out][retval] */ + _COM_Outptr_ IFrameDescription **frameDescription) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_KinectSensor( + /* [annotation][out][retval] */ + _COM_Outptr_ IKinectSensor **sensor) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IBodyIndexFrameSourceVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IBodyIndexFrameSource * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IBodyIndexFrameSource * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IBodyIndexFrameSource * This); + + HRESULT ( STDMETHODCALLTYPE *SubscribeFrameCaptured )( + IBodyIndexFrameSource * This, + /* [annotation][out][retval] */ + _Out_ WAITABLE_HANDLE *waitableHandle); + + HRESULT ( STDMETHODCALLTYPE *UnsubscribeFrameCaptured )( + IBodyIndexFrameSource * This, + /* [annotation][in] */ + _In_ WAITABLE_HANDLE waitableHandle); + + HRESULT ( STDMETHODCALLTYPE *GetFrameCapturedEventData )( + IBodyIndexFrameSource * This, + /* [annotation][in] */ + _In_ WAITABLE_HANDLE waitableHandle, + /* [annotation][out][retval] */ + _Out_ IFrameCapturedEventArgs **eventData); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_IsActive )( + IBodyIndexFrameSource * This, + /* [annotation][out][retval] */ + _Out_ BOOLEAN *isActive); + + HRESULT ( STDMETHODCALLTYPE *OpenReader )( + IBodyIndexFrameSource * This, + /* [annotation][out][retval] */ + _COM_Outptr_ IBodyIndexFrameReader **reader); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_FrameDescription )( + IBodyIndexFrameSource * This, + /* [annotation][out][retval] */ + _COM_Outptr_ IFrameDescription **frameDescription); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_KinectSensor )( + IBodyIndexFrameSource * This, + /* [annotation][out][retval] */ + _COM_Outptr_ IKinectSensor **sensor); + + END_INTERFACE + } IBodyIndexFrameSourceVtbl; + + interface IBodyIndexFrameSource + { + CONST_VTBL struct IBodyIndexFrameSourceVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IBodyIndexFrameSource_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IBodyIndexFrameSource_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IBodyIndexFrameSource_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IBodyIndexFrameSource_SubscribeFrameCaptured(This,waitableHandle) \ + ( (This)->lpVtbl -> SubscribeFrameCaptured(This,waitableHandle) ) + +#define IBodyIndexFrameSource_UnsubscribeFrameCaptured(This,waitableHandle) \ + ( (This)->lpVtbl -> UnsubscribeFrameCaptured(This,waitableHandle) ) + +#define IBodyIndexFrameSource_GetFrameCapturedEventData(This,waitableHandle,eventData) \ + ( (This)->lpVtbl -> GetFrameCapturedEventData(This,waitableHandle,eventData) ) + +#define IBodyIndexFrameSource_get_IsActive(This,isActive) \ + ( (This)->lpVtbl -> get_IsActive(This,isActive) ) + +#define IBodyIndexFrameSource_OpenReader(This,reader) \ + ( (This)->lpVtbl -> OpenReader(This,reader) ) + +#define IBodyIndexFrameSource_get_FrameDescription(This,frameDescription) \ + ( (This)->lpVtbl -> get_FrameDescription(This,frameDescription) ) + +#define IBodyIndexFrameSource_get_KinectSensor(This,sensor) \ + ( (This)->lpVtbl -> get_KinectSensor(This,sensor) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IBodyIndexFrameSource_INTERFACE_DEFINED__ */ + + +#ifndef __IBodyIndexFrameReader_INTERFACE_DEFINED__ +#define __IBodyIndexFrameReader_INTERFACE_DEFINED__ + +/* interface IBodyIndexFrameReader */ +/* [object][local][uuid] */ + + +EXTERN_C const IID IID_IBodyIndexFrameReader; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("E9724AA1-EBFA-48F8-9044-E0BE33383B8B") + IBodyIndexFrameReader : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE SubscribeFrameArrived( + /* [annotation][out][retval] */ + _Out_ WAITABLE_HANDLE *waitableHandle) = 0; + + virtual HRESULT STDMETHODCALLTYPE UnsubscribeFrameArrived( + /* [annotation][in] */ + _In_ WAITABLE_HANDLE waitableHandle) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetFrameArrivedEventData( + /* [annotation][in] */ + _In_ WAITABLE_HANDLE waitableHandle, + /* [annotation][out][retval] */ + _Out_ IBodyIndexFrameArrivedEventArgs **eventData) = 0; + + virtual HRESULT STDMETHODCALLTYPE AcquireLatestFrame( + /* [annotation][out][retval] */ + _COM_Outptr_ IBodyIndexFrame **bodyIndexFrame) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_IsPaused( + /* [annotation][out][retval] */ + _Out_ BOOLEAN *isPaused) = 0; + + virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_IsPaused( + BOOLEAN isPaused) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_BodyIndexFrameSource( + /* [annotation][out][retval] */ + _COM_Outptr_ IBodyIndexFrameSource **bodyIndexFrameSource) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IBodyIndexFrameReaderVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IBodyIndexFrameReader * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IBodyIndexFrameReader * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IBodyIndexFrameReader * This); + + HRESULT ( STDMETHODCALLTYPE *SubscribeFrameArrived )( + IBodyIndexFrameReader * This, + /* [annotation][out][retval] */ + _Out_ WAITABLE_HANDLE *waitableHandle); + + HRESULT ( STDMETHODCALLTYPE *UnsubscribeFrameArrived )( + IBodyIndexFrameReader * This, + /* [annotation][in] */ + _In_ WAITABLE_HANDLE waitableHandle); + + HRESULT ( STDMETHODCALLTYPE *GetFrameArrivedEventData )( + IBodyIndexFrameReader * This, + /* [annotation][in] */ + _In_ WAITABLE_HANDLE waitableHandle, + /* [annotation][out][retval] */ + _Out_ IBodyIndexFrameArrivedEventArgs **eventData); + + HRESULT ( STDMETHODCALLTYPE *AcquireLatestFrame )( + IBodyIndexFrameReader * This, + /* [annotation][out][retval] */ + _COM_Outptr_ IBodyIndexFrame **bodyIndexFrame); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_IsPaused )( + IBodyIndexFrameReader * This, + /* [annotation][out][retval] */ + _Out_ BOOLEAN *isPaused); + + /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_IsPaused )( + IBodyIndexFrameReader * This, + BOOLEAN isPaused); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_BodyIndexFrameSource )( + IBodyIndexFrameReader * This, + /* [annotation][out][retval] */ + _COM_Outptr_ IBodyIndexFrameSource **bodyIndexFrameSource); + + END_INTERFACE + } IBodyIndexFrameReaderVtbl; + + interface IBodyIndexFrameReader + { + CONST_VTBL struct IBodyIndexFrameReaderVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IBodyIndexFrameReader_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IBodyIndexFrameReader_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IBodyIndexFrameReader_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IBodyIndexFrameReader_SubscribeFrameArrived(This,waitableHandle) \ + ( (This)->lpVtbl -> SubscribeFrameArrived(This,waitableHandle) ) + +#define IBodyIndexFrameReader_UnsubscribeFrameArrived(This,waitableHandle) \ + ( (This)->lpVtbl -> UnsubscribeFrameArrived(This,waitableHandle) ) + +#define IBodyIndexFrameReader_GetFrameArrivedEventData(This,waitableHandle,eventData) \ + ( (This)->lpVtbl -> GetFrameArrivedEventData(This,waitableHandle,eventData) ) + +#define IBodyIndexFrameReader_AcquireLatestFrame(This,bodyIndexFrame) \ + ( (This)->lpVtbl -> AcquireLatestFrame(This,bodyIndexFrame) ) + +#define IBodyIndexFrameReader_get_IsPaused(This,isPaused) \ + ( (This)->lpVtbl -> get_IsPaused(This,isPaused) ) + +#define IBodyIndexFrameReader_put_IsPaused(This,isPaused) \ + ( (This)->lpVtbl -> put_IsPaused(This,isPaused) ) + +#define IBodyIndexFrameReader_get_BodyIndexFrameSource(This,bodyIndexFrameSource) \ + ( (This)->lpVtbl -> get_BodyIndexFrameSource(This,bodyIndexFrameSource) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IBodyIndexFrameReader_INTERFACE_DEFINED__ */ + + +#ifndef __IBodyIndexFrame_INTERFACE_DEFINED__ +#define __IBodyIndexFrame_INTERFACE_DEFINED__ + +/* interface IBodyIndexFrame */ +/* [object][local][uuid] */ + + +EXTERN_C const IID IID_IBodyIndexFrame; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("2CEA0C07-F90C-44DF-A18C-F4D18075EA6B") + IBodyIndexFrame : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE CopyFrameDataToArray( + UINT capacity, + /* [annotation][size_is][out] */ + _Out_writes_all_(capacity) BYTE *frameData) = 0; + + virtual HRESULT STDMETHODCALLTYPE AccessUnderlyingBuffer( + /* [annotation][out] */ + _Out_ UINT *capacity, + /* [annotation][size_is][size_is][out] */ + _Outptr_result_buffer_(*capacity) BYTE **buffer) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_FrameDescription( + /* [annotation][out][retval] */ + _COM_Outptr_ IFrameDescription **frameDescription) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_RelativeTime( + /* [annotation][out][retval] */ + _Out_ TIMESPAN *relativeTime) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_BodyIndexFrameSource( + /* [annotation][out][retval] */ + _COM_Outptr_ IBodyIndexFrameSource **bodyIndexFrameSource) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IBodyIndexFrameVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IBodyIndexFrame * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IBodyIndexFrame * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IBodyIndexFrame * This); + + HRESULT ( STDMETHODCALLTYPE *CopyFrameDataToArray )( + IBodyIndexFrame * This, + UINT capacity, + /* [annotation][size_is][out] */ + _Out_writes_all_(capacity) BYTE *frameData); + + HRESULT ( STDMETHODCALLTYPE *AccessUnderlyingBuffer )( + IBodyIndexFrame * This, + /* [annotation][out] */ + _Out_ UINT *capacity, + /* [annotation][size_is][size_is][out] */ + _Outptr_result_buffer_(*capacity) BYTE **buffer); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_FrameDescription )( + IBodyIndexFrame * This, + /* [annotation][out][retval] */ + _COM_Outptr_ IFrameDescription **frameDescription); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_RelativeTime )( + IBodyIndexFrame * This, + /* [annotation][out][retval] */ + _Out_ TIMESPAN *relativeTime); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_BodyIndexFrameSource )( + IBodyIndexFrame * This, + /* [annotation][out][retval] */ + _COM_Outptr_ IBodyIndexFrameSource **bodyIndexFrameSource); + + END_INTERFACE + } IBodyIndexFrameVtbl; + + interface IBodyIndexFrame + { + CONST_VTBL struct IBodyIndexFrameVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IBodyIndexFrame_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IBodyIndexFrame_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IBodyIndexFrame_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IBodyIndexFrame_CopyFrameDataToArray(This,capacity,frameData) \ + ( (This)->lpVtbl -> CopyFrameDataToArray(This,capacity,frameData) ) + +#define IBodyIndexFrame_AccessUnderlyingBuffer(This,capacity,buffer) \ + ( (This)->lpVtbl -> AccessUnderlyingBuffer(This,capacity,buffer) ) + +#define IBodyIndexFrame_get_FrameDescription(This,frameDescription) \ + ( (This)->lpVtbl -> get_FrameDescription(This,frameDescription) ) + +#define IBodyIndexFrame_get_RelativeTime(This,relativeTime) \ + ( (This)->lpVtbl -> get_RelativeTime(This,relativeTime) ) + +#define IBodyIndexFrame_get_BodyIndexFrameSource(This,bodyIndexFrameSource) \ + ( (This)->lpVtbl -> get_BodyIndexFrameSource(This,bodyIndexFrameSource) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IBodyIndexFrame_INTERFACE_DEFINED__ */ + + +#ifndef __IInfraredFrameReference_INTERFACE_DEFINED__ +#define __IInfraredFrameReference_INTERFACE_DEFINED__ + +/* interface IInfraredFrameReference */ +/* [object][local][uuid] */ + + +EXTERN_C const IID IID_IInfraredFrameReference; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("60183D5B-DED5-4D5C-AE59-64C7724FE5FE") + IInfraredFrameReference : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE AcquireFrame( + /* [annotation][out][retval] */ + _COM_Outptr_ IInfraredFrame **infraredFrame) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_RelativeTime( + /* [annotation][out][retval] */ + _Out_ TIMESPAN *relativeTime) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IInfraredFrameReferenceVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IInfraredFrameReference * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IInfraredFrameReference * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IInfraredFrameReference * This); + + HRESULT ( STDMETHODCALLTYPE *AcquireFrame )( + IInfraredFrameReference * This, + /* [annotation][out][retval] */ + _COM_Outptr_ IInfraredFrame **infraredFrame); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_RelativeTime )( + IInfraredFrameReference * This, + /* [annotation][out][retval] */ + _Out_ TIMESPAN *relativeTime); + + END_INTERFACE + } IInfraredFrameReferenceVtbl; + + interface IInfraredFrameReference + { + CONST_VTBL struct IInfraredFrameReferenceVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IInfraredFrameReference_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IInfraredFrameReference_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IInfraredFrameReference_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IInfraredFrameReference_AcquireFrame(This,infraredFrame) \ + ( (This)->lpVtbl -> AcquireFrame(This,infraredFrame) ) + +#define IInfraredFrameReference_get_RelativeTime(This,relativeTime) \ + ( (This)->lpVtbl -> get_RelativeTime(This,relativeTime) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IInfraredFrameReference_INTERFACE_DEFINED__ */ + + +#ifndef __IInfraredFrameArrivedEventArgs_INTERFACE_DEFINED__ +#define __IInfraredFrameArrivedEventArgs_INTERFACE_DEFINED__ + +/* interface IInfraredFrameArrivedEventArgs */ +/* [object][local][uuid] */ + + +EXTERN_C const IID IID_IInfraredFrameArrivedEventArgs; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("7E17F78E-D9D1-4448-90C2-4E50EC4ECEE9") + IInfraredFrameArrivedEventArgs : public IUnknown + { + public: + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_FrameReference( + /* [annotation][out][retval] */ + _COM_Outptr_ IInfraredFrameReference **infraredFrameReference) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IInfraredFrameArrivedEventArgsVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IInfraredFrameArrivedEventArgs * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IInfraredFrameArrivedEventArgs * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IInfraredFrameArrivedEventArgs * This); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_FrameReference )( + IInfraredFrameArrivedEventArgs * This, + /* [annotation][out][retval] */ + _COM_Outptr_ IInfraredFrameReference **infraredFrameReference); + + END_INTERFACE + } IInfraredFrameArrivedEventArgsVtbl; + + interface IInfraredFrameArrivedEventArgs + { + CONST_VTBL struct IInfraredFrameArrivedEventArgsVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IInfraredFrameArrivedEventArgs_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IInfraredFrameArrivedEventArgs_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IInfraredFrameArrivedEventArgs_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IInfraredFrameArrivedEventArgs_get_FrameReference(This,infraredFrameReference) \ + ( (This)->lpVtbl -> get_FrameReference(This,infraredFrameReference) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IInfraredFrameArrivedEventArgs_INTERFACE_DEFINED__ */ + + +#ifndef __IInfraredFrameSource_INTERFACE_DEFINED__ +#define __IInfraredFrameSource_INTERFACE_DEFINED__ + +/* interface IInfraredFrameSource */ +/* [object][local][uuid] */ + + +EXTERN_C const IID IID_IInfraredFrameSource; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("4C299EC6-CA45-4AFF-87AD-DF5762C49BE7") + IInfraredFrameSource : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE SubscribeFrameCaptured( + /* [annotation][out][retval] */ + _Out_ WAITABLE_HANDLE *waitableHandle) = 0; + + virtual HRESULT STDMETHODCALLTYPE UnsubscribeFrameCaptured( + /* [annotation][in] */ + _In_ WAITABLE_HANDLE waitableHandle) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetFrameCapturedEventData( + /* [annotation][in] */ + _In_ WAITABLE_HANDLE waitableHandle, + /* [annotation][out][retval] */ + _Out_ IFrameCapturedEventArgs **eventData) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_IsActive( + /* [annotation][out][retval] */ + _Out_ BOOLEAN *isActive) = 0; + + virtual HRESULT STDMETHODCALLTYPE OpenReader( + /* [annotation][out][retval] */ + _COM_Outptr_ IInfraredFrameReader **reader) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_FrameDescription( + /* [annotation][out][retval] */ + _COM_Outptr_ IFrameDescription **frameDescription) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_KinectSensor( + /* [annotation][out][retval] */ + _COM_Outptr_ IKinectSensor **sensor) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IInfraredFrameSourceVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IInfraredFrameSource * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IInfraredFrameSource * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IInfraredFrameSource * This); + + HRESULT ( STDMETHODCALLTYPE *SubscribeFrameCaptured )( + IInfraredFrameSource * This, + /* [annotation][out][retval] */ + _Out_ WAITABLE_HANDLE *waitableHandle); + + HRESULT ( STDMETHODCALLTYPE *UnsubscribeFrameCaptured )( + IInfraredFrameSource * This, + /* [annotation][in] */ + _In_ WAITABLE_HANDLE waitableHandle); + + HRESULT ( STDMETHODCALLTYPE *GetFrameCapturedEventData )( + IInfraredFrameSource * This, + /* [annotation][in] */ + _In_ WAITABLE_HANDLE waitableHandle, + /* [annotation][out][retval] */ + _Out_ IFrameCapturedEventArgs **eventData); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_IsActive )( + IInfraredFrameSource * This, + /* [annotation][out][retval] */ + _Out_ BOOLEAN *isActive); + + HRESULT ( STDMETHODCALLTYPE *OpenReader )( + IInfraredFrameSource * This, + /* [annotation][out][retval] */ + _COM_Outptr_ IInfraredFrameReader **reader); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_FrameDescription )( + IInfraredFrameSource * This, + /* [annotation][out][retval] */ + _COM_Outptr_ IFrameDescription **frameDescription); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_KinectSensor )( + IInfraredFrameSource * This, + /* [annotation][out][retval] */ + _COM_Outptr_ IKinectSensor **sensor); + + END_INTERFACE + } IInfraredFrameSourceVtbl; + + interface IInfraredFrameSource + { + CONST_VTBL struct IInfraredFrameSourceVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IInfraredFrameSource_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IInfraredFrameSource_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IInfraredFrameSource_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IInfraredFrameSource_SubscribeFrameCaptured(This,waitableHandle) \ + ( (This)->lpVtbl -> SubscribeFrameCaptured(This,waitableHandle) ) + +#define IInfraredFrameSource_UnsubscribeFrameCaptured(This,waitableHandle) \ + ( (This)->lpVtbl -> UnsubscribeFrameCaptured(This,waitableHandle) ) + +#define IInfraredFrameSource_GetFrameCapturedEventData(This,waitableHandle,eventData) \ + ( (This)->lpVtbl -> GetFrameCapturedEventData(This,waitableHandle,eventData) ) + +#define IInfraredFrameSource_get_IsActive(This,isActive) \ + ( (This)->lpVtbl -> get_IsActive(This,isActive) ) + +#define IInfraredFrameSource_OpenReader(This,reader) \ + ( (This)->lpVtbl -> OpenReader(This,reader) ) + +#define IInfraredFrameSource_get_FrameDescription(This,frameDescription) \ + ( (This)->lpVtbl -> get_FrameDescription(This,frameDescription) ) + +#define IInfraredFrameSource_get_KinectSensor(This,sensor) \ + ( (This)->lpVtbl -> get_KinectSensor(This,sensor) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IInfraredFrameSource_INTERFACE_DEFINED__ */ + + +#ifndef __IInfraredFrameReader_INTERFACE_DEFINED__ +#define __IInfraredFrameReader_INTERFACE_DEFINED__ + +/* interface IInfraredFrameReader */ +/* [object][local][uuid] */ + + +EXTERN_C const IID IID_IInfraredFrameReader; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("059A049D-A0AC-481E-B342-483EE94A028B") + IInfraredFrameReader : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE SubscribeFrameArrived( + /* [annotation][out][retval] */ + _Out_ WAITABLE_HANDLE *waitableHandle) = 0; + + virtual HRESULT STDMETHODCALLTYPE UnsubscribeFrameArrived( + /* [annotation][in] */ + _In_ WAITABLE_HANDLE waitableHandle) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetFrameArrivedEventData( + /* [annotation][in] */ + _In_ WAITABLE_HANDLE waitableHandle, + /* [annotation][out][retval] */ + _Out_ IInfraredFrameArrivedEventArgs **eventData) = 0; + + virtual HRESULT STDMETHODCALLTYPE AcquireLatestFrame( + /* [annotation][out][retval] */ + _COM_Outptr_ IInfraredFrame **infraredFrame) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_IsPaused( + /* [annotation][out][retval] */ + _Out_ BOOLEAN *isPaused) = 0; + + virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_IsPaused( + BOOLEAN isPaused) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_InfraredFrameSource( + /* [annotation][out][retval] */ + _COM_Outptr_ IInfraredFrameSource **infraredFrameSource) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IInfraredFrameReaderVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IInfraredFrameReader * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IInfraredFrameReader * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IInfraredFrameReader * This); + + HRESULT ( STDMETHODCALLTYPE *SubscribeFrameArrived )( + IInfraredFrameReader * This, + /* [annotation][out][retval] */ + _Out_ WAITABLE_HANDLE *waitableHandle); + + HRESULT ( STDMETHODCALLTYPE *UnsubscribeFrameArrived )( + IInfraredFrameReader * This, + /* [annotation][in] */ + _In_ WAITABLE_HANDLE waitableHandle); + + HRESULT ( STDMETHODCALLTYPE *GetFrameArrivedEventData )( + IInfraredFrameReader * This, + /* [annotation][in] */ + _In_ WAITABLE_HANDLE waitableHandle, + /* [annotation][out][retval] */ + _Out_ IInfraredFrameArrivedEventArgs **eventData); + + HRESULT ( STDMETHODCALLTYPE *AcquireLatestFrame )( + IInfraredFrameReader * This, + /* [annotation][out][retval] */ + _COM_Outptr_ IInfraredFrame **infraredFrame); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_IsPaused )( + IInfraredFrameReader * This, + /* [annotation][out][retval] */ + _Out_ BOOLEAN *isPaused); + + /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_IsPaused )( + IInfraredFrameReader * This, + BOOLEAN isPaused); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_InfraredFrameSource )( + IInfraredFrameReader * This, + /* [annotation][out][retval] */ + _COM_Outptr_ IInfraredFrameSource **infraredFrameSource); + + END_INTERFACE + } IInfraredFrameReaderVtbl; + + interface IInfraredFrameReader + { + CONST_VTBL struct IInfraredFrameReaderVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IInfraredFrameReader_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IInfraredFrameReader_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IInfraredFrameReader_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IInfraredFrameReader_SubscribeFrameArrived(This,waitableHandle) \ + ( (This)->lpVtbl -> SubscribeFrameArrived(This,waitableHandle) ) + +#define IInfraredFrameReader_UnsubscribeFrameArrived(This,waitableHandle) \ + ( (This)->lpVtbl -> UnsubscribeFrameArrived(This,waitableHandle) ) + +#define IInfraredFrameReader_GetFrameArrivedEventData(This,waitableHandle,eventData) \ + ( (This)->lpVtbl -> GetFrameArrivedEventData(This,waitableHandle,eventData) ) + +#define IInfraredFrameReader_AcquireLatestFrame(This,infraredFrame) \ + ( (This)->lpVtbl -> AcquireLatestFrame(This,infraredFrame) ) + +#define IInfraredFrameReader_get_IsPaused(This,isPaused) \ + ( (This)->lpVtbl -> get_IsPaused(This,isPaused) ) + +#define IInfraredFrameReader_put_IsPaused(This,isPaused) \ + ( (This)->lpVtbl -> put_IsPaused(This,isPaused) ) + +#define IInfraredFrameReader_get_InfraredFrameSource(This,infraredFrameSource) \ + ( (This)->lpVtbl -> get_InfraredFrameSource(This,infraredFrameSource) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IInfraredFrameReader_INTERFACE_DEFINED__ */ + + +#ifndef __IInfraredFrame_INTERFACE_DEFINED__ +#define __IInfraredFrame_INTERFACE_DEFINED__ + +/* interface IInfraredFrame */ +/* [object][local][uuid] */ + + +EXTERN_C const IID IID_IInfraredFrame; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("EA83823C-7613-4F29-BD51-4A9678A52C7E") + IInfraredFrame : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE CopyFrameDataToArray( + UINT capacity, + /* [annotation][size_is][out] */ + _Out_writes_all_(capacity) UINT16 *frameData) = 0; + + virtual HRESULT STDMETHODCALLTYPE AccessUnderlyingBuffer( + /* [annotation][out] */ + _Out_ UINT *capacity, + /* [annotation][size_is][size_is][out] */ + _Outptr_result_buffer_(*capacity) UINT16 **buffer) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_FrameDescription( + /* [annotation][out][retval] */ + _COM_Outptr_ IFrameDescription **frameDescription) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_RelativeTime( + /* [annotation][out][retval] */ + _Out_ TIMESPAN *relativeTime) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_InfraredFrameSource( + /* [annotation][out][retval] */ + _COM_Outptr_ IInfraredFrameSource **infraredFrameSource) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IInfraredFrameVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IInfraredFrame * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IInfraredFrame * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IInfraredFrame * This); + + HRESULT ( STDMETHODCALLTYPE *CopyFrameDataToArray )( + IInfraredFrame * This, + UINT capacity, + /* [annotation][size_is][out] */ + _Out_writes_all_(capacity) UINT16 *frameData); + + HRESULT ( STDMETHODCALLTYPE *AccessUnderlyingBuffer )( + IInfraredFrame * This, + /* [annotation][out] */ + _Out_ UINT *capacity, + /* [annotation][size_is][size_is][out] */ + _Outptr_result_buffer_(*capacity) UINT16 **buffer); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_FrameDescription )( + IInfraredFrame * This, + /* [annotation][out][retval] */ + _COM_Outptr_ IFrameDescription **frameDescription); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_RelativeTime )( + IInfraredFrame * This, + /* [annotation][out][retval] */ + _Out_ TIMESPAN *relativeTime); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_InfraredFrameSource )( + IInfraredFrame * This, + /* [annotation][out][retval] */ + _COM_Outptr_ IInfraredFrameSource **infraredFrameSource); + + END_INTERFACE + } IInfraredFrameVtbl; + + interface IInfraredFrame + { + CONST_VTBL struct IInfraredFrameVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IInfraredFrame_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IInfraredFrame_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IInfraredFrame_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IInfraredFrame_CopyFrameDataToArray(This,capacity,frameData) \ + ( (This)->lpVtbl -> CopyFrameDataToArray(This,capacity,frameData) ) + +#define IInfraredFrame_AccessUnderlyingBuffer(This,capacity,buffer) \ + ( (This)->lpVtbl -> AccessUnderlyingBuffer(This,capacity,buffer) ) + +#define IInfraredFrame_get_FrameDescription(This,frameDescription) \ + ( (This)->lpVtbl -> get_FrameDescription(This,frameDescription) ) + +#define IInfraredFrame_get_RelativeTime(This,relativeTime) \ + ( (This)->lpVtbl -> get_RelativeTime(This,relativeTime) ) + +#define IInfraredFrame_get_InfraredFrameSource(This,infraredFrameSource) \ + ( (This)->lpVtbl -> get_InfraredFrameSource(This,infraredFrameSource) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IInfraredFrame_INTERFACE_DEFINED__ */ + + +#ifndef __ILongExposureInfraredFrameReference_INTERFACE_DEFINED__ +#define __ILongExposureInfraredFrameReference_INTERFACE_DEFINED__ + +/* interface ILongExposureInfraredFrameReference */ +/* [object][local][uuid] */ + + +EXTERN_C const IID IID_ILongExposureInfraredFrameReference; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("10043A3E-0DAA-409C-9944-A6FC66C85AF7") + ILongExposureInfraredFrameReference : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE AcquireFrame( + /* [annotation][out][retval] */ + _COM_Outptr_ ILongExposureInfraredFrame **longExposureInfraredFrame) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_RelativeTime( + /* [annotation][out][retval] */ + _Out_ TIMESPAN *relativeTime) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ILongExposureInfraredFrameReferenceVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ILongExposureInfraredFrameReference * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ILongExposureInfraredFrameReference * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ILongExposureInfraredFrameReference * This); + + HRESULT ( STDMETHODCALLTYPE *AcquireFrame )( + ILongExposureInfraredFrameReference * This, + /* [annotation][out][retval] */ + _COM_Outptr_ ILongExposureInfraredFrame **longExposureInfraredFrame); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_RelativeTime )( + ILongExposureInfraredFrameReference * This, + /* [annotation][out][retval] */ + _Out_ TIMESPAN *relativeTime); + + END_INTERFACE + } ILongExposureInfraredFrameReferenceVtbl; + + interface ILongExposureInfraredFrameReference + { + CONST_VTBL struct ILongExposureInfraredFrameReferenceVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ILongExposureInfraredFrameReference_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ILongExposureInfraredFrameReference_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ILongExposureInfraredFrameReference_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ILongExposureInfraredFrameReference_AcquireFrame(This,longExposureInfraredFrame) \ + ( (This)->lpVtbl -> AcquireFrame(This,longExposureInfraredFrame) ) + +#define ILongExposureInfraredFrameReference_get_RelativeTime(This,relativeTime) \ + ( (This)->lpVtbl -> get_RelativeTime(This,relativeTime) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ILongExposureInfraredFrameReference_INTERFACE_DEFINED__ */ + + +#ifndef __ILongExposureInfraredFrameArrivedEventArgs_INTERFACE_DEFINED__ +#define __ILongExposureInfraredFrameArrivedEventArgs_INTERFACE_DEFINED__ + +/* interface ILongExposureInfraredFrameArrivedEventArgs */ +/* [object][local][uuid] */ + + +EXTERN_C const IID IID_ILongExposureInfraredFrameArrivedEventArgs; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("D73D4B5E-E329-4F04-894C-0C97482690D4") + ILongExposureInfraredFrameArrivedEventArgs : public IUnknown + { + public: + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_FrameReference( + /* [annotation][out][retval] */ + _COM_Outptr_ ILongExposureInfraredFrameReference **longExposureInfraredFrameReference) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ILongExposureInfraredFrameArrivedEventArgsVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ILongExposureInfraredFrameArrivedEventArgs * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ILongExposureInfraredFrameArrivedEventArgs * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ILongExposureInfraredFrameArrivedEventArgs * This); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_FrameReference )( + ILongExposureInfraredFrameArrivedEventArgs * This, + /* [annotation][out][retval] */ + _COM_Outptr_ ILongExposureInfraredFrameReference **longExposureInfraredFrameReference); + + END_INTERFACE + } ILongExposureInfraredFrameArrivedEventArgsVtbl; + + interface ILongExposureInfraredFrameArrivedEventArgs + { + CONST_VTBL struct ILongExposureInfraredFrameArrivedEventArgsVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ILongExposureInfraredFrameArrivedEventArgs_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ILongExposureInfraredFrameArrivedEventArgs_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ILongExposureInfraredFrameArrivedEventArgs_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ILongExposureInfraredFrameArrivedEventArgs_get_FrameReference(This,longExposureInfraredFrameReference) \ + ( (This)->lpVtbl -> get_FrameReference(This,longExposureInfraredFrameReference) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ILongExposureInfraredFrameArrivedEventArgs_INTERFACE_DEFINED__ */ + + +#ifndef __ILongExposureInfraredFrameSource_INTERFACE_DEFINED__ +#define __ILongExposureInfraredFrameSource_INTERFACE_DEFINED__ + +/* interface ILongExposureInfraredFrameSource */ +/* [object][local][uuid] */ + + +EXTERN_C const IID IID_ILongExposureInfraredFrameSource; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("D7150EDA-EDA2-4673-B4F8-E3C76D1F402B") + ILongExposureInfraredFrameSource : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE SubscribeFrameCaptured( + /* [annotation][out][retval] */ + _Out_ WAITABLE_HANDLE *waitableHandle) = 0; + + virtual HRESULT STDMETHODCALLTYPE UnsubscribeFrameCaptured( + /* [annotation][in] */ + _In_ WAITABLE_HANDLE waitableHandle) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetFrameCapturedEventData( + /* [annotation][in] */ + _In_ WAITABLE_HANDLE waitableHandle, + /* [annotation][out][retval] */ + _Out_ IFrameCapturedEventArgs **eventData) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_IsActive( + /* [annotation][out][retval] */ + _Out_ BOOLEAN *isActive) = 0; + + virtual HRESULT STDMETHODCALLTYPE OpenReader( + /* [annotation][out][retval] */ + _COM_Outptr_ ILongExposureInfraredFrameReader **reader) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_FrameDescription( + /* [annotation][out][retval] */ + _COM_Outptr_ IFrameDescription **frameDescription) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_KinectSensor( + /* [annotation][out][retval] */ + _COM_Outptr_ IKinectSensor **sensor) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ILongExposureInfraredFrameSourceVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ILongExposureInfraredFrameSource * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ILongExposureInfraredFrameSource * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ILongExposureInfraredFrameSource * This); + + HRESULT ( STDMETHODCALLTYPE *SubscribeFrameCaptured )( + ILongExposureInfraredFrameSource * This, + /* [annotation][out][retval] */ + _Out_ WAITABLE_HANDLE *waitableHandle); + + HRESULT ( STDMETHODCALLTYPE *UnsubscribeFrameCaptured )( + ILongExposureInfraredFrameSource * This, + /* [annotation][in] */ + _In_ WAITABLE_HANDLE waitableHandle); + + HRESULT ( STDMETHODCALLTYPE *GetFrameCapturedEventData )( + ILongExposureInfraredFrameSource * This, + /* [annotation][in] */ + _In_ WAITABLE_HANDLE waitableHandle, + /* [annotation][out][retval] */ + _Out_ IFrameCapturedEventArgs **eventData); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_IsActive )( + ILongExposureInfraredFrameSource * This, + /* [annotation][out][retval] */ + _Out_ BOOLEAN *isActive); + + HRESULT ( STDMETHODCALLTYPE *OpenReader )( + ILongExposureInfraredFrameSource * This, + /* [annotation][out][retval] */ + _COM_Outptr_ ILongExposureInfraredFrameReader **reader); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_FrameDescription )( + ILongExposureInfraredFrameSource * This, + /* [annotation][out][retval] */ + _COM_Outptr_ IFrameDescription **frameDescription); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_KinectSensor )( + ILongExposureInfraredFrameSource * This, + /* [annotation][out][retval] */ + _COM_Outptr_ IKinectSensor **sensor); + + END_INTERFACE + } ILongExposureInfraredFrameSourceVtbl; + + interface ILongExposureInfraredFrameSource + { + CONST_VTBL struct ILongExposureInfraredFrameSourceVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ILongExposureInfraredFrameSource_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ILongExposureInfraredFrameSource_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ILongExposureInfraredFrameSource_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ILongExposureInfraredFrameSource_SubscribeFrameCaptured(This,waitableHandle) \ + ( (This)->lpVtbl -> SubscribeFrameCaptured(This,waitableHandle) ) + +#define ILongExposureInfraredFrameSource_UnsubscribeFrameCaptured(This,waitableHandle) \ + ( (This)->lpVtbl -> UnsubscribeFrameCaptured(This,waitableHandle) ) + +#define ILongExposureInfraredFrameSource_GetFrameCapturedEventData(This,waitableHandle,eventData) \ + ( (This)->lpVtbl -> GetFrameCapturedEventData(This,waitableHandle,eventData) ) + +#define ILongExposureInfraredFrameSource_get_IsActive(This,isActive) \ + ( (This)->lpVtbl -> get_IsActive(This,isActive) ) + +#define ILongExposureInfraredFrameSource_OpenReader(This,reader) \ + ( (This)->lpVtbl -> OpenReader(This,reader) ) + +#define ILongExposureInfraredFrameSource_get_FrameDescription(This,frameDescription) \ + ( (This)->lpVtbl -> get_FrameDescription(This,frameDescription) ) + +#define ILongExposureInfraredFrameSource_get_KinectSensor(This,sensor) \ + ( (This)->lpVtbl -> get_KinectSensor(This,sensor) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ILongExposureInfraredFrameSource_INTERFACE_DEFINED__ */ + + +#ifndef __ILongExposureInfraredFrameReader_INTERFACE_DEFINED__ +#define __ILongExposureInfraredFrameReader_INTERFACE_DEFINED__ + +/* interface ILongExposureInfraredFrameReader */ +/* [object][local][uuid] */ + + +EXTERN_C const IID IID_ILongExposureInfraredFrameReader; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("2AF23594-0115-417B-859F-A0E3FFB690D2") + ILongExposureInfraredFrameReader : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE SubscribeFrameArrived( + /* [annotation][out][retval] */ + _Out_ WAITABLE_HANDLE *waitableHandle) = 0; + + virtual HRESULT STDMETHODCALLTYPE UnsubscribeFrameArrived( + /* [annotation][in] */ + _In_ WAITABLE_HANDLE waitableHandle) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetFrameArrivedEventData( + /* [annotation][in] */ + _In_ WAITABLE_HANDLE waitableHandle, + /* [annotation][out][retval] */ + _Out_ ILongExposureInfraredFrameArrivedEventArgs **eventData) = 0; + + virtual HRESULT STDMETHODCALLTYPE AcquireLatestFrame( + /* [annotation][out][retval] */ + _COM_Outptr_ ILongExposureInfraredFrame **longExposureInfraredFrame) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_IsPaused( + /* [annotation][out][retval] */ + _Out_ BOOLEAN *isPaused) = 0; + + virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_IsPaused( + BOOLEAN isPaused) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_LongExposureInfraredFrameSource( + /* [annotation][out][retval] */ + _COM_Outptr_ ILongExposureInfraredFrameSource **LongExposureInfraredFrameSource) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ILongExposureInfraredFrameReaderVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ILongExposureInfraredFrameReader * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ILongExposureInfraredFrameReader * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ILongExposureInfraredFrameReader * This); + + HRESULT ( STDMETHODCALLTYPE *SubscribeFrameArrived )( + ILongExposureInfraredFrameReader * This, + /* [annotation][out][retval] */ + _Out_ WAITABLE_HANDLE *waitableHandle); + + HRESULT ( STDMETHODCALLTYPE *UnsubscribeFrameArrived )( + ILongExposureInfraredFrameReader * This, + /* [annotation][in] */ + _In_ WAITABLE_HANDLE waitableHandle); + + HRESULT ( STDMETHODCALLTYPE *GetFrameArrivedEventData )( + ILongExposureInfraredFrameReader * This, + /* [annotation][in] */ + _In_ WAITABLE_HANDLE waitableHandle, + /* [annotation][out][retval] */ + _Out_ ILongExposureInfraredFrameArrivedEventArgs **eventData); + + HRESULT ( STDMETHODCALLTYPE *AcquireLatestFrame )( + ILongExposureInfraredFrameReader * This, + /* [annotation][out][retval] */ + _COM_Outptr_ ILongExposureInfraredFrame **longExposureInfraredFrame); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_IsPaused )( + ILongExposureInfraredFrameReader * This, + /* [annotation][out][retval] */ + _Out_ BOOLEAN *isPaused); + + /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_IsPaused )( + ILongExposureInfraredFrameReader * This, + BOOLEAN isPaused); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_LongExposureInfraredFrameSource )( + ILongExposureInfraredFrameReader * This, + /* [annotation][out][retval] */ + _COM_Outptr_ ILongExposureInfraredFrameSource **LongExposureInfraredFrameSource); + + END_INTERFACE + } ILongExposureInfraredFrameReaderVtbl; + + interface ILongExposureInfraredFrameReader + { + CONST_VTBL struct ILongExposureInfraredFrameReaderVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ILongExposureInfraredFrameReader_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ILongExposureInfraredFrameReader_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ILongExposureInfraredFrameReader_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ILongExposureInfraredFrameReader_SubscribeFrameArrived(This,waitableHandle) \ + ( (This)->lpVtbl -> SubscribeFrameArrived(This,waitableHandle) ) + +#define ILongExposureInfraredFrameReader_UnsubscribeFrameArrived(This,waitableHandle) \ + ( (This)->lpVtbl -> UnsubscribeFrameArrived(This,waitableHandle) ) + +#define ILongExposureInfraredFrameReader_GetFrameArrivedEventData(This,waitableHandle,eventData) \ + ( (This)->lpVtbl -> GetFrameArrivedEventData(This,waitableHandle,eventData) ) + +#define ILongExposureInfraredFrameReader_AcquireLatestFrame(This,longExposureInfraredFrame) \ + ( (This)->lpVtbl -> AcquireLatestFrame(This,longExposureInfraredFrame) ) + +#define ILongExposureInfraredFrameReader_get_IsPaused(This,isPaused) \ + ( (This)->lpVtbl -> get_IsPaused(This,isPaused) ) + +#define ILongExposureInfraredFrameReader_put_IsPaused(This,isPaused) \ + ( (This)->lpVtbl -> put_IsPaused(This,isPaused) ) + +#define ILongExposureInfraredFrameReader_get_LongExposureInfraredFrameSource(This,LongExposureInfraredFrameSource) \ + ( (This)->lpVtbl -> get_LongExposureInfraredFrameSource(This,LongExposureInfraredFrameSource) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ILongExposureInfraredFrameReader_INTERFACE_DEFINED__ */ + + +#ifndef __ILongExposureInfraredFrame_INTERFACE_DEFINED__ +#define __ILongExposureInfraredFrame_INTERFACE_DEFINED__ + +/* interface ILongExposureInfraredFrame */ +/* [object][local][uuid] */ + + +EXTERN_C const IID IID_ILongExposureInfraredFrame; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("D1199394-9A42-4577-BE12-90A38B72282C") + ILongExposureInfraredFrame : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE CopyFrameDataToArray( + UINT capacity, + /* [annotation][size_is][out] */ + _Out_writes_all_(capacity) UINT16 *frameData) = 0; + + virtual HRESULT STDMETHODCALLTYPE AccessUnderlyingBuffer( + /* [annotation][out] */ + _Out_ UINT *capacity, + /* [annotation][size_is][size_is][out] */ + _Outptr_result_buffer_(*capacity) UINT16 **buffer) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_FrameDescription( + /* [annotation][out][retval] */ + _COM_Outptr_ IFrameDescription **frameDescription) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_RelativeTime( + /* [annotation][out][retval] */ + _Out_ TIMESPAN *relativeTime) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_LongExposureInfraredFrameSource( + /* [annotation][out][retval] */ + _COM_Outptr_ ILongExposureInfraredFrameSource **longExposureInfraredFrameSource) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ILongExposureInfraredFrameVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ILongExposureInfraredFrame * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ILongExposureInfraredFrame * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ILongExposureInfraredFrame * This); + + HRESULT ( STDMETHODCALLTYPE *CopyFrameDataToArray )( + ILongExposureInfraredFrame * This, + UINT capacity, + /* [annotation][size_is][out] */ + _Out_writes_all_(capacity) UINT16 *frameData); + + HRESULT ( STDMETHODCALLTYPE *AccessUnderlyingBuffer )( + ILongExposureInfraredFrame * This, + /* [annotation][out] */ + _Out_ UINT *capacity, + /* [annotation][size_is][size_is][out] */ + _Outptr_result_buffer_(*capacity) UINT16 **buffer); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_FrameDescription )( + ILongExposureInfraredFrame * This, + /* [annotation][out][retval] */ + _COM_Outptr_ IFrameDescription **frameDescription); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_RelativeTime )( + ILongExposureInfraredFrame * This, + /* [annotation][out][retval] */ + _Out_ TIMESPAN *relativeTime); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_LongExposureInfraredFrameSource )( + ILongExposureInfraredFrame * This, + /* [annotation][out][retval] */ + _COM_Outptr_ ILongExposureInfraredFrameSource **longExposureInfraredFrameSource); + + END_INTERFACE + } ILongExposureInfraredFrameVtbl; + + interface ILongExposureInfraredFrame + { + CONST_VTBL struct ILongExposureInfraredFrameVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ILongExposureInfraredFrame_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ILongExposureInfraredFrame_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ILongExposureInfraredFrame_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ILongExposureInfraredFrame_CopyFrameDataToArray(This,capacity,frameData) \ + ( (This)->lpVtbl -> CopyFrameDataToArray(This,capacity,frameData) ) + +#define ILongExposureInfraredFrame_AccessUnderlyingBuffer(This,capacity,buffer) \ + ( (This)->lpVtbl -> AccessUnderlyingBuffer(This,capacity,buffer) ) + +#define ILongExposureInfraredFrame_get_FrameDescription(This,frameDescription) \ + ( (This)->lpVtbl -> get_FrameDescription(This,frameDescription) ) + +#define ILongExposureInfraredFrame_get_RelativeTime(This,relativeTime) \ + ( (This)->lpVtbl -> get_RelativeTime(This,relativeTime) ) + +#define ILongExposureInfraredFrame_get_LongExposureInfraredFrameSource(This,longExposureInfraredFrameSource) \ + ( (This)->lpVtbl -> get_LongExposureInfraredFrameSource(This,longExposureInfraredFrameSource) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ILongExposureInfraredFrame_INTERFACE_DEFINED__ */ + + +#ifndef __IAudioBeam_INTERFACE_DEFINED__ +#define __IAudioBeam_INTERFACE_DEFINED__ + +/* interface IAudioBeam */ +/* [object][local][uuid] */ + + +EXTERN_C const IID IID_IAudioBeam; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("F692D23A-14D0-432D-B802-DD381A45A121") + IAudioBeam : public IUnknown + { + public: + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_AudioSource( + /* [annotation][out][retval] */ + _COM_Outptr_ IAudioSource **audioSource) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_AudioBeamMode( + /* [annotation][out][retval] */ + _Out_ AudioBeamMode *audioBeamMode) = 0; + + virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_AudioBeamMode( + AudioBeamMode audioBeamMode) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_BeamAngle( + /* [annotation][out][retval] */ + _Out_ float *beamAngle) = 0; + + virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_BeamAngle( + float beamAngle) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_BeamAngleConfidence( + /* [annotation][out][retval] */ + _Out_ float *beamAngleConfidence) = 0; + + virtual HRESULT STDMETHODCALLTYPE OpenInputStream( + /* [annotation][out][retval] */ + _COM_Outptr_ IStream **stream) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_RelativeTime( + /* [annotation][out][retval] */ + _Out_ TIMESPAN *relativeTime) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IAudioBeamVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IAudioBeam * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IAudioBeam * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IAudioBeam * This); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_AudioSource )( + IAudioBeam * This, + /* [annotation][out][retval] */ + _COM_Outptr_ IAudioSource **audioSource); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_AudioBeamMode )( + IAudioBeam * This, + /* [annotation][out][retval] */ + _Out_ AudioBeamMode *audioBeamMode); + + /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_AudioBeamMode )( + IAudioBeam * This, + AudioBeamMode audioBeamMode); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_BeamAngle )( + IAudioBeam * This, + /* [annotation][out][retval] */ + _Out_ float *beamAngle); + + /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_BeamAngle )( + IAudioBeam * This, + float beamAngle); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_BeamAngleConfidence )( + IAudioBeam * This, + /* [annotation][out][retval] */ + _Out_ float *beamAngleConfidence); + + HRESULT ( STDMETHODCALLTYPE *OpenInputStream )( + IAudioBeam * This, + /* [annotation][out][retval] */ + _COM_Outptr_ IStream **stream); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_RelativeTime )( + IAudioBeam * This, + /* [annotation][out][retval] */ + _Out_ TIMESPAN *relativeTime); + + END_INTERFACE + } IAudioBeamVtbl; + + interface IAudioBeam + { + CONST_VTBL struct IAudioBeamVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IAudioBeam_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IAudioBeam_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IAudioBeam_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IAudioBeam_get_AudioSource(This,audioSource) \ + ( (This)->lpVtbl -> get_AudioSource(This,audioSource) ) + +#define IAudioBeam_get_AudioBeamMode(This,audioBeamMode) \ + ( (This)->lpVtbl -> get_AudioBeamMode(This,audioBeamMode) ) + +#define IAudioBeam_put_AudioBeamMode(This,audioBeamMode) \ + ( (This)->lpVtbl -> put_AudioBeamMode(This,audioBeamMode) ) + +#define IAudioBeam_get_BeamAngle(This,beamAngle) \ + ( (This)->lpVtbl -> get_BeamAngle(This,beamAngle) ) + +#define IAudioBeam_put_BeamAngle(This,beamAngle) \ + ( (This)->lpVtbl -> put_BeamAngle(This,beamAngle) ) + +#define IAudioBeam_get_BeamAngleConfidence(This,beamAngleConfidence) \ + ( (This)->lpVtbl -> get_BeamAngleConfidence(This,beamAngleConfidence) ) + +#define IAudioBeam_OpenInputStream(This,stream) \ + ( (This)->lpVtbl -> OpenInputStream(This,stream) ) + +#define IAudioBeam_get_RelativeTime(This,relativeTime) \ + ( (This)->lpVtbl -> get_RelativeTime(This,relativeTime) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IAudioBeam_INTERFACE_DEFINED__ */ + + +#ifndef __IAudioBeamList_INTERFACE_DEFINED__ +#define __IAudioBeamList_INTERFACE_DEFINED__ + +/* interface IAudioBeamList */ +/* [object][local][uuid] */ + + +EXTERN_C const IID IID_IAudioBeamList; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("3C792C7B-7D95-4C56-9DC7-EF63955781EA") + IAudioBeamList : public IUnknown + { + public: + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_BeamCount( + /* [annotation][out][retval] */ + _Out_ UINT *count) = 0; + + virtual HRESULT STDMETHODCALLTYPE OpenAudioBeam( + UINT32 index, + /* [annotation][out] */ + _COM_Outptr_ IAudioBeam **audioBeam) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IAudioBeamListVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IAudioBeamList * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IAudioBeamList * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IAudioBeamList * This); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_BeamCount )( + IAudioBeamList * This, + /* [annotation][out][retval] */ + _Out_ UINT *count); + + HRESULT ( STDMETHODCALLTYPE *OpenAudioBeam )( + IAudioBeamList * This, + UINT32 index, + /* [annotation][out] */ + _COM_Outptr_ IAudioBeam **audioBeam); + + END_INTERFACE + } IAudioBeamListVtbl; + + interface IAudioBeamList + { + CONST_VTBL struct IAudioBeamListVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IAudioBeamList_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IAudioBeamList_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IAudioBeamList_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IAudioBeamList_get_BeamCount(This,count) \ + ( (This)->lpVtbl -> get_BeamCount(This,count) ) + +#define IAudioBeamList_OpenAudioBeam(This,index,audioBeam) \ + ( (This)->lpVtbl -> OpenAudioBeam(This,index,audioBeam) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IAudioBeamList_INTERFACE_DEFINED__ */ + + +#ifndef __IAudioBeamFrameList_INTERFACE_DEFINED__ +#define __IAudioBeamFrameList_INTERFACE_DEFINED__ + +/* interface IAudioBeamFrameList */ +/* [object][local][uuid] */ + + +EXTERN_C const IID IID_IAudioBeamFrameList; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("5393C8B9-C044-49CB-BDD6-23DFFFD7427E") + IAudioBeamFrameList : public IUnknown + { + public: + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_BeamCount( + /* [annotation][out][retval] */ + _Out_ UINT *count) = 0; + + virtual HRESULT STDMETHODCALLTYPE OpenAudioBeamFrame( + UINT32 index, + /* [annotation][out] */ + _COM_Outptr_ IAudioBeamFrame **audioBeamFrame) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IAudioBeamFrameListVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IAudioBeamFrameList * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IAudioBeamFrameList * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IAudioBeamFrameList * This); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_BeamCount )( + IAudioBeamFrameList * This, + /* [annotation][out][retval] */ + _Out_ UINT *count); + + HRESULT ( STDMETHODCALLTYPE *OpenAudioBeamFrame )( + IAudioBeamFrameList * This, + UINT32 index, + /* [annotation][out] */ + _COM_Outptr_ IAudioBeamFrame **audioBeamFrame); + + END_INTERFACE + } IAudioBeamFrameListVtbl; + + interface IAudioBeamFrameList + { + CONST_VTBL struct IAudioBeamFrameListVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IAudioBeamFrameList_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IAudioBeamFrameList_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IAudioBeamFrameList_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IAudioBeamFrameList_get_BeamCount(This,count) \ + ( (This)->lpVtbl -> get_BeamCount(This,count) ) + +#define IAudioBeamFrameList_OpenAudioBeamFrame(This,index,audioBeamFrame) \ + ( (This)->lpVtbl -> OpenAudioBeamFrame(This,index,audioBeamFrame) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IAudioBeamFrameList_INTERFACE_DEFINED__ */ + + +#ifndef __IAudioBeamFrame_INTERFACE_DEFINED__ +#define __IAudioBeamFrame_INTERFACE_DEFINED__ + +/* interface IAudioBeamFrame */ +/* [object][local][uuid] */ + + +EXTERN_C const IID IID_IAudioBeamFrame; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("07AADCC8-EC4A-42F8-90A9-C72ECF0A1D06") + IAudioBeamFrame : public IUnknown + { + public: + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_AudioSource( + /* [annotation][out][retval] */ + _COM_Outptr_ IAudioSource **audioSource) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Duration( + /* [annotation][out][retval] */ + _Out_ TIMESPAN *duration) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_AudioBeam( + /* [annotation][out][retval] */ + _COM_Outptr_ IAudioBeam **audioBeam) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_SubFrameCount( + /* [annotation][out][retval] */ + _Out_ UINT32 *pSubFrameCount) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetSubFrame( + UINT32 subFrameIndex, + /* [annotation][out] */ + _COM_Outptr_ IAudioBeamSubFrame **audioBeamSubFrame) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_RelativeTimeStart( + /* [annotation][out][retval] */ + _Out_ TIMESPAN *relativeTime) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IAudioBeamFrameVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IAudioBeamFrame * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IAudioBeamFrame * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IAudioBeamFrame * This); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_AudioSource )( + IAudioBeamFrame * This, + /* [annotation][out][retval] */ + _COM_Outptr_ IAudioSource **audioSource); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Duration )( + IAudioBeamFrame * This, + /* [annotation][out][retval] */ + _Out_ TIMESPAN *duration); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_AudioBeam )( + IAudioBeamFrame * This, + /* [annotation][out][retval] */ + _COM_Outptr_ IAudioBeam **audioBeam); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_SubFrameCount )( + IAudioBeamFrame * This, + /* [annotation][out][retval] */ + _Out_ UINT32 *pSubFrameCount); + + HRESULT ( STDMETHODCALLTYPE *GetSubFrame )( + IAudioBeamFrame * This, + UINT32 subFrameIndex, + /* [annotation][out] */ + _COM_Outptr_ IAudioBeamSubFrame **audioBeamSubFrame); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_RelativeTimeStart )( + IAudioBeamFrame * This, + /* [annotation][out][retval] */ + _Out_ TIMESPAN *relativeTime); + + END_INTERFACE + } IAudioBeamFrameVtbl; + + interface IAudioBeamFrame + { + CONST_VTBL struct IAudioBeamFrameVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IAudioBeamFrame_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IAudioBeamFrame_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IAudioBeamFrame_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IAudioBeamFrame_get_AudioSource(This,audioSource) \ + ( (This)->lpVtbl -> get_AudioSource(This,audioSource) ) + +#define IAudioBeamFrame_get_Duration(This,duration) \ + ( (This)->lpVtbl -> get_Duration(This,duration) ) + +#define IAudioBeamFrame_get_AudioBeam(This,audioBeam) \ + ( (This)->lpVtbl -> get_AudioBeam(This,audioBeam) ) + +#define IAudioBeamFrame_get_SubFrameCount(This,pSubFrameCount) \ + ( (This)->lpVtbl -> get_SubFrameCount(This,pSubFrameCount) ) + +#define IAudioBeamFrame_GetSubFrame(This,subFrameIndex,audioBeamSubFrame) \ + ( (This)->lpVtbl -> GetSubFrame(This,subFrameIndex,audioBeamSubFrame) ) + +#define IAudioBeamFrame_get_RelativeTimeStart(This,relativeTime) \ + ( (This)->lpVtbl -> get_RelativeTimeStart(This,relativeTime) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IAudioBeamFrame_INTERFACE_DEFINED__ */ + + +#ifndef __IAudioBeamSubFrame_INTERFACE_DEFINED__ +#define __IAudioBeamSubFrame_INTERFACE_DEFINED__ + +/* interface IAudioBeamSubFrame */ +/* [object][local][uuid] */ + + +EXTERN_C const IID IID_IAudioBeamSubFrame; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("0967DB97-80D1-4BC5-BD2B-4685098D9795") + IAudioBeamSubFrame : public IUnknown + { + public: + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_FrameLengthInBytes( + /* [annotation][out][retval] */ + _Out_ UINT *length) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Duration( + /* [annotation][out][retval] */ + _Out_ TIMESPAN *duration) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_BeamAngle( + /* [annotation][out][retval] */ + _Out_ float *beamAngle) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_BeamAngleConfidence( + /* [annotation][out][retval] */ + _Out_ float *beamAngleConfidence) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_AudioBeamMode( + /* [annotation][out][retval] */ + _Out_ AudioBeamMode *audioBeamMode) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_AudioBodyCorrelationCount( + /* [annotation][out][retval] */ + _Out_ UINT32 *pCount) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetAudioBodyCorrelation( + /* [annotation][in][in] */ + _In_ UINT index, + /* [annotation][out][out] */ + _COM_Outptr_ IAudioBodyCorrelation **ppAudioBodyCorrelation) = 0; + + virtual HRESULT STDMETHODCALLTYPE CopyFrameDataToArray( + /* [annotation] */ + _Pre_equal_to_(1024) UINT capacity, + /* [annotation][size_is][out] */ + _Out_writes_all_(capacity) BYTE *frameData) = 0; + + virtual HRESULT STDMETHODCALLTYPE AccessUnderlyingBuffer( + /* [annotation][out] */ + _Out_ UINT *capacity, + /* [annotation][size_is][size_is][out] */ + _Outptr_result_buffer_(*capacity) BYTE **buffer) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_RelativeTime( + /* [annotation][out][retval] */ + _Out_ TIMESPAN *relativeTime) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IAudioBeamSubFrameVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IAudioBeamSubFrame * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IAudioBeamSubFrame * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IAudioBeamSubFrame * This); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_FrameLengthInBytes )( + IAudioBeamSubFrame * This, + /* [annotation][out][retval] */ + _Out_ UINT *length); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Duration )( + IAudioBeamSubFrame * This, + /* [annotation][out][retval] */ + _Out_ TIMESPAN *duration); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_BeamAngle )( + IAudioBeamSubFrame * This, + /* [annotation][out][retval] */ + _Out_ float *beamAngle); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_BeamAngleConfidence )( + IAudioBeamSubFrame * This, + /* [annotation][out][retval] */ + _Out_ float *beamAngleConfidence); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_AudioBeamMode )( + IAudioBeamSubFrame * This, + /* [annotation][out][retval] */ + _Out_ AudioBeamMode *audioBeamMode); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_AudioBodyCorrelationCount )( + IAudioBeamSubFrame * This, + /* [annotation][out][retval] */ + _Out_ UINT32 *pCount); + + HRESULT ( STDMETHODCALLTYPE *GetAudioBodyCorrelation )( + IAudioBeamSubFrame * This, + /* [annotation][in][in] */ + _In_ UINT index, + /* [annotation][out][out] */ + _COM_Outptr_ IAudioBodyCorrelation **ppAudioBodyCorrelation); + + HRESULT ( STDMETHODCALLTYPE *CopyFrameDataToArray )( + IAudioBeamSubFrame * This, + /* [annotation] */ + _Pre_equal_to_(1024) UINT capacity, + /* [annotation][size_is][out] */ + _Out_writes_all_(capacity) BYTE *frameData); + + HRESULT ( STDMETHODCALLTYPE *AccessUnderlyingBuffer )( + IAudioBeamSubFrame * This, + /* [annotation][out] */ + _Out_ UINT *capacity, + /* [annotation][size_is][size_is][out] */ + _Outptr_result_buffer_(*capacity) BYTE **buffer); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_RelativeTime )( + IAudioBeamSubFrame * This, + /* [annotation][out][retval] */ + _Out_ TIMESPAN *relativeTime); + + END_INTERFACE + } IAudioBeamSubFrameVtbl; + + interface IAudioBeamSubFrame + { + CONST_VTBL struct IAudioBeamSubFrameVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IAudioBeamSubFrame_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IAudioBeamSubFrame_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IAudioBeamSubFrame_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IAudioBeamSubFrame_get_FrameLengthInBytes(This,length) \ + ( (This)->lpVtbl -> get_FrameLengthInBytes(This,length) ) + +#define IAudioBeamSubFrame_get_Duration(This,duration) \ + ( (This)->lpVtbl -> get_Duration(This,duration) ) + +#define IAudioBeamSubFrame_get_BeamAngle(This,beamAngle) \ + ( (This)->lpVtbl -> get_BeamAngle(This,beamAngle) ) + +#define IAudioBeamSubFrame_get_BeamAngleConfidence(This,beamAngleConfidence) \ + ( (This)->lpVtbl -> get_BeamAngleConfidence(This,beamAngleConfidence) ) + +#define IAudioBeamSubFrame_get_AudioBeamMode(This,audioBeamMode) \ + ( (This)->lpVtbl -> get_AudioBeamMode(This,audioBeamMode) ) + +#define IAudioBeamSubFrame_get_AudioBodyCorrelationCount(This,pCount) \ + ( (This)->lpVtbl -> get_AudioBodyCorrelationCount(This,pCount) ) + +#define IAudioBeamSubFrame_GetAudioBodyCorrelation(This,index,ppAudioBodyCorrelation) \ + ( (This)->lpVtbl -> GetAudioBodyCorrelation(This,index,ppAudioBodyCorrelation) ) + +#define IAudioBeamSubFrame_CopyFrameDataToArray(This,capacity,frameData) \ + ( (This)->lpVtbl -> CopyFrameDataToArray(This,capacity,frameData) ) + +#define IAudioBeamSubFrame_AccessUnderlyingBuffer(This,capacity,buffer) \ + ( (This)->lpVtbl -> AccessUnderlyingBuffer(This,capacity,buffer) ) + +#define IAudioBeamSubFrame_get_RelativeTime(This,relativeTime) \ + ( (This)->lpVtbl -> get_RelativeTime(This,relativeTime) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IAudioBeamSubFrame_INTERFACE_DEFINED__ */ + + +#ifndef __IAudioBeamFrameReference_INTERFACE_DEFINED__ +#define __IAudioBeamFrameReference_INTERFACE_DEFINED__ + +/* interface IAudioBeamFrameReference */ +/* [object][local][uuid] */ + + +EXTERN_C const IID IID_IAudioBeamFrameReference; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("1BD29D0E-6304-4AFB-9C85-77CFE3DC4FCE") + IAudioBeamFrameReference : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE AcquireBeamFrames( + /* [annotation][out][retval] */ + _COM_Outptr_ IAudioBeamFrameList **audioBeamFrameList) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_RelativeTime( + /* [annotation][out][retval] */ + _Out_ TIMESPAN *relativeTime) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IAudioBeamFrameReferenceVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IAudioBeamFrameReference * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IAudioBeamFrameReference * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IAudioBeamFrameReference * This); + + HRESULT ( STDMETHODCALLTYPE *AcquireBeamFrames )( + IAudioBeamFrameReference * This, + /* [annotation][out][retval] */ + _COM_Outptr_ IAudioBeamFrameList **audioBeamFrameList); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_RelativeTime )( + IAudioBeamFrameReference * This, + /* [annotation][out][retval] */ + _Out_ TIMESPAN *relativeTime); + + END_INTERFACE + } IAudioBeamFrameReferenceVtbl; + + interface IAudioBeamFrameReference + { + CONST_VTBL struct IAudioBeamFrameReferenceVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IAudioBeamFrameReference_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IAudioBeamFrameReference_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IAudioBeamFrameReference_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IAudioBeamFrameReference_AcquireBeamFrames(This,audioBeamFrameList) \ + ( (This)->lpVtbl -> AcquireBeamFrames(This,audioBeamFrameList) ) + +#define IAudioBeamFrameReference_get_RelativeTime(This,relativeTime) \ + ( (This)->lpVtbl -> get_RelativeTime(This,relativeTime) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IAudioBeamFrameReference_INTERFACE_DEFINED__ */ + + +#ifndef __IAudioBodyCorrelation_INTERFACE_DEFINED__ +#define __IAudioBodyCorrelation_INTERFACE_DEFINED__ + +/* interface IAudioBodyCorrelation */ +/* [object][local][uuid] */ + + +EXTERN_C const IID IID_IAudioBodyCorrelation; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("C5BA2355-07DB-47C3-ABC4-68D24B91DE61") + IAudioBodyCorrelation : public IUnknown + { + public: + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_BodyTrackingId( + /* [annotation][out][retval] */ + _Out_ UINT64 *trackingId) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IAudioBodyCorrelationVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IAudioBodyCorrelation * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IAudioBodyCorrelation * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IAudioBodyCorrelation * This); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_BodyTrackingId )( + IAudioBodyCorrelation * This, + /* [annotation][out][retval] */ + _Out_ UINT64 *trackingId); + + END_INTERFACE + } IAudioBodyCorrelationVtbl; + + interface IAudioBodyCorrelation + { + CONST_VTBL struct IAudioBodyCorrelationVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IAudioBodyCorrelation_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IAudioBodyCorrelation_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IAudioBodyCorrelation_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IAudioBodyCorrelation_get_BodyTrackingId(This,trackingId) \ + ( (This)->lpVtbl -> get_BodyTrackingId(This,trackingId) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IAudioBodyCorrelation_INTERFACE_DEFINED__ */ + + +#ifndef __IAudioBeamFrameArrivedEventArgs_INTERFACE_DEFINED__ +#define __IAudioBeamFrameArrivedEventArgs_INTERFACE_DEFINED__ + +/* interface IAudioBeamFrameArrivedEventArgs */ +/* [object][local][uuid] */ + + +EXTERN_C const IID IID_IAudioBeamFrameArrivedEventArgs; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("E0DBE62D-2045-4571-8D1D-ECF3981E3C3D") + IAudioBeamFrameArrivedEventArgs : public IUnknown + { + public: + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_FrameReference( + /* [annotation][out][retval] */ + _COM_Outptr_ IAudioBeamFrameReference **audioBeamFrameReference) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IAudioBeamFrameArrivedEventArgsVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IAudioBeamFrameArrivedEventArgs * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IAudioBeamFrameArrivedEventArgs * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IAudioBeamFrameArrivedEventArgs * This); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_FrameReference )( + IAudioBeamFrameArrivedEventArgs * This, + /* [annotation][out][retval] */ + _COM_Outptr_ IAudioBeamFrameReference **audioBeamFrameReference); + + END_INTERFACE + } IAudioBeamFrameArrivedEventArgsVtbl; + + interface IAudioBeamFrameArrivedEventArgs + { + CONST_VTBL struct IAudioBeamFrameArrivedEventArgsVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IAudioBeamFrameArrivedEventArgs_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IAudioBeamFrameArrivedEventArgs_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IAudioBeamFrameArrivedEventArgs_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IAudioBeamFrameArrivedEventArgs_get_FrameReference(This,audioBeamFrameReference) \ + ( (This)->lpVtbl -> get_FrameReference(This,audioBeamFrameReference) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IAudioBeamFrameArrivedEventArgs_INTERFACE_DEFINED__ */ + + +#ifndef __IAudioBeamFrameReader_INTERFACE_DEFINED__ +#define __IAudioBeamFrameReader_INTERFACE_DEFINED__ + +/* interface IAudioBeamFrameReader */ +/* [object][local][uuid] */ + + +EXTERN_C const IID IID_IAudioBeamFrameReader; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("B5733DE9-6ECF-46B2-8B23-A16D71F1A75C") + IAudioBeamFrameReader : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE SubscribeFrameArrived( + /* [annotation][out][retval] */ + _Out_ WAITABLE_HANDLE *waitableHandle) = 0; + + virtual HRESULT STDMETHODCALLTYPE UnsubscribeFrameArrived( + /* [annotation][in] */ + _In_ WAITABLE_HANDLE waitableHandle) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetFrameArrivedEventData( + /* [annotation][in] */ + _In_ WAITABLE_HANDLE waitableHandle, + /* [annotation][out][retval] */ + _Out_ IAudioBeamFrameArrivedEventArgs **eventData) = 0; + + virtual HRESULT STDMETHODCALLTYPE AcquireLatestBeamFrames( + /* [annotation][out][retval] */ + _COM_Outptr_ IAudioBeamFrameList **audioBeamFrameList) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_IsPaused( + /* [annotation][out][retval] */ + _Out_ BOOLEAN *isPaused) = 0; + + virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_IsPaused( + BOOLEAN isPaused) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_AudioSource( + /* [annotation][out][retval] */ + _COM_Outptr_ IAudioSource **audioSource) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IAudioBeamFrameReaderVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IAudioBeamFrameReader * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IAudioBeamFrameReader * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IAudioBeamFrameReader * This); + + HRESULT ( STDMETHODCALLTYPE *SubscribeFrameArrived )( + IAudioBeamFrameReader * This, + /* [annotation][out][retval] */ + _Out_ WAITABLE_HANDLE *waitableHandle); + + HRESULT ( STDMETHODCALLTYPE *UnsubscribeFrameArrived )( + IAudioBeamFrameReader * This, + /* [annotation][in] */ + _In_ WAITABLE_HANDLE waitableHandle); + + HRESULT ( STDMETHODCALLTYPE *GetFrameArrivedEventData )( + IAudioBeamFrameReader * This, + /* [annotation][in] */ + _In_ WAITABLE_HANDLE waitableHandle, + /* [annotation][out][retval] */ + _Out_ IAudioBeamFrameArrivedEventArgs **eventData); + + HRESULT ( STDMETHODCALLTYPE *AcquireLatestBeamFrames )( + IAudioBeamFrameReader * This, + /* [annotation][out][retval] */ + _COM_Outptr_ IAudioBeamFrameList **audioBeamFrameList); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_IsPaused )( + IAudioBeamFrameReader * This, + /* [annotation][out][retval] */ + _Out_ BOOLEAN *isPaused); + + /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_IsPaused )( + IAudioBeamFrameReader * This, + BOOLEAN isPaused); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_AudioSource )( + IAudioBeamFrameReader * This, + /* [annotation][out][retval] */ + _COM_Outptr_ IAudioSource **audioSource); + + END_INTERFACE + } IAudioBeamFrameReaderVtbl; + + interface IAudioBeamFrameReader + { + CONST_VTBL struct IAudioBeamFrameReaderVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IAudioBeamFrameReader_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IAudioBeamFrameReader_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IAudioBeamFrameReader_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IAudioBeamFrameReader_SubscribeFrameArrived(This,waitableHandle) \ + ( (This)->lpVtbl -> SubscribeFrameArrived(This,waitableHandle) ) + +#define IAudioBeamFrameReader_UnsubscribeFrameArrived(This,waitableHandle) \ + ( (This)->lpVtbl -> UnsubscribeFrameArrived(This,waitableHandle) ) + +#define IAudioBeamFrameReader_GetFrameArrivedEventData(This,waitableHandle,eventData) \ + ( (This)->lpVtbl -> GetFrameArrivedEventData(This,waitableHandle,eventData) ) + +#define IAudioBeamFrameReader_AcquireLatestBeamFrames(This,audioBeamFrameList) \ + ( (This)->lpVtbl -> AcquireLatestBeamFrames(This,audioBeamFrameList) ) + +#define IAudioBeamFrameReader_get_IsPaused(This,isPaused) \ + ( (This)->lpVtbl -> get_IsPaused(This,isPaused) ) + +#define IAudioBeamFrameReader_put_IsPaused(This,isPaused) \ + ( (This)->lpVtbl -> put_IsPaused(This,isPaused) ) + +#define IAudioBeamFrameReader_get_AudioSource(This,audioSource) \ + ( (This)->lpVtbl -> get_AudioSource(This,audioSource) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IAudioBeamFrameReader_INTERFACE_DEFINED__ */ + + +#ifndef __IAudioSource_INTERFACE_DEFINED__ +#define __IAudioSource_INTERFACE_DEFINED__ + +/* interface IAudioSource */ +/* [object][local][uuid] */ + + +EXTERN_C const IID IID_IAudioSource; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("52D1D743-AED1-4E61-8AF8-19EF287A662C") + IAudioSource : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE SubscribeFrameCaptured( + /* [annotation][out][retval] */ + _Out_ WAITABLE_HANDLE *waitableHandle) = 0; + + virtual HRESULT STDMETHODCALLTYPE UnsubscribeFrameCaptured( + /* [annotation][in] */ + _In_ WAITABLE_HANDLE waitableHandle) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetFrameCapturedEventData( + /* [annotation][in] */ + _In_ WAITABLE_HANDLE waitableHandle, + /* [annotation][out][retval] */ + _Out_ IFrameCapturedEventArgs **eventData) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_KinectSensor( + /* [annotation][out][retval] */ + _COM_Outptr_ IKinectSensor **sensor) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_IsActive( + /* [annotation][out][retval] */ + _Out_ BOOLEAN *isActive) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_SubFrameLengthInBytes( + /* [annotation][out][retval] */ + _Out_ UINT *length) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_SubFrameDuration( + /* [annotation][out][retval] */ + _Out_ TIMESPAN *duration) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_MaxSubFrameCount( + /* [annotation][out][retval] */ + _Out_ UINT *count) = 0; + + virtual HRESULT STDMETHODCALLTYPE OpenReader( + /* [annotation][out][retval] */ + _COM_Outptr_ IAudioBeamFrameReader **reader) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_AudioBeams( + /* [annotation][out][retval] */ + _COM_Outptr_ IAudioBeamList **audioBeamList) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_AudioCalibrationState( + /* [annotation][out][retval] */ + _Out_ KinectAudioCalibrationState *audioCalibrationState) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IAudioSourceVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IAudioSource * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IAudioSource * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IAudioSource * This); + + HRESULT ( STDMETHODCALLTYPE *SubscribeFrameCaptured )( + IAudioSource * This, + /* [annotation][out][retval] */ + _Out_ WAITABLE_HANDLE *waitableHandle); + + HRESULT ( STDMETHODCALLTYPE *UnsubscribeFrameCaptured )( + IAudioSource * This, + /* [annotation][in] */ + _In_ WAITABLE_HANDLE waitableHandle); + + HRESULT ( STDMETHODCALLTYPE *GetFrameCapturedEventData )( + IAudioSource * This, + /* [annotation][in] */ + _In_ WAITABLE_HANDLE waitableHandle, + /* [annotation][out][retval] */ + _Out_ IFrameCapturedEventArgs **eventData); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_KinectSensor )( + IAudioSource * This, + /* [annotation][out][retval] */ + _COM_Outptr_ IKinectSensor **sensor); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_IsActive )( + IAudioSource * This, + /* [annotation][out][retval] */ + _Out_ BOOLEAN *isActive); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_SubFrameLengthInBytes )( + IAudioSource * This, + /* [annotation][out][retval] */ + _Out_ UINT *length); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_SubFrameDuration )( + IAudioSource * This, + /* [annotation][out][retval] */ + _Out_ TIMESPAN *duration); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_MaxSubFrameCount )( + IAudioSource * This, + /* [annotation][out][retval] */ + _Out_ UINT *count); + + HRESULT ( STDMETHODCALLTYPE *OpenReader )( + IAudioSource * This, + /* [annotation][out][retval] */ + _COM_Outptr_ IAudioBeamFrameReader **reader); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_AudioBeams )( + IAudioSource * This, + /* [annotation][out][retval] */ + _COM_Outptr_ IAudioBeamList **audioBeamList); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_AudioCalibrationState )( + IAudioSource * This, + /* [annotation][out][retval] */ + _Out_ KinectAudioCalibrationState *audioCalibrationState); + + END_INTERFACE + } IAudioSourceVtbl; + + interface IAudioSource + { + CONST_VTBL struct IAudioSourceVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IAudioSource_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IAudioSource_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IAudioSource_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IAudioSource_SubscribeFrameCaptured(This,waitableHandle) \ + ( (This)->lpVtbl -> SubscribeFrameCaptured(This,waitableHandle) ) + +#define IAudioSource_UnsubscribeFrameCaptured(This,waitableHandle) \ + ( (This)->lpVtbl -> UnsubscribeFrameCaptured(This,waitableHandle) ) + +#define IAudioSource_GetFrameCapturedEventData(This,waitableHandle,eventData) \ + ( (This)->lpVtbl -> GetFrameCapturedEventData(This,waitableHandle,eventData) ) + +#define IAudioSource_get_KinectSensor(This,sensor) \ + ( (This)->lpVtbl -> get_KinectSensor(This,sensor) ) + +#define IAudioSource_get_IsActive(This,isActive) \ + ( (This)->lpVtbl -> get_IsActive(This,isActive) ) + +#define IAudioSource_get_SubFrameLengthInBytes(This,length) \ + ( (This)->lpVtbl -> get_SubFrameLengthInBytes(This,length) ) + +#define IAudioSource_get_SubFrameDuration(This,duration) \ + ( (This)->lpVtbl -> get_SubFrameDuration(This,duration) ) + +#define IAudioSource_get_MaxSubFrameCount(This,count) \ + ( (This)->lpVtbl -> get_MaxSubFrameCount(This,count) ) + +#define IAudioSource_OpenReader(This,reader) \ + ( (This)->lpVtbl -> OpenReader(This,reader) ) + +#define IAudioSource_get_AudioBeams(This,audioBeamList) \ + ( (This)->lpVtbl -> get_AudioBeams(This,audioBeamList) ) + +#define IAudioSource_get_AudioCalibrationState(This,audioCalibrationState) \ + ( (This)->lpVtbl -> get_AudioCalibrationState(This,audioCalibrationState) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IAudioSource_INTERFACE_DEFINED__ */ + + +#ifndef __ICoordinateMapper_INTERFACE_DEFINED__ +#define __ICoordinateMapper_INTERFACE_DEFINED__ + +/* interface ICoordinateMapper */ +/* [object][local][uuid] */ + + +EXTERN_C const IID IID_ICoordinateMapper; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("8784DF2D-16B0-481C-A11E-55E70BF25018") + ICoordinateMapper : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE SubscribeCoordinateMappingChanged( + /* [annotation][out][retval] */ + _Out_ WAITABLE_HANDLE *waitableHandle) = 0; + + virtual HRESULT STDMETHODCALLTYPE UnsubscribeCoordinateMappingChanged( + /* [annotation][in] */ + _In_ WAITABLE_HANDLE waitableHandle) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetCoordinateMappingChangedEventData( + /* [annotation][in] */ + _In_ WAITABLE_HANDLE waitableHandle, + /* [annotation][out][retval] */ + _Out_ ICoordinateMappingChangedEventArgs **eventData) = 0; + + virtual HRESULT STDMETHODCALLTYPE MapCameraPointToDepthSpace( + CameraSpacePoint cameraPoint, + /* [annotation][out][retval] */ + _Out_ DepthSpacePoint *depthPoint) = 0; + + virtual HRESULT STDMETHODCALLTYPE MapCameraPointToColorSpace( + CameraSpacePoint cameraPoint, + /* [annotation][out][retval] */ + _Out_ ColorSpacePoint *colorPoint) = 0; + + virtual HRESULT STDMETHODCALLTYPE MapDepthPointToCameraSpace( + DepthSpacePoint depthPoint, + UINT16 depth, + /* [annotation][out][retval] */ + _Out_ CameraSpacePoint *cameraPoint) = 0; + + virtual HRESULT STDMETHODCALLTYPE MapDepthPointToColorSpace( + DepthSpacePoint depthPoint, + UINT16 depth, + /* [annotation][out][retval] */ + _Out_ ColorSpacePoint *colorPoint) = 0; + + virtual HRESULT STDMETHODCALLTYPE MapCameraPointsToDepthSpace( + UINT cameraPointCount, + /* [annotation][size_is][in] */ + _In_reads_(cameraPointCount) const CameraSpacePoint *cameraPoints, + UINT depthPointCount, + /* [annotation][size_is][out] */ + _Out_writes_all_(depthPointCount) DepthSpacePoint *depthPoints) = 0; + + virtual HRESULT STDMETHODCALLTYPE MapCameraPointsToColorSpace( + UINT cameraPointCount, + /* [annotation][size_is][in] */ + _In_reads_(cameraPointCount) const CameraSpacePoint *cameraPoints, + UINT colorPointCount, + /* [annotation][size_is][out] */ + _Out_writes_all_(colorPointCount) ColorSpacePoint *colorPoints) = 0; + + virtual HRESULT STDMETHODCALLTYPE MapDepthPointsToCameraSpace( + UINT depthPointCount, + /* [annotation][size_is][in] */ + _In_reads_(depthPointCount) const DepthSpacePoint *depthPoints, + UINT depthCount, + /* [annotation][size_is][in] */ + _In_reads_(depthCount) const UINT16 *depths, + UINT cameraPointCount, + /* [annotation][size_is][out] */ + _Out_writes_all_(cameraPointCount) CameraSpacePoint *cameraPoints) = 0; + + virtual HRESULT STDMETHODCALLTYPE MapDepthPointsToColorSpace( + UINT depthPointCount, + /* [annotation][size_is][in] */ + _In_reads_(depthPointCount) const DepthSpacePoint *depthPoints, + UINT depthCount, + /* [annotation][size_is][in] */ + _In_reads_(depthCount) const UINT16 *depths, + UINT colorPointCount, + /* [annotation][size_is][out] */ + _Out_writes_all_(colorPointCount) ColorSpacePoint *colorPoints) = 0; + + virtual HRESULT STDMETHODCALLTYPE MapDepthFrameToCameraSpace( + UINT depthPointCount, + /* [annotation][size_is][in] */ + _In_reads_(depthPointCount) const UINT16 *depthFrameData, + UINT cameraPointCount, + /* [annotation][size_is][out] */ + _Out_writes_all_(cameraPointCount) CameraSpacePoint *cameraSpacePoints) = 0; + + virtual HRESULT STDMETHODCALLTYPE MapDepthFrameToColorSpace( + UINT depthPointCount, + /* [annotation][size_is][in] */ + _In_reads_(depthPointCount) const UINT16 *depthFrameData, + UINT colorPointCount, + /* [annotation][size_is][out] */ + _Out_writes_all_(colorPointCount) ColorSpacePoint *colorSpacePoints) = 0; + + virtual HRESULT STDMETHODCALLTYPE MapColorFrameToDepthSpace( + UINT depthDataPointCount, + /* [annotation][size_is][in] */ + _In_reads_(depthDataPointCount) const UINT16 *depthFrameData, + UINT depthPointCount, + /* [annotation][size_is][out] */ + _Out_writes_all_(depthPointCount) DepthSpacePoint *depthSpacePoints) = 0; + + virtual HRESULT STDMETHODCALLTYPE MapColorFrameToCameraSpace( + UINT depthDataPointCount, + /* [annotation][size_is][in] */ + _In_reads_(depthDataPointCount) const UINT16 *depthFrameData, + UINT cameraPointCount, + /* [annotation][size_is][out] */ + _Out_writes_all_(cameraPointCount) CameraSpacePoint *cameraSpacePoints) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetDepthFrameToCameraSpaceTable( + /* [annotation][out] */ + _Out_ UINT32 *tableEntryCount, + /* [annotation][size_is][size_is][out][retval] */ + _Outptr_result_buffer_(*tableEntryCount) PointF **tableEntries) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetDepthCameraIntrinsics( + /* [annotation][out][retval] */ + _Out_ CameraIntrinsics *cameraIntrinsics) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ICoordinateMapperVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ICoordinateMapper * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ICoordinateMapper * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ICoordinateMapper * This); + + HRESULT ( STDMETHODCALLTYPE *SubscribeCoordinateMappingChanged )( + ICoordinateMapper * This, + /* [annotation][out][retval] */ + _Out_ WAITABLE_HANDLE *waitableHandle); + + HRESULT ( STDMETHODCALLTYPE *UnsubscribeCoordinateMappingChanged )( + ICoordinateMapper * This, + /* [annotation][in] */ + _In_ WAITABLE_HANDLE waitableHandle); + + HRESULT ( STDMETHODCALLTYPE *GetCoordinateMappingChangedEventData )( + ICoordinateMapper * This, + /* [annotation][in] */ + _In_ WAITABLE_HANDLE waitableHandle, + /* [annotation][out][retval] */ + _Out_ ICoordinateMappingChangedEventArgs **eventData); + + HRESULT ( STDMETHODCALLTYPE *MapCameraPointToDepthSpace )( + ICoordinateMapper * This, + CameraSpacePoint cameraPoint, + /* [annotation][out][retval] */ + _Out_ DepthSpacePoint *depthPoint); + + HRESULT ( STDMETHODCALLTYPE *MapCameraPointToColorSpace )( + ICoordinateMapper * This, + CameraSpacePoint cameraPoint, + /* [annotation][out][retval] */ + _Out_ ColorSpacePoint *colorPoint); + + HRESULT ( STDMETHODCALLTYPE *MapDepthPointToCameraSpace )( + ICoordinateMapper * This, + DepthSpacePoint depthPoint, + UINT16 depth, + /* [annotation][out][retval] */ + _Out_ CameraSpacePoint *cameraPoint); + + HRESULT ( STDMETHODCALLTYPE *MapDepthPointToColorSpace )( + ICoordinateMapper * This, + DepthSpacePoint depthPoint, + UINT16 depth, + /* [annotation][out][retval] */ + _Out_ ColorSpacePoint *colorPoint); + + HRESULT ( STDMETHODCALLTYPE *MapCameraPointsToDepthSpace )( + ICoordinateMapper * This, + UINT cameraPointCount, + /* [annotation][size_is][in] */ + _In_reads_(cameraPointCount) const CameraSpacePoint *cameraPoints, + UINT depthPointCount, + /* [annotation][size_is][out] */ + _Out_writes_all_(depthPointCount) DepthSpacePoint *depthPoints); + + HRESULT ( STDMETHODCALLTYPE *MapCameraPointsToColorSpace )( + ICoordinateMapper * This, + UINT cameraPointCount, + /* [annotation][size_is][in] */ + _In_reads_(cameraPointCount) const CameraSpacePoint *cameraPoints, + UINT colorPointCount, + /* [annotation][size_is][out] */ + _Out_writes_all_(colorPointCount) ColorSpacePoint *colorPoints); + + HRESULT ( STDMETHODCALLTYPE *MapDepthPointsToCameraSpace )( + ICoordinateMapper * This, + UINT depthPointCount, + /* [annotation][size_is][in] */ + _In_reads_(depthPointCount) const DepthSpacePoint *depthPoints, + UINT depthCount, + /* [annotation][size_is][in] */ + _In_reads_(depthCount) const UINT16 *depths, + UINT cameraPointCount, + /* [annotation][size_is][out] */ + _Out_writes_all_(cameraPointCount) CameraSpacePoint *cameraPoints); + + HRESULT ( STDMETHODCALLTYPE *MapDepthPointsToColorSpace )( + ICoordinateMapper * This, + UINT depthPointCount, + /* [annotation][size_is][in] */ + _In_reads_(depthPointCount) const DepthSpacePoint *depthPoints, + UINT depthCount, + /* [annotation][size_is][in] */ + _In_reads_(depthCount) const UINT16 *depths, + UINT colorPointCount, + /* [annotation][size_is][out] */ + _Out_writes_all_(colorPointCount) ColorSpacePoint *colorPoints); + + HRESULT ( STDMETHODCALLTYPE *MapDepthFrameToCameraSpace )( + ICoordinateMapper * This, + UINT depthPointCount, + /* [annotation][size_is][in] */ + _In_reads_(depthPointCount) const UINT16 *depthFrameData, + UINT cameraPointCount, + /* [annotation][size_is][out] */ + _Out_writes_all_(cameraPointCount) CameraSpacePoint *cameraSpacePoints); + + HRESULT ( STDMETHODCALLTYPE *MapDepthFrameToColorSpace )( + ICoordinateMapper * This, + UINT depthPointCount, + /* [annotation][size_is][in] */ + _In_reads_(depthPointCount) const UINT16 *depthFrameData, + UINT colorPointCount, + /* [annotation][size_is][out] */ + _Out_writes_all_(colorPointCount) ColorSpacePoint *colorSpacePoints); + + HRESULT ( STDMETHODCALLTYPE *MapColorFrameToDepthSpace )( + ICoordinateMapper * This, + UINT depthDataPointCount, + /* [annotation][size_is][in] */ + _In_reads_(depthDataPointCount) const UINT16 *depthFrameData, + UINT depthPointCount, + /* [annotation][size_is][out] */ + _Out_writes_all_(depthPointCount) DepthSpacePoint *depthSpacePoints); + + HRESULT ( STDMETHODCALLTYPE *MapColorFrameToCameraSpace )( + ICoordinateMapper * This, + UINT depthDataPointCount, + /* [annotation][size_is][in] */ + _In_reads_(depthDataPointCount) const UINT16 *depthFrameData, + UINT cameraPointCount, + /* [annotation][size_is][out] */ + _Out_writes_all_(cameraPointCount) CameraSpacePoint *cameraSpacePoints); + + HRESULT ( STDMETHODCALLTYPE *GetDepthFrameToCameraSpaceTable )( + ICoordinateMapper * This, + /* [annotation][out] */ + _Out_ UINT32 *tableEntryCount, + /* [annotation][size_is][size_is][out][retval] */ + _Outptr_result_buffer_(*tableEntryCount) PointF **tableEntries); + + HRESULT ( STDMETHODCALLTYPE *GetDepthCameraIntrinsics )( + ICoordinateMapper * This, + /* [annotation][out][retval] */ + _Out_ CameraIntrinsics *cameraIntrinsics); + + END_INTERFACE + } ICoordinateMapperVtbl; + + interface ICoordinateMapper + { + CONST_VTBL struct ICoordinateMapperVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ICoordinateMapper_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ICoordinateMapper_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ICoordinateMapper_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ICoordinateMapper_SubscribeCoordinateMappingChanged(This,waitableHandle) \ + ( (This)->lpVtbl -> SubscribeCoordinateMappingChanged(This,waitableHandle) ) + +#define ICoordinateMapper_UnsubscribeCoordinateMappingChanged(This,waitableHandle) \ + ( (This)->lpVtbl -> UnsubscribeCoordinateMappingChanged(This,waitableHandle) ) + +#define ICoordinateMapper_GetCoordinateMappingChangedEventData(This,waitableHandle,eventData) \ + ( (This)->lpVtbl -> GetCoordinateMappingChangedEventData(This,waitableHandle,eventData) ) + +#define ICoordinateMapper_MapCameraPointToDepthSpace(This,cameraPoint,depthPoint) \ + ( (This)->lpVtbl -> MapCameraPointToDepthSpace(This,cameraPoint,depthPoint) ) + +#define ICoordinateMapper_MapCameraPointToColorSpace(This,cameraPoint,colorPoint) \ + ( (This)->lpVtbl -> MapCameraPointToColorSpace(This,cameraPoint,colorPoint) ) + +#define ICoordinateMapper_MapDepthPointToCameraSpace(This,depthPoint,depth,cameraPoint) \ + ( (This)->lpVtbl -> MapDepthPointToCameraSpace(This,depthPoint,depth,cameraPoint) ) + +#define ICoordinateMapper_MapDepthPointToColorSpace(This,depthPoint,depth,colorPoint) \ + ( (This)->lpVtbl -> MapDepthPointToColorSpace(This,depthPoint,depth,colorPoint) ) + +#define ICoordinateMapper_MapCameraPointsToDepthSpace(This,cameraPointCount,cameraPoints,depthPointCount,depthPoints) \ + ( (This)->lpVtbl -> MapCameraPointsToDepthSpace(This,cameraPointCount,cameraPoints,depthPointCount,depthPoints) ) + +#define ICoordinateMapper_MapCameraPointsToColorSpace(This,cameraPointCount,cameraPoints,colorPointCount,colorPoints) \ + ( (This)->lpVtbl -> MapCameraPointsToColorSpace(This,cameraPointCount,cameraPoints,colorPointCount,colorPoints) ) + +#define ICoordinateMapper_MapDepthPointsToCameraSpace(This,depthPointCount,depthPoints,depthCount,depths,cameraPointCount,cameraPoints) \ + ( (This)->lpVtbl -> MapDepthPointsToCameraSpace(This,depthPointCount,depthPoints,depthCount,depths,cameraPointCount,cameraPoints) ) + +#define ICoordinateMapper_MapDepthPointsToColorSpace(This,depthPointCount,depthPoints,depthCount,depths,colorPointCount,colorPoints) \ + ( (This)->lpVtbl -> MapDepthPointsToColorSpace(This,depthPointCount,depthPoints,depthCount,depths,colorPointCount,colorPoints) ) + +#define ICoordinateMapper_MapDepthFrameToCameraSpace(This,depthPointCount,depthFrameData,cameraPointCount,cameraSpacePoints) \ + ( (This)->lpVtbl -> MapDepthFrameToCameraSpace(This,depthPointCount,depthFrameData,cameraPointCount,cameraSpacePoints) ) + +#define ICoordinateMapper_MapDepthFrameToColorSpace(This,depthPointCount,depthFrameData,colorPointCount,colorSpacePoints) \ + ( (This)->lpVtbl -> MapDepthFrameToColorSpace(This,depthPointCount,depthFrameData,colorPointCount,colorSpacePoints) ) + +#define ICoordinateMapper_MapColorFrameToDepthSpace(This,depthDataPointCount,depthFrameData,depthPointCount,depthSpacePoints) \ + ( (This)->lpVtbl -> MapColorFrameToDepthSpace(This,depthDataPointCount,depthFrameData,depthPointCount,depthSpacePoints) ) + +#define ICoordinateMapper_MapColorFrameToCameraSpace(This,depthDataPointCount,depthFrameData,cameraPointCount,cameraSpacePoints) \ + ( (This)->lpVtbl -> MapColorFrameToCameraSpace(This,depthDataPointCount,depthFrameData,cameraPointCount,cameraSpacePoints) ) + +#define ICoordinateMapper_GetDepthFrameToCameraSpaceTable(This,tableEntryCount,tableEntries) \ + ( (This)->lpVtbl -> GetDepthFrameToCameraSpaceTable(This,tableEntryCount,tableEntries) ) + +#define ICoordinateMapper_GetDepthCameraIntrinsics(This,cameraIntrinsics) \ + ( (This)->lpVtbl -> GetDepthCameraIntrinsics(This,cameraIntrinsics) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ICoordinateMapper_INTERFACE_DEFINED__ */ + + +#ifndef __ICoordinateMappingChangedEventArgs_INTERFACE_DEFINED__ +#define __ICoordinateMappingChangedEventArgs_INTERFACE_DEFINED__ + +/* interface ICoordinateMappingChangedEventArgs */ +/* [object][local][uuid] */ + + +EXTERN_C const IID IID_ICoordinateMappingChangedEventArgs; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("E9A2A0BF-13BD-4A53-A157-91FC8BB41F85") + ICoordinateMappingChangedEventArgs : public IUnknown + { + public: + }; + + +#else /* C style interface */ + + typedef struct ICoordinateMappingChangedEventArgsVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ICoordinateMappingChangedEventArgs * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ICoordinateMappingChangedEventArgs * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ICoordinateMappingChangedEventArgs * This); + + END_INTERFACE + } ICoordinateMappingChangedEventArgsVtbl; + + interface ICoordinateMappingChangedEventArgs + { + CONST_VTBL struct ICoordinateMappingChangedEventArgsVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ICoordinateMappingChangedEventArgs_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ICoordinateMappingChangedEventArgs_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ICoordinateMappingChangedEventArgs_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ICoordinateMappingChangedEventArgs_INTERFACE_DEFINED__ */ + + +#ifndef __IColorCameraSettings_INTERFACE_DEFINED__ +#define __IColorCameraSettings_INTERFACE_DEFINED__ + +/* interface IColorCameraSettings */ +/* [object][local][uuid] */ + + +EXTERN_C const IID IID_IColorCameraSettings; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("DBF802AB-0ADF-485A-A844-CF1C7956D039") + IColorCameraSettings : public IUnknown + { + public: + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_ExposureTime( + /* [annotation][out][retval] */ + _Out_ TIMESPAN *exposureTime) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_FrameInterval( + /* [annotation][out][retval] */ + _Out_ TIMESPAN *frameInterval) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Gain( + /* [annotation][out][retval] */ + _Out_ float *gain) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Gamma( + /* [annotation][out][retval] */ + _Out_ float *gamma) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IColorCameraSettingsVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IColorCameraSettings * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IColorCameraSettings * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IColorCameraSettings * This); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_ExposureTime )( + IColorCameraSettings * This, + /* [annotation][out][retval] */ + _Out_ TIMESPAN *exposureTime); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_FrameInterval )( + IColorCameraSettings * This, + /* [annotation][out][retval] */ + _Out_ TIMESPAN *frameInterval); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Gain )( + IColorCameraSettings * This, + /* [annotation][out][retval] */ + _Out_ float *gain); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Gamma )( + IColorCameraSettings * This, + /* [annotation][out][retval] */ + _Out_ float *gamma); + + END_INTERFACE + } IColorCameraSettingsVtbl; + + interface IColorCameraSettings + { + CONST_VTBL struct IColorCameraSettingsVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IColorCameraSettings_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IColorCameraSettings_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IColorCameraSettings_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IColorCameraSettings_get_ExposureTime(This,exposureTime) \ + ( (This)->lpVtbl -> get_ExposureTime(This,exposureTime) ) + +#define IColorCameraSettings_get_FrameInterval(This,frameInterval) \ + ( (This)->lpVtbl -> get_FrameInterval(This,frameInterval) ) + +#define IColorCameraSettings_get_Gain(This,gain) \ + ( (This)->lpVtbl -> get_Gain(This,gain) ) + +#define IColorCameraSettings_get_Gamma(This,gamma) \ + ( (This)->lpVtbl -> get_Gamma(This,gamma) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IColorCameraSettings_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_Kinect2ECOM_0000_0052 */ +/* [local] */ + +HRESULT WINAPI GetDefaultKinectSensor(_COM_Outptr_ IKinectSensor** defaultKinectSensor); +#define BODY_COUNT 6 + +#ifndef _PointerDeviceType_ +#define _PointerDeviceType_ +typedef enum _PointerDeviceType PointerDeviceType; + + +enum _PointerDeviceType + { + PointerDeviceType_Touch = 0, + PointerDeviceType_Pen = 1, + PointerDeviceType_Mouse = 2, + PointerDeviceType_Kinect = 3 + } ; +#endif // _PointerDeviceType_ +#ifndef _HandType_ +#define _HandType_ +typedef enum _HandType HandType; + + +enum _HandType + { + HandType_NONE = 0, + HandType_LEFT = ( HandType_NONE + 1 ) , + HandType_RIGHT = ( HandType_LEFT + 1 ) + } ; +#endif // _HandType_ +#ifndef _KinectHoldingState_ +#define _KinectHoldingState_ +typedef enum _KinectHoldingState KinectHoldingState; + + +enum _KinectHoldingState + { + KinectHoldingState_Started = 0, + KinectHoldingState_Completed = 1, + KinectHoldingState_Canceled = 2 + } ; +#endif // _KinectHoldingState_ +#ifndef _KinectGestureSettings_ +#define _KinectGestureSettings_ +typedef enum _KinectGestureSettings KinectGestureSettings; + + +enum _KinectGestureSettings + { + KinectGestureSettings_None = 0, + KinectGestureSettings_Tap = 0x1, + KinectGestureSettings_ManipulationTranslateX = 0x40, + KinectGestureSettings_ManipulationTranslateY = 0x80, + KinectGestureSettings_ManipulationTranslateRailsX = 0x100, + KinectGestureSettings_ManipulationTranslateRailsY = 0x200, + KinectGestureSettings_ManipulationScale = 0x800, + KinectGestureSettings_ManipulationTranslateInertia = 0x1000, + KinectGestureSettings_KinectHold = 0x10000 + } ; +#endif // _KinectGestureSettings_ +#ifndef _KinectInteractionMode_ +#define _KinectInteractionMode_ +typedef enum _KinectInteractionMode KinectInteractionMode; + + +enum _KinectInteractionMode + { + KinectInteractionMode_Normal = 0, + KinectInteractionMode_Off = 1, + KinectInteractionMode_Media = 2 + } ; +#endif // _KinectInteractionMode_ +#ifndef _KinectEngagementMode_ +#define _KinectEngagementMode_ +typedef enum _KinectEngagementMode KinectEngagementMode; + + +enum _KinectEngagementMode + { + KinectEngagementMode_None = 0, + KinectEngagementMode_SystemOnePerson = 1, + KinectEngagementMode_SystemTwoPerson = 2, + KinectEngagementMode_ManualOnePerson = 3, + KinectEngagementMode_ManualTwoPerson = 4 + } ; +#endif // _KinectEngagementMode_ +#ifndef _KinectManipulationDelta_ +#define _KinectManipulationDelta_ +typedef struct _KinectManipulationDelta + { + PointF Translation; + float Scale; + float Rotation; + float Expansion; + } KinectManipulationDelta; + +#endif // _KinectManipulationDelta_ +#ifndef _KinectManipulationVelocities_ +#define _KinectManipulationVelocities_ +typedef struct _KinectManipulationVelocities + { + PointF Linear; + float Angular; + float Expansion; + } KinectManipulationVelocities; + +#endif // _KinectManipulationVelocities_ + + + + + + + + + + + + + + + + + + + + +extern RPC_IF_HANDLE __MIDL_itf_Kinect2ECOM_0000_0052_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_Kinect2ECOM_0000_0052_v0_0_s_ifspec; + +#ifndef __IBodyHandPair_INTERFACE_DEFINED__ +#define __IBodyHandPair_INTERFACE_DEFINED__ + +/* interface IBodyHandPair */ +/* [object][local][uuid] */ + + +EXTERN_C const IID IID_IBodyHandPair; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("3F0C2E40-E9DC-4178-A8F5-5600E059C84C") + IBodyHandPair : public IUnknown + { + public: + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_BodyTrackingId( + /* [annotation][out][retval] */ + _Out_ UINT64 *value) = 0; + + virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_BodyTrackingId( + /* [in] */ UINT64 value) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_HandType( + /* [annotation][out][retval] */ + _Out_ HandType *value) = 0; + + virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_HandType( + /* [in] */ HandType value) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IBodyHandPairVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IBodyHandPair * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IBodyHandPair * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IBodyHandPair * This); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_BodyTrackingId )( + IBodyHandPair * This, + /* [annotation][out][retval] */ + _Out_ UINT64 *value); + + /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_BodyTrackingId )( + IBodyHandPair * This, + /* [in] */ UINT64 value); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_HandType )( + IBodyHandPair * This, + /* [annotation][out][retval] */ + _Out_ HandType *value); + + /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_HandType )( + IBodyHandPair * This, + /* [in] */ HandType value); + + END_INTERFACE + } IBodyHandPairVtbl; + + interface IBodyHandPair + { + CONST_VTBL struct IBodyHandPairVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IBodyHandPair_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IBodyHandPair_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IBodyHandPair_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IBodyHandPair_get_BodyTrackingId(This,value) \ + ( (This)->lpVtbl -> get_BodyTrackingId(This,value) ) + +#define IBodyHandPair_put_BodyTrackingId(This,value) \ + ( (This)->lpVtbl -> put_BodyTrackingId(This,value) ) + +#define IBodyHandPair_get_HandType(This,value) \ + ( (This)->lpVtbl -> get_HandType(This,value) ) + +#define IBodyHandPair_put_HandType(This,value) \ + ( (This)->lpVtbl -> put_HandType(This,value) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IBodyHandPair_INTERFACE_DEFINED__ */ + + +#ifndef __IKinectCoreWindow_INTERFACE_DEFINED__ +#define __IKinectCoreWindow_INTERFACE_DEFINED__ + +/* interface IKinectCoreWindow */ +/* [object][local][uuid] */ + + +EXTERN_C const IID IID_IKinectCoreWindow; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("6B5DDAC2-1C7A-4962-937B-A7A527149C64") + IKinectCoreWindow : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE SubscribePointerEntered( + /* [annotation][out][retval] */ + _Out_ WAITABLE_HANDLE *waitableHandle) = 0; + + virtual HRESULT STDMETHODCALLTYPE UnsubscribePointerEntered( + /* [annotation][in] */ + _In_ WAITABLE_HANDLE waitableHandle) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetPointerEnteredEventData( + /* [annotation][in] */ + _In_ WAITABLE_HANDLE waitableHandle, + /* [annotation][out][retval] */ + _Out_ IKinectPointerEventArgs **eventData) = 0; + + virtual HRESULT STDMETHODCALLTYPE SubscribePointerMoved( + /* [annotation][out][retval] */ + _Out_ WAITABLE_HANDLE *waitableHandle) = 0; + + virtual HRESULT STDMETHODCALLTYPE UnsubscribePointerMoved( + /* [annotation][in] */ + _In_ WAITABLE_HANDLE waitableHandle) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetPointerMovedEventData( + /* [annotation][in] */ + _In_ WAITABLE_HANDLE waitableHandle, + /* [annotation][out][retval] */ + _Out_ IKinectPointerEventArgs **eventData) = 0; + + virtual HRESULT STDMETHODCALLTYPE SubscribePointerExited( + /* [annotation][out][retval] */ + _Out_ WAITABLE_HANDLE *waitableHandle) = 0; + + virtual HRESULT STDMETHODCALLTYPE UnsubscribePointerExited( + /* [annotation][in] */ + _In_ WAITABLE_HANDLE waitableHandle) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetPointerExitedEventData( + /* [annotation][in] */ + _In_ WAITABLE_HANDLE waitableHandle, + /* [annotation][out][retval] */ + _Out_ IKinectPointerEventArgs **eventData) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IKinectCoreWindowVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IKinectCoreWindow * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IKinectCoreWindow * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IKinectCoreWindow * This); + + HRESULT ( STDMETHODCALLTYPE *SubscribePointerEntered )( + IKinectCoreWindow * This, + /* [annotation][out][retval] */ + _Out_ WAITABLE_HANDLE *waitableHandle); + + HRESULT ( STDMETHODCALLTYPE *UnsubscribePointerEntered )( + IKinectCoreWindow * This, + /* [annotation][in] */ + _In_ WAITABLE_HANDLE waitableHandle); + + HRESULT ( STDMETHODCALLTYPE *GetPointerEnteredEventData )( + IKinectCoreWindow * This, + /* [annotation][in] */ + _In_ WAITABLE_HANDLE waitableHandle, + /* [annotation][out][retval] */ + _Out_ IKinectPointerEventArgs **eventData); + + HRESULT ( STDMETHODCALLTYPE *SubscribePointerMoved )( + IKinectCoreWindow * This, + /* [annotation][out][retval] */ + _Out_ WAITABLE_HANDLE *waitableHandle); + + HRESULT ( STDMETHODCALLTYPE *UnsubscribePointerMoved )( + IKinectCoreWindow * This, + /* [annotation][in] */ + _In_ WAITABLE_HANDLE waitableHandle); + + HRESULT ( STDMETHODCALLTYPE *GetPointerMovedEventData )( + IKinectCoreWindow * This, + /* [annotation][in] */ + _In_ WAITABLE_HANDLE waitableHandle, + /* [annotation][out][retval] */ + _Out_ IKinectPointerEventArgs **eventData); + + HRESULT ( STDMETHODCALLTYPE *SubscribePointerExited )( + IKinectCoreWindow * This, + /* [annotation][out][retval] */ + _Out_ WAITABLE_HANDLE *waitableHandle); + + HRESULT ( STDMETHODCALLTYPE *UnsubscribePointerExited )( + IKinectCoreWindow * This, + /* [annotation][in] */ + _In_ WAITABLE_HANDLE waitableHandle); + + HRESULT ( STDMETHODCALLTYPE *GetPointerExitedEventData )( + IKinectCoreWindow * This, + /* [annotation][in] */ + _In_ WAITABLE_HANDLE waitableHandle, + /* [annotation][out][retval] */ + _Out_ IKinectPointerEventArgs **eventData); + + END_INTERFACE + } IKinectCoreWindowVtbl; + + interface IKinectCoreWindow + { + CONST_VTBL struct IKinectCoreWindowVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IKinectCoreWindow_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IKinectCoreWindow_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IKinectCoreWindow_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IKinectCoreWindow_SubscribePointerEntered(This,waitableHandle) \ + ( (This)->lpVtbl -> SubscribePointerEntered(This,waitableHandle) ) + +#define IKinectCoreWindow_UnsubscribePointerEntered(This,waitableHandle) \ + ( (This)->lpVtbl -> UnsubscribePointerEntered(This,waitableHandle) ) + +#define IKinectCoreWindow_GetPointerEnteredEventData(This,waitableHandle,eventData) \ + ( (This)->lpVtbl -> GetPointerEnteredEventData(This,waitableHandle,eventData) ) + +#define IKinectCoreWindow_SubscribePointerMoved(This,waitableHandle) \ + ( (This)->lpVtbl -> SubscribePointerMoved(This,waitableHandle) ) + +#define IKinectCoreWindow_UnsubscribePointerMoved(This,waitableHandle) \ + ( (This)->lpVtbl -> UnsubscribePointerMoved(This,waitableHandle) ) + +#define IKinectCoreWindow_GetPointerMovedEventData(This,waitableHandle,eventData) \ + ( (This)->lpVtbl -> GetPointerMovedEventData(This,waitableHandle,eventData) ) + +#define IKinectCoreWindow_SubscribePointerExited(This,waitableHandle) \ + ( (This)->lpVtbl -> SubscribePointerExited(This,waitableHandle) ) + +#define IKinectCoreWindow_UnsubscribePointerExited(This,waitableHandle) \ + ( (This)->lpVtbl -> UnsubscribePointerExited(This,waitableHandle) ) + +#define IKinectCoreWindow_GetPointerExitedEventData(This,waitableHandle,eventData) \ + ( (This)->lpVtbl -> GetPointerExitedEventData(This,waitableHandle,eventData) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IKinectCoreWindow_INTERFACE_DEFINED__ */ + + +#ifndef __IKinectGestureRecognizer_INTERFACE_DEFINED__ +#define __IKinectGestureRecognizer_INTERFACE_DEFINED__ + +/* interface IKinectGestureRecognizer */ +/* [object][local][uuid] */ + + +EXTERN_C const IID IID_IKinectGestureRecognizer; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("5F51A3C4-2400-4F6D-8A6C-25B96715EFF1") + IKinectGestureRecognizer : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE RegisterSelectionTappedHandler( + /* [in] */ IKinectGestureRecognizerSelectionHandler *handler) = 0; + + virtual HRESULT STDMETHODCALLTYPE UnregisterSelectionTappedHandler( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE RegisterSelectionHoldingHandler( + /* [in] */ IKinectGestureRecognizerSelectionHandler *handler) = 0; + + virtual HRESULT STDMETHODCALLTYPE UnregisterSelectionHoldingHandler( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE RegisterSelectionPressingStartedHandler( + /* [in] */ IKinectGestureRecognizerSelectionHandler *handler) = 0; + + virtual HRESULT STDMETHODCALLTYPE UnregisterSelectionPressingStartedHandler( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE RegisterSelectionPressingUpdatedHandler( + /* [in] */ IKinectGestureRecognizerSelectionHandler *handler) = 0; + + virtual HRESULT STDMETHODCALLTYPE UnregisterSelectionPressingUpdatedHandler( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE RegisterSelectionPressingCompletedHandler( + /* [in] */ IKinectGestureRecognizerSelectionHandler *handler) = 0; + + virtual HRESULT STDMETHODCALLTYPE UnregisterSelectionPressingCompletedHandler( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE RegisterManipulationStartedHandler( + /* [in] */ IKinectGestureRecognizerManipulationHandler *handler) = 0; + + virtual HRESULT STDMETHODCALLTYPE UnregisterManipulationStartedHandler( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE RegisterManipulationUpdatedHandler( + /* [in] */ IKinectGestureRecognizerManipulationHandler *handler) = 0; + + virtual HRESULT STDMETHODCALLTYPE UnregisterManipulationUpdatedHandler( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE RegisterManipulationInertiaStartingHandler( + /* [in] */ IKinectGestureRecognizerManipulationHandler *handler) = 0; + + virtual HRESULT STDMETHODCALLTYPE UnregisterManipulationInertiaStartingHandler( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE RegisterManipulationCompletedHandler( + /* [in] */ IKinectGestureRecognizerManipulationHandler *handler) = 0; + + virtual HRESULT STDMETHODCALLTYPE UnregisterManipulationCompletedHandler( void) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_GestureSettings( + /* [annotation][out][retval] */ + _Out_ KinectGestureSettings *value) = 0; + + virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_GestureSettings( + /* [in] */ KinectGestureSettings value) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_IsInertial( + /* [annotation][out][retval] */ + _Out_ boolean *value) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_IsActive( + /* [annotation][out][retval] */ + _Out_ boolean *value) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_InertiaTranslationDeceleration( + /* [annotation][out][retval] */ + _Out_ float *value) = 0; + + virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_InertiaTranslationDeceleration( + /* [in] */ float value) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_InertiaTranslationDisplacement( + /* [annotation][out][retval] */ + _Out_ float *value) = 0; + + virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_InertiaTranslationDisplacement( + /* [in] */ float value) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_AutoProcessInertia( + /* [annotation][out][retval] */ + _Out_ boolean *value) = 0; + + virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_AutoProcessInertia( + /* [in] */ boolean value) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_BoundingRect( + /* [annotation][out][retval] */ + _Out_ RectF *value) = 0; + + virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_BoundingRect( + /* [in] */ RectF value) = 0; + + virtual HRESULT STDMETHODCALLTYPE ProcessDownEvent( + /* [annotation][in] */ + _In_ IKinectPointerPoint *value) = 0; + + virtual HRESULT STDMETHODCALLTYPE ProcessUpEvent( + /* [annotation][in] */ + _In_ IKinectPointerPoint *value) = 0; + + virtual HRESULT STDMETHODCALLTYPE ProcessMoveEvents( + /* [annotation][in] */ + _In_ IKinectPointerPoint *value) = 0; + + virtual HRESULT STDMETHODCALLTYPE ProcessInertia( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE CompleteGesture( void) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IKinectGestureRecognizerVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IKinectGestureRecognizer * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IKinectGestureRecognizer * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IKinectGestureRecognizer * This); + + HRESULT ( STDMETHODCALLTYPE *RegisterSelectionTappedHandler )( + IKinectGestureRecognizer * This, + /* [in] */ IKinectGestureRecognizerSelectionHandler *handler); + + HRESULT ( STDMETHODCALLTYPE *UnregisterSelectionTappedHandler )( + IKinectGestureRecognizer * This); + + HRESULT ( STDMETHODCALLTYPE *RegisterSelectionHoldingHandler )( + IKinectGestureRecognizer * This, + /* [in] */ IKinectGestureRecognizerSelectionHandler *handler); + + HRESULT ( STDMETHODCALLTYPE *UnregisterSelectionHoldingHandler )( + IKinectGestureRecognizer * This); + + HRESULT ( STDMETHODCALLTYPE *RegisterSelectionPressingStartedHandler )( + IKinectGestureRecognizer * This, + /* [in] */ IKinectGestureRecognizerSelectionHandler *handler); + + HRESULT ( STDMETHODCALLTYPE *UnregisterSelectionPressingStartedHandler )( + IKinectGestureRecognizer * This); + + HRESULT ( STDMETHODCALLTYPE *RegisterSelectionPressingUpdatedHandler )( + IKinectGestureRecognizer * This, + /* [in] */ IKinectGestureRecognizerSelectionHandler *handler); + + HRESULT ( STDMETHODCALLTYPE *UnregisterSelectionPressingUpdatedHandler )( + IKinectGestureRecognizer * This); + + HRESULT ( STDMETHODCALLTYPE *RegisterSelectionPressingCompletedHandler )( + IKinectGestureRecognizer * This, + /* [in] */ IKinectGestureRecognizerSelectionHandler *handler); + + HRESULT ( STDMETHODCALLTYPE *UnregisterSelectionPressingCompletedHandler )( + IKinectGestureRecognizer * This); + + HRESULT ( STDMETHODCALLTYPE *RegisterManipulationStartedHandler )( + IKinectGestureRecognizer * This, + /* [in] */ IKinectGestureRecognizerManipulationHandler *handler); + + HRESULT ( STDMETHODCALLTYPE *UnregisterManipulationStartedHandler )( + IKinectGestureRecognizer * This); + + HRESULT ( STDMETHODCALLTYPE *RegisterManipulationUpdatedHandler )( + IKinectGestureRecognizer * This, + /* [in] */ IKinectGestureRecognizerManipulationHandler *handler); + + HRESULT ( STDMETHODCALLTYPE *UnregisterManipulationUpdatedHandler )( + IKinectGestureRecognizer * This); + + HRESULT ( STDMETHODCALLTYPE *RegisterManipulationInertiaStartingHandler )( + IKinectGestureRecognizer * This, + /* [in] */ IKinectGestureRecognizerManipulationHandler *handler); + + HRESULT ( STDMETHODCALLTYPE *UnregisterManipulationInertiaStartingHandler )( + IKinectGestureRecognizer * This); + + HRESULT ( STDMETHODCALLTYPE *RegisterManipulationCompletedHandler )( + IKinectGestureRecognizer * This, + /* [in] */ IKinectGestureRecognizerManipulationHandler *handler); + + HRESULT ( STDMETHODCALLTYPE *UnregisterManipulationCompletedHandler )( + IKinectGestureRecognizer * This); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_GestureSettings )( + IKinectGestureRecognizer * This, + /* [annotation][out][retval] */ + _Out_ KinectGestureSettings *value); + + /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_GestureSettings )( + IKinectGestureRecognizer * This, + /* [in] */ KinectGestureSettings value); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_IsInertial )( + IKinectGestureRecognizer * This, + /* [annotation][out][retval] */ + _Out_ boolean *value); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_IsActive )( + IKinectGestureRecognizer * This, + /* [annotation][out][retval] */ + _Out_ boolean *value); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_InertiaTranslationDeceleration )( + IKinectGestureRecognizer * This, + /* [annotation][out][retval] */ + _Out_ float *value); + + /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_InertiaTranslationDeceleration )( + IKinectGestureRecognizer * This, + /* [in] */ float value); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_InertiaTranslationDisplacement )( + IKinectGestureRecognizer * This, + /* [annotation][out][retval] */ + _Out_ float *value); + + /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_InertiaTranslationDisplacement )( + IKinectGestureRecognizer * This, + /* [in] */ float value); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_AutoProcessInertia )( + IKinectGestureRecognizer * This, + /* [annotation][out][retval] */ + _Out_ boolean *value); + + /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_AutoProcessInertia )( + IKinectGestureRecognizer * This, + /* [in] */ boolean value); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_BoundingRect )( + IKinectGestureRecognizer * This, + /* [annotation][out][retval] */ + _Out_ RectF *value); + + /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_BoundingRect )( + IKinectGestureRecognizer * This, + /* [in] */ RectF value); + + HRESULT ( STDMETHODCALLTYPE *ProcessDownEvent )( + IKinectGestureRecognizer * This, + /* [annotation][in] */ + _In_ IKinectPointerPoint *value); + + HRESULT ( STDMETHODCALLTYPE *ProcessUpEvent )( + IKinectGestureRecognizer * This, + /* [annotation][in] */ + _In_ IKinectPointerPoint *value); + + HRESULT ( STDMETHODCALLTYPE *ProcessMoveEvents )( + IKinectGestureRecognizer * This, + /* [annotation][in] */ + _In_ IKinectPointerPoint *value); + + HRESULT ( STDMETHODCALLTYPE *ProcessInertia )( + IKinectGestureRecognizer * This); + + HRESULT ( STDMETHODCALLTYPE *CompleteGesture )( + IKinectGestureRecognizer * This); + + END_INTERFACE + } IKinectGestureRecognizerVtbl; + + interface IKinectGestureRecognizer + { + CONST_VTBL struct IKinectGestureRecognizerVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IKinectGestureRecognizer_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IKinectGestureRecognizer_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IKinectGestureRecognizer_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IKinectGestureRecognizer_RegisterSelectionTappedHandler(This,handler) \ + ( (This)->lpVtbl -> RegisterSelectionTappedHandler(This,handler) ) + +#define IKinectGestureRecognizer_UnregisterSelectionTappedHandler(This) \ + ( (This)->lpVtbl -> UnregisterSelectionTappedHandler(This) ) + +#define IKinectGestureRecognizer_RegisterSelectionHoldingHandler(This,handler) \ + ( (This)->lpVtbl -> RegisterSelectionHoldingHandler(This,handler) ) + +#define IKinectGestureRecognizer_UnregisterSelectionHoldingHandler(This) \ + ( (This)->lpVtbl -> UnregisterSelectionHoldingHandler(This) ) + +#define IKinectGestureRecognizer_RegisterSelectionPressingStartedHandler(This,handler) \ + ( (This)->lpVtbl -> RegisterSelectionPressingStartedHandler(This,handler) ) + +#define IKinectGestureRecognizer_UnregisterSelectionPressingStartedHandler(This) \ + ( (This)->lpVtbl -> UnregisterSelectionPressingStartedHandler(This) ) + +#define IKinectGestureRecognizer_RegisterSelectionPressingUpdatedHandler(This,handler) \ + ( (This)->lpVtbl -> RegisterSelectionPressingUpdatedHandler(This,handler) ) + +#define IKinectGestureRecognizer_UnregisterSelectionPressingUpdatedHandler(This) \ + ( (This)->lpVtbl -> UnregisterSelectionPressingUpdatedHandler(This) ) + +#define IKinectGestureRecognizer_RegisterSelectionPressingCompletedHandler(This,handler) \ + ( (This)->lpVtbl -> RegisterSelectionPressingCompletedHandler(This,handler) ) + +#define IKinectGestureRecognizer_UnregisterSelectionPressingCompletedHandler(This) \ + ( (This)->lpVtbl -> UnregisterSelectionPressingCompletedHandler(This) ) + +#define IKinectGestureRecognizer_RegisterManipulationStartedHandler(This,handler) \ + ( (This)->lpVtbl -> RegisterManipulationStartedHandler(This,handler) ) + +#define IKinectGestureRecognizer_UnregisterManipulationStartedHandler(This) \ + ( (This)->lpVtbl -> UnregisterManipulationStartedHandler(This) ) + +#define IKinectGestureRecognizer_RegisterManipulationUpdatedHandler(This,handler) \ + ( (This)->lpVtbl -> RegisterManipulationUpdatedHandler(This,handler) ) + +#define IKinectGestureRecognizer_UnregisterManipulationUpdatedHandler(This) \ + ( (This)->lpVtbl -> UnregisterManipulationUpdatedHandler(This) ) + +#define IKinectGestureRecognizer_RegisterManipulationInertiaStartingHandler(This,handler) \ + ( (This)->lpVtbl -> RegisterManipulationInertiaStartingHandler(This,handler) ) + +#define IKinectGestureRecognizer_UnregisterManipulationInertiaStartingHandler(This) \ + ( (This)->lpVtbl -> UnregisterManipulationInertiaStartingHandler(This) ) + +#define IKinectGestureRecognizer_RegisterManipulationCompletedHandler(This,handler) \ + ( (This)->lpVtbl -> RegisterManipulationCompletedHandler(This,handler) ) + +#define IKinectGestureRecognizer_UnregisterManipulationCompletedHandler(This) \ + ( (This)->lpVtbl -> UnregisterManipulationCompletedHandler(This) ) + +#define IKinectGestureRecognizer_get_GestureSettings(This,value) \ + ( (This)->lpVtbl -> get_GestureSettings(This,value) ) + +#define IKinectGestureRecognizer_put_GestureSettings(This,value) \ + ( (This)->lpVtbl -> put_GestureSettings(This,value) ) + +#define IKinectGestureRecognizer_get_IsInertial(This,value) \ + ( (This)->lpVtbl -> get_IsInertial(This,value) ) + +#define IKinectGestureRecognizer_get_IsActive(This,value) \ + ( (This)->lpVtbl -> get_IsActive(This,value) ) + +#define IKinectGestureRecognizer_get_InertiaTranslationDeceleration(This,value) \ + ( (This)->lpVtbl -> get_InertiaTranslationDeceleration(This,value) ) + +#define IKinectGestureRecognizer_put_InertiaTranslationDeceleration(This,value) \ + ( (This)->lpVtbl -> put_InertiaTranslationDeceleration(This,value) ) + +#define IKinectGestureRecognizer_get_InertiaTranslationDisplacement(This,value) \ + ( (This)->lpVtbl -> get_InertiaTranslationDisplacement(This,value) ) + +#define IKinectGestureRecognizer_put_InertiaTranslationDisplacement(This,value) \ + ( (This)->lpVtbl -> put_InertiaTranslationDisplacement(This,value) ) + +#define IKinectGestureRecognizer_get_AutoProcessInertia(This,value) \ + ( (This)->lpVtbl -> get_AutoProcessInertia(This,value) ) + +#define IKinectGestureRecognizer_put_AutoProcessInertia(This,value) \ + ( (This)->lpVtbl -> put_AutoProcessInertia(This,value) ) + +#define IKinectGestureRecognizer_get_BoundingRect(This,value) \ + ( (This)->lpVtbl -> get_BoundingRect(This,value) ) + +#define IKinectGestureRecognizer_put_BoundingRect(This,value) \ + ( (This)->lpVtbl -> put_BoundingRect(This,value) ) + +#define IKinectGestureRecognizer_ProcessDownEvent(This,value) \ + ( (This)->lpVtbl -> ProcessDownEvent(This,value) ) + +#define IKinectGestureRecognizer_ProcessUpEvent(This,value) \ + ( (This)->lpVtbl -> ProcessUpEvent(This,value) ) + +#define IKinectGestureRecognizer_ProcessMoveEvents(This,value) \ + ( (This)->lpVtbl -> ProcessMoveEvents(This,value) ) + +#define IKinectGestureRecognizer_ProcessInertia(This) \ + ( (This)->lpVtbl -> ProcessInertia(This) ) + +#define IKinectGestureRecognizer_CompleteGesture(This) \ + ( (This)->lpVtbl -> CompleteGesture(This) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IKinectGestureRecognizer_INTERFACE_DEFINED__ */ + + +#ifndef __IKinectGestureRecognizerSelectionHandler_INTERFACE_DEFINED__ +#define __IKinectGestureRecognizerSelectionHandler_INTERFACE_DEFINED__ + +/* interface IKinectGestureRecognizerSelectionHandler */ +/* [object][local][uuid] */ + + +EXTERN_C const IID IID_IKinectGestureRecognizerSelectionHandler; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("9F3D5C22-158F-4A4E-AD4E-023FAE1F4BC9") + IKinectGestureRecognizerSelectionHandler : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE OnTapped( + /* [in] */ IKinectTappedEventArgs *args) = 0; + + virtual HRESULT STDMETHODCALLTYPE OnHolding( + /* [in] */ IKinectHoldingEventArgs *args) = 0; + + virtual HRESULT STDMETHODCALLTYPE OnPressingStarted( + /* [in] */ IKinectPressingStartedEventArgs *args) = 0; + + virtual HRESULT STDMETHODCALLTYPE OnPressingUpdated( + /* [in] */ IKinectPressingUpdatedEventArgs *args) = 0; + + virtual HRESULT STDMETHODCALLTYPE OnPressingCompleted( + /* [in] */ IKinectPressingCompletedEventArgs *args) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IKinectGestureRecognizerSelectionHandlerVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IKinectGestureRecognizerSelectionHandler * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IKinectGestureRecognizerSelectionHandler * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IKinectGestureRecognizerSelectionHandler * This); + + HRESULT ( STDMETHODCALLTYPE *OnTapped )( + IKinectGestureRecognizerSelectionHandler * This, + /* [in] */ IKinectTappedEventArgs *args); + + HRESULT ( STDMETHODCALLTYPE *OnHolding )( + IKinectGestureRecognizerSelectionHandler * This, + /* [in] */ IKinectHoldingEventArgs *args); + + HRESULT ( STDMETHODCALLTYPE *OnPressingStarted )( + IKinectGestureRecognizerSelectionHandler * This, + /* [in] */ IKinectPressingStartedEventArgs *args); + + HRESULT ( STDMETHODCALLTYPE *OnPressingUpdated )( + IKinectGestureRecognizerSelectionHandler * This, + /* [in] */ IKinectPressingUpdatedEventArgs *args); + + HRESULT ( STDMETHODCALLTYPE *OnPressingCompleted )( + IKinectGestureRecognizerSelectionHandler * This, + /* [in] */ IKinectPressingCompletedEventArgs *args); + + END_INTERFACE + } IKinectGestureRecognizerSelectionHandlerVtbl; + + interface IKinectGestureRecognizerSelectionHandler + { + CONST_VTBL struct IKinectGestureRecognizerSelectionHandlerVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IKinectGestureRecognizerSelectionHandler_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IKinectGestureRecognizerSelectionHandler_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IKinectGestureRecognizerSelectionHandler_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IKinectGestureRecognizerSelectionHandler_OnTapped(This,args) \ + ( (This)->lpVtbl -> OnTapped(This,args) ) + +#define IKinectGestureRecognizerSelectionHandler_OnHolding(This,args) \ + ( (This)->lpVtbl -> OnHolding(This,args) ) + +#define IKinectGestureRecognizerSelectionHandler_OnPressingStarted(This,args) \ + ( (This)->lpVtbl -> OnPressingStarted(This,args) ) + +#define IKinectGestureRecognizerSelectionHandler_OnPressingUpdated(This,args) \ + ( (This)->lpVtbl -> OnPressingUpdated(This,args) ) + +#define IKinectGestureRecognizerSelectionHandler_OnPressingCompleted(This,args) \ + ( (This)->lpVtbl -> OnPressingCompleted(This,args) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IKinectGestureRecognizerSelectionHandler_INTERFACE_DEFINED__ */ + + +#ifndef __IKinectGestureRecognizerManipulationHandler_INTERFACE_DEFINED__ +#define __IKinectGestureRecognizerManipulationHandler_INTERFACE_DEFINED__ + +/* interface IKinectGestureRecognizerManipulationHandler */ +/* [object][local][uuid] */ + + +EXTERN_C const IID IID_IKinectGestureRecognizerManipulationHandler; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("398CF7E0-4FD4-4336-BAAA-B6708B4C437B") + IKinectGestureRecognizerManipulationHandler : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE OnManipulationStarted( + /* [in] */ IKinectManipulationStartedEventArgs *args) = 0; + + virtual HRESULT STDMETHODCALLTYPE OnManipulationUpdated( + /* [in] */ IKinectManipulationUpdatedEventArgs *args) = 0; + + virtual HRESULT STDMETHODCALLTYPE OnManipulationInertiaStarting( + /* [in] */ IKinectManipulationInertiaStartingEventArgs *args) = 0; + + virtual HRESULT STDMETHODCALLTYPE OnManipulationCompleted( + /* [in] */ IKinectManipulationCompletedEventArgs *args) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IKinectGestureRecognizerManipulationHandlerVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IKinectGestureRecognizerManipulationHandler * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IKinectGestureRecognizerManipulationHandler * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IKinectGestureRecognizerManipulationHandler * This); + + HRESULT ( STDMETHODCALLTYPE *OnManipulationStarted )( + IKinectGestureRecognizerManipulationHandler * This, + /* [in] */ IKinectManipulationStartedEventArgs *args); + + HRESULT ( STDMETHODCALLTYPE *OnManipulationUpdated )( + IKinectGestureRecognizerManipulationHandler * This, + /* [in] */ IKinectManipulationUpdatedEventArgs *args); + + HRESULT ( STDMETHODCALLTYPE *OnManipulationInertiaStarting )( + IKinectGestureRecognizerManipulationHandler * This, + /* [in] */ IKinectManipulationInertiaStartingEventArgs *args); + + HRESULT ( STDMETHODCALLTYPE *OnManipulationCompleted )( + IKinectGestureRecognizerManipulationHandler * This, + /* [in] */ IKinectManipulationCompletedEventArgs *args); + + END_INTERFACE + } IKinectGestureRecognizerManipulationHandlerVtbl; + + interface IKinectGestureRecognizerManipulationHandler + { + CONST_VTBL struct IKinectGestureRecognizerManipulationHandlerVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IKinectGestureRecognizerManipulationHandler_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IKinectGestureRecognizerManipulationHandler_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IKinectGestureRecognizerManipulationHandler_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IKinectGestureRecognizerManipulationHandler_OnManipulationStarted(This,args) \ + ( (This)->lpVtbl -> OnManipulationStarted(This,args) ) + +#define IKinectGestureRecognizerManipulationHandler_OnManipulationUpdated(This,args) \ + ( (This)->lpVtbl -> OnManipulationUpdated(This,args) ) + +#define IKinectGestureRecognizerManipulationHandler_OnManipulationInertiaStarting(This,args) \ + ( (This)->lpVtbl -> OnManipulationInertiaStarting(This,args) ) + +#define IKinectGestureRecognizerManipulationHandler_OnManipulationCompleted(This,args) \ + ( (This)->lpVtbl -> OnManipulationCompleted(This,args) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IKinectGestureRecognizerManipulationHandler_INTERFACE_DEFINED__ */ + + +#ifndef __IKinectHoldingEventArgs_INTERFACE_DEFINED__ +#define __IKinectHoldingEventArgs_INTERFACE_DEFINED__ + +/* interface IKinectHoldingEventArgs */ +/* [object][local][uuid] */ + + +EXTERN_C const IID IID_IKinectHoldingEventArgs; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("A7B4B8F4-55B5-4FB2-B7C4-83B7700748DF") + IKinectHoldingEventArgs : public IUnknown + { + public: + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_PointerDeviceType( + /* [annotation][out][retval] */ + _Out_ PointerDeviceType *value) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Position( + /* [annotation][out][retval] */ + _Out_ PointF *value) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_HoldingState( + /* [annotation][out][retval] */ + _Out_ KinectHoldingState *value) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IKinectHoldingEventArgsVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IKinectHoldingEventArgs * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IKinectHoldingEventArgs * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IKinectHoldingEventArgs * This); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_PointerDeviceType )( + IKinectHoldingEventArgs * This, + /* [annotation][out][retval] */ + _Out_ PointerDeviceType *value); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Position )( + IKinectHoldingEventArgs * This, + /* [annotation][out][retval] */ + _Out_ PointF *value); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_HoldingState )( + IKinectHoldingEventArgs * This, + /* [annotation][out][retval] */ + _Out_ KinectHoldingState *value); + + END_INTERFACE + } IKinectHoldingEventArgsVtbl; + + interface IKinectHoldingEventArgs + { + CONST_VTBL struct IKinectHoldingEventArgsVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IKinectHoldingEventArgs_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IKinectHoldingEventArgs_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IKinectHoldingEventArgs_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IKinectHoldingEventArgs_get_PointerDeviceType(This,value) \ + ( (This)->lpVtbl -> get_PointerDeviceType(This,value) ) + +#define IKinectHoldingEventArgs_get_Position(This,value) \ + ( (This)->lpVtbl -> get_Position(This,value) ) + +#define IKinectHoldingEventArgs_get_HoldingState(This,value) \ + ( (This)->lpVtbl -> get_HoldingState(This,value) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IKinectHoldingEventArgs_INTERFACE_DEFINED__ */ + + +#ifndef __IKinectManipulationCompletedEventArgs_INTERFACE_DEFINED__ +#define __IKinectManipulationCompletedEventArgs_INTERFACE_DEFINED__ + +/* interface IKinectManipulationCompletedEventArgs */ +/* [object][local][uuid] */ + + +EXTERN_C const IID IID_IKinectManipulationCompletedEventArgs; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("98AF1727-D511-459C-BE14-16CA8230871B") + IKinectManipulationCompletedEventArgs : public IUnknown + { + public: + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_PointerDeviceType( + /* [annotation][out][retval] */ + _Out_ PointerDeviceType *value) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Position( + /* [annotation][out][retval] */ + _Out_ PointF *value) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Cumulative( + /* [annotation][out][retval] */ + _Out_ KinectManipulationDelta *value) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Velocities( + /* [annotation][out][retval] */ + _Out_ KinectManipulationVelocities *value) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IKinectManipulationCompletedEventArgsVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IKinectManipulationCompletedEventArgs * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IKinectManipulationCompletedEventArgs * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IKinectManipulationCompletedEventArgs * This); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_PointerDeviceType )( + IKinectManipulationCompletedEventArgs * This, + /* [annotation][out][retval] */ + _Out_ PointerDeviceType *value); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Position )( + IKinectManipulationCompletedEventArgs * This, + /* [annotation][out][retval] */ + _Out_ PointF *value); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Cumulative )( + IKinectManipulationCompletedEventArgs * This, + /* [annotation][out][retval] */ + _Out_ KinectManipulationDelta *value); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Velocities )( + IKinectManipulationCompletedEventArgs * This, + /* [annotation][out][retval] */ + _Out_ KinectManipulationVelocities *value); + + END_INTERFACE + } IKinectManipulationCompletedEventArgsVtbl; + + interface IKinectManipulationCompletedEventArgs + { + CONST_VTBL struct IKinectManipulationCompletedEventArgsVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IKinectManipulationCompletedEventArgs_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IKinectManipulationCompletedEventArgs_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IKinectManipulationCompletedEventArgs_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IKinectManipulationCompletedEventArgs_get_PointerDeviceType(This,value) \ + ( (This)->lpVtbl -> get_PointerDeviceType(This,value) ) + +#define IKinectManipulationCompletedEventArgs_get_Position(This,value) \ + ( (This)->lpVtbl -> get_Position(This,value) ) + +#define IKinectManipulationCompletedEventArgs_get_Cumulative(This,value) \ + ( (This)->lpVtbl -> get_Cumulative(This,value) ) + +#define IKinectManipulationCompletedEventArgs_get_Velocities(This,value) \ + ( (This)->lpVtbl -> get_Velocities(This,value) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IKinectManipulationCompletedEventArgs_INTERFACE_DEFINED__ */ + + +#ifndef __IKinectManipulationInertiaStartingEventArgs_INTERFACE_DEFINED__ +#define __IKinectManipulationInertiaStartingEventArgs_INTERFACE_DEFINED__ + +/* interface IKinectManipulationInertiaStartingEventArgs */ +/* [object][local][uuid] */ + + +EXTERN_C const IID IID_IKinectManipulationInertiaStartingEventArgs; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("90ACC90A-4573-406B-9715-20171D8A3875") + IKinectManipulationInertiaStartingEventArgs : public IUnknown + { + public: + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_PointerDeviceType( + /* [annotation][out][retval] */ + _Out_ PointerDeviceType *value) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Position( + /* [annotation][out][retval] */ + _Out_ PointF *value) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Delta( + /* [annotation][out][retval] */ + _Out_ KinectManipulationDelta *value) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Cumulative( + /* [annotation][out][retval] */ + _Out_ KinectManipulationDelta *value) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Velocities( + /* [annotation][out][retval] */ + _Out_ KinectManipulationVelocities *value) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IKinectManipulationInertiaStartingEventArgsVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IKinectManipulationInertiaStartingEventArgs * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IKinectManipulationInertiaStartingEventArgs * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IKinectManipulationInertiaStartingEventArgs * This); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_PointerDeviceType )( + IKinectManipulationInertiaStartingEventArgs * This, + /* [annotation][out][retval] */ + _Out_ PointerDeviceType *value); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Position )( + IKinectManipulationInertiaStartingEventArgs * This, + /* [annotation][out][retval] */ + _Out_ PointF *value); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Delta )( + IKinectManipulationInertiaStartingEventArgs * This, + /* [annotation][out][retval] */ + _Out_ KinectManipulationDelta *value); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Cumulative )( + IKinectManipulationInertiaStartingEventArgs * This, + /* [annotation][out][retval] */ + _Out_ KinectManipulationDelta *value); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Velocities )( + IKinectManipulationInertiaStartingEventArgs * This, + /* [annotation][out][retval] */ + _Out_ KinectManipulationVelocities *value); + + END_INTERFACE + } IKinectManipulationInertiaStartingEventArgsVtbl; + + interface IKinectManipulationInertiaStartingEventArgs + { + CONST_VTBL struct IKinectManipulationInertiaStartingEventArgsVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IKinectManipulationInertiaStartingEventArgs_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IKinectManipulationInertiaStartingEventArgs_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IKinectManipulationInertiaStartingEventArgs_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IKinectManipulationInertiaStartingEventArgs_get_PointerDeviceType(This,value) \ + ( (This)->lpVtbl -> get_PointerDeviceType(This,value) ) + +#define IKinectManipulationInertiaStartingEventArgs_get_Position(This,value) \ + ( (This)->lpVtbl -> get_Position(This,value) ) + +#define IKinectManipulationInertiaStartingEventArgs_get_Delta(This,value) \ + ( (This)->lpVtbl -> get_Delta(This,value) ) + +#define IKinectManipulationInertiaStartingEventArgs_get_Cumulative(This,value) \ + ( (This)->lpVtbl -> get_Cumulative(This,value) ) + +#define IKinectManipulationInertiaStartingEventArgs_get_Velocities(This,value) \ + ( (This)->lpVtbl -> get_Velocities(This,value) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IKinectManipulationInertiaStartingEventArgs_INTERFACE_DEFINED__ */ + + +#ifndef __IKinectManipulationStartedEventArgs_INTERFACE_DEFINED__ +#define __IKinectManipulationStartedEventArgs_INTERFACE_DEFINED__ + +/* interface IKinectManipulationStartedEventArgs */ +/* [object][local][uuid] */ + + +EXTERN_C const IID IID_IKinectManipulationStartedEventArgs; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("2EC8A1BA-96EC-49F7-BD41-D5FE791F0D46") + IKinectManipulationStartedEventArgs : public IUnknown + { + public: + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_PointerDeviceType( + /* [annotation][out][retval] */ + _Out_ PointerDeviceType *value) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Position( + /* [annotation][out][retval] */ + _Out_ PointF *value) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Cumulative( + /* [annotation][out][retval] */ + _Out_ KinectManipulationDelta *value) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IKinectManipulationStartedEventArgsVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IKinectManipulationStartedEventArgs * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IKinectManipulationStartedEventArgs * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IKinectManipulationStartedEventArgs * This); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_PointerDeviceType )( + IKinectManipulationStartedEventArgs * This, + /* [annotation][out][retval] */ + _Out_ PointerDeviceType *value); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Position )( + IKinectManipulationStartedEventArgs * This, + /* [annotation][out][retval] */ + _Out_ PointF *value); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Cumulative )( + IKinectManipulationStartedEventArgs * This, + /* [annotation][out][retval] */ + _Out_ KinectManipulationDelta *value); + + END_INTERFACE + } IKinectManipulationStartedEventArgsVtbl; + + interface IKinectManipulationStartedEventArgs + { + CONST_VTBL struct IKinectManipulationStartedEventArgsVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IKinectManipulationStartedEventArgs_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IKinectManipulationStartedEventArgs_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IKinectManipulationStartedEventArgs_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IKinectManipulationStartedEventArgs_get_PointerDeviceType(This,value) \ + ( (This)->lpVtbl -> get_PointerDeviceType(This,value) ) + +#define IKinectManipulationStartedEventArgs_get_Position(This,value) \ + ( (This)->lpVtbl -> get_Position(This,value) ) + +#define IKinectManipulationStartedEventArgs_get_Cumulative(This,value) \ + ( (This)->lpVtbl -> get_Cumulative(This,value) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IKinectManipulationStartedEventArgs_INTERFACE_DEFINED__ */ + + +#ifndef __IKinectManipulationUpdatedEventArgs_INTERFACE_DEFINED__ +#define __IKinectManipulationUpdatedEventArgs_INTERFACE_DEFINED__ + +/* interface IKinectManipulationUpdatedEventArgs */ +/* [object][local][uuid] */ + + +EXTERN_C const IID IID_IKinectManipulationUpdatedEventArgs; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("1097A513-F25E-4B48-84F2-2D3B0B3FC78C") + IKinectManipulationUpdatedEventArgs : public IUnknown + { + public: + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_PointerDeviceType( + /* [annotation][out][retval] */ + _Out_ PointerDeviceType *value) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Position( + /* [annotation][out][retval] */ + _Out_ PointF *value) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Delta( + /* [annotation][out][retval] */ + _Out_ KinectManipulationDelta *value) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Cumulative( + /* [annotation][out][retval] */ + _Out_ KinectManipulationDelta *value) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Velocities( + /* [annotation][out][retval] */ + _Out_ KinectManipulationVelocities *value) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IKinectManipulationUpdatedEventArgsVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IKinectManipulationUpdatedEventArgs * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IKinectManipulationUpdatedEventArgs * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IKinectManipulationUpdatedEventArgs * This); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_PointerDeviceType )( + IKinectManipulationUpdatedEventArgs * This, + /* [annotation][out][retval] */ + _Out_ PointerDeviceType *value); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Position )( + IKinectManipulationUpdatedEventArgs * This, + /* [annotation][out][retval] */ + _Out_ PointF *value); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Delta )( + IKinectManipulationUpdatedEventArgs * This, + /* [annotation][out][retval] */ + _Out_ KinectManipulationDelta *value); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Cumulative )( + IKinectManipulationUpdatedEventArgs * This, + /* [annotation][out][retval] */ + _Out_ KinectManipulationDelta *value); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Velocities )( + IKinectManipulationUpdatedEventArgs * This, + /* [annotation][out][retval] */ + _Out_ KinectManipulationVelocities *value); + + END_INTERFACE + } IKinectManipulationUpdatedEventArgsVtbl; + + interface IKinectManipulationUpdatedEventArgs + { + CONST_VTBL struct IKinectManipulationUpdatedEventArgsVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IKinectManipulationUpdatedEventArgs_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IKinectManipulationUpdatedEventArgs_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IKinectManipulationUpdatedEventArgs_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IKinectManipulationUpdatedEventArgs_get_PointerDeviceType(This,value) \ + ( (This)->lpVtbl -> get_PointerDeviceType(This,value) ) + +#define IKinectManipulationUpdatedEventArgs_get_Position(This,value) \ + ( (This)->lpVtbl -> get_Position(This,value) ) + +#define IKinectManipulationUpdatedEventArgs_get_Delta(This,value) \ + ( (This)->lpVtbl -> get_Delta(This,value) ) + +#define IKinectManipulationUpdatedEventArgs_get_Cumulative(This,value) \ + ( (This)->lpVtbl -> get_Cumulative(This,value) ) + +#define IKinectManipulationUpdatedEventArgs_get_Velocities(This,value) \ + ( (This)->lpVtbl -> get_Velocities(This,value) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IKinectManipulationUpdatedEventArgs_INTERFACE_DEFINED__ */ + + +#ifndef __IKinectPointerDevice_INTERFACE_DEFINED__ +#define __IKinectPointerDevice_INTERFACE_DEFINED__ + +/* interface IKinectPointerDevice */ +/* [object][local][uuid] */ + + +EXTERN_C const IID IID_IKinectPointerDevice; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("C6F3A13D-16DA-4556-AD25-C4CD73A2D625") + IKinectPointerDevice : public IUnknown + { + public: + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_PointerDeviceType( + /* [annotation][out][retval] */ + _Out_ PointerDeviceType *value) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IKinectPointerDeviceVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IKinectPointerDevice * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IKinectPointerDevice * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IKinectPointerDevice * This); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_PointerDeviceType )( + IKinectPointerDevice * This, + /* [annotation][out][retval] */ + _Out_ PointerDeviceType *value); + + END_INTERFACE + } IKinectPointerDeviceVtbl; + + interface IKinectPointerDevice + { + CONST_VTBL struct IKinectPointerDeviceVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IKinectPointerDevice_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IKinectPointerDevice_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IKinectPointerDevice_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IKinectPointerDevice_get_PointerDeviceType(This,value) \ + ( (This)->lpVtbl -> get_PointerDeviceType(This,value) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IKinectPointerDevice_INTERFACE_DEFINED__ */ + + +#ifndef __IKinectPointerEventArgs_INTERFACE_DEFINED__ +#define __IKinectPointerEventArgs_INTERFACE_DEFINED__ + +/* interface IKinectPointerEventArgs */ +/* [object][local][uuid] */ + + +EXTERN_C const IID IID_IKinectPointerEventArgs; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("65635AE1-3D28-4D5A-AA09-825AAE07C1B1") + IKinectPointerEventArgs : public IUnknown + { + public: + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Handled( + /* [annotation][out][retval] */ + _Out_ boolean *handled) = 0; + + virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_Handled( + /* [in] */ boolean handled) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_CurrentPoint( + /* [annotation][out][retval] */ + _COM_Outptr_ IKinectPointerPoint **pointer) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IKinectPointerEventArgsVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IKinectPointerEventArgs * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IKinectPointerEventArgs * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IKinectPointerEventArgs * This); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Handled )( + IKinectPointerEventArgs * This, + /* [annotation][out][retval] */ + _Out_ boolean *handled); + + /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_Handled )( + IKinectPointerEventArgs * This, + /* [in] */ boolean handled); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_CurrentPoint )( + IKinectPointerEventArgs * This, + /* [annotation][out][retval] */ + _COM_Outptr_ IKinectPointerPoint **pointer); + + END_INTERFACE + } IKinectPointerEventArgsVtbl; + + interface IKinectPointerEventArgs + { + CONST_VTBL struct IKinectPointerEventArgsVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IKinectPointerEventArgs_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IKinectPointerEventArgs_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IKinectPointerEventArgs_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IKinectPointerEventArgs_get_Handled(This,handled) \ + ( (This)->lpVtbl -> get_Handled(This,handled) ) + +#define IKinectPointerEventArgs_put_Handled(This,handled) \ + ( (This)->lpVtbl -> put_Handled(This,handled) ) + +#define IKinectPointerEventArgs_get_CurrentPoint(This,pointer) \ + ( (This)->lpVtbl -> get_CurrentPoint(This,pointer) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IKinectPointerEventArgs_INTERFACE_DEFINED__ */ + + +#ifndef __IKinectPointerPoint_INTERFACE_DEFINED__ +#define __IKinectPointerPoint_INTERFACE_DEFINED__ + +/* interface IKinectPointerPoint */ +/* [object][local][uuid] */ + + +EXTERN_C const IID IID_IKinectPointerPoint; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("D2F1E5B8-9DAD-4933-BCD2-90F4C64E17AC") + IKinectPointerPoint : public IUnknown + { + public: + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_PointerDevice( + /* [annotation][out][retval] */ + _COM_Outptr_ IKinectPointerDevice **ppPointerDevice) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_PointerId( + /* [annotation][out][retval] */ + _Out_ UINT32 *pointerId) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Position( + /* [annotation][out][retval] */ + _Out_ PointF *position) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_RawPosition( + /* [annotation][out][retval] */ + _Out_ PointF *rawPosition) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Timestamp( + /* [annotation][out][retval] */ + _Out_ UINT64 *timestamp) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Properties( + /* [annotation][out][retval] */ + _COM_Outptr_ IKinectPointerPointProperties **ppProperties) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IKinectPointerPointVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IKinectPointerPoint * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IKinectPointerPoint * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IKinectPointerPoint * This); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_PointerDevice )( + IKinectPointerPoint * This, + /* [annotation][out][retval] */ + _COM_Outptr_ IKinectPointerDevice **ppPointerDevice); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_PointerId )( + IKinectPointerPoint * This, + /* [annotation][out][retval] */ + _Out_ UINT32 *pointerId); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Position )( + IKinectPointerPoint * This, + /* [annotation][out][retval] */ + _Out_ PointF *position); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_RawPosition )( + IKinectPointerPoint * This, + /* [annotation][out][retval] */ + _Out_ PointF *rawPosition); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Timestamp )( + IKinectPointerPoint * This, + /* [annotation][out][retval] */ + _Out_ UINT64 *timestamp); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Properties )( + IKinectPointerPoint * This, + /* [annotation][out][retval] */ + _COM_Outptr_ IKinectPointerPointProperties **ppProperties); + + END_INTERFACE + } IKinectPointerPointVtbl; + + interface IKinectPointerPoint + { + CONST_VTBL struct IKinectPointerPointVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IKinectPointerPoint_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IKinectPointerPoint_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IKinectPointerPoint_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IKinectPointerPoint_get_PointerDevice(This,ppPointerDevice) \ + ( (This)->lpVtbl -> get_PointerDevice(This,ppPointerDevice) ) + +#define IKinectPointerPoint_get_PointerId(This,pointerId) \ + ( (This)->lpVtbl -> get_PointerId(This,pointerId) ) + +#define IKinectPointerPoint_get_Position(This,position) \ + ( (This)->lpVtbl -> get_Position(This,position) ) + +#define IKinectPointerPoint_get_RawPosition(This,rawPosition) \ + ( (This)->lpVtbl -> get_RawPosition(This,rawPosition) ) + +#define IKinectPointerPoint_get_Timestamp(This,timestamp) \ + ( (This)->lpVtbl -> get_Timestamp(This,timestamp) ) + +#define IKinectPointerPoint_get_Properties(This,ppProperties) \ + ( (This)->lpVtbl -> get_Properties(This,ppProperties) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IKinectPointerPoint_INTERFACE_DEFINED__ */ + + +#ifndef __IKinectPointerPointProperties_INTERFACE_DEFINED__ +#define __IKinectPointerPointProperties_INTERFACE_DEFINED__ + +/* interface IKinectPointerPointProperties */ +/* [object][local][uuid] */ + + +EXTERN_C const IID IID_IKinectPointerPointProperties; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("5527A776-CA76-47BA-95B4-A2DB2BD32207") + IKinectPointerPointProperties : public IUnknown + { + public: + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_IsPrimary( + /* [annotation][out][retval] */ + _Out_ boolean *isPrimary) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_IsInRange( + /* [annotation][out][retval] */ + _Out_ boolean *isInRange) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_IsEngaged( + /* [annotation][out][retval] */ + _Out_ boolean *isEngaged) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_BodyTrackingId( + /* [annotation][out][retval] */ + _Out_ UINT64 *bodyTrackingId) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_HandType( + /* [annotation][out][retval] */ + _Out_ HandType *handType) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_HandReachExtent( + /* [annotation][out][retval] */ + _Out_ float *handReachExtent) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_BodyTimeCounter( + /* [annotation][out][retval] */ + _Out_ TIMESPAN *bodyTimeCounter) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_HandRotation( + /* [annotation][out][retval] */ + _Out_ float *handRotation) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_PressExtent( + /* [annotation][out][retval] */ + _Out_ float *pressExtent) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_UnclampedPosition( + /* [annotation][out][retval] */ + _Out_ PointF *unclampedPosition) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IKinectPointerPointPropertiesVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IKinectPointerPointProperties * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IKinectPointerPointProperties * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IKinectPointerPointProperties * This); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_IsPrimary )( + IKinectPointerPointProperties * This, + /* [annotation][out][retval] */ + _Out_ boolean *isPrimary); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_IsInRange )( + IKinectPointerPointProperties * This, + /* [annotation][out][retval] */ + _Out_ boolean *isInRange); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_IsEngaged )( + IKinectPointerPointProperties * This, + /* [annotation][out][retval] */ + _Out_ boolean *isEngaged); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_BodyTrackingId )( + IKinectPointerPointProperties * This, + /* [annotation][out][retval] */ + _Out_ UINT64 *bodyTrackingId); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_HandType )( + IKinectPointerPointProperties * This, + /* [annotation][out][retval] */ + _Out_ HandType *handType); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_HandReachExtent )( + IKinectPointerPointProperties * This, + /* [annotation][out][retval] */ + _Out_ float *handReachExtent); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_BodyTimeCounter )( + IKinectPointerPointProperties * This, + /* [annotation][out][retval] */ + _Out_ TIMESPAN *bodyTimeCounter); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_HandRotation )( + IKinectPointerPointProperties * This, + /* [annotation][out][retval] */ + _Out_ float *handRotation); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_PressExtent )( + IKinectPointerPointProperties * This, + /* [annotation][out][retval] */ + _Out_ float *pressExtent); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_UnclampedPosition )( + IKinectPointerPointProperties * This, + /* [annotation][out][retval] */ + _Out_ PointF *unclampedPosition); + + END_INTERFACE + } IKinectPointerPointPropertiesVtbl; + + interface IKinectPointerPointProperties + { + CONST_VTBL struct IKinectPointerPointPropertiesVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IKinectPointerPointProperties_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IKinectPointerPointProperties_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IKinectPointerPointProperties_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IKinectPointerPointProperties_get_IsPrimary(This,isPrimary) \ + ( (This)->lpVtbl -> get_IsPrimary(This,isPrimary) ) + +#define IKinectPointerPointProperties_get_IsInRange(This,isInRange) \ + ( (This)->lpVtbl -> get_IsInRange(This,isInRange) ) + +#define IKinectPointerPointProperties_get_IsEngaged(This,isEngaged) \ + ( (This)->lpVtbl -> get_IsEngaged(This,isEngaged) ) + +#define IKinectPointerPointProperties_get_BodyTrackingId(This,bodyTrackingId) \ + ( (This)->lpVtbl -> get_BodyTrackingId(This,bodyTrackingId) ) + +#define IKinectPointerPointProperties_get_HandType(This,handType) \ + ( (This)->lpVtbl -> get_HandType(This,handType) ) + +#define IKinectPointerPointProperties_get_HandReachExtent(This,handReachExtent) \ + ( (This)->lpVtbl -> get_HandReachExtent(This,handReachExtent) ) + +#define IKinectPointerPointProperties_get_BodyTimeCounter(This,bodyTimeCounter) \ + ( (This)->lpVtbl -> get_BodyTimeCounter(This,bodyTimeCounter) ) + +#define IKinectPointerPointProperties_get_HandRotation(This,handRotation) \ + ( (This)->lpVtbl -> get_HandRotation(This,handRotation) ) + +#define IKinectPointerPointProperties_get_PressExtent(This,pressExtent) \ + ( (This)->lpVtbl -> get_PressExtent(This,pressExtent) ) + +#define IKinectPointerPointProperties_get_UnclampedPosition(This,unclampedPosition) \ + ( (This)->lpVtbl -> get_UnclampedPosition(This,unclampedPosition) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IKinectPointerPointProperties_INTERFACE_DEFINED__ */ + + +#ifndef __IKinectPressingCompletedEventArgs_INTERFACE_DEFINED__ +#define __IKinectPressingCompletedEventArgs_INTERFACE_DEFINED__ + +/* interface IKinectPressingCompletedEventArgs */ +/* [object][local][uuid] */ + + +EXTERN_C const IID IID_IKinectPressingCompletedEventArgs; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("7B9DAD43-0DFA-48DC-A2E3-CDBA3B3E251F") + IKinectPressingCompletedEventArgs : public IUnknown + { + public: + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Position( + /* [annotation][out][retval] */ + _Out_ PointF *value) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IKinectPressingCompletedEventArgsVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IKinectPressingCompletedEventArgs * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IKinectPressingCompletedEventArgs * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IKinectPressingCompletedEventArgs * This); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Position )( + IKinectPressingCompletedEventArgs * This, + /* [annotation][out][retval] */ + _Out_ PointF *value); + + END_INTERFACE + } IKinectPressingCompletedEventArgsVtbl; + + interface IKinectPressingCompletedEventArgs + { + CONST_VTBL struct IKinectPressingCompletedEventArgsVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IKinectPressingCompletedEventArgs_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IKinectPressingCompletedEventArgs_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IKinectPressingCompletedEventArgs_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IKinectPressingCompletedEventArgs_get_Position(This,value) \ + ( (This)->lpVtbl -> get_Position(This,value) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IKinectPressingCompletedEventArgs_INTERFACE_DEFINED__ */ + + +#ifndef __IKinectPressingStartedEventArgs_INTERFACE_DEFINED__ +#define __IKinectPressingStartedEventArgs_INTERFACE_DEFINED__ + +/* interface IKinectPressingStartedEventArgs */ +/* [object][local][uuid] */ + + +EXTERN_C const IID IID_IKinectPressingStartedEventArgs; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("C01511F4-C7B3-4BA1-A15F-09DC854962AB") + IKinectPressingStartedEventArgs : public IUnknown + { + public: + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Position( + /* [annotation][out][retval] */ + _Out_ PointF *value) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IKinectPressingStartedEventArgsVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IKinectPressingStartedEventArgs * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IKinectPressingStartedEventArgs * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IKinectPressingStartedEventArgs * This); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Position )( + IKinectPressingStartedEventArgs * This, + /* [annotation][out][retval] */ + _Out_ PointF *value); + + END_INTERFACE + } IKinectPressingStartedEventArgsVtbl; + + interface IKinectPressingStartedEventArgs + { + CONST_VTBL struct IKinectPressingStartedEventArgsVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IKinectPressingStartedEventArgs_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IKinectPressingStartedEventArgs_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IKinectPressingStartedEventArgs_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IKinectPressingStartedEventArgs_get_Position(This,value) \ + ( (This)->lpVtbl -> get_Position(This,value) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IKinectPressingStartedEventArgs_INTERFACE_DEFINED__ */ + + +#ifndef __IKinectPressingUpdatedEventArgs_INTERFACE_DEFINED__ +#define __IKinectPressingUpdatedEventArgs_INTERFACE_DEFINED__ + +/* interface IKinectPressingUpdatedEventArgs */ +/* [object][local][uuid] */ + + +EXTERN_C const IID IID_IKinectPressingUpdatedEventArgs; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("D7D93D29-228E-4EBD-A3B9-E1B916B9BAEF") + IKinectPressingUpdatedEventArgs : public IUnknown + { + public: + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Position( + /* [annotation][out][retval] */ + _Out_ PointF *value) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_PressExtent( + /* [annotation][out][retval] */ + _Out_ float *value) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_HoldProgress( + /* [annotation][out][retval] */ + _Out_ float *value) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IKinectPressingUpdatedEventArgsVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IKinectPressingUpdatedEventArgs * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IKinectPressingUpdatedEventArgs * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IKinectPressingUpdatedEventArgs * This); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Position )( + IKinectPressingUpdatedEventArgs * This, + /* [annotation][out][retval] */ + _Out_ PointF *value); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_PressExtent )( + IKinectPressingUpdatedEventArgs * This, + /* [annotation][out][retval] */ + _Out_ float *value); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_HoldProgress )( + IKinectPressingUpdatedEventArgs * This, + /* [annotation][out][retval] */ + _Out_ float *value); + + END_INTERFACE + } IKinectPressingUpdatedEventArgsVtbl; + + interface IKinectPressingUpdatedEventArgs + { + CONST_VTBL struct IKinectPressingUpdatedEventArgsVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IKinectPressingUpdatedEventArgs_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IKinectPressingUpdatedEventArgs_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IKinectPressingUpdatedEventArgs_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IKinectPressingUpdatedEventArgs_get_Position(This,value) \ + ( (This)->lpVtbl -> get_Position(This,value) ) + +#define IKinectPressingUpdatedEventArgs_get_PressExtent(This,value) \ + ( (This)->lpVtbl -> get_PressExtent(This,value) ) + +#define IKinectPressingUpdatedEventArgs_get_HoldProgress(This,value) \ + ( (This)->lpVtbl -> get_HoldProgress(This,value) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IKinectPressingUpdatedEventArgs_INTERFACE_DEFINED__ */ + + +#ifndef __IKinectTappedEventArgs_INTERFACE_DEFINED__ +#define __IKinectTappedEventArgs_INTERFACE_DEFINED__ + +/* interface IKinectTappedEventArgs */ +/* [object][local][uuid] */ + + +EXTERN_C const IID IID_IKinectTappedEventArgs; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("C5B870C3-C819-4FF9-9F11-B5334D98761E") + IKinectTappedEventArgs : public IUnknown + { + public: + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_PointerDeviceType( + /* [annotation][out][retval] */ + _Out_ PointerDeviceType *value) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Position( + /* [annotation][out][retval] */ + _Out_ PointF *value) = 0; + + virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_TapCount( + /* [annotation][out][retval] */ + _Out_ UINT32 *value) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IKinectTappedEventArgsVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IKinectTappedEventArgs * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IKinectTappedEventArgs * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IKinectTappedEventArgs * This); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_PointerDeviceType )( + IKinectTappedEventArgs * This, + /* [annotation][out][retval] */ + _Out_ PointerDeviceType *value); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Position )( + IKinectTappedEventArgs * This, + /* [annotation][out][retval] */ + _Out_ PointF *value); + + /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_TapCount )( + IKinectTappedEventArgs * This, + /* [annotation][out][retval] */ + _Out_ UINT32 *value); + + END_INTERFACE + } IKinectTappedEventArgsVtbl; + + interface IKinectTappedEventArgs + { + CONST_VTBL struct IKinectTappedEventArgsVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IKinectTappedEventArgs_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IKinectTappedEventArgs_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IKinectTappedEventArgs_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IKinectTappedEventArgs_get_PointerDeviceType(This,value) \ + ( (This)->lpVtbl -> get_PointerDeviceType(This,value) ) + +#define IKinectTappedEventArgs_get_Position(This,value) \ + ( (This)->lpVtbl -> get_Position(This,value) ) + +#define IKinectTappedEventArgs_get_TapCount(This,value) \ + ( (This)->lpVtbl -> get_TapCount(This,value) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IKinectTappedEventArgs_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_Kinect2ECOM_0000_0070 */ +/* [local] */ + +HRESULT WINAPI GetKinectCoreWindowForCurrentThread(_COM_Outptr_ IKinectCoreWindow** ppKinectCoreWindow); +HRESULT WINAPI CreateKinectGestureRecognizer(_COM_Outptr_ IKinectGestureRecognizer** ppKinectGestureRecognizer); +HRESULT WINAPI OverrideKinectInteractionMode(KinectInteractionMode mode); +HRESULT WINAPI SetKinectOnePersonSystemEngagement(); +HRESULT WINAPI SetKinectTwoPersonSystemEngagement(); +HRESULT WINAPI SetKinectOnePersonManualEngagement(_In_ IBodyHandPair* pBodyHandPair); +HRESULT WINAPI SetKinectTwoPersonManualEngagement(_In_ IBodyHandPair* pBodyHandPair1, _In_ IBodyHandPair* pBodyHandPair2); +HRESULT WINAPI GetKinectEngagementMode(_Out_ KinectEngagementMode* pMode); +HRESULT WINAPI GetKinectManualEngagedHandCount(_Out_ UINT32* pManualEngagedHandCount); +HRESULT WINAPI GetKinectManualEngagedHand(UINT32 manualEngagedHandIndex, _COM_Outptr_ IBodyHandPair** ppManualEngagedHand); +HRESULT WINAPI GetMaximumKinectEngagedPersonCount(_Out_ UINT32* pMaximumKinectEngagedPersonCount); +HRESULT WINAPI CreateBodyHandPair(UINT64 bodyTrackingId, HandType handType, _COM_Outptr_ IBodyHandPair** ppBodyHandPair); + + +extern RPC_IF_HANDLE __MIDL_itf_Kinect2ECOM_0000_0070_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_Kinect2ECOM_0000_0070_v0_0_s_ifspec; + +/* Additional Prototypes for ALL interfaces */ + +/* end of Additional Prototypes */ + +#ifdef __cplusplus +} +#endif + +#endif + + diff --git a/SpaceStudioClient/Plugins/NeoKinectUnreal/Source/ThirdParty/Kinect/Lib/Kinect20.Face.lib b/SpaceStudioClient/Plugins/NeoKinectUnreal/Source/ThirdParty/Kinect/Lib/Kinect20.Face.lib new file mode 100644 index 0000000..02924c6 Binary files /dev/null and b/SpaceStudioClient/Plugins/NeoKinectUnreal/Source/ThirdParty/Kinect/Lib/Kinect20.Face.lib differ diff --git a/SpaceStudioClient/Plugins/NeoKinectUnreal/Source/ThirdParty/Kinect/Lib/Kinect20.lib b/SpaceStudioClient/Plugins/NeoKinectUnreal/Source/ThirdParty/Kinect/Lib/Kinect20.lib new file mode 100644 index 0000000..32bb611 Binary files /dev/null and b/SpaceStudioClient/Plugins/NeoKinectUnreal/Source/ThirdParty/Kinect/Lib/Kinect20.lib differ diff --git a/SpaceStudioClient/Plugins/NeoKinectUnreal/Source/ThirdParty/NeoKinect/Inc/KinectExposure.h b/SpaceStudioClient/Plugins/NeoKinectUnreal/Source/ThirdParty/NeoKinect/Inc/KinectExposure.h new file mode 100644 index 0000000..972d6e0 --- /dev/null +++ b/SpaceStudioClient/Plugins/NeoKinectUnreal/Source/ThirdParty/NeoKinect/Inc/KinectExposure.h @@ -0,0 +1,68 @@ +#pragma once +#include +#include "NuiSensor.h" +#include "Lockable.h" + +namespace Xbox { namespace Kinect { class NuiSensor; } } + +class KinectExposure +{ +public: + KinectExposure() = default; + + // Fully automatic exposure setting. + // Exposure compensation: negative value gives an underexposed image, + // positive gives an overexposed image. + void SetAutoExposure(float exposure_compensation = 0); + + // Sets a pseudo-exposure time in ms, value in range [0.0, 640] ms. + // + // The actual frame integration time is set to a multiple of fluorescent light period + // that is shorter than the requested time e.g. requesting 16 ms will set 10 ms + // in Australia (100Hz), 8.33 ms in USA (120Hz). + // The gain is automatically set to compensate for the reduced integration time. + // + // Requesting less than a single fluorescent light period will set the integration time + // to the requested value. + // + // To set the shortest non-flickering integration period for any country, simply set + // a pseudo-exposure time of between (10.0, 16.667) ms, which will automatically drop + // the integration time to 10 or 8.3 ms depending on country, while setting the analog + // gain control to a brighter value. + void SetSemiAutoExposure(float pseudo_exposure_time_ms); + + // Manually set true exposure time and analog gain. + void SetManualExposure(float integration_time_ms, float analog_gain); + + // Use one of the SET commands. + void SetFloat(Xbox::Kinect::NUISENSOR_RGB_COMMAND_TYPE command, float value); + void SetUint(Xbox::Kinect::NUISENSOR_RGB_COMMAND_TYPE command, uint32_t value); + + // Use one of the GET commands. + uint32_t GetCommand(Xbox::Kinect::NUISENSOR_RGB_COMMAND_TYPE command); + float GetCommandFloat(Xbox::Kinect::NUISENSOR_RGB_COMMAND_TYPE command); + +private: + LockableSharedPtr _sensor; + + void Connect(); + + //private Dictionary GetCommands(NUISENSOR_RGB_COMMAND_TYPE[] commands) + //{ + // NUISENSOR_RGB_CHANGE_STREAM_SETTING setting; + // NUISENSOR_RGB_CHANGE_STREAM_SETTING_REPLY reply; + + // setting.SequenceId = 0; + // setting.Commands = commands.Select(command = > new NUISENSOR_RGB_CHANGE_SETTING_CMD{ Cmd = (uint)command, Arg = 0 }).ToArray(); + + // lock(_sensor) + // { + // _sensor.ColorChangeCameraSettings(ref setting, out reply); + // } + + // return commands.Zip(reply.Status, (c, r) = > { return Tuple.Create(c, r.Data); }).ToDictionary(t = > t.Item1, t = > t.Item2); + //} + + uint32_t SetCommand(Xbox::Kinect::NUISENSOR_RGB_COMMAND_TYPE command, uint32_t argument); + void SetCommand(Xbox::Kinect::NUISENSOR_RGB_COMMAND_TYPE command, float argument); +}; diff --git a/SpaceStudioClient/Plugins/NeoKinectUnreal/Source/ThirdParty/NeoKinect/Inc/Lockable.h b/SpaceStudioClient/Plugins/NeoKinectUnreal/Source/ThirdParty/NeoKinect/Inc/Lockable.h new file mode 100644 index 0000000..19f98e4 --- /dev/null +++ b/SpaceStudioClient/Plugins/NeoKinectUnreal/Source/ThirdParty/NeoKinect/Inc/Lockable.h @@ -0,0 +1,108 @@ +#pragma once +#ifndef LOCKABLE_H_ +#define LOCKABLE_H_ + +#include +#include + +// Acts like a pointer to the locked object, but holds a lock for the given variable. +template +class Locked +{ +public: + Locked(T& obj, std::mutex& mutex) : _obj(obj), _mutex(mutex) { _mutex.lock(); } + Locked& operator=(const Locked&) = delete; + ~Locked() { _mutex.unlock(); } + // Access members of the locked value. + const T* operator->() const noexcept { return &_obj; } + // Access members of the locked value. + T* operator->() noexcept { return &_obj; } + // Access the locked value. + const T& operator*() const noexcept { return _obj; } + // Access the locked value. + T& operator*() noexcept { return _obj; } + +private: + T& _obj; + std::mutex& _mutex; +}; + +// Lockable value type. +template +class Lockable +{ +public: + // Only exists if T() exists. + Lockable() = default; + explicit Lockable(T obj) : _obj(std::move(obj)) {} + // Lock-guards the value for the lifetime of the returned object. + auto lock() const noexcept { return Locked(_obj, _mutex); } + // Lock-guards the value for the lifetime of the returned object. + auto lock() noexcept { return Locked(_obj, _mutex); } + +private: + T _obj; + mutable std::mutex _mutex; +}; + + +// Acts like a shared_ptr, but holds a lock for the given pointer. +template +class LockedPtr +{ +public: + LockedPtr(TPtr& obj, std::mutex& mutex) : _obj(obj), _mutex(mutex) { _mutex.lock(); } + LockedPtr& operator=(const LockedPtr&) = delete; + ~LockedPtr() { _mutex.unlock(); } + // Access members of the locked shared_ptr. + auto* operator->() const noexcept { return _obj.get(); } + // Dereference the locked shared_ptr. + auto& operator*() const noexcept { return *_obj; } + // Test if the locked shared_ptr is null. + explicit operator bool() const noexcept { return bool(_obj); } + // Assign to the locked shared_ptr (assigns the shared_ptr, not the inner T value). + void operator=(TPtr obj) { _obj = std::move(obj); } + // Reset the locked shared_ptr. + void reset() noexcept { _obj.reset(); } + // Get the pointer type. + // WARNING: this is potentially unsafe since the data can be passed around unlocked. + TPtr value() const noexcept { return _obj; } + +private: + TPtr& _obj; + std::mutex& _mutex; +}; + +// Lockable templated pointer type. +template +class LockablePtr +{ +public: + LockablePtr() + : _obj() + , _mutex(std::make_shared()) + { + } + explicit LockablePtr(TPtr obj) + : _obj(std::move(obj)) + , _mutex(std::make_shared()) + { + } + // Lock-guards the pointer for the lifetime of the returned object. + auto lock() const noexcept { return LockedPtr(_obj, *_mutex); } + // Lock-guards the pointer for the lifetime of the returned object. + auto lock() noexcept { return LockedPtr(_obj, *_mutex); } + +private: + TPtr _obj; + mutable std::shared_ptr _mutex; // Shared so object is copyable e.g. TPtr is shared_ptr +}; + + +template +using LockableSharedPtr = LockablePtr>; + +template +using LockableUniquePtr = LockablePtr>; + +#endif // LOCKABLE_H_ diff --git a/SpaceStudioClient/Plugins/NeoKinectUnreal/Source/ThirdParty/NeoKinect/Inc/NeoKinect.h b/SpaceStudioClient/Plugins/NeoKinectUnreal/Source/ThirdParty/NeoKinect/Inc/NeoKinect.h new file mode 100644 index 0000000..0df4829 --- /dev/null +++ b/SpaceStudioClient/Plugins/NeoKinectUnreal/Source/ThirdParty/NeoKinect/Inc/NeoKinect.h @@ -0,0 +1,479 @@ +#pragma once + +#include +#include + +#include + +#include +#include + +#include + +namespace NeoKinect +{ + constexpr unsigned int KinectColorWidth = 1920; + constexpr unsigned int KinectColorHeight = 1080; + + constexpr unsigned int KinectDepthWidth = 512; + constexpr unsigned int KinectDepthHeight = 424; + + constexpr unsigned int KinectBodyCount = BODY_COUNT; + constexpr unsigned int KinectJointCount = JointType_Count; + + struct Vector2 + { + float x, y; + + Vector2() : x(0.f), y(0.f) {} + Vector2(float xy) : x(xy), y(xy) {} + Vector2(float x, float y) : x(x), y(y) {} + explicit Vector2(const DepthSpacePoint& dsp) : x(dsp.X), y(dsp.Y) {} + explicit Vector2(const ColorSpacePoint& csp) : x(csp.X), y(csp.Y) {} + explicit Vector2(const PointF& pf) : x(pf.X), y(pf.Y) {} + + template + inline Vector2& operator=(const T& b); + + inline DepthSpacePoint toDepthSpacePoint() const; + inline ColorSpacePoint toColorSpacePoint() const; + }; + + struct Vector3 + { + float x, y, z; + + Vector3() : x(0.f), y(0.f), z(0.f) {} + Vector3(float xyz) : x(xyz), y(xyz), z(xyz) {} + Vector3(float x, float y, float z) : x(x), y(y), z(z) {} + explicit Vector3(const CameraSpacePoint& csp) : x(csp.X), y(csp.Y), z(csp.Z) {} + + inline Vector3& operator=(const CameraSpacePoint& b); + inline Vector3& operator/=(const float& b); + inline const Vector3 operator/(const float& b) const; + inline Vector3& operator*=(const float& b); + inline const Vector3 operator*(const float& b) const; + + inline bool IsZero() const; + float magnitude() const; // not inline as it uses math header and I didn't want to polute the headers + inline Vector3 normalized() const; + + inline CameraSpacePoint toCameraSpacePoint() const; + }; + + enum class KinectFrameType : BYTE + { + Color = 0, + Depth = 1, + Body = 2, + BodyIndex = 3, + Infrared = 4, + LongExposureInfrared = 5, + Face = 6, + Count = 7 + }; + + enum class KinectCoordinateSpace : BYTE + { + Camera = 0, + Depth = 1, + Color = 2, + Count = 3 + }; + + enum class KinectPixelFormat : BYTE + { + B8G8R8A8 = 0, + G8 = 1, + G16 = 2, + Bayer = 3, + None = 4, + Count = 5 + }; + + struct KinectJoint + { + Vector4 orientation; + CameraSpacePoint position; + TrackingState trackingState; + JointType type; + }; + + struct KinectBodyEdges + { + bool left, right, top, bottom; + }; + + struct KinectBody + { + UINT64 trackingId; + bool isTracked, isRestricted; + + KinectBodyEdges clippedEdges; + + HandState handLeftState; + TrackingState handLeftTrackingState; + + HandState handRightState; + TrackingState handRightTrackingState; + + TrackingState leanTrackingState; + Vector2 lean; + + KinectJoint joints[JointType_Count]; + }; + + struct KinectFacePoints + { + Vector2 leftEye; + Vector2 rightEye; + Vector2 nose; + Vector2 leftMouthCorner; + Vector2 rightMouthCorner; + }; + + struct KinectFace + { + UINT64 trackingId; + // face bounding box in color space + RectI boxColor; + // face bounding box in infrared space + RectI boxInfrared; + // face rotation in quaternion + Vector4 rotation; + // face pivot point. The same as the skeleton head joint. It's here for conveninence. + CameraSpacePoint pivot; + // face alignment points in color space + KinectFacePoints pointsColor; + // face alignment points in infrared space + KinectFacePoints pointsInfrared; + + DetectionResult isEngaged; + DetectionResult isHappy; + DetectionResult isLookingAway; + DetectionResult isMouthMoved; + DetectionResult isMouthOpen; + DetectionResult isLeftEyeClosed; + DetectionResult isRightEyeClosed; + DetectionResult isWearingGlasses; + + bool bIsTracked; + }; + + struct FrameDescription + { + bool valid; + + float diagonalFieldOfView, + horizontalFieldOfView, + verticalFieldOfView; + + UINT bytesPerPixel; + UINT lengthInPixels; + int width, height; + + FrameDescription() : valid(false) {} + }; + + class KinectSensor + { + public: + KinectSensor(); + ~KinectSensor(); + + /* + Opens the Microsoft API to the sensor. + @return Is the sensor API working? + */ + bool InitSensor(); + /* + Is the sensor on already? + It may take some time for the sensor to effectivelly turn on. Keep trying. + If it's taking too long, there's probably no connected sensor or it's not working. + @return True if the sensor is on. + */ + bool IsSensorAvailable(); + /* + Is the Microsoft Kinect API responding? + @return True if the sensor API is working. + */ + bool IsSensorOpen(); + /* + Shuts the sensor down and closes the Microsoft API to it. + @return True if it worked. + */ + bool UninitSensor(); + + + /* + A Vector4 containing the floor normal (xyz) and height (w). + Valid only if frequently locking and unlocking Body frame. That's when + it gets updated. + @return A Vector4 containing the floor normal (xyz) and height (w). + */ + Vector4 GetFloorClipPlane(); + /* + Uses the floor clip plane to calculate how much the sensor is tilted. + @return The sensor tilt in degrees. Looking down gives negative values. + */ + float GetSensorTilt(); + + FrameDescription GetFrameDescription(const KinectFrameType frameType) const; + + bool SetUseFrame(const KinectFrameType frameType, const bool use = true); + bool GetIsUsingFrame(const KinectFrameType frameType) const; + bool LockLatestFrame(KinectFrameType frameType); + void UnlockLatestFrame(KinectFrameType frameType); + bool GetIsFrameLocked(KinectFrameType frameType) const; + bool GetLatestFrameData(const KinectFrameType frameType, BYTE *& buffer, const KinectPixelFormat pixelFormat = KinectPixelFormat::None); + bool GetLatestFrameData(KinectBody bodies[BODY_COUNT]); + bool GetLatestFrameData(KinectFace faces[BODY_COUNT]); + + /* + Gets a frame remapped to another coordinate system. + All the remapping methods depend on the Depth frame. So make sure you're + frequently locking and unlocking it. + @return True if it worked. + */ + bool GetRemappedFrameData( + const KinectFrameType frameType, const KinectCoordinateSpace targetSpace, + BYTE *const buffer, const KinectPixelFormat pixelFormat); + /* + Gets a point remapped to another coordinate system. + All the remapping methods depend on the Depth frame. So make sure you're + frequently locking and unlocking it. + @return True if it worked. + */ + bool GetRemappedPoint( + const KinectCoordinateSpace fromSpace, const KinectCoordinateSpace toSpace, + const Vector2& srcPoint, Vector2& resultPoint); + bool GetRemappedPoint( + const KinectCoordinateSpace fromSpace, const KinectCoordinateSpace toSpace, + const Vector2& srcPoint, Vector3& resultPoint) const; + bool GetRemappedPoint( + const KinectCoordinateSpace fromSpace, const KinectCoordinateSpace toSpace, + const Vector3& srcPoint, Vector2& resultPoint) const; + + /* + Samples distance from the Depth frame. + The pixel used will be the round result of X and Y. + Note: this only works if the Depth frame is used and is being locked and + unlocked frequently. + */ + UINT16 SampleDepthFrame(const Vector2& point); + /* + Samples distance from the Depth frame using a coordinate from the Color frame. + The pixel used will be the round result of X and Y after remapped to the Depth frame. + Note: this only works if the 'Depth' and 'Depth remapped to Color' frames are both + used and are being locked and unlocked frequently. + */ + UINT16 SampleDepthFromColorCoords(const Vector2& colorPoint); + + /* + Fully automatic exposure setting. + @param exposureCompensation Negative value gives an underexposed image, + positive gives an overexposed image. + */ + void SetAutoExposure(float exposureCompensation = 0); + + /* + Sets a pseudo-exposure time in ms. + + The actual frame integration time is set to a multiple of fluorescent light period + that is shorter than the requested time e.g. requesting 16 ms will set 10 ms + in Australia (100Hz), 8.33 ms in USA (120Hz). + The gain is automatically set to compensate for the reduced integration time. + + Requesting less than a single fluorescent light period will set the integration time + to the requested value. + + To set the shortest non-flickering integration period for any country, simply set + a pseudo-exposure time of between (10.0, 16.667) ms, which will automatically drop + the integration time to 10 or 8.3 ms depending on country, while setting the analog + gain control to a brighter value. + + @param pseudoExposureTime Pseudo-exposure time in ms. [0.0, 640]ms + */ + void SetSemiAutoExposure(float pseudoExposureTime); + + /* + Manually set true exposure time and analog gain. + @param frameExposureTime Time of exposure for each frame, in ms. [0.0, 640]ms + @param analogGain Exposure analog gain. + */ + void SetManualExposure(float frameExposureTime, float analogGain); + + private: + IKinectSensor *pSensor; // Kinect sensor + //IMultiSourceFrameReader *pMultiFrameReader; + //IMultiSourceFrame *pMultiFrame; + + KinectExposure exposureControl; + + // Frame types +#define FRAME_VAR(name) I ##name## Frame *p ##name## Frame; I ##name## FrameReader *p ##name## FrameReader; + FRAME_VAR(Body); + FRAME_VAR(BodyIndex); + FRAME_VAR(Color); + FRAME_VAR(Depth); + FRAME_VAR(Infrared); + FRAME_VAR(LongExposureInfrared); +#undef FRAME_VAR + + // Face frame resources + /* Features we'll use from face frames */ + static const DWORD cFaceFrameFeatures = + FaceFrameFeatures_FaceEngagement + | FaceFrameFeatures_Happy + | FaceFrameFeatures_LookingAway + | FaceFrameFeatures_Glasses + | FaceFrameFeatures_LeftEyeClosed + | FaceFrameFeatures_RightEyeClosed + | FaceFrameFeatures_MouthMoved + | FaceFrameFeatures_MouthOpen + | FaceFrameFeatures_RotationOrientation + | FaceFrameFeatures_PointsInColorSpace + | FaceFrameFeatures_PointsInInfraredSpace + | FaceFrameFeatures_BoundingBoxInColorSpace + | FaceFrameFeatures_BoundingBoxInInfraredSpace; + IFaceFrameSource *pFaceFrameSources[BODY_COUNT]; + IFaceFrameReader *pFaceFrameReaders[BODY_COUNT]; + IFaceFrame *pFaceFrames[BODY_COUNT]; + + // Converts between depth, color and 3d coords + ICoordinateMapper *pMapper; + DepthSpacePoint *pColorMappedToDepth; + bool bIsColorMappedToDepthDirty; + /* We keep a copy of the latest depth frame so the user can convert points + between spaces anytime, not only when the depth frame is locked. + This copy is updated everytime the frame is locked. Because of it, some + coordinate space convertions may not work if the depth frame is not in use + nor locked frequently. */ + UINT16 *pDepthRawCopy; + + IBody *bodies[BODY_COUNT]; + Joint joints[JointType_Count]; // keep joints array in memory to avoid frequent allocations + JointOrientation jointOrientations[JointType_Count]; + Vector4 floorClipPlane; + + inline bool InitMapper(); + inline void UpdateColorMappedToDepth(); + inline int IndexFromXY(int pitch, float x, float y) const; + }; + + /* Print formatted string to the Output window */ + void Printf(const char *szFormat, ...); + void LogFailedHResult(const HRESULT hr, const char *functionName, const int line, const char *action = ""); + template + inline void SafeRelease(T*& pointer); + template + inline void SafeReleaseArray(T*& pointer); + + /*------------------------------------------------------------------------- + Templates and inlines implementation + -------------------------------------------------------------------------*/ + + template + Vector2& Vector2::operator=(const T& b) + { + if (this != &b) + { + this->x = b.X; + this->y = b.Y; + } + return *this; + } + + DepthSpacePoint Vector2::toDepthSpacePoint() const + { + DepthSpacePoint b; + b.X = this->x; + b.Y = this->y; + return b; + } + + ColorSpacePoint Vector2::toColorSpacePoint() const + { + ColorSpacePoint b; + b.X = this->x; + b.Y = this->y; + return b; + } + + Vector3& Vector3::operator=(const CameraSpacePoint& b) + { + this->x = b.X; + this->y = b.Y; + this->z = b.Z; + return *this; + } + + Vector3& Vector3::operator/=(const float& other) + { + x /= other; + y /= other; + z /= other; + return *this; + } + + const Vector3 Vector3::operator/(const float& other) const + { + Vector3 result(*this); + return result /= other; + } + + Vector3& Vector3::operator*=(const float& other) + { + x *= other; + y *= other; + z *= other; + return *this; + } + + const Vector3 Vector3::operator*(const float& other) const + { + Vector3 result(*this); + return result *= other; + } + + bool Vector3::IsZero() const + { + return x == 0.f && y == 0.f && z == 0.f; + } + + Vector3 Vector3::normalized() const + { + if (IsZero()) + return Vector3(); + return (*this / magnitude()); + } + + CameraSpacePoint Vector3::toCameraSpacePoint() const + { + CameraSpacePoint b; + b.X = this->x; + b.Y = this->y; + b.Z = this->z; + return b; + } + + template + inline void SafeRelease(T*& pointer) + { + if (pointer) + { + pointer->Release(); + } + pointer = nullptr; + } + + template + inline void SafeReleaseArray(T*& pointer) + { + if (pointer) + { + delete[] pointer; + } + pointer = nullptr; + } +} \ No newline at end of file diff --git a/SpaceStudioClient/Plugins/NeoKinectUnreal/Source/ThirdParty/NeoKinect/Inc/NuiSensor.h b/SpaceStudioClient/Plugins/NeoKinectUnreal/Source/ThirdParty/NeoKinect/Inc/NuiSensor.h new file mode 100644 index 0000000..d264711 --- /dev/null +++ b/SpaceStudioClient/Plugins/NeoKinectUnreal/Source/ThirdParty/NeoKinect/Inc/NuiSensor.h @@ -0,0 +1,145 @@ +// Conversion from the original C++/CLI implementation. + +#pragma once +#include +typedef struct _NUISENSOR_HANDLE *NUISENSOR_HANDLE, **PNUISENSOR_HANDLE; + +//using namespace System; +//using namespace System::Runtime::InteropServices; + +namespace Xbox +{ +namespace Kinect +{ + +enum NUISENSOR_RGB_COMMAND_TYPE +{ + NUISENSOR_RGB_COMMAND_SET_EXPOSURE_MODE = 0, + NUISENSOR_RGB_COMMAND_SET_INTEGRATION_TIME = 1, + NUISENSOR_RGB_COMMAND_GET_INTEGRATION_TIME = 2, + + NUISENSOR_RGB_COMMAND_SET_WHITE_BALANCE_MODE = 10, + NUISENSOR_RGB_COMMAND_SET_RED_CHANNEL_GAIN = 11, + NUISENSOR_RGB_COMMAND_SET_GREEN_CHANNEL_GAIN = 12, + NUISENSOR_RGB_COMMAND_SET_BLUE_CHANNEL_GAIN = 13, + NUISENSOR_RGB_COMMAND_GET_RED_CHANNEL_GAIN = 14, + NUISENSOR_RGB_COMMAND_GET_GREEN_CHANNEL_GAIN = 15, + NUISENSOR_RGB_COMMAND_GET_BLUE_CHANNEL_GAIN = 16, + NUISENSOR_RGB_COMMAND_SET_EXPOSURE_TIME_MS = 17, + NUISENSOR_RGB_COMMAND_GET_EXPOSURE_TIME_MS = 18, + NUISENSOR_RGB_COMMAND_SET_DIGITAL_GAIN = 19, + NUISENSOR_RGB_COMMAND_GET_DIGITAL_GAIN = 20, + NUISENSOR_RGB_COMMAND_SET_ANALOG_GAIN = 21, + NUISENSOR_RGB_COMMAND_GET_ANALOG_GAIN = 22, + NUISENSOR_RGB_COMMAND_SET_EXPOSURE_COMPENSATION = 23, + NUISENSOR_RGB_COMMAND_GET_EXPOSURE_COMPENSATION = 24, + NUISENSOR_RGB_COMMAND_SET_ACS = 25, + NUISENSOR_RGB_COMMAND_GET_ACS = 26, + NUISENSOR_RGB_COMMAND_SET_EXPOSURE_METERING_MODE = 27, + NUISENSOR_RGB_COMMAND_SET_EXPOSURE_METERING_ZONES = 28, + NUISENSOR_RGB_COMMAND_SET_EXPOSURE_METERING_ZONE_0_WEIGHT = 29, + NUISENSOR_RGB_COMMAND_SET_EXPOSURE_METERING_ZONE_1_WEIGHT = 30, + NUISENSOR_RGB_COMMAND_SET_EXPOSURE_METERING_ZONE_2_WEIGHT = 31, + NUISENSOR_RGB_COMMAND_SET_EXPOSURE_METERING_ZONE_3_WEIGHT = 32, + NUISENSOR_RGB_COMMAND_SET_EXPOSURE_METERING_ZONE_4_WEIGHT = 33, + NUISENSOR_RGB_COMMAND_SET_EXPOSURE_METERING_ZONE_5_WEIGHT = 34, + NUISENSOR_RGB_COMMAND_SET_EXPOSURE_METERING_ZONE_6_WEIGHT = 35, + NUISENSOR_RGB_COMMAND_SET_EXPOSURE_METERING_ZONE_7_WEIGHT = 36, + NUISENSOR_RGB_COMMAND_SET_EXPOSURE_METERING_ZONE_8_WEIGHT = 37, + NUISENSOR_RGB_COMMAND_SET_EXPOSURE_METERING_ZONE_9_WEIGHT = 38, + NUISENSOR_RGB_COMMAND_SET_EXPOSURE_METERING_ZONE_10_WEIGHT = 39, + NUISENSOR_RGB_COMMAND_SET_EXPOSURE_METERING_ZONE_11_WEIGHT = 40, + NUISENSOR_RGB_COMMAND_SET_EXPOSURE_METERING_ZONE_12_WEIGHT = 41, + NUISENSOR_RGB_COMMAND_SET_EXPOSURE_METERING_ZONE_13_WEIGHT = 42, + NUISENSOR_RGB_COMMAND_SET_EXPOSURE_METERING_ZONE_14_WEIGHT = 43, + NUISENSOR_RGB_COMMAND_SET_EXPOSURE_METERING_ZONE_15_WEIGHT = 44, + NUISENSOR_RGB_COMMAND_SET_EXPOSURE_METERING_ZONE_16_WEIGHT = 45, + NUISENSOR_RGB_COMMAND_SET_EXPOSURE_METERING_ZONE_17_WEIGHT = 46, + NUISENSOR_RGB_COMMAND_SET_EXPOSURE_METERING_ZONE_18_WEIGHT = 47, + NUISENSOR_RGB_COMMAND_SET_EXPOSURE_METERING_ZONE_19_WEIGHT = 48, + NUISENSOR_RGB_COMMAND_SET_EXPOSURE_METERING_ZONE_20_WEIGHT = 49, + NUISENSOR_RGB_COMMAND_SET_EXPOSURE_METERING_ZONE_21_WEIGHT = 50, + NUISENSOR_RGB_COMMAND_SET_EXPOSURE_METERING_ZONE_22_WEIGHT = 51, + NUISENSOR_RGB_COMMAND_SET_EXPOSURE_METERING_ZONE_23_WEIGHT = 52, + NUISENSOR_RGB_COMMAND_SET_EXPOSURE_METERING_ZONE_24_WEIGHT = 53, + NUISENSOR_RGB_COMMAND_SET_EXPOSURE_METERING_ZONE_25_WEIGHT = 54, + NUISENSOR_RGB_COMMAND_SET_EXPOSURE_METERING_ZONE_26_WEIGHT = 55, + NUISENSOR_RGB_COMMAND_SET_EXPOSURE_METERING_ZONE_27_WEIGHT = 56, + NUISENSOR_RGB_COMMAND_SET_EXPOSURE_METERING_ZONE_28_WEIGHT = 57, + NUISENSOR_RGB_COMMAND_SET_EXPOSURE_METERING_ZONE_29_WEIGHT = 58, + NUISENSOR_RGB_COMMAND_SET_EXPOSURE_METERING_ZONE_30_WEIGHT = 59, + NUISENSOR_RGB_COMMAND_SET_EXPOSURE_METERING_ZONE_31_WEIGHT = 60, + NUISENSOR_RGB_COMMAND_SET_EXPOSURE_METERING_ZONE_32_WEIGHT = 61, + NUISENSOR_RGB_COMMAND_SET_EXPOSURE_METERING_ZONE_33_WEIGHT = 62, + NUISENSOR_RGB_COMMAND_SET_EXPOSURE_METERING_ZONE_34_WEIGHT = 63, + NUISENSOR_RGB_COMMAND_SET_EXPOSURE_METERING_ZONE_35_WEIGHT = 64, + NUISENSOR_RGB_COMMAND_SET_EXPOSURE_METERING_ZONE_36_WEIGHT = 65, + NUISENSOR_RGB_COMMAND_SET_EXPOSURE_METERING_ZONE_37_WEIGHT = 66, + NUISENSOR_RGB_COMMAND_SET_EXPOSURE_METERING_ZONE_38_WEIGHT = 67, + NUISENSOR_RGB_COMMAND_SET_EXPOSURE_METERING_ZONE_39_WEIGHT = 68, + NUISENSOR_RGB_COMMAND_SET_EXPOSURE_METERING_ZONE_40_WEIGHT = 69, + NUISENSOR_RGB_COMMAND_SET_EXPOSURE_METERING_ZONE_41_WEIGHT = 70, + NUISENSOR_RGB_COMMAND_SET_EXPOSURE_METERING_ZONE_42_WEIGHT = 71, + NUISENSOR_RGB_COMMAND_SET_EXPOSURE_METERING_ZONE_43_WEIGHT = 72, + NUISENSOR_RGB_COMMAND_SET_EXPOSURE_METERING_ZONE_44_WEIGHT = 73, + NUISENSOR_RGB_COMMAND_SET_EXPOSURE_METERING_ZONE_45_WEIGHT = 74, + NUISENSOR_RGB_COMMAND_SET_EXPOSURE_METERING_ZONE_46_WEIGHT = 75, + NUISENSOR_RGB_COMMAND_SET_EXPOSURE_METERING_ZONE_47_WEIGHT = 76, + NUISENSOR_RGB_COMMAND_SET_MAX_ANALOG_GAIN_CAP = 77, + NUISENSOR_RGB_COMMAND_SET_MAX_DIGITAL_GAIN_CAP = 78, + NUISENSOR_RGB_COMMAND_SET_FLICKER_FREE_FREQUENCY = 79, + NUISENSOR_RGB_COMMAND_GET_EXPOSURE_MODE = 80, + NUISENSOR_RGB_COMMAND_GET_WHITE_BALANCE_MODE = 81, + NUISENSOR_RGB_COMMAND_SET_FRAME_RATE = 82, + NUISENSOR_RGB_COMMAND_GET_FRAME_RATE = 83, + + // This range is reserved. Do not re-use. + NUISENSOR_RGB_COMMAND_RESERVED_BASE = 400, + NUISENSOR_RGB_COMMAND_RESERVED_END = NUISENSOR_RGB_COMMAND_RESERVED_BASE + 200, + // End of reserved region + +}; + +struct NUISENSOR_RGB_CHANGE_SETTING_CMD +{ + uint32_t Cmd; + uint32_t Arg; +}; + +struct NUISENSOR_RGB_CHANGE_STREAM_SETTING +{ + uint32_t SequenceId; + std::vector Commands; +}; + +struct NUISENSOR_RGB_CHANGE_STREAM_SETTING_REPLY_STATUS +{ + uint32_t Status; + uint32_t Data; +}; + +struct NUISENSOR_RGB_CHANGE_STREAM_SETTING_REPLY +{ + uint32_t CommandListStatus; + std::vector Status; +}; + + +class NuiSensor +{ +public: + NuiSensor(); + ~NuiSensor(); + + void Shutdown(); + + void ColorChangeCameraSettings(const NUISENSOR_RGB_CHANGE_STREAM_SETTING& settings, NUISENSOR_RGB_CHANGE_STREAM_SETTING_REPLY* p_reply); + +private: + void TestResult(int success); + + NUISENSOR_HANDLE _sensor = nullptr; +}; + +} +} diff --git a/SpaceStudioClient/Plugins/NeoKinectUnreal/Source/ThirdParty/NeoKinect/Lib/NeoKinect.lib b/SpaceStudioClient/Plugins/NeoKinectUnreal/Source/ThirdParty/NeoKinect/Lib/NeoKinect.lib new file mode 100644 index 0000000..3caf891 Binary files /dev/null and b/SpaceStudioClient/Plugins/NeoKinectUnreal/Source/ThirdParty/NeoKinect/Lib/NeoKinect.lib differ diff --git a/SpaceStudioClient/Source/SpaceStudioClient.Target.cs b/SpaceStudioClient/Source/SpaceStudioClient.Target.cs new file mode 100644 index 0000000..d5d9c6c --- /dev/null +++ b/SpaceStudioClient/Source/SpaceStudioClient.Target.cs @@ -0,0 +1,15 @@ +// Fill out your copyright notice in the Description page of Project Settings. + +using UnrealBuildTool; +using System.Collections.Generic; + +public class SpaceStudioClientTarget : TargetRules +{ + public SpaceStudioClientTarget(TargetInfo Target) : base(Target) + { + Type = TargetType.Game; + DefaultBuildSettings = BuildSettingsVersion.V4; + + ExtraModuleNames.AddRange( new string[] { "SpaceStudioClient" } ); + } +} diff --git a/SpaceStudioClient/Source/SpaceStudioClient/Private/MyActor.cpp b/SpaceStudioClient/Source/SpaceStudioClient/Private/MyActor.cpp new file mode 100644 index 0000000..d4a22d8 --- /dev/null +++ b/SpaceStudioClient/Source/SpaceStudioClient/Private/MyActor.cpp @@ -0,0 +1,27 @@ +// Fill out your copyright notice in the Description page of Project Settings. + + +#include "MyActor.h" + +// Sets default values +AMyActor::AMyActor() +{ + // Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it. + PrimaryActorTick.bCanEverTick = true; + +} + +// Called when the game starts or when spawned +void AMyActor::BeginPlay() +{ + Super::BeginPlay(); + +} + +// Called every frame +void AMyActor::Tick(float DeltaTime) +{ + Super::Tick(DeltaTime); + +} + diff --git a/SpaceStudioClient/Source/SpaceStudioClient/Private/MyBlueprintFunctionLibrary.cpp b/SpaceStudioClient/Source/SpaceStudioClient/Private/MyBlueprintFunctionLibrary.cpp new file mode 100644 index 0000000..b37735e --- /dev/null +++ b/SpaceStudioClient/Source/SpaceStudioClient/Private/MyBlueprintFunctionLibrary.cpp @@ -0,0 +1,133 @@ +// Fill out your copyright notice in the Description page of Project Settings. +#include "MyBlueprintFunctionLibrary.h" + +#include +#include +#include +#include +#include +#pragma comment(lib, "ole32.lib") + +// 获取当前系统音量 +float _GetSystemVolume() { + HRESULT hr; + IMMDeviceEnumerator* pEnumerator = NULL; + IMMDevice* pDevice = NULL; + IAudioEndpointVolume* pEndpointVolume = NULL; + float currentVolume = 0.0f; + + // 初始化COM库 + hr = CoInitialize(NULL); + if (FAILED(hr)) { + UE_LOG(LogTemp, Warning, TEXT("COM初始化失败")); + return -1.0f; + } + + // 创建设备枚举器 + hr = CoCreateInstance(__uuidof(MMDeviceEnumerator), NULL, CLSCTX_ALL, + __uuidof(IMMDeviceEnumerator), (void**)&pEnumerator); + if (FAILED(hr)) { + UE_LOG(LogTemp, Warning, TEXT("创建设备枚举器失败")); + CoUninitialize(); + return -1.0f; + } + + // 获取默认音频端点 + hr = pEnumerator->GetDefaultAudioEndpoint(eRender, eConsole, &pDevice); + if (FAILED(hr)) { + UE_LOG(LogTemp, Warning, TEXT("获取默认音频端点失败")); + pEnumerator->Release(); + CoUninitialize(); + return -1.0f; + } + + // 激活音频端点音量接口 + hr = pDevice->Activate(__uuidof(IAudioEndpointVolume), CLSCTX_ALL, NULL, (void**)&pEndpointVolume); + if (FAILED(hr)) { + UE_LOG(LogTemp, Warning, TEXT("激活音频端点音量接口失败")); + pDevice->Release(); + pEnumerator->Release(); + CoUninitialize(); + return -1.0f; + } + + // 获取当前音量 + hr = pEndpointVolume->GetMasterVolumeLevelScalar(¤tVolume); + if (FAILED(hr)) { + UE_LOG(LogTemp, Warning, TEXT("获取音量失败")); + } + + // 释放资源 + pEndpointVolume->Release(); + pDevice->Release(); + pEnumerator->Release(); + CoUninitialize(); + + return currentVolume; +} + +// 设置系统音量 +bool _SetSystemVolume(float volume) { + HRESULT hr; + IMMDeviceEnumerator* pEnumerator = NULL; + IMMDevice* pDevice = NULL; + IAudioEndpointVolume* pEndpointVolume = NULL; + + // 初始化COM库 + hr = CoInitialize(NULL); + if (FAILED(hr)) { + UE_LOG(LogTemp, Warning, TEXT("COM初始化失败")); + return false; + } + + // 创建设备枚举器 + hr = CoCreateInstance(__uuidof(MMDeviceEnumerator), NULL, CLSCTX_ALL, + __uuidof(IMMDeviceEnumerator), (void**)&pEnumerator); + if (FAILED(hr)) { + UE_LOG(LogTemp, Warning, TEXT("创建设备枚举器失败")); + CoUninitialize(); + return false; + } + + // 获取默认音频端点 + hr = pEnumerator->GetDefaultAudioEndpoint(eRender, eConsole, &pDevice); + if (FAILED(hr)) { + UE_LOG(LogTemp, Warning, TEXT("获取默认音频端点失败")); + pEnumerator->Release(); + CoUninitialize(); + return false; + } + + // 激活音频端点音量接口 + hr = pDevice->Activate(__uuidof(IAudioEndpointVolume), CLSCTX_ALL, NULL, (void**)&pEndpointVolume); + if (FAILED(hr)) { + UE_LOG(LogTemp, Warning, TEXT("激活音频端点音量接口失败")); + pDevice->Release(); + pEnumerator->Release(); + CoUninitialize(); + return false; + } + + // 设置音量 + hr = pEndpointVolume->SetMasterVolumeLevelScalar(volume, NULL); + if (FAILED(hr)) { + UE_LOG(LogTemp, Warning, TEXT("设置音量失败")); + } + + // 释放资源 + pEndpointVolume->Release(); + pDevice->Release(); + pEnumerator->Release(); + CoUninitialize(); + + return SUCCEEDED(hr); +} +bool UMyBlueprintFunctionLibrary::SetSystemVolume(float volume) +{ + return _SetSystemVolume(volume); +} + +float UMyBlueprintFunctionLibrary::GetSystemVolume() +{ + return _GetSystemVolume(); +} diff --git a/SpaceStudioClient/Source/SpaceStudioClient/Public/MyActor.h b/SpaceStudioClient/Source/SpaceStudioClient/Public/MyActor.h new file mode 100644 index 0000000..c3dfc60 --- /dev/null +++ b/SpaceStudioClient/Source/SpaceStudioClient/Public/MyActor.h @@ -0,0 +1,26 @@ +// Fill out your copyright notice in the Description page of Project Settings. + +#pragma once + +#include "CoreMinimal.h" +#include "GameFramework/Actor.h" +#include "MyActor.generated.h" + +UCLASS() +class SPACESTUDIOCLIENT_API AMyActor : public AActor +{ + GENERATED_BODY() + +public: + // Sets default values for this actor's properties + AMyActor(); + +protected: + // Called when the game starts or when spawned + virtual void BeginPlay() override; + +public: + // Called every frame + virtual void Tick(float DeltaTime) override; + +}; diff --git a/SpaceStudioClient/Source/SpaceStudioClient/Public/MyBlueprintFunctionLibrary.h b/SpaceStudioClient/Source/SpaceStudioClient/Public/MyBlueprintFunctionLibrary.h new file mode 100644 index 0000000..1b6845b --- /dev/null +++ b/SpaceStudioClient/Source/SpaceStudioClient/Public/MyBlueprintFunctionLibrary.h @@ -0,0 +1,21 @@ +// Fill out your copyright notice in the Description page of Project Settings. + +#pragma once + +#include "CoreMinimal.h" +#include "Kismet/BlueprintFunctionLibrary.h" +#include "MyBlueprintFunctionLibrary.generated.h" + +/** + * + */ +UCLASS() +class SPACESTUDIOCLIENT_API UMyBlueprintFunctionLibrary : public UBlueprintFunctionLibrary +{ + GENERATED_BODY() + UFUNCTION(BlueprintCallable, Category = "MyLibrary|Sound", meta = (DisplayName = "set system volume")) + static bool SetSystemVolume(float volume); + + UFUNCTION(BlueprintCallable, Category = "MyLibrary|Sound", meta = (DisplayName = "get system volume")) + static float GetSystemVolume(); +}; diff --git a/SpaceStudioClient/Source/SpaceStudioClient/SpaceStudioClient.Build.cs b/SpaceStudioClient/Source/SpaceStudioClient/SpaceStudioClient.Build.cs new file mode 100644 index 0000000..24b04e6 --- /dev/null +++ b/SpaceStudioClient/Source/SpaceStudioClient/SpaceStudioClient.Build.cs @@ -0,0 +1,23 @@ +// Fill out your copyright notice in the Description page of Project Settings. + +using UnrealBuildTool; + +public class SpaceStudioClient : ModuleRules +{ + public SpaceStudioClient(ReadOnlyTargetRules Target) : base(Target) + { + PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs; + + PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore" }); + + PrivateDependencyModuleNames.AddRange(new string[] { }); + + // Uncomment if you are using Slate UI + // PrivateDependencyModuleNames.AddRange(new string[] { "Slate", "SlateCore" }); + + // Uncomment if you are using online features + // PrivateDependencyModuleNames.Add("OnlineSubsystem"); + + // To include OnlineSubsystemSteam, add it to the plugins section in your uproject file with the Enabled attribute set to true + } +} diff --git a/SpaceStudioClient/Source/SpaceStudioClient/SpaceStudioClient.cpp b/SpaceStudioClient/Source/SpaceStudioClient/SpaceStudioClient.cpp new file mode 100644 index 0000000..ae5f54e --- /dev/null +++ b/SpaceStudioClient/Source/SpaceStudioClient/SpaceStudioClient.cpp @@ -0,0 +1,6 @@ +// Fill out your copyright notice in the Description page of Project Settings. + +#include "SpaceStudioClient.h" +#include "Modules/ModuleManager.h" + +IMPLEMENT_PRIMARY_GAME_MODULE( FDefaultGameModuleImpl, SpaceStudioClient, "SpaceStudioClient" ); diff --git a/SpaceStudioClient/Source/SpaceStudioClient/SpaceStudioClient.h b/SpaceStudioClient/Source/SpaceStudioClient/SpaceStudioClient.h new file mode 100644 index 0000000..90aad9e --- /dev/null +++ b/SpaceStudioClient/Source/SpaceStudioClient/SpaceStudioClient.h @@ -0,0 +1,6 @@ +// Fill out your copyright notice in the Description page of Project Settings. + +#pragma once + +#include "CoreMinimal.h" + diff --git a/SpaceStudioClient/Source/SpaceStudioClientEditor.Target.cs b/SpaceStudioClient/Source/SpaceStudioClientEditor.Target.cs new file mode 100644 index 0000000..61f11ea --- /dev/null +++ b/SpaceStudioClient/Source/SpaceStudioClientEditor.Target.cs @@ -0,0 +1,15 @@ +// Fill out your copyright notice in the Description page of Project Settings. + +using UnrealBuildTool; +using System.Collections.Generic; + +public class SpaceStudioClientEditorTarget : TargetRules +{ + public SpaceStudioClientEditorTarget(TargetInfo Target) : base(Target) + { + Type = TargetType.Editor; + DefaultBuildSettings = BuildSettingsVersion.V4; + + ExtraModuleNames.AddRange( new string[] { "SpaceStudioClient" } ); + } +} diff --git a/SpaceStudioClient/SpaceStudioClient.uproject b/SpaceStudioClient/SpaceStudioClient.uproject index 420d4d0..9609eb5 100644 --- a/SpaceStudioClient/SpaceStudioClient.uproject +++ b/SpaceStudioClient/SpaceStudioClient.uproject @@ -3,6 +3,16 @@ "EngineAssociation": "5.3", "Category": "", "Description": "", + "Modules": [ + { + "Name": "SpaceStudioClient", + "Type": "Runtime", + "LoadingPhase": "Default", + "AdditionalDependencies": [ + "Engine" + ] + } + ], "Plugins": [ { "Name": "ModelingToolsEditorMode", @@ -10,6 +20,10 @@ "TargetAllowList": [ "Editor" ] + }, + { + "Name": "JsonBlueprintUtilities", + "Enabled": true } ] } \ No newline at end of file