pub struct NetworkPacket {
pub body: NetworkPacketBody,
pub range: Option<i64>,
pub payload_transfer_info: Option<HashMap<String, Value>>,
/* private fields */
}Expand description
A root packet structured as defined in the KDE Connection specification.
https://invent.kde.org/network/kdeconnect-meta/blob/master/protocol.md#kdeconnect
Fields§
§body: NetworkPacketBodyA dictionary of parameters appropriate for the packet type.
range: Option<i64>The size of the payload to expect. There is a currently unused convention of using -1 to declare a stream of indefinite size.
payload_transfer_info: Option<HashMap<String, Value>>A dictionary of properties necessary for clients to negotiate a transfer channel.
Implementations§
Source§impl NetworkPacket
impl NetworkPacket
Sourcepub fn battery(current_charge: i8, is_charging: bool) -> Self
pub fn battery(current_charge: i8, is_charging: bool) -> Self
Make a NetworkPacket with a BatteryPacket payload.
Sourcepub fn battery_with_threshold(
current_charge: i8,
is_charging: bool,
threshold_event: u8,
) -> Self
pub fn battery_with_threshold( current_charge: i8, is_charging: bool, threshold_event: u8, ) -> Self
Make a NetworkPacket with a BatteryPacket payload and a threshold event.
Source§impl NetworkPacket
impl NetworkPacket
Sourcepub fn pair_request(timestamp: u64) -> Self
pub fn pair_request(timestamp: u64) -> Self
Make a NetworkPacket with a PairPacket payload ready to make a pair request.
Sourcepub fn pair_response() -> Self
pub fn pair_response() -> Self
Make a NetworkPacket with a PairPacket payload ready to make a pair response.
Sourcepub fn unpair_request() -> Self
pub fn unpair_request() -> Self
Make a NetworkPacket with a PairPacket payload ready to make an unpair request.
Sourcepub fn unpair_response() -> Self
pub fn unpair_response() -> Self
Make a NetworkPacket with a PairPacket payload ready to make an unpair responsee.
Source§impl NetworkPacket
impl NetworkPacket
Sourcepub fn ping<T: Into<String>>(message: T) -> Self
pub fn ping<T: Into<String>>(message: T) -> Self
Make a NetworkPacket with a PingPacket payload.
Sourcepub fn ping_empty_msg() -> Self
pub fn ping_empty_msg() -> Self
Make a NetworkPacket with a PingPacket payload and no message.
Source§impl NetworkPacket
impl NetworkPacket
Sourcepub fn run_command_list_response(
command_list: &HashMap<String, RunCommandValue>,
) -> Self
pub fn run_command_list_response( command_list: &HashMap<String, RunCommandValue>, ) -> Self
Make a NetworkPacket with a RunCommandPacket payload listing all available commands.
Sourcepub fn run_command_request_list() -> Self
pub fn run_command_request_list() -> Self
Make a NetworkPacket with a RunCommandRequestPacket payload ready to request the
list of commands.
Sourcepub fn run_command_exec<T: Into<String>>(key: T) -> Self
pub fn run_command_exec<T: Into<String>>(key: T) -> Self
Make a NetworkPacket with a RunCommandRequestPacket payload asking to execute the
provided command.
Source§impl NetworkPacket
impl NetworkPacket
Sourcepub fn new(body: NetworkPacketBody) -> Self
pub fn new(body: NetworkPacketBody) -> Self
Make a new NetworkPacket with the corresponding body.
The type will be inferred from the body variant.
Trait Implementations§
Source§impl Clone for NetworkPacket
impl Clone for NetworkPacket
Source§fn clone(&self) -> NetworkPacket
fn clone(&self) -> NetworkPacket
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more