node-red-contrib-socketcan
Version:
node-red nodes for socketcan
116 lines (103 loc) • 4.11 kB
HTML
<!--
///////////////////////////////////////////////////////////////////////////
// receive.html
//
// socketcan input node.
//
// This file is part of the VSCP (https://www.vscp.org)
//
// The MIT License (MIT)
//
// Copyright © 2020-2024 Ake Hedman, Grodans Paradis AB
// <info@grodansparadis.com>
//
// 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/x-red" data-template-name="socketcan-out">
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name">
</div>
<div class="form-row">
<label for="node-input-config"><i class="fa fa-random"></i> Config</label>
<input type="text" id="node-input-config" placeholder="Config">
</div>
<br/>
</script>
<script type="text/x-red" data-help-name="socketcan-out">
<p><b>socketcan-out</b> node is provided for receiving CAN frames.
You can receive standard or extended CAN id frames. </p>
<h3>Inputs</h3>
<dl class="message-properties">
This node have no inputs
</dl>
<h3>Outputs</h3>
<ul class="node-ports">
<li>CAN frame
<dl class="message-properties">
<dt>payload <span class="property-type">object</span></dt>
<dd>the standard output of the command in the form of a
JSON object with the following content.
<pre>
{
timestamp: 1552881174,
ext: 0,
rtr: 0,
canid: 123,
dlc: 5,
data: [1,2,3,4,5]
}
</pre>
where
<ul>
<li> <b>canid</b> - The standard or extended can id.</li>
<li> <b>ext</b> - Set to true if this is a extended id frame. False otherwise.</li>
<li> <b>rtr</b> - Specifies a remote transmission request frame if set to true.</li>
<li> <b>dlc</b> - Number of databytes.</li>
<li> <b>data</b> - An array with data or null or an empty array if no data.</li>
<li> <b>rawData</b> - A buffer containg the frame data, if any </li>.
<li> <b>timestamp</b> - Relative timestamp in microseconds</li>
</ul>
<br>
The timestamp (in microseconds) is generated by the node if not supplied by the interface.
</dd>
</dl>
</li>
</ul>
</script>
<script type="text/javascript">
RED.nodes.registerType('socketcan-out',{
category: 'network',
color: '#bbff33',
defaults: {
name: {value:"socketcan-out"},
config: {value:"",type:"socketcan-config",required:true}
},
inputs:0,
outputs:1,
icon: "bridge.png",
label: function() {
return this.name || "socketcan-out";
},
labelStyle: function() {
return this.name ? "node_label_italic" : "";
}
});
</script>