-
Notifications
You must be signed in to change notification settings - Fork 252
Expand file tree
/
Copy pathmain_client.py
More file actions
37 lines (26 loc) · 812 Bytes
/
main_client.py
File metadata and controls
37 lines (26 loc) · 812 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/python3
#
# Copyright 2023 NXP
#
# SPDX-License-Identifier: BSD-3-Clause
#
from erpc.basic_codec import BasicCodec
from erpc.client import ClientManager
from erpc.transport import TCPTransport
import config
from shim import hello_world
def main():
# load configuration macros from C header file
cfg = config.lead_config("../config.h")
# init eRPC client infrastructure
transport = TCPTransport(cfg["ERPC_HOSTNAME"], int(cfg["ERPC_PORT"]), False)
client_manager = ClientManager(transport, BasicCodec)
# init eRPC client
client = hello_world.client.TextServiceClient(client_manager)
# do eRPC call
if client.printText("Hello world!"):
print("Message received by server.")
# Stop server
client.stopServer()
if __name__ == "__main__":
main()