nfcscript 0.0.19__tar.gz → 0.0.20__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. {nfcscript-0.0.19 → nfcscript-0.0.20}/PKG-INFO +1 -1
  2. {nfcscript-0.0.19 → nfcscript-0.0.20}/pyproject.toml +2 -2
  3. {nfcscript-0.0.19 → nfcscript-0.0.20}/src/nfc/reader.py +3 -1
  4. {nfcscript-0.0.19 → nfcscript-0.0.20}/src/nfcscript.egg-info/PKG-INFO +1 -1
  5. {nfcscript-0.0.19 → nfcscript-0.0.20}/tests/test_reader.py +31 -0
  6. {nfcscript-0.0.19 → nfcscript-0.0.20}/README.md +0 -0
  7. {nfcscript-0.0.19 → nfcscript-0.0.20}/setup.cfg +0 -0
  8. {nfcscript-0.0.19 → nfcscript-0.0.20}/src/nfc/__init__.py +0 -0
  9. {nfcscript-0.0.19 → nfcscript-0.0.20}/src/nfc/assertions.py +0 -0
  10. {nfcscript-0.0.19 → nfcscript-0.0.20}/src/nfc/bits.py +0 -0
  11. {nfcscript-0.0.19 → nfcscript-0.0.20}/src/nfc/checksum.py +0 -0
  12. {nfcscript-0.0.19 → nfcscript-0.0.20}/src/nfc/cli.py +0 -0
  13. {nfcscript-0.0.19 → nfcscript-0.0.20}/src/nfc/delay.py +0 -0
  14. {nfcscript-0.0.19 → nfcscript-0.0.20}/src/nfc/hex_util.py +0 -0
  15. {nfcscript-0.0.19 → nfcscript-0.0.20}/src/nfc/nfc_cli.py +0 -0
  16. {nfcscript-0.0.19 → nfcscript-0.0.20}/src/nfc/trace.py +0 -0
  17. {nfcscript-0.0.19 → nfcscript-0.0.20}/src/nfcscript.egg-info/SOURCES.txt +0 -0
  18. {nfcscript-0.0.19 → nfcscript-0.0.20}/src/nfcscript.egg-info/dependency_links.txt +0 -0
  19. {nfcscript-0.0.19 → nfcscript-0.0.20}/src/nfcscript.egg-info/entry_points.txt +0 -0
  20. {nfcscript-0.0.19 → nfcscript-0.0.20}/src/nfcscript.egg-info/requires.txt +0 -0
  21. {nfcscript-0.0.19 → nfcscript-0.0.20}/src/nfcscript.egg-info/top_level.txt +0 -0
  22. {nfcscript-0.0.19 → nfcscript-0.0.20}/tests/test_assertions.py +0 -0
  23. {nfcscript-0.0.19 → nfcscript-0.0.20}/tests/test_bits.py +0 -0
  24. {nfcscript-0.0.19 → nfcscript-0.0.20}/tests/test_checksum.py +0 -0
  25. {nfcscript-0.0.19 → nfcscript-0.0.20}/tests/test_cli.py +0 -0
  26. {nfcscript-0.0.19 → nfcscript-0.0.20}/tests/test_cli_collect.py +0 -0
  27. {nfcscript-0.0.19 → nfcscript-0.0.20}/tests/test_delay.py +0 -0
  28. {nfcscript-0.0.19 → nfcscript-0.0.20}/tests/test_hex_util.py +0 -0
  29. {nfcscript-0.0.19 → nfcscript-0.0.20}/tests/test_trace.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nfcscript
3
- Version: 0.0.19
3
+ Version: 0.0.20
4
4
  Summary: A plugin-based core engine for DSL-style NFC testing automation.
5
5
  Author: crthu
6
6
  Requires-Python: >=3.14
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "nfcscript"
3
- version = "0.0.19"
3
+ version = "0.0.20"
4
4
  description = "A plugin-based core engine for DSL-style NFC testing automation."
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.14"
@@ -31,7 +31,7 @@ dev = [
31
31
  ]
32
32
 
33
33
  [tool.bumpversion]
34
- current_version = "0.0.19"
34
+ current_version = "0.0.20"
35
35
  commit = true
36
36
  tag = true
37
37
  allow_dirty = true
@@ -217,7 +217,9 @@ def active(low_layer: bool = False, ignore_error: bool = False, reqa_cmd: int =
217
217
  """
218
218
  rdr = get_reader()
219
219
 
220
- if not low_layer:
220
+ # PN532 固件在未激活 Target 前无法通过 InCommunicateThru (0x42) 发送裸位 REQA;
221
+ # 当使用标准 REQA (0x26) 时,自动路由至 PN532 原生 InListPassiveTarget 硬件寻卡
222
+ if not low_layer or (getattr(rdr, "name", "") == "pn532" and reqa_cmd == 0x26):
221
223
  return rdr.active()
222
224
 
223
225
  # 手动底层寻卡流程
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nfcscript
3
- Version: 0.0.19
3
+ Version: 0.0.20
4
4
  Summary: A plugin-based core engine for DSL-style NFC testing automation.
5
5
  Author: crthu
6
6
  Requires-Python: >=3.14
@@ -330,6 +330,37 @@ class TestGetSelCmd:
330
330
  _get_sel_cmd(4)
331
331
 
332
332
 
333
+ class TestActive:
334
+
335
+ def test_active_pn532_routes_to_rdr_active_on_std_reqa(self):
336
+ mock = _mock_reader()
337
+ mock.name = "pn532"
338
+ reader._target = mock
339
+ reader._connected = True
340
+
341
+ res = nfc.active(low_layer=True)
342
+ assert res is not None
343
+ mock.active.assert_called_once()
344
+
345
+ @patch("nfc.reader.anticoll")
346
+ @patch("nfc.reader.select")
347
+ @patch("nfc.reader.reqa")
348
+ def test_active_clrc663_executes_low_layer(self, mock_reqa, mock_select, mock_anticoll):
349
+ mock = _mock_reader()
350
+ mock.name = "clrc663"
351
+ reader._target = mock
352
+ reader._connected = True
353
+
354
+ mock_reqa.return_value = TransceiveBits(data=[0x44, 0x00], bits=8)
355
+ mock_anticoll.return_value = TransceiveBits(data=[0x01, 0x02, 0x03, 0x04, 0x04], bits=40)
356
+ mock_select.return_value = [0x00]
357
+
358
+ res = nfc.active(low_layer=True)
359
+ assert res is not None
360
+ assert res.uid == [0x01, 0x02, 0x03, 0x04]
361
+ mock.active.assert_not_called()
362
+
363
+
333
364
  class TestReaderSingletonProxy:
334
365
 
335
366
  @patch.object(CardReaderRegistry, "create")
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes