summaryrefslogtreecommitdiffstats
path: root/glucometer.py
diff options
context:
space:
mode:
authorDiego Elio Pettenò <flameeyes@flameeyes.eu>2013-08-03 10:07:41 +0200
committerDiego Elio Pettenò <flameeyes@flameeyes.eu>2013-08-03 10:07:41 +0200
commit389f424b0b541e581115d4cda355cd2c44118e1f (patch)
treeb83b3b42d4ddb2be764ba841bbd725528d83c413 /glucometer.py
downloadglucometerutils-389f424b0b541e581115d4cda355cd2c44118e1f.tar
glucometerutils-389f424b0b541e581115d4cda355cd2c44118e1f.tar.gz
glucometerutils-389f424b0b541e581115d4cda355cd2c44118e1f.tar.bz2
glucometerutils-389f424b0b541e581115d4cda355cd2c44118e1f.tar.lz
glucometerutils-389f424b0b541e581115d4cda355cd2c44118e1f.tar.xz
glucometerutils-389f424b0b541e581115d4cda355cd2c44118e1f.tar.zst
glucometerutils-389f424b0b541e581115d4cda355cd2c44118e1f.zip
Diffstat (limited to 'glucometer.py')
-rw-r--r--glucometer.py42
1 files changed, 42 insertions, 0 deletions
diff --git a/glucometer.py b/glucometer.py
new file mode 100644
index 0000000..69748b4
--- /dev/null
+++ b/glucometer.py
@@ -0,0 +1,42 @@
+#!/usr/bin/env python
+"""Utility to manage glucometers' data."""
+
+__author__ = 'Diego Elio Pettenò'
+__email__ = 'flameeyes@flameeyes.eu'
+__copyright__ = 'Copyright © 2013, Diego Elio Pettenò'
+__license__ = 'GPL v3 or later'
+
+import argparse
+import importlib
+import sys
+
+from glucometerutils import constants
+from glucometerutils.drivers import otultra2
+
+def main(argv=sys.argv):
+ parser = argparse.ArgumentParser()
+ subparsers = parser.add_subparsers()
+
+ parser.add_argument(
+ '--driver', action='store', required=True,
+ help='Select the driver to use for connecting to the glucometer.')
+ parser.add_argument(
+ '--device', action='store', required=True,
+ help='Select the path to the glucometer device.')
+
+ parser_dump = subparsers.add_parser(
+ 'dump', help='Dump the readings stored in the device.')
+
+ parser_date = subparsers.add_parser(
+ 'datetime', help='Reads or sets the date and time of the glucometer.')
+ parser_date.add_argument(
+ '--set', action='store_true',
+ help='Set the date rather than just reading it from the device.')
+
+ args = parser.parse_args()
+
+ driver = importlib.import_module('glucometerutils.drivers.' + args.driver)
+ device = driver.Device(args.device)
+
+if __name__ == "__main__":
+ main()