diff --git a/syringe.cpp b/syringe.cpp index 25a7a27744391e9864e5cb359c0523584ce8bc15..e8903c49c52c5b20a8cabe112aac748c24a12691 100644 --- a/syringe.cpp +++ b/syringe.cpp @@ -4,17 +4,39 @@ #include "syringe.h" //CONSTRUCTORS -Syringe :: Syringe(float total_volume_mL, float internal_diameter_mm, string id) +Syringe :: Syringe() { + //First Syringe + set_ref("300912"); + set_brand("BD"); + set_total_volume_mL(10); + set_internal_diameter_mm(14.5); + +} + +Syringe :: Syringe(string ref, string brand, float total_volume_mL, float internal_diameter_mm) +{ + set_ref(ref); + set_brand(brand); set_total_volume_mL(total_volume_mL); set_internal_diameter_mm(internal_diameter_mm); - set_id(id); + } //SET METHODS +void Syringe :: set_ref(string ref) +{ + SyringeJSON["ref"] = ref; +} + +void Syringe :: set_brand(string brand) +{ + SyringeJSON["brand"] = brand; +} + void Syringe :: set_total_volume_mL(float total_volume_mL) { SyringeJSON["total_volume_mL"] = total_volume_mL; @@ -25,13 +47,21 @@ void Syringe :: set_internal_diameter_mm(float internal_diameter_mm) SyringeJSON["internal_diameter_mm"] = internal_diameter_mm; } -void Syringe :: set_id(string id){ - SyringeJSON["id"] = id; -} + //GET METHODS +string Syringe :: get_ref() +{ + return SyringeJSON["ref"].as<string>(); +} + +string Syringe :: get_brand( ) +{ + return SyringeJSON["brand"].as<string>; +} + float Syringe :: get_total_volume_mL() { return SyringeJSON["total_volume_mL"].as<float>(); @@ -42,10 +72,6 @@ float Syringe :: get_internal_diameter_mm() return SyringeJSON["internal_diameter_mm"].as<float>(); } -string Syringe :: get_id() -{ - return SyringeJSON["id"].as<string>(); -} //Example : File f = ({ InterruptLock lock; filesystem->open(filename, "w"); }); and the f becomes the argument output_stream diff --git a/syringe.h b/syringe.h index 4f1d06f65914431bfbe7271bc4a451cda47bac81..b7d8f5d514832c7050b8fe4327285548c3977286 100644 --- a/syringe.h +++ b/syringe.h @@ -15,24 +15,32 @@ class Syringe { private : + string _ref; + string brand; float _total_volume_mL; float _internal_diameter_mm; - int _id; + + public : //CONSTRUCTORS - Syringe(float total_volume_mL, float internal_diameter_mm, string id); //There are arguments because we need to know what values to add in the Json document (no default syringe) + Syringe(); //There is no arguments because we add the generic syringe to use + Syringe(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_ref(string ref); + void set_brand(string brand); void set_total_volume_mL(float total_volume_mL); void set_internal_diameter_mm(float internal_diameter_mm); - void set_id(string id); + //GET METHODS + string get_ref(); + string get_brand(); float get_total_volume_mL(); float get_internal_diameter_mm(); - string get_id(); + //JSON DOCUMENT StaticJsonDocument<200> SyringeJSON; //200 = RAM allocated to this document diff --git a/syringefilled.cpp b/syringefilled.cpp index 27d7521d98a21576863a2c2e38de412ff12fe8a8..8fd865c902db3dff86705b1be89cb1b184452fca 100644 --- a/syringefilled.cpp +++ b/syringefilled.cpp @@ -9,7 +9,7 @@ SyringeFilled :: SyringeFilled() : Motor (&ISRStepper) //pb with my motor constr set_exchange_volume_mL(1); set_remaining_volume_mL(1); set_push(true); - set_id_syringe(??); //put one of the syringes stored by default, undefined for now + set_id_syringe("300912"); set_screw_thread_mm(4); set_clockwise_equals_push(true); set_emergency(false); diff --git a/syringefilled.h b/syringefilled.h index 6727883e465de31038b3664395ce6f5692d7ce10..98934aa87886f867c01e44d64bbcc625e9e7f230 100644 --- a/syringefilled.h +++ b/syringefilled.h @@ -41,7 +41,7 @@ class SyringeFilled : public Motor public : //CONSTRUCTORS - SyringeFilled(); + SyringeFilled(); //No arguments because we are going to have only one syringe filled and we are going to change its attributs values //SET METHODS