mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
132 lines
5.2 KiB
HTML
132 lines
5.2 KiB
HTML
|
<!--
|
||
|
Copyright 2013 IBM Corp.
|
||
|
|
||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||
|
you may not use this file except in compliance with the License.
|
||
|
You may obtain a copy of the License at
|
||
|
|
||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||
|
|
||
|
Unless required by applicable law or agreed to in writing, software
|
||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
|
See the License for the specific language governing permissions and
|
||
|
limitations under the License.
|
||
|
-->
|
||
|
|
||
|
<!-- The Input Node -->
|
||
|
<script type="text/x-red" data-template-name="multicast in">
|
||
|
<div class="form-row">
|
||
|
<label for="node-input-group"><i class="icon-tasks"></i> Group</label>
|
||
|
<input type="text" id="node-input-group" placeholder="225.0.18.83" style="width: 40%;">
|
||
|
<label for="node-input-port" style="margin-left: 10px; width: 35px;"> Port</label>
|
||
|
<input type="text" id="node-input-port" placeholder="Port" style="width: 45px">
|
||
|
</div>
|
||
|
<div class="form-row">
|
||
|
<label for="node-input-iface"><i class="icon-globe"></i> Interface</label>
|
||
|
<input type="text" id="node-input-iface" placeholder="eth0">
|
||
|
</div>
|
||
|
<div class="form-row">
|
||
|
<label> </label>
|
||
|
<input type="checkbox" id="node-input-base64" placeholder="base64" style="display: inline-block; width: auto; vertical-align: top;">
|
||
|
<label for="node-input-base64" style="width: 70%;">Base64 encode payload ?</label>
|
||
|
</div>
|
||
|
<div class="form-row">
|
||
|
<label for="node-input-name"><i class="icon-tag"></i> Name</label>
|
||
|
<input type="text" id="node-input-name" placeholder="Name">
|
||
|
</div>
|
||
|
<div class="form-tips">Tip: sends the received data as a Buffer object (not a String).<br/>Make sure your firewall will allow the data in.</div>
|
||
|
</script>
|
||
|
|
||
|
<script type="text/x-red" data-help-name="multicast in">
|
||
|
<p>A multicast udp input node, that produces a <b>msg.payload</b> containing a <i>BUFFER</i> object and NOT a String.</p>
|
||
|
<p>If you need a String then use <i>.toString()</i> on <b>msg.payload</b> in your next function block.</p>
|
||
|
<p>It also provides <b>msg.fromip</b> of the form ipaddress:port .</p>
|
||
|
</script>
|
||
|
|
||
|
<script type="text/javascript">
|
||
|
RED.nodes.registerType('multicast in',{
|
||
|
category: 'input',
|
||
|
color:"Silver",
|
||
|
defaults: {
|
||
|
name: {value:""},
|
||
|
group: {value:"",required:true},
|
||
|
host: {value:""},
|
||
|
iface: {value:""},
|
||
|
port: {value:"",required:true,validate:RED.validators.number()},
|
||
|
base64: {value:false,required:true},
|
||
|
multicast: {value:"true"}
|
||
|
},
|
||
|
inputs:0,
|
||
|
outputs:1,
|
||
|
icon: "bridge-dash.png",
|
||
|
label: function() {
|
||
|
if ((this.group!="") & (this.port!="")) {
|
||
|
return this.name||(this.group+":"+this.port);
|
||
|
}
|
||
|
else { return "multicast in"; }
|
||
|
},
|
||
|
labelStyle: function() {
|
||
|
return this.name?"node_label_italic":"";
|
||
|
}
|
||
|
});
|
||
|
</script>
|
||
|
|
||
|
<!-- The Output Node -->
|
||
|
<script type="text/x-red" data-template-name="multicast out">
|
||
|
<div class="form-row">
|
||
|
<label for="node-input-group"><i class="icon-tasks"></i> Group</label>
|
||
|
<input type="text" id="node-input-group" placeholder="225.0.18.83" style="width: 40%;">
|
||
|
<label for="node-input-port" style="margin-left: 10px; width: 35px;"> Port</label>
|
||
|
<input type="text" id="node-input-port" placeholder="Port" style="width: 45px">
|
||
|
</div>
|
||
|
|
||
|
<div class="form-row">
|
||
|
<label for="node-input-iface"><i class="icon-globe"></i> Interface</label>
|
||
|
<input type="text" id="node-input-iface" placeholder="eth0">
|
||
|
</div>
|
||
|
|
||
|
<div class="form-row">
|
||
|
<label> </label>
|
||
|
<input type="checkbox" id="node-input-base64" placeholder="base64" style="display: inline-block; width: auto; vertical-align: top;">
|
||
|
<label for="node-input-base64" style="width: 70%;">Decode Base64 encoded payload ?</label>
|
||
|
</div>
|
||
|
<div class="form-row">
|
||
|
<label for="node-input-name"><i class="icon-tag"></i> Name</label>
|
||
|
<input type="text" id="node-input-name" placeholder="Name">
|
||
|
</div>
|
||
|
</script>
|
||
|
|
||
|
<script type="text/x-red" data-help-name="multicast out">
|
||
|
<p>This node sends <b>msg.payload</b> to the designated multicast group and port.</p>
|
||
|
</script>
|
||
|
|
||
|
<script type="text/javascript">
|
||
|
RED.nodes.registerType('multicast out',{
|
||
|
category: 'output',
|
||
|
color:"Silver",
|
||
|
defaults: {
|
||
|
name: {value:""},
|
||
|
group: {value:"",required:true},
|
||
|
host: {value:""},
|
||
|
iface: {value:""},
|
||
|
port: {value:"",required:true,validate:RED.validators.number()},
|
||
|
base64: {value:false,required:true},
|
||
|
multicast: {value:"true"}
|
||
|
},
|
||
|
inputs:1,
|
||
|
outputs:0,
|
||
|
icon: "bridge-dash.png",
|
||
|
align: "right",
|
||
|
label: function() {
|
||
|
if ((this.group!="") & (this.port!="")) {
|
||
|
return this.name||(this.group+":"+this.port);
|
||
|
}
|
||
|
else { return "multicast out"; }
|
||
|
},
|
||
|
labelStyle: function() {
|
||
|
return this.name?"node_label_italic":"";
|
||
|
}
|
||
|
});
|
||
|
</script>
|