nfcscript 0.0.10__tar.gz → 0.0.11__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.10 → nfcscript-0.0.11}/PKG-INFO +1 -1
  2. {nfcscript-0.0.10 → nfcscript-0.0.11}/pyproject.toml +2 -2
  3. {nfcscript-0.0.10 → nfcscript-0.0.11}/src/nfc/trace.py +23 -2
  4. {nfcscript-0.0.10 → nfcscript-0.0.11}/src/nfcscript.egg-info/PKG-INFO +1 -1
  5. {nfcscript-0.0.10 → nfcscript-0.0.11}/README.md +0 -0
  6. {nfcscript-0.0.10 → nfcscript-0.0.11}/setup.cfg +0 -0
  7. {nfcscript-0.0.10 → nfcscript-0.0.11}/src/nfc/__init__.py +0 -0
  8. {nfcscript-0.0.10 → nfcscript-0.0.11}/src/nfc/assertions.py +0 -0
  9. {nfcscript-0.0.10 → nfcscript-0.0.11}/src/nfc/bits.py +0 -0
  10. {nfcscript-0.0.10 → nfcscript-0.0.11}/src/nfc/checksum.py +0 -0
  11. {nfcscript-0.0.10 → nfcscript-0.0.11}/src/nfc/cli.py +0 -0
  12. {nfcscript-0.0.10 → nfcscript-0.0.11}/src/nfc/delay.py +0 -0
  13. {nfcscript-0.0.10 → nfcscript-0.0.11}/src/nfc/hex_util.py +0 -0
  14. {nfcscript-0.0.10 → nfcscript-0.0.11}/src/nfc/nfc_cli.py +0 -0
  15. {nfcscript-0.0.10 → nfcscript-0.0.11}/src/nfc/reader.py +0 -0
  16. {nfcscript-0.0.10 → nfcscript-0.0.11}/src/nfcscript.egg-info/SOURCES.txt +0 -0
  17. {nfcscript-0.0.10 → nfcscript-0.0.11}/src/nfcscript.egg-info/dependency_links.txt +0 -0
  18. {nfcscript-0.0.10 → nfcscript-0.0.11}/src/nfcscript.egg-info/entry_points.txt +0 -0
  19. {nfcscript-0.0.10 → nfcscript-0.0.11}/src/nfcscript.egg-info/requires.txt +0 -0
  20. {nfcscript-0.0.10 → nfcscript-0.0.11}/src/nfcscript.egg-info/top_level.txt +0 -0
  21. {nfcscript-0.0.10 → nfcscript-0.0.11}/tests/test_assertions.py +0 -0
  22. {nfcscript-0.0.10 → nfcscript-0.0.11}/tests/test_bits.py +0 -0
  23. {nfcscript-0.0.10 → nfcscript-0.0.11}/tests/test_checksum.py +0 -0
  24. {nfcscript-0.0.10 → nfcscript-0.0.11}/tests/test_cli.py +0 -0
  25. {nfcscript-0.0.10 → nfcscript-0.0.11}/tests/test_cli_collect.py +0 -0
  26. {nfcscript-0.0.10 → nfcscript-0.0.11}/tests/test_delay.py +0 -0
  27. {nfcscript-0.0.10 → nfcscript-0.0.11}/tests/test_hex_util.py +0 -0
  28. {nfcscript-0.0.10 → nfcscript-0.0.11}/tests/test_reader.py +0 -0
  29. {nfcscript-0.0.10 → nfcscript-0.0.11}/tests/test_trace.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nfcscript
3
- Version: 0.0.10
3
+ Version: 0.0.11
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.10"
3
+ version = "0.0.11"
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"
@@ -34,7 +34,7 @@ dev = [
34
34
  ]
35
35
 
36
36
  [tool.bumpversion]
37
- current_version = "0.0.10"
37
+ current_version = "0.0.11"
38
38
  commit = true
39
39
  tag = true
40
40
  allow_dirty = true
@@ -4,7 +4,8 @@ NFC Script Trace 模块
4
4
  提供日志追踪控制,包装 nfctester.trace 的功能。
5
5
  """
6
6
 
7
- from nfctester.trace import trace as _trace
7
+ from typing import Callable
8
+ from nfctester.trace import TraceEvent, trace as _trace
8
9
 
9
10
 
10
11
  def set_layer(layer: str, enable: bool = True):
@@ -33,7 +34,7 @@ def set_parse(level: int = 1):
33
34
  设置解析级别。
34
35
 
35
36
  Args:
36
- level: 0=关闭, 1=简单(一行摘要), 2=复杂(树状结构)
37
+ level: 0=关闭(hex), 1=简单(hex + 摘要标签)
37
38
  """
38
39
  _trace.set_parse(level)
39
40
 
@@ -71,3 +72,23 @@ def success(msg: str):
71
72
  def debug(msg: str):
72
73
  """输出 DEBUG 级别日志"""
73
74
  _trace.debug(msg)
75
+
76
+
77
+ def add_sink(fn: Callable[[TraceEvent], None]):
78
+ """
79
+ 注册结构化 trace 事件回调。
80
+
81
+ Args:
82
+ fn: 回调函数,接收 TraceEvent 对象
83
+ """
84
+ _trace.add_sink(fn)
85
+
86
+
87
+ def remove_sink(fn: Callable[[TraceEvent], None]):
88
+ """
89
+ 移除结构化 trace 事件回调。
90
+
91
+ Args:
92
+ fn: 之前注册的回调函数
93
+ """
94
+ _trace.remove_sink(fn)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nfcscript
3
- Version: 0.0.10
3
+ Version: 0.0.11
4
4
  Summary: A plugin-based core engine for DSL-style NFC testing automation.
5
5
  Author: crthu
6
6
  Requires-Python: >=3.14
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes