diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2018-05-27 03:36:38 +0200 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2018-05-27 03:36:38 +0200 |
| commit | 10eab813d70a203e5b81583eac165e33a1bf6f6d (patch) | |
| tree | 3840a1fc534129b5b7b439fd7899cc8c8ae0e016 /test/module | |
| parent | e4957554e777bd9e25097fcb4db40686848a908c (diff) | |
auto scroll to bottom
Diffstat (limited to 'test/module')
| -rwxr-xr-x | test/module/test.py | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/test/module/test.py b/test/module/test.py index b9e7059..e78f932 100755 --- a/test/module/test.py +++ b/test/module/test.py @@ -1,3 +1,4 @@ +import time import importlib.util spec = importlib.util.spec_from_file_location("CortexRPC", "../../rpc/rpc.py") rpc_module = importlib.util.module_from_spec(spec) @@ -5,14 +6,26 @@ spec.loader.exec_module(rpc_module) CortexRPC = rpc_module.CortexRPC if __name__ == '__main__': - def get_params(key, value): + params = {} + + def get_params(): print('get params.') - return 'test' + return params + def set_param(key, value): print('log param. {}: {}'.format(key, value)) + params[key] = value return 'ok' - def ready(key): + + def ready(self): + print("Connected!") + i = 0 + while 1: + print('{}...'.format(i)) + i = i+1 + time.sleep(1) return 'ready' + def process_cmd(cmd, payload): print('process command', cmd, payload) return 'processed' @@ -47,4 +60,5 @@ if __name__ == '__main__': """ # this will block + print("Connecting to relay...") rpc = CortexRPC(get_params, set_param, ready, process_cmd) |
