summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xglucometer.py10
-rw-r--r--glucometerutils/drivers/sdcodefree.py15
2 files changed, 24 insertions, 1 deletions
diff --git a/glucometer.py b/glucometer.py
index dc5d78b..19a47a8 100755
--- a/glucometer.py
+++ b/glucometer.py
@@ -9,6 +9,7 @@ __license__ = 'MIT'
import argparse
import importlib
+import inspect
import logging
import sys
@@ -35,6 +36,9 @@ def main():
'https://docs.python.org/3/library/logging.html#logging-levels'))
subparsers.add_parser(
+ 'help', help=('Display a description of the driver, including supported '
+ 'features and known quirks.'))
+ subparsers.add_parser(
'info', help='Display information about the meter.')
subparsers.add_parser(
'zero', help='Zero out the data log of the meter.')
@@ -67,6 +71,12 @@ def main():
args.driver)
return 1
+ # This check needs to happen before we try to initialize the device, as the
+ # help action does not require a --device at all.
+ if args.action == 'help':
+ print(inspect.getdoc(driver))
+ return 0
+
device = driver.Device(args.device)
device.connect()
diff --git a/glucometerutils/drivers/sdcodefree.py b/glucometerutils/drivers/sdcodefree.py
index 9aeb653..5bcdab2 100644
--- a/glucometerutils/drivers/sdcodefree.py
+++ b/glucometerutils/drivers/sdcodefree.py
@@ -1,5 +1,18 @@
# -*- coding: utf-8 -*-
-"""Driver for SD CodeFree devices by SD Biosensor"""
+"""Driver for SD CodeFree devices by SD Biosensor.
+
+For SD Biosensor glucometers using the serial interface.
+
+Supported features:
+ - get readings, including pre-/post-meal notes;
+ - set date and time.
+
+Expected device path: /dev/ttyUSB0 or similar serial port device.
+
+IMPORTANT NOTE: the glucometer can be connected before starting the program, but
+it has to be turned on when the program asks you to.
+"""
+
__author__ = 'Diego Elio Pettenò'
__email__ = 'flameeyes@flameeyes.eu'