Merge pull request 'Implements Network Endianness' (#419) from gaisser/fsfw:gaisser_network_serialize into development

Reviewed-on: fsfw/fsfw#419
This commit is contained in:
Robin Müller 2021-05-12 17:25:13 +02:00
commit 9496ed42e2
3 changed files with 10 additions and 6 deletions

View File

@ -5,6 +5,8 @@
#include "../../ipc/MutexFactory.h"
#include "../../ipc/MutexGuard.h"
#include <cstring>
MessageQueue::MessageQueue(size_t messageDepth, size_t maxMessageSize):
messageSize(maxMessageSize), messageDepth(messageDepth) {
queueLock = MutexFactory::instance()->createMutex();
@ -126,8 +128,7 @@ ReturnValue_t MessageQueue::sendMessageFromMessageQueue(MessageQueueId_t sendTo,
internalErrorReporter->queueMessageNotSent();
}
}
// TODO: Better returnvalue
return HasReturnvaluesIF::RETURN_FAILED;
return MessageQueueIF::DESTINATION_INVALID;
}
if(targetQueue->messageQueue.size() < targetQueue->messageDepth) {
MutexGuard mutexLock(targetQueue->queueLock, MutexIF::TimeoutType::WAITING, 20);

View File

@ -217,15 +217,15 @@ private:
* @brief The class stores the queue id it got assigned.
* 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 messageDepth = 0;
MutexIF* queueLock;
bool defaultDestinationSet = false;
MessageQueueId_t defaultDestination = 0;
MessageQueueId_t lastPartner = 0;
MessageQueueId_t defaultDestination = MessageQueueIF::NO_QUEUE;
MessageQueueId_t lastPartner = MessageQueueIF::NO_QUEUE;
};
#endif /* FRAMEWORK_OSAL_HOST_MESSAGEQUEUE_H_ */

View File

@ -19,7 +19,10 @@
class SerializeIF {
public:
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;