From 12909d365089313c468d2d1bac50464a52a0cf7e Mon Sep 17 00:00:00 2001 From: Sietse Jonker Date: Tue, 26 Mar 2024 11:01:16 +0100 Subject: [PATCH] Add Node and Graph classes for website functionality --- .../{graph_classes.md => classes-website.md} | 43 ++++++++++--------- web/classes.js | 2 +- 2 files changed, 24 insertions(+), 21 deletions(-) rename docs/brainstorm/SoftwareDocumentatie/{graph_classes.md => classes-website.md} (82%) diff --git a/docs/brainstorm/SoftwareDocumentatie/graph_classes.md b/docs/brainstorm/SoftwareDocumentatie/classes-website.md similarity index 82% rename from docs/brainstorm/SoftwareDocumentatie/graph_classes.md rename to docs/brainstorm/SoftwareDocumentatie/classes-website.md index 0acf0e1..9da4e19 100644 --- a/docs/brainstorm/SoftwareDocumentatie/graph_classes.md +++ b/docs/brainstorm/SoftwareDocumentatie/classes-website.md @@ -22,30 +22,24 @@ The nodes are the devices that are placed in the rooms. The nodes are used to co ```mermaid classDiagram + + Node <-- SensorNode : extends + Node <-- FeedbackNode : extends + class Node { +nodeID +processNodeData() +updateNodeData() } -``` -#### Sensornode - -```mermaid -classDiagram - class SensorNode extends Node { + class SensorNode { +tempArray +humiArray +eco2Array +tvocArray } -``` -#### Feedbacknode - -```mermaid -classDiagram - class FeedbackNode extends Node { + class FeedbackNode { +feedbackArray } ``` @@ -68,19 +62,16 @@ The graphs are used to display the data from the sensors. The data is collected ### Graphs -```mermaid +```mermaid classDiagram + + liveGraph --> graph: extends class graph { +nodeId makeGraph() } -``` -### Live graphs - -```mermaid -classDiagram - class liveGraph extends graph { + class liveGraph { +cnt +timeArray +tempArray @@ -91,8 +82,8 @@ classDiagram updateGraph() updateData() } -``` +``` ## Order of operations ### Live graphs @@ -114,4 +105,16 @@ sequenceDiagram 3. The website updates the data coming from the raspberry pi on its own variables and arrays 4. The website updates the live graphs every time new data is received from the websocket +### Node +```mermaid +sequenceDiagram + participant Node + participant Raspberry pi + participant Website + + Node->>Raspberry pi: node data via websocket every 5 seconds + Raspberry pi->>Website: Make a new object depending on what node it is + Website->>Website: updateNodeData() + Website->>Website: processNodeData() +``` diff --git a/web/classes.js b/web/classes.js index 50e0e26..9ce53a8 100644 --- a/web/classes.js +++ b/web/classes.js @@ -38,7 +38,7 @@ class feedbackNode extends node { } } -class liveGraph extends node { +class liveGraph extends graph { // Constructor to initialize the graph constructor(id) { super(id);