Code Duplication    Length = 41-46 lines in 12 locations

opcua/ua/uaprotocol_auto.py 12 locations

@@ 3902-3947 (lines=46) @@
3899
    __repr__ = __str__
3900
3901
3902
class CloseSessionRequest(FrozenClass):
3903
    '''
3904
    Closes a session with the server.
3905
3906
    :ivar TypeId:
3907
    :vartype TypeId: NodeId
3908
    :ivar RequestHeader:
3909
    :vartype RequestHeader: RequestHeader
3910
    :ivar DeleteSubscriptions:
3911
    :vartype DeleteSubscriptions: Boolean
3912
    '''
3913
3914
    ua_types = [
3915
3916
        ('TypeId', 'NodeId'),
3917
        ('RequestHeader', 'RequestHeader'),
3918
        ('DeleteSubscriptions', 'Boolean'),
3919
               ]
3920
3921
    def __init__(self):
3922
        self.TypeId = FourByteNodeId(ObjectIds.CloseSessionRequest_Encoding_DefaultBinary)
3923
        self.RequestHeader = RequestHeader()
3924
        self.DeleteSubscriptions = True
3925
        self._freeze = True
3926
3927
    def to_binary(self):
3928
        packet = []
3929
        packet.append(self.TypeId.to_binary())
3930
        packet.append(self.RequestHeader.to_binary())
3931
        packet.append(uabin.Primitives.Boolean.pack(self.DeleteSubscriptions))
3932
        return b''.join(packet)
3933
3934
    @staticmethod
3935
    def from_binary(data):
3936
        obj = CloseSessionRequest()
3937
        obj.TypeId = NodeId.from_binary(data)
3938
        obj.RequestHeader = RequestHeader.from_binary(data)
3939
        self.DeleteSubscriptions = uabin.Primitives.Boolean.unpack(data)
3940
        return obj
3941
3942
    def __str__(self):
3943
        return 'CloseSessionRequest(' + 'TypeId:' + str(self.TypeId) + ', ' + \
3944
               'RequestHeader:' + str(self.RequestHeader) + ', ' + \
3945
               'DeleteSubscriptions:' + str(self.DeleteSubscriptions) + ')'
3946
3947
    __repr__ = __str__
3948
3949
3950
class CloseSessionResponse(FrozenClass):
@@ 1194-1239 (lines=46) @@
1191
    __repr__ = __str__
1192
1193
1194
class EnumValueType(FrozenClass):
1195
    '''
1196
    A mapping between a value of an enumerated type and a name and description.
1197
1198
    :ivar Value:
1199
    :vartype Value: Int64
1200
    :ivar DisplayName:
1201
    :vartype DisplayName: LocalizedText
1202
    :ivar Description:
1203
    :vartype Description: LocalizedText
1204
    '''
1205
1206
    ua_types = [
1207
1208
        ('Value', 'Int64'),
1209
        ('DisplayName', 'LocalizedText'),
1210
        ('Description', 'LocalizedText'),
1211
               ]
1212
1213
    def __init__(self):
1214
        self.Value = 0
1215
        self.DisplayName = LocalizedText()
1216
        self.Description = LocalizedText()
1217
        self._freeze = True
1218
1219
    def to_binary(self):
1220
        packet = []
1221
        packet.append(uabin.Primitives.Int64.pack(self.Value))
1222
        packet.append(self.DisplayName.to_binary())
1223
        packet.append(self.Description.to_binary())
1224
        return b''.join(packet)
1225
1226
    @staticmethod
1227
    def from_binary(data):
1228
        obj = EnumValueType()
1229
        self.Value = uabin.Primitives.Int64.unpack(data)
1230
        obj.DisplayName = LocalizedText.from_binary(data)
1231
        obj.Description = LocalizedText.from_binary(data)
1232
        return obj
1233
1234
    def __str__(self):
1235
        return 'EnumValueType(' + 'Value:' + str(self.Value) + ', ' + \
1236
               'DisplayName:' + str(self.DisplayName) + ', ' + \
1237
               'Description:' + str(self.Description) + ')'
1238
1239
    __repr__ = __str__
1240
1241
1242
class OptionSet(FrozenClass):
@@ 14770-14813 (lines=44) @@
14767
    __repr__ = __str__
14768
14769
14770
class ModelChangeStructureDataType(FrozenClass):
14771
    '''
14772
    :ivar Affected:
14773
    :vartype Affected: NodeId
14774
    :ivar AffectedType:
14775
    :vartype AffectedType: NodeId
14776
    :ivar Verb:
14777
    :vartype Verb: Byte
14778
    '''
14779
14780
    ua_types = [
14781
14782
        ('Affected', 'NodeId'),
14783
        ('AffectedType', 'NodeId'),
14784
        ('Verb', 'Byte'),
14785
               ]
14786
14787
    def __init__(self):
14788
        self.Affected = NodeId()
14789
        self.AffectedType = NodeId()
14790
        self.Verb = 0
14791
        self._freeze = True
14792
14793
    def to_binary(self):
14794
        packet = []
14795
        packet.append(self.Affected.to_binary())
14796
        packet.append(self.AffectedType.to_binary())
14797
        packet.append(uabin.Primitives.Byte.pack(self.Verb))
14798
        return b''.join(packet)
14799
14800
    @staticmethod
14801
    def from_binary(data):
14802
        obj = ModelChangeStructureDataType()
14803
        obj.Affected = NodeId.from_binary(data)
14804
        obj.AffectedType = NodeId.from_binary(data)
14805
        self.Verb = uabin.Primitives.Byte.unpack(data)
14806
        return obj
14807
14808
    def __str__(self):
14809
        return 'ModelChangeStructureDataType(' + 'Affected:' + str(self.Affected) + ', ' + \
14810
               'AffectedType:' + str(self.AffectedType) + ', ' + \
14811
               'Verb:' + str(self.Verb) + ')'
14812
14813
    __repr__ = __str__
14814
14815
14816
class SemanticChangeStructureDataType(FrozenClass):
@@ 10808-10851 (lines=44) @@
10805
    __repr__ = __str__
10806
10807
10808
class MonitoredItemCreateRequest(FrozenClass):
10809
    '''
10810
    :ivar ItemToMonitor:
10811
    :vartype ItemToMonitor: ReadValueId
10812
    :ivar MonitoringMode:
10813
    :vartype MonitoringMode: MonitoringMode
10814
    :ivar RequestedParameters:
10815
    :vartype RequestedParameters: MonitoringParameters
10816
    '''
10817
10818
    ua_types = [
10819
10820
        ('ItemToMonitor', 'ReadValueId'),
10821
        ('MonitoringMode', 'MonitoringMode'),
10822
        ('RequestedParameters', 'MonitoringParameters'),
10823
               ]
10824
10825
    def __init__(self):
10826
        self.ItemToMonitor = ReadValueId()
10827
        self.MonitoringMode = MonitoringMode(0)
10828
        self.RequestedParameters = MonitoringParameters()
10829
        self._freeze = True
10830
10831
    def to_binary(self):
10832
        packet = []
10833
        packet.append(self.ItemToMonitor.to_binary())
10834
        packet.append(uabin.Primitives.UInt32.pack(self.MonitoringMode.value))
10835
        packet.append(self.RequestedParameters.to_binary())
10836
        return b''.join(packet)
10837
10838
    @staticmethod
10839
    def from_binary(data):
10840
        obj = MonitoredItemCreateRequest()
10841
        obj.ItemToMonitor = ReadValueId.from_binary(data)
10842
        self.MonitoringMode = MonitoringMode(uabin.Primitives.UInt32.unpack(data))
10843
        obj.RequestedParameters = MonitoringParameters.from_binary(data)
10844
        return obj
10845
10846
    def __str__(self):
10847
        return 'MonitoredItemCreateRequest(' + 'ItemToMonitor:' + str(self.ItemToMonitor) + ', ' + \
10848
               'MonitoringMode:' + str(self.MonitoringMode) + ', ' + \
10849
               'RequestedParameters:' + str(self.RequestedParameters) + ')'
10850
10851
    __repr__ = __str__
10852
10853
10854
class MonitoredItemCreateResult(FrozenClass):
@@ 7370-7413 (lines=44) @@
7367
    __repr__ = __str__
7368
7369
7370
class QueryDataDescription(FrozenClass):
7371
    '''
7372
    :ivar RelativePath:
7373
    :vartype RelativePath: RelativePath
7374
    :ivar AttributeId:
7375
    :vartype AttributeId: UInt32
7376
    :ivar IndexRange:
7377
    :vartype IndexRange: String
7378
    '''
7379
7380
    ua_types = [
7381
7382
        ('RelativePath', 'RelativePath'),
7383
        ('AttributeId', 'UInt32'),
7384
        ('IndexRange', 'String'),
7385
               ]
7386
7387
    def __init__(self):
7388
        self.RelativePath = RelativePath()
7389
        self.AttributeId = 0
7390
        self.IndexRange = None
7391
        self._freeze = True
7392
7393
    def to_binary(self):
7394
        packet = []
7395
        packet.append(self.RelativePath.to_binary())
7396
        packet.append(uabin.Primitives.UInt32.pack(self.AttributeId))
7397
        packet.append(uabin.Primitives.String.pack(self.IndexRange))
7398
        return b''.join(packet)
7399
7400
    @staticmethod
7401
    def from_binary(data):
7402
        obj = QueryDataDescription()
7403
        obj.RelativePath = RelativePath.from_binary(data)
7404
        self.AttributeId = uabin.Primitives.UInt32.unpack(data)
7405
        self.IndexRange = uabin.Primitives.String.unpack(data)
7406
        return obj
7407
7408
    def __str__(self):
7409
        return 'QueryDataDescription(' + 'RelativePath:' + str(self.RelativePath) + ', ' + \
7410
               'AttributeId:' + str(self.AttributeId) + ', ' + \
7411
               'IndexRange:' + str(self.IndexRange) + ')'
7412
7413
    __repr__ = __str__
7414
7415
7416
class NodeTypeDescription(FrozenClass):
@@ 2889-2932 (lines=44) @@
2886
    __repr__ = __str__
2887
2888
2889
class OpenSecureChannelResult(FrozenClass):
2890
    '''
2891
    :ivar ServerProtocolVersion:
2892
    :vartype ServerProtocolVersion: UInt32
2893
    :ivar SecurityToken:
2894
    :vartype SecurityToken: ChannelSecurityToken
2895
    :ivar ServerNonce:
2896
    :vartype ServerNonce: ByteString
2897
    '''
2898
2899
    ua_types = [
2900
2901
        ('ServerProtocolVersion', 'UInt32'),
2902
        ('SecurityToken', 'ChannelSecurityToken'),
2903
        ('ServerNonce', 'ByteString'),
2904
               ]
2905
2906
    def __init__(self):
2907
        self.ServerProtocolVersion = 0
2908
        self.SecurityToken = ChannelSecurityToken()
2909
        self.ServerNonce = None
2910
        self._freeze = True
2911
2912
    def to_binary(self):
2913
        packet = []
2914
        packet.append(uabin.Primitives.UInt32.pack(self.ServerProtocolVersion))
2915
        packet.append(self.SecurityToken.to_binary())
2916
        packet.append(uabin.Primitives.ByteString.pack(self.ServerNonce))
2917
        return b''.join(packet)
2918
2919
    @staticmethod
2920
    def from_binary(data):
2921
        obj = OpenSecureChannelResult()
2922
        self.ServerProtocolVersion = uabin.Primitives.UInt32.unpack(data)
2923
        obj.SecurityToken = ChannelSecurityToken.from_binary(data)
2924
        self.ServerNonce = uabin.Primitives.ByteString.unpack(data)
2925
        return obj
2926
2927
    def __str__(self):
2928
        return 'OpenSecureChannelResult(' + 'ServerProtocolVersion:' + str(self.ServerProtocolVersion) + ', ' + \
2929
               'SecurityToken:' + str(self.SecurityToken) + ', ' + \
2930
               'ServerNonce:' + str(self.ServerNonce) + ')'
2931
2932
    __repr__ = __str__
2933
2934
2935
class OpenSecureChannelResponse(FrozenClass):
@@ 5819-5864 (lines=46) @@
5816
    __repr__ = __str__
5817
5818
5819
class ViewDescription(FrozenClass):
5820
    '''
5821
    The view to browse.
5822
5823
    :ivar ViewId:
5824
    :vartype ViewId: NodeId
5825
    :ivar Timestamp:
5826
    :vartype Timestamp: DateTime
5827
    :ivar ViewVersion:
5828
    :vartype ViewVersion: UInt32
5829
    '''
5830
5831
    ua_types = [
5832
5833
        ('ViewId', 'NodeId'),
5834
        ('Timestamp', 'DateTime'),
5835
        ('ViewVersion', 'UInt32'),
5836
               ]
5837
5838
    def __init__(self):
5839
        self.ViewId = NodeId()
5840
        self.Timestamp = datetime.utcnow()
5841
        self.ViewVersion = 0
5842
        self._freeze = True
5843
5844
    def to_binary(self):
5845
        packet = []
5846
        packet.append(self.ViewId.to_binary())
5847
        packet.append(uabin.Primitives.DateTime.pack(self.Timestamp))
5848
        packet.append(uabin.Primitives.UInt32.pack(self.ViewVersion))
5849
        return b''.join(packet)
5850
5851
    @staticmethod
5852
    def from_binary(data):
5853
        obj = ViewDescription()
5854
        obj.ViewId = NodeId.from_binary(data)
5855
        self.Timestamp = uabin.Primitives.DateTime.unpack(data)
5856
        self.ViewVersion = uabin.Primitives.UInt32.unpack(data)
5857
        return obj
5858
5859
    def __str__(self):
5860
        return 'ViewDescription(' + 'ViewId:' + str(self.ViewId) + ', ' + \
5861
               'Timestamp:' + str(self.Timestamp) + ', ' + \
5862
               'ViewVersion:' + str(self.ViewVersion) + ')'
5863
5864
    __repr__ = __str__
5865
5866
5867
class BrowseDescription(FrozenClass):
@@ 3629-3674 (lines=46) @@
3626
    __repr__ = __str__
3627
3628
3629
class IssuedIdentityToken(FrozenClass):
3630
    '''
3631
    A token representing a user identified by a WS-Security XML token.
3632
3633
    :ivar PolicyId:
3634
    :vartype PolicyId: String
3635
    :ivar TokenData:
3636
    :vartype TokenData: ByteString
3637
    :ivar EncryptionAlgorithm:
3638
    :vartype EncryptionAlgorithm: String
3639
    '''
3640
3641
    ua_types = [
3642
3643
        ('PolicyId', 'String'),
3644
        ('TokenData', 'ByteString'),
3645
        ('EncryptionAlgorithm', 'String'),
3646
               ]
3647
3648
    def __init__(self):
3649
        self.PolicyId = None
3650
        self.TokenData = None
3651
        self.EncryptionAlgorithm = None
3652
        self._freeze = True
3653
3654
    def to_binary(self):
3655
        packet = []
3656
        packet.append(uabin.Primitives.String.pack(self.PolicyId))
3657
        packet.append(uabin.Primitives.ByteString.pack(self.TokenData))
3658
        packet.append(uabin.Primitives.String.pack(self.EncryptionAlgorithm))
3659
        return b''.join(packet)
3660
3661
    @staticmethod
3662
    def from_binary(data):
3663
        obj = IssuedIdentityToken()
3664
        self.PolicyId = uabin.Primitives.String.unpack(data)
3665
        self.TokenData = uabin.Primitives.ByteString.unpack(data)
3666
        self.EncryptionAlgorithm = uabin.Primitives.String.unpack(data)
3667
        return obj
3668
3669
    def __str__(self):
3670
        return 'IssuedIdentityToken(' + 'PolicyId:' + str(self.PolicyId) + ', ' + \
3671
               'TokenData:' + str(self.TokenData) + ', ' + \
3672
               'EncryptionAlgorithm:' + str(self.EncryptionAlgorithm) + ')'
3673
3674
    __repr__ = __str__
3675
3676
3677
class ActivateSessionParameters(FrozenClass):
@@ 12240-12283 (lines=44) @@
12237
    __repr__ = __str__
12238
12239
12240
class ModifySubscriptionResult(FrozenClass):
12241
    '''
12242
    :ivar RevisedPublishingInterval:
12243
    :vartype RevisedPublishingInterval: Double
12244
    :ivar RevisedLifetimeCount:
12245
    :vartype RevisedLifetimeCount: UInt32
12246
    :ivar RevisedMaxKeepAliveCount:
12247
    :vartype RevisedMaxKeepAliveCount: UInt32
12248
    '''
12249
12250
    ua_types = [
12251
12252
        ('RevisedPublishingInterval', 'Double'),
12253
        ('RevisedLifetimeCount', 'UInt32'),
12254
        ('RevisedMaxKeepAliveCount', 'UInt32'),
12255
               ]
12256
12257
    def __init__(self):
12258
        self.RevisedPublishingInterval = 0
12259
        self.RevisedLifetimeCount = 0
12260
        self.RevisedMaxKeepAliveCount = 0
12261
        self._freeze = True
12262
12263
    def to_binary(self):
12264
        packet = []
12265
        packet.append(uabin.Primitives.Double.pack(self.RevisedPublishingInterval))
12266
        packet.append(uabin.Primitives.UInt32.pack(self.RevisedLifetimeCount))
12267
        packet.append(uabin.Primitives.UInt32.pack(self.RevisedMaxKeepAliveCount))
12268
        return b''.join(packet)
12269
12270
    @staticmethod
12271
    def from_binary(data):
12272
        obj = ModifySubscriptionResult()
12273
        self.RevisedPublishingInterval = uabin.Primitives.Double.unpack(data)
12274
        self.RevisedLifetimeCount = uabin.Primitives.UInt32.unpack(data)
12275
        self.RevisedMaxKeepAliveCount = uabin.Primitives.UInt32.unpack(data)
12276
        return obj
12277
12278
    def __str__(self):
12279
        return 'ModifySubscriptionResult(' + 'RevisedPublishingInterval:' + str(self.RevisedPublishingInterval) + ', ' + \
12280
               'RevisedLifetimeCount:' + str(self.RevisedLifetimeCount) + ', ' + \
12281
               'RevisedMaxKeepAliveCount:' + str(self.RevisedMaxKeepAliveCount) + ')'
12282
12283
    __repr__ = __str__
12284
12285
12286
class ModifySubscriptionResponse(FrozenClass):
@@ 10702-10745 (lines=44) @@
10699
    __repr__ = __str__
10700
10701
10702
class AggregateFilterResult(FrozenClass):
10703
    '''
10704
    :ivar RevisedStartTime:
10705
    :vartype RevisedStartTime: DateTime
10706
    :ivar RevisedProcessingInterval:
10707
    :vartype RevisedProcessingInterval: Double
10708
    :ivar RevisedAggregateConfiguration:
10709
    :vartype RevisedAggregateConfiguration: AggregateConfiguration
10710
    '''
10711
10712
    ua_types = [
10713
10714
        ('RevisedStartTime', 'DateTime'),
10715
        ('RevisedProcessingInterval', 'Double'),
10716
        ('RevisedAggregateConfiguration', 'AggregateConfiguration'),
10717
               ]
10718
10719
    def __init__(self):
10720
        self.RevisedStartTime = datetime.utcnow()
10721
        self.RevisedProcessingInterval = 0
10722
        self.RevisedAggregateConfiguration = AggregateConfiguration()
10723
        self._freeze = True
10724
10725
    def to_binary(self):
10726
        packet = []
10727
        packet.append(uabin.Primitives.DateTime.pack(self.RevisedStartTime))
10728
        packet.append(uabin.Primitives.Double.pack(self.RevisedProcessingInterval))
10729
        packet.append(self.RevisedAggregateConfiguration.to_binary())
10730
        return b''.join(packet)
10731
10732
    @staticmethod
10733
    def from_binary(data):
10734
        obj = AggregateFilterResult()
10735
        self.RevisedStartTime = uabin.Primitives.DateTime.unpack(data)
10736
        self.RevisedProcessingInterval = uabin.Primitives.Double.unpack(data)
10737
        obj.RevisedAggregateConfiguration = AggregateConfiguration.from_binary(data)
10738
        return obj
10739
10740
    def __str__(self):
10741
        return 'AggregateFilterResult(' + 'RevisedStartTime:' + str(self.RevisedStartTime) + ', ' + \
10742
               'RevisedProcessingInterval:' + str(self.RevisedProcessingInterval) + ', ' + \
10743
               'RevisedAggregateConfiguration:' + str(self.RevisedAggregateConfiguration) + ')'
10744
10745
    __repr__ = __str__
10746
10747
10748
class MonitoringParameters(FrozenClass):
@@ 8713-8756 (lines=44) @@
8710
    __repr__ = __str__
8711
8712
8713
class HistoryReadResult(FrozenClass):
8714
    '''
8715
    :ivar StatusCode:
8716
    :vartype StatusCode: StatusCode
8717
    :ivar ContinuationPoint:
8718
    :vartype ContinuationPoint: ByteString
8719
    :ivar HistoryData:
8720
    :vartype HistoryData: ExtensionObject
8721
    '''
8722
8723
    ua_types = [
8724
8725
        ('StatusCode', 'StatusCode'),
8726
        ('ContinuationPoint', 'ByteString'),
8727
        ('HistoryData', 'ExtensionObject'),
8728
               ]
8729
8730
    def __init__(self):
8731
        self.StatusCode = StatusCode()
8732
        self.ContinuationPoint = None
8733
        self.HistoryData = ExtensionObject()
8734
        self._freeze = True
8735
8736
    def to_binary(self):
8737
        packet = []
8738
        packet.append(self.StatusCode.to_binary())
8739
        packet.append(uabin.Primitives.ByteString.pack(self.ContinuationPoint))
8740
        packet.append(uabin.extensionobject_to_binary(self.HistoryData))
8741
        return b''.join(packet)
8742
8743
    @staticmethod
8744
    def from_binary(data):
8745
        obj = HistoryReadResult()
8746
        obj.StatusCode = StatusCode.from_binary(data)
8747
        self.ContinuationPoint = uabin.Primitives.ByteString.unpack(data)
8748
        obj.HistoryData = uabin.extensionobject_from_binary(data)
8749
        return obj
8750
8751
    def __str__(self):
8752
        return 'HistoryReadResult(' + 'StatusCode:' + str(self.StatusCode) + ', ' + \
8753
               'ContinuationPoint:' + str(self.ContinuationPoint) + ', ' + \
8754
               'HistoryData:' + str(self.HistoryData) + ')'
8755
8756
    __repr__ = __str__
8757
8758
8759
class HistoryReadDetails(FrozenClass):
@@ 2524-2564 (lines=41) @@
2521
    __repr__ = __str__
2522
2523
2524
class MdnsDiscoveryConfiguration(FrozenClass):
2525
    '''
2526
    The discovery information needed for mDNS registration.
2527
2528
    :ivar MdnsServerName:
2529
    :vartype MdnsServerName: String
2530
    :ivar ServerCapabilities:
2531
    :vartype ServerCapabilities: String
2532
    '''
2533
2534
    ua_types = [
2535
2536
        ('MdnsServerName', 'String'),
2537
        ('ServerCapabilities', 'ListOfString'),
2538
               ]
2539
2540
    def __init__(self):
2541
        self.MdnsServerName = None
2542
        self.ServerCapabilities = []
2543
        self._freeze = True
2544
2545
    def to_binary(self):
2546
        packet = []
2547
        packet.append(uabin.Primitives.String.pack(self.MdnsServerName))
2548
        packet.append(uabin.Primitives.Int32.pack(len(self.ServerCapabilities)))
2549
        for fieldname in self.ServerCapabilities:
2550
            packet.append(uabin.Primitives.String.pack(fieldname))
2551
        return b''.join(packet)
2552
2553
    @staticmethod
2554
    def from_binary(data):
2555
        obj = MdnsDiscoveryConfiguration()
2556
        self.MdnsServerName = uabin.Primitives.String.unpack(data)
2557
        obj.ServerCapabilities = uabin.Primitives.String.unpack_array(data)
2558
        return obj
2559
2560
    def __str__(self):
2561
        return 'MdnsDiscoveryConfiguration(' + 'MdnsServerName:' + str(self.MdnsServerName) + ', ' + \
2562
               'ServerCapabilities:' + str(self.ServerCapabilities) + ')'
2563
2564
    __repr__ = __str__
2565
2566
2567
class RegisterServer2Parameters(FrozenClass):