Hello everybody,

basic UTs for libnutconf were pushed to balooloo/nut,
libconf branch:

https://github.com/balooloo/nut/commit/f453459419abf6c597d5d186494f91ed6f0e81aa

Note that the tests are not exhaustive; however, they
test the most prominent (sample) configuration settings
(de)serialisation.
The code should also give you an idea about how to write
a simple configuration manipulation program using the library.
E.g. something like this should work:

nut::UpsConfiguration config;

config.parseFrom(nut::NutFile(
        "/usr/local/ups/etc/ups.conf",
        nut::NutFile::READ_ONLY));

std::cout << "my-ups description: " << config.getDescription("my-ups") << 
std::endl;

// ...

config.setDriver("my-ups", "snmp-ups");

config.writeTo(nut::NutFile(
        "/usr/local/ups/etc/ups.conf",
        nut::NutFile::WRITE_ONLY));

Regards,

vasek

--
Václav Krpec
Network UPS Tools project
Eaton Opensource Team




-----------------------------
Eaton Elektrotechnika s.r.o. ~ S�dlo spolecnosti, jak je zaps�no v rejstr�ku: 
Kom�rovsk� 2406, Praha 9 - Horn� Pocernice, 193 00, Cesk� Republika ~ Jm�no, 
m�sto, kde byla spolecnost zaregistrov�na: Praha ~ Identifikacn� c�slo (ICO): 
498 11 894 
-----------------------------


_______________________________________________
Nut-upsdev mailing list
Nut-upsdev@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/nut-upsdev

Reply via email to