Skip to content
Snippets Groups Projects
Commit 9cdc49d2 authored by Malaurie Bernard's avatar Malaurie Bernard
Browse files

Working on syringe database with arduino json

parent 2673dbfc
No related branches found
No related tags found
1 merge request!17Malaurie's work on UI + CLI interface + AccelStepper interface
......@@ -3,26 +3,19 @@
#include "syringe.h"
Syringe syringe;
StaticJsonDocument<200> Syringe :: syringe_json; //200 = RAM allocated to this document
//CONSTRUCTORS
//CONSTRUCTOR
Syringe :: Syringe()
{
//First Syringe
Serial.println("okk");
set_syringe("BD_10mL", "300912","BD", 10, 14.5);
set_syringe("Terumo_5mL", "0197","Terumo", 5, 10);
}
Syringe :: Syringe(String name, string ref, string brand, float total_volume_mL, float internal_diameter_mm)
{
set_ref(name, ref);
set_brand(name, brand);
set_total_volume_mL(name, total_volume_mL);
set_internal_diameter_mm(name, internal_diameter_mm);
}
//SET METHODS
void Syringe :: set_syringe(String name, string ref, string brand, float total_volume_mL, float internal_diameter_mm)
......@@ -82,6 +75,10 @@ const StaticJsonDocument<200>& Syringe :: get_syringe_database()
{
return syringe_json;
}
const JsonObject Syringe :: get_syringe_database_object()
{
return syringe_json.as<JsonObject>();
}
//CONFIGURATION
......@@ -111,9 +108,9 @@ void Syringe :: write_Json ()
-Action : Save the Json structure in a file (convert it to text)
***/
{
InterruptLock lock; //useful thanks to its constructor (so a is not visible in the code)
File f = filesystem->open("syringe_json", "w"); //Creation du fichier
serializeJson(syringe_json, f);
//InterruptLock lock; //useful thanks to its constructor (so a is not visible in the code)
//File f = filesystem->open("syringe_json", "w"); //Creation du fichier
serializeJson(syringe_json, Serial); //remettre f a la plce de json
}
......
......@@ -29,10 +29,9 @@ class Syringe
public :
//CONSTRUCTORS
//CONSTRUCTOR
Syringe(); //There is no arguments because we add the generic syringe to use
Syringe(String name, string ref, string brand, float total_volume_mL, float internal_diameter_mm); //There are arguments because we need to know what values to add in the Json document (no default syringe)
//SET METHODS
void set_syringe(String name, string ref, string brand, float total_volume_mL, float internal_diameter_mm);
......@@ -46,8 +45,11 @@ class Syringe
string get_brand(String name);
float get_total_volume_mL(String name);
float get_internal_diameter_mm(String name);
static const StaticJsonDocument<200>& get_syringe_database();
const JsonObject get_syringe_database_object();
//CONFIGURATION
bool check_configuration(String name);
......
......@@ -4,6 +4,7 @@
#include <DNSServer.h>
#include <ESPUI.h> // https://github.com/s00500/ESPUI
#include <ArduinoJson.h>
#include "common.h"
#include "syringe.h"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment