示例#1
0
 def run(self):
     cmd = CommandType.REQA
     struct = CommandStructure.encode_command(cmd, [])
     s = self._tag
     ns = self._reader
     i = 0
     mx = self._max
     while i < mx or mx == 0:
         ret = s.process_packet(cmd, struct)
         if not ret:
             cmd = CommandType.REQA
             struct = CommandStructure.encode_command(cmd, [])
             s = self._tag
             ns = self._reader
             s.wake_up()  # so that it can respond
             i += 1
         else:
             cmd, struct = ret
             temp = s
             s = ns
             ns = temp
示例#2
0
 def run(self):
     cmd = CommandType.REQA
     struct = CommandStructure.encode_command(cmd, [])
     s = self._tag
     ns = self._reader
     i = 0
     mx = self._max
     while i < mx or mx == 0:
         ret = s.process_packet(cmd, struct)
         if not ret:
             cmd = CommandType.REQA
             struct = CommandStructure.encode_command(cmd, [])
             s = self._tag
             ns = self._reader 
             s.wake_up() # so that it can respond
             i += 1
         else:
             cmd, struct = ret
             temp = s
             s = ns
             ns = temp 
示例#3
0
    def _handle_next(self, cmd, extra):
        if not cmd:
            return None
        struct = CommandStructure.encode_command(cmd, extra)
        print "TAG OUTGOING"
        struct.display()

        all_bits = Convert.to_bit_ar(struct.all_bytes(), True)
        if self._encode:
            all_bits = self._encode(all_bits, cmd)
        #print all_bits
        self._callback(all_bits)
        return (cmd, struct)
示例#4
0
文件: tag.py 项目: drtyhlpr/usrp_nfc
    def _handle_next(self, cmd, extra):
        if not cmd:
            return None
        struct = CommandStructure.encode_command(cmd, extra)
        print "TAG OUTGOING"
        struct.display()

        all_bits = Convert.to_bit_ar(struct.all_bytes(), True)
        if self._encode:
            all_bits = self._encode(all_bits, cmd)   
        #print all_bits
        self._callback(all_bits)
        return (cmd, struct)
示例#5
0
    def _handle_next(self, cmd, extra):
        struct = CommandStructure.encode_command(cmd, extra)
        print "READER OUTGOING"
        struct.display()
        if cmd == CommandType.HALT:
           self._reset_tag()

        all_bits = Convert.to_bit_ar(struct.all_bytes(), True)
        if self._encode:
            all_bits = self._encode(all_bits, cmd)   
        #print all_bits
        self._callback(all_bits, cmd == CommandType.HALT)
        return (cmd, struct) 
示例#6
0
    def _handle_next(self, cmd, extra):
        struct = CommandStructure.encode_command(cmd, extra)
        print "READER OUTGOING"
        struct.display()
        if cmd == CommandType.HALT:
            self._reset_tag()

        all_bits = Convert.to_bit_ar(struct.all_bytes(), True)
        if self._encode:
            all_bits = self._encode(all_bits, cmd)
        #print all_bits
        self._callback(all_bits, cmd == CommandType.HALT)
        return (cmd, struct)