112 lines
3.5 KiBLFS
C++
112 lines
3.5 KiBLFS
C++
/**
|
|
* @file
|
|
*
|
|
* @author Max Lammers <max@senseglove.com>
|
|
* @author Mamadou Babaei <mamadou@senseglove.com>
|
|
*
|
|
* @section LICENSE
|
|
*
|
|
* Copyright (c) 2020 - 2022 SenseGlove
|
|
*
|
|
* @section DESCRIPTION
|
|
*
|
|
* Contains internal enumerators and classes for raw byte communications with
|
|
* Sense Glove Devices.
|
|
*/
|
|
|
|
|
|
#pragma once
|
|
|
|
#include <cstdint>
|
|
|
|
#include "Platform.hpp"
|
|
|
|
namespace SGCore
|
|
{
|
|
namespace Util
|
|
{
|
|
/// <summary> Indices to access DeviceList data in Shared Memory. </summary>
|
|
enum class EListFormat : uint8_t
|
|
{
|
|
Connected = 0,
|
|
PacketsPerSecondGot,
|
|
DeviceType,
|
|
ConstantsString,
|
|
Address,
|
|
ConnectionType,
|
|
PacketsPerSecondSent,
|
|
All,
|
|
};
|
|
|
|
/// <summary> Indices to access Sensor Data in Shared Memory. </summary>
|
|
enum class ESensorFormat : uint8_t
|
|
{
|
|
Sensors
|
|
};
|
|
|
|
class SGCORE_API Communications;
|
|
}// namespace Util
|
|
}// namespace SGCore
|
|
|
|
/// <summary> "Database" containing communications bytes and conversions. </summary>
|
|
class SGCORE_API SGCore::Util::Communications
|
|
{
|
|
public:
|
|
/// <summary> Byte indicating the start of a new command. </summary>
|
|
#if !defined ( SENSEGLOVE_UNREAL_ENGINE_PLUGIN )
|
|
[[nodiscard]]
|
|
#endif /* !defined ( SENSEGLOVE_UNREAL_ENGINE_PLUGIN ) */
|
|
static char GetCommandOpen();
|
|
|
|
/// <summary> Byte indicating the end of a command. </summary>
|
|
#if !defined ( SENSEGLOVE_UNREAL_ENGINE_PLUGIN )
|
|
[[nodiscard]]
|
|
#endif /* !defined ( SENSEGLOVE_UNREAL_ENGINE_PLUGIN ) */
|
|
static char GetCommandClose();
|
|
|
|
/// <summary> Byte indicating the start of a new sensor data package. </summary>
|
|
#if !defined ( SENSEGLOVE_UNREAL_ENGINE_PLUGIN )
|
|
[[nodiscard]]
|
|
#endif /* !defined ( SENSEGLOVE_UNREAL_ENGINE_PLUGIN ) */
|
|
static char GetSenseOpen();
|
|
|
|
/// <summary> Byte indicating the end of a sensor data package. </summary>
|
|
#if !defined ( SENSEGLOVE_UNREAL_ENGINE_PLUGIN )
|
|
[[nodiscard]]
|
|
#endif /* !defined ( SENSEGLOVE_UNREAL_ENGINE_PLUGIN ) */
|
|
static char GetSenseClose();
|
|
|
|
///<summary> Denotes a block section of a DeviceList section. </summary>
|
|
#if !defined ( SENSEGLOVE_UNREAL_ENGINE_PLUGIN )
|
|
[[nodiscard]]
|
|
#endif /* !defined ( SENSEGLOVE_UNREAL_ENGINE_PLUGIN ) */
|
|
static char GetListDelimiter();
|
|
|
|
/// <summary> ':' - Used to split a set of different constant values into individual groups. </summary>
|
|
#if !defined ( SENSEGLOVE_UNREAL_ENGINE_PLUGIN )
|
|
[[nodiscard]]
|
|
#endif /* !defined ( SENSEGLOVE_UNREAL_ENGINE_PLUGIN ) */
|
|
static char GetSectionDelimiter();
|
|
|
|
/// <summary> ';' - Used to separate individual values </summary>
|
|
#if !defined ( SENSEGLOVE_UNREAL_ENGINE_PLUGIN )
|
|
[[nodiscard]]
|
|
#endif /* !defined ( SENSEGLOVE_UNREAL_ENGINE_PLUGIN ) */
|
|
static char GetColumnDelimiter();
|
|
|
|
/// <summary> '|' - Used to group a set of values, for example per finger. </summary>
|
|
#if !defined ( SENSEGLOVE_UNREAL_ENGINE_PLUGIN )
|
|
[[nodiscard]]
|
|
#endif /* !defined ( SENSEGLOVE_UNREAL_ENGINE_PLUGIN ) */
|
|
static char GetRowDelimiter();
|
|
|
|
/// <summary> Convert a value between 0..100 to a Sense Glove char/byte. </summary>
|
|
#if !defined ( SENSEGLOVE_UNREAL_ENGINE_PLUGIN )
|
|
[[nodiscard]]
|
|
#endif /* !defined ( SENSEGLOVE_UNREAL_ENGINE_PLUGIN ) */
|
|
static char ToSGByte(int32_t level);
|
|
|
|
public:
|
|
Communications() = delete;
|
|
virtual ~Communications() = delete;
|
|
}; |