Message

Enum Message 

Source
pub enum Message {
    StartOfMessage(MessageHeader),
    EndOfMessage,
}
Expand description

A fully-decoded SAME/EAS message

In order to automatically disseminate alerts, SAME/EAS wraps a voice message in digital data. The digital data demarcates the StartOfMessage and the EndOfMessage. Again, the digital data is not the message. The “message” in EAS is the voice message that is intended for a human listener.

With that said, the digital headers provide a good deal of information about the message.

  1. The StartOfMessage contains digital codes and timestamps which summarize the audio message to follow. Some messages are intended for either silent or audible tests. Others report actual emergencies; these either may or must interrupt normal broadcast programming.

  2. The voice message immediately follows. The voice message may be up to two minutes long and is intended for streaming playback. This datatype does not represent the audio.

  3. The EndOfMessage demarcates the end of the audio message.

Message implements Display and efficient conversion to &str. These methods output the wireline text representation, such as “ZCZC-...” for StartOfMessage and NNNN for EndOfMessage.

More information on the SAME/EAS standard may be found in,

Variants§

§

StartOfMessage(MessageHeader)

Indicates start of audio message

A StartOfMessage indicates that a SAME/EAS audio message immediately follows. The message header contains the event type, affected areas, time extents, and originator information.

For broadcast stations, the in-band audio which immediately follows the StartOfMessage may break station programming and be aired directly to listeners.

§

EndOfMessage

Indicates end of audio message

An EndOfMessage marks the conclusion of the SAME/EAS audio message. For broadcast stations, it is an indication that normal programming may resume.

Implementations§

Source§

impl Message

Source

pub fn as_str(&self) -> &str

Wireline Text Representation

Outputs UTF-8 string representation: i.e., ZCZC-... for start-of-message or NNNN for end-of-message.

Source

pub fn parity_error_count(&self) -> usize

Count of parity errors

The number of bit errors which were corrected by the 2-of-3 parity correction algorithm. High parity error counts indicate a high bit error rate in the receiving system.

Parity errors are not tracked for the EndOfMessage variant. Parity errors are only tracked within sameold and aren’t available for Messages constructed from string.

Source

pub fn voting_byte_count(&self) -> usize

Number of bytes which were bit-voted

voting_byte_count is the total number of bytes which were checked via the “two of three” bitwise voting algorithm—i.e., the total number of bytes for which all three SAME bursts were available.

Voting counts are not tracked for the EndOfMessage variant. Voting counts are only tracked within sameold and aren’t available for Messages constructed from string.

Trait Implementations§

Source§

impl AsRef<str> for Message

Source§

fn as_ref(&self) -> &str

Wireline Text Representation

Outputs UTF-8 string representation: i.e., ZCZC-... for start-of-message or NNNN for end-of-message.

Source§

impl Clone for Message

Source§

fn clone(&self) -> Message

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Message

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Display for Message

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Wireline Text Representation

Outputs UTF-8 string representation: i.e., ZCZC-... for start-of-message or NNNN for end-of-message.

Source§

impl Hash for Message

Source§

fn hash<__H>(&self, state: &mut __H)
where __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Message

Source§

fn eq(&self, other: &Message) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl TryFrom<(&[u8], &[u8], &[u8])> for Message

Source§

type Error = MessageDecodeErr

The type returned in the event of a conversion error.
Source§

fn try_from( inp: (&[u8], &[u8], &[u8]), ) -> Result<Message, <Message as TryFrom<(&[u8], &[u8], &[u8])>>::Error>

Performs the conversion.
Source§

impl TryFrom<(String, &[u8])> for Message

Source§

type Error = MessageDecodeErr

The type returned in the event of a conversion error.
Source§

fn try_from( inp: (String, &[u8]), ) -> Result<Message, <Message as TryFrom<(String, &[u8])>>::Error>

Performs the conversion.
Source§

impl TryFrom<String> for Message

Source§

type Error = MessageDecodeErr

The type returned in the event of a conversion error.
Source§

fn try_from(inp: String) -> Result<Message, <Message as TryFrom<String>>::Error>

Performs the conversion.
Source§

impl Eq for Message

Source§

impl StructuralPartialEq for Message

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Scalar for T
where T: 'static + Clone + PartialEq + Debug,