From 7f6b21e5fc3cf072ff7a3d4b8ab289318c41201e Mon Sep 17 00:00:00 2001 From: Malaurie Bernard <mbernard@kinouby> Date: Fri, 30 Jun 2023 14:24:28 +0200 Subject: [PATCH] Creation of the pump syringe class with basic functions (setters and getters) done with a json document --- pumpsyringe.cpp | 63 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 pumpsyringe.cpp diff --git a/pumpsyringe.cpp b/pumpsyringe.cpp new file mode 100644 index 0000000..92e3a11 --- /dev/null +++ b/pumpsyringe.cpp @@ -0,0 +1,63 @@ + +#include "pumpsyringe.h" + +//SET METHODS +void PumpSyringe :: set_screw_thread_mm(float screw_thread_mm) +{ + PumpSyringeJSON["screw_thread_mm"] = screw_thread_mm; +} + +void PumpSyringe :: set_clockwise_equals_forward(bool clockwise_equals_forward) +{ + PumpSyringeJSON["clockwise_equals_forward"] = clockwise_equals_forward; +} + +void PumpSyringe :: set_id(int id) +{ + PumpSyringeJSON["id"] = id; +} + + + +//GET METHODS +float PumpSyringe :: get_screw_thread_mm() +{ + return PumpSyringeJSON["screw_thread_mm"].as<float>(); +} + +bool PumpSyringe :: get_clockwise_equals_forward() +{ + return PumpSyringeJSON["clockwise_equals_forward"].as<float>(); +} + +int PumpSyringe :: get_id() +{ + return PumpSyringeJSON["id"].as<float>(); +} + + + + + +void PumpSyringe :: setupJsonPumpSyringe(float screw_thread_mm, bool clockwise_equals_forward, int id) +{ + + //ADD INITIALISATION VALUES TO THE DOC + PumpSyringeJSON["screw_thread_mm"] = screw_thread_mm; + PumpSyringeJSON["clockwise_equals_forward"] = clockwise_equals_forward; + PumpSyringeJSON["id"] = id; + + + //GENERATE THE MINIFIED JSON AND SEND IT TO THE SERIAL PORT + serializeJson(PumpSyringeJSON, Serial); + +} + + + + + + + + + -- GitLab