HansT - When I read updates of websocket, the $...
When I read updates of websocket, the $source can be canboatjs.X where X is the canbus id.
If I want a user to select a device, the canbus id (integer) isn't the best identifier to last over time / reboots etc.
Would it make sense to replace the $source with the name of the device (e.g. 'Fusion MS-205')?
(a bit like ip numbers vs hostnames)
6 Replies
A better choice is can name (check use can name in connection settings), but that is even less human readable
But in the end this about the ui; we can present there something for humans, even if the messages carry a machine oriented id
What use case / ui are you thinking of?
For the polar performance plugin I'd like a use to be able to choose which SOG source to use. I now use $source matching with e.g. 'canboatjs.34' as identifier.
I'd rather the user to be able to select 'B&G Zeus3'.
Can name sounds good as well. I just think that a $source like 'canboatjs.34' isn't very valuable as it requires a lookup to understand what it is.
the source identifier's function is to identify the source - it should be
- unique <== hard requirement (sk connection id plus can id or name is unique at any point in time)
- persistent (can id fails this one, but can name satisfies it)
- somewhat compact
- human readable to some extent
the name of the device (as received in N2K data) fails uniqueness, with the classical example of having multiple, same type depth transducers (on a multihull)
having said that there is nothing in the SK protocol itself that specifies what exactly should go in the source identifier, the current software just works this way
i think that this should be an identifier, not a name
i don't see the lookup problematic at all. we are not carrying "everything a client may need" in each delta, for example the unit for the path needs a lookup, it is not in each delta and is needed practically all the time. nor is the vessel's name for ais targets, even if that is what people usually want to see
Ok, fair points, although an AIS id is tied to the ship. A can id is more like a dhcp IP. It can change after the introduction of a new device.
See my points above re: can id vs can name (ip via dhcp vs MAC)