Skip to content

Commit 1494a8b

Browse files
committed
expose ButtonEvent members
this is done using methods instead of just making the member fields `pub` so that they can't be changed. the same will have to be done for all other events to make them usable.
1 parent 704f1bf commit 1494a8b

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/bluefruit_protocol/button_event.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,3 +82,12 @@ impl TryFrom<&[u8]> for ButtonEvent {
8282
}
8383
}
8484
}
85+
86+
impl ButtonEvent {
87+
pub fn button(&self) -> &Button {
88+
&self.button
89+
}
90+
pub fn state(&self) -> &ButtonState {
91+
&self.state
92+
}
93+
}

src/bluefruit_protocol/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ pub fn parse<const MAX_RESULTS: usize>(
113113
}
114114
}
115115
ParserState::ParseCommand => {
116-
let data_package = extract_and_parse_command(&input[(pos-1)..]);
116+
let data_package = extract_and_parse_command(&input[(pos - 1)..]);
117117
result.push(data_package).ok();
118118
if result.len() == MAX_RESULTS {
119119
return result;

0 commit comments

Comments
 (0)