alternative solution

This commit is contained in:
Robin Müller 2022-08-30 23:38:55 +02:00
parent 6c2b5ab39e
commit ab719a3e59
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC
2 changed files with 20 additions and 23 deletions

View File

@ -8,6 +8,7 @@
#include "fsfw/ipc/MessageQueueMessage.h" #include "fsfw/ipc/MessageQueueMessage.h"
#include "fsfw/ipc/QueueFactory.h" #include "fsfw/ipc/QueueFactory.h"
#include "fsfw/objectmanager/ObjectManager.h" #include "fsfw/objectmanager/ObjectManager.h"
#include "fsfw/serialize/SerialBufferAdapter.h"
#include "fsfw/serviceinterface/ServiceInterface.h" #include "fsfw/serviceinterface/ServiceInterface.h"
#include "fsfw/storagemanager/StorageManagerIF.h" #include "fsfw/storagemanager/StorageManagerIF.h"
#include "fsfw/subsystem/SubsystemBase.h" #include "fsfw/subsystem/SubsystemBase.h"
@ -1257,30 +1258,32 @@ ReturnValue_t DeviceHandlerBase::letChildHandleMessage(CommandMessage* message)
return returnvalue::FAILED; return returnvalue::FAILED;
} }
void DeviceHandlerBase::handleDeviceTM(SerializeIF* dataSet, DeviceCommandId_t replyId, void DeviceHandlerBase::handleDeviceTm(const uint8_t* rawData, size_t rawDataLen,
bool forceDirectTm) { DeviceCommandId_t replyId, bool forceDirectTm) {
if (dataSet == nullptr) { SerialBufferAdapter bufferWrapper(rawData, rawDataLen);
return; handleDeviceTm(bufferWrapper, replyId, forceDirectTm);
} }
DeviceReplyMap::iterator iter = deviceReplyMap.find(replyId); void DeviceHandlerBase::handleDeviceTm(SerializeIF& dataSet, DeviceCommandId_t replyId,
bool forceDirectTm) {
auto iter = deviceReplyMap.find(replyId);
if (iter == deviceReplyMap.end()) { if (iter == deviceReplyMap.end()) {
triggerEvent(DEVICE_UNKNOWN_REPLY, replyId); triggerEvent(DEVICE_UNKNOWN_REPLY, replyId);
return; return;
} }
/* Regular replies to a command */ // Regular replies to a command
if (iter->second.command != deviceCommandMap.end()) { if (iter->second.command != deviceCommandMap.end()) {
MessageQueueId_t queueId = iter->second.command->second.sendReplyTo; MessageQueueId_t queueId = iter->second.command->second.sendReplyTo;
if (queueId != NO_COMMANDER) { if (queueId != NO_COMMANDER) {
/* This may fail, but we'll ignore the fault. */ // This may fail, but we'll ignore the fault.
actionHelper.reportData(queueId, replyId, dataSet); actionHelper.reportData(queueId, replyId, &dataSet);
} }
/* This check should make sure we get any TM but don't get anything doubled. */ // This check should make sure we get any TM but don't get anything doubled.
if (wiretappingMode == TM && (requestedRawTraffic != queueId)) { if (wiretappingMode == TM && (requestedRawTraffic != queueId)) {
DeviceTmReportingWrapper wrapper(getObjectId(), replyId, dataSet); DeviceTmReportingWrapper wrapper(getObjectId(), replyId, &dataSet);
actionHelper.reportData(requestedRawTraffic, replyId, &wrapper); actionHelper.reportData(requestedRawTraffic, replyId, &wrapper);
} }
@ -1289,22 +1292,16 @@ void DeviceHandlerBase::handleDeviceTM(SerializeIF* dataSet, DeviceCommandId_t r
// hiding of sender needed so the service will handle it as // hiding of sender needed so the service will handle it as
// unexpected Data, no matter what state (progress or completed) // unexpected Data, no matter what state (progress or completed)
// it is in // it is in
actionHelper.reportData(defaultRawReceiver, replyId, dataSet, true); actionHelper.reportData(defaultRawReceiver, replyId, &dataSet, true);
} }
} }
/* Unrequested or aperiodic replies */ // Unrequested or aperiodic replies
else { else {
DeviceTmReportingWrapper wrapper(getObjectId(), replyId, dataSet); DeviceTmReportingWrapper wrapper(getObjectId(), replyId, &dataSet);
if (wiretappingMode == TM) { if (wiretappingMode == TM) {
actionHelper.reportData(requestedRawTraffic, replyId, &wrapper); actionHelper.reportData(requestedRawTraffic, replyId, &wrapper);
} }
if (forceDirectTm and defaultRawReceiver != MessageQueueIF::NO_QUEUE) { if (forceDirectTm and defaultRawReceiver != MessageQueueIF::NO_QUEUE) {
// sid_t setSid = sid_t(this->getObjectId(), replyId);
// LocalPoolDataSetBase* dataset = getDataSetHandle(setSid);
// if(dataset != nullptr) {
// poolManager.generateHousekeepingPacket(setSid, dataset, true);
// }
// hiding of sender needed so the service will handle it as // hiding of sender needed so the service will handle it as
// unexpected Data, no matter what state (progress or completed) // unexpected Data, no matter what state (progress or completed)
// it is in // it is in

View File

@ -1052,9 +1052,9 @@ class DeviceHandlerBase : public DeviceHandlerIF,
bool isAwaitingReply(); bool isAwaitingReply();
void handleDeviceTM(SerializeIF *dataSet, DeviceCommandId_t replyId, bool forceDirectTm = false); void handleDeviceTm(const uint8_t *rawData, size_t rawDataLen, DeviceCommandId_t replyId,
// void handleDeviceTM(uint8_t* data, size_t dataSize, DeviceCommandId_t replyId, bool forceDirectTm = false);
// bool forceDirectTm); void handleDeviceTm(SerializeIF &dataSet, DeviceCommandId_t replyId, bool forceDirectTm = false);
virtual ReturnValue_t checkModeCommand(Mode_t mode, Submode_t submode, virtual ReturnValue_t checkModeCommand(Mode_t mode, Submode_t submode,
uint32_t *msToReachTheMode); uint32_t *msToReachTheMode);