Merge remote-tracking branch 'upstream/master' into mueller_tcPacketBase

This commit is contained in:
Robin Müller 2020-08-25 12:45:42 +02:00
commit f863849a75
392 changed files with 5578 additions and 2892 deletions

View File

@ -1,9 +1,9 @@
#include <framework/action/ActionHelper.h>
#include <framework/action/HasActionsIF.h>
#include <framework/objectmanager/ObjectManagerIF.h>
#include "ActionHelper.h"
#include "HasActionsIF.h"
#include "../objectmanager/ObjectManagerIF.h"
ActionHelper::ActionHelper(HasActionsIF* setOwner, MessageQueueIF* useThisQueue) :
owner(setOwner), queueToUse(useThisQueue), ipcStore(
NULL) {
owner(setOwner), queueToUse(useThisQueue), ipcStore(nullptr) {
}
ActionHelper::~ActionHelper() {
@ -16,16 +16,18 @@ ReturnValue_t ActionHelper::handleActionMessage(CommandMessage* command) {
ActionMessage::getStoreId(command));
return HasReturnvaluesIF::RETURN_OK;
} else {
return CommandMessage::UNKNOW_COMMAND;
return CommandMessage::UNKNOWN_COMMAND;
}
}
ReturnValue_t ActionHelper::initialize(MessageQueueIF* queueToUse_) {
ipcStore = objectManager->get<StorageManagerIF>(objects::IPC_STORE);
if (ipcStore == NULL) {
if (ipcStore == nullptr) {
return HasReturnvaluesIF::RETURN_FAILED;
}
setQueueToUse(queueToUse_);
if(queueToUse_ != nullptr) {
setQueueToUse(queueToUse_);
}
return HasReturnvaluesIF::RETURN_OK;
}
@ -67,22 +69,23 @@ void ActionHelper::prepareExecution(MessageQueueId_t commandedBy, ActionId_t act
}
}
ReturnValue_t ActionHelper::reportData(MessageQueueId_t reportTo, ActionId_t replyId, SerializeIF* data, bool hideSender) {
ReturnValue_t ActionHelper::reportData(MessageQueueId_t reportTo,
ActionId_t replyId, SerializeIF* data, bool hideSender) {
CommandMessage reply;
store_address_t storeAddress;
uint8_t *dataPtr;
uint32_t maxSize = data->getSerializedSize();
size_t maxSize = data->getSerializedSize();
if (maxSize == 0) {
//No error, there's simply nothing to report.
return HasReturnvaluesIF::RETURN_OK;
}
uint32_t size = 0;
size_t size = 0;
ReturnValue_t result = ipcStore->getFreeElement(&storeAddress, maxSize,
&dataPtr);
if (result != HasReturnvaluesIF::RETURN_OK) {
return result;
}
result = data->serialize(&dataPtr, &size, maxSize, true);
result = data->serialize(&dataPtr, &size, maxSize, SerializeIF::Endianness::BIG);
if (result != HasReturnvaluesIF::RETURN_OK) {
ipcStore->deleteData(storeAddress);
return result;

View File

@ -1,9 +1,9 @@
#ifndef ACTIONHELPER_H_
#define ACTIONHELPER_H_
#include <framework/action/ActionMessage.h>
#include <framework/serialize/SerializeIF.h>
#include <framework/ipc/MessageQueueIF.h>
#include "ActionMessage.h"
#include "../serialize/SerializeIF.h"
#include "../ipc/MessageQueueIF.h"
/**
* \brief Action Helper is a helper class which handles action messages
*
@ -35,10 +35,10 @@ public:
ReturnValue_t handleActionMessage(CommandMessage* command);
/**
* Helper initialize function. Must be called before use of any other helper function
* @param queueToUse_ Pointer to the messageQueue to be used
* @param queueToUse_ Pointer to the messageQueue to be used, optional if queue was set in constructor
* @return Returns RETURN_OK if successful
*/
ReturnValue_t initialize(MessageQueueIF* queueToUse_);
ReturnValue_t initialize(MessageQueueIF* queueToUse_ = nullptr);
/**
* Function to be called from the owner to send a step message. Success or failure will be determined by the result value.
*

View File

@ -1,6 +1,6 @@
#include <framework/action/ActionMessage.h>
#include <framework/objectmanager/ObjectManagerIF.h>
#include <framework/storagemanager/StorageManagerIF.h>
#include "ActionMessage.h"
#include "../objectmanager/ObjectManagerIF.h"
#include "../storagemanager/StorageManagerIF.h"
ActionMessage::ActionMessage() {
}

View File

@ -1,9 +1,9 @@
#ifndef ACTIONMESSAGE_H_
#define ACTIONMESSAGE_H_
#include <framework/ipc/CommandMessage.h>
#include <framework/objectmanager/ObjectManagerIF.h>
#include <framework/storagemanager/StorageManagerIF.h>
#include "../ipc/CommandMessage.h"
#include "../objectmanager/ObjectManagerIF.h"
#include "../storagemanager/StorageManagerIF.h"
typedef uint32_t ActionId_t;
class ActionMessage {

View File

@ -1,33 +1,34 @@
#include <framework/action/ActionMessage.h>
#include <framework/action/CommandActionHelper.h>
#include <framework/action/CommandsActionsIF.h>
#include <framework/action/HasActionsIF.h>
#include <framework/objectmanager/ObjectManagerIF.h>
#include "ActionMessage.h"
#include "CommandActionHelper.h"
#include "CommandsActionsIF.h"
#include "HasActionsIF.h"
#include "../objectmanager/ObjectManagerIF.h"
CommandActionHelper::CommandActionHelper(CommandsActionsIF* setOwner) :
CommandActionHelper::CommandActionHelper(CommandsActionsIF *setOwner) :
owner(setOwner), queueToUse(NULL), ipcStore(
NULL), commandCount(0), lastTarget(0) {
NULL), commandCount(0), lastTarget(0) {
}
CommandActionHelper::~CommandActionHelper() {
}
ReturnValue_t CommandActionHelper::commandAction(object_id_t commandTo,
ActionId_t actionId, SerializeIF* data) {
HasActionsIF* receiver = objectManager->get<HasActionsIF>(commandTo);
ActionId_t actionId, SerializeIF *data) {
HasActionsIF *receiver = objectManager->get<HasActionsIF>(commandTo);
if (receiver == NULL) {
return CommandsActionsIF::OBJECT_HAS_NO_FUNCTIONS;
}
store_address_t storeId;
uint8_t* storePointer;
uint32_t maxSize = data->getSerializedSize();
uint8_t *storePointer;
size_t maxSize = data->getSerializedSize();
ReturnValue_t result = ipcStore->getFreeElement(&storeId, maxSize,
&storePointer);
if (result != HasReturnvaluesIF::RETURN_OK) {
return result;
}
uint32_t size = 0;
result = data->serialize(&storePointer, &size, maxSize, true);
size_t size = 0;
result = data->serialize(&storePointer, &size, maxSize,
SerializeIF::Endianness::BIG);
if (result != HasReturnvaluesIF::RETURN_OK) {
return result;
}
@ -35,11 +36,11 @@ ReturnValue_t CommandActionHelper::commandAction(object_id_t commandTo,
}
ReturnValue_t CommandActionHelper::commandAction(object_id_t commandTo,
ActionId_t actionId, const uint8_t* data, uint32_t size) {
ActionId_t actionId, const uint8_t *data, uint32_t size) {
// if (commandCount != 0) {
// return CommandsFunctionsIF::ALREADY_COMMANDING;
// }
HasActionsIF* receiver = objectManager->get<HasActionsIF>(commandTo);
HasActionsIF *receiver = objectManager->get<HasActionsIF>(commandTo);
if (receiver == NULL) {
return CommandsActionsIF::OBJECT_HAS_NO_FUNCTIONS;
}
@ -71,13 +72,13 @@ ReturnValue_t CommandActionHelper::initialize() {
}
queueToUse = owner->getCommandQueuePtr();
if(queueToUse == NULL){
if (queueToUse == NULL) {
return HasReturnvaluesIF::RETURN_FAILED;
}
return HasReturnvaluesIF::RETURN_OK;
}
ReturnValue_t CommandActionHelper::handleReply(CommandMessage* reply) {
ReturnValue_t CommandActionHelper::handleReply(CommandMessage *reply) {
if (reply->getSender() != lastTarget) {
return HasReturnvaluesIF::RETURN_FAILED;
}
@ -88,7 +89,8 @@ ReturnValue_t CommandActionHelper::handleReply(CommandMessage* reply) {
return HasReturnvaluesIF::RETURN_OK;
case ActionMessage::COMPLETION_FAILED:
commandCount--;
owner->completionFailedReceived(ActionMessage::getActionId(reply), ActionMessage::getReturnCode(reply));
owner->completionFailedReceived(ActionMessage::getActionId(reply),
ActionMessage::getReturnCode(reply));
return HasReturnvaluesIF::RETURN_OK;
case ActionMessage::STEP_SUCCESS:
owner->stepSuccessfulReceived(ActionMessage::getActionId(reply),
@ -96,11 +98,13 @@ ReturnValue_t CommandActionHelper::handleReply(CommandMessage* reply) {
return HasReturnvaluesIF::RETURN_OK;
case ActionMessage::STEP_FAILED:
commandCount--;
owner->stepFailedReceived(ActionMessage::getActionId(reply), ActionMessage::getStep(reply),
owner->stepFailedReceived(ActionMessage::getActionId(reply),
ActionMessage::getStep(reply),
ActionMessage::getReturnCode(reply));
return HasReturnvaluesIF::RETURN_OK;
case ActionMessage::DATA_REPLY:
extractDataForOwner(ActionMessage::getActionId(reply), ActionMessage::getStoreId(reply));
extractDataForOwner(ActionMessage::getActionId(reply),
ActionMessage::getStoreId(reply));
return HasReturnvaluesIF::RETURN_OK;
default:
return HasReturnvaluesIF::RETURN_FAILED;

View File

@ -1,12 +1,12 @@
#ifndef COMMANDACTIONHELPER_H_
#define COMMANDACTIONHELPER_H_
#include <framework/action/ActionMessage.h>
#include <framework/objectmanager/ObjectManagerIF.h>
#include <framework/returnvalues/HasReturnvaluesIF.h>
#include <framework/serialize/SerializeIF.h>
#include <framework/storagemanager/StorageManagerIF.h>
#include <framework/ipc/MessageQueueIF.h>
#include "ActionMessage.h"
#include "../objectmanager/ObjectManagerIF.h"
#include "../returnvalues/HasReturnvaluesIF.h"
#include "../serialize/SerializeIF.h"
#include "../storagemanager/StorageManagerIF.h"
#include "../ipc/MessageQueueIF.h"
class CommandsActionsIF;

View File

@ -1,9 +1,9 @@
#ifndef COMMANDSACTIONSIF_H_
#define COMMANDSACTIONSIF_H_
#include <framework/action/CommandActionHelper.h>
#include <framework/returnvalues/HasReturnvaluesIF.h>
#include <framework/ipc/MessageQueueIF.h>
#include "CommandActionHelper.h"
#include "../returnvalues/HasReturnvaluesIF.h"
#include "../ipc/MessageQueueIF.h"
/**
* Interface to separate commanding actions of other objects.

View File

@ -1,33 +1,41 @@
#ifndef HASACTIONSIF_H_
#define HASACTIONSIF_H_
#ifndef FRAMEWORK_ACTION_HASACTIONSIF_H_
#define FRAMEWORK_ACTION_HASACTIONSIF_H_
#include <framework/action/ActionHelper.h>
#include <framework/action/ActionMessage.h>
#include <framework/action/SimpleActionHelper.h>
#include <framework/returnvalues/HasReturnvaluesIF.h>
#include <framework/ipc/MessageQueueIF.h>
#include "ActionHelper.h"
#include "ActionMessage.h"
#include "SimpleActionHelper.h"
#include "../returnvalues/HasReturnvaluesIF.h"
#include "../ipc/MessageQueueIF.h"
/**
* \brief Interface for component which uses actions
* @brief
* Interface for component which uses actions
*
* This interface is used to execute actions in the component. Actions, in the sense of this interface, are activities with a well-defined beginning and
* end in time. They may adjust sub-states of components, but are not supposed to change
* the main mode of operation, which is handled with the HasModesIF described below.
* @details
* This interface is used to execute actions in the component. Actions, in the
* sense of this interface, are activities with a well-defined beginning and
* end in time. They may adjust sub-states of components, but are not supposed
* to change the main mode of operation, which is handled with the HasModesIF
* described below.
*
* The HasActionsIF allows components to define such actions and make them available
* for other components to use. Implementing the interface is straightforward: Theres a
* single executeAction call, which provides an identifier for the action to execute, as well
* as arbitrary parameters for input. Aside from direct, software-based
* actions, it is used in device handler components as an interface to forward commands to
* devices.
* Implementing components of the interface are supposed to check identifier (ID) and
* parameters and immediately start execution of the action. It is, however, not required to
* immediately finish execution. Instead, this may be deferred to a later point in time, at
* which the component needs to inform the caller about finished or failed execution.
* The HasActionsIF allows components to define such actions and make them
* available for other components to use. Implementing the interface is
* straightforward: Theres a single executeAction call, which provides an
* identifier for the action to execute, as well as arbitrary parameters for
* input.
* Aside from direct, software-based actions, it is used in device handler
* components as an interface to forward commands to devices.
* Implementing components of the interface are supposed to check identifier
* (ID) and parameters and immediately start execution of the action.
* It is, however, not required to immediately finish execution.
* Instead, this may be deferred to a later point in time, at which the
* component needs to inform the caller about finished or failed execution.
*
* @ingroup interfaces
*/
class HasActionsIF {
public:
static const uint8_t INTERFACE_ID = CLASS_ID::HAS_ACTIONS_IF;
static const ReturnValue_t IS_BUSY = MAKE_RETURN_CODE(1);//!<
static const ReturnValue_t IS_BUSY = MAKE_RETURN_CODE(1);
static const ReturnValue_t INVALID_PARAMETERS = MAKE_RETURN_CODE(2);
static const ReturnValue_t EXECUTION_FINISHED = MAKE_RETURN_CODE(3);
static const ReturnValue_t INVALID_ACTION_ID = MAKE_RETURN_CODE(4);
@ -39,12 +47,14 @@ public:
virtual MessageQueueId_t getCommandQueue() const = 0;
/**
* Execute or initialize the execution of a certain function.
* Returning #EXECUTION_FINISHED or a failure code, nothing else needs to be done.
* When needing more steps, return RETURN_OK and issue steps and completion manually. One "step failed" or completion report must
* be issued!
* Returning #EXECUTION_FINISHED or a failure code, nothing else needs to
* be done. When needing more steps, return RETURN_OK and issue steps and
* completion manually.
* One "step failed" or completion report must be issued!
*/
virtual ReturnValue_t executeAction(ActionId_t actionId, MessageQueueId_t commandedBy, const uint8_t* data, uint32_t size) = 0;
virtual ReturnValue_t executeAction(ActionId_t actionId,
MessageQueueId_t commandedBy, const uint8_t* data, size_t size) = 0;
};
#endif /* HASACTIONSIF_H_ */
#endif /* FRAMEWORK_ACTION_HASACTIONSIF_H_ */

View File

@ -1,5 +1,5 @@
#include <framework/action/HasActionsIF.h>
#include <framework/action/SimpleActionHelper.h>
#include "HasActionsIF.h"
#include "SimpleActionHelper.h"
SimpleActionHelper::SimpleActionHelper(HasActionsIF* setOwner,
MessageQueueIF* useThisQueue) :
ActionHelper(setOwner, useThisQueue), isExecuting(false), lastCommander(

View File

@ -1,7 +1,7 @@
#ifndef SIMPLEACTIONHELPER_H_
#define SIMPLEACTIONHELPER_H_
#include <framework/action/ActionHelper.h>
#include "ActionHelper.h"
class SimpleActionHelper: public ActionHelper {
public:

View File

@ -1,9 +1,9 @@
#ifndef ARRAYLIST_H_
#define ARRAYLIST_H_
#include <framework/returnvalues/HasReturnvaluesIF.h>
#include <framework/serialize/SerializeAdapter.h>
#include <framework/serialize/SerializeIF.h>
#include "../returnvalues/HasReturnvaluesIF.h"
#include "../serialize/SerializeAdapter.h"
#include "../serialize/SerializeIF.h"
/**
* A List that stores its values in an array.

View File

@ -1,7 +1,7 @@
#ifndef FIFO_H_
#define FIFO_H_
#include <framework/returnvalues/HasReturnvaluesIF.h>
#include "../returnvalues/HasReturnvaluesIF.h"
/**
* @brief Simple First-In-First-Out data structure

View File

@ -1,7 +1,7 @@
#ifndef FIXEDARRAYLIST_H_
#define FIXEDARRAYLIST_H_
#include <framework/container/ArrayList.h>
#include "ArrayList.h"
/**
* \ingroup container
*/

View File

@ -1,8 +1,8 @@
#ifndef FIXEDMAP_H_
#define FIXEDMAP_H_
#include <framework/container/ArrayList.h>
#include <framework/returnvalues/HasReturnvaluesIF.h>
#include "ArrayList.h"
#include "../returnvalues/HasReturnvaluesIF.h"
#include <utility>
/**
@ -148,47 +148,47 @@ public:
return theMap.maxSize();
}
virtual ReturnValue_t serialize(uint8_t** buffer, uint32_t* size,
const uint32_t max_size, bool bigEndian) const {
ReturnValue_t result = SerializeAdapter<uint32_t>::serialize(&this->_size,
buffer, size, max_size, bigEndian);
virtual ReturnValue_t serialize(uint8_t** buffer, size_t* size,
size_t maxSize, Endianness streamEndianness) const {
ReturnValue_t result = SerializeAdapter::serialize(&this->_size,
buffer, size, maxSize, streamEndianness);
uint32_t i = 0;
while ((result == HasReturnvaluesIF::RETURN_OK) && (i < this->_size)) {
result = SerializeAdapter<key_t>::serialize(&theMap[i].first, buffer,
size, max_size, bigEndian);
result = SerializeAdapter<T>::serialize(&theMap[i].second, buffer, size,
max_size, bigEndian);
result = SerializeAdapter::serialize(&theMap[i].first, buffer,
size, maxSize, streamEndianness);
result = SerializeAdapter::serialize(&theMap[i].second, buffer, size,
maxSize, streamEndianness);
++i;
}
return result;
}
virtual uint32_t getSerializedSize() const {
virtual size_t getSerializedSize() const {
uint32_t printSize = sizeof(_size);
uint32_t i = 0;
for (i = 0; i < _size; ++i) {
printSize += SerializeAdapter<key_t>::getSerializedSize(
printSize += SerializeAdapter::getSerializedSize(
&theMap[i].first);
printSize += SerializeAdapter<T>::getSerializedSize(&theMap[i].second);
printSize += SerializeAdapter::getSerializedSize(&theMap[i].second);
}
return printSize;
}
virtual ReturnValue_t deSerialize(const uint8_t** buffer, int32_t* size,
bool bigEndian) {
ReturnValue_t result = SerializeAdapter<uint32_t>::deSerialize(&this->_size,
buffer, size, bigEndian);
virtual ReturnValue_t deSerialize(const uint8_t** buffer, size_t* size,
Endianness streamEndianness) {
ReturnValue_t result = SerializeAdapter::deSerialize(&this->_size,
buffer, size, streamEndianness);
if (this->_size > theMap.maxSize()) {
return SerializeIF::TOO_MANY_ELEMENTS;
}
uint32_t i = 0;
while ((result == HasReturnvaluesIF::RETURN_OK) && (i < this->_size)) {
result = SerializeAdapter<key_t>::deSerialize(&theMap[i].first, buffer,
size, bigEndian);
result = SerializeAdapter<T>::deSerialize(&theMap[i].second, buffer, size,
bigEndian);
result = SerializeAdapter::deSerialize(&theMap[i].first, buffer,
size, streamEndianness);
result = SerializeAdapter::deSerialize(&theMap[i].second, buffer, size,
streamEndianness);
++i;
}
return result;

View File

@ -1,7 +1,7 @@
#ifndef FRAMEWORK_CONTAINER_FIXEDORDEREDMULTIMAP_H_
#define FRAMEWORK_CONTAINER_FIXEDORDEREDMULTIMAP_H_
#include <framework/container/ArrayList.h>
#include "ArrayList.h"
#include <cstring>
#include <set>
/**

View File

@ -1,41 +1,39 @@
#ifndef HYBRIDITERATOR_H_
#define HYBRIDITERATOR_H_
#ifndef FRAMEWORK_CONTAINER_HYBRIDITERATOR_H_
#define FRAMEWORK_CONTAINER_HYBRIDITERATOR_H_
#include <framework/container/ArrayList.h>
#include <framework/container/SinglyLinkedList.h>
#include "ArrayList.h"
#include "SinglyLinkedList.h"
template<typename T, typename count_t = uint8_t>
class HybridIterator: public LinkedElement<T>::Iterator,
public ArrayList<T, count_t>::Iterator {
public:
HybridIterator() :
value(NULL), linked(NULL), end(NULL) {
}
HybridIterator() {}
HybridIterator(typename LinkedElement<T>::Iterator *iter) :
LinkedElement<T>::Iterator(*iter), value(
iter->value), linked(true), end(NULL) {
LinkedElement<T>::Iterator(*iter), value(iter->value),
linked(true) {
}
HybridIterator(LinkedElement<T> *start) :
LinkedElement<T>::Iterator(start), value(
start->value), linked(true), end(NULL) {
LinkedElement<T>::Iterator(start), value(start->value),
linked(true) {
}
HybridIterator(typename ArrayList<T, count_t>::Iterator start,
typename ArrayList<T, count_t>::Iterator end) :
ArrayList<T, count_t>::Iterator(start), value(start.value), linked(
false), end(end.value) {
ArrayList<T, count_t>::Iterator(start), value(start.value),
linked(false), end(end.value) {
if (value == this->end) {
value = NULL;
}
}
HybridIterator(T *firstElement, T *lastElement) :
ArrayList<T, count_t>::Iterator(firstElement), value(firstElement), linked(
false), end(++lastElement) {
ArrayList<T, count_t>::Iterator(firstElement), value(firstElement),
linked(false), end(++lastElement) {
if (value == end) {
value = NULL;
}
@ -44,17 +42,17 @@ public:
HybridIterator& operator++() {
if (linked) {
LinkedElement<T>::Iterator::operator++();
if (LinkedElement<T>::Iterator::value != NULL) {
if (LinkedElement<T>::Iterator::value != nullptr) {
value = LinkedElement<T>::Iterator::value->value;
} else {
value = NULL;
value = nullptr;
}
} else {
ArrayList<T, count_t>::Iterator::operator++();
value = ArrayList<T, count_t>::Iterator::value;
if (value == end) {
value = NULL;
value = nullptr;
}
}
return *this;
@ -66,11 +64,11 @@ public:
return tmp;
}
bool operator==(HybridIterator other) {
return value == other->value;
bool operator==(const HybridIterator& other) const {
return value == other.value;
}
bool operator!=(HybridIterator other) {
bool operator!=(const HybridIterator& other) const {
return !(*this == other);
}
@ -82,11 +80,11 @@ public:
return value;
}
T* value;
T* value = nullptr;
private:
bool linked;
T *end;
bool linked = false;
T *end = nullptr;
};
#endif /* HYBRIDITERATOR_H_ */
#endif /* FRAMEWORK_CONTAINER_HYBRIDITERATOR_H_ */

View File

@ -1,11 +1,11 @@
#ifndef FRAMEWORK_CONTAINER_INDEXEDRINGMEMORY_H_
#define FRAMEWORK_CONTAINER_INDEXEDRINGMEMORY_H_
#include <framework/container/ArrayList.h>
#include <framework/globalfunctions/CRC.h>
#include <framework/serviceinterface/ServiceInterfaceStream.h>
#include <framework/returnvalues/HasReturnvaluesIF.h>
#include <framework/serialize/SerialArrayListAdapter.h>
#include "ArrayList.h"
#include "../globalfunctions/CRC.h"
#include "../serviceinterface/ServiceInterfaceStream.h"
#include "../returnvalues/HasReturnvaluesIF.h"
#include "../serialize/SerialArrayListAdapter.h"
#include <cmath>
template<typename T>
@ -68,50 +68,50 @@ public:
return this->storedPackets;
}
ReturnValue_t serialize(uint8_t** buffer, uint32_t* size,
const uint32_t max_size, bool bigEndian) const {
ReturnValue_t result = AutoSerializeAdapter::serialize(&blockStartAddress,buffer,size,max_size,bigEndian);
ReturnValue_t serialize(uint8_t** buffer, size_t* size,
size_t maxSize, Endianness streamEndianness) const {
ReturnValue_t result = SerializeAdapter::serialize(&blockStartAddress,buffer,size,maxSize,streamEndianness);
if(result != HasReturnvaluesIF::RETURN_OK){
return result;
}
result = indexType.serialize(buffer,size,max_size,bigEndian);
result = indexType.serialize(buffer,size,maxSize,streamEndianness);
if(result != HasReturnvaluesIF::RETURN_OK){
return result;
}
result = AutoSerializeAdapter::serialize(&this->size,buffer,size,max_size,bigEndian);
result = SerializeAdapter::serialize(&this->size,buffer,size,maxSize,streamEndianness);
if(result != HasReturnvaluesIF::RETURN_OK){
return result;
}
result = AutoSerializeAdapter::serialize(&this->storedPackets,buffer,size,max_size,bigEndian);
result = SerializeAdapter::serialize(&this->storedPackets,buffer,size,maxSize,streamEndianness);
return result;
}
ReturnValue_t deSerialize(const uint8_t** buffer, int32_t* size,
bool bigEndian){
ReturnValue_t result = AutoSerializeAdapter::deSerialize(&blockStartAddress,buffer,size,bigEndian);
ReturnValue_t deSerialize(const uint8_t** buffer, size_t* size,
Endianness streamEndianness){
ReturnValue_t result = SerializeAdapter::deSerialize(&blockStartAddress,buffer,size,streamEndianness);
if(result != HasReturnvaluesIF::RETURN_OK){
return result;
}
result = indexType.deSerialize(buffer,size,bigEndian);
result = indexType.deSerialize(buffer,size,streamEndianness);
if(result != HasReturnvaluesIF::RETURN_OK){
return result;
}
result = AutoSerializeAdapter::deSerialize(&this->size,buffer,size,bigEndian);
result = SerializeAdapter::deSerialize(&this->size,buffer,size,streamEndianness);
if(result != HasReturnvaluesIF::RETURN_OK){
return result;
}
result = AutoSerializeAdapter::deSerialize(&this->storedPackets,buffer,size,bigEndian);
result = SerializeAdapter::deSerialize(&this->storedPackets,buffer,size,streamEndianness);
if(result != HasReturnvaluesIF::RETURN_OK){
return result;
}
return result;
}
uint32_t getSerializedSize() const {
uint32_t size = AutoSerializeAdapter::getSerializedSize(&blockStartAddress);
size_t getSerializedSize() const {
uint32_t size = SerializeAdapter::getSerializedSize(&blockStartAddress);
size += indexType.getSerializedSize();
size += AutoSerializeAdapter::getSerializedSize(&this->size);
size += AutoSerializeAdapter::getSerializedSize(&this->storedPackets);
size += SerializeAdapter::getSerializedSize(&this->size);
size += SerializeAdapter::getSerializedSize(&this->storedPackets);
return size;
}
@ -485,37 +485,37 @@ public:
* Parameters according to HasSerializeIF
* @param buffer
* @param size
* @param max_size
* @param bigEndian
* @param maxSize
* @param streamEndianness
* @return
*/
ReturnValue_t serialize(uint8_t** buffer, uint32_t* size,
const uint32_t max_size, bool bigEndian) const{
ReturnValue_t serialize(uint8_t** buffer, size_t* size,
size_t maxSize, Endianness streamEndianness) const{
uint8_t* crcBuffer = *buffer;
uint32_t oldSize = *size;
if(additionalInfo!=NULL){
additionalInfo->serialize(buffer,size,max_size,bigEndian);
additionalInfo->serialize(buffer,size,maxSize,streamEndianness);
}
ReturnValue_t result = currentWriteBlock->serialize(buffer,size,max_size,bigEndian);
ReturnValue_t result = currentWriteBlock->serialize(buffer,size,maxSize,streamEndianness);
if(result != HasReturnvaluesIF::RETURN_OK){
return result;
}
result = AutoSerializeAdapter::serialize(&this->size,buffer,size,max_size,bigEndian);
result = SerializeAdapter::serialize(&this->size,buffer,size,maxSize,streamEndianness);
if(result != HasReturnvaluesIF::RETURN_OK){
return result;
}
uint32_t i = 0;
while ((result == HasReturnvaluesIF::RETURN_OK) && (i < this->size)) {
result = SerializeAdapter<Index<T> >::serialize(&this->entries[i], buffer, size,
max_size, bigEndian);
result = SerializeAdapter::serialize(&this->entries[i], buffer, size,
maxSize, streamEndianness);
++i;
}
if(result != HasReturnvaluesIF::RETURN_OK){
return result;
}
uint16_t crc = Calculate_CRC(crcBuffer,(*size-oldSize));
result = AutoSerializeAdapter::serialize(&crc,buffer,size,max_size,bigEndian);
result = SerializeAdapter::serialize(&crc,buffer,size,maxSize,streamEndianness);
return result;
}
@ -524,17 +524,17 @@ public:
* Get the serialized Size of the index
* @return The serialized size of the index
*/
uint32_t getSerializedSize() const {
size_t getSerializedSize() const {
uint32_t size = 0;
if(additionalInfo!=NULL){
size += additionalInfo->getSerializedSize();
}
size += currentWriteBlock->getSerializedSize();
size += AutoSerializeAdapter::getSerializedSize(&this->size);
size += SerializeAdapter::getSerializedSize(&this->size);
size += (this->entries[0].getSerializedSize()) * this->size;
uint16_t crc = 0;
size += AutoSerializeAdapter::getSerializedSize(&crc);
size += SerializeAdapter::getSerializedSize(&crc);
return size;
}
/**
@ -542,28 +542,28 @@ public:
* CRC Has to be checked before!
* @param buffer
* @param size
* @param bigEndian
* @param streamEndianness
* @return
*/
ReturnValue_t deSerialize(const uint8_t** buffer, int32_t* size,
bool bigEndian){
ReturnValue_t deSerialize(const uint8_t** buffer, size_t* size,
Endianness streamEndianness){
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
if(additionalInfo!=NULL){
result = additionalInfo->deSerialize(buffer,size,bigEndian);
result = additionalInfo->deSerialize(buffer,size,streamEndianness);
}
if(result != HasReturnvaluesIF::RETURN_OK){
return result;
}
Index<T> tempIndex;
result = tempIndex.deSerialize(buffer,size,bigEndian);
result = tempIndex.deSerialize(buffer,size,streamEndianness);
if(result != HasReturnvaluesIF::RETURN_OK){
return result;
}
uint32_t tempSize = 0;
result = AutoSerializeAdapter::deSerialize(&tempSize,buffer,size,bigEndian);
result = SerializeAdapter::deSerialize(&tempSize,buffer,size,streamEndianness);
if(result != HasReturnvaluesIF::RETURN_OK){
return result;
}
@ -572,9 +572,9 @@ public:
}
uint32_t i = 0;
while ((result == HasReturnvaluesIF::RETURN_OK) && (i < this->size)) {
result = SerializeAdapter<Index<T> >::deSerialize(
result = SerializeAdapter::deSerialize(
&this->entries[i], buffer, size,
bigEndian);
streamEndianness);
++i;
}
if(result != HasReturnvaluesIF::RETURN_OK){

View File

@ -1,7 +1,7 @@
#ifndef FRAMEWORK_CONTAINER_PLACEMENTFACTORY_H_
#define FRAMEWORK_CONTAINER_PLACEMENTFACTORY_H_
#include <framework/storagemanager/StorageManagerIF.h>
#include "../storagemanager/StorageManagerIF.h"
#include <utility>
class PlacementFactory {

View File

@ -1,7 +1,7 @@
#ifndef FRAMEWORK_CONTAINER_RINGBUFFERBASE_H_
#define FRAMEWORK_CONTAINER_RINGBUFFERBASE_H_
#include <framework/returnvalues/HasReturnvaluesIF.h>
#include "../returnvalues/HasReturnvaluesIF.h"
template<uint8_t N_READ_PTRS = 1>
class RingBufferBase {

View File

@ -1,4 +1,4 @@
#include <framework/container/SimpleRingBuffer.h>
#include "SimpleRingBuffer.h"
#include <string.h>
SimpleRingBuffer::SimpleRingBuffer(uint32_t size, bool overwriteOld) :

View File

@ -1,7 +1,7 @@
#ifndef FRAMEWORK_CONTAINER_SIMPLERINGBUFFER_H_
#define FRAMEWORK_CONTAINER_SIMPLERINGBUFFER_H_
#include <framework/container/RingBufferBase.h>
#include "RingBufferBase.h"
#include <stddef.h>
class SimpleRingBuffer: public RingBufferBase<> {

View File

@ -1,10 +1,13 @@
#ifndef SINGLYLINKEDLIST_H_
#define SINGLYLINKEDLIST_H_
#ifndef FRAMEWORK_CONTAINER_SINGLYLINKEDLIST_H_
#define FRAMEWORK_CONTAINER_SINGLYLINKEDLIST_H_
#include <cstddef>
#include <cstdint>
#include <stddef.h>
#include <stdint.h>
/**
* \ingroup container
* @brief Linked list data structure,
* each entry has a pointer to the next entry (singly)
* @ingroup container
*/
template<typename T>
class LinkedElement {
@ -12,11 +15,8 @@ public:
T *value;
class Iterator {
public:
LinkedElement<T> *value;
Iterator() :
value(NULL) {
}
LinkedElement<T> *value = nullptr;
Iterator() {}
Iterator(LinkedElement<T> *element) :
value(element) {
@ -45,12 +45,11 @@ public:
}
};
LinkedElement(T* setElement, LinkedElement<T>* setNext = NULL) : value(setElement),
next(setNext) {
}
virtual ~LinkedElement(){
LinkedElement(T* setElement, LinkedElement<T>* setNext = nullptr):
value(setElement), next(setNext) {}
virtual ~LinkedElement(){}
}
virtual LinkedElement* getNext() const {
return next;
}
@ -58,11 +57,16 @@ public:
virtual void setNext(LinkedElement* next) {
this->next = next;
}
virtual void setEnd() {
this->next = nullptr;
}
LinkedElement* begin() {
return this;
}
LinkedElement* end() {
return NULL;
return nullptr;
}
private:
LinkedElement *next;
@ -71,37 +75,80 @@ private:
template<typename T>
class SinglyLinkedList {
public:
SinglyLinkedList() :
start(NULL) {
}
using ElementIterator = typename LinkedElement<T>::Iterator;
SinglyLinkedList() {}
SinglyLinkedList(ElementIterator start) :
start(start.value) {}
SinglyLinkedList(typename LinkedElement<T>::Iterator start) :
start(start.value) {
}
SinglyLinkedList(LinkedElement<T>* startElement) :
start(startElement) {
}
typename LinkedElement<T>::Iterator begin() const {
return LinkedElement<T>::Iterator::Iterator(start);
}
typename LinkedElement<T>::Iterator::Iterator end() const {
return LinkedElement<T>::Iterator::Iterator();
start(startElement) {}
ElementIterator begin() const {
return ElementIterator::Iterator(start);
}
uint32_t getSize() const {
uint32_t size = 0;
/** Returns iterator to nulltr */
ElementIterator end() const {
return ElementIterator::Iterator();
}
/**
* Returns last element in singly linked list.
* @return
*/
ElementIterator back() const {
LinkedElement<T> *element = start;
while (element->getNext() != nullptr) {
element = element->getNext();
}
return ElementIterator::Iterator(element);
}
size_t getSize() const {
size_t size = 0;
LinkedElement<T> *element = start;
while (element != NULL) {
while (element != nullptr) {
size++;
element = element->getNext();
}
return size;
}
void setStart(LinkedElement<T>* setStart) {
start = setStart;
void setStart(LinkedElement<T>* firstElement) {
start = firstElement;
}
void setNext(LinkedElement<T>* currentElement,
LinkedElement<T>* nextElement) {
currentElement->setNext(nextElement);
}
void setLast(LinkedElement<T>* lastElement) {
lastElement->setEnd();
}
void insertElement(LinkedElement<T>* element, size_t position) {
LinkedElement<T> *currentElement = start;
for(size_t count = 0; count < position; count++) {
if(currentElement == nullptr) {
return;
}
currentElement = currentElement->getNext();
}
LinkedElement<T>* elementAfterCurrent = currentElement->next;
currentElement->setNext(element);
if(elementAfterCurrent != nullptr) {
element->setNext(elementAfterCurrent);
}
}
void insertBack(LinkedElement<T>* lastElement) {
back().value->setNext(lastElement);
}
protected:
LinkedElement<T> *start;
LinkedElement<T> *start = nullptr;
};
#endif /* SINGLYLINKEDLIST_H_ */

View File

@ -1,8 +1,8 @@
#include <framework/subsystem/SubsystemBase.h>
#include <framework/controller/ControllerBase.h>
#include <framework/subsystem/SubsystemBase.h>
#include <framework/ipc/QueueFactory.h>
#include <framework/action/HasActionsIF.h>
#include "../subsystem/SubsystemBase.h"
#include "ControllerBase.h"
#include "../subsystem/SubsystemBase.h"
#include "../ipc/QueueFactory.h"
#include "../action/HasActionsIF.h"
ControllerBase::ControllerBase(uint32_t setObjectId, uint32_t parentId,
size_t commandQueueDepth) :

View File

@ -1,13 +1,13 @@
#ifndef CONTROLLERBASE_H_
#define CONTROLLERBASE_H_
#include <framework/health/HasHealthIF.h>
#include <framework/health/HealthHelper.h>
#include <framework/modes/HasModesIF.h>
#include <framework/modes/ModeHelper.h>
#include <framework/objectmanager/SystemObject.h>
#include <framework/tasks/ExecutableObjectIF.h>
#include <framework/datapool/HkSwitchHelper.h>
#include "../health/HasHealthIF.h"
#include "../health/HealthHelper.h"
#include "../modes/HasModesIF.h"
#include "../modes/ModeHelper.h"
#include "../objectmanager/SystemObject.h"
#include "../tasks/ExecutableObjectIF.h"
#include "../datapool/HkSwitchHelper.h"
class ControllerBase: public HasModesIF,

View File

@ -1,7 +1,7 @@
#include <framework/coordinates/CoordinateTransformations.h>
#include <framework/globalfunctions/constants.h>
#include <framework/globalfunctions/math/MatrixOperations.h>
#include <framework/globalfunctions/math/VectorOperations.h>
#include "CoordinateTransformations.h"
#include "../globalfunctions/constants.h"
#include "../globalfunctions/math/MatrixOperations.h"
#include "../globalfunctions/math/VectorOperations.h"
#include <stddef.h>
#include <cmath>

View File

@ -1,7 +1,7 @@
#ifndef COORDINATETRANSFORMATIONS_H_
#define COORDINATETRANSFORMATIONS_H_
#include <framework/timemanager/Clock.h>
#include "../timemanager/Clock.h"
#include <cstring>
class CoordinateTransformations {

View File

@ -2,10 +2,10 @@
#define FRAMEWORK_COORDINATES_JGM3MODEL_H_
#include <stdint.h>
#include <framework/coordinates/CoordinateTransformations.h>
#include <framework/globalfunctions/math/VectorOperations.h>
#include <framework/globalfunctions/timevalOperations.h>
#include <framework/globalfunctions/constants.h>
#include "CoordinateTransformations.h"
#include "../globalfunctions/math/VectorOperations.h"
#include "../globalfunctions/timevalOperations.h"
#include "../globalfunctions/constants.h"
#include <memory.h>

View File

@ -1,9 +1,9 @@
#include <framework/coordinates/CoordinateTransformations.h>
#include <framework/coordinates/Sgp4Propagator.h>
#include <framework/globalfunctions/constants.h>
#include <framework/globalfunctions/math/MatrixOperations.h>
#include <framework/globalfunctions/math/VectorOperations.h>
#include <framework/globalfunctions/timevalOperations.h>
#include "CoordinateTransformations.h"
#include "Sgp4Propagator.h"
#include "../globalfunctions/constants.h"
#include "../globalfunctions/math/MatrixOperations.h"
#include "../globalfunctions/math/VectorOperations.h"
#include "../globalfunctions/timevalOperations.h"
#include <cstring>
Sgp4Propagator::Sgp4Propagator() :
initialized(false), epoch({0, 0}), whichconst(wgs84) {

View File

@ -3,7 +3,7 @@
#include <sys/time.h>
#include "../contrib/sgp4/sgp4unit.h"
#include <framework/returnvalues/HasReturnvaluesIF.h>
#include "../returnvalues/HasReturnvaluesIF.h"
class Sgp4Propagator {
public:

View File

@ -8,7 +8,7 @@
#ifndef BCFRAME_H_
#define BCFRAME_H_
#include <framework/datalinklayer/CCSDSReturnValuesIF.h>
#include "CCSDSReturnValuesIF.h"
/**
* Small helper class to identify a BcFrame.

View File

@ -8,7 +8,7 @@
#ifndef CCSDSRETURNVALUESIF_H_
#define CCSDSRETURNVALUESIF_H_
#include <framework/returnvalues/HasReturnvaluesIF.h>
#include "../returnvalues/HasReturnvaluesIF.h"
/**
* This is a helper class to collect special return values that come up during CCSDS Handling.
* @ingroup ccsds_handling

View File

@ -7,8 +7,8 @@
#include <framework/datalinklayer/Clcw.h>
#include <framework/serviceinterface/ServiceInterfaceStream.h>
#include "Clcw.h"
#include "../serviceinterface/ServiceInterfaceStream.h"
Clcw::Clcw() {
content.raw = 0;

View File

@ -8,7 +8,7 @@
#ifndef CLCW_H_
#define CLCW_H_
#include <framework/datalinklayer/ClcwIF.h>
#include "ClcwIF.h"
/**
* Small helper method to handle the Clcw values.
* It has a content struct that manages the register and can be set externally.

View File

@ -1,6 +1,6 @@
#include <framework/datalinklayer/DataLinkLayer.h>
#include <framework/globalfunctions/CRC.h>
#include <framework/serviceinterface/ServiceInterfaceStream.h>
#include "DataLinkLayer.h"
#include "../globalfunctions/CRC.h"
#include "../serviceinterface/ServiceInterfaceStream.h"
DataLinkLayer::DataLinkLayer(uint8_t* set_frame_buffer, ClcwIF* setClcw,
uint8_t set_start_sequence_length, uint16_t set_scid) :

View File

@ -1,11 +1,11 @@
#ifndef DATALINKLAYER_H_
#define DATALINKLAYER_H_
#include <framework/datalinklayer/CCSDSReturnValuesIF.h>
#include <framework/datalinklayer/ClcwIF.h>
#include <framework/datalinklayer/TcTransferFrame.h>
#include <framework/datalinklayer/VirtualChannelReceptionIF.h>
#include <framework/events/Event.h>
#include "CCSDSReturnValuesIF.h"
#include "ClcwIF.h"
#include "TcTransferFrame.h"
#include "VirtualChannelReceptionIF.h"
#include "../events/Event.h"
#include <map>

View File

@ -8,7 +8,7 @@
#ifndef FARM1STATEIF_H_
#define FARM1STATEIF_H_
#include <framework/datalinklayer/CCSDSReturnValuesIF.h>
#include "CCSDSReturnValuesIF.h"
class VirtualChannelReception;
class TcTransferFrame;
class ClcwIF;

View File

@ -7,10 +7,10 @@
#include <framework/datalinklayer/ClcwIF.h>
#include <framework/datalinklayer/Farm1StateLockout.h>
#include <framework/datalinklayer/TcTransferFrame.h>
#include <framework/datalinklayer/VirtualChannelReception.h>
#include "ClcwIF.h"
#include "Farm1StateLockout.h"
#include "TcTransferFrame.h"
#include "VirtualChannelReception.h"
Farm1StateLockout::Farm1StateLockout(VirtualChannelReception* setMyVC) : myVC(setMyVC) {
}

View File

@ -8,7 +8,7 @@
#ifndef FARM1STATELOCKOUT_H_
#define FARM1STATELOCKOUT_H_
#include <framework/datalinklayer/Farm1StateIF.h>
#include "Farm1StateIF.h"
/**
* This class represents the FARM-1 "Lockout" State.

View File

@ -8,10 +8,10 @@
#include <framework/datalinklayer/ClcwIF.h>
#include <framework/datalinklayer/Farm1StateOpen.h>
#include <framework/datalinklayer/TcTransferFrame.h>
#include <framework/datalinklayer/VirtualChannelReception.h>
#include "ClcwIF.h"
#include "Farm1StateOpen.h"
#include "TcTransferFrame.h"
#include "VirtualChannelReception.h"
Farm1StateOpen::Farm1StateOpen(VirtualChannelReception* setMyVC) : myVC(setMyVC) {
}

View File

@ -8,7 +8,7 @@
#ifndef FARM1STATEOPEN_H_
#define FARM1STATEOPEN_H_
#include <framework/datalinklayer/Farm1StateIF.h>
#include "Farm1StateIF.h"
/**
* This class represents the FARM-1 "Open" State.

View File

@ -6,10 +6,10 @@
*/
#include <framework/datalinklayer/ClcwIF.h>
#include <framework/datalinklayer/Farm1StateWait.h>
#include <framework/datalinklayer/TcTransferFrame.h>
#include <framework/datalinklayer/VirtualChannelReception.h>
#include "ClcwIF.h"
#include "Farm1StateWait.h"
#include "TcTransferFrame.h"
#include "VirtualChannelReception.h"
Farm1StateWait::Farm1StateWait(VirtualChannelReception* setMyVC) : myVC(setMyVC) {
}

View File

@ -8,7 +8,7 @@
#ifndef FARM1STATEWAIT_H_
#define FARM1STATEWAIT_H_
#include <framework/datalinklayer/Farm1StateIF.h>
#include "Farm1StateIF.h"
/**
* This class represents the FARM-1 "Wait" State.

View File

@ -5,13 +5,13 @@
* @author baetz
*/
#include <framework/datalinklayer/MapPacketExtraction.h>
#include <framework/ipc/QueueFactory.h>
#include <framework/serviceinterface/ServiceInterfaceStream.h>
#include <framework/storagemanager/StorageManagerIF.h>
#include <framework/tmtcpacket/SpacePacketBase.h>
#include <framework/tmtcservices/AcceptsTelecommandsIF.h>
#include <framework/tmtcservices/TmTcMessage.h>
#include "MapPacketExtraction.h"
#include "../ipc/QueueFactory.h"
#include "../serviceinterface/ServiceInterfaceStream.h"
#include "../storagemanager/StorageManagerIF.h"
#include "../tmtcpacket/SpacePacketBase.h"
#include "../tmtcservices/AcceptsTelecommandsIF.h"
#include "../tmtcservices/TmTcMessage.h"
#include <string.h>
MapPacketExtraction::MapPacketExtraction(uint8_t setMapId,

View File

@ -8,10 +8,10 @@
#ifndef MAPPACKETEXTRACTION_H_
#define MAPPACKETEXTRACTION_H_
#include <framework/datalinklayer/MapPacketExtractionIF.h>
#include <framework/objectmanager/ObjectManagerIF.h>
#include <framework/returnvalues/HasReturnvaluesIF.h>
#include <framework/ipc/MessageQueueSenderIF.h>
#include "MapPacketExtractionIF.h"
#include "../objectmanager/ObjectManagerIF.h"
#include "../returnvalues/HasReturnvaluesIF.h"
#include "../ipc/MessageQueueSenderIF.h"
class StorageManagerIF;

View File

@ -8,8 +8,8 @@
#ifndef MAPPACKETEXTRACTIONIF_H_
#define MAPPACKETEXTRACTIONIF_H_
#include <framework/datalinklayer/CCSDSReturnValuesIF.h>
#include <framework/datalinklayer/TcTransferFrame.h>
#include "CCSDSReturnValuesIF.h"
#include "TcTransferFrame.h"
/**
* This is the interface for MAP Packet Extraction classes.

View File

@ -7,8 +7,8 @@
#include <framework/datalinklayer/TcTransferFrame.h>
#include <framework/serviceinterface/ServiceInterfaceStream.h>
#include "TcTransferFrame.h"
#include "../serviceinterface/ServiceInterfaceStream.h"
TcTransferFrame::TcTransferFrame() {
frame = NULL;

View File

@ -5,9 +5,9 @@
* @author baetz
*/
#include <framework/datalinklayer/TcTransferFrameLocal.h>
#include <framework/globalfunctions/CRC.h>
#include <framework/serviceinterface/ServiceInterfaceStream.h>
#include "TcTransferFrameLocal.h"
#include "../globalfunctions/CRC.h"
#include "../serviceinterface/ServiceInterfaceStream.h"
#include <string.h>
TcTransferFrameLocal::TcTransferFrameLocal(bool bypass, bool controlCommand, uint16_t scid,

View File

@ -8,7 +8,7 @@
#ifndef TCTRANSFERFRAMELOCAL_H_
#define TCTRANSFERFRAMELOCAL_H_
#include <framework/datalinklayer/TcTransferFrame.h>
#include "TcTransferFrame.h"
/**
* This is a helper class to locally create TC Transfer Frames.

View File

@ -5,9 +5,9 @@
* @author baetz
*/
#include <framework/datalinklayer/BCFrame.h>
#include <framework/datalinklayer/VirtualChannelReception.h>
#include <framework/serviceinterface/ServiceInterfaceStream.h>
#include "BCFrame.h"
#include "VirtualChannelReception.h"
#include "../serviceinterface/ServiceInterfaceStream.h"
VirtualChannelReception::VirtualChannelReception(uint8_t setChannelId,
uint8_t setSlidingWindowWidth) :

View File

@ -8,14 +8,14 @@
#ifndef VIRTUALCHANNELRECEPTION_H_
#define VIRTUALCHANNELRECEPTION_H_
#include <framework/datalinklayer/CCSDSReturnValuesIF.h>
#include <framework/datalinklayer/Clcw.h>
#include <framework/datalinklayer/Farm1StateIF.h>
#include <framework/datalinklayer/Farm1StateLockout.h>
#include <framework/datalinklayer/Farm1StateOpen.h>
#include <framework/datalinklayer/Farm1StateWait.h>
#include <framework/datalinklayer/MapPacketExtractionIF.h>
#include <framework/datalinklayer/VirtualChannelReceptionIF.h>
#include "CCSDSReturnValuesIF.h"
#include "Clcw.h"
#include "Farm1StateIF.h"
#include "Farm1StateLockout.h"
#include "Farm1StateOpen.h"
#include "Farm1StateWait.h"
#include "MapPacketExtractionIF.h"
#include "VirtualChannelReceptionIF.h"
#include <map>
/**
* Implementation of a TC Virtual Channel.

View File

@ -8,9 +8,9 @@
#ifndef VIRTUALCHANNELRECEPTIONIF_H_
#define VIRTUALCHANNELRECEPTIONIF_H_
#include <framework/datalinklayer/ClcwIF.h>
#include <framework/datalinklayer/TcTransferFrame.h>
#include <framework/returnvalues/HasReturnvaluesIF.h>
#include "ClcwIF.h"
#include "TcTransferFrame.h"
#include "../returnvalues/HasReturnvaluesIF.h"
/**
* This is the interface for Virtual Channel reception classes.

View File

@ -1,4 +1,4 @@
#include <framework/datapool/ControllerSet.h>
#include "ControllerSet.h"
ControllerSet::ControllerSet() {

View File

@ -1,7 +1,7 @@
#ifndef CONTROLLERSET_H_
#define CONTROLLERSET_H_
#include <framework/datapool/DataSet.h>
#include "DataSet.h"
class ControllerSet :public DataSet {
public:

View File

@ -1,6 +1,6 @@
#include <framework/datapool/DataPool.h>
#include <framework/serviceinterface/ServiceInterfaceStream.h>
#include <framework/ipc/MutexFactory.h>
#include "DataPool.h"
#include "../serviceinterface/ServiceInterfaceStream.h"
#include "../ipc/MutexFactory.h"
DataPool::DataPool( void ( *initFunction )( std::map<uint32_t, PoolEntryIF*>* pool_map ) ) {
mutex = MutexFactory::instance()->createMutex();
@ -39,10 +39,10 @@ PoolEntryIF* DataPool::getRawData( uint32_t data_pool_id ) {
}
}
//uint8_t DataPool::getRawData( uint32_t data_pool_id, uint8_t* address, uint16_t* size, uint32_t max_size ) {
//uint8_t DataPool::getRawData( uint32_t data_pool_id, uint8_t* address, uint16_t* size, uint32_t maxSize ) {
// std::map<uint32_t, PoolEntryIF*>::iterator it = this->data_pool.find( data_pool_id );
// if ( it != this->data_pool.end() ) {
// if ( it->second->getByteSize() <= max_size ) {
// if ( it->second->getByteSize() <= maxSize ) {
// *size = it->second->getByteSize();
// memcpy( address, it->second->getRawData(), *size );
// return DP_SUCCESSFUL;
@ -61,7 +61,7 @@ ReturnValue_t DataPool::freeDataPoolLock() {
}
ReturnValue_t DataPool::lockDataPool() {
ReturnValue_t status = mutex->lockMutex(MutexIF::NO_TIMEOUT);
ReturnValue_t status = mutex->lockMutex(MutexIF::BLOCKING);
if ( status != RETURN_OK ) {
sif::error << "DataPool::DataPool: lock of mutex failed with error code: " << status << std::endl;
}

View File

@ -11,9 +11,9 @@
#ifndef DATAPOOL_H_
#define DATAPOOL_H_
#include <framework/datapool/PoolEntry.h>
#include <framework/globalfunctions/Type.h>
#include <framework/ipc/MutexIF.h>
#include "PoolEntry.h"
#include "../globalfunctions/Type.h"
#include "../ipc/MutexIF.h"
#include <map>
/**

View File

@ -1,10 +1,10 @@
#include <framework/datapool/DataPool.h>
#include <framework/datapool/DataPoolAdmin.h>
#include <framework/datapool/DataSet.h>
#include <framework/datapool/PoolRawAccess.h>
#include <framework/ipc/CommandMessage.h>
#include <framework/ipc/QueueFactory.h>
#include <framework/parameters/ParameterMessage.h>
#include "DataPool.h"
#include "DataPoolAdmin.h"
#include "DataSet.h"
#include "PoolRawAccess.h"
#include "../ipc/CommandMessage.h"
#include "../ipc/QueueFactory.h"
#include "../parameters/ParameterMessage.h"
DataPoolAdmin::DataPoolAdmin(object_id_t objectId) :
SystemObject(objectId), storage(NULL), commandQueue(NULL), memoryHelper(
@ -26,7 +26,7 @@ MessageQueueId_t DataPoolAdmin::getCommandQueue() const {
}
ReturnValue_t DataPoolAdmin::executeAction(ActionId_t actionId,
MessageQueueId_t commandedBy, const uint8_t* data, uint32_t size) {
MessageQueueId_t commandedBy, const uint8_t* data, size_t size) {
if (actionId != SET_VALIDITY) {
return INVALID_ACTION_ID;
}
@ -91,7 +91,7 @@ void DataPoolAdmin::handleCommand() {
}
ReturnValue_t DataPoolAdmin::handleMemoryLoad(uint32_t address,
const uint8_t* data, uint32_t size, uint8_t** dataPointer) {
const uint8_t* data, size_t size, uint8_t** dataPointer) {
uint32_t poolId = ::dataPool.PIDToDataPoolId(address);
uint8_t arrayIndex = ::dataPool.PIDToArrayIndex(address);
DataSet testSet;
@ -129,7 +129,7 @@ ReturnValue_t DataPoolAdmin::handleMemoryLoad(uint32_t address,
return ACTIVITY_COMPLETED;
}
ReturnValue_t DataPoolAdmin::handleMemoryDump(uint32_t address, uint32_t size,
ReturnValue_t DataPoolAdmin::handleMemoryDump(uint32_t address, size_t size,
uint8_t** dataPointer, uint8_t* copyHere) {
uint32_t poolId = ::dataPool.PIDToDataPoolId(address);
uint8_t arrayIndex = ::dataPool.PIDToArrayIndex(address);
@ -151,7 +151,7 @@ ReturnValue_t DataPoolAdmin::handleMemoryDump(uint32_t address, uint32_t size,
PoolVariableIF::VAR_READ);
status = rawSet.read();
if (status == RETURN_OK) {
uint32_t temp = 0;
size_t temp = 0;
status = variable.getEntryEndianSafe(ptrToCopy, &temp, size);
if (status != RETURN_OK) {
return RETURN_FAILED;
@ -261,7 +261,7 @@ ReturnValue_t DataPoolAdmin::handleParameterCommand(CommandMessage* command) {
//identical to ParameterHelper::sendParameter()
ReturnValue_t DataPoolAdmin::sendParameter(MessageQueueId_t to, uint32_t id,
const DataPoolParameterWrapper* wrapper) {
uint32_t serializedSize = wrapper->getSerializedSize();
size_t serializedSize = wrapper->getSerializedSize();
uint8_t *storeElement;
store_address_t address;
@ -272,10 +272,10 @@ ReturnValue_t DataPoolAdmin::sendParameter(MessageQueueId_t to, uint32_t id,
return result;
}
uint32_t storeElementSize = 0;
size_t storeElementSize = 0;
result = wrapper->serialize(&storeElement, &storeElementSize,
serializedSize, true);
serializedSize, SerializeIF::Endianness::BIG);
if (result != HasReturnvaluesIF::RETURN_OK) {
storage->deleteData(address);

View File

@ -1,15 +1,15 @@
#ifndef DATAPOOLADMIN_H_
#define DATAPOOLADMIN_H_
#include <framework/memory/MemoryHelper.h>
#include <framework/action/HasActionsIF.h>
#include <framework/action/SimpleActionHelper.h>
#include <framework/objectmanager/SystemObject.h>
#include <framework/returnvalues/HasReturnvaluesIF.h>
#include <framework/tasks/ExecutableObjectIF.h>
#include <framework/parameters/ReceivesParameterMessagesIF.h>
#include <framework/datapool/DataPoolParameterWrapper.h>
#include <framework/ipc/MessageQueueIF.h>
#include "../memory/MemoryHelper.h"
#include "../action/HasActionsIF.h"
#include "../action/SimpleActionHelper.h"
#include "../objectmanager/SystemObject.h"
#include "../returnvalues/HasReturnvaluesIF.h"
#include "../tasks/ExecutableObjectIF.h"
#include "../parameters/ReceivesParameterMessagesIF.h"
#include "DataPoolParameterWrapper.h"
#include "../ipc/MessageQueueIF.h"
class DataPoolAdmin: public HasActionsIF,
public ExecutableObjectIF,
@ -29,12 +29,12 @@ public:
MessageQueueId_t getCommandQueue() const;
ReturnValue_t handleMemoryLoad(uint32_t address, const uint8_t* data,
uint32_t size, uint8_t** dataPointer);
ReturnValue_t handleMemoryDump(uint32_t address, uint32_t size,
size_t size, uint8_t** dataPointer);
ReturnValue_t handleMemoryDump(uint32_t address, size_t size,
uint8_t** dataPointer, uint8_t* copyHere);
ReturnValue_t executeAction(ActionId_t actionId,
MessageQueueId_t commandedBy, const uint8_t* data, uint32_t size);
MessageQueueId_t commandedBy, const uint8_t* data, size_t size);
//not implemented as ParameterHelper is no used
ReturnValue_t getParameter(uint8_t domainId, uint16_t parameterId,

View File

@ -1,10 +1,10 @@
#include "DataPoolParameterWrapper.h"
//for returncodes
#include <framework/parameters/HasParametersIF.h>
#include "../parameters/HasParametersIF.h"
#include <framework/datapool/DataSet.h>
#include <framework/datapool/PoolRawAccess.h>
#include "DataSet.h"
#include "PoolRawAccess.h"
DataPoolParameterWrapper::DataPoolParameterWrapper() :
type(Type::UNKNOWN_TYPE), rows(0), columns(0), poolId(
@ -36,22 +36,22 @@ ReturnValue_t DataPoolParameterWrapper::set(uint8_t domainId,
}
ReturnValue_t DataPoolParameterWrapper::serialize(uint8_t** buffer,
uint32_t* size, const uint32_t max_size, bool bigEndian) const {
size_t* size, size_t maxSize, Endianness streamEndianness) const {
ReturnValue_t result;
result = SerializeAdapter<Type>::serialize(&type, buffer, size, max_size,
bigEndian);
result = SerializeAdapter::serialize(&type, buffer, size, maxSize,
streamEndianness);
if (result != HasReturnvaluesIF::RETURN_OK) {
return result;
}
result = SerializeAdapter<uint8_t>::serialize(&columns, buffer, size,
max_size, bigEndian);
result = SerializeAdapter::serialize(&columns, buffer, size,
maxSize, streamEndianness);
if (result != HasReturnvaluesIF::RETURN_OK) {
return result;
}
result = SerializeAdapter<uint8_t>::serialize(&rows, buffer, size, max_size,
bigEndian);
result = SerializeAdapter::serialize(&rows, buffer, size, maxSize,
streamEndianness);
if (result != HasReturnvaluesIF::RETURN_OK) {
return result;
}
@ -60,7 +60,7 @@ ReturnValue_t DataPoolParameterWrapper::serialize(uint8_t** buffer,
DataSet mySet;
PoolRawAccess raw(poolId, index, &mySet,PoolVariableIF::VAR_READ);
mySet.read();
result = raw.serialize(buffer,size,max_size,bigEndian);
result = raw.serialize(buffer,size,maxSize,streamEndianness);
if (result != HasReturnvaluesIF::RETURN_OK){
return result;
}
@ -69,8 +69,8 @@ ReturnValue_t DataPoolParameterWrapper::serialize(uint8_t** buffer,
}
//same as ParameterWrapper
uint32_t DataPoolParameterWrapper::getSerializedSize() const {
uint32_t serializedSize = 0;
size_t DataPoolParameterWrapper::getSerializedSize() const {
size_t serializedSize = 0;
serializedSize += type.getSerializedSize();
serializedSize += sizeof(rows);
serializedSize += sizeof(columns);
@ -80,7 +80,7 @@ uint32_t DataPoolParameterWrapper::getSerializedSize() const {
}
ReturnValue_t DataPoolParameterWrapper::deSerialize(const uint8_t** buffer,
int32_t* size, bool bigEndian) {
size_t* size, Endianness streamEndianness) {
return HasReturnvaluesIF::RETURN_FAILED;
}

View File

@ -1,8 +1,8 @@
#ifndef DATAPOOLPARAMETERWRAPPER_H_
#define DATAPOOLPARAMETERWRAPPER_H_
#include <framework/globalfunctions/Type.h>
#include <framework/parameters/ParameterWrapper.h>
#include "../globalfunctions/Type.h"
#include "../parameters/ParameterWrapper.h"
class DataPoolParameterWrapper: public SerializeIF {
public:
@ -11,13 +11,13 @@ public:
ReturnValue_t set(uint8_t domainId, uint16_t parameterId);
virtual ReturnValue_t serialize(uint8_t** buffer, uint32_t* size,
const uint32_t max_size, bool bigEndian) const;
virtual ReturnValue_t serialize(uint8_t** buffer, size_t* size,
size_t maxSize, Endianness streamEndianness) const override;
virtual uint32_t getSerializedSize() const;
virtual size_t getSerializedSize() const override;
virtual ReturnValue_t deSerialize(const uint8_t** buffer, int32_t* size,
bool bigEndian);
virtual ReturnValue_t deSerialize(const uint8_t** buffer, size_t* size,
Endianness streamEndianness) override;
ReturnValue_t copyFrom(const ParameterWrapper *from,
uint16_t startWritingAtIndex);

View File

@ -1,5 +1,5 @@
#include <framework/datapool/DataSet.h>
#include <framework/serviceinterface/ServiceInterfaceStream.h>
#include "DataSet.h"
#include "../serviceinterface/ServiceInterfaceStream.h"
DataSet::DataSet() :
fill_count(0), state(DATA_SET_UNINITIALISED) {
@ -106,12 +106,12 @@ uint8_t DataSet::lockDataPool() {
return ::dataPool.lockDataPool();
}
ReturnValue_t DataSet::serialize(uint8_t** buffer, uint32_t* size,
const uint32_t max_size, bool bigEndian) const {
ReturnValue_t DataSet::serialize(uint8_t** buffer, size_t* size,
size_t maxSize, Endianness streamEndianness) const {
ReturnValue_t result = RETURN_FAILED;
for (uint16_t count = 0; count < fill_count; count++) {
result = registeredVariables[count]->serialize(buffer, size, max_size,
bigEndian);
result = registeredVariables[count]->serialize(buffer, size, maxSize,
streamEndianness);
if (result != RETURN_OK) {
return result;
}
@ -119,8 +119,8 @@ ReturnValue_t DataSet::serialize(uint8_t** buffer, uint32_t* size,
return result;
}
uint32_t DataSet::getSerializedSize() const {
uint32_t size = 0;
size_t DataSet::getSerializedSize() const {
size_t size = 0;
for (uint16_t count = 0; count < fill_count; count++) {
size += registeredVariables[count]->getSerializedSize();
}
@ -136,12 +136,12 @@ void DataSet::setValid(uint8_t valid) {
}
}
ReturnValue_t DataSet::deSerialize(const uint8_t** buffer, int32_t* size,
bool bigEndian) {
ReturnValue_t DataSet::deSerialize(const uint8_t** buffer, size_t* size,
Endianness streamEndianness) {
ReturnValue_t result = RETURN_FAILED;
for (uint16_t count = 0; count < fill_count; count++) {
result = registeredVariables[count]->deSerialize(buffer, size,
bigEndian);
streamEndianness);
if (result != RETURN_OK) {
return result;
}

View File

@ -12,13 +12,13 @@
#ifndef DATASET_H_
#define DATASET_H_
#include <framework/datapool/DataPool.h>
#include <framework/datapool/DataSetIF.h>
#include <framework/datapool/PoolRawAccess.h>
#include <framework/datapool/PoolVariable.h>
#include <framework/datapool/PoolVarList.h>
#include <framework/datapool/PoolVector.h>
#include <framework/serialize/SerializeAdapter.h>
#include "DataPool.h"
#include "DataSetIF.h"
#include "PoolRawAccess.h"
#include "PoolVariable.h"
#include "PoolVarList.h"
#include "PoolVector.h"
#include "../serialize/SerializeAdapter.h"
/**
* \brief The DataSet class manages a set of locally checked out variables.
*
@ -146,13 +146,13 @@ public:
*/
void setValid(uint8_t valid);
ReturnValue_t serialize(uint8_t** buffer, uint32_t* size,
const uint32_t max_size, bool bigEndian) const;
ReturnValue_t serialize(uint8_t** buffer, size_t* size,
size_t maxSize, Endianness streamEndianness) const override;
uint32_t getSerializedSize() const;
size_t getSerializedSize() const override;
ReturnValue_t deSerialize(const uint8_t** buffer, int32_t* size,
bool bigEndian);
ReturnValue_t deSerialize(const uint8_t** buffer, size_t* size,
Endianness streamEndianness) override;
};

View File

@ -1,6 +1,6 @@
#include <framework/datapool/HkSwitchHelper.h>
#include "HkSwitchHelper.h"
//#include <mission/tmtcservices/HKService_03.h>
#include <framework/ipc/QueueFactory.h>
#include "../ipc/QueueFactory.h"
HkSwitchHelper::HkSwitchHelper(EventReportingProxyIF* eventProxy) :
commandActionHelper(this), eventProxy(eventProxy) {

View File

@ -1,9 +1,9 @@
#ifndef FRAMEWORK_DATAPOOL_HKSWITCHHELPER_H_
#define FRAMEWORK_DATAPOOL_HKSWITCHHELPER_H_
#include <framework/tasks/ExecutableObjectIF.h>
#include <framework/action/CommandsActionsIF.h>
#include <framework/events/EventReportingProxyIF.h>
#include "../tasks/ExecutableObjectIF.h"
#include "../action/CommandsActionsIF.h"
#include "../events/EventReportingProxyIF.h"
//TODO this class violations separation between mission and framework
//but it is only a transitional solution until the Datapool is

View File

@ -1,11 +1,11 @@
#ifndef PIDREADER_H_
#define PIDREADER_H_
#include <framework/datapool/DataPool.h>
#include <framework/datapool/DataSetIF.h>
#include <framework/datapool/PoolEntry.h>
#include <framework/datapool/PoolVariableIF.h>
#include <framework/serialize/SerializeAdapter.h>
#include <framework/serviceinterface/ServiceInterfaceStream.h>
#include "DataPool.h"
#include "DataSetIF.h"
#include "PoolEntry.h"
#include "PoolVariableIF.h"
#include "../serialize/SerializeAdapter.h"
#include "../serviceinterface/ServiceInterfaceStream.h"
template<typename U, uint8_t n_var> class PIDReaderList;
@ -17,7 +17,7 @@ protected:
uint8_t valid;
ReturnValue_t read() {
uint8_t arrayIndex = DataPool::PIDToArrayIndex(parameterId);
PoolEntry<T>* read_out = ::dataPool.getData<T>(
PoolEntry<T> *read_out = ::dataPool.getData<T>(
DataPool::PIDToDataPoolId(parameterId), arrayIndex);
if (read_out != NULL) {
valid = read_out->valid;
@ -43,7 +43,8 @@ protected:
* Empty ctor for List initialization
*/
PIDReader() :
parameterId(PoolVariableIF::NO_PARAMETER), valid(PoolVariableIF::INVALID), value(0) {
parameterId(PoolVariableIF::NO_PARAMETER), valid(
PoolVariableIF::INVALID), value(0) {
}
public:
@ -63,9 +64,9 @@ public:
* \param setWritable If this flag is set to true, changes in the value attribute can be
* written back to the data pool, otherwise not.
*/
PIDReader(uint32_t setParameterId, DataSetIF* dataSet) :
parameterId(setParameterId), valid(
PoolVariableIF::INVALID), value(0) {
PIDReader(uint32_t setParameterId, DataSetIF *dataSet) :
parameterId(setParameterId), valid(PoolVariableIF::INVALID), value(
0) {
if (dataSet != NULL) {
dataSet->registerVariable(this);
}
@ -74,7 +75,7 @@ public:
/**
* Copy ctor to copy classes containing Pool Variables.
*/
PIDReader(const PIDReader& rhs) :
PIDReader(const PIDReader &rhs) :
parameterId(rhs.parameterId), valid(rhs.valid), value(rhs.value) {
}
@ -121,24 +122,25 @@ public:
return value;
}
PIDReader<T> &operator=(T newValue) {
PIDReader<T>& operator=(T newValue) {
value = newValue;
return *this;
}
virtual ReturnValue_t serialize(uint8_t** buffer, uint32_t* size,
const uint32_t max_size, bool bigEndian) const {
return SerializeAdapter<T>::serialize(&value, buffer, size, max_size,
bigEndian);
virtual ReturnValue_t serialize(uint8_t **buffer, size_t *size,
size_t maxSize, Endianness streamEndianness) const override {
return SerializeAdapter::serialize(&value, buffer, size, maxSize,
streamEndianness);
}
virtual uint32_t getSerializedSize() const {
return SerializeAdapter<T>::getSerializedSize(&value);
virtual size_t getSerializedSize() const override {
return SerializeAdapter::getSerializedSize(&value);
}
virtual ReturnValue_t deSerialize(const uint8_t** buffer, int32_t* size,
bool bigEndian) {
return SerializeAdapter<T>::deSerialize(&value, buffer, size, bigEndian);
virtual ReturnValue_t deSerialize(const uint8_t **buffer, size_t *size,
Endianness streamEndianness) override {
return SerializeAdapter::deSerialize(&value, buffer, size,
streamEndianness);
}
};

View File

@ -1,8 +1,8 @@
#ifndef FRAMEWORK_DATAPOOL_PIDREADERLIST_H_
#define FRAMEWORK_DATAPOOL_PIDREADERLIST_H_
#include <framework/datapool/PIDReader.h>
#include <framework/datapool/PoolVariableIF.h>
#include "PIDReader.h"
#include "PoolVariableIF.h"
template <class T, uint8_t n_var>
class PIDReaderList {
private:

View File

@ -1,13 +1,34 @@
#include <framework/datapool/PoolEntry.h>
#include <framework/serviceinterface/ServiceInterfaceStream.h>
#include "PoolEntry.h"
#include "../serviceinterface/ServiceInterfaceStream.h"
#include "../globalfunctions/arrayprinter.h"
#include <cstring>
template <typename T>
PoolEntry<T>::PoolEntry( T* initValue, uint8_t set_length, uint8_t set_valid ) : length(set_length), valid(set_valid) {
PoolEntry<T>::PoolEntry(std::initializer_list<T> initValue, uint8_t setLength,
bool setValid ) : length(setLength), valid(setValid) {
this->address = new T[this->length];
if (initValue != NULL) {
memcpy(this->address, initValue, this->getByteSize() );
if(initValue.size() == 0) {
std::memset(this->address, 0, this->getByteSize());
}
else if (initValue.size() != setLength){
sif::warning << "PoolEntry: setLength is not equal to initializer list"
"length! Performing zero initialization with given setLength"
<< std::endl;
std::memset(this->address, 0, this->getByteSize());
}
else {
std::copy(initValue.begin(), initValue.end(), this->address);
}
}
template <typename T>
PoolEntry<T>::PoolEntry( T* initValue, uint8_t setLength, bool setValid ) :
length(setLength), valid(setValid) {
this->address = new T[this->length];
if (initValue != nullptr) {
std::memcpy(this->address, initValue, this->getByteSize() );
} else {
memset(this->address, 0, this->getByteSize() );
std::memset(this->address, 0, this->getByteSize() );
}
}
@ -34,21 +55,20 @@ void* PoolEntry<T>::getRawData() {
}
template <typename T>
void PoolEntry<T>::setValid( uint8_t isValid ) {
void PoolEntry<T>::setValid(bool isValid) {
this->valid = isValid;
}
template <typename T>
uint8_t PoolEntry<T>::getValid() {
bool PoolEntry<T>::getValid() {
return valid;
}
template <typename T>
void PoolEntry<T>::print() {
for (uint8_t size = 0; size < this->length; size++ ) {
sif::debug << "| " << std::hex << (double)this->address[size]
<< (this->valid? " (valid) " : " (invalid) ");
}
sif::debug << "Pool Entry Validity: " <<
(this->valid? " (valid) " : " (invalid) ") << std::endl;
arrayprinter::print(reinterpret_cast<uint8_t*>(address), length);
sif::debug << std::dec << std::endl;
}

View File

@ -1,81 +1,126 @@
#ifndef POOLENTRY_H_
#define POOLENTRY_H_
#ifndef FRAMEWORK_DATAPOOL_POOLENTRY_H_
#define FRAMEWORK_DATAPOOL_POOLENTRY_H_
#include "PoolEntryIF.h"
#include <initializer_list>
#include <type_traits>
#include <cstddef>
#include <framework/datapool/PoolEntryIF.h>
#include <stddef.h>
#include <cstring>
/**
* \brief This is a small helper class that defines a single data pool entry.
* @brief This is a small helper class that defines a single data pool entry.
* @details
* The helper is used to store all information together with the data as a
* single data pool entry. The content's type is defined by the template
* argument.
*
* \details The helper is used to store all information together with the data as a single data pool entry.
* The content's type is defined by the template argument.
* It is prepared for use with plain old data types,
* but may be extended to complex types if necessary.
* It can be initialized with a certain value, size and validity flag.
* It holds a pointer to the real data and offers methods to access this data and to acquire
* additional information (such as validity and array/byte size).
* It is NOT intended to be used outside the DataPool class.
* It is prepared for use with plain old data types, but may be
* extended to complex types if necessary. It can be initialized with a
* certain value, size and validity flag.
*
* \ingroup data_pool
* It holds a pointer to the real data and offers methods to access this data
* and to acquire additional information (such as validity and array/byte size).
* It is NOT intended to be used outside DataPool implementations as it performs
* dynamic memory allocation.
*
* @ingroup data_pool
*/
template <typename T>
class PoolEntry : public PoolEntryIF {
public:
static_assert(not std::is_same<T, bool>::value,
"Do not use boolean for the PoolEntry type, use uint8_t "
"instead! The ECSS standard defines a boolean as a one bit "
"field. Therefore it is preferred to store a boolean as an "
"uint8_t");
/**
* \brief In the classe's constructor, space is allocated on the heap and
* @brief In the classe's constructor, space is allocated on the heap and
* potential init values are copied to that space.
* \param initValue A pointer to the single value or array that holds the init value.
* With the default value (NULL), the entry is initalized with all 0.
* \param set_length Defines the array length of this entry.
* \param set_valid Sets the initialization flag. It is invalid (0) by default.
* @details
* Not passing any arguments will initialize an non-array pool entry
* (setLength = 1) with an initial invalid state.
* Please note that if an initializer list is passed, the correct
* corresponding length should be passed too, otherwise a zero
* initialization will be performed with the given setLength.
* @param initValue
* Initializer list with values to initialize with, for example {0,0} to
* initialize the two entries to zero.
* @param setLength
* Defines the array length of this entry. Should be equal to the
* intializer list length.
* @param setValid
* Sets the initialization flag. It is invalid by default.
*/
PoolEntry( T* initValue = NULL, uint8_t set_length = 1, uint8_t set_valid = 0 );
PoolEntry(std::initializer_list<T> initValue = {}, uint8_t setLength = 1,
bool setValid = false);
/**
* \brief The allocated memory for the variable is freed in the destructor.
* \details As the data pool is global, this dtor is only called on program exit.
* PoolEntries shall never be copied, as a copy might delete the variable on the heap.
* @brief In the classe's constructor, space is allocated on the heap and
* potential init values are copied to that space.
* @param initValue
* A pointer to the single value or array that holds the init value.
* With the default value (nullptr), the entry is initalized with all 0.
* @param setLength
* Defines the array length of this entry.
* @param setValid
* Sets the initialization flag. It is invalid by default.
*/
PoolEntry(T* initValue, uint8_t setLength = 1, bool setValid = false);
//! Explicitely deleted copy ctor, copying is not allowed!
PoolEntry(const PoolEntry&) = delete;
//! Explicitely deleted copy assignment, copying is not allowed!
PoolEntry& operator=(const PoolEntry&) = delete;
/**
* @brief The allocated memory for the variable is freed
* in the destructor.
* @details
* As the data pool is global, this dtor is only called on program exit.
* PoolEntries shall never be copied, as a copy might delete the variable
* on the heap.
*/
~PoolEntry();
/**
* \brief This is the address pointing to the allocated memory.
* @brief This is the address pointing to the allocated memory.
*/
T* address;
/**
* \brief This attribute stores the length information.
* @brief This attribute stores the length information.
*/
uint8_t length;
/**
* \brief Here, the validity information for a variable is stored.
* @brief Here, the validity information for a variable is stored.
* Every entry (single variable or vector) has one valid flag.
*/
uint8_t valid;
/**
* \brief getSize returns the array size of the entry.
* \details A single parameter has size 1.
* @brief getSize returns the array size of the entry.
* @details A single parameter has size 1.
*/
uint8_t getSize();
/**
* \brief This operation returns the size in bytes.
* \details The size is calculated by sizeof(type) * array_size.
* @brief This operation returns the size in bytes.
* @details The size is calculated by sizeof(type) * array_size.
*/
uint16_t getByteSize();
/**
* \brief This operation returns a the address pointer casted to void*.
* @brief This operation returns a the address pointer casted to void*.
*/
void* getRawData();
/**
* \brief This method allows to set the valid information of the pool entry.
* @brief This method allows to set the valid information
* of the pool entry.
*/
void setValid( uint8_t isValid );
void setValid( bool isValid );
/**
* \brief This method allows to get the valid information of the pool entry.
* @brief This method allows to get the valid information
* of the pool entry.
*/
uint8_t getValid();
bool getValid();
/**
* \brief This is a debug method that prints all values and the valid information to the screen.
* It prints all array entries in a row.
* @brief This is a debug method that prints all values and the valid
* information to the screen. It prints all array entries in a row.
*/
void print();

View File

@ -1,62 +1,57 @@
/**
* \file PoolEntryIF.h
*
* \brief This file holds the class that defines the Interface for Pool Entry elements.
*
* \date 10/18/2012
*
* \author Bastian Baetz
*/
#ifndef POOLENTRYIF_H_
#define POOLENTRYIF_H_
#include <framework/globalfunctions/Type.h>
#include <stdint.h>
#ifndef FRAMEWORK_DATAPOOL_POOLENTRYIF_H_
#define FRAMEWORK_DATAPOOL_POOLENTRYIF_H_
#include "../globalfunctions/Type.h"
#include <cstdint>
/**
* \brief This interface defines the access possibilities to a single data pool entry.
* @brief This interface defines the access possibilities to a
* single data pool entry.
* @details
* The interface provides methods to determine the size and the validity
* information of a value. It also defines a method to receive a pointer to the
* raw data content. It is mainly used by DataPool itself, but also as a
* return pointer.
*
* \details The interface provides methods to determine the size and the validity information of a value.
* It also defines a method to receive a pointer to the raw data content.
* It is mainly used by DataPool itself, but also as a return pointer.
*
* \ingroup data_pool
* @author Bastian Baetz
* @ingroup data_pool
*
*/
class PoolEntryIF {
public:
/**
* \brief This is an empty virtual destructor, as it is proposed for C++ interfaces.
* @brief This is an empty virtual destructor,
* as it is required for C++ interfaces.
*/
virtual ~PoolEntryIF() {
}
/**
* \brief getSize returns the array size of the entry. A single variable parameter has size 1.
* @brief getSize returns the array size of the entry.
* A single variable parameter has size 1.
*/
virtual uint8_t getSize() = 0;
/**
* \brief This operation returns the size in bytes, which is calculated by
* @brief This operation returns the size in bytes, which is calculated by
* sizeof(type) * array_size.
*/
virtual uint16_t getByteSize() = 0;
/**
* \brief This operation returns a the address pointer casted to void*.
* @brief This operation returns a the address pointer casted to void*.
*/
virtual void* getRawData() = 0;
/**
* \brief This method allows to set the valid information of the pool entry.
* @brief This method allows to set the valid information of the pool entry.
*/
virtual void setValid(uint8_t isValid) = 0;
virtual void setValid(bool isValid) = 0;
/**
* \brief This method allows to set the valid information of the pool entry.
* @brief This method allows to set the valid information of the pool entry.
*/
virtual uint8_t getValid() = 0;
virtual bool getValid() = 0;
/**
* \brief This is a debug method that prints all values and the valid information to the screen.
* It prints all array entries in a row.
* @brief This is a debug method that prints all values and the valid
* information to the screen. It prints all array entries in a row.
* @details
* Also displays whether the pool entry is valid or invalid.
*/
virtual void print() = 0;
/**

View File

@ -1,13 +1,16 @@
#include <framework/datapool/DataPool.h>
#include <framework/datapool/PoolEntryIF.h>
#include <framework/datapool/PoolRawAccess.h>
#include <framework/serviceinterface/ServiceInterfaceStream.h>
#include <framework/osal/Endiness.h>
#include "DataPool.h"
#include "PoolEntryIF.h"
#include "PoolRawAccess.h"
#include "../serviceinterface/ServiceInterfaceStream.h"
#include "../serialize/EndianConverter.h"
#include <cstring>
PoolRawAccess::PoolRawAccess(uint32_t set_id, uint8_t setArrayEntry,
DataSetIF* data_set, ReadWriteMode_t setReadWriteMode) :
dataPoolId(set_id), arrayEntry(setArrayEntry), valid(false), type(Type::UNKNOWN_TYPE), typeSize(
0), arraySize(0), sizeTillEnd(0), readWriteMode(setReadWriteMode) {
DataSetIF *data_set, ReadWriteMode_t setReadWriteMode) :
dataPoolId(set_id), arrayEntry(setArrayEntry), valid(false), type(
Type::UNKNOWN_TYPE), typeSize(0), arraySize(0), sizeTillEnd(0), readWriteMode(
setReadWriteMode) {
memset(value, 0, sizeof(value));
if (data_set != NULL) {
data_set->registerVariable(this);
@ -19,7 +22,7 @@ PoolRawAccess::~PoolRawAccess() {
}
ReturnValue_t PoolRawAccess::read() {
PoolEntryIF* read_out = ::dataPool.getRawData(dataPoolId);
PoolEntryIF *read_out = ::dataPool.getRawData(dataPoolId);
if (read_out != NULL) {
valid = read_out->getValid();
if (read_out->getSize() > arrayEntry) {
@ -29,7 +32,7 @@ ReturnValue_t PoolRawAccess::read() {
if (typeSize <= sizeof(value)) {
uint16_t arrayPosition = arrayEntry * typeSize;
sizeTillEnd = read_out->getByteSize() - arrayPosition;
uint8_t* ptr =
uint8_t *ptr =
&((uint8_t*) read_out->getRawData())[arrayPosition];
memcpy(value, ptr, typeSize);
return HasReturnvaluesIF::RETURN_OK;
@ -42,8 +45,8 @@ ReturnValue_t PoolRawAccess::read() {
} else {
//Error entry does not exist.
}
sif::error << "PoolRawAccess: read of DP Variable 0x" << std::hex << dataPoolId
<< std::dec << " failed." << std::endl;
sif::error << "PoolRawAccess: read of DP Variable 0x" << std::hex
<< dataPoolId << std::dec << " failed." << std::endl;
valid = INVALID;
typeSize = 0;
sizeTillEnd = 0;
@ -52,11 +55,11 @@ ReturnValue_t PoolRawAccess::read() {
}
ReturnValue_t PoolRawAccess::commit() {
PoolEntryIF* write_back = ::dataPool.getRawData(dataPoolId);
PoolEntryIF *write_back = ::dataPool.getRawData(dataPoolId);
if ((write_back != NULL) && (readWriteMode != VAR_READ)) {
write_back->setValid(valid);
uint8_t array_position = arrayEntry * typeSize;
uint8_t* ptr = &((uint8_t*) write_back->getRawData())[array_position];
uint8_t *ptr = &((uint8_t*) write_back->getRawData())[array_position];
memcpy(ptr, value, typeSize);
return HasReturnvaluesIF::RETURN_OK;
} else {
@ -68,23 +71,17 @@ uint8_t* PoolRawAccess::getEntry() {
return value;
}
ReturnValue_t PoolRawAccess::getEntryEndianSafe(uint8_t* buffer,
uint32_t* writtenBytes, uint32_t max_size) {
uint8_t* data_ptr = getEntry();
ReturnValue_t PoolRawAccess::getEntryEndianSafe(uint8_t *buffer,
size_t *writtenBytes, size_t maxSize) {
uint8_t *data_ptr = getEntry();
// debug << "PoolRawAccess::getEntry: Array position: " << index * size_of_type << " Size of T: " << (int)size_of_type << " ByteSize: " << byte_size << " Position: " << *size << std::endl;
if (typeSize == 0)
if (typeSize == 0) {
return DATA_POOL_ACCESS_FAILED;
if (typeSize > max_size)
return INCORRECT_SIZE;
#ifndef BYTE_ORDER_SYSTEM
#error BYTE_ORDER_SYSTEM not defined
#elif BYTE_ORDER_SYSTEM == LITTLE_ENDIAN
for (uint8_t count = 0; count < typeSize; count++) {
buffer[count] = data_ptr[typeSize - count - 1];
}
#elif BYTE_ORDER_SYSTEM == BIG_ENDIAN
memcpy(buffer, data_ptr, typeSize);
#endif
if (typeSize > maxSize) {
return INCORRECT_SIZE;
}
EndianConverter::convertBigEndian(buffer, data_ptr, typeSize);
*writtenBytes = typeSize;
return HasReturnvaluesIF::RETURN_OK;
}
@ -93,11 +90,11 @@ Type PoolRawAccess::getType() {
return type;
}
uint8_t PoolRawAccess::getSizeOfType() {
size_t PoolRawAccess::getSizeOfType() {
return typeSize;
}
uint8_t PoolRawAccess::getArraySize(){
size_t PoolRawAccess::getArraySize() {
return arraySize;
}
@ -109,21 +106,14 @@ PoolVariableIF::ReadWriteMode_t PoolRawAccess::getReadWriteMode() const {
return readWriteMode;
}
ReturnValue_t PoolRawAccess::setEntryFromBigEndian(const uint8_t* buffer,
uint32_t setSize) {
ReturnValue_t PoolRawAccess::setEntryFromBigEndian(const uint8_t *buffer,
size_t setSize) {
if (typeSize == setSize) {
#ifndef BYTE_ORDER_SYSTEM
#error BYTE_ORDER_SYSTEM not defined
#elif BYTE_ORDER_SYSTEM == LITTLE_ENDIAN
for (uint8_t count = 0; count < typeSize; count++) {
value[count] = buffer[typeSize - count - 1];
}
#elif BYTE_ORDER_SYSTEM == BIG_ENDIAN
memcpy(value, buffer, typeSize);
#endif
EndianConverter::convertBigEndian(value, buffer, typeSize);
return HasReturnvaluesIF::RETURN_OK;
} else {
sif::error << "PoolRawAccess::setEntryFromBigEndian: Illegal sizes: Internal"
sif::error
<< "PoolRawAccess::setEntryFromBigEndian: Illegal sizes: Internal"
<< (uint32_t) typeSize << ", Requested: " << setSize
<< std::endl;
return INCORRECT_SIZE;
@ -141,25 +131,24 @@ void PoolRawAccess::setValid(uint8_t valid) {
this->valid = valid;
}
uint16_t PoolRawAccess::getSizeTillEnd() const {
size_t PoolRawAccess::getSizeTillEnd() const {
return sizeTillEnd;
}
ReturnValue_t PoolRawAccess::serialize(uint8_t** buffer, uint32_t* size,
const uint32_t max_size, bool bigEndian) const {
if (typeSize + *size <= max_size) {
if (bigEndian) {
#ifndef BYTE_ORDER_SYSTEM
#error BYTE_ORDER_SYSTEM not defined
#elif BYTE_ORDER_SYSTEM == LITTLE_ENDIAN
for (uint8_t count = 0; count < typeSize; count++) {
(*buffer)[count] = value[typeSize - count - 1];
}
#elif BYTE_ORDER_SYSTEM == BIG_ENDIAN
memcpy(*buffer, value, typeSize);
#endif
} else {
ReturnValue_t PoolRawAccess::serialize(uint8_t **buffer, size_t *size,
size_t maxSize, Endianness streamEndianness) const {
if (typeSize + *size <= maxSize) {
switch (streamEndianness) {
case (Endianness::BIG):
EndianConverter::convertBigEndian(*buffer, value, typeSize);
break;
case (Endianness::LITTLE):
EndianConverter::convertLittleEndian(*buffer, value, typeSize);
break;
default:
case (Endianness::MACHINE):
memcpy(*buffer, value, typeSize);
break;
}
*size += typeSize;
(*buffer) += typeSize;
@ -169,28 +158,27 @@ ReturnValue_t PoolRawAccess::serialize(uint8_t** buffer, uint32_t* size,
}
}
uint32_t PoolRawAccess::getSerializedSize() const {
size_t PoolRawAccess::getSerializedSize() const {
return typeSize;
}
ReturnValue_t PoolRawAccess::deSerialize(const uint8_t** buffer, int32_t* size,
bool bigEndian) {
*size -= typeSize;
if (*size >= 0) {
ReturnValue_t PoolRawAccess::deSerialize(const uint8_t **buffer, size_t *size,
Endianness streamEndianness) {
if (bigEndian) {
#ifndef BYTE_ORDER_SYSTEM
#error BYTE_ORDER_SYSTEM not defined
#elif BYTE_ORDER_SYSTEM == LITTLE_ENDIAN
for (uint8_t count = 0; count < typeSize; count++) {
value[count] = (*buffer)[typeSize - count - 1];
}
#elif BYTE_ORDER_SYSTEM == BIG_ENDIAN
memcpy(value, *buffer, typeSize);
#endif
} else {
if (*size >= typeSize) {
switch (streamEndianness) {
case (Endianness::BIG):
EndianConverter::convertBigEndian(value, *buffer, typeSize);
break;
case (Endianness::LITTLE):
EndianConverter::convertLittleEndian(value, *buffer, typeSize);
break;
default:
case (Endianness::MACHINE):
memcpy(value, *buffer, typeSize);
break;
}
*size -= typeSize;
*buffer += typeSize;
return HasReturnvaluesIF::RETURN_OK;
} else {

View File

@ -1,8 +1,8 @@
#ifndef POOLRAWACCESS_H_
#define POOLRAWACCESS_H_
#include <framework/datapool/DataSetIF.h>
#include <framework/datapool/PoolVariableIF.h>
#include "DataSetIF.h"
#include "PoolVariableIF.h"
/**
* This class allows accessing Data Pool variables as raw bytes.
@ -32,15 +32,15 @@ private:
/**
* \brief This value contains the size of the data pool entry in bytes.
*/
uint8_t typeSize;
size_t typeSize;
/**
* The size of the DP array (single values return 1)
*/
uint8_t arraySize;
size_t arraySize;
/**
* The size (in bytes) from the selected entry till the end of this DataPool variable.
*/
uint16_t sizeTillEnd;
size_t sizeTillEnd;
/**
* \brief The information whether the class is read-write or read-only is stored here.
*/
@ -70,7 +70,7 @@ public:
static const ReturnValue_t DATA_POOL_ACCESS_FAILED = MAKE_RETURN_CODE(0x02);
uint8_t value[RAW_MAX_SIZE];
PoolRawAccess(uint32_t data_pool_id, uint8_t arrayEntry,
DataSetIF* data_set, ReadWriteMode_t setReadWriteMode =
DataSetIF *data_set, ReadWriteMode_t setReadWriteMode =
PoolVariableIF::VAR_READ);
/**
* \brief The classes destructor is empty. If commit() was not called, the local value is
@ -90,15 +90,15 @@ public:
* \details It makes use of the getEntry call of this function, but additionally flips the
* bytes to big endian, which is the default for external communication (as House-
* keeping telemetry). To achieve this, the data is copied directly to the passed
* buffer, if it fits in the given max_size.
* buffer, if it fits in the given maxSize.
* \param buffer A pointer to a buffer to write to
* \param writtenBytes The number of bytes written is returned with this value.
* \param max_size The maximum size that the function may write to buffer.
* \param maxSize The maximum size that the function may write to buffer.
* \return - \c RETURN_OK if entry could be acquired
* - \c RETURN_FAILED else.
*/
ReturnValue_t getEntryEndianSafe(uint8_t* buffer, uint32_t* size,
uint32_t max_size);
ReturnValue_t getEntryEndianSafe(uint8_t *buffer, size_t *size,
size_t maxSize);
/**
* With this method, the content can be set from a big endian buffer safely.
* @param buffer Pointer to the data to set
@ -106,8 +106,8 @@ public:
* @return - \c RETURN_OK on success
* - \c RETURN_FAILED on failure
*/
ReturnValue_t setEntryFromBigEndian(const uint8_t* buffer,
uint32_t setSize);
ReturnValue_t setEntryFromBigEndian(const uint8_t *buffer,
size_t setSize);
/**
* \brief This operation returns the type of the entry currently stored.
*/
@ -115,12 +115,12 @@ public:
/**
* \brief This operation returns the size of the entry currently stored.
*/
uint8_t getSizeOfType();
size_t getSizeOfType();
/**
*
* @return the size of the datapool array
*/
uint8_t getArraySize();
size_t getArraySize();
/**
* \brief This operation returns the data pool id of the variable.
*/
@ -138,15 +138,15 @@ public:
/**
* Getter for the remaining size.
*/
uint16_t getSizeTillEnd() const;
size_t getSizeTillEnd() const;
ReturnValue_t serialize(uint8_t** buffer, uint32_t* size,
const uint32_t max_size, bool bigEndian) const;
ReturnValue_t serialize(uint8_t **buffer, size_t *size, size_t maxSize,
Endianness streamEndianness) const override;
uint32_t getSerializedSize() const;
size_t getSerializedSize() const override;
ReturnValue_t deSerialize(const uint8_t** buffer, int32_t* size,
bool bigEndian);
ReturnValue_t deSerialize(const uint8_t **buffer, size_t *size,
Endianness streamEndianness) override;
};
#endif /* POOLRAWACCESS_H_ */

View File

@ -1,8 +1,8 @@
#ifndef POOLVARLIST_H_
#define POOLVARLIST_H_
#include <framework/datapool/PoolVariable.h>
#include <framework/datapool/PoolVariableIF.h>
#include "PoolVariable.h"
#include "PoolVariableIF.h"
template <class T, uint8_t n_var>
class PoolVarList {
private:

View File

@ -11,11 +11,11 @@
#ifndef POOLVARIABLE_H_
#define POOLVARIABLE_H_
#include <framework/datapool/DataSetIF.h>
#include <framework/datapool/PoolEntry.h>
#include <framework/datapool/PoolVariableIF.h>
#include <framework/serialize/SerializeAdapter.h>
#include <framework/serviceinterface/ServiceInterfaceStream.h>
#include "DataSetIF.h"
#include "PoolEntry.h"
#include "PoolVariableIF.h"
#include "../serialize/SerializeAdapter.h"
#include "../serviceinterface/ServiceInterfaceStream.h"
template<typename T, uint8_t n_var> class PoolVarList;
@ -58,7 +58,7 @@ protected:
* The operation does NOT provide any mutual exclusive protection by itself.
*/
ReturnValue_t read() {
PoolEntry<T>* read_out = ::dataPool.getData<T>(dataPoolId, 1);
PoolEntry<T> *read_out = ::dataPool.getData < T > (dataPoolId, 1);
if (read_out != NULL) {
valid = read_out->valid;
value = *(read_out->address);
@ -79,7 +79,7 @@ protected:
*
*/
ReturnValue_t commit() {
PoolEntry<T>* write_back = ::dataPool.getData<T>(dataPoolId, 1);
PoolEntry<T> *write_back = ::dataPool.getData < T > (dataPoolId, 1);
if ((write_back != NULL) && (readWriteMode != VAR_READ)) {
write_back->valid = valid;
*(write_back->address) = value;
@ -115,7 +115,7 @@ public:
* \param setWritable If this flag is set to true, changes in the value attribute can be
* written back to the data pool, otherwise not.
*/
PoolVariable(uint32_t set_id, DataSetIF* dataSet,
PoolVariable(uint32_t set_id, DataSetIF *dataSet,
ReadWriteMode_t setReadWriteMode) :
dataPoolId(set_id), valid(PoolVariableIF::INVALID), readWriteMode(
setReadWriteMode), value(0) {
@ -126,7 +126,7 @@ public:
/**
* Copy ctor to copy classes containing Pool Variables.
*/
PoolVariable(const PoolVariable& rhs) :
PoolVariable(const PoolVariable &rhs) :
dataPoolId(rhs.dataPoolId), valid(rhs.valid), readWriteMode(
rhs.readWriteMode), value(rhs.value) {
}
@ -184,29 +184,29 @@ public:
return value;
}
PoolVariable<T> &operator=(T newValue) {
PoolVariable<T>& operator=(T newValue) {
value = newValue;
return *this;
}
PoolVariable<T> &operator=(PoolVariable<T> newPoolVariable) {
PoolVariable<T>& operator=(PoolVariable<T> newPoolVariable) {
value = newPoolVariable.value;
return *this;
}
virtual ReturnValue_t serialize(uint8_t** buffer, uint32_t* size,
const uint32_t max_size, bool bigEndian) const {
return SerializeAdapter<T>::serialize(&value, buffer, size, max_size,
bigEndian);
virtual ReturnValue_t serialize(uint8_t **buffer, size_t *size,
size_t maxSize, Endianness streamEndianness) const override {
return SerializeAdapter::serialize<T>(&value, buffer, size, maxSize,
streamEndianness);
}
virtual uint32_t getSerializedSize() const {
return SerializeAdapter<T>::getSerializedSize(&value);
virtual size_t getSerializedSize() const override {
return SerializeAdapter::getSerializedSize(&value);
}
virtual ReturnValue_t deSerialize(const uint8_t** buffer, int32_t* size,
bool bigEndian) {
return SerializeAdapter<T>::deSerialize(&value, buffer, size, bigEndian);
virtual ReturnValue_t deSerialize(const uint8_t **buffer, size_t *size,
Endianness streamEndianness) override {
return SerializeAdapter::deSerialize(&value, buffer, size, streamEndianness);
}
};

View File

@ -11,8 +11,8 @@
#ifndef POOLVARIABLEIF_H_
#define POOLVARIABLEIF_H_
#include <framework/returnvalues/HasReturnvaluesIF.h>
#include <framework/serialize/SerializeIF.h>
#include "../returnvalues/HasReturnvaluesIF.h"
#include "../serialize/SerializeIF.h"
/**
* \brief This interface is used to control local data pool variable representations.

View File

@ -11,11 +11,11 @@
#ifndef POOLVECTOR_H_
#define POOLVECTOR_H_
#include <framework/datapool/DataSetIF.h>
#include <framework/datapool/PoolEntry.h>
#include <framework/datapool/PoolVariableIF.h>
#include <framework/serialize/SerializeAdapter.h>
#include <framework/serviceinterface/ServiceInterfaceStream.h>
#include "DataSetIF.h"
#include "PoolEntry.h"
#include "PoolVariableIF.h"
#include "../serialize/SerializeAdapter.h"
#include "../serviceinterface/ServiceInterfaceStream.h"
/**
* \brief This is the access class for array-type data pool entries.
@ -197,13 +197,13 @@ public:
return *this;
}
virtual ReturnValue_t serialize(uint8_t** buffer, uint32_t* size,
const uint32_t max_size, bool bigEndian) const {
virtual ReturnValue_t serialize(uint8_t** buffer, size_t* size,
size_t maxSize, Endianness streamEndianness) const {
uint16_t i;
ReturnValue_t result;
for (i = 0; i < vector_size; i++) {
result = SerializeAdapter<T>::serialize(&(value[i]), buffer, size,
max_size, bigEndian);
result = SerializeAdapter::serialize(&(value[i]), buffer, size,
maxSize, streamEndianness);
if (result != HasReturnvaluesIF::RETURN_OK) {
return result;
}
@ -211,17 +211,17 @@ public:
return result;
}
virtual uint32_t getSerializedSize() const {
return vector_size * SerializeAdapter<T>::getSerializedSize(value);
virtual size_t getSerializedSize() const {
return vector_size * SerializeAdapter::getSerializedSize(value);
}
virtual ReturnValue_t deSerialize(const uint8_t** buffer, int32_t* size,
bool bigEndian) {
virtual ReturnValue_t deSerialize(const uint8_t** buffer, size_t* size,
Endianness streamEndianness) {
uint16_t i;
ReturnValue_t result;
for (i = 0; i < vector_size; i++) {
result = SerializeAdapter<T>::deSerialize(&(value[i]), buffer, size,
bigEndian);
result = SerializeAdapter::deSerialize(&(value[i]), buffer, size,
streamEndianness);
if (result != HasReturnvaluesIF::RETURN_OK) {
return result;
}

View File

@ -8,7 +8,7 @@
#ifndef ACCEPTSDEVICERESPONSESIF_H_
#define ACCEPTSDEVICERESPONSESIF_H_
#include <framework/ipc/MessageQueueSenderIF.h>
#include "../ipc/MessageQueueSenderIF.h"
class AcceptsDeviceResponsesIF {
public:

View File

@ -1,4 +1,4 @@
#include <framework/devicehandlers/AssemblyBase.h>
#include "AssemblyBase.h"
AssemblyBase::AssemblyBase(object_id_t objectId, object_id_t parentId,
uint16_t commandQueueDepth) :

View File

@ -1,9 +1,9 @@
#ifndef ASSEMBLYBASE_H_
#define ASSEMBLYBASE_H_
#include <framework/container/FixedArrayList.h>
#include <framework/devicehandlers/DeviceHandlerBase.h>
#include <framework/subsystem/SubsystemBase.h>
#include "../container/FixedArrayList.h"
#include "DeviceHandlerBase.h"
#include "../subsystem/SubsystemBase.h"
class AssemblyBase: public SubsystemBase {
public:

View File

@ -1,6 +1,6 @@
#include <framework/subsystem/SubsystemBase.h>
#include <framework/devicehandlers/ChildHandlerBase.h>
#include <framework/subsystem/SubsystemBase.h>
#include "../subsystem/SubsystemBase.h"
#include "ChildHandlerBase.h"
#include "../subsystem/SubsystemBase.h"
ChildHandlerBase::ChildHandlerBase(object_id_t setObjectId,
object_id_t deviceCommunication, CookieIF * comCookie,
@ -35,7 +35,7 @@ ReturnValue_t ChildHandlerBase::initialize() {
parent->registerChild(getObjectId());
}
healthHelper.setParentQeueue(parentQueue);
healthHelper.setParentQueue(parentQueue);
modeHelper.setParentQueue(parentQueue);

View File

@ -1,8 +1,8 @@
#ifndef PAYLOADHANDLERBASE_H_
#define PAYLOADHANDLERBASE_H_
#include <framework/devicehandlers/ChildHandlerFDIR.h>
#include <framework/devicehandlers/DeviceHandlerBase.h>
#include "ChildHandlerFDIR.h"
#include "DeviceHandlerBase.h"
class ChildHandlerBase: public DeviceHandlerBase {
public:

View File

@ -1,4 +1,4 @@
#include <framework/devicehandlers/ChildHandlerFDIR.h>
#include "ChildHandlerFDIR.h"
ChildHandlerFDIR::ChildHandlerFDIR(object_id_t owner, object_id_t faultTreeParent, uint32_t recoveryCount) :
DeviceHandlerFailureIsolation(owner, faultTreeParent) {

View File

@ -1,7 +1,7 @@
#ifndef FRAMEWORK_DEVICEHANDLERS_CHILDHANDLERFDIR_H_
#define FRAMEWORK_DEVICEHANDLERS_CHILDHANDLERFDIR_H_
#include <framework/devicehandlers/DeviceHandlerFailureIsolation.h>
#include "DeviceHandlerFailureIsolation.h"
/**
* Very simple extension to normal FDIR.

View File

@ -1,8 +1,8 @@
#ifndef DEVICECOMMUNICATIONIF_H_
#define DEVICECOMMUNICATIONIF_H_
#include <framework/devicehandlers/CookieIF.h>
#include <framework/returnvalues/HasReturnvaluesIF.h>
#include "CookieIF.h"
#include "../returnvalues/HasReturnvaluesIF.h"
#include <cstddef>
/**
* @defgroup interfaces Interfaces

View File

@ -1,16 +1,16 @@
#include <framework/devicehandlers/DeviceHandlerBase.h>
#include <framework/objectmanager/ObjectManager.h>
#include <framework/storagemanager/StorageManagerIF.h>
#include <framework/thermal/ThermalComponentIF.h>
#include <framework/devicehandlers/AcceptsDeviceResponsesIF.h>
#include "DeviceHandlerBase.h"
#include "../objectmanager/ObjectManager.h"
#include "../storagemanager/StorageManagerIF.h"
#include "../thermal/ThermalComponentIF.h"
#include "AcceptsDeviceResponsesIF.h"
#include <framework/datapool/DataSet.h>
#include <framework/datapool/PoolVariable.h>
#include <framework/devicehandlers/DeviceTmReportingWrapper.h>
#include <framework/globalfunctions/CRC.h>
#include <framework/subsystem/SubsystemBase.h>
#include <framework/ipc/QueueFactory.h>
#include <framework/serviceinterface/ServiceInterfaceStream.h>
#include "../datapool/DataSet.h"
#include "../datapool/PoolVariable.h"
#include "DeviceTmReportingWrapper.h"
#include "../globalfunctions/CRC.h"
#include "../subsystem/SubsystemBase.h"
#include "../ipc/QueueFactory.h"
#include "../serviceinterface/ServiceInterfaceStream.h"
#include <iomanip>
@ -236,7 +236,7 @@ void DeviceHandlerBase::readCommandQueue() {
return;
}
replyReturnvalueToCommand(CommandMessage::UNKNOW_COMMAND);
replyReturnvalueToCommand(CommandMessage::UNKNOWN_COMMAND);
}
@ -1085,7 +1085,7 @@ ReturnValue_t DeviceHandlerBase::handleDeviceHandlerMessage(
void DeviceHandlerBase::setParentQueue(MessageQueueId_t parentQueueId) {
modeHelper.setParentQueue(parentQueueId);
healthHelper.setParentQeueue(parentQueueId);
healthHelper.setParentQueue(parentQueueId);
}
bool DeviceHandlerBase::isAwaitingReply() {
@ -1149,7 +1149,7 @@ void DeviceHandlerBase::handleDeviceTM(SerializeIF* data,
}
ReturnValue_t DeviceHandlerBase::executeAction(ActionId_t actionId,
MessageQueueId_t commandedBy, const uint8_t* data, uint32_t size) {
MessageQueueId_t commandedBy, const uint8_t* data, size_t size) {
ReturnValue_t result = acceptExternalDeviceCommands();
if (result != HasReturnvaluesIF::RETURN_OK) {
return result;

View File

@ -1,22 +1,22 @@
#ifndef DEVICEHANDLERBASE_H_
#define DEVICEHANDLERBASE_H_
#include <framework/objectmanager/SystemObject.h>
#include <framework/tasks/ExecutableObjectIF.h>
#include <framework/devicehandlers/DeviceHandlerIF.h>
#include <framework/returnvalues/HasReturnvaluesIF.h>
#include <framework/action/HasActionsIF.h>
#include <framework/datapool/PoolVariableIF.h>
#include <framework/devicehandlers/DeviceCommunicationIF.h>
#include <framework/modes/HasModesIF.h>
#include <framework/power/PowerSwitchIF.h>
#include <framework/ipc/MessageQueueIF.h>
#include "../objectmanager/SystemObject.h"
#include "../tasks/ExecutableObjectIF.h"
#include "DeviceHandlerIF.h"
#include "../returnvalues/HasReturnvaluesIF.h"
#include "../action/HasActionsIF.h"
#include "../datapool/PoolVariableIF.h"
#include "DeviceCommunicationIF.h"
#include "../modes/HasModesIF.h"
#include "../power/PowerSwitchIF.h"
#include "../ipc/MessageQueueIF.h"
#include <framework/action/ActionHelper.h>
#include <framework/health/HealthHelper.h>
#include <framework/parameters/ParameterHelper.h>
#include <framework/datapool/HkSwitchHelper.h>
#include <framework/devicehandlers/DeviceHandlerFailureIsolation.h>
#include "../action/ActionHelper.h"
#include "../health/HealthHelper.h"
#include "../parameters/ParameterHelper.h"
#include "../datapool/HkSwitchHelper.h"
#include "DeviceHandlerFailureIsolation.h"
#include <map>
@ -484,7 +484,7 @@ public:
/** @brief Implementation required for HasActionIF */
ReturnValue_t executeAction(ActionId_t actionId,
MessageQueueId_t commandedBy, const uint8_t* data,
uint32_t size) override;
size_t size) override;
Mode_t getTransitionSourceMode() const;
Submode_t getTransitionSourceSubMode() const;

View File

@ -1,9 +1,9 @@
#include <framework/devicehandlers/DeviceHandlerBase.h>
#include <framework/devicehandlers/DeviceHandlerFailureIsolation.h>
#include <framework/health/HealthTableIF.h>
#include <framework/power/Fuse.h>
#include <framework/serviceinterface/ServiceInterfaceStream.h>
#include <framework/thermal/ThermalComponentIF.h>
#include "DeviceHandlerBase.h"
#include "DeviceHandlerFailureIsolation.h"
#include "../health/HealthTableIF.h"
#include "../power/Fuse.h"
#include "../serviceinterface/ServiceInterfaceStream.h"
#include "../thermal/ThermalComponentIF.h"
object_id_t DeviceHandlerFailureIsolation::powerConfirmationId = 0;

View File

@ -1,8 +1,8 @@
#ifndef FRAMEWORK_DEVICEHANDLERS_DEVICEHANDLERFAILUREISOLATION_H_
#define FRAMEWORK_DEVICEHANDLERS_DEVICEHANDLERFAILUREISOLATION_H_
#include <framework/fdir/FaultCounter.h>
#include <framework/fdir/FailureIsolationBase.h>
#include "../fdir/FaultCounter.h"
#include "../fdir/FailureIsolationBase.h"
namespace Factory{
void setStaticFrameworkObjectIds();
}

View File

@ -1,11 +1,11 @@
#ifndef DEVICEHANDLERIF_H_
#define DEVICEHANDLERIF_H_
#include <framework/action/HasActionsIF.h>
#include <framework/devicehandlers/DeviceHandlerMessage.h>
#include <framework/events/Event.h>
#include <framework/modes/HasModesIF.h>
#include <framework/ipc/MessageQueueSenderIF.h>
#include "../action/HasActionsIF.h"
#include "DeviceHandlerMessage.h"
#include "../events/Event.h"
#include "../modes/HasModesIF.h"
#include "../ipc/MessageQueueSenderIF.h"
/**
* @brief This is the Interface used to communicate with a device handler.

View File

@ -1,6 +1,6 @@
#include <framework/objectmanager/ObjectManagerIF.h>
#include <framework/devicehandlers/DeviceHandlerMessage.h>
#include <framework/objectmanager/ObjectManagerIF.h>
#include "../objectmanager/ObjectManagerIF.h"
#include "DeviceHandlerMessage.h"
#include "../objectmanager/ObjectManagerIF.h"
DeviceHandlerMessage::DeviceHandlerMessage() {
}

View File

@ -1,10 +1,10 @@
#ifndef DEVICEHANDLERMESSAGE_H_
#define DEVICEHANDLERMESSAGE_H_
#include <framework/action/ActionMessage.h>
#include <framework/ipc/CommandMessage.h>
#include <framework/objectmanager/SystemObjectIF.h>
#include <framework/storagemanager/StorageManagerIF.h>
#include "../action/ActionMessage.h"
#include "../ipc/CommandMessage.h"
#include "../objectmanager/SystemObjectIF.h"
#include "../storagemanager/StorageManagerIF.h"
//SHOULDDO: rework the static constructors to name the type of command they are building, maybe even hide setting the commandID.
/**

View File

@ -1,6 +1,6 @@
#include <framework/serialize/SerializeAdapter.h>
#include <framework/devicehandlers/DeviceTmReportingWrapper.h>
#include <framework/serialize/SerializeAdapter.h>
#include "../serialize/SerializeAdapter.h"
#include "DeviceTmReportingWrapper.h"
#include "../serialize/SerializeAdapter.h"
DeviceTmReportingWrapper::DeviceTmReportingWrapper(object_id_t objectId,
ActionId_t actionId, SerializeIF* data) :
@ -12,35 +12,35 @@ DeviceTmReportingWrapper::~DeviceTmReportingWrapper() {
}
ReturnValue_t DeviceTmReportingWrapper::serialize(uint8_t** buffer,
uint32_t* size, const uint32_t max_size, bool bigEndian) const {
ReturnValue_t result = SerializeAdapter<object_id_t>::serialize(&objectId,
buffer, size, max_size, bigEndian);
size_t* size, size_t maxSize, Endianness streamEndianness) const {
ReturnValue_t result = SerializeAdapter::serialize(&objectId,
buffer, size, maxSize, streamEndianness);
if (result != HasReturnvaluesIF::RETURN_OK) {
return result;
}
result = SerializeAdapter<ActionId_t>::serialize(&actionId, buffer,
size, max_size, bigEndian);
result = SerializeAdapter::serialize(&actionId, buffer,
size, maxSize, streamEndianness);
if (result != HasReturnvaluesIF::RETURN_OK) {
return result;
}
return data->serialize(buffer, size, max_size, bigEndian);
return data->serialize(buffer, size, maxSize, streamEndianness);
}
uint32_t DeviceTmReportingWrapper::getSerializedSize() const {
size_t DeviceTmReportingWrapper::getSerializedSize() const {
return sizeof(objectId) + sizeof(ActionId_t) + data->getSerializedSize();
}
ReturnValue_t DeviceTmReportingWrapper::deSerialize(const uint8_t** buffer,
int32_t* size, bool bigEndian) {
ReturnValue_t result = SerializeAdapter<object_id_t>::deSerialize(&objectId,
buffer, size, bigEndian);
size_t* size, Endianness streamEndianness) {
ReturnValue_t result = SerializeAdapter::deSerialize(&objectId,
buffer, size, streamEndianness);
if (result != HasReturnvaluesIF::RETURN_OK) {
return result;
}
result = SerializeAdapter<ActionId_t>::deSerialize(&actionId, buffer,
size, bigEndian);
result = SerializeAdapter::deSerialize(&actionId, buffer,
size, streamEndianness);
if (result != HasReturnvaluesIF::RETURN_OK) {
return result;
}
return data->deSerialize(buffer, size, bigEndian);
return data->deSerialize(buffer, size, streamEndianness);
}

View File

@ -1,9 +1,9 @@
#ifndef DEVICETMREPORTINGWRAPPER_H_
#define DEVICETMREPORTINGWRAPPER_H_
#include <framework/action/HasActionsIF.h>
#include <framework/objectmanager/SystemObjectIF.h>
#include <framework/serialize/SerializeIF.h>
#include "../action/HasActionsIF.h"
#include "../objectmanager/SystemObjectIF.h"
#include "../serialize/SerializeIF.h"
class DeviceTmReportingWrapper: public SerializeIF {
public:
@ -11,13 +11,13 @@ public:
SerializeIF *data);
virtual ~DeviceTmReportingWrapper();
virtual ReturnValue_t serialize(uint8_t** buffer, uint32_t* size,
const uint32_t max_size, bool bigEndian) const;
virtual ReturnValue_t serialize(uint8_t** buffer, size_t* size,
size_t maxSize, Endianness streamEndianness) const override;
virtual uint32_t getSerializedSize() const;
virtual size_t getSerializedSize() const override;
virtual ReturnValue_t deSerialize(const uint8_t** buffer, int32_t* size,
bool bigEndian);
virtual ReturnValue_t deSerialize(const uint8_t** buffer, size_t* size,
Endianness streamEndianness) override;
private:
object_id_t objectId;
ActionId_t actionId;

View File

@ -5,8 +5,8 @@
* @author baetz
*/
#include <framework/devicehandlers/FixedSequenceSlot.h>
#include <framework/objectmanager/SystemObjectIF.h>
#include "FixedSequenceSlot.h"
#include "../objectmanager/SystemObjectIF.h"
#include <cstddef>
FixedSequenceSlot::FixedSequenceSlot(object_id_t handlerId, uint32_t setTime,

View File

@ -8,8 +8,8 @@
#ifndef FIXEDSEQUENCESLOT_H_
#define FIXEDSEQUENCESLOT_H_
#include <framework/objectmanager/ObjectManagerIF.h>
#include <framework/tasks/ExecutableObjectIF.h>
#include "../objectmanager/ObjectManagerIF.h"
#include "../tasks/ExecutableObjectIF.h"
class PeriodicTaskIF;
/**

View File

@ -1,5 +1,5 @@
#include <framework/devicehandlers/FixedSlotSequence.h>
#include <framework/serviceinterface/ServiceInterfaceStream.h>
#include "FixedSlotSequence.h"
#include "../serviceinterface/ServiceInterfaceStream.h"
FixedSlotSequence::FixedSlotSequence(uint32_t setLengthMs) :
lengthMs(setLengthMs) {

View File

@ -1,8 +1,8 @@
#ifndef FRAMEWORK_DEVICEHANDLERS_FIXEDSLOTSEQUENCE_H_
#define FRAMEWORK_DEVICEHANDLERS_FIXEDSLOTSEQUENCE_H_
#include <framework/devicehandlers/FixedSequenceSlot.h>
#include <framework/objectmanager/SystemObject.h>
#include "FixedSequenceSlot.h"
#include "../objectmanager/SystemObject.h"
#include <set>
/**

View File

@ -1,5 +1,5 @@
#include <framework/devicehandlers/HealthDevice.h>
#include <framework/ipc/QueueFactory.h>
#include "HealthDevice.h"
#include "../ipc/QueueFactory.h"
HealthDevice::HealthDevice(object_id_t setObjectId,
MessageQueueId_t parentQueue) :
@ -38,7 +38,7 @@ MessageQueueId_t HealthDevice::getCommandQueue() const {
}
void HealthDevice::setParentQueue(MessageQueueId_t parentQueue) {
healthHelper.setParentQeueue(parentQueue);
healthHelper.setParentQueue(parentQueue);
}
bool HealthDevice::hasHealthChanged() {

View File

@ -1,11 +1,11 @@
#ifndef HEALTHDEVICE_H_
#define HEALTHDEVICE_H_
#include <framework/health/HasHealthIF.h>
#include <framework/health/HealthHelper.h>
#include <framework/objectmanager/SystemObject.h>
#include <framework/tasks/ExecutableObjectIF.h>
#include <framework/ipc/MessageQueueIF.h>
#include "../health/HasHealthIF.h"
#include "../health/HealthHelper.h"
#include "../objectmanager/SystemObject.h"
#include "../tasks/ExecutableObjectIF.h"
#include "../ipc/MessageQueueIF.h"
class HealthDevice: public SystemObject,
public ExecutableObjectIF,

View File

@ -1,4 +1,4 @@
#include <framework/events/Event.h>
#include "Event.h"
namespace EVENT {
EventId_t getEventId(Event event) {
return (event & 0xFFFF);

View File

@ -2,7 +2,7 @@
#define EVENTOBJECT_EVENT_H_
#include <stdint.h>
#include <framework/events/fwSubsystemIdRanges.h>
#include "fwSubsystemIdRanges.h"
//could be move to more suitable location
#include <config/tmtc/subsystemIdRanges.h>

View File

@ -1,8 +1,8 @@
#include <framework/events/EventManager.h>
#include <framework/events/EventMessage.h>
#include <framework/serviceinterface/ServiceInterfaceStream.h>
#include <framework/ipc/QueueFactory.h>
#include <framework/ipc/MutexFactory.h>
#include "EventManager.h"
#include "EventMessage.h"
#include "../serviceinterface/ServiceInterfaceStream.h"
#include "../ipc/QueueFactory.h"
#include "../ipc/MutexFactory.h"
const uint16_t EventManager::POOL_SIZES[N_POOLS] = {
@ -147,7 +147,7 @@ void EventManager::printEvent(EventMessage* message) {
#endif
void EventManager::lockMutex() {
mutex->lockMutex(MutexIF::NO_TIMEOUT);
mutex->lockMutex(MutexIF::BLOCKING);
}
void EventManager::unlockMutex() {

Some files were not shown because too many files have changed in this diff Show More