some improvements
This commit is contained in:
parent
3fcbb988ae
commit
21346e40a5
@ -1,5 +1,6 @@
|
|||||||
#include "ActionHelper.h"
|
#include "ActionHelper.h"
|
||||||
#include "HasActionsIF.h"
|
#include "HasActionsIF.h"
|
||||||
|
#include "../ipc/MessageQueueSenderIF.h"
|
||||||
#include "../objectmanager/ObjectManagerIF.h"
|
#include "../objectmanager/ObjectManagerIF.h"
|
||||||
|
|
||||||
ActionHelper::ActionHelper(HasActionsIF* setOwner, MessageQueueIF* useThisQueue) :
|
ActionHelper::ActionHelper(HasActionsIF* setOwner, MessageQueueIF* useThisQueue) :
|
||||||
|
@ -18,7 +18,7 @@ MapPacketExtraction::MapPacketExtraction(uint8_t setMapId,
|
|||||||
object_id_t setPacketDestination) :
|
object_id_t setPacketDestination) :
|
||||||
lastSegmentationFlag(NO_SEGMENTATION), mapId(setMapId), packetLength(0), bufferPosition(
|
lastSegmentationFlag(NO_SEGMENTATION), mapId(setMapId), packetLength(0), bufferPosition(
|
||||||
packetBuffer), packetDestination(setPacketDestination), packetStore(
|
packetBuffer), packetDestination(setPacketDestination), packetStore(
|
||||||
NULL), tcQueueId(MessageQueueSenderIF::NO_QUEUE) {
|
NULL), tcQueueId(MessageQueueIF::NO_QUEUE) {
|
||||||
memset(packetBuffer, 0, sizeof(packetBuffer));
|
memset(packetBuffer, 0, sizeof(packetBuffer));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
#ifndef FRAMEWORK_IPC_MESSAGEQUEUEIF_H_
|
#ifndef FSFW_IPC_MESSAGEQUEUEIF_H_
|
||||||
#define FRAMEWORK_IPC_MESSAGEQUEUEIF_H_
|
#define FSFW_IPC_MESSAGEQUEUEIF_H_
|
||||||
|
|
||||||
// COULDDO: We could support blocking calls
|
// COULDDO: We could support blocking calls
|
||||||
|
|
||||||
|
#include "messageQueueDefinitions.h"
|
||||||
#include "MessageQueueMessage.h"
|
#include "MessageQueueMessage.h"
|
||||||
#include "MessageQueueSenderIF.h"
|
|
||||||
#include "../returnvalues/HasReturnvaluesIF.h"
|
#include "../returnvalues/HasReturnvaluesIF.h"
|
||||||
|
|
||||||
class MessageQueueIF {
|
class MessageQueueIF {
|
||||||
public:
|
public:
|
||||||
|
static const MessageQueueId_t NO_QUEUE = 0;
|
||||||
static const MessageQueueId_t NO_QUEUE = MessageQueueSenderIF::NO_QUEUE; //!< Ugly hack.
|
|
||||||
|
|
||||||
static const uint8_t INTERFACE_ID = CLASS_ID::MESSAGE_QUEUE_IF;
|
static const uint8_t INTERFACE_ID = CLASS_ID::MESSAGE_QUEUE_IF;
|
||||||
/**
|
/**
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
#define FSFW_IPC_MESSAGEQUEUEMESSAGE_H_
|
#define FSFW_IPC_MESSAGEQUEUEMESSAGE_H_
|
||||||
|
|
||||||
#include "../ipc/MessageQueueMessageIF.h"
|
#include "../ipc/MessageQueueMessageIF.h"
|
||||||
#include "../ipc/MessageQueueSenderIF.h"
|
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#ifndef FRAMEWORK_IPC_MESSAGEQUEUESENDERIF_H_
|
#ifndef FSFW_IPC_MESSAGEQUEUESENDERIF_H_
|
||||||
#define FRAMEWORK_IPC_MESSAGEQUEUESENDERIF_H_
|
#define FSFW_IPC_MESSAGEQUEUESENDERIF_H_
|
||||||
|
|
||||||
#include "../ipc/MessageQueueIF.h"
|
#include "../ipc/MessageQueueIF.h"
|
||||||
#include "../ipc/MessageQueueMessageIF.h"
|
#include "../ipc/MessageQueueMessageIF.h"
|
||||||
@ -15,7 +15,7 @@ public:
|
|||||||
* Not sure whether this is actually a good idea.
|
* Not sure whether this is actually a good idea.
|
||||||
*/
|
*/
|
||||||
static ReturnValue_t sendMessage(MessageQueueId_t sendTo,
|
static ReturnValue_t sendMessage(MessageQueueId_t sendTo,
|
||||||
MessageQueueMessageIF* message,
|
MessageQueueMessage* message,
|
||||||
MessageQueueId_t sentFrom = MessageQueueIF::NO_QUEUE,
|
MessageQueueId_t sentFrom = MessageQueueIF::NO_QUEUE,
|
||||||
bool ignoreFault = false);
|
bool ignoreFault = false);
|
||||||
private:
|
private:
|
||||||
@ -23,4 +23,4 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif /* FRAMEWORK_IPC_MESSAGEQUEUESENDERIF_H_ */
|
#endif /* FSFW_IPC_MESSAGEQUEUESENDERIF_H_ */
|
||||||
|
@ -15,4 +15,5 @@
|
|||||||
*/
|
*/
|
||||||
using MessageQueueId_t = uint32_t;
|
using MessageQueueId_t = uint32_t;
|
||||||
|
|
||||||
|
|
||||||
#endif /* FSFW_IPC_MESSAGEQUEUEDEFINITIONS_H_ */
|
#endif /* FSFW_IPC_MESSAGEQUEUEDEFINITIONS_H_ */
|
||||||
|
@ -36,7 +36,7 @@ ReturnValue_t ModeHelper::handleModeCommand(CommandMessage* message) {
|
|||||||
commandedMode = mode;
|
commandedMode = mode;
|
||||||
commandedSubmode = submode;
|
commandedSubmode = submode;
|
||||||
|
|
||||||
if ((parentQueueId != MessageQueueSenderIF::NO_QUEUE)
|
if ((parentQueueId != MessageQueueIF::NO_QUEUE)
|
||||||
&& (theOneWhoCommandedAMode != parentQueueId)) {
|
&& (theOneWhoCommandedAMode != parentQueueId)) {
|
||||||
owner->setToExternalControl();
|
owner->setToExternalControl();
|
||||||
}
|
}
|
||||||
@ -74,7 +74,7 @@ ReturnValue_t ModeHelper::initialize(MessageQueueId_t parentQueueId) {
|
|||||||
void ModeHelper::modeChanged(Mode_t mode, Submode_t submode) {
|
void ModeHelper::modeChanged(Mode_t mode, Submode_t submode) {
|
||||||
forced = false;
|
forced = false;
|
||||||
CommandMessage reply;
|
CommandMessage reply;
|
||||||
if (theOneWhoCommandedAMode != MessageQueueSenderIF::NO_QUEUE) {
|
if (theOneWhoCommandedAMode != MessageQueueIF::NO_QUEUE) {
|
||||||
if ((mode != commandedMode) || (submode != commandedSubmode)) {
|
if ((mode != commandedMode) || (submode != commandedSubmode)) {
|
||||||
ModeMessage::setModeMessage(&reply,
|
ModeMessage::setModeMessage(&reply,
|
||||||
ModeMessage::REPLY_WRONG_MODE_REPLY, mode, submode);
|
ModeMessage::REPLY_WRONG_MODE_REPLY, mode, submode);
|
||||||
@ -86,12 +86,12 @@ void ModeHelper::modeChanged(Mode_t mode, Submode_t submode) {
|
|||||||
owner->getCommandQueue());
|
owner->getCommandQueue());
|
||||||
}
|
}
|
||||||
if (theOneWhoCommandedAMode != parentQueueId
|
if (theOneWhoCommandedAMode != parentQueueId
|
||||||
&& parentQueueId != MessageQueueSenderIF::NO_QUEUE) {
|
&& parentQueueId != MessageQueueIF::NO_QUEUE) {
|
||||||
ModeMessage::setModeMessage(&reply, ModeMessage::REPLY_MODE_INFO, mode,
|
ModeMessage::setModeMessage(&reply, ModeMessage::REPLY_MODE_INFO, mode,
|
||||||
submode);
|
submode);
|
||||||
MessageQueueSenderIF::sendMessage(parentQueueId, &reply, owner->getCommandQueue());
|
MessageQueueSenderIF::sendMessage(parentQueueId, &reply, owner->getCommandQueue());
|
||||||
}
|
}
|
||||||
theOneWhoCommandedAMode = MessageQueueSenderIF::NO_QUEUE;
|
theOneWhoCommandedAMode = MessageQueueIF::NO_QUEUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ModeHelper::startTimer(uint32_t timeoutMs) {
|
void ModeHelper::startTimer(uint32_t timeoutMs) {
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#include "MessageQueue.h"
|
#include "MessageQueue.h"
|
||||||
|
|
||||||
|
#include "../../objectmanager/ObjectManagerIF.h"
|
||||||
#include "../../serviceinterface/ServiceInterfaceStream.h"
|
#include "../../serviceinterface/ServiceInterfaceStream.h"
|
||||||
|
|
||||||
// TODO I guess we should have a way of checking if we are in an ISR and then use the "fromISR" versions of all calls
|
// TODO I guess we should have a way of checking if we are in an ISR and then use the "fromISR" versions of all calls
|
||||||
@ -101,7 +102,8 @@ ReturnValue_t MessageQueue::sendMessageFromMessageQueue(MessageQueueId_t sendTo,
|
|||||||
reinterpret_cast<const void*>(message->getBuffer()), 0);
|
reinterpret_cast<const void*>(message->getBuffer()), 0);
|
||||||
if (result != pdPASS) {
|
if (result != pdPASS) {
|
||||||
if (!ignoreFault) {
|
if (!ignoreFault) {
|
||||||
InternalErrorReporterIF* internalErrorReporter = objectManager->get<InternalErrorReporterIF>(
|
InternalErrorReporterIF* internalErrorReporter =
|
||||||
|
objectManager->get<InternalErrorReporterIF>(
|
||||||
objects::INTERNAL_ERROR_REPORTER);
|
objects::INTERNAL_ERROR_REPORTER);
|
||||||
if (internalErrorReporter != NULL) {
|
if (internalErrorReporter != NULL) {
|
||||||
internalErrorReporter->queueMessageNotSent();
|
internalErrorReporter->queueMessageNotSent();
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
#include "../../ipc/MessageQueueSenderIF.h"
|
||||||
#include "../../ipc/QueueFactory.h"
|
#include "../../ipc/QueueFactory.h"
|
||||||
|
|
||||||
#include "MessageQueue.h"
|
#include "MessageQueue.h"
|
||||||
@ -7,8 +8,10 @@ QueueFactory* QueueFactory::factoryInstance = NULL;
|
|||||||
|
|
||||||
|
|
||||||
ReturnValue_t MessageQueueSenderIF::sendMessage(MessageQueueId_t sendTo,
|
ReturnValue_t MessageQueueSenderIF::sendMessage(MessageQueueId_t sendTo,
|
||||||
MessageQueueMessage* message, MessageQueueId_t sentFrom,bool ignoreFault) {
|
MessageQueueMessage* message, MessageQueueId_t sentFrom,
|
||||||
return MessageQueue::sendMessageFromMessageQueue(sendTo,message,sentFrom,ignoreFault);
|
bool ignoreFault) {
|
||||||
|
return MessageQueue::sendMessageFromMessageQueue(sendTo, message,
|
||||||
|
sentFrom, ignoreFault);
|
||||||
}
|
}
|
||||||
|
|
||||||
QueueFactory* QueueFactory::instance() {
|
QueueFactory* QueueFactory::instance() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user