Merge remote-tracking branch 'upstream/master' into mueller_StoreAccessor
This commit is contained in:
commit
9a06cb846c
@ -1,9 +1,9 @@
|
|||||||
#include <framework/action/ActionHelper.h>
|
#include "ActionHelper.h"
|
||||||
#include <framework/action/HasActionsIF.h>
|
#include "HasActionsIF.h"
|
||||||
#include <framework/objectmanager/ObjectManagerIF.h>
|
#include "../objectmanager/ObjectManagerIF.h"
|
||||||
|
|
||||||
ActionHelper::ActionHelper(HasActionsIF* setOwner, MessageQueueIF* useThisQueue) :
|
ActionHelper::ActionHelper(HasActionsIF* setOwner, MessageQueueIF* useThisQueue) :
|
||||||
owner(setOwner), queueToUse(useThisQueue), ipcStore(
|
owner(setOwner), queueToUse(useThisQueue), ipcStore(nullptr) {
|
||||||
NULL) {
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ActionHelper::~ActionHelper() {
|
ActionHelper::~ActionHelper() {
|
||||||
@ -16,16 +16,18 @@ ReturnValue_t ActionHelper::handleActionMessage(CommandMessage* command) {
|
|||||||
ActionMessage::getStoreId(command));
|
ActionMessage::getStoreId(command));
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
} else {
|
} else {
|
||||||
return CommandMessage::UNKNOW_COMMAND;
|
return CommandMessage::UNKNOWN_COMMAND;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t ActionHelper::initialize(MessageQueueIF* queueToUse_) {
|
ReturnValue_t ActionHelper::initialize(MessageQueueIF* queueToUse_) {
|
||||||
ipcStore = objectManager->get<StorageManagerIF>(objects::IPC_STORE);
|
ipcStore = objectManager->get<StorageManagerIF>(objects::IPC_STORE);
|
||||||
if (ipcStore == NULL) {
|
if (ipcStore == nullptr) {
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
}
|
}
|
||||||
|
if(queueToUse_ != nullptr) {
|
||||||
setQueueToUse(queueToUse_);
|
setQueueToUse(queueToUse_);
|
||||||
|
}
|
||||||
|
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
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;
|
CommandMessage reply;
|
||||||
store_address_t storeAddress;
|
store_address_t storeAddress;
|
||||||
uint8_t *dataPtr;
|
uint8_t *dataPtr;
|
||||||
uint32_t maxSize = data->getSerializedSize();
|
size_t maxSize = data->getSerializedSize();
|
||||||
if (maxSize == 0) {
|
if (maxSize == 0) {
|
||||||
//No error, there's simply nothing to report.
|
//No error, there's simply nothing to report.
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
uint32_t size = 0;
|
size_t size = 0;
|
||||||
ReturnValue_t result = ipcStore->getFreeElement(&storeAddress, maxSize,
|
ReturnValue_t result = ipcStore->getFreeElement(&storeAddress, maxSize,
|
||||||
&dataPtr);
|
&dataPtr);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
result = data->serialize(&dataPtr, &size, maxSize, true);
|
result = data->serialize(&dataPtr, &size, maxSize, SerializeIF::Endianness::BIG);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
ipcStore->deleteData(storeAddress);
|
ipcStore->deleteData(storeAddress);
|
||||||
return result;
|
return result;
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
#ifndef ACTIONHELPER_H_
|
#ifndef ACTIONHELPER_H_
|
||||||
#define ACTIONHELPER_H_
|
#define ACTIONHELPER_H_
|
||||||
|
|
||||||
#include <framework/action/ActionMessage.h>
|
#include "ActionMessage.h"
|
||||||
#include <framework/serialize/SerializeIF.h>
|
#include "../serialize/SerializeIF.h"
|
||||||
#include <framework/ipc/MessageQueueIF.h>
|
#include "../ipc/MessageQueueIF.h"
|
||||||
/**
|
/**
|
||||||
* \brief Action Helper is a helper class which handles action messages
|
* \brief Action Helper is a helper class which handles action messages
|
||||||
*
|
*
|
||||||
@ -35,10 +35,10 @@ public:
|
|||||||
ReturnValue_t handleActionMessage(CommandMessage* command);
|
ReturnValue_t handleActionMessage(CommandMessage* command);
|
||||||
/**
|
/**
|
||||||
* Helper initialize function. Must be called before use of any other helper function
|
* 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
|
* @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.
|
* Function to be called from the owner to send a step message. Success or failure will be determined by the result value.
|
||||||
*
|
*
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include <framework/action/ActionMessage.h>
|
#include "ActionMessage.h"
|
||||||
#include <framework/objectmanager/ObjectManagerIF.h>
|
#include "../objectmanager/ObjectManagerIF.h"
|
||||||
#include <framework/storagemanager/StorageManagerIF.h>
|
#include "../storagemanager/StorageManagerIF.h"
|
||||||
|
|
||||||
ActionMessage::ActionMessage() {
|
ActionMessage::ActionMessage() {
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
#ifndef ACTIONMESSAGE_H_
|
#ifndef ACTIONMESSAGE_H_
|
||||||
#define ACTIONMESSAGE_H_
|
#define ACTIONMESSAGE_H_
|
||||||
|
|
||||||
#include <framework/ipc/CommandMessage.h>
|
#include "../ipc/CommandMessage.h"
|
||||||
#include <framework/objectmanager/ObjectManagerIF.h>
|
#include "../objectmanager/ObjectManagerIF.h"
|
||||||
#include <framework/storagemanager/StorageManagerIF.h>
|
#include "../storagemanager/StorageManagerIF.h"
|
||||||
typedef uint32_t ActionId_t;
|
typedef uint32_t ActionId_t;
|
||||||
|
|
||||||
class ActionMessage {
|
class ActionMessage {
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#include <framework/action/ActionMessage.h>
|
#include "ActionMessage.h"
|
||||||
#include <framework/action/CommandActionHelper.h>
|
#include "CommandActionHelper.h"
|
||||||
#include <framework/action/CommandsActionsIF.h>
|
#include "CommandsActionsIF.h"
|
||||||
#include <framework/action/HasActionsIF.h>
|
#include "HasActionsIF.h"
|
||||||
#include <framework/objectmanager/ObjectManagerIF.h>
|
#include "../objectmanager/ObjectManagerIF.h"
|
||||||
|
|
||||||
CommandActionHelper::CommandActionHelper(CommandsActionsIF *setOwner) :
|
CommandActionHelper::CommandActionHelper(CommandsActionsIF *setOwner) :
|
||||||
owner(setOwner), queueToUse(NULL), ipcStore(
|
owner(setOwner), queueToUse(NULL), ipcStore(
|
||||||
@ -20,14 +20,15 @@ ReturnValue_t CommandActionHelper::commandAction(object_id_t commandTo,
|
|||||||
}
|
}
|
||||||
store_address_t storeId;
|
store_address_t storeId;
|
||||||
uint8_t *storePointer;
|
uint8_t *storePointer;
|
||||||
uint32_t maxSize = data->getSerializedSize();
|
size_t maxSize = data->getSerializedSize();
|
||||||
ReturnValue_t result = ipcStore->getFreeElement(&storeId, maxSize,
|
ReturnValue_t result = ipcStore->getFreeElement(&storeId, maxSize,
|
||||||
&storePointer);
|
&storePointer);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
uint32_t size = 0;
|
size_t size = 0;
|
||||||
result = data->serialize(&storePointer, &size, maxSize, true);
|
result = data->serialize(&storePointer, &size, maxSize,
|
||||||
|
SerializeIF::Endianness::BIG);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -88,7 +89,8 @@ ReturnValue_t CommandActionHelper::handleReply(CommandMessage* reply) {
|
|||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
case ActionMessage::COMPLETION_FAILED:
|
case ActionMessage::COMPLETION_FAILED:
|
||||||
commandCount--;
|
commandCount--;
|
||||||
owner->completionFailedReceived(ActionMessage::getActionId(reply), ActionMessage::getReturnCode(reply));
|
owner->completionFailedReceived(ActionMessage::getActionId(reply),
|
||||||
|
ActionMessage::getReturnCode(reply));
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
case ActionMessage::STEP_SUCCESS:
|
case ActionMessage::STEP_SUCCESS:
|
||||||
owner->stepSuccessfulReceived(ActionMessage::getActionId(reply),
|
owner->stepSuccessfulReceived(ActionMessage::getActionId(reply),
|
||||||
@ -96,11 +98,13 @@ ReturnValue_t CommandActionHelper::handleReply(CommandMessage* reply) {
|
|||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
case ActionMessage::STEP_FAILED:
|
case ActionMessage::STEP_FAILED:
|
||||||
commandCount--;
|
commandCount--;
|
||||||
owner->stepFailedReceived(ActionMessage::getActionId(reply), ActionMessage::getStep(reply),
|
owner->stepFailedReceived(ActionMessage::getActionId(reply),
|
||||||
|
ActionMessage::getStep(reply),
|
||||||
ActionMessage::getReturnCode(reply));
|
ActionMessage::getReturnCode(reply));
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
case ActionMessage::DATA_REPLY:
|
case ActionMessage::DATA_REPLY:
|
||||||
extractDataForOwner(ActionMessage::getActionId(reply), ActionMessage::getStoreId(reply));
|
extractDataForOwner(ActionMessage::getActionId(reply),
|
||||||
|
ActionMessage::getStoreId(reply));
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
default:
|
default:
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
#ifndef COMMANDACTIONHELPER_H_
|
#ifndef COMMANDACTIONHELPER_H_
|
||||||
#define COMMANDACTIONHELPER_H_
|
#define COMMANDACTIONHELPER_H_
|
||||||
|
|
||||||
#include <framework/action/ActionMessage.h>
|
#include "ActionMessage.h"
|
||||||
#include <framework/objectmanager/ObjectManagerIF.h>
|
#include "../objectmanager/ObjectManagerIF.h"
|
||||||
#include <framework/returnvalues/HasReturnvaluesIF.h>
|
#include "../returnvalues/HasReturnvaluesIF.h"
|
||||||
#include <framework/serialize/SerializeIF.h>
|
#include "../serialize/SerializeIF.h"
|
||||||
#include <framework/storagemanager/StorageManagerIF.h>
|
#include "../storagemanager/StorageManagerIF.h"
|
||||||
#include <framework/ipc/MessageQueueIF.h>
|
#include "../ipc/MessageQueueIF.h"
|
||||||
|
|
||||||
class CommandsActionsIF;
|
class CommandsActionsIF;
|
||||||
|
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
#ifndef COMMANDSACTIONSIF_H_
|
#ifndef COMMANDSACTIONSIF_H_
|
||||||
#define COMMANDSACTIONSIF_H_
|
#define COMMANDSACTIONSIF_H_
|
||||||
|
|
||||||
#include <framework/action/CommandActionHelper.h>
|
#include "CommandActionHelper.h"
|
||||||
#include <framework/returnvalues/HasReturnvaluesIF.h>
|
#include "../returnvalues/HasReturnvaluesIF.h"
|
||||||
#include <framework/ipc/MessageQueueIF.h>
|
#include "../ipc/MessageQueueIF.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interface to separate commanding actions of other objects.
|
* Interface to separate commanding actions of other objects.
|
||||||
|
@ -1,33 +1,41 @@
|
|||||||
#ifndef HASACTIONSIF_H_
|
#ifndef FRAMEWORK_ACTION_HASACTIONSIF_H_
|
||||||
#define HASACTIONSIF_H_
|
#define FRAMEWORK_ACTION_HASACTIONSIF_H_
|
||||||
|
|
||||||
#include <framework/action/ActionHelper.h>
|
#include "ActionHelper.h"
|
||||||
#include <framework/action/ActionMessage.h>
|
#include "ActionMessage.h"
|
||||||
#include <framework/action/SimpleActionHelper.h>
|
#include "SimpleActionHelper.h"
|
||||||
#include <framework/returnvalues/HasReturnvaluesIF.h>
|
#include "../returnvalues/HasReturnvaluesIF.h"
|
||||||
#include <framework/ipc/MessageQueueIF.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
|
* @details
|
||||||
* end in time. They may adjust sub-states of components, but are not supposed to change
|
* This interface is used to execute actions in the component. Actions, in the
|
||||||
* the main mode of operation, which is handled with the HasModesIF described below.
|
* 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
|
* The HasActionsIF allows components to define such actions and make them
|
||||||
* for other components to use. Implementing the interface is straightforward: There’s a
|
* available for other components to use. Implementing the interface is
|
||||||
* single executeAction call, which provides an identifier for the action to execute, as well
|
* straightforward: There’s a single executeAction call, which provides an
|
||||||
* as arbitrary parameters for input. Aside from direct, software-based
|
* identifier for the action to execute, as well as arbitrary parameters for
|
||||||
* actions, it is used in device handler components as an interface to forward commands to
|
* input.
|
||||||
* devices.
|
* Aside from direct, software-based actions, it is used in device handler
|
||||||
* Implementing components of the interface are supposed to check identifier (ID) and
|
* components as an interface to forward commands to devices.
|
||||||
* parameters and immediately start execution of the action. It is, however, not required to
|
* Implementing components of the interface are supposed to check identifier
|
||||||
* immediately finish execution. Instead, this may be deferred to a later point in time, at
|
* (ID) and parameters and immediately start execution of the action.
|
||||||
* which the component needs to inform the caller about finished or failed execution.
|
* 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 {
|
class HasActionsIF {
|
||||||
public:
|
public:
|
||||||
static const uint8_t INTERFACE_ID = CLASS_ID::HAS_ACTIONS_IF;
|
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 INVALID_PARAMETERS = MAKE_RETURN_CODE(2);
|
||||||
static const ReturnValue_t EXECUTION_FINISHED = MAKE_RETURN_CODE(3);
|
static const ReturnValue_t EXECUTION_FINISHED = MAKE_RETURN_CODE(3);
|
||||||
static const ReturnValue_t INVALID_ACTION_ID = MAKE_RETURN_CODE(4);
|
static const ReturnValue_t INVALID_ACTION_ID = MAKE_RETURN_CODE(4);
|
||||||
@ -39,12 +47,14 @@ public:
|
|||||||
virtual MessageQueueId_t getCommandQueue() const = 0;
|
virtual MessageQueueId_t getCommandQueue() const = 0;
|
||||||
/**
|
/**
|
||||||
* Execute or initialize the execution of a certain function.
|
* Execute or initialize the execution of a certain function.
|
||||||
* Returning #EXECUTION_FINISHED or a failure code, nothing else needs to be done.
|
* Returning #EXECUTION_FINISHED or a failure code, nothing else needs to
|
||||||
* When needing more steps, return RETURN_OK and issue steps and completion manually. One "step failed" or completion report must
|
* be done. When needing more steps, return RETURN_OK and issue steps and
|
||||||
* be issued!
|
* 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_ */
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#include <framework/action/HasActionsIF.h>
|
#include "HasActionsIF.h"
|
||||||
#include <framework/action/SimpleActionHelper.h>
|
#include "SimpleActionHelper.h"
|
||||||
SimpleActionHelper::SimpleActionHelper(HasActionsIF* setOwner,
|
SimpleActionHelper::SimpleActionHelper(HasActionsIF* setOwner,
|
||||||
MessageQueueIF* useThisQueue) :
|
MessageQueueIF* useThisQueue) :
|
||||||
ActionHelper(setOwner, useThisQueue), isExecuting(false), lastCommander(
|
ActionHelper(setOwner, useThisQueue), isExecuting(false), lastCommander(
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#ifndef SIMPLEACTIONHELPER_H_
|
#ifndef SIMPLEACTIONHELPER_H_
|
||||||
#define SIMPLEACTIONHELPER_H_
|
#define SIMPLEACTIONHELPER_H_
|
||||||
|
|
||||||
#include <framework/action/ActionHelper.h>
|
#include "ActionHelper.h"
|
||||||
|
|
||||||
class SimpleActionHelper: public ActionHelper {
|
class SimpleActionHelper: public ActionHelper {
|
||||||
public:
|
public:
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
#ifndef ARRAYLIST_H_
|
#ifndef ARRAYLIST_H_
|
||||||
#define ARRAYLIST_H_
|
#define ARRAYLIST_H_
|
||||||
|
|
||||||
#include <framework/returnvalues/HasReturnvaluesIF.h>
|
#include "../returnvalues/HasReturnvaluesIF.h"
|
||||||
#include <framework/serialize/SerializeAdapter.h>
|
#include "../serialize/SerializeAdapter.h"
|
||||||
#include <framework/serialize/SerializeIF.h>
|
#include "../serialize/SerializeIF.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A List that stores its values in an array.
|
* A List that stores its values in an array.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#ifndef FIFO_H_
|
#ifndef FIFO_H_
|
||||||
#define FIFO_H_
|
#define FIFO_H_
|
||||||
|
|
||||||
#include <framework/returnvalues/HasReturnvaluesIF.h>
|
#include "../returnvalues/HasReturnvaluesIF.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Simple First-In-First-Out data structure
|
* @brief Simple First-In-First-Out data structure
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#ifndef FIXEDARRAYLIST_H_
|
#ifndef FIXEDARRAYLIST_H_
|
||||||
#define FIXEDARRAYLIST_H_
|
#define FIXEDARRAYLIST_H_
|
||||||
|
|
||||||
#include <framework/container/ArrayList.h>
|
#include "ArrayList.h"
|
||||||
/**
|
/**
|
||||||
* \ingroup container
|
* \ingroup container
|
||||||
*/
|
*/
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#ifndef FIXEDMAP_H_
|
#ifndef FIXEDMAP_H_
|
||||||
#define FIXEDMAP_H_
|
#define FIXEDMAP_H_
|
||||||
|
|
||||||
#include <framework/container/ArrayList.h>
|
#include "ArrayList.h"
|
||||||
#include <framework/returnvalues/HasReturnvaluesIF.h>
|
#include "../returnvalues/HasReturnvaluesIF.h"
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -148,47 +148,47 @@ public:
|
|||||||
return theMap.maxSize();
|
return theMap.maxSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ReturnValue_t serialize(uint8_t** buffer, uint32_t* size,
|
virtual ReturnValue_t serialize(uint8_t** buffer, size_t* size,
|
||||||
const uint32_t max_size, bool bigEndian) const {
|
size_t maxSize, Endianness streamEndianness) const {
|
||||||
ReturnValue_t result = SerializeAdapter<uint32_t>::serialize(&this->_size,
|
ReturnValue_t result = SerializeAdapter::serialize(&this->_size,
|
||||||
buffer, size, max_size, bigEndian);
|
buffer, size, maxSize, streamEndianness);
|
||||||
uint32_t i = 0;
|
uint32_t i = 0;
|
||||||
while ((result == HasReturnvaluesIF::RETURN_OK) && (i < this->_size)) {
|
while ((result == HasReturnvaluesIF::RETURN_OK) && (i < this->_size)) {
|
||||||
result = SerializeAdapter<key_t>::serialize(&theMap[i].first, buffer,
|
result = SerializeAdapter::serialize(&theMap[i].first, buffer,
|
||||||
size, max_size, bigEndian);
|
size, maxSize, streamEndianness);
|
||||||
result = SerializeAdapter<T>::serialize(&theMap[i].second, buffer, size,
|
result = SerializeAdapter::serialize(&theMap[i].second, buffer, size,
|
||||||
max_size, bigEndian);
|
maxSize, streamEndianness);
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual uint32_t getSerializedSize() const {
|
virtual size_t getSerializedSize() const {
|
||||||
uint32_t printSize = sizeof(_size);
|
uint32_t printSize = sizeof(_size);
|
||||||
uint32_t i = 0;
|
uint32_t i = 0;
|
||||||
|
|
||||||
for (i = 0; i < _size; ++i) {
|
for (i = 0; i < _size; ++i) {
|
||||||
printSize += SerializeAdapter<key_t>::getSerializedSize(
|
printSize += SerializeAdapter::getSerializedSize(
|
||||||
&theMap[i].first);
|
&theMap[i].first);
|
||||||
printSize += SerializeAdapter<T>::getSerializedSize(&theMap[i].second);
|
printSize += SerializeAdapter::getSerializedSize(&theMap[i].second);
|
||||||
}
|
}
|
||||||
|
|
||||||
return printSize;
|
return printSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ReturnValue_t deSerialize(const uint8_t** buffer, int32_t* size,
|
virtual ReturnValue_t deSerialize(const uint8_t** buffer, size_t* size,
|
||||||
bool bigEndian) {
|
Endianness streamEndianness) {
|
||||||
ReturnValue_t result = SerializeAdapter<uint32_t>::deSerialize(&this->_size,
|
ReturnValue_t result = SerializeAdapter::deSerialize(&this->_size,
|
||||||
buffer, size, bigEndian);
|
buffer, size, streamEndianness);
|
||||||
if (this->_size > theMap.maxSize()) {
|
if (this->_size > theMap.maxSize()) {
|
||||||
return SerializeIF::TOO_MANY_ELEMENTS;
|
return SerializeIF::TOO_MANY_ELEMENTS;
|
||||||
}
|
}
|
||||||
uint32_t i = 0;
|
uint32_t i = 0;
|
||||||
while ((result == HasReturnvaluesIF::RETURN_OK) && (i < this->_size)) {
|
while ((result == HasReturnvaluesIF::RETURN_OK) && (i < this->_size)) {
|
||||||
result = SerializeAdapter<key_t>::deSerialize(&theMap[i].first, buffer,
|
result = SerializeAdapter::deSerialize(&theMap[i].first, buffer,
|
||||||
size, bigEndian);
|
size, streamEndianness);
|
||||||
result = SerializeAdapter<T>::deSerialize(&theMap[i].second, buffer, size,
|
result = SerializeAdapter::deSerialize(&theMap[i].second, buffer, size,
|
||||||
bigEndian);
|
streamEndianness);
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#ifndef FRAMEWORK_CONTAINER_FIXEDORDEREDMULTIMAP_H_
|
#ifndef FRAMEWORK_CONTAINER_FIXEDORDEREDMULTIMAP_H_
|
||||||
#define FRAMEWORK_CONTAINER_FIXEDORDEREDMULTIMAP_H_
|
#define FRAMEWORK_CONTAINER_FIXEDORDEREDMULTIMAP_H_
|
||||||
|
|
||||||
#include <framework/container/ArrayList.h>
|
#include "ArrayList.h"
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <set>
|
#include <set>
|
||||||
/**
|
/**
|
||||||
|
@ -1,41 +1,39 @@
|
|||||||
#ifndef HYBRIDITERATOR_H_
|
#ifndef FRAMEWORK_CONTAINER_HYBRIDITERATOR_H_
|
||||||
#define HYBRIDITERATOR_H_
|
#define FRAMEWORK_CONTAINER_HYBRIDITERATOR_H_
|
||||||
|
|
||||||
#include <framework/container/ArrayList.h>
|
#include "ArrayList.h"
|
||||||
#include <framework/container/SinglyLinkedList.h>
|
#include "SinglyLinkedList.h"
|
||||||
|
|
||||||
template<typename T, typename count_t = uint8_t>
|
template<typename T, typename count_t = uint8_t>
|
||||||
class HybridIterator: public LinkedElement<T>::Iterator,
|
class HybridIterator: public LinkedElement<T>::Iterator,
|
||||||
public ArrayList<T, count_t>::Iterator {
|
public ArrayList<T, count_t>::Iterator {
|
||||||
public:
|
public:
|
||||||
HybridIterator() :
|
HybridIterator() {}
|
||||||
value(NULL), linked(NULL), end(NULL) {
|
|
||||||
}
|
|
||||||
|
|
||||||
HybridIterator(typename LinkedElement<T>::Iterator *iter) :
|
HybridIterator(typename LinkedElement<T>::Iterator *iter) :
|
||||||
LinkedElement<T>::Iterator(*iter), value(
|
LinkedElement<T>::Iterator(*iter), value(iter->value),
|
||||||
iter->value), linked(true), end(NULL) {
|
linked(true) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
HybridIterator(LinkedElement<T> *start) :
|
HybridIterator(LinkedElement<T> *start) :
|
||||||
LinkedElement<T>::Iterator(start), value(
|
LinkedElement<T>::Iterator(start), value(start->value),
|
||||||
start->value), linked(true), end(NULL) {
|
linked(true) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
HybridIterator(typename ArrayList<T, count_t>::Iterator start,
|
HybridIterator(typename ArrayList<T, count_t>::Iterator start,
|
||||||
typename ArrayList<T, count_t>::Iterator end) :
|
typename ArrayList<T, count_t>::Iterator end) :
|
||||||
ArrayList<T, count_t>::Iterator(start), value(start.value), linked(
|
ArrayList<T, count_t>::Iterator(start), value(start.value),
|
||||||
false), end(end.value) {
|
linked(false), end(end.value) {
|
||||||
if (value == this->end) {
|
if (value == this->end) {
|
||||||
value = NULL;
|
value = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
HybridIterator(T *firstElement, T *lastElement) :
|
HybridIterator(T *firstElement, T *lastElement) :
|
||||||
ArrayList<T, count_t>::Iterator(firstElement), value(firstElement), linked(
|
ArrayList<T, count_t>::Iterator(firstElement), value(firstElement),
|
||||||
false), end(++lastElement) {
|
linked(false), end(++lastElement) {
|
||||||
if (value == end) {
|
if (value == end) {
|
||||||
value = NULL;
|
value = NULL;
|
||||||
}
|
}
|
||||||
@ -44,17 +42,17 @@ public:
|
|||||||
HybridIterator& operator++() {
|
HybridIterator& operator++() {
|
||||||
if (linked) {
|
if (linked) {
|
||||||
LinkedElement<T>::Iterator::operator++();
|
LinkedElement<T>::Iterator::operator++();
|
||||||
if (LinkedElement<T>::Iterator::value != NULL) {
|
if (LinkedElement<T>::Iterator::value != nullptr) {
|
||||||
value = LinkedElement<T>::Iterator::value->value;
|
value = LinkedElement<T>::Iterator::value->value;
|
||||||
} else {
|
} else {
|
||||||
value = NULL;
|
value = nullptr;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ArrayList<T, count_t>::Iterator::operator++();
|
ArrayList<T, count_t>::Iterator::operator++();
|
||||||
value = ArrayList<T, count_t>::Iterator::value;
|
value = ArrayList<T, count_t>::Iterator::value;
|
||||||
|
|
||||||
if (value == end) {
|
if (value == end) {
|
||||||
value = NULL;
|
value = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return *this;
|
return *this;
|
||||||
@ -66,11 +64,11 @@ public:
|
|||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator==(HybridIterator other) {
|
bool operator==(const HybridIterator& other) const {
|
||||||
return value == other->value;
|
return value == other.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator!=(HybridIterator other) {
|
bool operator!=(const HybridIterator& other) const {
|
||||||
return !(*this == other);
|
return !(*this == other);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -82,11 +80,11 @@ public:
|
|||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
T* value;
|
T* value = nullptr;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool linked;
|
bool linked = false;
|
||||||
T *end;
|
T *end = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* HYBRIDITERATOR_H_ */
|
#endif /* FRAMEWORK_CONTAINER_HYBRIDITERATOR_H_ */
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
#ifndef FRAMEWORK_CONTAINER_INDEXEDRINGMEMORY_H_
|
#ifndef FRAMEWORK_CONTAINER_INDEXEDRINGMEMORY_H_
|
||||||
#define FRAMEWORK_CONTAINER_INDEXEDRINGMEMORY_H_
|
#define FRAMEWORK_CONTAINER_INDEXEDRINGMEMORY_H_
|
||||||
|
|
||||||
#include <framework/container/ArrayList.h>
|
#include "ArrayList.h"
|
||||||
#include <framework/globalfunctions/CRC.h>
|
#include "../globalfunctions/CRC.h"
|
||||||
#include <framework/serviceinterface/ServiceInterfaceStream.h>
|
#include "../serviceinterface/ServiceInterfaceStream.h"
|
||||||
#include <framework/returnvalues/HasReturnvaluesIF.h>
|
#include "../returnvalues/HasReturnvaluesIF.h"
|
||||||
#include <framework/serialize/SerialArrayListAdapter.h>
|
#include "../serialize/SerialArrayListAdapter.h"
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
@ -68,50 +68,50 @@ public:
|
|||||||
return this->storedPackets;
|
return this->storedPackets;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t serialize(uint8_t** buffer, uint32_t* size,
|
ReturnValue_t serialize(uint8_t** buffer, size_t* size,
|
||||||
const uint32_t max_size, bool bigEndian) const {
|
size_t maxSize, Endianness streamEndianness) const {
|
||||||
ReturnValue_t result = AutoSerializeAdapter::serialize(&blockStartAddress,buffer,size,max_size,bigEndian);
|
ReturnValue_t result = SerializeAdapter::serialize(&blockStartAddress,buffer,size,maxSize,streamEndianness);
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK){
|
if(result != HasReturnvaluesIF::RETURN_OK){
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
result = indexType.serialize(buffer,size,max_size,bigEndian);
|
result = indexType.serialize(buffer,size,maxSize,streamEndianness);
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK){
|
if(result != HasReturnvaluesIF::RETURN_OK){
|
||||||
return result;
|
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){
|
if(result != HasReturnvaluesIF::RETURN_OK){
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
result = AutoSerializeAdapter::serialize(&this->storedPackets,buffer,size,max_size,bigEndian);
|
result = SerializeAdapter::serialize(&this->storedPackets,buffer,size,maxSize,streamEndianness);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t deSerialize(const uint8_t** buffer, int32_t* size,
|
ReturnValue_t deSerialize(const uint8_t** buffer, size_t* size,
|
||||||
bool bigEndian){
|
Endianness streamEndianness){
|
||||||
ReturnValue_t result = AutoSerializeAdapter::deSerialize(&blockStartAddress,buffer,size,bigEndian);
|
ReturnValue_t result = SerializeAdapter::deSerialize(&blockStartAddress,buffer,size,streamEndianness);
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK){
|
if(result != HasReturnvaluesIF::RETURN_OK){
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
result = indexType.deSerialize(buffer,size,bigEndian);
|
result = indexType.deSerialize(buffer,size,streamEndianness);
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK){
|
if(result != HasReturnvaluesIF::RETURN_OK){
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
result = AutoSerializeAdapter::deSerialize(&this->size,buffer,size,bigEndian);
|
result = SerializeAdapter::deSerialize(&this->size,buffer,size,streamEndianness);
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK){
|
if(result != HasReturnvaluesIF::RETURN_OK){
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
result = AutoSerializeAdapter::deSerialize(&this->storedPackets,buffer,size,bigEndian);
|
result = SerializeAdapter::deSerialize(&this->storedPackets,buffer,size,streamEndianness);
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK){
|
if(result != HasReturnvaluesIF::RETURN_OK){
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t getSerializedSize() const {
|
size_t getSerializedSize() const {
|
||||||
uint32_t size = AutoSerializeAdapter::getSerializedSize(&blockStartAddress);
|
uint32_t size = SerializeAdapter::getSerializedSize(&blockStartAddress);
|
||||||
size += indexType.getSerializedSize();
|
size += indexType.getSerializedSize();
|
||||||
size += AutoSerializeAdapter::getSerializedSize(&this->size);
|
size += SerializeAdapter::getSerializedSize(&this->size);
|
||||||
size += AutoSerializeAdapter::getSerializedSize(&this->storedPackets);
|
size += SerializeAdapter::getSerializedSize(&this->storedPackets);
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -485,37 +485,37 @@ public:
|
|||||||
* Parameters according to HasSerializeIF
|
* Parameters according to HasSerializeIF
|
||||||
* @param buffer
|
* @param buffer
|
||||||
* @param size
|
* @param size
|
||||||
* @param max_size
|
* @param maxSize
|
||||||
* @param bigEndian
|
* @param streamEndianness
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
ReturnValue_t serialize(uint8_t** buffer, uint32_t* size,
|
ReturnValue_t serialize(uint8_t** buffer, size_t* size,
|
||||||
const uint32_t max_size, bool bigEndian) const{
|
size_t maxSize, Endianness streamEndianness) const{
|
||||||
uint8_t* crcBuffer = *buffer;
|
uint8_t* crcBuffer = *buffer;
|
||||||
uint32_t oldSize = *size;
|
uint32_t oldSize = *size;
|
||||||
if(additionalInfo!=NULL){
|
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){
|
if(result != HasReturnvaluesIF::RETURN_OK){
|
||||||
return result;
|
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){
|
if(result != HasReturnvaluesIF::RETURN_OK){
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t i = 0;
|
uint32_t i = 0;
|
||||||
while ((result == HasReturnvaluesIF::RETURN_OK) && (i < this->size)) {
|
while ((result == HasReturnvaluesIF::RETURN_OK) && (i < this->size)) {
|
||||||
result = SerializeAdapter<Index<T> >::serialize(&this->entries[i], buffer, size,
|
result = SerializeAdapter::serialize(&this->entries[i], buffer, size,
|
||||||
max_size, bigEndian);
|
maxSize, streamEndianness);
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK){
|
if(result != HasReturnvaluesIF::RETURN_OK){
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
uint16_t crc = Calculate_CRC(crcBuffer,(*size-oldSize));
|
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;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -524,17 +524,17 @@ public:
|
|||||||
* Get the serialized Size of the index
|
* Get the serialized Size of the index
|
||||||
* @return 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;
|
uint32_t size = 0;
|
||||||
if(additionalInfo!=NULL){
|
if(additionalInfo!=NULL){
|
||||||
size += additionalInfo->getSerializedSize();
|
size += additionalInfo->getSerializedSize();
|
||||||
}
|
}
|
||||||
size += currentWriteBlock->getSerializedSize();
|
size += currentWriteBlock->getSerializedSize();
|
||||||
size += AutoSerializeAdapter::getSerializedSize(&this->size);
|
size += SerializeAdapter::getSerializedSize(&this->size);
|
||||||
size += (this->entries[0].getSerializedSize()) * this->size;
|
size += (this->entries[0].getSerializedSize()) * this->size;
|
||||||
uint16_t crc = 0;
|
uint16_t crc = 0;
|
||||||
size += AutoSerializeAdapter::getSerializedSize(&crc);
|
size += SerializeAdapter::getSerializedSize(&crc);
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@ -542,28 +542,28 @@ public:
|
|||||||
* CRC Has to be checked before!
|
* CRC Has to be checked before!
|
||||||
* @param buffer
|
* @param buffer
|
||||||
* @param size
|
* @param size
|
||||||
* @param bigEndian
|
* @param streamEndianness
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ReturnValue_t deSerialize(const uint8_t** buffer, int32_t* size,
|
ReturnValue_t deSerialize(const uint8_t** buffer, size_t* size,
|
||||||
bool bigEndian){
|
Endianness streamEndianness){
|
||||||
|
|
||||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||||
if(additionalInfo!=NULL){
|
if(additionalInfo!=NULL){
|
||||||
result = additionalInfo->deSerialize(buffer,size,bigEndian);
|
result = additionalInfo->deSerialize(buffer,size,streamEndianness);
|
||||||
}
|
}
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK){
|
if(result != HasReturnvaluesIF::RETURN_OK){
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
Index<T> tempIndex;
|
Index<T> tempIndex;
|
||||||
result = tempIndex.deSerialize(buffer,size,bigEndian);
|
result = tempIndex.deSerialize(buffer,size,streamEndianness);
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK){
|
if(result != HasReturnvaluesIF::RETURN_OK){
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
uint32_t tempSize = 0;
|
uint32_t tempSize = 0;
|
||||||
result = AutoSerializeAdapter::deSerialize(&tempSize,buffer,size,bigEndian);
|
result = SerializeAdapter::deSerialize(&tempSize,buffer,size,streamEndianness);
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK){
|
if(result != HasReturnvaluesIF::RETURN_OK){
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -572,9 +572,9 @@ public:
|
|||||||
}
|
}
|
||||||
uint32_t i = 0;
|
uint32_t i = 0;
|
||||||
while ((result == HasReturnvaluesIF::RETURN_OK) && (i < this->size)) {
|
while ((result == HasReturnvaluesIF::RETURN_OK) && (i < this->size)) {
|
||||||
result = SerializeAdapter<Index<T> >::deSerialize(
|
result = SerializeAdapter::deSerialize(
|
||||||
&this->entries[i], buffer, size,
|
&this->entries[i], buffer, size,
|
||||||
bigEndian);
|
streamEndianness);
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK){
|
if(result != HasReturnvaluesIF::RETURN_OK){
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#ifndef FRAMEWORK_CONTAINER_PLACEMENTFACTORY_H_
|
#ifndef FRAMEWORK_CONTAINER_PLACEMENTFACTORY_H_
|
||||||
#define FRAMEWORK_CONTAINER_PLACEMENTFACTORY_H_
|
#define FRAMEWORK_CONTAINER_PLACEMENTFACTORY_H_
|
||||||
|
|
||||||
#include <framework/storagemanager/StorageManagerIF.h>
|
#include "../storagemanager/StorageManagerIF.h"
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
class PlacementFactory {
|
class PlacementFactory {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#ifndef FRAMEWORK_CONTAINER_RINGBUFFERBASE_H_
|
#ifndef FRAMEWORK_CONTAINER_RINGBUFFERBASE_H_
|
||||||
#define 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>
|
template<uint8_t N_READ_PTRS = 1>
|
||||||
class RingBufferBase {
|
class RingBufferBase {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#include <framework/container/SimpleRingBuffer.h>
|
#include "SimpleRingBuffer.h"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
SimpleRingBuffer::SimpleRingBuffer(uint32_t size, bool overwriteOld) :
|
SimpleRingBuffer::SimpleRingBuffer(uint32_t size, bool overwriteOld) :
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#ifndef FRAMEWORK_CONTAINER_SIMPLERINGBUFFER_H_
|
#ifndef FRAMEWORK_CONTAINER_SIMPLERINGBUFFER_H_
|
||||||
#define FRAMEWORK_CONTAINER_SIMPLERINGBUFFER_H_
|
#define FRAMEWORK_CONTAINER_SIMPLERINGBUFFER_H_
|
||||||
|
|
||||||
#include <framework/container/RingBufferBase.h>
|
#include "RingBufferBase.h"
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
||||||
class SimpleRingBuffer: public RingBufferBase<> {
|
class SimpleRingBuffer: public RingBufferBase<> {
|
||||||
|
@ -1,10 +1,13 @@
|
|||||||
#ifndef SINGLYLINKEDLIST_H_
|
#ifndef FRAMEWORK_CONTAINER_SINGLYLINKEDLIST_H_
|
||||||
#define 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>
|
template<typename T>
|
||||||
class LinkedElement {
|
class LinkedElement {
|
||||||
@ -12,11 +15,8 @@ public:
|
|||||||
T *value;
|
T *value;
|
||||||
class Iterator {
|
class Iterator {
|
||||||
public:
|
public:
|
||||||
LinkedElement<T> *value;
|
LinkedElement<T> *value = nullptr;
|
||||||
Iterator() :
|
Iterator() {}
|
||||||
value(NULL) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
Iterator(LinkedElement<T> *element) :
|
Iterator(LinkedElement<T> *element) :
|
||||||
value(element) {
|
value(element) {
|
||||||
@ -45,12 +45,11 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
LinkedElement(T* setElement, LinkedElement<T>* setNext = NULL) : value(setElement),
|
LinkedElement(T* setElement, LinkedElement<T>* setNext = nullptr):
|
||||||
next(setNext) {
|
value(setElement), next(setNext) {}
|
||||||
}
|
|
||||||
virtual ~LinkedElement(){
|
virtual ~LinkedElement(){}
|
||||||
|
|
||||||
}
|
|
||||||
virtual LinkedElement* getNext() const {
|
virtual LinkedElement* getNext() const {
|
||||||
return next;
|
return next;
|
||||||
}
|
}
|
||||||
@ -58,11 +57,16 @@ public:
|
|||||||
virtual void setNext(LinkedElement* next) {
|
virtual void setNext(LinkedElement* next) {
|
||||||
this->next = next;
|
this->next = next;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual void setEnd() {
|
||||||
|
this->next = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
LinkedElement* begin() {
|
LinkedElement* begin() {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
LinkedElement* end() {
|
LinkedElement* end() {
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
LinkedElement *next;
|
LinkedElement *next;
|
||||||
@ -71,37 +75,80 @@ private:
|
|||||||
template<typename T>
|
template<typename T>
|
||||||
class SinglyLinkedList {
|
class SinglyLinkedList {
|
||||||
public:
|
public:
|
||||||
SinglyLinkedList() :
|
using ElementIterator = typename LinkedElement<T>::Iterator;
|
||||||
start(NULL) {
|
|
||||||
}
|
SinglyLinkedList() {}
|
||||||
|
|
||||||
|
SinglyLinkedList(ElementIterator start) :
|
||||||
|
start(start.value) {}
|
||||||
|
|
||||||
SinglyLinkedList(typename LinkedElement<T>::Iterator start) :
|
|
||||||
start(start.value) {
|
|
||||||
}
|
|
||||||
SinglyLinkedList(LinkedElement<T>* startElement) :
|
SinglyLinkedList(LinkedElement<T>* startElement) :
|
||||||
start(startElement) {
|
start(startElement) {}
|
||||||
}
|
|
||||||
typename LinkedElement<T>::Iterator begin() const {
|
ElementIterator begin() const {
|
||||||
return LinkedElement<T>::Iterator::Iterator(start);
|
return ElementIterator::Iterator(start);
|
||||||
}
|
|
||||||
typename LinkedElement<T>::Iterator::Iterator end() const {
|
|
||||||
return LinkedElement<T>::Iterator::Iterator();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t getSize() const {
|
/** Returns iterator to nulltr */
|
||||||
uint32_t size = 0;
|
ElementIterator end() const {
|
||||||
|
return ElementIterator::Iterator();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns last element in singly linked list.
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
ElementIterator back() const {
|
||||||
LinkedElement<T> *element = start;
|
LinkedElement<T> *element = start;
|
||||||
while (element != NULL) {
|
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 != nullptr) {
|
||||||
size++;
|
size++;
|
||||||
element = element->getNext();
|
element = element->getNext();
|
||||||
}
|
}
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
void setStart(LinkedElement<T>* setStart) {
|
void setStart(LinkedElement<T>* firstElement) {
|
||||||
start = setStart;
|
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:
|
protected:
|
||||||
LinkedElement<T> *start;
|
LinkedElement<T> *start = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* SINGLYLINKEDLIST_H_ */
|
#endif /* SINGLYLINKEDLIST_H_ */
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#include <framework/subsystem/SubsystemBase.h>
|
#include "../subsystem/SubsystemBase.h"
|
||||||
#include <framework/controller/ControllerBase.h>
|
#include "ControllerBase.h"
|
||||||
#include <framework/subsystem/SubsystemBase.h>
|
#include "../subsystem/SubsystemBase.h"
|
||||||
#include <framework/ipc/QueueFactory.h>
|
#include "../ipc/QueueFactory.h"
|
||||||
#include <framework/action/HasActionsIF.h>
|
#include "../action/HasActionsIF.h"
|
||||||
|
|
||||||
ControllerBase::ControllerBase(uint32_t setObjectId, uint32_t parentId,
|
ControllerBase::ControllerBase(uint32_t setObjectId, uint32_t parentId,
|
||||||
size_t commandQueueDepth) :
|
size_t commandQueueDepth) :
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
#ifndef CONTROLLERBASE_H_
|
#ifndef CONTROLLERBASE_H_
|
||||||
#define CONTROLLERBASE_H_
|
#define CONTROLLERBASE_H_
|
||||||
|
|
||||||
#include <framework/health/HasHealthIF.h>
|
#include "../health/HasHealthIF.h"
|
||||||
#include <framework/health/HealthHelper.h>
|
#include "../health/HealthHelper.h"
|
||||||
#include <framework/modes/HasModesIF.h>
|
#include "../modes/HasModesIF.h"
|
||||||
#include <framework/modes/ModeHelper.h>
|
#include "../modes/ModeHelper.h"
|
||||||
#include <framework/objectmanager/SystemObject.h>
|
#include "../objectmanager/SystemObject.h"
|
||||||
#include <framework/tasks/ExecutableObjectIF.h>
|
#include "../tasks/ExecutableObjectIF.h"
|
||||||
#include <framework/datapool/HkSwitchHelper.h>
|
#include "../datapool/HkSwitchHelper.h"
|
||||||
|
|
||||||
|
|
||||||
class ControllerBase: public HasModesIF,
|
class ControllerBase: public HasModesIF,
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include <framework/coordinates/CoordinateTransformations.h>
|
#include "CoordinateTransformations.h"
|
||||||
#include <framework/globalfunctions/constants.h>
|
#include "../globalfunctions/constants.h"
|
||||||
#include <framework/globalfunctions/math/MatrixOperations.h>
|
#include "../globalfunctions/math/MatrixOperations.h"
|
||||||
#include <framework/globalfunctions/math/VectorOperations.h>
|
#include "../globalfunctions/math/VectorOperations.h"
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#ifndef COORDINATETRANSFORMATIONS_H_
|
#ifndef COORDINATETRANSFORMATIONS_H_
|
||||||
#define COORDINATETRANSFORMATIONS_H_
|
#define COORDINATETRANSFORMATIONS_H_
|
||||||
|
|
||||||
#include <framework/timemanager/Clock.h>
|
#include "../timemanager/Clock.h"
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
class CoordinateTransformations {
|
class CoordinateTransformations {
|
||||||
|
@ -2,10 +2,10 @@
|
|||||||
#define FRAMEWORK_COORDINATES_JGM3MODEL_H_
|
#define FRAMEWORK_COORDINATES_JGM3MODEL_H_
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <framework/coordinates/CoordinateTransformations.h>
|
#include "CoordinateTransformations.h"
|
||||||
#include <framework/globalfunctions/math/VectorOperations.h>
|
#include "../globalfunctions/math/VectorOperations.h"
|
||||||
#include <framework/globalfunctions/timevalOperations.h>
|
#include "../globalfunctions/timevalOperations.h"
|
||||||
#include <framework/globalfunctions/constants.h>
|
#include "../globalfunctions/constants.h"
|
||||||
#include <memory.h>
|
#include <memory.h>
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
#include <framework/coordinates/CoordinateTransformations.h>
|
#include "CoordinateTransformations.h"
|
||||||
#include <framework/coordinates/Sgp4Propagator.h>
|
#include "Sgp4Propagator.h"
|
||||||
#include <framework/globalfunctions/constants.h>
|
#include "../globalfunctions/constants.h"
|
||||||
#include <framework/globalfunctions/math/MatrixOperations.h>
|
#include "../globalfunctions/math/MatrixOperations.h"
|
||||||
#include <framework/globalfunctions/math/VectorOperations.h>
|
#include "../globalfunctions/math/VectorOperations.h"
|
||||||
#include <framework/globalfunctions/timevalOperations.h>
|
#include "../globalfunctions/timevalOperations.h"
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
Sgp4Propagator::Sgp4Propagator() :
|
Sgp4Propagator::Sgp4Propagator() :
|
||||||
initialized(false), epoch({0, 0}), whichconst(wgs84) {
|
initialized(false), epoch({0, 0}), whichconst(wgs84) {
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include "../contrib/sgp4/sgp4unit.h"
|
#include "../contrib/sgp4/sgp4unit.h"
|
||||||
#include <framework/returnvalues/HasReturnvaluesIF.h>
|
#include "../returnvalues/HasReturnvaluesIF.h"
|
||||||
|
|
||||||
class Sgp4Propagator {
|
class Sgp4Propagator {
|
||||||
public:
|
public:
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
#ifndef BCFRAME_H_
|
#ifndef BCFRAME_H_
|
||||||
#define BCFRAME_H_
|
#define BCFRAME_H_
|
||||||
|
|
||||||
#include <framework/datalinklayer/CCSDSReturnValuesIF.h>
|
#include "CCSDSReturnValuesIF.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Small helper class to identify a BcFrame.
|
* Small helper class to identify a BcFrame.
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
#ifndef CCSDSRETURNVALUESIF_H_
|
#ifndef CCSDSRETURNVALUESIF_H_
|
||||||
#define 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.
|
* This is a helper class to collect special return values that come up during CCSDS Handling.
|
||||||
* @ingroup ccsds_handling
|
* @ingroup ccsds_handling
|
||||||
|
@ -7,8 +7,8 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include <framework/datalinklayer/Clcw.h>
|
#include "Clcw.h"
|
||||||
#include <framework/serviceinterface/ServiceInterfaceStream.h>
|
#include "../serviceinterface/ServiceInterfaceStream.h"
|
||||||
|
|
||||||
Clcw::Clcw() {
|
Clcw::Clcw() {
|
||||||
content.raw = 0;
|
content.raw = 0;
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
#ifndef CLCW_H_
|
#ifndef CLCW_H_
|
||||||
#define CLCW_H_
|
#define CLCW_H_
|
||||||
|
|
||||||
#include <framework/datalinklayer/ClcwIF.h>
|
#include "ClcwIF.h"
|
||||||
/**
|
/**
|
||||||
* Small helper method to handle the Clcw values.
|
* Small helper method to handle the Clcw values.
|
||||||
* It has a content struct that manages the register and can be set externally.
|
* It has a content struct that manages the register and can be set externally.
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include <framework/datalinklayer/DataLinkLayer.h>
|
#include "DataLinkLayer.h"
|
||||||
#include <framework/globalfunctions/CRC.h>
|
#include "../globalfunctions/CRC.h"
|
||||||
#include <framework/serviceinterface/ServiceInterfaceStream.h>
|
#include "../serviceinterface/ServiceInterfaceStream.h"
|
||||||
|
|
||||||
DataLinkLayer::DataLinkLayer(uint8_t* set_frame_buffer, ClcwIF* setClcw,
|
DataLinkLayer::DataLinkLayer(uint8_t* set_frame_buffer, ClcwIF* setClcw,
|
||||||
uint8_t set_start_sequence_length, uint16_t set_scid) :
|
uint8_t set_start_sequence_length, uint16_t set_scid) :
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
#ifndef DATALINKLAYER_H_
|
#ifndef DATALINKLAYER_H_
|
||||||
#define DATALINKLAYER_H_
|
#define DATALINKLAYER_H_
|
||||||
|
|
||||||
#include <framework/datalinklayer/CCSDSReturnValuesIF.h>
|
#include "CCSDSReturnValuesIF.h"
|
||||||
#include <framework/datalinklayer/ClcwIF.h>
|
#include "ClcwIF.h"
|
||||||
#include <framework/datalinklayer/TcTransferFrame.h>
|
#include "TcTransferFrame.h"
|
||||||
#include <framework/datalinklayer/VirtualChannelReceptionIF.h>
|
#include "VirtualChannelReceptionIF.h"
|
||||||
#include <framework/events/Event.h>
|
#include "../events/Event.h"
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
#ifndef FARM1STATEIF_H_
|
#ifndef FARM1STATEIF_H_
|
||||||
#define FARM1STATEIF_H_
|
#define FARM1STATEIF_H_
|
||||||
|
|
||||||
#include <framework/datalinklayer/CCSDSReturnValuesIF.h>
|
#include "CCSDSReturnValuesIF.h"
|
||||||
class VirtualChannelReception;
|
class VirtualChannelReception;
|
||||||
class TcTransferFrame;
|
class TcTransferFrame;
|
||||||
class ClcwIF;
|
class ClcwIF;
|
||||||
|
@ -7,10 +7,10 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include <framework/datalinklayer/ClcwIF.h>
|
#include "ClcwIF.h"
|
||||||
#include <framework/datalinklayer/Farm1StateLockout.h>
|
#include "Farm1StateLockout.h"
|
||||||
#include <framework/datalinklayer/TcTransferFrame.h>
|
#include "TcTransferFrame.h"
|
||||||
#include <framework/datalinklayer/VirtualChannelReception.h>
|
#include "VirtualChannelReception.h"
|
||||||
Farm1StateLockout::Farm1StateLockout(VirtualChannelReception* setMyVC) : myVC(setMyVC) {
|
Farm1StateLockout::Farm1StateLockout(VirtualChannelReception* setMyVC) : myVC(setMyVC) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
#ifndef FARM1STATELOCKOUT_H_
|
#ifndef FARM1STATELOCKOUT_H_
|
||||||
#define FARM1STATELOCKOUT_H_
|
#define FARM1STATELOCKOUT_H_
|
||||||
|
|
||||||
#include <framework/datalinklayer/Farm1StateIF.h>
|
#include "Farm1StateIF.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class represents the FARM-1 "Lockout" State.
|
* This class represents the FARM-1 "Lockout" State.
|
||||||
|
@ -8,10 +8,10 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include <framework/datalinklayer/ClcwIF.h>
|
#include "ClcwIF.h"
|
||||||
#include <framework/datalinklayer/Farm1StateOpen.h>
|
#include "Farm1StateOpen.h"
|
||||||
#include <framework/datalinklayer/TcTransferFrame.h>
|
#include "TcTransferFrame.h"
|
||||||
#include <framework/datalinklayer/VirtualChannelReception.h>
|
#include "VirtualChannelReception.h"
|
||||||
|
|
||||||
Farm1StateOpen::Farm1StateOpen(VirtualChannelReception* setMyVC) : myVC(setMyVC) {
|
Farm1StateOpen::Farm1StateOpen(VirtualChannelReception* setMyVC) : myVC(setMyVC) {
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
#ifndef FARM1STATEOPEN_H_
|
#ifndef FARM1STATEOPEN_H_
|
||||||
#define FARM1STATEOPEN_H_
|
#define FARM1STATEOPEN_H_
|
||||||
|
|
||||||
#include <framework/datalinklayer/Farm1StateIF.h>
|
#include "Farm1StateIF.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class represents the FARM-1 "Open" State.
|
* This class represents the FARM-1 "Open" State.
|
||||||
|
@ -6,10 +6,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <framework/datalinklayer/ClcwIF.h>
|
#include "ClcwIF.h"
|
||||||
#include <framework/datalinklayer/Farm1StateWait.h>
|
#include "Farm1StateWait.h"
|
||||||
#include <framework/datalinklayer/TcTransferFrame.h>
|
#include "TcTransferFrame.h"
|
||||||
#include <framework/datalinklayer/VirtualChannelReception.h>
|
#include "VirtualChannelReception.h"
|
||||||
|
|
||||||
Farm1StateWait::Farm1StateWait(VirtualChannelReception* setMyVC) : myVC(setMyVC) {
|
Farm1StateWait::Farm1StateWait(VirtualChannelReception* setMyVC) : myVC(setMyVC) {
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
#ifndef FARM1STATEWAIT_H_
|
#ifndef FARM1STATEWAIT_H_
|
||||||
#define FARM1STATEWAIT_H_
|
#define FARM1STATEWAIT_H_
|
||||||
|
|
||||||
#include <framework/datalinklayer/Farm1StateIF.h>
|
#include "Farm1StateIF.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class represents the FARM-1 "Wait" State.
|
* This class represents the FARM-1 "Wait" State.
|
||||||
|
@ -5,13 +5,13 @@
|
|||||||
* @author baetz
|
* @author baetz
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <framework/datalinklayer/MapPacketExtraction.h>
|
#include "MapPacketExtraction.h"
|
||||||
#include <framework/ipc/QueueFactory.h>
|
#include "../ipc/QueueFactory.h"
|
||||||
#include <framework/serviceinterface/ServiceInterfaceStream.h>
|
#include "../serviceinterface/ServiceInterfaceStream.h"
|
||||||
#include <framework/storagemanager/StorageManagerIF.h>
|
#include "../storagemanager/StorageManagerIF.h"
|
||||||
#include <framework/tmtcpacket/SpacePacketBase.h>
|
#include "../tmtcpacket/SpacePacketBase.h"
|
||||||
#include <framework/tmtcservices/AcceptsTelecommandsIF.h>
|
#include "../tmtcservices/AcceptsTelecommandsIF.h"
|
||||||
#include <framework/tmtcservices/TmTcMessage.h>
|
#include "../tmtcservices/TmTcMessage.h"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
MapPacketExtraction::MapPacketExtraction(uint8_t setMapId,
|
MapPacketExtraction::MapPacketExtraction(uint8_t setMapId,
|
||||||
|
@ -8,10 +8,10 @@
|
|||||||
#ifndef MAPPACKETEXTRACTION_H_
|
#ifndef MAPPACKETEXTRACTION_H_
|
||||||
#define MAPPACKETEXTRACTION_H_
|
#define MAPPACKETEXTRACTION_H_
|
||||||
|
|
||||||
#include <framework/datalinklayer/MapPacketExtractionIF.h>
|
#include "MapPacketExtractionIF.h"
|
||||||
#include <framework/objectmanager/ObjectManagerIF.h>
|
#include "../objectmanager/ObjectManagerIF.h"
|
||||||
#include <framework/returnvalues/HasReturnvaluesIF.h>
|
#include "../returnvalues/HasReturnvaluesIF.h"
|
||||||
#include <framework/ipc/MessageQueueSenderIF.h>
|
#include "../ipc/MessageQueueSenderIF.h"
|
||||||
|
|
||||||
class StorageManagerIF;
|
class StorageManagerIF;
|
||||||
|
|
||||||
|
@ -8,8 +8,8 @@
|
|||||||
#ifndef MAPPACKETEXTRACTIONIF_H_
|
#ifndef MAPPACKETEXTRACTIONIF_H_
|
||||||
#define MAPPACKETEXTRACTIONIF_H_
|
#define MAPPACKETEXTRACTIONIF_H_
|
||||||
|
|
||||||
#include <framework/datalinklayer/CCSDSReturnValuesIF.h>
|
#include "CCSDSReturnValuesIF.h"
|
||||||
#include <framework/datalinklayer/TcTransferFrame.h>
|
#include "TcTransferFrame.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the interface for MAP Packet Extraction classes.
|
* This is the interface for MAP Packet Extraction classes.
|
||||||
|
@ -7,8 +7,8 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include <framework/datalinklayer/TcTransferFrame.h>
|
#include "TcTransferFrame.h"
|
||||||
#include <framework/serviceinterface/ServiceInterfaceStream.h>
|
#include "../serviceinterface/ServiceInterfaceStream.h"
|
||||||
|
|
||||||
TcTransferFrame::TcTransferFrame() {
|
TcTransferFrame::TcTransferFrame() {
|
||||||
frame = NULL;
|
frame = NULL;
|
||||||
|
@ -5,9 +5,9 @@
|
|||||||
* @author baetz
|
* @author baetz
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <framework/datalinklayer/TcTransferFrameLocal.h>
|
#include "TcTransferFrameLocal.h"
|
||||||
#include <framework/globalfunctions/CRC.h>
|
#include "../globalfunctions/CRC.h"
|
||||||
#include <framework/serviceinterface/ServiceInterfaceStream.h>
|
#include "../serviceinterface/ServiceInterfaceStream.h"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
TcTransferFrameLocal::TcTransferFrameLocal(bool bypass, bool controlCommand, uint16_t scid,
|
TcTransferFrameLocal::TcTransferFrameLocal(bool bypass, bool controlCommand, uint16_t scid,
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
#ifndef TCTRANSFERFRAMELOCAL_H_
|
#ifndef TCTRANSFERFRAMELOCAL_H_
|
||||||
#define TCTRANSFERFRAMELOCAL_H_
|
#define TCTRANSFERFRAMELOCAL_H_
|
||||||
|
|
||||||
#include <framework/datalinklayer/TcTransferFrame.h>
|
#include "TcTransferFrame.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is a helper class to locally create TC Transfer Frames.
|
* This is a helper class to locally create TC Transfer Frames.
|
||||||
|
@ -5,9 +5,9 @@
|
|||||||
* @author baetz
|
* @author baetz
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <framework/datalinklayer/BCFrame.h>
|
#include "BCFrame.h"
|
||||||
#include <framework/datalinklayer/VirtualChannelReception.h>
|
#include "VirtualChannelReception.h"
|
||||||
#include <framework/serviceinterface/ServiceInterfaceStream.h>
|
#include "../serviceinterface/ServiceInterfaceStream.h"
|
||||||
|
|
||||||
VirtualChannelReception::VirtualChannelReception(uint8_t setChannelId,
|
VirtualChannelReception::VirtualChannelReception(uint8_t setChannelId,
|
||||||
uint8_t setSlidingWindowWidth) :
|
uint8_t setSlidingWindowWidth) :
|
||||||
|
@ -8,14 +8,14 @@
|
|||||||
#ifndef VIRTUALCHANNELRECEPTION_H_
|
#ifndef VIRTUALCHANNELRECEPTION_H_
|
||||||
#define VIRTUALCHANNELRECEPTION_H_
|
#define VIRTUALCHANNELRECEPTION_H_
|
||||||
|
|
||||||
#include <framework/datalinklayer/CCSDSReturnValuesIF.h>
|
#include "CCSDSReturnValuesIF.h"
|
||||||
#include <framework/datalinklayer/Clcw.h>
|
#include "Clcw.h"
|
||||||
#include <framework/datalinklayer/Farm1StateIF.h>
|
#include "Farm1StateIF.h"
|
||||||
#include <framework/datalinklayer/Farm1StateLockout.h>
|
#include "Farm1StateLockout.h"
|
||||||
#include <framework/datalinklayer/Farm1StateOpen.h>
|
#include "Farm1StateOpen.h"
|
||||||
#include <framework/datalinklayer/Farm1StateWait.h>
|
#include "Farm1StateWait.h"
|
||||||
#include <framework/datalinklayer/MapPacketExtractionIF.h>
|
#include "MapPacketExtractionIF.h"
|
||||||
#include <framework/datalinklayer/VirtualChannelReceptionIF.h>
|
#include "VirtualChannelReceptionIF.h"
|
||||||
#include <map>
|
#include <map>
|
||||||
/**
|
/**
|
||||||
* Implementation of a TC Virtual Channel.
|
* Implementation of a TC Virtual Channel.
|
||||||
|
@ -8,9 +8,9 @@
|
|||||||
#ifndef VIRTUALCHANNELRECEPTIONIF_H_
|
#ifndef VIRTUALCHANNELRECEPTIONIF_H_
|
||||||
#define VIRTUALCHANNELRECEPTIONIF_H_
|
#define VIRTUALCHANNELRECEPTIONIF_H_
|
||||||
|
|
||||||
#include <framework/datalinklayer/ClcwIF.h>
|
#include "ClcwIF.h"
|
||||||
#include <framework/datalinklayer/TcTransferFrame.h>
|
#include "TcTransferFrame.h"
|
||||||
#include <framework/returnvalues/HasReturnvaluesIF.h>
|
#include "../returnvalues/HasReturnvaluesIF.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the interface for Virtual Channel reception classes.
|
* This is the interface for Virtual Channel reception classes.
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#include <framework/datapool/ControllerSet.h>
|
#include "ControllerSet.h"
|
||||||
|
|
||||||
ControllerSet::ControllerSet() {
|
ControllerSet::ControllerSet() {
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#ifndef CONTROLLERSET_H_
|
#ifndef CONTROLLERSET_H_
|
||||||
#define CONTROLLERSET_H_
|
#define CONTROLLERSET_H_
|
||||||
|
|
||||||
#include <framework/datapool/DataSet.h>
|
#include "DataSet.h"
|
||||||
|
|
||||||
class ControllerSet :public DataSet {
|
class ControllerSet :public DataSet {
|
||||||
public:
|
public:
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include <framework/datapool/DataPool.h>
|
#include "DataPool.h"
|
||||||
#include <framework/serviceinterface/ServiceInterfaceStream.h>
|
#include "../serviceinterface/ServiceInterfaceStream.h"
|
||||||
#include <framework/ipc/MutexFactory.h>
|
#include "../ipc/MutexFactory.h"
|
||||||
|
|
||||||
DataPool::DataPool( void ( *initFunction )( std::map<uint32_t, PoolEntryIF*>* pool_map ) ) {
|
DataPool::DataPool( void ( *initFunction )( std::map<uint32_t, PoolEntryIF*>* pool_map ) ) {
|
||||||
mutex = MutexFactory::instance()->createMutex();
|
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 );
|
// std::map<uint32_t, PoolEntryIF*>::iterator it = this->data_pool.find( data_pool_id );
|
||||||
// if ( it != this->data_pool.end() ) {
|
// if ( it != this->data_pool.end() ) {
|
||||||
// if ( it->second->getByteSize() <= max_size ) {
|
// if ( it->second->getByteSize() <= maxSize ) {
|
||||||
// *size = it->second->getByteSize();
|
// *size = it->second->getByteSize();
|
||||||
// memcpy( address, it->second->getRawData(), *size );
|
// memcpy( address, it->second->getRawData(), *size );
|
||||||
// return DP_SUCCESSFUL;
|
// return DP_SUCCESSFUL;
|
||||||
@ -61,7 +61,7 @@ ReturnValue_t DataPool::freeDataPoolLock() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t DataPool::lockDataPool() {
|
ReturnValue_t DataPool::lockDataPool() {
|
||||||
ReturnValue_t status = mutex->lockMutex(MutexIF::NO_TIMEOUT);
|
ReturnValue_t status = mutex->lockMutex(MutexIF::BLOCKING);
|
||||||
if ( status != RETURN_OK ) {
|
if ( status != RETURN_OK ) {
|
||||||
sif::error << "DataPool::DataPool: lock of mutex failed with error code: " << status << std::endl;
|
sif::error << "DataPool::DataPool: lock of mutex failed with error code: " << status << std::endl;
|
||||||
}
|
}
|
||||||
|
@ -11,9 +11,9 @@
|
|||||||
#ifndef DATAPOOL_H_
|
#ifndef DATAPOOL_H_
|
||||||
#define DATAPOOL_H_
|
#define DATAPOOL_H_
|
||||||
|
|
||||||
#include <framework/datapool/PoolEntry.h>
|
#include "PoolEntry.h"
|
||||||
#include <framework/globalfunctions/Type.h>
|
#include "../globalfunctions/Type.h"
|
||||||
#include <framework/ipc/MutexIF.h>
|
#include "../ipc/MutexIF.h"
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
#include <framework/datapool/DataPool.h>
|
#include "DataPool.h"
|
||||||
#include <framework/datapool/DataPoolAdmin.h>
|
#include "DataPoolAdmin.h"
|
||||||
#include <framework/datapool/DataSet.h>
|
#include "DataSet.h"
|
||||||
#include <framework/datapool/PoolRawAccess.h>
|
#include "PoolRawAccess.h"
|
||||||
#include <framework/ipc/CommandMessage.h>
|
#include "../ipc/CommandMessage.h"
|
||||||
#include <framework/ipc/QueueFactory.h>
|
#include "../ipc/QueueFactory.h"
|
||||||
#include <framework/parameters/ParameterMessage.h>
|
#include "../parameters/ParameterMessage.h"
|
||||||
|
|
||||||
DataPoolAdmin::DataPoolAdmin(object_id_t objectId) :
|
DataPoolAdmin::DataPoolAdmin(object_id_t objectId) :
|
||||||
SystemObject(objectId), storage(NULL), commandQueue(NULL), memoryHelper(
|
SystemObject(objectId), storage(NULL), commandQueue(NULL), memoryHelper(
|
||||||
@ -26,7 +26,7 @@ MessageQueueId_t DataPoolAdmin::getCommandQueue() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t DataPoolAdmin::executeAction(ActionId_t actionId,
|
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) {
|
if (actionId != SET_VALIDITY) {
|
||||||
return INVALID_ACTION_ID;
|
return INVALID_ACTION_ID;
|
||||||
}
|
}
|
||||||
@ -91,7 +91,7 @@ void DataPoolAdmin::handleCommand() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t DataPoolAdmin::handleMemoryLoad(uint32_t address,
|
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);
|
uint32_t poolId = ::dataPool.PIDToDataPoolId(address);
|
||||||
uint8_t arrayIndex = ::dataPool.PIDToArrayIndex(address);
|
uint8_t arrayIndex = ::dataPool.PIDToArrayIndex(address);
|
||||||
DataSet testSet;
|
DataSet testSet;
|
||||||
@ -129,7 +129,7 @@ ReturnValue_t DataPoolAdmin::handleMemoryLoad(uint32_t address,
|
|||||||
return ACTIVITY_COMPLETED;
|
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) {
|
uint8_t** dataPointer, uint8_t* copyHere) {
|
||||||
uint32_t poolId = ::dataPool.PIDToDataPoolId(address);
|
uint32_t poolId = ::dataPool.PIDToDataPoolId(address);
|
||||||
uint8_t arrayIndex = ::dataPool.PIDToArrayIndex(address);
|
uint8_t arrayIndex = ::dataPool.PIDToArrayIndex(address);
|
||||||
@ -151,7 +151,7 @@ ReturnValue_t DataPoolAdmin::handleMemoryDump(uint32_t address, uint32_t size,
|
|||||||
PoolVariableIF::VAR_READ);
|
PoolVariableIF::VAR_READ);
|
||||||
status = rawSet.read();
|
status = rawSet.read();
|
||||||
if (status == RETURN_OK) {
|
if (status == RETURN_OK) {
|
||||||
uint32_t temp = 0;
|
size_t temp = 0;
|
||||||
status = variable.getEntryEndianSafe(ptrToCopy, &temp, size);
|
status = variable.getEntryEndianSafe(ptrToCopy, &temp, size);
|
||||||
if (status != RETURN_OK) {
|
if (status != RETURN_OK) {
|
||||||
return RETURN_FAILED;
|
return RETURN_FAILED;
|
||||||
@ -261,7 +261,7 @@ ReturnValue_t DataPoolAdmin::handleParameterCommand(CommandMessage* command) {
|
|||||||
//identical to ParameterHelper::sendParameter()
|
//identical to ParameterHelper::sendParameter()
|
||||||
ReturnValue_t DataPoolAdmin::sendParameter(MessageQueueId_t to, uint32_t id,
|
ReturnValue_t DataPoolAdmin::sendParameter(MessageQueueId_t to, uint32_t id,
|
||||||
const DataPoolParameterWrapper* wrapper) {
|
const DataPoolParameterWrapper* wrapper) {
|
||||||
uint32_t serializedSize = wrapper->getSerializedSize();
|
size_t serializedSize = wrapper->getSerializedSize();
|
||||||
|
|
||||||
uint8_t *storeElement;
|
uint8_t *storeElement;
|
||||||
store_address_t address;
|
store_address_t address;
|
||||||
@ -272,10 +272,10 @@ ReturnValue_t DataPoolAdmin::sendParameter(MessageQueueId_t to, uint32_t id,
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t storeElementSize = 0;
|
size_t storeElementSize = 0;
|
||||||
|
|
||||||
result = wrapper->serialize(&storeElement, &storeElementSize,
|
result = wrapper->serialize(&storeElement, &storeElementSize,
|
||||||
serializedSize, true);
|
serializedSize, SerializeIF::Endianness::BIG);
|
||||||
|
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
storage->deleteData(address);
|
storage->deleteData(address);
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
#ifndef DATAPOOLADMIN_H_
|
#ifndef DATAPOOLADMIN_H_
|
||||||
#define DATAPOOLADMIN_H_
|
#define DATAPOOLADMIN_H_
|
||||||
|
|
||||||
#include <framework/memory/MemoryHelper.h>
|
#include "../memory/MemoryHelper.h"
|
||||||
#include <framework/action/HasActionsIF.h>
|
#include "../action/HasActionsIF.h"
|
||||||
#include <framework/action/SimpleActionHelper.h>
|
#include "../action/SimpleActionHelper.h"
|
||||||
#include <framework/objectmanager/SystemObject.h>
|
#include "../objectmanager/SystemObject.h"
|
||||||
#include <framework/returnvalues/HasReturnvaluesIF.h>
|
#include "../returnvalues/HasReturnvaluesIF.h"
|
||||||
#include <framework/tasks/ExecutableObjectIF.h>
|
#include "../tasks/ExecutableObjectIF.h"
|
||||||
#include <framework/parameters/ReceivesParameterMessagesIF.h>
|
#include "../parameters/ReceivesParameterMessagesIF.h"
|
||||||
#include <framework/datapool/DataPoolParameterWrapper.h>
|
#include "DataPoolParameterWrapper.h"
|
||||||
#include <framework/ipc/MessageQueueIF.h>
|
#include "../ipc/MessageQueueIF.h"
|
||||||
|
|
||||||
class DataPoolAdmin: public HasActionsIF,
|
class DataPoolAdmin: public HasActionsIF,
|
||||||
public ExecutableObjectIF,
|
public ExecutableObjectIF,
|
||||||
@ -29,12 +29,12 @@ public:
|
|||||||
MessageQueueId_t getCommandQueue() const;
|
MessageQueueId_t getCommandQueue() const;
|
||||||
|
|
||||||
ReturnValue_t handleMemoryLoad(uint32_t address, const uint8_t* data,
|
ReturnValue_t handleMemoryLoad(uint32_t address, const uint8_t* data,
|
||||||
uint32_t size, uint8_t** dataPointer);
|
size_t size, uint8_t** dataPointer);
|
||||||
ReturnValue_t handleMemoryDump(uint32_t address, uint32_t size,
|
ReturnValue_t handleMemoryDump(uint32_t address, size_t size,
|
||||||
uint8_t** dataPointer, uint8_t* copyHere);
|
uint8_t** dataPointer, uint8_t* copyHere);
|
||||||
|
|
||||||
ReturnValue_t executeAction(ActionId_t actionId,
|
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
|
//not implemented as ParameterHelper is no used
|
||||||
ReturnValue_t getParameter(uint8_t domainId, uint16_t parameterId,
|
ReturnValue_t getParameter(uint8_t domainId, uint16_t parameterId,
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
#include "DataPoolParameterWrapper.h"
|
#include "DataPoolParameterWrapper.h"
|
||||||
|
|
||||||
//for returncodes
|
//for returncodes
|
||||||
#include <framework/parameters/HasParametersIF.h>
|
#include "../parameters/HasParametersIF.h"
|
||||||
|
|
||||||
#include <framework/datapool/DataSet.h>
|
#include "DataSet.h"
|
||||||
#include <framework/datapool/PoolRawAccess.h>
|
#include "PoolRawAccess.h"
|
||||||
|
|
||||||
DataPoolParameterWrapper::DataPoolParameterWrapper() :
|
DataPoolParameterWrapper::DataPoolParameterWrapper() :
|
||||||
type(Type::UNKNOWN_TYPE), rows(0), columns(0), poolId(
|
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,
|
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;
|
ReturnValue_t result;
|
||||||
|
|
||||||
result = SerializeAdapter<Type>::serialize(&type, buffer, size, max_size,
|
result = SerializeAdapter::serialize(&type, buffer, size, maxSize,
|
||||||
bigEndian);
|
streamEndianness);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = SerializeAdapter<uint8_t>::serialize(&columns, buffer, size,
|
result = SerializeAdapter::serialize(&columns, buffer, size,
|
||||||
max_size, bigEndian);
|
maxSize, streamEndianness);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
result = SerializeAdapter<uint8_t>::serialize(&rows, buffer, size, max_size,
|
result = SerializeAdapter::serialize(&rows, buffer, size, maxSize,
|
||||||
bigEndian);
|
streamEndianness);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -60,7 +60,7 @@ ReturnValue_t DataPoolParameterWrapper::serialize(uint8_t** buffer,
|
|||||||
DataSet mySet;
|
DataSet mySet;
|
||||||
PoolRawAccess raw(poolId, index, &mySet,PoolVariableIF::VAR_READ);
|
PoolRawAccess raw(poolId, index, &mySet,PoolVariableIF::VAR_READ);
|
||||||
mySet.read();
|
mySet.read();
|
||||||
result = raw.serialize(buffer,size,max_size,bigEndian);
|
result = raw.serialize(buffer,size,maxSize,streamEndianness);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK){
|
if (result != HasReturnvaluesIF::RETURN_OK){
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -69,8 +69,8 @@ ReturnValue_t DataPoolParameterWrapper::serialize(uint8_t** buffer,
|
|||||||
}
|
}
|
||||||
|
|
||||||
//same as ParameterWrapper
|
//same as ParameterWrapper
|
||||||
uint32_t DataPoolParameterWrapper::getSerializedSize() const {
|
size_t DataPoolParameterWrapper::getSerializedSize() const {
|
||||||
uint32_t serializedSize = 0;
|
size_t serializedSize = 0;
|
||||||
serializedSize += type.getSerializedSize();
|
serializedSize += type.getSerializedSize();
|
||||||
serializedSize += sizeof(rows);
|
serializedSize += sizeof(rows);
|
||||||
serializedSize += sizeof(columns);
|
serializedSize += sizeof(columns);
|
||||||
@ -80,7 +80,7 @@ uint32_t DataPoolParameterWrapper::getSerializedSize() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t DataPoolParameterWrapper::deSerialize(const uint8_t** buffer,
|
ReturnValue_t DataPoolParameterWrapper::deSerialize(const uint8_t** buffer,
|
||||||
int32_t* size, bool bigEndian) {
|
size_t* size, Endianness streamEndianness) {
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#ifndef DATAPOOLPARAMETERWRAPPER_H_
|
#ifndef DATAPOOLPARAMETERWRAPPER_H_
|
||||||
#define DATAPOOLPARAMETERWRAPPER_H_
|
#define DATAPOOLPARAMETERWRAPPER_H_
|
||||||
|
|
||||||
#include <framework/globalfunctions/Type.h>
|
#include "../globalfunctions/Type.h"
|
||||||
#include <framework/parameters/ParameterWrapper.h>
|
#include "../parameters/ParameterWrapper.h"
|
||||||
|
|
||||||
class DataPoolParameterWrapper: public SerializeIF {
|
class DataPoolParameterWrapper: public SerializeIF {
|
||||||
public:
|
public:
|
||||||
@ -11,13 +11,13 @@ public:
|
|||||||
|
|
||||||
ReturnValue_t set(uint8_t domainId, uint16_t parameterId);
|
ReturnValue_t set(uint8_t domainId, uint16_t parameterId);
|
||||||
|
|
||||||
virtual ReturnValue_t serialize(uint8_t** buffer, uint32_t* size,
|
virtual ReturnValue_t serialize(uint8_t** buffer, size_t* size,
|
||||||
const uint32_t max_size, bool bigEndian) const;
|
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,
|
virtual ReturnValue_t deSerialize(const uint8_t** buffer, size_t* size,
|
||||||
bool bigEndian);
|
Endianness streamEndianness) override;
|
||||||
|
|
||||||
ReturnValue_t copyFrom(const ParameterWrapper *from,
|
ReturnValue_t copyFrom(const ParameterWrapper *from,
|
||||||
uint16_t startWritingAtIndex);
|
uint16_t startWritingAtIndex);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#include <framework/datapool/DataSet.h>
|
#include "DataSet.h"
|
||||||
#include <framework/serviceinterface/ServiceInterfaceStream.h>
|
#include "../serviceinterface/ServiceInterfaceStream.h"
|
||||||
|
|
||||||
DataSet::DataSet() :
|
DataSet::DataSet() :
|
||||||
fill_count(0), state(DATA_SET_UNINITIALISED) {
|
fill_count(0), state(DATA_SET_UNINITIALISED) {
|
||||||
@ -106,12 +106,12 @@ uint8_t DataSet::lockDataPool() {
|
|||||||
return ::dataPool.lockDataPool();
|
return ::dataPool.lockDataPool();
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t DataSet::serialize(uint8_t** buffer, uint32_t* size,
|
ReturnValue_t DataSet::serialize(uint8_t** buffer, size_t* size,
|
||||||
const uint32_t max_size, bool bigEndian) const {
|
size_t maxSize, Endianness streamEndianness) const {
|
||||||
ReturnValue_t result = RETURN_FAILED;
|
ReturnValue_t result = RETURN_FAILED;
|
||||||
for (uint16_t count = 0; count < fill_count; count++) {
|
for (uint16_t count = 0; count < fill_count; count++) {
|
||||||
result = registeredVariables[count]->serialize(buffer, size, max_size,
|
result = registeredVariables[count]->serialize(buffer, size, maxSize,
|
||||||
bigEndian);
|
streamEndianness);
|
||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -119,8 +119,8 @@ ReturnValue_t DataSet::serialize(uint8_t** buffer, uint32_t* size,
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t DataSet::getSerializedSize() const {
|
size_t DataSet::getSerializedSize() const {
|
||||||
uint32_t size = 0;
|
size_t size = 0;
|
||||||
for (uint16_t count = 0; count < fill_count; count++) {
|
for (uint16_t count = 0; count < fill_count; count++) {
|
||||||
size += registeredVariables[count]->getSerializedSize();
|
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,
|
ReturnValue_t DataSet::deSerialize(const uint8_t** buffer, size_t* size,
|
||||||
bool bigEndian) {
|
Endianness streamEndianness) {
|
||||||
ReturnValue_t result = RETURN_FAILED;
|
ReturnValue_t result = RETURN_FAILED;
|
||||||
for (uint16_t count = 0; count < fill_count; count++) {
|
for (uint16_t count = 0; count < fill_count; count++) {
|
||||||
result = registeredVariables[count]->deSerialize(buffer, size,
|
result = registeredVariables[count]->deSerialize(buffer, size,
|
||||||
bigEndian);
|
streamEndianness);
|
||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -12,13 +12,13 @@
|
|||||||
#ifndef DATASET_H_
|
#ifndef DATASET_H_
|
||||||
#define DATASET_H_
|
#define DATASET_H_
|
||||||
|
|
||||||
#include <framework/datapool/DataPool.h>
|
#include "DataPool.h"
|
||||||
#include <framework/datapool/DataSetIF.h>
|
#include "DataSetIF.h"
|
||||||
#include <framework/datapool/PoolRawAccess.h>
|
#include "PoolRawAccess.h"
|
||||||
#include <framework/datapool/PoolVariable.h>
|
#include "PoolVariable.h"
|
||||||
#include <framework/datapool/PoolVarList.h>
|
#include "PoolVarList.h"
|
||||||
#include <framework/datapool/PoolVector.h>
|
#include "PoolVector.h"
|
||||||
#include <framework/serialize/SerializeAdapter.h>
|
#include "../serialize/SerializeAdapter.h"
|
||||||
/**
|
/**
|
||||||
* \brief The DataSet class manages a set of locally checked out variables.
|
* \brief The DataSet class manages a set of locally checked out variables.
|
||||||
*
|
*
|
||||||
@ -146,13 +146,13 @@ public:
|
|||||||
*/
|
*/
|
||||||
void setValid(uint8_t valid);
|
void setValid(uint8_t valid);
|
||||||
|
|
||||||
ReturnValue_t serialize(uint8_t** buffer, uint32_t* size,
|
ReturnValue_t serialize(uint8_t** buffer, size_t* size,
|
||||||
const uint32_t max_size, bool bigEndian) const;
|
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,
|
ReturnValue_t deSerialize(const uint8_t** buffer, size_t* size,
|
||||||
bool bigEndian);
|
Endianness streamEndianness) override;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include <framework/datapool/HkSwitchHelper.h>
|
#include "HkSwitchHelper.h"
|
||||||
//#include <mission/tmtcservices/HKService_03.h>
|
//#include <mission/tmtcservices/HKService_03.h>
|
||||||
#include <framework/ipc/QueueFactory.h>
|
#include "../ipc/QueueFactory.h"
|
||||||
|
|
||||||
HkSwitchHelper::HkSwitchHelper(EventReportingProxyIF* eventProxy) :
|
HkSwitchHelper::HkSwitchHelper(EventReportingProxyIF* eventProxy) :
|
||||||
commandActionHelper(this), eventProxy(eventProxy) {
|
commandActionHelper(this), eventProxy(eventProxy) {
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
#ifndef FRAMEWORK_DATAPOOL_HKSWITCHHELPER_H_
|
#ifndef FRAMEWORK_DATAPOOL_HKSWITCHHELPER_H_
|
||||||
#define FRAMEWORK_DATAPOOL_HKSWITCHHELPER_H_
|
#define FRAMEWORK_DATAPOOL_HKSWITCHHELPER_H_
|
||||||
|
|
||||||
#include <framework/tasks/ExecutableObjectIF.h>
|
#include "../tasks/ExecutableObjectIF.h"
|
||||||
#include <framework/action/CommandsActionsIF.h>
|
#include "../action/CommandsActionsIF.h"
|
||||||
#include <framework/events/EventReportingProxyIF.h>
|
#include "../events/EventReportingProxyIF.h"
|
||||||
|
|
||||||
//TODO this class violations separation between mission and framework
|
//TODO this class violations separation between mission and framework
|
||||||
//but it is only a transitional solution until the Datapool is
|
//but it is only a transitional solution until the Datapool is
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
#ifndef PIDREADER_H_
|
#ifndef PIDREADER_H_
|
||||||
#define PIDREADER_H_
|
#define PIDREADER_H_
|
||||||
#include <framework/datapool/DataPool.h>
|
#include "DataPool.h"
|
||||||
#include <framework/datapool/DataSetIF.h>
|
#include "DataSetIF.h"
|
||||||
#include <framework/datapool/PoolEntry.h>
|
#include "PoolEntry.h"
|
||||||
#include <framework/datapool/PoolVariableIF.h>
|
#include "PoolVariableIF.h"
|
||||||
#include <framework/serialize/SerializeAdapter.h>
|
#include "../serialize/SerializeAdapter.h"
|
||||||
#include <framework/serviceinterface/ServiceInterfaceStream.h>
|
#include "../serviceinterface/ServiceInterfaceStream.h"
|
||||||
|
|
||||||
template<typename U, uint8_t n_var> class PIDReaderList;
|
template<typename U, uint8_t n_var> class PIDReaderList;
|
||||||
|
|
||||||
@ -43,7 +43,8 @@ protected:
|
|||||||
* Empty ctor for List initialization
|
* Empty ctor for List initialization
|
||||||
*/
|
*/
|
||||||
PIDReader() :
|
PIDReader() :
|
||||||
parameterId(PoolVariableIF::NO_PARAMETER), valid(PoolVariableIF::INVALID), value(0) {
|
parameterId(PoolVariableIF::NO_PARAMETER), valid(
|
||||||
|
PoolVariableIF::INVALID), value(0) {
|
||||||
|
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
@ -64,8 +65,8 @@ public:
|
|||||||
* written back to the data pool, otherwise not.
|
* written back to the data pool, otherwise not.
|
||||||
*/
|
*/
|
||||||
PIDReader(uint32_t setParameterId, DataSetIF *dataSet) :
|
PIDReader(uint32_t setParameterId, DataSetIF *dataSet) :
|
||||||
parameterId(setParameterId), valid(
|
parameterId(setParameterId), valid(PoolVariableIF::INVALID), value(
|
||||||
PoolVariableIF::INVALID), value(0) {
|
0) {
|
||||||
if (dataSet != NULL) {
|
if (dataSet != NULL) {
|
||||||
dataSet->registerVariable(this);
|
dataSet->registerVariable(this);
|
||||||
}
|
}
|
||||||
@ -126,19 +127,20 @@ public:
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ReturnValue_t serialize(uint8_t** buffer, uint32_t* size,
|
virtual ReturnValue_t serialize(uint8_t **buffer, size_t *size,
|
||||||
const uint32_t max_size, bool bigEndian) const {
|
size_t maxSize, Endianness streamEndianness) const override {
|
||||||
return SerializeAdapter<T>::serialize(&value, buffer, size, max_size,
|
return SerializeAdapter::serialize(&value, buffer, size, maxSize,
|
||||||
bigEndian);
|
streamEndianness);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual uint32_t getSerializedSize() const {
|
virtual size_t getSerializedSize() const override {
|
||||||
return SerializeAdapter<T>::getSerializedSize(&value);
|
return SerializeAdapter::getSerializedSize(&value);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ReturnValue_t deSerialize(const uint8_t** buffer, int32_t* size,
|
virtual ReturnValue_t deSerialize(const uint8_t **buffer, size_t *size,
|
||||||
bool bigEndian) {
|
Endianness streamEndianness) override {
|
||||||
return SerializeAdapter<T>::deSerialize(&value, buffer, size, bigEndian);
|
return SerializeAdapter::deSerialize(&value, buffer, size,
|
||||||
|
streamEndianness);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#ifndef FRAMEWORK_DATAPOOL_PIDREADERLIST_H_
|
#ifndef FRAMEWORK_DATAPOOL_PIDREADERLIST_H_
|
||||||
#define FRAMEWORK_DATAPOOL_PIDREADERLIST_H_
|
#define FRAMEWORK_DATAPOOL_PIDREADERLIST_H_
|
||||||
|
|
||||||
#include <framework/datapool/PIDReader.h>
|
#include "PIDReader.h"
|
||||||
#include <framework/datapool/PoolVariableIF.h>
|
#include "PoolVariableIF.h"
|
||||||
template <class T, uint8_t n_var>
|
template <class T, uint8_t n_var>
|
||||||
class PIDReaderList {
|
class PIDReaderList {
|
||||||
private:
|
private:
|
||||||
|
@ -1,13 +1,34 @@
|
|||||||
#include <framework/datapool/PoolEntry.h>
|
#include "PoolEntry.h"
|
||||||
#include <framework/serviceinterface/ServiceInterfaceStream.h>
|
#include "../serviceinterface/ServiceInterfaceStream.h"
|
||||||
|
#include "../globalfunctions/arrayprinter.h"
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
template <typename T>
|
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];
|
this->address = new T[this->length];
|
||||||
if (initValue != NULL) {
|
if(initValue.size() == 0) {
|
||||||
memcpy(this->address, initValue, this->getByteSize() );
|
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 {
|
} 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>
|
template <typename T>
|
||||||
void PoolEntry<T>::setValid( uint8_t isValid ) {
|
void PoolEntry<T>::setValid(bool isValid) {
|
||||||
this->valid = isValid;
|
this->valid = isValid;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
uint8_t PoolEntry<T>::getValid() {
|
bool PoolEntry<T>::getValid() {
|
||||||
return valid;
|
return valid;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void PoolEntry<T>::print() {
|
void PoolEntry<T>::print() {
|
||||||
for (uint8_t size = 0; size < this->length; size++ ) {
|
sif::debug << "Pool Entry Validity: " <<
|
||||||
sif::debug << "| " << std::hex << (double)this->address[size]
|
(this->valid? " (valid) " : " (invalid) ") << std::endl;
|
||||||
<< (this->valid? " (valid) " : " (invalid) ");
|
arrayprinter::print(reinterpret_cast<uint8_t*>(address), length);
|
||||||
}
|
|
||||||
sif::debug << std::dec << std::endl;
|
sif::debug << std::dec << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,81 +1,126 @@
|
|||||||
#ifndef POOLENTRY_H_
|
#ifndef FRAMEWORK_DATAPOOL_POOLENTRY_H_
|
||||||
#define 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.
|
* It is prepared for use with plain old data types, but may be
|
||||||
* The content's type is defined by the template argument.
|
* extended to complex types if necessary. It can be initialized with a
|
||||||
* It is prepared for use with plain old data types,
|
* certain value, size and validity flag.
|
||||||
* 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.
|
|
||||||
*
|
*
|
||||||
* \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>
|
template <typename T>
|
||||||
class PoolEntry : public PoolEntryIF {
|
class PoolEntry : public PoolEntryIF {
|
||||||
public:
|
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.
|
* potential init values are copied to that space.
|
||||||
* \param initValue A pointer to the single value or array that holds the init value.
|
* @details
|
||||||
* With the default value (NULL), the entry is initalized with all 0.
|
* Not passing any arguments will initialize an non-array pool entry
|
||||||
* \param set_length Defines the array length of this entry.
|
* (setLength = 1) with an initial invalid state.
|
||||||
* \param set_valid Sets the initialization flag. It is invalid (0) by default.
|
* 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.
|
* @brief In the classe's constructor, space is allocated on the heap and
|
||||||
* \details As the data pool is global, this dtor is only called on program exit.
|
* potential init values are copied to that space.
|
||||||
* PoolEntries shall never be copied, as a copy might delete the variable on the heap.
|
* @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();
|
~PoolEntry();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief This is the address pointing to the allocated memory.
|
* @brief This is the address pointing to the allocated memory.
|
||||||
*/
|
*/
|
||||||
T* address;
|
T* address;
|
||||||
/**
|
/**
|
||||||
* \brief This attribute stores the length information.
|
* @brief This attribute stores the length information.
|
||||||
*/
|
*/
|
||||||
uint8_t length;
|
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.
|
* Every entry (single variable or vector) has one valid flag.
|
||||||
*/
|
*/
|
||||||
uint8_t valid;
|
uint8_t valid;
|
||||||
/**
|
/**
|
||||||
* \brief getSize returns the array size of the entry.
|
* @brief getSize returns the array size of the entry.
|
||||||
* \details A single parameter has size 1.
|
* @details A single parameter has size 1.
|
||||||
*/
|
*/
|
||||||
uint8_t getSize();
|
uint8_t getSize();
|
||||||
/**
|
/**
|
||||||
* \brief This operation returns the size in bytes.
|
* @brief This operation returns the size in bytes.
|
||||||
* \details The size is calculated by sizeof(type) * array_size.
|
* @details The size is calculated by sizeof(type) * array_size.
|
||||||
*/
|
*/
|
||||||
uint16_t getByteSize();
|
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();
|
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.
|
* @brief This is a debug method that prints all values and the valid
|
||||||
* It prints all array entries in a row.
|
* information to the screen. It prints all array entries in a row.
|
||||||
*/
|
*/
|
||||||
void print();
|
void print();
|
||||||
|
|
||||||
|
@ -1,62 +1,57 @@
|
|||||||
/**
|
#ifndef FRAMEWORK_DATAPOOL_POOLENTRYIF_H_
|
||||||
* \file PoolEntryIF.h
|
#define FRAMEWORK_DATAPOOL_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>
|
|
||||||
|
|
||||||
|
|
||||||
|
#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.
|
* @author Bastian Baetz
|
||||||
* It also defines a method to receive a pointer to the raw data content.
|
* @ingroup data_pool
|
||||||
* It is mainly used by DataPool itself, but also as a return pointer.
|
|
||||||
*
|
|
||||||
* \ingroup data_pool
|
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
class PoolEntryIF {
|
class PoolEntryIF {
|
||||||
public:
|
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() {
|
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;
|
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.
|
* sizeof(type) * array_size.
|
||||||
*/
|
*/
|
||||||
virtual uint16_t getByteSize() = 0;
|
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;
|
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.
|
* @brief This is a debug method that prints all values and the valid
|
||||||
* It prints all array entries in a row.
|
* 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;
|
virtual void print() = 0;
|
||||||
/**
|
/**
|
||||||
|
@ -1,13 +1,16 @@
|
|||||||
#include <framework/datapool/DataPool.h>
|
#include "DataPool.h"
|
||||||
#include <framework/datapool/PoolEntryIF.h>
|
#include "PoolEntryIF.h"
|
||||||
#include <framework/datapool/PoolRawAccess.h>
|
#include "PoolRawAccess.h"
|
||||||
#include <framework/serviceinterface/ServiceInterfaceStream.h>
|
#include "../serviceinterface/ServiceInterfaceStream.h"
|
||||||
#include <framework/osal/Endiness.h>
|
#include "../serialize/EndianConverter.h"
|
||||||
|
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
PoolRawAccess::PoolRawAccess(uint32_t set_id, uint8_t setArrayEntry,
|
PoolRawAccess::PoolRawAccess(uint32_t set_id, uint8_t setArrayEntry,
|
||||||
DataSetIF *data_set, ReadWriteMode_t setReadWriteMode) :
|
DataSetIF *data_set, ReadWriteMode_t setReadWriteMode) :
|
||||||
dataPoolId(set_id), arrayEntry(setArrayEntry), valid(false), type(Type::UNKNOWN_TYPE), typeSize(
|
dataPoolId(set_id), arrayEntry(setArrayEntry), valid(false), type(
|
||||||
0), arraySize(0), sizeTillEnd(0), readWriteMode(setReadWriteMode) {
|
Type::UNKNOWN_TYPE), typeSize(0), arraySize(0), sizeTillEnd(0), readWriteMode(
|
||||||
|
setReadWriteMode) {
|
||||||
memset(value, 0, sizeof(value));
|
memset(value, 0, sizeof(value));
|
||||||
if (data_set != NULL) {
|
if (data_set != NULL) {
|
||||||
data_set->registerVariable(this);
|
data_set->registerVariable(this);
|
||||||
@ -42,8 +45,8 @@ ReturnValue_t PoolRawAccess::read() {
|
|||||||
} else {
|
} else {
|
||||||
//Error entry does not exist.
|
//Error entry does not exist.
|
||||||
}
|
}
|
||||||
sif::error << "PoolRawAccess: read of DP Variable 0x" << std::hex << dataPoolId
|
sif::error << "PoolRawAccess: read of DP Variable 0x" << std::hex
|
||||||
<< std::dec << " failed." << std::endl;
|
<< dataPoolId << std::dec << " failed." << std::endl;
|
||||||
valid = INVALID;
|
valid = INVALID;
|
||||||
typeSize = 0;
|
typeSize = 0;
|
||||||
sizeTillEnd = 0;
|
sizeTillEnd = 0;
|
||||||
@ -69,22 +72,16 @@ uint8_t* PoolRawAccess::getEntry() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PoolRawAccess::getEntryEndianSafe(uint8_t *buffer,
|
ReturnValue_t PoolRawAccess::getEntryEndianSafe(uint8_t *buffer,
|
||||||
uint32_t* writtenBytes, uint32_t max_size) {
|
size_t *writtenBytes, size_t maxSize) {
|
||||||
uint8_t *data_ptr = getEntry();
|
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;
|
// 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;
|
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
|
if (typeSize > maxSize) {
|
||||||
memcpy(buffer, data_ptr, typeSize);
|
return INCORRECT_SIZE;
|
||||||
#endif
|
}
|
||||||
|
EndianConverter::convertBigEndian(buffer, data_ptr, typeSize);
|
||||||
*writtenBytes = typeSize;
|
*writtenBytes = typeSize;
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
@ -93,11 +90,11 @@ Type PoolRawAccess::getType() {
|
|||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t PoolRawAccess::getSizeOfType() {
|
size_t PoolRawAccess::getSizeOfType() {
|
||||||
return typeSize;
|
return typeSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t PoolRawAccess::getArraySize(){
|
size_t PoolRawAccess::getArraySize() {
|
||||||
return arraySize;
|
return arraySize;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -110,20 +107,13 @@ PoolVariableIF::ReadWriteMode_t PoolRawAccess::getReadWriteMode() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PoolRawAccess::setEntryFromBigEndian(const uint8_t *buffer,
|
ReturnValue_t PoolRawAccess::setEntryFromBigEndian(const uint8_t *buffer,
|
||||||
uint32_t setSize) {
|
size_t setSize) {
|
||||||
if (typeSize == setSize) {
|
if (typeSize == setSize) {
|
||||||
#ifndef BYTE_ORDER_SYSTEM
|
EndianConverter::convertBigEndian(value, buffer, typeSize);
|
||||||
#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
|
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
} else {
|
} else {
|
||||||
sif::error << "PoolRawAccess::setEntryFromBigEndian: Illegal sizes: Internal"
|
sif::error
|
||||||
|
<< "PoolRawAccess::setEntryFromBigEndian: Illegal sizes: Internal"
|
||||||
<< (uint32_t) typeSize << ", Requested: " << setSize
|
<< (uint32_t) typeSize << ", Requested: " << setSize
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
return INCORRECT_SIZE;
|
return INCORRECT_SIZE;
|
||||||
@ -141,25 +131,24 @@ void PoolRawAccess::setValid(uint8_t valid) {
|
|||||||
this->valid = valid;
|
this->valid = valid;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t PoolRawAccess::getSizeTillEnd() const {
|
size_t PoolRawAccess::getSizeTillEnd() const {
|
||||||
return sizeTillEnd;
|
return sizeTillEnd;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PoolRawAccess::serialize(uint8_t** buffer, uint32_t* size,
|
ReturnValue_t PoolRawAccess::serialize(uint8_t **buffer, size_t *size,
|
||||||
const uint32_t max_size, bool bigEndian) const {
|
size_t maxSize, Endianness streamEndianness) const {
|
||||||
if (typeSize + *size <= max_size) {
|
if (typeSize + *size <= maxSize) {
|
||||||
if (bigEndian) {
|
switch (streamEndianness) {
|
||||||
#ifndef BYTE_ORDER_SYSTEM
|
case (Endianness::BIG):
|
||||||
#error BYTE_ORDER_SYSTEM not defined
|
EndianConverter::convertBigEndian(*buffer, value, typeSize);
|
||||||
#elif BYTE_ORDER_SYSTEM == LITTLE_ENDIAN
|
break;
|
||||||
for (uint8_t count = 0; count < typeSize; count++) {
|
case (Endianness::LITTLE):
|
||||||
(*buffer)[count] = value[typeSize - count - 1];
|
EndianConverter::convertLittleEndian(*buffer, value, typeSize);
|
||||||
}
|
break;
|
||||||
#elif BYTE_ORDER_SYSTEM == BIG_ENDIAN
|
default:
|
||||||
memcpy(*buffer, value, typeSize);
|
case (Endianness::MACHINE):
|
||||||
#endif
|
|
||||||
} else {
|
|
||||||
memcpy(*buffer, value, typeSize);
|
memcpy(*buffer, value, typeSize);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
*size += typeSize;
|
*size += typeSize;
|
||||||
(*buffer) += 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;
|
return typeSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PoolRawAccess::deSerialize(const uint8_t** buffer, int32_t* size,
|
ReturnValue_t PoolRawAccess::deSerialize(const uint8_t **buffer, size_t *size,
|
||||||
bool bigEndian) {
|
Endianness streamEndianness) {
|
||||||
*size -= typeSize;
|
|
||||||
if (*size >= 0) {
|
|
||||||
|
|
||||||
if (bigEndian) {
|
if (*size >= typeSize) {
|
||||||
#ifndef BYTE_ORDER_SYSTEM
|
switch (streamEndianness) {
|
||||||
#error BYTE_ORDER_SYSTEM not defined
|
case (Endianness::BIG):
|
||||||
#elif BYTE_ORDER_SYSTEM == LITTLE_ENDIAN
|
EndianConverter::convertBigEndian(value, *buffer, typeSize);
|
||||||
for (uint8_t count = 0; count < typeSize; count++) {
|
break;
|
||||||
value[count] = (*buffer)[typeSize - count - 1];
|
case (Endianness::LITTLE):
|
||||||
}
|
EndianConverter::convertLittleEndian(value, *buffer, typeSize);
|
||||||
#elif BYTE_ORDER_SYSTEM == BIG_ENDIAN
|
break;
|
||||||
memcpy(value, *buffer, typeSize);
|
default:
|
||||||
#endif
|
case (Endianness::MACHINE):
|
||||||
} else {
|
|
||||||
memcpy(value, *buffer, typeSize);
|
memcpy(value, *buffer, typeSize);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
*size -= typeSize;
|
||||||
*buffer += typeSize;
|
*buffer += typeSize;
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
} else {
|
} else {
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#ifndef POOLRAWACCESS_H_
|
#ifndef POOLRAWACCESS_H_
|
||||||
#define POOLRAWACCESS_H_
|
#define POOLRAWACCESS_H_
|
||||||
|
|
||||||
#include <framework/datapool/DataSetIF.h>
|
#include "DataSetIF.h"
|
||||||
#include <framework/datapool/PoolVariableIF.h>
|
#include "PoolVariableIF.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class allows accessing Data Pool variables as raw bytes.
|
* 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.
|
* \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)
|
* 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.
|
* 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.
|
* \brief The information whether the class is read-write or read-only is stored here.
|
||||||
*/
|
*/
|
||||||
@ -90,15 +90,15 @@ public:
|
|||||||
* \details It makes use of the getEntry call of this function, but additionally flips the
|
* \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-
|
* 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
|
* 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 buffer A pointer to a buffer to write to
|
||||||
* \param writtenBytes The number of bytes written is returned with this value.
|
* \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
|
* \return - \c RETURN_OK if entry could be acquired
|
||||||
* - \c RETURN_FAILED else.
|
* - \c RETURN_FAILED else.
|
||||||
*/
|
*/
|
||||||
ReturnValue_t getEntryEndianSafe(uint8_t* buffer, uint32_t* size,
|
ReturnValue_t getEntryEndianSafe(uint8_t *buffer, size_t *size,
|
||||||
uint32_t max_size);
|
size_t maxSize);
|
||||||
/**
|
/**
|
||||||
* With this method, the content can be set from a big endian buffer safely.
|
* With this method, the content can be set from a big endian buffer safely.
|
||||||
* @param buffer Pointer to the data to set
|
* @param buffer Pointer to the data to set
|
||||||
@ -107,7 +107,7 @@ public:
|
|||||||
* - \c RETURN_FAILED on failure
|
* - \c RETURN_FAILED on failure
|
||||||
*/
|
*/
|
||||||
ReturnValue_t setEntryFromBigEndian(const uint8_t *buffer,
|
ReturnValue_t setEntryFromBigEndian(const uint8_t *buffer,
|
||||||
uint32_t setSize);
|
size_t setSize);
|
||||||
/**
|
/**
|
||||||
* \brief This operation returns the type of the entry currently stored.
|
* \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.
|
* \brief This operation returns the size of the entry currently stored.
|
||||||
*/
|
*/
|
||||||
uint8_t getSizeOfType();
|
size_t getSizeOfType();
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return the size of the datapool array
|
* @return the size of the datapool array
|
||||||
*/
|
*/
|
||||||
uint8_t getArraySize();
|
size_t getArraySize();
|
||||||
/**
|
/**
|
||||||
* \brief This operation returns the data pool id of the variable.
|
* \brief This operation returns the data pool id of the variable.
|
||||||
*/
|
*/
|
||||||
@ -138,15 +138,15 @@ public:
|
|||||||
/**
|
/**
|
||||||
* Getter for the remaining size.
|
* Getter for the remaining size.
|
||||||
*/
|
*/
|
||||||
uint16_t getSizeTillEnd() const;
|
size_t getSizeTillEnd() const;
|
||||||
|
|
||||||
ReturnValue_t serialize(uint8_t** buffer, uint32_t* size,
|
ReturnValue_t serialize(uint8_t **buffer, size_t *size, size_t maxSize,
|
||||||
const uint32_t max_size, bool bigEndian) const;
|
Endianness streamEndianness) const override;
|
||||||
|
|
||||||
uint32_t getSerializedSize() const;
|
size_t getSerializedSize() const override;
|
||||||
|
|
||||||
ReturnValue_t deSerialize(const uint8_t** buffer, int32_t* size,
|
ReturnValue_t deSerialize(const uint8_t **buffer, size_t *size,
|
||||||
bool bigEndian);
|
Endianness streamEndianness) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* POOLRAWACCESS_H_ */
|
#endif /* POOLRAWACCESS_H_ */
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#ifndef POOLVARLIST_H_
|
#ifndef POOLVARLIST_H_
|
||||||
#define POOLVARLIST_H_
|
#define POOLVARLIST_H_
|
||||||
|
|
||||||
#include <framework/datapool/PoolVariable.h>
|
#include "PoolVariable.h"
|
||||||
#include <framework/datapool/PoolVariableIF.h>
|
#include "PoolVariableIF.h"
|
||||||
template <class T, uint8_t n_var>
|
template <class T, uint8_t n_var>
|
||||||
class PoolVarList {
|
class PoolVarList {
|
||||||
private:
|
private:
|
||||||
|
@ -11,11 +11,11 @@
|
|||||||
#ifndef POOLVARIABLE_H_
|
#ifndef POOLVARIABLE_H_
|
||||||
#define POOLVARIABLE_H_
|
#define POOLVARIABLE_H_
|
||||||
|
|
||||||
#include <framework/datapool/DataSetIF.h>
|
#include "DataSetIF.h"
|
||||||
#include <framework/datapool/PoolEntry.h>
|
#include "PoolEntry.h"
|
||||||
#include <framework/datapool/PoolVariableIF.h>
|
#include "PoolVariableIF.h"
|
||||||
#include <framework/serialize/SerializeAdapter.h>
|
#include "../serialize/SerializeAdapter.h"
|
||||||
#include <framework/serviceinterface/ServiceInterfaceStream.h>
|
#include "../serviceinterface/ServiceInterfaceStream.h"
|
||||||
|
|
||||||
template<typename T, uint8_t n_var> class PoolVarList;
|
template<typename T, uint8_t n_var> class PoolVarList;
|
||||||
|
|
||||||
@ -194,19 +194,19 @@ public:
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ReturnValue_t serialize(uint8_t** buffer, uint32_t* size,
|
virtual ReturnValue_t serialize(uint8_t **buffer, size_t *size,
|
||||||
const uint32_t max_size, bool bigEndian) const {
|
size_t maxSize, Endianness streamEndianness) const override {
|
||||||
return SerializeAdapter<T>::serialize(&value, buffer, size, max_size,
|
return SerializeAdapter::serialize<T>(&value, buffer, size, maxSize,
|
||||||
bigEndian);
|
streamEndianness);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual uint32_t getSerializedSize() const {
|
virtual size_t getSerializedSize() const override {
|
||||||
return SerializeAdapter<T>::getSerializedSize(&value);
|
return SerializeAdapter::getSerializedSize(&value);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ReturnValue_t deSerialize(const uint8_t** buffer, int32_t* size,
|
virtual ReturnValue_t deSerialize(const uint8_t **buffer, size_t *size,
|
||||||
bool bigEndian) {
|
Endianness streamEndianness) override {
|
||||||
return SerializeAdapter<T>::deSerialize(&value, buffer, size, bigEndian);
|
return SerializeAdapter::deSerialize(&value, buffer, size, streamEndianness);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -11,8 +11,8 @@
|
|||||||
#ifndef POOLVARIABLEIF_H_
|
#ifndef POOLVARIABLEIF_H_
|
||||||
#define POOLVARIABLEIF_H_
|
#define POOLVARIABLEIF_H_
|
||||||
|
|
||||||
#include <framework/returnvalues/HasReturnvaluesIF.h>
|
#include "../returnvalues/HasReturnvaluesIF.h"
|
||||||
#include <framework/serialize/SerializeIF.h>
|
#include "../serialize/SerializeIF.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief This interface is used to control local data pool variable representations.
|
* \brief This interface is used to control local data pool variable representations.
|
||||||
|
@ -11,11 +11,11 @@
|
|||||||
#ifndef POOLVECTOR_H_
|
#ifndef POOLVECTOR_H_
|
||||||
#define POOLVECTOR_H_
|
#define POOLVECTOR_H_
|
||||||
|
|
||||||
#include <framework/datapool/DataSetIF.h>
|
#include "DataSetIF.h"
|
||||||
#include <framework/datapool/PoolEntry.h>
|
#include "PoolEntry.h"
|
||||||
#include <framework/datapool/PoolVariableIF.h>
|
#include "PoolVariableIF.h"
|
||||||
#include <framework/serialize/SerializeAdapter.h>
|
#include "../serialize/SerializeAdapter.h"
|
||||||
#include <framework/serviceinterface/ServiceInterfaceStream.h>
|
#include "../serviceinterface/ServiceInterfaceStream.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief This is the access class for array-type data pool entries.
|
* \brief This is the access class for array-type data pool entries.
|
||||||
@ -197,13 +197,13 @@ public:
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ReturnValue_t serialize(uint8_t** buffer, uint32_t* size,
|
virtual ReturnValue_t serialize(uint8_t** buffer, size_t* size,
|
||||||
const uint32_t max_size, bool bigEndian) const {
|
size_t maxSize, Endianness streamEndianness) const {
|
||||||
uint16_t i;
|
uint16_t i;
|
||||||
ReturnValue_t result;
|
ReturnValue_t result;
|
||||||
for (i = 0; i < vector_size; i++) {
|
for (i = 0; i < vector_size; i++) {
|
||||||
result = SerializeAdapter<T>::serialize(&(value[i]), buffer, size,
|
result = SerializeAdapter::serialize(&(value[i]), buffer, size,
|
||||||
max_size, bigEndian);
|
maxSize, streamEndianness);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -211,17 +211,17 @@ public:
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual uint32_t getSerializedSize() const {
|
virtual size_t getSerializedSize() const {
|
||||||
return vector_size * SerializeAdapter<T>::getSerializedSize(value);
|
return vector_size * SerializeAdapter::getSerializedSize(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ReturnValue_t deSerialize(const uint8_t** buffer, int32_t* size,
|
virtual ReturnValue_t deSerialize(const uint8_t** buffer, size_t* size,
|
||||||
bool bigEndian) {
|
Endianness streamEndianness) {
|
||||||
uint16_t i;
|
uint16_t i;
|
||||||
ReturnValue_t result;
|
ReturnValue_t result;
|
||||||
for (i = 0; i < vector_size; i++) {
|
for (i = 0; i < vector_size; i++) {
|
||||||
result = SerializeAdapter<T>::deSerialize(&(value[i]), buffer, size,
|
result = SerializeAdapter::deSerialize(&(value[i]), buffer, size,
|
||||||
bigEndian);
|
streamEndianness);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
#ifndef ACCEPTSDEVICERESPONSESIF_H_
|
#ifndef ACCEPTSDEVICERESPONSESIF_H_
|
||||||
#define ACCEPTSDEVICERESPONSESIF_H_
|
#define ACCEPTSDEVICERESPONSESIF_H_
|
||||||
|
|
||||||
#include <framework/ipc/MessageQueueSenderIF.h>
|
#include "../ipc/MessageQueueSenderIF.h"
|
||||||
|
|
||||||
class AcceptsDeviceResponsesIF {
|
class AcceptsDeviceResponsesIF {
|
||||||
public:
|
public:
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#include <framework/devicehandlers/AssemblyBase.h>
|
#include "AssemblyBase.h"
|
||||||
|
|
||||||
AssemblyBase::AssemblyBase(object_id_t objectId, object_id_t parentId,
|
AssemblyBase::AssemblyBase(object_id_t objectId, object_id_t parentId,
|
||||||
uint16_t commandQueueDepth) :
|
uint16_t commandQueueDepth) :
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
#ifndef ASSEMBLYBASE_H_
|
#ifndef ASSEMBLYBASE_H_
|
||||||
#define ASSEMBLYBASE_H_
|
#define ASSEMBLYBASE_H_
|
||||||
|
|
||||||
#include <framework/container/FixedArrayList.h>
|
#include "../container/FixedArrayList.h"
|
||||||
#include <framework/devicehandlers/DeviceHandlerBase.h>
|
#include "DeviceHandlerBase.h"
|
||||||
#include <framework/subsystem/SubsystemBase.h>
|
#include "../subsystem/SubsystemBase.h"
|
||||||
|
|
||||||
class AssemblyBase: public SubsystemBase {
|
class AssemblyBase: public SubsystemBase {
|
||||||
public:
|
public:
|
||||||
|
@ -1,16 +1,17 @@
|
|||||||
#include <framework/subsystem/SubsystemBase.h>
|
#include "../subsystem/SubsystemBase.h"
|
||||||
#include <framework/devicehandlers/ChildHandlerBase.h>
|
#include "ChildHandlerBase.h"
|
||||||
#include <framework/subsystem/SubsystemBase.h>
|
#include "../subsystem/SubsystemBase.h"
|
||||||
|
|
||||||
ChildHandlerBase::ChildHandlerBase(uint32_t ioBoardAddress,
|
ChildHandlerBase::ChildHandlerBase(object_id_t setObjectId,
|
||||||
object_id_t setObjectId, object_id_t deviceCommunication,
|
object_id_t deviceCommunication, CookieIF * comCookie,
|
||||||
uint32_t maxDeviceReplyLen, uint8_t setDeviceSwitch,
|
uint8_t setDeviceSwitch, uint32_t thermalStatePoolId,
|
||||||
uint32_t thermalStatePoolId, uint32_t thermalRequestPoolId,
|
uint32_t thermalRequestPoolId, uint32_t parent,
|
||||||
uint32_t parent, FailureIsolationBase* customFdir, uint32_t cmdQueueSize) :
|
FailureIsolationBase* customFdir, size_t cmdQueueSize) :
|
||||||
DeviceHandlerBase(ioBoardAddress, setObjectId, maxDeviceReplyLen,
|
DeviceHandlerBase(setObjectId, deviceCommunication, comCookie,
|
||||||
setDeviceSwitch, deviceCommunication, thermalStatePoolId,
|
setDeviceSwitch, thermalStatePoolId,thermalRequestPoolId,
|
||||||
thermalRequestPoolId, (customFdir == NULL? &childHandlerFdir : customFdir), cmdQueueSize), parentId(
|
(customFdir == nullptr? &childHandlerFdir : customFdir),
|
||||||
parent), childHandlerFdir(setObjectId) {
|
cmdQueueSize),
|
||||||
|
parentId(parent), childHandlerFdir(setObjectId) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ChildHandlerBase::~ChildHandlerBase() {
|
ChildHandlerBase::~ChildHandlerBase() {
|
||||||
@ -34,7 +35,7 @@ ReturnValue_t ChildHandlerBase::initialize() {
|
|||||||
parent->registerChild(getObjectId());
|
parent->registerChild(getObjectId());
|
||||||
}
|
}
|
||||||
|
|
||||||
healthHelper.setParentQeueue(parentQueue);
|
healthHelper.setParentQueue(parentQueue);
|
||||||
|
|
||||||
modeHelper.setParentQueue(parentQueue);
|
modeHelper.setParentQueue(parentQueue);
|
||||||
|
|
||||||
|
@ -1,17 +1,17 @@
|
|||||||
#ifndef PAYLOADHANDLERBASE_H_
|
#ifndef PAYLOADHANDLERBASE_H_
|
||||||
#define PAYLOADHANDLERBASE_H_
|
#define PAYLOADHANDLERBASE_H_
|
||||||
|
|
||||||
#include <framework/devicehandlers/ChildHandlerFDIR.h>
|
#include "ChildHandlerFDIR.h"
|
||||||
#include <framework/devicehandlers/DeviceHandlerBase.h>
|
#include "DeviceHandlerBase.h"
|
||||||
|
|
||||||
class ChildHandlerBase: public DeviceHandlerBase {
|
class ChildHandlerBase: public DeviceHandlerBase {
|
||||||
public:
|
public:
|
||||||
ChildHandlerBase(uint32_t ioBoardAddress, object_id_t setObjectId,
|
ChildHandlerBase(object_id_t setObjectId,
|
||||||
object_id_t deviceCommunication, uint32_t maxDeviceReplyLen,
|
object_id_t deviceCommunication, CookieIF * comCookie,
|
||||||
uint8_t setDeviceSwitch, uint32_t thermalStatePoolId,
|
uint8_t setDeviceSwitch, uint32_t thermalStatePoolId,
|
||||||
uint32_t thermalRequestPoolId, uint32_t parent,
|
uint32_t thermalRequestPoolId, uint32_t parent,
|
||||||
FailureIsolationBase* customFdir = NULL,
|
FailureIsolationBase* customFdir = nullptr,
|
||||||
uint32_t cmdQueueSize = 20);
|
size_t cmdQueueSize = 20);
|
||||||
virtual ~ChildHandlerBase();
|
virtual ~ChildHandlerBase();
|
||||||
|
|
||||||
virtual ReturnValue_t initialize();
|
virtual ReturnValue_t initialize();
|
||||||
|
@ -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) :
|
ChildHandlerFDIR::ChildHandlerFDIR(object_id_t owner, object_id_t faultTreeParent, uint32_t recoveryCount) :
|
||||||
DeviceHandlerFailureIsolation(owner, faultTreeParent) {
|
DeviceHandlerFailureIsolation(owner, faultTreeParent) {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#ifndef FRAMEWORK_DEVICEHANDLERS_CHILDHANDLERFDIR_H_
|
#ifndef FRAMEWORK_DEVICEHANDLERS_CHILDHANDLERFDIR_H_
|
||||||
#define FRAMEWORK_DEVICEHANDLERS_CHILDHANDLERFDIR_H_
|
#define FRAMEWORK_DEVICEHANDLERS_CHILDHANDLERFDIR_H_
|
||||||
|
|
||||||
#include <framework/devicehandlers/DeviceHandlerFailureIsolation.h>
|
#include "DeviceHandlerFailureIsolation.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Very simple extension to normal FDIR.
|
* Very simple extension to normal FDIR.
|
||||||
|
@ -1,10 +0,0 @@
|
|||||||
#ifndef COOKIE_H_
|
|
||||||
#define COOKIE_H_
|
|
||||||
|
|
||||||
class Cookie{
|
|
||||||
public:
|
|
||||||
virtual ~Cookie(){}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* COOKIE_H_ */
|
|
34
devicehandlers/CookieIF.h
Normal file
34
devicehandlers/CookieIF.h
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
#ifndef COOKIE_H_
|
||||||
|
#define COOKIE_H_
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Physical address type
|
||||||
|
*/
|
||||||
|
typedef std::uint32_t address_t;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This datatype is used to identify different connection over a
|
||||||
|
* single interface (like RMAP or I2C)
|
||||||
|
* @details
|
||||||
|
* To use this class, implement a communication specific child cookie which
|
||||||
|
* inherits Cookie. Cookie instances are created in config/Factory.cpp by
|
||||||
|
* calling @code{.cpp} CookieIF* childCookie = new ChildCookie(...)
|
||||||
|
* @endcode .
|
||||||
|
*
|
||||||
|
* [not implemented yet]
|
||||||
|
* This cookie is then passed to the child device handlers, which stores the
|
||||||
|
* pointer and passes it to the communication interface functions.
|
||||||
|
*
|
||||||
|
* The cookie can be used to store all kinds of information
|
||||||
|
* about the communication, like slave addresses, communication status,
|
||||||
|
* communication parameters etc.
|
||||||
|
*
|
||||||
|
* @ingroup comm
|
||||||
|
*/
|
||||||
|
class CookieIF {
|
||||||
|
public:
|
||||||
|
virtual ~CookieIF() {};
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* COOKIE_H_ */
|
@ -1,63 +1,131 @@
|
|||||||
#ifndef DEVICECOMMUNICATIONIF_H_
|
#ifndef DEVICECOMMUNICATIONIF_H_
|
||||||
#define DEVICECOMMUNICATIONIF_H_
|
#define DEVICECOMMUNICATIONIF_H_
|
||||||
|
|
||||||
#include <framework/devicehandlers/Cookie.h>
|
#include "CookieIF.h"
|
||||||
#include <framework/returnvalues/HasReturnvaluesIF.h>
|
#include "../returnvalues/HasReturnvaluesIF.h"
|
||||||
|
#include <cstddef>
|
||||||
|
/**
|
||||||
|
* @defgroup interfaces Interfaces
|
||||||
|
* @brief Interfaces for flight software objects
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @defgroup comm Communication
|
||||||
|
* @brief Communication software components.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This is an interface to decouple device communication from
|
||||||
|
* the device handler to allow reuse of these components.
|
||||||
|
* @details
|
||||||
|
* Documentation: Dissertation Baetz p.138.
|
||||||
|
* It works with the assumption that received data
|
||||||
|
* is polled by a component. There are four generic steps of device communication:
|
||||||
|
*
|
||||||
|
* 1. Send data to a device
|
||||||
|
* 2. Get acknowledgement for sending
|
||||||
|
* 3. Request reading data from a device
|
||||||
|
* 4. Read received data
|
||||||
|
*
|
||||||
|
* To identify different connection over a single interface can return
|
||||||
|
* so-called cookies to components.
|
||||||
|
* The CommunicationMessage message type can be used to extend the
|
||||||
|
* functionality of the ComIF if a separate polling task is required.
|
||||||
|
* @ingroup interfaces
|
||||||
|
* @ingroup comm
|
||||||
|
*/
|
||||||
class DeviceCommunicationIF: public HasReturnvaluesIF {
|
class DeviceCommunicationIF: public HasReturnvaluesIF {
|
||||||
public:
|
public:
|
||||||
static const uint8_t INTERFACE_ID = CLASS_ID::DEVICE_COMMUNICATION_IF;
|
static const uint8_t INTERFACE_ID = CLASS_ID::DEVICE_COMMUNICATION_IF;
|
||||||
|
|
||||||
static const ReturnValue_t INVALID_COOKIE_TYPE = MAKE_RETURN_CODE(0x01);
|
//! Standard Error Codes
|
||||||
static const ReturnValue_t NOT_ACTIVE = MAKE_RETURN_CODE(0x02);
|
//! General protocol error. Define more concrete errors in child handler
|
||||||
static const ReturnValue_t INVALID_ADDRESS = MAKE_RETURN_CODE(0x03);
|
static const ReturnValue_t PROTOCOL_ERROR = MAKE_RETURN_CODE(0x01);
|
||||||
static const ReturnValue_t TOO_MUCH_DATA = MAKE_RETURN_CODE(0x04);
|
//! If cookie is a null pointer
|
||||||
static const ReturnValue_t NULLPOINTER = MAKE_RETURN_CODE(0x05);
|
static const ReturnValue_t NULLPOINTER = MAKE_RETURN_CODE(0x02);
|
||||||
static const ReturnValue_t PROTOCOL_ERROR = MAKE_RETURN_CODE(0x06);
|
static const ReturnValue_t INVALID_COOKIE_TYPE = MAKE_RETURN_CODE(0x03);
|
||||||
static const ReturnValue_t CANT_CHANGE_REPLY_LEN = MAKE_RETURN_CODE(0x07);
|
// is this needed if there is no open/close call?
|
||||||
|
static const ReturnValue_t NOT_ACTIVE = MAKE_RETURN_CODE(0x05);
|
||||||
|
static const ReturnValue_t INVALID_ADDRESS = MAKE_RETURN_CODE(0x06);
|
||||||
|
static const ReturnValue_t TOO_MUCH_DATA = MAKE_RETURN_CODE(0x07);
|
||||||
|
static const ReturnValue_t CANT_CHANGE_REPLY_LEN = MAKE_RETURN_CODE(0x08);
|
||||||
|
|
||||||
virtual ~DeviceCommunicationIF() {
|
//! Can be used in readReceivedMessage() if no reply was received.
|
||||||
|
static const ReturnValue_t NO_REPLY_RECEIVED = MAKE_RETURN_CODE(0xA1);
|
||||||
|
|
||||||
}
|
virtual ~DeviceCommunicationIF() {}
|
||||||
|
|
||||||
virtual ReturnValue_t open(Cookie **cookie, uint32_t address,
|
|
||||||
uint32_t maxReplyLen) = 0;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use an existing cookie to open a connection to a new DeviceCommunication.
|
* @brief Device specific initialization, using the cookie.
|
||||||
* The previous connection must not be closed.
|
* @details
|
||||||
* If the returnvalue is not RETURN_OK, the cookie is unchanged and
|
* The cookie is already prepared in the factory. If the communication
|
||||||
* can be used with the previous connection.
|
* interface needs to be set up in some way and requires cookie information,
|
||||||
|
* this can be performed in this function, which is called on device handler
|
||||||
|
* initialization.
|
||||||
|
* @param cookie
|
||||||
|
* @return
|
||||||
|
* - @c RETURN_OK if initialization was successfull
|
||||||
|
* - Everything else triggers failure event with returnvalue as parameter 1
|
||||||
|
*/
|
||||||
|
virtual ReturnValue_t initializeInterface(CookieIF * cookie) = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called by DHB in the SEND_WRITE doSendWrite().
|
||||||
|
* This function is used to send data to the physical device
|
||||||
|
* by implementing and calling related drivers or wrapper functions.
|
||||||
|
* @param cookie
|
||||||
|
* @param data
|
||||||
|
* @param len
|
||||||
|
* @return
|
||||||
|
* - @c RETURN_OK for successfull send
|
||||||
|
* - Everything else triggers failure event with returnvalue as parameter 1
|
||||||
|
*/
|
||||||
|
virtual ReturnValue_t sendMessage(CookieIF *cookie, const uint8_t * sendData,
|
||||||
|
size_t sendLen) = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called by DHB in the GET_WRITE doGetWrite().
|
||||||
|
* Get send confirmation that the data in sendMessage() was sent successfully.
|
||||||
|
* @param cookie
|
||||||
|
* @return - @c RETURN_OK if data was sent successfull
|
||||||
|
* - Everything else triggers falure event with
|
||||||
|
* returnvalue as parameter 1
|
||||||
|
*/
|
||||||
|
virtual ReturnValue_t getSendSuccess(CookieIF *cookie) = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called by DHB in the SEND_WRITE doSendRead().
|
||||||
|
* It is assumed that it is always possible to request a reply
|
||||||
|
* from a device. If a requestLen of 0 is supplied, no reply was enabled
|
||||||
|
* and communication specific action should be taken (e.g. read nothing
|
||||||
|
* or read everything).
|
||||||
*
|
*
|
||||||
* @param cookie
|
* @param cookie
|
||||||
* @param address
|
* @param requestLen Size of data to read
|
||||||
* @param maxReplyLen
|
* @return - @c RETURN_OK to confirm the request for data has been sent.
|
||||||
* @return
|
* - Everything else triggers failure event with
|
||||||
|
* returnvalue as parameter 1
|
||||||
*/
|
*/
|
||||||
virtual ReturnValue_t reOpen(Cookie *cookie, uint32_t address,
|
virtual ReturnValue_t requestReceiveMessage(CookieIF *cookie,
|
||||||
uint32_t maxReplyLen) = 0;
|
size_t requestLen) = 0;
|
||||||
|
|
||||||
virtual void close(Cookie *cookie) = 0;
|
|
||||||
|
|
||||||
//SHOULDDO can data be const?
|
|
||||||
virtual ReturnValue_t sendMessage(Cookie *cookie, uint8_t *data,
|
|
||||||
uint32_t len) = 0;
|
|
||||||
|
|
||||||
virtual ReturnValue_t getSendSuccess(Cookie *cookie) = 0;
|
|
||||||
|
|
||||||
virtual ReturnValue_t requestReceiveMessage(Cookie *cookie) = 0;
|
|
||||||
|
|
||||||
virtual ReturnValue_t readReceivedMessage(Cookie *cookie, uint8_t **buffer,
|
|
||||||
uint32_t *size) = 0;
|
|
||||||
|
|
||||||
virtual ReturnValue_t setAddress(Cookie *cookie, uint32_t address) = 0;
|
|
||||||
|
|
||||||
virtual uint32_t getAddress(Cookie *cookie) = 0;
|
|
||||||
|
|
||||||
virtual ReturnValue_t setParameter(Cookie *cookie, uint32_t parameter) = 0;
|
|
||||||
|
|
||||||
virtual uint32_t getParameter(Cookie *cookie) = 0;
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called by DHB in the GET_WRITE doGetRead().
|
||||||
|
* This function is used to receive data from the physical device
|
||||||
|
* by implementing and calling related drivers or wrapper functions.
|
||||||
|
* @param cookie
|
||||||
|
* @param buffer [out] Set reply here (by using *buffer = ...)
|
||||||
|
* @param size [out] size pointer to set (by using *size = ...).
|
||||||
|
* Set to 0 if no reply was received
|
||||||
|
* @return - @c RETURN_OK for successfull receive
|
||||||
|
* - @c NO_REPLY_RECEIVED if not reply was received. Setting size to
|
||||||
|
* 0 has the same effect
|
||||||
|
* - Everything else triggers failure event with
|
||||||
|
* returnvalue as parameter 1
|
||||||
|
*/
|
||||||
|
virtual ReturnValue_t readReceivedMessage(CookieIF *cookie, uint8_t **buffer,
|
||||||
|
size_t *size) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* DEVICECOMMUNICATIONIF_H_ */
|
#endif /* DEVICECOMMUNICATIONIF_H_ */
|
||||||
|
@ -1,52 +1,60 @@
|
|||||||
#include <framework/datapool/DataSet.h>
|
#include "DeviceHandlerBase.h"
|
||||||
#include <framework/datapool/PoolVariable.h>
|
#include "../objectmanager/ObjectManager.h"
|
||||||
#include <framework/datapool/PoolVector.h>
|
#include "../storagemanager/StorageManagerIF.h"
|
||||||
#include <framework/devicehandlers/AcceptsDeviceResponsesIF.h>
|
#include "../thermal/ThermalComponentIF.h"
|
||||||
#include <framework/devicehandlers/DeviceHandlerBase.h>
|
#include "AcceptsDeviceResponsesIF.h"
|
||||||
#include <framework/devicehandlers/DeviceTmReportingWrapper.h>
|
|
||||||
#include <framework/globalfunctions/CRC.h>
|
#include "../datapool/DataSet.h"
|
||||||
#include <framework/objectmanager/ObjectManager.h>
|
#include "../datapool/PoolVariable.h"
|
||||||
#include <framework/storagemanager/StorageManagerIF.h>
|
#include "DeviceTmReportingWrapper.h"
|
||||||
#include <framework/subsystem/SubsystemBase.h>
|
#include "../globalfunctions/CRC.h"
|
||||||
#include <framework/thermal/ThermalComponentIF.h>
|
#include "../subsystem/SubsystemBase.h"
|
||||||
#include <framework/ipc/QueueFactory.h>
|
#include "../ipc/QueueFactory.h"
|
||||||
#include <framework/serviceinterface/ServiceInterfaceStream.h>
|
#include "../serviceinterface/ServiceInterfaceStream.h"
|
||||||
|
|
||||||
|
#include <iomanip>
|
||||||
|
|
||||||
object_id_t DeviceHandlerBase::powerSwitcherId = 0;
|
object_id_t DeviceHandlerBase::powerSwitcherId = 0;
|
||||||
object_id_t DeviceHandlerBase::rawDataReceiverId = 0;
|
object_id_t DeviceHandlerBase::rawDataReceiverId = 0;
|
||||||
object_id_t DeviceHandlerBase::defaultFDIRParentId = 0;
|
object_id_t DeviceHandlerBase::defaultFDIRParentId = 0;
|
||||||
|
|
||||||
DeviceHandlerBase::DeviceHandlerBase(uint32_t ioBoardAddress,
|
DeviceHandlerBase::DeviceHandlerBase(object_id_t setObjectId,
|
||||||
object_id_t setObjectId, uint32_t maxDeviceReplyLen,
|
object_id_t deviceCommunication, CookieIF * comCookie,
|
||||||
uint8_t setDeviceSwitch, object_id_t deviceCommunication,
|
uint8_t setDeviceSwitch, uint32_t thermalStatePoolId,
|
||||||
uint32_t thermalStatePoolId, uint32_t thermalRequestPoolId,
|
uint32_t thermalRequestPoolId, FailureIsolationBase* fdirInstance,
|
||||||
FailureIsolationBase* fdirInstance, uint32_t cmdQueueSize) :
|
size_t cmdQueueSize) :
|
||||||
SystemObject(setObjectId), rawPacket(0), rawPacketLen(0), mode(
|
SystemObject(setObjectId), mode(MODE_OFF), submode(SUBMODE_NONE),
|
||||||
MODE_OFF), submode(SUBMODE_NONE), pstStep(0), maxDeviceReplyLen(
|
wiretappingMode(OFF), storedRawData(StorageManagerIF::INVALID_ADDRESS),
|
||||||
maxDeviceReplyLen), wiretappingMode(OFF), defaultRawReceiver(0), storedRawData(
|
deviceCommunicationId(deviceCommunication), comCookie(comCookie),
|
||||||
StorageManagerIF::INVALID_ADDRESS), requestedRawTraffic(0), powerSwitcher(
|
deviceThermalStatePoolId(thermalStatePoolId),
|
||||||
NULL), IPCStore(NULL), deviceCommunicationId(deviceCommunication), communicationInterface(
|
deviceThermalRequestPoolId(thermalRequestPoolId),
|
||||||
NULL), cookie(
|
healthHelper(this,setObjectId), modeHelper(this), parameterHelper(this),
|
||||||
NULL), commandQueue(NULL), deviceThermalStatePoolId(thermalStatePoolId), deviceThermalRequestPoolId(
|
childTransitionFailure(RETURN_OK), fdirInstance(fdirInstance),
|
||||||
thermalRequestPoolId), healthHelper(this, setObjectId), modeHelper(
|
hkSwitcher(this), defaultFDIRUsed(fdirInstance == nullptr),
|
||||||
this), parameterHelper(this), childTransitionFailure(RETURN_OK), ignoreMissedRepliesCount(
|
switchOffWasReported(false), actionHelper(this, nullptr),
|
||||||
0), fdirInstance(fdirInstance), hkSwitcher(this), defaultFDIRUsed(
|
childTransitionDelay(5000),
|
||||||
fdirInstance == NULL), switchOffWasReported(false),executingTask(NULL), actionHelper(this, NULL), cookieInfo(), ioBoardAddress(
|
transitionSourceMode(_MODE_POWER_DOWN), transitionSourceSubMode(
|
||||||
ioBoardAddress), timeoutStart(0), childTransitionDelay(5000), transitionSourceMode(
|
SUBMODE_NONE), deviceSwitch(setDeviceSwitch) {
|
||||||
_MODE_POWER_DOWN), transitionSourceSubMode(SUBMODE_NONE), deviceSwitch(
|
|
||||||
setDeviceSwitch) {
|
|
||||||
commandQueue = QueueFactory::instance()->createMessageQueue(cmdQueueSize,
|
commandQueue = QueueFactory::instance()->createMessageQueue(cmdQueueSize,
|
||||||
CommandMessage::MAX_MESSAGE_SIZE);
|
CommandMessage::MAX_MESSAGE_SIZE);
|
||||||
cookieInfo.state = COOKIE_UNUSED;
|
|
||||||
insertInCommandMap(RAW_COMMAND_ID);
|
insertInCommandMap(RAW_COMMAND_ID);
|
||||||
if (this->fdirInstance == NULL) {
|
cookieInfo.state = COOKIE_UNUSED;
|
||||||
|
cookieInfo.pendingCommand = deviceCommandMap.end();
|
||||||
|
if (comCookie == nullptr) {
|
||||||
|
sif::error << "DeviceHandlerBase: ObjectID 0x" << std::hex <<
|
||||||
|
std::setw(8) << std::setfill('0') << this->getObjectId() <<
|
||||||
|
std::dec << ": Do not pass nullptr as a cookie, consider "
|
||||||
|
<< std::setfill(' ') << "passing a dummy cookie instead!" <<
|
||||||
|
std::endl;
|
||||||
|
}
|
||||||
|
if (this->fdirInstance == nullptr) {
|
||||||
this->fdirInstance = new DeviceHandlerFailureIsolation(setObjectId,
|
this->fdirInstance = new DeviceHandlerFailureIsolation(setObjectId,
|
||||||
defaultFDIRParentId);
|
defaultFDIRParentId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DeviceHandlerBase::~DeviceHandlerBase() {
|
DeviceHandlerBase::~DeviceHandlerBase() {
|
||||||
communicationInterface->close(cookie);
|
delete comCookie;
|
||||||
if (defaultFDIRUsed) {
|
if (defaultFDIRUsed) {
|
||||||
delete fdirInstance;
|
delete fdirInstance;
|
||||||
}
|
}
|
||||||
@ -56,7 +64,7 @@ DeviceHandlerBase::~DeviceHandlerBase() {
|
|||||||
ReturnValue_t DeviceHandlerBase::performOperation(uint8_t counter) {
|
ReturnValue_t DeviceHandlerBase::performOperation(uint8_t counter) {
|
||||||
this->pstStep = counter;
|
this->pstStep = counter;
|
||||||
|
|
||||||
if (counter == 0) {
|
if (getComAction() == SEND_WRITE) {
|
||||||
cookieInfo.state = COOKIE_UNUSED;
|
cookieInfo.state = COOKIE_UNUSED;
|
||||||
readCommandQueue();
|
readCommandQueue();
|
||||||
doStateMachine();
|
doStateMachine();
|
||||||
@ -64,11 +72,12 @@ ReturnValue_t DeviceHandlerBase::performOperation(uint8_t counter) {
|
|||||||
decrementDeviceReplyMap();
|
decrementDeviceReplyMap();
|
||||||
fdirInstance->checkForFailures();
|
fdirInstance->checkForFailures();
|
||||||
hkSwitcher.performOperation();
|
hkSwitcher.performOperation();
|
||||||
|
performOperationHook();
|
||||||
}
|
}
|
||||||
if (mode == MODE_OFF) {
|
if (mode == MODE_OFF) {
|
||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
switch (getRmapAction()) {
|
switch (getComAction()) {
|
||||||
case SEND_WRITE:
|
case SEND_WRITE:
|
||||||
if ((cookieInfo.state == COOKIE_UNUSED)) {
|
if ((cookieInfo.state == COOKIE_UNUSED)) {
|
||||||
buildInternalCommand();
|
buildInternalCommand();
|
||||||
@ -91,13 +100,91 @@ ReturnValue_t DeviceHandlerBase::performOperation(uint8_t counter) {
|
|||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ReturnValue_t DeviceHandlerBase::initialize() {
|
||||||
|
ReturnValue_t result = SystemObject::initialize();
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
communicationInterface = objectManager->get<DeviceCommunicationIF>(
|
||||||
|
deviceCommunicationId);
|
||||||
|
if (communicationInterface == NULL) {
|
||||||
|
return RETURN_FAILED;
|
||||||
|
}
|
||||||
|
|
||||||
|
result = communicationInterface->initializeInterface(comCookie);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
IPCStore = objectManager->get<StorageManagerIF>(objects::IPC_STORE);
|
||||||
|
if (IPCStore == NULL) {
|
||||||
|
return RETURN_FAILED;
|
||||||
|
}
|
||||||
|
|
||||||
|
AcceptsDeviceResponsesIF *rawReceiver = objectManager->get<
|
||||||
|
AcceptsDeviceResponsesIF>(rawDataReceiverId);
|
||||||
|
|
||||||
|
if (rawReceiver == NULL) {
|
||||||
|
return RETURN_FAILED;
|
||||||
|
}
|
||||||
|
|
||||||
|
defaultRawReceiver = rawReceiver->getDeviceQueue();
|
||||||
|
|
||||||
|
powerSwitcher = objectManager->get<PowerSwitchIF>(powerSwitcherId);
|
||||||
|
if (powerSwitcher == NULL) {
|
||||||
|
return RETURN_FAILED;
|
||||||
|
}
|
||||||
|
|
||||||
|
result = healthHelper.initialize();
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
result = modeHelper.initialize();
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
result = actionHelper.initialize(commandQueue);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
result = fdirInstance->initialize();
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
result = parameterHelper.initialize();
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
result = hkSwitcher.initialize();
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
fillCommandAndReplyMap();
|
||||||
|
|
||||||
|
//Set temperature target state to NON_OP.
|
||||||
|
DataSet mySet;
|
||||||
|
PoolVariable<int8_t> thermalRequest(deviceThermalRequestPoolId, &mySet,
|
||||||
|
PoolVariableIF::VAR_WRITE);
|
||||||
|
mySet.read();
|
||||||
|
thermalRequest = ThermalComponentIF::STATE_REQUEST_NON_OPERATIONAL;
|
||||||
|
mySet.commit(PoolVariableIF::VALID);
|
||||||
|
|
||||||
|
return RETURN_OK;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void DeviceHandlerBase::decrementDeviceReplyMap() {
|
void DeviceHandlerBase::decrementDeviceReplyMap() {
|
||||||
for (std::map<DeviceCommandId_t, DeviceReplyInfo>::iterator iter =
|
for (std::map<DeviceCommandId_t, DeviceReplyInfo>::iterator iter =
|
||||||
deviceReplyMap.begin(); iter != deviceReplyMap.end(); iter++) {
|
deviceReplyMap.begin(); iter != deviceReplyMap.end(); iter++) {
|
||||||
if (iter->second.delayCycles != 0) {
|
if (iter->second.delayCycles != 0) {
|
||||||
iter->second.delayCycles--;
|
iter->second.delayCycles--;
|
||||||
if (iter->second.delayCycles == 0) {
|
if (iter->second.delayCycles == 0) {
|
||||||
if (iter->second.periodic != 0) {
|
if (iter->second.periodic) {
|
||||||
iter->second.delayCycles = iter->second.maxDelayCycles;
|
iter->second.delayCycles = iter->second.maxDelayCycles;
|
||||||
}
|
}
|
||||||
replyToReply(iter, TIMEOUT);
|
replyToReply(iter, TIMEOUT);
|
||||||
@ -149,7 +236,7 @@ void DeviceHandlerBase::readCommandQueue() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
replyReturnvalueToCommand(CommandMessage::UNKNOW_COMMAND);
|
replyReturnvalueToCommand(CommandMessage::UNKNOWN_COMMAND);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -256,55 +343,49 @@ ReturnValue_t DeviceHandlerBase::isModeCombinationValid(Mode_t mode,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t DeviceHandlerBase::insertInCommandAndReplyMap(
|
ReturnValue_t DeviceHandlerBase::insertInCommandAndReplyMap(DeviceCommandId_t deviceCommand,
|
||||||
DeviceCommandId_t deviceCommand, uint16_t maxDelayCycles,
|
uint16_t maxDelayCycles, size_t replyLen, bool periodic,
|
||||||
uint8_t periodic, bool hasDifferentReplyId, DeviceCommandId_t replyId) {
|
bool hasDifferentReplyId, DeviceCommandId_t replyId) {
|
||||||
//No need to check, as we may try to insert multiple times.
|
//No need to check, as we may try to insert multiple times.
|
||||||
insertInCommandMap(deviceCommand);
|
insertInCommandMap(deviceCommand);
|
||||||
if (hasDifferentReplyId) {
|
if (hasDifferentReplyId) {
|
||||||
return insertInReplyMap(replyId, maxDelayCycles, periodic);
|
return insertInReplyMap(replyId, maxDelayCycles, replyLen, periodic);
|
||||||
} else {
|
} else {
|
||||||
return insertInReplyMap(deviceCommand, maxDelayCycles, periodic);
|
return insertInReplyMap(deviceCommand, maxDelayCycles, replyLen, periodic);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t DeviceHandlerBase::insertInReplyMap(DeviceCommandId_t replyId,
|
ReturnValue_t DeviceHandlerBase::insertInReplyMap(DeviceCommandId_t replyId,
|
||||||
uint16_t maxDelayCycles, uint8_t periodic) {
|
uint16_t maxDelayCycles, size_t replyLen, bool periodic) {
|
||||||
DeviceReplyInfo info;
|
DeviceReplyInfo info;
|
||||||
info.maxDelayCycles = maxDelayCycles;
|
info.maxDelayCycles = maxDelayCycles;
|
||||||
info.periodic = periodic;
|
info.periodic = periodic;
|
||||||
info.delayCycles = 0;
|
info.delayCycles = 0;
|
||||||
|
info.replyLen = replyLen;
|
||||||
info.command = deviceCommandMap.end();
|
info.command = deviceCommandMap.end();
|
||||||
std::pair<std::map<DeviceCommandId_t, DeviceReplyInfo>::iterator, bool> returnValue;
|
auto resultPair = deviceReplyMap.emplace(replyId, info);
|
||||||
returnValue = deviceReplyMap.insert(
|
if (resultPair.second) {
|
||||||
std::pair<DeviceCommandId_t, DeviceReplyInfo>(replyId, info));
|
|
||||||
if (returnValue.second) {
|
|
||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
} else {
|
} else {
|
||||||
return RETURN_FAILED;
|
return RETURN_FAILED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t DeviceHandlerBase::insertInCommandMap(
|
ReturnValue_t DeviceHandlerBase::insertInCommandMap(DeviceCommandId_t deviceCommand) {
|
||||||
DeviceCommandId_t deviceCommand) {
|
|
||||||
DeviceCommandInfo info;
|
DeviceCommandInfo info;
|
||||||
info.expectedReplies = 0;
|
info.expectedReplies = 0;
|
||||||
info.isExecuting = false;
|
info.isExecuting = false;
|
||||||
info.sendReplyTo = NO_COMMANDER;
|
info.sendReplyTo = NO_COMMANDER;
|
||||||
std::pair<std::map<DeviceCommandId_t, DeviceCommandInfo>::iterator, bool> returnValue;
|
auto resultPair = deviceCommandMap.emplace(deviceCommand, info);
|
||||||
returnValue = deviceCommandMap.insert(
|
if (resultPair.second) {
|
||||||
std::pair<DeviceCommandId_t, DeviceCommandInfo>(deviceCommand,
|
|
||||||
info));
|
|
||||||
if (returnValue.second) {
|
|
||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
} else {
|
} else {
|
||||||
return RETURN_FAILED;
|
return RETURN_FAILED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t DeviceHandlerBase::updateReplyMapEntry(
|
ReturnValue_t DeviceHandlerBase::updateReplyMapEntry(DeviceCommandId_t deviceReply,
|
||||||
DeviceCommandId_t deviceReply, uint16_t delayCycles,
|
uint16_t delayCycles, uint16_t maxDelayCycles, bool periodic) {
|
||||||
uint16_t maxDelayCycles, uint8_t periodic) {
|
|
||||||
std::map<DeviceCommandId_t, DeviceReplyInfo>::iterator iter =
|
std::map<DeviceCommandId_t, DeviceReplyInfo>::iterator iter =
|
||||||
deviceReplyMap.find(deviceReply);
|
deviceReplyMap.find(deviceReply);
|
||||||
if (iter == deviceReplyMap.end()) {
|
if (iter == deviceReplyMap.end()) {
|
||||||
@ -429,7 +510,7 @@ void DeviceHandlerBase::replyToReply(DeviceReplyMap::iterator iter,
|
|||||||
void DeviceHandlerBase::doSendWrite() {
|
void DeviceHandlerBase::doSendWrite() {
|
||||||
if (cookieInfo.state == COOKIE_WRITE_READY) {
|
if (cookieInfo.state == COOKIE_WRITE_READY) {
|
||||||
|
|
||||||
ReturnValue_t result = communicationInterface->sendMessage(cookie,
|
ReturnValue_t result = communicationInterface->sendMessage(comCookie,
|
||||||
rawPacket, rawPacketLen);
|
rawPacket, rawPacketLen);
|
||||||
|
|
||||||
if (result == RETURN_OK) {
|
if (result == RETURN_OK) {
|
||||||
@ -450,12 +531,14 @@ void DeviceHandlerBase::doGetWrite() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
cookieInfo.state = COOKIE_UNUSED;
|
cookieInfo.state = COOKIE_UNUSED;
|
||||||
ReturnValue_t result = communicationInterface->getSendSuccess(cookie);
|
ReturnValue_t result = communicationInterface->getSendSuccess(comCookie);
|
||||||
if (result == RETURN_OK) {
|
if (result == RETURN_OK) {
|
||||||
if (wiretappingMode == RAW) {
|
if (wiretappingMode == RAW) {
|
||||||
replyRawData(rawPacket, rawPacketLen, requestedRawTraffic, true);
|
replyRawData(rawPacket, rawPacketLen, requestedRawTraffic, true);
|
||||||
}
|
}
|
||||||
//We need to distinguish here, because a raw command never expects a reply. (Could be done in eRIRM, but then child implementations need to be careful.
|
|
||||||
|
//We need to distinguish here, because a raw command never expects a reply.
|
||||||
|
//(Could be done in eRIRM, but then child implementations need to be careful.
|
||||||
result = enableReplyInReplyMap(cookieInfo.pendingCommand);
|
result = enableReplyInReplyMap(cookieInfo.pendingCommand);
|
||||||
} else {
|
} else {
|
||||||
//always generate a failure event, so that FDIR knows what's up
|
//always generate a failure event, so that FDIR knows what's up
|
||||||
@ -471,7 +554,17 @@ void DeviceHandlerBase::doGetWrite() {
|
|||||||
void DeviceHandlerBase::doSendRead() {
|
void DeviceHandlerBase::doSendRead() {
|
||||||
ReturnValue_t result;
|
ReturnValue_t result;
|
||||||
|
|
||||||
result = communicationInterface->requestReceiveMessage(cookie);
|
size_t requestLen = 0;
|
||||||
|
if(cookieInfo.pendingCommand != deviceCommandMap.end()) {
|
||||||
|
DeviceReplyIter iter = deviceReplyMap.find(
|
||||||
|
cookieInfo.pendingCommand->first);
|
||||||
|
if(iter != deviceReplyMap.end()) {
|
||||||
|
requestLen = iter->second.replyLen;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
result = communicationInterface->requestReceiveMessage(comCookie, requestLen);
|
||||||
|
|
||||||
if (result == RETURN_OK) {
|
if (result == RETURN_OK) {
|
||||||
cookieInfo.state = COOKIE_READ_SENT;
|
cookieInfo.state = COOKIE_READ_SENT;
|
||||||
} else {
|
} else {
|
||||||
@ -485,10 +578,10 @@ void DeviceHandlerBase::doSendRead() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void DeviceHandlerBase::doGetRead() {
|
void DeviceHandlerBase::doGetRead() {
|
||||||
uint32_t receivedDataLen;
|
size_t receivedDataLen;
|
||||||
uint8_t *receivedData;
|
uint8_t *receivedData;
|
||||||
DeviceCommandId_t foundId = 0xFFFFFFFF;
|
DeviceCommandId_t foundId = 0xFFFFFFFF;
|
||||||
uint32_t foundLen = 0;
|
size_t foundLen = 0;
|
||||||
ReturnValue_t result;
|
ReturnValue_t result;
|
||||||
|
|
||||||
if (cookieInfo.state != COOKIE_READ_SENT) {
|
if (cookieInfo.state != COOKIE_READ_SENT) {
|
||||||
@ -498,8 +591,8 @@ void DeviceHandlerBase::doGetRead() {
|
|||||||
|
|
||||||
cookieInfo.state = COOKIE_UNUSED;
|
cookieInfo.state = COOKIE_UNUSED;
|
||||||
|
|
||||||
result = communicationInterface->readReceivedMessage(cookie, &receivedData,
|
result = communicationInterface->readReceivedMessage(comCookie,
|
||||||
&receivedDataLen);
|
&receivedData, &receivedDataLen);
|
||||||
|
|
||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
triggerEvent(DEVICE_REQUESTING_REPLY_FAILED, result);
|
triggerEvent(DEVICE_REQUESTING_REPLY_FAILED, result);
|
||||||
@ -508,7 +601,7 @@ void DeviceHandlerBase::doGetRead() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (receivedDataLen == 0)
|
if (receivedDataLen == 0 or result == DeviceCommunicationIF::NO_REPLY_RECEIVED)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (wiretappingMode == RAW) {
|
if (wiretappingMode == RAW) {
|
||||||
@ -539,6 +632,8 @@ void DeviceHandlerBase::doGetRead() {
|
|||||||
break;
|
break;
|
||||||
case IGNORE_REPLY_DATA:
|
case IGNORE_REPLY_DATA:
|
||||||
break;
|
break;
|
||||||
|
case IGNORE_FULL_PACKET:
|
||||||
|
return;
|
||||||
default:
|
default:
|
||||||
//We need to wait for timeout.. don't know what command failed and who sent it.
|
//We need to wait for timeout.. don't know what command failed and who sent it.
|
||||||
replyRawReplyIfnotWiretapped(receivedData, foundLen);
|
replyRawReplyIfnotWiretapped(receivedData, foundLen);
|
||||||
@ -560,8 +655,8 @@ ReturnValue_t DeviceHandlerBase::getStorageData(store_address_t storageAddress,
|
|||||||
uint8_t * *data, uint32_t * len) {
|
uint8_t * *data, uint32_t * len) {
|
||||||
size_t lenTmp;
|
size_t lenTmp;
|
||||||
|
|
||||||
if (IPCStore == NULL) {
|
if (IPCStore == nullptr) {
|
||||||
*data = NULL;
|
*data = nullptr;
|
||||||
*len = 0;
|
*len = 0;
|
||||||
return RETURN_FAILED;
|
return RETURN_FAILED;
|
||||||
}
|
}
|
||||||
@ -572,90 +667,10 @@ ReturnValue_t DeviceHandlerBase::getStorageData(store_address_t storageAddress,
|
|||||||
} else {
|
} else {
|
||||||
triggerEvent(StorageManagerIF::GET_DATA_FAILED, result,
|
triggerEvent(StorageManagerIF::GET_DATA_FAILED, result,
|
||||||
storageAddress.raw);
|
storageAddress.raw);
|
||||||
*data = NULL;
|
*data = nullptr;
|
||||||
*len = 0;
|
*len = 0;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
ReturnValue_t DeviceHandlerBase::initialize() {
|
|
||||||
ReturnValue_t result = SystemObject::initialize();
|
|
||||||
if (result != RETURN_OK) {
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
communicationInterface = objectManager->get<DeviceCommunicationIF>(
|
|
||||||
deviceCommunicationId);
|
|
||||||
if (communicationInterface == NULL) {
|
|
||||||
return RETURN_FAILED;
|
|
||||||
}
|
|
||||||
|
|
||||||
result = communicationInterface->open(&cookie, ioBoardAddress,
|
|
||||||
maxDeviceReplyLen);
|
|
||||||
if (result != RETURN_OK) {
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
IPCStore = objectManager->get<StorageManagerIF>(objects::IPC_STORE);
|
|
||||||
if (IPCStore == NULL) {
|
|
||||||
return RETURN_FAILED;
|
|
||||||
}
|
|
||||||
|
|
||||||
AcceptsDeviceResponsesIF *rawReceiver = objectManager->get<
|
|
||||||
AcceptsDeviceResponsesIF>(rawDataReceiverId);
|
|
||||||
|
|
||||||
if (rawReceiver == NULL) {
|
|
||||||
return RETURN_FAILED;
|
|
||||||
}
|
|
||||||
|
|
||||||
defaultRawReceiver = rawReceiver->getDeviceQueue();
|
|
||||||
|
|
||||||
powerSwitcher = objectManager->get<PowerSwitchIF>(powerSwitcherId);
|
|
||||||
if (powerSwitcher == NULL) {
|
|
||||||
return RETURN_FAILED;
|
|
||||||
}
|
|
||||||
|
|
||||||
result = healthHelper.initialize();
|
|
||||||
if (result != RETURN_OK) {
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
result = modeHelper.initialize();
|
|
||||||
if (result != RETURN_OK) {
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
result = actionHelper.initialize(commandQueue);
|
|
||||||
if (result != RETURN_OK) {
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
result = fdirInstance->initialize();
|
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
result = parameterHelper.initialize();
|
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
result = hkSwitcher.initialize();
|
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
fillCommandAndReplyMap();
|
|
||||||
|
|
||||||
//Set temperature target state to NON_OP.
|
|
||||||
DataSet mySet;
|
|
||||||
PoolVariable<int8_t> thermalRequest(deviceThermalRequestPoolId, &mySet,
|
|
||||||
PoolVariableIF::VAR_WRITE);
|
|
||||||
mySet.read();
|
|
||||||
thermalRequest = ThermalComponentIF::STATE_REQUEST_NON_OPERATIONAL;
|
|
||||||
mySet.commit(PoolVariableIF::VALID);
|
|
||||||
|
|
||||||
return RETURN_OK;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeviceHandlerBase::replyRawData(const uint8_t *data, size_t len,
|
void DeviceHandlerBase::replyRawData(const uint8_t *data, size_t len,
|
||||||
@ -687,8 +702,7 @@ void DeviceHandlerBase::replyRawData(const uint8_t *data, size_t len,
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Default child implementations
|
//Default child implementations
|
||||||
|
DeviceHandlerIF::CommunicationAction_t DeviceHandlerBase::getComAction() {
|
||||||
DeviceHandlerBase::RmapAction_t DeviceHandlerBase::getRmapAction() {
|
|
||||||
switch (pstStep) {
|
switch (pstStep) {
|
||||||
case 0:
|
case 0:
|
||||||
return SEND_WRITE;
|
return SEND_WRITE;
|
||||||
@ -727,7 +741,7 @@ void DeviceHandlerBase::handleReply(const uint8_t* receivedData,
|
|||||||
|
|
||||||
if (info->delayCycles != 0) {
|
if (info->delayCycles != 0) {
|
||||||
|
|
||||||
if (info->periodic != 0) {
|
if (info->periodic) {
|
||||||
info->delayCycles = info->maxDelayCycles;
|
info->delayCycles = info->maxDelayCycles;
|
||||||
} else {
|
} else {
|
||||||
info->delayCycles = 0;
|
info->delayCycles = 0;
|
||||||
@ -748,20 +762,20 @@ void DeviceHandlerBase::handleReply(const uint8_t* receivedData,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t DeviceHandlerBase::switchCookieChannel(object_id_t newChannelId) {
|
//ReturnValue_t DeviceHandlerBase::switchCookieChannel(object_id_t newChannelId) {
|
||||||
DeviceCommunicationIF *newCommunication = objectManager->get<
|
// DeviceCommunicationIF *newCommunication = objectManager->get<
|
||||||
DeviceCommunicationIF>(newChannelId);
|
// DeviceCommunicationIF>(newChannelId);
|
||||||
|
//
|
||||||
if (newCommunication != NULL) {
|
// if (newCommunication != NULL) {
|
||||||
ReturnValue_t result = newCommunication->reOpen(cookie, ioBoardAddress,
|
// ReturnValue_t result = newCommunication->reOpen(cookie, ioBoardAddress,
|
||||||
maxDeviceReplyLen);
|
// maxDeviceReplyLen);
|
||||||
if (result != RETURN_OK) {
|
// if (result != RETURN_OK) {
|
||||||
return result;
|
// return result;
|
||||||
}
|
// }
|
||||||
return RETURN_OK;
|
// return RETURN_OK;
|
||||||
}
|
// }
|
||||||
return RETURN_FAILED;
|
// return RETURN_FAILED;
|
||||||
}
|
//}
|
||||||
|
|
||||||
void DeviceHandlerBase::buildRawDeviceCommand(CommandMessage* commandMessage) {
|
void DeviceHandlerBase::buildRawDeviceCommand(CommandMessage* commandMessage) {
|
||||||
storedRawData = DeviceHandlerMessage::getStoreAddress(commandMessage);
|
storedRawData = DeviceHandlerMessage::getStoreAddress(commandMessage);
|
||||||
@ -1022,7 +1036,6 @@ void DeviceHandlerBase::replyRawReplyIfnotWiretapped(const uint8_t* data,
|
|||||||
|
|
||||||
ReturnValue_t DeviceHandlerBase::handleDeviceHandlerMessage(
|
ReturnValue_t DeviceHandlerBase::handleDeviceHandlerMessage(
|
||||||
CommandMessage * message) {
|
CommandMessage * message) {
|
||||||
ReturnValue_t result;
|
|
||||||
switch (message->getCommand()) {
|
switch (message->getCommand()) {
|
||||||
case DeviceHandlerMessage::CMD_WIRETAPPING:
|
case DeviceHandlerMessage::CMD_WIRETAPPING:
|
||||||
switch (DeviceHandlerMessage::getWiretappingMode(message)) {
|
switch (DeviceHandlerMessage::getWiretappingMode(message)) {
|
||||||
@ -1044,19 +1057,19 @@ ReturnValue_t DeviceHandlerBase::handleDeviceHandlerMessage(
|
|||||||
}
|
}
|
||||||
replyReturnvalueToCommand(RETURN_OK);
|
replyReturnvalueToCommand(RETURN_OK);
|
||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
case DeviceHandlerMessage::CMD_SWITCH_IOBOARD:
|
// case DeviceHandlerMessage::CMD_SWITCH_IOBOARD:
|
||||||
if (mode != MODE_OFF) {
|
// if (mode != MODE_OFF) {
|
||||||
replyReturnvalueToCommand(WRONG_MODE_FOR_COMMAND);
|
// replyReturnvalueToCommand(WRONG_MODE_FOR_COMMAND);
|
||||||
} else {
|
// } else {
|
||||||
result = switchCookieChannel(
|
// result = switchCookieChannel(
|
||||||
DeviceHandlerMessage::getIoBoardObjectId(message));
|
// DeviceHandlerMessage::getIoBoardObjectId(message));
|
||||||
if (result == RETURN_OK) {
|
// if (result == RETURN_OK) {
|
||||||
replyReturnvalueToCommand(RETURN_OK);
|
// replyReturnvalueToCommand(RETURN_OK);
|
||||||
} else {
|
// } else {
|
||||||
replyReturnvalueToCommand(CANT_SWITCH_IOBOARD);
|
// replyReturnvalueToCommand(CANT_SWITCH_IO_ADDRESS);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
return RETURN_OK;
|
// return RETURN_OK;
|
||||||
case DeviceHandlerMessage::CMD_RAW:
|
case DeviceHandlerMessage::CMD_RAW:
|
||||||
if ((mode != MODE_RAW)) {
|
if ((mode != MODE_RAW)) {
|
||||||
DeviceHandlerMessage::clear(message);
|
DeviceHandlerMessage::clear(message);
|
||||||
@ -1072,7 +1085,7 @@ ReturnValue_t DeviceHandlerBase::handleDeviceHandlerMessage(
|
|||||||
|
|
||||||
void DeviceHandlerBase::setParentQueue(MessageQueueId_t parentQueueId) {
|
void DeviceHandlerBase::setParentQueue(MessageQueueId_t parentQueueId) {
|
||||||
modeHelper.setParentQueue(parentQueueId);
|
modeHelper.setParentQueue(parentQueueId);
|
||||||
healthHelper.setParentQeueue(parentQueueId);
|
healthHelper.setParentQueue(parentQueueId);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DeviceHandlerBase::isAwaitingReply() {
|
bool DeviceHandlerBase::isAwaitingReply() {
|
||||||
@ -1136,7 +1149,7 @@ void DeviceHandlerBase::handleDeviceTM(SerializeIF* data,
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t DeviceHandlerBase::executeAction(ActionId_t actionId,
|
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();
|
ReturnValue_t result = acceptExternalDeviceCommands();
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
return result;
|
return result;
|
||||||
@ -1270,3 +1283,9 @@ void DeviceHandlerBase::changeHK(Mode_t mode, Submode_t submode, bool enable) {
|
|||||||
void DeviceHandlerBase::setTaskIF(PeriodicTaskIF* task_){
|
void DeviceHandlerBase::setTaskIF(PeriodicTaskIF* task_){
|
||||||
executingTask = task_;
|
executingTask = task_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Default implementations empty.
|
||||||
|
void DeviceHandlerBase::debugInterface(uint8_t positionTracker,
|
||||||
|
object_id_t objectId, uint32_t parameter) {}
|
||||||
|
|
||||||
|
void DeviceHandlerBase::performOperationHook() {}
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,9 +1,9 @@
|
|||||||
#include <framework/devicehandlers/DeviceHandlerBase.h>
|
#include "DeviceHandlerBase.h"
|
||||||
#include <framework/devicehandlers/DeviceHandlerFailureIsolation.h>
|
#include "DeviceHandlerFailureIsolation.h"
|
||||||
#include <framework/health/HealthTableIF.h>
|
#include "../health/HealthTableIF.h"
|
||||||
#include <framework/power/Fuse.h>
|
#include "../power/Fuse.h"
|
||||||
#include <framework/serviceinterface/ServiceInterfaceStream.h>
|
#include "../serviceinterface/ServiceInterfaceStream.h"
|
||||||
#include <framework/thermal/ThermalComponentIF.h>
|
#include "../thermal/ThermalComponentIF.h"
|
||||||
|
|
||||||
object_id_t DeviceHandlerFailureIsolation::powerConfirmationId = 0;
|
object_id_t DeviceHandlerFailureIsolation::powerConfirmationId = 0;
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#ifndef FRAMEWORK_DEVICEHANDLERS_DEVICEHANDLERFAILUREISOLATION_H_
|
#ifndef FRAMEWORK_DEVICEHANDLERS_DEVICEHANDLERFAILUREISOLATION_H_
|
||||||
#define FRAMEWORK_DEVICEHANDLERS_DEVICEHANDLERFAILUREISOLATION_H_
|
#define FRAMEWORK_DEVICEHANDLERS_DEVICEHANDLERFAILUREISOLATION_H_
|
||||||
|
|
||||||
#include <framework/fdir/FaultCounter.h>
|
#include "../fdir/FaultCounter.h"
|
||||||
#include <framework/fdir/FailureIsolationBase.h>
|
#include "../fdir/FailureIsolationBase.h"
|
||||||
namespace Factory{
|
namespace Factory{
|
||||||
void setStaticFrameworkObjectIds();
|
void setStaticFrameworkObjectIds();
|
||||||
}
|
}
|
||||||
|
@ -1,14 +1,15 @@
|
|||||||
#ifndef DEVICEHANDLERIF_H_
|
#ifndef DEVICEHANDLERIF_H_
|
||||||
#define DEVICEHANDLERIF_H_
|
#define DEVICEHANDLERIF_H_
|
||||||
|
|
||||||
#include <framework/action/HasActionsIF.h>
|
#include "../action/HasActionsIF.h"
|
||||||
#include <framework/devicehandlers/DeviceHandlerMessage.h>
|
#include "DeviceHandlerMessage.h"
|
||||||
#include <framework/events/Event.h>
|
#include "../events/Event.h"
|
||||||
#include <framework/modes/HasModesIF.h>
|
#include "../modes/HasModesIF.h"
|
||||||
#include <framework/ipc/MessageQueueSenderIF.h>
|
#include "../ipc/MessageQueueSenderIF.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the Interface used to communicate with a device handler.
|
* @brief This is the Interface used to communicate with a device handler.
|
||||||
|
* @details Includes all expected return values, events and modes.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
class DeviceHandlerIF {
|
class DeviceHandlerIF {
|
||||||
@ -22,22 +23,62 @@ public:
|
|||||||
*
|
*
|
||||||
* @details The mode of the device handler must not be confused with the mode the device is in.
|
* @details The mode of the device handler must not be confused with the mode the device is in.
|
||||||
* The mode of the device itself is transparent to the user but related to the mode of the handler.
|
* The mode of the device itself is transparent to the user but related to the mode of the handler.
|
||||||
|
* MODE_ON and MODE_OFF are included in hasModesIF.h
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// MODE_ON = 0, //!< The device is powered and ready to perform operations. In this mode, no commands are sent by the device handler itself, but direct commands van be commanded and will be interpreted
|
// MODE_ON = 0, //!< The device is powered and ready to perform operations. In this mode, no commands are sent by the device handler itself, but direct commands van be commanded and will be interpreted
|
||||||
// MODE_OFF = 1, //!< The device is powered off. The only command accepted in this mode is a mode change to on.
|
// MODE_OFF = 1, //!< The device is powered off. The only command accepted in this mode is a mode change to on.
|
||||||
static const Mode_t MODE_NORMAL = 2; //!< The device is powered on and the device handler periodically sends commands. The commands to be sent are selected by the handler according to the submode.
|
//! The device is powered on and the device handler periodically sends
|
||||||
static const Mode_t MODE_RAW = 3; //!< The device is powered on and ready to perform operations. In this mode, raw commands can be sent. The device handler will send all replies received from the command back to the commanding object.
|
//! commands. The commands to be sent are selected by the handler
|
||||||
static const Mode_t MODE_ERROR_ON = 4; //!4< The device is shut down but the switch could not be turned off, so the device still is powered. In this mode, only a mode change to @c MODE_OFF can be commanded, which tries to switch off the device again.
|
//! according to the submode.
|
||||||
static const Mode_t _MODE_START_UP = TRANSITION_MODE_CHILD_ACTION_MASK | 5; //!< This is a transitional state which can not be commanded. The device handler performs all commands to get the device in a state ready to perform commands. When this is completed, the mode changes to @c MODE_ON.
|
static const Mode_t MODE_NORMAL = 2;
|
||||||
static const Mode_t _MODE_SHUT_DOWN = TRANSITION_MODE_CHILD_ACTION_MASK | 6; //!< This is a transitional state which can not be commanded. The device handler performs all actions and commands to get the device shut down. When the device is off, the mode changes to @c MODE_OFF.
|
//! The device is powered on and ready to perform operations. In this mode,
|
||||||
|
//! raw commands can be sent. The device handler will send all replies
|
||||||
|
//! received from the command back to the commanding object.
|
||||||
|
static const Mode_t MODE_RAW = 3;
|
||||||
|
//! The device is shut down but the switch could not be turned off, so the
|
||||||
|
//! device still is powered. In this mode, only a mode change to @c MODE_OFF
|
||||||
|
//! can be commanded, which tries to switch off the device again.
|
||||||
|
static const Mode_t MODE_ERROR_ON = 4;
|
||||||
|
//! This is a transitional state which can not be commanded. The device
|
||||||
|
//! handler performs all commands to get the device in a state ready to
|
||||||
|
//! perform commands. When this is completed, the mode changes to @c MODE_ON.
|
||||||
|
static const Mode_t _MODE_START_UP = TRANSITION_MODE_CHILD_ACTION_MASK | 5;
|
||||||
|
//! This is a transitional state which can not be commanded.
|
||||||
|
//! The device handler performs all actions and commands to get the device
|
||||||
|
//! shut down. When the device is off, the mode changes to @c MODE_OFF.
|
||||||
|
static const Mode_t _MODE_SHUT_DOWN = TRANSITION_MODE_CHILD_ACTION_MASK | 6;
|
||||||
|
//! It is possible to set the mode to _MODE_TO_ON to use the to on
|
||||||
|
//! transition if available.
|
||||||
static const Mode_t _MODE_TO_ON = TRANSITION_MODE_CHILD_ACTION_MASK | HasModesIF::MODE_ON;
|
static const Mode_t _MODE_TO_ON = TRANSITION_MODE_CHILD_ACTION_MASK | HasModesIF::MODE_ON;
|
||||||
|
//! It is possible to set the mode to _MODE_TO_RAW to use the to raw
|
||||||
|
//! transition if available.
|
||||||
static const Mode_t _MODE_TO_RAW = TRANSITION_MODE_CHILD_ACTION_MASK | MODE_RAW;
|
static const Mode_t _MODE_TO_RAW = TRANSITION_MODE_CHILD_ACTION_MASK | MODE_RAW;
|
||||||
|
//! It is possible to set the mode to _MODE_TO_NORMAL to use the to normal
|
||||||
|
//! transition if available.
|
||||||
static const Mode_t _MODE_TO_NORMAL = TRANSITION_MODE_CHILD_ACTION_MASK | MODE_NORMAL;
|
static const Mode_t _MODE_TO_NORMAL = TRANSITION_MODE_CHILD_ACTION_MASK | MODE_NORMAL;
|
||||||
static const Mode_t _MODE_POWER_DOWN = TRANSITION_MODE_BASE_ACTION_MASK | 1; //!< This is a transitional state which can not be commanded. The device is shut down and ready to be switched off. After the command to set the switch off has been sent, the mode changes to @c MODE_WAIT_OFF
|
//! This is a transitional state which can not be commanded.
|
||||||
static const Mode_t _MODE_POWER_ON = TRANSITION_MODE_BASE_ACTION_MASK | 2; //!< This is a transitional state which can not be commanded. The device will be switched on in this state. After the command to set the switch on has been sent, the mode changes to @c MODE_WAIT_ON
|
//! The device is shut down and ready to be switched off.
|
||||||
static const Mode_t _MODE_WAIT_OFF = TRANSITION_MODE_BASE_ACTION_MASK | 3; //!< This is a transitional state which can not be commanded. The switch has been commanded off and the handler waits for it to be off. When the switch is off, the mode changes to @c MODE_OFF.
|
//! After the command to set the switch off has been sent,
|
||||||
static const Mode_t _MODE_WAIT_ON = TRANSITION_MODE_BASE_ACTION_MASK | 4; //!< This is a transitional state which can not be commanded. The switch has been commanded on and the handler waits for it to be on. When the switch is on, the mode changes to @c MODE_TO_ON.
|
//! the mode changes to @c MODE_WAIT_OFF
|
||||||
static const Mode_t _MODE_SWITCH_IS_OFF = TRANSITION_MODE_BASE_ACTION_MASK | 5; //!< This is a transitional state which can not be commanded. The switch has been commanded off and is off now. This state is only to do an RMAP cycle once more where the doSendRead() function will set the mode to MODE_OFF. The reason to do this is to get rid of stuck packets in the IO Board
|
static const Mode_t _MODE_POWER_DOWN = TRANSITION_MODE_BASE_ACTION_MASK | 1;
|
||||||
|
//! This is a transitional state which can not be commanded. The device
|
||||||
|
//! will be switched on in this state. After the command to set the switch
|
||||||
|
//! on has been sent, the mode changes to @c MODE_WAIT_ON.
|
||||||
|
static const Mode_t _MODE_POWER_ON = TRANSITION_MODE_BASE_ACTION_MASK | 2;
|
||||||
|
//! This is a transitional state which can not be commanded. The switch has
|
||||||
|
//! been commanded off and the handler waits for it to be off.
|
||||||
|
//! When the switch is off, the mode changes to @c MODE_OFF.
|
||||||
|
static const Mode_t _MODE_WAIT_OFF = TRANSITION_MODE_BASE_ACTION_MASK | 3;
|
||||||
|
//! This is a transitional state which can not be commanded. The switch
|
||||||
|
//! has been commanded on and the handler waits for it to be on.
|
||||||
|
//! When the switch is on, the mode changes to @c MODE_TO_ON.
|
||||||
|
static const Mode_t _MODE_WAIT_ON = TRANSITION_MODE_BASE_ACTION_MASK | 4;
|
||||||
|
//! This is a transitional state which can not be commanded. The switch has
|
||||||
|
//! been commanded off and is off now. This state is only to do an RMAP
|
||||||
|
//! cycle once more where the doSendRead() function will set the mode to
|
||||||
|
//! MODE_OFF. The reason to do this is to get rid of stuck packets in the IO Board.
|
||||||
|
static const Mode_t _MODE_SWITCH_IS_OFF = TRANSITION_MODE_BASE_ACTION_MASK | 5;
|
||||||
|
|
||||||
static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::CDH;
|
static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::CDH;
|
||||||
static const Event DEVICE_BUILDING_COMMAND_FAILED = MAKE_EVENT(0, SEVERITY::LOW);
|
static const Event DEVICE_BUILDING_COMMAND_FAILED = MAKE_EVENT(0, SEVERITY::LOW);
|
||||||
@ -53,11 +94,13 @@ public:
|
|||||||
static const Event MONITORING_AMBIGUOUS = MAKE_EVENT(10, SEVERITY::HIGH);
|
static const Event MONITORING_AMBIGUOUS = MAKE_EVENT(10, SEVERITY::HIGH);
|
||||||
|
|
||||||
static const uint8_t INTERFACE_ID = CLASS_ID::DEVICE_HANDLER_IF;
|
static const uint8_t INTERFACE_ID = CLASS_ID::DEVICE_HANDLER_IF;
|
||||||
static const ReturnValue_t NO_COMMAND_DATA = MAKE_RETURN_CODE(0xA0);
|
|
||||||
static const ReturnValue_t COMMAND_NOT_SUPPORTED = MAKE_RETURN_CODE(0xA1);
|
// Standard codes used when building commands.
|
||||||
static const ReturnValue_t COMMAND_ALREADY_SENT = MAKE_RETURN_CODE(0xA2);
|
static const ReturnValue_t NO_COMMAND_DATA = MAKE_RETURN_CODE(0xA0); //!< If the command size is 0. Checked in DHB
|
||||||
|
static const ReturnValue_t COMMAND_NOT_SUPPORTED = MAKE_RETURN_CODE(0xA1); //!< Command ID not in commandMap. Checked in DHB
|
||||||
|
static const ReturnValue_t COMMAND_ALREADY_SENT = MAKE_RETURN_CODE(0xA2); //!< Command was already executed. Checked in DHB
|
||||||
static const ReturnValue_t COMMAND_WAS_NOT_SENT = MAKE_RETURN_CODE(0xA3);
|
static const ReturnValue_t COMMAND_WAS_NOT_SENT = MAKE_RETURN_CODE(0xA3);
|
||||||
static const ReturnValue_t CANT_SWITCH_IOBOARD = MAKE_RETURN_CODE(0xA4);
|
static const ReturnValue_t CANT_SWITCH_ADDRESS = MAKE_RETURN_CODE(0xA4);
|
||||||
static const ReturnValue_t WRONG_MODE_FOR_COMMAND = MAKE_RETURN_CODE(0xA5);
|
static const ReturnValue_t WRONG_MODE_FOR_COMMAND = MAKE_RETURN_CODE(0xA5);
|
||||||
static const ReturnValue_t TIMEOUT = MAKE_RETURN_CODE(0xA6);
|
static const ReturnValue_t TIMEOUT = MAKE_RETURN_CODE(0xA6);
|
||||||
static const ReturnValue_t BUSY = MAKE_RETURN_CODE(0xA7);
|
static const ReturnValue_t BUSY = MAKE_RETURN_CODE(0xA7);
|
||||||
@ -65,50 +108,42 @@ public:
|
|||||||
static const ReturnValue_t NON_OP_TEMPERATURE = MAKE_RETURN_CODE(0xA9);
|
static const ReturnValue_t NON_OP_TEMPERATURE = MAKE_RETURN_CODE(0xA9);
|
||||||
static const ReturnValue_t COMMAND_NOT_IMPLEMENTED = MAKE_RETURN_CODE(0xAA);
|
static const ReturnValue_t COMMAND_NOT_IMPLEMENTED = MAKE_RETURN_CODE(0xAA);
|
||||||
|
|
||||||
//standard codes used in scan for reply
|
// Standard codes used in scanForReply
|
||||||
// static const ReturnValue_t TOO_SHORT = MAKE_RETURN_CODE(0xB1);
|
static const ReturnValue_t CHECKSUM_ERROR = MAKE_RETURN_CODE(0xB0);
|
||||||
static const ReturnValue_t CHECKSUM_ERROR = MAKE_RETURN_CODE(0xB2);
|
static const ReturnValue_t LENGTH_MISSMATCH = MAKE_RETURN_CODE(0xB1);
|
||||||
static const ReturnValue_t LENGTH_MISSMATCH = MAKE_RETURN_CODE(0xB3);
|
static const ReturnValue_t INVALID_DATA = MAKE_RETURN_CODE(0xB2);
|
||||||
static const ReturnValue_t INVALID_DATA = MAKE_RETURN_CODE(0xB4);
|
static const ReturnValue_t PROTOCOL_ERROR = MAKE_RETURN_CODE(0xB3);
|
||||||
static const ReturnValue_t PROTOCOL_ERROR = MAKE_RETURN_CODE(0xB5);
|
|
||||||
|
|
||||||
//standard codes used in interpret device reply
|
// Standard codes used in interpretDeviceReply
|
||||||
static const ReturnValue_t DEVICE_DID_NOT_EXECUTE = MAKE_RETURN_CODE(0xC1); //the device reported, that it did not execute the command
|
static const ReturnValue_t DEVICE_DID_NOT_EXECUTE = MAKE_RETURN_CODE(0xC0); //the device reported, that it did not execute the command
|
||||||
static const ReturnValue_t DEVICE_REPORTED_ERROR = MAKE_RETURN_CODE(0xC2);
|
static const ReturnValue_t DEVICE_REPORTED_ERROR = MAKE_RETURN_CODE(0xC1);
|
||||||
static const ReturnValue_t UNKNOW_DEVICE_REPLY = MAKE_RETURN_CODE(0xC3); //the deviceCommandId reported by scanforReply is unknown
|
static const ReturnValue_t UNKNOW_DEVICE_REPLY = MAKE_RETURN_CODE(0xC2); //the deviceCommandId reported by scanforReply is unknown
|
||||||
static const ReturnValue_t DEVICE_REPLY_INVALID = MAKE_RETURN_CODE(0xC4); //syntax etc is correct but still not ok, eg parameters where none are expected
|
static const ReturnValue_t DEVICE_REPLY_INVALID = MAKE_RETURN_CODE(0xC3); //syntax etc is correct but still not ok, eg parameters where none are expected
|
||||||
|
|
||||||
// Standard codes used in buildCommandFromCommand
|
// Standard codes used in buildCommandFromCommand
|
||||||
static const ReturnValue_t INVALID_COMMAND_PARAMETER = MAKE_RETURN_CODE(
|
static const ReturnValue_t INVALID_COMMAND_PARAMETER = MAKE_RETURN_CODE(0xD0);
|
||||||
0xD0);
|
static const ReturnValue_t INVALID_NUMBER_OR_LENGTH_OF_PARAMETERS = MAKE_RETURN_CODE(0xD1);
|
||||||
static const ReturnValue_t INVALID_NUMBER_OR_LENGTH_OF_PARAMETERS =
|
|
||||||
MAKE_RETURN_CODE(0xD1);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* RMAP Action that will be executed.
|
* Communication action that will be executed.
|
||||||
*
|
*
|
||||||
* This is used by the child class to tell the base class what to do.
|
* This is used by the child class to tell the base class what to do.
|
||||||
*/
|
*/
|
||||||
enum RmapAction_t {
|
enum CommunicationAction_t: uint8_t {
|
||||||
SEND_WRITE,//!< RMAP send write
|
SEND_WRITE,//!< Send write
|
||||||
GET_WRITE, //!< RMAP get write
|
GET_WRITE, //!< Get write
|
||||||
SEND_READ, //!< RMAP send read
|
SEND_READ, //!< Send read
|
||||||
GET_READ, //!< RMAP get read
|
GET_READ, //!< Get read
|
||||||
NOTHING //!< Do nothing.
|
NOTHING //!< Do nothing.
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default Destructor
|
* Default Destructor
|
||||||
*/
|
*/
|
||||||
virtual ~DeviceHandlerIF() {
|
virtual ~DeviceHandlerIF() {}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This MessageQueue is used to command the device handler.
|
* This MessageQueue is used to command the device handler.
|
||||||
*
|
|
||||||
* To command a device handler, a DeviceHandlerCommandMessage can be sent to this Queue.
|
|
||||||
* The handler replies with a DeviceHandlerCommandMessage containing the DeviceHandlerCommand_t reply.
|
|
||||||
*
|
|
||||||
* @return the id of the MessageQueue
|
* @return the id of the MessageQueue
|
||||||
*/
|
*/
|
||||||
virtual MessageQueueId_t getCommandQueue() const = 0;
|
virtual MessageQueueId_t getCommandQueue() const = 0;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include <framework/objectmanager/ObjectManagerIF.h>
|
#include "../objectmanager/ObjectManagerIF.h"
|
||||||
#include <framework/devicehandlers/DeviceHandlerMessage.h>
|
#include "DeviceHandlerMessage.h"
|
||||||
#include <framework/objectmanager/ObjectManagerIF.h>
|
#include "../objectmanager/ObjectManagerIF.h"
|
||||||
|
|
||||||
DeviceHandlerMessage::DeviceHandlerMessage() {
|
DeviceHandlerMessage::DeviceHandlerMessage() {
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
#ifndef DEVICEHANDLERMESSAGE_H_
|
#ifndef DEVICEHANDLERMESSAGE_H_
|
||||||
#define DEVICEHANDLERMESSAGE_H_
|
#define DEVICEHANDLERMESSAGE_H_
|
||||||
|
|
||||||
#include <framework/action/ActionMessage.h>
|
#include "../action/ActionMessage.h"
|
||||||
#include <framework/ipc/CommandMessage.h>
|
#include "../ipc/CommandMessage.h"
|
||||||
#include <framework/objectmanager/SystemObjectIF.h>
|
#include "../objectmanager/SystemObjectIF.h"
|
||||||
#include <framework/storagemanager/StorageManagerIF.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.
|
//SHOULDDO: rework the static constructors to name the type of command they are building, maybe even hide setting the commandID.
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include <framework/serialize/SerializeAdapter.h>
|
#include "../serialize/SerializeAdapter.h"
|
||||||
#include <framework/devicehandlers/DeviceTmReportingWrapper.h>
|
#include "DeviceTmReportingWrapper.h"
|
||||||
#include <framework/serialize/SerializeAdapter.h>
|
#include "../serialize/SerializeAdapter.h"
|
||||||
|
|
||||||
DeviceTmReportingWrapper::DeviceTmReportingWrapper(object_id_t objectId,
|
DeviceTmReportingWrapper::DeviceTmReportingWrapper(object_id_t objectId,
|
||||||
ActionId_t actionId, SerializeIF* data) :
|
ActionId_t actionId, SerializeIF* data) :
|
||||||
@ -12,35 +12,35 @@ DeviceTmReportingWrapper::~DeviceTmReportingWrapper() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t DeviceTmReportingWrapper::serialize(uint8_t** buffer,
|
ReturnValue_t DeviceTmReportingWrapper::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 = SerializeAdapter<object_id_t>::serialize(&objectId,
|
ReturnValue_t result = SerializeAdapter::serialize(&objectId,
|
||||||
buffer, size, max_size, bigEndian);
|
buffer, size, maxSize, streamEndianness);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
result = SerializeAdapter<ActionId_t>::serialize(&actionId, buffer,
|
result = SerializeAdapter::serialize(&actionId, buffer,
|
||||||
size, max_size, bigEndian);
|
size, maxSize, streamEndianness);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
return result;
|
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();
|
return sizeof(objectId) + sizeof(ActionId_t) + data->getSerializedSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t DeviceTmReportingWrapper::deSerialize(const uint8_t** buffer,
|
ReturnValue_t DeviceTmReportingWrapper::deSerialize(const uint8_t** buffer,
|
||||||
int32_t* size, bool bigEndian) {
|
size_t* size, Endianness streamEndianness) {
|
||||||
ReturnValue_t result = SerializeAdapter<object_id_t>::deSerialize(&objectId,
|
ReturnValue_t result = SerializeAdapter::deSerialize(&objectId,
|
||||||
buffer, size, bigEndian);
|
buffer, size, streamEndianness);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
result = SerializeAdapter<ActionId_t>::deSerialize(&actionId, buffer,
|
result = SerializeAdapter::deSerialize(&actionId, buffer,
|
||||||
size, bigEndian);
|
size, streamEndianness);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
return data->deSerialize(buffer, size, bigEndian);
|
return data->deSerialize(buffer, size, streamEndianness);
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
#ifndef DEVICETMREPORTINGWRAPPER_H_
|
#ifndef DEVICETMREPORTINGWRAPPER_H_
|
||||||
#define DEVICETMREPORTINGWRAPPER_H_
|
#define DEVICETMREPORTINGWRAPPER_H_
|
||||||
|
|
||||||
#include <framework/action/HasActionsIF.h>
|
#include "../action/HasActionsIF.h"
|
||||||
#include <framework/objectmanager/SystemObjectIF.h>
|
#include "../objectmanager/SystemObjectIF.h"
|
||||||
#include <framework/serialize/SerializeIF.h>
|
#include "../serialize/SerializeIF.h"
|
||||||
|
|
||||||
class DeviceTmReportingWrapper: public SerializeIF {
|
class DeviceTmReportingWrapper: public SerializeIF {
|
||||||
public:
|
public:
|
||||||
@ -11,13 +11,13 @@ public:
|
|||||||
SerializeIF *data);
|
SerializeIF *data);
|
||||||
virtual ~DeviceTmReportingWrapper();
|
virtual ~DeviceTmReportingWrapper();
|
||||||
|
|
||||||
virtual ReturnValue_t serialize(uint8_t** buffer, uint32_t* size,
|
virtual ReturnValue_t serialize(uint8_t** buffer, size_t* size,
|
||||||
const uint32_t max_size, bool bigEndian) const;
|
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,
|
virtual ReturnValue_t deSerialize(const uint8_t** buffer, size_t* size,
|
||||||
bool bigEndian);
|
Endianness streamEndianness) override;
|
||||||
private:
|
private:
|
||||||
object_id_t objectId;
|
object_id_t objectId;
|
||||||
ActionId_t actionId;
|
ActionId_t actionId;
|
||||||
|
@ -5,8 +5,8 @@
|
|||||||
* @author baetz
|
* @author baetz
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <framework/devicehandlers/FixedSequenceSlot.h>
|
#include "FixedSequenceSlot.h"
|
||||||
#include <framework/objectmanager/SystemObjectIF.h>
|
#include "../objectmanager/SystemObjectIF.h"
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
|
|
||||||
FixedSequenceSlot::FixedSequenceSlot(object_id_t handlerId, uint32_t setTime,
|
FixedSequenceSlot::FixedSequenceSlot(object_id_t handlerId, uint32_t setTime,
|
||||||
@ -16,6 +16,5 @@ FixedSequenceSlot::FixedSequenceSlot(object_id_t handlerId, uint32_t setTime,
|
|||||||
handler->setTaskIF(executingTask);
|
handler->setTaskIF(executingTask);
|
||||||
}
|
}
|
||||||
|
|
||||||
FixedSequenceSlot::~FixedSequenceSlot() {
|
FixedSequenceSlot::~FixedSequenceSlot() {}
|
||||||
}
|
|
||||||
|
|
||||||
|
@ -8,40 +8,52 @@
|
|||||||
#ifndef FIXEDSEQUENCESLOT_H_
|
#ifndef FIXEDSEQUENCESLOT_H_
|
||||||
#define FIXEDSEQUENCESLOT_H_
|
#define FIXEDSEQUENCESLOT_H_
|
||||||
|
|
||||||
#include <framework/objectmanager/ObjectManagerIF.h>
|
#include "../objectmanager/ObjectManagerIF.h"
|
||||||
#include <framework/tasks/ExecutableObjectIF.h>
|
#include "../tasks/ExecutableObjectIF.h"
|
||||||
class PeriodicTaskIF;
|
class PeriodicTaskIF;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief This class is the representation of a single polling sequence table entry.
|
* @brief This class is the representation of a single polling sequence table entry.
|
||||||
*
|
*
|
||||||
* \details The PollingSlot class is the representation of a single polling sequence table entry.
|
* @details The PollingSlot class is the representation of a single polling
|
||||||
|
* sequence table entry.
|
||||||
*/
|
*/
|
||||||
class FixedSequenceSlot {
|
class FixedSequenceSlot {
|
||||||
public:
|
public:
|
||||||
FixedSequenceSlot( object_id_t handlerId, uint32_t setTimeMs, int8_t setSequenceId, PeriodicTaskIF* executingTask );
|
FixedSequenceSlot( object_id_t handlerId, uint32_t setTimeMs,
|
||||||
|
int8_t setSequenceId, PeriodicTaskIF* executingTask );
|
||||||
virtual ~FixedSequenceSlot();
|
virtual ~FixedSequenceSlot();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief \c handler identifies which device handler object is executed in this slot.
|
* @brief Handler identifies which device handler object is executed in this slot.
|
||||||
*/
|
*/
|
||||||
ExecutableObjectIF* handler;
|
ExecutableObjectIF* handler;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief This attribute defines when a device handler object is executed.
|
* @brief This attribute defines when a device handler object is executed.
|
||||||
*
|
*
|
||||||
* \details The pollingTime attribute identifies the time the handler is executed in ms. It must be
|
* @details The pollingTime attribute identifies the time the handler is executed in ms.
|
||||||
* smaller than the period length of the polling sequence, what is ensured by automated calculation
|
* It must be smaller than the period length of the polling sequence.
|
||||||
* from a database.
|
|
||||||
*/
|
*/
|
||||||
uint32_t pollingTimeMs;
|
uint32_t pollingTimeMs;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief This value defines the type of device communication.
|
* @brief This value defines the type of device communication.
|
||||||
*
|
*
|
||||||
* \details The state of this value decides what communication routine is called in the PST executable or the device handler object.
|
* @details The state of this value decides what communication routine is
|
||||||
|
* called in the PST executable or the device handler object.
|
||||||
*/
|
*/
|
||||||
uint8_t opcode;
|
uint8_t opcode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Operator overload for the comparison operator to
|
||||||
|
* allow sorting by polling time.
|
||||||
|
* @param fixedSequenceSlot
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
bool operator <(const FixedSequenceSlot & fixedSequenceSlot) const {
|
||||||
|
return pollingTimeMs < fixedSequenceSlot.pollingTimeMs;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#include <framework/devicehandlers/FixedSlotSequence.h>
|
#include "FixedSlotSequence.h"
|
||||||
#include <framework/serviceinterface/ServiceInterfaceStream.h>
|
#include "../serviceinterface/ServiceInterfaceStream.h"
|
||||||
|
|
||||||
FixedSlotSequence::FixedSlotSequence(uint32_t setLengthMs) :
|
FixedSlotSequence::FixedSlotSequence(uint32_t setLengthMs) :
|
||||||
lengthMs(setLengthMs) {
|
lengthMs(setLengthMs) {
|
||||||
@ -7,17 +7,12 @@ FixedSlotSequence::FixedSlotSequence(uint32_t setLengthMs) :
|
|||||||
}
|
}
|
||||||
|
|
||||||
FixedSlotSequence::~FixedSlotSequence() {
|
FixedSlotSequence::~FixedSlotSequence() {
|
||||||
std::list<FixedSequenceSlot*>::iterator slotIt;
|
// Call the destructor on each list entry.
|
||||||
//Iterate through slotList and delete all entries.
|
slotList.clear();
|
||||||
slotIt = this->slotList.begin();
|
|
||||||
while (slotIt != this->slotList.end()) {
|
|
||||||
delete (*slotIt);
|
|
||||||
slotIt++;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FixedSlotSequence::executeAndAdvance() {
|
void FixedSlotSequence::executeAndAdvance() {
|
||||||
(*this->current)->handler->performOperation((*this->current)->opcode);
|
current->handler->performOperation(current->opcode);
|
||||||
// if (returnValue != RETURN_OK) {
|
// if (returnValue != RETURN_OK) {
|
||||||
// this->sendErrorMessage( returnValue );
|
// this->sendErrorMessage( returnValue );
|
||||||
// }
|
// }
|
||||||
@ -31,53 +26,50 @@ void FixedSlotSequence::executeAndAdvance() {
|
|||||||
|
|
||||||
uint32_t FixedSlotSequence::getIntervalToNextSlotMs() {
|
uint32_t FixedSlotSequence::getIntervalToNextSlotMs() {
|
||||||
uint32_t oldTime;
|
uint32_t oldTime;
|
||||||
std::list<FixedSequenceSlot*>::iterator it;
|
SlotListIter slotListIter = current;
|
||||||
it = current;
|
|
||||||
// Get the pollingTimeMs of the current slot object.
|
// Get the pollingTimeMs of the current slot object.
|
||||||
oldTime = (*it)->pollingTimeMs;
|
oldTime = slotListIter->pollingTimeMs;
|
||||||
// Advance to the next object.
|
// Advance to the next object.
|
||||||
it++;
|
slotListIter++;
|
||||||
// Find the next interval which is not 0.
|
// Find the next interval which is not 0.
|
||||||
while (it != slotList.end()) {
|
while (slotListIter != slotList.end()) {
|
||||||
if (oldTime != (*it)->pollingTimeMs) {
|
if (oldTime != slotListIter->pollingTimeMs) {
|
||||||
return (*it)->pollingTimeMs - oldTime;
|
return slotListIter->pollingTimeMs - oldTime;
|
||||||
} else {
|
} else {
|
||||||
it++;
|
slotListIter++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// If the list end is reached (this is definitely an interval != 0),
|
// If the list end is reached (this is definitely an interval != 0),
|
||||||
// the interval is calculated by subtracting the remaining time of the PST
|
// the interval is calculated by subtracting the remaining time of the PST
|
||||||
// and adding the start time of the first handler in the list.
|
// and adding the start time of the first handler in the list.
|
||||||
it = slotList.begin();
|
slotListIter = slotList.begin();
|
||||||
return lengthMs - oldTime + (*it)->pollingTimeMs;
|
return lengthMs - oldTime + slotListIter->pollingTimeMs;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t FixedSlotSequence::getIntervalToPreviousSlotMs() {
|
uint32_t FixedSlotSequence::getIntervalToPreviousSlotMs() {
|
||||||
uint32_t currentTime;
|
uint32_t currentTime;
|
||||||
std::list<FixedSequenceSlot*>::iterator it;
|
SlotListIter slotListIter = current;
|
||||||
it = current;
|
|
||||||
// Get the pollingTimeMs of the current slot object.
|
// Get the pollingTimeMs of the current slot object.
|
||||||
currentTime = (*it)->pollingTimeMs;
|
currentTime = slotListIter->pollingTimeMs;
|
||||||
|
|
||||||
//if it is the first slot, calculate difference to last slot
|
//if it is the first slot, calculate difference to last slot
|
||||||
if (it == slotList.begin()){
|
if (slotListIter == slotList.begin()){
|
||||||
return lengthMs - (*(--slotList.end()))->pollingTimeMs + currentTime;
|
return lengthMs - (--slotList.end())->pollingTimeMs + currentTime;
|
||||||
}
|
}
|
||||||
// get previous slot
|
// get previous slot
|
||||||
it--;
|
slotListIter--;
|
||||||
|
|
||||||
return currentTime - (*it)->pollingTimeMs;
|
return currentTime - slotListIter->pollingTimeMs;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FixedSlotSequence::slotFollowsImmediately() {
|
bool FixedSlotSequence::slotFollowsImmediately() {
|
||||||
uint32_t currentTime = (*current)->pollingTimeMs;
|
uint32_t currentTime = current->pollingTimeMs;
|
||||||
std::list<FixedSequenceSlot*>::iterator it;
|
SlotListIter fixedSequenceIter = this->current;
|
||||||
it = this->current;
|
|
||||||
// Get the pollingTimeMs of the current slot object.
|
// Get the pollingTimeMs of the current slot object.
|
||||||
if (it == slotList.begin())
|
if (fixedSequenceIter == slotList.begin())
|
||||||
return false;
|
return false;
|
||||||
it--;
|
fixedSequenceIter--;
|
||||||
if ((*it)->pollingTimeMs == currentTime) {
|
if (fixedSequenceIter->pollingTimeMs == currentTime) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
@ -93,26 +85,30 @@ ReturnValue_t FixedSlotSequence::checkSequence() const {
|
|||||||
sif::error << "Fixed Slot Sequence: Slot list is empty!" << std::endl;
|
sif::error << "Fixed Slot Sequence: Slot list is empty!" << std::endl;
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto slotIt = slotList.begin();
|
auto slotIt = slotList.begin();
|
||||||
uint32_t count = 0;
|
uint32_t count = 0;
|
||||||
uint32_t time = 0;
|
uint32_t time = 0;
|
||||||
while (slotIt != slotList.end()) {
|
while (slotIt != slotList.end()) {
|
||||||
if ((*slotIt)->handler == NULL) {
|
if (slotIt->handler == nullptr) {
|
||||||
sif::error << "FixedSlotSequene::initialize: ObjectId does not exist!"
|
sif::error << "FixedSlotSequene::initialize: ObjectId does not exist!"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
count++;
|
count++;
|
||||||
} else if ((*slotIt)->pollingTimeMs < time) {
|
} else if (slotIt->pollingTimeMs < time) {
|
||||||
sif::error << "FixedSlotSequence::initialize: Time: "
|
sif::error << "FixedSlotSequence::initialize: Time: "
|
||||||
<< (*slotIt)->pollingTimeMs
|
<< slotIt->pollingTimeMs
|
||||||
<< " is smaller than previous with " << time << std::endl;
|
<< " is smaller than previous with " << time << std::endl;
|
||||||
count++;
|
count++;
|
||||||
} else {
|
} else {
|
||||||
// All ok, print slot.
|
// All ok, print slot.
|
||||||
// (*slotIt)->print();
|
//info << "Current slot polling time: " << std::endl;
|
||||||
|
//info << std::dec << slotIt->pollingTimeMs << std::endl;
|
||||||
}
|
}
|
||||||
time = (*slotIt)->pollingTimeMs;
|
time = slotIt->pollingTimeMs;
|
||||||
slotIt++;
|
slotIt++;
|
||||||
}
|
}
|
||||||
|
//info << "Number of elements in slot list: "
|
||||||
|
// << slotList.size() << std::endl;
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
}
|
}
|
||||||
@ -121,8 +117,7 @@ ReturnValue_t FixedSlotSequence::checkSequence() const {
|
|||||||
|
|
||||||
void FixedSlotSequence::addSlot(object_id_t componentId, uint32_t slotTimeMs,
|
void FixedSlotSequence::addSlot(object_id_t componentId, uint32_t slotTimeMs,
|
||||||
int8_t executionStep, PeriodicTaskIF* executingTask) {
|
int8_t executionStep, PeriodicTaskIF* executingTask) {
|
||||||
this->slotList.push_back(
|
this->slotList.insert(FixedSequenceSlot(componentId, slotTimeMs, executionStep,
|
||||||
new FixedSequenceSlot(componentId, slotTimeMs, executionStep,
|
|
||||||
executingTask));
|
executingTask));
|
||||||
this->current = slotList.begin();
|
this->current = slotList.begin();
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
#ifndef FIXEDSLOTSEQUENCE_H_
|
#ifndef FRAMEWORK_DEVICEHANDLERS_FIXEDSLOTSEQUENCE_H_
|
||||||
#define FIXEDSLOTSEQUENCE_H_
|
#define FRAMEWORK_DEVICEHANDLERS_FIXEDSLOTSEQUENCE_H_
|
||||||
|
|
||||||
#include <framework/devicehandlers/FixedSequenceSlot.h>
|
#include "FixedSequenceSlot.h"
|
||||||
#include <framework/objectmanager/SystemObject.h>
|
#include "../objectmanager/SystemObject.h"
|
||||||
#include <list>
|
#include <set>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This class is the representation of a Polling Sequence Table in software.
|
* @brief This class is the representation of a Polling Sequence Table in software.
|
||||||
@ -24,30 +24,39 @@
|
|||||||
*/
|
*/
|
||||||
class FixedSlotSequence {
|
class FixedSlotSequence {
|
||||||
public:
|
public:
|
||||||
|
using SlotList = std::multiset<FixedSequenceSlot>;
|
||||||
|
using SlotListIter = std::multiset<FixedSequenceSlot>::iterator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief The constructor of the FixedSlotSequence object.
|
* @brief The constructor of the FixedSlotSequence object.
|
||||||
*
|
*
|
||||||
* \details The constructor takes two arguments, the period length and the init function.
|
* @details The constructor takes two arguments, the period length and the init function.
|
||||||
*
|
*
|
||||||
* \param setLength The period length, expressed in ms.
|
* @param setLength The period length, expressed in ms.
|
||||||
*/
|
*/
|
||||||
FixedSlotSequence(uint32_t setLengthMs);
|
FixedSlotSequence(uint32_t setLengthMs);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief The destructor of the FixedSlotSequence object.
|
* @brief The destructor of the FixedSlotSequence object.
|
||||||
*
|
*
|
||||||
* \details The destructor frees all allocated memory by iterating through the slotList
|
* @details The destructor frees all allocated memory by iterating through the slotList
|
||||||
* and deleting all allocated resources.
|
* and deleting all allocated resources.
|
||||||
*/
|
*/
|
||||||
virtual ~FixedSlotSequence();
|
virtual ~FixedSlotSequence();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief This is a method to add an PollingSlot object to slotList.
|
* @brief This is a method to add an PollingSlot object to slotList.
|
||||||
*
|
*
|
||||||
* \details Here, a polling slot object is added to the slot list. It is appended
|
* @details Here, a polling slot object is added to the slot list. It is appended
|
||||||
* to the end of the list. The list is currently NOT reordered.
|
* to the end of the list. The list is currently NOT reordered.
|
||||||
* Afterwards, the iterator current is set to the beginning of the list.
|
* Afterwards, the iterator current is set to the beginning of the list.
|
||||||
|
* @param Object ID of the object to add
|
||||||
|
* @param setTime Value between (0 to 1) * slotLengthMs, when a FixedTimeslotTask
|
||||||
|
* will be called inside the slot period.
|
||||||
|
* @param setSequenceId ID which can be used to distinguish
|
||||||
|
* different task operations
|
||||||
|
* @param
|
||||||
|
* @param
|
||||||
*/
|
*/
|
||||||
void addSlot(object_id_t handlerId, uint32_t setTime, int8_t setSequenceId,
|
void addSlot(object_id_t handlerId, uint32_t setTime, int8_t setSequenceId,
|
||||||
PeriodicTaskIF* executingTask);
|
PeriodicTaskIF* executingTask);
|
||||||
@ -61,47 +70,59 @@ public:
|
|||||||
bool slotFollowsImmediately();
|
bool slotFollowsImmediately();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief This method returns the time until the next software component is invoked.
|
* @brief This method returns the time until the next software
|
||||||
|
* component is invoked.
|
||||||
*
|
*
|
||||||
* \details This method is vitally important for the operation of the PST. By fetching the polling time
|
* @details
|
||||||
* of the current slot and that of the next one (or the first one, if the list end is reached)
|
* This method is vitally important for the operation of the PST.
|
||||||
* it calculates and returns the interval in milliseconds within which the handler execution
|
* By fetching the polling time of the current slot and that of the
|
||||||
* shall take place. If the next slot has the same time as the current one, it is ignored until
|
* next one (or the first one, if the list end is reached)
|
||||||
* a slot with different time or the end of the PST is found.
|
* it calculates and returns the interval in milliseconds within
|
||||||
|
* which the handler execution shall take place.
|
||||||
|
* If the next slot has the same time as the current one, it is ignored
|
||||||
|
* until a slot with different time or the end of the PST is found.
|
||||||
*/
|
*/
|
||||||
uint32_t getIntervalToNextSlotMs();
|
uint32_t getIntervalToNextSlotMs();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief This method returns the time difference between the current slot and the previous slot
|
* @brief This method returns the time difference between the current
|
||||||
|
* slot and the previous slot
|
||||||
*
|
*
|
||||||
* \details This method is vitally important for the operation of the PST. By fetching the polling time
|
* @details
|
||||||
* of the current slot and that of the prevous one (or the last one, if the slot is the first one)
|
* This method is vitally important for the operation of the PST.
|
||||||
* it calculates and returns the interval in milliseconds that the handler execution shall be delayed.
|
* By fetching the polling time of the current slot and that of the previous
|
||||||
|
* one (or the last one, if the slot is the first one) it calculates and
|
||||||
|
* returns the interval in milliseconds that the handler execution shall
|
||||||
|
* be delayed.
|
||||||
*/
|
*/
|
||||||
uint32_t getIntervalToPreviousSlotMs();
|
uint32_t getIntervalToPreviousSlotMs();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief This method returns the length of this FixedSlotSequence instance.
|
* @brief This method returns the length of this FixedSlotSequence instance.
|
||||||
*/
|
*/
|
||||||
uint32_t getLengthMs() const;
|
uint32_t getLengthMs() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief The method to execute the device handler entered in the current OPUSPollingSlot object.
|
* @brief The method to execute the device handler entered in the current
|
||||||
|
* PollingSlot object.
|
||||||
*
|
*
|
||||||
* \details Within this method the device handler object to be executed is chosen by looking up the
|
* @details
|
||||||
* handler address of the current slot in the handlerMap. Either the device handler's
|
* Within this method the device handler object to be executed is chosen by
|
||||||
* talkToInterface or its listenToInterface method is invoked, depending on the isTalking flag
|
* looking up the handler address of the current slot in the handlerMap.
|
||||||
* of the polling slot. After execution the iterator current is increased or, by reaching the
|
* Either the device handler's talkToInterface or its listenToInterface
|
||||||
|
* method is invoked, depending on the isTalking flag of the polling slot.
|
||||||
|
* After execution the iterator current is increased or, by reaching the
|
||||||
* end of slotList, reset to the beginning.
|
* end of slotList, reset to the beginning.
|
||||||
*/
|
*/
|
||||||
void executeAndAdvance();
|
void executeAndAdvance();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief An iterator that indicates the current polling slot to execute.
|
* @brief An iterator that indicates the current polling slot to execute.
|
||||||
*
|
*
|
||||||
* \details This is an iterator for slotList and always points to the polling slot which is executed next.
|
* @details This is an iterator for slotList and always points to the
|
||||||
|
* polling slot which is executed next.
|
||||||
*/
|
*/
|
||||||
std::list<FixedSequenceSlot*>::iterator current;
|
SlotListIter current;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Iterate through slotList and check successful creation.
|
* Iterate through slotList and check successful creation.
|
||||||
@ -109,18 +130,21 @@ public:
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
ReturnValue_t checkSequence() const;
|
ReturnValue_t checkSequence() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief This list contains all OPUSPollingSlot objects, defining order and execution time of the
|
* @brief This list contains all PollingSlot objects, defining order and
|
||||||
* device handler objects.
|
* execution time of the device handler objects.
|
||||||
*
|
*
|
||||||
* \details The slot list is a std:list object that contains all created OPUSPollingSlot instances.
|
* @details
|
||||||
* They are NOT ordered automatically, so by adding entries, the correct order needs to be ensured.
|
* The slot list is a std:list object that contains all created
|
||||||
* By iterating through this list the polling sequence is executed. Two entries with identical
|
* PollingSlot instances. They are NOT ordered automatically, so by
|
||||||
* polling times are executed immediately one after another.
|
* adding entries, the correct order needs to be ensured. By iterating
|
||||||
|
* through this list the polling sequence is executed. Two entries with
|
||||||
|
* identical polling times are executed immediately one after another.
|
||||||
*/
|
*/
|
||||||
std::list<FixedSequenceSlot*> slotList;
|
SlotList slotList;
|
||||||
|
|
||||||
uint32_t lengthMs;
|
uint32_t lengthMs;
|
||||||
};
|
};
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#include <framework/devicehandlers/HealthDevice.h>
|
#include "HealthDevice.h"
|
||||||
#include <framework/ipc/QueueFactory.h>
|
#include "../ipc/QueueFactory.h"
|
||||||
|
|
||||||
HealthDevice::HealthDevice(object_id_t setObjectId,
|
HealthDevice::HealthDevice(object_id_t setObjectId,
|
||||||
MessageQueueId_t parentQueue) :
|
MessageQueueId_t parentQueue) :
|
||||||
@ -38,7 +38,7 @@ MessageQueueId_t HealthDevice::getCommandQueue() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void HealthDevice::setParentQueue(MessageQueueId_t parentQueue) {
|
void HealthDevice::setParentQueue(MessageQueueId_t parentQueue) {
|
||||||
healthHelper.setParentQeueue(parentQueue);
|
healthHelper.setParentQueue(parentQueue);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool HealthDevice::hasHealthChanged() {
|
bool HealthDevice::hasHealthChanged() {
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
#ifndef HEALTHDEVICE_H_
|
#ifndef HEALTHDEVICE_H_
|
||||||
#define HEALTHDEVICE_H_
|
#define HEALTHDEVICE_H_
|
||||||
|
|
||||||
#include <framework/health/HasHealthIF.h>
|
#include "../health/HasHealthIF.h"
|
||||||
#include <framework/health/HealthHelper.h>
|
#include "../health/HealthHelper.h"
|
||||||
#include <framework/objectmanager/SystemObject.h>
|
#include "../objectmanager/SystemObject.h"
|
||||||
#include <framework/tasks/ExecutableObjectIF.h>
|
#include "../tasks/ExecutableObjectIF.h"
|
||||||
#include <framework/ipc/MessageQueueIF.h>
|
#include "../ipc/MessageQueueIF.h"
|
||||||
|
|
||||||
class HealthDevice: public SystemObject,
|
class HealthDevice: public SystemObject,
|
||||||
public ExecutableObjectIF,
|
public ExecutableObjectIF,
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#include <framework/events/Event.h>
|
#include "Event.h"
|
||||||
namespace EVENT {
|
namespace EVENT {
|
||||||
EventId_t getEventId(Event event) {
|
EventId_t getEventId(Event event) {
|
||||||
return (event & 0xFFFF);
|
return (event & 0xFFFF);
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user