revamp android backend initialization error handling and bump the senseglove libraries to the latest experimental ble builds

This commit is contained in:
Mamadou Babaei
2025-05-09 16:36:03 +02:00
parent b6ca5015a9
commit cbe193e547
72 changed files with 135 additions and 111 deletions
@@ -137,7 +137,7 @@ void USGAndroidPermissions::OnPermissionsGranted(const TArray<FString>& Permissi
return;
}
for (int32 i = 0; i < Permissions.Num(); i++)
for (int32 i = 0; i < Permissions.Num(); ++i)
{
if (GrantResults[i])
{
@@ -54,7 +54,7 @@
int32 FSGConnectJNI::Initialize()
{
int32 Result = -999999;
int32 Result = -1000;
#if PLATFORM_ANDROID
static constexpr char SGCONNECT_JAVA_CLASS_NAME[] = "com.senseglove.sgconnect.SGConnect";
@@ -66,7 +66,7 @@ int32 FSGConnectJNI::Initialize()
if (!Env)
{
SGLOG_ERROR("FSGCoreJNI: failed to get the Android JNI environmnet!");
return -1999999;
return -1001;
}
FSGIC_JNIEnv_Ptr InEnvContainer{Env};
@@ -77,7 +77,7 @@ int32 FSGConnectJNI::Initialize()
if (Env->IsSameObject(Class, nullptr))
{
SGLOG_ERROR("FSGCoreJNI: failed to get the Android Java class!");
return -2999999;
return -1002;
}
Class = (jclass)Env->NewGlobalRef(Class);
FSGIC_jclass InClassContainer{Class};
@@ -89,7 +89,7 @@ int32 FSGConnectJNI::Initialize()
if (!InitMethodID)
{
SGLOG_ERROR("FSGCoreJNI: failed to get the Android JNI method 'Init'!");
return -3999999;
return -1003;
}
FSGIC_jmethodID InInitMethodIDContainer{InitMethodID};
@@ -100,7 +100,7 @@ int32 FSGConnectJNI::Initialize()
if (!DisposeMethodID)
{
SGLOG_ERROR("FSGCoreJNI: failed to get the Android JNI method 'Dispose'!");
return -4999999;
return -1004;
}
FSGIC_jmethodID InDisposeMethodIDContainer{DisposeMethodID};
@@ -111,7 +111,7 @@ int32 FSGConnectJNI::Initialize()
if (!GetLibraryVersionMethodID)
{
SGLOG_ERROR("FSGCoreJNI: failed to get the Android JNI method 'GetLibraryVersion'!");
return -5999999;
return -1005;
}
FSGIC_jmethodID InGetLibraryVersionMethodIDContainer{GetLibraryVersionMethodID};
@@ -54,7 +54,7 @@
int32 FSGCoreJNI::Initialize()
{
int32 Result = -999999;
int32 Result = -1000;
#if PLATFORM_ANDROID
static constexpr char SGCONNECT_JAVA_CLASS_NAME[] = "com.senseglove.sgconnect.SGConnect";
@@ -66,7 +66,7 @@ int32 FSGCoreJNI::Initialize()
if (!Env)
{
SGLOG_ERROR("FSGCoreJNI: failed to get the Android JNI environmnet!");
return -1999999;
return -1001;
}
FSGIC_JNIEnv_Ptr InEnvContainer{Env};
@@ -77,7 +77,7 @@ int32 FSGCoreJNI::Initialize()
if (Env->IsSameObject(Class, nullptr))
{
SGLOG_ERROR("FSGCoreJNI: failed to get the Android Java class!");
return -2999999;
return -1002;
}
Class = (jclass)Env->NewGlobalRef(Class);
FSGIC_jclass InClassContainer{Class};
@@ -89,7 +89,7 @@ int32 FSGCoreJNI::Initialize()
if (!ActiveDevicesMethodID)
{
SGLOG_ERROR("FSGCoreJNI: failed to get the Android JNI method 'ActiveDevices'!");
return -3999999;
return -1003;
}
FSGIC_jmethodID InActiveDevicesMethodIDContainer{ActiveDevicesMethodID};
@@ -100,7 +100,7 @@ int32 FSGCoreJNI::Initialize()
if (!GetDeviceStringMethodID)
{
SGLOG_ERROR("FSGCoreJNI: failed to get the Android JNI method 'GetDeviceString'!");
return -4999999;
return -1004;
}
FSGIC_jmethodID InGetDeviceStringMethodIDContainer{GetDeviceStringMethodID};
@@ -111,7 +111,7 @@ int32 FSGCoreJNI::Initialize()
if (!GetSensorStringMethodID)
{
SGLOG_ERROR("FSGCoreJNI: failed to get the Android JNI method 'GetSensorString'!");
return -5999999;
return -1005;
}
FSGIC_jmethodID InGetSensorStringMethodIDContainer{GetSensorStringMethodID};
@@ -122,7 +122,7 @@ int32 FSGCoreJNI::Initialize()
if (!WriteHapticsMethodID)
{
SGLOG_ERROR("FSGCoreJNI: failed to get the Android JNI method 'WriteHaptics'!");
return -6999999;
return -1006;
}
FSGIC_jmethodID InWriteHapticsMethodIDContainer{WriteHapticsMethodID};
@@ -93,6 +93,18 @@ bool USGBackend::InitializeBackend()
const int32 Result = FSGConnect::Init();
switch (Result)
{
case -103:
SGLOG_ERROR("Android JNI-specific Error: Invalid Java method ID!");
return false;
case -102:
SGLOG_ERROR("Android JNI-specific Error: Invalid Java class!");
return false;
case -101:
SGLOG_ERROR("Android JNI-specific Error: Invalid Java environment!");
return false;
case -100:
SGLOG_ERROR("Android JNI-specific Error: Generic Error! Note: you should never see this!");
return false;
case -3:
SGLOG_ERROR("An Unexpected error occurred. Please try again.");
return false;
@@ -136,6 +148,18 @@ bool USGBackend::UninitializeBackend()
const int32 Result = FSGConnect::Dispose();
switch (Result)
{
case -103:
SGLOG_ERROR("Android JNI-specific Error: Invalid Java method ID!");
return false;
case -102:
SGLOG_ERROR("Android JNI-specific Error: Invalid Java class!");
return false;
case -101:
SGLOG_ERROR("Android JNI-specific Error: Invalid Java environment!");
return false;
case -100:
SGLOG_ERROR("Android JNI-specific Error: Generic Error! Note: you should never see this!");
return false;
case -3:
SGLOG_ERROR("An Unexpected error occurred. Please try again.");
return false;
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.