nfcscript 0.0.18__tar.gz → 0.0.19__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.
- {nfcscript-0.0.18 → nfcscript-0.0.19}/PKG-INFO +1 -1
- {nfcscript-0.0.18 → nfcscript-0.0.19}/pyproject.toml +2 -2
- {nfcscript-0.0.18 → nfcscript-0.0.19}/src/nfc/reader.py +20 -0
- {nfcscript-0.0.18 → nfcscript-0.0.19}/src/nfcscript.egg-info/PKG-INFO +1 -1
- {nfcscript-0.0.18 → nfcscript-0.0.19}/tests/test_reader.py +25 -0
- {nfcscript-0.0.18 → nfcscript-0.0.19}/README.md +0 -0
- {nfcscript-0.0.18 → nfcscript-0.0.19}/setup.cfg +0 -0
- {nfcscript-0.0.18 → nfcscript-0.0.19}/src/nfc/__init__.py +0 -0
- {nfcscript-0.0.18 → nfcscript-0.0.19}/src/nfc/assertions.py +0 -0
- {nfcscript-0.0.18 → nfcscript-0.0.19}/src/nfc/bits.py +0 -0
- {nfcscript-0.0.18 → nfcscript-0.0.19}/src/nfc/checksum.py +0 -0
- {nfcscript-0.0.18 → nfcscript-0.0.19}/src/nfc/cli.py +0 -0
- {nfcscript-0.0.18 → nfcscript-0.0.19}/src/nfc/delay.py +0 -0
- {nfcscript-0.0.18 → nfcscript-0.0.19}/src/nfc/hex_util.py +0 -0
- {nfcscript-0.0.18 → nfcscript-0.0.19}/src/nfc/nfc_cli.py +0 -0
- {nfcscript-0.0.18 → nfcscript-0.0.19}/src/nfc/trace.py +0 -0
- {nfcscript-0.0.18 → nfcscript-0.0.19}/src/nfcscript.egg-info/SOURCES.txt +0 -0
- {nfcscript-0.0.18 → nfcscript-0.0.19}/src/nfcscript.egg-info/dependency_links.txt +0 -0
- {nfcscript-0.0.18 → nfcscript-0.0.19}/src/nfcscript.egg-info/entry_points.txt +0 -0
- {nfcscript-0.0.18 → nfcscript-0.0.19}/src/nfcscript.egg-info/requires.txt +0 -0
- {nfcscript-0.0.18 → nfcscript-0.0.19}/src/nfcscript.egg-info/top_level.txt +0 -0
- {nfcscript-0.0.18 → nfcscript-0.0.19}/tests/test_assertions.py +0 -0
- {nfcscript-0.0.18 → nfcscript-0.0.19}/tests/test_bits.py +0 -0
- {nfcscript-0.0.18 → nfcscript-0.0.19}/tests/test_checksum.py +0 -0
- {nfcscript-0.0.18 → nfcscript-0.0.19}/tests/test_cli.py +0 -0
- {nfcscript-0.0.18 → nfcscript-0.0.19}/tests/test_cli_collect.py +0 -0
- {nfcscript-0.0.18 → nfcscript-0.0.19}/tests/test_delay.py +0 -0
- {nfcscript-0.0.18 → nfcscript-0.0.19}/tests/test_hex_util.py +0 -0
- {nfcscript-0.0.18 → nfcscript-0.0.19}/tests/test_trace.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "nfcscript"
|
|
3
|
-
version = "0.0.
|
|
3
|
+
version = "0.0.19"
|
|
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.
|
|
34
|
+
current_version = "0.0.19"
|
|
35
35
|
commit = true
|
|
36
36
|
tag = true
|
|
37
37
|
allow_dirty = true
|
|
@@ -83,6 +83,26 @@ class _ReaderFacade:
|
|
|
83
83
|
"""获取 Mifare 硬件加密状态。"""
|
|
84
84
|
return getattr(get_reader(), "mf_crypto", False)
|
|
85
85
|
|
|
86
|
+
@property
|
|
87
|
+
def name(self) -> str:
|
|
88
|
+
"""读卡器驱动名称 (如 'pn532', 'clrc663')。"""
|
|
89
|
+
return getattr(get_reader(), "name", "")
|
|
90
|
+
|
|
91
|
+
@property
|
|
92
|
+
def fifo_size(self) -> int:
|
|
93
|
+
"""读卡器内部物理硬件 FIFO 深度 (字节)。"""
|
|
94
|
+
return getattr(get_reader(), "fifo_size", 64)
|
|
95
|
+
|
|
96
|
+
@property
|
|
97
|
+
def lazy_crc(self) -> bool:
|
|
98
|
+
"""是否启用惰性 CRC 状态缓存。"""
|
|
99
|
+
return getattr(get_reader(), "lazy_crc", True)
|
|
100
|
+
|
|
101
|
+
@lazy_crc.setter
|
|
102
|
+
def lazy_crc(self, value: bool) -> None:
|
|
103
|
+
"""设置是否启用惰性 CRC 状态缓存。"""
|
|
104
|
+
get_reader().lazy_crc = value
|
|
105
|
+
|
|
86
106
|
@property
|
|
87
107
|
def target(self) -> Any:
|
|
88
108
|
"""获取当前连接的底层 CardReader 实例。"""
|
|
@@ -25,6 +25,9 @@ def _mock_reader():
|
|
|
25
25
|
mock.active.return_value = CardInfo(uid=[0x01, 0x02, 0x03, 0x04], atq=[0x44, 0x00], sak=0x00)
|
|
26
26
|
mock.rf_field = False
|
|
27
27
|
mock.mf_crypto = False
|
|
28
|
+
mock.name = "pn532"
|
|
29
|
+
mock.fifo_size = 64
|
|
30
|
+
mock.lazy_crc = True
|
|
28
31
|
return mock
|
|
29
32
|
|
|
30
33
|
|
|
@@ -84,6 +87,28 @@ class TestGetReader:
|
|
|
84
87
|
nfc.get_reader()
|
|
85
88
|
|
|
86
89
|
|
|
90
|
+
class TestReaderFacadeCapabilities:
|
|
91
|
+
def test_reader_properties(self):
|
|
92
|
+
mock = _mock_reader()
|
|
93
|
+
mock.name = "clrc663"
|
|
94
|
+
mock.fifo_size = 512
|
|
95
|
+
mock.lazy_crc = True
|
|
96
|
+
reader._target = mock
|
|
97
|
+
reader._connected = True
|
|
98
|
+
|
|
99
|
+
assert reader.name == "clrc663"
|
|
100
|
+
assert reader.fifo_size == 512
|
|
101
|
+
assert reader.lazy_crc is True
|
|
102
|
+
|
|
103
|
+
def test_reader_lazy_crc_setter(self):
|
|
104
|
+
mock = _mock_reader()
|
|
105
|
+
reader._target = mock
|
|
106
|
+
reader._connected = True
|
|
107
|
+
|
|
108
|
+
reader.lazy_crc = False
|
|
109
|
+
assert mock.lazy_crc is False
|
|
110
|
+
|
|
111
|
+
|
|
87
112
|
class TestTransceive:
|
|
88
113
|
|
|
89
114
|
def test_transceive_returns_data(self):
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|