Skip to content

Commit 44b1943

Browse files
committed
nutconf-related C++ sources: add new UPSMON-style notification keywords to vocabulary
Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
1 parent 7b225f5 commit 44b1943

4 files changed

Lines changed: 32 additions & 2 deletions

File tree

common/nutconf.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
44
Copyright (C)
55
2012 Emilien Kia <emilien.kia@gmail.com>
6+
2024 Jim Klimov <jimklimov+nut@gmail.com>
67
78
This program is free software; you can redistribute it and/or modify
89
it under the terms of the GNU General Public License as published by
@@ -1075,6 +1076,18 @@ UpsmonConfiguration::NotifyType UpsmonConfiguration::NotifyTypeFromString(const
10751076
return NOTIFY_NOCOMM;
10761077
else if(str=="NOPARENT")
10771078
return NOTIFY_NOPARENT;
1079+
else if(str=="CAL")
1080+
return NOTIFY_CAL;
1081+
else if(str=="NOTCAL")
1082+
return NOTIFY_NOTCAL;
1083+
else if(str=="OFF")
1084+
return NOTIFY_OFF;
1085+
else if(str=="NOTOFF")
1086+
return NOTIFY_NOTOFF;
1087+
else if(str=="BYPASS")
1088+
return NOTIFY_BYPASS;
1089+
else if(str=="NOTBYPASS")
1090+
return NOTIFY_NOTBYPASS;
10781091
else
10791092
return NOTIFY_TYPE_MAX;
10801093
}

common/nutwriter.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
44
Copyright (C)
55
2012 Vaclav Krpec <VaclavKrpec@Eaton.com>
6+
2024 Jim Klimov <jimklimov+nut@gmail.com>
67
78
This program is free software; you can redistribute it and/or modify
89
it under the terms of the GNU General Public License as published by
@@ -240,6 +241,12 @@ const NotifyFlagsStrings::TypeStrings NotifyFlagsStrings::type_str = {
240241
"REPLBATT", // NOTIFY_REPLBATT
241242
"NOCOMM", // NOTIFY_NOCOMM
242243
"NOPARENT", // NOTIFY_NOPARENT
244+
"CAL\t", // NOTIFY_CAL (including padding)
245+
"NOTCAL", // NOTIFY_NOTCAL
246+
"OFF\t", // NOTIFY_OFF (including padding)
247+
"NOTOFF", // NOTIFY_NOTOFF
248+
"BYPASS", // NOTIFY_BYPASS
249+
"NOTBYPASS", // NOTIFY_NOTBYPASS
243250
};
244251

245252

include/nutconf.hpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
44
Copyright (C)
55
2012 Emilien Kia <emilien.kia@gmail.com>
6+
2024 Jim Klimov <jimklimov+nut@gmail.com>
67
78
This program is free software; you can redistribute it and/or modify
89
it under the terms of the GNU General Public License as published by
@@ -658,6 +659,12 @@ class UpsmonConfiguration : public Serialisable
658659
NOTIFY_REPLBATT,
659660
NOTIFY_NOCOMM,
660661
NOTIFY_NOPARENT,
662+
NOTIFY_CAL,
663+
NOTIFY_NOTCAL,
664+
NOTIFY_OFF,
665+
NOTIFY_NOTOFF,
666+
NOTIFY_BYPASS,
667+
NOTIFY_NOTBYPASS,
661668
NOTIFY_TYPE_MAX
662669
};
663670

tools/nutconf/nutconf-cli.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
/*
2-
* Copyright (C) 2013 - EATON
2+
* Copyright (C)
3+
* 2013 - EATON
4+
* 2024 - Jim Klimov <jimklimov+nut@gmail.com>
35
*
46
* This program is free software; you can redistribute it and/or modify
57
* it under the terms of the GNU General Public License as published by
@@ -130,7 +132,8 @@ const char * Usage::s_text[] = {
130132
"UPS device is specified by the following sequence:",
131133
" <ups_ID> <driver> <port> [<key>=<value>]*",
132134
"Notification types:",
133-
" ONLINE, ONBATT, LOWBATT, FSD, COMMOK, COMMBAD, SHUTDOWN, REPLBATT, NOCOMM, NOPARENT",
135+
" ONLINE, ONBATT, LOWBATT, FSD, COMMOK, COMMBAD, SHUTDOWN, REPLBATT, NOCOMM, NOPARENT,",
136+
" CAL, NOTCAL, OFF, NOTOFF, BYPASS, NOTBYPASS",
134137
"Notification flags:",
135138
" SYSLOG, WALL, EXEC, IGNORE",
136139
"User specification:",

0 commit comments

Comments
 (0)