all necessary modifications
This commit is contained in:
parent
0849c8a08d
commit
237e29cc59
@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
TcpTmTcBridge::TcpTmTcBridge(object_id_t objectId, object_id_t tcDestination, object_id_t tmStoreId,
|
TcpTmTcBridge::TcpTmTcBridge(object_id_t objectId, object_id_t tcDestination, object_id_t tmStoreId,
|
||||||
object_id_t tcStoreId)
|
object_id_t tcStoreId)
|
||||||
: TmTcBridge(objectId, tcDestination, tmStoreId, tcStoreId) {
|
: TmTcBridge("TCP TMTC Bridge", objectId, tcDestination, tmStoreId, tcStoreId) {
|
||||||
mutex = MutexFactory::instance()->createMutex();
|
mutex = MutexFactory::instance()->createMutex();
|
||||||
// Connection is always up, TM is requested by connecting to server and receiving packets
|
// Connection is always up, TM is requested by connecting to server and receiving packets
|
||||||
registerCommConnect();
|
registerCommConnect();
|
||||||
|
@ -22,7 +22,7 @@ const std::string UdpTmTcBridge::DEFAULT_SERVER_PORT = tcpip::DEFAULT_SERVER_POR
|
|||||||
UdpTmTcBridge::UdpTmTcBridge(object_id_t objectId, object_id_t tcDestination,
|
UdpTmTcBridge::UdpTmTcBridge(object_id_t objectId, object_id_t tcDestination,
|
||||||
const std::string &udpServerPort_, object_id_t tmStoreId,
|
const std::string &udpServerPort_, object_id_t tmStoreId,
|
||||||
object_id_t tcStoreId)
|
object_id_t tcStoreId)
|
||||||
: TmTcBridge(objectId, tcDestination, tmStoreId, tcStoreId) {
|
: TmTcBridge("UDP TMTC Bridge", objectId, tcDestination, tmStoreId, tcStoreId) {
|
||||||
if (udpServerPort_.empty()) {
|
if (udpServerPort_.empty()) {
|
||||||
udpServerPort = DEFAULT_SERVER_PORT;
|
udpServerPort = DEFAULT_SERVER_PORT;
|
||||||
} else {
|
} else {
|
||||||
|
@ -59,7 +59,7 @@ TcDistributor::TcMqMapIter CCSDSDistributor::selectDestination() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MessageQueueId_t CCSDSDistributor::getRequestQueue() { return tcQueue->getId(); }
|
MessageQueueId_t CCSDSDistributor::getRequestQueue() const { return tcQueue->getId(); }
|
||||||
|
|
||||||
ReturnValue_t CCSDSDistributor::registerApplication(AcceptsTelecommandsIF* application) {
|
ReturnValue_t CCSDSDistributor::registerApplication(AcceptsTelecommandsIF* application) {
|
||||||
ReturnValue_t returnValue = returnvalue::OK;
|
ReturnValue_t returnValue = returnvalue::OK;
|
||||||
@ -80,7 +80,7 @@ ReturnValue_t CCSDSDistributor::registerApplication(uint16_t apid, MessageQueueI
|
|||||||
return returnValue;
|
return returnValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t CCSDSDistributor::getIdentifier() { return 0; }
|
uint32_t CCSDSDistributor::getIdentifier() const { return 0; }
|
||||||
|
|
||||||
ReturnValue_t CCSDSDistributor::initialize() {
|
ReturnValue_t CCSDSDistributor::initialize() {
|
||||||
if (packetChecker == nullptr) {
|
if (packetChecker == nullptr) {
|
||||||
|
@ -35,10 +35,10 @@ class CCSDSDistributor : public TcDistributor,
|
|||||||
*/
|
*/
|
||||||
~CCSDSDistributor() override;
|
~CCSDSDistributor() override;
|
||||||
|
|
||||||
MessageQueueId_t getRequestQueue() override;
|
MessageQueueId_t getRequestQueue() const override;
|
||||||
ReturnValue_t registerApplication(uint16_t apid, MessageQueueId_t id) override;
|
ReturnValue_t registerApplication(uint16_t apid, MessageQueueId_t id) override;
|
||||||
ReturnValue_t registerApplication(AcceptsTelecommandsIF* application) override;
|
ReturnValue_t registerApplication(AcceptsTelecommandsIF* application) override;
|
||||||
uint16_t getIdentifier() override;
|
uint32_t getIdentifier() const override;
|
||||||
ReturnValue_t initialize() override;
|
ReturnValue_t initialize() override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
target_sources(
|
target_sources(
|
||||||
${LIB_FSFW_NAME}
|
${LIB_FSFW_NAME}
|
||||||
PRIVATE CcsdsDistributor.cpp PusDistributor.cpp TcDistributorBase.cpp
|
PRIVATE CCSDSDistributor.cpp PusDistributor.cpp TcDistributor.cpp
|
||||||
PusPacketChecker.cpp TcPacketCheckCFDP.cpp CcsdsPacketChecker.cpp)
|
TcPacketCheckCFDP.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 tmtcdistrib::INVALID_APID;
|
return tcdistrib::INVALID_APID;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (currentPacket.getVersion() != ccsdsVersion) {
|
if (currentPacket.getVersion() != ccsdsVersion) {
|
||||||
return tmtcdistrib::INVALID_CCSDS_VERSION;
|
return tcdistrib::INVALID_CCSDS_VERSION;
|
||||||
}
|
}
|
||||||
if (currentPacket.getPacketType() != packetType) {
|
if (currentPacket.getPacketType() != packetType) {
|
||||||
return tmtcdistrib::INVALID_PACKET_TYPE;
|
return tcdistrib::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 tmtcdistrib::INCOMPLETE_PACKET;
|
return tcdistrib::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_)
|
||||||
: TcDistributorBase(setObjectId),
|
: TcDistributor(setObjectId),
|
||||||
store(store_),
|
store(store_),
|
||||||
checker(setApid, ccsds::PacketType::TC),
|
checker(setApid, ccsds::PacketType::TC),
|
||||||
ccsdsDistributor(distributor),
|
ccsdsDistributor(distributor),
|
||||||
@ -18,59 +18,61 @@ PusDistributor::PusDistributor(uint16_t setApid, object_id_t setObjectId,
|
|||||||
|
|
||||||
PusDistributor::~PusDistributor() = default;
|
PusDistributor::~PusDistributor() = default;
|
||||||
|
|
||||||
ReturnValue_t PusDistributor::selectDestination(MessageQueueId_t& destId) {
|
PusDistributor::TcMqMapIter PusDistributor::selectDestination() {
|
||||||
#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;
|
||||||
ReturnValue_t result =
|
if (store->getData(currentMessage.getStorageId(), &packetPtr, &packetLen) != returnvalue::OK) {
|
||||||
store->getData(currentMessage.getStorageId(), &packetPtr, &packetLen) != returnvalue::OK;
|
return queueMapIt;
|
||||||
if (result != returnvalue::OK) {
|
|
||||||
tcStatus = PACKET_LOST;
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
result = reader.setReadOnlyData(packetPtr, packetLen);
|
ReturnValue_t result = reader.setReadOnlyData(packetPtr, packetLen);
|
||||||
if (result != returnvalue::OK) {
|
if (result != returnvalue::OK) {
|
||||||
tcStatus = PACKET_LOST;
|
tcStatus = PACKET_LOST;
|
||||||
return result;
|
return queueMapIt;
|
||||||
}
|
}
|
||||||
// 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 result;
|
return queueMapIt;
|
||||||
}
|
}
|
||||||
|
|
||||||
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();
|
||||||
}
|
}
|
||||||
uint8_t pusId = reader.getService();
|
uint32_t queue_id = reader.getService();
|
||||||
auto iter = receiverMap.find(pusId);
|
queueMapIt = queueMap.find(queue_id);
|
||||||
if (iter == receiverMap.end()) {
|
|
||||||
tcStatus = DESTINATION_NOT_FOUND;
|
|
||||||
#if FSFW_VERBOSE_LEVEL >= 1
|
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
|
||||||
sif::debug << "PUSDistributor::handlePacket: Destination not found" << std::endl;
|
|
||||||
#else
|
|
||||||
sif::printDebug("PUSDistributor::handlePacket: Destination not found\n");
|
|
||||||
#endif /* !FSFW_CPP_OSTREAM_ENABLED == 1 */
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
destId = iter->second.destId;
|
|
||||||
} else {
|
} else {
|
||||||
tcStatus = PACKET_LOST;
|
tcStatus = PACKET_LOST;
|
||||||
}
|
}
|
||||||
return tcStatus;
|
|
||||||
|
if (queueMapIt == this->queueMap.end()) {
|
||||||
|
tcStatus = DESTINATION_NOT_FOUND;
|
||||||
|
#if FSFW_VERBOSE_LEVEL >= 1
|
||||||
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::debug << "PUSDistributor::handlePacket: Destination not found" << std::endl;
|
||||||
|
#else
|
||||||
|
sif::printDebug("PUSDistributor::handlePacket: Destination not found\n");
|
||||||
|
#endif /* !FSFW_CPP_OSTREAM_ENABLED == 1 */
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tcStatus != returnvalue::OK) {
|
||||||
|
return this->queueMap.end();
|
||||||
|
} else {
|
||||||
|
return queueMapIt;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PusDistributor::registerService(const AcceptsTelecommandsIF& service) {
|
ReturnValue_t PusDistributor::registerService(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;
|
||||||
@ -78,8 +80,8 @@ ReturnValue_t PusDistributor::registerService(const AcceptsTelecommandsIF& servi
|
|||||||
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 = receiverMap.emplace(serviceId, ServiceInfo(service.getName(), queue));
|
auto returnPair = queueMap.emplace(serviceId, 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
|
||||||
@ -128,7 +130,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;
|
||||||
}
|
}
|
||||||
@ -139,29 +141,28 @@ ReturnValue_t PusDistributor::initialize() {
|
|||||||
return ObjectManagerIF::CHILD_INIT_FAILED;
|
return ObjectManagerIF::CHILD_INIT_FAILED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ccsdsDistributor->registerApplication(CcsdsDistributorIF::DestInfo(*this, false));
|
return ccsdsDistributor->registerApplication(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PusDistributor::checkerFailurePrinter() const {
|
void PusDistributor::checkerFailurePrinter() const {
|
||||||
#if FSFW_VERBOSE_LEVEL >= 1
|
#if FSFW_VERBOSE_LEVEL >= 1
|
||||||
const char* reason = "Unknown reason";
|
const char* keyword = "unnamed error";
|
||||||
if (tcStatus == tmtcdistrib::INCORRECT_CHECKSUM) {
|
if (tcStatus == tcdistrib::INCORRECT_CHECKSUM) {
|
||||||
reason = "Checksum Error";
|
keyword = "checksum";
|
||||||
} else if (tcStatus == tmtcdistrib::INCORRECT_PRIMARY_HEADER) {
|
} else if (tcStatus == tcdistrib::INCORRECT_PRIMARY_HEADER) {
|
||||||
reason = "Incorrect Primary Header";
|
keyword = "incorrect primary header";
|
||||||
} else if (tcStatus == tmtcdistrib::INVALID_APID) {
|
} else if (tcStatus == tcdistrib::INVALID_APID) {
|
||||||
reason = "Illegal APID";
|
keyword = "illegal APID";
|
||||||
} else if (tcStatus == tmtcdistrib::INCORRECT_SECONDARY_HEADER) {
|
} else if (tcStatus == tcdistrib::INCORRECT_SECONDARY_HEADER) {
|
||||||
reason = "Incorrect Secondary Header";
|
keyword = "incorrect secondary header";
|
||||||
} else if (tcStatus == tmtcdistrib::INCOMPLETE_PACKET) {
|
} else if (tcStatus == tcdistrib::INCOMPLETE_PACKET) {
|
||||||
reason = "Incomplete packet";
|
keyword = "incomplete packet";
|
||||||
}
|
}
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
sif::warning << "PUSDistributor::handlePacket: Check failed: " << reason << std::endl;
|
sif::warning << "PUSDistributor::handlePacket: Packet format invalid, " << keyword << " error"
|
||||||
|
<< std::endl;
|
||||||
#else
|
#else
|
||||||
sif::printWarning("PUSDistributor::handlePacket: Check failed: %s\n", reason);
|
sif::printWarning("PUSDistributor::handlePacket: Packet format invalid, %s error\n", keyword);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* PusDistributor::getName() const { return "PUS Distributor"; }
|
|
||||||
|
@ -1,17 +1,15 @@
|
|||||||
#ifndef FSFW_TCDISTRIBUTION_PUSDISTRIBUTOR_H_
|
#ifndef FSFW_TCDISTRIBUTION_PUSDISTRIBUTOR_H_
|
||||||
#define FSFW_TCDISTRIBUTION_PUSDISTRIBUTOR_H_
|
#define FSFW_TCDISTRIBUTION_PUSDISTRIBUTOR_H_
|
||||||
|
|
||||||
#include <map>
|
#include "PUSDistributorIF.h"
|
||||||
|
|
||||||
#include "PusDistributorIF.h"
|
|
||||||
#include "PusPacketChecker.h"
|
#include "PusPacketChecker.h"
|
||||||
#include "TcDistributorBase.h"
|
#include "TcDistributor.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
|
||||||
@ -19,9 +17,7 @@ class CcsdsDistributorIF;
|
|||||||
* sends acceptance success or failure messages.
|
* sends acceptance success or failure messages.
|
||||||
* @ingroup tc_distribution
|
* @ingroup tc_distribution
|
||||||
*/
|
*/
|
||||||
class PusDistributor : public TcDistributorBase,
|
class PusDistributor : public TcDistributor, public PUSDistributorIF, public AcceptsTelecommandsIF {
|
||||||
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
|
||||||
@ -29,31 +25,20 @@ class PusDistributor : public TcDistributorBase,
|
|||||||
* @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(const AcceptsTelecommandsIF& service) override;
|
ReturnValue_t registerService(AcceptsTelecommandsIF* service) override;
|
||||||
[[nodiscard]] MessageQueueId_t getRequestQueue() const override;
|
MessageQueueId_t getRequestQueue() const override;
|
||||||
ReturnValue_t initialize() override;
|
ReturnValue_t initialize() override;
|
||||||
[[nodiscard]] uint32_t getIdentifier() const override;
|
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.
|
||||||
@ -65,7 +50,7 @@ class PusDistributor : public TcDistributorBase,
|
|||||||
*/
|
*/
|
||||||
VerificationReporterIF* verifyChannel = nullptr;
|
VerificationReporterIF* verifyChannel = nullptr;
|
||||||
//! Cached for initialization
|
//! Cached for initialization
|
||||||
CcsdsDistributorIF* ccsdsDistributor = nullptr;
|
CCSDSDistributorIF* ccsdsDistributor = nullptr;
|
||||||
PusTcReader reader;
|
PusTcReader reader;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -82,7 +67,7 @@ class PusDistributor : public TcDistributorBase,
|
|||||||
* @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().
|
||||||
*/
|
*/
|
||||||
ReturnValue_t selectDestination(MessageQueueId_t& destId) override;
|
TcMqMapIter selectDestination() 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 tmtcdistrib::INVALID_SEC_HEADER_FIELD;
|
return tcdistrib::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 tmtcdistrib::INCORRECT_CHECKSUM;
|
return tcdistrib::INCORRECT_CHECKSUM;
|
||||||
}
|
}
|
||||||
if (pusPacket.getApid() != apid) {
|
if (pusPacket.getApid() != apid) {
|
||||||
return tmtcdistrib::INVALID_APID;
|
return tcdistrib::INVALID_APID;
|
||||||
}
|
}
|
||||||
if (pusPacket.getPusVersion() != pusVersion) {
|
if (pusPacket.getPusVersion() != pusVersion) {
|
||||||
return tmtcdistrib::INVALID_PUS_VERSION;
|
return tcdistrib::INVALID_PUS_VERSION;
|
||||||
}
|
}
|
||||||
return returnvalue::OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
@ -3,19 +3,16 @@
|
|||||||
|
|
||||||
#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 tmtcdistrib {
|
namespace tcdistrib {
|
||||||
static const uint8_t INTERFACE_ID = CLASS_ID::TMTC_DISTRIBUTION;
|
static const uint8_t INTERFACE_ID = CLASS_ID::PACKET_CHECK;
|
||||||
static constexpr ReturnValue_t NO_DESTINATION_FOUND = returnvalue::makeCode(INTERFACE_ID, 0);
|
static constexpr ReturnValue_t INVALID_CCSDS_VERSION = MAKE_RETURN_CODE(0);
|
||||||
static constexpr ReturnValue_t INVALID_CCSDS_VERSION = MAKE_RETURN_CODE(1);
|
static constexpr ReturnValue_t INVALID_APID = MAKE_RETURN_CODE(1);
|
||||||
static constexpr ReturnValue_t INVALID_APID = MAKE_RETURN_CODE(2);
|
static constexpr ReturnValue_t INVALID_PACKET_TYPE = MAKE_RETURN_CODE(2);
|
||||||
static constexpr ReturnValue_t INVALID_PACKET_TYPE = MAKE_RETURN_CODE(3);
|
static constexpr ReturnValue_t INVALID_SEC_HEADER_FIELD = MAKE_RETURN_CODE(3);
|
||||||
static constexpr ReturnValue_t INVALID_SEC_HEADER_FIELD = MAKE_RETURN_CODE(4);
|
static constexpr ReturnValue_t INCORRECT_PRIMARY_HEADER = 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);
|
||||||
@ -23,9 +20,5 @@ 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);
|
||||||
|
|
||||||
static constexpr uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::TMTC_DISTRIBUTION;
|
}; // namespace tcdistrib
|
||||||
//! 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
|
||||||
|
@ -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"
|
||||||
@ -70,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
|
||||||
@ -81,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);
|
||||||
|
@ -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"
|
||||||
@ -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_) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user