node-red-contrib-vscp
Version:
A collection of VSCP (Very Simple Control Protocol) nodes
201 lines (177 loc) • 9.07 kB
HTML
<!--
MIT License
Copyright (c) 2020-2021 Åke Hedman, Grodans Paradis AB
This file is part of the VSCP (https://www.vscp.org)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
-->
<script type="text/html" data-template-name="vscp-config-filter">
<div class="form-row">
<label for="node-config-input-name"><i class="fa fa-tag"></i> Filter name</label>
<input type="text" id="node-config-input-name">
</div>
<div class="form-row">
<label for="node-config-input-filter_priority"><i class="fa fa-filter"></i> Filter Priority</label>
<input type="text" id="node-config-input-filterPriority">
</div>
<div class="form-row">
<label for="node-config-input-mask_priority"><i class="fa fa-filter"></i> Mask Priority</label>
<input type="text" id="node-config-input-maskPriority">
</div>
<div class="form-row">
<label for="node-config-input-filterClass"><i class="fa fa-filter"></i> Filter Class</label>
<input type="text" id="node-config-input-filterClass">
</div>
<div class="form-row">
<label for="node-config-input-maskClass"><i class="fa fa-filter"></i> Mask Class</label>
<input type="text" id="node-config-input-maskClass">
</div>
<div class="form-row">
<label for="node-config-input-filterType"><i class="fa fa-filter"></i> Filter Type</label>
<input type="text" id="node-config-input-filterType">
</div>
<div class="form-row">
<label for="node-config-input-maskType"><i class="fa fa-filter"></i> Mask Type</label>
<input type="text" id="node-config-input-maskType">
</div>
<div class="form-row">
<label for="node-config-input-filterGuid"><i class="fa fa-filter"></i> Filter GUID</label>
<input type="text" id="node-config-input-filterGuid">
</div>
<div class="form-row">
<label for="node-config-input-maskGuid"><i class="fa fa-filter"></i> Mask GUID</label>
<input type="text" id="node-config-input-maskGuid">
</div>
</script>
<script type="text/x-red" data-help-name="vscp-config-filter">
<p>Define a VSCP event filter for a connection.
A VSCP event filter makes it possible to only receive a
subset of the events that flows through an interface. It is
possible to filter events on priority, VSCP class, VSCP type
and GUID.</p>
<p>All values can be entered as decimal, hexadecimal, octal or binary
values. A hexadecimal, octal value or a binary value should be
preceded by '0x', '0o' respectively '0b'.</p>
<h3>Name</h3>
<dl class="message-properties">
Set the name to a useful description of the filter.
</dl>
<h3>Priority</h3>
<dl class="message-properties">
Makes it possible to filter out events with a specific priority.
Highest priority is 0 and lowest is 7. Set mask to all ones (7) and
filter to the wanted priority to receive only events with that specific priority.
<dt>Filter<span class="property-type">string</span></dt>
<dd>
Filter for priority. Can be a value between 0-7.
</dd>
<dt>Mask<span class="property-type">string</span></dt>
<dd>
Mask for priority. One byte.
</dd>
</dl>
<h3>VSCP Class</h3>
<dl class="message-properties">
Makes it possible to filter out events with a specific VSCP class.
A VSCP class is value in the range 0-512 for a Level I event and 0-65535
for a level II event. Set mask to all ones (0xffff) and
filter to the wanted VSCP class to receive only events with that
specific VSCP class.
<dt>Filter<span class="property-type">string</span></dt>
<dd>
Filter for VSCP class. A class is value in the range 0-512 for a
Level I event and 0-65535 for a level II event.
</dd>
<dt>Mask<span class="property-type">string</span></dt>
<dd>
Mask for VSCP class. 16-bits.
</dd>
</dl>
<h3>VSCP Type</h3>
<dl class="message-properties">
Makes it possible to filter out events with a specific VSCP type.
A VSCP type has a value in the range 0-255 for a Level I event and 0-65535
for a level II event. Set mask to all ones (0xffff) and
filter to the wanted VSCP type to receive only events with that
specific VSCP type.
<dt>Filter<span class="property-type">string</span></dt>
<dd>
Filter for VSCP type. A VSCP type is value in the range 0-255 for a
Level I event and 0-65535 for a level II event.
</dd>
<dt>Mask<span class="property-type">string</span></dt>
<dd>
Mask for VSCP type. 16-bits.
</dd>
</dl>
<h3>VSCP GUID</h3>
<dl class="message-properties">
Makes it possible to filter out events with a specific GUID
(Global Unique ID).
<dt>Filter<span class="property-type">string</span></dt>
<dd>
Filter for GUID. A GUID is entered on the form
00:01:02:03:04:05:06:07:08:09:0a:0b:0c:0d:0e:0f where each
colon separated digit pair is a hexadecimal value with the mask_priority
significant byte in the first position. Together (16 bytes) they form a
128-bit unique number that is used in VSCP as an id for devices.
</dd>
<dt>Mask<span class="property-type">string</span></dt>
<dd>
Mask for GUID. The mask should be entered on the same for as the filter.
Set to all zeros for a don't care (00:00:00....) and to all ones (ff:ff:ff...)
to receive only events with a specific GUID set in the GUID filter.
</dd>
</dl>
<h3>Details</h3>
<p>The filter object consist of pairs of filter-bits and
mask-bits. The mask-bits tell which bits of the filter-bits that
should be checked (and have the same value as the events bit at that position)
when the event filter is evaluated.</p>
<p>If you for example just want to receive a specific VSCP class
you set that class in the vscp_class_filter and set all bits in the
corresponding VSCP class mask_to all ones.</p>
<p>Generally a mask should have a one in a bit position at the same
place as a bit in the filter has the required value for that bit. Setting
a bit position to zero in the mask is therefore a don't care for that bit
position.</p>
<h3>References</h3>
<ul>
<li><a>https://docs.vscp.org/vscpd/latest/#/./tcp_ip_protocol_description?id=tcpip-setfilter</a> - full description of <code>event filters</code> </li>
<li><a>https://docs.vscp.org/</a> - documentation for VSCP</li>
<li><a>https://github.com/grodansparadis/node-red-contrib-vscp-tcp</a> - the nodes github repository</li>
<li><a>https://www.vscp.org/</a> - home of VSCP</li>
</ul>
</script>
<script type="text/javascript">
RED.nodes.registerType('vscp-config-filter',{
category: 'config',
defaults: {
name: {value:"",required:true},
filterPriority: {value:"0x00"},
maskPriority: {value:"0x00"},
filterClass: {value:"0x0000"},
maskClass: {value:"0x0000"},
filterType: {value:"0x0000"},
maskType: {value:"0x0000"},
filterGuid: {value:"00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00"},
maskGuid: {value:"00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00"},
},
label: function() {
return this.name;
}
});
</script>