<html><head></head><body><div style="font-family:Helvetica Neue, Helvetica, Arial, sans-serif;font-size:13px;"><div style="font-family:Helvetica Neue, Helvetica, Arial, sans-serif;font-size:13px;"><div></div>
        <div>Done. </div><div><a href="https://github.com/openvehicles/Open-Vehicle-Monitoring-System-3/pull/143" rel="nofollow" target="_blank" class="">https://github.com/openvehicles/Open-Vehicle-Monitoring-System-3/pull/143</a><br></div><div><br></div><div>I have not tested this in a vehicle.</div><div>It would take some time to receive the new boxes, but I thought it may help someone to go further. </div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div>
        
        </div><div id="yahoo_quoted_2652681336" class="yahoo_quoted">
            <div style="font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:13px;color:#26282a;">
                
                <div>
                    On Thursday, July 19, 2018, 12:46:28 PM GMT+2, Mark Webb-Johnson <mark@webb-johnson.net> wrote:
                </div>
                <div><br></div>
                <div><br></div>
                <div><div id="yiv9991126179"><div><div></div><div>Best is to create a pull request, and let us know. We can check and merge with master.</div><div><br clear="none"></div><div>Regards, Mark</div><div class="yiv9991126179yqt4942752334" id="yiv9991126179yqt29398"><div><br clear="none">On 19 Jul 2018, at 6:41 PM, Nikolay Shishkov <<a rel="nofollow" shape="rect" ymailto="mailto:nshishkov@yahoo.com" target="_blank" href="mailto:nshishkov@yahoo.com">nshishkov@yahoo.com</a>> wrote:<br clear="none"><br clear="none"></div><blockquote type="cite"><div><div style="font-family:Helvetica Neue, Helvetica, Arial, sans-serif;font-size:13px;"><div style="font-family:Helvetica Neue, Helvetica, Arial, sans-serif;font-size:13px;"><div></div>
        <div>Thank you guys!</div><div>I think I am ready with something I want to create pull request on. Do I do this through my own repository, or can I just send someone a diff?</div><div>Nikolay</div><div><br clear="none"></div>
        
        </div><div class="yiv9991126179yahoo_quoted" id="yiv9991126179yahoo_quoted_2418342972">
            <div style="font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:13px;color:#26282a;">
                
                <div>
                    On Thursday, July 19, 2018, 12:37:58 PM GMT+2, Michael Balzer <<a rel="nofollow" shape="rect" ymailto="mailto:dexter@expeedo.de" target="_blank" href="mailto:dexter@expeedo.de">dexter@expeedo.de</a>> wrote:
                </div>
                <div><br clear="none"></div>
                <div><br clear="none"></div>
                <div><div id="yiv9991126179"><div>
    Nikolay,<br clear="none">
    <br clear="none">
    <blockquote type="cite">
      </blockquote></div><div><blockquote class="yiv9991126179" type="cite">
        <div class="yiv9991126179">
          <div class="yiv9991126179" style="">
            <div class="yiv9991126179">
              <div class="yiv9991126179">
                <div class="yiv9991126179">- what is the best way to compare
                  OvmsMetricStrings? Or should I dublicate the state in
                  an enum and use that?</div>
                <div class="yiv9991126179">- what is the best way to compare the
                  OvmsMetricFloat to a literal float?</div>
              </div>
            </div>
          </div>
        </div>
      </blockquote>
    
    <br clear="none">
    If you want to compare a state code encoded as a string, you can
    simply compare the std::string returned by AsString() with hard
    coded strings, e.g.<br clear="none">
    <br clear="none">
    <tt>    std::string charge_state =
      StdMetrics.ms_v_charge_state->AsString();</tt><tt><br clear="none">
    </tt><tt>    if (charge_state == "charging")</tt><tt><br clear="none">
    </tt><tt>        …</tt><tt><br clear="none">
    </tt><br clear="none">
    If you'd rather use the old numeric state codes, there are utility
    functions in the ovms_utils module for encoding / decoding them.<br clear="none">
    <br clear="none">
    As Mark wrote, you get the float value by the AsFloat() method and
    can compare that directly to a float literal. We haven't added
    comparison operators to the metrics classes yet, just assignment
    (and that needs casts in many cases). If you'd like to add more
    operators/types, go ahead.<br clear="none">
    <br clear="none">
    <br clear="none">
    <blockquote type="cite"><br clear="none" class="yiv9991126179">
      <blockquote class="yiv9991126179" type="cite">
        <div class="yiv9991126179">
          <div class="yiv9991126179" style="">
            <div class="yiv9991126179">
              <div class="yiv9991126179">
                <div class="yiv9991126179">- what is the current way of doing <span class="yiv9991126179">net_req_notification</span></div>
              </div>
            </div>
          </div>
        </div>
      </blockquote>
      <div><br clear="none" class="yiv9991126179">
      </div>
      <div>Not required in v3. If you change a metric that needs
        notification, the serverv2 and serverv3 will act appropriately.</div>
    </blockquote>
    <br clear="none">
    And if you want to customize standard notifications, you can do so
    by overloading the vehicle methods:<br clear="none">
    <br clear="none">
    <tt>    virtual void NotifyChargeState();</tt><tt><br clear="none">
    </tt><tt>    virtual void NotifyChargeStart();</tt><tt><br clear="none">
    </tt><tt>    virtual void NotifyHeatingStart();</tt><tt><br clear="none">
    </tt><tt>    virtual void NotifyChargeStopped();</tt><tt><br clear="none">
    </tt><tt>    virtual void NotifyChargeDone();</tt><tt><br clear="none">
    </tt><tt>    virtual void NotifyValetEnabled();</tt><tt><br clear="none">
    </tt><tt>    virtual void NotifyValetDisabled();</tt><tt><br clear="none">
    </tt><tt>    virtual void NotifyValetHood();</tt><tt><br clear="none">
    </tt><tt>    virtual void NotifyValetTrunk();</tt><tt><br clear="none">
    </tt><tt>    virtual void NotifyAlarmSounding();</tt><tt><br clear="none">
    </tt><tt>    virtual void NotifyAlarmStopped();</tt><tt><br clear="none">
    </tt><tt>    virtual void Notify12vCritical();</tt><tt><br clear="none">
    </tt><tt>    virtual void Notify12vRecovered();</tt><br clear="none">
    <br clear="none">
    If you want to add vehicle specific notifications, take a look at
    the Twizy module (rt_notify).<br clear="none">
    <br clear="none">
    You can simply send a notification from any command output by
    issuing MyNotify.NotifyCommand() (att: stack intensive) or send any
    string by MyNotify.NotifyString(). There are also varargs versions
    with "f" suffix acting like printf.<br clear="none">
    <br clear="none">
    For building strings from command methods, there is the StringWriter
    class, that's a std::string that can be used as an OvmsWriter.
    Example:<br clear="none">
    <br clear="none">
    <tt>    StringWriter buf(200);</tt><tt><br clear="none">
    </tt><tt>    CommandStat(COMMAND_RESULT_NORMAL, &buf);</tt><tt><br clear="none">
    </tt><tt>    MyNotify.NotifyString("info", "charge.sufficient",
      buf.c_str());</tt><br clear="none">
    <br clear="none">
    Best practice is to send notifications from within an event handler
    (e.g. Ticker1), so they run asynchronously in the event task context
    instead of blocking something.<br clear="none">
    <br clear="none">
    Regards,<br clear="none">
    Michael<br clear="none">
    <br clear="none">
    PS: we should start collecting these pieces for the developer
    manual, the general system API is quite mature now<div class="yiv9991126179yqt4097312186" id="yiv9991126179yqtfd36178"><br clear="none">
    <br clear="none">
    <br clear="none">
    </div><blockquote type="cite"><div class="yiv9991126179yqt4097312186" id="yiv9991126179yqtfd98875">On
      19 Jul 2018, at 6:00 AM, Nikolay Shishkov <<a rel="nofollow" shape="rect" class="yiv9991126179" ymailto="mailto:nshishkov@yahoo.com" target="_blank" href="mailto:nshishkov@yahoo.com">nshishkov@yahoo.com</a>> wrote:
      </div><div><div class="yiv9991126179yqt4097312186" id="yiv9991126179yqtfd84373">
        </div><blockquote class="yiv9991126179" type="cite"><div class="yiv9991126179yqt4097312186" id="yiv9991126179yqtfd08496"><br clear="none" class="yiv9991126179Apple-interchange-newline">
          </div><div class="yiv9991126179"><div class="yiv9991126179yqt4097312186" id="yiv9991126179yqtfd35976">
            </div><div class="yiv9991126179"><div class="yiv9991126179yqt4097312186" id="yiv9991126179yqtfd14102">
              </div><div class="yiv9991126179" style="font-family:Helvetica Neue, Helvetica, Arial, sans-serif;font-size:13px;"><div class="yiv9991126179yqt4097312186" id="yiv9991126179yqtfd61138">
                <div class="yiv9991126179" style="font-family:Helvetica Neue, Helvetica, Arial, sans-serif;font-size:13px;">
                  <div class="yiv9991126179" style="font-family:Helvetica Neue, Helvetica, Arial, sans-serif;font-size:13px;">
                    <div class="yiv9991126179">Hi, </div>
                    <div class="yiv9991126179">I am working on the Think City EV code
                      and have some questions.</div>
                    <div class="yiv9991126179">- what is the best way to signal that
                      the charging connector is plugged?
                      ms_v_charge_pilot?</div>
                    <div class="yiv9991126179">previously it was cardoorbits1. </div>
                    <div class="yiv9991126179"><br clear="none" class="yiv9991126179">
                    </div>
                    <div class="yiv9991126179">- what is the best way to compare
                      OvmsMetricStrings? Or should I dublicate the state
                      in an enum and use that?</div>
                    <div class="yiv9991126179"><br clear="none" class="yiv9991126179">
                    </div>
                    <div class="yiv9991126179">- what is the best way to compare the
                      OvmsMetricFloat to a literal float?</div>
                    <div class="yiv9991126179"><br clear="none" class="yiv9991126179">
                    </div>
                    <div class="yiv9991126179">- what is the current way of doing <span class="yiv9991126179">net_req_notification</span></div>
                    <div class="yiv9991126179"><br clear="none" class="yiv9991126179">
                    </div>
                    <div class="yiv9991126179">Thanks in advance,</div>
                    <div class="yiv9991126179">Nikolay</div>
                  </div>
                </div>
                </div><div class="yiv9991126179yahoo_quoted" id="yiv9991126179yahoo_quoted_1950539485"><div class="yiv9991126179yqt4097312186" id="yiv9991126179yqtfd09252">
                  </div><div class="yiv9991126179" style="font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:13px;color:#26282a;"><div class="yiv9991126179yqt4097312186" id="yiv9991126179yqtfd20374">
                    <div class="yiv9991126179"> On Tuesday, July 17, 2018, 3:37:49 AM
                      GMT+2, Mark Webb-Johnson <<a rel="nofollow" shape="rect" class="yiv9991126179" ymailto="mailto:mark@webb-johnson.net" target="_blank" href="mailto:mark@webb-johnson.net">mark@webb-johnson.net</a>>
                      wrote: </div></div>
                    <br clear="none">
                  </div>
                </div>
              </div>
            </div>
          </div>
        </blockquote>
      </div>
    </blockquote>
    <br clear="none">
    <pre class="yiv9991126179moz-signature">-- 
Michael Balzer * Helkenberger Weg 9 * D-58256 Ennepetal
Fon 02333 / 833 5735 * Handy 0176 / 206 989 26
</pre><div class="yiv9991126179yqt4097312186" id="yiv9991126179yqtfd11498">
  </div></div></div><div class="yiv9991126179yqt4097312186" id="yiv9991126179yqtfd59892">_______________________________________________<br clear="none">OvmsDev mailing list<br clear="none"><a rel="nofollow" shape="rect" ymailto="mailto:OvmsDev@lists.openvehicles.com" target="_blank" href="mailto:OvmsDev@lists.openvehicles.com">OvmsDev@lists.openvehicles.com</a><br clear="none"><a rel="nofollow" shape="rect" target="_blank" href="http://lists.openvehicles.com/mailman/listinfo/ovmsdev">http://lists.openvehicles.com/mailman/listinfo/ovmsdev</a><br clear="none"></div></div>
            </div>
        </div></div></div></blockquote></div><blockquote type="cite"><div><span>_______________________________________________</span><br clear="none"><span>OvmsDev mailing list</span><br clear="none"><span><a rel="nofollow" shape="rect" ymailto="mailto:OvmsDev@lists.openvehicles.com" target="_blank" href="mailto:OvmsDev@lists.openvehicles.com">OvmsDev@lists.openvehicles.com</a></span><br clear="none"><span><a rel="nofollow" shape="rect" target="_blank" href="http://lists.openvehicles.com/mailman/listinfo/ovmsdev">http://lists.openvehicles.com/mailman/listinfo/ovmsdev</a></span><br clear="none"></div></blockquote></div></div><div class="yqt4942752334" id="yqt58658">_______________________________________________<br clear="none">OvmsDev mailing list<br clear="none"><a shape="rect" ymailto="mailto:OvmsDev@lists.openvehicles.com" href="mailto:OvmsDev@lists.openvehicles.com">OvmsDev@lists.openvehicles.com</a><br clear="none"><a shape="rect" href="http://lists.openvehicles.com/mailman/listinfo/ovmsdev" target="_blank">http://lists.openvehicles.com/mailman/listinfo/ovmsdev</a><br clear="none"></div></div>
            </div>
        </div></div></body></html>