[Nut-upsdev] [RFC] Support of ranges of values for writable variables

Arnaud Quette aquette.dev at gmail.com
Tue Apr 10 18:43:55 UTC 2012


Fellows,

I've had this stagging for too long:
For some writable (RW) variables, that support ranges of values, ENUM and
STRING are too limited and not adapted.
So it's worth adding a new RANGE type, with the needed driver function
(dstate_addrange()) and server / client support.

Thus, I'm intending to do the following network protocol addition:
    * new RANGE type, for the "GET TYPE" command. This needs the "RW" flag,
and completes existing ENUM and STRING types
    * new "LIST RANGE" command:

RANGE
~~~~~

Form:

    LIST RANGE <upsname> <varname>
    LIST RANGE su700 input.transfer.low

Response:

    BEGIN LIST RANGE <upsname> <varname>
    RANGE <upsname> <varname> "<min>" "<max>"
    ...
    END LIST RANGE <upsname> <varname>

    BEGIN LIST RANGE su700 input.transfer.low
    RANGE su700 input.transfer.low "90" "100"
    RANGE su700 input.transfer.low "102" "105"
    ...
    END LIST RANGE su700 input.transfer.low


A branch is available for review:
$ svn co svn://anonscm.debian.org/nut/branches/var-range
http://trac.networkupstools.org/projects/nut/changeset/3527

It includes the core implementation ({d,s,}state, Ie drivers,server,core
support), upsrw and the documentation updates.
Python / Perl / Java implementations, plus a bit of polishing, are the only
thing missing.

Note that this implementation supports multiple ranges specifications, as
shown above.
I'm still not sure if this is (or will be) useful, since I personally have
no example!

Here is a sample upsrw output:
[test.range.low]
Description unavailable
Type: RANGE
Option: "90-100" SELECTED
Option: "102-105"

As usual, feedback and comments welcome...

cheers,
Arnaud
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/nut-upsdev/attachments/20120410/fce458fb/attachment.html>


More information about the Nut-upsdev mailing list