allow device tm in raw format

This commit is contained in:
Robin Müller 2022-08-27 01:01:29 +02:00
parent f5866ddace
commit 2a75440b32
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC
5 changed files with 71 additions and 18 deletions

View File

@ -1325,6 +1325,67 @@ void DeviceHandlerBase::handleDeviceTM(SerializeIF* dataSet, DeviceCommandId_t r
} }
} }
void DeviceHandlerBase::handleDeviceTM(const uint8_t* data, size_t dataSize,
DeviceCommandId_t replyId, bool forceDirectTm) {
// TODO: Horrible duplicate code. Avoiding this would require using the Serializable union
// type. Furthermore, DeviceTmReportingWrapper needs to be extended to allow using raw
// buffers.
if (data == nullptr) {
return;
}
DeviceReplyMap::iterator iter = deviceReplyMap.find(replyId);
if (iter == deviceReplyMap.end()) {
triggerEvent(DEVICE_UNKNOWN_REPLY, replyId);
return;
}
/* Regular replies to a command */
if (iter->second.command != deviceCommandMap.end()) {
MessageQueueId_t queueId = iter->second.command->second.sendReplyTo;
if (queueId != NO_COMMANDER) {
/* This may fail, but we'll ignore the fault. */
actionHelper.reportData(queueId, replyId, data, dataSize);
}
/* This check should make sure we get any TM but don't get anything doubled. */
// TODO: The wrapper does not support this..
// if (wiretappingMode == TM && (requestedRawTraffic != queueId)) {
// DeviceTmReportingWrapper wrapper(getObjectId(), replyId, data, dataSize);
// actionHelper.reportData(requestedRawTraffic, replyId, &wrapper);
// }
else if (forceDirectTm and (defaultRawReceiver != queueId) and
(defaultRawReceiver != MessageQueueIF::NO_QUEUE)) {
// hiding of sender needed so the service will handle it as
// unexpected Data, no matter what state (progress or completed)
// it is in
actionHelper.reportData(defaultRawReceiver, replyId, data, dataSize, true);
}
}
/* Unrequested or aperiodic replies */
// TODO: The wrapper does not support this..
// else {
// DeviceTmReportingWrapper wrapper(getObjectId(), replyId, data, dataSize);
// if (wiretappingMode == TM) {
// actionHelper.reportData(requestedRawTraffic, replyId, &wrapper);
// }
// 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
// // unexpected Data, no matter what state (progress or completed)
// // it is in
// actionHelper.reportData(defaultRawReceiver, replyId, &wrapper, true);
// }
// }
}
ReturnValue_t DeviceHandlerBase::executeAction(ActionId_t actionId, MessageQueueId_t commandedBy, ReturnValue_t DeviceHandlerBase::executeAction(ActionId_t actionId, MessageQueueId_t commandedBy,
const uint8_t* data, size_t size) { const uint8_t* data, size_t size) {
ReturnValue_t result = acceptExternalDeviceCommands(); ReturnValue_t result = acceptExternalDeviceCommands();

View File

@ -1070,8 +1070,8 @@ class DeviceHandlerBase : public DeviceHandlerIF,
bool isAwaitingReply(); bool isAwaitingReply();
void handleDeviceTM(SerializeIF *dataSet, DeviceCommandId_t replyId, bool forceDirectTm = false); void handleDeviceTM(SerializeIF *dataSet, DeviceCommandId_t replyId, bool forceDirectTm = false);
// void handleDeviceTM(uint8_t* data, size_t dataSize, DeviceCommandId_t replyId, void handleDeviceTM(const uint8_t *data, size_t dataSize, DeviceCommandId_t replyId,
// bool forceDirectTm); 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);

View File

@ -16,12 +16,9 @@ class HasHealthIF {
}; };
static const uint8_t INTERFACE_ID = CLASS_ID::HAS_HEALTH_IF; static const uint8_t INTERFACE_ID = CLASS_ID::HAS_HEALTH_IF;
static constexpr ReturnValue_t OBJECT_NOT_HEALTHY = static constexpr ReturnValue_t OBJECT_NOT_HEALTHY = returnvalue::makeCode(INTERFACE_ID, 1);
returnvalue::makeCode(INTERFACE_ID, 1); static constexpr ReturnValue_t INVALID_HEALTH_STATE = returnvalue::makeCode(INTERFACE_ID, 2);
static constexpr ReturnValue_t INVALID_HEALTH_STATE = static constexpr ReturnValue_t IS_EXTERNALLY_CONTROLLED = returnvalue::makeCode(INTERFACE_ID, 3);
returnvalue::makeCode(INTERFACE_ID, 2);
static constexpr ReturnValue_t IS_EXTERNALLY_CONTROLLED =
returnvalue::makeCode(INTERFACE_ID, 3);
static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::SYSTEM_MANAGER_1; static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::SYSTEM_MANAGER_1;
//! P1: New Health, P2: Old Health //! P1: New Health, P2: Old Health

View File

@ -66,7 +66,8 @@ class HasParametersIF {
* @param newValues * @param newValues
* @param startAtIndex Linear index, runs left to right, top to bottom for * @param startAtIndex Linear index, runs left to right, top to bottom for
* matrix indexes. * matrix indexes.
* @return returnvalue::OK if parameter is valid and a set function of the parameter wrapper was called. * @return returnvalue::OK if parameter is valid and a set function of the parameter wrapper was
* called.
*/ */
virtual ReturnValue_t getParameter(uint8_t domainId, uint8_t uniqueIdentifier, virtual ReturnValue_t getParameter(uint8_t domainId, uint8_t uniqueIdentifier,
ParameterWrapper *parameterWrapper, ParameterWrapper *parameterWrapper,

View File

@ -9,16 +9,10 @@ class SourceSequenceCounter {
public: public:
SourceSequenceCounter(uint16_t initialSequenceCount = 0) : sequenceCount(initialSequenceCount) {} SourceSequenceCounter(uint16_t initialSequenceCount = 0) : sequenceCount(initialSequenceCount) {}
void increment() { void increment() { sequenceCount = (sequenceCount + 1) % (ccsds::LIMIT_SEQUENCE_COUNT); }
sequenceCount = (sequenceCount + 1) % (ccsds::LIMIT_SEQUENCE_COUNT); void decrement() { sequenceCount = (sequenceCount - 1) % (ccsds::LIMIT_SEQUENCE_COUNT); }
}
void decrement() {
sequenceCount = (sequenceCount - 1) % (ccsds::LIMIT_SEQUENCE_COUNT);
}
uint16_t get() { return this->sequenceCount; } uint16_t get() { return this->sequenceCount; }
void reset(uint16_t toValue = 0) { void reset(uint16_t toValue = 0) { sequenceCount = toValue % (ccsds::LIMIT_SEQUENCE_COUNT); }
sequenceCount = toValue % (ccsds::LIMIT_SEQUENCE_COUNT);
}
SourceSequenceCounter& operator++(int) { SourceSequenceCounter& operator++(int) {
this->increment(); this->increment();
return *this; return *this;