diff --git a/.gitignore b/.gitignore index cfca2eb..c83fb2b 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,5 @@ secrets.h arduino/MQTT/secret.h arduino/MQTT/secrets.h venv -rule-listener/secrets.py \ No newline at end of file +rule-listener/secrets.py +visualiser/secrets.el \ No newline at end of file diff --git a/README.md b/README.md index dfb3237..bb9847b 100644 --- a/README.md +++ b/README.md @@ -6,30 +6,13 @@ date: Tuesday, October 22, 2024 # Listening Daemon -Current structure of the repository +Communication between things in this room goes via a server running a +Message Queuing Telemetry Transport (MQTT) broker. MQTT is a protocol +for communication in which participants publish and subscribe to +so-called topics. The broker acts a centralised point of exchange in +this process, ensuring messages reach their intended targets. -``` -. -├── arduino -│ ├── motor_shield_one -│ │ ├── makefile -│ │ └── motor_shield_one.ino -│ ├── motor_shield_two -│ │ ├── makefile -│ │ └── motor_shield_two.ino -│ ├── relay_shield -│ │ ├── makefile -│ │ └── relay_shield.ino -│ └── sensors -│ ├── makefile -│ └── sensors.ino -└── tidal - ├── boot - └── compositions -``` - -The `arduino` directory contains code for each microcontroller. - - -The `tidal` directory features a combination of boot files and -compositions. +The server is also hosting the webpage displayed on the screen. The +server is the Klankschool server. Klankschool are a growing community +of people working with sound in and around Rotterdam, which both of us +are part of. \ No newline at end of file diff --git a/visualiser/main.html b/visualiser/main.html deleted file mode 100644 index bf17de8..0000000 --- a/visualiser/main.html +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/visualiser/main.svg b/visualiser/main.svg deleted file mode 100644 index 6375e96..0000000 --- a/visualiser/main.svg +++ /dev/null @@ -1,154 +0,0 @@ - - - - - - - - - -fan_one - - - - -fan_two - - - - -fan_one--fan_two - - - - -radio_one - - - - -fan_one--radio_one - - - - -lamp_one - - - - - -fan_one--lamp_one - - - - -lamp_two - - - - - -fan_one--lamp_two - - - - -printer_one - - - - -fan_one--printer_one - - - - -printer_two - - - - -fan_one--printer_two - - - - -fan_two--radio_one - - - - -fan_two--lamp_one - - - - -fan_two--lamp_two - - - - -fan_two--printer_one - - - - -fan_two--printer_two - - - - -radio_one--lamp_one - - - - -radio_one--lamp_two - - - - -radio_one--printer_one - - - - -radio_one--printer_two - - - - -lamp_one--lamp_two - - - - -lamp_one--printer_one - - - - -lamp_one--printer_two - - - - -lamp_two--printer_one - - - - -lamp_two--printer_two - - - - -printer_one--printer_two - - - - diff --git a/visualiser/main.el b/visualiser/visualiser.el similarity index 87% rename from visualiser/main.el rename to visualiser/visualiser.el index 8c753a2..4602367 100644 --- a/visualiser/main.el +++ b/visualiser/visualiser.el @@ -1,15 +1,20 @@ +;; visualiser.el +(load-file "~/.emacs.d/elpa/dash-20240510.1327/dash.elc") +(load-file "~/.emacs.d/elpa/mqtt-mode-20180611.1735/mqtt-mode.elc") + + (require 'dash) (require 'mqtt-mode) -;; (toggle-debug-on-error) -(setq mqtt-host "mqtt.klank.school") -(setq mqtt-port 7000) +(toggle-debug-on-error) ;; directory variables (defconst graphviz-command "circo") -(defconst graph-output-format "svg") -(defconst graph-dir "graphs/") -(defconst image-dir (concat graph-output-format "s/")) -(defconst working-directory "/home/riviera/XPUB2/public-moment/performance/") +(defconst graphviz-graph-output-format "svg") +(defconst graphviz-graph-output-dir "graphs/") +(defconst graphviz-image-output-dir (concat graphviz-graph-output-format "s/")) +(defconst working-directory "~/Applications/listeningdaemon/visualiser/") + +(load-file (concat working-directory "secrets.el")) ;; colors ;; (defconst on-color "black" "The default color for objects which are active") @@ -116,17 +121,17 @@ (defun graph-write-file-quietly () "Write the graph buffer to a graphviz file quietly" (let ((inhibit-message t)) - (write-file (concat working-directory graph-dir "graph" (number-to-string snapshot) ".dot") t))) + (write-file (concat working-directory graphviz-graph-output-dir "graph" (number-to-string snapshot) ".dot") t))) (defun format-graph-image-numbered () "format the numbered image of the graph quietly, for the .gif" (let ((inhibit-message t)) (shell-command - (concat graphviz-command " -T" graph-output-format " " - working-directory graph-dir (concat "graph" (number-to-string snapshot) ".dot") + (concat graphviz-command " -T" graphviz-graph-output-format " " + working-directory graphviz-graph-output-dir (concat "graph" (number-to-string snapshot) ".dot") " -o " - working-directory image-dir - (concat "graph" (number-to-string snapshot) "." graph-output-format))))) + working-directory graphviz-image-output-dir + (concat "graph" (number-to-string snapshot) "." graphviz-graph-output-format))))) (defun format-graph-image-main () "format the image of the main graph quietly" @@ -134,13 +139,14 @@ nil (let ((inhibit-message t)) (shell-command - (concat graphviz-command " -T" graph-output-format " " - working-directory graph-dir (concat "graph" (number-to-string snapshot) ".dot") + (concat graphviz-command " -T" graphviz-graph-output-format " " + working-directory graphviz-graph-output-dir (concat "graph" (number-to-string snapshot) ".dot") " -o " - working-directory "main." graph-output-format + ;; working-directory "main." graphviz-graph-output-format + ;; output the generated image to /var/www/ so that the webpage stays updated + "/var/www/img/main." graphviz-graph-output-format )))) - - + (defun format-graph () "Series of functions to format the graph to display in the browser and ultimately turn into a .gif" @@ -277,5 +283,5 @@ and ultimately turn into a .gif" )))))) (format-graph) -(start-process-shell-command "browser" nil (concat "firefox " working-directory "main.html --kiosk")) +;; (start-process-shell-command "browser" nil (concat "firefox " working-directory "main.html --kiosk")) (mqtt-start-consumer) diff --git a/web/index.html b/web/index.html new file mode 100644 index 0000000..cb5ac3a --- /dev/null +++ b/web/index.html @@ -0,0 +1,17 @@ + + + + + + + + free / abandoned / open / obsolete + + + + + + + diff --git a/web/refreshImage.js b/web/refreshImage.js new file mode 100644 index 0000000..78637fc --- /dev/null +++ b/web/refreshImage.js @@ -0,0 +1,10 @@ +var newImage = new Image(); +newImage.src = "img/main.svg"; + +function updateImage() { + if(newImage.complete) { + document.getElementById("dynamicImage").src = newImage.src; + newImage = new Image(); + newImage.src = "img/main.svg#" + new Date().getTime(); + } +} diff --git a/visualiser/main.css b/web/style.css similarity index 100% rename from visualiser/main.css rename to web/style.css