128 lines
5.3 KiB
C++
128 lines
5.3 KiB
C++
/**
|
|
* @file
|
|
*
|
|
* @author Mamadou Babaei <mamadou@senseglove.com>
|
|
*
|
|
* @section LICENSE
|
|
*
|
|
* (The MIT License)
|
|
*
|
|
* Copyright (c) 2020 - 2026 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
|
|
*
|
|
* Internal class to hold 'Threshold Commands' for specific fingers. Can be sent
|
|
* to a Device, or used internally.
|
|
* Threshold Commands tell our device "When your sensor data is higher than this
|
|
* threshold, lock FFB. Otherwise, turn it back off".
|
|
*/
|
|
|
|
|
|
#pragma once
|
|
|
|
#include "SGKismet/SGBlueprintFunctionLibrary.h"
|
|
|
|
#include "SGThresholdCommandKismetLibrary.generated.h"
|
|
|
|
class USGThresholdCommand;
|
|
|
|
/**
|
|
* Internal class to hold 'Threshold Commands' for specific fingers. Can be sent to a Device, or used internally.
|
|
*/
|
|
UCLASS(meta=(ScriptName = "SenseGloveThresholdCommandKismetLibrary"))
|
|
class SENSEGLOVECOREKISMET_API USGThresholdCommandKismetLibrary final : public USGBlueprintFunctionLibrary
|
|
{
|
|
GENERATED_BODY()
|
|
|
|
public:
|
|
/**
|
|
* The default constructor.
|
|
*/
|
|
UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Haptics | Threshold Command",
|
|
meta=(WorldContext="WorldContextObject"))
|
|
static USGThresholdCommand* MakeThresholdCommand(UObject* WorldContextObject);
|
|
|
|
/**
|
|
* Create a new instance of ThresholdCommand.
|
|
*/
|
|
UFUNCTION(BlueprintCallable, DisplayName="Make Threshold Command",
|
|
Category="SenseGlove | Core | Haptics | Threshold Command", meta=(WorldContext="WorldContextObject"))
|
|
static USGThresholdCommand* MakeThresholdCommand_AF_TV(
|
|
UObject* WorldContextObject,
|
|
const TArray<bool>& AffectedFingers, const TArray<float>& ThresholdValues);
|
|
|
|
/**
|
|
* Retrieve the threshold of a particular finger.
|
|
*/
|
|
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Haptics | Threshold Command")
|
|
static float GetThreshold(const USGThresholdCommand* ThresholdCommand, int32 Finger);
|
|
|
|
/**
|
|
* Activates the threshold for a finger at a particular value.
|
|
*/
|
|
UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Haptics | Threshold Command")
|
|
static void SetThreshold(UPARAM(ref) USGThresholdCommand* ThresholdCommand, int32 Finger, float ThresholdValue);
|
|
|
|
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Haptics | Threshold Command",
|
|
meta=(WorldContext="WorldContextObject"))
|
|
static TArray<float> GetThresholds(const USGThresholdCommand* ThresholdCommand);
|
|
|
|
/**
|
|
* Activates the threshold for a finger at a particular value.
|
|
*/
|
|
UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Haptics | Threshold Command")
|
|
static void SetThresholds(UPARAM(ref) USGThresholdCommand* ThresholdCommand,
|
|
const TArray<bool>& AffectedFingers, const TArray<float>& ThresholdValues);
|
|
|
|
/**
|
|
* If true, the threshold on a finger should be active.
|
|
*/
|
|
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Haptics | Threshold Command")
|
|
static bool GetFingerActive(const USGThresholdCommand* ThresholdCommand, int32 Finger);
|
|
|
|
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Haptics | Threshold Command")
|
|
static TArray<bool> GetActiveFingers(const USGThresholdCommand* ThresholdCommand);
|
|
|
|
/**
|
|
* Deactivates Threshold Mode for a particular finger.
|
|
*/
|
|
UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Haptics | Threshold Command")
|
|
static void ClearThreshold(UPARAM(ref) USGThresholdCommand* ThresholdCommand, int32 Finger);
|
|
|
|
/**
|
|
* Disables Threshold mode for all fingers. Clears the ActiveFingers, but keeps the Thresholds value for now, in
|
|
* case you want to re-apply them later.
|
|
*/
|
|
UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Haptics | Threshold Command")
|
|
static void ClearThresholds(UPARAM(ref) USGThresholdCommand* ThresholdCommand);
|
|
|
|
/**
|
|
* Returns true if both values are exactly equal.
|
|
*/
|
|
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Haptics | Threshold Command")
|
|
static bool Equals(const USGThresholdCommand* A, const USGThresholdCommand* B);
|
|
|
|
/**
|
|
* Print the contents of this Threshold Command. If inactive, a '-' is shown.
|
|
*/
|
|
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Haptics | Threshold Command")
|
|
static FString ToString(const USGThresholdCommand* ThresholdCommand);
|
|
}; |