null replaced by nullptr.

storeID initialization added, all nullptr/0 initializations in header
This commit is contained in:
Robin Müller 2020-04-18 13:16:00 +02:00
parent 5595b0f3ce
commit ea1d55b033
2 changed files with 23 additions and 21 deletions

View File

@ -11,17 +11,15 @@
#include <framework/tmtcservices/AcceptsTelecommandsIF.h> #include <framework/tmtcservices/AcceptsTelecommandsIF.h>
#include <framework/serviceinterface/ServiceInterfaceStream.h> #include <framework/serviceinterface/ServiceInterfaceStream.h>
TmTcBridge::TmTcBridge(object_id_t objectId_, object_id_t ccsdsPacketDistributor_): TmTcBridge::TmTcBridge(object_id_t objectId_,
SystemObject(objectId_),tcStore(NULL), tmStore(NULL), object_id_t ccsdsPacketDistributor_): SystemObject(objectId_),
ccsdsPacketDistributor(ccsdsPacketDistributor_), communicationLinkUp(false), ccsdsPacketDistributor(ccsdsPacketDistributor_)
tmStored(false),recvBuffer(NULL), size(0) { {
TmTcReceptionQueue = QueueFactory::instance()-> TmTcReceptionQueue = QueueFactory::instance()->
createMessageQueue(TMTC_RECEPTION_QUEUE_DEPTH); createMessageQueue(TMTC_RECEPTION_QUEUE_DEPTH);
} }
TmTcBridge::~TmTcBridge() { TmTcBridge::~TmTcBridge() {}
}
ReturnValue_t TmTcBridge::initialize() { ReturnValue_t TmTcBridge::initialize() {
tcStore = objectManager->get<StorageManagerIF>(objects::TC_STORE); tcStore = objectManager->get<StorageManagerIF>(objects::TC_STORE);
@ -75,8 +73,9 @@ ReturnValue_t TmTcBridge::handleTm() {
ReturnValue_t TmTcBridge::readTmQueue() { ReturnValue_t TmTcBridge::readTmQueue() {
TmTcMessage message; TmTcMessage message;
const uint8_t* data = NULL; const uint8_t* data = nullptr;
size_t size = 0; size_t size = 0;
for (ReturnValue_t result = TmTcReceptionQueue->receiveMessage(&message); for (ReturnValue_t result = TmTcReceptionQueue->receiveMessage(&message);
result == RETURN_OK; result = TmTcReceptionQueue->receiveMessage(&message)) result == RETURN_OK; result = TmTcReceptionQueue->receiveMessage(&message))
{ {
@ -105,7 +104,7 @@ ReturnValue_t TmTcBridge::readTmQueue() {
ReturnValue_t TmTcBridge::storeDownlinkData(TmTcMessage *message) { ReturnValue_t TmTcBridge::storeDownlinkData(TmTcMessage *message) {
info << "TMTC Bridge: Comm Link down. " info << "TMTC Bridge: Comm Link down. "
"Saving packet ID to be sent later\r\n" << std::flush; "Saving packet ID to be sent later\r\n" << std::flush;
store_address_t storeId; store_address_t storeId = 0;
if(fifo.full()) { if(fifo.full()) {
info << "TMTC Bridge: TM downlink max. number of stored packet IDs reached." info << "TMTC Bridge: TM downlink max. number of stored packet IDs reached."

View File

@ -48,12 +48,15 @@ public:
void registerCommConnect(); void registerCommConnect();
void registerCommDisconnect(); void registerCommDisconnect();
protected: protected:
MessageQueueIF* TmTcReceptionQueue; //!< Used to send and receive TMTC messages. TmTcMessage is used to transport messages between tasks. //! Used to send and receive TMTC messages.
StorageManagerIF* tcStore; //! TmTcMessage is used to transport messages between tasks.
StorageManagerIF* tmStore; MessageQueueIF* TmTcReceptionQueue = nullptr;
object_id_t ccsdsPacketDistributor; StorageManagerIF* tcStore = nullptr;
bool communicationLinkUp; //!< Used to specify whether communication link is up StorageManagerIF* tmStore = nullptr;
bool tmStored; object_id_t ccsdsPacketDistributor = 0;
//! Used to specify whether communication link is up
bool communicationLinkUp = false;
bool tmStored = false;
/** /**
* Handle TC reception. Default implementation provided * Handle TC reception. Default implementation provided
@ -113,13 +116,13 @@ protected:
void printData(uint8_t * data, uint32_t dataLen); void printData(uint8_t * data, uint32_t dataLen);
private: private:
static const uint8_t TMTC_RECEPTION_QUEUE_DEPTH = 20; static constexpr uint8_t TMTC_RECEPTION_QUEUE_DEPTH = 20;
static const uint8_t MAX_STORED_DATA_SENT_PER_CYCLE = 10; static constexpr uint8_t MAX_STORED_DATA_SENT_PER_CYCLE = 10;
static const uint8_t MAX_DOWNLINK_PACKETS_STORED = 15; static constexpr uint8_t MAX_DOWNLINK_PACKETS_STORED = 15;
FIFO<store_address_t, MAX_DOWNLINK_PACKETS_STORED> fifo; FIFO<store_address_t, MAX_DOWNLINK_PACKETS_STORED> fifo;
uint8_t * recvBuffer; uint8_t * recvBuffer = nullptr;
uint32_t size; uint32_t size = 0;
}; };