kdeconnect_proto/packet/lock.rs
1//! The Lock plugin allows requesting a device to lock or unlock.
2use serde::{Deserialize, Serialize};
3
4/// This packet is a lock status update.
5///
6/// <https://invent.kde.org/network/kdeconnect-meta/blob/master/protocol.md#kdeconnectlock>
7#[derive(Serialize, Deserialize, Debug, Clone)]
8#[serde(rename_all = "camelCase")]
9pub struct LockPacket {
10 /// Indicates the current locked status of the device. If true the device is locked and false if unlocked.
11 pub is_locked: bool,
12}
13
14/// This packet is a request for a lock status update or change.
15///
16/// <https://invent.kde.org/network/kdeconnect-meta/blob/master/protocol.md#kdeconnectlockrequest>
17#[derive(Serialize, Deserialize, Debug, Clone)]
18#[serde(rename_all = "camelCase")]
19pub struct LockRequestPacket {
20 /// A request to change the locked status. If true the device will be locked or if false unlocked.
21 #[serde(skip_serializing_if = "Option::is_none")]
22 #[serde(default)]
23 pub set_locked: Option<bool>,
24
25 /// Indicates this is a request for the current locked status. Always true, if present.
26 #[serde(skip_serializing_if = "Option::is_none")]
27 #[serde(default)]
28 pub request_locked: Option<bool>,
29}