Merge remote-tracking branch 'gaisser/gaisser_network_serialize' into mueller/merge-test
This commit is contained in:
commit
14027e449c
@ -50,8 +50,8 @@
|
|||||||
#define FSFW_USE_REALTIME_FOR_LINUX 1
|
#define FSFW_USE_REALTIME_FOR_LINUX 1
|
||||||
|
|
||||||
namespace fsfwconfig {
|
namespace fsfwconfig {
|
||||||
//! Default timestamp size. The default timestamp will be an eight byte CDC
|
|
||||||
//! short timestamp.
|
//! Default timestamp size. The default timestamp will be an seven byte CDC short timestamp.
|
||||||
static constexpr uint8_t FSFW_MISSION_TIMESTAMP_SIZE = 7;
|
static constexpr uint8_t FSFW_MISSION_TIMESTAMP_SIZE = 7;
|
||||||
|
|
||||||
//! Configure the allocated pool sizes for the event manager.
|
//! Configure the allocated pool sizes for the event manager.
|
||||||
|
@ -308,6 +308,14 @@ void DeviceHandlerBase::doStateMachine() {
|
|||||||
uint32_t currentUptime;
|
uint32_t currentUptime;
|
||||||
Clock::getUptime(¤tUptime);
|
Clock::getUptime(¤tUptime);
|
||||||
if (currentUptime - timeoutStart >= childTransitionDelay) {
|
if (currentUptime - timeoutStart >= childTransitionDelay) {
|
||||||
|
#if FSFW_VERBOSE_LEVEL >= 1 && FSFW_OBJ_EVENT_TRANSLATION == 0
|
||||||
|
char printout[60];
|
||||||
|
sprintf(printout, "Transition timeout (%lu) occured !",
|
||||||
|
static_cast<unsigned long>(childTransitionDelay));
|
||||||
|
/* Common configuration error for development, so print it */
|
||||||
|
printWarningOrError(sif::OutputTypes::OUT_WARNING, "doStateMachine",
|
||||||
|
RETURN_FAILED, printout);
|
||||||
|
#endif
|
||||||
triggerEvent(MODE_TRANSITION_FAILED, childTransitionFailure, 0);
|
triggerEvent(MODE_TRANSITION_FAILED, childTransitionFailure, 0);
|
||||||
setMode(transitionSourceMode, transitionSourceSubMode);
|
setMode(transitionSourceMode, transitionSourceSubMode);
|
||||||
break;
|
break;
|
||||||
@ -448,6 +456,15 @@ ReturnValue_t DeviceHandlerBase::insertInCommandMap(DeviceCommandId_t deviceComm
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
size_t DeviceHandlerBase::getNextReplyLength(DeviceCommandId_t commandId){
|
||||||
|
DeviceReplyIter iter = deviceReplyMap.find(commandId);
|
||||||
|
if(iter != deviceReplyMap.end()) {
|
||||||
|
return iter->second.replyLen;
|
||||||
|
}else{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ReturnValue_t DeviceHandlerBase::updateReplyMapEntry(DeviceCommandId_t deviceReply,
|
ReturnValue_t DeviceHandlerBase::updateReplyMapEntry(DeviceCommandId_t deviceReply,
|
||||||
uint16_t delayCycles, uint16_t maxDelayCycles, bool periodic) {
|
uint16_t delayCycles, uint16_t maxDelayCycles, bool periodic) {
|
||||||
auto replyIter = deviceReplyMap.find(deviceReply);
|
auto replyIter = deviceReplyMap.find(deviceReply);
|
||||||
@ -638,16 +655,12 @@ void DeviceHandlerBase::doGetWrite() {
|
|||||||
void DeviceHandlerBase::doSendRead() {
|
void DeviceHandlerBase::doSendRead() {
|
||||||
ReturnValue_t result;
|
ReturnValue_t result;
|
||||||
|
|
||||||
size_t requestLen = 0;
|
size_t replyLen = 0;
|
||||||
if(cookieInfo.pendingCommand != deviceCommandMap.end()) {
|
if(cookieInfo.pendingCommand != deviceCommandMap.end()) {
|
||||||
DeviceReplyIter iter = deviceReplyMap.find(
|
replyLen = getNextReplyLength(cookieInfo.pendingCommand->first);
|
||||||
cookieInfo.pendingCommand->first);
|
|
||||||
if(iter != deviceReplyMap.end()) {
|
|
||||||
requestLen = iter->second.replyLen;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
result = communicationInterface->requestReceiveMessage(comCookie, requestLen);
|
result = communicationInterface->requestReceiveMessage(comCookie, replyLen);
|
||||||
|
|
||||||
if (result == RETURN_OK) {
|
if (result == RETURN_OK) {
|
||||||
cookieInfo.state = COOKIE_READ_SENT;
|
cookieInfo.state = COOKIE_READ_SENT;
|
||||||
@ -1501,10 +1514,9 @@ void DeviceHandlerBase::printWarningOrError(sif::OutputTypes errorType,
|
|||||||
|
|
||||||
if(errorType == sif::OutputTypes::OUT_WARNING) {
|
if(errorType == sif::OutputTypes::OUT_WARNING) {
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
sif::warning << "DeviceHandlerBase::" << functionName << ": Object ID "
|
sif::warning << "DeviceHandlerBase::" << functionName << ": Object ID 0x" << std::hex <<
|
||||||
<< std::hex << std::setw(8) << std::setfill('0')
|
std::setw(8) << std::setfill('0') << this->getObjectId() << " | " << errorPrint <<
|
||||||
<< this->getObjectId() << " | " << errorPrint << std::dec
|
std::dec << std::setfill(' ') << std::endl;
|
||||||
<< std::setfill(' ') << std::endl;
|
|
||||||
#else
|
#else
|
||||||
sif::printWarning("DeviceHandlerBase::%s: Object ID 0x%08x | %s\n",
|
sif::printWarning("DeviceHandlerBase::%s: Object ID 0x%08x | %s\n",
|
||||||
functionName, this->getObjectId(), errorPrint);
|
functionName, this->getObjectId(), errorPrint);
|
||||||
@ -1512,7 +1524,7 @@ void DeviceHandlerBase::printWarningOrError(sif::OutputTypes errorType,
|
|||||||
}
|
}
|
||||||
else if(errorType == sif::OutputTypes::OUT_ERROR) {
|
else if(errorType == sif::OutputTypes::OUT_ERROR) {
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
sif::error << "DeviceHandlerBase::" << functionName << ": Object ID "
|
sif::error << "DeviceHandlerBase::" << functionName << ": Object ID 0x"
|
||||||
<< std::hex << std::setw(8) << std::setfill('0')
|
<< std::hex << std::setw(8) << std::setfill('0')
|
||||||
<< this->getObjectId() << " | " << errorPrint << std::dec
|
<< this->getObjectId() << " | " << errorPrint << std::dec
|
||||||
<< std::setfill(' ') << std::endl;
|
<< std::setfill(' ') << std::endl;
|
||||||
|
@ -471,13 +471,27 @@ protected:
|
|||||||
ReturnValue_t insertInReplyMap(DeviceCommandId_t deviceCommand,
|
ReturnValue_t insertInReplyMap(DeviceCommandId_t deviceCommand,
|
||||||
uint16_t maxDelayCycles, LocalPoolDataSetBase* dataSet = nullptr,
|
uint16_t maxDelayCycles, LocalPoolDataSetBase* dataSet = nullptr,
|
||||||
size_t replyLen = 0, bool periodic = false);
|
size_t replyLen = 0, bool periodic = false);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief A simple command to add a command to the commandList.
|
* @brief A simple command to add a command to the commandList.
|
||||||
* @param deviceCommand The command to add
|
* @param deviceCommand The command to add
|
||||||
* @return - @c RETURN_OK when the command was successfully inserted,
|
* @return - @c RETURN_OK when the command was successfully inserted,
|
||||||
* - @c RETURN_FAILED else.
|
* - @c RETURN_FAILED else.
|
||||||
*/
|
*/
|
||||||
ReturnValue_t insertInCommandMap(DeviceCommandId_t deviceCommand);
|
ReturnValue_t insertInCommandMap(DeviceCommandId_t deviceCommand);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function returns the reply length of the next reply to read.
|
||||||
|
*
|
||||||
|
* @param deviceCommand The command which triggered the device reply.
|
||||||
|
*
|
||||||
|
* @details The default implementation assumes only one reply is triggered by the command. In
|
||||||
|
* case the command triggers multiple replies (e.g. one acknowledgment, one data,
|
||||||
|
* and one execution status reply), this function can be overwritten to get the
|
||||||
|
* reply length of the next reply to read.
|
||||||
|
*/
|
||||||
|
virtual size_t getNextReplyLength(DeviceCommandId_t deviceCommand);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This is a helper method to facilitate updating entries
|
* @brief This is a helper method to facilitate updating entries
|
||||||
* in the reply map.
|
* in the reply map.
|
||||||
@ -953,7 +967,7 @@ protected:
|
|||||||
* - NO_REPLY_EXPECTED if there was no reply found. This is not an
|
* - NO_REPLY_EXPECTED if there was no reply found. This is not an
|
||||||
* error case as many commands do not expect a reply.
|
* error case as many commands do not expect a reply.
|
||||||
*/
|
*/
|
||||||
virtual ReturnValue_t enableReplyInReplyMap(DeviceCommandMap::iterator cmd,
|
virtual ReturnValue_t enableReplyInReplyMap(DeviceCommandMap::iterator command,
|
||||||
uint8_t expectedReplies = 1, bool useAlternateId = false,
|
uint8_t expectedReplies = 1, bool useAlternateId = false,
|
||||||
DeviceCommandId_t alternateReplyID = 0);
|
DeviceCommandId_t alternateReplyID = 0);
|
||||||
|
|
||||||
|
@ -128,8 +128,7 @@ ReturnValue_t MessageQueue::sendMessageFromMessageQueue(MessageQueueId_t sendTo,
|
|||||||
internalErrorReporter->queueMessageNotSent();
|
internalErrorReporter->queueMessageNotSent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// TODO: Better returnvalue
|
return MessageQueueIF::DESTINATION_INVALID;
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
|
||||||
}
|
}
|
||||||
if(targetQueue->messageQueue.size() < targetQueue->messageDepth) {
|
if(targetQueue->messageQueue.size() < targetQueue->messageDepth) {
|
||||||
MutexGuard mutexLock(targetQueue->queueLock, MutexIF::TimeoutType::WAITING, 20);
|
MutexGuard mutexLock(targetQueue->queueLock, MutexIF::TimeoutType::WAITING, 20);
|
||||||
|
@ -217,15 +217,15 @@ private:
|
|||||||
* @brief The class stores the queue id it got assigned.
|
* @brief The class stores the queue id it got assigned.
|
||||||
* If initialization fails, the queue id is set to zero.
|
* If initialization fails, the queue id is set to zero.
|
||||||
*/
|
*/
|
||||||
MessageQueueId_t mqId = 0;
|
MessageQueueId_t mqId = MessageQueueIF::NO_QUEUE;
|
||||||
size_t messageSize = 0;
|
size_t messageSize = 0;
|
||||||
size_t messageDepth = 0;
|
size_t messageDepth = 0;
|
||||||
|
|
||||||
MutexIF* queueLock;
|
MutexIF* queueLock;
|
||||||
|
|
||||||
bool defaultDestinationSet = false;
|
bool defaultDestinationSet = false;
|
||||||
MessageQueueId_t defaultDestination = 0;
|
MessageQueueId_t defaultDestination = MessageQueueIF::NO_QUEUE;
|
||||||
MessageQueueId_t lastPartner = 0;
|
MessageQueueId_t lastPartner = MessageQueueIF::NO_QUEUE;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* FRAMEWORK_OSAL_HOST_MESSAGEQUEUE_H_ */
|
#endif /* FRAMEWORK_OSAL_HOST_MESSAGEQUEUE_H_ */
|
||||||
|
@ -19,7 +19,10 @@
|
|||||||
class SerializeIF {
|
class SerializeIF {
|
||||||
public:
|
public:
|
||||||
enum class Endianness : uint8_t {
|
enum class Endianness : uint8_t {
|
||||||
BIG, LITTLE, MACHINE
|
BIG,
|
||||||
|
LITTLE,
|
||||||
|
MACHINE,
|
||||||
|
NETWORK = BIG // Added for convenience like htons on sockets
|
||||||
};
|
};
|
||||||
|
|
||||||
static const uint8_t INTERFACE_ID = CLASS_ID::SERIALIZE_IF;
|
static const uint8_t INTERFACE_ID = CLASS_ID::SERIALIZE_IF;
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#include <FSFWConfig.h>
|
#include <FSFWConfig.h>
|
||||||
#include "../returnvalues/HasReturnvaluesIF.h"
|
#include "../returnvalues/HasReturnvaluesIF.h"
|
||||||
|
#include <FSFWConfig.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A class implementing this IF provides facilities to add a time stamp to the
|
* A class implementing this IF provides facilities to add a time stamp to the
|
||||||
|
@ -1,8 +0,0 @@
|
|||||||
#ifndef FSFW_TMTCPACKET_PUS_TMPACKETIF_H_
|
|
||||||
#define FSFW_TMTCPACKET_PUS_TMPACKETIF_H_
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* FSFW_TMTCPACKET_PUS_TMPACKETIF_H_ */
|
|
@ -5,7 +5,7 @@
|
|||||||
#include <fsfw/tmtcpacket/pus/TmPacketStoredBase.h>
|
#include <fsfw/tmtcpacket/pus/TmPacketStoredBase.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class generates a ECSS PUS A Telemetry packet within a given
|
* This class generates a ECSS PUS C Telemetry packet within a given
|
||||||
* intermediate storage.
|
* intermediate storage.
|
||||||
* As most packets are passed between tasks with the help of a storage
|
* As most packets are passed between tasks with the help of a storage
|
||||||
* anyway, it seems logical to create a Packet-In-Storage access class
|
* anyway, it seems logical to create a Packet-In-Storage access class
|
||||||
@ -42,6 +42,9 @@ public:
|
|||||||
* @param headerData The header Data of the Application field,
|
* @param headerData The header Data of the Application field,
|
||||||
* will be copied in front of data
|
* will be copied in front of data
|
||||||
* @param headerSize The size of the headerDataF
|
* @param headerSize The size of the headerDataF
|
||||||
|
* @param destinationId Destination ID containing the application process ID as specified
|
||||||
|
* by PUS C
|
||||||
|
* @param timeRefField 4 bit time reference field as specified by PUS C
|
||||||
*/
|
*/
|
||||||
TmPacketStoredPusC( uint16_t apid, uint8_t service, uint8_t subservice,
|
TmPacketStoredPusC( uint16_t apid, uint8_t service, uint8_t subservice,
|
||||||
uint16_t packetCounter = 0, const uint8_t* data = nullptr,
|
uint16_t packetCounter = 0, const uint8_t* data = nullptr,
|
||||||
|
Loading…
Reference in New Issue
Block a user