-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPIToOcsEvent.py
89 lines (66 loc) · 2.12 KB
/
PIToOcsEvent.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
import inspect
import json
from datetime import datetime
class PIToOcsEvent:
"""Represents a PI event to be injected into Sds Service"""
def __init__(self):
self._Timestamp = ''
self._Value = ''
self._IsQuestionable = False
self._IsSubstituted = False
self._IsAnnotated = False
self._SystemStateCode = ''
self._DigitalStateName = ''
@property
def Timestamp(self):
return self._Timestamp
@Timestamp.setter
def Timestamp(self, Timestamp):
self._Timestamp = Timestamp
@property
def Value(self):
return self._Value
@Value.setter
def Value(self, value):
self._Value = value
@property
def IsQuestionable(self):
return self._IsQuestionable
@IsQuestionable.setter
def IsQuestionable(self, IsQuestionable):
self._IsQuestionable = IsQuestionable
@property
def IsSubstituted(self):
return self._IsSubstituted
@IsSubstituted.setter
def IsSubstituted(self, IsSubstituted):
self._IsSubstituted = IsSubstituted
@property
def IsAnnotated(self):
return self._IsAnnotated
@IsAnnotated.setter
def IsAnnotated(self, IsAnnotated):
self._IsAnnotated = IsAnnotated
@property
def SystemStateCode(self):
return self._SystemStateCode
@SystemStateCode.setter
def SystemStateCode(self, SystemStateCode):
self._SystemStateCode = SystemStateCode
@property
def DigitalStateName(self):
return self._DigitalStateName
@DigitalStateName.setter
def DigitalStateName(self, DigitalStateName):
self._DigitalStateName = DigitalStateName
def toDictionary(self):
"""Converts the object into a dictionary"""
dictionary = {}
for prop in inspect.getmembers(type(self),
lambda v: isinstance(v, property)):
if hasattr(self, prop[0]):
dictionary[prop[0]] = prop[1].fget(self)
return dictionary
def toJson(self):
"""Converts the object into JSON"""
return json.dumps(self.toDictionary())