summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--glucometerutils/drivers/fsoptium.py9
-rw-r--r--glucometerutils/drivers/otultra2.py10
-rw-r--r--glucometerutils/drivers/otultraeasy.py10
-rw-r--r--glucometerutils/drivers/sdcodefree.py13
4 files changed, 21 insertions, 21 deletions
diff --git a/glucometerutils/drivers/fsoptium.py b/glucometerutils/drivers/fsoptium.py
index 2be063e..a380c96 100644
--- a/glucometerutils/drivers/fsoptium.py
+++ b/glucometerutils/drivers/fsoptium.py
@@ -80,12 +80,11 @@ def _parse_clock(datestr):
class Device(object):
def __init__(self, device):
if not device:
- raise exceptions.CommandLineError(
- '--device parameter is required, should point to the serial device '
- 'connected to the meter.')
+ logging.info('No --device parameter provided, looking for default cable.')
+ device = 'hwgrep://1a61:3420'
- self.serial_ = serial.Serial(
- port=device, baudrate=19200, bytesize=serial.EIGHTBITS,
+ self.serial_ = serial.serial_for_url(
+ device, baudrate=19200, bytesize=serial.EIGHTBITS,
parity=serial.PARITY_NONE, stopbits=serial.STOPBITS_ONE,
timeout=1, xonxoff=True, rtscts=False, dsrdtr=False, writeTimeout=None)
diff --git a/glucometerutils/drivers/otultra2.py b/glucometerutils/drivers/otultra2.py
index 21d6743..28a4771 100644
--- a/glucometerutils/drivers/otultra2.py
+++ b/glucometerutils/drivers/otultra2.py
@@ -7,6 +7,7 @@ __copyright__ = 'Copyright © 2013-2017, Diego Elio Pettenò'
__license__ = 'MIT'
import datetime
+import logging
import re
import serial
@@ -125,12 +126,11 @@ def _parse_datetime(response):
class Device(object):
def __init__(self, device):
if not device:
- raise exceptions.CommandLineError(
- '--device parameter is required, should point to the serial device '
- 'connected to the meter.')
+ logging.info('No --device parameter provided, looking for default cable.')
+ device = 'hwgrep://067b:2303'
- self.serial_ = serial.Serial(
- port=device, baudrate=9600, bytesize=serial.EIGHTBITS,
+ self.serial_ = serial.serial_for_url(
+ device, baudrate=9600, bytesize=serial.EIGHTBITS,
parity=serial.PARITY_NONE, stopbits=serial.STOPBITS_ONE,
timeout=1, xonxoff=False, rtscts=False, dsrdtr=False, writeTimeout=None)
diff --git a/glucometerutils/drivers/otultraeasy.py b/glucometerutils/drivers/otultraeasy.py
index ce68625..2976b9e 100644
--- a/glucometerutils/drivers/otultraeasy.py
+++ b/glucometerutils/drivers/otultraeasy.py
@@ -8,6 +8,7 @@ __license__ = 'MIT'
import array
import datetime
+import logging
import re
import struct
import time
@@ -178,12 +179,11 @@ class _Packet(object):
class Device(object):
def __init__(self, device):
if not device:
- raise exceptions.CommandLineError(
- '--device parameter is required, should point to the serial device '
- 'connected to the meter.')
+ logging.info('No --device parameter provided, looking for default cable.')
+ device = 'hwgrep://067b:2303'
- self.serial_ = serial.Serial(
- port=device, baudrate=9600, bytesize=serial.EIGHTBITS,
+ self.serial_ = serial.serial_for_url(
+ device, baudrate=9600, bytesize=serial.EIGHTBITS,
parity=serial.PARITY_NONE, stopbits=serial.STOPBITS_ONE,
timeout=1, xonxoff=False, rtscts=False, dsrdtr=False, writeTimeout=None)
diff --git a/glucometerutils/drivers/sdcodefree.py b/glucometerutils/drivers/sdcodefree.py
index 19644f6..0cd0b28 100644
--- a/glucometerutils/drivers/sdcodefree.py
+++ b/glucometerutils/drivers/sdcodefree.py
@@ -10,6 +10,7 @@ import array
import collections
import datetime
import functools
+import logging
import operator
import struct
import time
@@ -66,12 +67,12 @@ def xor_checksum(msg):
class Device(object):
def __init__(self, device):
if not device:
- raise exceptions.CommandLineError(
- '--device parameter is required, should point to the serial '
- 'device connected to the meter.')
+ logging.info(
+ 'No --device parameter provided, looking for default cable.')
+ device = 'hwgrep://10c4:ea60'
- self.serial_ = serial.Serial(
- port=device, baudrate=38400, bytesize=serial.EIGHTBITS,
+ self.serial_ = serial.serial_for_url(
+ device, baudrate=38400, bytesize=serial.EIGHTBITS,
parity=serial.PARITY_NONE, stopbits=serial.STOPBITS_ONE,
timeout=300, xonxoff=False, rtscts=False, dsrdtr=False,
writeTimeout=None)
@@ -177,7 +178,7 @@ class Device(object):
# The date we return should only include up to minute, unfortunately.
return datetime.datetime(date.year, date.month, date.day,
- date.hour, date.minute)
+ date.hour, date.minute)
def zero_log(self):
raise NotmplementedError