MCPcopy Create free account
hub / github.com/EmbeddedRPC/erpc / runClient

Function runClient

examples/matrix_multiply_python/matrix_multiply.py:99–130  ·  view source on GitHub ↗
(transport)

Source from the content-addressed store, hash-verified

97
98## Run client on specified transport layer
99def runClient(transport):
100 # create matrix multiply eRPC service
101 clientManager = erpc.client.ClientManager(transport, erpc.basic_codec.BasicCodec)
102 client = erpc_matrix_multiply.client.MatrixMultiplyServiceClient(clientManager)
103
104 while True:
105 # create matrices with random values
106 matrix1 = fillMatrix(matrix_size, MAX_VALUE)
107 matrix2 = fillMatrix(matrix_size, MAX_VALUE)
108
109 # print matrices to the console
110 print('\r\nMatrix #1\r\n=========')
111 printMatrix(matrix1)
112
113 print('\r\nMatrix #2\r\n=========')
114 printMatrix(matrix2)
115
116 # create result matrix as eRPC reference object
117 resultMatrix = erpc.Reference()
118
119 # send request to the server
120 print('\r\neRPC request is sent to the server')
121 client.erpcMatrixMultiply(matrix1, matrix2, resultMatrix)
122
123 # print result matrix's value
124 print('\r\nResult matrix\r\n=============')
125 printMatrix(resultMatrix.value)
126
127 # wait for key press
128 print('\r\nPress Enter to initiate the next matrix multiplication')
129 sys.stdout.flush()
130 input_fn()
131
132###############################################################################
133# Main

Callers 1

matrix_multiply.pyFile · 0.70

Calls 6

erpcMatrixMultiplyMethod · 0.95
fillMatrixFunction · 0.85
printMatrixFunction · 0.85
ReferenceMethod · 0.80
ClientManagerMethod · 0.45

Tested by

no test coverage detected