add new HasReturnvaluesIF features
This commit is contained in:
parent
e48b6f1432
commit
bdf71d4e66
@ -70,11 +70,12 @@ class ProvidesDataPoolSubscriptionIF {
|
||||
virtual ReturnValue_t subscribeForDiagPeriodicPacket(
|
||||
subdp::DiagnosticsHkPeriodicParams params) = 0;
|
||||
|
||||
[[deprecated("Please use the new API which takes all arguments as one wrapper struct")]]
|
||||
virtual ReturnValue_t subscribeForPeriodicPacket(sid_t sid, bool enableReporting,
|
||||
float collectionInterval, bool isDiagnostics,
|
||||
object_id_t packetDestination) {
|
||||
if(isDiagnostics) {
|
||||
[[deprecated(
|
||||
"Please use the new API which takes all arguments as one wrapper "
|
||||
"struct")]] virtual ReturnValue_t
|
||||
subscribeForPeriodicPacket(sid_t sid, bool enableReporting, float collectionInterval,
|
||||
bool isDiagnostics, object_id_t packetDestination) {
|
||||
if (isDiagnostics) {
|
||||
subdp::DiagnosticsHkPeriodicParams params(sid, enableReporting, collectionInterval);
|
||||
return subscribeForDiagPeriodicPacket(params);
|
||||
} else {
|
||||
@ -96,11 +97,12 @@ class ProvidesDataPoolSubscriptionIF {
|
||||
virtual ReturnValue_t subscribeForRegularUpdatePacket(subdp::RegularHkUpdateParams params) = 0;
|
||||
virtual ReturnValue_t subscribeForDiagUpdatePacket(subdp::DiagnosticsHkUpdateParams params) = 0;
|
||||
|
||||
[[deprecated("Please use the new API which takes all arguments as one wrapper struct")]]
|
||||
virtual ReturnValue_t subscribeForUpdatePacket(sid_t sid, bool reportingEnabled,
|
||||
bool isDiagnostics,
|
||||
object_id_t packetDestination) {
|
||||
if(isDiagnostics) {
|
||||
[[deprecated(
|
||||
"Please use the new API which takes all arguments as one wrapper "
|
||||
"struct")]] virtual ReturnValue_t
|
||||
subscribeForUpdatePacket(sid_t sid, bool reportingEnabled, bool isDiagnostics,
|
||||
object_id_t packetDestination) {
|
||||
if (isDiagnostics) {
|
||||
subdp::DiagnosticsHkUpdateParams params(sid, reportingEnabled);
|
||||
return subscribeForDiagUpdatePacket(params);
|
||||
} else {
|
||||
|
@ -128,7 +128,7 @@ ReturnValue_t InternalErrorReporter::initializeLocalDataPool(localpool::DataPool
|
||||
LocalDataPoolManager &poolManager) {
|
||||
localDataPoolMap.emplace(errorPoolIds::TM_HITS, &tmHitsEntry);
|
||||
localDataPoolMap.emplace(errorPoolIds::QUEUE_HITS, &queueHitsEntry);
|
||||
localDataPoolMap.emplace(errorPoolIds::STORE_HITS,&storeHitsEntry);
|
||||
localDataPoolMap.emplace(errorPoolIds::STORE_HITS, &storeHitsEntry);
|
||||
poolManager.subscribeForDiagPeriodicPacket(subdp::DiagnosticsHkPeriodicParams(
|
||||
internalErrorSid, false,
|
||||
static_cast<float>(getPeriodicOperationFrequency()) / static_cast<float>(1000.0)));
|
||||
|
@ -10,11 +10,21 @@
|
||||
#define MAKE_RETURN_CODE(number) ((INTERFACE_ID << 8) + (number))
|
||||
typedef uint16_t ReturnValue_t;
|
||||
|
||||
namespace retval {
|
||||
static constexpr ReturnValue_t OK = 0;
|
||||
static constexpr ReturnValue_t FAILED = 1;
|
||||
|
||||
static constexpr ReturnValue_t makeCode(uint8_t classId, uint8_t number) {
|
||||
return (static_cast<ReturnValue_t>(classId) << 8) + number;
|
||||
}
|
||||
} // namespace retval
|
||||
|
||||
class HasReturnvaluesIF {
|
||||
public:
|
||||
static const ReturnValue_t RETURN_OK = 0;
|
||||
static const ReturnValue_t RETURN_FAILED = 1;
|
||||
virtual ~HasReturnvaluesIF() {}
|
||||
static const ReturnValue_t RETURN_OK = retval::OK;
|
||||
static const ReturnValue_t RETURN_FAILED = retval::FAILED;
|
||||
|
||||
virtual ~HasReturnvaluesIF() = default;
|
||||
|
||||
/**
|
||||
* It is discouraged to use the input parameters 0,0 and 0,1 as this
|
||||
@ -23,8 +33,9 @@ class HasReturnvaluesIF {
|
||||
* @param number
|
||||
* @return
|
||||
*/
|
||||
static constexpr ReturnValue_t makeReturnCode(uint8_t classId, uint8_t number) {
|
||||
return (static_cast<ReturnValue_t>(classId) << 8) + number;
|
||||
[[deprecated("Use retval::makeCode instead")]] static constexpr ReturnValue_t makeReturnCode(
|
||||
uint8_t classId, uint8_t number) {
|
||||
return retval::makeCode(classId, number);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -9,5 +9,6 @@ target_sources(
|
||||
SpacePacketParser.cpp
|
||||
TmStoreHelper.cpp
|
||||
TmSendHelper.cpp
|
||||
TmStoreAndSendHelper.cpp
|
||||
tcHelpers.cpp
|
||||
tmHelpers.cpp)
|
||||
|
3
src/fsfw/tmtcservices/TmStoreAndSendHelper.cpp
Normal file
3
src/fsfw/tmtcservices/TmStoreAndSendHelper.cpp
Normal file
@ -0,0 +1,3 @@
|
||||
#include "TmStoreAndSendHelper.h"
|
||||
|
||||
StoreAndSendWrapper::StoreAndSendWrapper(TmStoreHelper& storeHelper, TmSendHelper& sendHelper) {}
|
18
src/fsfw/tmtcservices/TmStoreAndSendHelper.h
Normal file
18
src/fsfw/tmtcservices/TmStoreAndSendHelper.h
Normal file
@ -0,0 +1,18 @@
|
||||
#ifndef FSFW_TMTCSERVICES_TMSTOREANDSENDHELPER_H
|
||||
#define FSFW_TMTCSERVICES_TMSTOREANDSENDHELPER_H
|
||||
|
||||
#include "TmSendHelper.h"
|
||||
#include "TmStoreHelper.h"
|
||||
|
||||
class StoreAndSendWrapper {
|
||||
public:
|
||||
StoreAndSendWrapper(TmStoreHelper& storeHelper, TmSendHelper& sendHelper)
|
||||
: storeHelper(storeHelper), sendHelper(sendHelper) {}
|
||||
ReturnValue_t storeAndSendTmPacket(TmStoreHelper& storeHelper, TmSendHelper& sendHelper,
|
||||
bool delOnFailure = true);
|
||||
TmStoreHelper& storeHelper;
|
||||
TmSendHelper& sendHelper;
|
||||
bool delOnFailure = true;
|
||||
};
|
||||
|
||||
#endif // FSFW_TMTCSERVICES_TMSTOREANDSENDHELPER_H
|
@ -7,9 +7,6 @@
|
||||
// I'd prefer to use tm, but there have been nameclashes with the tm struct
|
||||
namespace telemetry {
|
||||
|
||||
ReturnValue_t storeAndSendTmPacket(TmStoreHelper& storeHelper, TmSendHelper& sendHelper,
|
||||
bool delOnFailure = true);
|
||||
|
||||
class DataWithObjectIdPrefix : public SerializeIF {
|
||||
public:
|
||||
DataWithObjectIdPrefix(object_id_t objectId, const uint8_t* srcData, size_t srcDataLen)
|
||||
@ -34,8 +31,11 @@ class DataWithObjectIdPrefix : public SerializeIF {
|
||||
|
||||
ReturnValue_t deSerialize(const uint8_t** buffer, size_t* size,
|
||||
Endianness streamEndianness) override {
|
||||
// TODO: Implement
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
ReturnValue_t result = SerializeAdapter::deSerialize(&objectId, buffer, size, streamEndianness);
|
||||
if (result != retval::OK) {
|
||||
return result;
|
||||
}
|
||||
return retval::FAILED;
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -30,6 +30,4 @@ int customSetup() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int customTeardown() {
|
||||
return 0;
|
||||
}
|
||||
int customTeardown() { return 0; }
|
||||
|
@ -7,11 +7,10 @@
|
||||
#include <fsfw/datapoollocal/LocalPoolVariable.h>
|
||||
#include <fsfw/datapoollocal/LocalPoolVector.h>
|
||||
#include <fsfw/datapoollocal/StaticLocalDataSet.h>
|
||||
#include "fsfw/datapool/PoolEntry.h"
|
||||
|
||||
#include <fsfw/ipc/QueueFactory.h>
|
||||
#include <fsfw/objectmanager/SystemObject.h>
|
||||
|
||||
#include "fsfw/datapool/PoolEntry.h"
|
||||
#include "mocks/MessageQueueMock.h"
|
||||
#include "tests/TestsConfig.h"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user