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

Changing th attributs id to ref in Syringe, and adding the attribut brand and its setter and getter

parent 4380891d
No related branches found
No related tags found
1 merge request!17Malaurie's work on UI + CLI interface + AccelStepper interface
...@@ -4,17 +4,39 @@ ...@@ -4,17 +4,39 @@
#include "syringe.h" #include "syringe.h"
//CONSTRUCTORS //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_total_volume_mL(total_volume_mL);
set_internal_diameter_mm(internal_diameter_mm); set_internal_diameter_mm(internal_diameter_mm);
set_id(id);
} }
//SET METHODS //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) void Syringe :: set_total_volume_mL(float total_volume_mL)
{ {
SyringeJSON["total_volume_mL"] = total_volume_mL; SyringeJSON["total_volume_mL"] = total_volume_mL;
...@@ -25,13 +47,21 @@ void Syringe :: set_internal_diameter_mm(float internal_diameter_mm) ...@@ -25,13 +47,21 @@ void Syringe :: set_internal_diameter_mm(float internal_diameter_mm)
SyringeJSON["internal_diameter_mm"] = internal_diameter_mm; SyringeJSON["internal_diameter_mm"] = internal_diameter_mm;
} }
void Syringe :: set_id(string id){
SyringeJSON["id"] = id;
}
//GET METHODS //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() float Syringe :: get_total_volume_mL()
{ {
return SyringeJSON["total_volume_mL"].as<float>(); return SyringeJSON["total_volume_mL"].as<float>();
...@@ -42,10 +72,6 @@ float Syringe :: get_internal_diameter_mm() ...@@ -42,10 +72,6 @@ float Syringe :: get_internal_diameter_mm()
return SyringeJSON["internal_diameter_mm"].as<float>(); 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 //Example : File f = ({ InterruptLock lock; filesystem->open(filename, "w"); }); and the f becomes the argument output_stream
......
...@@ -15,24 +15,32 @@ class Syringe ...@@ -15,24 +15,32 @@ class Syringe
{ {
private : private :
string _ref;
string brand;
float _total_volume_mL; float _total_volume_mL;
float _internal_diameter_mm; float _internal_diameter_mm;
int _id;
public : public :
//CONSTRUCTORS //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 //SET METHODS
void set_ref(string ref);
void set_brand(string brand);
void set_total_volume_mL(float total_volume_mL); void set_total_volume_mL(float total_volume_mL);
void set_internal_diameter_mm(float internal_diameter_mm); void set_internal_diameter_mm(float internal_diameter_mm);
void set_id(string id);
//GET METHODS //GET METHODS
string get_ref();
string get_brand();
float get_total_volume_mL(); float get_total_volume_mL();
float get_internal_diameter_mm(); float get_internal_diameter_mm();
string get_id();
//JSON DOCUMENT //JSON DOCUMENT
StaticJsonDocument<200> SyringeJSON; //200 = RAM allocated to this document StaticJsonDocument<200> SyringeJSON; //200 = RAM allocated to this document
......
...@@ -9,7 +9,7 @@ SyringeFilled :: SyringeFilled() : Motor (&ISRStepper) //pb with my motor constr ...@@ -9,7 +9,7 @@ SyringeFilled :: SyringeFilled() : Motor (&ISRStepper) //pb with my motor constr
set_exchange_volume_mL(1); set_exchange_volume_mL(1);
set_remaining_volume_mL(1); set_remaining_volume_mL(1);
set_push(true); 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_screw_thread_mm(4);
set_clockwise_equals_push(true); set_clockwise_equals_push(true);
set_emergency(false); set_emergency(false);
......
...@@ -41,7 +41,7 @@ class SyringeFilled : public Motor ...@@ -41,7 +41,7 @@ class SyringeFilled : public Motor
public : public :
//CONSTRUCTORS //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 //SET METHODS
......
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