VaclavKrpec at Eaton.com
2012-Dec-11 17:53 UTC
[Nut-upsdev] libnutconf: Basic UTs for libnutconf pushed
?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
-----------------------------
