Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from __future__ import print_function
- import nfc
- import sys
- def connected(tag):
- servc = 0x100B
- service_code = [nfc.tag.tt3.ServiceCode(
- servc >> 6, servc & 0x3f
- )]
- bc_id = [nfc.tag.tt3.BlockCode(i) for i in range(3)]
- bc_name = [nfc.tag.tt3.BlockCode(3)]
- try:
- print(tag.read_without_encryption(
- service_code, bc_id
- ).decode('ascii')[2:11] + ',' +
- tag.read_without_encryption(
- service_code, bc_name
- ).decode('shift-jis')
- )
- except Exception:
- sys.exit("Read failed")
- return False
- if __name__ == "__main__":
- clf = nfc.ContactlessFrontend('usb')
- rdwr_options = {
- 'on-connect': connected
- }
- clf.connect(rdwr=rdwr_options)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement