PLCnext API Documentation  22.9.0.33
PnStationStatePayload.hpp
1 //
3 // Copyright PHOENIX CONTACT Electronics GmbH
4 //
6 
7 #pragma once
8 
9 
10 #include "Arp/System/Nm/SpecializedPayload.hpp"
11 #include "Arp/System/NmPayload/Io/ProfinetStack/PnStationType.hpp"
12 #include <tuple>
13 
14 
15 namespace Arp { namespace System { namespace NmPayload { namespace Io { namespace ProfinetStack
16 {
17 
18 
20 class PnStationStatePayload : public Arp::System::Nm::SpecializedPayload<PnStationStatePayload>
21 {
22 public:
24  using ArgumentsType = std::tuple<const char*, PnStationType, bool, bool>;
25 
26  using SpecializedPayload::SpecializedPayload;
27 
29  explicit PnStationStatePayload(const ArgumentsType& args);
30 
36  const String& componentName, PnStationType stationType, bool bfLed, bool sfLed);
37 
40 
42  PnStationType GetStationType() const;
43 
45  bool GetBfLed() const;
46 
48  bool GetSfLed() const;
49 
50 private:
51  String GetFormatstring(bool bfLed, bool sfLed) const;
52  String LedStateToString(bool state) const;
53 
54 private:
55  // Do not change the order of the field initialization!
56  const size_t indexComponentName = this->AddField<String>();
57  const size_t indexStationType = this->AddField<PnStationType>();
58  const size_t indexBfLed = this->AddField<bool>();
59  const size_t indexSfLed = this->AddField<bool>();
60 };
61 
62 
63 }}}}} // namespace Arp::System::NmPayload::Io::ProfinetStack
Payload class for state changes of PROFINET LEDs
Definition: PnStationStatePayload.hpp:21
bool GetSfLed() const
Returns the state of the SF LED
String GetComponentName() const
Return the name of the sending component
PnStationStatePayload(const ArgumentsType &args)
Constructs the payload object
bool GetBfLed() const
Returns the state of the BF LED
PnStationStatePayload(const String &componentName, PnStationType stationType, bool bfLed, bool sfLed)
Constructs the payload object
PnStationType GetStationType() const
Returns the station type
std::tuple< const char *, PnStationType, bool, bool > ArgumentsType
ArgumentsType to be used with NonBlockingNotificationRegistration3
Definition: PnStationStatePayload.hpp:24
Base class for custom Payload classes
Definition: SpecializedPayload.hpp:43
@ System
System components used by the System, Device, Plc or Io domains.
Root namespace for the PLCnext API