-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Are Oelsner edited this page Jul 5, 2022
·
1 revision
Author: Are Oelsner
Gateway gRPC code simulating communication between an app and a simple neural implant with four electrodes.
The App and the device communicate through gRPC for getting and setting individual electrode states.
python ./python/gateway_server.py
python ./python/gateway_client.py
< see Client command formats below>
get: get <(int) electrode number (0-3)>
set: set <(int) electrode number (0-3)> <(int) electrode state(>=0)>
PS C:\PATH\gRPC_Gateway> python .\python\gateway_server.py
PS C:\PATH\gRPC_Gateway> python .\python\gateway_client.py
please enter command: get 1
getting electrode 1 state...
electrode 1 state: 0
please enter command: set 1 100
setting electrode 1 state to 100...
electrode 1 state set to 100
please enter command: get 1
getting electrode 1 state...
electrode 1 state: 100
from gRPC_Gateway directory
# <python protoc compiler> -I<path to protos folder> --python_out=<path to new pb2 file> --grpc_python_out=<path to new pb2_grpc file> <path to proto file>
$ python -m grpc_tools.protoc -I./protos --python_out=./python --grpc_python_out=./python ./protos/gateway.proto