diff options
author | Magnus Feuer <mfeuer@jaguarlandrover.com> | 2015-03-04 19:14:16 -0800 |
---|---|---|
committer | Magnus Feuer <mfeuer@jaguarlandrover.com> | 2015-03-04 19:14:16 -0800 |
commit | a59e0d6f1a4c51fc249309de9158395a2bed92c5 (patch) | |
tree | 66b6edb65df0b24a388ec1c0225e9196ae808014 /python/rvi_service.py | |
parent | 9f11329836f8710274102b6d57d1ebc65a3ec31b (diff) | |
download | rvi_core-a59e0d6f1a4c51fc249309de9158395a2bed92c5.tar.gz |
Added register/unregister. Added get_services.py to list all available services
Diffstat (limited to 'python/rvi_service.py')
-rwxr-xr-x | python/rvi_service.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/python/rvi_service.py b/python/rvi_service.py index 36817ce..e1b705c 100755 --- a/python/rvi_service.py +++ b/python/rvi_service.py @@ -49,6 +49,23 @@ def service_invoked(**args): sys.stdout.flush() return ['ok'] +def services_available(**args): + print + print "Services available!" + print "args:", args + print + sys.stdout.write("Press enter to quit: ") + sys.stdout.flush() + return ['ok'] + +def services_unavailable(**args): + print + print "Services unavailable!" + print "args:", args + print + sys.stdout.write("Press enter to quit: ") + sys.stdout.flush() + return ['ok'] if len(sys.argv) != 3: @@ -65,6 +82,9 @@ rvi = RVI(rvi_node_url) rvi.start_serve_thread() +rvi.set_services_available_callback(services_available) +rvi.set_services_unavailable_callback(services_unavailable) + # Register our service and invoke 'service_invoked' if we # get an incoming JSON-RPC call to it from the RVI node # @@ -76,5 +96,6 @@ print "RVI node URL: ", rvi_node_url print "Service: ", full_service_name raw_input('Press enter to quit: ') +rvi.unregister_service(service_name) rvi.shutdown() sys.exit(0) |