@@ 11004-11065 (lines=62) @@ | ||
11001 | self.ObjectId = NodeId() |
|
11002 | self.MethodId = NodeId() |
|
11003 | self.InputArguments = [] |
|
11004 | self._freeze = True |
|
11005 | ||
11006 | def to_binary(self): |
|
11007 | packet = [] |
|
11008 | packet.append(self.ObjectId.to_binary()) |
|
11009 | packet.append(self.MethodId.to_binary()) |
|
11010 | packet.append(uabin.Primitives.Int32.pack(len(self.InputArguments))) |
|
11011 | for fieldname in self.InputArguments: |
|
11012 | packet.append(fieldname.to_binary()) |
|
11013 | return b''.join(packet) |
|
11014 | ||
11015 | @staticmethod |
|
11016 | def from_binary(data): |
|
11017 | return CallMethodRequest(data) |
|
11018 | ||
11019 | def _binary_init(self, data): |
|
11020 | self.ObjectId = NodeId.from_binary(data) |
|
11021 | self.MethodId = NodeId.from_binary(data) |
|
11022 | length = uabin.Primitives.Int32.unpack(data) |
|
11023 | array = [] |
|
11024 | if length != -1: |
|
11025 | for _ in range(0, length): |
|
11026 | array.append(Variant.from_binary(data)) |
|
11027 | self.InputArguments = array |
|
11028 | ||
11029 | def __str__(self): |
|
11030 | return 'CallMethodRequest(' + 'ObjectId:' + str(self.ObjectId) + ', ' + \ |
|
11031 | 'MethodId:' + str(self.MethodId) + ', ' + \ |
|
11032 | 'InputArguments:' + str(self.InputArguments) + ')' |
|
11033 | ||
11034 | __repr__ = __str__ |
|
11035 | ||
11036 | ||
11037 | class CallMethodResult(FrozenClass): |
|
11038 | ''' |
|
11039 | :ivar StatusCode: |
|
11040 | :vartype StatusCode: StatusCode |
|
11041 | :ivar InputArgumentResults: |
|
11042 | :vartype InputArgumentResults: StatusCode |
|
11043 | :ivar InputArgumentDiagnosticInfos: |
|
11044 | :vartype InputArgumentDiagnosticInfos: DiagnosticInfo |
|
11045 | :ivar OutputArguments: |
|
11046 | :vartype OutputArguments: Variant |
|
11047 | ''' |
|
11048 | ||
11049 | ua_types = ( |
|
11050 | ||
11051 | ('StatusCode', 'StatusCode'), |
|
11052 | ('InputArgumentResults', 'ListOfStatusCode'), |
|
11053 | ('InputArgumentDiagnosticInfos', 'ListOfDiagnosticInfo'), |
|
11054 | ('OutputArguments', 'ListOfVariant'), |
|
11055 | ) |
|
11056 | ||
11057 | def __init__(self, binary=None): |
|
11058 | if binary is not None: |
|
11059 | self._binary_init(binary) |
|
11060 | self._freeze = True |
|
11061 | return |
|
11062 | self.StatusCode = StatusCode() |
|
11063 | self.InputArgumentResults = [] |
|
11064 | self.InputArgumentDiagnosticInfos = [] |
|
11065 | self.OutputArguments = [] |
|
11066 | self._freeze = True |
|
11067 | ||
11068 | def to_binary(self): |
|
@@ 9206-9267 (lines=62) @@ | ||
9203 | __repr__ = __str__ |
|
9204 | ||
9205 | ||
9206 | class ReadParameters(FrozenClass): |
|
9207 | ''' |
|
9208 | :ivar MaxAge: |
|
9209 | :vartype MaxAge: Double |
|
9210 | :ivar TimestampsToReturn: |
|
9211 | :vartype TimestampsToReturn: TimestampsToReturn |
|
9212 | :ivar NodesToRead: |
|
9213 | :vartype NodesToRead: ReadValueId |
|
9214 | ''' |
|
9215 | ||
9216 | ua_types = ( |
|
9217 | ||
9218 | ('MaxAge', 'Double'), |
|
9219 | ('TimestampsToReturn', 'TimestampsToReturn'), |
|
9220 | ('NodesToRead', 'ListOfReadValueId'), |
|
9221 | ) |
|
9222 | ||
9223 | def __init__(self, binary=None): |
|
9224 | if binary is not None: |
|
9225 | self._binary_init(binary) |
|
9226 | self._freeze = True |
|
9227 | return |
|
9228 | self.MaxAge = 0 |
|
9229 | self.TimestampsToReturn = TimestampsToReturn(0) |
|
9230 | self.NodesToRead = [] |
|
9231 | self._freeze = True |
|
9232 | ||
9233 | def to_binary(self): |
|
9234 | packet = [] |
|
9235 | packet.append(uabin.Primitives.Double.pack(self.MaxAge)) |
|
9236 | packet.append(uabin.Primitives.UInt32.pack(self.TimestampsToReturn.value)) |
|
9237 | packet.append(uabin.Primitives.Int32.pack(len(self.NodesToRead))) |
|
9238 | for fieldname in self.NodesToRead: |
|
9239 | packet.append(fieldname.to_binary()) |
|
9240 | return b''.join(packet) |
|
9241 | ||
9242 | @staticmethod |
|
9243 | def from_binary(data): |
|
9244 | return ReadParameters(data) |
|
9245 | ||
9246 | def _binary_init(self, data): |
|
9247 | self.MaxAge = uabin.Primitives.Double.unpack(data) |
|
9248 | self.TimestampsToReturn = TimestampsToReturn(uabin.Primitives.UInt32.unpack(data)) |
|
9249 | length = uabin.Primitives.Int32.unpack(data) |
|
9250 | array = [] |
|
9251 | if length != -1: |
|
9252 | for _ in range(0, length): |
|
9253 | array.append(ReadValueId.from_binary(data)) |
|
9254 | self.NodesToRead = array |
|
9255 | ||
9256 | def __str__(self): |
|
9257 | return 'ReadParameters(' + 'MaxAge:' + str(self.MaxAge) + ', ' + \ |
|
9258 | 'TimestampsToReturn:' + str(self.TimestampsToReturn) + ', ' + \ |
|
9259 | 'NodesToRead:' + str(self.NodesToRead) + ')' |
|
9260 | ||
9261 | __repr__ = __str__ |
|
9262 | ||
9263 | ||
9264 | class ReadRequest(FrozenClass): |
|
9265 | ''' |
|
9266 | :ivar TypeId: |
|
9267 | :vartype TypeId: NodeId |
|
9268 | :ivar RequestHeader: |
|
9269 | :vartype RequestHeader: RequestHeader |
|
9270 | :ivar Parameters: |