node-red-contrib-canbus
Version:
A set of node-red nodes used for socketcan utilities
63 lines (56 loc) • 2.71 kB
HTML
<!--
Copyright (C) 2015 - Rajesh Sola <rajeshsola@gmail.com>
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.
-->
<!-- Prepared based on Sample html file,99-sample.html.demo
that corresponds to the 99-sample.js file-->
<script type="text/x-red" data-template-name="candump">
<!-- <div class="form-row">
<label for="node-input-channel"><i class="fa fa-tasks"></i> Channel</label>
<input type="text" id="node-input-channel" placeholder="Channel">
</div> -->
<div class="form-row">
<label for="node-input-vconfig"><i class="fa fa-random"></i> Config</label>
<input type="text" id="node-input-vconfig" placeholder="Config">
</div>
<br/>
<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>
</script>
<script type="text/x-red" data-help-name="candump">
<p>Simple node to listen for can frames on specified channels.</p>
<p>Outputs an object called <b>msg</b> containing <b>msg.channel</b>,<b>msg.data</b> and
<b>msg.payload</b> in the form of canid#data.</p>
</script>
<!-- Finally, the node type is registered along with all of its properties -->
<!-- The example below shows a small subset of the properties that can be set-->
<script type="text/javascript">
RED.nodes.registerType('candump',{
category: 'can bus', // the palette category
color: '#a6bbcf',
defaults: { // defines the editable properties of the node
name: {value:"candump"}, // along with default values.
vconfig: {type:"canconfig",required:true}
},
inputs:0, // set the number of inputs - only 0 or 1
outputs:1, // set the number of outputs - 0 to n
// set the icon (held in icons dir below where you save the node)
icon: "myicon.png", // saved in icons/myicon.png
label: function() { // sets the default label contents
return this.name||"candump";
},
labelStyle: function() { // sets the class to apply to the label
return this.name?"node_label_italic":"";
}
});
</script>