Ejemplo n.º 1
0
    def cb_acquire(self): 
        print 'Acquiring data'
        import store

        omron_obj = omron.Omron()

        if omron_obj.open() < 0:
            print 'Failed to open device'
            return

        ret = omron_obj.get_device_version()
        if not ret: print 'Failed to get device version'
        else: print 'Opened device version %s' % ret

        ret = omron_obj.get_bp_profile()
        if not ret: print 'Failed to get device profile'
        else: print 'Opened device with profile: %s' % ret

        data_count = omron_obj.get_daily_data_count()
        print 'Trying to get %d readings' % data_count

        def bad_data(data):
            return not data.day and not data.month and not data.year and \
                not data.hour and not data.minute and not data.second and \
                not data.sys and not data.dia and not data.pulse

        for ind in range(data_count-1, -1, -1):
            for trial in range(3):
                bp_data = omron_obj.get_daily_bp_data(ind)
                if bad_data(bp_data): continue
                break
            tsec = store.ymdhms2seconds(bp_data.year, bp_data.month,
                                        bp_data.day, bp_data.hour,
                                        bp_data.minute, bp_data.second)
            print trial, tsec, bp_data.sys, bp_data.dia, bp_data.pulse

            if bad_data(bp_data): continue

            self.data.add(tsec, bp_data.sys, bp_data.dia, bp_data.pulse)
            continue

        self.cb_update_plot()
        return
Ejemplo n.º 2
0
data_count = o.get_daily_data_count();
print 'AJR data count: %d'%data_count
if data_count < 0:
    print 'Cannot get device prf!'

def bad_data(r):
    return not r.day and not r.month and not r.year and \
        not r.hour and not r.minute and not r.second and \
        not r.sys and not r.dia and not r.pulse


d = store.Data()
for ind in range(data_count-1,-1,-1):
    for trial in range(3):
        r = o.get_daily_bp_data(ind)
        print ind,trial,r.year,r.month,r.day,r.hour,r.minute,r.second
        if bad_data(r): continue
        break

    ts = store.ymdhms2seconds(r.year,r.month,r.day,r.hour,r.minute,r.second)
    print trial, ts,r.sys,r.dia,r.pulse

    if bad_data(r): continue

    d.add(ts,r.sys,r.dia,r.pulse)

    continue



Ejemplo n.º 3
0
data_count = o.get_daily_data_count()
print 'AJR data count: %d' % data_count
if data_count < 0:
    print 'Cannot get device prf!'


def bad_data(r):
    return not r.day and not r.month and not r.year and \
        not r.hour and not r.minute and not r.second and \
        not r.sys and not r.dia and not r.pulse


d = store.Data()
for ind in range(data_count - 1, -1, -1):
    for trial in range(3):
        r = o.get_daily_bp_data(ind)
        print ind, trial, r.year, r.month, r.day, r.hour, r.minute, r.second
        if bad_data(r): continue
        break

    ts = store.ymdhms2seconds(r.year, r.month, r.day, r.hour, r.minute,
                              r.second)
    print trial, ts, r.sys, r.dia, r.pulse

    if bad_data(r): continue

    d.add(ts, r.sys, r.dia, r.pulse)

    continue