MCPcopy Create free account
hub / github.com/FreeOpcUa/python-opcua / pack

Method pack

opcua/ua/ua_binary.py:100–112  ·  view source on GitHub ↗
(guid)

Source from the content-addressed store, hash-verified

98class _Guid(object):
99 @staticmethod
100 def pack(guid):
101 # convert python UUID 6 field format to OPC UA 4 field format
102 f1 = Primitives.UInt32.pack(guid.time_low)
103 f2 = Primitives.UInt16.pack(guid.time_mid)
104 f3 = Primitives.UInt16.pack(guid.time_hi_version)
105 f4a = Primitives.Byte.pack(guid.clock_seq_hi_variant)
106 f4b = Primitives.Byte.pack(guid.clock_seq_low)
107 f4c = struct.pack('>Q', guid.node)[2:8] # no primitive .pack available for 6 byte int
108 f4 = f4a + f4b + f4c
109 # concat byte fields
110 b = f1 + f2 + f3 + f4
111
112 return b
113
114 @staticmethod
115 def unpack(data):

Callers

nothing calls this directly

Calls 1

packMethod · 0.45

Tested by

no test coverage detected