From 37e80e62d431a3effd2c24ced3b01a4da904a5e4 Mon Sep 17 00:00:00 2001 From: David Phillips Date: Tue, 28 Aug 2018 18:06:37 +1200 Subject: Add TODO file, sample Python alarms client --- TODO | 5 +++++ alarm-tools/sample.py | 18 ++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 TODO create mode 100755 alarm-tools/sample.py diff --git a/TODO b/TODO new file mode 100644 index 0000000..b6fb96b --- /dev/null +++ b/TODO @@ -0,0 +1,5 @@ +- Watch /proc/ and destroy alarms last owned by processes when they die +- Allow ownership change so long as uuid can be given +- Python binding needs more error messages, docs + - Python binding needs to hook into libalarm surely + - Python binding needs renaming diff --git a/alarm-tools/sample.py b/alarm-tools/sample.py new file mode 100755 index 0000000..0adac18 --- /dev/null +++ b/alarm-tools/sample.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python + +# NOTE: Requires PYTHONPATH to be set to ../lib/python if using the working +# tree module + +import alarms +import time + +if __name__ == "__main__": + sock = alarms.connect("/tmp/alarmd") + uuid = alarms.register_alarm(sock, "Test alarm") + time.sleep(10) + alarms.raise_alarm(sock, uuid) + time.sleep(10) + alarms.clear_alarm(sock, uuid) + time.sleep(10) + alarms.deregister_alarm(sock, uuid) + alarms.disconnect(sock) -- cgit v1.1