#ifndef MONITORINGMESSAGECONTENT_H_ #define MONITORINGMESSAGECONTENT_H_ #include #include #include #include #include #include #include #include #include //PID(uint32_t), TYPE, LIMIT_ID, value,limitValue, previous, later, timestamp template class MonitoringReportContent: public SerialLinkedListAdapter { public: SerializeElement monitorId; SerializeElement parameterId; SerializeElement parameterValue; SerializeElement limitValue; SerializeElement oldState; SerializeElement newState; uint8_t rawTimestamp[TimeStamperIF::MISSION_TIMESTAMP_SIZE]; SerializeElement timestampSerializer; TimeStamperIF* timeStamper; MonitoringReportContent() : SerialLinkedListAdapter( LinkedElement::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( LinkedElement::Iterator(¶meterId)), parameterId( setPID), parameterValue(value), limitValue(limitValue), oldState( oldState), newState(newState), rawTimestamp( { 0 }), timestampSerializer(rawTimestamp, sizeof(rawTimestamp)), timeStamper(NULL) { setAllNext(); if (checkAndSetStamper()) { timeStamper->addTimeStamp(rawTimestamp, sizeof(rawTimestamp)); } } private: void setAllNext() { parameterId.setNext(¶meterValue); parameterValue.setNext(&limitValue); limitValue.setNext(&oldState); oldState.setNext(&newState); newState.setNext(×tampSerializer); } bool checkAndSetStamper() { if (timeStamper == NULL) { //TODO: Adjust name? timeStamper = objectManager->get( objects::TIME_MANAGER ); if ( timeStamper == NULL ) { error << "MonitoringReportContent::checkAndSetStamper: Stamper not found!" << std::endl; return false; } } return true; } }; //TODO: Next message would be update_limit message. //PID(uint32_t), Data{type, n_entries {LIMIT_ID(uint8_t), TYPE(uint8_t) newLimits(data, depends) template class UpdateLimitMonitorContent: public SerialLinkedListAdapter { public: SerializeElement lowValue; SerializeElement highValue; UpdateLimitMonitorContent() : SerialLinkedListAdapter(&lowValue), lowValue(0), highValue( 0) { lowValue.setNext(&highValue); } private: }; //Not used at the moment. //class EnableDisableInner: public SerialLinkedListAdapter { //public: // SerializeElement parameterId; // typedef FixedArrayList LimitIdList; // SerializeElement limitList; // EnableDisableInner() : // SerialLinkedListAdapter(¶meterId) { // parameterId.setNext(&limitList); // } //}; class EnableDisableContent { public: typedef SerialFixedArrayListAdapter EnableDisableList; EnableDisableList funkyList; EnableDisableContent() { } ReturnValue_t deSerialize(const uint8_t** buffer, int32_t* size, bool bigEndian) { return funkyList.deSerialize(buffer, size, bigEndian); } }; #endif /* MONITORINGMESSAGECONTENT_H_ */