Completed
Push — dev ( 3d1b3a...abb445 )
by Olivier
02:17
created

opcua.ParsingResult.__str__()   A

Complexity

Conditions 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1.125
Metric Value
dl 0
loc 4
ccs 1
cts 2
cp 0.5
rs 10
cc 1
crap 1.125
1
'''
2
Autogenerate code from xml spec
3
'''
4
5 1
from datetime import datetime
6
7 1
from opcua.utils import Buffer
8 1
from opcua.uatypes import *
9 1
from opcua.object_ids import ObjectIds
10
11
12 1
class NamingRuleType(object):
13
    '''
14
    :ivar Mandatory:
15
    :vartype Mandatory: 1
16
    :ivar Optional:
17
    :vartype Optional: 2
18
    :ivar Constraint:
19
    :vartype Constraint: 3
20
    '''
21 1
    Mandatory = 1
22 1
    Optional = 2
23 1
    Constraint = 3
24
25
26 1
class OpenFileMode(object):
27
    '''
28
    :ivar Read:
29
    :vartype Read: 1
30
    :ivar Write:
31
    :vartype Write: 2
32
    :ivar EraseExisting:
33
    :vartype EraseExisting: 4
34
    :ivar Append:
35
    :vartype Append: 8
36
    '''
37 1
    Read = 1
38 1
    Write = 2
39 1
    EraseExisting = 4
40 1
    Append = 8
41
42
43 1
class TrustListMasks(object):
44
    '''
45
    :ivar None_:
46
    :vartype None_: 0
47
    :ivar TrustedCertificates:
48
    :vartype TrustedCertificates: 1
49
    :ivar TrustedCrls:
50
    :vartype TrustedCrls: 2
51
    :ivar IssuerCertificates:
52
    :vartype IssuerCertificates: 4
53
    :ivar IssuerCrls:
54
    :vartype IssuerCrls: 8
55
    :ivar All:
56
    :vartype All: 15
57
    '''
58 1
    None_ = 0
59 1
    TrustedCertificates = 1
60 1
    TrustedCrls = 2
61 1
    IssuerCertificates = 4
62 1
    IssuerCrls = 8
63 1
    All = 15
64
65
66 1
class IdType(object):
67
    '''
68
    The type of identifier used in a node id.
69
70
    :ivar Numeric:
71
    :vartype Numeric: 0
72
    :ivar String:
73
    :vartype String: 1
74
    :ivar Guid:
75
    :vartype Guid: 2
76
    :ivar Opaque:
77
    :vartype Opaque: 3
78
    '''
79 1
    Numeric = 0
80 1
    String = 1
81 1
    Guid = 2
82 1
    Opaque = 3
83
84
85 1
class NodeClass(object):
86
    '''
87
    A mask specifying the class of the node.
88
89
    :ivar Unspecified:
90
    :vartype Unspecified: 0
91
    :ivar Object:
92
    :vartype Object: 1
93
    :ivar Variable:
94
    :vartype Variable: 2
95
    :ivar Method:
96
    :vartype Method: 4
97
    :ivar ObjectType:
98
    :vartype ObjectType: 8
99
    :ivar VariableType:
100
    :vartype VariableType: 16
101
    :ivar ReferenceType:
102
    :vartype ReferenceType: 32
103
    :ivar DataType:
104
    :vartype DataType: 64
105
    :ivar View:
106
    :vartype View: 128
107
    '''
108 1
    Unspecified = 0
109 1
    Object = 1
110 1
    Variable = 2
111 1
    Method = 4
112 1
    ObjectType = 8
113 1
    VariableType = 16
114 1
    ReferenceType = 32
115 1
    DataType = 64
116 1
    View = 128
117
118
119 1
class ApplicationType(object):
120
    '''
121
    The types of applications.
122
123
    :ivar Server:
124
    :vartype Server: 0
125
    :ivar Client:
126
    :vartype Client: 1
127
    :ivar ClientAndServer:
128
    :vartype ClientAndServer: 2
129
    :ivar DiscoveryServer:
130
    :vartype DiscoveryServer: 3
131
    '''
132 1
    Server = 0
133 1
    Client = 1
134 1
    ClientAndServer = 2
135 1
    DiscoveryServer = 3
136
137
138 1
class MessageSecurityMode(object):
139
    '''
140
    The type of security to use on a message.
141
142
    :ivar Invalid:
143
    :vartype Invalid: 0
144
    :ivar None_:
145
    :vartype None_: 1
146
    :ivar Sign:
147
    :vartype Sign: 2
148
    :ivar SignAndEncrypt:
149
    :vartype SignAndEncrypt: 3
150
    '''
151 1
    Invalid = 0
152 1
    None_ = 1
153 1
    Sign = 2
154 1
    SignAndEncrypt = 3
155
156
157 1
class UserTokenType(object):
158
    '''
159
    The possible user token types.
160
161
    :ivar Anonymous:
162
    :vartype Anonymous: 0
163
    :ivar UserName:
164
    :vartype UserName: 1
165
    :ivar Certificate:
166
    :vartype Certificate: 2
167
    :ivar IssuedToken:
168
    :vartype IssuedToken: 3
169
    :ivar Kerberos:
170
    :vartype Kerberos: 4
171
    '''
172 1
    Anonymous = 0
173 1
    UserName = 1
174 1
    Certificate = 2
175 1
    IssuedToken = 3
176 1
    Kerberos = 4
177
178
179 1
class SecurityTokenRequestType(object):
180
    '''
181
    Indicates whether a token if being created or renewed.
182
183
    :ivar Issue:
184
    :vartype Issue: 0
185
    :ivar Renew:
186
    :vartype Renew: 1
187
    '''
188 1
    Issue = 0
189 1
    Renew = 1
190
191
192 1
class NodeAttributesMask(object):
193
    '''
194
    The bits used to specify default attributes for a new node.
195
196
    :ivar None_:
197
    :vartype None_: 0
198
    :ivar AccessLevel:
199
    :vartype AccessLevel: 1
200
    :ivar ArrayDimensions:
201
    :vartype ArrayDimensions: 2
202
    :ivar BrowseName:
203
    :vartype BrowseName: 4
204
    :ivar ContainsNoLoops:
205
    :vartype ContainsNoLoops: 8
206
    :ivar DataType:
207
    :vartype DataType: 16
208
    :ivar Description:
209
    :vartype Description: 32
210
    :ivar DisplayName:
211
    :vartype DisplayName: 64
212
    :ivar EventNotifier:
213
    :vartype EventNotifier: 128
214
    :ivar Executable:
215
    :vartype Executable: 256
216
    :ivar Historizing:
217
    :vartype Historizing: 512
218
    :ivar InverseName:
219
    :vartype InverseName: 1024
220
    :ivar IsAbstract:
221
    :vartype IsAbstract: 2048
222
    :ivar MinimumSamplingInterval:
223
    :vartype MinimumSamplingInterval: 4096
224
    :ivar NodeClass:
225
    :vartype NodeClass: 8192
226
    :ivar NodeId:
227
    :vartype NodeId: 16384
228
    :ivar Symmetric:
229
    :vartype Symmetric: 32768
230
    :ivar UserAccessLevel:
231
    :vartype UserAccessLevel: 65536
232
    :ivar UserExecutable:
233
    :vartype UserExecutable: 131072
234
    :ivar UserWriteMask:
235
    :vartype UserWriteMask: 262144
236
    :ivar ValueRank:
237
    :vartype ValueRank: 524288
238
    :ivar WriteMask:
239
    :vartype WriteMask: 1048576
240
    :ivar Value:
241
    :vartype Value: 2097152
242
    :ivar All:
243
    :vartype All: 4194303
244
    :ivar BaseNode:
245
    :vartype BaseNode: 1335396
246
    :ivar Object:
247
    :vartype Object: 1335524
248
    :ivar ObjectTypeOrDataType:
249
    :vartype ObjectTypeOrDataType: 1337444
250
    :ivar Variable:
251
    :vartype Variable: 4026999
252
    :ivar VariableType:
253
    :vartype VariableType: 3958902
254
    :ivar Method:
255
    :vartype Method: 1466724
256
    :ivar ReferenceType:
257
    :vartype ReferenceType: 1371236
258
    :ivar View:
259
    :vartype View: 1335532
260
    '''
261 1
    None_ = 0
262 1
    AccessLevel = 1
263 1
    ArrayDimensions = 2
264 1
    BrowseName = 4
265 1
    ContainsNoLoops = 8
266 1
    DataType = 16
267 1
    Description = 32
268 1
    DisplayName = 64
269 1
    EventNotifier = 128
270 1
    Executable = 256
271 1
    Historizing = 512
272 1
    InverseName = 1024
273 1
    IsAbstract = 2048
274 1
    MinimumSamplingInterval = 4096
275 1
    NodeClass = 8192
276 1
    NodeId = 16384
277 1
    Symmetric = 32768
278 1
    UserAccessLevel = 65536
279 1
    UserExecutable = 131072
280 1
    UserWriteMask = 262144
281 1
    ValueRank = 524288
282 1
    WriteMask = 1048576
283 1
    Value = 2097152
284 1
    All = 4194303
285 1
    BaseNode = 1335396
286 1
    Object = 1335524
287 1
    ObjectTypeOrDataType = 1337444
288 1
    Variable = 4026999
289 1
    VariableType = 3958902
290 1
    Method = 1466724
291 1
    ReferenceType = 1371236
292 1
    View = 1335532
293
294
295 1
class AttributeWriteMask(object):
296
    '''
297
    Define bits used to indicate which attributes are writable.
298
299
    :ivar None_:
300
    :vartype None_: 0
301
    :ivar AccessLevel:
302
    :vartype AccessLevel: 1
303
    :ivar ArrayDimensions:
304
    :vartype ArrayDimensions: 2
305
    :ivar BrowseName:
306
    :vartype BrowseName: 4
307
    :ivar ContainsNoLoops:
308
    :vartype ContainsNoLoops: 8
309
    :ivar DataType:
310
    :vartype DataType: 16
311
    :ivar Description:
312
    :vartype Description: 32
313
    :ivar DisplayName:
314
    :vartype DisplayName: 64
315
    :ivar EventNotifier:
316
    :vartype EventNotifier: 128
317
    :ivar Executable:
318
    :vartype Executable: 256
319
    :ivar Historizing:
320
    :vartype Historizing: 512
321
    :ivar InverseName:
322
    :vartype InverseName: 1024
323
    :ivar IsAbstract:
324
    :vartype IsAbstract: 2048
325
    :ivar MinimumSamplingInterval:
326
    :vartype MinimumSamplingInterval: 4096
327
    :ivar NodeClass:
328
    :vartype NodeClass: 8192
329
    :ivar NodeId:
330
    :vartype NodeId: 16384
331
    :ivar Symmetric:
332
    :vartype Symmetric: 32768
333
    :ivar UserAccessLevel:
334
    :vartype UserAccessLevel: 65536
335
    :ivar UserExecutable:
336
    :vartype UserExecutable: 131072
337
    :ivar UserWriteMask:
338
    :vartype UserWriteMask: 262144
339
    :ivar ValueRank:
340
    :vartype ValueRank: 524288
341
    :ivar WriteMask:
342
    :vartype WriteMask: 1048576
343
    :ivar ValueForVariableType:
344
    :vartype ValueForVariableType: 2097152
345
    '''
346 1
    None_ = 0
347 1
    AccessLevel = 1
348 1
    ArrayDimensions = 2
349 1
    BrowseName = 4
350 1
    ContainsNoLoops = 8
351 1
    DataType = 16
352 1
    Description = 32
353 1
    DisplayName = 64
354 1
    EventNotifier = 128
355 1
    Executable = 256
356 1
    Historizing = 512
357 1
    InverseName = 1024
358 1
    IsAbstract = 2048
359 1
    MinimumSamplingInterval = 4096
360 1
    NodeClass = 8192
361 1
    NodeId = 16384
362 1
    Symmetric = 32768
363 1
    UserAccessLevel = 65536
364 1
    UserExecutable = 131072
365 1
    UserWriteMask = 262144
366 1
    ValueRank = 524288
367 1
    WriteMask = 1048576
368 1
    ValueForVariableType = 2097152
369
370
371 1
class BrowseDirection(object):
372
    '''
373
    The directions of the references to return.
374
375
    :ivar Forward:
376
    :vartype Forward: 0
377
    :ivar Inverse:
378
    :vartype Inverse: 1
379
    :ivar Both:
380
    :vartype Both: 2
381
    '''
382 1
    Forward = 0
383 1
    Inverse = 1
384 1
    Both = 2
385
386
387 1
class BrowseResultMask(object):
388
    '''
389
    A bit mask which specifies what should be returned in a browse response.
390
391
    :ivar None_:
392
    :vartype None_: 0
393
    :ivar ReferenceTypeId:
394
    :vartype ReferenceTypeId: 1
395
    :ivar IsForward:
396
    :vartype IsForward: 2
397
    :ivar NodeClass:
398
    :vartype NodeClass: 4
399
    :ivar BrowseName:
400
    :vartype BrowseName: 8
401
    :ivar DisplayName:
402
    :vartype DisplayName: 16
403
    :ivar TypeDefinition:
404
    :vartype TypeDefinition: 32
405
    :ivar All:
406
    :vartype All: 63
407
    :ivar ReferenceTypeInfo:
408
    :vartype ReferenceTypeInfo: 3
409
    :ivar TargetInfo:
410
    :vartype TargetInfo: 60
411
    '''
412 1
    None_ = 0
413 1
    ReferenceTypeId = 1
414 1
    IsForward = 2
415 1
    NodeClass = 4
416 1
    BrowseName = 8
417 1
    DisplayName = 16
418 1
    TypeDefinition = 32
419 1
    All = 63
420 1
    ReferenceTypeInfo = 3
421 1
    TargetInfo = 60
422
423
424 1
class ComplianceLevel(object):
425
    '''
426
    :ivar Untested:
427
    :vartype Untested: 0
428
    :ivar Partial:
429
    :vartype Partial: 1
430
    :ivar SelfTested:
431
    :vartype SelfTested: 2
432
    :ivar Certified:
433
    :vartype Certified: 3
434
    '''
435 1
    Untested = 0
436 1
    Partial = 1
437 1
    SelfTested = 2
438 1
    Certified = 3
439
440
441 1
class FilterOperator(object):
442
    '''
443
    :ivar Equals:
444
    :vartype Equals: 0
445
    :ivar IsNull:
446
    :vartype IsNull: 1
447
    :ivar GreaterThan:
448
    :vartype GreaterThan: 2
449
    :ivar LessThan:
450
    :vartype LessThan: 3
451
    :ivar GreaterThanOrEqual:
452
    :vartype GreaterThanOrEqual: 4
453
    :ivar LessThanOrEqual:
454
    :vartype LessThanOrEqual: 5
455
    :ivar Like:
456
    :vartype Like: 6
457
    :ivar Not:
458
    :vartype Not: 7
459
    :ivar Between:
460
    :vartype Between: 8
461
    :ivar InList:
462
    :vartype InList: 9
463
    :ivar And:
464
    :vartype And: 10
465
    :ivar Or:
466
    :vartype Or: 11
467
    :ivar Cast:
468
    :vartype Cast: 12
469
    :ivar InView:
470
    :vartype InView: 13
471
    :ivar OfType:
472
    :vartype OfType: 14
473
    :ivar RelatedTo:
474
    :vartype RelatedTo: 15
475
    :ivar BitwiseAnd:
476
    :vartype BitwiseAnd: 16
477
    :ivar BitwiseOr:
478
    :vartype BitwiseOr: 17
479
    '''
480 1
    Equals = 0
481 1
    IsNull = 1
482 1
    GreaterThan = 2
483 1
    LessThan = 3
484 1
    GreaterThanOrEqual = 4
485 1
    LessThanOrEqual = 5
486 1
    Like = 6
487 1
    Not = 7
488 1
    Between = 8
489 1
    InList = 9
490 1
    And = 10
491 1
    Or = 11
492 1
    Cast = 12
493 1
    InView = 13
494 1
    OfType = 14
495 1
    RelatedTo = 15
496 1
    BitwiseAnd = 16
497 1
    BitwiseOr = 17
498
499
500 1
class TimestampsToReturn(object):
501
    '''
502
    :ivar Source:
503
    :vartype Source: 0
504
    :ivar Server:
505
    :vartype Server: 1
506
    :ivar Both:
507
    :vartype Both: 2
508
    :ivar Neither:
509
    :vartype Neither: 3
510
    '''
511 1
    Source = 0
512 1
    Server = 1
513 1
    Both = 2
514 1
    Neither = 3
515
516
517 1
class HistoryUpdateType(object):
518
    '''
519
    :ivar Insert:
520
    :vartype Insert: 1
521
    :ivar Replace:
522
    :vartype Replace: 2
523
    :ivar Update:
524
    :vartype Update: 3
525
    :ivar Delete:
526
    :vartype Delete: 4
527
    '''
528 1
    Insert = 1
529 1
    Replace = 2
530 1
    Update = 3
531 1
    Delete = 4
532
533
534 1
class PerformUpdateType(object):
535
    '''
536
    :ivar Insert:
537
    :vartype Insert: 1
538
    :ivar Replace:
539
    :vartype Replace: 2
540
    :ivar Update:
541
    :vartype Update: 3
542
    :ivar Remove:
543
    :vartype Remove: 4
544
    '''
545 1
    Insert = 1
546 1
    Replace = 2
547 1
    Update = 3
548 1
    Remove = 4
549
550
551 1
class MonitoringMode(object):
552
    '''
553
    :ivar Disabled:
554
    :vartype Disabled: 0
555
    :ivar Sampling:
556
    :vartype Sampling: 1
557
    :ivar Reporting:
558
    :vartype Reporting: 2
559
    '''
560 1
    Disabled = 0
561 1
    Sampling = 1
562 1
    Reporting = 2
563
564
565 1
class DataChangeTrigger(object):
566
    '''
567
    :ivar Status:
568
    :vartype Status: 0
569
    :ivar StatusValue:
570
    :vartype StatusValue: 1
571
    :ivar StatusValueTimestamp:
572
    :vartype StatusValueTimestamp: 2
573
    '''
574 1
    Status = 0
575 1
    StatusValue = 1
576 1
    StatusValueTimestamp = 2
577
578
579 1
class DeadbandType(object):
580
    '''
581
    :ivar None_:
582
    :vartype None_: 0
583
    :ivar Absolute:
584
    :vartype Absolute: 1
585
    :ivar Percent:
586
    :vartype Percent: 2
587
    '''
588 1
    None_ = 0
589 1
    Absolute = 1
590 1
    Percent = 2
591
592
593 1
class EnumeratedTestType(object):
594
    '''
595
    A simple enumerated type used for testing.
596
597
    :ivar Red:
598
    :vartype Red: 1
599
    :ivar Yellow:
600
    :vartype Yellow: 4
601
    :ivar Green:
602
    :vartype Green: 5
603
    '''
604 1
    Red = 1
605 1
    Yellow = 4
606 1
    Green = 5
607
608
609 1
class RedundancySupport(object):
610
    '''
611
    :ivar None_:
612
    :vartype None_: 0
613
    :ivar Cold:
614
    :vartype Cold: 1
615
    :ivar Warm:
616
    :vartype Warm: 2
617
    :ivar Hot:
618
    :vartype Hot: 3
619
    :ivar Transparent:
620
    :vartype Transparent: 4
621
    :ivar HotAndMirrored:
622
    :vartype HotAndMirrored: 5
623
    '''
624 1
    None_ = 0
625 1
    Cold = 1
626 1
    Warm = 2
627 1
    Hot = 3
628 1
    Transparent = 4
629 1
    HotAndMirrored = 5
630
631
632 1
class ServerState(object):
633
    '''
634
    :ivar Running:
635
    :vartype Running: 0
636
    :ivar Failed:
637
    :vartype Failed: 1
638
    :ivar NoConfiguration:
639
    :vartype NoConfiguration: 2
640
    :ivar Suspended:
641
    :vartype Suspended: 3
642
    :ivar Shutdown:
643
    :vartype Shutdown: 4
644
    :ivar Test:
645
    :vartype Test: 5
646
    :ivar CommunicationFault:
647
    :vartype CommunicationFault: 6
648
    :ivar Unknown:
649
    :vartype Unknown: 7
650
    '''
651 1
    Running = 0
652 1
    Failed = 1
653 1
    NoConfiguration = 2
654 1
    Suspended = 3
655 1
    Shutdown = 4
656 1
    Test = 5
657 1
    CommunicationFault = 6
658 1
    Unknown = 7
659
660
661 1
class ModelChangeStructureVerbMask(object):
662
    '''
663
    :ivar NodeAdded:
664
    :vartype NodeAdded: 1
665
    :ivar NodeDeleted:
666
    :vartype NodeDeleted: 2
667
    :ivar ReferenceAdded:
668
    :vartype ReferenceAdded: 4
669
    :ivar ReferenceDeleted:
670
    :vartype ReferenceDeleted: 8
671
    :ivar DataTypeChanged:
672
    :vartype DataTypeChanged: 16
673
    '''
674 1
    NodeAdded = 1
675 1
    NodeDeleted = 2
676 1
    ReferenceAdded = 4
677 1
    ReferenceDeleted = 8
678 1
    DataTypeChanged = 16
679
680
681 1
class AxisScaleEnumeration(object):
682
    '''
683
    :ivar Linear:
684
    :vartype Linear: 0
685
    :ivar Log:
686
    :vartype Log: 1
687
    :ivar Ln:
688
    :vartype Ln: 2
689
    '''
690 1
    Linear = 0
691 1
    Log = 1
692 1
    Ln = 2
693
694
695 1
class ExceptionDeviationFormat(object):
696
    '''
697
    :ivar AbsoluteValue:
698
    :vartype AbsoluteValue: 0
699
    :ivar PercentOfValue:
700
    :vartype PercentOfValue: 1
701
    :ivar PercentOfRange:
702
    :vartype PercentOfRange: 2
703
    :ivar PercentOfEURange:
704
    :vartype PercentOfEURange: 3
705
    :ivar Unknown:
706
    :vartype Unknown: 4
707
    '''
708 1
    AbsoluteValue = 0
709 1
    PercentOfValue = 1
710 1
    PercentOfRange = 2
711 1
    PercentOfEURange = 3
712 1
    Unknown = 4
713
714
715 1
class XmlElement(FrozenClass):
716
    '''
717
    An XML element encoded as a UTF-8 string.
718
719
    :ivar Length:
720
    :vartype Length: Int32
721
    :ivar Value:
722
    :vartype Value: Char
723
    '''
724 1
    def __init__(self, binary=None):
725
        if binary is not None:
726
            self._binary_init(binary)
727
            self._freeze()
728
            return
729
        self.Length = 0
730
        self.Value = []
731
        self._freeze()
732
733 1
    def to_binary(self):
734
        packet = []
735
        packet.append(uatype_Int32.pack(self.Length))
736
        packet.append(uatype_Int32.pack(len(self.Value)))
737
        for fieldname in self.Value:
738
            packet.append(uatype_Char.pack(fieldname))
739
        return b''.join(packet)
740
741 1
    @staticmethod
742
    def from_binary(data):
743
        return XmlElement(data)
744
745 1
    def _binary_init(self, data):
746
        self.Length = uatype_Int32.unpack(data.read(4))[0]
747
        self.Value = unpack_uatype_array('Char', data)
748
749 1
    def __str__(self):
750
        return 'XmlElement(' + 'Length:' + str(self.Length) + ', ' + \
751
               'Value:' + str(self.Value) + ')'
752
753 1
    __repr__ = __str__
754
755
756 1
class DiagnosticInfo(FrozenClass):
757
    '''
758
    A recursive structure containing diagnostic information associated with a status code.
759
760
    :ivar Encoding:
761
    :vartype Encoding: UInt8
762
    :ivar SymbolicId:
763
    :vartype SymbolicId: Int32
764
    :ivar NamespaceURI:
765
    :vartype NamespaceURI: Int32
766
    :ivar Locale:
767
    :vartype Locale: Int32
768
    :ivar LocalizedText:
769
    :vartype LocalizedText: Int32
770
    :ivar AdditionalInfo:
771
    :vartype AdditionalInfo: CharArray
772
    :ivar InnerStatusCode:
773
    :vartype InnerStatusCode: StatusCode
774
    :ivar InnerDiagnosticInfo:
775
    :vartype InnerDiagnosticInfo: DiagnosticInfo
776
    '''
777 1
    def __init__(self, binary=None):
778 1
        if binary is not None:
779 1
            self._binary_init(binary)
780 1
            self._freeze()
781 1
            return
782 1
        self.Encoding = 0
783 1
        self.SymbolicId = 0
784 1
        self.NamespaceURI = 0
785 1
        self.Locale = 0
786 1
        self.LocalizedText = 0
787 1
        self.AdditionalInfo = b''
788 1
        self.InnerStatusCode = StatusCode()
789 1
        self.InnerDiagnosticInfo = None
790 1
        self._freeze()
791
792 1
    def to_binary(self):
793 1
        packet = []
794 1
        if self.SymbolicId: self.Encoding |= (1 << 0)
795 1
        if self.NamespaceURI: self.Encoding |= (1 << 1)
796 1
        if self.Locale: self.Encoding |= (1 << 2)
797 1
        if self.LocalizedText: self.Encoding |= (1 << 3)
798 1
        if self.AdditionalInfo: self.Encoding |= (1 << 4)
799 1
        if self.InnerStatusCode: self.Encoding |= (1 << 5)
800 1
        if self.InnerDiagnosticInfo: self.Encoding |= (1 << 6)
801 1
        packet.append(uatype_UInt8.pack(self.Encoding))
802 1
        if self.SymbolicId: 
803
            packet.append(uatype_Int32.pack(self.SymbolicId))
804 1
        if self.NamespaceURI: 
805
            packet.append(uatype_Int32.pack(self.NamespaceURI))
806 1
        if self.Locale: 
807
            packet.append(uatype_Int32.pack(self.Locale))
808 1
        if self.LocalizedText: 
809
            packet.append(uatype_Int32.pack(self.LocalizedText))
810 1
        if self.AdditionalInfo: 
811
            packet.append(pack_bytes(self.AdditionalInfo))
812 1
        if self.InnerStatusCode: 
813 1
            packet.append(self.InnerStatusCode.to_binary())
814 1
        if self.InnerDiagnosticInfo: 
815
            packet.append(self.InnerDiagnosticInfo.to_binary())
816 1
        return b''.join(packet)
817
818 1
    @staticmethod
819
    def from_binary(data):
820 1
        return DiagnosticInfo(data)
821
822 1
    def _binary_init(self, data):
823 1
        self.Encoding = uatype_UInt8.unpack(data.read(1))[0]
824 1
        if self.Encoding & (1 << 0):
825
            self.SymbolicId = uatype_Int32.unpack(data.read(4))[0]
826
        else:
827 1
            self.SymbolicId = 0
828 1
        if self.Encoding & (1 << 1):
829
            self.NamespaceURI = uatype_Int32.unpack(data.read(4))[0]
830
        else:
831 1
            self.NamespaceURI = 0
832 1
        if self.Encoding & (1 << 2):
833
            self.Locale = uatype_Int32.unpack(data.read(4))[0]
834
        else:
835 1
            self.Locale = 0
836 1
        if self.Encoding & (1 << 3):
837
            self.LocalizedText = uatype_Int32.unpack(data.read(4))[0]
838
        else:
839 1
            self.LocalizedText = 0
840 1
        if self.Encoding & (1 << 4):
841
            self.AdditionalInfo = unpack_bytes(data)
842
        else:
843 1
            self.AdditionalInfo = b''
844 1
        if self.Encoding & (1 << 5):
845 1
            self.InnerStatusCode = StatusCode.from_binary(data)
846
        else:
847
            self.InnerStatusCode = StatusCode()
848 1
        if self.Encoding & (1 << 6):
849
            self.InnerDiagnosticInfo = DiagnosticInfo.from_binary(data)
850
        else:
851 1
            self.InnerDiagnosticInfo = None
852
853 1
    def __str__(self):
854
        return 'DiagnosticInfo(' + 'Encoding:' + str(self.Encoding) + ', ' + \
855
               'SymbolicId:' + str(self.SymbolicId) + ', ' + \
856
               'NamespaceURI:' + str(self.NamespaceURI) + ', ' + \
857
               'Locale:' + str(self.Locale) + ', ' + \
858
               'LocalizedText:' + str(self.LocalizedText) + ', ' + \
859
               'AdditionalInfo:' + str(self.AdditionalInfo) + ', ' + \
860
               'InnerStatusCode:' + str(self.InnerStatusCode) + ', ' + \
861
               'InnerDiagnosticInfo:' + str(self.InnerDiagnosticInfo) + ')'
862
863 1
    __repr__ = __str__
864
865
866 1
class TrustListDataType(FrozenClass):
867
    '''
868
    :ivar SpecifiedLists:
869
    :vartype SpecifiedLists: UInt32
870
    :ivar TrustedCertificates:
871
    :vartype TrustedCertificates: ByteString
872
    :ivar TrustedCrls:
873
    :vartype TrustedCrls: ByteString
874
    :ivar IssuerCertificates:
875
    :vartype IssuerCertificates: ByteString
876
    :ivar IssuerCrls:
877
    :vartype IssuerCrls: ByteString
878
    '''
879 1
    def __init__(self, binary=None):
880
        if binary is not None:
881
            self._binary_init(binary)
882
            self._freeze()
883
            return
884
        self.SpecifiedLists = 0
885
        self.TrustedCertificates = []
886
        self.TrustedCrls = []
887
        self.IssuerCertificates = []
888
        self.IssuerCrls = []
889
        self._freeze()
890
891 1
    def to_binary(self):
892
        packet = []
893
        packet.append(uatype_UInt32.pack(self.SpecifiedLists))
894
        packet.append(uatype_Int32.pack(len(self.TrustedCertificates)))
895
        for fieldname in self.TrustedCertificates:
896
            packet.append(pack_bytes(fieldname))
897
        packet.append(uatype_Int32.pack(len(self.TrustedCrls)))
898
        for fieldname in self.TrustedCrls:
899
            packet.append(pack_bytes(fieldname))
900
        packet.append(uatype_Int32.pack(len(self.IssuerCertificates)))
901
        for fieldname in self.IssuerCertificates:
902
            packet.append(pack_bytes(fieldname))
903
        packet.append(uatype_Int32.pack(len(self.IssuerCrls)))
904
        for fieldname in self.IssuerCrls:
905
            packet.append(pack_bytes(fieldname))
906
        return b''.join(packet)
907
908 1
    @staticmethod
909
    def from_binary(data):
910
        return TrustListDataType(data)
911
912 1
    def _binary_init(self, data):
913
        self.SpecifiedLists = uatype_UInt32.unpack(data.read(4))[0]
914
        self.TrustedCertificates = unpack_uatype_array('ByteString', data)
915
        self.TrustedCrls = unpack_uatype_array('ByteString', data)
916
        self.IssuerCertificates = unpack_uatype_array('ByteString', data)
917
        self.IssuerCrls = unpack_uatype_array('ByteString', data)
918
919 1
    def __str__(self):
920
        return 'TrustListDataType(' + 'SpecifiedLists:' + str(self.SpecifiedLists) + ', ' + \
921
               'TrustedCertificates:' + str(self.TrustedCertificates) + ', ' + \
922
               'TrustedCrls:' + str(self.TrustedCrls) + ', ' + \
923
               'IssuerCertificates:' + str(self.IssuerCertificates) + ', ' + \
924
               'IssuerCrls:' + str(self.IssuerCrls) + ')'
925
926 1
    __repr__ = __str__
927
928
929 1
class Argument(FrozenClass):
930
    '''
931
    An argument for a method.
932
933
    :ivar Name:
934
    :vartype Name: String
935
    :ivar DataType:
936
    :vartype DataType: NodeId
937
    :ivar ValueRank:
938
    :vartype ValueRank: Int32
939
    :ivar ArrayDimensions:
940
    :vartype ArrayDimensions: UInt32
941
    :ivar Description:
942
    :vartype Description: LocalizedText
943
    '''
944 1
    def __init__(self, binary=None):
945 1
        if binary is not None:
946
            self._binary_init(binary)
947
            self._freeze()
948
            return
949 1
        self.Name = ''
950 1
        self.DataType = NodeId()
951 1
        self.ValueRank = 0
952 1
        self.ArrayDimensions = []
953 1
        self.Description = LocalizedText()
954 1
        self._freeze()
955
956 1
    def to_binary(self):
957
        packet = []
958
        packet.append(pack_string(self.Name))
959
        packet.append(self.DataType.to_binary())
960
        packet.append(uatype_Int32.pack(self.ValueRank))
961
        packet.append(uatype_Int32.pack(len(self.ArrayDimensions)))
962
        for fieldname in self.ArrayDimensions:
963
            packet.append(uatype_UInt32.pack(fieldname))
964
        packet.append(self.Description.to_binary())
965
        return b''.join(packet)
966
967 1
    @staticmethod
968
    def from_binary(data):
969
        return Argument(data)
970
971 1
    def _binary_init(self, data):
972
        self.Name = unpack_string(data)
973
        self.DataType = NodeId.from_binary(data)
974
        self.ValueRank = uatype_Int32.unpack(data.read(4))[0]
975
        self.ArrayDimensions = unpack_uatype_array('UInt32', data)
976
        self.Description = LocalizedText.from_binary(data)
977
978 1
    def __str__(self):
979
        return 'Argument(' + 'Name:' + str(self.Name) + ', ' + \
980
               'DataType:' + str(self.DataType) + ', ' + \
981
               'ValueRank:' + str(self.ValueRank) + ', ' + \
982
               'ArrayDimensions:' + str(self.ArrayDimensions) + ', ' + \
983
               'Description:' + str(self.Description) + ')'
984
985 1
    __repr__ = __str__
986
987
988 1
class EnumValueType(FrozenClass):
989
    '''
990
    A mapping between a value of an enumerated type and a name and description.
991
992
    :ivar Value:
993
    :vartype Value: Int64
994
    :ivar DisplayName:
995
    :vartype DisplayName: LocalizedText
996
    :ivar Description:
997
    :vartype Description: LocalizedText
998
    '''
999 1
    def __init__(self, binary=None):
1000
        if binary is not None:
1001
            self._binary_init(binary)
1002
            self._freeze()
1003
            return
1004
        self.Value = 0
1005
        self.DisplayName = LocalizedText()
1006
        self.Description = LocalizedText()
1007
        self._freeze()
1008
1009 1
    def to_binary(self):
1010
        packet = []
1011
        packet.append(uatype_Int64.pack(self.Value))
1012
        packet.append(self.DisplayName.to_binary())
1013
        packet.append(self.Description.to_binary())
1014
        return b''.join(packet)
1015
1016 1
    @staticmethod
1017
    def from_binary(data):
1018
        return EnumValueType(data)
1019
1020 1
    def _binary_init(self, data):
1021
        self.Value = uatype_Int64.unpack(data.read(8))[0]
1022
        self.DisplayName = LocalizedText.from_binary(data)
1023
        self.Description = LocalizedText.from_binary(data)
1024
1025 1
    def __str__(self):
1026
        return 'EnumValueType(' + 'Value:' + str(self.Value) + ', ' + \
1027
               'DisplayName:' + str(self.DisplayName) + ', ' + \
1028
               'Description:' + str(self.Description) + ')'
1029
1030 1
    __repr__ = __str__
1031
1032
1033 1
class OptionSet(FrozenClass):
1034
    '''
1035
    This abstract Structured DataType is the base DataType for all DataTypes representing a bit mask.
1036
1037
    :ivar Value:
1038
    :vartype Value: ByteString
1039
    :ivar ValidBits:
1040
    :vartype ValidBits: ByteString
1041
    '''
1042 1
    def __init__(self, binary=None):
1043
        if binary is not None:
1044
            self._binary_init(binary)
1045
            self._freeze()
1046
            return
1047
        self.Value = b''
1048
        self.ValidBits = b''
1049
        self._freeze()
1050
1051 1
    def to_binary(self):
1052
        packet = []
1053
        packet.append(pack_bytes(self.Value))
1054
        packet.append(pack_bytes(self.ValidBits))
1055
        return b''.join(packet)
1056
1057 1
    @staticmethod
1058
    def from_binary(data):
1059
        return OptionSet(data)
1060
1061 1
    def _binary_init(self, data):
1062
        self.Value = unpack_bytes(data)
1063
        self.ValidBits = unpack_bytes(data)
1064
1065 1
    def __str__(self):
1066
        return 'OptionSet(' + 'Value:' + str(self.Value) + ', ' + \
1067
               'ValidBits:' + str(self.ValidBits) + ')'
1068
1069 1
    __repr__ = __str__
1070
1071
1072 1
class Union(FrozenClass):
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
1073
    '''
1074
    This abstract DataType is the base DataType for all union DataTypes.
1075
1076
    '''
1077 1
    def __init__(self, binary=None):
1078
        if binary is not None:
1079
            self._binary_init(binary)
1080
            self._freeze()
1081
            return
1082
        self._freeze()
1083
1084 1
    def to_binary(self):
1085
        packet = []
1086
        return b''.join(packet)
1087
1088 1
    @staticmethod
1089
    def from_binary(data):
1090
        return Union(data)
1091
1092 1
    def _binary_init(self, data):
1093
        pass
1094
1095 1
    def __str__(self):
1096
        return 'Union(' +  + ')'
1097
1098 1
    __repr__ = __str__
1099
1100
1101 1
class TimeZoneDataType(FrozenClass):
1102
    '''
1103
    :ivar Offset:
1104
    :vartype Offset: Int16
1105
    :ivar DaylightSavingInOffset:
1106
    :vartype DaylightSavingInOffset: Boolean
1107
    '''
1108 1
    def __init__(self, binary=None):
1109
        if binary is not None:
1110
            self._binary_init(binary)
1111
            self._freeze()
1112
            return
1113
        self.Offset = 0
1114
        self.DaylightSavingInOffset = True
1115
        self._freeze()
1116
1117 1
    def to_binary(self):
1118
        packet = []
1119
        packet.append(uatype_Int16.pack(self.Offset))
1120
        packet.append(uatype_Boolean.pack(self.DaylightSavingInOffset))
1121
        return b''.join(packet)
1122
1123 1
    @staticmethod
1124
    def from_binary(data):
1125
        return TimeZoneDataType(data)
1126
1127 1
    def _binary_init(self, data):
1128
        self.Offset = uatype_Int16.unpack(data.read(2))[0]
1129
        self.DaylightSavingInOffset = uatype_Boolean.unpack(data.read(1))[0]
1130
1131 1
    def __str__(self):
1132
        return 'TimeZoneDataType(' + 'Offset:' + str(self.Offset) + ', ' + \
1133
               'DaylightSavingInOffset:' + str(self.DaylightSavingInOffset) + ')'
1134
1135 1
    __repr__ = __str__
1136
1137
1138 1
class ApplicationDescription(FrozenClass):
1139
    '''
1140
    Describes an application and how to find it.
1141
1142
    :ivar ApplicationUri:
1143
    :vartype ApplicationUri: String
1144
    :ivar ProductUri:
1145
    :vartype ProductUri: String
1146
    :ivar ApplicationName:
1147
    :vartype ApplicationName: LocalizedText
1148
    :ivar ApplicationType:
1149
    :vartype ApplicationType: ApplicationType
1150
    :ivar GatewayServerUri:
1151
    :vartype GatewayServerUri: String
1152
    :ivar DiscoveryProfileUri:
1153
    :vartype DiscoveryProfileUri: String
1154
    :ivar DiscoveryUrls:
1155
    :vartype DiscoveryUrls: String
1156
    '''
1157 1
    def __init__(self, binary=None):
1158 1
        if binary is not None:
1159 1
            self._binary_init(binary)
1160 1
            self._freeze()
1161 1
            return
1162 1
        self.ApplicationUri = ''
1163 1
        self.ProductUri = ''
1164 1
        self.ApplicationName = LocalizedText()
1165 1
        self.ApplicationType = 0
1166 1
        self.GatewayServerUri = ''
1167 1
        self.DiscoveryProfileUri = ''
1168 1
        self.DiscoveryUrls = []
1169 1
        self._freeze()
1170
1171 1
    def to_binary(self):
1172 1
        packet = []
1173 1
        packet.append(pack_string(self.ApplicationUri))
1174 1
        packet.append(pack_string(self.ProductUri))
1175 1
        packet.append(self.ApplicationName.to_binary())
1176 1
        packet.append(uatype_UInt32.pack(self.ApplicationType))
1177 1
        packet.append(pack_string(self.GatewayServerUri))
1178 1
        packet.append(pack_string(self.DiscoveryProfileUri))
1179 1
        packet.append(uatype_Int32.pack(len(self.DiscoveryUrls)))
1180 1
        for fieldname in self.DiscoveryUrls:
1181 1
            packet.append(pack_string(fieldname))
1182 1
        return b''.join(packet)
1183
1184 1
    @staticmethod
1185
    def from_binary(data):
1186 1
        return ApplicationDescription(data)
1187
1188 1
    def _binary_init(self, data):
1189 1
        self.ApplicationUri = unpack_string(data)
1190 1
        self.ProductUri = unpack_string(data)
1191 1
        self.ApplicationName = LocalizedText.from_binary(data)
1192 1
        self.ApplicationType = uatype_UInt32.unpack(data.read(4))[0]
1193 1
        self.GatewayServerUri = unpack_string(data)
1194 1
        self.DiscoveryProfileUri = unpack_string(data)
1195 1
        self.DiscoveryUrls = unpack_uatype_array('String', data)
1196
1197 1
    def __str__(self):
1198
        return 'ApplicationDescription(' + 'ApplicationUri:' + str(self.ApplicationUri) + ', ' + \
1199
               'ProductUri:' + str(self.ProductUri) + ', ' + \
1200
               'ApplicationName:' + str(self.ApplicationName) + ', ' + \
1201
               'ApplicationType:' + str(self.ApplicationType) + ', ' + \
1202
               'GatewayServerUri:' + str(self.GatewayServerUri) + ', ' + \
1203
               'DiscoveryProfileUri:' + str(self.DiscoveryProfileUri) + ', ' + \
1204
               'DiscoveryUrls:' + str(self.DiscoveryUrls) + ')'
1205
1206 1
    __repr__ = __str__
1207
1208
1209 1
class RequestHeader(FrozenClass):
1210
    '''
1211
    The header passed with every server request.
1212
1213
    :ivar AuthenticationToken:
1214
    :vartype AuthenticationToken: NodeId
1215
    :ivar Timestamp:
1216
    :vartype Timestamp: DateTime
1217
    :ivar RequestHandle:
1218
    :vartype RequestHandle: UInt32
1219
    :ivar ReturnDiagnostics:
1220
    :vartype ReturnDiagnostics: UInt32
1221
    :ivar AuditEntryId:
1222
    :vartype AuditEntryId: String
1223
    :ivar TimeoutHint:
1224
    :vartype TimeoutHint: UInt32
1225
    :ivar AdditionalHeader:
1226
    :vartype AdditionalHeader: ExtensionObject
1227
    '''
1228 1
    def __init__(self, binary=None):
1229 1
        if binary is not None:
1230 1
            self._binary_init(binary)
1231 1
            self._freeze()
1232 1
            return
1233 1
        self.AuthenticationToken = NodeId()
1234 1
        self.Timestamp = datetime.now()
1235 1
        self.RequestHandle = 0
1236 1
        self.ReturnDiagnostics = 0
1237 1
        self.AuditEntryId = ''
1238 1
        self.TimeoutHint = 0
1239 1
        self.AdditionalHeader = None
1240 1
        self._freeze()
1241
1242 1
    def to_binary(self):
1243 1
        packet = []
1244 1
        packet.append(self.AuthenticationToken.to_binary())
1245 1
        packet.append(pack_datetime(self.Timestamp))
1246 1
        packet.append(uatype_UInt32.pack(self.RequestHandle))
1247 1
        packet.append(uatype_UInt32.pack(self.ReturnDiagnostics))
1248 1
        packet.append(pack_string(self.AuditEntryId))
1249 1
        packet.append(uatype_UInt32.pack(self.TimeoutHint))
1250 1
        packet.append(extensionobject_to_binary(self.AdditionalHeader))
1251 1
        return b''.join(packet)
1252
1253 1
    @staticmethod
1254
    def from_binary(data):
1255 1
        return RequestHeader(data)
1256
1257 1
    def _binary_init(self, data):
1258 1
        self.AuthenticationToken = NodeId.from_binary(data)
1259 1
        self.Timestamp = unpack_datetime(data)
1260 1
        self.RequestHandle = uatype_UInt32.unpack(data.read(4))[0]
1261 1
        self.ReturnDiagnostics = uatype_UInt32.unpack(data.read(4))[0]
1262 1
        self.AuditEntryId = unpack_string(data)
1263 1
        self.TimeoutHint = uatype_UInt32.unpack(data.read(4))[0]
1264 1
        self.AdditionalHeader = extensionobject_from_binary(data)
1265
1266 1
    def __str__(self):
1267
        return 'RequestHeader(' + 'AuthenticationToken:' + str(self.AuthenticationToken) + ', ' + \
1268
               'Timestamp:' + str(self.Timestamp) + ', ' + \
1269
               'RequestHandle:' + str(self.RequestHandle) + ', ' + \
1270
               'ReturnDiagnostics:' + str(self.ReturnDiagnostics) + ', ' + \
1271
               'AuditEntryId:' + str(self.AuditEntryId) + ', ' + \
1272
               'TimeoutHint:' + str(self.TimeoutHint) + ', ' + \
1273
               'AdditionalHeader:' + str(self.AdditionalHeader) + ')'
1274
1275 1
    __repr__ = __str__
1276
1277
1278 1
class ResponseHeader(FrozenClass):
1279
    '''
1280
    The header passed with every server response.
1281
1282
    :ivar Timestamp:
1283
    :vartype Timestamp: DateTime
1284
    :ivar RequestHandle:
1285
    :vartype RequestHandle: UInt32
1286
    :ivar ServiceResult:
1287
    :vartype ServiceResult: StatusCode
1288
    :ivar ServiceDiagnostics:
1289
    :vartype ServiceDiagnostics: DiagnosticInfo
1290
    :ivar StringTable:
1291
    :vartype StringTable: String
1292
    :ivar AdditionalHeader:
1293
    :vartype AdditionalHeader: ExtensionObject
1294
    '''
1295 1
    def __init__(self, binary=None):
1296 1
        if binary is not None:
1297 1
            self._binary_init(binary)
1298 1
            self._freeze()
1299 1
            return
1300 1
        self.Timestamp = datetime.now()
1301 1
        self.RequestHandle = 0
1302 1
        self.ServiceResult = StatusCode()
1303 1
        self.ServiceDiagnostics = DiagnosticInfo()
1304 1
        self.StringTable = []
1305 1
        self.AdditionalHeader = None
1306 1
        self._freeze()
1307
1308 1
    def to_binary(self):
1309 1
        packet = []
1310 1
        packet.append(pack_datetime(self.Timestamp))
1311 1
        packet.append(uatype_UInt32.pack(self.RequestHandle))
1312 1
        packet.append(self.ServiceResult.to_binary())
1313 1
        packet.append(self.ServiceDiagnostics.to_binary())
1314 1
        packet.append(uatype_Int32.pack(len(self.StringTable)))
1315 1
        for fieldname in self.StringTable:
1316
            packet.append(pack_string(fieldname))
1317 1
        packet.append(extensionobject_to_binary(self.AdditionalHeader))
1318 1
        return b''.join(packet)
1319
1320 1
    @staticmethod
1321
    def from_binary(data):
1322 1
        return ResponseHeader(data)
1323
1324 1
    def _binary_init(self, data):
1325 1
        self.Timestamp = unpack_datetime(data)
1326 1
        self.RequestHandle = uatype_UInt32.unpack(data.read(4))[0]
1327 1
        self.ServiceResult = StatusCode.from_binary(data)
1328 1
        self.ServiceDiagnostics = DiagnosticInfo.from_binary(data)
1329 1
        self.StringTable = unpack_uatype_array('String', data)
1330 1
        self.AdditionalHeader = extensionobject_from_binary(data)
1331
1332 1
    def __str__(self):
1333
        return 'ResponseHeader(' + 'Timestamp:' + str(self.Timestamp) + ', ' + \
1334
               'RequestHandle:' + str(self.RequestHandle) + ', ' + \
1335
               'ServiceResult:' + str(self.ServiceResult) + ', ' + \
1336
               'ServiceDiagnostics:' + str(self.ServiceDiagnostics) + ', ' + \
1337
               'StringTable:' + str(self.StringTable) + ', ' + \
1338
               'AdditionalHeader:' + str(self.AdditionalHeader) + ')'
1339
1340 1
    __repr__ = __str__
1341
1342
1343 1
class ServiceFault(FrozenClass):
1344
    '''
1345
    The response returned by all services when there is a service level error.
1346
1347
    :ivar TypeId:
1348
    :vartype TypeId: NodeId
1349
    :ivar ResponseHeader:
1350
    :vartype ResponseHeader: ResponseHeader
1351
    '''
1352 1
    def __init__(self, binary=None):
1353
        if binary is not None:
1354
            self._binary_init(binary)
1355
            self._freeze()
1356
            return
1357
        self.TypeId = FourByteNodeId(ObjectIds.ServiceFault_Encoding_DefaultBinary)
1358
        self.ResponseHeader = ResponseHeader()
1359
        self._freeze()
1360
1361 1
    def to_binary(self):
1362
        packet = []
1363
        packet.append(self.TypeId.to_binary())
1364
        packet.append(self.ResponseHeader.to_binary())
1365
        return b''.join(packet)
1366
1367 1
    @staticmethod
1368
    def from_binary(data):
1369
        return ServiceFault(data)
1370
1371 1
    def _binary_init(self, data):
1372
        self.TypeId = NodeId.from_binary(data)
1373
        self.ResponseHeader = ResponseHeader.from_binary(data)
1374
1375 1
    def __str__(self):
1376
        return 'ServiceFault(' + 'TypeId:' + str(self.TypeId) + ', ' + \
1377
               'ResponseHeader:' + str(self.ResponseHeader) + ')'
1378
1379 1
    __repr__ = __str__
1380
1381
1382 1
class FindServersParameters(FrozenClass):
1383
    '''
1384
    :ivar EndpointUrl:
1385
    :vartype EndpointUrl: String
1386
    :ivar LocaleIds:
1387
    :vartype LocaleIds: String
1388
    :ivar ServerUris:
1389
    :vartype ServerUris: String
1390
    '''
1391 1
    def __init__(self, binary=None):
1392 1
        if binary is not None:
1393 1
            self._binary_init(binary)
1394 1
            self._freeze()
1395 1
            return
1396 1
        self.EndpointUrl = ''
1397 1
        self.LocaleIds = []
1398 1
        self.ServerUris = []
1399 1
        self._freeze()
1400
1401 1
    def to_binary(self):
1402 1
        packet = []
1403 1
        packet.append(pack_string(self.EndpointUrl))
1404 1
        packet.append(uatype_Int32.pack(len(self.LocaleIds)))
1405 1
        for fieldname in self.LocaleIds:
1406
            packet.append(pack_string(fieldname))
1407 1
        packet.append(uatype_Int32.pack(len(self.ServerUris)))
1408 1
        for fieldname in self.ServerUris:
1409 1
            packet.append(pack_string(fieldname))
1410 1
        return b''.join(packet)
1411
1412 1
    @staticmethod
1413
    def from_binary(data):
1414 1
        return FindServersParameters(data)
1415
1416 1
    def _binary_init(self, data):
1417 1
        self.EndpointUrl = unpack_string(data)
1418 1
        self.LocaleIds = unpack_uatype_array('String', data)
1419 1
        self.ServerUris = unpack_uatype_array('String', data)
1420
1421 1
    def __str__(self):
1422
        return 'FindServersParameters(' + 'EndpointUrl:' + str(self.EndpointUrl) + ', ' + \
1423
               'LocaleIds:' + str(self.LocaleIds) + ', ' + \
1424
               'ServerUris:' + str(self.ServerUris) + ')'
1425
1426 1
    __repr__ = __str__
1427
1428
1429 1
class FindServersRequest(FrozenClass):
1430
    '''
1431
    Finds the servers known to the discovery server.
1432
1433
    :ivar TypeId:
1434
    :vartype TypeId: NodeId
1435
    :ivar RequestHeader:
1436
    :vartype RequestHeader: RequestHeader
1437
    :ivar Parameters:
1438
    :vartype Parameters: FindServersParameters
1439
    '''
1440 1
    def __init__(self, binary=None):
1441 1
        if binary is not None:
1442
            self._binary_init(binary)
1443
            self._freeze()
1444
            return
1445 1
        self.TypeId = FourByteNodeId(ObjectIds.FindServersRequest_Encoding_DefaultBinary)
1446 1
        self.RequestHeader = RequestHeader()
1447 1
        self.Parameters = FindServersParameters()
1448 1
        self._freeze()
1449
1450 1
    def to_binary(self):
1451 1
        packet = []
1452 1
        packet.append(self.TypeId.to_binary())
1453 1
        packet.append(self.RequestHeader.to_binary())
1454 1
        packet.append(self.Parameters.to_binary())
1455 1
        return b''.join(packet)
1456
1457 1
    @staticmethod
1458
    def from_binary(data):
1459
        return FindServersRequest(data)
1460
1461 1
    def _binary_init(self, data):
1462
        self.TypeId = NodeId.from_binary(data)
1463
        self.RequestHeader = RequestHeader.from_binary(data)
1464
        self.Parameters = FindServersParameters.from_binary(data)
1465
1466 1
    def __str__(self):
1467
        return 'FindServersRequest(' + 'TypeId:' + str(self.TypeId) + ', ' + \
1468
               'RequestHeader:' + str(self.RequestHeader) + ', ' + \
1469
               'Parameters:' + str(self.Parameters) + ')'
1470
1471 1
    __repr__ = __str__
1472
1473
1474 1
class FindServersResponse(FrozenClass):
1475
    '''
1476
    Finds the servers known to the discovery server.
1477
1478
    :ivar TypeId:
1479
    :vartype TypeId: NodeId
1480
    :ivar ResponseHeader:
1481
    :vartype ResponseHeader: ResponseHeader
1482
    :ivar Servers:
1483
    :vartype Servers: ApplicationDescription
1484
    '''
1485 1
    def __init__(self, binary=None):
1486 1
        if binary is not None:
1487 1
            self._binary_init(binary)
1488 1
            self._freeze()
1489 1
            return
1490 1
        self.TypeId = FourByteNodeId(ObjectIds.FindServersResponse_Encoding_DefaultBinary)
1491 1
        self.ResponseHeader = ResponseHeader()
1492 1
        self.Servers = []
1493 1
        self._freeze()
1494
1495 1
    def to_binary(self):
1496 1
        packet = []
1497 1
        packet.append(self.TypeId.to_binary())
1498 1
        packet.append(self.ResponseHeader.to_binary())
1499 1
        packet.append(uatype_Int32.pack(len(self.Servers)))
1500 1
        for fieldname in self.Servers:
1501 1
            packet.append(fieldname.to_binary())
1502 1
        return b''.join(packet)
1503
1504 1
    @staticmethod
1505
    def from_binary(data):
1506 1
        return FindServersResponse(data)
1507
1508 1
    def _binary_init(self, data):
1509 1
        self.TypeId = NodeId.from_binary(data)
1510 1
        self.ResponseHeader = ResponseHeader.from_binary(data)
1511 1
        length = uatype_Int32.unpack(data.read(4))[0]
1512 1
        array = []
1513 1
        if length != -1:
1514 1
            for _ in range(0, length):
1515 1
                array.append(ApplicationDescription.from_binary(data))
1516 1
        self.Servers = array
1517
1518 1
    def __str__(self):
1519
        return 'FindServersResponse(' + 'TypeId:' + str(self.TypeId) + ', ' + \
1520
               'ResponseHeader:' + str(self.ResponseHeader) + ', ' + \
1521
               'Servers:' + str(self.Servers) + ')'
1522
1523 1
    __repr__ = __str__
1524
1525
1526 1
class ServerOnNetwork(FrozenClass):
1527
    '''
1528
    :ivar RecordId:
1529
    :vartype RecordId: UInt32
1530
    :ivar ServerName:
1531
    :vartype ServerName: String
1532
    :ivar DiscoveryUrl:
1533
    :vartype DiscoveryUrl: String
1534
    :ivar ServerCapabilities:
1535
    :vartype ServerCapabilities: String
1536
    '''
1537 1
    def __init__(self, binary=None):
1538
        if binary is not None:
1539
            self._binary_init(binary)
1540
            self._freeze()
1541
            return
1542
        self.RecordId = 0
1543
        self.ServerName = ''
1544
        self.DiscoveryUrl = ''
1545
        self.ServerCapabilities = []
1546
        self._freeze()
1547
1548 1
    def to_binary(self):
1549
        packet = []
1550
        packet.append(uatype_UInt32.pack(self.RecordId))
1551
        packet.append(pack_string(self.ServerName))
1552
        packet.append(pack_string(self.DiscoveryUrl))
1553
        packet.append(uatype_Int32.pack(len(self.ServerCapabilities)))
1554
        for fieldname in self.ServerCapabilities:
1555
            packet.append(pack_string(fieldname))
1556
        return b''.join(packet)
1557
1558 1
    @staticmethod
1559
    def from_binary(data):
1560
        return ServerOnNetwork(data)
1561
1562 1
    def _binary_init(self, data):
1563
        self.RecordId = uatype_UInt32.unpack(data.read(4))[0]
1564
        self.ServerName = unpack_string(data)
1565
        self.DiscoveryUrl = unpack_string(data)
1566
        self.ServerCapabilities = unpack_uatype_array('String', data)
1567
1568 1
    def __str__(self):
1569
        return 'ServerOnNetwork(' + 'RecordId:' + str(self.RecordId) + ', ' + \
1570
               'ServerName:' + str(self.ServerName) + ', ' + \
1571
               'DiscoveryUrl:' + str(self.DiscoveryUrl) + ', ' + \
1572
               'ServerCapabilities:' + str(self.ServerCapabilities) + ')'
1573
1574 1
    __repr__ = __str__
1575
1576
1577 1
class FindServersOnNetworkParameters(FrozenClass):
1578
    '''
1579
    :ivar StartingRecordId:
1580
    :vartype StartingRecordId: UInt32
1581
    :ivar MaxRecordsToReturn:
1582
    :vartype MaxRecordsToReturn: UInt32
1583
    :ivar ServerCapabilityFilter:
1584
    :vartype ServerCapabilityFilter: String
1585
    '''
1586 1
    def __init__(self, binary=None):
1587
        if binary is not None:
1588
            self._binary_init(binary)
1589
            self._freeze()
1590
            return
1591
        self.StartingRecordId = 0
1592
        self.MaxRecordsToReturn = 0
1593
        self.ServerCapabilityFilter = []
1594
        self._freeze()
1595
1596 1
    def to_binary(self):
1597
        packet = []
1598
        packet.append(uatype_UInt32.pack(self.StartingRecordId))
1599
        packet.append(uatype_UInt32.pack(self.MaxRecordsToReturn))
1600
        packet.append(uatype_Int32.pack(len(self.ServerCapabilityFilter)))
1601
        for fieldname in self.ServerCapabilityFilter:
1602
            packet.append(pack_string(fieldname))
1603
        return b''.join(packet)
1604
1605 1
    @staticmethod
1606
    def from_binary(data):
1607
        return FindServersOnNetworkParameters(data)
1608
1609 1
    def _binary_init(self, data):
1610
        self.StartingRecordId = uatype_UInt32.unpack(data.read(4))[0]
1611
        self.MaxRecordsToReturn = uatype_UInt32.unpack(data.read(4))[0]
1612
        self.ServerCapabilityFilter = unpack_uatype_array('String', data)
1613
1614 1
    def __str__(self):
1615
        return 'FindServersOnNetworkParameters(' + 'StartingRecordId:' + str(self.StartingRecordId) + ', ' + \
1616
               'MaxRecordsToReturn:' + str(self.MaxRecordsToReturn) + ', ' + \
1617
               'ServerCapabilityFilter:' + str(self.ServerCapabilityFilter) + ')'
1618
1619 1
    __repr__ = __str__
1620
1621
1622 1
class FindServersOnNetworkRequest(FrozenClass):
1623
    '''
1624
    :ivar TypeId:
1625
    :vartype TypeId: NodeId
1626
    :ivar RequestHeader:
1627
    :vartype RequestHeader: RequestHeader
1628
    :ivar Parameters:
1629
    :vartype Parameters: FindServersOnNetworkParameters
1630
    '''
1631 1
    def __init__(self, binary=None):
1632
        if binary is not None:
1633
            self._binary_init(binary)
1634
            self._freeze()
1635
            return
1636
        self.TypeId = FourByteNodeId(ObjectIds.FindServersOnNetworkRequest_Encoding_DefaultBinary)
1637
        self.RequestHeader = RequestHeader()
1638
        self.Parameters = FindServersOnNetworkParameters()
1639
        self._freeze()
1640
1641 1
    def to_binary(self):
1642
        packet = []
1643
        packet.append(self.TypeId.to_binary())
1644
        packet.append(self.RequestHeader.to_binary())
1645
        packet.append(self.Parameters.to_binary())
1646
        return b''.join(packet)
1647
1648 1
    @staticmethod
1649
    def from_binary(data):
1650
        return FindServersOnNetworkRequest(data)
1651
1652 1
    def _binary_init(self, data):
1653
        self.TypeId = NodeId.from_binary(data)
1654
        self.RequestHeader = RequestHeader.from_binary(data)
1655
        self.Parameters = FindServersOnNetworkParameters.from_binary(data)
1656
1657 1
    def __str__(self):
1658
        return 'FindServersOnNetworkRequest(' + 'TypeId:' + str(self.TypeId) + ', ' + \
1659
               'RequestHeader:' + str(self.RequestHeader) + ', ' + \
1660
               'Parameters:' + str(self.Parameters) + ')'
1661
1662 1
    __repr__ = __str__
1663
1664
1665 1
class FindServersOnNetworkResult(FrozenClass):
1666
    '''
1667
    :ivar LastCounterResetTime:
1668
    :vartype LastCounterResetTime: DateTime
1669
    :ivar Servers:
1670
    :vartype Servers: ServerOnNetwork
1671
    '''
1672 1
    def __init__(self, binary=None):
1673
        if binary is not None:
1674
            self._binary_init(binary)
1675
            self._freeze()
1676
            return
1677
        self.LastCounterResetTime = datetime.now()
1678
        self.Servers = []
1679
        self._freeze()
1680
1681 1
    def to_binary(self):
1682
        packet = []
1683
        packet.append(pack_datetime(self.LastCounterResetTime))
1684
        packet.append(uatype_Int32.pack(len(self.Servers)))
1685
        for fieldname in self.Servers:
1686
            packet.append(fieldname.to_binary())
1687
        return b''.join(packet)
1688
1689 1
    @staticmethod
1690
    def from_binary(data):
1691
        return FindServersOnNetworkResult(data)
1692
1693 1
    def _binary_init(self, data):
1694
        self.LastCounterResetTime = unpack_datetime(data)
1695
        length = uatype_Int32.unpack(data.read(4))[0]
1696
        array = []
1697
        if length != -1:
1698
            for _ in range(0, length):
1699
                array.append(ServerOnNetwork.from_binary(data))
1700
        self.Servers = array
1701
1702 1
    def __str__(self):
1703
        return 'FindServersOnNetworkResult(' + 'LastCounterResetTime:' + str(self.LastCounterResetTime) + ', ' + \
1704
               'Servers:' + str(self.Servers) + ')'
1705
1706 1
    __repr__ = __str__
1707
1708
1709 1
class FindServersOnNetworkResponse(FrozenClass):
1710
    '''
1711
    :ivar TypeId:
1712
    :vartype TypeId: NodeId
1713
    :ivar ResponseHeader:
1714
    :vartype ResponseHeader: ResponseHeader
1715
    :ivar Parameters:
1716
    :vartype Parameters: FindServersOnNetworkResult
1717
    '''
1718 1
    def __init__(self, binary=None):
1719
        if binary is not None:
1720
            self._binary_init(binary)
1721
            self._freeze()
1722
            return
1723
        self.TypeId = FourByteNodeId(ObjectIds.FindServersOnNetworkResponse_Encoding_DefaultBinary)
1724
        self.ResponseHeader = ResponseHeader()
1725
        self.Parameters = FindServersOnNetworkResult()
1726
        self._freeze()
1727
1728 1
    def to_binary(self):
1729
        packet = []
1730
        packet.append(self.TypeId.to_binary())
1731
        packet.append(self.ResponseHeader.to_binary())
1732
        packet.append(self.Parameters.to_binary())
1733
        return b''.join(packet)
1734
1735 1
    @staticmethod
1736
    def from_binary(data):
1737
        return FindServersOnNetworkResponse(data)
1738
1739 1
    def _binary_init(self, data):
1740
        self.TypeId = NodeId.from_binary(data)
1741
        self.ResponseHeader = ResponseHeader.from_binary(data)
1742
        self.Parameters = FindServersOnNetworkResult.from_binary(data)
1743
1744 1
    def __str__(self):
1745
        return 'FindServersOnNetworkResponse(' + 'TypeId:' + str(self.TypeId) + ', ' + \
1746
               'ResponseHeader:' + str(self.ResponseHeader) + ', ' + \
1747
               'Parameters:' + str(self.Parameters) + ')'
1748
1749 1
    __repr__ = __str__
1750
1751
1752 1
class UserTokenPolicy(FrozenClass):
1753
    '''
1754
    Describes a user token that can be used with a server.
1755
1756
    :ivar PolicyId:
1757
    :vartype PolicyId: String
1758
    :ivar TokenType:
1759
    :vartype TokenType: UserTokenType
1760
    :ivar IssuedTokenType:
1761
    :vartype IssuedTokenType: String
1762
    :ivar IssuerEndpointUrl:
1763
    :vartype IssuerEndpointUrl: String
1764
    :ivar SecurityPolicyUri:
1765
    :vartype SecurityPolicyUri: String
1766
    '''
1767 1
    def __init__(self, binary=None):
1768 1
        if binary is not None:
1769 1
            self._binary_init(binary)
1770 1
            self._freeze()
1771 1
            return
1772 1
        self.PolicyId = ''
1773 1
        self.TokenType = 0
1774 1
        self.IssuedTokenType = ''
1775 1
        self.IssuerEndpointUrl = ''
1776 1
        self.SecurityPolicyUri = ''
1777 1
        self._freeze()
1778
1779 1
    def to_binary(self):
1780 1
        packet = []
1781 1
        packet.append(pack_string(self.PolicyId))
1782 1
        packet.append(uatype_UInt32.pack(self.TokenType))
1783 1
        packet.append(pack_string(self.IssuedTokenType))
1784 1
        packet.append(pack_string(self.IssuerEndpointUrl))
1785 1
        packet.append(pack_string(self.SecurityPolicyUri))
1786 1
        return b''.join(packet)
1787
1788 1
    @staticmethod
1789
    def from_binary(data):
1790 1
        return UserTokenPolicy(data)
1791
1792 1
    def _binary_init(self, data):
1793 1
        self.PolicyId = unpack_string(data)
1794 1
        self.TokenType = uatype_UInt32.unpack(data.read(4))[0]
1795 1
        self.IssuedTokenType = unpack_string(data)
1796 1
        self.IssuerEndpointUrl = unpack_string(data)
1797 1
        self.SecurityPolicyUri = unpack_string(data)
1798
1799 1
    def __str__(self):
1800
        return 'UserTokenPolicy(' + 'PolicyId:' + str(self.PolicyId) + ', ' + \
1801
               'TokenType:' + str(self.TokenType) + ', ' + \
1802
               'IssuedTokenType:' + str(self.IssuedTokenType) + ', ' + \
1803
               'IssuerEndpointUrl:' + str(self.IssuerEndpointUrl) + ', ' + \
1804
               'SecurityPolicyUri:' + str(self.SecurityPolicyUri) + ')'
1805
1806 1
    __repr__ = __str__
1807
1808
1809 1
class EndpointDescription(FrozenClass):
1810
    '''
1811
    The description of a endpoint that can be used to access a server.
1812
1813
    :ivar EndpointUrl:
1814
    :vartype EndpointUrl: String
1815
    :ivar Server:
1816
    :vartype Server: ApplicationDescription
1817
    :ivar ServerCertificate:
1818
    :vartype ServerCertificate: ByteString
1819
    :ivar SecurityMode:
1820
    :vartype SecurityMode: MessageSecurityMode
1821
    :ivar SecurityPolicyUri:
1822
    :vartype SecurityPolicyUri: String
1823
    :ivar UserIdentityTokens:
1824
    :vartype UserIdentityTokens: UserTokenPolicy
1825
    :ivar TransportProfileUri:
1826
    :vartype TransportProfileUri: String
1827
    :ivar SecurityLevel:
1828
    :vartype SecurityLevel: Byte
1829
    '''
1830 1
    def __init__(self, binary=None):
1831 1
        if binary is not None:
1832 1
            self._binary_init(binary)
1833 1
            self._freeze()
1834 1
            return
1835 1
        self.EndpointUrl = ''
1836 1
        self.Server = ApplicationDescription()
1837 1
        self.ServerCertificate = b''
1838 1
        self.SecurityMode = 0
1839 1
        self.SecurityPolicyUri = ''
1840 1
        self.UserIdentityTokens = []
1841 1
        self.TransportProfileUri = ''
1842 1
        self.SecurityLevel = 0
1843 1
        self._freeze()
1844
1845 1
    def to_binary(self):
1846 1
        packet = []
1847 1
        packet.append(pack_string(self.EndpointUrl))
1848 1
        packet.append(self.Server.to_binary())
1849 1
        packet.append(pack_bytes(self.ServerCertificate))
1850 1
        packet.append(uatype_UInt32.pack(self.SecurityMode))
1851 1
        packet.append(pack_string(self.SecurityPolicyUri))
1852 1
        packet.append(uatype_Int32.pack(len(self.UserIdentityTokens)))
1853 1
        for fieldname in self.UserIdentityTokens:
1854 1
            packet.append(fieldname.to_binary())
1855 1
        packet.append(pack_string(self.TransportProfileUri))
1856 1
        packet.append(uatype_Byte.pack(self.SecurityLevel))
1857 1
        return b''.join(packet)
1858
1859 1
    @staticmethod
1860
    def from_binary(data):
1861 1
        return EndpointDescription(data)
1862
1863 1
    def _binary_init(self, data):
1864 1
        self.EndpointUrl = unpack_string(data)
1865 1
        self.Server = ApplicationDescription.from_binary(data)
1866 1
        self.ServerCertificate = unpack_bytes(data)
1867 1
        self.SecurityMode = uatype_UInt32.unpack(data.read(4))[0]
1868 1
        self.SecurityPolicyUri = unpack_string(data)
1869 1
        length = uatype_Int32.unpack(data.read(4))[0]
1870 1
        array = []
1871 1
        if length != -1:
1872 1
            for _ in range(0, length):
1873 1
                array.append(UserTokenPolicy.from_binary(data))
1874 1
        self.UserIdentityTokens = array
1875 1
        self.TransportProfileUri = unpack_string(data)
1876 1
        self.SecurityLevel = uatype_Byte.unpack(data.read(1))[0]
1877
1878 1
    def __str__(self):
1879
        return 'EndpointDescription(' + 'EndpointUrl:' + str(self.EndpointUrl) + ', ' + \
1880
               'Server:' + str(self.Server) + ', ' + \
1881
               'ServerCertificate:' + str(self.ServerCertificate) + ', ' + \
1882
               'SecurityMode:' + str(self.SecurityMode) + ', ' + \
1883
               'SecurityPolicyUri:' + str(self.SecurityPolicyUri) + ', ' + \
1884
               'UserIdentityTokens:' + str(self.UserIdentityTokens) + ', ' + \
1885
               'TransportProfileUri:' + str(self.TransportProfileUri) + ', ' + \
1886
               'SecurityLevel:' + str(self.SecurityLevel) + ')'
1887
1888 1
    __repr__ = __str__
1889
1890
1891 1
class GetEndpointsParameters(FrozenClass):
1892
    '''
1893
    :ivar EndpointUrl:
1894
    :vartype EndpointUrl: String
1895
    :ivar LocaleIds:
1896
    :vartype LocaleIds: String
1897
    :ivar ProfileUris:
1898
    :vartype ProfileUris: String
1899
    '''
1900 1
    def __init__(self, binary=None):
1901 1
        if binary is not None:
1902 1
            self._binary_init(binary)
1903 1
            self._freeze()
1904 1
            return
1905 1
        self.EndpointUrl = ''
1906 1
        self.LocaleIds = []
1907 1
        self.ProfileUris = []
1908 1
        self._freeze()
1909
1910 1
    def to_binary(self):
1911 1
        packet = []
1912 1
        packet.append(pack_string(self.EndpointUrl))
1913 1
        packet.append(uatype_Int32.pack(len(self.LocaleIds)))
1914 1
        for fieldname in self.LocaleIds:
1915
            packet.append(pack_string(fieldname))
1916 1
        packet.append(uatype_Int32.pack(len(self.ProfileUris)))
1917 1
        for fieldname in self.ProfileUris:
1918
            packet.append(pack_string(fieldname))
1919 1
        return b''.join(packet)
1920
1921 1
    @staticmethod
1922
    def from_binary(data):
1923 1
        return GetEndpointsParameters(data)
1924
1925 1
    def _binary_init(self, data):
1926 1
        self.EndpointUrl = unpack_string(data)
1927 1
        self.LocaleIds = unpack_uatype_array('String', data)
1928 1
        self.ProfileUris = unpack_uatype_array('String', data)
1929
1930 1
    def __str__(self):
1931
        return 'GetEndpointsParameters(' + 'EndpointUrl:' + str(self.EndpointUrl) + ', ' + \
1932
               'LocaleIds:' + str(self.LocaleIds) + ', ' + \
1933
               'ProfileUris:' + str(self.ProfileUris) + ')'
1934
1935 1
    __repr__ = __str__
1936
1937
1938 1
class GetEndpointsRequest(FrozenClass):
1939
    '''
1940
    Gets the endpoints used by the server.
1941
1942
    :ivar TypeId:
1943
    :vartype TypeId: NodeId
1944
    :ivar RequestHeader:
1945
    :vartype RequestHeader: RequestHeader
1946
    :ivar Parameters:
1947
    :vartype Parameters: GetEndpointsParameters
1948
    '''
1949 1
    def __init__(self, binary=None):
1950 1
        if binary is not None:
1951
            self._binary_init(binary)
1952
            self._freeze()
1953
            return
1954 1
        self.TypeId = FourByteNodeId(ObjectIds.GetEndpointsRequest_Encoding_DefaultBinary)
1955 1
        self.RequestHeader = RequestHeader()
1956 1
        self.Parameters = GetEndpointsParameters()
1957 1
        self._freeze()
1958
1959 1
    def to_binary(self):
1960 1
        packet = []
1961 1
        packet.append(self.TypeId.to_binary())
1962 1
        packet.append(self.RequestHeader.to_binary())
1963 1
        packet.append(self.Parameters.to_binary())
1964 1
        return b''.join(packet)
1965
1966 1
    @staticmethod
1967
    def from_binary(data):
1968
        return GetEndpointsRequest(data)
1969
1970 1
    def _binary_init(self, data):
1971
        self.TypeId = NodeId.from_binary(data)
1972
        self.RequestHeader = RequestHeader.from_binary(data)
1973
        self.Parameters = GetEndpointsParameters.from_binary(data)
1974
1975 1
    def __str__(self):
1976
        return 'GetEndpointsRequest(' + 'TypeId:' + str(self.TypeId) + ', ' + \
1977
               'RequestHeader:' + str(self.RequestHeader) + ', ' + \
1978
               'Parameters:' + str(self.Parameters) + ')'
1979
1980 1
    __repr__ = __str__
1981
1982
1983 1
class GetEndpointsResponse(FrozenClass):
1984
    '''
1985
    Gets the endpoints used by the server.
1986
1987
    :ivar TypeId:
1988
    :vartype TypeId: NodeId
1989
    :ivar ResponseHeader:
1990
    :vartype ResponseHeader: ResponseHeader
1991
    :ivar Endpoints:
1992
    :vartype Endpoints: EndpointDescription
1993
    '''
1994 1
    def __init__(self, binary=None):
1995 1
        if binary is not None:
1996 1
            self._binary_init(binary)
1997 1
            self._freeze()
1998 1
            return
1999 1
        self.TypeId = FourByteNodeId(ObjectIds.GetEndpointsResponse_Encoding_DefaultBinary)
2000 1
        self.ResponseHeader = ResponseHeader()
2001 1
        self.Endpoints = []
2002 1
        self._freeze()
2003
2004 1
    def to_binary(self):
2005 1
        packet = []
2006 1
        packet.append(self.TypeId.to_binary())
2007 1
        packet.append(self.ResponseHeader.to_binary())
2008 1
        packet.append(uatype_Int32.pack(len(self.Endpoints)))
2009 1
        for fieldname in self.Endpoints:
2010 1
            packet.append(fieldname.to_binary())
2011 1
        return b''.join(packet)
2012
2013 1
    @staticmethod
2014
    def from_binary(data):
2015 1
        return GetEndpointsResponse(data)
2016
2017 1
    def _binary_init(self, data):
2018 1
        self.TypeId = NodeId.from_binary(data)
2019 1
        self.ResponseHeader = ResponseHeader.from_binary(data)
2020 1
        length = uatype_Int32.unpack(data.read(4))[0]
2021 1
        array = []
2022 1
        if length != -1:
2023 1
            for _ in range(0, length):
2024 1
                array.append(EndpointDescription.from_binary(data))
2025 1
        self.Endpoints = array
2026
2027 1
    def __str__(self):
2028
        return 'GetEndpointsResponse(' + 'TypeId:' + str(self.TypeId) + ', ' + \
2029
               'ResponseHeader:' + str(self.ResponseHeader) + ', ' + \
2030
               'Endpoints:' + str(self.Endpoints) + ')'
2031
2032 1
    __repr__ = __str__
2033
2034
2035 1
class RegisteredServer(FrozenClass):
2036
    '''
2037
    The information required to register a server with a discovery server.
2038
2039
    :ivar ServerUri:
2040
    :vartype ServerUri: String
2041
    :ivar ProductUri:
2042
    :vartype ProductUri: String
2043
    :ivar ServerNames:
2044
    :vartype ServerNames: LocalizedText
2045
    :ivar ServerType:
2046
    :vartype ServerType: ApplicationType
2047
    :ivar GatewayServerUri:
2048
    :vartype GatewayServerUri: String
2049
    :ivar DiscoveryUrls:
2050
    :vartype DiscoveryUrls: String
2051
    :ivar SemaphoreFilePath:
2052
    :vartype SemaphoreFilePath: String
2053
    :ivar IsOnline:
2054
    :vartype IsOnline: Boolean
2055
    '''
2056 1
    def __init__(self, binary=None):
2057 1
        if binary is not None:
2058 1
            self._binary_init(binary)
2059 1
            self._freeze()
2060 1
            return
2061 1
        self.ServerUri = ''
2062 1
        self.ProductUri = ''
2063 1
        self.ServerNames = []
2064 1
        self.ServerType = 0
2065 1
        self.GatewayServerUri = ''
2066 1
        self.DiscoveryUrls = []
2067 1
        self.SemaphoreFilePath = ''
2068 1
        self.IsOnline = True
2069 1
        self._freeze()
2070
2071 1
    def to_binary(self):
2072 1
        packet = []
2073 1
        packet.append(pack_string(self.ServerUri))
2074 1
        packet.append(pack_string(self.ProductUri))
2075 1
        packet.append(uatype_Int32.pack(len(self.ServerNames)))
2076 1
        for fieldname in self.ServerNames:
2077 1
            packet.append(fieldname.to_binary())
2078 1
        packet.append(uatype_UInt32.pack(self.ServerType))
2079 1
        packet.append(pack_string(self.GatewayServerUri))
2080 1
        packet.append(uatype_Int32.pack(len(self.DiscoveryUrls)))
2081 1
        for fieldname in self.DiscoveryUrls:
2082 1
            packet.append(pack_string(fieldname))
2083 1
        packet.append(pack_string(self.SemaphoreFilePath))
2084 1
        packet.append(uatype_Boolean.pack(self.IsOnline))
2085 1
        return b''.join(packet)
2086
2087 1
    @staticmethod
2088
    def from_binary(data):
2089 1
        return RegisteredServer(data)
2090
2091 1
    def _binary_init(self, data):
2092 1
        self.ServerUri = unpack_string(data)
2093 1
        self.ProductUri = unpack_string(data)
2094 1
        length = uatype_Int32.unpack(data.read(4))[0]
2095 1
        array = []
2096 1
        if length != -1:
2097 1
            for _ in range(0, length):
2098 1
                array.append(LocalizedText.from_binary(data))
2099 1
        self.ServerNames = array
2100 1
        self.ServerType = uatype_UInt32.unpack(data.read(4))[0]
2101 1
        self.GatewayServerUri = unpack_string(data)
2102 1
        self.DiscoveryUrls = unpack_uatype_array('String', data)
2103 1
        self.SemaphoreFilePath = unpack_string(data)
2104 1
        self.IsOnline = uatype_Boolean.unpack(data.read(1))[0]
2105
2106 1
    def __str__(self):
2107
        return 'RegisteredServer(' + 'ServerUri:' + str(self.ServerUri) + ', ' + \
2108
               'ProductUri:' + str(self.ProductUri) + ', ' + \
2109
               'ServerNames:' + str(self.ServerNames) + ', ' + \
2110
               'ServerType:' + str(self.ServerType) + ', ' + \
2111
               'GatewayServerUri:' + str(self.GatewayServerUri) + ', ' + \
2112
               'DiscoveryUrls:' + str(self.DiscoveryUrls) + ', ' + \
2113
               'SemaphoreFilePath:' + str(self.SemaphoreFilePath) + ', ' + \
2114
               'IsOnline:' + str(self.IsOnline) + ')'
2115
2116 1
    __repr__ = __str__
2117
2118
2119 1
class RegisterServerRequest(FrozenClass):
2120
    '''
2121
    Registers a server with the discovery server.
2122
2123
    :ivar TypeId:
2124
    :vartype TypeId: NodeId
2125
    :ivar RequestHeader:
2126
    :vartype RequestHeader: RequestHeader
2127
    :ivar Server:
2128
    :vartype Server: RegisteredServer
2129
    '''
2130 1
    def __init__(self, binary=None):
2131 1
        if binary is not None:
2132
            self._binary_init(binary)
2133
            self._freeze()
2134
            return
2135 1
        self.TypeId = FourByteNodeId(ObjectIds.RegisterServerRequest_Encoding_DefaultBinary)
2136 1
        self.RequestHeader = RequestHeader()
2137 1
        self.Server = RegisteredServer()
2138 1
        self._freeze()
2139
2140 1
    def to_binary(self):
2141 1
        packet = []
2142 1
        packet.append(self.TypeId.to_binary())
2143 1
        packet.append(self.RequestHeader.to_binary())
2144 1
        packet.append(self.Server.to_binary())
2145 1
        return b''.join(packet)
2146
2147 1
    @staticmethod
2148
    def from_binary(data):
2149
        return RegisterServerRequest(data)
2150
2151 1
    def _binary_init(self, data):
2152
        self.TypeId = NodeId.from_binary(data)
2153
        self.RequestHeader = RequestHeader.from_binary(data)
2154
        self.Server = RegisteredServer.from_binary(data)
2155
2156 1
    def __str__(self):
2157
        return 'RegisterServerRequest(' + 'TypeId:' + str(self.TypeId) + ', ' + \
2158
               'RequestHeader:' + str(self.RequestHeader) + ', ' + \
2159
               'Server:' + str(self.Server) + ')'
2160
2161 1
    __repr__ = __str__
2162
2163
2164 1
class RegisterServerResponse(FrozenClass):
2165
    '''
2166
    Registers a server with the discovery server.
2167
2168
    :ivar TypeId:
2169
    :vartype TypeId: NodeId
2170
    :ivar ResponseHeader:
2171
    :vartype ResponseHeader: ResponseHeader
2172
    '''
2173 1
    def __init__(self, binary=None):
2174 1
        if binary is not None:
2175 1
            self._binary_init(binary)
2176 1
            self._freeze()
2177 1
            return
2178 1
        self.TypeId = FourByteNodeId(ObjectIds.RegisterServerResponse_Encoding_DefaultBinary)
2179 1
        self.ResponseHeader = ResponseHeader()
2180 1
        self._freeze()
2181
2182 1
    def to_binary(self):
2183 1
        packet = []
2184 1
        packet.append(self.TypeId.to_binary())
2185 1
        packet.append(self.ResponseHeader.to_binary())
2186 1
        return b''.join(packet)
2187
2188 1
    @staticmethod
2189
    def from_binary(data):
2190 1
        return RegisterServerResponse(data)
2191
2192 1
    def _binary_init(self, data):
2193 1
        self.TypeId = NodeId.from_binary(data)
2194 1
        self.ResponseHeader = ResponseHeader.from_binary(data)
2195
2196 1
    def __str__(self):
2197
        return 'RegisterServerResponse(' + 'TypeId:' + str(self.TypeId) + ', ' + \
2198
               'ResponseHeader:' + str(self.ResponseHeader) + ')'
2199
2200 1
    __repr__ = __str__
2201
2202
2203 1
class DiscoveryConfiguration(FrozenClass):
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
2204
    '''
2205
    A base type for discovery configuration information.
2206
2207
    '''
2208 1
    def __init__(self, binary=None):
2209
        if binary is not None:
2210
            self._binary_init(binary)
2211
            self._freeze()
2212
            return
2213
        self._freeze()
2214
2215 1
    def to_binary(self):
2216
        packet = []
2217
        return b''.join(packet)
2218
2219 1
    @staticmethod
2220
    def from_binary(data):
2221
        return DiscoveryConfiguration(data)
2222
2223 1
    def _binary_init(self, data):
2224
        pass
2225
2226 1
    def __str__(self):
2227
        return 'DiscoveryConfiguration(' +  + ')'
2228
2229 1
    __repr__ = __str__
2230
2231
2232 1
class MdnsDiscoveryConfiguration(FrozenClass):
2233
    '''
2234
    The discovery information needed for mDNS registration.
2235
2236
    :ivar MdnsServerName:
2237
    :vartype MdnsServerName: String
2238
    :ivar ServerCapabilities:
2239
    :vartype ServerCapabilities: String
2240
    '''
2241 1
    def __init__(self, binary=None):
2242
        if binary is not None:
2243
            self._binary_init(binary)
2244
            self._freeze()
2245
            return
2246
        self.MdnsServerName = ''
2247
        self.ServerCapabilities = []
2248
        self._freeze()
2249
2250 1
    def to_binary(self):
2251
        packet = []
2252
        packet.append(pack_string(self.MdnsServerName))
2253
        packet.append(uatype_Int32.pack(len(self.ServerCapabilities)))
2254
        for fieldname in self.ServerCapabilities:
2255
            packet.append(pack_string(fieldname))
2256
        return b''.join(packet)
2257
2258 1
    @staticmethod
2259
    def from_binary(data):
2260
        return MdnsDiscoveryConfiguration(data)
2261
2262 1
    def _binary_init(self, data):
2263
        self.MdnsServerName = unpack_string(data)
2264
        self.ServerCapabilities = unpack_uatype_array('String', data)
2265
2266 1
    def __str__(self):
2267
        return 'MdnsDiscoveryConfiguration(' + 'MdnsServerName:' + str(self.MdnsServerName) + ', ' + \
2268
               'ServerCapabilities:' + str(self.ServerCapabilities) + ')'
2269
2270 1
    __repr__ = __str__
2271
2272
2273 1
class RegisterServer2Parameters(FrozenClass):
2274
    '''
2275
    :ivar Server:
2276
    :vartype Server: RegisteredServer
2277
    :ivar DiscoveryConfiguration:
2278
    :vartype DiscoveryConfiguration: ExtensionObject
2279
    '''
2280 1
    def __init__(self, binary=None):
2281
        if binary is not None:
2282
            self._binary_init(binary)
2283
            self._freeze()
2284
            return
2285
        self.Server = RegisteredServer()
2286
        self.DiscoveryConfiguration = []
2287
        self._freeze()
2288
2289 1
    def to_binary(self):
2290
        packet = []
2291
        packet.append(self.Server.to_binary())
2292
        packet.append(uatype_Int32.pack(len(self.DiscoveryConfiguration)))
2293
        for fieldname in self.DiscoveryConfiguration:
2294
            packet.append(extensionobject_to_binary(fieldname))
2295
        return b''.join(packet)
2296
2297 1
    @staticmethod
2298
    def from_binary(data):
2299
        return RegisterServer2Parameters(data)
2300
2301 1
    def _binary_init(self, data):
2302
        self.Server = RegisteredServer.from_binary(data)
2303
        length = uatype_Int32.unpack(data.read(4))[0]
2304
        array = []
2305
        if length != -1:
2306
            for _ in range(0, length):
2307
                array.append(extensionobject_from_binary(data))
2308
        self.DiscoveryConfiguration = array
2309
2310 1
    def __str__(self):
2311
        return 'RegisterServer2Parameters(' + 'Server:' + str(self.Server) + ', ' + \
2312
               'DiscoveryConfiguration:' + str(self.DiscoveryConfiguration) + ')'
2313
2314 1
    __repr__ = __str__
2315
2316
2317 1
class RegisterServer2Request(FrozenClass):
2318
    '''
2319
    :ivar TypeId:
2320
    :vartype TypeId: NodeId
2321
    :ivar RequestHeader:
2322
    :vartype RequestHeader: RequestHeader
2323
    :ivar Parameters:
2324
    :vartype Parameters: RegisterServer2Parameters
2325
    '''
2326 1
    def __init__(self, binary=None):
2327
        if binary is not None:
2328
            self._binary_init(binary)
2329
            self._freeze()
2330
            return
2331
        self.TypeId = FourByteNodeId(ObjectIds.RegisterServer2Request_Encoding_DefaultBinary)
2332
        self.RequestHeader = RequestHeader()
2333
        self.Parameters = RegisterServer2Parameters()
2334
        self._freeze()
2335
2336 1
    def to_binary(self):
2337
        packet = []
2338
        packet.append(self.TypeId.to_binary())
2339
        packet.append(self.RequestHeader.to_binary())
2340
        packet.append(self.Parameters.to_binary())
2341
        return b''.join(packet)
2342
2343 1
    @staticmethod
2344
    def from_binary(data):
2345
        return RegisterServer2Request(data)
2346
2347 1
    def _binary_init(self, data):
2348
        self.TypeId = NodeId.from_binary(data)
2349
        self.RequestHeader = RequestHeader.from_binary(data)
2350
        self.Parameters = RegisterServer2Parameters.from_binary(data)
2351
2352 1
    def __str__(self):
2353
        return 'RegisterServer2Request(' + 'TypeId:' + str(self.TypeId) + ', ' + \
2354
               'RequestHeader:' + str(self.RequestHeader) + ', ' + \
2355
               'Parameters:' + str(self.Parameters) + ')'
2356
2357 1
    __repr__ = __str__
2358
2359
2360 1
class RegisterServer2Response(FrozenClass):
2361
    '''
2362
    :ivar TypeId:
2363
    :vartype TypeId: NodeId
2364
    :ivar ResponseHeader:
2365
    :vartype ResponseHeader: ResponseHeader
2366
    :ivar ConfigurationResults:
2367
    :vartype ConfigurationResults: StatusCode
2368
    :ivar DiagnosticInfos:
2369
    :vartype DiagnosticInfos: DiagnosticInfo
2370
    '''
2371 1
    def __init__(self, binary=None):
2372
        if binary is not None:
2373
            self._binary_init(binary)
2374
            self._freeze()
2375
            return
2376
        self.TypeId = FourByteNodeId(ObjectIds.RegisterServer2Response_Encoding_DefaultBinary)
2377
        self.ResponseHeader = ResponseHeader()
2378
        self.ConfigurationResults = []
2379
        self.DiagnosticInfos = []
2380
        self._freeze()
2381
2382 1
    def to_binary(self):
2383
        packet = []
2384
        packet.append(self.TypeId.to_binary())
2385
        packet.append(self.ResponseHeader.to_binary())
2386
        packet.append(uatype_Int32.pack(len(self.ConfigurationResults)))
2387
        for fieldname in self.ConfigurationResults:
2388
            packet.append(fieldname.to_binary())
2389
        packet.append(uatype_Int32.pack(len(self.DiagnosticInfos)))
2390
        for fieldname in self.DiagnosticInfos:
2391
            packet.append(fieldname.to_binary())
2392
        return b''.join(packet)
2393
2394 1
    @staticmethod
2395
    def from_binary(data):
2396
        return RegisterServer2Response(data)
2397
2398 1
    def _binary_init(self, data):
2399
        self.TypeId = NodeId.from_binary(data)
2400
        self.ResponseHeader = ResponseHeader.from_binary(data)
2401
        length = uatype_Int32.unpack(data.read(4))[0]
2402
        array = []
2403
        if length != -1:
2404
            for _ in range(0, length):
2405
                array.append(StatusCode.from_binary(data))
2406
        self.ConfigurationResults = array
2407
        length = uatype_Int32.unpack(data.read(4))[0]
2408
        array = []
2409
        if length != -1:
2410
            for _ in range(0, length):
2411
                array.append(DiagnosticInfo.from_binary(data))
2412
        self.DiagnosticInfos = array
2413
2414 1
    def __str__(self):
2415
        return 'RegisterServer2Response(' + 'TypeId:' + str(self.TypeId) + ', ' + \
2416
               'ResponseHeader:' + str(self.ResponseHeader) + ', ' + \
2417
               'ConfigurationResults:' + str(self.ConfigurationResults) + ', ' + \
2418
               'DiagnosticInfos:' + str(self.DiagnosticInfos) + ')'
2419
2420 1
    __repr__ = __str__
2421
2422
2423 1
class ChannelSecurityToken(FrozenClass):
2424
    '''
2425
    The token that identifies a set of keys for an active secure channel.
2426
2427
    :ivar ChannelId:
2428
    :vartype ChannelId: UInt32
2429
    :ivar TokenId:
2430
    :vartype TokenId: UInt32
2431
    :ivar CreatedAt:
2432
    :vartype CreatedAt: DateTime
2433
    :ivar RevisedLifetime:
2434
    :vartype RevisedLifetime: UInt32
2435
    '''
2436 1
    def __init__(self, binary=None):
2437 1
        if binary is not None:
2438 1
            self._binary_init(binary)
2439 1
            self._freeze()
2440 1
            return
2441 1
        self.ChannelId = 0
2442 1
        self.TokenId = 0
2443 1
        self.CreatedAt = datetime.now()
2444 1
        self.RevisedLifetime = 0
2445 1
        self._freeze()
2446
2447 1
    def to_binary(self):
2448 1
        packet = []
2449 1
        packet.append(uatype_UInt32.pack(self.ChannelId))
2450 1
        packet.append(uatype_UInt32.pack(self.TokenId))
2451 1
        packet.append(pack_datetime(self.CreatedAt))
2452 1
        packet.append(uatype_UInt32.pack(self.RevisedLifetime))
2453 1
        return b''.join(packet)
2454
2455 1
    @staticmethod
2456
    def from_binary(data):
2457 1
        return ChannelSecurityToken(data)
2458
2459 1
    def _binary_init(self, data):
2460 1
        self.ChannelId = uatype_UInt32.unpack(data.read(4))[0]
2461 1
        self.TokenId = uatype_UInt32.unpack(data.read(4))[0]
2462 1
        self.CreatedAt = unpack_datetime(data)
2463 1
        self.RevisedLifetime = uatype_UInt32.unpack(data.read(4))[0]
2464
2465 1
    def __str__(self):
2466
        return 'ChannelSecurityToken(' + 'ChannelId:' + str(self.ChannelId) + ', ' + \
2467
               'TokenId:' + str(self.TokenId) + ', ' + \
2468
               'CreatedAt:' + str(self.CreatedAt) + ', ' + \
2469
               'RevisedLifetime:' + str(self.RevisedLifetime) + ')'
2470
2471 1
    __repr__ = __str__
2472
2473
2474 1
class OpenSecureChannelParameters(FrozenClass):
2475
    '''
2476
    :ivar ClientProtocolVersion:
2477
    :vartype ClientProtocolVersion: UInt32
2478
    :ivar RequestType:
2479
    :vartype RequestType: SecurityTokenRequestType
2480
    :ivar SecurityMode:
2481
    :vartype SecurityMode: MessageSecurityMode
2482
    :ivar ClientNonce:
2483
    :vartype ClientNonce: ByteString
2484
    :ivar RequestedLifetime:
2485
    :vartype RequestedLifetime: UInt32
2486
    '''
2487 1
    def __init__(self, binary=None):
2488 1
        if binary is not None:
2489 1
            self._binary_init(binary)
2490 1
            self._freeze()
2491 1
            return
2492 1
        self.ClientProtocolVersion = 0
2493 1
        self.RequestType = 0
2494 1
        self.SecurityMode = 0
2495 1
        self.ClientNonce = b''
2496 1
        self.RequestedLifetime = 0
2497 1
        self._freeze()
2498
2499 1
    def to_binary(self):
2500 1
        packet = []
2501 1
        packet.append(uatype_UInt32.pack(self.ClientProtocolVersion))
2502 1
        packet.append(uatype_UInt32.pack(self.RequestType))
2503 1
        packet.append(uatype_UInt32.pack(self.SecurityMode))
2504 1
        packet.append(pack_bytes(self.ClientNonce))
2505 1
        packet.append(uatype_UInt32.pack(self.RequestedLifetime))
2506 1
        return b''.join(packet)
2507
2508 1
    @staticmethod
2509
    def from_binary(data):
2510 1
        return OpenSecureChannelParameters(data)
2511
2512 1
    def _binary_init(self, data):
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
2513 1
        self.ClientProtocolVersion = uatype_UInt32.unpack(data.read(4))[0]
2514 1
        self.RequestType = uatype_UInt32.unpack(data.read(4))[0]
2515 1
        self.SecurityMode = uatype_UInt32.unpack(data.read(4))[0]
2516 1
        self.ClientNonce = unpack_bytes(data)
2517 1
        self.RequestedLifetime = uatype_UInt32.unpack(data.read(4))[0]
2518
2519 1
    def __str__(self):
2520
        return 'OpenSecureChannelParameters(' + 'ClientProtocolVersion:' + str(self.ClientProtocolVersion) + ', ' + \
2521
               'RequestType:' + str(self.RequestType) + ', ' + \
2522
               'SecurityMode:' + str(self.SecurityMode) + ', ' + \
2523
               'ClientNonce:' + str(self.ClientNonce) + ', ' + \
2524
               'RequestedLifetime:' + str(self.RequestedLifetime) + ')'
2525
2526 1
    __repr__ = __str__
2527
2528
2529 1
class OpenSecureChannelRequest(FrozenClass):
2530
    '''
2531
    Creates a secure channel with a server.
2532
2533
    :ivar TypeId:
2534
    :vartype TypeId: NodeId
2535
    :ivar RequestHeader:
2536
    :vartype RequestHeader: RequestHeader
2537
    :ivar Parameters:
2538
    :vartype Parameters: OpenSecureChannelParameters
2539
    '''
2540 1
    def __init__(self, binary=None):
2541 1
        if binary is not None:
2542 1
            self._binary_init(binary)
2543 1
            self._freeze()
2544 1
            return
2545 1
        self.TypeId = FourByteNodeId(ObjectIds.OpenSecureChannelRequest_Encoding_DefaultBinary)
2546 1
        self.RequestHeader = RequestHeader()
2547 1
        self.Parameters = OpenSecureChannelParameters()
2548 1
        self._freeze()
2549
2550 1
    def to_binary(self):
2551 1
        packet = []
2552 1
        packet.append(self.TypeId.to_binary())
2553 1
        packet.append(self.RequestHeader.to_binary())
2554 1
        packet.append(self.Parameters.to_binary())
2555 1
        return b''.join(packet)
2556
2557 1
    @staticmethod
2558
    def from_binary(data):
2559 1
        return OpenSecureChannelRequest(data)
2560
2561 1
    def _binary_init(self, data):
2562 1
        self.TypeId = NodeId.from_binary(data)
2563 1
        self.RequestHeader = RequestHeader.from_binary(data)
2564 1
        self.Parameters = OpenSecureChannelParameters.from_binary(data)
2565
2566 1
    def __str__(self):
2567
        return 'OpenSecureChannelRequest(' + 'TypeId:' + str(self.TypeId) + ', ' + \
2568
               'RequestHeader:' + str(self.RequestHeader) + ', ' + \
2569
               'Parameters:' + str(self.Parameters) + ')'
2570
2571 1
    __repr__ = __str__
2572
2573
2574 1
class OpenSecureChannelResult(FrozenClass):
2575
    '''
2576
    :ivar ServerProtocolVersion:
2577
    :vartype ServerProtocolVersion: UInt32
2578
    :ivar SecurityToken:
2579
    :vartype SecurityToken: ChannelSecurityToken
2580
    :ivar ServerNonce:
2581
    :vartype ServerNonce: ByteString
2582
    '''
2583 1
    def __init__(self, binary=None):
2584 1
        if binary is not None:
2585 1
            self._binary_init(binary)
2586 1
            self._freeze()
2587 1
            return
2588 1
        self.ServerProtocolVersion = 0
2589 1
        self.SecurityToken = ChannelSecurityToken()
2590 1
        self.ServerNonce = b''
2591 1
        self._freeze()
2592
2593 1
    def to_binary(self):
2594 1
        packet = []
2595 1
        packet.append(uatype_UInt32.pack(self.ServerProtocolVersion))
2596 1
        packet.append(self.SecurityToken.to_binary())
2597 1
        packet.append(pack_bytes(self.ServerNonce))
2598 1
        return b''.join(packet)
2599
2600 1
    @staticmethod
2601
    def from_binary(data):
2602 1
        return OpenSecureChannelResult(data)
2603
2604 1
    def _binary_init(self, data):
2605 1
        self.ServerProtocolVersion = uatype_UInt32.unpack(data.read(4))[0]
2606 1
        self.SecurityToken = ChannelSecurityToken.from_binary(data)
2607 1
        self.ServerNonce = unpack_bytes(data)
2608
2609 1
    def __str__(self):
2610
        return 'OpenSecureChannelResult(' + 'ServerProtocolVersion:' + str(self.ServerProtocolVersion) + ', ' + \
2611
               'SecurityToken:' + str(self.SecurityToken) + ', ' + \
2612
               'ServerNonce:' + str(self.ServerNonce) + ')'
2613
2614 1
    __repr__ = __str__
2615
2616
2617 1
class OpenSecureChannelResponse(FrozenClass):
2618
    '''
2619
    Creates a secure channel with a server.
2620
2621
    :ivar TypeId:
2622
    :vartype TypeId: NodeId
2623
    :ivar ResponseHeader:
2624
    :vartype ResponseHeader: ResponseHeader
2625
    :ivar Parameters:
2626
    :vartype Parameters: OpenSecureChannelResult
2627
    '''
2628 1
    def __init__(self, binary=None):
2629 1
        if binary is not None:
2630 1
            self._binary_init(binary)
2631 1
            self._freeze()
2632 1
            return
2633 1
        self.TypeId = FourByteNodeId(ObjectIds.OpenSecureChannelResponse_Encoding_DefaultBinary)
2634 1
        self.ResponseHeader = ResponseHeader()
2635 1
        self.Parameters = OpenSecureChannelResult()
2636 1
        self._freeze()
2637
2638 1
    def to_binary(self):
2639 1
        packet = []
2640 1
        packet.append(self.TypeId.to_binary())
2641 1
        packet.append(self.ResponseHeader.to_binary())
2642 1
        packet.append(self.Parameters.to_binary())
2643 1
        return b''.join(packet)
2644
2645 1
    @staticmethod
2646
    def from_binary(data):
2647 1
        return OpenSecureChannelResponse(data)
2648
2649 1
    def _binary_init(self, data):
2650 1
        self.TypeId = NodeId.from_binary(data)
2651 1
        self.ResponseHeader = ResponseHeader.from_binary(data)
2652 1
        self.Parameters = OpenSecureChannelResult.from_binary(data)
2653
2654 1
    def __str__(self):
2655
        return 'OpenSecureChannelResponse(' + 'TypeId:' + str(self.TypeId) + ', ' + \
2656
               'ResponseHeader:' + str(self.ResponseHeader) + ', ' + \
2657
               'Parameters:' + str(self.Parameters) + ')'
2658
2659 1
    __repr__ = __str__
2660
2661
2662 1
class CloseSecureChannelRequest(FrozenClass):
2663
    '''
2664
    Closes a secure channel.
2665
2666
    :ivar TypeId:
2667
    :vartype TypeId: NodeId
2668
    :ivar RequestHeader:
2669
    :vartype RequestHeader: RequestHeader
2670
    '''
2671 1
    def __init__(self, binary=None):
2672 1
        if binary is not None:
2673
            self._binary_init(binary)
2674
            self._freeze()
2675
            return
2676 1
        self.TypeId = FourByteNodeId(ObjectIds.CloseSecureChannelRequest_Encoding_DefaultBinary)
2677 1
        self.RequestHeader = RequestHeader()
2678 1
        self._freeze()
2679
2680 1
    def to_binary(self):
2681 1
        packet = []
2682 1
        packet.append(self.TypeId.to_binary())
2683 1
        packet.append(self.RequestHeader.to_binary())
2684 1
        return b''.join(packet)
2685
2686 1
    @staticmethod
2687
    def from_binary(data):
2688
        return CloseSecureChannelRequest(data)
2689
2690 1
    def _binary_init(self, data):
2691
        self.TypeId = NodeId.from_binary(data)
2692
        self.RequestHeader = RequestHeader.from_binary(data)
2693
2694 1
    def __str__(self):
2695
        return 'CloseSecureChannelRequest(' + 'TypeId:' + str(self.TypeId) + ', ' + \
2696
               'RequestHeader:' + str(self.RequestHeader) + ')'
2697
2698 1
    __repr__ = __str__
2699
2700
2701 1
class CloseSecureChannelResponse(FrozenClass):
2702
    '''
2703
    Closes a secure channel.
2704
2705
    :ivar TypeId:
2706
    :vartype TypeId: NodeId
2707
    :ivar ResponseHeader:
2708
    :vartype ResponseHeader: ResponseHeader
2709
    '''
2710 1
    def __init__(self, binary=None):
2711
        if binary is not None:
2712
            self._binary_init(binary)
2713
            self._freeze()
2714
            return
2715
        self.TypeId = FourByteNodeId(ObjectIds.CloseSecureChannelResponse_Encoding_DefaultBinary)
2716
        self.ResponseHeader = ResponseHeader()
2717
        self._freeze()
2718
2719 1
    def to_binary(self):
2720
        packet = []
2721
        packet.append(self.TypeId.to_binary())
2722
        packet.append(self.ResponseHeader.to_binary())
2723
        return b''.join(packet)
2724
2725 1
    @staticmethod
2726
    def from_binary(data):
2727
        return CloseSecureChannelResponse(data)
2728
2729 1
    def _binary_init(self, data):
2730
        self.TypeId = NodeId.from_binary(data)
2731
        self.ResponseHeader = ResponseHeader.from_binary(data)
2732
2733 1
    def __str__(self):
2734
        return 'CloseSecureChannelResponse(' + 'TypeId:' + str(self.TypeId) + ', ' + \
2735
               'ResponseHeader:' + str(self.ResponseHeader) + ')'
2736
2737 1
    __repr__ = __str__
2738
2739
2740 1
class SignedSoftwareCertificate(FrozenClass):
2741
    '''
2742
    A software certificate with a digital signature.
2743
2744
    :ivar CertificateData:
2745
    :vartype CertificateData: ByteString
2746
    :ivar Signature:
2747
    :vartype Signature: ByteString
2748
    '''
2749 1
    def __init__(self, binary=None):
2750
        if binary is not None:
2751
            self._binary_init(binary)
2752
            self._freeze()
2753
            return
2754
        self.CertificateData = b''
2755
        self.Signature = b''
2756
        self._freeze()
2757
2758 1
    def to_binary(self):
2759
        packet = []
2760
        packet.append(pack_bytes(self.CertificateData))
2761
        packet.append(pack_bytes(self.Signature))
2762
        return b''.join(packet)
2763
2764 1
    @staticmethod
2765
    def from_binary(data):
2766
        return SignedSoftwareCertificate(data)
2767
2768 1
    def _binary_init(self, data):
2769
        self.CertificateData = unpack_bytes(data)
2770
        self.Signature = unpack_bytes(data)
2771
2772 1
    def __str__(self):
2773
        return 'SignedSoftwareCertificate(' + 'CertificateData:' + str(self.CertificateData) + ', ' + \
2774
               'Signature:' + str(self.Signature) + ')'
2775
2776 1
    __repr__ = __str__
2777
2778
2779 1
class SignatureData(FrozenClass):
2780
    '''
2781
    A digital signature.
2782
2783
    :ivar Algorithm:
2784
    :vartype Algorithm: String
2785
    :ivar Signature:
2786
    :vartype Signature: ByteString
2787
    '''
2788 1
    def __init__(self, binary=None):
2789 1
        if binary is not None:
2790 1
            self._binary_init(binary)
2791 1
            self._freeze()
2792 1
            return
2793 1
        self.Algorithm = ''
2794 1
        self.Signature = b''
2795 1
        self._freeze()
2796
2797 1
    def to_binary(self):
2798 1
        packet = []
2799 1
        packet.append(pack_string(self.Algorithm))
2800 1
        packet.append(pack_bytes(self.Signature))
2801 1
        return b''.join(packet)
2802
2803 1
    @staticmethod
2804
    def from_binary(data):
2805 1
        return SignatureData(data)
2806
2807 1
    def _binary_init(self, data):
2808 1
        self.Algorithm = unpack_string(data)
2809 1
        self.Signature = unpack_bytes(data)
2810
2811 1
    def __str__(self):
2812
        return 'SignatureData(' + 'Algorithm:' + str(self.Algorithm) + ', ' + \
2813
               'Signature:' + str(self.Signature) + ')'
2814
2815 1
    __repr__ = __str__
2816
2817
2818 1
class CreateSessionParameters(FrozenClass):
2819
    '''
2820
    :ivar ClientDescription:
2821
    :vartype ClientDescription: ApplicationDescription
2822
    :ivar ServerUri:
2823
    :vartype ServerUri: String
2824
    :ivar EndpointUrl:
2825
    :vartype EndpointUrl: String
2826
    :ivar SessionName:
2827
    :vartype SessionName: String
2828
    :ivar ClientNonce:
2829
    :vartype ClientNonce: ByteString
2830
    :ivar ClientCertificate:
2831
    :vartype ClientCertificate: ByteString
2832
    :ivar RequestedSessionTimeout:
2833
    :vartype RequestedSessionTimeout: Double
2834
    :ivar MaxResponseMessageSize:
2835
    :vartype MaxResponseMessageSize: UInt32
2836
    '''
2837 1
    def __init__(self, binary=None):
2838 1
        if binary is not None:
2839 1
            self._binary_init(binary)
2840 1
            self._freeze()
2841 1
            return
2842 1
        self.ClientDescription = ApplicationDescription()
2843 1
        self.ServerUri = ''
2844 1
        self.EndpointUrl = ''
2845 1
        self.SessionName = ''
2846 1
        self.ClientNonce = b''
2847 1
        self.ClientCertificate = b''
2848 1
        self.RequestedSessionTimeout = 0
2849 1
        self.MaxResponseMessageSize = 0
2850 1
        self._freeze()
2851
2852 1
    def to_binary(self):
2853 1
        packet = []
2854 1
        packet.append(self.ClientDescription.to_binary())
2855 1
        packet.append(pack_string(self.ServerUri))
2856 1
        packet.append(pack_string(self.EndpointUrl))
2857 1
        packet.append(pack_string(self.SessionName))
2858 1
        packet.append(pack_bytes(self.ClientNonce))
2859 1
        packet.append(pack_bytes(self.ClientCertificate))
2860 1
        packet.append(uatype_Double.pack(self.RequestedSessionTimeout))
2861 1
        packet.append(uatype_UInt32.pack(self.MaxResponseMessageSize))
2862 1
        return b''.join(packet)
2863
2864 1
    @staticmethod
2865
    def from_binary(data):
2866 1
        return CreateSessionParameters(data)
2867
2868 1
    def _binary_init(self, data):
2869 1
        self.ClientDescription = ApplicationDescription.from_binary(data)
2870 1
        self.ServerUri = unpack_string(data)
2871 1
        self.EndpointUrl = unpack_string(data)
2872 1
        self.SessionName = unpack_string(data)
2873 1
        self.ClientNonce = unpack_bytes(data)
2874 1
        self.ClientCertificate = unpack_bytes(data)
2875 1
        self.RequestedSessionTimeout = uatype_Double.unpack(data.read(8))[0]
2876 1
        self.MaxResponseMessageSize = uatype_UInt32.unpack(data.read(4))[0]
2877
2878 1
    def __str__(self):
2879
        return 'CreateSessionParameters(' + 'ClientDescription:' + str(self.ClientDescription) + ', ' + \
2880
               'ServerUri:' + str(self.ServerUri) + ', ' + \
2881
               'EndpointUrl:' + str(self.EndpointUrl) + ', ' + \
2882
               'SessionName:' + str(self.SessionName) + ', ' + \
2883
               'ClientNonce:' + str(self.ClientNonce) + ', ' + \
2884
               'ClientCertificate:' + str(self.ClientCertificate) + ', ' + \
2885
               'RequestedSessionTimeout:' + str(self.RequestedSessionTimeout) + ', ' + \
2886
               'MaxResponseMessageSize:' + str(self.MaxResponseMessageSize) + ')'
2887
2888 1
    __repr__ = __str__
2889
2890
2891 1
class CreateSessionRequest(FrozenClass):
2892
    '''
2893
    Creates a new session with the server.
2894
2895
    :ivar TypeId:
2896
    :vartype TypeId: NodeId
2897
    :ivar RequestHeader:
2898
    :vartype RequestHeader: RequestHeader
2899
    :ivar Parameters:
2900
    :vartype Parameters: CreateSessionParameters
2901
    '''
2902 1
    def __init__(self, binary=None):
2903 1
        if binary is not None:
2904
            self._binary_init(binary)
2905
            self._freeze()
2906
            return
2907 1
        self.TypeId = FourByteNodeId(ObjectIds.CreateSessionRequest_Encoding_DefaultBinary)
2908 1
        self.RequestHeader = RequestHeader()
2909 1
        self.Parameters = CreateSessionParameters()
2910 1
        self._freeze()
2911
2912 1
    def to_binary(self):
2913 1
        packet = []
2914 1
        packet.append(self.TypeId.to_binary())
2915 1
        packet.append(self.RequestHeader.to_binary())
2916 1
        packet.append(self.Parameters.to_binary())
2917 1
        return b''.join(packet)
2918
2919 1
    @staticmethod
2920
    def from_binary(data):
2921
        return CreateSessionRequest(data)
2922
2923 1
    def _binary_init(self, data):
2924
        self.TypeId = NodeId.from_binary(data)
2925
        self.RequestHeader = RequestHeader.from_binary(data)
2926
        self.Parameters = CreateSessionParameters.from_binary(data)
2927
2928 1
    def __str__(self):
2929
        return 'CreateSessionRequest(' + 'TypeId:' + str(self.TypeId) + ', ' + \
2930
               'RequestHeader:' + str(self.RequestHeader) + ', ' + \
2931
               'Parameters:' + str(self.Parameters) + ')'
2932
2933 1
    __repr__ = __str__
2934
2935
2936 1
class CreateSessionResult(FrozenClass):
2937
    '''
2938
    :ivar SessionId:
2939
    :vartype SessionId: NodeId
2940
    :ivar AuthenticationToken:
2941
    :vartype AuthenticationToken: NodeId
2942
    :ivar RevisedSessionTimeout:
2943
    :vartype RevisedSessionTimeout: Double
2944
    :ivar ServerNonce:
2945
    :vartype ServerNonce: ByteString
2946
    :ivar ServerCertificate:
2947
    :vartype ServerCertificate: ByteString
2948
    :ivar ServerEndpoints:
2949
    :vartype ServerEndpoints: EndpointDescription
2950
    :ivar ServerSoftwareCertificates:
2951
    :vartype ServerSoftwareCertificates: SignedSoftwareCertificate
2952
    :ivar ServerSignature:
2953
    :vartype ServerSignature: SignatureData
2954
    :ivar MaxRequestMessageSize:
2955
    :vartype MaxRequestMessageSize: UInt32
2956
    '''
2957 1
    def __init__(self, binary=None):
2958 1
        if binary is not None:
2959 1
            self._binary_init(binary)
2960 1
            self._freeze()
2961 1
            return
2962 1
        self.SessionId = NodeId()
2963 1
        self.AuthenticationToken = NodeId()
2964 1
        self.RevisedSessionTimeout = 0
2965 1
        self.ServerNonce = b''
2966 1
        self.ServerCertificate = b''
2967 1
        self.ServerEndpoints = []
2968 1
        self.ServerSoftwareCertificates = []
2969 1
        self.ServerSignature = SignatureData()
2970 1
        self.MaxRequestMessageSize = 0
2971 1
        self._freeze()
2972
2973 1
    def to_binary(self):
2974 1
        packet = []
2975 1
        packet.append(self.SessionId.to_binary())
2976 1
        packet.append(self.AuthenticationToken.to_binary())
2977 1
        packet.append(uatype_Double.pack(self.RevisedSessionTimeout))
2978 1
        packet.append(pack_bytes(self.ServerNonce))
2979 1
        packet.append(pack_bytes(self.ServerCertificate))
2980 1
        packet.append(uatype_Int32.pack(len(self.ServerEndpoints)))
2981 1
        for fieldname in self.ServerEndpoints:
2982 1
            packet.append(fieldname.to_binary())
2983 1
        packet.append(uatype_Int32.pack(len(self.ServerSoftwareCertificates)))
2984 1
        for fieldname in self.ServerSoftwareCertificates:
2985
            packet.append(fieldname.to_binary())
2986 1
        packet.append(self.ServerSignature.to_binary())
2987 1
        packet.append(uatype_UInt32.pack(self.MaxRequestMessageSize))
2988 1
        return b''.join(packet)
2989
2990 1
    @staticmethod
2991
    def from_binary(data):
2992 1
        return CreateSessionResult(data)
2993
2994 1
    def _binary_init(self, data):
2995 1
        self.SessionId = NodeId.from_binary(data)
2996 1
        self.AuthenticationToken = NodeId.from_binary(data)
2997 1
        self.RevisedSessionTimeout = uatype_Double.unpack(data.read(8))[0]
2998 1
        self.ServerNonce = unpack_bytes(data)
2999 1
        self.ServerCertificate = unpack_bytes(data)
3000 1
        length = uatype_Int32.unpack(data.read(4))[0]
3001 1
        array = []
3002 1
        if length != -1:
3003 1
            for _ in range(0, length):
3004 1
                array.append(EndpointDescription.from_binary(data))
3005 1
        self.ServerEndpoints = array
3006 1
        length = uatype_Int32.unpack(data.read(4))[0]
3007 1
        array = []
3008 1
        if length != -1:
3009 1
            for _ in range(0, length):
3010
                array.append(SignedSoftwareCertificate.from_binary(data))
3011 1
        self.ServerSoftwareCertificates = array
3012 1
        self.ServerSignature = SignatureData.from_binary(data)
3013 1
        self.MaxRequestMessageSize = uatype_UInt32.unpack(data.read(4))[0]
3014
3015 1
    def __str__(self):
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
3016
        return 'CreateSessionResult(' + 'SessionId:' + str(self.SessionId) + ', ' + \
3017
               'AuthenticationToken:' + str(self.AuthenticationToken) + ', ' + \
3018
               'RevisedSessionTimeout:' + str(self.RevisedSessionTimeout) + ', ' + \
3019
               'ServerNonce:' + str(self.ServerNonce) + ', ' + \
3020
               'ServerCertificate:' + str(self.ServerCertificate) + ', ' + \
3021
               'ServerEndpoints:' + str(self.ServerEndpoints) + ', ' + \
3022
               'ServerSoftwareCertificates:' + str(self.ServerSoftwareCertificates) + ', ' + \
3023
               'ServerSignature:' + str(self.ServerSignature) + ', ' + \
3024
               'MaxRequestMessageSize:' + str(self.MaxRequestMessageSize) + ')'
3025
3026 1
    __repr__ = __str__
3027
3028
3029 1
class CreateSessionResponse(FrozenClass):
3030
    '''
3031
    Creates a new session with the server.
3032
3033
    :ivar TypeId:
3034
    :vartype TypeId: NodeId
3035
    :ivar ResponseHeader:
3036
    :vartype ResponseHeader: ResponseHeader
3037
    :ivar Parameters:
3038
    :vartype Parameters: CreateSessionResult
3039
    '''
3040 1
    def __init__(self, binary=None):
3041 1
        if binary is not None:
3042 1
            self._binary_init(binary)
3043 1
            self._freeze()
3044 1
            return
3045 1
        self.TypeId = FourByteNodeId(ObjectIds.CreateSessionResponse_Encoding_DefaultBinary)
3046 1
        self.ResponseHeader = ResponseHeader()
3047 1
        self.Parameters = CreateSessionResult()
3048 1
        self._freeze()
3049
3050 1
    def to_binary(self):
3051 1
        packet = []
3052 1
        packet.append(self.TypeId.to_binary())
3053 1
        packet.append(self.ResponseHeader.to_binary())
3054 1
        packet.append(self.Parameters.to_binary())
3055 1
        return b''.join(packet)
3056
3057 1
    @staticmethod
3058
    def from_binary(data):
3059 1
        return CreateSessionResponse(data)
3060
3061 1
    def _binary_init(self, data):
3062 1
        self.TypeId = NodeId.from_binary(data)
3063 1
        self.ResponseHeader = ResponseHeader.from_binary(data)
3064 1
        self.Parameters = CreateSessionResult.from_binary(data)
3065
3066 1
    def __str__(self):
3067
        return 'CreateSessionResponse(' + 'TypeId:' + str(self.TypeId) + ', ' + \
3068
               'ResponseHeader:' + str(self.ResponseHeader) + ', ' + \
3069
               'Parameters:' + str(self.Parameters) + ')'
3070
3071 1
    __repr__ = __str__
3072
3073
3074 1
class UserIdentityToken(FrozenClass):
3075
    '''
3076
    A base type for a user identity token.
3077
3078
    :ivar PolicyId:
3079
    :vartype PolicyId: String
3080
    '''
3081 1
    def __init__(self, binary=None):
3082
        if binary is not None:
3083
            self._binary_init(binary)
3084
            self._freeze()
3085
            return
3086
        self.PolicyId = ''
3087
        self._freeze()
3088
3089 1
    def to_binary(self):
3090
        packet = []
3091
        packet.append(pack_string(self.PolicyId))
3092
        return b''.join(packet)
3093
3094 1
    @staticmethod
3095
    def from_binary(data):
3096
        return UserIdentityToken(data)
3097
3098 1
    def _binary_init(self, data):
3099
        self.PolicyId = unpack_string(data)
3100
3101 1
    def __str__(self):
3102
        return 'UserIdentityToken(' + 'PolicyId:' + str(self.PolicyId) + ')'
3103
3104 1
    __repr__ = __str__
3105
3106
3107 1
class AnonymousIdentityToken(FrozenClass):
3108
    '''
3109
    A token representing an anonymous user.
3110
3111
    :ivar PolicyId:
3112
    :vartype PolicyId: String
3113
    '''
3114 1
    def __init__(self, binary=None):
3115 1
        if binary is not None:
3116 1
            self._binary_init(binary)
3117 1
            self._freeze()
3118 1
            return
3119 1
        self.PolicyId = ''
3120 1
        self._freeze()
3121
3122 1
    def to_binary(self):
3123 1
        packet = []
3124 1
        packet.append(pack_string(self.PolicyId))
3125 1
        return b''.join(packet)
3126
3127 1
    @staticmethod
3128
    def from_binary(data):
3129 1
        return AnonymousIdentityToken(data)
3130
3131 1
    def _binary_init(self, data):
3132 1
        self.PolicyId = unpack_string(data)
3133
3134 1
    def __str__(self):
3135
        return 'AnonymousIdentityToken(' + 'PolicyId:' + str(self.PolicyId) + ')'
3136
3137 1
    __repr__ = __str__
3138
3139
3140 1
class UserNameIdentityToken(FrozenClass):
3141
    '''
3142
    A token representing a user identified by a user name and password.
3143
3144
    :ivar PolicyId:
3145
    :vartype PolicyId: String
3146
    :ivar UserName:
3147
    :vartype UserName: String
3148
    :ivar Password:
3149
    :vartype Password: ByteString
3150
    :ivar EncryptionAlgorithm:
3151
    :vartype EncryptionAlgorithm: String
3152
    '''
3153 1
    def __init__(self, binary=None):
3154 1
        if binary is not None:
3155 1
            self._binary_init(binary)
3156 1
            self._freeze()
3157 1
            return
3158 1
        self.PolicyId = ''
3159 1
        self.UserName = ''
3160 1
        self.Password = b''
3161 1
        self.EncryptionAlgorithm = ''
3162 1
        self._freeze()
3163
3164 1
    def to_binary(self):
3165 1
        packet = []
3166 1
        packet.append(pack_string(self.PolicyId))
3167 1
        packet.append(pack_string(self.UserName))
3168 1
        packet.append(pack_bytes(self.Password))
3169 1
        packet.append(pack_string(self.EncryptionAlgorithm))
3170 1
        return b''.join(packet)
3171
3172 1
    @staticmethod
3173
    def from_binary(data):
3174 1
        return UserNameIdentityToken(data)
3175
3176 1
    def _binary_init(self, data):
3177 1
        self.PolicyId = unpack_string(data)
3178 1
        self.UserName = unpack_string(data)
3179 1
        self.Password = unpack_bytes(data)
3180 1
        self.EncryptionAlgorithm = unpack_string(data)
3181
3182 1
    def __str__(self):
3183
        return 'UserNameIdentityToken(' + 'PolicyId:' + str(self.PolicyId) + ', ' + \
3184
               'UserName:' + str(self.UserName) + ', ' + \
3185
               'Password:' + str(self.Password) + ', ' + \
3186
               'EncryptionAlgorithm:' + str(self.EncryptionAlgorithm) + ')'
3187
3188 1
    __repr__ = __str__
3189
3190
3191 1
class X509IdentityToken(FrozenClass):
3192
    '''
3193
    A token representing a user identified by an X509 certificate.
3194
3195
    :ivar PolicyId:
3196
    :vartype PolicyId: String
3197
    :ivar CertificateData:
3198
    :vartype CertificateData: ByteString
3199
    '''
3200 1
    def __init__(self, binary=None):
3201
        if binary is not None:
3202
            self._binary_init(binary)
3203
            self._freeze()
3204
            return
3205
        self.PolicyId = ''
3206
        self.CertificateData = b''
3207
        self._freeze()
3208
3209 1
    def to_binary(self):
3210
        packet = []
3211
        packet.append(pack_string(self.PolicyId))
3212
        packet.append(pack_bytes(self.CertificateData))
3213
        return b''.join(packet)
3214
3215 1
    @staticmethod
3216
    def from_binary(data):
3217
        return X509IdentityToken(data)
3218
3219 1
    def _binary_init(self, data):
3220
        self.PolicyId = unpack_string(data)
3221
        self.CertificateData = unpack_bytes(data)
3222
3223 1
    def __str__(self):
3224
        return 'X509IdentityToken(' + 'PolicyId:' + str(self.PolicyId) + ', ' + \
3225
               'CertificateData:' + str(self.CertificateData) + ')'
3226
3227 1
    __repr__ = __str__
3228
3229
3230 1
class KerberosIdentityToken(FrozenClass):
3231
    '''
3232
    :ivar PolicyId:
3233
    :vartype PolicyId: String
3234
    :ivar TicketData:
3235
    :vartype TicketData: ByteString
3236
    '''
3237 1
    def __init__(self, binary=None):
3238
        if binary is not None:
3239
            self._binary_init(binary)
3240
            self._freeze()
3241
            return
3242
        self.PolicyId = ''
3243
        self.TicketData = b''
3244
        self._freeze()
3245
3246 1
    def to_binary(self):
3247
        packet = []
3248
        packet.append(pack_string(self.PolicyId))
3249
        packet.append(pack_bytes(self.TicketData))
3250
        return b''.join(packet)
3251
3252 1
    @staticmethod
3253
    def from_binary(data):
3254
        return KerberosIdentityToken(data)
3255
3256 1
    def _binary_init(self, data):
3257
        self.PolicyId = unpack_string(data)
3258
        self.TicketData = unpack_bytes(data)
3259
3260 1
    def __str__(self):
3261
        return 'KerberosIdentityToken(' + 'PolicyId:' + str(self.PolicyId) + ', ' + \
3262
               'TicketData:' + str(self.TicketData) + ')'
3263
3264 1
    __repr__ = __str__
3265
3266
3267 1
class IssuedIdentityToken(FrozenClass):
3268
    '''
3269
    A token representing a user identified by a WS-Security XML token.
3270
3271
    :ivar PolicyId:
3272
    :vartype PolicyId: String
3273
    :ivar TokenData:
3274
    :vartype TokenData: ByteString
3275
    :ivar EncryptionAlgorithm:
3276
    :vartype EncryptionAlgorithm: String
3277
    '''
3278 1
    def __init__(self, binary=None):
3279
        if binary is not None:
3280
            self._binary_init(binary)
3281
            self._freeze()
3282
            return
3283
        self.PolicyId = ''
3284
        self.TokenData = b''
3285
        self.EncryptionAlgorithm = ''
3286
        self._freeze()
3287
3288 1
    def to_binary(self):
3289
        packet = []
3290
        packet.append(pack_string(self.PolicyId))
3291
        packet.append(pack_bytes(self.TokenData))
3292
        packet.append(pack_string(self.EncryptionAlgorithm))
3293
        return b''.join(packet)
3294
3295 1
    @staticmethod
3296
    def from_binary(data):
3297
        return IssuedIdentityToken(data)
3298
3299 1
    def _binary_init(self, data):
3300
        self.PolicyId = unpack_string(data)
3301
        self.TokenData = unpack_bytes(data)
3302
        self.EncryptionAlgorithm = unpack_string(data)
3303
3304 1
    def __str__(self):
3305
        return 'IssuedIdentityToken(' + 'PolicyId:' + str(self.PolicyId) + ', ' + \
3306
               'TokenData:' + str(self.TokenData) + ', ' + \
3307
               'EncryptionAlgorithm:' + str(self.EncryptionAlgorithm) + ')'
3308
3309 1
    __repr__ = __str__
3310
3311
3312 1
class ActivateSessionParameters(FrozenClass):
3313
    '''
3314
    :ivar ClientSignature:
3315
    :vartype ClientSignature: SignatureData
3316
    :ivar ClientSoftwareCertificates:
3317
    :vartype ClientSoftwareCertificates: SignedSoftwareCertificate
3318
    :ivar LocaleIds:
3319
    :vartype LocaleIds: String
3320
    :ivar UserIdentityToken:
3321
    :vartype UserIdentityToken: ExtensionObject
3322
    :ivar UserTokenSignature:
3323
    :vartype UserTokenSignature: SignatureData
3324
    '''
3325 1
    def __init__(self, binary=None):
3326 1
        if binary is not None:
3327 1
            self._binary_init(binary)
3328 1
            self._freeze()
3329 1
            return
3330 1
        self.ClientSignature = SignatureData()
3331 1
        self.ClientSoftwareCertificates = []
3332 1
        self.LocaleIds = []
3333 1
        self.UserIdentityToken = None
3334 1
        self.UserTokenSignature = SignatureData()
3335 1
        self._freeze()
3336
3337 1
    def to_binary(self):
3338 1
        packet = []
3339 1
        packet.append(self.ClientSignature.to_binary())
3340 1
        packet.append(uatype_Int32.pack(len(self.ClientSoftwareCertificates)))
3341 1
        for fieldname in self.ClientSoftwareCertificates:
3342
            packet.append(fieldname.to_binary())
3343 1
        packet.append(uatype_Int32.pack(len(self.LocaleIds)))
3344 1
        for fieldname in self.LocaleIds:
3345 1
            packet.append(pack_string(fieldname))
3346 1
        packet.append(extensionobject_to_binary(self.UserIdentityToken))
3347 1
        packet.append(self.UserTokenSignature.to_binary())
3348 1
        return b''.join(packet)
3349
3350 1
    @staticmethod
3351
    def from_binary(data):
3352 1
        return ActivateSessionParameters(data)
3353
3354 1
    def _binary_init(self, data):
3355 1
        self.ClientSignature = SignatureData.from_binary(data)
3356 1
        length = uatype_Int32.unpack(data.read(4))[0]
3357 1
        array = []
3358 1
        if length != -1:
3359 1
            for _ in range(0, length):
3360
                array.append(SignedSoftwareCertificate.from_binary(data))
3361 1
        self.ClientSoftwareCertificates = array
3362 1
        self.LocaleIds = unpack_uatype_array('String', data)
3363 1
        self.UserIdentityToken = extensionobject_from_binary(data)
3364 1
        self.UserTokenSignature = SignatureData.from_binary(data)
3365
3366 1
    def __str__(self):
3367
        return 'ActivateSessionParameters(' + 'ClientSignature:' + str(self.ClientSignature) + ', ' + \
3368
               'ClientSoftwareCertificates:' + str(self.ClientSoftwareCertificates) + ', ' + \
3369
               'LocaleIds:' + str(self.LocaleIds) + ', ' + \
3370
               'UserIdentityToken:' + str(self.UserIdentityToken) + ', ' + \
3371
               'UserTokenSignature:' + str(self.UserTokenSignature) + ')'
3372
3373 1
    __repr__ = __str__
3374
3375
3376 1
class ActivateSessionRequest(FrozenClass):
3377
    '''
3378
    Activates a session with the server.
3379
3380
    :ivar TypeId:
3381
    :vartype TypeId: NodeId
3382
    :ivar RequestHeader:
3383
    :vartype RequestHeader: RequestHeader
3384
    :ivar Parameters:
3385
    :vartype Parameters: ActivateSessionParameters
3386
    '''
3387 1
    def __init__(self, binary=None):
3388 1
        if binary is not None:
3389
            self._binary_init(binary)
3390
            self._freeze()
3391
            return
3392 1
        self.TypeId = FourByteNodeId(ObjectIds.ActivateSessionRequest_Encoding_DefaultBinary)
3393 1
        self.RequestHeader = RequestHeader()
3394 1
        self.Parameters = ActivateSessionParameters()
3395 1
        self._freeze()
3396
3397 1
    def to_binary(self):
3398 1
        packet = []
3399 1
        packet.append(self.TypeId.to_binary())
3400 1
        packet.append(self.RequestHeader.to_binary())
3401 1
        packet.append(self.Parameters.to_binary())
3402 1
        return b''.join(packet)
3403
3404 1
    @staticmethod
3405
    def from_binary(data):
3406
        return ActivateSessionRequest(data)
3407
3408 1
    def _binary_init(self, data):
3409
        self.TypeId = NodeId.from_binary(data)
3410
        self.RequestHeader = RequestHeader.from_binary(data)
3411
        self.Parameters = ActivateSessionParameters.from_binary(data)
3412
3413 1
    def __str__(self):
3414
        return 'ActivateSessionRequest(' + 'TypeId:' + str(self.TypeId) + ', ' + \
3415
               'RequestHeader:' + str(self.RequestHeader) + ', ' + \
3416
               'Parameters:' + str(self.Parameters) + ')'
3417
3418 1
    __repr__ = __str__
3419
3420
3421 1
class ActivateSessionResult(FrozenClass):
3422
    '''
3423
    :ivar ServerNonce:
3424
    :vartype ServerNonce: ByteString
3425
    :ivar Results:
3426
    :vartype Results: StatusCode
3427
    :ivar DiagnosticInfos:
3428
    :vartype DiagnosticInfos: DiagnosticInfo
3429
    '''
3430 1
    def __init__(self, binary=None):
3431 1
        if binary is not None:
3432 1
            self._binary_init(binary)
3433 1
            self._freeze()
3434 1
            return
3435 1
        self.ServerNonce = b''
3436 1
        self.Results = []
3437 1
        self.DiagnosticInfos = []
3438 1
        self._freeze()
3439
3440 1
    def to_binary(self):
3441 1
        packet = []
3442 1
        packet.append(pack_bytes(self.ServerNonce))
3443 1
        packet.append(uatype_Int32.pack(len(self.Results)))
3444 1
        for fieldname in self.Results:
3445
            packet.append(fieldname.to_binary())
3446 1
        packet.append(uatype_Int32.pack(len(self.DiagnosticInfos)))
3447 1
        for fieldname in self.DiagnosticInfos:
3448
            packet.append(fieldname.to_binary())
3449 1
        return b''.join(packet)
3450
3451 1
    @staticmethod
3452
    def from_binary(data):
3453 1
        return ActivateSessionResult(data)
3454
3455 1
    def _binary_init(self, data):
3456 1
        self.ServerNonce = unpack_bytes(data)
3457 1
        length = uatype_Int32.unpack(data.read(4))[0]
3458 1
        array = []
3459 1
        if length != -1:
3460 1
            for _ in range(0, length):
3461
                array.append(StatusCode.from_binary(data))
3462 1
        self.Results = array
3463 1
        length = uatype_Int32.unpack(data.read(4))[0]
3464 1
        array = []
3465 1
        if length != -1:
3466 1
            for _ in range(0, length):
3467
                array.append(DiagnosticInfo.from_binary(data))
3468 1
        self.DiagnosticInfos = array
3469
3470 1
    def __str__(self):
3471
        return 'ActivateSessionResult(' + 'ServerNonce:' + str(self.ServerNonce) + ', ' + \
3472
               'Results:' + str(self.Results) + ', ' + \
3473
               'DiagnosticInfos:' + str(self.DiagnosticInfos) + ')'
3474
3475 1
    __repr__ = __str__
3476
3477
3478 1
class ActivateSessionResponse(FrozenClass):
3479
    '''
3480
    Activates a session with the server.
3481
3482
    :ivar TypeId:
3483
    :vartype TypeId: NodeId
3484
    :ivar ResponseHeader:
3485
    :vartype ResponseHeader: ResponseHeader
3486
    :ivar Parameters:
3487
    :vartype Parameters: ActivateSessionResult
3488
    '''
3489 1
    def __init__(self, binary=None):
3490 1
        if binary is not None:
3491 1
            self._binary_init(binary)
3492 1
            self._freeze()
3493 1
            return
3494 1
        self.TypeId = FourByteNodeId(ObjectIds.ActivateSessionResponse_Encoding_DefaultBinary)
3495 1
        self.ResponseHeader = ResponseHeader()
3496 1
        self.Parameters = ActivateSessionResult()
3497 1
        self._freeze()
3498
3499 1
    def to_binary(self):
3500 1
        packet = []
3501 1
        packet.append(self.TypeId.to_binary())
3502 1
        packet.append(self.ResponseHeader.to_binary())
3503 1
        packet.append(self.Parameters.to_binary())
3504 1
        return b''.join(packet)
3505
3506 1
    @staticmethod
3507
    def from_binary(data):
3508 1
        return ActivateSessionResponse(data)
3509
3510 1
    def _binary_init(self, data):
3511 1
        self.TypeId = NodeId.from_binary(data)
3512 1
        self.ResponseHeader = ResponseHeader.from_binary(data)
3513 1
        self.Parameters = ActivateSessionResult.from_binary(data)
3514
3515 1
    def __str__(self):
3516
        return 'ActivateSessionResponse(' + 'TypeId:' + str(self.TypeId) + ', ' + \
3517
               'ResponseHeader:' + str(self.ResponseHeader) + ', ' + \
3518
               'Parameters:' + str(self.Parameters) + ')'
3519
3520 1
    __repr__ = __str__
3521
3522
3523 1
class CloseSessionRequest(FrozenClass):
3524
    '''
3525
    Closes a session with the server.
3526
3527
    :ivar TypeId:
3528
    :vartype TypeId: NodeId
3529
    :ivar RequestHeader:
3530
    :vartype RequestHeader: RequestHeader
3531
    :ivar DeleteSubscriptions:
3532
    :vartype DeleteSubscriptions: Boolean
3533
    '''
3534 1
    def __init__(self, binary=None):
3535 1
        if binary is not None:
3536
            self._binary_init(binary)
3537
            self._freeze()
3538
            return
3539 1
        self.TypeId = FourByteNodeId(ObjectIds.CloseSessionRequest_Encoding_DefaultBinary)
3540 1
        self.RequestHeader = RequestHeader()
3541 1
        self.DeleteSubscriptions = True
3542 1
        self._freeze()
3543
3544 1
    def to_binary(self):
3545 1
        packet = []
3546 1
        packet.append(self.TypeId.to_binary())
3547 1
        packet.append(self.RequestHeader.to_binary())
3548 1
        packet.append(uatype_Boolean.pack(self.DeleteSubscriptions))
3549 1
        return b''.join(packet)
3550
3551 1
    @staticmethod
3552
    def from_binary(data):
3553
        return CloseSessionRequest(data)
3554
3555 1
    def _binary_init(self, data):
3556
        self.TypeId = NodeId.from_binary(data)
3557
        self.RequestHeader = RequestHeader.from_binary(data)
3558
        self.DeleteSubscriptions = uatype_Boolean.unpack(data.read(1))[0]
3559
3560 1
    def __str__(self):
3561
        return 'CloseSessionRequest(' + 'TypeId:' + str(self.TypeId) + ', ' + \
3562
               'RequestHeader:' + str(self.RequestHeader) + ', ' + \
3563
               'DeleteSubscriptions:' + str(self.DeleteSubscriptions) + ')'
3564
3565 1
    __repr__ = __str__
3566
3567
3568 1
class CloseSessionResponse(FrozenClass):
3569
    '''
3570
    Closes a session with the server.
3571
3572
    :ivar TypeId:
3573
    :vartype TypeId: NodeId
3574
    :ivar ResponseHeader:
3575
    :vartype ResponseHeader: ResponseHeader
3576
    '''
3577 1
    def __init__(self, binary=None):
3578 1
        if binary is not None:
3579 1
            self._binary_init(binary)
3580 1
            self._freeze()
3581 1
            return
3582 1
        self.TypeId = FourByteNodeId(ObjectIds.CloseSessionResponse_Encoding_DefaultBinary)
3583 1
        self.ResponseHeader = ResponseHeader()
3584 1
        self._freeze()
3585
3586 1
    def to_binary(self):
3587 1
        packet = []
3588 1
        packet.append(self.TypeId.to_binary())
3589 1
        packet.append(self.ResponseHeader.to_binary())
3590 1
        return b''.join(packet)
3591
3592 1
    @staticmethod
3593
    def from_binary(data):
3594 1
        return CloseSessionResponse(data)
3595
3596 1
    def _binary_init(self, data):
3597 1
        self.TypeId = NodeId.from_binary(data)
3598 1
        self.ResponseHeader = ResponseHeader.from_binary(data)
3599
3600 1
    def __str__(self):
3601
        return 'CloseSessionResponse(' + 'TypeId:' + str(self.TypeId) + ', ' + \
3602
               'ResponseHeader:' + str(self.ResponseHeader) + ')'
3603
3604 1
    __repr__ = __str__
3605
3606
3607 1
class CancelParameters(FrozenClass):
3608
    '''
3609
    :ivar RequestHandle:
3610
    :vartype RequestHandle: UInt32
3611
    '''
3612 1
    def __init__(self, binary=None):
3613
        if binary is not None:
3614
            self._binary_init(binary)
3615
            self._freeze()
3616
            return
3617
        self.RequestHandle = 0
3618
        self._freeze()
3619
3620 1
    def to_binary(self):
3621
        packet = []
3622
        packet.append(uatype_UInt32.pack(self.RequestHandle))
3623
        return b''.join(packet)
3624
3625 1
    @staticmethod
3626
    def from_binary(data):
3627
        return CancelParameters(data)
3628
3629 1
    def _binary_init(self, data):
3630
        self.RequestHandle = uatype_UInt32.unpack(data.read(4))[0]
3631
3632 1
    def __str__(self):
3633
        return 'CancelParameters(' + 'RequestHandle:' + str(self.RequestHandle) + ')'
3634
3635 1
    __repr__ = __str__
3636
3637
3638 1
class CancelRequest(FrozenClass):
3639
    '''
3640
    Cancels an outstanding request.
3641
3642
    :ivar TypeId:
3643
    :vartype TypeId: NodeId
3644
    :ivar RequestHeader:
3645
    :vartype RequestHeader: RequestHeader
3646
    :ivar Parameters:
3647
    :vartype Parameters: CancelParameters
3648
    '''
3649 1
    def __init__(self, binary=None):
3650
        if binary is not None:
3651
            self._binary_init(binary)
3652
            self._freeze()
3653
            return
3654
        self.TypeId = FourByteNodeId(ObjectIds.CancelRequest_Encoding_DefaultBinary)
3655
        self.RequestHeader = RequestHeader()
3656
        self.Parameters = CancelParameters()
3657
        self._freeze()
3658
3659 1
    def to_binary(self):
3660
        packet = []
3661
        packet.append(self.TypeId.to_binary())
3662
        packet.append(self.RequestHeader.to_binary())
3663
        packet.append(self.Parameters.to_binary())
3664
        return b''.join(packet)
3665
3666 1
    @staticmethod
3667
    def from_binary(data):
3668
        return CancelRequest(data)
3669
3670 1
    def _binary_init(self, data):
3671
        self.TypeId = NodeId.from_binary(data)
3672
        self.RequestHeader = RequestHeader.from_binary(data)
3673
        self.Parameters = CancelParameters.from_binary(data)
3674
3675 1
    def __str__(self):
3676
        return 'CancelRequest(' + 'TypeId:' + str(self.TypeId) + ', ' + \
3677
               'RequestHeader:' + str(self.RequestHeader) + ', ' + \
3678
               'Parameters:' + str(self.Parameters) + ')'
3679
3680 1
    __repr__ = __str__
3681
3682
3683 1
class CancelResult(FrozenClass):
3684
    '''
3685
    :ivar CancelCount:
3686
    :vartype CancelCount: UInt32
3687
    '''
3688 1
    def __init__(self, binary=None):
3689
        if binary is not None:
3690
            self._binary_init(binary)
3691
            self._freeze()
3692
            return
3693
        self.CancelCount = 0
3694
        self._freeze()
3695
3696 1
    def to_binary(self):
3697
        packet = []
3698
        packet.append(uatype_UInt32.pack(self.CancelCount))
3699
        return b''.join(packet)
3700
3701 1
    @staticmethod
3702
    def from_binary(data):
3703
        return CancelResult(data)
3704
3705 1
    def _binary_init(self, data):
3706
        self.CancelCount = uatype_UInt32.unpack(data.read(4))[0]
3707
3708 1
    def __str__(self):
3709
        return 'CancelResult(' + 'CancelCount:' + str(self.CancelCount) + ')'
3710
3711 1
    __repr__ = __str__
3712
3713
3714 1
class CancelResponse(FrozenClass):
3715
    '''
3716
    Cancels an outstanding request.
3717
3718
    :ivar TypeId:
3719
    :vartype TypeId: NodeId
3720
    :ivar ResponseHeader:
3721
    :vartype ResponseHeader: ResponseHeader
3722
    :ivar Parameters:
3723
    :vartype Parameters: CancelResult
3724
    '''
3725 1
    def __init__(self, binary=None):
3726
        if binary is not None:
3727
            self._binary_init(binary)
3728
            self._freeze()
3729
            return
3730
        self.TypeId = FourByteNodeId(ObjectIds.CancelResponse_Encoding_DefaultBinary)
3731
        self.ResponseHeader = ResponseHeader()
3732
        self.Parameters = CancelResult()
3733
        self._freeze()
3734
3735 1
    def to_binary(self):
3736
        packet = []
3737
        packet.append(self.TypeId.to_binary())
3738
        packet.append(self.ResponseHeader.to_binary())
3739
        packet.append(self.Parameters.to_binary())
3740
        return b''.join(packet)
3741
3742 1
    @staticmethod
3743
    def from_binary(data):
3744
        return CancelResponse(data)
3745
3746 1
    def _binary_init(self, data):
3747
        self.TypeId = NodeId.from_binary(data)
3748
        self.ResponseHeader = ResponseHeader.from_binary(data)
3749
        self.Parameters = CancelResult.from_binary(data)
3750
3751 1
    def __str__(self):
3752
        return 'CancelResponse(' + 'TypeId:' + str(self.TypeId) + ', ' + \
3753
               'ResponseHeader:' + str(self.ResponseHeader) + ', ' + \
3754
               'Parameters:' + str(self.Parameters) + ')'
3755
3756 1
    __repr__ = __str__
3757
3758
3759 1
class NodeAttributes(FrozenClass):
3760
    '''
3761
    The base attributes for all nodes.
3762
3763
    :ivar SpecifiedAttributes:
3764
    :vartype SpecifiedAttributes: UInt32
3765
    :ivar DisplayName:
3766
    :vartype DisplayName: LocalizedText
3767
    :ivar Description:
3768
    :vartype Description: LocalizedText
3769
    :ivar WriteMask:
3770
    :vartype WriteMask: UInt32
3771
    :ivar UserWriteMask:
3772
    :vartype UserWriteMask: UInt32
3773
    '''
3774 1
    def __init__(self, binary=None):
3775
        if binary is not None:
3776
            self._binary_init(binary)
3777
            self._freeze()
3778
            return
3779
        self.SpecifiedAttributes = 0
3780
        self.DisplayName = LocalizedText()
3781
        self.Description = LocalizedText()
3782
        self.WriteMask = 0
3783
        self.UserWriteMask = 0
3784
        self._freeze()
3785
3786 1
    def to_binary(self):
3787
        packet = []
3788
        packet.append(uatype_UInt32.pack(self.SpecifiedAttributes))
3789
        packet.append(self.DisplayName.to_binary())
3790
        packet.append(self.Description.to_binary())
3791
        packet.append(uatype_UInt32.pack(self.WriteMask))
3792
        packet.append(uatype_UInt32.pack(self.UserWriteMask))
3793
        return b''.join(packet)
3794
3795 1
    @staticmethod
3796
    def from_binary(data):
3797
        return NodeAttributes(data)
3798
3799 1
    def _binary_init(self, data):
3800
        self.SpecifiedAttributes = uatype_UInt32.unpack(data.read(4))[0]
3801
        self.DisplayName = LocalizedText.from_binary(data)
3802
        self.Description = LocalizedText.from_binary(data)
3803
        self.WriteMask = uatype_UInt32.unpack(data.read(4))[0]
3804
        self.UserWriteMask = uatype_UInt32.unpack(data.read(4))[0]
3805
3806 1
    def __str__(self):
3807
        return 'NodeAttributes(' + 'SpecifiedAttributes:' + str(self.SpecifiedAttributes) + ', ' + \
3808
               'DisplayName:' + str(self.DisplayName) + ', ' + \
3809
               'Description:' + str(self.Description) + ', ' + \
3810
               'WriteMask:' + str(self.WriteMask) + ', ' + \
3811
               'UserWriteMask:' + str(self.UserWriteMask) + ')'
3812
3813 1
    __repr__ = __str__
3814
3815
3816 1
class ObjectAttributes(FrozenClass):
3817
    '''
3818
    The attributes for an object node.
3819
3820
    :ivar SpecifiedAttributes:
3821
    :vartype SpecifiedAttributes: UInt32
3822
    :ivar DisplayName:
3823
    :vartype DisplayName: LocalizedText
3824
    :ivar Description:
3825
    :vartype Description: LocalizedText
3826
    :ivar WriteMask:
3827
    :vartype WriteMask: UInt32
3828
    :ivar UserWriteMask:
3829
    :vartype UserWriteMask: UInt32
3830
    :ivar EventNotifier:
3831
    :vartype EventNotifier: Byte
3832
    '''
3833 1
    def __init__(self, binary=None):
3834 1
        if binary is not None:
3835 1
            self._binary_init(binary)
3836 1
            self._freeze()
3837 1
            return
3838 1
        self.SpecifiedAttributes = 0
3839 1
        self.DisplayName = LocalizedText()
3840 1
        self.Description = LocalizedText()
3841 1
        self.WriteMask = 0
3842 1
        self.UserWriteMask = 0
3843 1
        self.EventNotifier = 0
3844 1
        self._freeze()
3845
3846 1
    def to_binary(self):
3847 1
        packet = []
3848 1
        packet.append(uatype_UInt32.pack(self.SpecifiedAttributes))
3849 1
        packet.append(self.DisplayName.to_binary())
3850 1
        packet.append(self.Description.to_binary())
3851 1
        packet.append(uatype_UInt32.pack(self.WriteMask))
3852 1
        packet.append(uatype_UInt32.pack(self.UserWriteMask))
3853 1
        packet.append(uatype_Byte.pack(self.EventNotifier))
3854 1
        return b''.join(packet)
3855
3856 1
    @staticmethod
3857
    def from_binary(data):
3858 1
        return ObjectAttributes(data)
3859
3860 1
    def _binary_init(self, data):
3861 1
        self.SpecifiedAttributes = uatype_UInt32.unpack(data.read(4))[0]
3862 1
        self.DisplayName = LocalizedText.from_binary(data)
3863 1
        self.Description = LocalizedText.from_binary(data)
3864 1
        self.WriteMask = uatype_UInt32.unpack(data.read(4))[0]
3865 1
        self.UserWriteMask = uatype_UInt32.unpack(data.read(4))[0]
3866 1
        self.EventNotifier = uatype_Byte.unpack(data.read(1))[0]
3867
3868 1
    def __str__(self):
3869
        return 'ObjectAttributes(' + 'SpecifiedAttributes:' + str(self.SpecifiedAttributes) + ', ' + \
3870
               'DisplayName:' + str(self.DisplayName) + ', ' + \
3871
               'Description:' + str(self.Description) + ', ' + \
3872
               'WriteMask:' + str(self.WriteMask) + ', ' + \
3873
               'UserWriteMask:' + str(self.UserWriteMask) + ', ' + \
3874
               'EventNotifier:' + str(self.EventNotifier) + ')'
3875
3876 1
    __repr__ = __str__
3877
3878
3879 1
class VariableAttributes(FrozenClass):
3880
    '''
3881
    The attributes for a variable node.
3882
3883
    :ivar SpecifiedAttributes:
3884
    :vartype SpecifiedAttributes: UInt32
3885
    :ivar DisplayName:
3886
    :vartype DisplayName: LocalizedText
3887
    :ivar Description:
3888
    :vartype Description: LocalizedText
3889
    :ivar WriteMask:
3890
    :vartype WriteMask: UInt32
3891
    :ivar UserWriteMask:
3892
    :vartype UserWriteMask: UInt32
3893
    :ivar Value:
3894
    :vartype Value: Variant
3895
    :ivar DataType:
3896
    :vartype DataType: NodeId
3897
    :ivar ValueRank:
3898
    :vartype ValueRank: Int32
3899
    :ivar ArrayDimensions:
3900
    :vartype ArrayDimensions: UInt32
3901
    :ivar AccessLevel:
3902
    :vartype AccessLevel: Byte
3903
    :ivar UserAccessLevel:
3904
    :vartype UserAccessLevel: Byte
3905
    :ivar MinimumSamplingInterval:
3906
    :vartype MinimumSamplingInterval: Double
3907
    :ivar Historizing:
3908
    :vartype Historizing: Boolean
3909
    '''
3910 1
    def __init__(self, binary=None):
3911 1
        if binary is not None:
3912 1
            self._binary_init(binary)
3913 1
            self._freeze()
3914 1
            return
3915 1
        self.SpecifiedAttributes = 0
3916 1
        self.DisplayName = LocalizedText()
3917 1
        self.Description = LocalizedText()
3918 1
        self.WriteMask = 0
3919 1
        self.UserWriteMask = 0
3920 1
        self.Value = Variant()
3921 1
        self.DataType = NodeId()
3922 1
        self.ValueRank = 0
3923 1
        self.ArrayDimensions = []
3924 1
        self.AccessLevel = 0
3925 1
        self.UserAccessLevel = 0
3926 1
        self.MinimumSamplingInterval = 0
3927 1
        self.Historizing = True
3928 1
        self._freeze()
3929
3930 1
    def to_binary(self):
3931 1
        packet = []
3932 1
        packet.append(uatype_UInt32.pack(self.SpecifiedAttributes))
3933 1
        packet.append(self.DisplayName.to_binary())
3934 1
        packet.append(self.Description.to_binary())
3935 1
        packet.append(uatype_UInt32.pack(self.WriteMask))
3936 1
        packet.append(uatype_UInt32.pack(self.UserWriteMask))
3937 1
        packet.append(self.Value.to_binary())
3938 1
        packet.append(self.DataType.to_binary())
3939 1
        packet.append(uatype_Int32.pack(self.ValueRank))
3940 1
        packet.append(uatype_Int32.pack(len(self.ArrayDimensions)))
3941 1
        for fieldname in self.ArrayDimensions:
3942
            packet.append(uatype_UInt32.pack(fieldname))
3943 1
        packet.append(uatype_Byte.pack(self.AccessLevel))
3944 1
        packet.append(uatype_Byte.pack(self.UserAccessLevel))
3945 1
        packet.append(uatype_Double.pack(self.MinimumSamplingInterval))
3946 1
        packet.append(uatype_Boolean.pack(self.Historizing))
3947 1
        return b''.join(packet)
3948
3949 1
    @staticmethod
3950
    def from_binary(data):
3951 1
        return VariableAttributes(data)
3952
3953 1
    def _binary_init(self, data):
3954 1
        self.SpecifiedAttributes = uatype_UInt32.unpack(data.read(4))[0]
3955 1
        self.DisplayName = LocalizedText.from_binary(data)
3956 1
        self.Description = LocalizedText.from_binary(data)
3957 1
        self.WriteMask = uatype_UInt32.unpack(data.read(4))[0]
3958 1
        self.UserWriteMask = uatype_UInt32.unpack(data.read(4))[0]
3959 1
        self.Value = Variant.from_binary(data)
3960 1
        self.DataType = NodeId.from_binary(data)
3961 1
        self.ValueRank = uatype_Int32.unpack(data.read(4))[0]
3962 1
        self.ArrayDimensions = unpack_uatype_array('UInt32', data)
3963 1
        self.AccessLevel = uatype_Byte.unpack(data.read(1))[0]
3964 1
        self.UserAccessLevel = uatype_Byte.unpack(data.read(1))[0]
3965 1
        self.MinimumSamplingInterval = uatype_Double.unpack(data.read(8))[0]
3966 1
        self.Historizing = uatype_Boolean.unpack(data.read(1))[0]
3967
3968 1
    def __str__(self):
3969
        return 'VariableAttributes(' + 'SpecifiedAttributes:' + str(self.SpecifiedAttributes) + ', ' + \
3970
               'DisplayName:' + str(self.DisplayName) + ', ' + \
3971
               'Description:' + str(self.Description) + ', ' + \
3972
               'WriteMask:' + str(self.WriteMask) + ', ' + \
3973
               'UserWriteMask:' + str(self.UserWriteMask) + ', ' + \
3974
               'Value:' + str(self.Value) + ', ' + \
3975
               'DataType:' + str(self.DataType) + ', ' + \
3976
               'ValueRank:' + str(self.ValueRank) + ', ' + \
3977
               'ArrayDimensions:' + str(self.ArrayDimensions) + ', ' + \
3978
               'AccessLevel:' + str(self.AccessLevel) + ', ' + \
3979
               'UserAccessLevel:' + str(self.UserAccessLevel) + ', ' + \
3980
               'MinimumSamplingInterval:' + str(self.MinimumSamplingInterval) + ', ' + \
3981
               'Historizing:' + str(self.Historizing) + ')'
3982
3983 1
    __repr__ = __str__
3984
3985
3986 1
class MethodAttributes(FrozenClass):
3987
    '''
3988
    The attributes for a method node.
3989
3990
    :ivar SpecifiedAttributes:
3991
    :vartype SpecifiedAttributes: UInt32
3992
    :ivar DisplayName:
3993
    :vartype DisplayName: LocalizedText
3994
    :ivar Description:
3995
    :vartype Description: LocalizedText
3996
    :ivar WriteMask:
3997
    :vartype WriteMask: UInt32
3998
    :ivar UserWriteMask:
3999
    :vartype UserWriteMask: UInt32
4000
    :ivar Executable:
4001
    :vartype Executable: Boolean
4002
    :ivar UserExecutable:
4003
    :vartype UserExecutable: Boolean
4004
    '''
4005 1
    def __init__(self, binary=None):
4006 1
        if binary is not None:
4007
            self._binary_init(binary)
4008
            self._freeze()
4009
            return
4010 1
        self.SpecifiedAttributes = 0
4011 1
        self.DisplayName = LocalizedText()
4012 1
        self.Description = LocalizedText()
4013 1
        self.WriteMask = 0
4014 1
        self.UserWriteMask = 0
4015 1
        self.Executable = True
4016 1
        self.UserExecutable = True
4017 1
        self._freeze()
4018
4019 1
    def to_binary(self):
4020
        packet = []
4021
        packet.append(uatype_UInt32.pack(self.SpecifiedAttributes))
4022
        packet.append(self.DisplayName.to_binary())
4023
        packet.append(self.Description.to_binary())
4024
        packet.append(uatype_UInt32.pack(self.WriteMask))
4025
        packet.append(uatype_UInt32.pack(self.UserWriteMask))
4026
        packet.append(uatype_Boolean.pack(self.Executable))
4027
        packet.append(uatype_Boolean.pack(self.UserExecutable))
4028
        return b''.join(packet)
4029
4030 1
    @staticmethod
4031
    def from_binary(data):
4032
        return MethodAttributes(data)
4033
4034 1
    def _binary_init(self, data):
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
4035
        self.SpecifiedAttributes = uatype_UInt32.unpack(data.read(4))[0]
4036
        self.DisplayName = LocalizedText.from_binary(data)
4037
        self.Description = LocalizedText.from_binary(data)
4038
        self.WriteMask = uatype_UInt32.unpack(data.read(4))[0]
4039
        self.UserWriteMask = uatype_UInt32.unpack(data.read(4))[0]
4040
        self.Executable = uatype_Boolean.unpack(data.read(1))[0]
4041
        self.UserExecutable = uatype_Boolean.unpack(data.read(1))[0]
4042
4043 1
    def __str__(self):
4044
        return 'MethodAttributes(' + 'SpecifiedAttributes:' + str(self.SpecifiedAttributes) + ', ' + \
4045
               'DisplayName:' + str(self.DisplayName) + ', ' + \
4046
               'Description:' + str(self.Description) + ', ' + \
4047
               'WriteMask:' + str(self.WriteMask) + ', ' + \
4048
               'UserWriteMask:' + str(self.UserWriteMask) + ', ' + \
4049
               'Executable:' + str(self.Executable) + ', ' + \
4050
               'UserExecutable:' + str(self.UserExecutable) + ')'
4051
4052 1
    __repr__ = __str__
4053
4054
4055 1
class ObjectTypeAttributes(FrozenClass):
4056
    '''
4057
    The attributes for an object type node.
4058
4059
    :ivar SpecifiedAttributes:
4060
    :vartype SpecifiedAttributes: UInt32
4061
    :ivar DisplayName:
4062
    :vartype DisplayName: LocalizedText
4063
    :ivar Description:
4064
    :vartype Description: LocalizedText
4065
    :ivar WriteMask:
4066
    :vartype WriteMask: UInt32
4067
    :ivar UserWriteMask:
4068
    :vartype UserWriteMask: UInt32
4069
    :ivar IsAbstract:
4070
    :vartype IsAbstract: Boolean
4071
    '''
4072 1
    def __init__(self, binary=None):
4073 1
        if binary is not None:
4074
            self._binary_init(binary)
4075
            self._freeze()
4076
            return
4077 1
        self.SpecifiedAttributes = 0
4078 1
        self.DisplayName = LocalizedText()
4079 1
        self.Description = LocalizedText()
4080 1
        self.WriteMask = 0
4081 1
        self.UserWriteMask = 0
4082 1
        self.IsAbstract = True
4083 1
        self._freeze()
4084
4085 1
    def to_binary(self):
4086
        packet = []
4087
        packet.append(uatype_UInt32.pack(self.SpecifiedAttributes))
4088
        packet.append(self.DisplayName.to_binary())
4089
        packet.append(self.Description.to_binary())
4090
        packet.append(uatype_UInt32.pack(self.WriteMask))
4091
        packet.append(uatype_UInt32.pack(self.UserWriteMask))
4092
        packet.append(uatype_Boolean.pack(self.IsAbstract))
4093
        return b''.join(packet)
4094
4095 1
    @staticmethod
4096
    def from_binary(data):
4097
        return ObjectTypeAttributes(data)
4098
4099 1
    def _binary_init(self, data):
4100
        self.SpecifiedAttributes = uatype_UInt32.unpack(data.read(4))[0]
4101
        self.DisplayName = LocalizedText.from_binary(data)
4102
        self.Description = LocalizedText.from_binary(data)
4103
        self.WriteMask = uatype_UInt32.unpack(data.read(4))[0]
4104
        self.UserWriteMask = uatype_UInt32.unpack(data.read(4))[0]
4105
        self.IsAbstract = uatype_Boolean.unpack(data.read(1))[0]
4106
4107 1
    def __str__(self):
4108
        return 'ObjectTypeAttributes(' + 'SpecifiedAttributes:' + str(self.SpecifiedAttributes) + ', ' + \
4109
               'DisplayName:' + str(self.DisplayName) + ', ' + \
4110
               'Description:' + str(self.Description) + ', ' + \
4111
               'WriteMask:' + str(self.WriteMask) + ', ' + \
4112
               'UserWriteMask:' + str(self.UserWriteMask) + ', ' + \
4113
               'IsAbstract:' + str(self.IsAbstract) + ')'
4114
4115 1
    __repr__ = __str__
4116
4117
4118 1
class VariableTypeAttributes(FrozenClass):
4119
    '''
4120
    The attributes for a variable type node.
4121
4122
    :ivar SpecifiedAttributes:
4123
    :vartype SpecifiedAttributes: UInt32
4124
    :ivar DisplayName:
4125
    :vartype DisplayName: LocalizedText
4126
    :ivar Description:
4127
    :vartype Description: LocalizedText
4128
    :ivar WriteMask:
4129
    :vartype WriteMask: UInt32
4130
    :ivar UserWriteMask:
4131
    :vartype UserWriteMask: UInt32
4132
    :ivar Value:
4133
    :vartype Value: Variant
4134
    :ivar DataType:
4135
    :vartype DataType: NodeId
4136
    :ivar ValueRank:
4137
    :vartype ValueRank: Int32
4138
    :ivar ArrayDimensions:
4139
    :vartype ArrayDimensions: UInt32
4140
    :ivar IsAbstract:
4141
    :vartype IsAbstract: Boolean
4142
    '''
4143 1
    def __init__(self, binary=None):
4144 1
        if binary is not None:
4145
            self._binary_init(binary)
4146
            self._freeze()
4147
            return
4148 1
        self.SpecifiedAttributes = 0
4149 1
        self.DisplayName = LocalizedText()
4150 1
        self.Description = LocalizedText()
4151 1
        self.WriteMask = 0
4152 1
        self.UserWriteMask = 0
4153 1
        self.Value = Variant()
4154 1
        self.DataType = NodeId()
4155 1
        self.ValueRank = 0
4156 1
        self.ArrayDimensions = []
4157 1
        self.IsAbstract = True
4158 1
        self._freeze()
4159
4160 1
    def to_binary(self):
4161
        packet = []
4162
        packet.append(uatype_UInt32.pack(self.SpecifiedAttributes))
4163
        packet.append(self.DisplayName.to_binary())
4164
        packet.append(self.Description.to_binary())
4165
        packet.append(uatype_UInt32.pack(self.WriteMask))
4166
        packet.append(uatype_UInt32.pack(self.UserWriteMask))
4167
        packet.append(self.Value.to_binary())
4168
        packet.append(self.DataType.to_binary())
4169
        packet.append(uatype_Int32.pack(self.ValueRank))
4170
        packet.append(uatype_Int32.pack(len(self.ArrayDimensions)))
4171
        for fieldname in self.ArrayDimensions:
4172
            packet.append(uatype_UInt32.pack(fieldname))
4173
        packet.append(uatype_Boolean.pack(self.IsAbstract))
4174
        return b''.join(packet)
4175
4176 1
    @staticmethod
4177
    def from_binary(data):
4178
        return VariableTypeAttributes(data)
4179
4180 1
    def _binary_init(self, data):
4181
        self.SpecifiedAttributes = uatype_UInt32.unpack(data.read(4))[0]
4182
        self.DisplayName = LocalizedText.from_binary(data)
4183
        self.Description = LocalizedText.from_binary(data)
4184
        self.WriteMask = uatype_UInt32.unpack(data.read(4))[0]
4185
        self.UserWriteMask = uatype_UInt32.unpack(data.read(4))[0]
4186
        self.Value = Variant.from_binary(data)
4187
        self.DataType = NodeId.from_binary(data)
4188
        self.ValueRank = uatype_Int32.unpack(data.read(4))[0]
4189
        self.ArrayDimensions = unpack_uatype_array('UInt32', data)
4190
        self.IsAbstract = uatype_Boolean.unpack(data.read(1))[0]
4191
4192 1
    def __str__(self):
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
4193
        return 'VariableTypeAttributes(' + 'SpecifiedAttributes:' + str(self.SpecifiedAttributes) + ', ' + \
4194
               'DisplayName:' + str(self.DisplayName) + ', ' + \
4195
               'Description:' + str(self.Description) + ', ' + \
4196
               'WriteMask:' + str(self.WriteMask) + ', ' + \
4197
               'UserWriteMask:' + str(self.UserWriteMask) + ', ' + \
4198
               'Value:' + str(self.Value) + ', ' + \
4199
               'DataType:' + str(self.DataType) + ', ' + \
4200
               'ValueRank:' + str(self.ValueRank) + ', ' + \
4201
               'ArrayDimensions:' + str(self.ArrayDimensions) + ', ' + \
4202
               'IsAbstract:' + str(self.IsAbstract) + ')'
4203
4204 1
    __repr__ = __str__
4205
4206
4207 1
class ReferenceTypeAttributes(FrozenClass):
4208
    '''
4209
    The attributes for a reference type node.
4210
4211
    :ivar SpecifiedAttributes:
4212
    :vartype SpecifiedAttributes: UInt32
4213
    :ivar DisplayName:
4214
    :vartype DisplayName: LocalizedText
4215
    :ivar Description:
4216
    :vartype Description: LocalizedText
4217
    :ivar WriteMask:
4218
    :vartype WriteMask: UInt32
4219
    :ivar UserWriteMask:
4220
    :vartype UserWriteMask: UInt32
4221
    :ivar IsAbstract:
4222
    :vartype IsAbstract: Boolean
4223
    :ivar Symmetric:
4224
    :vartype Symmetric: Boolean
4225
    :ivar InverseName:
4226
    :vartype InverseName: LocalizedText
4227
    '''
4228 1
    def __init__(self, binary=None):
4229 1
        if binary is not None:
4230
            self._binary_init(binary)
4231
            self._freeze()
4232
            return
4233 1
        self.SpecifiedAttributes = 0
4234 1
        self.DisplayName = LocalizedText()
4235 1
        self.Description = LocalizedText()
4236 1
        self.WriteMask = 0
4237 1
        self.UserWriteMask = 0
4238 1
        self.IsAbstract = True
4239 1
        self.Symmetric = True
4240 1
        self.InverseName = LocalizedText()
4241 1
        self._freeze()
4242
4243 1
    def to_binary(self):
4244
        packet = []
4245
        packet.append(uatype_UInt32.pack(self.SpecifiedAttributes))
4246
        packet.append(self.DisplayName.to_binary())
4247
        packet.append(self.Description.to_binary())
4248
        packet.append(uatype_UInt32.pack(self.WriteMask))
4249
        packet.append(uatype_UInt32.pack(self.UserWriteMask))
4250
        packet.append(uatype_Boolean.pack(self.IsAbstract))
4251
        packet.append(uatype_Boolean.pack(self.Symmetric))
4252
        packet.append(self.InverseName.to_binary())
4253
        return b''.join(packet)
4254
4255 1
    @staticmethod
4256
    def from_binary(data):
4257
        return ReferenceTypeAttributes(data)
4258
4259 1
    def _binary_init(self, data):
4260
        self.SpecifiedAttributes = uatype_UInt32.unpack(data.read(4))[0]
4261
        self.DisplayName = LocalizedText.from_binary(data)
4262
        self.Description = LocalizedText.from_binary(data)
4263
        self.WriteMask = uatype_UInt32.unpack(data.read(4))[0]
4264
        self.UserWriteMask = uatype_UInt32.unpack(data.read(4))[0]
4265
        self.IsAbstract = uatype_Boolean.unpack(data.read(1))[0]
4266
        self.Symmetric = uatype_Boolean.unpack(data.read(1))[0]
4267
        self.InverseName = LocalizedText.from_binary(data)
4268
4269 1
    def __str__(self):
4270
        return 'ReferenceTypeAttributes(' + 'SpecifiedAttributes:' + str(self.SpecifiedAttributes) + ', ' + \
4271
               'DisplayName:' + str(self.DisplayName) + ', ' + \
4272
               'Description:' + str(self.Description) + ', ' + \
4273
               'WriteMask:' + str(self.WriteMask) + ', ' + \
4274
               'UserWriteMask:' + str(self.UserWriteMask) + ', ' + \
4275
               'IsAbstract:' + str(self.IsAbstract) + ', ' + \
4276
               'Symmetric:' + str(self.Symmetric) + ', ' + \
4277
               'InverseName:' + str(self.InverseName) + ')'
4278
4279 1
    __repr__ = __str__
4280
4281
4282 1
class DataTypeAttributes(FrozenClass):
4283
    '''
4284
    The attributes for a data type node.
4285
4286
    :ivar SpecifiedAttributes:
4287
    :vartype SpecifiedAttributes: UInt32
4288
    :ivar DisplayName:
4289
    :vartype DisplayName: LocalizedText
4290
    :ivar Description:
4291
    :vartype Description: LocalizedText
4292
    :ivar WriteMask:
4293
    :vartype WriteMask: UInt32
4294
    :ivar UserWriteMask:
4295
    :vartype UserWriteMask: UInt32
4296
    :ivar IsAbstract:
4297
    :vartype IsAbstract: Boolean
4298
    '''
4299 1
    def __init__(self, binary=None):
4300 1
        if binary is not None:
4301
            self._binary_init(binary)
4302
            self._freeze()
4303
            return
4304 1
        self.SpecifiedAttributes = 0
4305 1
        self.DisplayName = LocalizedText()
4306 1
        self.Description = LocalizedText()
4307 1
        self.WriteMask = 0
4308 1
        self.UserWriteMask = 0
4309 1
        self.IsAbstract = True
4310 1
        self._freeze()
4311
4312 1
    def to_binary(self):
4313
        packet = []
4314
        packet.append(uatype_UInt32.pack(self.SpecifiedAttributes))
4315
        packet.append(self.DisplayName.to_binary())
4316
        packet.append(self.Description.to_binary())
4317
        packet.append(uatype_UInt32.pack(self.WriteMask))
4318
        packet.append(uatype_UInt32.pack(self.UserWriteMask))
4319
        packet.append(uatype_Boolean.pack(self.IsAbstract))
4320
        return b''.join(packet)
4321
4322 1
    @staticmethod
4323
    def from_binary(data):
4324
        return DataTypeAttributes(data)
4325
4326 1
    def _binary_init(self, data):
4327
        self.SpecifiedAttributes = uatype_UInt32.unpack(data.read(4))[0]
4328
        self.DisplayName = LocalizedText.from_binary(data)
4329
        self.Description = LocalizedText.from_binary(data)
4330
        self.WriteMask = uatype_UInt32.unpack(data.read(4))[0]
4331
        self.UserWriteMask = uatype_UInt32.unpack(data.read(4))[0]
4332
        self.IsAbstract = uatype_Boolean.unpack(data.read(1))[0]
4333
4334 1
    def __str__(self):
4335
        return 'DataTypeAttributes(' + 'SpecifiedAttributes:' + str(self.SpecifiedAttributes) + ', ' + \
4336
               'DisplayName:' + str(self.DisplayName) + ', ' + \
4337
               'Description:' + str(self.Description) + ', ' + \
4338
               'WriteMask:' + str(self.WriteMask) + ', ' + \
4339
               'UserWriteMask:' + str(self.UserWriteMask) + ', ' + \
4340
               'IsAbstract:' + str(self.IsAbstract) + ')'
4341
4342 1
    __repr__ = __str__
4343
4344
4345 1
class ViewAttributes(FrozenClass):
4346
    '''
4347
    The attributes for a view node.
4348
4349
    :ivar SpecifiedAttributes:
4350
    :vartype SpecifiedAttributes: UInt32
4351
    :ivar DisplayName:
4352
    :vartype DisplayName: LocalizedText
4353
    :ivar Description:
4354
    :vartype Description: LocalizedText
4355
    :ivar WriteMask:
4356
    :vartype WriteMask: UInt32
4357
    :ivar UserWriteMask:
4358
    :vartype UserWriteMask: UInt32
4359
    :ivar ContainsNoLoops:
4360
    :vartype ContainsNoLoops: Boolean
4361
    :ivar EventNotifier:
4362
    :vartype EventNotifier: Byte
4363
    '''
4364 1
    def __init__(self, binary=None):
4365
        if binary is not None:
4366
            self._binary_init(binary)
4367
            self._freeze()
4368
            return
4369
        self.SpecifiedAttributes = 0
4370
        self.DisplayName = LocalizedText()
4371
        self.Description = LocalizedText()
4372
        self.WriteMask = 0
4373
        self.UserWriteMask = 0
4374
        self.ContainsNoLoops = True
4375
        self.EventNotifier = 0
4376
        self._freeze()
4377
4378 1
    def to_binary(self):
4379
        packet = []
4380
        packet.append(uatype_UInt32.pack(self.SpecifiedAttributes))
4381
        packet.append(self.DisplayName.to_binary())
4382
        packet.append(self.Description.to_binary())
4383
        packet.append(uatype_UInt32.pack(self.WriteMask))
4384
        packet.append(uatype_UInt32.pack(self.UserWriteMask))
4385
        packet.append(uatype_Boolean.pack(self.ContainsNoLoops))
4386
        packet.append(uatype_Byte.pack(self.EventNotifier))
4387
        return b''.join(packet)
4388
4389 1
    @staticmethod
4390
    def from_binary(data):
4391
        return ViewAttributes(data)
4392
4393 1
    def _binary_init(self, data):
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
4394
        self.SpecifiedAttributes = uatype_UInt32.unpack(data.read(4))[0]
4395
        self.DisplayName = LocalizedText.from_binary(data)
4396
        self.Description = LocalizedText.from_binary(data)
4397
        self.WriteMask = uatype_UInt32.unpack(data.read(4))[0]
4398
        self.UserWriteMask = uatype_UInt32.unpack(data.read(4))[0]
4399
        self.ContainsNoLoops = uatype_Boolean.unpack(data.read(1))[0]
4400
        self.EventNotifier = uatype_Byte.unpack(data.read(1))[0]
4401
4402 1
    def __str__(self):
4403
        return 'ViewAttributes(' + 'SpecifiedAttributes:' + str(self.SpecifiedAttributes) + ', ' + \
4404
               'DisplayName:' + str(self.DisplayName) + ', ' + \
4405
               'Description:' + str(self.Description) + ', ' + \
4406
               'WriteMask:' + str(self.WriteMask) + ', ' + \
4407
               'UserWriteMask:' + str(self.UserWriteMask) + ', ' + \
4408
               'ContainsNoLoops:' + str(self.ContainsNoLoops) + ', ' + \
4409
               'EventNotifier:' + str(self.EventNotifier) + ')'
4410
4411 1
    __repr__ = __str__
4412
4413
4414 1
class AddNodesItem(FrozenClass):
4415
    '''
4416
    A request to add a node to the server address space.
4417
4418
    :ivar ParentNodeId:
4419
    :vartype ParentNodeId: ExpandedNodeId
4420
    :ivar ReferenceTypeId:
4421
    :vartype ReferenceTypeId: NodeId
4422
    :ivar RequestedNewNodeId:
4423
    :vartype RequestedNewNodeId: ExpandedNodeId
4424
    :ivar BrowseName:
4425
    :vartype BrowseName: QualifiedName
4426
    :ivar NodeClass:
4427
    :vartype NodeClass: NodeClass
4428
    :ivar NodeAttributes:
4429
    :vartype NodeAttributes: ExtensionObject
4430
    :ivar TypeDefinition:
4431
    :vartype TypeDefinition: ExpandedNodeId
4432
    '''
4433 1
    def __init__(self, binary=None):
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
4434 1
        if binary is not None:
4435 1
            self._binary_init(binary)
4436 1
            self._freeze()
4437 1
            return
4438 1
        self.ParentNodeId = ExpandedNodeId()
4439 1
        self.ReferenceTypeId = NodeId()
4440 1
        self.RequestedNewNodeId = ExpandedNodeId()
4441 1
        self.BrowseName = QualifiedName()
4442 1
        self.NodeClass = 0
4443 1
        self.NodeAttributes = None
4444 1
        self.TypeDefinition = ExpandedNodeId()
4445 1
        self._freeze()
4446
4447 1
    def to_binary(self):
4448 1
        packet = []
4449 1
        packet.append(self.ParentNodeId.to_binary())
4450 1
        packet.append(self.ReferenceTypeId.to_binary())
4451 1
        packet.append(self.RequestedNewNodeId.to_binary())
4452 1
        packet.append(self.BrowseName.to_binary())
4453 1
        packet.append(uatype_UInt32.pack(self.NodeClass))
4454 1
        packet.append(extensionobject_to_binary(self.NodeAttributes))
4455 1
        packet.append(self.TypeDefinition.to_binary())
4456 1
        return b''.join(packet)
4457
4458 1
    @staticmethod
4459
    def from_binary(data):
4460 1
        return AddNodesItem(data)
4461
4462 1
    def _binary_init(self, data):
4463 1
        self.ParentNodeId = ExpandedNodeId.from_binary(data)
4464 1
        self.ReferenceTypeId = NodeId.from_binary(data)
4465 1
        self.RequestedNewNodeId = ExpandedNodeId.from_binary(data)
4466 1
        self.BrowseName = QualifiedName.from_binary(data)
4467 1
        self.NodeClass = uatype_UInt32.unpack(data.read(4))[0]
4468 1
        self.NodeAttributes = extensionobject_from_binary(data)
4469 1
        self.TypeDefinition = ExpandedNodeId.from_binary(data)
4470
4471 1
    def __str__(self):
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
4472
        return 'AddNodesItem(' + 'ParentNodeId:' + str(self.ParentNodeId) + ', ' + \
4473
               'ReferenceTypeId:' + str(self.ReferenceTypeId) + ', ' + \
4474
               'RequestedNewNodeId:' + str(self.RequestedNewNodeId) + ', ' + \
4475
               'BrowseName:' + str(self.BrowseName) + ', ' + \
4476
               'NodeClass:' + str(self.NodeClass) + ', ' + \
4477
               'NodeAttributes:' + str(self.NodeAttributes) + ', ' + \
4478
               'TypeDefinition:' + str(self.TypeDefinition) + ')'
4479
4480 1
    __repr__ = __str__
4481
4482
4483 1
class AddNodesResult(FrozenClass):
4484
    '''
4485
    A result of an add node operation.
4486
4487
    :ivar StatusCode:
4488
    :vartype StatusCode: StatusCode
4489
    :ivar AddedNodeId:
4490
    :vartype AddedNodeId: NodeId
4491
    '''
4492 1
    def __init__(self, binary=None):
4493 1
        if binary is not None:
4494 1
            self._binary_init(binary)
4495 1
            self._freeze()
4496 1
            return
4497 1
        self.StatusCode = StatusCode()
4498 1
        self.AddedNodeId = NodeId()
4499 1
        self._freeze()
4500
4501 1
    def to_binary(self):
4502 1
        packet = []
4503 1
        packet.append(self.StatusCode.to_binary())
4504 1
        packet.append(self.AddedNodeId.to_binary())
4505 1
        return b''.join(packet)
4506
4507 1
    @staticmethod
4508
    def from_binary(data):
4509 1
        return AddNodesResult(data)
4510
4511 1
    def _binary_init(self, data):
4512 1
        self.StatusCode = StatusCode.from_binary(data)
4513 1
        self.AddedNodeId = NodeId.from_binary(data)
4514
4515 1
    def __str__(self):
4516
        return 'AddNodesResult(' + 'StatusCode:' + str(self.StatusCode) + ', ' + \
4517
               'AddedNodeId:' + str(self.AddedNodeId) + ')'
4518
4519 1
    __repr__ = __str__
4520
4521
4522 1
class AddNodesParameters(FrozenClass):
4523
    '''
4524
    :ivar NodesToAdd:
4525
    :vartype NodesToAdd: AddNodesItem
4526
    '''
4527 1
    def __init__(self, binary=None):
4528 1
        if binary is not None:
4529 1
            self._binary_init(binary)
4530 1
            self._freeze()
4531 1
            return
4532 1
        self.NodesToAdd = []
4533 1
        self._freeze()
4534
4535 1
    def to_binary(self):
4536 1
        packet = []
4537 1
        packet.append(uatype_Int32.pack(len(self.NodesToAdd)))
4538 1
        for fieldname in self.NodesToAdd:
4539 1
            packet.append(fieldname.to_binary())
4540 1
        return b''.join(packet)
4541
4542 1
    @staticmethod
4543
    def from_binary(data):
4544 1
        return AddNodesParameters(data)
4545
4546 1
    def _binary_init(self, data):
4547 1
        length = uatype_Int32.unpack(data.read(4))[0]
4548 1
        array = []
4549 1
        if length != -1:
4550 1
            for _ in range(0, length):
4551 1
                array.append(AddNodesItem.from_binary(data))
4552 1
        self.NodesToAdd = array
4553
4554 1
    def __str__(self):
4555
        return 'AddNodesParameters(' + 'NodesToAdd:' + str(self.NodesToAdd) + ')'
4556
4557 1
    __repr__ = __str__
4558
4559
4560 1
class AddNodesRequest(FrozenClass):
4561
    '''
4562
    Adds one or more nodes to the server address space.
4563
4564
    :ivar TypeId:
4565
    :vartype TypeId: NodeId
4566
    :ivar RequestHeader:
4567
    :vartype RequestHeader: RequestHeader
4568
    :ivar Parameters:
4569
    :vartype Parameters: AddNodesParameters
4570
    '''
4571 1
    def __init__(self, binary=None):
4572 1
        if binary is not None:
4573
            self._binary_init(binary)
4574
            self._freeze()
4575
            return
4576 1
        self.TypeId = FourByteNodeId(ObjectIds.AddNodesRequest_Encoding_DefaultBinary)
4577 1
        self.RequestHeader = RequestHeader()
4578 1
        self.Parameters = AddNodesParameters()
4579 1
        self._freeze()
4580
4581 1
    def to_binary(self):
4582 1
        packet = []
4583 1
        packet.append(self.TypeId.to_binary())
4584 1
        packet.append(self.RequestHeader.to_binary())
4585 1
        packet.append(self.Parameters.to_binary())
4586 1
        return b''.join(packet)
4587
4588 1
    @staticmethod
4589
    def from_binary(data):
4590
        return AddNodesRequest(data)
4591
4592 1
    def _binary_init(self, data):
4593
        self.TypeId = NodeId.from_binary(data)
4594
        self.RequestHeader = RequestHeader.from_binary(data)
4595
        self.Parameters = AddNodesParameters.from_binary(data)
4596
4597 1
    def __str__(self):
4598
        return 'AddNodesRequest(' + 'TypeId:' + str(self.TypeId) + ', ' + \
4599
               'RequestHeader:' + str(self.RequestHeader) + ', ' + \
4600
               'Parameters:' + str(self.Parameters) + ')'
4601
4602 1
    __repr__ = __str__
4603
4604
4605 1
class AddNodesResponse(FrozenClass):
4606
    '''
4607
    Adds one or more nodes to the server address space.
4608
4609
    :ivar TypeId:
4610
    :vartype TypeId: NodeId
4611
    :ivar ResponseHeader:
4612
    :vartype ResponseHeader: ResponseHeader
4613
    :ivar Results:
4614
    :vartype Results: AddNodesResult
4615
    :ivar DiagnosticInfos:
4616
    :vartype DiagnosticInfos: DiagnosticInfo
4617
    '''
4618 1
    def __init__(self, binary=None):
4619 1
        if binary is not None:
4620 1
            self._binary_init(binary)
4621 1
            self._freeze()
4622 1
            return
4623 1
        self.TypeId = FourByteNodeId(ObjectIds.AddNodesResponse_Encoding_DefaultBinary)
4624 1
        self.ResponseHeader = ResponseHeader()
4625 1
        self.Results = []
4626 1
        self.DiagnosticInfos = []
4627 1
        self._freeze()
4628
4629 1
    def to_binary(self):
4630 1
        packet = []
4631 1
        packet.append(self.TypeId.to_binary())
4632 1
        packet.append(self.ResponseHeader.to_binary())
4633 1
        packet.append(uatype_Int32.pack(len(self.Results)))
4634 1
        for fieldname in self.Results:
4635 1
            packet.append(fieldname.to_binary())
4636 1
        packet.append(uatype_Int32.pack(len(self.DiagnosticInfos)))
4637 1
        for fieldname in self.DiagnosticInfos:
4638
            packet.append(fieldname.to_binary())
4639 1
        return b''.join(packet)
4640
4641 1
    @staticmethod
4642
    def from_binary(data):
4643 1
        return AddNodesResponse(data)
4644
4645 1
    def _binary_init(self, data):
4646 1
        self.TypeId = NodeId.from_binary(data)
4647 1
        self.ResponseHeader = ResponseHeader.from_binary(data)
4648 1
        length = uatype_Int32.unpack(data.read(4))[0]
4649 1
        array = []
4650 1
        if length != -1:
4651 1
            for _ in range(0, length):
4652 1
                array.append(AddNodesResult.from_binary(data))
4653 1
        self.Results = array
4654 1
        length = uatype_Int32.unpack(data.read(4))[0]
4655 1
        array = []
4656 1
        if length != -1:
4657 1
            for _ in range(0, length):
4658
                array.append(DiagnosticInfo.from_binary(data))
4659 1
        self.DiagnosticInfos = array
4660
4661 1
    def __str__(self):
4662
        return 'AddNodesResponse(' + 'TypeId:' + str(self.TypeId) + ', ' + \
4663
               'ResponseHeader:' + str(self.ResponseHeader) + ', ' + \
4664
               'Results:' + str(self.Results) + ', ' + \
4665
               'DiagnosticInfos:' + str(self.DiagnosticInfos) + ')'
4666
4667 1
    __repr__ = __str__
4668
4669
4670 1
class AddReferencesItem(FrozenClass):
4671
    '''
4672
    A request to add a reference to the server address space.
4673
4674
    :ivar SourceNodeId:
4675
    :vartype SourceNodeId: NodeId
4676
    :ivar ReferenceTypeId:
4677
    :vartype ReferenceTypeId: NodeId
4678
    :ivar IsForward:
4679
    :vartype IsForward: Boolean
4680
    :ivar TargetServerUri:
4681
    :vartype TargetServerUri: String
4682
    :ivar TargetNodeId:
4683
    :vartype TargetNodeId: ExpandedNodeId
4684
    :ivar TargetNodeClass:
4685
    :vartype TargetNodeClass: NodeClass
4686
    '''
4687 1
    def __init__(self, binary=None):
4688 1
        if binary is not None:
4689
            self._binary_init(binary)
4690
            self._freeze()
4691
            return
4692 1
        self.SourceNodeId = NodeId()
4693 1
        self.ReferenceTypeId = NodeId()
4694 1
        self.IsForward = True
4695 1
        self.TargetServerUri = ''
4696 1
        self.TargetNodeId = ExpandedNodeId()
4697 1
        self.TargetNodeClass = 0
4698 1
        self._freeze()
4699
4700 1
    def to_binary(self):
4701
        packet = []
4702
        packet.append(self.SourceNodeId.to_binary())
4703
        packet.append(self.ReferenceTypeId.to_binary())
4704
        packet.append(uatype_Boolean.pack(self.IsForward))
4705
        packet.append(pack_string(self.TargetServerUri))
4706
        packet.append(self.TargetNodeId.to_binary())
4707
        packet.append(uatype_UInt32.pack(self.TargetNodeClass))
4708
        return b''.join(packet)
4709
4710 1
    @staticmethod
4711
    def from_binary(data):
4712
        return AddReferencesItem(data)
4713
4714 1
    def _binary_init(self, data):
4715
        self.SourceNodeId = NodeId.from_binary(data)
4716
        self.ReferenceTypeId = NodeId.from_binary(data)
4717
        self.IsForward = uatype_Boolean.unpack(data.read(1))[0]
4718
        self.TargetServerUri = unpack_string(data)
4719
        self.TargetNodeId = ExpandedNodeId.from_binary(data)
4720
        self.TargetNodeClass = uatype_UInt32.unpack(data.read(4))[0]
4721
4722 1
    def __str__(self):
4723
        return 'AddReferencesItem(' + 'SourceNodeId:' + str(self.SourceNodeId) + ', ' + \
4724
               'ReferenceTypeId:' + str(self.ReferenceTypeId) + ', ' + \
4725
               'IsForward:' + str(self.IsForward) + ', ' + \
4726
               'TargetServerUri:' + str(self.TargetServerUri) + ', ' + \
4727
               'TargetNodeId:' + str(self.TargetNodeId) + ', ' + \
4728
               'TargetNodeClass:' + str(self.TargetNodeClass) + ')'
4729
4730 1
    __repr__ = __str__
4731
4732
4733 1
class AddReferencesRequest(FrozenClass):
4734
    '''
4735
    Adds one or more references to the server address space.
4736
4737
    :ivar TypeId:
4738
    :vartype TypeId: NodeId
4739
    :ivar RequestHeader:
4740
    :vartype RequestHeader: RequestHeader
4741
    :ivar ReferencesToAdd:
4742
    :vartype ReferencesToAdd: AddReferencesItem
4743
    '''
4744 1
    def __init__(self, binary=None):
4745
        if binary is not None:
4746
            self._binary_init(binary)
4747
            self._freeze()
4748
            return
4749
        self.TypeId = FourByteNodeId(ObjectIds.AddReferencesRequest_Encoding_DefaultBinary)
4750
        self.RequestHeader = RequestHeader()
4751
        self.ReferencesToAdd = []
4752
        self._freeze()
4753
4754 1
    def to_binary(self):
4755
        packet = []
4756
        packet.append(self.TypeId.to_binary())
4757
        packet.append(self.RequestHeader.to_binary())
4758
        packet.append(uatype_Int32.pack(len(self.ReferencesToAdd)))
4759
        for fieldname in self.ReferencesToAdd:
4760
            packet.append(fieldname.to_binary())
4761
        return b''.join(packet)
4762
4763 1
    @staticmethod
4764
    def from_binary(data):
4765
        return AddReferencesRequest(data)
4766
4767 1
    def _binary_init(self, data):
4768
        self.TypeId = NodeId.from_binary(data)
4769
        self.RequestHeader = RequestHeader.from_binary(data)
4770
        length = uatype_Int32.unpack(data.read(4))[0]
4771
        array = []
4772
        if length != -1:
4773
            for _ in range(0, length):
4774
                array.append(AddReferencesItem.from_binary(data))
4775
        self.ReferencesToAdd = array
4776
4777 1
    def __str__(self):
4778
        return 'AddReferencesRequest(' + 'TypeId:' + str(self.TypeId) + ', ' + \
4779
               'RequestHeader:' + str(self.RequestHeader) + ', ' + \
4780
               'ReferencesToAdd:' + str(self.ReferencesToAdd) + ')'
4781
4782 1
    __repr__ = __str__
4783
4784
4785 1
class AddReferencesResponse(FrozenClass):
4786
    '''
4787
    Adds one or more references to the server address space.
4788
4789
    :ivar TypeId:
4790
    :vartype TypeId: NodeId
4791
    :ivar ResponseHeader:
4792
    :vartype ResponseHeader: ResponseHeader
4793
    :ivar Results:
4794
    :vartype Results: StatusCode
4795
    :ivar DiagnosticInfos:
4796
    :vartype DiagnosticInfos: DiagnosticInfo
4797
    '''
4798 1
    def __init__(self, binary=None):
4799
        if binary is not None:
4800
            self._binary_init(binary)
4801
            self._freeze()
4802
            return
4803
        self.TypeId = FourByteNodeId(ObjectIds.AddReferencesResponse_Encoding_DefaultBinary)
4804
        self.ResponseHeader = ResponseHeader()
4805
        self.Results = []
4806
        self.DiagnosticInfos = []
4807
        self._freeze()
4808
4809 1
    def to_binary(self):
4810
        packet = []
4811
        packet.append(self.TypeId.to_binary())
4812
        packet.append(self.ResponseHeader.to_binary())
4813
        packet.append(uatype_Int32.pack(len(self.Results)))
4814
        for fieldname in self.Results:
4815
            packet.append(fieldname.to_binary())
4816
        packet.append(uatype_Int32.pack(len(self.DiagnosticInfos)))
4817
        for fieldname in self.DiagnosticInfos:
4818
            packet.append(fieldname.to_binary())
4819
        return b''.join(packet)
4820
4821 1
    @staticmethod
4822
    def from_binary(data):
4823
        return AddReferencesResponse(data)
4824
4825 1
    def _binary_init(self, data):
4826
        self.TypeId = NodeId.from_binary(data)
4827
        self.ResponseHeader = ResponseHeader.from_binary(data)
4828
        length = uatype_Int32.unpack(data.read(4))[0]
4829
        array = []
4830
        if length != -1:
4831
            for _ in range(0, length):
4832
                array.append(StatusCode.from_binary(data))
4833
        self.Results = array
4834
        length = uatype_Int32.unpack(data.read(4))[0]
4835
        array = []
4836
        if length != -1:
4837
            for _ in range(0, length):
4838
                array.append(DiagnosticInfo.from_binary(data))
4839
        self.DiagnosticInfos = array
4840
4841 1
    def __str__(self):
4842
        return 'AddReferencesResponse(' + 'TypeId:' + str(self.TypeId) + ', ' + \
4843
               'ResponseHeader:' + str(self.ResponseHeader) + ', ' + \
4844
               'Results:' + str(self.Results) + ', ' + \
4845
               'DiagnosticInfos:' + str(self.DiagnosticInfos) + ')'
4846
4847 1
    __repr__ = __str__
4848
4849
4850 1
class DeleteNodesItem(FrozenClass):
4851
    '''
4852
    A request to delete a node to the server address space.
4853
4854
    :ivar NodeId:
4855
    :vartype NodeId: NodeId
4856
    :ivar DeleteTargetReferences:
4857
    :vartype DeleteTargetReferences: Boolean
4858
    '''
4859 1
    def __init__(self, binary=None):
4860
        if binary is not None:
4861
            self._binary_init(binary)
4862
            self._freeze()
4863
            return
4864
        self.NodeId = NodeId()
4865
        self.DeleteTargetReferences = True
4866
        self._freeze()
4867
4868 1
    def to_binary(self):
4869
        packet = []
4870
        packet.append(self.NodeId.to_binary())
4871
        packet.append(uatype_Boolean.pack(self.DeleteTargetReferences))
4872
        return b''.join(packet)
4873
4874 1
    @staticmethod
4875
    def from_binary(data):
4876
        return DeleteNodesItem(data)
4877
4878 1
    def _binary_init(self, data):
4879
        self.NodeId = NodeId.from_binary(data)
4880
        self.DeleteTargetReferences = uatype_Boolean.unpack(data.read(1))[0]
4881
4882 1
    def __str__(self):
4883
        return 'DeleteNodesItem(' + 'NodeId:' + str(self.NodeId) + ', ' + \
4884
               'DeleteTargetReferences:' + str(self.DeleteTargetReferences) + ')'
4885
4886 1
    __repr__ = __str__
4887
4888
4889 1
class DeleteNodesParameters(FrozenClass):
4890
    '''
4891
    :ivar NodesToDelete:
4892
    :vartype NodesToDelete: DeleteNodesItem
4893
    '''
4894 1
    def __init__(self, binary=None):
4895
        if binary is not None:
4896
            self._binary_init(binary)
4897
            self._freeze()
4898
            return
4899
        self.NodesToDelete = []
4900
        self._freeze()
4901
4902 1
    def to_binary(self):
4903
        packet = []
4904
        packet.append(uatype_Int32.pack(len(self.NodesToDelete)))
4905
        for fieldname in self.NodesToDelete:
4906
            packet.append(fieldname.to_binary())
4907
        return b''.join(packet)
4908
4909 1
    @staticmethod
4910
    def from_binary(data):
4911
        return DeleteNodesParameters(data)
4912
4913 1
    def _binary_init(self, data):
4914
        length = uatype_Int32.unpack(data.read(4))[0]
4915
        array = []
4916
        if length != -1:
4917
            for _ in range(0, length):
4918
                array.append(DeleteNodesItem.from_binary(data))
4919
        self.NodesToDelete = array
4920
4921 1
    def __str__(self):
4922
        return 'DeleteNodesParameters(' + 'NodesToDelete:' + str(self.NodesToDelete) + ')'
4923
4924 1
    __repr__ = __str__
4925
4926
4927 1
class DeleteNodesRequest(FrozenClass):
4928
    '''
4929
    Delete one or more nodes from the server address space.
4930
4931
    :ivar TypeId:
4932
    :vartype TypeId: NodeId
4933
    :ivar RequestHeader:
4934
    :vartype RequestHeader: RequestHeader
4935
    :ivar Parameters:
4936
    :vartype Parameters: DeleteNodesParameters
4937
    '''
4938 1
    def __init__(self, binary=None):
4939
        if binary is not None:
4940
            self._binary_init(binary)
4941
            self._freeze()
4942
            return
4943
        self.TypeId = FourByteNodeId(ObjectIds.DeleteNodesRequest_Encoding_DefaultBinary)
4944
        self.RequestHeader = RequestHeader()
4945
        self.Parameters = DeleteNodesParameters()
4946
        self._freeze()
4947
4948 1
    def to_binary(self):
4949
        packet = []
4950
        packet.append(self.TypeId.to_binary())
4951
        packet.append(self.RequestHeader.to_binary())
4952
        packet.append(self.Parameters.to_binary())
4953
        return b''.join(packet)
4954
4955 1
    @staticmethod
4956
    def from_binary(data):
4957
        return DeleteNodesRequest(data)
4958
4959 1
    def _binary_init(self, data):
4960
        self.TypeId = NodeId.from_binary(data)
4961
        self.RequestHeader = RequestHeader.from_binary(data)
4962
        self.Parameters = DeleteNodesParameters.from_binary(data)
4963
4964 1
    def __str__(self):
4965
        return 'DeleteNodesRequest(' + 'TypeId:' + str(self.TypeId) + ', ' + \
4966
               'RequestHeader:' + str(self.RequestHeader) + ', ' + \
4967
               'Parameters:' + str(self.Parameters) + ')'
4968
4969 1
    __repr__ = __str__
4970
4971
4972 1
class DeleteNodesResult(FrozenClass):
4973
    '''
4974
    :ivar Results:
4975
    :vartype Results: StatusCode
4976
    :ivar DiagnosticInfos:
4977
    :vartype DiagnosticInfos: DiagnosticInfo
4978
    '''
4979 1
    def __init__(self, binary=None):
4980
        if binary is not None:
4981
            self._binary_init(binary)
4982
            self._freeze()
4983
            return
4984
        self.Results = []
4985
        self.DiagnosticInfos = []
4986
        self._freeze()
4987
4988 1
    def to_binary(self):
4989
        packet = []
4990
        packet.append(uatype_Int32.pack(len(self.Results)))
4991
        for fieldname in self.Results:
4992
            packet.append(fieldname.to_binary())
4993
        packet.append(uatype_Int32.pack(len(self.DiagnosticInfos)))
4994
        for fieldname in self.DiagnosticInfos:
4995
            packet.append(fieldname.to_binary())
4996
        return b''.join(packet)
4997
4998 1
    @staticmethod
4999
    def from_binary(data):
5000
        return DeleteNodesResult(data)
5001
5002 1
    def _binary_init(self, data):
5003
        length = uatype_Int32.unpack(data.read(4))[0]
5004
        array = []
5005
        if length != -1:
5006
            for _ in range(0, length):
5007
                array.append(StatusCode.from_binary(data))
5008
        self.Results = array
5009
        length = uatype_Int32.unpack(data.read(4))[0]
5010
        array = []
5011
        if length != -1:
5012
            for _ in range(0, length):
5013
                array.append(DiagnosticInfo.from_binary(data))
5014
        self.DiagnosticInfos = array
5015
5016 1
    def __str__(self):
5017
        return 'DeleteNodesResult(' + 'Results:' + str(self.Results) + ', ' + \
5018
               'DiagnosticInfos:' + str(self.DiagnosticInfos) + ')'
5019
5020 1
    __repr__ = __str__
5021
5022
5023 1
class DeleteNodesResponse(FrozenClass):
5024
    '''
5025
    Delete one or more nodes from the server address space.
5026
5027
    :ivar TypeId:
5028
    :vartype TypeId: NodeId
5029
    :ivar ResponseHeader:
5030
    :vartype ResponseHeader: ResponseHeader
5031
    :ivar Parameters:
5032
    :vartype Parameters: DeleteNodesResult
5033
    '''
5034 1
    def __init__(self, binary=None):
5035
        if binary is not None:
5036
            self._binary_init(binary)
5037
            self._freeze()
5038
            return
5039
        self.TypeId = FourByteNodeId(ObjectIds.DeleteNodesResponse_Encoding_DefaultBinary)
5040
        self.ResponseHeader = ResponseHeader()
5041
        self.Parameters = DeleteNodesResult()
5042
        self._freeze()
5043
5044 1
    def to_binary(self):
5045
        packet = []
5046
        packet.append(self.TypeId.to_binary())
5047
        packet.append(self.ResponseHeader.to_binary())
5048
        packet.append(self.Parameters.to_binary())
5049
        return b''.join(packet)
5050
5051 1
    @staticmethod
5052
    def from_binary(data):
5053
        return DeleteNodesResponse(data)
5054
5055 1
    def _binary_init(self, data):
5056
        self.TypeId = NodeId.from_binary(data)
5057
        self.ResponseHeader = ResponseHeader.from_binary(data)
5058
        self.Parameters = DeleteNodesResult.from_binary(data)
5059
5060 1
    def __str__(self):
5061
        return 'DeleteNodesResponse(' + 'TypeId:' + str(self.TypeId) + ', ' + \
5062
               'ResponseHeader:' + str(self.ResponseHeader) + ', ' + \
5063
               'Parameters:' + str(self.Parameters) + ')'
5064
5065 1
    __repr__ = __str__
5066
5067
5068 1
class DeleteReferencesItem(FrozenClass):
5069
    '''
5070
    A request to delete a node from the server address space.
5071
5072
    :ivar SourceNodeId:
5073
    :vartype SourceNodeId: NodeId
5074
    :ivar ReferenceTypeId:
5075
    :vartype ReferenceTypeId: NodeId
5076
    :ivar IsForward:
5077
    :vartype IsForward: Boolean
5078
    :ivar TargetNodeId:
5079
    :vartype TargetNodeId: ExpandedNodeId
5080
    :ivar DeleteBidirectional:
5081
    :vartype DeleteBidirectional: Boolean
5082
    '''
5083 1
    def __init__(self, binary=None):
5084
        if binary is not None:
5085
            self._binary_init(binary)
5086
            self._freeze()
5087
            return
5088
        self.SourceNodeId = NodeId()
5089
        self.ReferenceTypeId = NodeId()
5090
        self.IsForward = True
5091
        self.TargetNodeId = ExpandedNodeId()
5092
        self.DeleteBidirectional = True
5093
        self._freeze()
5094
5095 1
    def to_binary(self):
5096
        packet = []
5097
        packet.append(self.SourceNodeId.to_binary())
5098
        packet.append(self.ReferenceTypeId.to_binary())
5099
        packet.append(uatype_Boolean.pack(self.IsForward))
5100
        packet.append(self.TargetNodeId.to_binary())
5101
        packet.append(uatype_Boolean.pack(self.DeleteBidirectional))
5102
        return b''.join(packet)
5103
5104 1
    @staticmethod
5105
    def from_binary(data):
5106
        return DeleteReferencesItem(data)
5107
5108 1
    def _binary_init(self, data):
5109
        self.SourceNodeId = NodeId.from_binary(data)
5110
        self.ReferenceTypeId = NodeId.from_binary(data)
5111
        self.IsForward = uatype_Boolean.unpack(data.read(1))[0]
5112
        self.TargetNodeId = ExpandedNodeId.from_binary(data)
5113
        self.DeleteBidirectional = uatype_Boolean.unpack(data.read(1))[0]
5114
5115 1
    def __str__(self):
5116
        return 'DeleteReferencesItem(' + 'SourceNodeId:' + str(self.SourceNodeId) + ', ' + \
5117
               'ReferenceTypeId:' + str(self.ReferenceTypeId) + ', ' + \
5118
               'IsForward:' + str(self.IsForward) + ', ' + \
5119
               'TargetNodeId:' + str(self.TargetNodeId) + ', ' + \
5120
               'DeleteBidirectional:' + str(self.DeleteBidirectional) + ')'
5121
5122 1
    __repr__ = __str__
5123
5124
5125 1
class DeleteReferencesParameters(FrozenClass):
5126
    '''
5127
    :ivar ReferencesToDelete:
5128
    :vartype ReferencesToDelete: DeleteReferencesItem
5129
    '''
5130 1
    def __init__(self, binary=None):
5131
        if binary is not None:
5132
            self._binary_init(binary)
5133
            self._freeze()
5134
            return
5135
        self.ReferencesToDelete = []
5136
        self._freeze()
5137
5138 1
    def to_binary(self):
5139
        packet = []
5140
        packet.append(uatype_Int32.pack(len(self.ReferencesToDelete)))
5141
        for fieldname in self.ReferencesToDelete:
5142
            packet.append(fieldname.to_binary())
5143
        return b''.join(packet)
5144
5145 1
    @staticmethod
5146
    def from_binary(data):
5147
        return DeleteReferencesParameters(data)
5148
5149 1
    def _binary_init(self, data):
5150
        length = uatype_Int32.unpack(data.read(4))[0]
5151
        array = []
5152
        if length != -1:
5153
            for _ in range(0, length):
5154
                array.append(DeleteReferencesItem.from_binary(data))
5155
        self.ReferencesToDelete = array
5156
5157 1
    def __str__(self):
5158
        return 'DeleteReferencesParameters(' + 'ReferencesToDelete:' + str(self.ReferencesToDelete) + ')'
5159
5160 1
    __repr__ = __str__
5161
5162
5163 1
class DeleteReferencesRequest(FrozenClass):
5164
    '''
5165
    Delete one or more references from the server address space.
5166
5167
    :ivar TypeId:
5168
    :vartype TypeId: NodeId
5169
    :ivar RequestHeader:
5170
    :vartype RequestHeader: RequestHeader
5171
    :ivar Parameters:
5172
    :vartype Parameters: DeleteReferencesParameters
5173
    '''
5174 1
    def __init__(self, binary=None):
5175
        if binary is not None:
5176
            self._binary_init(binary)
5177
            self._freeze()
5178
            return
5179
        self.TypeId = FourByteNodeId(ObjectIds.DeleteReferencesRequest_Encoding_DefaultBinary)
5180
        self.RequestHeader = RequestHeader()
5181
        self.Parameters = DeleteReferencesParameters()
5182
        self._freeze()
5183
5184 1
    def to_binary(self):
5185
        packet = []
5186
        packet.append(self.TypeId.to_binary())
5187
        packet.append(self.RequestHeader.to_binary())
5188
        packet.append(self.Parameters.to_binary())
5189
        return b''.join(packet)
5190
5191 1
    @staticmethod
5192
    def from_binary(data):
5193
        return DeleteReferencesRequest(data)
5194
5195 1
    def _binary_init(self, data):
5196
        self.TypeId = NodeId.from_binary(data)
5197
        self.RequestHeader = RequestHeader.from_binary(data)
5198
        self.Parameters = DeleteReferencesParameters.from_binary(data)
5199
5200 1
    def __str__(self):
5201
        return 'DeleteReferencesRequest(' + 'TypeId:' + str(self.TypeId) + ', ' + \
5202
               'RequestHeader:' + str(self.RequestHeader) + ', ' + \
5203
               'Parameters:' + str(self.Parameters) + ')'
5204
5205 1
    __repr__ = __str__
5206
5207
5208 1
class DeleteReferencesResult(FrozenClass):
5209
    '''
5210
    :ivar Results:
5211
    :vartype Results: StatusCode
5212
    :ivar DiagnosticInfos:
5213
    :vartype DiagnosticInfos: DiagnosticInfo
5214
    '''
5215 1
    def __init__(self, binary=None):
5216
        if binary is not None:
5217
            self._binary_init(binary)
5218
            self._freeze()
5219
            return
5220
        self.Results = []
5221
        self.DiagnosticInfos = []
5222
        self._freeze()
5223
5224 1
    def to_binary(self):
5225
        packet = []
5226
        packet.append(uatype_Int32.pack(len(self.Results)))
5227
        for fieldname in self.Results:
5228
            packet.append(fieldname.to_binary())
5229
        packet.append(uatype_Int32.pack(len(self.DiagnosticInfos)))
5230
        for fieldname in self.DiagnosticInfos:
5231
            packet.append(fieldname.to_binary())
5232
        return b''.join(packet)
5233
5234 1
    @staticmethod
5235
    def from_binary(data):
5236
        return DeleteReferencesResult(data)
5237
5238 1
    def _binary_init(self, data):
5239
        length = uatype_Int32.unpack(data.read(4))[0]
5240
        array = []
5241
        if length != -1:
5242
            for _ in range(0, length):
5243
                array.append(StatusCode.from_binary(data))
5244
        self.Results = array
5245
        length = uatype_Int32.unpack(data.read(4))[0]
5246
        array = []
5247
        if length != -1:
5248
            for _ in range(0, length):
5249
                array.append(DiagnosticInfo.from_binary(data))
5250
        self.DiagnosticInfos = array
5251
5252 1
    def __str__(self):
5253
        return 'DeleteReferencesResult(' + 'Results:' + str(self.Results) + ', ' + \
5254
               'DiagnosticInfos:' + str(self.DiagnosticInfos) + ')'
5255
5256 1
    __repr__ = __str__
5257
5258
5259 1
class DeleteReferencesResponse(FrozenClass):
5260
    '''
5261
    Delete one or more references from the server address space.
5262
5263
    :ivar TypeId:
5264
    :vartype TypeId: NodeId
5265
    :ivar ResponseHeader:
5266
    :vartype ResponseHeader: ResponseHeader
5267
    :ivar Parameters:
5268
    :vartype Parameters: DeleteReferencesResult
5269
    '''
5270 1
    def __init__(self, binary=None):
5271
        if binary is not None:
5272
            self._binary_init(binary)
5273
            self._freeze()
5274
            return
5275
        self.TypeId = FourByteNodeId(ObjectIds.DeleteReferencesResponse_Encoding_DefaultBinary)
5276
        self.ResponseHeader = ResponseHeader()
5277
        self.Parameters = DeleteReferencesResult()
5278
        self._freeze()
5279
5280 1
    def to_binary(self):
5281
        packet = []
5282
        packet.append(self.TypeId.to_binary())
5283
        packet.append(self.ResponseHeader.to_binary())
5284
        packet.append(self.Parameters.to_binary())
5285
        return b''.join(packet)
5286
5287 1
    @staticmethod
5288
    def from_binary(data):
5289
        return DeleteReferencesResponse(data)
5290
5291 1
    def _binary_init(self, data):
5292
        self.TypeId = NodeId.from_binary(data)
5293
        self.ResponseHeader = ResponseHeader.from_binary(data)
5294
        self.Parameters = DeleteReferencesResult.from_binary(data)
5295
5296 1
    def __str__(self):
5297
        return 'DeleteReferencesResponse(' + 'TypeId:' + str(self.TypeId) + ', ' + \
5298
               'ResponseHeader:' + str(self.ResponseHeader) + ', ' + \
5299
               'Parameters:' + str(self.Parameters) + ')'
5300
5301 1
    __repr__ = __str__
5302
5303
5304 1
class ViewDescription(FrozenClass):
5305
    '''
5306
    The view to browse.
5307
5308
    :ivar ViewId:
5309
    :vartype ViewId: NodeId
5310
    :ivar Timestamp:
5311
    :vartype Timestamp: DateTime
5312
    :ivar ViewVersion:
5313
    :vartype ViewVersion: UInt32
5314
    '''
5315 1
    def __init__(self, binary=None):
5316 1
        if binary is not None:
5317 1
            self._binary_init(binary)
5318 1
            self._freeze()
5319 1
            return
5320 1
        self.ViewId = NodeId()
5321 1
        self.Timestamp = datetime.now()
5322 1
        self.ViewVersion = 0
5323 1
        self._freeze()
5324
5325 1
    def to_binary(self):
5326 1
        packet = []
5327 1
        packet.append(self.ViewId.to_binary())
5328 1
        packet.append(pack_datetime(self.Timestamp))
5329 1
        packet.append(uatype_UInt32.pack(self.ViewVersion))
5330 1
        return b''.join(packet)
5331
5332 1
    @staticmethod
5333
    def from_binary(data):
5334 1
        return ViewDescription(data)
5335
5336 1
    def _binary_init(self, data):
5337 1
        self.ViewId = NodeId.from_binary(data)
5338 1
        self.Timestamp = unpack_datetime(data)
5339 1
        self.ViewVersion = uatype_UInt32.unpack(data.read(4))[0]
5340
5341 1
    def __str__(self):
5342
        return 'ViewDescription(' + 'ViewId:' + str(self.ViewId) + ', ' + \
5343
               'Timestamp:' + str(self.Timestamp) + ', ' + \
5344
               'ViewVersion:' + str(self.ViewVersion) + ')'
5345
5346 1
    __repr__ = __str__
5347
5348
5349 1
class BrowseDescription(FrozenClass):
5350
    '''
5351
    A request to browse the the references from a node.
5352
5353
    :ivar NodeId:
5354
    :vartype NodeId: NodeId
5355
    :ivar BrowseDirection:
5356
    :vartype BrowseDirection: BrowseDirection
5357
    :ivar ReferenceTypeId:
5358
    :vartype ReferenceTypeId: NodeId
5359
    :ivar IncludeSubtypes:
5360
    :vartype IncludeSubtypes: Boolean
5361
    :ivar NodeClassMask:
5362
    :vartype NodeClassMask: UInt32
5363
    :ivar ResultMask:
5364
    :vartype ResultMask: UInt32
5365
    '''
5366 1
    def __init__(self, binary=None):
5367 1
        if binary is not None:
5368 1
            self._binary_init(binary)
5369 1
            self._freeze()
5370 1
            return
5371 1
        self.NodeId = NodeId()
5372 1
        self.BrowseDirection = 0
5373 1
        self.ReferenceTypeId = NodeId()
5374 1
        self.IncludeSubtypes = True
5375 1
        self.NodeClassMask = 0
5376 1
        self.ResultMask = 0
5377 1
        self._freeze()
5378
5379 1
    def to_binary(self):
5380 1
        packet = []
5381 1
        packet.append(self.NodeId.to_binary())
5382 1
        packet.append(uatype_UInt32.pack(self.BrowseDirection))
5383 1
        packet.append(self.ReferenceTypeId.to_binary())
5384 1
        packet.append(uatype_Boolean.pack(self.IncludeSubtypes))
5385 1
        packet.append(uatype_UInt32.pack(self.NodeClassMask))
5386 1
        packet.append(uatype_UInt32.pack(self.ResultMask))
5387 1
        return b''.join(packet)
5388
5389 1
    @staticmethod
5390
    def from_binary(data):
5391 1
        return BrowseDescription(data)
5392
5393 1
    def _binary_init(self, data):
5394 1
        self.NodeId = NodeId.from_binary(data)
5395 1
        self.BrowseDirection = uatype_UInt32.unpack(data.read(4))[0]
5396 1
        self.ReferenceTypeId = NodeId.from_binary(data)
5397 1
        self.IncludeSubtypes = uatype_Boolean.unpack(data.read(1))[0]
5398 1
        self.NodeClassMask = uatype_UInt32.unpack(data.read(4))[0]
5399 1
        self.ResultMask = uatype_UInt32.unpack(data.read(4))[0]
5400
5401 1
    def __str__(self):
5402
        return 'BrowseDescription(' + 'NodeId:' + str(self.NodeId) + ', ' + \
5403
               'BrowseDirection:' + str(self.BrowseDirection) + ', ' + \
5404
               'ReferenceTypeId:' + str(self.ReferenceTypeId) + ', ' + \
5405
               'IncludeSubtypes:' + str(self.IncludeSubtypes) + ', ' + \
5406
               'NodeClassMask:' + str(self.NodeClassMask) + ', ' + \
5407
               'ResultMask:' + str(self.ResultMask) + ')'
5408
5409 1
    __repr__ = __str__
5410
5411
5412 1
class ReferenceDescription(FrozenClass):
5413
    '''
5414
    The description of a reference.
5415
5416
    :ivar ReferenceTypeId:
5417
    :vartype ReferenceTypeId: NodeId
5418
    :ivar IsForward:
5419
    :vartype IsForward: Boolean
5420
    :ivar NodeId:
5421
    :vartype NodeId: ExpandedNodeId
5422
    :ivar BrowseName:
5423
    :vartype BrowseName: QualifiedName
5424
    :ivar DisplayName:
5425
    :vartype DisplayName: LocalizedText
5426
    :ivar NodeClass:
5427
    :vartype NodeClass: NodeClass
5428
    :ivar TypeDefinition:
5429
    :vartype TypeDefinition: ExpandedNodeId
5430
    '''
5431 1
    def __init__(self, binary=None):
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
5432 1
        if binary is not None:
5433 1
            self._binary_init(binary)
5434 1
            self._freeze()
5435 1
            return
5436 1
        self.ReferenceTypeId = NodeId()
5437 1
        self.IsForward = True
5438 1
        self.NodeId = ExpandedNodeId()
5439 1
        self.BrowseName = QualifiedName()
5440 1
        self.DisplayName = LocalizedText()
5441 1
        self.NodeClass = 0
5442 1
        self.TypeDefinition = ExpandedNodeId()
5443 1
        self._freeze()
5444
5445 1
    def to_binary(self):
5446 1
        packet = []
5447 1
        packet.append(self.ReferenceTypeId.to_binary())
5448 1
        packet.append(uatype_Boolean.pack(self.IsForward))
5449 1
        packet.append(self.NodeId.to_binary())
5450 1
        packet.append(self.BrowseName.to_binary())
5451 1
        packet.append(self.DisplayName.to_binary())
5452 1
        packet.append(uatype_UInt32.pack(self.NodeClass))
5453 1
        packet.append(self.TypeDefinition.to_binary())
5454 1
        return b''.join(packet)
5455
5456 1
    @staticmethod
5457
    def from_binary(data):
5458 1
        return ReferenceDescription(data)
5459
5460 1
    def _binary_init(self, data):
5461 1
        self.ReferenceTypeId = NodeId.from_binary(data)
5462 1
        self.IsForward = uatype_Boolean.unpack(data.read(1))[0]
5463 1
        self.NodeId = ExpandedNodeId.from_binary(data)
5464 1
        self.BrowseName = QualifiedName.from_binary(data)
5465 1
        self.DisplayName = LocalizedText.from_binary(data)
5466 1
        self.NodeClass = uatype_UInt32.unpack(data.read(4))[0]
5467 1
        self.TypeDefinition = ExpandedNodeId.from_binary(data)
5468
5469 1
    def __str__(self):
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
5470
        return 'ReferenceDescription(' + 'ReferenceTypeId:' + str(self.ReferenceTypeId) + ', ' + \
5471
               'IsForward:' + str(self.IsForward) + ', ' + \
5472
               'NodeId:' + str(self.NodeId) + ', ' + \
5473
               'BrowseName:' + str(self.BrowseName) + ', ' + \
5474
               'DisplayName:' + str(self.DisplayName) + ', ' + \
5475
               'NodeClass:' + str(self.NodeClass) + ', ' + \
5476
               'TypeDefinition:' + str(self.TypeDefinition) + ')'
5477
5478 1
    __repr__ = __str__
5479
5480
5481 1
class BrowseResult(FrozenClass):
5482
    '''
5483
    The result of a browse operation.
5484
5485
    :ivar StatusCode:
5486
    :vartype StatusCode: StatusCode
5487
    :ivar ContinuationPoint:
5488
    :vartype ContinuationPoint: ByteString
5489
    :ivar References:
5490
    :vartype References: ReferenceDescription
5491
    '''
5492 1
    def __init__(self, binary=None):
5493 1
        if binary is not None:
5494 1
            self._binary_init(binary)
5495 1
            self._freeze()
5496 1
            return
5497 1
        self.StatusCode = StatusCode()
5498 1
        self.ContinuationPoint = b''
5499 1
        self.References = []
5500 1
        self._freeze()
5501
5502 1
    def to_binary(self):
5503 1
        packet = []
5504 1
        packet.append(self.StatusCode.to_binary())
5505 1
        packet.append(pack_bytes(self.ContinuationPoint))
5506 1
        packet.append(uatype_Int32.pack(len(self.References)))
5507 1
        for fieldname in self.References:
5508 1
            packet.append(fieldname.to_binary())
5509 1
        return b''.join(packet)
5510
5511 1
    @staticmethod
5512
    def from_binary(data):
5513 1
        return BrowseResult(data)
5514
5515 1
    def _binary_init(self, data):
5516 1
        self.StatusCode = StatusCode.from_binary(data)
5517 1
        self.ContinuationPoint = unpack_bytes(data)
5518 1
        length = uatype_Int32.unpack(data.read(4))[0]
5519 1
        array = []
5520 1
        if length != -1:
5521 1
            for _ in range(0, length):
5522 1
                array.append(ReferenceDescription.from_binary(data))
5523 1
        self.References = array
5524
5525 1
    def __str__(self):
5526
        return 'BrowseResult(' + 'StatusCode:' + str(self.StatusCode) + ', ' + \
5527
               'ContinuationPoint:' + str(self.ContinuationPoint) + ', ' + \
5528
               'References:' + str(self.References) + ')'
5529
5530 1
    __repr__ = __str__
5531
5532
5533 1
class BrowseParameters(FrozenClass):
5534
    '''
5535
    :ivar View:
5536
    :vartype View: ViewDescription
5537
    :ivar RequestedMaxReferencesPerNode:
5538
    :vartype RequestedMaxReferencesPerNode: UInt32
5539
    :ivar NodesToBrowse:
5540
    :vartype NodesToBrowse: BrowseDescription
5541
    '''
5542 1
    def __init__(self, binary=None):
5543 1
        if binary is not None:
5544 1
            self._binary_init(binary)
5545 1
            self._freeze()
5546 1
            return
5547 1
        self.View = ViewDescription()
5548 1
        self.RequestedMaxReferencesPerNode = 0
5549 1
        self.NodesToBrowse = []
5550 1
        self._freeze()
5551
5552 1
    def to_binary(self):
5553 1
        packet = []
5554 1
        packet.append(self.View.to_binary())
5555 1
        packet.append(uatype_UInt32.pack(self.RequestedMaxReferencesPerNode))
5556 1
        packet.append(uatype_Int32.pack(len(self.NodesToBrowse)))
5557 1
        for fieldname in self.NodesToBrowse:
5558 1
            packet.append(fieldname.to_binary())
5559 1
        return b''.join(packet)
5560
5561 1
    @staticmethod
5562
    def from_binary(data):
5563 1
        return BrowseParameters(data)
5564
5565 1
    def _binary_init(self, data):
5566 1
        self.View = ViewDescription.from_binary(data)
5567 1
        self.RequestedMaxReferencesPerNode = uatype_UInt32.unpack(data.read(4))[0]
5568 1
        length = uatype_Int32.unpack(data.read(4))[0]
5569 1
        array = []
5570 1
        if length != -1:
5571 1
            for _ in range(0, length):
5572 1
                array.append(BrowseDescription.from_binary(data))
5573 1
        self.NodesToBrowse = array
5574
5575 1
    def __str__(self):
5576
        return 'BrowseParameters(' + 'View:' + str(self.View) + ', ' + \
5577
               'RequestedMaxReferencesPerNode:' + str(self.RequestedMaxReferencesPerNode) + ', ' + \
5578
               'NodesToBrowse:' + str(self.NodesToBrowse) + ')'
5579
5580 1
    __repr__ = __str__
5581
5582
5583 1
class BrowseRequest(FrozenClass):
5584
    '''
5585
    Browse the references for one or more nodes from the server address space.
5586
5587
    :ivar TypeId:
5588
    :vartype TypeId: NodeId
5589
    :ivar RequestHeader:
5590
    :vartype RequestHeader: RequestHeader
5591
    :ivar Parameters:
5592
    :vartype Parameters: BrowseParameters
5593
    '''
5594 1
    def __init__(self, binary=None):
5595 1
        if binary is not None:
5596
            self._binary_init(binary)
5597
            self._freeze()
5598
            return
5599 1
        self.TypeId = FourByteNodeId(ObjectIds.BrowseRequest_Encoding_DefaultBinary)
5600 1
        self.RequestHeader = RequestHeader()
5601 1
        self.Parameters = BrowseParameters()
5602 1
        self._freeze()
5603
5604 1
    def to_binary(self):
5605 1
        packet = []
5606 1
        packet.append(self.TypeId.to_binary())
5607 1
        packet.append(self.RequestHeader.to_binary())
5608 1
        packet.append(self.Parameters.to_binary())
5609 1
        return b''.join(packet)
5610
5611 1
    @staticmethod
5612
    def from_binary(data):
5613
        return BrowseRequest(data)
5614
5615 1
    def _binary_init(self, data):
5616
        self.TypeId = NodeId.from_binary(data)
5617
        self.RequestHeader = RequestHeader.from_binary(data)
5618
        self.Parameters = BrowseParameters.from_binary(data)
5619
5620 1
    def __str__(self):
5621
        return 'BrowseRequest(' + 'TypeId:' + str(self.TypeId) + ', ' + \
5622
               'RequestHeader:' + str(self.RequestHeader) + ', ' + \
5623
               'Parameters:' + str(self.Parameters) + ')'
5624
5625 1
    __repr__ = __str__
5626
5627
5628 1
class BrowseResponse(FrozenClass):
5629
    '''
5630
    Browse the references for one or more nodes from the server address space.
5631
5632
    :ivar TypeId:
5633
    :vartype TypeId: NodeId
5634
    :ivar ResponseHeader:
5635
    :vartype ResponseHeader: ResponseHeader
5636
    :ivar Results:
5637
    :vartype Results: BrowseResult
5638
    :ivar DiagnosticInfos:
5639
    :vartype DiagnosticInfos: DiagnosticInfo
5640
    '''
5641 1
    def __init__(self, binary=None):
5642 1
        if binary is not None:
5643 1
            self._binary_init(binary)
5644 1
            self._freeze()
5645 1
            return
5646 1
        self.TypeId = FourByteNodeId(ObjectIds.BrowseResponse_Encoding_DefaultBinary)
5647 1
        self.ResponseHeader = ResponseHeader()
5648 1
        self.Results = []
5649 1
        self.DiagnosticInfos = []
5650 1
        self._freeze()
5651
5652 1
    def to_binary(self):
5653 1
        packet = []
5654 1
        packet.append(self.TypeId.to_binary())
5655 1
        packet.append(self.ResponseHeader.to_binary())
5656 1
        packet.append(uatype_Int32.pack(len(self.Results)))
5657 1
        for fieldname in self.Results:
5658 1
            packet.append(fieldname.to_binary())
5659 1
        packet.append(uatype_Int32.pack(len(self.DiagnosticInfos)))
5660 1
        for fieldname in self.DiagnosticInfos:
5661
            packet.append(fieldname.to_binary())
5662 1
        return b''.join(packet)
5663
5664 1
    @staticmethod
5665
    def from_binary(data):
5666 1
        return BrowseResponse(data)
5667
5668 1
    def _binary_init(self, data):
5669 1
        self.TypeId = NodeId.from_binary(data)
5670 1
        self.ResponseHeader = ResponseHeader.from_binary(data)
5671 1
        length = uatype_Int32.unpack(data.read(4))[0]
5672 1
        array = []
5673 1
        if length != -1:
5674 1
            for _ in range(0, length):
5675 1
                array.append(BrowseResult.from_binary(data))
5676 1
        self.Results = array
5677 1
        length = uatype_Int32.unpack(data.read(4))[0]
5678 1
        array = []
5679 1
        if length != -1:
5680 1
            for _ in range(0, length):
5681
                array.append(DiagnosticInfo.from_binary(data))
5682 1
        self.DiagnosticInfos = array
5683
5684 1
    def __str__(self):
5685
        return 'BrowseResponse(' + 'TypeId:' + str(self.TypeId) + ', ' + \
5686
               'ResponseHeader:' + str(self.ResponseHeader) + ', ' + \
5687
               'Results:' + str(self.Results) + ', ' + \
5688
               'DiagnosticInfos:' + str(self.DiagnosticInfos) + ')'
5689
5690 1
    __repr__ = __str__
5691
5692
5693 1
class BrowseNextParameters(FrozenClass):
5694
    '''
5695
    :ivar ReleaseContinuationPoints:
5696
    :vartype ReleaseContinuationPoints: Boolean
5697
    :ivar ContinuationPoints:
5698
    :vartype ContinuationPoints: ByteString
5699
    '''
5700 1
    def __init__(self, binary=None):
5701
        if binary is not None:
5702
            self._binary_init(binary)
5703
            self._freeze()
5704
            return
5705
        self.ReleaseContinuationPoints = True
5706
        self.ContinuationPoints = []
5707
        self._freeze()
5708
5709 1
    def to_binary(self):
5710
        packet = []
5711
        packet.append(uatype_Boolean.pack(self.ReleaseContinuationPoints))
5712
        packet.append(uatype_Int32.pack(len(self.ContinuationPoints)))
5713
        for fieldname in self.ContinuationPoints:
5714
            packet.append(pack_bytes(fieldname))
5715
        return b''.join(packet)
5716
5717 1
    @staticmethod
5718
    def from_binary(data):
5719
        return BrowseNextParameters(data)
5720
5721 1
    def _binary_init(self, data):
5722
        self.ReleaseContinuationPoints = uatype_Boolean.unpack(data.read(1))[0]
5723
        self.ContinuationPoints = unpack_uatype_array('ByteString', data)
5724
5725 1
    def __str__(self):
5726
        return 'BrowseNextParameters(' + 'ReleaseContinuationPoints:' + str(self.ReleaseContinuationPoints) + ', ' + \
5727
               'ContinuationPoints:' + str(self.ContinuationPoints) + ')'
5728
5729 1
    __repr__ = __str__
5730
5731
5732 1
class BrowseNextRequest(FrozenClass):
5733
    '''
5734
    Continues one or more browse operations.
5735
5736
    :ivar TypeId:
5737
    :vartype TypeId: NodeId
5738
    :ivar RequestHeader:
5739
    :vartype RequestHeader: RequestHeader
5740
    :ivar Parameters:
5741
    :vartype Parameters: BrowseNextParameters
5742
    '''
5743 1
    def __init__(self, binary=None):
5744
        if binary is not None:
5745
            self._binary_init(binary)
5746
            self._freeze()
5747
            return
5748
        self.TypeId = FourByteNodeId(ObjectIds.BrowseNextRequest_Encoding_DefaultBinary)
5749
        self.RequestHeader = RequestHeader()
5750
        self.Parameters = BrowseNextParameters()
5751
        self._freeze()
5752
5753 1
    def to_binary(self):
5754
        packet = []
5755
        packet.append(self.TypeId.to_binary())
5756
        packet.append(self.RequestHeader.to_binary())
5757
        packet.append(self.Parameters.to_binary())
5758
        return b''.join(packet)
5759
5760 1
    @staticmethod
5761
    def from_binary(data):
5762
        return BrowseNextRequest(data)
5763
5764 1
    def _binary_init(self, data):
5765
        self.TypeId = NodeId.from_binary(data)
5766
        self.RequestHeader = RequestHeader.from_binary(data)
5767
        self.Parameters = BrowseNextParameters.from_binary(data)
5768
5769 1
    def __str__(self):
5770
        return 'BrowseNextRequest(' + 'TypeId:' + str(self.TypeId) + ', ' + \
5771
               'RequestHeader:' + str(self.RequestHeader) + ', ' + \
5772
               'Parameters:' + str(self.Parameters) + ')'
5773
5774 1
    __repr__ = __str__
5775
5776
5777 1
class BrowseNextResult(FrozenClass):
5778
    '''
5779
    :ivar Results:
5780
    :vartype Results: BrowseResult
5781
    :ivar DiagnosticInfos:
5782
    :vartype DiagnosticInfos: DiagnosticInfo
5783
    '''
5784 1
    def __init__(self, binary=None):
5785
        if binary is not None:
5786
            self._binary_init(binary)
5787
            self._freeze()
5788
            return
5789
        self.Results = []
5790
        self.DiagnosticInfos = []
5791
        self._freeze()
5792
5793 1
    def to_binary(self):
5794
        packet = []
5795
        packet.append(uatype_Int32.pack(len(self.Results)))
5796
        for fieldname in self.Results:
5797
            packet.append(fieldname.to_binary())
5798
        packet.append(uatype_Int32.pack(len(self.DiagnosticInfos)))
5799
        for fieldname in self.DiagnosticInfos:
5800
            packet.append(fieldname.to_binary())
5801
        return b''.join(packet)
5802
5803 1
    @staticmethod
5804
    def from_binary(data):
5805
        return BrowseNextResult(data)
5806
5807 1
    def _binary_init(self, data):
5808
        length = uatype_Int32.unpack(data.read(4))[0]
5809
        array = []
5810
        if length != -1:
5811
            for _ in range(0, length):
5812
                array.append(BrowseResult.from_binary(data))
5813
        self.Results = array
5814
        length = uatype_Int32.unpack(data.read(4))[0]
5815
        array = []
5816
        if length != -1:
5817
            for _ in range(0, length):
5818
                array.append(DiagnosticInfo.from_binary(data))
5819
        self.DiagnosticInfos = array
5820
5821 1
    def __str__(self):
5822
        return 'BrowseNextResult(' + 'Results:' + str(self.Results) + ', ' + \
5823
               'DiagnosticInfos:' + str(self.DiagnosticInfos) + ')'
5824
5825 1
    __repr__ = __str__
5826
5827
5828 1
class BrowseNextResponse(FrozenClass):
5829
    '''
5830
    Continues one or more browse operations.
5831
5832
    :ivar TypeId:
5833
    :vartype TypeId: NodeId
5834
    :ivar ResponseHeader:
5835
    :vartype ResponseHeader: ResponseHeader
5836
    :ivar Parameters:
5837
    :vartype Parameters: BrowseNextResult
5838
    '''
5839 1
    def __init__(self, binary=None):
5840
        if binary is not None:
5841
            self._binary_init(binary)
5842
            self._freeze()
5843
            return
5844
        self.TypeId = FourByteNodeId(ObjectIds.BrowseNextResponse_Encoding_DefaultBinary)
5845
        self.ResponseHeader = ResponseHeader()
5846
        self.Parameters = BrowseNextResult()
5847
        self._freeze()
5848
5849 1
    def to_binary(self):
5850
        packet = []
5851
        packet.append(self.TypeId.to_binary())
5852
        packet.append(self.ResponseHeader.to_binary())
5853
        packet.append(self.Parameters.to_binary())
5854
        return b''.join(packet)
5855
5856 1
    @staticmethod
5857
    def from_binary(data):
5858
        return BrowseNextResponse(data)
5859
5860 1
    def _binary_init(self, data):
5861
        self.TypeId = NodeId.from_binary(data)
5862
        self.ResponseHeader = ResponseHeader.from_binary(data)
5863
        self.Parameters = BrowseNextResult.from_binary(data)
5864
5865 1
    def __str__(self):
5866
        return 'BrowseNextResponse(' + 'TypeId:' + str(self.TypeId) + ', ' + \
5867
               'ResponseHeader:' + str(self.ResponseHeader) + ', ' + \
5868
               'Parameters:' + str(self.Parameters) + ')'
5869
5870 1
    __repr__ = __str__
5871
5872
5873 1
class RelativePathElement(FrozenClass):
5874
    '''
5875
    An element in a relative path.
5876
5877
    :ivar ReferenceTypeId:
5878
    :vartype ReferenceTypeId: NodeId
5879
    :ivar IsInverse:
5880
    :vartype IsInverse: Boolean
5881
    :ivar IncludeSubtypes:
5882
    :vartype IncludeSubtypes: Boolean
5883
    :ivar TargetName:
5884
    :vartype TargetName: QualifiedName
5885
    '''
5886 1
    def __init__(self, binary=None):
5887 1
        if binary is not None:
5888 1
            self._binary_init(binary)
5889 1
            self._freeze()
5890 1
            return
5891 1
        self.ReferenceTypeId = NodeId()
5892 1
        self.IsInverse = True
5893 1
        self.IncludeSubtypes = True
5894 1
        self.TargetName = QualifiedName()
5895 1
        self._freeze()
5896
5897 1
    def to_binary(self):
5898 1
        packet = []
5899 1
        packet.append(self.ReferenceTypeId.to_binary())
5900 1
        packet.append(uatype_Boolean.pack(self.IsInverse))
5901 1
        packet.append(uatype_Boolean.pack(self.IncludeSubtypes))
5902 1
        packet.append(self.TargetName.to_binary())
5903 1
        return b''.join(packet)
5904
5905 1
    @staticmethod
5906
    def from_binary(data):
5907 1
        return RelativePathElement(data)
5908
5909 1
    def _binary_init(self, data):
5910 1
        self.ReferenceTypeId = NodeId.from_binary(data)
5911 1
        self.IsInverse = uatype_Boolean.unpack(data.read(1))[0]
5912 1
        self.IncludeSubtypes = uatype_Boolean.unpack(data.read(1))[0]
5913 1
        self.TargetName = QualifiedName.from_binary(data)
5914
5915 1
    def __str__(self):
5916
        return 'RelativePathElement(' + 'ReferenceTypeId:' + str(self.ReferenceTypeId) + ', ' + \
5917
               'IsInverse:' + str(self.IsInverse) + ', ' + \
5918
               'IncludeSubtypes:' + str(self.IncludeSubtypes) + ', ' + \
5919
               'TargetName:' + str(self.TargetName) + ')'
5920
5921 1
    __repr__ = __str__
5922
5923
5924 1
class RelativePath(FrozenClass):
5925
    '''
5926
    A relative path constructed from reference types and browse names.
5927
5928
    :ivar Elements:
5929
    :vartype Elements: RelativePathElement
5930
    '''
5931 1
    def __init__(self, binary=None):
5932 1
        if binary is not None:
5933 1
            self._binary_init(binary)
5934 1
            self._freeze()
5935 1
            return
5936 1
        self.Elements = []
5937 1
        self._freeze()
5938
5939 1
    def to_binary(self):
5940 1
        packet = []
5941 1
        packet.append(uatype_Int32.pack(len(self.Elements)))
5942 1
        for fieldname in self.Elements:
5943 1
            packet.append(fieldname.to_binary())
5944 1
        return b''.join(packet)
5945
5946 1
    @staticmethod
5947
    def from_binary(data):
5948 1
        return RelativePath(data)
5949
5950 1
    def _binary_init(self, data):
5951 1
        length = uatype_Int32.unpack(data.read(4))[0]
5952 1
        array = []
5953 1
        if length != -1:
5954 1
            for _ in range(0, length):
5955 1
                array.append(RelativePathElement.from_binary(data))
5956 1
        self.Elements = array
5957
5958 1
    def __str__(self):
5959
        return 'RelativePath(' + 'Elements:' + str(self.Elements) + ')'
5960
5961 1
    __repr__ = __str__
5962
5963
5964 1
class BrowsePath(FrozenClass):
5965
    '''
5966
    A request to translate a path into a node id.
5967
5968
    :ivar StartingNode:
5969
    :vartype StartingNode: NodeId
5970
    :ivar RelativePath:
5971
    :vartype RelativePath: RelativePath
5972
    '''
5973 1
    def __init__(self, binary=None):
5974 1
        if binary is not None:
5975 1
            self._binary_init(binary)
5976 1
            self._freeze()
5977 1
            return
5978 1
        self.StartingNode = NodeId()
5979 1
        self.RelativePath = RelativePath()
5980 1
        self._freeze()
5981
5982 1
    def to_binary(self):
5983 1
        packet = []
5984 1
        packet.append(self.StartingNode.to_binary())
5985 1
        packet.append(self.RelativePath.to_binary())
5986 1
        return b''.join(packet)
5987
5988 1
    @staticmethod
5989
    def from_binary(data):
5990 1
        return BrowsePath(data)
5991
5992 1
    def _binary_init(self, data):
5993 1
        self.StartingNode = NodeId.from_binary(data)
5994 1
        self.RelativePath = RelativePath.from_binary(data)
5995
5996 1
    def __str__(self):
5997
        return 'BrowsePath(' + 'StartingNode:' + str(self.StartingNode) + ', ' + \
5998
               'RelativePath:' + str(self.RelativePath) + ')'
5999
6000 1
    __repr__ = __str__
6001
6002
6003 1
class BrowsePathTarget(FrozenClass):
6004
    '''
6005
    The target of the translated path.
6006
6007
    :ivar TargetId:
6008
    :vartype TargetId: ExpandedNodeId
6009
    :ivar RemainingPathIndex:
6010
    :vartype RemainingPathIndex: UInt32
6011
    '''
6012 1
    def __init__(self, binary=None):
6013 1
        if binary is not None:
6014 1
            self._binary_init(binary)
6015 1
            self._freeze()
6016 1
            return
6017 1
        self.TargetId = ExpandedNodeId()
6018 1
        self.RemainingPathIndex = 0
6019 1
        self._freeze()
6020
6021 1
    def to_binary(self):
6022 1
        packet = []
6023 1
        packet.append(self.TargetId.to_binary())
6024 1
        packet.append(uatype_UInt32.pack(self.RemainingPathIndex))
6025 1
        return b''.join(packet)
6026
6027 1
    @staticmethod
6028
    def from_binary(data):
6029 1
        return BrowsePathTarget(data)
6030
6031 1
    def _binary_init(self, data):
6032 1
        self.TargetId = ExpandedNodeId.from_binary(data)
6033 1
        self.RemainingPathIndex = uatype_UInt32.unpack(data.read(4))[0]
6034
6035 1
    def __str__(self):
6036
        return 'BrowsePathTarget(' + 'TargetId:' + str(self.TargetId) + ', ' + \
6037
               'RemainingPathIndex:' + str(self.RemainingPathIndex) + ')'
6038
6039 1
    __repr__ = __str__
6040
6041
6042 1
class BrowsePathResult(FrozenClass):
6043
    '''
6044
    The result of a translate opearation.
6045
6046
    :ivar StatusCode:
6047
    :vartype StatusCode: StatusCode
6048
    :ivar Targets:
6049
    :vartype Targets: BrowsePathTarget
6050
    '''
6051 1
    def __init__(self, binary=None):
6052 1
        if binary is not None:
6053 1
            self._binary_init(binary)
6054 1
            self._freeze()
6055 1
            return
6056 1
        self.StatusCode = StatusCode()
6057 1
        self.Targets = []
6058 1
        self._freeze()
6059
6060 1
    def to_binary(self):
6061 1
        packet = []
6062 1
        packet.append(self.StatusCode.to_binary())
6063 1
        packet.append(uatype_Int32.pack(len(self.Targets)))
6064 1
        for fieldname in self.Targets:
6065 1
            packet.append(fieldname.to_binary())
6066 1
        return b''.join(packet)
6067
6068 1
    @staticmethod
6069
    def from_binary(data):
6070 1
        return BrowsePathResult(data)
6071
6072 1
    def _binary_init(self, data):
6073 1
        self.StatusCode = StatusCode.from_binary(data)
6074 1
        length = uatype_Int32.unpack(data.read(4))[0]
6075 1
        array = []
6076 1
        if length != -1:
6077 1
            for _ in range(0, length):
6078 1
                array.append(BrowsePathTarget.from_binary(data))
6079 1
        self.Targets = array
6080
6081 1
    def __str__(self):
6082
        return 'BrowsePathResult(' + 'StatusCode:' + str(self.StatusCode) + ', ' + \
6083
               'Targets:' + str(self.Targets) + ')'
6084
6085 1
    __repr__ = __str__
6086
6087
6088 1
class TranslateBrowsePathsToNodeIdsParameters(FrozenClass):
6089
    '''
6090
    :ivar BrowsePaths:
6091
    :vartype BrowsePaths: BrowsePath
6092
    '''
6093 1
    def __init__(self, binary=None):
6094 1
        if binary is not None:
6095 1
            self._binary_init(binary)
6096 1
            self._freeze()
6097 1
            return
6098 1
        self.BrowsePaths = []
6099 1
        self._freeze()
6100
6101 1
    def to_binary(self):
6102 1
        packet = []
6103 1
        packet.append(uatype_Int32.pack(len(self.BrowsePaths)))
6104 1
        for fieldname in self.BrowsePaths:
6105 1
            packet.append(fieldname.to_binary())
6106 1
        return b''.join(packet)
6107
6108 1
    @staticmethod
6109
    def from_binary(data):
6110 1
        return TranslateBrowsePathsToNodeIdsParameters(data)
6111
6112 1
    def _binary_init(self, data):
6113 1
        length = uatype_Int32.unpack(data.read(4))[0]
6114 1
        array = []
6115 1
        if length != -1:
6116 1
            for _ in range(0, length):
6117 1
                array.append(BrowsePath.from_binary(data))
6118 1
        self.BrowsePaths = array
6119
6120 1
    def __str__(self):
6121
        return 'TranslateBrowsePathsToNodeIdsParameters(' + 'BrowsePaths:' + str(self.BrowsePaths) + ')'
6122
6123 1
    __repr__ = __str__
6124
6125
6126 1
class TranslateBrowsePathsToNodeIdsRequest(FrozenClass):
6127
    '''
6128
    Translates one or more paths in the server address space.
6129
6130
    :ivar TypeId:
6131
    :vartype TypeId: NodeId
6132
    :ivar RequestHeader:
6133
    :vartype RequestHeader: RequestHeader
6134
    :ivar Parameters:
6135
    :vartype Parameters: TranslateBrowsePathsToNodeIdsParameters
6136
    '''
6137 1
    def __init__(self, binary=None):
6138 1
        if binary is not None:
6139
            self._binary_init(binary)
6140
            self._freeze()
6141
            return
6142 1
        self.TypeId = FourByteNodeId(ObjectIds.TranslateBrowsePathsToNodeIdsRequest_Encoding_DefaultBinary)
6143 1
        self.RequestHeader = RequestHeader()
6144 1
        self.Parameters = TranslateBrowsePathsToNodeIdsParameters()
6145 1
        self._freeze()
6146
6147 1
    def to_binary(self):
6148 1
        packet = []
6149 1
        packet.append(self.TypeId.to_binary())
6150 1
        packet.append(self.RequestHeader.to_binary())
6151 1
        packet.append(self.Parameters.to_binary())
6152 1
        return b''.join(packet)
6153
6154 1
    @staticmethod
6155
    def from_binary(data):
6156
        return TranslateBrowsePathsToNodeIdsRequest(data)
6157
6158 1
    def _binary_init(self, data):
6159
        self.TypeId = NodeId.from_binary(data)
6160
        self.RequestHeader = RequestHeader.from_binary(data)
6161
        self.Parameters = TranslateBrowsePathsToNodeIdsParameters.from_binary(data)
6162
6163 1
    def __str__(self):
6164
        return 'TranslateBrowsePathsToNodeIdsRequest(' + 'TypeId:' + str(self.TypeId) + ', ' + \
6165
               'RequestHeader:' + str(self.RequestHeader) + ', ' + \
6166
               'Parameters:' + str(self.Parameters) + ')'
6167
6168 1
    __repr__ = __str__
6169
6170
6171 1
class TranslateBrowsePathsToNodeIdsResponse(FrozenClass):
6172
    '''
6173
    Translates one or more paths in the server address space.
6174
6175
    :ivar TypeId:
6176
    :vartype TypeId: NodeId
6177
    :ivar ResponseHeader:
6178
    :vartype ResponseHeader: ResponseHeader
6179
    :ivar Results:
6180
    :vartype Results: BrowsePathResult
6181
    :ivar DiagnosticInfos:
6182
    :vartype DiagnosticInfos: DiagnosticInfo
6183
    '''
6184 1
    def __init__(self, binary=None):
6185 1
        if binary is not None:
6186 1
            self._binary_init(binary)
6187 1
            self._freeze()
6188 1
            return
6189 1
        self.TypeId = FourByteNodeId(ObjectIds.TranslateBrowsePathsToNodeIdsResponse_Encoding_DefaultBinary)
6190 1
        self.ResponseHeader = ResponseHeader()
6191 1
        self.Results = []
6192 1
        self.DiagnosticInfos = []
6193 1
        self._freeze()
6194
6195 1
    def to_binary(self):
6196 1
        packet = []
6197 1
        packet.append(self.TypeId.to_binary())
6198 1
        packet.append(self.ResponseHeader.to_binary())
6199 1
        packet.append(uatype_Int32.pack(len(self.Results)))
6200 1
        for fieldname in self.Results:
6201 1
            packet.append(fieldname.to_binary())
6202 1
        packet.append(uatype_Int32.pack(len(self.DiagnosticInfos)))
6203 1
        for fieldname in self.DiagnosticInfos:
6204
            packet.append(fieldname.to_binary())
6205 1
        return b''.join(packet)
6206
6207 1
    @staticmethod
6208
    def from_binary(data):
6209 1
        return TranslateBrowsePathsToNodeIdsResponse(data)
6210
6211 1
    def _binary_init(self, data):
6212 1
        self.TypeId = NodeId.from_binary(data)
6213 1
        self.ResponseHeader = ResponseHeader.from_binary(data)
6214 1
        length = uatype_Int32.unpack(data.read(4))[0]
6215 1
        array = []
6216 1
        if length != -1:
6217 1
            for _ in range(0, length):
6218 1
                array.append(BrowsePathResult.from_binary(data))
6219 1
        self.Results = array
6220 1
        length = uatype_Int32.unpack(data.read(4))[0]
6221 1
        array = []
6222 1
        if length != -1:
6223 1
            for _ in range(0, length):
6224
                array.append(DiagnosticInfo.from_binary(data))
6225 1
        self.DiagnosticInfos = array
6226
6227 1
    def __str__(self):
6228
        return 'TranslateBrowsePathsToNodeIdsResponse(' + 'TypeId:' + str(self.TypeId) + ', ' + \
6229
               'ResponseHeader:' + str(self.ResponseHeader) + ', ' + \
6230
               'Results:' + str(self.Results) + ', ' + \
6231
               'DiagnosticInfos:' + str(self.DiagnosticInfos) + ')'
6232
6233 1
    __repr__ = __str__
6234
6235
6236 1
class RegisterNodesParameters(FrozenClass):
6237
    '''
6238
    :ivar NodesToRegister:
6239
    :vartype NodesToRegister: NodeId
6240
    '''
6241 1
    def __init__(self, binary=None):
6242
        if binary is not None:
6243
            self._binary_init(binary)
6244
            self._freeze()
6245
            return
6246
        self.NodesToRegister = []
6247
        self._freeze()
6248
6249 1
    def to_binary(self):
6250
        packet = []
6251
        packet.append(uatype_Int32.pack(len(self.NodesToRegister)))
6252
        for fieldname in self.NodesToRegister:
6253
            packet.append(fieldname.to_binary())
6254
        return b''.join(packet)
6255
6256 1
    @staticmethod
6257
    def from_binary(data):
6258
        return RegisterNodesParameters(data)
6259
6260 1
    def _binary_init(self, data):
6261
        length = uatype_Int32.unpack(data.read(4))[0]
6262
        array = []
6263
        if length != -1:
6264
            for _ in range(0, length):
6265
                array.append(NodeId.from_binary(data))
6266
        self.NodesToRegister = array
6267
6268 1
    def __str__(self):
6269
        return 'RegisterNodesParameters(' + 'NodesToRegister:' + str(self.NodesToRegister) + ')'
6270
6271 1
    __repr__ = __str__
6272
6273
6274 1
class RegisterNodesRequest(FrozenClass):
6275
    '''
6276
    Registers one or more nodes for repeated use within a session.
6277
6278
    :ivar TypeId:
6279
    :vartype TypeId: NodeId
6280
    :ivar RequestHeader:
6281
    :vartype RequestHeader: RequestHeader
6282
    :ivar Parameters:
6283
    :vartype Parameters: RegisterNodesParameters
6284
    '''
6285 1
    def __init__(self, binary=None):
6286
        if binary is not None:
6287
            self._binary_init(binary)
6288
            self._freeze()
6289
            return
6290
        self.TypeId = FourByteNodeId(ObjectIds.RegisterNodesRequest_Encoding_DefaultBinary)
6291
        self.RequestHeader = RequestHeader()
6292
        self.Parameters = RegisterNodesParameters()
6293
        self._freeze()
6294
6295 1
    def to_binary(self):
6296
        packet = []
6297
        packet.append(self.TypeId.to_binary())
6298
        packet.append(self.RequestHeader.to_binary())
6299
        packet.append(self.Parameters.to_binary())
6300
        return b''.join(packet)
6301
6302 1
    @staticmethod
6303
    def from_binary(data):
6304
        return RegisterNodesRequest(data)
6305
6306 1
    def _binary_init(self, data):
6307
        self.TypeId = NodeId.from_binary(data)
6308
        self.RequestHeader = RequestHeader.from_binary(data)
6309
        self.Parameters = RegisterNodesParameters.from_binary(data)
6310
6311 1
    def __str__(self):
6312
        return 'RegisterNodesRequest(' + 'TypeId:' + str(self.TypeId) + ', ' + \
6313
               'RequestHeader:' + str(self.RequestHeader) + ', ' + \
6314
               'Parameters:' + str(self.Parameters) + ')'
6315
6316 1
    __repr__ = __str__
6317
6318
6319 1
class RegisterNodesResult(FrozenClass):
6320
    '''
6321
    :ivar RegisteredNodeIds:
6322
    :vartype RegisteredNodeIds: NodeId
6323
    '''
6324 1
    def __init__(self, binary=None):
6325
        if binary is not None:
6326
            self._binary_init(binary)
6327
            self._freeze()
6328
            return
6329
        self.RegisteredNodeIds = []
6330
        self._freeze()
6331
6332 1
    def to_binary(self):
6333
        packet = []
6334
        packet.append(uatype_Int32.pack(len(self.RegisteredNodeIds)))
6335
        for fieldname in self.RegisteredNodeIds:
6336
            packet.append(fieldname.to_binary())
6337
        return b''.join(packet)
6338
6339 1
    @staticmethod
6340
    def from_binary(data):
6341
        return RegisterNodesResult(data)
6342
6343 1
    def _binary_init(self, data):
6344
        length = uatype_Int32.unpack(data.read(4))[0]
6345
        array = []
6346
        if length != -1:
6347
            for _ in range(0, length):
6348
                array.append(NodeId.from_binary(data))
6349
        self.RegisteredNodeIds = array
6350
6351 1
    def __str__(self):
6352
        return 'RegisterNodesResult(' + 'RegisteredNodeIds:' + str(self.RegisteredNodeIds) + ')'
6353
6354 1
    __repr__ = __str__
6355
6356
6357 1
class RegisterNodesResponse(FrozenClass):
6358
    '''
6359
    Registers one or more nodes for repeated use within a session.
6360
6361
    :ivar TypeId:
6362
    :vartype TypeId: NodeId
6363
    :ivar ResponseHeader:
6364
    :vartype ResponseHeader: ResponseHeader
6365
    :ivar Parameters:
6366
    :vartype Parameters: RegisterNodesResult
6367
    '''
6368 1
    def __init__(self, binary=None):
6369
        if binary is not None:
6370
            self._binary_init(binary)
6371
            self._freeze()
6372
            return
6373
        self.TypeId = FourByteNodeId(ObjectIds.RegisterNodesResponse_Encoding_DefaultBinary)
6374
        self.ResponseHeader = ResponseHeader()
6375
        self.Parameters = RegisterNodesResult()
6376
        self._freeze()
6377
6378 1
    def to_binary(self):
6379
        packet = []
6380
        packet.append(self.TypeId.to_binary())
6381
        packet.append(self.ResponseHeader.to_binary())
6382
        packet.append(self.Parameters.to_binary())
6383
        return b''.join(packet)
6384
6385 1
    @staticmethod
6386
    def from_binary(data):
6387
        return RegisterNodesResponse(data)
6388
6389 1
    def _binary_init(self, data):
6390
        self.TypeId = NodeId.from_binary(data)
6391
        self.ResponseHeader = ResponseHeader.from_binary(data)
6392
        self.Parameters = RegisterNodesResult.from_binary(data)
6393
6394 1
    def __str__(self):
6395
        return 'RegisterNodesResponse(' + 'TypeId:' + str(self.TypeId) + ', ' + \
6396
               'ResponseHeader:' + str(self.ResponseHeader) + ', ' + \
6397
               'Parameters:' + str(self.Parameters) + ')'
6398
6399 1
    __repr__ = __str__
6400
6401
6402 1
class UnregisterNodesParameters(FrozenClass):
6403
    '''
6404
    :ivar NodesToUnregister:
6405
    :vartype NodesToUnregister: NodeId
6406
    '''
6407 1
    def __init__(self, binary=None):
6408
        if binary is not None:
6409
            self._binary_init(binary)
6410
            self._freeze()
6411
            return
6412
        self.NodesToUnregister = []
6413
        self._freeze()
6414
6415 1
    def to_binary(self):
6416
        packet = []
6417
        packet.append(uatype_Int32.pack(len(self.NodesToUnregister)))
6418
        for fieldname in self.NodesToUnregister:
6419
            packet.append(fieldname.to_binary())
6420
        return b''.join(packet)
6421
6422 1
    @staticmethod
6423
    def from_binary(data):
6424
        return UnregisterNodesParameters(data)
6425
6426 1
    def _binary_init(self, data):
6427
        length = uatype_Int32.unpack(data.read(4))[0]
6428
        array = []
6429
        if length != -1:
6430
            for _ in range(0, length):
6431
                array.append(NodeId.from_binary(data))
6432
        self.NodesToUnregister = array
6433
6434 1
    def __str__(self):
6435
        return 'UnregisterNodesParameters(' + 'NodesToUnregister:' + str(self.NodesToUnregister) + ')'
6436
6437 1
    __repr__ = __str__
6438
6439
6440 1
class UnregisterNodesRequest(FrozenClass):
6441
    '''
6442
    Unregisters one or more previously registered nodes.
6443
6444
    :ivar TypeId:
6445
    :vartype TypeId: NodeId
6446
    :ivar RequestHeader:
6447
    :vartype RequestHeader: RequestHeader
6448
    :ivar Parameters:
6449
    :vartype Parameters: UnregisterNodesParameters
6450
    '''
6451 1
    def __init__(self, binary=None):
6452
        if binary is not None:
6453
            self._binary_init(binary)
6454
            self._freeze()
6455
            return
6456
        self.TypeId = FourByteNodeId(ObjectIds.UnregisterNodesRequest_Encoding_DefaultBinary)
6457
        self.RequestHeader = RequestHeader()
6458
        self.Parameters = UnregisterNodesParameters()
6459
        self._freeze()
6460
6461 1
    def to_binary(self):
6462
        packet = []
6463
        packet.append(self.TypeId.to_binary())
6464
        packet.append(self.RequestHeader.to_binary())
6465
        packet.append(self.Parameters.to_binary())
6466
        return b''.join(packet)
6467
6468 1
    @staticmethod
6469
    def from_binary(data):
6470
        return UnregisterNodesRequest(data)
6471
6472 1
    def _binary_init(self, data):
6473
        self.TypeId = NodeId.from_binary(data)
6474
        self.RequestHeader = RequestHeader.from_binary(data)
6475
        self.Parameters = UnregisterNodesParameters.from_binary(data)
6476
6477 1
    def __str__(self):
6478
        return 'UnregisterNodesRequest(' + 'TypeId:' + str(self.TypeId) + ', ' + \
6479
               'RequestHeader:' + str(self.RequestHeader) + ', ' + \
6480
               'Parameters:' + str(self.Parameters) + ')'
6481
6482 1
    __repr__ = __str__
6483
6484
6485 1
class UnregisterNodesResponse(FrozenClass):
6486
    '''
6487
    Unregisters one or more previously registered nodes.
6488
6489
    :ivar TypeId:
6490
    :vartype TypeId: NodeId
6491
    :ivar ResponseHeader:
6492
    :vartype ResponseHeader: ResponseHeader
6493
    '''
6494 1
    def __init__(self, binary=None):
6495
        if binary is not None:
6496
            self._binary_init(binary)
6497
            self._freeze()
6498
            return
6499
        self.TypeId = FourByteNodeId(ObjectIds.UnregisterNodesResponse_Encoding_DefaultBinary)
6500
        self.ResponseHeader = ResponseHeader()
6501
        self._freeze()
6502
6503 1
    def to_binary(self):
6504
        packet = []
6505
        packet.append(self.TypeId.to_binary())
6506
        packet.append(self.ResponseHeader.to_binary())
6507
        return b''.join(packet)
6508
6509 1
    @staticmethod
6510
    def from_binary(data):
6511
        return UnregisterNodesResponse(data)
6512
6513 1
    def _binary_init(self, data):
6514
        self.TypeId = NodeId.from_binary(data)
6515
        self.ResponseHeader = ResponseHeader.from_binary(data)
6516
6517 1
    def __str__(self):
6518
        return 'UnregisterNodesResponse(' + 'TypeId:' + str(self.TypeId) + ', ' + \
6519
               'ResponseHeader:' + str(self.ResponseHeader) + ')'
6520
6521 1
    __repr__ = __str__
6522
6523
6524 1
class EndpointConfiguration(FrozenClass):
6525
    '''
6526
    :ivar OperationTimeout:
6527
    :vartype OperationTimeout: Int32
6528
    :ivar UseBinaryEncoding:
6529
    :vartype UseBinaryEncoding: Boolean
6530
    :ivar MaxStringLength:
6531
    :vartype MaxStringLength: Int32
6532
    :ivar MaxByteStringLength:
6533
    :vartype MaxByteStringLength: Int32
6534
    :ivar MaxArrayLength:
6535
    :vartype MaxArrayLength: Int32
6536
    :ivar MaxMessageSize:
6537
    :vartype MaxMessageSize: Int32
6538
    :ivar MaxBufferSize:
6539
    :vartype MaxBufferSize: Int32
6540
    :ivar ChannelLifetime:
6541
    :vartype ChannelLifetime: Int32
6542
    :ivar SecurityTokenLifetime:
6543
    :vartype SecurityTokenLifetime: Int32
6544
    '''
6545 1
    def __init__(self, binary=None):
6546
        if binary is not None:
6547
            self._binary_init(binary)
6548
            self._freeze()
6549
            return
6550
        self.OperationTimeout = 0
6551
        self.UseBinaryEncoding = True
6552
        self.MaxStringLength = 0
6553
        self.MaxByteStringLength = 0
6554
        self.MaxArrayLength = 0
6555
        self.MaxMessageSize = 0
6556
        self.MaxBufferSize = 0
6557
        self.ChannelLifetime = 0
6558
        self.SecurityTokenLifetime = 0
6559
        self._freeze()
6560
6561 1
    def to_binary(self):
6562
        packet = []
6563
        packet.append(uatype_Int32.pack(self.OperationTimeout))
6564
        packet.append(uatype_Boolean.pack(self.UseBinaryEncoding))
6565
        packet.append(uatype_Int32.pack(self.MaxStringLength))
6566
        packet.append(uatype_Int32.pack(self.MaxByteStringLength))
6567
        packet.append(uatype_Int32.pack(self.MaxArrayLength))
6568
        packet.append(uatype_Int32.pack(self.MaxMessageSize))
6569
        packet.append(uatype_Int32.pack(self.MaxBufferSize))
6570
        packet.append(uatype_Int32.pack(self.ChannelLifetime))
6571
        packet.append(uatype_Int32.pack(self.SecurityTokenLifetime))
6572
        return b''.join(packet)
6573
6574 1
    @staticmethod
6575
    def from_binary(data):
6576
        return EndpointConfiguration(data)
6577
6578 1
    def _binary_init(self, data):
6579
        self.OperationTimeout = uatype_Int32.unpack(data.read(4))[0]
6580
        self.UseBinaryEncoding = uatype_Boolean.unpack(data.read(1))[0]
6581
        self.MaxStringLength = uatype_Int32.unpack(data.read(4))[0]
6582
        self.MaxByteStringLength = uatype_Int32.unpack(data.read(4))[0]
6583
        self.MaxArrayLength = uatype_Int32.unpack(data.read(4))[0]
6584
        self.MaxMessageSize = uatype_Int32.unpack(data.read(4))[0]
6585
        self.MaxBufferSize = uatype_Int32.unpack(data.read(4))[0]
6586
        self.ChannelLifetime = uatype_Int32.unpack(data.read(4))[0]
6587
        self.SecurityTokenLifetime = uatype_Int32.unpack(data.read(4))[0]
6588
6589 1
    def __str__(self):
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
6590
        return 'EndpointConfiguration(' + 'OperationTimeout:' + str(self.OperationTimeout) + ', ' + \
6591
               'UseBinaryEncoding:' + str(self.UseBinaryEncoding) + ', ' + \
6592
               'MaxStringLength:' + str(self.MaxStringLength) + ', ' + \
6593
               'MaxByteStringLength:' + str(self.MaxByteStringLength) + ', ' + \
6594
               'MaxArrayLength:' + str(self.MaxArrayLength) + ', ' + \
6595
               'MaxMessageSize:' + str(self.MaxMessageSize) + ', ' + \
6596
               'MaxBufferSize:' + str(self.MaxBufferSize) + ', ' + \
6597
               'ChannelLifetime:' + str(self.ChannelLifetime) + ', ' + \
6598
               'SecurityTokenLifetime:' + str(self.SecurityTokenLifetime) + ')'
6599
6600 1
    __repr__ = __str__
6601
6602
6603 1
class SupportedProfile(FrozenClass):
6604
    '''
6605
    :ivar OrganizationUri:
6606
    :vartype OrganizationUri: String
6607
    :ivar ProfileId:
6608
    :vartype ProfileId: String
6609
    :ivar ComplianceTool:
6610
    :vartype ComplianceTool: String
6611
    :ivar ComplianceDate:
6612
    :vartype ComplianceDate: DateTime
6613
    :ivar ComplianceLevel:
6614
    :vartype ComplianceLevel: ComplianceLevel
6615
    :ivar UnsupportedUnitIds:
6616
    :vartype UnsupportedUnitIds: String
6617
    '''
6618 1
    def __init__(self, binary=None):
6619
        if binary is not None:
6620
            self._binary_init(binary)
6621
            self._freeze()
6622
            return
6623
        self.OrganizationUri = ''
6624
        self.ProfileId = ''
6625
        self.ComplianceTool = ''
6626
        self.ComplianceDate = datetime.now()
6627
        self.ComplianceLevel = 0
6628
        self.UnsupportedUnitIds = []
6629
        self._freeze()
6630
6631 1
    def to_binary(self):
6632
        packet = []
6633
        packet.append(pack_string(self.OrganizationUri))
6634
        packet.append(pack_string(self.ProfileId))
6635
        packet.append(pack_string(self.ComplianceTool))
6636
        packet.append(pack_datetime(self.ComplianceDate))
6637
        packet.append(uatype_UInt32.pack(self.ComplianceLevel))
6638
        packet.append(uatype_Int32.pack(len(self.UnsupportedUnitIds)))
6639
        for fieldname in self.UnsupportedUnitIds:
6640
            packet.append(pack_string(fieldname))
6641
        return b''.join(packet)
6642
6643 1
    @staticmethod
6644
    def from_binary(data):
6645
        return SupportedProfile(data)
6646
6647 1
    def _binary_init(self, data):
6648
        self.OrganizationUri = unpack_string(data)
6649
        self.ProfileId = unpack_string(data)
6650
        self.ComplianceTool = unpack_string(data)
6651
        self.ComplianceDate = unpack_datetime(data)
6652
        self.ComplianceLevel = uatype_UInt32.unpack(data.read(4))[0]
6653
        self.UnsupportedUnitIds = unpack_uatype_array('String', data)
6654
6655 1
    def __str__(self):
6656
        return 'SupportedProfile(' + 'OrganizationUri:' + str(self.OrganizationUri) + ', ' + \
6657
               'ProfileId:' + str(self.ProfileId) + ', ' + \
6658
               'ComplianceTool:' + str(self.ComplianceTool) + ', ' + \
6659
               'ComplianceDate:' + str(self.ComplianceDate) + ', ' + \
6660
               'ComplianceLevel:' + str(self.ComplianceLevel) + ', ' + \
6661
               'UnsupportedUnitIds:' + str(self.UnsupportedUnitIds) + ')'
6662
6663 1
    __repr__ = __str__
6664
6665
6666 1
class SoftwareCertificate(FrozenClass):
6667
    '''
6668
    :ivar ProductName:
6669
    :vartype ProductName: String
6670
    :ivar ProductUri:
6671
    :vartype ProductUri: String
6672
    :ivar VendorName:
6673
    :vartype VendorName: String
6674
    :ivar VendorProductCertificate:
6675
    :vartype VendorProductCertificate: ByteString
6676
    :ivar SoftwareVersion:
6677
    :vartype SoftwareVersion: String
6678
    :ivar BuildNumber:
6679
    :vartype BuildNumber: String
6680
    :ivar BuildDate:
6681
    :vartype BuildDate: DateTime
6682
    :ivar IssuedBy:
6683
    :vartype IssuedBy: String
6684
    :ivar IssueDate:
6685
    :vartype IssueDate: DateTime
6686
    :ivar SupportedProfiles:
6687
    :vartype SupportedProfiles: SupportedProfile
6688
    '''
6689 1
    def __init__(self, binary=None):
6690
        if binary is not None:
6691
            self._binary_init(binary)
6692
            self._freeze()
6693
            return
6694
        self.ProductName = ''
6695
        self.ProductUri = ''
6696
        self.VendorName = ''
6697
        self.VendorProductCertificate = b''
6698
        self.SoftwareVersion = ''
6699
        self.BuildNumber = ''
6700
        self.BuildDate = datetime.now()
6701
        self.IssuedBy = ''
6702
        self.IssueDate = datetime.now()
6703
        self.SupportedProfiles = []
6704
        self._freeze()
6705
6706 1
    def to_binary(self):
6707
        packet = []
6708
        packet.append(pack_string(self.ProductName))
6709
        packet.append(pack_string(self.ProductUri))
6710
        packet.append(pack_string(self.VendorName))
6711
        packet.append(pack_bytes(self.VendorProductCertificate))
6712
        packet.append(pack_string(self.SoftwareVersion))
6713
        packet.append(pack_string(self.BuildNumber))
6714
        packet.append(pack_datetime(self.BuildDate))
6715
        packet.append(pack_string(self.IssuedBy))
6716
        packet.append(pack_datetime(self.IssueDate))
6717
        packet.append(uatype_Int32.pack(len(self.SupportedProfiles)))
6718
        for fieldname in self.SupportedProfiles:
6719
            packet.append(fieldname.to_binary())
6720
        return b''.join(packet)
6721
6722 1
    @staticmethod
6723
    def from_binary(data):
6724
        return SoftwareCertificate(data)
6725
6726 1
    def _binary_init(self, data):
6727
        self.ProductName = unpack_string(data)
6728
        self.ProductUri = unpack_string(data)
6729
        self.VendorName = unpack_string(data)
6730
        self.VendorProductCertificate = unpack_bytes(data)
6731
        self.SoftwareVersion = unpack_string(data)
6732
        self.BuildNumber = unpack_string(data)
6733
        self.BuildDate = unpack_datetime(data)
6734
        self.IssuedBy = unpack_string(data)
6735
        self.IssueDate = unpack_datetime(data)
6736
        length = uatype_Int32.unpack(data.read(4))[0]
6737
        array = []
6738
        if length != -1:
6739
            for _ in range(0, length):
6740
                array.append(SupportedProfile.from_binary(data))
6741
        self.SupportedProfiles = array
6742
6743 1
    def __str__(self):
6744
        return 'SoftwareCertificate(' + 'ProductName:' + str(self.ProductName) + ', ' + \
6745
               'ProductUri:' + str(self.ProductUri) + ', ' + \
6746
               'VendorName:' + str(self.VendorName) + ', ' + \
6747
               'VendorProductCertificate:' + str(self.VendorProductCertificate) + ', ' + \
6748
               'SoftwareVersion:' + str(self.SoftwareVersion) + ', ' + \
6749
               'BuildNumber:' + str(self.BuildNumber) + ', ' + \
6750
               'BuildDate:' + str(self.BuildDate) + ', ' + \
6751
               'IssuedBy:' + str(self.IssuedBy) + ', ' + \
6752
               'IssueDate:' + str(self.IssueDate) + ', ' + \
6753
               'SupportedProfiles:' + str(self.SupportedProfiles) + ')'
6754
6755 1
    __repr__ = __str__
6756
6757
6758 1
class QueryDataDescription(FrozenClass):
6759
    '''
6760
    :ivar RelativePath:
6761
    :vartype RelativePath: RelativePath
6762
    :ivar AttributeId:
6763
    :vartype AttributeId: UInt32
6764
    :ivar IndexRange:
6765
    :vartype IndexRange: String
6766
    '''
6767 1
    def __init__(self, binary=None):
6768
        if binary is not None:
6769
            self._binary_init(binary)
6770
            self._freeze()
6771
            return
6772
        self.RelativePath = RelativePath()
6773
        self.AttributeId = 0
6774
        self.IndexRange = ''
6775
        self._freeze()
6776
6777 1
    def to_binary(self):
6778
        packet = []
6779
        packet.append(self.RelativePath.to_binary())
6780
        packet.append(uatype_UInt32.pack(self.AttributeId))
6781
        packet.append(pack_string(self.IndexRange))
6782
        return b''.join(packet)
6783
6784 1
    @staticmethod
6785
    def from_binary(data):
6786
        return QueryDataDescription(data)
6787
6788 1
    def _binary_init(self, data):
6789
        self.RelativePath = RelativePath.from_binary(data)
6790
        self.AttributeId = uatype_UInt32.unpack(data.read(4))[0]
6791
        self.IndexRange = unpack_string(data)
6792
6793 1
    def __str__(self):
6794
        return 'QueryDataDescription(' + 'RelativePath:' + str(self.RelativePath) + ', ' + \
6795
               'AttributeId:' + str(self.AttributeId) + ', ' + \
6796
               'IndexRange:' + str(self.IndexRange) + ')'
6797
6798 1
    __repr__ = __str__
6799
6800
6801 1
class NodeTypeDescription(FrozenClass):
6802
    '''
6803
    :ivar TypeDefinitionNode:
6804
    :vartype TypeDefinitionNode: ExpandedNodeId
6805
    :ivar IncludeSubTypes:
6806
    :vartype IncludeSubTypes: Boolean
6807
    :ivar DataToReturn:
6808
    :vartype DataToReturn: QueryDataDescription
6809
    '''
6810 1
    def __init__(self, binary=None):
6811
        if binary is not None:
6812
            self._binary_init(binary)
6813
            self._freeze()
6814
            return
6815
        self.TypeDefinitionNode = ExpandedNodeId()
6816
        self.IncludeSubTypes = True
6817
        self.DataToReturn = []
6818
        self._freeze()
6819
6820 1
    def to_binary(self):
6821
        packet = []
6822
        packet.append(self.TypeDefinitionNode.to_binary())
6823
        packet.append(uatype_Boolean.pack(self.IncludeSubTypes))
6824
        packet.append(uatype_Int32.pack(len(self.DataToReturn)))
6825
        for fieldname in self.DataToReturn:
6826
            packet.append(fieldname.to_binary())
6827
        return b''.join(packet)
6828
6829 1
    @staticmethod
6830
    def from_binary(data):
6831
        return NodeTypeDescription(data)
6832
6833 1
    def _binary_init(self, data):
6834
        self.TypeDefinitionNode = ExpandedNodeId.from_binary(data)
6835
        self.IncludeSubTypes = uatype_Boolean.unpack(data.read(1))[0]
6836
        length = uatype_Int32.unpack(data.read(4))[0]
6837
        array = []
6838
        if length != -1:
6839
            for _ in range(0, length):
6840
                array.append(QueryDataDescription.from_binary(data))
6841
        self.DataToReturn = array
6842
6843 1
    def __str__(self):
6844
        return 'NodeTypeDescription(' + 'TypeDefinitionNode:' + str(self.TypeDefinitionNode) + ', ' + \
6845
               'IncludeSubTypes:' + str(self.IncludeSubTypes) + ', ' + \
6846
               'DataToReturn:' + str(self.DataToReturn) + ')'
6847
6848 1
    __repr__ = __str__
6849
6850
6851 1
class QueryDataSet(FrozenClass):
6852
    '''
6853
    :ivar NodeId:
6854
    :vartype NodeId: ExpandedNodeId
6855
    :ivar TypeDefinitionNode:
6856
    :vartype TypeDefinitionNode: ExpandedNodeId
6857
    :ivar Values:
6858
    :vartype Values: Variant
6859
    '''
6860 1
    def __init__(self, binary=None):
6861
        if binary is not None:
6862
            self._binary_init(binary)
6863
            self._freeze()
6864
            return
6865
        self.NodeId = ExpandedNodeId()
6866
        self.TypeDefinitionNode = ExpandedNodeId()
6867
        self.Values = []
6868
        self._freeze()
6869
6870 1
    def to_binary(self):
6871
        packet = []
6872
        packet.append(self.NodeId.to_binary())
6873
        packet.append(self.TypeDefinitionNode.to_binary())
6874
        packet.append(uatype_Int32.pack(len(self.Values)))
6875
        for fieldname in self.Values:
6876
            packet.append(fieldname.to_binary())
6877
        return b''.join(packet)
6878
6879 1
    @staticmethod
6880
    def from_binary(data):
6881
        return QueryDataSet(data)
6882
6883 1
    def _binary_init(self, data):
6884
        self.NodeId = ExpandedNodeId.from_binary(data)
6885
        self.TypeDefinitionNode = ExpandedNodeId.from_binary(data)
6886
        length = uatype_Int32.unpack(data.read(4))[0]
6887
        array = []
6888
        if length != -1:
6889
            for _ in range(0, length):
6890
                array.append(Variant.from_binary(data))
6891
        self.Values = array
6892
6893 1
    def __str__(self):
6894
        return 'QueryDataSet(' + 'NodeId:' + str(self.NodeId) + ', ' + \
6895
               'TypeDefinitionNode:' + str(self.TypeDefinitionNode) + ', ' + \
6896
               'Values:' + str(self.Values) + ')'
6897
6898 1
    __repr__ = __str__
6899
6900
6901 1
class NodeReference(FrozenClass):
6902
    '''
6903
    :ivar NodeId:
6904
    :vartype NodeId: NodeId
6905
    :ivar ReferenceTypeId:
6906
    :vartype ReferenceTypeId: NodeId
6907
    :ivar IsForward:
6908
    :vartype IsForward: Boolean
6909
    :ivar ReferencedNodeIds:
6910
    :vartype ReferencedNodeIds: NodeId
6911
    '''
6912 1
    def __init__(self, binary=None):
6913
        if binary is not None:
6914
            self._binary_init(binary)
6915
            self._freeze()
6916
            return
6917
        self.NodeId = NodeId()
6918
        self.ReferenceTypeId = NodeId()
6919
        self.IsForward = True
6920
        self.ReferencedNodeIds = []
6921
        self._freeze()
6922
6923 1
    def to_binary(self):
6924
        packet = []
6925
        packet.append(self.NodeId.to_binary())
6926
        packet.append(self.ReferenceTypeId.to_binary())
6927
        packet.append(uatype_Boolean.pack(self.IsForward))
6928
        packet.append(uatype_Int32.pack(len(self.ReferencedNodeIds)))
6929
        for fieldname in self.ReferencedNodeIds:
6930
            packet.append(fieldname.to_binary())
6931
        return b''.join(packet)
6932
6933 1
    @staticmethod
6934
    def from_binary(data):
6935
        return NodeReference(data)
6936
6937 1
    def _binary_init(self, data):
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
6938
        self.NodeId = NodeId.from_binary(data)
6939
        self.ReferenceTypeId = NodeId.from_binary(data)
6940
        self.IsForward = uatype_Boolean.unpack(data.read(1))[0]
6941
        length = uatype_Int32.unpack(data.read(4))[0]
6942
        array = []
6943
        if length != -1:
6944
            for _ in range(0, length):
6945
                array.append(NodeId.from_binary(data))
6946
        self.ReferencedNodeIds = array
6947
6948 1
    def __str__(self):
6949
        return 'NodeReference(' + 'NodeId:' + str(self.NodeId) + ', ' + \
6950
               'ReferenceTypeId:' + str(self.ReferenceTypeId) + ', ' + \
6951
               'IsForward:' + str(self.IsForward) + ', ' + \
6952
               'ReferencedNodeIds:' + str(self.ReferencedNodeIds) + ')'
6953
6954 1
    __repr__ = __str__
6955
6956
6957 1
class ContentFilterElement(FrozenClass):
6958
    '''
6959
    :ivar FilterOperator:
6960
    :vartype FilterOperator: FilterOperator
6961
    :ivar FilterOperands:
6962
    :vartype FilterOperands: ExtensionObject
6963
    '''
6964 1
    def __init__(self, binary=None):
6965
        if binary is not None:
6966
            self._binary_init(binary)
6967
            self._freeze()
6968
            return
6969
        self.FilterOperator = 0
6970
        self.FilterOperands = []
6971
        self._freeze()
6972
6973 1
    def to_binary(self):
6974
        packet = []
6975
        packet.append(uatype_UInt32.pack(self.FilterOperator))
6976
        packet.append(uatype_Int32.pack(len(self.FilterOperands)))
6977
        for fieldname in self.FilterOperands:
6978
            packet.append(extensionobject_to_binary(fieldname))
6979
        return b''.join(packet)
6980
6981 1
    @staticmethod
6982
    def from_binary(data):
6983
        return ContentFilterElement(data)
6984
6985 1
    def _binary_init(self, data):
6986
        self.FilterOperator = uatype_UInt32.unpack(data.read(4))[0]
6987
        length = uatype_Int32.unpack(data.read(4))[0]
6988
        array = []
6989
        if length != -1:
6990
            for _ in range(0, length):
6991
                array.append(extensionobject_from_binary(data))
6992
        self.FilterOperands = array
6993
6994 1
    def __str__(self):
6995
        return 'ContentFilterElement(' + 'FilterOperator:' + str(self.FilterOperator) + ', ' + \
6996
               'FilterOperands:' + str(self.FilterOperands) + ')'
6997
6998 1
    __repr__ = __str__
6999
7000
7001 1
class ContentFilter(FrozenClass):
7002
    '''
7003
    :ivar Elements:
7004
    :vartype Elements: ContentFilterElement
7005
    '''
7006 1
    def __init__(self, binary=None):
7007 1
        if binary is not None:
7008 1
            self._binary_init(binary)
7009 1
            self._freeze()
7010 1
            return
7011 1
        self.Elements = []
7012 1
        self._freeze()
7013
7014 1
    def to_binary(self):
7015 1
        packet = []
7016 1
        packet.append(uatype_Int32.pack(len(self.Elements)))
7017 1
        for fieldname in self.Elements:
7018
            packet.append(fieldname.to_binary())
7019 1
        return b''.join(packet)
7020
7021 1
    @staticmethod
7022
    def from_binary(data):
7023 1
        return ContentFilter(data)
7024
7025 1
    def _binary_init(self, data):
7026 1
        length = uatype_Int32.unpack(data.read(4))[0]
7027 1
        array = []
7028 1
        if length != -1:
7029 1
            for _ in range(0, length):
7030
                array.append(ContentFilterElement.from_binary(data))
7031 1
        self.Elements = array
7032
7033 1
    def __str__(self):
7034
        return 'ContentFilter(' + 'Elements:' + str(self.Elements) + ')'
7035
7036 1
    __repr__ = __str__
7037
7038
7039 1
class ElementOperand(FrozenClass):
7040
    '''
7041
    :ivar Index:
7042
    :vartype Index: UInt32
7043
    '''
7044 1
    def __init__(self, binary=None):
7045
        if binary is not None:
7046
            self._binary_init(binary)
7047
            self._freeze()
7048
            return
7049
        self.Index = 0
7050
        self._freeze()
7051
7052 1
    def to_binary(self):
7053
        packet = []
7054
        packet.append(uatype_UInt32.pack(self.Index))
7055
        return b''.join(packet)
7056
7057 1
    @staticmethod
7058
    def from_binary(data):
7059
        return ElementOperand(data)
7060
7061 1
    def _binary_init(self, data):
7062
        self.Index = uatype_UInt32.unpack(data.read(4))[0]
7063
7064 1
    def __str__(self):
7065
        return 'ElementOperand(' + 'Index:' + str(self.Index) + ')'
7066
7067 1
    __repr__ = __str__
7068
7069
7070 1
class LiteralOperand(FrozenClass):
7071
    '''
7072
    :ivar Value:
7073
    :vartype Value: Variant
7074
    '''
7075 1
    def __init__(self, binary=None):
7076
        if binary is not None:
7077
            self._binary_init(binary)
7078
            self._freeze()
7079
            return
7080
        self.Value = Variant()
7081
        self._freeze()
7082
7083 1
    def to_binary(self):
7084
        packet = []
7085
        packet.append(self.Value.to_binary())
7086
        return b''.join(packet)
7087
7088 1
    @staticmethod
7089
    def from_binary(data):
7090
        return LiteralOperand(data)
7091
7092 1
    def _binary_init(self, data):
7093
        self.Value = Variant.from_binary(data)
7094
7095 1
    def __str__(self):
7096
        return 'LiteralOperand(' + 'Value:' + str(self.Value) + ')'
7097
7098 1
    __repr__ = __str__
7099
7100
7101 1
class AttributeOperand(FrozenClass):
7102
    '''
7103
    :ivar NodeId:
7104
    :vartype NodeId: NodeId
7105
    :ivar Alias:
7106
    :vartype Alias: String
7107
    :ivar BrowsePath:
7108
    :vartype BrowsePath: RelativePath
7109
    :ivar AttributeId:
7110
    :vartype AttributeId: UInt32
7111
    :ivar IndexRange:
7112
    :vartype IndexRange: String
7113
    '''
7114 1
    def __init__(self, binary=None):
7115
        if binary is not None:
7116
            self._binary_init(binary)
7117
            self._freeze()
7118
            return
7119
        self.NodeId = NodeId()
7120
        self.Alias = ''
7121
        self.BrowsePath = RelativePath()
7122
        self.AttributeId = 0
7123
        self.IndexRange = ''
7124
        self._freeze()
7125
7126 1
    def to_binary(self):
7127
        packet = []
7128
        packet.append(self.NodeId.to_binary())
7129
        packet.append(pack_string(self.Alias))
7130
        packet.append(self.BrowsePath.to_binary())
7131
        packet.append(uatype_UInt32.pack(self.AttributeId))
7132
        packet.append(pack_string(self.IndexRange))
7133
        return b''.join(packet)
7134
7135 1
    @staticmethod
7136
    def from_binary(data):
7137
        return AttributeOperand(data)
7138
7139 1
    def _binary_init(self, data):
7140
        self.NodeId = NodeId.from_binary(data)
7141
        self.Alias = unpack_string(data)
7142
        self.BrowsePath = RelativePath.from_binary(data)
7143
        self.AttributeId = uatype_UInt32.unpack(data.read(4))[0]
7144
        self.IndexRange = unpack_string(data)
7145
7146 1
    def __str__(self):
7147
        return 'AttributeOperand(' + 'NodeId:' + str(self.NodeId) + ', ' + \
7148
               'Alias:' + str(self.Alias) + ', ' + \
7149
               'BrowsePath:' + str(self.BrowsePath) + ', ' + \
7150
               'AttributeId:' + str(self.AttributeId) + ', ' + \
7151
               'IndexRange:' + str(self.IndexRange) + ')'
7152
7153 1
    __repr__ = __str__
7154
7155
7156 1
class SimpleAttributeOperand(FrozenClass):
7157
    '''
7158
    :ivar TypeDefinitionId:
7159
    :vartype TypeDefinitionId: NodeId
7160
    :ivar BrowsePath:
7161
    :vartype BrowsePath: QualifiedName
7162
    :ivar AttributeId:
7163
    :vartype AttributeId: UInt32
7164
    :ivar IndexRange:
7165
    :vartype IndexRange: String
7166
    '''
7167 1
    def __init__(self, binary=None):
7168 1
        if binary is not None:
7169 1
            self._binary_init(binary)
7170 1
            self._freeze()
7171 1
            return
7172 1
        self.TypeDefinitionId = NodeId()
7173 1
        self.BrowsePath = []
7174 1
        self.AttributeId = 0
7175 1
        self.IndexRange = ''
7176 1
        self._freeze()
7177
7178 1
    def to_binary(self):
7179 1
        packet = []
7180 1
        packet.append(self.TypeDefinitionId.to_binary())
7181 1
        packet.append(uatype_Int32.pack(len(self.BrowsePath)))
7182 1
        for fieldname in self.BrowsePath:
7183 1
            packet.append(fieldname.to_binary())
7184 1
        packet.append(uatype_UInt32.pack(self.AttributeId))
7185 1
        packet.append(pack_string(self.IndexRange))
7186 1
        return b''.join(packet)
7187
7188 1
    @staticmethod
7189
    def from_binary(data):
7190 1
        return SimpleAttributeOperand(data)
7191
7192 1
    def _binary_init(self, data):
7193 1
        self.TypeDefinitionId = NodeId.from_binary(data)
7194 1
        length = uatype_Int32.unpack(data.read(4))[0]
7195 1
        array = []
7196 1
        if length != -1:
7197 1
            for _ in range(0, length):
7198 1
                array.append(QualifiedName.from_binary(data))
7199 1
        self.BrowsePath = array
7200 1
        self.AttributeId = uatype_UInt32.unpack(data.read(4))[0]
7201 1
        self.IndexRange = unpack_string(data)
7202
7203 1
    def __str__(self):
7204
        return 'SimpleAttributeOperand(' + 'TypeDefinitionId:' + str(self.TypeDefinitionId) + ', ' + \
7205
               'BrowsePath:' + str(self.BrowsePath) + ', ' + \
7206
               'AttributeId:' + str(self.AttributeId) + ', ' + \
7207
               'IndexRange:' + str(self.IndexRange) + ')'
7208
7209 1
    __repr__ = __str__
7210
7211
7212 1
class ContentFilterElementResult(FrozenClass):
7213
    '''
7214
    :ivar StatusCode:
7215
    :vartype StatusCode: StatusCode
7216
    :ivar OperandStatusCodes:
7217
    :vartype OperandStatusCodes: StatusCode
7218
    :ivar OperandDiagnosticInfos:
7219
    :vartype OperandDiagnosticInfos: DiagnosticInfo
7220
    '''
7221 1
    def __init__(self, binary=None):
7222
        if binary is not None:
7223
            self._binary_init(binary)
7224
            self._freeze()
7225
            return
7226
        self.StatusCode = StatusCode()
7227
        self.OperandStatusCodes = []
7228
        self.OperandDiagnosticInfos = []
7229
        self._freeze()
7230
7231 1
    def to_binary(self):
7232
        packet = []
7233
        packet.append(self.StatusCode.to_binary())
7234
        packet.append(uatype_Int32.pack(len(self.OperandStatusCodes)))
7235
        for fieldname in self.OperandStatusCodes:
7236
            packet.append(fieldname.to_binary())
7237
        packet.append(uatype_Int32.pack(len(self.OperandDiagnosticInfos)))
7238
        for fieldname in self.OperandDiagnosticInfos:
7239
            packet.append(fieldname.to_binary())
7240
        return b''.join(packet)
7241
7242 1
    @staticmethod
7243
    def from_binary(data):
7244
        return ContentFilterElementResult(data)
7245
7246 1
    def _binary_init(self, data):
7247
        self.StatusCode = StatusCode.from_binary(data)
7248
        length = uatype_Int32.unpack(data.read(4))[0]
7249
        array = []
7250
        if length != -1:
7251
            for _ in range(0, length):
7252
                array.append(StatusCode.from_binary(data))
7253
        self.OperandStatusCodes = array
7254
        length = uatype_Int32.unpack(data.read(4))[0]
7255
        array = []
7256
        if length != -1:
7257
            for _ in range(0, length):
7258
                array.append(DiagnosticInfo.from_binary(data))
7259
        self.OperandDiagnosticInfos = array
7260
7261 1
    def __str__(self):
7262
        return 'ContentFilterElementResult(' + 'StatusCode:' + str(self.StatusCode) + ', ' + \
7263
               'OperandStatusCodes:' + str(self.OperandStatusCodes) + ', ' + \
7264
               'OperandDiagnosticInfos:' + str(self.OperandDiagnosticInfos) + ')'
7265
7266 1
    __repr__ = __str__
7267
7268
7269 1
class ContentFilterResult(FrozenClass):
7270
    '''
7271
    :ivar ElementResults:
7272
    :vartype ElementResults: ContentFilterElementResult
7273
    :ivar ElementDiagnosticInfos:
7274
    :vartype ElementDiagnosticInfos: DiagnosticInfo
7275
    '''
7276 1
    def __init__(self, binary=None):
7277
        if binary is not None:
7278
            self._binary_init(binary)
7279
            self._freeze()
7280
            return
7281
        self.ElementResults = []
7282
        self.ElementDiagnosticInfos = []
7283
        self._freeze()
7284
7285 1
    def to_binary(self):
7286
        packet = []
7287
        packet.append(uatype_Int32.pack(len(self.ElementResults)))
7288
        for fieldname in self.ElementResults:
7289
            packet.append(fieldname.to_binary())
7290
        packet.append(uatype_Int32.pack(len(self.ElementDiagnosticInfos)))
7291
        for fieldname in self.ElementDiagnosticInfos:
7292
            packet.append(fieldname.to_binary())
7293
        return b''.join(packet)
7294
7295 1
    @staticmethod
7296
    def from_binary(data):
7297
        return ContentFilterResult(data)
7298
7299 1
    def _binary_init(self, data):
7300
        length = uatype_Int32.unpack(data.read(4))[0]
7301
        array = []
7302
        if length != -1:
7303
            for _ in range(0, length):
7304
                array.append(ContentFilterElementResult.from_binary(data))
7305
        self.ElementResults = array
7306
        length = uatype_Int32.unpack(data.read(4))[0]
7307
        array = []
7308
        if length != -1:
7309
            for _ in range(0, length):
7310
                array.append(DiagnosticInfo.from_binary(data))
7311
        self.ElementDiagnosticInfos = array
7312
7313 1
    def __str__(self):
7314
        return 'ContentFilterResult(' + 'ElementResults:' + str(self.ElementResults) + ', ' + \
7315
               'ElementDiagnosticInfos:' + str(self.ElementDiagnosticInfos) + ')'
7316
7317 1
    __repr__ = __str__
7318
7319
7320 1
class ParsingResult(FrozenClass):
7321
    '''
7322
    :ivar StatusCode:
7323
    :vartype StatusCode: StatusCode
7324
    :ivar DataStatusCodes:
7325
    :vartype DataStatusCodes: StatusCode
7326
    :ivar DataDiagnosticInfos:
7327
    :vartype DataDiagnosticInfos: DiagnosticInfo
7328
    '''
7329 1
    def __init__(self, binary=None):
7330
        if binary is not None:
7331
            self._binary_init(binary)
7332
            self._freeze()
7333
            return
7334
        self.StatusCode = StatusCode()
7335
        self.DataStatusCodes = []
7336
        self.DataDiagnosticInfos = []
7337
        self._freeze()
7338
7339 1
    def to_binary(self):
7340
        packet = []
7341
        packet.append(self.StatusCode.to_binary())
7342
        packet.append(uatype_Int32.pack(len(self.DataStatusCodes)))
7343
        for fieldname in self.DataStatusCodes:
7344
            packet.append(fieldname.to_binary())
7345
        packet.append(uatype_Int32.pack(len(self.DataDiagnosticInfos)))
7346
        for fieldname in self.DataDiagnosticInfos:
7347
            packet.append(fieldname.to_binary())
7348
        return b''.join(packet)
7349
7350 1
    @staticmethod
7351
    def from_binary(data):
7352
        return ParsingResult(data)
7353
7354 1
    def _binary_init(self, data):
7355
        self.StatusCode = StatusCode.from_binary(data)
7356
        length = uatype_Int32.unpack(data.read(4))[0]
7357
        array = []
7358
        if length != -1:
7359
            for _ in range(0, length):
7360
                array.append(StatusCode.from_binary(data))
7361
        self.DataStatusCodes = array
7362
        length = uatype_Int32.unpack(data.read(4))[0]
7363
        array = []
7364
        if length != -1:
7365
            for _ in range(0, length):
7366
                array.append(DiagnosticInfo.from_binary(data))
7367
        self.DataDiagnosticInfos = array
7368
7369 1
    def __str__(self):
7370
        return 'ParsingResult(' + 'StatusCode:' + str(self.StatusCode) + ', ' + \
7371
               'DataStatusCodes:' + str(self.DataStatusCodes) + ', ' + \
7372
               'DataDiagnosticInfos:' + str(self.DataDiagnosticInfos) + ')'
7373
7374 1
    __repr__ = __str__
7375
7376
7377 1
class QueryFirstParameters(FrozenClass):
7378
    '''
7379
    :ivar View:
7380
    :vartype View: ViewDescription
7381
    :ivar NodeTypes:
7382
    :vartype NodeTypes: NodeTypeDescription
7383
    :ivar Filter:
7384
    :vartype Filter: ContentFilter
7385
    :ivar MaxDataSetsToReturn:
7386
    :vartype MaxDataSetsToReturn: UInt32
7387
    :ivar MaxReferencesToReturn:
7388
    :vartype MaxReferencesToReturn: UInt32
7389
    '''
7390 1
    def __init__(self, binary=None):
7391
        if binary is not None:
7392
            self._binary_init(binary)
7393
            self._freeze()
7394
            return
7395
        self.View = ViewDescription()
7396
        self.NodeTypes = []
7397
        self.Filter = ContentFilter()
7398
        self.MaxDataSetsToReturn = 0
7399
        self.MaxReferencesToReturn = 0
7400
        self._freeze()
7401
7402 1
    def to_binary(self):
7403
        packet = []
7404
        packet.append(self.View.to_binary())
7405
        packet.append(uatype_Int32.pack(len(self.NodeTypes)))
7406
        for fieldname in self.NodeTypes:
7407
            packet.append(fieldname.to_binary())
7408
        packet.append(self.Filter.to_binary())
7409
        packet.append(uatype_UInt32.pack(self.MaxDataSetsToReturn))
7410
        packet.append(uatype_UInt32.pack(self.MaxReferencesToReturn))
7411
        return b''.join(packet)
7412
7413 1
    @staticmethod
7414
    def from_binary(data):
7415
        return QueryFirstParameters(data)
7416
7417 1
    def _binary_init(self, data):
7418
        self.View = ViewDescription.from_binary(data)
7419
        length = uatype_Int32.unpack(data.read(4))[0]
7420
        array = []
7421
        if length != -1:
7422
            for _ in range(0, length):
7423
                array.append(NodeTypeDescription.from_binary(data))
7424
        self.NodeTypes = array
7425
        self.Filter = ContentFilter.from_binary(data)
7426
        self.MaxDataSetsToReturn = uatype_UInt32.unpack(data.read(4))[0]
7427
        self.MaxReferencesToReturn = uatype_UInt32.unpack(data.read(4))[0]
7428
7429 1
    def __str__(self):
7430
        return 'QueryFirstParameters(' + 'View:' + str(self.View) + ', ' + \
7431
               'NodeTypes:' + str(self.NodeTypes) + ', ' + \
7432
               'Filter:' + str(self.Filter) + ', ' + \
7433
               'MaxDataSetsToReturn:' + str(self.MaxDataSetsToReturn) + ', ' + \
7434
               'MaxReferencesToReturn:' + str(self.MaxReferencesToReturn) + ')'
7435
7436 1
    __repr__ = __str__
7437
7438
7439 1
class QueryFirstRequest(FrozenClass):
7440
    '''
7441
    :ivar TypeId:
7442
    :vartype TypeId: NodeId
7443
    :ivar RequestHeader:
7444
    :vartype RequestHeader: RequestHeader
7445
    :ivar Parameters:
7446
    :vartype Parameters: QueryFirstParameters
7447
    '''
7448 1
    def __init__(self, binary=None):
7449
        if binary is not None:
7450
            self._binary_init(binary)
7451
            self._freeze()
7452
            return
7453
        self.TypeId = FourByteNodeId(ObjectIds.QueryFirstRequest_Encoding_DefaultBinary)
7454
        self.RequestHeader = RequestHeader()
7455
        self.Parameters = QueryFirstParameters()
7456
        self._freeze()
7457
7458 1
    def to_binary(self):
7459
        packet = []
7460
        packet.append(self.TypeId.to_binary())
7461
        packet.append(self.RequestHeader.to_binary())
7462
        packet.append(self.Parameters.to_binary())
7463
        return b''.join(packet)
7464
7465 1
    @staticmethod
7466
    def from_binary(data):
7467
        return QueryFirstRequest(data)
7468
7469 1
    def _binary_init(self, data):
7470
        self.TypeId = NodeId.from_binary(data)
7471
        self.RequestHeader = RequestHeader.from_binary(data)
7472
        self.Parameters = QueryFirstParameters.from_binary(data)
7473
7474 1
    def __str__(self):
7475
        return 'QueryFirstRequest(' + 'TypeId:' + str(self.TypeId) + ', ' + \
7476
               'RequestHeader:' + str(self.RequestHeader) + ', ' + \
7477
               'Parameters:' + str(self.Parameters) + ')'
7478
7479 1
    __repr__ = __str__
7480
7481
7482 1
class QueryFirstResult(FrozenClass):
7483
    '''
7484
    :ivar QueryDataSets:
7485
    :vartype QueryDataSets: QueryDataSet
7486
    :ivar ContinuationPoint:
7487
    :vartype ContinuationPoint: ByteString
7488
    :ivar ParsingResults:
7489
    :vartype ParsingResults: ParsingResult
7490
    :ivar DiagnosticInfos:
7491
    :vartype DiagnosticInfos: DiagnosticInfo
7492
    :ivar FilterResult:
7493
    :vartype FilterResult: ContentFilterResult
7494
    '''
7495 1
    def __init__(self, binary=None):
7496
        if binary is not None:
7497
            self._binary_init(binary)
7498
            self._freeze()
7499
            return
7500
        self.QueryDataSets = []
7501
        self.ContinuationPoint = b''
7502
        self.ParsingResults = []
7503
        self.DiagnosticInfos = []
7504
        self.FilterResult = ContentFilterResult()
7505
        self._freeze()
7506
7507 1
    def to_binary(self):
7508
        packet = []
7509
        packet.append(uatype_Int32.pack(len(self.QueryDataSets)))
7510
        for fieldname in self.QueryDataSets:
7511
            packet.append(fieldname.to_binary())
7512
        packet.append(pack_bytes(self.ContinuationPoint))
7513
        packet.append(uatype_Int32.pack(len(self.ParsingResults)))
7514
        for fieldname in self.ParsingResults:
7515
            packet.append(fieldname.to_binary())
7516
        packet.append(uatype_Int32.pack(len(self.DiagnosticInfos)))
7517
        for fieldname in self.DiagnosticInfos:
7518
            packet.append(fieldname.to_binary())
7519
        packet.append(self.FilterResult.to_binary())
7520
        return b''.join(packet)
7521
7522 1
    @staticmethod
7523
    def from_binary(data):
7524
        return QueryFirstResult(data)
7525
7526 1
    def _binary_init(self, data):
7527
        length = uatype_Int32.unpack(data.read(4))[0]
7528
        array = []
7529
        if length != -1:
7530
            for _ in range(0, length):
7531
                array.append(QueryDataSet.from_binary(data))
7532
        self.QueryDataSets = array
7533
        self.ContinuationPoint = unpack_bytes(data)
7534
        length = uatype_Int32.unpack(data.read(4))[0]
7535
        array = []
7536
        if length != -1:
7537
            for _ in range(0, length):
7538
                array.append(ParsingResult.from_binary(data))
7539
        self.ParsingResults = array
7540
        length = uatype_Int32.unpack(data.read(4))[0]
7541
        array = []
7542
        if length != -1:
7543
            for _ in range(0, length):
7544
                array.append(DiagnosticInfo.from_binary(data))
7545
        self.DiagnosticInfos = array
7546
        self.FilterResult = ContentFilterResult.from_binary(data)
7547
7548 1
    def __str__(self):
7549
        return 'QueryFirstResult(' + 'QueryDataSets:' + str(self.QueryDataSets) + ', ' + \
7550
               'ContinuationPoint:' + str(self.ContinuationPoint) + ', ' + \
7551
               'ParsingResults:' + str(self.ParsingResults) + ', ' + \
7552
               'DiagnosticInfos:' + str(self.DiagnosticInfos) + ', ' + \
7553
               'FilterResult:' + str(self.FilterResult) + ')'
7554
7555 1
    __repr__ = __str__
7556
7557
7558 1
class QueryFirstResponse(FrozenClass):
7559
    '''
7560
    :ivar TypeId:
7561
    :vartype TypeId: NodeId
7562
    :ivar ResponseHeader:
7563
    :vartype ResponseHeader: ResponseHeader
7564
    :ivar Parameters:
7565
    :vartype Parameters: QueryFirstResult
7566
    '''
7567 1
    def __init__(self, binary=None):
7568
        if binary is not None:
7569
            self._binary_init(binary)
7570
            self._freeze()
7571
            return
7572
        self.TypeId = FourByteNodeId(ObjectIds.QueryFirstResponse_Encoding_DefaultBinary)
7573
        self.ResponseHeader = ResponseHeader()
7574
        self.Parameters = QueryFirstResult()
7575
        self._freeze()
7576
7577 1
    def to_binary(self):
7578
        packet = []
7579
        packet.append(self.TypeId.to_binary())
7580
        packet.append(self.ResponseHeader.to_binary())
7581
        packet.append(self.Parameters.to_binary())
7582
        return b''.join(packet)
7583
7584 1
    @staticmethod
7585
    def from_binary(data):
7586
        return QueryFirstResponse(data)
7587
7588 1
    def _binary_init(self, data):
7589
        self.TypeId = NodeId.from_binary(data)
7590
        self.ResponseHeader = ResponseHeader.from_binary(data)
7591
        self.Parameters = QueryFirstResult.from_binary(data)
7592
7593 1
    def __str__(self):
7594
        return 'QueryFirstResponse(' + 'TypeId:' + str(self.TypeId) + ', ' + \
7595
               'ResponseHeader:' + str(self.ResponseHeader) + ', ' + \
7596
               'Parameters:' + str(self.Parameters) + ')'
7597
7598 1
    __repr__ = __str__
7599
7600
7601 1
class QueryNextParameters(FrozenClass):
7602
    '''
7603
    :ivar ReleaseContinuationPoint:
7604
    :vartype ReleaseContinuationPoint: Boolean
7605
    :ivar ContinuationPoint:
7606
    :vartype ContinuationPoint: ByteString
7607
    '''
7608 1
    def __init__(self, binary=None):
7609
        if binary is not None:
7610
            self._binary_init(binary)
7611
            self._freeze()
7612
            return
7613
        self.ReleaseContinuationPoint = True
7614
        self.ContinuationPoint = b''
7615
        self._freeze()
7616
7617 1
    def to_binary(self):
7618
        packet = []
7619
        packet.append(uatype_Boolean.pack(self.ReleaseContinuationPoint))
7620
        packet.append(pack_bytes(self.ContinuationPoint))
7621
        return b''.join(packet)
7622
7623 1
    @staticmethod
7624
    def from_binary(data):
7625
        return QueryNextParameters(data)
7626
7627 1
    def _binary_init(self, data):
7628
        self.ReleaseContinuationPoint = uatype_Boolean.unpack(data.read(1))[0]
7629
        self.ContinuationPoint = unpack_bytes(data)
7630
7631 1
    def __str__(self):
7632
        return 'QueryNextParameters(' + 'ReleaseContinuationPoint:' + str(self.ReleaseContinuationPoint) + ', ' + \
7633
               'ContinuationPoint:' + str(self.ContinuationPoint) + ')'
7634
7635 1
    __repr__ = __str__
7636
7637
7638 1
class QueryNextRequest(FrozenClass):
7639
    '''
7640
    :ivar TypeId:
7641
    :vartype TypeId: NodeId
7642
    :ivar RequestHeader:
7643
    :vartype RequestHeader: RequestHeader
7644
    :ivar Parameters:
7645
    :vartype Parameters: QueryNextParameters
7646
    '''
7647 1
    def __init__(self, binary=None):
7648
        if binary is not None:
7649
            self._binary_init(binary)
7650
            self._freeze()
7651
            return
7652
        self.TypeId = FourByteNodeId(ObjectIds.QueryNextRequest_Encoding_DefaultBinary)
7653
        self.RequestHeader = RequestHeader()
7654
        self.Parameters = QueryNextParameters()
7655
        self._freeze()
7656
7657 1
    def to_binary(self):
7658
        packet = []
7659
        packet.append(self.TypeId.to_binary())
7660
        packet.append(self.RequestHeader.to_binary())
7661
        packet.append(self.Parameters.to_binary())
7662
        return b''.join(packet)
7663
7664 1
    @staticmethod
7665
    def from_binary(data):
7666
        return QueryNextRequest(data)
7667
7668 1
    def _binary_init(self, data):
7669
        self.TypeId = NodeId.from_binary(data)
7670
        self.RequestHeader = RequestHeader.from_binary(data)
7671
        self.Parameters = QueryNextParameters.from_binary(data)
7672
7673 1
    def __str__(self):
7674
        return 'QueryNextRequest(' + 'TypeId:' + str(self.TypeId) + ', ' + \
7675
               'RequestHeader:' + str(self.RequestHeader) + ', ' + \
7676
               'Parameters:' + str(self.Parameters) + ')'
7677
7678 1
    __repr__ = __str__
7679
7680
7681 1
class QueryNextResult(FrozenClass):
7682
    '''
7683
    :ivar QueryDataSets:
7684
    :vartype QueryDataSets: QueryDataSet
7685
    :ivar RevisedContinuationPoint:
7686
    :vartype RevisedContinuationPoint: ByteString
7687
    '''
7688 1
    def __init__(self, binary=None):
7689
        if binary is not None:
7690
            self._binary_init(binary)
7691
            self._freeze()
7692
            return
7693
        self.QueryDataSets = []
7694
        self.RevisedContinuationPoint = b''
7695
        self._freeze()
7696
7697 1
    def to_binary(self):
7698
        packet = []
7699
        packet.append(uatype_Int32.pack(len(self.QueryDataSets)))
7700
        for fieldname in self.QueryDataSets:
7701
            packet.append(fieldname.to_binary())
7702
        packet.append(pack_bytes(self.RevisedContinuationPoint))
7703
        return b''.join(packet)
7704
7705 1
    @staticmethod
7706
    def from_binary(data):
7707
        return QueryNextResult(data)
7708
7709 1
    def _binary_init(self, data):
7710
        length = uatype_Int32.unpack(data.read(4))[0]
7711
        array = []
7712
        if length != -1:
7713
            for _ in range(0, length):
7714
                array.append(QueryDataSet.from_binary(data))
7715
        self.QueryDataSets = array
7716
        self.RevisedContinuationPoint = unpack_bytes(data)
7717
7718 1
    def __str__(self):
7719
        return 'QueryNextResult(' + 'QueryDataSets:' + str(self.QueryDataSets) + ', ' + \
7720
               'RevisedContinuationPoint:' + str(self.RevisedContinuationPoint) + ')'
7721
7722 1
    __repr__ = __str__
7723
7724
7725 1
class QueryNextResponse(FrozenClass):
7726
    '''
7727
    :ivar TypeId:
7728
    :vartype TypeId: NodeId
7729
    :ivar ResponseHeader:
7730
    :vartype ResponseHeader: ResponseHeader
7731
    :ivar Parameters:
7732
    :vartype Parameters: QueryNextResult
7733
    '''
7734 1
    def __init__(self, binary=None):
7735
        if binary is not None:
7736
            self._binary_init(binary)
7737
            self._freeze()
7738
            return
7739
        self.TypeId = FourByteNodeId(ObjectIds.QueryNextResponse_Encoding_DefaultBinary)
7740
        self.ResponseHeader = ResponseHeader()
7741
        self.Parameters = QueryNextResult()
7742
        self._freeze()
7743
7744 1
    def to_binary(self):
7745
        packet = []
7746
        packet.append(self.TypeId.to_binary())
7747
        packet.append(self.ResponseHeader.to_binary())
7748
        packet.append(self.Parameters.to_binary())
7749
        return b''.join(packet)
7750
7751 1
    @staticmethod
7752
    def from_binary(data):
7753
        return QueryNextResponse(data)
7754
7755 1
    def _binary_init(self, data):
7756
        self.TypeId = NodeId.from_binary(data)
7757
        self.ResponseHeader = ResponseHeader.from_binary(data)
7758
        self.Parameters = QueryNextResult.from_binary(data)
7759
7760 1
    def __str__(self):
7761
        return 'QueryNextResponse(' + 'TypeId:' + str(self.TypeId) + ', ' + \
7762
               'ResponseHeader:' + str(self.ResponseHeader) + ', ' + \
7763
               'Parameters:' + str(self.Parameters) + ')'
7764
7765 1
    __repr__ = __str__
7766
7767
7768 1
class ReadValueId(FrozenClass):
7769
    '''
7770
    :ivar NodeId:
7771
    :vartype NodeId: NodeId
7772
    :ivar AttributeId:
7773
    :vartype AttributeId: UInt32
7774
    :ivar IndexRange:
7775
    :vartype IndexRange: String
7776
    :ivar DataEncoding:
7777
    :vartype DataEncoding: QualifiedName
7778
    '''
7779 1
    def __init__(self, binary=None):
7780 1
        if binary is not None:
7781 1
            self._binary_init(binary)
7782 1
            self._freeze()
7783 1
            return
7784 1
        self.NodeId = NodeId()
7785 1
        self.AttributeId = 0
7786 1
        self.IndexRange = ''
7787 1
        self.DataEncoding = QualifiedName()
7788 1
        self._freeze()
7789
7790 1
    def to_binary(self):
7791 1
        packet = []
7792 1
        packet.append(self.NodeId.to_binary())
7793 1
        packet.append(uatype_UInt32.pack(self.AttributeId))
7794 1
        packet.append(pack_string(self.IndexRange))
7795 1
        packet.append(self.DataEncoding.to_binary())
7796 1
        return b''.join(packet)
7797
7798 1
    @staticmethod
7799
    def from_binary(data):
7800 1
        return ReadValueId(data)
7801
7802 1
    def _binary_init(self, data):
7803 1
        self.NodeId = NodeId.from_binary(data)
7804 1
        self.AttributeId = uatype_UInt32.unpack(data.read(4))[0]
7805 1
        self.IndexRange = unpack_string(data)
7806 1
        self.DataEncoding = QualifiedName.from_binary(data)
7807
7808 1
    def __str__(self):
7809
        return 'ReadValueId(' + 'NodeId:' + str(self.NodeId) + ', ' + \
7810
               'AttributeId:' + str(self.AttributeId) + ', ' + \
7811
               'IndexRange:' + str(self.IndexRange) + ', ' + \
7812
               'DataEncoding:' + str(self.DataEncoding) + ')'
7813
7814 1
    __repr__ = __str__
7815
7816
7817 1
class ReadParameters(FrozenClass):
7818
    '''
7819
    :ivar MaxAge:
7820
    :vartype MaxAge: Double
7821
    :ivar TimestampsToReturn:
7822
    :vartype TimestampsToReturn: TimestampsToReturn
7823
    :ivar NodesToRead:
7824
    :vartype NodesToRead: ReadValueId
7825
    '''
7826 1
    def __init__(self, binary=None):
7827 1
        if binary is not None:
7828 1
            self._binary_init(binary)
7829 1
            self._freeze()
7830 1
            return
7831 1
        self.MaxAge = 0
7832 1
        self.TimestampsToReturn = 0
7833 1
        self.NodesToRead = []
7834 1
        self._freeze()
7835
7836 1
    def to_binary(self):
7837 1
        packet = []
7838 1
        packet.append(uatype_Double.pack(self.MaxAge))
7839 1
        packet.append(uatype_UInt32.pack(self.TimestampsToReturn))
7840 1
        packet.append(uatype_Int32.pack(len(self.NodesToRead)))
7841 1
        for fieldname in self.NodesToRead:
7842 1
            packet.append(fieldname.to_binary())
7843 1
        return b''.join(packet)
7844
7845 1
    @staticmethod
7846
    def from_binary(data):
7847 1
        return ReadParameters(data)
7848
7849 1
    def _binary_init(self, data):
7850 1
        self.MaxAge = uatype_Double.unpack(data.read(8))[0]
7851 1
        self.TimestampsToReturn = uatype_UInt32.unpack(data.read(4))[0]
7852 1
        length = uatype_Int32.unpack(data.read(4))[0]
7853 1
        array = []
7854 1
        if length != -1:
7855 1
            for _ in range(0, length):
7856 1
                array.append(ReadValueId.from_binary(data))
7857 1
        self.NodesToRead = array
7858
7859 1
    def __str__(self):
7860
        return 'ReadParameters(' + 'MaxAge:' + str(self.MaxAge) + ', ' + \
7861
               'TimestampsToReturn:' + str(self.TimestampsToReturn) + ', ' + \
7862
               'NodesToRead:' + str(self.NodesToRead) + ')'
7863
7864 1
    __repr__ = __str__
7865
7866
7867 1
class ReadRequest(FrozenClass):
7868
    '''
7869
    :ivar TypeId:
7870
    :vartype TypeId: NodeId
7871
    :ivar RequestHeader:
7872
    :vartype RequestHeader: RequestHeader
7873
    :ivar Parameters:
7874
    :vartype Parameters: ReadParameters
7875
    '''
7876 1
    def __init__(self, binary=None):
7877 1
        if binary is not None:
7878
            self._binary_init(binary)
7879
            self._freeze()
7880
            return
7881 1
        self.TypeId = FourByteNodeId(ObjectIds.ReadRequest_Encoding_DefaultBinary)
7882 1
        self.RequestHeader = RequestHeader()
7883 1
        self.Parameters = ReadParameters()
7884 1
        self._freeze()
7885
7886 1
    def to_binary(self):
7887 1
        packet = []
7888 1
        packet.append(self.TypeId.to_binary())
7889 1
        packet.append(self.RequestHeader.to_binary())
7890 1
        packet.append(self.Parameters.to_binary())
7891 1
        return b''.join(packet)
7892
7893 1
    @staticmethod
7894
    def from_binary(data):
7895
        return ReadRequest(data)
7896
7897 1
    def _binary_init(self, data):
7898
        self.TypeId = NodeId.from_binary(data)
7899
        self.RequestHeader = RequestHeader.from_binary(data)
7900
        self.Parameters = ReadParameters.from_binary(data)
7901
7902 1
    def __str__(self):
7903
        return 'ReadRequest(' + 'TypeId:' + str(self.TypeId) + ', ' + \
7904
               'RequestHeader:' + str(self.RequestHeader) + ', ' + \
7905
               'Parameters:' + str(self.Parameters) + ')'
7906
7907 1
    __repr__ = __str__
7908
7909
7910 1
class ReadResponse(FrozenClass):
7911
    '''
7912
    :ivar TypeId:
7913
    :vartype TypeId: NodeId
7914
    :ivar ResponseHeader:
7915
    :vartype ResponseHeader: ResponseHeader
7916
    :ivar Results:
7917
    :vartype Results: DataValue
7918
    :ivar DiagnosticInfos:
7919
    :vartype DiagnosticInfos: DiagnosticInfo
7920
    '''
7921 1
    def __init__(self, binary=None):
7922 1
        if binary is not None:
7923 1
            self._binary_init(binary)
7924 1
            self._freeze()
7925 1
            return
7926 1
        self.TypeId = FourByteNodeId(ObjectIds.ReadResponse_Encoding_DefaultBinary)
7927 1
        self.ResponseHeader = ResponseHeader()
7928 1
        self.Results = []
7929 1
        self.DiagnosticInfos = []
7930 1
        self._freeze()
7931
7932 1
    def to_binary(self):
7933 1
        packet = []
7934 1
        packet.append(self.TypeId.to_binary())
7935 1
        packet.append(self.ResponseHeader.to_binary())
7936 1
        packet.append(uatype_Int32.pack(len(self.Results)))
7937 1
        for fieldname in self.Results:
7938 1
            packet.append(fieldname.to_binary())
7939 1
        packet.append(uatype_Int32.pack(len(self.DiagnosticInfos)))
7940 1
        for fieldname in self.DiagnosticInfos:
7941
            packet.append(fieldname.to_binary())
7942 1
        return b''.join(packet)
7943
7944 1
    @staticmethod
7945
    def from_binary(data):
7946 1
        return ReadResponse(data)
7947
7948 1
    def _binary_init(self, data):
7949 1
        self.TypeId = NodeId.from_binary(data)
7950 1
        self.ResponseHeader = ResponseHeader.from_binary(data)
7951 1
        length = uatype_Int32.unpack(data.read(4))[0]
7952 1
        array = []
7953 1
        if length != -1:
7954 1
            for _ in range(0, length):
7955 1
                array.append(DataValue.from_binary(data))
7956 1
        self.Results = array
7957 1
        length = uatype_Int32.unpack(data.read(4))[0]
7958 1
        array = []
7959 1
        if length != -1:
7960 1
            for _ in range(0, length):
7961
                array.append(DiagnosticInfo.from_binary(data))
7962 1
        self.DiagnosticInfos = array
7963
7964 1
    def __str__(self):
7965
        return 'ReadResponse(' + 'TypeId:' + str(self.TypeId) + ', ' + \
7966
               'ResponseHeader:' + str(self.ResponseHeader) + ', ' + \
7967
               'Results:' + str(self.Results) + ', ' + \
7968
               'DiagnosticInfos:' + str(self.DiagnosticInfos) + ')'
7969
7970 1
    __repr__ = __str__
7971
7972
7973 1
class HistoryReadValueId(FrozenClass):
7974
    '''
7975
    :ivar NodeId:
7976
    :vartype NodeId: NodeId
7977
    :ivar IndexRange:
7978
    :vartype IndexRange: String
7979
    :ivar DataEncoding:
7980
    :vartype DataEncoding: QualifiedName
7981
    :ivar ContinuationPoint:
7982
    :vartype ContinuationPoint: ByteString
7983
    '''
7984 1
    def __init__(self, binary=None):
7985
        if binary is not None:
7986
            self._binary_init(binary)
7987
            self._freeze()
7988
            return
7989
        self.NodeId = NodeId()
7990
        self.IndexRange = ''
7991
        self.DataEncoding = QualifiedName()
7992
        self.ContinuationPoint = b''
7993
        self._freeze()
7994
7995 1
    def to_binary(self):
7996
        packet = []
7997
        packet.append(self.NodeId.to_binary())
7998
        packet.append(pack_string(self.IndexRange))
7999
        packet.append(self.DataEncoding.to_binary())
8000
        packet.append(pack_bytes(self.ContinuationPoint))
8001
        return b''.join(packet)
8002
8003 1
    @staticmethod
8004
    def from_binary(data):
8005
        return HistoryReadValueId(data)
8006
8007 1
    def _binary_init(self, data):
8008
        self.NodeId = NodeId.from_binary(data)
8009
        self.IndexRange = unpack_string(data)
8010
        self.DataEncoding = QualifiedName.from_binary(data)
8011
        self.ContinuationPoint = unpack_bytes(data)
8012
8013 1
    def __str__(self):
8014
        return 'HistoryReadValueId(' + 'NodeId:' + str(self.NodeId) + ', ' + \
8015
               'IndexRange:' + str(self.IndexRange) + ', ' + \
8016
               'DataEncoding:' + str(self.DataEncoding) + ', ' + \
8017
               'ContinuationPoint:' + str(self.ContinuationPoint) + ')'
8018
8019 1
    __repr__ = __str__
8020
8021
8022 1
class HistoryReadResult(FrozenClass):
8023
    '''
8024
    :ivar StatusCode:
8025
    :vartype StatusCode: StatusCode
8026
    :ivar ContinuationPoint:
8027
    :vartype ContinuationPoint: ByteString
8028
    :ivar HistoryData:
8029
    :vartype HistoryData: ExtensionObject
8030
    '''
8031 1
    def __init__(self, binary=None):
8032
        if binary is not None:
8033
            self._binary_init(binary)
8034
            self._freeze()
8035
            return
8036
        self.StatusCode = StatusCode()
8037
        self.ContinuationPoint = b''
8038
        self.HistoryData = None
8039
        self._freeze()
8040
8041 1
    def to_binary(self):
8042
        packet = []
8043
        packet.append(self.StatusCode.to_binary())
8044
        packet.append(pack_bytes(self.ContinuationPoint))
8045
        packet.append(extensionobject_to_binary(self.HistoryData))
8046
        return b''.join(packet)
8047
8048 1
    @staticmethod
8049
    def from_binary(data):
8050
        return HistoryReadResult(data)
8051
8052 1
    def _binary_init(self, data):
8053
        self.StatusCode = StatusCode.from_binary(data)
8054
        self.ContinuationPoint = unpack_bytes(data)
8055
        self.HistoryData = extensionobject_from_binary(data)
8056
8057 1
    def __str__(self):
8058
        return 'HistoryReadResult(' + 'StatusCode:' + str(self.StatusCode) + ', ' + \
8059
               'ContinuationPoint:' + str(self.ContinuationPoint) + ', ' + \
8060
               'HistoryData:' + str(self.HistoryData) + ')'
8061
8062 1
    __repr__ = __str__
8063
8064
8065 1
class HistoryReadDetails(FrozenClass):
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
8066
    '''
8067
    '''
8068 1
    def __init__(self, binary=None):
8069
        if binary is not None:
8070
            self._binary_init(binary)
8071
            self._freeze()
8072
            return
8073
        self._freeze()
8074
8075 1
    def to_binary(self):
8076
        packet = []
8077
        return b''.join(packet)
8078
8079 1
    @staticmethod
8080
    def from_binary(data):
8081
        return HistoryReadDetails(data)
8082
8083 1
    def _binary_init(self, data):
8084
        pass
8085
8086 1
    def __str__(self):
8087
        return 'HistoryReadDetails(' +  + ')'
8088
8089 1
    __repr__ = __str__
8090
8091
8092 1
class ReadEventDetails(FrozenClass):
8093
    '''
8094
    :ivar NumValuesPerNode:
8095
    :vartype NumValuesPerNode: UInt32
8096
    :ivar StartTime:
8097
    :vartype StartTime: DateTime
8098
    :ivar EndTime:
8099
    :vartype EndTime: DateTime
8100
    :ivar Filter:
8101
    :vartype Filter: EventFilter
8102
    '''
8103 1
    def __init__(self, binary=None):
8104
        if binary is not None:
8105
            self._binary_init(binary)
8106
            self._freeze()
8107
            return
8108
        self.NumValuesPerNode = 0
8109
        self.StartTime = datetime.now()
8110
        self.EndTime = datetime.now()
8111
        self.Filter = EventFilter()
8112
        self._freeze()
8113
8114 1
    def to_binary(self):
8115
        packet = []
8116
        packet.append(uatype_UInt32.pack(self.NumValuesPerNode))
8117
        packet.append(pack_datetime(self.StartTime))
8118
        packet.append(pack_datetime(self.EndTime))
8119
        packet.append(self.Filter.to_binary())
8120
        return b''.join(packet)
8121
8122 1
    @staticmethod
8123
    def from_binary(data):
8124
        return ReadEventDetails(data)
8125
8126 1
    def _binary_init(self, data):
8127
        self.NumValuesPerNode = uatype_UInt32.unpack(data.read(4))[0]
8128
        self.StartTime = unpack_datetime(data)
8129
        self.EndTime = unpack_datetime(data)
8130
        self.Filter = EventFilter.from_binary(data)
8131
8132 1
    def __str__(self):
8133
        return 'ReadEventDetails(' + 'NumValuesPerNode:' + str(self.NumValuesPerNode) + ', ' + \
8134
               'StartTime:' + str(self.StartTime) + ', ' + \
8135
               'EndTime:' + str(self.EndTime) + ', ' + \
8136
               'Filter:' + str(self.Filter) + ')'
8137
8138 1
    __repr__ = __str__
8139
8140
8141 1
class ReadRawModifiedDetails(FrozenClass):
8142
    '''
8143
    :ivar IsReadModified:
8144
    :vartype IsReadModified: Boolean
8145
    :ivar StartTime:
8146
    :vartype StartTime: DateTime
8147
    :ivar EndTime:
8148
    :vartype EndTime: DateTime
8149
    :ivar NumValuesPerNode:
8150
    :vartype NumValuesPerNode: UInt32
8151
    :ivar ReturnBounds:
8152
    :vartype ReturnBounds: Boolean
8153
    '''
8154 1
    def __init__(self, binary=None):
8155
        if binary is not None:
8156
            self._binary_init(binary)
8157
            self._freeze()
8158
            return
8159
        self.IsReadModified = True
8160
        self.StartTime = datetime.now()
8161
        self.EndTime = datetime.now()
8162
        self.NumValuesPerNode = 0
8163
        self.ReturnBounds = True
8164
        self._freeze()
8165
8166 1
    def to_binary(self):
8167
        packet = []
8168
        packet.append(uatype_Boolean.pack(self.IsReadModified))
8169
        packet.append(pack_datetime(self.StartTime))
8170
        packet.append(pack_datetime(self.EndTime))
8171
        packet.append(uatype_UInt32.pack(self.NumValuesPerNode))
8172
        packet.append(uatype_Boolean.pack(self.ReturnBounds))
8173
        return b''.join(packet)
8174
8175 1
    @staticmethod
8176
    def from_binary(data):
8177
        return ReadRawModifiedDetails(data)
8178
8179 1
    def _binary_init(self, data):
8180
        self.IsReadModified = uatype_Boolean.unpack(data.read(1))[0]
8181
        self.StartTime = unpack_datetime(data)
8182
        self.EndTime = unpack_datetime(data)
8183
        self.NumValuesPerNode = uatype_UInt32.unpack(data.read(4))[0]
8184
        self.ReturnBounds = uatype_Boolean.unpack(data.read(1))[0]
8185
8186 1
    def __str__(self):
8187
        return 'ReadRawModifiedDetails(' + 'IsReadModified:' + str(self.IsReadModified) + ', ' + \
8188
               'StartTime:' + str(self.StartTime) + ', ' + \
8189
               'EndTime:' + str(self.EndTime) + ', ' + \
8190
               'NumValuesPerNode:' + str(self.NumValuesPerNode) + ', ' + \
8191
               'ReturnBounds:' + str(self.ReturnBounds) + ')'
8192
8193 1
    __repr__ = __str__
8194
8195
8196 1
class ReadProcessedDetails(FrozenClass):
8197
    '''
8198
    :ivar StartTime:
8199
    :vartype StartTime: DateTime
8200
    :ivar EndTime:
8201
    :vartype EndTime: DateTime
8202
    :ivar ProcessingInterval:
8203
    :vartype ProcessingInterval: Double
8204
    :ivar AggregateType:
8205
    :vartype AggregateType: NodeId
8206
    :ivar AggregateConfiguration:
8207
    :vartype AggregateConfiguration: AggregateConfiguration
8208
    '''
8209 1
    def __init__(self, binary=None):
8210
        if binary is not None:
8211
            self._binary_init(binary)
8212
            self._freeze()
8213
            return
8214
        self.StartTime = datetime.now()
8215
        self.EndTime = datetime.now()
8216
        self.ProcessingInterval = 0
8217
        self.AggregateType = []
8218
        self.AggregateConfiguration = AggregateConfiguration()
8219
        self._freeze()
8220
8221 1
    def to_binary(self):
8222
        packet = []
8223
        packet.append(pack_datetime(self.StartTime))
8224
        packet.append(pack_datetime(self.EndTime))
8225
        packet.append(uatype_Double.pack(self.ProcessingInterval))
8226
        packet.append(uatype_Int32.pack(len(self.AggregateType)))
8227
        for fieldname in self.AggregateType:
8228
            packet.append(fieldname.to_binary())
8229
        packet.append(self.AggregateConfiguration.to_binary())
8230
        return b''.join(packet)
8231
8232 1
    @staticmethod
8233
    def from_binary(data):
8234
        return ReadProcessedDetails(data)
8235
8236 1
    def _binary_init(self, data):
8237
        self.StartTime = unpack_datetime(data)
8238
        self.EndTime = unpack_datetime(data)
8239
        self.ProcessingInterval = uatype_Double.unpack(data.read(8))[0]
8240
        length = uatype_Int32.unpack(data.read(4))[0]
8241
        array = []
8242
        if length != -1:
8243
            for _ in range(0, length):
8244
                array.append(NodeId.from_binary(data))
8245
        self.AggregateType = array
8246
        self.AggregateConfiguration = AggregateConfiguration.from_binary(data)
8247
8248 1
    def __str__(self):
8249
        return 'ReadProcessedDetails(' + 'StartTime:' + str(self.StartTime) + ', ' + \
8250
               'EndTime:' + str(self.EndTime) + ', ' + \
8251
               'ProcessingInterval:' + str(self.ProcessingInterval) + ', ' + \
8252
               'AggregateType:' + str(self.AggregateType) + ', ' + \
8253
               'AggregateConfiguration:' + str(self.AggregateConfiguration) + ')'
8254
8255 1
    __repr__ = __str__
8256
8257
8258 1
class ReadAtTimeDetails(FrozenClass):
8259
    '''
8260
    :ivar ReqTimes:
8261
    :vartype ReqTimes: DateTime
8262
    :ivar UseSimpleBounds:
8263
    :vartype UseSimpleBounds: Boolean
8264
    '''
8265 1
    def __init__(self, binary=None):
8266
        if binary is not None:
8267
            self._binary_init(binary)
8268
            self._freeze()
8269
            return
8270
        self.ReqTimes = []
8271
        self.UseSimpleBounds = True
8272
        self._freeze()
8273
8274 1
    def to_binary(self):
8275
        packet = []
8276
        packet.append(uatype_Int32.pack(len(self.ReqTimes)))
8277
        for fieldname in self.ReqTimes:
8278
            packet.append(pack_datetime(fieldname))
8279
        packet.append(uatype_Boolean.pack(self.UseSimpleBounds))
8280
        return b''.join(packet)
8281
8282 1
    @staticmethod
8283
    def from_binary(data):
8284
        return ReadAtTimeDetails(data)
8285
8286 1
    def _binary_init(self, data):
8287
        self.ReqTimes = unpack_uatype_array('DateTime', data)
8288
        self.UseSimpleBounds = uatype_Boolean.unpack(data.read(1))[0]
8289
8290 1
    def __str__(self):
8291
        return 'ReadAtTimeDetails(' + 'ReqTimes:' + str(self.ReqTimes) + ', ' + \
8292
               'UseSimpleBounds:' + str(self.UseSimpleBounds) + ')'
8293
8294 1
    __repr__ = __str__
8295
8296
8297 1
class HistoryData(FrozenClass):
8298
    '''
8299
    :ivar DataValues:
8300
    :vartype DataValues: DataValue
8301
    '''
8302 1
    def __init__(self, binary=None):
8303
        if binary is not None:
8304
            self._binary_init(binary)
8305
            self._freeze()
8306
            return
8307
        self.DataValues = []
8308
        self._freeze()
8309
8310 1
    def to_binary(self):
8311
        packet = []
8312
        packet.append(uatype_Int32.pack(len(self.DataValues)))
8313
        for fieldname in self.DataValues:
8314
            packet.append(fieldname.to_binary())
8315
        return b''.join(packet)
8316
8317 1
    @staticmethod
8318
    def from_binary(data):
8319
        return HistoryData(data)
8320
8321 1
    def _binary_init(self, data):
8322
        length = uatype_Int32.unpack(data.read(4))[0]
8323
        array = []
8324
        if length != -1:
8325
            for _ in range(0, length):
8326
                array.append(DataValue.from_binary(data))
8327
        self.DataValues = array
8328
8329 1
    def __str__(self):
8330
        return 'HistoryData(' + 'DataValues:' + str(self.DataValues) + ')'
8331
8332 1
    __repr__ = __str__
8333
8334
8335 1
class ModificationInfo(FrozenClass):
8336
    '''
8337
    :ivar ModificationTime:
8338
    :vartype ModificationTime: DateTime
8339
    :ivar UpdateType:
8340
    :vartype UpdateType: HistoryUpdateType
8341
    :ivar UserName:
8342
    :vartype UserName: String
8343
    '''
8344 1
    def __init__(self, binary=None):
8345
        if binary is not None:
8346
            self._binary_init(binary)
8347
            self._freeze()
8348
            return
8349
        self.ModificationTime = datetime.now()
8350
        self.UpdateType = 0
8351
        self.UserName = ''
8352
        self._freeze()
8353
8354 1
    def to_binary(self):
8355
        packet = []
8356
        packet.append(pack_datetime(self.ModificationTime))
8357
        packet.append(uatype_UInt32.pack(self.UpdateType))
8358
        packet.append(pack_string(self.UserName))
8359
        return b''.join(packet)
8360
8361 1
    @staticmethod
8362
    def from_binary(data):
8363
        return ModificationInfo(data)
8364
8365 1
    def _binary_init(self, data):
8366
        self.ModificationTime = unpack_datetime(data)
8367
        self.UpdateType = uatype_UInt32.unpack(data.read(4))[0]
8368
        self.UserName = unpack_string(data)
8369
8370 1
    def __str__(self):
8371
        return 'ModificationInfo(' + 'ModificationTime:' + str(self.ModificationTime) + ', ' + \
8372
               'UpdateType:' + str(self.UpdateType) + ', ' + \
8373
               'UserName:' + str(self.UserName) + ')'
8374
8375 1
    __repr__ = __str__
8376
8377
8378 1
class HistoryModifiedData(FrozenClass):
8379
    '''
8380
    :ivar DataValues:
8381
    :vartype DataValues: DataValue
8382
    :ivar ModificationInfos:
8383
    :vartype ModificationInfos: ModificationInfo
8384
    '''
8385 1
    def __init__(self, binary=None):
8386
        if binary is not None:
8387
            self._binary_init(binary)
8388
            self._freeze()
8389
            return
8390
        self.DataValues = []
8391
        self.ModificationInfos = []
8392
        self._freeze()
8393
8394 1
    def to_binary(self):
8395
        packet = []
8396
        packet.append(uatype_Int32.pack(len(self.DataValues)))
8397
        for fieldname in self.DataValues:
8398
            packet.append(fieldname.to_binary())
8399
        packet.append(uatype_Int32.pack(len(self.ModificationInfos)))
8400
        for fieldname in self.ModificationInfos:
8401
            packet.append(fieldname.to_binary())
8402
        return b''.join(packet)
8403
8404 1
    @staticmethod
8405
    def from_binary(data):
8406
        return HistoryModifiedData(data)
8407
8408 1
    def _binary_init(self, data):
8409
        length = uatype_Int32.unpack(data.read(4))[0]
8410
        array = []
8411
        if length != -1:
8412
            for _ in range(0, length):
8413
                array.append(DataValue.from_binary(data))
8414
        self.DataValues = array
8415
        length = uatype_Int32.unpack(data.read(4))[0]
8416
        array = []
8417
        if length != -1:
8418
            for _ in range(0, length):
8419
                array.append(ModificationInfo.from_binary(data))
8420
        self.ModificationInfos = array
8421
8422 1
    def __str__(self):
8423
        return 'HistoryModifiedData(' + 'DataValues:' + str(self.DataValues) + ', ' + \
8424
               'ModificationInfos:' + str(self.ModificationInfos) + ')'
8425
8426 1
    __repr__ = __str__
8427
8428
8429 1
class HistoryEvent(FrozenClass):
8430
    '''
8431
    :ivar Events:
8432
    :vartype Events: HistoryEventFieldList
8433
    '''
8434 1
    def __init__(self, binary=None):
8435
        if binary is not None:
8436
            self._binary_init(binary)
8437
            self._freeze()
8438
            return
8439
        self.Events = []
8440
        self._freeze()
8441
8442 1
    def to_binary(self):
8443
        packet = []
8444
        packet.append(uatype_Int32.pack(len(self.Events)))
8445
        for fieldname in self.Events:
8446
            packet.append(fieldname.to_binary())
8447
        return b''.join(packet)
8448
8449 1
    @staticmethod
8450
    def from_binary(data):
8451
        return HistoryEvent(data)
8452
8453 1
    def _binary_init(self, data):
8454
        length = uatype_Int32.unpack(data.read(4))[0]
8455
        array = []
8456
        if length != -1:
8457
            for _ in range(0, length):
8458
                array.append(HistoryEventFieldList.from_binary(data))
8459
        self.Events = array
8460
8461 1
    def __str__(self):
8462
        return 'HistoryEvent(' + 'Events:' + str(self.Events) + ')'
8463
8464 1
    __repr__ = __str__
8465
8466
8467 1
class HistoryReadParameters(FrozenClass):
8468
    '''
8469
    :ivar HistoryReadDetails:
8470
    :vartype HistoryReadDetails: ExtensionObject
8471
    :ivar TimestampsToReturn:
8472
    :vartype TimestampsToReturn: TimestampsToReturn
8473
    :ivar ReleaseContinuationPoints:
8474
    :vartype ReleaseContinuationPoints: Boolean
8475
    :ivar NodesToRead:
8476
    :vartype NodesToRead: HistoryReadValueId
8477
    '''
8478 1
    def __init__(self, binary=None):
8479
        if binary is not None:
8480
            self._binary_init(binary)
8481
            self._freeze()
8482
            return
8483
        self.HistoryReadDetails = None
8484
        self.TimestampsToReturn = 0
8485
        self.ReleaseContinuationPoints = True
8486
        self.NodesToRead = []
8487
        self._freeze()
8488
8489 1
    def to_binary(self):
8490
        packet = []
8491
        packet.append(extensionobject_to_binary(self.HistoryReadDetails))
8492
        packet.append(uatype_UInt32.pack(self.TimestampsToReturn))
8493
        packet.append(uatype_Boolean.pack(self.ReleaseContinuationPoints))
8494
        packet.append(uatype_Int32.pack(len(self.NodesToRead)))
8495
        for fieldname in self.NodesToRead:
8496
            packet.append(fieldname.to_binary())
8497
        return b''.join(packet)
8498
8499 1
    @staticmethod
8500
    def from_binary(data):
8501
        return HistoryReadParameters(data)
8502
8503 1
    def _binary_init(self, data):
8504
        self.HistoryReadDetails = extensionobject_from_binary(data)
8505
        self.TimestampsToReturn = uatype_UInt32.unpack(data.read(4))[0]
8506
        self.ReleaseContinuationPoints = uatype_Boolean.unpack(data.read(1))[0]
8507
        length = uatype_Int32.unpack(data.read(4))[0]
8508
        array = []
8509
        if length != -1:
8510
            for _ in range(0, length):
8511
                array.append(HistoryReadValueId.from_binary(data))
8512
        self.NodesToRead = array
8513
8514 1
    def __str__(self):
8515
        return 'HistoryReadParameters(' + 'HistoryReadDetails:' + str(self.HistoryReadDetails) + ', ' + \
8516
               'TimestampsToReturn:' + str(self.TimestampsToReturn) + ', ' + \
8517
               'ReleaseContinuationPoints:' + str(self.ReleaseContinuationPoints) + ', ' + \
8518
               'NodesToRead:' + str(self.NodesToRead) + ')'
8519
8520 1
    __repr__ = __str__
8521
8522
8523 1
class HistoryReadRequest(FrozenClass):
8524
    '''
8525
    :ivar TypeId:
8526
    :vartype TypeId: NodeId
8527
    :ivar RequestHeader:
8528
    :vartype RequestHeader: RequestHeader
8529
    :ivar Parameters:
8530
    :vartype Parameters: HistoryReadParameters
8531
    '''
8532 1
    def __init__(self, binary=None):
8533
        if binary is not None:
8534
            self._binary_init(binary)
8535
            self._freeze()
8536
            return
8537
        self.TypeId = FourByteNodeId(ObjectIds.HistoryReadRequest_Encoding_DefaultBinary)
8538
        self.RequestHeader = RequestHeader()
8539
        self.Parameters = HistoryReadParameters()
8540
        self._freeze()
8541
8542 1
    def to_binary(self):
8543
        packet = []
8544
        packet.append(self.TypeId.to_binary())
8545
        packet.append(self.RequestHeader.to_binary())
8546
        packet.append(self.Parameters.to_binary())
8547
        return b''.join(packet)
8548
8549 1
    @staticmethod
8550
    def from_binary(data):
8551
        return HistoryReadRequest(data)
8552
8553 1
    def _binary_init(self, data):
8554
        self.TypeId = NodeId.from_binary(data)
8555
        self.RequestHeader = RequestHeader.from_binary(data)
8556
        self.Parameters = HistoryReadParameters.from_binary(data)
8557
8558 1
    def __str__(self):
8559
        return 'HistoryReadRequest(' + 'TypeId:' + str(self.TypeId) + ', ' + \
8560
               'RequestHeader:' + str(self.RequestHeader) + ', ' + \
8561
               'Parameters:' + str(self.Parameters) + ')'
8562
8563 1
    __repr__ = __str__
8564
8565
8566 1
class HistoryReadResponse(FrozenClass):
8567
    '''
8568
    :ivar TypeId:
8569
    :vartype TypeId: NodeId
8570
    :ivar ResponseHeader:
8571
    :vartype ResponseHeader: ResponseHeader
8572
    :ivar Results:
8573
    :vartype Results: HistoryReadResult
8574
    :ivar DiagnosticInfos:
8575
    :vartype DiagnosticInfos: DiagnosticInfo
8576
    '''
8577 1
    def __init__(self, binary=None):
8578
        if binary is not None:
8579
            self._binary_init(binary)
8580
            self._freeze()
8581
            return
8582
        self.TypeId = FourByteNodeId(ObjectIds.HistoryReadResponse_Encoding_DefaultBinary)
8583
        self.ResponseHeader = ResponseHeader()
8584
        self.Results = []
8585
        self.DiagnosticInfos = []
8586
        self._freeze()
8587
8588 1
    def to_binary(self):
8589
        packet = []
8590
        packet.append(self.TypeId.to_binary())
8591
        packet.append(self.ResponseHeader.to_binary())
8592
        packet.append(uatype_Int32.pack(len(self.Results)))
8593
        for fieldname in self.Results:
8594
            packet.append(fieldname.to_binary())
8595
        packet.append(uatype_Int32.pack(len(self.DiagnosticInfos)))
8596
        for fieldname in self.DiagnosticInfos:
8597
            packet.append(fieldname.to_binary())
8598
        return b''.join(packet)
8599
8600 1
    @staticmethod
8601
    def from_binary(data):
8602
        return HistoryReadResponse(data)
8603
8604 1
    def _binary_init(self, data):
8605
        self.TypeId = NodeId.from_binary(data)
8606
        self.ResponseHeader = ResponseHeader.from_binary(data)
8607
        length = uatype_Int32.unpack(data.read(4))[0]
8608
        array = []
8609
        if length != -1:
8610
            for _ in range(0, length):
8611
                array.append(HistoryReadResult.from_binary(data))
8612
        self.Results = array
8613
        length = uatype_Int32.unpack(data.read(4))[0]
8614
        array = []
8615
        if length != -1:
8616
            for _ in range(0, length):
8617
                array.append(DiagnosticInfo.from_binary(data))
8618
        self.DiagnosticInfos = array
8619
8620 1
    def __str__(self):
8621
        return 'HistoryReadResponse(' + 'TypeId:' + str(self.TypeId) + ', ' + \
8622
               'ResponseHeader:' + str(self.ResponseHeader) + ', ' + \
8623
               'Results:' + str(self.Results) + ', ' + \
8624
               'DiagnosticInfos:' + str(self.DiagnosticInfos) + ')'
8625
8626 1
    __repr__ = __str__
8627
8628
8629 1
class WriteValue(FrozenClass):
8630
    '''
8631
    :ivar NodeId:
8632
    :vartype NodeId: NodeId
8633
    :ivar AttributeId:
8634
    :vartype AttributeId: UInt32
8635
    :ivar IndexRange:
8636
    :vartype IndexRange: String
8637
    :ivar Value:
8638
    :vartype Value: DataValue
8639
    '''
8640 1
    def __init__(self, binary=None):
8641 1
        if binary is not None:
8642 1
            self._binary_init(binary)
8643 1
            self._freeze()
8644 1
            return
8645 1
        self.NodeId = NodeId()
8646 1
        self.AttributeId = 0
8647 1
        self.IndexRange = ''
8648 1
        self.Value = DataValue()
8649 1
        self._freeze()
8650
8651 1
    def to_binary(self):
8652 1
        packet = []
8653 1
        packet.append(self.NodeId.to_binary())
8654 1
        packet.append(uatype_UInt32.pack(self.AttributeId))
8655 1
        packet.append(pack_string(self.IndexRange))
8656 1
        packet.append(self.Value.to_binary())
8657 1
        return b''.join(packet)
8658
8659 1
    @staticmethod
8660
    def from_binary(data):
8661 1
        return WriteValue(data)
8662
8663 1
    def _binary_init(self, data):
8664 1
        self.NodeId = NodeId.from_binary(data)
8665 1
        self.AttributeId = uatype_UInt32.unpack(data.read(4))[0]
8666 1
        self.IndexRange = unpack_string(data)
8667 1
        self.Value = DataValue.from_binary(data)
8668
8669 1
    def __str__(self):
8670
        return 'WriteValue(' + 'NodeId:' + str(self.NodeId) + ', ' + \
8671
               'AttributeId:' + str(self.AttributeId) + ', ' + \
8672
               'IndexRange:' + str(self.IndexRange) + ', ' + \
8673
               'Value:' + str(self.Value) + ')'
8674
8675 1
    __repr__ = __str__
8676
8677
8678 1
class WriteParameters(FrozenClass):
8679
    '''
8680
    :ivar NodesToWrite:
8681
    :vartype NodesToWrite: WriteValue
8682
    '''
8683 1
    def __init__(self, binary=None):
8684 1
        if binary is not None:
8685 1
            self._binary_init(binary)
8686 1
            self._freeze()
8687 1
            return
8688 1
        self.NodesToWrite = []
8689 1
        self._freeze()
8690
8691 1
    def to_binary(self):
8692 1
        packet = []
8693 1
        packet.append(uatype_Int32.pack(len(self.NodesToWrite)))
8694 1
        for fieldname in self.NodesToWrite:
8695 1
            packet.append(fieldname.to_binary())
8696 1
        return b''.join(packet)
8697
8698 1
    @staticmethod
8699
    def from_binary(data):
8700 1
        return WriteParameters(data)
8701
8702 1
    def _binary_init(self, data):
8703 1
        length = uatype_Int32.unpack(data.read(4))[0]
8704 1
        array = []
8705 1
        if length != -1:
8706 1
            for _ in range(0, length):
8707 1
                array.append(WriteValue.from_binary(data))
8708 1
        self.NodesToWrite = array
8709
8710 1
    def __str__(self):
8711
        return 'WriteParameters(' + 'NodesToWrite:' + str(self.NodesToWrite) + ')'
8712
8713 1
    __repr__ = __str__
8714
8715
8716 1
class WriteRequest(FrozenClass):
8717
    '''
8718
    :ivar TypeId:
8719
    :vartype TypeId: NodeId
8720
    :ivar RequestHeader:
8721
    :vartype RequestHeader: RequestHeader
8722
    :ivar Parameters:
8723
    :vartype Parameters: WriteParameters
8724
    '''
8725 1
    def __init__(self, binary=None):
8726 1
        if binary is not None:
8727
            self._binary_init(binary)
8728
            self._freeze()
8729
            return
8730 1
        self.TypeId = FourByteNodeId(ObjectIds.WriteRequest_Encoding_DefaultBinary)
8731 1
        self.RequestHeader = RequestHeader()
8732 1
        self.Parameters = WriteParameters()
8733 1
        self._freeze()
8734
8735 1
    def to_binary(self):
8736 1
        packet = []
8737 1
        packet.append(self.TypeId.to_binary())
8738 1
        packet.append(self.RequestHeader.to_binary())
8739 1
        packet.append(self.Parameters.to_binary())
8740 1
        return b''.join(packet)
8741
8742 1
    @staticmethod
8743
    def from_binary(data):
8744
        return WriteRequest(data)
8745
8746 1
    def _binary_init(self, data):
8747
        self.TypeId = NodeId.from_binary(data)
8748
        self.RequestHeader = RequestHeader.from_binary(data)
8749
        self.Parameters = WriteParameters.from_binary(data)
8750
8751 1
    def __str__(self):
8752
        return 'WriteRequest(' + 'TypeId:' + str(self.TypeId) + ', ' + \
8753
               'RequestHeader:' + str(self.RequestHeader) + ', ' + \
8754
               'Parameters:' + str(self.Parameters) + ')'
8755
8756 1
    __repr__ = __str__
8757
8758
8759 1
class WriteResponse(FrozenClass):
8760
    '''
8761
    :ivar TypeId:
8762
    :vartype TypeId: NodeId
8763
    :ivar ResponseHeader:
8764
    :vartype ResponseHeader: ResponseHeader
8765
    :ivar Results:
8766
    :vartype Results: StatusCode
8767
    :ivar DiagnosticInfos:
8768
    :vartype DiagnosticInfos: DiagnosticInfo
8769
    '''
8770 1
    def __init__(self, binary=None):
8771 1
        if binary is not None:
8772 1
            self._binary_init(binary)
8773 1
            self._freeze()
8774 1
            return
8775 1
        self.TypeId = FourByteNodeId(ObjectIds.WriteResponse_Encoding_DefaultBinary)
8776 1
        self.ResponseHeader = ResponseHeader()
8777 1
        self.Results = []
8778 1
        self.DiagnosticInfos = []
8779 1
        self._freeze()
8780
8781 1
    def to_binary(self):
8782 1
        packet = []
8783 1
        packet.append(self.TypeId.to_binary())
8784 1
        packet.append(self.ResponseHeader.to_binary())
8785 1
        packet.append(uatype_Int32.pack(len(self.Results)))
8786 1
        for fieldname in self.Results:
8787 1
            packet.append(fieldname.to_binary())
8788 1
        packet.append(uatype_Int32.pack(len(self.DiagnosticInfos)))
8789 1
        for fieldname in self.DiagnosticInfos:
8790
            packet.append(fieldname.to_binary())
8791 1
        return b''.join(packet)
8792
8793 1
    @staticmethod
8794
    def from_binary(data):
8795 1
        return WriteResponse(data)
8796
8797 1
    def _binary_init(self, data):
8798 1
        self.TypeId = NodeId.from_binary(data)
8799 1
        self.ResponseHeader = ResponseHeader.from_binary(data)
8800 1
        length = uatype_Int32.unpack(data.read(4))[0]
8801 1
        array = []
8802 1
        if length != -1:
8803 1
            for _ in range(0, length):
8804 1
                array.append(StatusCode.from_binary(data))
8805 1
        self.Results = array
8806 1
        length = uatype_Int32.unpack(data.read(4))[0]
8807 1
        array = []
8808 1
        if length != -1:
8809 1
            for _ in range(0, length):
8810
                array.append(DiagnosticInfo.from_binary(data))
8811 1
        self.DiagnosticInfos = array
8812
8813 1
    def __str__(self):
8814
        return 'WriteResponse(' + 'TypeId:' + str(self.TypeId) + ', ' + \
8815
               'ResponseHeader:' + str(self.ResponseHeader) + ', ' + \
8816
               'Results:' + str(self.Results) + ', ' + \
8817
               'DiagnosticInfos:' + str(self.DiagnosticInfos) + ')'
8818
8819 1
    __repr__ = __str__
8820
8821
8822 1
class HistoryUpdateDetails(FrozenClass):
8823
    '''
8824
    :ivar NodeId:
8825
    :vartype NodeId: NodeId
8826
    '''
8827 1
    def __init__(self, binary=None):
8828
        if binary is not None:
8829
            self._binary_init(binary)
8830
            self._freeze()
8831
            return
8832
        self.NodeId = NodeId()
8833
        self._freeze()
8834
8835 1
    def to_binary(self):
8836
        packet = []
8837
        packet.append(self.NodeId.to_binary())
8838
        return b''.join(packet)
8839
8840 1
    @staticmethod
8841
    def from_binary(data):
8842
        return HistoryUpdateDetails(data)
8843
8844 1
    def _binary_init(self, data):
8845
        self.NodeId = NodeId.from_binary(data)
8846
8847 1
    def __str__(self):
8848
        return 'HistoryUpdateDetails(' + 'NodeId:' + str(self.NodeId) + ')'
8849
8850 1
    __repr__ = __str__
8851
8852
8853 1
class UpdateDataDetails(FrozenClass):
8854
    '''
8855
    :ivar NodeId:
8856
    :vartype NodeId: NodeId
8857
    :ivar PerformInsertReplace:
8858
    :vartype PerformInsertReplace: PerformUpdateType
8859
    :ivar UpdateValues:
8860
    :vartype UpdateValues: DataValue
8861
    '''
8862 1
    def __init__(self, binary=None):
8863
        if binary is not None:
8864
            self._binary_init(binary)
8865
            self._freeze()
8866
            return
8867
        self.NodeId = NodeId()
8868
        self.PerformInsertReplace = 0
8869
        self.UpdateValues = []
8870
        self._freeze()
8871
8872 1
    def to_binary(self):
8873
        packet = []
8874
        packet.append(self.NodeId.to_binary())
8875
        packet.append(uatype_UInt32.pack(self.PerformInsertReplace))
8876
        packet.append(uatype_Int32.pack(len(self.UpdateValues)))
8877
        for fieldname in self.UpdateValues:
8878
            packet.append(fieldname.to_binary())
8879
        return b''.join(packet)
8880
8881 1
    @staticmethod
8882
    def from_binary(data):
8883
        return UpdateDataDetails(data)
8884
8885 1
    def _binary_init(self, data):
8886
        self.NodeId = NodeId.from_binary(data)
8887
        self.PerformInsertReplace = uatype_UInt32.unpack(data.read(4))[0]
8888
        length = uatype_Int32.unpack(data.read(4))[0]
8889
        array = []
8890
        if length != -1:
8891
            for _ in range(0, length):
8892
                array.append(DataValue.from_binary(data))
8893
        self.UpdateValues = array
8894
8895 1
    def __str__(self):
8896
        return 'UpdateDataDetails(' + 'NodeId:' + str(self.NodeId) + ', ' + \
8897
               'PerformInsertReplace:' + str(self.PerformInsertReplace) + ', ' + \
8898
               'UpdateValues:' + str(self.UpdateValues) + ')'
8899
8900 1
    __repr__ = __str__
8901
8902
8903 1
class UpdateStructureDataDetails(FrozenClass):
8904
    '''
8905
    :ivar NodeId:
8906
    :vartype NodeId: NodeId
8907
    :ivar PerformInsertReplace:
8908
    :vartype PerformInsertReplace: PerformUpdateType
8909
    :ivar UpdateValues:
8910
    :vartype UpdateValues: DataValue
8911
    '''
8912 1
    def __init__(self, binary=None):
8913
        if binary is not None:
8914
            self._binary_init(binary)
8915
            self._freeze()
8916
            return
8917
        self.NodeId = NodeId()
8918
        self.PerformInsertReplace = 0
8919
        self.UpdateValues = []
8920
        self._freeze()
8921
8922 1
    def to_binary(self):
8923
        packet = []
8924
        packet.append(self.NodeId.to_binary())
8925
        packet.append(uatype_UInt32.pack(self.PerformInsertReplace))
8926
        packet.append(uatype_Int32.pack(len(self.UpdateValues)))
8927
        for fieldname in self.UpdateValues:
8928
            packet.append(fieldname.to_binary())
8929
        return b''.join(packet)
8930
8931 1
    @staticmethod
8932
    def from_binary(data):
8933
        return UpdateStructureDataDetails(data)
8934
8935 1
    def _binary_init(self, data):
8936
        self.NodeId = NodeId.from_binary(data)
8937
        self.PerformInsertReplace = uatype_UInt32.unpack(data.read(4))[0]
8938
        length = uatype_Int32.unpack(data.read(4))[0]
8939
        array = []
8940
        if length != -1:
8941
            for _ in range(0, length):
8942
                array.append(DataValue.from_binary(data))
8943
        self.UpdateValues = array
8944
8945 1
    def __str__(self):
8946
        return 'UpdateStructureDataDetails(' + 'NodeId:' + str(self.NodeId) + ', ' + \
8947
               'PerformInsertReplace:' + str(self.PerformInsertReplace) + ', ' + \
8948
               'UpdateValues:' + str(self.UpdateValues) + ')'
8949
8950 1
    __repr__ = __str__
8951
8952
8953 1
class UpdateEventDetails(FrozenClass):
8954
    '''
8955
    :ivar NodeId:
8956
    :vartype NodeId: NodeId
8957
    :ivar PerformInsertReplace:
8958
    :vartype PerformInsertReplace: PerformUpdateType
8959
    :ivar Filter:
8960
    :vartype Filter: EventFilter
8961
    :ivar EventData:
8962
    :vartype EventData: HistoryEventFieldList
8963
    '''
8964 1
    def __init__(self, binary=None):
8965
        if binary is not None:
8966
            self._binary_init(binary)
8967
            self._freeze()
8968
            return
8969
        self.NodeId = NodeId()
8970
        self.PerformInsertReplace = 0
8971
        self.Filter = EventFilter()
8972
        self.EventData = []
8973
        self._freeze()
8974
8975 1
    def to_binary(self):
8976
        packet = []
8977
        packet.append(self.NodeId.to_binary())
8978
        packet.append(uatype_UInt32.pack(self.PerformInsertReplace))
8979
        packet.append(self.Filter.to_binary())
8980
        packet.append(uatype_Int32.pack(len(self.EventData)))
8981
        for fieldname in self.EventData:
8982
            packet.append(fieldname.to_binary())
8983
        return b''.join(packet)
8984
8985 1
    @staticmethod
8986
    def from_binary(data):
8987
        return UpdateEventDetails(data)
8988
8989 1
    def _binary_init(self, data):
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
8990
        self.NodeId = NodeId.from_binary(data)
8991
        self.PerformInsertReplace = uatype_UInt32.unpack(data.read(4))[0]
8992
        self.Filter = EventFilter.from_binary(data)
8993
        length = uatype_Int32.unpack(data.read(4))[0]
8994
        array = []
8995
        if length != -1:
8996
            for _ in range(0, length):
8997
                array.append(HistoryEventFieldList.from_binary(data))
8998
        self.EventData = array
8999
9000 1
    def __str__(self):
9001
        return 'UpdateEventDetails(' + 'NodeId:' + str(self.NodeId) + ', ' + \
9002
               'PerformInsertReplace:' + str(self.PerformInsertReplace) + ', ' + \
9003
               'Filter:' + str(self.Filter) + ', ' + \
9004
               'EventData:' + str(self.EventData) + ')'
9005
9006 1
    __repr__ = __str__
9007
9008
9009 1
class DeleteRawModifiedDetails(FrozenClass):
9010
    '''
9011
    :ivar NodeId:
9012
    :vartype NodeId: NodeId
9013
    :ivar IsDeleteModified:
9014
    :vartype IsDeleteModified: Boolean
9015
    :ivar StartTime:
9016
    :vartype StartTime: DateTime
9017
    :ivar EndTime:
9018
    :vartype EndTime: DateTime
9019
    '''
9020 1
    def __init__(self, binary=None):
9021
        if binary is not None:
9022
            self._binary_init(binary)
9023
            self._freeze()
9024
            return
9025
        self.NodeId = NodeId()
9026
        self.IsDeleteModified = True
9027
        self.StartTime = datetime.now()
9028
        self.EndTime = datetime.now()
9029
        self._freeze()
9030
9031 1
    def to_binary(self):
9032
        packet = []
9033
        packet.append(self.NodeId.to_binary())
9034
        packet.append(uatype_Boolean.pack(self.IsDeleteModified))
9035
        packet.append(pack_datetime(self.StartTime))
9036
        packet.append(pack_datetime(self.EndTime))
9037
        return b''.join(packet)
9038
9039 1
    @staticmethod
9040
    def from_binary(data):
9041
        return DeleteRawModifiedDetails(data)
9042
9043 1
    def _binary_init(self, data):
9044
        self.NodeId = NodeId.from_binary(data)
9045
        self.IsDeleteModified = uatype_Boolean.unpack(data.read(1))[0]
9046
        self.StartTime = unpack_datetime(data)
9047
        self.EndTime = unpack_datetime(data)
9048
9049 1
    def __str__(self):
9050
        return 'DeleteRawModifiedDetails(' + 'NodeId:' + str(self.NodeId) + ', ' + \
9051
               'IsDeleteModified:' + str(self.IsDeleteModified) + ', ' + \
9052
               'StartTime:' + str(self.StartTime) + ', ' + \
9053
               'EndTime:' + str(self.EndTime) + ')'
9054
9055 1
    __repr__ = __str__
9056
9057
9058 1
class DeleteAtTimeDetails(FrozenClass):
9059
    '''
9060
    :ivar NodeId:
9061
    :vartype NodeId: NodeId
9062
    :ivar ReqTimes:
9063
    :vartype ReqTimes: DateTime
9064
    '''
9065 1
    def __init__(self, binary=None):
9066
        if binary is not None:
9067
            self._binary_init(binary)
9068
            self._freeze()
9069
            return
9070
        self.NodeId = NodeId()
9071
        self.ReqTimes = []
9072
        self._freeze()
9073
9074 1
    def to_binary(self):
9075
        packet = []
9076
        packet.append(self.NodeId.to_binary())
9077
        packet.append(uatype_Int32.pack(len(self.ReqTimes)))
9078
        for fieldname in self.ReqTimes:
9079
            packet.append(pack_datetime(fieldname))
9080
        return b''.join(packet)
9081
9082 1
    @staticmethod
9083
    def from_binary(data):
9084
        return DeleteAtTimeDetails(data)
9085
9086 1
    def _binary_init(self, data):
9087
        self.NodeId = NodeId.from_binary(data)
9088
        self.ReqTimes = unpack_uatype_array('DateTime', data)
9089
9090 1
    def __str__(self):
9091
        return 'DeleteAtTimeDetails(' + 'NodeId:' + str(self.NodeId) + ', ' + \
9092
               'ReqTimes:' + str(self.ReqTimes) + ')'
9093
9094 1
    __repr__ = __str__
9095
9096
9097 1
class DeleteEventDetails(FrozenClass):
9098
    '''
9099
    :ivar NodeId:
9100
    :vartype NodeId: NodeId
9101
    :ivar EventIds:
9102
    :vartype EventIds: ByteString
9103
    '''
9104 1
    def __init__(self, binary=None):
9105
        if binary is not None:
9106
            self._binary_init(binary)
9107
            self._freeze()
9108
            return
9109
        self.NodeId = NodeId()
9110
        self.EventIds = []
9111
        self._freeze()
9112
9113 1
    def to_binary(self):
9114
        packet = []
9115
        packet.append(self.NodeId.to_binary())
9116
        packet.append(uatype_Int32.pack(len(self.EventIds)))
9117
        for fieldname in self.EventIds:
9118
            packet.append(pack_bytes(fieldname))
9119
        return b''.join(packet)
9120
9121 1
    @staticmethod
9122
    def from_binary(data):
9123
        return DeleteEventDetails(data)
9124
9125 1
    def _binary_init(self, data):
9126
        self.NodeId = NodeId.from_binary(data)
9127
        self.EventIds = unpack_uatype_array('ByteString', data)
9128
9129 1
    def __str__(self):
9130
        return 'DeleteEventDetails(' + 'NodeId:' + str(self.NodeId) + ', ' + \
9131
               'EventIds:' + str(self.EventIds) + ')'
9132
9133 1
    __repr__ = __str__
9134
9135
9136 1
class HistoryUpdateResult(FrozenClass):
9137
    '''
9138
    :ivar StatusCode:
9139
    :vartype StatusCode: StatusCode
9140
    :ivar OperationResults:
9141
    :vartype OperationResults: StatusCode
9142
    :ivar DiagnosticInfos:
9143
    :vartype DiagnosticInfos: DiagnosticInfo
9144
    '''
9145 1
    def __init__(self, binary=None):
9146
        if binary is not None:
9147
            self._binary_init(binary)
9148
            self._freeze()
9149
            return
9150
        self.StatusCode = StatusCode()
9151
        self.OperationResults = []
9152
        self.DiagnosticInfos = []
9153
        self._freeze()
9154
9155 1
    def to_binary(self):
9156
        packet = []
9157
        packet.append(self.StatusCode.to_binary())
9158
        packet.append(uatype_Int32.pack(len(self.OperationResults)))
9159
        for fieldname in self.OperationResults:
9160
            packet.append(fieldname.to_binary())
9161
        packet.append(uatype_Int32.pack(len(self.DiagnosticInfos)))
9162
        for fieldname in self.DiagnosticInfos:
9163
            packet.append(fieldname.to_binary())
9164
        return b''.join(packet)
9165
9166 1
    @staticmethod
9167
    def from_binary(data):
9168
        return HistoryUpdateResult(data)
9169
9170 1
    def _binary_init(self, data):
9171
        self.StatusCode = StatusCode.from_binary(data)
9172
        length = uatype_Int32.unpack(data.read(4))[0]
9173
        array = []
9174
        if length != -1:
9175
            for _ in range(0, length):
9176
                array.append(StatusCode.from_binary(data))
9177
        self.OperationResults = array
9178
        length = uatype_Int32.unpack(data.read(4))[0]
9179
        array = []
9180
        if length != -1:
9181
            for _ in range(0, length):
9182
                array.append(DiagnosticInfo.from_binary(data))
9183
        self.DiagnosticInfos = array
9184
9185 1
    def __str__(self):
9186
        return 'HistoryUpdateResult(' + 'StatusCode:' + str(self.StatusCode) + ', ' + \
9187
               'OperationResults:' + str(self.OperationResults) + ', ' + \
9188
               'DiagnosticInfos:' + str(self.DiagnosticInfos) + ')'
9189
9190 1
    __repr__ = __str__
9191
9192
9193 1
class HistoryUpdateParameters(FrozenClass):
9194
    '''
9195
    :ivar HistoryUpdateDetails:
9196
    :vartype HistoryUpdateDetails: ExtensionObject
9197
    '''
9198 1
    def __init__(self, binary=None):
9199
        if binary is not None:
9200
            self._binary_init(binary)
9201
            self._freeze()
9202
            return
9203
        self.HistoryUpdateDetails = []
9204
        self._freeze()
9205
9206 1
    def to_binary(self):
9207
        packet = []
9208
        packet.append(uatype_Int32.pack(len(self.HistoryUpdateDetails)))
9209
        for fieldname in self.HistoryUpdateDetails:
9210
            packet.append(extensionobject_to_binary(fieldname))
9211
        return b''.join(packet)
9212
9213 1
    @staticmethod
9214
    def from_binary(data):
9215
        return HistoryUpdateParameters(data)
9216
9217 1
    def _binary_init(self, data):
9218
        length = uatype_Int32.unpack(data.read(4))[0]
9219
        array = []
9220
        if length != -1:
9221
            for _ in range(0, length):
9222
                array.append(extensionobject_from_binary(data))
9223
        self.HistoryUpdateDetails = array
9224
9225 1
    def __str__(self):
9226
        return 'HistoryUpdateParameters(' + 'HistoryUpdateDetails:' + str(self.HistoryUpdateDetails) + ')'
9227
9228 1
    __repr__ = __str__
9229
9230
9231 1
class HistoryUpdateRequest(FrozenClass):
9232
    '''
9233
    :ivar TypeId:
9234
    :vartype TypeId: NodeId
9235
    :ivar RequestHeader:
9236
    :vartype RequestHeader: RequestHeader
9237
    :ivar Parameters:
9238
    :vartype Parameters: HistoryUpdateParameters
9239
    '''
9240 1
    def __init__(self, binary=None):
9241
        if binary is not None:
9242
            self._binary_init(binary)
9243
            self._freeze()
9244
            return
9245
        self.TypeId = FourByteNodeId(ObjectIds.HistoryUpdateRequest_Encoding_DefaultBinary)
9246
        self.RequestHeader = RequestHeader()
9247
        self.Parameters = HistoryUpdateParameters()
9248
        self._freeze()
9249
9250 1
    def to_binary(self):
9251
        packet = []
9252
        packet.append(self.TypeId.to_binary())
9253
        packet.append(self.RequestHeader.to_binary())
9254
        packet.append(self.Parameters.to_binary())
9255
        return b''.join(packet)
9256
9257 1
    @staticmethod
9258
    def from_binary(data):
9259
        return HistoryUpdateRequest(data)
9260
9261 1
    def _binary_init(self, data):
9262
        self.TypeId = NodeId.from_binary(data)
9263
        self.RequestHeader = RequestHeader.from_binary(data)
9264
        self.Parameters = HistoryUpdateParameters.from_binary(data)
9265
9266 1
    def __str__(self):
9267
        return 'HistoryUpdateRequest(' + 'TypeId:' + str(self.TypeId) + ', ' + \
9268
               'RequestHeader:' + str(self.RequestHeader) + ', ' + \
9269
               'Parameters:' + str(self.Parameters) + ')'
9270
9271 1
    __repr__ = __str__
9272
9273
9274 1
class HistoryUpdateResponse(FrozenClass):
9275
    '''
9276
    :ivar TypeId:
9277
    :vartype TypeId: NodeId
9278
    :ivar ResponseHeader:
9279
    :vartype ResponseHeader: ResponseHeader
9280
    :ivar Results:
9281
    :vartype Results: HistoryUpdateResult
9282
    :ivar DiagnosticInfos:
9283
    :vartype DiagnosticInfos: DiagnosticInfo
9284
    '''
9285 1
    def __init__(self, binary=None):
9286
        if binary is not None:
9287
            self._binary_init(binary)
9288
            self._freeze()
9289
            return
9290
        self.TypeId = FourByteNodeId(ObjectIds.HistoryUpdateResponse_Encoding_DefaultBinary)
9291
        self.ResponseHeader = ResponseHeader()
9292
        self.Results = []
9293
        self.DiagnosticInfos = []
9294
        self._freeze()
9295
9296 1
    def to_binary(self):
9297
        packet = []
9298
        packet.append(self.TypeId.to_binary())
9299
        packet.append(self.ResponseHeader.to_binary())
9300
        packet.append(uatype_Int32.pack(len(self.Results)))
9301
        for fieldname in self.Results:
9302
            packet.append(fieldname.to_binary())
9303
        packet.append(uatype_Int32.pack(len(self.DiagnosticInfos)))
9304
        for fieldname in self.DiagnosticInfos:
9305
            packet.append(fieldname.to_binary())
9306
        return b''.join(packet)
9307
9308 1
    @staticmethod
9309
    def from_binary(data):
9310
        return HistoryUpdateResponse(data)
9311
9312 1
    def _binary_init(self, data):
9313
        self.TypeId = NodeId.from_binary(data)
9314
        self.ResponseHeader = ResponseHeader.from_binary(data)
9315
        length = uatype_Int32.unpack(data.read(4))[0]
9316
        array = []
9317
        if length != -1:
9318
            for _ in range(0, length):
9319
                array.append(HistoryUpdateResult.from_binary(data))
9320
        self.Results = array
9321
        length = uatype_Int32.unpack(data.read(4))[0]
9322
        array = []
9323
        if length != -1:
9324
            for _ in range(0, length):
9325
                array.append(DiagnosticInfo.from_binary(data))
9326
        self.DiagnosticInfos = array
9327
9328 1
    def __str__(self):
9329
        return 'HistoryUpdateResponse(' + 'TypeId:' + str(self.TypeId) + ', ' + \
9330
               'ResponseHeader:' + str(self.ResponseHeader) + ', ' + \
9331
               'Results:' + str(self.Results) + ', ' + \
9332
               'DiagnosticInfos:' + str(self.DiagnosticInfos) + ')'
9333
9334 1
    __repr__ = __str__
9335
9336
9337 1
class CallMethodRequest(FrozenClass):
9338
    '''
9339
    :ivar ObjectId:
9340
    :vartype ObjectId: NodeId
9341
    :ivar MethodId:
9342
    :vartype MethodId: NodeId
9343
    :ivar InputArguments:
9344
    :vartype InputArguments: Variant
9345
    '''
9346 1
    def __init__(self, binary=None):
9347 1
        if binary is not None:
9348 1
            self._binary_init(binary)
9349 1
            self._freeze()
9350 1
            return
9351 1
        self.ObjectId = NodeId()
9352 1
        self.MethodId = NodeId()
9353 1
        self.InputArguments = []
9354 1
        self._freeze()
9355
9356 1
    def to_binary(self):
9357 1
        packet = []
9358 1
        packet.append(self.ObjectId.to_binary())
9359 1
        packet.append(self.MethodId.to_binary())
9360 1
        packet.append(uatype_Int32.pack(len(self.InputArguments)))
9361 1
        for fieldname in self.InputArguments:
9362 1
            packet.append(fieldname.to_binary())
9363 1
        return b''.join(packet)
9364
9365 1
    @staticmethod
9366
    def from_binary(data):
9367 1
        return CallMethodRequest(data)
9368
9369 1
    def _binary_init(self, data):
9370 1
        self.ObjectId = NodeId.from_binary(data)
9371 1
        self.MethodId = NodeId.from_binary(data)
9372 1
        length = uatype_Int32.unpack(data.read(4))[0]
9373 1
        array = []
9374 1
        if length != -1:
9375 1
            for _ in range(0, length):
9376 1
                array.append(Variant.from_binary(data))
9377 1
        self.InputArguments = array
9378
9379 1
    def __str__(self):
9380 1
        return 'CallMethodRequest(' + 'ObjectId:' + str(self.ObjectId) + ', ' + \
9381
               'MethodId:' + str(self.MethodId) + ', ' + \
9382
               'InputArguments:' + str(self.InputArguments) + ')'
9383
9384 1
    __repr__ = __str__
9385
9386
9387 1
class CallMethodResult(FrozenClass):
9388
    '''
9389
    :ivar StatusCode:
9390
    :vartype StatusCode: StatusCode
9391
    :ivar InputArgumentResults:
9392
    :vartype InputArgumentResults: StatusCode
9393
    :ivar InputArgumentDiagnosticInfos:
9394
    :vartype InputArgumentDiagnosticInfos: DiagnosticInfo
9395
    :ivar OutputArguments:
9396
    :vartype OutputArguments: Variant
9397
    '''
9398 1
    def __init__(self, binary=None):
9399 1
        if binary is not None:
9400 1
            self._binary_init(binary)
9401 1
            self._freeze()
9402 1
            return
9403 1
        self.StatusCode = StatusCode()
9404 1
        self.InputArgumentResults = []
9405 1
        self.InputArgumentDiagnosticInfos = []
9406 1
        self.OutputArguments = []
9407 1
        self._freeze()
9408
9409 1
    def to_binary(self):
9410 1
        packet = []
9411 1
        packet.append(self.StatusCode.to_binary())
9412 1
        packet.append(uatype_Int32.pack(len(self.InputArgumentResults)))
9413 1
        for fieldname in self.InputArgumentResults:
9414 1
            packet.append(fieldname.to_binary())
9415 1
        packet.append(uatype_Int32.pack(len(self.InputArgumentDiagnosticInfos)))
9416 1
        for fieldname in self.InputArgumentDiagnosticInfos:
9417
            packet.append(fieldname.to_binary())
9418 1
        packet.append(uatype_Int32.pack(len(self.OutputArguments)))
9419 1
        for fieldname in self.OutputArguments:
9420 1
            packet.append(fieldname.to_binary())
9421 1
        return b''.join(packet)
9422
9423 1
    @staticmethod
9424
    def from_binary(data):
9425 1
        return CallMethodResult(data)
9426
9427 1
    def _binary_init(self, data):
9428 1
        self.StatusCode = StatusCode.from_binary(data)
9429 1
        length = uatype_Int32.unpack(data.read(4))[0]
9430 1
        array = []
9431 1
        if length != -1:
9432 1
            for _ in range(0, length):
9433 1
                array.append(StatusCode.from_binary(data))
9434 1
        self.InputArgumentResults = array
9435 1
        length = uatype_Int32.unpack(data.read(4))[0]
9436 1
        array = []
9437 1
        if length != -1:
9438 1
            for _ in range(0, length):
9439
                array.append(DiagnosticInfo.from_binary(data))
9440 1
        self.InputArgumentDiagnosticInfos = array
9441 1
        length = uatype_Int32.unpack(data.read(4))[0]
9442 1
        array = []
9443 1
        if length != -1:
9444 1
            for _ in range(0, length):
9445 1
                array.append(Variant.from_binary(data))
9446 1
        self.OutputArguments = array
9447
9448 1
    def __str__(self):
9449
        return 'CallMethodResult(' + 'StatusCode:' + str(self.StatusCode) + ', ' + \
9450
               'InputArgumentResults:' + str(self.InputArgumentResults) + ', ' + \
9451
               'InputArgumentDiagnosticInfos:' + str(self.InputArgumentDiagnosticInfos) + ', ' + \
9452
               'OutputArguments:' + str(self.OutputArguments) + ')'
9453
9454 1
    __repr__ = __str__
9455
9456
9457 1
class CallParameters(FrozenClass):
9458
    '''
9459
    :ivar MethodsToCall:
9460
    :vartype MethodsToCall: CallMethodRequest
9461
    '''
9462 1
    def __init__(self, binary=None):
9463 1
        if binary is not None:
9464 1
            self._binary_init(binary)
9465 1
            self._freeze()
9466 1
            return
9467 1
        self.MethodsToCall = []
9468 1
        self._freeze()
9469
9470 1
    def to_binary(self):
9471 1
        packet = []
9472 1
        packet.append(uatype_Int32.pack(len(self.MethodsToCall)))
9473 1
        for fieldname in self.MethodsToCall:
9474 1
            packet.append(fieldname.to_binary())
9475 1
        return b''.join(packet)
9476
9477 1
    @staticmethod
9478
    def from_binary(data):
9479 1
        return CallParameters(data)
9480
9481 1
    def _binary_init(self, data):
9482 1
        length = uatype_Int32.unpack(data.read(4))[0]
9483 1
        array = []
9484 1
        if length != -1:
9485 1
            for _ in range(0, length):
9486 1
                array.append(CallMethodRequest.from_binary(data))
9487 1
        self.MethodsToCall = array
9488
9489 1
    def __str__(self):
9490
        return 'CallParameters(' + 'MethodsToCall:' + str(self.MethodsToCall) + ')'
9491
9492 1
    __repr__ = __str__
9493
9494
9495 1
class CallRequest(FrozenClass):
9496
    '''
9497
    :ivar TypeId:
9498
    :vartype TypeId: NodeId
9499
    :ivar RequestHeader:
9500
    :vartype RequestHeader: RequestHeader
9501
    :ivar Parameters:
9502
    :vartype Parameters: CallParameters
9503
    '''
9504 1
    def __init__(self, binary=None):
9505 1
        if binary is not None:
9506
            self._binary_init(binary)
9507
            self._freeze()
9508
            return
9509 1
        self.TypeId = FourByteNodeId(ObjectIds.CallRequest_Encoding_DefaultBinary)
9510 1
        self.RequestHeader = RequestHeader()
9511 1
        self.Parameters = CallParameters()
9512 1
        self._freeze()
9513
9514 1
    def to_binary(self):
9515 1
        packet = []
9516 1
        packet.append(self.TypeId.to_binary())
9517 1
        packet.append(self.RequestHeader.to_binary())
9518 1
        packet.append(self.Parameters.to_binary())
9519 1
        return b''.join(packet)
9520
9521 1
    @staticmethod
9522
    def from_binary(data):
9523
        return CallRequest(data)
9524
9525 1
    def _binary_init(self, data):
9526
        self.TypeId = NodeId.from_binary(data)
9527
        self.RequestHeader = RequestHeader.from_binary(data)
9528
        self.Parameters = CallParameters.from_binary(data)
9529
9530 1
    def __str__(self):
9531
        return 'CallRequest(' + 'TypeId:' + str(self.TypeId) + ', ' + \
9532
               'RequestHeader:' + str(self.RequestHeader) + ', ' + \
9533
               'Parameters:' + str(self.Parameters) + ')'
9534
9535 1
    __repr__ = __str__
9536
9537
9538 1
class CallResponse(FrozenClass):
9539
    '''
9540
    :ivar TypeId:
9541
    :vartype TypeId: NodeId
9542
    :ivar ResponseHeader:
9543
    :vartype ResponseHeader: ResponseHeader
9544
    :ivar Results:
9545
    :vartype Results: CallMethodResult
9546
    :ivar DiagnosticInfos:
9547
    :vartype DiagnosticInfos: DiagnosticInfo
9548
    '''
9549 1
    def __init__(self, binary=None):
9550 1
        if binary is not None:
9551 1
            self._binary_init(binary)
9552 1
            self._freeze()
9553 1
            return
9554 1
        self.TypeId = FourByteNodeId(ObjectIds.CallResponse_Encoding_DefaultBinary)
9555 1
        self.ResponseHeader = ResponseHeader()
9556 1
        self.Results = []
9557 1
        self.DiagnosticInfos = []
9558 1
        self._freeze()
9559
9560 1
    def to_binary(self):
9561 1
        packet = []
9562 1
        packet.append(self.TypeId.to_binary())
9563 1
        packet.append(self.ResponseHeader.to_binary())
9564 1
        packet.append(uatype_Int32.pack(len(self.Results)))
9565 1
        for fieldname in self.Results:
9566 1
            packet.append(fieldname.to_binary())
9567 1
        packet.append(uatype_Int32.pack(len(self.DiagnosticInfos)))
9568 1
        for fieldname in self.DiagnosticInfos:
9569
            packet.append(fieldname.to_binary())
9570 1
        return b''.join(packet)
9571
9572 1
    @staticmethod
9573
    def from_binary(data):
9574 1
        return CallResponse(data)
9575
9576 1
    def _binary_init(self, data):
9577 1
        self.TypeId = NodeId.from_binary(data)
9578 1
        self.ResponseHeader = ResponseHeader.from_binary(data)
9579 1
        length = uatype_Int32.unpack(data.read(4))[0]
9580 1
        array = []
9581 1
        if length != -1:
9582 1
            for _ in range(0, length):
9583 1
                array.append(CallMethodResult.from_binary(data))
9584 1
        self.Results = array
9585 1
        length = uatype_Int32.unpack(data.read(4))[0]
9586 1
        array = []
9587 1
        if length != -1:
9588 1
            for _ in range(0, length):
9589
                array.append(DiagnosticInfo.from_binary(data))
9590 1
        self.DiagnosticInfos = array
9591
9592 1
    def __str__(self):
9593
        return 'CallResponse(' + 'TypeId:' + str(self.TypeId) + ', ' + \
9594
               'ResponseHeader:' + str(self.ResponseHeader) + ', ' + \
9595
               'Results:' + str(self.Results) + ', ' + \
9596
               'DiagnosticInfos:' + str(self.DiagnosticInfos) + ')'
9597
9598 1
    __repr__ = __str__
9599
9600
9601 1
class MonitoringFilter(FrozenClass):
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
9602
    '''
9603
    '''
9604 1
    def __init__(self, binary=None):
9605
        if binary is not None:
9606
            self._binary_init(binary)
9607
            self._freeze()
9608
            return
9609
        self._freeze()
9610
9611 1
    def to_binary(self):
9612
        packet = []
9613
        return b''.join(packet)
9614
9615 1
    @staticmethod
9616
    def from_binary(data):
9617
        return MonitoringFilter(data)
9618
9619 1
    def _binary_init(self, data):
9620
        pass
9621
9622 1
    def __str__(self):
9623
        return 'MonitoringFilter(' +  + ')'
9624
9625 1
    __repr__ = __str__
9626
9627
9628 1
class DataChangeFilter(FrozenClass):
9629
    '''
9630
    :ivar Trigger:
9631
    :vartype Trigger: DataChangeTrigger
9632
    :ivar DeadbandType:
9633
    :vartype DeadbandType: UInt32
9634
    :ivar DeadbandValue:
9635
    :vartype DeadbandValue: Double
9636
    '''
9637 1
    def __init__(self, binary=None):
9638
        if binary is not None:
9639
            self._binary_init(binary)
9640
            self._freeze()
9641
            return
9642
        self.Trigger = 0
9643
        self.DeadbandType = 0
9644
        self.DeadbandValue = 0
9645
        self._freeze()
9646
9647 1
    def to_binary(self):
9648
        packet = []
9649
        packet.append(uatype_UInt32.pack(self.Trigger))
9650
        packet.append(uatype_UInt32.pack(self.DeadbandType))
9651
        packet.append(uatype_Double.pack(self.DeadbandValue))
9652
        return b''.join(packet)
9653
9654 1
    @staticmethod
9655
    def from_binary(data):
9656
        return DataChangeFilter(data)
9657
9658 1
    def _binary_init(self, data):
9659
        self.Trigger = uatype_UInt32.unpack(data.read(4))[0]
9660
        self.DeadbandType = uatype_UInt32.unpack(data.read(4))[0]
9661
        self.DeadbandValue = uatype_Double.unpack(data.read(8))[0]
9662
9663 1
    def __str__(self):
9664
        return 'DataChangeFilter(' + 'Trigger:' + str(self.Trigger) + ', ' + \
9665
               'DeadbandType:' + str(self.DeadbandType) + ', ' + \
9666
               'DeadbandValue:' + str(self.DeadbandValue) + ')'
9667
9668 1
    __repr__ = __str__
9669
9670
9671 1
class EventFilter(FrozenClass):
9672
    '''
9673
    :ivar SelectClauses:
9674
    :vartype SelectClauses: SimpleAttributeOperand
9675
    :ivar WhereClause:
9676
    :vartype WhereClause: ContentFilter
9677
    '''
9678 1
    def __init__(self, binary=None):
9679 1
        if binary is not None:
9680 1
            self._binary_init(binary)
9681 1
            self._freeze()
9682 1
            return
9683 1
        self.SelectClauses = []
9684 1
        self.WhereClause = ContentFilter()
9685 1
        self._freeze()
9686
9687 1
    def to_binary(self):
9688 1
        packet = []
9689 1
        packet.append(uatype_Int32.pack(len(self.SelectClauses)))
9690 1
        for fieldname in self.SelectClauses:
9691 1
            packet.append(fieldname.to_binary())
9692 1
        packet.append(self.WhereClause.to_binary())
9693 1
        return b''.join(packet)
9694
9695 1
    @staticmethod
9696
    def from_binary(data):
9697 1
        return EventFilter(data)
9698
9699 1
    def _binary_init(self, data):
9700 1
        length = uatype_Int32.unpack(data.read(4))[0]
9701 1
        array = []
9702 1
        if length != -1:
9703 1
            for _ in range(0, length):
9704 1
                array.append(SimpleAttributeOperand.from_binary(data))
9705 1
        self.SelectClauses = array
9706 1
        self.WhereClause = ContentFilter.from_binary(data)
9707
9708 1
    def __str__(self):
9709
        return 'EventFilter(' + 'SelectClauses:' + str(self.SelectClauses) + ', ' + \
9710
               'WhereClause:' + str(self.WhereClause) + ')'
9711
9712 1
    __repr__ = __str__
9713
9714
9715 1
class AggregateConfiguration(FrozenClass):
9716
    '''
9717
    :ivar UseServerCapabilitiesDefaults:
9718
    :vartype UseServerCapabilitiesDefaults: Boolean
9719
    :ivar TreatUncertainAsBad:
9720
    :vartype TreatUncertainAsBad: Boolean
9721
    :ivar PercentDataBad:
9722
    :vartype PercentDataBad: Byte
9723
    :ivar PercentDataGood:
9724
    :vartype PercentDataGood: Byte
9725
    :ivar UseSlopedExtrapolation:
9726
    :vartype UseSlopedExtrapolation: Boolean
9727
    '''
9728 1
    def __init__(self, binary=None):
9729
        if binary is not None:
9730
            self._binary_init(binary)
9731
            self._freeze()
9732
            return
9733
        self.UseServerCapabilitiesDefaults = True
9734
        self.TreatUncertainAsBad = True
9735
        self.PercentDataBad = 0
9736
        self.PercentDataGood = 0
9737
        self.UseSlopedExtrapolation = True
9738
        self._freeze()
9739
9740 1
    def to_binary(self):
9741
        packet = []
9742
        packet.append(uatype_Boolean.pack(self.UseServerCapabilitiesDefaults))
9743
        packet.append(uatype_Boolean.pack(self.TreatUncertainAsBad))
9744
        packet.append(uatype_Byte.pack(self.PercentDataBad))
9745
        packet.append(uatype_Byte.pack(self.PercentDataGood))
9746
        packet.append(uatype_Boolean.pack(self.UseSlopedExtrapolation))
9747
        return b''.join(packet)
9748
9749 1
    @staticmethod
9750
    def from_binary(data):
9751
        return AggregateConfiguration(data)
9752
9753 1
    def _binary_init(self, data):
9754
        self.UseServerCapabilitiesDefaults = uatype_Boolean.unpack(data.read(1))[0]
9755
        self.TreatUncertainAsBad = uatype_Boolean.unpack(data.read(1))[0]
9756
        self.PercentDataBad = uatype_Byte.unpack(data.read(1))[0]
9757
        self.PercentDataGood = uatype_Byte.unpack(data.read(1))[0]
9758
        self.UseSlopedExtrapolation = uatype_Boolean.unpack(data.read(1))[0]
9759
9760 1
    def __str__(self):
9761
        return 'AggregateConfiguration(' + 'UseServerCapabilitiesDefaults:' + str(self.UseServerCapabilitiesDefaults) + ', ' + \
9762
               'TreatUncertainAsBad:' + str(self.TreatUncertainAsBad) + ', ' + \
9763
               'PercentDataBad:' + str(self.PercentDataBad) + ', ' + \
9764
               'PercentDataGood:' + str(self.PercentDataGood) + ', ' + \
9765
               'UseSlopedExtrapolation:' + str(self.UseSlopedExtrapolation) + ')'
9766
9767 1
    __repr__ = __str__
9768
9769
9770 1
class AggregateFilter(FrozenClass):
9771
    '''
9772
    :ivar StartTime:
9773
    :vartype StartTime: DateTime
9774
    :ivar AggregateType:
9775
    :vartype AggregateType: NodeId
9776
    :ivar ProcessingInterval:
9777
    :vartype ProcessingInterval: Double
9778
    :ivar AggregateConfiguration:
9779
    :vartype AggregateConfiguration: AggregateConfiguration
9780
    '''
9781 1
    def __init__(self, binary=None):
9782
        if binary is not None:
9783
            self._binary_init(binary)
9784
            self._freeze()
9785
            return
9786
        self.StartTime = datetime.now()
9787
        self.AggregateType = NodeId()
9788
        self.ProcessingInterval = 0
9789
        self.AggregateConfiguration = AggregateConfiguration()
9790
        self._freeze()
9791
9792 1
    def to_binary(self):
9793
        packet = []
9794
        packet.append(pack_datetime(self.StartTime))
9795
        packet.append(self.AggregateType.to_binary())
9796
        packet.append(uatype_Double.pack(self.ProcessingInterval))
9797
        packet.append(self.AggregateConfiguration.to_binary())
9798
        return b''.join(packet)
9799
9800 1
    @staticmethod
9801
    def from_binary(data):
9802
        return AggregateFilter(data)
9803
9804 1
    def _binary_init(self, data):
9805
        self.StartTime = unpack_datetime(data)
9806
        self.AggregateType = NodeId.from_binary(data)
9807
        self.ProcessingInterval = uatype_Double.unpack(data.read(8))[0]
9808
        self.AggregateConfiguration = AggregateConfiguration.from_binary(data)
9809
9810 1
    def __str__(self):
9811
        return 'AggregateFilter(' + 'StartTime:' + str(self.StartTime) + ', ' + \
9812
               'AggregateType:' + str(self.AggregateType) + ', ' + \
9813
               'ProcessingInterval:' + str(self.ProcessingInterval) + ', ' + \
9814
               'AggregateConfiguration:' + str(self.AggregateConfiguration) + ')'
9815
9816 1
    __repr__ = __str__
9817
9818
9819 1
class MonitoringFilterResult(FrozenClass):
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
9820
    '''
9821
    '''
9822 1
    def __init__(self, binary=None):
9823
        if binary is not None:
9824
            self._binary_init(binary)
9825
            self._freeze()
9826
            return
9827
        self._freeze()
9828
9829 1
    def to_binary(self):
9830
        packet = []
9831
        return b''.join(packet)
9832
9833 1
    @staticmethod
9834
    def from_binary(data):
9835
        return MonitoringFilterResult(data)
9836
9837 1
    def _binary_init(self, data):
9838
        pass
9839
9840 1
    def __str__(self):
9841
        return 'MonitoringFilterResult(' +  + ')'
9842
9843 1
    __repr__ = __str__
9844
9845
9846 1
class EventFilterResult(FrozenClass):
9847
    '''
9848
    :ivar SelectClauseResults:
9849
    :vartype SelectClauseResults: StatusCode
9850
    :ivar SelectClauseDiagnosticInfos:
9851
    :vartype SelectClauseDiagnosticInfos: DiagnosticInfo
9852
    :ivar WhereClauseResult:
9853
    :vartype WhereClauseResult: ContentFilterResult
9854
    '''
9855 1
    def __init__(self, binary=None):
9856
        if binary is not None:
9857
            self._binary_init(binary)
9858
            self._freeze()
9859
            return
9860
        self.SelectClauseResults = []
9861
        self.SelectClauseDiagnosticInfos = []
9862
        self.WhereClauseResult = ContentFilterResult()
9863
        self._freeze()
9864
9865 1
    def to_binary(self):
9866
        packet = []
9867
        packet.append(uatype_Int32.pack(len(self.SelectClauseResults)))
9868
        for fieldname in self.SelectClauseResults:
9869
            packet.append(fieldname.to_binary())
9870
        packet.append(uatype_Int32.pack(len(self.SelectClauseDiagnosticInfos)))
9871
        for fieldname in self.SelectClauseDiagnosticInfos:
9872
            packet.append(fieldname.to_binary())
9873
        packet.append(self.WhereClauseResult.to_binary())
9874
        return b''.join(packet)
9875
9876 1
    @staticmethod
9877
    def from_binary(data):
9878
        return EventFilterResult(data)
9879
9880 1
    def _binary_init(self, data):
9881
        length = uatype_Int32.unpack(data.read(4))[0]
9882
        array = []
9883
        if length != -1:
9884
            for _ in range(0, length):
9885
                array.append(StatusCode.from_binary(data))
9886
        self.SelectClauseResults = array
9887
        length = uatype_Int32.unpack(data.read(4))[0]
9888
        array = []
9889
        if length != -1:
9890
            for _ in range(0, length):
9891
                array.append(DiagnosticInfo.from_binary(data))
9892
        self.SelectClauseDiagnosticInfos = array
9893
        self.WhereClauseResult = ContentFilterResult.from_binary(data)
9894
9895 1
    def __str__(self):
9896
        return 'EventFilterResult(' + 'SelectClauseResults:' + str(self.SelectClauseResults) + ', ' + \
9897
               'SelectClauseDiagnosticInfos:' + str(self.SelectClauseDiagnosticInfos) + ', ' + \
9898
               'WhereClauseResult:' + str(self.WhereClauseResult) + ')'
9899
9900 1
    __repr__ = __str__
9901
9902
9903 1
class AggregateFilterResult(FrozenClass):
9904
    '''
9905
    :ivar RevisedStartTime:
9906
    :vartype RevisedStartTime: DateTime
9907
    :ivar RevisedProcessingInterval:
9908
    :vartype RevisedProcessingInterval: Double
9909
    :ivar RevisedAggregateConfiguration:
9910
    :vartype RevisedAggregateConfiguration: AggregateConfiguration
9911
    '''
9912 1
    def __init__(self, binary=None):
9913
        if binary is not None:
9914
            self._binary_init(binary)
9915
            self._freeze()
9916
            return
9917
        self.RevisedStartTime = datetime.now()
9918
        self.RevisedProcessingInterval = 0
9919
        self.RevisedAggregateConfiguration = AggregateConfiguration()
9920
        self._freeze()
9921
9922 1
    def to_binary(self):
9923
        packet = []
9924
        packet.append(pack_datetime(self.RevisedStartTime))
9925
        packet.append(uatype_Double.pack(self.RevisedProcessingInterval))
9926
        packet.append(self.RevisedAggregateConfiguration.to_binary())
9927
        return b''.join(packet)
9928
9929 1
    @staticmethod
9930
    def from_binary(data):
9931
        return AggregateFilterResult(data)
9932
9933 1
    def _binary_init(self, data):
9934
        self.RevisedStartTime = unpack_datetime(data)
9935
        self.RevisedProcessingInterval = uatype_Double.unpack(data.read(8))[0]
9936
        self.RevisedAggregateConfiguration = AggregateConfiguration.from_binary(data)
9937
9938 1
    def __str__(self):
9939
        return 'AggregateFilterResult(' + 'RevisedStartTime:' + str(self.RevisedStartTime) + ', ' + \
9940
               'RevisedProcessingInterval:' + str(self.RevisedProcessingInterval) + ', ' + \
9941
               'RevisedAggregateConfiguration:' + str(self.RevisedAggregateConfiguration) + ')'
9942
9943 1
    __repr__ = __str__
9944
9945
9946 1
class MonitoringParameters(FrozenClass):
9947
    '''
9948
    :ivar ClientHandle:
9949
    :vartype ClientHandle: UInt32
9950
    :ivar SamplingInterval:
9951
    :vartype SamplingInterval: Double
9952
    :ivar Filter:
9953
    :vartype Filter: ExtensionObject
9954
    :ivar QueueSize:
9955
    :vartype QueueSize: UInt32
9956
    :ivar DiscardOldest:
9957
    :vartype DiscardOldest: Boolean
9958
    '''
9959 1
    def __init__(self, binary=None):
9960 1
        if binary is not None:
9961 1
            self._binary_init(binary)
9962 1
            self._freeze()
9963 1
            return
9964 1
        self.ClientHandle = 0
9965 1
        self.SamplingInterval = 0
9966 1
        self.Filter = None
9967 1
        self.QueueSize = 0
9968 1
        self.DiscardOldest = True
9969 1
        self._freeze()
9970
9971 1
    def to_binary(self):
9972 1
        packet = []
9973 1
        packet.append(uatype_UInt32.pack(self.ClientHandle))
9974 1
        packet.append(uatype_Double.pack(self.SamplingInterval))
9975 1
        packet.append(extensionobject_to_binary(self.Filter))
9976 1
        packet.append(uatype_UInt32.pack(self.QueueSize))
9977 1
        packet.append(uatype_Boolean.pack(self.DiscardOldest))
9978 1
        return b''.join(packet)
9979
9980 1
    @staticmethod
9981
    def from_binary(data):
9982 1
        return MonitoringParameters(data)
9983
9984 1
    def _binary_init(self, data):
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
9985 1
        self.ClientHandle = uatype_UInt32.unpack(data.read(4))[0]
9986 1
        self.SamplingInterval = uatype_Double.unpack(data.read(8))[0]
9987 1
        self.Filter = extensionobject_from_binary(data)
9988 1
        self.QueueSize = uatype_UInt32.unpack(data.read(4))[0]
9989 1
        self.DiscardOldest = uatype_Boolean.unpack(data.read(1))[0]
9990
9991 1
    def __str__(self):
9992
        return 'MonitoringParameters(' + 'ClientHandle:' + str(self.ClientHandle) + ', ' + \
9993
               'SamplingInterval:' + str(self.SamplingInterval) + ', ' + \
9994
               'Filter:' + str(self.Filter) + ', ' + \
9995
               'QueueSize:' + str(self.QueueSize) + ', ' + \
9996
               'DiscardOldest:' + str(self.DiscardOldest) + ')'
9997
9998 1
    __repr__ = __str__
9999
10000
10001 1
class MonitoredItemCreateRequest(FrozenClass):
10002
    '''
10003
    :ivar ItemToMonitor:
10004
    :vartype ItemToMonitor: ReadValueId
10005
    :ivar MonitoringMode:
10006
    :vartype MonitoringMode: MonitoringMode
10007
    :ivar RequestedParameters:
10008
    :vartype RequestedParameters: MonitoringParameters
10009
    '''
10010 1
    def __init__(self, binary=None):
10011 1
        if binary is not None:
10012 1
            self._binary_init(binary)
10013 1
            self._freeze()
10014 1
            return
10015 1
        self.ItemToMonitor = ReadValueId()
10016 1
        self.MonitoringMode = 0
10017 1
        self.RequestedParameters = MonitoringParameters()
10018 1
        self._freeze()
10019
10020 1
    def to_binary(self):
10021 1
        packet = []
10022 1
        packet.append(self.ItemToMonitor.to_binary())
10023 1
        packet.append(uatype_UInt32.pack(self.MonitoringMode))
10024 1
        packet.append(self.RequestedParameters.to_binary())
10025 1
        return b''.join(packet)
10026
10027 1
    @staticmethod
10028
    def from_binary(data):
10029 1
        return MonitoredItemCreateRequest(data)
10030
10031 1
    def _binary_init(self, data):
10032 1
        self.ItemToMonitor = ReadValueId.from_binary(data)
10033 1
        self.MonitoringMode = uatype_UInt32.unpack(data.read(4))[0]
10034 1
        self.RequestedParameters = MonitoringParameters.from_binary(data)
10035
10036 1
    def __str__(self):
10037
        return 'MonitoredItemCreateRequest(' + 'ItemToMonitor:' + str(self.ItemToMonitor) + ', ' + \
10038
               'MonitoringMode:' + str(self.MonitoringMode) + ', ' + \
10039
               'RequestedParameters:' + str(self.RequestedParameters) + ')'
10040
10041 1
    __repr__ = __str__
10042
10043
10044 1
class MonitoredItemCreateResult(FrozenClass):
10045
    '''
10046
    :ivar StatusCode:
10047
    :vartype StatusCode: StatusCode
10048
    :ivar MonitoredItemId:
10049
    :vartype MonitoredItemId: UInt32
10050
    :ivar RevisedSamplingInterval:
10051
    :vartype RevisedSamplingInterval: Double
10052
    :ivar RevisedQueueSize:
10053
    :vartype RevisedQueueSize: UInt32
10054
    :ivar FilterResult:
10055
    :vartype FilterResult: ExtensionObject
10056
    '''
10057 1
    def __init__(self, binary=None):
10058 1
        if binary is not None:
10059 1
            self._binary_init(binary)
10060 1
            self._freeze()
10061 1
            return
10062 1
        self.StatusCode = StatusCode()
10063 1
        self.MonitoredItemId = 0
10064 1
        self.RevisedSamplingInterval = 0
10065 1
        self.RevisedQueueSize = 0
10066 1
        self.FilterResult = None
10067 1
        self._freeze()
10068
10069 1
    def to_binary(self):
10070 1
        packet = []
10071 1
        packet.append(self.StatusCode.to_binary())
10072 1
        packet.append(uatype_UInt32.pack(self.MonitoredItemId))
10073 1
        packet.append(uatype_Double.pack(self.RevisedSamplingInterval))
10074 1
        packet.append(uatype_UInt32.pack(self.RevisedQueueSize))
10075 1
        packet.append(extensionobject_to_binary(self.FilterResult))
10076 1
        return b''.join(packet)
10077
10078 1
    @staticmethod
10079
    def from_binary(data):
10080 1
        return MonitoredItemCreateResult(data)
10081
10082 1
    def _binary_init(self, data):
10083 1
        self.StatusCode = StatusCode.from_binary(data)
10084 1
        self.MonitoredItemId = uatype_UInt32.unpack(data.read(4))[0]
10085 1
        self.RevisedSamplingInterval = uatype_Double.unpack(data.read(8))[0]
10086 1
        self.RevisedQueueSize = uatype_UInt32.unpack(data.read(4))[0]
10087 1
        self.FilterResult = extensionobject_from_binary(data)
10088
10089 1
    def __str__(self):
10090
        return 'MonitoredItemCreateResult(' + 'StatusCode:' + str(self.StatusCode) + ', ' + \
10091
               'MonitoredItemId:' + str(self.MonitoredItemId) + ', ' + \
10092
               'RevisedSamplingInterval:' + str(self.RevisedSamplingInterval) + ', ' + \
10093
               'RevisedQueueSize:' + str(self.RevisedQueueSize) + ', ' + \
10094
               'FilterResult:' + str(self.FilterResult) + ')'
10095
10096 1
    __repr__ = __str__
10097
10098
10099 1
class CreateMonitoredItemsParameters(FrozenClass):
10100
    '''
10101
    :ivar SubscriptionId:
10102
    :vartype SubscriptionId: UInt32
10103
    :ivar TimestampsToReturn:
10104
    :vartype TimestampsToReturn: TimestampsToReturn
10105
    :ivar ItemsToCreate:
10106
    :vartype ItemsToCreate: MonitoredItemCreateRequest
10107
    '''
10108 1
    def __init__(self, binary=None):
10109 1
        if binary is not None:
10110 1
            self._binary_init(binary)
10111 1
            self._freeze()
10112 1
            return
10113 1
        self.SubscriptionId = 0
10114 1
        self.TimestampsToReturn = 0
10115 1
        self.ItemsToCreate = []
10116 1
        self._freeze()
10117
10118 1
    def to_binary(self):
10119 1
        packet = []
10120 1
        packet.append(uatype_UInt32.pack(self.SubscriptionId))
10121 1
        packet.append(uatype_UInt32.pack(self.TimestampsToReturn))
10122 1
        packet.append(uatype_Int32.pack(len(self.ItemsToCreate)))
10123 1
        for fieldname in self.ItemsToCreate:
10124 1
            packet.append(fieldname.to_binary())
10125 1
        return b''.join(packet)
10126
10127 1
    @staticmethod
10128
    def from_binary(data):
10129 1
        return CreateMonitoredItemsParameters(data)
10130
10131 1
    def _binary_init(self, data):
10132 1
        self.SubscriptionId = uatype_UInt32.unpack(data.read(4))[0]
10133 1
        self.TimestampsToReturn = uatype_UInt32.unpack(data.read(4))[0]
10134 1
        length = uatype_Int32.unpack(data.read(4))[0]
10135 1
        array = []
10136 1
        if length != -1:
10137 1
            for _ in range(0, length):
10138 1
                array.append(MonitoredItemCreateRequest.from_binary(data))
10139 1
        self.ItemsToCreate = array
10140
10141 1
    def __str__(self):
10142
        return 'CreateMonitoredItemsParameters(' + 'SubscriptionId:' + str(self.SubscriptionId) + ', ' + \
10143
               'TimestampsToReturn:' + str(self.TimestampsToReturn) + ', ' + \
10144
               'ItemsToCreate:' + str(self.ItemsToCreate) + ')'
10145
10146 1
    __repr__ = __str__
10147
10148
10149 1
class CreateMonitoredItemsRequest(FrozenClass):
10150
    '''
10151
    :ivar TypeId:
10152
    :vartype TypeId: NodeId
10153
    :ivar RequestHeader:
10154
    :vartype RequestHeader: RequestHeader
10155
    :ivar Parameters:
10156
    :vartype Parameters: CreateMonitoredItemsParameters
10157
    '''
10158 1
    def __init__(self, binary=None):
10159 1
        if binary is not None:
10160
            self._binary_init(binary)
10161
            self._freeze()
10162
            return
10163 1
        self.TypeId = FourByteNodeId(ObjectIds.CreateMonitoredItemsRequest_Encoding_DefaultBinary)
10164 1
        self.RequestHeader = RequestHeader()
10165 1
        self.Parameters = CreateMonitoredItemsParameters()
10166 1
        self._freeze()
10167
10168 1
    def to_binary(self):
10169 1
        packet = []
10170 1
        packet.append(self.TypeId.to_binary())
10171 1
        packet.append(self.RequestHeader.to_binary())
10172 1
        packet.append(self.Parameters.to_binary())
10173 1
        return b''.join(packet)
10174
10175 1
    @staticmethod
10176
    def from_binary(data):
10177
        return CreateMonitoredItemsRequest(data)
10178
10179 1
    def _binary_init(self, data):
10180
        self.TypeId = NodeId.from_binary(data)
10181
        self.RequestHeader = RequestHeader.from_binary(data)
10182
        self.Parameters = CreateMonitoredItemsParameters.from_binary(data)
10183
10184 1
    def __str__(self):
10185
        return 'CreateMonitoredItemsRequest(' + 'TypeId:' + str(self.TypeId) + ', ' + \
10186
               'RequestHeader:' + str(self.RequestHeader) + ', ' + \
10187
               'Parameters:' + str(self.Parameters) + ')'
10188
10189 1
    __repr__ = __str__
10190
10191
10192 1
class CreateMonitoredItemsResponse(FrozenClass):
10193
    '''
10194
    :ivar TypeId:
10195
    :vartype TypeId: NodeId
10196
    :ivar ResponseHeader:
10197
    :vartype ResponseHeader: ResponseHeader
10198
    :ivar Results:
10199
    :vartype Results: MonitoredItemCreateResult
10200
    :ivar DiagnosticInfos:
10201
    :vartype DiagnosticInfos: DiagnosticInfo
10202
    '''
10203 1
    def __init__(self, binary=None):
10204 1
        if binary is not None:
10205 1
            self._binary_init(binary)
10206 1
            self._freeze()
10207 1
            return
10208 1
        self.TypeId = FourByteNodeId(ObjectIds.CreateMonitoredItemsResponse_Encoding_DefaultBinary)
10209 1
        self.ResponseHeader = ResponseHeader()
10210 1
        self.Results = []
10211 1
        self.DiagnosticInfos = []
10212 1
        self._freeze()
10213
10214 1
    def to_binary(self):
10215 1
        packet = []
10216 1
        packet.append(self.TypeId.to_binary())
10217 1
        packet.append(self.ResponseHeader.to_binary())
10218 1
        packet.append(uatype_Int32.pack(len(self.Results)))
10219 1
        for fieldname in self.Results:
10220 1
            packet.append(fieldname.to_binary())
10221 1
        packet.append(uatype_Int32.pack(len(self.DiagnosticInfos)))
10222 1
        for fieldname in self.DiagnosticInfos:
10223
            packet.append(fieldname.to_binary())
10224 1
        return b''.join(packet)
10225
10226 1
    @staticmethod
10227
    def from_binary(data):
10228 1
        return CreateMonitoredItemsResponse(data)
10229
10230 1
    def _binary_init(self, data):
10231 1
        self.TypeId = NodeId.from_binary(data)
10232 1
        self.ResponseHeader = ResponseHeader.from_binary(data)
10233 1
        length = uatype_Int32.unpack(data.read(4))[0]
10234 1
        array = []
10235 1
        if length != -1:
10236 1
            for _ in range(0, length):
10237 1
                array.append(MonitoredItemCreateResult.from_binary(data))
10238 1
        self.Results = array
10239 1
        length = uatype_Int32.unpack(data.read(4))[0]
10240 1
        array = []
10241 1
        if length != -1:
10242 1
            for _ in range(0, length):
10243
                array.append(DiagnosticInfo.from_binary(data))
10244 1
        self.DiagnosticInfos = array
10245
10246 1
    def __str__(self):
10247
        return 'CreateMonitoredItemsResponse(' + 'TypeId:' + str(self.TypeId) + ', ' + \
10248
               'ResponseHeader:' + str(self.ResponseHeader) + ', ' + \
10249
               'Results:' + str(self.Results) + ', ' + \
10250
               'DiagnosticInfos:' + str(self.DiagnosticInfos) + ')'
10251
10252 1
    __repr__ = __str__
10253
10254
10255 1
class MonitoredItemModifyRequest(FrozenClass):
10256
    '''
10257
    :ivar MonitoredItemId:
10258
    :vartype MonitoredItemId: UInt32
10259
    :ivar RequestedParameters:
10260
    :vartype RequestedParameters: MonitoringParameters
10261
    '''
10262 1
    def __init__(self, binary=None):
10263
        if binary is not None:
10264
            self._binary_init(binary)
10265
            self._freeze()
10266
            return
10267
        self.MonitoredItemId = 0
10268
        self.RequestedParameters = MonitoringParameters()
10269
        self._freeze()
10270
10271 1
    def to_binary(self):
10272
        packet = []
10273
        packet.append(uatype_UInt32.pack(self.MonitoredItemId))
10274
        packet.append(self.RequestedParameters.to_binary())
10275
        return b''.join(packet)
10276
10277 1
    @staticmethod
10278
    def from_binary(data):
10279
        return MonitoredItemModifyRequest(data)
10280
10281 1
    def _binary_init(self, data):
10282
        self.MonitoredItemId = uatype_UInt32.unpack(data.read(4))[0]
10283
        self.RequestedParameters = MonitoringParameters.from_binary(data)
10284
10285 1
    def __str__(self):
10286
        return 'MonitoredItemModifyRequest(' + 'MonitoredItemId:' + str(self.MonitoredItemId) + ', ' + \
10287
               'RequestedParameters:' + str(self.RequestedParameters) + ')'
10288
10289 1
    __repr__ = __str__
10290
10291
10292 1
class MonitoredItemModifyResult(FrozenClass):
10293
    '''
10294
    :ivar StatusCode:
10295
    :vartype StatusCode: StatusCode
10296
    :ivar RevisedSamplingInterval:
10297
    :vartype RevisedSamplingInterval: Double
10298
    :ivar RevisedQueueSize:
10299
    :vartype RevisedQueueSize: UInt32
10300
    :ivar FilterResult:
10301
    :vartype FilterResult: ExtensionObject
10302
    '''
10303 1
    def __init__(self, binary=None):
10304
        if binary is not None:
10305
            self._binary_init(binary)
10306
            self._freeze()
10307
            return
10308
        self.StatusCode = StatusCode()
10309
        self.RevisedSamplingInterval = 0
10310
        self.RevisedQueueSize = 0
10311
        self.FilterResult = None
10312
        self._freeze()
10313
10314 1
    def to_binary(self):
10315
        packet = []
10316
        packet.append(self.StatusCode.to_binary())
10317
        packet.append(uatype_Double.pack(self.RevisedSamplingInterval))
10318
        packet.append(uatype_UInt32.pack(self.RevisedQueueSize))
10319
        packet.append(extensionobject_to_binary(self.FilterResult))
10320
        return b''.join(packet)
10321
10322 1
    @staticmethod
10323
    def from_binary(data):
10324
        return MonitoredItemModifyResult(data)
10325
10326 1
    def _binary_init(self, data):
10327
        self.StatusCode = StatusCode.from_binary(data)
10328
        self.RevisedSamplingInterval = uatype_Double.unpack(data.read(8))[0]
10329
        self.RevisedQueueSize = uatype_UInt32.unpack(data.read(4))[0]
10330
        self.FilterResult = extensionobject_from_binary(data)
10331
10332 1
    def __str__(self):
10333
        return 'MonitoredItemModifyResult(' + 'StatusCode:' + str(self.StatusCode) + ', ' + \
10334
               'RevisedSamplingInterval:' + str(self.RevisedSamplingInterval) + ', ' + \
10335
               'RevisedQueueSize:' + str(self.RevisedQueueSize) + ', ' + \
10336
               'FilterResult:' + str(self.FilterResult) + ')'
10337
10338 1
    __repr__ = __str__
10339
10340
10341 1
class ModifyMonitoredItemsParameters(FrozenClass):
10342
    '''
10343
    :ivar SubscriptionId:
10344
    :vartype SubscriptionId: UInt32
10345
    :ivar TimestampsToReturn:
10346
    :vartype TimestampsToReturn: TimestampsToReturn
10347
    :ivar ItemsToModify:
10348
    :vartype ItemsToModify: MonitoredItemModifyRequest
10349
    '''
10350 1
    def __init__(self, binary=None):
10351
        if binary is not None:
10352
            self._binary_init(binary)
10353
            self._freeze()
10354
            return
10355
        self.SubscriptionId = 0
10356
        self.TimestampsToReturn = 0
10357
        self.ItemsToModify = []
10358
        self._freeze()
10359
10360 1
    def to_binary(self):
10361
        packet = []
10362
        packet.append(uatype_UInt32.pack(self.SubscriptionId))
10363
        packet.append(uatype_UInt32.pack(self.TimestampsToReturn))
10364
        packet.append(uatype_Int32.pack(len(self.ItemsToModify)))
10365
        for fieldname in self.ItemsToModify:
10366
            packet.append(fieldname.to_binary())
10367
        return b''.join(packet)
10368
10369 1
    @staticmethod
10370
    def from_binary(data):
10371
        return ModifyMonitoredItemsParameters(data)
10372
10373 1
    def _binary_init(self, data):
10374
        self.SubscriptionId = uatype_UInt32.unpack(data.read(4))[0]
10375
        self.TimestampsToReturn = uatype_UInt32.unpack(data.read(4))[0]
10376
        length = uatype_Int32.unpack(data.read(4))[0]
10377
        array = []
10378
        if length != -1:
10379
            for _ in range(0, length):
10380
                array.append(MonitoredItemModifyRequest.from_binary(data))
10381
        self.ItemsToModify = array
10382
10383 1
    def __str__(self):
10384
        return 'ModifyMonitoredItemsParameters(' + 'SubscriptionId:' + str(self.SubscriptionId) + ', ' + \
10385
               'TimestampsToReturn:' + str(self.TimestampsToReturn) + ', ' + \
10386
               'ItemsToModify:' + str(self.ItemsToModify) + ')'
10387
10388 1
    __repr__ = __str__
10389
10390
10391 1
class ModifyMonitoredItemsRequest(FrozenClass):
10392
    '''
10393
    :ivar TypeId:
10394
    :vartype TypeId: NodeId
10395
    :ivar RequestHeader:
10396
    :vartype RequestHeader: RequestHeader
10397
    :ivar Parameters:
10398
    :vartype Parameters: ModifyMonitoredItemsParameters
10399
    '''
10400 1
    def __init__(self, binary=None):
10401
        if binary is not None:
10402
            self._binary_init(binary)
10403
            self._freeze()
10404
            return
10405
        self.TypeId = FourByteNodeId(ObjectIds.ModifyMonitoredItemsRequest_Encoding_DefaultBinary)
10406
        self.RequestHeader = RequestHeader()
10407
        self.Parameters = ModifyMonitoredItemsParameters()
10408
        self._freeze()
10409
10410 1
    def to_binary(self):
10411
        packet = []
10412
        packet.append(self.TypeId.to_binary())
10413
        packet.append(self.RequestHeader.to_binary())
10414
        packet.append(self.Parameters.to_binary())
10415
        return b''.join(packet)
10416
10417 1
    @staticmethod
10418
    def from_binary(data):
10419
        return ModifyMonitoredItemsRequest(data)
10420
10421 1
    def _binary_init(self, data):
10422
        self.TypeId = NodeId.from_binary(data)
10423
        self.RequestHeader = RequestHeader.from_binary(data)
10424
        self.Parameters = ModifyMonitoredItemsParameters.from_binary(data)
10425
10426 1
    def __str__(self):
10427
        return 'ModifyMonitoredItemsRequest(' + 'TypeId:' + str(self.TypeId) + ', ' + \
10428
               'RequestHeader:' + str(self.RequestHeader) + ', ' + \
10429
               'Parameters:' + str(self.Parameters) + ')'
10430
10431 1
    __repr__ = __str__
10432
10433
10434 1
class ModifyMonitoredItemsResponse(FrozenClass):
10435
    '''
10436
    :ivar TypeId:
10437
    :vartype TypeId: NodeId
10438
    :ivar ResponseHeader:
10439
    :vartype ResponseHeader: ResponseHeader
10440
    :ivar Results:
10441
    :vartype Results: MonitoredItemModifyResult
10442
    :ivar DiagnosticInfos:
10443
    :vartype DiagnosticInfos: DiagnosticInfo
10444
    '''
10445 1
    def __init__(self, binary=None):
10446
        if binary is not None:
10447
            self._binary_init(binary)
10448
            self._freeze()
10449
            return
10450
        self.TypeId = FourByteNodeId(ObjectIds.ModifyMonitoredItemsResponse_Encoding_DefaultBinary)
10451
        self.ResponseHeader = ResponseHeader()
10452
        self.Results = []
10453
        self.DiagnosticInfos = []
10454
        self._freeze()
10455
10456 1
    def to_binary(self):
10457
        packet = []
10458
        packet.append(self.TypeId.to_binary())
10459
        packet.append(self.ResponseHeader.to_binary())
10460
        packet.append(uatype_Int32.pack(len(self.Results)))
10461
        for fieldname in self.Results:
10462
            packet.append(fieldname.to_binary())
10463
        packet.append(uatype_Int32.pack(len(self.DiagnosticInfos)))
10464
        for fieldname in self.DiagnosticInfos:
10465
            packet.append(fieldname.to_binary())
10466
        return b''.join(packet)
10467
10468 1
    @staticmethod
10469
    def from_binary(data):
10470
        return ModifyMonitoredItemsResponse(data)
10471
10472 1
    def _binary_init(self, data):
10473
        self.TypeId = NodeId.from_binary(data)
10474
        self.ResponseHeader = ResponseHeader.from_binary(data)
10475
        length = uatype_Int32.unpack(data.read(4))[0]
10476
        array = []
10477
        if length != -1:
10478
            for _ in range(0, length):
10479
                array.append(MonitoredItemModifyResult.from_binary(data))
10480
        self.Results = array
10481
        length = uatype_Int32.unpack(data.read(4))[0]
10482
        array = []
10483
        if length != -1:
10484
            for _ in range(0, length):
10485
                array.append(DiagnosticInfo.from_binary(data))
10486
        self.DiagnosticInfos = array
10487
10488 1
    def __str__(self):
10489
        return 'ModifyMonitoredItemsResponse(' + 'TypeId:' + str(self.TypeId) + ', ' + \
10490
               'ResponseHeader:' + str(self.ResponseHeader) + ', ' + \
10491
               'Results:' + str(self.Results) + ', ' + \
10492
               'DiagnosticInfos:' + str(self.DiagnosticInfos) + ')'
10493
10494 1
    __repr__ = __str__
10495
10496
10497 1
class SetMonitoringModeParameters(FrozenClass):
10498
    '''
10499
    :ivar SubscriptionId:
10500
    :vartype SubscriptionId: UInt32
10501
    :ivar MonitoringMode:
10502
    :vartype MonitoringMode: MonitoringMode
10503
    :ivar MonitoredItemIds:
10504
    :vartype MonitoredItemIds: UInt32
10505
    '''
10506 1
    def __init__(self, binary=None):
10507
        if binary is not None:
10508
            self._binary_init(binary)
10509
            self._freeze()
10510
            return
10511
        self.SubscriptionId = 0
10512
        self.MonitoringMode = 0
10513
        self.MonitoredItemIds = []
10514
        self._freeze()
10515
10516 1
    def to_binary(self):
10517
        packet = []
10518
        packet.append(uatype_UInt32.pack(self.SubscriptionId))
10519
        packet.append(uatype_UInt32.pack(self.MonitoringMode))
10520
        packet.append(uatype_Int32.pack(len(self.MonitoredItemIds)))
10521
        for fieldname in self.MonitoredItemIds:
10522
            packet.append(uatype_UInt32.pack(fieldname))
10523
        return b''.join(packet)
10524
10525 1
    @staticmethod
10526
    def from_binary(data):
10527
        return SetMonitoringModeParameters(data)
10528
10529 1
    def _binary_init(self, data):
10530
        self.SubscriptionId = uatype_UInt32.unpack(data.read(4))[0]
10531
        self.MonitoringMode = uatype_UInt32.unpack(data.read(4))[0]
10532
        self.MonitoredItemIds = unpack_uatype_array('UInt32', data)
10533
10534 1
    def __str__(self):
10535
        return 'SetMonitoringModeParameters(' + 'SubscriptionId:' + str(self.SubscriptionId) + ', ' + \
10536
               'MonitoringMode:' + str(self.MonitoringMode) + ', ' + \
10537
               'MonitoredItemIds:' + str(self.MonitoredItemIds) + ')'
10538
10539 1
    __repr__ = __str__
10540
10541
10542 1
class SetMonitoringModeRequest(FrozenClass):
10543
    '''
10544
    :ivar TypeId:
10545
    :vartype TypeId: NodeId
10546
    :ivar RequestHeader:
10547
    :vartype RequestHeader: RequestHeader
10548
    :ivar Parameters:
10549
    :vartype Parameters: SetMonitoringModeParameters
10550
    '''
10551 1
    def __init__(self, binary=None):
10552
        if binary is not None:
10553
            self._binary_init(binary)
10554
            self._freeze()
10555
            return
10556
        self.TypeId = FourByteNodeId(ObjectIds.SetMonitoringModeRequest_Encoding_DefaultBinary)
10557
        self.RequestHeader = RequestHeader()
10558
        self.Parameters = SetMonitoringModeParameters()
10559
        self._freeze()
10560
10561 1
    def to_binary(self):
10562
        packet = []
10563
        packet.append(self.TypeId.to_binary())
10564
        packet.append(self.RequestHeader.to_binary())
10565
        packet.append(self.Parameters.to_binary())
10566
        return b''.join(packet)
10567
10568 1
    @staticmethod
10569
    def from_binary(data):
10570
        return SetMonitoringModeRequest(data)
10571
10572 1
    def _binary_init(self, data):
10573
        self.TypeId = NodeId.from_binary(data)
10574
        self.RequestHeader = RequestHeader.from_binary(data)
10575
        self.Parameters = SetMonitoringModeParameters.from_binary(data)
10576
10577 1
    def __str__(self):
10578
        return 'SetMonitoringModeRequest(' + 'TypeId:' + str(self.TypeId) + ', ' + \
10579
               'RequestHeader:' + str(self.RequestHeader) + ', ' + \
10580
               'Parameters:' + str(self.Parameters) + ')'
10581
10582 1
    __repr__ = __str__
10583
10584
10585 1
class SetMonitoringModeResult(FrozenClass):
10586
    '''
10587
    :ivar Results:
10588
    :vartype Results: StatusCode
10589
    :ivar DiagnosticInfos:
10590
    :vartype DiagnosticInfos: DiagnosticInfo
10591
    '''
10592 1
    def __init__(self, binary=None):
10593
        if binary is not None:
10594
            self._binary_init(binary)
10595
            self._freeze()
10596
            return
10597
        self.Results = []
10598
        self.DiagnosticInfos = []
10599
        self._freeze()
10600
10601 1
    def to_binary(self):
10602
        packet = []
10603
        packet.append(uatype_Int32.pack(len(self.Results)))
10604
        for fieldname in self.Results:
10605
            packet.append(fieldname.to_binary())
10606
        packet.append(uatype_Int32.pack(len(self.DiagnosticInfos)))
10607
        for fieldname in self.DiagnosticInfos:
10608
            packet.append(fieldname.to_binary())
10609
        return b''.join(packet)
10610
10611 1
    @staticmethod
10612
    def from_binary(data):
10613
        return SetMonitoringModeResult(data)
10614
10615 1
    def _binary_init(self, data):
10616
        length = uatype_Int32.unpack(data.read(4))[0]
10617
        array = []
10618
        if length != -1:
10619
            for _ in range(0, length):
10620
                array.append(StatusCode.from_binary(data))
10621
        self.Results = array
10622
        length = uatype_Int32.unpack(data.read(4))[0]
10623
        array = []
10624
        if length != -1:
10625
            for _ in range(0, length):
10626
                array.append(DiagnosticInfo.from_binary(data))
10627
        self.DiagnosticInfos = array
10628
10629 1
    def __str__(self):
10630
        return 'SetMonitoringModeResult(' + 'Results:' + str(self.Results) + ', ' + \
10631
               'DiagnosticInfos:' + str(self.DiagnosticInfos) + ')'
10632
10633 1
    __repr__ = __str__
10634
10635
10636 1
class SetMonitoringModeResponse(FrozenClass):
10637
    '''
10638
    :ivar TypeId:
10639
    :vartype TypeId: NodeId
10640
    :ivar ResponseHeader:
10641
    :vartype ResponseHeader: ResponseHeader
10642
    :ivar Parameters:
10643
    :vartype Parameters: SetMonitoringModeResult
10644
    '''
10645 1
    def __init__(self, binary=None):
10646
        if binary is not None:
10647
            self._binary_init(binary)
10648
            self._freeze()
10649
            return
10650
        self.TypeId = FourByteNodeId(ObjectIds.SetMonitoringModeResponse_Encoding_DefaultBinary)
10651
        self.ResponseHeader = ResponseHeader()
10652
        self.Parameters = SetMonitoringModeResult()
10653
        self._freeze()
10654
10655 1
    def to_binary(self):
10656
        packet = []
10657
        packet.append(self.TypeId.to_binary())
10658
        packet.append(self.ResponseHeader.to_binary())
10659
        packet.append(self.Parameters.to_binary())
10660
        return b''.join(packet)
10661
10662 1
    @staticmethod
10663
    def from_binary(data):
10664
        return SetMonitoringModeResponse(data)
10665
10666 1
    def _binary_init(self, data):
10667
        self.TypeId = NodeId.from_binary(data)
10668
        self.ResponseHeader = ResponseHeader.from_binary(data)
10669
        self.Parameters = SetMonitoringModeResult.from_binary(data)
10670
10671 1
    def __str__(self):
10672
        return 'SetMonitoringModeResponse(' + 'TypeId:' + str(self.TypeId) + ', ' + \
10673
               'ResponseHeader:' + str(self.ResponseHeader) + ', ' + \
10674
               'Parameters:' + str(self.Parameters) + ')'
10675
10676 1
    __repr__ = __str__
10677
10678
10679 1
class SetTriggeringParameters(FrozenClass):
10680
    '''
10681
    :ivar SubscriptionId:
10682
    :vartype SubscriptionId: UInt32
10683
    :ivar TriggeringItemId:
10684
    :vartype TriggeringItemId: UInt32
10685
    :ivar LinksToAdd:
10686
    :vartype LinksToAdd: UInt32
10687
    :ivar LinksToRemove:
10688
    :vartype LinksToRemove: UInt32
10689
    '''
10690 1
    def __init__(self, binary=None):
10691
        if binary is not None:
10692
            self._binary_init(binary)
10693
            self._freeze()
10694
            return
10695
        self.SubscriptionId = 0
10696
        self.TriggeringItemId = 0
10697
        self.LinksToAdd = []
10698
        self.LinksToRemove = []
10699
        self._freeze()
10700
10701 1
    def to_binary(self):
10702
        packet = []
10703
        packet.append(uatype_UInt32.pack(self.SubscriptionId))
10704
        packet.append(uatype_UInt32.pack(self.TriggeringItemId))
10705
        packet.append(uatype_Int32.pack(len(self.LinksToAdd)))
10706
        for fieldname in self.LinksToAdd:
10707
            packet.append(uatype_UInt32.pack(fieldname))
10708
        packet.append(uatype_Int32.pack(len(self.LinksToRemove)))
10709
        for fieldname in self.LinksToRemove:
10710
            packet.append(uatype_UInt32.pack(fieldname))
10711
        return b''.join(packet)
10712
10713 1
    @staticmethod
10714
    def from_binary(data):
10715
        return SetTriggeringParameters(data)
10716
10717 1
    def _binary_init(self, data):
10718
        self.SubscriptionId = uatype_UInt32.unpack(data.read(4))[0]
10719
        self.TriggeringItemId = uatype_UInt32.unpack(data.read(4))[0]
10720
        self.LinksToAdd = unpack_uatype_array('UInt32', data)
10721
        self.LinksToRemove = unpack_uatype_array('UInt32', data)
10722
10723 1
    def __str__(self):
10724
        return 'SetTriggeringParameters(' + 'SubscriptionId:' + str(self.SubscriptionId) + ', ' + \
10725
               'TriggeringItemId:' + str(self.TriggeringItemId) + ', ' + \
10726
               'LinksToAdd:' + str(self.LinksToAdd) + ', ' + \
10727
               'LinksToRemove:' + str(self.LinksToRemove) + ')'
10728
10729 1
    __repr__ = __str__
10730
10731
10732 1
class SetTriggeringRequest(FrozenClass):
10733
    '''
10734
    :ivar TypeId:
10735
    :vartype TypeId: NodeId
10736
    :ivar RequestHeader:
10737
    :vartype RequestHeader: RequestHeader
10738
    :ivar Parameters:
10739
    :vartype Parameters: SetTriggeringParameters
10740
    '''
10741 1
    def __init__(self, binary=None):
10742
        if binary is not None:
10743
            self._binary_init(binary)
10744
            self._freeze()
10745
            return
10746
        self.TypeId = FourByteNodeId(ObjectIds.SetTriggeringRequest_Encoding_DefaultBinary)
10747
        self.RequestHeader = RequestHeader()
10748
        self.Parameters = SetTriggeringParameters()
10749
        self._freeze()
10750
10751 1
    def to_binary(self):
10752
        packet = []
10753
        packet.append(self.TypeId.to_binary())
10754
        packet.append(self.RequestHeader.to_binary())
10755
        packet.append(self.Parameters.to_binary())
10756
        return b''.join(packet)
10757
10758 1
    @staticmethod
10759
    def from_binary(data):
10760
        return SetTriggeringRequest(data)
10761
10762 1
    def _binary_init(self, data):
10763
        self.TypeId = NodeId.from_binary(data)
10764
        self.RequestHeader = RequestHeader.from_binary(data)
10765
        self.Parameters = SetTriggeringParameters.from_binary(data)
10766
10767 1
    def __str__(self):
10768
        return 'SetTriggeringRequest(' + 'TypeId:' + str(self.TypeId) + ', ' + \
10769
               'RequestHeader:' + str(self.RequestHeader) + ', ' + \
10770
               'Parameters:' + str(self.Parameters) + ')'
10771
10772 1
    __repr__ = __str__
10773
10774
10775 1
class SetTriggeringResult(FrozenClass):
10776
    '''
10777
    :ivar AddResults:
10778
    :vartype AddResults: StatusCode
10779
    :ivar AddDiagnosticInfos:
10780
    :vartype AddDiagnosticInfos: DiagnosticInfo
10781
    :ivar RemoveResults:
10782
    :vartype RemoveResults: StatusCode
10783
    :ivar RemoveDiagnosticInfos:
10784
    :vartype RemoveDiagnosticInfos: DiagnosticInfo
10785
    '''
10786 1
    def __init__(self, binary=None):
10787
        if binary is not None:
10788
            self._binary_init(binary)
10789
            self._freeze()
10790
            return
10791
        self.AddResults = []
10792
        self.AddDiagnosticInfos = []
10793
        self.RemoveResults = []
10794
        self.RemoveDiagnosticInfos = []
10795
        self._freeze()
10796
10797 1
    def to_binary(self):
10798
        packet = []
10799
        packet.append(uatype_Int32.pack(len(self.AddResults)))
10800
        for fieldname in self.AddResults:
10801
            packet.append(fieldname.to_binary())
10802
        packet.append(uatype_Int32.pack(len(self.AddDiagnosticInfos)))
10803
        for fieldname in self.AddDiagnosticInfos:
10804
            packet.append(fieldname.to_binary())
10805
        packet.append(uatype_Int32.pack(len(self.RemoveResults)))
10806
        for fieldname in self.RemoveResults:
10807
            packet.append(fieldname.to_binary())
10808
        packet.append(uatype_Int32.pack(len(self.RemoveDiagnosticInfos)))
10809
        for fieldname in self.RemoveDiagnosticInfos:
10810
            packet.append(fieldname.to_binary())
10811
        return b''.join(packet)
10812
10813 1
    @staticmethod
10814
    def from_binary(data):
10815
        return SetTriggeringResult(data)
10816
10817 1
    def _binary_init(self, data):
10818
        length = uatype_Int32.unpack(data.read(4))[0]
10819
        array = []
10820
        if length != -1:
10821
            for _ in range(0, length):
10822
                array.append(StatusCode.from_binary(data))
10823
        self.AddResults = array
10824
        length = uatype_Int32.unpack(data.read(4))[0]
10825
        array = []
10826
        if length != -1:
10827
            for _ in range(0, length):
10828
                array.append(DiagnosticInfo.from_binary(data))
10829
        self.AddDiagnosticInfos = array
10830
        length = uatype_Int32.unpack(data.read(4))[0]
10831
        array = []
10832
        if length != -1:
10833
            for _ in range(0, length):
10834
                array.append(StatusCode.from_binary(data))
10835
        self.RemoveResults = array
10836
        length = uatype_Int32.unpack(data.read(4))[0]
10837
        array = []
10838
        if length != -1:
10839
            for _ in range(0, length):
10840
                array.append(DiagnosticInfo.from_binary(data))
10841
        self.RemoveDiagnosticInfos = array
10842
10843 1
    def __str__(self):
10844
        return 'SetTriggeringResult(' + 'AddResults:' + str(self.AddResults) + ', ' + \
10845
               'AddDiagnosticInfos:' + str(self.AddDiagnosticInfos) + ', ' + \
10846
               'RemoveResults:' + str(self.RemoveResults) + ', ' + \
10847
               'RemoveDiagnosticInfos:' + str(self.RemoveDiagnosticInfos) + ')'
10848
10849 1
    __repr__ = __str__
10850
10851
10852 1
class SetTriggeringResponse(FrozenClass):
10853
    '''
10854
    :ivar TypeId:
10855
    :vartype TypeId: NodeId
10856
    :ivar ResponseHeader:
10857
    :vartype ResponseHeader: ResponseHeader
10858
    :ivar Parameters:
10859
    :vartype Parameters: SetTriggeringResult
10860
    '''
10861 1
    def __init__(self, binary=None):
10862
        if binary is not None:
10863
            self._binary_init(binary)
10864
            self._freeze()
10865
            return
10866
        self.TypeId = FourByteNodeId(ObjectIds.SetTriggeringResponse_Encoding_DefaultBinary)
10867
        self.ResponseHeader = ResponseHeader()
10868
        self.Parameters = SetTriggeringResult()
10869
        self._freeze()
10870
10871 1
    def to_binary(self):
10872
        packet = []
10873
        packet.append(self.TypeId.to_binary())
10874
        packet.append(self.ResponseHeader.to_binary())
10875
        packet.append(self.Parameters.to_binary())
10876
        return b''.join(packet)
10877
10878 1
    @staticmethod
10879
    def from_binary(data):
10880
        return SetTriggeringResponse(data)
10881
10882 1
    def _binary_init(self, data):
10883
        self.TypeId = NodeId.from_binary(data)
10884
        self.ResponseHeader = ResponseHeader.from_binary(data)
10885
        self.Parameters = SetTriggeringResult.from_binary(data)
10886
10887 1
    def __str__(self):
10888
        return 'SetTriggeringResponse(' + 'TypeId:' + str(self.TypeId) + ', ' + \
10889
               'ResponseHeader:' + str(self.ResponseHeader) + ', ' + \
10890
               'Parameters:' + str(self.Parameters) + ')'
10891
10892 1
    __repr__ = __str__
10893
10894
10895 1
class DeleteMonitoredItemsParameters(FrozenClass):
10896
    '''
10897
    :ivar SubscriptionId:
10898
    :vartype SubscriptionId: UInt32
10899
    :ivar MonitoredItemIds:
10900
    :vartype MonitoredItemIds: UInt32
10901
    '''
10902 1
    def __init__(self, binary=None):
10903 1
        if binary is not None:
10904 1
            self._binary_init(binary)
10905 1
            self._freeze()
10906 1
            return
10907 1
        self.SubscriptionId = 0
10908 1
        self.MonitoredItemIds = []
10909 1
        self._freeze()
10910
10911 1
    def to_binary(self):
10912 1
        packet = []
10913 1
        packet.append(uatype_UInt32.pack(self.SubscriptionId))
10914 1
        packet.append(uatype_Int32.pack(len(self.MonitoredItemIds)))
10915 1
        for fieldname in self.MonitoredItemIds:
10916 1
            packet.append(uatype_UInt32.pack(fieldname))
10917 1
        return b''.join(packet)
10918
10919 1
    @staticmethod
10920
    def from_binary(data):
10921 1
        return DeleteMonitoredItemsParameters(data)
10922
10923 1
    def _binary_init(self, data):
10924 1
        self.SubscriptionId = uatype_UInt32.unpack(data.read(4))[0]
10925 1
        self.MonitoredItemIds = unpack_uatype_array('UInt32', data)
10926
10927 1
    def __str__(self):
10928
        return 'DeleteMonitoredItemsParameters(' + 'SubscriptionId:' + str(self.SubscriptionId) + ', ' + \
10929
               'MonitoredItemIds:' + str(self.MonitoredItemIds) + ')'
10930
10931 1
    __repr__ = __str__
10932
10933
10934 1
class DeleteMonitoredItemsRequest(FrozenClass):
10935
    '''
10936
    :ivar TypeId:
10937
    :vartype TypeId: NodeId
10938
    :ivar RequestHeader:
10939
    :vartype RequestHeader: RequestHeader
10940
    :ivar Parameters:
10941
    :vartype Parameters: DeleteMonitoredItemsParameters
10942
    '''
10943 1
    def __init__(self, binary=None):
10944 1
        if binary is not None:
10945
            self._binary_init(binary)
10946
            self._freeze()
10947
            return
10948 1
        self.TypeId = FourByteNodeId(ObjectIds.DeleteMonitoredItemsRequest_Encoding_DefaultBinary)
10949 1
        self.RequestHeader = RequestHeader()
10950 1
        self.Parameters = DeleteMonitoredItemsParameters()
10951 1
        self._freeze()
10952
10953 1
    def to_binary(self):
10954 1
        packet = []
10955 1
        packet.append(self.TypeId.to_binary())
10956 1
        packet.append(self.RequestHeader.to_binary())
10957 1
        packet.append(self.Parameters.to_binary())
10958 1
        return b''.join(packet)
10959
10960 1
    @staticmethod
10961
    def from_binary(data):
10962
        return DeleteMonitoredItemsRequest(data)
10963
10964 1
    def _binary_init(self, data):
10965
        self.TypeId = NodeId.from_binary(data)
10966
        self.RequestHeader = RequestHeader.from_binary(data)
10967
        self.Parameters = DeleteMonitoredItemsParameters.from_binary(data)
10968
10969 1
    def __str__(self):
10970
        return 'DeleteMonitoredItemsRequest(' + 'TypeId:' + str(self.TypeId) + ', ' + \
10971
               'RequestHeader:' + str(self.RequestHeader) + ', ' + \
10972
               'Parameters:' + str(self.Parameters) + ')'
10973
10974 1
    __repr__ = __str__
10975
10976
10977 1
class DeleteMonitoredItemsResponse(FrozenClass):
10978
    '''
10979
    :ivar TypeId:
10980
    :vartype TypeId: NodeId
10981
    :ivar ResponseHeader:
10982
    :vartype ResponseHeader: ResponseHeader
10983
    :ivar Results:
10984
    :vartype Results: StatusCode
10985
    :ivar DiagnosticInfos:
10986
    :vartype DiagnosticInfos: DiagnosticInfo
10987
    '''
10988 1
    def __init__(self, binary=None):
10989 1
        if binary is not None:
10990 1
            self._binary_init(binary)
10991 1
            self._freeze()
10992 1
            return
10993 1
        self.TypeId = FourByteNodeId(ObjectIds.DeleteMonitoredItemsResponse_Encoding_DefaultBinary)
10994 1
        self.ResponseHeader = ResponseHeader()
10995 1
        self.Results = []
10996 1
        self.DiagnosticInfos = []
10997 1
        self._freeze()
10998
10999 1
    def to_binary(self):
11000 1
        packet = []
11001 1
        packet.append(self.TypeId.to_binary())
11002 1
        packet.append(self.ResponseHeader.to_binary())
11003 1
        packet.append(uatype_Int32.pack(len(self.Results)))
11004 1
        for fieldname in self.Results:
11005 1
            packet.append(fieldname.to_binary())
11006 1
        packet.append(uatype_Int32.pack(len(self.DiagnosticInfos)))
11007 1
        for fieldname in self.DiagnosticInfos:
11008
            packet.append(fieldname.to_binary())
11009 1
        return b''.join(packet)
11010
11011 1
    @staticmethod
11012
    def from_binary(data):
11013 1
        return DeleteMonitoredItemsResponse(data)
11014
11015 1
    def _binary_init(self, data):
11016 1
        self.TypeId = NodeId.from_binary(data)
11017 1
        self.ResponseHeader = ResponseHeader.from_binary(data)
11018 1
        length = uatype_Int32.unpack(data.read(4))[0]
11019 1
        array = []
11020 1
        if length != -1:
11021 1
            for _ in range(0, length):
11022 1
                array.append(StatusCode.from_binary(data))
11023 1
        self.Results = array
11024 1
        length = uatype_Int32.unpack(data.read(4))[0]
11025 1
        array = []
11026 1
        if length != -1:
11027 1
            for _ in range(0, length):
11028
                array.append(DiagnosticInfo.from_binary(data))
11029 1
        self.DiagnosticInfos = array
11030
11031 1
    def __str__(self):
11032
        return 'DeleteMonitoredItemsResponse(' + 'TypeId:' + str(self.TypeId) + ', ' + \
11033
               'ResponseHeader:' + str(self.ResponseHeader) + ', ' + \
11034
               'Results:' + str(self.Results) + ', ' + \
11035
               'DiagnosticInfos:' + str(self.DiagnosticInfos) + ')'
11036
11037 1
    __repr__ = __str__
11038
11039
11040 1
class CreateSubscriptionParameters(FrozenClass):
11041
    '''
11042
    :ivar RequestedPublishingInterval:
11043
    :vartype RequestedPublishingInterval: Double
11044
    :ivar RequestedLifetimeCount:
11045
    :vartype RequestedLifetimeCount: UInt32
11046
    :ivar RequestedMaxKeepAliveCount:
11047
    :vartype RequestedMaxKeepAliveCount: UInt32
11048
    :ivar MaxNotificationsPerPublish:
11049
    :vartype MaxNotificationsPerPublish: UInt32
11050
    :ivar PublishingEnabled:
11051
    :vartype PublishingEnabled: Boolean
11052
    :ivar Priority:
11053
    :vartype Priority: Byte
11054
    '''
11055 1
    def __init__(self, binary=None):
11056 1
        if binary is not None:
11057 1
            self._binary_init(binary)
11058 1
            self._freeze()
11059 1
            return
11060 1
        self.RequestedPublishingInterval = 0
11061 1
        self.RequestedLifetimeCount = 0
11062 1
        self.RequestedMaxKeepAliveCount = 0
11063 1
        self.MaxNotificationsPerPublish = 0
11064 1
        self.PublishingEnabled = True
11065 1
        self.Priority = 0
11066 1
        self._freeze()
11067
11068 1
    def to_binary(self):
11069 1
        packet = []
11070 1
        packet.append(uatype_Double.pack(self.RequestedPublishingInterval))
11071 1
        packet.append(uatype_UInt32.pack(self.RequestedLifetimeCount))
11072 1
        packet.append(uatype_UInt32.pack(self.RequestedMaxKeepAliveCount))
11073 1
        packet.append(uatype_UInt32.pack(self.MaxNotificationsPerPublish))
11074 1
        packet.append(uatype_Boolean.pack(self.PublishingEnabled))
11075 1
        packet.append(uatype_Byte.pack(self.Priority))
11076 1
        return b''.join(packet)
11077
11078 1
    @staticmethod
11079
    def from_binary(data):
11080 1
        return CreateSubscriptionParameters(data)
11081
11082 1
    def _binary_init(self, data):
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
11083 1
        self.RequestedPublishingInterval = uatype_Double.unpack(data.read(8))[0]
11084 1
        self.RequestedLifetimeCount = uatype_UInt32.unpack(data.read(4))[0]
11085 1
        self.RequestedMaxKeepAliveCount = uatype_UInt32.unpack(data.read(4))[0]
11086 1
        self.MaxNotificationsPerPublish = uatype_UInt32.unpack(data.read(4))[0]
11087 1
        self.PublishingEnabled = uatype_Boolean.unpack(data.read(1))[0]
11088 1
        self.Priority = uatype_Byte.unpack(data.read(1))[0]
11089
11090 1
    def __str__(self):
11091
        return 'CreateSubscriptionParameters(' + 'RequestedPublishingInterval:' + str(self.RequestedPublishingInterval) + ', ' + \
11092
               'RequestedLifetimeCount:' + str(self.RequestedLifetimeCount) + ', ' + \
11093
               'RequestedMaxKeepAliveCount:' + str(self.RequestedMaxKeepAliveCount) + ', ' + \
11094
               'MaxNotificationsPerPublish:' + str(self.MaxNotificationsPerPublish) + ', ' + \
11095
               'PublishingEnabled:' + str(self.PublishingEnabled) + ', ' + \
11096
               'Priority:' + str(self.Priority) + ')'
11097
11098 1
    __repr__ = __str__
11099
11100
11101 1
class CreateSubscriptionRequest(FrozenClass):
11102
    '''
11103
    :ivar TypeId:
11104
    :vartype TypeId: NodeId
11105
    :ivar RequestHeader:
11106
    :vartype RequestHeader: RequestHeader
11107
    :ivar Parameters:
11108
    :vartype Parameters: CreateSubscriptionParameters
11109
    '''
11110 1
    def __init__(self, binary=None):
11111 1
        if binary is not None:
11112
            self._binary_init(binary)
11113
            self._freeze()
11114
            return
11115 1
        self.TypeId = FourByteNodeId(ObjectIds.CreateSubscriptionRequest_Encoding_DefaultBinary)
11116 1
        self.RequestHeader = RequestHeader()
11117 1
        self.Parameters = CreateSubscriptionParameters()
11118 1
        self._freeze()
11119
11120 1
    def to_binary(self):
11121 1
        packet = []
11122 1
        packet.append(self.TypeId.to_binary())
11123 1
        packet.append(self.RequestHeader.to_binary())
11124 1
        packet.append(self.Parameters.to_binary())
11125 1
        return b''.join(packet)
11126
11127 1
    @staticmethod
11128
    def from_binary(data):
11129
        return CreateSubscriptionRequest(data)
11130
11131 1
    def _binary_init(self, data):
11132
        self.TypeId = NodeId.from_binary(data)
11133
        self.RequestHeader = RequestHeader.from_binary(data)
11134
        self.Parameters = CreateSubscriptionParameters.from_binary(data)
11135
11136 1
    def __str__(self):
11137
        return 'CreateSubscriptionRequest(' + 'TypeId:' + str(self.TypeId) + ', ' + \
11138
               'RequestHeader:' + str(self.RequestHeader) + ', ' + \
11139
               'Parameters:' + str(self.Parameters) + ')'
11140
11141 1
    __repr__ = __str__
11142
11143
11144 1
class CreateSubscriptionResult(FrozenClass):
11145
    '''
11146
    :ivar SubscriptionId:
11147
    :vartype SubscriptionId: UInt32
11148
    :ivar RevisedPublishingInterval:
11149
    :vartype RevisedPublishingInterval: Double
11150
    :ivar RevisedLifetimeCount:
11151
    :vartype RevisedLifetimeCount: UInt32
11152
    :ivar RevisedMaxKeepAliveCount:
11153
    :vartype RevisedMaxKeepAliveCount: UInt32
11154
    '''
11155 1
    def __init__(self, binary=None):
11156 1
        if binary is not None:
11157 1
            self._binary_init(binary)
11158 1
            self._freeze()
11159 1
            return
11160 1
        self.SubscriptionId = 0
11161 1
        self.RevisedPublishingInterval = 0
11162 1
        self.RevisedLifetimeCount = 0
11163 1
        self.RevisedMaxKeepAliveCount = 0
11164 1
        self._freeze()
11165
11166 1
    def to_binary(self):
11167 1
        packet = []
11168 1
        packet.append(uatype_UInt32.pack(self.SubscriptionId))
11169 1
        packet.append(uatype_Double.pack(self.RevisedPublishingInterval))
11170 1
        packet.append(uatype_UInt32.pack(self.RevisedLifetimeCount))
11171 1
        packet.append(uatype_UInt32.pack(self.RevisedMaxKeepAliveCount))
11172 1
        return b''.join(packet)
11173
11174 1
    @staticmethod
11175
    def from_binary(data):
11176 1
        return CreateSubscriptionResult(data)
11177
11178 1
    def _binary_init(self, data):
11179 1
        self.SubscriptionId = uatype_UInt32.unpack(data.read(4))[0]
11180 1
        self.RevisedPublishingInterval = uatype_Double.unpack(data.read(8))[0]
11181 1
        self.RevisedLifetimeCount = uatype_UInt32.unpack(data.read(4))[0]
11182 1
        self.RevisedMaxKeepAliveCount = uatype_UInt32.unpack(data.read(4))[0]
11183
11184 1
    def __str__(self):
11185
        return 'CreateSubscriptionResult(' + 'SubscriptionId:' + str(self.SubscriptionId) + ', ' + \
11186
               'RevisedPublishingInterval:' + str(self.RevisedPublishingInterval) + ', ' + \
11187
               'RevisedLifetimeCount:' + str(self.RevisedLifetimeCount) + ', ' + \
11188
               'RevisedMaxKeepAliveCount:' + str(self.RevisedMaxKeepAliveCount) + ')'
11189
11190 1
    __repr__ = __str__
11191
11192
11193 1
class CreateSubscriptionResponse(FrozenClass):
11194
    '''
11195
    :ivar TypeId:
11196
    :vartype TypeId: NodeId
11197
    :ivar ResponseHeader:
11198
    :vartype ResponseHeader: ResponseHeader
11199
    :ivar Parameters:
11200
    :vartype Parameters: CreateSubscriptionResult
11201
    '''
11202 1
    def __init__(self, binary=None):
11203 1
        if binary is not None:
11204 1
            self._binary_init(binary)
11205 1
            self._freeze()
11206 1
            return
11207 1
        self.TypeId = FourByteNodeId(ObjectIds.CreateSubscriptionResponse_Encoding_DefaultBinary)
11208 1
        self.ResponseHeader = ResponseHeader()
11209 1
        self.Parameters = CreateSubscriptionResult()
11210 1
        self._freeze()
11211
11212 1
    def to_binary(self):
11213 1
        packet = []
11214 1
        packet.append(self.TypeId.to_binary())
11215 1
        packet.append(self.ResponseHeader.to_binary())
11216 1
        packet.append(self.Parameters.to_binary())
11217 1
        return b''.join(packet)
11218
11219 1
    @staticmethod
11220
    def from_binary(data):
11221 1
        return CreateSubscriptionResponse(data)
11222
11223 1
    def _binary_init(self, data):
11224 1
        self.TypeId = NodeId.from_binary(data)
11225 1
        self.ResponseHeader = ResponseHeader.from_binary(data)
11226 1
        self.Parameters = CreateSubscriptionResult.from_binary(data)
11227
11228 1
    def __str__(self):
11229
        return 'CreateSubscriptionResponse(' + 'TypeId:' + str(self.TypeId) + ', ' + \
11230
               'ResponseHeader:' + str(self.ResponseHeader) + ', ' + \
11231
               'Parameters:' + str(self.Parameters) + ')'
11232
11233 1
    __repr__ = __str__
11234
11235
11236 1
class ModifySubscriptionParameters(FrozenClass):
11237
    '''
11238
    :ivar SubscriptionId:
11239
    :vartype SubscriptionId: UInt32
11240
    :ivar RequestedPublishingInterval:
11241
    :vartype RequestedPublishingInterval: Double
11242
    :ivar RequestedLifetimeCount:
11243
    :vartype RequestedLifetimeCount: UInt32
11244
    :ivar RequestedMaxKeepAliveCount:
11245
    :vartype RequestedMaxKeepAliveCount: UInt32
11246
    :ivar MaxNotificationsPerPublish:
11247
    :vartype MaxNotificationsPerPublish: UInt32
11248
    :ivar Priority:
11249
    :vartype Priority: Byte
11250
    '''
11251 1
    def __init__(self, binary=None):
11252
        if binary is not None:
11253
            self._binary_init(binary)
11254
            self._freeze()
11255
            return
11256
        self.SubscriptionId = 0
11257
        self.RequestedPublishingInterval = 0
11258
        self.RequestedLifetimeCount = 0
11259
        self.RequestedMaxKeepAliveCount = 0
11260
        self.MaxNotificationsPerPublish = 0
11261
        self.Priority = 0
11262
        self._freeze()
11263
11264 1
    def to_binary(self):
11265
        packet = []
11266
        packet.append(uatype_UInt32.pack(self.SubscriptionId))
11267
        packet.append(uatype_Double.pack(self.RequestedPublishingInterval))
11268
        packet.append(uatype_UInt32.pack(self.RequestedLifetimeCount))
11269
        packet.append(uatype_UInt32.pack(self.RequestedMaxKeepAliveCount))
11270
        packet.append(uatype_UInt32.pack(self.MaxNotificationsPerPublish))
11271
        packet.append(uatype_Byte.pack(self.Priority))
11272
        return b''.join(packet)
11273
11274 1
    @staticmethod
11275
    def from_binary(data):
11276
        return ModifySubscriptionParameters(data)
11277
11278 1
    def _binary_init(self, data):
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
11279
        self.SubscriptionId = uatype_UInt32.unpack(data.read(4))[0]
11280
        self.RequestedPublishingInterval = uatype_Double.unpack(data.read(8))[0]
11281
        self.RequestedLifetimeCount = uatype_UInt32.unpack(data.read(4))[0]
11282
        self.RequestedMaxKeepAliveCount = uatype_UInt32.unpack(data.read(4))[0]
11283
        self.MaxNotificationsPerPublish = uatype_UInt32.unpack(data.read(4))[0]
11284
        self.Priority = uatype_Byte.unpack(data.read(1))[0]
11285
11286 1
    def __str__(self):
11287
        return 'ModifySubscriptionParameters(' + 'SubscriptionId:' + str(self.SubscriptionId) + ', ' + \
11288
               'RequestedPublishingInterval:' + str(self.RequestedPublishingInterval) + ', ' + \
11289
               'RequestedLifetimeCount:' + str(self.RequestedLifetimeCount) + ', ' + \
11290
               'RequestedMaxKeepAliveCount:' + str(self.RequestedMaxKeepAliveCount) + ', ' + \
11291
               'MaxNotificationsPerPublish:' + str(self.MaxNotificationsPerPublish) + ', ' + \
11292
               'Priority:' + str(self.Priority) + ')'
11293
11294 1
    __repr__ = __str__
11295
11296
11297 1
class ModifySubscriptionRequest(FrozenClass):
11298
    '''
11299
    :ivar TypeId:
11300
    :vartype TypeId: NodeId
11301
    :ivar RequestHeader:
11302
    :vartype RequestHeader: RequestHeader
11303
    :ivar Parameters:
11304
    :vartype Parameters: ModifySubscriptionParameters
11305
    '''
11306 1
    def __init__(self, binary=None):
11307
        if binary is not None:
11308
            self._binary_init(binary)
11309
            self._freeze()
11310
            return
11311
        self.TypeId = FourByteNodeId(ObjectIds.ModifySubscriptionRequest_Encoding_DefaultBinary)
11312
        self.RequestHeader = RequestHeader()
11313
        self.Parameters = ModifySubscriptionParameters()
11314
        self._freeze()
11315
11316 1
    def to_binary(self):
11317
        packet = []
11318
        packet.append(self.TypeId.to_binary())
11319
        packet.append(self.RequestHeader.to_binary())
11320
        packet.append(self.Parameters.to_binary())
11321
        return b''.join(packet)
11322
11323 1
    @staticmethod
11324
    def from_binary(data):
11325
        return ModifySubscriptionRequest(data)
11326
11327 1
    def _binary_init(self, data):
11328
        self.TypeId = NodeId.from_binary(data)
11329
        self.RequestHeader = RequestHeader.from_binary(data)
11330
        self.Parameters = ModifySubscriptionParameters.from_binary(data)
11331
11332 1
    def __str__(self):
11333
        return 'ModifySubscriptionRequest(' + 'TypeId:' + str(self.TypeId) + ', ' + \
11334
               'RequestHeader:' + str(self.RequestHeader) + ', ' + \
11335
               'Parameters:' + str(self.Parameters) + ')'
11336
11337 1
    __repr__ = __str__
11338
11339
11340 1
class ModifySubscriptionResult(FrozenClass):
11341
    '''
11342
    :ivar RevisedPublishingInterval:
11343
    :vartype RevisedPublishingInterval: Double
11344
    :ivar RevisedLifetimeCount:
11345
    :vartype RevisedLifetimeCount: UInt32
11346
    :ivar RevisedMaxKeepAliveCount:
11347
    :vartype RevisedMaxKeepAliveCount: UInt32
11348
    '''
11349 1
    def __init__(self, binary=None):
11350
        if binary is not None:
11351
            self._binary_init(binary)
11352
            self._freeze()
11353
            return
11354
        self.RevisedPublishingInterval = 0
11355
        self.RevisedLifetimeCount = 0
11356
        self.RevisedMaxKeepAliveCount = 0
11357
        self._freeze()
11358
11359 1
    def to_binary(self):
11360
        packet = []
11361
        packet.append(uatype_Double.pack(self.RevisedPublishingInterval))
11362
        packet.append(uatype_UInt32.pack(self.RevisedLifetimeCount))
11363
        packet.append(uatype_UInt32.pack(self.RevisedMaxKeepAliveCount))
11364
        return b''.join(packet)
11365
11366 1
    @staticmethod
11367
    def from_binary(data):
11368
        return ModifySubscriptionResult(data)
11369
11370 1
    def _binary_init(self, data):
11371
        self.RevisedPublishingInterval = uatype_Double.unpack(data.read(8))[0]
11372
        self.RevisedLifetimeCount = uatype_UInt32.unpack(data.read(4))[0]
11373
        self.RevisedMaxKeepAliveCount = uatype_UInt32.unpack(data.read(4))[0]
11374
11375 1
    def __str__(self):
11376
        return 'ModifySubscriptionResult(' + 'RevisedPublishingInterval:' + str(self.RevisedPublishingInterval) + ', ' + \
11377
               'RevisedLifetimeCount:' + str(self.RevisedLifetimeCount) + ', ' + \
11378
               'RevisedMaxKeepAliveCount:' + str(self.RevisedMaxKeepAliveCount) + ')'
11379
11380 1
    __repr__ = __str__
11381
11382
11383 1
class ModifySubscriptionResponse(FrozenClass):
11384
    '''
11385
    :ivar TypeId:
11386
    :vartype TypeId: NodeId
11387
    :ivar ResponseHeader:
11388
    :vartype ResponseHeader: ResponseHeader
11389
    :ivar Parameters:
11390
    :vartype Parameters: ModifySubscriptionResult
11391
    '''
11392 1
    def __init__(self, binary=None):
11393
        if binary is not None:
11394
            self._binary_init(binary)
11395
            self._freeze()
11396
            return
11397
        self.TypeId = FourByteNodeId(ObjectIds.ModifySubscriptionResponse_Encoding_DefaultBinary)
11398
        self.ResponseHeader = ResponseHeader()
11399
        self.Parameters = ModifySubscriptionResult()
11400
        self._freeze()
11401
11402 1
    def to_binary(self):
11403
        packet = []
11404
        packet.append(self.TypeId.to_binary())
11405
        packet.append(self.ResponseHeader.to_binary())
11406
        packet.append(self.Parameters.to_binary())
11407
        return b''.join(packet)
11408
11409 1
    @staticmethod
11410
    def from_binary(data):
11411
        return ModifySubscriptionResponse(data)
11412
11413 1
    def _binary_init(self, data):
11414
        self.TypeId = NodeId.from_binary(data)
11415
        self.ResponseHeader = ResponseHeader.from_binary(data)
11416
        self.Parameters = ModifySubscriptionResult.from_binary(data)
11417
11418 1
    def __str__(self):
11419
        return 'ModifySubscriptionResponse(' + 'TypeId:' + str(self.TypeId) + ', ' + \
11420
               'ResponseHeader:' + str(self.ResponseHeader) + ', ' + \
11421
               'Parameters:' + str(self.Parameters) + ')'
11422
11423 1
    __repr__ = __str__
11424
11425
11426 1
class SetPublishingModeParameters(FrozenClass):
11427
    '''
11428
    :ivar PublishingEnabled:
11429
    :vartype PublishingEnabled: Boolean
11430
    :ivar SubscriptionIds:
11431
    :vartype SubscriptionIds: UInt32
11432
    '''
11433 1
    def __init__(self, binary=None):
11434
        if binary is not None:
11435
            self._binary_init(binary)
11436
            self._freeze()
11437
            return
11438
        self.PublishingEnabled = True
11439
        self.SubscriptionIds = []
11440
        self._freeze()
11441
11442 1
    def to_binary(self):
11443
        packet = []
11444
        packet.append(uatype_Boolean.pack(self.PublishingEnabled))
11445
        packet.append(uatype_Int32.pack(len(self.SubscriptionIds)))
11446
        for fieldname in self.SubscriptionIds:
11447
            packet.append(uatype_UInt32.pack(fieldname))
11448
        return b''.join(packet)
11449
11450 1
    @staticmethod
11451
    def from_binary(data):
11452
        return SetPublishingModeParameters(data)
11453
11454 1
    def _binary_init(self, data):
11455
        self.PublishingEnabled = uatype_Boolean.unpack(data.read(1))[0]
11456
        self.SubscriptionIds = unpack_uatype_array('UInt32', data)
11457
11458 1
    def __str__(self):
11459
        return 'SetPublishingModeParameters(' + 'PublishingEnabled:' + str(self.PublishingEnabled) + ', ' + \
11460
               'SubscriptionIds:' + str(self.SubscriptionIds) + ')'
11461
11462 1
    __repr__ = __str__
11463
11464
11465 1
class SetPublishingModeRequest(FrozenClass):
11466
    '''
11467
    :ivar TypeId:
11468
    :vartype TypeId: NodeId
11469
    :ivar RequestHeader:
11470
    :vartype RequestHeader: RequestHeader
11471
    :ivar Parameters:
11472
    :vartype Parameters: SetPublishingModeParameters
11473
    '''
11474 1
    def __init__(self, binary=None):
11475
        if binary is not None:
11476
            self._binary_init(binary)
11477
            self._freeze()
11478
            return
11479
        self.TypeId = FourByteNodeId(ObjectIds.SetPublishingModeRequest_Encoding_DefaultBinary)
11480
        self.RequestHeader = RequestHeader()
11481
        self.Parameters = SetPublishingModeParameters()
11482
        self._freeze()
11483
11484 1
    def to_binary(self):
11485
        packet = []
11486
        packet.append(self.TypeId.to_binary())
11487
        packet.append(self.RequestHeader.to_binary())
11488
        packet.append(self.Parameters.to_binary())
11489
        return b''.join(packet)
11490
11491 1
    @staticmethod
11492
    def from_binary(data):
11493
        return SetPublishingModeRequest(data)
11494
11495 1
    def _binary_init(self, data):
11496
        self.TypeId = NodeId.from_binary(data)
11497
        self.RequestHeader = RequestHeader.from_binary(data)
11498
        self.Parameters = SetPublishingModeParameters.from_binary(data)
11499
11500 1
    def __str__(self):
11501
        return 'SetPublishingModeRequest(' + 'TypeId:' + str(self.TypeId) + ', ' + \
11502
               'RequestHeader:' + str(self.RequestHeader) + ', ' + \
11503
               'Parameters:' + str(self.Parameters) + ')'
11504
11505 1
    __repr__ = __str__
11506
11507
11508 1
class SetPublishingModeResult(FrozenClass):
11509
    '''
11510
    :ivar Results:
11511
    :vartype Results: StatusCode
11512
    :ivar DiagnosticInfos:
11513
    :vartype DiagnosticInfos: DiagnosticInfo
11514
    '''
11515 1
    def __init__(self, binary=None):
11516
        if binary is not None:
11517
            self._binary_init(binary)
11518
            self._freeze()
11519
            return
11520
        self.Results = []
11521
        self.DiagnosticInfos = []
11522
        self._freeze()
11523
11524 1
    def to_binary(self):
11525
        packet = []
11526
        packet.append(uatype_Int32.pack(len(self.Results)))
11527
        for fieldname in self.Results:
11528
            packet.append(fieldname.to_binary())
11529
        packet.append(uatype_Int32.pack(len(self.DiagnosticInfos)))
11530
        for fieldname in self.DiagnosticInfos:
11531
            packet.append(fieldname.to_binary())
11532
        return b''.join(packet)
11533
11534 1
    @staticmethod
11535
    def from_binary(data):
11536
        return SetPublishingModeResult(data)
11537
11538 1
    def _binary_init(self, data):
11539
        length = uatype_Int32.unpack(data.read(4))[0]
11540
        array = []
11541
        if length != -1:
11542
            for _ in range(0, length):
11543
                array.append(StatusCode.from_binary(data))
11544
        self.Results = array
11545
        length = uatype_Int32.unpack(data.read(4))[0]
11546
        array = []
11547
        if length != -1:
11548
            for _ in range(0, length):
11549
                array.append(DiagnosticInfo.from_binary(data))
11550
        self.DiagnosticInfos = array
11551
11552 1
    def __str__(self):
11553
        return 'SetPublishingModeResult(' + 'Results:' + str(self.Results) + ', ' + \
11554
               'DiagnosticInfos:' + str(self.DiagnosticInfos) + ')'
11555
11556 1
    __repr__ = __str__
11557
11558
11559 1
class SetPublishingModeResponse(FrozenClass):
11560
    '''
11561
    :ivar TypeId:
11562
    :vartype TypeId: NodeId
11563
    :ivar ResponseHeader:
11564
    :vartype ResponseHeader: ResponseHeader
11565
    :ivar Parameters:
11566
    :vartype Parameters: SetPublishingModeResult
11567
    '''
11568 1
    def __init__(self, binary=None):
11569
        if binary is not None:
11570
            self._binary_init(binary)
11571
            self._freeze()
11572
            return
11573
        self.TypeId = FourByteNodeId(ObjectIds.SetPublishingModeResponse_Encoding_DefaultBinary)
11574
        self.ResponseHeader = ResponseHeader()
11575
        self.Parameters = SetPublishingModeResult()
11576
        self._freeze()
11577
11578 1
    def to_binary(self):
11579
        packet = []
11580
        packet.append(self.TypeId.to_binary())
11581
        packet.append(self.ResponseHeader.to_binary())
11582
        packet.append(self.Parameters.to_binary())
11583
        return b''.join(packet)
11584
11585 1
    @staticmethod
11586
    def from_binary(data):
11587
        return SetPublishingModeResponse(data)
11588
11589 1
    def _binary_init(self, data):
11590
        self.TypeId = NodeId.from_binary(data)
11591
        self.ResponseHeader = ResponseHeader.from_binary(data)
11592
        self.Parameters = SetPublishingModeResult.from_binary(data)
11593
11594 1
    def __str__(self):
11595
        return 'SetPublishingModeResponse(' + 'TypeId:' + str(self.TypeId) + ', ' + \
11596
               'ResponseHeader:' + str(self.ResponseHeader) + ', ' + \
11597
               'Parameters:' + str(self.Parameters) + ')'
11598
11599 1
    __repr__ = __str__
11600
11601
11602 1
class NotificationMessage(FrozenClass):
11603
    '''
11604
    :ivar SequenceNumber:
11605
    :vartype SequenceNumber: UInt32
11606
    :ivar PublishTime:
11607
    :vartype PublishTime: DateTime
11608
    :ivar NotificationData:
11609
    :vartype NotificationData: ExtensionObject
11610
    '''
11611 1
    def __init__(self, binary=None):
11612 1
        if binary is not None:
11613 1
            self._binary_init(binary)
11614 1
            self._freeze()
11615 1
            return
11616 1
        self.SequenceNumber = 0
11617 1
        self.PublishTime = datetime.now()
11618 1
        self.NotificationData = []
11619 1
        self._freeze()
11620
11621 1
    def to_binary(self):
11622 1
        packet = []
11623 1
        packet.append(uatype_UInt32.pack(self.SequenceNumber))
11624 1
        packet.append(pack_datetime(self.PublishTime))
11625 1
        packet.append(uatype_Int32.pack(len(self.NotificationData)))
11626 1
        for fieldname in self.NotificationData:
11627 1
            packet.append(extensionobject_to_binary(fieldname))
11628 1
        return b''.join(packet)
11629
11630 1
    @staticmethod
11631
    def from_binary(data):
11632 1
        return NotificationMessage(data)
11633
11634 1
    def _binary_init(self, data):
11635 1
        self.SequenceNumber = uatype_UInt32.unpack(data.read(4))[0]
11636 1
        self.PublishTime = unpack_datetime(data)
11637 1
        length = uatype_Int32.unpack(data.read(4))[0]
11638 1
        array = []
11639 1
        if length != -1:
11640 1
            for _ in range(0, length):
11641 1
                array.append(extensionobject_from_binary(data))
11642 1
        self.NotificationData = array
11643
11644 1
    def __str__(self):
11645
        return 'NotificationMessage(' + 'SequenceNumber:' + str(self.SequenceNumber) + ', ' + \
11646
               'PublishTime:' + str(self.PublishTime) + ', ' + \
11647
               'NotificationData:' + str(self.NotificationData) + ')'
11648
11649 1
    __repr__ = __str__
11650
11651
11652 1
class NotificationData(FrozenClass):
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
11653
    '''
11654
    '''
11655 1
    def __init__(self, binary=None):
11656
        if binary is not None:
11657
            self._binary_init(binary)
11658
            self._freeze()
11659
            return
11660
        self._freeze()
11661
11662 1
    def to_binary(self):
11663
        packet = []
11664
        return b''.join(packet)
11665
11666 1
    @staticmethod
11667
    def from_binary(data):
11668
        return NotificationData(data)
11669
11670 1
    def _binary_init(self, data):
11671
        pass
11672
11673 1
    def __str__(self):
11674
        return 'NotificationData(' +  + ')'
11675
11676 1
    __repr__ = __str__
11677
11678
11679 1
class DataChangeNotification(FrozenClass):
11680
    '''
11681
    :ivar MonitoredItems:
11682
    :vartype MonitoredItems: MonitoredItemNotification
11683
    :ivar DiagnosticInfos:
11684
    :vartype DiagnosticInfos: DiagnosticInfo
11685
    '''
11686 1
    def __init__(self, binary=None):
11687 1
        if binary is not None:
11688 1
            self._binary_init(binary)
11689 1
            self._freeze()
11690 1
            return
11691 1
        self.MonitoredItems = []
11692 1
        self.DiagnosticInfos = []
11693 1
        self._freeze()
11694
11695 1
    def to_binary(self):
11696 1
        packet = []
11697 1
        packet.append(uatype_Int32.pack(len(self.MonitoredItems)))
11698 1
        for fieldname in self.MonitoredItems:
11699 1
            packet.append(fieldname.to_binary())
11700 1
        packet.append(uatype_Int32.pack(len(self.DiagnosticInfos)))
11701 1
        for fieldname in self.DiagnosticInfos:
11702
            packet.append(fieldname.to_binary())
11703 1
        return b''.join(packet)
11704
11705 1
    @staticmethod
11706
    def from_binary(data):
11707 1
        return DataChangeNotification(data)
11708
11709 1
    def _binary_init(self, data):
11710 1
        length = uatype_Int32.unpack(data.read(4))[0]
11711 1
        array = []
11712 1
        if length != -1:
11713 1
            for _ in range(0, length):
11714 1
                array.append(MonitoredItemNotification.from_binary(data))
11715 1
        self.MonitoredItems = array
11716 1
        length = uatype_Int32.unpack(data.read(4))[0]
11717 1
        array = []
11718 1
        if length != -1:
11719 1
            for _ in range(0, length):
11720
                array.append(DiagnosticInfo.from_binary(data))
11721 1
        self.DiagnosticInfos = array
11722
11723 1
    def __str__(self):
11724
        return 'DataChangeNotification(' + 'MonitoredItems:' + str(self.MonitoredItems) + ', ' + \
11725
               'DiagnosticInfos:' + str(self.DiagnosticInfos) + ')'
11726
11727 1
    __repr__ = __str__
11728
11729
11730 1
class MonitoredItemNotification(FrozenClass):
11731
    '''
11732
    :ivar ClientHandle:
11733
    :vartype ClientHandle: UInt32
11734
    :ivar Value:
11735
    :vartype Value: DataValue
11736
    '''
11737 1
    def __init__(self, binary=None):
11738 1
        if binary is not None:
11739 1
            self._binary_init(binary)
11740 1
            self._freeze()
11741 1
            return
11742 1
        self.ClientHandle = 0
11743 1
        self.Value = DataValue()
11744 1
        self._freeze()
11745
11746 1
    def to_binary(self):
11747 1
        packet = []
11748 1
        packet.append(uatype_UInt32.pack(self.ClientHandle))
11749 1
        packet.append(self.Value.to_binary())
11750 1
        return b''.join(packet)
11751
11752 1
    @staticmethod
11753
    def from_binary(data):
11754 1
        return MonitoredItemNotification(data)
11755
11756 1
    def _binary_init(self, data):
11757 1
        self.ClientHandle = uatype_UInt32.unpack(data.read(4))[0]
11758 1
        self.Value = DataValue.from_binary(data)
11759
11760 1
    def __str__(self):
11761
        return 'MonitoredItemNotification(' + 'ClientHandle:' + str(self.ClientHandle) + ', ' + \
11762
               'Value:' + str(self.Value) + ')'
11763
11764 1
    __repr__ = __str__
11765
11766
11767 1
class EventNotificationList(FrozenClass):
11768
    '''
11769
    :ivar Events:
11770
    :vartype Events: EventFieldList
11771
    '''
11772 1
    def __init__(self, binary=None):
11773 1
        if binary is not None:
11774 1
            self._binary_init(binary)
11775 1
            self._freeze()
11776 1
            return
11777 1
        self.Events = []
11778 1
        self._freeze()
11779
11780 1
    def to_binary(self):
11781 1
        packet = []
11782 1
        packet.append(uatype_Int32.pack(len(self.Events)))
11783 1
        for fieldname in self.Events:
11784 1
            packet.append(fieldname.to_binary())
11785 1
        return b''.join(packet)
11786
11787 1
    @staticmethod
11788
    def from_binary(data):
11789 1
        return EventNotificationList(data)
11790
11791 1
    def _binary_init(self, data):
11792 1
        length = uatype_Int32.unpack(data.read(4))[0]
11793 1
        array = []
11794 1
        if length != -1:
11795 1
            for _ in range(0, length):
11796 1
                array.append(EventFieldList.from_binary(data))
11797 1
        self.Events = array
11798
11799 1
    def __str__(self):
11800
        return 'EventNotificationList(' + 'Events:' + str(self.Events) + ')'
11801
11802 1
    __repr__ = __str__
11803
11804
11805 1
class EventFieldList(FrozenClass):
11806
    '''
11807
    :ivar ClientHandle:
11808
    :vartype ClientHandle: UInt32
11809
    :ivar EventFields:
11810
    :vartype EventFields: Variant
11811
    '''
11812 1
    def __init__(self, binary=None):
11813 1
        if binary is not None:
11814 1
            self._binary_init(binary)
11815 1
            self._freeze()
11816 1
            return
11817 1
        self.ClientHandle = 0
11818 1
        self.EventFields = []
11819 1
        self._freeze()
11820
11821 1
    def to_binary(self):
11822 1
        packet = []
11823 1
        packet.append(uatype_UInt32.pack(self.ClientHandle))
11824 1
        packet.append(uatype_Int32.pack(len(self.EventFields)))
11825 1
        for fieldname in self.EventFields:
11826 1
            packet.append(fieldname.to_binary())
11827 1
        return b''.join(packet)
11828
11829 1
    @staticmethod
11830
    def from_binary(data):
11831 1
        return EventFieldList(data)
11832
11833 1
    def _binary_init(self, data):
11834 1
        self.ClientHandle = uatype_UInt32.unpack(data.read(4))[0]
11835 1
        length = uatype_Int32.unpack(data.read(4))[0]
11836 1
        array = []
11837 1
        if length != -1:
11838 1
            for _ in range(0, length):
11839 1
                array.append(Variant.from_binary(data))
11840 1
        self.EventFields = array
11841
11842 1
    def __str__(self):
11843
        return 'EventFieldList(' + 'ClientHandle:' + str(self.ClientHandle) + ', ' + \
11844
               'EventFields:' + str(self.EventFields) + ')'
11845
11846 1
    __repr__ = __str__
11847
11848
11849 1
class HistoryEventFieldList(FrozenClass):
11850
    '''
11851
    :ivar EventFields:
11852
    :vartype EventFields: Variant
11853
    '''
11854 1
    def __init__(self, binary=None):
11855
        if binary is not None:
11856
            self._binary_init(binary)
11857
            self._freeze()
11858
            return
11859
        self.EventFields = []
11860
        self._freeze()
11861
11862 1
    def to_binary(self):
11863
        packet = []
11864
        packet.append(uatype_Int32.pack(len(self.EventFields)))
11865
        for fieldname in self.EventFields:
11866
            packet.append(fieldname.to_binary())
11867
        return b''.join(packet)
11868
11869 1
    @staticmethod
11870
    def from_binary(data):
11871
        return HistoryEventFieldList(data)
11872
11873 1
    def _binary_init(self, data):
11874
        length = uatype_Int32.unpack(data.read(4))[0]
11875
        array = []
11876
        if length != -1:
11877
            for _ in range(0, length):
11878
                array.append(Variant.from_binary(data))
11879
        self.EventFields = array
11880
11881 1
    def __str__(self):
11882
        return 'HistoryEventFieldList(' + 'EventFields:' + str(self.EventFields) + ')'
11883
11884 1
    __repr__ = __str__
11885
11886
11887 1
class StatusChangeNotification(FrozenClass):
11888
    '''
11889
    :ivar Status:
11890
    :vartype Status: StatusCode
11891
    :ivar DiagnosticInfo:
11892
    :vartype DiagnosticInfo: DiagnosticInfo
11893
    '''
11894 1
    def __init__(self, binary=None):
11895
        if binary is not None:
11896
            self._binary_init(binary)
11897
            self._freeze()
11898
            return
11899
        self.Status = StatusCode()
11900
        self.DiagnosticInfo = DiagnosticInfo()
11901
        self._freeze()
11902
11903 1
    def to_binary(self):
11904
        packet = []
11905
        packet.append(self.Status.to_binary())
11906
        packet.append(self.DiagnosticInfo.to_binary())
11907
        return b''.join(packet)
11908
11909 1
    @staticmethod
11910
    def from_binary(data):
11911
        return StatusChangeNotification(data)
11912
11913 1
    def _binary_init(self, data):
11914
        self.Status = StatusCode.from_binary(data)
11915
        self.DiagnosticInfo = DiagnosticInfo.from_binary(data)
11916
11917 1
    def __str__(self):
11918
        return 'StatusChangeNotification(' + 'Status:' + str(self.Status) + ', ' + \
11919
               'DiagnosticInfo:' + str(self.DiagnosticInfo) + ')'
11920
11921 1
    __repr__ = __str__
11922
11923
11924 1
class SubscriptionAcknowledgement(FrozenClass):
11925
    '''
11926
    :ivar SubscriptionId:
11927
    :vartype SubscriptionId: UInt32
11928
    :ivar SequenceNumber:
11929
    :vartype SequenceNumber: UInt32
11930
    '''
11931 1
    def __init__(self, binary=None):
11932 1
        if binary is not None:
11933 1
            self._binary_init(binary)
11934 1
            self._freeze()
11935 1
            return
11936 1
        self.SubscriptionId = 0
11937 1
        self.SequenceNumber = 0
11938 1
        self._freeze()
11939
11940 1
    def to_binary(self):
11941 1
        packet = []
11942 1
        packet.append(uatype_UInt32.pack(self.SubscriptionId))
11943 1
        packet.append(uatype_UInt32.pack(self.SequenceNumber))
11944 1
        return b''.join(packet)
11945
11946 1
    @staticmethod
11947
    def from_binary(data):
11948 1
        return SubscriptionAcknowledgement(data)
11949
11950 1
    def _binary_init(self, data):
11951 1
        self.SubscriptionId = uatype_UInt32.unpack(data.read(4))[0]
11952 1
        self.SequenceNumber = uatype_UInt32.unpack(data.read(4))[0]
11953
11954 1
    def __str__(self):
11955
        return 'SubscriptionAcknowledgement(' + 'SubscriptionId:' + str(self.SubscriptionId) + ', ' + \
11956
               'SequenceNumber:' + str(self.SequenceNumber) + ')'
11957
11958 1
    __repr__ = __str__
11959
11960
11961 1
class PublishParameters(FrozenClass):
11962
    '''
11963
    :ivar SubscriptionAcknowledgements:
11964
    :vartype SubscriptionAcknowledgements: SubscriptionAcknowledgement
11965
    '''
11966 1
    def __init__(self, binary=None):
11967 1
        if binary is not None:
11968 1
            self._binary_init(binary)
11969 1
            self._freeze()
11970 1
            return
11971 1
        self.SubscriptionAcknowledgements = []
11972 1
        self._freeze()
11973
11974 1
    def to_binary(self):
11975 1
        packet = []
11976 1
        packet.append(uatype_Int32.pack(len(self.SubscriptionAcknowledgements)))
11977 1
        for fieldname in self.SubscriptionAcknowledgements:
11978 1
            packet.append(fieldname.to_binary())
11979 1
        return b''.join(packet)
11980
11981 1
    @staticmethod
11982
    def from_binary(data):
11983 1
        return PublishParameters(data)
11984
11985 1
    def _binary_init(self, data):
11986 1
        length = uatype_Int32.unpack(data.read(4))[0]
11987 1
        array = []
11988 1
        if length != -1:
11989 1
            for _ in range(0, length):
11990 1
                array.append(SubscriptionAcknowledgement.from_binary(data))
11991 1
        self.SubscriptionAcknowledgements = array
11992
11993 1
    def __str__(self):
11994
        return 'PublishParameters(' + 'SubscriptionAcknowledgements:' + str(self.SubscriptionAcknowledgements) + ')'
11995
11996 1
    __repr__ = __str__
11997
11998
11999 1
class PublishRequest(FrozenClass):
12000
    '''
12001
    :ivar TypeId:
12002
    :vartype TypeId: NodeId
12003
    :ivar RequestHeader:
12004
    :vartype RequestHeader: RequestHeader
12005
    :ivar Parameters:
12006
    :vartype Parameters: PublishParameters
12007
    '''
12008 1
    def __init__(self, binary=None):
12009 1
        if binary is not None:
12010
            self._binary_init(binary)
12011
            self._freeze()
12012
            return
12013 1
        self.TypeId = FourByteNodeId(ObjectIds.PublishRequest_Encoding_DefaultBinary)
12014 1
        self.RequestHeader = RequestHeader()
12015 1
        self.Parameters = PublishParameters()
12016 1
        self._freeze()
12017
12018 1
    def to_binary(self):
12019 1
        packet = []
12020 1
        packet.append(self.TypeId.to_binary())
12021 1
        packet.append(self.RequestHeader.to_binary())
12022 1
        packet.append(self.Parameters.to_binary())
12023 1
        return b''.join(packet)
12024
12025 1
    @staticmethod
12026
    def from_binary(data):
12027
        return PublishRequest(data)
12028
12029 1
    def _binary_init(self, data):
12030
        self.TypeId = NodeId.from_binary(data)
12031
        self.RequestHeader = RequestHeader.from_binary(data)
12032
        self.Parameters = PublishParameters.from_binary(data)
12033
12034 1
    def __str__(self):
12035
        return 'PublishRequest(' + 'TypeId:' + str(self.TypeId) + ', ' + \
12036
               'RequestHeader:' + str(self.RequestHeader) + ', ' + \
12037
               'Parameters:' + str(self.Parameters) + ')'
12038
12039 1
    __repr__ = __str__
12040
12041
12042 1
class PublishResult(FrozenClass):
12043
    '''
12044
    :ivar SubscriptionId:
12045
    :vartype SubscriptionId: UInt32
12046
    :ivar AvailableSequenceNumbers:
12047
    :vartype AvailableSequenceNumbers: UInt32
12048
    :ivar MoreNotifications:
12049
    :vartype MoreNotifications: Boolean
12050
    :ivar NotificationMessage:
12051
    :vartype NotificationMessage: NotificationMessage
12052
    :ivar Results:
12053
    :vartype Results: StatusCode
12054
    :ivar DiagnosticInfos:
12055
    :vartype DiagnosticInfos: DiagnosticInfo
12056
    '''
12057 1
    def __init__(self, binary=None):
12058 1
        if binary is not None:
12059 1
            self._binary_init(binary)
12060 1
            self._freeze()
12061 1
            return
12062 1
        self.SubscriptionId = 0
12063 1
        self.AvailableSequenceNumbers = []
12064 1
        self.MoreNotifications = True
12065 1
        self.NotificationMessage = NotificationMessage()
12066 1
        self.Results = []
12067 1
        self.DiagnosticInfos = []
12068 1
        self._freeze()
12069
12070 1
    def to_binary(self):
12071 1
        packet = []
12072 1
        packet.append(uatype_UInt32.pack(self.SubscriptionId))
12073 1
        packet.append(uatype_Int32.pack(len(self.AvailableSequenceNumbers)))
12074 1
        for fieldname in self.AvailableSequenceNumbers:
12075 1
            packet.append(uatype_UInt32.pack(fieldname))
12076 1
        packet.append(uatype_Boolean.pack(self.MoreNotifications))
12077 1
        packet.append(self.NotificationMessage.to_binary())
12078 1
        packet.append(uatype_Int32.pack(len(self.Results)))
12079 1
        for fieldname in self.Results:
12080
            packet.append(fieldname.to_binary())
12081 1
        packet.append(uatype_Int32.pack(len(self.DiagnosticInfos)))
12082 1
        for fieldname in self.DiagnosticInfos:
12083
            packet.append(fieldname.to_binary())
12084 1
        return b''.join(packet)
12085
12086 1
    @staticmethod
12087
    def from_binary(data):
12088 1
        return PublishResult(data)
12089
12090 1
    def _binary_init(self, data):
12091 1
        self.SubscriptionId = uatype_UInt32.unpack(data.read(4))[0]
12092 1
        self.AvailableSequenceNumbers = unpack_uatype_array('UInt32', data)
12093 1
        self.MoreNotifications = uatype_Boolean.unpack(data.read(1))[0]
12094 1
        self.NotificationMessage = NotificationMessage.from_binary(data)
12095 1
        length = uatype_Int32.unpack(data.read(4))[0]
12096 1
        array = []
12097 1
        if length != -1:
12098 1
            for _ in range(0, length):
12099
                array.append(StatusCode.from_binary(data))
12100 1
        self.Results = array
12101 1
        length = uatype_Int32.unpack(data.read(4))[0]
12102 1
        array = []
12103 1
        if length != -1:
12104 1
            for _ in range(0, length):
12105
                array.append(DiagnosticInfo.from_binary(data))
12106 1
        self.DiagnosticInfos = array
12107
12108 1
    def __str__(self):
12109
        return 'PublishResult(' + 'SubscriptionId:' + str(self.SubscriptionId) + ', ' + \
12110
               'AvailableSequenceNumbers:' + str(self.AvailableSequenceNumbers) + ', ' + \
12111
               'MoreNotifications:' + str(self.MoreNotifications) + ', ' + \
12112
               'NotificationMessage:' + str(self.NotificationMessage) + ', ' + \
12113
               'Results:' + str(self.Results) + ', ' + \
12114
               'DiagnosticInfos:' + str(self.DiagnosticInfos) + ')'
12115
12116 1
    __repr__ = __str__
12117
12118
12119 1
class PublishResponse(FrozenClass):
12120
    '''
12121
    :ivar TypeId:
12122
    :vartype TypeId: NodeId
12123
    :ivar ResponseHeader:
12124
    :vartype ResponseHeader: ResponseHeader
12125
    :ivar Parameters:
12126
    :vartype Parameters: PublishResult
12127
    '''
12128 1
    def __init__(self, binary=None):
12129 1
        if binary is not None:
12130 1
            self._binary_init(binary)
12131 1
            self._freeze()
12132 1
            return
12133 1
        self.TypeId = FourByteNodeId(ObjectIds.PublishResponse_Encoding_DefaultBinary)
12134 1
        self.ResponseHeader = ResponseHeader()
12135 1
        self.Parameters = PublishResult()
12136 1
        self._freeze()
12137
12138 1
    def to_binary(self):
12139 1
        packet = []
12140 1
        packet.append(self.TypeId.to_binary())
12141 1
        packet.append(self.ResponseHeader.to_binary())
12142 1
        packet.append(self.Parameters.to_binary())
12143 1
        return b''.join(packet)
12144
12145 1
    @staticmethod
12146
    def from_binary(data):
12147 1
        return PublishResponse(data)
12148
12149 1
    def _binary_init(self, data):
12150 1
        self.TypeId = NodeId.from_binary(data)
12151 1
        self.ResponseHeader = ResponseHeader.from_binary(data)
12152 1
        self.Parameters = PublishResult.from_binary(data)
12153
12154 1
    def __str__(self):
12155
        return 'PublishResponse(' + 'TypeId:' + str(self.TypeId) + ', ' + \
12156
               'ResponseHeader:' + str(self.ResponseHeader) + ', ' + \
12157
               'Parameters:' + str(self.Parameters) + ')'
12158
12159 1
    __repr__ = __str__
12160
12161
12162 1
class RepublishParameters(FrozenClass):
12163
    '''
12164
    :ivar SubscriptionId:
12165
    :vartype SubscriptionId: UInt32
12166
    :ivar RetransmitSequenceNumber:
12167
    :vartype RetransmitSequenceNumber: UInt32
12168
    '''
12169 1
    def __init__(self, binary=None):
12170
        if binary is not None:
12171
            self._binary_init(binary)
12172
            self._freeze()
12173
            return
12174
        self.SubscriptionId = 0
12175
        self.RetransmitSequenceNumber = 0
12176
        self._freeze()
12177
12178 1
    def to_binary(self):
12179
        packet = []
12180
        packet.append(uatype_UInt32.pack(self.SubscriptionId))
12181
        packet.append(uatype_UInt32.pack(self.RetransmitSequenceNumber))
12182
        return b''.join(packet)
12183
12184 1
    @staticmethod
12185
    def from_binary(data):
12186
        return RepublishParameters(data)
12187
12188 1
    def _binary_init(self, data):
12189
        self.SubscriptionId = uatype_UInt32.unpack(data.read(4))[0]
12190
        self.RetransmitSequenceNumber = uatype_UInt32.unpack(data.read(4))[0]
12191
12192 1
    def __str__(self):
12193
        return 'RepublishParameters(' + 'SubscriptionId:' + str(self.SubscriptionId) + ', ' + \
12194
               'RetransmitSequenceNumber:' + str(self.RetransmitSequenceNumber) + ')'
12195
12196 1
    __repr__ = __str__
12197
12198
12199 1
class RepublishRequest(FrozenClass):
12200
    '''
12201
    :ivar TypeId:
12202
    :vartype TypeId: NodeId
12203
    :ivar RequestHeader:
12204
    :vartype RequestHeader: RequestHeader
12205
    :ivar Parameters:
12206
    :vartype Parameters: RepublishParameters
12207
    '''
12208 1
    def __init__(self, binary=None):
12209
        if binary is not None:
12210
            self._binary_init(binary)
12211
            self._freeze()
12212
            return
12213
        self.TypeId = FourByteNodeId(ObjectIds.RepublishRequest_Encoding_DefaultBinary)
12214
        self.RequestHeader = RequestHeader()
12215
        self.Parameters = RepublishParameters()
12216
        self._freeze()
12217
12218 1
    def to_binary(self):
12219
        packet = []
12220
        packet.append(self.TypeId.to_binary())
12221
        packet.append(self.RequestHeader.to_binary())
12222
        packet.append(self.Parameters.to_binary())
12223
        return b''.join(packet)
12224
12225 1
    @staticmethod
12226
    def from_binary(data):
12227
        return RepublishRequest(data)
12228
12229 1
    def _binary_init(self, data):
12230
        self.TypeId = NodeId.from_binary(data)
12231
        self.RequestHeader = RequestHeader.from_binary(data)
12232
        self.Parameters = RepublishParameters.from_binary(data)
12233
12234 1
    def __str__(self):
12235
        return 'RepublishRequest(' + 'TypeId:' + str(self.TypeId) + ', ' + \
12236
               'RequestHeader:' + str(self.RequestHeader) + ', ' + \
12237
               'Parameters:' + str(self.Parameters) + ')'
12238
12239 1
    __repr__ = __str__
12240
12241
12242 1
class RepublishResponse(FrozenClass):
12243
    '''
12244
    :ivar TypeId:
12245
    :vartype TypeId: NodeId
12246
    :ivar ResponseHeader:
12247
    :vartype ResponseHeader: ResponseHeader
12248
    :ivar NotificationMessage:
12249
    :vartype NotificationMessage: NotificationMessage
12250
    '''
12251 1
    def __init__(self, binary=None):
12252
        if binary is not None:
12253
            self._binary_init(binary)
12254
            self._freeze()
12255
            return
12256
        self.TypeId = FourByteNodeId(ObjectIds.RepublishResponse_Encoding_DefaultBinary)
12257
        self.ResponseHeader = ResponseHeader()
12258
        self.NotificationMessage = NotificationMessage()
12259
        self._freeze()
12260
12261 1
    def to_binary(self):
12262
        packet = []
12263
        packet.append(self.TypeId.to_binary())
12264
        packet.append(self.ResponseHeader.to_binary())
12265
        packet.append(self.NotificationMessage.to_binary())
12266
        return b''.join(packet)
12267
12268 1
    @staticmethod
12269
    def from_binary(data):
12270
        return RepublishResponse(data)
12271
12272 1
    def _binary_init(self, data):
12273
        self.TypeId = NodeId.from_binary(data)
12274
        self.ResponseHeader = ResponseHeader.from_binary(data)
12275
        self.NotificationMessage = NotificationMessage.from_binary(data)
12276
12277 1
    def __str__(self):
12278
        return 'RepublishResponse(' + 'TypeId:' + str(self.TypeId) + ', ' + \
12279
               'ResponseHeader:' + str(self.ResponseHeader) + ', ' + \
12280
               'NotificationMessage:' + str(self.NotificationMessage) + ')'
12281
12282 1
    __repr__ = __str__
12283
12284
12285 1
class TransferResult(FrozenClass):
12286
    '''
12287
    :ivar StatusCode:
12288
    :vartype StatusCode: StatusCode
12289
    :ivar AvailableSequenceNumbers:
12290
    :vartype AvailableSequenceNumbers: UInt32
12291
    '''
12292 1
    def __init__(self, binary=None):
12293
        if binary is not None:
12294
            self._binary_init(binary)
12295
            self._freeze()
12296
            return
12297
        self.StatusCode = StatusCode()
12298
        self.AvailableSequenceNumbers = []
12299
        self._freeze()
12300
12301 1
    def to_binary(self):
12302
        packet = []
12303
        packet.append(self.StatusCode.to_binary())
12304
        packet.append(uatype_Int32.pack(len(self.AvailableSequenceNumbers)))
12305
        for fieldname in self.AvailableSequenceNumbers:
12306
            packet.append(uatype_UInt32.pack(fieldname))
12307
        return b''.join(packet)
12308
12309 1
    @staticmethod
12310
    def from_binary(data):
12311
        return TransferResult(data)
12312
12313 1
    def _binary_init(self, data):
12314
        self.StatusCode = StatusCode.from_binary(data)
12315
        self.AvailableSequenceNumbers = unpack_uatype_array('UInt32', data)
12316
12317 1
    def __str__(self):
12318
        return 'TransferResult(' + 'StatusCode:' + str(self.StatusCode) + ', ' + \
12319
               'AvailableSequenceNumbers:' + str(self.AvailableSequenceNumbers) + ')'
12320
12321 1
    __repr__ = __str__
12322
12323
12324 1
class TransferSubscriptionsParameters(FrozenClass):
12325
    '''
12326
    :ivar SubscriptionIds:
12327
    :vartype SubscriptionIds: UInt32
12328
    :ivar SendInitialValues:
12329
    :vartype SendInitialValues: Boolean
12330
    '''
12331 1
    def __init__(self, binary=None):
12332
        if binary is not None:
12333
            self._binary_init(binary)
12334
            self._freeze()
12335
            return
12336
        self.SubscriptionIds = []
12337
        self.SendInitialValues = True
12338
        self._freeze()
12339
12340 1
    def to_binary(self):
12341
        packet = []
12342
        packet.append(uatype_Int32.pack(len(self.SubscriptionIds)))
12343
        for fieldname in self.SubscriptionIds:
12344
            packet.append(uatype_UInt32.pack(fieldname))
12345
        packet.append(uatype_Boolean.pack(self.SendInitialValues))
12346
        return b''.join(packet)
12347
12348 1
    @staticmethod
12349
    def from_binary(data):
12350
        return TransferSubscriptionsParameters(data)
12351
12352 1
    def _binary_init(self, data):
12353
        self.SubscriptionIds = unpack_uatype_array('UInt32', data)
12354
        self.SendInitialValues = uatype_Boolean.unpack(data.read(1))[0]
12355
12356 1
    def __str__(self):
12357
        return 'TransferSubscriptionsParameters(' + 'SubscriptionIds:' + str(self.SubscriptionIds) + ', ' + \
12358
               'SendInitialValues:' + str(self.SendInitialValues) + ')'
12359
12360 1
    __repr__ = __str__
12361
12362
12363 1
class TransferSubscriptionsRequest(FrozenClass):
12364
    '''
12365
    :ivar TypeId:
12366
    :vartype TypeId: NodeId
12367
    :ivar RequestHeader:
12368
    :vartype RequestHeader: RequestHeader
12369
    :ivar Parameters:
12370
    :vartype Parameters: TransferSubscriptionsParameters
12371
    '''
12372 1
    def __init__(self, binary=None):
12373
        if binary is not None:
12374
            self._binary_init(binary)
12375
            self._freeze()
12376
            return
12377
        self.TypeId = FourByteNodeId(ObjectIds.TransferSubscriptionsRequest_Encoding_DefaultBinary)
12378
        self.RequestHeader = RequestHeader()
12379
        self.Parameters = TransferSubscriptionsParameters()
12380
        self._freeze()
12381
12382 1
    def to_binary(self):
12383
        packet = []
12384
        packet.append(self.TypeId.to_binary())
12385
        packet.append(self.RequestHeader.to_binary())
12386
        packet.append(self.Parameters.to_binary())
12387
        return b''.join(packet)
12388
12389 1
    @staticmethod
12390
    def from_binary(data):
12391
        return TransferSubscriptionsRequest(data)
12392
12393 1
    def _binary_init(self, data):
12394
        self.TypeId = NodeId.from_binary(data)
12395
        self.RequestHeader = RequestHeader.from_binary(data)
12396
        self.Parameters = TransferSubscriptionsParameters.from_binary(data)
12397
12398 1
    def __str__(self):
12399
        return 'TransferSubscriptionsRequest(' + 'TypeId:' + str(self.TypeId) + ', ' + \
12400
               'RequestHeader:' + str(self.RequestHeader) + ', ' + \
12401
               'Parameters:' + str(self.Parameters) + ')'
12402
12403 1
    __repr__ = __str__
12404
12405
12406 1
class TransferSubscriptionsResult(FrozenClass):
12407
    '''
12408
    :ivar Results:
12409
    :vartype Results: TransferResult
12410
    :ivar DiagnosticInfos:
12411
    :vartype DiagnosticInfos: DiagnosticInfo
12412
    '''
12413 1
    def __init__(self, binary=None):
12414
        if binary is not None:
12415
            self._binary_init(binary)
12416
            self._freeze()
12417
            return
12418
        self.Results = []
12419
        self.DiagnosticInfos = []
12420
        self._freeze()
12421
12422 1
    def to_binary(self):
12423
        packet = []
12424
        packet.append(uatype_Int32.pack(len(self.Results)))
12425
        for fieldname in self.Results:
12426
            packet.append(fieldname.to_binary())
12427
        packet.append(uatype_Int32.pack(len(self.DiagnosticInfos)))
12428
        for fieldname in self.DiagnosticInfos:
12429
            packet.append(fieldname.to_binary())
12430
        return b''.join(packet)
12431
12432 1
    @staticmethod
12433
    def from_binary(data):
12434
        return TransferSubscriptionsResult(data)
12435
12436 1
    def _binary_init(self, data):
12437
        length = uatype_Int32.unpack(data.read(4))[0]
12438
        array = []
12439
        if length != -1:
12440
            for _ in range(0, length):
12441
                array.append(TransferResult.from_binary(data))
12442
        self.Results = array
12443
        length = uatype_Int32.unpack(data.read(4))[0]
12444
        array = []
12445
        if length != -1:
12446
            for _ in range(0, length):
12447
                array.append(DiagnosticInfo.from_binary(data))
12448
        self.DiagnosticInfos = array
12449
12450 1
    def __str__(self):
12451
        return 'TransferSubscriptionsResult(' + 'Results:' + str(self.Results) + ', ' + \
12452
               'DiagnosticInfos:' + str(self.DiagnosticInfos) + ')'
12453
12454 1
    __repr__ = __str__
12455
12456
12457 1
class TransferSubscriptionsResponse(FrozenClass):
12458
    '''
12459
    :ivar TypeId:
12460
    :vartype TypeId: NodeId
12461
    :ivar ResponseHeader:
12462
    :vartype ResponseHeader: ResponseHeader
12463
    :ivar Parameters:
12464
    :vartype Parameters: TransferSubscriptionsResult
12465
    '''
12466 1
    def __init__(self, binary=None):
12467
        if binary is not None:
12468
            self._binary_init(binary)
12469
            self._freeze()
12470
            return
12471
        self.TypeId = FourByteNodeId(ObjectIds.TransferSubscriptionsResponse_Encoding_DefaultBinary)
12472
        self.ResponseHeader = ResponseHeader()
12473
        self.Parameters = TransferSubscriptionsResult()
12474
        self._freeze()
12475
12476 1
    def to_binary(self):
12477
        packet = []
12478
        packet.append(self.TypeId.to_binary())
12479
        packet.append(self.ResponseHeader.to_binary())
12480
        packet.append(self.Parameters.to_binary())
12481
        return b''.join(packet)
12482
12483 1
    @staticmethod
12484
    def from_binary(data):
12485
        return TransferSubscriptionsResponse(data)
12486
12487 1
    def _binary_init(self, data):
12488
        self.TypeId = NodeId.from_binary(data)
12489
        self.ResponseHeader = ResponseHeader.from_binary(data)
12490
        self.Parameters = TransferSubscriptionsResult.from_binary(data)
12491
12492 1
    def __str__(self):
12493
        return 'TransferSubscriptionsResponse(' + 'TypeId:' + str(self.TypeId) + ', ' + \
12494
               'ResponseHeader:' + str(self.ResponseHeader) + ', ' + \
12495
               'Parameters:' + str(self.Parameters) + ')'
12496
12497 1
    __repr__ = __str__
12498
12499
12500 1
class DeleteSubscriptionsParameters(FrozenClass):
12501
    '''
12502
    :ivar SubscriptionIds:
12503
    :vartype SubscriptionIds: UInt32
12504
    '''
12505 1
    def __init__(self, binary=None):
12506 1
        if binary is not None:
12507 1
            self._binary_init(binary)
12508 1
            self._freeze()
12509 1
            return
12510 1
        self.SubscriptionIds = []
12511 1
        self._freeze()
12512
12513 1
    def to_binary(self):
12514 1
        packet = []
12515 1
        packet.append(uatype_Int32.pack(len(self.SubscriptionIds)))
12516 1
        for fieldname in self.SubscriptionIds:
12517 1
            packet.append(uatype_UInt32.pack(fieldname))
12518 1
        return b''.join(packet)
12519
12520 1
    @staticmethod
12521
    def from_binary(data):
12522 1
        return DeleteSubscriptionsParameters(data)
12523
12524 1
    def _binary_init(self, data):
12525 1
        self.SubscriptionIds = unpack_uatype_array('UInt32', data)
12526
12527 1
    def __str__(self):
12528
        return 'DeleteSubscriptionsParameters(' + 'SubscriptionIds:' + str(self.SubscriptionIds) + ')'
12529
12530 1
    __repr__ = __str__
12531
12532
12533 1
class DeleteSubscriptionsRequest(FrozenClass):
12534
    '''
12535
    :ivar TypeId:
12536
    :vartype TypeId: NodeId
12537
    :ivar RequestHeader:
12538
    :vartype RequestHeader: RequestHeader
12539
    :ivar Parameters:
12540
    :vartype Parameters: DeleteSubscriptionsParameters
12541
    '''
12542 1
    def __init__(self, binary=None):
12543 1
        if binary is not None:
12544
            self._binary_init(binary)
12545
            self._freeze()
12546
            return
12547 1
        self.TypeId = FourByteNodeId(ObjectIds.DeleteSubscriptionsRequest_Encoding_DefaultBinary)
12548 1
        self.RequestHeader = RequestHeader()
12549 1
        self.Parameters = DeleteSubscriptionsParameters()
12550 1
        self._freeze()
12551
12552 1
    def to_binary(self):
12553 1
        packet = []
12554 1
        packet.append(self.TypeId.to_binary())
12555 1
        packet.append(self.RequestHeader.to_binary())
12556 1
        packet.append(self.Parameters.to_binary())
12557 1
        return b''.join(packet)
12558
12559 1
    @staticmethod
12560
    def from_binary(data):
12561
        return DeleteSubscriptionsRequest(data)
12562
12563 1
    def _binary_init(self, data):
12564
        self.TypeId = NodeId.from_binary(data)
12565
        self.RequestHeader = RequestHeader.from_binary(data)
12566
        self.Parameters = DeleteSubscriptionsParameters.from_binary(data)
12567
12568 1
    def __str__(self):
12569
        return 'DeleteSubscriptionsRequest(' + 'TypeId:' + str(self.TypeId) + ', ' + \
12570
               'RequestHeader:' + str(self.RequestHeader) + ', ' + \
12571
               'Parameters:' + str(self.Parameters) + ')'
12572
12573 1
    __repr__ = __str__
12574
12575
12576 1
class DeleteSubscriptionsResponse(FrozenClass):
12577
    '''
12578
    :ivar TypeId:
12579
    :vartype TypeId: NodeId
12580
    :ivar ResponseHeader:
12581
    :vartype ResponseHeader: ResponseHeader
12582
    :ivar Results:
12583
    :vartype Results: StatusCode
12584
    :ivar DiagnosticInfos:
12585
    :vartype DiagnosticInfos: DiagnosticInfo
12586
    '''
12587 1
    def __init__(self, binary=None):
12588 1
        if binary is not None:
12589 1
            self._binary_init(binary)
12590 1
            self._freeze()
12591 1
            return
12592 1
        self.TypeId = FourByteNodeId(ObjectIds.DeleteSubscriptionsResponse_Encoding_DefaultBinary)
12593 1
        self.ResponseHeader = ResponseHeader()
12594 1
        self.Results = []
12595 1
        self.DiagnosticInfos = []
12596 1
        self._freeze()
12597
12598 1
    def to_binary(self):
12599 1
        packet = []
12600 1
        packet.append(self.TypeId.to_binary())
12601 1
        packet.append(self.ResponseHeader.to_binary())
12602 1
        packet.append(uatype_Int32.pack(len(self.Results)))
12603 1
        for fieldname in self.Results:
12604 1
            packet.append(fieldname.to_binary())
12605 1
        packet.append(uatype_Int32.pack(len(self.DiagnosticInfos)))
12606 1
        for fieldname in self.DiagnosticInfos:
12607
            packet.append(fieldname.to_binary())
12608 1
        return b''.join(packet)
12609
12610 1
    @staticmethod
12611
    def from_binary(data):
12612 1
        return DeleteSubscriptionsResponse(data)
12613
12614 1
    def _binary_init(self, data):
12615 1
        self.TypeId = NodeId.from_binary(data)
12616 1
        self.ResponseHeader = ResponseHeader.from_binary(data)
12617 1
        length = uatype_Int32.unpack(data.read(4))[0]
12618 1
        array = []
12619 1
        if length != -1:
12620 1
            for _ in range(0, length):
12621 1
                array.append(StatusCode.from_binary(data))
12622 1
        self.Results = array
12623 1
        length = uatype_Int32.unpack(data.read(4))[0]
12624 1
        array = []
12625 1
        if length != -1:
12626 1
            for _ in range(0, length):
12627
                array.append(DiagnosticInfo.from_binary(data))
12628 1
        self.DiagnosticInfos = array
12629
12630 1
    def __str__(self):
12631
        return 'DeleteSubscriptionsResponse(' + 'TypeId:' + str(self.TypeId) + ', ' + \
12632
               'ResponseHeader:' + str(self.ResponseHeader) + ', ' + \
12633
               'Results:' + str(self.Results) + ', ' + \
12634
               'DiagnosticInfos:' + str(self.DiagnosticInfos) + ')'
12635
12636 1
    __repr__ = __str__
12637
12638
12639 1
class BuildInfo(FrozenClass):
12640
    '''
12641
    :ivar ProductUri:
12642
    :vartype ProductUri: String
12643
    :ivar ManufacturerName:
12644
    :vartype ManufacturerName: String
12645
    :ivar ProductName:
12646
    :vartype ProductName: String
12647
    :ivar SoftwareVersion:
12648
    :vartype SoftwareVersion: String
12649
    :ivar BuildNumber:
12650
    :vartype BuildNumber: String
12651
    :ivar BuildDate:
12652
    :vartype BuildDate: DateTime
12653
    '''
12654 1
    def __init__(self, binary=None):
12655
        if binary is not None:
12656
            self._binary_init(binary)
12657
            self._freeze()
12658
            return
12659
        self.ProductUri = ''
12660
        self.ManufacturerName = ''
12661
        self.ProductName = ''
12662
        self.SoftwareVersion = ''
12663
        self.BuildNumber = ''
12664
        self.BuildDate = datetime.now()
12665
        self._freeze()
12666
12667 1
    def to_binary(self):
12668
        packet = []
12669
        packet.append(pack_string(self.ProductUri))
12670
        packet.append(pack_string(self.ManufacturerName))
12671
        packet.append(pack_string(self.ProductName))
12672
        packet.append(pack_string(self.SoftwareVersion))
12673
        packet.append(pack_string(self.BuildNumber))
12674
        packet.append(pack_datetime(self.BuildDate))
12675
        return b''.join(packet)
12676
12677 1
    @staticmethod
12678
    def from_binary(data):
12679
        return BuildInfo(data)
12680
12681 1
    def _binary_init(self, data):
12682
        self.ProductUri = unpack_string(data)
12683
        self.ManufacturerName = unpack_string(data)
12684
        self.ProductName = unpack_string(data)
12685
        self.SoftwareVersion = unpack_string(data)
12686
        self.BuildNumber = unpack_string(data)
12687
        self.BuildDate = unpack_datetime(data)
12688
12689 1
    def __str__(self):
12690
        return 'BuildInfo(' + 'ProductUri:' + str(self.ProductUri) + ', ' + \
12691
               'ManufacturerName:' + str(self.ManufacturerName) + ', ' + \
12692
               'ProductName:' + str(self.ProductName) + ', ' + \
12693
               'SoftwareVersion:' + str(self.SoftwareVersion) + ', ' + \
12694
               'BuildNumber:' + str(self.BuildNumber) + ', ' + \
12695
               'BuildDate:' + str(self.BuildDate) + ')'
12696
12697 1
    __repr__ = __str__
12698
12699
12700 1
class RedundantServerDataType(FrozenClass):
12701
    '''
12702
    :ivar ServerId:
12703
    :vartype ServerId: String
12704
    :ivar ServiceLevel:
12705
    :vartype ServiceLevel: Byte
12706
    :ivar ServerState:
12707
    :vartype ServerState: ServerState
12708
    '''
12709 1
    def __init__(self, binary=None):
12710
        if binary is not None:
12711
            self._binary_init(binary)
12712
            self._freeze()
12713
            return
12714
        self.ServerId = ''
12715
        self.ServiceLevel = 0
12716
        self.ServerState = 0
12717
        self._freeze()
12718
12719 1
    def to_binary(self):
12720
        packet = []
12721
        packet.append(pack_string(self.ServerId))
12722
        packet.append(uatype_Byte.pack(self.ServiceLevel))
12723
        packet.append(uatype_UInt32.pack(self.ServerState))
12724
        return b''.join(packet)
12725
12726 1
    @staticmethod
12727
    def from_binary(data):
12728
        return RedundantServerDataType(data)
12729
12730 1
    def _binary_init(self, data):
12731
        self.ServerId = unpack_string(data)
12732
        self.ServiceLevel = uatype_Byte.unpack(data.read(1))[0]
12733
        self.ServerState = uatype_UInt32.unpack(data.read(4))[0]
12734
12735 1
    def __str__(self):
12736
        return 'RedundantServerDataType(' + 'ServerId:' + str(self.ServerId) + ', ' + \
12737
               'ServiceLevel:' + str(self.ServiceLevel) + ', ' + \
12738
               'ServerState:' + str(self.ServerState) + ')'
12739
12740 1
    __repr__ = __str__
12741
12742
12743 1
class EndpointUrlListDataType(FrozenClass):
12744
    '''
12745
    :ivar EndpointUrlList:
12746
    :vartype EndpointUrlList: String
12747
    '''
12748 1
    def __init__(self, binary=None):
12749
        if binary is not None:
12750
            self._binary_init(binary)
12751
            self._freeze()
12752
            return
12753
        self.EndpointUrlList = []
12754
        self._freeze()
12755
12756 1
    def to_binary(self):
12757
        packet = []
12758
        packet.append(uatype_Int32.pack(len(self.EndpointUrlList)))
12759
        for fieldname in self.EndpointUrlList:
12760
            packet.append(pack_string(fieldname))
12761
        return b''.join(packet)
12762
12763 1
    @staticmethod
12764
    def from_binary(data):
12765
        return EndpointUrlListDataType(data)
12766
12767 1
    def _binary_init(self, data):
12768
        self.EndpointUrlList = unpack_uatype_array('String', data)
12769
12770 1
    def __str__(self):
12771
        return 'EndpointUrlListDataType(' + 'EndpointUrlList:' + str(self.EndpointUrlList) + ')'
12772
12773 1
    __repr__ = __str__
12774
12775
12776 1
class NetworkGroupDataType(FrozenClass):
12777
    '''
12778
    :ivar ServerUri:
12779
    :vartype ServerUri: String
12780
    :ivar NetworkPaths:
12781
    :vartype NetworkPaths: EndpointUrlListDataType
12782
    '''
12783 1
    def __init__(self, binary=None):
12784
        if binary is not None:
12785
            self._binary_init(binary)
12786
            self._freeze()
12787
            return
12788
        self.ServerUri = ''
12789
        self.NetworkPaths = []
12790
        self._freeze()
12791
12792 1
    def to_binary(self):
12793
        packet = []
12794
        packet.append(pack_string(self.ServerUri))
12795
        packet.append(uatype_Int32.pack(len(self.NetworkPaths)))
12796
        for fieldname in self.NetworkPaths:
12797
            packet.append(fieldname.to_binary())
12798
        return b''.join(packet)
12799
12800 1
    @staticmethod
12801
    def from_binary(data):
12802
        return NetworkGroupDataType(data)
12803
12804 1
    def _binary_init(self, data):
12805
        self.ServerUri = unpack_string(data)
12806
        length = uatype_Int32.unpack(data.read(4))[0]
12807
        array = []
12808
        if length != -1:
12809
            for _ in range(0, length):
12810
                array.append(EndpointUrlListDataType.from_binary(data))
12811
        self.NetworkPaths = array
12812
12813 1
    def __str__(self):
12814
        return 'NetworkGroupDataType(' + 'ServerUri:' + str(self.ServerUri) + ', ' + \
12815
               'NetworkPaths:' + str(self.NetworkPaths) + ')'
12816
12817 1
    __repr__ = __str__
12818
12819
12820 1
class SamplingIntervalDiagnosticsDataType(FrozenClass):
12821
    '''
12822
    :ivar SamplingInterval:
12823
    :vartype SamplingInterval: Double
12824
    :ivar MonitoredItemCount:
12825
    :vartype MonitoredItemCount: UInt32
12826
    :ivar MaxMonitoredItemCount:
12827
    :vartype MaxMonitoredItemCount: UInt32
12828
    :ivar DisabledMonitoredItemCount:
12829
    :vartype DisabledMonitoredItemCount: UInt32
12830
    '''
12831 1
    def __init__(self, binary=None):
12832
        if binary is not None:
12833
            self._binary_init(binary)
12834
            self._freeze()
12835
            return
12836
        self.SamplingInterval = 0
12837
        self.MonitoredItemCount = 0
12838
        self.MaxMonitoredItemCount = 0
12839
        self.DisabledMonitoredItemCount = 0
12840
        self._freeze()
12841
12842 1
    def to_binary(self):
12843
        packet = []
12844
        packet.append(uatype_Double.pack(self.SamplingInterval))
12845
        packet.append(uatype_UInt32.pack(self.MonitoredItemCount))
12846
        packet.append(uatype_UInt32.pack(self.MaxMonitoredItemCount))
12847
        packet.append(uatype_UInt32.pack(self.DisabledMonitoredItemCount))
12848
        return b''.join(packet)
12849
12850 1
    @staticmethod
12851
    def from_binary(data):
12852
        return SamplingIntervalDiagnosticsDataType(data)
12853
12854 1
    def _binary_init(self, data):
12855
        self.SamplingInterval = uatype_Double.unpack(data.read(8))[0]
12856
        self.MonitoredItemCount = uatype_UInt32.unpack(data.read(4))[0]
12857
        self.MaxMonitoredItemCount = uatype_UInt32.unpack(data.read(4))[0]
12858
        self.DisabledMonitoredItemCount = uatype_UInt32.unpack(data.read(4))[0]
12859
12860 1
    def __str__(self):
12861
        return 'SamplingIntervalDiagnosticsDataType(' + 'SamplingInterval:' + str(self.SamplingInterval) + ', ' + \
12862
               'MonitoredItemCount:' + str(self.MonitoredItemCount) + ', ' + \
12863
               'MaxMonitoredItemCount:' + str(self.MaxMonitoredItemCount) + ', ' + \
12864
               'DisabledMonitoredItemCount:' + str(self.DisabledMonitoredItemCount) + ')'
12865
12866 1
    __repr__ = __str__
12867
12868
12869 1
class ServerDiagnosticsSummaryDataType(FrozenClass):
12870
    '''
12871
    :ivar ServerViewCount:
12872
    :vartype ServerViewCount: UInt32
12873
    :ivar CurrentSessionCount:
12874
    :vartype CurrentSessionCount: UInt32
12875
    :ivar CumulatedSessionCount:
12876
    :vartype CumulatedSessionCount: UInt32
12877
    :ivar SecurityRejectedSessionCount:
12878
    :vartype SecurityRejectedSessionCount: UInt32
12879
    :ivar RejectedSessionCount:
12880
    :vartype RejectedSessionCount: UInt32
12881
    :ivar SessionTimeoutCount:
12882
    :vartype SessionTimeoutCount: UInt32
12883
    :ivar SessionAbortCount:
12884
    :vartype SessionAbortCount: UInt32
12885
    :ivar CurrentSubscriptionCount:
12886
    :vartype CurrentSubscriptionCount: UInt32
12887
    :ivar CumulatedSubscriptionCount:
12888
    :vartype CumulatedSubscriptionCount: UInt32
12889
    :ivar PublishingIntervalCount:
12890
    :vartype PublishingIntervalCount: UInt32
12891
    :ivar SecurityRejectedRequestsCount:
12892
    :vartype SecurityRejectedRequestsCount: UInt32
12893
    :ivar RejectedRequestsCount:
12894
    :vartype RejectedRequestsCount: UInt32
12895
    '''
12896 1
    def __init__(self, binary=None):
12897
        if binary is not None:
12898
            self._binary_init(binary)
12899
            self._freeze()
12900
            return
12901
        self.ServerViewCount = 0
12902
        self.CurrentSessionCount = 0
12903
        self.CumulatedSessionCount = 0
12904
        self.SecurityRejectedSessionCount = 0
12905
        self.RejectedSessionCount = 0
12906
        self.SessionTimeoutCount = 0
12907
        self.SessionAbortCount = 0
12908
        self.CurrentSubscriptionCount = 0
12909
        self.CumulatedSubscriptionCount = 0
12910
        self.PublishingIntervalCount = 0
12911
        self.SecurityRejectedRequestsCount = 0
12912
        self.RejectedRequestsCount = 0
12913
        self._freeze()
12914
12915 1
    def to_binary(self):
12916
        packet = []
12917
        packet.append(uatype_UInt32.pack(self.ServerViewCount))
12918
        packet.append(uatype_UInt32.pack(self.CurrentSessionCount))
12919
        packet.append(uatype_UInt32.pack(self.CumulatedSessionCount))
12920
        packet.append(uatype_UInt32.pack(self.SecurityRejectedSessionCount))
12921
        packet.append(uatype_UInt32.pack(self.RejectedSessionCount))
12922
        packet.append(uatype_UInt32.pack(self.SessionTimeoutCount))
12923
        packet.append(uatype_UInt32.pack(self.SessionAbortCount))
12924
        packet.append(uatype_UInt32.pack(self.CurrentSubscriptionCount))
12925
        packet.append(uatype_UInt32.pack(self.CumulatedSubscriptionCount))
12926
        packet.append(uatype_UInt32.pack(self.PublishingIntervalCount))
12927
        packet.append(uatype_UInt32.pack(self.SecurityRejectedRequestsCount))
12928
        packet.append(uatype_UInt32.pack(self.RejectedRequestsCount))
12929
        return b''.join(packet)
12930
12931 1
    @staticmethod
12932
    def from_binary(data):
12933
        return ServerDiagnosticsSummaryDataType(data)
12934
12935 1
    def _binary_init(self, data):
12936
        self.ServerViewCount = uatype_UInt32.unpack(data.read(4))[0]
12937
        self.CurrentSessionCount = uatype_UInt32.unpack(data.read(4))[0]
12938
        self.CumulatedSessionCount = uatype_UInt32.unpack(data.read(4))[0]
12939
        self.SecurityRejectedSessionCount = uatype_UInt32.unpack(data.read(4))[0]
12940
        self.RejectedSessionCount = uatype_UInt32.unpack(data.read(4))[0]
12941
        self.SessionTimeoutCount = uatype_UInt32.unpack(data.read(4))[0]
12942
        self.SessionAbortCount = uatype_UInt32.unpack(data.read(4))[0]
12943
        self.CurrentSubscriptionCount = uatype_UInt32.unpack(data.read(4))[0]
12944
        self.CumulatedSubscriptionCount = uatype_UInt32.unpack(data.read(4))[0]
12945
        self.PublishingIntervalCount = uatype_UInt32.unpack(data.read(4))[0]
12946
        self.SecurityRejectedRequestsCount = uatype_UInt32.unpack(data.read(4))[0]
12947
        self.RejectedRequestsCount = uatype_UInt32.unpack(data.read(4))[0]
12948
12949 1
    def __str__(self):
12950
        return 'ServerDiagnosticsSummaryDataType(' + 'ServerViewCount:' + str(self.ServerViewCount) + ', ' + \
12951
               'CurrentSessionCount:' + str(self.CurrentSessionCount) + ', ' + \
12952
               'CumulatedSessionCount:' + str(self.CumulatedSessionCount) + ', ' + \
12953
               'SecurityRejectedSessionCount:' + str(self.SecurityRejectedSessionCount) + ', ' + \
12954
               'RejectedSessionCount:' + str(self.RejectedSessionCount) + ', ' + \
12955
               'SessionTimeoutCount:' + str(self.SessionTimeoutCount) + ', ' + \
12956
               'SessionAbortCount:' + str(self.SessionAbortCount) + ', ' + \
12957
               'CurrentSubscriptionCount:' + str(self.CurrentSubscriptionCount) + ', ' + \
12958
               'CumulatedSubscriptionCount:' + str(self.CumulatedSubscriptionCount) + ', ' + \
12959
               'PublishingIntervalCount:' + str(self.PublishingIntervalCount) + ', ' + \
12960
               'SecurityRejectedRequestsCount:' + str(self.SecurityRejectedRequestsCount) + ', ' + \
12961
               'RejectedRequestsCount:' + str(self.RejectedRequestsCount) + ')'
12962
12963 1
    __repr__ = __str__
12964
12965
12966 1
class ServerStatusDataType(FrozenClass):
12967
    '''
12968
    :ivar StartTime:
12969
    :vartype StartTime: DateTime
12970
    :ivar CurrentTime:
12971
    :vartype CurrentTime: DateTime
12972
    :ivar State:
12973
    :vartype State: ServerState
12974
    :ivar BuildInfo:
12975
    :vartype BuildInfo: BuildInfo
12976
    :ivar SecondsTillShutdown:
12977
    :vartype SecondsTillShutdown: UInt32
12978
    :ivar ShutdownReason:
12979
    :vartype ShutdownReason: LocalizedText
12980
    '''
12981 1
    def __init__(self, binary=None):
12982
        if binary is not None:
12983
            self._binary_init(binary)
12984
            self._freeze()
12985
            return
12986
        self.StartTime = datetime.now()
12987
        self.CurrentTime = datetime.now()
12988
        self.State = 0
12989
        self.BuildInfo = BuildInfo()
12990
        self.SecondsTillShutdown = 0
12991
        self.ShutdownReason = LocalizedText()
12992
        self._freeze()
12993
12994 1
    def to_binary(self):
12995
        packet = []
12996
        packet.append(pack_datetime(self.StartTime))
12997
        packet.append(pack_datetime(self.CurrentTime))
12998
        packet.append(uatype_UInt32.pack(self.State))
12999
        packet.append(self.BuildInfo.to_binary())
13000
        packet.append(uatype_UInt32.pack(self.SecondsTillShutdown))
13001
        packet.append(self.ShutdownReason.to_binary())
13002
        return b''.join(packet)
13003
13004 1
    @staticmethod
13005
    def from_binary(data):
13006
        return ServerStatusDataType(data)
13007
13008 1
    def _binary_init(self, data):
13009
        self.StartTime = unpack_datetime(data)
13010
        self.CurrentTime = unpack_datetime(data)
13011
        self.State = uatype_UInt32.unpack(data.read(4))[0]
13012
        self.BuildInfo = BuildInfo.from_binary(data)
13013
        self.SecondsTillShutdown = uatype_UInt32.unpack(data.read(4))[0]
13014
        self.ShutdownReason = LocalizedText.from_binary(data)
13015
13016 1
    def __str__(self):
13017
        return 'ServerStatusDataType(' + 'StartTime:' + str(self.StartTime) + ', ' + \
13018
               'CurrentTime:' + str(self.CurrentTime) + ', ' + \
13019
               'State:' + str(self.State) + ', ' + \
13020
               'BuildInfo:' + str(self.BuildInfo) + ', ' + \
13021
               'SecondsTillShutdown:' + str(self.SecondsTillShutdown) + ', ' + \
13022
               'ShutdownReason:' + str(self.ShutdownReason) + ')'
13023
13024 1
    __repr__ = __str__
13025
13026
13027 1
class SessionDiagnosticsDataType(FrozenClass):
13028
    '''
13029
    :ivar SessionId:
13030
    :vartype SessionId: NodeId
13031
    :ivar SessionName:
13032
    :vartype SessionName: String
13033
    :ivar ClientDescription:
13034
    :vartype ClientDescription: ApplicationDescription
13035
    :ivar ServerUri:
13036
    :vartype ServerUri: String
13037
    :ivar EndpointUrl:
13038
    :vartype EndpointUrl: String
13039
    :ivar LocaleIds:
13040
    :vartype LocaleIds: String
13041
    :ivar ActualSessionTimeout:
13042
    :vartype ActualSessionTimeout: Double
13043
    :ivar MaxResponseMessageSize:
13044
    :vartype MaxResponseMessageSize: UInt32
13045
    :ivar ClientConnectionTime:
13046
    :vartype ClientConnectionTime: DateTime
13047
    :ivar ClientLastContactTime:
13048
    :vartype ClientLastContactTime: DateTime
13049
    :ivar CurrentSubscriptionsCount:
13050
    :vartype CurrentSubscriptionsCount: UInt32
13051
    :ivar CurrentMonitoredItemsCount:
13052
    :vartype CurrentMonitoredItemsCount: UInt32
13053
    :ivar CurrentPublishRequestsInQueue:
13054
    :vartype CurrentPublishRequestsInQueue: UInt32
13055
    :ivar TotalRequestCount:
13056
    :vartype TotalRequestCount: ServiceCounterDataType
13057
    :ivar UnauthorizedRequestCount:
13058
    :vartype UnauthorizedRequestCount: UInt32
13059
    :ivar ReadCount:
13060
    :vartype ReadCount: ServiceCounterDataType
13061
    :ivar HistoryReadCount:
13062
    :vartype HistoryReadCount: ServiceCounterDataType
13063
    :ivar WriteCount:
13064
    :vartype WriteCount: ServiceCounterDataType
13065
    :ivar HistoryUpdateCount:
13066
    :vartype HistoryUpdateCount: ServiceCounterDataType
13067
    :ivar CallCount:
13068
    :vartype CallCount: ServiceCounterDataType
13069
    :ivar CreateMonitoredItemsCount:
13070
    :vartype CreateMonitoredItemsCount: ServiceCounterDataType
13071
    :ivar ModifyMonitoredItemsCount:
13072
    :vartype ModifyMonitoredItemsCount: ServiceCounterDataType
13073
    :ivar SetMonitoringModeCount:
13074
    :vartype SetMonitoringModeCount: ServiceCounterDataType
13075
    :ivar SetTriggeringCount:
13076
    :vartype SetTriggeringCount: ServiceCounterDataType
13077
    :ivar DeleteMonitoredItemsCount:
13078
    :vartype DeleteMonitoredItemsCount: ServiceCounterDataType
13079
    :ivar CreateSubscriptionCount:
13080
    :vartype CreateSubscriptionCount: ServiceCounterDataType
13081
    :ivar ModifySubscriptionCount:
13082
    :vartype ModifySubscriptionCount: ServiceCounterDataType
13083
    :ivar SetPublishingModeCount:
13084
    :vartype SetPublishingModeCount: ServiceCounterDataType
13085
    :ivar PublishCount:
13086
    :vartype PublishCount: ServiceCounterDataType
13087
    :ivar RepublishCount:
13088
    :vartype RepublishCount: ServiceCounterDataType
13089
    :ivar TransferSubscriptionsCount:
13090
    :vartype TransferSubscriptionsCount: ServiceCounterDataType
13091
    :ivar DeleteSubscriptionsCount:
13092
    :vartype DeleteSubscriptionsCount: ServiceCounterDataType
13093
    :ivar AddNodesCount:
13094
    :vartype AddNodesCount: ServiceCounterDataType
13095
    :ivar AddReferencesCount:
13096
    :vartype AddReferencesCount: ServiceCounterDataType
13097
    :ivar DeleteNodesCount:
13098
    :vartype DeleteNodesCount: ServiceCounterDataType
13099
    :ivar DeleteReferencesCount:
13100
    :vartype DeleteReferencesCount: ServiceCounterDataType
13101
    :ivar BrowseCount:
13102
    :vartype BrowseCount: ServiceCounterDataType
13103
    :ivar BrowseNextCount:
13104
    :vartype BrowseNextCount: ServiceCounterDataType
13105
    :ivar TranslateBrowsePathsToNodeIdsCount:
13106
    :vartype TranslateBrowsePathsToNodeIdsCount: ServiceCounterDataType
13107
    :ivar QueryFirstCount:
13108
    :vartype QueryFirstCount: ServiceCounterDataType
13109
    :ivar QueryNextCount:
13110
    :vartype QueryNextCount: ServiceCounterDataType
13111
    :ivar RegisterNodesCount:
13112
    :vartype RegisterNodesCount: ServiceCounterDataType
13113
    :ivar UnregisterNodesCount:
13114
    :vartype UnregisterNodesCount: ServiceCounterDataType
13115
    '''
13116 1
    def __init__(self, binary=None):
13117
        if binary is not None:
13118
            self._binary_init(binary)
13119
            self._freeze()
13120
            return
13121
        self.SessionId = NodeId()
13122
        self.SessionName = ''
13123
        self.ClientDescription = ApplicationDescription()
13124
        self.ServerUri = ''
13125
        self.EndpointUrl = ''
13126
        self.LocaleIds = []
13127
        self.ActualSessionTimeout = 0
13128
        self.MaxResponseMessageSize = 0
13129
        self.ClientConnectionTime = datetime.now()
13130
        self.ClientLastContactTime = datetime.now()
13131
        self.CurrentSubscriptionsCount = 0
13132
        self.CurrentMonitoredItemsCount = 0
13133
        self.CurrentPublishRequestsInQueue = 0
13134
        self.TotalRequestCount = ServiceCounterDataType()
13135
        self.UnauthorizedRequestCount = 0
13136
        self.ReadCount = ServiceCounterDataType()
13137
        self.HistoryReadCount = ServiceCounterDataType()
13138
        self.WriteCount = ServiceCounterDataType()
13139
        self.HistoryUpdateCount = ServiceCounterDataType()
13140
        self.CallCount = ServiceCounterDataType()
13141
        self.CreateMonitoredItemsCount = ServiceCounterDataType()
13142
        self.ModifyMonitoredItemsCount = ServiceCounterDataType()
13143
        self.SetMonitoringModeCount = ServiceCounterDataType()
13144
        self.SetTriggeringCount = ServiceCounterDataType()
13145
        self.DeleteMonitoredItemsCount = ServiceCounterDataType()
13146
        self.CreateSubscriptionCount = ServiceCounterDataType()
13147
        self.ModifySubscriptionCount = ServiceCounterDataType()
13148
        self.SetPublishingModeCount = ServiceCounterDataType()
13149
        self.PublishCount = ServiceCounterDataType()
13150
        self.RepublishCount = ServiceCounterDataType()
13151
        self.TransferSubscriptionsCount = ServiceCounterDataType()
13152
        self.DeleteSubscriptionsCount = ServiceCounterDataType()
13153
        self.AddNodesCount = ServiceCounterDataType()
13154
        self.AddReferencesCount = ServiceCounterDataType()
13155
        self.DeleteNodesCount = ServiceCounterDataType()
13156
        self.DeleteReferencesCount = ServiceCounterDataType()
13157
        self.BrowseCount = ServiceCounterDataType()
13158
        self.BrowseNextCount = ServiceCounterDataType()
13159
        self.TranslateBrowsePathsToNodeIdsCount = ServiceCounterDataType()
13160
        self.QueryFirstCount = ServiceCounterDataType()
13161
        self.QueryNextCount = ServiceCounterDataType()
13162
        self.RegisterNodesCount = ServiceCounterDataType()
13163
        self.UnregisterNodesCount = ServiceCounterDataType()
13164
        self._freeze()
13165
13166 1
    def to_binary(self):
13167
        packet = []
13168
        packet.append(self.SessionId.to_binary())
13169
        packet.append(pack_string(self.SessionName))
13170
        packet.append(self.ClientDescription.to_binary())
13171
        packet.append(pack_string(self.ServerUri))
13172
        packet.append(pack_string(self.EndpointUrl))
13173
        packet.append(uatype_Int32.pack(len(self.LocaleIds)))
13174
        for fieldname in self.LocaleIds:
13175
            packet.append(pack_string(fieldname))
13176
        packet.append(uatype_Double.pack(self.ActualSessionTimeout))
13177
        packet.append(uatype_UInt32.pack(self.MaxResponseMessageSize))
13178
        packet.append(pack_datetime(self.ClientConnectionTime))
13179
        packet.append(pack_datetime(self.ClientLastContactTime))
13180
        packet.append(uatype_UInt32.pack(self.CurrentSubscriptionsCount))
13181
        packet.append(uatype_UInt32.pack(self.CurrentMonitoredItemsCount))
13182
        packet.append(uatype_UInt32.pack(self.CurrentPublishRequestsInQueue))
13183
        packet.append(self.TotalRequestCount.to_binary())
13184
        packet.append(uatype_UInt32.pack(self.UnauthorizedRequestCount))
13185
        packet.append(self.ReadCount.to_binary())
13186
        packet.append(self.HistoryReadCount.to_binary())
13187
        packet.append(self.WriteCount.to_binary())
13188
        packet.append(self.HistoryUpdateCount.to_binary())
13189
        packet.append(self.CallCount.to_binary())
13190
        packet.append(self.CreateMonitoredItemsCount.to_binary())
13191
        packet.append(self.ModifyMonitoredItemsCount.to_binary())
13192
        packet.append(self.SetMonitoringModeCount.to_binary())
13193
        packet.append(self.SetTriggeringCount.to_binary())
13194
        packet.append(self.DeleteMonitoredItemsCount.to_binary())
13195
        packet.append(self.CreateSubscriptionCount.to_binary())
13196
        packet.append(self.ModifySubscriptionCount.to_binary())
13197
        packet.append(self.SetPublishingModeCount.to_binary())
13198
        packet.append(self.PublishCount.to_binary())
13199
        packet.append(self.RepublishCount.to_binary())
13200
        packet.append(self.TransferSubscriptionsCount.to_binary())
13201
        packet.append(self.DeleteSubscriptionsCount.to_binary())
13202
        packet.append(self.AddNodesCount.to_binary())
13203
        packet.append(self.AddReferencesCount.to_binary())
13204
        packet.append(self.DeleteNodesCount.to_binary())
13205
        packet.append(self.DeleteReferencesCount.to_binary())
13206
        packet.append(self.BrowseCount.to_binary())
13207
        packet.append(self.BrowseNextCount.to_binary())
13208
        packet.append(self.TranslateBrowsePathsToNodeIdsCount.to_binary())
13209
        packet.append(self.QueryFirstCount.to_binary())
13210
        packet.append(self.QueryNextCount.to_binary())
13211
        packet.append(self.RegisterNodesCount.to_binary())
13212
        packet.append(self.UnregisterNodesCount.to_binary())
13213
        return b''.join(packet)
13214
13215 1
    @staticmethod
13216
    def from_binary(data):
13217
        return SessionDiagnosticsDataType(data)
13218
13219 1
    def _binary_init(self, data):
13220
        self.SessionId = NodeId.from_binary(data)
13221
        self.SessionName = unpack_string(data)
13222
        self.ClientDescription = ApplicationDescription.from_binary(data)
13223
        self.ServerUri = unpack_string(data)
13224
        self.EndpointUrl = unpack_string(data)
13225
        self.LocaleIds = unpack_uatype_array('String', data)
13226
        self.ActualSessionTimeout = uatype_Double.unpack(data.read(8))[0]
13227
        self.MaxResponseMessageSize = uatype_UInt32.unpack(data.read(4))[0]
13228
        self.ClientConnectionTime = unpack_datetime(data)
13229
        self.ClientLastContactTime = unpack_datetime(data)
13230
        self.CurrentSubscriptionsCount = uatype_UInt32.unpack(data.read(4))[0]
13231
        self.CurrentMonitoredItemsCount = uatype_UInt32.unpack(data.read(4))[0]
13232
        self.CurrentPublishRequestsInQueue = uatype_UInt32.unpack(data.read(4))[0]
13233
        self.TotalRequestCount = ServiceCounterDataType.from_binary(data)
13234
        self.UnauthorizedRequestCount = uatype_UInt32.unpack(data.read(4))[0]
13235
        self.ReadCount = ServiceCounterDataType.from_binary(data)
13236
        self.HistoryReadCount = ServiceCounterDataType.from_binary(data)
13237
        self.WriteCount = ServiceCounterDataType.from_binary(data)
13238
        self.HistoryUpdateCount = ServiceCounterDataType.from_binary(data)
13239
        self.CallCount = ServiceCounterDataType.from_binary(data)
13240
        self.CreateMonitoredItemsCount = ServiceCounterDataType.from_binary(data)
13241
        self.ModifyMonitoredItemsCount = ServiceCounterDataType.from_binary(data)
13242
        self.SetMonitoringModeCount = ServiceCounterDataType.from_binary(data)
13243
        self.SetTriggeringCount = ServiceCounterDataType.from_binary(data)
13244
        self.DeleteMonitoredItemsCount = ServiceCounterDataType.from_binary(data)
13245
        self.CreateSubscriptionCount = ServiceCounterDataType.from_binary(data)
13246
        self.ModifySubscriptionCount = ServiceCounterDataType.from_binary(data)
13247
        self.SetPublishingModeCount = ServiceCounterDataType.from_binary(data)
13248
        self.PublishCount = ServiceCounterDataType.from_binary(data)
13249
        self.RepublishCount = ServiceCounterDataType.from_binary(data)
13250
        self.TransferSubscriptionsCount = ServiceCounterDataType.from_binary(data)
13251
        self.DeleteSubscriptionsCount = ServiceCounterDataType.from_binary(data)
13252
        self.AddNodesCount = ServiceCounterDataType.from_binary(data)
13253
        self.AddReferencesCount = ServiceCounterDataType.from_binary(data)
13254
        self.DeleteNodesCount = ServiceCounterDataType.from_binary(data)
13255
        self.DeleteReferencesCount = ServiceCounterDataType.from_binary(data)
13256
        self.BrowseCount = ServiceCounterDataType.from_binary(data)
13257
        self.BrowseNextCount = ServiceCounterDataType.from_binary(data)
13258
        self.TranslateBrowsePathsToNodeIdsCount = ServiceCounterDataType.from_binary(data)
13259
        self.QueryFirstCount = ServiceCounterDataType.from_binary(data)
13260
        self.QueryNextCount = ServiceCounterDataType.from_binary(data)
13261
        self.RegisterNodesCount = ServiceCounterDataType.from_binary(data)
13262
        self.UnregisterNodesCount = ServiceCounterDataType.from_binary(data)
13263
13264 1
    def __str__(self):
13265
        return 'SessionDiagnosticsDataType(' + 'SessionId:' + str(self.SessionId) + ', ' + \
13266
               'SessionName:' + str(self.SessionName) + ', ' + \
13267
               'ClientDescription:' + str(self.ClientDescription) + ', ' + \
13268
               'ServerUri:' + str(self.ServerUri) + ', ' + \
13269
               'EndpointUrl:' + str(self.EndpointUrl) + ', ' + \
13270
               'LocaleIds:' + str(self.LocaleIds) + ', ' + \
13271
               'ActualSessionTimeout:' + str(self.ActualSessionTimeout) + ', ' + \
13272
               'MaxResponseMessageSize:' + str(self.MaxResponseMessageSize) + ', ' + \
13273
               'ClientConnectionTime:' + str(self.ClientConnectionTime) + ', ' + \
13274
               'ClientLastContactTime:' + str(self.ClientLastContactTime) + ', ' + \
13275
               'CurrentSubscriptionsCount:' + str(self.CurrentSubscriptionsCount) + ', ' + \
13276
               'CurrentMonitoredItemsCount:' + str(self.CurrentMonitoredItemsCount) + ', ' + \
13277
               'CurrentPublishRequestsInQueue:' + str(self.CurrentPublishRequestsInQueue) + ', ' + \
13278
               'TotalRequestCount:' + str(self.TotalRequestCount) + ', ' + \
13279
               'UnauthorizedRequestCount:' + str(self.UnauthorizedRequestCount) + ', ' + \
13280
               'ReadCount:' + str(self.ReadCount) + ', ' + \
13281
               'HistoryReadCount:' + str(self.HistoryReadCount) + ', ' + \
13282
               'WriteCount:' + str(self.WriteCount) + ', ' + \
13283
               'HistoryUpdateCount:' + str(self.HistoryUpdateCount) + ', ' + \
13284
               'CallCount:' + str(self.CallCount) + ', ' + \
13285
               'CreateMonitoredItemsCount:' + str(self.CreateMonitoredItemsCount) + ', ' + \
13286
               'ModifyMonitoredItemsCount:' + str(self.ModifyMonitoredItemsCount) + ', ' + \
13287
               'SetMonitoringModeCount:' + str(self.SetMonitoringModeCount) + ', ' + \
13288
               'SetTriggeringCount:' + str(self.SetTriggeringCount) + ', ' + \
13289
               'DeleteMonitoredItemsCount:' + str(self.DeleteMonitoredItemsCount) + ', ' + \
13290
               'CreateSubscriptionCount:' + str(self.CreateSubscriptionCount) + ', ' + \
13291
               'ModifySubscriptionCount:' + str(self.ModifySubscriptionCount) + ', ' + \
13292
               'SetPublishingModeCount:' + str(self.SetPublishingModeCount) + ', ' + \
13293
               'PublishCount:' + str(self.PublishCount) + ', ' + \
13294
               'RepublishCount:' + str(self.RepublishCount) + ', ' + \
13295
               'TransferSubscriptionsCount:' + str(self.TransferSubscriptionsCount) + ', ' + \
13296
               'DeleteSubscriptionsCount:' + str(self.DeleteSubscriptionsCount) + ', ' + \
13297
               'AddNodesCount:' + str(self.AddNodesCount) + ', ' + \
13298
               'AddReferencesCount:' + str(self.AddReferencesCount) + ', ' + \
13299
               'DeleteNodesCount:' + str(self.DeleteNodesCount) + ', ' + \
13300
               'DeleteReferencesCount:' + str(self.DeleteReferencesCount) + ', ' + \
13301
               'BrowseCount:' + str(self.BrowseCount) + ', ' + \
13302
               'BrowseNextCount:' + str(self.BrowseNextCount) + ', ' + \
13303
               'TranslateBrowsePathsToNodeIdsCount:' + str(self.TranslateBrowsePathsToNodeIdsCount) + ', ' + \
13304
               'QueryFirstCount:' + str(self.QueryFirstCount) + ', ' + \
13305
               'QueryNextCount:' + str(self.QueryNextCount) + ', ' + \
13306
               'RegisterNodesCount:' + str(self.RegisterNodesCount) + ', ' + \
13307
               'UnregisterNodesCount:' + str(self.UnregisterNodesCount) + ')'
13308
13309 1
    __repr__ = __str__
13310
13311
13312 1
class SessionSecurityDiagnosticsDataType(FrozenClass):
13313
    '''
13314
    :ivar SessionId:
13315
    :vartype SessionId: NodeId
13316
    :ivar ClientUserIdOfSession:
13317
    :vartype ClientUserIdOfSession: String
13318
    :ivar ClientUserIdHistory:
13319
    :vartype ClientUserIdHistory: String
13320
    :ivar AuthenticationMechanism:
13321
    :vartype AuthenticationMechanism: String
13322
    :ivar Encoding:
13323
    :vartype Encoding: String
13324
    :ivar TransportProtocol:
13325
    :vartype TransportProtocol: String
13326
    :ivar SecurityMode:
13327
    :vartype SecurityMode: MessageSecurityMode
13328
    :ivar SecurityPolicyUri:
13329
    :vartype SecurityPolicyUri: String
13330
    :ivar ClientCertificate:
13331
    :vartype ClientCertificate: ByteString
13332
    '''
13333 1
    def __init__(self, binary=None):
13334
        if binary is not None:
13335
            self._binary_init(binary)
13336
            self._freeze()
13337
            return
13338
        self.SessionId = NodeId()
13339
        self.ClientUserIdOfSession = ''
13340
        self.ClientUserIdHistory = []
13341
        self.AuthenticationMechanism = ''
13342
        self.Encoding = ''
13343
        self.TransportProtocol = ''
13344
        self.SecurityMode = 0
13345
        self.SecurityPolicyUri = ''
13346
        self.ClientCertificate = b''
13347
        self._freeze()
13348
13349 1
    def to_binary(self):
13350
        packet = []
13351
        packet.append(self.SessionId.to_binary())
13352
        packet.append(pack_string(self.ClientUserIdOfSession))
13353
        packet.append(uatype_Int32.pack(len(self.ClientUserIdHistory)))
13354
        for fieldname in self.ClientUserIdHistory:
13355
            packet.append(pack_string(fieldname))
13356
        packet.append(pack_string(self.AuthenticationMechanism))
13357
        packet.append(pack_string(self.Encoding))
13358
        packet.append(pack_string(self.TransportProtocol))
13359
        packet.append(uatype_UInt32.pack(self.SecurityMode))
13360
        packet.append(pack_string(self.SecurityPolicyUri))
13361
        packet.append(pack_bytes(self.ClientCertificate))
13362
        return b''.join(packet)
13363
13364 1
    @staticmethod
13365
    def from_binary(data):
13366
        return SessionSecurityDiagnosticsDataType(data)
13367
13368 1
    def _binary_init(self, data):
13369
        self.SessionId = NodeId.from_binary(data)
13370
        self.ClientUserIdOfSession = unpack_string(data)
13371
        self.ClientUserIdHistory = unpack_uatype_array('String', data)
13372
        self.AuthenticationMechanism = unpack_string(data)
13373
        self.Encoding = unpack_string(data)
13374
        self.TransportProtocol = unpack_string(data)
13375
        self.SecurityMode = uatype_UInt32.unpack(data.read(4))[0]
13376
        self.SecurityPolicyUri = unpack_string(data)
13377
        self.ClientCertificate = unpack_bytes(data)
13378
13379 1
    def __str__(self):
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
13380
        return 'SessionSecurityDiagnosticsDataType(' + 'SessionId:' + str(self.SessionId) + ', ' + \
13381
               'ClientUserIdOfSession:' + str(self.ClientUserIdOfSession) + ', ' + \
13382
               'ClientUserIdHistory:' + str(self.ClientUserIdHistory) + ', ' + \
13383
               'AuthenticationMechanism:' + str(self.AuthenticationMechanism) + ', ' + \
13384
               'Encoding:' + str(self.Encoding) + ', ' + \
13385
               'TransportProtocol:' + str(self.TransportProtocol) + ', ' + \
13386
               'SecurityMode:' + str(self.SecurityMode) + ', ' + \
13387
               'SecurityPolicyUri:' + str(self.SecurityPolicyUri) + ', ' + \
13388
               'ClientCertificate:' + str(self.ClientCertificate) + ')'
13389
13390 1
    __repr__ = __str__
13391
13392
13393 1
class ServiceCounterDataType(FrozenClass):
13394
    '''
13395
    :ivar TotalCount:
13396
    :vartype TotalCount: UInt32
13397
    :ivar ErrorCount:
13398
    :vartype ErrorCount: UInt32
13399
    '''
13400 1
    def __init__(self, binary=None):
13401
        if binary is not None:
13402
            self._binary_init(binary)
13403
            self._freeze()
13404
            return
13405
        self.TotalCount = 0
13406
        self.ErrorCount = 0
13407
        self._freeze()
13408
13409 1
    def to_binary(self):
13410
        packet = []
13411
        packet.append(uatype_UInt32.pack(self.TotalCount))
13412
        packet.append(uatype_UInt32.pack(self.ErrorCount))
13413
        return b''.join(packet)
13414
13415 1
    @staticmethod
13416
    def from_binary(data):
13417
        return ServiceCounterDataType(data)
13418
13419 1
    def _binary_init(self, data):
13420
        self.TotalCount = uatype_UInt32.unpack(data.read(4))[0]
13421
        self.ErrorCount = uatype_UInt32.unpack(data.read(4))[0]
13422
13423 1
    def __str__(self):
13424
        return 'ServiceCounterDataType(' + 'TotalCount:' + str(self.TotalCount) + ', ' + \
13425
               'ErrorCount:' + str(self.ErrorCount) + ')'
13426
13427 1
    __repr__ = __str__
13428
13429
13430 1
class StatusResult(FrozenClass):
13431
    '''
13432
    :ivar StatusCode:
13433
    :vartype StatusCode: StatusCode
13434
    :ivar DiagnosticInfo:
13435
    :vartype DiagnosticInfo: DiagnosticInfo
13436
    '''
13437 1
    def __init__(self, binary=None):
13438
        if binary is not None:
13439
            self._binary_init(binary)
13440
            self._freeze()
13441
            return
13442
        self.StatusCode = StatusCode()
13443
        self.DiagnosticInfo = DiagnosticInfo()
13444
        self._freeze()
13445
13446 1
    def to_binary(self):
13447
        packet = []
13448
        packet.append(self.StatusCode.to_binary())
13449
        packet.append(self.DiagnosticInfo.to_binary())
13450
        return b''.join(packet)
13451
13452 1
    @staticmethod
13453
    def from_binary(data):
13454
        return StatusResult(data)
13455
13456 1
    def _binary_init(self, data):
13457
        self.StatusCode = StatusCode.from_binary(data)
13458
        self.DiagnosticInfo = DiagnosticInfo.from_binary(data)
13459
13460 1
    def __str__(self):
13461
        return 'StatusResult(' + 'StatusCode:' + str(self.StatusCode) + ', ' + \
13462
               'DiagnosticInfo:' + str(self.DiagnosticInfo) + ')'
13463
13464 1
    __repr__ = __str__
13465
13466
13467 1
class SubscriptionDiagnosticsDataType(FrozenClass):
13468
    '''
13469
    :ivar SessionId:
13470
    :vartype SessionId: NodeId
13471
    :ivar SubscriptionId:
13472
    :vartype SubscriptionId: UInt32
13473
    :ivar Priority:
13474
    :vartype Priority: Byte
13475
    :ivar PublishingInterval:
13476
    :vartype PublishingInterval: Double
13477
    :ivar MaxKeepAliveCount:
13478
    :vartype MaxKeepAliveCount: UInt32
13479
    :ivar MaxLifetimeCount:
13480
    :vartype MaxLifetimeCount: UInt32
13481
    :ivar MaxNotificationsPerPublish:
13482
    :vartype MaxNotificationsPerPublish: UInt32
13483
    :ivar PublishingEnabled:
13484
    :vartype PublishingEnabled: Boolean
13485
    :ivar ModifyCount:
13486
    :vartype ModifyCount: UInt32
13487
    :ivar EnableCount:
13488
    :vartype EnableCount: UInt32
13489
    :ivar DisableCount:
13490
    :vartype DisableCount: UInt32
13491
    :ivar RepublishRequestCount:
13492
    :vartype RepublishRequestCount: UInt32
13493
    :ivar RepublishMessageRequestCount:
13494
    :vartype RepublishMessageRequestCount: UInt32
13495
    :ivar RepublishMessageCount:
13496
    :vartype RepublishMessageCount: UInt32
13497
    :ivar TransferRequestCount:
13498
    :vartype TransferRequestCount: UInt32
13499
    :ivar TransferredToAltClientCount:
13500
    :vartype TransferredToAltClientCount: UInt32
13501
    :ivar TransferredToSameClientCount:
13502
    :vartype TransferredToSameClientCount: UInt32
13503
    :ivar PublishRequestCount:
13504
    :vartype PublishRequestCount: UInt32
13505
    :ivar DataChangeNotificationsCount:
13506
    :vartype DataChangeNotificationsCount: UInt32
13507
    :ivar EventNotificationsCount:
13508
    :vartype EventNotificationsCount: UInt32
13509
    :ivar NotificationsCount:
13510
    :vartype NotificationsCount: UInt32
13511
    :ivar LatePublishRequestCount:
13512
    :vartype LatePublishRequestCount: UInt32
13513
    :ivar CurrentKeepAliveCount:
13514
    :vartype CurrentKeepAliveCount: UInt32
13515
    :ivar CurrentLifetimeCount:
13516
    :vartype CurrentLifetimeCount: UInt32
13517
    :ivar UnacknowledgedMessageCount:
13518
    :vartype UnacknowledgedMessageCount: UInt32
13519
    :ivar DiscardedMessageCount:
13520
    :vartype DiscardedMessageCount: UInt32
13521
    :ivar MonitoredItemCount:
13522
    :vartype MonitoredItemCount: UInt32
13523
    :ivar DisabledMonitoredItemCount:
13524
    :vartype DisabledMonitoredItemCount: UInt32
13525
    :ivar MonitoringQueueOverflowCount:
13526
    :vartype MonitoringQueueOverflowCount: UInt32
13527
    :ivar NextSequenceNumber:
13528
    :vartype NextSequenceNumber: UInt32
13529
    :ivar EventQueueOverFlowCount:
13530
    :vartype EventQueueOverFlowCount: UInt32
13531
    '''
13532 1
    def __init__(self, binary=None):
13533
        if binary is not None:
13534
            self._binary_init(binary)
13535
            self._freeze()
13536
            return
13537
        self.SessionId = NodeId()
13538
        self.SubscriptionId = 0
13539
        self.Priority = 0
13540
        self.PublishingInterval = 0
13541
        self.MaxKeepAliveCount = 0
13542
        self.MaxLifetimeCount = 0
13543
        self.MaxNotificationsPerPublish = 0
13544
        self.PublishingEnabled = True
13545
        self.ModifyCount = 0
13546
        self.EnableCount = 0
13547
        self.DisableCount = 0
13548
        self.RepublishRequestCount = 0
13549
        self.RepublishMessageRequestCount = 0
13550
        self.RepublishMessageCount = 0
13551
        self.TransferRequestCount = 0
13552
        self.TransferredToAltClientCount = 0
13553
        self.TransferredToSameClientCount = 0
13554
        self.PublishRequestCount = 0
13555
        self.DataChangeNotificationsCount = 0
13556
        self.EventNotificationsCount = 0
13557
        self.NotificationsCount = 0
13558
        self.LatePublishRequestCount = 0
13559
        self.CurrentKeepAliveCount = 0
13560
        self.CurrentLifetimeCount = 0
13561
        self.UnacknowledgedMessageCount = 0
13562
        self.DiscardedMessageCount = 0
13563
        self.MonitoredItemCount = 0
13564
        self.DisabledMonitoredItemCount = 0
13565
        self.MonitoringQueueOverflowCount = 0
13566
        self.NextSequenceNumber = 0
13567
        self.EventQueueOverFlowCount = 0
13568
        self._freeze()
13569
13570 1
    def to_binary(self):
13571
        packet = []
13572
        packet.append(self.SessionId.to_binary())
13573
        packet.append(uatype_UInt32.pack(self.SubscriptionId))
13574
        packet.append(uatype_Byte.pack(self.Priority))
13575
        packet.append(uatype_Double.pack(self.PublishingInterval))
13576
        packet.append(uatype_UInt32.pack(self.MaxKeepAliveCount))
13577
        packet.append(uatype_UInt32.pack(self.MaxLifetimeCount))
13578
        packet.append(uatype_UInt32.pack(self.MaxNotificationsPerPublish))
13579
        packet.append(uatype_Boolean.pack(self.PublishingEnabled))
13580
        packet.append(uatype_UInt32.pack(self.ModifyCount))
13581
        packet.append(uatype_UInt32.pack(self.EnableCount))
13582
        packet.append(uatype_UInt32.pack(self.DisableCount))
13583
        packet.append(uatype_UInt32.pack(self.RepublishRequestCount))
13584
        packet.append(uatype_UInt32.pack(self.RepublishMessageRequestCount))
13585
        packet.append(uatype_UInt32.pack(self.RepublishMessageCount))
13586
        packet.append(uatype_UInt32.pack(self.TransferRequestCount))
13587
        packet.append(uatype_UInt32.pack(self.TransferredToAltClientCount))
13588
        packet.append(uatype_UInt32.pack(self.TransferredToSameClientCount))
13589
        packet.append(uatype_UInt32.pack(self.PublishRequestCount))
13590
        packet.append(uatype_UInt32.pack(self.DataChangeNotificationsCount))
13591
        packet.append(uatype_UInt32.pack(self.EventNotificationsCount))
13592
        packet.append(uatype_UInt32.pack(self.NotificationsCount))
13593
        packet.append(uatype_UInt32.pack(self.LatePublishRequestCount))
13594
        packet.append(uatype_UInt32.pack(self.CurrentKeepAliveCount))
13595
        packet.append(uatype_UInt32.pack(self.CurrentLifetimeCount))
13596
        packet.append(uatype_UInt32.pack(self.UnacknowledgedMessageCount))
13597
        packet.append(uatype_UInt32.pack(self.DiscardedMessageCount))
13598
        packet.append(uatype_UInt32.pack(self.MonitoredItemCount))
13599
        packet.append(uatype_UInt32.pack(self.DisabledMonitoredItemCount))
13600
        packet.append(uatype_UInt32.pack(self.MonitoringQueueOverflowCount))
13601
        packet.append(uatype_UInt32.pack(self.NextSequenceNumber))
13602
        packet.append(uatype_UInt32.pack(self.EventQueueOverFlowCount))
13603
        return b''.join(packet)
13604
13605 1
    @staticmethod
13606
    def from_binary(data):
13607
        return SubscriptionDiagnosticsDataType(data)
13608
13609 1
    def _binary_init(self, data):
13610
        self.SessionId = NodeId.from_binary(data)
13611
        self.SubscriptionId = uatype_UInt32.unpack(data.read(4))[0]
13612
        self.Priority = uatype_Byte.unpack(data.read(1))[0]
13613
        self.PublishingInterval = uatype_Double.unpack(data.read(8))[0]
13614
        self.MaxKeepAliveCount = uatype_UInt32.unpack(data.read(4))[0]
13615
        self.MaxLifetimeCount = uatype_UInt32.unpack(data.read(4))[0]
13616
        self.MaxNotificationsPerPublish = uatype_UInt32.unpack(data.read(4))[0]
13617
        self.PublishingEnabled = uatype_Boolean.unpack(data.read(1))[0]
13618
        self.ModifyCount = uatype_UInt32.unpack(data.read(4))[0]
13619
        self.EnableCount = uatype_UInt32.unpack(data.read(4))[0]
13620
        self.DisableCount = uatype_UInt32.unpack(data.read(4))[0]
13621
        self.RepublishRequestCount = uatype_UInt32.unpack(data.read(4))[0]
13622
        self.RepublishMessageRequestCount = uatype_UInt32.unpack(data.read(4))[0]
13623
        self.RepublishMessageCount = uatype_UInt32.unpack(data.read(4))[0]
13624
        self.TransferRequestCount = uatype_UInt32.unpack(data.read(4))[0]
13625
        self.TransferredToAltClientCount = uatype_UInt32.unpack(data.read(4))[0]
13626
        self.TransferredToSameClientCount = uatype_UInt32.unpack(data.read(4))[0]
13627
        self.PublishRequestCount = uatype_UInt32.unpack(data.read(4))[0]
13628
        self.DataChangeNotificationsCount = uatype_UInt32.unpack(data.read(4))[0]
13629
        self.EventNotificationsCount = uatype_UInt32.unpack(data.read(4))[0]
13630
        self.NotificationsCount = uatype_UInt32.unpack(data.read(4))[0]
13631
        self.LatePublishRequestCount = uatype_UInt32.unpack(data.read(4))[0]
13632
        self.CurrentKeepAliveCount = uatype_UInt32.unpack(data.read(4))[0]
13633
        self.CurrentLifetimeCount = uatype_UInt32.unpack(data.read(4))[0]
13634
        self.UnacknowledgedMessageCount = uatype_UInt32.unpack(data.read(4))[0]
13635
        self.DiscardedMessageCount = uatype_UInt32.unpack(data.read(4))[0]
13636
        self.MonitoredItemCount = uatype_UInt32.unpack(data.read(4))[0]
13637
        self.DisabledMonitoredItemCount = uatype_UInt32.unpack(data.read(4))[0]
13638
        self.MonitoringQueueOverflowCount = uatype_UInt32.unpack(data.read(4))[0]
13639
        self.NextSequenceNumber = uatype_UInt32.unpack(data.read(4))[0]
13640
        self.EventQueueOverFlowCount = uatype_UInt32.unpack(data.read(4))[0]
13641
13642 1
    def __str__(self):
13643
        return 'SubscriptionDiagnosticsDataType(' + 'SessionId:' + str(self.SessionId) + ', ' + \
13644
               'SubscriptionId:' + str(self.SubscriptionId) + ', ' + \
13645
               'Priority:' + str(self.Priority) + ', ' + \
13646
               'PublishingInterval:' + str(self.PublishingInterval) + ', ' + \
13647
               'MaxKeepAliveCount:' + str(self.MaxKeepAliveCount) + ', ' + \
13648
               'MaxLifetimeCount:' + str(self.MaxLifetimeCount) + ', ' + \
13649
               'MaxNotificationsPerPublish:' + str(self.MaxNotificationsPerPublish) + ', ' + \
13650
               'PublishingEnabled:' + str(self.PublishingEnabled) + ', ' + \
13651
               'ModifyCount:' + str(self.ModifyCount) + ', ' + \
13652
               'EnableCount:' + str(self.EnableCount) + ', ' + \
13653
               'DisableCount:' + str(self.DisableCount) + ', ' + \
13654
               'RepublishRequestCount:' + str(self.RepublishRequestCount) + ', ' + \
13655
               'RepublishMessageRequestCount:' + str(self.RepublishMessageRequestCount) + ', ' + \
13656
               'RepublishMessageCount:' + str(self.RepublishMessageCount) + ', ' + \
13657
               'TransferRequestCount:' + str(self.TransferRequestCount) + ', ' + \
13658
               'TransferredToAltClientCount:' + str(self.TransferredToAltClientCount) + ', ' + \
13659
               'TransferredToSameClientCount:' + str(self.TransferredToSameClientCount) + ', ' + \
13660
               'PublishRequestCount:' + str(self.PublishRequestCount) + ', ' + \
13661
               'DataChangeNotificationsCount:' + str(self.DataChangeNotificationsCount) + ', ' + \
13662
               'EventNotificationsCount:' + str(self.EventNotificationsCount) + ', ' + \
13663
               'NotificationsCount:' + str(self.NotificationsCount) + ', ' + \
13664
               'LatePublishRequestCount:' + str(self.LatePublishRequestCount) + ', ' + \
13665
               'CurrentKeepAliveCount:' + str(self.CurrentKeepAliveCount) + ', ' + \
13666
               'CurrentLifetimeCount:' + str(self.CurrentLifetimeCount) + ', ' + \
13667
               'UnacknowledgedMessageCount:' + str(self.UnacknowledgedMessageCount) + ', ' + \
13668
               'DiscardedMessageCount:' + str(self.DiscardedMessageCount) + ', ' + \
13669
               'MonitoredItemCount:' + str(self.MonitoredItemCount) + ', ' + \
13670
               'DisabledMonitoredItemCount:' + str(self.DisabledMonitoredItemCount) + ', ' + \
13671
               'MonitoringQueueOverflowCount:' + str(self.MonitoringQueueOverflowCount) + ', ' + \
13672
               'NextSequenceNumber:' + str(self.NextSequenceNumber) + ', ' + \
13673
               'EventQueueOverFlowCount:' + str(self.EventQueueOverFlowCount) + ')'
13674
13675 1
    __repr__ = __str__
13676
13677
13678 1
class ModelChangeStructureDataType(FrozenClass):
13679
    '''
13680
    :ivar Affected:
13681
    :vartype Affected: NodeId
13682
    :ivar AffectedType:
13683
    :vartype AffectedType: NodeId
13684
    :ivar Verb:
13685
    :vartype Verb: Byte
13686
    '''
13687 1
    def __init__(self, binary=None):
13688
        if binary is not None:
13689
            self._binary_init(binary)
13690
            self._freeze()
13691
            return
13692
        self.Affected = NodeId()
13693
        self.AffectedType = NodeId()
13694
        self.Verb = 0
13695
        self._freeze()
13696
13697 1
    def to_binary(self):
13698
        packet = []
13699
        packet.append(self.Affected.to_binary())
13700
        packet.append(self.AffectedType.to_binary())
13701
        packet.append(uatype_Byte.pack(self.Verb))
13702
        return b''.join(packet)
13703
13704 1
    @staticmethod
13705
    def from_binary(data):
13706
        return ModelChangeStructureDataType(data)
13707
13708 1
    def _binary_init(self, data):
13709
        self.Affected = NodeId.from_binary(data)
13710
        self.AffectedType = NodeId.from_binary(data)
13711
        self.Verb = uatype_Byte.unpack(data.read(1))[0]
13712
13713 1
    def __str__(self):
13714
        return 'ModelChangeStructureDataType(' + 'Affected:' + str(self.Affected) + ', ' + \
13715
               'AffectedType:' + str(self.AffectedType) + ', ' + \
13716
               'Verb:' + str(self.Verb) + ')'
13717
13718 1
    __repr__ = __str__
13719
13720
13721 1
class SemanticChangeStructureDataType(FrozenClass):
13722
    '''
13723
    :ivar Affected:
13724
    :vartype Affected: NodeId
13725
    :ivar AffectedType:
13726
    :vartype AffectedType: NodeId
13727
    '''
13728 1
    def __init__(self, binary=None):
13729
        if binary is not None:
13730
            self._binary_init(binary)
13731
            self._freeze()
13732
            return
13733
        self.Affected = NodeId()
13734
        self.AffectedType = NodeId()
13735
        self._freeze()
13736
13737 1
    def to_binary(self):
13738
        packet = []
13739
        packet.append(self.Affected.to_binary())
13740
        packet.append(self.AffectedType.to_binary())
13741
        return b''.join(packet)
13742
13743 1
    @staticmethod
13744
    def from_binary(data):
13745
        return SemanticChangeStructureDataType(data)
13746
13747 1
    def _binary_init(self, data):
13748
        self.Affected = NodeId.from_binary(data)
13749
        self.AffectedType = NodeId.from_binary(data)
13750
13751 1
    def __str__(self):
13752
        return 'SemanticChangeStructureDataType(' + 'Affected:' + str(self.Affected) + ', ' + \
13753
               'AffectedType:' + str(self.AffectedType) + ')'
13754
13755 1
    __repr__ = __str__
13756
13757
13758 1
class Range(FrozenClass):
13759
    '''
13760
    :ivar Low:
13761
    :vartype Low: Double
13762
    :ivar High:
13763
    :vartype High: Double
13764
    '''
13765 1
    def __init__(self, binary=None):
13766
        if binary is not None:
13767
            self._binary_init(binary)
13768
            self._freeze()
13769
            return
13770
        self.Low = 0
13771
        self.High = 0
13772
        self._freeze()
13773
13774 1
    def to_binary(self):
13775
        packet = []
13776
        packet.append(uatype_Double.pack(self.Low))
13777
        packet.append(uatype_Double.pack(self.High))
13778
        return b''.join(packet)
13779
13780 1
    @staticmethod
13781
    def from_binary(data):
13782
        return Range(data)
13783
13784 1
    def _binary_init(self, data):
13785
        self.Low = uatype_Double.unpack(data.read(8))[0]
13786
        self.High = uatype_Double.unpack(data.read(8))[0]
13787
13788 1
    def __str__(self):
13789
        return 'Range(' + 'Low:' + str(self.Low) + ', ' + \
13790
               'High:' + str(self.High) + ')'
13791
13792 1
    __repr__ = __str__
13793
13794
13795 1
class EUInformation(FrozenClass):
13796
    '''
13797
    :ivar NamespaceUri:
13798
    :vartype NamespaceUri: String
13799
    :ivar UnitId:
13800
    :vartype UnitId: Int32
13801
    :ivar DisplayName:
13802
    :vartype DisplayName: LocalizedText
13803
    :ivar Description:
13804
    :vartype Description: LocalizedText
13805
    '''
13806 1
    def __init__(self, binary=None):
13807
        if binary is not None:
13808
            self._binary_init(binary)
13809
            self._freeze()
13810
            return
13811
        self.NamespaceUri = ''
13812
        self.UnitId = 0
13813
        self.DisplayName = LocalizedText()
13814
        self.Description = LocalizedText()
13815
        self._freeze()
13816
13817 1
    def to_binary(self):
13818
        packet = []
13819
        packet.append(pack_string(self.NamespaceUri))
13820
        packet.append(uatype_Int32.pack(self.UnitId))
13821
        packet.append(self.DisplayName.to_binary())
13822
        packet.append(self.Description.to_binary())
13823
        return b''.join(packet)
13824
13825 1
    @staticmethod
13826
    def from_binary(data):
13827
        return EUInformation(data)
13828
13829 1
    def _binary_init(self, data):
13830
        self.NamespaceUri = unpack_string(data)
13831
        self.UnitId = uatype_Int32.unpack(data.read(4))[0]
13832
        self.DisplayName = LocalizedText.from_binary(data)
13833
        self.Description = LocalizedText.from_binary(data)
13834
13835 1
    def __str__(self):
13836
        return 'EUInformation(' + 'NamespaceUri:' + str(self.NamespaceUri) + ', ' + \
13837
               'UnitId:' + str(self.UnitId) + ', ' + \
13838
               'DisplayName:' + str(self.DisplayName) + ', ' + \
13839
               'Description:' + str(self.Description) + ')'
13840
13841 1
    __repr__ = __str__
13842
13843
13844 1
class ComplexNumberType(FrozenClass):
13845
    '''
13846
    :ivar Real:
13847
    :vartype Real: Float
13848
    :ivar Imaginary:
13849
    :vartype Imaginary: Float
13850
    '''
13851 1
    def __init__(self, binary=None):
13852
        if binary is not None:
13853
            self._binary_init(binary)
13854
            self._freeze()
13855
            return
13856
        self.Real = 0
13857
        self.Imaginary = 0
13858
        self._freeze()
13859
13860 1
    def to_binary(self):
13861
        packet = []
13862
        packet.append(uatype_Float.pack(self.Real))
13863
        packet.append(uatype_Float.pack(self.Imaginary))
13864
        return b''.join(packet)
13865
13866 1
    @staticmethod
13867
    def from_binary(data):
13868
        return ComplexNumberType(data)
13869
13870 1
    def _binary_init(self, data):
13871
        self.Real = uatype_Float.unpack(data.read(4))[0]
13872
        self.Imaginary = uatype_Float.unpack(data.read(4))[0]
13873
13874 1
    def __str__(self):
13875
        return 'ComplexNumberType(' + 'Real:' + str(self.Real) + ', ' + \
13876
               'Imaginary:' + str(self.Imaginary) + ')'
13877
13878 1
    __repr__ = __str__
13879
13880
13881 1
class DoubleComplexNumberType(FrozenClass):
13882
    '''
13883
    :ivar Real:
13884
    :vartype Real: Double
13885
    :ivar Imaginary:
13886
    :vartype Imaginary: Double
13887
    '''
13888 1
    def __init__(self, binary=None):
13889
        if binary is not None:
13890
            self._binary_init(binary)
13891
            self._freeze()
13892
            return
13893
        self.Real = 0
13894
        self.Imaginary = 0
13895
        self._freeze()
13896
13897 1
    def to_binary(self):
13898
        packet = []
13899
        packet.append(uatype_Double.pack(self.Real))
13900
        packet.append(uatype_Double.pack(self.Imaginary))
13901
        return b''.join(packet)
13902
13903 1
    @staticmethod
13904
    def from_binary(data):
13905
        return DoubleComplexNumberType(data)
13906
13907 1
    def _binary_init(self, data):
13908
        self.Real = uatype_Double.unpack(data.read(8))[0]
13909
        self.Imaginary = uatype_Double.unpack(data.read(8))[0]
13910
13911 1
    def __str__(self):
13912
        return 'DoubleComplexNumberType(' + 'Real:' + str(self.Real) + ', ' + \
13913
               'Imaginary:' + str(self.Imaginary) + ')'
13914
13915 1
    __repr__ = __str__
13916
13917
13918 1
class AxisInformation(FrozenClass):
13919
    '''
13920
    :ivar EngineeringUnits:
13921
    :vartype EngineeringUnits: EUInformation
13922
    :ivar EURange:
13923
    :vartype EURange: Range
13924
    :ivar Title:
13925
    :vartype Title: LocalizedText
13926
    :ivar AxisScaleType:
13927
    :vartype AxisScaleType: AxisScaleEnumeration
13928
    :ivar AxisSteps:
13929
    :vartype AxisSteps: Double
13930
    '''
13931 1
    def __init__(self, binary=None):
13932
        if binary is not None:
13933
            self._binary_init(binary)
13934
            self._freeze()
13935
            return
13936
        self.EngineeringUnits = EUInformation()
13937
        self.EURange = Range()
13938
        self.Title = LocalizedText()
13939
        self.AxisScaleType = 0
13940
        self.AxisSteps = []
13941
        self._freeze()
13942
13943 1
    def to_binary(self):
13944
        packet = []
13945
        packet.append(self.EngineeringUnits.to_binary())
13946
        packet.append(self.EURange.to_binary())
13947
        packet.append(self.Title.to_binary())
13948
        packet.append(uatype_UInt32.pack(self.AxisScaleType))
13949
        packet.append(uatype_Int32.pack(len(self.AxisSteps)))
13950
        for fieldname in self.AxisSteps:
13951
            packet.append(uatype_Double.pack(fieldname))
13952
        return b''.join(packet)
13953
13954 1
    @staticmethod
13955
    def from_binary(data):
13956
        return AxisInformation(data)
13957
13958 1
    def _binary_init(self, data):
13959
        self.EngineeringUnits = EUInformation.from_binary(data)
13960
        self.EURange = Range.from_binary(data)
13961
        self.Title = LocalizedText.from_binary(data)
13962
        self.AxisScaleType = uatype_UInt32.unpack(data.read(4))[0]
13963
        self.AxisSteps = unpack_uatype_array('Double', data)
13964
13965 1
    def __str__(self):
13966
        return 'AxisInformation(' + 'EngineeringUnits:' + str(self.EngineeringUnits) + ', ' + \
13967
               'EURange:' + str(self.EURange) + ', ' + \
13968
               'Title:' + str(self.Title) + ', ' + \
13969
               'AxisScaleType:' + str(self.AxisScaleType) + ', ' + \
13970
               'AxisSteps:' + str(self.AxisSteps) + ')'
13971
13972 1
    __repr__ = __str__
13973
13974
13975 1
class XVType(FrozenClass):
13976
    '''
13977
    :ivar X:
13978
    :vartype X: Double
13979
    :ivar Value:
13980
    :vartype Value: Float
13981
    '''
13982 1
    def __init__(self, binary=None):
13983
        if binary is not None:
13984
            self._binary_init(binary)
13985
            self._freeze()
13986
            return
13987
        self.X = 0
13988
        self.Value = 0
13989
        self._freeze()
13990
13991 1
    def to_binary(self):
13992
        packet = []
13993
        packet.append(uatype_Double.pack(self.X))
13994
        packet.append(uatype_Float.pack(self.Value))
13995
        return b''.join(packet)
13996
13997 1
    @staticmethod
13998
    def from_binary(data):
13999
        return XVType(data)
14000
14001 1
    def _binary_init(self, data):
14002
        self.X = uatype_Double.unpack(data.read(8))[0]
14003
        self.Value = uatype_Float.unpack(data.read(4))[0]
14004
14005 1
    def __str__(self):
14006
        return 'XVType(' + 'X:' + str(self.X) + ', ' + \
14007
               'Value:' + str(self.Value) + ')'
14008
14009 1
    __repr__ = __str__
14010
14011
14012 1
class ProgramDiagnosticDataType(FrozenClass):
14013
    '''
14014
    :ivar CreateSessionId:
14015
    :vartype CreateSessionId: NodeId
14016
    :ivar CreateClientName:
14017
    :vartype CreateClientName: String
14018
    :ivar InvocationCreationTime:
14019
    :vartype InvocationCreationTime: DateTime
14020
    :ivar LastTransitionTime:
14021
    :vartype LastTransitionTime: DateTime
14022
    :ivar LastMethodCall:
14023
    :vartype LastMethodCall: String
14024
    :ivar LastMethodSessionId:
14025
    :vartype LastMethodSessionId: NodeId
14026
    :ivar LastMethodInputArguments:
14027
    :vartype LastMethodInputArguments: Argument
14028
    :ivar LastMethodOutputArguments:
14029
    :vartype LastMethodOutputArguments: Argument
14030
    :ivar LastMethodCallTime:
14031
    :vartype LastMethodCallTime: DateTime
14032
    :ivar LastMethodReturnStatus:
14033
    :vartype LastMethodReturnStatus: StatusResult
14034
    '''
14035 1
    def __init__(self, binary=None):
14036
        if binary is not None:
14037
            self._binary_init(binary)
14038
            self._freeze()
14039
            return
14040
        self.CreateSessionId = NodeId()
14041
        self.CreateClientName = ''
14042
        self.InvocationCreationTime = datetime.now()
14043
        self.LastTransitionTime = datetime.now()
14044
        self.LastMethodCall = ''
14045
        self.LastMethodSessionId = NodeId()
14046
        self.LastMethodInputArguments = []
14047
        self.LastMethodOutputArguments = []
14048
        self.LastMethodCallTime = datetime.now()
14049
        self.LastMethodReturnStatus = StatusResult()
14050
        self._freeze()
14051
14052 1
    def to_binary(self):
14053
        packet = []
14054
        packet.append(self.CreateSessionId.to_binary())
14055
        packet.append(pack_string(self.CreateClientName))
14056
        packet.append(pack_datetime(self.InvocationCreationTime))
14057
        packet.append(pack_datetime(self.LastTransitionTime))
14058
        packet.append(pack_string(self.LastMethodCall))
14059
        packet.append(self.LastMethodSessionId.to_binary())
14060
        packet.append(uatype_Int32.pack(len(self.LastMethodInputArguments)))
14061
        for fieldname in self.LastMethodInputArguments:
14062
            packet.append(fieldname.to_binary())
14063
        packet.append(uatype_Int32.pack(len(self.LastMethodOutputArguments)))
14064
        for fieldname in self.LastMethodOutputArguments:
14065
            packet.append(fieldname.to_binary())
14066
        packet.append(pack_datetime(self.LastMethodCallTime))
14067
        packet.append(self.LastMethodReturnStatus.to_binary())
14068
        return b''.join(packet)
14069
14070 1
    @staticmethod
14071
    def from_binary(data):
14072
        return ProgramDiagnosticDataType(data)
14073
14074 1
    def _binary_init(self, data):
14075
        self.CreateSessionId = NodeId.from_binary(data)
14076
        self.CreateClientName = unpack_string(data)
14077
        self.InvocationCreationTime = unpack_datetime(data)
14078
        self.LastTransitionTime = unpack_datetime(data)
14079
        self.LastMethodCall = unpack_string(data)
14080
        self.LastMethodSessionId = NodeId.from_binary(data)
14081
        length = uatype_Int32.unpack(data.read(4))[0]
14082
        array = []
14083
        if length != -1:
14084
            for _ in range(0, length):
14085
                array.append(Argument.from_binary(data))
14086
        self.LastMethodInputArguments = array
14087
        length = uatype_Int32.unpack(data.read(4))[0]
14088
        array = []
14089
        if length != -1:
14090
            for _ in range(0, length):
14091
                array.append(Argument.from_binary(data))
14092
        self.LastMethodOutputArguments = array
14093
        self.LastMethodCallTime = unpack_datetime(data)
14094
        self.LastMethodReturnStatus = StatusResult.from_binary(data)
14095
14096 1
    def __str__(self):
14097
        return 'ProgramDiagnosticDataType(' + 'CreateSessionId:' + str(self.CreateSessionId) + ', ' + \
14098
               'CreateClientName:' + str(self.CreateClientName) + ', ' + \
14099
               'InvocationCreationTime:' + str(self.InvocationCreationTime) + ', ' + \
14100
               'LastTransitionTime:' + str(self.LastTransitionTime) + ', ' + \
14101
               'LastMethodCall:' + str(self.LastMethodCall) + ', ' + \
14102
               'LastMethodSessionId:' + str(self.LastMethodSessionId) + ', ' + \
14103
               'LastMethodInputArguments:' + str(self.LastMethodInputArguments) + ', ' + \
14104
               'LastMethodOutputArguments:' + str(self.LastMethodOutputArguments) + ', ' + \
14105
               'LastMethodCallTime:' + str(self.LastMethodCallTime) + ', ' + \
14106
               'LastMethodReturnStatus:' + str(self.LastMethodReturnStatus) + ')'
14107
14108 1
    __repr__ = __str__
14109
14110
14111 1
class Annotation(FrozenClass):
14112
    '''
14113
    :ivar Message:
14114
    :vartype Message: String
14115
    :ivar UserName:
14116
    :vartype UserName: String
14117
    :ivar AnnotationTime:
14118
    :vartype AnnotationTime: DateTime
14119
    '''
14120 1
    def __init__(self, binary=None):
14121
        if binary is not None:
14122
            self._binary_init(binary)
14123
            self._freeze()
14124
            return
14125
        self.Message = ''
14126
        self.UserName = ''
14127
        self.AnnotationTime = datetime.now()
14128
        self._freeze()
14129
14130 1
    def to_binary(self):
14131
        packet = []
14132
        packet.append(pack_string(self.Message))
14133
        packet.append(pack_string(self.UserName))
14134
        packet.append(pack_datetime(self.AnnotationTime))
14135
        return b''.join(packet)
14136
14137 1
    @staticmethod
14138
    def from_binary(data):
14139
        return Annotation(data)
14140
14141 1
    def _binary_init(self, data):
14142
        self.Message = unpack_string(data)
14143
        self.UserName = unpack_string(data)
14144
        self.AnnotationTime = unpack_datetime(data)
14145
14146 1
    def __str__(self):
14147
        return 'Annotation(' + 'Message:' + str(self.Message) + ', ' + \
14148
               'UserName:' + str(self.UserName) + ', ' + \
14149
               'AnnotationTime:' + str(self.AnnotationTime) + ')'
14150
14151 1
    __repr__ = __str__
14152
14153
14154 1
ExtensionClasses = {
14155
    ObjectIds.TrustListDataType_Encoding_DefaultBinary: TrustListDataType,
14156
    ObjectIds.Argument_Encoding_DefaultBinary: Argument,
14157
    ObjectIds.EnumValueType_Encoding_DefaultBinary: EnumValueType,
14158
    ObjectIds.OptionSet_Encoding_DefaultBinary: OptionSet,
14159
    ObjectIds.Union_Encoding_DefaultBinary: Union,
14160
    ObjectIds.TimeZoneDataType_Encoding_DefaultBinary: TimeZoneDataType,
14161
    ObjectIds.ApplicationDescription_Encoding_DefaultBinary: ApplicationDescription,
14162
    ObjectIds.RequestHeader_Encoding_DefaultBinary: RequestHeader,
14163
    ObjectIds.ResponseHeader_Encoding_DefaultBinary: ResponseHeader,
14164
    ObjectIds.ServiceFault_Encoding_DefaultBinary: ServiceFault,
14165
    ObjectIds.FindServersRequest_Encoding_DefaultBinary: FindServersRequest,
14166
    ObjectIds.FindServersResponse_Encoding_DefaultBinary: FindServersResponse,
14167
    ObjectIds.ServerOnNetwork_Encoding_DefaultBinary: ServerOnNetwork,
14168
    ObjectIds.FindServersOnNetworkRequest_Encoding_DefaultBinary: FindServersOnNetworkRequest,
14169
    ObjectIds.FindServersOnNetworkResponse_Encoding_DefaultBinary: FindServersOnNetworkResponse,
14170
    ObjectIds.UserTokenPolicy_Encoding_DefaultBinary: UserTokenPolicy,
14171
    ObjectIds.EndpointDescription_Encoding_DefaultBinary: EndpointDescription,
14172
    ObjectIds.GetEndpointsRequest_Encoding_DefaultBinary: GetEndpointsRequest,
14173
    ObjectIds.GetEndpointsResponse_Encoding_DefaultBinary: GetEndpointsResponse,
14174
    ObjectIds.RegisteredServer_Encoding_DefaultBinary: RegisteredServer,
14175
    ObjectIds.RegisterServerRequest_Encoding_DefaultBinary: RegisterServerRequest,
14176
    ObjectIds.RegisterServerResponse_Encoding_DefaultBinary: RegisterServerResponse,
14177
    ObjectIds.DiscoveryConfiguration_Encoding_DefaultBinary: DiscoveryConfiguration,
14178
    ObjectIds.MdnsDiscoveryConfiguration_Encoding_DefaultBinary: MdnsDiscoveryConfiguration,
14179
    ObjectIds.RegisterServer2Request_Encoding_DefaultBinary: RegisterServer2Request,
14180
    ObjectIds.RegisterServer2Response_Encoding_DefaultBinary: RegisterServer2Response,
14181
    ObjectIds.ChannelSecurityToken_Encoding_DefaultBinary: ChannelSecurityToken,
14182
    ObjectIds.OpenSecureChannelRequest_Encoding_DefaultBinary: OpenSecureChannelRequest,
14183
    ObjectIds.OpenSecureChannelResponse_Encoding_DefaultBinary: OpenSecureChannelResponse,
14184
    ObjectIds.CloseSecureChannelRequest_Encoding_DefaultBinary: CloseSecureChannelRequest,
14185
    ObjectIds.CloseSecureChannelResponse_Encoding_DefaultBinary: CloseSecureChannelResponse,
14186
    ObjectIds.SignedSoftwareCertificate_Encoding_DefaultBinary: SignedSoftwareCertificate,
14187
    ObjectIds.SignatureData_Encoding_DefaultBinary: SignatureData,
14188
    ObjectIds.CreateSessionRequest_Encoding_DefaultBinary: CreateSessionRequest,
14189
    ObjectIds.CreateSessionResponse_Encoding_DefaultBinary: CreateSessionResponse,
14190
    ObjectIds.UserIdentityToken_Encoding_DefaultBinary: UserIdentityToken,
14191
    ObjectIds.AnonymousIdentityToken_Encoding_DefaultBinary: AnonymousIdentityToken,
14192
    ObjectIds.UserNameIdentityToken_Encoding_DefaultBinary: UserNameIdentityToken,
14193
    ObjectIds.X509IdentityToken_Encoding_DefaultBinary: X509IdentityToken,
14194
    ObjectIds.KerberosIdentityToken_Encoding_DefaultBinary: KerberosIdentityToken,
14195
    ObjectIds.IssuedIdentityToken_Encoding_DefaultBinary: IssuedIdentityToken,
14196
    ObjectIds.ActivateSessionRequest_Encoding_DefaultBinary: ActivateSessionRequest,
14197
    ObjectIds.ActivateSessionResponse_Encoding_DefaultBinary: ActivateSessionResponse,
14198
    ObjectIds.CloseSessionRequest_Encoding_DefaultBinary: CloseSessionRequest,
14199
    ObjectIds.CloseSessionResponse_Encoding_DefaultBinary: CloseSessionResponse,
14200
    ObjectIds.CancelRequest_Encoding_DefaultBinary: CancelRequest,
14201
    ObjectIds.CancelResponse_Encoding_DefaultBinary: CancelResponse,
14202
    ObjectIds.NodeAttributes_Encoding_DefaultBinary: NodeAttributes,
14203
    ObjectIds.ObjectAttributes_Encoding_DefaultBinary: ObjectAttributes,
14204
    ObjectIds.VariableAttributes_Encoding_DefaultBinary: VariableAttributes,
14205
    ObjectIds.MethodAttributes_Encoding_DefaultBinary: MethodAttributes,
14206
    ObjectIds.ObjectTypeAttributes_Encoding_DefaultBinary: ObjectTypeAttributes,
14207
    ObjectIds.VariableTypeAttributes_Encoding_DefaultBinary: VariableTypeAttributes,
14208
    ObjectIds.ReferenceTypeAttributes_Encoding_DefaultBinary: ReferenceTypeAttributes,
14209
    ObjectIds.DataTypeAttributes_Encoding_DefaultBinary: DataTypeAttributes,
14210
    ObjectIds.ViewAttributes_Encoding_DefaultBinary: ViewAttributes,
14211
    ObjectIds.AddNodesItem_Encoding_DefaultBinary: AddNodesItem,
14212
    ObjectIds.AddNodesResult_Encoding_DefaultBinary: AddNodesResult,
14213
    ObjectIds.AddNodesRequest_Encoding_DefaultBinary: AddNodesRequest,
14214
    ObjectIds.AddNodesResponse_Encoding_DefaultBinary: AddNodesResponse,
14215
    ObjectIds.AddReferencesItem_Encoding_DefaultBinary: AddReferencesItem,
14216
    ObjectIds.AddReferencesRequest_Encoding_DefaultBinary: AddReferencesRequest,
14217
    ObjectIds.AddReferencesResponse_Encoding_DefaultBinary: AddReferencesResponse,
14218
    ObjectIds.DeleteNodesItem_Encoding_DefaultBinary: DeleteNodesItem,
14219
    ObjectIds.DeleteNodesRequest_Encoding_DefaultBinary: DeleteNodesRequest,
14220
    ObjectIds.DeleteNodesResponse_Encoding_DefaultBinary: DeleteNodesResponse,
14221
    ObjectIds.DeleteReferencesItem_Encoding_DefaultBinary: DeleteReferencesItem,
14222
    ObjectIds.DeleteReferencesRequest_Encoding_DefaultBinary: DeleteReferencesRequest,
14223
    ObjectIds.DeleteReferencesResponse_Encoding_DefaultBinary: DeleteReferencesResponse,
14224
    ObjectIds.ViewDescription_Encoding_DefaultBinary: ViewDescription,
14225
    ObjectIds.BrowseDescription_Encoding_DefaultBinary: BrowseDescription,
14226
    ObjectIds.ReferenceDescription_Encoding_DefaultBinary: ReferenceDescription,
14227
    ObjectIds.BrowseResult_Encoding_DefaultBinary: BrowseResult,
14228
    ObjectIds.BrowseRequest_Encoding_DefaultBinary: BrowseRequest,
14229
    ObjectIds.BrowseResponse_Encoding_DefaultBinary: BrowseResponse,
14230
    ObjectIds.BrowseNextRequest_Encoding_DefaultBinary: BrowseNextRequest,
14231
    ObjectIds.BrowseNextResponse_Encoding_DefaultBinary: BrowseNextResponse,
14232
    ObjectIds.RelativePathElement_Encoding_DefaultBinary: RelativePathElement,
14233
    ObjectIds.RelativePath_Encoding_DefaultBinary: RelativePath,
14234
    ObjectIds.BrowsePath_Encoding_DefaultBinary: BrowsePath,
14235
    ObjectIds.BrowsePathTarget_Encoding_DefaultBinary: BrowsePathTarget,
14236
    ObjectIds.BrowsePathResult_Encoding_DefaultBinary: BrowsePathResult,
14237
    ObjectIds.TranslateBrowsePathsToNodeIdsRequest_Encoding_DefaultBinary: TranslateBrowsePathsToNodeIdsRequest,
14238
    ObjectIds.TranslateBrowsePathsToNodeIdsResponse_Encoding_DefaultBinary: TranslateBrowsePathsToNodeIdsResponse,
14239
    ObjectIds.RegisterNodesRequest_Encoding_DefaultBinary: RegisterNodesRequest,
14240
    ObjectIds.RegisterNodesResponse_Encoding_DefaultBinary: RegisterNodesResponse,
14241
    ObjectIds.UnregisterNodesRequest_Encoding_DefaultBinary: UnregisterNodesRequest,
14242
    ObjectIds.UnregisterNodesResponse_Encoding_DefaultBinary: UnregisterNodesResponse,
14243
    ObjectIds.EndpointConfiguration_Encoding_DefaultBinary: EndpointConfiguration,
14244
    ObjectIds.SupportedProfile_Encoding_DefaultBinary: SupportedProfile,
14245
    ObjectIds.SoftwareCertificate_Encoding_DefaultBinary: SoftwareCertificate,
14246
    ObjectIds.QueryDataDescription_Encoding_DefaultBinary: QueryDataDescription,
14247
    ObjectIds.NodeTypeDescription_Encoding_DefaultBinary: NodeTypeDescription,
14248
    ObjectIds.QueryDataSet_Encoding_DefaultBinary: QueryDataSet,
14249
    ObjectIds.NodeReference_Encoding_DefaultBinary: NodeReference,
14250
    ObjectIds.ContentFilterElement_Encoding_DefaultBinary: ContentFilterElement,
14251
    ObjectIds.ContentFilter_Encoding_DefaultBinary: ContentFilter,
14252
    ObjectIds.ElementOperand_Encoding_DefaultBinary: ElementOperand,
14253
    ObjectIds.LiteralOperand_Encoding_DefaultBinary: LiteralOperand,
14254
    ObjectIds.AttributeOperand_Encoding_DefaultBinary: AttributeOperand,
14255
    ObjectIds.SimpleAttributeOperand_Encoding_DefaultBinary: SimpleAttributeOperand,
14256
    ObjectIds.ContentFilterElementResult_Encoding_DefaultBinary: ContentFilterElementResult,
14257
    ObjectIds.ContentFilterResult_Encoding_DefaultBinary: ContentFilterResult,
14258
    ObjectIds.ParsingResult_Encoding_DefaultBinary: ParsingResult,
14259
    ObjectIds.QueryFirstRequest_Encoding_DefaultBinary: QueryFirstRequest,
14260
    ObjectIds.QueryFirstResponse_Encoding_DefaultBinary: QueryFirstResponse,
14261
    ObjectIds.QueryNextRequest_Encoding_DefaultBinary: QueryNextRequest,
14262
    ObjectIds.QueryNextResponse_Encoding_DefaultBinary: QueryNextResponse,
14263
    ObjectIds.ReadValueId_Encoding_DefaultBinary: ReadValueId,
14264
    ObjectIds.ReadRequest_Encoding_DefaultBinary: ReadRequest,
14265
    ObjectIds.ReadResponse_Encoding_DefaultBinary: ReadResponse,
14266
    ObjectIds.HistoryReadValueId_Encoding_DefaultBinary: HistoryReadValueId,
14267
    ObjectIds.HistoryReadResult_Encoding_DefaultBinary: HistoryReadResult,
14268
    ObjectIds.HistoryReadDetails_Encoding_DefaultBinary: HistoryReadDetails,
14269
    ObjectIds.ReadEventDetails_Encoding_DefaultBinary: ReadEventDetails,
14270
    ObjectIds.ReadRawModifiedDetails_Encoding_DefaultBinary: ReadRawModifiedDetails,
14271
    ObjectIds.ReadProcessedDetails_Encoding_DefaultBinary: ReadProcessedDetails,
14272
    ObjectIds.ReadAtTimeDetails_Encoding_DefaultBinary: ReadAtTimeDetails,
14273
    ObjectIds.HistoryData_Encoding_DefaultBinary: HistoryData,
14274
    ObjectIds.ModificationInfo_Encoding_DefaultBinary: ModificationInfo,
14275
    ObjectIds.HistoryModifiedData_Encoding_DefaultBinary: HistoryModifiedData,
14276
    ObjectIds.HistoryEvent_Encoding_DefaultBinary: HistoryEvent,
14277
    ObjectIds.HistoryReadRequest_Encoding_DefaultBinary: HistoryReadRequest,
14278
    ObjectIds.HistoryReadResponse_Encoding_DefaultBinary: HistoryReadResponse,
14279
    ObjectIds.WriteValue_Encoding_DefaultBinary: WriteValue,
14280
    ObjectIds.WriteRequest_Encoding_DefaultBinary: WriteRequest,
14281
    ObjectIds.WriteResponse_Encoding_DefaultBinary: WriteResponse,
14282
    ObjectIds.HistoryUpdateDetails_Encoding_DefaultBinary: HistoryUpdateDetails,
14283
    ObjectIds.UpdateDataDetails_Encoding_DefaultBinary: UpdateDataDetails,
14284
    ObjectIds.UpdateStructureDataDetails_Encoding_DefaultBinary: UpdateStructureDataDetails,
14285
    ObjectIds.UpdateEventDetails_Encoding_DefaultBinary: UpdateEventDetails,
14286
    ObjectIds.DeleteRawModifiedDetails_Encoding_DefaultBinary: DeleteRawModifiedDetails,
14287
    ObjectIds.DeleteAtTimeDetails_Encoding_DefaultBinary: DeleteAtTimeDetails,
14288
    ObjectIds.DeleteEventDetails_Encoding_DefaultBinary: DeleteEventDetails,
14289
    ObjectIds.HistoryUpdateResult_Encoding_DefaultBinary: HistoryUpdateResult,
14290
    ObjectIds.HistoryUpdateRequest_Encoding_DefaultBinary: HistoryUpdateRequest,
14291
    ObjectIds.HistoryUpdateResponse_Encoding_DefaultBinary: HistoryUpdateResponse,
14292
    ObjectIds.CallMethodRequest_Encoding_DefaultBinary: CallMethodRequest,
14293
    ObjectIds.CallMethodResult_Encoding_DefaultBinary: CallMethodResult,
14294
    ObjectIds.CallRequest_Encoding_DefaultBinary: CallRequest,
14295
    ObjectIds.CallResponse_Encoding_DefaultBinary: CallResponse,
14296
    ObjectIds.MonitoringFilter_Encoding_DefaultBinary: MonitoringFilter,
14297
    ObjectIds.DataChangeFilter_Encoding_DefaultBinary: DataChangeFilter,
14298
    ObjectIds.EventFilter_Encoding_DefaultBinary: EventFilter,
14299
    ObjectIds.AggregateConfiguration_Encoding_DefaultBinary: AggregateConfiguration,
14300
    ObjectIds.AggregateFilter_Encoding_DefaultBinary: AggregateFilter,
14301
    ObjectIds.MonitoringFilterResult_Encoding_DefaultBinary: MonitoringFilterResult,
14302
    ObjectIds.EventFilterResult_Encoding_DefaultBinary: EventFilterResult,
14303
    ObjectIds.AggregateFilterResult_Encoding_DefaultBinary: AggregateFilterResult,
14304
    ObjectIds.MonitoringParameters_Encoding_DefaultBinary: MonitoringParameters,
14305
    ObjectIds.MonitoredItemCreateRequest_Encoding_DefaultBinary: MonitoredItemCreateRequest,
14306
    ObjectIds.MonitoredItemCreateResult_Encoding_DefaultBinary: MonitoredItemCreateResult,
14307
    ObjectIds.CreateMonitoredItemsRequest_Encoding_DefaultBinary: CreateMonitoredItemsRequest,
14308
    ObjectIds.CreateMonitoredItemsResponse_Encoding_DefaultBinary: CreateMonitoredItemsResponse,
14309
    ObjectIds.MonitoredItemModifyRequest_Encoding_DefaultBinary: MonitoredItemModifyRequest,
14310
    ObjectIds.MonitoredItemModifyResult_Encoding_DefaultBinary: MonitoredItemModifyResult,
14311
    ObjectIds.ModifyMonitoredItemsRequest_Encoding_DefaultBinary: ModifyMonitoredItemsRequest,
14312
    ObjectIds.ModifyMonitoredItemsResponse_Encoding_DefaultBinary: ModifyMonitoredItemsResponse,
14313
    ObjectIds.SetMonitoringModeRequest_Encoding_DefaultBinary: SetMonitoringModeRequest,
14314
    ObjectIds.SetMonitoringModeResponse_Encoding_DefaultBinary: SetMonitoringModeResponse,
14315
    ObjectIds.SetTriggeringRequest_Encoding_DefaultBinary: SetTriggeringRequest,
14316
    ObjectIds.SetTriggeringResponse_Encoding_DefaultBinary: SetTriggeringResponse,
14317
    ObjectIds.DeleteMonitoredItemsRequest_Encoding_DefaultBinary: DeleteMonitoredItemsRequest,
14318
    ObjectIds.DeleteMonitoredItemsResponse_Encoding_DefaultBinary: DeleteMonitoredItemsResponse,
14319
    ObjectIds.CreateSubscriptionRequest_Encoding_DefaultBinary: CreateSubscriptionRequest,
14320
    ObjectIds.CreateSubscriptionResponse_Encoding_DefaultBinary: CreateSubscriptionResponse,
14321
    ObjectIds.ModifySubscriptionRequest_Encoding_DefaultBinary: ModifySubscriptionRequest,
14322
    ObjectIds.ModifySubscriptionResponse_Encoding_DefaultBinary: ModifySubscriptionResponse,
14323
    ObjectIds.SetPublishingModeRequest_Encoding_DefaultBinary: SetPublishingModeRequest,
14324
    ObjectIds.SetPublishingModeResponse_Encoding_DefaultBinary: SetPublishingModeResponse,
14325
    ObjectIds.NotificationMessage_Encoding_DefaultBinary: NotificationMessage,
14326
    ObjectIds.NotificationData_Encoding_DefaultBinary: NotificationData,
14327
    ObjectIds.DataChangeNotification_Encoding_DefaultBinary: DataChangeNotification,
14328
    ObjectIds.MonitoredItemNotification_Encoding_DefaultBinary: MonitoredItemNotification,
14329
    ObjectIds.EventNotificationList_Encoding_DefaultBinary: EventNotificationList,
14330
    ObjectIds.EventFieldList_Encoding_DefaultBinary: EventFieldList,
14331
    ObjectIds.HistoryEventFieldList_Encoding_DefaultBinary: HistoryEventFieldList,
14332
    ObjectIds.StatusChangeNotification_Encoding_DefaultBinary: StatusChangeNotification,
14333
    ObjectIds.SubscriptionAcknowledgement_Encoding_DefaultBinary: SubscriptionAcknowledgement,
14334
    ObjectIds.PublishRequest_Encoding_DefaultBinary: PublishRequest,
14335
    ObjectIds.PublishResponse_Encoding_DefaultBinary: PublishResponse,
14336
    ObjectIds.RepublishRequest_Encoding_DefaultBinary: RepublishRequest,
14337
    ObjectIds.RepublishResponse_Encoding_DefaultBinary: RepublishResponse,
14338
    ObjectIds.TransferResult_Encoding_DefaultBinary: TransferResult,
14339
    ObjectIds.TransferSubscriptionsRequest_Encoding_DefaultBinary: TransferSubscriptionsRequest,
14340
    ObjectIds.TransferSubscriptionsResponse_Encoding_DefaultBinary: TransferSubscriptionsResponse,
14341
    ObjectIds.DeleteSubscriptionsRequest_Encoding_DefaultBinary: DeleteSubscriptionsRequest,
14342
    ObjectIds.DeleteSubscriptionsResponse_Encoding_DefaultBinary: DeleteSubscriptionsResponse,
14343
    ObjectIds.BuildInfo_Encoding_DefaultBinary: BuildInfo,
14344
    ObjectIds.RedundantServerDataType_Encoding_DefaultBinary: RedundantServerDataType,
14345
    ObjectIds.EndpointUrlListDataType_Encoding_DefaultBinary: EndpointUrlListDataType,
14346
    ObjectIds.NetworkGroupDataType_Encoding_DefaultBinary: NetworkGroupDataType,
14347
    ObjectIds.SamplingIntervalDiagnosticsDataType_Encoding_DefaultBinary: SamplingIntervalDiagnosticsDataType,
14348
    ObjectIds.ServerDiagnosticsSummaryDataType_Encoding_DefaultBinary: ServerDiagnosticsSummaryDataType,
14349
    ObjectIds.ServerStatusDataType_Encoding_DefaultBinary: ServerStatusDataType,
14350
    ObjectIds.SessionDiagnosticsDataType_Encoding_DefaultBinary: SessionDiagnosticsDataType,
14351
    ObjectIds.SessionSecurityDiagnosticsDataType_Encoding_DefaultBinary: SessionSecurityDiagnosticsDataType,
14352
    ObjectIds.ServiceCounterDataType_Encoding_DefaultBinary: ServiceCounterDataType,
14353
    ObjectIds.StatusResult_Encoding_DefaultBinary: StatusResult,
14354
    ObjectIds.SubscriptionDiagnosticsDataType_Encoding_DefaultBinary: SubscriptionDiagnosticsDataType,
14355
    ObjectIds.ModelChangeStructureDataType_Encoding_DefaultBinary: ModelChangeStructureDataType,
14356
    ObjectIds.SemanticChangeStructureDataType_Encoding_DefaultBinary: SemanticChangeStructureDataType,
14357
    ObjectIds.Range_Encoding_DefaultBinary: Range,
14358
    ObjectIds.EUInformation_Encoding_DefaultBinary: EUInformation,
14359
    ObjectIds.ComplexNumberType_Encoding_DefaultBinary: ComplexNumberType,
14360
    ObjectIds.DoubleComplexNumberType_Encoding_DefaultBinary: DoubleComplexNumberType,
14361
    ObjectIds.AxisInformation_Encoding_DefaultBinary: AxisInformation,
14362
    ObjectIds.XVType_Encoding_DefaultBinary: XVType,
14363
    ObjectIds.ProgramDiagnosticDataType_Encoding_DefaultBinary: ProgramDiagnosticDataType,
14364
    ObjectIds.Annotation_Encoding_DefaultBinary: Annotation,
14365
}
14366
14367
14368 1
def extensionobject_from_binary(data):
14369
    """
14370
    Convert binary-coded ExtensionObject to a Python object.
14371
    Returns an object, or None if TypeId is zero
14372
    """
14373 1
    TypeId = NodeId.from_binary(data)
14374 1
    Encoding = ord(data.read(1))
14375 1
    if Encoding & (1 << 0):
14376 1
        Body = unpack_bytes(data)
14377 1
    if TypeId.Identifier == 0:
14378 1
        return None
14379 1
    klass = ExtensionClasses[TypeId.Identifier]
14380 1
    return klass.from_binary(Buffer(Body))
14381
14382
14383 1
def extensionobject_to_binary(obj):
14384
    """
14385
    Convert Python object to binary-coded ExtensionObject.
14386
    If obj is None, convert to empty ExtensionObject (TypeId = 0, no Body).
14387
    Returns a binary string
14388
    """
14389 1
    TypeId = NodeId()
14390 1
    Encoding = 0
14391 1
    Body = None
14392 1
    if obj is not None:
14393 1
        TypeId = FourByteNodeId(getattr(ObjectIds, "{}_Encoding_DefaultBinary".format(obj.__class__.__name__)))
14394 1
        Encoding |= (1 << 0)
14395 1
        Body = obj.to_binary()
14396 1
    packet = []
14397 1
    packet.append(TypeId.to_binary())
14398 1
    packet.append(uatype_UInt8.pack(Encoding))
14399 1
    if Body:
14400 1
        packet.append(pack_bytes(Body))
14401
    return b''.join(packet)
14402