event.h
Go to the documentation of this file.
1 
2 #pragma once
3 
4 #include <opc/ua/node.h>
10 
11 #include <map>
12 
13 
14 
15 namespace OpcUa
16 {
17 typedef std::map<std::vector<QualifiedName>, Variant> PathMap;
18 typedef std::map<AttributeId, Variant> AttributeMap;
19 
20 class Event
21 {
22 
23 public:
24  //Instanciate a new event object
25  //The optional argument is the type of the event
26  //If not set BaseEventType is used
27  //If you want to send custom data, you need custom event type on server
28  //The attributes of BaseEventType are accesible as class member,
29  //Other attributes must be set using SetValue and accessed using GetValue
30  // This API is a draft, it WILL change
31  Event(const Node & type);
32  Event(const NodeId & type);
33  Event();
34 
35  //Attributes of an BaseEventType
36  ByteString EventId; //unique id
37  NodeId EventType; //The type of event, defines attribues, connections, ...
38  DateTime LocalTime; //Time zone information
39  DateTime ReceiveTime; //Time at which the server received the event
40  DateTime Time; //Time at which the event occured, should come from underlying system
41  LocalizedText Message; //human readable event description
42  uint16_t Severity = 1; //Priority, from 1 to 1000. 1 is lowest priority
43  NodeId SourceNode; //The node that has generated the event
44  std::string SourceName; //Description of the source
45 
46 
47  //Set value of a variable(or object)
48  //This value will be used when the event is fired
49  //You can set arbitrary data, but clients will not be able to discover them thus subscribe to them
50  void SetValue(const std::vector<QualifiedName> & path, Variant value);
51  void SetValue(AttributeId attribute, Variant value);
52  void SetValue(const QualifiedName & path, Variant value);
53  void SetValue(const std::string & qualifiedname, Variant value); //helper method for the most common case
54 
55  //Return value og variable identified by its relative path
56  //or value of attribute identified by its Id
57  //returns null variant if no match
58  Variant GetValue(const std::vector<QualifiedName> & path) const;
59  Variant GetValue(AttributeId attribute) const;
60  Variant GetValue(const QualifiedName & path) const;
61  Variant GetValue(const std::string & qualifiedname) const; //helper method for the most common case
62 
63  //Get the list of available values in this event
64  std::vector<std::vector<QualifiedName>> GetValueKeys();
65 
66 protected:
67  PathMap PathValues;
68  AttributeMap AttributeValues;
69 };
70 }
std::map< AttributeId, Variant > AttributeMap
Definition: event.h:18
LocalizedText Message
Definition: event.h:41
DateTime ReceiveTime
Definition: event.h:39
std::string SourceName
Definition: event.h:44
PathMap PathValues
Definition: event.h:67
std::map< std::vector< QualifiedName >, Variant > PathMap
Definition: event.h:17
DateTime LocalTime
Definition: event.h:38
NodeId SourceNode
Definition: event.h:43
std::vector< std::vector< QualifiedName > > GetValueKeys()
Definition: event.cpp:18
uint16_t Severity
Definition: event.h:42
NodeId EventType
Definition: event.h:37
OPC UA Address space part. GNU LGPL.
Variant GetValue(const std::vector< QualifiedName > &path) const
Definition: event.cpp:57
A Node object represent an OPC-UA node. It is high level object intended for developper who want to e...
Definition: node.h:42
ByteString EventId
Definition: event.h:36
AttributeMap AttributeValues
Definition: event.h:68
void SetValue(const std::vector< QualifiedName > &path, Variant value)
Definition: event.cpp:35
DateTime Time
Definition: event.h:40


ros_opcua_impl_freeopcua
Author(s): Denis Štogl
autogenerated on Tue Jan 19 2021 03:06:04