Merge branch 'master' into mueller/Stopwatch-Update

This commit is contained in:
Steffen Gaisser 2020-09-22 14:52:20 +02:00
commit af53bf6643
5 changed files with 97 additions and 7 deletions

View File

@ -1,5 +1,5 @@
#ifndef FRAMEWORK_EVENTS_FWSUBSYSTEMIDRANGES_H_
#define FRAMEWORK_EVENTS_FWSUBSYSTEMIDRANGES_H_
#ifndef FSFW_EVENTS_FWSUBSYSTEMIDRANGES_H_
#define FSFW_EVENTS_FWSUBSYSTEMIDRANGES_H_
namespace SUBSYSTEM_ID {
enum {
@ -19,10 +19,11 @@ enum {
SYSTEM_MANAGER_1 = 75,
SYSTEM_1 = 79,
PUS_SERVICE_1 = 80,
PUS_SERVICE_17 = 97,
FW_SUBSYSTEM_ID_RANGE
};
}
#endif /* FRAMEWORK_EVENTS_FWSUBSYSTEMIDRANGES_H_ */
#endif /* FSFW_EVENTS_FWSUBSYSTEMIDRANGES_H_ */

41
pus/Service17Test.cpp Normal file
View File

@ -0,0 +1,41 @@
#include "Service17Test.h"
#include "../serviceinterface/ServiceInterfaceStream.h"
#include "../objectmanager/SystemObject.h"
#include "../tmtcpacket/pus/TmPacketStored.h"
Service17Test::Service17Test(object_id_t objectId,
uint16_t apid, uint8_t serviceId):
PusServiceBase(objectId, apid, serviceId),
packetSubCounter(0) {
}
Service17Test::~Service17Test() {
}
ReturnValue_t Service17Test::handleRequest(uint8_t subservice) {
switch(subservice){
case Subservice::CONNECTION_TEST: {
TmPacketStored connectionPacket(apid, serviceId,
Subservice::CONNECTION_TEST_REPORT, packetSubCounter++);
connectionPacket.sendPacket(requestQueue->getDefaultDestination(),
requestQueue->getId());
return HasReturnvaluesIF::RETURN_OK;
}
case Subservice::EVENT_TRIGGER_TEST: {
TmPacketStored connectionPacket(apid, serviceId,
Subservice::CONNECTION_TEST_REPORT, packetSubCounter++);
connectionPacket.sendPacket(requestQueue->getDefaultDestination(),
requestQueue->getId());
triggerEvent(TEST, 1234, 5678);
return RETURN_OK;
}
default:
return AcceptsTelecommandsIF::INVALID_SUBSERVICE;
}
}
ReturnValue_t Service17Test::performService() {
return HasReturnvaluesIF::RETURN_OK;
}

44
pus/Service17Test.h Normal file
View File

@ -0,0 +1,44 @@
#ifndef FSFW_PUS_SERVICE17TEST_H_
#define FSFW_PUS_SERVICE17TEST_H_
#include "../tmtcservices/PusServiceBase.h"
#include "../objectmanager/SystemObject.h"
/**
* @brief Test Service
* Full Documentation: ECSS-E70-41A p.167
*
* The test service provides the capability to activate test functions
* implemented on-board and to report the results of such tests.
* Service capability:
* - TC[17,1]: Perform connection test
* - TM[17,2]: Send Connection Test Report
* - TC[17,128]: Perform connection test and trigger event
*
* @ingroup pus_services
*/
class Service17Test: public PusServiceBase {
public:
// Custom events which can be triggered
static constexpr uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::PUS_SERVICE_17;
static constexpr Event TEST = MAKE_EVENT(0, SEVERITY::INFO);
enum Subservice: uint8_t {
//! [EXPORT] : [COMMAND] Perform connection test
CONNECTION_TEST = 1,
//! [EXPORT] : [REPLY] Connection test reply
CONNECTION_TEST_REPORT = 2,
//! [EXPORT] : [COMMAND] Trigger test reply and test event
EVENT_TRIGGER_TEST = 128,
};
Service17Test(object_id_t objectId, uint16_t apid, uint8_t serviceId);
virtual ~Service17Test();
virtual ReturnValue_t handleRequest(uint8_t subservice) override;
virtual ReturnValue_t performService() override;
protected:
uint16_t packetSubCounter = 0;
};
#endif /* FSFW_PUS_SERVICE17TEST_H_ */

View File

@ -384,7 +384,7 @@ void CommandingServiceBase::acceptPacket(uint8_t reportId,
}
void CommandingServiceBase::checkAndExecuteFifo(CommandMapIter iter) {
void CommandingServiceBase::checkAndExecuteFifo(CommandMapIter& iter) {
store_address_t address;
if (iter->second.fifo.retrieve(&address) != RETURN_OK) {
commandMap.erase(&iter);

View File

@ -39,7 +39,11 @@ class CommandingServiceBase: public SystemObject,
public HasReturnvaluesIF {
friend void (Factory::setStaticFrameworkObjectIds)();
public:
// We could make this configurable via preprocessor and the FSFWConfig file.
static constexpr uint8_t COMMAND_INFO_FIFO_DEPTH = 3;
static const uint8_t INTERFACE_ID = CLASS_ID::COMMAND_SERVICE_BASE;
static const ReturnValue_t EXECUTION_COMPLETE = MAKE_RETURN_CODE(1);
static const ReturnValue_t NO_STEP_MESSAGE = MAKE_RETURN_CODE(2);
static const ReturnValue_t OBJECT_BUSY = MAKE_RETURN_CODE(3);
@ -223,7 +227,7 @@ protected:
uint32_t state;
Command_t command;
object_id_t objectId;
FIFO<store_address_t, 3> fifo;
FIFO<store_address_t, COMMAND_INFO_FIFO_DEPTH> fifo;
virtual ReturnValue_t serialize(uint8_t **buffer, size_t *size,
size_t maxSize, Endianness streamEndianness) const override{
@ -235,7 +239,7 @@ protected:
};
virtual ReturnValue_t deSerialize(const uint8_t **buffer, size_t *size,
Endianness streamEndianness) override{
Endianness streamEndianness) override {
return HasReturnvaluesIF::RETURN_FAILED;
};
};
@ -312,7 +316,7 @@ protected:
ReturnValue_t sendTmPacket(uint8_t subservice, SerializeIF* content,
SerializeIF* header = nullptr);
void checkAndExecuteFifo(CommandMapIter iter);
void checkAndExecuteFifo(CommandMapIter& iter);
private:
/**