diff --git a/src/lib/SensorGroup.svelte b/src/lib/SensorGroup.svelte index 75c0daa..ad3b295 100644 --- a/src/lib/SensorGroup.svelte +++ b/src/lib/SensorGroup.svelte @@ -6,6 +6,7 @@ export let timeChunkSize: number = -1; export let freqSampleRate: number = -1; export let freqChunkSize: number = -1; + export let sourceIdentifier: string = '-'; // export let TimeDomainChart; // export let TimeDomainYValues = [0]; @@ -63,7 +64,7 @@
-
Test
+
Sensor ID: {sourceIdentifier}
diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index 2583d4b..91a23cf 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -28,16 +28,7 @@ timeChunkSize: number; freqSampleRate: number; freqChunkSize: number; - }[] = [ - { - timeSampleRate: 1000, - timeChunkSize: 512, - freqSampleRate: 1000, - freqChunkSize: 512 - } - // Add more objects as needed for multiple SensorGroup components - // ... - ]; + }[] = []; // Callback function used to connect to the websocket, retrieve data // and update the time domain plot @@ -56,16 +47,6 @@ let parsedData = null; let datasets = []; - // sensorGroup = [ - // ...sensorGroup, - // { - // timeSampleRate: 1000, - // timeChunkSize: 512, - // freqSampleRate: 1000, - // freqChunkSize: 512 - // } - // ]; - // console.log(sensorGroup); TimeWebSocket.addEventListener('message', async (event) => { @@ -89,6 +70,19 @@ }; datasets.push(dataset); } + + console.log(parsedData['TimeChunk']['SourceIndentifier']); + + sensorGroup = [ + ...sensorGroup, + { + timeSampleRate: JSON.parse(event.data)['TimeChunk']['SampleRate'], + timeChunkSize: JSON.parse(event.data)['TimeChunk']['ChunkSize'], + sourceIdentifier: JSON.parse(event.data)['TimeChunk']['SourceIndentifier'], + freqSampleRate: 1000, + freqChunkSize: 512 + } + ]; } // const newData = JSON.parse(event.data)['TimeChunk']['Channels']; // const numChannels = JSON.parse(event.data)['TimeChunk']['NumChannels'];