From 84c6afb6466bc9909e2676fc8e5b941c8c8ebb25 Mon Sep 17 00:00:00 2001 From: Hal Simpson <hasimpson@usgs.gov> Date: Tue, 23 Jun 2015 00:22:02 -0600 Subject: [PATCH] Added static variables of FORCEOUT and TAG to keep -1/-2 number of sample special cases from getting mixed up, like I did. --- geomagio/edge/RawInputClient.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/geomagio/edge/RawInputClient.py b/geomagio/edge/RawInputClient.py index c7fe0e359..d3e4b5005 100644 --- a/geomagio/edge/RawInputClient.py +++ b/geomagio/edge/RawInputClient.py @@ -29,6 +29,9 @@ MAXINPUTSIZE = 32767 HOURSECONDS = 3600 DAYMINUTES = 1440 +TAG = -1 +FORCEOUT = -2 + class RawInputClient(): Sequence = 0 @@ -262,11 +265,12 @@ class RawInputClient(): ratedivisor = -10000 # Construct the packet to be sent. - packStr = '!1H1h12s4h4B3i0i' + packStr = '!1H1h12s4h4B3i' if forceout: - buf = struct.pack(packStr, 0xa1b2, -1, seedname, yr, doy, - ratemantissa, ratedivisor, activity, ioclock, quality, - timingquality, secs, usecs, RawInputClient.Sequence) + buf = struct.pack(packStr, 0xa1b2, FORCEOUT, seedname, yr, + doy, ratemantissa, ratedivisor, activity, ioclock, + quality, timingquality, secs, usecs, + RawInputClient.Sequence) else: packStr = '%s%d%s' % (packStr, nsamp, 'i') buf = struct.pack(packStr, 0xa1b2, nsamp, seedname, yr, doy, @@ -333,5 +337,6 @@ class RawInputClient(): The Packet must be 40 Bytes long. """ tg = self.tag + ' ' - tb = struct.pack('!1H1h12s6i', 0xa1b2, -1, tg[:12], 0, 0, 0, 0, 0, 0) + tb = struct.pack('!1H1h12s6i', 0xa1b2, TAG, tg[:12], + 0, 0, 0, 0, 0, 0) return tb -- GitLab