/** * @file * * @author Max Lammers * @author Mamadou Babaei * * @section LICENSE * * Copyright (c) 2020 - 2026 SenseGlove * * @section DESCRIPTION * * A parsed version of an {I} response from a Sense Glove Device, with utility * functions. */ #pragma once #include #include #include #include namespace SGConnect { class SGCONNECT_API IdResponse; } /// The processed ID Response of a Sense Glove Device, which we use to identify it. class SGCONNECT_API SGConnect::IdResponse { public: /// Parse a raw IdResponse, as received from a possible SGDevice, into useful data. static IdResponse Parse(const std::string& rawCommand); private: struct Impl; std::unique_ptr Pimpl; public: /// Create a new instance of an invalid IdResponse IdResponse(); /// Create a new instance of a processed IdResponse IdResponse(int32_t deviceType, const std::string& deviceId); public: /** * The copy constructor. */ IdResponse(const IdResponse& rhs); /** * The move constructor. */ IdResponse(IdResponse&& rhs) noexcept; public: virtual ~IdResponse(); public: /** * The copy assignment operator. */ IdResponse& operator=(const IdResponse& rhs); /** * The move assignment operator. */ IdResponse& operator=(IdResponse&& rhs) noexcept; public: /// The type of device. If < -2, it is not one of Sense Glove, if -1, it's a Beta Device. If anything /// else, its one of ours. [[nodiscard]] int32_t GetDeviceType() const;// SenseCom does not care which exact type this device is, only if it // adheres to our communications protocol. /// The unique Serial Number of this device. [[nodiscard]] const std::string& GetSerialNumber() const; public: /// Check if this IdResponse matches that of otherDevice. [[nodiscard]] bool SameDevice(const IdResponse& otherDevice) const; /// Returns true if this is a Valid Sense Glove Device. [[nodiscard]] bool IsValid() const; };