2016-06-15 23:48:41 +02:00
|
|
|
#ifndef EVENTMESSAGE_H_
|
|
|
|
#define EVENTMESSAGE_H_
|
|
|
|
|
2020-08-13 20:53:35 +02:00
|
|
|
#include "Event.h"
|
|
|
|
#include "../ipc/MessageQueueMessage.h"
|
|
|
|
#include "../objectmanager/ObjectManagerIF.h"
|
2016-06-15 23:48:41 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Passing on events through IPC.
|
|
|
|
* Event Id, severity and message type retrieval is a bit difficult.
|
|
|
|
*/
|
|
|
|
class EventMessage: public MessageQueueMessage {
|
|
|
|
public:
|
|
|
|
static const uint8_t EVENT_MESSAGE = 0; //!< Normal event
|
|
|
|
static const uint8_t CONFIRMATION_REQUEST = 1; //!< Request to parent if event is caused by child or not.
|
|
|
|
static const uint8_t YOUR_FAULT = 2; //!< The fault was caused by child, parent believes it's ok.
|
|
|
|
static const uint8_t MY_FAULT = 3; //!< The fault was caused by the parent, child is ok.
|
2018-07-12 16:29:32 +02:00
|
|
|
//Add other messageIDs here if necessary.
|
2016-06-15 23:48:41 +02:00
|
|
|
static const uint8_t EVENT_MESSAGE_SIZE = HEADER_SIZE + sizeof(Event)
|
|
|
|
+ 3 * sizeof(uint32_t);
|
|
|
|
|
|
|
|
EventMessage();
|
|
|
|
// EventMessage(EventId_t event, EventSeverity_t severity,
|
|
|
|
// object_id_t reporter, uint32_t parameter1, uint32_t parameter2 = 0);
|
|
|
|
EventMessage(Event event, object_id_t reporter, uint32_t parameter1,
|
|
|
|
uint32_t parameter2 = 0);
|
|
|
|
virtual ~EventMessage();
|
|
|
|
Event getEvent();
|
|
|
|
void setEvent(Event event);
|
|
|
|
uint8_t getMessageId();
|
|
|
|
void setMessageId(uint8_t id);
|
|
|
|
EventSeverity_t getSeverity();
|
2019-08-28 14:50:24 +02:00
|
|
|
void setSeverity(EventSeverity_t severity);
|
2016-06-15 23:48:41 +02:00
|
|
|
EventId_t getEventId();
|
|
|
|
void setEventId(EventId_t event);
|
|
|
|
object_id_t getReporter();
|
|
|
|
void setReporter(object_id_t reporter);
|
|
|
|
uint32_t getParameter1();
|
|
|
|
void setParameter1(uint32_t parameter);
|
|
|
|
uint32_t getParameter2();
|
|
|
|
void setParameter2(uint32_t parameter);
|
|
|
|
|
|
|
|
void clearEventMessage();
|
|
|
|
bool isClearedEventMessage();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
static const Event INVALID_EVENT = 0;
|
2021-04-11 21:54:48 +02:00
|
|
|
virtual size_t getMinimumMessageSize() const override;
|
2016-06-15 23:48:41 +02:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* EVENTMESSAGE_H_ */
|