diff --git a/devicehandlers/DeviceHandlerBase.h b/devicehandlers/DeviceHandlerBase.h index 3c5edf55e..61fb701d5 100644 --- a/devicehandlers/DeviceHandlerBase.h +++ b/devicehandlers/DeviceHandlerBase.h @@ -1048,6 +1048,7 @@ private: /** Cached for initialize() */ static object_id_t defaultHkDestination; + /** HK destination can also be set individually */ object_id_t hkDestination = objects::NO_OBJECT; /** diff --git a/tmtcservices/CommandingServiceBase.cpp b/tmtcservices/CommandingServiceBase.cpp index 63a3d9435..4c9b5375c 100644 --- a/tmtcservices/CommandingServiceBase.cpp +++ b/tmtcservices/CommandingServiceBase.cpp @@ -8,8 +8,8 @@ #include #include -object_id_t CommandingServiceBase::packetSource = objects::NO_OBJECT; -object_id_t CommandingServiceBase::packetDestination = objects::NO_OBJECT; +object_id_t CommandingServiceBase::defaultPacketSource = objects::NO_OBJECT; +object_id_t CommandingServiceBase::defaultPacketDestination = objects::NO_OBJECT; CommandingServiceBase::CommandingServiceBase(object_id_t setObjectId, uint16_t apid, uint8_t service, uint8_t numberOfParallelCommands, @@ -62,10 +62,18 @@ ReturnValue_t CommandingServiceBase::initialize() { return result; } + if(packetDestination == objects::NO_OBJECT) { + packetDestination = defaultPacketDestination; + } AcceptsTelemetryIF* packetForwarding = objectManager->get(packetDestination); + + if(packetSource == objects::NO_OBJECT) { + packetSource = defaultPacketSource; + } PUSDistributorIF* distributor = objectManager->get( packetSource); + if (packetForwarding == nullptr or distributor == nullptr) { sif::error << "CommandingServiceBase::intialize: Packet source or " "packet destination invalid!" << std::endl; diff --git a/tmtcservices/CommandingServiceBase.h b/tmtcservices/CommandingServiceBase.h index e9b5f0471..ec38bdee4 100644 --- a/tmtcservices/CommandingServiceBase.h +++ b/tmtcservices/CommandingServiceBase.h @@ -248,8 +248,10 @@ protected: uint32_t failureParameter1 = 0; uint32_t failureParameter2 = 0; - static object_id_t packetSource; - static object_id_t packetDestination; + static object_id_t defaultPacketSource; + object_id_t packetSource = objects::NO_OBJECT; + static object_id_t defaultPacketDestination; + object_id_t packetDestination = objects::NO_OBJECT; /** * Pointer to the task which executes this component,