Any UA object packed as an ExtensionObject :ivar TypeId: :vartype TypeId: NodeId :ivar Body: :vartype Body: bytes
| 585 | |
| 586 | |
| 587 | class ExtensionObject(FrozenClass): |
| 588 | """ |
| 589 | Any UA object packed as an ExtensionObject |
| 590 | |
| 591 | :ivar TypeId: |
| 592 | :vartype TypeId: NodeId |
| 593 | :ivar Body: |
| 594 | :vartype Body: bytes |
| 595 | """ |
| 596 | ua_switches = { |
| 597 | 'Body': ('Encoding', 0), |
| 598 | } |
| 599 | |
| 600 | ua_types = ( |
| 601 | ("TypeId", "NodeId"), |
| 602 | ("Encoding", "Byte"), |
| 603 | ("Body", "ByteString"), |
| 604 | ) |
| 605 | |
| 606 | def __init__(self): |
| 607 | self.TypeId = NodeId() |
| 608 | self.Encoding = 0 |
| 609 | self.Body = None |
| 610 | self._freeze = True |
| 611 | |
| 612 | def __bool__(self): |
| 613 | return self.Body is not None |
| 614 | __nonzero__ = __bool__ # Python2 compatibilty |
| 615 | |
| 616 | def __str__(self): |
| 617 | size = len(self.Body) if self.Body is not None else None |
| 618 | return 'ExtensionObject(' + 'TypeId:' + str(self.TypeId) + ', ' + \ |
| 619 | 'Encoding:' + str(self.Encoding) + ', ' + str(size) + ' bytes)' |
| 620 | |
| 621 | __repr__ = __str__ |
| 622 | |
| 623 | |
| 624 | class VariantType(Enum): |
no outgoing calls
no test coverage detected