
/**
* @file RespirationBelt.h
*
* @brief The file contains the header for TUsb respiration belt object
**/

/*!
Header include
*/
#include "prerequisites.h"


/*!
Class definition
*/
class RespirationBelt
{
  public:
    /*!
    Standard constructor and destructor
    */
    RespirationBelt();
    ~RespirationBelt();

    /*!
    Getters and Setters
    */
    double GetChestExtension();
    float GetBatteryLevel();
    void SetChestExtension(double extensionPercent);
    void SetBatteryLevel(float batteryPercent);

    /*!
    Connection and Disconnection
    */
    bool Connect(long comPort, long carryingFrequency);
    bool Disconnect();

    /*!
    Thread loop
    */
    void GoThread();

    /*!
    Handle new data
    */
    void ParseData();

  private:
    IT_USBComPtr m_pIMonCom;
    double m_chestExtension;
    float m_batteryLevel;
    bool m_isConnected;

    /*!
    Boost thread
    */
    boost::mutex mutexNewData;
    boost::thread* loopThread;    // Pointer to the update loop thread
    bool exitRequested;           // Boolean used to ask the loop thread to end
    bool comState;                // Boolean used to handle COM connection state
};