Init Commit

This commit is contained in:
2020-09-16 10:33:06 +02:00
commit 7852b88e6a
821 changed files with 115954 additions and 0 deletions
+1
View File
@@ -0,0 +1 @@
target_sources(${LIB_EIVE_MISSION} PUBLIC)
+65
View File
@@ -0,0 +1,65 @@
#include <fsfw/globalfunctions/arrayprinter.h>
#include <fsfw/ipc/QueueFactory.h>
#include <fsfw/objectmanager/ObjectManager.h>
#include <fsfw/tmtcpacket/pus/TcPacketBase.h>
#include <fsfw/tmtcpacket/pus/TcPacketStored.h>
#include <fsfw/tmtcservices/AcceptsTelecommandsIF.h>
#include <fsfw/tmtcservices/TmTcMessage.h>
#include <test/testtasks/PusTcInjector.h>
PusTcInjector::PusTcInjector(object_id_t objectId, object_id_t destination, object_id_t tcStore,
uint16_t defaultApid)
: SystemObject(objectId),
defaultApid(defaultApid),
destination(destination),
tcStoreId(tcStore) {}
PusTcInjector::~PusTcInjector() {}
// ReturnValue_t PusTcInjector::injectPusTelecommand(uint8_t service,
// uint8_t subservice,const uint8_t* appData, size_t appDataLen) {
// return injectPusTelecommand(service, subservice, defaultApid, appData,
// appDataLen);
// }
// TODO: ACK flags
// ReturnValue_t PusTcInjector::injectPusTelecommand(uint8_t service,
// uint8_t subservice,uint16_t apid, const uint8_t* appData,
// size_t appDataLen) {
// // Prepare TC packet. Store into TC store immediately.
// TcPacketStored tcPacket(service, subservice, apid, sequenceCount++);
//
// const uint8_t* packetPtr = nullptr;
// size_t packetSize = 0;
// tcPacket.getData(&packetPtr, &packetSize);
// //arrayprinter::print(packetPtr, packetSize, OutputType::BIN);
//
// // Send TC packet.
// TmTcMessage tcMessage(tcPacket.getStoreAddress());
// ReturnValue_t result = injectionQueue->sendToDefault(&tcMessage);
// if(result != returnvalue::OK) {
// sif::warning << "PusTcInjector: Sending TMTC message failed!" << std::endl;
// }
// return result;
//}
ReturnValue_t PusTcInjector::initialize() {
// Prepare message queue which is used to send telecommands.
injectionQueue = QueueFactory::instance()->createMessageQueue(INJECTION_QUEUE_DEPTH);
AcceptsTelecommandsIF* targetQueue =
ObjectManager::instance()->get<AcceptsTelecommandsIF>(destination);
if (targetQueue == nullptr) {
sif::error << "PusTcInjector: CCSDS distributor not initialized yet!" << std::endl;
return ObjectManagerIF::CHILD_INIT_FAILED;
} else {
injectionQueue->setDefaultDestination(targetQueue->getRequestQueue());
}
// Prepare store used to store TC messages
tcStore = ObjectManager::instance()->get<StorageManagerIF>(tcStoreId);
if (tcStore == nullptr) {
sif::error << "PusTcInjector: TC Store not initialized!" << std::endl;
return ObjectManagerIF::CHILD_INIT_FAILED;
}
return returnvalue::OK;
}
+73
View File
@@ -0,0 +1,73 @@
#ifndef TEST_TESTTASKS_PUSTCINJECTOR_H_
#define TEST_TESTTASKS_PUSTCINJECTOR_H_
#include <fsfw/ipc/MessageQueueIF.h>
#include <fsfw/objectmanager/SystemObject.h>
#include <fsfw/storagemanager/StorageManagerIF.h>
#include <array>
class PusTcInjector : public SystemObject {
public:
static constexpr uint8_t INJECTION_QUEUE_DEPTH = 10;
const uint16_t defaultApid;
/**
* Initialize a software telecommand injector by supplying object IDs to
* various helper objects which must exist before calling initialiez()
* @param objectId ID of PUS telecommand injector
* @param destination ID of destination, which has to implement
* AcceptsTelecommandIF.
* @param tcStore ID of telecommand store, which has to implement
* StorageManagerIF.
* @param defaultApid Default APID which will be used if an injection
* without an APID is requested.
*/
PusTcInjector(object_id_t objectId, object_id_t destination, object_id_t tcStore,
uint16_t defaultApid);
/**
* This has to be called before using the PusTcInjector.
* Call Not necessary when using a factory and the object manager.
* @return -@c returnvalue::OK for successfull init
* -@c ObjectManagerIF::CHILD_INIT_FAILED otherwise
*/
ReturnValue_t initialize() override;
virtual ~PusTcInjector();
/**
* Can be used to inject a telecommand by supplying service, subservice
* and optional application data and its length.
* Default APID will be used.
* @param service PUS service type
* @param subservice PUS subservice type
* @param appData Pointer to application data
* @param appDataLen Length of application data
* @return
*/
// ReturnValue_t injectPusTelecommand(uint8_t service, uint8_t subservice,
// const uint8_t* appData = nullptr, size_t appDataLen = 0);
/**
* Provides the same functionality while also setting a user defined APID.
* @param service PUS service type
* @param subservice PUS subservice type
* @param apid Custom APID to,
* @param appData Pointer to application data
* @param appDataLen Length of application data
* @return
*/
// ReturnValue_t injectPusTelecommand(uint8_t service, uint8_t subservice,
// uint16_t apid, const uint8_t* appData = nullptr,
// size_t appDataLen = 0);
private:
MessageQueueIF* injectionQueue = nullptr;
StorageManagerIF* tcStore = nullptr;
/* Cached for initialize function */
object_id_t destination = 0;
object_id_t tcStoreId = 0;
uint16_t sequenceCount = 0;
};
#endif /* TEST_TESTTASKS_PUSTCINJECTOR_H_ */