pub struct MorseDecoder<const MSG_MAX: usize> {
pub message: Message<MSG_MAX>,
/* private fields */
}
Expand description
This is the concrete implementation of the decoder.
It doesn’t have a new function, or public data members, so to get an instance of it, use public builder interface Decoder.
Fields§
§message: Message<MSG_MAX>
Implementations§
Source§impl<const MSG_MAX: usize> MorseDecoder<MSG_MAX>
impl<const MSG_MAX: usize> MorseDecoder<MSG_MAX>
Sourcepub fn get_reference_short(&self) -> u16
pub fn get_reference_short(&self) -> u16
Returns currently resolved reference short signal duration.
Reference short signal is resolved continuously by the decoder as signal events pour in. As longer signal durations are calculated by multiplying this value, it might be useful for the client code.
Sourcepub fn get_wpm(&self) -> u16
pub fn get_wpm(&self) -> u16
Returns the current signal entry speed in Words Per Minute format.
Sourcepub fn get_last_decoded_char(&self) -> Character
pub fn get_last_decoded_char(&self) -> Character
Returns last decoded character for easy access.
Sourcepub fn add_signal_to_character(&mut self, signal: Option<MorseSignal>)
pub fn add_signal_to_character(&mut self, signal: Option<MorseSignal>)
Directly add a prepared signal to the character.
Signal duration resolving is done by the client code, or you’re using a prepared signal.
Sourcepub fn add_current_char_to_message(&mut self)
pub fn add_current_char_to_message(&mut self)
Add current decoded character to the message.
This happens automatically when using signal_event
calls.
Use this with add_signal_to_character
directly with
prepared MorseSignal enums.
Sourcepub fn signal_event_end(&mut self, end_word: bool)
pub fn signal_event_end(&mut self, end_word: bool)
Manually end a sequence of signals.
This decodes the current character and moves to the next one. With end_word flag it will optionally add a space after it. Especially useful when client code can’t determine if signal input by the operator ended, because no other high signal is following the low signal at the end. At that point a separate button or whatever can be used to trigger this function.
Sourcepub fn signal_event(&mut self, duration_ms: u16, is_high: bool)
pub fn signal_event(&mut self, duration_ms: u16, is_high: bool)
Send signal events to the decoder, filling signal buffer one event at a time.
When a character ending long space signal or a word ending long space is sent,
signal buffer will be decoded automatically and character will be added to message.
Note that if signal input itself has ended, oftentimes there’s no way to send that signal.
Use signal_event_end
at that point to manually end the character.