feat: render particle clouds for selected tags

This commit is contained in:
2026-05-16 22:07:18 +02:00
parent b3f199b431
commit 181dcdc30e
9 changed files with 171 additions and 43 deletions
@@ -53,13 +53,21 @@ class PhoenixTagRepository implements TagRepository {
});
@override
Stream<List<Particle>> watchParticleCloud() =>
realtime.channel('localiserd').map((payload) {
final list = payload['particles'] as List<dynamic>? ?? [];
return list
.map((j) => Particle.fromJson(j as Map<String, dynamic>))
.toList();
});
Stream<ParticleSnapshot> watchParticleCloud(String tagId) =>
realtime
.channelMessages('particles:$tagId')
.where((m) => m.event == 'particles_updated')
.map((m) {
final est = m.payload['estimate'] as Map<String, dynamic>;
final list = m.payload['particles'] as List<dynamic>;
return ParticleSnapshot(
tagId: tagId,
estimate: Estimate.fromJson(est),
particles: list
.map((j) => Particle.fromJson(j as Map<String, dynamic>))
.toList(),
);
});
@override
Stream<Map<int, List<String>>> watchRoomOccupancy() async* {
+2 -2
View File
@@ -11,8 +11,8 @@ abstract class TagRepository {
/// Live stream of all tag positions, pushed by localiserd over Phoenix channel.
Stream<List<TagPosition>> watchPositions();
/// Live stream of particle filter cloud snapshots.
Stream<List<Particle>> watchParticleCloud();
/// Live stream of particle filter cloud snapshots for [tagId].
Stream<ParticleSnapshot> watchParticleCloud(String tagId);
/// Room occupancy delta stream.
/// room_id -> list of tag_id strings currently in that room.