Files
Plugin/Source/SenseGloveCore/Private/SGCore/SGHapticGloveHandProfiles.cpp
T
Mamadou Babaei ba716b269d * Expose SenseGloveTypes as a public dependency in SenseGloveConnect and
SenseGloveCore modules, so that the C++ users of the API don't need to
 explicitly add it as a dependency
* Clean up the redundant headers/modules dependency from SGCore headers
* Fix RunUAT build issues for Epic Store submission
2022-11-25 15:08:41 +01:00

144 lines
5.9 KiB
C++

/**
* @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 "SGCore/SGHapticGloveHandProfiles.h"
#include "SGCore/SGHandProfile.h"
#include "SGCore/SGHapticGlove.h"
#include "SGCore/SGSensorRange.h"
#include "SGCoreImpl/SGHapticGloveImpl.h"
#include "SGCoreImpl/SGExportedFunctions.h"
#include "SGInterop/SGIC_FSGHandProfileImpl.h"
#include "SGInterop/SGIC_TSharedPtr_FSGHapticGloveImpl.h"
#include "SGInterop/SGIC_FSGSensorRangeImpl.h"
#include "SGInterop/SGIC_FString.h"
FString FSGHapticGloveHandProfiles::GetProfileDirectory()
{
FSGIC_FString OutDirectoryContainer;
SGCoreImpl_FSGHapticGloveHandProfilesImpl_GetProfileDirectory(&OutDirectoryContainer);
return MoveTemp(OutDirectoryContainer.String);
}
void FSGHapticGloveHandProfiles::SetProfileDirectory(const FString& Directory)
{
FSGIC_FString DirectoryContainer{Directory};
SGCoreImpl_FSGHapticGloveHandProfilesImpl_SetProfileDirectory(&DirectoryContainer);
}
void FSGHapticGloveHandProfiles::GetLeftHandProfile(UObject* Outer, USGHandProfile*& OutHandProfile)
{
FSGIC_FSGHandProfileImpl OutHandProfileImplContainer{OutHandProfile->ToHandProfileImpl()};
SGCoreImpl_FSGHapticGloveHandProfilesImpl_GetLeftHandProfile(&OutHandProfileImplContainer);
OutHandProfile = USGHandProfile::NewHandProfile(Outer, MoveTemp(OutHandProfileImplContainer.HandProfileImpl));
}
void FSGHapticGloveHandProfiles::SetLeftHandProfile(const USGHandProfile* HandProfile)
{
FSGIC_FSGHandProfileImpl HandProfileImplContainer{HandProfile->ToHandProfileImpl()};
SGCoreImpl_FSGHapticGloveHandProfilesImpl_SetLeftHandProfile(&HandProfileImplContainer);
}
void FSGHapticGloveHandProfiles::GetRightHandProfile(UObject* Outer, USGHandProfile*& OutHandProfile)
{
FSGIC_FSGHandProfileImpl OutHandProfileImplContainer;
SGCoreImpl_FSGHapticGloveHandProfilesImpl_GetRightHandProfile(&OutHandProfileImplContainer);
OutHandProfile = USGHandProfile::NewHandProfile(Outer, MoveTemp(OutHandProfileImplContainer.HandProfileImpl));
}
void FSGHapticGloveHandProfiles::SetRightHandProfile(const USGHandProfile* HandProfile)
{
FSGIC_FSGHandProfileImpl HandProfileImplContainer{HandProfile->ToHandProfileImpl()};
SGCoreImpl_FSGHapticGloveHandProfilesImpl_SetRightHandProfile(&HandProfileImplContainer);
}
void FSGHapticGloveHandProfiles::GetProfile(UObject* Outer,
const bool bRightHanded, USGHandProfile*& OutHandProfile)
{
FSGIC_FSGHandProfileImpl OutHandProfileImplContainer;
SGCoreImpl_FSGHapticGloveHandProfilesImpl_GetProfile(bRightHanded, &OutHandProfileImplContainer);
OutHandProfile = USGHandProfile::NewHandProfile(Outer, MoveTemp(OutHandProfileImplContainer.HandProfileImpl));
}
void FSGHapticGloveHandProfiles::SetProfile(const USGHandProfile* HandProfile)
{
FSGIC_FSGHandProfileImpl HandProfileImplContainer{HandProfile->ToHandProfileImpl()};
SGCoreImpl_FSGHapticGloveHandProfilesImpl_SetProfile_HandProfileImpl(&HandProfileImplContainer);
}
void FSGHapticGloveHandProfiles::SetProfile(const USGHandProfile* HandProfile,
const bool bRightHanded)
{
FSGIC_FSGHandProfileImpl HandProfileImplContainer{HandProfile->ToHandProfileImpl()};
SGCoreImpl_FSGHapticGloveHandProfilesImpl_SetProfile_HandProfileImpl_bRightHanded(
&HandProfileImplContainer, bRightHanded);
}
void FSGHapticGloveHandProfiles::RestoreDefaults()
{
SGCoreImpl_FSGHapticGloveHandProfilesImpl_RestoreDefaults();
}
void FSGHapticGloveHandProfiles::RestoreDefaults(const bool bRightHanded)
{
SGCoreImpl_FSGHapticGloveHandProfilesImpl_RestoreDefaults_bRightHanded(bRightHanded);
}
void FSGHapticGloveHandProfiles::TryLoadingFromDisk()
{
SGCoreImpl_FSGHapticGloveHandProfilesImpl_TryLoadingFromDisk();
}
bool FSGHapticGloveHandProfiles::SaveLastRange(
const USGSensorRange* CurrentRange, const USGHapticGlove* ForGlove)
{
FSGIC_FSGSensorRangeImpl CurrentRangeContainer{CurrentRange->ToSensorRangeImpl()};
FSGIC_TSharedPtr_FSGHapticGloveImpl ForGloveContainer{ForGlove->ToHapticGloveImpl()};
return SGCoreImpl_FSGHapticGloveHandProfilesImpl_SaveLastRange(&CurrentRangeContainer, &ForGloveContainer);
}
bool FSGHapticGloveHandProfiles::LoadLastRange(UObject* Outer,
const USGHapticGlove* ForGlove, USGSensorRange*& OutLastRange)
{
FSGIC_TSharedPtr_FSGHapticGloveImpl ForGloveContainer{ForGlove->ToHapticGloveImpl()};
FSGIC_FSGSensorRangeImpl OutLastRangeContainer;
const bool bResult = SGCoreImpl_FSGHapticGloveHandProfilesImpl_LoadLastRange(
&ForGloveContainer, &OutLastRangeContainer);
OutLastRange = USGSensorRange::NewSensorRange(Outer, MoveTemp(OutLastRangeContainer.SensorRangeImpl));
return bResult;
}