Updated help files

This commit is contained in:
Collin Kidder
2021-05-21 21:08:00 -04:00
parent 00c1a922de
commit 204c115162
36 changed files with 6514 additions and 1105 deletions
+173 -19
View File
@@ -1,43 +1,57 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>79. Scripting Interface</title>
<link rel="stylesheet" href="_static/nonav.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>79. Scripting Interface &#8212; SavvyCAN 189 documentation</title>
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="_static/alabaster.css" type="text/css" />
<script id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
<script src="_static/jquery.js"></script>
<script src="_static/underscore.js"></script>
<script src="_static/doctools.js"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="prev" title="74. Custom Sender Window" href="customsender.html" />
<link rel="stylesheet" href="_static/custom.css" type="text/css" />
<meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9" />
</head><body>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<div class="section" id="scripting-interface">
<h1>79. Scripting Interface</h1>
<h1><span class="section-number">79. </span>Scripting Interface<a class="headerlink" href="#scripting-interface" title="Permalink to this headline"></a></h1>
<p>.</p>
<img alt="_images/ScriptingWindow.png" src="_images/ScriptingWindow.png" />
</div>
<div class="section" id="purpose-of-the-scripting-interface">
<h1>80. Purpose of the Scripting Interface</h1>
<h1><span class="section-number">80. </span>Purpose of the Scripting Interface<a class="headerlink" href="#purpose-of-the-scripting-interface" title="Permalink to this headline"></a></h1>
<p>To give you an open ended place where you can write JavaScript files that do whatever you need them to do. You can load several files at once and they’ll all work at the same time. Scripts can expose parameters that can then be edited by you while the program is running. They also update 4 times per second so they can be used to give feedback of the current state of the script as well. But, it is safer to give status in the “Log Window” instead. However, for values that might need to be seen and frequently updated it might be easiest to show them as “Public Variables”.</p>
</div>
<div class="section" id="managing-scripts">
<h1>81. Managing Scripts</h1>
<h1><span class="section-number">81. </span>Managing Scripts<a class="headerlink" href="#managing-scripts" title="Permalink to this headline"></a></h1>
<p>In the bottom left is the “Loaded Scripts” list. You can create a new script by clicking the “New” button below the list. The new script will have a random name until you save it. The “Del” button will delete the currently selected script but it will ask you first. The “Load” button will load a new script from a file. The “Save” button is above the main script view which is in the upper right of the window. “Revert” will revert the script to the last version that was compiled. Any changes you’ve made since compiling well be reverted. “Recompile” is used to compile the script and begin running the new version.</p>
</div>
<div class="section" id="getting-script-status">
<h1>82. Getting Script Status</h1>
<h1><span class="section-number">82. </span>Getting Script Status<a class="headerlink" href="#getting-script-status" title="Permalink to this headline"></a></h1>
<p>There are two places you can look for the status of a script. The “Log Window” is directly below the script source code editor. This window is shared between all scripts and shows the status of compiling scripts as well as log messages from each script. The script name that sent the log message is prepended. The number before the script name is the amount of time the scripting window had been open for when the message was sent. This unified interface can be used to keep an eye on all of the running scripts and to debug issues when a script is compiled. Any compile errors will show up in the log window. You can set the checkbox on “Auto Scroll Log Window” to make it continue to stay at the bottom of the log. You can clear the log at any time as well.</p>
<p>The other way to see script status is to use the “Public Variables” interface. Here you will find variables that were registered by the current script. Each script has its own list so information that needs to be updated frequently and/or specific to a script and easily accessible should be registered here. But, public variables can have their value set by you, the user, as well. So, care should be taken not to edit variables used for script feedback and scripts shouldn’t try to change the value of variables used for input to the program.</p>
</div>
<div class="section" id="writing-scripts">
<h1>83. Writing Scripts</h1>
<h1><span class="section-number">83. </span>Writing Scripts<a class="headerlink" href="#writing-scripts" title="Permalink to this headline"></a></h1>
<p>You are more or less free to write JavaScript scripts but, of course, you aren’t in a web browser so browser specific functions are just not there. In their place are a couple of JS objects that allow the script to interface with the CAN buses connected to SavvyCAN. Also, certain functions can be created to automatically register callbacks.</p>
</div>
<div class="section" id="callback-functions">
<h1>84. Callback Functions</h1>
<h1><span class="section-number">84. </span>Callback Functions<a class="headerlink" href="#callback-functions" title="Permalink to this headline"></a></h1>
<p>These functions can be created in your scripts to enable certain functionality:</p>
<p>setup () - If you create a function named setup then it will be called as soon as the script starts. Yes, you probably could just dump code into no function at all right into the file but that’s bad form!</p>
<p>tick () - If you registered to receive a periodic tick within your setup function then the script interface will call this function for every tick. You can do whatever you need to periodically do here. But, you get only one tick handler so if you need multiple tick rates you’ll have to create a fast tick here and dispatch from this function at different rates yourself.</p>
@@ -46,33 +60,33 @@
<p>gotUDSMessage (bus, id, service, subfunc, len, data) - UDS messages are transmitted over ISO-TP but with additional structure. If you’re looking to interface directly at the UDS level then you can create this function to have it automatically registered. As with raw CAN and ISO-TP you still need to specify which messages IDs you are interested in.</p>
</div>
<div class="section" id="the-host-object">
<h1>85. The host Object</h1>
<h1><span class="section-number">85. </span>The host Object<a class="headerlink" href="#the-host-object" title="Permalink to this headline"></a></h1>
<p>The first object you can use is “host” This object handles setup of the tick timer as well as logging output and registration of public variables.</p>
<p>host.setTickInterval(interval) - If the interval is more than 0 then your tick callback will be called every “interval” milliseconds. If a value of 0 is passed then the tick timer will be stopped.</p>
<p>host.log(text) - Send text to the log window. It will be timestamped, marked according to which script sent it, and placed into the log window.</p>
<p>host.addParameter(“variablename”) - Add the named variable to the list of public variables. From then on any changes that you make in the GUI will immediately show up in the script and any changes the script makes to a value will reflect in the GUI within 250ms. Remember to use quotes around the variable name. You want to pass the variable name, not its value.</p>
</div>
<div class="section" id="the-can-object">
<h1>86. The can Object</h1>
<h1><span class="section-number">86. </span>The can Object<a class="headerlink" href="#the-can-object" title="Permalink to this headline"></a></h1>
<p>This object is your interface to raw CAN. It has the following functions:</p>
<p>can.setFilter(id, mask, bus) - register to receive messages based on an ID, Mask, and Bus. It works like this. First the bus is compared. If it doesn’t match the frame is not delivered to you. Then, the incoming frame has its ID ANDed with your mask. Let’s say your mask is 0x7F0 and the incoming frame has an ID of 0x235. 0x235 AND 0x7F0 is 0x230. This value is compared to the ID you passed. So, if your filter ID is 0x230 then the frame is accepted and you will get a callback with the frame. Otherwise the frame is not delivered to you. This masking setup is very common in CAN bus interfaces. Basically, the mask allows a single filter to accept a range of IDs. 0x7F0 would accept 16 different IDs (0x230 through 0x23F in this case). 0x700 accepts 256 different IDs, etc.</p>
<p>can.clearFilters() - remove all filters and revert to a clean state. You will no longer receive any CAN callbacks unless you create more filters with setFilter.</p>
<p>can.sendFrame(bus, id, length, data) - Send a CAN frame out the given bus. The CAN id will be what you set as will the length. The length can thus be different from the actual length of “data” which should be a valid javascript array. The length can not exceed 8. The frame will be sent as soon as possible so long as that bus is connected and not in listen only mode.</p>
</div>
<div class="section" id="the-isotp-object">
<h1>87. The isotp Object</h1>
<h1><span class="section-number">87. </span>The isotp Object<a class="headerlink" href="#the-isotp-object" title="Permalink to this headline"></a></h1>
<p>isotp.setFilter(id, mask, bus) - Exactly like the raw CAN version in the can object. Allows you to register a filter so that you can receive ISO-TP traffic from the filtered addresses. It should be noted that you’ll essentially only get traffic that seems to be able to be turned into ISO-TP traffic. Any CAN frames obviously not ISO-TP will be rejected.</p>
<p>isotp.clearFilters() - Clear all ISO-TP filters and no longer receive ISO-TP traffic.</p>
<p>isotp.sendISOTP(bus, id, length, data) - As in the can version. The difference here is that ISO-TP messages can be longer than 8 bytes and so might get turned into a multi-frame set of messages with flow control. This is handled for you by SavvyCAN so you needn’t handle of the details of the exchange.</p>
</div>
<div class="section" id="the-uds-object">
<h1>88. The uds Object</h1>
<h1><span class="section-number">88. </span>The uds Object<a class="headerlink" href="#the-uds-object" title="Permalink to this headline"></a></h1>
<p>uds.setFilter(id, mask, bus) - Exactly like the other two setFilter functions. Register for a set of IDs to be interpreted as UDS (if possible) and sent through to your callback. Any obviously not UDS traffic will be discarded.</p>
<p>uds.clearFilter() - Remove all filters and quit receiving UDS traffic.</p>
<p>uds.sendUDS(bus, id, service, sublen, subfunc, length, data) - Sends a UDS message out from the script. service must be between 0 and 255, subfunc can be larger than one byte if needed. data is only needed for extended payloads as the actual UDS protocol is handled by the service and subfunc parameters.</p>
</div>
<div class="section" id="a-full-example-script">
<h1>89. A full example script</h1>
<h1><span class="section-number">89. </span>A full example script<a class="headerlink" href="#a-full-example-script" title="Permalink to this headline"></a></h1>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">var</span> <span class="n">newID</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="o">//</span><span class="nb">set</span> <span class="n">this</span> <span class="n">to</span> <span class="n">the</span> <span class="n">ID</span> <span class="n">you</span> <span class="n">want</span> <span class="n">your</span> <span class="n">RLEC</span> <span class="n">to</span> <span class="n">become</span>
<span class="n">function</span> <span class="n">setup</span> <span class="p">()</span>
@@ -123,8 +137,148 @@
</div>
</div>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<h1 class="logo"><a href="index.html">SavvyCAN</a></h1>
<h3>Navigation</h3>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="mainscreen.html">1. Main / Start Up Screen</a></li>
<li class="toctree-l1"><a class="reference internal" href="mainscreen.html#the-main-frame-list">2. The Main Frame List</a></li>
<li class="toctree-l1"><a class="reference internal" href="mainscreen.html#the-bottom-statusbar">3. The Bottom Statusbar</a></li>
<li class="toctree-l1"><a class="reference internal" href="mainscreen.html#the-rest-of-the-main-window">4. The Rest of the Main Window</a></li>
<li class="toctree-l1"><a class="reference internal" href="mainscreen.html#loading-and-saving-frames">5. Loading And Saving Frames</a></li>
<li class="toctree-l1"><a class="reference internal" href="mainscreen.html#filters">6. Filters</a></li>
<li class="toctree-l1"><a class="reference internal" href="mainscreen.html#what-is-dbc-and-why-would-i-care">7. What is DBC and why would I care?!</a></li>
<li class="toctree-l1"><a class="reference internal" href="mainscreen.html#how-dbc-interacts-with-the-main-screen">8. How DBC interacts with the main screen?</a></li>
<li class="toctree-l1"><a class="reference internal" href="connectionwindow.html">9. Connection Window</a></li>
<li class="toctree-l1"><a class="reference internal" href="connectionwindow.html#connecting-to-a-dongle">10. Connecting To A Dongle</a></li>
<li class="toctree-l1"><a class="reference internal" href="connectionwindow.html#debugging-connection-problems">11. Debugging Connection Problems</a></li>
<li class="toctree-l1"><a class="reference internal" href="preferences.html">12. Preference Window</a></li>
<li class="toctree-l1"><a class="reference internal" href="preferences.html#setting-preferences">13. Setting Preferences</a></li>
<li class="toctree-l1"><a class="reference internal" href="dbc_manager.html">14. DBC File Manager</a></li>
<li class="toctree-l1"><a class="reference internal" href="dbc_manager.html#working-with-dbc-files">15. Working with DBC Files</a></li>
<li class="toctree-l1"><a class="reference internal" href="dbc_manager.html#dbc-file-ordering">16. DBC File Ordering</a></li>
<li class="toctree-l1"><a class="reference internal" href="dbc_editor.html">17. DBC Message Editor</a></li>
<li class="toctree-l1"><a class="reference internal" href="dbc_editor.html#working-with-nodes">18. Working with Nodes</a></li>
<li class="toctree-l1"><a class="reference internal" href="dbc_editor.html#working-with-messages">19. Working with Messages</a></li>
<li class="toctree-l1"><a class="reference internal" href="signaleditor.html">20. DBC Signal Editor</a></li>
<li class="toctree-l1"><a class="reference internal" href="signaleditor.html#defining-and-editing-signals">21. Defining and Editing Signals</a></li>
<li class="toctree-l1"><a class="reference internal" href="graphwindow.html">22. Graphing Window</a></li>
<li class="toctree-l1"><a class="reference internal" href="graphwindow.html#creating-a-new-graph">23. Creating a new Graph</a></li>
<li class="toctree-l1"><a class="reference internal" href="graphwindow.html#selecting-a-graph">24. Selecting a Graph</a></li>
<li class="toctree-l1"><a class="reference internal" href="graphwindow.html#editing-a-graph">25. Editing a Graph</a></li>
<li class="toctree-l1"><a class="reference internal" href="graphwindow.html#deleting-graphs">26. Deleting Graphs</a></li>
<li class="toctree-l1"><a class="reference internal" href="graphwindow.html#moving-around">27. Moving Around</a></li>
<li class="toctree-l1"><a class="reference internal" href="graphwindow.html#loading-and-saving-graphs">28. Loading and Saving Graphs</a></li>
<li class="toctree-l1"><a class="reference internal" href="graphwindow.html#real-time-graphing">29. Real Time Graphing</a></li>
<li class="toctree-l1"><a class="reference internal" href="graphwindow.html#hidden-tricks">30. Hidden Tricks</a></li>
<li class="toctree-l1"><a class="reference internal" href="graphsetup.html">31. Graph Setup</a></li>
<li class="toctree-l1"><a class="reference internal" href="graphsetup.html#setting-up-a-graph">32. Setting up a Graph</a></li>
<li class="toctree-l1"><a class="reference internal" href="graphsetup.html#graphing-a-dbc-signal">33. Graphing a DBC Signal</a></li>
<li class="toctree-l1"><a class="reference internal" href="graphsetup.html#manual-signal-graphing-or-editing">34. Manual Signal Graphing (Or Editing)</a></li>
<li class="toctree-l1"><a class="reference internal" href="flowview.html">35. Flow View Window</a></li>
<li class="toctree-l1"><a class="reference internal" href="flowview.html#the-purpose-of-flow-view">36. The Purpose of Flow View</a></li>
<li class="toctree-l1"><a class="reference internal" href="flowview.html#selecting-an-id-to-flow">37. Selecting an ID to Flow</a></li>
<li class="toctree-l1"><a class="reference internal" href="flowview.html#viewing-the-flow">38. Viewing the Flow</a></li>
<li class="toctree-l1"><a class="reference internal" href="flowview.html#controlling-the-flow">39. Controlling the Flow</a></li>
<li class="toctree-l1"><a class="reference internal" href="flowview.html#additional-control-options">40. Additional control options</a></li>
<li class="toctree-l1"><a class="reference internal" href="flowview.html#reference-values">41. Reference Values</a></li>
<li class="toctree-l1"><a class="reference internal" href="flowview.html#seeking-to-specific-values">42. Seeking to Specific Values</a></li>
<li class="toctree-l1"><a class="reference internal" href="bisector.html">43. Bisector Window</a></li>
<li class="toctree-l1"><a class="reference internal" href="bisector.html#using-the-bisector-window">44. Using the Bisector Window</a></li>
<li class="toctree-l1"><a class="reference internal" href="sniffer.html">45. Sniffer Window</a></li>
<li class="toctree-l1"><a class="reference internal" href="sniffer.html#using-the-sniffer-window">46. Using the Sniffer Window</a></li>
<li class="toctree-l1"><a class="reference internal" href="sniffer.html#notching-and-unnotching">47. Notching and Unnotching</a></li>
<li class="toctree-l1"><a class="reference internal" href="sniffer.html#advanced-options">48. Advanced Options</a></li>
<li class="toctree-l1"><a class="reference internal" href="sniffer.html#never-expire-ids">49. Never Expire IDs</a></li>
<li class="toctree-l1"><a class="reference internal" href="sniffer.html#mute-notched-bits">50. Mute notched bits</a></li>
<li class="toctree-l1"><a class="reference internal" href="sniffer.html#fade-inactive-bytes">51. Fade inactive bytes</a></li>
<li class="toctree-l1"><a class="reference internal" href="sniffer.html#view-bits">52. View Bits</a></li>
<li class="toctree-l1"><a class="reference internal" href="framedetails.html">53. Frame Details Window</a></li>
<li class="toctree-l1"><a class="reference internal" href="framedetails.html#the-purpose-of-frame-details-window">54. The Purpose of Frame Details Window</a></li>
<li class="toctree-l1"><a class="reference internal" href="filecomparison.html">55. File Comparison Window</a></li>
<li class="toctree-l1"><a class="reference internal" href="filecomparison.html#the-purpose-of-the-file-comparator">56. The Purpose of the File Comparator</a></li>
<li class="toctree-l1"><a class="reference internal" href="filecomparison.html#the-layout-of-the-differences-list">57. The layout of the differences list</a></li>
<li class="toctree-l1"><a class="reference internal" href="fuzzingwindow.html">58. Fuzzing Window</a></li>
<li class="toctree-l1"><a class="reference internal" href="fuzzingwindow.html#the-purpose-of-fuzzing">59. The Purpose of Fuzzing</a></li>
<li class="toctree-l1"><a class="reference internal" href="fuzzingwindow.html#fuzzing-is-dangerous">60. Fuzzing is Dangerous</a></li>
<li class="toctree-l1"><a class="reference internal" href="fuzzingwindow.html#controlling-the-fuzzy-beast">61. Controlling the Fuzzy Beast</a></li>
<li class="toctree-l1"><a class="reference internal" href="fuzzingwindow.html#pulling-the-trigger">62. Pulling the Trigger</a></li>
<li class="toctree-l1"><a class="reference internal" href="isotp_decoder.html">63. ISO-TP Decoder</a></li>
<li class="toctree-l1"><a class="reference internal" href="isotp_decoder.html#using-the-iso-tp-decoder">64. Using the ISO-TP Decoder</a></li>
<li class="toctree-l1"><a class="reference internal" href="rangestate.html">65. Range State Window</a></li>
<li class="toctree-l1"><a class="reference internal" href="rangestate.html#using-the-range-state-window">66. Using the Range State Window</a></li>
<li class="toctree-l1"><a class="reference internal" href="uds_scanner.html">67. UDS Scan Window</a></li>
<li class="toctree-l1"><a class="reference internal" href="uds_scanner.html#purpose-of-the-uds-scan-window">68. Purpose of the UDS Scan Window</a></li>
<li class="toctree-l1"><a class="reference internal" href="uds_scanner.html#using-the-uds-scan-window">69. Using the UDS Scan Window</a></li>
<li class="toctree-l1"><a class="reference internal" href="playbackwindow.html">70. Playback Window</a></li>
<li class="toctree-l1"><a class="reference internal" href="playbackwindow.html#preparing-frames-for-playback">71. Preparing Frames for Playback</a></li>
<li class="toctree-l1"><a class="reference internal" href="playbackwindow.html#playing-back-frames">72. Playing Back Frames</a></li>
<li class="toctree-l1"><a class="reference internal" href="playbackwindow.html#playback-status">73. Playback Status</a></li>
<li class="toctree-l1"><a class="reference internal" href="customsender.html">74. Custom Sender Window</a></li>
<li class="toctree-l1"><a class="reference internal" href="customsender.html#general-overview">75. General Overview</a></li>
<li class="toctree-l1"><a class="reference internal" href="customsender.html#layout-of-the-view">76. Layout of the View</a></li>
<li class="toctree-l1"><a class="reference internal" href="customsender.html#writing-trigger-rules">77. Writing Trigger Rules</a></li>
<li class="toctree-l1"><a class="reference internal" href="customsender.html#writing-modifications">78. Writing Modifications</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">79. Scripting Interface</a></li>
<li class="toctree-l1"><a class="reference internal" href="#purpose-of-the-scripting-interface">80. Purpose of the Scripting Interface</a></li>
<li class="toctree-l1"><a class="reference internal" href="#managing-scripts">81. Managing Scripts</a></li>
<li class="toctree-l1"><a class="reference internal" href="#getting-script-status">82. Getting Script Status</a></li>
<li class="toctree-l1"><a class="reference internal" href="#writing-scripts">83. Writing Scripts</a></li>
<li class="toctree-l1"><a class="reference internal" href="#callback-functions">84. Callback Functions</a></li>
<li class="toctree-l1"><a class="reference internal" href="#the-host-object">85. The host Object</a></li>
<li class="toctree-l1"><a class="reference internal" href="#the-can-object">86. The can Object</a></li>
<li class="toctree-l1"><a class="reference internal" href="#the-isotp-object">87. The isotp Object</a></li>
<li class="toctree-l1"><a class="reference internal" href="#the-uds-object">88. The uds Object</a></li>
<li class="toctree-l1"><a class="reference internal" href="#a-full-example-script">89. A full example script</a></li>
</ul>
<div class="relations">
<h3>Related Topics</h3>
<ul>
<li><a href="index.html">Documentation overview</a><ul>
<li>Previous: <a href="customsender.html" title="previous chapter"><span class="section-number">74. </span>Custom Sender Window</a></li>
</ul></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<h3 id="searchlabel">Quick search</h3>
<div class="searchformwrapper">
<form class="search" action="search.html" method="get">
<input type="text" name="q" aria-labelledby="searchlabel" />
<input type="submit" value="Go" />
</form>
</div>
</div>
<script>$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="footer">
&copy;2018, EVTV.
|
Powered by <a href="http://sphinx-doc.org/">Sphinx 3.5.4</a>
&amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.8</a>
|
<a href="_sources/scriptingwindow.rst.txt"
rel="nofollow">Page source</a>
</div>
</body>
</html>