コード例 #1
0
 def _inventory(self, *args, **kwargs):
     try:
         s = Serial(port=args[0], baudrate=115200)
         r = Reader(s, self.hb)
         r.inventory(cb=self.on_txt)
     finally:
         self.f_running = False
         self.set_status('Closed ' + self.selected_port())
コード例 #2
0
def main():
    print "ST110"
    finish = False
    s = Serial(port=port, baudrate=115200)
    b = False
    delay = 3
    reader = Reader(s)
    #for i in range(5):
        #b ^= 1
        #reader.set_heartbeat(b)
        #time.sleep(delay)
        #reader.run = False
    epc = reader.inventory()
    print epc
コード例 #3
0
 def _readfromtag(self, *args, **kwargs):
     membank = self._app.config.getint('section1', 'membank')
     length = self._app.config.getint('section1', 'length')
     startaddr = int(self._app.config.getint('section1', 'startaddr'))
     try:
         s = Serial(port=args[0], baudrate=115200)
         r = Reader(s, self.hb)
         tags = r.inventory(close=False)
         if len(tags) > 0:
             epc = tags[0]
             r.read_from_tag(epc=epc, membank=membank, length=length,
                     startaddr=startaddr, cb=self.on_txt)
         else:
             r.run = False
     finally:
         self.f_running = False
         self.set_status('Closed ' + self.selected_port())