Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
_v1 = codec.read_int32()
_v0.append(_v1)
matrix2.append(_v0)
codec.end_read_message()
# Invoke user implementation of remote function.
self._handler.erpcMatrixMultiply(matrix1, matrix2, result_matrix)
# Prepare codec for reply message.
codec.reset()
# Construct reply message.
codec.start_write_message(erpc.codec.MessageInfo(
type=erpc.codec.MessageType.kReplyMessage,
service=interface.IMatrixMultiplyService.SERVICE_ID,
request=interface.IMatrixMultiplyService.ERPCMATRIXMULTIPLY_ID,
sequence=sequence))
if result_matrix.value is None:
raise ValueError("result_matrix is None")
for _i0 in result_matrix.value:
for _i1 in _i0:
codec.write_int32(_i1)
codec.end_write_message()
def erpcMatrixMultiply(self, matrix1, matrix2, result_matrix):
assert type(result_matrix) is erpc.Reference, "out parameter must be a Reference object"
# Build remote function invocation message.
request = self._clientManager.create_request()
codec = request.codec
codec.start_write_message(erpc.codec.MessageInfo(
type=erpc.codec.MessageType.kInvocationMessage,
service=self.SERVICE_ID,
request=self.ERPCMATRIXMULTIPLY_ID,
sequence=request.sequence))
if matrix1 is None:
raise ValueError("matrix1 is None")
for _i0 in matrix1:
for _i1 in _i0:
codec.write_int32(_i1)
if matrix2 is None:
raise ValueError("matrix2 is None")
for _i0 in matrix2:
for _i1 in _i0:
codec.write_int32(_i1)
for _i1 in range(5):
_v1 = codec.read_int32()
_v0.append(_v1)
matrix2.append(_v0)
codec.end_read_message()
# Invoke user implementation of remote function.
self._handler.erpcMatrixMultiply(matrix1, matrix2, result_matrix)
# Prepare codec for reply message.
codec.reset()
# Construct reply message.
codec.start_write_message(erpc.codec.MessageInfo(
type=erpc.codec.MessageType.kReplyMessage,
service=interface.IMatrixMultiplyService.SERVICE_ID,
request=interface.IMatrixMultiplyService.ERPCMATRIXMULTIPLY_ID,
sequence=sequence))
if result_matrix.value is None:
raise ValueError("result_matrix is None")
for _i0 in result_matrix.value:
for _i1 in _i0:
codec.write_int32(_i1)
codec.end_write_message()
def erpcMatrixMultiply(self, matrix1, matrix2, result_matrix):
assert type(result_matrix) is erpc.Reference, "out parameter must be a Reference object"
# Build remote function invocation message.
request = self._clientManager.create_request()
codec = request.codec
codec.start_write_message(erpc.codec.MessageInfo(
type=erpc.codec.MessageType.kInvocationMessage,
service=self.SERVICE_ID,
request=self.ERPCMATRIXMULTIPLY_ID,
sequence=request.sequence))
if matrix1 is None:
raise ValueError("matrix1 is None")
for _i0 in matrix1:
for _i1 in _i0:
codec.write_int32(_i1)
if matrix2 is None:
raise ValueError("matrix2 is None")
for _i0 in matrix2:
for _i1 in _i0:
codec.write_int32(_i1)
def _handle_erpcMatrixMultiply(self, sequence, codec):
# Create reference objects to pass into handler for out/inout parameters.
result_matrix = erpc.Reference()
# Read incoming parameters.
matrix1 = []
for _i0 in range(5):
_v0 = []
for _i1 in range(5):
_v1 = codec.read_int32()
_v0.append(_v1)
matrix1.append(_v0)
matrix2 = []
for _i0 in range(5):
_v0 = []
for _i1 in range(5):
_v1 = codec.read_int32()
def erpcMatrixMultiply(self, matrix1, matrix2, result_matrix):
assert type(result_matrix) is erpc.Reference, "out parameter must be a Reference object"
# Build remote function invocation message.
request = self._clientManager.create_request()
codec = request.codec
codec.start_write_message(erpc.codec.MessageInfo(
type=erpc.codec.MessageType.kInvocationMessage,
service=self.SERVICE_ID,
request=self.ERPCMATRIXMULTIPLY_ID,
sequence=request.sequence))
if matrix1 is None:
raise ValueError("matrix1 is None")
for _i0 in matrix1:
for _i1 in _i0:
codec.write_int32(_i1)
def encodeParam(fsig, param, sig):
return fsig[0:8] + abi.encode_abi(sig, param).encode("hex")
def processedAbi(args, data):
results = abi.decode_abi(args, data[2:].decode("hex"))
for i in range(0, len(args)):
if args[i] == "bytes32":
results[i] = results[i].encode("hex")
return results
def getEvents(scABI):
events = []
for i in scABI:
if i["type"] == "event":
args = []
for j in i["inputs"]:
args.append(j["type"])
esig = i["name"] + "(" + ','.join(args) + ")"
event = {
"hash": '0x' + utils.sha3(esig).encode("hex"),
"argsig": args,
"name": esig
}
events.append(event)
return events
#
# Generated by erpcgen 1.4.0 on Tue May 9 14:15:10 2017.
#
# AUTOGENERATED - DO NOT EDIT
#
import erpc
from . import common, interface
# Client for MatrixMultiplyService
class MatrixMultiplyServiceService(erpc.server.Service):
def __init__(self, handler):
super(MatrixMultiplyServiceService, self).__init__(interface.IMatrixMultiplyService.SERVICE_ID)
self._handler = handler
self._methods = {
interface.IMatrixMultiplyService.ERPCMATRIXMULTIPLY_ID: self._handle_erpcMatrixMultiply,
}
def _handle_erpcMatrixMultiply(self, sequence, codec):
# Create reference objects to pass into handler for out/inout parameters.
result_matrix = erpc.Reference()
# Read incoming parameters.
matrix1 = []
for _i0 in range(5):
_v0 = []
for _i1 in range(5):