From 06c2ee6170c5e0aafcba06cebf2c79311edea13a Mon Sep 17 00:00:00 2001 From: Mamadou Babaei Date: Thu, 2 Feb 2023 21:35:33 +0100 Subject: [PATCH] bump sgconnect and sgcore to v2.1.0-9080621 and add an almost functional android implementation --- .../Private/SGAndroid/SGConnectJNI.cpp | 120 +++++++++++++++ .../Private/SGAndroid/SGCoreJNI.cpp | 138 ++++++++++++++++++ .../Private/SenseGloveAndroidModule.cpp | 42 ++---- .../Public/SGAndroid/SGConnectJNI.h | 49 +++++++ .../Public/SGAndroid/SGCoreJNI.h | 49 +++++++ .../SGConnectImpl/SGExportedFunctions.cpp | 19 ++- .../SGConnectImpl/SGExportedFunctions.h | 7 +- .../SGCoreImpl/SGExportedFunctions.cpp | 22 ++- .../Public/SGCoreImpl/SGExportedFunctions.h | 8 +- .../Private/SGInterop/SGIC_jclass.cpp | 36 +++++ .../Private/SGInterop/SGIC_jmethodID.cpp | 36 +++++ .../Public/SGInterop/SGIC_jclass.h | 45 ++++++ .../Public/SGInterop/SGIC_jmethodID.h | 45 ++++++ .../include/SenseGlove/Connect/Android.hpp | 4 +- .../include/SenseGlove/Core/Android.hpp | 4 +- .../lib/linux/v19/debug/libsgconnect.a | 2 +- .../lib/linux/v19/debug/libsgcore.a | 4 +- .../lib/linux/v19/release/libsgconnect.a | 2 +- .../lib/linux/v19/release/libsgcore.a | 2 +- .../lib/linux/v20/debug/libsgconnect.a | 2 +- .../lib/linux/v20/debug/libsgcore.a | 4 +- .../lib/linux/v20/release/libsgconnect.a | 2 +- .../lib/linux/v20/release/libsgcore.a | 4 +- .../lib/oculus/debug/libsgconnect.a | 4 +- .../ThirdParty/lib/oculus/debug/libsgcore.a | 4 +- .../lib/oculus/release/libsgconnect.a | 4 +- .../ThirdParty/lib/oculus/release/libsgcore.a | 4 +- 27 files changed, 600 insertions(+), 62 deletions(-) create mode 100644 Source/SenseGloveAndroid/Private/SGAndroid/SGConnectJNI.cpp create mode 100644 Source/SenseGloveAndroid/Private/SGAndroid/SGCoreJNI.cpp create mode 100644 Source/SenseGloveAndroid/Public/SGAndroid/SGConnectJNI.h create mode 100644 Source/SenseGloveAndroid/Public/SGAndroid/SGCoreJNI.h create mode 100644 Source/SenseGloveInterop/Private/SGInterop/SGIC_jclass.cpp create mode 100644 Source/SenseGloveInterop/Private/SGInterop/SGIC_jmethodID.cpp create mode 100644 Source/SenseGloveInterop/Public/SGInterop/SGIC_jclass.h create mode 100644 Source/SenseGloveInterop/Public/SGInterop/SGIC_jmethodID.h diff --git a/Source/SenseGloveAndroid/Private/SGAndroid/SGConnectJNI.cpp b/Source/SenseGloveAndroid/Private/SGAndroid/SGConnectJNI.cpp new file mode 100644 index 00000000..fe57460d --- /dev/null +++ b/Source/SenseGloveAndroid/Private/SGAndroid/SGConnectJNI.cpp @@ -0,0 +1,120 @@ +/** + * @file + * + * @author Mamadou Babaei + * + * @section LICENSE + * + * (The MIT License) + * + * Copyright (c) 2020 - 2023 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 */ + +#if PLATFORM_ANDROID +#include "SGConnectImpl/SGExportedFunctions.h" +#include "SGInterop/SGIC_jclass.h" +#include "SGInterop/SGIC_jmethodID.h" +#include "SGInterop/SGIC_JNIEnv_Ptr.h" +#endif /* PLATFORM_ANDROID */ + +int32 FSGConnectJNI::Initialize() +{ + int32 Result = -999999; + +#if PLATFORM_ANDROID + static constexpr char SGCONNECT_JAVA_CLASS_NAME[] = "com.senseglove.sgconnect.SGConnect"; + + SGLOG("FSGCoreJNI: attempting to get the Android JNI environment..."); + + JNIEnv* Env = FAndroidApplication::GetJavaEnv(); + FAndroidApplication::CheckJavaException(); + if (!Env) + { + SGLOG_ERROR("FSGCoreJNI: failed to get the Android JNI environmnet!"); + return -1999999; + } + FSGIC_JNIEnv_Ptr InEnvContainer{Env}; + + SGLOG("FSGCoreJNI: attempting to find the Android Java class..."); + + jclass Class = FAndroidApplication::FindJavaClass(SGCONNECT_JAVA_CLASS_NAME); + FAndroidApplication::CheckJavaException(); + if (Env->IsSameObject(Class, nullptr)) + { + SGLOG_ERROR("FSGCoreJNI: failed to get the Android Java class!"); + return -2999999; + } + Class = (jclass)Env->NewGlobalRef(Class); + FSGIC_jclass InClassContainer{Class}; + + SGLOG("FSGCoreJNI: attempting to find the Android JNI method 'Init'..."); + + jmethodID InitMethodID = Env->GetStaticMethodID(Class, "Init", "()I"); + FAndroidApplication::CheckJavaException(); + if (!InitMethodID) + { + SGLOG_ERROR("FSGCoreJNI: failed to get the Android JNI method 'Init'!"); + return -3999999; + } + FSGIC_jmethodID InInitMethodIDContainer{InitMethodID}; + + SGLOG("FSGCoreJNI: attempting to find the Android JNI method 'Dispose'..."); + + jmethodID DisposeMethodID = Env->GetStaticMethodID(Class, "Dispose", "()I"); + FAndroidApplication::CheckJavaException(); + if (!DisposeMethodID) + { + SGLOG_ERROR("FSGCoreJNI: failed to get the Android JNI method 'Dispose'!"); + return -4999999; + } + FSGIC_jmethodID InDisposeMethodIDContainer{DisposeMethodID}; + + SGLOG("FSGCoreJNI: attempting to find the Android JNI method 'GetLibraryVersion'..."); + + jmethodID GetLibraryVersionMethodID = Env->GetStaticMethodID(Class, "GetLibraryVersion", "()Ljava/lang/String;"); + FAndroidApplication::CheckJavaException(); + if (!GetLibraryVersionMethodID) + { + SGLOG_ERROR("FSGCoreJNI: failed to get the Android JNI method 'GetLibraryVersion'!"); + return -5999999; + } + FSGIC_jmethodID InGetLibraryVersionMethodIDContainer{GetLibraryVersionMethodID}; + + Result = SGConnectImpl_Android_Initialize(&InEnvContainer, &InClassContainer, + &InInitMethodIDContainer, + &InDisposeMethodIDContainer, + &InGetLibraryVersionMethodIDContainer); +#endif /* PLATFORM_ANDROID */ + + return Result; +} \ No newline at end of file diff --git a/Source/SenseGloveAndroid/Private/SGAndroid/SGCoreJNI.cpp b/Source/SenseGloveAndroid/Private/SGAndroid/SGCoreJNI.cpp new file mode 100644 index 00000000..408259a5 --- /dev/null +++ b/Source/SenseGloveAndroid/Private/SGAndroid/SGCoreJNI.cpp @@ -0,0 +1,138 @@ +/** + * @file + * + * @author Mamadou Babaei + * + * @section LICENSE + * + * (The MIT License) + * + * Copyright (c) 2020 - 2023 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/SGCoreJNI.h" + +#if PLATFORM_ANDROID +#include "Android/AndroidApplication.h" +#include "Android/AndroidJava.h" +#endif /* PLATFORM_ANDROID */ + +#if PLATFORM_ANDROID +#include "SGCoreImpl/SGExportedFunctions.h" +#include "SGInterop/SGIC_jclass.h" +#include "SGInterop/SGIC_jmethodID.h" +#include "SGInterop/SGIC_JNIEnv_Ptr.h" +#endif /* PLATFORM_ANDROID */ + +#include "SGLog/SGLog.h" + +int32 FSGCoreJNI::Initialize() +{ + int32 Result = -999999; + +#if PLATFORM_ANDROID + static constexpr char SGCONNECT_JAVA_CLASS_NAME[] = "com.senseglove.sgconnect.SGConnect"; + + SGLOG("FSGCoreJNI: attempting to get the Android JNI environment..."); + + JNIEnv* Env = FAndroidApplication::GetJavaEnv(); + FAndroidApplication::CheckJavaException(); + if (!Env) + { + SGLOG_ERROR("FSGCoreJNI: failed to get the Android JNI environmnet!"); + return -1999999; + } + FSGIC_JNIEnv_Ptr InEnvContainer{Env}; + + SGLOG("FSGCoreJNI: attempting to find the Android Java class..."); + + jclass Class = FAndroidApplication::FindJavaClass(SGCONNECT_JAVA_CLASS_NAME); + FAndroidApplication::CheckJavaException(); + if (Env->IsSameObject(Class, nullptr)) + { + SGLOG_ERROR("FSGCoreJNI: failed to get the Android Java class!"); + return -2999999; + } + Class = (jclass)Env->NewGlobalRef(Class); + FSGIC_jclass InClassContainer{Class}; + + SGLOG("FSGCoreJNI: attempting to find the Android JNI method 'ActiveDevices'..."); + + jmethodID ActiveDevicesMethodID = Env->GetStaticMethodID(Class, "ActiveDevices", "()I"); + FAndroidApplication::CheckJavaException(); + if (!ActiveDevicesMethodID) + { + SGLOG_ERROR("FSGCoreJNI: failed to get the Android JNI method 'ActiveDevices'!"); + return -3999999; + } + FSGIC_jmethodID InActiveDevicesMethodIDContainer{ActiveDevicesMethodID}; + + SGLOG("FSGCoreJNI: attempting to find the Android JNI method 'GetDeviceString'..."); + + jmethodID GetDeviceStringMethodID = Env->GetStaticMethodID(Class, "GetDeviceString", "(I)Ljava/lang/String;"); + FAndroidApplication::CheckJavaException(); + if (!GetDeviceStringMethodID) + { + SGLOG_ERROR("FSGCoreJNI: failed to get the Android JNI method 'GetDeviceString'!"); + return -4999999; + } + FSGIC_jmethodID InGetDeviceStringMethodIDContainer{GetDeviceStringMethodID}; + + SGLOG("FSGCoreJNI: attempting to find the Android JNI method 'GetSensorString'..."); + + jmethodID GetSensorStringMethodID = Env->GetStaticMethodID(Class, "GetSensorString", "(I)Ljava/lang/String;"); + FAndroidApplication::CheckJavaException(); + if (!GetSensorStringMethodID) + { + SGLOG_ERROR("FSGCoreJNI: failed to get the Android JNI method 'GetSensorString'!"); + return -5999999; + } + FSGIC_jmethodID InGetSensorStringMethodIDContainer{GetSensorStringMethodID}; + + SGLOG("FSGCoreJNI: attempting to find the Android JNI method 'WriteHaptics'..."); + + // FIXME + // Trying to find WriteHaptics causes crash in the C++ core libraries + // Temporarily we pass another method instead + //jmethodID WriteHapticsMethodID = Env->GetStaticMethodID(Class, "WriteHaptics", "(ILjava/lang/String;)I"); + jmethodID WriteHapticsMethodID = Env->GetStaticMethodID(Class, "GetSensorString", "(I)Ljava/lang/String;"); + FAndroidApplication::CheckJavaException(); + if (!WriteHapticsMethodID) + { + SGLOG_ERROR("FSGCoreJNI: failed to get the Android JNI method 'WriteHaptics'!"); + return -6999999; + } + FSGIC_jmethodID InWriteHapticsMethodIDContainer{WriteHapticsMethodID}; + + Result = SGCoreImpl_Android_Initialize(&InEnvContainer, &InClassContainer, + &InActiveDevicesMethodIDContainer, + &InGetDeviceStringMethodIDContainer, + &InGetSensorStringMethodIDContainer, + &InWriteHapticsMethodIDContainer); +#endif /* PLATFORM_ANDROID */ + + return Result; +} diff --git a/Source/SenseGloveAndroid/Private/SenseGloveAndroidModule.cpp b/Source/SenseGloveAndroid/Private/SenseGloveAndroidModule.cpp index f6a8d281..957bd753 100644 --- a/Source/SenseGloveAndroid/Private/SenseGloveAndroidModule.cpp +++ b/Source/SenseGloveAndroid/Private/SenseGloveAndroidModule.cpp @@ -35,17 +35,8 @@ #include "SenseGloveAndroidModule.h" -#if PLATFORM_ANDROID -#include "Android/AndroidApplication.h" -#include "Android/AndroidJava.h" -#endif /* PLATFORM_ANDROID */ - -#if PLATFORM_ANDROID -#include "SGConnectImpl/SGExportedFunctions.h" -#include "SGCoreImpl/SGExportedFunctions.h" -#include "SGInterop/SGIC_JNIEnv_Ptr.h" -#endif /* PLATFORM_ANDROID */ - +#include "SGAndroid/SGConnectJNI.h" +#include "SGAndroid/SGCoreJNI.h" #include "SGLog/SGLog.h" #define LOCTEXT_NAMESPACE "FSenseGloveAndroidModule" @@ -55,29 +46,14 @@ void FSenseGloveAndroidModule::StartupModule() SGLOG("Starting up SenseGloveAndroid module..."); #if PLATFORM_ANDROID - JNIEnv* Env = FAndroidApplication::GetJavaEnv(); - if (!Env) - { - SGLOG_ERROR("Failed to get the Android JNI environmnet!"); - return; - } + const int32 R1 = FSGConnectJNI::Initialize(); + const int32 R2 = FSGCoreJNI::Initialize(); - FSGIC_JNIEnv_Ptr EnvContainer{Env}; + ensureAlwaysMsgf(R1 == 0, + TEXT("Failed to initialize the SGConnect JNI bridge to SGConnect for Android! Status Code: %d"), R1); - /*ensureAlwaysMsgf(SGConnectImpl_Android_Initialize(&EnvContainer), - TEXT("Failed to initialize the SGConnect JNI bridge to SGConnect for Android!")); - - ensureAlwaysMsgf(SGCoreImpl_Android_Initialize(&EnvContainer), - TEXT("Failed to initialize the SGCore JNI bridge to SGConnect for Android!"));*/ - - const int32 r1 = SGConnectImpl_Android_Initialize(&EnvContainer); - const int32 r2 = SGCoreImpl_Android_Initialize(&EnvContainer); - - ensureAlwaysMsgf(r1 == 0, - TEXT("Failed to initialize the SGConnect JNI bridge to SGConnect for Android! Status Code: %d"), r1); - - ensureAlwaysMsgf(r2 == 0, - TEXT("Failed to initialize the SGCore JNI bridge to SGConnect for Android! Status Code: %d"), r1); + ensureAlwaysMsgf(R2 == 0, + TEXT("Failed to initialize the SGCore JNI bridge to SGConnect for Android! Status Code: %d"), R2); #endif /* PLATFORM_ANDROID */ } @@ -88,7 +64,7 @@ void FSenseGloveAndroidModule::PreUnloadCallback() void FSenseGloveAndroidModule::PostLoadCallback() { - SGLOG("Loading of SenseGloveAndroid module has succeeded!"); + SGLOG("Loading SenseGloveAndroid module has succeeded!"); } void FSenseGloveAndroidModule::ShutdownModule() diff --git a/Source/SenseGloveAndroid/Public/SGAndroid/SGConnectJNI.h b/Source/SenseGloveAndroid/Public/SGAndroid/SGConnectJNI.h new file mode 100644 index 00000000..d51cea76 --- /dev/null +++ b/Source/SenseGloveAndroid/Public/SGAndroid/SGConnectJNI.h @@ -0,0 +1,49 @@ +/** + * @file + * + * @author Mamadou Babaei + * + * @section LICENSE + * + * (The MIT License) + * + * Copyright (c) 2020 - 2023 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 Initialize(); +}; \ No newline at end of file diff --git a/Source/SenseGloveAndroid/Public/SGAndroid/SGCoreJNI.h b/Source/SenseGloveAndroid/Public/SGAndroid/SGCoreJNI.h new file mode 100644 index 00000000..cb8dd3e4 --- /dev/null +++ b/Source/SenseGloveAndroid/Public/SGAndroid/SGCoreJNI.h @@ -0,0 +1,49 @@ +/** + * @file + * + * @author Mamadou Babaei + * + * @section LICENSE + * + * (The MIT License) + * + * Copyright (c) 2020 - 2023 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 "SGCoreJNI.generated.h" + +USTRUCT() +struct SENSEGLOVEANDROID_API FSGCoreJNI +{ + GENERATED_BODY() + +public: + static int32 Initialize(); +}; \ No newline at end of file diff --git a/Source/SenseGloveConnectImpl/Private/SGConnectImpl/SGExportedFunctions.cpp b/Source/SenseGloveConnectImpl/Private/SGConnectImpl/SGExportedFunctions.cpp index a90e04dd..85a18d00 100644 --- a/Source/SenseGloveConnectImpl/Private/SGConnectImpl/SGExportedFunctions.cpp +++ b/Source/SenseGloveConnectImpl/Private/SGConnectImpl/SGExportedFunctions.cpp @@ -43,16 +43,31 @@ #include "SGConnectImpl/SGConnectImpl.h" #include "SGInterop/SGIC_FString.h" + +#if PLATFORM_ANDROID +#include "SGInterop/SGIC_jclass.h" +#include "SGInterop/SGIC_jmethodID.h" #include "SGInterop/SGIC_JNIEnv_Ptr.h" +#endif /* PLATFORM_ANDROID */ /******************************************************************************* * Exceptional function calls ******************************************************************************/ #if PLATFORM_ANDROID -int32 SGConnectImpl_Android_Initialize(void* Env) +int32 SGConnectImpl_Android_Initialize( + void* InEnv, + void* InClass, + void* InInitMethodID, + void* InDisposeMethodID, + void* InGetLibraryVersionMethodID) { - return SGConnect::Android::Initialize(StaticCast(Env)->Ptr); + return SGConnect::Android::Initialize( + StaticCast(InEnv)->Ptr, + StaticCast(InClass)->Class, + StaticCast(InInitMethodID)->MethodID, + StaticCast(InDisposeMethodID)->MethodID, + StaticCast(InGetLibraryVersionMethodID)->MethodID); } #endif /* PLATFORM_ANDROID */ diff --git a/Source/SenseGloveConnectImpl/Public/SGConnectImpl/SGExportedFunctions.h b/Source/SenseGloveConnectImpl/Public/SGConnectImpl/SGExportedFunctions.h index 81031196..8e88a5bc 100644 --- a/Source/SenseGloveConnectImpl/Public/SGConnectImpl/SGExportedFunctions.h +++ b/Source/SenseGloveConnectImpl/Public/SGConnectImpl/SGExportedFunctions.h @@ -69,7 +69,12 @@ extern "C" { ******************************************************************************/ #if PLATFORM_ANDROID -SENSEGLOVECONNECTIMPL_PUBLIC_API int32 SGConnectImpl_Android_Initialize(void* Env); +SENSEGLOVECONNECTIMPL_PUBLIC_API int32 SGConnectImpl_Android_Initialize( + void* InEnv, + void* InClass, + void* InInitMethodID, + void* InDisposeMethodID, + void* InGetLibraryVersionMethodID); #endif /* PLATFORM_ANDROID */ /******************************************************************************* diff --git a/Source/SenseGloveCoreImpl/Private/SGCoreImpl/SGExportedFunctions.cpp b/Source/SenseGloveCoreImpl/Private/SGCoreImpl/SGExportedFunctions.cpp index 8b16e3cf..5c353a2a 100644 --- a/Source/SenseGloveCoreImpl/Private/SGCoreImpl/SGExportedFunctions.cpp +++ b/Source/SenseGloveCoreImpl/Private/SGCoreImpl/SGExportedFunctions.cpp @@ -107,7 +107,13 @@ #include "SGInterop/SGIC_FString.h" #include "SGInterop/SGIC_FVector.h" #include "SGInterop/SGIC_int32_Ref.h" + +#if PLATFORM_ANDROID +#include "SGInterop/SGIC_jclass.h" +#include "SGInterop/SGIC_jmethodID.h" #include "SGInterop/SGIC_JNIEnv_Ptr.h" +#endif /* PLATFORM_ANDROID */ + #include "SGInterop/SGIC_TArray_bool.h" #include "SGInterop/SGIC_TArray_FSGCalibrationDataPointImpl.h" #include "SGInterop/SGIC_TArray_float.h" @@ -142,9 +148,21 @@ ******************************************************************************/ #if PLATFORM_ANDROID -int32 SGCoreImpl_Android_Initialize(void* Env) +int32 SGCoreImpl_Android_Initialize( + void* InEnv, + void* InClass, + void* InActiveDevicesMethodID, + void* InGetDeviceStringMethodID, + void* InGetSensorStringMethodID, + void* InWriteHapticsMethodID) { - return SGCore::Android::Initialize(StaticCast(Env)->Ptr); + return SGCore::Android::Initialize( + StaticCast(InEnv)->Ptr, + StaticCast(InClass)->Class, + StaticCast(InActiveDevicesMethodID)->MethodID, + StaticCast(InGetDeviceStringMethodID)->MethodID, + StaticCast(InGetSensorStringMethodID)->MethodID, + StaticCast(InWriteHapticsMethodID)->MethodID); } #endif /* PLATFORM_ANDROID */ diff --git a/Source/SenseGloveCoreImpl/Public/SGCoreImpl/SGExportedFunctions.h b/Source/SenseGloveCoreImpl/Public/SGCoreImpl/SGExportedFunctions.h index e707ed43..b0154d49 100644 --- a/Source/SenseGloveCoreImpl/Public/SGCoreImpl/SGExportedFunctions.h +++ b/Source/SenseGloveCoreImpl/Public/SGCoreImpl/SGExportedFunctions.h @@ -69,7 +69,13 @@ extern "C" { ******************************************************************************/ #if PLATFORM_ANDROID -SENSEGLOVECOREIMPL_PUBLIC_API int32 SGCoreImpl_Android_Initialize(void* Env); +SENSEGLOVECOREIMPL_PUBLIC_API int32 SGCoreImpl_Android_Initialize( + void* InEnv, + void* InClass, + void* InActiveDevicesMethodID, + void* InGetDeviceStringMethodID, + void* InGetSensorStringMethodID, + void* InWriteHapticsMethodID); #endif /* PLATFORM_ANDROID */ /******************************************************************************* diff --git a/Source/SenseGloveInterop/Private/SGInterop/SGIC_jclass.cpp b/Source/SenseGloveInterop/Private/SGInterop/SGIC_jclass.cpp new file mode 100644 index 00000000..c7b788d4 --- /dev/null +++ b/Source/SenseGloveInterop/Private/SGInterop/SGIC_jclass.cpp @@ -0,0 +1,36 @@ +/** + * @file + * + * @author Mamadou Babaei + * + * @section LICENSE + * + * (The MIT License) + * + * Copyright (c) 2020 - 2023 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 "SGInterop/SGIC_jclass.h" \ No newline at end of file diff --git a/Source/SenseGloveInterop/Private/SGInterop/SGIC_jmethodID.cpp b/Source/SenseGloveInterop/Private/SGInterop/SGIC_jmethodID.cpp new file mode 100644 index 00000000..302ed0b1 --- /dev/null +++ b/Source/SenseGloveInterop/Private/SGInterop/SGIC_jmethodID.cpp @@ -0,0 +1,36 @@ +/** + * @file + * + * @author Mamadou Babaei + * + * @section LICENSE + * + * (The MIT License) + * + * Copyright (c) 2020 - 2023 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 "SGInterop/SGIC_jmethodID.h" \ No newline at end of file diff --git a/Source/SenseGloveInterop/Public/SGInterop/SGIC_jclass.h b/Source/SenseGloveInterop/Public/SGInterop/SGIC_jclass.h new file mode 100644 index 00000000..0e927aec --- /dev/null +++ b/Source/SenseGloveInterop/Public/SGInterop/SGIC_jclass.h @@ -0,0 +1,45 @@ +/** + * @file + * + * @author Mamadou Babaei + * + * @section LICENSE + * + * (The MIT License) + * + * Copyright (c) 2020 - 2023 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 + +#if PLATFORM_ANDROID +#include "Android/AndroidJavaEnv.h" + +struct FSGIC_jclass +{ + jclass Class; +}; +#endif /* PLATFORM_ANDROID */ \ No newline at end of file diff --git a/Source/SenseGloveInterop/Public/SGInterop/SGIC_jmethodID.h b/Source/SenseGloveInterop/Public/SGInterop/SGIC_jmethodID.h new file mode 100644 index 00000000..18d7f0d4 --- /dev/null +++ b/Source/SenseGloveInterop/Public/SGInterop/SGIC_jmethodID.h @@ -0,0 +1,45 @@ +/** + * @file + * + * @author Mamadou Babaei + * + * @section LICENSE + * + * (The MIT License) + * + * Copyright (c) 2020 - 2023 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 + +#if PLATFORM_ANDROID +#include "Android/AndroidJavaEnv.h" + +struct FSGIC_jmethodID +{ + jmethodID MethodID; +}; +#endif /* PLATFORM_ANDROID */ \ No newline at end of file diff --git a/Source/ThirdParty/include/SenseGlove/Connect/Android.hpp b/Source/ThirdParty/include/SenseGlove/Connect/Android.hpp index e14e8fdd..11a67292 100644 --- a/Source/ThirdParty/include/SenseGlove/Connect/Android.hpp +++ b/Source/ThirdParty/include/SenseGlove/Connect/Android.hpp @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7ed1009a6062c22f757cd05a5eed79d9744a1160435635a940b458ec7eb1a6a7 -size 925 +oid sha256:bbe9c4ee067b6f72b114b25eac7ef8e6e38419765fe35df7d7655f43b4d93c54 +size 1167 diff --git a/Source/ThirdParty/include/SenseGlove/Core/Android.hpp b/Source/ThirdParty/include/SenseGlove/Core/Android.hpp index 998f5427..be268c08 100644 --- a/Source/ThirdParty/include/SenseGlove/Core/Android.hpp +++ b/Source/ThirdParty/include/SenseGlove/Core/Android.hpp @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:12766c3197957199fd23acb4961847feb3aab456625a2119808784a9da0f8b28 -size 1342 +oid sha256:3dad286d7af9d74e9e92c2be501fe307ddfee0fdcb870ffe773bfa3ac1210cd1 +size 1673 diff --git a/Source/ThirdParty/lib/linux/v19/debug/libsgconnect.a b/Source/ThirdParty/lib/linux/v19/debug/libsgconnect.a index 4fa5fdaf..e0c3b6c6 100644 --- a/Source/ThirdParty/lib/linux/v19/debug/libsgconnect.a +++ b/Source/ThirdParty/lib/linux/v19/debug/libsgconnect.a @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:091e079685e4ee25423f5f110fd2cd33993f18bb91e011f6ba4973a0cd54e624 +oid sha256:1df443490aadbfef4d8993f15c024a0d5ca0eda0a825995479d5979108a59919 size 7460082 diff --git a/Source/ThirdParty/lib/linux/v19/debug/libsgcore.a b/Source/ThirdParty/lib/linux/v19/debug/libsgcore.a index 2b70a673..617fb95e 100644 --- a/Source/ThirdParty/lib/linux/v19/debug/libsgcore.a +++ b/Source/ThirdParty/lib/linux/v19/debug/libsgcore.a @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b227d92adc294e7c92a0a014e3d7cfdb64610e53a0f58cf081fe19a6fa8e71fe -size 12940358 +oid sha256:0d41be3aaab45f8f3dab8846bbf324c4c69e318d2bb4e678d7e91871fd193994 +size 12940350 diff --git a/Source/ThirdParty/lib/linux/v19/release/libsgconnect.a b/Source/ThirdParty/lib/linux/v19/release/libsgconnect.a index c29ab95d..24b1be62 100644 --- a/Source/ThirdParty/lib/linux/v19/release/libsgconnect.a +++ b/Source/ThirdParty/lib/linux/v19/release/libsgconnect.a @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c7f24fec619cfffb52dba5bc273a0cc64ffe632ef66c3256c9bf471710cc1e2e +oid sha256:10b887db844b94855f0b895d5bfe6e454b9422a4fcc8b97300b58c7b4e462ae0 size 903838 diff --git a/Source/ThirdParty/lib/linux/v19/release/libsgcore.a b/Source/ThirdParty/lib/linux/v19/release/libsgcore.a index 0a378b0a..09105ab8 100644 --- a/Source/ThirdParty/lib/linux/v19/release/libsgcore.a +++ b/Source/ThirdParty/lib/linux/v19/release/libsgcore.a @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:bd6092238027755781921e9cc892879a0431bc0b98d7402f85053c459ac179dd +oid sha256:e161520965acfe845bbf5a9a18dd0cd0bc97c0ad11aaefed4074833da09c73d3 size 1544572 diff --git a/Source/ThirdParty/lib/linux/v20/debug/libsgconnect.a b/Source/ThirdParty/lib/linux/v20/debug/libsgconnect.a index 4757272b..88a57661 100644 --- a/Source/ThirdParty/lib/linux/v20/debug/libsgconnect.a +++ b/Source/ThirdParty/lib/linux/v20/debug/libsgconnect.a @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8f94e0d7e00ae7eaf868fec35030af5d71790e232a6f993649366ff9857ac56a +oid sha256:4efb46996ac7465117e2cb7ce6e1a36025583bbf151ba54e6b9904c60b7ad85e size 7379754 diff --git a/Source/ThirdParty/lib/linux/v20/debug/libsgcore.a b/Source/ThirdParty/lib/linux/v20/debug/libsgcore.a index ef7f3ff2..63dc4bfa 100644 --- a/Source/ThirdParty/lib/linux/v20/debug/libsgcore.a +++ b/Source/ThirdParty/lib/linux/v20/debug/libsgcore.a @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f2428091c556e87ea2ed9bdf3c3ff5520fafeb84539e056e127d97493642dca4 -size 12578694 +oid sha256:141990e28ce2189cef684a8595050a2bf2bc4f9419d899b2eb73bfb682f76591 +size 12578686 diff --git a/Source/ThirdParty/lib/linux/v20/release/libsgconnect.a b/Source/ThirdParty/lib/linux/v20/release/libsgconnect.a index 25e87a65..097e48bd 100644 --- a/Source/ThirdParty/lib/linux/v20/release/libsgconnect.a +++ b/Source/ThirdParty/lib/linux/v20/release/libsgconnect.a @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:50784d96ad7993cefd1ba1725a362c397e01e50776b78884ee59c71d0544d7c6 +oid sha256:4aa1cb9842b14af59be661e067bfe608f9776fccd6c57bf2c9b0c0c112dcd340 size 994668 diff --git a/Source/ThirdParty/lib/linux/v20/release/libsgcore.a b/Source/ThirdParty/lib/linux/v20/release/libsgcore.a index 7154ee95..91ab53e9 100644 --- a/Source/ThirdParty/lib/linux/v20/release/libsgcore.a +++ b/Source/ThirdParty/lib/linux/v20/release/libsgcore.a @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:76f1a26f7f9a4ad818ba85fea378f8eb28041d39d89cb0ad74f09f8281c57222 -size 1691368 +oid sha256:ae77ba6851c5904c6aa2e4eff3bb3b608262f29db9196639a5df12bce143ca77 +size 1691360 diff --git a/Source/ThirdParty/lib/oculus/debug/libsgconnect.a b/Source/ThirdParty/lib/oculus/debug/libsgconnect.a index f7cd2efd..a68c20da 100644 --- a/Source/ThirdParty/lib/oculus/debug/libsgconnect.a +++ b/Source/ThirdParty/lib/oculus/debug/libsgconnect.a @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:721769cdebb10298b92a55491ffad607a5c70fd78e0d76ef03708ff4b9cf6418 -size 8007120 +oid sha256:7aab1ce9fa6df3780ee5f17ccf2efe20ec73be887c2cc2cff6b93762563d63fa +size 8011980 diff --git a/Source/ThirdParty/lib/oculus/debug/libsgcore.a b/Source/ThirdParty/lib/oculus/debug/libsgcore.a index e6d649d1..60323af1 100644 --- a/Source/ThirdParty/lib/oculus/debug/libsgcore.a +++ b/Source/ThirdParty/lib/oculus/debug/libsgcore.a @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:99388ae7ee923f9063ab8b82d6ca72ca883f72d44e27c2f368db2a497ea9fcf7 -size 14042960 +oid sha256:c64c251ca9fd10abcbe39f37a30926a340993bb1385aefb1f61091b136d27f21 +size 14048790 diff --git a/Source/ThirdParty/lib/oculus/release/libsgconnect.a b/Source/ThirdParty/lib/oculus/release/libsgconnect.a index 24ee30d0..5dceeb8d 100644 --- a/Source/ThirdParty/lib/oculus/release/libsgconnect.a +++ b/Source/ThirdParty/lib/oculus/release/libsgconnect.a @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:46368334283c7af66a7d56e6f4e16dbf50d19840e052746fa94f29fef9449264 -size 995544 +oid sha256:844467f411fd3cac6427c88cf133f535de4e9f0d8b8b08559dea6860d0ba442b +size 999780 diff --git a/Source/ThirdParty/lib/oculus/release/libsgcore.a b/Source/ThirdParty/lib/oculus/release/libsgcore.a index 4fd7f608..bef9a4e4 100644 --- a/Source/ThirdParty/lib/oculus/release/libsgcore.a +++ b/Source/ThirdParty/lib/oculus/release/libsgcore.a @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9a04e170c49213757b43a4baeddb069ed8c3034a2dc6bde2d105fe720c4ea2d1 -size 1426426 +oid sha256:fd4b6809e993d5762e1d5157ad9efbf3814020d46aa4c6a70fe65b0dcb8f7989 +size 1431562