diff --git a/CHANGELOG b/CHANGELOG index a4951a41c..a6686478c 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -6,4 +6,8 @@ - vRequestContextSwitchFromISR is declared extern "C" so it can be defined in a C file without issues +### PUS Services + +- It is now possible to change the message queue depth for the telecommand verification service (PUS1) +- The same is possible for the event reporting service (PUS5) - PUS Health Service added, which allows to command and retrieve health via PUS packets diff --git a/pus/CService200ModeCommanding.cpp b/pus/CService200ModeCommanding.cpp index c63b47a69..c4e99359b 100644 --- a/pus/CService200ModeCommanding.cpp +++ b/pus/CService200ModeCommanding.cpp @@ -7,9 +7,10 @@ #include "../modes/ModeMessage.h" CService200ModeCommanding::CService200ModeCommanding(object_id_t objectId, - uint16_t apid, uint8_t serviceId): + uint16_t apid, uint8_t serviceId, uint8_t numParallelCommands, + uint16_t commandTimeoutSeconds): CommandingServiceBase(objectId, apid, serviceId, - NUMBER_OF_PARALLEL_COMMANDS,COMMAND_TIMEOUT_SECONDS) {} + numParallelCommands, commandTimeoutSeconds) {} CService200ModeCommanding::~CService200ModeCommanding() {} diff --git a/pus/CService200ModeCommanding.h b/pus/CService200ModeCommanding.h index 89347dbd8..840402120 100644 --- a/pus/CService200ModeCommanding.h +++ b/pus/CService200ModeCommanding.h @@ -1,5 +1,5 @@ -#ifndef FRAMEWORK_PUS_CSERVICE200MODECOMMANDING_H_ -#define FRAMEWORK_PUS_CSERVICE200MODECOMMANDING_H_ +#ifndef FSFW_PUS_CSERVICE200MODECOMMANDING_H_ +#define FSFW_PUS_CSERVICE200MODECOMMANDING_H_ #include "../tmtcservices/CommandingServiceBase.h" @@ -15,11 +15,10 @@ */ class CService200ModeCommanding: public CommandingServiceBase { public: - static constexpr uint8_t NUMBER_OF_PARALLEL_COMMANDS = 4; - static constexpr uint16_t COMMAND_TIMEOUT_SECONDS = 60; CService200ModeCommanding(object_id_t objectId, - uint16_t apid, uint8_t serviceId); + uint16_t apid, uint8_t serviceId, uint8_t numParallelCommands = 4, + uint16_t commandTimeoutSeconds = 60); virtual~ CService200ModeCommanding(); protected: @@ -82,4 +81,4 @@ private: }; }; -#endif /* FRAMEWORK_PUS_CSERVICE200MODECOMMANDING_H_ */ +#endif /* FSFW_PUS_CSERVICE200MODECOMMANDING_H_ */ diff --git a/pus/Service1TelecommandVerification.cpp b/pus/Service1TelecommandVerification.cpp index 578eb02d4..86b0dcded 100644 --- a/pus/Service1TelecommandVerification.cpp +++ b/pus/Service1TelecommandVerification.cpp @@ -6,15 +6,13 @@ #include "../tmtcpacket/pus/TmPacketStored.h" #include "../serviceinterface/ServiceInterfaceStream.h" #include "../tmtcservices/AcceptsTelemetryIF.h" -#include "../serviceinterface/ServiceInterfaceStream.h" - Service1TelecommandVerification::Service1TelecommandVerification( object_id_t objectId, uint16_t apid, uint8_t serviceId, - object_id_t targetDestination): + object_id_t targetDestination, uint16_t messageQueueDepth): SystemObject(objectId), apid(apid), serviceId(serviceId), targetDestination(targetDestination) { - tmQueue = QueueFactory::instance()->createMessageQueue(); + tmQueue = QueueFactory::instance()->createMessageQueue(messageQueueDepth); } Service1TelecommandVerification::~Service1TelecommandVerification() {} @@ -53,7 +51,7 @@ ReturnValue_t Service1TelecommandVerification::sendVerificationReport( result = generateSuccessReport(message); } if(result != HasReturnvaluesIF::RETURN_OK){ - sif::error << "Service1TelecommandVerification::initialize: " + sif::error << "Service1TelecommandVerification::sendVerificationReport: " "Sending verification packet failed !" << std::endl; } return result; diff --git a/pus/Service1TelecommandVerification.h b/pus/Service1TelecommandVerification.h index 37562d1c9..3d68a4e06 100644 --- a/pus/Service1TelecommandVerification.h +++ b/pus/Service1TelecommandVerification.h @@ -1,5 +1,5 @@ -#ifndef MISSION_PUS_SERVICE1TELECOMMANDVERIFICATION_H_ -#define MISSION_PUS_SERVICE1TELECOMMANDVERIFICATION_H_ +#ifndef FSFW_PUS_SERVICE1TELECOMMANDVERIFICATION_H_ +#define FSFW_PUS_SERVICE1TELECOMMANDVERIFICATION_H_ #include "../objectmanager/SystemObject.h" #include "../returnvalues/HasReturnvaluesIF.h" @@ -44,14 +44,15 @@ public: static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::PUS_SERVICE_1; Service1TelecommandVerification(object_id_t objectId, - uint16_t apid, uint8_t serviceId, object_id_t targetDestination); + uint16_t apid, uint8_t serviceId, object_id_t targetDestination, + uint16_t messageQueueDepth); virtual ~Service1TelecommandVerification(); /** * * @return ID of Verification Queue */ - virtual MessageQueueId_t getVerificationQueue(); + virtual MessageQueueId_t getVerificationQueue() override; /** * Performs the service periodically as specified in init_mission(). @@ -91,4 +92,4 @@ private: }; }; -#endif /* MISSION_PUS_SERVICE1TELECOMMANDVERIFICATION_H_ */ +#endif /* FSFW_PUS_SERVICE1TELECOMMANDVERIFICATION_H_ */ diff --git a/pus/Service2DeviceAccess.cpp b/pus/Service2DeviceAccess.cpp index 2093a617d..3648b7eb6 100644 --- a/pus/Service2DeviceAccess.cpp +++ b/pus/Service2DeviceAccess.cpp @@ -21,8 +21,8 @@ Service2DeviceAccess::~Service2DeviceAccess() {} ReturnValue_t Service2DeviceAccess::isValidSubservice(uint8_t subservice) { switch(static_cast(subservice)){ - case Subservice::RAW_COMMANDING: - case Subservice::TOGGLE_WIRETAPPING: + case Subservice::COMMAND_RAW_COMMANDING: + case Subservice::COMMAND_TOGGLE_WIRETAPPING: return HasReturnvaluesIF::RETURN_OK; default: sif::error << "Invalid Subservice" << std::endl; @@ -39,8 +39,7 @@ ReturnValue_t Service2DeviceAccess::getMessageQueueAndObject( SerializeAdapter::deSerialize(objectId, &tcData, &tcDataLen, SerializeIF::Endianness::BIG); - ReturnValue_t result = checkInterfaceAndAcquireMessageQueue(id,objectId); - return result; + return checkInterfaceAndAcquireMessageQueue(id,objectId); } ReturnValue_t Service2DeviceAccess::checkInterfaceAndAcquireMessageQueue( @@ -59,14 +58,12 @@ ReturnValue_t Service2DeviceAccess::prepareCommand(CommandMessage* message, uint8_t subservice, const uint8_t* tcData, size_t tcDataLen, uint32_t* state, object_id_t objectId) { switch(static_cast(subservice)){ - case Subservice::RAW_COMMANDING: { - return prepareRawCommand(dynamic_cast(message), - tcData, tcDataLen); + case Subservice::COMMAND_RAW_COMMANDING: { + return prepareRawCommand(message, tcData, tcDataLen); } break; - case Subservice::TOGGLE_WIRETAPPING: { - return prepareWiretappingCommand(dynamic_cast(message), - tcData, tcDataLen); + case Subservice::COMMAND_TOGGLE_WIRETAPPING: { + return prepareWiretappingCommand(message, tcData, tcDataLen); } break; default: @@ -121,11 +118,11 @@ void Service2DeviceAccess::handleUnrequestedReply(CommandMessage* reply) { switch(reply->getCommand()) { case DeviceHandlerMessage::REPLY_RAW_COMMAND: sendWiretappingTm(reply, - static_cast(Subservice::WIRETAPPING_RAW_TC)); + static_cast(Subservice::REPLY_WIRETAPPING_RAW_TC)); break; case DeviceHandlerMessage::REPLY_RAW_REPLY: sendWiretappingTm(reply, - static_cast(Subservice::RAW_REPLY)); + static_cast(Subservice::REPLY_RAW)); break; default: sif::error << "Unknown message in Service2DeviceAccess::" diff --git a/pus/Service2DeviceAccess.h b/pus/Service2DeviceAccess.h index f6aa8b521..b62e6854a 100644 --- a/pus/Service2DeviceAccess.h +++ b/pus/Service2DeviceAccess.h @@ -1,5 +1,5 @@ -#ifndef FRAMEWORK_PUS_SERVICE2DEVICEACCESS_H_ -#define FRAMEWORK_PUS_SERVICE2DEVICEACCESS_H_ +#ifndef FSFW_PUS_SERVICE2DEVICEACCESS_H_ +#define FSFW_PUS_SERVICE2DEVICEACCESS_H_ #include "../objectmanager/SystemObjectIF.h" #include "../devicehandlers/AcceptsDeviceResponsesIF.h" @@ -81,12 +81,16 @@ private: const uint8_t* tcData, size_t tcDataLen); enum class Subservice { - RAW_COMMANDING = 128, //!< [EXPORT] : [COMMAND] Command in device native protocol - TOGGLE_WIRETAPPING = 129, //!< [EXPORT] : [COMMAND] Toggle wiretapping of raw communication - RAW_REPLY = 130, //!< [EXPORT] : [REPLY] Includes wiretapping TM and normal TM raw replies from device - WIRETAPPING_RAW_TC = 131 //!< [EXPORT] : [REPLY] Wiretapping packets of commands built by device handler + //!< [EXPORT] : [COMMAND] Command in device native protocol + COMMAND_RAW_COMMANDING = 128, + //!< [EXPORT] : [COMMAND] Toggle wiretapping of raw communication + COMMAND_TOGGLE_WIRETAPPING = 129, + //!< [EXPORT] : [REPLY] Includes wiretapping TM and normal TM raw replies from device + REPLY_RAW = 130, + //!< [EXPORT] : [REPLY] Wiretapping packets of commands built by device handler + REPLY_WIRETAPPING_RAW_TC = 131 }; }; -#endif /* MISSION_PUS_DEVICE2DEVICECOMMANDING_H_ */ +#endif /* FSFW_PUS_DEVICE2DEVICECOMMANDING_H_ */ diff --git a/pus/Service5EventReporting.cpp b/pus/Service5EventReporting.cpp index 829d04bde..e0b34a5b4 100644 --- a/pus/Service5EventReporting.cpp +++ b/pus/Service5EventReporting.cpp @@ -8,10 +8,11 @@ Service5EventReporting::Service5EventReporting(object_id_t objectId, - uint16_t apid, uint8_t serviceId, size_t maxNumberReportsPerCycle): + uint16_t apid, uint8_t serviceId, size_t maxNumberReportsPerCycle, + uint32_t messageQueueDepth): PusServiceBase(objectId, apid, serviceId), maxNumberReportsPerCycle(maxNumberReportsPerCycle) { - eventQueue = QueueFactory::instance()->createMessageQueue(); + eventQueue = QueueFactory::instance()->createMessageQueue(messageQueueDepth); } Service5EventReporting::~Service5EventReporting(){} diff --git a/pus/Service5EventReporting.h b/pus/Service5EventReporting.h index 0b6ee9a8c..69242801f 100644 --- a/pus/Service5EventReporting.h +++ b/pus/Service5EventReporting.h @@ -1,5 +1,5 @@ -#ifndef FRAMEWORK_PUS_SERVICE5EVENTREPORTING_H_ -#define FRAMEWORK_PUS_SERVICE5EVENTREPORTING_H_ +#ifndef FSFW_PUS_SERVICE5EVENTREPORTING_H_ +#define FSFW_PUS_SERVICE5EVENTREPORTING_H_ #include "../tmtcservices/PusServiceBase.h" #include "../events/EventMessage.h" @@ -42,7 +42,8 @@ class Service5EventReporting: public PusServiceBase { public: Service5EventReporting(object_id_t objectId, uint16_t apid, - uint8_t serviceId, size_t maxNumberReportsPerCycle = 10); + uint8_t serviceId, size_t maxNumberReportsPerCycle = 10, + uint32_t messageQueueDepth = 10); virtual ~Service5EventReporting(); /*** @@ -83,4 +84,4 @@ private: ReturnValue_t generateEventReport(EventMessage message); }; -#endif /* MISSION_PUS_SERVICE5EVENTREPORTING_H_ */ +#endif /* FSFW_PUS_SERVICE5EVENTREPORTING_H_ */ diff --git a/pus/Service8FunctionManagement.cpp b/pus/Service8FunctionManagement.cpp index 2c2e590b5..d710c56e1 100644 --- a/pus/Service8FunctionManagement.cpp +++ b/pus/Service8FunctionManagement.cpp @@ -7,10 +7,10 @@ #include "../serialize/SerializeAdapter.h" #include "../serviceinterface/ServiceInterfaceStream.h" -Service8FunctionManagement::Service8FunctionManagement(object_id_t object_id, +Service8FunctionManagement::Service8FunctionManagement(object_id_t objectId, uint16_t apid, uint8_t serviceId, uint8_t numParallelCommands, uint16_t commandTimeoutSeconds): - CommandingServiceBase(object_id, apid, serviceId, numParallelCommands, + CommandingServiceBase(objectId, apid, serviceId, numParallelCommands, commandTimeoutSeconds) {} Service8FunctionManagement::~Service8FunctionManagement() {} @@ -19,7 +19,7 @@ Service8FunctionManagement::~Service8FunctionManagement() {} ReturnValue_t Service8FunctionManagement::isValidSubservice( uint8_t subservice) { switch(static_cast(subservice)) { - case Subservice::DIRECT_COMMANDING: + case Subservice::COMMAND_DIRECT_COMMANDING: return HasReturnvaluesIF::RETURN_OK; default: return AcceptsTelecommandsIF::INVALID_SUBSERVICE; @@ -131,7 +131,7 @@ ReturnValue_t Service8FunctionManagement::handleDataReply( } DataReply dataReply(objectId, actionId, buffer, size); result = sendTmPacket(static_cast( - Subservice::DIRECT_COMMANDING_DATA_REPLY), &dataReply); + Subservice::REPLY_DIRECT_COMMANDING_DATA), &dataReply); auto deletionResult = IPCStore->deleteData(storeId); if(deletionResult != HasReturnvaluesIF::RETURN_OK) { diff --git a/pus/Service8FunctionManagement.h b/pus/Service8FunctionManagement.h index b5ebcda8b..00153cfb0 100644 --- a/pus/Service8FunctionManagement.h +++ b/pus/Service8FunctionManagement.h @@ -1,5 +1,5 @@ -#ifndef FRAMEWORK_PUS_SERVICE8FUNCTIONMANAGEMENT_H_ -#define FRAMEWORK_PUS_SERVICE8FUNCTIONMANAGEMENT_H_ +#ifndef FSFW_PUS_SERVICE8FUNCTIONMANAGEMENT_H_ +#define FSFW_PUS_SERVICE8FUNCTIONMANAGEMENT_H_ #include "../action/ActionMessage.h" #include "../tmtcservices/CommandingServiceBase.h" @@ -52,8 +52,10 @@ protected: private: enum class Subservice { - DIRECT_COMMANDING = 128, //!< [EXPORT] : [COMMAND] Functional commanding - DIRECT_COMMANDING_DATA_REPLY = 130, //!< [EXPORT] : [REPLY] Data reply + //!< [EXPORT] : [COMMAND] Functional commanding + COMMAND_DIRECT_COMMANDING = 128, + //!< [EXPORT] : [REPLY] Data reply + REPLY_DIRECT_COMMANDING_DATA = 130, }; ReturnValue_t checkInterfaceAndAcquireMessageQueue( @@ -64,4 +66,4 @@ private: object_id_t objectId, ActionId_t actionId); }; -#endif /* FRAMEWORK_PUS_SERVICE8FUNCTIONMANAGEMENT_H_ */ +#endif /* FSFW_PUS_SERVICE8FUNCTIONMANAGEMENT_H_ */ diff --git a/pus/servicepackets/Service1Packets.h b/pus/servicepackets/Service1Packets.h index dbd31028c..ecb62693c 100644 --- a/pus/servicepackets/Service1Packets.h +++ b/pus/servicepackets/Service1Packets.h @@ -1,3 +1,6 @@ +#ifndef FSFW_PUS_SERVICEPACKETS_SERVICE1PACKETS_H_ +#define FSFW_PUS_SERVICEPACKETS_SERVICE1PACKETS_H_ + /** * @defgroup spacepackets PUS Packet Definitions * This group contains all implemented TM or TM packages that are sent to @@ -5,9 +8,6 @@ * packet structures in Mission Information Base (MIB). */ -#ifndef MISSION_PUS_SERVICEPACKETS_SERVICE1PACKETS_H_ -#define MISSION_PUS_SERVICEPACKETS_SERVICE1PACKETS_H_ - #include "../../serialize/SerializeAdapter.h" #include "../../tmtcservices/VerificationCodes.h" diff --git a/pus/servicepackets/Service200Packets.h b/pus/servicepackets/Service200Packets.h index efcf65fcf..cb9ad4a70 100644 --- a/pus/servicepackets/Service200Packets.h +++ b/pus/servicepackets/Service200Packets.h @@ -1,5 +1,5 @@ -#ifndef FRAMEWORK_PUS_SERVICEPACKETS_SERVICE200PACKETS_H_ -#define FRAMEWORK_PUS_SERVICEPACKETS_SERVICE200PACKETS_H_ +#ifndef FSFW_PUS_SERVICEPACKETS_SERVICE200PACKETS_H_ +#define FSFW_PUS_SERVICEPACKETS_SERVICE200PACKETS_H_ #include "../../serialize/SerialLinkedListAdapter.h" #include "../../modes/ModeMessage.h" @@ -60,4 +60,4 @@ public: SerializeElement reason; //!< [EXPORT] : [COMMENT] Reason the mode could not be reached }; -#endif /* FRAMEWORK_PUS_SERVICEPACKETS_SERVICE200PACKETS_H_ */ +#endif /* FSFW_PUS_SERVICEPACKETS_SERVICE200PACKETS_H_ */ diff --git a/pus/servicepackets/Service2Packets.h b/pus/servicepackets/Service2Packets.h index d4f3fb170..285a8f9f1 100644 --- a/pus/servicepackets/Service2Packets.h +++ b/pus/servicepackets/Service2Packets.h @@ -1,5 +1,5 @@ -#ifndef FRAMEWORK_PUS_SERVICEPACKETS_SERVICE2PACKETS_H_ -#define FRAMEWORK_PUS_SERVICEPACKETS_SERVICE2PACKETS_H_ +#ifndef FSFW_PUS_SERVICEPACKETS_SERVICE2PACKETS_H_ +#define FSFW_PUS_SERVICEPACKETS_SERVICE2PACKETS_H_ #include "../../action/ActionMessage.h" #include "../../objectmanager/SystemObjectIF.h" @@ -73,4 +73,4 @@ public: } }; -#endif /* FRAMEWORK_PUS_SERVICEPACKETS_SERVICE2PACKETS_H_ */ +#endif /* FSFW_PUS_SERVICEPACKETS_SERVICE2PACKETS_H_ */ diff --git a/pus/servicepackets/Service5Packets.h b/pus/servicepackets/Service5Packets.h index 9655608aa..f903d6a26 100644 --- a/pus/servicepackets/Service5Packets.h +++ b/pus/servicepackets/Service5Packets.h @@ -1,5 +1,5 @@ -#ifndef MISSION_PUS_SERVICEPACKETS_SERVICE5PACKETS_H_ -#define MISSION_PUS_SERVICEPACKETS_SERVICE5PACKETS_H_ +#ifndef FSFW_PUS_SERVICEPACKETS_SERVICE5PACKETS_H_ +#define FSFW_PUS_SERVICEPACKETS_SERVICE5PACKETS_H_ #include "../../serialize/SerializeAdapter.h" #include "../../tmtcservices/VerificationCodes.h" @@ -73,4 +73,4 @@ private: }; -#endif /* MISSION_PUS_SERVICEPACKETS_SERVICE5PACKETS_H_ */ +#endif /* FSFW_PUS_SERVICEPACKETS_SERVICE5PACKETS_H_ */ diff --git a/pus/servicepackets/Service8Packets.h b/pus/servicepackets/Service8Packets.h index 14f8b6e6e..b026edf52 100644 --- a/pus/servicepackets/Service8Packets.h +++ b/pus/servicepackets/Service8Packets.h @@ -1,5 +1,5 @@ -#ifndef FRAMEWORK_PUS_SERVICEPACKETS_SERVICE8PACKETS_H_ -#define FRAMEWORK_PUS_SERVICEPACKETS_SERVICE8PACKETS_H_ +#ifndef FSFW_PUS_SERVICEPACKETS_SERVICE8PACKETS_H_ +#define FSFW_PUS_SERVICEPACKETS_SERVICE8PACKETS_H_ #include "../../action/ActionMessage.h" #include "../../objectmanager/SystemObjectIF.h" @@ -118,4 +118,4 @@ private: }; -#endif /* FRAMEWORK_PUS_SERVICEPACKETS_SERVICE8PACKETS_H_ */ +#endif /* FSFW_PUS_SERVICEPACKETS_SERVICE8PACKETS_H_ */