@@ -127,30 +127,39 @@ <h2 class="text-xl font-semibold text-gray-700 dark:text-gray-200">Applications<
127
127
</ footer >
128
128
< script >
129
129
const apps = [
130
- { title : 'ECG with Heart Rate' , icon : 'fa-heartbeat' , color : 'cyan' } ,
131
- { title : 'EMG with Envelope' , icon : 'fa-wave-square' , color : 'red' } ,
132
- { title : 'EOG with Blinks' , icon : 'fa-chart-line ' , color : 'purple' } ,
133
- { title : 'EEG with FFT' , icon : 'fa-hand-holding-water ' , color : 'green' } ,
134
- { title : 'EEG Tug of War game' , icon : 'fa-brain ' , color : 'yellow' } ,
135
- { title : 'EEG Beetle Game' , icon : 'fa-eye ' , color : 'pink' } ,
136
- { title : 'EOG Keystroke Emualtor ' , icon : 'fa-lungs ' , color : 'blue' } ,
137
- { title : 'GUI Visualization' , icon : 'fa-heart-pulse ' , color : 'orange' } ,
138
- { title : 'CSV Plotter' , icon : 'fa-thermometer-half ' , color : 'teal' } ,
130
+ { title : 'ECG with Heart Rate' , icon : 'fa-heartbeat' , color : 'cyan' , script : 'heartbeat_ecg' } ,
131
+ { title : 'EMG with Envelope' , icon : 'fa-wave-square' , color : 'red' , script : 'emgenvelope' } ,
132
+ { title : 'EOG with Blinks' , icon : 'fa-eye ' , color : 'purple' , script : 'eog ' } ,
133
+ { title : 'EEG with FFT' , icon : 'fa-brain ' , color : 'green' , script : 'ffteeg ' } ,
134
+ { title : 'EEG Tug of War game' , icon : 'fa-gamepad ' , color : 'yellow' , script : 'game ' } ,
135
+ { title : 'EEG Beetle Game' , icon : 'fa-bug ' , color : 'pink' , script : 'beetle ' } ,
136
+ { title : 'EOG Keystroke Emulator ' , icon : 'fa-keyboard ' , color : 'blue' , script : 'keystroke ' } ,
137
+ { title : 'GUI Visualization' , icon : 'fa-chart-bar ' , color : 'orange' , script : 'gui ' } ,
138
+ { title : 'CSV Plotter' , icon : 'fa-chart-line ' , color : 'teal' , script : 'csvplotter ' } ,
139
139
] ;
140
140
141
141
const appGrid = document . getElementById ( 'app-grid' ) ;
142
142
apps . forEach ( app => {
143
143
const card = document . createElement ( 'div' ) ;
144
- card . className = 'bg-gradient-to-b from-white to-gray-50 dark:from-gray-700 dark:to-gray-800 rounded-xl shadow border hover:shadow-lg transition duration-300 dark:border-gray-700' ;
144
+ card . className = 'bg-gradient-to-b from-white to-gray-50 dark:from-gray-700 dark:to-gray-800 rounded-xl shadow border hover:shadow-lg transition duration-300 dark:border-gray-700 cursor-pointer ' ;
145
145
card . innerHTML = `
146
146
<div class="p-4">
147
147
<div class="w-full h-32 bg-${ app . color } -100 dark:bg-${ app . color } -900 rounded-lg flex items-center justify-center mb-4">
148
148
<i class="fas ${ app . icon } text-4xl text-${ app . color } -600 dark:text-${ app . color } -300"></i>
149
149
</div>
150
150
<h3 class="text-lg font-semibold text-gray-800 dark:text-gray-200 mb-1">${ app . title } </h3>
151
- <p class="text-sm text-gray-600 dark:text-gray-400">Sample description for ${ app . title } </p>
151
+ <p class="text-sm text-gray-600 dark:text-gray-400">Click to launch ${ app . title } </p>
152
152
</div>
153
153
` ;
154
+
155
+ card . addEventListener ( 'click' , ( ) => {
156
+ if ( ! isConnected ) {
157
+ showAlert ( 'Please start LSL Stream first by any protocol (USB/WIFI/BLE)' ) ;
158
+ return ;
159
+ }
160
+ launchApplication ( app . script ) ;
161
+ } ) ;
162
+
154
163
appGrid . appendChild ( card ) ;
155
164
} ) ;
156
165
@@ -462,6 +471,25 @@ <h3 class="text-lg font-semibold text-gray-800 dark:text-gray-200 mb-1">${app.ti
462
471
startConsoleUpdates ( ) ;
463
472
}
464
473
474
+ function launchApplication ( appName ) {
475
+ fetch ( '/launch_app' , {
476
+ method : 'POST' ,
477
+ headers : { 'Content-Type' : 'application/json' } ,
478
+ body : JSON . stringify ( { app : appName } )
479
+ } )
480
+ . then ( response => response . json ( ) )
481
+ . then ( data => {
482
+ if ( data . status === 'success' ) {
483
+ // showStatus(`Launched ${appName} application`, 'fa-check-circle', 'text-green-500');
484
+ } else {
485
+ showAlert ( `Failed to launch ${ appName } : ${ data . message } ` ) ;
486
+ }
487
+ } )
488
+ . catch ( error => {
489
+ showAlert ( `Error launching ${ appName } : ${ error . message } ` ) ;
490
+ } ) ;
491
+ }
492
+
465
493
// Handle disconnect button
466
494
disconnectBtn . addEventListener ( 'click' , async ( ) => {
467
495
try {
0 commit comments