bit rate setter

This commit is contained in:
Jakob Meier
2021-11-21 18:07:05 +01:00
parent 63965e2f68
commit dc0f435dbd
7 changed files with 147 additions and 5 deletions

View File

@ -5,8 +5,10 @@
#include "CCSDSHandler.h"
CCSDSHandler::CCSDSHandler(object_id_t objectId, object_id_t ptmeId, object_id_t tcDestination) :
SystemObject(objectId), ptmeId(ptmeId), tcDestination(tcDestination), parameterHelper(this) {
CCSDSHandler::CCSDSHandler(object_id_t objectId, object_id_t ptmeId, object_id_t tcDestination,
TxRateSetterIF* txRateSetterIF) :
SystemObject(objectId), ptmeId(ptmeId), tcDestination(tcDestination), parameterHelper(this), actionHelper(
this, nullptr), txRateSetterIF(txRateSetterIF) {
commandQueue = QueueFactory::instance()->createMessageQueue(QUEUE_SIZE);
}
@ -55,6 +57,11 @@ ReturnValue_t CCSDSHandler::initialize() {
return result;
}
result = actionHelper.initialize(commandQueue);
if (result != RETURN_OK) {
return result;
}
VirtualChannelMapIter iter;
for (iter = virtualChannelMap.begin(); iter != virtualChannelMap.end(); iter++) {
result = iter->second->initialize();
@ -77,10 +84,15 @@ void CCSDSHandler::readCommandQueue(void) {
if (result == RETURN_OK) {
return;
}
result = actionHelper.handleActionMessage(&commandMessage);
if (result == RETURN_OK) {
return;
}
CommandMessage reply;
reply.setReplyRejected(CommandMessage::UNKNOWN_COMMAND,
commandMessage.getCommand());
commandQueue->reply(&reply);
return;
}
}
@ -140,3 +152,18 @@ MessageQueueId_t CCSDSHandler::getRequestQueue() {
// Forward packets directly to TC distributor
return tcDistributorQueueId;
}
ReturnValue_t CCSDSHandler::executeAction(ActionId_t actionId,
MessageQueueId_t commandedBy, const uint8_t* data, size_t size) {
switch(actionId) {
case SET_LOW_RATE:
txRateSetterIF->setRate(BitRates::RATE_400KHZ);
return EXECUTION_FINISHED;
case SET_HIGH_RATE:
txRateSetterIF->setRate(BitRates::RATE_2000KHZ);
return EXECUTION_FINISHED;
default:
return COMMAND_NOT_IMPLEMENTED;
}
}