Compare commits
2 Commits
spahr/Shar
...
event-defi
Author | SHA1 | Date | |
---|---|---|---|
a994be47c3 | |||
893e0a41d7 |
@ -18,13 +18,13 @@ class MgmRM3100Handler : public DeviceHandlerBase {
|
|||||||
static const uint8_t INTERFACE_ID = CLASS_ID::MGM_RM3100;
|
static const uint8_t INTERFACE_ID = CLASS_ID::MGM_RM3100;
|
||||||
|
|
||||||
//! [EXPORT] : [COMMENT] P1: TMRC value which was set, P2: 0
|
//! [EXPORT] : [COMMENT] P1: TMRC value which was set, P2: 0
|
||||||
static constexpr Event tmrcSet = event::makeEvent<SUBSYSTEM_ID::MGM_RM3100, 0x00, severity::INFO>();
|
static constexpr Event tmrcSet = event::makeEvent(SUBSYSTEM_ID::MGM_RM3100, 0x00, severity::INFO);
|
||||||
|
|
||||||
//! [EXPORT] : [COMMENT] Cycle counter set. P1: First two bytes new Cycle Count X
|
//! [EXPORT] : [COMMENT] Cycle counter set. P1: First two bytes new Cycle Count X
|
||||||
//! P1: Second two bytes new Cycle Count Y
|
//! P1: Second two bytes new Cycle Count Y
|
||||||
//! P2: New cycle count Z
|
//! P2: New cycle count Z
|
||||||
static constexpr Event cycleCountersSet =
|
static constexpr Event cycleCountersSet =
|
||||||
event::makeEvent<SUBSYSTEM_ID::MGM_RM3100, 0x01, severity::INFO>();
|
event::makeEvent(SUBSYSTEM_ID::MGM_RM3100, 0x01, severity::INFO);
|
||||||
|
|
||||||
MgmRM3100Handler(object_id_t objectId, object_id_t deviceCommunication, CookieIF *comCookie,
|
MgmRM3100Handler(object_id_t objectId, object_id_t deviceCommunication, CookieIF *comCookie,
|
||||||
uint32_t transitionDelay);
|
uint32_t transitionDelay);
|
||||||
|
@ -19,13 +19,13 @@ struct FsfwParams {
|
|||||||
};
|
};
|
||||||
|
|
||||||
namespace events {
|
namespace events {
|
||||||
static constexpr Event PDU_SEND_ERROR = event::makeEvent<SSID, 1, severity::LOW>();
|
static constexpr Event PDU_SEND_ERROR = event::makeEvent(SSID, 1, severity::LOW);
|
||||||
static constexpr Event SERIALIZATION_ERROR = event::makeEvent<SSID, 2, severity::LOW>();
|
static constexpr Event SERIALIZATION_ERROR = event::makeEvent(SSID, 2, severity::LOW);
|
||||||
static constexpr Event FILESTORE_ERROR = event::makeEvent<SSID, 3, severity::LOW>();
|
static constexpr Event FILESTORE_ERROR = event::makeEvent(SSID, 3, severity::LOW);
|
||||||
//! [EXPORT] : [COMMENT] P1: Transaction step ID, P2: 0 for source file name, 1 for dest file name
|
//! [EXPORT] : [COMMENT] P1: Transaction step ID, P2: 0 for source file name, 1 for dest file name
|
||||||
static constexpr Event FILENAME_TOO_LARGE_ERROR = event::makeEvent<SSID, 4, severity::LOW>();
|
static constexpr Event FILENAME_TOO_LARGE_ERROR = event::makeEvent(SSID, 4, severity::LOW);
|
||||||
//! [EXPORT] : [COMMENT] CFDP request handling failed. P2: Returncode.
|
//! [EXPORT] : [COMMENT] CFDP request handling failed. P2: Returncode.
|
||||||
static constexpr Event HANDLING_CFDP_REQUEST_FAILED = event::makeEvent<SSID, 5, severity::LOW>();
|
static constexpr Event HANDLING_CFDP_REQUEST_FAILED = event::makeEvent(SSID, 5, severity::LOW);
|
||||||
} // namespace events
|
} // namespace events
|
||||||
|
|
||||||
static constexpr ReturnValue_t SOURCE_TRANSACTION_PENDING = returnvalue::makeCode(CID, 0);
|
static constexpr ReturnValue_t SOURCE_TRANSACTION_PENDING = returnvalue::makeCode(CID, 0);
|
||||||
|
@ -191,5 +191,3 @@ ReturnValue_t FreshDeviceHandlerBase::getParameter(uint8_t domainId, uint8_t uni
|
|||||||
}
|
}
|
||||||
|
|
||||||
datapool::SharedPool* FreshDeviceHandlerBase::getOptionalSharedPool() { return nullptr; }
|
datapool::SharedPool* FreshDeviceHandlerBase::getOptionalSharedPool() { return nullptr; }
|
||||||
|
|
||||||
ModeHelper& FreshDeviceHandlerBase::getModeHelper() { return this->modeHelper; }
|
|
@ -97,11 +97,6 @@ class FreshDeviceHandlerBase : public SystemObject,
|
|||||||
ReturnValue_t connectModeTreeParent(HasModeTreeChildrenIF& parent) override;
|
ReturnValue_t connectModeTreeParent(HasModeTreeChildrenIF& parent) override;
|
||||||
ModeTreeChildIF& getModeTreeChildIF() override;
|
ModeTreeChildIF& getModeTreeChildIF() override;
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Return an interface to the ModeHelper.
|
|
||||||
*/
|
|
||||||
ModeHelper& getModeHelper();
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
ActionHelper actionHelper;
|
ActionHelper actionHelper;
|
||||||
ModeHelper modeHelper;
|
ModeHelper modeHelper;
|
||||||
|
@ -14,6 +14,8 @@ enum Severity : EventSeverity_t { INFO = 1, LOW = 2, MEDIUM = 3, HIGH = 4 };
|
|||||||
|
|
||||||
} // namespace severity
|
} // namespace severity
|
||||||
|
|
||||||
|
#define MAKE_EVENT(id, severity) (((severity) << 16) + (SUBSYSTEM_ID * 100) + (id))
|
||||||
|
|
||||||
typedef uint32_t Event;
|
typedef uint32_t Event;
|
||||||
|
|
||||||
namespace event {
|
namespace event {
|
||||||
@ -22,14 +24,11 @@ constexpr EventId_t getEventId(Event event) { return (event & 0xFFFF); }
|
|||||||
|
|
||||||
constexpr EventSeverity_t getSeverity(Event event) { return ((event >> 16) & 0xFF); }
|
constexpr EventSeverity_t getSeverity(Event event) { return ((event >> 16) & 0xFF); }
|
||||||
|
|
||||||
template<uint8_t subsystemId, UniqueEventId_t uniqueEventId, EventSeverity_t eventSeverity>
|
constexpr Event makeEvent(uint8_t subsystemId, UniqueEventId_t uniqueEventId,
|
||||||
constexpr Event makeEvent() {
|
EventSeverity_t eventSeverity) {
|
||||||
static_assert(uniqueEventId < 100, "The unique event ID must be smaller than 100!");
|
|
||||||
return (eventSeverity << 16) + (subsystemId * 100) + uniqueEventId;
|
return (eventSeverity << 16) + (subsystemId * 100) + uniqueEventId;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace event
|
} // namespace event
|
||||||
|
|
||||||
#define MAKE_EVENT(id, severity) event::makeEvent<SUBSYSTEM_ID, id, severity>();
|
|
||||||
|
|
||||||
#endif /* EVENTOBJECT_EVENT_H_ */
|
#endif /* EVENTOBJECT_EVENT_H_ */
|
||||||
|
@ -91,7 +91,7 @@ class Dataset : public SerializeIF {
|
|||||||
|
|
||||||
void setChildrenValidity(bool valid) {
|
void setChildrenValidity(bool valid) {
|
||||||
for (auto &serializable : serializables) {
|
for (auto &serializable : serializables) {
|
||||||
serializable.get().setValid(valid);
|
serializable.get().setValid(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,12 +35,8 @@ ReturnValue_t ModeHelper::handleModeCommand(CommandMessage* command) {
|
|||||||
commandedMode = mode;
|
commandedMode = mode;
|
||||||
commandedSubmode = submode;
|
commandedSubmode = submode;
|
||||||
|
|
||||||
// if (((parentQueueId != MessageQueueIF::NO_QUEUE) &&
|
if ((parentQueueId != MessageQueueIF::NO_QUEUE) &&
|
||||||
// (theOneWhoCommandedAMode != parentQueueId))) {
|
(theOneWhoCommandedAMode != parentQueueId)) {
|
||||||
// owner->setToExternalControl();
|
|
||||||
// }
|
|
||||||
|
|
||||||
if(theOneWhoCommandedAMode != parentQueueId and theOneWhoCommandedAMode != powerswitchQueueId) {
|
|
||||||
owner->setToExternalControl();
|
owner->setToExternalControl();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -110,7 +106,3 @@ bool ModeHelper::isTimedOut() { return countdown.hasTimedOut(); }
|
|||||||
bool ModeHelper::isForced() { return forced; }
|
bool ModeHelper::isForced() { return forced; }
|
||||||
|
|
||||||
void ModeHelper::setForced(bool forced) { this->forced = forced; }
|
void ModeHelper::setForced(bool forced) { this->forced = forced; }
|
||||||
|
|
||||||
void ModeHelper::setPowerSwitchQueueId(MessageQueueId_t queueId) {
|
|
||||||
powerswitchQueueId = queueId;
|
|
||||||
}
|
|
||||||
|
@ -21,15 +21,10 @@ class ModeHelper {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param parentQueue the Queue id of the parent object.
|
* @param parentQueue the Queue id of the parent object.
|
||||||
* Set to MessageQueueIF::NO_QUEUE if no parent present
|
* Set to 0 if no parent present
|
||||||
*/
|
*/
|
||||||
void setParentQueue(MessageQueueId_t parentQueueId);
|
void setParentQueue(MessageQueueId_t parentQueueId);
|
||||||
|
|
||||||
/**
|
|
||||||
* Set to MessageQueue::NO_QUEUE if no powerswitch is commanding the obejct.
|
|
||||||
*/
|
|
||||||
void setPowerSwitchQueueId(MessageQueueId_t queueId);
|
|
||||||
|
|
||||||
ReturnValue_t initialize(MessageQueueId_t parentQueueId);
|
ReturnValue_t initialize(MessageQueueId_t parentQueueId);
|
||||||
|
|
||||||
ReturnValue_t initialize(void);
|
ReturnValue_t initialize(void);
|
||||||
@ -47,7 +42,6 @@ class ModeHelper {
|
|||||||
protected:
|
protected:
|
||||||
HasModesIF *owner;
|
HasModesIF *owner;
|
||||||
MessageQueueId_t parentQueueId = MessageQueueIF::NO_QUEUE;
|
MessageQueueId_t parentQueueId = MessageQueueIF::NO_QUEUE;
|
||||||
MessageQueueId_t powerswitchQueueId = MessageQueueIF::NO_QUEUE;
|
|
||||||
|
|
||||||
Countdown countdown;
|
Countdown countdown;
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ class Service11TelecommandScheduling final : public PusServiceBase {
|
|||||||
|
|
||||||
//! [EXPORT] : [COMMENT] Deletion of a TC from the map failed.
|
//! [EXPORT] : [COMMENT] Deletion of a TC from the map failed.
|
||||||
//! P1: First 32 bit of request ID, P2. Last 32 bit of Request ID
|
//! P1: First 32 bit of request ID, P2. Last 32 bit of Request ID
|
||||||
static constexpr Event TC_DELETION_FAILED = event::makeEvent<SUBSYSTEM_ID, 0, severity::MEDIUM>();
|
static constexpr Event TC_DELETION_FAILED = MAKE_EVENT(0, severity::MEDIUM);
|
||||||
|
|
||||||
// The types of PUS-11 subservices
|
// The types of PUS-11 subservices
|
||||||
enum Subservice : uint8_t {
|
enum Subservice : uint8_t {
|
||||||
|
@ -64,11 +64,6 @@ void SubsystemBase::executeTable(HybridIterator<ModeListEntry> tableIter, Submod
|
|||||||
|
|
||||||
for (; tableIter.value != nullptr; ++tableIter) {
|
for (; tableIter.value != nullptr; ++tableIter) {
|
||||||
object_id_t object = tableIter.value->getObject();
|
object_id_t object = tableIter.value->getObject();
|
||||||
|
|
||||||
// As default, the objectId in the commandTable is the same as the one in the childrenMap.
|
|
||||||
// The user has to specify otherwise if required.
|
|
||||||
object = commandObjectIdToChildrenMapObjectId(object);
|
|
||||||
|
|
||||||
if ((iter = childrenMap.find(object)) == childrenMap.end()) {
|
if ((iter = childrenMap.find(object)) == childrenMap.end()) {
|
||||||
// illegal table entry, should only happen due to misconfigured mode table
|
// illegal table entry, should only happen due to misconfigured mode table
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
@ -124,11 +119,7 @@ void SubsystemBase::executeTable(HybridIterator<ModeListEntry> tableIter, Submod
|
|||||||
continue; // don't send redundant mode commands (produces event spam), but still command if
|
continue; // don't send redundant mode commands (produces event spam), but still command if
|
||||||
// mode is forced to reach lower levels
|
// mode is forced to reach lower levels
|
||||||
}
|
}
|
||||||
|
ReturnValue_t result = commandQueue->sendMessage(iter->second.commandQueue, &command);
|
||||||
// Get the messageQueueId if the receiver specified by the commandTable.
|
|
||||||
// This the same MessageQueueId as stored in the childrenMap if the commanded object is part of the childrenMap.
|
|
||||||
MessageQueueId_t commandedReceiver = ObjectManager::instance()->get<HasHealthIF>(tableIter->getObject())->getCommandQueue();
|
|
||||||
ReturnValue_t result = commandQueue->sendMessage(commandedReceiver, &command);
|
|
||||||
if (result == returnvalue::OK) {
|
if (result == returnvalue::OK) {
|
||||||
++commandsOutstanding;
|
++commandsOutstanding;
|
||||||
}
|
}
|
||||||
@ -362,7 +353,3 @@ ReturnValue_t SubsystemBase::registerChild(object_id_t childObjectId, MessageQue
|
|||||||
}
|
}
|
||||||
return returnvalue::OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
object_id_t SubsystemBase::commandObjectIdToChildrenMapObjectId(object_id_t commandId) {
|
|
||||||
return commandId;
|
|
||||||
}
|
|
||||||
|
@ -153,15 +153,6 @@ class SubsystemBase : public SystemObject,
|
|||||||
virtual void announceMode(bool recursive) override;
|
virtual void announceMode(bool recursive) override;
|
||||||
|
|
||||||
virtual void modeChanged();
|
virtual void modeChanged();
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief This converts the objectId of the object we want to send a mode command to into the
|
|
||||||
* objectId of the corresponding object in the childrenMap for the current mode command.
|
|
||||||
* As default implementation, this is the same objectId, and this functions returns it's input value
|
|
||||||
*
|
|
||||||
* It is up to the user to specify otherwise.
|
|
||||||
*/
|
|
||||||
virtual object_id_t commandObjectIdToChildrenMapObjectId(object_id_t commandId);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* FSFW_SUBSYSTEM_SUBSYSTEMBASE_H_ */
|
#endif /* FSFW_SUBSYSTEM_SUBSYSTEMBASE_H_ */
|
||||||
|
@ -25,7 +25,7 @@ static constexpr ReturnValue_t INCORRECT_SECONDARY_HEADER = MAKE_RETURN_CODE(11)
|
|||||||
|
|
||||||
static constexpr uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::TMTC_DISTRIBUTION;
|
static constexpr uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::TMTC_DISTRIBUTION;
|
||||||
//! P1: Returnvalue, P2: 0 for TM issues, 1 for TC issues
|
//! P1: Returnvalue, P2: 0 for TM issues, 1 for TC issues
|
||||||
static constexpr Event HANDLE_PACKET_FAILED = event::makeEvent<SUBSYSTEM_ID, 0, severity::LOW>();
|
static constexpr Event HANDLE_PACKET_FAILED = MAKE_EVENT(0, severity::LOW);
|
||||||
|
|
||||||
}; // namespace tmtcdistrib
|
}; // namespace tmtcdistrib
|
||||||
#endif // FSFW_TMTCPACKET_DEFINITIONS_H
|
#endif // FSFW_TMTCPACKET_DEFINITIONS_H
|
||||||
|
Reference in New Issue
Block a user