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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
//! The MousePad plugin allows remote control of the pointer and keyboard.
use serde::{Deserialize, Serialize};
#[cfg(not(feature = "std"))]
use alloc::string::String;
/// This packet is an echo for a kdeconnect.mousepad.request packet.
///
/// <https://invent.kde.org/network/kdeconnect-meta/blob/master/protocol.md#kdeconnectmousepadecho>
#[derive(Serialize, Deserialize, Debug, Clone)]
#[serde(rename_all = "camelCase")]
pub struct MousepadEchoPacket {
/// A request to press-release a single readable character, which may be a unicode character and thus more than one byte.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub key: Option<String>,
/// A request to press-release a single non-printable character, usually a control character or function key such as Backspace or F10.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub special_key: Option<u8>,
/// Indicates whether the Alt modifier should be applied to the associated key or specialKey.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub alt: Option<bool>,
/// Indicates whether the Control modifier should be applied to the associated key or specialKey.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub ctrl: Option<bool>,
/// Indicates whether the Shift modifier should be applied to the associated key or specialKey.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub shift: Option<bool>,
/// Indicates whether the Super modifier should be applied to the associated key or specialKey.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
#[serde(rename = "super")]
pub super_: Option<bool>,
/// A single press-release of the primary pointer button.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub singleclick: Option<bool>,
/// A double press-release of the primary pointer button.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub doubleclick: Option<bool>,
/// A single press-release of the middle pointer button.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub middleclick: Option<bool>,
/// A single press-release of the secondary pointer button.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub rightclick: Option<bool>,
/// A single press of the primary pointer button.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub singlehold: Option<bool>,
/// A single release of the primary pointer button.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub singlerelease: Option<bool>,
/// A double precision integer indicating a relative position delta for the pointer on the X-axis.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub dx: Option<i64>,
/// A double precision integer indicating a relative position delta for the pointer on the Y-axis.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub dy: Option<i64>,
/// Whether the associated dx or dy movement is a scroll event.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub scroll: Option<bool>,
/// Indicates the packet is a confirmation of a request. Always true and always present.
pub is_ack: bool,
}
/// This packet is a keyboard status update.
///
/// <https://invent.kde.org/network/kdeconnect-meta/blob/master/protocol.md#kdeconnectmousepadkeyboardstate>
#[derive(Serialize, Deserialize, Debug, Clone)]
#[serde(rename_all = "camelCase")]
pub struct MousepadKeyboardStatePacket {
/// Indicates the keyboard is ready to receive keypress events.
pub state: bool,
}
/// This packet is a request for a pointer or keyboard event.
///
/// <https://invent.kde.org/network/kdeconnect-meta/blob/master/protocol.md#kdeconnectmousepadrequest>
#[derive(Serialize, Deserialize, Debug, Clone)]
#[serde(rename_all = "camelCase")]
pub struct MousepadRequestPacket {
/// A request to press-release a single readable character, which may be a unicode character and thus more than one byte.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub key: Option<String>,
/// A request to press-release a single non-printable character, usually a control character or function key such as Backspace or F10.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub special_key: Option<u8>,
/// Indicates whether the Alt modifier should be applied to the associated key or specialKey.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub alt: Option<bool>,
/// Indicates whether the Control modifier should be applied to the associated key or specialKey.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub ctrl: Option<bool>,
/// Indicates whether the Shift modifier should be applied to the associated key or specialKey.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub shift: Option<bool>,
/// Indicates whether the Super modifier should be applied to the associated key or specialKey.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
#[serde(rename = "super")]
pub super_: Option<bool>,
/// A single press-release of the primary pointer button.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub singleclick: Option<bool>,
/// A double press-release of the primary pointer button.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub doubleclick: Option<bool>,
/// A single press-release of the middle pointer button.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub middleclick: Option<bool>,
/// A single press-release of the secondary pointer button.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub rightclick: Option<bool>,
/// A single press of the primary pointer button.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub singlehold: Option<bool>,
/// A single release of the primary pointer button.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub singlerelease: Option<bool>,
/// A double precision integer indicating a position delta on the X-axis.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub dx: Option<i64>,
/// A double precision integer indicating a position delta on the Y-axis.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub dy: Option<i64>,
/// Whether the associated dx or dy movement is a scroll event.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub scroll: Option<bool>,
/// Indicates that the devices wants a kdeconnect.mousepad.echo packet as confirmation of a keyboard event.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub send_ack: Option<bool>,
}