Skip to content

Commit

Permalink
Feat: Adding sensor ID to group
Browse files Browse the repository at this point in the history
  • Loading branch information
Grabt234 committed Nov 24, 2023
1 parent bb03ec8 commit cdcdced
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 21 deletions.
3 changes: 2 additions & 1 deletion src/lib/SensorGroup.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
export let timeChunkSize: number = -1;

Check failure on line 6 in src/lib/SensorGroup.svelte

View workflow job for this annotation

GitHub Actions / lint

Type number trivially inferred from a number literal, remove type annotation
export let freqSampleRate: number = -1;

Check failure on line 7 in src/lib/SensorGroup.svelte

View workflow job for this annotation

GitHub Actions / lint

Type number trivially inferred from a number literal, remove type annotation
export let freqChunkSize: number = -1;

Check failure on line 8 in src/lib/SensorGroup.svelte

View workflow job for this annotation

GitHub Actions / lint

Type number trivially inferred from a number literal, remove type annotation
export let sourceIdentifier: string = '-';

Check failure on line 9 in src/lib/SensorGroup.svelte

View workflow job for this annotation

GitHub Actions / lint

Type string trivially inferred from a string literal, remove type annotation
// export let TimeDomainChart;
// export let TimeDomainYValues = [0];
Expand Down Expand Up @@ -63,7 +64,7 @@
</script>

<div class-="sensorGroup">
<div class="sensorGroupTitle">Test</div>
<div class="sensorGroupTitle">Sensor ID: {sourceIdentifier}</div>
<div class="graphSuperGroup">
<div class="graphGroup">
<div class="parameterContainer">
Expand Down
34 changes: 14 additions & 20 deletions src/routes/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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) => {
Expand All @@ -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'];
Expand Down

0 comments on commit cdcdced

Please sign in to comment.