Merge pull request 'PUS Improvements' (#283) from KSat/fsfw:mueller/pus-improvements into development

Reviewed-on: fsfw/fsfw#283
This commit is contained in:
Steffen Gaisser 2020-12-01 15:27:05 +01:00
commit 409f2d1779
16 changed files with 75 additions and 67 deletions

View File

@ -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

View File

@ -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() {}

View File

@ -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_ */

View File

@ -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;

View File

@ -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_ */

View File

@ -21,8 +21,8 @@ Service2DeviceAccess::~Service2DeviceAccess() {}
ReturnValue_t Service2DeviceAccess::isValidSubservice(uint8_t subservice) {
switch(static_cast<Subservice>(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>(subservice)){
case Subservice::RAW_COMMANDING: {
return prepareRawCommand(dynamic_cast<CommandMessage*>(message),
tcData, tcDataLen);
case Subservice::COMMAND_RAW_COMMANDING: {
return prepareRawCommand(message, tcData, tcDataLen);
}
break;
case Subservice::TOGGLE_WIRETAPPING: {
return prepareWiretappingCommand(dynamic_cast<CommandMessage*>(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<uint8_t>(Subservice::WIRETAPPING_RAW_TC));
static_cast<uint8_t>(Subservice::REPLY_WIRETAPPING_RAW_TC));
break;
case DeviceHandlerMessage::REPLY_RAW_REPLY:
sendWiretappingTm(reply,
static_cast<uint8_t>(Subservice::RAW_REPLY));
static_cast<uint8_t>(Subservice::REPLY_RAW));
break;
default:
sif::error << "Unknown message in Service2DeviceAccess::"

View File

@ -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_ */

View File

@ -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(){}

View File

@ -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_ */

View File

@ -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>(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<uint8_t>(
Subservice::DIRECT_COMMANDING_DATA_REPLY), &dataReply);
Subservice::REPLY_DIRECT_COMMANDING_DATA), &dataReply);
auto deletionResult = IPCStore->deleteData(storeId);
if(deletionResult != HasReturnvaluesIF::RETURN_OK) {

View File

@ -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_ */

View File

@ -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"

View File

@ -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<ReturnValue_t> reason; //!< [EXPORT] : [COMMENT] Reason the mode could not be reached
};
#endif /* FRAMEWORK_PUS_SERVICEPACKETS_SERVICE200PACKETS_H_ */
#endif /* FSFW_PUS_SERVICEPACKETS_SERVICE200PACKETS_H_ */

View File

@ -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_ */

View File

@ -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_ */

View File

@ -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_ */