WIP: somethings wrong.. #19
@ -2,6 +2,8 @@
|
|||||||
#define FRAMEWORK_IPC_MESSAGEQUEUEIF_H_
|
#define FRAMEWORK_IPC_MESSAGEQUEUEIF_H_
|
||||||
|
|
||||||
// COULDDO: We could support blocking calls
|
// COULDDO: We could support blocking calls
|
||||||
|
// semaphores are being implemented, which makes this idea even more iteresting.
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @defgroup message_queue Message Queue
|
* @defgroup message_queue Message Queue
|
||||||
|
@ -16,7 +16,7 @@ typedef uint32_t MessageQueueId_t;
|
|||||||
|
|
||||||
class MessageQueueSenderIF {
|
class MessageQueueSenderIF {
|
||||||
public:
|
public:
|
||||||
static const MessageQueueId_t NO_QUEUE = 0;
|
static const MessageQueueId_t NO_QUEUE = 0xffffffff;
|
||||||
|
|
||||||
virtual ~MessageQueueSenderIF() {}
|
virtual ~MessageQueueSenderIF() {}
|
||||||
|
|
||||||
|
@ -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,
|
void MemoryHelper::completeLoad(ReturnValue_t errorCode,
|
||||||
const uint8_t* dataToCopy, const uint32_t size, uint8_t* copyHere) {
|
const uint8_t* dataToCopy, const uint32_t size, uint8_t* copyHere) {
|
||||||
busy = false;
|
busy = false;
|
||||||
@ -185,11 +176,18 @@ void MemoryHelper::handleMemoryCheckOrDump(CommandMessage* message) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t MemoryHelper::initialize(MessageQueueIF* queueToUse_) {
|
ReturnValue_t MemoryHelper::initialize(MessageQueueIF* queueToUse_) {
|
||||||
if(queueToUse_!=NULL){
|
if(queueToUse_ == nullptr) {
|
||||||
this->queueToUse = queueToUse_;
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
}else{
|
|
||||||
return MessageQueueIF::NO_QUEUE;
|
|
||||||
}
|
}
|
||||||
|
this->queueToUse = queueToUse_;
|
||||||
return initialize();
|
return initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ReturnValue_t MemoryHelper::initialize() {
|
||||||
|
ipcStore = objectManager->get<StorageManagerIF>(objects::IPC_STORE);
|
||||||
|
if (ipcStore != nullptr) {
|
||||||
|
return RETURN_OK;
|
||||||
|
} else {
|
||||||
|
return RETURN_FAILED;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -4,15 +4,13 @@
|
|||||||
#include <framework/tmtcpacket/pus/TcPacketStored.h>
|
#include <framework/tmtcpacket/pus/TcPacketStored.h>
|
||||||
#include <framework/tmtcservices/PusVerificationReport.h>
|
#include <framework/tmtcservices/PusVerificationReport.h>
|
||||||
|
|
||||||
PUSDistributor::PUSDistributor(uint16_t setApid, object_id_t setObjectId, object_id_t setPacketSource) :
|
PUSDistributor::PUSDistributor(uint16_t setApid, object_id_t setObjectId,
|
||||||
TcDistributor(setObjectId), checker(setApid), verifyChannel(), currentPacket(), tcStatus(
|
object_id_t setPacketSource) :
|
||||||
RETURN_FAILED), packetSource(setPacketSource) {
|
TcDistributor(setObjectId), checker(setApid), verifyChannel(),
|
||||||
|
currentPacket(), tcStatus(RETURN_FAILED),
|
||||||
|
packetSource(setPacketSource) {}
|
||||||
|
|
||||||
}
|
PUSDistributor::~PUSDistributor() {}
|
||||||
|
|
||||||
PUSDistributor::~PUSDistributor() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
iterator_t PUSDistributor::selectDestination() {
|
iterator_t PUSDistributor::selectDestination() {
|
||||||
// debug << "PUSDistributor::handlePacket received: " << this->current_packet_id.store_index << ", " << this->current_packet_id.packet_index << std::endl;
|
// 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 PUSDistributor::registerService(AcceptsTelecommandsIF* service) {
|
||||||
ReturnValue_t returnValue = RETURN_OK;
|
|
||||||
bool errorCode = true;
|
|
||||||
uint16_t serviceId = service->getIdentifier();
|
uint16_t serviceId = service->getIdentifier();
|
||||||
//info << "Service ID: " << (int)serviceId << std::endl;
|
//info << "Service ID: " << (int)serviceId << std::endl;
|
||||||
MessageQueueId_t queue = service->getRequestQueue();
|
MessageQueueId_t queue = service->getRequestQueue();
|
||||||
errorCode = this->queueMap.insert(
|
auto returnPair = queueMap.emplace(serviceId, queue);
|
||||||
std::pair<uint32_t, MessageQueueId_t>(serviceId, queue)).second;
|
if (not returnPair.second) {
|
||||||
if (errorCode == false) {
|
|
||||||
//TODO Return Code
|
//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() {
|
MessageQueueId_t PUSDistributor::getRequestQueue() {
|
||||||
|
Loading…
Reference in New Issue
Block a user