198 lines
6.3 KiBLFS
C++
198 lines
6.3 KiBLFS
C++
/**
|
|
* @file
|
|
*
|
|
* @author Max Lammers <max@senseglove.com>
|
|
* @author Mamadou Babaei <mamadou@senseglove.com>
|
|
*
|
|
* @section LICENSE
|
|
*
|
|
* Copyright (c) 2020 - 2023 SenseGlove
|
|
*
|
|
* @section DESCRIPTION
|
|
*
|
|
* Contains information on Nova's hardware, extracted from the device.
|
|
*/
|
|
|
|
|
|
#pragma once
|
|
|
|
#include <cstdint>
|
|
#include <memory>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
#include "Platform.hpp"
|
|
|
|
namespace SGCore
|
|
{
|
|
namespace Kinematics
|
|
{
|
|
class Quat;
|
|
}// namespace Kinematics
|
|
|
|
namespace Nova
|
|
{
|
|
/// <summary> Device information extracted from a Nova Glove. </summary>
|
|
class SGCORE_API NovaGloveInfo;
|
|
}// namespace Nova
|
|
}// namespace SGCore
|
|
|
|
/// <summary> Device information extracted from a Nova Glove. </summary>
|
|
class SGCORE_API SGCore::Nova::NovaGloveInfo
|
|
{
|
|
public:
|
|
/// <summary> Parse a constants string into a NovaGloveInfo class. </summary>
|
|
/// <param name="constantsString"></param>
|
|
/// <param name="out_novaGloveInfo"></param>
|
|
/// <returns></returns>
|
|
static bool Parse(const std::string& constantsString, NovaGloveInfo& out_novaGloveInfo);
|
|
|
|
/// <summary> Convert a string representation back into a NovaGloveInfo class. </summary>
|
|
/// <param name="serializedString"></param>
|
|
/// <returns></returns>
|
|
#if !defined ( SENSEGLOVE_UNREAL_ENGINE_PLUGIN )
|
|
[[nodiscard]]
|
|
#endif /* !defined ( SENSEGLOVE_UNREAL_ENGINE_PLUGIN ) */
|
|
static NovaGloveInfo Deserialize(const std::string& serializedString);
|
|
|
|
private:
|
|
struct Impl;
|
|
std::unique_ptr<Impl> Pimpl;
|
|
|
|
public:
|
|
/// <summary> The default constructor. </summary>
|
|
/// <returns></returns>
|
|
NovaGloveInfo();
|
|
|
|
/// <summary> Create a new instance of a NovaGloveInfo. </summary>
|
|
/// <param name="id"></param>
|
|
/// <param name="hardwareVersion"></param>
|
|
/// <param name="firmwareVersion"></param>
|
|
/// <param name="subFirmwareVersion"></param>
|
|
/// <param name="bRightHand"></param>
|
|
/// <param name="imuCorr"></param>
|
|
/// <param name="nSensors"></param>
|
|
/// <returns></returns>
|
|
NovaGloveInfo(const std::string &deviceId, const std::string& hardwareVersion,
|
|
int32_t firmwareVersion, int32_t subFirmwareVersion, bool bRightHanded,
|
|
const Kinematics::Quat& imuCorrection, int32_t numberOfSensors);
|
|
|
|
/**
|
|
* The copy constructor.
|
|
*/
|
|
NovaGloveInfo(const NovaGloveInfo& rhs);
|
|
|
|
/**
|
|
* The move constructor.
|
|
*/
|
|
NovaGloveInfo(NovaGloveInfo&& rhs) noexcept;
|
|
|
|
virtual ~NovaGloveInfo();
|
|
|
|
public:
|
|
/**
|
|
* The copy assignment operator.
|
|
*/
|
|
NovaGloveInfo& operator=(const NovaGloveInfo& rhs);
|
|
|
|
/**
|
|
* The move assignment operator.
|
|
*/
|
|
NovaGloveInfo& operator=(NovaGloveInfo&& rhs) noexcept;
|
|
|
|
public:
|
|
/// <summary> Unique identifier of this device. </summary>
|
|
#if !defined ( SENSEGLOVE_UNREAL_ENGINE_PLUGIN )
|
|
[[nodiscard]]
|
|
#endif /* !defined ( SENSEGLOVE_UNREAL_ENGINE_PLUGIN ) */
|
|
const std::string& GetDeviceId() const;
|
|
|
|
#if SENSEGLOVE_UNREAL_ENGINE_PLUGIN
|
|
void SetDeviceId(const std::string& deviceId);
|
|
#endif /* SENSEGLOVE_UNREAL_ENGINE_PLUGIN */
|
|
|
|
/// <summary> Hardware (sub) version of this Sense Glove Device. </summary>
|
|
#if !defined ( SENSEGLOVE_UNREAL_ENGINE_PLUGIN )
|
|
[[nodiscard]]
|
|
#endif /* !defined ( SENSEGLOVE_UNREAL_ENGINE_PLUGIN ) */
|
|
const std::string& GetHardwareVersion() const;
|
|
|
|
#if SENSEGLOVE_UNREAL_ENGINE_PLUGIN
|
|
void SetHardwareVersion(const std::string& hardwareVersion);
|
|
#endif /* SENSEGLOVE_UNREAL_ENGINE_PLUGIN */
|
|
|
|
/// <summary> Firmware version running on the device's MicroController. (as v4.12, this is the 4). </summary>
|
|
#if !defined ( SENSEGLOVE_UNREAL_ENGINE_PLUGIN )
|
|
[[nodiscard]]
|
|
#endif /* !defined ( SENSEGLOVE_UNREAL_ENGINE_PLUGIN ) */
|
|
int32_t GetFirmwareVersion() const;
|
|
|
|
#if SENSEGLOVE_UNREAL_ENGINE_PLUGIN
|
|
void SetFirmwareVersion(int32_t firmwareVersion);
|
|
#endif /* SENSEGLOVE_UNREAL_ENGINE_PLUGIN */
|
|
|
|
/// <summary> Sub firmware version running on the device's microcontroller (as v4.12, this is the .12). </summary>
|
|
#if !defined ( SENSEGLOVE_UNREAL_ENGINE_PLUGIN )
|
|
[[nodiscard]]
|
|
#endif /* !defined ( SENSEGLOVE_UNREAL_ENGINE_PLUGIN ) */
|
|
int32_t GetSubFirmwareVersion() const;
|
|
|
|
#if SENSEGLOVE_UNREAL_ENGINE_PLUGIN
|
|
void SetSubFirmwareVersion(int32_t subFirmwareVersion);
|
|
#endif /* SENSEGLOVE_UNREAL_ENGINE_PLUGIN */
|
|
|
|
/// <summary> Determines if this is a right-handed Nova. </summary>
|
|
#if !defined ( SENSEGLOVE_UNREAL_ENGINE_PLUGIN )
|
|
[[nodiscard]]
|
|
#endif /* !defined ( SENSEGLOVE_UNREAL_ENGINE_PLUGIN ) */
|
|
bool IsRight() const;
|
|
|
|
#if SENSEGLOVE_UNREAL_ENGINE_PLUGIN
|
|
void SetIsRight(bool bRightHanded);
|
|
#endif /* SENSEGLOVE_UNREAL_ENGINE_PLUGIN */
|
|
|
|
///<summary> The IMU correction of this Nova. </summary>
|
|
#if !defined ( SENSEGLOVE_UNREAL_ENGINE_PLUGIN )
|
|
[[nodiscard]]
|
|
#endif /* !defined ( SENSEGLOVE_UNREAL_ENGINE_PLUGIN ) */
|
|
const Kinematics::Quat& GetImuCorrection() const;
|
|
|
|
#if SENSEGLOVE_UNREAL_ENGINE_PLUGIN
|
|
void SetImuCorrection(const Kinematics::Quat& imuCorrection);
|
|
#endif /* SENSEGLOVE_UNREAL_ENGINE_PLUGIN */
|
|
|
|
///<summary> The number of sensors in this device. </summary>
|
|
#if !defined ( SENSEGLOVE_UNREAL_ENGINE_PLUGIN )
|
|
[[nodiscard]]
|
|
#endif /* !defined ( SENSEGLOVE_UNREAL_ENGINE_PLUGIN ) */
|
|
int32_t GetNumberOfSensors() const;
|
|
|
|
#if SENSEGLOVE_UNREAL_ENGINE_PLUGIN
|
|
void SetNumberOfSensors(int32_t numberOfSensors);
|
|
#endif /* SENSEGLOVE_UNREAL_ENGINE_PLUGIN */
|
|
|
|
public:
|
|
/// <summary> Returns true if this GloveInfo contains the same information as another. </summary>
|
|
/// <param name="other"></param>
|
|
/// <returns></returns>
|
|
#if !defined ( SENSEGLOVE_UNREAL_ENGINE_PLUGIN )
|
|
[[nodiscard]]
|
|
#endif /* !defined ( SENSEGLOVE_UNREAL_ENGINE_PLUGIN ) */
|
|
bool Equals(const NovaGloveInfo& novaGloveInfo) const;
|
|
|
|
public:
|
|
/// <summary> Create a string representation of this Glove Info. </summary>
|
|
/// <returns></returns>
|
|
#if !defined ( SENSEGLOVE_UNREAL_ENGINE_PLUGIN )
|
|
[[nodiscard]]
|
|
#endif /* !defined ( SENSEGLOVE_UNREAL_ENGINE_PLUGIN ) */
|
|
std::string ToString() const;
|
|
|
|
/// <summary> Convert this class into a string representation so it can be unpacked later. </summary>
|
|
/// <returns></returns>
|
|
#if !defined ( SENSEGLOVE_UNREAL_ENGINE_PLUGIN )
|
|
[[nodiscard]]
|
|
#endif /* !defined ( SENSEGLOVE_UNREAL_ENGINE_PLUGIN ) */
|
|
std::string Serialize() const;
|
|
};
|