teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

1

touch_nfc.pyのソースコードが一部間違っていたため直しました

2020/12/10 15:11

投稿

ada39
ada39

スコア1

title CHANGED
File without changes
body CHANGED
@@ -68,13 +68,11 @@
68
68
 
69
69
  def on(tag,self):
70
70
 
71
- self.sc1 = nfc.tag.tt3.ServiceCode(0x0009 >> 6 ,0x0009 & 0x3f)
71
+ self.idm = binascii.hexlify(tag._nfcid)
72
- self.bc1 = nfc.tag.tt3.BlockCode(0,service = 0)
72
+ self.idm = self.idm.decode('utf-8')
73
73
 
74
- self.data = tag.read_without_encryption([self.sc1],[self.bc1])
74
+ return self.idm
75
75
 
76
- return self.data
77
-
78
76
  # -----------------------------------------------------
79
77
  # threadのworker
80
78
  # -----------------------------------------------------
@@ -95,7 +93,7 @@
95
93
  if self.callback is not None: # コールバックが指定されていれば通知
96
94
  self.callback(pl) # 々
97
95
 
98
- time.sleep(self.repeat_time) # 10ms wait ※ノーウェイトは良くない
96
+ time.sleep(self.repeat_time) # 10ms wait
99
97
 
100
98
  self.finished = True # ループが完了したら終わった状態設定
101
99