| @@ 297-370 (lines=74) @@ | ||
| 294 | ||
| 295 | class AttributeWriteMask(IntEnum): |
|
| 296 | ''' |
|
| 297 | Define bits used to indicate which attributes are writable. |
|
| 298 | ||
| 299 | :ivar None_: |
|
| 300 | :vartype None_: 0 |
|
| 301 | :ivar AccessLevel: |
|
| 302 | :vartype AccessLevel: 1 |
|
| 303 | :ivar ArrayDimensions: |
|
| 304 | :vartype ArrayDimensions: 2 |
|
| 305 | :ivar BrowseName: |
|
| 306 | :vartype BrowseName: 4 |
|
| 307 | :ivar ContainsNoLoops: |
|
| 308 | :vartype ContainsNoLoops: 8 |
|
| 309 | :ivar DataType: |
|
| 310 | :vartype DataType: 16 |
|
| 311 | :ivar Description: |
|
| 312 | :vartype Description: 32 |
|
| 313 | :ivar DisplayName: |
|
| 314 | :vartype DisplayName: 64 |
|
| 315 | :ivar EventNotifier: |
|
| 316 | :vartype EventNotifier: 128 |
|
| 317 | :ivar Executable: |
|
| 318 | :vartype Executable: 256 |
|
| 319 | :ivar Historizing: |
|
| 320 | :vartype Historizing: 512 |
|
| 321 | :ivar InverseName: |
|
| 322 | :vartype InverseName: 1024 |
|
| 323 | :ivar IsAbstract: |
|
| 324 | :vartype IsAbstract: 2048 |
|
| 325 | :ivar MinimumSamplingInterval: |
|
| 326 | :vartype MinimumSamplingInterval: 4096 |
|
| 327 | :ivar NodeClass: |
|
| 328 | :vartype NodeClass: 8192 |
|
| 329 | :ivar NodeId: |
|
| 330 | :vartype NodeId: 16384 |
|
| 331 | :ivar Symmetric: |
|
| 332 | :vartype Symmetric: 32768 |
|
| 333 | :ivar UserAccessLevel: |
|
| 334 | :vartype UserAccessLevel: 65536 |
|
| 335 | :ivar UserExecutable: |
|
| 336 | :vartype UserExecutable: 131072 |
|
| 337 | :ivar UserWriteMask: |
|
| 338 | :vartype UserWriteMask: 262144 |
|
| 339 | :ivar ValueRank: |
|
| 340 | :vartype ValueRank: 524288 |
|
| 341 | :ivar WriteMask: |
|
| 342 | :vartype WriteMask: 1048576 |
|
| 343 | :ivar ValueForVariableType: |
|
| 344 | :vartype ValueForVariableType: 2097152 |
|
| 345 | ''' |
|
| 346 | None_ = 0 |
|
| 347 | AccessLevel = 1 |
|
| 348 | ArrayDimensions = 2 |
|
| 349 | BrowseName = 4 |
|
| 350 | ContainsNoLoops = 8 |
|
| 351 | DataType = 16 |
|
| 352 | Description = 32 |
|
| 353 | DisplayName = 64 |
|
| 354 | EventNotifier = 128 |
|
| 355 | Executable = 256 |
|
| 356 | Historizing = 512 |
|
| 357 | InverseName = 1024 |
|
| 358 | IsAbstract = 2048 |
|
| 359 | MinimumSamplingInterval = 4096 |
|
| 360 | NodeClass = 8192 |
|
| 361 | NodeId = 16384 |
|
| 362 | Symmetric = 32768 |
|
| 363 | UserAccessLevel = 65536 |
|
| 364 | UserExecutable = 131072 |
|
| 365 | UserWriteMask = 262144 |
|
| 366 | ValueRank = 524288 |
|
| 367 | WriteMask = 1048576 |
|
| 368 | ValueForVariableType = 2097152 |
|
| 369 | ||
| 370 | ||
| 371 | class BrowseDirection(IntEnum): |
|
| 372 | ''' |
|
| 373 | The directions of the references to return. |
|
| @@ 805-865 (lines=61) @@ | ||
| 802 | def get_shape(mylist): |
|
| 803 | dims = [] |
|
| 804 | while isinstance(mylist, (list, tuple)): |
|
| 805 | dims.append(len(mylist)) |
|
| 806 | if len(mylist) == 0: |
|
| 807 | break |
|
| 808 | mylist = mylist[0] |
|
| 809 | return dims |
|
| 810 | ||
| 811 | ||
| 812 | class DataValue(FrozenClass): |
|
| 813 | """ |
|
| 814 | A value with an associated timestamp, and quality. |
|
| 815 | Automatically generated from xml , copied and modified here to fix errors in xml spec |
|
| 816 | ||
| 817 | :ivar Value: |
|
| 818 | :vartype Value: Variant |
|
| 819 | :ivar StatusCode: |
|
| 820 | :vartype StatusCode: StatusCode |
|
| 821 | :ivar SourceTimestamp: |
|
| 822 | :vartype SourceTimestamp: datetime |
|
| 823 | :ivar SourcePicoSeconds: |
|
| 824 | :vartype SourcePicoSeconds: int |
|
| 825 | :ivar ServerTimestamp: |
|
| 826 | :vartype ServerTimestamp: datetime |
|
| 827 | :ivar ServerPicoseconds: |
|
| 828 | :vartype ServerPicoseconds: int |
|
| 829 | """ |
|
| 830 | ||
| 831 | ua_switches = { |
|
| 832 | 'Value': ('Encoding', 0), |
|
| 833 | 'StatusCode': ('Encoding', 1), |
|
| 834 | 'SourceTimestamp': ('Encoding', 2), |
|
| 835 | 'ServerTimestamp': ('Encoding', 3), |
|
| 836 | 'SourcePicoseconds': ('Encoding', 4), |
|
| 837 | 'ServerPicoseconds': ('Encoding', 5), |
|
| 838 | } |
|
| 839 | ||
| 840 | ua_types = ( |
|
| 841 | ('Encoding', 'Byte'), |
|
| 842 | ('Value', 'Variant'), |
|
| 843 | ('StatusCode', 'StatusCode'), |
|
| 844 | ('SourceTimestamp', 'DateTime'), |
|
| 845 | ('SourcePicoseconds', 'UInt16'), |
|
| 846 | ('ServerTimestamp', 'DateTime'), |
|
| 847 | ('ServerPicoseconds', 'UInt16'), |
|
| 848 | ) |
|
| 849 | ||
| 850 | def __init__(self, variant=None, status=None): |
|
| 851 | self.Encoding = 0 |
|
| 852 | if not isinstance(variant, Variant): |
|
| 853 | variant = Variant(variant) |
|
| 854 | self.Value = variant |
|
| 855 | if status is None: |
|
| 856 | self.StatusCode = StatusCode() |
|
| 857 | else: |
|
| 858 | self.StatusCode = status |
|
| 859 | self.SourceTimestamp = None # DateTime() |
|
| 860 | self.SourcePicoseconds = None |
|
| 861 | self.ServerTimestamp = None # DateTime() |
|
| 862 | self.ServerPicoseconds = None |
|
| 863 | self._freeze = True |
|
| 864 | ||
| 865 | def __str__(self): |
|
| 866 | s = 'DataValue(Value:{0}'.format(self.Value) |
|
| 867 | if self.StatusCode is not None: |
|
| 868 | s += ', StatusCode:{0}'.format(self.StatusCode) |
|