PLCnext API Documentation 23.0.2.9
Notification.hpp
1
2//
3// Copyright PHOENIX CONTACT Electronics GmbH
4//
6#pragma once
8#include "Arp/System/Nm/NotificationManagerTypes.hpp"
9#include "Arp/System/Nm/Services/Severity.hpp"
10#include "Arp/System/Rsc/Services/IRscSerializable.hpp"
11#include "Arp/System/Rsc/Services/RscReader.hpp"
12#include "Arp/System/Rsc/Services/RscString.hxx"
13#include "Arp/System/Rsc/Services/RscWriter.hpp"
14
15
16namespace Arp { namespace System { namespace Nm
17{
18
19
22{
23public:
25 Notification() = default;
26
30 const DateTime& timestamp, Severity severity, PayloadTypeIdType payloadTypeId,
31 const RawPayloadType& payload);
32
33 ~Notification() override = default;
34
35 // Methods inherited from IRscSerializable
38 static size_t GetFieldCount(void);
39
42
45
48
51
54
56 const RawPayloadType& GetPayload() const;
57
60 template<typename PayloadType>
61 const PayloadType GetPayloadAs() const
62 {
63 return PayloadType(*this);
64 }
65
66private:
68 NotificationNameIdType NotificationNameId;
69 DateTime Timestamp;
70 Severity severity = Severity::Default;
71 PayloadTypeIdType PayloadTypeId;
72 RawPayloadType Payload;
73};
74
75
76}}} // namespace Arp::System::Nm
The class contains date and time informations.
Definition: DateTime.hpp:45
Contains meta data and paylod of a Notification
Definition: Notification.hpp:22
PayloadTypeIdType GetPayloadTypeId() const
Returns the PayloadTypeId
void Deserialize(Arp::System::Rsc::Services::RscReader &reader) override
Deserializes the datatype. All fields of the datatype have to be deserialized in use of RscReader.
Notification()=default
Creates an empty Notification
const RawPayloadType & GetPayload() const
Returns a reference to the raw payload
Severity GetSeverity() const
Returns the Severity
NotificationNameIdType GetNotificationNameId() const
Returns the NotificationNameId
NotificationIdType GetId() const
Returns the id
const PayloadType GetPayloadAs() const
Returns a view to the Payload using the defined PayloadType
Definition: Notification.hpp:61
void Serialize(Arp::System::Rsc::Services::RscWriter &writer) const override
Serializes the datatype. All fields of the datatype have to be serialized in use of RscWriter.
DateTime GetTimestamp() const
Returns the timestamp
Notification(NotificationIdType id, NotificationNameIdType notificationNameId, const DateTime &timestamp, Severity severity, PayloadTypeIdType payloadTypeId, const RawPayloadType &payload)
Constructor with all data
Marshalls structure or class data types. Serialize and Deserialize have to marshal fields in the same...
Definition: IRscSerializable.hpp:19
Reads data from Rsc
Definition: RscReader.hpp:26
Writes data to Rsc.
Definition: RscWriter.hpp:31
@ System
System components used by the System, Device, Plc or Io domains.
Severity
Enumeration of Severities for notifications
Definition: Severity.hpp:15
std::vector< Arp::System::Rsc::Services::RscVariant< RawPayloadTypeLength > > RawPayloadType
type for the internally transferred payloads
Definition: NotificationManagerTypes.hpp:34
Root namespace for the PLCnext API