feat: render particle clouds for selected tags
This commit is contained in:
@@ -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* {
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user