Skip to content
Snippets Groups Projects
syringe.h 1.13 KiB

#pragma once

#include "motor.h"

#include <ArduinoJson.h>
#include <interrupts.h> // InterruptLock
using InterruptLock = esp8266::InterruptLock;

#include <iostream>
using namespace std;


#include "fs.h"

class Syringe
{
  private :

  String _name; //Would be used as the key
  float _total_volume_mL;
  float _internal_diameter_mm;

  //JSON DOCUMENT
  StaticJsonDocument<200> syringe_json;  //200 = RAM allocated to this document

  public :
  
  //CONSTRUCTOR
  Syringe(); //There is no arguments because we add the generic syringe to use
 
  //SET METHODS
  void set_syringe(String name, float total_volume_mL, float internal_diameter_mm);

  void set_total_volume_mL(String name, float total_volume_mL);
  void set_internal_diameter_mm(String name, float internal_diameter_mm);

  //GET METHODS
  float get_total_volume_mL(String name);
  float get_internal_diameter_mm(String name);

  const StaticJsonDocument<200>& get_syringe_database();

  const JsonObject get_syringe_database_object();

  //CONFIGURATION
  bool check_configuration(String name);

  //JSON METHODS
  void write_Json ();
  void read_Json ();

};

extern Syringe syringe;