opcua/ua/uatypes.py 1 location
|
@@ 575-586 (lines=12) @@
|
572 |
|
self.Locale = None |
573 |
|
self._freeze = True |
574 |
|
|
575 |
|
def to_binary(self): |
576 |
|
packet = [] |
577 |
|
if self.Locale: |
578 |
|
self.Encoding |= (1 << 0) |
579 |
|
if self.Text: |
580 |
|
self.Encoding |= (1 << 1) |
581 |
|
packet.append(uabin.Primitives.UInt8.pack(self.Encoding)) |
582 |
|
if self.Locale: |
583 |
|
packet.append(uabin.Primitives.String.pack(self.Locale)) |
584 |
|
if self.Text: |
585 |
|
packet.append(uabin.Primitives.String.pack(self.Text)) |
586 |
|
return b''.join(packet) |
587 |
|
|
588 |
|
@staticmethod |
589 |
|
def from_binary(data): |
opcua/ua/uaprotocol_auto.py 1 location
|
@@ 929-938 (lines=10) @@
|
926 |
|
self.Text = None |
927 |
|
self._freeze = True |
928 |
|
|
929 |
|
def to_binary(self): |
930 |
|
packet = [] |
931 |
|
if self.Locale: self.Encoding |= (1 << 0) |
932 |
|
if self.Text: self.Encoding |= (1 << 1) |
933 |
|
packet.append(uabin.Primitives.UInt8.pack(self.Encoding)) |
934 |
|
if self.Locale: |
935 |
|
packet.append(uabin.Primitives.CharArray.pack(self.Locale)) |
936 |
|
if self.Text: |
937 |
|
packet.append(uabin.Primitives.CharArray.pack(self.Text)) |
938 |
|
return b''.join(packet) |
939 |
|
|
940 |
|
@staticmethod |
941 |
|
def from_binary(data): |