Files
Plugin/Source/SenseGloveCore/Public/SGCore/SGNovaGloveInfo.h
T
Mamadou Babaei 5e1f83fe95 * 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:00 +01:00

198 lines
5.2 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
*
* Contains information on Nova's hardware, extracted from the device.
*/
#pragma once
#include "SGHapticGlove.h"
#include "Containers/Array.h"
#include "Containers/UnrealString.h"
#include "HAL/Platform.h"
#include "UObject/Object.h"
#include "UObject/ObjectMacros.h"
#include "SGNovaGloveInfo.generated.h"
class FSGNovaGloveInfoImpl;
/**
* Device information extracted from a Nova Glove.
*/
UCLASS(BlueprintType)
class SENSEGLOVECORE_API USGNovaGloveInfo final : public UObject
{
GENERATED_BODY()
public:
static USGNovaGloveInfo* NewNovaGloveInfo(
UObject* Outer, const FSGNovaGloveInfoImpl& NovaGloveInfoImpl);
public:
/**
* The default constructor.
*/
static USGNovaGloveInfo* NewNovaGloveInfo(UObject* Outer);
/**
* Create a new instance of a NovaGloveInfo.
*/
static USGNovaGloveInfo* NewNovaGloveInfo(
UObject* Outer,
const FString& DeviceId, const FString& HardwareVersion, int32 FirmwareVersion, int32 SubFirmwareVersion,
bool bRightHanded, const FQuat& ImuCorrection, int32 NumberOfSensors);
public:
/**
* Parse an constants string into a NovaGloveInfo class.
*/
static bool Parse(UObject* Outer, const FString& ConstantsString, USGNovaGloveInfo*& OutGloveInfo);
/**
* Convert a string representation back into a NovaGloveInfo class.
*/
static USGNovaGloveInfo* Deserialize(UObject* Outer, const FString& SerializedString);
private:
struct FImpl;
struct FImplDeleter
{
void operator()(const FImpl* P) const;
};
TUniquePtr<FImpl, FImplDeleter> Pimpl;
FImplDeleter PimplDeleter;
public:
/**
* The default constructor.
*/
USGNovaGloveInfo();
/**
* Create a new instance of a NovaGloveInfo.
*/
USGNovaGloveInfo(const FString& DeviceId,
const FString& HardwareVersion, int32 FirmwareVersion, int32 SubFirmwareVersion,
bool bRightHanded, const FQuat& ImuCorrection, int32 NumberOfSensors);
public:
/**
* The cast from underlying type constructor.
*/
explicit USGNovaGloveInfo(const FSGNovaGloveInfoImpl& NovaGloveInfoImpl);
public:
/**
* The destructor.
*/
virtual ~USGNovaGloveInfo() override;
protected:
/**
* Allows to set the underlying object after construction.
*/
void SetNovaGloveInfoImpl(const FSGNovaGloveInfoImpl& NovaGloveInfoImpl);
public:
/**
* The cast to underlying type method.
*/
const FSGNovaGloveInfoImpl& ToNovaGloveInfoImpl() const;
protected:
/**
* The non-const cast to underlying type method.
*/
FSGNovaGloveInfoImpl& ToNovaGloveInfoImpl();
public:
/**
* Unique identifier of this device.
*/
FString GetDeviceId() const;
/**
* Hardware (sub) version of this Sense Glove Device.
*/
FString GetHardwareVersion() const;
/**
* Firmware version running on the device's MicroController. (as v4.12, this is the 4).
*/
int32 GetFirmwareVersion() const;
/**
* Sub firmware version running on the device's microcontroller (as v4.12, this is the .12).
*/
int32 GetSubFirmwareVersion() const;
/**
* Determines if this is a right-handed Nova.
*/
bool IsRight() const;
/**
* The IMU correction of this Nova.
*/
FQuat GetImuCorrectionQ() const;
/**
* The IMU correction of this Nova.
*/
FRotator GetImuCorrection() const;
/**
* The number of sensors in this device.
*/
int32 GetNumberOfSensors() const;
public:
/**
* Returns true if this GloveInfo contains the same information as another.
*/
bool Equals(const USGNovaGloveInfo* NovaGloveInfo) const;
public:
/**
* Create a string representation of this Glove Info.
*/
FString ToString() const;
/**
* Convert this class into a string representation so it can be unpacked later.
*/
FString SGSerialize() const;
};