mirror of
https://github.com/arampoire/nut-rs.git
synced 2025-11-30 16:20:25 -05:00
WIP clientbound
This commit is contained in:
parent
dab761acb7
commit
50b2d3190e
2 changed files with 40 additions and 0 deletions
35
rups/src/proto/client.rs
Normal file
35
rups/src/proto/client.rs
Normal file
|
|
@ -0,0 +1,35 @@
|
||||||
|
use crate::proto::impl_sentences;
|
||||||
|
|
||||||
|
impl_sentences! {
|
||||||
|
/// Server responds with the number of prior logins to the given `ups_name` device.
|
||||||
|
RespondNumLogins (
|
||||||
|
{
|
||||||
|
0: NumLogins,
|
||||||
|
1: Arg,
|
||||||
|
2: Arg,
|
||||||
|
3: EOL,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
/// The name of the UPS device.
|
||||||
|
1: ups_name,
|
||||||
|
/// The number of logins to the UPS device.
|
||||||
|
2: num_logins,
|
||||||
|
}
|
||||||
|
),
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::Sentences;
|
||||||
|
use crate::proto::test_encode_decode;
|
||||||
|
#[test]
|
||||||
|
fn test_encode_decode() {
|
||||||
|
test_encode_decode!(
|
||||||
|
["NUMLOGINS", "nutdev", "42"] <=>
|
||||||
|
Sentences::RespondNumLogins {
|
||||||
|
ups_name: "nutdev".into(),
|
||||||
|
num_logins: "42".into(),
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,3 +1,8 @@
|
||||||
|
/// Client-bound protocol implementation.
|
||||||
|
///
|
||||||
|
/// "Client-bound" implies commands RECEIVED and DECODED by the client. The server implementation
|
||||||
|
/// must use the same messages to ENCODE and SEND.
|
||||||
|
pub mod client;
|
||||||
/// Server-bound protocol implementation.
|
/// Server-bound protocol implementation.
|
||||||
///
|
///
|
||||||
/// "Server-bound" implies commands RECEIVED and DECODED by the server. The client implementation
|
/// "Server-bound" implies commands RECEIVED and DECODED by the server. The client implementation
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue