<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
That's an open end, implementing command registration for Duktape.<br>
<br>
There's a thread on this… found it:<br>
<a class="moz-txt-link-freetext" href="http://lists.openvehicles.com/pipermail/ovmsdev/2020-July/006952.html">http://lists.openvehicles.com/pipermail/ovmsdev/2020-July/006952.html</a><br>
<br>
Regards,<br>
Michael<br>
<br>
<br>
<div class="moz-cite-prefix">Am 23.10.22 um 15:38 schrieb Michael
Geddes:<br>
</div>
<blockquote type="cite"
cite="mid:CAH0p7uJjwLcvAZTpkc1CR1=nyzLiay=v07c9UCOTUPnBrUcHcQ@mail.gmail.com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<div dir="ltr">
<div>There's an unused variable 'dcc' warning in the below code.<br>
</div>
<div><br>
</div>
<div>It seems that the 'Perform the callback' is not being
'performed!</div>
<div><br>
</div>
<div>Is this deliberate?</div>
<div><br>
</div>
<div><br>
</div>
<div>//.ichael</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div>
<div style="color:rgb(212,212,212);background-color:rgb(30,30,30);font-family:Consolas,"Courier New",monospace;font-size:14px;line-height:19px;white-space:pre"><div><span style="color:rgb(86,156,214)">void</span> <span style="color:rgb(220,220,170)">DukOvmsCommandRegisterRun</span>(<span style="color:rgb(86,156,214)">int</span> <span style="color:rgb(156,220,254)">verbosity</span>, <span style="color:rgb(78,201,176)">OvmsWriter</span><span style="color:rgb(86,156,214)">*</span> <span style="color:rgb(156,220,254)">writer</span>, <span style="color:rgb(78,201,176)">OvmsCommand</span><span style="color:rgb(86,156,214)">*</span> <span style="color:rgb(156,220,254)">cmd</span>, <span style="color:rgb(86,156,214)">int</span> <span style="color:rgb(156,220,254)">argc</span>, <span style="color:rgb(86,156,214)">const</span> <span style="color:rgb(86,156,214)">char*</span> <span style="color:rgb(86,156,214)">const*</span> <span style="color:rgb(156,220,254)">argv</span>)</div><div> {</div><div> <span style="color:rgb(86,156,214)">ESP_LOGD</span>(<span style="color:rgb(156,220,254)">TAG</span>, <span style="color:rgb(206,145,120)">"DukOvmsCommandRegisterRun(</span><span style="color:rgb(156,220,254)">%s</span><span style="color:rgb(206,145,120)">)"</span>,<span style="color:rgb(156,220,254)">cmd</span>-><span style="color:rgb(220,220,170)">GetName</span>());</div>
<div> <span style="color:rgb(86,156,214)">auto</span> <span style="color:rgb(156,220,254)">it</span> = <span style="color:rgb(156,220,254)">MyDuktape</span>.<span style="color:rgb(156,220,254)">m_cmdmap</span>.<span style="color:rgb(220,220,170)">find</span>(<span style="color:rgb(156,220,254)">cmd</span>);</div><div> <span style="color:rgb(197,134,192)">if</span> (<span style="color:rgb(156,220,254)">it</span> <span style="color:rgb(220,220,170)">==</span> <span style="color:rgb(156,220,254)">MyDuktape</span>.<span style="color:rgb(156,220,254)">m_cmdmap</span>.<span style="color:rgb(220,220,170)">end</span>())</div><div> {</div><div> <span style="color:rgb(86,156,214)">ESP_LOGE</span>(<span style="color:rgb(156,220,254)">TAG</span>, <span style="color:rgb(206,145,120)">"Command '</span><span style="color:rgb(156,220,254)">%s</span><span style="color:rgb(206,145,120)">' cannot be found in registry"</span>,<span style="color:rgb(156,220,254)">cmd</span>-><span style="color:rgb(220,220,170)">GetName</span>());</div><div> <span style="color:rgb(197,134,192)">return</span>;</div><div> }</div><div> <span style="color:rgb(197,134,192)">else</span></div><div> {</div><div> <span style="color:rgb(78,201,176)">DuktapeConsoleCommand</span>* <span style="color:rgb(156,220,254)">dcc</span> = <span style="color:rgb(156,220,254)">it</span><span style="color:rgb(220,220,170)">-></span><span style="color:rgb(156,220,254)">second</span>;</div><div><span style="color:rgb(106,153,85)"> // Perform the callback</span></div><div> }</div><div> }</div>
</div>
</div>
</div>
<br>
<fieldset class="moz-mime-attachment-header"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
OvmsDev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:OvmsDev@lists.openvehicles.com">OvmsDev@lists.openvehicles.com</a>
<a class="moz-txt-link-freetext" href="http://lists.openvehicles.com/mailman/listinfo/ovmsdev">http://lists.openvehicles.com/mailman/listinfo/ovmsdev</a>
</pre>
</blockquote>
<br>
<pre class="moz-signature" cols="72">--
Michael Balzer * Helkenberger Weg 9 * D-58256 Ennepetal
Fon 02333 / 833 5735 * Handy 0176 / 206 989 26</pre>
</body>
</html>