PLCnext API Documentation 25.0.2.69
Notification.hpp
1
2//
3// Copyright Phoenix Contact GmbH & Co. KG
4//
6#pragma once
8#include "Arp/System/Nm/NotificationManagerTypes.hpp"
9#include "Arp/System/Nm/Services/Severity.hpp"
10#include "Arp/Base/Rsc/Commons/RscSerializable.hpp"
11#include "Arp/Base/Rsc/Commons/RscString.hxx"
12#include "Arp/Base/JRsc/Commons/JRsc.hpp"
13
14namespace Arp { namespace System { namespace Nm
15{
16
17
19class ARP_CXX_SYMBOL_EXPORT Notification : public Arp::Base::Rsc::Commons::RscSerializable
20{
21public:
23 Notification() = default;
24
28 const DateTime& timestamp, Severity severity, PayloadTypeIdType payloadTypeId,
29 const RawPayloadType& payload);
30
31 ~Notification() = default;
32
33 // Methods inherited from RscSerializable
34 void Serialize(Arp::Base::Rsc::Commons::Services::RscWriter& writer)const;
35 void Deserialize(Arp::Base::Rsc::Commons::Services::RscReader& reader);
36 void Serialize(Arp::Base::JRsc::Commons::JRscWriter& writer)const;
37 void Deserialize(Arp::Base::JRsc::Commons::JRscReader& reader);
38 static size_t GetFieldCount(void);
39 NotificationIdType GetId() const;
40 NotificationNameIdType GetNotificationNameId() const;
41 DateTime GetTimestamp() const;
42 Severity GetSeverity() const;
43 PayloadTypeIdType GetPayloadTypeId() const;
44 const RawPayloadType& GetPayload() const;
45
48 template<typename PayloadType>
49 const PayloadType GetPayloadAs() const
50 {
51 return PayloadType(*this);
52 }
53
54private:
56 NotificationNameIdType NotificationNameId;
57 DateTime Timestamp;
58 Severity severity = Severity::Internal;
59 PayloadTypeIdType PayloadTypeId;
60 RawPayloadType Payload;
61};
62
63
64}}} // namespace Arp::System::Nm
This class contains date and time informations.
Definition: DateTime.hpp:27
Any custom struct type which is intended to be marshalled in a Rsc serialization context,...
Definition: RscSerializable.hpp:35
Reads marshaled data of RSC services.
Definition: RscReader.hpp:34
Writes marshalled data of RSC services.
Definition: RscWriter.hpp:34
Contains meta data and paylod of a Notification
Definition: Notification.hpp:20
Notification()=default
Creates an empty Notification
const PayloadType GetPayloadAs() const
Returns a view to the Payload using the defined PayloadType
Definition: Notification.hpp:49
Notification(NotificationIdType id, NotificationNameIdType notificationNameId, const DateTime &timestamp, Severity severity, PayloadTypeIdType payloadTypeId, const RawPayloadType &payload)
Constructor with all data
enum ARP_CXX_SYMBOL_EXPORT Severity
Enumeration of Severities for notifications
Definition: Severity.hpp:14
std::vector< Arp::Base::Rsc::Commons::RscVariant< RawPayloadTypeLength > > RawPayloadType
type for the internally transferred payloads
Definition: NotificationManagerTypes.hpp:32
Root namespace for the PLCnext API