edouard@3884: # edouard@4035: # Generated by erpcgen 1.13.0 on Fri Nov 8 11:06:24 2024. edouard@3884: # edouard@3884: # AUTOGENERATED - DO NOT EDIT edouard@3884: # edouard@3884: edouard@3884: import erpc edouard@3884: from . import common, interface edouard@3884: edouard@3884: # Client for BeremizPLCObjectService edouard@3884: class BeremizPLCObjectServiceService(erpc.server.Service): edouard@3884: def __init__(self, handler): edouard@3884: super(BeremizPLCObjectServiceService, self).__init__(interface.IBeremizPLCObjectService.SERVICE_ID) edouard@3884: self._handler = handler edouard@3884: self._methods = { edouard@3884: interface.IBeremizPLCObjectService.APPENDCHUNKTOBLOB_ID: self._handle_AppendChunkToBlob, edouard@3884: interface.IBeremizPLCObjectService.GETLOGMESSAGE_ID: self._handle_GetLogMessage, edouard@3884: interface.IBeremizPLCObjectService.GETPLCID_ID: self._handle_GetPLCID, edouard@3884: interface.IBeremizPLCObjectService.GETPLCSTATUS_ID: self._handle_GetPLCstatus, edouard@3884: interface.IBeremizPLCObjectService.GETTRACEVARIABLES_ID: self._handle_GetTraceVariables, edouard@3884: interface.IBeremizPLCObjectService.MATCHMD5_ID: self._handle_MatchMD5, edouard@3884: interface.IBeremizPLCObjectService.NEWPLC_ID: self._handle_NewPLC, edouard@3884: interface.IBeremizPLCObjectService.PURGEBLOBS_ID: self._handle_PurgeBlobs, edouard@3884: interface.IBeremizPLCObjectService.REPAIRPLC_ID: self._handle_RepairPLC, edouard@3884: interface.IBeremizPLCObjectService.RESETLOGCOUNT_ID: self._handle_ResetLogCount, edouard@3884: interface.IBeremizPLCObjectService.SEEDBLOB_ID: self._handle_SeedBlob, edouard@3884: interface.IBeremizPLCObjectService.SETTRACEVARIABLESLIST_ID: self._handle_SetTraceVariablesList, edouard@3884: interface.IBeremizPLCObjectService.STARTPLC_ID: self._handle_StartPLC, edouard@3884: interface.IBeremizPLCObjectService.STOPPLC_ID: self._handle_StopPLC, edouard@4032: interface.IBeremizPLCObjectService.EXTENDEDCALL_ID: self._handle_ExtendedCall, edouard@3884: } edouard@3884: edouard@3884: def _handle_AppendChunkToBlob(self, sequence, codec): edouard@3884: # Create reference objects to pass into handler for out/inout parameters. edouard@3884: newBlobID = erpc.Reference() edouard@3884: edouard@3884: # Read incoming parameters. edouard@3884: data = codec.read_binary() edouard@3884: blobID = codec.read_binary() edouard@3884: edouard@3884: # Invoke user implementation of remote function. edouard@3884: _result = self._handler.AppendChunkToBlob(data, blobID, newBlobID) edouard@3884: edouard@3884: # Prepare codec for reply message. edouard@3884: codec.reset() edouard@3884: edouard@3884: # Construct reply message. edouard@3884: codec.start_write_message(erpc.codec.MessageInfo( edouard@3884: type=erpc.codec.MessageType.kReplyMessage, edouard@3884: service=interface.IBeremizPLCObjectService.SERVICE_ID, edouard@3884: request=interface.IBeremizPLCObjectService.APPENDCHUNKTOBLOB_ID, edouard@3884: sequence=sequence)) edouard@3884: if newBlobID.value is None: edouard@3884: raise ValueError("newBlobID.value is None") edouard@3884: codec.write_binary(newBlobID.value) edouard@3884: codec.write_uint32(_result) edouard@3884: edouard@3884: def _handle_GetLogMessage(self, sequence, codec): edouard@3884: # Create reference objects to pass into handler for out/inout parameters. edouard@3884: message = erpc.Reference() edouard@3884: edouard@3884: # Read incoming parameters. edouard@3884: level = codec.read_uint8() edouard@3884: msgID = codec.read_uint32() edouard@3884: edouard@3884: # Invoke user implementation of remote function. edouard@3884: _result = self._handler.GetLogMessage(level, msgID, message) edouard@3884: edouard@3884: # Prepare codec for reply message. edouard@3884: codec.reset() edouard@3884: edouard@3884: # Construct reply message. edouard@3884: codec.start_write_message(erpc.codec.MessageInfo( edouard@3884: type=erpc.codec.MessageType.kReplyMessage, edouard@3884: service=interface.IBeremizPLCObjectService.SERVICE_ID, edouard@3884: request=interface.IBeremizPLCObjectService.GETLOGMESSAGE_ID, edouard@3884: sequence=sequence)) edouard@3884: if message.value is None: edouard@3884: raise ValueError("message.value is None") edouard@3884: message.value._write(codec) edouard@3884: codec.write_uint32(_result) edouard@3884: edouard@3884: def _handle_GetPLCID(self, sequence, codec): edouard@3884: # Create reference objects to pass into handler for out/inout parameters. edouard@3884: plcID = erpc.Reference() edouard@3884: edouard@3884: # Read incoming parameters. edouard@3884: edouard@3884: # Invoke user implementation of remote function. edouard@3884: _result = self._handler.GetPLCID(plcID) edouard@3884: edouard@3884: # Prepare codec for reply message. edouard@3884: codec.reset() edouard@3884: edouard@3884: # Construct reply message. edouard@3884: codec.start_write_message(erpc.codec.MessageInfo( edouard@3884: type=erpc.codec.MessageType.kReplyMessage, edouard@3884: service=interface.IBeremizPLCObjectService.SERVICE_ID, edouard@3884: request=interface.IBeremizPLCObjectService.GETPLCID_ID, edouard@3884: sequence=sequence)) edouard@3884: if plcID.value is None: edouard@3884: raise ValueError("plcID.value is None") edouard@3884: plcID.value._write(codec) edouard@3884: codec.write_uint32(_result) edouard@3884: edouard@3884: def _handle_GetPLCstatus(self, sequence, codec): edouard@3884: # Create reference objects to pass into handler for out/inout parameters. edouard@3884: status = erpc.Reference() edouard@3884: edouard@3884: # Read incoming parameters. edouard@3884: edouard@3884: # Invoke user implementation of remote function. edouard@3884: _result = self._handler.GetPLCstatus(status) edouard@3884: edouard@3884: # Prepare codec for reply message. edouard@3884: codec.reset() edouard@3884: edouard@3884: # Construct reply message. edouard@3884: codec.start_write_message(erpc.codec.MessageInfo( edouard@3884: type=erpc.codec.MessageType.kReplyMessage, edouard@3884: service=interface.IBeremizPLCObjectService.SERVICE_ID, edouard@3884: request=interface.IBeremizPLCObjectService.GETPLCSTATUS_ID, edouard@3884: sequence=sequence)) edouard@3884: if status.value is None: edouard@3884: raise ValueError("status.value is None") edouard@3884: status.value._write(codec) edouard@3884: codec.write_uint32(_result) edouard@3884: edouard@3884: def _handle_GetTraceVariables(self, sequence, codec): edouard@3884: # Create reference objects to pass into handler for out/inout parameters. edouard@3884: traces = erpc.Reference() edouard@3884: edouard@3884: # Read incoming parameters. edouard@3884: debugToken = codec.read_uint32() edouard@3884: edouard@3884: # Invoke user implementation of remote function. edouard@3884: _result = self._handler.GetTraceVariables(debugToken, traces) edouard@3884: edouard@3884: # Prepare codec for reply message. edouard@3884: codec.reset() edouard@3884: edouard@3884: # Construct reply message. edouard@3884: codec.start_write_message(erpc.codec.MessageInfo( edouard@3884: type=erpc.codec.MessageType.kReplyMessage, edouard@3884: service=interface.IBeremizPLCObjectService.SERVICE_ID, edouard@3884: request=interface.IBeremizPLCObjectService.GETTRACEVARIABLES_ID, edouard@3884: sequence=sequence)) edouard@3884: if traces.value is None: edouard@3884: raise ValueError("traces.value is None") edouard@3884: traces.value._write(codec) edouard@3884: codec.write_uint32(_result) edouard@3884: edouard@3884: def _handle_MatchMD5(self, sequence, codec): edouard@3884: # Create reference objects to pass into handler for out/inout parameters. edouard@3884: match = erpc.Reference() edouard@3884: edouard@3884: # Read incoming parameters. edouard@3884: MD5 = codec.read_string() edouard@3884: edouard@3884: # Invoke user implementation of remote function. edouard@3884: _result = self._handler.MatchMD5(MD5, match) edouard@3884: edouard@3884: # Prepare codec for reply message. edouard@3884: codec.reset() edouard@3884: edouard@3884: # Construct reply message. edouard@3884: codec.start_write_message(erpc.codec.MessageInfo( edouard@3884: type=erpc.codec.MessageType.kReplyMessage, edouard@3884: service=interface.IBeremizPLCObjectService.SERVICE_ID, edouard@3884: request=interface.IBeremizPLCObjectService.MATCHMD5_ID, edouard@3884: sequence=sequence)) edouard@3884: if match.value is None: edouard@3884: raise ValueError("match.value is None") edouard@3884: codec.write_bool(match.value) edouard@3884: codec.write_uint32(_result) edouard@3884: edouard@3884: def _handle_NewPLC(self, sequence, codec): edouard@3884: # Create reference objects to pass into handler for out/inout parameters. edouard@3884: success = erpc.Reference() edouard@3884: edouard@3884: # Read incoming parameters. edouard@3884: md5sum = codec.read_string() edouard@3884: plcObjectBlobID = codec.read_binary() edouard@3884: _n0 = codec.start_read_list() edouard@3884: extrafiles = [] edouard@3884: for _i0 in range(_n0): edouard@3884: _v0 = common.extra_file()._read(codec) edouard@3884: extrafiles.append(_v0) edouard@3884: edouard@3884: edouard@3884: # Invoke user implementation of remote function. edouard@3884: _result = self._handler.NewPLC(md5sum, plcObjectBlobID, extrafiles, success) edouard@3884: edouard@3884: # Prepare codec for reply message. edouard@3884: codec.reset() edouard@3884: edouard@3884: # Construct reply message. edouard@3884: codec.start_write_message(erpc.codec.MessageInfo( edouard@3884: type=erpc.codec.MessageType.kReplyMessage, edouard@3884: service=interface.IBeremizPLCObjectService.SERVICE_ID, edouard@3884: request=interface.IBeremizPLCObjectService.NEWPLC_ID, edouard@3884: sequence=sequence)) edouard@3884: if success.value is None: edouard@3884: raise ValueError("success.value is None") edouard@3884: codec.write_bool(success.value) edouard@3884: codec.write_uint32(_result) edouard@3884: edouard@3884: def _handle_PurgeBlobs(self, sequence, codec): edouard@3884: # Read incoming parameters. edouard@3884: edouard@3884: # Invoke user implementation of remote function. edouard@3884: _result = self._handler.PurgeBlobs() edouard@3884: edouard@3884: # Prepare codec for reply message. edouard@3884: codec.reset() edouard@3884: edouard@3884: # Construct reply message. edouard@3884: codec.start_write_message(erpc.codec.MessageInfo( edouard@3884: type=erpc.codec.MessageType.kReplyMessage, edouard@3884: service=interface.IBeremizPLCObjectService.SERVICE_ID, edouard@3884: request=interface.IBeremizPLCObjectService.PURGEBLOBS_ID, edouard@3884: sequence=sequence)) edouard@3884: codec.write_uint32(_result) edouard@3884: edouard@3884: def _handle_RepairPLC(self, sequence, codec): edouard@3884: # Read incoming parameters. edouard@3884: edouard@3884: # Invoke user implementation of remote function. edouard@3884: _result = self._handler.RepairPLC() edouard@3884: edouard@3884: # Prepare codec for reply message. edouard@3884: codec.reset() edouard@3884: edouard@3884: # Construct reply message. edouard@3884: codec.start_write_message(erpc.codec.MessageInfo( edouard@3884: type=erpc.codec.MessageType.kReplyMessage, edouard@3884: service=interface.IBeremizPLCObjectService.SERVICE_ID, edouard@3884: request=interface.IBeremizPLCObjectService.REPAIRPLC_ID, edouard@3884: sequence=sequence)) edouard@3884: codec.write_uint32(_result) edouard@3884: edouard@3884: def _handle_ResetLogCount(self, sequence, codec): edouard@3884: # Read incoming parameters. edouard@3884: edouard@3884: # Invoke user implementation of remote function. edouard@3884: _result = self._handler.ResetLogCount() edouard@3884: edouard@3884: # Prepare codec for reply message. edouard@3884: codec.reset() edouard@3884: edouard@3884: # Construct reply message. edouard@3884: codec.start_write_message(erpc.codec.MessageInfo( edouard@3884: type=erpc.codec.MessageType.kReplyMessage, edouard@3884: service=interface.IBeremizPLCObjectService.SERVICE_ID, edouard@3884: request=interface.IBeremizPLCObjectService.RESETLOGCOUNT_ID, edouard@3884: sequence=sequence)) edouard@3884: codec.write_uint32(_result) edouard@3884: edouard@3884: def _handle_SeedBlob(self, sequence, codec): edouard@3884: # Create reference objects to pass into handler for out/inout parameters. edouard@3884: blobID = erpc.Reference() edouard@3884: edouard@3884: # Read incoming parameters. edouard@3884: seed = codec.read_binary() edouard@3884: edouard@3884: # Invoke user implementation of remote function. edouard@3884: _result = self._handler.SeedBlob(seed, blobID) edouard@3884: edouard@3884: # Prepare codec for reply message. edouard@3884: codec.reset() edouard@3884: edouard@3884: # Construct reply message. edouard@3884: codec.start_write_message(erpc.codec.MessageInfo( edouard@3884: type=erpc.codec.MessageType.kReplyMessage, edouard@3884: service=interface.IBeremizPLCObjectService.SERVICE_ID, edouard@3884: request=interface.IBeremizPLCObjectService.SEEDBLOB_ID, edouard@3884: sequence=sequence)) edouard@3884: if blobID.value is None: edouard@3884: raise ValueError("blobID.value is None") edouard@3884: codec.write_binary(blobID.value) edouard@3884: codec.write_uint32(_result) edouard@3884: edouard@3884: def _handle_SetTraceVariablesList(self, sequence, codec): edouard@3885: # Create reference objects to pass into handler for out/inout parameters. edouard@3885: debugtoken = erpc.Reference() edouard@3885: edouard@3884: # Read incoming parameters. edouard@3884: _n0 = codec.start_read_list() edouard@3884: orders = [] edouard@3884: for _i0 in range(_n0): edouard@3884: _v0 = common.trace_order()._read(codec) edouard@3884: orders.append(_v0) edouard@3884: edouard@3884: edouard@3884: # Invoke user implementation of remote function. edouard@3885: _result = self._handler.SetTraceVariablesList(orders, debugtoken) edouard@3884: edouard@3884: # Prepare codec for reply message. edouard@3884: codec.reset() edouard@3884: edouard@3884: # Construct reply message. edouard@3884: codec.start_write_message(erpc.codec.MessageInfo( edouard@3884: type=erpc.codec.MessageType.kReplyMessage, edouard@3884: service=interface.IBeremizPLCObjectService.SERVICE_ID, edouard@3884: request=interface.IBeremizPLCObjectService.SETTRACEVARIABLESLIST_ID, edouard@3884: sequence=sequence)) edouard@3885: if debugtoken.value is None: edouard@3885: raise ValueError("debugtoken.value is None") edouard@3941: codec.write_int32(debugtoken.value) edouard@3884: codec.write_uint32(_result) edouard@3884: edouard@3884: def _handle_StartPLC(self, sequence, codec): edouard@3884: # Read incoming parameters. edouard@3884: edouard@3884: # Invoke user implementation of remote function. edouard@3884: _result = self._handler.StartPLC() edouard@3884: edouard@3884: # Prepare codec for reply message. edouard@3884: codec.reset() edouard@3884: edouard@3884: # Construct reply message. edouard@3884: codec.start_write_message(erpc.codec.MessageInfo( edouard@3884: type=erpc.codec.MessageType.kReplyMessage, edouard@3884: service=interface.IBeremizPLCObjectService.SERVICE_ID, edouard@3884: request=interface.IBeremizPLCObjectService.STARTPLC_ID, edouard@3884: sequence=sequence)) edouard@3884: codec.write_uint32(_result) edouard@3884: edouard@3884: def _handle_StopPLC(self, sequence, codec): edouard@3885: # Create reference objects to pass into handler for out/inout parameters. edouard@3885: success = erpc.Reference() edouard@3885: edouard@3885: # Read incoming parameters. edouard@3885: edouard@3885: # Invoke user implementation of remote function. edouard@3885: _result = self._handler.StopPLC(success) edouard@3884: edouard@3884: # Prepare codec for reply message. edouard@3884: codec.reset() edouard@3884: edouard@3884: # Construct reply message. edouard@3884: codec.start_write_message(erpc.codec.MessageInfo( edouard@3884: type=erpc.codec.MessageType.kReplyMessage, edouard@3884: service=interface.IBeremizPLCObjectService.SERVICE_ID, edouard@3884: request=interface.IBeremizPLCObjectService.STOPPLC_ID, edouard@3884: sequence=sequence)) edouard@3885: if success.value is None: edouard@3885: raise ValueError("success.value is None") edouard@3885: codec.write_bool(success.value) edouard@3885: codec.write_uint32(_result) edouard@3885: edouard@4032: def _handle_ExtendedCall(self, sequence, codec): edouard@4032: # Create reference objects to pass into handler for out/inout parameters. edouard@4032: answer = erpc.Reference() edouard@4032: edouard@4032: # Read incoming parameters. edouard@4032: method = codec.read_string() edouard@4032: argument = codec.read_binary() edouard@4032: edouard@4032: # Invoke user implementation of remote function. edouard@4032: _result = self._handler.ExtendedCall(method, argument, answer) edouard@4032: edouard@4032: # Prepare codec for reply message. edouard@4032: codec.reset() edouard@4032: edouard@4032: # Construct reply message. edouard@4032: codec.start_write_message(erpc.codec.MessageInfo( edouard@4032: type=erpc.codec.MessageType.kReplyMessage, edouard@4032: service=interface.IBeremizPLCObjectService.SERVICE_ID, edouard@4032: request=interface.IBeremizPLCObjectService.EXTENDEDCALL_ID, edouard@4032: sequence=sequence)) edouard@4032: if answer.value is None: edouard@4032: raise ValueError("answer.value is None") edouard@4032: codec.write_binary(answer.value) edouard@4032: codec.write_uint32(_result) edouard@4032: edouard@4032: