6 Replies - 425 Views - Last Post: 30 July 2019 - 11:20 AM Rate Topic: -----

#1 kedane100   User is offline

  • New D.I.C Head

Reputation: 4
  • View blog
  • Posts: 15
  • Joined: 10-December 18

NFC Tag Script

Posted 22 July 2019 - 12:57 PM

Hello

I configured an nfc reader using python however I want to create a script for the tags so that whenever they are read by the user it returns an incremented value for each tag placed on the reader.

this is what I have so far:

import nfc
import ndef

tag = ++, string "card"

def on_connect(tag):
    print ++, string 'Card'



this is the config

import nfc
>>> clf = nfc.ContactlessFrontend()
>>> assert clf.open('usb:001:009) is True
		
SyntaxError: EOL while scanning string literal
>>> assert clf.open('usb:001:009') is True

Traceback (most recent call last):
  File "<pyshell#3>", line 1, in <module>
    assert clf.open('usb:001:009') is True
Assertionerror
>>> assert clf.open('usb:001:016') is True
>>> assert clf.open('usb:072f:2200') is True
>>> assert clf.open('usb:001') is True
>>> assert clf.open('usb:072f')is True
>>> assert clf.open('usb') is True
>>> clf.close()
>>> import nfc
>>> clf = nfc.ContactlessFrontend('usb')
>>> tag = clf.connect(rdwr={'on-connect':lambda tag: False})
>>> print(tag)
Type2Tag ID=0C1C493C
>>> tag
<nfc.tag.tt2.Type2Tag object at 0x0335C8F0>
>>> tag
<nfc.tag.tt2.Type2Tag object at 0x0335C8F0>




Is This A Good Question/Topic? 1
  • +

Replies To: NFC Tag Script

#2 modi123_1   User is offline

  • Suitor #2
  • member icon



Reputation: 15175
  • View blog
  • Posts: 60,742
  • Joined: 12-June 08

Re: NFC Tag Script

Posted 22 July 2019 - 01:18 PM

You neglected to ask a question or explain what is currently happening.
Was This Post Helpful? 0
  • +
  • -

#3 kedane100   User is offline

  • New D.I.C Head

Reputation: 4
  • View blog
  • Posts: 15
  • Joined: 10-December 18

Re: NFC Tag Script

Posted 22 July 2019 - 03:42 PM

My script isn't giving me what I want so I want to know what is wrong with it
Was This Post Helpful? 1
  • +
  • -

#4 DK3250   User is offline

  • Pythonian
  • member icon

Reputation: 551
  • View blog
  • Posts: 1,721
  • Joined: 27-December 13

Re: NFC Tag Script

Posted 23 July 2019 - 03:36 AM

View Postkedane100, on 22 July 2019 - 11:42 PM, said:

My script isn't giving me what I want so I want to know what is wrong with it
Oh, come on, kedane100; you can't be serious here.

All you show us is a code fragment and a screenshot from a console session. No comments, no thoughts about what you expect or any other information that might help us helping you.

It's almost as if you don't want any help...
Was This Post Helpful? 0
  • +
  • -

#5 kedane100   User is offline

  • New D.I.C Head

Reputation: 4
  • View blog
  • Posts: 15
  • Joined: 10-December 18

Re: NFC Tag Script

Posted 30 July 2019 - 07:04 AM

View PostDK3250, on 23 July 2019 - 03:36 AM, said:

View Postkedane100, on 22 July 2019 - 11:42 PM, said:

My script isn't giving me what I want so I want to know what is wrong with it
Oh, come on, kedane100; you can't be serious here.

All you show us is a code fragment and a screenshot from a console session. No comments, no thoughts about what you expect or any other information that might help us helping you.

It's almost as if you don't want any help...


I just want to know why my connect function isn't working when i connect my smart card to the reader....
Was This Post Helpful? 1
  • +
  • -

#6 modi123_1   User is offline

  • Suitor #2
  • member icon



Reputation: 15175
  • View blog
  • Posts: 60,742
  • Joined: 12-June 08

Re: NFC Tag Script

Posted 30 July 2019 - 08:50 AM

A friendly reminder that folk are not there looking over your shoulder. So to provide as much information as possible about the problem helps those to help you.

Example - are there any error messages (if so copy/paste them here), what is the device, are you using manufacturer specific drivers or SDK, how is the device connected, what is the NFC reader reading, etc.

:^:
Was This Post Helpful? 1
  • +
  • -

#7 kedane100   User is offline

  • New D.I.C Head

Reputation: 4
  • View blog
  • Posts: 15
  • Joined: 10-December 18

Re: NFC Tag Script

Posted 30 July 2019 - 11:20 AM

I want to create a code within the nfcpy code that will just accept a variable of the card type and return an incremented value of maybe "card 1, 2, 3 etc..." for every card that is placed on the reader.

the code 'fragment' i had attached to my initial forum entry was my attempt at doing so but it did not run as expected.

import nfc
import ndef

tag = ++, string "card"

#I want the connect function to to take the tag(card) as argument and return an incremented value for every card that is placed on the reader every time the function is run

def on_connect(tag):

   print ++, string 'Card'


Was This Post Helpful? 1
  • +
  • -

Page 1 of 1