Skip to content

Commit 6fc11f4

Browse files
committed
SendStatus
1 parent 9c20e77 commit 6fc11f4

3 files changed

Lines changed: 17 additions & 2 deletions

File tree

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "firefly-types"
3-
version = "0.6.0"
3+
version = "0.6.1"
44
rust-version = "1.82.0"
55
edition = "2021"
66
authors = ["Firefly Zero team"]

src/spi.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ pub enum Request<'a> {
1616
NetRecv,
1717
/// Send an outgoing message to the IO chip.
1818
NetSend([u8; 6], &'a [u8]),
19+
/// Get send status of the previous message for the peer.
20+
NetSendStatus([u8; 6]),
1921
/// Get the latest touchpad and buttons inputs.
2022
ReadInput,
2123
}
@@ -33,7 +35,20 @@ pub enum Response<'a> {
3335
NetIncoming([u8; 6], &'a [u8]),
3436
NetNoIncoming,
3537
NetSent,
38+
NetSendStatus(SendStatus),
3639
Input(Option<(u16, u16)>, u8),
3740
}
3841

3942
impl<'a> Encode<'a> for Response<'a> {}
43+
44+
#[derive(Serialize, Deserialize, Clone, Copy, Debug, PartialEq)]
45+
pub enum SendStatus {
46+
/// Trying to send the message. The value is the number of attempts so far.
47+
Sending(u8),
48+
/// Message is delivered. The value is the number of attempts that it took.
49+
Delivered(u8),
50+
/// Message delivery failed.
51+
Failed,
52+
/// No messages were sent to the peer.
53+
Empty,
54+
}

0 commit comments

Comments
 (0)