continue TM handling refactoring
Some checks failed
EIVE/eive-obsw/pipeline/pr-develop There was a failure building this commit
Some checks failed
EIVE/eive-obsw/pipeline/pr-develop There was a failure building this commit
This commit is contained in:
@ -13,10 +13,10 @@
|
||||
#include "mission/devices/devicedefinitions/SyrlinksDefinitions.h"
|
||||
|
||||
CcsdsIpCoreHandler::CcsdsIpCoreHandler(object_id_t objectId, object_id_t tcDestination,
|
||||
PtmeIF& ptme, PtmeConfig& ptmeConfig, GpioIF* gpioIF,
|
||||
gpioId_t enTxClock, gpioId_t enTxData)
|
||||
PtmeConfig& ptmeConfig, std::atomic_bool& linkState,
|
||||
GpioIF* gpioIF, gpioId_t enTxClock, gpioId_t enTxData)
|
||||
: SystemObject(objectId),
|
||||
ptme(ptme),
|
||||
linkState(linkState),
|
||||
tcDestination(tcDestination),
|
||||
parameterHelper(this),
|
||||
actionHelper(this, nullptr),
|
||||
@ -31,22 +31,13 @@ CcsdsIpCoreHandler::CcsdsIpCoreHandler(object_id_t objectId, object_id_t tcDesti
|
||||
QueueFactory::instance()->createMessageQueue(10, EventMessage::EVENT_MESSAGE_SIZE, &mqArgs);
|
||||
}
|
||||
|
||||
CcsdsIpCoreHandler::~CcsdsIpCoreHandler() {}
|
||||
CcsdsIpCoreHandler::~CcsdsIpCoreHandler() = default;
|
||||
|
||||
ReturnValue_t CcsdsIpCoreHandler::performOperation(uint8_t operationCode) {
|
||||
readCommandQueue();
|
||||
// handleTelemetry();
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
||||
// TODO: TM is sent to the respective VCs directly.
|
||||
// void CcsdsIpCoreHandler::handleTelemetry() {
|
||||
// VirtualChannelMapIter iter;
|
||||
// for (iter = virtualChannelMap.begin(); iter != virtualChannelMap.end(); iter++) {
|
||||
// iter->second->performOperation();
|
||||
// }
|
||||
//}
|
||||
|
||||
ReturnValue_t CcsdsIpCoreHandler::initialize() {
|
||||
ReturnValue_t result = returnvalue::OK;
|
||||
AcceptsTelecommandsIF* tcDistributor =
|
||||
@ -75,15 +66,6 @@ ReturnValue_t CcsdsIpCoreHandler::initialize() {
|
||||
return result;
|
||||
}
|
||||
|
||||
VirtualChannelMapIter iter;
|
||||
for (iter = virtualChannelMap.begin(); iter != virtualChannelMap.end(); iter++) {
|
||||
result = iter->second->initialize();
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
iter->second->setPtmeObject(&ptme);
|
||||
}
|
||||
|
||||
result = ptmeConfig.initialize();
|
||||
if (result != returnvalue::OK) {
|
||||
return ObjectManagerIF::CHILD_INIT_FAILED;
|
||||
@ -92,7 +74,7 @@ ReturnValue_t CcsdsIpCoreHandler::initialize() {
|
||||
#if OBSW_SYRLINKS_SIMULATED == 1
|
||||
// Update data on rising edge
|
||||
ptmeConfig->invertTxClock(false);
|
||||
linkState = UP;
|
||||
linkState = LINK_UP;
|
||||
forwardLinkstate();
|
||||
#endif /* OBSW_SYRLINKS_SIMULATED == 1*/
|
||||
|
||||
@ -126,41 +108,40 @@ void CcsdsIpCoreHandler::readCommandQueue(void) {
|
||||
|
||||
MessageQueueId_t CcsdsIpCoreHandler::getCommandQueue() const { return commandQueue->getId(); }
|
||||
|
||||
void CcsdsIpCoreHandler::addVirtualChannel(VcId_t vcId, VirtualChannel* virtualChannel) {
|
||||
if (vcId > config::NUMBER_OF_VIRTUAL_CHANNELS) {
|
||||
sif::warning << "CcsdsHandler::addVirtualChannel: Invalid virtual channel ID" << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
if (virtualChannel == nullptr) {
|
||||
sif::warning << "CcsdsHandler::addVirtualChannel: Invalid virtual channel interface"
|
||||
<< std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
auto status = virtualChannelMap.emplace(vcId, virtualChannel);
|
||||
if (status.second == false) {
|
||||
sif::warning << "CcsdsHandler::addVirtualChannel: Failed to add virtual channel to "
|
||||
"virtual channel map"
|
||||
<< std::endl;
|
||||
return;
|
||||
}
|
||||
}
|
||||
// void CcsdsIpCoreHandler::addVirtualChannel(VcId_t vcId, VirtualChannelWithQueue* virtualChannel)
|
||||
// {
|
||||
// if (vcId > config::NUMBER_OF_VIRTUAL_CHANNELS) {
|
||||
// sif::warning << "CcsdsHandler::addVirtualChannel: Invalid virtual channel ID" << std::endl;
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// if (virtualChannel == nullptr) {
|
||||
// sif::warning << "CcsdsHandler::addVirtualChannel: Invalid virtual channel interface"
|
||||
// << std::endl;
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// auto status = virtualChannelMap.emplace(vcId, virtualChannel);
|
||||
// if (status.second == false) {
|
||||
// sif::warning << "CcsdsHandler::addVirtualChannel: Failed to add virtual channel to "
|
||||
// "virtual channel map"
|
||||
// << std::endl;
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
|
||||
// MessageQueueId_t CcsdsIpCoreHandler::getReportReceptionQueue(uint8_t virtualChannel) const {
|
||||
// if (virtualChannel < config::NUMBER_OF_VIRTUAL_CHANNELS) {
|
||||
// auto iter = virtualChannelMap.find(virtualChannel);
|
||||
// if (iter != virtualChannelMap.end()) {
|
||||
// return iter->second->getReportReceptionQueue();
|
||||
// } else {
|
||||
// sif::warning << "CcsdsHandler::getReportReceptionQueue: Virtual channel with ID "
|
||||
// << static_cast<unsigned int>(virtualChannel) << " not in virtual channel map"
|
||||
// << std::endl;
|
||||
// return MessageQueueIF::NO_QUEUE;
|
||||
// }
|
||||
// } else {
|
||||
// if (virtualChannel > config::NUMBER_OF_VIRTUAL_CHANNELS) {
|
||||
// sif::debug << "CcsdsHandler::getReportReceptionQueue: Invalid virtual channel requested";
|
||||
// return MessageQueueIF::NO_QUEUE;
|
||||
// }
|
||||
// auto iter = virtualChannelMap.find(virtualChannel);
|
||||
// if (iter != virtualChannelMap.end()) {
|
||||
// return iter->second->getReportReceptionQueue();
|
||||
// }
|
||||
// sif::warning << "CcsdsHandler::getReportReceptionQueue: Virtual channel with ID "
|
||||
// << static_cast<unsigned int>(virtualChannel) << " not in virtual channel map"
|
||||
// << std::endl;
|
||||
// return MessageQueueIF::NO_QUEUE;
|
||||
// }
|
||||
|
||||
@ -237,20 +218,14 @@ ReturnValue_t CcsdsIpCoreHandler::executeAction(ActionId_t actionId, MessageQueu
|
||||
return EXECUTION_FINISHED;
|
||||
}
|
||||
|
||||
void CcsdsIpCoreHandler::forwardLinkstate() {
|
||||
VirtualChannelMapIter iter;
|
||||
for (iter = virtualChannelMap.begin(); iter != virtualChannelMap.end(); iter++) {
|
||||
iter->second->setLinkState(linkState);
|
||||
}
|
||||
}
|
||||
void CcsdsIpCoreHandler::updateLinkState() { linkState = LINK_UP; }
|
||||
|
||||
void CcsdsIpCoreHandler::enableTransmit() {
|
||||
#ifndef TE0720_1CFA
|
||||
gpioIF->pullHigh(enTxClock);
|
||||
gpioIF->pullHigh(enTxData);
|
||||
#endif
|
||||
linkState = UP;
|
||||
forwardLinkstate();
|
||||
linkState = LINK_UP;
|
||||
}
|
||||
|
||||
void CcsdsIpCoreHandler::getMode(Mode_t* mode, Submode_t* submode) {
|
||||
@ -317,8 +292,7 @@ void CcsdsIpCoreHandler::disableTransmit() {
|
||||
gpioIF->pullLow(enTxClock);
|
||||
gpioIF->pullLow(enTxData);
|
||||
#endif
|
||||
linkState = DOWN;
|
||||
forwardLinkstate();
|
||||
linkState = LINK_DOWN;
|
||||
}
|
||||
|
||||
const char* CcsdsIpCoreHandler::getName() const { return "CCSDS Handler"; }
|
||||
|
Reference in New Issue
Block a user