tmtc bridge improvements
This commit is contained in:
@ -5,11 +5,13 @@
|
||||
#include <framework/serviceinterface/ServiceInterfaceStream.h>
|
||||
#include <framework/globalfunctions/arrayprinter.h>
|
||||
|
||||
TmTcBridge::TmTcBridge(object_id_t objectId_,
|
||||
object_id_t ccsdsPacketDistributor_): SystemObject(objectId_),
|
||||
ccsdsPacketDistributor(ccsdsPacketDistributor_)
|
||||
TmTcBridge::TmTcBridge(object_id_t objectId, object_id_t tcDestination,
|
||||
object_id_t tmStoreId, object_id_t tcStoreId):
|
||||
SystemObject(objectId),tmStoreId(tmStoreId), tcStoreId(tcStoreId),
|
||||
tcDestination(tcDestination)
|
||||
|
||||
{
|
||||
TmTcReceptionQueue = QueueFactory::instance()->
|
||||
tmTcReceptionQueue = QueueFactory::instance()->
|
||||
createMessageQueue(TMTC_RECEPTION_QUEUE_DEPTH);
|
||||
}
|
||||
|
||||
@ -42,20 +44,27 @@ ReturnValue_t TmTcBridge::setMaxNumberOfPacketsStored(
|
||||
}
|
||||
|
||||
ReturnValue_t TmTcBridge::initialize() {
|
||||
tcStore = objectManager->get<StorageManagerIF>(objects::TC_STORE);
|
||||
if (tcStore == NULL) {
|
||||
return RETURN_FAILED;
|
||||
tcStore = objectManager->get<StorageManagerIF>(tcStoreId);
|
||||
if (tcStore == nullptr) {
|
||||
sif::error << "TmTcBridge::initialize: TC store invalid. Make sure"
|
||||
"it is created and set up properly." << std::endl;
|
||||
return ObjectManagerIF::CHILD_INIT_FAILED;
|
||||
}
|
||||
tmStore = objectManager->get<StorageManagerIF>(objects::TM_STORE);
|
||||
if (tmStore == NULL) {
|
||||
return RETURN_FAILED;
|
||||
tmStore = objectManager->get<StorageManagerIF>(tmStoreId);
|
||||
if (tmStore == nullptr) {
|
||||
sif::error << "TmTcBridge::initialize: TM store invalid. Make sure"
|
||||
"it is created and set up properly." << std::endl;
|
||||
return ObjectManagerIF::CHILD_INIT_FAILED;
|
||||
}
|
||||
AcceptsTelecommandsIF* tcDistributor =
|
||||
objectManager->get<AcceptsTelecommandsIF>(ccsdsPacketDistributor);
|
||||
if (tcDistributor == NULL) {
|
||||
return RETURN_FAILED;
|
||||
objectManager->get<AcceptsTelecommandsIF>(tcDestination);
|
||||
if (tcDistributor == nullptr) {
|
||||
sif::error << "TmTcBridge::initialize: TC Distributor invalid"
|
||||
<< std::endl;
|
||||
return ObjectManagerIF::CHILD_INIT_FAILED;
|
||||
}
|
||||
TmTcReceptionQueue->setDefaultDestination(tcDistributor->getRequestQueue());
|
||||
|
||||
tmTcReceptionQueue->setDefaultDestination(tcDistributor->getRequestQueue());
|
||||
return RETURN_OK;
|
||||
}
|
||||
|
||||
@ -73,10 +82,7 @@ ReturnValue_t TmTcBridge::performOperation(uint8_t operationCode) {
|
||||
}
|
||||
|
||||
ReturnValue_t TmTcBridge::handleTc() {
|
||||
uint8_t * recvBuffer = nullptr;
|
||||
size_t recvLen = 0;
|
||||
ReturnValue_t result = receiveTc(&recvBuffer, &recvLen);
|
||||
return result;
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
ReturnValue_t TmTcBridge::handleTm() {
|
||||
@ -97,8 +103,8 @@ ReturnValue_t TmTcBridge::handleTmQueue() {
|
||||
TmTcMessage message;
|
||||
const uint8_t* data = nullptr;
|
||||
size_t size = 0;
|
||||
for (ReturnValue_t result = TmTcReceptionQueue->receiveMessage(&message);
|
||||
result == RETURN_OK; result = TmTcReceptionQueue->receiveMessage(&message))
|
||||
for (ReturnValue_t result = tmTcReceptionQueue->receiveMessage(&message);
|
||||
result == RETURN_OK; result = tmTcReceptionQueue->receiveMessage(&message))
|
||||
{
|
||||
if(communicationLinkUp == false) {
|
||||
result = storeDownlinkData(&message);
|
||||
@ -183,10 +189,20 @@ void TmTcBridge::registerCommDisconnect() {
|
||||
}
|
||||
|
||||
MessageQueueId_t TmTcBridge::getReportReceptionQueue(uint8_t virtualChannel) {
|
||||
return TmTcReceptionQueue->getId();
|
||||
return tmTcReceptionQueue->getId();
|
||||
}
|
||||
|
||||
|
||||
void TmTcBridge::printData(uint8_t * data, size_t dataLen) {
|
||||
arrayprinter::print(data, dataLen);
|
||||
}
|
||||
|
||||
uint16_t TmTcBridge::getIdentifier() {
|
||||
// This is no PUS service, so we just return 0
|
||||
return 0;
|
||||
}
|
||||
|
||||
MessageQueueId_t TmTcBridge::getRequestQueue() {
|
||||
// Default implementation: Relay TC messages to TC distributor directly.
|
||||
return tmTcReceptionQueue->getDefaultDestination();
|
||||
}
|
||||
|
Reference in New Issue
Block a user