/** * @file * * @author Max Lammers * @author Mamadou Babaei * * @section LICENSE * * Copyright (c) 2020 - 2026 SenseGlove * * @section DESCRIPTION * * Base class for Device Models containing the minimum amount of data gathered * through Communications Protocol. Used for shared functionality. */ #pragma once #include #include #include #include #include namespace SGCore { /// Base class containing the minimum amount of data for device models. class SGCORE_API DeviceModel; }// namespace SGCore /// Base class containing the minimum amount of data for device models. class SGCORE_API SGCore::DeviceModel { public: /// Parse a 32-bit integer value into a set of booleans (010010011) that indicate which (optional) /// functions this device has. static std::vector ParseFunctions(int32_t value, int32_t size); /// /// /// /// static void ParseFirmware(const std::string& rawFirmware, int32_t& out_mainVersion, int32_t& out_subVersion); private: struct Impl; std::unique_ptr Pimpl; public: DeviceModel();// empty constructor to be used by child classes. DeviceModel(const std::string& id, const std::string& hardwareVersion, int32_t firmwareVersion, int32_t subFirmwareVersion); /** * The copy constructor. */ DeviceModel(const DeviceModel& rhs); /** * The move constructor. */ DeviceModel(DeviceModel&& rhs) noexcept; virtual ~DeviceModel(); public: /** * The copy assignment operator. */ DeviceModel& operator=(const DeviceModel& rhs); /** * The move assignment operator. */ DeviceModel& operator=(DeviceModel&& rhs) noexcept; public: /// Retrieve the Unique identifier of this device. [[nodiscard]] std::string GetDeviceId() const; protected: /// Unique identifier of this device. void SetDeviceId(const std::string& id); public: /// Retrieve the Hardware (sub) version of this Sense Glove Device. [[nodiscard]] std::string GetHardwareVersion() const; protected: /// Hardware (sub) version of this Sense Glove Device. void SetHardwareVersion(const std::string& version); public: /// Firmware version running on the device's MicroController. (as of v4.12, this is the 4). [[nodiscard]] int32_t GetFirmwareVersion() const; protected: /// Firmware version running on the device's MicroController. void SetFirmwareVersion(int32_t version); public: /// Sub firmware version running on the device's microcontroller (as of v4.12, this is the 12). /// [[nodiscard]] int32_t GetSubFirmwareVersion() const; protected: /// Sub-Firmware version running on the device's MicroController. void SetSubFirmwareVersion(int32_t version); public: /// Returns true if this glove's firmware is newer than certain version. /// /// /// /// [[nodiscard]] bool FirmwareNewerThan(int32_t firmwareMain, int32_t firmwareSub, bool bInclusive) const; /// Returns true if this glove's firmware is older than certain version. /// /// /// /// [[nodiscard]] bool FirmwareOlderThan(int32_t firmwareMain, int32_t firmwareSub, bool bInclusive) const; };