Skip to main content

live_labjack_channel_subject

Function live_labjack_channel_subject 

Source
pub fn live_labjack_channel_subject(
    nats_subject: &str,
    asset: u32,
    channel: u8,
    site_id: Option<&str>,
    box_id: Option<&str>,
    labjack_name: Option<&str>,
    source_type: Option<&str>,
    source_id: Option<&str>,
) -> String
Expand description

Builds the live-data subject for one LabJack channel.

Legacy configs use <root>.<asset>.data.<channel>, with the root used as given. Structured configs use <root>.<site>.<box>.<source>.live.<channel>, with every token passed through sanitize_token. In the structured layout a missing or empty site or box becomes unknown-site or unknown-box, and the source is chosen by source_token: the first of source_id, labjack_name or asset<NNN> that is set.

§Arguments

  • nats_subject - Subject root, for example avenabox or avenars.
  • asset - Asset number. Used in the legacy layout and as the last-resort source token in the structured layout.
  • channel - LabJack channel number, formatted by pad_channel.
  • site_id - Site ID for the structured layout.
  • box_id - Box ID for the structured layout.
  • labjack_name - LabJack name, used as the source when source_id is None.
  • source_type - Accepted for config compatibility; not used in the subject.
  • source_id - Source ID for the structured layout.

§Examples

("avenabox", 1456, 11, None, None, None, None, None)
    -> "avenabox.1456.data.ch11"
("avenars", 1456, 11, Some("i69"), Some("i69-mu1"), Some("i69-lj2"), None, None)
    -> "avenars.i69.i69-mu1.i69-lj2.live.ch11"
("avenars", 42, 3, None, None, None, None, None)
    -> "avenars.unknown-site.unknown-box.asset042.live.ch03"