kdeconnect-proto 0.1.1

A pure Rust modular implementation of the KDE Connect protocol
Documentation
//! The Connectivity Report plugin allows a device to expose the status of its connectivity.
use hashbrown::HashMap;
use serde::{Deserialize, Serialize};

#[cfg(not(feature = "std"))]
use alloc::string::String;

/// The ID of the connection.
#[derive(Serialize, Deserialize, Debug, Clone)]
#[serde(rename_all = "camelCase")]
pub struct ConnectivityReportSignal {
    /// The network type.
    pub network_type: String,

    /// The signal strength. Values 0 through 4 describe the coarse strength of the signal.
    pub signal_strength: u8,
}

/// This packet is a connectivity report.
///
/// <https://invent.kde.org/network/kdeconnect-meta/blob/master/protocol.md#kdeconnectconnectivity_report>
#[derive(Serialize, Deserialize, Debug, Clone)]
#[serde(rename_all = "camelCase")]
pub struct ConnectivityReportPacket {
    /// A dictionary of signal states. Each key is an arbitrary, but unique, string and each value is a [`ConnectivityReportSignal`] object.
    pub signal_strengths: HashMap<String, ConnectivityReportSignal>,
}