ccsds handler sending command to enable transmitter
This commit is contained in:
@ -10,6 +10,8 @@
|
||||
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||
#include "fsfw/serviceinterface/serviceInterfaceDefintions.h"
|
||||
|
||||
#include "mission/devices/devicedefinitions/SyrlinksDefinitions.h"
|
||||
|
||||
CCSDSHandler::CCSDSHandler(object_id_t objectId, object_id_t ptmeId, object_id_t tcDestination,
|
||||
PtmeConfig* ptmeConfig, GpioIF* gpioIF, gpioId_t enTxClock,
|
||||
gpioId_t enTxData, uint32_t transmitterTimeout)
|
||||
@ -22,11 +24,14 @@ CCSDSHandler::CCSDSHandler(object_id_t objectId, object_id_t ptmeId, object_id_t
|
||||
gpioIF(gpioIF),
|
||||
enTxClock(enTxClock),
|
||||
enTxData(enTxData),
|
||||
transmitterTimeout(transmitterTimeout) {
|
||||
transmitterTimeout(transmitterTimeout),
|
||||
commandActionHelper(this) {
|
||||
commandQueue = QueueFactory::instance()->createMessageQueue(QUEUE_SIZE);
|
||||
auto mqArgs = MqArgs(objectId, static_cast<void*>(this));
|
||||
eventQueue =
|
||||
QueueFactory::instance()->createMessageQueue(10, EventMessage::EVENT_MESSAGE_SIZE, &mqArgs);
|
||||
commandActionHelperQueue =
|
||||
QueueFactory::instance()->createMessageQueue(EventMessage::EVENT_MESSAGE_SIZE * 5);
|
||||
}
|
||||
|
||||
CCSDSHandler::~CCSDSHandler() {}
|
||||
@ -120,6 +125,10 @@ ReturnValue_t CCSDSHandler::initialize() {
|
||||
return ObjectManagerIF::CHILD_INIT_FAILED;
|
||||
}
|
||||
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
return ObjectManagerIF::CHILD_INIT_FAILED;
|
||||
}
|
||||
|
||||
#if OBSW_SYRLINKS_SIMULATED == 1
|
||||
ptmeConfig->invertTxClock(true);
|
||||
#endif /* OBSW_SYRLINKS_SIMULATED == 1*/
|
||||
@ -148,8 +157,73 @@ void CCSDSHandler::readCommandQueue(void) {
|
||||
}
|
||||
}
|
||||
|
||||
void CCSDSHandler::readCommandActionHelperQueue() {
|
||||
CommandMessage message;
|
||||
for (ReturnValue_t result = commandActionHelperQueue->receiveMessage(&message);
|
||||
result == RETURN_OK; result = commandActionHelperQueue->receiveMessage(&message)) {
|
||||
result = commandActionHelper.handleReply(&message);
|
||||
if (result == RETURN_OK) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MessageQueueId_t CCSDSHandler::getCommandQueue() const { return commandQueue->getId(); }
|
||||
|
||||
MessageQueueIF* CCSDSHandler::getCommandQueuePtr() { return commandActionHelperQueue; }
|
||||
|
||||
void CCSDSHandler::stepSuccessfulReceived(ActionId_t actionId, uint8_t step) { return; }
|
||||
|
||||
void CCSDSHandler::stepFailedReceived(ActionId_t actionId, uint8_t step,
|
||||
ReturnValue_t returnCode) {
|
||||
switch (actionId) {
|
||||
case syrlinks::SET_TX_MODE_MODULATION: {
|
||||
sif::warning << "CCSDSHandler::stepFailedReceived: Failed to set enable transmitter"
|
||||
<< std::endl;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
sif::debug << "CCSDSHandler::stepFailedReceived: Received unexpected action reply"
|
||||
<< std::endl;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void CCSDSHandler::dataReceived(ActionId_t actionId, const uint8_t* data, uint32_t size) {
|
||||
return;
|
||||
}
|
||||
|
||||
void CCSDSHandler::completionSuccessfulReceived(ActionId_t actionId) {
|
||||
switch (actionId) {
|
||||
case syrlinks::SET_TX_MODE_MODULATION: {
|
||||
triggerEvent(TRANSMITTER_ENABLED);
|
||||
transmitterCountdown.setTimeout(transmitterTimeout);
|
||||
linkState = UP;
|
||||
// Set link state of all virtual channels to link up
|
||||
forwardLinkstate();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
sif::debug << "CCSDSHandler::completionSuccessfulReceived: Received unexpected action reply"
|
||||
<< std::endl;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void CCSDSHandler::completionFailedReceived(ActionId_t actionId, ReturnValue_t returnCode) {
|
||||
switch (actionId) {
|
||||
case syrlinks::SET_TX_MODE_MODULATION: {
|
||||
sif::warning << "CCSDSHandler::completionFailedReceived: Failed to set enable transmitter"
|
||||
<< std::endl;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
sif::debug << "CCSDSHandler::completionFailedReceived: Received unexpected action reply"
|
||||
<< std::endl;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void CCSDSHandler::addVirtualChannel(VcId_t vcId, VirtualChannel* virtualChannel) {
|
||||
if (vcId > common::NUMBER_OF_VIRTUAL_CHANNELS) {
|
||||
sif::warning << "CCSDSHandler::addVirtualChannel: Invalid virtual channel ID" << std::endl;
|
||||
@ -312,14 +386,10 @@ void CCSDSHandler::enableTransmit() {
|
||||
// Transmitter already enabled
|
||||
return;
|
||||
}
|
||||
transmitterCountdown.setTimeout(transmitterTimeout);
|
||||
#ifndef TE0720_1CFA
|
||||
gpioIF->pullHigh(enTxClock);
|
||||
gpioIF->pullHigh(enTxData);
|
||||
#endif /* BOARD_TE0720 == 0 */
|
||||
linkState = UP;
|
||||
// Set link state of all virtual channels to link up
|
||||
forwardLinkstate();
|
||||
}
|
||||
|
||||
void CCSDSHandler::checkTxTimer() {
|
||||
|
Reference in New Issue
Block a user