add an android module with working jni calls to Init(), Dispose(), and GetLibraryVersion()
This commit is contained in:
@@ -31,6 +31,16 @@
|
|||||||
"Win64"
|
"Win64"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"Name": "SenseGloveAndroid",
|
||||||
|
"Type": "Runtime",
|
||||||
|
"LoadingPhase": "PreDefault",
|
||||||
|
"WhitelistPlatforms": [
|
||||||
|
"Android",
|
||||||
|
"Linux",
|
||||||
|
"Win64"
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"Name": "SenseGloveBuildHacks",
|
"Name": "SenseGloveBuildHacks",
|
||||||
"Type": "Runtime",
|
"Type": "Runtime",
|
||||||
|
|||||||
@@ -0,0 +1,115 @@
|
|||||||
|
/**
|
||||||
|
* @file
|
||||||
|
*
|
||||||
|
* @author Mamadou Babaei <mamadou@senseglove.com>
|
||||||
|
*
|
||||||
|
* @section LICENSE
|
||||||
|
*
|
||||||
|
* (The MIT License)
|
||||||
|
*
|
||||||
|
* Copyright (c) 2020 - 2022 SenseGlove
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
|
* copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
* SOFTWARE.
|
||||||
|
*
|
||||||
|
* @section DESCRIPTION
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "SGAndroid/SGConnectJNI.h"
|
||||||
|
|
||||||
|
#if PLATFORM_ANDROID
|
||||||
|
#include "Android/AndroidApplication.h"
|
||||||
|
#include "Android/AndroidJava.h"
|
||||||
|
#endif /* PLATFORM_ANDROID */
|
||||||
|
|
||||||
|
static constexpr char SGCONNECT_JAVA_CLASS_NAME[] = "com.senseglove.sgconnect.SGConnect";
|
||||||
|
|
||||||
|
int32 FSGConnectJNI::Init()
|
||||||
|
{
|
||||||
|
int32 Result = 0;
|
||||||
|
|
||||||
|
#if PLATFORM_ANDROID
|
||||||
|
JNIEnv* Env = FAndroidApplication::GetJavaEnv();
|
||||||
|
if (Env)
|
||||||
|
{
|
||||||
|
jclass Class = FAndroidApplication::FindJavaClass(SGCONNECT_JAVA_CLASS_NAME);
|
||||||
|
if (!Env->IsSameObject(Class, nullptr))
|
||||||
|
{
|
||||||
|
jmethodID Method = Env->GetStaticMethodID(Class, "Init", "()I");
|
||||||
|
if (Method)
|
||||||
|
{
|
||||||
|
Result = Env->CallStaticIntMethod(Class, Method);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif /* PLATFORM_ANDROID */
|
||||||
|
|
||||||
|
return Result;
|
||||||
|
}
|
||||||
|
|
||||||
|
int32 FSGConnectJNI::Dispose()
|
||||||
|
{
|
||||||
|
int32 Result = 0;
|
||||||
|
|
||||||
|
#if PLATFORM_ANDROID
|
||||||
|
JNIEnv* Env = FAndroidApplication::GetJavaEnv();
|
||||||
|
if (Env)
|
||||||
|
{
|
||||||
|
jclass Class = FAndroidApplication::FindJavaClass(SGCONNECT_JAVA_CLASS_NAME);
|
||||||
|
if (!Env->IsSameObject(Class, nullptr))
|
||||||
|
{
|
||||||
|
jmethodID Method = Env->GetStaticMethodID(Class, "Dispose", "()I");
|
||||||
|
if (Method)
|
||||||
|
{
|
||||||
|
Result = Env->CallStaticIntMethod(Class, Method);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif /* PLATFORM_ANDROID */
|
||||||
|
|
||||||
|
return Result;
|
||||||
|
}
|
||||||
|
|
||||||
|
FString FSGConnectJNI::GetLibraryVersion()
|
||||||
|
{
|
||||||
|
FString Result;
|
||||||
|
|
||||||
|
#if PLATFORM_ANDROID
|
||||||
|
JNIEnv* Env = FAndroidApplication::GetJavaEnv();
|
||||||
|
if (Env)
|
||||||
|
{
|
||||||
|
jclass Class = FAndroidApplication::FindJavaClass(SGCONNECT_JAVA_CLASS_NAME);
|
||||||
|
if (!Env->IsSameObject(Class, nullptr))
|
||||||
|
{
|
||||||
|
jmethodID Method = Env->GetStaticMethodID(Class, "GetLibraryVersion", "()Ljava/lang/String;");
|
||||||
|
if (Method)
|
||||||
|
{
|
||||||
|
jstring ResultJString = (jstring)Env->CallStaticObjectMethod(Class, Method);
|
||||||
|
const char* ResultChars = Env->GetStringUTFChars(ResultJString, nullptr);
|
||||||
|
Result = FString(UTF8_TO_TCHAR(ResultChars));
|
||||||
|
Env->ReleaseStringUTFChars(ResultJString, ResultChars);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif /* PLATFORM_ANDROID */
|
||||||
|
|
||||||
|
return Result;
|
||||||
|
}
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
/**
|
||||||
|
* @file
|
||||||
|
*
|
||||||
|
* @author Mamadou Babaei <mamadou@senseglove.com>
|
||||||
|
*
|
||||||
|
* @section LICENSE
|
||||||
|
*
|
||||||
|
* (The MIT License)
|
||||||
|
*
|
||||||
|
* Copyright (c) 2020 - 2022 SenseGlove
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
|
* copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
* SOFTWARE.
|
||||||
|
*
|
||||||
|
* @section DESCRIPTION
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "SenseGloveAndroid.h"
|
||||||
|
|
||||||
|
#include "Modules/ModuleManager.h"
|
||||||
|
#include "SenseGloveAndroidModule.h"
|
||||||
|
|
||||||
|
IMPLEMENT_MODULE(FSenseGloveAndroidModule, SenseGloveAndroid)
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
/**
|
||||||
|
* @file
|
||||||
|
*
|
||||||
|
* @author Mamadou Babaei <mamadou@senseglove.com>
|
||||||
|
*
|
||||||
|
* @section LICENSE
|
||||||
|
*
|
||||||
|
* (The MIT License)
|
||||||
|
*
|
||||||
|
* Copyright (c) 2020 - 2022 SenseGlove
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
|
* copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
* SOFTWARE.
|
||||||
|
*
|
||||||
|
* @section DESCRIPTION
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "CoreMinimal.h"
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
/**
|
||||||
|
* @file
|
||||||
|
*
|
||||||
|
* @author Mamadou Babaei <mamadou@senseglove.com>
|
||||||
|
*
|
||||||
|
* @section LICENSE
|
||||||
|
*
|
||||||
|
* (The MIT License)
|
||||||
|
*
|
||||||
|
* Copyright (c) 2020 - 2022 SenseGlove
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
|
* copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
* SOFTWARE.
|
||||||
|
*
|
||||||
|
* @section DESCRIPTION
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "SenseGloveAndroidModule.h"
|
||||||
|
|
||||||
|
#include "SGLog/SGLog.h"
|
||||||
|
|
||||||
|
#define LOCTEXT_NAMESPACE "FSenseGloveAndroidModule"
|
||||||
|
|
||||||
|
void FSenseGloveAndroidModule::StartupModule()
|
||||||
|
{
|
||||||
|
SGLOG("Starting up SenseGloveAndroid module...");
|
||||||
|
}
|
||||||
|
|
||||||
|
void FSenseGloveAndroidModule::PreUnloadCallback()
|
||||||
|
{
|
||||||
|
SGLOG("Unloading SenseGloveAndroid module...");
|
||||||
|
}
|
||||||
|
|
||||||
|
void FSenseGloveAndroidModule::PostLoadCallback()
|
||||||
|
{
|
||||||
|
SGLOG("Loading of SenseGloveAndroid module has succeeded!");
|
||||||
|
}
|
||||||
|
|
||||||
|
void FSenseGloveAndroidModule::ShutdownModule()
|
||||||
|
{
|
||||||
|
SGLOG("Shutting down SenseGloveAndroid module...");
|
||||||
|
}
|
||||||
|
|
||||||
|
#undef LOCTEXT_NAMESPACE
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
/**
|
||||||
|
* @file
|
||||||
|
*
|
||||||
|
* @author Mamadou Babaei <mamadou@senseglove.com>
|
||||||
|
*
|
||||||
|
* @section LICENSE
|
||||||
|
*
|
||||||
|
* (The MIT License)
|
||||||
|
*
|
||||||
|
* Copyright (c) 2020 - 2022 SenseGlove
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
|
* copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
* SOFTWARE.
|
||||||
|
*
|
||||||
|
* @section DESCRIPTION
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "Modules/ModuleInterface.h"
|
||||||
|
|
||||||
|
#define LOCTEXT_NAMESPACE "SenseGloveAndroid"
|
||||||
|
|
||||||
|
class FSenseGloveAndroidModule : public IModuleInterface
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void StartupModule() override;
|
||||||
|
virtual void PreUnloadCallback() override;
|
||||||
|
virtual void PostLoadCallback() override;
|
||||||
|
virtual void ShutdownModule() override;
|
||||||
|
};
|
||||||
|
|
||||||
|
#undef LOCTEXT_NAMESPACE
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
/**
|
||||||
|
* @file
|
||||||
|
*
|
||||||
|
* @author Mamadou Babaei <mamadou@senseglove.com>
|
||||||
|
*
|
||||||
|
* @section LICENSE
|
||||||
|
*
|
||||||
|
* (The MIT License)
|
||||||
|
*
|
||||||
|
* Copyright (c) 2020 - 2022 SenseGlove
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
|
* copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
* SOFTWARE.
|
||||||
|
*
|
||||||
|
* @section DESCRIPTION
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "UObject/ObjectMacros.h"
|
||||||
|
|
||||||
|
#include "SGConnectJNI.generated.h"
|
||||||
|
|
||||||
|
USTRUCT()
|
||||||
|
struct SENSEGLOVEANDROID_API FSGConnectJNI
|
||||||
|
{
|
||||||
|
GENERATED_BODY()
|
||||||
|
|
||||||
|
public:
|
||||||
|
static int32 Init();
|
||||||
|
|
||||||
|
static int32 Dispose();
|
||||||
|
|
||||||
|
static FString GetLibraryVersion();
|
||||||
|
};
|
||||||
@@ -0,0 +1,75 @@
|
|||||||
|
/**
|
||||||
|
* @file
|
||||||
|
*
|
||||||
|
* @author Mamadou Babaei <mamadou@senseglove.com>
|
||||||
|
*
|
||||||
|
* @section LICENSE
|
||||||
|
*
|
||||||
|
* (The MIT License)
|
||||||
|
*
|
||||||
|
* Copyright (c) 2020 - 2022 SenseGlove
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
|
* copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
* SOFTWARE.
|
||||||
|
*
|
||||||
|
* @section DESCRIPTION
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using UnrealBuildTool;
|
||||||
|
|
||||||
|
public class SenseGloveAndroid : ModuleRules
|
||||||
|
{
|
||||||
|
public SenseGloveAndroid(ReadOnlyTargetRules Target) : base(Target)
|
||||||
|
{
|
||||||
|
PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs;
|
||||||
|
|
||||||
|
PublicDependencyModuleNames.AddRange(
|
||||||
|
new string[]
|
||||||
|
{
|
||||||
|
"Core",
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
PrivateDependencyModuleNames.AddRange(
|
||||||
|
new string[]
|
||||||
|
{
|
||||||
|
"CoreUObject",
|
||||||
|
"Engine",
|
||||||
|
"SenseGloveLog",
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
if (Target.Platform == UnrealTargetPlatform.Android)
|
||||||
|
{
|
||||||
|
PrivateDependencyModuleNames.AddRange(
|
||||||
|
new string[]
|
||||||
|
{
|
||||||
|
"Launch",
|
||||||
|
"Settings",
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
AdditionalPropertiesForReceipt.Add("AndroidPlugin", Path.Combine(ModuleDirectory, "SenseGloveAndroid_UPL.xml"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,209 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
@author Mamadou Babaei <mamadou@senseglove.com>
|
||||||
|
|
||||||
|
@section LICENSE
|
||||||
|
|
||||||
|
(The MIT License)
|
||||||
|
|
||||||
|
Copyright (c) 2020 - 2022 SenseGlove
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<!-- https://docs.unrealengine.com/en-US/SharingAndReleasing/Mobile/UnrealPluginLanguage/index.html -->
|
||||||
|
|
||||||
|
<root xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
|
<init>
|
||||||
|
<log text="SenseGloveAndroid [INIT]: adding properties to the manifest and Gradle"/>
|
||||||
|
<trace enable="true"/>
|
||||||
|
|
||||||
|
<setBool result="bSupportedArch" value="false"/>
|
||||||
|
|
||||||
|
<isArch arch="armeabi-v7a">
|
||||||
|
<setBool result="bSupportedArch" value="false"/>
|
||||||
|
</isArch>
|
||||||
|
|
||||||
|
<isArch arch="arm64-v8a">
|
||||||
|
<setBool result="bSupportedArch" value="true"/>
|
||||||
|
</isArch>
|
||||||
|
|
||||||
|
<isArch arch="x86">
|
||||||
|
<setBool result="bSupportedArch" value="false"/>
|
||||||
|
</isArch>
|
||||||
|
|
||||||
|
<isArch arch="x86_64">
|
||||||
|
<setBool result="bSupportedArch" value="false"/>
|
||||||
|
</isArch>
|
||||||
|
|
||||||
|
<if condition="bSupportedArch">
|
||||||
|
<false>
|
||||||
|
<log text="SenseGloveAndroid [WARN]: this architecture is not supported!"/>
|
||||||
|
</false>
|
||||||
|
</if>
|
||||||
|
</init>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
<prebuildCopies>
|
||||||
|
<copyDir src="$S(PluginDir)/Private/Java" dst="$S(BuildDir)/src/com/senseglove/sgconnect" />
|
||||||
|
</prebuildCopies>
|
||||||
|
-->
|
||||||
|
|
||||||
|
<resourceCopies>
|
||||||
|
<isArch arch="arm64-v8a">
|
||||||
|
<if condition="Distribution">
|
||||||
|
<true>
|
||||||
|
<!--
|
||||||
|
<copyFile src="$S(PluginDir)/ThirdParty/lib/oculus/release/somelib.so"
|
||||||
|
dst="$S(BuildDir)/libs/$S(Architecture)/somelib.so" />
|
||||||
|
-->
|
||||||
|
</true>
|
||||||
|
<false>
|
||||||
|
<!--
|
||||||
|
<copyFile src="$S(PluginDir)/ThirdParty/lib/oculus/debug/somelib.so"
|
||||||
|
dst="$S(BuildDir)/libs/$S(Architecture)/somelib.so" />
|
||||||
|
-->
|
||||||
|
</false>
|
||||||
|
</if>
|
||||||
|
</isArch>
|
||||||
|
|
||||||
|
<copyFile src="$S(PluginDir)/../ThirdParty/android/sgconnect.jar" dst="$S(BuildDir)/gradle/app/libs/sgconnect.jar" />
|
||||||
|
</resourceCopies>
|
||||||
|
|
||||||
|
<gradleProperties>
|
||||||
|
<insert>
|
||||||
|
<!--android.useAndroidX=true
|
||||||
|
android.enableJetifier=true-->
|
||||||
|
kapt.incremental.apt=true
|
||||||
|
</insert>
|
||||||
|
</gradleProperties>
|
||||||
|
|
||||||
|
<proguardAdditions>
|
||||||
|
<insert>
|
||||||
|
|
||||||
|
<!-- Disable obfuscation for SenseGlove classes -->
|
||||||
|
-dontwarn com.senseglove.**
|
||||||
|
-keep class com.senseglove.** { *; }
|
||||||
|
-keep interface com.senseglove.** { *; }
|
||||||
|
-keep public class com.senseglove.sgconnect.** { public protected *; }
|
||||||
|
|
||||||
|
<!-- Disable obfuscation for AndroidX classes -->
|
||||||
|
<!---dontwarn androidx.**
|
||||||
|
-keep class androidx.** { *; }
|
||||||
|
-keep interface androidx.** { *; }-->
|
||||||
|
|
||||||
|
</insert>
|
||||||
|
</proguardAdditions>
|
||||||
|
|
||||||
|
<soLoadLibrary>
|
||||||
|
<!--
|
||||||
|
<loadLibrary name="somelib" failmsg="SenseGlove [WARN]: somelib.so library failed to load!" />
|
||||||
|
-->
|
||||||
|
</soLoadLibrary>
|
||||||
|
|
||||||
|
<androidManifestUpdates>
|
||||||
|
|
||||||
|
<!-- For target SDK 31 update the SplashActivity activity -->
|
||||||
|
<loopElements tag="activity">
|
||||||
|
<setStringFromAttribute result="activityName" tag="$" name="android:name"/>
|
||||||
|
<setBoolIsEqual result="bSplashActivity" arg1="$S(activityName)" arg2="com.epicgames.ue4.SplashActivity"/>
|
||||||
|
<if condition="bSplashActivity">
|
||||||
|
<true>
|
||||||
|
<addAttribute tag="$" name="android:exported" value="true"/>
|
||||||
|
</true>
|
||||||
|
</if>
|
||||||
|
</loopElements>
|
||||||
|
|
||||||
|
<addElements tag="application">
|
||||||
|
<!--
|
||||||
|
<addAttribute tag="application" name="android:requestSomeThingHere" value="true"/>
|
||||||
|
-->
|
||||||
|
</addElements>
|
||||||
|
|
||||||
|
<addPermission android:name="android.permission.BLUETOOTH"/>
|
||||||
|
<addPermission android:name="android.permission.BLUETOOTH_ADMIN"/>
|
||||||
|
<addPermission android:name="android.permission.ACCESS_BACKGROUND_LOCATION"/>
|
||||||
|
<addPermission android:name="android.permission.ACCESS_FINE_LOCATION"/>
|
||||||
|
|
||||||
|
</androidManifestUpdates>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
<AARImports>
|
||||||
|
<insertValue value="repository $S(PluginDir)/../../ThirdParty/android"/>
|
||||||
|
<insertNewline/>
|
||||||
|
<insertValue value="com.senseglove.sgconnect,sgconnect-android,release" />
|
||||||
|
<insertNewline/>
|
||||||
|
</AARImports>
|
||||||
|
-->
|
||||||
|
|
||||||
|
<buildGradleAdditions>
|
||||||
|
<insert>
|
||||||
|
ext {
|
||||||
|
android {
|
||||||
|
buildTypes {
|
||||||
|
release {
|
||||||
|
minifyEnabled false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
jcenter()
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation files('libs/sgconnect.jar')
|
||||||
|
}
|
||||||
|
|
||||||
|
</insert>
|
||||||
|
</buildGradleAdditions>
|
||||||
|
|
||||||
|
<baseBuildGradleAdditions>
|
||||||
|
<insert>
|
||||||
|
allprojects {
|
||||||
|
def mappings = [
|
||||||
|
]
|
||||||
|
beforeEvaluate {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</insert>
|
||||||
|
</baseBuildGradleAdditions>
|
||||||
|
|
||||||
|
<buildscriptGradleAdditions>
|
||||||
|
</buildscriptGradleAdditions>
|
||||||
|
|
||||||
|
<gradleCopies>
|
||||||
|
</gradleCopies>
|
||||||
|
|
||||||
|
<buildXmlPropertyAdditions>
|
||||||
|
</buildXmlPropertyAdditions>
|
||||||
|
|
||||||
|
<minimumSDKAPI>
|
||||||
|
</minimumSDKAPI>
|
||||||
|
|
||||||
|
<gameActivityImportAdditions>
|
||||||
|
<insert>
|
||||||
|
import com.senseglove.*;
|
||||||
|
</insert>
|
||||||
|
</gameActivityImportAdditions>
|
||||||
|
</root>
|
||||||
@@ -35,22 +35,38 @@
|
|||||||
|
|
||||||
#include "SGConnect/SGConnect.h"
|
#include "SGConnect/SGConnect.h"
|
||||||
|
|
||||||
|
#if PLATFORM_ANDROID
|
||||||
|
#include "SGAndroid/SGConnectJNI.h"
|
||||||
|
#endif /* PLATFORM_ANDROID */
|
||||||
|
|
||||||
#include "SGConnectImpl/SGExportedFunctions.h"
|
#include "SGConnectImpl/SGExportedFunctions.h"
|
||||||
#include "SGInterop/SGIC_FString.h"
|
#include "SGInterop/SGIC_FString.h"
|
||||||
|
|
||||||
int32 FSGConnect::Init()
|
int32 FSGConnect::Init()
|
||||||
{
|
{
|
||||||
|
#if ! PLATFORM_ANDROID
|
||||||
return SGConnect_Init();
|
return SGConnect_Init();
|
||||||
|
#else
|
||||||
|
return FSGConnectJNI::Init();
|
||||||
|
#endif /* ! PLATFORM_ANDROID */
|
||||||
}
|
}
|
||||||
|
|
||||||
int32 FSGConnect::Dispose()
|
int32 FSGConnect::Dispose()
|
||||||
{
|
{
|
||||||
|
#if ! PLATFORM_ANDROID
|
||||||
return SGConnect_Dispose();
|
return SGConnect_Dispose();
|
||||||
|
#else
|
||||||
|
return FSGConnectJNI::Dispose();
|
||||||
|
#endif /* ! PLATFORM_ANDROID */
|
||||||
}
|
}
|
||||||
|
|
||||||
FString FSGConnect::GetLibraryVersion()
|
FString FSGConnect::GetLibraryVersion()
|
||||||
{
|
{
|
||||||
|
#if ! PLATFORM_ANDROID
|
||||||
FSGIC_FString Container;
|
FSGIC_FString Container;
|
||||||
SGConnect_GetLibraryVersion(&Container);
|
SGConnect_GetLibraryVersion(&Container);
|
||||||
return Container.String;
|
return Container.String;
|
||||||
|
#else
|
||||||
|
return FSGConnectJNI::GetLibraryVersion();
|
||||||
|
#endif /* ! PLATFORM_ANDROID */
|
||||||
}
|
}
|
||||||
@@ -52,7 +52,7 @@ public:
|
|||||||
* -3 : An Unexpected error occured. Please try again.
|
* -3 : An Unexpected error occured. Please try again.
|
||||||
* -2 : Device Scanning is already running within a different program.
|
* -2 : Device Scanning is already running within a different program.
|
||||||
* -1 : Device Scanning already being initialized (function called twice in short succession).
|
* -1 : Device Scanning already being initialized (function called twice in short succession).
|
||||||
* 0 : Device Scanning is already running in within this program.
|
* 0 : Device Scanning is already running within this program.
|
||||||
* 1 : Successfully started up DeviceScanning from the current program.
|
* 1 : Successfully started up DeviceScanning from the current program.
|
||||||
*/
|
*/
|
||||||
static int32 Init();
|
static int32 Init();
|
||||||
|
|||||||
@@ -59,5 +59,15 @@ public class SenseGloveConnect : ModuleRules
|
|||||||
"SenseGloveTypes",
|
"SenseGloveTypes",
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (Target.Platform == UnrealTargetPlatform.Android)
|
||||||
|
{
|
||||||
|
PrivateDependencyModuleNames.AddRange(
|
||||||
|
new string[]
|
||||||
|
{
|
||||||
|
"SenseGloveAndroid",
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,7 +34,9 @@
|
|||||||
|
|
||||||
|
|
||||||
#include "SGConnectImpl/SGConnectImpl.h"
|
#include "SGConnectImpl/SGConnectImpl.h"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "SGBuildHacks/SGInclude_Connect_SGConnect.h"
|
#include "SGBuildHacks/SGInclude_Connect_SGConnect.h"
|
||||||
|
|
||||||
int32 FSGConnectImpl::Init()
|
int32 FSGConnectImpl::Init()
|
||||||
@@ -49,7 +51,7 @@ int32 FSGConnectImpl::Dispose()
|
|||||||
|
|
||||||
FString FSGConnectImpl::GetLibraryVersion()
|
FString FSGConnectImpl::GetLibraryVersion()
|
||||||
{
|
{
|
||||||
std::string version;
|
std::string Version;
|
||||||
SGConnect::GetLibraryVersion(&version);
|
SGConnect::GetLibraryVersion(&Version);
|
||||||
return UTF8_TO_TCHAR(version.c_str());
|
return UTF8_TO_TCHAR(Version.c_str());
|
||||||
}
|
}
|
||||||
BIN
Binary file not shown.
Reference in New Issue
Block a user