Files
node-red-contrib-xilica/nodes/xilica-subscribe.html
2025-12-31 08:54:22 +01:00

80 lines
3.5 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<script type="text/javascript">
RED.nodes.registerType('xilica-subscribe', {
category: 'Xilica',
color: '#D8E7FF',
defaults: {
name: { value: "" },
action: { value: "subscribe" },
mode: { value: "list" },
targets: { value: "" },
startIndex: { value: 1 },
endIndex: { value: 1 },
transport: { value: "TCP" }
},
inputs: 1,
outputs: 1,
icon: "font-awesome/fa-plug",
label: function () {
var act = (this.action || "subscribe").toLowerCase();
if (this.name) {
return this.name;
}
return "xilica " + act;
}
});
</script>
<script type="text/x-red" data-template-name="xilica-subscribe">
<div class="form-row">
<label for="node-input-name">Name</label>
<input type="text" id="node-input-name">
</div>
<div class="form-row">
<label for="node-input-action">Action</label>
<select id="node-input-action">
<option value="subscribe">Subscribe</option>
<option value="unsubscribe">Unsubscribe</option>
</select>
</div>
<div class="form-row">
<label for="node-input-mode">Mode</label>
<select id="node-input-mode">
<option value="list">Explicit list</option>
<option value="startsWith">Starts with</option>
<option value="endsWith">Ends with</option>
<option value="startsAndEnds">Starts with and ends with</option>
</select>
</div>
<div class="form-row">
<label for="node-input-targets">Targets</label>
<textarea id="node-input-targets" rows="5" style="width: 100%;"></textarea>
</div>
<div class="form-row">
<label for="node-input-startIndex">Start index</label>
<input type="number" id="node-input-startIndex" min="0">
</div>
<div class="form-row">
<label for="node-input-endIndex">End index</label>
<input type="number" id="node-input-endIndex" min="0">
</div>
<div class="form-row">
<label for="node-input-transport">Transport</label>
<input type="text" id="node-input-transport" placeholder="TCP">
</div>
</script>
<script type="text/x-red" data-help-name="xilica-subscribe">
<p>Builds <code>SUBSCRIBE</code> or <code>UNSUBSCRIBE</code> commands for a Xilica Solaro processor.</p>
<p>On each input message, the node sets <code>msg.payload</code> to one or more commands separated by carriage returns. Wire the output into a <code>xilica-command</code> node to send them over TCP.</p>
<p><strong>Action</strong> selects whether to generate <code>SUBSCRIBE</code> or <code>UNSUBSCRIBE</code> commands.</p>
<p><strong>Mode</strong> controls how the Targets field is interpreted:</p>
<ul>
<li><strong>Explicit list</strong>: each non-empty line in Targets is used as a full control name (e.g. <code>MASTER_GAIN</code>).</li>
<li><strong>Starts with</strong>: each line in Targets is treated as a prefix (e.g. <code>CH</code>), and Start/End index define the numeric range (e.g. 148 <code>CH1</code><code>CH48</code>).</li>
<li><strong>Ends with</strong>: each line in Targets is treated as a suffix (e.g. <code>_OUT</code>), and Start/End index define the numeric range (e.g. 14 <code>1_OUT</code><code>4_OUT</code>).</li>
<li><strong>Starts with and ends with</strong>: each line in Targets is interpreted as <code>prefix|suffix</code> (for example <code>CH|OUT</code>), and Start/End index define the numeric range (e.g. 428 <code>CH4OUT</code><code>CH28OUT</code>).</li>
</ul>
<p>The Transport field controls the subscription transport string, typically <code>TCP</code>. The node generates commands like <code>SUBSCRIBE CH1 "TCP"</code>.</p>
</script>