コード例 #1
0
ファイル: medtronic.py プロジェクト: addie/openaps
 def setup_medtronic(self):
     log = logging.getLogger(decocare.__name__)
     log.setLevel(logging.INFO)
     log.addHandler(logging.handlers.SysLogHandler(address='/dev/log'))
     self.uart = stick.Stick(link.Link(self.scanner()))
     self.uart.open()
     serial = self.device.fields['serial']
     self.pump = session.Pump(self.uart, serial)
     stats = self.uart.interface_stats()
コード例 #2
0
 def setup_medtronic (self):
   log = logging.getLogger(decocare.__name__)
   level = getattr(logging, self.device.get('logLevel', 'WARN'))
   address = self.device.get('logAddress', '/dev/log')
   log.setLevel(level)
   for previous in log.handlers[:]:
     log.removeHandler(previous)
   log.addHandler(logging.handlers.SysLogHandler(address=address))
   self.uart = stick.Stick(link.Link(self.scanner( )))
   self.uart.open( )
   serial = self.device.get('serial')
   self.pump = session.Pump(self.uart, serial)
   stats = self.uart.interface_stats( )
コード例 #3
0
    def prelude(self, args):
        if args.no_prelude:
            print "##### skipping prelude"
            return
        print "## do stuff with an insulin pump over RF"
        print "using", "`", args, "`"

        print "```"
        if args.port == 'scan' or args.port == "":
            args.port = scan.scan()
        uart = stick.Stick(link.Link(args.port))
        print "```"
        print "```"
        uart.open()
        print "```"
        print "```"
        pump = session.Pump(uart, args.serial)
        print "```"
        print "```"
        stats = uart.interface_stats()
        print "```"
        print "```javascript"
        print pformat(stats)
        print "```"
        self.uart = uart
        self.pump = pump
        self.model = None
        if args.no_rf_prelude:
            print "##### skipping normal RF preludes"
            return
        print "```"
        if not args.autoinit:
            if args.init:
                pump.power_control(minutes=args.session_life)
            model = pump.read_model()
            self.model = model
        else:
            self.autoinit(args)
        print "```"
        print '### PUMP MODEL: `%s`' % self.model
コード例 #4
0
ファイル: medtronic.py プロジェクト: scottleibrand/openaps
 def setup_medtronic (self):
   self.uart = stick.Stick(link.Link(self.scanner( )))
   self.uart.open( )
   serial = self.device.fields['serial']
   self.pump = session.Pump(self.uart, serial)
   stats = self.uart.interface_stats( )