summaryrefslogtreecommitdiffstats
path: root/src/events.rs
blob: aa5328095addc78b9bbf0b223ecfb96f2a14aa81 (plain)
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
use super::enums::*;

#[allow(dead_code)]
#[derive(Debug, PartialEq, Eq, Clone)]
pub enum Event {
    AdvertisementPacket {
        opcode: u8,
        scan_id: u32,
        bd_addr: String,
        name: String,
        rssi: u8,
        is_private: bool,
        already_verified: bool,
        already_connected_to_this_device: bool,
        already_connected_to_other_device: bool,
    },

    CreateConnectionChannelResponse {
        conn_id: u32,
        error: CreateConnectionChannelError,
        connection_status: ConnectionStatus,
    },

    ConnectionStatusChanged {
        conn_id: u32,
        connection_status: ConnectionStatus,
        disconnect_reason: DisconnectReason,
    },

    ConnectionChannelRemoved {
        conn_id: u32,
        removed_reason: RemovedReason,
    },

    ButtonEvent {
        conn_id: u32,
        click_type: ClickType,
        was_queued: bool,
        time_diff: i32,
    },

    NewVerifiedButton {
        opcode: u8,
        bd_addr: String,
    },

    GetInfoResponse {
        opcode: u8,
        bluetooth_controller_state: BluetoothControllerState,
        my_bd_addr: String,
        my_bd_addr_type: BdAddrType,
        max_pending_connections: u8,
        max_concurrently_connected_buttons: i16,
        current_pending_connections: u8,
        currently_no_space_for_new_connection: bool,
        bd_addr_of_verified_buttons: Vec<String>,
    },

    NoSpaceForNewConnection {
        opcode: u8,
        max_concurrently_connected_buttons: u8,
    },

    GotSpaceForNewConnection {
        opcode: u8,
        max_concurrently_connected_buttons: u8,
    },

    BluetoothControllerStateChange {
        opcode: u8,
        state: BluetoothControllerState,
    },

    PingResponse {
        opcode: u8,
        ping_id: u32,
    },

    GetButtonInfoResponse {
        opcode: u8,
        bd_addr: String,
        uuid: String,
        color: Option<String>,
        serial_number: Option<String>,
    },

    ScanWizardFoundPrivateButton {
        scan_wizard_id: u32,
    },

    ScanWizardFoundPublicButton {
        scan_wizard_id: u32,
        bd_addr: String,
        name: String,
    },

    ScanWizardButtonConnected {
        scan_wizard_id: u32,
    },

    ScanWizardCompleted {
        scan_wizard_id: u32,
        result: ScanWizardResult,
    },

    ButtonDeleted {
        opcode: u8,
        bd_addr: String,
        deleted_by_this_client: bool,
    },

    BatteryStatus {
        opcode: u8,
        listener_id: u32,
        battery_percentage: i8,
        timestamp: u64,
    },
}