Prosim.h 2.17 KB
Newer Older
fmg005's avatar
fmg005 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
#ifndef Prosim_H
#define Prosim_H

#include <string>
#include <iostream>
#include <cstdio>
#include <chrono>
#include <thread>
#include <map>
#include <libconfig.h++>
#include "serial/serial.h"
#include "CLA_Logger.h"
#include "Environment.h"
#include "Action.h"
#include "Pump.h"
#include "Monitor.h"
#include "PatientOut.h"

/* Pulse header files */
#include "PulsePhysiologyEngine.h"
#include "properties/SEScalarTime.h"
#include "properties/SEScalarPressure.h"
#include "properties/SEScalarFrequency.h"
#include "engine/SEEngineTracker.h"
#include "system/physiology/SECardiovascularSystem.h"
#include "system/physiology/SEBloodChemistrySystem.h"
#include "system/physiology/SERespiratorySystem.h"

using namespace std;
using namespace libconfig;
using namespace std::chrono;

class Prosim : public PatientOut {
  private:
      serial::Serial* m_serial;
      CLA::Environment m_env;
      double systolic_pressure;
      double diastolic_pressure;
      double heart_rate;
      double resp_rate;
      double oxygen_sat;
      std::shared_ptr<CLA::LOGGER> m_logger;
      std::map<std::string, CLA::Pump*> m_pumps;
      size_t SendCommand(string);
      string GetResponse();
      void Clear();
      string mode;
      /* chrono */
      system_clock::time_point m_start;
      system_clock::time_point m_engine_advance_end;
      system_clock::time_point m_command_start;
      system_clock::time_point m_command_end;
      system_clock::time_point m_infusion_start;
      system_clock::time_point m_infusion_end;
      time_t m_delta;
      time_t m_next_update_time;
      time_t m_engine_duration_ms;
      time_t m_command_duration_ms;
      time_t m_infusion_duration_ms;
      time_t m_next_update_time_duration_ms;
      time_t m_total_duration_ms;

  public:
      Prosim(std::shared_ptr<CLA::LOGGER>& logger, CLA::Environment&,\
             std::map<std::string, CLA::Pump*>&);
      ~Prosim();
      bool isOpen();
      void SetHeartRate(double);
      void SetRespRate(double);
      void SetOxygenSat(double);
      void SetIBP(int, double, double);
      void SetRemoteMode();
      void SetLocalMode();
      string GetCurrentMode();
      void update(std::unique_ptr<PhysiologyEngine>&);
};

#endif