@@ 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) |
@@ 647-732 (lines=86) @@ | ||
644 | View = 26501356 |
|
645 | ||
646 | ||
647 | class AttributeWriteMask(IntEnum): |
|
648 | ''' |
|
649 | Define bits used to indicate which attributes are writable. |
|
650 | ||
651 | :ivar None_: |
|
652 | :vartype None_: 0 |
|
653 | :ivar AccessLevel: |
|
654 | :vartype AccessLevel: 1 |
|
655 | :ivar ArrayDimensions: |
|
656 | :vartype ArrayDimensions: 2 |
|
657 | :ivar BrowseName: |
|
658 | :vartype BrowseName: 4 |
|
659 | :ivar ContainsNoLoops: |
|
660 | :vartype ContainsNoLoops: 8 |
|
661 | :ivar DataType: |
|
662 | :vartype DataType: 16 |
|
663 | :ivar Description: |
|
664 | :vartype Description: 32 |
|
665 | :ivar DisplayName: |
|
666 | :vartype DisplayName: 64 |
|
667 | :ivar EventNotifier: |
|
668 | :vartype EventNotifier: 128 |
|
669 | :ivar Executable: |
|
670 | :vartype Executable: 256 |
|
671 | :ivar Historizing: |
|
672 | :vartype Historizing: 512 |
|
673 | :ivar InverseName: |
|
674 | :vartype InverseName: 1024 |
|
675 | :ivar IsAbstract: |
|
676 | :vartype IsAbstract: 2048 |
|
677 | :ivar MinimumSamplingInterval: |
|
678 | :vartype MinimumSamplingInterval: 4096 |
|
679 | :ivar NodeClass: |
|
680 | :vartype NodeClass: 8192 |
|
681 | :ivar NodeId: |
|
682 | :vartype NodeId: 16384 |
|
683 | :ivar Symmetric: |
|
684 | :vartype Symmetric: 32768 |
|
685 | :ivar UserAccessLevel: |
|
686 | :vartype UserAccessLevel: 65536 |
|
687 | :ivar UserExecutable: |
|
688 | :vartype UserExecutable: 131072 |
|
689 | :ivar UserWriteMask: |
|
690 | :vartype UserWriteMask: 262144 |
|
691 | :ivar ValueRank: |
|
692 | :vartype ValueRank: 524288 |
|
693 | :ivar WriteMask: |
|
694 | :vartype WriteMask: 1048576 |
|
695 | :ivar ValueForVariableType: |
|
696 | :vartype ValueForVariableType: 2097152 |
|
697 | :ivar DataTypeDefinition: |
|
698 | :vartype DataTypeDefinition: 4194304 |
|
699 | :ivar RolePermissions: |
|
700 | :vartype RolePermissions: 8388608 |
|
701 | :ivar AccessRestrictions: |
|
702 | :vartype AccessRestrictions: 16777216 |
|
703 | :ivar AccessLevelEx: |
|
704 | :vartype AccessLevelEx: 33554432 |
|
705 | ''' |
|
706 | None_ = 0 |
|
707 | AccessLevel = 1 |
|
708 | ArrayDimensions = 2 |
|
709 | BrowseName = 4 |
|
710 | ContainsNoLoops = 8 |
|
711 | DataType = 16 |
|
712 | Description = 32 |
|
713 | DisplayName = 64 |
|
714 | EventNotifier = 128 |
|
715 | Executable = 256 |
|
716 | Historizing = 512 |
|
717 | InverseName = 1024 |
|
718 | IsAbstract = 2048 |
|
719 | MinimumSamplingInterval = 4096 |
|
720 | NodeClass = 8192 |
|
721 | NodeId = 16384 |
|
722 | Symmetric = 32768 |
|
723 | UserAccessLevel = 65536 |
|
724 | UserExecutable = 131072 |
|
725 | UserWriteMask = 262144 |
|
726 | ValueRank = 524288 |
|
727 | WriteMask = 1048576 |
|
728 | ValueForVariableType = 2097152 |
|
729 | DataTypeDefinition = 4194304 |
|
730 | RolePermissions = 8388608 |
|
731 | AccessRestrictions = 16777216 |
|
732 | AccessLevelEx = 33554432 |
|
733 | ||
734 | ||
735 | class BrowseDirection(IntEnum): |
@@ 5-32 (lines=28) @@ | ||
2 | ||
3 | from enum import IntEnum |
|
4 | ||
5 | class AttributeIds(IntEnum): |
|
6 | NodeId = 1 |
|
7 | NodeClass = 2 |
|
8 | BrowseName = 3 |
|
9 | DisplayName = 4 |
|
10 | Description = 5 |
|
11 | WriteMask = 6 |
|
12 | UserWriteMask = 7 |
|
13 | IsAbstract = 8 |
|
14 | Symmetric = 9 |
|
15 | InverseName = 10 |
|
16 | ContainsNoLoops = 11 |
|
17 | EventNotifier = 12 |
|
18 | Value = 13 |
|
19 | DataType = 14 |
|
20 | ValueRank = 15 |
|
21 | ArrayDimensions = 16 |
|
22 | AccessLevel = 17 |
|
23 | UserAccessLevel = 18 |
|
24 | MinimumSamplingInterval = 19 |
|
25 | Historizing = 20 |
|
26 | Executable = 21 |
|
27 | UserExecutable = 22 |
|
28 | DataTypeDefinition = 23 |
|
29 | RolePermissions = 24 |
|
30 | UserRolePermissions = 25 |
|
31 | AccessRestrictions = 26 |
|
32 | AccessLevelEx = 27 |
|
33 |