@signalk/tracks-plugin 3.0.0-beta.3 → 3.0.0-beta.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,35 +1,24 @@
1
1
  import { Context } from './types.js';
2
- /**
3
- * Watches which `$source` each context's positions arrive from.
4
- *
5
- * `navigation.position` is a rapid update — a GPS may report at 10Hz — and a
6
- * typical boat has several receivers: an internal GPS, an AIS transponder, a
7
- * chart plotter echoing its own fix.
8
- *
9
- * Signal K resolves which one wins through source priority, and the bus this
10
- * plugin listens on is the filtered one: the server applies `toPreferredDelta`
11
- * before emitting `delta`, which is what feeds `getBus()`. So with a priority
12
- * rule in place, only the winner arrives and there is nothing to warn about.
13
- *
14
- * The gap is when no rule *matches* the path. Then the engine passes every
15
- * source through, the fixes from receivers metres apart interleave, and the
16
- * track zigzags between them rather than following the boat. The fix is to
17
- * configure source priority for `navigation.position`; this watcher exists to
18
- * say so, because the symptom (a track that looks noisy) does not obviously
19
- * point at the cause.
20
- *
21
- * Detection is therefore empirical rather than reading the priority config:
22
- * seeing several sources here *is* the evidence that no rule is matching,
23
- * which a config that merely exists would not tell us.
24
- */
25
2
  export declare class SourceWatch {
3
+ /** Last time each source produced a position, per context. */
26
4
  private readonly seen;
5
+ /** Sources found competing, per context, with when each was last seen so. */
6
+ private readonly competing;
7
+ /** The current alternation per context: who is in it, and how long it is. */
8
+ private readonly lastSeen;
27
9
  /** Record that `context` produced a position from `$source`. */
28
- add(context: Context, source: string | undefined): void;
29
- /** Sources seen for a context, in the order they first appeared. */
10
+ add(context: Context, source: string | undefined, now?: number): void;
11
+ /** Every source seen for a context, in the order they first appeared. */
30
12
  sourcesFor(context: Context): string[];
31
- /** Contexts receiving positions from more than one source. */
32
- conflicted(): Context[];
13
+ /**
14
+ * The sources found live at the same time, which is what a warning names.
15
+ *
16
+ * Expired entries are dropped rather than merely hidden, so a conflict that
17
+ * has stopped recurring leaves nothing behind.
18
+ */
19
+ competingFor(context: Context, now?: number): string[];
20
+ /** Contexts that have received positions from two sources at once. */
21
+ conflicted(now?: number): Context[];
33
22
  /**
34
23
  * A status line naming the problem, or undefined when nothing is wrong.
35
24
  *
@@ -38,7 +27,7 @@ export declare class SourceWatch {
38
27
  * vessels are usually AIS, where multiple receivers are expected and less
39
28
  * worth nagging about — they are counted, not named.
40
29
  */
41
- warning(selfContext?: Context): string | undefined;
30
+ warning(selfContext?: Context, now?: number): string | undefined;
42
31
  /** Forget everything seen; used when the plugin restarts. */
43
32
  clear(): void;
44
33
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@signalk/tracks-plugin",
3
- "version": "3.0.0-beta.3",
3
+ "version": "3.0.0-beta.4",
4
4
  "description": "Plugin to keep track of tracks of vessels",
5
5
  "type": "module",
6
6
  "exports": {
@@ -20,12 +20,11 @@
20
20
  ],
21
21
  "signalk": {
22
22
  "displayName": "Tracks",
23
- "appIcon": "app-icon.svg"
23
+ "appIcon": "./app-icon.svg"
24
24
  },
25
25
  "keywords": [
26
26
  "signalk-node-server-plugin",
27
27
  "signalk-webapp",
28
- "signalk-embeddable-webapp",
29
28
  "signalk-category-utility"
30
29
  ],
31
30
  "author": "Teppo Kurki <teppo.kurki@iki.fi>",