Merge branch 'master' into mueller/ipc-updates
This commit is contained in:
commit
170217e2e8
@ -4,13 +4,13 @@
|
||||
namespace objects {
|
||||
enum framework_objects {
|
||||
// Default verification reporter.
|
||||
PUS_SERVICE_1 = 0x53000001,
|
||||
PUS_SERVICE_2 = 0x53000002,
|
||||
PUS_SERVICE_5 = 0x53000005,
|
||||
PUS_SERVICE_8 = 0x53000008,
|
||||
PUS_SERVICE_9 = 0x53000009,
|
||||
PUS_SERVICE_17 = 0x53000017,
|
||||
PUS_SERVICE_200 = 0x53000200,
|
||||
PUS_SERVICE_1_VERIFICATION = 0x53000001,
|
||||
PUS_SERVICE_2_DEVICE_ACCESS = 0x53000002,
|
||||
PUS_SERVICE_5_EVENT_REPORTING = 0x53000005,
|
||||
PUS_SERVICE_8_FUNCTION_MGMT = 0x53000008,
|
||||
PUS_SERVICE_9_TIME_MGMT = 0x53000009,
|
||||
PUS_SERVICE_17_TEST = 0x53000017,
|
||||
PUS_SERVICE_200_MODE_MGMT = 0x53000200,
|
||||
|
||||
//Generic IDs for IPC, modes, health, events
|
||||
HEALTH_TABLE = 0x53010000,
|
||||
|
@ -1,55 +1,59 @@
|
||||
#include "../serviceinterface/ServiceInterfaceStream.h"
|
||||
#include "VerificationReporter.h"
|
||||
#include "AcceptsVerifyMessageIF.h"
|
||||
#include "PusVerificationReport.h"
|
||||
#include "VerificationReporter.h"
|
||||
|
||||
object_id_t VerificationReporter::messageReceiver = 0;
|
||||
#include "../ipc/MessageQueueIF.h"
|
||||
#include "../serviceinterface/ServiceInterfaceStream.h"
|
||||
#include "../objectmanager/frameworkObjects.h"
|
||||
|
||||
object_id_t VerificationReporter::messageReceiver =
|
||||
objects::PUS_SERVICE_1_VERIFICATION;
|
||||
|
||||
VerificationReporter::VerificationReporter() :
|
||||
acknowledgeQueue() {
|
||||
acknowledgeQueue(MessageQueueIF::NO_QUEUE) {
|
||||
}
|
||||
|
||||
VerificationReporter::~VerificationReporter() {
|
||||
//Default, empty
|
||||
}
|
||||
VerificationReporter::~VerificationReporter() {}
|
||||
|
||||
void VerificationReporter::sendSuccessReport(uint8_t set_report_id,
|
||||
TcPacketBase* current_packet, uint8_t set_step) {
|
||||
if (this->acknowledgeQueue == 0) {
|
||||
if (acknowledgeQueue == MessageQueueIF::NO_QUEUE) {
|
||||
this->initialize();
|
||||
}
|
||||
PusVerificationMessage message(set_report_id,
|
||||
current_packet->getAcknowledgeFlags(),
|
||||
current_packet->getPacketId(),
|
||||
current_packet->getPacketSequenceControl(), 0, set_step);
|
||||
ReturnValue_t status = MessageQueueSenderIF::sendMessage(acknowledgeQueue, &message);
|
||||
ReturnValue_t status = MessageQueueSenderIF::sendMessage(acknowledgeQueue,
|
||||
&message);
|
||||
if (status != HasReturnvaluesIF::RETURN_OK) {
|
||||
sif::error
|
||||
<< "VerificationReporter::sendSuccessReport: Error writing to queue. Code: "
|
||||
<< (uint16_t) status << std::endl;
|
||||
sif::error << "VerificationReporter::sendSuccessReport: Error writing "
|
||||
<< "to queue. Code: " << std::hex << status << std::dec
|
||||
<< std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
void VerificationReporter::sendSuccessReport(uint8_t set_report_id,
|
||||
uint8_t ackFlags, uint16_t tcPacketId, uint16_t tcSequenceControl,
|
||||
uint8_t set_step) {
|
||||
if (this->acknowledgeQueue == 0) {
|
||||
if (acknowledgeQueue == MessageQueueIF::NO_QUEUE) {
|
||||
this->initialize();
|
||||
}
|
||||
PusVerificationMessage message(set_report_id, ackFlags, tcPacketId,
|
||||
tcSequenceControl, 0, set_step);
|
||||
ReturnValue_t status = MessageQueueSenderIF::sendMessage(acknowledgeQueue, &message);
|
||||
ReturnValue_t status = MessageQueueSenderIF::sendMessage(acknowledgeQueue,
|
||||
&message);
|
||||
if (status != HasReturnvaluesIF::RETURN_OK) {
|
||||
sif::error
|
||||
<< "VerificationReporter::sendSuccessReport: Error writing to queue. Code: "
|
||||
<< (uint16_t) status << std::endl;
|
||||
sif::error << "VerificationReporter::sendSuccessReport: Error writing "
|
||||
<< "to queue. Code: " << std::hex << status << std::dec
|
||||
<< std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
void VerificationReporter::sendFailureReport(uint8_t report_id,
|
||||
TcPacketBase* current_packet, ReturnValue_t error_code, uint8_t step,
|
||||
uint32_t parameter1, uint32_t parameter2) {
|
||||
if (this->acknowledgeQueue == 0) {
|
||||
if (acknowledgeQueue == MessageQueueIF::NO_QUEUE) {
|
||||
this->initialize();
|
||||
}
|
||||
PusVerificationMessage message(report_id,
|
||||
@ -57,11 +61,12 @@ void VerificationReporter::sendFailureReport(uint8_t report_id,
|
||||
current_packet->getPacketId(),
|
||||
current_packet->getPacketSequenceControl(), error_code, step,
|
||||
parameter1, parameter2);
|
||||
ReturnValue_t status = MessageQueueSenderIF::sendMessage(acknowledgeQueue, &message);
|
||||
ReturnValue_t status = MessageQueueSenderIF::sendMessage(acknowledgeQueue,
|
||||
&message);
|
||||
if (status != HasReturnvaluesIF::RETURN_OK) {
|
||||
sif::error
|
||||
<< "VerificationReporter::sendFailureReport Error writing to queue. Code: "
|
||||
<< (uint16_t) status << std::endl;
|
||||
sif::error << "VerificationReporter::sendFailureReport: Error writing "
|
||||
<< "to queue. Code: " << std::hex << "0x" << status << std::dec
|
||||
<< std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
@ -69,27 +74,33 @@ void VerificationReporter::sendFailureReport(uint8_t report_id,
|
||||
uint8_t ackFlags, uint16_t tcPacketId, uint16_t tcSequenceControl,
|
||||
ReturnValue_t error_code, uint8_t step, uint32_t parameter1,
|
||||
uint32_t parameter2) {
|
||||
if (this->acknowledgeQueue == 0) {
|
||||
if (acknowledgeQueue == MessageQueueIF::NO_QUEUE) {
|
||||
this->initialize();
|
||||
}
|
||||
PusVerificationMessage message(report_id, ackFlags, tcPacketId,
|
||||
tcSequenceControl, error_code, step, parameter1, parameter2);
|
||||
ReturnValue_t status = MessageQueueSenderIF::sendMessage(acknowledgeQueue, &message);
|
||||
ReturnValue_t status = MessageQueueSenderIF::sendMessage(acknowledgeQueue,
|
||||
&message);
|
||||
if (status != HasReturnvaluesIF::RETURN_OK) {
|
||||
sif::error
|
||||
<< "VerificationReporter::sendFailureReport Error writing to queue. Code: "
|
||||
<< (uint16_t) status << std::endl;
|
||||
sif::error << "VerificationReporter::sendFailureReport: Error writing "
|
||||
<< "to queue. Code: " << std::hex << "0x" << status << std::dec
|
||||
<< std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
void VerificationReporter::initialize() {
|
||||
if(messageReceiver == objects::NO_OBJECT) {
|
||||
sif::warning << "VerificationReporter::initialize: Verification message"
|
||||
" receiver object ID not set yet in Factory!" << std::endl;
|
||||
return;
|
||||
}
|
||||
AcceptsVerifyMessageIF* temp = objectManager->get<AcceptsVerifyMessageIF>(
|
||||
messageReceiver);
|
||||
if (temp != NULL) {
|
||||
this->acknowledgeQueue = temp->getVerificationQueue();
|
||||
} else {
|
||||
sif::error
|
||||
<< "VerificationReporter::VerificationReporter: Configuration error."
|
||||
<< std::endl;
|
||||
if (temp == nullptr) {
|
||||
sif::error << "VerificationReporter::initialize: Message "
|
||||
<< "receiver invalid. Make sure it is set up properly and "
|
||||
<< "implementsAcceptsVerifyMessageIF" << std::endl;
|
||||
return;
|
||||
}
|
||||
this->acknowledgeQueue = temp->getVerificationQueue();
|
||||
}
|
||||
|
@ -1,31 +1,50 @@
|
||||
#ifndef VERIFICATIONREPORTER_H_
|
||||
#define VERIFICATIONREPORTER_H_
|
||||
#ifndef FSFW_TMTCSERVICES_VERIFICATIONREPORTER_H_
|
||||
#define FSFW_TMTCSERVICES_VERIFICATIONREPORTER_H_
|
||||
|
||||
#include "../objectmanager/ObjectManagerIF.h"
|
||||
#include "PusVerificationReport.h"
|
||||
#include "../objectmanager/ObjectManagerIF.h"
|
||||
|
||||
namespace Factory{
|
||||
void setStaticFrameworkObjectIds();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This helper object is used to forward verification messages
|
||||
* which are generated by the Flight Software Framework.
|
||||
* @details
|
||||
* The messages can be relayed to an arbitrary object, for example a dedicated
|
||||
* Verification Reporter. The destination is set by setting the static framework
|
||||
* Id VerificationReporter::messageReceiver. The default verification reporter
|
||||
* will be the PUS service 1, which sends verification messages according
|
||||
* to the PUS standard.
|
||||
*
|
||||
*/
|
||||
class VerificationReporter {
|
||||
friend void (Factory::setStaticFrameworkObjectIds)();
|
||||
public:
|
||||
VerificationReporter();
|
||||
virtual ~VerificationReporter();
|
||||
void sendSuccessReport( uint8_t set_report_id, TcPacketBase* current_packet, uint8_t set_step = 0 );
|
||||
void sendSuccessReport(uint8_t set_report_id, uint8_t ackFlags, uint16_t tcPacketId, uint16_t tcSequenceControl, uint8_t set_step = 0);
|
||||
void sendFailureReport( uint8_t report_id, TcPacketBase* current_packet, ReturnValue_t error_code = 0,
|
||||
uint8_t step = 0, uint32_t parameter1 = 0, uint32_t parameter2 = 0 );
|
||||
|
||||
void sendSuccessReport( uint8_t set_report_id, TcPacketBase* current_packet,
|
||||
uint8_t set_step = 0 );
|
||||
void sendSuccessReport(uint8_t set_report_id, uint8_t ackFlags,
|
||||
uint16_t tcPacketId, uint16_t tcSequenceControl,
|
||||
uint8_t set_step = 0);
|
||||
|
||||
void sendFailureReport( uint8_t report_id, TcPacketBase* current_packet,
|
||||
ReturnValue_t error_code = 0,
|
||||
uint8_t step = 0, uint32_t parameter1 = 0,
|
||||
uint32_t parameter2 = 0 );
|
||||
void sendFailureReport(uint8_t report_id,
|
||||
uint8_t ackFlags, uint16_t tcPacketId, uint16_t tcSequenceControl, ReturnValue_t error_code = 0, uint8_t step = 0,
|
||||
uint8_t ackFlags, uint16_t tcPacketId, uint16_t tcSequenceControl,
|
||||
ReturnValue_t error_code = 0, uint8_t step = 0,
|
||||
uint32_t parameter1 = 0, uint32_t parameter2 = 0);
|
||||
|
||||
void initialize();
|
||||
|
||||
private:
|
||||
static object_id_t messageReceiver;
|
||||
MessageQueueId_t acknowledgeQueue;
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif /* VERIFICATIONREPORTER_H_ */
|
||||
#endif /* FSFW_TMTCSERVICES_VERIFICATIONREPORTER_H_ */
|
||||
|
Loading…
Reference in New Issue
Block a user