yaaay, hardcoded values
This commit is contained in:
parent
c81613690b
commit
33cc8591dc
@ -1,9 +1,8 @@
|
||||
#include <framework/health/HealthHelper.h>
|
||||
#include <framework/ipc/MessageQueueSenderIF.h>
|
||||
#include <framework/serviceinterface/ServiceInterfaceStream.h>
|
||||
|
||||
HealthHelper::HealthHelper(HasHealthIF* owner, object_id_t objectId) :
|
||||
healthTable(NULL), eventSender(NULL), objectId(objectId), parentQueue(
|
||||
0), owner(owner) {
|
||||
objectId(objectId), owner(owner) {
|
||||
}
|
||||
|
||||
HealthHelper::~HealthHelper() {
|
||||
|
@ -1,11 +1,12 @@
|
||||
#ifndef HEALTHHELPER_H_
|
||||
#define HEALTHHELPER_H_
|
||||
#ifndef FRAMEWORK_HEALTH_HEALTHHELPER_H_
|
||||
#define FRAMEWORK_HEALTH_HEALTHHELPER_H_
|
||||
|
||||
#include <framework/events/EventManagerIF.h>
|
||||
#include <framework/events/EventReportingProxyIF.h>
|
||||
#include <framework/health/HasHealthIF.h>
|
||||
#include <framework/health/HealthMessage.h>
|
||||
#include <framework/health/HealthTableIF.h>
|
||||
#include <framework/ipc/MessageQueueIF.h>
|
||||
#include <framework/objectmanager/ObjectManagerIF.h>
|
||||
#include <framework/returnvalues/HasReturnvaluesIF.h>
|
||||
|
||||
@ -39,12 +40,12 @@ public:
|
||||
*
|
||||
* only valid after initialize() has been called
|
||||
*/
|
||||
HealthTableIF *healthTable;
|
||||
HealthTableIF *healthTable = nullptr;
|
||||
|
||||
/**
|
||||
* Proxy to forward events.
|
||||
*/
|
||||
EventReportingProxyIF* eventSender;
|
||||
EventReportingProxyIF* eventSender = nullptr;
|
||||
|
||||
/**
|
||||
* Try to handle the message.
|
||||
@ -100,7 +101,7 @@ private:
|
||||
/**
|
||||
* The Queue of the parent
|
||||
*/
|
||||
MessageQueueId_t parentQueue;
|
||||
MessageQueueId_t parentQueue = MessageQueueIF::NO_QUEUE;
|
||||
|
||||
/**
|
||||
* The one using the healthHelper.
|
||||
|
@ -5,10 +5,10 @@
|
||||
#include <framework/serialize/EndianSwapper.h>
|
||||
#include <framework/serviceinterface/ServiceInterfaceStream.h>
|
||||
|
||||
MemoryHelper::MemoryHelper(HasMemoryIF* workOnThis, MessageQueueIF* useThisQueue) :
|
||||
workOnThis(workOnThis), queueToUse(useThisQueue), ipcStore(NULL), ipcAddress(), lastCommand(
|
||||
CommandMessage::CMD_NONE), lastSender(0), reservedSpaceInIPC(
|
||||
NULL), busy(false) {
|
||||
MemoryHelper::MemoryHelper(HasMemoryIF* workOnThis,
|
||||
MessageQueueIF* useThisQueue):
|
||||
workOnThis(workOnThis), queueToUse(useThisQueue), ipcStore(nullptr),
|
||||
ipcAddress(), lastCommand(CommandMessage::CMD_NONE), busy(false) {
|
||||
}
|
||||
|
||||
ReturnValue_t MemoryHelper::handleMemoryCommand(CommandMessage* message) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
#ifndef MEMORYHELPER_H_
|
||||
#define MEMORYHELPER_H_
|
||||
#ifndef FRAMEWORK_MEMORY_MEMORYHELPER_H_
|
||||
#define FRAMEWORK_MEMORY_MEMORYHELPER_H_
|
||||
#include <framework/ipc/CommandMessage.h>
|
||||
#include <framework/memory/AcceptsMemoryMessagesIF.h>
|
||||
#include <framework/returnvalues/HasReturnvaluesIF.h>
|
||||
@ -16,11 +16,11 @@ public:
|
||||
private:
|
||||
HasMemoryIF* workOnThis;
|
||||
MessageQueueIF* queueToUse;
|
||||
StorageManagerIF* ipcStore;
|
||||
StorageManagerIF* ipcStore = nullptr;
|
||||
store_address_t ipcAddress;
|
||||
Command_t lastCommand;
|
||||
MessageQueueId_t lastSender;
|
||||
uint8_t* reservedSpaceInIPC;
|
||||
MessageQueueId_t lastSender = MessageQueueIF::NO_QUEUE;
|
||||
uint8_t* reservedSpaceInIPC = nullptr;
|
||||
bool busy;
|
||||
void handleMemoryLoad(CommandMessage* message);
|
||||
void handleMemoryCheckOrDump(CommandMessage* message);
|
||||
|
@ -1,13 +1,11 @@
|
||||
#include <framework/modes/HasModesIF.h>
|
||||
#include <framework/modes/ModeHelper.h>
|
||||
#include <framework/ipc/MessageQueueSenderIF.h>
|
||||
#include <framework/serviceinterface/ServiceInterfaceStream.h>
|
||||
|
||||
ModeHelper::ModeHelper(HasModesIF *owner) :
|
||||
theOneWhoCommandedAMode(0), commandedMode(HasModesIF::MODE_OFF), commandedSubmode(
|
||||
HasModesIF::SUBMODE_NONE), owner(owner), parentQueueId(0), forced(
|
||||
false) {
|
||||
}
|
||||
commandedMode(HasModesIF::MODE_OFF),
|
||||
commandedSubmode(HasModesIF::SUBMODE_NONE),
|
||||
owner(owner), forced(false) {}
|
||||
|
||||
ModeHelper::~ModeHelper() {
|
||||
|
||||
@ -71,27 +69,45 @@ ReturnValue_t ModeHelper::initialize(MessageQueueId_t parentQueueId) {
|
||||
return initialize();
|
||||
}
|
||||
|
||||
void ModeHelper::modeChanged(Mode_t mode, Submode_t submode) {
|
||||
void ModeHelper::modeChanged(Mode_t ownerMode, Submode_t ownerSubmode) {
|
||||
forced = false;
|
||||
sendModeReplyMessage(ownerMode, ownerSubmode);
|
||||
sendModeInfoMessage(ownerMode, ownerSubmode);
|
||||
theOneWhoCommandedAMode = MessageQueueSenderIF::NO_QUEUE;
|
||||
}
|
||||
|
||||
void ModeHelper::sendModeReplyMessage(Mode_t ownerMode,
|
||||
Submode_t ownerSubmode) {
|
||||
CommandMessage reply;
|
||||
if (theOneWhoCommandedAMode != MessageQueueSenderIF::NO_QUEUE) {
|
||||
if ((mode != commandedMode) || (submode != commandedSubmode)) {
|
||||
if (theOneWhoCommandedAMode != MessageQueueSenderIF::NO_QUEUE)
|
||||
{
|
||||
if (ownerMode != commandedMode or ownerSubmode != commandedSubmode)
|
||||
{
|
||||
ModeMessage::setModeMessage(&reply,
|
||||
ModeMessage::REPLY_WRONG_MODE_REPLY, mode, submode);
|
||||
} else {
|
||||
ModeMessage::REPLY_WRONG_MODE_REPLY, ownerMode,
|
||||
ownerSubmode);
|
||||
}
|
||||
else
|
||||
{
|
||||
ModeMessage::setModeMessage(&reply, ModeMessage::REPLY_MODE_REPLY,
|
||||
mode, submode);
|
||||
ownerMode, ownerSubmode);
|
||||
}
|
||||
MessageQueueSenderIF::sendMessage(theOneWhoCommandedAMode, &reply,
|
||||
owner->getCommandQueue());
|
||||
}
|
||||
}
|
||||
|
||||
void ModeHelper::sendModeInfoMessage(Mode_t ownerMode,
|
||||
Submode_t ownerSubmode) {
|
||||
CommandMessage reply;
|
||||
if (theOneWhoCommandedAMode != parentQueueId
|
||||
&& parentQueueId != MessageQueueSenderIF::NO_QUEUE) {
|
||||
ModeMessage::setModeMessage(&reply, ModeMessage::REPLY_MODE_INFO, mode,
|
||||
submode);
|
||||
MessageQueueSenderIF::sendMessage(parentQueueId, &reply, owner->getCommandQueue());
|
||||
and parentQueueId != MessageQueueSenderIF::NO_QUEUE)
|
||||
{
|
||||
ModeMessage::setModeMessage(&reply, ModeMessage::REPLY_MODE_INFO,
|
||||
ownerMode, ownerSubmode);
|
||||
MessageQueueSenderIF::sendMessage(parentQueueId, &reply,
|
||||
owner->getCommandQueue());
|
||||
}
|
||||
theOneWhoCommandedAMode = MessageQueueSenderIF::NO_QUEUE;
|
||||
}
|
||||
|
||||
void ModeHelper::startTimer(uint32_t timeoutMs) {
|
||||
|
@ -1,6 +1,7 @@
|
||||
#ifndef MODEHELPER_H_
|
||||
#define MODEHELPER_H_
|
||||
|
||||
#include <framework/ipc/MessageQueueIF.h>
|
||||
#include <framework/modes/ModeMessage.h>
|
||||
#include <framework/returnvalues/HasReturnvaluesIF.h>
|
||||
#include <framework/timemanager/Countdown.h>
|
||||
@ -9,7 +10,7 @@ class HasModesIF;
|
||||
|
||||
class ModeHelper {
|
||||
public:
|
||||
MessageQueueId_t theOneWhoCommandedAMode;
|
||||
MessageQueueId_t theOneWhoCommandedAMode = MessageQueueIF::NO_QUEUE;
|
||||
Mode_t commandedMode;
|
||||
Submode_t commandedSubmode;
|
||||
|
||||
@ -39,11 +40,14 @@ public:
|
||||
void setForced(bool forced);
|
||||
protected:
|
||||
HasModesIF *owner;
|
||||
MessageQueueId_t parentQueueId;
|
||||
MessageQueueId_t parentQueueId = MessageQueueIF::NO_QUEUE;
|
||||
|
||||
Countdown countdown;
|
||||
|
||||
bool forced;
|
||||
private:
|
||||
void sendModeReplyMessage(Mode_t ownerMode, Submode_t ownerSubmode);
|
||||
void sendModeInfoMessage(Mode_t ownerMode, Submode_t ownerSubmode);
|
||||
};
|
||||
|
||||
#endif /* MODEHELPER_H_ */
|
||||
|
@ -3,9 +3,7 @@
|
||||
#include <framework/parameters/ParameterMessage.h>
|
||||
|
||||
ParameterHelper::ParameterHelper(ReceivesParameterMessagesIF* owner) :
|
||||
owner(owner), ownerQueueId(0), storage(NULL){
|
||||
|
||||
}
|
||||
owner(owner) {}
|
||||
|
||||
ParameterHelper::~ParameterHelper() {
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
#ifndef PARAMETERHELPER_H_
|
||||
#define PARAMETERHELPER_H_
|
||||
#ifndef FRAMEWORK_PARAMETERS_PARAMETERHELPER_H_
|
||||
#define FRAMEWORK_PARAMETERS_PARAMETERHELPER_H_
|
||||
|
||||
#include <framework/ipc/MessageQueueIF.h>
|
||||
#include <framework/parameters/ParameterMessage.h>
|
||||
#include <framework/parameters/ReceivesParameterMessagesIF.h>
|
||||
|
||||
@ -15,9 +16,9 @@ public:
|
||||
private:
|
||||
ReceivesParameterMessagesIF *owner;
|
||||
|
||||
MessageQueueId_t ownerQueueId;
|
||||
MessageQueueId_t ownerQueueId = MessageQueueIF::NO_QUEUE;
|
||||
|
||||
StorageManagerIF *storage;
|
||||
StorageManagerIF *storage = nullptr;
|
||||
|
||||
ReturnValue_t sendParameter(MessageQueueId_t to, uint32_t id, const ParameterWrapper *description);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user