Files
Plugin/Source/ThirdParty/include/SenseGlove/Core/Communications.hpp
T

85 lines
2.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>
[[nodiscard]] static char GetCommandOpen();
/// <summary> Byte indicating the end of a command. </summary>
[[nodiscard]] static char GetCommandClose();
/// <summary> Byte indicating the start of a new sensor data package. </summary>
[[nodiscard]] static char GetSenseOpen();
/// <summary> Byte indicating the end of a sensor data package. </summary>
[[nodiscard]] static char GetSenseClose();
///<summary> Denotes a block section of a DeviceList section. </summary>
[[nodiscard]] static char GetListDelimiter();
/// <summary> ':' - Used to split a set of different contant values into individual groups. </summary>
[[nodiscard]] static char GetSectionDelimiter();
/// <summary> ';' - Used to separate individual values </summary>
[[nodiscard]] static char GetColumnDelimiter();
/// <summary> '|' - Used to group a set of values, for example per finger. </summary>
[[nodiscard]] static char GetRowDelimiter();
/// <summary> Convert a value between 0..100 to a Sense Glove char/byte </summary>
[[nodiscard]] static char ToSGByte(int32_t level);
public:
Communications() = delete;
virtual ~Communications() = delete;
};