YOKONEX 设备扫描、连接、波形执行与状态输出依赖
Project description
yokonex-device
yokonex-device 是一个面向 YOKONEX 设备的独立 Python 仓库,负责:
- 蓝牙设备扫描
- 蓝牙连接与断开
- 设备状态读取
- EMS / Toy / GCQ 波形模型
- 自定义波形与内置波形管理
- 单设备 / 多设备波形执行
- overlay 遥测数据输出
这个仓库刻意只保留设备层能力,不包含直播业务规则,例如:
- 礼物档位
- 价格区间映射
- 弹幕关键词匹配
- 直播事件分发
- OBS 最近事件列表聚合
这些能力应放在业务项目中,由上层项目计算出目标波形后,再调用本仓库提供的接口。
仓库结构
yokonex-device/
README.md
pyproject.toml
.gitignore
docs/
usage.md
tests/
test_bleak_runtime.py
test_service.py
test_storage.py
yokonex_device/
__init__.py
models.py
service.py
storage.py
ems_builtin_waveforms.py
toy_builtin_waveforms.py
gcq_toy_builtin_waveforms.py
runtime/
base.py
bleak_runtime.py
memory_runtime.py
安装
开发安装:
pip install -e .[dev]
普通安装:
pip install .
快速开始
from pathlib import Path
from yokonex_device import BluetoothService
service = BluetoothService.create_default(
config_path=Path("config/bluetooth_settings.json"),
)
扫描与连接:
devices = await service.scan()
status = await service.connect(devices[0].device_id)
print(status.connected, status.device)
触发波形:
result = await service.trigger_waveform(
event_type="manual_test",
waveform_id="ems-preset-01",
)
print(result)
更多接入方式见 docs/usage.md。
发布
构建:
python -m build
测试:
python -m pytest
上传到 PyPI:
python -m twine upload dist/*
也可以直接使用仓库内置的 GitHub Actions 发布工作流:
- 给仓库打 tag,例如
v0.1.1 - 推送 tag 到 GitHub
- 工作流会先测试、构建,再通过 PyPI Trusted Publisher 发布
首次使用前需要在 PyPI 项目后台配置 Trusted Publisher,绑定:
- owner:
tzwgoo - repo:
yokonex-device - workflow:
.github/workflows/publish.yml
如果只想手动触发构建和发布,也可以在 GitHub Actions 页面使用 workflow_dispatch。
与主仓库的关系
这个目录是从 Bililive-YOKONEX 中拆出的独立仓库骨架,适合作为新仓库初始化起点:
- 进入
standalone/yokonex-device - 执行
git init - 关联新的远端仓库
- 提交并推送
如果后续还需要从主仓库继续同步设备层能力,建议把同步边界控制在:
yokonex_device/docs/usage.mdtests/test_bleak_runtime.py- 设备层专属测试
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file yokonex_device-0.1.0.tar.gz.
File metadata
- Download URL: yokonex_device-0.1.0.tar.gz
- Upload date:
- Size: 31.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b9f4c4e931cf14f5a0535df5a748a230154a5f5fbd70feac92861766e2d7ba60
|
|
| MD5 |
1754d7edc1be9c22b4e5d1f101df040e
|
|
| BLAKE2b-256 |
12d09df06171784da3cd240a247e75d2dfad9697d4b070bfb83781db4d08a1a7
|
Provenance
The following attestation bundles were made for yokonex_device-0.1.0.tar.gz:
Publisher:
publish.yml on tzwgoo/yokonex-device
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
yokonex_device-0.1.0.tar.gz -
Subject digest:
b9f4c4e931cf14f5a0535df5a748a230154a5f5fbd70feac92861766e2d7ba60 - Sigstore transparency entry: 1809194966
- Sigstore integration time:
-
Permalink:
tzwgoo/yokonex-device@2ea2970f4ac140ad9b389b4c98f9a6491b6aa848 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/tzwgoo
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@2ea2970f4ac140ad9b389b4c98f9a6491b6aa848 -
Trigger Event:
push
-
Statement type:
File details
Details for the file yokonex_device-0.1.0-py3-none-any.whl.
File metadata
- Download URL: yokonex_device-0.1.0-py3-none-any.whl
- Upload date:
- Size: 29.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3a079c6a2a87c981ff17ab1f904462ff98cda4a78cf20e0585cba1bb164b85ac
|
|
| MD5 |
2ca87e4b9cba9acad2c3b7b275a9bda6
|
|
| BLAKE2b-256 |
1a70f1c3ab4f97848724b9ab604ced0ea8f29c6b5684731b797e86f80b2cd4db
|
Provenance
The following attestation bundles were made for yokonex_device-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on tzwgoo/yokonex-device
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
yokonex_device-0.1.0-py3-none-any.whl -
Subject digest:
3a079c6a2a87c981ff17ab1f904462ff98cda4a78cf20e0585cba1bb164b85ac - Sigstore transparency entry: 1809194978
- Sigstore integration time:
-
Permalink:
tzwgoo/yokonex-device@2ea2970f4ac140ad9b389b4c98f9a6491b6aa848 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/tzwgoo
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@2ea2970f4ac140ad9b389b4c98f9a6491b6aa848 -
Trigger Event:
push
-
Statement type: