UNPKG

node-red-contrib-vscp

Version:

A collection of VSCP (Very Simple Control Protocol) nodes

124 lines (114 loc) 4.59 kB
<!-- /////////////////////////////////////////////////////////////////////////// // can2vscp.html // // socketcan output node. // // This file is part of the VSCP (https://www.vscp.org) // // The MIT License (MIT) // // Copyright © 2020-2021 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/html" data-template-name="can2vscp"> <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/html" data-help-name="can2vscp"> <p>A node that converts a CAN message object or a CAN message on string form to a VSCP event object. Typically used by a tool, node or application that use VSCP over CAN (CAN4VSCP) to receive VSCP events. </p> <h3>Inputs</h3> <dl class="message-properties"> <dd> the payload is the message to send to the configured CAN bus interface. It can either be a JSON object or a string. </dd> <dt class="optional">payload <span class="property-type">object</span></dt> <dd> The CAN message is defined as a JSON object with the following payload format <pre> { "ext":false, "rtr":false, "canid":123, "dlc":5, "data":[1,2,3,4,5]} } </pre> <ul> <li> <b>ext</b> - Marks the message as an extended id message.</li> <li> <b>rtr</b> - The message is a remote transmission request. No data should be specified in this case (set to null).</li> <li> <b>canid</b> - The canid for the CAN message. Must be less then 0x7ff for a standard CAN message.</li> <li> <b>dlc</b> - Number of data bytes, 0-8. </li> <li> <b>data</b> - An array, comma separated list or buffer with data bytes. Set to null if no data.</li> </ul> </dd> <dt class="optional">payload <span class="property-type">string</span></dt> <dd> The CAN message is defined as a string with the following payload format <pre> &lt;canid&gt;#{R|data} </pre> <ul> <li> <b>canid</b> - Less than 0x7ff and with less than three digits for a standard id. Always defined in hex format.</li> <li> <b>data</b> - The data part for the can frame. Always in hex format.</li> <li> <b>R</b> - Specifies a remote transmission request frame.</li> </ul> <p> <b>Examples</b> <pre> 123#DEADBEEF - standard frame 5AA# - Standard frame no data 1F334455#1122334455667788 - extended frame 123#R - for remote transmission request. </pre> </p> </dd> </dl> <h3>Outputs</h3> <ol class="node-ports"> <li> <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. </dd> </li> </ol> </script> <script type="text/javascript"> RED.nodes.registerType('can2vscp',{ category: 'vscp', color: '#ffe033', defaults: { name: {value:""} }, inputs:1, outputs:1, icon: "arrow-in.png", label: function() { return this.name||"can2vscp"; } }); </script>