Code Duplication    Length = 55-57 lines in 11 locations

opcua/ua/uaprotocol_auto.py 11 locations

@@ 6116-6172 (lines=57) @@
6113
    __repr__ = __str__
6114
6115
6116
class BrowseResult(FrozenClass):
6117
    '''
6118
    The result of a browse operation.
6119
6120
    :ivar StatusCode:
6121
    :vartype StatusCode: StatusCode
6122
    :ivar ContinuationPoint:
6123
    :vartype ContinuationPoint: ByteString
6124
    :ivar References:
6125
    :vartype References: ReferenceDescription
6126
    '''
6127
6128
    ua_types = {
6129
        'StatusCode': 'StatusCode',
6130
        'ContinuationPoint': 'ByteString',
6131
        'References': 'ReferenceDescription',
6132
               }
6133
6134
    def __init__(self, binary=None):
6135
        if binary is not None:
6136
            self._binary_init(binary)
6137
            self._freeze = True
6138
            return
6139
        self.StatusCode = StatusCode()
6140
        self.ContinuationPoint = None
6141
        self.References = []
6142
        self._freeze = True
6143
6144
    def to_binary(self):
6145
        packet = []
6146
        packet.append(self.StatusCode.to_binary())
6147
        packet.append(uabin.Primitives.ByteString.pack(self.ContinuationPoint))
6148
        packet.append(uabin.Primitives.Int32.pack(len(self.References)))
6149
        for fieldname in self.References:
6150
            packet.append(fieldname.to_binary())
6151
        return b''.join(packet)
6152
6153
    @staticmethod
6154
    def from_binary(data):
6155
        return BrowseResult(data)
6156
6157
    def _binary_init(self, data):
6158
        self.StatusCode = StatusCode.from_binary(data)
6159
        self.ContinuationPoint = uabin.Primitives.ByteString.unpack(data)
6160
        length = uabin.Primitives.Int32.unpack(data)
6161
        array = []
6162
        if length != -1:
6163
            for _ in range(0, length):
6164
                array.append(ReferenceDescription.from_binary(data))
6165
        self.References = array
6166
6167
    def __str__(self):
6168
        return 'BrowseResult(' + 'StatusCode:' + str(self.StatusCode) + ', ' + \
6169
               'ContinuationPoint:' + str(self.ContinuationPoint) + ', ' + \
6170
               'References:' + str(self.References) + ')'
6171
6172
    __repr__ = __str__
6173
6174
6175
class BrowseParameters(FrozenClass):
@@ 5296-5352 (lines=57) @@
5293
    __repr__ = __str__
5294
5295
5296
class AddReferencesRequest(FrozenClass):
5297
    '''
5298
    Adds one or more references to the server address space.
5299
5300
    :ivar TypeId:
5301
    :vartype TypeId: NodeId
5302
    :ivar RequestHeader:
5303
    :vartype RequestHeader: RequestHeader
5304
    :ivar ReferencesToAdd:
5305
    :vartype ReferencesToAdd: AddReferencesItem
5306
    '''
5307
5308
    ua_types = {
5309
        'TypeId': 'NodeId',
5310
        'RequestHeader': 'RequestHeader',
5311
        'ReferencesToAdd': 'AddReferencesItem',
5312
               }
5313
5314
    def __init__(self, binary=None):
5315
        if binary is not None:
5316
            self._binary_init(binary)
5317
            self._freeze = True
5318
            return
5319
        self.TypeId = FourByteNodeId(ObjectIds.AddReferencesRequest_Encoding_DefaultBinary)
5320
        self.RequestHeader = RequestHeader()
5321
        self.ReferencesToAdd = []
5322
        self._freeze = True
5323
5324
    def to_binary(self):
5325
        packet = []
5326
        packet.append(self.TypeId.to_binary())
5327
        packet.append(self.RequestHeader.to_binary())
5328
        packet.append(uabin.Primitives.Int32.pack(len(self.ReferencesToAdd)))
5329
        for fieldname in self.ReferencesToAdd:
5330
            packet.append(fieldname.to_binary())
5331
        return b''.join(packet)
5332
5333
    @staticmethod
5334
    def from_binary(data):
5335
        return AddReferencesRequest(data)
5336
5337
    def _binary_init(self, data):
5338
        self.TypeId = NodeId.from_binary(data)
5339
        self.RequestHeader = RequestHeader.from_binary(data)
5340
        length = uabin.Primitives.Int32.unpack(data)
5341
        array = []
5342
        if length != -1:
5343
            for _ in range(0, length):
5344
                array.append(AddReferencesItem.from_binary(data))
5345
        self.ReferencesToAdd = array
5346
5347
    def __str__(self):
5348
        return 'AddReferencesRequest(' + 'TypeId:' + str(self.TypeId) + ', ' + \
5349
               'RequestHeader:' + str(self.RequestHeader) + ', ' + \
5350
               'ReferencesToAdd:' + str(self.ReferencesToAdd) + ')'
5351
5352
    __repr__ = __str__
5353
5354
5355
class AddReferencesResponse(FrozenClass):
@@ 2127-2183 (lines=57) @@
2124
    __repr__ = __str__
2125
2126
2127
class GetEndpointsResponse(FrozenClass):
2128
    '''
2129
    Gets the endpoints used by the server.
2130
2131
    :ivar TypeId:
2132
    :vartype TypeId: NodeId
2133
    :ivar ResponseHeader:
2134
    :vartype ResponseHeader: ResponseHeader
2135
    :ivar Endpoints:
2136
    :vartype Endpoints: EndpointDescription
2137
    '''
2138
2139
    ua_types = {
2140
        'TypeId': 'NodeId',
2141
        'ResponseHeader': 'ResponseHeader',
2142
        'Endpoints': 'EndpointDescription',
2143
               }
2144
2145
    def __init__(self, binary=None):
2146
        if binary is not None:
2147
            self._binary_init(binary)
2148
            self._freeze = True
2149
            return
2150
        self.TypeId = FourByteNodeId(ObjectIds.GetEndpointsResponse_Encoding_DefaultBinary)
2151
        self.ResponseHeader = ResponseHeader()
2152
        self.Endpoints = []
2153
        self._freeze = True
2154
2155
    def to_binary(self):
2156
        packet = []
2157
        packet.append(self.TypeId.to_binary())
2158
        packet.append(self.ResponseHeader.to_binary())
2159
        packet.append(uabin.Primitives.Int32.pack(len(self.Endpoints)))
2160
        for fieldname in self.Endpoints:
2161
            packet.append(fieldname.to_binary())
2162
        return b''.join(packet)
2163
2164
    @staticmethod
2165
    def from_binary(data):
2166
        return GetEndpointsResponse(data)
2167
2168
    def _binary_init(self, data):
2169
        self.TypeId = NodeId.from_binary(data)
2170
        self.ResponseHeader = ResponseHeader.from_binary(data)
2171
        length = uabin.Primitives.Int32.unpack(data)
2172
        array = []
2173
        if length != -1:
2174
            for _ in range(0, length):
2175
                array.append(EndpointDescription.from_binary(data))
2176
        self.Endpoints = array
2177
2178
    def __str__(self):
2179
        return 'GetEndpointsResponse(' + 'TypeId:' + str(self.TypeId) + ', ' + \
2180
               'ResponseHeader:' + str(self.ResponseHeader) + ', ' + \
2181
               'Endpoints:' + str(self.Endpoints) + ')'
2182
2183
    __repr__ = __str__
2184
2185
2186
class RegisteredServer(FrozenClass):
@@ 1541-1597 (lines=57) @@
1538
    __repr__ = __str__
1539
1540
1541
class FindServersResponse(FrozenClass):
1542
    '''
1543
    Finds the servers known to the discovery server.
1544
1545
    :ivar TypeId:
1546
    :vartype TypeId: NodeId
1547
    :ivar ResponseHeader:
1548
    :vartype ResponseHeader: ResponseHeader
1549
    :ivar Servers:
1550
    :vartype Servers: ApplicationDescription
1551
    '''
1552
1553
    ua_types = {
1554
        'TypeId': 'NodeId',
1555
        'ResponseHeader': 'ResponseHeader',
1556
        'Servers': 'ApplicationDescription',
1557
               }
1558
1559
    def __init__(self, binary=None):
1560
        if binary is not None:
1561
            self._binary_init(binary)
1562
            self._freeze = True
1563
            return
1564
        self.TypeId = FourByteNodeId(ObjectIds.FindServersResponse_Encoding_DefaultBinary)
1565
        self.ResponseHeader = ResponseHeader()
1566
        self.Servers = []
1567
        self._freeze = True
1568
1569
    def to_binary(self):
1570
        packet = []
1571
        packet.append(self.TypeId.to_binary())
1572
        packet.append(self.ResponseHeader.to_binary())
1573
        packet.append(uabin.Primitives.Int32.pack(len(self.Servers)))
1574
        for fieldname in self.Servers:
1575
            packet.append(fieldname.to_binary())
1576
        return b''.join(packet)
1577
1578
    @staticmethod
1579
    def from_binary(data):
1580
        return FindServersResponse(data)
1581
1582
    def _binary_init(self, data):
1583
        self.TypeId = NodeId.from_binary(data)
1584
        self.ResponseHeader = ResponseHeader.from_binary(data)
1585
        length = uabin.Primitives.Int32.unpack(data)
1586
        array = []
1587
        if length != -1:
1588
            for _ in range(0, length):
1589
                array.append(ApplicationDescription.from_binary(data))
1590
        self.Servers = array
1591
1592
    def __str__(self):
1593
        return 'FindServersResponse(' + 'TypeId:' + str(self.TypeId) + ', ' + \
1594
               'ResponseHeader:' + str(self.ResponseHeader) + ', ' + \
1595
               'Servers:' + str(self.Servers) + ')'
1596
1597
    __repr__ = __str__
1598
1599
1600
class ServerOnNetwork(FrozenClass):
@@ 10531-10585 (lines=55) @@
10528
    __repr__ = __str__
10529
10530
10531
class CallMethodRequest(FrozenClass):
10532
    '''
10533
    :ivar ObjectId:
10534
    :vartype ObjectId: NodeId
10535
    :ivar MethodId:
10536
    :vartype MethodId: NodeId
10537
    :ivar InputArguments:
10538
    :vartype InputArguments: Variant
10539
    '''
10540
10541
    ua_types = {
10542
        'ObjectId': 'NodeId',
10543
        'MethodId': 'NodeId',
10544
        'InputArguments': 'Variant',
10545
               }
10546
10547
    def __init__(self, binary=None):
10548
        if binary is not None:
10549
            self._binary_init(binary)
10550
            self._freeze = True
10551
            return
10552
        self.ObjectId = NodeId()
10553
        self.MethodId = NodeId()
10554
        self.InputArguments = []
10555
        self._freeze = True
10556
10557
    def to_binary(self):
10558
        packet = []
10559
        packet.append(self.ObjectId.to_binary())
10560
        packet.append(self.MethodId.to_binary())
10561
        packet.append(uabin.Primitives.Int32.pack(len(self.InputArguments)))
10562
        for fieldname in self.InputArguments:
10563
            packet.append(fieldname.to_binary())
10564
        return b''.join(packet)
10565
10566
    @staticmethod
10567
    def from_binary(data):
10568
        return CallMethodRequest(data)
10569
10570
    def _binary_init(self, data):
10571
        self.ObjectId = NodeId.from_binary(data)
10572
        self.MethodId = NodeId.from_binary(data)
10573
        length = uabin.Primitives.Int32.unpack(data)
10574
        array = []
10575
        if length != -1:
10576
            for _ in range(0, length):
10577
                array.append(Variant.from_binary(data))
10578
        self.InputArguments = array
10579
10580
    def __str__(self):
10581
        return 'CallMethodRequest(' + 'ObjectId:' + str(self.ObjectId) + ', ' + \
10582
               'MethodId:' + str(self.MethodId) + ', ' + \
10583
               'InputArguments:' + str(self.InputArguments) + ')'
10584
10585
    __repr__ = __str__
10586
10587
10588
class CallMethodResult(FrozenClass):
@@ 10035-10089 (lines=55) @@
10032
    __repr__ = __str__
10033
10034
10035
class UpdateStructureDataDetails(FrozenClass):
10036
    '''
10037
    :ivar NodeId:
10038
    :vartype NodeId: NodeId
10039
    :ivar PerformInsertReplace:
10040
    :vartype PerformInsertReplace: PerformUpdateType
10041
    :ivar UpdateValues:
10042
    :vartype UpdateValues: DataValue
10043
    '''
10044
10045
    ua_types = {
10046
        'NodeId': 'NodeId',
10047
        'PerformInsertReplace': 'PerformUpdateType',
10048
        'UpdateValues': 'DataValue',
10049
               }
10050
10051
    def __init__(self, binary=None):
10052
        if binary is not None:
10053
            self._binary_init(binary)
10054
            self._freeze = True
10055
            return
10056
        self.NodeId = NodeId()
10057
        self.PerformInsertReplace = PerformUpdateType(0)
10058
        self.UpdateValues = []
10059
        self._freeze = True
10060
10061
    def to_binary(self):
10062
        packet = []
10063
        packet.append(self.NodeId.to_binary())
10064
        packet.append(uabin.Primitives.UInt32.pack(self.PerformInsertReplace.value))
10065
        packet.append(uabin.Primitives.Int32.pack(len(self.UpdateValues)))
10066
        for fieldname in self.UpdateValues:
10067
            packet.append(fieldname.to_binary())
10068
        return b''.join(packet)
10069
10070
    @staticmethod
10071
    def from_binary(data):
10072
        return UpdateStructureDataDetails(data)
10073
10074
    def _binary_init(self, data):
10075
        self.NodeId = NodeId.from_binary(data)
10076
        self.PerformInsertReplace = PerformUpdateType(uabin.Primitives.UInt32.unpack(data))
10077
        length = uabin.Primitives.Int32.unpack(data)
10078
        array = []
10079
        if length != -1:
10080
            for _ in range(0, length):
10081
                array.append(DataValue.from_binary(data))
10082
        self.UpdateValues = array
10083
10084
    def __str__(self):
10085
        return 'UpdateStructureDataDetails(' + 'NodeId:' + str(self.NodeId) + ', ' + \
10086
               'PerformInsertReplace:' + str(self.PerformInsertReplace) + ', ' + \
10087
               'UpdateValues:' + str(self.UpdateValues) + ')'
10088
10089
    __repr__ = __str__
10090
10091
10092
class UpdateEventDetails(FrozenClass):
@@ 9978-10032 (lines=55) @@
9975
    __repr__ = __str__
9976
9977
9978
class UpdateDataDetails(FrozenClass):
9979
    '''
9980
    :ivar NodeId:
9981
    :vartype NodeId: NodeId
9982
    :ivar PerformInsertReplace:
9983
    :vartype PerformInsertReplace: PerformUpdateType
9984
    :ivar UpdateValues:
9985
    :vartype UpdateValues: DataValue
9986
    '''
9987
9988
    ua_types = {
9989
        'NodeId': 'NodeId',
9990
        'PerformInsertReplace': 'PerformUpdateType',
9991
        'UpdateValues': 'DataValue',
9992
               }
9993
9994
    def __init__(self, binary=None):
9995
        if binary is not None:
9996
            self._binary_init(binary)
9997
            self._freeze = True
9998
            return
9999
        self.NodeId = NodeId()
10000
        self.PerformInsertReplace = PerformUpdateType(0)
10001
        self.UpdateValues = []
10002
        self._freeze = True
10003
10004
    def to_binary(self):
10005
        packet = []
10006
        packet.append(self.NodeId.to_binary())
10007
        packet.append(uabin.Primitives.UInt32.pack(self.PerformInsertReplace.value))
10008
        packet.append(uabin.Primitives.Int32.pack(len(self.UpdateValues)))
10009
        for fieldname in self.UpdateValues:
10010
            packet.append(fieldname.to_binary())
10011
        return b''.join(packet)
10012
10013
    @staticmethod
10014
    def from_binary(data):
10015
        return UpdateDataDetails(data)
10016
10017
    def _binary_init(self, data):
10018
        self.NodeId = NodeId.from_binary(data)
10019
        self.PerformInsertReplace = PerformUpdateType(uabin.Primitives.UInt32.unpack(data))
10020
        length = uabin.Primitives.Int32.unpack(data)
10021
        array = []
10022
        if length != -1:
10023
            for _ in range(0, length):
10024
                array.append(DataValue.from_binary(data))
10025
        self.UpdateValues = array
10026
10027
    def __str__(self):
10028
        return 'UpdateDataDetails(' + 'NodeId:' + str(self.NodeId) + ', ' + \
10029
               'PerformInsertReplace:' + str(self.PerformInsertReplace) + ', ' + \
10030
               'UpdateValues:' + str(self.UpdateValues) + ')'
10031
10032
    __repr__ = __str__
10033
10034
10035
class UpdateStructureDataDetails(FrozenClass):
@@ 7685-7739 (lines=55) @@
7682
    __repr__ = __str__
7683
7684
7685
class QueryDataSet(FrozenClass):
7686
    '''
7687
    :ivar NodeId:
7688
    :vartype NodeId: ExpandedNodeId
7689
    :ivar TypeDefinitionNode:
7690
    :vartype TypeDefinitionNode: ExpandedNodeId
7691
    :ivar Values:
7692
    :vartype Values: Variant
7693
    '''
7694
7695
    ua_types = {
7696
        'NodeId': 'ExpandedNodeId',
7697
        'TypeDefinitionNode': 'ExpandedNodeId',
7698
        'Values': 'Variant',
7699
               }
7700
7701
    def __init__(self, binary=None):
7702
        if binary is not None:
7703
            self._binary_init(binary)
7704
            self._freeze = True
7705
            return
7706
        self.NodeId = ExpandedNodeId()
7707
        self.TypeDefinitionNode = ExpandedNodeId()
7708
        self.Values = []
7709
        self._freeze = True
7710
7711
    def to_binary(self):
7712
        packet = []
7713
        packet.append(self.NodeId.to_binary())
7714
        packet.append(self.TypeDefinitionNode.to_binary())
7715
        packet.append(uabin.Primitives.Int32.pack(len(self.Values)))
7716
        for fieldname in self.Values:
7717
            packet.append(fieldname.to_binary())
7718
        return b''.join(packet)
7719
7720
    @staticmethod
7721
    def from_binary(data):
7722
        return QueryDataSet(data)
7723
7724
    def _binary_init(self, data):
7725
        self.NodeId = ExpandedNodeId.from_binary(data)
7726
        self.TypeDefinitionNode = ExpandedNodeId.from_binary(data)
7727
        length = uabin.Primitives.Int32.unpack(data)
7728
        array = []
7729
        if length != -1:
7730
            for _ in range(0, length):
7731
                array.append(Variant.from_binary(data))
7732
        self.Values = array
7733
7734
    def __str__(self):
7735
        return 'QueryDataSet(' + 'NodeId:' + str(self.NodeId) + ', ' + \
7736
               'TypeDefinitionNode:' + str(self.TypeDefinitionNode) + ', ' + \
7737
               'Values:' + str(self.Values) + ')'
7738
7739
    __repr__ = __str__
7740
7741
7742
class NodeReference(FrozenClass):
@@ 7628-7682 (lines=55) @@
7625
    __repr__ = __str__
7626
7627
7628
class NodeTypeDescription(FrozenClass):
7629
    '''
7630
    :ivar TypeDefinitionNode:
7631
    :vartype TypeDefinitionNode: ExpandedNodeId
7632
    :ivar IncludeSubTypes:
7633
    :vartype IncludeSubTypes: Boolean
7634
    :ivar DataToReturn:
7635
    :vartype DataToReturn: QueryDataDescription
7636
    '''
7637
7638
    ua_types = {
7639
        'TypeDefinitionNode': 'ExpandedNodeId',
7640
        'IncludeSubTypes': 'Boolean',
7641
        'DataToReturn': 'QueryDataDescription',
7642
               }
7643
7644
    def __init__(self, binary=None):
7645
        if binary is not None:
7646
            self._binary_init(binary)
7647
            self._freeze = True
7648
            return
7649
        self.TypeDefinitionNode = ExpandedNodeId()
7650
        self.IncludeSubTypes = True
7651
        self.DataToReturn = []
7652
        self._freeze = True
7653
7654
    def to_binary(self):
7655
        packet = []
7656
        packet.append(self.TypeDefinitionNode.to_binary())
7657
        packet.append(uabin.Primitives.Boolean.pack(self.IncludeSubTypes))
7658
        packet.append(uabin.Primitives.Int32.pack(len(self.DataToReturn)))
7659
        for fieldname in self.DataToReturn:
7660
            packet.append(fieldname.to_binary())
7661
        return b''.join(packet)
7662
7663
    @staticmethod
7664
    def from_binary(data):
7665
        return NodeTypeDescription(data)
7666
7667
    def _binary_init(self, data):
7668
        self.TypeDefinitionNode = ExpandedNodeId.from_binary(data)
7669
        self.IncludeSubTypes = uabin.Primitives.Boolean.unpack(data)
7670
        length = uabin.Primitives.Int32.unpack(data)
7671
        array = []
7672
        if length != -1:
7673
            for _ in range(0, length):
7674
                array.append(QueryDataDescription.from_binary(data))
7675
        self.DataToReturn = array
7676
7677
    def __str__(self):
7678
        return 'NodeTypeDescription(' + 'TypeDefinitionNode:' + str(self.TypeDefinitionNode) + ', ' + \
7679
               'IncludeSubTypes:' + str(self.IncludeSubTypes) + ', ' + \
7680
               'DataToReturn:' + str(self.DataToReturn) + ')'
7681
7682
    __repr__ = __str__
7683
7684
7685
class QueryDataSet(FrozenClass):
@@ 6175-6229 (lines=55) @@
6172
    __repr__ = __str__
6173
6174
6175
class BrowseParameters(FrozenClass):
6176
    '''
6177
    :ivar View:
6178
    :vartype View: ViewDescription
6179
    :ivar RequestedMaxReferencesPerNode:
6180
    :vartype RequestedMaxReferencesPerNode: UInt32
6181
    :ivar NodesToBrowse:
6182
    :vartype NodesToBrowse: BrowseDescription
6183
    '''
6184
6185
    ua_types = {
6186
        'View': 'ViewDescription',
6187
        'RequestedMaxReferencesPerNode': 'UInt32',
6188
        'NodesToBrowse': 'BrowseDescription',
6189
               }
6190
6191
    def __init__(self, binary=None):
6192
        if binary is not None:
6193
            self._binary_init(binary)
6194
            self._freeze = True
6195
            return
6196
        self.View = ViewDescription()
6197
        self.RequestedMaxReferencesPerNode = 0
6198
        self.NodesToBrowse = []
6199
        self._freeze = True
6200
6201
    def to_binary(self):
6202
        packet = []
6203
        packet.append(self.View.to_binary())
6204
        packet.append(uabin.Primitives.UInt32.pack(self.RequestedMaxReferencesPerNode))
6205
        packet.append(uabin.Primitives.Int32.pack(len(self.NodesToBrowse)))
6206
        for fieldname in self.NodesToBrowse:
6207
            packet.append(fieldname.to_binary())
6208
        return b''.join(packet)
6209
6210
    @staticmethod
6211
    def from_binary(data):
6212
        return BrowseParameters(data)
6213
6214
    def _binary_init(self, data):
6215
        self.View = ViewDescription.from_binary(data)
6216
        self.RequestedMaxReferencesPerNode = uabin.Primitives.UInt32.unpack(data)
6217
        length = uabin.Primitives.Int32.unpack(data)
6218
        array = []
6219
        if length != -1:
6220
            for _ in range(0, length):
6221
                array.append(BrowseDescription.from_binary(data))
6222
        self.NodesToBrowse = array
6223
6224
    def __str__(self):
6225
        return 'BrowseParameters(' + 'View:' + str(self.View) + ', ' + \
6226
               'RequestedMaxReferencesPerNode:' + str(self.RequestedMaxReferencesPerNode) + ', ' + \
6227
               'NodesToBrowse:' + str(self.NodesToBrowse) + ')'
6228
6229
    __repr__ = __str__
6230
6231
6232
class BrowseRequest(FrozenClass):
@@ 13133-13187 (lines=55) @@
13130
    __repr__ = __str__
13131
13132
13133
class NotificationMessage(FrozenClass):
13134
    '''
13135
    :ivar SequenceNumber:
13136
    :vartype SequenceNumber: UInt32
13137
    :ivar PublishTime:
13138
    :vartype PublishTime: DateTime
13139
    :ivar NotificationData:
13140
    :vartype NotificationData: ExtensionObject
13141
    '''
13142
13143
    ua_types = {
13144
        'SequenceNumber': 'UInt32',
13145
        'PublishTime': 'DateTime',
13146
        'NotificationData': 'ExtensionObject',
13147
               }
13148
13149
    def __init__(self, binary=None):
13150
        if binary is not None:
13151
            self._binary_init(binary)
13152
            self._freeze = True
13153
            return
13154
        self.SequenceNumber = 0
13155
        self.PublishTime = datetime.now()
13156
        self.NotificationData = []
13157
        self._freeze = True
13158
13159
    def to_binary(self):
13160
        packet = []
13161
        packet.append(uabin.Primitives.UInt32.pack(self.SequenceNumber))
13162
        packet.append(uabin.Primitives.DateTime.pack(self.PublishTime))
13163
        packet.append(uabin.Primitives.Int32.pack(len(self.NotificationData)))
13164
        for fieldname in self.NotificationData:
13165
            packet.append(extensionobject_to_binary(fieldname))
13166
        return b''.join(packet)
13167
13168
    @staticmethod
13169
    def from_binary(data):
13170
        return NotificationMessage(data)
13171
13172
    def _binary_init(self, data):
13173
        self.SequenceNumber = uabin.Primitives.UInt32.unpack(data)
13174
        self.PublishTime = uabin.Primitives.DateTime.unpack(data)
13175
        length = uabin.Primitives.Int32.unpack(data)
13176
        array = []
13177
        if length != -1:
13178
            for _ in range(0, length):
13179
                array.append(extensionobject_from_binary(data))
13180
        self.NotificationData = array
13181
13182
    def __str__(self):
13183
        return 'NotificationMessage(' + 'SequenceNumber:' + str(self.SequenceNumber) + ', ' + \
13184
               'PublishTime:' + str(self.PublishTime) + ', ' + \
13185
               'NotificationData:' + str(self.NotificationData) + ')'
13186
13187
    __repr__ = __str__
13188
13189
13190
class NotificationData(FrozenClass):