CFDP FSFW Integration #111
@ -51,6 +51,6 @@ ReturnValue_t CfdpHandler::performOperation(uint8_t opCode) {
|
|||||||
return returnvalue::OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t CfdpHandler::getIdentifier() { return 0; }
|
uint32_t CfdpHandler::getIdentifier() const { return 0; }
|
||||||
|
|
||||||
MessageQueueId_t CfdpHandler::getRequestQueue() { return this->requestQueue->getId(); }
|
MessageQueueId_t CfdpHandler::getRequestQueue() const { return this->requestQueue->getId(); }
|
||||||
|
@ -25,8 +25,8 @@ class CfdpHandler : public ExecutableObjectIF, public AcceptsTelecommandsIF, pub
|
|||||||
virtual ReturnValue_t handleRequest(store_address_t storeId);
|
virtual ReturnValue_t handleRequest(store_address_t storeId);
|
||||||
|
|
||||||
virtual ReturnValue_t initialize() override;
|
virtual ReturnValue_t initialize() override;
|
||||||
virtual uint16_t getIdentifier() override;
|
uint32_t getIdentifier() const override;
|
||||||
MessageQueueId_t getRequestQueue() override;
|
MessageQueueId_t getRequestQueue() const override;
|
||||||
ReturnValue_t performOperation(uint8_t opCode) override;
|
ReturnValue_t performOperation(uint8_t opCode) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -10,8 +10,8 @@
|
|||||||
CService200ModeCommanding::CService200ModeCommanding(object_id_t objectId, uint16_t apid,
|
CService200ModeCommanding::CService200ModeCommanding(object_id_t objectId, uint16_t apid,
|
||||||
uint8_t serviceId, uint8_t numParallelCommands,
|
uint8_t serviceId, uint8_t numParallelCommands,
|
||||||
uint16_t commandTimeoutSeconds)
|
uint16_t commandTimeoutSeconds)
|
||||||
: CommandingServiceBase(objectId, apid, serviceId, numParallelCommands, commandTimeoutSeconds) {
|
: CommandingServiceBase(objectId, apid, "PUS 200 Mode MGMT", serviceId, numParallelCommands,
|
||||||
}
|
commandTimeoutSeconds) {}
|
||||||
|
|
||||||
CService200ModeCommanding::~CService200ModeCommanding() {}
|
CService200ModeCommanding::~CService200ModeCommanding() {}
|
||||||
|
|
||||||
|
@ -10,8 +10,8 @@ CService201HealthCommanding::CService201HealthCommanding(object_id_t objectId, u
|
|||||||
uint8_t serviceId,
|
uint8_t serviceId,
|
||||||
uint8_t numParallelCommands,
|
uint8_t numParallelCommands,
|
||||||
uint16_t commandTimeoutSeconds)
|
uint16_t commandTimeoutSeconds)
|
||||||
: CommandingServiceBase(objectId, apid, serviceId, numParallelCommands, commandTimeoutSeconds) {
|
: CommandingServiceBase(objectId, apid, "PUS 201 Health MGMT", serviceId, numParallelCommands,
|
||||||
}
|
commandTimeoutSeconds) {}
|
||||||
|
|
||||||
ReturnValue_t CService201HealthCommanding::isValidSubservice(uint8_t subservice) {
|
ReturnValue_t CService201HealthCommanding::isValidSubservice(uint8_t subservice) {
|
||||||
switch (subservice) {
|
switch (subservice) {
|
||||||
|
@ -16,7 +16,9 @@ inline Service11TelecommandScheduling<MAX_NUM_TCS>::Service11TelecommandScheduli
|
|||||||
: PusServiceBase(params),
|
: PusServiceBase(params),
|
||||||
RELEASE_TIME_MARGIN_SECONDS(releaseTimeMarginSeconds),
|
RELEASE_TIME_MARGIN_SECONDS(releaseTimeMarginSeconds),
|
||||||
debugMode(debugMode),
|
debugMode(debugMode),
|
||||||
tcRecipient(tcRecipient) {}
|
tcRecipient(tcRecipient) {
|
||||||
|
params.name = "PUS 11 TC Scheduling";
|
||||||
|
}
|
||||||
|
|
||||||
template <size_t MAX_NUM_TCS>
|
template <size_t MAX_NUM_TCS>
|
||||||
inline Service11TelecommandScheduling<MAX_NUM_TCS>::~Service11TelecommandScheduling() = default;
|
inline Service11TelecommandScheduling<MAX_NUM_TCS>::~Service11TelecommandScheduling() = default;
|
||||||
|
@ -8,7 +8,9 @@
|
|||||||
Service17Test::Service17Test(PsbParams params)
|
Service17Test::Service17Test(PsbParams params)
|
||||||
: PusServiceBase(params),
|
: PusServiceBase(params),
|
||||||
storeHelper(params.apid),
|
storeHelper(params.apid),
|
||||||
tmHelper(params.serviceId, storeHelper, sendHelper) {}
|
tmHelper(params.serviceId, storeHelper, sendHelper) {
|
||||||
|
params.name = "PUS 17 Test";
|
||||||
|
}
|
||||||
|
|
||||||
Service17Test::~Service17Test() = default;
|
Service17Test::~Service17Test() = default;
|
||||||
|
|
||||||
|
@ -11,8 +11,8 @@ Service20ParameterManagement::Service20ParameterManagement(object_id_t objectId,
|
|||||||
uint8_t serviceId,
|
uint8_t serviceId,
|
||||||
uint8_t numberOfParallelCommands,
|
uint8_t numberOfParallelCommands,
|
||||||
uint16_t commandTimeoutSeconds)
|
uint16_t commandTimeoutSeconds)
|
||||||
: CommandingServiceBase(objectId, apid, serviceId, numberOfParallelCommands,
|
: CommandingServiceBase(objectId, apid, "PUS 20 Parameter MGMT", serviceId,
|
||||||
commandTimeoutSeconds) {}
|
numberOfParallelCommands, commandTimeoutSeconds) {}
|
||||||
|
|
||||||
Service20ParameterManagement::~Service20ParameterManagement() = default;
|
Service20ParameterManagement::~Service20ParameterManagement() = default;
|
||||||
|
|
||||||
|
@ -14,8 +14,8 @@
|
|||||||
Service2DeviceAccess::Service2DeviceAccess(object_id_t objectId, uint16_t apid, uint8_t serviceId,
|
Service2DeviceAccess::Service2DeviceAccess(object_id_t objectId, uint16_t apid, uint8_t serviceId,
|
||||||
uint8_t numberOfParallelCommands,
|
uint8_t numberOfParallelCommands,
|
||||||
uint16_t commandTimeoutSeconds)
|
uint16_t commandTimeoutSeconds)
|
||||||
: CommandingServiceBase(objectId, apid, serviceId, numberOfParallelCommands,
|
: CommandingServiceBase(objectId, apid, "PUS 2 Raw Commanding", serviceId,
|
||||||
commandTimeoutSeconds) {}
|
numberOfParallelCommands, commandTimeoutSeconds) {}
|
||||||
|
|
||||||
Service2DeviceAccess::~Service2DeviceAccess() {}
|
Service2DeviceAccess::~Service2DeviceAccess() {}
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
#include "fsfw/pus/servicepackets/Service3Packets.h"
|
#include "fsfw/pus/servicepackets/Service3Packets.h"
|
||||||
|
|
||||||
Service3Housekeeping::Service3Housekeeping(object_id_t objectId, uint16_t apid, uint8_t serviceId)
|
Service3Housekeeping::Service3Housekeeping(object_id_t objectId, uint16_t apid, uint8_t serviceId)
|
||||||
: CommandingServiceBase(objectId, apid, serviceId, NUM_OF_PARALLEL_COMMANDS,
|
: CommandingServiceBase(objectId, apid, "PUS 3 HK", serviceId, NUM_OF_PARALLEL_COMMANDS,
|
||||||
COMMAND_TIMEOUT_SECONDS) {}
|
COMMAND_TIMEOUT_SECONDS) {}
|
||||||
|
|
||||||
Service3Housekeeping::~Service3Housekeeping() {}
|
Service3Housekeeping::~Service3Housekeeping() {}
|
||||||
|
@ -13,6 +13,7 @@ Service5EventReporting::Service5EventReporting(PsbParams params, size_t maxNumbe
|
|||||||
storeHelper(params.apid),
|
storeHelper(params.apid),
|
||||||
tmHelper(params.serviceId, storeHelper, sendHelper),
|
tmHelper(params.serviceId, storeHelper, sendHelper),
|
||||||
maxNumberReportsPerCycle(maxNumberReportsPerCycle) {
|
maxNumberReportsPerCycle(maxNumberReportsPerCycle) {
|
||||||
|
psbParams.name = "PUS 5 Event Reporting";
|
||||||
eventQueue = QueueFactory::instance()->createMessageQueue(messageQueueDepth);
|
eventQueue = QueueFactory::instance()->createMessageQueue(messageQueueDepth);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,8 +12,8 @@ Service8FunctionManagement::Service8FunctionManagement(object_id_t objectId, uin
|
|||||||
uint8_t serviceId,
|
uint8_t serviceId,
|
||||||
uint8_t numParallelCommands,
|
uint8_t numParallelCommands,
|
||||||
uint16_t commandTimeoutSeconds)
|
uint16_t commandTimeoutSeconds)
|
||||||
: CommandingServiceBase(objectId, apid, serviceId, numParallelCommands, commandTimeoutSeconds) {
|
: CommandingServiceBase(objectId, apid, "PUS 8 Functional Commanding", serviceId,
|
||||||
}
|
numParallelCommands, commandTimeoutSeconds) {}
|
||||||
|
|
||||||
Service8FunctionManagement::~Service8FunctionManagement() {}
|
Service8FunctionManagement::~Service8FunctionManagement() {}
|
||||||
|
|
||||||
|
@ -5,7 +5,9 @@
|
|||||||
#include "fsfw/serviceinterface/ServiceInterface.h"
|
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||||
#include "fsfw/timemanager/CCSDSTime.h"
|
#include "fsfw/timemanager/CCSDSTime.h"
|
||||||
|
|
||||||
Service9TimeManagement::Service9TimeManagement(PsbParams params) : PusServiceBase(params) {}
|
Service9TimeManagement::Service9TimeManagement(PsbParams params) : PusServiceBase(params) {
|
||||||
|
params.name = "PUS 9 Time MGMT";
|
||||||
|
}
|
||||||
|
|
||||||
Service9TimeManagement::~Service9TimeManagement() = default;
|
Service9TimeManagement::~Service9TimeManagement() = default;
|
||||||
|
|
||||||
|
@ -33,9 +33,9 @@ class CFDPDistributor : public TcDistributor,
|
|||||||
*/
|
*/
|
||||||
~CFDPDistributor() override;
|
~CFDPDistributor() override;
|
||||||
ReturnValue_t registerHandler(AcceptsTelecommandsIF* handler) override;
|
ReturnValue_t registerHandler(AcceptsTelecommandsIF* handler) override;
|
||||||
MessageQueueId_t getRequestQueue() override;
|
MessageQueueId_t getRequestQueue() const override;
|
||||||
ReturnValue_t initialize() override;
|
ReturnValue_t initialize() override;
|
||||||
uint16_t getIdentifier() override;
|
uint32_t getIdentifier() const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
uint16_t apid;
|
uint16_t apid;
|
||||||
|
@ -1,9 +1,4 @@
|
|||||||
target_sources(
|
target_sources(
|
||||||
${LIB_FSFW_NAME}
|
${LIB_FSFW_NAME}
|
||||||
PRIVATE CCSDSDistributor.cpp
|
PRIVATE CcsdsDistributor.cpp PusDistributor.cpp TcDistributorBase.cpp
|
||||||
PusDistributor.cpp
|
PusPacketChecker.cpp TcPacketCheckCFDP.cpp CcsdsPacketChecker.cpp)
|
||||||
TcDistributor.cpp
|
|
||||||
PusPacketChecker.cpp
|
|
||||||
TcPacketCheckCFDP.cpp
|
|
||||||
CFDPDistributor.cpp
|
|
||||||
CcsdsPacketChecker.cpp)
|
|
||||||
|
@ -10,19 +10,19 @@ ReturnValue_t CcsdsPacketChecker::checkPacket(const SpacePacketReader& currentPa
|
|||||||
size_t packetLen) {
|
size_t packetLen) {
|
||||||
if (checkApid) {
|
if (checkApid) {
|
||||||
if (currentPacket.getApid() != apid) {
|
if (currentPacket.getApid() != apid) {
|
||||||
return tcdistrib::INVALID_APID;
|
return tmtcdistrib::INVALID_APID;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (currentPacket.getVersion() != ccsdsVersion) {
|
if (currentPacket.getVersion() != ccsdsVersion) {
|
||||||
return tcdistrib::INVALID_CCSDS_VERSION;
|
return tmtcdistrib::INVALID_CCSDS_VERSION;
|
||||||
}
|
}
|
||||||
if (currentPacket.getPacketType() != packetType) {
|
if (currentPacket.getPacketType() != packetType) {
|
||||||
return tcdistrib::INVALID_PACKET_TYPE;
|
return tmtcdistrib::INVALID_PACKET_TYPE;
|
||||||
}
|
}
|
||||||
// This assumes that the getFullPacketLen version uses the space packet data length field
|
// This assumes that the getFullPacketLen version uses the space packet data length field
|
||||||
if (currentPacket.getFullPacketLen() != packetLen) {
|
if (currentPacket.getFullPacketLen() != packetLen) {
|
||||||
return tcdistrib::INCOMPLETE_PACKET;
|
return tmtcdistrib::INCOMPLETE_PACKET;
|
||||||
}
|
}
|
||||||
return returnvalue::OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
@ -3,14 +3,14 @@
|
|||||||
#include "definitions.h"
|
#include "definitions.h"
|
||||||
#include "fsfw/objectmanager/ObjectManager.h"
|
#include "fsfw/objectmanager/ObjectManager.h"
|
||||||
#include "fsfw/serviceinterface/ServiceInterface.h"
|
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||||
#include "fsfw/tcdistribution/CCSDSDistributorIF.h"
|
#include "fsfw/tcdistribution/CcsdsDistributorIF.h"
|
||||||
#include "fsfw/tmtcservices/PusVerificationReport.h"
|
#include "fsfw/tmtcservices/PusVerificationReport.h"
|
||||||
|
|
||||||
#define PUS_DISTRIBUTOR_DEBUGGING 0
|
#define PUS_DISTRIBUTOR_DEBUGGING 0
|
||||||
|
|
||||||
PusDistributor::PusDistributor(uint16_t setApid, object_id_t setObjectId,
|
PusDistributor::PusDistributor(uint16_t setApid, object_id_t setObjectId,
|
||||||
CCSDSDistributorIF* distributor, StorageManagerIF* store_)
|
CcsdsDistributorIF* distributor, StorageManagerIF* store_)
|
||||||
: TcDistributor(setObjectId),
|
: TcDistributorBase(setObjectId),
|
||||||
store(store_),
|
store(store_),
|
||||||
checker(setApid, ccsds::PacketType::TC),
|
checker(setApid, ccsds::PacketType::TC),
|
||||||
ccsdsDistributor(distributor),
|
ccsdsDistributor(distributor),
|
||||||
@ -18,42 +18,41 @@ PusDistributor::PusDistributor(uint16_t setApid, object_id_t setObjectId,
|
|||||||
|
|
||||||
PusDistributor::~PusDistributor() = default;
|
PusDistributor::~PusDistributor() = default;
|
||||||
|
|
||||||
PusDistributor::TcMqMapIter PusDistributor::selectDestination() {
|
ReturnValue_t PusDistributor::selectDestination(MessageQueueId_t& destId) {
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1 && PUS_DISTRIBUTOR_DEBUGGING == 1
|
#if FSFW_CPP_OSTREAM_ENABLED == 1 && PUS_DISTRIBUTOR_DEBUGGING == 1
|
||||||
store_address_t storeId = currentMessage.getStorageId();
|
store_address_t storeId = currentMessage.getStorageId();
|
||||||
sif::debug << "PUSDistributor::handlePacket received: " << storeId.poolIndex << ", "
|
sif::debug << "PUSDistributor::handlePacket received: " << storeId.poolIndex << ", "
|
||||||
<< storeId.packetIndex << std::endl;
|
<< storeId.packetIndex << std::endl;
|
||||||
#endif
|
#endif
|
||||||
auto queueMapIt = queueMap.end();
|
|
||||||
// TODO: Need to set the data
|
// TODO: Need to set the data
|
||||||
const uint8_t* packetPtr = nullptr;
|
const uint8_t* packetPtr = nullptr;
|
||||||
size_t packetLen = 0;
|
size_t packetLen = 0;
|
||||||
if (store->getData(currentMessage.getStorageId(), &packetPtr, &packetLen) != returnvalue::OK) {
|
ReturnValue_t result =
|
||||||
return queueMapIt;
|
store->getData(currentMessage.getStorageId(), &packetPtr, &packetLen) != returnvalue::OK;
|
||||||
}
|
|
||||||
ReturnValue_t result = reader.setReadOnlyData(packetPtr, packetLen);
|
|
||||||
if (result != returnvalue::OK) {
|
if (result != returnvalue::OK) {
|
||||||
tcStatus = PACKET_LOST;
|
tcStatus = PACKET_LOST;
|
||||||
return queueMapIt;
|
return result;
|
||||||
|
}
|
||||||
|
result = reader.setReadOnlyData(packetPtr, packetLen);
|
||||||
|
if (result != returnvalue::OK) {
|
||||||
|
tcStatus = PACKET_LOST;
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
// CRC check done by checker
|
// CRC check done by checker
|
||||||
result = reader.parseDataWithoutCrcCheck();
|
result = reader.parseDataWithoutCrcCheck();
|
||||||
if (result != returnvalue::OK) {
|
if (result != returnvalue::OK) {
|
||||||
tcStatus = PACKET_LOST;
|
tcStatus = PACKET_LOST;
|
||||||
return queueMapIt;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (reader.getFullData() != nullptr) {
|
if (reader.getFullData() != nullptr) {
|
||||||
tcStatus = checker.checkPacket(reader, reader.getFullPacketLen());
|
tcStatus = checker.checkPacket(reader, reader.getFullPacketLen());
|
||||||
if (tcStatus != returnvalue::OK) {
|
if (tcStatus != returnvalue::OK) {
|
||||||
checkerFailurePrinter();
|
checkerFailurePrinter();
|
||||||
}
|
}
|
||||||
uint32_t queue_id = reader.getService();
|
uint8_t pusId = reader.getService();
|
||||||
queueMapIt = queueMap.find(queue_id);
|
auto iter = receiverMap.find(pusId);
|
||||||
} else {
|
if (iter == receiverMap.end()) {
|
||||||
tcStatus = PACKET_LOST;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (queueMapIt == this->queueMap.end()) {
|
|
||||||
tcStatus = DESTINATION_NOT_FOUND;
|
tcStatus = DESTINATION_NOT_FOUND;
|
||||||
#if FSFW_VERBOSE_LEVEL >= 1
|
#if FSFW_VERBOSE_LEVEL >= 1
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
@ -63,16 +62,15 @@ PusDistributor::TcMqMapIter PusDistributor::selectDestination() {
|
|||||||
#endif /* !FSFW_CPP_OSTREAM_ENABLED == 1 */
|
#endif /* !FSFW_CPP_OSTREAM_ENABLED == 1 */
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
destId = iter->second.destId;
|
||||||
if (tcStatus != returnvalue::OK) {
|
|
||||||
return this->queueMap.end();
|
|
||||||
} else {
|
} else {
|
||||||
return queueMapIt;
|
tcStatus = PACKET_LOST;
|
||||||
}
|
}
|
||||||
|
return tcStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PusDistributor::registerService(AcceptsTelecommandsIF* service) {
|
ReturnValue_t PusDistributor::registerService(const AcceptsTelecommandsIF& service) {
|
||||||
uint16_t serviceId = service->getIdentifier();
|
uint16_t serviceId = service.getIdentifier();
|
||||||
#if PUS_DISTRIBUTOR_DEBUGGING == 1
|
#if PUS_DISTRIBUTOR_DEBUGGING == 1
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
sif::info << "Service ID: " << static_cast<int>(serviceId) << std::endl;
|
sif::info << "Service ID: " << static_cast<int>(serviceId) << std::endl;
|
||||||
@ -80,8 +78,8 @@ ReturnValue_t PusDistributor::registerService(AcceptsTelecommandsIF* service) {
|
|||||||
sif::printInfo("Service ID: %d\n", static_cast<int>(serviceId));
|
sif::printInfo("Service ID: %d\n", static_cast<int>(serviceId));
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
MessageQueueId_t queue = service->getRequestQueue();
|
MessageQueueId_t queue = service.getRequestQueue();
|
||||||
auto returnPair = queueMap.emplace(serviceId, queue);
|
auto returnPair = receiverMap.emplace(serviceId, ServiceInfo(service.getName(), queue));
|
||||||
if (not returnPair.second) {
|
if (not returnPair.second) {
|
||||||
#if FSFW_VERBOSE_LEVEL >= 1
|
#if FSFW_VERBOSE_LEVEL >= 1
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
@ -97,7 +95,7 @@ ReturnValue_t PusDistributor::registerService(AcceptsTelecommandsIF* service) {
|
|||||||
return returnvalue::OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
MessageQueueId_t PusDistributor::getRequestQueue() { return tcQueue->getId(); }
|
MessageQueueId_t PusDistributor::getRequestQueue() const { return tcQueue->getId(); }
|
||||||
|
|
||||||
ReturnValue_t PusDistributor::callbackAfterSending(ReturnValue_t queueStatus) {
|
ReturnValue_t PusDistributor::callbackAfterSending(ReturnValue_t queueStatus) {
|
||||||
if (queueStatus != returnvalue::OK) {
|
if (queueStatus != returnvalue::OK) {
|
||||||
@ -115,7 +113,7 @@ ReturnValue_t PusDistributor::callbackAfterSending(ReturnValue_t queueStatus) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t PusDistributor::getIdentifier() { return checker.getApid(); }
|
uint32_t PusDistributor::getIdentifier() const { return checker.getApid(); }
|
||||||
|
|
||||||
ReturnValue_t PusDistributor::initialize() {
|
ReturnValue_t PusDistributor::initialize() {
|
||||||
if (store == nullptr) {
|
if (store == nullptr) {
|
||||||
@ -130,7 +128,7 @@ ReturnValue_t PusDistributor::initialize() {
|
|||||||
sif::error << " Make sure it exists and implements CCSDSDistributorIF!" << std::endl;
|
sif::error << " Make sure it exists and implements CCSDSDistributorIF!" << std::endl;
|
||||||
#else
|
#else
|
||||||
sif::printError("PusDistributor::initialize: Packet source invalid\n");
|
sif::printError("PusDistributor::initialize: Packet source invalid\n");
|
||||||
sif::printError("Make sure it exists and implements CCSDSDistributorIF\n");
|
sif::printError("Make sure it exists and implements CcsdsDistributorIF\n");
|
||||||
#endif
|
#endif
|
||||||
return ObjectManagerIF::CHILD_INIT_FAILED;
|
return ObjectManagerIF::CHILD_INIT_FAILED;
|
||||||
}
|
}
|
||||||
@ -141,28 +139,29 @@ ReturnValue_t PusDistributor::initialize() {
|
|||||||
return ObjectManagerIF::CHILD_INIT_FAILED;
|
return ObjectManagerIF::CHILD_INIT_FAILED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ccsdsDistributor->registerApplication(this);
|
return ccsdsDistributor->registerApplication(CcsdsDistributorIF::DestInfo(*this, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
void PusDistributor::checkerFailurePrinter() const {
|
void PusDistributor::checkerFailurePrinter() const {
|
||||||
#if FSFW_VERBOSE_LEVEL >= 1
|
#if FSFW_VERBOSE_LEVEL >= 1
|
||||||
const char* keyword = "unnamed error";
|
const char* reason = "Unknown reason";
|
||||||
if (tcStatus == tcdistrib::INCORRECT_CHECKSUM) {
|
if (tcStatus == tmtcdistrib::INCORRECT_CHECKSUM) {
|
||||||
keyword = "checksum";
|
reason = "Checksum Error";
|
||||||
} else if (tcStatus == tcdistrib::INCORRECT_PRIMARY_HEADER) {
|
} else if (tcStatus == tmtcdistrib::INCORRECT_PRIMARY_HEADER) {
|
||||||
keyword = "incorrect primary header";
|
reason = "Incorrect Primary Header";
|
||||||
} else if (tcStatus == tcdistrib::INVALID_APID) {
|
} else if (tcStatus == tmtcdistrib::INVALID_APID) {
|
||||||
keyword = "illegal APID";
|
reason = "Illegal APID";
|
||||||
} else if (tcStatus == tcdistrib::INCORRECT_SECONDARY_HEADER) {
|
} else if (tcStatus == tmtcdistrib::INCORRECT_SECONDARY_HEADER) {
|
||||||
keyword = "incorrect secondary header";
|
reason = "Incorrect Secondary Header";
|
||||||
} else if (tcStatus == tcdistrib::INCOMPLETE_PACKET) {
|
} else if (tcStatus == tmtcdistrib::INCOMPLETE_PACKET) {
|
||||||
keyword = "incomplete packet";
|
reason = "Incomplete packet";
|
||||||
}
|
}
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
sif::warning << "PUSDistributor::handlePacket: Packet format invalid, " << keyword << " error"
|
sif::warning << "PUSDistributor::handlePacket: Check failed: " << reason << std::endl;
|
||||||
<< std::endl;
|
|
||||||
#else
|
#else
|
||||||
sif::printWarning("PUSDistributor::handlePacket: Packet format invalid, %s error\n", keyword);
|
sif::printWarning("PUSDistributor::handlePacket: Check failed: %s\n", reason);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char* PusDistributor::getName() const { return "PUS Distributor"; }
|
||||||
|
@ -1,15 +1,17 @@
|
|||||||
#ifndef FSFW_TCDISTRIBUTION_PUSDISTRIBUTOR_H_
|
#ifndef FSFW_TCDISTRIBUTION_PUSDISTRIBUTOR_H_
|
||||||
#define FSFW_TCDISTRIBUTION_PUSDISTRIBUTOR_H_
|
#define FSFW_TCDISTRIBUTION_PUSDISTRIBUTOR_H_
|
||||||
|
|
||||||
#include "PUSDistributorIF.h"
|
#include <map>
|
||||||
|
|
||||||
|
#include "PusDistributorIF.h"
|
||||||
#include "PusPacketChecker.h"
|
#include "PusPacketChecker.h"
|
||||||
#include "TcDistributor.h"
|
#include "TcDistributorBase.h"
|
||||||
#include "fsfw/returnvalues/returnvalue.h"
|
#include "fsfw/returnvalues/returnvalue.h"
|
||||||
#include "fsfw/tmtcpacket/pus/tc.h"
|
#include "fsfw/tmtcpacket/pus/tc.h"
|
||||||
#include "fsfw/tmtcservices/AcceptsTelecommandsIF.h"
|
#include "fsfw/tmtcservices/AcceptsTelecommandsIF.h"
|
||||||
#include "fsfw/tmtcservices/VerificationReporter.h"
|
#include "fsfw/tmtcservices/VerificationReporter.h"
|
||||||
|
|
||||||
class CCSDSDistributorIF;
|
class CcsdsDistributorIF;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class accepts PUS Telecommands and forwards them to Application
|
* This class accepts PUS Telecommands and forwards them to Application
|
||||||
@ -17,7 +19,9 @@ class CCSDSDistributorIF;
|
|||||||
* sends acceptance success or failure messages.
|
* sends acceptance success or failure messages.
|
||||||
* @ingroup tc_distribution
|
* @ingroup tc_distribution
|
||||||
*/
|
*/
|
||||||
class PusDistributor : public TcDistributor, public PUSDistributorIF, public AcceptsTelecommandsIF {
|
class PusDistributor : public TcDistributorBase,
|
||||||
|
public PusDistributorIF,
|
||||||
|
public AcceptsTelecommandsIF {
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* The ctor passes @c set_apid to the checker class and calls the
|
* The ctor passes @c set_apid to the checker class and calls the
|
||||||
@ -25,20 +29,31 @@ class PusDistributor : public TcDistributor, public PUSDistributorIF, public Acc
|
|||||||
* @param setApid The APID of this receiving Application.
|
* @param setApid The APID of this receiving Application.
|
||||||
* @param setObjectId Object ID of the distributor itself
|
* @param setObjectId Object ID of the distributor itself
|
||||||
* @param setPacketSource Object ID of the source of TC packets.
|
* @param setPacketSource Object ID of the source of TC packets.
|
||||||
* Must implement CCSDSDistributorIF.
|
* Must implement CcsdsDistributorIF.
|
||||||
*/
|
*/
|
||||||
PusDistributor(uint16_t setApid, object_id_t setObjectId, CCSDSDistributorIF* packetSource,
|
PusDistributor(uint16_t setApid, object_id_t setObjectId, CcsdsDistributorIF* packetSource,
|
||||||
StorageManagerIF* store = nullptr);
|
StorageManagerIF* store = nullptr);
|
||||||
|
[[nodiscard]] const char* getName() const override;
|
||||||
/**
|
/**
|
||||||
* The destructor is empty.
|
* The destructor is empty.
|
||||||
*/
|
*/
|
||||||
~PusDistributor() override;
|
~PusDistributor() override;
|
||||||
ReturnValue_t registerService(AcceptsTelecommandsIF* service) override;
|
ReturnValue_t registerService(const AcceptsTelecommandsIF& service) override;
|
||||||
MessageQueueId_t getRequestQueue() override;
|
[[nodiscard]] MessageQueueId_t getRequestQueue() const override;
|
||||||
ReturnValue_t initialize() override;
|
ReturnValue_t initialize() override;
|
||||||
uint16_t getIdentifier() override;
|
[[nodiscard]] uint32_t getIdentifier() const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
struct ServiceInfo {
|
||||||
|
ServiceInfo(const char* name, MessageQueueId_t destId) : name(name), destId(destId) {}
|
||||||
|
|
||||||
|
const char* name;
|
||||||
|
MessageQueueId_t destId;
|
||||||
|
};
|
||||||
|
/// PUS recipient map. The key value will generally be the PUS Service
|
||||||
|
using PusReceiverMap = std::map<uint8_t, ServiceInfo>;
|
||||||
|
|
||||||
|
PusReceiverMap receiverMap;
|
||||||
StorageManagerIF* store;
|
StorageManagerIF* store;
|
||||||
/**
|
/**
|
||||||
* This attribute contains the class, that performs a formal packet check.
|
* This attribute contains the class, that performs a formal packet check.
|
||||||
@ -50,7 +65,7 @@ class PusDistributor : public TcDistributor, public PUSDistributorIF, public Acc
|
|||||||
*/
|
*/
|
||||||
VerificationReporterIF* verifyChannel = nullptr;
|
VerificationReporterIF* verifyChannel = nullptr;
|
||||||
//! Cached for initialization
|
//! Cached for initialization
|
||||||
CCSDSDistributorIF* ccsdsDistributor = nullptr;
|
CcsdsDistributorIF* ccsdsDistributor = nullptr;
|
||||||
PusTcReader reader;
|
PusTcReader reader;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -67,7 +82,7 @@ class PusDistributor : public TcDistributor, public PUSDistributorIF, public Acc
|
|||||||
* @return Iterator to map entry of found service id
|
* @return Iterator to map entry of found service id
|
||||||
* or iterator to @c map.end().
|
* or iterator to @c map.end().
|
||||||
*/
|
*/
|
||||||
TcMqMapIter selectDestination() override;
|
ReturnValue_t selectDestination(MessageQueueId_t& destId) override;
|
||||||
/**
|
/**
|
||||||
* The callback here handles the generation of acceptance
|
* The callback here handles the generation of acceptance
|
||||||
* success/failure messages.
|
* success/failure messages.
|
||||||
|
@ -12,17 +12,17 @@ PusPacketChecker::PusPacketChecker(uint16_t apid, ccsds::PacketType packetType_,
|
|||||||
ReturnValue_t PusPacketChecker::checkPacket(const PusTcReader& pusPacket, size_t packetLen) {
|
ReturnValue_t PusPacketChecker::checkPacket(const PusTcReader& pusPacket, size_t packetLen) {
|
||||||
// Other primary header fields are checked by base class
|
// Other primary header fields are checked by base class
|
||||||
if (not pusPacket.hasSecHeader()) {
|
if (not pusPacket.hasSecHeader()) {
|
||||||
return tcdistrib::INVALID_SEC_HEADER_FIELD;
|
return tmtcdistrib::INVALID_SEC_HEADER_FIELD;
|
||||||
}
|
}
|
||||||
uint16_t calculated_crc = CRC::crc16ccitt(pusPacket.getFullData(), pusPacket.getFullPacketLen());
|
uint16_t calculated_crc = CRC::crc16ccitt(pusPacket.getFullData(), pusPacket.getFullPacketLen());
|
||||||
if (calculated_crc != 0) {
|
if (calculated_crc != 0) {
|
||||||
return tcdistrib::INCORRECT_CHECKSUM;
|
return tmtcdistrib::INCORRECT_CHECKSUM;
|
||||||
}
|
}
|
||||||
if (pusPacket.getApid() != apid) {
|
if (pusPacket.getApid() != apid) {
|
||||||
return tcdistrib::INVALID_APID;
|
return tmtcdistrib::INVALID_APID;
|
||||||
}
|
}
|
||||||
if (pusPacket.getPusVersion() != pusVersion) {
|
if (pusPacket.getPusVersion() != pusVersion) {
|
||||||
return tcdistrib::INVALID_PUS_VERSION;
|
return tmtcdistrib::INVALID_PUS_VERSION;
|
||||||
}
|
}
|
||||||
return returnvalue::OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
@ -3,16 +3,19 @@
|
|||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
|
#include "fsfw/events/Event.h"
|
||||||
|
#include "fsfw/events/fwSubsystemIdRanges.h"
|
||||||
#include "fsfw/returnvalues/FwClassIds.h"
|
#include "fsfw/returnvalues/FwClassIds.h"
|
||||||
#include "fsfw/returnvalues/returnvalue.h"
|
#include "fsfw/returnvalues/returnvalue.h"
|
||||||
|
|
||||||
namespace tcdistrib {
|
namespace tmtcdistrib {
|
||||||
static const uint8_t INTERFACE_ID = CLASS_ID::PACKET_CHECK;
|
static const uint8_t INTERFACE_ID = CLASS_ID::TMTC_DISTRIBUTION;
|
||||||
static constexpr ReturnValue_t INVALID_CCSDS_VERSION = MAKE_RETURN_CODE(0);
|
static constexpr ReturnValue_t NO_DESTINATION_FOUND = returnvalue::makeCode(INTERFACE_ID, 0);
|
||||||
static constexpr ReturnValue_t INVALID_APID = MAKE_RETURN_CODE(1);
|
static constexpr ReturnValue_t INVALID_CCSDS_VERSION = MAKE_RETURN_CODE(1);
|
||||||
static constexpr ReturnValue_t INVALID_PACKET_TYPE = MAKE_RETURN_CODE(2);
|
static constexpr ReturnValue_t INVALID_APID = MAKE_RETURN_CODE(2);
|
||||||
static constexpr ReturnValue_t INVALID_SEC_HEADER_FIELD = MAKE_RETURN_CODE(3);
|
static constexpr ReturnValue_t INVALID_PACKET_TYPE = MAKE_RETURN_CODE(3);
|
||||||
static constexpr ReturnValue_t INCORRECT_PRIMARY_HEADER = MAKE_RETURN_CODE(4);
|
static constexpr ReturnValue_t INVALID_SEC_HEADER_FIELD = MAKE_RETURN_CODE(4);
|
||||||
|
static constexpr ReturnValue_t INCORRECT_PRIMARY_HEADER = MAKE_RETURN_CODE(5);
|
||||||
|
|
||||||
static constexpr ReturnValue_t INCOMPLETE_PACKET = MAKE_RETURN_CODE(5);
|
static constexpr ReturnValue_t INCOMPLETE_PACKET = MAKE_RETURN_CODE(5);
|
||||||
static constexpr ReturnValue_t INVALID_PUS_VERSION = MAKE_RETURN_CODE(6);
|
static constexpr ReturnValue_t INVALID_PUS_VERSION = MAKE_RETURN_CODE(6);
|
||||||
@ -20,5 +23,9 @@ static constexpr ReturnValue_t INCORRECT_CHECKSUM = MAKE_RETURN_CODE(7);
|
|||||||
static constexpr ReturnValue_t ILLEGAL_PACKET_SUBTYPE = MAKE_RETURN_CODE(8);
|
static constexpr ReturnValue_t ILLEGAL_PACKET_SUBTYPE = MAKE_RETURN_CODE(8);
|
||||||
static constexpr ReturnValue_t INCORRECT_SECONDARY_HEADER = MAKE_RETURN_CODE(9);
|
static constexpr ReturnValue_t INCORRECT_SECONDARY_HEADER = MAKE_RETURN_CODE(9);
|
||||||
|
|
||||||
}; // namespace tcdistrib
|
static constexpr uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::TMTC_DISTRIBUTION;
|
||||||
|
//! P1: Returnvalue, P2: 0 for TM issues, 1 for TC issues
|
||||||
|
static constexpr Event HANDLE_PACKET_FAILED = event::makeEvent(SUBSYSTEM_ID, 0, severity::LOW);
|
||||||
|
|
||||||
|
}; // namespace tmtcdistrib
|
||||||
#endif // FSFW_TMTCPACKET_DEFINITIONS_H
|
#endif // FSFW_TMTCPACKET_DEFINITIONS_H
|
||||||
|
@ -21,20 +21,22 @@ class AcceptsTelecommandsIF {
|
|||||||
* @brief The virtual destructor as it is mandatory for C++ interfaces.
|
* @brief The virtual destructor as it is mandatory for C++ interfaces.
|
||||||
*/
|
*/
|
||||||
virtual ~AcceptsTelecommandsIF() = default;
|
virtual ~AcceptsTelecommandsIF() = default;
|
||||||
|
[[nodiscard]] virtual const char* getName() const = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Getter for the service id.
|
* @brief Getter for a generic identifier ID.
|
||||||
* @details Any receiving service (at least any PUS service) shall have a
|
* @details Any receiving service (at least any PUS service) shall have an identifier. For
|
||||||
* service ID. If the receiver can handle Telecommands, but for
|
* example, this could be the APID for a receiver expecting generic PUS packets, or a PUS
|
||||||
* some reason has no service id, it shall return 0.
|
* service for a component expecting specific PUS service packets.
|
||||||
* @return The service ID or 0.
|
* @return The identifier.
|
||||||
*/
|
*/
|
||||||
virtual uint16_t getIdentifier() = 0;
|
[[nodiscard]] virtual uint32_t getIdentifier() const = 0;
|
||||||
/**
|
/**
|
||||||
* @brief This method returns the message queue id of the telecommand
|
* @brief This method returns the message queue id of the telecommand
|
||||||
* receiving message queue.
|
* receiving message queue.
|
||||||
* @return The telecommand reception message queue id.
|
* @return The telecommand reception message queue id.
|
||||||
*/
|
*/
|
||||||
virtual MessageQueueId_t getRequestQueue() = 0;
|
[[nodiscard]] virtual MessageQueueId_t getRequestQueue() const = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* FRAMEWORK_TMTCSERVICES_ACCEPTSTELECOMMANDSIF_H_ */
|
#endif /* FRAMEWORK_TMTCSERVICES_ACCEPTSTELECOMMANDSIF_H_ */
|
||||||
|
@ -14,6 +14,8 @@ class AcceptsTelemetryIF {
|
|||||||
* @brief The virtual destructor as it is mandatory for C++ interfaces.
|
* @brief The virtual destructor as it is mandatory for C++ interfaces.
|
||||||
*/
|
*/
|
||||||
virtual ~AcceptsTelemetryIF() = default;
|
virtual ~AcceptsTelemetryIF() = default;
|
||||||
|
|
||||||
|
[[nodiscard]] virtual const char* getName() const = 0;
|
||||||
/**
|
/**
|
||||||
* @brief This method returns the message queue id of the telemetry
|
* @brief This method returns the message queue id of the telemetry
|
||||||
* receiving message queue.
|
* receiving message queue.
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#include "fsfw/ipc/QueueFactory.h"
|
#include "fsfw/ipc/QueueFactory.h"
|
||||||
#include "fsfw/objectmanager/ObjectManager.h"
|
#include "fsfw/objectmanager/ObjectManager.h"
|
||||||
#include "fsfw/serviceinterface/ServiceInterface.h"
|
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||||
#include "fsfw/tcdistribution/PUSDistributorIF.h"
|
#include "fsfw/tcdistribution/PusDistributorIF.h"
|
||||||
#include "fsfw/tmtcpacket/pus/tc.h"
|
#include "fsfw/tmtcpacket/pus/tc.h"
|
||||||
#include "fsfw/tmtcservices/AcceptsTelemetryIF.h"
|
#include "fsfw/tmtcservices/AcceptsTelemetryIF.h"
|
||||||
#include "fsfw/tmtcservices/TmTcMessage.h"
|
#include "fsfw/tmtcservices/TmTcMessage.h"
|
||||||
@ -14,7 +14,8 @@ object_id_t CommandingServiceBase::defaultPacketSource = objects::NO_OBJECT;
|
|||||||
object_id_t CommandingServiceBase::defaultPacketDestination = objects::NO_OBJECT;
|
object_id_t CommandingServiceBase::defaultPacketDestination = objects::NO_OBJECT;
|
||||||
|
|
||||||
CommandingServiceBase::CommandingServiceBase(object_id_t setObjectId, uint16_t apid,
|
CommandingServiceBase::CommandingServiceBase(object_id_t setObjectId, uint16_t apid,
|
||||||
uint8_t service, uint8_t numberOfParallelCommands,
|
const char* name, uint8_t service,
|
||||||
|
uint8_t numberOfParallelCommands,
|
||||||
uint16_t commandTimeoutSeconds, size_t queueDepth,
|
uint16_t commandTimeoutSeconds, size_t queueDepth,
|
||||||
VerificationReporterIF* verificationReporter)
|
VerificationReporterIF* verificationReporter)
|
||||||
: SystemObject(setObjectId),
|
: SystemObject(setObjectId),
|
||||||
@ -24,7 +25,8 @@ CommandingServiceBase::CommandingServiceBase(object_id_t setObjectId, uint16_t a
|
|||||||
tmStoreHelper(apid),
|
tmStoreHelper(apid),
|
||||||
tmHelper(service, tmStoreHelper, tmSendHelper),
|
tmHelper(service, tmStoreHelper, tmSendHelper),
|
||||||
verificationReporter(verificationReporter),
|
verificationReporter(verificationReporter),
|
||||||
commandMap(numberOfParallelCommands) {
|
commandMap(numberOfParallelCommands),
|
||||||
|
name(name) {
|
||||||
commandQueue = QueueFactory::instance()->createMessageQueue(queueDepth);
|
commandQueue = QueueFactory::instance()->createMessageQueue(queueDepth);
|
||||||
requestQueue = QueueFactory::instance()->createMessageQueue(queueDepth);
|
requestQueue = QueueFactory::instance()->createMessageQueue(queueDepth);
|
||||||
}
|
}
|
||||||
@ -50,9 +52,9 @@ ReturnValue_t CommandingServiceBase::performOperation(uint8_t opCode) {
|
|||||||
return returnvalue::OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t CommandingServiceBase::getIdentifier() { return service; }
|
uint32_t CommandingServiceBase::getIdentifier() const { return service; }
|
||||||
|
|
||||||
MessageQueueId_t CommandingServiceBase::getRequestQueue() { return requestQueue->getId(); }
|
MessageQueueId_t CommandingServiceBase::getRequestQueue() const { return requestQueue->getId(); }
|
||||||
|
|
||||||
ReturnValue_t CommandingServiceBase::initialize() {
|
ReturnValue_t CommandingServiceBase::initialize() {
|
||||||
ReturnValue_t result = SystemObject::initialize();
|
ReturnValue_t result = SystemObject::initialize();
|
||||||
@ -68,7 +70,7 @@ ReturnValue_t CommandingServiceBase::initialize() {
|
|||||||
if (packetSource == objects::NO_OBJECT) {
|
if (packetSource == objects::NO_OBJECT) {
|
||||||
packetSource = defaultPacketSource;
|
packetSource = defaultPacketSource;
|
||||||
}
|
}
|
||||||
auto* distributor = ObjectManager::instance()->get<PUSDistributorIF>(packetSource);
|
auto* distributor = ObjectManager::instance()->get<PusDistributorIF>(packetSource);
|
||||||
|
|
||||||
if (packetForwarding == nullptr or distributor == nullptr) {
|
if (packetForwarding == nullptr or distributor == nullptr) {
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
@ -79,7 +81,7 @@ ReturnValue_t CommandingServiceBase::initialize() {
|
|||||||
return ObjectManagerIF::CHILD_INIT_FAILED;
|
return ObjectManagerIF::CHILD_INIT_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
distributor->registerService(this);
|
distributor->registerService(*this);
|
||||||
requestQueue->setDefaultDestination(packetForwarding->getReportReceptionQueue());
|
requestQueue->setDefaultDestination(packetForwarding->getReportReceptionQueue());
|
||||||
|
|
||||||
ipcStore = ObjectManager::instance()->get<StorageManagerIF>(objects::IPC_STORE);
|
ipcStore = ObjectManager::instance()->get<StorageManagerIF>(objects::IPC_STORE);
|
||||||
@ -489,3 +491,5 @@ void CommandingServiceBase::prepareVerificationSuccessWithFullInfo(
|
|||||||
successParams.tcPsc = tcInfo.tcSequenceControl;
|
successParams.tcPsc = tcInfo.tcSequenceControl;
|
||||||
successParams.ackFlags = tcInfo.ackFlags;
|
successParams.ackFlags = tcInfo.ackFlags;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char* CommandingServiceBase::getName() const { return name; }
|
||||||
|
@ -75,7 +75,7 @@ class CommandingServiceBase : public SystemObject,
|
|||||||
* @param setPacketDestination
|
* @param setPacketDestination
|
||||||
* @param queueDepth
|
* @param queueDepth
|
||||||
*/
|
*/
|
||||||
CommandingServiceBase(object_id_t setObjectId, uint16_t apid, uint8_t service,
|
CommandingServiceBase(object_id_t setObjectId, uint16_t apid, const char* name, uint8_t service,
|
||||||
uint8_t numberOfParallelCommands, uint16_t commandTimeoutSeconds,
|
uint8_t numberOfParallelCommands, uint16_t commandTimeoutSeconds,
|
||||||
size_t queueDepth = 20, VerificationReporterIF* reporter = nullptr);
|
size_t queueDepth = 20, VerificationReporterIF* reporter = nullptr);
|
||||||
~CommandingServiceBase() override;
|
~CommandingServiceBase() override;
|
||||||
@ -105,7 +105,7 @@ class CommandingServiceBase : public SystemObject,
|
|||||||
*/
|
*/
|
||||||
ReturnValue_t performOperation(uint8_t opCode) override;
|
ReturnValue_t performOperation(uint8_t opCode) override;
|
||||||
|
|
||||||
uint16_t getIdentifier() override;
|
uint32_t getIdentifier() const override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the requestQueue MessageQueueId_t
|
* Returns the requestQueue MessageQueueId_t
|
||||||
@ -114,7 +114,7 @@ class CommandingServiceBase : public SystemObject,
|
|||||||
*
|
*
|
||||||
* @return requestQueue messageQueueId_t
|
* @return requestQueue messageQueueId_t
|
||||||
*/
|
*/
|
||||||
MessageQueueId_t getRequestQueue() override;
|
MessageQueueId_t getRequestQueue() const override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the commandQueue MessageQueueId_t
|
* Returns the commandQueue MessageQueueId_t
|
||||||
@ -133,6 +133,7 @@ class CommandingServiceBase : public SystemObject,
|
|||||||
* @param task Pointer to the taskIF of this task
|
* @param task Pointer to the taskIF of this task
|
||||||
*/
|
*/
|
||||||
void setTaskIF(PeriodicTaskIF* task) override;
|
void setTaskIF(PeriodicTaskIF* task) override;
|
||||||
|
const char* getName() const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/**
|
/**
|
||||||
@ -283,6 +284,8 @@ class CommandingServiceBase : public SystemObject,
|
|||||||
uint32_t failureParameter1 = 0;
|
uint32_t failureParameter1 = 0;
|
||||||
uint32_t failureParameter2 = 0;
|
uint32_t failureParameter2 = 0;
|
||||||
|
|
||||||
|
const char* name = "";
|
||||||
|
|
||||||
static object_id_t defaultPacketSource;
|
static object_id_t defaultPacketSource;
|
||||||
object_id_t packetSource = objects::NO_OBJECT;
|
object_id_t packetSource = objects::NO_OBJECT;
|
||||||
static object_id_t defaultPacketDestination;
|
static object_id_t defaultPacketDestination;
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#include "fsfw/ipc/QueueFactory.h"
|
#include "fsfw/ipc/QueueFactory.h"
|
||||||
#include "fsfw/objectmanager/ObjectManager.h"
|
#include "fsfw/objectmanager/ObjectManager.h"
|
||||||
#include "fsfw/serviceinterface/ServiceInterface.h"
|
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||||
#include "fsfw/tcdistribution/PUSDistributorIF.h"
|
#include "fsfw/tcdistribution/PusDistributorIF.h"
|
||||||
#include "fsfw/timemanager/CdsShortTimeStamper.h"
|
#include "fsfw/timemanager/CdsShortTimeStamper.h"
|
||||||
#include "fsfw/tmtcservices/AcceptsTelemetryIF.h"
|
#include "fsfw/tmtcservices/AcceptsTelemetryIF.h"
|
||||||
#include "fsfw/tmtcservices/PusVerificationReport.h"
|
#include "fsfw/tmtcservices/PusVerificationReport.h"
|
||||||
@ -82,9 +82,9 @@ void PusServiceBase::handleRequestQueue() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t PusServiceBase::getIdentifier() { return psbParams.serviceId; }
|
uint32_t PusServiceBase::getIdentifier() const { return psbParams.serviceId; }
|
||||||
|
|
||||||
MessageQueueId_t PusServiceBase::getRequestQueue() {
|
MessageQueueId_t PusServiceBase::getRequestQueue() const {
|
||||||
if (psbParams.reqQueue == nullptr) {
|
if (psbParams.reqQueue == nullptr) {
|
||||||
return MessageQueueIF::NO_QUEUE;
|
return MessageQueueIF::NO_QUEUE;
|
||||||
}
|
}
|
||||||
@ -111,7 +111,7 @@ ReturnValue_t PusServiceBase::initialize() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (psbParams.pusDistributor == nullptr) {
|
if (psbParams.pusDistributor == nullptr) {
|
||||||
psbParams.pusDistributor = ObjectManager::instance()->get<PUSDistributorIF>(PUS_DISTRIBUTOR);
|
psbParams.pusDistributor = ObjectManager::instance()->get<PusDistributorIF>(PUS_DISTRIBUTOR);
|
||||||
if (psbParams.pusDistributor != nullptr) {
|
if (psbParams.pusDistributor != nullptr) {
|
||||||
registerService(*psbParams.pusDistributor);
|
registerService(*psbParams.pusDistributor);
|
||||||
}
|
}
|
||||||
@ -193,8 +193,8 @@ void PusServiceBase::setVerificationReporter(VerificationReporterIF& reporter) {
|
|||||||
psbParams.verifReporter = &reporter;
|
psbParams.verifReporter = &reporter;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PusServiceBase::registerService(PUSDistributorIF& distributor) {
|
ReturnValue_t PusServiceBase::registerService(PusDistributorIF& distributor) {
|
||||||
return distributor.registerService(this);
|
return distributor.registerService(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PusServiceBase::setTmReceiver(AcceptsTelemetryIF& tmReceiver_) {
|
void PusServiceBase::setTmReceiver(AcceptsTelemetryIF& tmReceiver_) {
|
||||||
@ -202,3 +202,5 @@ void PusServiceBase::setTmReceiver(AcceptsTelemetryIF& tmReceiver_) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void PusServiceBase::setRequestQueue(MessageQueueIF& reqQueue) { psbParams.reqQueue = &reqQueue; }
|
void PusServiceBase::setRequestQueue(MessageQueueIF& reqQueue) { psbParams.reqQueue = &reqQueue; }
|
||||||
|
|
||||||
|
const char* PusServiceBase::getName() const { return psbParams.name; }
|
||||||
|
@ -22,9 +22,13 @@ class StorageManagerIF;
|
|||||||
struct PsbParams {
|
struct PsbParams {
|
||||||
PsbParams() = default;
|
PsbParams() = default;
|
||||||
PsbParams(uint16_t apid, AcceptsTelemetryIF* tmReceiver) : apid(apid), tmReceiver(tmReceiver) {}
|
PsbParams(uint16_t apid, AcceptsTelemetryIF* tmReceiver) : apid(apid), tmReceiver(tmReceiver) {}
|
||||||
|
PsbParams(const char* name, uint16_t apid, AcceptsTelemetryIF* tmReceiver)
|
||||||
|
: name(name), apid(apid), tmReceiver(tmReceiver) {}
|
||||||
PsbParams(object_id_t objectId, uint16_t apid, uint8_t serviceId)
|
PsbParams(object_id_t objectId, uint16_t apid, uint8_t serviceId)
|
||||||
: objectId(objectId), apid(apid), serviceId(serviceId) {}
|
: objectId(objectId), apid(apid), serviceId(serviceId) {}
|
||||||
|
PsbParams(const char* name, object_id_t objectId, uint16_t apid, uint8_t serviceId)
|
||||||
|
: name(name), objectId(objectId), apid(apid), serviceId(serviceId) {}
|
||||||
|
const char* name = "";
|
||||||
object_id_t objectId = objects::NO_OBJECT;
|
object_id_t objectId = objects::NO_OBJECT;
|
||||||
uint16_t apid = 0;
|
uint16_t apid = 0;
|
||||||
uint8_t serviceId = 0;
|
uint8_t serviceId = 0;
|
||||||
@ -187,11 +191,12 @@ class PusServiceBase : public ExecutableObjectIF,
|
|||||||
* @c returnvalue::FAILED else.
|
* @c returnvalue::FAILED else.
|
||||||
*/
|
*/
|
||||||
ReturnValue_t performOperation(uint8_t opCode) override;
|
ReturnValue_t performOperation(uint8_t opCode) override;
|
||||||
uint16_t getIdentifier() override;
|
uint32_t getIdentifier() const override;
|
||||||
MessageQueueId_t getRequestQueue() override;
|
MessageQueueId_t getRequestQueue() const override;
|
||||||
ReturnValue_t initialize() override;
|
ReturnValue_t initialize() override;
|
||||||
|
|
||||||
void setTaskIF(PeriodicTaskIF* taskHandle) override;
|
void setTaskIF(PeriodicTaskIF* taskHandle) override;
|
||||||
|
[[nodiscard]] const char* getName() const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/**
|
/**
|
||||||
@ -200,6 +205,7 @@ class PusServiceBase : public ExecutableObjectIF,
|
|||||||
* Will be set by setTaskIF(), which is called on task creation.
|
* Will be set by setTaskIF(), which is called on task creation.
|
||||||
*/
|
*/
|
||||||
PeriodicTaskIF* taskHandle = nullptr;
|
PeriodicTaskIF* taskHandle = nullptr;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* One of two error parameters for additional error information.
|
* One of two error parameters for additional error information.
|
||||||
*/
|
*/
|
||||||
|
@ -7,9 +7,10 @@
|
|||||||
|
|
||||||
#define TMTCBRIDGE_WIRETAPPING 0
|
#define TMTCBRIDGE_WIRETAPPING 0
|
||||||
|
|
||||||
TmTcBridge::TmTcBridge(object_id_t objectId, object_id_t tcDestination, object_id_t tmStoreId,
|
TmTcBridge::TmTcBridge(const char* name, object_id_t objectId, object_id_t tcDestination,
|
||||||
object_id_t tcStoreId)
|
object_id_t tmStoreId, object_id_t tcStoreId)
|
||||||
: SystemObject(objectId),
|
: SystemObject(objectId),
|
||||||
|
name(name),
|
||||||
tmStoreId(tmStoreId),
|
tmStoreId(tmStoreId),
|
||||||
tcStoreId(tcStoreId),
|
tcStoreId(tcStoreId),
|
||||||
tcDestination(tcDestination)
|
tcDestination(tcDestination)
|
||||||
@ -67,8 +68,7 @@ ReturnValue_t TmTcBridge::initialize() {
|
|||||||
#endif
|
#endif
|
||||||
return ObjectManagerIF::CHILD_INIT_FAILED;
|
return ObjectManagerIF::CHILD_INIT_FAILED;
|
||||||
}
|
}
|
||||||
AcceptsTelecommandsIF* tcDistributor =
|
auto* tcDistributor = ObjectManager::instance()->get<AcceptsTelecommandsIF>(tcDestination);
|
||||||
ObjectManager::instance()->get<AcceptsTelecommandsIF>(tcDestination);
|
|
||||||
if (tcDistributor == nullptr) {
|
if (tcDistributor == nullptr) {
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
sif::error << "TmTcBridge::initialize: TC Distributor invalid" << std::endl;
|
sif::error << "TmTcBridge::initialize: TC Distributor invalid" << std::endl;
|
||||||
@ -246,14 +246,16 @@ MessageQueueId_t TmTcBridge::getReportReceptionQueue(uint8_t virtualChannel) {
|
|||||||
|
|
||||||
void TmTcBridge::printData(uint8_t* data, size_t dataLen) { arrayprinter::print(data, dataLen); }
|
void TmTcBridge::printData(uint8_t* data, size_t dataLen) { arrayprinter::print(data, dataLen); }
|
||||||
|
|
||||||
uint16_t TmTcBridge::getIdentifier() {
|
uint32_t TmTcBridge::getIdentifier() const {
|
||||||
// This is no PUS service, so we just return 0
|
// This is no PUS service, so we just return 0
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
MessageQueueId_t TmTcBridge::getRequestQueue() {
|
MessageQueueId_t TmTcBridge::getRequestQueue() const {
|
||||||
// Default implementation: Relay TC messages to TC distributor directly.
|
// Default implementation: Relay TC messages to TC distributor directly.
|
||||||
return tmTcReceptionQueue->getDefaultDestination();
|
return tmTcReceptionQueue->getDefaultDestination();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TmTcBridge::setFifoToOverwriteOldData(bool overwriteOld) { this->overwriteOld = overwriteOld; }
|
void TmTcBridge::setFifoToOverwriteOldData(bool overwriteOld) { this->overwriteOld = overwriteOld; }
|
||||||
|
|
||||||
|
const char* TmTcBridge::getName() const { return name; }
|
||||||
|
@ -22,9 +22,9 @@ class TmTcBridge : public AcceptsTelemetryIF,
|
|||||||
static constexpr uint8_t DEFAULT_STORED_DATA_SENT_PER_CYCLE = 5;
|
static constexpr uint8_t DEFAULT_STORED_DATA_SENT_PER_CYCLE = 5;
|
||||||
static constexpr uint8_t DEFAULT_DOWNLINK_PACKETS_STORED = 10;
|
static constexpr uint8_t DEFAULT_DOWNLINK_PACKETS_STORED = 10;
|
||||||
|
|
||||||
TmTcBridge(object_id_t objectId, object_id_t tcDestination, object_id_t tmStoreId,
|
TmTcBridge(const char* name, object_id_t objectId, object_id_t tcDestination,
|
||||||
object_id_t tcStoreId);
|
object_id_t tmStoreId, object_id_t tcStoreId);
|
||||||
virtual ~TmTcBridge();
|
~TmTcBridge() override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set number of packets sent per performOperation().Please note that this
|
* Set number of packets sent per performOperation().Please note that this
|
||||||
@ -57,21 +57,24 @@ class TmTcBridge : public AcceptsTelemetryIF,
|
|||||||
* Initializes necessary FSFW components for the TMTC Bridge
|
* Initializes necessary FSFW components for the TMTC Bridge
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
virtual ReturnValue_t initialize() override;
|
ReturnValue_t initialize() override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Handles TMTC reception
|
* @brief Handles TMTC reception
|
||||||
*/
|
*/
|
||||||
virtual ReturnValue_t performOperation(uint8_t operationCode = 0) override;
|
ReturnValue_t performOperation(uint8_t operationCode = 0) override;
|
||||||
|
|
||||||
/** AcceptsTelemetryIF override */
|
/** AcceptsTelemetryIF override */
|
||||||
virtual MessageQueueId_t getReportReceptionQueue(uint8_t virtualChannel = 0) override;
|
MessageQueueId_t getReportReceptionQueue(uint8_t virtualChannel = 0) override;
|
||||||
|
|
||||||
/** AcceptsTelecommandsIF override */
|
/** AcceptsTelecommandsIF override */
|
||||||
virtual uint16_t getIdentifier() override;
|
uint32_t getIdentifier() const override;
|
||||||
virtual MessageQueueId_t getRequestQueue() override;
|
MessageQueueId_t getRequestQueue() const override;
|
||||||
|
const char* getName() const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
const char* name = "";
|
||||||
|
|
||||||
//! Cached for initialize function.
|
//! Cached for initialize function.
|
||||||
object_id_t tmStoreId = objects::NO_OBJECT;
|
object_id_t tmStoreId = objects::NO_OBJECT;
|
||||||
object_id_t tcStoreId = objects::NO_OBJECT;
|
object_id_t tcStoreId = objects::NO_OBJECT;
|
||||||
|
@ -9,3 +9,5 @@ AcceptsTmMock::AcceptsTmMock(MessageQueueId_t queueToReturn)
|
|||||||
MessageQueueId_t AcceptsTmMock::getReportReceptionQueue(uint8_t virtualChannel) {
|
MessageQueueId_t AcceptsTmMock::getReportReceptionQueue(uint8_t virtualChannel) {
|
||||||
return returnedQueue;
|
return returnedQueue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char* AcceptsTmMock::getName() const { return "TM Acceptor Mock"; }
|
||||||
|
@ -10,6 +10,7 @@ class AcceptsTmMock : public SystemObject, public AcceptsTelemetryIF {
|
|||||||
explicit AcceptsTmMock(MessageQueueId_t queueToReturn);
|
explicit AcceptsTmMock(MessageQueueId_t queueToReturn);
|
||||||
|
|
||||||
MessageQueueId_t getReportReceptionQueue(uint8_t virtualChannel) override;
|
MessageQueueId_t getReportReceptionQueue(uint8_t virtualChannel) override;
|
||||||
|
const char* getName() const override;
|
||||||
|
|
||||||
MessageQueueId_t returnedQueue;
|
MessageQueueId_t returnedQueue;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user