updating code from Flying Laptop
This is the framework of Flying Laptop OBSW version A.13.0.
This commit is contained in:
@ -1,17 +1,12 @@
|
||||
/*
|
||||
* VerificationReporter.cpp
|
||||
*
|
||||
* Created on: 20.07.2012
|
||||
* Author: baetz
|
||||
*/
|
||||
|
||||
#include <framework/serviceinterface/ServiceInterfaceStream.h>
|
||||
#include <framework/tmtcservices/AcceptsVerifyMessageIF.h>
|
||||
#include <framework/tmtcservices/PusVerificationReport.h>
|
||||
#include <framework/tmtcservices/VerificationReporter.h>
|
||||
|
||||
object_id_t VerificationReporter::messageReceiver = 0;
|
||||
|
||||
VerificationReporter::VerificationReporter() :
|
||||
acknowledge_queue() {
|
||||
acknowledgeQueue() {
|
||||
}
|
||||
|
||||
VerificationReporter::~VerificationReporter() {
|
||||
@ -20,12 +15,15 @@ VerificationReporter::~VerificationReporter() {
|
||||
|
||||
void VerificationReporter::sendSuccessReport(uint8_t set_report_id,
|
||||
TcPacketBase* current_packet, uint8_t set_step) {
|
||||
if (this->acknowledge_queue.getDefaultDestination() == 0) {
|
||||
if (this->acknowledgeQueue == 0) {
|
||||
this->initialize();
|
||||
}
|
||||
PusVerificationMessage message(set_report_id, current_packet->getAcknowledgeFlags(), current_packet->getPacketId(), current_packet->getPacketSequenceControl(), set_step);
|
||||
ReturnValue_t status = this->acknowledge_queue.sendToDefault(&message);
|
||||
if (status != OSAL::RETURN_OK) {
|
||||
PusVerificationMessage message(set_report_id,
|
||||
current_packet->getAcknowledgeFlags(),
|
||||
current_packet->getPacketId(),
|
||||
current_packet->getPacketSequenceControl(), 0, set_step);
|
||||
ReturnValue_t status = MessageQueueSenderIF::sendMessage(acknowledgeQueue, &message);
|
||||
if (status != HasReturnvaluesIF::RETURN_OK) {
|
||||
error
|
||||
<< "VerificationReporter::sendSuccessReport: Error writing to queue. Code: "
|
||||
<< (uint16_t) status << std::endl;
|
||||
@ -33,13 +31,15 @@ void VerificationReporter::sendSuccessReport(uint8_t set_report_id,
|
||||
}
|
||||
|
||||
void VerificationReporter::sendSuccessReport(uint8_t set_report_id,
|
||||
uint8_t ackFlags, uint16_t tcPacketId, uint16_t tcSequenceControl, uint8_t set_step) {
|
||||
if (this->acknowledge_queue.getDefaultDestination() == 0) {
|
||||
uint8_t ackFlags, uint16_t tcPacketId, uint16_t tcSequenceControl,
|
||||
uint8_t set_step) {
|
||||
if (this->acknowledgeQueue == 0) {
|
||||
this->initialize();
|
||||
}
|
||||
PusVerificationMessage message(set_report_id, ackFlags, tcPacketId, tcSequenceControl, set_step);
|
||||
ReturnValue_t status = this->acknowledge_queue.sendToDefault(&message);
|
||||
if (status != OSAL::RETURN_OK) {
|
||||
PusVerificationMessage message(set_report_id, ackFlags, tcPacketId,
|
||||
tcSequenceControl, 0, set_step);
|
||||
ReturnValue_t status = MessageQueueSenderIF::sendMessage(acknowledgeQueue, &message);
|
||||
if (status != HasReturnvaluesIF::RETURN_OK) {
|
||||
error
|
||||
<< "VerificationReporter::sendSuccessReport: Error writing to queue. Code: "
|
||||
<< (uint16_t) status << std::endl;
|
||||
@ -49,13 +49,16 @@ void VerificationReporter::sendSuccessReport(uint8_t set_report_id,
|
||||
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->acknowledge_queue.getDefaultDestination() == 0) {
|
||||
if (this->acknowledgeQueue == 0) {
|
||||
this->initialize();
|
||||
}
|
||||
PusVerificationMessage message(report_id, current_packet->getAcknowledgeFlags(), current_packet->getPacketId(), current_packet->getPacketSequenceControl(), error_code, step,
|
||||
PusVerificationMessage message(report_id,
|
||||
current_packet->getAcknowledgeFlags(),
|
||||
current_packet->getPacketId(),
|
||||
current_packet->getPacketSequenceControl(), error_code, step,
|
||||
parameter1, parameter2);
|
||||
ReturnValue_t status = this->acknowledge_queue.sendToDefault(&message);
|
||||
if (status != OSAL::RETURN_OK) {
|
||||
ReturnValue_t status = MessageQueueSenderIF::sendMessage(acknowledgeQueue, &message);
|
||||
if (status != HasReturnvaluesIF::RETURN_OK) {
|
||||
error
|
||||
<< "VerificationReporter::sendFailureReport Error writing to queue. Code: "
|
||||
<< (uint16_t) status << std::endl;
|
||||
@ -63,15 +66,16 @@ void VerificationReporter::sendFailureReport(uint8_t report_id,
|
||||
}
|
||||
|
||||
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->acknowledge_queue.getDefaultDestination() == 0) {
|
||||
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) {
|
||||
this->initialize();
|
||||
}
|
||||
PusVerificationMessage message(report_id, ackFlags, tcPacketId, tcSequenceControl, error_code, step,
|
||||
parameter1, parameter2);
|
||||
ReturnValue_t status = this->acknowledge_queue.sendToDefault(&message);
|
||||
if (status != OSAL::RETURN_OK) {
|
||||
PusVerificationMessage message(report_id, ackFlags, tcPacketId,
|
||||
tcSequenceControl, error_code, step, parameter1, parameter2);
|
||||
ReturnValue_t status = MessageQueueSenderIF::sendMessage(acknowledgeQueue, &message);
|
||||
if (status != HasReturnvaluesIF::RETURN_OK) {
|
||||
error
|
||||
<< "VerificationReporter::sendFailureReport Error writing to queue. Code: "
|
||||
<< (uint16_t) status << std::endl;
|
||||
@ -80,10 +84,9 @@ void VerificationReporter::sendFailureReport(uint8_t report_id,
|
||||
|
||||
void VerificationReporter::initialize() {
|
||||
AcceptsVerifyMessageIF* temp = objectManager->get<AcceptsVerifyMessageIF>(
|
||||
objects::PUS_VERIFICATION_SERVICE);
|
||||
messageReceiver);
|
||||
if (temp != NULL) {
|
||||
this->acknowledge_queue.setDefaultDestination(
|
||||
temp->getVerificationQueue());
|
||||
this->acknowledgeQueue = temp->getVerificationQueue();
|
||||
} else {
|
||||
error
|
||||
<< "VerificationReporter::VerificationReporter: Configuration error."
|
||||
|
Reference in New Issue
Block a user