summaryrefslogtreecommitdiff
path: root/test/module
diff options
context:
space:
mode:
Diffstat (limited to 'test/module')
-rwxr-xr-xtest/module/test.py20
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)