diff --git a/VApp/src/App.vue b/VApp/src/App.vue index 7b7c5a16..eb6f81b3 100644 --- a/VApp/src/App.vue +++ b/VApp/src/App.vue @@ -1,19 +1,28 @@ - - - + + - + diff --git a/VApp/src/components/CardButtonScore.vue b/VApp/src/components/CardButtonScore.vue index 5f3c1471..b1c4201a 100644 --- a/VApp/src/components/CardButtonScore.vue +++ b/VApp/src/components/CardButtonScore.vue @@ -59,7 +59,7 @@ diff --git a/VApp/src/plugins/router.js b/VApp/src/plugins/router.js index b8a96dc6..4f248dc7 100644 --- a/VApp/src/plugins/router.js +++ b/VApp/src/plugins/router.js @@ -3,30 +3,36 @@ import HomeView from '../views/HomeView.vue' const router = createRouter({ history: createWebHistory(import.meta.env.BASE_URL), - routes: [ { - path: '/', - name: 'Accueil', - component: HomeView - }, - { - path: '/game/control', - name: 'Game Control (Présentateur)', - component: () => import('@/views/GameControl.vue') - }, - { - path: '/game/display', - name: 'Game Display (Projection)', - component: () => import('@/views/GameDisplay.vue') - }, - { - path: '/mqtt-debugger', - name: 'Debugger MQTT', - component: () => import('@/views/MQTTDebugView.vue') - }, - { - path: '/settings', - name: 'Paramètres', - component: () => import('@/views/SettingsView.vue') } + routes: [{ + path: '/', + name: 'Accueil', + component: HomeView + }, + { + path: '/game/control', + name: 'Game Control (Présentateur)', + component: () => import('@/views/GameControl.vue') + }, + { + path: '/game/display', + name: 'Game Display (Projection)', + component: () => import('@/views/GameDisplay.vue') + }, + { + path: '/score/display', + name: 'Score Display (Projection)', + component: () => import('@/views/ScoreDisplay.vue') + }, + { + path: '/mqtt-debugger', + name: 'Debugger MQTT', + component: () => import('@/views/MQTTDebugView.vue') + }, + { + path: '/settings', + name: 'Paramètres', + component: () => import('@/views/SettingsView.vue') + } ] }) diff --git a/VApp/src/plugins/vuetify.js b/VApp/src/plugins/vuetify.js index 4fa2f79f..bd7d687c 100644 --- a/VApp/src/plugins/vuetify.js +++ b/VApp/src/plugins/vuetify.js @@ -13,36 +13,38 @@ import { createVuetify } from 'vuetify' const CustomThemeDark = { dark: true, - colors: { - background: '#121212', - primary: '#d42828', - secondary: '#F44336', - accent: '#FFC107', - error: '#e91e1e', - warning: '#FFC107', - info: '#607D8B', - success: '#15B01B', - BlueBuzzer: '#2867d4', - YellowBuzzer: '#D4D100', - RedBuzzer: '#d42828', + colors: { + background: '#121212', + primary: '#d42828', + secondary: '#F44336', + accent: '#FFC107', + error: '#e91e1e', + warning: '#FFC107', + info: '#607D8B', + inactiveButton: '#707070ff', + success: '#15B01B', + BlueBuzzer: '#2867d4', + YellowBuzzer: '#D4D100', + RedBuzzer: '#d42828', GreenBuzzer: '#28d42e', DisconnectedBuzzer: '#595959', } } const CustomThemeLight = { dark: false, - colors: { - background: '#ffffff', - primary: '#d42828', - secondary: '#F44336', - accent: '#FFC107', - error: '#e91e1e', - warning: '#FFC107', - info: '#607D8B', - success: '#4CAF50', - BlueBuzzer: '#2867d4', - YellowBuzzer: '#D4D100', - RedBuzzer: '#d42828', + colors: { + background: '#ffffff', + primary: '#d42828', + secondary: '#F44336', + accent: '#FFC107', + error: '#e91e1e', + warning: '#FFC107', + info: '#607D8B', + inactiveButton: '#707070ff', + success: '#4CAF50', + BlueBuzzer: '#2867d4', + YellowBuzzer: '#D4D100', + RedBuzzer: '#d42828', GreenBuzzer: '#28d42e', DisconnectedBuzzer: '#595959', } @@ -50,10 +52,11 @@ const CustomThemeLight = { // https://vuetifyjs.com/en/introduction/why-vuetify/#feature-guides export default createVuetify({ - theme: { - defaultTheme: 'CustomThemeDark', - themes: { - CustomThemeDark, - CustomThemeLight, }, + theme: { + defaultTheme: 'CustomThemeDark', + themes: { + CustomThemeDark, + CustomThemeLight, + }, }, }) diff --git a/VApp/src/views/ScoreDisplay.vue b/VApp/src/views/ScoreDisplay.vue new file mode 100644 index 00000000..f46ea5f5 --- /dev/null +++ b/VApp/src/views/ScoreDisplay.vue @@ -0,0 +1,287 @@ + + + + + + Bleue + + Total + {{ scores.BlueTotalScore }} + + + + {{ scores.BlueRoundScore }} + + + + + + + {{ scores.RedRoundScore }} + + + Rouge + + Total + {{ scores.RedTotalScore }} + + + + + + + + Verte + + Total + {{ scores.GreenTotalScore }} + + + + {{ scores.GreenRoundScore }} + + + + + + + {{ scores.YellowRoundScore }} + + + Jaune + + Total + {{ scores.YellowTotalScore }} + + + + + + + 00:00 + + + + + + + diff --git a/VNode/services/buzzer/buzzer-manager.js b/VNode/services/buzzer/buzzer-manager.js index 1c63f3ee..d2ded3fc 100644 --- a/VNode/services/buzzer/buzzer-manager.js +++ b/VNode/services/buzzer/buzzer-manager.js @@ -1,8 +1,14 @@ // Import necessary modules const mqtt = require('mqtt'); +const fs = require('fs'); +const path = require('path'); + +// Load configuration +const configPath = path.join(__dirname, '../config/configuration.json'); +const config = JSON.parse(fs.readFileSync(configPath, 'utf8')); // MQTT broker configuration -const brokerUrl = 'mqtt://nanomq'; // Broker URL (change if needed) +const brokerUrl = config.mqttHost; const clientId = 'buzzer_manager'; const options = { clientId, diff --git a/VNode/services/buzzer/buzzer-watcher.js b/VNode/services/buzzer/buzzer-watcher.js index 498d10e5..fbf4ab54 100644 --- a/VNode/services/buzzer/buzzer-watcher.js +++ b/VNode/services/buzzer/buzzer-watcher.js @@ -4,10 +4,10 @@ const mqtt = require('mqtt'); const fs = require('fs'); // Lecture du fichier de configuration -const config = JSON.parse(fs.readFileSync(path.join('services','config','config_network.json'), 'utf8')); +const config = JSON.parse(fs.readFileSync(path.join(__dirname, '../config/configuration.json'), 'utf8')); // Extraction des informations de config -const { hosts: { buzzers: { IP: buzzerIPs, MQTTconfig: { mqttHost, mqttTopic } } } } = config; +const { mqttHost, hosts: { buzzers: { IP: buzzerIPs, MQTTconfig: { mqttTopic } } } } = config; // Connexion au broker MQTT const client = mqtt.connect(mqttHost); diff --git a/VNode/services/config/config_network.json b/VNode/services/config/config_network.json deleted file mode 100644 index fa788824..00000000 --- a/VNode/services/config/config_network.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "hosts": { - "buzzers": { - "IP": { - "redBuzzerIP": "192.168.73.40", - "blueBuzzerIP": "192.168.73.41", - "greenBuzzerIP": "192.168.73.42", - "yellowBuzzerIP": "192.168.73.43" - }, - "MQTTconfig": { - "mqttHost": "mqtt://nanomq", - "mqttTopic": "buzzer/watcher" - } - } - } -} \ No newline at end of file diff --git a/VNode/services/config/config_game.json b/VNode/services/config/configuration.json similarity index 52% rename from VNode/services/config/config_game.json rename to VNode/services/config/configuration.json index 9d873038..a930515f 100644 --- a/VNode/services/config/config_game.json +++ b/VNode/services/config/configuration.json @@ -1,6 +1,6 @@ { + "mqttHost": "mqtt://192.168.1.201", "services": { - "mqttHost": "mqtt://nanomq", "score": { "MQTTconfig": { "mqttScoreTopic": "game/score", @@ -13,5 +13,18 @@ "mqttQuizzCollectorCmdTopic": "game/quizz-collector/cmd" } } + }, + "hosts": { + "buzzers": { + "IP": { + "redBuzzerIP": "8.8.8.6", + "blueBuzzerIP": "8.8.8.8", + "greenBuzzerIP": "8.8.8.8", + "yellowBuzzerIP": "8.8.8.8" + }, + "MQTTconfig": { + "mqttTopic": "buzzer/watcher" + } + } } -} \ No newline at end of file +} diff --git a/VNode/services/game/quizz-collector.js b/VNode/services/game/quizz-collector.js index 1edbea59..63300539 100644 --- a/VNode/services/game/quizz-collector.js +++ b/VNode/services/game/quizz-collector.js @@ -3,10 +3,10 @@ const mqtt = require('mqtt'); const path = require('path'); // Lecture du fichier de configuration -const config = JSON.parse(fs.readFileSync(path.join('services','config','config_game.json'), 'utf8')); +const config = JSON.parse(fs.readFileSync(path.join(__dirname, '../config/configuration.json'), 'utf8')); // Extraction des informations de config -const { services: { mqttHost, quizzcollector: { MQTTconfig: { mqttQuizzCollectorListTopic, mqttQuizzCollectorCmdTopic } } } } = config; +const { mqttHost, services: { quizzcollector: { MQTTconfig: { mqttQuizzCollectorListTopic, mqttQuizzCollectorCmdTopic } } } } = config; // Configuration const folderPath = 'quizz'; // Remplace par le chemin de ton dossier @@ -39,9 +39,9 @@ function Collect() { console.error('Erreur lors de la lecture du dossier:', err); return; } - + console.log('Dossiers trouvés:', files); - const message = JSON.stringify( files ); + const message = JSON.stringify(files); client.publish(mqttQuizzCollectorListTopic, message, { qos: 1 }, (err) => { if (err) { console.error('Erreur lors de la publication MQTT:', err); diff --git a/VNode/services/game/score-manager.js b/VNode/services/game/score-manager.js index c1317517..519e363a 100644 --- a/VNode/services/game/score-manager.js +++ b/VNode/services/game/score-manager.js @@ -132,11 +132,11 @@ function updateTeamTotalScore(teamColor, points) { // Lecture du fichier de configuration -const configPath = path.join(__dirname, '../config/config_game.json'); +const configPath = path.join(__dirname, '../config/configuration.json'); const config = JSON.parse(fs.readFileSync(configPath, 'utf8')); // Extraction des informations de config -const { services: { mqttHost, score: { MQTTconfig: { mqttScoreTopic, mqttScoreChangeTopic } } } } = config; +const { mqttHost, services: { score: { MQTTconfig: { mqttScoreTopic, mqttScoreChangeTopic } } } } = config; console.log("DEBUG: Config loaded from:", configPath); console.log("DEBUG: MQTT Host:", mqttHost); console.log("DEBUG: Topics:", mqttScoreTopic, mqttScoreChangeTopic);