/** * @file * * @author Max Lammers * @author Mamadou Babaei * * @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 #include "Platform.hpp" namespace SGCore { namespace Util { /// Indices to access DeviceList data in Shared Memory. enum class EListFormat : uint8_t { Connected = 0, PacketsPerSecondGot, DeviceType, ConstantsString, Address, ConnectionType, PacketsPerSecondSent, All, }; /// Indices to access Sensor Data in Shared Memory. enum class ESensorFormat : uint8_t { Sensors }; class SGCORE_API Communications; }// namespace Util }// namespace SGCore /// "Database" containing communications bytes and conversions. class SGCORE_API SGCore::Util::Communications { public: /// Byte indicating the start of a new command. #if !defined ( SENSEGLOVE_UNREAL_ENGINE_PLUGIN ) [[nodiscard]] #endif /* !defined ( SENSEGLOVE_UNREAL_ENGINE_PLUGIN ) */ static char GetCommandOpen(); /// Byte indicating the end of a command. #if !defined ( SENSEGLOVE_UNREAL_ENGINE_PLUGIN ) [[nodiscard]] #endif /* !defined ( SENSEGLOVE_UNREAL_ENGINE_PLUGIN ) */ static char GetCommandClose(); /// Byte indicating the start of a new sensor data package. #if !defined ( SENSEGLOVE_UNREAL_ENGINE_PLUGIN ) [[nodiscard]] #endif /* !defined ( SENSEGLOVE_UNREAL_ENGINE_PLUGIN ) */ static char GetSenseOpen(); /// Byte indicating the end of a sensor data package. #if !defined ( SENSEGLOVE_UNREAL_ENGINE_PLUGIN ) [[nodiscard]] #endif /* !defined ( SENSEGLOVE_UNREAL_ENGINE_PLUGIN ) */ static char GetSenseClose(); /// Denotes a block section of a DeviceList section. #if !defined ( SENSEGLOVE_UNREAL_ENGINE_PLUGIN ) [[nodiscard]] #endif /* !defined ( SENSEGLOVE_UNREAL_ENGINE_PLUGIN ) */ static char GetListDelimiter(); /// ':' - Used to split a set of different constant values into individual groups. #if !defined ( SENSEGLOVE_UNREAL_ENGINE_PLUGIN ) [[nodiscard]] #endif /* !defined ( SENSEGLOVE_UNREAL_ENGINE_PLUGIN ) */ static char GetSectionDelimiter(); /// ';' - Used to separate individual values #if !defined ( SENSEGLOVE_UNREAL_ENGINE_PLUGIN ) [[nodiscard]] #endif /* !defined ( SENSEGLOVE_UNREAL_ENGINE_PLUGIN ) */ static char GetColumnDelimiter(); /// '|' - Used to group a set of values, for example per finger. #if !defined ( SENSEGLOVE_UNREAL_ENGINE_PLUGIN ) [[nodiscard]] #endif /* !defined ( SENSEGLOVE_UNREAL_ENGINE_PLUGIN ) */ static char GetRowDelimiter(); /// Convert a value between 0..100 to a Sense Glove char/byte. #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; };