1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
use thiserror::Error;

#[derive(Error, Debug)]
pub enum CameraControlError {
    #[error("ParseError")]
    ParseError,
    #[error("CategoryOutOfRange")]
    CategoryOutOfRange,
    #[error("ConnectionTimeout")]
    ConnectionTimeout,
}

#[derive(Error, Debug)]
pub enum BluetoothCameraError {
    #[error("No Bluetooth adapter detected.")]
    NoBluetooth,

    #[error(
        "Could not find the right characteristic. Make sure you connected to the right device."
    )]
    NoCharacteristic,

    #[error("Cannot resolve characteristic from protocol")]
    NoCharacteristicFromProtocol,

    #[error("Could not send to camera. Did you run connect()?")]
    SendError,

    #[error("Could not connect to the camera.")]
    ConnectError,

    #[error(transparent)]
    BTLEError(#[from] btleplug::Error),

    #[error(transparent)]
    IOError(#[from] std::io::Error),

    #[error(transparent)]
    UUIDError(#[from] uuid::Error),
}