#ifndef enviro_H
#define enviro_H

//Update time of the values on this window (in milliseconds)
#define UPDATE_TIME_enviro 60000
#define NEnvpars 12

#define Pdef 1010.
#define Tdef 293.
#define Hdef 45.

#include <MainWindow.h>

class MainWindow;

class enviro : public QWidget
{
  Q_OBJECT

public slots:   
  void updateWindow();

signals:
  void consolewrite( const QString );
public:
  enviro(MainWindow *parent = 0);
  ~enviro();
  float getPenv() { return p0_env; }
  float getTenv() { return 0.5*(t0_env+t1_env); }
  float getHenv() { return 0.5*(h0_env+h1_env); }
  float getTgas() { return t_gas; }
  float getHgas() { return h_gas; }
  float getPenvMin() { return p0_env_min; }
  float getPenvMax() { return p0_env_max; }
  void FetchEnviropars();
  void ResetMinMax() { 
    p0_env_min = -1.; 
    p0_env_max = -1.; 
    updateWindow();
  }

private:
  void printc(const char*, ...);
  void print(const char*, ...);
  
private:
  char date_env[80];
  char time_env[80];
  float p0_env, t0_env, t1_env, h0_env, h1_env;
  float p0_env_min, p0_env_max;
  char date_gas[80];
  char time_gas[80];
  float t_gas, h_gas, p_gas;
  MainWindow *myMainWindow;
  QTimer *updateTimer;
  QLabel *EnvparsLabel[NEnvpars];
  QLineEdit *EnvparsLine[NEnvpars];
  QMutex mutex;
};

#endif
