Merge branch 'master' into mueller/HealthHelperIdFix
This commit is contained in:
commit
036a022e66
@ -72,11 +72,15 @@ public:
|
||||
return tmp;
|
||||
}
|
||||
|
||||
T operator*() {
|
||||
T& operator*(){
|
||||
return *value;
|
||||
}
|
||||
|
||||
T *operator->() {
|
||||
const T& operator*() const{
|
||||
return *value;
|
||||
}
|
||||
|
||||
T *operator->(){
|
||||
return value;
|
||||
}
|
||||
|
||||
|
@ -27,14 +27,27 @@ public:
|
||||
|
||||
/**
|
||||
* @brief Custom copy constructor which prevents setting the
|
||||
* underlying pointer wrong.
|
||||
* underlying pointer wrong. This function allocates memory!
|
||||
* @details This is a very heavy operation so try to avoid this!
|
||||
*
|
||||
*/
|
||||
DynamicFIFO(const DynamicFIFO& other): FIFOBase<T>(other),
|
||||
fifoVector(other.maxCapacity) {
|
||||
this->fifoVector = other.fifoVector;
|
||||
this->setContainer(fifoVector.data());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Custom assignment operator
|
||||
* @details This is a very heavy operation so try to avoid this!
|
||||
* @param other DyamicFIFO to copy from
|
||||
*/
|
||||
DynamicFIFO& operator=(const DynamicFIFO& other){
|
||||
FIFOBase<T>::operator=(other);
|
||||
this->fifoVector = other.fifoVector;
|
||||
this->setContainer(fifoVector.data());
|
||||
return *this;
|
||||
}
|
||||
private:
|
||||
std::vector<T> fifoVector;
|
||||
};
|
||||
|
@ -25,9 +25,21 @@ public:
|
||||
* @param other
|
||||
*/
|
||||
FIFO(const FIFO& other): FIFOBase<T>(other) {
|
||||
this->fifoArray = other.fifoArray;
|
||||
this->setContainer(fifoArray.data());
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Custom assignment operator
|
||||
* @param other
|
||||
*/
|
||||
FIFO& operator=(const FIFO& other){
|
||||
FIFOBase<T>::operator=(other);
|
||||
this->fifoArray = other.fifoArray;
|
||||
this->setContainer(fifoArray.data());
|
||||
return *this;
|
||||
}
|
||||
|
||||
private:
|
||||
std::array<T, capacity> fifoArray;
|
||||
};
|
||||
|
@ -1,15 +1,20 @@
|
||||
#ifndef FIXEDMAP_H_
|
||||
#define FIXEDMAP_H_
|
||||
#ifndef FSFW_CONTAINER_FIXEDMAP_H_
|
||||
#define FSFW_CONTAINER_FIXEDMAP_H_
|
||||
|
||||
#include "ArrayList.h"
|
||||
#include "../returnvalues/HasReturnvaluesIF.h"
|
||||
#include <utility>
|
||||
#include <type_traits>
|
||||
|
||||
/**
|
||||
* \ingroup container
|
||||
* @warning Iterators return a non-const key_t in the pair.
|
||||
* @warning A User is not allowed to change the key, otherwise the map is corrupted.
|
||||
* @ingroup container
|
||||
*/
|
||||
template<typename key_t, typename T>
|
||||
class FixedMap: public SerializeIF {
|
||||
static_assert (std::is_trivially_copyable<T>::value or std::is_base_of<SerializeIF, T>::value,
|
||||
"Types used in FixedMap must either be trivial copy-able or a derived Class from SerializeIF to be serialize-able");
|
||||
public:
|
||||
static const uint8_t INTERFACE_ID = CLASS_ID::FIXED_MAP;
|
||||
static const ReturnValue_t KEY_ALREADY_EXISTS = MAKE_RETURN_CODE(0x01);
|
||||
@ -47,15 +52,6 @@ public:
|
||||
Iterator(std::pair<key_t, T> *pair) :
|
||||
ArrayList<std::pair<key_t, T>, uint32_t>::Iterator(pair) {
|
||||
}
|
||||
|
||||
T operator*() {
|
||||
return ArrayList<std::pair<key_t, T>, uint32_t>::Iterator::value->second;
|
||||
}
|
||||
|
||||
T *operator->() {
|
||||
return &ArrayList<std::pair<key_t, T>, uint32_t>::Iterator::value->second;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
Iterator begin() const {
|
||||
@ -70,7 +66,7 @@ public:
|
||||
return _size;
|
||||
}
|
||||
|
||||
ReturnValue_t insert(key_t key, T value, Iterator *storedValue = NULL) {
|
||||
ReturnValue_t insert(key_t key, T value, Iterator *storedValue = nullptr) {
|
||||
if (exists(key) == HasReturnvaluesIF::RETURN_OK) {
|
||||
return KEY_ALREADY_EXISTS;
|
||||
}
|
||||
@ -79,7 +75,7 @@ public:
|
||||
}
|
||||
theMap[_size].first = key;
|
||||
theMap[_size].second = value;
|
||||
if (storedValue != NULL) {
|
||||
if (storedValue != nullptr) {
|
||||
*storedValue = Iterator(&theMap[_size]);
|
||||
}
|
||||
++_size;
|
||||
@ -87,7 +83,7 @@ public:
|
||||
}
|
||||
|
||||
ReturnValue_t insert(std::pair<key_t, T> pair) {
|
||||
return insert(pair.fist, pair.second);
|
||||
return insert(pair.first, pair.second);
|
||||
}
|
||||
|
||||
ReturnValue_t exists(key_t key) const {
|
||||
@ -196,4 +192,4 @@ public:
|
||||
|
||||
};
|
||||
|
||||
#endif /* FIXEDMAP_H_ */
|
||||
#endif /* FSFW_CONTAINER_FIXEDMAP_H_ */
|
||||
|
@ -48,7 +48,7 @@ private:
|
||||
if (_size <= position) {
|
||||
return;
|
||||
}
|
||||
memmove(&theMap[position], &theMap[position + 1],
|
||||
memmove(static_cast<void*>(&theMap[position]), static_cast<void*>(&theMap[position + 1]),
|
||||
(_size - position - 1) * sizeof(std::pair<key_t,T>));
|
||||
--_size;
|
||||
}
|
||||
@ -68,15 +68,6 @@ public:
|
||||
Iterator(std::pair<key_t, T> *pair) :
|
||||
ArrayList<std::pair<key_t, T>, uint32_t>::Iterator(pair) {
|
||||
}
|
||||
|
||||
T operator*() {
|
||||
return ArrayList<std::pair<key_t, T>, uint32_t>::Iterator::value->second;
|
||||
}
|
||||
|
||||
T *operator->() {
|
||||
return &ArrayList<std::pair<key_t, T>, uint32_t>::Iterator::value->second;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
Iterator begin() const {
|
||||
@ -91,17 +82,17 @@ public:
|
||||
return _size;
|
||||
}
|
||||
|
||||
ReturnValue_t insert(key_t key, T value, Iterator *storedValue = NULL) {
|
||||
ReturnValue_t insert(key_t key, T value, Iterator *storedValue = nullptr) {
|
||||
if (_size == theMap.maxSize()) {
|
||||
return MAP_FULL;
|
||||
}
|
||||
uint32_t position = findNicePlace(key);
|
||||
memmove(&theMap[position + 1], &theMap[position],
|
||||
memmove(static_cast<void*>(&theMap[position + 1]),static_cast<void*>(&theMap[position]),
|
||||
(_size - position) * sizeof(std::pair<key_t,T>));
|
||||
theMap[position].first = key;
|
||||
theMap[position].second = value;
|
||||
++_size;
|
||||
if (storedValue != NULL) {
|
||||
if (storedValue != nullptr) {
|
||||
*storedValue = Iterator(&theMap[position]);
|
||||
}
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
@ -145,12 +136,6 @@ public:
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
//This is potentially unsafe
|
||||
// T *findValue(key_t key) const {
|
||||
// return &theMap[findFirstIndex(key)].second;
|
||||
// }
|
||||
|
||||
|
||||
Iterator find(key_t key) const {
|
||||
ReturnValue_t result = exists(key);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
|
@ -1,41 +0,0 @@
|
||||
#ifndef ISDERIVEDFROM_H_
|
||||
#define ISDERIVEDFROM_H_
|
||||
|
||||
template<typename D, typename B>
|
||||
class IsDerivedFrom {
|
||||
class No {
|
||||
};
|
||||
class Yes {
|
||||
No no[3];
|
||||
};
|
||||
|
||||
static Yes Test(B*); // declared, but not defined
|
||||
static No Test(... ); // declared, but not defined
|
||||
|
||||
public:
|
||||
enum {
|
||||
Is = sizeof(Test(static_cast<D*>(0))) == sizeof(Yes)
|
||||
};
|
||||
};
|
||||
|
||||
template<typename, typename>
|
||||
struct is_same {
|
||||
static bool const value = false;
|
||||
};
|
||||
|
||||
template<typename A>
|
||||
struct is_same<A, A> {
|
||||
static bool const value = true;
|
||||
};
|
||||
|
||||
|
||||
template<bool C, typename T = void>
|
||||
struct enable_if {
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct enable_if<false, T> { };
|
||||
|
||||
|
||||
#endif /* ISDERIVEDFROM_H_ */
|
@ -1,11 +1,11 @@
|
||||
#ifndef SERIALIZEADAPTER_H_
|
||||
#define SERIALIZEADAPTER_H_
|
||||
#ifndef _FSFW_SERIALIZE_SERIALIZEADAPTER_H_
|
||||
#define _FSFW_SERIALIZE_SERIALIZEADAPTER_H_
|
||||
|
||||
#include "../container/IsDerivedFrom.h"
|
||||
#include "../returnvalues/HasReturnvaluesIF.h"
|
||||
#include "EndianConverter.h"
|
||||
#include "SerializeIF.h"
|
||||
#include <string.h>
|
||||
#include <cstddef>
|
||||
#include <type_traits>
|
||||
|
||||
/**
|
||||
* \ingroup serialize
|
||||
@ -13,36 +13,91 @@
|
||||
|
||||
class SerializeAdapter {
|
||||
public:
|
||||
/***
|
||||
* This function can be used to serialize a trivial copy-able type or a child of SerializeIF.
|
||||
* The right template to be called is determined in the function itself.
|
||||
* For objects of non trivial copy-able type this function is almost never called by the user directly.
|
||||
* Instead helpers for specific types like SerialArrayListAdapter or SerialLinkedListAdapter is the right choice here.
|
||||
*
|
||||
* @param[in] object Object to serialize, the used type is deduced from this pointer
|
||||
* @param[in/out] buffer Buffer to serialize into. Will be moved by the function.
|
||||
* @param[in/out] size Size of current written buffer. Will be incremented by the function.
|
||||
* @param[in] maxSize Max size of Buffer
|
||||
* @param[in] streamEndianness Endianness of serialized element as in according to SerializeIF::Endianness
|
||||
* @return
|
||||
* - @c BUFFER_TOO_SHORT The given buffer in is too short
|
||||
* - @c RETURN_FAILED Generic Error
|
||||
* - @c RETURN_OK Successful serialization
|
||||
*/
|
||||
template<typename T>
|
||||
static ReturnValue_t serialize(const T *object, uint8_t **buffer,
|
||||
size_t *size, size_t maxSize, SerializeIF::Endianness streamEndianness) {
|
||||
InternalSerializeAdapter<T, IsDerivedFrom<T, SerializeIF>::Is> adapter;
|
||||
size_t *size, size_t maxSize,
|
||||
SerializeIF::Endianness streamEndianness) {
|
||||
InternalSerializeAdapter<T, std::is_base_of<SerializeIF, T>::value> adapter;
|
||||
return adapter.serialize(object, buffer, size, maxSize,
|
||||
streamEndianness);
|
||||
}
|
||||
/**
|
||||
* Function to return the serialized size of the object in the pointer.
|
||||
* May be a trivially copy-able object or a Child of SerializeIF
|
||||
*
|
||||
* @param object Pointer to Object
|
||||
* @return Serialized size of object
|
||||
*/
|
||||
template<typename T>
|
||||
static uint32_t getSerializedSize(const T *object) {
|
||||
InternalSerializeAdapter<T, IsDerivedFrom<T, SerializeIF>::Is> adapter;
|
||||
static size_t getSerializedSize(const T *object){
|
||||
InternalSerializeAdapter<T, std::is_base_of<SerializeIF, T>::value> adapter;
|
||||
return adapter.getSerializedSize(object);
|
||||
}
|
||||
/**
|
||||
* @brief
|
||||
* Deserializes a object from a given buffer of given size.
|
||||
* Object Must be trivially copy-able or a child of SerializeIF.
|
||||
*
|
||||
* @details
|
||||
* Buffer will be moved to the current read location. Size will be decreased by the function.
|
||||
*
|
||||
* @param[in/out] buffer Buffer to deSerialize from. Will be moved by the function.
|
||||
* @param[in/out] size Remaining size of the buffer to read from. Will be decreased by function.
|
||||
* @param[in] streamEndianness Endianness as in according to SerializeIF::Endianness
|
||||
* @return
|
||||
* - @c STREAM_TOO_SHORT The input stream is too short to deSerialize the object
|
||||
* - @c TOO_MANY_ELEMENTS The buffer has more inputs than expected
|
||||
* - @c RETURN_FAILED Generic Error
|
||||
* - @c RETURN_OK Successful deserialization
|
||||
*/
|
||||
template<typename T>
|
||||
static ReturnValue_t deSerialize(T *object, const uint8_t **buffer,
|
||||
size_t *size, SerializeIF::Endianness streamEndianness) {
|
||||
InternalSerializeAdapter<T, IsDerivedFrom<T, SerializeIF>::Is> adapter;
|
||||
InternalSerializeAdapter<T, std::is_base_of<SerializeIF, T>::value> adapter;
|
||||
return adapter.deSerialize(object, buffer, size, streamEndianness);
|
||||
}
|
||||
private:
|
||||
template<typename T, int>
|
||||
class InternalSerializeAdapter {
|
||||
/**
|
||||
* Internal template to deduce the right function calls at compile time
|
||||
*/
|
||||
template<typename T, bool> class InternalSerializeAdapter;
|
||||
|
||||
/**
|
||||
* Template to be used if T is not a child of SerializeIF
|
||||
*
|
||||
* @tparam T T must be trivially_copyable
|
||||
*/
|
||||
template<typename T>
|
||||
class InternalSerializeAdapter<T, false> {
|
||||
static_assert (std::is_trivially_copyable<T>::value,
|
||||
"If a type needs to be serialized it must be a child of SerializeIF or trivially copy-able");
|
||||
public:
|
||||
static ReturnValue_t serialize(const T *object, uint8_t **buffer,
|
||||
size_t *size, size_t max_size, SerializeIF::Endianness streamEndianness) {
|
||||
size_t *size, size_t max_size,
|
||||
SerializeIF::Endianness streamEndianness) {
|
||||
size_t ignoredSize = 0;
|
||||
if (size == NULL) {
|
||||
if (size == nullptr) {
|
||||
size = &ignoredSize;
|
||||
}
|
||||
//TODO check integer overflow of *size
|
||||
if (sizeof(T) + *size <= max_size) {
|
||||
//Check remaining size is large enough and check integer overflow of *size
|
||||
size_t newSize = sizeof(T) + *size;
|
||||
if ((newSize <= max_size) and (newSize > *size)) {
|
||||
T tmp;
|
||||
switch (streamEndianness) {
|
||||
case SerializeIF::Endianness::BIG:
|
||||
@ -94,22 +149,26 @@ private:
|
||||
uint32_t getSerializedSize(const T *object) {
|
||||
return sizeof(T);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* Template for objects that inherit from SerializeIF
|
||||
*
|
||||
* @tparam T A child of SerializeIF
|
||||
*/
|
||||
template<typename T>
|
||||
class InternalSerializeAdapter<T, 1> {
|
||||
class InternalSerializeAdapter<T, true> {
|
||||
public:
|
||||
ReturnValue_t serialize(const T *object, uint8_t **buffer,
|
||||
size_t *size, size_t max_size,
|
||||
ReturnValue_t serialize(const T *object, uint8_t **buffer, size_t *size,
|
||||
size_t max_size,
|
||||
SerializeIF::Endianness streamEndianness) const {
|
||||
size_t ignoredSize = 0;
|
||||
if (size == NULL) {
|
||||
if (size == nullptr) {
|
||||
size = &ignoredSize;
|
||||
}
|
||||
return object->serialize(buffer, size, max_size, streamEndianness);
|
||||
}
|
||||
uint32_t getSerializedSize(const T *object) const {
|
||||
size_t getSerializedSize(const T *object) const {
|
||||
return object->getSerializedSize();
|
||||
}
|
||||
|
||||
@ -120,4 +179,4 @@ private:
|
||||
};
|
||||
};
|
||||
|
||||
#endif /* SERIALIZEADAPTER_H_ */
|
||||
#endif /* _FSFW_SERIALIZE_SERIALIZEADAPTER_H_ */
|
||||
|
@ -43,7 +43,7 @@ public:
|
||||
* @param[in] maxSize The size of the buffer that is allowed to be used for serialize.
|
||||
* @param[in] streamEndianness Endianness of the serialized data according to SerializeIF::Endianness
|
||||
* @return
|
||||
* - @¢ BUFFER_TOO_SHORT The given buffer in is too short
|
||||
* - @c BUFFER_TOO_SHORT The given buffer in is too short
|
||||
* - @c RETURN_FAILED Generic error
|
||||
* - @c RETURN_OK Successful serialization
|
||||
*/
|
||||
|
@ -550,7 +550,7 @@ Mode_t Subsystem::getFallbackSequence(Mode_t sequence) {
|
||||
for (FixedMap<Mode_t, SequenceInfo>::Iterator iter = modeSequences.begin();
|
||||
iter != modeSequences.end(); ++iter) {
|
||||
if (iter.value->first == sequence) {
|
||||
return iter->fallbackSequence;
|
||||
return iter->second.fallbackSequence;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
@ -559,7 +559,7 @@ Mode_t Subsystem::getFallbackSequence(Mode_t sequence) {
|
||||
bool Subsystem::isFallbackSequence(Mode_t SequenceId) {
|
||||
for (FixedMap<Mode_t, SequenceInfo>::Iterator iter = modeSequences.begin();
|
||||
iter != modeSequences.end(); iter++) {
|
||||
if (iter->fallbackSequence == SequenceId) {
|
||||
if (iter->second.fallbackSequence == SequenceId) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -122,8 +122,8 @@ void CommandingServiceBase::handleCommandMessage(CommandMessage* reply) {
|
||||
|
||||
|
||||
// Implemented by child class, specifies what to do with reply.
|
||||
ReturnValue_t result = handleReply(reply, iter->command, &iter->state,
|
||||
&nextCommand, iter->objectId, &isStep);
|
||||
ReturnValue_t result = handleReply(reply, iter->second.command, &iter->second.state,
|
||||
&nextCommand, iter->second.objectId, &isStep);
|
||||
|
||||
/* If the child implementation does not implement special handling for
|
||||
* rejected replies (RETURN_FAILED or INVALID_REPLY is returned), a
|
||||
@ -132,7 +132,7 @@ void CommandingServiceBase::handleCommandMessage(CommandMessage* reply) {
|
||||
if((reply->getCommand() == CommandMessage::REPLY_REJECTED) and
|
||||
(result == RETURN_FAILED or result == INVALID_REPLY)) {
|
||||
result = reply->getReplyRejectedReason();
|
||||
failureParameter1 = iter->command;
|
||||
failureParameter1 = iter->second.command;
|
||||
}
|
||||
|
||||
switch (result) {
|
||||
@ -149,14 +149,14 @@ void CommandingServiceBase::handleCommandMessage(CommandMessage* reply) {
|
||||
default:
|
||||
if (isStep) {
|
||||
verificationReporter.sendFailureReport(
|
||||
TC_VERIFY::PROGRESS_FAILURE, iter->tcInfo.ackFlags,
|
||||
iter->tcInfo.tcPacketId, iter->tcInfo.tcSequenceControl,
|
||||
result, ++iter->step, failureParameter1,
|
||||
TC_VERIFY::PROGRESS_FAILURE, iter->second.tcInfo.ackFlags,
|
||||
iter->second.tcInfo.tcPacketId, iter->second.tcInfo.tcSequenceControl,
|
||||
result, ++iter->second.step, failureParameter1,
|
||||
failureParameter2);
|
||||
} else {
|
||||
verificationReporter.sendFailureReport(
|
||||
TC_VERIFY::COMPLETION_FAILURE, iter->tcInfo.ackFlags,
|
||||
iter->tcInfo.tcPacketId, iter->tcInfo.tcSequenceControl,
|
||||
TC_VERIFY::COMPLETION_FAILURE, iter->second.tcInfo.ackFlags,
|
||||
iter->second.tcInfo.tcPacketId, iter->second.tcInfo.tcSequenceControl,
|
||||
result, 0, failureParameter1, failureParameter2);
|
||||
}
|
||||
failureParameter1 = 0;
|
||||
@ -170,7 +170,7 @@ void CommandingServiceBase::handleCommandMessage(CommandMessage* reply) {
|
||||
void CommandingServiceBase::handleReplyHandlerResult(ReturnValue_t result,
|
||||
CommandMapIter iter, CommandMessage* nextCommand,
|
||||
CommandMessage* reply, bool& isStep) {
|
||||
iter->command = nextCommand->getCommand();
|
||||
iter->second.command = nextCommand->getCommand();
|
||||
|
||||
// In case a new command is to be sent immediately, this is performed here.
|
||||
// If no new command is sent, only analyse reply result by initializing
|
||||
@ -185,14 +185,14 @@ void CommandingServiceBase::handleReplyHandlerResult(ReturnValue_t result,
|
||||
if (isStep and result != NO_STEP_MESSAGE) {
|
||||
verificationReporter.sendSuccessReport(
|
||||
TC_VERIFY::PROGRESS_SUCCESS,
|
||||
iter->tcInfo.ackFlags, iter->tcInfo.tcPacketId,
|
||||
iter->tcInfo.tcSequenceControl, ++iter->step);
|
||||
iter->second.tcInfo.ackFlags, iter->second.tcInfo.tcPacketId,
|
||||
iter->second.tcInfo.tcSequenceControl, ++iter->second.step);
|
||||
}
|
||||
else {
|
||||
verificationReporter.sendSuccessReport(
|
||||
TC_VERIFY::COMPLETION_SUCCESS,
|
||||
iter->tcInfo.ackFlags, iter->tcInfo.tcPacketId,
|
||||
iter->tcInfo.tcSequenceControl, 0);
|
||||
iter->second.tcInfo.ackFlags, iter->second.tcInfo.tcPacketId,
|
||||
iter->second.tcInfo.tcSequenceControl, 0);
|
||||
checkAndExecuteFifo(iter);
|
||||
}
|
||||
}
|
||||
@ -200,16 +200,16 @@ void CommandingServiceBase::handleReplyHandlerResult(ReturnValue_t result,
|
||||
if (isStep) {
|
||||
nextCommand->clearCommandMessage();
|
||||
verificationReporter.sendFailureReport(
|
||||
TC_VERIFY::PROGRESS_FAILURE, iter->tcInfo.ackFlags,
|
||||
iter->tcInfo.tcPacketId,
|
||||
iter->tcInfo.tcSequenceControl, sendResult,
|
||||
++iter->step, failureParameter1, failureParameter2);
|
||||
TC_VERIFY::PROGRESS_FAILURE, iter->second.tcInfo.ackFlags,
|
||||
iter->second.tcInfo.tcPacketId,
|
||||
iter->second.tcInfo.tcSequenceControl, sendResult,
|
||||
++iter->second.step, failureParameter1, failureParameter2);
|
||||
} else {
|
||||
nextCommand->clearCommandMessage();
|
||||
verificationReporter.sendFailureReport(
|
||||
TC_VERIFY::COMPLETION_FAILURE,
|
||||
iter->tcInfo.ackFlags, iter->tcInfo.tcPacketId,
|
||||
iter->tcInfo.tcSequenceControl, sendResult, 0,
|
||||
iter->second.tcInfo.ackFlags, iter->second.tcInfo.tcPacketId,
|
||||
iter->second.tcInfo.tcSequenceControl, sendResult, 0,
|
||||
failureParameter1, failureParameter2);
|
||||
}
|
||||
failureParameter1 = 0;
|
||||
@ -248,7 +248,7 @@ void CommandingServiceBase::handleRequestQueue() {
|
||||
iter = commandMap.find(queue);
|
||||
|
||||
if (iter != commandMap.end()) {
|
||||
result = iter->fifo.insert(address);
|
||||
result = iter->second.fifo.insert(address);
|
||||
if (result != RETURN_OK) {
|
||||
rejectPacket(TC_VERIFY::START_FAILURE, &packet, OBJECT_BUSY);
|
||||
}
|
||||
@ -316,11 +316,11 @@ void CommandingServiceBase::startExecution(TcPacketStored *storedPacket,
|
||||
CommandMapIter iter) {
|
||||
ReturnValue_t result = RETURN_OK;
|
||||
CommandMessage command;
|
||||
iter->subservice = storedPacket->getSubService();
|
||||
result = prepareCommand(&command, iter->subservice,
|
||||
iter->second.subservice = storedPacket->getSubService();
|
||||
result = prepareCommand(&command, iter->second.subservice,
|
||||
storedPacket->getApplicationData(),
|
||||
storedPacket->getApplicationDataSize(), &iter->state,
|
||||
iter->objectId);
|
||||
storedPacket->getApplicationDataSize(), &iter->second.state,
|
||||
iter->second.objectId);
|
||||
|
||||
ReturnValue_t sendResult = RETURN_OK;
|
||||
switch (result) {
|
||||
@ -330,13 +330,13 @@ void CommandingServiceBase::startExecution(TcPacketStored *storedPacket,
|
||||
&command);
|
||||
}
|
||||
if (sendResult == RETURN_OK) {
|
||||
Clock::getUptime(&iter->uptimeOfStart);
|
||||
iter->step = 0;
|
||||
iter->subservice = storedPacket->getSubService();
|
||||
iter->command = command.getCommand();
|
||||
iter->tcInfo.ackFlags = storedPacket->getAcknowledgeFlags();
|
||||
iter->tcInfo.tcPacketId = storedPacket->getPacketId();
|
||||
iter->tcInfo.tcSequenceControl =
|
||||
Clock::getUptime(&iter->second.uptimeOfStart);
|
||||
iter->second.step = 0;
|
||||
iter->second.subservice = storedPacket->getSubService();
|
||||
iter->second.command = command.getCommand();
|
||||
iter->second.tcInfo.ackFlags = storedPacket->getAcknowledgeFlags();
|
||||
iter->second.tcInfo.tcPacketId = storedPacket->getPacketId();
|
||||
iter->second.tcInfo.tcSequenceControl =
|
||||
storedPacket->getPacketSequenceControl();
|
||||
acceptPacket(TC_VERIFY::START_SUCCESS, storedPacket);
|
||||
} else {
|
||||
@ -386,7 +386,7 @@ void CommandingServiceBase::acceptPacket(uint8_t reportId,
|
||||
|
||||
void CommandingServiceBase::checkAndExecuteFifo(CommandMapIter iter) {
|
||||
store_address_t address;
|
||||
if (iter->fifo.retrieve(&address) != RETURN_OK) {
|
||||
if (iter->second.fifo.retrieve(&address) != RETURN_OK) {
|
||||
commandMap.erase(&iter);
|
||||
} else {
|
||||
TcPacketStored newPacket(address);
|
||||
@ -412,10 +412,10 @@ void CommandingServiceBase::checkTimeout() {
|
||||
Clock::getUptime(&uptime);
|
||||
CommandMapIter iter;
|
||||
for (iter = commandMap.begin(); iter != commandMap.end(); ++iter) {
|
||||
if ((iter->uptimeOfStart + (timeoutSeconds * 1000)) < uptime) {
|
||||
if ((iter->second.uptimeOfStart + (timeoutSeconds * 1000)) < uptime) {
|
||||
verificationReporter.sendFailureReport(
|
||||
TC_VERIFY::COMPLETION_FAILURE, iter->tcInfo.ackFlags,
|
||||
iter->tcInfo.tcPacketId, iter->tcInfo.tcSequenceControl,
|
||||
TC_VERIFY::COMPLETION_FAILURE, iter->second.tcInfo.ackFlags,
|
||||
iter->second.tcInfo.tcPacketId, iter->second.tcInfo.tcSequenceControl,
|
||||
TIMEOUT);
|
||||
checkAndExecuteFifo(iter);
|
||||
}
|
||||
|
@ -211,8 +211,7 @@ protected:
|
||||
|
||||
virtual void doPeriodicOperation();
|
||||
|
||||
|
||||
struct CommandInfo {
|
||||
struct CommandInfo: public SerializeIF{
|
||||
struct tcInfo {
|
||||
uint8_t ackFlags;
|
||||
uint16_t tcPacketId;
|
||||
@ -225,6 +224,20 @@ protected:
|
||||
Command_t command;
|
||||
object_id_t objectId;
|
||||
FIFO<store_address_t, 3> fifo;
|
||||
|
||||
virtual ReturnValue_t serialize(uint8_t **buffer, size_t *size,
|
||||
size_t maxSize, Endianness streamEndianness) const override{
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
};
|
||||
|
||||
virtual size_t getSerializedSize() const override {
|
||||
return 0;
|
||||
};
|
||||
|
||||
virtual ReturnValue_t deSerialize(const uint8_t **buffer, size_t *size,
|
||||
Endianness streamEndianness) override{
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
};
|
||||
};
|
||||
|
||||
using CommandMapIter = FixedMap<MessageQueueId_t,
|
||||
|
Loading…
Reference in New Issue
Block a user