summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDiego Elio Pettenò <flameeyes@flameeyes.eu>2013-08-03 10:56:57 +0200
committerDiego Elio Pettenò <flameeyes@flameeyes.eu>2013-08-03 10:56:57 +0200
commit0de4ea1cabde2c0333b806e8a21dcc67bd520a64 (patch)
tree39f7753199c121b6515898c1af88cf15bb45522c
parentAdd tests for the glucose unit conversion. (diff)
downloadglucometerutils-0de4ea1cabde2c0333b806e8a21dcc67bd520a64.tar
glucometerutils-0de4ea1cabde2c0333b806e8a21dcc67bd520a64.tar.gz
glucometerutils-0de4ea1cabde2c0333b806e8a21dcc67bd520a64.tar.bz2
glucometerutils-0de4ea1cabde2c0333b806e8a21dcc67bd520a64.tar.lz
glucometerutils-0de4ea1cabde2c0333b806e8a21dcc67bd520a64.tar.xz
glucometerutils-0de4ea1cabde2c0333b806e8a21dcc67bd520a64.tar.zst
glucometerutils-0de4ea1cabde2c0333b806e8a21dcc67bd520a64.zip
-rw-r--r--glucometer.py15
1 files changed, 13 insertions, 2 deletions
diff --git a/glucometer.py b/glucometer.py
index 69748b4..a288dae 100644
--- a/glucometer.py
+++ b/glucometer.py
@@ -10,12 +10,12 @@ import argparse
import importlib
import sys
-from glucometerutils import constants
+from glucometerutils import common
from glucometerutils.drivers import otultra2
def main(argv=sys.argv):
parser = argparse.ArgumentParser()
- subparsers = parser.add_subparsers()
+ subparsers = parser.add_subparsers(dest="action")
parser.add_argument(
'--driver', action='store', required=True,
@@ -38,5 +38,16 @@ def main(argv=sys.argv):
driver = importlib.import_module('glucometerutils.drivers.' + args.driver)
device = driver.Device(args.device)
+ if args.action == 'dump':
+ for reading in device.GetReadings():
+ print('%s,%f' % reading)
+ elif args.action == 'datetime':
+ if args.set:
+ print(device.SetDateTime())
+ else:
+ print(device.GetDateTime())
+ else:
+ return 1
+
if __name__ == "__main__":
main()