Skip to content

feat: 提供状态变化回调 #798

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

laride
Copy link
Contributor

@laride laride commented Jun 11, 2025

在不同状态(Listening, Speaking, Idle)切换时,不同的开发版可能需要进行自定义的操作,诸如灯等外设也需要有变化。先前的代码仅在 Led 类下可通过 OnStateChanged 处理状态变化,有局限性。此 PR 新增了一个 DeviceStateEventManager 类,可以注册状态变化时的回调。

此 PR 未将原有的状态处理修改至此 DeviceStateEventManager 中。

@HoGC
Copy link

HoGC commented Jun 15, 2025

在Board里实现一个和led一样的OnStateChanged接口是不是会更好点

@laride
Copy link
Contributor Author

laride commented Jun 16, 2025

在Board里实现一个和led一样的OnStateChanged接口是不是会更好点

也可以?似乎没有动态注册那么灵活。

@laride laride force-pushed the feat/state-switch-event branch from 7d7782f to 3feddf2 Compare June 16, 2025 07:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants