PDUConfigurator.cpp 1.27 KB
Newer Older
1
2
3
4
5
6
7
8
9
/*
 * PDUConfigurator.cpp
 *
 *  Created on: 24.02.2018
 *      Author: Micha Mueller
 */

#include "PDUConfigurator.h"

10
#include <iostream>
11
#include <sstream>
12

13
14
15
16
17
PDUConfigurator::PDUConfigurator() {
	_entityName = "pdu";
	_groupName = "group";
	_baseName = "sensor";
}
18

19
PDUConfigurator::~PDUConfigurator() {}
20

21
22
23
void PDUConfigurator::sensorBase(PDUSensorBase& s, CFG_VAL config) {
	ADD {
		ATTRIBUTE("path", setXMLPath);
24
	}
25
26
}

27
28
void PDUConfigurator::sensorGroup(PDUSensorGroup& s, CFG_VAL config) {
	ADD {
29
		ATTRIBUTE("request", setRequest);
30
	}
31
32
}

33
34
35
36
void PDUConfigurator::sensorEntity(PDUUnit& s, CFG_VAL config) {
	ADD {
		ATTRIBUTE("host", setHost);
		//TODO add support for mqttPart if required
37
	}
38
}
39

40
41
42
bool PDUConfigurator::isEntityOfGroup(PDUUnit& e, PDUSensorGroup& g) {
	return (g.getPdu() == &e);
}
43

44
45
void PDUConfigurator::setEntityForGroup(PDUUnit& e, PDUSensorGroup& g) {
	g.setPdu(&e);
46
47
}

48
49
50
void PDUConfigurator::finalizeGroup(PDUSensorGroup& g) {
	//nothing to finalize
}
Micha Mueller's avatar
Micha Mueller committed
51
52
53
54
55
56
57
58
59
60
61
62
63

void PDUConfigurator::printConfiguratorConfig(LOG_LEVEL ll) {
  LOG_VAR(ll) << "  No other plugin specific general attributes";

  LOG_VAR(ll) << " PDU Units:";
  if (_sensorEntitys.size() != 0) {
    for(auto e : _sensorEntitys) {
      e->printConfig(ll);
    }
  } else {
    LOG_VAR(ll) << "  No PDU Units present!";
  }
}