2022-11-02 22:43:14 +01:00
|
|
|
/**
|
|
|
|
|
* @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
|
|
|
|
|
*
|
2022-11-18 14:32:55 +01:00
|
|
|
* An interface to get calibration to / from disk.
|
2022-11-02 22:43:14 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include "Containers/UnrealString.h"
|
|
|
|
|
|
|
|
|
|
#include "SGCore/SGHandProfile.h"
|
|
|
|
|
#include "SGCore/SGSensorRange.h"
|
|
|
|
|
|
|
|
|
|
#include "SGHapticGloveHandProfiles.generated.h"
|
|
|
|
|
|
|
|
|
|
class USGHapticGlove;
|
|
|
|
|
|
2022-11-18 14:32:55 +01:00
|
|
|
/**
|
|
|
|
|
* A glove developed by SenseGlove, that has hand tracking and/or haptic feedback functionality.
|
|
|
|
|
*/
|
2022-11-02 22:43:14 +01:00
|
|
|
USTRUCT()
|
|
|
|
|
struct SENSEGLOVECORE_API FSGHapticGloveHandProfiles
|
|
|
|
|
{
|
|
|
|
|
GENERATED_BODY()
|
|
|
|
|
|
|
|
|
|
public:
|
2022-11-18 14:32:55 +01:00
|
|
|
/**
|
|
|
|
|
* Returns the directory where our HandProfiles are stored.
|
|
|
|
|
*/
|
2022-11-02 22:43:14 +01:00
|
|
|
static FString GetProfileDirectory();
|
|
|
|
|
|
2022-11-18 14:32:55 +01:00
|
|
|
/**
|
|
|
|
|
* Set the directory where our HandProfiles are stored.
|
|
|
|
|
*/
|
2022-11-02 22:43:14 +01:00
|
|
|
static void SetProfileDirectory(const FString& Directory);
|
|
|
|
|
|
2022-11-18 14:32:55 +01:00
|
|
|
/**
|
|
|
|
|
* Access the latest Left Hand Profile from disk.
|
|
|
|
|
*/
|
2022-11-02 22:43:14 +01:00
|
|
|
static void GetLeftHandProfile(UObject* Outer, USGHandProfile*& OutHandProfile);
|
|
|
|
|
|
2022-11-18 14:32:55 +01:00
|
|
|
/**
|
|
|
|
|
* Sets the newest Left Hand Profile - also stores it on disk.
|
|
|
|
|
*/
|
2022-11-02 22:43:14 +01:00
|
|
|
static void SetLeftHandProfile(const USGHandProfile* HandProfile);
|
|
|
|
|
|
2022-11-18 14:32:55 +01:00
|
|
|
/**
|
|
|
|
|
* Access the latest Right Hand Profile from disk.
|
|
|
|
|
*/
|
2022-11-02 22:43:14 +01:00
|
|
|
static void GetRightHandProfile(UObject* Outer, USGHandProfile*& OutHandProfile);
|
|
|
|
|
|
2022-11-18 14:32:55 +01:00
|
|
|
/**
|
|
|
|
|
* Sets the newest Right Hand Profile - also stores it on disk.
|
|
|
|
|
*/
|
2022-11-02 22:43:14 +01:00
|
|
|
static void SetRightHandProfile(const USGHandProfile* HandProfile);
|
|
|
|
|
|
2022-11-18 14:32:55 +01:00
|
|
|
/**
|
|
|
|
|
* Retrieve a left- or right handed profile.
|
|
|
|
|
*/
|
2022-11-02 22:43:14 +01:00
|
|
|
static void GetProfile(UObject* Outer, bool bRightHanded, USGHandProfile*& OutHandProfile);
|
|
|
|
|
|
2022-11-18 14:32:55 +01:00
|
|
|
/**
|
|
|
|
|
* Store a profile in the global variables and on disk. The profile determines if this is a left or right hand.
|
|
|
|
|
*/
|
2022-11-02 22:43:14 +01:00
|
|
|
static void SetProfile(const USGHandProfile* HandProfile);
|
|
|
|
|
|
2022-11-18 14:32:55 +01:00
|
|
|
/**
|
|
|
|
|
* Store a profile in the global variables and on disk. You determine if this is a left or right hand.
|
|
|
|
|
*/
|
2022-11-02 22:43:14 +01:00
|
|
|
static void SetProfile(const USGHandProfile* HandProfile, bool bRightHanded);
|
|
|
|
|
|
2022-11-18 14:32:55 +01:00
|
|
|
/**
|
|
|
|
|
* Restore both profiles back to their default values.
|
|
|
|
|
*/
|
2022-11-02 22:43:14 +01:00
|
|
|
static void RestoreDefaults();
|
|
|
|
|
|
2022-11-18 14:32:55 +01:00
|
|
|
/**
|
|
|
|
|
* Restore the left- or right hand profiles back to their default values.
|
|
|
|
|
*/
|
2022-11-02 22:43:14 +01:00
|
|
|
static void RestoreDefaults(bool bRightHanded);
|
|
|
|
|
|
2022-11-18 14:32:55 +01:00
|
|
|
/**
|
|
|
|
|
* Load the latest profiles from disk. Automatically called when you first try to access a profile.
|
|
|
|
|
* Exposed so you can force-reload profiles.
|
|
|
|
|
*/
|
2022-11-02 22:43:14 +01:00
|
|
|
static void TryLoadingFromDisk();
|
|
|
|
|
|
2022-11-18 14:32:55 +01:00
|
|
|
/**
|
|
|
|
|
* Stores the last sensor range of a glove.
|
|
|
|
|
*/
|
2022-11-02 22:43:14 +01:00
|
|
|
static bool SaveLastRange(const USGSensorRange* CurrentRange, const USGHapticGlove* ForGlove);
|
|
|
|
|
|
2022-11-18 14:32:55 +01:00
|
|
|
/**
|
|
|
|
|
* Loads the last sensor range of a glove.
|
|
|
|
|
*/
|
2022-11-02 22:43:14 +01:00
|
|
|
static bool LoadLastRange(UObject* Outer, const USGHapticGlove* ForGlove, USGSensorRange*& OutLastRange);
|
2022-11-18 14:32:55 +01:00
|
|
|
};
|