MCPcopy Create free account
hub / github.com/apache/nifi-minifi-cpp / onEnable

Method onEnable

libminifi/src/controllers/LinuxPowerManagementService.cpp:188–221  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

186}
187
188void LinuxPowerManagerService::onEnable() {
189 if (nullptr == configuration_) {
190 logger_->log_trace("Cannot enable Linux Power Manager");
191 return;
192 }
193 status_keyword_ = "Discharging";
194 core::Property capacityPaths;
195 core::Property statusPaths;
196
197 uint64_t wait;
198 if (getProperty(TriggerThreshold.getName(), trigger_) && getProperty(WaitPeriod.getName(), wait)) {
199 wait_period_ = wait;
200
201 getProperty(BatteryStatusDischargeKeyword.getName(), status_keyword_);
202
203 if (!getProperty(LowBatteryThreshold.getName(), low_battery_trigger_)) {
204 low_battery_trigger_ = 0;
205 }
206 getProperty(BatteryCapacityPath.getName(), capacityPaths);
207 getProperty(BatteryStatusPath.getName(), statusPaths);
208 if (capacityPaths.getValues().size() == statusPaths.getValues().size()) {
209 for (size_t i = 0; i < capacityPaths.getValues().size(); i++) {
210 paths_.push_back(std::make_pair(capacityPaths.getValues().at(i), statusPaths.getValues().at(i)));
211 }
212 } else {
213 logger_->log_error("BatteryCapacityPath and BatteryStatusPath mis-configuration");
214 }
215
216 enabled_ = true;
217 logger_->log_trace("Enabled enable ");
218 } else {
219 logger_->log_trace("Could not enable ");
220 }
221}
222} // namespace controllers
223} // namespace minifi
224} // namespace nifi

Callers

nothing calls this directly

Calls 5

log_traceMethod · 0.80
getValuesMethod · 0.80
log_errorMethod · 0.80
getNameMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected