cleaned up includes, improved doc
This commit is contained in:
parent
5dc2133c3a
commit
482aedfaf2
@ -1,22 +1,21 @@
|
|||||||
/*
|
#include <framework/tcdistribution/PUSDistributorIF.h>
|
||||||
* CommandingServiceBase.cpp
|
#include <framework/tmtcservices/AcceptsTelemetryIF.h>
|
||||||
*
|
#include <framework/objectmanager/ObjectManagerIF.h>
|
||||||
* Created on: 28.08.2019
|
|
||||||
* Author: gaisser
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <framework/tmtcservices/CommandingServiceBase.h>
|
#include <framework/tmtcservices/CommandingServiceBase.h>
|
||||||
|
#include <framework/tmtcservices/TmTcMessage.h>
|
||||||
|
#include <framework/ipc/QueueFactory.h>
|
||||||
|
#include <framework/tmtcpacket/pus/TcPacketStored.h>
|
||||||
|
#include <framework/tmtcpacket/pus/TmPacketStored.h>
|
||||||
|
|
||||||
CommandingServiceBase::CommandingServiceBase(object_id_t setObjectId,
|
CommandingServiceBase::CommandingServiceBase(object_id_t setObjectId,
|
||||||
uint16_t apid, uint8_t service, uint8_t numberOfParallelCommands,
|
uint16_t apid, uint8_t service, uint8_t numberOfParallelCommands,
|
||||||
uint16_t commandTimeout_seconds, object_id_t setPacketSource,
|
uint16_t commandTimeoutSeconds, object_id_t setPacketSource,
|
||||||
object_id_t setPacketDestination, size_t queueDepth) :
|
object_id_t setPacketDestination, size_t queueDepth) :
|
||||||
SystemObject(setObjectId), apid(apid), service(service), timeout_seconds(
|
SystemObject(setObjectId), apid(apid), service(service),
|
||||||
commandTimeout_seconds), tmPacketCounter(0), IPCStore(NULL), TCStore(
|
timeoutSeconds(commandTimeoutSeconds),
|
||||||
NULL), commandQueue(NULL), requestQueue(NULL), commandMap(
|
commandMap(numberOfParallelCommands), packetSource(setPacketSource),
|
||||||
numberOfParallelCommands), failureParameter1(0), failureParameter2(
|
packetDestination(setPacketDestination) {
|
||||||
0), packetSource(setPacketSource), packetDestination(
|
|
||||||
setPacketDestination),executingTask(NULL) {
|
|
||||||
commandQueue = QueueFactory::instance()->createMessageQueue(queueDepth);
|
commandQueue = QueueFactory::instance()->createMessageQueue(queueDepth);
|
||||||
requestQueue = QueueFactory::instance()->createMessageQueue(queueDepth);
|
requestQueue = QueueFactory::instance()->createMessageQueue(queueDepth);
|
||||||
}
|
}
|
||||||
@ -369,7 +368,7 @@ void CommandingServiceBase::checkTimeout() {
|
|||||||
typename FixedMap<MessageQueueId_t,
|
typename FixedMap<MessageQueueId_t,
|
||||||
CommandingServiceBase::CommandInfo>::Iterator iter;
|
CommandingServiceBase::CommandInfo>::Iterator iter;
|
||||||
for (iter = commandMap.begin(); iter != commandMap.end(); ++iter) {
|
for (iter = commandMap.begin(); iter != commandMap.end(); ++iter) {
|
||||||
if ((iter->uptimeOfStart + (timeout_seconds * 1000)) < uptime) {
|
if ((iter->uptimeOfStart + (timeoutSeconds * 1000)) < uptime) {
|
||||||
verificationReporter.sendFailureReport(
|
verificationReporter.sendFailureReport(
|
||||||
TC_VERIFY::COMPLETION_FAILURE, iter->tcInfo.ackFlags,
|
TC_VERIFY::COMPLETION_FAILURE, iter->tcInfo.ackFlags,
|
||||||
iter->tcInfo.tcPacketId, iter->tcInfo.tcSequenceControl,
|
iter->tcInfo.tcPacketId, iter->tcInfo.tcSequenceControl,
|
||||||
|
@ -1,35 +1,33 @@
|
|||||||
#ifndef COMMANDINGSERVICEBASE_H_
|
#ifndef FRAMEWORK_TMTCSERVICES_COMMANDINGSERVICEBASE_H_
|
||||||
#define COMMANDINGSERVICEBASE_H_
|
#define FRAMEWORK_TMTCSERVICES_COMMANDINGSERVICEBASE_H_
|
||||||
|
|
||||||
#include <framework/container/FixedMap.h>
|
|
||||||
#include <framework/container/FIFO.h>
|
|
||||||
#include <framework/ipc/CommandMessage.h>
|
|
||||||
#include <framework/objectmanager/ObjectManagerIF.h>
|
|
||||||
#include <framework/objectmanager/SystemObject.h>
|
#include <framework/objectmanager/SystemObject.h>
|
||||||
#include <framework/serialize/SerializeAdapter.h>
|
|
||||||
#include <framework/storagemanager/StorageManagerIF.h>
|
#include <framework/storagemanager/StorageManagerIF.h>
|
||||||
#include <framework/tasks/ExecutableObjectIF.h>
|
#include <framework/tasks/ExecutableObjectIF.h>
|
||||||
#include <framework/tcdistribution/PUSDistributorIF.h>
|
#include <framework/ipc/MessageQueueIF.h>
|
||||||
#include <framework/tmtcpacket/pus/TcPacketStored.h>
|
|
||||||
#include <framework/tmtcpacket/pus/TmPacketStored.h>
|
|
||||||
#include <framework/tmtcservices/AcceptsTelecommandsIF.h>
|
#include <framework/tmtcservices/AcceptsTelecommandsIF.h>
|
||||||
#include <framework/tmtcservices/AcceptsTelemetryIF.h>
|
|
||||||
#include <framework/tmtcservices/TmTcMessage.h>
|
|
||||||
#include <framework/tmtcservices/VerificationReporter.h>
|
#include <framework/tmtcservices/VerificationReporter.h>
|
||||||
#include <framework/internalError/InternalErrorReporterIF.h>
|
#include <framework/ipc/CommandMessage.h>
|
||||||
#include <framework/ipc/QueueFactory.h>
|
#include <framework/container/FixedMap.h>
|
||||||
#include <framework/timemanager/Clock.h>
|
#include <framework/container/FIFO.h>
|
||||||
|
#include <framework/serialize/SerializeIF.h>
|
||||||
|
|
||||||
|
class TcPacketStored;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief This class is the basis for all PUS Services, which have to relay Telecommands to software bus.
|
* @brief This class is the basis for all PUS Services, which have to
|
||||||
|
* relay Telecommands to software bus.
|
||||||
*
|
*
|
||||||
* It manages Telecommand reception and the generation of Verification Reports like PUSServiceBase.
|
* It manages Telecommand reception and the generation of Verification Reports
|
||||||
* Every class that inherits from this abstract class has to implement four adaption points:
|
* similar to PusServiceBase. This class is used if a telecommand can't be
|
||||||
|
* handled immediately and must be relayed to the internal software bus.
|
||||||
* - isValidSubservice
|
* - isValidSubservice
|
||||||
* - getMessageQueueAndObject
|
* - getMessageQueueAndObject
|
||||||
* - prepareCommand
|
* - prepareCommand
|
||||||
* - handleReply
|
* - handleReply
|
||||||
* \ingroup pus_services
|
* @author gaisser
|
||||||
|
* @ingroup pus_services
|
||||||
*/
|
*/
|
||||||
class CommandingServiceBase: public SystemObject,
|
class CommandingServiceBase: public SystemObject,
|
||||||
public AcceptsTelecommandsIF,
|
public AcceptsTelecommandsIF,
|
||||||
@ -59,7 +57,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
CommandingServiceBase(object_id_t setObjectId, uint16_t apid,
|
CommandingServiceBase(object_id_t setObjectId, uint16_t apid,
|
||||||
uint8_t service, uint8_t numberOfParallelCommands,
|
uint8_t service, uint8_t numberOfParallelCommands,
|
||||||
uint16_t commandTimeout_seconds, object_id_t setPacketSource,
|
uint16_t commandTimeoutSeconds, object_id_t setPacketSource,
|
||||||
object_id_t setPacketDestination, size_t queueDepth = 20);
|
object_id_t setPacketDestination, size_t queueDepth = 20);
|
||||||
virtual ~CommandingServiceBase();
|
virtual ~CommandingServiceBase();
|
||||||
|
|
||||||
@ -113,8 +111,9 @@ protected:
|
|||||||
virtual ReturnValue_t isValidSubservice(uint8_t subservice) = 0;
|
virtual ReturnValue_t isValidSubservice(uint8_t subservice) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Once a TC Request is valid, the existence of the destination and its target interface is checked and retrieved.
|
* Once a TC Request is valid, the existence of the destination and its
|
||||||
* The target message queue ID can then be acquired by using the target interface.
|
* target interface is checked and retrieved. The target message queue ID
|
||||||
|
* can then be acquired by using the target interface.
|
||||||
* @param subservice
|
* @param subservice
|
||||||
* @param tcData Application Data of TC Packet
|
* @param tcData Application Data of TC Packet
|
||||||
* @param tcDataLen
|
* @param tcDataLen
|
||||||
@ -129,10 +128,10 @@ protected:
|
|||||||
object_id_t *objectId) = 0;
|
object_id_t *objectId) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* After the Message Queue and Object ID are determined,
|
* After the Message Queue and Object ID are determined, the command is
|
||||||
* the command is prepared by using an implementation specific CommandMessage type
|
* prepared by using an implementation specific CommandMessage type
|
||||||
* which is sent to the target object.
|
* which is sent to the target object. It contains all necessary information
|
||||||
* It contains all necessary information for the device to execute telecommands.
|
* for the device to execute telecommands.
|
||||||
* @param message
|
* @param message
|
||||||
* @param subservice
|
* @param subservice
|
||||||
* @param tcData
|
* @param tcData
|
||||||
@ -146,18 +145,23 @@ protected:
|
|||||||
uint32_t *state, object_id_t objectId) = 0;
|
uint32_t *state, object_id_t objectId) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function is responsible for the communication between the Command Service Base
|
* This function is implemented by child services to specify how replies
|
||||||
* and the respective PUS Commanding Service once the execution has started.
|
* to a command from another software component are handled
|
||||||
* The PUS Commanding Service receives replies from the target device and forwards them by calling this function.
|
* @param reply
|
||||||
* There are different translations of these replies to specify how the Command Service proceeds.
|
* This is the reply in form of a command message.
|
||||||
* @param reply[out] Command Message which contains information about the command
|
* @param previousCommand
|
||||||
* @param previousCommand [out]
|
* Command_t of related command
|
||||||
* @param state
|
* @param state [out/in]
|
||||||
* @param optionalNextCommand
|
* Additional parameter which can be used to pass state information.
|
||||||
|
* State of the communication
|
||||||
|
* @param optionalNextCommand [out]
|
||||||
|
* An optional next command which can be set in this function
|
||||||
* @param objectId Source object ID
|
* @param objectId Source object ID
|
||||||
* @param isStep Flag value to mark steps of command execution
|
* @param isStep Flag value to mark steps of command execution
|
||||||
* @return - @c RETURN_OK, @c EXECUTION_COMPLETE or @c NO_STEP_MESSAGE to generate TC verification success
|
* @return
|
||||||
* - @c INVALID_REPLY can handle unrequested replies
|
* - @c RETURN_OK, @c EXECUTION_COMPLETE or @c NO_STEP_MESSAGE to
|
||||||
|
* generate TC verification success
|
||||||
|
* - @c INVALID_REPLY calls handleUnrequestedReply
|
||||||
* - Anything else triggers a TC verification failure
|
* - Anything else triggers a TC verification failure
|
||||||
*/
|
*/
|
||||||
virtual ReturnValue_t handleReply(const CommandMessage *reply,
|
virtual ReturnValue_t handleReply(const CommandMessage *reply,
|
||||||
@ -165,6 +169,16 @@ protected:
|
|||||||
CommandMessage *optionalNextCommand, object_id_t objectId,
|
CommandMessage *optionalNextCommand, object_id_t objectId,
|
||||||
bool *isStep) = 0;
|
bool *isStep) = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function can be overidden to handle unrequested reply,
|
||||||
|
* when the reply sender ID is unknown or is not found is the command map.
|
||||||
|
* @param reply
|
||||||
|
*/
|
||||||
|
virtual void handleUnrequestedReply(CommandMessage *reply);
|
||||||
|
|
||||||
|
virtual void doPeriodicOperation();
|
||||||
|
|
||||||
|
|
||||||
struct CommandInfo {
|
struct CommandInfo {
|
||||||
struct tcInfo {
|
struct tcInfo {
|
||||||
uint8_t ackFlags;
|
uint8_t ackFlags;
|
||||||
@ -184,33 +198,35 @@ protected:
|
|||||||
|
|
||||||
const uint8_t service;
|
const uint8_t service;
|
||||||
|
|
||||||
const uint16_t timeout_seconds;
|
const uint16_t timeoutSeconds;
|
||||||
|
|
||||||
uint8_t tmPacketCounter;
|
uint8_t tmPacketCounter = 0;
|
||||||
|
|
||||||
StorageManagerIF *IPCStore;
|
StorageManagerIF *IPCStore = nullptr;
|
||||||
|
|
||||||
StorageManagerIF *TCStore;
|
StorageManagerIF *TCStore = nullptr;
|
||||||
|
|
||||||
MessageQueueIF* commandQueue;
|
MessageQueueIF* commandQueue = nullptr;
|
||||||
|
|
||||||
MessageQueueIF* requestQueue;
|
MessageQueueIF* requestQueue = nullptr;
|
||||||
|
|
||||||
VerificationReporter verificationReporter;
|
VerificationReporter verificationReporter;
|
||||||
|
|
||||||
FixedMap<MessageQueueId_t, CommandInfo> commandMap;
|
FixedMap<MessageQueueId_t, CommandInfo> commandMap;
|
||||||
|
|
||||||
uint32_t failureParameter1; //!< May be set be children to return a more precise failure condition.
|
/* May be set be children to return a more precise failure condition. */
|
||||||
uint32_t failureParameter2; //!< May be set be children to return a more precise failure condition.
|
uint32_t failureParameter1 = 0;
|
||||||
|
uint32_t failureParameter2 = 0;
|
||||||
|
|
||||||
object_id_t packetSource;
|
object_id_t packetSource;
|
||||||
|
|
||||||
object_id_t packetDestination;
|
object_id_t packetDestination;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pointer to the task which executes this component, is invalid before setTaskIF was called.
|
* Pointer to the task which executes this component,
|
||||||
|
* is invalid before setTaskIF was called.
|
||||||
*/
|
*/
|
||||||
PeriodicTaskIF* executingTask;
|
PeriodicTaskIF* executingTask = nullptr;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Send TM data from pointer to data.
|
* @brief Send TM data from pointer to data.
|
||||||
@ -246,10 +262,6 @@ protected:
|
|||||||
ReturnValue_t sendTmPacket(uint8_t subservice, SerializeIF* content,
|
ReturnValue_t sendTmPacket(uint8_t subservice, SerializeIF* content,
|
||||||
SerializeIF* header = nullptr);
|
SerializeIF* header = nullptr);
|
||||||
|
|
||||||
virtual void handleUnrequestedReply(CommandMessage *reply);
|
|
||||||
|
|
||||||
virtual void doPeriodicOperation();
|
|
||||||
|
|
||||||
void checkAndExecuteFifo(
|
void checkAndExecuteFifo(
|
||||||
typename FixedMap<MessageQueueId_t, CommandInfo>::Iterator *iter);
|
typename FixedMap<MessageQueueId_t, CommandInfo>::Iterator *iter);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user