Completed
Push — master ( 1fc97e...d4e3b8 )
by Olivier
04:23
created

BrowseNextResult.to_binary()   A

Complexity

Conditions 3

Size

Total Lines 9

Duplication

Lines 9
Ratio 100 %

Code Coverage

Tests 0
CRAP Score 12

Importance

Changes 0
Metric Value
cc 3
dl 9
loc 9
ccs 0
cts 8
cp 0
crap 12
rs 9.6666
c 0
b 0
f 0
1
'''
2
Autogenerate code from xml spec
3
'''
4
5 1
from datetime import datetime
6 1
from enum import Enum, IntEnum
7
8 1
from opcua.common.utils import Buffer
9 1
from opcua.common.uaerrors import UaError
10 1
from opcua.ua.uatypes import *
11 1
from opcua.ua.object_ids import ObjectIds
12
13
14 1
class NamingRuleType(IntEnum):
15
    '''
16
    :ivar Mandatory:
17
    :vartype Mandatory: 1
18
    :ivar Optional:
19
    :vartype Optional: 2
20
    :ivar Constraint:
21
    :vartype Constraint: 3
22
    '''
23 1
    Mandatory = 1
24 1
    Optional = 2
25 1
    Constraint = 3
26
27
28 1
class OpenFileMode(IntEnum):
29
    '''
30
    :ivar Read:
31
    :vartype Read: 1
32
    :ivar Write:
33
    :vartype Write: 2
34
    :ivar EraseExisting:
35
    :vartype EraseExisting: 4
36
    :ivar Append:
37
    :vartype Append: 8
38
    '''
39 1
    Read = 1
40 1
    Write = 2
41 1
    EraseExisting = 4
42 1
    Append = 8
43
44
45 1
class TrustListMasks(IntEnum):
46
    '''
47
    :ivar None_:
48
    :vartype None_: 0
49
    :ivar TrustedCertificates:
50
    :vartype TrustedCertificates: 1
51
    :ivar TrustedCrls:
52
    :vartype TrustedCrls: 2
53
    :ivar IssuerCertificates:
54
    :vartype IssuerCertificates: 4
55
    :ivar IssuerCrls:
56
    :vartype IssuerCrls: 8
57
    :ivar All:
58
    :vartype All: 15
59
    '''
60 1
    None_ = 0
61 1
    TrustedCertificates = 1
62 1
    TrustedCrls = 2
63 1
    IssuerCertificates = 4
64 1
    IssuerCrls = 8
65 1
    All = 15
66
67
68 1
class IdType(IntEnum):
69
    '''
70
    The type of identifier used in a node id.
71
72
    :ivar Numeric:
73
    :vartype Numeric: 0
74
    :ivar String:
75
    :vartype String: 1
76
    :ivar Guid:
77
    :vartype Guid: 2
78
    :ivar Opaque:
79
    :vartype Opaque: 3
80
    '''
81 1
    Numeric = 0
82 1
    String = 1
83 1
    Guid = 2
84 1
    Opaque = 3
85
86
87 1
class NodeClass(IntEnum):
88
    '''
89
    A mask specifying the class of the node.
90
91
    :ivar Unspecified:
92
    :vartype Unspecified: 0
93
    :ivar Object:
94
    :vartype Object: 1
95
    :ivar Variable:
96
    :vartype Variable: 2
97
    :ivar Method:
98
    :vartype Method: 4
99
    :ivar ObjectType:
100
    :vartype ObjectType: 8
101
    :ivar VariableType:
102
    :vartype VariableType: 16
103
    :ivar ReferenceType:
104
    :vartype ReferenceType: 32
105
    :ivar DataType:
106
    :vartype DataType: 64
107
    :ivar View:
108
    :vartype View: 128
109
    '''
110 1
    Unspecified = 0
111 1
    Object = 1
112 1
    Variable = 2
113 1
    Method = 4
114 1
    ObjectType = 8
115 1
    VariableType = 16
116 1
    ReferenceType = 32
117 1
    DataType = 64
118 1
    View = 128
119
120
121 1
class ApplicationType(IntEnum):
122
    '''
123
    The types of applications.
124
125
    :ivar Server:
126
    :vartype Server: 0
127
    :ivar Client:
128
    :vartype Client: 1
129
    :ivar ClientAndServer:
130
    :vartype ClientAndServer: 2
131
    :ivar DiscoveryServer:
132
    :vartype DiscoveryServer: 3
133
    '''
134 1
    Server = 0
135 1
    Client = 1
136 1
    ClientAndServer = 2
137 1
    DiscoveryServer = 3
138
139
140 1
class MessageSecurityMode(IntEnum):
141
    '''
142
    The type of security to use on a message.
143
144
    :ivar Invalid:
145
    :vartype Invalid: 0
146
    :ivar None_:
147
    :vartype None_: 1
148
    :ivar Sign:
149
    :vartype Sign: 2
150
    :ivar SignAndEncrypt:
151
    :vartype SignAndEncrypt: 3
152
    '''
153 1
    Invalid = 0
154 1
    None_ = 1
155 1
    Sign = 2
156 1
    SignAndEncrypt = 3
157
158
159 1
class UserTokenType(IntEnum):
160
    '''
161
    The possible user token types.
162
163
    :ivar Anonymous:
164
    :vartype Anonymous: 0
165
    :ivar UserName:
166
    :vartype UserName: 1
167
    :ivar Certificate:
168
    :vartype Certificate: 2
169
    :ivar IssuedToken:
170
    :vartype IssuedToken: 3
171
    :ivar Kerberos:
172
    :vartype Kerberos: 4
173
    '''
174 1
    Anonymous = 0
175 1
    UserName = 1
176 1
    Certificate = 2
177 1
    IssuedToken = 3
178 1
    Kerberos = 4
179
180
181 1
class SecurityTokenRequestType(IntEnum):
182
    '''
183
    Indicates whether a token if being created or renewed.
184
185
    :ivar Issue:
186
    :vartype Issue: 0
187
    :ivar Renew:
188
    :vartype Renew: 1
189
    '''
190 1
    Issue = 0
191 1
    Renew = 1
192
193
194 1
class NodeAttributesMask(IntEnum):
195
    '''
196
    The bits used to specify default attributes for a new node.
197
198
    :ivar None_:
199
    :vartype None_: 0
200
    :ivar AccessLevel:
201
    :vartype AccessLevel: 1
202
    :ivar ArrayDimensions:
203
    :vartype ArrayDimensions: 2
204
    :ivar BrowseName:
205
    :vartype BrowseName: 4
206
    :ivar ContainsNoLoops:
207
    :vartype ContainsNoLoops: 8
208
    :ivar DataType:
209
    :vartype DataType: 16
210
    :ivar Description:
211
    :vartype Description: 32
212
    :ivar DisplayName:
213
    :vartype DisplayName: 64
214
    :ivar EventNotifier:
215
    :vartype EventNotifier: 128
216
    :ivar Executable:
217
    :vartype Executable: 256
218
    :ivar Historizing:
219
    :vartype Historizing: 512
220
    :ivar InverseName:
221
    :vartype InverseName: 1024
222
    :ivar IsAbstract:
223
    :vartype IsAbstract: 2048
224
    :ivar MinimumSamplingInterval:
225
    :vartype MinimumSamplingInterval: 4096
226
    :ivar NodeClass:
227
    :vartype NodeClass: 8192
228
    :ivar NodeId:
229
    :vartype NodeId: 16384
230
    :ivar Symmetric:
231
    :vartype Symmetric: 32768
232
    :ivar UserAccessLevel:
233
    :vartype UserAccessLevel: 65536
234
    :ivar UserExecutable:
235
    :vartype UserExecutable: 131072
236
    :ivar UserWriteMask:
237
    :vartype UserWriteMask: 262144
238
    :ivar ValueRank:
239
    :vartype ValueRank: 524288
240
    :ivar WriteMask:
241
    :vartype WriteMask: 1048576
242
    :ivar Value:
243
    :vartype Value: 2097152
244
    :ivar All:
245
    :vartype All: 4194303
246
    :ivar BaseNode:
247
    :vartype BaseNode: 1335396
248
    :ivar Object:
249
    :vartype Object: 1335524
250
    :ivar ObjectTypeOrDataType:
251
    :vartype ObjectTypeOrDataType: 1337444
252
    :ivar Variable:
253
    :vartype Variable: 4026999
254
    :ivar VariableType:
255
    :vartype VariableType: 3958902
256
    :ivar Method:
257
    :vartype Method: 1466724
258
    :ivar ReferenceType:
259
    :vartype ReferenceType: 1371236
260
    :ivar View:
261
    :vartype View: 1335532
262
    '''
263 1
    None_ = 0
264 1
    AccessLevel = 1
265 1
    ArrayDimensions = 2
266 1
    BrowseName = 4
267 1
    ContainsNoLoops = 8
268 1
    DataType = 16
269 1
    Description = 32
270 1
    DisplayName = 64
271 1
    EventNotifier = 128
272 1
    Executable = 256
273 1
    Historizing = 512
274 1
    InverseName = 1024
275 1
    IsAbstract = 2048
276 1
    MinimumSamplingInterval = 4096
277 1
    NodeClass = 8192
278 1
    NodeId = 16384
279 1
    Symmetric = 32768
280 1
    UserAccessLevel = 65536
281 1
    UserExecutable = 131072
282 1
    UserWriteMask = 262144
283 1
    ValueRank = 524288
284 1
    WriteMask = 1048576
285 1
    Value = 2097152
286 1
    All = 4194303
287 1
    BaseNode = 1335396
288 1
    Object = 1335524
289 1
    ObjectTypeOrDataType = 1337444
290 1
    Variable = 4026999
291 1
    VariableType = 3958902
292 1
    Method = 1466724
293 1
    ReferenceType = 1371236
294 1
    View = 1335532
295
296
297 1 View Code Duplication
class AttributeWriteMask(IntEnum):
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
298
    '''
299
    Define bits used to indicate which attributes are writable.
300
301
    :ivar None_:
302
    :vartype None_: 0
303
    :ivar AccessLevel:
304
    :vartype AccessLevel: 1
305
    :ivar ArrayDimensions:
306
    :vartype ArrayDimensions: 2
307
    :ivar BrowseName:
308
    :vartype BrowseName: 4
309
    :ivar ContainsNoLoops:
310
    :vartype ContainsNoLoops: 8
311
    :ivar DataType:
312
    :vartype DataType: 16
313
    :ivar Description:
314
    :vartype Description: 32
315
    :ivar DisplayName:
316
    :vartype DisplayName: 64
317
    :ivar EventNotifier:
318
    :vartype EventNotifier: 128
319
    :ivar Executable:
320
    :vartype Executable: 256
321
    :ivar Historizing:
322
    :vartype Historizing: 512
323
    :ivar InverseName:
324
    :vartype InverseName: 1024
325
    :ivar IsAbstract:
326
    :vartype IsAbstract: 2048
327
    :ivar MinimumSamplingInterval:
328
    :vartype MinimumSamplingInterval: 4096
329
    :ivar NodeClass:
330
    :vartype NodeClass: 8192
331
    :ivar NodeId:
332
    :vartype NodeId: 16384
333
    :ivar Symmetric:
334
    :vartype Symmetric: 32768
335
    :ivar UserAccessLevel:
336
    :vartype UserAccessLevel: 65536
337
    :ivar UserExecutable:
338
    :vartype UserExecutable: 131072
339
    :ivar UserWriteMask:
340
    :vartype UserWriteMask: 262144
341
    :ivar ValueRank:
342
    :vartype ValueRank: 524288
343
    :ivar WriteMask:
344
    :vartype WriteMask: 1048576
345
    :ivar ValueForVariableType:
346
    :vartype ValueForVariableType: 2097152
347
    '''
348 1
    None_ = 0
349 1
    AccessLevel = 1
350 1
    ArrayDimensions = 2
351 1
    BrowseName = 4
352 1
    ContainsNoLoops = 8
353 1
    DataType = 16
354 1
    Description = 32
355 1
    DisplayName = 64
356 1
    EventNotifier = 128
357 1
    Executable = 256
358 1
    Historizing = 512
359 1
    InverseName = 1024
360 1
    IsAbstract = 2048
361 1
    MinimumSamplingInterval = 4096
362 1
    NodeClass = 8192
363 1
    NodeId = 16384
364 1
    Symmetric = 32768
365 1
    UserAccessLevel = 65536
366 1
    UserExecutable = 131072
367 1
    UserWriteMask = 262144
368 1
    ValueRank = 524288
369 1
    WriteMask = 1048576
370 1
    ValueForVariableType = 2097152
371
372
373 1
class BrowseDirection(IntEnum):
374
    '''
375
    The directions of the references to return.
376
377
    :ivar Forward:
378
    :vartype Forward: 0
379
    :ivar Inverse:
380
    :vartype Inverse: 1
381
    :ivar Both:
382
    :vartype Both: 2
383
    '''
384 1
    Forward = 0
385 1
    Inverse = 1
386 1
    Both = 2
387
388
389 1
class BrowseResultMask(IntEnum):
390
    '''
391
    A bit mask which specifies what should be returned in a browse response.
392
393
    :ivar None_:
394
    :vartype None_: 0
395
    :ivar ReferenceTypeId:
396
    :vartype ReferenceTypeId: 1
397
    :ivar IsForward:
398
    :vartype IsForward: 2
399
    :ivar NodeClass:
400
    :vartype NodeClass: 4
401
    :ivar BrowseName:
402
    :vartype BrowseName: 8
403
    :ivar DisplayName:
404
    :vartype DisplayName: 16
405
    :ivar TypeDefinition:
406
    :vartype TypeDefinition: 32
407
    :ivar All:
408
    :vartype All: 63
409
    :ivar ReferenceTypeInfo:
410
    :vartype ReferenceTypeInfo: 3
411
    :ivar TargetInfo:
412
    :vartype TargetInfo: 60
413
    '''
414 1
    None_ = 0
415 1
    ReferenceTypeId = 1
416 1
    IsForward = 2
417 1
    NodeClass = 4
418 1
    BrowseName = 8
419 1
    DisplayName = 16
420 1
    TypeDefinition = 32
421 1
    All = 63
422 1
    ReferenceTypeInfo = 3
423 1
    TargetInfo = 60
424
425
426 1
class ComplianceLevel(IntEnum):
427
    '''
428
    :ivar Untested:
429
    :vartype Untested: 0
430
    :ivar Partial:
431
    :vartype Partial: 1
432
    :ivar SelfTested:
433
    :vartype SelfTested: 2
434
    :ivar Certified:
435
    :vartype Certified: 3
436
    '''
437 1
    Untested = 0
438 1
    Partial = 1
439 1
    SelfTested = 2
440 1
    Certified = 3
441
442
443 1
class FilterOperator(IntEnum):
444
    '''
445
    :ivar Equals:
446
    :vartype Equals: 0
447
    :ivar IsNull:
448
    :vartype IsNull: 1
449
    :ivar GreaterThan:
450
    :vartype GreaterThan: 2
451
    :ivar LessThan:
452
    :vartype LessThan: 3
453
    :ivar GreaterThanOrEqual:
454
    :vartype GreaterThanOrEqual: 4
455
    :ivar LessThanOrEqual:
456
    :vartype LessThanOrEqual: 5
457
    :ivar Like:
458
    :vartype Like: 6
459
    :ivar Not:
460
    :vartype Not: 7
461
    :ivar Between:
462
    :vartype Between: 8
463
    :ivar InList:
464
    :vartype InList: 9
465
    :ivar And:
466
    :vartype And: 10
467
    :ivar Or:
468
    :vartype Or: 11
469
    :ivar Cast:
470
    :vartype Cast: 12
471
    :ivar InView:
472
    :vartype InView: 13
473
    :ivar OfType:
474
    :vartype OfType: 14
475
    :ivar RelatedTo:
476
    :vartype RelatedTo: 15
477
    :ivar BitwiseAnd:
478
    :vartype BitwiseAnd: 16
479
    :ivar BitwiseOr:
480
    :vartype BitwiseOr: 17
481
    '''
482 1
    Equals = 0
483 1
    IsNull = 1
484 1
    GreaterThan = 2
485 1
    LessThan = 3
486 1
    GreaterThanOrEqual = 4
487 1
    LessThanOrEqual = 5
488 1
    Like = 6
489 1
    Not = 7
490 1
    Between = 8
491 1
    InList = 9
492 1
    And = 10
493 1
    Or = 11
494 1
    Cast = 12
495 1
    InView = 13
496 1
    OfType = 14
497 1
    RelatedTo = 15
498 1
    BitwiseAnd = 16
499 1
    BitwiseOr = 17
500
501
502 1
class TimestampsToReturn(IntEnum):
503
    '''
504
    :ivar Source:
505
    :vartype Source: 0
506
    :ivar Server:
507
    :vartype Server: 1
508
    :ivar Both:
509
    :vartype Both: 2
510
    :ivar Neither:
511
    :vartype Neither: 3
512
    '''
513 1
    Source = 0
514 1
    Server = 1
515 1
    Both = 2
516 1
    Neither = 3
517
518
519 1
class HistoryUpdateType(IntEnum):
520
    '''
521
    :ivar Insert:
522
    :vartype Insert: 1
523
    :ivar Replace:
524
    :vartype Replace: 2
525
    :ivar Update:
526
    :vartype Update: 3
527
    :ivar Delete:
528
    :vartype Delete: 4
529
    '''
530 1
    Insert = 1
531 1
    Replace = 2
532 1
    Update = 3
533 1
    Delete = 4
534
535
536 1
class PerformUpdateType(IntEnum):
537
    '''
538
    :ivar Insert:
539
    :vartype Insert: 1
540
    :ivar Replace:
541
    :vartype Replace: 2
542
    :ivar Update:
543
    :vartype Update: 3
544
    :ivar Remove:
545
    :vartype Remove: 4
546
    '''
547 1
    Insert = 1
548 1
    Replace = 2
549 1
    Update = 3
550 1
    Remove = 4
551
552
553 1
class MonitoringMode(IntEnum):
554
    '''
555
    :ivar Disabled:
556
    :vartype Disabled: 0
557
    :ivar Sampling:
558
    :vartype Sampling: 1
559
    :ivar Reporting:
560
    :vartype Reporting: 2
561
    '''
562 1
    Disabled = 0
563 1
    Sampling = 1
564 1
    Reporting = 2
565
566
567 1
class DataChangeTrigger(IntEnum):
568
    '''
569
    :ivar Status:
570
    :vartype Status: 0
571
    :ivar StatusValue:
572
    :vartype StatusValue: 1
573
    :ivar StatusValueTimestamp:
574
    :vartype StatusValueTimestamp: 2
575
    '''
576 1
    Status = 0
577 1
    StatusValue = 1
578 1
    StatusValueTimestamp = 2
579
580
581 1
class DeadbandType(IntEnum):
582
    '''
583
    :ivar None_:
584
    :vartype None_: 0
585
    :ivar Absolute:
586
    :vartype Absolute: 1
587
    :ivar Percent:
588
    :vartype Percent: 2
589
    '''
590 1
    None_ = 0
591 1
    Absolute = 1
592 1
    Percent = 2
593
594
595 1
class EnumeratedTestType(IntEnum):
596
    '''
597
    A simple enumerated type used for testing.
598
599
    :ivar Red:
600
    :vartype Red: 1
601
    :ivar Yellow:
602
    :vartype Yellow: 4
603
    :ivar Green:
604
    :vartype Green: 5
605
    '''
606 1
    Red = 1
607 1
    Yellow = 4
608 1
    Green = 5
609
610
611 1
class RedundancySupport(IntEnum):
612
    '''
613
    :ivar None_:
614
    :vartype None_: 0
615
    :ivar Cold:
616
    :vartype Cold: 1
617
    :ivar Warm:
618
    :vartype Warm: 2
619
    :ivar Hot:
620
    :vartype Hot: 3
621
    :ivar Transparent:
622
    :vartype Transparent: 4
623
    :ivar HotAndMirrored:
624
    :vartype HotAndMirrored: 5
625
    '''
626 1
    None_ = 0
627 1
    Cold = 1
628 1
    Warm = 2
629 1
    Hot = 3
630 1
    Transparent = 4
631 1
    HotAndMirrored = 5
632
633
634 1
class ServerState(IntEnum):
635
    '''
636
    :ivar Running:
637
    :vartype Running: 0
638
    :ivar Failed:
639
    :vartype Failed: 1
640
    :ivar NoConfiguration:
641
    :vartype NoConfiguration: 2
642
    :ivar Suspended:
643
    :vartype Suspended: 3
644
    :ivar Shutdown:
645
    :vartype Shutdown: 4
646
    :ivar Test:
647
    :vartype Test: 5
648
    :ivar CommunicationFault:
649
    :vartype CommunicationFault: 6
650
    :ivar Unknown:
651
    :vartype Unknown: 7
652
    '''
653 1
    Running = 0
654 1
    Failed = 1
655 1
    NoConfiguration = 2
656 1
    Suspended = 3
657 1
    Shutdown = 4
658 1
    Test = 5
659 1
    CommunicationFault = 6
660 1
    Unknown = 7
661
662
663 1
class ModelChangeStructureVerbMask(IntEnum):
664
    '''
665
    :ivar NodeAdded:
666
    :vartype NodeAdded: 1
667
    :ivar NodeDeleted:
668
    :vartype NodeDeleted: 2
669
    :ivar ReferenceAdded:
670
    :vartype ReferenceAdded: 4
671
    :ivar ReferenceDeleted:
672
    :vartype ReferenceDeleted: 8
673
    :ivar DataTypeChanged:
674
    :vartype DataTypeChanged: 16
675
    '''
676 1
    NodeAdded = 1
677 1
    NodeDeleted = 2
678 1
    ReferenceAdded = 4
679 1
    ReferenceDeleted = 8
680 1
    DataTypeChanged = 16
681
682
683 1
class AxisScaleEnumeration(IntEnum):
684
    '''
685
    :ivar Linear:
686
    :vartype Linear: 0
687
    :ivar Log:
688
    :vartype Log: 1
689
    :ivar Ln:
690
    :vartype Ln: 2
691
    '''
692 1
    Linear = 0
693 1
    Log = 1
694 1
    Ln = 2
695
696
697 1
class ExceptionDeviationFormat(IntEnum):
698
    '''
699
    :ivar AbsoluteValue:
700
    :vartype AbsoluteValue: 0
701
    :ivar PercentOfValue:
702
    :vartype PercentOfValue: 1
703
    :ivar PercentOfRange:
704
    :vartype PercentOfRange: 2
705
    :ivar PercentOfEURange:
706
    :vartype PercentOfEURange: 3
707
    :ivar Unknown:
708
    :vartype Unknown: 4
709
    '''
710 1
    AbsoluteValue = 0
711 1
    PercentOfValue = 1
712 1
    PercentOfRange = 2
713 1
    PercentOfEURange = 3
714 1
    Unknown = 4
715
716
717 1
class DiagnosticInfo(FrozenClass):
718
    '''
719
    A recursive structure containing diagnostic information associated with a status code.
720
721
    :ivar Encoding:
722
    :vartype Encoding: UInt8
723
    :ivar SymbolicId:
724
    :vartype SymbolicId: Int32
725
    :ivar NamespaceURI:
726
    :vartype NamespaceURI: Int32
727
    :ivar Locale:
728
    :vartype Locale: Int32
729
    :ivar LocalizedText:
730
    :vartype LocalizedText: Int32
731
    :ivar AdditionalInfo:
732
    :vartype AdditionalInfo: CharArray
733
    :ivar InnerStatusCode:
734
    :vartype InnerStatusCode: StatusCode
735
    :ivar InnerDiagnosticInfo:
736
    :vartype InnerDiagnosticInfo: DiagnosticInfo
737
    '''
738 1
    def __init__(self, binary=None):
739 1
        if binary is not None:
740 1
            self._binary_init(binary)
741 1
            self._freeze = True
742 1
            return
743 1
        self.Encoding = 0
744 1
        self.SymbolicId = 0
745 1
        self.NamespaceURI = 0
746 1
        self.Locale = 0
747 1
        self.LocalizedText = 0
748 1
        self.AdditionalInfo = None
749 1
        self.InnerStatusCode = StatusCode()
750 1
        self.InnerDiagnosticInfo = None
751 1
        self._freeze = True
752
753 1
    def to_binary(self):
754 1
        packet = []
755 1
        if self.SymbolicId: self.Encoding |= (1 << 0)
756 1
        if self.NamespaceURI: self.Encoding |= (1 << 1)
757 1
        if self.Locale: self.Encoding |= (1 << 2)
758 1
        if self.LocalizedText: self.Encoding |= (1 << 3)
759 1
        if self.AdditionalInfo: self.Encoding |= (1 << 4)
760 1
        if self.InnerStatusCode: self.Encoding |= (1 << 5)
761 1
        if self.InnerDiagnosticInfo: self.Encoding |= (1 << 6)
762 1
        packet.append(uatype_UInt8.pack(self.Encoding))
763 1
        if self.SymbolicId: 
764
            packet.append(uatype_Int32.pack(self.SymbolicId))
765 1
        if self.NamespaceURI: 
766
            packet.append(uatype_Int32.pack(self.NamespaceURI))
767 1
        if self.Locale: 
768
            packet.append(uatype_Int32.pack(self.Locale))
769 1
        if self.LocalizedText: 
770
            packet.append(uatype_Int32.pack(self.LocalizedText))
771 1
        if self.AdditionalInfo: 
772
            packet.append(pack_bytes(self.AdditionalInfo))
773 1
        if self.InnerStatusCode: 
774 1
            packet.append(self.InnerStatusCode.to_binary())
775 1
        if self.InnerDiagnosticInfo: 
776
            packet.append(self.InnerDiagnosticInfo.to_binary())
777 1
        return b''.join(packet)
778
779 1
    @staticmethod
780
    def from_binary(data):
781 1
        return DiagnosticInfo(data)
782
783 1
    def _binary_init(self, data):
784 1
        self.Encoding = uatype_UInt8.unpack(data.read(1))[0]
785 1
        if self.Encoding & (1 << 0):
786
            self.SymbolicId = uatype_Int32.unpack(data.read(4))[0]
787
        else:
788 1
            self.SymbolicId = 0
789 1
        if self.Encoding & (1 << 1):
790
            self.NamespaceURI = uatype_Int32.unpack(data.read(4))[0]
791
        else:
792 1
            self.NamespaceURI = 0
793 1
        if self.Encoding & (1 << 2):
794
            self.Locale = uatype_Int32.unpack(data.read(4))[0]
795
        else:
796 1
            self.Locale = 0
797 1
        if self.Encoding & (1 << 3):
798
            self.LocalizedText = uatype_Int32.unpack(data.read(4))[0]
799
        else:
800 1
            self.LocalizedText = 0
801 1
        if self.Encoding & (1 << 4):
802
            self.AdditionalInfo = unpack_bytes(data)
803
        else:
804 1
            self.AdditionalInfo = None
805 1
        if self.Encoding & (1 << 5):
806 1
            self.InnerStatusCode = StatusCode.from_binary(data)
807
        else:
808
            self.InnerStatusCode = StatusCode()
809 1
        if self.Encoding & (1 << 6):
810
            self.InnerDiagnosticInfo = DiagnosticInfo.from_binary(data)
811
        else:
812 1
            self.InnerDiagnosticInfo = None
813
814 1
    def __str__(self):
815
        return 'DiagnosticInfo(' + 'Encoding:' + str(self.Encoding) + ', ' + \
816
               'SymbolicId:' + str(self.SymbolicId) + ', ' + \
817
               'NamespaceURI:' + str(self.NamespaceURI) + ', ' + \
818
               'Locale:' + str(self.Locale) + ', ' + \
819
               'LocalizedText:' + str(self.LocalizedText) + ', ' + \
820
               'AdditionalInfo:' + str(self.AdditionalInfo) + ', ' + \
821
               'InnerStatusCode:' + str(self.InnerStatusCode) + ', ' + \
822
               'InnerDiagnosticInfo:' + str(self.InnerDiagnosticInfo) + ')'
823
824 1
    __repr__ = __str__
825
826
827 1
class TrustListDataType(FrozenClass):
828
    '''
829
    :ivar SpecifiedLists:
830
    :vartype SpecifiedLists: UInt32
831
    :ivar TrustedCertificates:
832
    :vartype TrustedCertificates: ByteString
833
    :ivar TrustedCrls:
834
    :vartype TrustedCrls: ByteString
835
    :ivar IssuerCertificates:
836
    :vartype IssuerCertificates: ByteString
837
    :ivar IssuerCrls:
838
    :vartype IssuerCrls: ByteString
839
    '''
840 1
    def __init__(self, binary=None):
841
        if binary is not None:
842
            self._binary_init(binary)
843
            self._freeze = True
844
            return
845
        self.SpecifiedLists = 0
846
        self.TrustedCertificates = []
847
        self.TrustedCrls = []
848
        self.IssuerCertificates = []
849
        self.IssuerCrls = []
850
        self._freeze = True
851
852 1
    def to_binary(self):
853
        packet = []
854
        packet.append(uatype_UInt32.pack(self.SpecifiedLists))
855
        packet.append(uatype_Int32.pack(len(self.TrustedCertificates)))
856
        for fieldname in self.TrustedCertificates:
857
            packet.append(pack_bytes(fieldname))
858
        packet.append(uatype_Int32.pack(len(self.TrustedCrls)))
859
        for fieldname in self.TrustedCrls:
860
            packet.append(pack_bytes(fieldname))
861
        packet.append(uatype_Int32.pack(len(self.IssuerCertificates)))
862
        for fieldname in self.IssuerCertificates:
863
            packet.append(pack_bytes(fieldname))
864
        packet.append(uatype_Int32.pack(len(self.IssuerCrls)))
865
        for fieldname in self.IssuerCrls:
866
            packet.append(pack_bytes(fieldname))
867
        return b''.join(packet)
868
869 1
    @staticmethod
870
    def from_binary(data):
871
        return TrustListDataType(data)
872
873 1
    def _binary_init(self, data):
874
        self.SpecifiedLists = uatype_UInt32.unpack(data.read(4))[0]
875
        self.TrustedCertificates = unpack_uatype_array('ByteString', data)
876
        self.TrustedCrls = unpack_uatype_array('ByteString', data)
877
        self.IssuerCertificates = unpack_uatype_array('ByteString', data)
878
        self.IssuerCrls = unpack_uatype_array('ByteString', data)
879
880 1
    def __str__(self):
881
        return 'TrustListDataType(' + 'SpecifiedLists:' + str(self.SpecifiedLists) + ', ' + \
882
               'TrustedCertificates:' + str(self.TrustedCertificates) + ', ' + \
883
               'TrustedCrls:' + str(self.TrustedCrls) + ', ' + \
884
               'IssuerCertificates:' + str(self.IssuerCertificates) + ', ' + \
885
               'IssuerCrls:' + str(self.IssuerCrls) + ')'
886
887 1
    __repr__ = __str__
888
889
890 1 View Code Duplication
class Argument(FrozenClass):
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
891
    '''
892
    An argument for a method.
893
894
    :ivar Name:
895
    :vartype Name: String
896
    :ivar DataType:
897
    :vartype DataType: NodeId
898
    :ivar ValueRank:
899
    :vartype ValueRank: Int32
900
    :ivar ArrayDimensions:
901
    :vartype ArrayDimensions: UInt32
902
    :ivar Description:
903
    :vartype Description: LocalizedText
904
    '''
905 1
    def __init__(self, binary=None):
906 1
        if binary is not None:
907
            self._binary_init(binary)
908
            self._freeze = True
909
            return
910 1
        self.Name = None
911 1
        self.DataType = NodeId()
912 1
        self.ValueRank = 0
913 1
        self.ArrayDimensions = []
914 1
        self.Description = LocalizedText()
915 1
        self._freeze = True
916
917 1
    def to_binary(self):
918
        packet = []
919
        packet.append(pack_string(self.Name))
920
        packet.append(self.DataType.to_binary())
921
        packet.append(uatype_Int32.pack(self.ValueRank))
922
        packet.append(uatype_Int32.pack(len(self.ArrayDimensions)))
923
        for fieldname in self.ArrayDimensions:
924
            packet.append(uatype_UInt32.pack(fieldname))
925
        packet.append(self.Description.to_binary())
926
        return b''.join(packet)
927
928 1
    @staticmethod
929
    def from_binary(data):
930
        return Argument(data)
931
932 1
    def _binary_init(self, data):
933
        self.Name = unpack_string(data)
934
        self.DataType = NodeId.from_binary(data)
935
        self.ValueRank = uatype_Int32.unpack(data.read(4))[0]
936
        self.ArrayDimensions = unpack_uatype_array('UInt32', data)
937
        self.Description = LocalizedText.from_binary(data)
938
939 1
    def __str__(self):
940
        return 'Argument(' + 'Name:' + str(self.Name) + ', ' + \
941
               'DataType:' + str(self.DataType) + ', ' + \
942
               'ValueRank:' + str(self.ValueRank) + ', ' + \
943
               'ArrayDimensions:' + str(self.ArrayDimensions) + ', ' + \
944
               'Description:' + str(self.Description) + ')'
945
946 1
    __repr__ = __str__
947
948
949 1
class EnumValueType(FrozenClass):
950
    '''
951
    A mapping between a value of an enumerated type and a name and description.
952
953
    :ivar Value:
954
    :vartype Value: Int64
955
    :ivar DisplayName:
956
    :vartype DisplayName: LocalizedText
957
    :ivar Description:
958
    :vartype Description: LocalizedText
959
    '''
960 1
961
    def __init__(self, binary=None):
962
        if binary is not None:
963
            self._binary_init(binary)
964
            self._freeze = True
965
            return
966
        self.Value = 0
967
        self.DisplayName = LocalizedText()
968
        self.Description = LocalizedText()
969
        self._freeze = True
970 1
971
    def to_binary(self):
972
        packet = []
973
        packet.append(uatype_Int64.pack(self.Value))
974
        packet.append(self.DisplayName.to_binary())
975
        packet.append(self.Description.to_binary())
976
        return b''.join(packet)
977 1
978
    @staticmethod
979
    def from_binary(data):
980
        return EnumValueType(data)
981 1
982
    def _binary_init(self, data):
983
        self.Value = uatype_Int64.unpack(data.read(8))[0]
984
        self.DisplayName = LocalizedText.from_binary(data)
985
        self.Description = LocalizedText.from_binary(data)
986 1
987
    def __str__(self):
988
        return 'EnumValueType(' + 'Value:' + str(self.Value) + ', ' + \
989
               'DisplayName:' + str(self.DisplayName) + ', ' + \
990
               'Description:' + str(self.Description) + ')'
991 1
992
    __repr__ = __str__
993
994 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
995
class OptionSet(FrozenClass):
996
    '''
997
    This abstract Structured DataType is the base DataType for all DataTypes representing a bit mask.
998
999
    :ivar Value:
1000
    :vartype Value: ByteString
1001
    :ivar ValidBits:
1002
    :vartype ValidBits: ByteString
1003 1
    '''
1004
    def __init__(self, binary=None):
1005
        if binary is not None:
1006
            self._binary_init(binary)
1007
            self._freeze = True
1008
            return
1009
        self.Value = None
1010
        self.ValidBits = None
1011
        self._freeze = True
1012 1
1013
    def to_binary(self):
1014
        packet = []
1015
        packet.append(pack_bytes(self.Value))
1016
        packet.append(pack_bytes(self.ValidBits))
1017
        return b''.join(packet)
1018 1
1019
    @staticmethod
1020
    def from_binary(data):
1021
        return OptionSet(data)
1022 1
1023
    def _binary_init(self, data):
1024
        self.Value = unpack_bytes(data)
1025
        self.ValidBits = unpack_bytes(data)
1026 1
1027
    def __str__(self):
1028
        return 'OptionSet(' + 'Value:' + str(self.Value) + ', ' + \
1029
               'ValidBits:' + str(self.ValidBits) + ')'
1030 1
1031
    __repr__ = __str__
1032
1033 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
1034
class Union(FrozenClass):
1035
    '''
1036
    This abstract DataType is the base DataType for all union DataTypes.
1037
1038 1
    '''
1039
    def __init__(self, binary=None):
1040
        if binary is not None:
1041
            self._binary_init(binary)
1042
            self._freeze = True
1043
            return
1044
        self._freeze = True
1045 1
1046
    def to_binary(self):
1047
        packet = []
1048
        return b''.join(packet)
1049 1
1050
    @staticmethod
1051
    def from_binary(data):
1052
        return Union(data)
1053 1
1054
    def _binary_init(self, data):
1055
        pass
1056 1
1057
    def __str__(self):
1058
        return 'Union(' +  + ')'
1059 1
1060
    __repr__ = __str__
1061
1062 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
1063
class TimeZoneDataType(FrozenClass):
1064
    '''
1065
    :ivar Offset:
1066
    :vartype Offset: Int16
1067
    :ivar DaylightSavingInOffset:
1068
    :vartype DaylightSavingInOffset: Boolean
1069 1
    '''
1070
    def __init__(self, binary=None):
1071
        if binary is not None:
1072
            self._binary_init(binary)
1073
            self._freeze = True
1074
            return
1075
        self.Offset = 0
1076
        self.DaylightSavingInOffset = True
1077
        self._freeze = True
1078 1
1079
    def to_binary(self):
1080
        packet = []
1081
        packet.append(uatype_Int16.pack(self.Offset))
1082
        packet.append(uatype_Boolean.pack(self.DaylightSavingInOffset))
1083
        return b''.join(packet)
1084 1
1085
    @staticmethod
1086
    def from_binary(data):
1087
        return TimeZoneDataType(data)
1088 1
1089
    def _binary_init(self, data):
1090
        self.Offset = uatype_Int16.unpack(data.read(2))[0]
1091
        self.DaylightSavingInOffset = uatype_Boolean.unpack(data.read(1))[0]
1092 1
1093
    def __str__(self):
1094
        return 'TimeZoneDataType(' + 'Offset:' + str(self.Offset) + ', ' + \
1095
               'DaylightSavingInOffset:' + str(self.DaylightSavingInOffset) + ')'
1096 1
1097
    __repr__ = __str__
1098
1099 1
1100
class ApplicationDescription(FrozenClass):
1101
    '''
1102
    Describes an application and how to find it.
1103
1104
    :ivar ApplicationUri:
1105
    :vartype ApplicationUri: String
1106
    :ivar ProductUri:
1107
    :vartype ProductUri: String
1108
    :ivar ApplicationName:
1109
    :vartype ApplicationName: LocalizedText
1110
    :ivar ApplicationType:
1111
    :vartype ApplicationType: ApplicationType
1112
    :ivar GatewayServerUri:
1113
    :vartype GatewayServerUri: String
1114
    :ivar DiscoveryProfileUri:
1115
    :vartype DiscoveryProfileUri: String
1116
    :ivar DiscoveryUrls:
1117
    :vartype DiscoveryUrls: String
1118 1
    '''
1119 1
    def __init__(self, binary=None):
1120 1
        if binary is not None:
1121 1
            self._binary_init(binary)
1122 1
            self._freeze = True
1123 1
            return
1124 1
        self.ApplicationUri = None
1125 1
        self.ProductUri = None
1126 1
        self.ApplicationName = LocalizedText()
1127 1
        self.ApplicationType = ApplicationType(0)
1128 1
        self.GatewayServerUri = None
1129 1
        self.DiscoveryProfileUri = None
1130 1
        self.DiscoveryUrls = []
1131
        self._freeze = True
1132 1
1133 1
    def to_binary(self):
1134 1
        packet = []
1135 1
        packet.append(pack_string(self.ApplicationUri))
1136 1
        packet.append(pack_string(self.ProductUri))
1137 1
        packet.append(self.ApplicationName.to_binary())
1138 1
        packet.append(uatype_UInt32.pack(self.ApplicationType.value))
1139 1
        packet.append(pack_string(self.GatewayServerUri))
1140 1
        packet.append(pack_string(self.DiscoveryProfileUri))
1141 1
        packet.append(uatype_Int32.pack(len(self.DiscoveryUrls)))
1142 1
        for fieldname in self.DiscoveryUrls:
1143 1
            packet.append(pack_string(fieldname))
1144
        return b''.join(packet)
1145 1
1146
    @staticmethod
1147 1
    def from_binary(data):
1148
        return ApplicationDescription(data)
1149 1
1150 1
    def _binary_init(self, data):
1151 1
        self.ApplicationUri = unpack_string(data)
1152 1
        self.ProductUri = unpack_string(data)
1153 1
        self.ApplicationName = LocalizedText.from_binary(data)
1154 1
        self.ApplicationType = ApplicationType(uatype_UInt32.unpack(data.read(4))[0])
1155 1
        self.GatewayServerUri = unpack_string(data)
1156 1
        self.DiscoveryProfileUri = unpack_string(data)
1157
        self.DiscoveryUrls = unpack_uatype_array('String', data)
1158 1
1159
    def __str__(self):
1160
        return 'ApplicationDescription(' + 'ApplicationUri:' + str(self.ApplicationUri) + ', ' + \
1161
               'ProductUri:' + str(self.ProductUri) + ', ' + \
1162
               'ApplicationName:' + str(self.ApplicationName) + ', ' + \
1163
               'ApplicationType:' + str(self.ApplicationType) + ', ' + \
1164
               'GatewayServerUri:' + str(self.GatewayServerUri) + ', ' + \
1165
               'DiscoveryProfileUri:' + str(self.DiscoveryProfileUri) + ', ' + \
1166
               'DiscoveryUrls:' + str(self.DiscoveryUrls) + ')'
1167 1
1168
    __repr__ = __str__
1169
1170 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
1171
class RequestHeader(FrozenClass):
1172
    '''
1173
    The header passed with every server request.
1174
1175
    :ivar AuthenticationToken:
1176
    :vartype AuthenticationToken: NodeId
1177
    :ivar Timestamp:
1178
    :vartype Timestamp: DateTime
1179
    :ivar RequestHandle:
1180
    :vartype RequestHandle: UInt32
1181
    :ivar ReturnDiagnostics:
1182
    :vartype ReturnDiagnostics: UInt32
1183
    :ivar AuditEntryId:
1184
    :vartype AuditEntryId: String
1185
    :ivar TimeoutHint:
1186
    :vartype TimeoutHint: UInt32
1187
    :ivar AdditionalHeader:
1188
    :vartype AdditionalHeader: ExtensionObject
1189 1
    '''
1190 1
    def __init__(self, binary=None):
1191 1
        if binary is not None:
1192 1
            self._binary_init(binary)
1193 1
            self._freeze = True
1194 1
            return
1195 1
        self.AuthenticationToken = NodeId()
1196 1
        self.Timestamp = datetime.now()
1197 1
        self.RequestHandle = 0
1198 1
        self.ReturnDiagnostics = 0
1199 1
        self.AuditEntryId = None
1200 1
        self.TimeoutHint = 0
1201 1
        self.AdditionalHeader = None
1202
        self._freeze = True
1203 1
1204 1
    def to_binary(self):
1205 1
        packet = []
1206 1
        packet.append(self.AuthenticationToken.to_binary())
1207 1
        packet.append(pack_datetime(self.Timestamp))
1208 1
        packet.append(uatype_UInt32.pack(self.RequestHandle))
1209 1
        packet.append(uatype_UInt32.pack(self.ReturnDiagnostics))
1210 1
        packet.append(pack_string(self.AuditEntryId))
1211 1
        packet.append(uatype_UInt32.pack(self.TimeoutHint))
1212 1
        packet.append(extensionobject_to_binary(self.AdditionalHeader))
1213
        return b''.join(packet)
1214 1
1215
    @staticmethod
1216 1
    def from_binary(data):
1217
        return RequestHeader(data)
1218 1
1219 1
    def _binary_init(self, data):
1220 1
        self.AuthenticationToken = NodeId.from_binary(data)
1221 1
        self.Timestamp = unpack_datetime(data)
1222 1
        self.RequestHandle = uatype_UInt32.unpack(data.read(4))[0]
1223 1
        self.ReturnDiagnostics = uatype_UInt32.unpack(data.read(4))[0]
1224 1
        self.AuditEntryId = unpack_string(data)
1225 1
        self.TimeoutHint = uatype_UInt32.unpack(data.read(4))[0]
1226
        self.AdditionalHeader = extensionobject_from_binary(data)
1227 1
1228
    def __str__(self):
1229
        return 'RequestHeader(' + 'AuthenticationToken:' + str(self.AuthenticationToken) + ', ' + \
1230
               'Timestamp:' + str(self.Timestamp) + ', ' + \
1231
               'RequestHandle:' + str(self.RequestHandle) + ', ' + \
1232
               'ReturnDiagnostics:' + str(self.ReturnDiagnostics) + ', ' + \
1233
               'AuditEntryId:' + str(self.AuditEntryId) + ', ' + \
1234
               'TimeoutHint:' + str(self.TimeoutHint) + ', ' + \
1235
               'AdditionalHeader:' + str(self.AdditionalHeader) + ')'
1236 1
1237
    __repr__ = __str__
1238
1239 1
1240
class ResponseHeader(FrozenClass):
1241
    '''
1242
    The header passed with every server response.
1243
1244
    :ivar Timestamp:
1245
    :vartype Timestamp: DateTime
1246
    :ivar RequestHandle:
1247
    :vartype RequestHandle: UInt32
1248
    :ivar ServiceResult:
1249
    :vartype ServiceResult: StatusCode
1250
    :ivar ServiceDiagnostics:
1251
    :vartype ServiceDiagnostics: DiagnosticInfo
1252
    :ivar StringTable:
1253
    :vartype StringTable: String
1254
    :ivar AdditionalHeader:
1255
    :vartype AdditionalHeader: ExtensionObject
1256 1
    '''
1257 1
    def __init__(self, binary=None):
1258 1
        if binary is not None:
1259 1
            self._binary_init(binary)
1260 1
            self._freeze = True
1261 1
            return
1262 1
        self.Timestamp = datetime.now()
1263 1
        self.RequestHandle = 0
1264 1
        self.ServiceResult = StatusCode()
1265 1
        self.ServiceDiagnostics = DiagnosticInfo()
1266 1
        self.StringTable = []
1267 1
        self.AdditionalHeader = None
1268
        self._freeze = True
1269 1
1270 1
    def to_binary(self):
1271 1
        packet = []
1272 1
        packet.append(pack_datetime(self.Timestamp))
1273 1
        packet.append(uatype_UInt32.pack(self.RequestHandle))
1274 1
        packet.append(self.ServiceResult.to_binary())
1275 1
        packet.append(self.ServiceDiagnostics.to_binary())
1276 1
        packet.append(uatype_Int32.pack(len(self.StringTable)))
1277
        for fieldname in self.StringTable:
1278 1
            packet.append(pack_string(fieldname))
1279 1
        packet.append(extensionobject_to_binary(self.AdditionalHeader))
1280
        return b''.join(packet)
1281 1
1282
    @staticmethod
1283 1
    def from_binary(data):
1284
        return ResponseHeader(data)
1285 1
1286 1
    def _binary_init(self, data):
1287 1
        self.Timestamp = unpack_datetime(data)
1288 1
        self.RequestHandle = uatype_UInt32.unpack(data.read(4))[0]
1289 1
        self.ServiceResult = StatusCode.from_binary(data)
1290 1
        self.ServiceDiagnostics = DiagnosticInfo.from_binary(data)
1291 1
        self.StringTable = unpack_uatype_array('String', data)
1292
        self.AdditionalHeader = extensionobject_from_binary(data)
1293 1
1294
    def __str__(self):
1295
        return 'ResponseHeader(' + 'Timestamp:' + str(self.Timestamp) + ', ' + \
1296
               'RequestHandle:' + str(self.RequestHandle) + ', ' + \
1297
               'ServiceResult:' + str(self.ServiceResult) + ', ' + \
1298
               'ServiceDiagnostics:' + str(self.ServiceDiagnostics) + ', ' + \
1299
               'StringTable:' + str(self.StringTable) + ', ' + \
1300
               'AdditionalHeader:' + str(self.AdditionalHeader) + ')'
1301 1
1302
    __repr__ = __str__
1303
1304 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
1305
class ServiceFault(FrozenClass):
1306
    '''
1307
    The response returned by all services when there is a service level error.
1308
1309
    :ivar TypeId:
1310
    :vartype TypeId: NodeId
1311
    :ivar ResponseHeader:
1312
    :vartype ResponseHeader: ResponseHeader
1313 1
    '''
1314 1
    def __init__(self, binary=None):
1315
        if binary is not None:
1316
            self._binary_init(binary)
1317
            self._freeze = True
1318 1
            return
1319 1
        self.TypeId = FourByteNodeId(ObjectIds.ServiceFault_Encoding_DefaultBinary)
1320 1
        self.ResponseHeader = ResponseHeader()
1321
        self._freeze = True
1322 1
1323 1
    def to_binary(self):
1324 1
        packet = []
1325 1
        packet.append(self.TypeId.to_binary())
1326 1
        packet.append(self.ResponseHeader.to_binary())
1327
        return b''.join(packet)
1328 1
1329
    @staticmethod
1330
    def from_binary(data):
1331
        return ServiceFault(data)
1332 1
1333
    def _binary_init(self, data):
1334
        self.TypeId = NodeId.from_binary(data)
1335
        self.ResponseHeader = ResponseHeader.from_binary(data)
1336 1
1337
    def __str__(self):
1338
        return 'ServiceFault(' + 'TypeId:' + str(self.TypeId) + ', ' + \
1339
               'ResponseHeader:' + str(self.ResponseHeader) + ')'
1340 1
1341
    __repr__ = __str__
1342
1343 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
1344
class FindServersParameters(FrozenClass):
1345
    '''
1346
    :ivar EndpointUrl:
1347
    :vartype EndpointUrl: String
1348
    :ivar LocaleIds:
1349
    :vartype LocaleIds: String
1350
    :ivar ServerUris:
1351
    :vartype ServerUris: String
1352 1
    '''
1353 1
    def __init__(self, binary=None):
1354 1
        if binary is not None:
1355 1
            self._binary_init(binary)
1356 1
            self._freeze = True
1357 1
            return
1358 1
        self.EndpointUrl = None
1359 1
        self.LocaleIds = []
1360 1
        self.ServerUris = []
1361
        self._freeze = True
1362 1
1363 1
    def to_binary(self):
1364 1
        packet = []
1365 1
        packet.append(pack_string(self.EndpointUrl))
1366 1
        packet.append(uatype_Int32.pack(len(self.LocaleIds)))
1367
        for fieldname in self.LocaleIds:
1368 1
            packet.append(pack_string(fieldname))
1369 1
        packet.append(uatype_Int32.pack(len(self.ServerUris)))
1370 1
        for fieldname in self.ServerUris:
1371 1
            packet.append(pack_string(fieldname))
1372
        return b''.join(packet)
1373 1
1374
    @staticmethod
1375 1
    def from_binary(data):
1376
        return FindServersParameters(data)
1377 1
1378 1
    def _binary_init(self, data):
1379 1
        self.EndpointUrl = unpack_string(data)
1380 1
        self.LocaleIds = unpack_uatype_array('String', data)
1381
        self.ServerUris = unpack_uatype_array('String', data)
1382 1
1383
    def __str__(self):
1384
        return 'FindServersParameters(' + 'EndpointUrl:' + str(self.EndpointUrl) + ', ' + \
1385
               'LocaleIds:' + str(self.LocaleIds) + ', ' + \
1386
               'ServerUris:' + str(self.ServerUris) + ')'
1387 1
1388
    __repr__ = __str__
1389
1390 1
1391
class FindServersRequest(FrozenClass):
1392
    '''
1393
    Finds the servers known to the discovery server.
1394
1395
    :ivar TypeId:
1396
    :vartype TypeId: NodeId
1397
    :ivar RequestHeader:
1398
    :vartype RequestHeader: RequestHeader
1399
    :ivar Parameters:
1400
    :vartype Parameters: FindServersParameters
1401 1
    '''
1402 1
    def __init__(self, binary=None):
1403
        if binary is not None:
1404
            self._binary_init(binary)
1405
            self._freeze = True
1406 1
            return
1407 1
        self.TypeId = FourByteNodeId(ObjectIds.FindServersRequest_Encoding_DefaultBinary)
1408 1
        self.RequestHeader = RequestHeader()
1409 1
        self.Parameters = FindServersParameters()
1410
        self._freeze = True
1411 1
1412 1
    def to_binary(self):
1413 1
        packet = []
1414 1
        packet.append(self.TypeId.to_binary())
1415 1
        packet.append(self.RequestHeader.to_binary())
1416 1
        packet.append(self.Parameters.to_binary())
1417
        return b''.join(packet)
1418 1
1419
    @staticmethod
1420
    def from_binary(data):
1421
        return FindServersRequest(data)
1422 1
1423
    def _binary_init(self, data):
1424
        self.TypeId = NodeId.from_binary(data)
1425
        self.RequestHeader = RequestHeader.from_binary(data)
1426
        self.Parameters = FindServersParameters.from_binary(data)
1427 1
1428
    def __str__(self):
1429
        return 'FindServersRequest(' + 'TypeId:' + str(self.TypeId) + ', ' + \
1430
               'RequestHeader:' + str(self.RequestHeader) + ', ' + \
1431
               'Parameters:' + str(self.Parameters) + ')'
1432 1
1433
    __repr__ = __str__
1434
1435 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
1436
class FindServersResponse(FrozenClass):
1437
    '''
1438
    Finds the servers known to the discovery server.
1439
1440
    :ivar TypeId:
1441
    :vartype TypeId: NodeId
1442
    :ivar ResponseHeader:
1443
    :vartype ResponseHeader: ResponseHeader
1444
    :ivar Servers:
1445
    :vartype Servers: ApplicationDescription
1446 1
    '''
1447 1
    def __init__(self, binary=None):
1448 1
        if binary is not None:
1449 1
            self._binary_init(binary)
1450 1
            self._freeze = True
1451 1
            return
1452 1
        self.TypeId = FourByteNodeId(ObjectIds.FindServersResponse_Encoding_DefaultBinary)
1453 1
        self.ResponseHeader = ResponseHeader()
1454 1
        self.Servers = []
1455
        self._freeze = True
1456 1
1457 1
    def to_binary(self):
1458 1
        packet = []
1459 1
        packet.append(self.TypeId.to_binary())
1460 1
        packet.append(self.ResponseHeader.to_binary())
1461 1
        packet.append(uatype_Int32.pack(len(self.Servers)))
1462 1
        for fieldname in self.Servers:
1463 1
            packet.append(fieldname.to_binary())
1464
        return b''.join(packet)
1465 1
1466
    @staticmethod
1467 1
    def from_binary(data):
1468
        return FindServersResponse(data)
1469 1
1470 1
    def _binary_init(self, data):
1471 1
        self.TypeId = NodeId.from_binary(data)
1472 1
        self.ResponseHeader = ResponseHeader.from_binary(data)
1473 1
        length = uatype_Int32.unpack(data.read(4))[0]
1474 1
        array = []
1475 1
        if length != -1:
1476 1
            for _ in range(0, length):
1477 1
                array.append(ApplicationDescription.from_binary(data))
1478
        self.Servers = array
1479 1
1480
    def __str__(self):
1481
        return 'FindServersResponse(' + 'TypeId:' + str(self.TypeId) + ', ' + \
1482
               'ResponseHeader:' + str(self.ResponseHeader) + ', ' + \
1483
               'Servers:' + str(self.Servers) + ')'
1484 1
1485
    __repr__ = __str__
1486
1487 1
1488
class ServerOnNetwork(FrozenClass):
1489
    '''
1490
    :ivar RecordId:
1491
    :vartype RecordId: UInt32
1492
    :ivar ServerName:
1493
    :vartype ServerName: String
1494
    :ivar DiscoveryUrl:
1495
    :vartype DiscoveryUrl: String
1496
    :ivar ServerCapabilities:
1497
    :vartype ServerCapabilities: String
1498 1
    '''
1499
    def __init__(self, binary=None):
1500
        if binary is not None:
1501
            self._binary_init(binary)
1502
            self._freeze = True
1503
            return
1504
        self.RecordId = 0
1505
        self.ServerName = None
1506
        self.DiscoveryUrl = None
1507
        self.ServerCapabilities = []
1508
        self._freeze = True
1509 1
1510
    def to_binary(self):
1511
        packet = []
1512
        packet.append(uatype_UInt32.pack(self.RecordId))
1513
        packet.append(pack_string(self.ServerName))
1514
        packet.append(pack_string(self.DiscoveryUrl))
1515
        packet.append(uatype_Int32.pack(len(self.ServerCapabilities)))
1516
        for fieldname in self.ServerCapabilities:
1517
            packet.append(pack_string(fieldname))
1518
        return b''.join(packet)
1519 1
1520
    @staticmethod
1521
    def from_binary(data):
1522
        return ServerOnNetwork(data)
1523 1
1524
    def _binary_init(self, data):
1525
        self.RecordId = uatype_UInt32.unpack(data.read(4))[0]
1526
        self.ServerName = unpack_string(data)
1527
        self.DiscoveryUrl = unpack_string(data)
1528
        self.ServerCapabilities = unpack_uatype_array('String', data)
1529 1
1530
    def __str__(self):
1531
        return 'ServerOnNetwork(' + 'RecordId:' + str(self.RecordId) + ', ' + \
1532
               'ServerName:' + str(self.ServerName) + ', ' + \
1533
               'DiscoveryUrl:' + str(self.DiscoveryUrl) + ', ' + \
1534
               'ServerCapabilities:' + str(self.ServerCapabilities) + ')'
1535 1
1536
    __repr__ = __str__
1537
1538 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
1539
class FindServersOnNetworkParameters(FrozenClass):
1540
    '''
1541
    :ivar StartingRecordId:
1542
    :vartype StartingRecordId: UInt32
1543
    :ivar MaxRecordsToReturn:
1544
    :vartype MaxRecordsToReturn: UInt32
1545
    :ivar ServerCapabilityFilter:
1546
    :vartype ServerCapabilityFilter: String
1547 1
    '''
1548
    def __init__(self, binary=None):
1549
        if binary is not None:
1550
            self._binary_init(binary)
1551
            self._freeze = True
1552
            return
1553
        self.StartingRecordId = 0
1554
        self.MaxRecordsToReturn = 0
1555
        self.ServerCapabilityFilter = []
1556
        self._freeze = True
1557 1
1558
    def to_binary(self):
1559
        packet = []
1560
        packet.append(uatype_UInt32.pack(self.StartingRecordId))
1561
        packet.append(uatype_UInt32.pack(self.MaxRecordsToReturn))
1562
        packet.append(uatype_Int32.pack(len(self.ServerCapabilityFilter)))
1563
        for fieldname in self.ServerCapabilityFilter:
1564
            packet.append(pack_string(fieldname))
1565
        return b''.join(packet)
1566 1
1567
    @staticmethod
1568
    def from_binary(data):
1569
        return FindServersOnNetworkParameters(data)
1570 1
1571
    def _binary_init(self, data):
1572
        self.StartingRecordId = uatype_UInt32.unpack(data.read(4))[0]
1573
        self.MaxRecordsToReturn = uatype_UInt32.unpack(data.read(4))[0]
1574
        self.ServerCapabilityFilter = unpack_uatype_array('String', data)
1575 1
1576
    def __str__(self):
1577
        return 'FindServersOnNetworkParameters(' + 'StartingRecordId:' + str(self.StartingRecordId) + ', ' + \
1578
               'MaxRecordsToReturn:' + str(self.MaxRecordsToReturn) + ', ' + \
1579
               'ServerCapabilityFilter:' + str(self.ServerCapabilityFilter) + ')'
1580 1
1581
    __repr__ = __str__
1582
1583 1
1584
class FindServersOnNetworkRequest(FrozenClass):
1585
    '''
1586
    :ivar TypeId:
1587
    :vartype TypeId: NodeId
1588
    :ivar RequestHeader:
1589
    :vartype RequestHeader: RequestHeader
1590
    :ivar Parameters:
1591
    :vartype Parameters: FindServersOnNetworkParameters
1592 1
    '''
1593
    def __init__(self, binary=None):
1594
        if binary is not None:
1595
            self._binary_init(binary)
1596
            self._freeze = True
1597
            return
1598
        self.TypeId = FourByteNodeId(ObjectIds.FindServersOnNetworkRequest_Encoding_DefaultBinary)
1599
        self.RequestHeader = RequestHeader()
1600
        self.Parameters = FindServersOnNetworkParameters()
1601
        self._freeze = True
1602 1
1603
    def to_binary(self):
1604
        packet = []
1605
        packet.append(self.TypeId.to_binary())
1606
        packet.append(self.RequestHeader.to_binary())
1607
        packet.append(self.Parameters.to_binary())
1608
        return b''.join(packet)
1609 1
1610
    @staticmethod
1611
    def from_binary(data):
1612
        return FindServersOnNetworkRequest(data)
1613 1
1614
    def _binary_init(self, data):
1615
        self.TypeId = NodeId.from_binary(data)
1616
        self.RequestHeader = RequestHeader.from_binary(data)
1617
        self.Parameters = FindServersOnNetworkParameters.from_binary(data)
1618 1
1619
    def __str__(self):
1620
        return 'FindServersOnNetworkRequest(' + 'TypeId:' + str(self.TypeId) + ', ' + \
1621
               'RequestHeader:' + str(self.RequestHeader) + ', ' + \
1622
               'Parameters:' + str(self.Parameters) + ')'
1623 1
1624
    __repr__ = __str__
1625
1626 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
1627
class FindServersOnNetworkResult(FrozenClass):
1628
    '''
1629
    :ivar LastCounterResetTime:
1630
    :vartype LastCounterResetTime: DateTime
1631
    :ivar Servers:
1632
    :vartype Servers: ServerOnNetwork
1633 1
    '''
1634
    def __init__(self, binary=None):
1635
        if binary is not None:
1636
            self._binary_init(binary)
1637
            self._freeze = True
1638
            return
1639
        self.LastCounterResetTime = datetime.now()
1640
        self.Servers = []
1641
        self._freeze = True
1642 1
1643
    def to_binary(self):
1644
        packet = []
1645
        packet.append(pack_datetime(self.LastCounterResetTime))
1646
        packet.append(uatype_Int32.pack(len(self.Servers)))
1647
        for fieldname in self.Servers:
1648
            packet.append(fieldname.to_binary())
1649
        return b''.join(packet)
1650 1
1651
    @staticmethod
1652
    def from_binary(data):
1653
        return FindServersOnNetworkResult(data)
1654 1
1655
    def _binary_init(self, data):
1656
        self.LastCounterResetTime = unpack_datetime(data)
1657
        length = uatype_Int32.unpack(data.read(4))[0]
1658
        array = []
1659
        if length != -1:
1660
            for _ in range(0, length):
1661
                array.append(ServerOnNetwork.from_binary(data))
1662
        self.Servers = array
1663 1
1664
    def __str__(self):
1665
        return 'FindServersOnNetworkResult(' + 'LastCounterResetTime:' + str(self.LastCounterResetTime) + ', ' + \
1666
               'Servers:' + str(self.Servers) + ')'
1667 1
1668
    __repr__ = __str__
1669
1670 1
1671
class FindServersOnNetworkResponse(FrozenClass):
1672
    '''
1673
    :ivar TypeId:
1674
    :vartype TypeId: NodeId
1675
    :ivar ResponseHeader:
1676
    :vartype ResponseHeader: ResponseHeader
1677
    :ivar Parameters:
1678
    :vartype Parameters: FindServersOnNetworkResult
1679 1
    '''
1680
    def __init__(self, binary=None):
1681
        if binary is not None:
1682
            self._binary_init(binary)
1683
            self._freeze = True
1684
            return
1685
        self.TypeId = FourByteNodeId(ObjectIds.FindServersOnNetworkResponse_Encoding_DefaultBinary)
1686
        self.ResponseHeader = ResponseHeader()
1687
        self.Parameters = FindServersOnNetworkResult()
1688
        self._freeze = True
1689 1
1690
    def to_binary(self):
1691
        packet = []
1692
        packet.append(self.TypeId.to_binary())
1693
        packet.append(self.ResponseHeader.to_binary())
1694
        packet.append(self.Parameters.to_binary())
1695
        return b''.join(packet)
1696 1
1697
    @staticmethod
1698
    def from_binary(data):
1699
        return FindServersOnNetworkResponse(data)
1700 1
1701
    def _binary_init(self, data):
1702
        self.TypeId = NodeId.from_binary(data)
1703
        self.ResponseHeader = ResponseHeader.from_binary(data)
1704
        self.Parameters = FindServersOnNetworkResult.from_binary(data)
1705 1
1706
    def __str__(self):
1707
        return 'FindServersOnNetworkResponse(' + 'TypeId:' + str(self.TypeId) + ', ' + \
1708
               'ResponseHeader:' + str(self.ResponseHeader) + ', ' + \
1709
               'Parameters:' + str(self.Parameters) + ')'
1710 1
1711
    __repr__ = __str__
1712
1713 1
1714
class UserTokenPolicy(FrozenClass):
1715
    '''
1716
    Describes a user token that can be used with a server.
1717
1718
    :ivar PolicyId:
1719
    :vartype PolicyId: String
1720
    :ivar TokenType:
1721
    :vartype TokenType: UserTokenType
1722
    :ivar IssuedTokenType:
1723
    :vartype IssuedTokenType: String
1724
    :ivar IssuerEndpointUrl:
1725
    :vartype IssuerEndpointUrl: String
1726
    :ivar SecurityPolicyUri:
1727
    :vartype SecurityPolicyUri: String
1728 1
    '''
1729 1
    def __init__(self, binary=None):
1730 1
        if binary is not None:
1731 1
            self._binary_init(binary)
1732 1
            self._freeze = True
1733 1
            return
1734 1
        self.PolicyId = None
1735 1
        self.TokenType = UserTokenType(0)
1736 1
        self.IssuedTokenType = None
1737 1
        self.IssuerEndpointUrl = None
1738 1
        self.SecurityPolicyUri = None
1739
        self._freeze = True
1740 1
1741 1
    def to_binary(self):
1742 1
        packet = []
1743 1
        packet.append(pack_string(self.PolicyId))
1744 1
        packet.append(uatype_UInt32.pack(self.TokenType.value))
1745 1
        packet.append(pack_string(self.IssuedTokenType))
1746 1
        packet.append(pack_string(self.IssuerEndpointUrl))
1747 1
        packet.append(pack_string(self.SecurityPolicyUri))
1748
        return b''.join(packet)
1749 1
1750
    @staticmethod
1751 1
    def from_binary(data):
1752
        return UserTokenPolicy(data)
1753 1
1754 1
    def _binary_init(self, data):
1755 1
        self.PolicyId = unpack_string(data)
1756 1
        self.TokenType = UserTokenType(uatype_UInt32.unpack(data.read(4))[0])
1757 1
        self.IssuedTokenType = unpack_string(data)
1758 1
        self.IssuerEndpointUrl = unpack_string(data)
1759
        self.SecurityPolicyUri = unpack_string(data)
1760 1
1761
    def __str__(self):
1762
        return 'UserTokenPolicy(' + 'PolicyId:' + str(self.PolicyId) + ', ' + \
1763
               'TokenType:' + str(self.TokenType) + ', ' + \
1764
               'IssuedTokenType:' + str(self.IssuedTokenType) + ', ' + \
1765
               'IssuerEndpointUrl:' + str(self.IssuerEndpointUrl) + ', ' + \
1766
               'SecurityPolicyUri:' + str(self.SecurityPolicyUri) + ')'
1767 1
1768
    __repr__ = __str__
1769
1770 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
1771
class EndpointDescription(FrozenClass):
1772
    '''
1773
    The description of a endpoint that can be used to access a server.
1774
1775
    :ivar EndpointUrl:
1776
    :vartype EndpointUrl: String
1777
    :ivar Server:
1778
    :vartype Server: ApplicationDescription
1779
    :ivar ServerCertificate:
1780
    :vartype ServerCertificate: ByteString
1781
    :ivar SecurityMode:
1782
    :vartype SecurityMode: MessageSecurityMode
1783
    :ivar SecurityPolicyUri:
1784
    :vartype SecurityPolicyUri: String
1785
    :ivar UserIdentityTokens:
1786
    :vartype UserIdentityTokens: UserTokenPolicy
1787
    :ivar TransportProfileUri:
1788
    :vartype TransportProfileUri: String
1789
    :ivar SecurityLevel:
1790
    :vartype SecurityLevel: Byte
1791 1
    '''
1792 1
    def __init__(self, binary=None):
1793 1
        if binary is not None:
1794 1
            self._binary_init(binary)
1795 1
            self._freeze = True
1796 1
            return
1797 1
        self.EndpointUrl = None
1798 1
        self.Server = ApplicationDescription()
1799 1
        self.ServerCertificate = None
1800 1
        self.SecurityMode = MessageSecurityMode(0)
1801 1
        self.SecurityPolicyUri = None
1802 1
        self.UserIdentityTokens = []
1803 1
        self.TransportProfileUri = None
1804 1
        self.SecurityLevel = 0
1805
        self._freeze = True
1806 1
1807 1
    def to_binary(self):
1808 1
        packet = []
1809 1
        packet.append(pack_string(self.EndpointUrl))
1810 1
        packet.append(self.Server.to_binary())
1811 1
        packet.append(pack_bytes(self.ServerCertificate))
1812 1
        packet.append(uatype_UInt32.pack(self.SecurityMode.value))
1813 1
        packet.append(pack_string(self.SecurityPolicyUri))
1814 1
        packet.append(uatype_Int32.pack(len(self.UserIdentityTokens)))
1815 1
        for fieldname in self.UserIdentityTokens:
1816 1
            packet.append(fieldname.to_binary())
1817 1
        packet.append(pack_string(self.TransportProfileUri))
1818 1
        packet.append(uatype_Byte.pack(self.SecurityLevel))
1819
        return b''.join(packet)
1820 1
1821
    @staticmethod
1822 1
    def from_binary(data):
1823
        return EndpointDescription(data)
1824 1
1825 1
    def _binary_init(self, data):
1826 1
        self.EndpointUrl = unpack_string(data)
1827 1
        self.Server = ApplicationDescription.from_binary(data)
1828 1
        self.ServerCertificate = unpack_bytes(data)
1829 1
        self.SecurityMode = MessageSecurityMode(uatype_UInt32.unpack(data.read(4))[0])
1830 1
        self.SecurityPolicyUri = unpack_string(data)
1831 1
        length = uatype_Int32.unpack(data.read(4))[0]
1832 1
        array = []
1833 1
        if length != -1:
1834 1
            for _ in range(0, length):
1835 1
                array.append(UserTokenPolicy.from_binary(data))
1836 1
        self.UserIdentityTokens = array
1837 1
        self.TransportProfileUri = unpack_string(data)
1838
        self.SecurityLevel = uatype_Byte.unpack(data.read(1))[0]
1839 1
1840
    def __str__(self):
1841
        return 'EndpointDescription(' + 'EndpointUrl:' + str(self.EndpointUrl) + ', ' + \
1842
               'Server:' + str(self.Server) + ', ' + \
1843
               'ServerCertificate:' + str(self.ServerCertificate) + ', ' + \
1844
               'SecurityMode:' + str(self.SecurityMode) + ', ' + \
1845
               'SecurityPolicyUri:' + str(self.SecurityPolicyUri) + ', ' + \
1846
               'UserIdentityTokens:' + str(self.UserIdentityTokens) + ', ' + \
1847
               'TransportProfileUri:' + str(self.TransportProfileUri) + ', ' + \
1848
               'SecurityLevel:' + str(self.SecurityLevel) + ')'
1849 1
1850
    __repr__ = __str__
1851
1852 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
1853
class GetEndpointsParameters(FrozenClass):
1854
    '''
1855
    :ivar EndpointUrl:
1856
    :vartype EndpointUrl: String
1857
    :ivar LocaleIds:
1858
    :vartype LocaleIds: String
1859
    :ivar ProfileUris:
1860
    :vartype ProfileUris: String
1861 1
    '''
1862 1
    def __init__(self, binary=None):
1863 1
        if binary is not None:
1864 1
            self._binary_init(binary)
1865 1
            self._freeze = True
1866 1
            return
1867 1
        self.EndpointUrl = None
1868 1
        self.LocaleIds = []
1869 1
        self.ProfileUris = []
1870
        self._freeze = True
1871 1
1872 1
    def to_binary(self):
1873 1
        packet = []
1874 1
        packet.append(pack_string(self.EndpointUrl))
1875 1
        packet.append(uatype_Int32.pack(len(self.LocaleIds)))
1876
        for fieldname in self.LocaleIds:
1877 1
            packet.append(pack_string(fieldname))
1878 1
        packet.append(uatype_Int32.pack(len(self.ProfileUris)))
1879
        for fieldname in self.ProfileUris:
1880 1
            packet.append(pack_string(fieldname))
1881
        return b''.join(packet)
1882 1
1883
    @staticmethod
1884 1
    def from_binary(data):
1885
        return GetEndpointsParameters(data)
1886 1
1887 1
    def _binary_init(self, data):
1888 1
        self.EndpointUrl = unpack_string(data)
1889 1
        self.LocaleIds = unpack_uatype_array('String', data)
1890
        self.ProfileUris = unpack_uatype_array('String', data)
1891 1
1892
    def __str__(self):
1893
        return 'GetEndpointsParameters(' + 'EndpointUrl:' + str(self.EndpointUrl) + ', ' + \
1894
               'LocaleIds:' + str(self.LocaleIds) + ', ' + \
1895
               'ProfileUris:' + str(self.ProfileUris) + ')'
1896 1
1897
    __repr__ = __str__
1898
1899 1
1900
class GetEndpointsRequest(FrozenClass):
1901
    '''
1902
    Gets the endpoints used by the server.
1903
1904
    :ivar TypeId:
1905
    :vartype TypeId: NodeId
1906
    :ivar RequestHeader:
1907
    :vartype RequestHeader: RequestHeader
1908
    :ivar Parameters:
1909
    :vartype Parameters: GetEndpointsParameters
1910 1
    '''
1911 1
    def __init__(self, binary=None):
1912
        if binary is not None:
1913
            self._binary_init(binary)
1914
            self._freeze = True
1915 1
            return
1916 1
        self.TypeId = FourByteNodeId(ObjectIds.GetEndpointsRequest_Encoding_DefaultBinary)
1917 1
        self.RequestHeader = RequestHeader()
1918 1
        self.Parameters = GetEndpointsParameters()
1919
        self._freeze = True
1920 1
1921 1
    def to_binary(self):
1922 1
        packet = []
1923 1
        packet.append(self.TypeId.to_binary())
1924 1
        packet.append(self.RequestHeader.to_binary())
1925 1
        packet.append(self.Parameters.to_binary())
1926
        return b''.join(packet)
1927 1
1928
    @staticmethod
1929
    def from_binary(data):
1930
        return GetEndpointsRequest(data)
1931 1
1932
    def _binary_init(self, data):
1933
        self.TypeId = NodeId.from_binary(data)
1934
        self.RequestHeader = RequestHeader.from_binary(data)
1935
        self.Parameters = GetEndpointsParameters.from_binary(data)
1936 1
1937
    def __str__(self):
1938
        return 'GetEndpointsRequest(' + 'TypeId:' + str(self.TypeId) + ', ' + \
1939
               'RequestHeader:' + str(self.RequestHeader) + ', ' + \
1940
               'Parameters:' + str(self.Parameters) + ')'
1941 1
1942
    __repr__ = __str__
1943
1944 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
1945
class GetEndpointsResponse(FrozenClass):
1946
    '''
1947
    Gets the endpoints used by the server.
1948
1949
    :ivar TypeId:
1950
    :vartype TypeId: NodeId
1951
    :ivar ResponseHeader:
1952
    :vartype ResponseHeader: ResponseHeader
1953
    :ivar Endpoints:
1954
    :vartype Endpoints: EndpointDescription
1955 1
    '''
1956 1
    def __init__(self, binary=None):
1957 1
        if binary is not None:
1958 1
            self._binary_init(binary)
1959 1
            self._freeze = True
1960 1
            return
1961 1
        self.TypeId = FourByteNodeId(ObjectIds.GetEndpointsResponse_Encoding_DefaultBinary)
1962 1
        self.ResponseHeader = ResponseHeader()
1963 1
        self.Endpoints = []
1964
        self._freeze = True
1965 1
1966 1
    def to_binary(self):
1967 1
        packet = []
1968 1
        packet.append(self.TypeId.to_binary())
1969 1
        packet.append(self.ResponseHeader.to_binary())
1970 1
        packet.append(uatype_Int32.pack(len(self.Endpoints)))
1971 1
        for fieldname in self.Endpoints:
1972 1
            packet.append(fieldname.to_binary())
1973
        return b''.join(packet)
1974 1
1975
    @staticmethod
1976 1
    def from_binary(data):
1977
        return GetEndpointsResponse(data)
1978 1
1979 1
    def _binary_init(self, data):
1980 1
        self.TypeId = NodeId.from_binary(data)
1981 1
        self.ResponseHeader = ResponseHeader.from_binary(data)
1982 1
        length = uatype_Int32.unpack(data.read(4))[0]
1983 1
        array = []
1984 1
        if length != -1:
1985 1
            for _ in range(0, length):
1986 1
                array.append(EndpointDescription.from_binary(data))
1987
        self.Endpoints = array
1988 1
1989
    def __str__(self):
1990
        return 'GetEndpointsResponse(' + 'TypeId:' + str(self.TypeId) + ', ' + \
1991
               'ResponseHeader:' + str(self.ResponseHeader) + ', ' + \
1992
               'Endpoints:' + str(self.Endpoints) + ')'
1993 1
1994
    __repr__ = __str__
1995
1996 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
1997
class RegisteredServer(FrozenClass):
1998
    '''
1999
    The information required to register a server with a discovery server.
2000
2001
    :ivar ServerUri:
2002
    :vartype ServerUri: String
2003
    :ivar ProductUri:
2004
    :vartype ProductUri: String
2005
    :ivar ServerNames:
2006
    :vartype ServerNames: LocalizedText
2007
    :ivar ServerType:
2008
    :vartype ServerType: ApplicationType
2009
    :ivar GatewayServerUri:
2010
    :vartype GatewayServerUri: String
2011
    :ivar DiscoveryUrls:
2012
    :vartype DiscoveryUrls: String
2013
    :ivar SemaphoreFilePath:
2014
    :vartype SemaphoreFilePath: String
2015
    :ivar IsOnline:
2016
    :vartype IsOnline: Boolean
2017 1
    '''
2018 1
    def __init__(self, binary=None):
2019 1
        if binary is not None:
2020 1
            self._binary_init(binary)
2021 1
            self._freeze = True
2022 1
            return
2023 1
        self.ServerUri = None
2024 1
        self.ProductUri = None
2025 1
        self.ServerNames = []
2026 1
        self.ServerType = ApplicationType(0)
2027 1
        self.GatewayServerUri = None
2028 1
        self.DiscoveryUrls = []
2029 1
        self.SemaphoreFilePath = None
2030 1
        self.IsOnline = True
2031
        self._freeze = True
2032 1
2033 1
    def to_binary(self):
2034 1
        packet = []
2035 1
        packet.append(pack_string(self.ServerUri))
2036 1
        packet.append(pack_string(self.ProductUri))
2037 1
        packet.append(uatype_Int32.pack(len(self.ServerNames)))
2038 1
        for fieldname in self.ServerNames:
2039 1
            packet.append(fieldname.to_binary())
2040 1
        packet.append(uatype_UInt32.pack(self.ServerType.value))
2041 1
        packet.append(pack_string(self.GatewayServerUri))
2042 1
        packet.append(uatype_Int32.pack(len(self.DiscoveryUrls)))
2043 1
        for fieldname in self.DiscoveryUrls:
2044 1
            packet.append(pack_string(fieldname))
2045 1
        packet.append(pack_string(self.SemaphoreFilePath))
2046 1
        packet.append(uatype_Boolean.pack(self.IsOnline))
2047
        return b''.join(packet)
2048 1
2049
    @staticmethod
2050 1
    def from_binary(data):
2051
        return RegisteredServer(data)
2052 1
2053 1
    def _binary_init(self, data):
2054 1
        self.ServerUri = unpack_string(data)
2055 1
        self.ProductUri = unpack_string(data)
2056 1
        length = uatype_Int32.unpack(data.read(4))[0]
2057 1
        array = []
2058 1
        if length != -1:
2059 1
            for _ in range(0, length):
2060 1
                array.append(LocalizedText.from_binary(data))
2061 1
        self.ServerNames = array
2062 1
        self.ServerType = ApplicationType(uatype_UInt32.unpack(data.read(4))[0])
2063 1
        self.GatewayServerUri = unpack_string(data)
2064 1
        self.DiscoveryUrls = unpack_uatype_array('String', data)
2065 1
        self.SemaphoreFilePath = unpack_string(data)
2066
        self.IsOnline = uatype_Boolean.unpack(data.read(1))[0]
2067 1
2068
    def __str__(self):
2069
        return 'RegisteredServer(' + 'ServerUri:' + str(self.ServerUri) + ', ' + \
2070
               'ProductUri:' + str(self.ProductUri) + ', ' + \
2071
               'ServerNames:' + str(self.ServerNames) + ', ' + \
2072
               'ServerType:' + str(self.ServerType) + ', ' + \
2073
               'GatewayServerUri:' + str(self.GatewayServerUri) + ', ' + \
2074
               'DiscoveryUrls:' + str(self.DiscoveryUrls) + ', ' + \
2075
               'SemaphoreFilePath:' + str(self.SemaphoreFilePath) + ', ' + \
2076
               'IsOnline:' + str(self.IsOnline) + ')'
2077 1
2078
    __repr__ = __str__
2079
2080 1
2081
class RegisterServerRequest(FrozenClass):
2082
    '''
2083
    Registers a server with the discovery server.
2084
2085
    :ivar TypeId:
2086
    :vartype TypeId: NodeId
2087
    :ivar RequestHeader:
2088
    :vartype RequestHeader: RequestHeader
2089
    :ivar Server:
2090
    :vartype Server: RegisteredServer
2091 1
    '''
2092 1
    def __init__(self, binary=None):
2093
        if binary is not None:
2094
            self._binary_init(binary)
2095
            self._freeze = True
2096 1
            return
2097 1
        self.TypeId = FourByteNodeId(ObjectIds.RegisterServerRequest_Encoding_DefaultBinary)
2098 1
        self.RequestHeader = RequestHeader()
2099 1
        self.Server = RegisteredServer()
2100
        self._freeze = True
2101 1
2102 1
    def to_binary(self):
2103 1
        packet = []
2104 1
        packet.append(self.TypeId.to_binary())
2105 1
        packet.append(self.RequestHeader.to_binary())
2106 1
        packet.append(self.Server.to_binary())
2107
        return b''.join(packet)
2108 1
2109
    @staticmethod
2110
    def from_binary(data):
2111
        return RegisterServerRequest(data)
2112 1
2113
    def _binary_init(self, data):
2114
        self.TypeId = NodeId.from_binary(data)
2115
        self.RequestHeader = RequestHeader.from_binary(data)
2116
        self.Server = RegisteredServer.from_binary(data)
2117 1
2118
    def __str__(self):
2119
        return 'RegisterServerRequest(' + 'TypeId:' + str(self.TypeId) + ', ' + \
2120
               'RequestHeader:' + str(self.RequestHeader) + ', ' + \
2121
               'Server:' + str(self.Server) + ')'
2122 1
2123
    __repr__ = __str__
2124
2125 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
2126
class RegisterServerResponse(FrozenClass):
2127
    '''
2128
    Registers a server with the discovery server.
2129
2130
    :ivar TypeId:
2131
    :vartype TypeId: NodeId
2132
    :ivar ResponseHeader:
2133
    :vartype ResponseHeader: ResponseHeader
2134 1
    '''
2135 1
    def __init__(self, binary=None):
2136 1
        if binary is not None:
2137 1
            self._binary_init(binary)
2138 1
            self._freeze = True
2139 1
            return
2140 1
        self.TypeId = FourByteNodeId(ObjectIds.RegisterServerResponse_Encoding_DefaultBinary)
2141 1
        self.ResponseHeader = ResponseHeader()
2142
        self._freeze = True
2143 1
2144 1
    def to_binary(self):
2145 1
        packet = []
2146 1
        packet.append(self.TypeId.to_binary())
2147 1
        packet.append(self.ResponseHeader.to_binary())
2148
        return b''.join(packet)
2149 1
2150
    @staticmethod
2151 1
    def from_binary(data):
2152
        return RegisterServerResponse(data)
2153 1
2154 1
    def _binary_init(self, data):
2155 1
        self.TypeId = NodeId.from_binary(data)
2156
        self.ResponseHeader = ResponseHeader.from_binary(data)
2157 1
2158
    def __str__(self):
2159
        return 'RegisterServerResponse(' + 'TypeId:' + str(self.TypeId) + ', ' + \
2160
               'ResponseHeader:' + str(self.ResponseHeader) + ')'
2161 1
2162
    __repr__ = __str__
2163
2164 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
2165
class DiscoveryConfiguration(FrozenClass):
2166
    '''
2167
    A base type for discovery configuration information.
2168
2169 1
    '''
2170
    def __init__(self, binary=None):
2171
        if binary is not None:
2172
            self._binary_init(binary)
2173
            self._freeze = True
2174
            return
2175
        self._freeze = True
2176 1
2177
    def to_binary(self):
2178
        packet = []
2179
        return b''.join(packet)
2180 1
2181
    @staticmethod
2182
    def from_binary(data):
2183
        return DiscoveryConfiguration(data)
2184 1
2185
    def _binary_init(self, data):
2186
        pass
2187 1
2188
    def __str__(self):
2189
        return 'DiscoveryConfiguration(' +  + ')'
2190 1
2191
    __repr__ = __str__
2192
2193 1
2194
class MdnsDiscoveryConfiguration(FrozenClass):
2195
    '''
2196
    The discovery information needed for mDNS registration.
2197
2198
    :ivar MdnsServerName:
2199
    :vartype MdnsServerName: String
2200
    :ivar ServerCapabilities:
2201
    :vartype ServerCapabilities: String
2202 1
    '''
2203
    def __init__(self, binary=None):
2204
        if binary is not None:
2205
            self._binary_init(binary)
2206
            self._freeze = True
2207
            return
2208
        self.MdnsServerName = None
2209
        self.ServerCapabilities = []
2210
        self._freeze = True
2211 1
2212
    def to_binary(self):
2213
        packet = []
2214
        packet.append(pack_string(self.MdnsServerName))
2215
        packet.append(uatype_Int32.pack(len(self.ServerCapabilities)))
2216
        for fieldname in self.ServerCapabilities:
2217
            packet.append(pack_string(fieldname))
2218
        return b''.join(packet)
2219 1
2220
    @staticmethod
2221
    def from_binary(data):
2222
        return MdnsDiscoveryConfiguration(data)
2223 1
2224
    def _binary_init(self, data):
2225
        self.MdnsServerName = unpack_string(data)
2226
        self.ServerCapabilities = unpack_uatype_array('String', data)
2227 1
2228
    def __str__(self):
2229
        return 'MdnsDiscoveryConfiguration(' + 'MdnsServerName:' + str(self.MdnsServerName) + ', ' + \
2230
               'ServerCapabilities:' + str(self.ServerCapabilities) + ')'
2231 1
2232
    __repr__ = __str__
2233
2234 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
2235
class RegisterServer2Parameters(FrozenClass):
2236
    '''
2237
    :ivar Server:
2238
    :vartype Server: RegisteredServer
2239
    :ivar DiscoveryConfiguration:
2240
    :vartype DiscoveryConfiguration: ExtensionObject
2241 1
    '''
2242
    def __init__(self, binary=None):
2243
        if binary is not None:
2244
            self._binary_init(binary)
2245
            self._freeze = True
2246
            return
2247
        self.Server = RegisteredServer()
2248
        self.DiscoveryConfiguration = []
2249
        self._freeze = True
2250 1
2251
    def to_binary(self):
2252
        packet = []
2253
        packet.append(self.Server.to_binary())
2254
        packet.append(uatype_Int32.pack(len(self.DiscoveryConfiguration)))
2255
        for fieldname in self.DiscoveryConfiguration:
2256
            packet.append(extensionobject_to_binary(fieldname))
2257
        return b''.join(packet)
2258 1
2259
    @staticmethod
2260
    def from_binary(data):
2261
        return RegisterServer2Parameters(data)
2262 1
2263
    def _binary_init(self, data):
2264
        self.Server = RegisteredServer.from_binary(data)
2265
        length = uatype_Int32.unpack(data.read(4))[0]
2266
        array = []
2267
        if length != -1:
2268
            for _ in range(0, length):
2269
                array.append(extensionobject_from_binary(data))
2270
        self.DiscoveryConfiguration = array
2271 1
2272
    def __str__(self):
2273
        return 'RegisterServer2Parameters(' + 'Server:' + str(self.Server) + ', ' + \
2274
               'DiscoveryConfiguration:' + str(self.DiscoveryConfiguration) + ')'
2275 1
2276
    __repr__ = __str__
2277
2278 1
2279
class RegisterServer2Request(FrozenClass):
2280
    '''
2281
    :ivar TypeId:
2282
    :vartype TypeId: NodeId
2283
    :ivar RequestHeader:
2284
    :vartype RequestHeader: RequestHeader
2285
    :ivar Parameters:
2286
    :vartype Parameters: RegisterServer2Parameters
2287 1
    '''
2288
    def __init__(self, binary=None):
2289
        if binary is not None:
2290
            self._binary_init(binary)
2291
            self._freeze = True
2292
            return
2293
        self.TypeId = FourByteNodeId(ObjectIds.RegisterServer2Request_Encoding_DefaultBinary)
2294
        self.RequestHeader = RequestHeader()
2295
        self.Parameters = RegisterServer2Parameters()
2296
        self._freeze = True
2297 1
2298
    def to_binary(self):
2299
        packet = []
2300
        packet.append(self.TypeId.to_binary())
2301
        packet.append(self.RequestHeader.to_binary())
2302
        packet.append(self.Parameters.to_binary())
2303
        return b''.join(packet)
2304 1
2305
    @staticmethod
2306
    def from_binary(data):
2307
        return RegisterServer2Request(data)
2308 1
2309
    def _binary_init(self, data):
2310
        self.TypeId = NodeId.from_binary(data)
2311
        self.RequestHeader = RequestHeader.from_binary(data)
2312
        self.Parameters = RegisterServer2Parameters.from_binary(data)
2313 1
2314
    def __str__(self):
2315
        return 'RegisterServer2Request(' + 'TypeId:' + str(self.TypeId) + ', ' + \
2316
               'RequestHeader:' + str(self.RequestHeader) + ', ' + \
2317
               'Parameters:' + str(self.Parameters) + ')'
2318 1
2319
    __repr__ = __str__
2320
2321 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
2322
class RegisterServer2Response(FrozenClass):
2323
    '''
2324
    :ivar TypeId:
2325
    :vartype TypeId: NodeId
2326
    :ivar ResponseHeader:
2327
    :vartype ResponseHeader: ResponseHeader
2328
    :ivar ConfigurationResults:
2329
    :vartype ConfigurationResults: StatusCode
2330
    :ivar DiagnosticInfos:
2331
    :vartype DiagnosticInfos: DiagnosticInfo
2332 1
    '''
2333
    def __init__(self, binary=None):
2334
        if binary is not None:
2335
            self._binary_init(binary)
2336
            self._freeze = True
2337
            return
2338
        self.TypeId = FourByteNodeId(ObjectIds.RegisterServer2Response_Encoding_DefaultBinary)
2339
        self.ResponseHeader = ResponseHeader()
2340
        self.ConfigurationResults = []
2341
        self.DiagnosticInfos = []
2342
        self._freeze = True
2343 1
2344
    def to_binary(self):
2345
        packet = []
2346
        packet.append(self.TypeId.to_binary())
2347
        packet.append(self.ResponseHeader.to_binary())
2348
        packet.append(uatype_Int32.pack(len(self.ConfigurationResults)))
2349
        for fieldname in self.ConfigurationResults:
2350
            packet.append(fieldname.to_binary())
2351
        packet.append(uatype_Int32.pack(len(self.DiagnosticInfos)))
2352
        for fieldname in self.DiagnosticInfos:
2353
            packet.append(fieldname.to_binary())
2354
        return b''.join(packet)
2355 1
2356
    @staticmethod
2357
    def from_binary(data):
2358
        return RegisterServer2Response(data)
2359 1
2360
    def _binary_init(self, data):
2361
        self.TypeId = NodeId.from_binary(data)
2362
        self.ResponseHeader = ResponseHeader.from_binary(data)
2363
        length = uatype_Int32.unpack(data.read(4))[0]
2364
        array = []
2365
        if length != -1:
2366
            for _ in range(0, length):
2367
                array.append(StatusCode.from_binary(data))
2368
        self.ConfigurationResults = array
2369
        length = uatype_Int32.unpack(data.read(4))[0]
2370
        array = []
2371
        if length != -1:
2372
            for _ in range(0, length):
2373
                array.append(DiagnosticInfo.from_binary(data))
2374
        self.DiagnosticInfos = array
2375 1
2376
    def __str__(self):
2377
        return 'RegisterServer2Response(' + 'TypeId:' + str(self.TypeId) + ', ' + \
2378
               'ResponseHeader:' + str(self.ResponseHeader) + ', ' + \
2379
               'ConfigurationResults:' + str(self.ConfigurationResults) + ', ' + \
2380
               'DiagnosticInfos:' + str(self.DiagnosticInfos) + ')'
2381 1
2382
    __repr__ = __str__
2383
2384 1
2385
class ChannelSecurityToken(FrozenClass):
2386
    '''
2387
    The token that identifies a set of keys for an active secure channel.
2388
2389
    :ivar ChannelId:
2390
    :vartype ChannelId: UInt32
2391
    :ivar TokenId:
2392
    :vartype TokenId: UInt32
2393
    :ivar CreatedAt:
2394
    :vartype CreatedAt: DateTime
2395
    :ivar RevisedLifetime:
2396
    :vartype RevisedLifetime: UInt32
2397 1
    '''
2398 1
    def __init__(self, binary=None):
2399 1
        if binary is not None:
2400 1
            self._binary_init(binary)
2401 1
            self._freeze = True
2402 1
            return
2403 1
        self.ChannelId = 0
2404 1
        self.TokenId = 0
2405 1
        self.CreatedAt = datetime.now()
2406 1
        self.RevisedLifetime = 0
2407
        self._freeze = True
2408 1
2409 1
    def to_binary(self):
2410 1
        packet = []
2411 1
        packet.append(uatype_UInt32.pack(self.ChannelId))
2412 1
        packet.append(uatype_UInt32.pack(self.TokenId))
2413 1
        packet.append(pack_datetime(self.CreatedAt))
2414 1
        packet.append(uatype_UInt32.pack(self.RevisedLifetime))
2415
        return b''.join(packet)
2416 1
2417
    @staticmethod
2418 1
    def from_binary(data):
2419
        return ChannelSecurityToken(data)
2420 1
2421 1
    def _binary_init(self, data):
2422 1
        self.ChannelId = uatype_UInt32.unpack(data.read(4))[0]
2423 1
        self.TokenId = uatype_UInt32.unpack(data.read(4))[0]
2424 1
        self.CreatedAt = unpack_datetime(data)
2425
        self.RevisedLifetime = uatype_UInt32.unpack(data.read(4))[0]
2426 1
2427
    def __str__(self):
2428
        return 'ChannelSecurityToken(' + 'ChannelId:' + str(self.ChannelId) + ', ' + \
2429
               'TokenId:' + str(self.TokenId) + ', ' + \
2430
               'CreatedAt:' + str(self.CreatedAt) + ', ' + \
2431
               'RevisedLifetime:' + str(self.RevisedLifetime) + ')'
2432 1
2433
    __repr__ = __str__
2434
2435 1
2436
class OpenSecureChannelParameters(FrozenClass):
2437
    '''
2438
    :ivar ClientProtocolVersion:
2439
    :vartype ClientProtocolVersion: UInt32
2440
    :ivar RequestType:
2441
    :vartype RequestType: SecurityTokenRequestType
2442
    :ivar SecurityMode:
2443
    :vartype SecurityMode: MessageSecurityMode
2444
    :ivar ClientNonce:
2445
    :vartype ClientNonce: ByteString
2446
    :ivar RequestedLifetime:
2447
    :vartype RequestedLifetime: UInt32
2448 1
    '''
2449 1
    def __init__(self, binary=None):
2450 1
        if binary is not None:
2451 1
            self._binary_init(binary)
2452 1
            self._freeze = True
2453 1
            return
2454 1
        self.ClientProtocolVersion = 0
2455 1
        self.RequestType = SecurityTokenRequestType(0)
2456 1
        self.SecurityMode = MessageSecurityMode(0)
2457 1
        self.ClientNonce = None
2458 1
        self.RequestedLifetime = 0
2459
        self._freeze = True
2460 1
2461 1
    def to_binary(self):
2462 1
        packet = []
2463 1
        packet.append(uatype_UInt32.pack(self.ClientProtocolVersion))
2464 1
        packet.append(uatype_UInt32.pack(self.RequestType.value))
2465 1
        packet.append(uatype_UInt32.pack(self.SecurityMode.value))
2466 1
        packet.append(pack_bytes(self.ClientNonce))
2467 1
        packet.append(uatype_UInt32.pack(self.RequestedLifetime))
2468
        return b''.join(packet)
2469 1
2470
    @staticmethod
2471 1
    def from_binary(data):
2472
        return OpenSecureChannelParameters(data)
2473 1
2474 1
    def _binary_init(self, data):
2475 1
        self.ClientProtocolVersion = uatype_UInt32.unpack(data.read(4))[0]
2476 1
        self.RequestType = SecurityTokenRequestType(uatype_UInt32.unpack(data.read(4))[0])
2477 1
        self.SecurityMode = MessageSecurityMode(uatype_UInt32.unpack(data.read(4))[0])
2478 1
        self.ClientNonce = unpack_bytes(data)
2479
        self.RequestedLifetime = uatype_UInt32.unpack(data.read(4))[0]
2480 1
2481
    def __str__(self):
2482
        return 'OpenSecureChannelParameters(' + 'ClientProtocolVersion:' + str(self.ClientProtocolVersion) + ', ' + \
2483
               'RequestType:' + str(self.RequestType) + ', ' + \
2484
               'SecurityMode:' + str(self.SecurityMode) + ', ' + \
2485
               'ClientNonce:' + str(self.ClientNonce) + ', ' + \
2486
               'RequestedLifetime:' + str(self.RequestedLifetime) + ')'
2487 1
2488
    __repr__ = __str__
2489
2490 1
2491
class OpenSecureChannelRequest(FrozenClass):
2492
    '''
2493
    Creates a secure channel with a server.
2494
2495
    :ivar TypeId:
2496
    :vartype TypeId: NodeId
2497
    :ivar RequestHeader:
2498
    :vartype RequestHeader: RequestHeader
2499
    :ivar Parameters:
2500
    :vartype Parameters: OpenSecureChannelParameters
2501 1
    '''
2502 1
    def __init__(self, binary=None):
2503 1
        if binary is not None:
2504 1
            self._binary_init(binary)
2505 1
            self._freeze = True
2506 1
            return
2507 1
        self.TypeId = FourByteNodeId(ObjectIds.OpenSecureChannelRequest_Encoding_DefaultBinary)
2508 1
        self.RequestHeader = RequestHeader()
2509 1
        self.Parameters = OpenSecureChannelParameters()
2510
        self._freeze = True
2511 1
2512 1
    def to_binary(self):
2513 1
        packet = []
2514 1
        packet.append(self.TypeId.to_binary())
2515 1
        packet.append(self.RequestHeader.to_binary())
2516 1
        packet.append(self.Parameters.to_binary())
2517
        return b''.join(packet)
2518 1
2519
    @staticmethod
2520 1
    def from_binary(data):
2521
        return OpenSecureChannelRequest(data)
2522 1
2523 1
    def _binary_init(self, data):
2524 1
        self.TypeId = NodeId.from_binary(data)
2525 1
        self.RequestHeader = RequestHeader.from_binary(data)
2526
        self.Parameters = OpenSecureChannelParameters.from_binary(data)
2527 1
2528
    def __str__(self):
2529
        return 'OpenSecureChannelRequest(' + 'TypeId:' + str(self.TypeId) + ', ' + \
2530
               'RequestHeader:' + str(self.RequestHeader) + ', ' + \
2531
               'Parameters:' + str(self.Parameters) + ')'
2532 1
2533
    __repr__ = __str__
2534
2535 1
2536
class OpenSecureChannelResult(FrozenClass):
2537
    '''
2538
    :ivar ServerProtocolVersion:
2539
    :vartype ServerProtocolVersion: UInt32
2540
    :ivar SecurityToken:
2541
    :vartype SecurityToken: ChannelSecurityToken
2542
    :ivar ServerNonce:
2543
    :vartype ServerNonce: ByteString
2544 1
    '''
2545 1
    def __init__(self, binary=None):
2546 1
        if binary is not None:
2547 1
            self._binary_init(binary)
2548 1
            self._freeze = True
2549 1
            return
2550 1
        self.ServerProtocolVersion = 0
2551 1
        self.SecurityToken = ChannelSecurityToken()
2552 1
        self.ServerNonce = None
2553
        self._freeze = True
2554 1
2555 1
    def to_binary(self):
2556 1
        packet = []
2557 1
        packet.append(uatype_UInt32.pack(self.ServerProtocolVersion))
2558 1
        packet.append(self.SecurityToken.to_binary())
2559 1
        packet.append(pack_bytes(self.ServerNonce))
2560
        return b''.join(packet)
2561 1
2562
    @staticmethod
2563 1
    def from_binary(data):
2564
        return OpenSecureChannelResult(data)
2565 1
2566 1
    def _binary_init(self, data):
2567 1
        self.ServerProtocolVersion = uatype_UInt32.unpack(data.read(4))[0]
2568 1
        self.SecurityToken = ChannelSecurityToken.from_binary(data)
2569
        self.ServerNonce = unpack_bytes(data)
2570 1
2571
    def __str__(self):
2572
        return 'OpenSecureChannelResult(' + 'ServerProtocolVersion:' + str(self.ServerProtocolVersion) + ', ' + \
2573
               'SecurityToken:' + str(self.SecurityToken) + ', ' + \
2574
               'ServerNonce:' + str(self.ServerNonce) + ')'
2575 1
2576
    __repr__ = __str__
2577
2578 1
2579
class OpenSecureChannelResponse(FrozenClass):
2580
    '''
2581
    Creates a secure channel with a server.
2582
2583
    :ivar TypeId:
2584
    :vartype TypeId: NodeId
2585
    :ivar ResponseHeader:
2586
    :vartype ResponseHeader: ResponseHeader
2587
    :ivar Parameters:
2588
    :vartype Parameters: OpenSecureChannelResult
2589 1
    '''
2590 1
    def __init__(self, binary=None):
2591 1
        if binary is not None:
2592 1
            self._binary_init(binary)
2593 1
            self._freeze = True
2594 1
            return
2595 1
        self.TypeId = FourByteNodeId(ObjectIds.OpenSecureChannelResponse_Encoding_DefaultBinary)
2596 1
        self.ResponseHeader = ResponseHeader()
2597 1
        self.Parameters = OpenSecureChannelResult()
2598
        self._freeze = True
2599 1
2600 1
    def to_binary(self):
2601 1
        packet = []
2602 1
        packet.append(self.TypeId.to_binary())
2603 1
        packet.append(self.ResponseHeader.to_binary())
2604 1
        packet.append(self.Parameters.to_binary())
2605
        return b''.join(packet)
2606 1
2607
    @staticmethod
2608 1
    def from_binary(data):
2609
        return OpenSecureChannelResponse(data)
2610 1
2611 1
    def _binary_init(self, data):
2612 1
        self.TypeId = NodeId.from_binary(data)
2613 1
        self.ResponseHeader = ResponseHeader.from_binary(data)
2614
        self.Parameters = OpenSecureChannelResult.from_binary(data)
2615 1
2616
    def __str__(self):
2617
        return 'OpenSecureChannelResponse(' + 'TypeId:' + str(self.TypeId) + ', ' + \
2618
               'ResponseHeader:' + str(self.ResponseHeader) + ', ' + \
2619
               'Parameters:' + str(self.Parameters) + ')'
2620 1
2621
    __repr__ = __str__
2622
2623 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
2624
class CloseSecureChannelRequest(FrozenClass):
2625
    '''
2626
    Closes a secure channel.
2627
2628
    :ivar TypeId:
2629
    :vartype TypeId: NodeId
2630
    :ivar RequestHeader:
2631
    :vartype RequestHeader: RequestHeader
2632 1
    '''
2633 1
    def __init__(self, binary=None):
2634
        if binary is not None:
2635
            self._binary_init(binary)
2636
            self._freeze = True
2637 1
            return
2638 1
        self.TypeId = FourByteNodeId(ObjectIds.CloseSecureChannelRequest_Encoding_DefaultBinary)
2639 1
        self.RequestHeader = RequestHeader()
2640
        self._freeze = True
2641 1
2642 1
    def to_binary(self):
2643 1
        packet = []
2644 1
        packet.append(self.TypeId.to_binary())
2645 1
        packet.append(self.RequestHeader.to_binary())
2646
        return b''.join(packet)
2647 1
2648
    @staticmethod
2649
    def from_binary(data):
2650
        return CloseSecureChannelRequest(data)
2651 1
2652
    def _binary_init(self, data):
2653
        self.TypeId = NodeId.from_binary(data)
2654
        self.RequestHeader = RequestHeader.from_binary(data)
2655 1
2656
    def __str__(self):
2657
        return 'CloseSecureChannelRequest(' + 'TypeId:' + str(self.TypeId) + ', ' + \
2658
               'RequestHeader:' + str(self.RequestHeader) + ')'
2659 1
2660
    __repr__ = __str__
2661
2662 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
2663
class CloseSecureChannelResponse(FrozenClass):
2664
    '''
2665
    Closes a secure channel.
2666
2667
    :ivar TypeId:
2668
    :vartype TypeId: NodeId
2669
    :ivar ResponseHeader:
2670
    :vartype ResponseHeader: ResponseHeader
2671 1
    '''
2672
    def __init__(self, binary=None):
2673
        if binary is not None:
2674
            self._binary_init(binary)
2675
            self._freeze = True
2676
            return
2677
        self.TypeId = FourByteNodeId(ObjectIds.CloseSecureChannelResponse_Encoding_DefaultBinary)
2678
        self.ResponseHeader = ResponseHeader()
2679
        self._freeze = True
2680 1
2681
    def to_binary(self):
2682
        packet = []
2683
        packet.append(self.TypeId.to_binary())
2684
        packet.append(self.ResponseHeader.to_binary())
2685
        return b''.join(packet)
2686 1
2687
    @staticmethod
2688
    def from_binary(data):
2689
        return CloseSecureChannelResponse(data)
2690 1
2691
    def _binary_init(self, data):
2692
        self.TypeId = NodeId.from_binary(data)
2693
        self.ResponseHeader = ResponseHeader.from_binary(data)
2694 1
2695
    def __str__(self):
2696
        return 'CloseSecureChannelResponse(' + 'TypeId:' + str(self.TypeId) + ', ' + \
2697
               'ResponseHeader:' + str(self.ResponseHeader) + ')'
2698 1
2699
    __repr__ = __str__
2700
2701 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
2702
class SignedSoftwareCertificate(FrozenClass):
2703
    '''
2704
    A software certificate with a digital signature.
2705
2706
    :ivar CertificateData:
2707
    :vartype CertificateData: ByteString
2708
    :ivar Signature:
2709
    :vartype Signature: ByteString
2710 1
    '''
2711
    def __init__(self, binary=None):
2712
        if binary is not None:
2713
            self._binary_init(binary)
2714
            self._freeze = True
2715
            return
2716
        self.CertificateData = None
2717
        self.Signature = None
2718
        self._freeze = True
2719 1
2720
    def to_binary(self):
2721
        packet = []
2722
        packet.append(pack_bytes(self.CertificateData))
2723
        packet.append(pack_bytes(self.Signature))
2724
        return b''.join(packet)
2725 1
2726
    @staticmethod
2727
    def from_binary(data):
2728
        return SignedSoftwareCertificate(data)
2729 1
2730
    def _binary_init(self, data):
2731
        self.CertificateData = unpack_bytes(data)
2732
        self.Signature = unpack_bytes(data)
2733 1
2734
    def __str__(self):
2735
        return 'SignedSoftwareCertificate(' + 'CertificateData:' + str(self.CertificateData) + ', ' + \
2736
               'Signature:' + str(self.Signature) + ')'
2737 1
2738
    __repr__ = __str__
2739
2740 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
2741
class SignatureData(FrozenClass):
2742
    '''
2743
    A digital signature.
2744
2745
    :ivar Algorithm:
2746
    :vartype Algorithm: String
2747
    :ivar Signature:
2748
    :vartype Signature: ByteString
2749 1
    '''
2750 1
    def __init__(self, binary=None):
2751 1
        if binary is not None:
2752 1
            self._binary_init(binary)
2753 1
            self._freeze = True
2754 1
            return
2755 1
        self.Algorithm = None
2756 1
        self.Signature = None
2757
        self._freeze = True
2758 1
2759 1
    def to_binary(self):
2760 1
        packet = []
2761 1
        packet.append(pack_string(self.Algorithm))
2762 1
        packet.append(pack_bytes(self.Signature))
2763
        return b''.join(packet)
2764 1
2765
    @staticmethod
2766 1
    def from_binary(data):
2767
        return SignatureData(data)
2768 1
2769 1
    def _binary_init(self, data):
2770 1
        self.Algorithm = unpack_string(data)
2771
        self.Signature = unpack_bytes(data)
2772 1
2773
    def __str__(self):
2774
        return 'SignatureData(' + 'Algorithm:' + str(self.Algorithm) + ', ' + \
2775
               'Signature:' + str(self.Signature) + ')'
2776 1
2777
    __repr__ = __str__
2778
2779 1
2780
class CreateSessionParameters(FrozenClass):
2781
    '''
2782
    :ivar ClientDescription:
2783
    :vartype ClientDescription: ApplicationDescription
2784
    :ivar ServerUri:
2785
    :vartype ServerUri: String
2786
    :ivar EndpointUrl:
2787
    :vartype EndpointUrl: String
2788
    :ivar SessionName:
2789
    :vartype SessionName: String
2790
    :ivar ClientNonce:
2791
    :vartype ClientNonce: ByteString
2792
    :ivar ClientCertificate:
2793
    :vartype ClientCertificate: ByteString
2794
    :ivar RequestedSessionTimeout:
2795
    :vartype RequestedSessionTimeout: Double
2796
    :ivar MaxResponseMessageSize:
2797
    :vartype MaxResponseMessageSize: UInt32
2798 1
    '''
2799 1
    def __init__(self, binary=None):
2800 1
        if binary is not None:
2801 1
            self._binary_init(binary)
2802 1
            self._freeze = True
2803 1
            return
2804 1
        self.ClientDescription = ApplicationDescription()
2805 1
        self.ServerUri = None
2806 1
        self.EndpointUrl = None
2807 1
        self.SessionName = None
2808 1
        self.ClientNonce = None
2809 1
        self.ClientCertificate = None
2810 1
        self.RequestedSessionTimeout = 0
2811 1
        self.MaxResponseMessageSize = 0
2812
        self._freeze = True
2813 1
2814 1
    def to_binary(self):
2815 1
        packet = []
2816 1
        packet.append(self.ClientDescription.to_binary())
2817 1
        packet.append(pack_string(self.ServerUri))
2818 1
        packet.append(pack_string(self.EndpointUrl))
2819 1
        packet.append(pack_string(self.SessionName))
2820 1
        packet.append(pack_bytes(self.ClientNonce))
2821 1
        packet.append(pack_bytes(self.ClientCertificate))
2822 1
        packet.append(uatype_Double.pack(self.RequestedSessionTimeout))
2823 1
        packet.append(uatype_UInt32.pack(self.MaxResponseMessageSize))
2824
        return b''.join(packet)
2825 1
2826
    @staticmethod
2827 1
    def from_binary(data):
2828
        return CreateSessionParameters(data)
2829 1
2830 1
    def _binary_init(self, data):
2831 1
        self.ClientDescription = ApplicationDescription.from_binary(data)
2832 1
        self.ServerUri = unpack_string(data)
2833 1
        self.EndpointUrl = unpack_string(data)
2834 1
        self.SessionName = unpack_string(data)
2835 1
        self.ClientNonce = unpack_bytes(data)
2836 1
        self.ClientCertificate = unpack_bytes(data)
2837 1
        self.RequestedSessionTimeout = uatype_Double.unpack(data.read(8))[0]
2838
        self.MaxResponseMessageSize = uatype_UInt32.unpack(data.read(4))[0]
2839 1
2840
    def __str__(self):
2841
        return 'CreateSessionParameters(' + 'ClientDescription:' + str(self.ClientDescription) + ', ' + \
2842
               'ServerUri:' + str(self.ServerUri) + ', ' + \
2843
               'EndpointUrl:' + str(self.EndpointUrl) + ', ' + \
2844
               'SessionName:' + str(self.SessionName) + ', ' + \
2845
               'ClientNonce:' + str(self.ClientNonce) + ', ' + \
2846
               'ClientCertificate:' + str(self.ClientCertificate) + ', ' + \
2847
               'RequestedSessionTimeout:' + str(self.RequestedSessionTimeout) + ', ' + \
2848
               'MaxResponseMessageSize:' + str(self.MaxResponseMessageSize) + ')'
2849 1
2850
    __repr__ = __str__
2851
2852 1
2853
class CreateSessionRequest(FrozenClass):
2854
    '''
2855
    Creates a new session with the server.
2856
2857
    :ivar TypeId:
2858
    :vartype TypeId: NodeId
2859
    :ivar RequestHeader:
2860
    :vartype RequestHeader: RequestHeader
2861
    :ivar Parameters:
2862
    :vartype Parameters: CreateSessionParameters
2863 1
    '''
2864 1
    def __init__(self, binary=None):
2865
        if binary is not None:
2866
            self._binary_init(binary)
2867
            self._freeze = True
2868 1
            return
2869 1
        self.TypeId = FourByteNodeId(ObjectIds.CreateSessionRequest_Encoding_DefaultBinary)
2870 1
        self.RequestHeader = RequestHeader()
2871 1
        self.Parameters = CreateSessionParameters()
2872
        self._freeze = True
2873 1
2874 1
    def to_binary(self):
2875 1
        packet = []
2876 1
        packet.append(self.TypeId.to_binary())
2877 1
        packet.append(self.RequestHeader.to_binary())
2878 1
        packet.append(self.Parameters.to_binary())
2879
        return b''.join(packet)
2880 1
2881
    @staticmethod
2882
    def from_binary(data):
2883
        return CreateSessionRequest(data)
2884 1
2885
    def _binary_init(self, data):
2886
        self.TypeId = NodeId.from_binary(data)
2887
        self.RequestHeader = RequestHeader.from_binary(data)
2888
        self.Parameters = CreateSessionParameters.from_binary(data)
2889 1
2890
    def __str__(self):
2891
        return 'CreateSessionRequest(' + 'TypeId:' + str(self.TypeId) + ', ' + \
2892
               'RequestHeader:' + str(self.RequestHeader) + ', ' + \
2893
               'Parameters:' + str(self.Parameters) + ')'
2894 1
2895
    __repr__ = __str__
2896
2897 1
2898
class CreateSessionResult(FrozenClass):
2899
    '''
2900
    :ivar SessionId:
2901
    :vartype SessionId: NodeId
2902
    :ivar AuthenticationToken:
2903
    :vartype AuthenticationToken: NodeId
2904
    :ivar RevisedSessionTimeout:
2905
    :vartype RevisedSessionTimeout: Double
2906
    :ivar ServerNonce:
2907
    :vartype ServerNonce: ByteString
2908
    :ivar ServerCertificate:
2909
    :vartype ServerCertificate: ByteString
2910
    :ivar ServerEndpoints:
2911
    :vartype ServerEndpoints: EndpointDescription
2912
    :ivar ServerSoftwareCertificates:
2913
    :vartype ServerSoftwareCertificates: SignedSoftwareCertificate
2914
    :ivar ServerSignature:
2915
    :vartype ServerSignature: SignatureData
2916
    :ivar MaxRequestMessageSize:
2917
    :vartype MaxRequestMessageSize: UInt32
2918 1
    '''
2919 1
    def __init__(self, binary=None):
2920 1
        if binary is not None:
2921 1
            self._binary_init(binary)
2922 1
            self._freeze = True
2923 1
            return
2924 1
        self.SessionId = NodeId()
2925 1
        self.AuthenticationToken = NodeId()
2926 1
        self.RevisedSessionTimeout = 0
2927 1
        self.ServerNonce = None
2928 1
        self.ServerCertificate = None
2929 1
        self.ServerEndpoints = []
2930 1
        self.ServerSoftwareCertificates = []
2931 1
        self.ServerSignature = SignatureData()
2932 1
        self.MaxRequestMessageSize = 0
2933
        self._freeze = True
2934 1
2935 1
    def to_binary(self):
2936 1
        packet = []
2937 1
        packet.append(self.SessionId.to_binary())
2938 1
        packet.append(self.AuthenticationToken.to_binary())
2939 1
        packet.append(uatype_Double.pack(self.RevisedSessionTimeout))
2940 1
        packet.append(pack_bytes(self.ServerNonce))
2941 1
        packet.append(pack_bytes(self.ServerCertificate))
2942 1
        packet.append(uatype_Int32.pack(len(self.ServerEndpoints)))
2943 1
        for fieldname in self.ServerEndpoints:
2944 1
            packet.append(fieldname.to_binary())
2945 1
        packet.append(uatype_Int32.pack(len(self.ServerSoftwareCertificates)))
2946
        for fieldname in self.ServerSoftwareCertificates:
2947 1
            packet.append(fieldname.to_binary())
2948 1
        packet.append(self.ServerSignature.to_binary())
2949 1
        packet.append(uatype_UInt32.pack(self.MaxRequestMessageSize))
2950
        return b''.join(packet)
2951 1
2952
    @staticmethod
2953 1
    def from_binary(data):
2954
        return CreateSessionResult(data)
2955 1
2956 1
    def _binary_init(self, data):
2957 1
        self.SessionId = NodeId.from_binary(data)
2958 1
        self.AuthenticationToken = NodeId.from_binary(data)
2959 1
        self.RevisedSessionTimeout = uatype_Double.unpack(data.read(8))[0]
2960 1
        self.ServerNonce = unpack_bytes(data)
2961 1
        self.ServerCertificate = unpack_bytes(data)
2962 1
        length = uatype_Int32.unpack(data.read(4))[0]
2963 1
        array = []
2964 1
        if length != -1:
2965 1
            for _ in range(0, length):
2966 1
                array.append(EndpointDescription.from_binary(data))
2967 1
        self.ServerEndpoints = array
2968 1
        length = uatype_Int32.unpack(data.read(4))[0]
2969 1
        array = []
2970 1
        if length != -1:
2971
            for _ in range(0, length):
2972 1
                array.append(SignedSoftwareCertificate.from_binary(data))
2973 1
        self.ServerSoftwareCertificates = array
2974 1
        self.ServerSignature = SignatureData.from_binary(data)
2975
        self.MaxRequestMessageSize = uatype_UInt32.unpack(data.read(4))[0]
2976 1
2977
    def __str__(self):
2978
        return 'CreateSessionResult(' + 'SessionId:' + str(self.SessionId) + ', ' + \
2979
               'AuthenticationToken:' + str(self.AuthenticationToken) + ', ' + \
2980
               'RevisedSessionTimeout:' + str(self.RevisedSessionTimeout) + ', ' + \
2981
               'ServerNonce:' + str(self.ServerNonce) + ', ' + \
2982
               'ServerCertificate:' + str(self.ServerCertificate) + ', ' + \
2983
               'ServerEndpoints:' + str(self.ServerEndpoints) + ', ' + \
2984
               'ServerSoftwareCertificates:' + str(self.ServerSoftwareCertificates) + ', ' + \
2985
               'ServerSignature:' + str(self.ServerSignature) + ', ' + \
2986
               'MaxRequestMessageSize:' + str(self.MaxRequestMessageSize) + ')'
2987 1
2988
    __repr__ = __str__
2989
2990 1
2991
class CreateSessionResponse(FrozenClass):
2992
    '''
2993
    Creates a new session with the server.
2994
2995
    :ivar TypeId:
2996
    :vartype TypeId: NodeId
2997
    :ivar ResponseHeader:
2998
    :vartype ResponseHeader: ResponseHeader
2999
    :ivar Parameters:
3000
    :vartype Parameters: CreateSessionResult
3001 1
    '''
3002 1
    def __init__(self, binary=None):
3003 1
        if binary is not None:
3004 1
            self._binary_init(binary)
3005 1
            self._freeze = True
3006 1
            return
3007 1
        self.TypeId = FourByteNodeId(ObjectIds.CreateSessionResponse_Encoding_DefaultBinary)
3008 1
        self.ResponseHeader = ResponseHeader()
3009 1
        self.Parameters = CreateSessionResult()
3010
        self._freeze = True
3011 1
3012 1
    def to_binary(self):
3013 1
        packet = []
3014 1
        packet.append(self.TypeId.to_binary())
3015 1
        packet.append(self.ResponseHeader.to_binary())
3016 1
        packet.append(self.Parameters.to_binary())
3017
        return b''.join(packet)
3018 1
3019
    @staticmethod
3020 1
    def from_binary(data):
3021
        return CreateSessionResponse(data)
3022 1
3023 1
    def _binary_init(self, data):
3024 1
        self.TypeId = NodeId.from_binary(data)
3025 1
        self.ResponseHeader = ResponseHeader.from_binary(data)
3026
        self.Parameters = CreateSessionResult.from_binary(data)
3027 1
3028
    def __str__(self):
3029
        return 'CreateSessionResponse(' + 'TypeId:' + str(self.TypeId) + ', ' + \
3030
               'ResponseHeader:' + str(self.ResponseHeader) + ', ' + \
3031
               'Parameters:' + str(self.Parameters) + ')'
3032 1
3033
    __repr__ = __str__
3034
3035 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
3036
class UserIdentityToken(FrozenClass):
3037
    '''
3038
    A base type for a user identity token.
3039
3040
    :ivar PolicyId:
3041
    :vartype PolicyId: String
3042 1
    '''
3043
    def __init__(self, binary=None):
3044
        if binary is not None:
3045
            self._binary_init(binary)
3046
            self._freeze = True
3047
            return
3048
        self.PolicyId = None
3049
        self._freeze = True
3050 1
3051
    def to_binary(self):
3052
        packet = []
3053
        packet.append(pack_string(self.PolicyId))
3054
        return b''.join(packet)
3055 1
3056
    @staticmethod
3057
    def from_binary(data):
3058
        return UserIdentityToken(data)
3059 1
3060
    def _binary_init(self, data):
3061
        self.PolicyId = unpack_string(data)
3062 1
3063
    def __str__(self):
3064
        return 'UserIdentityToken(' + 'PolicyId:' + str(self.PolicyId) + ')'
3065 1
3066
    __repr__ = __str__
3067
3068 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
3069
class AnonymousIdentityToken(FrozenClass):
3070
    '''
3071
    A token representing an anonymous user.
3072
3073
    :ivar PolicyId:
3074
    :vartype PolicyId: String
3075 1
    '''
3076 1
    def __init__(self, binary=None):
3077 1
        if binary is not None:
3078 1
            self._binary_init(binary)
3079 1
            self._freeze = True
3080 1
            return
3081 1
        self.PolicyId = None
3082
        self._freeze = True
3083 1
3084 1
    def to_binary(self):
3085 1
        packet = []
3086 1
        packet.append(pack_string(self.PolicyId))
3087
        return b''.join(packet)
3088 1
3089
    @staticmethod
3090 1
    def from_binary(data):
3091
        return AnonymousIdentityToken(data)
3092 1
3093 1
    def _binary_init(self, data):
3094
        self.PolicyId = unpack_string(data)
3095 1
3096
    def __str__(self):
3097
        return 'AnonymousIdentityToken(' + 'PolicyId:' + str(self.PolicyId) + ')'
3098 1
3099
    __repr__ = __str__
3100
3101 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
3102
class UserNameIdentityToken(FrozenClass):
3103
    '''
3104
    A token representing a user identified by a user name and password.
3105
3106
    :ivar PolicyId:
3107
    :vartype PolicyId: String
3108
    :ivar UserName:
3109
    :vartype UserName: String
3110
    :ivar Password:
3111
    :vartype Password: ByteString
3112
    :ivar EncryptionAlgorithm:
3113
    :vartype EncryptionAlgorithm: String
3114 1
    '''
3115 1
    def __init__(self, binary=None):
3116 1
        if binary is not None:
3117 1
            self._binary_init(binary)
3118 1
            self._freeze = True
3119 1
            return
3120 1
        self.PolicyId = None
3121 1
        self.UserName = None
3122 1
        self.Password = None
3123 1
        self.EncryptionAlgorithm = None
3124
        self._freeze = True
3125 1
3126 1
    def to_binary(self):
3127 1
        packet = []
3128 1
        packet.append(pack_string(self.PolicyId))
3129 1
        packet.append(pack_string(self.UserName))
3130 1
        packet.append(pack_bytes(self.Password))
3131 1
        packet.append(pack_string(self.EncryptionAlgorithm))
3132
        return b''.join(packet)
3133 1
3134
    @staticmethod
3135 1
    def from_binary(data):
3136
        return UserNameIdentityToken(data)
3137 1
3138 1
    def _binary_init(self, data):
3139 1
        self.PolicyId = unpack_string(data)
3140 1
        self.UserName = unpack_string(data)
3141 1
        self.Password = unpack_bytes(data)
3142
        self.EncryptionAlgorithm = unpack_string(data)
3143 1
3144
    def __str__(self):
3145
        return 'UserNameIdentityToken(' + 'PolicyId:' + str(self.PolicyId) + ', ' + \
3146
               'UserName:' + str(self.UserName) + ', ' + \
3147
               'Password:' + str(self.Password) + ', ' + \
3148
               'EncryptionAlgorithm:' + str(self.EncryptionAlgorithm) + ')'
3149 1
3150
    __repr__ = __str__
3151
3152 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
3153
class X509IdentityToken(FrozenClass):
3154
    '''
3155
    A token representing a user identified by an X509 certificate.
3156
3157
    :ivar PolicyId:
3158
    :vartype PolicyId: String
3159
    :ivar CertificateData:
3160
    :vartype CertificateData: ByteString
3161 1
    '''
3162
    def __init__(self, binary=None):
3163
        if binary is not None:
3164
            self._binary_init(binary)
3165
            self._freeze = True
3166
            return
3167
        self.PolicyId = None
3168
        self.CertificateData = None
3169
        self._freeze = True
3170 1
3171
    def to_binary(self):
3172
        packet = []
3173
        packet.append(pack_string(self.PolicyId))
3174
        packet.append(pack_bytes(self.CertificateData))
3175
        return b''.join(packet)
3176 1
3177
    @staticmethod
3178
    def from_binary(data):
3179
        return X509IdentityToken(data)
3180 1
3181
    def _binary_init(self, data):
3182
        self.PolicyId = unpack_string(data)
3183
        self.CertificateData = unpack_bytes(data)
3184 1
3185
    def __str__(self):
3186
        return 'X509IdentityToken(' + 'PolicyId:' + str(self.PolicyId) + ', ' + \
3187
               'CertificateData:' + str(self.CertificateData) + ')'
3188 1
3189
    __repr__ = __str__
3190
3191 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
3192
class KerberosIdentityToken(FrozenClass):
3193
    '''
3194
    :ivar PolicyId:
3195
    :vartype PolicyId: String
3196
    :ivar TicketData:
3197
    :vartype TicketData: ByteString
3198 1
    '''
3199
    def __init__(self, binary=None):
3200
        if binary is not None:
3201
            self._binary_init(binary)
3202
            self._freeze = True
3203
            return
3204
        self.PolicyId = None
3205
        self.TicketData = None
3206
        self._freeze = True
3207 1
3208
    def to_binary(self):
3209
        packet = []
3210
        packet.append(pack_string(self.PolicyId))
3211
        packet.append(pack_bytes(self.TicketData))
3212
        return b''.join(packet)
3213 1
3214
    @staticmethod
3215
    def from_binary(data):
3216
        return KerberosIdentityToken(data)
3217 1
3218
    def _binary_init(self, data):
3219
        self.PolicyId = unpack_string(data)
3220
        self.TicketData = unpack_bytes(data)
3221 1
3222
    def __str__(self):
3223
        return 'KerberosIdentityToken(' + 'PolicyId:' + str(self.PolicyId) + ', ' + \
3224
               'TicketData:' + str(self.TicketData) + ')'
3225 1
3226
    __repr__ = __str__
3227
3228 1
3229
class IssuedIdentityToken(FrozenClass):
3230
    '''
3231
    A token representing a user identified by a WS-Security XML token.
3232
3233
    :ivar PolicyId:
3234
    :vartype PolicyId: String
3235
    :ivar TokenData:
3236
    :vartype TokenData: ByteString
3237
    :ivar EncryptionAlgorithm:
3238
    :vartype EncryptionAlgorithm: String
3239 1
    '''
3240
    def __init__(self, binary=None):
3241
        if binary is not None:
3242
            self._binary_init(binary)
3243
            self._freeze = True
3244
            return
3245
        self.PolicyId = None
3246
        self.TokenData = None
3247
        self.EncryptionAlgorithm = None
3248
        self._freeze = True
3249 1
3250
    def to_binary(self):
3251
        packet = []
3252
        packet.append(pack_string(self.PolicyId))
3253
        packet.append(pack_bytes(self.TokenData))
3254
        packet.append(pack_string(self.EncryptionAlgorithm))
3255
        return b''.join(packet)
3256 1
3257
    @staticmethod
3258
    def from_binary(data):
3259
        return IssuedIdentityToken(data)
3260 1
3261
    def _binary_init(self, data):
3262
        self.PolicyId = unpack_string(data)
3263
        self.TokenData = unpack_bytes(data)
3264
        self.EncryptionAlgorithm = unpack_string(data)
3265 1
3266
    def __str__(self):
3267
        return 'IssuedIdentityToken(' + 'PolicyId:' + str(self.PolicyId) + ', ' + \
3268
               'TokenData:' + str(self.TokenData) + ', ' + \
3269
               'EncryptionAlgorithm:' + str(self.EncryptionAlgorithm) + ')'
3270 1
3271
    __repr__ = __str__
3272
3273 1
3274
class ActivateSessionParameters(FrozenClass):
3275
    '''
3276
    :ivar ClientSignature:
3277
    :vartype ClientSignature: SignatureData
3278
    :ivar ClientSoftwareCertificates:
3279
    :vartype ClientSoftwareCertificates: SignedSoftwareCertificate
3280
    :ivar LocaleIds:
3281
    :vartype LocaleIds: String
3282
    :ivar UserIdentityToken:
3283
    :vartype UserIdentityToken: ExtensionObject
3284
    :ivar UserTokenSignature:
3285
    :vartype UserTokenSignature: SignatureData
3286 1
    '''
3287 1
    def __init__(self, binary=None):
3288 1
        if binary is not None:
3289 1
            self._binary_init(binary)
3290 1
            self._freeze = True
3291 1
            return
3292 1
        self.ClientSignature = SignatureData()
3293 1
        self.ClientSoftwareCertificates = []
3294 1
        self.LocaleIds = []
3295 1
        self.UserIdentityToken = None
3296 1
        self.UserTokenSignature = SignatureData()
3297
        self._freeze = True
3298 1
3299 1
    def to_binary(self):
3300 1
        packet = []
3301 1
        packet.append(self.ClientSignature.to_binary())
3302 1
        packet.append(uatype_Int32.pack(len(self.ClientSoftwareCertificates)))
3303
        for fieldname in self.ClientSoftwareCertificates:
3304 1
            packet.append(fieldname.to_binary())
3305 1
        packet.append(uatype_Int32.pack(len(self.LocaleIds)))
3306 1
        for fieldname in self.LocaleIds:
3307 1
            packet.append(pack_string(fieldname))
3308 1
        packet.append(extensionobject_to_binary(self.UserIdentityToken))
3309 1
        packet.append(self.UserTokenSignature.to_binary())
3310
        return b''.join(packet)
3311 1
3312
    @staticmethod
3313 1
    def from_binary(data):
3314
        return ActivateSessionParameters(data)
3315 1
3316 1
    def _binary_init(self, data):
3317 1
        self.ClientSignature = SignatureData.from_binary(data)
3318 1
        length = uatype_Int32.unpack(data.read(4))[0]
3319 1
        array = []
3320 1
        if length != -1:
3321
            for _ in range(0, length):
3322 1
                array.append(SignedSoftwareCertificate.from_binary(data))
3323 1
        self.ClientSoftwareCertificates = array
3324 1
        self.LocaleIds = unpack_uatype_array('String', data)
3325 1
        self.UserIdentityToken = extensionobject_from_binary(data)
3326
        self.UserTokenSignature = SignatureData.from_binary(data)
3327 1
3328
    def __str__(self):
3329
        return 'ActivateSessionParameters(' + 'ClientSignature:' + str(self.ClientSignature) + ', ' + \
3330
               'ClientSoftwareCertificates:' + str(self.ClientSoftwareCertificates) + ', ' + \
3331
               'LocaleIds:' + str(self.LocaleIds) + ', ' + \
3332
               'UserIdentityToken:' + str(self.UserIdentityToken) + ', ' + \
3333
               'UserTokenSignature:' + str(self.UserTokenSignature) + ')'
3334 1
3335
    __repr__ = __str__
3336
3337 1
3338
class ActivateSessionRequest(FrozenClass):
3339
    '''
3340
    Activates a session with the server.
3341
3342
    :ivar TypeId:
3343
    :vartype TypeId: NodeId
3344
    :ivar RequestHeader:
3345
    :vartype RequestHeader: RequestHeader
3346
    :ivar Parameters:
3347
    :vartype Parameters: ActivateSessionParameters
3348 1
    '''
3349 1
    def __init__(self, binary=None):
3350
        if binary is not None:
3351
            self._binary_init(binary)
3352
            self._freeze = True
3353 1
            return
3354 1
        self.TypeId = FourByteNodeId(ObjectIds.ActivateSessionRequest_Encoding_DefaultBinary)
3355 1
        self.RequestHeader = RequestHeader()
3356 1
        self.Parameters = ActivateSessionParameters()
3357
        self._freeze = True
3358 1
3359 1
    def to_binary(self):
3360 1
        packet = []
3361 1
        packet.append(self.TypeId.to_binary())
3362 1
        packet.append(self.RequestHeader.to_binary())
3363 1
        packet.append(self.Parameters.to_binary())
3364
        return b''.join(packet)
3365 1
3366
    @staticmethod
3367
    def from_binary(data):
3368
        return ActivateSessionRequest(data)
3369 1
3370
    def _binary_init(self, data):
3371
        self.TypeId = NodeId.from_binary(data)
3372
        self.RequestHeader = RequestHeader.from_binary(data)
3373
        self.Parameters = ActivateSessionParameters.from_binary(data)
3374 1
3375
    def __str__(self):
3376
        return 'ActivateSessionRequest(' + 'TypeId:' + str(self.TypeId) + ', ' + \
3377
               'RequestHeader:' + str(self.RequestHeader) + ', ' + \
3378
               'Parameters:' + str(self.Parameters) + ')'
3379 1
3380
    __repr__ = __str__
3381
3382 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
3383
class ActivateSessionResult(FrozenClass):
3384
    '''
3385
    :ivar ServerNonce:
3386
    :vartype ServerNonce: ByteString
3387
    :ivar Results:
3388
    :vartype Results: StatusCode
3389
    :ivar DiagnosticInfos:
3390
    :vartype DiagnosticInfos: DiagnosticInfo
3391 1
    '''
3392 1
    def __init__(self, binary=None):
3393 1
        if binary is not None:
3394 1
            self._binary_init(binary)
3395 1
            self._freeze = True
3396 1
            return
3397 1
        self.ServerNonce = None
3398 1
        self.Results = []
3399 1
        self.DiagnosticInfos = []
3400
        self._freeze = True
3401 1
3402 1
    def to_binary(self):
3403 1
        packet = []
3404 1
        packet.append(pack_bytes(self.ServerNonce))
3405 1
        packet.append(uatype_Int32.pack(len(self.Results)))
3406
        for fieldname in self.Results:
3407 1
            packet.append(fieldname.to_binary())
3408 1
        packet.append(uatype_Int32.pack(len(self.DiagnosticInfos)))
3409
        for fieldname in self.DiagnosticInfos:
3410 1
            packet.append(fieldname.to_binary())
3411
        return b''.join(packet)
3412 1
3413
    @staticmethod
3414 1
    def from_binary(data):
3415
        return ActivateSessionResult(data)
3416 1
3417 1
    def _binary_init(self, data):
3418 1
        self.ServerNonce = unpack_bytes(data)
3419 1
        length = uatype_Int32.unpack(data.read(4))[0]
3420 1
        array = []
3421 1
        if length != -1:
3422
            for _ in range(0, length):
3423 1
                array.append(StatusCode.from_binary(data))
3424 1
        self.Results = array
3425 1
        length = uatype_Int32.unpack(data.read(4))[0]
3426 1
        array = []
3427 1
        if length != -1:
3428
            for _ in range(0, length):
3429 1
                array.append(DiagnosticInfo.from_binary(data))
3430
        self.DiagnosticInfos = array
3431 1
3432
    def __str__(self):
3433
        return 'ActivateSessionResult(' + 'ServerNonce:' + str(self.ServerNonce) + ', ' + \
3434
               'Results:' + str(self.Results) + ', ' + \
3435
               'DiagnosticInfos:' + str(self.DiagnosticInfos) + ')'
3436 1
3437
    __repr__ = __str__
3438
3439 1
3440
class ActivateSessionResponse(FrozenClass):
3441
    '''
3442
    Activates a session with the server.
3443
3444
    :ivar TypeId:
3445
    :vartype TypeId: NodeId
3446
    :ivar ResponseHeader:
3447
    :vartype ResponseHeader: ResponseHeader
3448
    :ivar Parameters:
3449
    :vartype Parameters: ActivateSessionResult
3450 1
    '''
3451 1
    def __init__(self, binary=None):
3452 1
        if binary is not None:
3453 1
            self._binary_init(binary)
3454 1
            self._freeze = True
3455 1
            return
3456 1
        self.TypeId = FourByteNodeId(ObjectIds.ActivateSessionResponse_Encoding_DefaultBinary)
3457 1
        self.ResponseHeader = ResponseHeader()
3458 1
        self.Parameters = ActivateSessionResult()
3459
        self._freeze = True
3460 1
3461 1
    def to_binary(self):
3462 1
        packet = []
3463 1
        packet.append(self.TypeId.to_binary())
3464 1
        packet.append(self.ResponseHeader.to_binary())
3465 1
        packet.append(self.Parameters.to_binary())
3466
        return b''.join(packet)
3467 1
3468
    @staticmethod
3469 1
    def from_binary(data):
3470
        return ActivateSessionResponse(data)
3471 1
3472 1
    def _binary_init(self, data):
3473 1
        self.TypeId = NodeId.from_binary(data)
3474 1
        self.ResponseHeader = ResponseHeader.from_binary(data)
3475
        self.Parameters = ActivateSessionResult.from_binary(data)
3476 1
3477
    def __str__(self):
3478
        return 'ActivateSessionResponse(' + 'TypeId:' + str(self.TypeId) + ', ' + \
3479
               'ResponseHeader:' + str(self.ResponseHeader) + ', ' + \
3480
               'Parameters:' + str(self.Parameters) + ')'
3481 1
3482
    __repr__ = __str__
3483
3484 1
3485
class CloseSessionRequest(FrozenClass):
3486
    '''
3487
    Closes a session with the server.
3488
3489
    :ivar TypeId:
3490
    :vartype TypeId: NodeId
3491
    :ivar RequestHeader:
3492
    :vartype RequestHeader: RequestHeader
3493
    :ivar DeleteSubscriptions:
3494
    :vartype DeleteSubscriptions: Boolean
3495 1
    '''
3496 1
    def __init__(self, binary=None):
3497
        if binary is not None:
3498
            self._binary_init(binary)
3499
            self._freeze = True
3500 1
            return
3501 1
        self.TypeId = FourByteNodeId(ObjectIds.CloseSessionRequest_Encoding_DefaultBinary)
3502 1
        self.RequestHeader = RequestHeader()
3503 1
        self.DeleteSubscriptions = True
3504
        self._freeze = True
3505 1
3506 1
    def to_binary(self):
3507 1
        packet = []
3508 1
        packet.append(self.TypeId.to_binary())
3509 1
        packet.append(self.RequestHeader.to_binary())
3510 1
        packet.append(uatype_Boolean.pack(self.DeleteSubscriptions))
3511
        return b''.join(packet)
3512 1
3513
    @staticmethod
3514
    def from_binary(data):
3515
        return CloseSessionRequest(data)
3516 1
3517
    def _binary_init(self, data):
3518
        self.TypeId = NodeId.from_binary(data)
3519
        self.RequestHeader = RequestHeader.from_binary(data)
3520
        self.DeleteSubscriptions = uatype_Boolean.unpack(data.read(1))[0]
3521 1
3522
    def __str__(self):
3523
        return 'CloseSessionRequest(' + 'TypeId:' + str(self.TypeId) + ', ' + \
3524
               'RequestHeader:' + str(self.RequestHeader) + ', ' + \
3525
               'DeleteSubscriptions:' + str(self.DeleteSubscriptions) + ')'
3526 1
3527
    __repr__ = __str__
3528
3529 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
3530
class CloseSessionResponse(FrozenClass):
3531
    '''
3532
    Closes a session with the server.
3533
3534
    :ivar TypeId:
3535
    :vartype TypeId: NodeId
3536
    :ivar ResponseHeader:
3537
    :vartype ResponseHeader: ResponseHeader
3538 1
    '''
3539 1
    def __init__(self, binary=None):
3540 1
        if binary is not None:
3541 1
            self._binary_init(binary)
3542 1
            self._freeze = True
3543 1
            return
3544 1
        self.TypeId = FourByteNodeId(ObjectIds.CloseSessionResponse_Encoding_DefaultBinary)
3545 1
        self.ResponseHeader = ResponseHeader()
3546
        self._freeze = True
3547 1
3548 1
    def to_binary(self):
3549 1
        packet = []
3550 1
        packet.append(self.TypeId.to_binary())
3551 1
        packet.append(self.ResponseHeader.to_binary())
3552
        return b''.join(packet)
3553 1
3554
    @staticmethod
3555 1
    def from_binary(data):
3556
        return CloseSessionResponse(data)
3557 1
3558 1
    def _binary_init(self, data):
3559 1
        self.TypeId = NodeId.from_binary(data)
3560
        self.ResponseHeader = ResponseHeader.from_binary(data)
3561 1
3562
    def __str__(self):
3563
        return 'CloseSessionResponse(' + 'TypeId:' + str(self.TypeId) + ', ' + \
3564
               'ResponseHeader:' + str(self.ResponseHeader) + ')'
3565 1
3566
    __repr__ = __str__
3567
3568 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
3569
class CancelParameters(FrozenClass):
3570
    '''
3571
    :ivar RequestHandle:
3572
    :vartype RequestHandle: UInt32
3573 1
    '''
3574
    def __init__(self, binary=None):
3575
        if binary is not None:
3576
            self._binary_init(binary)
3577
            self._freeze = True
3578
            return
3579
        self.RequestHandle = 0
3580
        self._freeze = True
3581 1
3582
    def to_binary(self):
3583
        packet = []
3584
        packet.append(uatype_UInt32.pack(self.RequestHandle))
3585
        return b''.join(packet)
3586 1
3587
    @staticmethod
3588
    def from_binary(data):
3589
        return CancelParameters(data)
3590 1
3591
    def _binary_init(self, data):
3592
        self.RequestHandle = uatype_UInt32.unpack(data.read(4))[0]
3593 1
3594
    def __str__(self):
3595
        return 'CancelParameters(' + 'RequestHandle:' + str(self.RequestHandle) + ')'
3596 1
3597
    __repr__ = __str__
3598
3599 1
3600
class CancelRequest(FrozenClass):
3601
    '''
3602
    Cancels an outstanding request.
3603
3604
    :ivar TypeId:
3605
    :vartype TypeId: NodeId
3606
    :ivar RequestHeader:
3607
    :vartype RequestHeader: RequestHeader
3608
    :ivar Parameters:
3609
    :vartype Parameters: CancelParameters
3610 1
    '''
3611
    def __init__(self, binary=None):
3612
        if binary is not None:
3613
            self._binary_init(binary)
3614
            self._freeze = True
3615
            return
3616
        self.TypeId = FourByteNodeId(ObjectIds.CancelRequest_Encoding_DefaultBinary)
3617
        self.RequestHeader = RequestHeader()
3618
        self.Parameters = CancelParameters()
3619
        self._freeze = True
3620 1
3621
    def to_binary(self):
3622
        packet = []
3623
        packet.append(self.TypeId.to_binary())
3624
        packet.append(self.RequestHeader.to_binary())
3625
        packet.append(self.Parameters.to_binary())
3626
        return b''.join(packet)
3627 1
3628
    @staticmethod
3629
    def from_binary(data):
3630
        return CancelRequest(data)
3631 1
3632
    def _binary_init(self, data):
3633
        self.TypeId = NodeId.from_binary(data)
3634
        self.RequestHeader = RequestHeader.from_binary(data)
3635
        self.Parameters = CancelParameters.from_binary(data)
3636 1
3637
    def __str__(self):
3638
        return 'CancelRequest(' + 'TypeId:' + str(self.TypeId) + ', ' + \
3639
               'RequestHeader:' + str(self.RequestHeader) + ', ' + \
3640
               'Parameters:' + str(self.Parameters) + ')'
3641 1
3642
    __repr__ = __str__
3643
3644 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
3645
class CancelResult(FrozenClass):
3646
    '''
3647
    :ivar CancelCount:
3648
    :vartype CancelCount: UInt32
3649 1
    '''
3650
    def __init__(self, binary=None):
3651
        if binary is not None:
3652
            self._binary_init(binary)
3653
            self._freeze = True
3654
            return
3655
        self.CancelCount = 0
3656
        self._freeze = True
3657 1
3658
    def to_binary(self):
3659
        packet = []
3660
        packet.append(uatype_UInt32.pack(self.CancelCount))
3661
        return b''.join(packet)
3662 1
3663
    @staticmethod
3664
    def from_binary(data):
3665
        return CancelResult(data)
3666 1
3667
    def _binary_init(self, data):
3668
        self.CancelCount = uatype_UInt32.unpack(data.read(4))[0]
3669 1
3670
    def __str__(self):
3671
        return 'CancelResult(' + 'CancelCount:' + str(self.CancelCount) + ')'
3672 1
3673
    __repr__ = __str__
3674
3675 1
3676
class CancelResponse(FrozenClass):
3677
    '''
3678
    Cancels an outstanding request.
3679
3680
    :ivar TypeId:
3681
    :vartype TypeId: NodeId
3682
    :ivar ResponseHeader:
3683
    :vartype ResponseHeader: ResponseHeader
3684
    :ivar Parameters:
3685
    :vartype Parameters: CancelResult
3686 1
    '''
3687
    def __init__(self, binary=None):
3688
        if binary is not None:
3689
            self._binary_init(binary)
3690
            self._freeze = True
3691
            return
3692
        self.TypeId = FourByteNodeId(ObjectIds.CancelResponse_Encoding_DefaultBinary)
3693
        self.ResponseHeader = ResponseHeader()
3694
        self.Parameters = CancelResult()
3695
        self._freeze = True
3696 1
3697
    def to_binary(self):
3698
        packet = []
3699
        packet.append(self.TypeId.to_binary())
3700
        packet.append(self.ResponseHeader.to_binary())
3701
        packet.append(self.Parameters.to_binary())
3702
        return b''.join(packet)
3703 1
3704
    @staticmethod
3705
    def from_binary(data):
3706
        return CancelResponse(data)
3707 1
3708
    def _binary_init(self, data):
3709
        self.TypeId = NodeId.from_binary(data)
3710
        self.ResponseHeader = ResponseHeader.from_binary(data)
3711
        self.Parameters = CancelResult.from_binary(data)
3712 1
3713
    def __str__(self):
3714
        return 'CancelResponse(' + 'TypeId:' + str(self.TypeId) + ', ' + \
3715
               'ResponseHeader:' + str(self.ResponseHeader) + ', ' + \
3716
               'Parameters:' + str(self.Parameters) + ')'
3717 1
3718
    __repr__ = __str__
3719
3720 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
3721
class NodeAttributes(FrozenClass):
3722
    '''
3723
    The base attributes for all nodes.
3724
3725
    :ivar SpecifiedAttributes:
3726
    :vartype SpecifiedAttributes: UInt32
3727
    :ivar DisplayName:
3728
    :vartype DisplayName: LocalizedText
3729
    :ivar Description:
3730
    :vartype Description: LocalizedText
3731
    :ivar WriteMask:
3732
    :vartype WriteMask: UInt32
3733
    :ivar UserWriteMask:
3734
    :vartype UserWriteMask: UInt32
3735 1
    '''
3736
    def __init__(self, binary=None):
3737
        if binary is not None:
3738
            self._binary_init(binary)
3739
            self._freeze = True
3740
            return
3741
        self.SpecifiedAttributes = 0
3742
        self.DisplayName = LocalizedText()
3743
        self.Description = LocalizedText()
3744
        self.WriteMask = 0
3745
        self.UserWriteMask = 0
3746
        self._freeze = True
3747 1
3748
    def to_binary(self):
3749
        packet = []
3750
        packet.append(uatype_UInt32.pack(self.SpecifiedAttributes))
3751
        packet.append(self.DisplayName.to_binary())
3752
        packet.append(self.Description.to_binary())
3753
        packet.append(uatype_UInt32.pack(self.WriteMask))
3754
        packet.append(uatype_UInt32.pack(self.UserWriteMask))
3755
        return b''.join(packet)
3756 1
3757
    @staticmethod
3758
    def from_binary(data):
3759
        return NodeAttributes(data)
3760 1
3761
    def _binary_init(self, data):
3762
        self.SpecifiedAttributes = uatype_UInt32.unpack(data.read(4))[0]
3763
        self.DisplayName = LocalizedText.from_binary(data)
3764
        self.Description = LocalizedText.from_binary(data)
3765
        self.WriteMask = uatype_UInt32.unpack(data.read(4))[0]
3766
        self.UserWriteMask = uatype_UInt32.unpack(data.read(4))[0]
3767 1
3768
    def __str__(self):
3769
        return 'NodeAttributes(' + 'SpecifiedAttributes:' + str(self.SpecifiedAttributes) + ', ' + \
3770
               'DisplayName:' + str(self.DisplayName) + ', ' + \
3771
               'Description:' + str(self.Description) + ', ' + \
3772
               'WriteMask:' + str(self.WriteMask) + ', ' + \
3773
               'UserWriteMask:' + str(self.UserWriteMask) + ')'
3774 1
3775
    __repr__ = __str__
3776
3777 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
3778
class ObjectAttributes(FrozenClass):
3779
    '''
3780
    The attributes for an object node.
3781
3782
    :ivar SpecifiedAttributes:
3783
    :vartype SpecifiedAttributes: UInt32
3784
    :ivar DisplayName:
3785
    :vartype DisplayName: LocalizedText
3786
    :ivar Description:
3787
    :vartype Description: LocalizedText
3788
    :ivar WriteMask:
3789
    :vartype WriteMask: UInt32
3790
    :ivar UserWriteMask:
3791
    :vartype UserWriteMask: UInt32
3792
    :ivar EventNotifier:
3793
    :vartype EventNotifier: Byte
3794 1
    '''
3795 1
    def __init__(self, binary=None):
3796 1
        if binary is not None:
3797 1
            self._binary_init(binary)
3798 1
            self._freeze = True
3799 1
            return
3800 1
        self.SpecifiedAttributes = 0
3801 1
        self.DisplayName = LocalizedText()
3802 1
        self.Description = LocalizedText()
3803 1
        self.WriteMask = 0
3804 1
        self.UserWriteMask = 0
3805 1
        self.EventNotifier = 0
3806
        self._freeze = True
3807 1
3808 1
    def to_binary(self):
3809 1
        packet = []
3810 1
        packet.append(uatype_UInt32.pack(self.SpecifiedAttributes))
3811 1
        packet.append(self.DisplayName.to_binary())
3812 1
        packet.append(self.Description.to_binary())
3813 1
        packet.append(uatype_UInt32.pack(self.WriteMask))
3814 1
        packet.append(uatype_UInt32.pack(self.UserWriteMask))
3815 1
        packet.append(uatype_Byte.pack(self.EventNotifier))
3816
        return b''.join(packet)
3817 1
3818
    @staticmethod
3819 1
    def from_binary(data):
3820
        return ObjectAttributes(data)
3821 1
3822 1
    def _binary_init(self, data):
3823 1
        self.SpecifiedAttributes = uatype_UInt32.unpack(data.read(4))[0]
3824 1
        self.DisplayName = LocalizedText.from_binary(data)
3825 1
        self.Description = LocalizedText.from_binary(data)
3826 1
        self.WriteMask = uatype_UInt32.unpack(data.read(4))[0]
3827 1
        self.UserWriteMask = uatype_UInt32.unpack(data.read(4))[0]
3828
        self.EventNotifier = uatype_Byte.unpack(data.read(1))[0]
3829 1
3830
    def __str__(self):
3831
        return 'ObjectAttributes(' + 'SpecifiedAttributes:' + str(self.SpecifiedAttributes) + ', ' + \
3832
               'DisplayName:' + str(self.DisplayName) + ', ' + \
3833
               'Description:' + str(self.Description) + ', ' + \
3834
               'WriteMask:' + str(self.WriteMask) + ', ' + \
3835
               'UserWriteMask:' + str(self.UserWriteMask) + ', ' + \
3836
               'EventNotifier:' + str(self.EventNotifier) + ')'
3837 1
3838
    __repr__ = __str__
3839
3840 1
3841
class VariableAttributes(FrozenClass):
3842
    '''
3843
    The attributes for a variable node.
3844
3845
    :ivar SpecifiedAttributes:
3846
    :vartype SpecifiedAttributes: UInt32
3847
    :ivar DisplayName:
3848
    :vartype DisplayName: LocalizedText
3849
    :ivar Description:
3850
    :vartype Description: LocalizedText
3851
    :ivar WriteMask:
3852
    :vartype WriteMask: UInt32
3853
    :ivar UserWriteMask:
3854
    :vartype UserWriteMask: UInt32
3855
    :ivar Value:
3856
    :vartype Value: Variant
3857
    :ivar DataType:
3858
    :vartype DataType: NodeId
3859
    :ivar ValueRank:
3860
    :vartype ValueRank: Int32
3861
    :ivar ArrayDimensions:
3862
    :vartype ArrayDimensions: UInt32
3863
    :ivar AccessLevel:
3864
    :vartype AccessLevel: Byte
3865
    :ivar UserAccessLevel:
3866
    :vartype UserAccessLevel: Byte
3867
    :ivar MinimumSamplingInterval:
3868
    :vartype MinimumSamplingInterval: Double
3869
    :ivar Historizing:
3870
    :vartype Historizing: Boolean
3871 1
    '''
3872 1
    def __init__(self, binary=None):
3873 1
        if binary is not None:
3874 1
            self._binary_init(binary)
3875 1
            self._freeze = True
3876 1
            return
3877 1
        self.SpecifiedAttributes = 0
3878 1
        self.DisplayName = LocalizedText()
3879 1
        self.Description = LocalizedText()
3880 1
        self.WriteMask = 0
3881 1
        self.UserWriteMask = 0
3882 1
        self.Value = Variant()
3883 1
        self.DataType = NodeId()
3884 1
        self.ValueRank = 0
3885 1
        self.ArrayDimensions = []
3886 1
        self.AccessLevel = 0
3887 1
        self.UserAccessLevel = 0
3888 1
        self.MinimumSamplingInterval = 0
3889 1
        self.Historizing = True
3890
        self._freeze = True
3891 1
3892 1
    def to_binary(self):
3893 1
        packet = []
3894 1
        packet.append(uatype_UInt32.pack(self.SpecifiedAttributes))
3895 1
        packet.append(self.DisplayName.to_binary())
3896 1
        packet.append(self.Description.to_binary())
3897 1
        packet.append(uatype_UInt32.pack(self.WriteMask))
3898 1
        packet.append(uatype_UInt32.pack(self.UserWriteMask))
3899 1
        packet.append(self.Value.to_binary())
3900 1
        packet.append(self.DataType.to_binary())
3901 1
        packet.append(uatype_Int32.pack(self.ValueRank))
3902 1
        packet.append(uatype_Int32.pack(len(self.ArrayDimensions)))
3903
        for fieldname in self.ArrayDimensions:
3904 1
            packet.append(uatype_UInt32.pack(fieldname))
3905 1
        packet.append(uatype_Byte.pack(self.AccessLevel))
3906 1
        packet.append(uatype_Byte.pack(self.UserAccessLevel))
3907 1
        packet.append(uatype_Double.pack(self.MinimumSamplingInterval))
3908 1
        packet.append(uatype_Boolean.pack(self.Historizing))
3909
        return b''.join(packet)
3910 1
3911
    @staticmethod
3912 1
    def from_binary(data):
3913
        return VariableAttributes(data)
3914 1
3915 1
    def _binary_init(self, data):
3916 1
        self.SpecifiedAttributes = uatype_UInt32.unpack(data.read(4))[0]
3917 1
        self.DisplayName = LocalizedText.from_binary(data)
3918 1
        self.Description = LocalizedText.from_binary(data)
3919 1
        self.WriteMask = uatype_UInt32.unpack(data.read(4))[0]
3920 1
        self.UserWriteMask = uatype_UInt32.unpack(data.read(4))[0]
3921 1
        self.Value = Variant.from_binary(data)
3922 1
        self.DataType = NodeId.from_binary(data)
3923 1
        self.ValueRank = uatype_Int32.unpack(data.read(4))[0]
3924 1
        self.ArrayDimensions = unpack_uatype_array('UInt32', data)
3925 1
        self.AccessLevel = uatype_Byte.unpack(data.read(1))[0]
3926 1
        self.UserAccessLevel = uatype_Byte.unpack(data.read(1))[0]
3927 1
        self.MinimumSamplingInterval = uatype_Double.unpack(data.read(8))[0]
3928
        self.Historizing = uatype_Boolean.unpack(data.read(1))[0]
3929 1
3930
    def __str__(self):
3931
        return 'VariableAttributes(' + 'SpecifiedAttributes:' + str(self.SpecifiedAttributes) + ', ' + \
3932
               'DisplayName:' + str(self.DisplayName) + ', ' + \
3933
               'Description:' + str(self.Description) + ', ' + \
3934
               'WriteMask:' + str(self.WriteMask) + ', ' + \
3935
               'UserWriteMask:' + str(self.UserWriteMask) + ', ' + \
3936
               'Value:' + str(self.Value) + ', ' + \
3937
               'DataType:' + str(self.DataType) + ', ' + \
3938
               'ValueRank:' + str(self.ValueRank) + ', ' + \
3939
               'ArrayDimensions:' + str(self.ArrayDimensions) + ', ' + \
3940
               'AccessLevel:' + str(self.AccessLevel) + ', ' + \
3941
               'UserAccessLevel:' + str(self.UserAccessLevel) + ', ' + \
3942
               'MinimumSamplingInterval:' + str(self.MinimumSamplingInterval) + ', ' + \
3943
               'Historizing:' + str(self.Historizing) + ')'
3944 1
3945
    __repr__ = __str__
3946
3947 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
3948
class MethodAttributes(FrozenClass):
3949
    '''
3950
    The attributes for a method node.
3951
3952
    :ivar SpecifiedAttributes:
3953
    :vartype SpecifiedAttributes: UInt32
3954
    :ivar DisplayName:
3955
    :vartype DisplayName: LocalizedText
3956
    :ivar Description:
3957
    :vartype Description: LocalizedText
3958
    :ivar WriteMask:
3959
    :vartype WriteMask: UInt32
3960
    :ivar UserWriteMask:
3961
    :vartype UserWriteMask: UInt32
3962
    :ivar Executable:
3963
    :vartype Executable: Boolean
3964
    :ivar UserExecutable:
3965
    :vartype UserExecutable: Boolean
3966 1
    '''
3967 1
    def __init__(self, binary=None):
3968
        if binary is not None:
3969
            self._binary_init(binary)
3970
            self._freeze = True
3971 1
            return
3972 1
        self.SpecifiedAttributes = 0
3973 1
        self.DisplayName = LocalizedText()
3974 1
        self.Description = LocalizedText()
3975 1
        self.WriteMask = 0
3976 1
        self.UserWriteMask = 0
3977 1
        self.Executable = True
3978 1
        self.UserExecutable = True
3979
        self._freeze = True
3980 1
3981
    def to_binary(self):
3982
        packet = []
3983
        packet.append(uatype_UInt32.pack(self.SpecifiedAttributes))
3984
        packet.append(self.DisplayName.to_binary())
3985
        packet.append(self.Description.to_binary())
3986
        packet.append(uatype_UInt32.pack(self.WriteMask))
3987
        packet.append(uatype_UInt32.pack(self.UserWriteMask))
3988
        packet.append(uatype_Boolean.pack(self.Executable))
3989
        packet.append(uatype_Boolean.pack(self.UserExecutable))
3990
        return b''.join(packet)
3991 1
3992
    @staticmethod
3993
    def from_binary(data):
3994
        return MethodAttributes(data)
3995 1
3996
    def _binary_init(self, data):
3997
        self.SpecifiedAttributes = uatype_UInt32.unpack(data.read(4))[0]
3998
        self.DisplayName = LocalizedText.from_binary(data)
3999
        self.Description = LocalizedText.from_binary(data)
4000
        self.WriteMask = uatype_UInt32.unpack(data.read(4))[0]
4001
        self.UserWriteMask = uatype_UInt32.unpack(data.read(4))[0]
4002
        self.Executable = uatype_Boolean.unpack(data.read(1))[0]
4003
        self.UserExecutable = uatype_Boolean.unpack(data.read(1))[0]
4004 1
4005
    def __str__(self):
4006
        return 'MethodAttributes(' + 'SpecifiedAttributes:' + str(self.SpecifiedAttributes) + ', ' + \
4007
               'DisplayName:' + str(self.DisplayName) + ', ' + \
4008
               'Description:' + str(self.Description) + ', ' + \
4009
               'WriteMask:' + str(self.WriteMask) + ', ' + \
4010
               'UserWriteMask:' + str(self.UserWriteMask) + ', ' + \
4011
               'Executable:' + str(self.Executable) + ', ' + \
4012
               'UserExecutable:' + str(self.UserExecutable) + ')'
4013 1
4014
    __repr__ = __str__
4015
4016 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
4017
class ObjectTypeAttributes(FrozenClass):
4018
    '''
4019
    The attributes for an object type node.
4020
4021
    :ivar SpecifiedAttributes:
4022
    :vartype SpecifiedAttributes: UInt32
4023
    :ivar DisplayName:
4024
    :vartype DisplayName: LocalizedText
4025
    :ivar Description:
4026
    :vartype Description: LocalizedText
4027
    :ivar WriteMask:
4028
    :vartype WriteMask: UInt32
4029
    :ivar UserWriteMask:
4030
    :vartype UserWriteMask: UInt32
4031
    :ivar IsAbstract:
4032
    :vartype IsAbstract: Boolean
4033 1
    '''
4034 1
    def __init__(self, binary=None):
4035
        if binary is not None:
4036
            self._binary_init(binary)
4037
            self._freeze = True
4038 1
            return
4039 1
        self.SpecifiedAttributes = 0
4040 1
        self.DisplayName = LocalizedText()
4041 1
        self.Description = LocalizedText()
4042 1
        self.WriteMask = 0
4043 1
        self.UserWriteMask = 0
4044 1
        self.IsAbstract = True
4045
        self._freeze = True
4046 1
4047
    def to_binary(self):
4048
        packet = []
4049
        packet.append(uatype_UInt32.pack(self.SpecifiedAttributes))
4050
        packet.append(self.DisplayName.to_binary())
4051
        packet.append(self.Description.to_binary())
4052
        packet.append(uatype_UInt32.pack(self.WriteMask))
4053
        packet.append(uatype_UInt32.pack(self.UserWriteMask))
4054
        packet.append(uatype_Boolean.pack(self.IsAbstract))
4055
        return b''.join(packet)
4056 1
4057
    @staticmethod
4058
    def from_binary(data):
4059
        return ObjectTypeAttributes(data)
4060 1
4061
    def _binary_init(self, data):
4062
        self.SpecifiedAttributes = uatype_UInt32.unpack(data.read(4))[0]
4063
        self.DisplayName = LocalizedText.from_binary(data)
4064
        self.Description = LocalizedText.from_binary(data)
4065
        self.WriteMask = uatype_UInt32.unpack(data.read(4))[0]
4066
        self.UserWriteMask = uatype_UInt32.unpack(data.read(4))[0]
4067
        self.IsAbstract = uatype_Boolean.unpack(data.read(1))[0]
4068 1
4069
    def __str__(self):
4070
        return 'ObjectTypeAttributes(' + 'SpecifiedAttributes:' + str(self.SpecifiedAttributes) + ', ' + \
4071
               'DisplayName:' + str(self.DisplayName) + ', ' + \
4072
               'Description:' + str(self.Description) + ', ' + \
4073
               'WriteMask:' + str(self.WriteMask) + ', ' + \
4074
               'UserWriteMask:' + str(self.UserWriteMask) + ', ' + \
4075
               'IsAbstract:' + str(self.IsAbstract) + ')'
4076 1
4077
    __repr__ = __str__
4078
4079 1
4080
class VariableTypeAttributes(FrozenClass):
4081
    '''
4082
    The attributes for a variable type node.
4083
4084
    :ivar SpecifiedAttributes:
4085
    :vartype SpecifiedAttributes: UInt32
4086
    :ivar DisplayName:
4087
    :vartype DisplayName: LocalizedText
4088
    :ivar Description:
4089
    :vartype Description: LocalizedText
4090
    :ivar WriteMask:
4091
    :vartype WriteMask: UInt32
4092
    :ivar UserWriteMask:
4093
    :vartype UserWriteMask: UInt32
4094
    :ivar Value:
4095
    :vartype Value: Variant
4096
    :ivar DataType:
4097
    :vartype DataType: NodeId
4098
    :ivar ValueRank:
4099
    :vartype ValueRank: Int32
4100
    :ivar ArrayDimensions:
4101
    :vartype ArrayDimensions: UInt32
4102
    :ivar IsAbstract:
4103
    :vartype IsAbstract: Boolean
4104 1 View Code Duplication
    '''
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
4105 1
    def __init__(self, binary=None):
4106
        if binary is not None:
4107
            self._binary_init(binary)
4108
            self._freeze = True
4109 1
            return
4110 1
        self.SpecifiedAttributes = 0
4111 1
        self.DisplayName = LocalizedText()
4112 1
        self.Description = LocalizedText()
4113 1
        self.WriteMask = 0
4114 1
        self.UserWriteMask = 0
4115 1
        self.Value = Variant()
4116 1
        self.DataType = NodeId()
4117 1
        self.ValueRank = 0
4118 1
        self.ArrayDimensions = []
4119 1
        self.IsAbstract = True
4120
        self._freeze = True
4121 1
4122
    def to_binary(self):
4123
        packet = []
4124
        packet.append(uatype_UInt32.pack(self.SpecifiedAttributes))
4125
        packet.append(self.DisplayName.to_binary())
4126
        packet.append(self.Description.to_binary())
4127
        packet.append(uatype_UInt32.pack(self.WriteMask))
4128
        packet.append(uatype_UInt32.pack(self.UserWriteMask))
4129
        packet.append(self.Value.to_binary())
4130
        packet.append(self.DataType.to_binary())
4131
        packet.append(uatype_Int32.pack(self.ValueRank))
4132
        packet.append(uatype_Int32.pack(len(self.ArrayDimensions)))
4133
        for fieldname in self.ArrayDimensions:
4134
            packet.append(uatype_UInt32.pack(fieldname))
4135
        packet.append(uatype_Boolean.pack(self.IsAbstract))
4136
        return b''.join(packet)
4137 1
4138
    @staticmethod
4139
    def from_binary(data):
4140
        return VariableTypeAttributes(data)
4141 1
4142
    def _binary_init(self, data):
4143
        self.SpecifiedAttributes = uatype_UInt32.unpack(data.read(4))[0]
4144
        self.DisplayName = LocalizedText.from_binary(data)
4145
        self.Description = LocalizedText.from_binary(data)
4146
        self.WriteMask = uatype_UInt32.unpack(data.read(4))[0]
4147
        self.UserWriteMask = uatype_UInt32.unpack(data.read(4))[0]
4148
        self.Value = Variant.from_binary(data)
4149
        self.DataType = NodeId.from_binary(data)
4150
        self.ValueRank = uatype_Int32.unpack(data.read(4))[0]
4151
        self.ArrayDimensions = unpack_uatype_array('UInt32', data)
4152
        self.IsAbstract = uatype_Boolean.unpack(data.read(1))[0]
4153 1
4154
    def __str__(self):
4155
        return 'VariableTypeAttributes(' + 'SpecifiedAttributes:' + str(self.SpecifiedAttributes) + ', ' + \
4156
               'DisplayName:' + str(self.DisplayName) + ', ' + \
4157
               'Description:' + str(self.Description) + ', ' + \
4158
               'WriteMask:' + str(self.WriteMask) + ', ' + \
4159
               'UserWriteMask:' + str(self.UserWriteMask) + ', ' + \
4160
               'Value:' + str(self.Value) + ', ' + \
4161
               'DataType:' + str(self.DataType) + ', ' + \
4162
               'ValueRank:' + str(self.ValueRank) + ', ' + \
4163
               'ArrayDimensions:' + str(self.ArrayDimensions) + ', ' + \
4164
               'IsAbstract:' + str(self.IsAbstract) + ')'
4165 1
4166
    __repr__ = __str__
4167
4168 1
4169
class ReferenceTypeAttributes(FrozenClass):
4170
    '''
4171
    The attributes for a reference type node.
4172
4173
    :ivar SpecifiedAttributes:
4174
    :vartype SpecifiedAttributes: UInt32
4175
    :ivar DisplayName:
4176
    :vartype DisplayName: LocalizedText
4177
    :ivar Description:
4178
    :vartype Description: LocalizedText
4179
    :ivar WriteMask:
4180
    :vartype WriteMask: UInt32
4181
    :ivar UserWriteMask:
4182
    :vartype UserWriteMask: UInt32
4183
    :ivar IsAbstract:
4184
    :vartype IsAbstract: Boolean
4185
    :ivar Symmetric:
4186
    :vartype Symmetric: Boolean
4187
    :ivar InverseName:
4188
    :vartype InverseName: LocalizedText
4189 1 View Code Duplication
    '''
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
4190 1
    def __init__(self, binary=None):
4191
        if binary is not None:
4192
            self._binary_init(binary)
4193
            self._freeze = True
4194 1
            return
4195 1
        self.SpecifiedAttributes = 0
4196 1
        self.DisplayName = LocalizedText()
4197 1
        self.Description = LocalizedText()
4198 1
        self.WriteMask = 0
4199 1
        self.UserWriteMask = 0
4200 1
        self.IsAbstract = True
4201 1
        self.Symmetric = True
4202 1
        self.InverseName = LocalizedText()
4203
        self._freeze = True
4204 1
4205
    def to_binary(self):
4206
        packet = []
4207
        packet.append(uatype_UInt32.pack(self.SpecifiedAttributes))
4208
        packet.append(self.DisplayName.to_binary())
4209
        packet.append(self.Description.to_binary())
4210
        packet.append(uatype_UInt32.pack(self.WriteMask))
4211
        packet.append(uatype_UInt32.pack(self.UserWriteMask))
4212
        packet.append(uatype_Boolean.pack(self.IsAbstract))
4213
        packet.append(uatype_Boolean.pack(self.Symmetric))
4214
        packet.append(self.InverseName.to_binary())
4215
        return b''.join(packet)
4216 1
4217
    @staticmethod
4218
    def from_binary(data):
4219
        return ReferenceTypeAttributes(data)
4220 1
4221
    def _binary_init(self, data):
4222
        self.SpecifiedAttributes = uatype_UInt32.unpack(data.read(4))[0]
4223
        self.DisplayName = LocalizedText.from_binary(data)
4224
        self.Description = LocalizedText.from_binary(data)
4225
        self.WriteMask = uatype_UInt32.unpack(data.read(4))[0]
4226
        self.UserWriteMask = uatype_UInt32.unpack(data.read(4))[0]
4227
        self.IsAbstract = uatype_Boolean.unpack(data.read(1))[0]
4228
        self.Symmetric = uatype_Boolean.unpack(data.read(1))[0]
4229
        self.InverseName = LocalizedText.from_binary(data)
4230 1
4231
    def __str__(self):
4232
        return 'ReferenceTypeAttributes(' + 'SpecifiedAttributes:' + str(self.SpecifiedAttributes) + ', ' + \
4233
               'DisplayName:' + str(self.DisplayName) + ', ' + \
4234
               'Description:' + str(self.Description) + ', ' + \
4235
               'WriteMask:' + str(self.WriteMask) + ', ' + \
4236
               'UserWriteMask:' + str(self.UserWriteMask) + ', ' + \
4237
               'IsAbstract:' + str(self.IsAbstract) + ', ' + \
4238
               'Symmetric:' + str(self.Symmetric) + ', ' + \
4239
               'InverseName:' + str(self.InverseName) + ')'
4240 1
4241
    __repr__ = __str__
4242
4243 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
4244
class DataTypeAttributes(FrozenClass):
4245
    '''
4246
    The attributes for a data type node.
4247
4248
    :ivar SpecifiedAttributes:
4249
    :vartype SpecifiedAttributes: UInt32
4250
    :ivar DisplayName:
4251
    :vartype DisplayName: LocalizedText
4252
    :ivar Description:
4253
    :vartype Description: LocalizedText
4254
    :ivar WriteMask:
4255
    :vartype WriteMask: UInt32
4256
    :ivar UserWriteMask:
4257
    :vartype UserWriteMask: UInt32
4258
    :ivar IsAbstract:
4259
    :vartype IsAbstract: Boolean
4260 1
    '''
4261 1
    def __init__(self, binary=None):
4262
        if binary is not None:
4263
            self._binary_init(binary)
4264
            self._freeze = True
4265 1
            return
4266 1
        self.SpecifiedAttributes = 0
4267 1
        self.DisplayName = LocalizedText()
4268 1
        self.Description = LocalizedText()
4269 1
        self.WriteMask = 0
4270 1
        self.UserWriteMask = 0
4271 1
        self.IsAbstract = True
4272
        self._freeze = True
4273 1
4274
    def to_binary(self):
4275
        packet = []
4276
        packet.append(uatype_UInt32.pack(self.SpecifiedAttributes))
4277
        packet.append(self.DisplayName.to_binary())
4278
        packet.append(self.Description.to_binary())
4279
        packet.append(uatype_UInt32.pack(self.WriteMask))
4280
        packet.append(uatype_UInt32.pack(self.UserWriteMask))
4281
        packet.append(uatype_Boolean.pack(self.IsAbstract))
4282
        return b''.join(packet)
4283 1
4284
    @staticmethod
4285
    def from_binary(data):
4286
        return DataTypeAttributes(data)
4287 1
4288
    def _binary_init(self, data):
4289
        self.SpecifiedAttributes = uatype_UInt32.unpack(data.read(4))[0]
4290
        self.DisplayName = LocalizedText.from_binary(data)
4291
        self.Description = LocalizedText.from_binary(data)
4292
        self.WriteMask = uatype_UInt32.unpack(data.read(4))[0]
4293
        self.UserWriteMask = uatype_UInt32.unpack(data.read(4))[0]
4294
        self.IsAbstract = uatype_Boolean.unpack(data.read(1))[0]
4295 1
4296
    def __str__(self):
4297
        return 'DataTypeAttributes(' + 'SpecifiedAttributes:' + str(self.SpecifiedAttributes) + ', ' + \
4298
               'DisplayName:' + str(self.DisplayName) + ', ' + \
4299
               'Description:' + str(self.Description) + ', ' + \
4300
               'WriteMask:' + str(self.WriteMask) + ', ' + \
4301
               'UserWriteMask:' + str(self.UserWriteMask) + ', ' + \
4302
               'IsAbstract:' + str(self.IsAbstract) + ')'
4303 1
4304
    __repr__ = __str__
4305
4306 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
4307
class ViewAttributes(FrozenClass):
4308
    '''
4309
    The attributes for a view node.
4310
4311
    :ivar SpecifiedAttributes:
4312
    :vartype SpecifiedAttributes: UInt32
4313
    :ivar DisplayName:
4314
    :vartype DisplayName: LocalizedText
4315
    :ivar Description:
4316
    :vartype Description: LocalizedText
4317
    :ivar WriteMask:
4318
    :vartype WriteMask: UInt32
4319
    :ivar UserWriteMask:
4320
    :vartype UserWriteMask: UInt32
4321
    :ivar ContainsNoLoops:
4322
    :vartype ContainsNoLoops: Boolean
4323
    :ivar EventNotifier:
4324
    :vartype EventNotifier: Byte
4325 1
    '''
4326
    def __init__(self, binary=None):
4327
        if binary is not None:
4328
            self._binary_init(binary)
4329
            self._freeze = True
4330
            return
4331
        self.SpecifiedAttributes = 0
4332
        self.DisplayName = LocalizedText()
4333
        self.Description = LocalizedText()
4334
        self.WriteMask = 0
4335
        self.UserWriteMask = 0
4336
        self.ContainsNoLoops = True
4337
        self.EventNotifier = 0
4338
        self._freeze = True
4339 1
4340
    def to_binary(self):
4341
        packet = []
4342
        packet.append(uatype_UInt32.pack(self.SpecifiedAttributes))
4343
        packet.append(self.DisplayName.to_binary())
4344
        packet.append(self.Description.to_binary())
4345
        packet.append(uatype_UInt32.pack(self.WriteMask))
4346
        packet.append(uatype_UInt32.pack(self.UserWriteMask))
4347
        packet.append(uatype_Boolean.pack(self.ContainsNoLoops))
4348
        packet.append(uatype_Byte.pack(self.EventNotifier))
4349
        return b''.join(packet)
4350 1
4351
    @staticmethod
4352
    def from_binary(data):
4353
        return ViewAttributes(data)
4354 1
4355
    def _binary_init(self, data):
4356
        self.SpecifiedAttributes = uatype_UInt32.unpack(data.read(4))[0]
4357
        self.DisplayName = LocalizedText.from_binary(data)
4358
        self.Description = LocalizedText.from_binary(data)
4359
        self.WriteMask = uatype_UInt32.unpack(data.read(4))[0]
4360
        self.UserWriteMask = uatype_UInt32.unpack(data.read(4))[0]
4361
        self.ContainsNoLoops = uatype_Boolean.unpack(data.read(1))[0]
4362
        self.EventNotifier = uatype_Byte.unpack(data.read(1))[0]
4363 1
4364
    def __str__(self):
4365
        return 'ViewAttributes(' + 'SpecifiedAttributes:' + str(self.SpecifiedAttributes) + ', ' + \
4366
               'DisplayName:' + str(self.DisplayName) + ', ' + \
4367
               'Description:' + str(self.Description) + ', ' + \
4368
               'WriteMask:' + str(self.WriteMask) + ', ' + \
4369
               'UserWriteMask:' + str(self.UserWriteMask) + ', ' + \
4370
               'ContainsNoLoops:' + str(self.ContainsNoLoops) + ', ' + \
4371
               'EventNotifier:' + str(self.EventNotifier) + ')'
4372 1
4373
    __repr__ = __str__
4374
4375 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
4376
class AddNodesItem(FrozenClass):
4377
    '''
4378
    A request to add a node to the server address space.
4379
4380
    :ivar ParentNodeId:
4381
    :vartype ParentNodeId: ExpandedNodeId
4382
    :ivar ReferenceTypeId:
4383
    :vartype ReferenceTypeId: NodeId
4384
    :ivar RequestedNewNodeId:
4385
    :vartype RequestedNewNodeId: ExpandedNodeId
4386
    :ivar BrowseName:
4387
    :vartype BrowseName: QualifiedName
4388
    :ivar NodeClass:
4389
    :vartype NodeClass: NodeClass
4390
    :ivar NodeAttributes:
4391
    :vartype NodeAttributes: ExtensionObject
4392
    :ivar TypeDefinition:
4393
    :vartype TypeDefinition: ExpandedNodeId
4394 1
    '''
4395 1
    def __init__(self, binary=None):
4396 1
        if binary is not None:
4397 1
            self._binary_init(binary)
4398 1
            self._freeze = True
4399 1
            return
4400 1
        self.ParentNodeId = ExpandedNodeId()
4401 1
        self.ReferenceTypeId = NodeId()
4402 1
        self.RequestedNewNodeId = ExpandedNodeId()
4403 1
        self.BrowseName = QualifiedName()
4404 1
        self.NodeClass = NodeClass(0)
4405 1
        self.NodeAttributes = None
4406 1
        self.TypeDefinition = ExpandedNodeId()
4407
        self._freeze = True
4408 1
4409 1
    def to_binary(self):
4410 1
        packet = []
4411 1
        packet.append(self.ParentNodeId.to_binary())
4412 1
        packet.append(self.ReferenceTypeId.to_binary())
4413 1
        packet.append(self.RequestedNewNodeId.to_binary())
4414 1
        packet.append(self.BrowseName.to_binary())
4415 1
        packet.append(uatype_UInt32.pack(self.NodeClass.value))
4416 1
        packet.append(extensionobject_to_binary(self.NodeAttributes))
4417 1
        packet.append(self.TypeDefinition.to_binary())
4418
        return b''.join(packet)
4419 1
4420
    @staticmethod
4421 1
    def from_binary(data):
4422
        return AddNodesItem(data)
4423 1
4424 1
    def _binary_init(self, data):
4425 1
        self.ParentNodeId = ExpandedNodeId.from_binary(data)
4426 1
        self.ReferenceTypeId = NodeId.from_binary(data)
4427 1
        self.RequestedNewNodeId = ExpandedNodeId.from_binary(data)
4428 1
        self.BrowseName = QualifiedName.from_binary(data)
4429 1
        self.NodeClass = NodeClass(uatype_UInt32.unpack(data.read(4))[0])
4430 1
        self.NodeAttributes = extensionobject_from_binary(data)
4431
        self.TypeDefinition = ExpandedNodeId.from_binary(data)
4432 1
4433
    def __str__(self):
4434
        return 'AddNodesItem(' + 'ParentNodeId:' + str(self.ParentNodeId) + ', ' + \
4435
               'ReferenceTypeId:' + str(self.ReferenceTypeId) + ', ' + \
4436
               'RequestedNewNodeId:' + str(self.RequestedNewNodeId) + ', ' + \
4437
               'BrowseName:' + str(self.BrowseName) + ', ' + \
4438
               'NodeClass:' + str(self.NodeClass) + ', ' + \
4439
               'NodeAttributes:' + str(self.NodeAttributes) + ', ' + \
4440
               'TypeDefinition:' + str(self.TypeDefinition) + ')'
4441 1
4442
    __repr__ = __str__
4443
4444 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
4445
class AddNodesResult(FrozenClass):
4446
    '''
4447
    A result of an add node operation.
4448
4449
    :ivar StatusCode:
4450
    :vartype StatusCode: StatusCode
4451
    :ivar AddedNodeId:
4452
    :vartype AddedNodeId: NodeId
4453 1
    '''
4454 1
    def __init__(self, binary=None):
4455 1
        if binary is not None:
4456 1
            self._binary_init(binary)
4457 1
            self._freeze = True
4458 1
            return
4459 1
        self.StatusCode = StatusCode()
4460 1
        self.AddedNodeId = NodeId()
4461
        self._freeze = True
4462 1
4463 1
    def to_binary(self):
4464 1
        packet = []
4465 1
        packet.append(self.StatusCode.to_binary())
4466 1
        packet.append(self.AddedNodeId.to_binary())
4467
        return b''.join(packet)
4468 1
4469
    @staticmethod
4470 1
    def from_binary(data):
4471
        return AddNodesResult(data)
4472 1
4473 1
    def _binary_init(self, data):
4474 1
        self.StatusCode = StatusCode.from_binary(data)
4475
        self.AddedNodeId = NodeId.from_binary(data)
4476 1
4477
    def __str__(self):
4478
        return 'AddNodesResult(' + 'StatusCode:' + str(self.StatusCode) + ', ' + \
4479
               'AddedNodeId:' + str(self.AddedNodeId) + ')'
4480 1
4481
    __repr__ = __str__
4482
4483 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
4484
class AddNodesParameters(FrozenClass):
4485
    '''
4486
    :ivar NodesToAdd:
4487
    :vartype NodesToAdd: AddNodesItem
4488 1
    '''
4489 1
    def __init__(self, binary=None):
4490 1
        if binary is not None:
4491 1
            self._binary_init(binary)
4492 1
            self._freeze = True
4493 1
            return
4494 1
        self.NodesToAdd = []
4495
        self._freeze = True
4496 1
4497 1
    def to_binary(self):
4498 1
        packet = []
4499 1
        packet.append(uatype_Int32.pack(len(self.NodesToAdd)))
4500 1
        for fieldname in self.NodesToAdd:
4501 1
            packet.append(fieldname.to_binary())
4502
        return b''.join(packet)
4503 1
4504
    @staticmethod
4505 1
    def from_binary(data):
4506
        return AddNodesParameters(data)
4507 1
4508 1
    def _binary_init(self, data):
4509 1
        length = uatype_Int32.unpack(data.read(4))[0]
4510 1
        array = []
4511 1
        if length != -1:
4512 1
            for _ in range(0, length):
4513 1
                array.append(AddNodesItem.from_binary(data))
4514
        self.NodesToAdd = array
4515 1
4516
    def __str__(self):
4517
        return 'AddNodesParameters(' + 'NodesToAdd:' + str(self.NodesToAdd) + ')'
4518 1
4519
    __repr__ = __str__
4520
4521 1
4522
class AddNodesRequest(FrozenClass):
4523
    '''
4524
    Adds one or more nodes to the server address space.
4525
4526
    :ivar TypeId:
4527
    :vartype TypeId: NodeId
4528
    :ivar RequestHeader:
4529
    :vartype RequestHeader: RequestHeader
4530
    :ivar Parameters:
4531
    :vartype Parameters: AddNodesParameters
4532 1
    '''
4533 1
    def __init__(self, binary=None):
4534
        if binary is not None:
4535
            self._binary_init(binary)
4536
            self._freeze = True
4537 1
            return
4538 1
        self.TypeId = FourByteNodeId(ObjectIds.AddNodesRequest_Encoding_DefaultBinary)
4539 1
        self.RequestHeader = RequestHeader()
4540 1
        self.Parameters = AddNodesParameters()
4541
        self._freeze = True
4542 1
4543 1
    def to_binary(self):
4544 1
        packet = []
4545 1
        packet.append(self.TypeId.to_binary())
4546 1
        packet.append(self.RequestHeader.to_binary())
4547 1
        packet.append(self.Parameters.to_binary())
4548
        return b''.join(packet)
4549 1
4550
    @staticmethod
4551
    def from_binary(data):
4552
        return AddNodesRequest(data)
4553 1
4554
    def _binary_init(self, data):
4555
        self.TypeId = NodeId.from_binary(data)
4556
        self.RequestHeader = RequestHeader.from_binary(data)
4557
        self.Parameters = AddNodesParameters.from_binary(data)
4558 1
4559
    def __str__(self):
4560
        return 'AddNodesRequest(' + 'TypeId:' + str(self.TypeId) + ', ' + \
4561
               'RequestHeader:' + str(self.RequestHeader) + ', ' + \
4562
               'Parameters:' + str(self.Parameters) + ')'
4563 1
4564
    __repr__ = __str__
4565
4566 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
4567
class AddNodesResponse(FrozenClass):
4568
    '''
4569
    Adds one or more nodes to the server address space.
4570
4571
    :ivar TypeId:
4572
    :vartype TypeId: NodeId
4573
    :ivar ResponseHeader:
4574
    :vartype ResponseHeader: ResponseHeader
4575
    :ivar Results:
4576
    :vartype Results: AddNodesResult
4577
    :ivar DiagnosticInfos:
4578
    :vartype DiagnosticInfos: DiagnosticInfo
4579 1
    '''
4580 1
    def __init__(self, binary=None):
4581 1
        if binary is not None:
4582 1
            self._binary_init(binary)
4583 1
            self._freeze = True
4584 1
            return
4585 1
        self.TypeId = FourByteNodeId(ObjectIds.AddNodesResponse_Encoding_DefaultBinary)
4586 1
        self.ResponseHeader = ResponseHeader()
4587 1
        self.Results = []
4588 1
        self.DiagnosticInfos = []
4589
        self._freeze = True
4590 1
4591 1
    def to_binary(self):
4592 1
        packet = []
4593 1
        packet.append(self.TypeId.to_binary())
4594 1
        packet.append(self.ResponseHeader.to_binary())
4595 1
        packet.append(uatype_Int32.pack(len(self.Results)))
4596 1
        for fieldname in self.Results:
4597 1
            packet.append(fieldname.to_binary())
4598 1
        packet.append(uatype_Int32.pack(len(self.DiagnosticInfos)))
4599
        for fieldname in self.DiagnosticInfos:
4600 1
            packet.append(fieldname.to_binary())
4601
        return b''.join(packet)
4602 1
4603
    @staticmethod
4604 1
    def from_binary(data):
4605
        return AddNodesResponse(data)
4606 1
4607 1
    def _binary_init(self, data):
4608 1
        self.TypeId = NodeId.from_binary(data)
4609 1
        self.ResponseHeader = ResponseHeader.from_binary(data)
4610 1
        length = uatype_Int32.unpack(data.read(4))[0]
4611 1
        array = []
4612 1
        if length != -1:
4613 1
            for _ in range(0, length):
4614 1
                array.append(AddNodesResult.from_binary(data))
4615 1
        self.Results = array
4616 1
        length = uatype_Int32.unpack(data.read(4))[0]
4617 1
        array = []
4618 1
        if length != -1:
4619
            for _ in range(0, length):
4620 1
                array.append(DiagnosticInfo.from_binary(data))
4621
        self.DiagnosticInfos = array
4622 1
4623
    def __str__(self):
4624
        return 'AddNodesResponse(' + 'TypeId:' + str(self.TypeId) + ', ' + \
4625
               'ResponseHeader:' + str(self.ResponseHeader) + ', ' + \
4626
               'Results:' + str(self.Results) + ', ' + \
4627
               'DiagnosticInfos:' + str(self.DiagnosticInfos) + ')'
4628 1
4629
    __repr__ = __str__
4630
4631 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
4632
class AddReferencesItem(FrozenClass):
4633
    '''
4634
    A request to add a reference to the server address space.
4635
4636
    :ivar SourceNodeId:
4637
    :vartype SourceNodeId: NodeId
4638
    :ivar ReferenceTypeId:
4639
    :vartype ReferenceTypeId: NodeId
4640
    :ivar IsForward:
4641
    :vartype IsForward: Boolean
4642
    :ivar TargetServerUri:
4643
    :vartype TargetServerUri: String
4644
    :ivar TargetNodeId:
4645
    :vartype TargetNodeId: ExpandedNodeId
4646
    :ivar TargetNodeClass:
4647
    :vartype TargetNodeClass: NodeClass
4648 1
    '''
4649 1
    def __init__(self, binary=None):
4650
        if binary is not None:
4651
            self._binary_init(binary)
4652
            self._freeze = True
4653 1
            return
4654 1
        self.SourceNodeId = NodeId()
4655 1
        self.ReferenceTypeId = NodeId()
4656 1
        self.IsForward = True
4657 1
        self.TargetServerUri = None
4658 1
        self.TargetNodeId = ExpandedNodeId()
4659 1
        self.TargetNodeClass = NodeClass(0)
4660
        self._freeze = True
4661 1
4662
    def to_binary(self):
4663
        packet = []
4664
        packet.append(self.SourceNodeId.to_binary())
4665
        packet.append(self.ReferenceTypeId.to_binary())
4666
        packet.append(uatype_Boolean.pack(self.IsForward))
4667
        packet.append(pack_string(self.TargetServerUri))
4668
        packet.append(self.TargetNodeId.to_binary())
4669
        packet.append(uatype_UInt32.pack(self.TargetNodeClass.value))
4670
        return b''.join(packet)
4671 1
4672
    @staticmethod
4673
    def from_binary(data):
4674
        return AddReferencesItem(data)
4675 1
4676
    def _binary_init(self, data):
4677
        self.SourceNodeId = NodeId.from_binary(data)
4678
        self.ReferenceTypeId = NodeId.from_binary(data)
4679
        self.IsForward = uatype_Boolean.unpack(data.read(1))[0]
4680
        self.TargetServerUri = unpack_string(data)
4681
        self.TargetNodeId = ExpandedNodeId.from_binary(data)
4682
        self.TargetNodeClass = NodeClass(uatype_UInt32.unpack(data.read(4))[0])
4683 1
4684
    def __str__(self):
4685
        return 'AddReferencesItem(' + 'SourceNodeId:' + str(self.SourceNodeId) + ', ' + \
4686
               'ReferenceTypeId:' + str(self.ReferenceTypeId) + ', ' + \
4687
               'IsForward:' + str(self.IsForward) + ', ' + \
4688
               'TargetServerUri:' + str(self.TargetServerUri) + ', ' + \
4689
               'TargetNodeId:' + str(self.TargetNodeId) + ', ' + \
4690
               'TargetNodeClass:' + str(self.TargetNodeClass) + ')'
4691 1
4692
    __repr__ = __str__
4693
4694 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
4695
class AddReferencesRequest(FrozenClass):
4696
    '''
4697
    Adds one or more references to the server address space.
4698
4699
    :ivar TypeId:
4700
    :vartype TypeId: NodeId
4701
    :ivar RequestHeader:
4702
    :vartype RequestHeader: RequestHeader
4703
    :ivar ReferencesToAdd:
4704
    :vartype ReferencesToAdd: AddReferencesItem
4705 1
    '''
4706
    def __init__(self, binary=None):
4707
        if binary is not None:
4708
            self._binary_init(binary)
4709
            self._freeze = True
4710
            return
4711
        self.TypeId = FourByteNodeId(ObjectIds.AddReferencesRequest_Encoding_DefaultBinary)
4712
        self.RequestHeader = RequestHeader()
4713
        self.ReferencesToAdd = []
4714
        self._freeze = True
4715 1
4716
    def to_binary(self):
4717
        packet = []
4718
        packet.append(self.TypeId.to_binary())
4719
        packet.append(self.RequestHeader.to_binary())
4720
        packet.append(uatype_Int32.pack(len(self.ReferencesToAdd)))
4721
        for fieldname in self.ReferencesToAdd:
4722
            packet.append(fieldname.to_binary())
4723
        return b''.join(packet)
4724 1
4725
    @staticmethod
4726
    def from_binary(data):
4727
        return AddReferencesRequest(data)
4728 1
4729
    def _binary_init(self, data):
4730
        self.TypeId = NodeId.from_binary(data)
4731
        self.RequestHeader = RequestHeader.from_binary(data)
4732
        length = uatype_Int32.unpack(data.read(4))[0]
4733
        array = []
4734
        if length != -1:
4735
            for _ in range(0, length):
4736
                array.append(AddReferencesItem.from_binary(data))
4737
        self.ReferencesToAdd = array
4738 1
4739
    def __str__(self):
4740
        return 'AddReferencesRequest(' + 'TypeId:' + str(self.TypeId) + ', ' + \
4741
               'RequestHeader:' + str(self.RequestHeader) + ', ' + \
4742
               'ReferencesToAdd:' + str(self.ReferencesToAdd) + ')'
4743 1
4744
    __repr__ = __str__
4745
4746 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
4747
class AddReferencesResponse(FrozenClass):
4748
    '''
4749
    Adds one or more references to the server address space.
4750
4751
    :ivar TypeId:
4752
    :vartype TypeId: NodeId
4753
    :ivar ResponseHeader:
4754
    :vartype ResponseHeader: ResponseHeader
4755
    :ivar Results:
4756
    :vartype Results: StatusCode
4757
    :ivar DiagnosticInfos:
4758
    :vartype DiagnosticInfos: DiagnosticInfo
4759 1
    '''
4760
    def __init__(self, binary=None):
4761
        if binary is not None:
4762
            self._binary_init(binary)
4763
            self._freeze = True
4764
            return
4765
        self.TypeId = FourByteNodeId(ObjectIds.AddReferencesResponse_Encoding_DefaultBinary)
4766
        self.ResponseHeader = ResponseHeader()
4767
        self.Results = []
4768
        self.DiagnosticInfos = []
4769
        self._freeze = True
4770 1
4771
    def to_binary(self):
4772
        packet = []
4773
        packet.append(self.TypeId.to_binary())
4774
        packet.append(self.ResponseHeader.to_binary())
4775
        packet.append(uatype_Int32.pack(len(self.Results)))
4776
        for fieldname in self.Results:
4777
            packet.append(fieldname.to_binary())
4778
        packet.append(uatype_Int32.pack(len(self.DiagnosticInfos)))
4779
        for fieldname in self.DiagnosticInfos:
4780
            packet.append(fieldname.to_binary())
4781
        return b''.join(packet)
4782 1
4783
    @staticmethod
4784
    def from_binary(data):
4785
        return AddReferencesResponse(data)
4786 1
4787
    def _binary_init(self, data):
4788
        self.TypeId = NodeId.from_binary(data)
4789
        self.ResponseHeader = ResponseHeader.from_binary(data)
4790
        length = uatype_Int32.unpack(data.read(4))[0]
4791
        array = []
4792
        if length != -1:
4793
            for _ in range(0, length):
4794
                array.append(StatusCode.from_binary(data))
4795
        self.Results = array
4796
        length = uatype_Int32.unpack(data.read(4))[0]
4797
        array = []
4798
        if length != -1:
4799
            for _ in range(0, length):
4800
                array.append(DiagnosticInfo.from_binary(data))
4801
        self.DiagnosticInfos = array
4802 1
4803
    def __str__(self):
4804
        return 'AddReferencesResponse(' + 'TypeId:' + str(self.TypeId) + ', ' + \
4805
               'ResponseHeader:' + str(self.ResponseHeader) + ', ' + \
4806
               'Results:' + str(self.Results) + ', ' + \
4807
               'DiagnosticInfos:' + str(self.DiagnosticInfos) + ')'
4808 1
4809
    __repr__ = __str__
4810
4811 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
4812
class DeleteNodesItem(FrozenClass):
4813
    '''
4814
    A request to delete a node to the server address space.
4815
4816
    :ivar NodeId:
4817
    :vartype NodeId: NodeId
4818
    :ivar DeleteTargetReferences:
4819
    :vartype DeleteTargetReferences: Boolean
4820 1
    '''
4821 1
    def __init__(self, binary=None):
4822 1
        if binary is not None:
4823 1
            self._binary_init(binary)
4824 1
            self._freeze = True
4825 1
            return
4826 1
        self.NodeId = NodeId()
4827 1
        self.DeleteTargetReferences = True
4828
        self._freeze = True
4829 1
4830 1
    def to_binary(self):
4831 1
        packet = []
4832 1
        packet.append(self.NodeId.to_binary())
4833 1
        packet.append(uatype_Boolean.pack(self.DeleteTargetReferences))
4834
        return b''.join(packet)
4835 1
4836
    @staticmethod
4837 1
    def from_binary(data):
4838
        return DeleteNodesItem(data)
4839 1
4840 1
    def _binary_init(self, data):
4841 1
        self.NodeId = NodeId.from_binary(data)
4842
        self.DeleteTargetReferences = uatype_Boolean.unpack(data.read(1))[0]
4843 1
4844
    def __str__(self):
4845
        return 'DeleteNodesItem(' + 'NodeId:' + str(self.NodeId) + ', ' + \
4846
               'DeleteTargetReferences:' + str(self.DeleteTargetReferences) + ')'
4847 1
4848
    __repr__ = __str__
4849
4850 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
4851
class DeleteNodesParameters(FrozenClass):
4852
    '''
4853
    :ivar NodesToDelete:
4854
    :vartype NodesToDelete: DeleteNodesItem
4855 1
    '''
4856 1
    def __init__(self, binary=None):
4857 1
        if binary is not None:
4858 1
            self._binary_init(binary)
4859 1
            self._freeze = True
4860 1
            return
4861 1
        self.NodesToDelete = []
4862
        self._freeze = True
4863 1
4864 1
    def to_binary(self):
4865 1
        packet = []
4866 1
        packet.append(uatype_Int32.pack(len(self.NodesToDelete)))
4867 1
        for fieldname in self.NodesToDelete:
4868 1
            packet.append(fieldname.to_binary())
4869
        return b''.join(packet)
4870 1
4871
    @staticmethod
4872 1
    def from_binary(data):
4873
        return DeleteNodesParameters(data)
4874 1
4875 1
    def _binary_init(self, data):
4876 1
        length = uatype_Int32.unpack(data.read(4))[0]
4877 1
        array = []
4878 1
        if length != -1:
4879 1
            for _ in range(0, length):
4880 1
                array.append(DeleteNodesItem.from_binary(data))
4881
        self.NodesToDelete = array
4882 1
4883
    def __str__(self):
4884
        return 'DeleteNodesParameters(' + 'NodesToDelete:' + str(self.NodesToDelete) + ')'
4885 1
4886
    __repr__ = __str__
4887
4888 1
4889
class DeleteNodesRequest(FrozenClass):
4890
    '''
4891
    Delete one or more nodes from the server address space.
4892
4893
    :ivar TypeId:
4894
    :vartype TypeId: NodeId
4895
    :ivar RequestHeader:
4896
    :vartype RequestHeader: RequestHeader
4897
    :ivar Parameters:
4898
    :vartype Parameters: DeleteNodesParameters
4899 1
    '''
4900 1
    def __init__(self, binary=None):
4901
        if binary is not None:
4902
            self._binary_init(binary)
4903
            self._freeze = True
4904 1
            return
4905 1
        self.TypeId = FourByteNodeId(ObjectIds.DeleteNodesRequest_Encoding_DefaultBinary)
4906 1
        self.RequestHeader = RequestHeader()
4907 1
        self.Parameters = DeleteNodesParameters()
4908
        self._freeze = True
4909 1
4910 1
    def to_binary(self):
4911 1
        packet = []
4912 1
        packet.append(self.TypeId.to_binary())
4913 1
        packet.append(self.RequestHeader.to_binary())
4914 1
        packet.append(self.Parameters.to_binary())
4915
        return b''.join(packet)
4916 1
4917
    @staticmethod
4918
    def from_binary(data):
4919
        return DeleteNodesRequest(data)
4920 1
4921
    def _binary_init(self, data):
4922
        self.TypeId = NodeId.from_binary(data)
4923
        self.RequestHeader = RequestHeader.from_binary(data)
4924
        self.Parameters = DeleteNodesParameters.from_binary(data)
4925 1
4926
    def __str__(self):
4927
        return 'DeleteNodesRequest(' + 'TypeId:' + str(self.TypeId) + ', ' + \
4928
               'RequestHeader:' + str(self.RequestHeader) + ', ' + \
4929
               'Parameters:' + str(self.Parameters) + ')'
4930 1
4931
    __repr__ = __str__
4932
4933 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
4934
class DeleteNodesResponse(FrozenClass):
4935
    '''
4936
    Delete one or more nodes from the server address space.
4937
4938
    :ivar TypeId:
4939
    :vartype TypeId: NodeId
4940
    :ivar ResponseHeader:
4941
    :vartype ResponseHeader: ResponseHeader
4942
    :ivar Results:
4943
    :vartype Results: StatusCode
4944
    :ivar DiagnosticInfos:
4945
    :vartype DiagnosticInfos: DiagnosticInfo
4946 1
    '''
4947 1
    def __init__(self, binary=None):
4948 1
        if binary is not None:
4949 1
            self._binary_init(binary)
4950 1
            self._freeze = True
4951 1
            return
4952 1
        self.TypeId = FourByteNodeId(ObjectIds.DeleteNodesResponse_Encoding_DefaultBinary)
4953 1
        self.ResponseHeader = ResponseHeader()
4954 1
        self.Results = []
4955 1
        self.DiagnosticInfos = []
4956
        self._freeze = True
4957 1
4958 1
    def to_binary(self):
4959 1
        packet = []
4960 1
        packet.append(self.TypeId.to_binary())
4961 1
        packet.append(self.ResponseHeader.to_binary())
4962 1
        packet.append(uatype_Int32.pack(len(self.Results)))
4963 1
        for fieldname in self.Results:
4964 1
            packet.append(fieldname.to_binary())
4965 1
        packet.append(uatype_Int32.pack(len(self.DiagnosticInfos)))
4966
        for fieldname in self.DiagnosticInfos:
4967 1
            packet.append(fieldname.to_binary())
4968
        return b''.join(packet)
4969 1
4970
    @staticmethod
4971 1
    def from_binary(data):
4972
        return DeleteNodesResponse(data)
4973 1
4974 1
    def _binary_init(self, data):
4975 1
        self.TypeId = NodeId.from_binary(data)
4976 1
        self.ResponseHeader = ResponseHeader.from_binary(data)
4977 1
        length = uatype_Int32.unpack(data.read(4))[0]
4978 1
        array = []
4979 1
        if length != -1:
4980 1
            for _ in range(0, length):
4981 1
                array.append(StatusCode.from_binary(data))
4982 1
        self.Results = array
4983 1
        length = uatype_Int32.unpack(data.read(4))[0]
4984 1
        array = []
4985 1
        if length != -1:
4986
            for _ in range(0, length):
4987 1
                array.append(DiagnosticInfo.from_binary(data))
4988
        self.DiagnosticInfos = array
4989 1
4990
    def __str__(self):
4991
        return 'DeleteNodesResponse(' + 'TypeId:' + str(self.TypeId) + ', ' + \
4992
               'ResponseHeader:' + str(self.ResponseHeader) + ', ' + \
4993
               'Results:' + str(self.Results) + ', ' + \
4994
               'DiagnosticInfos:' + str(self.DiagnosticInfos) + ')'
4995 1
4996
    __repr__ = __str__
4997
4998 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
4999
class DeleteReferencesItem(FrozenClass):
5000
    '''
5001
    A request to delete a node from the server address space.
5002
5003
    :ivar SourceNodeId:
5004
    :vartype SourceNodeId: NodeId
5005
    :ivar ReferenceTypeId:
5006
    :vartype ReferenceTypeId: NodeId
5007
    :ivar IsForward:
5008
    :vartype IsForward: Boolean
5009
    :ivar TargetNodeId:
5010
    :vartype TargetNodeId: ExpandedNodeId
5011
    :ivar DeleteBidirectional:
5012
    :vartype DeleteBidirectional: Boolean
5013 1
    '''
5014
    def __init__(self, binary=None):
5015
        if binary is not None:
5016
            self._binary_init(binary)
5017
            self._freeze = True
5018
            return
5019
        self.SourceNodeId = NodeId()
5020
        self.ReferenceTypeId = NodeId()
5021
        self.IsForward = True
5022
        self.TargetNodeId = ExpandedNodeId()
5023
        self.DeleteBidirectional = True
5024
        self._freeze = True
5025 1
5026
    def to_binary(self):
5027
        packet = []
5028
        packet.append(self.SourceNodeId.to_binary())
5029
        packet.append(self.ReferenceTypeId.to_binary())
5030
        packet.append(uatype_Boolean.pack(self.IsForward))
5031
        packet.append(self.TargetNodeId.to_binary())
5032
        packet.append(uatype_Boolean.pack(self.DeleteBidirectional))
5033
        return b''.join(packet)
5034 1
5035
    @staticmethod
5036
    def from_binary(data):
5037
        return DeleteReferencesItem(data)
5038 1
5039
    def _binary_init(self, data):
5040
        self.SourceNodeId = NodeId.from_binary(data)
5041
        self.ReferenceTypeId = NodeId.from_binary(data)
5042
        self.IsForward = uatype_Boolean.unpack(data.read(1))[0]
5043
        self.TargetNodeId = ExpandedNodeId.from_binary(data)
5044
        self.DeleteBidirectional = uatype_Boolean.unpack(data.read(1))[0]
5045 1
5046
    def __str__(self):
5047
        return 'DeleteReferencesItem(' + 'SourceNodeId:' + str(self.SourceNodeId) + ', ' + \
5048
               'ReferenceTypeId:' + str(self.ReferenceTypeId) + ', ' + \
5049
               'IsForward:' + str(self.IsForward) + ', ' + \
5050
               'TargetNodeId:' + str(self.TargetNodeId) + ', ' + \
5051
               'DeleteBidirectional:' + str(self.DeleteBidirectional) + ')'
5052 1
5053
    __repr__ = __str__
5054
5055 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
5056
class DeleteReferencesParameters(FrozenClass):
5057
    '''
5058
    :ivar ReferencesToDelete:
5059
    :vartype ReferencesToDelete: DeleteReferencesItem
5060 1
    '''
5061
    def __init__(self, binary=None):
5062
        if binary is not None:
5063
            self._binary_init(binary)
5064
            self._freeze = True
5065
            return
5066
        self.ReferencesToDelete = []
5067
        self._freeze = True
5068 1
5069
    def to_binary(self):
5070
        packet = []
5071
        packet.append(uatype_Int32.pack(len(self.ReferencesToDelete)))
5072
        for fieldname in self.ReferencesToDelete:
5073
            packet.append(fieldname.to_binary())
5074
        return b''.join(packet)
5075 1
5076
    @staticmethod
5077
    def from_binary(data):
5078
        return DeleteReferencesParameters(data)
5079 1
5080
    def _binary_init(self, data):
5081
        length = uatype_Int32.unpack(data.read(4))[0]
5082
        array = []
5083
        if length != -1:
5084
            for _ in range(0, length):
5085
                array.append(DeleteReferencesItem.from_binary(data))
5086
        self.ReferencesToDelete = array
5087 1
5088
    def __str__(self):
5089
        return 'DeleteReferencesParameters(' + 'ReferencesToDelete:' + str(self.ReferencesToDelete) + ')'
5090 1
5091
    __repr__ = __str__
5092
5093 1
5094
class DeleteReferencesRequest(FrozenClass):
5095
    '''
5096
    Delete one or more references from the server address space.
5097
5098
    :ivar TypeId:
5099
    :vartype TypeId: NodeId
5100
    :ivar RequestHeader:
5101
    :vartype RequestHeader: RequestHeader
5102
    :ivar Parameters:
5103
    :vartype Parameters: DeleteReferencesParameters
5104 1
    '''
5105
    def __init__(self, binary=None):
5106
        if binary is not None:
5107
            self._binary_init(binary)
5108
            self._freeze = True
5109
            return
5110
        self.TypeId = FourByteNodeId(ObjectIds.DeleteReferencesRequest_Encoding_DefaultBinary)
5111
        self.RequestHeader = RequestHeader()
5112
        self.Parameters = DeleteReferencesParameters()
5113
        self._freeze = True
5114 1
5115
    def to_binary(self):
5116
        packet = []
5117
        packet.append(self.TypeId.to_binary())
5118
        packet.append(self.RequestHeader.to_binary())
5119
        packet.append(self.Parameters.to_binary())
5120
        return b''.join(packet)
5121 1
5122
    @staticmethod
5123
    def from_binary(data):
5124
        return DeleteReferencesRequest(data)
5125 1
5126
    def _binary_init(self, data):
5127
        self.TypeId = NodeId.from_binary(data)
5128
        self.RequestHeader = RequestHeader.from_binary(data)
5129
        self.Parameters = DeleteReferencesParameters.from_binary(data)
5130 1
5131
    def __str__(self):
5132
        return 'DeleteReferencesRequest(' + 'TypeId:' + str(self.TypeId) + ', ' + \
5133
               'RequestHeader:' + str(self.RequestHeader) + ', ' + \
5134
               'Parameters:' + str(self.Parameters) + ')'
5135 1
5136
    __repr__ = __str__
5137
5138 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
5139
class DeleteReferencesResult(FrozenClass):
5140
    '''
5141
    :ivar Results:
5142
    :vartype Results: StatusCode
5143
    :ivar DiagnosticInfos:
5144
    :vartype DiagnosticInfos: DiagnosticInfo
5145 1
    '''
5146
    def __init__(self, binary=None):
5147
        if binary is not None:
5148
            self._binary_init(binary)
5149
            self._freeze = True
5150
            return
5151
        self.Results = []
5152
        self.DiagnosticInfos = []
5153
        self._freeze = True
5154 1
5155
    def to_binary(self):
5156
        packet = []
5157
        packet.append(uatype_Int32.pack(len(self.Results)))
5158
        for fieldname in self.Results:
5159
            packet.append(fieldname.to_binary())
5160
        packet.append(uatype_Int32.pack(len(self.DiagnosticInfos)))
5161
        for fieldname in self.DiagnosticInfos:
5162
            packet.append(fieldname.to_binary())
5163
        return b''.join(packet)
5164 1
5165
    @staticmethod
5166
    def from_binary(data):
5167
        return DeleteReferencesResult(data)
5168 1
5169
    def _binary_init(self, data):
5170
        length = uatype_Int32.unpack(data.read(4))[0]
5171
        array = []
5172
        if length != -1:
5173
            for _ in range(0, length):
5174
                array.append(StatusCode.from_binary(data))
5175
        self.Results = array
5176
        length = uatype_Int32.unpack(data.read(4))[0]
5177
        array = []
5178
        if length != -1:
5179
            for _ in range(0, length):
5180
                array.append(DiagnosticInfo.from_binary(data))
5181
        self.DiagnosticInfos = array
5182 1
5183
    def __str__(self):
5184
        return 'DeleteReferencesResult(' + 'Results:' + str(self.Results) + ', ' + \
5185
               'DiagnosticInfos:' + str(self.DiagnosticInfos) + ')'
5186 1
5187
    __repr__ = __str__
5188
5189 1
5190
class DeleteReferencesResponse(FrozenClass):
5191
    '''
5192
    Delete one or more references from the server address space.
5193
5194
    :ivar TypeId:
5195
    :vartype TypeId: NodeId
5196
    :ivar ResponseHeader:
5197
    :vartype ResponseHeader: ResponseHeader
5198
    :ivar Parameters:
5199
    :vartype Parameters: DeleteReferencesResult
5200 1
    '''
5201
    def __init__(self, binary=None):
5202
        if binary is not None:
5203
            self._binary_init(binary)
5204
            self._freeze = True
5205
            return
5206
        self.TypeId = FourByteNodeId(ObjectIds.DeleteReferencesResponse_Encoding_DefaultBinary)
5207
        self.ResponseHeader = ResponseHeader()
5208
        self.Parameters = DeleteReferencesResult()
5209
        self._freeze = True
5210 1
5211
    def to_binary(self):
5212
        packet = []
5213
        packet.append(self.TypeId.to_binary())
5214
        packet.append(self.ResponseHeader.to_binary())
5215
        packet.append(self.Parameters.to_binary())
5216
        return b''.join(packet)
5217 1
5218
    @staticmethod
5219
    def from_binary(data):
5220
        return DeleteReferencesResponse(data)
5221 1
5222
    def _binary_init(self, data):
5223
        self.TypeId = NodeId.from_binary(data)
5224
        self.ResponseHeader = ResponseHeader.from_binary(data)
5225
        self.Parameters = DeleteReferencesResult.from_binary(data)
5226 1
5227
    def __str__(self):
5228
        return 'DeleteReferencesResponse(' + 'TypeId:' + str(self.TypeId) + ', ' + \
5229
               'ResponseHeader:' + str(self.ResponseHeader) + ', ' + \
5230
               'Parameters:' + str(self.Parameters) + ')'
5231 1
5232
    __repr__ = __str__
5233
5234 1
5235
class ViewDescription(FrozenClass):
5236
    '''
5237
    The view to browse.
5238
5239
    :ivar ViewId:
5240
    :vartype ViewId: NodeId
5241
    :ivar Timestamp:
5242
    :vartype Timestamp: DateTime
5243
    :ivar ViewVersion:
5244
    :vartype ViewVersion: UInt32
5245 1
    '''
5246 1
    def __init__(self, binary=None):
5247 1
        if binary is not None:
5248 1
            self._binary_init(binary)
5249 1
            self._freeze = True
5250 1
            return
5251 1
        self.ViewId = NodeId()
5252 1
        self.Timestamp = datetime.now()
5253 1
        self.ViewVersion = 0
5254
        self._freeze = True
5255 1
5256 1
    def to_binary(self):
5257 1
        packet = []
5258 1
        packet.append(self.ViewId.to_binary())
5259 1
        packet.append(pack_datetime(self.Timestamp))
5260 1
        packet.append(uatype_UInt32.pack(self.ViewVersion))
5261
        return b''.join(packet)
5262 1
5263
    @staticmethod
5264 1
    def from_binary(data):
5265
        return ViewDescription(data)
5266 1
5267 1
    def _binary_init(self, data):
5268 1
        self.ViewId = NodeId.from_binary(data)
5269 1
        self.Timestamp = unpack_datetime(data)
5270
        self.ViewVersion = uatype_UInt32.unpack(data.read(4))[0]
5271 1
5272
    def __str__(self):
5273
        return 'ViewDescription(' + 'ViewId:' + str(self.ViewId) + ', ' + \
5274
               'Timestamp:' + str(self.Timestamp) + ', ' + \
5275
               'ViewVersion:' + str(self.ViewVersion) + ')'
5276 1
5277
    __repr__ = __str__
5278
5279 1
5280
class BrowseDescription(FrozenClass):
5281
    '''
5282
    A request to browse the the references from a node.
5283
5284
    :ivar NodeId:
5285
    :vartype NodeId: NodeId
5286
    :ivar BrowseDirection:
5287
    :vartype BrowseDirection: BrowseDirection
5288
    :ivar ReferenceTypeId:
5289
    :vartype ReferenceTypeId: NodeId
5290
    :ivar IncludeSubtypes:
5291
    :vartype IncludeSubtypes: Boolean
5292
    :ivar NodeClassMask:
5293
    :vartype NodeClassMask: UInt32
5294
    :ivar ResultMask:
5295
    :vartype ResultMask: UInt32
5296 1
    '''
5297 1
    def __init__(self, binary=None):
5298 1
        if binary is not None:
5299 1
            self._binary_init(binary)
5300 1
            self._freeze = True
5301 1
            return
5302 1
        self.NodeId = NodeId()
5303 1
        self.BrowseDirection = BrowseDirection(0)
5304 1
        self.ReferenceTypeId = NodeId()
5305 1
        self.IncludeSubtypes = True
5306 1
        self.NodeClassMask = 0
5307 1
        self.ResultMask = 0
5308
        self._freeze = True
5309 1
5310 1
    def to_binary(self):
5311 1
        packet = []
5312 1
        packet.append(self.NodeId.to_binary())
5313 1
        packet.append(uatype_UInt32.pack(self.BrowseDirection.value))
5314 1
        packet.append(self.ReferenceTypeId.to_binary())
5315 1
        packet.append(uatype_Boolean.pack(self.IncludeSubtypes))
5316 1
        packet.append(uatype_UInt32.pack(self.NodeClassMask))
5317 1
        packet.append(uatype_UInt32.pack(self.ResultMask))
5318
        return b''.join(packet)
5319 1
5320
    @staticmethod
5321 1
    def from_binary(data):
5322
        return BrowseDescription(data)
5323 1
5324 1
    def _binary_init(self, data):
5325 1
        self.NodeId = NodeId.from_binary(data)
5326 1
        self.BrowseDirection = BrowseDirection(uatype_UInt32.unpack(data.read(4))[0])
5327 1
        self.ReferenceTypeId = NodeId.from_binary(data)
5328 1
        self.IncludeSubtypes = uatype_Boolean.unpack(data.read(1))[0]
5329 1
        self.NodeClassMask = uatype_UInt32.unpack(data.read(4))[0]
5330
        self.ResultMask = uatype_UInt32.unpack(data.read(4))[0]
5331 1
5332
    def __str__(self):
5333
        return 'BrowseDescription(' + 'NodeId:' + str(self.NodeId) + ', ' + \
5334
               'BrowseDirection:' + str(self.BrowseDirection) + ', ' + \
5335
               'ReferenceTypeId:' + str(self.ReferenceTypeId) + ', ' + \
5336
               'IncludeSubtypes:' + str(self.IncludeSubtypes) + ', ' + \
5337
               'NodeClassMask:' + str(self.NodeClassMask) + ', ' + \
5338
               'ResultMask:' + str(self.ResultMask) + ')'
5339 1
5340
    __repr__ = __str__
5341
5342 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
5343
class ReferenceDescription(FrozenClass):
5344
    '''
5345
    The description of a reference.
5346
5347
    :ivar ReferenceTypeId:
5348
    :vartype ReferenceTypeId: NodeId
5349
    :ivar IsForward:
5350
    :vartype IsForward: Boolean
5351
    :ivar NodeId:
5352
    :vartype NodeId: ExpandedNodeId
5353
    :ivar BrowseName:
5354
    :vartype BrowseName: QualifiedName
5355
    :ivar DisplayName:
5356
    :vartype DisplayName: LocalizedText
5357
    :ivar NodeClass:
5358
    :vartype NodeClass: NodeClass
5359
    :ivar TypeDefinition:
5360
    :vartype TypeDefinition: ExpandedNodeId
5361 1
    '''
5362 1
    def __init__(self, binary=None):
5363 1
        if binary is not None:
5364 1
            self._binary_init(binary)
5365 1
            self._freeze = True
5366 1
            return
5367 1
        self.ReferenceTypeId = NodeId()
5368 1
        self.IsForward = True
5369 1
        self.NodeId = ExpandedNodeId()
5370 1
        self.BrowseName = QualifiedName()
5371 1
        self.DisplayName = LocalizedText()
5372 1
        self.NodeClass = NodeClass(0)
5373 1
        self.TypeDefinition = ExpandedNodeId()
5374
        self._freeze = True
5375 1
5376 1
    def to_binary(self):
5377 1
        packet = []
5378 1
        packet.append(self.ReferenceTypeId.to_binary())
5379 1
        packet.append(uatype_Boolean.pack(self.IsForward))
5380 1
        packet.append(self.NodeId.to_binary())
5381 1
        packet.append(self.BrowseName.to_binary())
5382 1
        packet.append(self.DisplayName.to_binary())
5383 1
        packet.append(uatype_UInt32.pack(self.NodeClass.value))
5384 1
        packet.append(self.TypeDefinition.to_binary())
5385
        return b''.join(packet)
5386 1
5387
    @staticmethod
5388 1
    def from_binary(data):
5389
        return ReferenceDescription(data)
5390 1
5391 1
    def _binary_init(self, data):
5392 1
        self.ReferenceTypeId = NodeId.from_binary(data)
5393 1
        self.IsForward = uatype_Boolean.unpack(data.read(1))[0]
5394 1
        self.NodeId = ExpandedNodeId.from_binary(data)
5395 1
        self.BrowseName = QualifiedName.from_binary(data)
5396 1
        self.DisplayName = LocalizedText.from_binary(data)
5397 1
        self.NodeClass = NodeClass(uatype_UInt32.unpack(data.read(4))[0])
5398
        self.TypeDefinition = ExpandedNodeId.from_binary(data)
5399 1
5400
    def __str__(self):
5401
        return 'ReferenceDescription(' + 'ReferenceTypeId:' + str(self.ReferenceTypeId) + ', ' + \
5402
               'IsForward:' + str(self.IsForward) + ', ' + \
5403
               'NodeId:' + str(self.NodeId) + ', ' + \
5404
               'BrowseName:' + str(self.BrowseName) + ', ' + \
5405
               'DisplayName:' + str(self.DisplayName) + ', ' + \
5406
               'NodeClass:' + str(self.NodeClass) + ', ' + \
5407
               'TypeDefinition:' + str(self.TypeDefinition) + ')'
5408 1
5409
    __repr__ = __str__
5410
5411 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
5412
class BrowseResult(FrozenClass):
5413
    '''
5414
    The result of a browse operation.
5415
5416
    :ivar StatusCode:
5417
    :vartype StatusCode: StatusCode
5418
    :ivar ContinuationPoint:
5419
    :vartype ContinuationPoint: ByteString
5420
    :ivar References:
5421
    :vartype References: ReferenceDescription
5422 1
    '''
5423 1
    def __init__(self, binary=None):
5424 1
        if binary is not None:
5425 1
            self._binary_init(binary)
5426 1
            self._freeze = True
5427 1
            return
5428 1
        self.StatusCode = StatusCode()
5429 1
        self.ContinuationPoint = None
5430 1
        self.References = []
5431
        self._freeze = True
5432 1
5433 1
    def to_binary(self):
5434 1
        packet = []
5435 1
        packet.append(self.StatusCode.to_binary())
5436 1
        packet.append(pack_bytes(self.ContinuationPoint))
5437 1
        packet.append(uatype_Int32.pack(len(self.References)))
5438 1
        for fieldname in self.References:
5439 1
            packet.append(fieldname.to_binary())
5440
        return b''.join(packet)
5441 1
5442
    @staticmethod
5443 1
    def from_binary(data):
5444
        return BrowseResult(data)
5445 1
5446 1
    def _binary_init(self, data):
5447 1
        self.StatusCode = StatusCode.from_binary(data)
5448 1
        self.ContinuationPoint = unpack_bytes(data)
5449 1
        length = uatype_Int32.unpack(data.read(4))[0]
5450 1
        array = []
5451 1
        if length != -1:
5452 1
            for _ in range(0, length):
5453 1
                array.append(ReferenceDescription.from_binary(data))
5454
        self.References = array
5455 1
5456
    def __str__(self):
5457
        return 'BrowseResult(' + 'StatusCode:' + str(self.StatusCode) + ', ' + \
5458
               'ContinuationPoint:' + str(self.ContinuationPoint) + ', ' + \
5459
               'References:' + str(self.References) + ')'
5460 1
5461
    __repr__ = __str__
5462
5463 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
5464
class BrowseParameters(FrozenClass):
5465
    '''
5466
    :ivar View:
5467
    :vartype View: ViewDescription
5468
    :ivar RequestedMaxReferencesPerNode:
5469
    :vartype RequestedMaxReferencesPerNode: UInt32
5470
    :ivar NodesToBrowse:
5471
    :vartype NodesToBrowse: BrowseDescription
5472 1
    '''
5473 1
    def __init__(self, binary=None):
5474 1
        if binary is not None:
5475 1
            self._binary_init(binary)
5476 1
            self._freeze = True
5477 1
            return
5478 1
        self.View = ViewDescription()
5479 1
        self.RequestedMaxReferencesPerNode = 0
5480 1
        self.NodesToBrowse = []
5481
        self._freeze = True
5482 1
5483 1
    def to_binary(self):
5484 1
        packet = []
5485 1
        packet.append(self.View.to_binary())
5486 1
        packet.append(uatype_UInt32.pack(self.RequestedMaxReferencesPerNode))
5487 1
        packet.append(uatype_Int32.pack(len(self.NodesToBrowse)))
5488 1
        for fieldname in self.NodesToBrowse:
5489 1
            packet.append(fieldname.to_binary())
5490
        return b''.join(packet)
5491 1
5492
    @staticmethod
5493 1
    def from_binary(data):
5494
        return BrowseParameters(data)
5495 1
5496 1
    def _binary_init(self, data):
5497 1
        self.View = ViewDescription.from_binary(data)
5498 1
        self.RequestedMaxReferencesPerNode = uatype_UInt32.unpack(data.read(4))[0]
5499 1
        length = uatype_Int32.unpack(data.read(4))[0]
5500 1
        array = []
5501 1
        if length != -1:
5502 1
            for _ in range(0, length):
5503 1
                array.append(BrowseDescription.from_binary(data))
5504
        self.NodesToBrowse = array
5505 1
5506
    def __str__(self):
5507
        return 'BrowseParameters(' + 'View:' + str(self.View) + ', ' + \
5508
               'RequestedMaxReferencesPerNode:' + str(self.RequestedMaxReferencesPerNode) + ', ' + \
5509
               'NodesToBrowse:' + str(self.NodesToBrowse) + ')'
5510 1
5511
    __repr__ = __str__
5512
5513 1
5514
class BrowseRequest(FrozenClass):
5515
    '''
5516
    Browse the references for one or more nodes from the server address space.
5517
5518
    :ivar TypeId:
5519
    :vartype TypeId: NodeId
5520
    :ivar RequestHeader:
5521
    :vartype RequestHeader: RequestHeader
5522
    :ivar Parameters:
5523
    :vartype Parameters: BrowseParameters
5524 1
    '''
5525 1
    def __init__(self, binary=None):
5526
        if binary is not None:
5527
            self._binary_init(binary)
5528
            self._freeze = True
5529 1
            return
5530 1
        self.TypeId = FourByteNodeId(ObjectIds.BrowseRequest_Encoding_DefaultBinary)
5531 1
        self.RequestHeader = RequestHeader()
5532 1
        self.Parameters = BrowseParameters()
5533
        self._freeze = True
5534 1
5535 1
    def to_binary(self):
5536 1
        packet = []
5537 1
        packet.append(self.TypeId.to_binary())
5538 1
        packet.append(self.RequestHeader.to_binary())
5539 1
        packet.append(self.Parameters.to_binary())
5540
        return b''.join(packet)
5541 1
5542
    @staticmethod
5543
    def from_binary(data):
5544
        return BrowseRequest(data)
5545 1
5546
    def _binary_init(self, data):
5547
        self.TypeId = NodeId.from_binary(data)
5548
        self.RequestHeader = RequestHeader.from_binary(data)
5549
        self.Parameters = BrowseParameters.from_binary(data)
5550 1
5551
    def __str__(self):
5552
        return 'BrowseRequest(' + 'TypeId:' + str(self.TypeId) + ', ' + \
5553
               'RequestHeader:' + str(self.RequestHeader) + ', ' + \
5554
               'Parameters:' + str(self.Parameters) + ')'
5555 1
5556
    __repr__ = __str__
5557
5558 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
5559
class BrowseResponse(FrozenClass):
5560
    '''
5561
    Browse the references for one or more nodes from the server address space.
5562
5563
    :ivar TypeId:
5564
    :vartype TypeId: NodeId
5565
    :ivar ResponseHeader:
5566
    :vartype ResponseHeader: ResponseHeader
5567
    :ivar Results:
5568
    :vartype Results: BrowseResult
5569
    :ivar DiagnosticInfos:
5570
    :vartype DiagnosticInfos: DiagnosticInfo
5571 1
    '''
5572 1
    def __init__(self, binary=None):
5573 1
        if binary is not None:
5574 1
            self._binary_init(binary)
5575 1
            self._freeze = True
5576 1
            return
5577 1
        self.TypeId = FourByteNodeId(ObjectIds.BrowseResponse_Encoding_DefaultBinary)
5578 1
        self.ResponseHeader = ResponseHeader()
5579 1
        self.Results = []
5580 1
        self.DiagnosticInfos = []
5581
        self._freeze = True
5582 1
5583 1
    def to_binary(self):
5584 1
        packet = []
5585 1
        packet.append(self.TypeId.to_binary())
5586 1
        packet.append(self.ResponseHeader.to_binary())
5587 1
        packet.append(uatype_Int32.pack(len(self.Results)))
5588 1
        for fieldname in self.Results:
5589 1
            packet.append(fieldname.to_binary())
5590 1
        packet.append(uatype_Int32.pack(len(self.DiagnosticInfos)))
5591
        for fieldname in self.DiagnosticInfos:
5592 1
            packet.append(fieldname.to_binary())
5593
        return b''.join(packet)
5594 1
5595
    @staticmethod
5596 1
    def from_binary(data):
5597
        return BrowseResponse(data)
5598 1
5599 1
    def _binary_init(self, data):
5600 1
        self.TypeId = NodeId.from_binary(data)
5601 1
        self.ResponseHeader = ResponseHeader.from_binary(data)
5602 1
        length = uatype_Int32.unpack(data.read(4))[0]
5603 1
        array = []
5604 1
        if length != -1:
5605 1
            for _ in range(0, length):
5606 1
                array.append(BrowseResult.from_binary(data))
5607 1
        self.Results = array
5608 1
        length = uatype_Int32.unpack(data.read(4))[0]
5609 1
        array = []
5610 1
        if length != -1:
5611
            for _ in range(0, length):
5612 1
                array.append(DiagnosticInfo.from_binary(data))
5613
        self.DiagnosticInfos = array
5614 1
5615
    def __str__(self):
5616
        return 'BrowseResponse(' + 'TypeId:' + str(self.TypeId) + ', ' + \
5617
               'ResponseHeader:' + str(self.ResponseHeader) + ', ' + \
5618
               'Results:' + str(self.Results) + ', ' + \
5619
               'DiagnosticInfos:' + str(self.DiagnosticInfos) + ')'
5620 1
5621
    __repr__ = __str__
5622
5623 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
5624
class BrowseNextParameters(FrozenClass):
5625
    '''
5626
    :ivar ReleaseContinuationPoints:
5627
    :vartype ReleaseContinuationPoints: Boolean
5628
    :ivar ContinuationPoints:
5629
    :vartype ContinuationPoints: ByteString
5630 1
    '''
5631
    def __init__(self, binary=None):
5632
        if binary is not None:
5633
            self._binary_init(binary)
5634
            self._freeze = True
5635
            return
5636
        self.ReleaseContinuationPoints = True
5637
        self.ContinuationPoints = []
5638
        self._freeze = True
5639 1
5640
    def to_binary(self):
5641
        packet = []
5642
        packet.append(uatype_Boolean.pack(self.ReleaseContinuationPoints))
5643
        packet.append(uatype_Int32.pack(len(self.ContinuationPoints)))
5644
        for fieldname in self.ContinuationPoints:
5645
            packet.append(pack_bytes(fieldname))
5646
        return b''.join(packet)
5647 1
5648
    @staticmethod
5649
    def from_binary(data):
5650
        return BrowseNextParameters(data)
5651 1
5652
    def _binary_init(self, data):
5653
        self.ReleaseContinuationPoints = uatype_Boolean.unpack(data.read(1))[0]
5654
        self.ContinuationPoints = unpack_uatype_array('ByteString', data)
5655 1
5656
    def __str__(self):
5657
        return 'BrowseNextParameters(' + 'ReleaseContinuationPoints:' + str(self.ReleaseContinuationPoints) + ', ' + \
5658
               'ContinuationPoints:' + str(self.ContinuationPoints) + ')'
5659 1
5660
    __repr__ = __str__
5661
5662 1
5663
class BrowseNextRequest(FrozenClass):
5664
    '''
5665
    Continues one or more browse operations.
5666
5667
    :ivar TypeId:
5668
    :vartype TypeId: NodeId
5669
    :ivar RequestHeader:
5670
    :vartype RequestHeader: RequestHeader
5671
    :ivar Parameters:
5672
    :vartype Parameters: BrowseNextParameters
5673 1
    '''
5674
    def __init__(self, binary=None):
5675
        if binary is not None:
5676
            self._binary_init(binary)
5677
            self._freeze = True
5678
            return
5679
        self.TypeId = FourByteNodeId(ObjectIds.BrowseNextRequest_Encoding_DefaultBinary)
5680
        self.RequestHeader = RequestHeader()
5681
        self.Parameters = BrowseNextParameters()
5682
        self._freeze = True
5683 1
5684
    def to_binary(self):
5685
        packet = []
5686
        packet.append(self.TypeId.to_binary())
5687
        packet.append(self.RequestHeader.to_binary())
5688
        packet.append(self.Parameters.to_binary())
5689
        return b''.join(packet)
5690 1
5691
    @staticmethod
5692
    def from_binary(data):
5693
        return BrowseNextRequest(data)
5694 1
5695
    def _binary_init(self, data):
5696
        self.TypeId = NodeId.from_binary(data)
5697
        self.RequestHeader = RequestHeader.from_binary(data)
5698
        self.Parameters = BrowseNextParameters.from_binary(data)
5699 1
5700
    def __str__(self):
5701
        return 'BrowseNextRequest(' + 'TypeId:' + str(self.TypeId) + ', ' + \
5702
               'RequestHeader:' + str(self.RequestHeader) + ', ' + \
5703
               'Parameters:' + str(self.Parameters) + ')'
5704 1
5705
    __repr__ = __str__
5706
5707 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
5708
class BrowseNextResult(FrozenClass):
5709
    '''
5710
    :ivar Results:
5711
    :vartype Results: BrowseResult
5712
    :ivar DiagnosticInfos:
5713
    :vartype DiagnosticInfos: DiagnosticInfo
5714 1
    '''
5715
    def __init__(self, binary=None):
5716
        if binary is not None:
5717
            self._binary_init(binary)
5718
            self._freeze = True
5719
            return
5720
        self.Results = []
5721
        self.DiagnosticInfos = []
5722
        self._freeze = True
5723 1
5724
    def to_binary(self):
5725
        packet = []
5726
        packet.append(uatype_Int32.pack(len(self.Results)))
5727
        for fieldname in self.Results:
5728
            packet.append(fieldname.to_binary())
5729
        packet.append(uatype_Int32.pack(len(self.DiagnosticInfos)))
5730
        for fieldname in self.DiagnosticInfos:
5731
            packet.append(fieldname.to_binary())
5732
        return b''.join(packet)
5733 1
5734
    @staticmethod
5735
    def from_binary(data):
5736
        return BrowseNextResult(data)
5737 1
5738
    def _binary_init(self, data):
5739
        length = uatype_Int32.unpack(data.read(4))[0]
5740
        array = []
5741
        if length != -1:
5742
            for _ in range(0, length):
5743
                array.append(BrowseResult.from_binary(data))
5744
        self.Results = array
5745
        length = uatype_Int32.unpack(data.read(4))[0]
5746
        array = []
5747
        if length != -1:
5748
            for _ in range(0, length):
5749
                array.append(DiagnosticInfo.from_binary(data))
5750
        self.DiagnosticInfos = array
5751 1
5752
    def __str__(self):
5753
        return 'BrowseNextResult(' + 'Results:' + str(self.Results) + ', ' + \
5754
               'DiagnosticInfos:' + str(self.DiagnosticInfos) + ')'
5755 1
5756
    __repr__ = __str__
5757
5758 1
5759
class BrowseNextResponse(FrozenClass):
5760
    '''
5761
    Continues one or more browse operations.
5762
5763
    :ivar TypeId:
5764
    :vartype TypeId: NodeId
5765
    :ivar ResponseHeader:
5766
    :vartype ResponseHeader: ResponseHeader
5767
    :ivar Parameters:
5768
    :vartype Parameters: BrowseNextResult
5769 1
    '''
5770
    def __init__(self, binary=None):
5771
        if binary is not None:
5772
            self._binary_init(binary)
5773
            self._freeze = True
5774
            return
5775
        self.TypeId = FourByteNodeId(ObjectIds.BrowseNextResponse_Encoding_DefaultBinary)
5776
        self.ResponseHeader = ResponseHeader()
5777
        self.Parameters = BrowseNextResult()
5778
        self._freeze = True
5779 1
5780
    def to_binary(self):
5781
        packet = []
5782
        packet.append(self.TypeId.to_binary())
5783
        packet.append(self.ResponseHeader.to_binary())
5784
        packet.append(self.Parameters.to_binary())
5785
        return b''.join(packet)
5786 1
5787
    @staticmethod
5788
    def from_binary(data):
5789
        return BrowseNextResponse(data)
5790 1
5791
    def _binary_init(self, data):
5792
        self.TypeId = NodeId.from_binary(data)
5793
        self.ResponseHeader = ResponseHeader.from_binary(data)
5794
        self.Parameters = BrowseNextResult.from_binary(data)
5795 1
5796
    def __str__(self):
5797
        return 'BrowseNextResponse(' + 'TypeId:' + str(self.TypeId) + ', ' + \
5798
               'ResponseHeader:' + str(self.ResponseHeader) + ', ' + \
5799
               'Parameters:' + str(self.Parameters) + ')'
5800 1
5801
    __repr__ = __str__
5802
5803 1
5804
class RelativePathElement(FrozenClass):
5805
    '''
5806
    An element in a relative path.
5807
5808
    :ivar ReferenceTypeId:
5809
    :vartype ReferenceTypeId: NodeId
5810
    :ivar IsInverse:
5811
    :vartype IsInverse: Boolean
5812
    :ivar IncludeSubtypes:
5813
    :vartype IncludeSubtypes: Boolean
5814
    :ivar TargetName:
5815
    :vartype TargetName: QualifiedName
5816 1
    '''
5817 1
    def __init__(self, binary=None):
5818 1
        if binary is not None:
5819 1
            self._binary_init(binary)
5820 1
            self._freeze = True
5821 1
            return
5822 1
        self.ReferenceTypeId = NodeId()
5823 1
        self.IsInverse = True
5824 1
        self.IncludeSubtypes = True
5825 1
        self.TargetName = QualifiedName()
5826
        self._freeze = True
5827 1
5828 1
    def to_binary(self):
5829 1
        packet = []
5830 1
        packet.append(self.ReferenceTypeId.to_binary())
5831 1
        packet.append(uatype_Boolean.pack(self.IsInverse))
5832 1
        packet.append(uatype_Boolean.pack(self.IncludeSubtypes))
5833 1
        packet.append(self.TargetName.to_binary())
5834
        return b''.join(packet)
5835 1
5836
    @staticmethod
5837 1
    def from_binary(data):
5838
        return RelativePathElement(data)
5839 1
5840 1
    def _binary_init(self, data):
5841 1
        self.ReferenceTypeId = NodeId.from_binary(data)
5842 1
        self.IsInverse = uatype_Boolean.unpack(data.read(1))[0]
5843 1
        self.IncludeSubtypes = uatype_Boolean.unpack(data.read(1))[0]
5844
        self.TargetName = QualifiedName.from_binary(data)
5845 1
5846
    def __str__(self):
5847
        return 'RelativePathElement(' + 'ReferenceTypeId:' + str(self.ReferenceTypeId) + ', ' + \
5848
               'IsInverse:' + str(self.IsInverse) + ', ' + \
5849
               'IncludeSubtypes:' + str(self.IncludeSubtypes) + ', ' + \
5850
               'TargetName:' + str(self.TargetName) + ')'
5851 1
5852
    __repr__ = __str__
5853
5854 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
5855
class RelativePath(FrozenClass):
5856
    '''
5857
    A relative path constructed from reference types and browse names.
5858
5859
    :ivar Elements:
5860
    :vartype Elements: RelativePathElement
5861 1
    '''
5862 1
    def __init__(self, binary=None):
5863 1
        if binary is not None:
5864 1
            self._binary_init(binary)
5865 1
            self._freeze = True
5866 1
            return
5867 1
        self.Elements = []
5868
        self._freeze = True
5869 1
5870 1
    def to_binary(self):
5871 1
        packet = []
5872 1
        packet.append(uatype_Int32.pack(len(self.Elements)))
5873 1
        for fieldname in self.Elements:
5874 1
            packet.append(fieldname.to_binary())
5875
        return b''.join(packet)
5876 1
5877
    @staticmethod
5878 1
    def from_binary(data):
5879
        return RelativePath(data)
5880 1
5881 1
    def _binary_init(self, data):
5882 1
        length = uatype_Int32.unpack(data.read(4))[0]
5883 1
        array = []
5884 1
        if length != -1:
5885 1
            for _ in range(0, length):
5886 1
                array.append(RelativePathElement.from_binary(data))
5887
        self.Elements = array
5888 1
5889
    def __str__(self):
5890
        return 'RelativePath(' + 'Elements:' + str(self.Elements) + ')'
5891 1
5892
    __repr__ = __str__
5893
5894 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
5895
class BrowsePath(FrozenClass):
5896
    '''
5897
    A request to translate a path into a node id.
5898
5899
    :ivar StartingNode:
5900
    :vartype StartingNode: NodeId
5901
    :ivar RelativePath:
5902
    :vartype RelativePath: RelativePath
5903 1
    '''
5904 1
    def __init__(self, binary=None):
5905 1
        if binary is not None:
5906 1
            self._binary_init(binary)
5907 1
            self._freeze = True
5908 1
            return
5909 1
        self.StartingNode = NodeId()
5910 1
        self.RelativePath = RelativePath()
5911
        self._freeze = True
5912 1
5913 1
    def to_binary(self):
5914 1
        packet = []
5915 1
        packet.append(self.StartingNode.to_binary())
5916 1
        packet.append(self.RelativePath.to_binary())
5917
        return b''.join(packet)
5918 1
5919
    @staticmethod
5920 1
    def from_binary(data):
5921
        return BrowsePath(data)
5922 1
5923 1
    def _binary_init(self, data):
5924 1
        self.StartingNode = NodeId.from_binary(data)
5925
        self.RelativePath = RelativePath.from_binary(data)
5926 1
5927
    def __str__(self):
5928
        return 'BrowsePath(' + 'StartingNode:' + str(self.StartingNode) + ', ' + \
5929
               'RelativePath:' + str(self.RelativePath) + ')'
5930 1
5931
    __repr__ = __str__
5932
5933 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
5934
class BrowsePathTarget(FrozenClass):
5935
    '''
5936
    The target of the translated path.
5937
5938
    :ivar TargetId:
5939
    :vartype TargetId: ExpandedNodeId
5940
    :ivar RemainingPathIndex:
5941
    :vartype RemainingPathIndex: UInt32
5942 1
    '''
5943 1
    def __init__(self, binary=None):
5944 1
        if binary is not None:
5945 1
            self._binary_init(binary)
5946 1
            self._freeze = True
5947 1
            return
5948 1
        self.TargetId = ExpandedNodeId()
5949 1
        self.RemainingPathIndex = 0
5950
        self._freeze = True
5951 1
5952 1
    def to_binary(self):
5953 1
        packet = []
5954 1
        packet.append(self.TargetId.to_binary())
5955 1
        packet.append(uatype_UInt32.pack(self.RemainingPathIndex))
5956
        return b''.join(packet)
5957 1
5958
    @staticmethod
5959 1
    def from_binary(data):
5960
        return BrowsePathTarget(data)
5961 1
5962 1
    def _binary_init(self, data):
5963 1
        self.TargetId = ExpandedNodeId.from_binary(data)
5964
        self.RemainingPathIndex = uatype_UInt32.unpack(data.read(4))[0]
5965 1
5966
    def __str__(self):
5967
        return 'BrowsePathTarget(' + 'TargetId:' + str(self.TargetId) + ', ' + \
5968
               'RemainingPathIndex:' + str(self.RemainingPathIndex) + ')'
5969 1
5970
    __repr__ = __str__
5971
5972 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
5973
class BrowsePathResult(FrozenClass):
5974
    '''
5975
    The result of a translate opearation.
5976
5977
    :ivar StatusCode:
5978
    :vartype StatusCode: StatusCode
5979
    :ivar Targets:
5980
    :vartype Targets: BrowsePathTarget
5981 1
    '''
5982 1
    def __init__(self, binary=None):
5983 1
        if binary is not None:
5984 1
            self._binary_init(binary)
5985 1
            self._freeze = True
5986 1
            return
5987 1
        self.StatusCode = StatusCode()
5988 1
        self.Targets = []
5989
        self._freeze = True
5990 1
5991 1
    def to_binary(self):
5992 1
        packet = []
5993 1
        packet.append(self.StatusCode.to_binary())
5994 1
        packet.append(uatype_Int32.pack(len(self.Targets)))
5995 1
        for fieldname in self.Targets:
5996 1
            packet.append(fieldname.to_binary())
5997
        return b''.join(packet)
5998 1
5999
    @staticmethod
6000 1
    def from_binary(data):
6001
        return BrowsePathResult(data)
6002 1
6003 1
    def _binary_init(self, data):
6004 1
        self.StatusCode = StatusCode.from_binary(data)
6005 1
        length = uatype_Int32.unpack(data.read(4))[0]
6006 1
        array = []
6007 1
        if length != -1:
6008 1
            for _ in range(0, length):
6009 1
                array.append(BrowsePathTarget.from_binary(data))
6010
        self.Targets = array
6011 1
6012
    def __str__(self):
6013
        return 'BrowsePathResult(' + 'StatusCode:' + str(self.StatusCode) + ', ' + \
6014
               'Targets:' + str(self.Targets) + ')'
6015 1
6016
    __repr__ = __str__
6017
6018 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
6019
class TranslateBrowsePathsToNodeIdsParameters(FrozenClass):
6020
    '''
6021
    :ivar BrowsePaths:
6022
    :vartype BrowsePaths: BrowsePath
6023 1
    '''
6024 1
    def __init__(self, binary=None):
6025 1
        if binary is not None:
6026 1
            self._binary_init(binary)
6027 1
            self._freeze = True
6028 1
            return
6029 1
        self.BrowsePaths = []
6030
        self._freeze = True
6031 1
6032 1
    def to_binary(self):
6033 1
        packet = []
6034 1
        packet.append(uatype_Int32.pack(len(self.BrowsePaths)))
6035 1
        for fieldname in self.BrowsePaths:
6036 1
            packet.append(fieldname.to_binary())
6037
        return b''.join(packet)
6038 1
6039
    @staticmethod
6040 1
    def from_binary(data):
6041
        return TranslateBrowsePathsToNodeIdsParameters(data)
6042 1
6043 1
    def _binary_init(self, data):
6044 1
        length = uatype_Int32.unpack(data.read(4))[0]
6045 1
        array = []
6046 1
        if length != -1:
6047 1
            for _ in range(0, length):
6048 1
                array.append(BrowsePath.from_binary(data))
6049
        self.BrowsePaths = array
6050 1
6051
    def __str__(self):
6052
        return 'TranslateBrowsePathsToNodeIdsParameters(' + 'BrowsePaths:' + str(self.BrowsePaths) + ')'
6053 1
6054
    __repr__ = __str__
6055
6056 1
6057
class TranslateBrowsePathsToNodeIdsRequest(FrozenClass):
6058
    '''
6059
    Translates one or more paths in the server address space.
6060
6061
    :ivar TypeId:
6062
    :vartype TypeId: NodeId
6063
    :ivar RequestHeader:
6064
    :vartype RequestHeader: RequestHeader
6065
    :ivar Parameters:
6066
    :vartype Parameters: TranslateBrowsePathsToNodeIdsParameters
6067 1
    '''
6068 1
    def __init__(self, binary=None):
6069
        if binary is not None:
6070
            self._binary_init(binary)
6071
            self._freeze = True
6072 1
            return
6073 1
        self.TypeId = FourByteNodeId(ObjectIds.TranslateBrowsePathsToNodeIdsRequest_Encoding_DefaultBinary)
6074 1
        self.RequestHeader = RequestHeader()
6075 1
        self.Parameters = TranslateBrowsePathsToNodeIdsParameters()
6076
        self._freeze = True
6077 1
6078 1
    def to_binary(self):
6079 1
        packet = []
6080 1
        packet.append(self.TypeId.to_binary())
6081 1
        packet.append(self.RequestHeader.to_binary())
6082 1
        packet.append(self.Parameters.to_binary())
6083
        return b''.join(packet)
6084 1
6085
    @staticmethod
6086
    def from_binary(data):
6087
        return TranslateBrowsePathsToNodeIdsRequest(data)
6088 1
6089
    def _binary_init(self, data):
6090
        self.TypeId = NodeId.from_binary(data)
6091
        self.RequestHeader = RequestHeader.from_binary(data)
6092
        self.Parameters = TranslateBrowsePathsToNodeIdsParameters.from_binary(data)
6093 1
6094
    def __str__(self):
6095
        return 'TranslateBrowsePathsToNodeIdsRequest(' + 'TypeId:' + str(self.TypeId) + ', ' + \
6096
               'RequestHeader:' + str(self.RequestHeader) + ', ' + \
6097
               'Parameters:' + str(self.Parameters) + ')'
6098 1
6099
    __repr__ = __str__
6100
6101 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
6102
class TranslateBrowsePathsToNodeIdsResponse(FrozenClass):
6103
    '''
6104
    Translates one or more paths in the server address space.
6105
6106
    :ivar TypeId:
6107
    :vartype TypeId: NodeId
6108
    :ivar ResponseHeader:
6109
    :vartype ResponseHeader: ResponseHeader
6110
    :ivar Results:
6111
    :vartype Results: BrowsePathResult
6112
    :ivar DiagnosticInfos:
6113
    :vartype DiagnosticInfos: DiagnosticInfo
6114 1
    '''
6115 1
    def __init__(self, binary=None):
6116 1
        if binary is not None:
6117 1
            self._binary_init(binary)
6118 1
            self._freeze = True
6119 1
            return
6120 1
        self.TypeId = FourByteNodeId(ObjectIds.TranslateBrowsePathsToNodeIdsResponse_Encoding_DefaultBinary)
6121 1
        self.ResponseHeader = ResponseHeader()
6122 1
        self.Results = []
6123 1
        self.DiagnosticInfos = []
6124
        self._freeze = True
6125 1
6126 1
    def to_binary(self):
6127 1
        packet = []
6128 1
        packet.append(self.TypeId.to_binary())
6129 1
        packet.append(self.ResponseHeader.to_binary())
6130 1
        packet.append(uatype_Int32.pack(len(self.Results)))
6131 1
        for fieldname in self.Results:
6132 1
            packet.append(fieldname.to_binary())
6133 1
        packet.append(uatype_Int32.pack(len(self.DiagnosticInfos)))
6134
        for fieldname in self.DiagnosticInfos:
6135 1
            packet.append(fieldname.to_binary())
6136
        return b''.join(packet)
6137 1
6138
    @staticmethod
6139 1
    def from_binary(data):
6140
        return TranslateBrowsePathsToNodeIdsResponse(data)
6141 1
6142 1
    def _binary_init(self, data):
6143 1
        self.TypeId = NodeId.from_binary(data)
6144 1
        self.ResponseHeader = ResponseHeader.from_binary(data)
6145 1
        length = uatype_Int32.unpack(data.read(4))[0]
6146 1
        array = []
6147 1
        if length != -1:
6148 1
            for _ in range(0, length):
6149 1
                array.append(BrowsePathResult.from_binary(data))
6150 1
        self.Results = array
6151 1
        length = uatype_Int32.unpack(data.read(4))[0]
6152 1
        array = []
6153 1
        if length != -1:
6154
            for _ in range(0, length):
6155 1
                array.append(DiagnosticInfo.from_binary(data))
6156
        self.DiagnosticInfos = array
6157 1
6158
    def __str__(self):
6159
        return 'TranslateBrowsePathsToNodeIdsResponse(' + 'TypeId:' + str(self.TypeId) + ', ' + \
6160
               'ResponseHeader:' + str(self.ResponseHeader) + ', ' + \
6161
               'Results:' + str(self.Results) + ', ' + \
6162
               'DiagnosticInfos:' + str(self.DiagnosticInfos) + ')'
6163 1
6164
    __repr__ = __str__
6165
6166 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
6167
class RegisterNodesParameters(FrozenClass):
6168
    '''
6169
    :ivar NodesToRegister:
6170
    :vartype NodesToRegister: NodeId
6171 1
    '''
6172
    def __init__(self, binary=None):
6173
        if binary is not None:
6174
            self._binary_init(binary)
6175
            self._freeze = True
6176
            return
6177
        self.NodesToRegister = []
6178
        self._freeze = True
6179 1
6180
    def to_binary(self):
6181
        packet = []
6182
        packet.append(uatype_Int32.pack(len(self.NodesToRegister)))
6183
        for fieldname in self.NodesToRegister:
6184
            packet.append(fieldname.to_binary())
6185
        return b''.join(packet)
6186 1
6187
    @staticmethod
6188
    def from_binary(data):
6189
        return RegisterNodesParameters(data)
6190 1
6191
    def _binary_init(self, data):
6192
        length = uatype_Int32.unpack(data.read(4))[0]
6193
        array = []
6194
        if length != -1:
6195
            for _ in range(0, length):
6196
                array.append(NodeId.from_binary(data))
6197
        self.NodesToRegister = array
6198 1
6199
    def __str__(self):
6200
        return 'RegisterNodesParameters(' + 'NodesToRegister:' + str(self.NodesToRegister) + ')'
6201 1
6202
    __repr__ = __str__
6203
6204 1
6205
class RegisterNodesRequest(FrozenClass):
6206
    '''
6207
    Registers one or more nodes for repeated use within a session.
6208
6209
    :ivar TypeId:
6210
    :vartype TypeId: NodeId
6211
    :ivar RequestHeader:
6212
    :vartype RequestHeader: RequestHeader
6213
    :ivar Parameters:
6214
    :vartype Parameters: RegisterNodesParameters
6215 1
    '''
6216
    def __init__(self, binary=None):
6217
        if binary is not None:
6218
            self._binary_init(binary)
6219
            self._freeze = True
6220
            return
6221
        self.TypeId = FourByteNodeId(ObjectIds.RegisterNodesRequest_Encoding_DefaultBinary)
6222
        self.RequestHeader = RequestHeader()
6223
        self.Parameters = RegisterNodesParameters()
6224
        self._freeze = True
6225 1
6226
    def to_binary(self):
6227
        packet = []
6228
        packet.append(self.TypeId.to_binary())
6229
        packet.append(self.RequestHeader.to_binary())
6230
        packet.append(self.Parameters.to_binary())
6231
        return b''.join(packet)
6232 1
6233
    @staticmethod
6234
    def from_binary(data):
6235
        return RegisterNodesRequest(data)
6236 1
6237
    def _binary_init(self, data):
6238
        self.TypeId = NodeId.from_binary(data)
6239
        self.RequestHeader = RequestHeader.from_binary(data)
6240
        self.Parameters = RegisterNodesParameters.from_binary(data)
6241 1
6242
    def __str__(self):
6243
        return 'RegisterNodesRequest(' + 'TypeId:' + str(self.TypeId) + ', ' + \
6244
               'RequestHeader:' + str(self.RequestHeader) + ', ' + \
6245
               'Parameters:' + str(self.Parameters) + ')'
6246 1
6247
    __repr__ = __str__
6248
6249 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
6250
class RegisterNodesResult(FrozenClass):
6251
    '''
6252
    :ivar RegisteredNodeIds:
6253
    :vartype RegisteredNodeIds: NodeId
6254 1
    '''
6255
    def __init__(self, binary=None):
6256
        if binary is not None:
6257
            self._binary_init(binary)
6258
            self._freeze = True
6259
            return
6260
        self.RegisteredNodeIds = []
6261
        self._freeze = True
6262 1
6263
    def to_binary(self):
6264
        packet = []
6265
        packet.append(uatype_Int32.pack(len(self.RegisteredNodeIds)))
6266
        for fieldname in self.RegisteredNodeIds:
6267
            packet.append(fieldname.to_binary())
6268
        return b''.join(packet)
6269 1
6270
    @staticmethod
6271
    def from_binary(data):
6272
        return RegisterNodesResult(data)
6273 1
6274
    def _binary_init(self, data):
6275
        length = uatype_Int32.unpack(data.read(4))[0]
6276
        array = []
6277
        if length != -1:
6278
            for _ in range(0, length):
6279
                array.append(NodeId.from_binary(data))
6280
        self.RegisteredNodeIds = array
6281 1
6282
    def __str__(self):
6283
        return 'RegisterNodesResult(' + 'RegisteredNodeIds:' + str(self.RegisteredNodeIds) + ')'
6284 1
6285
    __repr__ = __str__
6286
6287 1
6288
class RegisterNodesResponse(FrozenClass):
6289
    '''
6290
    Registers one or more nodes for repeated use within a session.
6291
6292
    :ivar TypeId:
6293
    :vartype TypeId: NodeId
6294
    :ivar ResponseHeader:
6295
    :vartype ResponseHeader: ResponseHeader
6296
    :ivar Parameters:
6297
    :vartype Parameters: RegisterNodesResult
6298 1
    '''
6299
    def __init__(self, binary=None):
6300
        if binary is not None:
6301
            self._binary_init(binary)
6302
            self._freeze = True
6303
            return
6304
        self.TypeId = FourByteNodeId(ObjectIds.RegisterNodesResponse_Encoding_DefaultBinary)
6305
        self.ResponseHeader = ResponseHeader()
6306
        self.Parameters = RegisterNodesResult()
6307
        self._freeze = True
6308 1
6309
    def to_binary(self):
6310
        packet = []
6311
        packet.append(self.TypeId.to_binary())
6312
        packet.append(self.ResponseHeader.to_binary())
6313
        packet.append(self.Parameters.to_binary())
6314
        return b''.join(packet)
6315 1
6316
    @staticmethod
6317
    def from_binary(data):
6318
        return RegisterNodesResponse(data)
6319 1
6320
    def _binary_init(self, data):
6321
        self.TypeId = NodeId.from_binary(data)
6322
        self.ResponseHeader = ResponseHeader.from_binary(data)
6323
        self.Parameters = RegisterNodesResult.from_binary(data)
6324 1
6325
    def __str__(self):
6326
        return 'RegisterNodesResponse(' + 'TypeId:' + str(self.TypeId) + ', ' + \
6327
               'ResponseHeader:' + str(self.ResponseHeader) + ', ' + \
6328
               'Parameters:' + str(self.Parameters) + ')'
6329 1
6330
    __repr__ = __str__
6331
6332 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
6333
class UnregisterNodesParameters(FrozenClass):
6334
    '''
6335
    :ivar NodesToUnregister:
6336
    :vartype NodesToUnregister: NodeId
6337 1
    '''
6338
    def __init__(self, binary=None):
6339
        if binary is not None:
6340
            self._binary_init(binary)
6341
            self._freeze = True
6342
            return
6343
        self.NodesToUnregister = []
6344
        self._freeze = True
6345 1
6346
    def to_binary(self):
6347
        packet = []
6348
        packet.append(uatype_Int32.pack(len(self.NodesToUnregister)))
6349
        for fieldname in self.NodesToUnregister:
6350
            packet.append(fieldname.to_binary())
6351
        return b''.join(packet)
6352 1
6353
    @staticmethod
6354
    def from_binary(data):
6355
        return UnregisterNodesParameters(data)
6356 1
6357
    def _binary_init(self, data):
6358
        length = uatype_Int32.unpack(data.read(4))[0]
6359
        array = []
6360
        if length != -1:
6361
            for _ in range(0, length):
6362
                array.append(NodeId.from_binary(data))
6363
        self.NodesToUnregister = array
6364 1
6365
    def __str__(self):
6366
        return 'UnregisterNodesParameters(' + 'NodesToUnregister:' + str(self.NodesToUnregister) + ')'
6367 1
6368
    __repr__ = __str__
6369
6370 1
6371
class UnregisterNodesRequest(FrozenClass):
6372
    '''
6373
    Unregisters one or more previously registered nodes.
6374
6375
    :ivar TypeId:
6376
    :vartype TypeId: NodeId
6377
    :ivar RequestHeader:
6378
    :vartype RequestHeader: RequestHeader
6379
    :ivar Parameters:
6380
    :vartype Parameters: UnregisterNodesParameters
6381 1
    '''
6382
    def __init__(self, binary=None):
6383
        if binary is not None:
6384
            self._binary_init(binary)
6385
            self._freeze = True
6386
            return
6387
        self.TypeId = FourByteNodeId(ObjectIds.UnregisterNodesRequest_Encoding_DefaultBinary)
6388
        self.RequestHeader = RequestHeader()
6389
        self.Parameters = UnregisterNodesParameters()
6390
        self._freeze = True
6391 1
6392
    def to_binary(self):
6393
        packet = []
6394
        packet.append(self.TypeId.to_binary())
6395
        packet.append(self.RequestHeader.to_binary())
6396
        packet.append(self.Parameters.to_binary())
6397
        return b''.join(packet)
6398 1
6399
    @staticmethod
6400
    def from_binary(data):
6401
        return UnregisterNodesRequest(data)
6402 1
6403
    def _binary_init(self, data):
6404
        self.TypeId = NodeId.from_binary(data)
6405
        self.RequestHeader = RequestHeader.from_binary(data)
6406
        self.Parameters = UnregisterNodesParameters.from_binary(data)
6407 1
6408
    def __str__(self):
6409
        return 'UnregisterNodesRequest(' + 'TypeId:' + str(self.TypeId) + ', ' + \
6410
               'RequestHeader:' + str(self.RequestHeader) + ', ' + \
6411
               'Parameters:' + str(self.Parameters) + ')'
6412 1
6413
    __repr__ = __str__
6414
6415 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
6416
class UnregisterNodesResponse(FrozenClass):
6417
    '''
6418
    Unregisters one or more previously registered nodes.
6419
6420
    :ivar TypeId:
6421
    :vartype TypeId: NodeId
6422
    :ivar ResponseHeader:
6423
    :vartype ResponseHeader: ResponseHeader
6424 1
    '''
6425
    def __init__(self, binary=None):
6426
        if binary is not None:
6427
            self._binary_init(binary)
6428
            self._freeze = True
6429
            return
6430
        self.TypeId = FourByteNodeId(ObjectIds.UnregisterNodesResponse_Encoding_DefaultBinary)
6431
        self.ResponseHeader = ResponseHeader()
6432
        self._freeze = True
6433 1
6434
    def to_binary(self):
6435
        packet = []
6436
        packet.append(self.TypeId.to_binary())
6437
        packet.append(self.ResponseHeader.to_binary())
6438
        return b''.join(packet)
6439 1
6440
    @staticmethod
6441
    def from_binary(data):
6442
        return UnregisterNodesResponse(data)
6443 1
6444
    def _binary_init(self, data):
6445
        self.TypeId = NodeId.from_binary(data)
6446
        self.ResponseHeader = ResponseHeader.from_binary(data)
6447 1
6448
    def __str__(self):
6449
        return 'UnregisterNodesResponse(' + 'TypeId:' + str(self.TypeId) + ', ' + \
6450
               'ResponseHeader:' + str(self.ResponseHeader) + ')'
6451 1
6452
    __repr__ = __str__
6453
6454 1
6455
class EndpointConfiguration(FrozenClass):
6456
    '''
6457
    :ivar OperationTimeout:
6458
    :vartype OperationTimeout: Int32
6459
    :ivar UseBinaryEncoding:
6460
    :vartype UseBinaryEncoding: Boolean
6461
    :ivar MaxStringLength:
6462
    :vartype MaxStringLength: Int32
6463
    :ivar MaxByteStringLength:
6464
    :vartype MaxByteStringLength: Int32
6465
    :ivar MaxArrayLength:
6466
    :vartype MaxArrayLength: Int32
6467
    :ivar MaxMessageSize:
6468
    :vartype MaxMessageSize: Int32
6469
    :ivar MaxBufferSize:
6470
    :vartype MaxBufferSize: Int32
6471
    :ivar ChannelLifetime:
6472
    :vartype ChannelLifetime: Int32
6473
    :ivar SecurityTokenLifetime:
6474
    :vartype SecurityTokenLifetime: Int32
6475 1
    '''
6476
    def __init__(self, binary=None):
6477
        if binary is not None:
6478
            self._binary_init(binary)
6479
            self._freeze = True
6480
            return
6481
        self.OperationTimeout = 0
6482
        self.UseBinaryEncoding = True
6483
        self.MaxStringLength = 0
6484
        self.MaxByteStringLength = 0
6485
        self.MaxArrayLength = 0
6486
        self.MaxMessageSize = 0
6487
        self.MaxBufferSize = 0
6488
        self.ChannelLifetime = 0
6489
        self.SecurityTokenLifetime = 0
6490
        self._freeze = True
6491 1
6492
    def to_binary(self):
6493
        packet = []
6494
        packet.append(uatype_Int32.pack(self.OperationTimeout))
6495
        packet.append(uatype_Boolean.pack(self.UseBinaryEncoding))
6496
        packet.append(uatype_Int32.pack(self.MaxStringLength))
6497
        packet.append(uatype_Int32.pack(self.MaxByteStringLength))
6498
        packet.append(uatype_Int32.pack(self.MaxArrayLength))
6499
        packet.append(uatype_Int32.pack(self.MaxMessageSize))
6500
        packet.append(uatype_Int32.pack(self.MaxBufferSize))
6501
        packet.append(uatype_Int32.pack(self.ChannelLifetime))
6502
        packet.append(uatype_Int32.pack(self.SecurityTokenLifetime))
6503
        return b''.join(packet)
6504 1
6505
    @staticmethod
6506
    def from_binary(data):
6507
        return EndpointConfiguration(data)
6508 1
6509
    def _binary_init(self, data):
6510
        self.OperationTimeout = uatype_Int32.unpack(data.read(4))[0]
6511
        self.UseBinaryEncoding = uatype_Boolean.unpack(data.read(1))[0]
6512
        self.MaxStringLength = uatype_Int32.unpack(data.read(4))[0]
6513
        self.MaxByteStringLength = uatype_Int32.unpack(data.read(4))[0]
6514
        self.MaxArrayLength = uatype_Int32.unpack(data.read(4))[0]
6515
        self.MaxMessageSize = uatype_Int32.unpack(data.read(4))[0]
6516
        self.MaxBufferSize = uatype_Int32.unpack(data.read(4))[0]
6517
        self.ChannelLifetime = uatype_Int32.unpack(data.read(4))[0]
6518
        self.SecurityTokenLifetime = uatype_Int32.unpack(data.read(4))[0]
6519 1
6520
    def __str__(self):
6521
        return 'EndpointConfiguration(' + 'OperationTimeout:' + str(self.OperationTimeout) + ', ' + \
6522
               'UseBinaryEncoding:' + str(self.UseBinaryEncoding) + ', ' + \
6523
               'MaxStringLength:' + str(self.MaxStringLength) + ', ' + \
6524
               'MaxByteStringLength:' + str(self.MaxByteStringLength) + ', ' + \
6525
               'MaxArrayLength:' + str(self.MaxArrayLength) + ', ' + \
6526
               'MaxMessageSize:' + str(self.MaxMessageSize) + ', ' + \
6527
               'MaxBufferSize:' + str(self.MaxBufferSize) + ', ' + \
6528
               'ChannelLifetime:' + str(self.ChannelLifetime) + ', ' + \
6529
               'SecurityTokenLifetime:' + str(self.SecurityTokenLifetime) + ')'
6530 1
6531
    __repr__ = __str__
6532
6533 1
6534
class SupportedProfile(FrozenClass):
6535
    '''
6536
    :ivar OrganizationUri:
6537
    :vartype OrganizationUri: String
6538
    :ivar ProfileId:
6539
    :vartype ProfileId: String
6540
    :ivar ComplianceTool:
6541
    :vartype ComplianceTool: String
6542
    :ivar ComplianceDate:
6543
    :vartype ComplianceDate: DateTime
6544
    :ivar ComplianceLevel:
6545
    :vartype ComplianceLevel: ComplianceLevel
6546
    :ivar UnsupportedUnitIds:
6547
    :vartype UnsupportedUnitIds: String
6548 1
    '''
6549
    def __init__(self, binary=None):
6550
        if binary is not None:
6551
            self._binary_init(binary)
6552
            self._freeze = True
6553
            return
6554
        self.OrganizationUri = None
6555
        self.ProfileId = None
6556
        self.ComplianceTool = None
6557
        self.ComplianceDate = datetime.now()
6558
        self.ComplianceLevel = ComplianceLevel(0)
6559
        self.UnsupportedUnitIds = []
6560
        self._freeze = True
6561 1
6562
    def to_binary(self):
6563
        packet = []
6564
        packet.append(pack_string(self.OrganizationUri))
6565
        packet.append(pack_string(self.ProfileId))
6566
        packet.append(pack_string(self.ComplianceTool))
6567
        packet.append(pack_datetime(self.ComplianceDate))
6568
        packet.append(uatype_UInt32.pack(self.ComplianceLevel.value))
6569
        packet.append(uatype_Int32.pack(len(self.UnsupportedUnitIds)))
6570
        for fieldname in self.UnsupportedUnitIds:
6571
            packet.append(pack_string(fieldname))
6572
        return b''.join(packet)
6573 1
6574
    @staticmethod
6575
    def from_binary(data):
6576
        return SupportedProfile(data)
6577 1
6578
    def _binary_init(self, data):
6579
        self.OrganizationUri = unpack_string(data)
6580
        self.ProfileId = unpack_string(data)
6581
        self.ComplianceTool = unpack_string(data)
6582
        self.ComplianceDate = unpack_datetime(data)
6583
        self.ComplianceLevel = ComplianceLevel(uatype_UInt32.unpack(data.read(4))[0])
6584
        self.UnsupportedUnitIds = unpack_uatype_array('String', data)
6585 1
6586
    def __str__(self):
6587
        return 'SupportedProfile(' + 'OrganizationUri:' + str(self.OrganizationUri) + ', ' + \
6588
               'ProfileId:' + str(self.ProfileId) + ', ' + \
6589
               'ComplianceTool:' + str(self.ComplianceTool) + ', ' + \
6590
               'ComplianceDate:' + str(self.ComplianceDate) + ', ' + \
6591
               'ComplianceLevel:' + str(self.ComplianceLevel) + ', ' + \
6592
               'UnsupportedUnitIds:' + str(self.UnsupportedUnitIds) + ')'
6593 1
6594
    __repr__ = __str__
6595
6596 1
6597
class SoftwareCertificate(FrozenClass):
6598
    '''
6599
    :ivar ProductName:
6600
    :vartype ProductName: String
6601
    :ivar ProductUri:
6602
    :vartype ProductUri: String
6603
    :ivar VendorName:
6604
    :vartype VendorName: String
6605
    :ivar VendorProductCertificate:
6606
    :vartype VendorProductCertificate: ByteString
6607
    :ivar SoftwareVersion:
6608
    :vartype SoftwareVersion: String
6609
    :ivar BuildNumber:
6610
    :vartype BuildNumber: String
6611
    :ivar BuildDate:
6612
    :vartype BuildDate: DateTime
6613
    :ivar IssuedBy:
6614
    :vartype IssuedBy: String
6615
    :ivar IssueDate:
6616
    :vartype IssueDate: DateTime
6617
    :ivar SupportedProfiles:
6618
    :vartype SupportedProfiles: SupportedProfile
6619 1
    '''
6620
    def __init__(self, binary=None):
6621
        if binary is not None:
6622
            self._binary_init(binary)
6623
            self._freeze = True
6624
            return
6625
        self.ProductName = None
6626
        self.ProductUri = None
6627
        self.VendorName = None
6628
        self.VendorProductCertificate = None
6629
        self.SoftwareVersion = None
6630
        self.BuildNumber = None
6631
        self.BuildDate = datetime.now()
6632
        self.IssuedBy = None
6633
        self.IssueDate = datetime.now()
6634
        self.SupportedProfiles = []
6635
        self._freeze = True
6636 1
6637
    def to_binary(self):
6638
        packet = []
6639
        packet.append(pack_string(self.ProductName))
6640
        packet.append(pack_string(self.ProductUri))
6641
        packet.append(pack_string(self.VendorName))
6642
        packet.append(pack_bytes(self.VendorProductCertificate))
6643
        packet.append(pack_string(self.SoftwareVersion))
6644
        packet.append(pack_string(self.BuildNumber))
6645
        packet.append(pack_datetime(self.BuildDate))
6646
        packet.append(pack_string(self.IssuedBy))
6647
        packet.append(pack_datetime(self.IssueDate))
6648
        packet.append(uatype_Int32.pack(len(self.SupportedProfiles)))
6649
        for fieldname in self.SupportedProfiles:
6650
            packet.append(fieldname.to_binary())
6651
        return b''.join(packet)
6652 1
6653
    @staticmethod
6654
    def from_binary(data):
6655
        return SoftwareCertificate(data)
6656 1
6657
    def _binary_init(self, data):
6658
        self.ProductName = unpack_string(data)
6659
        self.ProductUri = unpack_string(data)
6660
        self.VendorName = unpack_string(data)
6661
        self.VendorProductCertificate = unpack_bytes(data)
6662
        self.SoftwareVersion = unpack_string(data)
6663
        self.BuildNumber = unpack_string(data)
6664
        self.BuildDate = unpack_datetime(data)
6665
        self.IssuedBy = unpack_string(data)
6666
        self.IssueDate = unpack_datetime(data)
6667
        length = uatype_Int32.unpack(data.read(4))[0]
6668
        array = []
6669
        if length != -1:
6670
            for _ in range(0, length):
6671
                array.append(SupportedProfile.from_binary(data))
6672
        self.SupportedProfiles = array
6673 1
6674
    def __str__(self):
6675
        return 'SoftwareCertificate(' + 'ProductName:' + str(self.ProductName) + ', ' + \
6676
               'ProductUri:' + str(self.ProductUri) + ', ' + \
6677
               'VendorName:' + str(self.VendorName) + ', ' + \
6678
               'VendorProductCertificate:' + str(self.VendorProductCertificate) + ', ' + \
6679
               'SoftwareVersion:' + str(self.SoftwareVersion) + ', ' + \
6680
               'BuildNumber:' + str(self.BuildNumber) + ', ' + \
6681
               'BuildDate:' + str(self.BuildDate) + ', ' + \
6682
               'IssuedBy:' + str(self.IssuedBy) + ', ' + \
6683
               'IssueDate:' + str(self.IssueDate) + ', ' + \
6684
               'SupportedProfiles:' + str(self.SupportedProfiles) + ')'
6685 1
6686
    __repr__ = __str__
6687
6688 1
6689
class QueryDataDescription(FrozenClass):
6690
    '''
6691
    :ivar RelativePath:
6692
    :vartype RelativePath: RelativePath
6693
    :ivar AttributeId:
6694
    :vartype AttributeId: UInt32
6695
    :ivar IndexRange:
6696
    :vartype IndexRange: String
6697 1
    '''
6698
    def __init__(self, binary=None):
6699
        if binary is not None:
6700
            self._binary_init(binary)
6701
            self._freeze = True
6702
            return
6703
        self.RelativePath = RelativePath()
6704
        self.AttributeId = 0
6705
        self.IndexRange = None
6706
        self._freeze = True
6707 1
6708
    def to_binary(self):
6709
        packet = []
6710
        packet.append(self.RelativePath.to_binary())
6711
        packet.append(uatype_UInt32.pack(self.AttributeId))
6712
        packet.append(pack_string(self.IndexRange))
6713
        return b''.join(packet)
6714 1
6715
    @staticmethod
6716
    def from_binary(data):
6717
        return QueryDataDescription(data)
6718 1
6719
    def _binary_init(self, data):
6720
        self.RelativePath = RelativePath.from_binary(data)
6721
        self.AttributeId = uatype_UInt32.unpack(data.read(4))[0]
6722
        self.IndexRange = unpack_string(data)
6723 1
6724
    def __str__(self):
6725
        return 'QueryDataDescription(' + 'RelativePath:' + str(self.RelativePath) + ', ' + \
6726
               'AttributeId:' + str(self.AttributeId) + ', ' + \
6727
               'IndexRange:' + str(self.IndexRange) + ')'
6728 1
6729
    __repr__ = __str__
6730
6731 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
6732
class NodeTypeDescription(FrozenClass):
6733
    '''
6734
    :ivar TypeDefinitionNode:
6735
    :vartype TypeDefinitionNode: ExpandedNodeId
6736
    :ivar IncludeSubTypes:
6737
    :vartype IncludeSubTypes: Boolean
6738
    :ivar DataToReturn:
6739
    :vartype DataToReturn: QueryDataDescription
6740 1
    '''
6741
    def __init__(self, binary=None):
6742
        if binary is not None:
6743
            self._binary_init(binary)
6744
            self._freeze = True
6745
            return
6746
        self.TypeDefinitionNode = ExpandedNodeId()
6747
        self.IncludeSubTypes = True
6748
        self.DataToReturn = []
6749
        self._freeze = True
6750 1
6751
    def to_binary(self):
6752
        packet = []
6753
        packet.append(self.TypeDefinitionNode.to_binary())
6754
        packet.append(uatype_Boolean.pack(self.IncludeSubTypes))
6755
        packet.append(uatype_Int32.pack(len(self.DataToReturn)))
6756
        for fieldname in self.DataToReturn:
6757
            packet.append(fieldname.to_binary())
6758
        return b''.join(packet)
6759 1
6760
    @staticmethod
6761
    def from_binary(data):
6762
        return NodeTypeDescription(data)
6763 1
6764
    def _binary_init(self, data):
6765
        self.TypeDefinitionNode = ExpandedNodeId.from_binary(data)
6766
        self.IncludeSubTypes = uatype_Boolean.unpack(data.read(1))[0]
6767
        length = uatype_Int32.unpack(data.read(4))[0]
6768
        array = []
6769
        if length != -1:
6770
            for _ in range(0, length):
6771
                array.append(QueryDataDescription.from_binary(data))
6772
        self.DataToReturn = array
6773 1
6774
    def __str__(self):
6775
        return 'NodeTypeDescription(' + 'TypeDefinitionNode:' + str(self.TypeDefinitionNode) + ', ' + \
6776
               'IncludeSubTypes:' + str(self.IncludeSubTypes) + ', ' + \
6777
               'DataToReturn:' + str(self.DataToReturn) + ')'
6778 1
6779
    __repr__ = __str__
6780
6781 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
6782
class QueryDataSet(FrozenClass):
6783
    '''
6784
    :ivar NodeId:
6785
    :vartype NodeId: ExpandedNodeId
6786
    :ivar TypeDefinitionNode:
6787
    :vartype TypeDefinitionNode: ExpandedNodeId
6788
    :ivar Values:
6789
    :vartype Values: Variant
6790 1
    '''
6791
    def __init__(self, binary=None):
6792
        if binary is not None:
6793
            self._binary_init(binary)
6794
            self._freeze = True
6795
            return
6796
        self.NodeId = ExpandedNodeId()
6797
        self.TypeDefinitionNode = ExpandedNodeId()
6798
        self.Values = []
6799
        self._freeze = True
6800 1
6801
    def to_binary(self):
6802
        packet = []
6803
        packet.append(self.NodeId.to_binary())
6804
        packet.append(self.TypeDefinitionNode.to_binary())
6805
        packet.append(uatype_Int32.pack(len(self.Values)))
6806
        for fieldname in self.Values:
6807
            packet.append(fieldname.to_binary())
6808
        return b''.join(packet)
6809 1
6810
    @staticmethod
6811
    def from_binary(data):
6812
        return QueryDataSet(data)
6813 1
6814
    def _binary_init(self, data):
6815
        self.NodeId = ExpandedNodeId.from_binary(data)
6816
        self.TypeDefinitionNode = ExpandedNodeId.from_binary(data)
6817
        length = uatype_Int32.unpack(data.read(4))[0]
6818
        array = []
6819
        if length != -1:
6820
            for _ in range(0, length):
6821
                array.append(Variant.from_binary(data))
6822
        self.Values = array
6823 1
6824
    def __str__(self):
6825
        return 'QueryDataSet(' + 'NodeId:' + str(self.NodeId) + ', ' + \
6826
               'TypeDefinitionNode:' + str(self.TypeDefinitionNode) + ', ' + \
6827
               'Values:' + str(self.Values) + ')'
6828 1
6829
    __repr__ = __str__
6830
6831 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
6832
class NodeReference(FrozenClass):
6833
    '''
6834
    :ivar NodeId:
6835
    :vartype NodeId: NodeId
6836
    :ivar ReferenceTypeId:
6837
    :vartype ReferenceTypeId: NodeId
6838
    :ivar IsForward:
6839
    :vartype IsForward: Boolean
6840
    :ivar ReferencedNodeIds:
6841
    :vartype ReferencedNodeIds: NodeId
6842 1
    '''
6843
    def __init__(self, binary=None):
6844
        if binary is not None:
6845
            self._binary_init(binary)
6846
            self._freeze = True
6847
            return
6848
        self.NodeId = NodeId()
6849
        self.ReferenceTypeId = NodeId()
6850
        self.IsForward = True
6851
        self.ReferencedNodeIds = []
6852
        self._freeze = True
6853 1
6854
    def to_binary(self):
6855
        packet = []
6856
        packet.append(self.NodeId.to_binary())
6857
        packet.append(self.ReferenceTypeId.to_binary())
6858
        packet.append(uatype_Boolean.pack(self.IsForward))
6859
        packet.append(uatype_Int32.pack(len(self.ReferencedNodeIds)))
6860
        for fieldname in self.ReferencedNodeIds:
6861
            packet.append(fieldname.to_binary())
6862
        return b''.join(packet)
6863 1
6864
    @staticmethod
6865
    def from_binary(data):
6866
        return NodeReference(data)
6867 1
6868
    def _binary_init(self, data):
6869
        self.NodeId = NodeId.from_binary(data)
6870
        self.ReferenceTypeId = NodeId.from_binary(data)
6871
        self.IsForward = uatype_Boolean.unpack(data.read(1))[0]
6872
        length = uatype_Int32.unpack(data.read(4))[0]
6873
        array = []
6874
        if length != -1:
6875
            for _ in range(0, length):
6876
                array.append(NodeId.from_binary(data))
6877
        self.ReferencedNodeIds = array
6878 1
6879
    def __str__(self):
6880
        return 'NodeReference(' + 'NodeId:' + str(self.NodeId) + ', ' + \
6881
               'ReferenceTypeId:' + str(self.ReferenceTypeId) + ', ' + \
6882
               'IsForward:' + str(self.IsForward) + ', ' + \
6883
               'ReferencedNodeIds:' + str(self.ReferencedNodeIds) + ')'
6884 1
6885
    __repr__ = __str__
6886
6887 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
6888
class ContentFilterElement(FrozenClass):
6889
    '''
6890
    :ivar FilterOperator:
6891
    :vartype FilterOperator: FilterOperator
6892
    :ivar FilterOperands:
6893
    :vartype FilterOperands: ExtensionObject
6894 1
    '''
6895
    def __init__(self, binary=None):
6896
        if binary is not None:
6897
            self._binary_init(binary)
6898
            self._freeze = True
6899
            return
6900
        self.FilterOperator = FilterOperator(0)
6901
        self.FilterOperands = []
6902
        self._freeze = True
6903 1
6904
    def to_binary(self):
6905
        packet = []
6906
        packet.append(uatype_UInt32.pack(self.FilterOperator.value))
6907
        packet.append(uatype_Int32.pack(len(self.FilterOperands)))
6908
        for fieldname in self.FilterOperands:
6909
            packet.append(extensionobject_to_binary(fieldname))
6910
        return b''.join(packet)
6911 1
6912
    @staticmethod
6913
    def from_binary(data):
6914
        return ContentFilterElement(data)
6915 1
6916
    def _binary_init(self, data):
6917
        self.FilterOperator = FilterOperator(uatype_UInt32.unpack(data.read(4))[0])
6918
        length = uatype_Int32.unpack(data.read(4))[0]
6919
        array = []
6920
        if length != -1:
6921
            for _ in range(0, length):
6922
                array.append(extensionobject_from_binary(data))
6923
        self.FilterOperands = array
6924 1
6925
    def __str__(self):
6926
        return 'ContentFilterElement(' + 'FilterOperator:' + str(self.FilterOperator) + ', ' + \
6927
               'FilterOperands:' + str(self.FilterOperands) + ')'
6928 1
6929
    __repr__ = __str__
6930
6931 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
6932
class ContentFilter(FrozenClass):
6933
    '''
6934
    :ivar Elements:
6935
    :vartype Elements: ContentFilterElement
6936 1
    '''
6937 1
    def __init__(self, binary=None):
6938 1
        if binary is not None:
6939 1
            self._binary_init(binary)
6940 1
            self._freeze = True
6941 1
            return
6942 1
        self.Elements = []
6943
        self._freeze = True
6944 1
6945 1
    def to_binary(self):
6946 1
        packet = []
6947 1
        packet.append(uatype_Int32.pack(len(self.Elements)))
6948
        for fieldname in self.Elements:
6949 1
            packet.append(fieldname.to_binary())
6950
        return b''.join(packet)
6951 1
6952
    @staticmethod
6953 1
    def from_binary(data):
6954
        return ContentFilter(data)
6955 1
6956 1
    def _binary_init(self, data):
6957 1
        length = uatype_Int32.unpack(data.read(4))[0]
6958 1
        array = []
6959 1
        if length != -1:
6960
            for _ in range(0, length):
6961 1
                array.append(ContentFilterElement.from_binary(data))
6962
        self.Elements = array
6963 1
6964
    def __str__(self):
6965
        return 'ContentFilter(' + 'Elements:' + str(self.Elements) + ')'
6966 1
6967
    __repr__ = __str__
6968
6969 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
6970
class ElementOperand(FrozenClass):
6971
    '''
6972
    :ivar Index:
6973
    :vartype Index: UInt32
6974 1
    '''
6975
    def __init__(self, binary=None):
6976
        if binary is not None:
6977
            self._binary_init(binary)
6978
            self._freeze = True
6979
            return
6980
        self.Index = 0
6981
        self._freeze = True
6982 1
6983
    def to_binary(self):
6984
        packet = []
6985
        packet.append(uatype_UInt32.pack(self.Index))
6986
        return b''.join(packet)
6987 1
6988
    @staticmethod
6989
    def from_binary(data):
6990
        return ElementOperand(data)
6991 1
6992
    def _binary_init(self, data):
6993
        self.Index = uatype_UInt32.unpack(data.read(4))[0]
6994 1
6995
    def __str__(self):
6996
        return 'ElementOperand(' + 'Index:' + str(self.Index) + ')'
6997 1
6998
    __repr__ = __str__
6999
7000 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
7001
class LiteralOperand(FrozenClass):
7002
    '''
7003
    :ivar Value:
7004
    :vartype Value: Variant
7005 1
    '''
7006
    def __init__(self, binary=None):
7007
        if binary is not None:
7008
            self._binary_init(binary)
7009
            self._freeze = True
7010
            return
7011
        self.Value = Variant()
7012
        self._freeze = True
7013 1
7014
    def to_binary(self):
7015
        packet = []
7016
        packet.append(self.Value.to_binary())
7017
        return b''.join(packet)
7018 1
7019
    @staticmethod
7020
    def from_binary(data):
7021
        return LiteralOperand(data)
7022 1
7023
    def _binary_init(self, data):
7024
        self.Value = Variant.from_binary(data)
7025 1
7026
    def __str__(self):
7027
        return 'LiteralOperand(' + 'Value:' + str(self.Value) + ')'
7028 1
7029
    __repr__ = __str__
7030
7031 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
7032
class AttributeOperand(FrozenClass):
7033
    '''
7034
    :ivar NodeId:
7035
    :vartype NodeId: NodeId
7036
    :ivar Alias:
7037
    :vartype Alias: String
7038
    :ivar BrowsePath:
7039
    :vartype BrowsePath: RelativePath
7040
    :ivar AttributeId:
7041
    :vartype AttributeId: UInt32
7042
    :ivar IndexRange:
7043
    :vartype IndexRange: String
7044 1
    '''
7045
    def __init__(self, binary=None):
7046
        if binary is not None:
7047
            self._binary_init(binary)
7048
            self._freeze = True
7049
            return
7050
        self.NodeId = NodeId()
7051
        self.Alias = None
7052
        self.BrowsePath = RelativePath()
7053
        self.AttributeId = 0
7054
        self.IndexRange = None
7055
        self._freeze = True
7056 1
7057
    def to_binary(self):
7058
        packet = []
7059
        packet.append(self.NodeId.to_binary())
7060
        packet.append(pack_string(self.Alias))
7061
        packet.append(self.BrowsePath.to_binary())
7062
        packet.append(uatype_UInt32.pack(self.AttributeId))
7063
        packet.append(pack_string(self.IndexRange))
7064
        return b''.join(packet)
7065 1
7066
    @staticmethod
7067
    def from_binary(data):
7068
        return AttributeOperand(data)
7069 1
7070
    def _binary_init(self, data):
7071
        self.NodeId = NodeId.from_binary(data)
7072
        self.Alias = unpack_string(data)
7073
        self.BrowsePath = RelativePath.from_binary(data)
7074
        self.AttributeId = uatype_UInt32.unpack(data.read(4))[0]
7075
        self.IndexRange = unpack_string(data)
7076 1
7077
    def __str__(self):
7078
        return 'AttributeOperand(' + 'NodeId:' + str(self.NodeId) + ', ' + \
7079
               'Alias:' + str(self.Alias) + ', ' + \
7080
               'BrowsePath:' + str(self.BrowsePath) + ', ' + \
7081
               'AttributeId:' + str(self.AttributeId) + ', ' + \
7082
               'IndexRange:' + str(self.IndexRange) + ')'
7083 1
7084
    __repr__ = __str__
7085
7086 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
7087
class SimpleAttributeOperand(FrozenClass):
7088
    '''
7089
    :ivar TypeDefinitionId:
7090
    :vartype TypeDefinitionId: NodeId
7091
    :ivar BrowsePath:
7092
    :vartype BrowsePath: QualifiedName
7093
    :ivar AttributeId:
7094
    :vartype AttributeId: UInt32
7095
    :ivar IndexRange:
7096
    :vartype IndexRange: String
7097 1
    '''
7098 1
    def __init__(self, binary=None):
7099 1
        if binary is not None:
7100 1
            self._binary_init(binary)
7101 1
            self._freeze = True
7102 1
            return
7103 1
        self.TypeDefinitionId = NodeId()
7104 1
        self.BrowsePath = []
7105 1
        self.AttributeId = 0
7106 1
        self.IndexRange = None
7107
        self._freeze = True
7108 1
7109 1
    def to_binary(self):
7110 1
        packet = []
7111 1
        packet.append(self.TypeDefinitionId.to_binary())
7112 1
        packet.append(uatype_Int32.pack(len(self.BrowsePath)))
7113 1
        for fieldname in self.BrowsePath:
7114 1
            packet.append(fieldname.to_binary())
7115 1
        packet.append(uatype_UInt32.pack(self.AttributeId))
7116 1
        packet.append(pack_string(self.IndexRange))
7117
        return b''.join(packet)
7118 1
7119
    @staticmethod
7120 1
    def from_binary(data):
7121
        return SimpleAttributeOperand(data)
7122 1
7123 1
    def _binary_init(self, data):
7124 1
        self.TypeDefinitionId = NodeId.from_binary(data)
7125 1
        length = uatype_Int32.unpack(data.read(4))[0]
7126 1
        array = []
7127 1
        if length != -1:
7128 1
            for _ in range(0, length):
7129 1
                array.append(QualifiedName.from_binary(data))
7130 1
        self.BrowsePath = array
7131 1
        self.AttributeId = uatype_UInt32.unpack(data.read(4))[0]
7132
        self.IndexRange = unpack_string(data)
7133 1
7134
    def __str__(self):
7135
        return 'SimpleAttributeOperand(' + 'TypeDefinitionId:' + str(self.TypeDefinitionId) + ', ' + \
7136
               'BrowsePath:' + str(self.BrowsePath) + ', ' + \
7137
               'AttributeId:' + str(self.AttributeId) + ', ' + \
7138
               'IndexRange:' + str(self.IndexRange) + ')'
7139 1
7140
    __repr__ = __str__
7141
7142 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
7143
class ContentFilterElementResult(FrozenClass):
7144
    '''
7145
    :ivar StatusCode:
7146
    :vartype StatusCode: StatusCode
7147
    :ivar OperandStatusCodes:
7148
    :vartype OperandStatusCodes: StatusCode
7149
    :ivar OperandDiagnosticInfos:
7150
    :vartype OperandDiagnosticInfos: DiagnosticInfo
7151 1
    '''
7152
    def __init__(self, binary=None):
7153
        if binary is not None:
7154
            self._binary_init(binary)
7155
            self._freeze = True
7156
            return
7157
        self.StatusCode = StatusCode()
7158
        self.OperandStatusCodes = []
7159
        self.OperandDiagnosticInfos = []
7160
        self._freeze = True
7161 1
7162
    def to_binary(self):
7163
        packet = []
7164
        packet.append(self.StatusCode.to_binary())
7165
        packet.append(uatype_Int32.pack(len(self.OperandStatusCodes)))
7166
        for fieldname in self.OperandStatusCodes:
7167
            packet.append(fieldname.to_binary())
7168
        packet.append(uatype_Int32.pack(len(self.OperandDiagnosticInfos)))
7169
        for fieldname in self.OperandDiagnosticInfos:
7170
            packet.append(fieldname.to_binary())
7171
        return b''.join(packet)
7172 1
7173
    @staticmethod
7174
    def from_binary(data):
7175
        return ContentFilterElementResult(data)
7176 1
7177
    def _binary_init(self, data):
7178
        self.StatusCode = StatusCode.from_binary(data)
7179
        length = uatype_Int32.unpack(data.read(4))[0]
7180
        array = []
7181
        if length != -1:
7182
            for _ in range(0, length):
7183
                array.append(StatusCode.from_binary(data))
7184
        self.OperandStatusCodes = array
7185
        length = uatype_Int32.unpack(data.read(4))[0]
7186
        array = []
7187
        if length != -1:
7188
            for _ in range(0, length):
7189
                array.append(DiagnosticInfo.from_binary(data))
7190
        self.OperandDiagnosticInfos = array
7191 1
7192
    def __str__(self):
7193
        return 'ContentFilterElementResult(' + 'StatusCode:' + str(self.StatusCode) + ', ' + \
7194
               'OperandStatusCodes:' + str(self.OperandStatusCodes) + ', ' + \
7195
               'OperandDiagnosticInfos:' + str(self.OperandDiagnosticInfos) + ')'
7196 1
7197
    __repr__ = __str__
7198
7199 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
7200
class ContentFilterResult(FrozenClass):
7201
    '''
7202
    :ivar ElementResults:
7203
    :vartype ElementResults: ContentFilterElementResult
7204
    :ivar ElementDiagnosticInfos:
7205
    :vartype ElementDiagnosticInfos: DiagnosticInfo
7206 1
    '''
7207 1
    def __init__(self, binary=None):
7208 1
        if binary is not None:
7209 1
            self._binary_init(binary)
7210 1
            self._freeze = True
7211 1
            return
7212 1
        self.ElementResults = []
7213 1
        self.ElementDiagnosticInfos = []
7214
        self._freeze = True
7215 1
7216 1
    def to_binary(self):
7217 1
        packet = []
7218 1
        packet.append(uatype_Int32.pack(len(self.ElementResults)))
7219
        for fieldname in self.ElementResults:
7220 1
            packet.append(fieldname.to_binary())
7221 1
        packet.append(uatype_Int32.pack(len(self.ElementDiagnosticInfos)))
7222
        for fieldname in self.ElementDiagnosticInfos:
7223 1
            packet.append(fieldname.to_binary())
7224
        return b''.join(packet)
7225 1
7226
    @staticmethod
7227 1
    def from_binary(data):
7228
        return ContentFilterResult(data)
7229 1
7230 1
    def _binary_init(self, data):
7231 1
        length = uatype_Int32.unpack(data.read(4))[0]
7232 1
        array = []
7233 1
        if length != -1:
7234
            for _ in range(0, length):
7235 1
                array.append(ContentFilterElementResult.from_binary(data))
7236 1
        self.ElementResults = array
7237 1
        length = uatype_Int32.unpack(data.read(4))[0]
7238 1
        array = []
7239 1
        if length != -1:
7240
            for _ in range(0, length):
7241 1
                array.append(DiagnosticInfo.from_binary(data))
7242
        self.ElementDiagnosticInfos = array
7243 1
7244
    def __str__(self):
7245
        return 'ContentFilterResult(' + 'ElementResults:' + str(self.ElementResults) + ', ' + \
7246
               'ElementDiagnosticInfos:' + str(self.ElementDiagnosticInfos) + ')'
7247 1
7248
    __repr__ = __str__
7249
7250 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
7251
class ParsingResult(FrozenClass):
7252
    '''
7253
    :ivar StatusCode:
7254
    :vartype StatusCode: StatusCode
7255
    :ivar DataStatusCodes:
7256
    :vartype DataStatusCodes: StatusCode
7257
    :ivar DataDiagnosticInfos:
7258
    :vartype DataDiagnosticInfos: DiagnosticInfo
7259 1
    '''
7260
    def __init__(self, binary=None):
7261
        if binary is not None:
7262
            self._binary_init(binary)
7263
            self._freeze = True
7264
            return
7265
        self.StatusCode = StatusCode()
7266
        self.DataStatusCodes = []
7267
        self.DataDiagnosticInfos = []
7268
        self._freeze = True
7269 1
7270
    def to_binary(self):
7271
        packet = []
7272
        packet.append(self.StatusCode.to_binary())
7273
        packet.append(uatype_Int32.pack(len(self.DataStatusCodes)))
7274
        for fieldname in self.DataStatusCodes:
7275
            packet.append(fieldname.to_binary())
7276
        packet.append(uatype_Int32.pack(len(self.DataDiagnosticInfos)))
7277
        for fieldname in self.DataDiagnosticInfos:
7278
            packet.append(fieldname.to_binary())
7279
        return b''.join(packet)
7280 1
7281
    @staticmethod
7282
    def from_binary(data):
7283
        return ParsingResult(data)
7284 1
7285
    def _binary_init(self, data):
7286
        self.StatusCode = StatusCode.from_binary(data)
7287
        length = uatype_Int32.unpack(data.read(4))[0]
7288
        array = []
7289
        if length != -1:
7290
            for _ in range(0, length):
7291
                array.append(StatusCode.from_binary(data))
7292
        self.DataStatusCodes = array
7293
        length = uatype_Int32.unpack(data.read(4))[0]
7294
        array = []
7295
        if length != -1:
7296
            for _ in range(0, length):
7297
                array.append(DiagnosticInfo.from_binary(data))
7298
        self.DataDiagnosticInfos = array
7299 1
7300
    def __str__(self):
7301
        return 'ParsingResult(' + 'StatusCode:' + str(self.StatusCode) + ', ' + \
7302
               'DataStatusCodes:' + str(self.DataStatusCodes) + ', ' + \
7303
               'DataDiagnosticInfos:' + str(self.DataDiagnosticInfos) + ')'
7304 1
7305
    __repr__ = __str__
7306
7307 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
7308
class QueryFirstParameters(FrozenClass):
7309
    '''
7310
    :ivar View:
7311
    :vartype View: ViewDescription
7312
    :ivar NodeTypes:
7313
    :vartype NodeTypes: NodeTypeDescription
7314
    :ivar Filter:
7315
    :vartype Filter: ContentFilter
7316
    :ivar MaxDataSetsToReturn:
7317
    :vartype MaxDataSetsToReturn: UInt32
7318
    :ivar MaxReferencesToReturn:
7319
    :vartype MaxReferencesToReturn: UInt32
7320 1
    '''
7321
    def __init__(self, binary=None):
7322
        if binary is not None:
7323
            self._binary_init(binary)
7324
            self._freeze = True
7325
            return
7326
        self.View = ViewDescription()
7327
        self.NodeTypes = []
7328
        self.Filter = ContentFilter()
7329
        self.MaxDataSetsToReturn = 0
7330
        self.MaxReferencesToReturn = 0
7331
        self._freeze = True
7332 1
7333
    def to_binary(self):
7334
        packet = []
7335
        packet.append(self.View.to_binary())
7336
        packet.append(uatype_Int32.pack(len(self.NodeTypes)))
7337
        for fieldname in self.NodeTypes:
7338
            packet.append(fieldname.to_binary())
7339
        packet.append(self.Filter.to_binary())
7340
        packet.append(uatype_UInt32.pack(self.MaxDataSetsToReturn))
7341
        packet.append(uatype_UInt32.pack(self.MaxReferencesToReturn))
7342
        return b''.join(packet)
7343 1
7344
    @staticmethod
7345
    def from_binary(data):
7346
        return QueryFirstParameters(data)
7347 1
7348
    def _binary_init(self, data):
7349
        self.View = ViewDescription.from_binary(data)
7350
        length = uatype_Int32.unpack(data.read(4))[0]
7351
        array = []
7352
        if length != -1:
7353
            for _ in range(0, length):
7354
                array.append(NodeTypeDescription.from_binary(data))
7355
        self.NodeTypes = array
7356
        self.Filter = ContentFilter.from_binary(data)
7357
        self.MaxDataSetsToReturn = uatype_UInt32.unpack(data.read(4))[0]
7358
        self.MaxReferencesToReturn = uatype_UInt32.unpack(data.read(4))[0]
7359 1
7360
    def __str__(self):
7361
        return 'QueryFirstParameters(' + 'View:' + str(self.View) + ', ' + \
7362
               'NodeTypes:' + str(self.NodeTypes) + ', ' + \
7363
               'Filter:' + str(self.Filter) + ', ' + \
7364
               'MaxDataSetsToReturn:' + str(self.MaxDataSetsToReturn) + ', ' + \
7365
               'MaxReferencesToReturn:' + str(self.MaxReferencesToReturn) + ')'
7366 1
7367
    __repr__ = __str__
7368
7369 1
7370
class QueryFirstRequest(FrozenClass):
7371
    '''
7372
    :ivar TypeId:
7373
    :vartype TypeId: NodeId
7374
    :ivar RequestHeader:
7375
    :vartype RequestHeader: RequestHeader
7376
    :ivar Parameters:
7377
    :vartype Parameters: QueryFirstParameters
7378 1
    '''
7379
    def __init__(self, binary=None):
7380
        if binary is not None:
7381
            self._binary_init(binary)
7382
            self._freeze = True
7383
            return
7384
        self.TypeId = FourByteNodeId(ObjectIds.QueryFirstRequest_Encoding_DefaultBinary)
7385
        self.RequestHeader = RequestHeader()
7386
        self.Parameters = QueryFirstParameters()
7387
        self._freeze = True
7388 1
7389
    def to_binary(self):
7390
        packet = []
7391
        packet.append(self.TypeId.to_binary())
7392
        packet.append(self.RequestHeader.to_binary())
7393
        packet.append(self.Parameters.to_binary())
7394
        return b''.join(packet)
7395 1
7396
    @staticmethod
7397
    def from_binary(data):
7398
        return QueryFirstRequest(data)
7399 1
7400
    def _binary_init(self, data):
7401
        self.TypeId = NodeId.from_binary(data)
7402
        self.RequestHeader = RequestHeader.from_binary(data)
7403
        self.Parameters = QueryFirstParameters.from_binary(data)
7404 1
7405
    def __str__(self):
7406
        return 'QueryFirstRequest(' + 'TypeId:' + str(self.TypeId) + ', ' + \
7407
               'RequestHeader:' + str(self.RequestHeader) + ', ' + \
7408
               'Parameters:' + str(self.Parameters) + ')'
7409 1
7410
    __repr__ = __str__
7411
7412 1
7413
class QueryFirstResult(FrozenClass):
7414
    '''
7415
    :ivar QueryDataSets:
7416
    :vartype QueryDataSets: QueryDataSet
7417
    :ivar ContinuationPoint:
7418
    :vartype ContinuationPoint: ByteString
7419
    :ivar ParsingResults:
7420
    :vartype ParsingResults: ParsingResult
7421
    :ivar DiagnosticInfos:
7422
    :vartype DiagnosticInfos: DiagnosticInfo
7423
    :ivar FilterResult:
7424
    :vartype FilterResult: ContentFilterResult
7425 1
    '''
7426
    def __init__(self, binary=None):
7427
        if binary is not None:
7428
            self._binary_init(binary)
7429
            self._freeze = True
7430
            return
7431
        self.QueryDataSets = []
7432
        self.ContinuationPoint = None
7433
        self.ParsingResults = []
7434
        self.DiagnosticInfos = []
7435
        self.FilterResult = ContentFilterResult()
7436
        self._freeze = True
7437 1
7438
    def to_binary(self):
7439
        packet = []
7440
        packet.append(uatype_Int32.pack(len(self.QueryDataSets)))
7441
        for fieldname in self.QueryDataSets:
7442
            packet.append(fieldname.to_binary())
7443
        packet.append(pack_bytes(self.ContinuationPoint))
7444
        packet.append(uatype_Int32.pack(len(self.ParsingResults)))
7445
        for fieldname in self.ParsingResults:
7446
            packet.append(fieldname.to_binary())
7447
        packet.append(uatype_Int32.pack(len(self.DiagnosticInfos)))
7448
        for fieldname in self.DiagnosticInfos:
7449
            packet.append(fieldname.to_binary())
7450
        packet.append(self.FilterResult.to_binary())
7451
        return b''.join(packet)
7452 1
7453
    @staticmethod
7454
    def from_binary(data):
7455
        return QueryFirstResult(data)
7456 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
7457
    def _binary_init(self, data):
7458
        length = uatype_Int32.unpack(data.read(4))[0]
7459
        array = []
7460
        if length != -1:
7461
            for _ in range(0, length):
7462
                array.append(QueryDataSet.from_binary(data))
7463
        self.QueryDataSets = array
7464
        self.ContinuationPoint = unpack_bytes(data)
7465
        length = uatype_Int32.unpack(data.read(4))[0]
7466
        array = []
7467
        if length != -1:
7468
            for _ in range(0, length):
7469
                array.append(ParsingResult.from_binary(data))
7470
        self.ParsingResults = array
7471
        length = uatype_Int32.unpack(data.read(4))[0]
7472
        array = []
7473
        if length != -1:
7474
            for _ in range(0, length):
7475
                array.append(DiagnosticInfo.from_binary(data))
7476
        self.DiagnosticInfos = array
7477
        self.FilterResult = ContentFilterResult.from_binary(data)
7478 1
7479
    def __str__(self):
7480
        return 'QueryFirstResult(' + 'QueryDataSets:' + str(self.QueryDataSets) + ', ' + \
7481
               'ContinuationPoint:' + str(self.ContinuationPoint) + ', ' + \
7482
               'ParsingResults:' + str(self.ParsingResults) + ', ' + \
7483
               'DiagnosticInfos:' + str(self.DiagnosticInfos) + ', ' + \
7484
               'FilterResult:' + str(self.FilterResult) + ')'
7485 1
7486
    __repr__ = __str__
7487
7488 1
7489
class QueryFirstResponse(FrozenClass):
7490
    '''
7491
    :ivar TypeId:
7492
    :vartype TypeId: NodeId
7493
    :ivar ResponseHeader:
7494
    :vartype ResponseHeader: ResponseHeader
7495
    :ivar Parameters:
7496
    :vartype Parameters: QueryFirstResult
7497 1
    '''
7498
    def __init__(self, binary=None):
7499
        if binary is not None:
7500
            self._binary_init(binary)
7501
            self._freeze = True
7502
            return
7503
        self.TypeId = FourByteNodeId(ObjectIds.QueryFirstResponse_Encoding_DefaultBinary)
7504
        self.ResponseHeader = ResponseHeader()
7505
        self.Parameters = QueryFirstResult()
7506
        self._freeze = True
7507 1
7508
    def to_binary(self):
7509
        packet = []
7510
        packet.append(self.TypeId.to_binary())
7511
        packet.append(self.ResponseHeader.to_binary())
7512
        packet.append(self.Parameters.to_binary())
7513
        return b''.join(packet)
7514 1
7515
    @staticmethod
7516
    def from_binary(data):
7517
        return QueryFirstResponse(data)
7518 1
7519
    def _binary_init(self, data):
7520
        self.TypeId = NodeId.from_binary(data)
7521
        self.ResponseHeader = ResponseHeader.from_binary(data)
7522
        self.Parameters = QueryFirstResult.from_binary(data)
7523 1
7524
    def __str__(self):
7525
        return 'QueryFirstResponse(' + 'TypeId:' + str(self.TypeId) + ', ' + \
7526
               'ResponseHeader:' + str(self.ResponseHeader) + ', ' + \
7527
               'Parameters:' + str(self.Parameters) + ')'
7528 1
7529
    __repr__ = __str__
7530
7531 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
7532
class QueryNextParameters(FrozenClass):
7533
    '''
7534
    :ivar ReleaseContinuationPoint:
7535
    :vartype ReleaseContinuationPoint: Boolean
7536
    :ivar ContinuationPoint:
7537
    :vartype ContinuationPoint: ByteString
7538 1
    '''
7539
    def __init__(self, binary=None):
7540
        if binary is not None:
7541
            self._binary_init(binary)
7542
            self._freeze = True
7543
            return
7544
        self.ReleaseContinuationPoint = True
7545
        self.ContinuationPoint = None
7546
        self._freeze = True
7547 1
7548
    def to_binary(self):
7549
        packet = []
7550
        packet.append(uatype_Boolean.pack(self.ReleaseContinuationPoint))
7551
        packet.append(pack_bytes(self.ContinuationPoint))
7552
        return b''.join(packet)
7553 1
7554
    @staticmethod
7555
    def from_binary(data):
7556
        return QueryNextParameters(data)
7557 1
7558
    def _binary_init(self, data):
7559
        self.ReleaseContinuationPoint = uatype_Boolean.unpack(data.read(1))[0]
7560
        self.ContinuationPoint = unpack_bytes(data)
7561 1
7562
    def __str__(self):
7563
        return 'QueryNextParameters(' + 'ReleaseContinuationPoint:' + str(self.ReleaseContinuationPoint) + ', ' + \
7564
               'ContinuationPoint:' + str(self.ContinuationPoint) + ')'
7565 1
7566
    __repr__ = __str__
7567
7568 1
7569
class QueryNextRequest(FrozenClass):
7570
    '''
7571
    :ivar TypeId:
7572
    :vartype TypeId: NodeId
7573
    :ivar RequestHeader:
7574
    :vartype RequestHeader: RequestHeader
7575
    :ivar Parameters:
7576
    :vartype Parameters: QueryNextParameters
7577 1
    '''
7578
    def __init__(self, binary=None):
7579
        if binary is not None:
7580
            self._binary_init(binary)
7581
            self._freeze = True
7582
            return
7583
        self.TypeId = FourByteNodeId(ObjectIds.QueryNextRequest_Encoding_DefaultBinary)
7584
        self.RequestHeader = RequestHeader()
7585
        self.Parameters = QueryNextParameters()
7586
        self._freeze = True
7587 1
7588
    def to_binary(self):
7589
        packet = []
7590
        packet.append(self.TypeId.to_binary())
7591
        packet.append(self.RequestHeader.to_binary())
7592
        packet.append(self.Parameters.to_binary())
7593
        return b''.join(packet)
7594 1
7595
    @staticmethod
7596
    def from_binary(data):
7597
        return QueryNextRequest(data)
7598 1
7599
    def _binary_init(self, data):
7600
        self.TypeId = NodeId.from_binary(data)
7601
        self.RequestHeader = RequestHeader.from_binary(data)
7602
        self.Parameters = QueryNextParameters.from_binary(data)
7603 1
7604
    def __str__(self):
7605
        return 'QueryNextRequest(' + 'TypeId:' + str(self.TypeId) + ', ' + \
7606
               'RequestHeader:' + str(self.RequestHeader) + ', ' + \
7607
               'Parameters:' + str(self.Parameters) + ')'
7608 1
7609
    __repr__ = __str__
7610
7611 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
7612
class QueryNextResult(FrozenClass):
7613
    '''
7614
    :ivar QueryDataSets:
7615
    :vartype QueryDataSets: QueryDataSet
7616
    :ivar RevisedContinuationPoint:
7617
    :vartype RevisedContinuationPoint: ByteString
7618 1
    '''
7619
    def __init__(self, binary=None):
7620
        if binary is not None:
7621
            self._binary_init(binary)
7622
            self._freeze = True
7623
            return
7624
        self.QueryDataSets = []
7625
        self.RevisedContinuationPoint = None
7626
        self._freeze = True
7627 1
7628
    def to_binary(self):
7629
        packet = []
7630
        packet.append(uatype_Int32.pack(len(self.QueryDataSets)))
7631
        for fieldname in self.QueryDataSets:
7632
            packet.append(fieldname.to_binary())
7633
        packet.append(pack_bytes(self.RevisedContinuationPoint))
7634
        return b''.join(packet)
7635 1
7636
    @staticmethod
7637
    def from_binary(data):
7638
        return QueryNextResult(data)
7639 1
7640
    def _binary_init(self, data):
7641
        length = uatype_Int32.unpack(data.read(4))[0]
7642
        array = []
7643
        if length != -1:
7644
            for _ in range(0, length):
7645
                array.append(QueryDataSet.from_binary(data))
7646
        self.QueryDataSets = array
7647
        self.RevisedContinuationPoint = unpack_bytes(data)
7648 1
7649
    def __str__(self):
7650
        return 'QueryNextResult(' + 'QueryDataSets:' + str(self.QueryDataSets) + ', ' + \
7651
               'RevisedContinuationPoint:' + str(self.RevisedContinuationPoint) + ')'
7652 1
7653
    __repr__ = __str__
7654
7655 1
7656
class QueryNextResponse(FrozenClass):
7657
    '''
7658
    :ivar TypeId:
7659
    :vartype TypeId: NodeId
7660
    :ivar ResponseHeader:
7661
    :vartype ResponseHeader: ResponseHeader
7662
    :ivar Parameters:
7663
    :vartype Parameters: QueryNextResult
7664 1
    '''
7665
    def __init__(self, binary=None):
7666
        if binary is not None:
7667
            self._binary_init(binary)
7668
            self._freeze = True
7669
            return
7670
        self.TypeId = FourByteNodeId(ObjectIds.QueryNextResponse_Encoding_DefaultBinary)
7671
        self.ResponseHeader = ResponseHeader()
7672
        self.Parameters = QueryNextResult()
7673
        self._freeze = True
7674 1
7675
    def to_binary(self):
7676
        packet = []
7677
        packet.append(self.TypeId.to_binary())
7678
        packet.append(self.ResponseHeader.to_binary())
7679
        packet.append(self.Parameters.to_binary())
7680
        return b''.join(packet)
7681 1
7682
    @staticmethod
7683
    def from_binary(data):
7684
        return QueryNextResponse(data)
7685 1
7686
    def _binary_init(self, data):
7687
        self.TypeId = NodeId.from_binary(data)
7688
        self.ResponseHeader = ResponseHeader.from_binary(data)
7689
        self.Parameters = QueryNextResult.from_binary(data)
7690 1
7691
    def __str__(self):
7692
        return 'QueryNextResponse(' + 'TypeId:' + str(self.TypeId) + ', ' + \
7693
               'ResponseHeader:' + str(self.ResponseHeader) + ', ' + \
7694
               'Parameters:' + str(self.Parameters) + ')'
7695 1
7696
    __repr__ = __str__
7697
7698 1
7699
class ReadValueId(FrozenClass):
7700
    '''
7701
    :ivar NodeId:
7702
    :vartype NodeId: NodeId
7703
    :ivar AttributeId:
7704
    :vartype AttributeId: UInt32
7705
    :ivar IndexRange:
7706
    :vartype IndexRange: String
7707
    :ivar DataEncoding:
7708
    :vartype DataEncoding: QualifiedName
7709 1
    '''
7710 1
    def __init__(self, binary=None):
7711 1
        if binary is not None:
7712 1
            self._binary_init(binary)
7713 1
            self._freeze = True
7714 1
            return
7715 1
        self.NodeId = NodeId()
7716 1
        self.AttributeId = 0
7717 1
        self.IndexRange = None
7718 1
        self.DataEncoding = QualifiedName()
7719
        self._freeze = True
7720 1
7721 1
    def to_binary(self):
7722 1
        packet = []
7723 1
        packet.append(self.NodeId.to_binary())
7724 1
        packet.append(uatype_UInt32.pack(self.AttributeId))
7725 1
        packet.append(pack_string(self.IndexRange))
7726 1
        packet.append(self.DataEncoding.to_binary())
7727
        return b''.join(packet)
7728 1
7729
    @staticmethod
7730 1
    def from_binary(data):
7731
        return ReadValueId(data)
7732 1
7733 1
    def _binary_init(self, data):
7734 1
        self.NodeId = NodeId.from_binary(data)
7735 1
        self.AttributeId = uatype_UInt32.unpack(data.read(4))[0]
7736 1
        self.IndexRange = unpack_string(data)
7737
        self.DataEncoding = QualifiedName.from_binary(data)
7738 1
7739
    def __str__(self):
7740
        return 'ReadValueId(' + 'NodeId:' + str(self.NodeId) + ', ' + \
7741
               'AttributeId:' + str(self.AttributeId) + ', ' + \
7742
               'IndexRange:' + str(self.IndexRange) + ', ' + \
7743
               'DataEncoding:' + str(self.DataEncoding) + ')'
7744 1
7745
    __repr__ = __str__
7746
7747 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
7748
class ReadParameters(FrozenClass):
7749
    '''
7750
    :ivar MaxAge:
7751
    :vartype MaxAge: Double
7752
    :ivar TimestampsToReturn:
7753
    :vartype TimestampsToReturn: TimestampsToReturn
7754
    :ivar NodesToRead:
7755
    :vartype NodesToRead: ReadValueId
7756 1
    '''
7757 1
    def __init__(self, binary=None):
7758 1
        if binary is not None:
7759 1
            self._binary_init(binary)
7760 1
            self._freeze = True
7761 1
            return
7762 1
        self.MaxAge = 0
7763 1
        self.TimestampsToReturn = TimestampsToReturn(0)
7764 1
        self.NodesToRead = []
7765
        self._freeze = True
7766 1
7767 1
    def to_binary(self):
7768 1
        packet = []
7769 1
        packet.append(uatype_Double.pack(self.MaxAge))
7770 1
        packet.append(uatype_UInt32.pack(self.TimestampsToReturn.value))
7771 1
        packet.append(uatype_Int32.pack(len(self.NodesToRead)))
7772 1
        for fieldname in self.NodesToRead:
7773 1
            packet.append(fieldname.to_binary())
7774
        return b''.join(packet)
7775 1
7776
    @staticmethod
7777 1
    def from_binary(data):
7778
        return ReadParameters(data)
7779 1
7780 1
    def _binary_init(self, data):
7781 1
        self.MaxAge = uatype_Double.unpack(data.read(8))[0]
7782 1
        self.TimestampsToReturn = TimestampsToReturn(uatype_UInt32.unpack(data.read(4))[0])
7783 1
        length = uatype_Int32.unpack(data.read(4))[0]
7784 1
        array = []
7785 1
        if length != -1:
7786 1
            for _ in range(0, length):
7787 1
                array.append(ReadValueId.from_binary(data))
7788
        self.NodesToRead = array
7789 1
7790
    def __str__(self):
7791
        return 'ReadParameters(' + 'MaxAge:' + str(self.MaxAge) + ', ' + \
7792
               'TimestampsToReturn:' + str(self.TimestampsToReturn) + ', ' + \
7793
               'NodesToRead:' + str(self.NodesToRead) + ')'
7794 1
7795
    __repr__ = __str__
7796
7797 1
7798
class ReadRequest(FrozenClass):
7799
    '''
7800
    :ivar TypeId:
7801
    :vartype TypeId: NodeId
7802
    :ivar RequestHeader:
7803
    :vartype RequestHeader: RequestHeader
7804
    :ivar Parameters:
7805
    :vartype Parameters: ReadParameters
7806 1
    '''
7807 1
    def __init__(self, binary=None):
7808
        if binary is not None:
7809
            self._binary_init(binary)
7810
            self._freeze = True
7811 1
            return
7812 1
        self.TypeId = FourByteNodeId(ObjectIds.ReadRequest_Encoding_DefaultBinary)
7813 1
        self.RequestHeader = RequestHeader()
7814 1
        self.Parameters = ReadParameters()
7815
        self._freeze = True
7816 1
7817 1
    def to_binary(self):
7818 1
        packet = []
7819 1
        packet.append(self.TypeId.to_binary())
7820 1
        packet.append(self.RequestHeader.to_binary())
7821 1
        packet.append(self.Parameters.to_binary())
7822
        return b''.join(packet)
7823 1
7824
    @staticmethod
7825
    def from_binary(data):
7826
        return ReadRequest(data)
7827 1
7828
    def _binary_init(self, data):
7829
        self.TypeId = NodeId.from_binary(data)
7830
        self.RequestHeader = RequestHeader.from_binary(data)
7831
        self.Parameters = ReadParameters.from_binary(data)
7832 1
7833
    def __str__(self):
7834
        return 'ReadRequest(' + 'TypeId:' + str(self.TypeId) + ', ' + \
7835
               'RequestHeader:' + str(self.RequestHeader) + ', ' + \
7836
               'Parameters:' + str(self.Parameters) + ')'
7837 1
7838
    __repr__ = __str__
7839
7840 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
7841
class ReadResponse(FrozenClass):
7842
    '''
7843
    :ivar TypeId:
7844
    :vartype TypeId: NodeId
7845
    :ivar ResponseHeader:
7846
    :vartype ResponseHeader: ResponseHeader
7847
    :ivar Results:
7848
    :vartype Results: DataValue
7849
    :ivar DiagnosticInfos:
7850
    :vartype DiagnosticInfos: DiagnosticInfo
7851 1
    '''
7852 1
    def __init__(self, binary=None):
7853 1
        if binary is not None:
7854 1
            self._binary_init(binary)
7855 1
            self._freeze = True
7856 1
            return
7857 1
        self.TypeId = FourByteNodeId(ObjectIds.ReadResponse_Encoding_DefaultBinary)
7858 1
        self.ResponseHeader = ResponseHeader()
7859 1
        self.Results = []
7860 1
        self.DiagnosticInfos = []
7861
        self._freeze = True
7862 1
7863 1
    def to_binary(self):
7864 1
        packet = []
7865 1
        packet.append(self.TypeId.to_binary())
7866 1
        packet.append(self.ResponseHeader.to_binary())
7867 1
        packet.append(uatype_Int32.pack(len(self.Results)))
7868 1
        for fieldname in self.Results:
7869 1
            packet.append(fieldname.to_binary())
7870 1
        packet.append(uatype_Int32.pack(len(self.DiagnosticInfos)))
7871
        for fieldname in self.DiagnosticInfos:
7872 1
            packet.append(fieldname.to_binary())
7873
        return b''.join(packet)
7874 1
7875
    @staticmethod
7876 1
    def from_binary(data):
7877
        return ReadResponse(data)
7878 1
7879 1
    def _binary_init(self, data):
7880 1
        self.TypeId = NodeId.from_binary(data)
7881 1
        self.ResponseHeader = ResponseHeader.from_binary(data)
7882 1
        length = uatype_Int32.unpack(data.read(4))[0]
7883 1
        array = []
7884 1
        if length != -1:
7885 1
            for _ in range(0, length):
7886 1
                array.append(DataValue.from_binary(data))
7887 1
        self.Results = array
7888 1
        length = uatype_Int32.unpack(data.read(4))[0]
7889 1
        array = []
7890 1
        if length != -1:
7891
            for _ in range(0, length):
7892 1
                array.append(DiagnosticInfo.from_binary(data))
7893
        self.DiagnosticInfos = array
7894 1
7895
    def __str__(self):
7896
        return 'ReadResponse(' + 'TypeId:' + str(self.TypeId) + ', ' + \
7897
               'ResponseHeader:' + str(self.ResponseHeader) + ', ' + \
7898
               'Results:' + str(self.Results) + ', ' + \
7899
               'DiagnosticInfos:' + str(self.DiagnosticInfos) + ')'
7900 1
7901
    __repr__ = __str__
7902
7903 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
7904
class HistoryReadValueId(FrozenClass):
7905
    '''
7906
    :ivar NodeId:
7907
    :vartype NodeId: NodeId
7908
    :ivar IndexRange:
7909
    :vartype IndexRange: String
7910
    :ivar DataEncoding:
7911
    :vartype DataEncoding: QualifiedName
7912
    :ivar ContinuationPoint:
7913
    :vartype ContinuationPoint: ByteString
7914 1
    '''
7915 1
    def __init__(self, binary=None):
7916
        if binary is not None:
7917
            self._binary_init(binary)
7918
            self._freeze = True
7919 1
            return
7920 1
        self.NodeId = NodeId()
7921 1
        self.IndexRange = None
7922 1
        self.DataEncoding = QualifiedName()
7923 1
        self.ContinuationPoint = None
7924
        self._freeze = True
7925 1
7926
    def to_binary(self):
7927
        packet = []
7928
        packet.append(self.NodeId.to_binary())
7929
        packet.append(pack_string(self.IndexRange))
7930
        packet.append(self.DataEncoding.to_binary())
7931
        packet.append(pack_bytes(self.ContinuationPoint))
7932
        return b''.join(packet)
7933 1
7934
    @staticmethod
7935
    def from_binary(data):
7936
        return HistoryReadValueId(data)
7937 1
7938
    def _binary_init(self, data):
7939
        self.NodeId = NodeId.from_binary(data)
7940
        self.IndexRange = unpack_string(data)
7941
        self.DataEncoding = QualifiedName.from_binary(data)
7942
        self.ContinuationPoint = unpack_bytes(data)
7943 1
7944
    def __str__(self):
7945
        return 'HistoryReadValueId(' + 'NodeId:' + str(self.NodeId) + ', ' + \
7946
               'IndexRange:' + str(self.IndexRange) + ', ' + \
7947
               'DataEncoding:' + str(self.DataEncoding) + ', ' + \
7948
               'ContinuationPoint:' + str(self.ContinuationPoint) + ')'
7949 1
7950
    __repr__ = __str__
7951
7952 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
7953
class HistoryReadResult(FrozenClass):
7954
    '''
7955
    :ivar StatusCode:
7956
    :vartype StatusCode: StatusCode
7957
    :ivar ContinuationPoint:
7958
    :vartype ContinuationPoint: ByteString
7959
    :ivar HistoryData:
7960
    :vartype HistoryData: ExtensionObject
7961 1
    '''
7962 1
    def __init__(self, binary=None):
7963
        if binary is not None:
7964
            self._binary_init(binary)
7965
            self._freeze = True
7966 1
            return
7967 1
        self.StatusCode = StatusCode()
7968 1
        self.ContinuationPoint = None
7969 1
        self.HistoryData = None
7970
        self._freeze = True
7971 1
7972
    def to_binary(self):
7973
        packet = []
7974
        packet.append(self.StatusCode.to_binary())
7975
        packet.append(pack_bytes(self.ContinuationPoint))
7976
        packet.append(extensionobject_to_binary(self.HistoryData))
7977
        return b''.join(packet)
7978 1
7979
    @staticmethod
7980
    def from_binary(data):
7981
        return HistoryReadResult(data)
7982 1
7983
    def _binary_init(self, data):
7984
        self.StatusCode = StatusCode.from_binary(data)
7985
        self.ContinuationPoint = unpack_bytes(data)
7986
        self.HistoryData = extensionobject_from_binary(data)
7987 1
7988
    def __str__(self):
7989
        return 'HistoryReadResult(' + 'StatusCode:' + str(self.StatusCode) + ', ' + \
7990
               'ContinuationPoint:' + str(self.ContinuationPoint) + ', ' + \
7991
               'HistoryData:' + str(self.HistoryData) + ')'
7992 1
7993
    __repr__ = __str__
7994
7995 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
7996
class HistoryReadDetails(FrozenClass):
7997
    '''
7998 1
    '''
7999
    def __init__(self, binary=None):
8000
        if binary is not None:
8001
            self._binary_init(binary)
8002
            self._freeze = True
8003
            return
8004
        self._freeze = True
8005 1
8006
    def to_binary(self):
8007
        packet = []
8008
        return b''.join(packet)
8009 1
8010
    @staticmethod
8011
    def from_binary(data):
8012
        return HistoryReadDetails(data)
8013 1
8014
    def _binary_init(self, data):
8015
        pass
8016 1
8017
    def __str__(self):
8018
        return 'HistoryReadDetails(' +  + ')'
8019 1
8020
    __repr__ = __str__
8021
8022 1
8023
class ReadEventDetails(FrozenClass):
8024
    '''
8025
    :ivar NumValuesPerNode:
8026
    :vartype NumValuesPerNode: UInt32
8027
    :ivar StartTime:
8028
    :vartype StartTime: DateTime
8029
    :ivar EndTime:
8030
    :vartype EndTime: DateTime
8031
    :ivar Filter:
8032
    :vartype Filter: EventFilter
8033 1
    '''
8034 1
    def __init__(self, binary=None):
8035
        if binary is not None:
8036
            self._binary_init(binary)
8037
            self._freeze = True
8038 1
            return
8039 1
        self.NumValuesPerNode = 0
8040 1
        self.StartTime = datetime.now()
8041 1
        self.EndTime = datetime.now()
8042 1
        self.Filter = EventFilter()
8043
        self._freeze = True
8044 1
8045
    def to_binary(self):
8046
        packet = []
8047
        packet.append(uatype_UInt32.pack(self.NumValuesPerNode))
8048
        packet.append(pack_datetime(self.StartTime))
8049
        packet.append(pack_datetime(self.EndTime))
8050
        packet.append(self.Filter.to_binary())
8051
        return b''.join(packet)
8052 1
8053
    @staticmethod
8054
    def from_binary(data):
8055
        return ReadEventDetails(data)
8056 1
8057
    def _binary_init(self, data):
8058
        self.NumValuesPerNode = uatype_UInt32.unpack(data.read(4))[0]
8059
        self.StartTime = unpack_datetime(data)
8060
        self.EndTime = unpack_datetime(data)
8061
        self.Filter = EventFilter.from_binary(data)
8062 1
8063
    def __str__(self):
8064
        return 'ReadEventDetails(' + 'NumValuesPerNode:' + str(self.NumValuesPerNode) + ', ' + \
8065
               'StartTime:' + str(self.StartTime) + ', ' + \
8066
               'EndTime:' + str(self.EndTime) + ', ' + \
8067
               'Filter:' + str(self.Filter) + ')'
8068 1
8069
    __repr__ = __str__
8070
8071 1
8072
class ReadRawModifiedDetails(FrozenClass):
8073
    '''
8074
    :ivar IsReadModified:
8075
    :vartype IsReadModified: Boolean
8076
    :ivar StartTime:
8077
    :vartype StartTime: DateTime
8078
    :ivar EndTime:
8079
    :vartype EndTime: DateTime
8080
    :ivar NumValuesPerNode:
8081
    :vartype NumValuesPerNode: UInt32
8082
    :ivar ReturnBounds:
8083
    :vartype ReturnBounds: Boolean
8084 1
    '''
8085 1
    def __init__(self, binary=None):
8086
        if binary is not None:
8087
            self._binary_init(binary)
8088
            self._freeze = True
8089 1
            return
8090 1
        self.IsReadModified = True
8091 1
        self.StartTime = datetime.now()
8092 1
        self.EndTime = datetime.now()
8093 1
        self.NumValuesPerNode = 0
8094 1
        self.ReturnBounds = True
8095
        self._freeze = True
8096 1
8097
    def to_binary(self):
8098
        packet = []
8099
        packet.append(uatype_Boolean.pack(self.IsReadModified))
8100
        packet.append(pack_datetime(self.StartTime))
8101
        packet.append(pack_datetime(self.EndTime))
8102
        packet.append(uatype_UInt32.pack(self.NumValuesPerNode))
8103
        packet.append(uatype_Boolean.pack(self.ReturnBounds))
8104
        return b''.join(packet)
8105 1
8106
    @staticmethod
8107
    def from_binary(data):
8108
        return ReadRawModifiedDetails(data)
8109 1
8110
    def _binary_init(self, data):
8111
        self.IsReadModified = uatype_Boolean.unpack(data.read(1))[0]
8112
        self.StartTime = unpack_datetime(data)
8113
        self.EndTime = unpack_datetime(data)
8114
        self.NumValuesPerNode = uatype_UInt32.unpack(data.read(4))[0]
8115
        self.ReturnBounds = uatype_Boolean.unpack(data.read(1))[0]
8116 1
8117
    def __str__(self):
8118
        return 'ReadRawModifiedDetails(' + 'IsReadModified:' + str(self.IsReadModified) + ', ' + \
8119
               'StartTime:' + str(self.StartTime) + ', ' + \
8120
               'EndTime:' + str(self.EndTime) + ', ' + \
8121
               'NumValuesPerNode:' + str(self.NumValuesPerNode) + ', ' + \
8122
               'ReturnBounds:' + str(self.ReturnBounds) + ')'
8123 1
8124
    __repr__ = __str__
8125
8126 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
8127
class ReadProcessedDetails(FrozenClass):
8128
    '''
8129
    :ivar StartTime:
8130
    :vartype StartTime: DateTime
8131
    :ivar EndTime:
8132
    :vartype EndTime: DateTime
8133
    :ivar ProcessingInterval:
8134
    :vartype ProcessingInterval: Double
8135
    :ivar AggregateType:
8136
    :vartype AggregateType: NodeId
8137
    :ivar AggregateConfiguration:
8138
    :vartype AggregateConfiguration: AggregateConfiguration
8139 1
    '''
8140
    def __init__(self, binary=None):
8141
        if binary is not None:
8142
            self._binary_init(binary)
8143
            self._freeze = True
8144
            return
8145
        self.StartTime = datetime.now()
8146
        self.EndTime = datetime.now()
8147
        self.ProcessingInterval = 0
8148
        self.AggregateType = []
8149
        self.AggregateConfiguration = AggregateConfiguration()
8150
        self._freeze = True
8151 1
8152
    def to_binary(self):
8153
        packet = []
8154
        packet.append(pack_datetime(self.StartTime))
8155
        packet.append(pack_datetime(self.EndTime))
8156
        packet.append(uatype_Double.pack(self.ProcessingInterval))
8157
        packet.append(uatype_Int32.pack(len(self.AggregateType)))
8158
        for fieldname in self.AggregateType:
8159
            packet.append(fieldname.to_binary())
8160
        packet.append(self.AggregateConfiguration.to_binary())
8161
        return b''.join(packet)
8162 1
8163
    @staticmethod
8164
    def from_binary(data):
8165
        return ReadProcessedDetails(data)
8166 1
8167
    def _binary_init(self, data):
8168
        self.StartTime = unpack_datetime(data)
8169
        self.EndTime = unpack_datetime(data)
8170
        self.ProcessingInterval = uatype_Double.unpack(data.read(8))[0]
8171
        length = uatype_Int32.unpack(data.read(4))[0]
8172
        array = []
8173
        if length != -1:
8174
            for _ in range(0, length):
8175
                array.append(NodeId.from_binary(data))
8176
        self.AggregateType = array
8177
        self.AggregateConfiguration = AggregateConfiguration.from_binary(data)
8178 1
8179
    def __str__(self):
8180
        return 'ReadProcessedDetails(' + 'StartTime:' + str(self.StartTime) + ', ' + \
8181
               'EndTime:' + str(self.EndTime) + ', ' + \
8182
               'ProcessingInterval:' + str(self.ProcessingInterval) + ', ' + \
8183
               'AggregateType:' + str(self.AggregateType) + ', ' + \
8184
               'AggregateConfiguration:' + str(self.AggregateConfiguration) + ')'
8185 1
8186
    __repr__ = __str__
8187
8188 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
8189
class ReadAtTimeDetails(FrozenClass):
8190
    '''
8191
    :ivar ReqTimes:
8192
    :vartype ReqTimes: DateTime
8193
    :ivar UseSimpleBounds:
8194
    :vartype UseSimpleBounds: Boolean
8195 1
    '''
8196
    def __init__(self, binary=None):
8197
        if binary is not None:
8198
            self._binary_init(binary)
8199
            self._freeze = True
8200
            return
8201
        self.ReqTimes = []
8202
        self.UseSimpleBounds = True
8203
        self._freeze = True
8204 1
8205
    def to_binary(self):
8206
        packet = []
8207
        packet.append(uatype_Int32.pack(len(self.ReqTimes)))
8208
        for fieldname in self.ReqTimes:
8209
            packet.append(pack_datetime(fieldname))
8210
        packet.append(uatype_Boolean.pack(self.UseSimpleBounds))
8211
        return b''.join(packet)
8212 1
8213
    @staticmethod
8214
    def from_binary(data):
8215
        return ReadAtTimeDetails(data)
8216 1
8217
    def _binary_init(self, data):
8218
        self.ReqTimes = unpack_uatype_array('DateTime', data)
8219
        self.UseSimpleBounds = uatype_Boolean.unpack(data.read(1))[0]
8220 1
8221
    def __str__(self):
8222
        return 'ReadAtTimeDetails(' + 'ReqTimes:' + str(self.ReqTimes) + ', ' + \
8223
               'UseSimpleBounds:' + str(self.UseSimpleBounds) + ')'
8224 1
8225
    __repr__ = __str__
8226
8227 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
8228
class HistoryData(FrozenClass):
8229
    '''
8230
    :ivar DataValues:
8231
    :vartype DataValues: DataValue
8232 1
    '''
8233 1
    def __init__(self, binary=None):
8234
        if binary is not None:
8235
            self._binary_init(binary)
8236
            self._freeze = True
8237 1
            return
8238 1
        self.DataValues = []
8239
        self._freeze = True
8240 1
8241
    def to_binary(self):
8242
        packet = []
8243
        packet.append(uatype_Int32.pack(len(self.DataValues)))
8244
        for fieldname in self.DataValues:
8245
            packet.append(fieldname.to_binary())
8246
        return b''.join(packet)
8247 1
8248
    @staticmethod
8249
    def from_binary(data):
8250
        return HistoryData(data)
8251 1
8252
    def _binary_init(self, data):
8253
        length = uatype_Int32.unpack(data.read(4))[0]
8254
        array = []
8255
        if length != -1:
8256
            for _ in range(0, length):
8257
                array.append(DataValue.from_binary(data))
8258
        self.DataValues = array
8259 1
8260
    def __str__(self):
8261
        return 'HistoryData(' + 'DataValues:' + str(self.DataValues) + ')'
8262 1
8263
    __repr__ = __str__
8264
8265 1
8266
class ModificationInfo(FrozenClass):
8267
    '''
8268
    :ivar ModificationTime:
8269
    :vartype ModificationTime: DateTime
8270
    :ivar UpdateType:
8271
    :vartype UpdateType: HistoryUpdateType
8272
    :ivar UserName:
8273
    :vartype UserName: String
8274 1
    '''
8275
    def __init__(self, binary=None):
8276
        if binary is not None:
8277
            self._binary_init(binary)
8278
            self._freeze = True
8279
            return
8280
        self.ModificationTime = datetime.now()
8281
        self.UpdateType = HistoryUpdateType(0)
8282
        self.UserName = None
8283
        self._freeze = True
8284 1
8285
    def to_binary(self):
8286
        packet = []
8287
        packet.append(pack_datetime(self.ModificationTime))
8288
        packet.append(uatype_UInt32.pack(self.UpdateType.value))
8289
        packet.append(pack_string(self.UserName))
8290
        return b''.join(packet)
8291 1
8292
    @staticmethod
8293
    def from_binary(data):
8294
        return ModificationInfo(data)
8295 1
8296
    def _binary_init(self, data):
8297
        self.ModificationTime = unpack_datetime(data)
8298
        self.UpdateType = HistoryUpdateType(uatype_UInt32.unpack(data.read(4))[0])
8299
        self.UserName = unpack_string(data)
8300 1
8301
    def __str__(self):
8302
        return 'ModificationInfo(' + 'ModificationTime:' + str(self.ModificationTime) + ', ' + \
8303
               'UpdateType:' + str(self.UpdateType) + ', ' + \
8304
               'UserName:' + str(self.UserName) + ')'
8305 1
8306
    __repr__ = __str__
8307
8308 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
8309
class HistoryModifiedData(FrozenClass):
8310
    '''
8311
    :ivar DataValues:
8312
    :vartype DataValues: DataValue
8313
    :ivar ModificationInfos:
8314
    :vartype ModificationInfos: ModificationInfo
8315 1
    '''
8316
    def __init__(self, binary=None):
8317
        if binary is not None:
8318
            self._binary_init(binary)
8319
            self._freeze = True
8320
            return
8321
        self.DataValues = []
8322
        self.ModificationInfos = []
8323
        self._freeze = True
8324 1
8325
    def to_binary(self):
8326
        packet = []
8327
        packet.append(uatype_Int32.pack(len(self.DataValues)))
8328
        for fieldname in self.DataValues:
8329
            packet.append(fieldname.to_binary())
8330
        packet.append(uatype_Int32.pack(len(self.ModificationInfos)))
8331
        for fieldname in self.ModificationInfos:
8332
            packet.append(fieldname.to_binary())
8333
        return b''.join(packet)
8334 1
8335
    @staticmethod
8336
    def from_binary(data):
8337
        return HistoryModifiedData(data)
8338 1
8339
    def _binary_init(self, data):
8340
        length = uatype_Int32.unpack(data.read(4))[0]
8341
        array = []
8342
        if length != -1:
8343
            for _ in range(0, length):
8344
                array.append(DataValue.from_binary(data))
8345
        self.DataValues = array
8346
        length = uatype_Int32.unpack(data.read(4))[0]
8347
        array = []
8348
        if length != -1:
8349
            for _ in range(0, length):
8350
                array.append(ModificationInfo.from_binary(data))
8351
        self.ModificationInfos = array
8352 1
8353
    def __str__(self):
8354
        return 'HistoryModifiedData(' + 'DataValues:' + str(self.DataValues) + ', ' + \
8355
               'ModificationInfos:' + str(self.ModificationInfos) + ')'
8356 1
8357
    __repr__ = __str__
8358
8359 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
8360
class HistoryEvent(FrozenClass):
8361
    '''
8362
    :ivar Events:
8363
    :vartype Events: HistoryEventFieldList
8364 1
    '''
8365 1
    def __init__(self, binary=None):
8366
        if binary is not None:
8367
            self._binary_init(binary)
8368
            self._freeze = True
8369 1
            return
8370 1
        self.Events = []
8371
        self._freeze = True
8372 1
8373
    def to_binary(self):
8374
        packet = []
8375
        packet.append(uatype_Int32.pack(len(self.Events)))
8376
        for fieldname in self.Events:
8377
            packet.append(fieldname.to_binary())
8378
        return b''.join(packet)
8379 1
8380
    @staticmethod
8381
    def from_binary(data):
8382
        return HistoryEvent(data)
8383 1
8384
    def _binary_init(self, data):
8385
        length = uatype_Int32.unpack(data.read(4))[0]
8386
        array = []
8387
        if length != -1:
8388
            for _ in range(0, length):
8389
                array.append(HistoryEventFieldList.from_binary(data))
8390
        self.Events = array
8391 1
8392
    def __str__(self):
8393
        return 'HistoryEvent(' + 'Events:' + str(self.Events) + ')'
8394 1
8395
    __repr__ = __str__
8396
8397 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
8398
class HistoryReadParameters(FrozenClass):
8399
    '''
8400
    :ivar HistoryReadDetails:
8401
    :vartype HistoryReadDetails: ExtensionObject
8402
    :ivar TimestampsToReturn:
8403
    :vartype TimestampsToReturn: TimestampsToReturn
8404
    :ivar ReleaseContinuationPoints:
8405
    :vartype ReleaseContinuationPoints: Boolean
8406
    :ivar NodesToRead:
8407
    :vartype NodesToRead: HistoryReadValueId
8408 1
    '''
8409 1
    def __init__(self, binary=None):
8410
        if binary is not None:
8411
            self._binary_init(binary)
8412
            self._freeze = True
8413 1
            return
8414 1
        self.HistoryReadDetails = None
8415 1
        self.TimestampsToReturn = TimestampsToReturn(0)
8416 1
        self.ReleaseContinuationPoints = True
8417 1
        self.NodesToRead = []
8418
        self._freeze = True
8419 1
8420
    def to_binary(self):
8421
        packet = []
8422
        packet.append(extensionobject_to_binary(self.HistoryReadDetails))
8423
        packet.append(uatype_UInt32.pack(self.TimestampsToReturn.value))
8424
        packet.append(uatype_Boolean.pack(self.ReleaseContinuationPoints))
8425
        packet.append(uatype_Int32.pack(len(self.NodesToRead)))
8426
        for fieldname in self.NodesToRead:
8427
            packet.append(fieldname.to_binary())
8428
        return b''.join(packet)
8429 1
8430
    @staticmethod
8431
    def from_binary(data):
8432
        return HistoryReadParameters(data)
8433 1
8434
    def _binary_init(self, data):
8435
        self.HistoryReadDetails = extensionobject_from_binary(data)
8436
        self.TimestampsToReturn = TimestampsToReturn(uatype_UInt32.unpack(data.read(4))[0])
8437
        self.ReleaseContinuationPoints = uatype_Boolean.unpack(data.read(1))[0]
8438
        length = uatype_Int32.unpack(data.read(4))[0]
8439
        array = []
8440
        if length != -1:
8441
            for _ in range(0, length):
8442
                array.append(HistoryReadValueId.from_binary(data))
8443
        self.NodesToRead = array
8444 1
8445
    def __str__(self):
8446
        return 'HistoryReadParameters(' + 'HistoryReadDetails:' + str(self.HistoryReadDetails) + ', ' + \
8447
               'TimestampsToReturn:' + str(self.TimestampsToReturn) + ', ' + \
8448
               'ReleaseContinuationPoints:' + str(self.ReleaseContinuationPoints) + ', ' + \
8449
               'NodesToRead:' + str(self.NodesToRead) + ')'
8450 1
8451
    __repr__ = __str__
8452
8453 1
8454
class HistoryReadRequest(FrozenClass):
8455
    '''
8456
    :ivar TypeId:
8457
    :vartype TypeId: NodeId
8458
    :ivar RequestHeader:
8459
    :vartype RequestHeader: RequestHeader
8460
    :ivar Parameters:
8461
    :vartype Parameters: HistoryReadParameters
8462 1
    '''
8463
    def __init__(self, binary=None):
8464
        if binary is not None:
8465
            self._binary_init(binary)
8466
            self._freeze = True
8467
            return
8468
        self.TypeId = FourByteNodeId(ObjectIds.HistoryReadRequest_Encoding_DefaultBinary)
8469
        self.RequestHeader = RequestHeader()
8470
        self.Parameters = HistoryReadParameters()
8471
        self._freeze = True
8472 1
8473
    def to_binary(self):
8474
        packet = []
8475
        packet.append(self.TypeId.to_binary())
8476
        packet.append(self.RequestHeader.to_binary())
8477
        packet.append(self.Parameters.to_binary())
8478
        return b''.join(packet)
8479 1
8480
    @staticmethod
8481
    def from_binary(data):
8482
        return HistoryReadRequest(data)
8483 1
8484
    def _binary_init(self, data):
8485
        self.TypeId = NodeId.from_binary(data)
8486
        self.RequestHeader = RequestHeader.from_binary(data)
8487
        self.Parameters = HistoryReadParameters.from_binary(data)
8488 1
8489
    def __str__(self):
8490
        return 'HistoryReadRequest(' + 'TypeId:' + str(self.TypeId) + ', ' + \
8491
               'RequestHeader:' + str(self.RequestHeader) + ', ' + \
8492
               'Parameters:' + str(self.Parameters) + ')'
8493 1
8494
    __repr__ = __str__
8495
8496 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
8497
class HistoryReadResponse(FrozenClass):
8498
    '''
8499
    :ivar TypeId:
8500
    :vartype TypeId: NodeId
8501
    :ivar ResponseHeader:
8502
    :vartype ResponseHeader: ResponseHeader
8503
    :ivar Results:
8504
    :vartype Results: HistoryReadResult
8505
    :ivar DiagnosticInfos:
8506
    :vartype DiagnosticInfos: DiagnosticInfo
8507 1
    '''
8508
    def __init__(self, binary=None):
8509
        if binary is not None:
8510
            self._binary_init(binary)
8511
            self._freeze = True
8512
            return
8513
        self.TypeId = FourByteNodeId(ObjectIds.HistoryReadResponse_Encoding_DefaultBinary)
8514
        self.ResponseHeader = ResponseHeader()
8515
        self.Results = []
8516
        self.DiagnosticInfos = []
8517
        self._freeze = True
8518 1
8519
    def to_binary(self):
8520
        packet = []
8521
        packet.append(self.TypeId.to_binary())
8522
        packet.append(self.ResponseHeader.to_binary())
8523
        packet.append(uatype_Int32.pack(len(self.Results)))
8524
        for fieldname in self.Results:
8525
            packet.append(fieldname.to_binary())
8526
        packet.append(uatype_Int32.pack(len(self.DiagnosticInfos)))
8527
        for fieldname in self.DiagnosticInfos:
8528
            packet.append(fieldname.to_binary())
8529
        return b''.join(packet)
8530 1
8531
    @staticmethod
8532
    def from_binary(data):
8533
        return HistoryReadResponse(data)
8534 1
8535
    def _binary_init(self, data):
8536
        self.TypeId = NodeId.from_binary(data)
8537
        self.ResponseHeader = ResponseHeader.from_binary(data)
8538
        length = uatype_Int32.unpack(data.read(4))[0]
8539
        array = []
8540
        if length != -1:
8541
            for _ in range(0, length):
8542
                array.append(HistoryReadResult.from_binary(data))
8543
        self.Results = array
8544
        length = uatype_Int32.unpack(data.read(4))[0]
8545
        array = []
8546
        if length != -1:
8547
            for _ in range(0, length):
8548
                array.append(DiagnosticInfo.from_binary(data))
8549
        self.DiagnosticInfos = array
8550 1
8551
    def __str__(self):
8552
        return 'HistoryReadResponse(' + 'TypeId:' + str(self.TypeId) + ', ' + \
8553
               'ResponseHeader:' + str(self.ResponseHeader) + ', ' + \
8554
               'Results:' + str(self.Results) + ', ' + \
8555
               'DiagnosticInfos:' + str(self.DiagnosticInfos) + ')'
8556 1
8557
    __repr__ = __str__
8558
8559 1
8560
class WriteValue(FrozenClass):
8561
    '''
8562
    :ivar NodeId:
8563
    :vartype NodeId: NodeId
8564
    :ivar AttributeId:
8565
    :vartype AttributeId: UInt32
8566
    :ivar IndexRange:
8567
    :vartype IndexRange: String
8568
    :ivar Value:
8569
    :vartype Value: DataValue
8570 1
    '''
8571 1
    def __init__(self, binary=None):
8572 1
        if binary is not None:
8573 1
            self._binary_init(binary)
8574 1
            self._freeze = True
8575 1
            return
8576 1
        self.NodeId = NodeId()
8577 1
        self.AttributeId = 0
8578 1
        self.IndexRange = None
8579 1
        self.Value = DataValue()
8580
        self._freeze = True
8581 1
8582 1
    def to_binary(self):
8583 1
        packet = []
8584 1
        packet.append(self.NodeId.to_binary())
8585 1
        packet.append(uatype_UInt32.pack(self.AttributeId))
8586 1
        packet.append(pack_string(self.IndexRange))
8587 1
        packet.append(self.Value.to_binary())
8588
        return b''.join(packet)
8589 1
8590
    @staticmethod
8591 1
    def from_binary(data):
8592
        return WriteValue(data)
8593 1
8594 1
    def _binary_init(self, data):
8595 1
        self.NodeId = NodeId.from_binary(data)
8596 1
        self.AttributeId = uatype_UInt32.unpack(data.read(4))[0]
8597 1
        self.IndexRange = unpack_string(data)
8598
        self.Value = DataValue.from_binary(data)
8599 1
8600
    def __str__(self):
8601
        return 'WriteValue(' + 'NodeId:' + str(self.NodeId) + ', ' + \
8602
               'AttributeId:' + str(self.AttributeId) + ', ' + \
8603
               'IndexRange:' + str(self.IndexRange) + ', ' + \
8604
               'Value:' + str(self.Value) + ')'
8605 1
8606
    __repr__ = __str__
8607
8608 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
8609
class WriteParameters(FrozenClass):
8610
    '''
8611
    :ivar NodesToWrite:
8612
    :vartype NodesToWrite: WriteValue
8613 1
    '''
8614 1
    def __init__(self, binary=None):
8615 1
        if binary is not None:
8616 1
            self._binary_init(binary)
8617 1
            self._freeze = True
8618 1
            return
8619 1
        self.NodesToWrite = []
8620
        self._freeze = True
8621 1
8622 1
    def to_binary(self):
8623 1
        packet = []
8624 1
        packet.append(uatype_Int32.pack(len(self.NodesToWrite)))
8625 1
        for fieldname in self.NodesToWrite:
8626 1
            packet.append(fieldname.to_binary())
8627
        return b''.join(packet)
8628 1
8629
    @staticmethod
8630 1
    def from_binary(data):
8631
        return WriteParameters(data)
8632 1
8633 1
    def _binary_init(self, data):
8634 1
        length = uatype_Int32.unpack(data.read(4))[0]
8635 1
        array = []
8636 1
        if length != -1:
8637 1
            for _ in range(0, length):
8638 1
                array.append(WriteValue.from_binary(data))
8639
        self.NodesToWrite = array
8640 1
8641
    def __str__(self):
8642
        return 'WriteParameters(' + 'NodesToWrite:' + str(self.NodesToWrite) + ')'
8643 1
8644
    __repr__ = __str__
8645
8646 1
8647
class WriteRequest(FrozenClass):
8648
    '''
8649
    :ivar TypeId:
8650
    :vartype TypeId: NodeId
8651
    :ivar RequestHeader:
8652
    :vartype RequestHeader: RequestHeader
8653
    :ivar Parameters:
8654
    :vartype Parameters: WriteParameters
8655 1
    '''
8656 1
    def __init__(self, binary=None):
8657
        if binary is not None:
8658
            self._binary_init(binary)
8659
            self._freeze = True
8660 1
            return
8661 1
        self.TypeId = FourByteNodeId(ObjectIds.WriteRequest_Encoding_DefaultBinary)
8662 1
        self.RequestHeader = RequestHeader()
8663 1
        self.Parameters = WriteParameters()
8664
        self._freeze = True
8665 1
8666 1
    def to_binary(self):
8667 1
        packet = []
8668 1
        packet.append(self.TypeId.to_binary())
8669 1
        packet.append(self.RequestHeader.to_binary())
8670 1
        packet.append(self.Parameters.to_binary())
8671
        return b''.join(packet)
8672 1
8673
    @staticmethod
8674
    def from_binary(data):
8675
        return WriteRequest(data)
8676 1
8677
    def _binary_init(self, data):
8678
        self.TypeId = NodeId.from_binary(data)
8679
        self.RequestHeader = RequestHeader.from_binary(data)
8680
        self.Parameters = WriteParameters.from_binary(data)
8681 1
8682
    def __str__(self):
8683
        return 'WriteRequest(' + 'TypeId:' + str(self.TypeId) + ', ' + \
8684
               'RequestHeader:' + str(self.RequestHeader) + ', ' + \
8685
               'Parameters:' + str(self.Parameters) + ')'
8686 1
8687
    __repr__ = __str__
8688
8689 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
8690
class WriteResponse(FrozenClass):
8691
    '''
8692
    :ivar TypeId:
8693
    :vartype TypeId: NodeId
8694
    :ivar ResponseHeader:
8695
    :vartype ResponseHeader: ResponseHeader
8696
    :ivar Results:
8697
    :vartype Results: StatusCode
8698
    :ivar DiagnosticInfos:
8699
    :vartype DiagnosticInfos: DiagnosticInfo
8700 1
    '''
8701 1
    def __init__(self, binary=None):
8702 1
        if binary is not None:
8703 1
            self._binary_init(binary)
8704 1
            self._freeze = True
8705 1
            return
8706 1
        self.TypeId = FourByteNodeId(ObjectIds.WriteResponse_Encoding_DefaultBinary)
8707 1
        self.ResponseHeader = ResponseHeader()
8708 1
        self.Results = []
8709 1
        self.DiagnosticInfos = []
8710
        self._freeze = True
8711 1
8712 1
    def to_binary(self):
8713 1
        packet = []
8714 1
        packet.append(self.TypeId.to_binary())
8715 1
        packet.append(self.ResponseHeader.to_binary())
8716 1
        packet.append(uatype_Int32.pack(len(self.Results)))
8717 1
        for fieldname in self.Results:
8718 1
            packet.append(fieldname.to_binary())
8719 1
        packet.append(uatype_Int32.pack(len(self.DiagnosticInfos)))
8720
        for fieldname in self.DiagnosticInfos:
8721 1
            packet.append(fieldname.to_binary())
8722
        return b''.join(packet)
8723 1
8724
    @staticmethod
8725 1
    def from_binary(data):
8726
        return WriteResponse(data)
8727 1
8728 1
    def _binary_init(self, data):
8729 1
        self.TypeId = NodeId.from_binary(data)
8730 1
        self.ResponseHeader = ResponseHeader.from_binary(data)
8731 1
        length = uatype_Int32.unpack(data.read(4))[0]
8732 1
        array = []
8733 1
        if length != -1:
8734 1
            for _ in range(0, length):
8735 1
                array.append(StatusCode.from_binary(data))
8736 1
        self.Results = array
8737 1
        length = uatype_Int32.unpack(data.read(4))[0]
8738 1
        array = []
8739 1
        if length != -1:
8740
            for _ in range(0, length):
8741 1
                array.append(DiagnosticInfo.from_binary(data))
8742
        self.DiagnosticInfos = array
8743 1
8744
    def __str__(self):
8745
        return 'WriteResponse(' + 'TypeId:' + str(self.TypeId) + ', ' + \
8746
               'ResponseHeader:' + str(self.ResponseHeader) + ', ' + \
8747
               'Results:' + str(self.Results) + ', ' + \
8748
               'DiagnosticInfos:' + str(self.DiagnosticInfos) + ')'
8749 1
8750
    __repr__ = __str__
8751
8752 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
8753
class HistoryUpdateDetails(FrozenClass):
8754
    '''
8755
    :ivar NodeId:
8756
    :vartype NodeId: NodeId
8757 1
    '''
8758
    def __init__(self, binary=None):
8759
        if binary is not None:
8760
            self._binary_init(binary)
8761
            self._freeze = True
8762
            return
8763
        self.NodeId = NodeId()
8764
        self._freeze = True
8765 1
8766
    def to_binary(self):
8767
        packet = []
8768
        packet.append(self.NodeId.to_binary())
8769
        return b''.join(packet)
8770 1
8771
    @staticmethod
8772
    def from_binary(data):
8773
        return HistoryUpdateDetails(data)
8774 1
8775
    def _binary_init(self, data):
8776
        self.NodeId = NodeId.from_binary(data)
8777 1
8778
    def __str__(self):
8779
        return 'HistoryUpdateDetails(' + 'NodeId:' + str(self.NodeId) + ')'
8780 1
8781
    __repr__ = __str__
8782
8783 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
8784
class UpdateDataDetails(FrozenClass):
8785
    '''
8786
    :ivar NodeId:
8787
    :vartype NodeId: NodeId
8788
    :ivar PerformInsertReplace:
8789
    :vartype PerformInsertReplace: PerformUpdateType
8790
    :ivar UpdateValues:
8791
    :vartype UpdateValues: DataValue
8792 1
    '''
8793
    def __init__(self, binary=None):
8794
        if binary is not None:
8795
            self._binary_init(binary)
8796
            self._freeze = True
8797
            return
8798
        self.NodeId = NodeId()
8799
        self.PerformInsertReplace = PerformUpdateType(0)
8800
        self.UpdateValues = []
8801
        self._freeze = True
8802 1
8803
    def to_binary(self):
8804
        packet = []
8805
        packet.append(self.NodeId.to_binary())
8806
        packet.append(uatype_UInt32.pack(self.PerformInsertReplace.value))
8807
        packet.append(uatype_Int32.pack(len(self.UpdateValues)))
8808
        for fieldname in self.UpdateValues:
8809
            packet.append(fieldname.to_binary())
8810
        return b''.join(packet)
8811 1
8812
    @staticmethod
8813
    def from_binary(data):
8814
        return UpdateDataDetails(data)
8815 1
8816
    def _binary_init(self, data):
8817
        self.NodeId = NodeId.from_binary(data)
8818
        self.PerformInsertReplace = PerformUpdateType(uatype_UInt32.unpack(data.read(4))[0])
8819
        length = uatype_Int32.unpack(data.read(4))[0]
8820
        array = []
8821
        if length != -1:
8822
            for _ in range(0, length):
8823
                array.append(DataValue.from_binary(data))
8824
        self.UpdateValues = array
8825 1
8826
    def __str__(self):
8827
        return 'UpdateDataDetails(' + 'NodeId:' + str(self.NodeId) + ', ' + \
8828
               'PerformInsertReplace:' + str(self.PerformInsertReplace) + ', ' + \
8829
               'UpdateValues:' + str(self.UpdateValues) + ')'
8830 1
8831
    __repr__ = __str__
8832
8833 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
8834
class UpdateStructureDataDetails(FrozenClass):
8835
    '''
8836
    :ivar NodeId:
8837
    :vartype NodeId: NodeId
8838
    :ivar PerformInsertReplace:
8839
    :vartype PerformInsertReplace: PerformUpdateType
8840
    :ivar UpdateValues:
8841
    :vartype UpdateValues: DataValue
8842 1
    '''
8843
    def __init__(self, binary=None):
8844
        if binary is not None:
8845
            self._binary_init(binary)
8846
            self._freeze = True
8847
            return
8848
        self.NodeId = NodeId()
8849
        self.PerformInsertReplace = PerformUpdateType(0)
8850
        self.UpdateValues = []
8851
        self._freeze = True
8852 1
8853
    def to_binary(self):
8854
        packet = []
8855
        packet.append(self.NodeId.to_binary())
8856
        packet.append(uatype_UInt32.pack(self.PerformInsertReplace.value))
8857
        packet.append(uatype_Int32.pack(len(self.UpdateValues)))
8858
        for fieldname in self.UpdateValues:
8859
            packet.append(fieldname.to_binary())
8860
        return b''.join(packet)
8861 1
8862
    @staticmethod
8863
    def from_binary(data):
8864
        return UpdateStructureDataDetails(data)
8865 1
8866
    def _binary_init(self, data):
8867
        self.NodeId = NodeId.from_binary(data)
8868
        self.PerformInsertReplace = PerformUpdateType(uatype_UInt32.unpack(data.read(4))[0])
8869
        length = uatype_Int32.unpack(data.read(4))[0]
8870
        array = []
8871
        if length != -1:
8872
            for _ in range(0, length):
8873
                array.append(DataValue.from_binary(data))
8874
        self.UpdateValues = array
8875 1
8876
    def __str__(self):
8877
        return 'UpdateStructureDataDetails(' + 'NodeId:' + str(self.NodeId) + ', ' + \
8878
               'PerformInsertReplace:' + str(self.PerformInsertReplace) + ', ' + \
8879
               'UpdateValues:' + str(self.UpdateValues) + ')'
8880 1
8881
    __repr__ = __str__
8882
8883 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
8884
class UpdateEventDetails(FrozenClass):
8885
    '''
8886
    :ivar NodeId:
8887
    :vartype NodeId: NodeId
8888
    :ivar PerformInsertReplace:
8889
    :vartype PerformInsertReplace: PerformUpdateType
8890
    :ivar Filter:
8891
    :vartype Filter: EventFilter
8892
    :ivar EventData:
8893
    :vartype EventData: HistoryEventFieldList
8894 1
    '''
8895
    def __init__(self, binary=None):
8896
        if binary is not None:
8897
            self._binary_init(binary)
8898
            self._freeze = True
8899
            return
8900
        self.NodeId = NodeId()
8901
        self.PerformInsertReplace = PerformUpdateType(0)
8902
        self.Filter = EventFilter()
8903
        self.EventData = []
8904
        self._freeze = True
8905 1
8906
    def to_binary(self):
8907
        packet = []
8908
        packet.append(self.NodeId.to_binary())
8909
        packet.append(uatype_UInt32.pack(self.PerformInsertReplace.value))
8910
        packet.append(self.Filter.to_binary())
8911
        packet.append(uatype_Int32.pack(len(self.EventData)))
8912
        for fieldname in self.EventData:
8913
            packet.append(fieldname.to_binary())
8914
        return b''.join(packet)
8915 1
8916
    @staticmethod
8917
    def from_binary(data):
8918
        return UpdateEventDetails(data)
8919 1
8920
    def _binary_init(self, data):
8921
        self.NodeId = NodeId.from_binary(data)
8922
        self.PerformInsertReplace = PerformUpdateType(uatype_UInt32.unpack(data.read(4))[0])
8923
        self.Filter = EventFilter.from_binary(data)
8924
        length = uatype_Int32.unpack(data.read(4))[0]
8925
        array = []
8926
        if length != -1:
8927
            for _ in range(0, length):
8928
                array.append(HistoryEventFieldList.from_binary(data))
8929
        self.EventData = array
8930 1
8931
    def __str__(self):
8932
        return 'UpdateEventDetails(' + 'NodeId:' + str(self.NodeId) + ', ' + \
8933
               'PerformInsertReplace:' + str(self.PerformInsertReplace) + ', ' + \
8934
               'Filter:' + str(self.Filter) + ', ' + \
8935
               'EventData:' + str(self.EventData) + ')'
8936 1
8937
    __repr__ = __str__
8938
8939 1
8940
class DeleteRawModifiedDetails(FrozenClass):
8941
    '''
8942
    :ivar NodeId:
8943
    :vartype NodeId: NodeId
8944
    :ivar IsDeleteModified:
8945
    :vartype IsDeleteModified: Boolean
8946
    :ivar StartTime:
8947
    :vartype StartTime: DateTime
8948
    :ivar EndTime:
8949
    :vartype EndTime: DateTime
8950 1
    '''
8951
    def __init__(self, binary=None):
8952
        if binary is not None:
8953
            self._binary_init(binary)
8954
            self._freeze = True
8955
            return
8956
        self.NodeId = NodeId()
8957
        self.IsDeleteModified = True
8958
        self.StartTime = datetime.now()
8959
        self.EndTime = datetime.now()
8960
        self._freeze = True
8961 1
8962
    def to_binary(self):
8963
        packet = []
8964
        packet.append(self.NodeId.to_binary())
8965
        packet.append(uatype_Boolean.pack(self.IsDeleteModified))
8966
        packet.append(pack_datetime(self.StartTime))
8967
        packet.append(pack_datetime(self.EndTime))
8968
        return b''.join(packet)
8969 1
8970
    @staticmethod
8971
    def from_binary(data):
8972
        return DeleteRawModifiedDetails(data)
8973 1
8974
    def _binary_init(self, data):
8975
        self.NodeId = NodeId.from_binary(data)
8976
        self.IsDeleteModified = uatype_Boolean.unpack(data.read(1))[0]
8977
        self.StartTime = unpack_datetime(data)
8978
        self.EndTime = unpack_datetime(data)
8979 1
8980
    def __str__(self):
8981
        return 'DeleteRawModifiedDetails(' + 'NodeId:' + str(self.NodeId) + ', ' + \
8982
               'IsDeleteModified:' + str(self.IsDeleteModified) + ', ' + \
8983
               'StartTime:' + str(self.StartTime) + ', ' + \
8984
               'EndTime:' + str(self.EndTime) + ')'
8985 1
8986
    __repr__ = __str__
8987
8988 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
8989
class DeleteAtTimeDetails(FrozenClass):
8990
    '''
8991
    :ivar NodeId:
8992
    :vartype NodeId: NodeId
8993
    :ivar ReqTimes:
8994
    :vartype ReqTimes: DateTime
8995 1
    '''
8996
    def __init__(self, binary=None):
8997
        if binary is not None:
8998
            self._binary_init(binary)
8999
            self._freeze = True
9000
            return
9001
        self.NodeId = NodeId()
9002
        self.ReqTimes = []
9003
        self._freeze = True
9004 1
9005
    def to_binary(self):
9006
        packet = []
9007
        packet.append(self.NodeId.to_binary())
9008
        packet.append(uatype_Int32.pack(len(self.ReqTimes)))
9009
        for fieldname in self.ReqTimes:
9010
            packet.append(pack_datetime(fieldname))
9011
        return b''.join(packet)
9012 1
9013
    @staticmethod
9014
    def from_binary(data):
9015
        return DeleteAtTimeDetails(data)
9016 1
9017
    def _binary_init(self, data):
9018
        self.NodeId = NodeId.from_binary(data)
9019
        self.ReqTimes = unpack_uatype_array('DateTime', data)
9020 1
9021
    def __str__(self):
9022
        return 'DeleteAtTimeDetails(' + 'NodeId:' + str(self.NodeId) + ', ' + \
9023
               'ReqTimes:' + str(self.ReqTimes) + ')'
9024 1
9025
    __repr__ = __str__
9026
9027 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
9028
class DeleteEventDetails(FrozenClass):
9029
    '''
9030
    :ivar NodeId:
9031
    :vartype NodeId: NodeId
9032
    :ivar EventIds:
9033
    :vartype EventIds: ByteString
9034 1
    '''
9035
    def __init__(self, binary=None):
9036
        if binary is not None:
9037
            self._binary_init(binary)
9038
            self._freeze = True
9039
            return
9040
        self.NodeId = NodeId()
9041
        self.EventIds = []
9042
        self._freeze = True
9043 1
9044
    def to_binary(self):
9045
        packet = []
9046
        packet.append(self.NodeId.to_binary())
9047
        packet.append(uatype_Int32.pack(len(self.EventIds)))
9048
        for fieldname in self.EventIds:
9049
            packet.append(pack_bytes(fieldname))
9050
        return b''.join(packet)
9051 1
9052
    @staticmethod
9053
    def from_binary(data):
9054
        return DeleteEventDetails(data)
9055 1
9056
    def _binary_init(self, data):
9057
        self.NodeId = NodeId.from_binary(data)
9058
        self.EventIds = unpack_uatype_array('ByteString', data)
9059 1
9060
    def __str__(self):
9061
        return 'DeleteEventDetails(' + 'NodeId:' + str(self.NodeId) + ', ' + \
9062
               'EventIds:' + str(self.EventIds) + ')'
9063 1
9064
    __repr__ = __str__
9065
9066 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
9067
class HistoryUpdateResult(FrozenClass):
9068
    '''
9069
    :ivar StatusCode:
9070
    :vartype StatusCode: StatusCode
9071
    :ivar OperationResults:
9072
    :vartype OperationResults: StatusCode
9073
    :ivar DiagnosticInfos:
9074
    :vartype DiagnosticInfos: DiagnosticInfo
9075 1
    '''
9076
    def __init__(self, binary=None):
9077
        if binary is not None:
9078
            self._binary_init(binary)
9079
            self._freeze = True
9080
            return
9081
        self.StatusCode = StatusCode()
9082
        self.OperationResults = []
9083
        self.DiagnosticInfos = []
9084
        self._freeze = True
9085 1
9086
    def to_binary(self):
9087
        packet = []
9088
        packet.append(self.StatusCode.to_binary())
9089
        packet.append(uatype_Int32.pack(len(self.OperationResults)))
9090
        for fieldname in self.OperationResults:
9091
            packet.append(fieldname.to_binary())
9092
        packet.append(uatype_Int32.pack(len(self.DiagnosticInfos)))
9093
        for fieldname in self.DiagnosticInfos:
9094
            packet.append(fieldname.to_binary())
9095
        return b''.join(packet)
9096 1
9097
    @staticmethod
9098
    def from_binary(data):
9099
        return HistoryUpdateResult(data)
9100 1
9101
    def _binary_init(self, data):
9102
        self.StatusCode = StatusCode.from_binary(data)
9103
        length = uatype_Int32.unpack(data.read(4))[0]
9104
        array = []
9105
        if length != -1:
9106
            for _ in range(0, length):
9107
                array.append(StatusCode.from_binary(data))
9108
        self.OperationResults = array
9109
        length = uatype_Int32.unpack(data.read(4))[0]
9110
        array = []
9111
        if length != -1:
9112
            for _ in range(0, length):
9113
                array.append(DiagnosticInfo.from_binary(data))
9114
        self.DiagnosticInfos = array
9115 1
9116
    def __str__(self):
9117
        return 'HistoryUpdateResult(' + 'StatusCode:' + str(self.StatusCode) + ', ' + \
9118
               'OperationResults:' + str(self.OperationResults) + ', ' + \
9119
               'DiagnosticInfos:' + str(self.DiagnosticInfos) + ')'
9120 1
9121
    __repr__ = __str__
9122
9123 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
9124
class HistoryUpdateParameters(FrozenClass):
9125
    '''
9126
    :ivar HistoryUpdateDetails:
9127
    :vartype HistoryUpdateDetails: ExtensionObject
9128 1
    '''
9129
    def __init__(self, binary=None):
9130
        if binary is not None:
9131
            self._binary_init(binary)
9132
            self._freeze = True
9133
            return
9134
        self.HistoryUpdateDetails = []
9135
        self._freeze = True
9136 1
9137
    def to_binary(self):
9138
        packet = []
9139
        packet.append(uatype_Int32.pack(len(self.HistoryUpdateDetails)))
9140
        for fieldname in self.HistoryUpdateDetails:
9141
            packet.append(extensionobject_to_binary(fieldname))
9142
        return b''.join(packet)
9143 1
9144
    @staticmethod
9145
    def from_binary(data):
9146
        return HistoryUpdateParameters(data)
9147 1
9148
    def _binary_init(self, data):
9149
        length = uatype_Int32.unpack(data.read(4))[0]
9150
        array = []
9151
        if length != -1:
9152
            for _ in range(0, length):
9153
                array.append(extensionobject_from_binary(data))
9154
        self.HistoryUpdateDetails = array
9155 1
9156
    def __str__(self):
9157
        return 'HistoryUpdateParameters(' + 'HistoryUpdateDetails:' + str(self.HistoryUpdateDetails) + ')'
9158 1
9159
    __repr__ = __str__
9160
9161 1
9162
class HistoryUpdateRequest(FrozenClass):
9163
    '''
9164
    :ivar TypeId:
9165
    :vartype TypeId: NodeId
9166
    :ivar RequestHeader:
9167
    :vartype RequestHeader: RequestHeader
9168
    :ivar Parameters:
9169
    :vartype Parameters: HistoryUpdateParameters
9170 1
    '''
9171
    def __init__(self, binary=None):
9172
        if binary is not None:
9173
            self._binary_init(binary)
9174
            self._freeze = True
9175
            return
9176
        self.TypeId = FourByteNodeId(ObjectIds.HistoryUpdateRequest_Encoding_DefaultBinary)
9177
        self.RequestHeader = RequestHeader()
9178
        self.Parameters = HistoryUpdateParameters()
9179
        self._freeze = True
9180 1
9181
    def to_binary(self):
9182
        packet = []
9183
        packet.append(self.TypeId.to_binary())
9184
        packet.append(self.RequestHeader.to_binary())
9185
        packet.append(self.Parameters.to_binary())
9186
        return b''.join(packet)
9187 1
9188
    @staticmethod
9189
    def from_binary(data):
9190
        return HistoryUpdateRequest(data)
9191 1
9192
    def _binary_init(self, data):
9193
        self.TypeId = NodeId.from_binary(data)
9194
        self.RequestHeader = RequestHeader.from_binary(data)
9195
        self.Parameters = HistoryUpdateParameters.from_binary(data)
9196 1
9197
    def __str__(self):
9198
        return 'HistoryUpdateRequest(' + 'TypeId:' + str(self.TypeId) + ', ' + \
9199
               'RequestHeader:' + str(self.RequestHeader) + ', ' + \
9200
               'Parameters:' + str(self.Parameters) + ')'
9201 1
9202
    __repr__ = __str__
9203
9204 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
9205
class HistoryUpdateResponse(FrozenClass):
9206
    '''
9207
    :ivar TypeId:
9208
    :vartype TypeId: NodeId
9209
    :ivar ResponseHeader:
9210
    :vartype ResponseHeader: ResponseHeader
9211
    :ivar Results:
9212
    :vartype Results: HistoryUpdateResult
9213
    :ivar DiagnosticInfos:
9214
    :vartype DiagnosticInfos: DiagnosticInfo
9215 1
    '''
9216
    def __init__(self, binary=None):
9217
        if binary is not None:
9218
            self._binary_init(binary)
9219
            self._freeze = True
9220
            return
9221
        self.TypeId = FourByteNodeId(ObjectIds.HistoryUpdateResponse_Encoding_DefaultBinary)
9222
        self.ResponseHeader = ResponseHeader()
9223
        self.Results = []
9224
        self.DiagnosticInfos = []
9225
        self._freeze = True
9226 1
9227
    def to_binary(self):
9228
        packet = []
9229
        packet.append(self.TypeId.to_binary())
9230
        packet.append(self.ResponseHeader.to_binary())
9231
        packet.append(uatype_Int32.pack(len(self.Results)))
9232
        for fieldname in self.Results:
9233
            packet.append(fieldname.to_binary())
9234
        packet.append(uatype_Int32.pack(len(self.DiagnosticInfos)))
9235
        for fieldname in self.DiagnosticInfos:
9236
            packet.append(fieldname.to_binary())
9237
        return b''.join(packet)
9238 1
9239
    @staticmethod
9240
    def from_binary(data):
9241
        return HistoryUpdateResponse(data)
9242 1
9243
    def _binary_init(self, data):
9244
        self.TypeId = NodeId.from_binary(data)
9245
        self.ResponseHeader = ResponseHeader.from_binary(data)
9246
        length = uatype_Int32.unpack(data.read(4))[0]
9247
        array = []
9248
        if length != -1:
9249
            for _ in range(0, length):
9250
                array.append(HistoryUpdateResult.from_binary(data))
9251
        self.Results = array
9252
        length = uatype_Int32.unpack(data.read(4))[0]
9253
        array = []
9254
        if length != -1:
9255
            for _ in range(0, length):
9256
                array.append(DiagnosticInfo.from_binary(data))
9257
        self.DiagnosticInfos = array
9258 1
9259
    def __str__(self):
9260
        return 'HistoryUpdateResponse(' + 'TypeId:' + str(self.TypeId) + ', ' + \
9261
               'ResponseHeader:' + str(self.ResponseHeader) + ', ' + \
9262
               'Results:' + str(self.Results) + ', ' + \
9263
               'DiagnosticInfos:' + str(self.DiagnosticInfos) + ')'
9264 1
9265
    __repr__ = __str__
9266
9267 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
9268
class CallMethodRequest(FrozenClass):
9269
    '''
9270
    :ivar ObjectId:
9271
    :vartype ObjectId: NodeId
9272
    :ivar MethodId:
9273
    :vartype MethodId: NodeId
9274
    :ivar InputArguments:
9275
    :vartype InputArguments: Variant
9276 1
    '''
9277 1
    def __init__(self, binary=None):
9278 1
        if binary is not None:
9279 1
            self._binary_init(binary)
9280 1
            self._freeze = True
9281 1
            return
9282 1
        self.ObjectId = NodeId()
9283 1
        self.MethodId = NodeId()
9284 1
        self.InputArguments = []
9285
        self._freeze = True
9286 1
9287 1
    def to_binary(self):
9288 1
        packet = []
9289 1
        packet.append(self.ObjectId.to_binary())
9290 1
        packet.append(self.MethodId.to_binary())
9291 1
        packet.append(uatype_Int32.pack(len(self.InputArguments)))
9292 1
        for fieldname in self.InputArguments:
9293 1
            packet.append(fieldname.to_binary())
9294
        return b''.join(packet)
9295 1
9296
    @staticmethod
9297 1
    def from_binary(data):
9298
        return CallMethodRequest(data)
9299 1
9300 1
    def _binary_init(self, data):
9301 1
        self.ObjectId = NodeId.from_binary(data)
9302 1
        self.MethodId = NodeId.from_binary(data)
9303 1
        length = uatype_Int32.unpack(data.read(4))[0]
9304 1
        array = []
9305 1
        if length != -1:
9306 1
            for _ in range(0, length):
9307 1
                array.append(Variant.from_binary(data))
9308
        self.InputArguments = array
9309 1
9310 1
    def __str__(self):
9311
        return 'CallMethodRequest(' + 'ObjectId:' + str(self.ObjectId) + ', ' + \
9312
               'MethodId:' + str(self.MethodId) + ', ' + \
9313
               'InputArguments:' + str(self.InputArguments) + ')'
9314 1
9315
    __repr__ = __str__
9316
9317 1
9318
class CallMethodResult(FrozenClass):
9319
    '''
9320
    :ivar StatusCode:
9321
    :vartype StatusCode: StatusCode
9322
    :ivar InputArgumentResults:
9323
    :vartype InputArgumentResults: StatusCode
9324
    :ivar InputArgumentDiagnosticInfos:
9325
    :vartype InputArgumentDiagnosticInfos: DiagnosticInfo
9326
    :ivar OutputArguments:
9327
    :vartype OutputArguments: Variant
9328 1
    '''
9329 1
    def __init__(self, binary=None):
9330 1
        if binary is not None:
9331 1
            self._binary_init(binary)
9332 1
            self._freeze = True
9333 1
            return
9334 1
        self.StatusCode = StatusCode()
9335 1
        self.InputArgumentResults = []
9336 1
        self.InputArgumentDiagnosticInfos = []
9337 1
        self.OutputArguments = []
9338
        self._freeze = True
9339 1
9340 1
    def to_binary(self):
9341 1
        packet = []
9342 1
        packet.append(self.StatusCode.to_binary())
9343 1
        packet.append(uatype_Int32.pack(len(self.InputArgumentResults)))
9344 1
        for fieldname in self.InputArgumentResults:
9345 1
            packet.append(fieldname.to_binary())
9346 1
        packet.append(uatype_Int32.pack(len(self.InputArgumentDiagnosticInfos)))
9347
        for fieldname in self.InputArgumentDiagnosticInfos:
9348 1
            packet.append(fieldname.to_binary())
9349 1
        packet.append(uatype_Int32.pack(len(self.OutputArguments)))
9350 1
        for fieldname in self.OutputArguments:
9351 1
            packet.append(fieldname.to_binary())
9352
        return b''.join(packet)
9353 1
9354
    @staticmethod
9355 1
    def from_binary(data):
9356
        return CallMethodResult(data)
9357 1
9358 1
    def _binary_init(self, data):
9359 1
        self.StatusCode = StatusCode.from_binary(data)
9360 1
        length = uatype_Int32.unpack(data.read(4))[0]
9361 1
        array = []
9362 1
        if length != -1:
9363 1
            for _ in range(0, length):
9364 1
                array.append(StatusCode.from_binary(data))
9365 1
        self.InputArgumentResults = array
9366 1
        length = uatype_Int32.unpack(data.read(4))[0]
9367 1
        array = []
9368 1
        if length != -1:
9369
            for _ in range(0, length):
9370 1
                array.append(DiagnosticInfo.from_binary(data))
9371 1
        self.InputArgumentDiagnosticInfos = array
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
        self.OutputArguments = array
9378 1
9379
    def __str__(self):
9380
        return 'CallMethodResult(' + 'StatusCode:' + str(self.StatusCode) + ', ' + \
9381
               'InputArgumentResults:' + str(self.InputArgumentResults) + ', ' + \
9382
               'InputArgumentDiagnosticInfos:' + str(self.InputArgumentDiagnosticInfos) + ', ' + \
9383
               'OutputArguments:' + str(self.OutputArguments) + ')'
9384 1
9385
    __repr__ = __str__
9386
9387 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
9388
class CallParameters(FrozenClass):
9389
    '''
9390
    :ivar MethodsToCall:
9391
    :vartype MethodsToCall: CallMethodRequest
9392 1
    '''
9393 1
    def __init__(self, binary=None):
9394 1
        if binary is not None:
9395 1
            self._binary_init(binary)
9396 1
            self._freeze = True
9397 1
            return
9398 1
        self.MethodsToCall = []
9399
        self._freeze = True
9400 1
9401 1
    def to_binary(self):
9402 1
        packet = []
9403 1
        packet.append(uatype_Int32.pack(len(self.MethodsToCall)))
9404 1
        for fieldname in self.MethodsToCall:
9405 1
            packet.append(fieldname.to_binary())
9406
        return b''.join(packet)
9407 1
9408
    @staticmethod
9409 1
    def from_binary(data):
9410
        return CallParameters(data)
9411 1
9412 1
    def _binary_init(self, data):
9413 1
        length = uatype_Int32.unpack(data.read(4))[0]
9414 1
        array = []
9415 1
        if length != -1:
9416 1
            for _ in range(0, length):
9417 1
                array.append(CallMethodRequest.from_binary(data))
9418
        self.MethodsToCall = array
9419 1
9420
    def __str__(self):
9421
        return 'CallParameters(' + 'MethodsToCall:' + str(self.MethodsToCall) + ')'
9422 1
9423
    __repr__ = __str__
9424
9425 1
9426
class CallRequest(FrozenClass):
9427
    '''
9428
    :ivar TypeId:
9429
    :vartype TypeId: NodeId
9430
    :ivar RequestHeader:
9431
    :vartype RequestHeader: RequestHeader
9432
    :ivar Parameters:
9433
    :vartype Parameters: CallParameters
9434 1
    '''
9435 1
    def __init__(self, binary=None):
9436
        if binary is not None:
9437
            self._binary_init(binary)
9438
            self._freeze = True
9439 1
            return
9440 1
        self.TypeId = FourByteNodeId(ObjectIds.CallRequest_Encoding_DefaultBinary)
9441 1
        self.RequestHeader = RequestHeader()
9442 1
        self.Parameters = CallParameters()
9443
        self._freeze = True
9444 1
9445 1
    def to_binary(self):
9446 1
        packet = []
9447 1
        packet.append(self.TypeId.to_binary())
9448 1
        packet.append(self.RequestHeader.to_binary())
9449 1
        packet.append(self.Parameters.to_binary())
9450
        return b''.join(packet)
9451 1
9452
    @staticmethod
9453
    def from_binary(data):
9454
        return CallRequest(data)
9455 1
9456
    def _binary_init(self, data):
9457
        self.TypeId = NodeId.from_binary(data)
9458
        self.RequestHeader = RequestHeader.from_binary(data)
9459
        self.Parameters = CallParameters.from_binary(data)
9460 1
9461
    def __str__(self):
9462
        return 'CallRequest(' + 'TypeId:' + str(self.TypeId) + ', ' + \
9463
               'RequestHeader:' + str(self.RequestHeader) + ', ' + \
9464
               'Parameters:' + str(self.Parameters) + ')'
9465 1
9466
    __repr__ = __str__
9467
9468 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
9469
class CallResponse(FrozenClass):
9470
    '''
9471
    :ivar TypeId:
9472
    :vartype TypeId: NodeId
9473
    :ivar ResponseHeader:
9474
    :vartype ResponseHeader: ResponseHeader
9475
    :ivar Results:
9476
    :vartype Results: CallMethodResult
9477
    :ivar DiagnosticInfos:
9478
    :vartype DiagnosticInfos: DiagnosticInfo
9479 1
    '''
9480 1
    def __init__(self, binary=None):
9481 1
        if binary is not None:
9482 1
            self._binary_init(binary)
9483 1
            self._freeze = True
9484 1
            return
9485 1
        self.TypeId = FourByteNodeId(ObjectIds.CallResponse_Encoding_DefaultBinary)
9486 1
        self.ResponseHeader = ResponseHeader()
9487 1
        self.Results = []
9488 1
        self.DiagnosticInfos = []
9489
        self._freeze = True
9490 1
9491 1
    def to_binary(self):
9492 1
        packet = []
9493 1
        packet.append(self.TypeId.to_binary())
9494 1
        packet.append(self.ResponseHeader.to_binary())
9495 1
        packet.append(uatype_Int32.pack(len(self.Results)))
9496 1
        for fieldname in self.Results:
9497 1
            packet.append(fieldname.to_binary())
9498 1
        packet.append(uatype_Int32.pack(len(self.DiagnosticInfos)))
9499
        for fieldname in self.DiagnosticInfos:
9500 1
            packet.append(fieldname.to_binary())
9501
        return b''.join(packet)
9502 1
9503
    @staticmethod
9504 1
    def from_binary(data):
9505
        return CallResponse(data)
9506 1
9507 1
    def _binary_init(self, data):
9508 1
        self.TypeId = NodeId.from_binary(data)
9509 1
        self.ResponseHeader = ResponseHeader.from_binary(data)
9510 1
        length = uatype_Int32.unpack(data.read(4))[0]
9511 1
        array = []
9512 1
        if length != -1:
9513 1
            for _ in range(0, length):
9514 1
                array.append(CallMethodResult.from_binary(data))
9515 1
        self.Results = array
9516 1
        length = uatype_Int32.unpack(data.read(4))[0]
9517 1
        array = []
9518 1
        if length != -1:
9519
            for _ in range(0, length):
9520 1
                array.append(DiagnosticInfo.from_binary(data))
9521
        self.DiagnosticInfos = array
9522 1
9523
    def __str__(self):
9524
        return 'CallResponse(' + 'TypeId:' + str(self.TypeId) + ', ' + \
9525
               'ResponseHeader:' + str(self.ResponseHeader) + ', ' + \
9526
               'Results:' + str(self.Results) + ', ' + \
9527
               'DiagnosticInfos:' + str(self.DiagnosticInfos) + ')'
9528 1
9529
    __repr__ = __str__
9530
9531 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
9532
class MonitoringFilter(FrozenClass):
9533
    '''
9534 1
    '''
9535
    def __init__(self, binary=None):
9536
        if binary is not None:
9537
            self._binary_init(binary)
9538
            self._freeze = True
9539
            return
9540
        self._freeze = True
9541 1
9542
    def to_binary(self):
9543
        packet = []
9544
        return b''.join(packet)
9545 1
9546
    @staticmethod
9547
    def from_binary(data):
9548
        return MonitoringFilter(data)
9549 1
9550
    def _binary_init(self, data):
9551
        pass
9552 1
9553
    def __str__(self):
9554
        return 'MonitoringFilter(' +  + ')'
9555 1
9556
    __repr__ = __str__
9557
9558 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
9559
class DataChangeFilter(FrozenClass):
9560
    '''
9561
    :ivar Trigger:
9562
    :vartype Trigger: DataChangeTrigger
9563
    :ivar DeadbandType:
9564
    :vartype DeadbandType: UInt32
9565
    :ivar DeadbandValue:
9566
    :vartype DeadbandValue: Double
9567 1
    '''
9568
    def __init__(self, binary=None):
9569
        if binary is not None:
9570
            self._binary_init(binary)
9571
            self._freeze = True
9572
            return
9573
        self.Trigger = DataChangeTrigger(0)
9574
        self.DeadbandType = 0
9575
        self.DeadbandValue = 0
9576
        self._freeze = True
9577 1
9578
    def to_binary(self):
9579
        packet = []
9580
        packet.append(uatype_UInt32.pack(self.Trigger.value))
9581
        packet.append(uatype_UInt32.pack(self.DeadbandType))
9582
        packet.append(uatype_Double.pack(self.DeadbandValue))
9583
        return b''.join(packet)
9584 1
9585
    @staticmethod
9586
    def from_binary(data):
9587
        return DataChangeFilter(data)
9588 1
9589
    def _binary_init(self, data):
9590
        self.Trigger = DataChangeTrigger(uatype_UInt32.unpack(data.read(4))[0])
9591
        self.DeadbandType = uatype_UInt32.unpack(data.read(4))[0]
9592
        self.DeadbandValue = uatype_Double.unpack(data.read(8))[0]
9593 1
9594
    def __str__(self):
9595
        return 'DataChangeFilter(' + 'Trigger:' + str(self.Trigger) + ', ' + \
9596
               'DeadbandType:' + str(self.DeadbandType) + ', ' + \
9597
               'DeadbandValue:' + str(self.DeadbandValue) + ')'
9598 1
9599
    __repr__ = __str__
9600
9601 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
9602
class EventFilter(FrozenClass):
9603
    '''
9604
    :ivar SelectClauses:
9605
    :vartype SelectClauses: SimpleAttributeOperand
9606
    :ivar WhereClause:
9607
    :vartype WhereClause: ContentFilter
9608 1
    '''
9609 1
    def __init__(self, binary=None):
9610 1
        if binary is not None:
9611 1
            self._binary_init(binary)
9612 1
            self._freeze = True
9613 1
            return
9614 1
        self.SelectClauses = []
9615 1
        self.WhereClause = ContentFilter()
9616
        self._freeze = True
9617 1
9618 1
    def to_binary(self):
9619 1
        packet = []
9620 1
        packet.append(uatype_Int32.pack(len(self.SelectClauses)))
9621 1
        for fieldname in self.SelectClauses:
9622 1
            packet.append(fieldname.to_binary())
9623 1
        packet.append(self.WhereClause.to_binary())
9624
        return b''.join(packet)
9625 1
9626
    @staticmethod
9627 1
    def from_binary(data):
9628
        return EventFilter(data)
9629 1
9630 1
    def _binary_init(self, data):
9631 1
        length = uatype_Int32.unpack(data.read(4))[0]
9632 1
        array = []
9633 1
        if length != -1:
9634 1
            for _ in range(0, length):
9635 1
                array.append(SimpleAttributeOperand.from_binary(data))
9636 1
        self.SelectClauses = array
9637
        self.WhereClause = ContentFilter.from_binary(data)
9638 1
9639
    def __str__(self):
9640
        return 'EventFilter(' + 'SelectClauses:' + str(self.SelectClauses) + ', ' + \
9641
               'WhereClause:' + str(self.WhereClause) + ')'
9642 1
9643
    __repr__ = __str__
9644
9645 1
9646
class AggregateConfiguration(FrozenClass):
9647
    '''
9648
    :ivar UseServerCapabilitiesDefaults:
9649
    :vartype UseServerCapabilitiesDefaults: Boolean
9650
    :ivar TreatUncertainAsBad:
9651
    :vartype TreatUncertainAsBad: Boolean
9652
    :ivar PercentDataBad:
9653
    :vartype PercentDataBad: Byte
9654
    :ivar PercentDataGood:
9655
    :vartype PercentDataGood: Byte
9656
    :ivar UseSlopedExtrapolation:
9657
    :vartype UseSlopedExtrapolation: Boolean
9658 1
    '''
9659
    def __init__(self, binary=None):
9660
        if binary is not None:
9661
            self._binary_init(binary)
9662
            self._freeze = True
9663
            return
9664
        self.UseServerCapabilitiesDefaults = True
9665
        self.TreatUncertainAsBad = True
9666
        self.PercentDataBad = 0
9667
        self.PercentDataGood = 0
9668
        self.UseSlopedExtrapolation = True
9669
        self._freeze = True
9670 1
9671
    def to_binary(self):
9672
        packet = []
9673
        packet.append(uatype_Boolean.pack(self.UseServerCapabilitiesDefaults))
9674
        packet.append(uatype_Boolean.pack(self.TreatUncertainAsBad))
9675
        packet.append(uatype_Byte.pack(self.PercentDataBad))
9676
        packet.append(uatype_Byte.pack(self.PercentDataGood))
9677
        packet.append(uatype_Boolean.pack(self.UseSlopedExtrapolation))
9678
        return b''.join(packet)
9679 1
9680
    @staticmethod
9681
    def from_binary(data):
9682
        return AggregateConfiguration(data)
9683 1
9684
    def _binary_init(self, data):
9685
        self.UseServerCapabilitiesDefaults = uatype_Boolean.unpack(data.read(1))[0]
9686
        self.TreatUncertainAsBad = uatype_Boolean.unpack(data.read(1))[0]
9687
        self.PercentDataBad = uatype_Byte.unpack(data.read(1))[0]
9688
        self.PercentDataGood = uatype_Byte.unpack(data.read(1))[0]
9689
        self.UseSlopedExtrapolation = uatype_Boolean.unpack(data.read(1))[0]
9690 1
9691
    def __str__(self):
9692
        return 'AggregateConfiguration(' + 'UseServerCapabilitiesDefaults:' + str(self.UseServerCapabilitiesDefaults) + ', ' + \
9693
               'TreatUncertainAsBad:' + str(self.TreatUncertainAsBad) + ', ' + \
9694
               'PercentDataBad:' + str(self.PercentDataBad) + ', ' + \
9695
               'PercentDataGood:' + str(self.PercentDataGood) + ', ' + \
9696
               'UseSlopedExtrapolation:' + str(self.UseSlopedExtrapolation) + ')'
9697 1
9698
    __repr__ = __str__
9699
9700 1
9701
class AggregateFilter(FrozenClass):
9702
    '''
9703
    :ivar StartTime:
9704
    :vartype StartTime: DateTime
9705
    :ivar AggregateType:
9706
    :vartype AggregateType: NodeId
9707
    :ivar ProcessingInterval:
9708
    :vartype ProcessingInterval: Double
9709
    :ivar AggregateConfiguration:
9710
    :vartype AggregateConfiguration: AggregateConfiguration
9711 1
    '''
9712
    def __init__(self, binary=None):
9713
        if binary is not None:
9714
            self._binary_init(binary)
9715
            self._freeze = True
9716
            return
9717
        self.StartTime = datetime.now()
9718
        self.AggregateType = NodeId()
9719
        self.ProcessingInterval = 0
9720
        self.AggregateConfiguration = AggregateConfiguration()
9721
        self._freeze = True
9722 1
9723
    def to_binary(self):
9724
        packet = []
9725
        packet.append(pack_datetime(self.StartTime))
9726
        packet.append(self.AggregateType.to_binary())
9727
        packet.append(uatype_Double.pack(self.ProcessingInterval))
9728
        packet.append(self.AggregateConfiguration.to_binary())
9729
        return b''.join(packet)
9730 1
9731
    @staticmethod
9732
    def from_binary(data):
9733
        return AggregateFilter(data)
9734 1
9735
    def _binary_init(self, data):
9736
        self.StartTime = unpack_datetime(data)
9737
        self.AggregateType = NodeId.from_binary(data)
9738
        self.ProcessingInterval = uatype_Double.unpack(data.read(8))[0]
9739
        self.AggregateConfiguration = AggregateConfiguration.from_binary(data)
9740 1
9741
    def __str__(self):
9742
        return 'AggregateFilter(' + 'StartTime:' + str(self.StartTime) + ', ' + \
9743
               'AggregateType:' + str(self.AggregateType) + ', ' + \
9744
               'ProcessingInterval:' + str(self.ProcessingInterval) + ', ' + \
9745
               'AggregateConfiguration:' + str(self.AggregateConfiguration) + ')'
9746 1
9747
    __repr__ = __str__
9748
9749 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
9750
class MonitoringFilterResult(FrozenClass):
9751
    '''
9752 1
    '''
9753
    def __init__(self, binary=None):
9754
        if binary is not None:
9755
            self._binary_init(binary)
9756
            self._freeze = True
9757
            return
9758
        self._freeze = True
9759 1
9760
    def to_binary(self):
9761
        packet = []
9762
        return b''.join(packet)
9763 1
9764
    @staticmethod
9765
    def from_binary(data):
9766
        return MonitoringFilterResult(data)
9767 1
9768
    def _binary_init(self, data):
9769
        pass
9770 1
9771
    def __str__(self):
9772
        return 'MonitoringFilterResult(' +  + ')'
9773 1
9774
    __repr__ = __str__
9775
9776 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
9777
class EventFilterResult(FrozenClass):
9778
    '''
9779
    :ivar SelectClauseResults:
9780
    :vartype SelectClauseResults: StatusCode
9781
    :ivar SelectClauseDiagnosticInfos:
9782
    :vartype SelectClauseDiagnosticInfos: DiagnosticInfo
9783
    :ivar WhereClauseResult:
9784
    :vartype WhereClauseResult: ContentFilterResult
9785 1
    '''
9786 1
    def __init__(self, binary=None):
9787 1
        if binary is not None:
9788 1
            self._binary_init(binary)
9789 1
            self._freeze = True
9790 1
            return
9791 1
        self.SelectClauseResults = []
9792 1
        self.SelectClauseDiagnosticInfos = []
9793 1
        self.WhereClauseResult = ContentFilterResult()
9794
        self._freeze = True
9795 1
9796 1
    def to_binary(self):
9797 1
        packet = []
9798 1
        packet.append(uatype_Int32.pack(len(self.SelectClauseResults)))
9799 1
        for fieldname in self.SelectClauseResults:
9800 1
            packet.append(fieldname.to_binary())
9801 1
        packet.append(uatype_Int32.pack(len(self.SelectClauseDiagnosticInfos)))
9802
        for fieldname in self.SelectClauseDiagnosticInfos:
9803 1
            packet.append(fieldname.to_binary())
9804 1
        packet.append(self.WhereClauseResult.to_binary())
9805
        return b''.join(packet)
9806 1
9807
    @staticmethod
9808 1
    def from_binary(data):
9809
        return EventFilterResult(data)
9810 1
9811 1
    def _binary_init(self, data):
9812 1
        length = uatype_Int32.unpack(data.read(4))[0]
9813 1
        array = []
9814 1
        if length != -1:
9815 1
            for _ in range(0, length):
9816 1
                array.append(StatusCode.from_binary(data))
9817 1
        self.SelectClauseResults = array
9818 1
        length = uatype_Int32.unpack(data.read(4))[0]
9819 1
        array = []
9820 1
        if length != -1:
9821
            for _ in range(0, length):
9822 1
                array.append(DiagnosticInfo.from_binary(data))
9823 1
        self.SelectClauseDiagnosticInfos = array
9824
        self.WhereClauseResult = ContentFilterResult.from_binary(data)
9825 1
9826
    def __str__(self):
9827
        return 'EventFilterResult(' + 'SelectClauseResults:' + str(self.SelectClauseResults) + ', ' + \
9828
               'SelectClauseDiagnosticInfos:' + str(self.SelectClauseDiagnosticInfos) + ', ' + \
9829
               'WhereClauseResult:' + str(self.WhereClauseResult) + ')'
9830 1
9831
    __repr__ = __str__
9832
9833 1
9834
class AggregateFilterResult(FrozenClass):
9835
    '''
9836
    :ivar RevisedStartTime:
9837
    :vartype RevisedStartTime: DateTime
9838
    :ivar RevisedProcessingInterval:
9839
    :vartype RevisedProcessingInterval: Double
9840
    :ivar RevisedAggregateConfiguration:
9841
    :vartype RevisedAggregateConfiguration: AggregateConfiguration
9842 1
    '''
9843
    def __init__(self, binary=None):
9844
        if binary is not None:
9845
            self._binary_init(binary)
9846
            self._freeze = True
9847
            return
9848
        self.RevisedStartTime = datetime.now()
9849
        self.RevisedProcessingInterval = 0
9850
        self.RevisedAggregateConfiguration = AggregateConfiguration()
9851
        self._freeze = True
9852 1
9853
    def to_binary(self):
9854
        packet = []
9855
        packet.append(pack_datetime(self.RevisedStartTime))
9856
        packet.append(uatype_Double.pack(self.RevisedProcessingInterval))
9857
        packet.append(self.RevisedAggregateConfiguration.to_binary())
9858
        return b''.join(packet)
9859 1
9860
    @staticmethod
9861
    def from_binary(data):
9862
        return AggregateFilterResult(data)
9863 1
9864
    def _binary_init(self, data):
9865
        self.RevisedStartTime = unpack_datetime(data)
9866
        self.RevisedProcessingInterval = uatype_Double.unpack(data.read(8))[0]
9867
        self.RevisedAggregateConfiguration = AggregateConfiguration.from_binary(data)
9868 1
9869
    def __str__(self):
9870
        return 'AggregateFilterResult(' + 'RevisedStartTime:' + str(self.RevisedStartTime) + ', ' + \
9871
               'RevisedProcessingInterval:' + str(self.RevisedProcessingInterval) + ', ' + \
9872
               'RevisedAggregateConfiguration:' + str(self.RevisedAggregateConfiguration) + ')'
9873 1
9874
    __repr__ = __str__
9875
9876 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
9877
class MonitoringParameters(FrozenClass):
9878
    '''
9879
    :ivar ClientHandle:
9880
    :vartype ClientHandle: UInt32
9881
    :ivar SamplingInterval:
9882
    :vartype SamplingInterval: Double
9883
    :ivar Filter:
9884
    :vartype Filter: ExtensionObject
9885
    :ivar QueueSize:
9886
    :vartype QueueSize: UInt32
9887
    :ivar DiscardOldest:
9888
    :vartype DiscardOldest: Boolean
9889 1
    '''
9890 1
    def __init__(self, binary=None):
9891 1
        if binary is not None:
9892 1
            self._binary_init(binary)
9893 1
            self._freeze = True
9894 1
            return
9895 1
        self.ClientHandle = 0
9896 1
        self.SamplingInterval = 0
9897 1
        self.Filter = None
9898 1
        self.QueueSize = 0
9899 1
        self.DiscardOldest = True
9900
        self._freeze = True
9901 1
9902 1
    def to_binary(self):
9903 1
        packet = []
9904 1
        packet.append(uatype_UInt32.pack(self.ClientHandle))
9905 1
        packet.append(uatype_Double.pack(self.SamplingInterval))
9906 1
        packet.append(extensionobject_to_binary(self.Filter))
9907 1
        packet.append(uatype_UInt32.pack(self.QueueSize))
9908 1
        packet.append(uatype_Boolean.pack(self.DiscardOldest))
9909
        return b''.join(packet)
9910 1
9911
    @staticmethod
9912 1
    def from_binary(data):
9913
        return MonitoringParameters(data)
9914 1
9915 1
    def _binary_init(self, data):
9916 1
        self.ClientHandle = uatype_UInt32.unpack(data.read(4))[0]
9917 1
        self.SamplingInterval = uatype_Double.unpack(data.read(8))[0]
9918 1
        self.Filter = extensionobject_from_binary(data)
9919 1
        self.QueueSize = uatype_UInt32.unpack(data.read(4))[0]
9920
        self.DiscardOldest = uatype_Boolean.unpack(data.read(1))[0]
9921 1
9922
    def __str__(self):
9923
        return 'MonitoringParameters(' + 'ClientHandle:' + str(self.ClientHandle) + ', ' + \
9924
               'SamplingInterval:' + str(self.SamplingInterval) + ', ' + \
9925
               'Filter:' + str(self.Filter) + ', ' + \
9926
               'QueueSize:' + str(self.QueueSize) + ', ' + \
9927
               'DiscardOldest:' + str(self.DiscardOldest) + ')'
9928 1
9929
    __repr__ = __str__
9930
9931 1
9932
class MonitoredItemCreateRequest(FrozenClass):
9933
    '''
9934
    :ivar ItemToMonitor:
9935
    :vartype ItemToMonitor: ReadValueId
9936
    :ivar MonitoringMode:
9937
    :vartype MonitoringMode: MonitoringMode
9938
    :ivar RequestedParameters:
9939
    :vartype RequestedParameters: MonitoringParameters
9940 1
    '''
9941 1
    def __init__(self, binary=None):
9942 1
        if binary is not None:
9943 1
            self._binary_init(binary)
9944 1
            self._freeze = True
9945 1
            return
9946 1
        self.ItemToMonitor = ReadValueId()
9947 1
        self.MonitoringMode = MonitoringMode(0)
9948 1
        self.RequestedParameters = MonitoringParameters()
9949
        self._freeze = True
9950 1
9951 1
    def to_binary(self):
9952 1
        packet = []
9953 1
        packet.append(self.ItemToMonitor.to_binary())
9954 1
        packet.append(uatype_UInt32.pack(self.MonitoringMode.value))
9955 1
        packet.append(self.RequestedParameters.to_binary())
9956
        return b''.join(packet)
9957 1
9958
    @staticmethod
9959 1
    def from_binary(data):
9960
        return MonitoredItemCreateRequest(data)
9961 1
9962 1
    def _binary_init(self, data):
9963 1
        self.ItemToMonitor = ReadValueId.from_binary(data)
9964 1
        self.MonitoringMode = MonitoringMode(uatype_UInt32.unpack(data.read(4))[0])
9965
        self.RequestedParameters = MonitoringParameters.from_binary(data)
9966 1
9967
    def __str__(self):
9968
        return 'MonitoredItemCreateRequest(' + 'ItemToMonitor:' + str(self.ItemToMonitor) + ', ' + \
9969
               'MonitoringMode:' + str(self.MonitoringMode) + ', ' + \
9970
               'RequestedParameters:' + str(self.RequestedParameters) + ')'
9971 1
9972
    __repr__ = __str__
9973
9974 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
9975
class MonitoredItemCreateResult(FrozenClass):
9976
    '''
9977
    :ivar StatusCode:
9978
    :vartype StatusCode: StatusCode
9979
    :ivar MonitoredItemId:
9980
    :vartype MonitoredItemId: UInt32
9981
    :ivar RevisedSamplingInterval:
9982
    :vartype RevisedSamplingInterval: Double
9983
    :ivar RevisedQueueSize:
9984
    :vartype RevisedQueueSize: UInt32
9985
    :ivar FilterResult:
9986
    :vartype FilterResult: ExtensionObject
9987 1
    '''
9988 1
    def __init__(self, binary=None):
9989 1
        if binary is not None:
9990 1
            self._binary_init(binary)
9991 1
            self._freeze = True
9992 1
            return
9993 1
        self.StatusCode = StatusCode()
9994 1
        self.MonitoredItemId = 0
9995 1
        self.RevisedSamplingInterval = 0
9996 1
        self.RevisedQueueSize = 0
9997 1
        self.FilterResult = None
9998
        self._freeze = True
9999 1
10000 1
    def to_binary(self):
10001 1
        packet = []
10002 1
        packet.append(self.StatusCode.to_binary())
10003 1
        packet.append(uatype_UInt32.pack(self.MonitoredItemId))
10004 1
        packet.append(uatype_Double.pack(self.RevisedSamplingInterval))
10005 1
        packet.append(uatype_UInt32.pack(self.RevisedQueueSize))
10006 1
        packet.append(extensionobject_to_binary(self.FilterResult))
10007
        return b''.join(packet)
10008 1
10009
    @staticmethod
10010 1
    def from_binary(data):
10011
        return MonitoredItemCreateResult(data)
10012 1
10013 1
    def _binary_init(self, data):
10014 1
        self.StatusCode = StatusCode.from_binary(data)
10015 1
        self.MonitoredItemId = uatype_UInt32.unpack(data.read(4))[0]
10016 1
        self.RevisedSamplingInterval = uatype_Double.unpack(data.read(8))[0]
10017 1
        self.RevisedQueueSize = uatype_UInt32.unpack(data.read(4))[0]
10018
        self.FilterResult = extensionobject_from_binary(data)
10019 1
10020
    def __str__(self):
10021
        return 'MonitoredItemCreateResult(' + 'StatusCode:' + str(self.StatusCode) + ', ' + \
10022
               'MonitoredItemId:' + str(self.MonitoredItemId) + ', ' + \
10023
               'RevisedSamplingInterval:' + str(self.RevisedSamplingInterval) + ', ' + \
10024
               'RevisedQueueSize:' + str(self.RevisedQueueSize) + ', ' + \
10025
               'FilterResult:' + str(self.FilterResult) + ')'
10026 1
10027
    __repr__ = __str__
10028
10029 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
10030
class CreateMonitoredItemsParameters(FrozenClass):
10031
    '''
10032
    :ivar SubscriptionId:
10033
    :vartype SubscriptionId: UInt32
10034
    :ivar TimestampsToReturn:
10035
    :vartype TimestampsToReturn: TimestampsToReturn
10036
    :ivar ItemsToCreate:
10037
    :vartype ItemsToCreate: MonitoredItemCreateRequest
10038 1
    '''
10039 1
    def __init__(self, binary=None):
10040 1
        if binary is not None:
10041 1
            self._binary_init(binary)
10042 1
            self._freeze = True
10043 1
            return
10044 1
        self.SubscriptionId = 0
10045 1
        self.TimestampsToReturn = TimestampsToReturn(0)
10046 1
        self.ItemsToCreate = []
10047
        self._freeze = True
10048 1
10049 1
    def to_binary(self):
10050 1
        packet = []
10051 1
        packet.append(uatype_UInt32.pack(self.SubscriptionId))
10052 1
        packet.append(uatype_UInt32.pack(self.TimestampsToReturn.value))
10053 1
        packet.append(uatype_Int32.pack(len(self.ItemsToCreate)))
10054 1
        for fieldname in self.ItemsToCreate:
10055 1
            packet.append(fieldname.to_binary())
10056
        return b''.join(packet)
10057 1
10058
    @staticmethod
10059 1
    def from_binary(data):
10060
        return CreateMonitoredItemsParameters(data)
10061 1
10062 1
    def _binary_init(self, data):
10063 1
        self.SubscriptionId = uatype_UInt32.unpack(data.read(4))[0]
10064 1
        self.TimestampsToReturn = TimestampsToReturn(uatype_UInt32.unpack(data.read(4))[0])
10065 1
        length = uatype_Int32.unpack(data.read(4))[0]
10066 1
        array = []
10067 1
        if length != -1:
10068 1
            for _ in range(0, length):
10069 1
                array.append(MonitoredItemCreateRequest.from_binary(data))
10070
        self.ItemsToCreate = array
10071 1
10072
    def __str__(self):
10073
        return 'CreateMonitoredItemsParameters(' + 'SubscriptionId:' + str(self.SubscriptionId) + ', ' + \
10074
               'TimestampsToReturn:' + str(self.TimestampsToReturn) + ', ' + \
10075
               'ItemsToCreate:' + str(self.ItemsToCreate) + ')'
10076 1
10077
    __repr__ = __str__
10078
10079 1
10080
class CreateMonitoredItemsRequest(FrozenClass):
10081
    '''
10082
    :ivar TypeId:
10083
    :vartype TypeId: NodeId
10084
    :ivar RequestHeader:
10085
    :vartype RequestHeader: RequestHeader
10086
    :ivar Parameters:
10087
    :vartype Parameters: CreateMonitoredItemsParameters
10088 1
    '''
10089 1
    def __init__(self, binary=None):
10090
        if binary is not None:
10091
            self._binary_init(binary)
10092
            self._freeze = True
10093 1
            return
10094 1
        self.TypeId = FourByteNodeId(ObjectIds.CreateMonitoredItemsRequest_Encoding_DefaultBinary)
10095 1
        self.RequestHeader = RequestHeader()
10096 1
        self.Parameters = CreateMonitoredItemsParameters()
10097
        self._freeze = True
10098 1
10099 1
    def to_binary(self):
10100 1
        packet = []
10101 1
        packet.append(self.TypeId.to_binary())
10102 1
        packet.append(self.RequestHeader.to_binary())
10103 1
        packet.append(self.Parameters.to_binary())
10104
        return b''.join(packet)
10105 1
10106
    @staticmethod
10107
    def from_binary(data):
10108
        return CreateMonitoredItemsRequest(data)
10109 1
10110
    def _binary_init(self, data):
10111
        self.TypeId = NodeId.from_binary(data)
10112
        self.RequestHeader = RequestHeader.from_binary(data)
10113
        self.Parameters = CreateMonitoredItemsParameters.from_binary(data)
10114 1
10115
    def __str__(self):
10116
        return 'CreateMonitoredItemsRequest(' + 'TypeId:' + str(self.TypeId) + ', ' + \
10117
               'RequestHeader:' + str(self.RequestHeader) + ', ' + \
10118
               'Parameters:' + str(self.Parameters) + ')'
10119 1
10120
    __repr__ = __str__
10121
10122 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
10123
class CreateMonitoredItemsResponse(FrozenClass):
10124
    '''
10125
    :ivar TypeId:
10126
    :vartype TypeId: NodeId
10127
    :ivar ResponseHeader:
10128
    :vartype ResponseHeader: ResponseHeader
10129
    :ivar Results:
10130
    :vartype Results: MonitoredItemCreateResult
10131
    :ivar DiagnosticInfos:
10132
    :vartype DiagnosticInfos: DiagnosticInfo
10133 1
    '''
10134 1
    def __init__(self, binary=None):
10135 1
        if binary is not None:
10136 1
            self._binary_init(binary)
10137 1
            self._freeze = True
10138 1
            return
10139 1
        self.TypeId = FourByteNodeId(ObjectIds.CreateMonitoredItemsResponse_Encoding_DefaultBinary)
10140 1
        self.ResponseHeader = ResponseHeader()
10141 1
        self.Results = []
10142 1
        self.DiagnosticInfos = []
10143
        self._freeze = True
10144 1
10145 1
    def to_binary(self):
10146 1
        packet = []
10147 1
        packet.append(self.TypeId.to_binary())
10148 1
        packet.append(self.ResponseHeader.to_binary())
10149 1
        packet.append(uatype_Int32.pack(len(self.Results)))
10150 1
        for fieldname in self.Results:
10151 1
            packet.append(fieldname.to_binary())
10152 1
        packet.append(uatype_Int32.pack(len(self.DiagnosticInfos)))
10153
        for fieldname in self.DiagnosticInfos:
10154 1
            packet.append(fieldname.to_binary())
10155
        return b''.join(packet)
10156 1
10157
    @staticmethod
10158 1
    def from_binary(data):
10159
        return CreateMonitoredItemsResponse(data)
10160 1
10161 1
    def _binary_init(self, data):
10162 1
        self.TypeId = NodeId.from_binary(data)
10163 1
        self.ResponseHeader = ResponseHeader.from_binary(data)
10164 1
        length = uatype_Int32.unpack(data.read(4))[0]
10165 1
        array = []
10166 1
        if length != -1:
10167 1
            for _ in range(0, length):
10168 1
                array.append(MonitoredItemCreateResult.from_binary(data))
10169 1
        self.Results = array
10170 1
        length = uatype_Int32.unpack(data.read(4))[0]
10171 1
        array = []
10172 1
        if length != -1:
10173
            for _ in range(0, length):
10174 1
                array.append(DiagnosticInfo.from_binary(data))
10175
        self.DiagnosticInfos = array
10176 1
10177
    def __str__(self):
10178
        return 'CreateMonitoredItemsResponse(' + 'TypeId:' + str(self.TypeId) + ', ' + \
10179
               'ResponseHeader:' + str(self.ResponseHeader) + ', ' + \
10180
               'Results:' + str(self.Results) + ', ' + \
10181
               'DiagnosticInfos:' + str(self.DiagnosticInfos) + ')'
10182 1
10183
    __repr__ = __str__
10184
10185 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
10186
class MonitoredItemModifyRequest(FrozenClass):
10187
    '''
10188
    :ivar MonitoredItemId:
10189
    :vartype MonitoredItemId: UInt32
10190
    :ivar RequestedParameters:
10191
    :vartype RequestedParameters: MonitoringParameters
10192 1
    '''
10193
    def __init__(self, binary=None):
10194
        if binary is not None:
10195
            self._binary_init(binary)
10196
            self._freeze = True
10197
            return
10198
        self.MonitoredItemId = 0
10199
        self.RequestedParameters = MonitoringParameters()
10200
        self._freeze = True
10201 1
10202
    def to_binary(self):
10203
        packet = []
10204
        packet.append(uatype_UInt32.pack(self.MonitoredItemId))
10205
        packet.append(self.RequestedParameters.to_binary())
10206
        return b''.join(packet)
10207 1
10208
    @staticmethod
10209
    def from_binary(data):
10210
        return MonitoredItemModifyRequest(data)
10211 1
10212
    def _binary_init(self, data):
10213
        self.MonitoredItemId = uatype_UInt32.unpack(data.read(4))[0]
10214
        self.RequestedParameters = MonitoringParameters.from_binary(data)
10215 1
10216
    def __str__(self):
10217
        return 'MonitoredItemModifyRequest(' + 'MonitoredItemId:' + str(self.MonitoredItemId) + ', ' + \
10218
               'RequestedParameters:' + str(self.RequestedParameters) + ')'
10219 1
10220
    __repr__ = __str__
10221
10222 1
10223
class MonitoredItemModifyResult(FrozenClass):
10224
    '''
10225
    :ivar StatusCode:
10226
    :vartype StatusCode: StatusCode
10227
    :ivar RevisedSamplingInterval:
10228
    :vartype RevisedSamplingInterval: Double
10229
    :ivar RevisedQueueSize:
10230
    :vartype RevisedQueueSize: UInt32
10231
    :ivar FilterResult:
10232
    :vartype FilterResult: ExtensionObject
10233 1
    '''
10234
    def __init__(self, binary=None):
10235
        if binary is not None:
10236
            self._binary_init(binary)
10237
            self._freeze = True
10238
            return
10239
        self.StatusCode = StatusCode()
10240
        self.RevisedSamplingInterval = 0
10241
        self.RevisedQueueSize = 0
10242
        self.FilterResult = None
10243
        self._freeze = True
10244 1
10245
    def to_binary(self):
10246
        packet = []
10247
        packet.append(self.StatusCode.to_binary())
10248
        packet.append(uatype_Double.pack(self.RevisedSamplingInterval))
10249
        packet.append(uatype_UInt32.pack(self.RevisedQueueSize))
10250
        packet.append(extensionobject_to_binary(self.FilterResult))
10251
        return b''.join(packet)
10252 1
10253
    @staticmethod
10254
    def from_binary(data):
10255
        return MonitoredItemModifyResult(data)
10256 1
10257
    def _binary_init(self, data):
10258
        self.StatusCode = StatusCode.from_binary(data)
10259
        self.RevisedSamplingInterval = uatype_Double.unpack(data.read(8))[0]
10260
        self.RevisedQueueSize = uatype_UInt32.unpack(data.read(4))[0]
10261
        self.FilterResult = extensionobject_from_binary(data)
10262 1
10263
    def __str__(self):
10264
        return 'MonitoredItemModifyResult(' + 'StatusCode:' + str(self.StatusCode) + ', ' + \
10265
               'RevisedSamplingInterval:' + str(self.RevisedSamplingInterval) + ', ' + \
10266
               'RevisedQueueSize:' + str(self.RevisedQueueSize) + ', ' + \
10267
               'FilterResult:' + str(self.FilterResult) + ')'
10268 1
10269
    __repr__ = __str__
10270
10271 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
10272
class ModifyMonitoredItemsParameters(FrozenClass):
10273
    '''
10274
    :ivar SubscriptionId:
10275
    :vartype SubscriptionId: UInt32
10276
    :ivar TimestampsToReturn:
10277
    :vartype TimestampsToReturn: TimestampsToReturn
10278
    :ivar ItemsToModify:
10279
    :vartype ItemsToModify: MonitoredItemModifyRequest
10280 1
    '''
10281
    def __init__(self, binary=None):
10282
        if binary is not None:
10283
            self._binary_init(binary)
10284
            self._freeze = True
10285
            return
10286
        self.SubscriptionId = 0
10287
        self.TimestampsToReturn = TimestampsToReturn(0)
10288
        self.ItemsToModify = []
10289
        self._freeze = True
10290 1
10291
    def to_binary(self):
10292
        packet = []
10293
        packet.append(uatype_UInt32.pack(self.SubscriptionId))
10294
        packet.append(uatype_UInt32.pack(self.TimestampsToReturn.value))
10295
        packet.append(uatype_Int32.pack(len(self.ItemsToModify)))
10296
        for fieldname in self.ItemsToModify:
10297
            packet.append(fieldname.to_binary())
10298
        return b''.join(packet)
10299 1
10300
    @staticmethod
10301
    def from_binary(data):
10302
        return ModifyMonitoredItemsParameters(data)
10303 1
10304
    def _binary_init(self, data):
10305
        self.SubscriptionId = uatype_UInt32.unpack(data.read(4))[0]
10306
        self.TimestampsToReturn = TimestampsToReturn(uatype_UInt32.unpack(data.read(4))[0])
10307
        length = uatype_Int32.unpack(data.read(4))[0]
10308
        array = []
10309
        if length != -1:
10310
            for _ in range(0, length):
10311
                array.append(MonitoredItemModifyRequest.from_binary(data))
10312
        self.ItemsToModify = array
10313 1
10314
    def __str__(self):
10315
        return 'ModifyMonitoredItemsParameters(' + 'SubscriptionId:' + str(self.SubscriptionId) + ', ' + \
10316
               'TimestampsToReturn:' + str(self.TimestampsToReturn) + ', ' + \
10317
               'ItemsToModify:' + str(self.ItemsToModify) + ')'
10318 1
10319
    __repr__ = __str__
10320
10321 1
10322
class ModifyMonitoredItemsRequest(FrozenClass):
10323
    '''
10324
    :ivar TypeId:
10325
    :vartype TypeId: NodeId
10326
    :ivar RequestHeader:
10327
    :vartype RequestHeader: RequestHeader
10328
    :ivar Parameters:
10329
    :vartype Parameters: ModifyMonitoredItemsParameters
10330 1
    '''
10331
    def __init__(self, binary=None):
10332
        if binary is not None:
10333
            self._binary_init(binary)
10334
            self._freeze = True
10335
            return
10336
        self.TypeId = FourByteNodeId(ObjectIds.ModifyMonitoredItemsRequest_Encoding_DefaultBinary)
10337
        self.RequestHeader = RequestHeader()
10338
        self.Parameters = ModifyMonitoredItemsParameters()
10339
        self._freeze = True
10340 1
10341
    def to_binary(self):
10342
        packet = []
10343
        packet.append(self.TypeId.to_binary())
10344
        packet.append(self.RequestHeader.to_binary())
10345
        packet.append(self.Parameters.to_binary())
10346
        return b''.join(packet)
10347 1
10348
    @staticmethod
10349
    def from_binary(data):
10350
        return ModifyMonitoredItemsRequest(data)
10351 1
10352
    def _binary_init(self, data):
10353
        self.TypeId = NodeId.from_binary(data)
10354
        self.RequestHeader = RequestHeader.from_binary(data)
10355
        self.Parameters = ModifyMonitoredItemsParameters.from_binary(data)
10356 1
10357
    def __str__(self):
10358
        return 'ModifyMonitoredItemsRequest(' + 'TypeId:' + str(self.TypeId) + ', ' + \
10359
               'RequestHeader:' + str(self.RequestHeader) + ', ' + \
10360
               'Parameters:' + str(self.Parameters) + ')'
10361 1
10362
    __repr__ = __str__
10363
10364 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
10365
class ModifyMonitoredItemsResponse(FrozenClass):
10366
    '''
10367
    :ivar TypeId:
10368
    :vartype TypeId: NodeId
10369
    :ivar ResponseHeader:
10370
    :vartype ResponseHeader: ResponseHeader
10371
    :ivar Results:
10372
    :vartype Results: MonitoredItemModifyResult
10373
    :ivar DiagnosticInfos:
10374
    :vartype DiagnosticInfos: DiagnosticInfo
10375 1
    '''
10376
    def __init__(self, binary=None):
10377
        if binary is not None:
10378
            self._binary_init(binary)
10379
            self._freeze = True
10380
            return
10381
        self.TypeId = FourByteNodeId(ObjectIds.ModifyMonitoredItemsResponse_Encoding_DefaultBinary)
10382
        self.ResponseHeader = ResponseHeader()
10383
        self.Results = []
10384
        self.DiagnosticInfos = []
10385
        self._freeze = True
10386 1
10387
    def to_binary(self):
10388
        packet = []
10389
        packet.append(self.TypeId.to_binary())
10390
        packet.append(self.ResponseHeader.to_binary())
10391
        packet.append(uatype_Int32.pack(len(self.Results)))
10392
        for fieldname in self.Results:
10393
            packet.append(fieldname.to_binary())
10394
        packet.append(uatype_Int32.pack(len(self.DiagnosticInfos)))
10395
        for fieldname in self.DiagnosticInfos:
10396
            packet.append(fieldname.to_binary())
10397
        return b''.join(packet)
10398 1
10399
    @staticmethod
10400
    def from_binary(data):
10401
        return ModifyMonitoredItemsResponse(data)
10402 1
10403
    def _binary_init(self, data):
10404
        self.TypeId = NodeId.from_binary(data)
10405
        self.ResponseHeader = ResponseHeader.from_binary(data)
10406
        length = uatype_Int32.unpack(data.read(4))[0]
10407
        array = []
10408
        if length != -1:
10409
            for _ in range(0, length):
10410
                array.append(MonitoredItemModifyResult.from_binary(data))
10411
        self.Results = array
10412
        length = uatype_Int32.unpack(data.read(4))[0]
10413
        array = []
10414
        if length != -1:
10415
            for _ in range(0, length):
10416
                array.append(DiagnosticInfo.from_binary(data))
10417
        self.DiagnosticInfos = array
10418 1
10419
    def __str__(self):
10420
        return 'ModifyMonitoredItemsResponse(' + 'TypeId:' + str(self.TypeId) + ', ' + \
10421
               'ResponseHeader:' + str(self.ResponseHeader) + ', ' + \
10422
               'Results:' + str(self.Results) + ', ' + \
10423
               'DiagnosticInfos:' + str(self.DiagnosticInfos) + ')'
10424 1
10425
    __repr__ = __str__
10426
10427 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
10428
class SetMonitoringModeParameters(FrozenClass):
10429
    '''
10430
    :ivar SubscriptionId:
10431
    :vartype SubscriptionId: UInt32
10432
    :ivar MonitoringMode:
10433
    :vartype MonitoringMode: MonitoringMode
10434
    :ivar MonitoredItemIds:
10435
    :vartype MonitoredItemIds: UInt32
10436 1
    '''
10437
    def __init__(self, binary=None):
10438
        if binary is not None:
10439
            self._binary_init(binary)
10440
            self._freeze = True
10441
            return
10442
        self.SubscriptionId = 0
10443
        self.MonitoringMode = MonitoringMode(0)
10444
        self.MonitoredItemIds = []
10445
        self._freeze = True
10446 1
10447
    def to_binary(self):
10448
        packet = []
10449
        packet.append(uatype_UInt32.pack(self.SubscriptionId))
10450
        packet.append(uatype_UInt32.pack(self.MonitoringMode.value))
10451
        packet.append(uatype_Int32.pack(len(self.MonitoredItemIds)))
10452
        for fieldname in self.MonitoredItemIds:
10453
            packet.append(uatype_UInt32.pack(fieldname))
10454
        return b''.join(packet)
10455 1
10456
    @staticmethod
10457
    def from_binary(data):
10458
        return SetMonitoringModeParameters(data)
10459 1
10460
    def _binary_init(self, data):
10461
        self.SubscriptionId = uatype_UInt32.unpack(data.read(4))[0]
10462
        self.MonitoringMode = MonitoringMode(uatype_UInt32.unpack(data.read(4))[0])
10463
        self.MonitoredItemIds = unpack_uatype_array('UInt32', data)
10464 1
10465
    def __str__(self):
10466
        return 'SetMonitoringModeParameters(' + 'SubscriptionId:' + str(self.SubscriptionId) + ', ' + \
10467
               'MonitoringMode:' + str(self.MonitoringMode) + ', ' + \
10468
               'MonitoredItemIds:' + str(self.MonitoredItemIds) + ')'
10469 1
10470
    __repr__ = __str__
10471
10472 1
10473
class SetMonitoringModeRequest(FrozenClass):
10474
    '''
10475
    :ivar TypeId:
10476
    :vartype TypeId: NodeId
10477
    :ivar RequestHeader:
10478
    :vartype RequestHeader: RequestHeader
10479
    :ivar Parameters:
10480
    :vartype Parameters: SetMonitoringModeParameters
10481 1
    '''
10482
    def __init__(self, binary=None):
10483
        if binary is not None:
10484
            self._binary_init(binary)
10485
            self._freeze = True
10486
            return
10487
        self.TypeId = FourByteNodeId(ObjectIds.SetMonitoringModeRequest_Encoding_DefaultBinary)
10488
        self.RequestHeader = RequestHeader()
10489
        self.Parameters = SetMonitoringModeParameters()
10490
        self._freeze = True
10491 1
10492
    def to_binary(self):
10493
        packet = []
10494
        packet.append(self.TypeId.to_binary())
10495
        packet.append(self.RequestHeader.to_binary())
10496
        packet.append(self.Parameters.to_binary())
10497
        return b''.join(packet)
10498 1
10499
    @staticmethod
10500
    def from_binary(data):
10501
        return SetMonitoringModeRequest(data)
10502 1
10503
    def _binary_init(self, data):
10504
        self.TypeId = NodeId.from_binary(data)
10505
        self.RequestHeader = RequestHeader.from_binary(data)
10506
        self.Parameters = SetMonitoringModeParameters.from_binary(data)
10507 1
10508
    def __str__(self):
10509
        return 'SetMonitoringModeRequest(' + 'TypeId:' + str(self.TypeId) + ', ' + \
10510
               'RequestHeader:' + str(self.RequestHeader) + ', ' + \
10511
               'Parameters:' + str(self.Parameters) + ')'
10512 1
10513
    __repr__ = __str__
10514
10515 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
10516
class SetMonitoringModeResult(FrozenClass):
10517
    '''
10518
    :ivar Results:
10519
    :vartype Results: StatusCode
10520
    :ivar DiagnosticInfos:
10521
    :vartype DiagnosticInfos: DiagnosticInfo
10522 1
    '''
10523
    def __init__(self, binary=None):
10524
        if binary is not None:
10525
            self._binary_init(binary)
10526
            self._freeze = True
10527
            return
10528
        self.Results = []
10529
        self.DiagnosticInfos = []
10530
        self._freeze = True
10531 1
10532
    def to_binary(self):
10533
        packet = []
10534
        packet.append(uatype_Int32.pack(len(self.Results)))
10535
        for fieldname in self.Results:
10536
            packet.append(fieldname.to_binary())
10537
        packet.append(uatype_Int32.pack(len(self.DiagnosticInfos)))
10538
        for fieldname in self.DiagnosticInfos:
10539
            packet.append(fieldname.to_binary())
10540
        return b''.join(packet)
10541 1
10542
    @staticmethod
10543
    def from_binary(data):
10544
        return SetMonitoringModeResult(data)
10545 1
10546
    def _binary_init(self, data):
10547
        length = uatype_Int32.unpack(data.read(4))[0]
10548
        array = []
10549
        if length != -1:
10550
            for _ in range(0, length):
10551
                array.append(StatusCode.from_binary(data))
10552
        self.Results = array
10553
        length = uatype_Int32.unpack(data.read(4))[0]
10554
        array = []
10555
        if length != -1:
10556
            for _ in range(0, length):
10557
                array.append(DiagnosticInfo.from_binary(data))
10558
        self.DiagnosticInfos = array
10559 1
10560
    def __str__(self):
10561
        return 'SetMonitoringModeResult(' + 'Results:' + str(self.Results) + ', ' + \
10562
               'DiagnosticInfos:' + str(self.DiagnosticInfos) + ')'
10563 1
10564
    __repr__ = __str__
10565
10566 1
10567
class SetMonitoringModeResponse(FrozenClass):
10568
    '''
10569
    :ivar TypeId:
10570
    :vartype TypeId: NodeId
10571
    :ivar ResponseHeader:
10572
    :vartype ResponseHeader: ResponseHeader
10573
    :ivar Parameters:
10574
    :vartype Parameters: SetMonitoringModeResult
10575 1
    '''
10576
    def __init__(self, binary=None):
10577
        if binary is not None:
10578
            self._binary_init(binary)
10579
            self._freeze = True
10580
            return
10581
        self.TypeId = FourByteNodeId(ObjectIds.SetMonitoringModeResponse_Encoding_DefaultBinary)
10582
        self.ResponseHeader = ResponseHeader()
10583
        self.Parameters = SetMonitoringModeResult()
10584
        self._freeze = True
10585 1
10586
    def to_binary(self):
10587
        packet = []
10588
        packet.append(self.TypeId.to_binary())
10589
        packet.append(self.ResponseHeader.to_binary())
10590
        packet.append(self.Parameters.to_binary())
10591
        return b''.join(packet)
10592 1
10593
    @staticmethod
10594
    def from_binary(data):
10595
        return SetMonitoringModeResponse(data)
10596 1
10597
    def _binary_init(self, data):
10598
        self.TypeId = NodeId.from_binary(data)
10599
        self.ResponseHeader = ResponseHeader.from_binary(data)
10600
        self.Parameters = SetMonitoringModeResult.from_binary(data)
10601 1
10602
    def __str__(self):
10603
        return 'SetMonitoringModeResponse(' + 'TypeId:' + str(self.TypeId) + ', ' + \
10604
               'ResponseHeader:' + str(self.ResponseHeader) + ', ' + \
10605
               'Parameters:' + str(self.Parameters) + ')'
10606 1
10607
    __repr__ = __str__
10608
10609 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
10610
class SetTriggeringParameters(FrozenClass):
10611
    '''
10612
    :ivar SubscriptionId:
10613
    :vartype SubscriptionId: UInt32
10614
    :ivar TriggeringItemId:
10615
    :vartype TriggeringItemId: UInt32
10616
    :ivar LinksToAdd:
10617
    :vartype LinksToAdd: UInt32
10618
    :ivar LinksToRemove:
10619
    :vartype LinksToRemove: UInt32
10620 1
    '''
10621
    def __init__(self, binary=None):
10622
        if binary is not None:
10623
            self._binary_init(binary)
10624
            self._freeze = True
10625
            return
10626
        self.SubscriptionId = 0
10627
        self.TriggeringItemId = 0
10628
        self.LinksToAdd = []
10629
        self.LinksToRemove = []
10630
        self._freeze = True
10631 1
10632
    def to_binary(self):
10633
        packet = []
10634
        packet.append(uatype_UInt32.pack(self.SubscriptionId))
10635
        packet.append(uatype_UInt32.pack(self.TriggeringItemId))
10636
        packet.append(uatype_Int32.pack(len(self.LinksToAdd)))
10637
        for fieldname in self.LinksToAdd:
10638
            packet.append(uatype_UInt32.pack(fieldname))
10639
        packet.append(uatype_Int32.pack(len(self.LinksToRemove)))
10640
        for fieldname in self.LinksToRemove:
10641
            packet.append(uatype_UInt32.pack(fieldname))
10642
        return b''.join(packet)
10643 1
10644
    @staticmethod
10645
    def from_binary(data):
10646
        return SetTriggeringParameters(data)
10647 1
10648
    def _binary_init(self, data):
10649
        self.SubscriptionId = uatype_UInt32.unpack(data.read(4))[0]
10650
        self.TriggeringItemId = uatype_UInt32.unpack(data.read(4))[0]
10651
        self.LinksToAdd = unpack_uatype_array('UInt32', data)
10652
        self.LinksToRemove = unpack_uatype_array('UInt32', data)
10653 1
10654
    def __str__(self):
10655
        return 'SetTriggeringParameters(' + 'SubscriptionId:' + str(self.SubscriptionId) + ', ' + \
10656
               'TriggeringItemId:' + str(self.TriggeringItemId) + ', ' + \
10657
               'LinksToAdd:' + str(self.LinksToAdd) + ', ' + \
10658
               'LinksToRemove:' + str(self.LinksToRemove) + ')'
10659 1
10660
    __repr__ = __str__
10661
10662 1
10663
class SetTriggeringRequest(FrozenClass):
10664
    '''
10665
    :ivar TypeId:
10666
    :vartype TypeId: NodeId
10667
    :ivar RequestHeader:
10668
    :vartype RequestHeader: RequestHeader
10669
    :ivar Parameters:
10670
    :vartype Parameters: SetTriggeringParameters
10671 1
    '''
10672
    def __init__(self, binary=None):
10673
        if binary is not None:
10674
            self._binary_init(binary)
10675
            self._freeze = True
10676
            return
10677
        self.TypeId = FourByteNodeId(ObjectIds.SetTriggeringRequest_Encoding_DefaultBinary)
10678
        self.RequestHeader = RequestHeader()
10679
        self.Parameters = SetTriggeringParameters()
10680
        self._freeze = True
10681 1
10682
    def to_binary(self):
10683
        packet = []
10684
        packet.append(self.TypeId.to_binary())
10685
        packet.append(self.RequestHeader.to_binary())
10686
        packet.append(self.Parameters.to_binary())
10687
        return b''.join(packet)
10688 1
10689
    @staticmethod
10690
    def from_binary(data):
10691
        return SetTriggeringRequest(data)
10692 1
10693
    def _binary_init(self, data):
10694
        self.TypeId = NodeId.from_binary(data)
10695
        self.RequestHeader = RequestHeader.from_binary(data)
10696
        self.Parameters = SetTriggeringParameters.from_binary(data)
10697 1
10698
    def __str__(self):
10699
        return 'SetTriggeringRequest(' + 'TypeId:' + str(self.TypeId) + ', ' + \
10700
               'RequestHeader:' + str(self.RequestHeader) + ', ' + \
10701
               'Parameters:' + str(self.Parameters) + ')'
10702 1
10703
    __repr__ = __str__
10704
10705 1
10706
class SetTriggeringResult(FrozenClass):
10707
    '''
10708
    :ivar AddResults:
10709
    :vartype AddResults: StatusCode
10710
    :ivar AddDiagnosticInfos:
10711
    :vartype AddDiagnosticInfos: DiagnosticInfo
10712
    :ivar RemoveResults:
10713
    :vartype RemoveResults: StatusCode
10714
    :ivar RemoveDiagnosticInfos:
10715
    :vartype RemoveDiagnosticInfos: DiagnosticInfo
10716 1
    '''
10717
    def __init__(self, binary=None):
10718
        if binary is not None:
10719
            self._binary_init(binary)
10720
            self._freeze = True
10721
            return
10722
        self.AddResults = []
10723
        self.AddDiagnosticInfos = []
10724
        self.RemoveResults = []
10725
        self.RemoveDiagnosticInfos = []
10726
        self._freeze = True
10727 1
10728
    def to_binary(self):
10729
        packet = []
10730
        packet.append(uatype_Int32.pack(len(self.AddResults)))
10731
        for fieldname in self.AddResults:
10732
            packet.append(fieldname.to_binary())
10733
        packet.append(uatype_Int32.pack(len(self.AddDiagnosticInfos)))
10734
        for fieldname in self.AddDiagnosticInfos:
10735
            packet.append(fieldname.to_binary())
10736
        packet.append(uatype_Int32.pack(len(self.RemoveResults)))
10737
        for fieldname in self.RemoveResults:
10738
            packet.append(fieldname.to_binary())
10739
        packet.append(uatype_Int32.pack(len(self.RemoveDiagnosticInfos)))
10740
        for fieldname in self.RemoveDiagnosticInfos:
10741
            packet.append(fieldname.to_binary())
10742
        return b''.join(packet)
10743 1
10744
    @staticmethod
10745
    def from_binary(data):
10746
        return SetTriggeringResult(data)
10747 1
10748
    def _binary_init(self, data):
10749
        length = uatype_Int32.unpack(data.read(4))[0]
10750
        array = []
10751
        if length != -1:
10752
            for _ in range(0, length):
10753
                array.append(StatusCode.from_binary(data))
10754
        self.AddResults = array
10755
        length = uatype_Int32.unpack(data.read(4))[0]
10756
        array = []
10757
        if length != -1:
10758
            for _ in range(0, length):
10759
                array.append(DiagnosticInfo.from_binary(data))
10760
        self.AddDiagnosticInfos = array
10761
        length = uatype_Int32.unpack(data.read(4))[0]
10762
        array = []
10763
        if length != -1:
10764
            for _ in range(0, length):
10765
                array.append(StatusCode.from_binary(data))
10766
        self.RemoveResults = array
10767
        length = uatype_Int32.unpack(data.read(4))[0]
10768
        array = []
10769
        if length != -1:
10770
            for _ in range(0, length):
10771
                array.append(DiagnosticInfo.from_binary(data))
10772
        self.RemoveDiagnosticInfos = array
10773 1
10774
    def __str__(self):
10775
        return 'SetTriggeringResult(' + 'AddResults:' + str(self.AddResults) + ', ' + \
10776
               'AddDiagnosticInfos:' + str(self.AddDiagnosticInfos) + ', ' + \
10777
               'RemoveResults:' + str(self.RemoveResults) + ', ' + \
10778
               'RemoveDiagnosticInfos:' + str(self.RemoveDiagnosticInfos) + ')'
10779 1
10780
    __repr__ = __str__
10781
10782 1
10783
class SetTriggeringResponse(FrozenClass):
10784
    '''
10785
    :ivar TypeId:
10786
    :vartype TypeId: NodeId
10787
    :ivar ResponseHeader:
10788
    :vartype ResponseHeader: ResponseHeader
10789
    :ivar Parameters:
10790
    :vartype Parameters: SetTriggeringResult
10791 1
    '''
10792
    def __init__(self, binary=None):
10793
        if binary is not None:
10794
            self._binary_init(binary)
10795
            self._freeze = True
10796
            return
10797
        self.TypeId = FourByteNodeId(ObjectIds.SetTriggeringResponse_Encoding_DefaultBinary)
10798
        self.ResponseHeader = ResponseHeader()
10799
        self.Parameters = SetTriggeringResult()
10800
        self._freeze = True
10801 1
10802
    def to_binary(self):
10803
        packet = []
10804
        packet.append(self.TypeId.to_binary())
10805
        packet.append(self.ResponseHeader.to_binary())
10806
        packet.append(self.Parameters.to_binary())
10807
        return b''.join(packet)
10808 1
10809
    @staticmethod
10810
    def from_binary(data):
10811
        return SetTriggeringResponse(data)
10812 1
10813
    def _binary_init(self, data):
10814
        self.TypeId = NodeId.from_binary(data)
10815
        self.ResponseHeader = ResponseHeader.from_binary(data)
10816
        self.Parameters = SetTriggeringResult.from_binary(data)
10817 1
10818
    def __str__(self):
10819
        return 'SetTriggeringResponse(' + 'TypeId:' + str(self.TypeId) + ', ' + \
10820
               'ResponseHeader:' + str(self.ResponseHeader) + ', ' + \
10821
               'Parameters:' + str(self.Parameters) + ')'
10822 1
10823
    __repr__ = __str__
10824
10825 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
10826
class DeleteMonitoredItemsParameters(FrozenClass):
10827
    '''
10828
    :ivar SubscriptionId:
10829
    :vartype SubscriptionId: UInt32
10830
    :ivar MonitoredItemIds:
10831
    :vartype MonitoredItemIds: UInt32
10832 1
    '''
10833 1
    def __init__(self, binary=None):
10834 1
        if binary is not None:
10835 1
            self._binary_init(binary)
10836 1
            self._freeze = True
10837 1
            return
10838 1
        self.SubscriptionId = 0
10839 1
        self.MonitoredItemIds = []
10840
        self._freeze = True
10841 1
10842 1
    def to_binary(self):
10843 1
        packet = []
10844 1
        packet.append(uatype_UInt32.pack(self.SubscriptionId))
10845 1
        packet.append(uatype_Int32.pack(len(self.MonitoredItemIds)))
10846 1
        for fieldname in self.MonitoredItemIds:
10847 1
            packet.append(uatype_UInt32.pack(fieldname))
10848
        return b''.join(packet)
10849 1
10850
    @staticmethod
10851 1
    def from_binary(data):
10852
        return DeleteMonitoredItemsParameters(data)
10853 1
10854 1
    def _binary_init(self, data):
10855 1
        self.SubscriptionId = uatype_UInt32.unpack(data.read(4))[0]
10856
        self.MonitoredItemIds = unpack_uatype_array('UInt32', data)
10857 1
10858
    def __str__(self):
10859
        return 'DeleteMonitoredItemsParameters(' + 'SubscriptionId:' + str(self.SubscriptionId) + ', ' + \
10860
               'MonitoredItemIds:' + str(self.MonitoredItemIds) + ')'
10861 1
10862
    __repr__ = __str__
10863
10864 1
10865
class DeleteMonitoredItemsRequest(FrozenClass):
10866
    '''
10867
    :ivar TypeId:
10868
    :vartype TypeId: NodeId
10869
    :ivar RequestHeader:
10870
    :vartype RequestHeader: RequestHeader
10871
    :ivar Parameters:
10872
    :vartype Parameters: DeleteMonitoredItemsParameters
10873 1
    '''
10874 1
    def __init__(self, binary=None):
10875
        if binary is not None:
10876
            self._binary_init(binary)
10877
            self._freeze = True
10878 1
            return
10879 1
        self.TypeId = FourByteNodeId(ObjectIds.DeleteMonitoredItemsRequest_Encoding_DefaultBinary)
10880 1
        self.RequestHeader = RequestHeader()
10881 1
        self.Parameters = DeleteMonitoredItemsParameters()
10882
        self._freeze = True
10883 1
10884 1
    def to_binary(self):
10885 1
        packet = []
10886 1
        packet.append(self.TypeId.to_binary())
10887 1
        packet.append(self.RequestHeader.to_binary())
10888 1
        packet.append(self.Parameters.to_binary())
10889
        return b''.join(packet)
10890 1
10891
    @staticmethod
10892
    def from_binary(data):
10893
        return DeleteMonitoredItemsRequest(data)
10894 1
10895
    def _binary_init(self, data):
10896
        self.TypeId = NodeId.from_binary(data)
10897
        self.RequestHeader = RequestHeader.from_binary(data)
10898
        self.Parameters = DeleteMonitoredItemsParameters.from_binary(data)
10899 1
10900
    def __str__(self):
10901
        return 'DeleteMonitoredItemsRequest(' + 'TypeId:' + str(self.TypeId) + ', ' + \
10902
               'RequestHeader:' + str(self.RequestHeader) + ', ' + \
10903
               'Parameters:' + str(self.Parameters) + ')'
10904 1
10905
    __repr__ = __str__
10906
10907 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
10908
class DeleteMonitoredItemsResponse(FrozenClass):
10909
    '''
10910
    :ivar TypeId:
10911
    :vartype TypeId: NodeId
10912
    :ivar ResponseHeader:
10913
    :vartype ResponseHeader: ResponseHeader
10914
    :ivar Results:
10915
    :vartype Results: StatusCode
10916
    :ivar DiagnosticInfos:
10917
    :vartype DiagnosticInfos: DiagnosticInfo
10918 1
    '''
10919 1
    def __init__(self, binary=None):
10920 1
        if binary is not None:
10921 1
            self._binary_init(binary)
10922 1
            self._freeze = True
10923 1
            return
10924 1
        self.TypeId = FourByteNodeId(ObjectIds.DeleteMonitoredItemsResponse_Encoding_DefaultBinary)
10925 1
        self.ResponseHeader = ResponseHeader()
10926 1
        self.Results = []
10927 1
        self.DiagnosticInfos = []
10928
        self._freeze = True
10929 1
10930 1
    def to_binary(self):
10931 1
        packet = []
10932 1
        packet.append(self.TypeId.to_binary())
10933 1
        packet.append(self.ResponseHeader.to_binary())
10934 1
        packet.append(uatype_Int32.pack(len(self.Results)))
10935 1
        for fieldname in self.Results:
10936 1
            packet.append(fieldname.to_binary())
10937 1
        packet.append(uatype_Int32.pack(len(self.DiagnosticInfos)))
10938
        for fieldname in self.DiagnosticInfos:
10939 1
            packet.append(fieldname.to_binary())
10940
        return b''.join(packet)
10941 1
10942
    @staticmethod
10943 1
    def from_binary(data):
10944
        return DeleteMonitoredItemsResponse(data)
10945 1
10946 1
    def _binary_init(self, data):
10947 1
        self.TypeId = NodeId.from_binary(data)
10948 1
        self.ResponseHeader = ResponseHeader.from_binary(data)
10949 1
        length = uatype_Int32.unpack(data.read(4))[0]
10950 1
        array = []
10951 1
        if length != -1:
10952 1
            for _ in range(0, length):
10953 1
                array.append(StatusCode.from_binary(data))
10954 1
        self.Results = array
10955 1
        length = uatype_Int32.unpack(data.read(4))[0]
10956 1
        array = []
10957 1
        if length != -1:
10958
            for _ in range(0, length):
10959 1
                array.append(DiagnosticInfo.from_binary(data))
10960
        self.DiagnosticInfos = array
10961 1
10962
    def __str__(self):
10963
        return 'DeleteMonitoredItemsResponse(' + 'TypeId:' + str(self.TypeId) + ', ' + \
10964
               'ResponseHeader:' + str(self.ResponseHeader) + ', ' + \
10965
               'Results:' + str(self.Results) + ', ' + \
10966
               'DiagnosticInfos:' + str(self.DiagnosticInfos) + ')'
10967 1
10968
    __repr__ = __str__
10969
10970 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
10971
class CreateSubscriptionParameters(FrozenClass):
10972
    '''
10973
    :ivar RequestedPublishingInterval:
10974
    :vartype RequestedPublishingInterval: Double
10975
    :ivar RequestedLifetimeCount:
10976
    :vartype RequestedLifetimeCount: UInt32
10977
    :ivar RequestedMaxKeepAliveCount:
10978
    :vartype RequestedMaxKeepAliveCount: UInt32
10979
    :ivar MaxNotificationsPerPublish:
10980
    :vartype MaxNotificationsPerPublish: UInt32
10981
    :ivar PublishingEnabled:
10982
    :vartype PublishingEnabled: Boolean
10983
    :ivar Priority:
10984
    :vartype Priority: Byte
10985 1
    '''
10986 1
    def __init__(self, binary=None):
10987 1
        if binary is not None:
10988 1
            self._binary_init(binary)
10989 1
            self._freeze = True
10990 1
            return
10991 1
        self.RequestedPublishingInterval = 0
10992 1
        self.RequestedLifetimeCount = 0
10993 1
        self.RequestedMaxKeepAliveCount = 0
10994 1
        self.MaxNotificationsPerPublish = 0
10995 1
        self.PublishingEnabled = True
10996 1
        self.Priority = 0
10997
        self._freeze = True
10998 1
10999 1
    def to_binary(self):
11000 1
        packet = []
11001 1
        packet.append(uatype_Double.pack(self.RequestedPublishingInterval))
11002 1
        packet.append(uatype_UInt32.pack(self.RequestedLifetimeCount))
11003 1
        packet.append(uatype_UInt32.pack(self.RequestedMaxKeepAliveCount))
11004 1
        packet.append(uatype_UInt32.pack(self.MaxNotificationsPerPublish))
11005 1
        packet.append(uatype_Boolean.pack(self.PublishingEnabled))
11006 1
        packet.append(uatype_Byte.pack(self.Priority))
11007
        return b''.join(packet)
11008 1
11009
    @staticmethod
11010 1
    def from_binary(data):
11011
        return CreateSubscriptionParameters(data)
11012 1
11013 1
    def _binary_init(self, data):
11014 1
        self.RequestedPublishingInterval = uatype_Double.unpack(data.read(8))[0]
11015 1
        self.RequestedLifetimeCount = uatype_UInt32.unpack(data.read(4))[0]
11016 1
        self.RequestedMaxKeepAliveCount = uatype_UInt32.unpack(data.read(4))[0]
11017 1
        self.MaxNotificationsPerPublish = uatype_UInt32.unpack(data.read(4))[0]
11018 1
        self.PublishingEnabled = uatype_Boolean.unpack(data.read(1))[0]
11019
        self.Priority = uatype_Byte.unpack(data.read(1))[0]
11020 1
11021
    def __str__(self):
11022
        return 'CreateSubscriptionParameters(' + 'RequestedPublishingInterval:' + str(self.RequestedPublishingInterval) + ', ' + \
11023
               'RequestedLifetimeCount:' + str(self.RequestedLifetimeCount) + ', ' + \
11024
               'RequestedMaxKeepAliveCount:' + str(self.RequestedMaxKeepAliveCount) + ', ' + \
11025
               'MaxNotificationsPerPublish:' + str(self.MaxNotificationsPerPublish) + ', ' + \
11026
               'PublishingEnabled:' + str(self.PublishingEnabled) + ', ' + \
11027
               'Priority:' + str(self.Priority) + ')'
11028 1
11029
    __repr__ = __str__
11030
11031 1
11032
class CreateSubscriptionRequest(FrozenClass):
11033
    '''
11034
    :ivar TypeId:
11035
    :vartype TypeId: NodeId
11036
    :ivar RequestHeader:
11037
    :vartype RequestHeader: RequestHeader
11038
    :ivar Parameters:
11039
    :vartype Parameters: CreateSubscriptionParameters
11040 1
    '''
11041 1
    def __init__(self, binary=None):
11042
        if binary is not None:
11043
            self._binary_init(binary)
11044
            self._freeze = True
11045 1
            return
11046 1
        self.TypeId = FourByteNodeId(ObjectIds.CreateSubscriptionRequest_Encoding_DefaultBinary)
11047 1
        self.RequestHeader = RequestHeader()
11048 1
        self.Parameters = CreateSubscriptionParameters()
11049
        self._freeze = True
11050 1
11051 1
    def to_binary(self):
11052 1
        packet = []
11053 1
        packet.append(self.TypeId.to_binary())
11054 1
        packet.append(self.RequestHeader.to_binary())
11055 1
        packet.append(self.Parameters.to_binary())
11056
        return b''.join(packet)
11057 1
11058
    @staticmethod
11059
    def from_binary(data):
11060
        return CreateSubscriptionRequest(data)
11061 1
11062
    def _binary_init(self, data):
11063
        self.TypeId = NodeId.from_binary(data)
11064
        self.RequestHeader = RequestHeader.from_binary(data)
11065
        self.Parameters = CreateSubscriptionParameters.from_binary(data)
11066 1
11067
    def __str__(self):
11068
        return 'CreateSubscriptionRequest(' + 'TypeId:' + str(self.TypeId) + ', ' + \
11069
               'RequestHeader:' + str(self.RequestHeader) + ', ' + \
11070
               'Parameters:' + str(self.Parameters) + ')'
11071 1
11072
    __repr__ = __str__
11073
11074 1
11075
class CreateSubscriptionResult(FrozenClass):
11076
    '''
11077
    :ivar SubscriptionId:
11078
    :vartype SubscriptionId: UInt32
11079
    :ivar RevisedPublishingInterval:
11080
    :vartype RevisedPublishingInterval: Double
11081
    :ivar RevisedLifetimeCount:
11082
    :vartype RevisedLifetimeCount: UInt32
11083
    :ivar RevisedMaxKeepAliveCount:
11084
    :vartype RevisedMaxKeepAliveCount: UInt32
11085 1
    '''
11086 1
    def __init__(self, binary=None):
11087 1
        if binary is not None:
11088 1
            self._binary_init(binary)
11089 1
            self._freeze = True
11090 1
            return
11091 1
        self.SubscriptionId = 0
11092 1
        self.RevisedPublishingInterval = 0
11093 1
        self.RevisedLifetimeCount = 0
11094 1
        self.RevisedMaxKeepAliveCount = 0
11095
        self._freeze = True
11096 1
11097 1
    def to_binary(self):
11098 1
        packet = []
11099 1
        packet.append(uatype_UInt32.pack(self.SubscriptionId))
11100 1
        packet.append(uatype_Double.pack(self.RevisedPublishingInterval))
11101 1
        packet.append(uatype_UInt32.pack(self.RevisedLifetimeCount))
11102 1
        packet.append(uatype_UInt32.pack(self.RevisedMaxKeepAliveCount))
11103
        return b''.join(packet)
11104 1
11105
    @staticmethod
11106 1
    def from_binary(data):
11107
        return CreateSubscriptionResult(data)
11108 1
11109 1
    def _binary_init(self, data):
11110 1
        self.SubscriptionId = uatype_UInt32.unpack(data.read(4))[0]
11111 1
        self.RevisedPublishingInterval = uatype_Double.unpack(data.read(8))[0]
11112 1
        self.RevisedLifetimeCount = uatype_UInt32.unpack(data.read(4))[0]
11113
        self.RevisedMaxKeepAliveCount = uatype_UInt32.unpack(data.read(4))[0]
11114 1
11115
    def __str__(self):
11116
        return 'CreateSubscriptionResult(' + 'SubscriptionId:' + str(self.SubscriptionId) + ', ' + \
11117
               'RevisedPublishingInterval:' + str(self.RevisedPublishingInterval) + ', ' + \
11118
               'RevisedLifetimeCount:' + str(self.RevisedLifetimeCount) + ', ' + \
11119
               'RevisedMaxKeepAliveCount:' + str(self.RevisedMaxKeepAliveCount) + ')'
11120 1
11121
    __repr__ = __str__
11122
11123 1
11124
class CreateSubscriptionResponse(FrozenClass):
11125
    '''
11126
    :ivar TypeId:
11127
    :vartype TypeId: NodeId
11128
    :ivar ResponseHeader:
11129
    :vartype ResponseHeader: ResponseHeader
11130
    :ivar Parameters:
11131
    :vartype Parameters: CreateSubscriptionResult
11132 1
    '''
11133 1
    def __init__(self, binary=None):
11134 1
        if binary is not None:
11135 1
            self._binary_init(binary)
11136 1
            self._freeze = True
11137 1
            return
11138 1
        self.TypeId = FourByteNodeId(ObjectIds.CreateSubscriptionResponse_Encoding_DefaultBinary)
11139 1
        self.ResponseHeader = ResponseHeader()
11140 1
        self.Parameters = CreateSubscriptionResult()
11141
        self._freeze = True
11142 1
11143 1
    def to_binary(self):
11144 1
        packet = []
11145 1
        packet.append(self.TypeId.to_binary())
11146 1
        packet.append(self.ResponseHeader.to_binary())
11147 1
        packet.append(self.Parameters.to_binary())
11148
        return b''.join(packet)
11149 1
11150
    @staticmethod
11151 1
    def from_binary(data):
11152
        return CreateSubscriptionResponse(data)
11153 1
11154 1
    def _binary_init(self, data):
11155 1
        self.TypeId = NodeId.from_binary(data)
11156 1
        self.ResponseHeader = ResponseHeader.from_binary(data)
11157
        self.Parameters = CreateSubscriptionResult.from_binary(data)
11158 1
11159
    def __str__(self):
11160
        return 'CreateSubscriptionResponse(' + 'TypeId:' + str(self.TypeId) + ', ' + \
11161
               'ResponseHeader:' + str(self.ResponseHeader) + ', ' + \
11162
               'Parameters:' + str(self.Parameters) + ')'
11163 1
11164
    __repr__ = __str__
11165
11166 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
11167
class ModifySubscriptionParameters(FrozenClass):
11168
    '''
11169
    :ivar SubscriptionId:
11170
    :vartype SubscriptionId: UInt32
11171
    :ivar RequestedPublishingInterval:
11172
    :vartype RequestedPublishingInterval: Double
11173
    :ivar RequestedLifetimeCount:
11174
    :vartype RequestedLifetimeCount: UInt32
11175
    :ivar RequestedMaxKeepAliveCount:
11176
    :vartype RequestedMaxKeepAliveCount: UInt32
11177
    :ivar MaxNotificationsPerPublish:
11178
    :vartype MaxNotificationsPerPublish: UInt32
11179
    :ivar Priority:
11180
    :vartype Priority: Byte
11181 1
    '''
11182
    def __init__(self, binary=None):
11183
        if binary is not None:
11184
            self._binary_init(binary)
11185
            self._freeze = True
11186
            return
11187
        self.SubscriptionId = 0
11188
        self.RequestedPublishingInterval = 0
11189
        self.RequestedLifetimeCount = 0
11190
        self.RequestedMaxKeepAliveCount = 0
11191
        self.MaxNotificationsPerPublish = 0
11192
        self.Priority = 0
11193
        self._freeze = True
11194 1
11195
    def to_binary(self):
11196
        packet = []
11197
        packet.append(uatype_UInt32.pack(self.SubscriptionId))
11198
        packet.append(uatype_Double.pack(self.RequestedPublishingInterval))
11199
        packet.append(uatype_UInt32.pack(self.RequestedLifetimeCount))
11200
        packet.append(uatype_UInt32.pack(self.RequestedMaxKeepAliveCount))
11201
        packet.append(uatype_UInt32.pack(self.MaxNotificationsPerPublish))
11202
        packet.append(uatype_Byte.pack(self.Priority))
11203
        return b''.join(packet)
11204 1
11205
    @staticmethod
11206
    def from_binary(data):
11207
        return ModifySubscriptionParameters(data)
11208 1
11209
    def _binary_init(self, data):
11210
        self.SubscriptionId = uatype_UInt32.unpack(data.read(4))[0]
11211
        self.RequestedPublishingInterval = uatype_Double.unpack(data.read(8))[0]
11212
        self.RequestedLifetimeCount = uatype_UInt32.unpack(data.read(4))[0]
11213
        self.RequestedMaxKeepAliveCount = uatype_UInt32.unpack(data.read(4))[0]
11214
        self.MaxNotificationsPerPublish = uatype_UInt32.unpack(data.read(4))[0]
11215
        self.Priority = uatype_Byte.unpack(data.read(1))[0]
11216 1
11217
    def __str__(self):
11218
        return 'ModifySubscriptionParameters(' + 'SubscriptionId:' + str(self.SubscriptionId) + ', ' + \
11219
               'RequestedPublishingInterval:' + str(self.RequestedPublishingInterval) + ', ' + \
11220
               'RequestedLifetimeCount:' + str(self.RequestedLifetimeCount) + ', ' + \
11221
               'RequestedMaxKeepAliveCount:' + str(self.RequestedMaxKeepAliveCount) + ', ' + \
11222
               'MaxNotificationsPerPublish:' + str(self.MaxNotificationsPerPublish) + ', ' + \
11223
               'Priority:' + str(self.Priority) + ')'
11224 1
11225
    __repr__ = __str__
11226
11227 1
11228
class ModifySubscriptionRequest(FrozenClass):
11229
    '''
11230
    :ivar TypeId:
11231
    :vartype TypeId: NodeId
11232
    :ivar RequestHeader:
11233
    :vartype RequestHeader: RequestHeader
11234
    :ivar Parameters:
11235
    :vartype Parameters: ModifySubscriptionParameters
11236 1
    '''
11237
    def __init__(self, binary=None):
11238
        if binary is not None:
11239
            self._binary_init(binary)
11240
            self._freeze = True
11241
            return
11242
        self.TypeId = FourByteNodeId(ObjectIds.ModifySubscriptionRequest_Encoding_DefaultBinary)
11243
        self.RequestHeader = RequestHeader()
11244
        self.Parameters = ModifySubscriptionParameters()
11245
        self._freeze = True
11246 1
11247
    def to_binary(self):
11248
        packet = []
11249
        packet.append(self.TypeId.to_binary())
11250
        packet.append(self.RequestHeader.to_binary())
11251
        packet.append(self.Parameters.to_binary())
11252
        return b''.join(packet)
11253 1
11254
    @staticmethod
11255
    def from_binary(data):
11256
        return ModifySubscriptionRequest(data)
11257 1
11258
    def _binary_init(self, data):
11259
        self.TypeId = NodeId.from_binary(data)
11260
        self.RequestHeader = RequestHeader.from_binary(data)
11261
        self.Parameters = ModifySubscriptionParameters.from_binary(data)
11262 1
11263
    def __str__(self):
11264
        return 'ModifySubscriptionRequest(' + 'TypeId:' + str(self.TypeId) + ', ' + \
11265
               'RequestHeader:' + str(self.RequestHeader) + ', ' + \
11266
               'Parameters:' + str(self.Parameters) + ')'
11267 1
11268
    __repr__ = __str__
11269
11270 1
11271
class ModifySubscriptionResult(FrozenClass):
11272
    '''
11273
    :ivar RevisedPublishingInterval:
11274
    :vartype RevisedPublishingInterval: Double
11275
    :ivar RevisedLifetimeCount:
11276
    :vartype RevisedLifetimeCount: UInt32
11277
    :ivar RevisedMaxKeepAliveCount:
11278
    :vartype RevisedMaxKeepAliveCount: UInt32
11279 1
    '''
11280
    def __init__(self, binary=None):
11281
        if binary is not None:
11282
            self._binary_init(binary)
11283
            self._freeze = True
11284
            return
11285
        self.RevisedPublishingInterval = 0
11286
        self.RevisedLifetimeCount = 0
11287
        self.RevisedMaxKeepAliveCount = 0
11288
        self._freeze = True
11289 1
11290
    def to_binary(self):
11291
        packet = []
11292
        packet.append(uatype_Double.pack(self.RevisedPublishingInterval))
11293
        packet.append(uatype_UInt32.pack(self.RevisedLifetimeCount))
11294
        packet.append(uatype_UInt32.pack(self.RevisedMaxKeepAliveCount))
11295
        return b''.join(packet)
11296 1
11297
    @staticmethod
11298
    def from_binary(data):
11299
        return ModifySubscriptionResult(data)
11300 1
11301
    def _binary_init(self, data):
11302
        self.RevisedPublishingInterval = uatype_Double.unpack(data.read(8))[0]
11303
        self.RevisedLifetimeCount = uatype_UInt32.unpack(data.read(4))[0]
11304
        self.RevisedMaxKeepAliveCount = uatype_UInt32.unpack(data.read(4))[0]
11305 1
11306
    def __str__(self):
11307
        return 'ModifySubscriptionResult(' + 'RevisedPublishingInterval:' + str(self.RevisedPublishingInterval) + ', ' + \
11308
               'RevisedLifetimeCount:' + str(self.RevisedLifetimeCount) + ', ' + \
11309
               'RevisedMaxKeepAliveCount:' + str(self.RevisedMaxKeepAliveCount) + ')'
11310 1
11311
    __repr__ = __str__
11312
11313 1
11314
class ModifySubscriptionResponse(FrozenClass):
11315
    '''
11316
    :ivar TypeId:
11317
    :vartype TypeId: NodeId
11318
    :ivar ResponseHeader:
11319
    :vartype ResponseHeader: ResponseHeader
11320
    :ivar Parameters:
11321
    :vartype Parameters: ModifySubscriptionResult
11322 1
    '''
11323
    def __init__(self, binary=None):
11324
        if binary is not None:
11325
            self._binary_init(binary)
11326
            self._freeze = True
11327
            return
11328
        self.TypeId = FourByteNodeId(ObjectIds.ModifySubscriptionResponse_Encoding_DefaultBinary)
11329
        self.ResponseHeader = ResponseHeader()
11330
        self.Parameters = ModifySubscriptionResult()
11331
        self._freeze = True
11332 1
11333
    def to_binary(self):
11334
        packet = []
11335
        packet.append(self.TypeId.to_binary())
11336
        packet.append(self.ResponseHeader.to_binary())
11337
        packet.append(self.Parameters.to_binary())
11338
        return b''.join(packet)
11339 1
11340
    @staticmethod
11341
    def from_binary(data):
11342
        return ModifySubscriptionResponse(data)
11343 1
11344
    def _binary_init(self, data):
11345
        self.TypeId = NodeId.from_binary(data)
11346
        self.ResponseHeader = ResponseHeader.from_binary(data)
11347
        self.Parameters = ModifySubscriptionResult.from_binary(data)
11348 1
11349
    def __str__(self):
11350
        return 'ModifySubscriptionResponse(' + 'TypeId:' + str(self.TypeId) + ', ' + \
11351
               'ResponseHeader:' + str(self.ResponseHeader) + ', ' + \
11352
               'Parameters:' + str(self.Parameters) + ')'
11353 1
11354
    __repr__ = __str__
11355
11356 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
11357
class SetPublishingModeParameters(FrozenClass):
11358
    '''
11359
    :ivar PublishingEnabled:
11360
    :vartype PublishingEnabled: Boolean
11361
    :ivar SubscriptionIds:
11362
    :vartype SubscriptionIds: UInt32
11363 1
    '''
11364
    def __init__(self, binary=None):
11365
        if binary is not None:
11366
            self._binary_init(binary)
11367
            self._freeze = True
11368
            return
11369
        self.PublishingEnabled = True
11370
        self.SubscriptionIds = []
11371
        self._freeze = True
11372 1
11373
    def to_binary(self):
11374
        packet = []
11375
        packet.append(uatype_Boolean.pack(self.PublishingEnabled))
11376
        packet.append(uatype_Int32.pack(len(self.SubscriptionIds)))
11377
        for fieldname in self.SubscriptionIds:
11378
            packet.append(uatype_UInt32.pack(fieldname))
11379
        return b''.join(packet)
11380 1
11381
    @staticmethod
11382
    def from_binary(data):
11383
        return SetPublishingModeParameters(data)
11384 1
11385
    def _binary_init(self, data):
11386
        self.PublishingEnabled = uatype_Boolean.unpack(data.read(1))[0]
11387
        self.SubscriptionIds = unpack_uatype_array('UInt32', data)
11388 1
11389
    def __str__(self):
11390
        return 'SetPublishingModeParameters(' + 'PublishingEnabled:' + str(self.PublishingEnabled) + ', ' + \
11391
               'SubscriptionIds:' + str(self.SubscriptionIds) + ')'
11392 1
11393
    __repr__ = __str__
11394
11395 1
11396
class SetPublishingModeRequest(FrozenClass):
11397
    '''
11398
    :ivar TypeId:
11399
    :vartype TypeId: NodeId
11400
    :ivar RequestHeader:
11401
    :vartype RequestHeader: RequestHeader
11402
    :ivar Parameters:
11403
    :vartype Parameters: SetPublishingModeParameters
11404 1
    '''
11405
    def __init__(self, binary=None):
11406
        if binary is not None:
11407
            self._binary_init(binary)
11408
            self._freeze = True
11409
            return
11410
        self.TypeId = FourByteNodeId(ObjectIds.SetPublishingModeRequest_Encoding_DefaultBinary)
11411
        self.RequestHeader = RequestHeader()
11412
        self.Parameters = SetPublishingModeParameters()
11413
        self._freeze = True
11414 1
11415
    def to_binary(self):
11416
        packet = []
11417
        packet.append(self.TypeId.to_binary())
11418
        packet.append(self.RequestHeader.to_binary())
11419
        packet.append(self.Parameters.to_binary())
11420
        return b''.join(packet)
11421 1
11422
    @staticmethod
11423
    def from_binary(data):
11424
        return SetPublishingModeRequest(data)
11425 1
11426
    def _binary_init(self, data):
11427
        self.TypeId = NodeId.from_binary(data)
11428
        self.RequestHeader = RequestHeader.from_binary(data)
11429
        self.Parameters = SetPublishingModeParameters.from_binary(data)
11430 1
11431
    def __str__(self):
11432
        return 'SetPublishingModeRequest(' + 'TypeId:' + str(self.TypeId) + ', ' + \
11433
               'RequestHeader:' + str(self.RequestHeader) + ', ' + \
11434
               'Parameters:' + str(self.Parameters) + ')'
11435 1
11436
    __repr__ = __str__
11437
11438 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
11439
class SetPublishingModeResult(FrozenClass):
11440
    '''
11441
    :ivar Results:
11442
    :vartype Results: StatusCode
11443
    :ivar DiagnosticInfos:
11444
    :vartype DiagnosticInfos: DiagnosticInfo
11445 1
    '''
11446
    def __init__(self, binary=None):
11447
        if binary is not None:
11448
            self._binary_init(binary)
11449
            self._freeze = True
11450
            return
11451
        self.Results = []
11452
        self.DiagnosticInfos = []
11453
        self._freeze = True
11454 1
11455
    def to_binary(self):
11456
        packet = []
11457
        packet.append(uatype_Int32.pack(len(self.Results)))
11458
        for fieldname in self.Results:
11459
            packet.append(fieldname.to_binary())
11460
        packet.append(uatype_Int32.pack(len(self.DiagnosticInfos)))
11461
        for fieldname in self.DiagnosticInfos:
11462
            packet.append(fieldname.to_binary())
11463
        return b''.join(packet)
11464 1
11465
    @staticmethod
11466
    def from_binary(data):
11467
        return SetPublishingModeResult(data)
11468 1
11469
    def _binary_init(self, data):
11470
        length = uatype_Int32.unpack(data.read(4))[0]
11471
        array = []
11472
        if length != -1:
11473
            for _ in range(0, length):
11474
                array.append(StatusCode.from_binary(data))
11475
        self.Results = array
11476
        length = uatype_Int32.unpack(data.read(4))[0]
11477
        array = []
11478
        if length != -1:
11479
            for _ in range(0, length):
11480
                array.append(DiagnosticInfo.from_binary(data))
11481
        self.DiagnosticInfos = array
11482 1
11483
    def __str__(self):
11484
        return 'SetPublishingModeResult(' + 'Results:' + str(self.Results) + ', ' + \
11485
               'DiagnosticInfos:' + str(self.DiagnosticInfos) + ')'
11486 1
11487
    __repr__ = __str__
11488
11489 1
11490
class SetPublishingModeResponse(FrozenClass):
11491
    '''
11492
    :ivar TypeId:
11493
    :vartype TypeId: NodeId
11494
    :ivar ResponseHeader:
11495
    :vartype ResponseHeader: ResponseHeader
11496
    :ivar Parameters:
11497
    :vartype Parameters: SetPublishingModeResult
11498 1
    '''
11499
    def __init__(self, binary=None):
11500
        if binary is not None:
11501
            self._binary_init(binary)
11502
            self._freeze = True
11503
            return
11504
        self.TypeId = FourByteNodeId(ObjectIds.SetPublishingModeResponse_Encoding_DefaultBinary)
11505
        self.ResponseHeader = ResponseHeader()
11506
        self.Parameters = SetPublishingModeResult()
11507
        self._freeze = True
11508 1
11509
    def to_binary(self):
11510
        packet = []
11511
        packet.append(self.TypeId.to_binary())
11512
        packet.append(self.ResponseHeader.to_binary())
11513
        packet.append(self.Parameters.to_binary())
11514
        return b''.join(packet)
11515 1
11516
    @staticmethod
11517
    def from_binary(data):
11518
        return SetPublishingModeResponse(data)
11519 1
11520
    def _binary_init(self, data):
11521
        self.TypeId = NodeId.from_binary(data)
11522
        self.ResponseHeader = ResponseHeader.from_binary(data)
11523
        self.Parameters = SetPublishingModeResult.from_binary(data)
11524 1
11525
    def __str__(self):
11526
        return 'SetPublishingModeResponse(' + 'TypeId:' + str(self.TypeId) + ', ' + \
11527
               'ResponseHeader:' + str(self.ResponseHeader) + ', ' + \
11528
               'Parameters:' + str(self.Parameters) + ')'
11529 1
11530
    __repr__ = __str__
11531
11532 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
11533
class NotificationMessage(FrozenClass):
11534
    '''
11535
    :ivar SequenceNumber:
11536
    :vartype SequenceNumber: UInt32
11537
    :ivar PublishTime:
11538
    :vartype PublishTime: DateTime
11539
    :ivar NotificationData:
11540
    :vartype NotificationData: ExtensionObject
11541 1
    '''
11542 1
    def __init__(self, binary=None):
11543 1
        if binary is not None:
11544 1
            self._binary_init(binary)
11545 1
            self._freeze = True
11546 1
            return
11547 1
        self.SequenceNumber = 0
11548 1
        self.PublishTime = datetime.now()
11549 1
        self.NotificationData = []
11550
        self._freeze = True
11551 1
11552 1
    def to_binary(self):
11553 1
        packet = []
11554 1
        packet.append(uatype_UInt32.pack(self.SequenceNumber))
11555 1
        packet.append(pack_datetime(self.PublishTime))
11556 1
        packet.append(uatype_Int32.pack(len(self.NotificationData)))
11557 1
        for fieldname in self.NotificationData:
11558 1
            packet.append(extensionobject_to_binary(fieldname))
11559
        return b''.join(packet)
11560 1
11561
    @staticmethod
11562 1
    def from_binary(data):
11563
        return NotificationMessage(data)
11564 1
11565 1
    def _binary_init(self, data):
11566 1
        self.SequenceNumber = uatype_UInt32.unpack(data.read(4))[0]
11567 1
        self.PublishTime = unpack_datetime(data)
11568 1
        length = uatype_Int32.unpack(data.read(4))[0]
11569 1
        array = []
11570 1
        if length != -1:
11571 1
            for _ in range(0, length):
11572 1
                array.append(extensionobject_from_binary(data))
11573
        self.NotificationData = array
11574 1
11575
    def __str__(self):
11576
        return 'NotificationMessage(' + 'SequenceNumber:' + str(self.SequenceNumber) + ', ' + \
11577
               'PublishTime:' + str(self.PublishTime) + ', ' + \
11578
               'NotificationData:' + str(self.NotificationData) + ')'
11579 1
11580
    __repr__ = __str__
11581
11582 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
11583
class NotificationData(FrozenClass):
11584
    '''
11585 1
    '''
11586
    def __init__(self, binary=None):
11587
        if binary is not None:
11588
            self._binary_init(binary)
11589
            self._freeze = True
11590
            return
11591
        self._freeze = True
11592 1
11593
    def to_binary(self):
11594
        packet = []
11595
        return b''.join(packet)
11596 1
11597
    @staticmethod
11598
    def from_binary(data):
11599
        return NotificationData(data)
11600 1
11601
    def _binary_init(self, data):
11602
        pass
11603 1
11604
    def __str__(self):
11605
        return 'NotificationData(' +  + ')'
11606 1
11607
    __repr__ = __str__
11608
11609 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
11610
class DataChangeNotification(FrozenClass):
11611
    '''
11612
    :ivar MonitoredItems:
11613
    :vartype MonitoredItems: MonitoredItemNotification
11614
    :ivar DiagnosticInfos:
11615
    :vartype DiagnosticInfos: DiagnosticInfo
11616 1
    '''
11617 1
    def __init__(self, binary=None):
11618 1
        if binary is not None:
11619 1
            self._binary_init(binary)
11620 1
            self._freeze = True
11621 1
            return
11622 1
        self.MonitoredItems = []
11623 1
        self.DiagnosticInfos = []
11624
        self._freeze = True
11625 1
11626 1
    def to_binary(self):
11627 1
        packet = []
11628 1
        packet.append(uatype_Int32.pack(len(self.MonitoredItems)))
11629 1
        for fieldname in self.MonitoredItems:
11630 1
            packet.append(fieldname.to_binary())
11631 1
        packet.append(uatype_Int32.pack(len(self.DiagnosticInfos)))
11632
        for fieldname in self.DiagnosticInfos:
11633 1
            packet.append(fieldname.to_binary())
11634
        return b''.join(packet)
11635 1
11636
    @staticmethod
11637 1
    def from_binary(data):
11638
        return DataChangeNotification(data)
11639 1
11640 1
    def _binary_init(self, data):
11641 1
        length = uatype_Int32.unpack(data.read(4))[0]
11642 1
        array = []
11643 1
        if length != -1:
11644 1
            for _ in range(0, length):
11645 1
                array.append(MonitoredItemNotification.from_binary(data))
11646 1
        self.MonitoredItems = array
11647 1
        length = uatype_Int32.unpack(data.read(4))[0]
11648 1
        array = []
11649 1
        if length != -1:
11650
            for _ in range(0, length):
11651 1
                array.append(DiagnosticInfo.from_binary(data))
11652
        self.DiagnosticInfos = array
11653 1
11654
    def __str__(self):
11655
        return 'DataChangeNotification(' + 'MonitoredItems:' + str(self.MonitoredItems) + ', ' + \
11656
               'DiagnosticInfos:' + str(self.DiagnosticInfos) + ')'
11657 1
11658
    __repr__ = __str__
11659
11660 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
11661
class MonitoredItemNotification(FrozenClass):
11662
    '''
11663
    :ivar ClientHandle:
11664
    :vartype ClientHandle: UInt32
11665
    :ivar Value:
11666
    :vartype Value: DataValue
11667 1
    '''
11668 1
    def __init__(self, binary=None):
11669 1
        if binary is not None:
11670 1
            self._binary_init(binary)
11671 1
            self._freeze = True
11672 1
            return
11673 1
        self.ClientHandle = 0
11674 1
        self.Value = DataValue()
11675
        self._freeze = True
11676 1
11677 1
    def to_binary(self):
11678 1
        packet = []
11679 1
        packet.append(uatype_UInt32.pack(self.ClientHandle))
11680 1
        packet.append(self.Value.to_binary())
11681
        return b''.join(packet)
11682 1
11683
    @staticmethod
11684 1
    def from_binary(data):
11685
        return MonitoredItemNotification(data)
11686 1
11687 1
    def _binary_init(self, data):
11688 1
        self.ClientHandle = uatype_UInt32.unpack(data.read(4))[0]
11689
        self.Value = DataValue.from_binary(data)
11690 1
11691
    def __str__(self):
11692
        return 'MonitoredItemNotification(' + 'ClientHandle:' + str(self.ClientHandle) + ', ' + \
11693
               'Value:' + str(self.Value) + ')'
11694 1
11695
    __repr__ = __str__
11696
11697 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
11698
class EventNotificationList(FrozenClass):
11699
    '''
11700
    :ivar Events:
11701
    :vartype Events: EventFieldList
11702 1
    '''
11703 1
    def __init__(self, binary=None):
11704 1
        if binary is not None:
11705 1
            self._binary_init(binary)
11706 1
            self._freeze = True
11707 1
            return
11708 1
        self.Events = []
11709
        self._freeze = True
11710 1
11711 1
    def to_binary(self):
11712 1
        packet = []
11713 1
        packet.append(uatype_Int32.pack(len(self.Events)))
11714 1
        for fieldname in self.Events:
11715 1
            packet.append(fieldname.to_binary())
11716
        return b''.join(packet)
11717 1
11718
    @staticmethod
11719 1
    def from_binary(data):
11720
        return EventNotificationList(data)
11721 1
11722 1
    def _binary_init(self, data):
11723 1
        length = uatype_Int32.unpack(data.read(4))[0]
11724 1
        array = []
11725 1
        if length != -1:
11726 1
            for _ in range(0, length):
11727 1
                array.append(EventFieldList.from_binary(data))
11728
        self.Events = array
11729 1
11730
    def __str__(self):
11731
        return 'EventNotificationList(' + 'Events:' + str(self.Events) + ')'
11732 1
11733
    __repr__ = __str__
11734
11735 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
11736
class EventFieldList(FrozenClass):
11737
    '''
11738
    :ivar ClientHandle:
11739
    :vartype ClientHandle: UInt32
11740
    :ivar EventFields:
11741
    :vartype EventFields: Variant
11742 1
    '''
11743 1
    def __init__(self, binary=None):
11744 1
        if binary is not None:
11745 1
            self._binary_init(binary)
11746 1
            self._freeze = True
11747 1
            return
11748 1
        self.ClientHandle = 0
11749 1
        self.EventFields = []
11750
        self._freeze = True
11751 1
11752 1
    def to_binary(self):
11753 1
        packet = []
11754 1
        packet.append(uatype_UInt32.pack(self.ClientHandle))
11755 1
        packet.append(uatype_Int32.pack(len(self.EventFields)))
11756 1
        for fieldname in self.EventFields:
11757 1
            packet.append(fieldname.to_binary())
11758
        return b''.join(packet)
11759 1
11760
    @staticmethod
11761 1
    def from_binary(data):
11762
        return EventFieldList(data)
11763 1
11764 1
    def _binary_init(self, data):
11765 1
        self.ClientHandle = uatype_UInt32.unpack(data.read(4))[0]
11766 1
        length = uatype_Int32.unpack(data.read(4))[0]
11767 1
        array = []
11768 1
        if length != -1:
11769 1
            for _ in range(0, length):
11770 1
                array.append(Variant.from_binary(data))
11771
        self.EventFields = array
11772 1
11773
    def __str__(self):
11774
        return 'EventFieldList(' + 'ClientHandle:' + str(self.ClientHandle) + ', ' + \
11775
               'EventFields:' + str(self.EventFields) + ')'
11776 1
11777
    __repr__ = __str__
11778
11779 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
11780
class HistoryEventFieldList(FrozenClass):
11781
    '''
11782
    :ivar EventFields:
11783
    :vartype EventFields: Variant
11784 1
    '''
11785 1
    def __init__(self, binary=None):
11786
        if binary is not None:
11787
            self._binary_init(binary)
11788
            self._freeze = True
11789 1
            return
11790 1
        self.EventFields = []
11791
        self._freeze = True
11792 1
11793
    def to_binary(self):
11794
        packet = []
11795
        packet.append(uatype_Int32.pack(len(self.EventFields)))
11796
        for fieldname in self.EventFields:
11797
            packet.append(fieldname.to_binary())
11798
        return b''.join(packet)
11799 1
11800
    @staticmethod
11801
    def from_binary(data):
11802
        return HistoryEventFieldList(data)
11803 1
11804
    def _binary_init(self, data):
11805
        length = uatype_Int32.unpack(data.read(4))[0]
11806
        array = []
11807
        if length != -1:
11808
            for _ in range(0, length):
11809
                array.append(Variant.from_binary(data))
11810
        self.EventFields = array
11811 1
11812
    def __str__(self):
11813
        return 'HistoryEventFieldList(' + 'EventFields:' + str(self.EventFields) + ')'
11814 1
11815
    __repr__ = __str__
11816
11817 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
11818
class StatusChangeNotification(FrozenClass):
11819
    '''
11820
    :ivar Status:
11821
    :vartype Status: StatusCode
11822
    :ivar DiagnosticInfo:
11823
    :vartype DiagnosticInfo: DiagnosticInfo
11824 1
    '''
11825
    def __init__(self, binary=None):
11826
        if binary is not None:
11827
            self._binary_init(binary)
11828
            self._freeze = True
11829
            return
11830
        self.Status = StatusCode()
11831
        self.DiagnosticInfo = DiagnosticInfo()
11832
        self._freeze = True
11833 1
11834
    def to_binary(self):
11835
        packet = []
11836
        packet.append(self.Status.to_binary())
11837
        packet.append(self.DiagnosticInfo.to_binary())
11838
        return b''.join(packet)
11839 1
11840
    @staticmethod
11841
    def from_binary(data):
11842
        return StatusChangeNotification(data)
11843 1
11844
    def _binary_init(self, data):
11845
        self.Status = StatusCode.from_binary(data)
11846
        self.DiagnosticInfo = DiagnosticInfo.from_binary(data)
11847 1
11848
    def __str__(self):
11849
        return 'StatusChangeNotification(' + 'Status:' + str(self.Status) + ', ' + \
11850
               'DiagnosticInfo:' + str(self.DiagnosticInfo) + ')'
11851 1
11852
    __repr__ = __str__
11853
11854 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
11855
class SubscriptionAcknowledgement(FrozenClass):
11856
    '''
11857
    :ivar SubscriptionId:
11858
    :vartype SubscriptionId: UInt32
11859
    :ivar SequenceNumber:
11860
    :vartype SequenceNumber: UInt32
11861 1
    '''
11862 1
    def __init__(self, binary=None):
11863 1
        if binary is not None:
11864 1
            self._binary_init(binary)
11865 1
            self._freeze = True
11866 1
            return
11867 1
        self.SubscriptionId = 0
11868 1
        self.SequenceNumber = 0
11869
        self._freeze = True
11870 1
11871 1
    def to_binary(self):
11872 1
        packet = []
11873 1
        packet.append(uatype_UInt32.pack(self.SubscriptionId))
11874 1
        packet.append(uatype_UInt32.pack(self.SequenceNumber))
11875
        return b''.join(packet)
11876 1
11877
    @staticmethod
11878 1
    def from_binary(data):
11879
        return SubscriptionAcknowledgement(data)
11880 1
11881 1
    def _binary_init(self, data):
11882 1
        self.SubscriptionId = uatype_UInt32.unpack(data.read(4))[0]
11883
        self.SequenceNumber = uatype_UInt32.unpack(data.read(4))[0]
11884 1
11885
    def __str__(self):
11886
        return 'SubscriptionAcknowledgement(' + 'SubscriptionId:' + str(self.SubscriptionId) + ', ' + \
11887
               'SequenceNumber:' + str(self.SequenceNumber) + ')'
11888 1
11889
    __repr__ = __str__
11890
11891 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
11892
class PublishParameters(FrozenClass):
11893
    '''
11894
    :ivar SubscriptionAcknowledgements:
11895
    :vartype SubscriptionAcknowledgements: SubscriptionAcknowledgement
11896 1
    '''
11897 1
    def __init__(self, binary=None):
11898 1
        if binary is not None:
11899 1
            self._binary_init(binary)
11900 1
            self._freeze = True
11901 1
            return
11902 1
        self.SubscriptionAcknowledgements = []
11903
        self._freeze = True
11904 1
11905 1
    def to_binary(self):
11906 1
        packet = []
11907 1
        packet.append(uatype_Int32.pack(len(self.SubscriptionAcknowledgements)))
11908 1
        for fieldname in self.SubscriptionAcknowledgements:
11909 1
            packet.append(fieldname.to_binary())
11910
        return b''.join(packet)
11911 1
11912
    @staticmethod
11913 1
    def from_binary(data):
11914
        return PublishParameters(data)
11915 1
11916 1
    def _binary_init(self, data):
11917 1
        length = uatype_Int32.unpack(data.read(4))[0]
11918 1
        array = []
11919 1
        if length != -1:
11920 1
            for _ in range(0, length):
11921 1
                array.append(SubscriptionAcknowledgement.from_binary(data))
11922
        self.SubscriptionAcknowledgements = array
11923 1
11924
    def __str__(self):
11925
        return 'PublishParameters(' + 'SubscriptionAcknowledgements:' + str(self.SubscriptionAcknowledgements) + ')'
11926 1
11927
    __repr__ = __str__
11928
11929 1
11930
class PublishRequest(FrozenClass):
11931
    '''
11932
    :ivar TypeId:
11933
    :vartype TypeId: NodeId
11934
    :ivar RequestHeader:
11935
    :vartype RequestHeader: RequestHeader
11936
    :ivar Parameters:
11937
    :vartype Parameters: PublishParameters
11938 1
    '''
11939 1
    def __init__(self, binary=None):
11940
        if binary is not None:
11941
            self._binary_init(binary)
11942
            self._freeze = True
11943 1
            return
11944 1
        self.TypeId = FourByteNodeId(ObjectIds.PublishRequest_Encoding_DefaultBinary)
11945 1
        self.RequestHeader = RequestHeader()
11946 1
        self.Parameters = PublishParameters()
11947
        self._freeze = True
11948 1
11949 1
    def to_binary(self):
11950 1
        packet = []
11951 1
        packet.append(self.TypeId.to_binary())
11952 1
        packet.append(self.RequestHeader.to_binary())
11953 1
        packet.append(self.Parameters.to_binary())
11954
        return b''.join(packet)
11955 1
11956
    @staticmethod
11957
    def from_binary(data):
11958
        return PublishRequest(data)
11959 1
11960
    def _binary_init(self, data):
11961
        self.TypeId = NodeId.from_binary(data)
11962
        self.RequestHeader = RequestHeader.from_binary(data)
11963
        self.Parameters = PublishParameters.from_binary(data)
11964 1
11965
    def __str__(self):
11966
        return 'PublishRequest(' + 'TypeId:' + str(self.TypeId) + ', ' + \
11967
               'RequestHeader:' + str(self.RequestHeader) + ', ' + \
11968
               'Parameters:' + str(self.Parameters) + ')'
11969 1
11970
    __repr__ = __str__
11971
11972 1
11973
class PublishResult(FrozenClass):
11974
    '''
11975
    :ivar SubscriptionId:
11976
    :vartype SubscriptionId: UInt32
11977
    :ivar AvailableSequenceNumbers:
11978
    :vartype AvailableSequenceNumbers: UInt32
11979
    :ivar MoreNotifications:
11980
    :vartype MoreNotifications: Boolean
11981
    :ivar NotificationMessage:
11982
    :vartype NotificationMessage: NotificationMessage
11983
    :ivar Results:
11984
    :vartype Results: StatusCode
11985
    :ivar DiagnosticInfos:
11986
    :vartype DiagnosticInfos: DiagnosticInfo
11987 1
    '''
11988 1
    def __init__(self, binary=None):
11989 1
        if binary is not None:
11990 1
            self._binary_init(binary)
11991 1
            self._freeze = True
11992 1
            return
11993 1
        self.SubscriptionId = 0
11994 1
        self.AvailableSequenceNumbers = []
11995 1
        self.MoreNotifications = True
11996 1
        self.NotificationMessage = NotificationMessage()
11997 1
        self.Results = []
11998 1
        self.DiagnosticInfos = []
11999
        self._freeze = True
12000 1
12001 1
    def to_binary(self):
12002 1
        packet = []
12003 1
        packet.append(uatype_UInt32.pack(self.SubscriptionId))
12004 1
        packet.append(uatype_Int32.pack(len(self.AvailableSequenceNumbers)))
12005 1
        for fieldname in self.AvailableSequenceNumbers:
12006 1
            packet.append(uatype_UInt32.pack(fieldname))
12007 1
        packet.append(uatype_Boolean.pack(self.MoreNotifications))
12008 1
        packet.append(self.NotificationMessage.to_binary())
12009 1
        packet.append(uatype_Int32.pack(len(self.Results)))
12010
        for fieldname in self.Results:
12011 1
            packet.append(fieldname.to_binary())
12012 1
        packet.append(uatype_Int32.pack(len(self.DiagnosticInfos)))
12013
        for fieldname in self.DiagnosticInfos:
12014 1
            packet.append(fieldname.to_binary())
12015
        return b''.join(packet)
12016 1
12017
    @staticmethod
12018 1
    def from_binary(data):
12019
        return PublishResult(data)
12020 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
12021 1
    def _binary_init(self, data):
12022 1
        self.SubscriptionId = uatype_UInt32.unpack(data.read(4))[0]
12023 1
        self.AvailableSequenceNumbers = unpack_uatype_array('UInt32', data)
12024 1
        self.MoreNotifications = uatype_Boolean.unpack(data.read(1))[0]
12025 1
        self.NotificationMessage = NotificationMessage.from_binary(data)
12026 1
        length = uatype_Int32.unpack(data.read(4))[0]
12027 1
        array = []
12028 1
        if length != -1:
12029
            for _ in range(0, length):
12030 1
                array.append(StatusCode.from_binary(data))
12031 1
        self.Results = array
12032 1
        length = uatype_Int32.unpack(data.read(4))[0]
12033 1
        array = []
12034 1
        if length != -1:
12035
            for _ in range(0, length):
12036 1
                array.append(DiagnosticInfo.from_binary(data))
12037
        self.DiagnosticInfos = array
12038 1
12039
    def __str__(self):
12040
        return 'PublishResult(' + 'SubscriptionId:' + str(self.SubscriptionId) + ', ' + \
12041
               'AvailableSequenceNumbers:' + str(self.AvailableSequenceNumbers) + ', ' + \
12042
               'MoreNotifications:' + str(self.MoreNotifications) + ', ' + \
12043
               'NotificationMessage:' + str(self.NotificationMessage) + ', ' + \
12044
               'Results:' + str(self.Results) + ', ' + \
12045
               'DiagnosticInfos:' + str(self.DiagnosticInfos) + ')'
12046 1
12047
    __repr__ = __str__
12048
12049 1
12050
class PublishResponse(FrozenClass):
12051
    '''
12052
    :ivar TypeId:
12053
    :vartype TypeId: NodeId
12054
    :ivar ResponseHeader:
12055
    :vartype ResponseHeader: ResponseHeader
12056
    :ivar Parameters:
12057
    :vartype Parameters: PublishResult
12058 1
    '''
12059 1
    def __init__(self, binary=None):
12060 1
        if binary is not None:
12061 1
            self._binary_init(binary)
12062 1
            self._freeze = True
12063 1
            return
12064 1
        self.TypeId = FourByteNodeId(ObjectIds.PublishResponse_Encoding_DefaultBinary)
12065 1
        self.ResponseHeader = ResponseHeader()
12066 1
        self.Parameters = PublishResult()
12067
        self._freeze = True
12068 1
12069 1
    def to_binary(self):
12070 1
        packet = []
12071 1
        packet.append(self.TypeId.to_binary())
12072 1
        packet.append(self.ResponseHeader.to_binary())
12073 1
        packet.append(self.Parameters.to_binary())
12074
        return b''.join(packet)
12075 1
12076
    @staticmethod
12077 1
    def from_binary(data):
12078
        return PublishResponse(data)
12079 1
12080 1
    def _binary_init(self, data):
12081 1
        self.TypeId = NodeId.from_binary(data)
12082 1
        self.ResponseHeader = ResponseHeader.from_binary(data)
12083
        self.Parameters = PublishResult.from_binary(data)
12084 1
12085
    def __str__(self):
12086
        return 'PublishResponse(' + 'TypeId:' + str(self.TypeId) + ', ' + \
12087
               'ResponseHeader:' + str(self.ResponseHeader) + ', ' + \
12088
               'Parameters:' + str(self.Parameters) + ')'
12089 1
12090
    __repr__ = __str__
12091
12092 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
12093
class RepublishParameters(FrozenClass):
12094
    '''
12095
    :ivar SubscriptionId:
12096
    :vartype SubscriptionId: UInt32
12097
    :ivar RetransmitSequenceNumber:
12098
    :vartype RetransmitSequenceNumber: UInt32
12099 1
    '''
12100
    def __init__(self, binary=None):
12101
        if binary is not None:
12102
            self._binary_init(binary)
12103
            self._freeze = True
12104
            return
12105
        self.SubscriptionId = 0
12106
        self.RetransmitSequenceNumber = 0
12107
        self._freeze = True
12108 1
12109
    def to_binary(self):
12110
        packet = []
12111
        packet.append(uatype_UInt32.pack(self.SubscriptionId))
12112
        packet.append(uatype_UInt32.pack(self.RetransmitSequenceNumber))
12113
        return b''.join(packet)
12114 1
12115
    @staticmethod
12116
    def from_binary(data):
12117
        return RepublishParameters(data)
12118 1
12119
    def _binary_init(self, data):
12120
        self.SubscriptionId = uatype_UInt32.unpack(data.read(4))[0]
12121
        self.RetransmitSequenceNumber = uatype_UInt32.unpack(data.read(4))[0]
12122 1
12123
    def __str__(self):
12124
        return 'RepublishParameters(' + 'SubscriptionId:' + str(self.SubscriptionId) + ', ' + \
12125
               'RetransmitSequenceNumber:' + str(self.RetransmitSequenceNumber) + ')'
12126 1
12127
    __repr__ = __str__
12128
12129 1
12130
class RepublishRequest(FrozenClass):
12131
    '''
12132
    :ivar TypeId:
12133
    :vartype TypeId: NodeId
12134
    :ivar RequestHeader:
12135
    :vartype RequestHeader: RequestHeader
12136
    :ivar Parameters:
12137
    :vartype Parameters: RepublishParameters
12138 1
    '''
12139
    def __init__(self, binary=None):
12140
        if binary is not None:
12141
            self._binary_init(binary)
12142
            self._freeze = True
12143
            return
12144
        self.TypeId = FourByteNodeId(ObjectIds.RepublishRequest_Encoding_DefaultBinary)
12145
        self.RequestHeader = RequestHeader()
12146
        self.Parameters = RepublishParameters()
12147
        self._freeze = True
12148 1
12149
    def to_binary(self):
12150
        packet = []
12151
        packet.append(self.TypeId.to_binary())
12152
        packet.append(self.RequestHeader.to_binary())
12153
        packet.append(self.Parameters.to_binary())
12154
        return b''.join(packet)
12155 1
12156
    @staticmethod
12157
    def from_binary(data):
12158
        return RepublishRequest(data)
12159 1
12160
    def _binary_init(self, data):
12161
        self.TypeId = NodeId.from_binary(data)
12162
        self.RequestHeader = RequestHeader.from_binary(data)
12163
        self.Parameters = RepublishParameters.from_binary(data)
12164 1
12165
    def __str__(self):
12166
        return 'RepublishRequest(' + 'TypeId:' + str(self.TypeId) + ', ' + \
12167
               'RequestHeader:' + str(self.RequestHeader) + ', ' + \
12168
               'Parameters:' + str(self.Parameters) + ')'
12169 1
12170
    __repr__ = __str__
12171
12172 1
12173
class RepublishResponse(FrozenClass):
12174
    '''
12175
    :ivar TypeId:
12176
    :vartype TypeId: NodeId
12177
    :ivar ResponseHeader:
12178
    :vartype ResponseHeader: ResponseHeader
12179
    :ivar NotificationMessage:
12180
    :vartype NotificationMessage: NotificationMessage
12181 1
    '''
12182
    def __init__(self, binary=None):
12183
        if binary is not None:
12184
            self._binary_init(binary)
12185
            self._freeze = True
12186
            return
12187
        self.TypeId = FourByteNodeId(ObjectIds.RepublishResponse_Encoding_DefaultBinary)
12188
        self.ResponseHeader = ResponseHeader()
12189
        self.NotificationMessage = NotificationMessage()
12190
        self._freeze = True
12191 1
12192
    def to_binary(self):
12193
        packet = []
12194
        packet.append(self.TypeId.to_binary())
12195
        packet.append(self.ResponseHeader.to_binary())
12196
        packet.append(self.NotificationMessage.to_binary())
12197
        return b''.join(packet)
12198 1
12199
    @staticmethod
12200
    def from_binary(data):
12201
        return RepublishResponse(data)
12202 1
12203
    def _binary_init(self, data):
12204
        self.TypeId = NodeId.from_binary(data)
12205
        self.ResponseHeader = ResponseHeader.from_binary(data)
12206
        self.NotificationMessage = NotificationMessage.from_binary(data)
12207 1
12208
    def __str__(self):
12209
        return 'RepublishResponse(' + 'TypeId:' + str(self.TypeId) + ', ' + \
12210
               'ResponseHeader:' + str(self.ResponseHeader) + ', ' + \
12211
               'NotificationMessage:' + str(self.NotificationMessage) + ')'
12212 1
12213
    __repr__ = __str__
12214
12215 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
12216
class TransferResult(FrozenClass):
12217
    '''
12218
    :ivar StatusCode:
12219
    :vartype StatusCode: StatusCode
12220
    :ivar AvailableSequenceNumbers:
12221
    :vartype AvailableSequenceNumbers: UInt32
12222 1
    '''
12223
    def __init__(self, binary=None):
12224
        if binary is not None:
12225
            self._binary_init(binary)
12226
            self._freeze = True
12227
            return
12228
        self.StatusCode = StatusCode()
12229
        self.AvailableSequenceNumbers = []
12230
        self._freeze = True
12231 1
12232
    def to_binary(self):
12233
        packet = []
12234
        packet.append(self.StatusCode.to_binary())
12235
        packet.append(uatype_Int32.pack(len(self.AvailableSequenceNumbers)))
12236
        for fieldname in self.AvailableSequenceNumbers:
12237
            packet.append(uatype_UInt32.pack(fieldname))
12238
        return b''.join(packet)
12239 1
12240
    @staticmethod
12241
    def from_binary(data):
12242
        return TransferResult(data)
12243 1
12244
    def _binary_init(self, data):
12245
        self.StatusCode = StatusCode.from_binary(data)
12246
        self.AvailableSequenceNumbers = unpack_uatype_array('UInt32', data)
12247 1
12248
    def __str__(self):
12249
        return 'TransferResult(' + 'StatusCode:' + str(self.StatusCode) + ', ' + \
12250
               'AvailableSequenceNumbers:' + str(self.AvailableSequenceNumbers) + ')'
12251 1
12252
    __repr__ = __str__
12253
12254 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
12255
class TransferSubscriptionsParameters(FrozenClass):
12256
    '''
12257
    :ivar SubscriptionIds:
12258
    :vartype SubscriptionIds: UInt32
12259
    :ivar SendInitialValues:
12260
    :vartype SendInitialValues: Boolean
12261 1
    '''
12262
    def __init__(self, binary=None):
12263
        if binary is not None:
12264
            self._binary_init(binary)
12265
            self._freeze = True
12266
            return
12267
        self.SubscriptionIds = []
12268
        self.SendInitialValues = True
12269
        self._freeze = True
12270 1
12271
    def to_binary(self):
12272
        packet = []
12273
        packet.append(uatype_Int32.pack(len(self.SubscriptionIds)))
12274
        for fieldname in self.SubscriptionIds:
12275
            packet.append(uatype_UInt32.pack(fieldname))
12276
        packet.append(uatype_Boolean.pack(self.SendInitialValues))
12277
        return b''.join(packet)
12278 1
12279
    @staticmethod
12280
    def from_binary(data):
12281
        return TransferSubscriptionsParameters(data)
12282 1
12283
    def _binary_init(self, data):
12284
        self.SubscriptionIds = unpack_uatype_array('UInt32', data)
12285
        self.SendInitialValues = uatype_Boolean.unpack(data.read(1))[0]
12286 1
12287
    def __str__(self):
12288
        return 'TransferSubscriptionsParameters(' + 'SubscriptionIds:' + str(self.SubscriptionIds) + ', ' + \
12289
               'SendInitialValues:' + str(self.SendInitialValues) + ')'
12290 1
12291
    __repr__ = __str__
12292
12293 1
12294
class TransferSubscriptionsRequest(FrozenClass):
12295
    '''
12296
    :ivar TypeId:
12297
    :vartype TypeId: NodeId
12298
    :ivar RequestHeader:
12299
    :vartype RequestHeader: RequestHeader
12300
    :ivar Parameters:
12301
    :vartype Parameters: TransferSubscriptionsParameters
12302 1
    '''
12303
    def __init__(self, binary=None):
12304
        if binary is not None:
12305
            self._binary_init(binary)
12306
            self._freeze = True
12307
            return
12308
        self.TypeId = FourByteNodeId(ObjectIds.TransferSubscriptionsRequest_Encoding_DefaultBinary)
12309
        self.RequestHeader = RequestHeader()
12310
        self.Parameters = TransferSubscriptionsParameters()
12311
        self._freeze = True
12312 1
12313
    def to_binary(self):
12314
        packet = []
12315
        packet.append(self.TypeId.to_binary())
12316
        packet.append(self.RequestHeader.to_binary())
12317
        packet.append(self.Parameters.to_binary())
12318
        return b''.join(packet)
12319 1
12320
    @staticmethod
12321
    def from_binary(data):
12322
        return TransferSubscriptionsRequest(data)
12323 1
12324
    def _binary_init(self, data):
12325
        self.TypeId = NodeId.from_binary(data)
12326
        self.RequestHeader = RequestHeader.from_binary(data)
12327
        self.Parameters = TransferSubscriptionsParameters.from_binary(data)
12328 1
12329
    def __str__(self):
12330
        return 'TransferSubscriptionsRequest(' + 'TypeId:' + str(self.TypeId) + ', ' + \
12331
               'RequestHeader:' + str(self.RequestHeader) + ', ' + \
12332
               'Parameters:' + str(self.Parameters) + ')'
12333 1
12334
    __repr__ = __str__
12335
12336 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
12337
class TransferSubscriptionsResult(FrozenClass):
12338
    '''
12339
    :ivar Results:
12340
    :vartype Results: TransferResult
12341
    :ivar DiagnosticInfos:
12342
    :vartype DiagnosticInfos: DiagnosticInfo
12343 1
    '''
12344
    def __init__(self, binary=None):
12345
        if binary is not None:
12346
            self._binary_init(binary)
12347
            self._freeze = True
12348
            return
12349
        self.Results = []
12350
        self.DiagnosticInfos = []
12351
        self._freeze = True
12352 1
12353
    def to_binary(self):
12354
        packet = []
12355
        packet.append(uatype_Int32.pack(len(self.Results)))
12356
        for fieldname in self.Results:
12357
            packet.append(fieldname.to_binary())
12358
        packet.append(uatype_Int32.pack(len(self.DiagnosticInfos)))
12359
        for fieldname in self.DiagnosticInfos:
12360
            packet.append(fieldname.to_binary())
12361
        return b''.join(packet)
12362 1
12363
    @staticmethod
12364
    def from_binary(data):
12365
        return TransferSubscriptionsResult(data)
12366 1
12367
    def _binary_init(self, data):
12368
        length = uatype_Int32.unpack(data.read(4))[0]
12369
        array = []
12370
        if length != -1:
12371
            for _ in range(0, length):
12372
                array.append(TransferResult.from_binary(data))
12373
        self.Results = array
12374
        length = uatype_Int32.unpack(data.read(4))[0]
12375
        array = []
12376
        if length != -1:
12377
            for _ in range(0, length):
12378
                array.append(DiagnosticInfo.from_binary(data))
12379
        self.DiagnosticInfos = array
12380 1
12381
    def __str__(self):
12382
        return 'TransferSubscriptionsResult(' + 'Results:' + str(self.Results) + ', ' + \
12383
               'DiagnosticInfos:' + str(self.DiagnosticInfos) + ')'
12384 1
12385
    __repr__ = __str__
12386
12387 1
12388
class TransferSubscriptionsResponse(FrozenClass):
12389
    '''
12390
    :ivar TypeId:
12391
    :vartype TypeId: NodeId
12392
    :ivar ResponseHeader:
12393
    :vartype ResponseHeader: ResponseHeader
12394
    :ivar Parameters:
12395
    :vartype Parameters: TransferSubscriptionsResult
12396 1
    '''
12397
    def __init__(self, binary=None):
12398
        if binary is not None:
12399
            self._binary_init(binary)
12400
            self._freeze = True
12401
            return
12402
        self.TypeId = FourByteNodeId(ObjectIds.TransferSubscriptionsResponse_Encoding_DefaultBinary)
12403
        self.ResponseHeader = ResponseHeader()
12404
        self.Parameters = TransferSubscriptionsResult()
12405
        self._freeze = True
12406 1
12407
    def to_binary(self):
12408
        packet = []
12409
        packet.append(self.TypeId.to_binary())
12410
        packet.append(self.ResponseHeader.to_binary())
12411
        packet.append(self.Parameters.to_binary())
12412
        return b''.join(packet)
12413 1
12414
    @staticmethod
12415
    def from_binary(data):
12416
        return TransferSubscriptionsResponse(data)
12417 1
12418
    def _binary_init(self, data):
12419
        self.TypeId = NodeId.from_binary(data)
12420
        self.ResponseHeader = ResponseHeader.from_binary(data)
12421
        self.Parameters = TransferSubscriptionsResult.from_binary(data)
12422 1
12423
    def __str__(self):
12424
        return 'TransferSubscriptionsResponse(' + 'TypeId:' + str(self.TypeId) + ', ' + \
12425
               'ResponseHeader:' + str(self.ResponseHeader) + ', ' + \
12426
               'Parameters:' + str(self.Parameters) + ')'
12427 1
12428
    __repr__ = __str__
12429
12430 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
12431
class DeleteSubscriptionsParameters(FrozenClass):
12432
    '''
12433
    :ivar SubscriptionIds:
12434
    :vartype SubscriptionIds: UInt32
12435 1
    '''
12436 1
    def __init__(self, binary=None):
12437 1
        if binary is not None:
12438 1
            self._binary_init(binary)
12439 1
            self._freeze = True
12440 1
            return
12441 1
        self.SubscriptionIds = []
12442
        self._freeze = True
12443 1
12444 1
    def to_binary(self):
12445 1
        packet = []
12446 1
        packet.append(uatype_Int32.pack(len(self.SubscriptionIds)))
12447 1
        for fieldname in self.SubscriptionIds:
12448 1
            packet.append(uatype_UInt32.pack(fieldname))
12449
        return b''.join(packet)
12450 1
12451
    @staticmethod
12452 1
    def from_binary(data):
12453
        return DeleteSubscriptionsParameters(data)
12454 1
12455 1
    def _binary_init(self, data):
12456
        self.SubscriptionIds = unpack_uatype_array('UInt32', data)
12457 1
12458
    def __str__(self):
12459
        return 'DeleteSubscriptionsParameters(' + 'SubscriptionIds:' + str(self.SubscriptionIds) + ')'
12460 1
12461
    __repr__ = __str__
12462
12463 1
12464
class DeleteSubscriptionsRequest(FrozenClass):
12465
    '''
12466
    :ivar TypeId:
12467
    :vartype TypeId: NodeId
12468
    :ivar RequestHeader:
12469
    :vartype RequestHeader: RequestHeader
12470
    :ivar Parameters:
12471
    :vartype Parameters: DeleteSubscriptionsParameters
12472 1
    '''
12473 1
    def __init__(self, binary=None):
12474
        if binary is not None:
12475
            self._binary_init(binary)
12476
            self._freeze = True
12477 1
            return
12478 1
        self.TypeId = FourByteNodeId(ObjectIds.DeleteSubscriptionsRequest_Encoding_DefaultBinary)
12479 1
        self.RequestHeader = RequestHeader()
12480 1
        self.Parameters = DeleteSubscriptionsParameters()
12481
        self._freeze = True
12482 1
12483 1
    def to_binary(self):
12484 1
        packet = []
12485 1
        packet.append(self.TypeId.to_binary())
12486 1
        packet.append(self.RequestHeader.to_binary())
12487 1
        packet.append(self.Parameters.to_binary())
12488
        return b''.join(packet)
12489 1
12490
    @staticmethod
12491
    def from_binary(data):
12492
        return DeleteSubscriptionsRequest(data)
12493 1
12494
    def _binary_init(self, data):
12495
        self.TypeId = NodeId.from_binary(data)
12496
        self.RequestHeader = RequestHeader.from_binary(data)
12497
        self.Parameters = DeleteSubscriptionsParameters.from_binary(data)
12498 1
12499
    def __str__(self):
12500
        return 'DeleteSubscriptionsRequest(' + 'TypeId:' + str(self.TypeId) + ', ' + \
12501
               'RequestHeader:' + str(self.RequestHeader) + ', ' + \
12502
               'Parameters:' + str(self.Parameters) + ')'
12503 1
12504
    __repr__ = __str__
12505
12506 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
12507
class DeleteSubscriptionsResponse(FrozenClass):
12508
    '''
12509
    :ivar TypeId:
12510
    :vartype TypeId: NodeId
12511
    :ivar ResponseHeader:
12512
    :vartype ResponseHeader: ResponseHeader
12513
    :ivar Results:
12514
    :vartype Results: StatusCode
12515
    :ivar DiagnosticInfos:
12516
    :vartype DiagnosticInfos: DiagnosticInfo
12517 1
    '''
12518 1
    def __init__(self, binary=None):
12519 1
        if binary is not None:
12520 1
            self._binary_init(binary)
12521 1
            self._freeze = True
12522 1
            return
12523 1
        self.TypeId = FourByteNodeId(ObjectIds.DeleteSubscriptionsResponse_Encoding_DefaultBinary)
12524 1
        self.ResponseHeader = ResponseHeader()
12525 1
        self.Results = []
12526 1
        self.DiagnosticInfos = []
12527
        self._freeze = True
12528 1
12529 1
    def to_binary(self):
12530 1
        packet = []
12531 1
        packet.append(self.TypeId.to_binary())
12532 1
        packet.append(self.ResponseHeader.to_binary())
12533 1
        packet.append(uatype_Int32.pack(len(self.Results)))
12534 1
        for fieldname in self.Results:
12535 1
            packet.append(fieldname.to_binary())
12536 1
        packet.append(uatype_Int32.pack(len(self.DiagnosticInfos)))
12537
        for fieldname in self.DiagnosticInfos:
12538 1
            packet.append(fieldname.to_binary())
12539
        return b''.join(packet)
12540 1
12541
    @staticmethod
12542 1
    def from_binary(data):
12543
        return DeleteSubscriptionsResponse(data)
12544 1
12545 1
    def _binary_init(self, data):
12546 1
        self.TypeId = NodeId.from_binary(data)
12547 1
        self.ResponseHeader = ResponseHeader.from_binary(data)
12548 1
        length = uatype_Int32.unpack(data.read(4))[0]
12549 1
        array = []
12550 1
        if length != -1:
12551 1
            for _ in range(0, length):
12552 1
                array.append(StatusCode.from_binary(data))
12553 1
        self.Results = array
12554 1
        length = uatype_Int32.unpack(data.read(4))[0]
12555 1
        array = []
12556 1
        if length != -1:
12557
            for _ in range(0, length):
12558 1
                array.append(DiagnosticInfo.from_binary(data))
12559
        self.DiagnosticInfos = array
12560 1
12561
    def __str__(self):
12562
        return 'DeleteSubscriptionsResponse(' + 'TypeId:' + str(self.TypeId) + ', ' + \
12563
               'ResponseHeader:' + str(self.ResponseHeader) + ', ' + \
12564
               'Results:' + str(self.Results) + ', ' + \
12565
               'DiagnosticInfos:' + str(self.DiagnosticInfos) + ')'
12566 1
12567
    __repr__ = __str__
12568
12569 1
12570
class BuildInfo(FrozenClass):
12571
    '''
12572
    :ivar ProductUri:
12573
    :vartype ProductUri: String
12574
    :ivar ManufacturerName:
12575
    :vartype ManufacturerName: String
12576
    :ivar ProductName:
12577
    :vartype ProductName: String
12578
    :ivar SoftwareVersion:
12579
    :vartype SoftwareVersion: String
12580
    :ivar BuildNumber:
12581
    :vartype BuildNumber: String
12582
    :ivar BuildDate:
12583
    :vartype BuildDate: DateTime
12584 1
    '''
12585
    def __init__(self, binary=None):
12586
        if binary is not None:
12587
            self._binary_init(binary)
12588
            self._freeze = True
12589
            return
12590
        self.ProductUri = None
12591
        self.ManufacturerName = None
12592
        self.ProductName = None
12593
        self.SoftwareVersion = None
12594
        self.BuildNumber = None
12595
        self.BuildDate = datetime.now()
12596
        self._freeze = True
12597 1
12598
    def to_binary(self):
12599
        packet = []
12600
        packet.append(pack_string(self.ProductUri))
12601
        packet.append(pack_string(self.ManufacturerName))
12602
        packet.append(pack_string(self.ProductName))
12603
        packet.append(pack_string(self.SoftwareVersion))
12604
        packet.append(pack_string(self.BuildNumber))
12605
        packet.append(pack_datetime(self.BuildDate))
12606
        return b''.join(packet)
12607 1
12608
    @staticmethod
12609
    def from_binary(data):
12610
        return BuildInfo(data)
12611 1
12612
    def _binary_init(self, data):
12613
        self.ProductUri = unpack_string(data)
12614
        self.ManufacturerName = unpack_string(data)
12615
        self.ProductName = unpack_string(data)
12616
        self.SoftwareVersion = unpack_string(data)
12617
        self.BuildNumber = unpack_string(data)
12618
        self.BuildDate = unpack_datetime(data)
12619 1
12620
    def __str__(self):
12621
        return 'BuildInfo(' + 'ProductUri:' + str(self.ProductUri) + ', ' + \
12622
               'ManufacturerName:' + str(self.ManufacturerName) + ', ' + \
12623
               'ProductName:' + str(self.ProductName) + ', ' + \
12624
               'SoftwareVersion:' + str(self.SoftwareVersion) + ', ' + \
12625
               'BuildNumber:' + str(self.BuildNumber) + ', ' + \
12626
               'BuildDate:' + str(self.BuildDate) + ')'
12627 1
12628
    __repr__ = __str__
12629
12630 1
12631
class RedundantServerDataType(FrozenClass):
12632
    '''
12633
    :ivar ServerId:
12634
    :vartype ServerId: String
12635
    :ivar ServiceLevel:
12636
    :vartype ServiceLevel: Byte
12637
    :ivar ServerState:
12638
    :vartype ServerState: ServerState
12639 1
    '''
12640
    def __init__(self, binary=None):
12641
        if binary is not None:
12642
            self._binary_init(binary)
12643
            self._freeze = True
12644
            return
12645
        self.ServerId = None
12646
        self.ServiceLevel = 0
12647
        self.ServerState = ServerState(0)
12648
        self._freeze = True
12649 1
12650
    def to_binary(self):
12651
        packet = []
12652
        packet.append(pack_string(self.ServerId))
12653
        packet.append(uatype_Byte.pack(self.ServiceLevel))
12654
        packet.append(uatype_UInt32.pack(self.ServerState.value))
12655
        return b''.join(packet)
12656 1
12657
    @staticmethod
12658
    def from_binary(data):
12659
        return RedundantServerDataType(data)
12660 1
12661
    def _binary_init(self, data):
12662
        self.ServerId = unpack_string(data)
12663
        self.ServiceLevel = uatype_Byte.unpack(data.read(1))[0]
12664
        self.ServerState = ServerState(uatype_UInt32.unpack(data.read(4))[0])
12665 1
12666
    def __str__(self):
12667
        return 'RedundantServerDataType(' + 'ServerId:' + str(self.ServerId) + ', ' + \
12668
               'ServiceLevel:' + str(self.ServiceLevel) + ', ' + \
12669
               'ServerState:' + str(self.ServerState) + ')'
12670 1
12671
    __repr__ = __str__
12672
12673 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
12674
class EndpointUrlListDataType(FrozenClass):
12675
    '''
12676
    :ivar EndpointUrlList:
12677
    :vartype EndpointUrlList: String
12678 1
    '''
12679
    def __init__(self, binary=None):
12680
        if binary is not None:
12681
            self._binary_init(binary)
12682
            self._freeze = True
12683
            return
12684
        self.EndpointUrlList = []
12685
        self._freeze = True
12686 1
12687
    def to_binary(self):
12688
        packet = []
12689
        packet.append(uatype_Int32.pack(len(self.EndpointUrlList)))
12690
        for fieldname in self.EndpointUrlList:
12691
            packet.append(pack_string(fieldname))
12692
        return b''.join(packet)
12693 1
12694
    @staticmethod
12695
    def from_binary(data):
12696
        return EndpointUrlListDataType(data)
12697 1
12698
    def _binary_init(self, data):
12699
        self.EndpointUrlList = unpack_uatype_array('String', data)
12700 1
12701
    def __str__(self):
12702
        return 'EndpointUrlListDataType(' + 'EndpointUrlList:' + str(self.EndpointUrlList) + ')'
12703 1
12704
    __repr__ = __str__
12705
12706 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
12707
class NetworkGroupDataType(FrozenClass):
12708
    '''
12709
    :ivar ServerUri:
12710
    :vartype ServerUri: String
12711
    :ivar NetworkPaths:
12712
    :vartype NetworkPaths: EndpointUrlListDataType
12713 1
    '''
12714
    def __init__(self, binary=None):
12715
        if binary is not None:
12716
            self._binary_init(binary)
12717
            self._freeze = True
12718
            return
12719
        self.ServerUri = None
12720
        self.NetworkPaths = []
12721
        self._freeze = True
12722 1
12723
    def to_binary(self):
12724
        packet = []
12725
        packet.append(pack_string(self.ServerUri))
12726
        packet.append(uatype_Int32.pack(len(self.NetworkPaths)))
12727
        for fieldname in self.NetworkPaths:
12728
            packet.append(fieldname.to_binary())
12729
        return b''.join(packet)
12730 1
12731
    @staticmethod
12732
    def from_binary(data):
12733
        return NetworkGroupDataType(data)
12734 1
12735
    def _binary_init(self, data):
12736
        self.ServerUri = unpack_string(data)
12737
        length = uatype_Int32.unpack(data.read(4))[0]
12738
        array = []
12739
        if length != -1:
12740
            for _ in range(0, length):
12741
                array.append(EndpointUrlListDataType.from_binary(data))
12742
        self.NetworkPaths = array
12743 1
12744
    def __str__(self):
12745
        return 'NetworkGroupDataType(' + 'ServerUri:' + str(self.ServerUri) + ', ' + \
12746
               'NetworkPaths:' + str(self.NetworkPaths) + ')'
12747 1
12748
    __repr__ = __str__
12749
12750 1
12751
class SamplingIntervalDiagnosticsDataType(FrozenClass):
12752
    '''
12753
    :ivar SamplingInterval:
12754
    :vartype SamplingInterval: Double
12755
    :ivar MonitoredItemCount:
12756
    :vartype MonitoredItemCount: UInt32
12757
    :ivar MaxMonitoredItemCount:
12758
    :vartype MaxMonitoredItemCount: UInt32
12759
    :ivar DisabledMonitoredItemCount:
12760
    :vartype DisabledMonitoredItemCount: UInt32
12761 1
    '''
12762
    def __init__(self, binary=None):
12763
        if binary is not None:
12764
            self._binary_init(binary)
12765
            self._freeze = True
12766
            return
12767
        self.SamplingInterval = 0
12768
        self.MonitoredItemCount = 0
12769
        self.MaxMonitoredItemCount = 0
12770
        self.DisabledMonitoredItemCount = 0
12771
        self._freeze = True
12772 1
12773
    def to_binary(self):
12774
        packet = []
12775
        packet.append(uatype_Double.pack(self.SamplingInterval))
12776
        packet.append(uatype_UInt32.pack(self.MonitoredItemCount))
12777
        packet.append(uatype_UInt32.pack(self.MaxMonitoredItemCount))
12778
        packet.append(uatype_UInt32.pack(self.DisabledMonitoredItemCount))
12779
        return b''.join(packet)
12780 1
12781
    @staticmethod
12782
    def from_binary(data):
12783
        return SamplingIntervalDiagnosticsDataType(data)
12784 1
12785
    def _binary_init(self, data):
12786
        self.SamplingInterval = uatype_Double.unpack(data.read(8))[0]
12787
        self.MonitoredItemCount = uatype_UInt32.unpack(data.read(4))[0]
12788
        self.MaxMonitoredItemCount = uatype_UInt32.unpack(data.read(4))[0]
12789
        self.DisabledMonitoredItemCount = uatype_UInt32.unpack(data.read(4))[0]
12790 1
12791
    def __str__(self):
12792
        return 'SamplingIntervalDiagnosticsDataType(' + 'SamplingInterval:' + str(self.SamplingInterval) + ', ' + \
12793
               'MonitoredItemCount:' + str(self.MonitoredItemCount) + ', ' + \
12794
               'MaxMonitoredItemCount:' + str(self.MaxMonitoredItemCount) + ', ' + \
12795
               'DisabledMonitoredItemCount:' + str(self.DisabledMonitoredItemCount) + ')'
12796 1
12797
    __repr__ = __str__
12798
12799 1
12800
class ServerDiagnosticsSummaryDataType(FrozenClass):
12801
    '''
12802
    :ivar ServerViewCount:
12803
    :vartype ServerViewCount: UInt32
12804
    :ivar CurrentSessionCount:
12805
    :vartype CurrentSessionCount: UInt32
12806
    :ivar CumulatedSessionCount:
12807
    :vartype CumulatedSessionCount: UInt32
12808
    :ivar SecurityRejectedSessionCount:
12809
    :vartype SecurityRejectedSessionCount: UInt32
12810
    :ivar RejectedSessionCount:
12811
    :vartype RejectedSessionCount: UInt32
12812
    :ivar SessionTimeoutCount:
12813
    :vartype SessionTimeoutCount: UInt32
12814
    :ivar SessionAbortCount:
12815
    :vartype SessionAbortCount: UInt32
12816
    :ivar CurrentSubscriptionCount:
12817
    :vartype CurrentSubscriptionCount: UInt32
12818
    :ivar CumulatedSubscriptionCount:
12819
    :vartype CumulatedSubscriptionCount: UInt32
12820
    :ivar PublishingIntervalCount:
12821
    :vartype PublishingIntervalCount: UInt32
12822
    :ivar SecurityRejectedRequestsCount:
12823
    :vartype SecurityRejectedRequestsCount: UInt32
12824
    :ivar RejectedRequestsCount:
12825
    :vartype RejectedRequestsCount: UInt32
12826 1
    '''
12827
    def __init__(self, binary=None):
12828
        if binary is not None:
12829
            self._binary_init(binary)
12830
            self._freeze = True
12831
            return
12832
        self.ServerViewCount = 0
12833
        self.CurrentSessionCount = 0
12834
        self.CumulatedSessionCount = 0
12835
        self.SecurityRejectedSessionCount = 0
12836
        self.RejectedSessionCount = 0
12837
        self.SessionTimeoutCount = 0
12838
        self.SessionAbortCount = 0
12839
        self.CurrentSubscriptionCount = 0
12840
        self.CumulatedSubscriptionCount = 0
12841
        self.PublishingIntervalCount = 0
12842
        self.SecurityRejectedRequestsCount = 0
12843
        self.RejectedRequestsCount = 0
12844
        self._freeze = True
12845 1
12846
    def to_binary(self):
12847
        packet = []
12848
        packet.append(uatype_UInt32.pack(self.ServerViewCount))
12849
        packet.append(uatype_UInt32.pack(self.CurrentSessionCount))
12850
        packet.append(uatype_UInt32.pack(self.CumulatedSessionCount))
12851
        packet.append(uatype_UInt32.pack(self.SecurityRejectedSessionCount))
12852
        packet.append(uatype_UInt32.pack(self.RejectedSessionCount))
12853
        packet.append(uatype_UInt32.pack(self.SessionTimeoutCount))
12854
        packet.append(uatype_UInt32.pack(self.SessionAbortCount))
12855
        packet.append(uatype_UInt32.pack(self.CurrentSubscriptionCount))
12856
        packet.append(uatype_UInt32.pack(self.CumulatedSubscriptionCount))
12857
        packet.append(uatype_UInt32.pack(self.PublishingIntervalCount))
12858
        packet.append(uatype_UInt32.pack(self.SecurityRejectedRequestsCount))
12859
        packet.append(uatype_UInt32.pack(self.RejectedRequestsCount))
12860
        return b''.join(packet)
12861 1
12862
    @staticmethod
12863
    def from_binary(data):
12864
        return ServerDiagnosticsSummaryDataType(data)
12865 1
12866
    def _binary_init(self, data):
12867
        self.ServerViewCount = uatype_UInt32.unpack(data.read(4))[0]
12868
        self.CurrentSessionCount = uatype_UInt32.unpack(data.read(4))[0]
12869
        self.CumulatedSessionCount = uatype_UInt32.unpack(data.read(4))[0]
12870
        self.SecurityRejectedSessionCount = uatype_UInt32.unpack(data.read(4))[0]
12871
        self.RejectedSessionCount = uatype_UInt32.unpack(data.read(4))[0]
12872
        self.SessionTimeoutCount = uatype_UInt32.unpack(data.read(4))[0]
12873
        self.SessionAbortCount = uatype_UInt32.unpack(data.read(4))[0]
12874
        self.CurrentSubscriptionCount = uatype_UInt32.unpack(data.read(4))[0]
12875
        self.CumulatedSubscriptionCount = uatype_UInt32.unpack(data.read(4))[0]
12876
        self.PublishingIntervalCount = uatype_UInt32.unpack(data.read(4))[0]
12877
        self.SecurityRejectedRequestsCount = uatype_UInt32.unpack(data.read(4))[0]
12878
        self.RejectedRequestsCount = uatype_UInt32.unpack(data.read(4))[0]
12879 1
12880
    def __str__(self):
12881
        return 'ServerDiagnosticsSummaryDataType(' + 'ServerViewCount:' + str(self.ServerViewCount) + ', ' + \
12882
               'CurrentSessionCount:' + str(self.CurrentSessionCount) + ', ' + \
12883
               'CumulatedSessionCount:' + str(self.CumulatedSessionCount) + ', ' + \
12884
               'SecurityRejectedSessionCount:' + str(self.SecurityRejectedSessionCount) + ', ' + \
12885
               'RejectedSessionCount:' + str(self.RejectedSessionCount) + ', ' + \
12886
               'SessionTimeoutCount:' + str(self.SessionTimeoutCount) + ', ' + \
12887
               'SessionAbortCount:' + str(self.SessionAbortCount) + ', ' + \
12888
               'CurrentSubscriptionCount:' + str(self.CurrentSubscriptionCount) + ', ' + \
12889
               'CumulatedSubscriptionCount:' + str(self.CumulatedSubscriptionCount) + ', ' + \
12890
               'PublishingIntervalCount:' + str(self.PublishingIntervalCount) + ', ' + \
12891
               'SecurityRejectedRequestsCount:' + str(self.SecurityRejectedRequestsCount) + ', ' + \
12892
               'RejectedRequestsCount:' + str(self.RejectedRequestsCount) + ')'
12893 1
12894
    __repr__ = __str__
12895
12896 1
12897
class ServerStatusDataType(FrozenClass):
12898
    '''
12899
    :ivar StartTime:
12900
    :vartype StartTime: DateTime
12901
    :ivar CurrentTime:
12902
    :vartype CurrentTime: DateTime
12903
    :ivar State:
12904
    :vartype State: ServerState
12905
    :ivar BuildInfo:
12906
    :vartype BuildInfo: BuildInfo
12907
    :ivar SecondsTillShutdown:
12908
    :vartype SecondsTillShutdown: UInt32
12909
    :ivar ShutdownReason:
12910
    :vartype ShutdownReason: LocalizedText
12911 1
    '''
12912
    def __init__(self, binary=None):
12913
        if binary is not None:
12914
            self._binary_init(binary)
12915
            self._freeze = True
12916
            return
12917
        self.StartTime = datetime.now()
12918
        self.CurrentTime = datetime.now()
12919
        self.State = ServerState(0)
12920
        self.BuildInfo = BuildInfo()
12921
        self.SecondsTillShutdown = 0
12922
        self.ShutdownReason = LocalizedText()
12923
        self._freeze = True
12924 1
12925
    def to_binary(self):
12926
        packet = []
12927
        packet.append(pack_datetime(self.StartTime))
12928
        packet.append(pack_datetime(self.CurrentTime))
12929
        packet.append(uatype_UInt32.pack(self.State.value))
12930
        packet.append(self.BuildInfo.to_binary())
12931
        packet.append(uatype_UInt32.pack(self.SecondsTillShutdown))
12932
        packet.append(self.ShutdownReason.to_binary())
12933
        return b''.join(packet)
12934 1
12935
    @staticmethod
12936
    def from_binary(data):
12937
        return ServerStatusDataType(data)
12938 1
12939
    def _binary_init(self, data):
12940
        self.StartTime = unpack_datetime(data)
12941
        self.CurrentTime = unpack_datetime(data)
12942
        self.State = ServerState(uatype_UInt32.unpack(data.read(4))[0])
12943
        self.BuildInfo = BuildInfo.from_binary(data)
12944
        self.SecondsTillShutdown = uatype_UInt32.unpack(data.read(4))[0]
12945
        self.ShutdownReason = LocalizedText.from_binary(data)
12946 1
12947
    def __str__(self):
12948
        return 'ServerStatusDataType(' + 'StartTime:' + str(self.StartTime) + ', ' + \
12949
               'CurrentTime:' + str(self.CurrentTime) + ', ' + \
12950
               'State:' + str(self.State) + ', ' + \
12951
               'BuildInfo:' + str(self.BuildInfo) + ', ' + \
12952
               'SecondsTillShutdown:' + str(self.SecondsTillShutdown) + ', ' + \
12953
               'ShutdownReason:' + str(self.ShutdownReason) + ')'
12954 1
12955
    __repr__ = __str__
12956
12957 1
12958
class SessionDiagnosticsDataType(FrozenClass):
12959
    '''
12960
    :ivar SessionId:
12961
    :vartype SessionId: NodeId
12962
    :ivar SessionName:
12963
    :vartype SessionName: String
12964
    :ivar ClientDescription:
12965
    :vartype ClientDescription: ApplicationDescription
12966
    :ivar ServerUri:
12967
    :vartype ServerUri: String
12968
    :ivar EndpointUrl:
12969
    :vartype EndpointUrl: String
12970
    :ivar LocaleIds:
12971
    :vartype LocaleIds: String
12972
    :ivar ActualSessionTimeout:
12973
    :vartype ActualSessionTimeout: Double
12974
    :ivar MaxResponseMessageSize:
12975
    :vartype MaxResponseMessageSize: UInt32
12976
    :ivar ClientConnectionTime:
12977
    :vartype ClientConnectionTime: DateTime
12978
    :ivar ClientLastContactTime:
12979
    :vartype ClientLastContactTime: DateTime
12980
    :ivar CurrentSubscriptionsCount:
12981
    :vartype CurrentSubscriptionsCount: UInt32
12982
    :ivar CurrentMonitoredItemsCount:
12983
    :vartype CurrentMonitoredItemsCount: UInt32
12984
    :ivar CurrentPublishRequestsInQueue:
12985
    :vartype CurrentPublishRequestsInQueue: UInt32
12986
    :ivar TotalRequestCount:
12987
    :vartype TotalRequestCount: ServiceCounterDataType
12988
    :ivar UnauthorizedRequestCount:
12989
    :vartype UnauthorizedRequestCount: UInt32
12990
    :ivar ReadCount:
12991
    :vartype ReadCount: ServiceCounterDataType
12992
    :ivar HistoryReadCount:
12993
    :vartype HistoryReadCount: ServiceCounterDataType
12994
    :ivar WriteCount:
12995
    :vartype WriteCount: ServiceCounterDataType
12996
    :ivar HistoryUpdateCount:
12997
    :vartype HistoryUpdateCount: ServiceCounterDataType
12998
    :ivar CallCount:
12999
    :vartype CallCount: ServiceCounterDataType
13000
    :ivar CreateMonitoredItemsCount:
13001
    :vartype CreateMonitoredItemsCount: ServiceCounterDataType
13002
    :ivar ModifyMonitoredItemsCount:
13003
    :vartype ModifyMonitoredItemsCount: ServiceCounterDataType
13004
    :ivar SetMonitoringModeCount:
13005
    :vartype SetMonitoringModeCount: ServiceCounterDataType
13006
    :ivar SetTriggeringCount:
13007
    :vartype SetTriggeringCount: ServiceCounterDataType
13008
    :ivar DeleteMonitoredItemsCount:
13009
    :vartype DeleteMonitoredItemsCount: ServiceCounterDataType
13010
    :ivar CreateSubscriptionCount:
13011
    :vartype CreateSubscriptionCount: ServiceCounterDataType
13012
    :ivar ModifySubscriptionCount:
13013
    :vartype ModifySubscriptionCount: ServiceCounterDataType
13014
    :ivar SetPublishingModeCount:
13015
    :vartype SetPublishingModeCount: ServiceCounterDataType
13016
    :ivar PublishCount:
13017
    :vartype PublishCount: ServiceCounterDataType
13018
    :ivar RepublishCount:
13019
    :vartype RepublishCount: ServiceCounterDataType
13020
    :ivar TransferSubscriptionsCount:
13021
    :vartype TransferSubscriptionsCount: ServiceCounterDataType
13022
    :ivar DeleteSubscriptionsCount:
13023
    :vartype DeleteSubscriptionsCount: ServiceCounterDataType
13024
    :ivar AddNodesCount:
13025
    :vartype AddNodesCount: ServiceCounterDataType
13026
    :ivar AddReferencesCount:
13027
    :vartype AddReferencesCount: ServiceCounterDataType
13028
    :ivar DeleteNodesCount:
13029
    :vartype DeleteNodesCount: ServiceCounterDataType
13030
    :ivar DeleteReferencesCount:
13031
    :vartype DeleteReferencesCount: ServiceCounterDataType
13032
    :ivar BrowseCount:
13033
    :vartype BrowseCount: ServiceCounterDataType
13034
    :ivar BrowseNextCount:
13035
    :vartype BrowseNextCount: ServiceCounterDataType
13036
    :ivar TranslateBrowsePathsToNodeIdsCount:
13037
    :vartype TranslateBrowsePathsToNodeIdsCount: ServiceCounterDataType
13038
    :ivar QueryFirstCount:
13039
    :vartype QueryFirstCount: ServiceCounterDataType
13040
    :ivar QueryNextCount:
13041
    :vartype QueryNextCount: ServiceCounterDataType
13042
    :ivar RegisterNodesCount:
13043
    :vartype RegisterNodesCount: ServiceCounterDataType
13044
    :ivar UnregisterNodesCount:
13045
    :vartype UnregisterNodesCount: ServiceCounterDataType
13046 1
    '''
13047
    def __init__(self, binary=None):
13048
        if binary is not None:
13049
            self._binary_init(binary)
13050
            self._freeze = True
13051
            return
13052
        self.SessionId = NodeId()
13053
        self.SessionName = None
13054
        self.ClientDescription = ApplicationDescription()
13055
        self.ServerUri = None
13056
        self.EndpointUrl = None
13057
        self.LocaleIds = []
13058
        self.ActualSessionTimeout = 0
13059
        self.MaxResponseMessageSize = 0
13060
        self.ClientConnectionTime = datetime.now()
13061
        self.ClientLastContactTime = datetime.now()
13062
        self.CurrentSubscriptionsCount = 0
13063
        self.CurrentMonitoredItemsCount = 0
13064
        self.CurrentPublishRequestsInQueue = 0
13065
        self.TotalRequestCount = ServiceCounterDataType()
13066
        self.UnauthorizedRequestCount = 0
13067
        self.ReadCount = ServiceCounterDataType()
13068
        self.HistoryReadCount = ServiceCounterDataType()
13069
        self.WriteCount = ServiceCounterDataType()
13070
        self.HistoryUpdateCount = ServiceCounterDataType()
13071
        self.CallCount = ServiceCounterDataType()
13072
        self.CreateMonitoredItemsCount = ServiceCounterDataType()
13073
        self.ModifyMonitoredItemsCount = ServiceCounterDataType()
13074
        self.SetMonitoringModeCount = ServiceCounterDataType()
13075
        self.SetTriggeringCount = ServiceCounterDataType()
13076
        self.DeleteMonitoredItemsCount = ServiceCounterDataType()
13077
        self.CreateSubscriptionCount = ServiceCounterDataType()
13078
        self.ModifySubscriptionCount = ServiceCounterDataType()
13079
        self.SetPublishingModeCount = ServiceCounterDataType()
13080
        self.PublishCount = ServiceCounterDataType()
13081
        self.RepublishCount = ServiceCounterDataType()
13082
        self.TransferSubscriptionsCount = ServiceCounterDataType()
13083
        self.DeleteSubscriptionsCount = ServiceCounterDataType()
13084
        self.AddNodesCount = ServiceCounterDataType()
13085
        self.AddReferencesCount = ServiceCounterDataType()
13086
        self.DeleteNodesCount = ServiceCounterDataType()
13087
        self.DeleteReferencesCount = ServiceCounterDataType()
13088
        self.BrowseCount = ServiceCounterDataType()
13089
        self.BrowseNextCount = ServiceCounterDataType()
13090
        self.TranslateBrowsePathsToNodeIdsCount = ServiceCounterDataType()
13091
        self.QueryFirstCount = ServiceCounterDataType()
13092
        self.QueryNextCount = ServiceCounterDataType()
13093
        self.RegisterNodesCount = ServiceCounterDataType()
13094
        self.UnregisterNodesCount = ServiceCounterDataType()
13095
        self._freeze = True
13096 1
13097
    def to_binary(self):
13098
        packet = []
13099
        packet.append(self.SessionId.to_binary())
13100
        packet.append(pack_string(self.SessionName))
13101
        packet.append(self.ClientDescription.to_binary())
13102
        packet.append(pack_string(self.ServerUri))
13103
        packet.append(pack_string(self.EndpointUrl))
13104
        packet.append(uatype_Int32.pack(len(self.LocaleIds)))
13105
        for fieldname in self.LocaleIds:
13106
            packet.append(pack_string(fieldname))
13107
        packet.append(uatype_Double.pack(self.ActualSessionTimeout))
13108
        packet.append(uatype_UInt32.pack(self.MaxResponseMessageSize))
13109
        packet.append(pack_datetime(self.ClientConnectionTime))
13110
        packet.append(pack_datetime(self.ClientLastContactTime))
13111
        packet.append(uatype_UInt32.pack(self.CurrentSubscriptionsCount))
13112
        packet.append(uatype_UInt32.pack(self.CurrentMonitoredItemsCount))
13113
        packet.append(uatype_UInt32.pack(self.CurrentPublishRequestsInQueue))
13114
        packet.append(self.TotalRequestCount.to_binary())
13115
        packet.append(uatype_UInt32.pack(self.UnauthorizedRequestCount))
13116
        packet.append(self.ReadCount.to_binary())
13117
        packet.append(self.HistoryReadCount.to_binary())
13118
        packet.append(self.WriteCount.to_binary())
13119
        packet.append(self.HistoryUpdateCount.to_binary())
13120
        packet.append(self.CallCount.to_binary())
13121
        packet.append(self.CreateMonitoredItemsCount.to_binary())
13122
        packet.append(self.ModifyMonitoredItemsCount.to_binary())
13123
        packet.append(self.SetMonitoringModeCount.to_binary())
13124
        packet.append(self.SetTriggeringCount.to_binary())
13125
        packet.append(self.DeleteMonitoredItemsCount.to_binary())
13126
        packet.append(self.CreateSubscriptionCount.to_binary())
13127
        packet.append(self.ModifySubscriptionCount.to_binary())
13128
        packet.append(self.SetPublishingModeCount.to_binary())
13129
        packet.append(self.PublishCount.to_binary())
13130
        packet.append(self.RepublishCount.to_binary())
13131
        packet.append(self.TransferSubscriptionsCount.to_binary())
13132
        packet.append(self.DeleteSubscriptionsCount.to_binary())
13133
        packet.append(self.AddNodesCount.to_binary())
13134
        packet.append(self.AddReferencesCount.to_binary())
13135
        packet.append(self.DeleteNodesCount.to_binary())
13136
        packet.append(self.DeleteReferencesCount.to_binary())
13137
        packet.append(self.BrowseCount.to_binary())
13138
        packet.append(self.BrowseNextCount.to_binary())
13139
        packet.append(self.TranslateBrowsePathsToNodeIdsCount.to_binary())
13140
        packet.append(self.QueryFirstCount.to_binary())
13141
        packet.append(self.QueryNextCount.to_binary())
13142
        packet.append(self.RegisterNodesCount.to_binary())
13143
        packet.append(self.UnregisterNodesCount.to_binary())
13144
        return b''.join(packet)
13145 1
13146
    @staticmethod
13147
    def from_binary(data):
13148
        return SessionDiagnosticsDataType(data)
13149 1
13150
    def _binary_init(self, data):
13151
        self.SessionId = NodeId.from_binary(data)
13152
        self.SessionName = unpack_string(data)
13153
        self.ClientDescription = ApplicationDescription.from_binary(data)
13154
        self.ServerUri = unpack_string(data)
13155
        self.EndpointUrl = unpack_string(data)
13156
        self.LocaleIds = unpack_uatype_array('String', data)
13157
        self.ActualSessionTimeout = uatype_Double.unpack(data.read(8))[0]
13158
        self.MaxResponseMessageSize = uatype_UInt32.unpack(data.read(4))[0]
13159
        self.ClientConnectionTime = unpack_datetime(data)
13160
        self.ClientLastContactTime = unpack_datetime(data)
13161
        self.CurrentSubscriptionsCount = uatype_UInt32.unpack(data.read(4))[0]
13162
        self.CurrentMonitoredItemsCount = uatype_UInt32.unpack(data.read(4))[0]
13163
        self.CurrentPublishRequestsInQueue = uatype_UInt32.unpack(data.read(4))[0]
13164
        self.TotalRequestCount = ServiceCounterDataType.from_binary(data)
13165
        self.UnauthorizedRequestCount = uatype_UInt32.unpack(data.read(4))[0]
13166
        self.ReadCount = ServiceCounterDataType.from_binary(data)
13167
        self.HistoryReadCount = ServiceCounterDataType.from_binary(data)
13168
        self.WriteCount = ServiceCounterDataType.from_binary(data)
13169
        self.HistoryUpdateCount = ServiceCounterDataType.from_binary(data)
13170
        self.CallCount = ServiceCounterDataType.from_binary(data)
13171
        self.CreateMonitoredItemsCount = ServiceCounterDataType.from_binary(data)
13172
        self.ModifyMonitoredItemsCount = ServiceCounterDataType.from_binary(data)
13173
        self.SetMonitoringModeCount = ServiceCounterDataType.from_binary(data)
13174
        self.SetTriggeringCount = ServiceCounterDataType.from_binary(data)
13175
        self.DeleteMonitoredItemsCount = ServiceCounterDataType.from_binary(data)
13176
        self.CreateSubscriptionCount = ServiceCounterDataType.from_binary(data)
13177
        self.ModifySubscriptionCount = ServiceCounterDataType.from_binary(data)
13178
        self.SetPublishingModeCount = ServiceCounterDataType.from_binary(data)
13179
        self.PublishCount = ServiceCounterDataType.from_binary(data)
13180
        self.RepublishCount = ServiceCounterDataType.from_binary(data)
13181
        self.TransferSubscriptionsCount = ServiceCounterDataType.from_binary(data)
13182
        self.DeleteSubscriptionsCount = ServiceCounterDataType.from_binary(data)
13183
        self.AddNodesCount = ServiceCounterDataType.from_binary(data)
13184
        self.AddReferencesCount = ServiceCounterDataType.from_binary(data)
13185
        self.DeleteNodesCount = ServiceCounterDataType.from_binary(data)
13186
        self.DeleteReferencesCount = ServiceCounterDataType.from_binary(data)
13187
        self.BrowseCount = ServiceCounterDataType.from_binary(data)
13188
        self.BrowseNextCount = ServiceCounterDataType.from_binary(data)
13189
        self.TranslateBrowsePathsToNodeIdsCount = ServiceCounterDataType.from_binary(data)
13190
        self.QueryFirstCount = ServiceCounterDataType.from_binary(data)
13191
        self.QueryNextCount = ServiceCounterDataType.from_binary(data)
13192
        self.RegisterNodesCount = ServiceCounterDataType.from_binary(data)
13193
        self.UnregisterNodesCount = ServiceCounterDataType.from_binary(data)
13194 1
13195
    def __str__(self):
13196
        return 'SessionDiagnosticsDataType(' + 'SessionId:' + str(self.SessionId) + ', ' + \
13197
               'SessionName:' + str(self.SessionName) + ', ' + \
13198
               'ClientDescription:' + str(self.ClientDescription) + ', ' + \
13199
               'ServerUri:' + str(self.ServerUri) + ', ' + \
13200
               'EndpointUrl:' + str(self.EndpointUrl) + ', ' + \
13201
               'LocaleIds:' + str(self.LocaleIds) + ', ' + \
13202
               'ActualSessionTimeout:' + str(self.ActualSessionTimeout) + ', ' + \
13203
               'MaxResponseMessageSize:' + str(self.MaxResponseMessageSize) + ', ' + \
13204
               'ClientConnectionTime:' + str(self.ClientConnectionTime) + ', ' + \
13205
               'ClientLastContactTime:' + str(self.ClientLastContactTime) + ', ' + \
13206
               'CurrentSubscriptionsCount:' + str(self.CurrentSubscriptionsCount) + ', ' + \
13207
               'CurrentMonitoredItemsCount:' + str(self.CurrentMonitoredItemsCount) + ', ' + \
13208
               'CurrentPublishRequestsInQueue:' + str(self.CurrentPublishRequestsInQueue) + ', ' + \
13209
               'TotalRequestCount:' + str(self.TotalRequestCount) + ', ' + \
13210
               'UnauthorizedRequestCount:' + str(self.UnauthorizedRequestCount) + ', ' + \
13211
               'ReadCount:' + str(self.ReadCount) + ', ' + \
13212
               'HistoryReadCount:' + str(self.HistoryReadCount) + ', ' + \
13213
               'WriteCount:' + str(self.WriteCount) + ', ' + \
13214
               'HistoryUpdateCount:' + str(self.HistoryUpdateCount) + ', ' + \
13215
               'CallCount:' + str(self.CallCount) + ', ' + \
13216
               'CreateMonitoredItemsCount:' + str(self.CreateMonitoredItemsCount) + ', ' + \
13217
               'ModifyMonitoredItemsCount:' + str(self.ModifyMonitoredItemsCount) + ', ' + \
13218
               'SetMonitoringModeCount:' + str(self.SetMonitoringModeCount) + ', ' + \
13219
               'SetTriggeringCount:' + str(self.SetTriggeringCount) + ', ' + \
13220
               'DeleteMonitoredItemsCount:' + str(self.DeleteMonitoredItemsCount) + ', ' + \
13221
               'CreateSubscriptionCount:' + str(self.CreateSubscriptionCount) + ', ' + \
13222
               'ModifySubscriptionCount:' + str(self.ModifySubscriptionCount) + ', ' + \
13223
               'SetPublishingModeCount:' + str(self.SetPublishingModeCount) + ', ' + \
13224
               'PublishCount:' + str(self.PublishCount) + ', ' + \
13225
               'RepublishCount:' + str(self.RepublishCount) + ', ' + \
13226
               'TransferSubscriptionsCount:' + str(self.TransferSubscriptionsCount) + ', ' + \
13227
               'DeleteSubscriptionsCount:' + str(self.DeleteSubscriptionsCount) + ', ' + \
13228
               'AddNodesCount:' + str(self.AddNodesCount) + ', ' + \
13229
               'AddReferencesCount:' + str(self.AddReferencesCount) + ', ' + \
13230
               'DeleteNodesCount:' + str(self.DeleteNodesCount) + ', ' + \
13231
               'DeleteReferencesCount:' + str(self.DeleteReferencesCount) + ', ' + \
13232
               'BrowseCount:' + str(self.BrowseCount) + ', ' + \
13233
               'BrowseNextCount:' + str(self.BrowseNextCount) + ', ' + \
13234
               'TranslateBrowsePathsToNodeIdsCount:' + str(self.TranslateBrowsePathsToNodeIdsCount) + ', ' + \
13235
               'QueryFirstCount:' + str(self.QueryFirstCount) + ', ' + \
13236
               'QueryNextCount:' + str(self.QueryNextCount) + ', ' + \
13237
               'RegisterNodesCount:' + str(self.RegisterNodesCount) + ', ' + \
13238
               'UnregisterNodesCount:' + str(self.UnregisterNodesCount) + ')'
13239 1
13240
    __repr__ = __str__
13241
13242 1
13243
class SessionSecurityDiagnosticsDataType(FrozenClass):
13244
    '''
13245
    :ivar SessionId:
13246
    :vartype SessionId: NodeId
13247
    :ivar ClientUserIdOfSession:
13248
    :vartype ClientUserIdOfSession: String
13249
    :ivar ClientUserIdHistory:
13250
    :vartype ClientUserIdHistory: String
13251
    :ivar AuthenticationMechanism:
13252
    :vartype AuthenticationMechanism: String
13253
    :ivar Encoding:
13254
    :vartype Encoding: String
13255
    :ivar TransportProtocol:
13256
    :vartype TransportProtocol: String
13257
    :ivar SecurityMode:
13258
    :vartype SecurityMode: MessageSecurityMode
13259
    :ivar SecurityPolicyUri:
13260
    :vartype SecurityPolicyUri: String
13261
    :ivar ClientCertificate:
13262
    :vartype ClientCertificate: ByteString
13263 1
    '''
13264
    def __init__(self, binary=None):
13265
        if binary is not None:
13266
            self._binary_init(binary)
13267
            self._freeze = True
13268
            return
13269
        self.SessionId = NodeId()
13270
        self.ClientUserIdOfSession = None
13271
        self.ClientUserIdHistory = []
13272
        self.AuthenticationMechanism = None
13273
        self.Encoding = None
13274
        self.TransportProtocol = None
13275
        self.SecurityMode = MessageSecurityMode(0)
13276
        self.SecurityPolicyUri = None
13277
        self.ClientCertificate = None
13278
        self._freeze = True
13279 1
13280
    def to_binary(self):
13281
        packet = []
13282
        packet.append(self.SessionId.to_binary())
13283
        packet.append(pack_string(self.ClientUserIdOfSession))
13284
        packet.append(uatype_Int32.pack(len(self.ClientUserIdHistory)))
13285
        for fieldname in self.ClientUserIdHistory:
13286
            packet.append(pack_string(fieldname))
13287
        packet.append(pack_string(self.AuthenticationMechanism))
13288
        packet.append(pack_string(self.Encoding))
13289
        packet.append(pack_string(self.TransportProtocol))
13290
        packet.append(uatype_UInt32.pack(self.SecurityMode.value))
13291
        packet.append(pack_string(self.SecurityPolicyUri))
13292
        packet.append(pack_bytes(self.ClientCertificate))
13293
        return b''.join(packet)
13294 1
13295
    @staticmethod
13296
    def from_binary(data):
13297
        return SessionSecurityDiagnosticsDataType(data)
13298 1
13299
    def _binary_init(self, data):
13300
        self.SessionId = NodeId.from_binary(data)
13301
        self.ClientUserIdOfSession = unpack_string(data)
13302
        self.ClientUserIdHistory = unpack_uatype_array('String', data)
13303
        self.AuthenticationMechanism = unpack_string(data)
13304
        self.Encoding = unpack_string(data)
13305
        self.TransportProtocol = unpack_string(data)
13306
        self.SecurityMode = MessageSecurityMode(uatype_UInt32.unpack(data.read(4))[0])
13307
        self.SecurityPolicyUri = unpack_string(data)
13308
        self.ClientCertificate = unpack_bytes(data)
13309 1
13310
    def __str__(self):
13311
        return 'SessionSecurityDiagnosticsDataType(' + 'SessionId:' + str(self.SessionId) + ', ' + \
13312
               'ClientUserIdOfSession:' + str(self.ClientUserIdOfSession) + ', ' + \
13313
               'ClientUserIdHistory:' + str(self.ClientUserIdHistory) + ', ' + \
13314
               'AuthenticationMechanism:' + str(self.AuthenticationMechanism) + ', ' + \
13315
               'Encoding:' + str(self.Encoding) + ', ' + \
13316
               'TransportProtocol:' + str(self.TransportProtocol) + ', ' + \
13317
               'SecurityMode:' + str(self.SecurityMode) + ', ' + \
13318
               'SecurityPolicyUri:' + str(self.SecurityPolicyUri) + ', ' + \
13319
               'ClientCertificate:' + str(self.ClientCertificate) + ')'
13320 1
13321
    __repr__ = __str__
13322
13323 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
13324
class ServiceCounterDataType(FrozenClass):
13325
    '''
13326
    :ivar TotalCount:
13327
    :vartype TotalCount: UInt32
13328
    :ivar ErrorCount:
13329
    :vartype ErrorCount: UInt32
13330 1
    '''
13331
    def __init__(self, binary=None):
13332
        if binary is not None:
13333
            self._binary_init(binary)
13334
            self._freeze = True
13335
            return
13336
        self.TotalCount = 0
13337
        self.ErrorCount = 0
13338
        self._freeze = True
13339 1
13340
    def to_binary(self):
13341
        packet = []
13342
        packet.append(uatype_UInt32.pack(self.TotalCount))
13343
        packet.append(uatype_UInt32.pack(self.ErrorCount))
13344
        return b''.join(packet)
13345 1
13346
    @staticmethod
13347
    def from_binary(data):
13348
        return ServiceCounterDataType(data)
13349 1
13350
    def _binary_init(self, data):
13351
        self.TotalCount = uatype_UInt32.unpack(data.read(4))[0]
13352
        self.ErrorCount = uatype_UInt32.unpack(data.read(4))[0]
13353 1
13354
    def __str__(self):
13355
        return 'ServiceCounterDataType(' + 'TotalCount:' + str(self.TotalCount) + ', ' + \
13356
               'ErrorCount:' + str(self.ErrorCount) + ')'
13357 1
13358
    __repr__ = __str__
13359
13360 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
13361
class StatusResult(FrozenClass):
13362
    '''
13363
    :ivar StatusCode:
13364
    :vartype StatusCode: StatusCode
13365
    :ivar DiagnosticInfo:
13366
    :vartype DiagnosticInfo: DiagnosticInfo
13367 1
    '''
13368
    def __init__(self, binary=None):
13369
        if binary is not None:
13370
            self._binary_init(binary)
13371
            self._freeze = True
13372
            return
13373
        self.StatusCode = StatusCode()
13374
        self.DiagnosticInfo = DiagnosticInfo()
13375
        self._freeze = True
13376 1
13377
    def to_binary(self):
13378
        packet = []
13379
        packet.append(self.StatusCode.to_binary())
13380
        packet.append(self.DiagnosticInfo.to_binary())
13381
        return b''.join(packet)
13382 1
13383
    @staticmethod
13384
    def from_binary(data):
13385
        return StatusResult(data)
13386 1
13387
    def _binary_init(self, data):
13388
        self.StatusCode = StatusCode.from_binary(data)
13389
        self.DiagnosticInfo = DiagnosticInfo.from_binary(data)
13390 1
13391
    def __str__(self):
13392
        return 'StatusResult(' + 'StatusCode:' + str(self.StatusCode) + ', ' + \
13393
               'DiagnosticInfo:' + str(self.DiagnosticInfo) + ')'
13394 1
13395
    __repr__ = __str__
13396
13397 1
13398
class SubscriptionDiagnosticsDataType(FrozenClass):
13399
    '''
13400
    :ivar SessionId:
13401
    :vartype SessionId: NodeId
13402
    :ivar SubscriptionId:
13403
    :vartype SubscriptionId: UInt32
13404
    :ivar Priority:
13405
    :vartype Priority: Byte
13406
    :ivar PublishingInterval:
13407
    :vartype PublishingInterval: Double
13408
    :ivar MaxKeepAliveCount:
13409
    :vartype MaxKeepAliveCount: UInt32
13410
    :ivar MaxLifetimeCount:
13411
    :vartype MaxLifetimeCount: UInt32
13412
    :ivar MaxNotificationsPerPublish:
13413
    :vartype MaxNotificationsPerPublish: UInt32
13414
    :ivar PublishingEnabled:
13415
    :vartype PublishingEnabled: Boolean
13416
    :ivar ModifyCount:
13417
    :vartype ModifyCount: UInt32
13418
    :ivar EnableCount:
13419
    :vartype EnableCount: UInt32
13420
    :ivar DisableCount:
13421
    :vartype DisableCount: UInt32
13422
    :ivar RepublishRequestCount:
13423
    :vartype RepublishRequestCount: UInt32
13424
    :ivar RepublishMessageRequestCount:
13425
    :vartype RepublishMessageRequestCount: UInt32
13426
    :ivar RepublishMessageCount:
13427
    :vartype RepublishMessageCount: UInt32
13428
    :ivar TransferRequestCount:
13429
    :vartype TransferRequestCount: UInt32
13430
    :ivar TransferredToAltClientCount:
13431
    :vartype TransferredToAltClientCount: UInt32
13432
    :ivar TransferredToSameClientCount:
13433
    :vartype TransferredToSameClientCount: UInt32
13434
    :ivar PublishRequestCount:
13435
    :vartype PublishRequestCount: UInt32
13436
    :ivar DataChangeNotificationsCount:
13437
    :vartype DataChangeNotificationsCount: UInt32
13438
    :ivar EventNotificationsCount:
13439
    :vartype EventNotificationsCount: UInt32
13440
    :ivar NotificationsCount:
13441
    :vartype NotificationsCount: UInt32
13442
    :ivar LatePublishRequestCount:
13443
    :vartype LatePublishRequestCount: UInt32
13444
    :ivar CurrentKeepAliveCount:
13445
    :vartype CurrentKeepAliveCount: UInt32
13446
    :ivar CurrentLifetimeCount:
13447
    :vartype CurrentLifetimeCount: UInt32
13448
    :ivar UnacknowledgedMessageCount:
13449
    :vartype UnacknowledgedMessageCount: UInt32
13450
    :ivar DiscardedMessageCount:
13451
    :vartype DiscardedMessageCount: UInt32
13452
    :ivar MonitoredItemCount:
13453
    :vartype MonitoredItemCount: UInt32
13454
    :ivar DisabledMonitoredItemCount:
13455
    :vartype DisabledMonitoredItemCount: UInt32
13456
    :ivar MonitoringQueueOverflowCount:
13457
    :vartype MonitoringQueueOverflowCount: UInt32
13458
    :ivar NextSequenceNumber:
13459
    :vartype NextSequenceNumber: UInt32
13460
    :ivar EventQueueOverFlowCount:
13461
    :vartype EventQueueOverFlowCount: UInt32
13462 1
    '''
13463
    def __init__(self, binary=None):
13464
        if binary is not None:
13465
            self._binary_init(binary)
13466
            self._freeze = True
13467
            return
13468
        self.SessionId = NodeId()
13469
        self.SubscriptionId = 0
13470
        self.Priority = 0
13471
        self.PublishingInterval = 0
13472
        self.MaxKeepAliveCount = 0
13473
        self.MaxLifetimeCount = 0
13474
        self.MaxNotificationsPerPublish = 0
13475
        self.PublishingEnabled = True
13476
        self.ModifyCount = 0
13477
        self.EnableCount = 0
13478
        self.DisableCount = 0
13479
        self.RepublishRequestCount = 0
13480
        self.RepublishMessageRequestCount = 0
13481
        self.RepublishMessageCount = 0
13482
        self.TransferRequestCount = 0
13483
        self.TransferredToAltClientCount = 0
13484
        self.TransferredToSameClientCount = 0
13485
        self.PublishRequestCount = 0
13486
        self.DataChangeNotificationsCount = 0
13487
        self.EventNotificationsCount = 0
13488
        self.NotificationsCount = 0
13489
        self.LatePublishRequestCount = 0
13490
        self.CurrentKeepAliveCount = 0
13491
        self.CurrentLifetimeCount = 0
13492
        self.UnacknowledgedMessageCount = 0
13493
        self.DiscardedMessageCount = 0
13494
        self.MonitoredItemCount = 0
13495
        self.DisabledMonitoredItemCount = 0
13496
        self.MonitoringQueueOverflowCount = 0
13497
        self.NextSequenceNumber = 0
13498
        self.EventQueueOverFlowCount = 0
13499
        self._freeze = True
13500 1
13501
    def to_binary(self):
13502
        packet = []
13503
        packet.append(self.SessionId.to_binary())
13504
        packet.append(uatype_UInt32.pack(self.SubscriptionId))
13505
        packet.append(uatype_Byte.pack(self.Priority))
13506
        packet.append(uatype_Double.pack(self.PublishingInterval))
13507
        packet.append(uatype_UInt32.pack(self.MaxKeepAliveCount))
13508
        packet.append(uatype_UInt32.pack(self.MaxLifetimeCount))
13509
        packet.append(uatype_UInt32.pack(self.MaxNotificationsPerPublish))
13510
        packet.append(uatype_Boolean.pack(self.PublishingEnabled))
13511
        packet.append(uatype_UInt32.pack(self.ModifyCount))
13512
        packet.append(uatype_UInt32.pack(self.EnableCount))
13513
        packet.append(uatype_UInt32.pack(self.DisableCount))
13514
        packet.append(uatype_UInt32.pack(self.RepublishRequestCount))
13515
        packet.append(uatype_UInt32.pack(self.RepublishMessageRequestCount))
13516
        packet.append(uatype_UInt32.pack(self.RepublishMessageCount))
13517
        packet.append(uatype_UInt32.pack(self.TransferRequestCount))
13518
        packet.append(uatype_UInt32.pack(self.TransferredToAltClientCount))
13519
        packet.append(uatype_UInt32.pack(self.TransferredToSameClientCount))
13520
        packet.append(uatype_UInt32.pack(self.PublishRequestCount))
13521
        packet.append(uatype_UInt32.pack(self.DataChangeNotificationsCount))
13522
        packet.append(uatype_UInt32.pack(self.EventNotificationsCount))
13523
        packet.append(uatype_UInt32.pack(self.NotificationsCount))
13524
        packet.append(uatype_UInt32.pack(self.LatePublishRequestCount))
13525
        packet.append(uatype_UInt32.pack(self.CurrentKeepAliveCount))
13526
        packet.append(uatype_UInt32.pack(self.CurrentLifetimeCount))
13527
        packet.append(uatype_UInt32.pack(self.UnacknowledgedMessageCount))
13528
        packet.append(uatype_UInt32.pack(self.DiscardedMessageCount))
13529
        packet.append(uatype_UInt32.pack(self.MonitoredItemCount))
13530
        packet.append(uatype_UInt32.pack(self.DisabledMonitoredItemCount))
13531
        packet.append(uatype_UInt32.pack(self.MonitoringQueueOverflowCount))
13532
        packet.append(uatype_UInt32.pack(self.NextSequenceNumber))
13533
        packet.append(uatype_UInt32.pack(self.EventQueueOverFlowCount))
13534
        return b''.join(packet)
13535 1
13536
    @staticmethod
13537
    def from_binary(data):
13538
        return SubscriptionDiagnosticsDataType(data)
13539 1
13540
    def _binary_init(self, data):
13541
        self.SessionId = NodeId.from_binary(data)
13542
        self.SubscriptionId = uatype_UInt32.unpack(data.read(4))[0]
13543
        self.Priority = uatype_Byte.unpack(data.read(1))[0]
13544
        self.PublishingInterval = uatype_Double.unpack(data.read(8))[0]
13545
        self.MaxKeepAliveCount = uatype_UInt32.unpack(data.read(4))[0]
13546
        self.MaxLifetimeCount = uatype_UInt32.unpack(data.read(4))[0]
13547
        self.MaxNotificationsPerPublish = uatype_UInt32.unpack(data.read(4))[0]
13548
        self.PublishingEnabled = uatype_Boolean.unpack(data.read(1))[0]
13549
        self.ModifyCount = uatype_UInt32.unpack(data.read(4))[0]
13550
        self.EnableCount = uatype_UInt32.unpack(data.read(4))[0]
13551
        self.DisableCount = uatype_UInt32.unpack(data.read(4))[0]
13552
        self.RepublishRequestCount = uatype_UInt32.unpack(data.read(4))[0]
13553
        self.RepublishMessageRequestCount = uatype_UInt32.unpack(data.read(4))[0]
13554
        self.RepublishMessageCount = uatype_UInt32.unpack(data.read(4))[0]
13555
        self.TransferRequestCount = uatype_UInt32.unpack(data.read(4))[0]
13556
        self.TransferredToAltClientCount = uatype_UInt32.unpack(data.read(4))[0]
13557
        self.TransferredToSameClientCount = uatype_UInt32.unpack(data.read(4))[0]
13558
        self.PublishRequestCount = uatype_UInt32.unpack(data.read(4))[0]
13559
        self.DataChangeNotificationsCount = uatype_UInt32.unpack(data.read(4))[0]
13560
        self.EventNotificationsCount = uatype_UInt32.unpack(data.read(4))[0]
13561
        self.NotificationsCount = uatype_UInt32.unpack(data.read(4))[0]
13562
        self.LatePublishRequestCount = uatype_UInt32.unpack(data.read(4))[0]
13563
        self.CurrentKeepAliveCount = uatype_UInt32.unpack(data.read(4))[0]
13564
        self.CurrentLifetimeCount = uatype_UInt32.unpack(data.read(4))[0]
13565
        self.UnacknowledgedMessageCount = uatype_UInt32.unpack(data.read(4))[0]
13566
        self.DiscardedMessageCount = uatype_UInt32.unpack(data.read(4))[0]
13567
        self.MonitoredItemCount = uatype_UInt32.unpack(data.read(4))[0]
13568
        self.DisabledMonitoredItemCount = uatype_UInt32.unpack(data.read(4))[0]
13569
        self.MonitoringQueueOverflowCount = uatype_UInt32.unpack(data.read(4))[0]
13570
        self.NextSequenceNumber = uatype_UInt32.unpack(data.read(4))[0]
13571
        self.EventQueueOverFlowCount = uatype_UInt32.unpack(data.read(4))[0]
13572 1
13573
    def __str__(self):
13574
        return 'SubscriptionDiagnosticsDataType(' + 'SessionId:' + str(self.SessionId) + ', ' + \
13575
               'SubscriptionId:' + str(self.SubscriptionId) + ', ' + \
13576
               'Priority:' + str(self.Priority) + ', ' + \
13577
               'PublishingInterval:' + str(self.PublishingInterval) + ', ' + \
13578
               'MaxKeepAliveCount:' + str(self.MaxKeepAliveCount) + ', ' + \
13579
               'MaxLifetimeCount:' + str(self.MaxLifetimeCount) + ', ' + \
13580
               'MaxNotificationsPerPublish:' + str(self.MaxNotificationsPerPublish) + ', ' + \
13581
               'PublishingEnabled:' + str(self.PublishingEnabled) + ', ' + \
13582
               'ModifyCount:' + str(self.ModifyCount) + ', ' + \
13583
               'EnableCount:' + str(self.EnableCount) + ', ' + \
13584
               'DisableCount:' + str(self.DisableCount) + ', ' + \
13585
               'RepublishRequestCount:' + str(self.RepublishRequestCount) + ', ' + \
13586
               'RepublishMessageRequestCount:' + str(self.RepublishMessageRequestCount) + ', ' + \
13587
               'RepublishMessageCount:' + str(self.RepublishMessageCount) + ', ' + \
13588
               'TransferRequestCount:' + str(self.TransferRequestCount) + ', ' + \
13589
               'TransferredToAltClientCount:' + str(self.TransferredToAltClientCount) + ', ' + \
13590
               'TransferredToSameClientCount:' + str(self.TransferredToSameClientCount) + ', ' + \
13591
               'PublishRequestCount:' + str(self.PublishRequestCount) + ', ' + \
13592
               'DataChangeNotificationsCount:' + str(self.DataChangeNotificationsCount) + ', ' + \
13593
               'EventNotificationsCount:' + str(self.EventNotificationsCount) + ', ' + \
13594
               'NotificationsCount:' + str(self.NotificationsCount) + ', ' + \
13595
               'LatePublishRequestCount:' + str(self.LatePublishRequestCount) + ', ' + \
13596
               'CurrentKeepAliveCount:' + str(self.CurrentKeepAliveCount) + ', ' + \
13597
               'CurrentLifetimeCount:' + str(self.CurrentLifetimeCount) + ', ' + \
13598
               'UnacknowledgedMessageCount:' + str(self.UnacknowledgedMessageCount) + ', ' + \
13599
               'DiscardedMessageCount:' + str(self.DiscardedMessageCount) + ', ' + \
13600
               'MonitoredItemCount:' + str(self.MonitoredItemCount) + ', ' + \
13601
               'DisabledMonitoredItemCount:' + str(self.DisabledMonitoredItemCount) + ', ' + \
13602
               'MonitoringQueueOverflowCount:' + str(self.MonitoringQueueOverflowCount) + ', ' + \
13603
               'NextSequenceNumber:' + str(self.NextSequenceNumber) + ', ' + \
13604
               'EventQueueOverFlowCount:' + str(self.EventQueueOverFlowCount) + ')'
13605 1
13606
    __repr__ = __str__
13607
13608 1
13609
class ModelChangeStructureDataType(FrozenClass):
13610
    '''
13611
    :ivar Affected:
13612
    :vartype Affected: NodeId
13613
    :ivar AffectedType:
13614
    :vartype AffectedType: NodeId
13615
    :ivar Verb:
13616
    :vartype Verb: Byte
13617 1
    '''
13618
    def __init__(self, binary=None):
13619
        if binary is not None:
13620
            self._binary_init(binary)
13621
            self._freeze = True
13622
            return
13623
        self.Affected = NodeId()
13624
        self.AffectedType = NodeId()
13625
        self.Verb = 0
13626
        self._freeze = True
13627 1
13628
    def to_binary(self):
13629
        packet = []
13630
        packet.append(self.Affected.to_binary())
13631
        packet.append(self.AffectedType.to_binary())
13632
        packet.append(uatype_Byte.pack(self.Verb))
13633
        return b''.join(packet)
13634 1
13635
    @staticmethod
13636
    def from_binary(data):
13637
        return ModelChangeStructureDataType(data)
13638 1
13639
    def _binary_init(self, data):
13640
        self.Affected = NodeId.from_binary(data)
13641
        self.AffectedType = NodeId.from_binary(data)
13642
        self.Verb = uatype_Byte.unpack(data.read(1))[0]
13643 1
13644
    def __str__(self):
13645
        return 'ModelChangeStructureDataType(' + 'Affected:' + str(self.Affected) + ', ' + \
13646
               'AffectedType:' + str(self.AffectedType) + ', ' + \
13647
               'Verb:' + str(self.Verb) + ')'
13648 1
13649
    __repr__ = __str__
13650
13651 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
13652
class SemanticChangeStructureDataType(FrozenClass):
13653
    '''
13654
    :ivar Affected:
13655
    :vartype Affected: NodeId
13656
    :ivar AffectedType:
13657
    :vartype AffectedType: NodeId
13658 1
    '''
13659
    def __init__(self, binary=None):
13660
        if binary is not None:
13661
            self._binary_init(binary)
13662
            self._freeze = True
13663
            return
13664
        self.Affected = NodeId()
13665
        self.AffectedType = NodeId()
13666
        self._freeze = True
13667 1
13668
    def to_binary(self):
13669
        packet = []
13670
        packet.append(self.Affected.to_binary())
13671
        packet.append(self.AffectedType.to_binary())
13672
        return b''.join(packet)
13673 1
13674
    @staticmethod
13675
    def from_binary(data):
13676
        return SemanticChangeStructureDataType(data)
13677 1
13678
    def _binary_init(self, data):
13679
        self.Affected = NodeId.from_binary(data)
13680
        self.AffectedType = NodeId.from_binary(data)
13681 1
13682
    def __str__(self):
13683
        return 'SemanticChangeStructureDataType(' + 'Affected:' + str(self.Affected) + ', ' + \
13684
               'AffectedType:' + str(self.AffectedType) + ')'
13685 1
13686
    __repr__ = __str__
13687
13688 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
13689
class Range(FrozenClass):
13690
    '''
13691
    :ivar Low:
13692
    :vartype Low: Double
13693
    :ivar High:
13694
    :vartype High: Double
13695 1
    '''
13696
    def __init__(self, binary=None):
13697
        if binary is not None:
13698
            self._binary_init(binary)
13699
            self._freeze = True
13700
            return
13701
        self.Low = 0
13702
        self.High = 0
13703
        self._freeze = True
13704 1
13705
    def to_binary(self):
13706
        packet = []
13707
        packet.append(uatype_Double.pack(self.Low))
13708
        packet.append(uatype_Double.pack(self.High))
13709
        return b''.join(packet)
13710 1
13711
    @staticmethod
13712
    def from_binary(data):
13713
        return Range(data)
13714 1
13715
    def _binary_init(self, data):
13716
        self.Low = uatype_Double.unpack(data.read(8))[0]
13717
        self.High = uatype_Double.unpack(data.read(8))[0]
13718 1
13719
    def __str__(self):
13720
        return 'Range(' + 'Low:' + str(self.Low) + ', ' + \
13721
               'High:' + str(self.High) + ')'
13722 1
13723
    __repr__ = __str__
13724
13725 1
13726
class EUInformation(FrozenClass):
13727
    '''
13728
    :ivar NamespaceUri:
13729
    :vartype NamespaceUri: String
13730
    :ivar UnitId:
13731
    :vartype UnitId: Int32
13732
    :ivar DisplayName:
13733
    :vartype DisplayName: LocalizedText
13734
    :ivar Description:
13735
    :vartype Description: LocalizedText
13736 1
    '''
13737
    def __init__(self, binary=None):
13738
        if binary is not None:
13739
            self._binary_init(binary)
13740
            self._freeze = True
13741
            return
13742
        self.NamespaceUri = None
13743
        self.UnitId = 0
13744
        self.DisplayName = LocalizedText()
13745
        self.Description = LocalizedText()
13746
        self._freeze = True
13747 1
13748
    def to_binary(self):
13749
        packet = []
13750
        packet.append(pack_string(self.NamespaceUri))
13751
        packet.append(uatype_Int32.pack(self.UnitId))
13752
        packet.append(self.DisplayName.to_binary())
13753
        packet.append(self.Description.to_binary())
13754
        return b''.join(packet)
13755 1
13756
    @staticmethod
13757
    def from_binary(data):
13758
        return EUInformation(data)
13759 1
13760
    def _binary_init(self, data):
13761
        self.NamespaceUri = unpack_string(data)
13762
        self.UnitId = uatype_Int32.unpack(data.read(4))[0]
13763
        self.DisplayName = LocalizedText.from_binary(data)
13764
        self.Description = LocalizedText.from_binary(data)
13765 1
13766
    def __str__(self):
13767
        return 'EUInformation(' + 'NamespaceUri:' + str(self.NamespaceUri) + ', ' + \
13768
               'UnitId:' + str(self.UnitId) + ', ' + \
13769
               'DisplayName:' + str(self.DisplayName) + ', ' + \
13770
               'Description:' + str(self.Description) + ')'
13771 1
13772
    __repr__ = __str__
13773
13774 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
13775
class ComplexNumberType(FrozenClass):
13776
    '''
13777
    :ivar Real:
13778
    :vartype Real: Float
13779
    :ivar Imaginary:
13780
    :vartype Imaginary: Float
13781 1
    '''
13782
    def __init__(self, binary=None):
13783
        if binary is not None:
13784
            self._binary_init(binary)
13785
            self._freeze = True
13786
            return
13787
        self.Real = 0
13788
        self.Imaginary = 0
13789
        self._freeze = True
13790 1
13791
    def to_binary(self):
13792
        packet = []
13793
        packet.append(uatype_Float.pack(self.Real))
13794
        packet.append(uatype_Float.pack(self.Imaginary))
13795
        return b''.join(packet)
13796 1
13797
    @staticmethod
13798
    def from_binary(data):
13799
        return ComplexNumberType(data)
13800 1
13801
    def _binary_init(self, data):
13802
        self.Real = uatype_Float.unpack(data.read(4))[0]
13803
        self.Imaginary = uatype_Float.unpack(data.read(4))[0]
13804 1
13805
    def __str__(self):
13806
        return 'ComplexNumberType(' + 'Real:' + str(self.Real) + ', ' + \
13807
               'Imaginary:' + str(self.Imaginary) + ')'
13808 1
13809
    __repr__ = __str__
13810
13811 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
13812
class DoubleComplexNumberType(FrozenClass):
13813
    '''
13814
    :ivar Real:
13815
    :vartype Real: Double
13816
    :ivar Imaginary:
13817
    :vartype Imaginary: Double
13818 1
    '''
13819
    def __init__(self, binary=None):
13820
        if binary is not None:
13821
            self._binary_init(binary)
13822
            self._freeze = True
13823
            return
13824
        self.Real = 0
13825
        self.Imaginary = 0
13826
        self._freeze = True
13827 1
13828
    def to_binary(self):
13829
        packet = []
13830
        packet.append(uatype_Double.pack(self.Real))
13831
        packet.append(uatype_Double.pack(self.Imaginary))
13832
        return b''.join(packet)
13833 1
13834
    @staticmethod
13835
    def from_binary(data):
13836
        return DoubleComplexNumberType(data)
13837 1
13838
    def _binary_init(self, data):
13839
        self.Real = uatype_Double.unpack(data.read(8))[0]
13840
        self.Imaginary = uatype_Double.unpack(data.read(8))[0]
13841 1
13842
    def __str__(self):
13843
        return 'DoubleComplexNumberType(' + 'Real:' + str(self.Real) + ', ' + \
13844
               'Imaginary:' + str(self.Imaginary) + ')'
13845 1
13846
    __repr__ = __str__
13847
13848 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
13849
class AxisInformation(FrozenClass):
13850
    '''
13851
    :ivar EngineeringUnits:
13852
    :vartype EngineeringUnits: EUInformation
13853
    :ivar EURange:
13854
    :vartype EURange: Range
13855
    :ivar Title:
13856
    :vartype Title: LocalizedText
13857
    :ivar AxisScaleType:
13858
    :vartype AxisScaleType: AxisScaleEnumeration
13859
    :ivar AxisSteps:
13860
    :vartype AxisSteps: Double
13861 1
    '''
13862
    def __init__(self, binary=None):
13863
        if binary is not None:
13864
            self._binary_init(binary)
13865
            self._freeze = True
13866
            return
13867
        self.EngineeringUnits = EUInformation()
13868
        self.EURange = Range()
13869
        self.Title = LocalizedText()
13870
        self.AxisScaleType = AxisScaleEnumeration(0)
13871
        self.AxisSteps = []
13872
        self._freeze = True
13873 1
13874
    def to_binary(self):
13875
        packet = []
13876
        packet.append(self.EngineeringUnits.to_binary())
13877
        packet.append(self.EURange.to_binary())
13878
        packet.append(self.Title.to_binary())
13879
        packet.append(uatype_UInt32.pack(self.AxisScaleType.value))
13880
        packet.append(uatype_Int32.pack(len(self.AxisSteps)))
13881
        for fieldname in self.AxisSteps:
13882
            packet.append(uatype_Double.pack(fieldname))
13883
        return b''.join(packet)
13884 1
13885
    @staticmethod
13886
    def from_binary(data):
13887
        return AxisInformation(data)
13888 1
13889
    def _binary_init(self, data):
13890
        self.EngineeringUnits = EUInformation.from_binary(data)
13891
        self.EURange = Range.from_binary(data)
13892
        self.Title = LocalizedText.from_binary(data)
13893
        self.AxisScaleType = AxisScaleEnumeration(uatype_UInt32.unpack(data.read(4))[0])
13894
        self.AxisSteps = unpack_uatype_array('Double', data)
13895 1
13896
    def __str__(self):
13897
        return 'AxisInformation(' + 'EngineeringUnits:' + str(self.EngineeringUnits) + ', ' + \
13898
               'EURange:' + str(self.EURange) + ', ' + \
13899
               'Title:' + str(self.Title) + ', ' + \
13900
               'AxisScaleType:' + str(self.AxisScaleType) + ', ' + \
13901
               'AxisSteps:' + str(self.AxisSteps) + ')'
13902 1
13903
    __repr__ = __str__
13904
13905 1 View Code Duplication
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
13906
class XVType(FrozenClass):
13907
    '''
13908
    :ivar X:
13909
    :vartype X: Double
13910
    :ivar Value:
13911
    :vartype Value: Float
13912 1
    '''
13913
    def __init__(self, binary=None):
13914
        if binary is not None:
13915
            self._binary_init(binary)
13916
            self._freeze = True
13917
            return
13918
        self.X = 0
13919
        self.Value = 0
13920
        self._freeze = True
13921 1
13922
    def to_binary(self):
13923
        packet = []
13924
        packet.append(uatype_Double.pack(self.X))
13925
        packet.append(uatype_Float.pack(self.Value))
13926
        return b''.join(packet)
13927 1
13928
    @staticmethod
13929
    def from_binary(data):
13930
        return XVType(data)
13931 1
13932
    def _binary_init(self, data):
13933
        self.X = uatype_Double.unpack(data.read(8))[0]
13934
        self.Value = uatype_Float.unpack(data.read(4))[0]
13935 1
13936
    def __str__(self):
13937
        return 'XVType(' + 'X:' + str(self.X) + ', ' + \
13938
               'Value:' + str(self.Value) + ')'
13939 1
13940
    __repr__ = __str__
13941
13942 1
13943
class ProgramDiagnosticDataType(FrozenClass):
13944
    '''
13945
    :ivar CreateSessionId:
13946
    :vartype CreateSessionId: NodeId
13947
    :ivar CreateClientName:
13948
    :vartype CreateClientName: String
13949
    :ivar InvocationCreationTime:
13950
    :vartype InvocationCreationTime: DateTime
13951
    :ivar LastTransitionTime:
13952
    :vartype LastTransitionTime: DateTime
13953
    :ivar LastMethodCall:
13954
    :vartype LastMethodCall: String
13955
    :ivar LastMethodSessionId:
13956
    :vartype LastMethodSessionId: NodeId
13957
    :ivar LastMethodInputArguments:
13958
    :vartype LastMethodInputArguments: Argument
13959
    :ivar LastMethodOutputArguments:
13960
    :vartype LastMethodOutputArguments: Argument
13961
    :ivar LastMethodCallTime:
13962
    :vartype LastMethodCallTime: DateTime
13963
    :ivar LastMethodReturnStatus:
13964
    :vartype LastMethodReturnStatus: StatusResult
13965 1
    '''
13966
    def __init__(self, binary=None):
13967
        if binary is not None:
13968
            self._binary_init(binary)
13969
            self._freeze = True
13970
            return
13971
        self.CreateSessionId = NodeId()
13972
        self.CreateClientName = None
13973
        self.InvocationCreationTime = datetime.now()
13974
        self.LastTransitionTime = datetime.now()
13975
        self.LastMethodCall = None
13976
        self.LastMethodSessionId = NodeId()
13977
        self.LastMethodInputArguments = []
13978
        self.LastMethodOutputArguments = []
13979
        self.LastMethodCallTime = datetime.now()
13980
        self.LastMethodReturnStatus = StatusResult()
13981
        self._freeze = True
13982 1
13983
    def to_binary(self):
13984
        packet = []
13985
        packet.append(self.CreateSessionId.to_binary())
13986
        packet.append(pack_string(self.CreateClientName))
13987
        packet.append(pack_datetime(self.InvocationCreationTime))
13988
        packet.append(pack_datetime(self.LastTransitionTime))
13989
        packet.append(pack_string(self.LastMethodCall))
13990
        packet.append(self.LastMethodSessionId.to_binary())
13991
        packet.append(uatype_Int32.pack(len(self.LastMethodInputArguments)))
13992
        for fieldname in self.LastMethodInputArguments:
13993
            packet.append(fieldname.to_binary())
13994
        packet.append(uatype_Int32.pack(len(self.LastMethodOutputArguments)))
13995
        for fieldname in self.LastMethodOutputArguments:
13996
            packet.append(fieldname.to_binary())
13997
        packet.append(pack_datetime(self.LastMethodCallTime))
13998
        packet.append(self.LastMethodReturnStatus.to_binary())
13999
        return b''.join(packet)
14000 1
14001
    @staticmethod
14002
    def from_binary(data):
14003
        return ProgramDiagnosticDataType(data)
14004 1
14005
    def _binary_init(self, data):
14006
        self.CreateSessionId = NodeId.from_binary(data)
14007
        self.CreateClientName = unpack_string(data)
14008
        self.InvocationCreationTime = unpack_datetime(data)
14009
        self.LastTransitionTime = unpack_datetime(data)
14010
        self.LastMethodCall = unpack_string(data)
14011
        self.LastMethodSessionId = NodeId.from_binary(data)
14012
        length = uatype_Int32.unpack(data.read(4))[0]
14013
        array = []
14014
        if length != -1:
14015
            for _ in range(0, length):
14016
                array.append(Argument.from_binary(data))
14017
        self.LastMethodInputArguments = array
14018
        length = uatype_Int32.unpack(data.read(4))[0]
14019
        array = []
14020
        if length != -1:
14021
            for _ in range(0, length):
14022
                array.append(Argument.from_binary(data))
14023
        self.LastMethodOutputArguments = array
14024
        self.LastMethodCallTime = unpack_datetime(data)
14025
        self.LastMethodReturnStatus = StatusResult.from_binary(data)
14026 1
14027
    def __str__(self):
14028
        return 'ProgramDiagnosticDataType(' + 'CreateSessionId:' + str(self.CreateSessionId) + ', ' + \
14029
               'CreateClientName:' + str(self.CreateClientName) + ', ' + \
14030
               'InvocationCreationTime:' + str(self.InvocationCreationTime) + ', ' + \
14031
               'LastTransitionTime:' + str(self.LastTransitionTime) + ', ' + \
14032
               'LastMethodCall:' + str(self.LastMethodCall) + ', ' + \
14033
               'LastMethodSessionId:' + str(self.LastMethodSessionId) + ', ' + \
14034
               'LastMethodInputArguments:' + str(self.LastMethodInputArguments) + ', ' + \
14035
               'LastMethodOutputArguments:' + str(self.LastMethodOutputArguments) + ', ' + \
14036
               'LastMethodCallTime:' + str(self.LastMethodCallTime) + ', ' + \
14037
               'LastMethodReturnStatus:' + str(self.LastMethodReturnStatus) + ')'
14038 1
14039
    __repr__ = __str__
14040
14041 1
14042
class Annotation(FrozenClass):
14043
    '''
14044
    :ivar Message:
14045
    :vartype Message: String
14046
    :ivar UserName:
14047
    :vartype UserName: String
14048
    :ivar AnnotationTime:
14049
    :vartype AnnotationTime: DateTime
14050 1
    '''
14051
    def __init__(self, binary=None):
14052
        if binary is not None:
14053
            self._binary_init(binary)
14054
            self._freeze = True
14055
            return
14056
        self.Message = None
14057
        self.UserName = None
14058
        self.AnnotationTime = datetime.now()
14059
        self._freeze = True
14060 1
14061
    def to_binary(self):
14062
        packet = []
14063
        packet.append(pack_string(self.Message))
14064
        packet.append(pack_string(self.UserName))
14065
        packet.append(pack_datetime(self.AnnotationTime))
14066
        return b''.join(packet)
14067 1
14068
    @staticmethod
14069
    def from_binary(data):
14070
        return Annotation(data)
14071 1
14072
    def _binary_init(self, data):
14073
        self.Message = unpack_string(data)
14074
        self.UserName = unpack_string(data)
14075
        self.AnnotationTime = unpack_datetime(data)
14076 1
14077
    def __str__(self):
14078
        return 'Annotation(' + 'Message:' + str(self.Message) + ', ' + \
14079
               'UserName:' + str(self.UserName) + ', ' + \
14080
               'AnnotationTime:' + str(self.AnnotationTime) + ')'
14081 1
14082
    __repr__ = __str__
14083
14084 1
14085
ExtensionClasses = {
14086
    ObjectIds.TrustListDataType_Encoding_DefaultBinary: TrustListDataType,
14087
    ObjectIds.Argument_Encoding_DefaultBinary: Argument,
14088
    ObjectIds.EnumValueType_Encoding_DefaultBinary: EnumValueType,
14089
    ObjectIds.OptionSet_Encoding_DefaultBinary: OptionSet,
14090
    ObjectIds.Union_Encoding_DefaultBinary: Union,
14091
    ObjectIds.TimeZoneDataType_Encoding_DefaultBinary: TimeZoneDataType,
14092
    ObjectIds.ApplicationDescription_Encoding_DefaultBinary: ApplicationDescription,
14093
    ObjectIds.RequestHeader_Encoding_DefaultBinary: RequestHeader,
14094
    ObjectIds.ResponseHeader_Encoding_DefaultBinary: ResponseHeader,
14095
    ObjectIds.ServiceFault_Encoding_DefaultBinary: ServiceFault,
14096
    ObjectIds.FindServersRequest_Encoding_DefaultBinary: FindServersRequest,
14097
    ObjectIds.FindServersResponse_Encoding_DefaultBinary: FindServersResponse,
14098
    ObjectIds.ServerOnNetwork_Encoding_DefaultBinary: ServerOnNetwork,
14099
    ObjectIds.FindServersOnNetworkRequest_Encoding_DefaultBinary: FindServersOnNetworkRequest,
14100
    ObjectIds.FindServersOnNetworkResponse_Encoding_DefaultBinary: FindServersOnNetworkResponse,
14101
    ObjectIds.UserTokenPolicy_Encoding_DefaultBinary: UserTokenPolicy,
14102
    ObjectIds.EndpointDescription_Encoding_DefaultBinary: EndpointDescription,
14103
    ObjectIds.GetEndpointsRequest_Encoding_DefaultBinary: GetEndpointsRequest,
14104
    ObjectIds.GetEndpointsResponse_Encoding_DefaultBinary: GetEndpointsResponse,
14105
    ObjectIds.RegisteredServer_Encoding_DefaultBinary: RegisteredServer,
14106
    ObjectIds.RegisterServerRequest_Encoding_DefaultBinary: RegisterServerRequest,
14107
    ObjectIds.RegisterServerResponse_Encoding_DefaultBinary: RegisterServerResponse,
14108
    ObjectIds.DiscoveryConfiguration_Encoding_DefaultBinary: DiscoveryConfiguration,
14109
    ObjectIds.MdnsDiscoveryConfiguration_Encoding_DefaultBinary: MdnsDiscoveryConfiguration,
14110
    ObjectIds.RegisterServer2Request_Encoding_DefaultBinary: RegisterServer2Request,
14111
    ObjectIds.RegisterServer2Response_Encoding_DefaultBinary: RegisterServer2Response,
14112
    ObjectIds.ChannelSecurityToken_Encoding_DefaultBinary: ChannelSecurityToken,
14113
    ObjectIds.OpenSecureChannelRequest_Encoding_DefaultBinary: OpenSecureChannelRequest,
14114
    ObjectIds.OpenSecureChannelResponse_Encoding_DefaultBinary: OpenSecureChannelResponse,
14115
    ObjectIds.CloseSecureChannelRequest_Encoding_DefaultBinary: CloseSecureChannelRequest,
14116
    ObjectIds.CloseSecureChannelResponse_Encoding_DefaultBinary: CloseSecureChannelResponse,
14117
    ObjectIds.SignedSoftwareCertificate_Encoding_DefaultBinary: SignedSoftwareCertificate,
14118
    ObjectIds.SignatureData_Encoding_DefaultBinary: SignatureData,
14119
    ObjectIds.CreateSessionRequest_Encoding_DefaultBinary: CreateSessionRequest,
14120
    ObjectIds.CreateSessionResponse_Encoding_DefaultBinary: CreateSessionResponse,
14121
    ObjectIds.UserIdentityToken_Encoding_DefaultBinary: UserIdentityToken,
14122
    ObjectIds.AnonymousIdentityToken_Encoding_DefaultBinary: AnonymousIdentityToken,
14123
    ObjectIds.UserNameIdentityToken_Encoding_DefaultBinary: UserNameIdentityToken,
14124
    ObjectIds.X509IdentityToken_Encoding_DefaultBinary: X509IdentityToken,
14125
    ObjectIds.KerberosIdentityToken_Encoding_DefaultBinary: KerberosIdentityToken,
14126
    ObjectIds.IssuedIdentityToken_Encoding_DefaultBinary: IssuedIdentityToken,
14127
    ObjectIds.ActivateSessionRequest_Encoding_DefaultBinary: ActivateSessionRequest,
14128
    ObjectIds.ActivateSessionResponse_Encoding_DefaultBinary: ActivateSessionResponse,
14129
    ObjectIds.CloseSessionRequest_Encoding_DefaultBinary: CloseSessionRequest,
14130
    ObjectIds.CloseSessionResponse_Encoding_DefaultBinary: CloseSessionResponse,
14131
    ObjectIds.CancelRequest_Encoding_DefaultBinary: CancelRequest,
14132
    ObjectIds.CancelResponse_Encoding_DefaultBinary: CancelResponse,
14133
    ObjectIds.NodeAttributes_Encoding_DefaultBinary: NodeAttributes,
14134
    ObjectIds.ObjectAttributes_Encoding_DefaultBinary: ObjectAttributes,
14135
    ObjectIds.VariableAttributes_Encoding_DefaultBinary: VariableAttributes,
14136
    ObjectIds.MethodAttributes_Encoding_DefaultBinary: MethodAttributes,
14137
    ObjectIds.ObjectTypeAttributes_Encoding_DefaultBinary: ObjectTypeAttributes,
14138
    ObjectIds.VariableTypeAttributes_Encoding_DefaultBinary: VariableTypeAttributes,
14139
    ObjectIds.ReferenceTypeAttributes_Encoding_DefaultBinary: ReferenceTypeAttributes,
14140
    ObjectIds.DataTypeAttributes_Encoding_DefaultBinary: DataTypeAttributes,
14141
    ObjectIds.ViewAttributes_Encoding_DefaultBinary: ViewAttributes,
14142
    ObjectIds.AddNodesItem_Encoding_DefaultBinary: AddNodesItem,
14143
    ObjectIds.AddNodesResult_Encoding_DefaultBinary: AddNodesResult,
14144
    ObjectIds.AddNodesRequest_Encoding_DefaultBinary: AddNodesRequest,
14145
    ObjectIds.AddNodesResponse_Encoding_DefaultBinary: AddNodesResponse,
14146
    ObjectIds.AddReferencesItem_Encoding_DefaultBinary: AddReferencesItem,
14147
    ObjectIds.AddReferencesRequest_Encoding_DefaultBinary: AddReferencesRequest,
14148
    ObjectIds.AddReferencesResponse_Encoding_DefaultBinary: AddReferencesResponse,
14149
    ObjectIds.DeleteNodesItem_Encoding_DefaultBinary: DeleteNodesItem,
14150
    ObjectIds.DeleteNodesRequest_Encoding_DefaultBinary: DeleteNodesRequest,
14151
    ObjectIds.DeleteNodesResponse_Encoding_DefaultBinary: DeleteNodesResponse,
14152
    ObjectIds.DeleteReferencesItem_Encoding_DefaultBinary: DeleteReferencesItem,
14153
    ObjectIds.DeleteReferencesRequest_Encoding_DefaultBinary: DeleteReferencesRequest,
14154
    ObjectIds.DeleteReferencesResponse_Encoding_DefaultBinary: DeleteReferencesResponse,
14155
    ObjectIds.ViewDescription_Encoding_DefaultBinary: ViewDescription,
14156
    ObjectIds.BrowseDescription_Encoding_DefaultBinary: BrowseDescription,
14157
    ObjectIds.ReferenceDescription_Encoding_DefaultBinary: ReferenceDescription,
14158
    ObjectIds.BrowseResult_Encoding_DefaultBinary: BrowseResult,
14159
    ObjectIds.BrowseRequest_Encoding_DefaultBinary: BrowseRequest,
14160
    ObjectIds.BrowseResponse_Encoding_DefaultBinary: BrowseResponse,
14161
    ObjectIds.BrowseNextRequest_Encoding_DefaultBinary: BrowseNextRequest,
14162
    ObjectIds.BrowseNextResponse_Encoding_DefaultBinary: BrowseNextResponse,
14163
    ObjectIds.RelativePathElement_Encoding_DefaultBinary: RelativePathElement,
14164
    ObjectIds.RelativePath_Encoding_DefaultBinary: RelativePath,
14165
    ObjectIds.BrowsePath_Encoding_DefaultBinary: BrowsePath,
14166
    ObjectIds.BrowsePathTarget_Encoding_DefaultBinary: BrowsePathTarget,
14167
    ObjectIds.BrowsePathResult_Encoding_DefaultBinary: BrowsePathResult,
14168
    ObjectIds.TranslateBrowsePathsToNodeIdsRequest_Encoding_DefaultBinary: TranslateBrowsePathsToNodeIdsRequest,
14169
    ObjectIds.TranslateBrowsePathsToNodeIdsResponse_Encoding_DefaultBinary: TranslateBrowsePathsToNodeIdsResponse,
14170
    ObjectIds.RegisterNodesRequest_Encoding_DefaultBinary: RegisterNodesRequest,
14171
    ObjectIds.RegisterNodesResponse_Encoding_DefaultBinary: RegisterNodesResponse,
14172
    ObjectIds.UnregisterNodesRequest_Encoding_DefaultBinary: UnregisterNodesRequest,
14173
    ObjectIds.UnregisterNodesResponse_Encoding_DefaultBinary: UnregisterNodesResponse,
14174
    ObjectIds.EndpointConfiguration_Encoding_DefaultBinary: EndpointConfiguration,
14175
    ObjectIds.SupportedProfile_Encoding_DefaultBinary: SupportedProfile,
14176
    ObjectIds.SoftwareCertificate_Encoding_DefaultBinary: SoftwareCertificate,
14177
    ObjectIds.QueryDataDescription_Encoding_DefaultBinary: QueryDataDescription,
14178
    ObjectIds.NodeTypeDescription_Encoding_DefaultBinary: NodeTypeDescription,
14179
    ObjectIds.QueryDataSet_Encoding_DefaultBinary: QueryDataSet,
14180
    ObjectIds.NodeReference_Encoding_DefaultBinary: NodeReference,
14181
    ObjectIds.ContentFilterElement_Encoding_DefaultBinary: ContentFilterElement,
14182
    ObjectIds.ContentFilter_Encoding_DefaultBinary: ContentFilter,
14183
    ObjectIds.ElementOperand_Encoding_DefaultBinary: ElementOperand,
14184
    ObjectIds.LiteralOperand_Encoding_DefaultBinary: LiteralOperand,
14185
    ObjectIds.AttributeOperand_Encoding_DefaultBinary: AttributeOperand,
14186
    ObjectIds.SimpleAttributeOperand_Encoding_DefaultBinary: SimpleAttributeOperand,
14187
    ObjectIds.ContentFilterElementResult_Encoding_DefaultBinary: ContentFilterElementResult,
14188
    ObjectIds.ContentFilterResult_Encoding_DefaultBinary: ContentFilterResult,
14189
    ObjectIds.ParsingResult_Encoding_DefaultBinary: ParsingResult,
14190
    ObjectIds.QueryFirstRequest_Encoding_DefaultBinary: QueryFirstRequest,
14191
    ObjectIds.QueryFirstResponse_Encoding_DefaultBinary: QueryFirstResponse,
14192
    ObjectIds.QueryNextRequest_Encoding_DefaultBinary: QueryNextRequest,
14193
    ObjectIds.QueryNextResponse_Encoding_DefaultBinary: QueryNextResponse,
14194
    ObjectIds.ReadValueId_Encoding_DefaultBinary: ReadValueId,
14195
    ObjectIds.ReadRequest_Encoding_DefaultBinary: ReadRequest,
14196
    ObjectIds.ReadResponse_Encoding_DefaultBinary: ReadResponse,
14197
    ObjectIds.HistoryReadValueId_Encoding_DefaultBinary: HistoryReadValueId,
14198
    ObjectIds.HistoryReadResult_Encoding_DefaultBinary: HistoryReadResult,
14199
    ObjectIds.HistoryReadDetails_Encoding_DefaultBinary: HistoryReadDetails,
14200
    ObjectIds.ReadEventDetails_Encoding_DefaultBinary: ReadEventDetails,
14201
    ObjectIds.ReadRawModifiedDetails_Encoding_DefaultBinary: ReadRawModifiedDetails,
14202
    ObjectIds.ReadProcessedDetails_Encoding_DefaultBinary: ReadProcessedDetails,
14203
    ObjectIds.ReadAtTimeDetails_Encoding_DefaultBinary: ReadAtTimeDetails,
14204
    ObjectIds.HistoryData_Encoding_DefaultBinary: HistoryData,
14205
    ObjectIds.ModificationInfo_Encoding_DefaultBinary: ModificationInfo,
14206
    ObjectIds.HistoryModifiedData_Encoding_DefaultBinary: HistoryModifiedData,
14207
    ObjectIds.HistoryEvent_Encoding_DefaultBinary: HistoryEvent,
14208
    ObjectIds.HistoryReadRequest_Encoding_DefaultBinary: HistoryReadRequest,
14209
    ObjectIds.HistoryReadResponse_Encoding_DefaultBinary: HistoryReadResponse,
14210
    ObjectIds.WriteValue_Encoding_DefaultBinary: WriteValue,
14211
    ObjectIds.WriteRequest_Encoding_DefaultBinary: WriteRequest,
14212
    ObjectIds.WriteResponse_Encoding_DefaultBinary: WriteResponse,
14213
    ObjectIds.HistoryUpdateDetails_Encoding_DefaultBinary: HistoryUpdateDetails,
14214
    ObjectIds.UpdateDataDetails_Encoding_DefaultBinary: UpdateDataDetails,
14215
    ObjectIds.UpdateStructureDataDetails_Encoding_DefaultBinary: UpdateStructureDataDetails,
14216
    ObjectIds.UpdateEventDetails_Encoding_DefaultBinary: UpdateEventDetails,
14217
    ObjectIds.DeleteRawModifiedDetails_Encoding_DefaultBinary: DeleteRawModifiedDetails,
14218
    ObjectIds.DeleteAtTimeDetails_Encoding_DefaultBinary: DeleteAtTimeDetails,
14219
    ObjectIds.DeleteEventDetails_Encoding_DefaultBinary: DeleteEventDetails,
14220
    ObjectIds.HistoryUpdateResult_Encoding_DefaultBinary: HistoryUpdateResult,
14221
    ObjectIds.HistoryUpdateRequest_Encoding_DefaultBinary: HistoryUpdateRequest,
14222
    ObjectIds.HistoryUpdateResponse_Encoding_DefaultBinary: HistoryUpdateResponse,
14223
    ObjectIds.CallMethodRequest_Encoding_DefaultBinary: CallMethodRequest,
14224
    ObjectIds.CallMethodResult_Encoding_DefaultBinary: CallMethodResult,
14225
    ObjectIds.CallRequest_Encoding_DefaultBinary: CallRequest,
14226
    ObjectIds.CallResponse_Encoding_DefaultBinary: CallResponse,
14227
    ObjectIds.MonitoringFilter_Encoding_DefaultBinary: MonitoringFilter,
14228
    ObjectIds.DataChangeFilter_Encoding_DefaultBinary: DataChangeFilter,
14229
    ObjectIds.EventFilter_Encoding_DefaultBinary: EventFilter,
14230
    ObjectIds.AggregateConfiguration_Encoding_DefaultBinary: AggregateConfiguration,
14231
    ObjectIds.AggregateFilter_Encoding_DefaultBinary: AggregateFilter,
14232
    ObjectIds.MonitoringFilterResult_Encoding_DefaultBinary: MonitoringFilterResult,
14233
    ObjectIds.EventFilterResult_Encoding_DefaultBinary: EventFilterResult,
14234
    ObjectIds.AggregateFilterResult_Encoding_DefaultBinary: AggregateFilterResult,
14235
    ObjectIds.MonitoringParameters_Encoding_DefaultBinary: MonitoringParameters,
14236
    ObjectIds.MonitoredItemCreateRequest_Encoding_DefaultBinary: MonitoredItemCreateRequest,
14237
    ObjectIds.MonitoredItemCreateResult_Encoding_DefaultBinary: MonitoredItemCreateResult,
14238
    ObjectIds.CreateMonitoredItemsRequest_Encoding_DefaultBinary: CreateMonitoredItemsRequest,
14239
    ObjectIds.CreateMonitoredItemsResponse_Encoding_DefaultBinary: CreateMonitoredItemsResponse,
14240
    ObjectIds.MonitoredItemModifyRequest_Encoding_DefaultBinary: MonitoredItemModifyRequest,
14241
    ObjectIds.MonitoredItemModifyResult_Encoding_DefaultBinary: MonitoredItemModifyResult,
14242
    ObjectIds.ModifyMonitoredItemsRequest_Encoding_DefaultBinary: ModifyMonitoredItemsRequest,
14243
    ObjectIds.ModifyMonitoredItemsResponse_Encoding_DefaultBinary: ModifyMonitoredItemsResponse,
14244
    ObjectIds.SetMonitoringModeRequest_Encoding_DefaultBinary: SetMonitoringModeRequest,
14245
    ObjectIds.SetMonitoringModeResponse_Encoding_DefaultBinary: SetMonitoringModeResponse,
14246
    ObjectIds.SetTriggeringRequest_Encoding_DefaultBinary: SetTriggeringRequest,
14247
    ObjectIds.SetTriggeringResponse_Encoding_DefaultBinary: SetTriggeringResponse,
14248
    ObjectIds.DeleteMonitoredItemsRequest_Encoding_DefaultBinary: DeleteMonitoredItemsRequest,
14249
    ObjectIds.DeleteMonitoredItemsResponse_Encoding_DefaultBinary: DeleteMonitoredItemsResponse,
14250
    ObjectIds.CreateSubscriptionRequest_Encoding_DefaultBinary: CreateSubscriptionRequest,
14251
    ObjectIds.CreateSubscriptionResponse_Encoding_DefaultBinary: CreateSubscriptionResponse,
14252
    ObjectIds.ModifySubscriptionRequest_Encoding_DefaultBinary: ModifySubscriptionRequest,
14253
    ObjectIds.ModifySubscriptionResponse_Encoding_DefaultBinary: ModifySubscriptionResponse,
14254
    ObjectIds.SetPublishingModeRequest_Encoding_DefaultBinary: SetPublishingModeRequest,
14255
    ObjectIds.SetPublishingModeResponse_Encoding_DefaultBinary: SetPublishingModeResponse,
14256
    ObjectIds.NotificationMessage_Encoding_DefaultBinary: NotificationMessage,
14257
    ObjectIds.NotificationData_Encoding_DefaultBinary: NotificationData,
14258
    ObjectIds.DataChangeNotification_Encoding_DefaultBinary: DataChangeNotification,
14259
    ObjectIds.MonitoredItemNotification_Encoding_DefaultBinary: MonitoredItemNotification,
14260
    ObjectIds.EventNotificationList_Encoding_DefaultBinary: EventNotificationList,
14261
    ObjectIds.EventFieldList_Encoding_DefaultBinary: EventFieldList,
14262
    ObjectIds.HistoryEventFieldList_Encoding_DefaultBinary: HistoryEventFieldList,
14263
    ObjectIds.StatusChangeNotification_Encoding_DefaultBinary: StatusChangeNotification,
14264
    ObjectIds.SubscriptionAcknowledgement_Encoding_DefaultBinary: SubscriptionAcknowledgement,
14265
    ObjectIds.PublishRequest_Encoding_DefaultBinary: PublishRequest,
14266
    ObjectIds.PublishResponse_Encoding_DefaultBinary: PublishResponse,
14267
    ObjectIds.RepublishRequest_Encoding_DefaultBinary: RepublishRequest,
14268
    ObjectIds.RepublishResponse_Encoding_DefaultBinary: RepublishResponse,
14269
    ObjectIds.TransferResult_Encoding_DefaultBinary: TransferResult,
14270
    ObjectIds.TransferSubscriptionsRequest_Encoding_DefaultBinary: TransferSubscriptionsRequest,
14271
    ObjectIds.TransferSubscriptionsResponse_Encoding_DefaultBinary: TransferSubscriptionsResponse,
14272
    ObjectIds.DeleteSubscriptionsRequest_Encoding_DefaultBinary: DeleteSubscriptionsRequest,
14273
    ObjectIds.DeleteSubscriptionsResponse_Encoding_DefaultBinary: DeleteSubscriptionsResponse,
14274
    ObjectIds.BuildInfo_Encoding_DefaultBinary: BuildInfo,
14275
    ObjectIds.RedundantServerDataType_Encoding_DefaultBinary: RedundantServerDataType,
14276
    ObjectIds.EndpointUrlListDataType_Encoding_DefaultBinary: EndpointUrlListDataType,
14277
    ObjectIds.NetworkGroupDataType_Encoding_DefaultBinary: NetworkGroupDataType,
14278
    ObjectIds.SamplingIntervalDiagnosticsDataType_Encoding_DefaultBinary: SamplingIntervalDiagnosticsDataType,
14279
    ObjectIds.ServerDiagnosticsSummaryDataType_Encoding_DefaultBinary: ServerDiagnosticsSummaryDataType,
14280
    ObjectIds.ServerStatusDataType_Encoding_DefaultBinary: ServerStatusDataType,
14281
    ObjectIds.SessionDiagnosticsDataType_Encoding_DefaultBinary: SessionDiagnosticsDataType,
14282
    ObjectIds.SessionSecurityDiagnosticsDataType_Encoding_DefaultBinary: SessionSecurityDiagnosticsDataType,
14283
    ObjectIds.ServiceCounterDataType_Encoding_DefaultBinary: ServiceCounterDataType,
14284
    ObjectIds.StatusResult_Encoding_DefaultBinary: StatusResult,
14285
    ObjectIds.SubscriptionDiagnosticsDataType_Encoding_DefaultBinary: SubscriptionDiagnosticsDataType,
14286
    ObjectIds.ModelChangeStructureDataType_Encoding_DefaultBinary: ModelChangeStructureDataType,
14287
    ObjectIds.SemanticChangeStructureDataType_Encoding_DefaultBinary: SemanticChangeStructureDataType,
14288
    ObjectIds.Range_Encoding_DefaultBinary: Range,
14289
    ObjectIds.EUInformation_Encoding_DefaultBinary: EUInformation,
14290
    ObjectIds.ComplexNumberType_Encoding_DefaultBinary: ComplexNumberType,
14291
    ObjectIds.DoubleComplexNumberType_Encoding_DefaultBinary: DoubleComplexNumberType,
14292
    ObjectIds.AxisInformation_Encoding_DefaultBinary: AxisInformation,
14293
    ObjectIds.XVType_Encoding_DefaultBinary: XVType,
14294
    ObjectIds.ProgramDiagnosticDataType_Encoding_DefaultBinary: ProgramDiagnosticDataType,
14295
    ObjectIds.Annotation_Encoding_DefaultBinary: Annotation,
14296
}
14297
14298 1
14299
def extensionobject_from_binary(data):
14300
    """
14301
    Convert binary-coded ExtensionObject to a Python object.
14302
    Returns an object, or None if TypeId is zero
14303 1
    """
14304 1
    TypeId = NodeId.from_binary(data)
14305 1
    Encoding = ord(data.read(1))
14306 1
    body = None
14307 1
    if Encoding & (1 << 0):
14308 1
        length = uatype_Int32.unpack(data.read(4))[0]
14309
        if length < 1:
14310
            body = Buffer(b"")
14311 1
        else:
14312 1
            body = data.copy(length)
14313 1
            data.skip(length)
14314 1
    if TypeId.Identifier == 0:
14315 1
        return None
14316 1
    elif TypeId.Identifier not in ExtensionClasses:
14317 1
        e = ExtensionObject()
14318 1
        e.TypeId = TypeId
14319 1
        e.Encoding = Encoding
14320 1
        if body is not None:
14321 1
            e.Body = body.read(len(body))
14322 1
        return e
14323 1
    klass = ExtensionClasses[TypeId.Identifier]
14324
    if body is None:
14325 1
        raise UaError("parsing ExtensionObject {} without data".format(klass.__name__))
14326
    return klass.from_binary(body)
14327
14328 1
14329
def extensionobject_to_binary(obj):
14330
    """
14331
    Convert Python object to binary-coded ExtensionObject.
14332
    If obj is None, convert to empty ExtensionObject (TypeId = 0, no Body).
14333
    Returns a binary string
14334 1
    """
14335 1
    if isinstance(obj, ExtensionObject):
14336 1
        return obj.to_binary()
14337 1
    TypeId = NodeId()
14338 1
    Encoding = 0
14339 1
    Body = None
14340 1
    if obj is not None:
14341 1
        TypeId = FourByteNodeId(getattr(ObjectIds, "{}_Encoding_DefaultBinary".format(obj.__class__.__name__)))
14342 1
        Encoding |= (1 << 0)
14343 1
        Body = obj.to_binary()
14344 1
    packet = []
14345 1
    packet.append(TypeId.to_binary())
14346 1
    packet.append(uatype_UInt8.pack(Encoding))
14347 1
    if Body:
14348 1
        packet.append(pack_bytes(Body))
14349
    return b''.join(packet)
14350