feat: integrate StreamRuntime with EskinDevice, add streaming mode demo

- Separate DeviceState (connection lifecycle) and DeviceMode (Command/Streaming)
- Add stream: Option<StreamRuntime> to EskinDeviceInner
- Wire up start_stream/stop_stream with StreamRuntime (worker thread)
- Add StreamingBusy error for command-mode guard
- Fix stream frame total_len calculation (was double-counting status byte)
- Add ensure_command_mode() check on read_register/write_register
- close() now auto-stops stream if active
- Add stream_demo() in main.rs with Enter-to-stop loop
- Add finger_addr config to StreamConfig
This commit is contained in:
lenn
2026-05-07 17:27:40 +08:00
parent 1b1ab46f1d
commit c195234771
6 changed files with 150 additions and 34 deletions

View File

@@ -18,6 +18,7 @@ pub enum SdkErrorCode {
FrameError = 15,
ProtocolError = 16,
DeviceError = 17,
StreamingBusy = 18,
}
#[derive(Debug, thiserror::Error)]
@@ -69,4 +70,7 @@ pub enum SdkError {
#[error("Device error: status 0x{0:04X}")]
DeviceError(u16),
#[error("Device is in streaming mode, command not allowed")]
StreamingBusy
}