no_queue value is 0xffffffff now

This commit is contained in:
Robin Müller 2020-06-06 23:41:54 +02:00
parent 65999ac6d6
commit c81613690b
4 changed files with 27 additions and 30 deletions

View File

@ -2,6 +2,8 @@
#define FRAMEWORK_IPC_MESSAGEQUEUEIF_H_
// COULDDO: We could support blocking calls
// semaphores are being implemented, which makes this idea even more iteresting.
/**
* @defgroup message_queue Message Queue

View File

@ -16,7 +16,7 @@ typedef uint32_t MessageQueueId_t;
class MessageQueueSenderIF {
public:
static const MessageQueueId_t NO_QUEUE = 0;
static const MessageQueueId_t NO_QUEUE = 0xffffffff;
virtual ~MessageQueueSenderIF() {}

View File

@ -33,15 +33,6 @@ ReturnValue_t MemoryHelper::handleMemoryCommand(CommandMessage* message) {
}
}
ReturnValue_t MemoryHelper::initialize() {
ipcStore = objectManager->get<StorageManagerIF>(objects::IPC_STORE);
if (ipcStore != NULL) {
return RETURN_OK;
} else {
return RETURN_FAILED;
}
}
void MemoryHelper::completeLoad(ReturnValue_t errorCode,
const uint8_t* dataToCopy, const uint32_t size, uint8_t* copyHere) {
busy = false;
@ -185,11 +176,18 @@ void MemoryHelper::handleMemoryCheckOrDump(CommandMessage* message) {
}
ReturnValue_t MemoryHelper::initialize(MessageQueueIF* queueToUse_) {
if(queueToUse_!=NULL){
this->queueToUse = queueToUse_;
}else{
return MessageQueueIF::NO_QUEUE;
if(queueToUse_ == nullptr) {
return HasReturnvaluesIF::RETURN_FAILED;
}
this->queueToUse = queueToUse_;
return initialize();
}
ReturnValue_t MemoryHelper::initialize() {
ipcStore = objectManager->get<StorageManagerIF>(objects::IPC_STORE);
if (ipcStore != nullptr) {
return RETURN_OK;
} else {
return RETURN_FAILED;
}
}

View File

@ -4,15 +4,13 @@
#include <framework/tmtcpacket/pus/TcPacketStored.h>
#include <framework/tmtcservices/PusVerificationReport.h>
PUSDistributor::PUSDistributor(uint16_t setApid, object_id_t setObjectId, object_id_t setPacketSource) :
TcDistributor(setObjectId), checker(setApid), verifyChannel(), currentPacket(), tcStatus(
RETURN_FAILED), packetSource(setPacketSource) {
PUSDistributor::PUSDistributor(uint16_t setApid, object_id_t setObjectId,
object_id_t setPacketSource) :
TcDistributor(setObjectId), checker(setApid), verifyChannel(),
currentPacket(), tcStatus(RETURN_FAILED),
packetSource(setPacketSource) {}
}
PUSDistributor::~PUSDistributor() {
}
PUSDistributor::~PUSDistributor() {}
iterator_t PUSDistributor::selectDestination() {
// debug << "PUSDistributor::handlePacket received: " << this->current_packet_id.store_index << ", " << this->current_packet_id.packet_index << std::endl;
@ -45,18 +43,17 @@ iterator_t PUSDistributor::selectDestination() {
//}
ReturnValue_t PUSDistributor::registerService(AcceptsTelecommandsIF* service) {
ReturnValue_t returnValue = RETURN_OK;
bool errorCode = true;
uint16_t serviceId = service->getIdentifier();
//info << "Service ID: " << (int)serviceId << std::endl;
MessageQueueId_t queue = service->getRequestQueue();
errorCode = this->queueMap.insert(
std::pair<uint32_t, MessageQueueId_t>(serviceId, queue)).second;
if (errorCode == false) {
auto returnPair = queueMap.emplace(serviceId, queue);
if (not returnPair.second) {
//TODO Return Code
returnValue = MessageQueueIF::NO_QUEUE;
sif::error << "PUSDistributor::registerService: Service ID already"
"exists in map." << std::endl;
return HasReturnvaluesIF::RETURN_FAILED;
}
return returnValue;
return HasReturnvaluesIF::RETURN_OK;
}
MessageQueueId_t PUSDistributor::getRequestQueue() {