From 1602879e1ea415d477eb1826bdc18ceb58dc1239 Mon Sep 17 00:00:00 2001 From: Nadja Reitzenstein Date: Wed, 18 Jan 2023 16:30:24 +0100 Subject: [PATCH] Example actor implementation --- examples/actor.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/examples/actor.py b/examples/actor.py index 489260c..c2824f5 100755 --- a/examples/actor.py +++ b/examples/actor.py @@ -100,6 +100,14 @@ def on_reserve(args, actor_name, user_id): print("process called with unexpected combo id %s and state 'Reserved'" % actor_name) exit(-1) +def on_raw(args, actor_name, data): + """ + Function called when a raw_write call was issued for the connected machine + + data is the data passed with that call, base64-encoded + """ + if args.verbose > 2: + print("on_raw called! data=" + data) def main(args): """ @@ -138,6 +146,8 @@ def main(args): on_disabled(args, args.name) elif new_state == "reserved": on_reserve(args, args.name, args.userid) + elif new_state == "raw": + on_raw(args, args.name, args.data) else: print("Process actor called with unknown state %s" % new_state) @@ -175,5 +185,8 @@ if __name__ == "__main__": parser_reserved = subparsers.add_parser("reserved") parser_reserved.add_argument("userid", help="The user that reserved the machine") + parser_raw = subparsers.add_parser("raw") + parser_raw.add_argument("data", help="Raw data set for this actor") + args = parser.parse_args() main(args)