UNPKG

signalk-server

Version:

An implementation of a [Signal K](http://signalk.org) server for boats.

45 lines 2.35 kB
/** * Walk the self-vessel Signal K tree and derive, for each PGN known to * carry a `instance` primary key, which `(sourceRef, instance)` tuples * are *currently* present. * * This replaces an earlier passive listener that accumulated every * instance value ever seen on the wire. That set never forgot, so a * value like `instance: 0` emitted briefly during a device's startup * Address Claim — before the user-configured instance took effect — * haunted conflict detection forever. * * The SK tree is the authoritative current state: a leaf at * `electrical.batteries.<n>.voltage` only exists while a device is * actively publishing instance `<n>`. Reading instances from there * matches what users see in the data browser and the per-PGN editors, * and there is nothing to decay. * * Path conventions per PGN follow the @signalk/n2k-signalk mapping * package. Most are `<prefix>.<instance>.<...>`; PGN 130312/130316 * (temperature/humidity) carry an additional `source` enum that splits * the path as `<prefix>.<source>.<instance>.<...>`. We treat that as * the compound key the conflict detector already understands. */ /** * Build sourceRef → pgn → list of currently-published instance numbers. * Used by the admin UI conflict detector. The shape mirrors the legacy * passive map so the client is unchanged. */ export declare function buildPgnDataInstancesFromTree(selfTree: any): Record<string, Record<string, number[]>>; /** * Build sourceRef → pgn → list of compound keys for temperature/humidity * PGNs whose unique key includes the source-type enum. * * The n2k-signalk mapping for PGN 130312/130316 routes each source-type * (Outside, Inside, Main Cabin, Freezer, …) to a different SK path, * usually flat — `environment.outside.temperature`, * `environment.inside.mainCabin.temperature`, etc. The numeric instance * is generally not part of the path either (only Live/Bait Well and * Exhaust Gas use pathWithIndex). Two devices "share" a 130312 stream * only when they publish the same SK leaf path; the path already * encodes the (instance, source-type) tuple uniquely. Use the relative * SK path as the compound key. */ export declare function buildPgnSourceKeysFromTree(selfTree: any): Record<string, Record<string, string[]>>; //# sourceMappingURL=n2k-discovery-instances.d.ts.map