88 lines
4.0 KiB
HTML
88 lines
4.0 KiB
HTML
<script type="text/javascript">
|
||
RED.nodes.registerType('xilica-subscribe', {
|
||
category: 'Xilica',
|
||
color: '#dddddd',
|
||
defaults: {
|
||
name: { value: "" },
|
||
action: { value: "subscribe" },
|
||
connection: { value: "", type: "xilica-connection" },
|
||
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-connection">Connection</label>
|
||
<input type="text" id="node-input-connection">
|
||
</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>
|
||
<select id="node-input-transport">
|
||
<option value="TCP">TCP</option>
|
||
<option value="UDP">UDP</option>
|
||
</select>
|
||
</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 builds the commands and sends them directly to the selected <code>xilica-connection</code>. It then outputs a message with the commands that were sent.</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. 1–48 → <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. 1–4 → <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. 4–28 → <code>CH4OUT</code>…<code>CH28OUT</code>).</li>
|
||
</ul>
|
||
<p><strong>Transport</strong> selects the subscription transport (<code>TCP</code> or <code>UDP</code>). The node generates commands like <code>SUBSCRIBE CH1 "TCP"</code> or <code>SUBSCRIBE CH1 "UDP"</code> and sends them over the selected connection.</p>
|
||
<p>The Xilica device connection (IP/port/password) is chosen directly on this node via the <strong>Connection</strong> field.</p>
|
||
</script>
|