Files
Plugin/Source/SenseGloveCore/Public/SGCore/SGBuzzCommand.h
T
Mamadou Babaei a17b63bb0a * 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:09:37 +01:00

169 lines
4.8 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
*
* Buzz motor command specific for the Sense Glove.
*/
#pragma once
#include "HAL/Platform.h"
#include "Templates/SharedPointer.h"
#include "Templates/UniquePtr.h"
#include "UObject/ObjectMacros.h"
#include "SGCore/SGFingerCommand.h"
#include "SGTypes/SGCoreTypes.h"
#include "SGBuzzCommand.generated.h"
class FSGBuzzCommandImpl;
/**
* A vibration command for the Sense Glove, with levels for each finger.
*/
UCLASS(BlueprintType)
class SENSEGLOVECORE_API USGBuzzCommand : public USGFingerCommand
{
GENERATED_BODY()
public:
static USGBuzzCommand* NewBuzzCommand(UObject* Outer, const FSGBuzzCommandImpl& BuzzCommandImpl);
static USGBuzzCommand* NewBuzzCommand(UObject* Outer, TSharedRef<FSGBuzzCommandImpl> BuzzCommandImpl);
public:
/**
* The basic constructor.
*/
static USGBuzzCommand* NewBuzzCommand(UObject* Outer);
/**
* Create a new buzz motor command, where each finger level is contained inside an array of size 5.
*/
static USGBuzzCommand* NewBuzzCommand(UObject* Outer, const TArray<int32>& BuzzLevels);
/**
* Create a new Buzz Motor command, indicating the intensity for each finger.
*/
static USGBuzzCommand* NewBuzzCommand(UObject* Outer, int32 Thumb, int32 Index, int32 Middle, int32 Ring,
int32 Pinky);
/**
* Create a new Buzz Motor command, with only one finger being activated.
*/
static USGBuzzCommand* NewBuzzCommand(UObject* Outer, ESGFinger Finger, int32 BuzzLevel);
public:
/**
* A command that turns off all vibration motors of the Sense Glove.
*/
static USGBuzzCommand* Off(UObject* Outer);
private:
struct FImpl;
struct FImplDeleter
{
void operator()(const FImpl* P) const;
};
TUniquePtr<FImpl, FImplDeleter> Pimpl;
FImplDeleter PimplDeleter;
public:
/**
* The basic constructor.
*/
USGBuzzCommand();
/**
* Create a new buzz motor command, where each finger level is contained inside an array of size 5.
*/
explicit USGBuzzCommand(const TArray<int32>& BuzzLevels);
/**
* Create a new Buzz Motor command, indicating the intensity for each finger.
*/
USGBuzzCommand(int32 Thumb, int32 Index, int32 Middle, int32 Ring, int32 Pinky);
/**
* Create a new Buzz Motor command, with only one finger being activated.
*/
USGBuzzCommand(ESGFinger Finger, int32 BuzzLevel);
public:
/**
* The cast from underlying type constructor.
*/
explicit USGBuzzCommand(const FSGBuzzCommandImpl& BuzzCommandImpl);
protected:
/**
* The cast from underlying pointer type constructor.
*/
explicit USGBuzzCommand(TSharedRef<FSGBuzzCommandImpl> BuzzCommandImpl);
public:
/**
* The destructor.
*/
virtual ~USGBuzzCommand() override;
public:
/**
* The cast to underlying type method.
*/
TSharedRef<FSGBuzzCommandImpl> ToBuzzCommandImpl() const;
protected:
/**
* Allows the child classes to synchronize the parent's underlying object at any time.
*/
virtual void SyncImplObject() const override;
/**
* Allows the child classes to synchronize the parent's uproperties at any time.
*/
virtual void SyncUProperties() override;
public:
/**
* Copy this Buzz Command into a new object.
*/
USGBuzzCommand* Copy(UObject* Outer) const;
/**
* Merge this command with another, taking the maximum value between the two.
*/
USGBuzzCommand* Merge(UObject* Outer, const USGBuzzCommand* BuzzCommand) const;
};