1use std::io;
4use thiserror::Error;
5
6pub type Result<T> = std::result::Result<T, HdcError>;
8
9#[derive(Error, Debug)]
11pub enum HdcError {
12 #[error("I/O error: {0}")]
14 Io(#[from] io::Error),
15
16 #[error("Protocol error: {0}")]
18 Protocol(String),
19
20 #[error("Handshake failed: {0}")]
22 HandshakeFailed(String),
23
24 #[error("Not connected to HDC server")]
26 NotConnected,
27
28 #[error("Invalid banner: expected 'OHOS HDC', got {0:?}")]
30 InvalidBanner(Vec<u8>),
31
32 #[error("Buffer error: {0}")]
34 BufferError(String),
35
36 #[error("Command failed: {0}")]
38 CommandFailed(String),
39
40 #[error("Operation timed out")]
42 Timeout,
43
44 #[error("Device not found: {0}")]
46 DeviceNotFound(String),
47
48 #[error("UTF-8 error: {0}")]
50 Utf8(#[from] std::string::FromUtf8Error),
51}