2016-06-15 23:48:41 +02:00
|
|
|
#ifndef MONITORINGMESSAGECONTENT_H_
|
|
|
|
#define MONITORINGMESSAGECONTENT_H_
|
|
|
|
|
|
|
|
#include <framework/monitoring/HasMonitorsIF.h>
|
|
|
|
#include <framework/monitoring/MonitoringIF.h>
|
|
|
|
#include <framework/objectmanager/ObjectManagerIF.h>
|
|
|
|
#include <framework/serialize/SerialBufferAdapter.h>
|
|
|
|
#include <framework/serialize/SerialFixedArrayListAdapter.h>
|
|
|
|
#include <framework/serialize/SerializeElement.h>
|
|
|
|
#include <framework/serialize/SerialLinkedListAdapter.h>
|
|
|
|
#include <framework/serviceinterface/ServiceInterfaceStream.h>
|
|
|
|
#include <framework/timemanager/TimeStamperIF.h>
|
|
|
|
|
2018-07-12 16:29:32 +02:00
|
|
|
namespace Factory{
|
|
|
|
void setStaticFrameworkObjectIds();
|
|
|
|
}
|
|
|
|
|
2016-06-15 23:48:41 +02:00
|
|
|
//PID(uint32_t), TYPE, LIMIT_ID, value,limitValue, previous, later, timestamp
|
|
|
|
template<typename T>
|
|
|
|
class MonitoringReportContent: public SerialLinkedListAdapter<SerializeIF> {
|
2018-07-12 16:29:32 +02:00
|
|
|
friend void (Factory::setStaticFrameworkObjectIds)();
|
2016-06-15 23:48:41 +02:00
|
|
|
public:
|
|
|
|
SerializeElement<uint8_t> monitorId;
|
|
|
|
SerializeElement<uint32_t> parameterId;
|
|
|
|
SerializeElement<T> parameterValue;
|
|
|
|
SerializeElement<T> limitValue;
|
|
|
|
SerializeElement<ReturnValue_t> oldState;
|
|
|
|
SerializeElement<ReturnValue_t> newState;
|
|
|
|
uint8_t rawTimestamp[TimeStamperIF::MISSION_TIMESTAMP_SIZE];
|
2018-07-12 16:29:32 +02:00
|
|
|
SerializeElement<SerialBufferAdapter<uint8_t>> timestampSerializer;
|
2016-06-15 23:48:41 +02:00
|
|
|
TimeStamperIF* timeStamper;
|
|
|
|
MonitoringReportContent() :
|
|
|
|
SerialLinkedListAdapter<SerializeIF>(
|
|
|
|
LinkedElement<SerializeIF>::Iterator(¶meterId)), monitorId(0), parameterId(
|
|
|
|
0), parameterValue(0), limitValue(0), oldState(0), newState(
|
|
|
|
0), rawTimestamp( { 0 }), timestampSerializer(rawTimestamp,
|
|
|
|
sizeof(rawTimestamp)), timeStamper(NULL) {
|
|
|
|
setAllNext();
|
|
|
|
}
|
|
|
|
MonitoringReportContent(uint32_t setPID, T value, T limitValue,
|
|
|
|
ReturnValue_t oldState, ReturnValue_t newState) :
|
|
|
|
SerialLinkedListAdapter<SerializeIF>(
|
2018-07-12 16:29:32 +02:00
|
|
|
LinkedElement<SerializeIF>::Iterator(¶meterId)), monitorId(0), parameterId(
|
2016-06-15 23:48:41 +02:00
|
|
|
setPID), parameterValue(value), limitValue(limitValue), oldState(
|
2018-07-12 16:29:32 +02:00
|
|
|
oldState), newState(newState), timestampSerializer(rawTimestamp,
|
2016-06-15 23:48:41 +02:00
|
|
|
sizeof(rawTimestamp)), timeStamper(NULL) {
|
|
|
|
setAllNext();
|
|
|
|
if (checkAndSetStamper()) {
|
|
|
|
timeStamper->addTimeStamp(rawTimestamp, sizeof(rawTimestamp));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
private:
|
2018-07-12 16:29:32 +02:00
|
|
|
|
|
|
|
static object_id_t timeStamperId;
|
2016-06-15 23:48:41 +02:00
|
|
|
void setAllNext() {
|
|
|
|
parameterId.setNext(¶meterValue);
|
|
|
|
parameterValue.setNext(&limitValue);
|
|
|
|
limitValue.setNext(&oldState);
|
|
|
|
oldState.setNext(&newState);
|
|
|
|
newState.setNext(×tampSerializer);
|
|
|
|
}
|
|
|
|
bool checkAndSetStamper() {
|
|
|
|
if (timeStamper == NULL) {
|
2018-07-12 16:29:32 +02:00
|
|
|
timeStamper = objectManager->get<TimeStamperIF>( timeStamperId );
|
2016-06-15 23:48:41 +02:00
|
|
|
if ( timeStamper == NULL ) {
|
|
|
|
error << "MonitoringReportContent::checkAndSetStamper: Stamper not found!" << std::endl;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
template<typename T>
|
2018-07-12 16:29:32 +02:00
|
|
|
object_id_t MonitoringReportContent<T>::timeStamperId = 0;
|
2016-06-15 23:48:41 +02:00
|
|
|
|
|
|
|
#endif /* MONITORINGMESSAGECONTENT_H_ */
|